diff --git a/ApiApp/ApiApp.csproj b/ApiApp/ApiApp.csproj index 1473481..109559b 100644 --- a/ApiApp/ApiApp.csproj +++ b/ApiApp/ApiApp.csproj @@ -10,7 +10,7 @@ - + diff --git a/ClientApp/ClientApp.csproj b/ClientApp/ClientApp.csproj index 9763fe1..f854b09 100644 --- a/ClientApp/ClientApp.csproj +++ b/ClientApp/ClientApp.csproj @@ -8,8 +8,8 @@ - - + + diff --git a/ClientApp/ClientApp/app/app.module.shared.ts b/ClientApp/ClientApp/app/app.module.shared.ts index 2c13f1f..f536c71 100644 --- a/ClientApp/ClientApp/app/app.module.shared.ts +++ b/ClientApp/ClientApp/app/app.module.shared.ts @@ -1,7 +1,7 @@ import { NgModule } from '@angular/core'; import { CommonModule } from '@angular/common'; import { FormsModule } from '@angular/forms'; -import { HttpModule } from '@angular/http'; +import { HttpClientModule } from '@angular/common/http'; import { RouterModule } from '@angular/router'; import { AppComponent } from './components/app/app.component' @@ -26,7 +26,7 @@ import { AuthService } from './components/services/auth.service'; imports: [ AuthModule.forRoot(), CommonModule, - HttpModule, + HttpClientModule, FormsModule, RouterModule.forRoot([ { path: '', redirectTo: 'home', pathMatch: 'full' }, diff --git a/ClientApp/ClientApp/app/components/fetchdata/fetchdata.component.ts b/ClientApp/ClientApp/app/components/fetchdata/fetchdata.component.ts index 0bf69b6..be562ba 100644 --- a/ClientApp/ClientApp/app/components/fetchdata/fetchdata.component.ts +++ b/ClientApp/ClientApp/app/components/fetchdata/fetchdata.component.ts @@ -10,7 +10,7 @@ export class FetchDataComponent { constructor(authService: AuthService, @Inject('API_URL') apiUrl: string) { authService.get(apiUrl + 'SampleData/WeatherForecasts').subscribe(result => { - this.forecasts = result.json() as WeatherForecast[]; + this.forecasts = result as WeatherForecast[]; }, error => console.error(error)); } } diff --git a/ClientApp/ClientApp/app/components/services/auth.service.ts b/ClientApp/ClientApp/app/components/services/auth.service.ts index 7bde8bb..8474d8e 100644 --- a/ClientApp/ClientApp/app/components/services/auth.service.ts +++ b/ClientApp/ClientApp/app/components/services/auth.service.ts @@ -1,5 +1,5 @@ import { Injectable, Component, OnInit, OnDestroy, Inject } from '@angular/core'; -import { Http, Headers, RequestOptions, Response } from '@angular/http'; +import { HttpClient, HttpHeaders } from '@angular/common/http'; import { Observable } from 'rxjs/Rx'; import { Subscription } from 'rxjs/Subscription'; @@ -11,7 +11,7 @@ export class AuthService implements OnInit, OnDestroy { isAuthorized: boolean; constructor(public oidcSecurityService: OidcSecurityService, - private http: Http, + private http: HttpClient, @Inject('ORIGIN_URL') originUrl: string, @Inject('IDENTITY_URL') identityUrl: string ) { @@ -77,52 +77,36 @@ export class AuthService implements OnInit, OnDestroy { } } - get(url: string, options?: RequestOptions): Observable { - return this.http.get(url, this.setRequestOptions(options)); + get(url: string): Observable { + return this.http.get(url, { headers: this.getHeaders() }); } - put(url: string, data: any, options?: RequestOptions): Observable { + put(url: string, data: any): Observable { const body = JSON.stringify(data); - return this.http.put(url, body, this.setRequestOptions(options)); + return this.http.put(url, body, { headers: this.getHeaders() }); } - delete(url: string, options?: RequestOptions): Observable { - return this.http.delete(url, this.setRequestOptions(options)); + delete(url: string): Observable { + return this.http.delete(url, { headers: this.getHeaders() }); } - post(url: string, data: any, options?: RequestOptions): Observable { + post(url: string, data: any): Observable { const body = JSON.stringify(data); - return this.http.post(url, body, this.setRequestOptions(options)); - } - - private setRequestOptions(options?: RequestOptions | null) { - if (options) { - this.appendAuthHeader(options.headers); - } - else { - options = new RequestOptions({ headers: this.getHeaders(), body: "" }); - } - return options; + return this.http.post(url, body, { headers: this.getHeaders() }); } private getHeaders() { - const headers = new Headers(); - headers.append('Content-Type', 'application/json'); - this.appendAuthHeader(headers); - return headers; + let headers = new HttpHeaders(); + headers = headers.set('Content-Type', 'application/json'); + return this.appendAuthHeader(headers); } - private appendAuthHeader(headers?: Headers | null) { - - if (headers == null) headers = this.getHeaders(); - + private appendAuthHeader(headers: HttpHeaders) { const token = this.oidcSecurityService.getToken(); - if (token == '') return; + if (token === '') return headers; const tokenValue = 'Bearer ' + token; - headers.append('Authorization', tokenValue); + return headers.set('Authorization', tokenValue); } - - } \ No newline at end of file diff --git a/ClientApp/ClientApp/boot.server.ts b/ClientApp/ClientApp/boot.server.ts index 166bcb1..4aa6423 100644 --- a/ClientApp/ClientApp/boot.server.ts +++ b/ClientApp/ClientApp/boot.server.ts @@ -23,7 +23,7 @@ export default createServerRenderer(params => { return platformDynamicServer(providers).bootstrapModule(AppModule).then(moduleRef => { const appRef: ApplicationRef = moduleRef.injector.get(ApplicationRef); const state = moduleRef.injector.get(PlatformState); - const zone = moduleRef.injector.get(NgZone); + const zone: NgZone = moduleRef.injector.get(NgZone); return new Promise((resolve, reject) => { zone.onError.subscribe((errorInfo: any) => reject(errorInfo)); diff --git a/ClientApp/ClientApp/dist/main-server.js b/ClientApp/ClientApp/dist/main-server.js index 40edab8..ae8e270 100644 --- a/ClientApp/ClientApp/dist/main-server.js +++ b/ClientApp/ClientApp/dist/main-server.js @@ -63,6130 +63,14655 @@ /******/ __webpack_require__.p = "dist/"; /******/ /******/ // Load entry module and return exports -/******/ return __webpack_require__(__webpack_require__.s = 100); +/******/ return __webpack_require__(__webpack_require__.s = 70); /******/ }) /************************************************************************/ /******/ ([ /* 0 */ -/***/ (function(module, exports, __webpack_require__) { - -module.exports = (__webpack_require__(1))(0); - -/***/ }), -/* 1 */ /***/ (function(module, exports) { module.exports = require("./vendor"); /***/ }), -/* 2 */ +/* 1 */ /***/ (function(module, exports, __webpack_require__) { -module.exports = (__webpack_require__(1))(2); +"use strict"; + +var DOMException = __webpack_require__(30); +var ERR = DOMException; +var isApiWritable = __webpack_require__(43).isApiWritable; -/***/ }), -/* 3 */ -/***/ (function(module, exports, __webpack_require__) { +exports.NAMESPACE = { + HTML: 'http://www.w3.org/1999/xhtml', + XML: 'http://www.w3.org/XML/1998/namespace', + XMLNS: 'http://www.w3.org/2000/xmlns/', + MATHML: 'http://www.w3.org/1998/Math/MathML', + SVG: 'http://www.w3.org/2000/svg', + XLINK: 'http://www.w3.org/1999/xlink' +}; -module.exports = (__webpack_require__(1))(10); +// +// Shortcut functions for throwing errors of various types. +// +exports.IndexSizeError = function() { throw new DOMException(ERR.INDEX_SIZE_ERR); }; +exports.HierarchyRequestError = function() { throw new DOMException(ERR.HIERARCHY_REQUEST_ERR); }; +exports.WrongDocumentError = function() { throw new DOMException(ERR.WRONG_DOCUMENT_ERR); }; +exports.InvalidCharacterError = function() { throw new DOMException(ERR.INVALID_CHARACTER_ERR); }; +exports.NoModificationAllowedError = function() { throw new DOMException(ERR.NO_MODIFICATION_ALLOWED_ERR); }; +exports.NotFoundError = function() { throw new DOMException(ERR.NOT_FOUND_ERR); }; +exports.NotSupportedError = function() { throw new DOMException(ERR.NOT_SUPPORTED_ERR); }; +exports.InvalidStateError = function() { throw new DOMException(ERR.INVALID_STATE_ERR); }; +exports.SyntaxError = function() { throw new DOMException(ERR.SYNTAX_ERR); }; +exports.InvalidModificationError = function() { throw new DOMException(ERR.INVALID_MODIFICATION_ERR); }; +exports.NamespaceError = function() { throw new DOMException(ERR.NAMESPACE_ERR); }; +exports.InvalidAccessError = function() { throw new DOMException(ERR.INVALID_ACCESS_ERR); }; +exports.TypeMismatchError = function() { throw new DOMException(ERR.TYPE_MISMATCH_ERR); }; +exports.SecurityError = function() { throw new DOMException(ERR.SECURITY_ERR); }; +exports.NetworkError = function() { throw new DOMException(ERR.NETWORK_ERR); }; +exports.AbortError = function() { throw new DOMException(ERR.ABORT_ERR); }; +exports.UrlMismatchError = function() { throw new DOMException(ERR.URL_MISMATCH_ERR); }; +exports.QuotaExceededError = function() { throw new DOMException(ERR.QUOTA_EXCEEDED_ERR); }; +exports.TimeoutError = function() { throw new DOMException(ERR.TIMEOUT_ERR); }; +exports.InvalidNodeTypeError = function() { throw new DOMException(ERR.INVALID_NODE_TYPE_ERR); }; +exports.DataCloneError = function() { throw new DOMException(ERR.DATA_CLONE_ERR); }; -/***/ }), -/* 4 */ -/***/ (function(module, exports, __webpack_require__) { +exports.nyi = function() { + throw new Error("NotYetImplemented"); +}; -module.exports = (__webpack_require__(1))(8); +exports.assert = function(expr, msg) { + if (!expr) { + throw new Error("Assertion failed: " + (msg || "") + "\n" + new Error().stack); + } +}; -/***/ }), -/* 5 */ -/***/ (function(module, exports, __webpack_require__) { +exports.expose = function(src, c) { + for (var n in src) { + Object.defineProperty(c.prototype, n, { value: src[n], writable: isApiWritable }); + } +}; -module.exports = (__webpack_require__(1))(29); +exports.merge = function(a, b) { + for (var n in b) { + a[n] = b[n]; + } +}; -/***/ }), -/* 6 */ -/***/ (function(module, exports, __webpack_require__) { +// Compare two nodes based on their document order. This function is intended +// to be passed to sort(). Assumes that the array being sorted does not +// contain duplicates. And that all nodes are connected and comparable. +// Clever code by ppk via jeresig. +exports.documentOrder = function(n,m) { + /* jshint bitwise: false */ + return 3 - (n.compareDocumentPosition(m) & 6); +}; + +exports.toASCIILowerCase = function(s) { + return s.replace(/[A-Z]+/g, function(t) { return t.toLowerCase(); }); +}; -module.exports = (__webpack_require__(1))(6); /***/ }), -/* 7 */ +/* 2 */ /***/ (function(module, exports, __webpack_require__) { -module.exports = (__webpack_require__(1))(92); +module.exports = (__webpack_require__(0))(0); /***/ }), -/* 8 */ +/* 3 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -var AsyncAction_1 = __webpack_require__(20); -var AsyncScheduler_1 = __webpack_require__(21); -/** - * - * Async Scheduler - * - * Schedule task as if you used setTimeout(task, duration) - * - * `async` scheduler schedules tasks asynchronously, by putting them on the JavaScript - * event loop queue. It is best used to delay tasks in time or to schedule tasks repeating - * in intervals. - * - * If you just want to "defer" task, that is to perform it right after currently - * executing synchronous code ends (commonly achieved by `setTimeout(deferredTask, 0)`), - * better choice will be the {@link asap} scheduler. - * - * @example Use async scheduler to delay task - * const task = () => console.log('it works!'); - * - * Rx.Scheduler.async.schedule(task, 2000); - * - * // After 2 seconds logs: - * // "it works!" - * - * - * @example Use async scheduler to repeat task in intervals - * function task(state) { - * console.log(state); - * this.schedule(state + 1, 1000); // `this` references currently executing Action, - * // which we reschedule with new state and delay - * } - * - * Rx.Scheduler.async.schedule(task, 3000, 0); - * - * // Logs: - * // 0 after 3s - * // 1 after 4s - * // 2 after 5s - * // 3 after 6s - * - * @static true - * @name async - * @owner Scheduler - */ -exports.async = new AsyncScheduler_1.AsyncScheduler(AsyncAction_1.AsyncAction); -//# sourceMappingURL=async.js.map +module.exports = Node; + +var EventTarget = __webpack_require__(33); +var utils = __webpack_require__(1); +var NAMESPACE = utils.NAMESPACE; + +// All nodes have a nodeType and an ownerDocument. +// Once inserted, they also have a parentNode. +// This is an abstract class; all nodes in a document are instances +// of a subtype, so all the properties are defined by more specific +// constructors. +function Node() { +} + +var ELEMENT_NODE = Node.ELEMENT_NODE = 1; +var ATTRIBUTE_NODE = Node.ATTRIBUTE_NODE = 2; +var TEXT_NODE = Node.TEXT_NODE = 3; +var CDATA_SECTION_NODE = Node.CDATA_SECTION_NODE = 4; +var ENTITY_REFERENCE_NODE = Node.ENTITY_REFERENCE_NODE = 5; +var ENTITY_NODE = Node.ENTITY_NODE = 6; +var PROCESSING_INSTRUCTION_NODE = Node.PROCESSING_INSTRUCTION_NODE = 7; +var COMMENT_NODE = Node.COMMENT_NODE = 8; +var DOCUMENT_NODE = Node.DOCUMENT_NODE = 9; +var DOCUMENT_TYPE_NODE = Node.DOCUMENT_TYPE_NODE = 10; +var DOCUMENT_FRAGMENT_NODE = Node.DOCUMENT_FRAGMENT_NODE = 11; +var NOTATION_NODE = Node.NOTATION_NODE = 12; + +var DOCUMENT_POSITION_DISCONNECTED = Node.DOCUMENT_POSITION_DISCONNECTED = 0x01; +var DOCUMENT_POSITION_PRECEDING = Node.DOCUMENT_POSITION_PRECEDING = 0x02; +var DOCUMENT_POSITION_FOLLOWING = Node.DOCUMENT_POSITION_FOLLOWING = 0x04; +var DOCUMENT_POSITION_CONTAINS = Node.DOCUMENT_POSITION_CONTAINS = 0x08; +var DOCUMENT_POSITION_CONTAINED_BY = Node.DOCUMENT_POSITION_CONTAINED_BY = 0x10; +var DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC = Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC = 0x20; + +var hasRawContent = { + STYLE: true, + SCRIPT: true, + XMP: true, + IFRAME: true, + NOEMBED: true, + NOFRAMES: true, + PLAINTEXT: true +}; + +var emptyElements = { + area: true, + base: true, + basefont: true, + bgsound: true, + br: true, + col: true, + embed: true, + frame: true, + hr: true, + img: true, + input: true, + keygen: true, + link: true, + meta: true, + param: true, + source: true, + track: true, + wbr: true +}; + +var extraNewLine = { + /* Removed in https://github.com/whatwg/html/issues/944 + pre: true, + textarea: true, + listing: true + */ +}; + +Node.prototype = Object.create(EventTarget.prototype, { + + // Node that are not inserted into the tree inherit a null parent + parentNode: { value: null, writable: true }, + + // XXX: the baseURI attribute is defined by dom core, but + // a correct implementation of it requires HTML features, so + // we'll come back to this later. + baseURI: { get: utils.nyi }, + + parentElement: { get: function() { + return (this.parentNode && this.parentNode.nodeType===ELEMENT_NODE) ? this.parentNode : null; + }}, + + hasChildNodes: { value: function() { // Overridden in leaf.js + return this.childNodes.length > 0; + }}, + + firstChild: { get: function() { + return this.childNodes.length === 0 ? null : this.childNodes[0]; + }}, + + lastChild: { get: function() { + return this.childNodes.length === 0 ? null : this.childNodes[this.childNodes.length-1]; + }}, + + previousSibling: { get: function() { + if (!this.parentNode) return null; + var sibs = this.parentNode.childNodes, i = this.index; + return i === 0 ? null : sibs[i-1]; + }}, + + nextSibling: { get: function() { + if (!this.parentNode) return null; + var sibs = this.parentNode.childNodes, i = this.index; + return i+1 === sibs.length ? null : sibs[i+1]; + }}, + + + _countChildrenOfType: { value: function(type) { + var sum = 0, nodes = this.childNodes, length = nodes.length, i; + for (i=0; i 0) + utils.HierarchyRequestError(); + switch (node._countChildrenOfType(ELEMENT_NODE)) { + case 0: + break; + case 1: + // 6a2. Otherwise, if node has one element child and either + // parent has an element child, child is a doctype, or child + // is not null and a doctype is following child. [preinsert] + // 6a2. Otherwise, if node has one element child and either + // parent has an element child that is not child or a + // doctype is following child. [replaceWith] + if (child !== null /* always true here for replaceWith */) { + if (isPreinsert && child.nodeType === DOCUMENT_TYPE_NODE) + utils.HierarchyRequestError(); + for (i=parent.childNodes.length-1; i>=0; i--) { + if (parent.childNodes[i] === child) break; + if (parent.childNodes[i].nodeType === DOCUMENT_TYPE_NODE) + utils.HierarchyRequestError(); + } + } + i = parent._countChildrenOfType(ELEMENT_NODE); + if (isPreinsert) { + // "parent has an element child" + if (i > 0) + utils.HierarchyRequestError(); + } else { + // "parent has an element child that is not child" + if (i > 1 || (i === 1 && child.nodeType !== ELEMENT_NODE)) + utils.HierarchyRequestError(); + } + break; + default: // 6a1, continued. (more than one Element child) + utils.HierarchyRequestError(); + } + break; + case ELEMENT_NODE: + // 6b. parent has an element child, child is a doctype, or + // child is not null and a doctype is following child. [preinsert] + // 6b. parent has an element child that is not child or a + // doctype is following child. [replaceWith] + if (child !== null /* always true here for replaceWith */) { + if (isPreinsert && child.nodeType === DOCUMENT_TYPE_NODE) + utils.HierarchyRequestError(); + for (i=parent.childNodes.length-1; i>=0; i--) { + if (parent.childNodes[i] === child) break; + if (parent.childNodes[i].nodeType === DOCUMENT_TYPE_NODE) + utils.HierarchyRequestError(); + } + } + i = parent._countChildrenOfType(ELEMENT_NODE); + if (isPreinsert) { + // "parent has an element child" + if (i > 0) + utils.HierarchyRequestError(); + } else { + // "parent has an element child that is not child" + if (i > 1 || (i === 1 && child.nodeType !== ELEMENT_NODE)) + utils.HierarchyRequestError(); + } + break; + case DOCUMENT_TYPE_NODE: + // 6c. parent has a doctype child, child is non-null and an + // element is preceding child, or child is null and parent has + // an element child. [preinsert] + // 6c. parent has a doctype child that is not child, or an + // element is preceding child. [replaceWith] + if (child === null) { + if (parent._countChildrenOfType(ELEMENT_NODE)) + utils.HierarchyRequestError(); + } else { + // child is always non-null for [replaceWith] case + for (i=0; i 0) + utils.HierarchyRequestError(); + } else { + // "parent has an doctype child that is not child" + if (i > 1 || (i === 1 && child.nodeType !== DOCUMENT_TYPE_NODE)) + utils.HierarchyRequestError(); + } + break; + } + } else { + // 5, continued: (parent is not a document) + if (node.nodeType === DOCUMENT_TYPE_NODE) utils.HierarchyRequestError(); + } + }}, + + insertBefore: { value: function insertBefore(node, child) { + var parent = this; + // 1. Ensure pre-insertion validity + parent._ensureInsertValid(node, child, true); + // 2. Let reference child be child. + var refChild = child; + // 3. If reference child is node, set it to node's next sibling + if (refChild === node) { refChild = node.nextSibling; } + // 4. Adopt node into parent's node document. + parent.doc.adoptNode(node); + // 5. Insert node into parent before reference child. + if (refChild === null) { + parent._appendChild(node); + } else { + node.insert(parent, refChild.index); + } + // 6. Return node + return node; + }}, + + + appendChild: { value: function(child) { + // This invokes _appendChild after doing validity checks. + return this.insertBefore(child, null); + }}, + + _appendChild: { value: function(child) { + child.insert(this, this.childNodes.length); + return child; + }}, + + removeChild: { value: function removeChild(child) { + var parent = this; + if (!child.nodeType) throw new TypeError('not a node'); + if (child.parentNode !== parent) utils.NotFoundError(); + child.remove(); + return child; + }}, + + // To replace a `child` with `node` within a `parent` (this) + replaceChild: { value: function replaceChild(node, child) { + var parent = this; + // Ensure validity (slight differences from pre-insertion check) + parent._ensureInsertValid(node, child, false); + // Adopt node into parent's node document. + if (node.doc !== parent.doc) { + // XXX adoptNode has side-effect of removing node from its parent + // and generating a mutation event, thus causing the _insertOrReplace + // to generate two deletes and an insert instead of a 'move' + // event. It looks like the new MutationObserver stuff avoids + // this problem, but for now let's only adopt (ie, remove `node` + // from its parent) here if we need to. + parent.doc.adoptNode(node); + } + // Do the replace. + node._insertOrReplace(parent, child.index, true); + return child; + }}, + + // See: http://ejohn.org/blog/comparing-document-position/ + contains: { value: function contains(node) { + if (node === null) { return false; } + if (this === node) { return true; /* inclusive descendant */ } + /* jshint bitwise: false */ + return (this.compareDocumentPosition(node) & + DOCUMENT_POSITION_CONTAINED_BY) !== 0; + }}, + + compareDocumentPosition: { value: function compareDocumentPosition(that){ + // Basic algorithm for finding the relative position of two nodes. + // Make a list the ancestors of each node, starting with the + // document element and proceeding down to the nodes themselves. + // Then, loop through the lists, looking for the first element + // that differs. The order of those two elements give the + // order of their descendant nodes. Or, if one list is a prefix + // of the other one, then that node contains the other. + + if (this === that) return 0; + + // If they're not owned by the same document or if one is rooted + // and one is not, then they're disconnected. + if (this.doc !== that.doc || + this.rooted !== that.rooted) + return (DOCUMENT_POSITION_DISCONNECTED + + DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC); + + // Get arrays of ancestors for this and that + var these = [], those = []; + for(var n = this; n !== null; n = n.parentNode) these.push(n); + for(n = that; n !== null; n = n.parentNode) those.push(n); + these.reverse(); // So we start with the outermost + those.reverse(); + + if (these[0] !== those[0]) // No common ancestor + return (DOCUMENT_POSITION_DISCONNECTED + + DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC); + + n = Math.min(these.length, those.length); + for(var i = 1; i < n; i++) { + if (these[i] !== those[i]) { + // We found two different ancestors, so compare + // their positions + if (these[i].index < those[i].index) + return DOCUMENT_POSITION_FOLLOWING; + else + return DOCUMENT_POSITION_PRECEDING; + } + } -/***/ }), -/* 9 */ -/***/ (function(module, exports, __webpack_require__) { + // If we get to here, then one of the nodes (the one with the + // shorter list of ancestors) contains the other one. + if (these.length < those.length) + return (DOCUMENT_POSITION_FOLLOWING + + DOCUMENT_POSITION_CONTAINED_BY); + else + return (DOCUMENT_POSITION_PRECEDING + + DOCUMENT_POSITION_CONTAINS); + }}, + + isSameNode: {value : function isSameNode(node) { + return this === node; + }}, + + + // This method implements the generic parts of node equality testing + // and defers to the (non-recursive) type-specific isEqual() method + // defined by subclasses + isEqualNode: { value: function isEqualNode(node) { + if (!node) return false; + if (node.nodeType !== this.nodeType) return false; + + // Check for same number of children + // Check for children this way because it is more efficient + // for childless leaf nodes. + var n; // number of child nodes + if (!this.firstChild) { + n = 0; + if (node.firstChild) return false; + } + else { + n = this.childNodes.length; + if (node.childNodes.length !== n) return false; + } -module.exports = (__webpack_require__(1))(9); + // Check type-specific properties for equality + if (!this.isEqual(node)) return false; -/***/ }), -/* 10 */ -/***/ (function(module, exports, __webpack_require__) { + // Now check children for equality + for(var i = 0; i < n; i++) { + var c1 = this.childNodes[i], c2 = node.childNodes[i]; + if (!c1.isEqualNode(c2)) return false; + } -module.exports = (__webpack_require__(1))(3); + return true; + }}, + + // This method delegates shallow cloning to a clone() method + // that each concrete subclass must implement + cloneNode: { value: function(deep) { + // Clone this node + var clone = this.clone(); + + // Handle the recursive case if necessary + if (deep && this.firstChild) { + for(var i = 0, n = this.childNodes.length; i < n; i++) { + clone._appendChild(this.childNodes[i].cloneNode(true)); + } + } -/***/ }), -/* 11 */ -/***/ (function(module, exports, __webpack_require__) { + return clone; + }}, + + lookupPrefix: { value: function lookupPrefix(ns) { + var e; + if (ns === '') return null; + switch(this.nodeType) { + case ELEMENT_NODE: + return this.locateNamespacePrefix(ns); + case DOCUMENT_NODE: + e = this.documentElement; + return e ? e.locateNamespacePrefix(ns) : null; + case DOCUMENT_TYPE_NODE: + case DOCUMENT_FRAGMENT_NODE: + return null; + default: + e = this.parentElement; + return e ? e.locateNamespacePrefix(ns) : null; + } + }}, + + + lookupNamespaceURI: {value: function lookupNamespaceURI(prefix) { + var e; + switch(this.nodeType) { + case ELEMENT_NODE: + return this.locateNamespace(prefix); + case DOCUMENT_NODE: + e = this.documentElement; + return e ? e.locateNamespace(prefix) : null; + case DOCUMENT_TYPE_NODE: + case DOCUMENT_FRAGMENT_NODE: + return null; + default: + e = this.parentElement; + return e ? e.locateNamespace(prefix) : null; + } + }}, + + isDefaultNamespace: { value: function isDefaultNamespace(ns) { + var defaultns = this.lookupNamespaceURI(null); + if (defaultns === null) defaultns = ''; + return ns === defaultns; + }}, + + // Utility methods for nodes. Not part of the DOM + + // Return the index of this node in its parent. + // Throw if no parent, or if this node is not a child of its parent + index: { get: function() { + utils.assert(this.parentNode); + var kids = this.parentNode.childNodes; + if (this._index === undefined || kids[this._index] !== this) { + // Ensure that we don't have an O(N^2) blowup if none of the + // kids have defined indices yet and we're traversing via + // nextSibling or prevSibling + for (var i=0; i'; + + if (!(html && emptyElements[tagname])) { + var ss = kid.serialize(); + if (html && extraNewLine[tagname] && ss.charAt(0)==='\n') s += '\n'; + // Serialize children and add end tag for all others + s += ss; + s += '' + tagname + '>'; + } + break; + case 3: //TEXT_NODE + case 4: //CDATA_SECTION_NODE + var parenttag; + if (this.nodeType === ELEMENT_NODE && + this.namespaceURI === NAMESPACE.HTML) + parenttag = this.tagName; + else + parenttag = ''; -module.exports = (__webpack_require__(1))(11); + if (hasRawContent[parenttag] || + (parenttag==='NOSCRIPT' && this.ownerDocument._scripting_enabled)) { + s += kid.data; + } else { + s += escape(kid.data); + } + break; + case 8: //COMMENT_NODE + s += ''; + break; + case 7: //PROCESSING_INSTRUCTION_NODE + s += '' + kid.target + ' ' + kid.data + '?>'; + break; + case 10: //DOCUMENT_TYPE_NODE + s += ''; + break; + default: + utils.InvalidState(); + } + } -/***/ }), -/* 16 */ -/***/ (function(module, exports, __webpack_require__) { + return s; + }}, + + // mirror node type properties in the prototype, so they are present + // in instances of Node (and subclasses) + ELEMENT_NODE: { value: ELEMENT_NODE }, + ATTRIBUTE_NODE: { value: ATTRIBUTE_NODE }, + TEXT_NODE: { value: TEXT_NODE }, + CDATA_SECTION_NODE: { value: CDATA_SECTION_NODE }, + ENTITY_REFERENCE_NODE: { value: ENTITY_REFERENCE_NODE }, + ENTITY_NODE: { value: ENTITY_NODE }, + PROCESSING_INSTRUCTION_NODE: { value: PROCESSING_INSTRUCTION_NODE }, + COMMENT_NODE: { value: COMMENT_NODE }, + DOCUMENT_NODE: { value: DOCUMENT_NODE }, + DOCUMENT_TYPE_NODE: { value: DOCUMENT_TYPE_NODE }, + DOCUMENT_FRAGMENT_NODE: { value: DOCUMENT_FRAGMENT_NODE }, + NOTATION_NODE: { value: NOTATION_NODE } +}); -module.exports = (__webpack_require__(1))(86); +function escape(s) { + return s.replace(/[&<>\u00A0]/g, function(c) { + switch(c) { + case '&': return '&'; + case '<': return '<'; + case '>': return '>'; + case '\u00A0': return ' '; + } + }); +} + +function escapeAttr(s) { + var toEscape = /[&"\u00A0]/g; + if (!toEscape.test(s)) { + // nothing to do, fast path + return s; + } else { + return s.replace(toEscape, function(c) { + switch(c) { + case '&': return '&'; + case '"': return '"'; + case '\u00A0': return ' '; + } + }); + } +} -/***/ }), -/* 17 */ -/***/ (function(module, exports, __webpack_require__) { +function attrname(a) { + var ns = a.namespaceURI; + if (!ns) + return a.localName; + if (ns === NAMESPACE.XML) + return 'xml:' + a.localName; + if (ns === NAMESPACE.XLINK) + return 'xlink:' + a.localName; + + if (ns === NAMESPACE.XMLNS) { + if (a.localName === 'xmlns') return 'xmlns'; + else return 'xmlns:' + a.localName; + } + return a.name; +} -module.exports = (__webpack_require__(1))(7); /***/ }), -/* 18 */ +/* 4 */ /***/ (function(module, exports, __webpack_require__) { -"use strict"; - +module.exports = (__webpack_require__(0))(3); -exports.REPLACEMENT_CHARACTER = '\uFFFD'; - -exports.CODE_POINTS = { - EOF: -1, - NULL: 0x00, - TABULATION: 0x09, - CARRIAGE_RETURN: 0x0D, - LINE_FEED: 0x0A, - FORM_FEED: 0x0C, - SPACE: 0x20, - EXCLAMATION_MARK: 0x21, - QUOTATION_MARK: 0x22, - NUMBER_SIGN: 0x23, - AMPERSAND: 0x26, - APOSTROPHE: 0x27, - HYPHEN_MINUS: 0x2D, - SOLIDUS: 0x2F, - DIGIT_0: 0x30, - DIGIT_9: 0x39, - SEMICOLON: 0x3B, - LESS_THAN_SIGN: 0x3C, - EQUALS_SIGN: 0x3D, - GREATER_THAN_SIGN: 0x3E, - QUESTION_MARK: 0x3F, - LATIN_CAPITAL_A: 0x41, - LATIN_CAPITAL_F: 0x46, - LATIN_CAPITAL_X: 0x58, - LATIN_CAPITAL_Z: 0x5A, - GRAVE_ACCENT: 0x60, - LATIN_SMALL_A: 0x61, - LATIN_SMALL_F: 0x66, - LATIN_SMALL_X: 0x78, - LATIN_SMALL_Z: 0x7A, - REPLACEMENT_CHARACTER: 0xFFFD -}; - -exports.CODE_POINT_SEQUENCES = { - DASH_DASH_STRING: [0x2D, 0x2D], //-- - DOCTYPE_STRING: [0x44, 0x4F, 0x43, 0x54, 0x59, 0x50, 0x45], //DOCTYPE - CDATA_START_STRING: [0x5B, 0x43, 0x44, 0x41, 0x54, 0x41, 0x5B], //[CDATA[ - CDATA_END_STRING: [0x5D, 0x5D, 0x3E], //]]> - SCRIPT_STRING: [0x73, 0x63, 0x72, 0x69, 0x70, 0x74], //script - PUBLIC_STRING: [0x50, 0x55, 0x42, 0x4C, 0x49, 0x43], //PUBLIC - SYSTEM_STRING: [0x53, 0x59, 0x53, 0x54, 0x45, 0x4D] //SYSTEM -}; +/***/ }), +/* 5 */ +/***/ (function(module, exports, __webpack_require__) { +module.exports = (__webpack_require__(0))(5); /***/ }), -/* 19 */ +/* 6 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; +module.exports = Element; -var Preprocessor = __webpack_require__(119), - locationInfoMixin = __webpack_require__(111), - UNICODE = __webpack_require__(18), - neTree = __webpack_require__(118); +var xml = __webpack_require__(24); +var utils = __webpack_require__(1); +var NAMESPACE = utils.NAMESPACE; +var attributes = __webpack_require__(42); +var Node = __webpack_require__(3); +var NodeList = __webpack_require__(11); +var FilteredElementList = __webpack_require__(74); +var DOMTokenList = __webpack_require__(31); +var select = __webpack_require__(23); +var ChildNode = __webpack_require__(16); +var NonDocumentTypeChildNode = __webpack_require__(37); -//Aliases -var $ = UNICODE.CODE_POINTS, - $$ = UNICODE.CODE_POINT_SEQUENCES; - -//Replacement code points for numeric entities -var NUMERIC_ENTITY_REPLACEMENTS = { - 0x00: 0xFFFD, 0x0D: 0x000D, 0x80: 0x20AC, 0x81: 0x0081, 0x82: 0x201A, 0x83: 0x0192, 0x84: 0x201E, - 0x85: 0x2026, 0x86: 0x2020, 0x87: 0x2021, 0x88: 0x02C6, 0x89: 0x2030, 0x8A: 0x0160, 0x8B: 0x2039, - 0x8C: 0x0152, 0x8D: 0x008D, 0x8E: 0x017D, 0x8F: 0x008F, 0x90: 0x0090, 0x91: 0x2018, 0x92: 0x2019, - 0x93: 0x201C, 0x94: 0x201D, 0x95: 0x2022, 0x96: 0x2013, 0x97: 0x2014, 0x98: 0x02DC, 0x99: 0x2122, - 0x9A: 0x0161, 0x9B: 0x203A, 0x9C: 0x0153, 0x9D: 0x009D, 0x9E: 0x017E, 0x9F: 0x0178 -}; - -// Named entity tree flags -var HAS_DATA_FLAG = 1 << 0; -var DATA_DUPLET_FLAG = 1 << 1; -var HAS_BRANCHES_FLAG = 1 << 2; -var MAX_BRANCH_MARKER_VALUE = HAS_DATA_FLAG | DATA_DUPLET_FLAG | HAS_BRANCHES_FLAG; - - -//States -var DATA_STATE = 'DATA_STATE', - CHARACTER_REFERENCE_IN_DATA_STATE = 'CHARACTER_REFERENCE_IN_DATA_STATE', - RCDATA_STATE = 'RCDATA_STATE', - CHARACTER_REFERENCE_IN_RCDATA_STATE = 'CHARACTER_REFERENCE_IN_RCDATA_STATE', - RAWTEXT_STATE = 'RAWTEXT_STATE', - SCRIPT_DATA_STATE = 'SCRIPT_DATA_STATE', - PLAINTEXT_STATE = 'PLAINTEXT_STATE', - TAG_OPEN_STATE = 'TAG_OPEN_STATE', - END_TAG_OPEN_STATE = 'END_TAG_OPEN_STATE', - TAG_NAME_STATE = 'TAG_NAME_STATE', - RCDATA_LESS_THAN_SIGN_STATE = 'RCDATA_LESS_THAN_SIGN_STATE', - RCDATA_END_TAG_OPEN_STATE = 'RCDATA_END_TAG_OPEN_STATE', - RCDATA_END_TAG_NAME_STATE = 'RCDATA_END_TAG_NAME_STATE', - RAWTEXT_LESS_THAN_SIGN_STATE = 'RAWTEXT_LESS_THAN_SIGN_STATE', - RAWTEXT_END_TAG_OPEN_STATE = 'RAWTEXT_END_TAG_OPEN_STATE', - RAWTEXT_END_TAG_NAME_STATE = 'RAWTEXT_END_TAG_NAME_STATE', - SCRIPT_DATA_LESS_THAN_SIGN_STATE = 'SCRIPT_DATA_LESS_THAN_SIGN_STATE', - SCRIPT_DATA_END_TAG_OPEN_STATE = 'SCRIPT_DATA_END_TAG_OPEN_STATE', - SCRIPT_DATA_END_TAG_NAME_STATE = 'SCRIPT_DATA_END_TAG_NAME_STATE', - SCRIPT_DATA_ESCAPE_START_STATE = 'SCRIPT_DATA_ESCAPE_START_STATE', - SCRIPT_DATA_ESCAPE_START_DASH_STATE = 'SCRIPT_DATA_ESCAPE_START_DASH_STATE', - SCRIPT_DATA_ESCAPED_STATE = 'SCRIPT_DATA_ESCAPED_STATE', - SCRIPT_DATA_ESCAPED_DASH_STATE = 'SCRIPT_DATA_ESCAPED_DASH_STATE', - SCRIPT_DATA_ESCAPED_DASH_DASH_STATE = 'SCRIPT_DATA_ESCAPED_DASH_DASH_STATE', - SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN_STATE = 'SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN_STATE', - SCRIPT_DATA_ESCAPED_END_TAG_OPEN_STATE = 'SCRIPT_DATA_ESCAPED_END_TAG_OPEN_STATE', - SCRIPT_DATA_ESCAPED_END_TAG_NAME_STATE = 'SCRIPT_DATA_ESCAPED_END_TAG_NAME_STATE', - SCRIPT_DATA_DOUBLE_ESCAPE_START_STATE = 'SCRIPT_DATA_DOUBLE_ESCAPE_START_STATE', - SCRIPT_DATA_DOUBLE_ESCAPED_STATE = 'SCRIPT_DATA_DOUBLE_ESCAPED_STATE', - SCRIPT_DATA_DOUBLE_ESCAPED_DASH_STATE = 'SCRIPT_DATA_DOUBLE_ESCAPED_DASH_STATE', - SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH_STATE = 'SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH_STATE', - SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN_STATE = 'SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN_STATE', - SCRIPT_DATA_DOUBLE_ESCAPE_END_STATE = 'SCRIPT_DATA_DOUBLE_ESCAPE_END_STATE', - BEFORE_ATTRIBUTE_NAME_STATE = 'BEFORE_ATTRIBUTE_NAME_STATE', - ATTRIBUTE_NAME_STATE = 'ATTRIBUTE_NAME_STATE', - AFTER_ATTRIBUTE_NAME_STATE = 'AFTER_ATTRIBUTE_NAME_STATE', - BEFORE_ATTRIBUTE_VALUE_STATE = 'BEFORE_ATTRIBUTE_VALUE_STATE', - ATTRIBUTE_VALUE_DOUBLE_QUOTED_STATE = 'ATTRIBUTE_VALUE_DOUBLE_QUOTED_STATE', - ATTRIBUTE_VALUE_SINGLE_QUOTED_STATE = 'ATTRIBUTE_VALUE_SINGLE_QUOTED_STATE', - ATTRIBUTE_VALUE_UNQUOTED_STATE = 'ATTRIBUTE_VALUE_UNQUOTED_STATE', - CHARACTER_REFERENCE_IN_ATTRIBUTE_VALUE_STATE = 'CHARACTER_REFERENCE_IN_ATTRIBUTE_VALUE_STATE', - AFTER_ATTRIBUTE_VALUE_QUOTED_STATE = 'AFTER_ATTRIBUTE_VALUE_QUOTED_STATE', - SELF_CLOSING_START_TAG_STATE = 'SELF_CLOSING_START_TAG_STATE', - BOGUS_COMMENT_STATE = 'BOGUS_COMMENT_STATE', - BOGUS_COMMENT_STATE_CONTINUATION = 'BOGUS_COMMENT_STATE_CONTINUATION', - MARKUP_DECLARATION_OPEN_STATE = 'MARKUP_DECLARATION_OPEN_STATE', - COMMENT_START_STATE = 'COMMENT_START_STATE', - COMMENT_START_DASH_STATE = 'COMMENT_START_DASH_STATE', - COMMENT_STATE = 'COMMENT_STATE', - COMMENT_END_DASH_STATE = 'COMMENT_END_DASH_STATE', - COMMENT_END_STATE = 'COMMENT_END_STATE', - COMMENT_END_BANG_STATE = 'COMMENT_END_BANG_STATE', - DOCTYPE_STATE = 'DOCTYPE_STATE', - DOCTYPE_NAME_STATE = 'DOCTYPE_NAME_STATE', - AFTER_DOCTYPE_NAME_STATE = 'AFTER_DOCTYPE_NAME_STATE', - BEFORE_DOCTYPE_PUBLIC_IDENTIFIER_STATE = 'BEFORE_DOCTYPE_PUBLIC_IDENTIFIER_STATE', - DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED_STATE = 'DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED_STATE', - DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED_STATE = 'DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED_STATE', - BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS_STATE = 'BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS_STATE', - BEFORE_DOCTYPE_SYSTEM_IDENTIFIER_STATE = 'BEFORE_DOCTYPE_SYSTEM_IDENTIFIER_STATE', - DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED_STATE = 'DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED_STATE', - DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED_STATE = 'DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED_STATE', - AFTER_DOCTYPE_SYSTEM_IDENTIFIER_STATE = 'AFTER_DOCTYPE_SYSTEM_IDENTIFIER_STATE', - BOGUS_DOCTYPE_STATE = 'BOGUS_DOCTYPE_STATE', - CDATA_SECTION_STATE = 'CDATA_SECTION_STATE'; - -//Utils - -//OPTIMIZATION: these utility functions should not be moved out of this module. V8 Crankshaft will not inline -//this functions if they will be situated in another module due to context switch. -//Always perform inlining check before modifying this functions ('node --trace-inlining'). -function isWhitespace(cp) { - return cp === $.SPACE || cp === $.LINE_FEED || cp === $.TABULATION || cp === $.FORM_FEED; -} +function Element(doc, localName, namespaceURI, prefix) { + this.nodeType = Node.ELEMENT_NODE; + this.ownerDocument = doc; + this.localName = localName; + this.namespaceURI = namespaceURI; + this.prefix = prefix; -function isAsciiDigit(cp) { - return cp >= $.DIGIT_0 && cp <= $.DIGIT_9; -} + this.tagName = (prefix !== null) ? prefix + ':' + localName : localName; -function isAsciiUpper(cp) { - return cp >= $.LATIN_CAPITAL_A && cp <= $.LATIN_CAPITAL_Z; -} + if (namespaceURI !== NAMESPACE.HTML || (!namespaceURI && !doc.isHTML)) this.isHTML = false; -function isAsciiLower(cp) { - return cp >= $.LATIN_SMALL_A && cp <= $.LATIN_SMALL_Z; -} + if (this.isHTML) this.tagName = this.tagName.toUpperCase(); -function isAsciiLetter(cp) { - return isAsciiLower(cp) || isAsciiUpper(cp); -} + this.childNodes = new NodeList(); -function isAsciiAlphaNumeric(cp) { - return isAsciiLetter(cp) || isAsciiDigit(cp); -} + // These properties maintain the set of attributes + this._attrsByQName = Object.create(null); // The qname->Attr map + this._attrsByLName = Object.create(null); // The ns|lname->Attr map + this._attrKeys = []; // attr index -> ns|lname -function isDigit(cp, isHex) { - return isAsciiDigit(cp) || isHex && (cp >= $.LATIN_CAPITAL_A && cp <= $.LATIN_CAPITAL_F || - cp >= $.LATIN_SMALL_A && cp <= $.LATIN_SMALL_F); + this._index = undefined; } -function isReservedCodePoint(cp) { - return cp >= 0xD800 && cp <= 0xDFFF || cp > 0x10FFFF; +function recursiveGetText(node, a) { + if (node.nodeType === Node.TEXT_NODE) { + a.push(node._data); + } + else { + for(var i = 0, n = node.childNodes.length; i < n; i++) + recursiveGetText(node.childNodes[i], a); + } } -function toAsciiLowerCodePoint(cp) { - return cp + 0x0020; -} +Element.prototype = Object.create(Node.prototype, { + nodeName: { get: function() { return this.tagName; }}, + nodeValue: { + get: function() { + return null; + }, + set: function() {} + }, + textContent: { + get: function() { + var strings = []; + recursiveGetText(this, strings); + return strings.join(''); + }, + set: function(newtext) { + this.removeChildren(); + if (newtext !== null && newtext !== '') { + this._appendChild(this.ownerDocument.createTextNode(newtext)); + } + } + }, + innerHTML: { + get: function() { + return this.serialize(); + }, + set: utils.nyi + }, + outerHTML: { + get: function() { + // "the attribute must return the result of running the HTML fragment + // serialization algorithm on a fictional node whose only child is + // the context object" + var fictional = { + childNodes: [ this ], + nodeType: 0 + }; + return Node.prototype.serialize.call(fictional); + }, + set: utils.nyi + }, -//NOTE: String.fromCharCode() function can handle only characters from BMP subset. -//So, we need to workaround this manually. -//(see: https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String/fromCharCode#Getting_it_to_work_with_higher_values) -function toChar(cp) { - if (cp <= 0xFFFF) - return String.fromCharCode(cp); + children: { get: function() { + if (!this._children) { + this._children = new ChildrenCollection(this); + } + return this._children; + }}, - cp -= 0x10000; - return String.fromCharCode(cp >>> 10 & 0x3FF | 0xD800) + String.fromCharCode(0xDC00 | cp & 0x3FF); -} + attributes: { get: function() { + if (!this._attributes) { + this._attributes = new AttributesArray(this); + } + return this._attributes; + }}, -function toAsciiLowerChar(cp) { - return String.fromCharCode(toAsciiLowerCodePoint(cp)); -} -function findNamedEntityTreeBranch(nodeIx, cp) { - var branchCount = neTree[++nodeIx], - lo = ++nodeIx, - hi = lo + branchCount - 1; + firstElementChild: { get: function() { + var kids = this.childNodes; + for(var i = 0, n = kids.length; i < n; i++) { + if (kids[i].nodeType === Node.ELEMENT_NODE) return kids[i]; + } + return null; + }}, - while (lo <= hi) { - var mid = lo + hi >>> 1, - midCp = neTree[mid]; + lastElementChild: { get: function() { + var kids = this.childNodes; + for(var i = kids.length-1; i >= 0; i--) { + if (kids[i].nodeType === Node.ELEMENT_NODE) return kids[i]; + } + return null; + }}, + + childElementCount: { get: function() { + return this.children.length; + }}, + + + // Return the next element, in source order, after this one or + // null if there are no more. If root element is specified, + // then don't traverse beyond its subtree. + // + // This is not a DOM method, but is convenient for + // lazy traversals of the tree. + nextElement: { value: function(root) { + if (!root) root = this.ownerDocument.documentElement; + var next = this.firstElementChild; + if (!next) { + // don't use sibling if we're at root + if (this===root) return null; + next = this.nextElementSibling; + } + if (next) return next; + + // If we can't go down or across, then we have to go up + // and across to the parent sibling or another ancestor's + // sibling. Be careful, though: if we reach the root + // element, or if we reach the documentElement, then + // the traversal ends. + for(var parent = this.parentElement; + parent && parent !== root; + parent = parent.parentElement) { + + next = parent.nextElementSibling; + if (next) return next; + } - if (midCp < cp) - lo = mid + 1; + return null; + }}, + + // XXX: + // Tests are currently failing for this function. + // Awaiting resolution of: + // http://lists.w3.org/Archives/Public/www-dom/2011JulSep/0016.html + getElementsByTagName: { value: function getElementsByTagName(lname) { + var filter; + if (!lname) return new NodeList(); + if (lname === '*') + filter = function() { return true; }; + else if (this.isHTML) + filter = htmlLocalNameElementFilter(lname); + else + filter = localNameElementFilter(lname); + + return new FilteredElementList(this, filter); + }}, + + getElementsByTagNameNS: { value: function getElementsByTagNameNS(ns, lname){ + var filter; + if (ns === '*' && lname === '*') + filter = function() { return true; }; + else if (ns === '*') + filter = localNameElementFilter(lname); + else if (lname === '*') + filter = namespaceElementFilter(ns); + else + filter = namespaceLocalNameElementFilter(ns, lname); + + return new FilteredElementList(this, filter); + }}, + + getElementsByClassName: { value: function getElementsByClassName(names){ + names = String(names).trim(); + if (names === '') { + var result = new NodeList(); // Empty node list + return result; + } + names = names.split(/\s+/); // Split on spaces + return new FilteredElementList(this, classNamesElementFilter(names)); + }}, + + getElementsByName: { value: function getElementsByName(name) { + return new FilteredElementList(this, elementNameFilter(String(name))); + }}, + + // Overwritten in the constructor if not in the HTML namespace + isHTML: { value: true, writable: true }, + + // Utility methods used by the public API methods above + clone: { value: function clone() { + var e; + + // XXX: + // Modify this to use the constructor directly or + // avoid error checking in some other way. In case we try + // to clone an invalid node that the parser inserted. + // + if (this.namespaceURI !== NAMESPACE.HTML || this.prefix) + e = this.ownerDocument.createElementNS(this.namespaceURI, + this.tagName); + else + e = this.ownerDocument.createElement(this.localName); + + for(var i = 0, n = this._attrKeys.length; i < n; i++) { + var lname = this._attrKeys[i]; + var a = this._attrsByLName[lname]; + var b = new Attr(e, a.localName, a.prefix, a.namespaceURI); + b.data = a.data; + e._attrsByLName[lname] = b; + e._addQName(b); + } + e._attrKeys = this._attrKeys.concat(); + + return e; + }}, + + isEqual: { value: function isEqual(that) { + if (this.localName !== that.localName || + this.namespaceURI !== that.namespaceURI || + this.prefix !== that.prefix || + this._numattrs !== that._numattrs) + return false; + + // Compare the sets of attributes, ignoring order + // and ignoring attribute prefixes. + for(var i = 0, n = this._numattrs; i < n; i++) { + var a = this._attr(i); + if (!that.hasAttributeNS(a.namespaceURI, a.localName)) + return false; + if (that.getAttributeNS(a.namespaceURI,a.localName) !== a.value) + return false; + } - else if (midCp > cp) - hi = mid - 1; + return true; + }}, + + // This is the 'locate a namespace prefix' algorithm from the + // DOMCore specification. It is used by Node.lookupPrefix() + locateNamespacePrefix: { value: function locateNamespacePrefix(ns) { + if (this.namespaceURI === ns && this.prefix !== null) + return this.prefix; + + for(var i = 0, n = this._numattrs; i < n; i++) { + var a = this._attr(i); + if (a.prefix === 'xmlns' && a.value === ns) + return a.localName; + } + + var parent = this.parentElement; + return parent ? parent.locateNamespacePrefix(ns) : null; + }}, + + // This is the 'locate a namespace' algorithm for Element nodes + // from the DOM Core spec. It is used by Node.lookupNamespaceURI + locateNamespace: { value: function locateNamespace(prefix) { + if (this.prefix === prefix && this.namespaceURI !== null) + return this.namespaceURI; + + for(var i = 0, n = this._numattrs; i < n; i++) { + var a = this._attr(i); + if ((a.prefix === 'xmlns' && a.localName === prefix) || + (a.prefix === null && a.localName === 'xmlns')) { + return a.value || null; + } + } - else - return neTree[mid + branchCount]; + var parent = this.parentElement; + return parent ? parent.locateNamespace(prefix) : null; + }}, + + // + // Attribute handling methods and utilities + // + + /* + * Attributes in the DOM are tricky: + * + * - there are the 8 basic get/set/has/removeAttribute{NS} methods + * + * - but many HTML attributes are also 'reflected' through IDL + * attributes which means that they can be queried and set through + * regular properties of the element. There is just one attribute + * value, but two ways to get and set it. + * + * - Different HTML element types have different sets of reflected + attributes. + * + * - attributes can also be queried and set through the .attributes + * property of an element. This property behaves like an array of + * Attr objects. The value property of each Attr is writeable, so + * this is a third way to read and write attributes. + * + * - for efficiency, we really want to store attributes in some kind + * of name->attr map. But the attributes[] array is an array, not a + * map, which is kind of unnatural. + * + * - When using namespaces and prefixes, and mixing the NS methods + * with the non-NS methods, it is apparently actually possible for + * an attributes[] array to have more than one attribute with the + * same qualified name. And certain methods must operate on only + * the first attribute with such a name. So for these methods, an + * inefficient array-like data structure would be easier to + * implement. + * + * - The attributes[] array is live, not a snapshot, so changes to the + * attributes must be immediately visible through existing arrays. + * + * - When attributes are queried and set through IDL properties + * (instead of the get/setAttributes() method or the attributes[] + * array) they may be subject to type conversions, URL + * normalization, etc., so some extra processing is required in that + * case. + * + * - But access through IDL properties is probably the most common + * case, so we'd like that to be as fast as possible. + * + * - We can't just store attribute values in their parsed idl form, + * because setAttribute() has to return whatever string is passed to + * getAttribute even if it is not a legal, parseable value. So + * attribute values must be stored in unparsed string form. + * + * - We need to be able to send change notifications or mutation + * events of some sort to the renderer whenever an attribute value + * changes, regardless of the way in which it changes. + * + * - Some attributes, such as id and class affect other parts of the + * DOM API, like getElementById and getElementsByClassName and so + * for efficiency, we need to specially track changes to these + * special attributes. + * + * - Some attributes like class have different names (className) when + * reflected. + * + * - Attributes whose names begin with the string 'data-' are treated + specially. + * + * - Reflected attributes that have a boolean type in IDL have special + * behavior: setting them to false (in IDL) is the same as removing + * them with removeAttribute() + * + * - numeric attributes (like HTMLElement.tabIndex) can have default + * values that must be returned by the idl getter even if the + * content attribute does not exist. (The default tabIndex value + * actually varies based on the type of the element, so that is a + * tricky one). + * + * See + * http://www.whatwg.org/specs/web-apps/current-work/multipage/urls.html#reflect + * for rules on how attributes are reflected. + * + */ + + getAttribute: { value: function getAttribute(qname) { + if (this.isHTML) qname = utils.toASCIILowerCase(qname); + var attr = this._attrsByQName[qname]; + if (!attr) return null; + + if (Array.isArray(attr)) // If there is more than one + attr = attr[0]; // use the first + + return attr.value; + }}, + + getAttributeNS: { value: function getAttributeNS(ns, lname) { + var attr = this._attrsByLName[(ns === null ? '' : ns) + '|' + lname]; + return attr ? attr.value : null; + }}, + + hasAttribute: { value: function hasAttribute(qname) { + if (this.isHTML) qname = utils.toASCIILowerCase(qname); + return this._attrsByQName[qname] !== undefined; + }}, + + hasAttributeNS: { value: function hasAttributeNS(ns, lname) { + var key = (ns === null ? '' : ns) + '|' + lname; + return this._attrsByLName[key] !== undefined; + }}, + + // Set the attribute without error checking. The parser uses this. + _setAttribute: { value: function _setAttribute(qname, value) { + // XXX: the spec says that this next search should be done + // on the local name, but I think that is an error. + // email pending on www-dom about it. + var attr = this._attrsByQName[qname]; + var isnew; + if (!attr) { + attr = this._newattr(qname); + isnew = true; + } + else { + if (Array.isArray(attr)) attr = attr[0]; } - return -1; -} + // Now set the attribute value on the new or existing Attr object. + // The Attr.value setter method handles mutation events, etc. + attr.value = value; + if (this._attributes) this._attributes[qname] = attr; + if (isnew && this._newattrhook) this._newattrhook(qname, value); + }}, + // Check for errors, and then set the attribute + setAttribute: { value: function setAttribute(qname, value) { + if (!xml.isValidName(qname)) utils.InvalidCharacterError(); + if (this.isHTML) qname = utils.toASCIILowerCase(qname); + if (qname.substring(0, 5) === 'xmlns') utils.NamespaceError(); + this._setAttribute(qname, String(value)); + }}, -//Tokenizer -var Tokenizer = module.exports = function (options) { - this.preprocessor = new Preprocessor(); - this.tokenQueue = []; + // The version with no error checking used by the parser + _setAttributeNS: { value: function _setAttributeNS(ns, qname, value) { + var pos = qname.indexOf(':'), prefix, lname; + if (pos === -1) { + prefix = null; + lname = qname; + } + else { + prefix = qname.substring(0, pos); + lname = qname.substring(pos+1); + } - this.allowCDATA = false; + var key = (ns === null ? '' : ns) + '|' + lname; + if (ns === '') ns = null; - this.state = DATA_STATE; - this.returnState = ''; + var attr = this._attrsByLName[key]; + var isnew; + if (!attr) { + attr = new Attr(this, lname, prefix, ns); + isnew = true; + this._attrsByLName[key] = attr; + this._attrKeys.push(key); - this.tempBuff = []; - this.additionalAllowedCp = void 0; - this.lastStartTagName = ''; + // We also have to make the attr searchable by qname. + // But we have to be careful because there may already + // be an attr with this qname. + this._addQName(attr); + } + else { + // Calling setAttributeNS() can change the prefix of an + // existing attribute! + if (attr.prefix !== prefix) { + // Unbind the old qname + this._removeQName(attr); + // Update the prefix + attr.prefix = prefix; + // Bind the new qname + this._addQName(attr); - this.consumedAfterSnapshot = -1; - this.active = false; + } - this.currentCharacterToken = null; - this.currentToken = null; - this.currentAttr = null; + } + attr.value = value; // Automatically sends mutation event + if (isnew && this._newattrhook) this._newattrhook(qname, value); + }}, - if (options && options.locationInfo) - locationInfoMixin.assign(this); -}; + // Do error checking then call _setAttributeNS + setAttributeNS: { value: function setAttributeNS(ns, qname, value) { + if (!xml.isValidName(qname)) utils.InvalidCharacterError(); + if (!xml.isValidQName(qname)) utils.NamespaceError(); -//Token types -Tokenizer.CHARACTER_TOKEN = 'CHARACTER_TOKEN'; -Tokenizer.NULL_CHARACTER_TOKEN = 'NULL_CHARACTER_TOKEN'; -Tokenizer.WHITESPACE_CHARACTER_TOKEN = 'WHITESPACE_CHARACTER_TOKEN'; -Tokenizer.START_TAG_TOKEN = 'START_TAG_TOKEN'; -Tokenizer.END_TAG_TOKEN = 'END_TAG_TOKEN'; -Tokenizer.COMMENT_TOKEN = 'COMMENT_TOKEN'; -Tokenizer.DOCTYPE_TOKEN = 'DOCTYPE_TOKEN'; -Tokenizer.EOF_TOKEN = 'EOF_TOKEN'; -Tokenizer.HIBERNATION_TOKEN = 'HIBERNATION_TOKEN'; - -//Tokenizer initial states for different modes -Tokenizer.MODE = Tokenizer.prototype.MODE = { - DATA: DATA_STATE, - RCDATA: RCDATA_STATE, - RAWTEXT: RAWTEXT_STATE, - SCRIPT_DATA: SCRIPT_DATA_STATE, - PLAINTEXT: PLAINTEXT_STATE -}; + var pos = qname.indexOf(':'); + var prefix = (pos === -1) ? null : qname.substring(0, pos); + if (ns === '') ns = null; -//Static -Tokenizer.getTokenAttr = function (token, attrName) { - for (var i = token.attrs.length - 1; i >= 0; i--) { - if (token.attrs[i].name === attrName) - return token.attrs[i].value; - } + if ((prefix !== null && ns === null) || + (prefix === 'xml' && ns !== NAMESPACE.XML) || + ((qname === 'xmlns' || prefix === 'xmlns') && + (ns !== NAMESPACE.XMLNS)) || + (ns === NAMESPACE.XMLNS && + !(qname === 'xmlns' || prefix === 'xmlns'))) + utils.NamespaceError(); - return null; -}; + this._setAttributeNS(ns, qname, String(value)); + }}, -//API -Tokenizer.prototype.getNextToken = function () { - while (!this.tokenQueue.length && this.active) { - this._hibernationSnapshot(); + removeAttribute: { value: function removeAttribute(qname) { + if (this.isHTML) qname = utils.toASCIILowerCase(qname); - var cp = this._consume(); + var attr = this._attrsByQName[qname]; + if (!attr) return; - if (!this._ensureHibernation()) - this[this.state](cp); + // If there is more than one match for this qname + // so don't delete the qname mapping, just remove the first + // element from it. + if (Array.isArray(attr)) { + if (attr.length > 2) { + attr = attr.shift(); // remove it from the array + } + else { + this._attrsByQName[qname] = attr[1]; + attr = attr[0]; + } + } + else { + // only a single match, so remove the qname mapping + this._attrsByQName[qname] = undefined; + } + + var ns = attr.namespaceURI; + // Now attr is the removed attribute. Figure out its + // ns+lname key and remove it from the other mapping as well. + var key = (ns === null ? '' : ns) + '|' + attr.localName; + this._attrsByLName[key] = undefined; + + var i = this._attrKeys.indexOf(key); + this._attrKeys.splice(i, 1); + + if (this._attributes) + this._attributes[qname] = undefined; + + // Onchange handler for the attribute + if (attr.onchange) + attr.onchange(this, attr.localName, attr.value, null); + + // Mutation event + if (this.rooted) this.ownerDocument.mutateRemoveAttr(attr); + }}, + + removeAttributeNS: { value: function removeAttributeNS(ns, lname) { + var key = (ns === null ? '' : ns) + '|' + lname; + var attr = this._attrsByLName[key]; + if (!attr) return; + + this._attrsByLName[key] = undefined; + + var i = this._attrKeys.indexOf(key); + this._attrKeys.splice(i, 1); + + // Now find the same Attr object in the qname mapping and remove it + // But be careful because there may be more than one match. + this._removeQName(attr); + + // Onchange handler for the attribute + if (attr.onchange) + attr.onchange(this, attr.localName, attr.value, null); + // Mutation event + if (this.rooted) this.ownerDocument.mutateRemoveAttr(attr); + }}, + + // This 'raw' version of getAttribute is used by the getter functions + // of reflected attributes. It skips some error checking and + // namespace steps + _getattr: { value: function _getattr(qname) { + // Assume that qname is already lowercased, so don't do it here. + // Also don't check whether attr is an array: a qname with no + // prefix will never have two matching Attr objects (because + // setAttributeNS doesn't allow a non-null namespace with a + // null prefix. + var attr = this._attrsByQName[qname]; + return attr ? attr.value : null; + }}, + + // The raw version of setAttribute for reflected idl attributes. + _setattr: { value: function _setattr(qname, value) { + var attr = this._attrsByQName[qname]; + var isnew; + if (!attr) { + attr = this._newattr(qname); + isnew = true; + } + attr.value = String(value); + if (this._attributes) this._attributes[qname] = attr; + if (isnew && this._newattrhook) this._newattrhook(qname, value); + }}, + + // Create a new Attr object, insert it, and return it. + // Used by setAttribute() and by set() + _newattr: { value: function _newattr(qname) { + var attr = new Attr(this, qname, null, null); + var key = '|' + qname; + this._attrsByQName[qname] = attr; + this._attrsByLName[key] = attr; + this._attrKeys.push(key); + return attr; + }}, + + // Add a qname->Attr mapping to the _attrsByQName object, taking into + // account that there may be more than one attr object with the + // same qname + _addQName: { value: function(attr) { + var qname = attr.name; + var existing = this._attrsByQName[qname]; + if (!existing) { + this._attrsByQName[qname] = attr; + } + else if (Array.isArray(existing)) { + existing.push(attr); + } + else { + this._attrsByQName[qname] = [existing, attr]; + } + if (this._attributes) this._attributes[qname] = attr; + }}, + + // Remove a qname->Attr mapping to the _attrsByQName object, taking into + // account that there may be more than one attr object with the + // same qname + _removeQName: { value: function(attr) { + var qname = attr.name; + var target = this._attrsByQName[qname]; + + if (Array.isArray(target)) { + var idx = target.indexOf(attr); + utils.assert(idx !== -1); // It must be here somewhere + if (target.length === 2) { + this._attrsByQName[qname] = target[1-idx]; + } + else { + target.splice(idx, 1); + } } + else { + utils.assert(target === attr); // If only one, it must match + this._attrsByQName[qname] = undefined; + } + }}, - return this.tokenQueue.shift(); -}; + // Return the number of attributes + _numattrs: { get: function() { return this._attrKeys.length; }}, + // Return the nth Attr object + _attr: { value: function(n) { + return this._attrsByLName[this._attrKeys[n]]; + }}, -Tokenizer.prototype.write = function (chunk, isLastChunk) { - this.active = true; - this.preprocessor.write(chunk, isLastChunk); -}; + // Define getters and setters for an 'id' property that reflects + // the content attribute 'id'. + id: attributes.property({name: 'id'}), -Tokenizer.prototype.insertHtmlAtCurrentPos = function (chunk) { - this.active = true; - this.preprocessor.insertHtmlAtCurrentPos(chunk); -}; + // Define getters and setters for a 'className' property that reflects + // the content attribute 'class'. + className: attributes.property({name: 'class'}), -//Hibernation -Tokenizer.prototype._hibernationSnapshot = function () { - this.consumedAfterSnapshot = 0; -}; + classList: { get: function() { + var self = this; + if (this._classList) { + return this._classList; + } + var dtlist = new DOMTokenList( + function() { + return self.className || ""; + }, + function(v) { + self.className = v; + } + ); + this._classList = dtlist; + return dtlist; + }}, + + matches: { value: function(selector) { + return select.matches(this, selector); + }}, + + closest: { value: function(selector) { + var el = this; + while (el.matches && !el.matches(selector)) el = el.parentNode; + return el.matches ? el : null; + }}, + + querySelector: { value: function(selector) { + return select(selector, this)[0]; + }}, + + querySelectorAll: { value: function(selector) { + var nodes = select(selector, this); + return nodes.item ? nodes : new NodeList(nodes); + }} -Tokenizer.prototype._ensureHibernation = function () { - if (this.preprocessor.endOfChunkHit) { - for (; this.consumedAfterSnapshot > 0; this.consumedAfterSnapshot--) - this.preprocessor.retreat(); - - this.active = false; - this.tokenQueue.push({type: Tokenizer.HIBERNATION_TOKEN}); - - return true; - } - - return false; -}; - - -//Consumption -Tokenizer.prototype._consume = function () { - this.consumedAfterSnapshot++; - return this.preprocessor.advance(); -}; - -Tokenizer.prototype._unconsume = function () { - this.consumedAfterSnapshot--; - this.preprocessor.retreat(); -}; - -Tokenizer.prototype._unconsumeSeveral = function (count) { - while (count--) - this._unconsume(); -}; - -Tokenizer.prototype._reconsumeInState = function (state) { - this.state = state; - this._unconsume(); -}; - -Tokenizer.prototype._consumeSubsequentIfMatch = function (pattern, startCp, caseSensitive) { - var consumedCount = 0, - isMatch = true, - patternLength = pattern.length, - patternPos = 0, - cp = startCp, - patternCp = void 0; - - for (; patternPos < patternLength; patternPos++) { - if (patternPos > 0) { - cp = this._consume(); - consumedCount++; - } - - if (cp === $.EOF) { - isMatch = false; - break; - } - - patternCp = pattern[patternPos]; - - if (cp !== patternCp && (caseSensitive || cp !== toAsciiLowerCodePoint(patternCp))) { - isMatch = false; - break; - } - } - - if (!isMatch) - this._unconsumeSeveral(consumedCount); - - return isMatch; -}; - -//Lookahead -Tokenizer.prototype._lookahead = function () { - var cp = this._consume(); - - this._unconsume(); - - return cp; -}; - -//Temp buffer -Tokenizer.prototype.isTempBufferEqualToScriptString = function () { - if (this.tempBuff.length !== $$.SCRIPT_STRING.length) - return false; - - for (var i = 0; i < this.tempBuff.length; i++) { - if (this.tempBuff[i] !== $$.SCRIPT_STRING[i]) - return false; - } +}); +Object.defineProperties(Element.prototype, ChildNode); +Object.defineProperties(Element.prototype, NonDocumentTypeChildNode); + +// Register special handling for the id attribute +attributes.registerChangeHandler(Element, 'id', + function(element, lname, oldval, newval) { + if (element.rooted) { + if (oldval) { + element.ownerDocument.delId(oldval, element); + } + if (newval) { + element.ownerDocument.addId(newval, element); + } + } + } +); + + +// The Attr class represents a single attribute. The values in +// _attrsByQName and _attrsByLName are instances of this class. +function Attr(elt, lname, prefix, namespace) { + // Always remember what element we're associated with. + // We need this to property handle mutations + this.ownerElement = elt; + + if (!namespace && !prefix && elt._attributeChangeHandlers[lname]) + this.onchange = elt._attributeChangeHandlers[lname]; + + // localName and namespace are constant for any attr object. + // But value may change. And so can prefix, and so, therefore can name. + this.localName = lname; + this.prefix = (prefix===null || prefix==='') ? null : ('' + prefix); + this.namespaceURI = (namespace===null || namespace==='') ? null : ('' + namespace); +} + +Attr.prototype = { + get name() { + return this.prefix ? this.prefix + ':' + this.localName : this.localName; + }, + + get value() { + return this.data; + }, + + get specified() { + // Deprecated return true; -}; - -//Token creation -Tokenizer.prototype._createStartTagToken = function () { - this.currentToken = { - type: Tokenizer.START_TAG_TOKEN, - tagName: '', - selfClosing: false, - attrs: [] - }; -}; - -Tokenizer.prototype._createEndTagToken = function () { - this.currentToken = { - type: Tokenizer.END_TAG_TOKEN, - tagName: '', - attrs: [] - }; -}; - -Tokenizer.prototype._createCommentToken = function () { - this.currentToken = { - type: Tokenizer.COMMENT_TOKEN, - data: '' - }; -}; - -Tokenizer.prototype._createDoctypeToken = function (initialName) { - this.currentToken = { - type: Tokenizer.DOCTYPE_TOKEN, - name: initialName, - forceQuirks: false, - publicId: null, - systemId: null - }; -}; - -Tokenizer.prototype._createCharacterToken = function (type, ch) { - this.currentCharacterToken = { - type: type, - chars: ch - }; -}; - -//Tag attributes -Tokenizer.prototype._createAttr = function (attrNameFirstCh) { - this.currentAttr = { - name: attrNameFirstCh, - value: '' - }; -}; - -Tokenizer.prototype._isDuplicateAttr = function () { - return Tokenizer.getTokenAttr(this.currentToken, this.currentAttr.name) !== null; -}; - -Tokenizer.prototype._leaveAttrName = function (toState) { - this.state = toState; - - if (!this._isDuplicateAttr()) - this.currentToken.attrs.push(this.currentAttr); -}; + }, + + set value(value) { + var oldval = this.data; + value = (value === undefined) ? '' : value + ''; + if (value === oldval) return; + + this.data = value; + + // Run the onchange hook for the attribute + // if there is one. + if (this.onchange) + this.onchange(this.ownerElement,this.localName, oldval, value); + + // Generate a mutation event if the element is rooted + if (this.ownerElement.rooted) + this.ownerElement.ownerDocument.mutateAttr(this, oldval); + }, + + // Legacy aliases (see gh#70 and https://dom.spec.whatwg.org/#interface-attr) + get nodeName() { return this.name; }, + get nodeValue() { return this.value; }, + get textContent() { return this.value; }, + set nodeValue(v) { this.value = v; }, + set textContent(v) { this.value = v; }, +}; + + +// The attributes property of an Element will be an instance of this class. +// This class is really just a dummy, though. It only defines a length +// property and an item() method. The AttrArrayProxy that +// defines the public API just uses the Element object itself. +function AttributesArray(elt) { + this.element = elt; + for (var name in elt._attrsByQName) { + this[name] = elt._attrsByQName[name]; + } +} +AttributesArray.prototype = { + get length() { + return this.element._attrKeys.length; + }, + item: function(n) { + return this.element._attrsByLName[this.element._attrKeys[n]]; + } +}; + + +// The children property of an Element will be an instance of this class. +// It defines length, item() and namedItem() and will be wrapped by an +// HTMLCollection when exposed through the DOM. +function ChildrenCollection(e) { + this.element = e; + this.updateCache(); +} + +ChildrenCollection.prototype = { + get length() { + this.updateCache(); + return this.childrenByNumber.length; + }, + item: function item(n) { + this.updateCache(); + return this.childrenByNumber[n] || null; + }, + + namedItem: function namedItem(name) { + this.updateCache(); + return this.childrenByName[name] || null; + }, + + // This attribute returns the entire name->element map. + // It is not part of the HTMLCollection API, but we need it in + // src/HTMLCollectionProxy + get namedItems() { + this.updateCache(); + return this.childrenByName; + }, + + updateCache: function updateCache() { + var namedElts = /^(a|applet|area|embed|form|frame|frameset|iframe|img|object)$/; + if (this.lastModTime !== this.element.lastModTime) { + this.lastModTime = this.element.lastModTime; + + var n = this.childrenByNumber && this.childrenByNumber.length || 0; + for(var i = 0; i < n; i++) { + this[i] = undefined; + } -Tokenizer.prototype._leaveAttrValue = function (toState) { - this.state = toState; -}; + this.childrenByNumber = []; + this.childrenByName = Object.create(null); -//Appropriate end tag token -//(see: http://www.whatwg.org/specs/web-apps/current-work/multipage/tokenization.html#appropriate-end-tag-token) -Tokenizer.prototype._isAppropriateEndTagToken = function () { - return this.lastStartTagName === this.currentToken.tagName; -}; + for(i = 0, n = this.element.childNodes.length; i < n; i++) { + var c = this.element.childNodes[i]; + if (c.nodeType === Node.ELEMENT_NODE) { -//Token emission -Tokenizer.prototype._emitCurrentToken = function () { - this._emitCurrentCharacterToken(); + this[this.childrenByNumber.length] = c; + this.childrenByNumber.push(c); - //NOTE: store emited start tag's tagName to determine is the following end tag token is appropriate. - if (this.currentToken.type === Tokenizer.START_TAG_TOKEN) - this.lastStartTagName = this.currentToken.tagName; + // XXX Are there any requirements about the namespace + // of the id property? + var id = c.getAttribute('id'); - this.tokenQueue.push(this.currentToken); - this.currentToken = null; -}; + // If there is an id that is not already in use... + if (id && !this.childrenByName[id]) + this.childrenByName[id] = c; -Tokenizer.prototype._emitCurrentCharacterToken = function () { - if (this.currentCharacterToken) { - this.tokenQueue.push(this.currentCharacterToken); - this.currentCharacterToken = null; + // For certain HTML elements we check the name attribute + var name = c.getAttribute('name'); + if (name && + this.element.namespaceURI === NAMESPACE.HTML && + namedElts.test(this.element.localName) && + !this.childrenByName[name]) + this.childrenByName[id] = c; + } + } } + } }; -Tokenizer.prototype._emitEOFToken = function () { - this._emitCurrentCharacterToken(); - this.tokenQueue.push({type: Tokenizer.EOF_TOKEN}); -}; - -//Characters emission - -//OPTIMIZATION: specification uses only one type of character tokens (one token per character). -//This causes a huge memory overhead and a lot of unnecessary parser loops. parse5 uses 3 groups of characters. -//If we have a sequence of characters that belong to the same group, parser can process it -//as a single solid character token. -//So, there are 3 types of character tokens in parse5: -//1)NULL_CHARACTER_TOKEN - \u0000-character sequences (e.g. '\u0000\u0000\u0000') -//2)WHITESPACE_CHARACTER_TOKEN - any whitespace/new-line character sequences (e.g. '\n \r\t \f') -//3)CHARACTER_TOKEN - any character sequence which don't belong to groups 1 and 2 (e.g. 'abcdef1234@@#$%^') -Tokenizer.prototype._appendCharToCurrentCharacterToken = function (type, ch) { - if (this.currentCharacterToken && this.currentCharacterToken.type !== type) - this._emitCurrentCharacterToken(); - - if (this.currentCharacterToken) - this.currentCharacterToken.chars += ch; - - else - this._createCharacterToken(type, ch); -}; - -Tokenizer.prototype._emitCodePoint = function (cp) { - var type = Tokenizer.CHARACTER_TOKEN; - - if (isWhitespace(cp)) - type = Tokenizer.WHITESPACE_CHARACTER_TOKEN; - - else if (cp === $.NULL) - type = Tokenizer.NULL_CHARACTER_TOKEN; - - this._appendCharToCurrentCharacterToken(type, toChar(cp)); -}; - -Tokenizer.prototype._emitSeveralCodePoints = function (codePoints) { - for (var i = 0; i < codePoints.length; i++) - this._emitCodePoint(codePoints[i]); -}; - -//NOTE: used then we emit character explicitly. This is always a non-whitespace and a non-null character. -//So we can avoid additional checks here. -Tokenizer.prototype._emitChar = function (ch) { - this._appendCharToCurrentCharacterToken(Tokenizer.CHARACTER_TOKEN, ch); -}; - -//Character reference tokenization -Tokenizer.prototype._consumeNumericEntity = function (isHex) { - var digits = '', - nextCp = void 0; +// These functions return predicates for filtering elements. +// They're used by the Document and Element classes for methods like +// getElementsByTagName and getElementsByClassName - do { - digits += toChar(this._consume()); - nextCp = this._lookahead(); - } while (nextCp !== $.EOF && isDigit(nextCp, isHex)); - - if (this._lookahead() === $.SEMICOLON) - this._consume(); +function localNameElementFilter(lname) { + return function(e) { return e.localName === lname; }; +} - var referencedCp = parseInt(digits, isHex ? 16 : 10), - replacement = NUMERIC_ENTITY_REPLACEMENTS[referencedCp]; +function htmlLocalNameElementFilter(lname) { + var lclname = utils.toASCIILowerCase(lname); + if (lclname === lname) + return localNameElementFilter(lname); - if (replacement) - return replacement; + return function(e) { + return e.isHTML ? e.localName === lclname : e.localName === lname; + }; +} - if (isReservedCodePoint(referencedCp)) - return $.REPLACEMENT_CHARACTER; +function namespaceElementFilter(ns) { + return function(e) { return e.namespaceURI === ns; }; +} - return referencedCp; -}; +function namespaceLocalNameElementFilter(ns, lname) { + return function(e) { + return e.namespaceURI === ns && e.localName === lname; + }; +} -// NOTE: for the details on this algorithm see -// https://github.com/inikulin/parse5/tree/master/scripts/generate_named_entity_data/README.md -Tokenizer.prototype._consumeNamedEntity = function (inAttr) { - var referencedCodePoints = null, - referenceSize = 0, - cp = null, - consumedCount = 0, - semicolonTerminated = false; - - for (var i = 0; i > -1;) { - var current = neTree[i], - inNode = current < MAX_BRANCH_MARKER_VALUE, - nodeWithData = inNode && current & HAS_DATA_FLAG; - - if (nodeWithData) { - referencedCodePoints = current & DATA_DUPLET_FLAG ? [neTree[++i], neTree[++i]] : [neTree[++i]]; - referenceSize = consumedCount; - - if (cp === $.SEMICOLON) { - semicolonTerminated = true; - break; - } - } +// XXX +// Optimize this when I implement classList. +function classNamesElementFilter(names) { + return function(e) { + var classAttr = e.getAttribute('class'); + if (!classAttr) return false; + var classes = classAttr.trim().split(/\s+/); + return names.every(function(n) { + return classes.indexOf(n) !== -1; + }); + }; +} - cp = this._consume(); - consumedCount++; +function elementNameFilter(name) { + return function(e) { + return e.getAttribute('name') === name; + }; +} - if (cp === $.EOF) - break; - if (inNode) - i = current & HAS_BRANCHES_FLAG ? findNamedEntityTreeBranch(i, cp) : -1; +/***/ }), +/* 7 */ +/***/ (function(module, exports, __webpack_require__) { - else - i = cp === current ? ++i : -1; - } +"use strict"; +module.exports = Event; - if (referencedCodePoints) { - if (!semicolonTerminated) { - //NOTE: unconsume excess (e.g. 'it' in '¬it') - this._unconsumeSeveral(consumedCount - referenceSize); +Event.CAPTURING_PHASE = 1; +Event.AT_TARGET = 2; +Event.BUBBLING_PHASE = 3; - //NOTE: If the character reference is being consumed as part of an attribute and the next character - //is either a U+003D EQUALS SIGN character (=) or an alphanumeric ASCII character, then, for historical - //reasons, all the characters that were matched after the U+0026 AMPERSAND character (&) must be - //unconsumed, and nothing is returned. - //However, if this next character is in fact a U+003D EQUALS SIGN character (=), then this is a - //parse error, because some legacy user agents will misinterpret the markup in those cases. - //(see: http://www.whatwg.org/specs/web-apps/current-work/multipage/tokenization.html#tokenizing-character-references) - if (inAttr) { - var nextCp = this._lookahead(); +function Event(type, dictionary) { + // Initialize basic event properties + this.type = ''; + this.target = null; + this.currentTarget = null; + this.eventPhase = Event.AT_TARGET; + this.bubbles = false; + this.cancelable = false; + this.isTrusted = false; + this.defaultPrevented = false; + this.timeStamp = Date.now(); - if (nextCp === $.EQUALS_SIGN || isAsciiAlphaNumeric(nextCp)) { - this._unconsumeSeveral(referenceSize); - return null; - } - } - } + // Initialize internal flags + // XXX: Would it be better to inherit these defaults from the prototype? + this._propagationStopped = false; + this._immediatePropagationStopped = false; + this._initialized = true; + this._dispatching = false; - return referencedCodePoints; + // Now initialize based on the constructor arguments (if any) + if (type) this.type = type; + if (dictionary) { + for(var p in dictionary) { + this[p] = dictionary[p]; } + } +} - this._unconsumeSeveral(consumedCount); - - return null; -}; - -Tokenizer.prototype._consumeCharacterReference = function (startCp, inAttr) { - if (isWhitespace(startCp) || startCp === $.GREATER_THAN_SIGN || - startCp === $.AMPERSAND || startCp === this.additionalAllowedCp || startCp === $.EOF) { - //NOTE: not a character reference. No characters are consumed, and nothing is returned. - this._unconsume(); - return null; - } +Event.prototype = Object.create(Object.prototype, { + constructor: { value: Event }, + stopPropagation: { value: function stopPropagation() { + this._propagationStopped = true; + }}, - if (startCp === $.NUMBER_SIGN) { - //NOTE: we have a numeric entity candidate, now we should determine if it's hex or decimal - var isHex = false, - nextCp = this._lookahead(); + stopImmediatePropagation: { value: function stopImmediatePropagation() { + this._propagationStopped = true; + this._immediatePropagationStopped = true; + }}, - if (nextCp === $.LATIN_SMALL_X || nextCp === $.LATIN_CAPITAL_X) { - this._consume(); - isHex = true; - } + preventDefault: { value: function preventDefault() { + if (this.cancelable) this.defaultPrevented = true; + }}, - nextCp = this._lookahead(); + initEvent: { value: function initEvent(type, bubbles, cancelable) { + this._initialized = true; + if (this._dispatching) return; - //NOTE: if we have at least one digit this is a numeric entity for sure, so we consume it - if (nextCp !== $.EOF && isDigit(nextCp, isHex)) - return [this._consumeNumericEntity(isHex)]; + this._propagationStopped = false; + this._immediatePropagationStopped = false; + this.defaultPrevented = false; + this.isTrusted = false; - //NOTE: otherwise this is a bogus number entity and a parse error. Unconsume the number sign - //and the 'x'-character if appropriate. - this._unconsumeSeveral(isHex ? 2 : 1); - return null; - } + this.target = null; + this.type = type; + this.bubbles = bubbles; + this.cancelable = cancelable; + }}, - this._unconsume(); +}); - return this._consumeNamedEntity(inAttr); -}; -//State machine -var _ = Tokenizer.prototype; +/***/ }), +/* 8 */ +/***/ (function(module, exports, __webpack_require__) { -//12.2.4.1 Data state -//------------------------------------------------------------------ -_[DATA_STATE] = function dataState(cp) { - this.preprocessor.dropParsedChunk(); +"use strict"; - if (cp === $.AMPERSAND) - this.state = CHARACTER_REFERENCE_IN_DATA_STATE; +module.exports = CharacterData; + +var Leaf = __webpack_require__(34); +var utils = __webpack_require__(1); +var ChildNode = __webpack_require__(16); +var NonDocumentTypeChildNode = __webpack_require__(37); + +function CharacterData() { +} + +CharacterData.prototype = Object.create(Leaf.prototype, { + // DOMString substringData(unsigned long offset, + // unsigned long count); + // The substringData(offset, count) method must run these steps: + // + // If offset is greater than the context object's + // length, throw an INDEX_SIZE_ERR exception and + // terminate these steps. + // + // If offset+count is greater than the context + // object's length, return a DOMString whose value is + // the UTF-16 code units from the offsetth UTF-16 code + // unit to the end of data. + // + // Return a DOMString whose value is the UTF-16 code + // units from the offsetth UTF-16 code unit to the + // offset+countth UTF-16 code unit in data. + substringData: { value: function substringData(offset, count) { + if (offset > this.data.length || offset < 0 || count < 0) + utils.IndexSizeError(); + return this.data.substring(offset, offset+count); + }}, + + // void appendData(DOMString data); + // The appendData(data) method must append data to the context + // object's data. + appendData: { value: function appendData(data) { + this.data = this.data + data; + }}, + + // void insertData(unsigned long offset, DOMString data); + // The insertData(offset, data) method must run these steps: + // + // If offset is greater than the context object's + // length, throw an INDEX_SIZE_ERR exception and + // terminate these steps. + // + // Insert data into the context object's data after + // offset UTF-16 code units. + // + insertData: { value: function insertData(offset, data) { + var curtext = this.data; + if (offset > curtext.length || offset < 0) utils.IndexSizeError(); + var prefix = curtext.substring(0, offset), + suffix = curtext.substring(offset); + this.data = prefix + data + suffix; + }}, + + + // void deleteData(unsigned long offset, unsigned long count); + // The deleteData(offset, count) method must run these steps: + // + // If offset is greater than the context object's + // length, throw an INDEX_SIZE_ERR exception and + // terminate these steps. + // + // If offset+count is greater than the context + // object's length var count be length-offset. + // + // Starting from offset UTF-16 code units remove count + // UTF-16 code units from the context object's data. + deleteData: { value: function deleteData(offset, count) { + var curtext = this.data, len = curtext.length; + + if (offset > len || offset < 0) utils.IndexSizeError(); + + if (offset+count > len) + count = len - offset; + + var prefix = curtext.substring(0, offset), + suffix = curtext.substring(offset+count); + + this.data = prefix + suffix; + }}, + + + // void replaceData(unsigned long offset, unsigned long count, + // DOMString data); + // + // The replaceData(offset, count, data) method must act as + // if the deleteData() method is invoked with offset and + // count as arguments followed by the insertData() method + // with offset and data as arguments and re-throw any + // exceptions these methods might have thrown. + replaceData: { value: function replaceData(offset, count, data) { + var curtext = this.data, len = curtext.length; + + if (offset > len || offset < 0) utils.IndexSizeError(); + + if (offset+count > len) + count = len - offset; + + var prefix = curtext.substring(0, offset), + suffix = curtext.substring(offset+count); + + this.data = prefix + data + suffix; + }}, + + // Utility method that Node.isEqualNode() calls to test Text and + // Comment nodes for equality. It is okay to put it here, since + // Node will have already verified that nodeType is equal + isEqual: { value: function isEqual(n) { + return this._data === n._data; + }}, + + length: { get: function() { return this.data.length; }} - else if (cp === $.LESS_THAN_SIGN) - this.state = TAG_OPEN_STATE; +}); - else if (cp === $.NULL) - this._emitCodePoint(cp); +Object.defineProperties(CharacterData.prototype, ChildNode); +Object.defineProperties(CharacterData.prototype, NonDocumentTypeChildNode); - else if (cp === $.EOF) - this._emitEOFToken(); - else - this._emitCodePoint(cp); -}; +/***/ }), +/* 9 */ +/***/ (function(module, exports, __webpack_require__) { +"use strict"; -//12.2.4.2 Character reference in data state -//------------------------------------------------------------------ -_[CHARACTER_REFERENCE_IN_DATA_STATE] = function characterReferenceInDataState(cp) { - this.additionalAllowedCp = void 0; +module.exports = DOMImplementation; - var referencedCodePoints = this._consumeCharacterReference(cp, false); +var Document = __webpack_require__(17); +var DocumentType = __webpack_require__(18); +var HTMLParser = __webpack_require__(19); +var utils = __webpack_require__(1); +var xml = __webpack_require__(24); - if (!this._ensureHibernation()) { - if (referencedCodePoints) - this._emitSeveralCodePoints(referencedCodePoints); +// Each document must have its own instance of the domimplementation object +// Even though these objects have no state +function DOMImplementation() {} - else - this._emitChar('&'); - this.state = DATA_STATE; - } +// Feature/version pairs that DOMImplementation.hasFeature() returns +// true for. It returns false for anything else. +var supportedFeatures = { + 'xml': { '': true, '1.0': true, '2.0': true }, // DOM Core + 'core': { '': true, '2.0': true }, // DOM Core + 'html': { '': true, '1.0': true, '2.0': true} , // HTML + 'xhtml': { '': true, '1.0': true, '2.0': true} , // HTML }; +DOMImplementation.prototype = { + hasFeature: function hasFeature(feature, version) { + var f = supportedFeatures[(feature || '').toLowerCase()]; + return (f && f[version || '']) || false; + }, -//12.2.4.3 RCDATA state -//------------------------------------------------------------------ -_[RCDATA_STATE] = function rcdataState(cp) { - this.preprocessor.dropParsedChunk(); + createDocumentType: function createDocumentType(qualifiedName, publicId, systemId) { + if (!xml.isValidName(qualifiedName)) utils.InvalidCharacterError(); + if (!xml.isValidQName(qualifiedName)) utils.NamespaceError(); - if (cp === $.AMPERSAND) - this.state = CHARACTER_REFERENCE_IN_RCDATA_STATE; + return new DocumentType(qualifiedName, publicId, systemId); + }, - else if (cp === $.LESS_THAN_SIGN) - this.state = RCDATA_LESS_THAN_SIGN_STATE; - - else if (cp === $.NULL) - this._emitChar(UNICODE.REPLACEMENT_CHARACTER); - - else if (cp === $.EOF) - this._emitEOFToken(); + createDocument: function createDocument(namespace, qualifiedName, doctype) { + // + // Note that the current DOMCore spec makes it impossible to + // create an HTML document with this function, even if the + // namespace and doctype are propertly set. See this thread: + // http://lists.w3.org/Archives/Public/www-dom/2011AprJun/0132.html + // + var d = new Document(false, null); + var e; + if (qualifiedName) + e = d.createElementNS(namespace, qualifiedName); else - this._emitCodePoint(cp); -}; - - -//12.2.4.4 Character reference in RCDATA state -//------------------------------------------------------------------ -_[CHARACTER_REFERENCE_IN_RCDATA_STATE] = function characterReferenceInRcdataState(cp) { - this.additionalAllowedCp = void 0; - - var referencedCodePoints = this._consumeCharacterReference(cp, false); - - if (!this._ensureHibernation()) { - if (referencedCodePoints) - this._emitSeveralCodePoints(referencedCodePoints); - - else - this._emitChar('&'); + e = null; - this.state = RCDATA_STATE; + if (doctype) { + if (doctype.ownerDocument) utils.WrongDocumentError(); + d.appendChild(doctype); } -}; - - -//12.2.4.5 RAWTEXT state -//------------------------------------------------------------------ -_[RAWTEXT_STATE] = function rawtextState(cp) { - this.preprocessor.dropParsedChunk(); - - if (cp === $.LESS_THAN_SIGN) - this.state = RAWTEXT_LESS_THAN_SIGN_STATE; - - else if (cp === $.NULL) - this._emitChar(UNICODE.REPLACEMENT_CHARACTER); - - else if (cp === $.EOF) - this._emitEOFToken(); - - else - this._emitCodePoint(cp); -}; - - -//12.2.4.6 Script data state -//------------------------------------------------------------------ -_[SCRIPT_DATA_STATE] = function scriptDataState(cp) { - this.preprocessor.dropParsedChunk(); - - if (cp === $.LESS_THAN_SIGN) - this.state = SCRIPT_DATA_LESS_THAN_SIGN_STATE; - - else if (cp === $.NULL) - this._emitChar(UNICODE.REPLACEMENT_CHARACTER); - - else if (cp === $.EOF) - this._emitEOFToken(); - - else - this._emitCodePoint(cp); -}; - - -//12.2.4.7 PLAINTEXT state -//------------------------------------------------------------------ -_[PLAINTEXT_STATE] = function plaintextState(cp) { - this.preprocessor.dropParsedChunk(); - - if (cp === $.NULL) - this._emitChar(UNICODE.REPLACEMENT_CHARACTER); - - else if (cp === $.EOF) - this._emitEOFToken(); - - else - this._emitCodePoint(cp); -}; + if (e) d.appendChild(e); -//12.2.4.8 Tag open state -//------------------------------------------------------------------ -_[TAG_OPEN_STATE] = function tagOpenState(cp) { - if (cp === $.EXCLAMATION_MARK) - this.state = MARKUP_DECLARATION_OPEN_STATE; + return d; + }, - else if (cp === $.SOLIDUS) - this.state = END_TAG_OPEN_STATE; + createHTMLDocument: function createHTMLDocument(titleText) { + var d = new Document(true, null); + d.appendChild(new DocumentType('html')); + var html = d.createElement('html'); + d.appendChild(html); + var head = d.createElement('head'); + html.appendChild(head); + var title = d.createElement('title'); + head.appendChild(title); + title.appendChild(d.createTextNode(titleText)); + html.appendChild(d.createElement('body')); + d.modclock = 1; // Start tracking modifications + return d; + }, - else if (isAsciiLetter(cp)) { - this._createStartTagToken(); - this._reconsumeInState(TAG_NAME_STATE); - } + mozSetOutputMutationHandler: function(doc, handler) { + doc.mutationHandler = handler; + }, - else if (cp === $.QUESTION_MARK) - this._reconsumeInState(BOGUS_COMMENT_STATE); + mozGetInputMutationHandler: function(doc) { + utils.nyi(); + }, - else { - this._emitChar('<'); - this._reconsumeInState(DATA_STATE); - } + mozHTMLParser: HTMLParser, }; -//12.2.4.9 End tag open state -//------------------------------------------------------------------ -_[END_TAG_OPEN_STATE] = function endTagOpenState(cp) { - if (isAsciiLetter(cp)) { - this._createEndTagToken(); - this._reconsumeInState(TAG_NAME_STATE); - } +/***/ }), +/* 10 */ +/***/ (function(module, exports, __webpack_require__) { - else if (cp === $.GREATER_THAN_SIGN) - this.state = DATA_STATE; +"use strict"; - else if (cp === $.EOF) { - this._reconsumeInState(DATA_STATE); - this._emitChar('<'); - this._emitChar('/'); - } +var NodeFilter = { + // Constants for acceptNode() + FILTER_ACCEPT: 1, + FILTER_REJECT: 2, + FILTER_SKIP: 3, - else - this._reconsumeInState(BOGUS_COMMENT_STATE); + // Constants for whatToShow + SHOW_ALL: 0xFFFFFFFF, + SHOW_ELEMENT: 0x1, + SHOW_ATTRIBUTE: 0x2, // historical + SHOW_TEXT: 0x4, + SHOW_CDATA_SECTION: 0x8, // historical + SHOW_ENTITY_REFERENCE: 0x10, // historical + SHOW_ENTITY: 0x20, // historical + SHOW_PROCESSING_INSTRUCTION: 0x40, + SHOW_COMMENT: 0x80, + SHOW_DOCUMENT: 0x100, + SHOW_DOCUMENT_TYPE: 0x200, + SHOW_DOCUMENT_FRAGMENT: 0x400, + SHOW_NOTATION: 0x800 // historical }; +module.exports = (NodeFilter.constructor = NodeFilter.prototype = NodeFilter); -//12.2.4.10 Tag name state -//------------------------------------------------------------------ -_[TAG_NAME_STATE] = function tagNameState(cp) { - if (isWhitespace(cp)) - this.state = BEFORE_ATTRIBUTE_NAME_STATE; - - else if (cp === $.SOLIDUS) - this.state = SELF_CLOSING_START_TAG_STATE; - else if (cp === $.GREATER_THAN_SIGN) { - this.state = DATA_STATE; - this._emitCurrentToken(); - } - - else if (isAsciiUpper(cp)) - this.currentToken.tagName += toAsciiLowerChar(cp); - - else if (cp === $.NULL) - this.currentToken.tagName += UNICODE.REPLACEMENT_CHARACTER; +/***/ }), +/* 11 */ +/***/ (function(module, exports, __webpack_require__) { - else if (cp === $.EOF) - this._reconsumeInState(DATA_STATE); +"use strict"; - else - this.currentToken.tagName += toChar(cp); -}; +module.exports = NodeList; +function item(i) { + /* jshint validthis: true */ + return this[i]; +} -//12.2.4.11 RCDATA less-than sign state -//------------------------------------------------------------------ -_[RCDATA_LESS_THAN_SIGN_STATE] = function rcdataLessThanSignState(cp) { - if (cp === $.SOLIDUS) { - this.tempBuff = []; - this.state = RCDATA_END_TAG_OPEN_STATE; - } +function NodeList(a) { + if (!a) a = []; + a.item = item; + return a; +} - else { - this._emitChar('<'); - this._reconsumeInState(RCDATA_STATE); - } -}; +/***/ }), +/* 12 */ +/***/ (function(module, exports, __webpack_require__) { -//12.2.4.12 RCDATA end tag open state -//------------------------------------------------------------------ -_[RCDATA_END_TAG_OPEN_STATE] = function rcdataEndTagOpenState(cp) { - if (isAsciiLetter(cp)) { - this._createEndTagToken(); - this._reconsumeInState(RCDATA_END_TAG_NAME_STATE); - } +"use strict"; - else { - this._emitChar('<'); - this._emitChar('/'); - this._reconsumeInState(RCDATA_STATE); - } -}; +var AsyncAction_1 = __webpack_require__(115); +var AsyncScheduler_1 = __webpack_require__(116); +/** + * + * Async Scheduler + * + * Schedule task as if you used setTimeout(task, duration) + * + * `async` scheduler schedules tasks asynchronously, by putting them on the JavaScript + * event loop queue. It is best used to delay tasks in time or to schedule tasks repeating + * in intervals. + * + * If you just want to "defer" task, that is to perform it right after currently + * executing synchronous code ends (commonly achieved by `setTimeout(deferredTask, 0)`), + * better choice will be the {@link asap} scheduler. + * + * @example Use async scheduler to delay task + * const task = () => console.log('it works!'); + * + * Rx.Scheduler.async.schedule(task, 2000); + * + * // After 2 seconds logs: + * // "it works!" + * + * + * @example Use async scheduler to repeat task in intervals + * function task(state) { + * console.log(state); + * this.schedule(state + 1, 1000); // `this` references currently executing Action, + * // which we reschedule with new state and delay + * } + * + * Rx.Scheduler.async.schedule(task, 3000, 0); + * + * // Logs: + * // 0 after 3s + * // 1 after 4s + * // 2 after 5s + * // 3 after 6s + * + * @static true + * @name async + * @owner Scheduler + */ +exports.async = new AsyncScheduler_1.AsyncScheduler(AsyncAction_1.AsyncAction); +//# sourceMappingURL=async.js.map +/***/ }), +/* 13 */ +/***/ (function(module, exports, __webpack_require__) { -//12.2.4.13 RCDATA end tag name state -//------------------------------------------------------------------ -_[RCDATA_END_TAG_NAME_STATE] = function rcdataEndTagNameState(cp) { - if (isAsciiUpper(cp)) { - this.currentToken.tagName += toAsciiLowerChar(cp); - this.tempBuff.push(cp); - } +module.exports = (__webpack_require__(0))(43); - else if (isAsciiLower(cp)) { - this.currentToken.tagName += toChar(cp); - this.tempBuff.push(cp); - } +/***/ }), +/* 14 */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { - else { - if (this._isAppropriateEndTagToken()) { - if (isWhitespace(cp)) { - this.state = BEFORE_ATTRIBUTE_NAME_STATE; - return; - } +"use strict"; +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return AuthService; }); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__(4); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0__angular_core__); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__angular_common_http__ = __webpack_require__(13); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__angular_common_http___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1__angular_common_http__); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_angular_auth_oidc_client__ = __webpack_require__(27); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_angular_auth_oidc_client___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2_angular_auth_oidc_client__); +var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { + var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); + else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; + return c > 3 && r && Object.defineProperty(target, key, r), r; +}; +var __metadata = (this && this.__metadata) || function (k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); +}; +var __param = (this && this.__param) || function (paramIndex, decorator) { + return function (target, key) { decorator(target, key, paramIndex); } +}; + + + +var AuthService = (function () { + function AuthService(oidcSecurityService, http, originUrl, identityUrl) { + var _this = this; + this.oidcSecurityService = oidcSecurityService; + this.http = http; + var openIdImplicitFlowConfiguration = new __WEBPACK_IMPORTED_MODULE_2_angular_auth_oidc_client__["OpenIDImplicitFlowConfiguration"](); + openIdImplicitFlowConfiguration.stsServer = identityUrl; + openIdImplicitFlowConfiguration.redirect_url = originUrl + 'callback'; + openIdImplicitFlowConfiguration.client_id = 'ng'; + openIdImplicitFlowConfiguration.response_type = 'id_token token'; + openIdImplicitFlowConfiguration.scope = 'openid profile apiApp'; + openIdImplicitFlowConfiguration.post_logout_redirect_uri = originUrl + 'home'; + openIdImplicitFlowConfiguration.forbidden_route = '/forbidden'; + openIdImplicitFlowConfiguration.unauthorized_route = '/unauthorized'; + openIdImplicitFlowConfiguration.auto_userinfo = true; + openIdImplicitFlowConfiguration.log_console_warning_active = true; + openIdImplicitFlowConfiguration.log_console_debug_active = false; + openIdImplicitFlowConfiguration.max_id_token_iat_offset_allowed_in_seconds = 10; + this.oidcSecurityService.setupModule(openIdImplicitFlowConfiguration); + if (this.oidcSecurityService.moduleSetup) { + this.doCallbackLogicIfRequired(); + } + else { + this.oidcSecurityService.onModuleSetup.subscribe(function () { + _this.doCallbackLogicIfRequired(); + }); + } + } + AuthService.prototype.ngOnInit = function () { + var _this = this; + this.isAuthorizedSubscription = this.oidcSecurityService.getIsAuthorized().subscribe(function (isAuthorized) { + _this.isAuthorized = isAuthorized; + }); + }; + AuthService.prototype.ngOnDestroy = function () { + this.isAuthorizedSubscription.unsubscribe(); + this.oidcSecurityService.onModuleSetup.unsubscribe(); + }; + AuthService.prototype.getIsAuthorized = function () { + return this.oidcSecurityService.getIsAuthorized(); + }; + AuthService.prototype.login = function () { + console.log('start login'); + this.oidcSecurityService.authorize(); + }; + AuthService.prototype.refreshSession = function () { + console.log('start refreshSession'); + this.oidcSecurityService.authorize(); + }; + AuthService.prototype.logout = function () { + console.log('start logoff'); + this.oidcSecurityService.logoff(); + }; + AuthService.prototype.doCallbackLogicIfRequired = function () { + if (typeof location !== "undefined" && window.location.hash) { + this.oidcSecurityService.authorizedCallback(); + } + }; + AuthService.prototype.get = function (url) { + return this.http.get(url, { headers: this.getHeaders() }); + }; + AuthService.prototype.put = function (url, data) { + var body = JSON.stringify(data); + return this.http.put(url, body, { headers: this.getHeaders() }); + }; + AuthService.prototype.delete = function (url) { + return this.http.delete(url, { headers: this.getHeaders() }); + }; + AuthService.prototype.post = function (url, data) { + var body = JSON.stringify(data); + return this.http.post(url, body, { headers: this.getHeaders() }); + }; + AuthService.prototype.getHeaders = function () { + var headers = new __WEBPACK_IMPORTED_MODULE_1__angular_common_http__["HttpHeaders"](); + headers = headers.set('Content-Type', 'application/json'); + return this.appendAuthHeader(headers); + }; + AuthService.prototype.appendAuthHeader = function (headers) { + var token = this.oidcSecurityService.getToken(); + if (token === '') + return headers; + var tokenValue = 'Bearer ' + token; + return headers.set('Authorization', tokenValue); + }; + AuthService = __decorate([ + __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Injectable"])(), + __param(2, __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Inject"])('ORIGIN_URL')), + __param(3, __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Inject"])('IDENTITY_URL')), + __metadata("design:paramtypes", [__WEBPACK_IMPORTED_MODULE_2_angular_auth_oidc_client__["OidcSecurityService"], + __WEBPACK_IMPORTED_MODULE_1__angular_common_http__["HttpClient"], String, String]) + ], AuthService); + return AuthService; +}()); + - if (cp === $.SOLIDUS) { - this.state = SELF_CLOSING_START_TAG_STATE; - return; - } - if (cp === $.GREATER_THAN_SIGN) { - this.state = DATA_STATE; - this._emitCurrentToken(); - return; - } - } +/***/ }), +/* 15 */ +/***/ (function(module, exports, __webpack_require__) { - this._emitChar('<'); - this._emitChar('/'); - this._emitSeveralCodePoints(this.tempBuff); - this._reconsumeInState(RCDATA_STATE); - } -}; +"use strict"; +var parserlib = __webpack_require__(81); -//12.2.4.14 RAWTEXT less-than sign state -//------------------------------------------------------------------ -_[RAWTEXT_LESS_THAN_SIGN_STATE] = function rawtextLessThanSignState(cp) { - if (cp === $.SOLIDUS) { - this.tempBuff = []; - this.state = RAWTEXT_END_TAG_OPEN_STATE; - } +module.exports = CSSStyleDeclaration; - else { - this._emitChar('<'); - this._reconsumeInState(RAWTEXT_STATE); - } -}; +function CSSStyleDeclaration(elt) { + this._element = elt; +} +// Utility function for parsing style declarations +// Pass in a string like "margin-left: 5px; border-style: solid" +// and this function returns an object like +// {"margin-left":"5px", "border-style":"solid"} +function parseStyles(s) { + var parser = new parserlib.css.Parser(); + var result = { property: Object.create(null), priority: Object.create(null) }; + parser.addListener("property", function(e) { + if (e.invalid) return; // Skip errors + result.property[e.property.text] = e.value.text; + if (e.important) result.priority[e.property.text] = 'important'; + }); + s = (''+s).replace(/^;/, ''); + parser.parseStyleAttribute(s); + return result; +} -//12.2.4.15 RAWTEXT end tag open state -//------------------------------------------------------------------ -_[RAWTEXT_END_TAG_OPEN_STATE] = function rawtextEndTagOpenState(cp) { - if (isAsciiLetter(cp)) { - this._createEndTagToken(); - this._reconsumeInState(RAWTEXT_END_TAG_NAME_STATE); - } +var NO_CHANGE = {}; // Private marker object - else { - this._emitChar('<'); - this._emitChar('/'); - this._reconsumeInState(RAWTEXT_STATE); +CSSStyleDeclaration.prototype = Object.create(Object.prototype, { + + // Return the parsed form of the element's style attribute. + // If the element's style attribute has never been parsed + // or if it has changed since the last parse, then reparse it + // Note that the styles don't get parsed until they're actually needed + _parsed: { get: function() { + if (!this._parsedStyles || this.cssText !== this._lastParsedText) { + var text = this.cssText; + this._parsedStyles = parseStyles(text); + this._lastParsedText = text; + delete this._names; } -}; + return this._parsedStyles; + }}, + // Call this method any time the parsed representation of the + // style changes. It converts the style properties to a string and + // sets cssText and the element's style attribute + _serialize: { value: function() { + var styles = this._parsed; + var s = ""; -//12.2.4.16 RAWTEXT end tag name state -//------------------------------------------------------------------ -_[RAWTEXT_END_TAG_NAME_STATE] = function rawtextEndTagNameState(cp) { - if (isAsciiUpper(cp)) { - this.currentToken.tagName += toAsciiLowerChar(cp); - this.tempBuff.push(cp); + for(var name in styles.property) { + if (s) s += " "; + s += name + ": " + styles.property[name]; + if (styles.priority[name]) { + s += " !" + styles.priority[name]; + } + s += ";"; } - else if (isAsciiLower(cp)) { - this.currentToken.tagName += toChar(cp); - this.tempBuff.push(cp); - } + this.cssText = s; // also sets the style attribute + this._lastParsedText = s; // so we don't reparse + delete this._names; + }}, - else { - if (this._isAppropriateEndTagToken()) { - if (isWhitespace(cp)) { - this.state = BEFORE_ATTRIBUTE_NAME_STATE; - return; - } + cssText: { + get: function() { + // XXX: this is a CSSStyleDeclaration for an element. + // A different impl might be necessary for a set of styles + // associated returned by getComputedStyle(), e.g. + return this._element.getAttribute("style"); + }, + set: function(value) { + // XXX: I should parse and serialize the value to + // normalize it and remove errors. FF and chrome do that. + this._element.setAttribute("style", value); + } + }, - if (cp === $.SOLIDUS) { - this.state = SELF_CLOSING_START_TAG_STATE; - return; - } + length: { get: function() { + if (!this._names) + this._names = Object.getOwnPropertyNames(this._parsed.property); + return this._names.length; + }}, - if (cp === $.GREATER_THAN_SIGN) { - this._emitCurrentToken(); - this.state = DATA_STATE; - return; - } - } + item: { value: function(n) { + if (!this._names) + this._names = Object.getOwnPropertyNames(this._parsed.property); + return this._names[n]; + }}, - this._emitChar('<'); - this._emitChar('/'); - this._emitSeveralCodePoints(this.tempBuff); - this._reconsumeInState(RAWTEXT_STATE); - } -}; + getPropertyValue: { value: function(property) { + property = property.toLowerCase(); + return this._parsed.property[property] || ""; + }}, + getPropertyPriority: { value: function(property) { + property = property.toLowerCase(); + return this._parsed.priority[property] || ""; + }}, -//12.2.4.17 Script data less-than sign state -//------------------------------------------------------------------ -_[SCRIPT_DATA_LESS_THAN_SIGN_STATE] = function scriptDataLessThanSignState(cp) { - if (cp === $.SOLIDUS) { - this.tempBuff = []; - this.state = SCRIPT_DATA_END_TAG_OPEN_STATE; + setProperty: { value: function(property, value, priority) { + property = property.toLowerCase(); + if (value === null || value === undefined) { + value = ""; } - - else if (cp === $.EXCLAMATION_MARK) { - this.state = SCRIPT_DATA_ESCAPE_START_STATE; - this._emitChar('<'); - this._emitChar('!'); + if (priority === null || priority === undefined) { + priority = ""; } - else { - this._emitChar('<'); - this._reconsumeInState(SCRIPT_DATA_STATE); + // String coercion + if (value !== NO_CHANGE) { + value = "" + value; } -}; - -//12.2.4.18 Script data end tag open state -//------------------------------------------------------------------ -_[SCRIPT_DATA_END_TAG_OPEN_STATE] = function scriptDataEndTagOpenState(cp) { - if (isAsciiLetter(cp)) { - this._createEndTagToken(); - this._reconsumeInState(SCRIPT_DATA_END_TAG_NAME_STATE); + if (value === "") { + this.removeProperty(property); + return; } - else { - this._emitChar('<'); - this._emitChar('/'); - this._reconsumeInState(SCRIPT_DATA_STATE); + if (priority !== "" && priority !== NO_CHANGE && + !/^important$/i.test(priority)) { + return; } -}; + var styles = this._parsed; + if (value === NO_CHANGE) { + if (!styles.property[property]) { + return; // Not a valid property name. + } + if (priority !== "") { + styles.priority[property] = "important"; + } else { + delete styles.priority[property]; + } + } else { + // We don't just accept the property value. Instead + // we parse it to ensure that it is something valid. + // If it contains a semicolon it is invalid + if (value.indexOf(";") !== -1) return; + + var newprops = parseStyles(property + ":" + value); + if (Object.getOwnPropertyNames(newprops.property).length === 0) { + return; // no valid property found + } + if (Object.getOwnPropertyNames(newprops.priority).length !== 0) { + return; // if the value included '!important' it wasn't valid. + } -//12.2.4.19 Script data end tag name state -//------------------------------------------------------------------ -_[SCRIPT_DATA_END_TAG_NAME_STATE] = function scriptDataEndTagNameState(cp) { - if (isAsciiUpper(cp)) { - this.currentToken.tagName += toAsciiLowerChar(cp); - this.tempBuff.push(cp); - } + // XXX handle shorthand properties - else if (isAsciiLower(cp)) { - this.currentToken.tagName += toChar(cp); - this.tempBuff.push(cp); + for (var p in newprops.property) { + styles.property[p] = newprops.property[p]; + if (priority === NO_CHANGE) { + continue; + } else if (priority !== "") { + styles.priority[p] = "important"; + } else if (styles.priority[p]) { + delete styles.priority[p]; + } + } } - else { - if (this._isAppropriateEndTagToken()) { - if (isWhitespace(cp)) { - this.state = BEFORE_ATTRIBUTE_NAME_STATE; - return; - } + // Serialize and update cssText and element.style! + this._serialize(); + }}, - else if (cp === $.SOLIDUS) { - this.state = SELF_CLOSING_START_TAG_STATE; - return; - } + setPropertyValue: { value: function(property, value) { + return this.setProperty(property, value, NO_CHANGE); + }}, - else if (cp === $.GREATER_THAN_SIGN) { - this._emitCurrentToken(); - this.state = DATA_STATE; - return; - } - } + setPropertyPriority: { value: function(property, priority) { + return this.setProperty(property, NO_CHANGE, priority); + }}, - this._emitChar('<'); - this._emitChar('/'); - this._emitSeveralCodePoints(this.tempBuff); - this._reconsumeInState(SCRIPT_DATA_STATE); - } -}; + removeProperty: { value: function(property) { + property = property.toLowerCase(); + var styles = this._parsed; + if (property in styles.property) { + delete styles.property[property]; + delete styles.priority[property]; + // Serialize and update cssText and element.style! + this._serialize(); + } + }}, +}); -//12.2.4.20 Script data escape start state -//------------------------------------------------------------------ -_[SCRIPT_DATA_ESCAPE_START_STATE] = function scriptDataEscapeStartState(cp) { - if (cp === $.HYPHEN_MINUS) { - this.state = SCRIPT_DATA_ESCAPE_START_DASH_STATE; - this._emitChar('-'); +var cssProperties = { + background: "background", + backgroundAttachment: "background-attachment", + backgroundColor: "background-color", + backgroundImage: "background-image", + backgroundPosition: "background-position", + backgroundRepeat: "background-repeat", + border: "border", + borderCollapse: "border-collapse", + borderColor: "border-color", + borderSpacing: "border-spacing", + borderStyle: "border-style", + borderTop: "border-top", + borderRight: "border-right", + borderBottom: "border-bottom", + borderLeft: "border-left", + borderTopColor: "border-top-color", + borderRightColor: "border-right-color", + borderBottomColor: "border-bottom-color", + borderLeftColor: "border-left-color", + borderTopStyle: "border-top-style", + borderRightStyle: "border-right-style", + borderBottomStyle: "border-bottom-style", + borderLeftStyle: "border-left-style", + borderTopWidth: "border-top-width", + borderRightWidth: "border-right-width", + borderBottomWidth: "border-bottom-width", + borderLeftWidth: "border-left-width", + borderWidth: "border-width", + bottom: "bottom", + captionSide: "caption-side", + clear: "clear", + clip: "clip", + color: "color", + content: "content", + counterIncrement: "counter-increment", + counterReset: "counter-reset", + cursor: "cursor", + direction: "direction", + display: "display", + emptyCells: "empty-cells", + cssFloat: "float", + font: "font", + fontFamily: "font-family", + fontSize: "font-size", + fontSizeAdjust: "font-size-adjust", + fontStretch: "font-stretch", + fontStyle: "font-style", + fontVariant: "font-variant", + fontWeight: "font-weight", + height: "height", + left: "left", + letterSpacing: "letter-spacing", + lineHeight: "line-height", + listStyle: "list-style", + listStyleImage: "list-style-image", + listStylePosition: "list-style-position", + listStyleType: "list-style-type", + margin: "margin", + marginTop: "margin-top", + marginRight: "margin-right", + marginBottom: "margin-bottom", + marginLeft: "margin-left", + markerOffset: "marker-offset", + marks: "marks", + maxHeight: "max-height", + maxWidth: "max-width", + minHeight: "min-height", + minWidth: "min-width", + opacity: "opacity", + orphans: "orphans", + outline: "outline", + outlineColor: "outline-color", + outlineStyle: "outline-style", + outlineWidth: "outline-width", + overflow: "overflow", + padding: "padding", + paddingTop: "padding-top", + paddingRight: "padding-right", + paddingBottom: "padding-bottom", + paddingLeft: "padding-left", + page: "page", + pageBreakAfter: "page-break-after", + pageBreakBefore: "page-break-before", + pageBreakInside: "page-break-inside", + position: "position", + quotes: "quotes", + right: "right", + size: "size", + tableLayout: "table-layout", + textAlign: "text-align", + textDecoration: "text-decoration", + textIndent: "text-indent", + textShadow: "text-shadow", + textTransform: "text-transform", + top: "top", + unicodeBidi: "unicode-bidi", + verticalAlign: "vertical-align", + visibility: "visibility", + whiteSpace: "white-space", + widows: "widows", + width: "width", + wordSpacing: "word-spacing", + zIndex: "z-index", +}; + +for(var prop in cssProperties) defineStyleProperty(prop); + +function defineStyleProperty(jsname) { + var cssname = cssProperties[jsname]; + Object.defineProperty(CSSStyleDeclaration.prototype, jsname, { + get: function() { + return this.getPropertyValue(cssname); + }, + set: function(value) { + this.setProperty(cssname, value); } + }); +} - else - this._reconsumeInState(SCRIPT_DATA_STATE); -}; +/***/ }), +/* 16 */ +/***/ (function(module, exports, __webpack_require__) { -//12.2.4.21 Script data escape start dash state -//------------------------------------------------------------------ -_[SCRIPT_DATA_ESCAPE_START_DASH_STATE] = function scriptDataEscapeStartDashState(cp) { - if (cp === $.HYPHEN_MINUS) { - this.state = SCRIPT_DATA_ESCAPED_DASH_DASH_STATE; - this._emitChar('-'); - } +"use strict"; - else - this._reconsumeInState(SCRIPT_DATA_STATE); -}; +var Node = __webpack_require__(3); -//12.2.4.22 Script data escaped state -//------------------------------------------------------------------ -_[SCRIPT_DATA_ESCAPED_STATE] = function scriptDataEscapedState(cp) { - if (cp === $.HYPHEN_MINUS) { - this.state = SCRIPT_DATA_ESCAPED_DASH_STATE; - this._emitChar('-'); - } +var createDocumentFragmentFromArguments = function(document, args) { + var docFrag = document.createDocumentFragment(); - else if (cp === $.LESS_THAN_SIGN) - this.state = SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN_STATE; + for (var i=0; i'); - } +"use strict"; - else if (cp === $.NULL) { - this.state = SCRIPT_DATA_ESCAPED_STATE; - this._emitChar(UNICODE.REPLACEMENT_CHARACTER); +module.exports = Document; + +var Node = __webpack_require__(3); +var NodeList = __webpack_require__(11); +var Element = __webpack_require__(6); +var Text = __webpack_require__(39); +var Comment = __webpack_require__(29); +var Event = __webpack_require__(7); +var DocumentFragment = __webpack_require__(32); +var ProcessingInstruction = __webpack_require__(38); +var DOMImplementation = __webpack_require__(9); +var TreeWalker = __webpack_require__(79); +var NodeIterator = __webpack_require__(78); +var NodeFilter = __webpack_require__(10); +var URL = __webpack_require__(20); +var select = __webpack_require__(23); +var events = __webpack_require__(45); +var xml = __webpack_require__(24); +var html = __webpack_require__(22); +var svg = __webpack_require__(48); +var utils = __webpack_require__(1); +var MUTATE = __webpack_require__(76); +var NAMESPACE = utils.NAMESPACE; +var isApiWritable = __webpack_require__(43).isApiWritable; + +function Document(isHTML, address) { + this.nodeType = Node.DOCUMENT_NODE; + this.isHTML = isHTML; + this._address = address || 'about:blank'; + this.readyState = 'loading'; + this.implementation = new DOMImplementation(); + + // DOMCore says that documents are always associated with themselves + this.ownerDocument = null; // ... but W3C tests expect null + + // These will be initialized by our custom versions of + // appendChild and insertBefore that override the inherited + // Node methods. + // XXX: override those methods! + this.doctype = null; + this.documentElement = null; + this.childNodes = new NodeList(); + + // "Associated inert template document" + this._templateDocCache = null; + + // Documents are always rooted, by definition + this._nid = 1; + this._nextnid = 2; // For numbering children of the document + this._nodes = [null, this]; // nid to node map + + // This maintains the mapping from element ids to element nodes. + // We may need to update this mapping every time a node is rooted + // or uprooted, and any time an attribute is added, removed or changed + // on a rooted element. + this.byId = Object.create(null); + + // This property holds a monotonically increasing value akin to + // a timestamp used to record the last modification time of nodes + // and their subtrees. See the lastModTime attribute and modify() + // method of the Node class. And see FilteredElementList for an example + // of the use of lastModTime + this.modclock = 0; +} + +// Map from lowercase event category names (used as arguments to +// createEvent()) to the property name in the impl object of the +// event constructor. +var supportedEvents = { + event: 'Event', + customevent: 'CustomEvent', + uievent: 'UIEvent', + mouseevent: 'MouseEvent' +}; + +// Certain arguments to document.createEvent() must be treated specially +var replacementEvent = { + events: 'event', + htmlevents: 'event', + mouseevents: 'mouseevent', + mutationevents: 'mutationevent', + uievents: 'uievent' +}; + +var mirrorAttr = function(f, name, defaultValue) { + return { + get: function() { + var o = f.call(this); + if (o) { return o[name]; } + return defaultValue; + }, + set: function(value) { + var o = f.call(this); + if (o) { o[name] = value; } + }, + }; +}; + +Document.prototype = Object.create(Node.prototype, { + // This method allows dom.js to communicate with a renderer + // that displays the document in some way + // XXX: I should probably move this to the window object + _setMutationHandler: { value: function(handler) { + this.mutationHandler = handler; + }}, + + // This method allows dom.js to receive event notifications + // from the renderer. + // XXX: I should probably move this to the window object + _dispatchRendererEvent: { value: function(targetNid, type, details) { + var target = this._nodes[targetNid]; + if (!target) return; + target._dispatchEvent(new Event(type, details), true); + }}, + + nodeName: { value: '#document'}, + nodeValue: { + get: function() { + return null; + }, + set: function() {} + }, + + // XXX: DOMCore may remove documentURI, so it is NYI for now + documentURI: { get: utils.nyi, set: utils.nyi }, + compatMode: { get: function() { + // The _quirks property is set by the HTML parser + return this._quirks ? 'BackCompat' : 'CSS1Compat'; + }}, + parentNode: { value: null }, + + createTextNode: { value: function(data) { + return new Text(this, '' + data); + }}, + createComment: { value: function(data) { + return new Comment(this, data); + }}, + createDocumentFragment: { value: function() { + return new DocumentFragment(this); + }}, + createProcessingInstruction: { value: function(target, data) { + if (!xml.isValidName(target) || data.indexOf('?>') !== -1) + utils.InvalidCharacterError(); + return new ProcessingInstruction(this, target, data); + }}, + + createElement: { value: function(localName) { + if (!xml.isValidName(localName)) utils.InvalidCharacterError(); + if (this.isHTML) localName = utils.toASCIILowerCase(localName); + return html.createElement(this, localName, null); + }, writable: isApiWritable }, + + createElementNS: { value: function(namespace, qualifiedName) { + if (!xml.isValidName(qualifiedName)) utils.InvalidCharacterError(); + if (!xml.isValidQName(qualifiedName)) utils.NamespaceError(); + + var pos, prefix, localName; + if ((pos = qualifiedName.indexOf(':')) !== -1) { + prefix = qualifiedName.substring(0, pos); + localName = qualifiedName.substring(pos+1); + + if (namespace === '' || + (prefix === 'xml' && namespace !== NAMESPACE.XML)) + utils.NamespaceError(); } - - else if (cp === $.EOF) - this._reconsumeInState(DATA_STATE); - else { - this.state = SCRIPT_DATA_ESCAPED_STATE; - this._emitCodePoint(cp); + prefix = null; + localName = qualifiedName; } -}; + if (((qualifiedName === 'xmlns' || prefix === 'xmlns') && + namespace !== NAMESPACE.XMLNS) || + (namespace === NAMESPACE.XMLNS && + qualifiedName !== 'xmlns' && + prefix !== 'xmlns')) + utils.NamespaceError(); -//12.2.4.25 Script data escaped less-than sign state -//------------------------------------------------------------------ -_[SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN_STATE] = function scriptDataEscapedLessThanSignState(cp) { - if (cp === $.SOLIDUS) { - this.tempBuff = []; - this.state = SCRIPT_DATA_ESCAPED_END_TAG_OPEN_STATE; + if (namespace === NAMESPACE.HTML) { + return html.createElement(this, localName, prefix); } - - else if (isAsciiLetter(cp)) { - this.tempBuff = []; - this._emitChar('<'); - this._reconsumeInState(SCRIPT_DATA_DOUBLE_ESCAPE_START_STATE); + else if (namespace === NAMESPACE.SVG) { + return svg.createElement(this, localName, prefix); } - else { - this._emitChar('<'); - this._reconsumeInState(SCRIPT_DATA_ESCAPED_STATE); - } -}; + return new Element(this, localName, namespace, prefix); + }, writable: isApiWritable }, + createEvent: { value: function createEvent(interfaceName) { + interfaceName = interfaceName.toLowerCase(); + var name = replacementEvent[interfaceName] || interfaceName; + var constructor = events[supportedEvents[name]]; -//12.2.4.26 Script data escaped end tag open state -//------------------------------------------------------------------ -_[SCRIPT_DATA_ESCAPED_END_TAG_OPEN_STATE] = function scriptDataEscapedEndTagOpenState(cp) { - if (isAsciiLetter(cp)) { - this._createEndTagToken(); - this._reconsumeInState(SCRIPT_DATA_ESCAPED_END_TAG_NAME_STATE); + if (constructor) { + var e = new constructor(); + e._initialized = false; + return e; } - else { - this._emitChar('<'); - this._emitChar('/'); - this._reconsumeInState(SCRIPT_DATA_ESCAPED_STATE); + utils.NotSupportedError(); + } + }}, + + // See: http://www.w3.org/TR/dom/#dom-document-createtreewalker + createTreeWalker: {value: function (root, whatToShow, filter) { + whatToShow = whatToShow === undefined ? NodeFilter.SHOW_ALL : whatToShow; + + if (filter && typeof filter === 'object' && + typeof filter.acceptNode === 'function') { + filter = filter.acceptNode.bind(filter); + // Support filter being a function + // https://developer.mozilla.org/en-US/docs/DOM/document.createTreeWalker + } + else if (typeof filter !== 'function') { + filter = null; + } + return new TreeWalker(root, whatToShow, filter); + }}, + + // See: http://www.w3.org/TR/dom/#dom-document-createnodeiterator + createNodeIterator: {value: function (root, whatToShow, filter) { + whatToShow = whatToShow === undefined ? NodeFilter.SHOW_ALL : whatToShow; + + if (filter && typeof filter === 'object' && + typeof filter.acceptNode === 'function') { + filter = filter.acceptNode.bind(filter); + // Support filter being a function + // https://developer.mozilla.org/en-US/docs/DOM/document.createNodeIterator + } + else if (typeof filter !== 'function') { + filter = null; + } + return new NodeIterator(root, whatToShow, filter); + }}, + + // Maintain the documentElement and + // doctype properties of the document. Each of the following + // methods chains to the Node implementation of the method + // to do the actual inserting, removal or replacement. + + _updateDocTypeElement: { value: function _updateDocTypeElement() { + var i, n, nodes = this.childNodes, length = nodes.length; + this.doctype = this.documentElement = null; + for (i=0; i child of the document element. + // XXX For now, setting this attribute is not implemented. + body: { + get: function() { + return namedHTMLChild(this.documentElement, 'body'); + }, + set: utils.nyi + }, + // Return the first child of the document element. + head: { get: function() { + return namedHTMLChild(this.documentElement, 'head'); + }}, + images: { get: utils.nyi }, + embeds: { get: utils.nyi }, + plugins: { get: utils.nyi }, + links: { get: utils.nyi }, + forms: { get: utils.nyi }, + scripts: { get: utils.nyi }, + innerHTML: { + get: function() { return this.serialize(); }, + set: utils.nyi + }, + outerHTML: { + get: function() { return this.serialize(); }, + set: utils.nyi + }, + + write: { value: function(args) { + if (!this.isHTML) utils.InvalidStateError(); + + // XXX: still have to implement the ignore part + if (!this._parser /* && this._ignore_destructive_writes > 0 */ ) + return; + + if (!this._parser) { + // XXX call document.open, etc. + } + + var s = arguments.join(''); + + // If the Document object's reload override flag is set, then + // append the string consisting of the concatenation of all the + // arguments to the method to the Document's reload override + // buffer. + // XXX: don't know what this is about. Still have to do it + + // If there is no pending parsing-blocking script, have the + // tokenizer process the characters that were inserted, one at a + // time, processing resulting tokens as they are emitted, and + // stopping when the tokenizer reaches the insertion point or when + // the processing of the tokenizer is aborted by the tree + // construction stage (this can happen if a script end tag token is + // emitted by the tokenizer). + + // XXX: still have to do the above. Sounds as if we don't + // always call parse() here. If we're blocked, then we just + // insert the text into the stream but don't parse it reentrantly... + + // Invoke the parser reentrantly + this._parser.parse(s); + }}, + + writeln: { value: function writeln(args) { + this.write(Array.prototype.join.call(arguments, '') + '\n'); + }}, + + open: { value: function() { + this.documentElement = null; + }}, + + close: { value: function() { + this.readyState = 'complete'; + var ev = new Event('DOMContentLoaded'); + this._dispatchEvent(ev, true); + if (this.defaultView) { + ev = new Event('load'); + this.defaultView._dispatchEvent(ev, true); + } + }}, + + // Utility methods + clone: { value: function clone() { + // Can't clone an entire document + utils.DataCloneError(); + }}, + + isEqual: { value: function isEqual(n) { + // Any two documents are shallowly equal. + // Node.isEqualNode will also test the children + return true; + }}, + + // Implementation-specific function. Called when a text, comment, + // or pi value changes. + mutateValue: { value: function(node) { + if (this.mutationHandler) { + this.mutationHandler({ + type: MUTATE.VALUE, + target: node, + data: node.data + }); } -}; + }}, - -//12.2.4.27 Script data escaped end tag name state -//------------------------------------------------------------------ -_[SCRIPT_DATA_ESCAPED_END_TAG_NAME_STATE] = function scriptDataEscapedEndTagNameState(cp) { - if (isAsciiUpper(cp)) { - this.currentToken.tagName += toAsciiLowerChar(cp); - this.tempBuff.push(cp); + // Invoked when an attribute's value changes. Attr holds the new + // value. oldval is the old value. Attribute mutations can also + // involve changes to the prefix (and therefore the qualified name) + mutateAttr: { value: function(attr, oldval) { + // Manage id->element mapping for getElementsById() + // XXX: this special case id handling should not go here, + // but in the attribute declaration for the id attribute + /* + if (attr.localName === 'id' && attr.namespaceURI === null) { + if (oldval) delId(oldval, attr.ownerElement); + addId(attr.value, attr.ownerElement); + } + */ + if (this.mutationHandler) { + this.mutationHandler({ + type: MUTATE.ATTR, + target: attr.ownerElement, + attr: attr + }); } + }}, - else if (isAsciiLower(cp)) { - this.currentToken.tagName += toChar(cp); - this.tempBuff.push(cp); + // Used by removeAttribute and removeAttributeNS for attributes. + mutateRemoveAttr: { value: function(attr) { +/* +* This is now handled in Attributes.js + // Manage id to element mapping + if (attr.localName === 'id' && attr.namespaceURI === null) { + this.delId(attr.value, attr.ownerElement); + } +*/ + if (this.mutationHandler) { + this.mutationHandler({ + type: MUTATE.REMOVE_ATTR, + target: attr.ownerElement, + attr: attr + }); + } + }}, + + // Called by Node.removeChild, etc. to remove a rooted element from + // the tree. Only needs to generate a single mutation event when a + // node is removed, but must recursively mark all descendants as not + // rooted. + mutateRemove: { value: function(node) { + // Send a single mutation event + if (this.mutationHandler) { + this.mutationHandler({ + type: MUTATE.REMOVE, + target: node.parentNode, + node: node + }); } - else { - if (this._isAppropriateEndTagToken()) { - if (isWhitespace(cp)) { - this.state = BEFORE_ATTRIBUTE_NAME_STATE; - return; - } + // Mark this and all descendants as not rooted + recursivelyUproot(node); + }}, - if (cp === $.SOLIDUS) { - this.state = SELF_CLOSING_START_TAG_STATE; - return; - } + // Called when a new element becomes rooted. It must recursively + // generate mutation events for each of the children, and mark them all + // as rooted. + mutateInsert: { value: function(node) { + // Mark node and its descendants as rooted + recursivelyRoot(node); - if (cp === $.GREATER_THAN_SIGN) { - this._emitCurrentToken(); - this.state = DATA_STATE; - return; - } - } + // Send a single mutation event + if (this.mutationHandler) { + this.mutationHandler({ + type: MUTATE.INSERT, + target: node.parentNode, + node: node + }); + } + }}, - this._emitChar('<'); - this._emitChar('/'); - this._emitSeveralCodePoints(this.tempBuff); - this._reconsumeInState(SCRIPT_DATA_ESCAPED_STATE); + // Called when a rooted element is moved within the document + mutateMove: { value: function(node) { + if (this.mutationHandler) { + this.mutationHandler({ + type: MUTATE.MOVE, + target: node + }); } -}; + }}, -//12.2.4.28 Script data double escape start state -//------------------------------------------------------------------ -_[SCRIPT_DATA_DOUBLE_ESCAPE_START_STATE] = function scriptDataDoubleEscapeStartState(cp) { - if (isWhitespace(cp) || cp === $.SOLIDUS || cp === $.GREATER_THAN_SIGN) { - this.state = this.isTempBufferEqualToScriptString() ? SCRIPT_DATA_DOUBLE_ESCAPED_STATE : SCRIPT_DATA_ESCAPED_STATE; - this._emitCodePoint(cp); + // Add a mapping from id to n for n.ownerDocument + addId: { value: function addId(id, n) { + var val = this.byId[id]; + if (!val) { + this.byId[id] = n; } - - else if (isAsciiUpper(cp)) { - this.tempBuff.push(toAsciiLowerCodePoint(cp)); - this._emitCodePoint(cp); + else { + // TODO: Add a way to opt-out console warnings + //console.warn('Duplicate element id ' + id); + if (!(val instanceof MultiId)) { + val = new MultiId(val); + this.byId[id] = val; + } + val.add(n); } + }}, + + // Delete the mapping from id to n for n.ownerDocument + delId: { value: function delId(id, n) { + var val = this.byId[id]; + utils.assert(val); - else if (isAsciiLower(cp)) { - this.tempBuff.push(cp); - this._emitCodePoint(cp); + if (val instanceof MultiId) { + val.del(n); + if (val.length === 1) { // convert back to a single node + this.byId[id] = val.downgrade(); + } + } + else { + this.byId[id] = undefined; } + }}, - else - this._reconsumeInState(SCRIPT_DATA_ESCAPED_STATE); -}; + _resolve: { value: function(href) { + //XXX: Cache the URL + return new URL(this._documentBaseURL).resolve(href); + }}, + _documentBaseURL: { get: function() { + // XXX: This is not implemented correctly yet + var url = this._address; + if (url === 'about:blank') url = '/'; -//12.2.4.29 Script data double escaped state -//------------------------------------------------------------------ -_[SCRIPT_DATA_DOUBLE_ESCAPED_STATE] = function scriptDataDoubleEscapedState(cp) { - if (cp === $.HYPHEN_MINUS) { - this.state = SCRIPT_DATA_DOUBLE_ESCAPED_DASH_STATE; - this._emitChar('-'); + var base = this.querySelector('base[href]'); + if (base) { + return new URL(url).resolve(base.getAttribute('href')); } + return url; - else if (cp === $.LESS_THAN_SIGN) { - this.state = SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN_STATE; - this._emitChar('<'); - } + // The document base URL of a Document object is the + // absolute URL obtained by running these substeps: - else if (cp === $.NULL) - this._emitChar(UNICODE.REPLACEMENT_CHARACTER); + // Let fallback base url be the document's address. - else if (cp === $.EOF) - this._reconsumeInState(DATA_STATE); + // If fallback base url is about:blank, and the + // Document's browsing context has a creator browsing + // context, then let fallback base url be the document + // base URL of the creator Document instead. - else - this._emitCodePoint(cp); -}; + // If the Document is an iframe srcdoc document, then + // let fallback base url be the document base URL of + // the Document's browsing context's browsing context + // container's Document instead. + // If there is no base element that has an href + // attribute, then the document base URL is fallback + // base url; abort these steps. Otherwise, let url be + // the value of the href attribute of the first such + // element. -//12.2.4.30 Script data double escaped dash state -//------------------------------------------------------------------ -_[SCRIPT_DATA_DOUBLE_ESCAPED_DASH_STATE] = function scriptDataDoubleEscapedDashState(cp) { - if (cp === $.HYPHEN_MINUS) { - this.state = SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH_STATE; - this._emitChar('-'); - } + // Resolve url relative to fallback base url (thus, + // the base href attribute isn't affected by xml:base + // attributes). - else if (cp === $.LESS_THAN_SIGN) { - this.state = SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN_STATE; - this._emitChar('<'); - } + // The document base URL is the result of the previous + // step if it was successful; otherwise it is fallback + // base url. + }}, - else if (cp === $.NULL) { - this.state = SCRIPT_DATA_DOUBLE_ESCAPED_STATE; - this._emitChar(UNICODE.REPLACEMENT_CHARACTER); + _templateDoc: { get: function() { + if (!this._templateDocCache) { + // "associated inert template document" + var newDoc = new Document(this.isHTML, this._address); + this._templateDocCache = newDoc._templateDocCache = newDoc; } + return this._templateDocCache; + }}, - else if (cp === $.EOF) - this._reconsumeInState(DATA_STATE); + querySelector: { value: function(selector) { + return select(selector, this)[0]; + }}, - else { - this.state = SCRIPT_DATA_DOUBLE_ESCAPED_STATE; - this._emitCodePoint(cp); - } -}; + querySelectorAll: { value: function(selector) { + var nodes = select(selector, this); + return nodes.item ? nodes : new NodeList(nodes); + }} + +}); -//12.2.4.31 Script data double escaped dash dash state -//------------------------------------------------------------------ -_[SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH_STATE] = function scriptDataDoubleEscapedDashDashState(cp) { - if (cp === $.HYPHEN_MINUS) - this._emitChar('-'); +var eventHandlerTypes = [ + 'abort', 'canplay', 'canplaythrough', 'change', 'click', 'contextmenu', + 'cuechange', 'dblclick', 'drag', 'dragend', 'dragenter', 'dragleave', + 'dragover', 'dragstart', 'drop', 'durationchange', 'emptied', 'ended', + 'input', 'invalid', 'keydown', 'keypress', 'keyup', 'loadeddata', + 'loadedmetadata', 'loadstart', 'mousedown', 'mousemove', 'mouseout', + 'mouseover', 'mouseup', 'mousewheel', 'pause', 'play', 'playing', + 'progress', 'ratechange', 'readystatechange', 'reset', 'seeked', + 'seeking', 'select', 'show', 'stalled', 'submit', 'suspend', + 'timeupdate', 'volumechange', 'waiting', - else if (cp === $.LESS_THAN_SIGN) { - this.state = SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN_STATE; - this._emitChar('<'); - } + 'blur', 'error', 'focus', 'load', 'scroll' +]; - else if (cp === $.GREATER_THAN_SIGN) { - this.state = SCRIPT_DATA_STATE; - this._emitChar('>'); +// Add event handler idl attribute getters and setters to Document +eventHandlerTypes.forEach(function(type) { + // Define the event handler registration IDL attribute for this type + Object.defineProperty(Document.prototype, 'on' + type, { + get: function() { + return this._getEventHandler(type); + }, + set: function(v) { + this._setEventHandler(type, v); } + }); +}); - else if (cp === $.NULL) { - this.state = SCRIPT_DATA_DOUBLE_ESCAPED_STATE; - this._emitChar(UNICODE.REPLACEMENT_CHARACTER); +function namedHTMLChild(parent, name) { + if (parent && parent.isHTML) { + var kids = parent.childNodes; + for(var i = 0, n = kids.length; i < n; i++) { + if (kids[i].nodeType === Node.ELEMENT_NODE && + kids[i].localName === name && + kids[i].namespaceURI === NAMESPACE.HTML) { + return kids[i]; + } } + } + return null; +} + +function root(n) { + n._nid = n.ownerDocument._nextnid++; + n.ownerDocument._nodes[n._nid] = n; + // Manage id to element mapping + if (n.nodeType === Node.ELEMENT_NODE) { + var id = n.getAttribute('id'); + if (id) n.ownerDocument.addId(id, n); + + // Script elements need to know when they're inserted + // into the document + if (n._roothook) n._roothook(); + } +} + +function uproot(n) { + // Manage id to element mapping + if (n.nodeType === Node.ELEMENT_NODE) { + var id = n.getAttribute('id'); + if (id) n.ownerDocument.delId(id, n); + } + n.ownerDocument._nodes[n._nid] = undefined; + n._nid = undefined; +} + +function recursivelyRoot(node) { + root(node); + // XXX: + // accessing childNodes on a leaf node creates a new array the + // first time, so be careful to write this loop so that it + // doesn't do that. node is polymorphic, so maybe this is hard to + // optimize? Try switching on nodeType? +/* + if (node.hasChildNodes()) { + var kids = node.childNodes; + for(var i = 0, n = kids.length; i < n; i++) + recursivelyRoot(kids[i]); + } +*/ + if (node.nodeType === Node.ELEMENT_NODE) { + var kids = node.childNodes; + for(var i = 0, n = kids.length; i < n; i++) + recursivelyRoot(kids[i]); + } +} - else if (cp === $.EOF) - this._reconsumeInState(DATA_STATE); +function recursivelyUproot(node) { + uproot(node); + for(var i = 0, n = node.childNodes.length; i < n; i++) + recursivelyUproot(node.childNodes[i]); +} - else { - this.state = SCRIPT_DATA_DOUBLE_ESCAPED_STATE; - this._emitCodePoint(cp); - } -}; +function recursivelySetOwner(node, owner) { + node.ownerDocument = owner; + node._lastModTime = undefined; // mod times are document-based + var kids = node.childNodes; + for(var i = 0, n = kids.length; i < n; i++) + recursivelySetOwner(kids[i], owner); +} +// A class for storing multiple nodes with the same ID +function MultiId(node) { + this.nodes = Object.create(null); + this.nodes[node._nid] = node; + this.length = 1; + this.firstNode = undefined; +} -//12.2.4.32 Script data double escaped less-than sign state -//------------------------------------------------------------------ -_[SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN_STATE] = function scriptDataDoubleEscapedLessThanSignState(cp) { - if (cp === $.SOLIDUS) { - this.tempBuff = []; - this.state = SCRIPT_DATA_DOUBLE_ESCAPE_END_STATE; - this._emitChar('/'); +// Add a node to the list, with O(1) time +MultiId.prototype.add = function(node) { + if (!this.nodes[node._nid]) { + this.nodes[node._nid] = node; + this.length++; + this.firstNode = undefined; + } +}; + +// Remove a node from the list, with O(1) time +MultiId.prototype.del = function(node) { + if (this.nodes[node._nid]) { + delete this.nodes[node._nid]; + this.length--; + this.firstNode = undefined; + } +}; + +// Get the first node from the list, in the document order +// Takes O(N) time in the size of the list, with a cache that is invalidated +// when the list is modified. +MultiId.prototype.getFirst = function() { + /* jshint bitwise: false */ + if (!this.firstNode) { + var nid; + for (nid in this.nodes) { + if (this.firstNode === undefined || + this.firstNode.compareDocumentPosition(this.nodes[nid]) & Node.DOCUMENT_POSITION_PRECEDING) { + this.firstNode = this.nodes[nid]; + } } - - else - this._reconsumeInState(SCRIPT_DATA_DOUBLE_ESCAPED_STATE); + } + return this.firstNode; }; - -//12.2.4.33 Script data double escape end state -//------------------------------------------------------------------ -_[SCRIPT_DATA_DOUBLE_ESCAPE_END_STATE] = function scriptDataDoubleEscapeEndState(cp) { - if (isWhitespace(cp) || cp === $.SOLIDUS || cp === $.GREATER_THAN_SIGN) { - this.state = this.isTempBufferEqualToScriptString() ? SCRIPT_DATA_ESCAPED_STATE : SCRIPT_DATA_DOUBLE_ESCAPED_STATE; - - this._emitCodePoint(cp); - } - - else if (isAsciiUpper(cp)) { - this.tempBuff.push(toAsciiLowerCodePoint(cp)); - this._emitCodePoint(cp); - } - - else if (isAsciiLower(cp)) { - this.tempBuff.push(cp); - this._emitCodePoint(cp); +// If there is only one node left, return it. Otherwise return "this". +MultiId.prototype.downgrade = function() { + if (this.length === 1) { + var nid; + for (nid in this.nodes) { + return this.nodes[nid]; } - - else - this._reconsumeInState(SCRIPT_DATA_DOUBLE_ESCAPED_STATE); + } + return this; }; -//12.2.4.34 Before attribute name state -//------------------------------------------------------------------ -_[BEFORE_ATTRIBUTE_NAME_STATE] = function beforeAttributeNameState(cp) { - if (isWhitespace(cp)) - return; - - if (cp === $.SOLIDUS || cp === $.GREATER_THAN_SIGN || cp === $.EOF) - this._reconsumeInState(AFTER_ATTRIBUTE_NAME_STATE); - - else if (cp === $.EQUALS_SIGN) { - this._createAttr('='); - this.state = ATTRIBUTE_NAME_STATE; - } +/***/ }), +/* 18 */ +/***/ (function(module, exports, __webpack_require__) { - else { - this._createAttr(''); - this._reconsumeInState(ATTRIBUTE_NAME_STATE); - } -}; +"use strict"; +module.exports = DocumentType; -//12.2.4.35 Attribute name state -//------------------------------------------------------------------ -_[ATTRIBUTE_NAME_STATE] = function attributeNameState(cp) { - if (isWhitespace(cp) || cp === $.SOLIDUS || cp === $.GREATER_THAN_SIGN || cp === $.EOF) { - this._leaveAttrName(AFTER_ATTRIBUTE_NAME_STATE); - this._unconsume(); - } +var Node = __webpack_require__(3); +var Leaf = __webpack_require__(34); +var utils = __webpack_require__(1); +var ChildNode = __webpack_require__(16); - else if (cp === $.EQUALS_SIGN) - this._leaveAttrName(BEFORE_ATTRIBUTE_VALUE_STATE); +function DocumentType(name, publicId, systemId) { + // Unlike other nodes, doctype nodes always start off unowned + // until inserted + this.nodeType = Node.DOCUMENT_TYPE_NODE; + this.ownerDocument = null; + this.name = name; + this.publicId = publicId || ""; + this.systemId = systemId || ""; +} - else if (isAsciiUpper(cp)) - this.currentAttr.name += toAsciiLowerChar(cp); +DocumentType.prototype = Object.create(Leaf.prototype, { + nodeName: { get: function() { return this.name; }}, + nodeValue: { + get: function() { return null; }, + set: function() {} + }, - else if (cp === $.QUOTATION_MARK || cp === $.APOSTROPHE || cp === $.LESS_THAN_SIGN) - this.currentAttr.name += toChar(cp); + // Utility methods + clone: { value: function clone() { + utils.DataCloneError(); + }}, - else if (cp === $.NULL) - this.currentAttr.name += UNICODE.REPLACEMENT_CHARACTER; + isEqual: { value: function isEqual(n) { + return this.name === n.name && + this.publicId === n.publicId && + this.systemId === n.systemId; + }} +}); - else - this.currentAttr.name += toChar(cp); -}; +Object.defineProperties(DocumentType.prototype, ChildNode); -//12.2.4.36 After attribute name state -//------------------------------------------------------------------ -_[AFTER_ATTRIBUTE_NAME_STATE] = function afterAttributeNameState(cp) { - if (isWhitespace(cp)) - return; +/***/ }), +/* 19 */ +/***/ (function(module, exports, __webpack_require__) { - if (cp === $.SOLIDUS) - this.state = SELF_CLOSING_START_TAG_STATE; +"use strict"; - else if (cp === $.EQUALS_SIGN) - this.state = BEFORE_ATTRIBUTE_VALUE_STATE; +module.exports = HTMLParser; - else if (cp === $.GREATER_THAN_SIGN) { - this.state = DATA_STATE; - this._emitCurrentToken(); - } +var Document = __webpack_require__(17); +var DocumentType = __webpack_require__(18); +var Node = __webpack_require__(3); +var NAMESPACE = __webpack_require__(1).NAMESPACE; +var html = __webpack_require__(22); +var impl = html.elements; - else if (cp === $.EOF) - this._reconsumeInState(DATA_STATE); +var pushAll = Function.prototype.apply.bind(Array.prototype.push); - else { - this._createAttr(''); - this._reconsumeInState(ATTRIBUTE_NAME_STATE); - } +/* + * This file contains an implementation of the HTML parsing algorithm. + * The algorithm and the implementation are complex because HTML + * explicitly defines how the parser should behave for all possible + * valid and invalid inputs. + * + * Usage: + * + * The file defines a single HTMLParser() function, which dom.js exposes + * publicly as document.implementation.mozHTMLParser(). This is a + * factory function, not a constructor. + * + * When you call document.implementation.mozHTMLParser(), it returns + * an object that has parse() and document() methods. To parse HTML text, + * pass the text (in one or more chunks) to the parse() method. When + * you've passed all the text (on the last chunk, or afterward) pass + * true as the second argument to parse() to tell the parser that there + * is no more coming. Call document() to get the document object that + * the parser is parsing into. You can call this at any time, before + * or after calling parse(). + * + * The first argument to mozHTMLParser is the absolute URL of the document. + * + * The second argument is optional and is for internal use only. Pass an + * element as the fragmentContext to do innerHTML parsing for the + * element. To do innerHTML parsing on a document, pass null. Otherwise, + * omit the 2nd argument. See HTMLElement.innerHTML for an example. Note + * that if you pass a context element, the end() method will return an + * unwrapped document instead of a wrapped one. + * + * Implementation details: + * + * This is a long file of almost 7000 lines. It is structured as one + * big function nested within another big function. The outer + * function defines a bunch of constant data, utility functions + * that use that data, and a couple of classes used by the parser. + * The outer function also defines and returns the + * inner function. This inner function is the HTMLParser factory + * function that implements the parser and holds all the parser state + * as local variables. The HTMLParser function is quite big because + * it defines many nested functions that use those local variables. + * + * There are three tightly coupled parser stages: a scanner, a + * tokenizer and a tree builder. In a (possibly misguided) attempt at + * efficiency, the stages are not implemented as separate classes: + * everything shares state and is (mostly) implemented in imperative + * (rather than OO) style. + * + * The stages of the parser work like this: When the client code calls + * the parser's parse() method, the specified string is passed to + * scanChars(). The scanner loops through that string and passes characters + * (sometimes one at a time, sometimes in chunks) to the tokenizer stage. + * The tokenizer groups the characters into tokens: tags, endtags, runs + * of text, comments, doctype declarations, and the end-of-file (EOF) + * token. These tokens are then passed to the tree building stage via + * the insertToken() function. The tree building stage builds up the + * document tree. + * + * The tokenizer stage is a finite state machine. Each state is + * implemented as a function with a name that ends in "_state". The + * initial state is data_state(). The current tokenizer state is stored + * in the variable 'tokenizer'. Most state functions expect a single + * integer argument which represents a single UTF-16 codepoint. Some + * states want more characters and set a lookahead property on + * themselves. The scanChars() function in the scanner checks for this + * lookahead property. If it doesn't exist, then scanChars() just passes + * the next input character to the current tokenizer state function. + * Otherwise, scanChars() looks ahead (a given # of characters, or for a + * matching string, or for a matching regexp) and passes a string of + * characters to the current tokenizer state function. + * + * As a shortcut, certain states of the tokenizer use regular expressions + * to look ahead in the scanner's input buffer for runs of text, simple + * tags and attributes. For well-formed input, these shortcuts skip a + * lot of state transitions and speed things up a bit. + * + * When a tokenizer state function has consumed a complete token, it + * emits that token, by calling insertToken(), or by calling a utility + * function that itself calls insertToken(). These tokens are passed to + * the tree building stage, which is also a state machine. Like the + * tokenizer, the tree building states are implemented as functions, and + * these functions have names that end with _mode (because the HTML spec + * refers to them as insertion modes). The current insertion mode is held + * by the 'parser' variable. Each insertion mode function takes up to 4 + * arguments. The first is a token type, represented by the constants + * TAG, ENDTAG, TEXT, COMMENT, DOCTYPE and EOF. The second argument is + * the value of the token: the text or comment data, or tagname or + * doctype. For tags, the 3rd argument is an array of attributes. For + * DOCTYPES it is the optional public id. For tags, the 4th argument is + * true if the tag is self-closing. For doctypes, the 4th argument is the + * optional system id. + * + * Search for "***" to find the major sub-divisions in the code. + */ + + +/*** + * Data prolog. Lots of constants declared here, including some + * very large objects. They're used throughout the code that follows + */ +// Token types for the tree builder. +var EOF = -1; +var TEXT = 1; +var TAG = 2; +var ENDTAG = 3; +var COMMENT = 4; +var DOCTYPE = 5; + +// A re-usable empty array +var NOATTRS = []; + +// These DTD public ids put the browser in quirks mode +var quirkyPublicIds = /^HTML$|^-\/\/W3O\/\/DTD W3 HTML Strict 3\.0\/\/EN\/\/$|^-\/W3C\/DTD HTML 4\.0 Transitional\/EN$|^\+\/\/Silmaril\/\/dtd html Pro v0r11 19970101\/\/|^-\/\/AdvaSoft Ltd\/\/DTD HTML 3\.0 asWedit \+ extensions\/\/|^-\/\/AS\/\/DTD HTML 3\.0 asWedit \+ extensions\/\/|^-\/\/IETF\/\/DTD HTML 2\.0 Level 1\/\/|^-\/\/IETF\/\/DTD HTML 2\.0 Level 2\/\/|^-\/\/IETF\/\/DTD HTML 2\.0 Strict Level 1\/\/|^-\/\/IETF\/\/DTD HTML 2\.0 Strict Level 2\/\/|^-\/\/IETF\/\/DTD HTML 2\.0 Strict\/\/|^-\/\/IETF\/\/DTD HTML 2\.0\/\/|^-\/\/IETF\/\/DTD HTML 2\.1E\/\/|^-\/\/IETF\/\/DTD HTML 3\.0\/\/|^-\/\/IETF\/\/DTD HTML 3\.2 Final\/\/|^-\/\/IETF\/\/DTD HTML 3\.2\/\/|^-\/\/IETF\/\/DTD HTML 3\/\/|^-\/\/IETF\/\/DTD HTML Level 0\/\/|^-\/\/IETF\/\/DTD HTML Level 1\/\/|^-\/\/IETF\/\/DTD HTML Level 2\/\/|^-\/\/IETF\/\/DTD HTML Level 3\/\/|^-\/\/IETF\/\/DTD HTML Strict Level 0\/\/|^-\/\/IETF\/\/DTD HTML Strict Level 1\/\/|^-\/\/IETF\/\/DTD HTML Strict Level 2\/\/|^-\/\/IETF\/\/DTD HTML Strict Level 3\/\/|^-\/\/IETF\/\/DTD HTML Strict\/\/|^-\/\/IETF\/\/DTD HTML\/\/|^-\/\/Metrius\/\/DTD Metrius Presentational\/\/|^-\/\/Microsoft\/\/DTD Internet Explorer 2\.0 HTML Strict\/\/|^-\/\/Microsoft\/\/DTD Internet Explorer 2\.0 HTML\/\/|^-\/\/Microsoft\/\/DTD Internet Explorer 2\.0 Tables\/\/|^-\/\/Microsoft\/\/DTD Internet Explorer 3\.0 HTML Strict\/\/|^-\/\/Microsoft\/\/DTD Internet Explorer 3\.0 HTML\/\/|^-\/\/Microsoft\/\/DTD Internet Explorer 3\.0 Tables\/\/|^-\/\/Netscape Comm\. Corp\.\/\/DTD HTML\/\/|^-\/\/Netscape Comm\. Corp\.\/\/DTD Strict HTML\/\/|^-\/\/O'Reilly and Associates\/\/DTD HTML 2\.0\/\/|^-\/\/O'Reilly and Associates\/\/DTD HTML Extended 1\.0\/\/|^-\/\/O'Reilly and Associates\/\/DTD HTML Extended Relaxed 1\.0\/\/|^-\/\/SoftQuad Software\/\/DTD HoTMetaL PRO 6\.0::19990601::extensions to HTML 4\.0\/\/|^-\/\/SoftQuad\/\/DTD HoTMetaL PRO 4\.0::19971010::extensions to HTML 4\.0\/\/|^-\/\/Spyglass\/\/DTD HTML 2\.0 Extended\/\/|^-\/\/SQ\/\/DTD HTML 2\.0 HoTMetaL \+ extensions\/\/|^-\/\/Sun Microsystems Corp\.\/\/DTD HotJava HTML\/\/|^-\/\/Sun Microsystems Corp\.\/\/DTD HotJava Strict HTML\/\/|^-\/\/W3C\/\/DTD HTML 3 1995-03-24\/\/|^-\/\/W3C\/\/DTD HTML 3\.2 Draft\/\/|^-\/\/W3C\/\/DTD HTML 3\.2 Final\/\/|^-\/\/W3C\/\/DTD HTML 3\.2\/\/|^-\/\/W3C\/\/DTD HTML 3\.2S Draft\/\/|^-\/\/W3C\/\/DTD HTML 4\.0 Frameset\/\/|^-\/\/W3C\/\/DTD HTML 4\.0 Transitional\/\/|^-\/\/W3C\/\/DTD HTML Experimental 19960712\/\/|^-\/\/W3C\/\/DTD HTML Experimental 970421\/\/|^-\/\/W3C\/\/DTD W3 HTML\/\/|^-\/\/W3O\/\/DTD W3 HTML 3\.0\/\/|^-\/\/WebTechs\/\/DTD Mozilla HTML 2\.0\/\/|^-\/\/WebTechs\/\/DTD Mozilla HTML\/\//i; + +var quirkySystemId = "http://www.ibm.com/data/dtd/v11/ibmxhtml1-transitional.dtd"; + +var conditionallyQuirkyPublicIds = /^-\/\/W3C\/\/DTD HTML 4\.01 Frameset\/\/|^-\/\/W3C\/\/DTD HTML 4\.01 Transitional\/\//i; + +// These DTD public ids put the browser in limited quirks mode +var limitedQuirkyPublicIds = /^-\/\/W3C\/\/DTD XHTML 1\.0 Frameset\/\/|^-\/\/W3C\/\/DTD XHTML 1\.0 Transitional\/\//i; + + +// Element sets below. See the isA() function for a way to test +// whether an element is a member of a set +var specialSet = Object.create(null); +specialSet[NAMESPACE.HTML] = { + __proto__: null, + "address":true, "applet":true, "area":true, "article":true, + "aside":true, "base":true, "basefont":true, "bgsound":true, + "blockquote":true, "body":true, "br":true, "button":true, + "caption":true, "center":true, "col":true, "colgroup":true, + "dd":true, "details":true, "dir":true, + "div":true, "dl":true, "dt":true, "embed":true, + "fieldset":true, "figcaption":true, "figure":true, "footer":true, + "form":true, "frame":true, "frameset":true, "h1":true, + "h2":true, "h3":true, "h4":true, "h5":true, + "h6":true, "head":true, "header":true, "hgroup":true, + "hr":true, "html":true, "iframe":true, "img":true, + "input":true, "li":true, "link":true, + "listing":true, "main":true, "marquee":true, "menu":true, "meta":true, + "nav":true, "noembed":true, "noframes":true, "noscript":true, + "object":true, "ol":true, "p":true, "param":true, + "plaintext":true, "pre":true, "script":true, "section":true, + "select":true, "source":true, "style":true, "summary":true, "table":true, + "tbody":true, "td":true, "template":true, "textarea":true, "tfoot":true, + "th":true, "thead":true, "title":true, "tr":true, "track":true, + // Note that "xmp" was removed from the "special" set in the latest + // spec, apparently by accident; see + // https://github.com/whatwg/html/pull/1919 + "ul":true, "wbr":true, "xmp":true +}; +specialSet[NAMESPACE.SVG] = { + __proto__: null, + "foreignObject": true, "desc": true, "title": true +}; +specialSet[NAMESPACE.MATHML] = { + __proto__: null, + "mi":true, "mo":true, "mn":true, "ms":true, + "mtext":true, "annotation-xml":true +}; + +// The set of address, div, and p HTML tags +var addressdivpSet = Object.create(null); +addressdivpSet[NAMESPACE.HTML] = { + __proto__: null, + "address":true, "div":true, "p":true +}; + +var dddtSet = Object.create(null); +dddtSet[NAMESPACE.HTML] = { + __proto__: null, + "dd":true, "dt":true +}; + +var tablesectionrowSet = Object.create(null); +tablesectionrowSet[NAMESPACE.HTML] = { + __proto__: null, + "table":true, "thead":true, "tbody":true, "tfoot":true, "tr":true +}; + +var impliedEndTagsSet = Object.create(null); +impliedEndTagsSet[NAMESPACE.HTML] = { + __proto__: null, + "dd": true, "dt": true, "li": true, "menuitem": true, "optgroup": true, + "option": true, "p": true, "rb": true, "rp": true, "rt": true, "rtc": true +}; + +var thoroughImpliedEndTagsSet = Object.create(null); +thoroughImpliedEndTagsSet[NAMESPACE.HTML] = { + __proto__: null, + "caption": true, "colgroup": true, "dd": true, "dt": true, "li": true, + "optgroup": true, "option": true, "p": true, "rb": true, "rp": true, + "rt": true, "rtc": true, "tbody": true, "td": true, "tfoot": true, + "th": true, "thead": true, "tr": true +}; + +var tableContextSet = Object.create(null); +tableContextSet[NAMESPACE.HTML] = { + __proto__: null, + "table": true, "template": true, "html": true +}; + +var tableBodyContextSet = Object.create(null); +tableBodyContextSet[NAMESPACE.HTML] = { + __proto__: null, + "tbody": true, "tfoot": true, "thead": true, "template": true, "html": true +}; + +var tableRowContextSet = Object.create(null); +tableRowContextSet[NAMESPACE.HTML] = { + __proto__: null, + "tr": true, "template": true, "html": true +}; + +// See http://www.w3.org/TR/html5/forms.html#form-associated-element +var formassociatedSet = Object.create(null); +formassociatedSet[NAMESPACE.HTML] = { + __proto__: null, + "button": true, "fieldset": true, "input": true, "keygen": true, + "object": true, "output": true, "select": true, "textarea": true, + "img": true +}; + +var inScopeSet = Object.create(null); +inScopeSet[NAMESPACE.HTML]= { + __proto__: null, + "applet":true, "caption":true, "html":true, "table":true, + "td":true, "th":true, "marquee":true, "object":true, + "template":true +}; +inScopeSet[NAMESPACE.MATHML] = { + __proto__: null, + "mi":true, "mo":true, "mn":true, "ms":true, + "mtext":true, "annotation-xml":true +}; +inScopeSet[NAMESPACE.SVG] = { + __proto__: null, + "foreignObject":true, "desc":true, "title":true +}; + +var inListItemScopeSet = Object.create(inScopeSet); +inListItemScopeSet[NAMESPACE.HTML] = + Object.create(inScopeSet[NAMESPACE.HTML]); +inListItemScopeSet[NAMESPACE.HTML].ol = true; +inListItemScopeSet[NAMESPACE.HTML].ul = true; + +var inButtonScopeSet = Object.create(inScopeSet); +inButtonScopeSet[NAMESPACE.HTML] = + Object.create(inScopeSet[NAMESPACE.HTML]); +inButtonScopeSet[NAMESPACE.HTML].button = true; + +var inTableScopeSet = Object.create(null); +inTableScopeSet[NAMESPACE.HTML] = { + __proto__: null, + "html":true, "table":true, "template":true +}; + +// The set of elements for select scope is the everything *except* these +var invertedSelectScopeSet = Object.create(null); +invertedSelectScopeSet[NAMESPACE.HTML] = { + __proto__: null, + "optgroup":true, "option":true +}; + +var mathmlTextIntegrationPointSet = Object.create(null); +mathmlTextIntegrationPointSet[NAMESPACE.MATHML] = { + __proto__: null, + mi: true, + mo: true, + mn: true, + ms: true, + mtext: true +}; + +var htmlIntegrationPointSet = Object.create(null); +htmlIntegrationPointSet[NAMESPACE.SVG] = { + __proto__: null, + foreignObject: true, + desc: true, + title: true +}; + +var foreignAttributes = { + __proto__: null, + "xlink:actuate": NAMESPACE.XLINK, "xlink:arcrole": NAMESPACE.XLINK, + "xlink:href": NAMESPACE.XLINK, "xlink:role": NAMESPACE.XLINK, + "xlink:show": NAMESPACE.XLINK, "xlink:title": NAMESPACE.XLINK, + "xlink:type": NAMESPACE.XLINK, "xml:base": NAMESPACE.XML, + "xml:lang": NAMESPACE.XML, "xml:space": NAMESPACE.XML, + "xmlns": NAMESPACE.XMLNS, "xmlns:xlink": NAMESPACE.XMLNS +}; + + +// Lowercase to mixed case mapping for SVG attributes and tagnames +var svgAttrAdjustments = { + __proto__: null, + attributename: "attributeName", attributetype: "attributeType", + basefrequency: "baseFrequency", baseprofile: "baseProfile", + calcmode: "calcMode", clippathunits: "clipPathUnits", + diffuseconstant: "diffuseConstant", + edgemode: "edgeMode", + filterunits: "filterUnits", + glyphref: "glyphRef", gradienttransform: "gradientTransform", + gradientunits: "gradientUnits", kernelmatrix: "kernelMatrix", + kernelunitlength: "kernelUnitLength", keypoints: "keyPoints", + keysplines: "keySplines", keytimes: "keyTimes", + lengthadjust: "lengthAdjust", limitingconeangle: "limitingConeAngle", + markerheight: "markerHeight", markerunits: "markerUnits", + markerwidth: "markerWidth", maskcontentunits: "maskContentUnits", + maskunits: "maskUnits", numoctaves: "numOctaves", + pathlength: "pathLength", patterncontentunits: "patternContentUnits", + patterntransform: "patternTransform", patternunits: "patternUnits", + pointsatx: "pointsAtX", pointsaty: "pointsAtY", + pointsatz: "pointsAtZ", preservealpha: "preserveAlpha", + preserveaspectratio: "preserveAspectRatio", + primitiveunits: "primitiveUnits", refx: "refX", + refy: "refY", repeatcount: "repeatCount", + repeatdur: "repeatDur", requiredextensions: "requiredExtensions", + requiredfeatures: "requiredFeatures", + specularconstant: "specularConstant", + specularexponent: "specularExponent", spreadmethod: "spreadMethod", + startoffset: "startOffset", stddeviation: "stdDeviation", + stitchtiles: "stitchTiles", surfacescale: "surfaceScale", + systemlanguage: "systemLanguage", tablevalues: "tableValues", + targetx: "targetX", targety: "targetY", + textlength: "textLength", viewbox: "viewBox", + viewtarget: "viewTarget", xchannelselector: "xChannelSelector", + ychannelselector: "yChannelSelector", zoomandpan: "zoomAndPan" +}; + +var svgTagNameAdjustments = { + __proto__: null, + altglyph: "altGlyph", altglyphdef: "altGlyphDef", + altglyphitem: "altGlyphItem", animatecolor: "animateColor", + animatemotion: "animateMotion", animatetransform: "animateTransform", + clippath: "clipPath", feblend: "feBlend", + fecolormatrix: "feColorMatrix", + fecomponenttransfer: "feComponentTransfer", fecomposite: "feComposite", + feconvolvematrix: "feConvolveMatrix", + fediffuselighting: "feDiffuseLighting", + fedisplacementmap: "feDisplacementMap", + fedistantlight: "feDistantLight", feflood: "feFlood", + fefunca: "feFuncA", fefuncb: "feFuncB", + fefuncg: "feFuncG", fefuncr: "feFuncR", + fegaussianblur: "feGaussianBlur", feimage: "feImage", + femerge: "feMerge", femergenode: "feMergeNode", + femorphology: "feMorphology", feoffset: "feOffset", + fepointlight: "fePointLight", fespecularlighting: "feSpecularLighting", + fespotlight: "feSpotLight", fetile: "feTile", + feturbulence: "feTurbulence", foreignobject: "foreignObject", + glyphref: "glyphRef", lineargradient: "linearGradient", + radialgradient: "radialGradient", textpath: "textPath" +}; + + +// Data for parsing numeric and named character references +// These next 3 objects are direct translations of tables +// in the HTML spec into JavaScript object format +var numericCharRefReplacements = { + __proto__: null, + 0x00:0xFFFD, 0x80:0x20AC, 0x82:0x201A, 0x83:0x0192, 0x84:0x201E, + 0x85:0x2026, 0x86:0x2020, 0x87:0x2021, 0x88:0x02C6, 0x89:0x2030, + 0x8A:0x0160, 0x8B:0x2039, 0x8C:0x0152, 0x8E:0x017D, 0x91:0x2018, + 0x92:0x2019, 0x93:0x201C, 0x94:0x201D, 0x95:0x2022, 0x96:0x2013, + 0x97:0x2014, 0x98:0x02DC, 0x99:0x2122, 0x9A:0x0161, 0x9B:0x203A, + 0x9C:0x0153, 0x9E:0x017E, 0x9F:0x0178 }; - -//12.2.4.37 Before attribute value state -//------------------------------------------------------------------ -_[BEFORE_ATTRIBUTE_VALUE_STATE] = function beforeAttributeValueState(cp) { - if (isWhitespace(cp)) - return; - - if (cp === $.QUOTATION_MARK) - this.state = ATTRIBUTE_VALUE_DOUBLE_QUOTED_STATE; - - else if (cp === $.APOSTROPHE) - this.state = ATTRIBUTE_VALUE_SINGLE_QUOTED_STATE; - - else - this._reconsumeInState(ATTRIBUTE_VALUE_UNQUOTED_STATE); +/* + * This table is generated with test/tools/update-entities.js + */ +var namedCharRefs = { + __proto__: null, + "AElig":0xc6, "AElig;":0xc6, + "AMP":0x26, "AMP;":0x26, + "Aacute":0xc1, "Aacute;":0xc1, + "Abreve;":0x102, "Acirc":0xc2, + "Acirc;":0xc2, "Acy;":0x410, + "Afr;":[0xd835,0xdd04], "Agrave":0xc0, + "Agrave;":0xc0, "Alpha;":0x391, + "Amacr;":0x100, "And;":0x2a53, + "Aogon;":0x104, "Aopf;":[0xd835,0xdd38], + "ApplyFunction;":0x2061, "Aring":0xc5, + "Aring;":0xc5, "Ascr;":[0xd835,0xdc9c], + "Assign;":0x2254, "Atilde":0xc3, + "Atilde;":0xc3, "Auml":0xc4, + "Auml;":0xc4, "Backslash;":0x2216, + "Barv;":0x2ae7, "Barwed;":0x2306, + "Bcy;":0x411, "Because;":0x2235, + "Bernoullis;":0x212c, "Beta;":0x392, + "Bfr;":[0xd835,0xdd05], "Bopf;":[0xd835,0xdd39], + "Breve;":0x2d8, "Bscr;":0x212c, + "Bumpeq;":0x224e, "CHcy;":0x427, + "COPY":0xa9, "COPY;":0xa9, + "Cacute;":0x106, "Cap;":0x22d2, + "CapitalDifferentialD;":0x2145, "Cayleys;":0x212d, + "Ccaron;":0x10c, "Ccedil":0xc7, + "Ccedil;":0xc7, "Ccirc;":0x108, + "Cconint;":0x2230, "Cdot;":0x10a, + "Cedilla;":0xb8, "CenterDot;":0xb7, + "Cfr;":0x212d, "Chi;":0x3a7, + "CircleDot;":0x2299, "CircleMinus;":0x2296, + "CirclePlus;":0x2295, "CircleTimes;":0x2297, + "ClockwiseContourIntegral;":0x2232, "CloseCurlyDoubleQuote;":0x201d, + "CloseCurlyQuote;":0x2019, "Colon;":0x2237, + "Colone;":0x2a74, "Congruent;":0x2261, + "Conint;":0x222f, "ContourIntegral;":0x222e, + "Copf;":0x2102, "Coproduct;":0x2210, + "CounterClockwiseContourIntegral;":0x2233, "Cross;":0x2a2f, + "Cscr;":[0xd835,0xdc9e], "Cup;":0x22d3, + "CupCap;":0x224d, "DD;":0x2145, + "DDotrahd;":0x2911, "DJcy;":0x402, + "DScy;":0x405, "DZcy;":0x40f, + "Dagger;":0x2021, "Darr;":0x21a1, + "Dashv;":0x2ae4, "Dcaron;":0x10e, + "Dcy;":0x414, "Del;":0x2207, + "Delta;":0x394, "Dfr;":[0xd835,0xdd07], + "DiacriticalAcute;":0xb4, "DiacriticalDot;":0x2d9, + "DiacriticalDoubleAcute;":0x2dd, "DiacriticalGrave;":0x60, + "DiacriticalTilde;":0x2dc, "Diamond;":0x22c4, + "DifferentialD;":0x2146, "Dopf;":[0xd835,0xdd3b], + "Dot;":0xa8, "DotDot;":0x20dc, + "DotEqual;":0x2250, "DoubleContourIntegral;":0x222f, + "DoubleDot;":0xa8, "DoubleDownArrow;":0x21d3, + "DoubleLeftArrow;":0x21d0, "DoubleLeftRightArrow;":0x21d4, + "DoubleLeftTee;":0x2ae4, "DoubleLongLeftArrow;":0x27f8, + "DoubleLongLeftRightArrow;":0x27fa, "DoubleLongRightArrow;":0x27f9, + "DoubleRightArrow;":0x21d2, "DoubleRightTee;":0x22a8, + "DoubleUpArrow;":0x21d1, "DoubleUpDownArrow;":0x21d5, + "DoubleVerticalBar;":0x2225, "DownArrow;":0x2193, + "DownArrowBar;":0x2913, "DownArrowUpArrow;":0x21f5, + "DownBreve;":0x311, "DownLeftRightVector;":0x2950, + "DownLeftTeeVector;":0x295e, "DownLeftVector;":0x21bd, + "DownLeftVectorBar;":0x2956, "DownRightTeeVector;":0x295f, + "DownRightVector;":0x21c1, "DownRightVectorBar;":0x2957, + "DownTee;":0x22a4, "DownTeeArrow;":0x21a7, + "Downarrow;":0x21d3, "Dscr;":[0xd835,0xdc9f], + "Dstrok;":0x110, "ENG;":0x14a, + "ETH":0xd0, "ETH;":0xd0, + "Eacute":0xc9, "Eacute;":0xc9, + "Ecaron;":0x11a, "Ecirc":0xca, + "Ecirc;":0xca, "Ecy;":0x42d, + "Edot;":0x116, "Efr;":[0xd835,0xdd08], + "Egrave":0xc8, "Egrave;":0xc8, + "Element;":0x2208, "Emacr;":0x112, + "EmptySmallSquare;":0x25fb, "EmptyVerySmallSquare;":0x25ab, + "Eogon;":0x118, "Eopf;":[0xd835,0xdd3c], + "Epsilon;":0x395, "Equal;":0x2a75, + "EqualTilde;":0x2242, "Equilibrium;":0x21cc, + "Escr;":0x2130, "Esim;":0x2a73, + "Eta;":0x397, "Euml":0xcb, + "Euml;":0xcb, "Exists;":0x2203, + "ExponentialE;":0x2147, "Fcy;":0x424, + "Ffr;":[0xd835,0xdd09], "FilledSmallSquare;":0x25fc, + "FilledVerySmallSquare;":0x25aa, "Fopf;":[0xd835,0xdd3d], + "ForAll;":0x2200, "Fouriertrf;":0x2131, + "Fscr;":0x2131, "GJcy;":0x403, + "GT":0x3e, "GT;":0x3e, + "Gamma;":0x393, "Gammad;":0x3dc, + "Gbreve;":0x11e, "Gcedil;":0x122, + "Gcirc;":0x11c, "Gcy;":0x413, + "Gdot;":0x120, "Gfr;":[0xd835,0xdd0a], + "Gg;":0x22d9, "Gopf;":[0xd835,0xdd3e], + "GreaterEqual;":0x2265, "GreaterEqualLess;":0x22db, + "GreaterFullEqual;":0x2267, "GreaterGreater;":0x2aa2, + "GreaterLess;":0x2277, "GreaterSlantEqual;":0x2a7e, + "GreaterTilde;":0x2273, "Gscr;":[0xd835,0xdca2], + "Gt;":0x226b, "HARDcy;":0x42a, + "Hacek;":0x2c7, "Hat;":0x5e, + "Hcirc;":0x124, "Hfr;":0x210c, + "HilbertSpace;":0x210b, "Hopf;":0x210d, + "HorizontalLine;":0x2500, "Hscr;":0x210b, + "Hstrok;":0x126, "HumpDownHump;":0x224e, + "HumpEqual;":0x224f, "IEcy;":0x415, + "IJlig;":0x132, "IOcy;":0x401, + "Iacute":0xcd, "Iacute;":0xcd, + "Icirc":0xce, "Icirc;":0xce, + "Icy;":0x418, "Idot;":0x130, + "Ifr;":0x2111, "Igrave":0xcc, + "Igrave;":0xcc, "Im;":0x2111, + "Imacr;":0x12a, "ImaginaryI;":0x2148, + "Implies;":0x21d2, "Int;":0x222c, + "Integral;":0x222b, "Intersection;":0x22c2, + "InvisibleComma;":0x2063, "InvisibleTimes;":0x2062, + "Iogon;":0x12e, "Iopf;":[0xd835,0xdd40], + "Iota;":0x399, "Iscr;":0x2110, + "Itilde;":0x128, "Iukcy;":0x406, + "Iuml":0xcf, "Iuml;":0xcf, + "Jcirc;":0x134, "Jcy;":0x419, + "Jfr;":[0xd835,0xdd0d], "Jopf;":[0xd835,0xdd41], + "Jscr;":[0xd835,0xdca5], "Jsercy;":0x408, + "Jukcy;":0x404, "KHcy;":0x425, + "KJcy;":0x40c, "Kappa;":0x39a, + "Kcedil;":0x136, "Kcy;":0x41a, + "Kfr;":[0xd835,0xdd0e], "Kopf;":[0xd835,0xdd42], + "Kscr;":[0xd835,0xdca6], "LJcy;":0x409, + "LT":0x3c, "LT;":0x3c, + "Lacute;":0x139, "Lambda;":0x39b, + "Lang;":0x27ea, "Laplacetrf;":0x2112, + "Larr;":0x219e, "Lcaron;":0x13d, + "Lcedil;":0x13b, "Lcy;":0x41b, + "LeftAngleBracket;":0x27e8, "LeftArrow;":0x2190, + "LeftArrowBar;":0x21e4, "LeftArrowRightArrow;":0x21c6, + "LeftCeiling;":0x2308, "LeftDoubleBracket;":0x27e6, + "LeftDownTeeVector;":0x2961, "LeftDownVector;":0x21c3, + "LeftDownVectorBar;":0x2959, "LeftFloor;":0x230a, + "LeftRightArrow;":0x2194, "LeftRightVector;":0x294e, + "LeftTee;":0x22a3, "LeftTeeArrow;":0x21a4, + "LeftTeeVector;":0x295a, "LeftTriangle;":0x22b2, + "LeftTriangleBar;":0x29cf, "LeftTriangleEqual;":0x22b4, + "LeftUpDownVector;":0x2951, "LeftUpTeeVector;":0x2960, + "LeftUpVector;":0x21bf, "LeftUpVectorBar;":0x2958, + "LeftVector;":0x21bc, "LeftVectorBar;":0x2952, + "Leftarrow;":0x21d0, "Leftrightarrow;":0x21d4, + "LessEqualGreater;":0x22da, "LessFullEqual;":0x2266, + "LessGreater;":0x2276, "LessLess;":0x2aa1, + "LessSlantEqual;":0x2a7d, "LessTilde;":0x2272, + "Lfr;":[0xd835,0xdd0f], "Ll;":0x22d8, + "Lleftarrow;":0x21da, "Lmidot;":0x13f, + "LongLeftArrow;":0x27f5, "LongLeftRightArrow;":0x27f7, + "LongRightArrow;":0x27f6, "Longleftarrow;":0x27f8, + "Longleftrightarrow;":0x27fa, "Longrightarrow;":0x27f9, + "Lopf;":[0xd835,0xdd43], "LowerLeftArrow;":0x2199, + "LowerRightArrow;":0x2198, "Lscr;":0x2112, + "Lsh;":0x21b0, "Lstrok;":0x141, + "Lt;":0x226a, "Map;":0x2905, + "Mcy;":0x41c, "MediumSpace;":0x205f, + "Mellintrf;":0x2133, "Mfr;":[0xd835,0xdd10], + "MinusPlus;":0x2213, "Mopf;":[0xd835,0xdd44], + "Mscr;":0x2133, "Mu;":0x39c, + "NJcy;":0x40a, "Nacute;":0x143, + "Ncaron;":0x147, "Ncedil;":0x145, + "Ncy;":0x41d, "NegativeMediumSpace;":0x200b, + "NegativeThickSpace;":0x200b, "NegativeThinSpace;":0x200b, + "NegativeVeryThinSpace;":0x200b, "NestedGreaterGreater;":0x226b, + "NestedLessLess;":0x226a, "NewLine;":0xa, + "Nfr;":[0xd835,0xdd11], "NoBreak;":0x2060, + "NonBreakingSpace;":0xa0, "Nopf;":0x2115, + "Not;":0x2aec, "NotCongruent;":0x2262, + "NotCupCap;":0x226d, "NotDoubleVerticalBar;":0x2226, + "NotElement;":0x2209, "NotEqual;":0x2260, + "NotEqualTilde;":[0x2242,0x338], "NotExists;":0x2204, + "NotGreater;":0x226f, "NotGreaterEqual;":0x2271, + "NotGreaterFullEqual;":[0x2267,0x338], "NotGreaterGreater;":[0x226b,0x338], + "NotGreaterLess;":0x2279, "NotGreaterSlantEqual;":[0x2a7e,0x338], + "NotGreaterTilde;":0x2275, "NotHumpDownHump;":[0x224e,0x338], + "NotHumpEqual;":[0x224f,0x338], "NotLeftTriangle;":0x22ea, + "NotLeftTriangleBar;":[0x29cf,0x338], "NotLeftTriangleEqual;":0x22ec, + "NotLess;":0x226e, "NotLessEqual;":0x2270, + "NotLessGreater;":0x2278, "NotLessLess;":[0x226a,0x338], + "NotLessSlantEqual;":[0x2a7d,0x338], "NotLessTilde;":0x2274, + "NotNestedGreaterGreater;":[0x2aa2,0x338], "NotNestedLessLess;":[0x2aa1,0x338], + "NotPrecedes;":0x2280, "NotPrecedesEqual;":[0x2aaf,0x338], + "NotPrecedesSlantEqual;":0x22e0, "NotReverseElement;":0x220c, + "NotRightTriangle;":0x22eb, "NotRightTriangleBar;":[0x29d0,0x338], + "NotRightTriangleEqual;":0x22ed, "NotSquareSubset;":[0x228f,0x338], + "NotSquareSubsetEqual;":0x22e2, "NotSquareSuperset;":[0x2290,0x338], + "NotSquareSupersetEqual;":0x22e3, "NotSubset;":[0x2282,0x20d2], + "NotSubsetEqual;":0x2288, "NotSucceeds;":0x2281, + "NotSucceedsEqual;":[0x2ab0,0x338], "NotSucceedsSlantEqual;":0x22e1, + "NotSucceedsTilde;":[0x227f,0x338], "NotSuperset;":[0x2283,0x20d2], + "NotSupersetEqual;":0x2289, "NotTilde;":0x2241, + "NotTildeEqual;":0x2244, "NotTildeFullEqual;":0x2247, + "NotTildeTilde;":0x2249, "NotVerticalBar;":0x2224, + "Nscr;":[0xd835,0xdca9], "Ntilde":0xd1, + "Ntilde;":0xd1, "Nu;":0x39d, + "OElig;":0x152, "Oacute":0xd3, + "Oacute;":0xd3, "Ocirc":0xd4, + "Ocirc;":0xd4, "Ocy;":0x41e, + "Odblac;":0x150, "Ofr;":[0xd835,0xdd12], + "Ograve":0xd2, "Ograve;":0xd2, + "Omacr;":0x14c, "Omega;":0x3a9, + "Omicron;":0x39f, "Oopf;":[0xd835,0xdd46], + "OpenCurlyDoubleQuote;":0x201c, "OpenCurlyQuote;":0x2018, + "Or;":0x2a54, "Oscr;":[0xd835,0xdcaa], + "Oslash":0xd8, "Oslash;":0xd8, + "Otilde":0xd5, "Otilde;":0xd5, + "Otimes;":0x2a37, "Ouml":0xd6, + "Ouml;":0xd6, "OverBar;":0x203e, + "OverBrace;":0x23de, "OverBracket;":0x23b4, + "OverParenthesis;":0x23dc, "PartialD;":0x2202, + "Pcy;":0x41f, "Pfr;":[0xd835,0xdd13], + "Phi;":0x3a6, "Pi;":0x3a0, + "PlusMinus;":0xb1, "Poincareplane;":0x210c, + "Popf;":0x2119, "Pr;":0x2abb, + "Precedes;":0x227a, "PrecedesEqual;":0x2aaf, + "PrecedesSlantEqual;":0x227c, "PrecedesTilde;":0x227e, + "Prime;":0x2033, "Product;":0x220f, + "Proportion;":0x2237, "Proportional;":0x221d, + "Pscr;":[0xd835,0xdcab], "Psi;":0x3a8, + "QUOT":0x22, "QUOT;":0x22, + "Qfr;":[0xd835,0xdd14], "Qopf;":0x211a, + "Qscr;":[0xd835,0xdcac], "RBarr;":0x2910, + "REG":0xae, "REG;":0xae, + "Racute;":0x154, "Rang;":0x27eb, + "Rarr;":0x21a0, "Rarrtl;":0x2916, + "Rcaron;":0x158, "Rcedil;":0x156, + "Rcy;":0x420, "Re;":0x211c, + "ReverseElement;":0x220b, "ReverseEquilibrium;":0x21cb, + "ReverseUpEquilibrium;":0x296f, "Rfr;":0x211c, + "Rho;":0x3a1, "RightAngleBracket;":0x27e9, + "RightArrow;":0x2192, "RightArrowBar;":0x21e5, + "RightArrowLeftArrow;":0x21c4, "RightCeiling;":0x2309, + "RightDoubleBracket;":0x27e7, "RightDownTeeVector;":0x295d, + "RightDownVector;":0x21c2, "RightDownVectorBar;":0x2955, + "RightFloor;":0x230b, "RightTee;":0x22a2, + "RightTeeArrow;":0x21a6, "RightTeeVector;":0x295b, + "RightTriangle;":0x22b3, "RightTriangleBar;":0x29d0, + "RightTriangleEqual;":0x22b5, "RightUpDownVector;":0x294f, + "RightUpTeeVector;":0x295c, "RightUpVector;":0x21be, + "RightUpVectorBar;":0x2954, "RightVector;":0x21c0, + "RightVectorBar;":0x2953, "Rightarrow;":0x21d2, + "Ropf;":0x211d, "RoundImplies;":0x2970, + "Rrightarrow;":0x21db, "Rscr;":0x211b, + "Rsh;":0x21b1, "RuleDelayed;":0x29f4, + "SHCHcy;":0x429, "SHcy;":0x428, + "SOFTcy;":0x42c, "Sacute;":0x15a, + "Sc;":0x2abc, "Scaron;":0x160, + "Scedil;":0x15e, "Scirc;":0x15c, + "Scy;":0x421, "Sfr;":[0xd835,0xdd16], + "ShortDownArrow;":0x2193, "ShortLeftArrow;":0x2190, + "ShortRightArrow;":0x2192, "ShortUpArrow;":0x2191, + "Sigma;":0x3a3, "SmallCircle;":0x2218, + "Sopf;":[0xd835,0xdd4a], "Sqrt;":0x221a, + "Square;":0x25a1, "SquareIntersection;":0x2293, + "SquareSubset;":0x228f, "SquareSubsetEqual;":0x2291, + "SquareSuperset;":0x2290, "SquareSupersetEqual;":0x2292, + "SquareUnion;":0x2294, "Sscr;":[0xd835,0xdcae], + "Star;":0x22c6, "Sub;":0x22d0, + "Subset;":0x22d0, "SubsetEqual;":0x2286, + "Succeeds;":0x227b, "SucceedsEqual;":0x2ab0, + "SucceedsSlantEqual;":0x227d, "SucceedsTilde;":0x227f, + "SuchThat;":0x220b, "Sum;":0x2211, + "Sup;":0x22d1, "Superset;":0x2283, + "SupersetEqual;":0x2287, "Supset;":0x22d1, + "THORN":0xde, "THORN;":0xde, + "TRADE;":0x2122, "TSHcy;":0x40b, + "TScy;":0x426, "Tab;":0x9, + "Tau;":0x3a4, "Tcaron;":0x164, + "Tcedil;":0x162, "Tcy;":0x422, + "Tfr;":[0xd835,0xdd17], "Therefore;":0x2234, + "Theta;":0x398, "ThickSpace;":[0x205f,0x200a], + "ThinSpace;":0x2009, "Tilde;":0x223c, + "TildeEqual;":0x2243, "TildeFullEqual;":0x2245, + "TildeTilde;":0x2248, "Topf;":[0xd835,0xdd4b], + "TripleDot;":0x20db, "Tscr;":[0xd835,0xdcaf], + "Tstrok;":0x166, "Uacute":0xda, + "Uacute;":0xda, "Uarr;":0x219f, + "Uarrocir;":0x2949, "Ubrcy;":0x40e, + "Ubreve;":0x16c, "Ucirc":0xdb, + "Ucirc;":0xdb, "Ucy;":0x423, + "Udblac;":0x170, "Ufr;":[0xd835,0xdd18], + "Ugrave":0xd9, "Ugrave;":0xd9, + "Umacr;":0x16a, "UnderBar;":0x5f, + "UnderBrace;":0x23df, "UnderBracket;":0x23b5, + "UnderParenthesis;":0x23dd, "Union;":0x22c3, + "UnionPlus;":0x228e, "Uogon;":0x172, + "Uopf;":[0xd835,0xdd4c], "UpArrow;":0x2191, + "UpArrowBar;":0x2912, "UpArrowDownArrow;":0x21c5, + "UpDownArrow;":0x2195, "UpEquilibrium;":0x296e, + "UpTee;":0x22a5, "UpTeeArrow;":0x21a5, + "Uparrow;":0x21d1, "Updownarrow;":0x21d5, + "UpperLeftArrow;":0x2196, "UpperRightArrow;":0x2197, + "Upsi;":0x3d2, "Upsilon;":0x3a5, + "Uring;":0x16e, "Uscr;":[0xd835,0xdcb0], + "Utilde;":0x168, "Uuml":0xdc, + "Uuml;":0xdc, "VDash;":0x22ab, + "Vbar;":0x2aeb, "Vcy;":0x412, + "Vdash;":0x22a9, "Vdashl;":0x2ae6, + "Vee;":0x22c1, "Verbar;":0x2016, + "Vert;":0x2016, "VerticalBar;":0x2223, + "VerticalLine;":0x7c, "VerticalSeparator;":0x2758, + "VerticalTilde;":0x2240, "VeryThinSpace;":0x200a, + "Vfr;":[0xd835,0xdd19], "Vopf;":[0xd835,0xdd4d], + "Vscr;":[0xd835,0xdcb1], "Vvdash;":0x22aa, + "Wcirc;":0x174, "Wedge;":0x22c0, + "Wfr;":[0xd835,0xdd1a], "Wopf;":[0xd835,0xdd4e], + "Wscr;":[0xd835,0xdcb2], "Xfr;":[0xd835,0xdd1b], + "Xi;":0x39e, "Xopf;":[0xd835,0xdd4f], + "Xscr;":[0xd835,0xdcb3], "YAcy;":0x42f, + "YIcy;":0x407, "YUcy;":0x42e, + "Yacute":0xdd, "Yacute;":0xdd, + "Ycirc;":0x176, "Ycy;":0x42b, + "Yfr;":[0xd835,0xdd1c], "Yopf;":[0xd835,0xdd50], + "Yscr;":[0xd835,0xdcb4], "Yuml;":0x178, + "ZHcy;":0x416, "Zacute;":0x179, + "Zcaron;":0x17d, "Zcy;":0x417, + "Zdot;":0x17b, "ZeroWidthSpace;":0x200b, + "Zeta;":0x396, "Zfr;":0x2128, + "Zopf;":0x2124, "Zscr;":[0xd835,0xdcb5], + "aacute":0xe1, "aacute;":0xe1, + "abreve;":0x103, "ac;":0x223e, + "acE;":[0x223e,0x333], "acd;":0x223f, + "acirc":0xe2, "acirc;":0xe2, + "acute":0xb4, "acute;":0xb4, + "acy;":0x430, "aelig":0xe6, + "aelig;":0xe6, "af;":0x2061, + "afr;":[0xd835,0xdd1e], "agrave":0xe0, + "agrave;":0xe0, "alefsym;":0x2135, + "aleph;":0x2135, "alpha;":0x3b1, + "amacr;":0x101, "amalg;":0x2a3f, + "amp":0x26, "amp;":0x26, + "and;":0x2227, "andand;":0x2a55, + "andd;":0x2a5c, "andslope;":0x2a58, + "andv;":0x2a5a, "ang;":0x2220, + "ange;":0x29a4, "angle;":0x2220, + "angmsd;":0x2221, "angmsdaa;":0x29a8, + "angmsdab;":0x29a9, "angmsdac;":0x29aa, + "angmsdad;":0x29ab, "angmsdae;":0x29ac, + "angmsdaf;":0x29ad, "angmsdag;":0x29ae, + "angmsdah;":0x29af, "angrt;":0x221f, + "angrtvb;":0x22be, "angrtvbd;":0x299d, + "angsph;":0x2222, "angst;":0xc5, + "angzarr;":0x237c, "aogon;":0x105, + "aopf;":[0xd835,0xdd52], "ap;":0x2248, + "apE;":0x2a70, "apacir;":0x2a6f, + "ape;":0x224a, "apid;":0x224b, + "apos;":0x27, "approx;":0x2248, + "approxeq;":0x224a, "aring":0xe5, + "aring;":0xe5, "ascr;":[0xd835,0xdcb6], + "ast;":0x2a, "asymp;":0x2248, + "asympeq;":0x224d, "atilde":0xe3, + "atilde;":0xe3, "auml":0xe4, + "auml;":0xe4, "awconint;":0x2233, + "awint;":0x2a11, "bNot;":0x2aed, + "backcong;":0x224c, "backepsilon;":0x3f6, + "backprime;":0x2035, "backsim;":0x223d, + "backsimeq;":0x22cd, "barvee;":0x22bd, + "barwed;":0x2305, "barwedge;":0x2305, + "bbrk;":0x23b5, "bbrktbrk;":0x23b6, + "bcong;":0x224c, "bcy;":0x431, + "bdquo;":0x201e, "becaus;":0x2235, + "because;":0x2235, "bemptyv;":0x29b0, + "bepsi;":0x3f6, "bernou;":0x212c, + "beta;":0x3b2, "beth;":0x2136, + "between;":0x226c, "bfr;":[0xd835,0xdd1f], + "bigcap;":0x22c2, "bigcirc;":0x25ef, + "bigcup;":0x22c3, "bigodot;":0x2a00, + "bigoplus;":0x2a01, "bigotimes;":0x2a02, + "bigsqcup;":0x2a06, "bigstar;":0x2605, + "bigtriangledown;":0x25bd, "bigtriangleup;":0x25b3, + "biguplus;":0x2a04, "bigvee;":0x22c1, + "bigwedge;":0x22c0, "bkarow;":0x290d, + "blacklozenge;":0x29eb, "blacksquare;":0x25aa, + "blacktriangle;":0x25b4, "blacktriangledown;":0x25be, + "blacktriangleleft;":0x25c2, "blacktriangleright;":0x25b8, + "blank;":0x2423, "blk12;":0x2592, + "blk14;":0x2591, "blk34;":0x2593, + "block;":0x2588, "bne;":[0x3d,0x20e5], + "bnequiv;":[0x2261,0x20e5], "bnot;":0x2310, + "bopf;":[0xd835,0xdd53], "bot;":0x22a5, + "bottom;":0x22a5, "bowtie;":0x22c8, + "boxDL;":0x2557, "boxDR;":0x2554, + "boxDl;":0x2556, "boxDr;":0x2553, + "boxH;":0x2550, "boxHD;":0x2566, + "boxHU;":0x2569, "boxHd;":0x2564, + "boxHu;":0x2567, "boxUL;":0x255d, + "boxUR;":0x255a, "boxUl;":0x255c, + "boxUr;":0x2559, "boxV;":0x2551, + "boxVH;":0x256c, "boxVL;":0x2563, + "boxVR;":0x2560, "boxVh;":0x256b, + "boxVl;":0x2562, "boxVr;":0x255f, + "boxbox;":0x29c9, "boxdL;":0x2555, + "boxdR;":0x2552, "boxdl;":0x2510, + "boxdr;":0x250c, "boxh;":0x2500, + "boxhD;":0x2565, "boxhU;":0x2568, + "boxhd;":0x252c, "boxhu;":0x2534, + "boxminus;":0x229f, "boxplus;":0x229e, + "boxtimes;":0x22a0, "boxuL;":0x255b, + "boxuR;":0x2558, "boxul;":0x2518, + "boxur;":0x2514, "boxv;":0x2502, + "boxvH;":0x256a, "boxvL;":0x2561, + "boxvR;":0x255e, "boxvh;":0x253c, + "boxvl;":0x2524, "boxvr;":0x251c, + "bprime;":0x2035, "breve;":0x2d8, + "brvbar":0xa6, "brvbar;":0xa6, + "bscr;":[0xd835,0xdcb7], "bsemi;":0x204f, + "bsim;":0x223d, "bsime;":0x22cd, + "bsol;":0x5c, "bsolb;":0x29c5, + "bsolhsub;":0x27c8, "bull;":0x2022, + "bullet;":0x2022, "bump;":0x224e, + "bumpE;":0x2aae, "bumpe;":0x224f, + "bumpeq;":0x224f, "cacute;":0x107, + "cap;":0x2229, "capand;":0x2a44, + "capbrcup;":0x2a49, "capcap;":0x2a4b, + "capcup;":0x2a47, "capdot;":0x2a40, + "caps;":[0x2229,0xfe00], "caret;":0x2041, + "caron;":0x2c7, "ccaps;":0x2a4d, + "ccaron;":0x10d, "ccedil":0xe7, + "ccedil;":0xe7, "ccirc;":0x109, + "ccups;":0x2a4c, "ccupssm;":0x2a50, + "cdot;":0x10b, "cedil":0xb8, + "cedil;":0xb8, "cemptyv;":0x29b2, + "cent":0xa2, "cent;":0xa2, + "centerdot;":0xb7, "cfr;":[0xd835,0xdd20], + "chcy;":0x447, "check;":0x2713, + "checkmark;":0x2713, "chi;":0x3c7, + "cir;":0x25cb, "cirE;":0x29c3, + "circ;":0x2c6, "circeq;":0x2257, + "circlearrowleft;":0x21ba, "circlearrowright;":0x21bb, + "circledR;":0xae, "circledS;":0x24c8, + "circledast;":0x229b, "circledcirc;":0x229a, + "circleddash;":0x229d, "cire;":0x2257, + "cirfnint;":0x2a10, "cirmid;":0x2aef, + "cirscir;":0x29c2, "clubs;":0x2663, + "clubsuit;":0x2663, "colon;":0x3a, + "colone;":0x2254, "coloneq;":0x2254, + "comma;":0x2c, "commat;":0x40, + "comp;":0x2201, "compfn;":0x2218, + "complement;":0x2201, "complexes;":0x2102, + "cong;":0x2245, "congdot;":0x2a6d, + "conint;":0x222e, "copf;":[0xd835,0xdd54], + "coprod;":0x2210, "copy":0xa9, + "copy;":0xa9, "copysr;":0x2117, + "crarr;":0x21b5, "cross;":0x2717, + "cscr;":[0xd835,0xdcb8], "csub;":0x2acf, + "csube;":0x2ad1, "csup;":0x2ad0, + "csupe;":0x2ad2, "ctdot;":0x22ef, + "cudarrl;":0x2938, "cudarrr;":0x2935, + "cuepr;":0x22de, "cuesc;":0x22df, + "cularr;":0x21b6, "cularrp;":0x293d, + "cup;":0x222a, "cupbrcap;":0x2a48, + "cupcap;":0x2a46, "cupcup;":0x2a4a, + "cupdot;":0x228d, "cupor;":0x2a45, + "cups;":[0x222a,0xfe00], "curarr;":0x21b7, + "curarrm;":0x293c, "curlyeqprec;":0x22de, + "curlyeqsucc;":0x22df, "curlyvee;":0x22ce, + "curlywedge;":0x22cf, "curren":0xa4, + "curren;":0xa4, "curvearrowleft;":0x21b6, + "curvearrowright;":0x21b7, "cuvee;":0x22ce, + "cuwed;":0x22cf, "cwconint;":0x2232, + "cwint;":0x2231, "cylcty;":0x232d, + "dArr;":0x21d3, "dHar;":0x2965, + "dagger;":0x2020, "daleth;":0x2138, + "darr;":0x2193, "dash;":0x2010, + "dashv;":0x22a3, "dbkarow;":0x290f, + "dblac;":0x2dd, "dcaron;":0x10f, + "dcy;":0x434, "dd;":0x2146, + "ddagger;":0x2021, "ddarr;":0x21ca, + "ddotseq;":0x2a77, "deg":0xb0, + "deg;":0xb0, "delta;":0x3b4, + "demptyv;":0x29b1, "dfisht;":0x297f, + "dfr;":[0xd835,0xdd21], "dharl;":0x21c3, + "dharr;":0x21c2, "diam;":0x22c4, + "diamond;":0x22c4, "diamondsuit;":0x2666, + "diams;":0x2666, "die;":0xa8, + "digamma;":0x3dd, "disin;":0x22f2, + "div;":0xf7, "divide":0xf7, + "divide;":0xf7, "divideontimes;":0x22c7, + "divonx;":0x22c7, "djcy;":0x452, + "dlcorn;":0x231e, "dlcrop;":0x230d, + "dollar;":0x24, "dopf;":[0xd835,0xdd55], + "dot;":0x2d9, "doteq;":0x2250, + "doteqdot;":0x2251, "dotminus;":0x2238, + "dotplus;":0x2214, "dotsquare;":0x22a1, + "doublebarwedge;":0x2306, "downarrow;":0x2193, + "downdownarrows;":0x21ca, "downharpoonleft;":0x21c3, + "downharpoonright;":0x21c2, "drbkarow;":0x2910, + "drcorn;":0x231f, "drcrop;":0x230c, + "dscr;":[0xd835,0xdcb9], "dscy;":0x455, + "dsol;":0x29f6, "dstrok;":0x111, + "dtdot;":0x22f1, "dtri;":0x25bf, + "dtrif;":0x25be, "duarr;":0x21f5, + "duhar;":0x296f, "dwangle;":0x29a6, + "dzcy;":0x45f, "dzigrarr;":0x27ff, + "eDDot;":0x2a77, "eDot;":0x2251, + "eacute":0xe9, "eacute;":0xe9, + "easter;":0x2a6e, "ecaron;":0x11b, + "ecir;":0x2256, "ecirc":0xea, + "ecirc;":0xea, "ecolon;":0x2255, + "ecy;":0x44d, "edot;":0x117, + "ee;":0x2147, "efDot;":0x2252, + "efr;":[0xd835,0xdd22], "eg;":0x2a9a, + "egrave":0xe8, "egrave;":0xe8, + "egs;":0x2a96, "egsdot;":0x2a98, + "el;":0x2a99, "elinters;":0x23e7, + "ell;":0x2113, "els;":0x2a95, + "elsdot;":0x2a97, "emacr;":0x113, + "empty;":0x2205, "emptyset;":0x2205, + "emptyv;":0x2205, "emsp13;":0x2004, + "emsp14;":0x2005, "emsp;":0x2003, + "eng;":0x14b, "ensp;":0x2002, + "eogon;":0x119, "eopf;":[0xd835,0xdd56], + "epar;":0x22d5, "eparsl;":0x29e3, + "eplus;":0x2a71, "epsi;":0x3b5, + "epsilon;":0x3b5, "epsiv;":0x3f5, + "eqcirc;":0x2256, "eqcolon;":0x2255, + "eqsim;":0x2242, "eqslantgtr;":0x2a96, + "eqslantless;":0x2a95, "equals;":0x3d, + "equest;":0x225f, "equiv;":0x2261, + "equivDD;":0x2a78, "eqvparsl;":0x29e5, + "erDot;":0x2253, "erarr;":0x2971, + "escr;":0x212f, "esdot;":0x2250, + "esim;":0x2242, "eta;":0x3b7, + "eth":0xf0, "eth;":0xf0, + "euml":0xeb, "euml;":0xeb, + "euro;":0x20ac, "excl;":0x21, + "exist;":0x2203, "expectation;":0x2130, + "exponentiale;":0x2147, "fallingdotseq;":0x2252, + "fcy;":0x444, "female;":0x2640, + "ffilig;":0xfb03, "fflig;":0xfb00, + "ffllig;":0xfb04, "ffr;":[0xd835,0xdd23], + "filig;":0xfb01, "fjlig;":[0x66,0x6a], + "flat;":0x266d, "fllig;":0xfb02, + "fltns;":0x25b1, "fnof;":0x192, + "fopf;":[0xd835,0xdd57], "forall;":0x2200, + "fork;":0x22d4, "forkv;":0x2ad9, + "fpartint;":0x2a0d, "frac12":0xbd, + "frac12;":0xbd, "frac13;":0x2153, + "frac14":0xbc, "frac14;":0xbc, + "frac15;":0x2155, "frac16;":0x2159, + "frac18;":0x215b, "frac23;":0x2154, + "frac25;":0x2156, "frac34":0xbe, + "frac34;":0xbe, "frac35;":0x2157, + "frac38;":0x215c, "frac45;":0x2158, + "frac56;":0x215a, "frac58;":0x215d, + "frac78;":0x215e, "frasl;":0x2044, + "frown;":0x2322, "fscr;":[0xd835,0xdcbb], + "gE;":0x2267, "gEl;":0x2a8c, + "gacute;":0x1f5, "gamma;":0x3b3, + "gammad;":0x3dd, "gap;":0x2a86, + "gbreve;":0x11f, "gcirc;":0x11d, + "gcy;":0x433, "gdot;":0x121, + "ge;":0x2265, "gel;":0x22db, + "geq;":0x2265, "geqq;":0x2267, + "geqslant;":0x2a7e, "ges;":0x2a7e, + "gescc;":0x2aa9, "gesdot;":0x2a80, + "gesdoto;":0x2a82, "gesdotol;":0x2a84, + "gesl;":[0x22db,0xfe00], "gesles;":0x2a94, + "gfr;":[0xd835,0xdd24], "gg;":0x226b, + "ggg;":0x22d9, "gimel;":0x2137, + "gjcy;":0x453, "gl;":0x2277, + "glE;":0x2a92, "gla;":0x2aa5, + "glj;":0x2aa4, "gnE;":0x2269, + "gnap;":0x2a8a, "gnapprox;":0x2a8a, + "gne;":0x2a88, "gneq;":0x2a88, + "gneqq;":0x2269, "gnsim;":0x22e7, + "gopf;":[0xd835,0xdd58], "grave;":0x60, + "gscr;":0x210a, "gsim;":0x2273, + "gsime;":0x2a8e, "gsiml;":0x2a90, + "gt":0x3e, "gt;":0x3e, + "gtcc;":0x2aa7, "gtcir;":0x2a7a, + "gtdot;":0x22d7, "gtlPar;":0x2995, + "gtquest;":0x2a7c, "gtrapprox;":0x2a86, + "gtrarr;":0x2978, "gtrdot;":0x22d7, + "gtreqless;":0x22db, "gtreqqless;":0x2a8c, + "gtrless;":0x2277, "gtrsim;":0x2273, + "gvertneqq;":[0x2269,0xfe00], "gvnE;":[0x2269,0xfe00], + "hArr;":0x21d4, "hairsp;":0x200a, + "half;":0xbd, "hamilt;":0x210b, + "hardcy;":0x44a, "harr;":0x2194, + "harrcir;":0x2948, "harrw;":0x21ad, + "hbar;":0x210f, "hcirc;":0x125, + "hearts;":0x2665, "heartsuit;":0x2665, + "hellip;":0x2026, "hercon;":0x22b9, + "hfr;":[0xd835,0xdd25], "hksearow;":0x2925, + "hkswarow;":0x2926, "hoarr;":0x21ff, + "homtht;":0x223b, "hookleftarrow;":0x21a9, + "hookrightarrow;":0x21aa, "hopf;":[0xd835,0xdd59], + "horbar;":0x2015, "hscr;":[0xd835,0xdcbd], + "hslash;":0x210f, "hstrok;":0x127, + "hybull;":0x2043, "hyphen;":0x2010, + "iacute":0xed, "iacute;":0xed, + "ic;":0x2063, "icirc":0xee, + "icirc;":0xee, "icy;":0x438, + "iecy;":0x435, "iexcl":0xa1, + "iexcl;":0xa1, "iff;":0x21d4, + "ifr;":[0xd835,0xdd26], "igrave":0xec, + "igrave;":0xec, "ii;":0x2148, + "iiiint;":0x2a0c, "iiint;":0x222d, + "iinfin;":0x29dc, "iiota;":0x2129, + "ijlig;":0x133, "imacr;":0x12b, + "image;":0x2111, "imagline;":0x2110, + "imagpart;":0x2111, "imath;":0x131, + "imof;":0x22b7, "imped;":0x1b5, + "in;":0x2208, "incare;":0x2105, + "infin;":0x221e, "infintie;":0x29dd, + "inodot;":0x131, "int;":0x222b, + "intcal;":0x22ba, "integers;":0x2124, + "intercal;":0x22ba, "intlarhk;":0x2a17, + "intprod;":0x2a3c, "iocy;":0x451, + "iogon;":0x12f, "iopf;":[0xd835,0xdd5a], + "iota;":0x3b9, "iprod;":0x2a3c, + "iquest":0xbf, "iquest;":0xbf, + "iscr;":[0xd835,0xdcbe], "isin;":0x2208, + "isinE;":0x22f9, "isindot;":0x22f5, + "isins;":0x22f4, "isinsv;":0x22f3, + "isinv;":0x2208, "it;":0x2062, + "itilde;":0x129, "iukcy;":0x456, + "iuml":0xef, "iuml;":0xef, + "jcirc;":0x135, "jcy;":0x439, + "jfr;":[0xd835,0xdd27], "jmath;":0x237, + "jopf;":[0xd835,0xdd5b], "jscr;":[0xd835,0xdcbf], + "jsercy;":0x458, "jukcy;":0x454, + "kappa;":0x3ba, "kappav;":0x3f0, + "kcedil;":0x137, "kcy;":0x43a, + "kfr;":[0xd835,0xdd28], "kgreen;":0x138, + "khcy;":0x445, "kjcy;":0x45c, + "kopf;":[0xd835,0xdd5c], "kscr;":[0xd835,0xdcc0], + "lAarr;":0x21da, "lArr;":0x21d0, + "lAtail;":0x291b, "lBarr;":0x290e, + "lE;":0x2266, "lEg;":0x2a8b, + "lHar;":0x2962, "lacute;":0x13a, + "laemptyv;":0x29b4, "lagran;":0x2112, + "lambda;":0x3bb, "lang;":0x27e8, + "langd;":0x2991, "langle;":0x27e8, + "lap;":0x2a85, "laquo":0xab, + "laquo;":0xab, "larr;":0x2190, + "larrb;":0x21e4, "larrbfs;":0x291f, + "larrfs;":0x291d, "larrhk;":0x21a9, + "larrlp;":0x21ab, "larrpl;":0x2939, + "larrsim;":0x2973, "larrtl;":0x21a2, + "lat;":0x2aab, "latail;":0x2919, + "late;":0x2aad, "lates;":[0x2aad,0xfe00], + "lbarr;":0x290c, "lbbrk;":0x2772, + "lbrace;":0x7b, "lbrack;":0x5b, + "lbrke;":0x298b, "lbrksld;":0x298f, + "lbrkslu;":0x298d, "lcaron;":0x13e, + "lcedil;":0x13c, "lceil;":0x2308, + "lcub;":0x7b, "lcy;":0x43b, + "ldca;":0x2936, "ldquo;":0x201c, + "ldquor;":0x201e, "ldrdhar;":0x2967, + "ldrushar;":0x294b, "ldsh;":0x21b2, + "le;":0x2264, "leftarrow;":0x2190, + "leftarrowtail;":0x21a2, "leftharpoondown;":0x21bd, + "leftharpoonup;":0x21bc, "leftleftarrows;":0x21c7, + "leftrightarrow;":0x2194, "leftrightarrows;":0x21c6, + "leftrightharpoons;":0x21cb, "leftrightsquigarrow;":0x21ad, + "leftthreetimes;":0x22cb, "leg;":0x22da, + "leq;":0x2264, "leqq;":0x2266, + "leqslant;":0x2a7d, "les;":0x2a7d, + "lescc;":0x2aa8, "lesdot;":0x2a7f, + "lesdoto;":0x2a81, "lesdotor;":0x2a83, + "lesg;":[0x22da,0xfe00], "lesges;":0x2a93, + "lessapprox;":0x2a85, "lessdot;":0x22d6, + "lesseqgtr;":0x22da, "lesseqqgtr;":0x2a8b, + "lessgtr;":0x2276, "lesssim;":0x2272, + "lfisht;":0x297c, "lfloor;":0x230a, + "lfr;":[0xd835,0xdd29], "lg;":0x2276, + "lgE;":0x2a91, "lhard;":0x21bd, + "lharu;":0x21bc, "lharul;":0x296a, + "lhblk;":0x2584, "ljcy;":0x459, + "ll;":0x226a, "llarr;":0x21c7, + "llcorner;":0x231e, "llhard;":0x296b, + "lltri;":0x25fa, "lmidot;":0x140, + "lmoust;":0x23b0, "lmoustache;":0x23b0, + "lnE;":0x2268, "lnap;":0x2a89, + "lnapprox;":0x2a89, "lne;":0x2a87, + "lneq;":0x2a87, "lneqq;":0x2268, + "lnsim;":0x22e6, "loang;":0x27ec, + "loarr;":0x21fd, "lobrk;":0x27e6, + "longleftarrow;":0x27f5, "longleftrightarrow;":0x27f7, + "longmapsto;":0x27fc, "longrightarrow;":0x27f6, + "looparrowleft;":0x21ab, "looparrowright;":0x21ac, + "lopar;":0x2985, "lopf;":[0xd835,0xdd5d], + "loplus;":0x2a2d, "lotimes;":0x2a34, + "lowast;":0x2217, "lowbar;":0x5f, + "loz;":0x25ca, "lozenge;":0x25ca, + "lozf;":0x29eb, "lpar;":0x28, + "lparlt;":0x2993, "lrarr;":0x21c6, + "lrcorner;":0x231f, "lrhar;":0x21cb, + "lrhard;":0x296d, "lrm;":0x200e, + "lrtri;":0x22bf, "lsaquo;":0x2039, + "lscr;":[0xd835,0xdcc1], "lsh;":0x21b0, + "lsim;":0x2272, "lsime;":0x2a8d, + "lsimg;":0x2a8f, "lsqb;":0x5b, + "lsquo;":0x2018, "lsquor;":0x201a, + "lstrok;":0x142, "lt":0x3c, + "lt;":0x3c, "ltcc;":0x2aa6, + "ltcir;":0x2a79, "ltdot;":0x22d6, + "lthree;":0x22cb, "ltimes;":0x22c9, + "ltlarr;":0x2976, "ltquest;":0x2a7b, + "ltrPar;":0x2996, "ltri;":0x25c3, + "ltrie;":0x22b4, "ltrif;":0x25c2, + "lurdshar;":0x294a, "luruhar;":0x2966, + "lvertneqq;":[0x2268,0xfe00], "lvnE;":[0x2268,0xfe00], + "mDDot;":0x223a, "macr":0xaf, + "macr;":0xaf, "male;":0x2642, + "malt;":0x2720, "maltese;":0x2720, + "map;":0x21a6, "mapsto;":0x21a6, + "mapstodown;":0x21a7, "mapstoleft;":0x21a4, + "mapstoup;":0x21a5, "marker;":0x25ae, + "mcomma;":0x2a29, "mcy;":0x43c, + "mdash;":0x2014, "measuredangle;":0x2221, + "mfr;":[0xd835,0xdd2a], "mho;":0x2127, + "micro":0xb5, "micro;":0xb5, + "mid;":0x2223, "midast;":0x2a, + "midcir;":0x2af0, "middot":0xb7, + "middot;":0xb7, "minus;":0x2212, + "minusb;":0x229f, "minusd;":0x2238, + "minusdu;":0x2a2a, "mlcp;":0x2adb, + "mldr;":0x2026, "mnplus;":0x2213, + "models;":0x22a7, "mopf;":[0xd835,0xdd5e], + "mp;":0x2213, "mscr;":[0xd835,0xdcc2], + "mstpos;":0x223e, "mu;":0x3bc, + "multimap;":0x22b8, "mumap;":0x22b8, + "nGg;":[0x22d9,0x338], "nGt;":[0x226b,0x20d2], + "nGtv;":[0x226b,0x338], "nLeftarrow;":0x21cd, + "nLeftrightarrow;":0x21ce, "nLl;":[0x22d8,0x338], + "nLt;":[0x226a,0x20d2], "nLtv;":[0x226a,0x338], + "nRightarrow;":0x21cf, "nVDash;":0x22af, + "nVdash;":0x22ae, "nabla;":0x2207, + "nacute;":0x144, "nang;":[0x2220,0x20d2], + "nap;":0x2249, "napE;":[0x2a70,0x338], + "napid;":[0x224b,0x338], "napos;":0x149, + "napprox;":0x2249, "natur;":0x266e, + "natural;":0x266e, "naturals;":0x2115, + "nbsp":0xa0, "nbsp;":0xa0, + "nbump;":[0x224e,0x338], "nbumpe;":[0x224f,0x338], + "ncap;":0x2a43, "ncaron;":0x148, + "ncedil;":0x146, "ncong;":0x2247, + "ncongdot;":[0x2a6d,0x338], "ncup;":0x2a42, + "ncy;":0x43d, "ndash;":0x2013, + "ne;":0x2260, "neArr;":0x21d7, + "nearhk;":0x2924, "nearr;":0x2197, + "nearrow;":0x2197, "nedot;":[0x2250,0x338], + "nequiv;":0x2262, "nesear;":0x2928, + "nesim;":[0x2242,0x338], "nexist;":0x2204, + "nexists;":0x2204, "nfr;":[0xd835,0xdd2b], + "ngE;":[0x2267,0x338], "nge;":0x2271, + "ngeq;":0x2271, "ngeqq;":[0x2267,0x338], + "ngeqslant;":[0x2a7e,0x338], "nges;":[0x2a7e,0x338], + "ngsim;":0x2275, "ngt;":0x226f, + "ngtr;":0x226f, "nhArr;":0x21ce, + "nharr;":0x21ae, "nhpar;":0x2af2, + "ni;":0x220b, "nis;":0x22fc, + "nisd;":0x22fa, "niv;":0x220b, + "njcy;":0x45a, "nlArr;":0x21cd, + "nlE;":[0x2266,0x338], "nlarr;":0x219a, + "nldr;":0x2025, "nle;":0x2270, + "nleftarrow;":0x219a, "nleftrightarrow;":0x21ae, + "nleq;":0x2270, "nleqq;":[0x2266,0x338], + "nleqslant;":[0x2a7d,0x338], "nles;":[0x2a7d,0x338], + "nless;":0x226e, "nlsim;":0x2274, + "nlt;":0x226e, "nltri;":0x22ea, + "nltrie;":0x22ec, "nmid;":0x2224, + "nopf;":[0xd835,0xdd5f], "not":0xac, + "not;":0xac, "notin;":0x2209, + "notinE;":[0x22f9,0x338], "notindot;":[0x22f5,0x338], + "notinva;":0x2209, "notinvb;":0x22f7, + "notinvc;":0x22f6, "notni;":0x220c, + "notniva;":0x220c, "notnivb;":0x22fe, + "notnivc;":0x22fd, "npar;":0x2226, + "nparallel;":0x2226, "nparsl;":[0x2afd,0x20e5], + "npart;":[0x2202,0x338], "npolint;":0x2a14, + "npr;":0x2280, "nprcue;":0x22e0, + "npre;":[0x2aaf,0x338], "nprec;":0x2280, + "npreceq;":[0x2aaf,0x338], "nrArr;":0x21cf, + "nrarr;":0x219b, "nrarrc;":[0x2933,0x338], + "nrarrw;":[0x219d,0x338], "nrightarrow;":0x219b, + "nrtri;":0x22eb, "nrtrie;":0x22ed, + "nsc;":0x2281, "nsccue;":0x22e1, + "nsce;":[0x2ab0,0x338], "nscr;":[0xd835,0xdcc3], + "nshortmid;":0x2224, "nshortparallel;":0x2226, + "nsim;":0x2241, "nsime;":0x2244, + "nsimeq;":0x2244, "nsmid;":0x2224, + "nspar;":0x2226, "nsqsube;":0x22e2, + "nsqsupe;":0x22e3, "nsub;":0x2284, + "nsubE;":[0x2ac5,0x338], "nsube;":0x2288, + "nsubset;":[0x2282,0x20d2], "nsubseteq;":0x2288, + "nsubseteqq;":[0x2ac5,0x338], "nsucc;":0x2281, + "nsucceq;":[0x2ab0,0x338], "nsup;":0x2285, + "nsupE;":[0x2ac6,0x338], "nsupe;":0x2289, + "nsupset;":[0x2283,0x20d2], "nsupseteq;":0x2289, + "nsupseteqq;":[0x2ac6,0x338], "ntgl;":0x2279, + "ntilde":0xf1, "ntilde;":0xf1, + "ntlg;":0x2278, "ntriangleleft;":0x22ea, + "ntrianglelefteq;":0x22ec, "ntriangleright;":0x22eb, + "ntrianglerighteq;":0x22ed, "nu;":0x3bd, + "num;":0x23, "numero;":0x2116, + "numsp;":0x2007, "nvDash;":0x22ad, + "nvHarr;":0x2904, "nvap;":[0x224d,0x20d2], + "nvdash;":0x22ac, "nvge;":[0x2265,0x20d2], + "nvgt;":[0x3e,0x20d2], "nvinfin;":0x29de, + "nvlArr;":0x2902, "nvle;":[0x2264,0x20d2], + "nvlt;":[0x3c,0x20d2], "nvltrie;":[0x22b4,0x20d2], + "nvrArr;":0x2903, "nvrtrie;":[0x22b5,0x20d2], + "nvsim;":[0x223c,0x20d2], "nwArr;":0x21d6, + "nwarhk;":0x2923, "nwarr;":0x2196, + "nwarrow;":0x2196, "nwnear;":0x2927, + "oS;":0x24c8, "oacute":0xf3, + "oacute;":0xf3, "oast;":0x229b, + "ocir;":0x229a, "ocirc":0xf4, + "ocirc;":0xf4, "ocy;":0x43e, + "odash;":0x229d, "odblac;":0x151, + "odiv;":0x2a38, "odot;":0x2299, + "odsold;":0x29bc, "oelig;":0x153, + "ofcir;":0x29bf, "ofr;":[0xd835,0xdd2c], + "ogon;":0x2db, "ograve":0xf2, + "ograve;":0xf2, "ogt;":0x29c1, + "ohbar;":0x29b5, "ohm;":0x3a9, + "oint;":0x222e, "olarr;":0x21ba, + "olcir;":0x29be, "olcross;":0x29bb, + "oline;":0x203e, "olt;":0x29c0, + "omacr;":0x14d, "omega;":0x3c9, + "omicron;":0x3bf, "omid;":0x29b6, + "ominus;":0x2296, "oopf;":[0xd835,0xdd60], + "opar;":0x29b7, "operp;":0x29b9, + "oplus;":0x2295, "or;":0x2228, + "orarr;":0x21bb, "ord;":0x2a5d, + "order;":0x2134, "orderof;":0x2134, + "ordf":0xaa, "ordf;":0xaa, + "ordm":0xba, "ordm;":0xba, + "origof;":0x22b6, "oror;":0x2a56, + "orslope;":0x2a57, "orv;":0x2a5b, + "oscr;":0x2134, "oslash":0xf8, + "oslash;":0xf8, "osol;":0x2298, + "otilde":0xf5, "otilde;":0xf5, + "otimes;":0x2297, "otimesas;":0x2a36, + "ouml":0xf6, "ouml;":0xf6, + "ovbar;":0x233d, "par;":0x2225, + "para":0xb6, "para;":0xb6, + "parallel;":0x2225, "parsim;":0x2af3, + "parsl;":0x2afd, "part;":0x2202, + "pcy;":0x43f, "percnt;":0x25, + "period;":0x2e, "permil;":0x2030, + "perp;":0x22a5, "pertenk;":0x2031, + "pfr;":[0xd835,0xdd2d], "phi;":0x3c6, + "phiv;":0x3d5, "phmmat;":0x2133, + "phone;":0x260e, "pi;":0x3c0, + "pitchfork;":0x22d4, "piv;":0x3d6, + "planck;":0x210f, "planckh;":0x210e, + "plankv;":0x210f, "plus;":0x2b, + "plusacir;":0x2a23, "plusb;":0x229e, + "pluscir;":0x2a22, "plusdo;":0x2214, + "plusdu;":0x2a25, "pluse;":0x2a72, + "plusmn":0xb1, "plusmn;":0xb1, + "plussim;":0x2a26, "plustwo;":0x2a27, + "pm;":0xb1, "pointint;":0x2a15, + "popf;":[0xd835,0xdd61], "pound":0xa3, + "pound;":0xa3, "pr;":0x227a, + "prE;":0x2ab3, "prap;":0x2ab7, + "prcue;":0x227c, "pre;":0x2aaf, + "prec;":0x227a, "precapprox;":0x2ab7, + "preccurlyeq;":0x227c, "preceq;":0x2aaf, + "precnapprox;":0x2ab9, "precneqq;":0x2ab5, + "precnsim;":0x22e8, "precsim;":0x227e, + "prime;":0x2032, "primes;":0x2119, + "prnE;":0x2ab5, "prnap;":0x2ab9, + "prnsim;":0x22e8, "prod;":0x220f, + "profalar;":0x232e, "profline;":0x2312, + "profsurf;":0x2313, "prop;":0x221d, + "propto;":0x221d, "prsim;":0x227e, + "prurel;":0x22b0, "pscr;":[0xd835,0xdcc5], + "psi;":0x3c8, "puncsp;":0x2008, + "qfr;":[0xd835,0xdd2e], "qint;":0x2a0c, + "qopf;":[0xd835,0xdd62], "qprime;":0x2057, + "qscr;":[0xd835,0xdcc6], "quaternions;":0x210d, + "quatint;":0x2a16, "quest;":0x3f, + "questeq;":0x225f, "quot":0x22, + "quot;":0x22, "rAarr;":0x21db, + "rArr;":0x21d2, "rAtail;":0x291c, + "rBarr;":0x290f, "rHar;":0x2964, + "race;":[0x223d,0x331], "racute;":0x155, + "radic;":0x221a, "raemptyv;":0x29b3, + "rang;":0x27e9, "rangd;":0x2992, + "range;":0x29a5, "rangle;":0x27e9, + "raquo":0xbb, "raquo;":0xbb, + "rarr;":0x2192, "rarrap;":0x2975, + "rarrb;":0x21e5, "rarrbfs;":0x2920, + "rarrc;":0x2933, "rarrfs;":0x291e, + "rarrhk;":0x21aa, "rarrlp;":0x21ac, + "rarrpl;":0x2945, "rarrsim;":0x2974, + "rarrtl;":0x21a3, "rarrw;":0x219d, + "ratail;":0x291a, "ratio;":0x2236, + "rationals;":0x211a, "rbarr;":0x290d, + "rbbrk;":0x2773, "rbrace;":0x7d, + "rbrack;":0x5d, "rbrke;":0x298c, + "rbrksld;":0x298e, "rbrkslu;":0x2990, + "rcaron;":0x159, "rcedil;":0x157, + "rceil;":0x2309, "rcub;":0x7d, + "rcy;":0x440, "rdca;":0x2937, + "rdldhar;":0x2969, "rdquo;":0x201d, + "rdquor;":0x201d, "rdsh;":0x21b3, + "real;":0x211c, "realine;":0x211b, + "realpart;":0x211c, "reals;":0x211d, + "rect;":0x25ad, "reg":0xae, + "reg;":0xae, "rfisht;":0x297d, + "rfloor;":0x230b, "rfr;":[0xd835,0xdd2f], + "rhard;":0x21c1, "rharu;":0x21c0, + "rharul;":0x296c, "rho;":0x3c1, + "rhov;":0x3f1, "rightarrow;":0x2192, + "rightarrowtail;":0x21a3, "rightharpoondown;":0x21c1, + "rightharpoonup;":0x21c0, "rightleftarrows;":0x21c4, + "rightleftharpoons;":0x21cc, "rightrightarrows;":0x21c9, + "rightsquigarrow;":0x219d, "rightthreetimes;":0x22cc, + "ring;":0x2da, "risingdotseq;":0x2253, + "rlarr;":0x21c4, "rlhar;":0x21cc, + "rlm;":0x200f, "rmoust;":0x23b1, + "rmoustache;":0x23b1, "rnmid;":0x2aee, + "roang;":0x27ed, "roarr;":0x21fe, + "robrk;":0x27e7, "ropar;":0x2986, + "ropf;":[0xd835,0xdd63], "roplus;":0x2a2e, + "rotimes;":0x2a35, "rpar;":0x29, + "rpargt;":0x2994, "rppolint;":0x2a12, + "rrarr;":0x21c9, "rsaquo;":0x203a, + "rscr;":[0xd835,0xdcc7], "rsh;":0x21b1, + "rsqb;":0x5d, "rsquo;":0x2019, + "rsquor;":0x2019, "rthree;":0x22cc, + "rtimes;":0x22ca, "rtri;":0x25b9, + "rtrie;":0x22b5, "rtrif;":0x25b8, + "rtriltri;":0x29ce, "ruluhar;":0x2968, + "rx;":0x211e, "sacute;":0x15b, + "sbquo;":0x201a, "sc;":0x227b, + "scE;":0x2ab4, "scap;":0x2ab8, + "scaron;":0x161, "sccue;":0x227d, + "sce;":0x2ab0, "scedil;":0x15f, + "scirc;":0x15d, "scnE;":0x2ab6, + "scnap;":0x2aba, "scnsim;":0x22e9, + "scpolint;":0x2a13, "scsim;":0x227f, + "scy;":0x441, "sdot;":0x22c5, + "sdotb;":0x22a1, "sdote;":0x2a66, + "seArr;":0x21d8, "searhk;":0x2925, + "searr;":0x2198, "searrow;":0x2198, + "sect":0xa7, "sect;":0xa7, + "semi;":0x3b, "seswar;":0x2929, + "setminus;":0x2216, "setmn;":0x2216, + "sext;":0x2736, "sfr;":[0xd835,0xdd30], + "sfrown;":0x2322, "sharp;":0x266f, + "shchcy;":0x449, "shcy;":0x448, + "shortmid;":0x2223, "shortparallel;":0x2225, + "shy":0xad, "shy;":0xad, + "sigma;":0x3c3, "sigmaf;":0x3c2, + "sigmav;":0x3c2, "sim;":0x223c, + "simdot;":0x2a6a, "sime;":0x2243, + "simeq;":0x2243, "simg;":0x2a9e, + "simgE;":0x2aa0, "siml;":0x2a9d, + "simlE;":0x2a9f, "simne;":0x2246, + "simplus;":0x2a24, "simrarr;":0x2972, + "slarr;":0x2190, "smallsetminus;":0x2216, + "smashp;":0x2a33, "smeparsl;":0x29e4, + "smid;":0x2223, "smile;":0x2323, + "smt;":0x2aaa, "smte;":0x2aac, + "smtes;":[0x2aac,0xfe00], "softcy;":0x44c, + "sol;":0x2f, "solb;":0x29c4, + "solbar;":0x233f, "sopf;":[0xd835,0xdd64], + "spades;":0x2660, "spadesuit;":0x2660, + "spar;":0x2225, "sqcap;":0x2293, + "sqcaps;":[0x2293,0xfe00], "sqcup;":0x2294, + "sqcups;":[0x2294,0xfe00], "sqsub;":0x228f, + "sqsube;":0x2291, "sqsubset;":0x228f, + "sqsubseteq;":0x2291, "sqsup;":0x2290, + "sqsupe;":0x2292, "sqsupset;":0x2290, + "sqsupseteq;":0x2292, "squ;":0x25a1, + "square;":0x25a1, "squarf;":0x25aa, + "squf;":0x25aa, "srarr;":0x2192, + "sscr;":[0xd835,0xdcc8], "ssetmn;":0x2216, + "ssmile;":0x2323, "sstarf;":0x22c6, + "star;":0x2606, "starf;":0x2605, + "straightepsilon;":0x3f5, "straightphi;":0x3d5, + "strns;":0xaf, "sub;":0x2282, + "subE;":0x2ac5, "subdot;":0x2abd, + "sube;":0x2286, "subedot;":0x2ac3, + "submult;":0x2ac1, "subnE;":0x2acb, + "subne;":0x228a, "subplus;":0x2abf, + "subrarr;":0x2979, "subset;":0x2282, + "subseteq;":0x2286, "subseteqq;":0x2ac5, + "subsetneq;":0x228a, "subsetneqq;":0x2acb, + "subsim;":0x2ac7, "subsub;":0x2ad5, + "subsup;":0x2ad3, "succ;":0x227b, + "succapprox;":0x2ab8, "succcurlyeq;":0x227d, + "succeq;":0x2ab0, "succnapprox;":0x2aba, + "succneqq;":0x2ab6, "succnsim;":0x22e9, + "succsim;":0x227f, "sum;":0x2211, + "sung;":0x266a, "sup1":0xb9, + "sup1;":0xb9, "sup2":0xb2, + "sup2;":0xb2, "sup3":0xb3, + "sup3;":0xb3, "sup;":0x2283, + "supE;":0x2ac6, "supdot;":0x2abe, + "supdsub;":0x2ad8, "supe;":0x2287, + "supedot;":0x2ac4, "suphsol;":0x27c9, + "suphsub;":0x2ad7, "suplarr;":0x297b, + "supmult;":0x2ac2, "supnE;":0x2acc, + "supne;":0x228b, "supplus;":0x2ac0, + "supset;":0x2283, "supseteq;":0x2287, + "supseteqq;":0x2ac6, "supsetneq;":0x228b, + "supsetneqq;":0x2acc, "supsim;":0x2ac8, + "supsub;":0x2ad4, "supsup;":0x2ad6, + "swArr;":0x21d9, "swarhk;":0x2926, + "swarr;":0x2199, "swarrow;":0x2199, + "swnwar;":0x292a, "szlig":0xdf, + "szlig;":0xdf, "target;":0x2316, + "tau;":0x3c4, "tbrk;":0x23b4, + "tcaron;":0x165, "tcedil;":0x163, + "tcy;":0x442, "tdot;":0x20db, + "telrec;":0x2315, "tfr;":[0xd835,0xdd31], + "there4;":0x2234, "therefore;":0x2234, + "theta;":0x3b8, "thetasym;":0x3d1, + "thetav;":0x3d1, "thickapprox;":0x2248, + "thicksim;":0x223c, "thinsp;":0x2009, + "thkap;":0x2248, "thksim;":0x223c, + "thorn":0xfe, "thorn;":0xfe, + "tilde;":0x2dc, "times":0xd7, + "times;":0xd7, "timesb;":0x22a0, + "timesbar;":0x2a31, "timesd;":0x2a30, + "tint;":0x222d, "toea;":0x2928, + "top;":0x22a4, "topbot;":0x2336, + "topcir;":0x2af1, "topf;":[0xd835,0xdd65], + "topfork;":0x2ada, "tosa;":0x2929, + "tprime;":0x2034, "trade;":0x2122, + "triangle;":0x25b5, "triangledown;":0x25bf, + "triangleleft;":0x25c3, "trianglelefteq;":0x22b4, + "triangleq;":0x225c, "triangleright;":0x25b9, + "trianglerighteq;":0x22b5, "tridot;":0x25ec, + "trie;":0x225c, "triminus;":0x2a3a, + "triplus;":0x2a39, "trisb;":0x29cd, + "tritime;":0x2a3b, "trpezium;":0x23e2, + "tscr;":[0xd835,0xdcc9], "tscy;":0x446, + "tshcy;":0x45b, "tstrok;":0x167, + "twixt;":0x226c, "twoheadleftarrow;":0x219e, + "twoheadrightarrow;":0x21a0, "uArr;":0x21d1, + "uHar;":0x2963, "uacute":0xfa, + "uacute;":0xfa, "uarr;":0x2191, + "ubrcy;":0x45e, "ubreve;":0x16d, + "ucirc":0xfb, "ucirc;":0xfb, + "ucy;":0x443, "udarr;":0x21c5, + "udblac;":0x171, "udhar;":0x296e, + "ufisht;":0x297e, "ufr;":[0xd835,0xdd32], + "ugrave":0xf9, "ugrave;":0xf9, + "uharl;":0x21bf, "uharr;":0x21be, + "uhblk;":0x2580, "ulcorn;":0x231c, + "ulcorner;":0x231c, "ulcrop;":0x230f, + "ultri;":0x25f8, "umacr;":0x16b, + "uml":0xa8, "uml;":0xa8, + "uogon;":0x173, "uopf;":[0xd835,0xdd66], + "uparrow;":0x2191, "updownarrow;":0x2195, + "upharpoonleft;":0x21bf, "upharpoonright;":0x21be, + "uplus;":0x228e, "upsi;":0x3c5, + "upsih;":0x3d2, "upsilon;":0x3c5, + "upuparrows;":0x21c8, "urcorn;":0x231d, + "urcorner;":0x231d, "urcrop;":0x230e, + "uring;":0x16f, "urtri;":0x25f9, + "uscr;":[0xd835,0xdcca], "utdot;":0x22f0, + "utilde;":0x169, "utri;":0x25b5, + "utrif;":0x25b4, "uuarr;":0x21c8, + "uuml":0xfc, "uuml;":0xfc, + "uwangle;":0x29a7, "vArr;":0x21d5, + "vBar;":0x2ae8, "vBarv;":0x2ae9, + "vDash;":0x22a8, "vangrt;":0x299c, + "varepsilon;":0x3f5, "varkappa;":0x3f0, + "varnothing;":0x2205, "varphi;":0x3d5, + "varpi;":0x3d6, "varpropto;":0x221d, + "varr;":0x2195, "varrho;":0x3f1, + "varsigma;":0x3c2, "varsubsetneq;":[0x228a,0xfe00], + "varsubsetneqq;":[0x2acb,0xfe00], "varsupsetneq;":[0x228b,0xfe00], + "varsupsetneqq;":[0x2acc,0xfe00], "vartheta;":0x3d1, + "vartriangleleft;":0x22b2, "vartriangleright;":0x22b3, + "vcy;":0x432, "vdash;":0x22a2, + "vee;":0x2228, "veebar;":0x22bb, + "veeeq;":0x225a, "vellip;":0x22ee, + "verbar;":0x7c, "vert;":0x7c, + "vfr;":[0xd835,0xdd33], "vltri;":0x22b2, + "vnsub;":[0x2282,0x20d2], "vnsup;":[0x2283,0x20d2], + "vopf;":[0xd835,0xdd67], "vprop;":0x221d, + "vrtri;":0x22b3, "vscr;":[0xd835,0xdccb], + "vsubnE;":[0x2acb,0xfe00], "vsubne;":[0x228a,0xfe00], + "vsupnE;":[0x2acc,0xfe00], "vsupne;":[0x228b,0xfe00], + "vzigzag;":0x299a, "wcirc;":0x175, + "wedbar;":0x2a5f, "wedge;":0x2227, + "wedgeq;":0x2259, "weierp;":0x2118, + "wfr;":[0xd835,0xdd34], "wopf;":[0xd835,0xdd68], + "wp;":0x2118, "wr;":0x2240, + "wreath;":0x2240, "wscr;":[0xd835,0xdccc], + "xcap;":0x22c2, "xcirc;":0x25ef, + "xcup;":0x22c3, "xdtri;":0x25bd, + "xfr;":[0xd835,0xdd35], "xhArr;":0x27fa, + "xharr;":0x27f7, "xi;":0x3be, + "xlArr;":0x27f8, "xlarr;":0x27f5, + "xmap;":0x27fc, "xnis;":0x22fb, + "xodot;":0x2a00, "xopf;":[0xd835,0xdd69], + "xoplus;":0x2a01, "xotime;":0x2a02, + "xrArr;":0x27f9, "xrarr;":0x27f6, + "xscr;":[0xd835,0xdccd], "xsqcup;":0x2a06, + "xuplus;":0x2a04, "xutri;":0x25b3, + "xvee;":0x22c1, "xwedge;":0x22c0, + "yacute":0xfd, "yacute;":0xfd, + "yacy;":0x44f, "ycirc;":0x177, + "ycy;":0x44b, "yen":0xa5, + "yen;":0xa5, "yfr;":[0xd835,0xdd36], + "yicy;":0x457, "yopf;":[0xd835,0xdd6a], + "yscr;":[0xd835,0xdcce], "yucy;":0x44e, + "yuml":0xff, "yuml;":0xff, + "zacute;":0x17a, "zcaron;":0x17e, + "zcy;":0x437, "zdot;":0x17c, + "zeetrf;":0x2128, "zeta;":0x3b6, + "zfr;":[0xd835,0xdd37], "zhcy;":0x436, + "zigrarr;":0x21dd, "zopf;":[0xd835,0xdd6b], + "zscr;":[0xd835,0xdccf], "zwj;":0x200d, + "zwnj;":0x200c, }; +/* + * This regexp is generated with test/tools/update-entities.js + * It will always match at least one character -- but note that there + * are no entities whose names are a single character long. + */ +var NAMEDCHARREF = /(A(?:Elig;?|MP;?|acute;?|breve;|c(?:irc;?|y;)|fr;|grave;?|lpha;|macr;|nd;|o(?:gon;|pf;)|pplyFunction;|ring;?|s(?:cr;|sign;)|tilde;?|uml;?)|B(?:a(?:ckslash;|r(?:v;|wed;))|cy;|e(?:cause;|rnoullis;|ta;)|fr;|opf;|reve;|scr;|umpeq;)|C(?:Hcy;|OPY;?|a(?:cute;|p(?:;|italDifferentialD;)|yleys;)|c(?:aron;|edil;?|irc;|onint;)|dot;|e(?:dilla;|nterDot;)|fr;|hi;|ircle(?:Dot;|Minus;|Plus;|Times;)|lo(?:ckwiseContourIntegral;|seCurly(?:DoubleQuote;|Quote;))|o(?:lon(?:;|e;)|n(?:gruent;|int;|tourIntegral;)|p(?:f;|roduct;)|unterClockwiseContourIntegral;)|ross;|scr;|up(?:;|Cap;))|D(?:D(?:;|otrahd;)|Jcy;|Scy;|Zcy;|a(?:gger;|rr;|shv;)|c(?:aron;|y;)|el(?:;|ta;)|fr;|i(?:a(?:critical(?:Acute;|Do(?:t;|ubleAcute;)|Grave;|Tilde;)|mond;)|fferentialD;)|o(?:pf;|t(?:;|Dot;|Equal;)|uble(?:ContourIntegral;|Do(?:t;|wnArrow;)|L(?:eft(?:Arrow;|RightArrow;|Tee;)|ong(?:Left(?:Arrow;|RightArrow;)|RightArrow;))|Right(?:Arrow;|Tee;)|Up(?:Arrow;|DownArrow;)|VerticalBar;)|wn(?:Arrow(?:;|Bar;|UpArrow;)|Breve;|Left(?:RightVector;|TeeVector;|Vector(?:;|Bar;))|Right(?:TeeVector;|Vector(?:;|Bar;))|Tee(?:;|Arrow;)|arrow;))|s(?:cr;|trok;))|E(?:NG;|TH;?|acute;?|c(?:aron;|irc;?|y;)|dot;|fr;|grave;?|lement;|m(?:acr;|pty(?:SmallSquare;|VerySmallSquare;))|o(?:gon;|pf;)|psilon;|qu(?:al(?:;|Tilde;)|ilibrium;)|s(?:cr;|im;)|ta;|uml;?|x(?:ists;|ponentialE;))|F(?:cy;|fr;|illed(?:SmallSquare;|VerySmallSquare;)|o(?:pf;|rAll;|uriertrf;)|scr;)|G(?:Jcy;|T;?|amma(?:;|d;)|breve;|c(?:edil;|irc;|y;)|dot;|fr;|g;|opf;|reater(?:Equal(?:;|Less;)|FullEqual;|Greater;|Less;|SlantEqual;|Tilde;)|scr;|t;)|H(?:ARDcy;|a(?:cek;|t;)|circ;|fr;|ilbertSpace;|o(?:pf;|rizontalLine;)|s(?:cr;|trok;)|ump(?:DownHump;|Equal;))|I(?:Ecy;|Jlig;|Ocy;|acute;?|c(?:irc;?|y;)|dot;|fr;|grave;?|m(?:;|a(?:cr;|ginaryI;)|plies;)|n(?:t(?:;|e(?:gral;|rsection;))|visible(?:Comma;|Times;))|o(?:gon;|pf;|ta;)|scr;|tilde;|u(?:kcy;|ml;?))|J(?:c(?:irc;|y;)|fr;|opf;|s(?:cr;|ercy;)|ukcy;)|K(?:Hcy;|Jcy;|appa;|c(?:edil;|y;)|fr;|opf;|scr;)|L(?:Jcy;|T;?|a(?:cute;|mbda;|ng;|placetrf;|rr;)|c(?:aron;|edil;|y;)|e(?:ft(?:A(?:ngleBracket;|rrow(?:;|Bar;|RightArrow;))|Ceiling;|Do(?:ubleBracket;|wn(?:TeeVector;|Vector(?:;|Bar;)))|Floor;|Right(?:Arrow;|Vector;)|T(?:ee(?:;|Arrow;|Vector;)|riangle(?:;|Bar;|Equal;))|Up(?:DownVector;|TeeVector;|Vector(?:;|Bar;))|Vector(?:;|Bar;)|arrow;|rightarrow;)|ss(?:EqualGreater;|FullEqual;|Greater;|Less;|SlantEqual;|Tilde;))|fr;|l(?:;|eftarrow;)|midot;|o(?:ng(?:Left(?:Arrow;|RightArrow;)|RightArrow;|left(?:arrow;|rightarrow;)|rightarrow;)|pf;|wer(?:LeftArrow;|RightArrow;))|s(?:cr;|h;|trok;)|t;)|M(?:ap;|cy;|e(?:diumSpace;|llintrf;)|fr;|inusPlus;|opf;|scr;|u;)|N(?:Jcy;|acute;|c(?:aron;|edil;|y;)|e(?:gative(?:MediumSpace;|Thi(?:ckSpace;|nSpace;)|VeryThinSpace;)|sted(?:GreaterGreater;|LessLess;)|wLine;)|fr;|o(?:Break;|nBreakingSpace;|pf;|t(?:;|C(?:ongruent;|upCap;)|DoubleVerticalBar;|E(?:lement;|qual(?:;|Tilde;)|xists;)|Greater(?:;|Equal;|FullEqual;|Greater;|Less;|SlantEqual;|Tilde;)|Hump(?:DownHump;|Equal;)|Le(?:ftTriangle(?:;|Bar;|Equal;)|ss(?:;|Equal;|Greater;|Less;|SlantEqual;|Tilde;))|Nested(?:GreaterGreater;|LessLess;)|Precedes(?:;|Equal;|SlantEqual;)|R(?:everseElement;|ightTriangle(?:;|Bar;|Equal;))|S(?:quareSu(?:bset(?:;|Equal;)|perset(?:;|Equal;))|u(?:bset(?:;|Equal;)|cceeds(?:;|Equal;|SlantEqual;|Tilde;)|perset(?:;|Equal;)))|Tilde(?:;|Equal;|FullEqual;|Tilde;)|VerticalBar;))|scr;|tilde;?|u;)|O(?:Elig;|acute;?|c(?:irc;?|y;)|dblac;|fr;|grave;?|m(?:acr;|ega;|icron;)|opf;|penCurly(?:DoubleQuote;|Quote;)|r;|s(?:cr;|lash;?)|ti(?:lde;?|mes;)|uml;?|ver(?:B(?:ar;|rac(?:e;|ket;))|Parenthesis;))|P(?:artialD;|cy;|fr;|hi;|i;|lusMinus;|o(?:incareplane;|pf;)|r(?:;|ecedes(?:;|Equal;|SlantEqual;|Tilde;)|ime;|o(?:duct;|portion(?:;|al;)))|s(?:cr;|i;))|Q(?:UOT;?|fr;|opf;|scr;)|R(?:Barr;|EG;?|a(?:cute;|ng;|rr(?:;|tl;))|c(?:aron;|edil;|y;)|e(?:;|verse(?:E(?:lement;|quilibrium;)|UpEquilibrium;))|fr;|ho;|ight(?:A(?:ngleBracket;|rrow(?:;|Bar;|LeftArrow;))|Ceiling;|Do(?:ubleBracket;|wn(?:TeeVector;|Vector(?:;|Bar;)))|Floor;|T(?:ee(?:;|Arrow;|Vector;)|riangle(?:;|Bar;|Equal;))|Up(?:DownVector;|TeeVector;|Vector(?:;|Bar;))|Vector(?:;|Bar;)|arrow;)|o(?:pf;|undImplies;)|rightarrow;|s(?:cr;|h;)|uleDelayed;)|S(?:H(?:CHcy;|cy;)|OFTcy;|acute;|c(?:;|aron;|edil;|irc;|y;)|fr;|hort(?:DownArrow;|LeftArrow;|RightArrow;|UpArrow;)|igma;|mallCircle;|opf;|q(?:rt;|uare(?:;|Intersection;|Su(?:bset(?:;|Equal;)|perset(?:;|Equal;))|Union;))|scr;|tar;|u(?:b(?:;|set(?:;|Equal;))|c(?:ceeds(?:;|Equal;|SlantEqual;|Tilde;)|hThat;)|m;|p(?:;|erset(?:;|Equal;)|set;)))|T(?:HORN;?|RADE;|S(?:Hcy;|cy;)|a(?:b;|u;)|c(?:aron;|edil;|y;)|fr;|h(?:e(?:refore;|ta;)|i(?:ckSpace;|nSpace;))|ilde(?:;|Equal;|FullEqual;|Tilde;)|opf;|ripleDot;|s(?:cr;|trok;))|U(?:a(?:cute;?|rr(?:;|ocir;))|br(?:cy;|eve;)|c(?:irc;?|y;)|dblac;|fr;|grave;?|macr;|n(?:der(?:B(?:ar;|rac(?:e;|ket;))|Parenthesis;)|ion(?:;|Plus;))|o(?:gon;|pf;)|p(?:Arrow(?:;|Bar;|DownArrow;)|DownArrow;|Equilibrium;|Tee(?:;|Arrow;)|arrow;|downarrow;|per(?:LeftArrow;|RightArrow;)|si(?:;|lon;))|ring;|scr;|tilde;|uml;?)|V(?:Dash;|bar;|cy;|dash(?:;|l;)|e(?:e;|r(?:bar;|t(?:;|ical(?:Bar;|Line;|Separator;|Tilde;))|yThinSpace;))|fr;|opf;|scr;|vdash;)|W(?:circ;|edge;|fr;|opf;|scr;)|X(?:fr;|i;|opf;|scr;)|Y(?:Acy;|Icy;|Ucy;|acute;?|c(?:irc;|y;)|fr;|opf;|scr;|uml;)|Z(?:Hcy;|acute;|c(?:aron;|y;)|dot;|e(?:roWidthSpace;|ta;)|fr;|opf;|scr;)|a(?:acute;?|breve;|c(?:;|E;|d;|irc;?|ute;?|y;)|elig;?|f(?:;|r;)|grave;?|l(?:e(?:fsym;|ph;)|pha;)|m(?:a(?:cr;|lg;)|p;?)|n(?:d(?:;|and;|d;|slope;|v;)|g(?:;|e;|le;|msd(?:;|a(?:a;|b;|c;|d;|e;|f;|g;|h;))|rt(?:;|vb(?:;|d;))|s(?:ph;|t;)|zarr;))|o(?:gon;|pf;)|p(?:;|E;|acir;|e;|id;|os;|prox(?:;|eq;))|ring;?|s(?:cr;|t;|ymp(?:;|eq;))|tilde;?|uml;?|w(?:conint;|int;))|b(?:Not;|a(?:ck(?:cong;|epsilon;|prime;|sim(?:;|eq;))|r(?:vee;|wed(?:;|ge;)))|brk(?:;|tbrk;)|c(?:ong;|y;)|dquo;|e(?:caus(?:;|e;)|mptyv;|psi;|rnou;|t(?:a;|h;|ween;))|fr;|ig(?:c(?:ap;|irc;|up;)|o(?:dot;|plus;|times;)|s(?:qcup;|tar;)|triangle(?:down;|up;)|uplus;|vee;|wedge;)|karow;|l(?:a(?:ck(?:lozenge;|square;|triangle(?:;|down;|left;|right;))|nk;)|k(?:1(?:2;|4;)|34;)|ock;)|n(?:e(?:;|quiv;)|ot;)|o(?:pf;|t(?:;|tom;)|wtie;|x(?:D(?:L;|R;|l;|r;)|H(?:;|D;|U;|d;|u;)|U(?:L;|R;|l;|r;)|V(?:;|H;|L;|R;|h;|l;|r;)|box;|d(?:L;|R;|l;|r;)|h(?:;|D;|U;|d;|u;)|minus;|plus;|times;|u(?:L;|R;|l;|r;)|v(?:;|H;|L;|R;|h;|l;|r;)))|prime;|r(?:eve;|vbar;?)|s(?:cr;|emi;|im(?:;|e;)|ol(?:;|b;|hsub;))|u(?:ll(?:;|et;)|mp(?:;|E;|e(?:;|q;))))|c(?:a(?:cute;|p(?:;|and;|brcup;|c(?:ap;|up;)|dot;|s;)|r(?:et;|on;))|c(?:a(?:ps;|ron;)|edil;?|irc;|ups(?:;|sm;))|dot;|e(?:dil;?|mptyv;|nt(?:;|erdot;|))|fr;|h(?:cy;|eck(?:;|mark;)|i;)|ir(?:;|E;|c(?:;|eq;|le(?:arrow(?:left;|right;)|d(?:R;|S;|ast;|circ;|dash;)))|e;|fnint;|mid;|scir;)|lubs(?:;|uit;)|o(?:lon(?:;|e(?:;|q;))|m(?:ma(?:;|t;)|p(?:;|fn;|le(?:ment;|xes;)))|n(?:g(?:;|dot;)|int;)|p(?:f;|rod;|y(?:;|sr;|)))|r(?:arr;|oss;)|s(?:cr;|u(?:b(?:;|e;)|p(?:;|e;)))|tdot;|u(?:darr(?:l;|r;)|e(?:pr;|sc;)|larr(?:;|p;)|p(?:;|brcap;|c(?:ap;|up;)|dot;|or;|s;)|r(?:arr(?:;|m;)|ly(?:eq(?:prec;|succ;)|vee;|wedge;)|ren;?|vearrow(?:left;|right;))|vee;|wed;)|w(?:conint;|int;)|ylcty;)|d(?:Arr;|Har;|a(?:gger;|leth;|rr;|sh(?:;|v;))|b(?:karow;|lac;)|c(?:aron;|y;)|d(?:;|a(?:gger;|rr;)|otseq;)|e(?:g;?|lta;|mptyv;)|f(?:isht;|r;)|har(?:l;|r;)|i(?:am(?:;|ond(?:;|suit;)|s;)|e;|gamma;|sin;|v(?:;|ide(?:;|ontimes;|)|onx;))|jcy;|lc(?:orn;|rop;)|o(?:llar;|pf;|t(?:;|eq(?:;|dot;)|minus;|plus;|square;)|ublebarwedge;|wn(?:arrow;|downarrows;|harpoon(?:left;|right;)))|r(?:bkarow;|c(?:orn;|rop;))|s(?:c(?:r;|y;)|ol;|trok;)|t(?:dot;|ri(?:;|f;))|u(?:arr;|har;)|wangle;|z(?:cy;|igrarr;))|e(?:D(?:Dot;|ot;)|a(?:cute;?|ster;)|c(?:aron;|ir(?:;|c;?)|olon;|y;)|dot;|e;|f(?:Dot;|r;)|g(?:;|rave;?|s(?:;|dot;))|l(?:;|inters;|l;|s(?:;|dot;))|m(?:acr;|pty(?:;|set;|v;)|sp(?:1(?:3;|4;)|;))|n(?:g;|sp;)|o(?:gon;|pf;)|p(?:ar(?:;|sl;)|lus;|si(?:;|lon;|v;))|q(?:c(?:irc;|olon;)|s(?:im;|lant(?:gtr;|less;))|u(?:als;|est;|iv(?:;|DD;))|vparsl;)|r(?:Dot;|arr;)|s(?:cr;|dot;|im;)|t(?:a;|h;?)|u(?:ml;?|ro;)|x(?:cl;|ist;|p(?:ectation;|onentiale;)))|f(?:allingdotseq;|cy;|emale;|f(?:ilig;|l(?:ig;|lig;)|r;)|ilig;|jlig;|l(?:at;|lig;|tns;)|nof;|o(?:pf;|r(?:all;|k(?:;|v;)))|partint;|r(?:a(?:c(?:1(?:2;?|3;|4;?|5;|6;|8;)|2(?:3;|5;)|3(?:4;?|5;|8;)|45;|5(?:6;|8;)|78;)|sl;)|own;)|scr;)|g(?:E(?:;|l;)|a(?:cute;|mma(?:;|d;)|p;)|breve;|c(?:irc;|y;)|dot;|e(?:;|l;|q(?:;|q;|slant;)|s(?:;|cc;|dot(?:;|o(?:;|l;))|l(?:;|es;)))|fr;|g(?:;|g;)|imel;|jcy;|l(?:;|E;|a;|j;)|n(?:E;|ap(?:;|prox;)|e(?:;|q(?:;|q;))|sim;)|opf;|rave;|s(?:cr;|im(?:;|e;|l;))|t(?:;|c(?:c;|ir;)|dot;|lPar;|quest;|r(?:a(?:pprox;|rr;)|dot;|eq(?:less;|qless;)|less;|sim;)|)|v(?:ertneqq;|nE;))|h(?:Arr;|a(?:irsp;|lf;|milt;|r(?:dcy;|r(?:;|cir;|w;)))|bar;|circ;|e(?:arts(?:;|uit;)|llip;|rcon;)|fr;|ks(?:earow;|warow;)|o(?:arr;|mtht;|ok(?:leftarrow;|rightarrow;)|pf;|rbar;)|s(?:cr;|lash;|trok;)|y(?:bull;|phen;))|i(?:acute;?|c(?:;|irc;?|y;)|e(?:cy;|xcl;?)|f(?:f;|r;)|grave;?|i(?:;|i(?:int;|nt;)|nfin;|ota;)|jlig;|m(?:a(?:cr;|g(?:e;|line;|part;)|th;)|of;|ped;)|n(?:;|care;|fin(?:;|tie;)|odot;|t(?:;|cal;|e(?:gers;|rcal;)|larhk;|prod;))|o(?:cy;|gon;|pf;|ta;)|prod;|quest;?|s(?:cr;|in(?:;|E;|dot;|s(?:;|v;)|v;))|t(?:;|ilde;)|u(?:kcy;|ml;?))|j(?:c(?:irc;|y;)|fr;|math;|opf;|s(?:cr;|ercy;)|ukcy;)|k(?:appa(?:;|v;)|c(?:edil;|y;)|fr;|green;|hcy;|jcy;|opf;|scr;)|l(?:A(?:arr;|rr;|tail;)|Barr;|E(?:;|g;)|Har;|a(?:cute;|emptyv;|gran;|mbda;|ng(?:;|d;|le;)|p;|quo;?|rr(?:;|b(?:;|fs;)|fs;|hk;|lp;|pl;|sim;|tl;)|t(?:;|ail;|e(?:;|s;)))|b(?:arr;|brk;|r(?:ac(?:e;|k;)|k(?:e;|sl(?:d;|u;))))|c(?:aron;|e(?:dil;|il;)|ub;|y;)|d(?:ca;|quo(?:;|r;)|r(?:dhar;|ushar;)|sh;)|e(?:;|ft(?:arrow(?:;|tail;)|harpoon(?:down;|up;)|leftarrows;|right(?:arrow(?:;|s;)|harpoons;|squigarrow;)|threetimes;)|g;|q(?:;|q;|slant;)|s(?:;|cc;|dot(?:;|o(?:;|r;))|g(?:;|es;)|s(?:approx;|dot;|eq(?:gtr;|qgtr;)|gtr;|sim;)))|f(?:isht;|loor;|r;)|g(?:;|E;)|h(?:ar(?:d;|u(?:;|l;))|blk;)|jcy;|l(?:;|arr;|corner;|hard;|tri;)|m(?:idot;|oust(?:;|ache;))|n(?:E;|ap(?:;|prox;)|e(?:;|q(?:;|q;))|sim;)|o(?:a(?:ng;|rr;)|brk;|ng(?:left(?:arrow;|rightarrow;)|mapsto;|rightarrow;)|oparrow(?:left;|right;)|p(?:ar;|f;|lus;)|times;|w(?:ast;|bar;)|z(?:;|enge;|f;))|par(?:;|lt;)|r(?:arr;|corner;|har(?:;|d;)|m;|tri;)|s(?:aquo;|cr;|h;|im(?:;|e;|g;)|q(?:b;|uo(?:;|r;))|trok;)|t(?:;|c(?:c;|ir;)|dot;|hree;|imes;|larr;|quest;|r(?:Par;|i(?:;|e;|f;))|)|ur(?:dshar;|uhar;)|v(?:ertneqq;|nE;))|m(?:DDot;|a(?:cr;?|l(?:e;|t(?:;|ese;))|p(?:;|sto(?:;|down;|left;|up;))|rker;)|c(?:omma;|y;)|dash;|easuredangle;|fr;|ho;|i(?:cro;?|d(?:;|ast;|cir;|dot;?)|nus(?:;|b;|d(?:;|u;)))|l(?:cp;|dr;)|nplus;|o(?:dels;|pf;)|p;|s(?:cr;|tpos;)|u(?:;|ltimap;|map;))|n(?:G(?:g;|t(?:;|v;))|L(?:eft(?:arrow;|rightarrow;)|l;|t(?:;|v;))|Rightarrow;|V(?:Dash;|dash;)|a(?:bla;|cute;|ng;|p(?:;|E;|id;|os;|prox;)|tur(?:;|al(?:;|s;)))|b(?:sp;?|ump(?:;|e;))|c(?:a(?:p;|ron;)|edil;|ong(?:;|dot;)|up;|y;)|dash;|e(?:;|Arr;|ar(?:hk;|r(?:;|ow;))|dot;|quiv;|s(?:ear;|im;)|xist(?:;|s;))|fr;|g(?:E;|e(?:;|q(?:;|q;|slant;)|s;)|sim;|t(?:;|r;))|h(?:Arr;|arr;|par;)|i(?:;|s(?:;|d;)|v;)|jcy;|l(?:Arr;|E;|arr;|dr;|e(?:;|ft(?:arrow;|rightarrow;)|q(?:;|q;|slant;)|s(?:;|s;))|sim;|t(?:;|ri(?:;|e;)))|mid;|o(?:pf;|t(?:;|in(?:;|E;|dot;|v(?:a;|b;|c;))|ni(?:;|v(?:a;|b;|c;))|))|p(?:ar(?:;|allel;|sl;|t;)|olint;|r(?:;|cue;|e(?:;|c(?:;|eq;))))|r(?:Arr;|arr(?:;|c;|w;)|ightarrow;|tri(?:;|e;))|s(?:c(?:;|cue;|e;|r;)|hort(?:mid;|parallel;)|im(?:;|e(?:;|q;))|mid;|par;|qsu(?:be;|pe;)|u(?:b(?:;|E;|e;|set(?:;|eq(?:;|q;)))|cc(?:;|eq;)|p(?:;|E;|e;|set(?:;|eq(?:;|q;)))))|t(?:gl;|ilde;?|lg;|riangle(?:left(?:;|eq;)|right(?:;|eq;)))|u(?:;|m(?:;|ero;|sp;))|v(?:Dash;|Harr;|ap;|dash;|g(?:e;|t;)|infin;|l(?:Arr;|e;|t(?:;|rie;))|r(?:Arr;|trie;)|sim;)|w(?:Arr;|ar(?:hk;|r(?:;|ow;))|near;))|o(?:S;|a(?:cute;?|st;)|c(?:ir(?:;|c;?)|y;)|d(?:ash;|blac;|iv;|ot;|sold;)|elig;|f(?:cir;|r;)|g(?:on;|rave;?|t;)|h(?:bar;|m;)|int;|l(?:arr;|c(?:ir;|ross;)|ine;|t;)|m(?:acr;|ega;|i(?:cron;|d;|nus;))|opf;|p(?:ar;|erp;|lus;)|r(?:;|arr;|d(?:;|er(?:;|of;)|f;?|m;?)|igof;|or;|slope;|v;)|s(?:cr;|lash;?|ol;)|ti(?:lde;?|mes(?:;|as;))|uml;?|vbar;)|p(?:ar(?:;|a(?:;|llel;|)|s(?:im;|l;)|t;)|cy;|er(?:cnt;|iod;|mil;|p;|tenk;)|fr;|h(?:i(?:;|v;)|mmat;|one;)|i(?:;|tchfork;|v;)|l(?:an(?:ck(?:;|h;)|kv;)|us(?:;|acir;|b;|cir;|d(?:o;|u;)|e;|mn;?|sim;|two;))|m;|o(?:intint;|pf;|und;?)|r(?:;|E;|ap;|cue;|e(?:;|c(?:;|approx;|curlyeq;|eq;|n(?:approx;|eqq;|sim;)|sim;))|ime(?:;|s;)|n(?:E;|ap;|sim;)|o(?:d;|f(?:alar;|line;|surf;)|p(?:;|to;))|sim;|urel;)|s(?:cr;|i;)|uncsp;)|q(?:fr;|int;|opf;|prime;|scr;|u(?:at(?:ernions;|int;)|est(?:;|eq;)|ot;?))|r(?:A(?:arr;|rr;|tail;)|Barr;|Har;|a(?:c(?:e;|ute;)|dic;|emptyv;|ng(?:;|d;|e;|le;)|quo;?|rr(?:;|ap;|b(?:;|fs;)|c;|fs;|hk;|lp;|pl;|sim;|tl;|w;)|t(?:ail;|io(?:;|nals;)))|b(?:arr;|brk;|r(?:ac(?:e;|k;)|k(?:e;|sl(?:d;|u;))))|c(?:aron;|e(?:dil;|il;)|ub;|y;)|d(?:ca;|ldhar;|quo(?:;|r;)|sh;)|e(?:al(?:;|ine;|part;|s;)|ct;|g;?)|f(?:isht;|loor;|r;)|h(?:ar(?:d;|u(?:;|l;))|o(?:;|v;))|i(?:ght(?:arrow(?:;|tail;)|harpoon(?:down;|up;)|left(?:arrows;|harpoons;)|rightarrows;|squigarrow;|threetimes;)|ng;|singdotseq;)|l(?:arr;|har;|m;)|moust(?:;|ache;)|nmid;|o(?:a(?:ng;|rr;)|brk;|p(?:ar;|f;|lus;)|times;)|p(?:ar(?:;|gt;)|polint;)|rarr;|s(?:aquo;|cr;|h;|q(?:b;|uo(?:;|r;)))|t(?:hree;|imes;|ri(?:;|e;|f;|ltri;))|uluhar;|x;)|s(?:acute;|bquo;|c(?:;|E;|a(?:p;|ron;)|cue;|e(?:;|dil;)|irc;|n(?:E;|ap;|sim;)|polint;|sim;|y;)|dot(?:;|b;|e;)|e(?:Arr;|ar(?:hk;|r(?:;|ow;))|ct;?|mi;|swar;|tm(?:inus;|n;)|xt;)|fr(?:;|own;)|h(?:arp;|c(?:hcy;|y;)|ort(?:mid;|parallel;)|y;?)|i(?:gma(?:;|f;|v;)|m(?:;|dot;|e(?:;|q;)|g(?:;|E;)|l(?:;|E;)|ne;|plus;|rarr;))|larr;|m(?:a(?:llsetminus;|shp;)|eparsl;|i(?:d;|le;)|t(?:;|e(?:;|s;)))|o(?:ftcy;|l(?:;|b(?:;|ar;))|pf;)|pa(?:des(?:;|uit;)|r;)|q(?:c(?:ap(?:;|s;)|up(?:;|s;))|su(?:b(?:;|e;|set(?:;|eq;))|p(?:;|e;|set(?:;|eq;)))|u(?:;|ar(?:e;|f;)|f;))|rarr;|s(?:cr;|etmn;|mile;|tarf;)|t(?:ar(?:;|f;)|r(?:aight(?:epsilon;|phi;)|ns;))|u(?:b(?:;|E;|dot;|e(?:;|dot;)|mult;|n(?:E;|e;)|plus;|rarr;|s(?:et(?:;|eq(?:;|q;)|neq(?:;|q;))|im;|u(?:b;|p;)))|cc(?:;|approx;|curlyeq;|eq;|n(?:approx;|eqq;|sim;)|sim;)|m;|ng;|p(?:1;?|2;?|3;?|;|E;|d(?:ot;|sub;)|e(?:;|dot;)|hs(?:ol;|ub;)|larr;|mult;|n(?:E;|e;)|plus;|s(?:et(?:;|eq(?:;|q;)|neq(?:;|q;))|im;|u(?:b;|p;))))|w(?:Arr;|ar(?:hk;|r(?:;|ow;))|nwar;)|zlig;?)|t(?:a(?:rget;|u;)|brk;|c(?:aron;|edil;|y;)|dot;|elrec;|fr;|h(?:e(?:re(?:4;|fore;)|ta(?:;|sym;|v;))|i(?:ck(?:approx;|sim;)|nsp;)|k(?:ap;|sim;)|orn;?)|i(?:lde;|mes(?:;|b(?:;|ar;)|d;|)|nt;)|o(?:ea;|p(?:;|bot;|cir;|f(?:;|ork;))|sa;)|prime;|r(?:ade;|i(?:angle(?:;|down;|left(?:;|eq;)|q;|right(?:;|eq;))|dot;|e;|minus;|plus;|sb;|time;)|pezium;)|s(?:c(?:r;|y;)|hcy;|trok;)|w(?:ixt;|ohead(?:leftarrow;|rightarrow;)))|u(?:Arr;|Har;|a(?:cute;?|rr;)|br(?:cy;|eve;)|c(?:irc;?|y;)|d(?:arr;|blac;|har;)|f(?:isht;|r;)|grave;?|h(?:ar(?:l;|r;)|blk;)|l(?:c(?:orn(?:;|er;)|rop;)|tri;)|m(?:acr;|l;?)|o(?:gon;|pf;)|p(?:arrow;|downarrow;|harpoon(?:left;|right;)|lus;|si(?:;|h;|lon;)|uparrows;)|r(?:c(?:orn(?:;|er;)|rop;)|ing;|tri;)|scr;|t(?:dot;|ilde;|ri(?:;|f;))|u(?:arr;|ml;?)|wangle;)|v(?:Arr;|Bar(?:;|v;)|Dash;|a(?:ngrt;|r(?:epsilon;|kappa;|nothing;|p(?:hi;|i;|ropto;)|r(?:;|ho;)|s(?:igma;|u(?:bsetneq(?:;|q;)|psetneq(?:;|q;)))|t(?:heta;|riangle(?:left;|right;))))|cy;|dash;|e(?:e(?:;|bar;|eq;)|llip;|r(?:bar;|t;))|fr;|ltri;|nsu(?:b;|p;)|opf;|prop;|rtri;|s(?:cr;|u(?:bn(?:E;|e;)|pn(?:E;|e;)))|zigzag;)|w(?:circ;|e(?:d(?:bar;|ge(?:;|q;))|ierp;)|fr;|opf;|p;|r(?:;|eath;)|scr;)|x(?:c(?:ap;|irc;|up;)|dtri;|fr;|h(?:Arr;|arr;)|i;|l(?:Arr;|arr;)|map;|nis;|o(?:dot;|p(?:f;|lus;)|time;)|r(?:Arr;|arr;)|s(?:cr;|qcup;)|u(?:plus;|tri;)|vee;|wedge;)|y(?:ac(?:ute;?|y;)|c(?:irc;|y;)|en;?|fr;|icy;|opf;|scr;|u(?:cy;|ml;?))|z(?:acute;|c(?:aron;|y;)|dot;|e(?:etrf;|ta;)|fr;|hcy;|igrarr;|opf;|scr;|w(?:j;|nj;)))|[\s\S]/g; + +var NAMEDCHARREF_MAXLEN = 32; + +// Regular expression constants used by the tokenizer and parser + +// Note that \r is included in all of these regexps because it will need +// to be converted to LF by the scanChars() function. +var DBLQUOTEATTRVAL = /[^\r"&\u0000]+/g; +var SINGLEQUOTEATTRVAL = /[^\r'&\u0000]+/g; +var UNQUOTEDATTRVAL = /[^\r\t\n\f &>\u0000]+/g; +var TAGNAME = /[^\r\t\n\f \/>A-Z\u0000]+/g; +var ATTRNAME = /[^\r\t\n\f \/=>A-Z\u0000]+/g; + +var CDATATEXT = /[^\]\r\u0000\uffff]*/g; +var DATATEXT = /[^&<\r\u0000\uffff]*/g; +var RAWTEXT = /[^<\r\u0000\uffff]*/g; +var PLAINTEXT = /[^\r\u0000\uffff]*/g; +// Since we don't have the 'sticky tag', add '|.' to the end of SIMPLETAG +// and SIMPLEATTR so that we are guaranteed to always match. This prevents +// us from scanning past the lastIndex set. (Note that the desired matches +// are always greater than 1 char long, so longest-match will ensure that . +// is not matched unless the desired match fails.) +var SIMPLETAG = /(?:(\/)?([a-z]+)>)|[\s\S]/g; +var SIMPLEATTR = /(?:([-a-z]+)[ \t\n\f]*=[ \t\n\f]*('[^'&\r\u0000]*'|"[^"&\r\u0000]*"|[^\t\n\r\f "&'\u0000>][^&> \t\n\r\f\u0000]*[ \t\n\f]))|[\s\S]/g; + +var NONWS = /[^\x09\x0A\x0C\x0D\x20]/; +var ALLNONWS = /[^\x09\x0A\x0C\x0D\x20]/g; // like above, with g flag +var NONWSNONNUL = /[^\x00\x09\x0A\x0C\x0D\x20]/; // don't allow NUL either +var LEADINGWS = /^[\x09\x0A\x0C\x0D\x20]+/; +var NULCHARS = /\x00/g; + +/*** + * These are utility functions that don't use any of the parser's + * internal state. + */ +function buf2str(buf) { + var CHUNKSIZE=16384; + if (buf.length < CHUNKSIZE) { + return String.fromCharCode.apply(String, buf); + } + // special case for large strings, to avoid busting the stack. + var result = ''; + for (var i = 0; i < buf.length; i += CHUNKSIZE) { + result += String.fromCharCode.apply(String, buf.slice(i, i+CHUNKSIZE)); + } + return result; +} + +function str2buf(s) { + var result = []; + for (var i=0; i 0; i--) { + var e = this.elements[i]; + if (isA(e, tag)) break; + } + this.elements.length = i; + this.top = this.elements[i-1]; +}; -//12.2.4.39 Attribute value (single-quoted) state -//------------------------------------------------------------------ -_[ATTRIBUTE_VALUE_SINGLE_QUOTED_STATE] = function attributeValueSingleQuotedState(cp) { - if (cp === $.APOSTROPHE) - this.state = AFTER_ATTRIBUTE_VALUE_QUOTED_STATE; +// Pop elements off the stack up to and including the first +// element that is an instance of the specified type +HTMLParser.ElementStack.prototype.popElementType = function(type) { + for(var i = this.elements.length-1; i > 0; i--) { + if (this.elements[i] instanceof type) break; + } + this.elements.length = i; + this.top = this.elements[i-1]; +}; - else if (cp === $.AMPERSAND) { - this.additionalAllowedCp = $.APOSTROPHE; - this.returnState = this.state; - this.state = CHARACTER_REFERENCE_IN_ATTRIBUTE_VALUE_STATE; - } +// Pop elements off the stack up to and including the element e. +// Note that this is very different from removeElement() +// This requires that e is on the stack. +HTMLParser.ElementStack.prototype.popElement = function(e) { + for(var i = this.elements.length-1; i > 0; i--) { + if (this.elements[i] === e) break; + } + this.elements.length = i; + this.top = this.elements[i-1]; +}; - else if (cp === $.NULL) - this.currentAttr.value += UNICODE.REPLACEMENT_CHARACTER; +// Remove a specific element from the stack. +// Do nothing if the element is not on the stack +HTMLParser.ElementStack.prototype.removeElement = function(e) { + if (this.top === e) this.pop(); + else { + var idx = this.elements.lastIndexOf(e); + if (idx !== -1) + this.elements.splice(idx, 1); + } +}; - else if (cp === $.EOF) - this._reconsumeInState(DATA_STATE); +HTMLParser.ElementStack.prototype.clearToContext = function(set) { + // Note that we don't loop to 0. Never pop the elt off. + for(var i = this.elements.length-1; i > 0; i--) { + if (isA(this.elements[i], set)) break; + } + this.elements.length = i+1; + this.top = this.elements[i]; +}; - else - this.currentAttr.value += toChar(cp); +HTMLParser.ElementStack.prototype.contains = function(tag) { + return this.inSpecificScope(tag, Object.create(null)); }; +HTMLParser.ElementStack.prototype.inSpecificScope = function(tag, set) { + for(var i = this.elements.length-1; i >= 0; i--) { + var elt = this.elements[i]; + if (isA(elt, tag)) return true; + if (isA(elt, set)) return false; + } + return false; +}; -//12.2.4.40 Attribute value (unquoted) state -//------------------------------------------------------------------ -_[ATTRIBUTE_VALUE_UNQUOTED_STATE] = function attributeValueUnquotedState(cp) { - if (isWhitespace(cp)) - this._leaveAttrValue(BEFORE_ATTRIBUTE_NAME_STATE); +// Like the above, but for a specific element, not a tagname +HTMLParser.ElementStack.prototype.elementInSpecificScope = function(target, set) { + for(var i = this.elements.length-1; i >= 0; i--) { + var elt = this.elements[i]; + if (elt === target) return true; + if (isA(elt, set)) return false; + } + return false; +}; - else if (cp === $.AMPERSAND) { - this.additionalAllowedCp = $.GREATER_THAN_SIGN; - this.returnState = this.state; - this.state = CHARACTER_REFERENCE_IN_ATTRIBUTE_VALUE_STATE; - } +// Like the above, but for an element interface, not a tagname +HTMLParser.ElementStack.prototype.elementTypeInSpecificScope = function(target, set) { + for(var i = this.elements.length-1; i >= 0; i--) { + var elt = this.elements[i]; + if (elt instanceof target) return true; + if (isA(elt, set)) return false; + } + return false; +}; - else if (cp === $.GREATER_THAN_SIGN) { - this._leaveAttrValue(DATA_STATE); - this._emitCurrentToken(); - } +HTMLParser.ElementStack.prototype.inScope = function(tag) { + return this.inSpecificScope(tag, inScopeSet); +}; - else if (cp === $.NULL) - this.currentAttr.value += UNICODE.REPLACEMENT_CHARACTER; +HTMLParser.ElementStack.prototype.elementInScope = function(e) { + return this.elementInSpecificScope(e, inScopeSet); +}; - else if (cp === $.QUOTATION_MARK || cp === $.APOSTROPHE || cp === $.LESS_THAN_SIGN || - cp === $.EQUALS_SIGN || cp === $.GRAVE_ACCENT) - this.currentAttr.value += toChar(cp); +HTMLParser.ElementStack.prototype.elementTypeInScope = function(type) { + return this.elementTypeInSpecificScope(type, inScopeSet); +}; - else if (cp === $.EOF) - this._reconsumeInState(DATA_STATE); +HTMLParser.ElementStack.prototype.inButtonScope = function(tag) { + return this.inSpecificScope(tag, inButtonScopeSet); +}; - else - this.currentAttr.value += toChar(cp); +HTMLParser.ElementStack.prototype.inListItemScope = function(tag) { + return this.inSpecificScope(tag, inListItemScopeSet); }; +HTMLParser.ElementStack.prototype.inTableScope = function(tag) { + return this.inSpecificScope(tag, inTableScopeSet); +}; -//12.2.4.41 Character reference in attribute value state -//------------------------------------------------------------------ -_[CHARACTER_REFERENCE_IN_ATTRIBUTE_VALUE_STATE] = function characterReferenceInAttributeValueState(cp) { - var referencedCodePoints = this._consumeCharacterReference(cp, true); +HTMLParser.ElementStack.prototype.inSelectScope = function(tag) { + // Can't implement this one with inSpecificScope, since it involves + // a set defined by inverting another set. So implement manually. + for(var i = this.elements.length-1; i >= 0; i--) { + var elt = this.elements[i]; + if (elt.namespaceURI !== NAMESPACE.HTML) return false; + var localname = elt.localName; + if (localname === tag) return true; + if (localname !== "optgroup" && localname !== "option") + return false; + } + return false; +}; - if (!this._ensureHibernation()) { - if (referencedCodePoints) { - for (var i = 0; i < referencedCodePoints.length; i++) - this.currentAttr.value += toChar(referencedCodePoints[i]); - } - else - this.currentAttr.value += '&'; +HTMLParser.ElementStack.prototype.generateImpliedEndTags = function(butnot, thorough) { + var endTagSet = thorough ? thoroughImpliedEndTagsSet : impliedEndTagsSet; + for(var i = this.elements.length-1; i >= 0; i--) { + var e = this.elements[i]; + if (butnot && isA(e, butnot)) break; + if (!isA(this.elements[i], endTagSet)) break; + } - this.state = this.returnState; - } + this.elements.length = i+1; + this.top = this.elements[i]; }; +/*** + * The ActiveFormattingElements class + */ +HTMLParser.ActiveFormattingElements = function AFE() { + this.list = []; // elements + this.attrs = []; // attribute tokens for cloning +}; -//12.2.4.42 After attribute value (quoted) state -//------------------------------------------------------------------ -_[AFTER_ATTRIBUTE_VALUE_QUOTED_STATE] = function afterAttributeValueQuotedState(cp) { - if (isWhitespace(cp)) - this._leaveAttrValue(BEFORE_ATTRIBUTE_NAME_STATE); +HTMLParser.ActiveFormattingElements.prototype.MARKER = { localName: "|" }; - else if (cp === $.SOLIDUS) - this._leaveAttrValue(SELF_CLOSING_START_TAG_STATE); +/* +// For debugging +HTMLParser.ActiveFormattingElements.prototype.toString = function() { + return "AFE: " + + this.list.map(function(e) { return e.localName; }).join("-"); +} +*/ - else if (cp === $.GREATER_THAN_SIGN) { - this._leaveAttrValue(DATA_STATE); - this._emitCurrentToken(); +HTMLParser.ActiveFormattingElements.prototype.insertMarker = function() { + this.list.push(this.MARKER); + this.attrs.push(this.MARKER); +}; + +HTMLParser.ActiveFormattingElements.prototype.push = function(elt, attrs) { + // Scan backwards: if there are already 3 copies of this element + // before we encounter a marker, then drop the last one + var count = 0; + for(var i = this.list.length-1; i >= 0; i--) { + if (this.list[i] === this.MARKER) break; + // equal() is defined below + if (equal(elt, this.list[i], this.attrs[i])) { + count++; + if (count === 3) { + this.list.splice(i, 1); + this.attrs.splice(i, 1); + break; + } } + } - else if (cp === $.EOF) - this._reconsumeInState(DATA_STATE); - else - this._reconsumeInState(BEFORE_ATTRIBUTE_NAME_STATE); -}; + // Now push the element onto the list + this.list.push(elt); + + // Copy the attributes and push those on, too + var attrcopy = []; + for(var ii = 0; ii < attrs.length; ii++) { + attrcopy[ii] = attrs[ii]; + } + this.attrs.push(attrcopy); -//12.2.4.43 Self-closing start tag state -//------------------------------------------------------------------ -_[SELF_CLOSING_START_TAG_STATE] = function selfClosingStartTagState(cp) { - if (cp === $.GREATER_THAN_SIGN) { - this.currentToken.selfClosing = true; - this.state = DATA_STATE; - this._emitCurrentToken(); + // This function defines equality of two elements for the purposes + // of the AFE list. Note that it compares the new elements + // attributes to the saved array of attributes associated with + // the old element because a script could have changed the + // old element's set of attributes + function equal(newelt, oldelt, oldattrs) { + if (newelt.localName !== oldelt.localName) return false; + if (newelt._numattrs !== oldattrs.length) return false; + for(var i = 0, n = oldattrs.length; i < n; i++) { + var oldname = oldattrs[i][0]; + var oldval = oldattrs[i][1]; + if (!newelt.hasAttribute(oldname)) return false; + if (newelt.getAttribute(oldname) !== oldval) return false; } + return true; + } +}; + +HTMLParser.ActiveFormattingElements.prototype.clearToMarker = function() { + for(var i = this.list.length-1; i >= 0; i--) { + if (this.list[i] === this.MARKER) break; + } + if (i < 0) i = 0; + this.list.length = i; + this.attrs.length = i; +}; + +// Find and return the last element with the specified tag between the +// end of the list and the last marker on the list. +// Used when parsing in_body_mode() +HTMLParser.ActiveFormattingElements.prototype.findElementByTag = function(tag) { + for(var i = this.list.length-1; i >= 0; i--) { + var elt = this.list[i]; + if (elt === this.MARKER) break; + if (elt.localName === tag) return elt; + } + return null; +}; + +HTMLParser.ActiveFormattingElements.prototype.indexOf = function(e) { + return this.list.lastIndexOf(e); +}; + +// Find the element e in the list and remove it +// Used when parsing in_body() +HTMLParser.ActiveFormattingElements.prototype.remove = function(e) { + var idx = this.list.lastIndexOf(e); + if (idx !== -1) { + this.list.splice(idx, 1); + this.attrs.splice(idx, 1); + } +}; + +// Find element a in the list and replace it with element b +// XXX: Do I need to handle attributes here? +HTMLParser.ActiveFormattingElements.prototype.replace = function(a, b, attrs) { + var idx = this.list.lastIndexOf(a); + if (idx !== -1) { + this.list[idx] = b; + this.attrs[idx] = attrs; + } +}; + +// Find a in the list and insert b after it +// This is only used for insert a bookmark object, so the +// attrs array doesn't really matter +HTMLParser.ActiveFormattingElements.prototype.insertAfter = function(a,b) { + var idx = this.list.lastIndexOf(a); + if (idx !== -1) { + this.list.splice(idx, 0, b); + this.attrs.splice(idx, 0, b); + } +}; + + + + +/*** + * This is the parser factory function. It is the return value of + * the outer closure that it is defined within. Most of the parser + * implementation details are inside this function. + */ +function HTMLParser(address, fragmentContext, options) { + /*** + * These are the parser's state variables + */ + // Scanner state + var chars = null; + var numchars = 0; // Length of chars + var nextchar = 0; // Index of next char + var input_complete = false; // Becomes true when end() called. + var scanner_skip_newline = false; // If previous char was CR + var reentrant_invocations = 0; + var saved_scanner_state = []; + var leftovers = ""; + var first_batch = true; + var paused = 0; // Becomes non-zero while loading scripts + + + // Tokenizer state + var tokenizer = data_state; // Current tokenizer state + var return_state; + var character_reference_code; + var tagnamebuf = ""; + var lasttagname = ""; // holds the target end tag for text states + var tempbuf = []; + var attrnamebuf = ""; + var attrvaluebuf = ""; + var commentbuf = []; + var doctypenamebuf = []; + var doctypepublicbuf = []; + var doctypesystembuf = []; + var attributes = []; + var is_end_tag = false; + + // Tree builder state + var parser = initial_mode; // Current insertion mode + var originalInsertionMode = null; // A saved insertion mode + var templateInsertionModes = []; // Stack of template insertion modes. + var stack = new HTMLParser.ElementStack(); // Stack of open elements + var afe = new HTMLParser.ActiveFormattingElements(); // mis-nested tags + var fragment = (fragmentContext!==undefined); // For innerHTML, etc. + var head_element_pointer = null; + var form_element_pointer = null; + var scripting_enabled = true; + if (fragmentContext) { + scripting_enabled = fragmentContext.ownerDocument._scripting_enabled; + } + if (options && options.scripting_enabled === false) + scripting_enabled = false; + var frameset_ok = true; + var force_quirks = false; + var pending_table_text; + var text_integration_mode; // XXX a spec bug workaround? + + // A single run of characters, buffered up to be sent to + // the parser as a single string. + var textrun = []; + var textIncludesNUL = false; + var ignore_linefeed = false; + + /*** + * This is the parser object that will be the return value of this + * factory function, which is some 5000 lines below. + * Note that the variable "parser" is the current state of the + * parser's state machine. This variable "htmlparser" is the + * return value and defines the public API of the parser + */ + var htmlparser = { + document: function() { + return doc; + }, - else if (cp === $.EOF) - this._reconsumeInState(DATA_STATE); + // Internal function used from HTMLScriptElement to pause the + // parser while a script is being loaded from the network + pause: function() { + // print("pausing parser"); + paused++; + }, - else - this._reconsumeInState(BEFORE_ATTRIBUTE_NAME_STATE); -}; + // Called when a script finishes loading + resume: function() { + // print("resuming parser"); + paused--; + // XXX: added this to force a resumption. + // Is this the right thing to do? + this.parse(""); + }, + // Parse the HTML text s. + // The second argument should be true if there is no more + // text to be parsed, and should be false or omitted otherwise. + // The second argument must not be set for recursive invocations + // from document.write() + parse: function(s, end) { + + // If we're paused, remember the text to parse, but + // don't parse it now. + if (paused > 0) { + leftovers += s; + return; + } -//12.2.4.44 Bogus comment state -//------------------------------------------------------------------ -_[BOGUS_COMMENT_STATE] = function bogusCommentState() { - this._createCommentToken(); - this._reconsumeInState(BOGUS_COMMENT_STATE_CONTINUATION); -}; -//HACK: to support streaming and make BOGUS_COMMENT_STATE reentrant we've -//introduced BOGUS_COMMENT_STATE_CONTINUATION state which will not produce -//comment token on each call. -_[BOGUS_COMMENT_STATE_CONTINUATION] = function bogusCommentStateContinuation(cp) { - while (true) { - if (cp === $.GREATER_THAN_SIGN) { - this.state = DATA_STATE; - break; + if (reentrant_invocations === 0) { + // A normal, top-level invocation + if (leftovers) { + s = leftovers + s; + leftovers = ""; } - else if (cp === $.EOF) { - this._reconsumeInState(DATA_STATE); - break; + // Add a special marker character to the end of + // the buffer. If the scanner is at the end of + // the buffer and input_complete is set, then this + // character will transform into an EOF token. + // Having an actual character that represents EOF + // in the character buffer makes lookahead regexp + // matching work more easily, and this is + // important for character references. + if (end) { + s += "\uFFFF"; + input_complete = true; // Makes scanChars() send EOF } - else { - this.currentToken.data += cp === $.NULL ? UNICODE.REPLACEMENT_CHARACTER : toChar(cp); - - this._hibernationSnapshot(); - cp = this._consume(); + chars = s; + numchars = s.length; + nextchar = 0; - if (this._ensureHibernation()) - return; + if (first_batch) { + // We skip a leading Byte Order Mark (\uFEFF) + // on first batch of text we're given + first_batch = false; + if (chars.charCodeAt(0) === 0xFEFF) nextchar = 1; } - } - this._emitCurrentToken(); -}; - -//12.2.4.45 Markup declaration open state -//------------------------------------------------------------------ -_[MARKUP_DECLARATION_OPEN_STATE] = function markupDeclarationOpenState(cp) { - var dashDashMatch = this._consumeSubsequentIfMatch($$.DASH_DASH_STRING, cp, true), - doctypeMatch = !dashDashMatch && this._consumeSubsequentIfMatch($$.DOCTYPE_STRING, cp, false), - cdataMatch = !dashDashMatch && !doctypeMatch && - this.allowCDATA && - this._consumeSubsequentIfMatch($$.CDATA_START_STRING, cp, true); + reentrant_invocations++; + scanChars(); + leftovers = chars.substring(nextchar, numchars); + reentrant_invocations--; + } + else { + // This is the re-entrant case, which we have to + // handle a little differently. + reentrant_invocations++; - if (!this._ensureHibernation()) { - if (dashDashMatch) { - this._createCommentToken(); - this.state = COMMENT_START_STATE; - } + // Save current scanner state + saved_scanner_state.push(chars, numchars, nextchar); - else if (doctypeMatch) - this.state = DOCTYPE_STATE; + // Set new scanner state + chars = s; + numchars = s.length; + nextchar = 0; - else if (cdataMatch) - this.state = CDATA_SECTION_STATE; + // Now scan as many of these new chars as we can + scanChars(); - else - this._reconsumeInState(BOGUS_COMMENT_STATE); - } -}; + leftovers = chars.substring(nextchar, numchars); + // restore old scanner state + nextchar = saved_scanner_state.pop(); + numchars = saved_scanner_state.pop(); + chars = saved_scanner_state.pop(); -//12.2.4.46 Comment start state -//------------------------------------------------------------------ -_[COMMENT_START_STATE] = function commentStartState(cp) { - if (cp === $.HYPHEN_MINUS) - this.state = COMMENT_START_DASH_STATE; + // If there were leftover chars from this invocation + // insert them into the pending invocation's buffer + // and trim already processed chars at the same time + if (leftovers) { + chars = leftovers + chars.substring(nextchar); + numchars = chars.length; + nextchar = 0; + leftovers = ""; + } - else if (cp === $.NULL) { - this.currentToken.data += UNICODE.REPLACEMENT_CHARACTER; - this.state = COMMENT_STATE; + // Decrement the counter + reentrant_invocations--; + } } - - else if (cp === $.GREATER_THAN_SIGN) { - this.state = DATA_STATE; - this._emitCurrentToken(); + }; + + + // This is the document we'll be building up + var doc = new Document(true, address); + + // The document needs to know about the parser, for document.write(). + // This _parser property will be deleted when we're done parsing. + doc._parser = htmlparser; + + // XXX I think that any document we use this parser on should support + // scripts. But I may need to configure that through a parser parameter + // Only documents with windows ("browsing contexts" to be precise) + // allow scripting. + doc._scripting_enabled = scripting_enabled; + + + /*** + * The actual code of the HTMLParser() factory function begins here. + */ + + if (fragmentContext) { // for innerHTML parsing + if (fragmentContext.ownerDocument._quirks) + doc._quirks = true; + if (fragmentContext.ownerDocument._limitedQuirks) + doc._limitedQuirks = true; + + // Set the initial tokenizer state + if (fragmentContext.namespaceURI === NAMESPACE.HTML) { + switch(fragmentContext.localName) { + case "title": + case "textarea": + tokenizer = rcdata_state; + break; + case "style": + case "xmp": + case "iframe": + case "noembed": + case "noframes": + case "script": + case "plaintext": + tokenizer = plaintext_state; + break; + case "noscript": + if (scripting_enabled) + tokenizer = plaintext_state; + } } - else if (cp === $.EOF) { - this._emitCurrentToken(); - this._reconsumeInState(DATA_STATE); + var root = doc.createElement("html"); + doc._appendChild(root); + stack.push(root); + if (fragmentContext instanceof impl.HTMLTemplateElement) { + templateInsertionModes.push(in_template_mode); } + resetInsertionMode(); - else { - this.currentToken.data += toChar(cp); - this.state = COMMENT_STATE; + for(var e = fragmentContext; e !== null; e = e.parentElement) { + if (e instanceof impl.HTMLFormElement) { + form_element_pointer = e; + break; + } } -}; + } + + /*** + * Scanner functions + */ + // Loop through the characters in chars, and pass them one at a time + // to the tokenizer FSM. Return when no more characters can be processed + // (This may leave 1 or more characters in the buffer: like a CR + // waiting to see if the next char is LF, or for states that require + // lookahead...) + function scanChars() { + var codepoint, s, pattern, eof; + + while(nextchar < numchars) { + + // If we just tokenized a tag, then the paused flag + // may have been set to tell us to stop tokenizing while + // the script is loading + if (paused > 0) { + return; + } -//12.2.4.47 Comment start dash state -//------------------------------------------------------------------ -_[COMMENT_START_DASH_STATE] = function commentStartDashState(cp) { - if (cp === $.HYPHEN_MINUS) - this.state = COMMENT_END_STATE; + switch(typeof tokenizer.lookahead) { + case 'undefined': + codepoint = chars.charCodeAt(nextchar++); + if (scanner_skip_newline) { + scanner_skip_newline = false; + if (codepoint === 0x000A) { + nextchar++; + continue; + } + } + switch(codepoint) { + case 0x000D: + // CR always turns into LF, but if the next character + // is LF, then that second LF is skipped. + if (nextchar < numchars) { + if (chars.charCodeAt(nextchar) === 0x000A) + nextchar++; + } + else { + // We don't know the next char right now, so we + // can't check if it is a LF. So set a flag + scanner_skip_newline = true; + } - else if (cp === $.NULL) { - this.currentToken.data += '-'; - this.currentToken.data += UNICODE.REPLACEMENT_CHARACTER; - this.state = COMMENT_STATE; - } + // In either case, emit a LF + tokenizer(0x000A); - else if (cp === $.GREATER_THAN_SIGN) { - this.state = DATA_STATE; - this._emitCurrentToken(); - } + break; + case 0xFFFF: + if (input_complete && nextchar === numchars) { + tokenizer(EOF); // codepoint will be 0xFFFF here + break; + } + /* falls through */ + default: + tokenizer(codepoint); + break; + } + break; - else if (cp === $.EOF) { - this._emitCurrentToken(); - this._reconsumeInState(DATA_STATE); - } + case 'number': + codepoint = chars.charCodeAt(nextchar); - else { - this.currentToken.data += '-'; - this.currentToken.data += toChar(cp); - this.state = COMMENT_STATE; - } -}; + // The only tokenizer states that require fixed lookahead + // only consume alphanum characters, so we don't have + // to worry about CR and LF in this case + // tokenizer wants n chars of lookahead + var n = tokenizer.lookahead; + var needsString = true; + if (n < 0) { + needsString = false; + n = -n; + } -//12.2.4.48 Comment state -//------------------------------------------------------------------ -_[COMMENT_STATE] = function commentState(cp) { - if (cp === $.HYPHEN_MINUS) - this.state = COMMENT_END_DASH_STATE; + if (n < numchars - nextchar) { + // If we can look ahead that far + s = needsString ? chars.substring(nextchar, nextchar+n) : null; + eof = false; + } + else { // if we don't have that many characters + if (input_complete) { // If no more are coming + // Just return what we have + s = needsString ? chars.substring(nextchar, numchars) : null; + eof = true; + if (codepoint === 0xFFFF && nextchar === numchars-1) + codepoint = EOF; + } + else { + // Return now and wait for more chars later + return; + } + } + tokenizer(codepoint, s, eof); + break; + case 'string': + codepoint = chars.charCodeAt(nextchar); + + // tokenizer wants characters up to a matching string + pattern = tokenizer.lookahead; + var pos = chars.indexOf(pattern, nextchar); + if (pos !== -1) { + s = chars.substring(nextchar, pos + pattern.length); + eof = false; + } + else { // No match + // If more characters coming, wait for them + if (!input_complete) return; + + // Otherwise, we've got to return what we've got + s = chars.substring(nextchar, numchars); + if (codepoint === 0xFFFF && nextchar === numchars-1) + codepoint = EOF; + eof = true; + } + + // The tokenizer states that require this kind of + // lookahead have to be careful to handle CR characters + // correctly + tokenizer(codepoint, s, eof); + break; + } + } + } - else if (cp === $.NULL) - this.currentToken.data += UNICODE.REPLACEMENT_CHARACTER; - else if (cp === $.EOF) { - this._emitCurrentToken(); - this._reconsumeInState(DATA_STATE); + /*** + * Tokenizer utility functions + */ + function addAttribute(name,value) { + // Make sure there isn't already an attribute with this name + // If there is, ignore this one. + for(var i = 0; i < attributes.length; i++) { + if (attributes[i][0] === name) return; } - else - this.currentToken.data += toChar(cp); -}; + if (value !== undefined) { + attributes.push([name, value]); + } + else { + attributes.push([name]); + } + } + + // Shortcut for simple attributes + function handleSimpleAttribute() { + SIMPLEATTR.lastIndex = nextchar-1; + var matched = SIMPLEATTR.exec(chars); + if (!matched) throw new Error("should never happen"); + var name = matched[1]; + if (!name) return false; + var value = matched[2]; + var len = value.length; + switch(value[0]) { + case '"': + case "'": + value = value.substring(1, len-1); + nextchar += (matched[0].length-1); + tokenizer = after_attribute_value_quoted_state; + break; + default: + tokenizer = before_attribute_name_state; + nextchar += (matched[0].length-1); + value = value.substring(0, len-1); + break; + } + + // Make sure there isn't already an attribute with this name + // If there is, ignore this one. + for(var i = 0; i < attributes.length; i++) { + if (attributes[i][0] === name) return true; + } + + attributes.push([name, value]); + return true; + } + + function beginTagName() { + is_end_tag = false; + tagnamebuf = ""; + attributes.length = 0; + } + function beginEndTagName() { + is_end_tag = true; + tagnamebuf = ""; + attributes.length = 0; + } + + function beginTempBuf() { tempbuf.length = 0; } + function beginAttrName() { attrnamebuf = ""; } + function beginAttrValue() { attrvaluebuf = ""; } + function beginComment() { commentbuf.length = 0; } + function beginDoctype() { + doctypenamebuf.length = 0; + doctypepublicbuf = null; + doctypesystembuf = null; + } + function beginDoctypePublicId() { doctypepublicbuf = []; } + function beginDoctypeSystemId() { doctypesystembuf = []; } + function forcequirks() { force_quirks = true; } + function cdataAllowed() { + return stack.top && + stack.top.namespaceURI !== "http://www.w3.org/1999/xhtml"; + } + + // Return true if the codepoints in the specified buffer match the + // characters of lasttagname + function appropriateEndTag(buf) { + return lasttagname === buf; + } + + function flushText() { + if (textrun.length > 0) { + var s = buf2str(textrun); + textrun.length = 0; + + if (ignore_linefeed) { + ignore_linefeed = false; + if (s[0] === "\n") s = s.substring(1); + if (s.length === 0) return; + } + insertToken(TEXT, s); + textIncludesNUL = false; + } + ignore_linefeed = false; + } + + // Consume chars matched by the pattern and return them as a string. Starts + // matching at the current position, so users should drop the current char + // otherwise. + function getMatchingChars(pattern) { + pattern.lastIndex = nextchar - 1; + var match = pattern.exec(chars); + if (match && match.index === nextchar - 1) { + match = match[0]; + nextchar += match.length - 1; + /* Careful! Make sure we haven't matched the EOF character! */ + if (input_complete && nextchar === numchars) { + // Oops, backup one. + match = match.slice(0, -1); + nextchar--; + } + return match; + } else { + throw new Error("should never happen"); + } + } + + // emit a string of chars that match a regexp + // Returns false if no chars matched. + function emitCharsWhile(pattern) { + pattern.lastIndex = nextchar-1; + var match = pattern.exec(chars)[0]; + if (!match) return false; + emitCharString(match); + nextchar += match.length - 1; + return true; + } -//12.2.4.49 Comment end dash state -//------------------------------------------------------------------ -_[COMMENT_END_DASH_STATE] = function commentEndDashState(cp) { - if (cp === $.HYPHEN_MINUS) - this.state = COMMENT_END_STATE; + // This is used by CDATA sections + function emitCharString(s) { + if (textrun.length > 0) flushText(); - else if (cp === $.NULL) { - this.currentToken.data += '-'; - this.currentToken.data += UNICODE.REPLACEMENT_CHARACTER; - this.state = COMMENT_STATE; + if (ignore_linefeed) { + ignore_linefeed = false; + if (s[0] === "\n") s = s.substring(1); + if (s.length === 0) return; } - else if (cp === $.EOF) { - this._emitCurrentToken(); - this._reconsumeInState(DATA_STATE); - } + insertToken(TEXT, s); + } + function emitTag() { + if (is_end_tag) insertToken(ENDTAG, tagnamebuf); else { - this.currentToken.data += '-'; - this.currentToken.data += toChar(cp); - this.state = COMMENT_STATE; + // Remember the last open tag we emitted + var tagname = tagnamebuf; + tagnamebuf = ""; + lasttagname = tagname; + insertToken(TAG, tagname, attributes); + } + } + + + // A shortcut: look ahead and if this is a open or close tag + // in lowercase with no spaces and no attributes, just emit it now. + function emitSimpleTag() { + SIMPLETAG.lastIndex = nextchar; + var matched = SIMPLETAG.exec(chars); + if (!matched) throw new Error("should never happen"); + var tagname = matched[2]; + if (!tagname) return false; + var endtag = matched[1]; + if (endtag) { + nextchar += (tagname.length+2); + insertToken(ENDTAG, tagname); } -}; - + else { + nextchar += (tagname.length+1); + lasttagname = tagname; + insertToken(TAG, tagname, NOATTRS); + } + return true; + } -//12.2.4.50 Comment end state -//------------------------------------------------------------------ -_[COMMENT_END_STATE] = function commentEndState(cp) { - if (cp === $.GREATER_THAN_SIGN) { - this.state = DATA_STATE; - this._emitCurrentToken(); + function emitSelfClosingTag() { + if (is_end_tag) insertToken(ENDTAG, tagnamebuf, null, true); + else { + insertToken(TAG, tagnamebuf, attributes, true); } + } - else if (cp === $.EXCLAMATION_MARK) - this.state = COMMENT_END_BANG_STATE; + function emitDoctype() { + insertToken(DOCTYPE, + buf2str(doctypenamebuf), + doctypepublicbuf ? buf2str(doctypepublicbuf) : undefined, + doctypesystembuf ? buf2str(doctypesystembuf) : undefined); + } - else if (cp === $.HYPHEN_MINUS) - this.currentToken.data += '-'; + function emitEOF() { + flushText(); + parser(EOF); // EOF never goes to insertForeignContent() + doc.modclock = 1; // Start tracking modifications + } - else if (cp === $.NULL) { - this.currentToken.data += '--'; - this.currentToken.data += UNICODE.REPLACEMENT_CHARACTER; - this.state = COMMENT_STATE; - } + // Insert a token, either using the current parser insertion mode + // (for HTML stuff) or using the insertForeignToken() method. + var insertToken = htmlparser.insertToken = function insertToken(t, value, arg3, arg4) { + flushText(); + var current = stack.top; - else if (cp === $.EOF) { - this._reconsumeInState(DATA_STATE); - this._emitCurrentToken(); + if (!current || current.namespaceURI === NAMESPACE.HTML) { + // This is the common case + parser(t, value, arg3, arg4); } - else { - this.currentToken.data += '--'; - this.currentToken.data += toChar(cp); - this.state = COMMENT_STATE; + // Otherwise we may need to insert this token as foreign content + if (t !== TAG && t !== TEXT) { + insertForeignToken(t, value, arg3, arg4); + } + else { + // But in some cases we treat it as regular content + if ((isMathmlTextIntegrationPoint(current) && + (t === TEXT || + (t === TAG && + value !== "mglyph" && value !== "malignmark"))) || + (t === TAG && + value === "svg" && + current.namespaceURI === NAMESPACE.MATHML && + current.localName === "annotation-xml") || + isHTMLIntegrationPoint(current)) { + + // XXX: the text_integration_mode stuff is an + // attempted bug workaround of mine + text_integration_mode = true; + parser(t, value, arg3, arg4); + text_integration_mode = false; + } + // Otherwise it is foreign content + else { + insertForeignToken(t, value, arg3, arg4); + } + } } -}; + }; + + + /*** + * Tree building utility functions + */ + function insertComment(data) { + var parent = stack.top; + if (foster_parent_mode && isA(parent, tablesectionrowSet)) { + fosterParent(function(doc) { return doc.createComment(data); }); + } else { + // "If the adjusted insertion location is inside a template element, + // let it instead be inside the template element's template contents" + if (parent instanceof impl.HTMLTemplateElement) { + parent = parent.content; + } + parent._appendChild(parent.ownerDocument.createComment(data)); + } + } + + function insertText(s) { + var parent = stack.top; + if (foster_parent_mode && isA(parent, tablesectionrowSet)) { + fosterParent(function(doc) { return doc.createTextNode(s); }); + } else { + // "If the adjusted insertion location is inside a template element, + // let it instead be inside the template element's template contents" + if (parent instanceof impl.HTMLTemplateElement) { + parent = parent.content; + } + // "If there is a Text node immediately before the adjusted insertion + // location, then append data to that Text node's data." + var lastChild = parent.lastChild; + if (lastChild && lastChild.nodeType === Node.TEXT_NODE) { + lastChild.appendData(s); + } else { + parent._appendChild(parent.ownerDocument.createTextNode(s)); + } + } + } + function createHTMLElt(doc, name, attrs) { + // Create the element this way, rather than with + // doc.createElement because createElement() does error + // checking on the element name that we need to avoid here. + var elt = html.createElement(doc, name, null); -//12.2.4.51 Comment end bang state -//------------------------------------------------------------------ -_[COMMENT_END_BANG_STATE] = function commentEndBangState(cp) { - if (cp === $.HYPHEN_MINUS) { - this.currentToken.data += '--!'; - this.state = COMMENT_END_DASH_STATE; + if (attrs) { + for(var i = 0, n = attrs.length; i < n; i++) { + // Use the _ version to avoid testing the validity + // of the attribute name + elt._setAttribute(attrs[i][0], attrs[i][1]); + } } + // XXX + // If the element is a resettable form element, + // run its reset algorithm now + // XXX + // handle case where form-element-pointer is not null + return elt; + } + + // The in_table insertion mode turns on this flag, and that makes + // insertHTMLElement use the foster parenting algorithm for elements + // tags inside a table + var foster_parent_mode = false; + + function insertHTMLElement(name, attrs) { + var elt = insertElement(function(doc) { + return createHTMLElt(doc, name, attrs); + }); + + // XXX + // If this is a form element, set its form attribute property here + if (isA(elt, formassociatedSet)) { + elt._form = form_element_pointer; + } + + return elt; + } + + // Insert the element into the open element or foster parent it + function insertElement(eltFunc) { + var elt; + if (foster_parent_mode && isA(stack.top, tablesectionrowSet)) { + elt = fosterParent(eltFunc); + } + else if (stack.top instanceof impl.HTMLTemplateElement) { + // "If the adjusted insertion location is inside a template element, + // let it instead be inside the template element's template contents" + elt = eltFunc(stack.top.content.ownerDocument); + stack.top.content._appendChild(elt); + } else { + elt = eltFunc(stack.top.ownerDocument); + stack.top._appendChild(elt); + } + + stack.push(elt); + return elt; + } + + function insertForeignElement(name, attrs, ns) { + return insertElement(function(doc) { + var elt = doc.createElementNS(ns, name); + if (attrs) { + for(var i = 0, n = attrs.length; i < n; i++) { + var attr = attrs[i]; + if (attr.length === 2) + elt._setAttribute(attr[0], attr[1]); + else { + elt._setAttributeNS(attr[2], attr[0], attr[1]); + } + } + } + return elt; + }); + } - else if (cp === $.GREATER_THAN_SIGN) { - this.state = DATA_STATE; - this._emitCurrentToken(); + function lastElementOfType(type) { + for(var i = stack.elements.length-1; i >= 0; i--) { + if (stack.elements[i] instanceof type) { + return i; + } } + return -1; + } + + function fosterParent(eltFunc) { + var parent, before, lastTable = -1, lastTemplate = -1, elt; - else if (cp === $.NULL) { - this.currentToken.data += '--!'; - this.currentToken.data += UNICODE.REPLACEMENT_CHARACTER; - this.state = COMMENT_STATE; + lastTable = lastElementOfType(impl.HTMLTableElement); + lastTemplate = lastElementOfType(impl.HTMLTemplateElement); + + if (lastTemplate >= 0 && (lastTable < 0 || lastTemplate > lastTable)) { + parent = stack.elements[lastTemplate]; + } else if (lastTable >= 0) { + parent = stack.elements[lastTable].parentNode; + if (parent) { + before = stack.elements[lastTable]; + } else { + parent = stack.elements[lastTable - 1]; + } } + if (!parent) parent = stack.elements[0]; // the `html` element. - else if (cp === $.EOF) { - this._emitCurrentToken(); - this._reconsumeInState(DATA_STATE); + // "If the adjusted insertion location is inside a template element, + // let it instead be inside the template element's template contents" + if (parent instanceof impl.HTMLTemplateElement) { + parent = parent.content; } + // Create element in the appropriate document. + elt = eltFunc(parent.ownerDocument); - else { - this.currentToken.data += '--!'; - this.currentToken.data += toChar(cp); - this.state = COMMENT_STATE; + if (elt.nodeType === Node.TEXT_NODE) { + var prev; + if (before) prev = before.previousSibling; + else prev = parent.lastChild; + if (prev && prev.nodeType === Node.TEXT_NODE) { + prev.appendData(elt.data); + return elt; + } } -}; + if (before) + parent.insertBefore(elt, before); + else + parent._appendChild(elt); + return elt; + } -//12.2.4.52 DOCTYPE state -//------------------------------------------------------------------ -_[DOCTYPE_STATE] = function doctypeState(cp) { - if (isWhitespace(cp)) + function resetInsertionMode() { + var last = false; + for(var i = stack.elements.length-1; i >= 0; i--) { + var node = stack.elements[i]; + if (i === 0) { + last = true; + if (fragment) { + node = fragmentContext; + } + } + if (node.namespaceURI === NAMESPACE.HTML) { + var tag = node.localName; + switch(tag) { + case "select": + for(var j = i; j > 0; ) { + var ancestor = stack.elements[--j]; + if (ancestor instanceof impl.HTMLTemplateElement) { + break; + } else if (ancestor instanceof impl.HTMLTableElement) { + parser = in_select_in_table_mode; + return; + } + } + parser = in_select_mode; + return; + case "tr": + parser = in_row_mode; + return; + case "tbody": + case "tfoot": + case "thead": + parser = in_table_body_mode; + return; + case "caption": + parser = in_caption_mode; + return; + case "colgroup": + parser = in_column_group_mode; + return; + case "table": + parser = in_table_mode; + return; + case "template": + parser = templateInsertionModes[templateInsertionModes.length-1]; + return; + case "body": + parser = in_body_mode; + return; + case "frameset": + parser = in_frameset_mode; + return; + case "html": + if (head_element_pointer === null) { + parser = before_head_mode; + } else { + parser = after_head_mode; + } + return; + default: + if (!last) { + if (tag === "head") { + parser = in_head_mode; + return; + } + if (tag === "td" || tag === "th") { + parser = in_cell_mode; + return; + } + } + } + } + if (last) { + parser = in_body_mode; return; - - else if (cp === $.GREATER_THAN_SIGN) { - this._createDoctypeToken(null); - this.currentToken.forceQuirks = true; - this._emitCurrentToken(); - this.state = DATA_STATE; + } } + } - else if (cp === $.EOF) { - this._createDoctypeToken(null); - this.currentToken.forceQuirks = true; - this._emitCurrentToken(); - this._reconsumeInState(DATA_STATE); - } - else { - this._createDoctypeToken(''); - this._reconsumeInState(DOCTYPE_NAME_STATE); - } -}; + function parseRawText(name, attrs) { + insertHTMLElement(name, attrs); + tokenizer = rawtext_state; + originalInsertionMode = parser; + parser = text_mode; + } -//12.2.4.54 DOCTYPE name state -//------------------------------------------------------------------ -_[DOCTYPE_NAME_STATE] = function doctypeNameState(cp) { - if (isWhitespace(cp) || cp === $.GREATER_THAN_SIGN || cp === $.EOF) - this._reconsumeInState(AFTER_DOCTYPE_NAME_STATE); + function parseRCDATA(name, attrs) { + insertHTMLElement(name, attrs); + tokenizer = rcdata_state; + originalInsertionMode = parser; + parser = text_mode; + } - else if (isAsciiUpper(cp)) - this.currentToken.name += toAsciiLowerChar(cp); + // Make a copy of element i on the list of active formatting + // elements, using its original attributes, not current + // attributes (which may have been modified by a script) + function afeclone(doc, i) { + return { + elt: createHTMLElt(doc, afe.list[i].localName, afe.attrs[i]), + attrs: afe.attrs[i], + }; + } + + + function afereconstruct() { + if (afe.list.length === 0) return; + var entry = afe.list[afe.list.length-1]; + // If the last is a marker , do nothing + if (entry === afe.MARKER) return; + // Or if it is an open element, do nothing + if (stack.elements.lastIndexOf(entry) !== -1) return; + + // Loop backward through the list until we find a marker or an + // open element, and then move forward one from there. + for(var i = afe.list.length-2; i >= 0; i--) { + entry = afe.list[i]; + if (entry === afe.MARKER) break; + if (stack.elements.lastIndexOf(entry) !== -1) break; + } + + // Now loop forward, starting from the element after the current + // one, recreating formatting elements and pushing them back onto + // the list of open elements + for(i = i+1; i < afe.list.length; i++) { + var newelt = insertElement(function(doc) { return afeclone(doc, i).elt; }); + afe.list[i] = newelt; + } + } + + // Used by the adoptionAgency() function + var BOOKMARK = {localName:"BM"}; + + function adoptionAgency(tag) { + // If the current node is an HTML element whose tag name is subject, + // and the current node is not in the list of active formatting + // elements, then pop the current node off the stack of open + // elements and abort these steps. + if (isA(stack.top, tag) && afe.indexOf(stack.top) === -1) { + stack.pop(); + return true; // no more handling required + } + + // Let outer loop counter be zero. + var outer = 0; + + // Outer loop: If outer loop counter is greater than or + // equal to eight, then abort these steps. + while(outer < 8) { + // Increment outer loop counter by one. + outer++; + + // Let the formatting element be the last element in the list + // of active formatting elements that: is between the end of + // the list and the last scope marker in the list, if any, or + // the start of the list otherwise, and has the same tag name + // as the token. + var fmtelt = afe.findElementByTag(tag); + + // If there is no such node, then abort these steps and instead + // act as described in the "any other end tag" entry below. + if (!fmtelt) { + return false; // false means handle by the default case + } - else if (cp === $.NULL) - this.currentToken.name += UNICODE.REPLACEMENT_CHARACTER; + // Otherwise, if there is such a node, but that node is not in + // the stack of open elements, then this is a parse error; + // remove the element from the list, and abort these steps. + var index = stack.elements.lastIndexOf(fmtelt); + if (index === -1) { + afe.remove(fmtelt); + return true; // true means no more handling required + } - else - this.currentToken.name += toChar(cp); -}; + // Otherwise, if there is such a node, and that node is also in + // the stack of open elements, but the element is not in scope, + // then this is a parse error; ignore the token, and abort + // these steps. + if (!stack.elementInScope(fmtelt)) { + return true; + } + // Let the furthest block be the topmost node in the stack of + // open elements that is lower in the stack than the formatting + // element, and is an element in the special category. There + // might not be one. + var furthestblock = null, furthestblockindex; + for(var i = index+1; i < stack.elements.length; i++) { + if (isA(stack.elements[i], specialSet)) { + furthestblock = stack.elements[i]; + furthestblockindex = i; + break; + } + } -//12.2.4.55 After DOCTYPE name state -//------------------------------------------------------------------ -_[AFTER_DOCTYPE_NAME_STATE] = function afterDoctypeNameState(cp) { - if (isWhitespace(cp)) - return; + // If there is no furthest block, then the UA must skip the + // subsequent steps and instead just pop all the nodes from the + // bottom of the stack of open elements, from the current node + // up to and including the formatting element, and remove the + // formatting element from the list of active formatting + // elements. + if (!furthestblock) { + stack.popElement(fmtelt); + afe.remove(fmtelt); + return true; + } + else { + // Let the common ancestor be the element immediately above + // the formatting element in the stack of open elements. + var ancestor = stack.elements[index-1]; + + // Let a bookmark note the position of the formatting + // element in the list of active formatting elements + // relative to the elements on either side of it in the + // list. + afe.insertAfter(fmtelt, BOOKMARK); + + // Let node and last node be the furthest block. + var node = furthestblock; + var lastnode = furthestblock; + var nodeindex = furthestblockindex; + var nodeafeindex; + + // Let inner loop counter be zero. + var inner = 0; + + while (true) { + + // Increment inner loop counter by one. + inner++; + + // Let node be the element immediately above node in + // the stack of open elements, or if node is no longer + // in the stack of open elements (e.g. because it got + // removed by this algorithm), the element that was + // immediately above node in the stack of open elements + // before node was removed. + node = stack.elements[--nodeindex]; + + // If node is the formatting element, then go + // to the next step in the overall algorithm. + if (node === fmtelt) break; + + // If the inner loop counter is greater than three and node + // is in the list of active formatting elements, then remove + // node from the list of active formatting elements. + nodeafeindex = afe.indexOf(node); + if (inner > 3 && nodeafeindex !== -1) { + afe.remove(node); + nodeafeindex = -1; + } - if (cp === $.GREATER_THAN_SIGN) { - this.state = DATA_STATE; - this._emitCurrentToken(); - } + // If node is not in the list of active formatting + // elements, then remove node from the stack of open + // elements and then go back to the step labeled inner + // loop. + if (nodeafeindex === -1) { + stack.removeElement(node); + continue; + } - else { - var publicMatch = this._consumeSubsequentIfMatch($$.PUBLIC_STRING, cp, false), - systemMatch = !publicMatch && this._consumeSubsequentIfMatch($$.SYSTEM_STRING, cp, false); + // Create an element for the token for which the + // element node was created with common ancestor as + // the intended parent, replace the entry for node + // in the list of active formatting elements with an + // entry for the new element, replace the entry for + // node in the stack of open elements with an entry for + // the new element, and let node be the new element. + var newelt = afeclone(ancestor.ownerDocument, nodeafeindex); + afe.replace(node, newelt.elt, newelt.attrs); + stack.elements[nodeindex] = newelt.elt; + node = newelt.elt; + + // If last node is the furthest block, then move the + // aforementioned bookmark to be immediately after the + // new node in the list of active formatting elements. + if (lastnode === furthestblock) { + afe.remove(BOOKMARK); + afe.insertAfter(newelt.elt, BOOKMARK); + } - if (!this._ensureHibernation()) { - if (publicMatch) - this.state = BEFORE_DOCTYPE_PUBLIC_IDENTIFIER_STATE; + // Insert last node into node, first removing it from + // its previous parent node if any. + node._appendChild(lastnode); - else if (systemMatch) - this.state = BEFORE_DOCTYPE_SYSTEM_IDENTIFIER_STATE; + // Let last node be node. + lastnode = node; + } - else { - this.currentToken.forceQuirks = true; - this.state = BOGUS_DOCTYPE_STATE; - } + // If the common ancestor node is a table, tbody, tfoot, + // thead, or tr element, then, foster parent whatever last + // node ended up being in the previous step, first removing + // it from its previous parent node if any. + if (foster_parent_mode && isA(ancestor, tablesectionrowSet)) { + fosterParent(function() { return lastnode; }); + } + // Otherwise, append whatever last node ended up being in + // the previous step to the common ancestor node, first + // removing it from its previous parent node if any. + else if (ancestor instanceof impl.HTMLTemplateElement) { + ancestor.content._appendChild(lastnode); + } else { + ancestor._appendChild(lastnode); } - } -}; + // Create an element for the token for which the + // formatting element was created, with furthest block + // as the intended parent. + var newelt2 = afeclone(furthestblock.ownerDocument, afe.indexOf(fmtelt)); -//12.2.4.57 Before DOCTYPE public identifier state -//------------------------------------------------------------------ -_[BEFORE_DOCTYPE_PUBLIC_IDENTIFIER_STATE] = function beforeDoctypePublicIdentifierState(cp) { - if (isWhitespace(cp)) - return; + // Take all of the child nodes of the furthest block and + // append them to the element created in the last step. + while(furthestblock.hasChildNodes()) { + newelt2.elt._appendChild(furthestblock.firstChild); + } - if (cp === $.QUOTATION_MARK) { - this.currentToken.publicId = ''; - this.state = DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED_STATE; - } + // Append that new element to the furthest block. + furthestblock._appendChild(newelt2.elt); - else if (cp === $.APOSTROPHE) { - this.currentToken.publicId = ''; - this.state = DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED_STATE; - } + // Remove the formatting element from the list of active + // formatting elements, and insert the new element into the + // list of active formatting elements at the position of + // the aforementioned bookmark. + afe.remove(fmtelt); + afe.replace(BOOKMARK, newelt2.elt, newelt2.attrs); - else { - this.currentToken.forceQuirks = true; - this._reconsumeInState(BOGUS_DOCTYPE_STATE); + // Remove the formatting element from the stack of open + // elements, and insert the new element into the stack of + // open elements immediately below the position of the + // furthest block in that stack. + stack.removeElement(fmtelt); + var pos = stack.elements.lastIndexOf(furthestblock); + stack.elements.splice(pos+1, 0, newelt2.elt); + } } -}; + return true; + } -//12.2.4.58 DOCTYPE public identifier (double-quoted) state -//------------------------------------------------------------------ -_[DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED_STATE] = function doctypePublicIdentifierDoubleQuotedState(cp) { - if (cp === $.QUOTATION_MARK) - this.state = BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS_STATE; + // We do this when we get /script in in_text_mode + function handleScriptEnd() { + // XXX: + // This is just a stub implementation right now and doesn't run scripts. + // Getting this method right involves the event loop, URL resolution + // script fetching etc. For now I just want to be able to parse + // documents and test the parser. - else if (cp === $.NULL) - this.currentToken.publicId += UNICODE.REPLACEMENT_CHARACTER; + //var script = stack.top; + stack.pop(); + parser = originalInsertionMode; + //script._prepare(); + return; - else if (cp === $.GREATER_THAN_SIGN) { - this.currentToken.forceQuirks = true; - this._emitCurrentToken(); - this.state = DATA_STATE; - } + // XXX: here is what this method is supposed to do - else if (cp === $.EOF) { - this.currentToken.forceQuirks = true; - this._emitCurrentToken(); - this._reconsumeInState(DATA_STATE); - } + // Provide a stable state. - else - this.currentToken.publicId += toChar(cp); -}; + // Let script be the current node (which will be a script + // element). + // Pop the current node off the stack of open elements. -//12.2.4.59 DOCTYPE public identifier (single-quoted) state -//------------------------------------------------------------------ -_[DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED_STATE] = function doctypePublicIdentifierSingleQuotedState(cp) { - if (cp === $.APOSTROPHE) - this.state = BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS_STATE; + // Switch the insertion mode to the original insertion mode. - else if (cp === $.NULL) - this.currentToken.publicId += UNICODE.REPLACEMENT_CHARACTER; - - else if (cp === $.GREATER_THAN_SIGN) { - this.currentToken.forceQuirks = true; - this._emitCurrentToken(); - this.state = DATA_STATE; - } + // Let the old insertion point have the same value as the current + // insertion point. Let the insertion point be just before the + // next input character. - else if (cp === $.EOF) { - this.currentToken.forceQuirks = true; - this._emitCurrentToken(); - this._reconsumeInState(DATA_STATE); - } + // Increment the parser's script nesting level by one. - else - this.currentToken.publicId += toChar(cp); -}; + // Prepare the script. This might cause some script to execute, + // which might cause new characters to be inserted into the + // tokenizer, and might cause the tokenizer to output more tokens, + // resulting in a reentrant invocation of the parser. + // Decrement the parser's script nesting level by one. If the + // parser's script nesting level is zero, then set the parser + // pause flag to false. -//12.2.4.61 Between DOCTYPE public and system identifiers state -//------------------------------------------------------------------ -_[BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS_STATE] = function betweenDoctypePublicAndSystemIdentifiersState(cp) { - if (isWhitespace(cp)) - return; + // Let the insertion point have the value of the old insertion + // point. (In other words, restore the insertion point to its + // previous value. This value might be the "undefined" value.) - if (cp === $.GREATER_THAN_SIGN) { - this._emitCurrentToken(); - this.state = DATA_STATE; - } + // At this stage, if there is a pending parsing-blocking script, + // then: - else if (cp === $.QUOTATION_MARK) { - this.currentToken.systemId = ''; - this.state = DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED_STATE; - } + // If the script nesting level is not zero: + // Set the parser pause flag to true, and abort the processing + // of any nested invocations of the tokenizer, yielding + // control back to the caller. (Tokenization will resume when + // the caller returns to the "outer" tree construction stage.) - else if (cp === $.APOSTROPHE) { - this.currentToken.systemId = ''; - this.state = DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED_STATE; + // The tree construction stage of this particular parser is + // being called reentrantly, say from a call to + // document.write(). + + // Otherwise: + + // Run these steps: + + // Let the script be the pending parsing-blocking + // script. There is no longer a pending + // parsing-blocking script. + + // Block the tokenizer for this instance of the HTML + // parser, such that the event loop will not run tasks + // that invoke the tokenizer. + + // If the parser's Document has a style sheet that is + // blocking scripts or the script's "ready to be + // parser-executed" flag is not set: spin the event + // loop until the parser's Document has no style sheet + // that is blocking scripts and the script's "ready to + // be parser-executed" flag is set. + + // Unblock the tokenizer for this instance of the HTML + // parser, such that tasks that invoke the tokenizer + // can again be run. + + // Let the insertion point be just before the next + // input character. + + // Increment the parser's script nesting level by one + // (it should be zero before this step, so this sets + // it to one). + + // Execute the script. + + // Decrement the parser's script nesting level by + // one. If the parser's script nesting level is zero + // (which it always should be at this point), then set + // the parser pause flag to false. + + // Let the insertion point be undefined again. + + // If there is once again a pending parsing-blocking + // script, then repeat these steps from step 1. + + + } + + function stopParsing() { + // XXX This is just a temporary implementation to get the parser working. + // A full implementation involves scripts and events and the event loop. + + // Remove the link from document to parser. + // This is instead of "set the insertion point to undefined". + // It means that document.write() can't write into the doc anymore. + delete doc._parser; + + stack.elements.length = 0; // pop everything off + + // If there is a window object associated with the document + // then trigger an load event on it + if (doc.defaultView) { + doc.defaultView.dispatchEvent(new impl.Event("load",{})); + } + + } + + /**** + * Tokenizer states + */ + + /** + * This file was partially mechanically generated from + * http://www.whatwg.org/specs/web-apps/current-work/multipage/tokenization.html + * + * After mechanical conversion, it was further converted from + * prose to JS by hand, but the intent is that it is a very + * faithful rendering of the HTML tokenization spec in + * JavaScript. + * + * It is not a goal of this tokenizer to detect or report + * parse errors. + * + * XXX The tokenizer is supposed to work with straight UTF32 + * codepoints. But I don't think it has any dependencies on + * any character outside of the BMP so I think it is safe to + * pass it UTF16 characters. I don't think it will ever change + * state in the middle of a surrogate pair. + */ + + /* + * Each state is represented by a function. For most states, the + * scanner simply passes the next character (as an integer + * codepoint) to the current state function and automatically + * consumes the character. If the state function can't process + * the character it can call pushback() to push it back to the + * scanner. + * + * Some states require lookahead, though. If a state function has + * a lookahead property, then it is invoked differently. In this + * case, the scanner invokes the function with 3 arguments: 1) the + * next codepoint 2) a string of lookahead text 3) a boolean that + * is true if the lookahead goes all the way to the EOF. (XXX + * actually maybe this third is not necessary... the lookahead + * could just include \uFFFF?) + * + * If the lookahead property of a state function is an integer, it + * specifies the number of characters required. If it is a string, + * then the scanner will scan for that string and return all + * characters up to and including that sequence, or up to EOF. If + * the lookahead property is a regexp, then the scanner will match + * the regexp at the current point and return the matching string. + * + * States that require lookahead are responsible for explicitly + * consuming the characters they process. They do this by + * incrementing nextchar by the number of processed characters. + */ + function reconsume(c, new_state) { + tokenizer = new_state; + nextchar--; // pushback + } + + function data_state(c) { + switch(c) { + case 0x0026: // AMPERSAND + return_state = data_state; + tokenizer = character_reference_state; + break; + case 0x003C: // LESS-THAN SIGN + if (emitSimpleTag()) // Shortcut for , , etc. + break; + tokenizer = tag_open_state; + break; + case 0x0000: // NULL + // Usually null characters emitted by the tokenizer will be + // ignored by the tree builder, but sometimes they'll be + // converted to \uFFFD. I don't want to have the search every + // string emitted to replace NULs, so I'll set a flag + // if I've emitted a NUL. + textrun.push(c); + textIncludesNUL = true; + break; + case -1: // EOF + emitEOF(); + break; + default: + // Instead of just pushing a single character and then + // coming back to the very same place, lookahead and + // emit everything we can at once. + /*jshint -W030 */ + emitCharsWhile(DATATEXT) || textrun.push(c); + break; + } + } + + function rcdata_state(c) { + // Save the open tag so we can find a matching close tag + switch(c) { + case 0x0026: // AMPERSAND + return_state = rcdata_state; + tokenizer = character_reference_state; + break; + case 0x003C: // LESS-THAN SIGN + tokenizer = rcdata_less_than_sign_state; + break; + case 0x0000: // NULL + textrun.push(0xFFFD); // REPLACEMENT CHARACTER + textIncludesNUL = true; + break; + case -1: // EOF + emitEOF(); + break; + default: + textrun.push(c); + break; + } + } + + function rawtext_state(c) { + switch(c) { + case 0x003C: // LESS-THAN SIGN + tokenizer = rawtext_less_than_sign_state; + break; + case 0x0000: // NULL + textrun.push(0xFFFD); // REPLACEMENT CHARACTER + break; + case -1: // EOF + emitEOF(); + break; + default: + /*jshint -W030 */ + emitCharsWhile(RAWTEXT) || textrun.push(c); + break; + } + } + + function script_data_state(c) { + switch(c) { + case 0x003C: // LESS-THAN SIGN + tokenizer = script_data_less_than_sign_state; + break; + case 0x0000: // NULL + textrun.push(0xFFFD); // REPLACEMENT CHARACTER + break; + case -1: // EOF + emitEOF(); + break; + default: + /*jshint -W030 */ + emitCharsWhile(RAWTEXT) || textrun.push(c); + break; + } + } + + function plaintext_state(c) { + switch(c) { + case 0x0000: // NULL + textrun.push(0xFFFD); // REPLACEMENT CHARACTER + break; + case -1: // EOF + emitEOF(); + break; + default: + /*jshint -W030 */ + emitCharsWhile(PLAINTEXT) || textrun.push(c); + break; + } + } + + function tag_open_state(c) { + switch(c) { + case 0x0021: // EXCLAMATION MARK + tokenizer = markup_declaration_open_state; + break; + case 0x002F: // SOLIDUS + tokenizer = end_tag_open_state; + break; + case 0x0041: // [A-Z] + case 0x0042:case 0x0043:case 0x0044:case 0x0045:case 0x0046: + case 0x0047:case 0x0048:case 0x0049:case 0x004A:case 0x004B: + case 0x004C:case 0x004D:case 0x004E:case 0x004F:case 0x0050: + case 0x0051:case 0x0052:case 0x0053:case 0x0054:case 0x0055: + case 0x0056:case 0x0057:case 0x0058:case 0x0059:case 0x005A: + case 0x0061: // [a-z] + case 0x0062:case 0x0063:case 0x0064:case 0x0065:case 0x0066: + case 0x0067:case 0x0068:case 0x0069:case 0x006A:case 0x006B: + case 0x006C:case 0x006D:case 0x006E:case 0x006F:case 0x0070: + case 0x0071:case 0x0072:case 0x0073:case 0x0074:case 0x0075: + case 0x0076:case 0x0077:case 0x0078:case 0x0079:case 0x007A: + beginTagName(); + reconsume(c, tag_name_state); + break; + case 0x003F: // QUESTION MARK + reconsume(c, bogus_comment_state); + break; + default: + textrun.push(0x003C); // LESS-THAN SIGN + reconsume(c, data_state); + break; + } + } + + function end_tag_open_state(c) { + switch(c) { + case 0x0041: // [A-Z] + case 0x0042:case 0x0043:case 0x0044:case 0x0045:case 0x0046: + case 0x0047:case 0x0048:case 0x0049:case 0x004A:case 0x004B: + case 0x004C:case 0x004D:case 0x004E:case 0x004F:case 0x0050: + case 0x0051:case 0x0052:case 0x0053:case 0x0054:case 0x0055: + case 0x0056:case 0x0057:case 0x0058:case 0x0059:case 0x005A: + case 0x0061: // [a-z] + case 0x0062:case 0x0063:case 0x0064:case 0x0065:case 0x0066: + case 0x0067:case 0x0068:case 0x0069:case 0x006A:case 0x006B: + case 0x006C:case 0x006D:case 0x006E:case 0x006F:case 0x0070: + case 0x0071:case 0x0072:case 0x0073:case 0x0074:case 0x0075: + case 0x0076:case 0x0077:case 0x0078:case 0x0079:case 0x007A: + beginEndTagName(); + reconsume(c, tag_name_state); + break; + case 0x003E: // GREATER-THAN SIGN + tokenizer = data_state; + break; + case -1: // EOF + textrun.push(0x003C); // LESS-THAN SIGN + textrun.push(0x002F); // SOLIDUS + emitEOF(); + break; + default: + reconsume(c, bogus_comment_state); + break; + } + } + + function tag_name_state(c) { + switch(c) { + case 0x0009: // CHARACTER TABULATION (tab) + case 0x000A: // LINE FEED (LF) + case 0x000C: // FORM FEED (FF) + case 0x0020: // SPACE + tokenizer = before_attribute_name_state; + break; + case 0x002F: // SOLIDUS + tokenizer = self_closing_start_tag_state; + break; + case 0x003E: // GREATER-THAN SIGN + tokenizer = data_state; + emitTag(); + break; + case 0x0041: // [A-Z] + case 0x0042:case 0x0043:case 0x0044:case 0x0045:case 0x0046: + case 0x0047:case 0x0048:case 0x0049:case 0x004A:case 0x004B: + case 0x004C:case 0x004D:case 0x004E:case 0x004F:case 0x0050: + case 0x0051:case 0x0052:case 0x0053:case 0x0054:case 0x0055: + case 0x0056:case 0x0057:case 0x0058:case 0x0059:case 0x005A: + tagnamebuf += String.fromCharCode(c + 0x0020); + break; + case 0x0000: // NULL + tagnamebuf += String.fromCharCode(0xFFFD /* REPLACEMENT CHARACTER */); + break; + case -1: // EOF + emitEOF(); + break; + default: + tagnamebuf += getMatchingChars(TAGNAME); + break; + } + } + + function rcdata_less_than_sign_state(c) { + /* identical to the RAWTEXT less-than sign state, except s/RAWTEXT/RCDATA/g */ + if (c === 0x002F) { // SOLIDUS + beginTempBuf(); + tokenizer = rcdata_end_tag_open_state; + } + else { + textrun.push(0x003C); // LESS-THAN SIGN + reconsume(c, rcdata_state); + } + } + + function rcdata_end_tag_open_state(c) { + /* identical to the RAWTEXT (and Script data) end tag open state, except s/RAWTEXT/RCDATA/g */ + switch(c) { + case 0x0041: // [A-Z] + case 0x0042:case 0x0043:case 0x0044:case 0x0045:case 0x0046: + case 0x0047:case 0x0048:case 0x0049:case 0x004A:case 0x004B: + case 0x004C:case 0x004D:case 0x004E:case 0x004F:case 0x0050: + case 0x0051:case 0x0052:case 0x0053:case 0x0054:case 0x0055: + case 0x0056:case 0x0057:case 0x0058:case 0x0059:case 0x005A: + case 0x0061: // [a-z] + case 0x0062:case 0x0063:case 0x0064:case 0x0065:case 0x0066: + case 0x0067:case 0x0068:case 0x0069:case 0x006A:case 0x006B: + case 0x006C:case 0x006D:case 0x006E:case 0x006F:case 0x0070: + case 0x0071:case 0x0072:case 0x0073:case 0x0074:case 0x0075: + case 0x0076:case 0x0077:case 0x0078:case 0x0079:case 0x007A: + beginEndTagName(); + reconsume(c, rcdata_end_tag_name_state); + break; + default: + textrun.push(0x003C); // LESS-THAN SIGN + textrun.push(0x002F); // SOLIDUS + reconsume(c, rcdata_state); + break; + } + } + + function rcdata_end_tag_name_state(c) { + /* identical to the RAWTEXT (and Script data) end tag name state, except s/RAWTEXT/RCDATA/g */ + switch(c) { + case 0x0009: // CHARACTER TABULATION (tab) + case 0x000A: // LINE FEED (LF) + case 0x000C: // FORM FEED (FF) + case 0x0020: // SPACE + if (appropriateEndTag(tagnamebuf)) { + tokenizer = before_attribute_name_state; + return; + } + break; + case 0x002F: // SOLIDUS + if (appropriateEndTag(tagnamebuf)) { + tokenizer = self_closing_start_tag_state; + return; + } + break; + case 0x003E: // GREATER-THAN SIGN + if (appropriateEndTag(tagnamebuf)) { + tokenizer = data_state; + emitTag(); + return; + } + break; + case 0x0041: // [A-Z] + case 0x0042:case 0x0043:case 0x0044:case 0x0045:case 0x0046: + case 0x0047:case 0x0048:case 0x0049:case 0x004A:case 0x004B: + case 0x004C:case 0x004D:case 0x004E:case 0x004F:case 0x0050: + case 0x0051:case 0x0052:case 0x0053:case 0x0054:case 0x0055: + case 0x0056:case 0x0057:case 0x0058:case 0x0059:case 0x005A: + + tagnamebuf += String.fromCharCode(c + 0x0020); + tempbuf.push(c); + return; + case 0x0061: // [a-z] + case 0x0062:case 0x0063:case 0x0064:case 0x0065:case 0x0066: + case 0x0067:case 0x0068:case 0x0069:case 0x006A:case 0x006B: + case 0x006C:case 0x006D:case 0x006E:case 0x006F:case 0x0070: + case 0x0071:case 0x0072:case 0x0073:case 0x0074:case 0x0075: + case 0x0076:case 0x0077:case 0x0078:case 0x0079:case 0x007A: + + tagnamebuf += String.fromCharCode(c); + tempbuf.push(c); + return; + default: + break; + } + + // If we don't return in one of the cases above, then this was not + // an appropriately matching close tag, so back out by emitting all + // the characters as text + textrun.push(0x003C); // LESS-THAN SIGN + textrun.push(0x002F); // SOLIDUS + pushAll(textrun, tempbuf); + reconsume(c, rcdata_state); + } + + function rawtext_less_than_sign_state(c) { + /* identical to the RCDATA less-than sign state, except s/RCDATA/RAWTEXT/g + */ + if (c === 0x002F) { // SOLIDUS + beginTempBuf(); + tokenizer = rawtext_end_tag_open_state; + } + else { + textrun.push(0x003C); // LESS-THAN SIGN + reconsume(c, rawtext_state); + } + } + + function rawtext_end_tag_open_state(c) { + /* identical to the RCDATA (and Script data) end tag open state, except s/RCDATA/RAWTEXT/g */ + switch(c) { + case 0x0041: // [A-Z] + case 0x0042:case 0x0043:case 0x0044:case 0x0045:case 0x0046: + case 0x0047:case 0x0048:case 0x0049:case 0x004A:case 0x004B: + case 0x004C:case 0x004D:case 0x004E:case 0x004F:case 0x0050: + case 0x0051:case 0x0052:case 0x0053:case 0x0054:case 0x0055: + case 0x0056:case 0x0057:case 0x0058:case 0x0059:case 0x005A: + case 0x0061: // [a-z] + case 0x0062:case 0x0063:case 0x0064:case 0x0065:case 0x0066: + case 0x0067:case 0x0068:case 0x0069:case 0x006A:case 0x006B: + case 0x006C:case 0x006D:case 0x006E:case 0x006F:case 0x0070: + case 0x0071:case 0x0072:case 0x0073:case 0x0074:case 0x0075: + case 0x0076:case 0x0077:case 0x0078:case 0x0079:case 0x007A: + beginEndTagName(); + reconsume(c, rawtext_end_tag_name_state); + break; + default: + textrun.push(0x003C); // LESS-THAN SIGN + textrun.push(0x002F); // SOLIDUS + reconsume(c, rawtext_state); + break; + } + } + + function rawtext_end_tag_name_state(c) { + /* identical to the RCDATA (and Script data) end tag name state, except s/RCDATA/RAWTEXT/g */ + switch(c) { + case 0x0009: // CHARACTER TABULATION (tab) + case 0x000A: // LINE FEED (LF) + case 0x000C: // FORM FEED (FF) + case 0x0020: // SPACE + if (appropriateEndTag(tagnamebuf)) { + tokenizer = before_attribute_name_state; + return; + } + break; + case 0x002F: // SOLIDUS + if (appropriateEndTag(tagnamebuf)) { + tokenizer = self_closing_start_tag_state; + return; + } + break; + case 0x003E: // GREATER-THAN SIGN + if (appropriateEndTag(tagnamebuf)) { + tokenizer = data_state; + emitTag(); + return; + } + break; + case 0x0041: // [A-Z] + case 0x0042:case 0x0043:case 0x0044:case 0x0045:case 0x0046: + case 0x0047:case 0x0048:case 0x0049:case 0x004A:case 0x004B: + case 0x004C:case 0x004D:case 0x004E:case 0x004F:case 0x0050: + case 0x0051:case 0x0052:case 0x0053:case 0x0054:case 0x0055: + case 0x0056:case 0x0057:case 0x0058:case 0x0059:case 0x005A: + tagnamebuf += String.fromCharCode(c + 0x0020); + tempbuf.push(c); + return; + case 0x0061: // [a-z] + case 0x0062:case 0x0063:case 0x0064:case 0x0065:case 0x0066: + case 0x0067:case 0x0068:case 0x0069:case 0x006A:case 0x006B: + case 0x006C:case 0x006D:case 0x006E:case 0x006F:case 0x0070: + case 0x0071:case 0x0072:case 0x0073:case 0x0074:case 0x0075: + case 0x0076:case 0x0077:case 0x0078:case 0x0079:case 0x007A: + tagnamebuf += String.fromCharCode(c); + tempbuf.push(c); + return; + default: + break; + } + + // If we don't return in one of the cases above, then this was not + // an appropriately matching close tag, so back out by emitting all + // the characters as text + textrun.push(0x003C); // LESS-THAN SIGN + textrun.push(0x002F); // SOLIDUS + pushAll(textrun,tempbuf); + reconsume(c, rawtext_state); + } + + function script_data_less_than_sign_state(c) { + switch(c) { + case 0x002F: // SOLIDUS + beginTempBuf(); + tokenizer = script_data_end_tag_open_state; + break; + case 0x0021: // EXCLAMATION MARK + tokenizer = script_data_escape_start_state; + textrun.push(0x003C); // LESS-THAN SIGN + textrun.push(0x0021); // EXCLAMATION MARK + break; + default: + textrun.push(0x003C); // LESS-THAN SIGN + reconsume(c, script_data_state); + break; + } + } + + function script_data_end_tag_open_state(c) { + /* identical to the RCDATA (and RAWTEXT) end tag open state, except s/RCDATA/Script data/g */ + switch(c) { + case 0x0041: // [A-Z] + case 0x0042:case 0x0043:case 0x0044:case 0x0045:case 0x0046: + case 0x0047:case 0x0048:case 0x0049:case 0x004A:case 0x004B: + case 0x004C:case 0x004D:case 0x004E:case 0x004F:case 0x0050: + case 0x0051:case 0x0052:case 0x0053:case 0x0054:case 0x0055: + case 0x0056:case 0x0057:case 0x0058:case 0x0059:case 0x005A: + case 0x0061: // [a-z] + case 0x0062:case 0x0063:case 0x0064:case 0x0065:case 0x0066: + case 0x0067:case 0x0068:case 0x0069:case 0x006A:case 0x006B: + case 0x006C:case 0x006D:case 0x006E:case 0x006F:case 0x0070: + case 0x0071:case 0x0072:case 0x0073:case 0x0074:case 0x0075: + case 0x0076:case 0x0077:case 0x0078:case 0x0079:case 0x007A: + beginEndTagName(); + reconsume(c, script_data_end_tag_name_state); + break; + default: + textrun.push(0x003C); // LESS-THAN SIGN + textrun.push(0x002F); // SOLIDUS + reconsume(c, script_data_state); + break; + } + } + + function script_data_end_tag_name_state(c) { + /* identical to the RCDATA (and RAWTEXT) end tag name state, except s/RCDATA/Script data/g */ + switch(c) { + case 0x0009: // CHARACTER TABULATION (tab) + case 0x000A: // LINE FEED (LF) + case 0x000C: // FORM FEED (FF) + case 0x0020: // SPACE + if (appropriateEndTag(tagnamebuf)) { + tokenizer = before_attribute_name_state; + return; + } + break; + case 0x002F: // SOLIDUS + if (appropriateEndTag(tagnamebuf)) { + tokenizer = self_closing_start_tag_state; + return; + } + break; + case 0x003E: // GREATER-THAN SIGN + if (appropriateEndTag(tagnamebuf)) { + tokenizer = data_state; + emitTag(); + return; + } + break; + case 0x0041: // [A-Z] + case 0x0042:case 0x0043:case 0x0044:case 0x0045:case 0x0046: + case 0x0047:case 0x0048:case 0x0049:case 0x004A:case 0x004B: + case 0x004C:case 0x004D:case 0x004E:case 0x004F:case 0x0050: + case 0x0051:case 0x0052:case 0x0053:case 0x0054:case 0x0055: + case 0x0056:case 0x0057:case 0x0058:case 0x0059:case 0x005A: + + tagnamebuf += String.fromCharCode(c + 0x0020); + tempbuf.push(c); + return; + case 0x0061: // [a-z] + case 0x0062:case 0x0063:case 0x0064:case 0x0065:case 0x0066: + case 0x0067:case 0x0068:case 0x0069:case 0x006A:case 0x006B: + case 0x006C:case 0x006D:case 0x006E:case 0x006F:case 0x0070: + case 0x0071:case 0x0072:case 0x0073:case 0x0074:case 0x0075: + case 0x0076:case 0x0077:case 0x0078:case 0x0079:case 0x007A: + + tagnamebuf += String.fromCharCode(c); + tempbuf.push(c); + return; + default: + break; + } + + // If we don't return in one of the cases above, then this was not + // an appropriately matching close tag, so back out by emitting all + // the characters as text + textrun.push(0x003C); // LESS-THAN SIGN + textrun.push(0x002F); // SOLIDUS + pushAll(textrun,tempbuf); + reconsume(c, script_data_state); + } + + function script_data_escape_start_state(c) { + if (c === 0x002D) { // HYPHEN-MINUS + tokenizer = script_data_escape_start_dash_state; + textrun.push(0x002D); // HYPHEN-MINUS } + else { + reconsume(c, script_data_state); + } + } + function script_data_escape_start_dash_state(c) { + if (c === 0x002D) { // HYPHEN-MINUS + tokenizer = script_data_escaped_dash_dash_state; + textrun.push(0x002D); // HYPHEN-MINUS + } + else { + reconsume(c, script_data_state); + } + } + + function script_data_escaped_state(c) { + switch(c) { + case 0x002D: // HYPHEN-MINUS + tokenizer = script_data_escaped_dash_state; + textrun.push(0x002D); // HYPHEN-MINUS + break; + case 0x003C: // LESS-THAN SIGN + tokenizer = script_data_escaped_less_than_sign_state; + break; + case 0x0000: // NULL + textrun.push(0xFFFD); // REPLACEMENT CHARACTER + break; + case -1: // EOF + emitEOF(); + break; + default: + textrun.push(c); + break; + } + } + + function script_data_escaped_dash_state(c) { + switch(c) { + case 0x002D: // HYPHEN-MINUS + tokenizer = script_data_escaped_dash_dash_state; + textrun.push(0x002D); // HYPHEN-MINUS + break; + case 0x003C: // LESS-THAN SIGN + tokenizer = script_data_escaped_less_than_sign_state; + break; + case 0x0000: // NULL + tokenizer = script_data_escaped_state; + textrun.push(0xFFFD); // REPLACEMENT CHARACTER + break; + case -1: // EOF + emitEOF(); + break; + default: + tokenizer = script_data_escaped_state; + textrun.push(c); + break; + } + } + + function script_data_escaped_dash_dash_state(c) { + switch(c) { + case 0x002D: // HYPHEN-MINUS + textrun.push(0x002D); // HYPHEN-MINUS + break; + case 0x003C: // LESS-THAN SIGN + tokenizer = script_data_escaped_less_than_sign_state; + break; + case 0x003E: // GREATER-THAN SIGN + tokenizer = script_data_state; + textrun.push(0x003E); // GREATER-THAN SIGN + break; + case 0x0000: // NULL + tokenizer = script_data_escaped_state; + textrun.push(0xFFFD); // REPLACEMENT CHARACTER + break; + case -1: // EOF + emitEOF(); + break; + default: + tokenizer = script_data_escaped_state; + textrun.push(c); + break; + } + } + + function script_data_escaped_less_than_sign_state(c) { + switch(c) { + case 0x002F: // SOLIDUS + beginTempBuf(); + tokenizer = script_data_escaped_end_tag_open_state; + break; + case 0x0041: // [A-Z] + case 0x0042:case 0x0043:case 0x0044:case 0x0045:case 0x0046: + case 0x0047:case 0x0048:case 0x0049:case 0x004A:case 0x004B: + case 0x004C:case 0x004D:case 0x004E:case 0x004F:case 0x0050: + case 0x0051:case 0x0052:case 0x0053:case 0x0054:case 0x0055: + case 0x0056:case 0x0057:case 0x0058:case 0x0059:case 0x005A: + case 0x0061: // [a-z] + case 0x0062:case 0x0063:case 0x0064:case 0x0065:case 0x0066: + case 0x0067:case 0x0068:case 0x0069:case 0x006A:case 0x006B: + case 0x006C:case 0x006D:case 0x006E:case 0x006F:case 0x0070: + case 0x0071:case 0x0072:case 0x0073:case 0x0074:case 0x0075: + case 0x0076:case 0x0077:case 0x0078:case 0x0079:case 0x007A: + beginTempBuf(); + textrun.push(0x003C); // LESS-THAN SIGN + reconsume(c, script_data_double_escape_start_state); + break; + default: + textrun.push(0x003C); // LESS-THAN SIGN + reconsume(c, script_data_escaped_state); + break; + } + } + + function script_data_escaped_end_tag_open_state(c) { + switch(c) { + case 0x0041: // [A-Z] + case 0x0042:case 0x0043:case 0x0044:case 0x0045:case 0x0046: + case 0x0047:case 0x0048:case 0x0049:case 0x004A:case 0x004B: + case 0x004C:case 0x004D:case 0x004E:case 0x004F:case 0x0050: + case 0x0051:case 0x0052:case 0x0053:case 0x0054:case 0x0055: + case 0x0056:case 0x0057:case 0x0058:case 0x0059:case 0x005A: + case 0x0061: // [a-z] + case 0x0062:case 0x0063:case 0x0064:case 0x0065:case 0x0066: + case 0x0067:case 0x0068:case 0x0069:case 0x006A:case 0x006B: + case 0x006C:case 0x006D:case 0x006E:case 0x006F:case 0x0070: + case 0x0071:case 0x0072:case 0x0073:case 0x0074:case 0x0075: + case 0x0076:case 0x0077:case 0x0078:case 0x0079:case 0x007A: + beginEndTagName(); + reconsume(c, script_data_escaped_end_tag_name_state); + break; + default: + textrun.push(0x003C); // LESS-THAN SIGN + textrun.push(0x002F); // SOLIDUS + reconsume(c, script_data_escaped_state); + break; + } + } + + function script_data_escaped_end_tag_name_state(c) { + switch(c) { + case 0x0009: // CHARACTER TABULATION (tab) + case 0x000A: // LINE FEED (LF) + case 0x000C: // FORM FEED (FF) + case 0x0020: // SPACE + if (appropriateEndTag(tagnamebuf)) { + tokenizer = before_attribute_name_state; + return; + } + break; + case 0x002F: // SOLIDUS + if (appropriateEndTag(tagnamebuf)) { + tokenizer = self_closing_start_tag_state; + return; + } + break; + case 0x003E: // GREATER-THAN SIGN + if (appropriateEndTag(tagnamebuf)) { + tokenizer = data_state; + emitTag(); + return; + } + break; + case 0x0041: // [A-Z] + case 0x0042:case 0x0043:case 0x0044:case 0x0045:case 0x0046: + case 0x0047:case 0x0048:case 0x0049:case 0x004A:case 0x004B: + case 0x004C:case 0x004D:case 0x004E:case 0x004F:case 0x0050: + case 0x0051:case 0x0052:case 0x0053:case 0x0054:case 0x0055: + case 0x0056:case 0x0057:case 0x0058:case 0x0059:case 0x005A: + tagnamebuf += String.fromCharCode(c + 0x0020); + tempbuf.push(c); + return; + case 0x0061: // [a-z] + case 0x0062:case 0x0063:case 0x0064:case 0x0065:case 0x0066: + case 0x0067:case 0x0068:case 0x0069:case 0x006A:case 0x006B: + case 0x006C:case 0x006D:case 0x006E:case 0x006F:case 0x0070: + case 0x0071:case 0x0072:case 0x0073:case 0x0074:case 0x0075: + case 0x0076:case 0x0077:case 0x0078:case 0x0079:case 0x007A: + tagnamebuf += String.fromCharCode(c); + tempbuf.push(c); + return; + default: + break; + } + + // We get here in the default case, and if the closing tagname + // is not an appropriate tagname. + textrun.push(0x003C); // LESS-THAN SIGN + textrun.push(0x002F); // SOLIDUS + pushAll(textrun,tempbuf); + reconsume(c, script_data_escaped_state); + } + + function script_data_double_escape_start_state(c) { + switch(c) { + case 0x0009: // CHARACTER TABULATION (tab) + case 0x000A: // LINE FEED (LF) + case 0x000C: // FORM FEED (FF) + case 0x0020: // SPACE + case 0x002F: // SOLIDUS + case 0x003E: // GREATER-THAN SIGN + if (buf2str(tempbuf) === "script") { + tokenizer = script_data_double_escaped_state; + } + else { + tokenizer = script_data_escaped_state; + } + textrun.push(c); + break; + case 0x0041: // [A-Z] + case 0x0042:case 0x0043:case 0x0044:case 0x0045:case 0x0046: + case 0x0047:case 0x0048:case 0x0049:case 0x004A:case 0x004B: + case 0x004C:case 0x004D:case 0x004E:case 0x004F:case 0x0050: + case 0x0051:case 0x0052:case 0x0053:case 0x0054:case 0x0055: + case 0x0056:case 0x0057:case 0x0058:case 0x0059:case 0x005A: + tempbuf.push(c + 0x0020); + textrun.push(c); + break; + case 0x0061: // [a-z] + case 0x0062:case 0x0063:case 0x0064:case 0x0065:case 0x0066: + case 0x0067:case 0x0068:case 0x0069:case 0x006A:case 0x006B: + case 0x006C:case 0x006D:case 0x006E:case 0x006F:case 0x0070: + case 0x0071:case 0x0072:case 0x0073:case 0x0074:case 0x0075: + case 0x0076:case 0x0077:case 0x0078:case 0x0079:case 0x007A: + tempbuf.push(c); + textrun.push(c); + break; + default: + reconsume(c, script_data_escaped_state); + break; + } + } + + function script_data_double_escaped_state(c) { + switch(c) { + case 0x002D: // HYPHEN-MINUS + tokenizer = script_data_double_escaped_dash_state; + textrun.push(0x002D); // HYPHEN-MINUS + break; + case 0x003C: // LESS-THAN SIGN + tokenizer = script_data_double_escaped_less_than_sign_state; + textrun.push(0x003C); // LESS-THAN SIGN + break; + case 0x0000: // NULL + textrun.push(0xFFFD); // REPLACEMENT CHARACTER + break; + case -1: // EOF + emitEOF(); + break; + default: + textrun.push(c); + break; + } + } + + function script_data_double_escaped_dash_state(c) { + switch(c) { + case 0x002D: // HYPHEN-MINUS + tokenizer = script_data_double_escaped_dash_dash_state; + textrun.push(0x002D); // HYPHEN-MINUS + break; + case 0x003C: // LESS-THAN SIGN + tokenizer = script_data_double_escaped_less_than_sign_state; + textrun.push(0x003C); // LESS-THAN SIGN + break; + case 0x0000: // NULL + tokenizer = script_data_double_escaped_state; + textrun.push(0xFFFD); // REPLACEMENT CHARACTER + break; + case -1: // EOF + emitEOF(); + break; + default: + tokenizer = script_data_double_escaped_state; + textrun.push(c); + break; + } + } + + function script_data_double_escaped_dash_dash_state(c) { + switch(c) { + case 0x002D: // HYPHEN-MINUS + textrun.push(0x002D); // HYPHEN-MINUS + break; + case 0x003C: // LESS-THAN SIGN + tokenizer = script_data_double_escaped_less_than_sign_state; + textrun.push(0x003C); // LESS-THAN SIGN + break; + case 0x003E: // GREATER-THAN SIGN + tokenizer = script_data_state; + textrun.push(0x003E); // GREATER-THAN SIGN + break; + case 0x0000: // NULL + tokenizer = script_data_double_escaped_state; + textrun.push(0xFFFD); // REPLACEMENT CHARACTER + break; + case -1: // EOF + emitEOF(); + break; + default: + tokenizer = script_data_double_escaped_state; + textrun.push(c); + break; + } + } + + function script_data_double_escaped_less_than_sign_state(c) { + if (c === 0x002F) { // SOLIDUS + beginTempBuf(); + tokenizer = script_data_double_escape_end_state; + textrun.push(0x002F); // SOLIDUS + } else { - this.currentToken.forceQuirks = true; - this._reconsumeInState(BOGUS_DOCTYPE_STATE); + reconsume(c, script_data_double_escaped_state); + } + } + + function script_data_double_escape_end_state(c) { + switch(c) { + case 0x0009: // CHARACTER TABULATION (tab) + case 0x000A: // LINE FEED (LF) + case 0x000C: // FORM FEED (FF) + case 0x0020: // SPACE + case 0x002F: // SOLIDUS + case 0x003E: // GREATER-THAN SIGN + if (buf2str(tempbuf) === "script") { + tokenizer = script_data_escaped_state; + } + else { + tokenizer = script_data_double_escaped_state; + } + textrun.push(c); + break; + case 0x0041: // [A-Z] + case 0x0042:case 0x0043:case 0x0044:case 0x0045:case 0x0046: + case 0x0047:case 0x0048:case 0x0049:case 0x004A:case 0x004B: + case 0x004C:case 0x004D:case 0x004E:case 0x004F:case 0x0050: + case 0x0051:case 0x0052:case 0x0053:case 0x0054:case 0x0055: + case 0x0056:case 0x0057:case 0x0058:case 0x0059:case 0x005A: + tempbuf.push(c + 0x0020); + textrun.push(c); + break; + case 0x0061: // [a-z] + case 0x0062:case 0x0063:case 0x0064:case 0x0065:case 0x0066: + case 0x0067:case 0x0068:case 0x0069:case 0x006A:case 0x006B: + case 0x006C:case 0x006D:case 0x006E:case 0x006F:case 0x0070: + case 0x0071:case 0x0072:case 0x0073:case 0x0074:case 0x0075: + case 0x0076:case 0x0077:case 0x0078:case 0x0079:case 0x007A: + tempbuf.push(c); + textrun.push(c); + break; + default: + reconsume(c, script_data_double_escaped_state); + break; + } + } + + function before_attribute_name_state(c) { + switch(c) { + case 0x0009: // CHARACTER TABULATION (tab) + case 0x000A: // LINE FEED (LF) + case 0x000C: // FORM FEED (FF) + case 0x0020: // SPACE + /* Ignore the character. */ + break; + // For SOLIDUS, GREATER-THAN SIGN, and EOF, spec says "reconsume in + // the after attribute name state", but in our implementation that + // state always has an active attribute in attrnamebuf. Just clone + // the rules here, without the addAttribute business. + case 0x002F: // SOLIDUS + tokenizer = self_closing_start_tag_state; + break; + case 0x003E: // GREATER-THAN SIGN + tokenizer = data_state; + emitTag(); + break; + case -1: // EOF + emitEOF(); + break; + case 0x003D: // EQUALS SIGN + beginAttrName(); + attrnamebuf += String.fromCharCode(c); + tokenizer = attribute_name_state; + break; + default: + if (handleSimpleAttribute()) break; + beginAttrName(); + reconsume(c, attribute_name_state); + break; + } + } + + // beginAttrName() must have been called before this point + // There is an active attribute in attrnamebuf (but not attrvaluebuf) + function attribute_name_state(c) { + switch(c) { + case 0x0009: // CHARACTER TABULATION (tab) + case 0x000A: // LINE FEED (LF) + case 0x000C: // FORM FEED (FF) + case 0x0020: // SPACE + case 0x002F: // SOLIDUS + case 0x003E: // GREATER-THAN SIGN + case -1: // EOF + reconsume(c, after_attribute_name_state); + break; + case 0x003D: // EQUALS SIGN + tokenizer = before_attribute_value_state; + break; + case 0x0041: // [A-Z] + case 0x0042:case 0x0043:case 0x0044:case 0x0045:case 0x0046: + case 0x0047:case 0x0048:case 0x0049:case 0x004A:case 0x004B: + case 0x004C:case 0x004D:case 0x004E:case 0x004F:case 0x0050: + case 0x0051:case 0x0052:case 0x0053:case 0x0054:case 0x0055: + case 0x0056:case 0x0057:case 0x0058:case 0x0059:case 0x005A: + attrnamebuf += String.fromCharCode(c + 0x0020); + break; + case 0x0000: // NULL + attrnamebuf += String.fromCharCode(0xFFFD /* REPLACEMENT CHARACTER */); + break; + case 0x0022: // QUOTATION MARK + case 0x0027: // APOSTROPHE + case 0x003C: // LESS-THAN SIGN + /* falls through */ + default: + attrnamebuf += getMatchingChars(ATTRNAME); + break; + } + } + + // There is an active attribute in attrnamebuf, but not yet in attrvaluebuf. + function after_attribute_name_state(c) { + switch(c) { + case 0x0009: // CHARACTER TABULATION (tab) + case 0x000A: // LINE FEED (LF) + case 0x000C: // FORM FEED (FF) + case 0x0020: // SPACE + /* Ignore the character. */ + break; + case 0x002F: // SOLIDUS + // Keep in sync with before_attribute_name_state. + addAttribute(attrnamebuf); + tokenizer = self_closing_start_tag_state; + break; + case 0x003D: // EQUALS SIGN + tokenizer = before_attribute_value_state; + break; + case 0x003E: // GREATER-THAN SIGN + // Keep in sync with before_attribute_name_state. + tokenizer = data_state; + addAttribute(attrnamebuf); + emitTag(); + break; + case -1: // EOF + // Keep in sync with before_attribute_name_state. + addAttribute(attrnamebuf); + emitEOF(); + break; + default: + addAttribute(attrnamebuf); + beginAttrName(); + reconsume(c, attribute_name_state); + break; + } + } + + function before_attribute_value_state(c) { + switch(c) { + case 0x0009: // CHARACTER TABULATION (tab) + case 0x000A: // LINE FEED (LF) + case 0x000C: // FORM FEED (FF) + case 0x0020: // SPACE + /* Ignore the character. */ + break; + case 0x0022: // QUOTATION MARK + beginAttrValue(); + tokenizer = attribute_value_double_quoted_state; + break; + case 0x0027: // APOSTROPHE + beginAttrValue(); + tokenizer = attribute_value_single_quoted_state; + break; + case 0x003E: // GREATER-THAN SIGN + /* falls through */ + default: + beginAttrValue(); + reconsume(c, attribute_value_unquoted_state); + break; + } + } + + function attribute_value_double_quoted_state(c) { + switch(c) { + case 0x0022: // QUOTATION MARK + addAttribute(attrnamebuf, attrvaluebuf); + tokenizer = after_attribute_value_quoted_state; + break; + case 0x0026: // AMPERSAND + return_state = attribute_value_double_quoted_state; + tokenizer = character_reference_state; + break; + case 0x0000: // NULL + attrvaluebuf += String.fromCharCode(0xFFFD /* REPLACEMENT CHARACTER */); + break; + case -1: // EOF + emitEOF(); + break; + case 0x000A: // LF + // this could be a converted \r, so don't use getMatchingChars + attrvaluebuf += String.fromCharCode(c); + break; + default: + attrvaluebuf += getMatchingChars(DBLQUOTEATTRVAL); + break; + } + } + + function attribute_value_single_quoted_state(c) { + switch(c) { + case 0x0027: // APOSTROPHE + addAttribute(attrnamebuf, attrvaluebuf); + tokenizer = after_attribute_value_quoted_state; + break; + case 0x0026: // AMPERSAND + return_state = attribute_value_single_quoted_state; + tokenizer = character_reference_state; + break; + case 0x0000: // NULL + attrvaluebuf += String.fromCharCode(0xFFFD /* REPLACEMENT CHARACTER */); + break; + case -1: // EOF + emitEOF(); + break; + case 0x000A: // LF + // this could be a converted \r, so don't use getMatchingChars + attrvaluebuf += String.fromCharCode(c); + break; + default: + attrvaluebuf += getMatchingChars(SINGLEQUOTEATTRVAL); + break; + } + } + + function attribute_value_unquoted_state(c) { + switch(c) { + case 0x0009: // CHARACTER TABULATION (tab) + case 0x000A: // LINE FEED (LF) + case 0x000C: // FORM FEED (FF) + case 0x0020: // SPACE + addAttribute(attrnamebuf, attrvaluebuf); + tokenizer = before_attribute_name_state; + break; + case 0x0026: // AMPERSAND + return_state = attribute_value_unquoted_state; + tokenizer = character_reference_state; + break; + case 0x003E: // GREATER-THAN SIGN + addAttribute(attrnamebuf, attrvaluebuf); + tokenizer = data_state; + emitTag(); + break; + case 0x0000: // NULL + attrvaluebuf += String.fromCharCode(0xFFFD /* REPLACEMENT CHARACTER */); + break; + case -1: // EOF + nextchar--; // pushback + tokenizer = data_state; + break; + case 0x0022: // QUOTATION MARK + case 0x0027: // APOSTROPHE + case 0x003C: // LESS-THAN SIGN + case 0x003D: // EQUALS SIGN + case 0x0060: // GRAVE ACCENT + /* falls through */ + default: + attrvaluebuf += getMatchingChars(UNQUOTEDATTRVAL); + break; + } + } + + function after_attribute_value_quoted_state(c) { + switch(c) { + case 0x0009: // CHARACTER TABULATION (tab) + case 0x000A: // LINE FEED (LF) + case 0x000C: // FORM FEED (FF) + case 0x0020: // SPACE + tokenizer = before_attribute_name_state; + break; + case 0x002F: // SOLIDUS + tokenizer = self_closing_start_tag_state; + break; + case 0x003E: // GREATER-THAN SIGN + tokenizer = data_state; + emitTag(); + break; + case -1: // EOF + emitEOF(); + break; + default: + reconsume(c, before_attribute_name_state); + break; + } + } + + function self_closing_start_tag_state(c) { + switch(c) { + case 0x003E: // GREATER-THAN SIGN + // Set the self-closing flag of the current tag token. + tokenizer = data_state; + emitSelfClosingTag(true); + break; + case -1: // EOF + emitEOF(); + break; + default: + reconsume(c, before_attribute_name_state); + break; + } + } + + function bogus_comment_state(c, lookahead, eof) { + var len = lookahead.length; + + if (eof) { + nextchar += len-1; // don't consume the eof + } + else { + nextchar += len; } -}; + var comment = lookahead.substring(0, len-1); -//12.2.4.63 Before DOCTYPE system identifier state -//------------------------------------------------------------------ -_[BEFORE_DOCTYPE_SYSTEM_IDENTIFIER_STATE] = function beforeDoctypeSystemIdentifierState(cp) { - if (isWhitespace(cp)) - return; + comment = comment.replace(/\u0000/g,"\uFFFD"); + comment = comment.replace(/\u000D\u000A/g,"\u000A"); + comment = comment.replace(/\u000D/g,"\u000A"); - if (cp === $.QUOTATION_MARK) { - this.currentToken.systemId = ''; - this.state = DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED_STATE; - } + insertToken(COMMENT, comment); + tokenizer = data_state; + } + bogus_comment_state.lookahead = ">"; - else if (cp === $.APOSTROPHE) { - this.currentToken.systemId = ''; - this.state = DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED_STATE; + function markup_declaration_open_state(c, lookahead, eof) { + if (lookahead[0] === "-" && lookahead[1] === "-") { + nextchar += 2; + beginComment(); + tokenizer = comment_start_state; + return; } + if (lookahead.toUpperCase() === "DOCTYPE") { + nextchar += 7; + tokenizer = doctype_state; + } + else if (lookahead === "[CDATA[" && cdataAllowed()) { + nextchar += 7; + tokenizer = cdata_section_state; + } else { - this.currentToken.forceQuirks = true; - this._reconsumeInState(BOGUS_DOCTYPE_STATE); + tokenizer = bogus_comment_state; + } + } + markup_declaration_open_state.lookahead = 7; + + function comment_start_state(c) { + beginComment(); + switch(c) { + case 0x002D: // HYPHEN-MINUS + tokenizer = comment_start_dash_state; + break; + case 0x003E: // GREATER-THAN SIGN + tokenizer = data_state; + insertToken(COMMENT, buf2str(commentbuf)); + break; /* see comment in comment end state */ + default: + reconsume(c, comment_state); + break; + } + } + + function comment_start_dash_state(c) { + switch(c) { + case 0x002D: // HYPHEN-MINUS + tokenizer = comment_end_state; + break; + case 0x003E: // GREATER-THAN SIGN + tokenizer = data_state; + insertToken(COMMENT, buf2str(commentbuf)); + break; + case -1: // EOF + insertToken(COMMENT, buf2str(commentbuf)); + emitEOF(); + break; /* see comment in comment end state */ + default: + commentbuf.push(0x002D /* HYPHEN-MINUS */); + reconsume(c, comment_state); + break; + } + } + + function comment_state(c) { + switch(c) { + case 0x003C: // LESS-THAN SIGN + commentbuf.push(c); + tokenizer = comment_less_than_sign_state; + break; + case 0x002D: // HYPHEN-MINUS + tokenizer = comment_end_dash_state; + break; + case 0x0000: // NULL + commentbuf.push(0xFFFD /* REPLACEMENT CHARACTER */); + break; + case -1: // EOF + insertToken(COMMENT, buf2str(commentbuf)); + emitEOF(); + break; /* see comment in comment end state */ + default: + commentbuf.push(c); + break; + } + } + + function comment_less_than_sign_state(c) { + switch(c) { + case 0x0021: // EXCLAMATION MARK + commentbuf.push(c); + tokenizer = comment_less_than_sign_bang_state; + break; + case 0x003C: // LESS-THAN SIGN + commentbuf.push(c); + break; + default: + reconsume(c, comment_state); + break; + } + } + + function comment_less_than_sign_bang_state(c) { + switch(c) { + case 0x002D: // HYPHEN-MINUS + tokenizer = comment_less_than_sign_bang_dash_state; + break; + default: + reconsume(c, comment_state); + break; + } + } + + function comment_less_than_sign_bang_dash_state(c) { + switch(c) { + case 0x002D: // HYPHEN-MINUS + tokenizer = comment_less_than_sign_bang_dash_dash_state; + break; + default: + reconsume(c, comment_end_dash_state); + break; + } + } + + function comment_less_than_sign_bang_dash_dash_state(c) { + switch(c) { + case 0x003E: // GREATER-THAN SIGN + case -1: // EOF + reconsume(c, comment_end_state); + break; + default: + // parse error + reconsume(c, comment_end_state); + break; + } + } + + function comment_end_dash_state(c) { + switch(c) { + case 0x002D: // HYPHEN-MINUS + tokenizer = comment_end_state; + break; + case -1: // EOF + insertToken(COMMENT, buf2str(commentbuf)); + emitEOF(); + break; /* see comment in comment end state */ + default: + commentbuf.push(0x002D /* HYPHEN-MINUS */); + reconsume(c, comment_state); + break; + } + } + + function comment_end_state(c) { + switch(c) { + case 0x003E: // GREATER-THAN SIGN + tokenizer = data_state; + insertToken(COMMENT, buf2str(commentbuf)); + break; + case 0x0021: // EXCLAMATION MARK + tokenizer = comment_end_bang_state; + break; + case 0x002D: // HYPHEN-MINUS + commentbuf.push(0x002D); + break; + case -1: // EOF + insertToken(COMMENT, buf2str(commentbuf)); + emitEOF(); + break; /* For security reasons: otherwise, hostile user could put a script in a comment e.g. in a blog comment and then DOS the server so that the end tag isn't read, and then the commented script tag would be treated as live code */ + default: + commentbuf.push(0x002D); + commentbuf.push(0x002D); + reconsume(c, comment_state); + break; + } + } + + function comment_end_bang_state(c) { + switch(c) { + case 0x002D: // HYPHEN-MINUS + commentbuf.push(0x002D); + commentbuf.push(0x002D); + commentbuf.push(0x0021); + tokenizer = comment_end_dash_state; + break; + case 0x003E: // GREATER-THAN SIGN + tokenizer = data_state; + insertToken(COMMENT, buf2str(commentbuf)); + break; + case -1: // EOF + insertToken(COMMENT, buf2str(commentbuf)); + emitEOF(); + break; /* see comment in comment end state */ + default: + commentbuf.push(0x002D); + commentbuf.push(0x002D); + commentbuf.push(0x0021); + reconsume(c, comment_state); + break; + } + } + + function doctype_state(c) { + switch(c) { + case 0x0009: // CHARACTER TABULATION (tab) + case 0x000A: // LINE FEED (LF) + case 0x000C: // FORM FEED (FF) + case 0x0020: // SPACE + tokenizer = before_doctype_name_state; + break; + case -1: // EOF + beginDoctype(); + forcequirks(); + emitDoctype(); + emitEOF(); + break; + default: + reconsume(c, before_doctype_name_state); + break; + } + } + + function before_doctype_name_state(c) { + switch(c) { + case 0x0009: // CHARACTER TABULATION (tab) + case 0x000A: // LINE FEED (LF) + case 0x000C: // FORM FEED (FF) + case 0x0020: // SPACE + /* Ignore the character. */ + break; + case 0x0041: // [A-Z] + case 0x0042:case 0x0043:case 0x0044:case 0x0045:case 0x0046: + case 0x0047:case 0x0048:case 0x0049:case 0x004A:case 0x004B: + case 0x004C:case 0x004D:case 0x004E:case 0x004F:case 0x0050: + case 0x0051:case 0x0052:case 0x0053:case 0x0054:case 0x0055: + case 0x0056:case 0x0057:case 0x0058:case 0x0059:case 0x005A: + beginDoctype(); + doctypenamebuf.push(c + 0x0020); + tokenizer = doctype_name_state; + break; + case 0x0000: // NULL + beginDoctype(); + doctypenamebuf.push(0xFFFD); + tokenizer = doctype_name_state; + break; + case 0x003E: // GREATER-THAN SIGN + beginDoctype(); + forcequirks(); + tokenizer = data_state; + emitDoctype(); + break; + case -1: // EOF + beginDoctype(); + forcequirks(); + emitDoctype(); + emitEOF(); + break; + default: + beginDoctype(); + doctypenamebuf.push(c); + tokenizer = doctype_name_state; + break; + } + } + + function doctype_name_state(c) { + switch(c) { + case 0x0009: // CHARACTER TABULATION (tab) + case 0x000A: // LINE FEED (LF) + case 0x000C: // FORM FEED (FF) + case 0x0020: // SPACE + tokenizer = after_doctype_name_state; + break; + case 0x003E: // GREATER-THAN SIGN + tokenizer = data_state; + emitDoctype(); + break; + case 0x0041: // [A-Z] + case 0x0042:case 0x0043:case 0x0044:case 0x0045:case 0x0046: + case 0x0047:case 0x0048:case 0x0049:case 0x004A:case 0x004B: + case 0x004C:case 0x004D:case 0x004E:case 0x004F:case 0x0050: + case 0x0051:case 0x0052:case 0x0053:case 0x0054:case 0x0055: + case 0x0056:case 0x0057:case 0x0058:case 0x0059:case 0x005A: + doctypenamebuf.push(c + 0x0020); + break; + case 0x0000: // NULL + doctypenamebuf.push(0xFFFD /* REPLACEMENT CHARACTER */); + break; + case -1: // EOF + forcequirks(); + emitDoctype(); + emitEOF(); + break; + default: + doctypenamebuf.push(c); + break; + } + } + + function after_doctype_name_state(c, lookahead, eof) { + switch(c) { + case 0x0009: // CHARACTER TABULATION (tab) + case 0x000A: // LINE FEED (LF) + case 0x000C: // FORM FEED (FF) + case 0x0020: // SPACE + /* Ignore the character. */ + nextchar += 1; + break; + case 0x003E: // GREATER-THAN SIGN + tokenizer = data_state; + nextchar += 1; + emitDoctype(); + break; + case -1: // EOF + forcequirks(); + emitDoctype(); + emitEOF(); + break; + default: + lookahead = lookahead.toUpperCase(); + if (lookahead === "PUBLIC") { + nextchar += 6; + tokenizer = after_doctype_public_keyword_state; + } + else if (lookahead === "SYSTEM") { + nextchar += 6; + tokenizer = after_doctype_system_keyword_state; + } + else { + forcequirks(); + tokenizer = bogus_doctype_state; + } + break; + } + } + after_doctype_name_state.lookahead = 6; + + function after_doctype_public_keyword_state(c) { + switch(c) { + case 0x0009: // CHARACTER TABULATION (tab) + case 0x000A: // LINE FEED (LF) + case 0x000C: // FORM FEED (FF) + case 0x0020: // SPACE + tokenizer = before_doctype_public_identifier_state; + break; + case 0x0022: // QUOTATION MARK + beginDoctypePublicId(); + tokenizer = doctype_public_identifier_double_quoted_state; + break; + case 0x0027: // APOSTROPHE + beginDoctypePublicId(); + tokenizer = doctype_public_identifier_single_quoted_state; + break; + case 0x003E: // GREATER-THAN SIGN + forcequirks(); + tokenizer = data_state; + emitDoctype(); + break; + case -1: // EOF + forcequirks(); + emitDoctype(); + emitEOF(); + break; + default: + forcequirks(); + tokenizer = bogus_doctype_state; + break; + } + } + + function before_doctype_public_identifier_state(c) { + switch(c) { + case 0x0009: // CHARACTER TABULATION (tab) + case 0x000A: // LINE FEED (LF) + case 0x000C: // FORM FEED (FF) + case 0x0020: // SPACE + /* Ignore the character. */ + break; + case 0x0022: // QUOTATION MARK + beginDoctypePublicId(); + tokenizer = doctype_public_identifier_double_quoted_state; + break; + case 0x0027: // APOSTROPHE + beginDoctypePublicId(); + tokenizer = doctype_public_identifier_single_quoted_state; + break; + case 0x003E: // GREATER-THAN SIGN + forcequirks(); + tokenizer = data_state; + emitDoctype(); + break; + case -1: // EOF + forcequirks(); + emitDoctype(); + emitEOF(); + break; + default: + forcequirks(); + tokenizer = bogus_doctype_state; + break; + } + } + + function doctype_public_identifier_double_quoted_state(c) { + switch(c) { + case 0x0022: // QUOTATION MARK + tokenizer = after_doctype_public_identifier_state; + break; + case 0x0000: // NULL + doctypepublicbuf.push(0xFFFD /* REPLACEMENT CHARACTER */); + break; + case 0x003E: // GREATER-THAN SIGN + forcequirks(); + tokenizer = data_state; + emitDoctype(); + break; + case -1: // EOF + forcequirks(); + emitDoctype(); + emitEOF(); + break; + default: + doctypepublicbuf.push(c); + break; + } + } + + function doctype_public_identifier_single_quoted_state(c) { + switch(c) { + case 0x0027: // APOSTROPHE + tokenizer = after_doctype_public_identifier_state; + break; + case 0x0000: // NULL + doctypepublicbuf.push(0xFFFD /* REPLACEMENT CHARACTER */); + break; + case 0x003E: // GREATER-THAN SIGN + forcequirks(); + tokenizer = data_state; + emitDoctype(); + break; + case -1: // EOF + forcequirks(); + emitDoctype(); + emitEOF(); + break; + default: + doctypepublicbuf.push(c); + break; + } + } + + function after_doctype_public_identifier_state(c) { + switch(c) { + case 0x0009: // CHARACTER TABULATION (tab) + case 0x000A: // LINE FEED (LF) + case 0x000C: // FORM FEED (FF) + case 0x0020: // SPACE + tokenizer = between_doctype_public_and_system_identifiers_state; + break; + case 0x003E: // GREATER-THAN SIGN + tokenizer = data_state; + emitDoctype(); + break; + case 0x0022: // QUOTATION MARK + beginDoctypeSystemId(); + tokenizer = doctype_system_identifier_double_quoted_state; + break; + case 0x0027: // APOSTROPHE + beginDoctypeSystemId(); + tokenizer = doctype_system_identifier_single_quoted_state; + break; + case -1: // EOF + forcequirks(); + emitDoctype(); + emitEOF(); + break; + default: + forcequirks(); + tokenizer = bogus_doctype_state; + break; + } + } + + function between_doctype_public_and_system_identifiers_state(c) { + switch(c) { + case 0x0009: // CHARACTER TABULATION (tab) + case 0x000A: // LINE FEED (LF) + case 0x000C: // FORM FEED (FF) + case 0x0020: // SPACE Ignore the character. + break; + case 0x003E: // GREATER-THAN SIGN + tokenizer = data_state; + emitDoctype(); + break; + case 0x0022: // QUOTATION MARK + beginDoctypeSystemId(); + tokenizer = doctype_system_identifier_double_quoted_state; + break; + case 0x0027: // APOSTROPHE + beginDoctypeSystemId(); + tokenizer = doctype_system_identifier_single_quoted_state; + break; + case -1: // EOF + forcequirks(); + emitDoctype(); + emitEOF(); + break; + default: + forcequirks(); + tokenizer = bogus_doctype_state; + break; + } + } + + function after_doctype_system_keyword_state(c) { + switch(c) { + case 0x0009: // CHARACTER TABULATION (tab) + case 0x000A: // LINE FEED (LF) + case 0x000C: // FORM FEED (FF) + case 0x0020: // SPACE + tokenizer = before_doctype_system_identifier_state; + break; + case 0x0022: // QUOTATION MARK + beginDoctypeSystemId(); + tokenizer = doctype_system_identifier_double_quoted_state; + break; + case 0x0027: // APOSTROPHE + beginDoctypeSystemId(); + tokenizer = doctype_system_identifier_single_quoted_state; + break; + case 0x003E: // GREATER-THAN SIGN + forcequirks(); + tokenizer = data_state; + emitDoctype(); + break; + case -1: // EOF + forcequirks(); + emitDoctype(); + emitEOF(); + break; + default: + forcequirks(); + tokenizer = bogus_doctype_state; + break; + } + } + + function before_doctype_system_identifier_state(c) { + switch(c) { + case 0x0009: // CHARACTER TABULATION (tab) + case 0x000A: // LINE FEED (LF) + case 0x000C: // FORM FEED (FF) + case 0x0020: // SPACE Ignore the character. + break; + case 0x0022: // QUOTATION MARK + beginDoctypeSystemId(); + tokenizer = doctype_system_identifier_double_quoted_state; + break; + case 0x0027: // APOSTROPHE + beginDoctypeSystemId(); + tokenizer = doctype_system_identifier_single_quoted_state; + break; + case 0x003E: // GREATER-THAN SIGN + forcequirks(); + tokenizer = data_state; + emitDoctype(); + break; + case -1: // EOF + forcequirks(); + emitDoctype(); + emitEOF(); + break; + default: + forcequirks(); + tokenizer = bogus_doctype_state; + break; + } + } + + function doctype_system_identifier_double_quoted_state(c) { + switch(c) { + case 0x0022: // QUOTATION MARK + tokenizer = after_doctype_system_identifier_state; + break; + case 0x0000: // NULL + doctypesystembuf.push(0xFFFD /* REPLACEMENT CHARACTER */); + break; + case 0x003E: // GREATER-THAN SIGN + forcequirks(); + tokenizer = data_state; + emitDoctype(); + break; + case -1: // EOF + forcequirks(); + emitDoctype(); + emitEOF(); + break; + default: + doctypesystembuf.push(c); + break; + } + } + + function doctype_system_identifier_single_quoted_state(c) { + switch(c) { + case 0x0027: // APOSTROPHE + tokenizer = after_doctype_system_identifier_state; + break; + case 0x0000: // NULL + doctypesystembuf.push(0xFFFD /* REPLACEMENT CHARACTER */); + break; + case 0x003E: // GREATER-THAN SIGN + forcequirks(); + tokenizer = data_state; + emitDoctype(); + break; + case -1: // EOF + forcequirks(); + emitDoctype(); + emitEOF(); + break; + default: + doctypesystembuf.push(c); + break; + } + } + + function after_doctype_system_identifier_state(c) { + switch(c) { + case 0x0009: // CHARACTER TABULATION (tab) + case 0x000A: // LINE FEED (LF) + case 0x000C: // FORM FEED (FF) + case 0x0020: // SPACE + /* Ignore the character. */ + break; + case 0x003E: // GREATER-THAN SIGN + tokenizer = data_state; + emitDoctype(); + break; + case -1: // EOF + forcequirks(); + emitDoctype(); + emitEOF(); + break; + default: + tokenizer = bogus_doctype_state; + /* This does *not* set the DOCTYPE token's force-quirks flag. */ + break; + } + } + + function bogus_doctype_state(c) { + switch(c) { + case 0x003E: // GREATER-THAN SIGN + tokenizer = data_state; + emitDoctype(); + break; + case -1: // EOF + emitDoctype(); + emitEOF(); + break; + default: + /* Ignore the character. */ + break; + } + } + + function cdata_section_state(c) { + switch(c) { + case 0x005D: // RIGHT SQUARE BRACKET + tokenizer = cdata_section_bracket_state; + break; + case -1: // EOF + emitEOF(); + break; + case 0x0000: // NULL + textIncludesNUL = true; + /* fall through */ + default: + // Instead of just pushing a single character and then + // coming back to the very same place, lookahead and + // emit everything we can at once. + /*jshint -W030 */ + emitCharsWhile(CDATATEXT) || textrun.push(c); + break; + } + } + + function cdata_section_bracket_state(c) { + switch(c) { + case 0x005D: // RIGHT SQUARE BRACKET + tokenizer = cdata_section_end_state; + break; + default: + textrun.push(0x005D); + reconsume(c, cdata_section_state); + break; + } + } + + function cdata_section_end_state(c) { + switch(c) { + case 0x005D: // RIGHT SQUARE BRACKET + textrun.push(0x005D); + break; + case 0x003E: // GREATER-THAN SIGN + flushText(); + tokenizer = data_state; + break; + default: + textrun.push(0x005D); + textrun.push(0x005D); + reconsume(c, cdata_section_state); + break; + } + } + + function character_reference_state(c) { + beginTempBuf(); + tempbuf.push(0x0026); + switch(c) { + case 0x0009: // TAB + case 0x000A: // LINE FEED + case 0x000C: // FORM FEED + case 0x0020: // SPACE + case 0x003C: // LESS-THAN SIGN + case 0x0026: // AMPERSAND + case -1: // EOF + reconsume(c, character_reference_end_state); + break; + case 0x0023: // NUMBER SIGN + tempbuf.push(c); + tokenizer = numeric_character_reference_state; + break; + default: + reconsume(c, named_character_reference_state); + break; + } + } + + function named_character_reference_state(c) { + NAMEDCHARREF.lastIndex = nextchar; // w/ lookahead no char has been consumed + var matched = NAMEDCHARREF.exec(chars); + if (!matched) throw new Error("should never happen"); + var name = matched[1]; + if (!name) { + // If no match can be made, switch to the character reference end state + tokenizer = character_reference_end_state; + return; + } + + // Consume the matched characters and append them to temporary buffer + nextchar += name.length; + pushAll(tempbuf, str2buf(name)); + + switch(return_state) { + case attribute_value_double_quoted_state: + case attribute_value_single_quoted_state: + case attribute_value_unquoted_state: + // If the character reference was consumed as part of an attribute... + if (name[name.length-1] !== ';') { // ...and the last char is not ; + if (/[=A-Za-z0-9]/.test(chars[nextchar])) { + tokenizer = character_reference_end_state; + return; + } + } + break; + default: + break; + } + + beginTempBuf(); + var rv = namedCharRefs[name]; + if (typeof rv === 'number') { + tempbuf.push(rv); + } else { + pushAll(tempbuf, rv); + } + tokenizer = character_reference_end_state; + } + // We might need to pause tokenization until we have enough characters + // in the buffer for longest possible character reference. + named_character_reference_state.lookahead = -NAMEDCHARREF_MAXLEN; + + function numeric_character_reference_state(c) { + character_reference_code = 0; + switch(c) { + case 0x0078: // x + case 0x0058: // X + tempbuf.push(c); + tokenizer = hexadecimal_character_reference_start_state; + break; + default: + reconsume(c, decimal_character_reference_start_state); + break; + } + } + + function hexadecimal_character_reference_start_state(c) { + switch(c) { + case 0x0030: case 0x0031: case 0x0032: case 0x0033: case 0x0034: + case 0x0035: case 0x0036: case 0x0037: case 0x0038: case 0x0039: // [0-9] + case 0x0041: case 0x0042: case 0x0043: case 0x0044: case 0x0045: + case 0x0046: // [A-F] + case 0x0061: case 0x0062: case 0x0063: case 0x0064: case 0x0065: + case 0x0066: // [a-f] + reconsume(c, hexadecimal_character_reference_state); + break; + default: + reconsume(c, character_reference_end_state); + break; + } + } + + function decimal_character_reference_start_state(c) { + switch(c) { + case 0x0030: case 0x0031: case 0x0032: case 0x0033: case 0x0034: + case 0x0035: case 0x0036: case 0x0037: case 0x0038: case 0x0039: // [0-9] + reconsume(c, decimal_character_reference_state); + break; + default: + reconsume(c, character_reference_end_state); + break; + } + } + + function hexadecimal_character_reference_state(c) { + switch(c) { + case 0x0041: case 0x0042: case 0x0043: case 0x0044: case 0x0045: + case 0x0046: // [A-F] + character_reference_code *= 16; + character_reference_code += (c - 0x0037); + break; + case 0x0061: case 0x0062: case 0x0063: case 0x0064: case 0x0065: + case 0x0066: // [a-f] + character_reference_code *= 16; + character_reference_code += (c - 0x0057); + break; + case 0x0030: case 0x0031: case 0x0032: case 0x0033: case 0x0034: + case 0x0035: case 0x0036: case 0x0037: case 0x0038: case 0x0039: // [0-9] + character_reference_code *= 16; + character_reference_code += (c - 0x0030); + break; + case 0x003B: // SEMICOLON + tokenizer = numeric_character_reference_end_state; + break; + default: + reconsume(c, numeric_character_reference_end_state); + break; + } + } + + function decimal_character_reference_state(c) { + switch(c) { + case 0x0030: case 0x0031: case 0x0032: case 0x0033: case 0x0034: + case 0x0035: case 0x0036: case 0x0037: case 0x0038: case 0x0039: // [0-9] + character_reference_code *= 10; + character_reference_code += (c - 0x0030); + break; + case 0x003B: // SEMICOLON + tokenizer = numeric_character_reference_end_state; + break; + default: + reconsume(c, numeric_character_reference_end_state); + break; + } + } + + function numeric_character_reference_end_state(c) { + if (character_reference_code in numericCharRefReplacements) { + character_reference_code = numericCharRefReplacements[character_reference_code]; + } else if (character_reference_code > 0x10FFFF || (character_reference_code >= 0xD800 && character_reference_code < 0xE000)) { + character_reference_code = 0xFFFD; + } + + beginTempBuf(); + if (character_reference_code <= 0xFFFF) { + tempbuf.push(character_reference_code); + } else { + character_reference_code = character_reference_code - 0x10000; + /* jshint bitwise: false */ + tempbuf.push(0xD800 + (character_reference_code >> 10)); + tempbuf.push(0xDC00 + (character_reference_code & 0x03FF)); + } + reconsume(c, character_reference_end_state); + } + + function character_reference_end_state(c) { + switch(return_state) { + case attribute_value_double_quoted_state: + case attribute_value_single_quoted_state: + case attribute_value_unquoted_state: + // append each character to the current attribute's value + attrvaluebuf += buf2str(tempbuf); + break; + default: + pushAll(textrun, tempbuf); + break; + } + reconsume(c, return_state); + } + + /*** + * The tree builder insertion modes + */ + + // 11.2.5.4.1 The "initial" insertion mode + function initial_mode(t, value, arg3, arg4) { + switch(t) { + case 1: // TEXT + value = value.replace(LEADINGWS, ""); // Ignore spaces + if (value.length === 0) return; // Are we done? + break; // Handle anything non-space text below + case 4: // COMMENT + doc._appendChild(doc.createComment(value)); + return; + case 5: // DOCTYPE + var name = value; + var publicid = arg3; + var systemid = arg4; + // Use the constructor directly instead of + // implementation.createDocumentType because the create + // function throws errors on invalid characters, and + // we don't want the parser to throw them. + doc.appendChild(new DocumentType(name,publicid, systemid)); + + // Note that there is no public API for setting quirks mode We can + // do this here because we have access to implementation details + if (force_quirks || + name.toLowerCase() !== "html" || + quirkyPublicIds.test(publicid) || + (systemid && systemid.toLowerCase() === quirkySystemId) || + (systemid === undefined && + conditionallyQuirkyPublicIds.test(publicid))) + doc._quirks = true; + else if (limitedQuirkyPublicIds.test(publicid) || + (systemid !== undefined && + conditionallyQuirkyPublicIds.test(publicid))) + doc._limitedQuirks = true; + parser = before_html_mode; + return; + } + + // tags or non-whitespace text + doc._quirks = true; + parser = before_html_mode; + parser(t,value,arg3,arg4); + } + + // 11.2.5.4.2 The "before html" insertion mode + function before_html_mode(t,value,arg3,arg4) { + var elt; + switch(t) { + case 1: // TEXT + value = value.replace(LEADINGWS, ""); // Ignore spaces + if (value.length === 0) return; // Are we done? + break; // Handle anything non-space text below + case 5: // DOCTYPE + /* ignore the token */ + return; + case 4: // COMMENT + doc._appendChild(doc.createComment(value)); + return; + case 2: // TAG + if (value === "html") { + elt = createHTMLElt(doc, value, arg3); + stack.push(elt); + doc.appendChild(elt); + // XXX: handle application cache here + parser = before_head_mode; + return; + } + break; + case 3: // ENDTAG + switch(value) { + case "html": + case "head": + case "body": + case "br": + break; // fall through on these + default: + return; // ignore most end tags + } } -}; + // Anything that didn't get handled above is handled like this: + elt = createHTMLElt(doc, "html", null); + stack.push(elt); + doc.appendChild(elt); + // XXX: handle application cache here + parser = before_head_mode; + parser(t,value,arg3,arg4); + } + + // 11.2.5.4.3 The "before head" insertion mode + function before_head_mode(t,value,arg3,arg4) { + switch(t) { + case 1: // TEXT + value = value.replace(LEADINGWS, ""); // Ignore spaces + if (value.length === 0) return; // Are we done? + break; // Handle anything non-space text below + case 5: // DOCTYPE + /* ignore the token */ + return; + case 4: // COMMENT + insertComment(value); + return; + case 2: // TAG + switch(value) { + case "html": + in_body_mode(t,value,arg3,arg4); + return; + case "head": + var elt = insertHTMLElement(value, arg3); + head_element_pointer = elt; + parser = in_head_mode; + return; + } + break; + case 3: // ENDTAG + switch(value) { + case "html": + case "head": + case "body": + case "br": + break; + default: + return; // ignore most end tags + } + } -//12.2.4.64 DOCTYPE system identifier (double-quoted) state -//------------------------------------------------------------------ -_[DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED_STATE] = function doctypeSystemIdentifierDoubleQuotedState(cp) { - if (cp === $.QUOTATION_MARK) - this.state = AFTER_DOCTYPE_SYSTEM_IDENTIFIER_STATE; + // If not handled explicitly above + before_head_mode(TAG, "head", null); // create a head tag + parser(t, value, arg3, arg4); // then try again with this token + } - else if (cp === $.GREATER_THAN_SIGN) { - this.currentToken.forceQuirks = true; - this._emitCurrentToken(); - this.state = DATA_STATE; + function in_head_mode(t, value, arg3, arg4) { + switch(t) { + case 1: // TEXT + var ws = value.match(LEADINGWS); + if (ws) { + insertText(ws[0]); + value = value.substring(ws[0].length); + } + if (value.length === 0) return; + break; // Handle non-whitespace below + case 4: // COMMENT + insertComment(value); + return; + case 5: // DOCTYPE + return; + case 2: // TAG + switch(value) { + case "html": + in_body_mode(t, value, arg3, arg4); + return; + case "meta": + // XXX: + // May need to change the encoding based on this tag + /* falls through */ + case "base": + case "basefont": + case "bgsound": + case "link": + insertHTMLElement(value, arg3); + stack.pop(); + return; + case "title": + parseRCDATA(value, arg3); + return; + case "noscript": + if (!scripting_enabled) { + insertHTMLElement(value, arg3); + parser = in_head_noscript_mode; + return; + } + // Otherwise, if scripting is enabled... + /* falls through */ + case "noframes": + case "style": + parseRawText(value,arg3); + return; + case "script": + insertElement(function(doc) { + var elt = createHTMLElt(doc, value, arg3); + elt._parser_inserted = true; + elt._force_async = false; + if (fragment) elt._already_started = true; + flushText(); + return elt; + }); + tokenizer = script_data_state; + originalInsertionMode = parser; + parser = text_mode; + return; + case "template": + insertHTMLElement(value, arg3); + afe.insertMarker(); + frameset_ok = false; + parser = in_template_mode; + templateInsertionModes.push(parser); + return; + case "head": + return; // ignore it + } + break; + case 3: // ENDTAG + switch(value) { + case "head": + stack.pop(); + parser = after_head_mode; + return; + case "body": + case "html": + case "br": + break; // handle these at the bottom of the function + case "template": + if (!stack.contains("template")) { + return; + } + stack.generateImpliedEndTags(null, "thorough"); + stack.popTag("template"); + afe.clearToMarker(); + templateInsertionModes.pop(); + resetInsertionMode(); + return; + default: + // ignore any other end tag + return; + } + break; + } + + // If not handled above + in_head_mode(ENDTAG, "head", null); // synthetic + parser(t, value, arg3, arg4); // Then redo this one + } + + // 13.2.5.4.5 The "in head noscript" insertion mode + function in_head_noscript_mode(t, value, arg3, arg4) { + switch(t) { + case 5: // DOCTYPE + return; + case 4: // COMMENT + in_head_mode(t, value); + return; + case 1: // TEXT + var ws = value.match(LEADINGWS); + if (ws) { + in_head_mode(t, ws[0]); + value = value.substring(ws[0].length); + } + if (value.length === 0) return; // no more text + break; // Handle non-whitespace below + case 2: // TAG + switch(value) { + case "html": + in_body_mode(t, value, arg3, arg4); + return; + case "basefont": + case "bgsound": + case "link": + case "meta": + case "noframes": + case "style": + in_head_mode(t, value, arg3); + return; + case "head": + case "noscript": + return; + } + break; + case 3: // ENDTAG + switch(value) { + case "noscript": + stack.pop(); + parser = in_head_mode; + return; + case "br": + break; // goes to the outer default + default: + return; // ignore other end tags + } + break; } - else if (cp === $.NULL) - this.currentToken.systemId += UNICODE.REPLACEMENT_CHARACTER; + // If not handled above + in_head_noscript_mode(ENDTAG, "noscript", null); + parser(t, value, arg3, arg4); + } - else if (cp === $.EOF) { - this.currentToken.forceQuirks = true; - this._emitCurrentToken(); - this._reconsumeInState(DATA_STATE); - } + function after_head_mode(t, value, arg3, arg4) { + switch(t) { + case 1: // TEXT + var ws = value.match(LEADINGWS); + if (ws) { + insertText(ws[0]); + value = value.substring(ws[0].length); + } + if (value.length === 0) return; + break; // Handle non-whitespace below + case 4: // COMMENT + insertComment(value); + return; + case 5: // DOCTYPE + return; + case 2: // TAG + switch(value) { + case "html": + in_body_mode(t, value, arg3, arg4); + return; + case "body": + insertHTMLElement(value, arg3); + frameset_ok = false; + parser = in_body_mode; + return; + case "frameset": + insertHTMLElement(value, arg3); + parser = in_frameset_mode; + return; + case "base": + case "basefont": + case "bgsound": + case "link": + case "meta": + case "noframes": + case "script": + case "style": + case "template": + case "title": + stack.push(head_element_pointer); + in_head_mode(TAG, value, arg3); + stack.removeElement(head_element_pointer); + return; + case "head": + return; + } + break; + case 3: // ENDTAG + switch(value) { + case "template": + return in_head_mode(t, value, arg3, arg4); + case "body": + case "html": + case "br": + break; + default: + return; // ignore any other end tag + } + break; + } + + after_head_mode(TAG, "body", null); + frameset_ok = true; + parser(t, value, arg3, arg4); + } + + // 13.2.5.4.7 The "in body" insertion mode + function in_body_mode(t,value,arg3,arg4) { + var body, i, node, elt; + switch(t) { + case 1: // TEXT + if (textIncludesNUL) { + value = value.replace(NULCHARS, ""); + if (value.length === 0) return; + } + // If any non-space characters + if (frameset_ok && NONWS.test(value)) + frameset_ok = false; + afereconstruct(); + insertText(value); + return; + case 5: // DOCTYPE + return; + case 4: // COMMENT + insertComment(value); + return; + case -1: // EOF + if (templateInsertionModes.length) { + return in_template_mode(t); + } + stopParsing(); + return; + case 2: // TAG + switch(value) { + case "html": + if (stack.contains("template")) { + return; + } + transferAttributes(arg3, stack.elements[0]); + return; + case "base": + case "basefont": + case "bgsound": + case "link": + case "meta": + case "noframes": + case "script": + case "style": + case "template": + case "title": + in_head_mode(TAG, value, arg3); + return; + case "body": + body = stack.elements[1]; + if (!body || !(body instanceof impl.HTMLBodyElement) || + stack.contains("template")) + return; + frameset_ok = false; + transferAttributes(arg3, body); + return; + case "frameset": + if (!frameset_ok) return; + body = stack.elements[1]; + if (!body || !(body instanceof impl.HTMLBodyElement)) + return; + if (body.parentNode) body.parentNode.removeChild(body); + while(!(stack.top instanceof impl.HTMLHtmlElement)) + stack.pop(); + insertHTMLElement(value, arg3); + parser = in_frameset_mode; + return; - else - this.currentToken.systemId += toChar(cp); -}; + case "address": + case "article": + case "aside": + case "blockquote": + case "center": + case "details": + case "dialog": + case "dir": + case "div": + case "dl": + case "fieldset": + case "figcaption": + case "figure": + case "footer": + case "header": + case "hgroup": + case "main": + case "nav": + case "ol": + case "p": + case "section": + case "summary": + case "ul": + if (stack.inButtonScope("p")) in_body_mode(ENDTAG, "p"); + insertHTMLElement(value, arg3); + return; + case "menu": + if (stack.inButtonScope("p")) in_body_mode(ENDTAG, "p"); + if (isA(stack.top, 'menuitem')) { + stack.pop(); + } + insertHTMLElement(value, arg3); + return; -//12.2.4.65 DOCTYPE system identifier (single-quoted) state -//------------------------------------------------------------------ -_[DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED_STATE] = function doctypeSystemIdentifierSingleQuotedState(cp) { - if (cp === $.APOSTROPHE) - this.state = AFTER_DOCTYPE_SYSTEM_IDENTIFIER_STATE; + case "h1": + case "h2": + case "h3": + case "h4": + case "h5": + case "h6": + if (stack.inButtonScope("p")) in_body_mode(ENDTAG, "p"); + if (stack.top instanceof impl.HTMLHeadingElement) + stack.pop(); + insertHTMLElement(value, arg3); + return; - else if (cp === $.GREATER_THAN_SIGN) { - this.currentToken.forceQuirks = true; - this._emitCurrentToken(); - this.state = DATA_STATE; - } + case "pre": + case "listing": + if (stack.inButtonScope("p")) in_body_mode(ENDTAG, "p"); + insertHTMLElement(value, arg3); + ignore_linefeed = true; + frameset_ok = false; + return; - else if (cp === $.NULL) - this.currentToken.systemId += UNICODE.REPLACEMENT_CHARACTER; + case "form": + if (form_element_pointer && !stack.contains("template")) return; + if (stack.inButtonScope("p")) in_body_mode(ENDTAG, "p"); + elt = insertHTMLElement(value, arg3); + if (!stack.contains("template")) + form_element_pointer = elt; + return; - else if (cp === $.EOF) { - this.currentToken.forceQuirks = true; - this._emitCurrentToken(); - this._reconsumeInState(DATA_STATE); - } + case "li": + frameset_ok = false; + for(i = stack.elements.length-1; i >= 0; i--) { + node = stack.elements[i]; + if (node instanceof impl.HTMLLIElement) { + in_body_mode(ENDTAG, "li"); + break; + } + if (isA(node, specialSet) && !isA(node, addressdivpSet)) + break; + } + if (stack.inButtonScope("p")) in_body_mode(ENDTAG, "p"); + insertHTMLElement(value, arg3); + return; - else - this.currentToken.systemId += toChar(cp); -}; + case "dd": + case "dt": + frameset_ok = false; + for(i = stack.elements.length-1; i >= 0; i--) { + node = stack.elements[i]; + if (isA(node, dddtSet)) { + in_body_mode(ENDTAG, node.localName); + break; + } + if (isA(node, specialSet) && !isA(node, addressdivpSet)) + break; + } + if (stack.inButtonScope("p")) in_body_mode(ENDTAG, "p"); + insertHTMLElement(value, arg3); + return; + case "plaintext": + if (stack.inButtonScope("p")) in_body_mode(ENDTAG, "p"); + insertHTMLElement(value, arg3); + tokenizer = plaintext_state; + return; -//12.2.4.66 After DOCTYPE system identifier state -//------------------------------------------------------------------ -_[AFTER_DOCTYPE_SYSTEM_IDENTIFIER_STATE] = function afterDoctypeSystemIdentifierState(cp) { - if (isWhitespace(cp)) + case "button": + if (stack.inScope("button")) { + in_body_mode(ENDTAG, "button"); + parser(t, value, arg3, arg4); + } + else { + afereconstruct(); + insertHTMLElement(value, arg3); + frameset_ok = false; + } return; - if (cp === $.GREATER_THAN_SIGN) { - this._emitCurrentToken(); - this.state = DATA_STATE; - } + case "a": + var activeElement = afe.findElementByTag("a"); + if (activeElement) { + in_body_mode(ENDTAG, value); + afe.remove(activeElement); + stack.removeElement(activeElement); + } + /* falls through */ + case "b": + case "big": + case "code": + case "em": + case "font": + case "i": + case "s": + case "small": + case "strike": + case "strong": + case "tt": + case "u": + afereconstruct(); + afe.push(insertHTMLElement(value,arg3), arg3); + return; - else if (cp === $.EOF) { - this.currentToken.forceQuirks = true; - this._emitCurrentToken(); - this._reconsumeInState(DATA_STATE); - } + case "nobr": + afereconstruct(); - else - this.state = BOGUS_DOCTYPE_STATE; -}; + if (stack.inScope(value)) { + in_body_mode(ENDTAG, value); + afereconstruct(); + } + afe.push(insertHTMLElement(value,arg3), arg3); + return; + case "applet": + case "marquee": + case "object": + afereconstruct(); + insertHTMLElement(value,arg3); + afe.insertMarker(); + frameset_ok = false; + return; -//12.2.4.67 Bogus DOCTYPE state -//------------------------------------------------------------------ -_[BOGUS_DOCTYPE_STATE] = function bogusDoctypeState(cp) { - if (cp === $.GREATER_THAN_SIGN) { - this._emitCurrentToken(); - this.state = DATA_STATE; - } + case "table": + if (!doc._quirks && stack.inButtonScope("p")) { + in_body_mode(ENDTAG, "p"); + } + insertHTMLElement(value,arg3); + frameset_ok = false; + parser = in_table_mode; + return; - else if (cp === $.EOF) { - this._emitCurrentToken(); - this._reconsumeInState(DATA_STATE); - } -}; + case "area": + case "br": + case "embed": + case "img": + case "keygen": + case "wbr": + afereconstruct(); + insertHTMLElement(value,arg3); + stack.pop(); + frameset_ok = false; + return; + case "input": + afereconstruct(); + elt = insertHTMLElement(value,arg3); + stack.pop(); + var type = elt.getAttribute("type"); + if (!type || type.toLowerCase() !== "hidden") + frameset_ok = false; + return; -//12.2.4.68 CDATA section state -//------------------------------------------------------------------ -_[CDATA_SECTION_STATE] = function cdataSectionState(cp) { - while (true) { - if (cp === $.EOF) { - this._reconsumeInState(DATA_STATE); - break; + case "param": + case "source": + case "track": + insertHTMLElement(value,arg3); + stack.pop(); + return; + + case "hr": + if (stack.inButtonScope("p")) in_body_mode(ENDTAG, "p"); + if (isA(stack.top, 'menuitem')) { + stack.pop(); } + insertHTMLElement(value,arg3); + stack.pop(); + frameset_ok = false; + return; - else { - var cdataEndMatch = this._consumeSubsequentIfMatch($$.CDATA_END_STRING, cp, true); + case "image": + in_body_mode(TAG, "img", arg3, arg4); + return; - if (this._ensureHibernation()) - break; + case "textarea": + insertHTMLElement(value,arg3); + ignore_linefeed = true; + frameset_ok = false; + tokenizer = rcdata_state; + originalInsertionMode = parser; + parser = text_mode; + return; - if (cdataEndMatch) { - this.state = DATA_STATE; - break; - } + case "xmp": + if (stack.inButtonScope("p")) in_body_mode(ENDTAG, "p"); + afereconstruct(); + frameset_ok = false; + parseRawText(value, arg3); + return; - this._emitCodePoint(cp); + case "iframe": + frameset_ok = false; + parseRawText(value, arg3); + return; - this._hibernationSnapshot(); - cp = this._consume(); + case "noembed": + parseRawText(value,arg3); + return; - if (this._ensureHibernation()) - break; + case "noscript": + if (scripting_enabled) { + parseRawText(value,arg3); + return; } - } -}; + break; // XXX Otherwise treat it as any other open tag? + + case "select": + afereconstruct(); + insertHTMLElement(value,arg3); + frameset_ok = false; + if (parser === in_table_mode || + parser === in_caption_mode || + parser === in_table_body_mode || + parser === in_row_mode || + parser === in_cell_mode) + parser = in_select_in_table_mode; + else + parser = in_select_mode; + return; + case "optgroup": + case "option": + if (stack.top instanceof impl.HTMLOptionElement) { + in_body_mode(ENDTAG, "option"); + } + afereconstruct(); + insertHTMLElement(value,arg3); + return; -/***/ }), -/* 20 */ -/***/ (function(module, exports, __webpack_require__) { + case "menuitem": + if (isA(stack.top, 'menuitem')) { + stack.pop(); + } + afereconstruct(); + insertHTMLElement(value, arg3); + return; -"use strict"; + case "rb": + case "rtc": + if (stack.inScope("ruby")) { + stack.generateImpliedEndTags(); + } + insertHTMLElement(value,arg3); + return; -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; -var root_1 = __webpack_require__(12); -var Action_1 = __webpack_require__(356); -/** - * We need this JSDoc comment for affecting ESDoc. - * @ignore - * @extends {Ignored} - */ -var AsyncAction = (function (_super) { - __extends(AsyncAction, _super); - function AsyncAction(scheduler, work) { - _super.call(this, scheduler, work); - this.scheduler = scheduler; - this.work = work; - this.pending = false; - } - AsyncAction.prototype.schedule = function (state, delay) { - if (delay === void 0) { delay = 0; } - if (this.closed) { - return this; + case "rp": + case "rt": + if (stack.inScope("ruby")) { + stack.generateImpliedEndTags("rtc"); } - // Always replace the current state with the new state. - this.state = state; - // Set the pending flag indicating that this action has been scheduled, or - // has recursively rescheduled itself. - this.pending = true; - var id = this.id; - var scheduler = this.scheduler; - // - // Important implementation note: - // - // Actions only execute once by default, unless rescheduled from within the - // scheduled callback. This allows us to implement single and repeat - // actions via the same code path, without adding API surface area, as well - // as mimic traditional recursion but across asynchronous boundaries. - // - // However, JS runtimes and timers distinguish between intervals achieved by - // serial `setTimeout` calls vs. a single `setInterval` call. An interval of - // serial `setTimeout` calls can be individually delayed, which delays - // scheduling the next `setTimeout`, and so on. `setInterval` attempts to - // guarantee the interval callback will be invoked more precisely to the - // interval period, regardless of load. - // - // Therefore, we use `setInterval` to schedule single and repeat actions. - // If the action reschedules itself with the same delay, the interval is not - // canceled. If the action doesn't reschedule, or reschedules with a - // different delay, the interval will be canceled after scheduled callback - // execution. - // - if (id != null) { - this.id = this.recycleAsyncId(scheduler, id, delay); + insertHTMLElement(value,arg3); + return; + + case "math": + afereconstruct(); + adjustMathMLAttributes(arg3); + adjustForeignAttributes(arg3); + insertForeignElement(value, arg3, NAMESPACE.MATHML); + if (arg4) // self-closing flag + stack.pop(); + return; + + case "svg": + afereconstruct(); + adjustSVGAttributes(arg3); + adjustForeignAttributes(arg3); + insertForeignElement(value, arg3, NAMESPACE.SVG); + if (arg4) // self-closing flag + stack.pop(); + return; + + case "caption": + case "col": + case "colgroup": + case "frame": + case "head": + case "tbody": + case "td": + case "tfoot": + case "th": + case "thead": + case "tr": + // Ignore table tags if we're not in_table mode + return; + } + + // Handle any other start tag here + // (and also noscript tags when scripting is disabled) + afereconstruct(); + insertHTMLElement(value,arg3); + return; + + case 3: // ENDTAG + switch(value) { + case "template": + in_head_mode(ENDTAG, value, arg3); + return; + case "body": + if (!stack.inScope("body")) return; + parser = after_body_mode; + return; + case "html": + if (!stack.inScope("body")) return; + parser = after_body_mode; + parser(t, value, arg3); + return; + + case "address": + case "article": + case "aside": + case "blockquote": + case "button": + case "center": + case "details": + case "dialog": + case "dir": + case "div": + case "dl": + case "fieldset": + case "figcaption": + case "figure": + case "footer": + case "header": + case "hgroup": + case "listing": + case "main": + case "menu": + case "nav": + case "ol": + case "pre": + case "section": + case "summary": + case "ul": + // Ignore if there is not a matching open tag + if (!stack.inScope(value)) return; + stack.generateImpliedEndTags(); + stack.popTag(value); + return; + + case "form": + if (!stack.contains("template")) { + var openform = form_element_pointer; + form_element_pointer = null; + if (!openform || !stack.elementInScope(openform)) return; + stack.generateImpliedEndTags(); + stack.removeElement(openform); + } else { + if (!stack.inScope("form")) return; + stack.generateImpliedEndTags(); + stack.popTag("form"); } - this.delay = delay; - // If this action has already an async Id, don't request a new one. - this.id = this.id || this.requestAsyncId(scheduler, this.id, delay); - return this; - }; - AsyncAction.prototype.requestAsyncId = function (scheduler, id, delay) { - if (delay === void 0) { delay = 0; } - return root_1.root.setInterval(scheduler.flush.bind(scheduler, this), delay); - }; - AsyncAction.prototype.recycleAsyncId = function (scheduler, id, delay) { - if (delay === void 0) { delay = 0; } - // If this action is rescheduled with the same delay time, don't clear the interval id. - if (delay !== null && this.delay === delay && this.pending === false) { - return id; - } - // Otherwise, if the action's delay time is different from the current delay, - // or the action has been rescheduled before it's executed, clear the interval id - return root_1.root.clearInterval(id) && undefined || undefined; - }; - /** - * Immediately executes this action and the `work` it contains. - * @return {any} - */ - AsyncAction.prototype.execute = function (state, delay) { - if (this.closed) { - return new Error('executing a cancelled action'); - } - this.pending = false; - var error = this._execute(state, delay); - if (error) { - return error; - } - else if (this.pending === false && this.id != null) { - // Dequeue if the action didn't reschedule itself. Don't call - // unsubscribe(), because the action could reschedule later. - // For example: - // ``` - // scheduler.schedule(function doWork(counter) { - // /* ... I'm a busy worker bee ... */ - // var originalAction = this; - // /* wait 100ms before rescheduling the action */ - // setTimeout(function () { - // originalAction.schedule(counter + 1); - // }, 100); - // }, 1000); - // ``` - this.id = this.recycleAsyncId(this.scheduler, this.id, null); - } - }; - AsyncAction.prototype._execute = function (state, delay) { - var errored = false; - var errorValue = undefined; - try { - this.work(state); - } - catch (e) { - errored = true; - errorValue = !!e && e || new Error(e); - } - if (errored) { - this.unsubscribe(); - return errorValue; - } - }; - AsyncAction.prototype._unsubscribe = function () { - var id = this.id; - var scheduler = this.scheduler; - var actions = scheduler.actions; - var index = actions.indexOf(this); - this.work = null; - this.state = null; - this.pending = false; - this.scheduler = null; - if (index !== -1) { - actions.splice(index, 1); + return; + + case "p": + if (!stack.inButtonScope(value)) { + in_body_mode(TAG, value, null); + parser(t, value, arg3, arg4); } - if (id != null) { - this.id = this.recycleAsyncId(scheduler, id, null); + else { + stack.generateImpliedEndTags(value); + stack.popTag(value); } - this.delay = null; - }; - return AsyncAction; -}(Action_1.Action)); -exports.AsyncAction = AsyncAction; -//# sourceMappingURL=AsyncAction.js.map + return; -/***/ }), -/* 21 */ -/***/ (function(module, exports, __webpack_require__) { + case "li": + if (!stack.inListItemScope(value)) return; + stack.generateImpliedEndTags(value); + stack.popTag(value); + return; -"use strict"; + case "dd": + case "dt": + if (!stack.inScope(value)) return; + stack.generateImpliedEndTags(value); + stack.popTag(value); + return; -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; -var Scheduler_1 = __webpack_require__(122); -var AsyncScheduler = (function (_super) { - __extends(AsyncScheduler, _super); - function AsyncScheduler() { - _super.apply(this, arguments); - this.actions = []; - /** - * A flag to indicate whether the Scheduler is currently executing a batch of - * queued actions. - * @type {boolean} - */ - this.active = false; - /** - * An internal ID used to track the latest asynchronous task such as those - * coming from `setTimeout`, `setInterval`, `requestAnimationFrame`, and - * others. - * @type {any} - */ - this.scheduled = undefined; - } - AsyncScheduler.prototype.flush = function (action) { - var actions = this.actions; - if (this.active) { - actions.push(action); - return; + case "h1": + case "h2": + case "h3": + case "h4": + case "h5": + case "h6": + if (!stack.elementTypeInScope(impl.HTMLHeadingElement)) return; + stack.generateImpliedEndTags(); + stack.popElementType(impl.HTMLHeadingElement); + return; + + case "sarcasm": + // Take a deep breath, and then: + break; + + case "a": + case "b": + case "big": + case "code": + case "em": + case "font": + case "i": + case "nobr": + case "s": + case "small": + case "strike": + case "strong": + case "tt": + case "u": + var result = adoptionAgency(value); + if (result) return; // If we did something we're done + break; // Go to the "any other end tag" case + + case "applet": + case "marquee": + case "object": + if (!stack.inScope(value)) return; + stack.generateImpliedEndTags(); + stack.popTag(value); + afe.clearToMarker(); + return; + + case "br": + in_body_mode(TAG, value, null); // Turn into + return; + } + + // Any other end tag goes here + for(i = stack.elements.length-1; i >= 0; i--) { + node = stack.elements[i]; + if (isA(node, value)) { + stack.generateImpliedEndTags(value); + stack.popElement(node); + break; } - var error; - this.active = true; - do { - if (error = action.execute(action.state, action.delay)) { - break; - } - } while (action = actions.shift()); // exhaust the scheduler queue - this.active = false; - if (error) { - while (action = actions.shift()) { - action.unsubscribe(); - } - throw error; + else if (isA(node, specialSet)) { + return; } - }; - return AsyncScheduler; -}(Scheduler_1.Scheduler)); -exports.AsyncScheduler = AsyncScheduler; -//# sourceMappingURL=AsyncScheduler.js.map + } -/***/ }), -/* 22 */ -/***/ (function(module, exports, __webpack_require__) { + return; + } + } + + function text_mode(t, value, arg3, arg4) { + switch(t) { + case 1: // TEXT + insertText(value); + return; + case -1: // EOF + if (stack.top instanceof impl.HTMLScriptElement) + stack.top._already_started = true; + stack.pop(); + parser = originalInsertionMode; + parser(t); + return; + case 3: // ENDTAG + if (value === "script") { + handleScriptEnd(); + } + else { + stack.pop(); + parser = originalInsertionMode; + } + return; + default: + // We should never get any other token types + return; + } + } + + function in_table_mode(t, value, arg3, arg4) { + function getTypeAttr(attrs) { + for(var i = 0, n = attrs.length; i < n; i++) { + if (attrs[i][0] === "type") + return attrs[i][1].toLowerCase(); + } + return null; + } -"use strict"; + switch(t) { + case 1: // TEXT + // XXX the text_integration_mode stuff is + // just a hack I made up + if (text_integration_mode) { + in_body_mode(t, value, arg3, arg4); + return; + } + else if (isA(stack.top, tablesectionrowSet)) { + pending_table_text = []; + originalInsertionMode = parser; + parser = in_table_text_mode; + parser(t, value, arg3, arg4); + return; + } + break; + case 4: // COMMENT + insertComment(value); + return; + case 5: // DOCTYPE + return; + case 2: // TAG + switch(value) { + case "caption": + stack.clearToContext(tableContextSet); + afe.insertMarker(); + insertHTMLElement(value,arg3); + parser = in_caption_mode; + return; + case "colgroup": + stack.clearToContext(tableContextSet); + insertHTMLElement(value,arg3); + parser = in_column_group_mode; + return; + case "col": + in_table_mode(TAG, "colgroup", null); + parser(t, value, arg3, arg4); + return; + case "tbody": + case "tfoot": + case "thead": + stack.clearToContext(tableContextSet); + insertHTMLElement(value,arg3); + parser = in_table_body_mode; + return; + case "td": + case "th": + case "tr": + in_table_mode(TAG, "tbody", null); + parser(t, value, arg3, arg4); + return; -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; -/** - * An error thrown when an element was queried at a certain index of an - * Observable, but no such index or position exists in that sequence. - * - * @see {@link elementAt} - * @see {@link take} - * @see {@link takeLast} - * - * @class ArgumentOutOfRangeError - */ -var ArgumentOutOfRangeError = (function (_super) { - __extends(ArgumentOutOfRangeError, _super); - function ArgumentOutOfRangeError() { - var err = _super.call(this, 'argument out of range'); - this.name = err.name = 'ArgumentOutOfRangeError'; - this.stack = err.stack; - this.message = err.message; - } - return ArgumentOutOfRangeError; -}(Error)); -exports.ArgumentOutOfRangeError = ArgumentOutOfRangeError; -//# sourceMappingURL=ArgumentOutOfRangeError.js.map + case "table": + if (!stack.inTableScope(value)) { + return; // Ignore the token + } + in_table_mode(ENDTAG, value); + parser(t, value, arg3, arg4); + return; -/***/ }), -/* 23 */ -/***/ (function(module, exports, __webpack_require__) { + case "style": + case "script": + case "template": + in_head_mode(t, value, arg3, arg4); + return; -module.exports = (__webpack_require__(1))(12); + case "input": + var type = getTypeAttr(arg3); + if (type !== "hidden") break; // to the anything else case + insertHTMLElement(value,arg3); + stack.pop(); + return; -/***/ }), -/* 24 */ -/***/ (function(module, exports) { + case "form": + if (form_element_pointer || stack.contains("template")) return; + form_element_pointer = insertHTMLElement(value, arg3); + stack.popElement(form_element_pointer); + return; + } + break; + case 3: // ENDTAG + switch(value) { + case "table": + if (!stack.inTableScope(value)) return; + stack.popTag(value); + resetInsertionMode(); + return; + case "body": + case "caption": + case "col": + case "colgroup": + case "html": + case "tbody": + case "td": + case "tfoot": + case "th": + case "thead": + case "tr": + return; + case "template": + in_head_mode(t, value, arg3, arg4); + return; + } -module.exports = require("util"); + break; + case -1: // EOF + in_body_mode(t, value, arg3, arg4); + return; + } -/***/ }), -/* 25 */ -/***/ (function(module, exports, __webpack_require__) { + // This is the anything else case + foster_parent_mode = true; + in_body_mode(t, value, arg3, arg4); + foster_parent_mode = false; + } -"use strict"; + function in_table_text_mode(t, value, arg3, arg4) { + if (t === TEXT) { + if (textIncludesNUL) { + value = value.replace(NULCHARS, ""); + if (value.length === 0) return; + } + pending_table_text.push(value); + } + else { + var s = pending_table_text.join(""); + pending_table_text.length = 0; + if (NONWS.test(s)) { // If any non-whitespace characters + // This must be the same code as the "anything else" + // case of the in_table mode above. + foster_parent_mode = true; + in_body_mode(TEXT, s); + foster_parent_mode = false; + } + else { + insertText(s); + } + parser = originalInsertionMode; + parser(t, value, arg3, arg4); + } + } + + + function in_caption_mode(t, value, arg3, arg4) { + function end_caption() { + if (!stack.inTableScope("caption")) return false; + stack.generateImpliedEndTags(); + stack.popTag("caption"); + afe.clearToMarker(); + parser = in_table_mode; + return true; + } + + switch(t) { + case 2: // TAG + switch(value) { + case "caption": + case "col": + case "colgroup": + case "tbody": + case "td": + case "tfoot": + case "th": + case "thead": + case "tr": + if (end_caption()) parser(t, value, arg3, arg4); + return; + } + break; + case 3: // ENDTAG + switch(value) { + case "caption": + end_caption(); + return; + case "table": + if (end_caption()) parser(t, value, arg3, arg4); + return; + case "body": + case "col": + case "colgroup": + case "html": + case "tbody": + case "td": + case "tfoot": + case "th": + case "thead": + case "tr": + return; + } + break; + } -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; -var Subject_1 = __webpack_require__(6); -var Subscription_1 = __webpack_require__(9); -/** - * @class AsyncSubject - */ -var AsyncSubject = (function (_super) { - __extends(AsyncSubject, _super); - function AsyncSubject() { - _super.apply(this, arguments); - this.value = null; - this.hasNext = false; - this.hasCompleted = false; + // The Anything Else case + in_body_mode(t, value, arg3, arg4); + } + + function in_column_group_mode(t, value, arg3, arg4) { + switch(t) { + case 1: // TEXT + var ws = value.match(LEADINGWS); + if (ws) { + insertText(ws[0]); + value = value.substring(ws[0].length); + } + if (value.length === 0) return; + break; // Handle non-whitespace below + + case 4: // COMMENT + insertComment(value); + return; + case 5: // DOCTYPE + return; + case 2: // TAG + switch(value) { + case "html": + in_body_mode(t, value, arg3, arg4); + return; + case "col": + insertHTMLElement(value, arg3); + stack.pop(); + return; + case "template": + in_head_mode(t, value, arg3, arg4); + return; + } + break; + case 3: // ENDTAG + switch(value) { + case "colgroup": + if (!isA(stack.top, 'colgroup')) { + return; // Ignore the token. + } + stack.pop(); + parser = in_table_mode; + return; + case "col": + return; + case "template": + in_head_mode(t, value, arg3, arg4); + return; + } + break; + case -1: // EOF + in_body_mode(t, value, arg3, arg4); + return; } - AsyncSubject.prototype._subscribe = function (subscriber) { - if (this.hasError) { - subscriber.error(this.thrownError); - return Subscription_1.Subscription.EMPTY; - } - else if (this.hasCompleted && this.hasNext) { - subscriber.next(this.value); - subscriber.complete(); - return Subscription_1.Subscription.EMPTY; - } - return _super.prototype._subscribe.call(this, subscriber); - }; - AsyncSubject.prototype.next = function (value) { - if (!this.hasCompleted) { - this.value = value; - this.hasNext = true; + + // Anything else + if (!isA(stack.top, 'colgroup')) { + return; // Ignore the token. + } + in_column_group_mode(ENDTAG, "colgroup"); + parser(t, value, arg3, arg4); + } + + function in_table_body_mode(t, value, arg3, arg4) { + function endsect() { + if (!stack.inTableScope("tbody") && + !stack.inTableScope("thead") && + !stack.inTableScope("tfoot")) + return; + stack.clearToContext(tableBodyContextSet); + in_table_body_mode(ENDTAG, stack.top.localName, null); + parser(t, value, arg3, arg4); + } + + switch(t) { + case 2: // TAG + switch(value) { + case "tr": + stack.clearToContext(tableBodyContextSet); + insertHTMLElement(value, arg3); + parser = in_row_mode; + return; + case "th": + case "td": + in_table_body_mode(TAG, "tr", null); + parser(t, value, arg3, arg4); + return; + case "caption": + case "col": + case "colgroup": + case "tbody": + case "tfoot": + case "thead": + endsect(); + return; + } + break; + case 3: // ENDTAG + switch(value) { + case "table": + endsect(); + return; + case "tbody": + case "tfoot": + case "thead": + if (stack.inTableScope(value)) { + stack.clearToContext(tableBodyContextSet); + stack.pop(); + parser = in_table_mode; } - }; - AsyncSubject.prototype.error = function (error) { - if (!this.hasCompleted) { - _super.prototype.error.call(this, error); + return; + case "body": + case "caption": + case "col": + case "colgroup": + case "html": + case "td": + case "th": + case "tr": + return; + } + break; + } + + // Anything else: + in_table_mode(t, value, arg3, arg4); + } + + function in_row_mode(t, value, arg3, arg4) { + function endrow() { + if (!stack.inTableScope("tr")) return false; + stack.clearToContext(tableRowContextSet); + stack.pop(); + parser = in_table_body_mode; + return true; + } + + switch(t) { + case 2: // TAG + switch(value) { + case "th": + case "td": + stack.clearToContext(tableRowContextSet); + insertHTMLElement(value, arg3); + parser = in_cell_mode; + afe.insertMarker(); + return; + case "caption": + case "col": + case "colgroup": + case "tbody": + case "tfoot": + case "thead": + case "tr": + if (endrow()) parser(t, value, arg3, arg4); + return; + } + break; + case 3: // ENDTAG + switch(value) { + case "tr": + endrow(); + return; + case "table": + if (endrow()) parser(t, value, arg3, arg4); + return; + case "tbody": + case "tfoot": + case "thead": + if (stack.inTableScope(value)) { + if (endrow()) parser(t, value, arg3, arg4); } - }; - AsyncSubject.prototype.complete = function () { - this.hasCompleted = true; - if (this.hasNext) { - _super.prototype.next.call(this, this.value); + return; + case "body": + case "caption": + case "col": + case "colgroup": + case "html": + case "td": + case "th": + return; + } + break; + } + + // anything else + in_table_mode(t, value, arg3, arg4); + } + + function in_cell_mode(t, value, arg3, arg4) { + switch(t) { + case 2: // TAG + switch(value) { + case "caption": + case "col": + case "colgroup": + case "tbody": + case "td": + case "tfoot": + case "th": + case "thead": + case "tr": + if (stack.inTableScope("td")) { + in_cell_mode(ENDTAG, "td"); + parser(t, value, arg3, arg4); + } + else if (stack.inTableScope("th")) { + in_cell_mode(ENDTAG, "th"); + parser(t, value, arg3, arg4); } - _super.prototype.complete.call(this); - }; - return AsyncSubject; -}(Subject_1.Subject)); -exports.AsyncSubject = AsyncSubject; -//# sourceMappingURL=AsyncSubject.js.map + return; + } + break; + case 3: // ENDTAG + switch(value) { + case "td": + case "th": + if (!stack.inTableScope(value)) return; + stack.generateImpliedEndTags(); + stack.popTag(value); + afe.clearToMarker(); + parser = in_row_mode; + return; -/***/ }), -/* 26 */ + case "body": + case "caption": + case "col": + case "colgroup": + case "html": + return; + + case "table": + case "tbody": + case "tfoot": + case "thead": + case "tr": + if (!stack.inTableScope(value)) return; + in_cell_mode(ENDTAG, stack.inTableScope("td") ? "td" : "th"); + parser(t, value, arg3, arg4); + return; + } + break; + } + + // anything else + in_body_mode(t, value, arg3, arg4); + } + + function in_select_mode(t, value, arg3, arg4) { + switch(t) { + case 1: // TEXT + if (textIncludesNUL) { + value = value.replace(NULCHARS, ""); + if (value.length === 0) return; + } + insertText(value); + return; + case 4: // COMMENT + insertComment(value); + return; + case 5: // DOCTYPE + return; + case -1: // EOF + in_body_mode(t, value, arg3, arg4); + return; + case 2: // TAG + switch(value) { + case "html": + in_body_mode(t, value, arg3, arg4); + return; + case "option": + if (stack.top instanceof impl.HTMLOptionElement) + in_select_mode(ENDTAG, value); + insertHTMLElement(value, arg3); + return; + case "optgroup": + if (stack.top instanceof impl.HTMLOptionElement) + in_select_mode(ENDTAG, "option"); + if (stack.top instanceof impl.HTMLOptGroupElement) + in_select_mode(ENDTAG, value); + insertHTMLElement(value, arg3); + return; + case "select": + in_select_mode(ENDTAG, value); // treat it as a close tag + return; + + case "input": + case "keygen": + case "textarea": + if (!stack.inSelectScope("select")) return; + in_select_mode(ENDTAG, "select"); + parser(t, value, arg3, arg4); + return; + + case "script": + case "template": + in_head_mode(t, value, arg3, arg4); + return; + } + break; + case 3: // ENDTAG + switch(value) { + case "optgroup": + if (stack.top instanceof impl.HTMLOptionElement && + stack.elements[stack.elements.length-2] instanceof + impl.HTMLOptGroupElement) { + in_select_mode(ENDTAG, "option"); + } + if (stack.top instanceof impl.HTMLOptGroupElement) + stack.pop(); + + return; + + case "option": + if (stack.top instanceof impl.HTMLOptionElement) + stack.pop(); + return; + + case "select": + if (!stack.inSelectScope(value)) return; + stack.popTag(value); + resetInsertionMode(); + return; + + case "template": + in_head_mode(t, value, arg3, arg4); + return; + } + + break; + } + + // anything else: just ignore the token + } + + function in_select_in_table_mode(t, value, arg3, arg4) { + switch(value) { + case "caption": + case "table": + case "tbody": + case "tfoot": + case "thead": + case "tr": + case "td": + case "th": + switch(t) { + case 2: // TAG + in_select_in_table_mode(ENDTAG, "select"); + parser(t, value, arg3, arg4); + return; + case 3: // ENDTAG + if (stack.inTableScope(value)) { + in_select_in_table_mode(ENDTAG, "select"); + parser(t, value, arg3, arg4); + } + return; + } + } + + // anything else + in_select_mode(t, value, arg3, arg4); + } + + function in_template_mode(t, value, arg3, arg4) { + function switchModeAndReprocess(mode) { + parser = mode; + templateInsertionModes[templateInsertionModes.length-1] = parser; + parser(t, value, arg3, arg4); + } + switch(t) { + case 1: // TEXT + case 4: // COMMENT + case 5: // DOCTYPE + in_body_mode(t, value, arg3, arg4); + return; + case -1: // EOF + if (!stack.contains("template")) { + stopParsing(); + } else { + stack.popTag("template"); + afe.clearToMarker(); + templateInsertionModes.pop(); + resetInsertionMode(); + parser(t, value, arg3, arg4); + } + return; + case 2: // TAG + switch(value) { + case "base": + case "basefont": + case "bgsound": + case "link": + case "meta": + case "noframes": + case "script": + case "style": + case "template": + case "title": + in_head_mode(t, value, arg3, arg4); + return; + case "caption": + case "colgroup": + case "tbody": + case "tfoot": + case "thead": + switchModeAndReprocess(in_table_mode); + return; + case "col": + switchModeAndReprocess(in_column_group_mode); + return; + case "tr": + switchModeAndReprocess(in_table_body_mode); + return; + case "td": + case "th": + switchModeAndReprocess(in_row_mode); + return; + } + switchModeAndReprocess(in_body_mode); + return; + case 3: // ENDTAG + switch(value) { + case "template": + in_head_mode(t, value, arg3, arg4); + return; + default: + return; + } + } + } + + function after_body_mode(t, value, arg3, arg4) { + switch(t) { + case 1: // TEXT + // If any non-space chars, handle below + if (NONWS.test(value)) break; + in_body_mode(t, value); + return; + case 4: // COMMENT + // Append it to the element + stack.elements[0]._appendChild(doc.createComment(value)); + return; + case 5: // DOCTYPE + return; + case -1: // EOF + stopParsing(); + return; + case 2: // TAG + if (value === "html") { + in_body_mode(t, value, arg3, arg4); + return; + } + break; // for any other tags + case 3: // ENDTAG + if (value === "html") { + if (fragment) return; + parser = after_after_body_mode; + return; + } + break; // for any other tags + } + + // anything else + parser = in_body_mode; + parser(t, value, arg3, arg4); + } + + function in_frameset_mode(t, value, arg3, arg4) { + switch(t) { + case 1: // TEXT + // Ignore any non-space characters + value = value.replace(ALLNONWS, ""); + if (value.length > 0) insertText(value); + return; + case 4: // COMMENT + insertComment(value); + return; + case 5: // DOCTYPE + return; + case -1: // EOF + stopParsing(); + return; + case 2: // TAG + switch(value) { + case "html": + in_body_mode(t, value, arg3, arg4); + return; + case "frameset": + insertHTMLElement(value, arg3); + return; + case "frame": + insertHTMLElement(value, arg3); + stack.pop(); + return; + case "noframes": + in_head_mode(t, value, arg3, arg4); + return; + } + break; + case 3: // ENDTAG + if (value === "frameset") { + if (fragment && stack.top instanceof impl.HTMLHtmlElement) + return; + stack.pop(); + if (!fragment && + !(stack.top instanceof impl.HTMLFrameSetElement)) + parser = after_frameset_mode; + return; + } + break; + } + + // ignore anything else + } + + function after_frameset_mode(t, value, arg3, arg4) { + switch(t) { + case 1: // TEXT + // Ignore any non-space characters + value = value.replace(ALLNONWS, ""); + if (value.length > 0) insertText(value); + return; + case 4: // COMMENT + insertComment(value); + return; + case 5: // DOCTYPE + return; + case -1: // EOF + stopParsing(); + return; + case 2: // TAG + switch(value) { + case "html": + in_body_mode(t, value, arg3, arg4); + return; + case "noframes": + in_head_mode(t, value, arg3, arg4); + return; + } + break; + case 3: // ENDTAG + if (value === "html") { + parser = after_after_frameset_mode; + return; + } + break; + } + + // ignore anything else + } + + function after_after_body_mode(t, value, arg3, arg4) { + switch(t) { + case 1: // TEXT + // If any non-space chars, handle below + if (NONWS.test(value)) break; + in_body_mode(t, value, arg3, arg4); + return; + case 4: // COMMENT + doc._appendChild(doc.createComment(value)); + return; + case 5: // DOCTYPE + in_body_mode(t, value, arg3, arg4); + return; + case -1: // EOF + stopParsing(); + return; + case 2: // TAG + if (value === "html") { + in_body_mode(t, value, arg3, arg4); + return; + } + break; + } + + // anything else + parser = in_body_mode; + parser(t, value, arg3, arg4); + } + + function after_after_frameset_mode(t, value, arg3, arg4) { + switch(t) { + case 1: // TEXT + // Ignore any non-space characters + value = value.replace(ALLNONWS, ""); + if (value.length > 0) + in_body_mode(t, value, arg3, arg4); + return; + case 4: // COMMENT + doc._appendChild(doc.createComment(value)); + return; + case 5: // DOCTYPE + in_body_mode(t, value, arg3, arg4); + return; + case -1: // EOF + stopParsing(); + return; + case 2: // TAG + switch(value) { + case "html": + in_body_mode(t, value, arg3, arg4); + return; + case "noframes": + in_head_mode(t, value, arg3, arg4); + return; + } + break; + } + + // ignore anything else + } + + + // 13.2.5.5 The rules for parsing tokens in foreign content + // + // This is like one of the insertion modes above, but is + // invoked somewhat differently when the current token is not HTML. + // See the insertToken() function. + function insertForeignToken(t, value, arg3, arg4) { + // A tag is an HTML font tag if it has a color, font, or size + // attribute. Otherwise we assume it is foreign content + function isHTMLFont(attrs) { + for(var i = 0, n = attrs.length; i < n; i++) { + switch(attrs[i][0]) { + case "color": + case "face": + case "size": + return true; + } + } + return false; + } + + var current; + + switch(t) { + case 1: // TEXT + // If any non-space, non-nul characters + if (frameset_ok && NONWSNONNUL.test(value)) + frameset_ok = false; + if (textIncludesNUL) { + value = value.replace(NULCHARS, "\uFFFD"); + } + insertText(value); + return; + case 4: // COMMENT + insertComment(value); + return; + case 5: // DOCTYPE + // ignore it + return; + case 2: // TAG + switch(value) { + case "font": + if (!isHTMLFont(arg3)) break; + /* falls through */ + case "b": + case "big": + case "blockquote": + case "body": + case "br": + case "center": + case "code": + case "dd": + case "div": + case "dl": + case "dt": + case "em": + case "embed": + case "h1": + case "h2": + case "h3": + case "h4": + case "h5": + case "h6": + case "head": + case "hr": + case "i": + case "img": + case "li": + case "listing": + case "menu": + case "meta": + case "nobr": + case "ol": + case "p": + case "pre": + case "ruby": + case "s": + case "small": + case "span": + case "strong": + case "strike": + case "sub": + case "sup": + case "table": + case "tt": + case "u": + case "ul": + case "var": + if (fragment) { + break; + } + do { + stack.pop(); + current = stack.top; + } while(current.namespaceURI !== NAMESPACE.HTML && + !isMathmlTextIntegrationPoint(current) && + !isHTMLIntegrationPoint(current)); + + insertToken(t, value, arg3, arg4); // reprocess + return; + } + + // Any other start tag case goes here + current = (stack.elements.length===1 && fragment) ? fragmentContext : + stack.top; + if (current.namespaceURI === NAMESPACE.MATHML) { + adjustMathMLAttributes(arg3); + } + else if (current.namespaceURI === NAMESPACE.SVG) { + value = adjustSVGTagName(value); + adjustSVGAttributes(arg3); + } + adjustForeignAttributes(arg3); + + insertForeignElement(value, arg3, current.namespaceURI); + if (arg4) { // the self-closing flag + if (value === 'script' && current.namespaceURI === NAMESPACE.SVG) { + // XXX deal with SVG scripts here + } + stack.pop(); + } + return; + + case 3: // ENDTAG + current = stack.top; + if (value === "script" && + current.namespaceURI === NAMESPACE.SVG && + current.localName === "script") { + + stack.pop(); + + // XXX + // Deal with SVG scripts here + } + else { + // The any other end tag case + var i = stack.elements.length-1; + var node = stack.elements[i]; + for(;;) { + if (node.localName.toLowerCase() === value) { + stack.popElement(node); + break; + } + node = stack.elements[--i]; + // If non-html, keep looping + if (node.namespaceURI !== NAMESPACE.HTML) + continue; + // Otherwise process the end tag as html + parser(t, value, arg3, arg4); + break; + } + } + return; + } + } + + /*** + * Finally, this is the end of the HTMLParser() factory function. + * It returns the htmlparser object with the append() and end() methods. + */ + + // Sneak another method into the htmlparser object to allow us to run + // tokenizer tests. This can be commented out in production code. + // This is a hook for testing the tokenizer. It has to be here + // because the tokenizer details are all hidden away within the closure. + // It should return an array of tokens generated while parsing the + // input string. + htmlparser.testTokenizer = function(input, initialState, lastStartTag, charbychar) { + var tokens = []; + + switch(initialState) { + case "PCDATA state": + tokenizer = data_state; + break; + case "RCDATA state": + tokenizer = rcdata_state; + break; + case "RAWTEXT state": + tokenizer = rawtext_state; + break; + case "PLAINTEXT state": + tokenizer = plaintext_state; + break; + } + + if (lastStartTag) { + lasttagname = lastStartTag; + } + + insertToken = function(t, value, arg3, arg4) { + flushText(); + switch(t) { + case 1: // TEXT + if (tokens.length > 0 && + tokens[tokens.length-1][0] === "Character") { + tokens[tokens.length-1][1] += value; + } + else tokens.push(["Character", value]); + break; + case 4: // COMMENT + tokens.push(["Comment", value]); + break; + case 5: // DOCTYPE + tokens.push(["DOCTYPE", value, + arg3 === undefined ? null : arg3, + arg4 === undefined ? null : arg4, + !force_quirks]); + break; + case 2: // TAG + var attrs = Object.create(null); + for(var i = 0; i < arg3.length; i++) { + // XXX: does attribute order matter? + var a = arg3[i]; + if (a.length === 1) { + attrs[a[0]] = ""; + } + else { + attrs[a[0]] = a[1]; + } + } + var token = ["StartTag", value, attrs]; + if (arg4) token.push(true); + tokens.push(token); + break; + case 3: // ENDTAG + tokens.push(["EndTag", value]); + break; + case -1: // EOF + break; + } + }; + + if (!charbychar) { + this.parse(input, true); + } + else { + for(var i = 0; i < input.length; i++) { + this.parse(input[i]); + } + this.parse("", true); + } + return tokens; + }; + + // Return the parser object from the HTMLParser() factory function + return htmlparser; +} + + +/***/ }), +/* 20 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; -var Subject_1 = __webpack_require__(6); -var queue_1 = __webpack_require__(71); -var Subscription_1 = __webpack_require__(9); -var observeOn_1 = __webpack_require__(87); -var ObjectUnsubscribedError_1 = __webpack_require__(80); -var SubjectSubscription_1 = __webpack_require__(385); -/** - * @class ReplaySubject - */ -var ReplaySubject = (function (_super) { - __extends(ReplaySubject, _super); - function ReplaySubject(bufferSize, windowTime, scheduler) { - if (bufferSize === void 0) { bufferSize = Number.POSITIVE_INFINITY; } - if (windowTime === void 0) { windowTime = Number.POSITIVE_INFINITY; } - _super.call(this); - this.scheduler = scheduler; - this._events = []; - this._bufferSize = bufferSize < 1 ? 1 : bufferSize; - this._windowTime = windowTime < 1 ? 1 : windowTime; - } - ReplaySubject.prototype.next = function (value) { - var now = this._getNow(); - this._events.push(new ReplayEvent(now, value)); - this._trimBufferThenGetEvents(); - _super.prototype.next.call(this, value); - }; - ReplaySubject.prototype._subscribe = function (subscriber) { - var _events = this._trimBufferThenGetEvents(); - var scheduler = this.scheduler; - var subscription; - if (this.closed) { - throw new ObjectUnsubscribedError_1.ObjectUnsubscribedError(); +module.exports = URL; + +function URL(url) { + if (!url) return Object.create(URL.prototype); + // Can't use String.trim() since it defines whitespace differently than HTML + this.url = url.replace(/^[ \t\n\r\f]+|[ \t\n\r\f]+$/g, ""); + + // See http://tools.ietf.org/html/rfc3986#appendix-B + // and https://url.spec.whatwg.org/#parsing + var match = URL.pattern.exec(this.url); + if (match) { + if (match[2]) this.scheme = match[2]; + if (match[4]) { + // parse username/password + var userinfo = match[4].match(URL.userinfoPattern); + if (userinfo) { + this.username = userinfo[1]; + this.password = userinfo[3]; + match[4] = match[4].substring(userinfo[0].length); + } + if (match[4].match(URL.portPattern)) { + var pos = match[4].lastIndexOf(':'); + this.host = match[4].substring(0, pos); + this.port = match[4].substring(pos+1); + } + else { + this.host = match[4]; + } + } + if (match[5]) this.path = match[5]; + if (match[6]) this.query = match[7]; + if (match[8]) this.fragment = match[9]; + } +} + +URL.pattern = /^(([^:\/?#]+):)?(\/\/([^\/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?$/; +URL.userinfoPattern = /^([^@:]*)(:([^@]*))?@/; +URL.portPattern = /:\d+$/; +URL.authorityPattern = /^[^:\/?#]+:\/\//; +URL.hierarchyPattern = /^[^:\/?#]+:\//; + +// Return a percentEncoded version of s. +// S should be a single-character string +// XXX: needs to do utf-8 encoding? +URL.percentEncode = function percentEncode(s) { + var c = s.charCodeAt(0); + if (c < 256) return "%" + c.toString(16); + else throw Error("can't percent-encode codepoints > 255 yet"); +}; + +URL.prototype = { + constructor: URL, + + // XXX: not sure if this is the precise definition of absolute + isAbsolute: function() { return !!this.scheme; }, + isAuthorityBased: function() { + return URL.authorityPattern.test(this.url); + }, + isHierarchical: function() { + return URL.hierarchyPattern.test(this.url); + }, + + toString: function() { + var s = ""; + if (this.scheme !== undefined) s += this.scheme + ":"; + if (this.isAbsolute()) { + s += '//'; + if (this.username || this.password) { + s += this.username || ''; + if (this.password) { + s += ':' + this.password; + } + s += '@'; + } + s += this.host; + } + if (this.port !== undefined) s += ":" + this.port; + if (this.path !== undefined) s += this.path; + if (this.query !== undefined) s += "?" + this.query; + if (this.fragment !== undefined) s += "#" + this.fragment; + return s; + }, + + // See: http://tools.ietf.org/html/rfc3986#section-5.2 + // and https://url.spec.whatwg.org/#constructors + resolve: function(relative) { + var base = this; // The base url we're resolving against + var r = new URL(relative); // The relative reference url to resolve + var t = new URL(); // The absolute target url we will return + + if (r.scheme !== undefined) { + t.scheme = r.scheme; + t.username = r.username; + t.password = r.password; + t.host = r.host; + t.port = r.port; + t.path = remove_dot_segments(r.path); + t.query = r.query; + } + else { + t.scheme = base.scheme; + if (r.host !== undefined) { + t.username = r.username; + t.password = r.password; + t.host = r.host; + t.port = r.port; + t.path = remove_dot_segments(r.path); + t.query = r.query; + } + else { + t.username = base.username; + t.password = base.password; + t.host = base.host; + t.port = base.port; + if (!r.path) { // undefined or empty + t.path = base.path; + if (r.query !== undefined) + t.query = r.query; + else + t.query = base.query; + } + else { + if (r.path.charAt(0) === "/") { + t.path = remove_dot_segments(r.path); + } + else { + t.path = merge(base.path, r.path); + t.path = remove_dot_segments(t.path); + } + t.query = r.query; + } + } + } + t.fragment = r.fragment; + + return t.toString(); + + + function merge(basepath, refpath) { + if (base.host !== undefined && !base.path) + return "/" + refpath; + + var lastslash = basepath.lastIndexOf("/"); + if (lastslash === -1) + return refpath; + else + return basepath.substring(0, lastslash+1) + refpath; + } + + function remove_dot_segments(path) { + if (!path) return path; // For "" or undefined + + var output = ""; + while(path.length > 0) { + if (path === "." || path === "..") { + path = ""; + break; } - else if (this.hasError) { - subscription = Subscription_1.Subscription.EMPTY; + + var twochars = path.substring(0,2); + var threechars = path.substring(0,3); + var fourchars = path.substring(0,4); + if (threechars === "../") { + path = path.substring(3); } - else if (this.isStopped) { - subscription = Subscription_1.Subscription.EMPTY; + else if (twochars === "./") { + path = path.substring(2); } - else { - this.observers.push(subscriber); - subscription = new SubjectSubscription_1.SubjectSubscription(this, subscriber); + else if (threechars === "/./") { + path = "/" + path.substring(3); } - if (scheduler) { - subscriber.add(subscriber = new observeOn_1.ObserveOnSubscriber(subscriber, scheduler)); - } - var len = _events.length; - for (var i = 0; i < len && !subscriber.closed; i++) { - subscriber.next(_events[i].value); - } - if (this.hasError) { - subscriber.error(this.thrownError); - } - else if (this.isStopped) { - subscriber.complete(); - } - return subscription; - }; - ReplaySubject.prototype._getNow = function () { - return (this.scheduler || queue_1.queue).now(); - }; - ReplaySubject.prototype._trimBufferThenGetEvents = function () { - var now = this._getNow(); - var _bufferSize = this._bufferSize; - var _windowTime = this._windowTime; - var _events = this._events; - var eventsCount = _events.length; - var spliceCount = 0; - // Trim events that fall out of the time window. - // Start at the front of the list. Break early once - // we encounter an event that falls within the window. - while (spliceCount < eventsCount) { - if ((now - _events[spliceCount].time) < _windowTime) { - break; - } - spliceCount++; + else if (twochars === "/." && path.length === 2) { + path = "/"; } - if (eventsCount > _bufferSize) { - spliceCount = Math.max(spliceCount, eventsCount - _bufferSize); + else if (fourchars === "/../" || + (threechars === "/.." && path.length === 3)) { + path = "/" + path.substring(4); + + output = output.replace(/\/?[^\/]*$/, ""); } - if (spliceCount > 0) { - _events.splice(0, spliceCount); + else { + var segment = path.match(/(\/?([^\/]*))/)[0]; + output += segment; + path = path.substring(segment.length); } - return _events; - }; - return ReplaySubject; -}(Subject_1.Subject)); -exports.ReplaySubject = ReplaySubject; -var ReplayEvent = (function () { - function ReplayEvent(time, value) { - this.time = time; - this.value = value; + } + + return output; } - return ReplayEvent; -}()); -//# sourceMappingURL=ReplaySubject.js.map + }, +}; + /***/ }), -/* 27 */ +/* 21 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -function isDate(value) { - return value instanceof Date && !isNaN(+value); +var DOMImplementation = __webpack_require__(9); +var EventTarget = __webpack_require__(33); +var Location = __webpack_require__(75); +var sloppy = __webpack_require__(47); +var utils = __webpack_require__(1); + +module.exports = Window; + +function Window(document) { + this.document = document || new DOMImplementation().createHTMLDocument(""); + this.document._scripting_enabled = true; + this.document.defaultView = this; + this.location = new Location(this, this.document._address || 'about:blank'); } -exports.isDate = isDate; -//# sourceMappingURL=isDate.js.map + +Window.prototype = Object.create(EventTarget.prototype, { + _run: { value: sloppy.Window_run }, + console: { value: console }, + history: { value: { + back: utils.nyi, + forward: utils.nyi, + go: utils.nyi + }}, + navigator: { value: __webpack_require__(77) }, + + // Self-referential properties + window: { get: function() { return this; }}, + self: { get: function() { return this; }}, + frames: { get: function() { return this; }}, + + // Self-referential properties for a top-level window + parent: { get: function() { return this; }}, + top: { get: function() { return this; }}, + + // We don't support any other windows for now + length: { value: 0 }, // no frames + frameElement: { value: null }, // not part of a frame + opener: { value: null }, // not opened by another window + + // The onload event handler. + // XXX: need to support a bunch of other event types, too, + // and have them interoperate with document.body. + + onload: { + get: function() { + return this._getEventHandler("load"); + }, + set: function(v) { + this._setEventHandler("load", v); + } + }, + + // XXX This is a completely broken implementation + getComputedStyle: { value: function getComputedStyle(elt) { + return elt.style; + }} + +}); + +utils.expose(__webpack_require__(80), Window); +utils.expose(__webpack_require__(46), Window); + /***/ }), -/* 28 */ +/* 22 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -var isArray_1 = __webpack_require__(15); -function isNumeric(val) { - // parseFloat NaNs numeric-cast false positives (null|true|false|"") - // ...but misinterprets leading-number strings, particularly hex literals ("0x...") - // subtraction forces infinities to NaN - // adding 1 corrects loss of precision from parseFloat (#15100) - return !isArray_1.isArray(val) && (val - parseFloat(val) + 1) >= 0; +var Node = __webpack_require__(3); +var Element = __webpack_require__(6); +var CSSStyleDeclaration = __webpack_require__(15); +var utils = __webpack_require__(1); +var URLUtils = __webpack_require__(41); +var defineElement = __webpack_require__(44); + +var htmlElements = exports.elements = {}; +var htmlNameToImpl = Object.create(null); + +exports.createElement = function(doc, localName, prefix) { + var impl = htmlNameToImpl[localName] || HTMLUnknownElement; + return new impl(doc, localName, prefix); +}; + +function define(spec) { + return defineElement(spec, HTMLElement, htmlElements, htmlNameToImpl); } -exports.isNumeric = isNumeric; -; -//# sourceMappingURL=isNumeric.js.map -/***/ }), -/* 29 */ -/***/ (function(module, exports, __webpack_require__) { +function URL(attr) { + return { + get: function() { + var v = this._getattr(attr); + if (v === null) { return ''; } + var url = this.doc._resolve(v); + return (url === null) ? v : url; + }, + set: function(value) { + this._setattr(attr, value); + } + }; +} -module.exports = (__webpack_require__(1))(38); +function CORS(attr) { + return { + get: function() { + var v = this._getattr(attr); + if (v === null) { return null; } + if (v.toLowerCase() === 'use-credentials') { return 'use-credentials'; } + return 'anonymous'; + }, + set: function(value) { + if (value===null || value===undefined) { + this.removeAttribute(attr); + } else { + this._setattr(attr, value); + } + } + }; +} -/***/ }), -/* 30 */ -/***/ (function(module, exports, __webpack_require__) { +var REFERRER = { + type: ["", "no-referrer", "no-referrer-when-downgrade", "same-origin", "origin", "strict-origin", "origin-when-cross-origin", "strict-origin-when-cross-origin", "unsafe-url"], + missing: '', +}; -module.exports = (__webpack_require__(1))(67); -/***/ }), -/* 31 */ -/***/ (function(module, exports) { +// XXX: the default value for tabIndex should be 0 if the element is +// focusable and -1 if it is not. But the full definition of focusable +// is actually hard to compute, so for now, I'll follow Firefox and +// just base the default value on the type of the element. +var focusableElements = { + "A":true, "LINK":true, "BUTTON":true, "INPUT":true, + "SELECT":true, "TEXTAREA":true, "COMMAND":true +}; -module.exports = require("stream"); +var HTMLFormElement = function(doc, localName, prefix) { + HTMLElement.call(this, doc, localName, prefix); + this._form = null; // Prevent later deoptimization +}; -/***/ }), -/* 32 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { +var HTMLElement = exports.HTMLElement = define({ + superclass: Element, + ctor: function HTMLElement(doc, localName, prefix) { + Element.call(this, doc, localName, utils.NAMESPACE.HTML, prefix); + }, + props: { + innerHTML: { + get: function() { + return this.serialize(); + }, + set: function(v) { + var parser = this.ownerDocument.implementation.mozHTMLParser( + this.ownerDocument._address, + this); + parser.parse(v, true); + var tmpdoc = parser.document(); + var root = tmpdoc.firstChild; + var target = (this instanceof htmlNameToImpl.template) ? + this.content : this; -"use strict"; -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return AuthService; }); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__(10); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0__angular_core__); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__angular_http__ = __webpack_require__(29); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__angular_http___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1__angular_http__); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_angular_auth_oidc_client__ = __webpack_require__(47); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_angular_auth_oidc_client___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2_angular_auth_oidc_client__); -var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { - var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; - if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); - else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; - return c > 3 && r && Object.defineProperty(target, key, r), r; -}; -var __metadata = (this && this.__metadata) || function (k, v) { - if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); -}; -var __param = (this && this.__param) || function (paramIndex, decorator) { - return function (target, key) { decorator(target, key, paramIndex); } -}; - - - -var AuthService = (function () { - function AuthService(oidcSecurityService, http, originUrl, identityUrl) { - var _this = this; - this.oidcSecurityService = oidcSecurityService; - this.http = http; - var openIdImplicitFlowConfiguration = new __WEBPACK_IMPORTED_MODULE_2_angular_auth_oidc_client__["OpenIDImplicitFlowConfiguration"](); - openIdImplicitFlowConfiguration.stsServer = identityUrl; - openIdImplicitFlowConfiguration.redirect_url = originUrl + 'callback'; - openIdImplicitFlowConfiguration.client_id = 'ng'; - openIdImplicitFlowConfiguration.response_type = 'id_token token'; - openIdImplicitFlowConfiguration.scope = 'openid profile apiApp'; - openIdImplicitFlowConfiguration.post_logout_redirect_uri = originUrl + 'home'; - openIdImplicitFlowConfiguration.forbidden_route = '/forbidden'; - openIdImplicitFlowConfiguration.unauthorized_route = '/unauthorized'; - openIdImplicitFlowConfiguration.auto_userinfo = true; - openIdImplicitFlowConfiguration.log_console_warning_active = true; - openIdImplicitFlowConfiguration.log_console_debug_active = false; - openIdImplicitFlowConfiguration.max_id_token_iat_offset_allowed_in_seconds = 10; - this.oidcSecurityService.setupModule(openIdImplicitFlowConfiguration); - if (this.oidcSecurityService.moduleSetup) { - this.doCallbackLogicIfRequired(); - } - else { - this.oidcSecurityService.onModuleSetup.subscribe(function () { - _this.doCallbackLogicIfRequired(); - }); - } - } - AuthService.prototype.ngOnInit = function () { - var _this = this; - this.isAuthorizedSubscription = this.oidcSecurityService.getIsAuthorized().subscribe(function (isAuthorized) { - _this.isAuthorized = isAuthorized; - }); - }; - AuthService.prototype.ngOnDestroy = function () { - this.isAuthorizedSubscription.unsubscribe(); - this.oidcSecurityService.onModuleSetup.unsubscribe(); - }; - AuthService.prototype.getIsAuthorized = function () { - return this.oidcSecurityService.getIsAuthorized(); - }; - AuthService.prototype.login = function () { - console.log('start login'); - this.oidcSecurityService.authorize(); - }; - AuthService.prototype.refreshSession = function () { - console.log('start refreshSession'); - this.oidcSecurityService.authorize(); - }; - AuthService.prototype.logout = function () { - console.log('start logoff'); - this.oidcSecurityService.logoff(); - }; - AuthService.prototype.doCallbackLogicIfRequired = function () { - if (typeof location !== "undefined" && window.location.hash) { - this.oidcSecurityService.authorizedCallback(); - } - }; - AuthService.prototype.get = function (url, options) { - return this.http.get(url, this.setRequestOptions(options)); - }; - AuthService.prototype.put = function (url, data, options) { - var body = JSON.stringify(data); - return this.http.put(url, body, this.setRequestOptions(options)); - }; - AuthService.prototype.delete = function (url, options) { - return this.http.delete(url, this.setRequestOptions(options)); - }; - AuthService.prototype.post = function (url, data, options) { - var body = JSON.stringify(data); - return this.http.post(url, body, this.setRequestOptions(options)); - }; - AuthService.prototype.setRequestOptions = function (options) { - if (options) { - this.appendAuthHeader(options.headers); - } - else { - options = new __WEBPACK_IMPORTED_MODULE_1__angular_http__["RequestOptions"]({ headers: this.getHeaders(), body: "" }); - } - return options; - }; - AuthService.prototype.getHeaders = function () { - var headers = new __WEBPACK_IMPORTED_MODULE_1__angular_http__["Headers"](); - headers.append('Content-Type', 'application/json'); - this.appendAuthHeader(headers); - return headers; - }; - AuthService.prototype.appendAuthHeader = function (headers) { - if (headers == null) - headers = this.getHeaders(); - var token = this.oidcSecurityService.getToken(); - if (token == '') - return; - var tokenValue = 'Bearer ' + token; - headers.append('Authorization', tokenValue); - }; - AuthService = __decorate([ - __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Injectable"])(), - __param(2, __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Inject"])('ORIGIN_URL')), - __param(3, __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Inject"])('IDENTITY_URL')), - __metadata("design:paramtypes", [__WEBPACK_IMPORTED_MODULE_2_angular_auth_oidc_client__["OidcSecurityService"], - __WEBPACK_IMPORTED_MODULE_1__angular_http__["Http"], String, String]) - ], AuthService); - return AuthService; -}()); - + // Remove any existing children of this node + while(target.hasChildNodes()) + target.removeChild(target.firstChild); + // Now copy newly parsed children from the root to this node + target.doc.adoptNode(root); + while(root.hasChildNodes()) { + target.appendChild(root.firstChild); + } + } + }, + style: { get: function() { + if (!this._style) + this._style = new CSSStyleDeclaration(this); + return this._style; + }}, + + click: { value: function() { + if (this._click_in_progress) return; + this._click_in_progress = true; + try { + if (this._pre_click_activation_steps) + this._pre_click_activation_steps(); + + var event = this.ownerDocument.createEvent("MouseEvent"); + event.initMouseEvent("click", true, true, + this.ownerDocument.defaultView, 1, + 0, 0, 0, 0, + // These 4 should be initialized with + // the actually current keyboard state + // somehow... + false, false, false, false, + 0, null + ); + + // Dispatch this as an untrusted event since it is synthetic + var success = this.dispatchEvent(event); + + if (success) { + if (this._post_click_activation_steps) + this._post_click_activation_steps(event); + } + else { + if (this._cancelled_activation_steps) + this._cancelled_activation_steps(); + } + } + finally { + this._click_in_progress = false; + } + }} + }, + attributes: { + title: String, + lang: String, + dir: {type: ["ltr", "rtl", "auto"], missing: ''}, + accessKey: String, + hidden: Boolean, + tabIndex: {type: "long", default: function() { + if (this.tagName in focusableElements || + this.contentEditable) + return 0; + else + return -1; + }} + }, + events: [ + "abort", "canplay", "canplaythrough", "change", "click", "contextmenu", + "cuechange", "dblclick", "drag", "dragend", "dragenter", "dragleave", + "dragover", "dragstart", "drop", "durationchange", "emptied", "ended", + "input", "invalid", "keydown", "keypress", "keyup", "loadeddata", + "loadedmetadata", "loadstart", "mousedown", "mousemove", "mouseout", + "mouseover", "mouseup", "mousewheel", "pause", "play", "playing", + "progress", "ratechange", "readystatechange", "reset", "seeked", + "seeking", "select", "show", "stalled", "submit", "suspend", + "timeupdate", "volumechange", "waiting", + + // These last 5 event types will be overriden by HTMLBodyElement + "blur", "error", "focus", "load", "scroll" + ] +}); -/***/ }), -/* 33 */ -/***/ (function(module, exports, __webpack_require__) { -"use strict"; +// XXX: reflect contextmenu as contextMenu, with element type -var DOCUMENT_MODE = __webpack_require__(11).DOCUMENT_MODE; - -//Const -var VALID_DOCTYPE_NAME = 'html', - QUIRKS_MODE_SYSTEM_ID = 'http://www.ibm.com/data/dtd/v11/ibmxhtml1-transitional.dtd', - QUIRKS_MODE_PUBLIC_ID_PREFIXES = [ - '+//silmaril//dtd html pro v0r11 19970101//en', - '-//advasoft ltd//dtd html 3.0 aswedit + extensions//en', - '-//as//dtd html 3.0 aswedit + extensions//en', - '-//ietf//dtd html 2.0 level 1//en', - '-//ietf//dtd html 2.0 level 2//en', - '-//ietf//dtd html 2.0 strict level 1//en', - '-//ietf//dtd html 2.0 strict level 2//en', - '-//ietf//dtd html 2.0 strict//en', - '-//ietf//dtd html 2.0//en', - '-//ietf//dtd html 2.1e//en', - '-//ietf//dtd html 3.0//en', - '-//ietf//dtd html 3.0//en//', - '-//ietf//dtd html 3.2 final//en', - '-//ietf//dtd html 3.2//en', - '-//ietf//dtd html 3//en', - '-//ietf//dtd html level 0//en', - '-//ietf//dtd html level 0//en//2.0', - '-//ietf//dtd html level 1//en', - '-//ietf//dtd html level 1//en//2.0', - '-//ietf//dtd html level 2//en', - '-//ietf//dtd html level 2//en//2.0', - '-//ietf//dtd html level 3//en', - '-//ietf//dtd html level 3//en//3.0', - '-//ietf//dtd html strict level 0//en', - '-//ietf//dtd html strict level 0//en//2.0', - '-//ietf//dtd html strict level 1//en', - '-//ietf//dtd html strict level 1//en//2.0', - '-//ietf//dtd html strict level 2//en', - '-//ietf//dtd html strict level 2//en//2.0', - '-//ietf//dtd html strict level 3//en', - '-//ietf//dtd html strict level 3//en//3.0', - '-//ietf//dtd html strict//en', - '-//ietf//dtd html strict//en//2.0', - '-//ietf//dtd html strict//en//3.0', - '-//ietf//dtd html//en', - '-//ietf//dtd html//en//2.0', - '-//ietf//dtd html//en//3.0', - '-//metrius//dtd metrius presentational//en', - '-//microsoft//dtd internet explorer 2.0 html strict//en', - '-//microsoft//dtd internet explorer 2.0 html//en', - '-//microsoft//dtd internet explorer 2.0 tables//en', - '-//microsoft//dtd internet explorer 3.0 html strict//en', - '-//microsoft//dtd internet explorer 3.0 html//en', - '-//microsoft//dtd internet explorer 3.0 tables//en', - '-//netscape comm. corp.//dtd html//en', - '-//netscape comm. corp.//dtd strict html//en', - '-//o\'reilly and associates//dtd html 2.0//en', - '-//o\'reilly and associates//dtd html extended 1.0//en', - '-//spyglass//dtd html 2.0 extended//en', - '-//sq//dtd html 2.0 hotmetal + extensions//en', - '-//sun microsystems corp.//dtd hotjava html//en', - '-//sun microsystems corp.//dtd hotjava strict html//en', - '-//w3c//dtd html 3 1995-03-24//en', - '-//w3c//dtd html 3.2 draft//en', - '-//w3c//dtd html 3.2 final//en', - '-//w3c//dtd html 3.2//en', - '-//w3c//dtd html 3.2s draft//en', - '-//w3c//dtd html 4.0 frameset//en', - '-//w3c//dtd html 4.0 transitional//en', - '-//w3c//dtd html experimental 19960712//en', - '-//w3c//dtd html experimental 970421//en', - '-//w3c//dtd w3 html//en', - '-//w3o//dtd w3 html 3.0//en', - '-//w3o//dtd w3 html 3.0//en//', - '-//webtechs//dtd mozilla html 2.0//en', - '-//webtechs//dtd mozilla html//en' - ], - QUIRKS_MODE_NO_SYSTEM_ID_PUBLIC_ID_PREFIXES = QUIRKS_MODE_PUBLIC_ID_PREFIXES.concat([ - '-//w3c//dtd html 4.01 frameset//', - '-//w3c//dtd html 4.01 transitional//' - ]), - QUIRKS_MODE_PUBLIC_IDS = [ - '-//w3o//dtd w3 html strict 3.0//en//', - '-/w3c/dtd html 4.0 transitional/en', - 'html' - ], - LIMITED_QUIRKS_PUBLIC_ID_PREFIXES = [ - '-//W3C//DTD XHTML 1.0 Frameset//', - '-//W3C//DTD XHTML 1.0 Transitional//' - ], - LIMITED_QUIRKS_WITH_SYSTEM_ID_PUBLIC_ID_PREFIXES = LIMITED_QUIRKS_PUBLIC_ID_PREFIXES.concat([ - '-//W3C//DTD HTML 4.01 Frameset//', - '-//W3C//DTD HTML 4.01 Transitional//' - ]); +// style: the spec doesn't call this a reflected attribute. +// may want to handle it manually. +// contentEditable: enumerated, not clear if it is actually +// reflected or requires custom getter/setter. Not listed as +// "limited to known values". Raises syntax_err on bad setting, +// so I think this is custom. -//Utils -function enquoteDoctypeId(id) { - var quote = id.indexOf('"') !== -1 ? '\'' : '"'; +// contextmenu: content is element id, idl type is an element +// draggable: boolean, but not a reflected attribute +// dropzone: reflected SettableTokenList, experimental, so don't +// implement it right away. - return quote + id + quote; -} +// data-* attributes: need special handling in setAttribute? +// Or maybe that isn't necessary. Can I just scan the attribute list +// when building the dataset? Liveness and caching issues? -function hasPrefix(publicId, prefixes) { - for (var i = 0; i < prefixes.length; i++) { - if (publicId.indexOf(prefixes[i]) === 0) - return true; - } +// microdata attributes: many are simple reflected attributes, but +// I'm not going to implement this now. - return false; -} +var HTMLUnknownElement = define({ + ctor: function HTMLUnknownElement(doc, localName, prefix) { + HTMLElement.call(this, doc, localName, prefix); + } +}); -//API -exports.getDocumentMode = function (name, publicId, systemId) { - if (name !== VALID_DOCTYPE_NAME) - return DOCUMENT_MODE.QUIRKS; - if (systemId && systemId.toLowerCase() === QUIRKS_MODE_SYSTEM_ID) - return DOCUMENT_MODE.QUIRKS; +var formAssociatedProps = { + // See http://www.w3.org/TR/html5/association-of-controls-and-forms.html#form-owner + form: { get: function() { + return this._form; + }} +}; + +define({ + tag: 'a', + ctor: function HTMLAnchorElement(doc, localName, prefix) { + HTMLElement.call(this, doc, localName, prefix); + }, + props: { + _post_click_activation_steps: { value: function(e) { + if (this.href) { + // Follow the link + // XXX: this is just a quick hack + // XXX: the HTML spec probably requires more than this + this.ownerDocument.defaultView.location = this.href; + } + }}, + blur: { value: function() {}}, + focus: { value: function() {}} + }, + attributes: { + href: URL, + ping: String, + download: String, + target: String, + rel: String, + media: String, + hreflang: String, + type: String, + referrerPolicy: REFERRER, + // Obsolete + coords: String, + charset: String, + name: String, + rev: String, + shape: String, + } +}); +URLUtils._inherit(htmlNameToImpl.a.prototype); + +define({ + tag: 'area', + ctor: function HTMLAreaElement(doc, localName, prefix) { + HTMLElement.call(this, doc, localName, prefix); + }, + attributes: { + alt: String, + target: String, + download: String, + rel: String, + media: String, + href: URL, + hreflang: String, + type: String, + shape: String, + coords: String, + ping: String, + // XXX: also reflect relList + referrerPolicy: REFERRER, + // Obsolete + noHref: Boolean, + } +}); - if (publicId !== null) { - publicId = publicId.toLowerCase(); +define({ + tag: 'br', + ctor: function HTMLBRElement(doc, localName, prefix) { + HTMLElement.call(this, doc, localName, prefix); + }, + attributes: { + // Obsolete + clear: String + }, +}); - if (QUIRKS_MODE_PUBLIC_IDS.indexOf(publicId) > -1) - return DOCUMENT_MODE.QUIRKS; +define({ + tag: 'base', + ctor: function HTMLBaseElement(doc, localName, prefix) { + HTMLElement.call(this, doc, localName, prefix); + }, + attributes: { + "target": String + } +}); - var prefixes = systemId === null ? QUIRKS_MODE_NO_SYSTEM_ID_PUBLIC_ID_PREFIXES : QUIRKS_MODE_PUBLIC_ID_PREFIXES; - if (hasPrefix(publicId, prefixes)) - return DOCUMENT_MODE.QUIRKS; +define({ + tag: 'body', + ctor: function HTMLBodyElement(doc, localName, prefix) { + HTMLElement.call(this, doc, localName, prefix); + }, + // Certain event handler attributes on a tag actually set + // handlers for the window rather than just that element. Define + // getters and setters for those here. Note that some of these override + // properties on HTMLElement.prototype. + // XXX: If I add support for , these have to go there, too + // XXX + // When the Window object is implemented, these attribute will have + // to work with the same-named attributes on the Window. + events: [ + "afterprint", "beforeprint", "beforeunload", "blur", "error", + "focus","hashchange", "load", "message", "offline", "online", + "pagehide", "pageshow","popstate","resize","scroll","storage","unload", + ], + attributes: { + // Obsolete + text: { type: String, treatNullAsEmptyString: true }, + link: { type: String, treatNullAsEmptyString: true }, + vLink: { type: String, treatNullAsEmptyString: true }, + aLink: { type: String, treatNullAsEmptyString: true }, + bgColor: { type: String, treatNullAsEmptyString: true }, + background: String, + } +}); - prefixes = systemId === null ? LIMITED_QUIRKS_PUBLIC_ID_PREFIXES : LIMITED_QUIRKS_WITH_SYSTEM_ID_PUBLIC_ID_PREFIXES; +define({ + tag: 'button', + ctor: function HTMLButtonElement(doc, localName, prefix) { + HTMLFormElement.call(this, doc, localName, prefix); + }, + props: formAssociatedProps, + attributes: { + name: String, + value: String, + disabled: Boolean, + autofocus: Boolean, + type: { type:["submit", "reset", "button", "menu"], missing: 'submit' }, + formTarget: String, + formNoValidate: Boolean, + formMethod: { type: ["get", "post", "dialog"], invalid: 'get', missing: '' }, + formEnctype: { type: ["application/x-www-form-urlencoded", "multipart/form-data", "text/plain"], invalid: "application/x-www-form-urlencoded", missing: '' }, + } +}); - if (hasPrefix(publicId, prefixes)) - return DOCUMENT_MODE.LIMITED_QUIRKS; - } +define({ + tag: 'dl', + ctor: function HTMLDListElement(doc, localName, prefix) { + HTMLElement.call(this, doc, localName, prefix); + }, + attributes: { + // Obsolete + compact: Boolean, + } +}); - return DOCUMENT_MODE.NO_QUIRKS; -}; +define({ + tag: 'data', + ctor: function HTMLDataElement(doc, localName, prefix) { + HTMLElement.call(this, doc, localName, prefix); + }, + attributes: { + value: String, + } +}); -exports.serializeContent = function (name, publicId, systemId) { - var str = '!DOCTYPE '; +define({ + tag: 'datalist', + ctor: function HTMLDataListElement(doc, localName, prefix) { + HTMLElement.call(this, doc, localName, prefix); + } +}); - if (name) - str += name; +define({ + tag: 'details', + ctor: function HTMLDetailsElement(doc, localName, prefix) { + HTMLElement.call(this, doc, localName, prefix); + }, + attributes: { + "open": Boolean + } +}); - if (publicId !== null) - str += ' PUBLIC ' + enquoteDoctypeId(publicId); +define({ + tag: 'div', + ctor: function HTMLDivElement(doc, localName, prefix) { + HTMLElement.call(this, doc, localName, prefix); + }, + attributes: { + // Obsolete + align: String + } +}); - else if (systemId !== null) - str += ' SYSTEM'; +define({ + tag: 'embed', + ctor: function HTMLEmbedElement(doc, localName, prefix) { + HTMLElement.call(this, doc, localName, prefix); + }, + attributes: { + src: URL, + type: String, + width: String, + height: String, + // Obsolete + align: String, + name: String, + } +}); - if (systemId !== null) - str += ' ' + enquoteDoctypeId(systemId); +define({ + tag: 'fieldset', + ctor: function HTMLFieldSetElement(doc, localName, prefix) { + HTMLFormElement.call(this, doc, localName, prefix); + }, + props: formAssociatedProps, + attributes: { + disabled: Boolean, + name: String + } +}); - return str; -}; +define({ + tag: 'form', + ctor: function HTMLFormElement(doc, localName, prefix) { + HTMLElement.call(this, doc, localName, prefix); + }, + attributes: { + action: String, + autocomplete: {type:['on', 'off'], missing: 'on'}, + name: String, + acceptCharset: {name: "accept-charset"}, + target: String, + noValidate: Boolean, + method: { type: ["get", "post", "dialog"], invalid: 'get', missing: 'get' }, + // Both enctype and encoding reflect the enctype content attribute + enctype: { type: ["application/x-www-form-urlencoded", "multipart/form-data", "text/plain"], invalid: "application/x-www-form-urlencoded", missing: "application/x-www-form-urlencoded" }, + encoding: {name: 'enctype', type: ["application/x-www-form-urlencoded", "multipart/form-data", "text/plain"], invalid: "application/x-www-form-urlencoded", missing: "application/x-www-form-urlencoded" }, + } +}); +define({ + tag: 'hr', + ctor: function HTMLHRElement(doc, localName, prefix) { + HTMLElement.call(this, doc, localName, prefix); + }, + attributes: { + // Obsolete + align: String, + color: String, + noShade: Boolean, + size: String, + width: String, + }, +}); -/***/ }), -/* 34 */ -/***/ (function(module, exports, __webpack_require__) { +define({ + tag: 'head', + ctor: function HTMLHeadElement(doc, localName, prefix) { + HTMLElement.call(this, doc, localName, prefix); + } +}); -"use strict"; +define({ + tags: ['h1','h2','h3','h4','h5','h6'], + ctor: function HTMLHeadingElement(doc, localName, prefix) { + HTMLElement.call(this, doc, localName, prefix); + }, + attributes: { + // Obsolete + align: String, + }, +}); +define({ + tag: 'html', + ctor: function HTMLHtmlElement(doc, localName, prefix) { + HTMLElement.call(this, doc, localName, prefix); + }, + attributes: { + // Obsolete + version: String + } +}); -module.exports = function mergeOptions(defaults, options) { - options = options || Object.create(null); +define({ + tag: 'iframe', + ctor: function HTMLIFrameElement(doc, localName, prefix) { + HTMLElement.call(this, doc, localName, prefix); + var Window = __webpack_require__(21); // Avoid circular dependencies. + this._contentWindow = new Window(); + }, + props: { + contentWindow: { get: function() { + return this._contentWindow; + } }, + contentDocument: { get: function() { + return this.contentWindow.document; + } }, + }, + attributes: { + src: URL, + srcdoc: String, + name: String, + width: String, + height: String, + // XXX: sandbox is a reflected settable token list + seamless: Boolean, + allowFullscreen: Boolean, + allowUserMedia: Boolean, + allowPaymentRequest: Boolean, + referrerPolicy: REFERRER, + // Obsolete + align: String, + scrolling: String, + frameBorder: String, + longDesc: URL, + marginHeight: { type: String, treatNullAsEmptyString: true }, + marginWidth: { type: String, treatNullAsEmptyString: true }, + } +}); - return [defaults, options].reduce(function (merged, optObj) { - Object.keys(optObj).forEach(function (key) { - merged[key] = optObj[key]; - }); +define({ + tag: 'img', + ctor: function HTMLImageElement(doc, localName, prefix) { + HTMLElement.call(this, doc, localName, prefix); + }, + attributes: { + alt: String, + src: URL, + srcset: String, + crossOrigin: CORS, + useMap: String, + isMap: Boolean, + height: { type: "unsigned long", default: 0 }, + width: { type: "unsigned long", default: 0 }, + referrerPolicy: REFERRER, + // Obsolete: + name: String, + lowsrc: URL, + align: String, + hspace: { type: "unsigned long", default: 0 }, + vspace: { type: "unsigned long", default: 0 }, + longDesc: URL, + border: { type: String, treatNullAsEmptyString: true }, + } +}); - return merged; - }, Object.create(null)); -}; +define({ + tag: 'input', + ctor: function HTMLInputElement(doc, localName, prefix) { + HTMLFormElement.call(this, doc, localName, prefix); + }, + props: { + form: formAssociatedProps.form, + _post_click_activation_steps: { value: function(e) { + if (this.type === 'checkbox') { + this.checked = !this.checked; + } + else if (this.type === 'radio') { + var group = this.form.getElementsByName(this.name); + for (var i=group.length-1; i >= 0; i--) { + var el = group[i]; + el.checked = (el === this); + } + } + }}, + }, + attributes: { + name: String, + disabled: Boolean, + autofocus: Boolean, + accept: String, + alt: String, + max: String, + min: String, + pattern: String, + placeholder: String, + step: String, + dirName: String, + defaultValue: {name: 'value'}, + multiple: Boolean, + required: Boolean, + readOnly: Boolean, + checked: Boolean, + value: String, + src: URL, + defaultChecked: {name: 'checked', type: Boolean}, + size: {type: 'unsigned long', default: 20, min: 1, setmin: 1}, + maxLength: {type: 'unsigned long', min: 0, setmin: 0, default: -1}, + autocomplete: String, // It's complicated + type: { type: + ["text", "hidden", "search", "tel", "url", "email", "password", + "datetime", "date", "month", "week", "time", "datetime-local", + "number", "range", "color", "checkbox", "radio", "file", "submit", + "image", "reset", "button"], + missing: 'text' }, + formTarget: String, + formNoValidate: Boolean, + formMethod: { type: ["get", "post"], invalid: 'get', missing: '' }, + formEnctype: { type: ["application/x-www-form-urlencoded", "multipart/form-data", "text/plain"], invalid: "application/x-www-form-urlencoded", missing: '' }, + inputMode: { type: [ "verbatim", "latin", "latin-name", "latin-prose", "full-width-latin", "kana", "kana-name", "katakana", "numeric", "tel", "email", "url" ], missing: '' }, + // Obsolete + align: String, + useMap: String, + } +}); +define({ + tag: 'keygen', + ctor: function HTMLKeygenElement(doc, localName, prefix) { + HTMLFormElement.call(this, doc, localName, prefix); + }, + props: formAssociatedProps, + attributes: { + name: String, + disabled: Boolean, + autofocus: Boolean, + challenge: String, + keytype: { type:["rsa"], missing: '' }, + } +}); -/***/ }), -/* 35 */ -/***/ (function(module, exports, __webpack_require__) { +define({ + tag: 'li', + ctor: function HTMLLIElement(doc, localName, prefix) { + HTMLElement.call(this, doc, localName, prefix); + }, + attributes: { + value: {type: "long", default: 0}, + // Obsolete + type: String, + } +}); -"use strict"; +define({ + tag: 'label', + ctor: function HTMLLabelElement(doc, localName, prefix) { + HTMLFormElement.call(this, doc, localName, prefix); + }, + props: formAssociatedProps, + attributes: { + htmlFor: {name: 'for', type: String} + } +}); +define({ + tag: 'legend', + ctor: function HTMLLegendElement(doc, localName, prefix) { + HTMLElement.call(this, doc, localName, prefix); + }, + attributes: { + // Obsolete + align: String + }, +}); -var Parser = __webpack_require__(50), - Serializer = __webpack_require__(53); +define({ + tag: 'link', + ctor: function HTMLLinkElement(doc, localName, prefix) { + HTMLElement.call(this, doc, localName, prefix); + }, + attributes: { + // XXX Reflect DOMSettableTokenList sizes also DOMTokenList relList + href: URL, + rel: String, + media: String, + hreflang: String, + type: String, + crossOrigin: CORS, + nonce: String, + integrity: String, + referrerPolicy: REFERRER, + // Obsolete + charset: String, + rev: String, + target: String, + } +}); +define({ + tag: 'map', + ctor: function HTMLMapElement(doc, localName, prefix) { + HTMLElement.call(this, doc, localName, prefix); + }, + attributes: { + name: String + } +}); -// Shorthands -exports.parse = function parse(html, options) { - var parser = new Parser(options); +define({ + tag: 'menu', + ctor: function HTMLMenuElement(doc, localName, prefix) { + HTMLElement.call(this, doc, localName, prefix); + }, + attributes: { + // XXX: not quite right, default should be popup if parent element is + // popup. + type: { type: [ 'context', 'popup', 'toolbar' ], missing: 'toolbar' }, + label: String, + // Obsolete + compact: Boolean, + } +}); - return parser.parse(html); -}; +define({ + tag: 'meta', + ctor: function HTMLMetaElement(doc, localName, prefix) { + HTMLElement.call(this, doc, localName, prefix); + }, + attributes: { + name: String, + content: String, + httpEquiv: {name: 'http-equiv', type: String}, + // Obsolete + scheme: String, + } +}); -exports.parseFragment = function parseFragment(fragmentContext, html, options) { - if (typeof fragmentContext === 'string') { - options = html; - html = fragmentContext; - fragmentContext = null; - } +define({ + tag: 'meter', + ctor: function HTMLMeterElement(doc, localName, prefix) { + HTMLFormElement.call(this, doc, localName, prefix); + }, + props: formAssociatedProps +}); - var parser = new Parser(options); +define({ + tags: ['ins', 'del'], + ctor: function HTMLModElement(doc, localName, prefix) { + HTMLElement.call(this, doc, localName, prefix); + }, + attributes: { + cite: URL, + dateTime: String + } +}); - return parser.parseFragment(html, fragmentContext); -}; +define({ + tag: 'ol', + ctor: function HTMLOListElement(doc, localName, prefix) { + HTMLElement.call(this, doc, localName, prefix); + }, + props: { + // Utility function (see the start attribute default value). Returns + // the number of children of this element + _numitems: { get: function() { + var items = 0; + this.childNodes.forEach(function(n) { + if (n.nodeType === Node.ELEMENT_NODE && n.tagName === "LI") + items++; + }); + return items; + }} + }, + attributes: { + type: String, + reversed: Boolean, + start: { + type: "long", + default: function() { + // The default value of the start attribute is 1 unless the list is + // reversed. Then it is the # of li children + if (this.reversed) + return this._numitems; + else + return 1; + } + }, + // Obsolete + compact: Boolean, + } +}); -exports.serialize = function (node, options) { - var serializer = new Serializer(node, options); +define({ + tag: 'object', + ctor: function HTMLObjectElement(doc, localName, prefix) { + HTMLFormElement.call(this, doc, localName, prefix); + }, + props: formAssociatedProps, + attributes: { + data: URL, + type: String, + name: String, + useMap: String, + typeMustMatch: Boolean, + width: String, + height: String, + // Obsolete + align: String, + archive: String, + code: String, + declare: Boolean, + hspace: { type: "unsigned long", default: 0 }, + standby: String, + vspace: { type: "unsigned long", default: 0 }, + codeBase: URL, + codeType: String, + border: { type: String, treatNullAsEmptyString: true }, + } +}); - return serializer.serialize(); -}; +define({ + tag: 'optgroup', + ctor: function HTMLOptGroupElement(doc, localName, prefix) { + HTMLElement.call(this, doc, localName, prefix); + }, + attributes: { + disabled: Boolean, + label: String + } +}); +define({ + tag: 'option', + ctor: function HTMLOptionElement(doc, localName, prefix) { + HTMLElement.call(this, doc, localName, prefix); + }, + props: { + form: { get: function() { + var p = this.parentNode; + while (p && p.nodeType === Node.ELEMENT_NODE) { + if (p.localName === 'select') return p.form; + p = p.parentNode; + } + }} + }, + attributes: { + disabled: Boolean, + defaultSelected: {name: 'selected', type: Boolean}, + label: String, + value: String, + } +}); -// Tree adapters -exports.treeAdapters = { - default: __webpack_require__(36), - htmlparser2: __webpack_require__(120) -}; +define({ + tag: 'output', + ctor: function HTMLOutputElement(doc, localName, prefix) { + HTMLFormElement.call(this, doc, localName, prefix); + }, + props: formAssociatedProps, + attributes: { + // XXX Reflect for/htmlFor as a settable token list + name: String + } +}); +define({ + tag: 'p', + ctor: function HTMLParagraphElement(doc, localName, prefix) { + HTMLElement.call(this, doc, localName, prefix); + }, + attributes: { + // Obsolete + align: String + } +}); -// Streaming -exports.ParserStream = __webpack_require__(52); -exports.PlainTextConversionStream = __webpack_require__(113); -exports.SerializerStream = __webpack_require__(117); -exports.SAXParser = __webpack_require__(115); +define({ + tag: 'param', + ctor: function HTMLParamElement(doc, localName, prefix) { + HTMLElement.call(this, doc, localName, prefix); + }, + attributes: { + name: String, + value: String, + // Obsolete + type: String, + valueType: String, + } +}); +define({ + tags: ['pre',/*legacy elements:*/'listing','xmp'], + ctor: function HTMLPreElement(doc, localName, prefix) { + HTMLElement.call(this, doc, localName, prefix); + }, + attributes: { + // Obsolete + width: { type: "long", default: 0 }, + } +}); -/***/ }), -/* 36 */ -/***/ (function(module, exports, __webpack_require__) { +define({ + tag: 'progress', + ctor: function HTMLProgressElement(doc, localName, prefix) { + HTMLFormElement.call(this, doc, localName, prefix); + }, + props: formAssociatedProps, + attributes: { + max: {type: Number, float: true, default: 1.0, min: 0} + } +}); -"use strict"; +define({ + tags: ['q', 'blockquote'], + ctor: function HTMLQuoteElement(doc, localName, prefix) { + HTMLElement.call(this, doc, localName, prefix); + }, + attributes: { + cite: URL + } +}); +define({ + tag: 'script', + ctor: function HTMLScriptElement(doc, localName, prefix) { + HTMLElement.call(this, doc, localName, prefix); + }, + props: { + text: { + get: function() { + var s = ""; + for(var i = 0, n = this.childNodes.length; i < n; i++) { + var child = this.childNodes[i]; + if (child.nodeType === Node.TEXT_NODE) + s += child._data; + } + return s; + }, + set: function(value) { + this.removeChildren(); + if (value !== null && value !== "") { + this.appendChild(this.ownerDocument.createTextNode(value)); + } + } + } + }, + attributes: { + src: URL, + type: String, + charset: String, + defer: Boolean, + async: Boolean, + crossOrigin: CORS, + nonce: String, + integrity: String, + } +}); -var DOCUMENT_MODE = __webpack_require__(11).DOCUMENT_MODE; +define({ + tag: 'select', + ctor: function HTMLSelectElement(doc, localName, prefix) { + HTMLFormElement.call(this, doc, localName, prefix); + }, + props: { + form: formAssociatedProps.form, + options: { get: function() { + return this.getElementsByTagName('option'); + }} + }, + attributes: { + name: String, + disabled: Boolean, + autofocus: Boolean, + multiple: Boolean, + required: Boolean, + size: {type: "unsigned long", default: 0} + } +}); -//Node construction -exports.createDocument = function () { - return { - nodeName: '#document', - mode: DOCUMENT_MODE.NO_QUIRKS, - childNodes: [] - }; -}; +define({ + tag: 'source', + ctor: function HTMLSourceElement(doc, localName, prefix) { + HTMLElement.call(this, doc, localName, prefix); + }, + attributes: { + src: URL, + type: String, + media: String + } +}); -exports.createDocumentFragment = function () { - return { - nodeName: '#document-fragment', - childNodes: [] - }; -}; +define({ + tag: 'span', + ctor: function HTMLSpanElement(doc, localName, prefix) { + HTMLElement.call(this, doc, localName, prefix); + } +}); -exports.createElement = function (tagName, namespaceURI, attrs) { - return { - nodeName: tagName, - tagName: tagName, - attrs: attrs, - namespaceURI: namespaceURI, - childNodes: [], - parentNode: null - }; -}; +define({ + tag: 'style', + ctor: function HTMLStyleElement(doc, localName, prefix) { + HTMLElement.call(this, doc, localName, prefix); + }, + attributes: { + media: String, + type: String, + scoped: Boolean + } +}); -exports.createCommentNode = function (data) { - return { - nodeName: '#comment', - data: data, - parentNode: null - }; -}; +define({ + tag: 'caption', + ctor: function HTMLTableCaptionElement(doc, localName, prefix) { + HTMLElement.call(this, doc, localName, prefix); + }, + attributes: { + // Obsolete + align: String, + } +}); -var createTextNode = function (value) { - return { - nodeName: '#text', - value: value, - parentNode: null - }; -}; +define({ + ctor: function HTMLTableCellElement(doc, localName, prefix) { + HTMLElement.call(this, doc, localName, prefix); + }, + attributes: { + colSpan: {type: "unsigned long", default: 1}, + rowSpan: {type: "unsigned long", default: 1}, + //XXX Also reflect settable token list headers + scope: { type: ['row','col','rowgroup','colgroup'], missing: '' }, + abbr: String, + // Obsolete + align: String, + axis: String, + height: String, + width: String, + ch: { name: 'char', type: String }, + chOff: { name: 'charoff', type: String }, + noWrap: Boolean, + vAlign: String, + bgColor: { type: String, treatNullAsEmptyString: true }, + } +}); -//Tree mutation -var appendChild = exports.appendChild = function (parentNode, newNode) { - parentNode.childNodes.push(newNode); - newNode.parentNode = parentNode; -}; +define({ + tags: ['col', 'colgroup'], + ctor: function HTMLTableColElement(doc, localName, prefix) { + HTMLElement.call(this, doc, localName, prefix); + }, + attributes: { + span: {type: 'limited unsigned long with fallback', default: 1, min: 1}, + // Obsolete + align: String, + ch: { name: 'char', type: String }, + chOff: { name: 'charoff', type: String }, + vAlign: String, + width: String, + } +}); -var insertBefore = exports.insertBefore = function (parentNode, newNode, referenceNode) { - var insertionIdx = parentNode.childNodes.indexOf(referenceNode); +define({ + tag: 'table', + ctor: function HTMLTableElement(doc, localName, prefix) { + HTMLElement.call(this, doc, localName, prefix); + }, + props: { + rows: { get: function() { + return this.getElementsByTagName('tr'); + }} + }, + attributes: { + // Obsolete + align: String, + border: String, + frame: String, + rules: String, + summary: String, + width: String, + bgColor: { type: String, treatNullAsEmptyString: true }, + cellPadding: { type: String, treatNullAsEmptyString: true }, + cellSpacing: { type: String, treatNullAsEmptyString: true }, + } +}); - parentNode.childNodes.splice(insertionIdx, 0, newNode); - newNode.parentNode = parentNode; -}; +define({ + tag: 'template', + ctor: function HTMLTemplateElement(doc, localName, prefix) { + HTMLElement.call(this, doc, localName, prefix); + this._contentFragment = doc._templateDoc.createDocumentFragment(); + }, + props: { + content: { get: function() { return this._contentFragment; } }, + serialize: { value: function() { return this.content.serialize(); } } + } +}); -exports.setTemplateContent = function (templateElement, contentElement) { - templateElement.content = contentElement; -}; +define({ + tag: 'tr', + ctor: function HTMLTableRowElement(doc, localName, prefix) { + HTMLElement.call(this, doc, localName, prefix); + }, + props: { + cells: { get: function() { + return this.querySelectorAll('td,th'); + }} + }, + attributes: { + // Obsolete + align: String, + ch: { name: 'char', type: String }, + chOff: { name: 'charoff', type: String }, + vAlign: String, + bgColor: { type: String, treatNullAsEmptyString: true }, + }, +}); -exports.getTemplateContent = function (templateElement) { - return templateElement.content; -}; +define({ + tags: ['thead', 'tfoot', 'tbody'], + ctor: function HTMLTableSectionElement(doc, localName, prefix) { + HTMLElement.call(this, doc, localName, prefix); + }, + props: { + rows: { get: function() { + return this.getElementsByTagName('tr'); + }} + }, + attributes: { + // Obsolete + align: String, + ch: { name: 'char', type: String }, + chOff: { name: 'charoff', type: String }, + vAlign: String, + } +}); -exports.setDocumentType = function (document, name, publicId, systemId) { - var doctypeNode = null; +define({ + tag: 'textarea', + ctor: function HTMLTextAreaElement(doc, localName, prefix) { + HTMLFormElement.call(this, doc, localName, prefix); + }, + props: formAssociatedProps, + attributes: { + autocomplete: String, // It's complicated + name: String, + disabled: Boolean, + autofocus: Boolean, + placeholder: String, + wrap: String, + dirName: String, + required: Boolean, + readOnly: Boolean, + rows: {type: 'limited unsigned long with fallback', default: 2 }, + cols: {type: 'limited unsigned long with fallback', default: 20 }, + maxLength: {type: 'unsigned long', min: 0, setmin: 0, default: -1}, + inputMode: { type: [ "verbatim", "latin", "latin-name", "latin-prose", "full-width-latin", "kana", "kana-name", "katakana", "numeric", "tel", "email", "url" ], missing: '' }, + } +}); - for (var i = 0; i < document.childNodes.length; i++) { - if (document.childNodes[i].nodeName === '#documentType') { - doctypeNode = document.childNodes[i]; - break; - } - } +define({ + tag: 'time', + ctor: function HTMLTimeElement(doc, localName, prefix) { + HTMLElement.call(this, doc, localName, prefix); + }, + attributes: { + dateTime: String, + pubDate: Boolean + } +}); - if (doctypeNode) { - doctypeNode.name = name; - doctypeNode.publicId = publicId; - doctypeNode.systemId = systemId; - } +define({ + tag: 'title', + ctor: function HTMLTitleElement(doc, localName, prefix) { + HTMLElement.call(this, doc, localName, prefix); + }, + props: { + text: { get: function() { + return this.textContent; + }} + } +}); - else { - appendChild(document, { - nodeName: '#documentType', - name: name, - publicId: publicId, - systemId: systemId - }); - } -}; +define({ + tag: 'ul', + ctor: function HTMLUListElement(doc, localName, prefix) { + HTMLElement.call(this, doc, localName, prefix); + }, + attributes: { + type: String, + // Obsolete + compact: Boolean, + } +}); -exports.setDocumentMode = function (document, mode) { - document.mode = mode; -}; +define({ + ctor: function HTMLMediaElement(doc, localName, prefix) { + HTMLElement.call(this, doc, localName, prefix); + }, + attributes: { + src: URL, + crossOrigin: CORS, + preload: { type:["metadata", "none", "auto", {value: "", alias: "auto"}], missing: 'auto' }, + loop: Boolean, + autoplay: Boolean, + mediaGroup: String, + controls: Boolean, + defaultMuted: {name: "muted", type: Boolean} + } +}); -exports.getDocumentMode = function (document) { - return document.mode; -}; +define({ + tag: 'audio', + superclass: htmlElements.HTMLMediaElement, + ctor: function HTMLAudioElement(doc, localName, prefix) { + htmlElements.HTMLMediaElement.call(this, doc, localName, prefix); + } +}); -exports.detachNode = function (node) { - if (node.parentNode) { - var idx = node.parentNode.childNodes.indexOf(node); +define({ + tag: 'video', + superclass: htmlElements.HTMLMediaElement, + ctor: function HTMLVideoElement(doc, localName, prefix) { + htmlElements.HTMLMediaElement.call(this, doc, localName, prefix); + }, + attributes: { + poster: URL, + width: {type: "unsigned long", min: 0, default: 0 }, + height: {type: "unsigned long", min: 0, default: 0 } + } +}); - node.parentNode.childNodes.splice(idx, 1); - node.parentNode = null; - } -}; +define({ + tag: 'td', + superclass: htmlElements.HTMLTableCellElement, + ctor: function HTMLTableDataCellElement(doc, localName, prefix) { + htmlElements.HTMLTableCellElement.call(this, doc, localName, prefix); + } +}); -exports.insertText = function (parentNode, text) { - if (parentNode.childNodes.length) { - var prevNode = parentNode.childNodes[parentNode.childNodes.length - 1]; +define({ + tag: 'th', + superclass: htmlElements.HTMLTableCellElement, + ctor: function HTMLTableHeaderCellElement(doc, localName, prefix) { + htmlElements.HTMLTableCellElement.call(this, doc, localName, prefix); + }, +}); - if (prevNode.nodeName === '#text') { - prevNode.value += text; - return; - } - } +define({ + tag: 'frameset', + ctor: function HTMLFrameSetElement(doc, localName, prefix) { + HTMLElement.call(this, doc, localName, prefix); + } +}); - appendChild(parentNode, createTextNode(text)); -}; +define({ + tag: 'frame', + ctor: function HTMLFrameElement(doc, localName, prefix) { + HTMLElement.call(this, doc, localName, prefix); + } +}); -exports.insertTextBefore = function (parentNode, text, referenceNode) { - var prevNode = parentNode.childNodes[parentNode.childNodes.indexOf(referenceNode) - 1]; +define({ + tag: 'canvas', + ctor: function HTMLCanvasElement(doc, localName, prefix) { + HTMLElement.call(this, doc, localName, prefix); + }, + props: { + getContext: { value: utils.nyi }, + probablySupportsContext: { value: utils.nyi }, + setContext: { value: utils.nyi }, + transferControlToProxy: { value: utils.nyi }, + toDataURL: { value: utils.nyi }, + toBlob: { value: utils.nyi } + }, + attributes: { + width: { type: "unsigned long", default: 300}, + height: { type: "unsigned long", default: 150} + } +}); - if (prevNode && prevNode.nodeName === '#text') - prevNode.value += text; - else - insertBefore(parentNode, createTextNode(text), referenceNode); -}; +define({ + tag: 'dialog', + ctor: function HTMLDialogElement(doc, localName, prefix) { + HTMLElement.call(this, doc, localName, prefix); + }, + props: { + show: { value: utils.nyi }, + showModal: { value: utils.nyi }, + close: { value: utils.nyi } + }, + attributes: { + open: Boolean, + returnValue: String + } +}); -exports.adoptAttributes = function (recipient, attrs) { - var recipientAttrsMap = []; +define({ + tag: 'menuitem', + ctor: function HTMLMenuItemElement(doc, localName, prefix) { + HTMLElement.call(this, doc, localName, prefix); + }, + props: { + // The menuitem's label + _label: { + get: function() { + var val = this._getattr('label'); + if (val !== null && val !== '') { return val; } + val = this.textContent; + // Strip and collapse whitespace + return val.replace(/[ \t\n\f\r]+/g, ' ').trim(); + } + }, + // The menuitem label IDL attribute + label: { + get: function() { + var val = this._getattr('label'); + if (val !== null) { return val; } + return this._label; + }, + set: function(v) { + this._setattr('label', v); + }, + } + }, + attributes: { + type: { type: ["command","checkbox","radio"], missing: 'command' }, + icon: URL, + disabled: Boolean, + checked: Boolean, + radiogroup: String, + default: Boolean + } +}); - for (var i = 0; i < recipient.attrs.length; i++) - recipientAttrsMap.push(recipient.attrs[i].name); +define({ + tag: 'source', + ctor: function HTMLSourceElement(doc, localName, prefix) { + HTMLElement.call(this, doc, localName, prefix); + }, + attributes: { + srcset: String, + sizes: String, + media: String, + src: URL, + type: String + } +}); - for (var j = 0; j < attrs.length; j++) { - if (recipientAttrsMap.indexOf(attrs[j].name) === -1) - recipient.attrs.push(attrs[j]); - } -}; +define({ + tag: 'track', + ctor: function HTMLTrackElement(doc, localName, prefix) { + HTMLElement.call(this, doc, localName, prefix); + }, + attributes: { + src: URL, + srclang: String, + label: String, + default: Boolean, + kind: { type: ["subtitles", "captions", "descriptions", "chapters", "metadata"], missing: 'subtitles', invalid: 'metadata' }, + }, + props: { + NONE: { get: function() { return 0; } }, + LOADING: { get: function() { return 1; } }, + LOADED: { get: function() { return 2; } }, + ERROR: { get: function() { return 3; } }, + readyState: { get: utils.nyi }, + track: { get: utils.nyi } + } +}); +define({ + tags: [ + "abbr", "address", "article", "aside", "b", "bdi", "bdo", + "cite", "code", "dd", "dfn", "dt", "em", "figcaption", "figure", + "footer", "header", "hgroup", "i", "kbd", "main", "mark", "nav", "noscript", + "rb", "rp", "rt", "rtc", "ruby", "s", "samp", "section", "small", "strong", + "sub", "summary", "sup", "u", "var", "wbr", + // Legacy elements + "acronym", "basefont", "big", "center", "nobr", "noembed", "noframes", + "plaintext", "strike", "tt" + ] +}); -//Tree traversing -exports.getFirstChild = function (node) { - return node.childNodes[0]; -}; -exports.getChildNodes = function (node) { - return node.childNodes; -}; +/***/ }), +/* 23 */ +/***/ (function(module, exports, __webpack_require__) { -exports.getParentNode = function (node) { - return node.parentNode; -}; +"use strict"; -exports.getAttrList = function (element) { - return element.attrs; -}; +/* jshint eqnull: true */ +/** + * Zest (https://github.com/chjj/zest) + * A css selector engine. + * Copyright (c) 2011-2012, Christopher Jeffrey. (MIT Licensed) + */ -//Node data -exports.getTagName = function (element) { - return element.tagName; -}; +/** + * Helpers + */ -exports.getNamespaceURI = function (element) { - return element.namespaceURI; -}; +var window = Object.create(null, { + location: { get: function() { + throw new Error('window.location is not supported.'); + } } +}); -exports.getTextNodeContent = function (textNode) { - return textNode.value; +var compareDocumentPosition = function(a, b) { + return a.compareDocumentPosition(b); }; -exports.getCommentNodeContent = function (commentNode) { - return commentNode.data; +var order = function(a, b) { + /* jshint bitwise: false */ + return compareDocumentPosition(a, b) & 2 ? 1 : -1; }; -exports.getDocumentTypeNodeName = function (doctypeNode) { - return doctypeNode.name; +var next = function(el) { + while ((el = el.nextSibling) + && el.nodeType !== 1); + return el; }; -exports.getDocumentTypeNodePublicId = function (doctypeNode) { - return doctypeNode.publicId; +var prev = function(el) { + while ((el = el.previousSibling) + && el.nodeType !== 1); + return el; }; -exports.getDocumentTypeNodeSystemId = function (doctypeNode) { - return doctypeNode.systemId; +var child = function(el) { + /*jshint -W084 */ + if (el = el.firstChild) { + while (el.nodeType !== 1 + && (el = el.nextSibling)); + } + return el; }; -//Node types -exports.isTextNode = function (node) { - return node.nodeName === '#text'; +var lastChild = function(el) { + /*jshint -W084 */ + if (el = el.lastChild) { + while (el.nodeType !== 1 + && (el = el.previousSibling)); + } + return el; }; -exports.isCommentNode = function (node) { - return node.nodeName === '#comment'; +var unquote = function(str) { + if (!str) return str; + var ch = str[0]; + if (ch === '"' || ch === '\'') { + if (str[str.length-1] === ch) { + str = str.slice(1, -1); + } else { + // bad string. + str = str.slice(1); + } + return str.replace(rules.str_escape, function(s) { + var m = /^\\(?:([0-9A-Fa-f]+)|([\r\n\f]+))/.exec(s); + if (!m) { return s.slice(1); } + if (m[2]) { return ''; /* escaped newlines are ignored in strings. */ } + var cp = parseInt(m[1], 16); + return String.fromCodePoint ? String.fromCodePoint(cp) : + // Not all JavaScript implementations have String.fromCodePoint yet. + String.fromCharCode(cp); + }); + } else if (rules.ident.test(str)) { + return decodeid(str); + } else { + // NUMBER, PERCENTAGE, DIMENSION, etc + return str; + } }; -exports.isDocumentTypeNode = function (node) { - return node.nodeName === '#documentType'; +var decodeid = function(str) { + return str.replace(rules.escape, function(s) { + var m = /^\\([0-9A-Fa-f]+)/.exec(s); + if (!m) { return s[1]; } + var cp = parseInt(m[1], 16); + return String.fromCodePoint ? String.fromCodePoint(cp) : + // Not all JavaScript implementations have String.fromCodePoint yet. + String.fromCharCode(cp); + }); }; -exports.isElementNode = function (node) { - return !!node.tagName; -}; +var indexOf = (function() { + if (Array.prototype.indexOf) { + return Array.prototype.indexOf; + } + return function(obj, item) { + var i = this.length; + while (i--) { + if (this[i] === item) return i; + } + return -1; + }; +})(); +var makeInside = function(start, end) { + var regex = rules.inside.source + .replace(//g, end); -/***/ }), -/* 37 */ -/***/ (function(module, exports, __webpack_require__) { + return new RegExp(regex); +}; -"use strict"; +var replace = function(regex, name, val) { + regex = regex.source; + regex = regex.replace(name, val.source || val); + return new RegExp(regex); +}; -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); +var truncateUrl = function(url, num) { + return url + .replace(/^(?:\w+:\/\/|\/+)/, '') + .replace(/(?:\/+|\/*#.*?)$/, '') + .split('/', num) + .join('/'); }; -var ArrayObservable_1 = __webpack_require__(14); -var isArray_1 = __webpack_require__(15); -var OuterSubscriber_1 = __webpack_require__(4); -var subscribeToResult_1 = __webpack_require__(3); -var none = {}; -/* tslint:enable:max-line-length */ + /** - * Combines multiple Observables to create an Observable whose values are - * calculated from the latest values of each of its input Observables. - * - * Whenever any input Observable emits a value, it - * computes a formula using the latest values from all the inputs, then emits - * the output of that formula. - * - * - * - * `combineLatest` combines the values from this Observable with values from - * Observables passed as arguments. This is done by subscribing to each - * Observable, in order, and collecting an array of each of the most recent - * values any time any of the input Observables emits, then either taking that - * array and passing it as arguments to an optional `project` function and - * emitting the return value of that, or just emitting the array of recent - * values directly if there is no `project` function. - * - * @example Dynamically calculate the Body-Mass Index from an Observable of weight and one for height - * var weight = Rx.Observable.of(70, 72, 76, 79, 75); - * var height = Rx.Observable.of(1.76, 1.77, 1.78); - * var bmi = weight.combineLatest(height, (w, h) => w / (h * h)); - * bmi.subscribe(x => console.log('BMI is ' + x)); - * - * // With output to console: - * // BMI is 24.212293388429753 - * // BMI is 23.93948099205209 - * // BMI is 23.671253629592222 - * - * @see {@link combineAll} - * @see {@link merge} - * @see {@link withLatestFrom} - * - * @param {ObservableInput} other An input Observable to combine with the source - * Observable. More than one input Observables may be given as argument. - * @param {function} [project] An optional function to project the values from - * the combined latest values into a new value on the output Observable. - * @return {Observable} An Observable of projected values from the most recent - * values from each input Observable, or an array of the most recent values from - * each input Observable. - * @method combineLatest - * @owner Observable + * Handle `nth` Selectors */ -function combineLatest() { - var observables = []; - for (var _i = 0; _i < arguments.length; _i++) { - observables[_i - 0] = arguments[_i]; + +var parseNth = function(param_, test) { + var param = param_.replace(/\s+/g, '') + , cap; + + if (param === 'even') { + param = '2n+0'; + } else if (param === 'odd') { + param = '2n+1'; + } else if (param.indexOf('n') === -1) { + param = '0n' + param; + } + + cap = /^([+-])?(\d+)?n([+-])?(\d+)?$/.exec(param); + + return { + group: cap[1] === '-' + ? -(cap[2] || 1) + : +(cap[2] || 1), + offset: cap[4] + ? (cap[3] === '-' ? -cap[4] : +cap[4]) + : 0 + }; +}; + +var nth = function(param_, test, last) { + var param = parseNth(param_) + , group = param.group + , offset = param.offset + , find = !last ? child : lastChild + , advance = !last ? next : prev; + + return function(el) { + if (el.parentNode.nodeType !== 1) return; + + var rel = find(el.parentNode) + , pos = 0; + + while (rel) { + if (test(rel, el)) pos++; + if (rel === el) { + pos -= offset; + return group && pos + ? (pos % group) === 0 && (pos < 0 === group < 0) + : !pos; + } + rel = advance(rel); } - var project = null; - if (typeof observables[observables.length - 1] === 'function') { - project = observables.pop(); + }; +}; + +/** + * Simple Selectors + */ + +var selectors = { + '*': (function() { + if (false/*function() { + var el = document.createElement('div'); + el.appendChild(document.createComment('')); + return !!el.getElementsByTagName('*')[0]; + }()*/) { + return function(el) { + if (el.nodeType === 1) return true; + }; } - // if the first and only other argument besides the resultSelector is an array - // assume it's been called with `combineLatest([obs1, obs2, obs3], project)` - if (observables.length === 1 && isArray_1.isArray(observables[0])) { - observables = observables[0].slice(); + return function() { + return true; + }; + })(), + 'type': function(type) { + type = type.toLowerCase(); + return function(el) { + return el.nodeName.toLowerCase() === type; + }; + }, + 'attr': function(key, op, val, i) { + op = operators[op]; + return function(el) { + var attr; + switch (key) { + case 'for': + attr = el.htmlFor; + break; + case 'class': + // className is '' when non-existent + // getAttribute('class') is null + attr = el.className; + if (attr === '' && el.getAttribute('class') == null) { + attr = null; + } + break; + case 'href': + attr = el.getAttribute('href', 2); + break; + case 'title': + // getAttribute('title') can be '' when non-existent sometimes? + attr = el.getAttribute('title') || null; + break; + // careful with attributes with special getter functions + case 'id': + case 'lang': + case 'dir': + case 'accessKey': + case 'hidden': + case 'tabIndex': + case 'style': + if (el.getAttribute) { + attr = el.getAttribute(key); + break; + } + /* falls through */ + default: + if (el.hasAttribute && !el.hasAttribute(key)) { + break; + } + attr = el[key] != null + ? el[key] + : el.getAttribute && el.getAttribute(key); + break; + } + if (attr == null) return; + attr = attr + ''; + if (i) { + attr = attr.toLowerCase(); + val = val.toLowerCase(); + } + return op(attr, val); + }; + }, + ':first-child': function(el) { + return !prev(el) && el.parentNode.nodeType === 1; + }, + ':last-child': function(el) { + return !next(el) && el.parentNode.nodeType === 1; + }, + ':only-child': function(el) { + return !prev(el) && !next(el) + && el.parentNode.nodeType === 1; + }, + ':nth-child': function(param, last) { + return nth(param, function() { + return true; + }, last); + }, + ':nth-last-child': function(param) { + return selectors[':nth-child'](param, true); + }, + ':root': function(el) { + return el.ownerDocument.documentElement === el; + }, + ':empty': function(el) { + return !el.firstChild; + }, + ':not': function(sel) { + var test = compileGroup(sel); + return function(el) { + return !test(el); + }; + }, + ':first-of-type': function(el) { + if (el.parentNode.nodeType !== 1) return; + var type = el.nodeName; + /*jshint -W084 */ + while (el = prev(el)) { + if (el.nodeName === type) return; } - observables.unshift(this); - return this.lift.call(new ArrayObservable_1.ArrayObservable(observables), new CombineLatestOperator(project)); -} -exports.combineLatest = combineLatest; -var CombineLatestOperator = (function () { - function CombineLatestOperator(project) { - this.project = project; + return true; + }, + ':last-of-type': function(el) { + if (el.parentNode.nodeType !== 1) return; + var type = el.nodeName; + /*jshint -W084 */ + while (el = next(el)) { + if (el.nodeName === type) return; } - CombineLatestOperator.prototype.call = function (subscriber, source) { - return source.subscribe(new CombineLatestSubscriber(subscriber, this.project)); + return true; + }, + ':only-of-type': function(el) { + return selectors[':first-of-type'](el) + && selectors[':last-of-type'](el); + }, + ':nth-of-type': function(param, last) { + return nth(param, function(rel, el) { + return rel.nodeName === el.nodeName; + }, last); + }, + ':nth-last-of-type': function(param) { + return selectors[':nth-of-type'](param, true); + }, + ':checked': function(el) { + return !!(el.checked || el.selected); + }, + ':indeterminate': function(el) { + return !selectors[':checked'](el); + }, + ':enabled': function(el) { + return !el.disabled && el.type !== 'hidden'; + }, + ':disabled': function(el) { + return !!el.disabled; + }, + ':target': function(el) { + return el.id === window.location.hash.substring(1); + }, + ':focus': function(el) { + return el === el.ownerDocument.activeElement; + }, + ':matches': function(sel) { + return compileGroup(sel); + }, + ':nth-match': function(param, last) { + var args = param.split(/\s*,\s*/) + , arg = args.shift() + , test = compileGroup(args.join(',')); + + return nth(arg, test, last); + }, + ':nth-last-match': function(param) { + return selectors[':nth-match'](param, true); + }, + ':links-here': function(el) { + return el + '' === window.location + ''; + }, + ':lang': function(param) { + return function(el) { + while (el) { + if (el.lang) return el.lang.indexOf(param) === 0; + el = el.parentNode; + } }; - return CombineLatestOperator; -}()); -exports.CombineLatestOperator = CombineLatestOperator; -/** - * We need this JSDoc comment for affecting ESDoc. - * @ignore - * @extends {Ignored} - */ -var CombineLatestSubscriber = (function (_super) { - __extends(CombineLatestSubscriber, _super); - function CombineLatestSubscriber(destination, project) { - _super.call(this, destination); - this.project = project; - this.active = 0; - this.values = []; - this.observables = []; - } - CombineLatestSubscriber.prototype._next = function (observable) { - this.values.push(none); - this.observables.push(observable); + }, + ':dir': function(param) { + return function(el) { + while (el) { + if (el.dir) return el.dir === param; + el = el.parentNode; + } }; - CombineLatestSubscriber.prototype._complete = function () { - var observables = this.observables; - var len = observables.length; - if (len === 0) { - this.destination.complete(); - } - else { - this.active = len; - this.toRespond = len; - for (var i = 0; i < len; i++) { - var observable = observables[i]; - this.add(subscribeToResult_1.subscribeToResult(this, observable, observable, i)); - } - } + }, + ':scope': function(el, con) { + var context = con || el.ownerDocument; + if (context.nodeType === 9) { + return el === context.documentElement; + } + return el === context; + }, + ':any-link': function(el) { + return typeof el.href === 'string'; + }, + ':local-link': function(el) { + if (el.nodeName) { + return el.href && el.host === window.location.host; + } + var param = +el + 1; + return function(el) { + if (!el.href) return; + + var url = window.location + '' + , href = el + ''; + + return truncateUrl(url, param) === truncateUrl(href, param); + }; + }, + ':default': function(el) { + return !!el.defaultSelected; + }, + ':valid': function(el) { + return el.willValidate || (el.validity && el.validity.valid); + }, + ':invalid': function(el) { + return !selectors[':valid'](el); + }, + ':in-range': function(el) { + return el.value > el.min && el.value <= el.max; + }, + ':out-of-range': function(el) { + return !selectors[':in-range'](el); + }, + ':required': function(el) { + return !!el.required; + }, + ':optional': function(el) { + return !el.required; + }, + ':read-only': function(el) { + if (el.readOnly) return true; + + var attr = el.getAttribute('contenteditable') + , prop = el.contentEditable + , name = el.nodeName.toLowerCase(); + + name = name !== 'input' && name !== 'textarea'; + + return (name || el.disabled) && attr == null && prop !== 'true'; + }, + ':read-write': function(el) { + return !selectors[':read-only'](el); + }, + ':hover': function() { + throw new Error(':hover is not supported.'); + }, + ':active': function() { + throw new Error(':active is not supported.'); + }, + ':link': function() { + throw new Error(':link is not supported.'); + }, + ':visited': function() { + throw new Error(':visited is not supported.'); + }, + ':column': function() { + throw new Error(':column is not supported.'); + }, + ':nth-column': function() { + throw new Error(':nth-column is not supported.'); + }, + ':nth-last-column': function() { + throw new Error(':nth-last-column is not supported.'); + }, + ':current': function() { + throw new Error(':current is not supported.'); + }, + ':past': function() { + throw new Error(':past is not supported.'); + }, + ':future': function() { + throw new Error(':future is not supported.'); + }, + // Non-standard, for compatibility purposes. + ':contains': function(param) { + return function(el) { + var text = el.innerText || el.textContent || el.value || ''; + return text.indexOf(param) !== -1; + }; + }, + ':has': function(param) { + return function(el) { + return find(param, el).length > 0; + }; + } + // Potentially add more pseudo selectors for + // compatibility with sizzle and most other + // selector engines (?). +}; + +/** + * Attribute Operators + */ + +var operators = { + '-': function() { + return true; + }, + '=': function(attr, val) { + return attr === val; + }, + '*=': function(attr, val) { + return attr.indexOf(val) !== -1; + }, + '~=': function(attr, val) { + var i = attr.indexOf(val) + , f + , l; + + if (i === -1) return; + f = attr[i - 1]; + l = attr[i + val.length]; + + return (!f || f === ' ') && (!l || l === ' '); + }, + '|=': function(attr, val) { + var i = attr.indexOf(val) + , l; + + if (i !== 0) return; + l = attr[i + val.length]; + + return l === '-' || !l; + }, + '^=': function(attr, val) { + return attr.indexOf(val) === 0; + }, + '$=': function(attr, val) { + return attr.indexOf(val) + val.length === attr.length; + }, + // non-standard + '!=': function(attr, val) { + return attr !== val; + } +}; + +/** + * Combinator Logic + */ + +var combinators = { + ' ': function(test) { + return function(el) { + /*jshint -W084 */ + while (el = el.parentNode) { + if (test(el)) return el; + } }; - CombineLatestSubscriber.prototype.notifyComplete = function (unused) { - if ((this.active -= 1) === 0) { - this.destination.complete(); - } + }, + '>': function(test) { + return function(el) { + /*jshint -W084 */ + if (el = el.parentNode) { + return test(el) && el; + } }; - CombineLatestSubscriber.prototype.notifyNext = function (outerValue, innerValue, outerIndex, innerIndex, innerSub) { - var values = this.values; - var oldVal = values[outerIndex]; - var toRespond = !this.toRespond - ? 0 - : oldVal === none ? --this.toRespond : this.toRespond; - values[outerIndex] = innerValue; - if (toRespond === 0) { - if (this.project) { - this._tryProject(values); - } - else { - this.destination.next(values.slice()); - } - } + }, + '+': function(test) { + return function(el) { + /*jshint -W084 */ + if (el = prev(el)) { + return test(el) && el; + } }; - CombineLatestSubscriber.prototype._tryProject = function (values) { - var result; - try { - result = this.project.apply(this, values); - } - catch (err) { - this.destination.error(err); - return; + }, + '~': function(test) { + return function(el) { + /*jshint -W084 */ + while (el = prev(el)) { + if (test(el)) return el; + } + }; + }, + 'noop': function(test) { + return function(el) { + return test(el) && el; + }; + }, + 'ref': function(test, name) { + var node; + + function ref(el) { + var doc = el.ownerDocument + , nodes = doc.getElementsByTagName('*') + , i = nodes.length; + + while (i--) { + node = nodes[i]; + if (ref.test(el)) { + node = null; + return true; } - this.destination.next(result); + } + + node = null; + } + + ref.combinator = function(el) { + if (!node || !node.getAttribute) return; + + var attr = node.getAttribute(name) || ''; + if (attr[0] === '#') attr = attr.substring(1); + + if (attr === el.id && test(node)) { + return node; + } }; - return CombineLatestSubscriber; -}(OuterSubscriber_1.OuterSubscriber)); -exports.CombineLatestSubscriber = CombineLatestSubscriber; -//# sourceMappingURL=combineLatest.js.map -/***/ }), -/* 38 */ -/***/ (function(module, exports, __webpack_require__) { + return ref; + } +}; + +/** + * Grammar + */ + +var rules = { + escape: /\\(?:[^0-9A-Fa-f\r\n]|[0-9A-Fa-f]{1,6}[\r\n\t ]?)/g, + str_escape: /(escape)|\\(\n|\r\n?|\f)/g, + nonascii: /[\u00A0-\uFFFF]/, + cssid: /(?:(?!-?[0-9])(?:escape|nonascii|[-_a-zA-Z0-9])+)/, + qname: /^ *(cssid|\*)/, + simple: /^(?:([.#]cssid)|pseudo|attr)/, + ref: /^ *\/(cssid)\/ */, + combinator: /^(?: +([^ \w*.#\\]) +|( )+|([^ \w*.#\\]))(?! *$)/, + attr: /^\[(cssid)(?:([^\w]?=)(inside))?\]/, + pseudo: /^(:cssid)(?:\((inside)\))?/, + inside: /(?:"(?:\\"|[^"])*"|'(?:\\'|[^'])*'|<[^"'>]*>|\\["'>]|[^"'>])*/, + ident: /^(cssid)$/ +}; + +rules.cssid = replace(rules.cssid, 'nonascii', rules.nonascii); +rules.cssid = replace(rules.cssid, 'escape', rules.escape); +rules.qname = replace(rules.qname, 'cssid', rules.cssid); +rules.simple = replace(rules.simple, 'cssid', rules.cssid); +rules.ref = replace(rules.ref, 'cssid', rules.cssid); +rules.attr = replace(rules.attr, 'cssid', rules.cssid); +rules.pseudo = replace(rules.pseudo, 'cssid', rules.cssid); +rules.inside = replace(rules.inside, '[^"\'>]*', rules.inside); +rules.attr = replace(rules.attr, 'inside', makeInside('\\[', '\\]')); +rules.pseudo = replace(rules.pseudo, 'inside', makeInside('\\(', '\\)')); +rules.simple = replace(rules.simple, 'pseudo', rules.pseudo); +rules.simple = replace(rules.simple, 'attr', rules.attr); +rules.ident = replace(rules.ident, 'cssid', rules.cssid); +rules.str_escape = replace(rules.str_escape, 'escape', rules.escape); + +/** + * Compiling + */ + +var compile = function(sel_) { + var sel = sel_.replace(/^\s+|\s+$/g, '') + , test + , filter = [] + , buff = [] + , subject + , qname + , cap + , op + , ref; + + /*jshint -W084 */ + while (sel) { + if (cap = rules.qname.exec(sel)) { + sel = sel.substring(cap[0].length); + qname = cap[1]; + buff.push(tok(qname, true)); + } else if (cap = rules.simple.exec(sel)) { + sel = sel.substring(cap[0].length); + qname = '*'; + buff.push(tok(qname, true)); + buff.push(tok(cap)); + } else { + throw new SyntaxError('Invalid selector.'); + } + + while (cap = rules.simple.exec(sel)) { + sel = sel.substring(cap[0].length); + buff.push(tok(cap)); + } + + if (sel[0] === '!') { + sel = sel.substring(1); + subject = makeSubject(); + subject.qname = qname; + buff.push(subject.simple); + } + + if (cap = rules.ref.exec(sel)) { + sel = sel.substring(cap[0].length); + ref = combinators.ref(makeSimple(buff), decodeid(cap[1])); + filter.push(ref.combinator); + buff = []; + continue; + } + + if (cap = rules.combinator.exec(sel)) { + sel = sel.substring(cap[0].length); + op = cap[1] || cap[2] || cap[3]; + if (op === ',') { + filter.push(combinators.noop(makeSimple(buff))); + break; + } + } else { + op = 'noop'; + } + + if (!combinators[op]) { throw new SyntaxError('Bad combinator.'); } + filter.push(combinators[op](makeSimple(buff))); + buff = []; + } + + test = makeTest(filter); + test.qname = qname; + test.sel = sel; + + if (subject) { + subject.lname = test.qname; + + subject.test = test; + subject.qname = subject.qname; + subject.sel = test.sel; + test = subject; + } + + if (ref) { + ref.test = test; + ref.qname = test.qname; + ref.sel = test.sel; + test = ref; + } + + return test; +}; + +var tok = function(cap, qname) { + // qname + if (qname) { + return cap === '*' + ? selectors['*'] + : selectors.type(decodeid(cap)); + } + + // class/id + if (cap[1]) { + return cap[1][0] === '.' + // XXX unescape here? or in attr? + ? selectors.attr('class', '~=', decodeid(cap[1].substring(1))) + : selectors.attr('id', '=', decodeid(cap[1].substring(1))); + } + + // pseudo-name + // inside-pseudo + if (cap[2]) { + return cap[3] + ? selectors[decodeid(cap[2])](unquote(cap[3])) + : selectors[decodeid(cap[2])]; + } + + // attr name + // attr op + // attr value + if (cap[4]) { + return selectors.attr(decodeid(cap[4]), cap[5] || '-', unquote(cap[6]), false); + } + + throw new SyntaxError('Unknown Selector.'); +}; + +var makeSimple = function(func) { + var l = func.length + , i; + + // Potentially make sure + // `el` is truthy. + if (l < 2) return func[0]; + + return function(el) { + if (!el) return; + for (i = 0; i < l; i++) { + if (!func[i](el)) return; + } + return true; + }; +}; -"use strict"; +var makeTest = function(func) { + if (func.length < 2) { + return function(el) { + return !!func[0](el); + }; + } + return function(el) { + var i = func.length; + while (i--) { + if (!(el = func[i](el))) return; + } + return true; + }; +}; + +var makeSubject = function() { + var target; + + function subject(el) { + var node = el.ownerDocument + , scope = node.getElementsByTagName(subject.lname) + , i = scope.length; + + while (i--) { + if (subject.test(scope[i]) && target === el) { + target = null; + return true; + } + } + + target = null; + } + + subject.simple = function(el) { + target = el; + return true; + }; + + return subject; +}; + +var compileGroup = function(sel) { + var test = compile(sel) + , tests = [ test ]; + + while (test.sel) { + test = compile(test.sel); + tests.push(test); + } + + if (tests.length < 2) return test; + + return function(el) { + var l = tests.length + , i = 0; + + for (; i < l; i++) { + if (tests[i](el)) return true; + } + }; +}; -var Observable_1 = __webpack_require__(0); -var isScheduler_1 = __webpack_require__(13); -var ArrayObservable_1 = __webpack_require__(14); -var mergeAll_1 = __webpack_require__(77); -/* tslint:enable:max-line-length */ /** - * Creates an output Observable which sequentially emits all values from every - * given input Observable after the current Observable. - * - * Concatenates multiple Observables together by - * sequentially emitting their values, one Observable after the other. - * - * - * - * Joins this Observable with multiple other Observables by subscribing to them - * one at a time, starting with the source, and merging their results into the - * output Observable. Will wait for each Observable to complete before moving - * on to the next. - * - * @example Concatenate a timer counting from 0 to 3 with a synchronous sequence from 1 to 10 - * var timer = Rx.Observable.interval(1000).take(4); - * var sequence = Rx.Observable.range(1, 10); - * var result = timer.concat(sequence); - * result.subscribe(x => console.log(x)); - * - * // results in: - * // 1000ms-> 0 -1000ms-> 1 -1000ms-> 2 -1000ms-> 3 -immediate-> 1 ... 10 - * - * @example Concatenate 3 Observables - * var timer1 = Rx.Observable.interval(1000).take(10); - * var timer2 = Rx.Observable.interval(2000).take(6); - * var timer3 = Rx.Observable.interval(500).take(10); - * var result = timer1.concat(timer2, timer3); - * result.subscribe(x => console.log(x)); - * - * // results in the following: - * // (Prints to console sequentially) - * // -1000ms-> 0 -1000ms-> 1 -1000ms-> ... 9 - * // -2000ms-> 0 -2000ms-> 1 -2000ms-> ... 5 - * // -500ms-> 0 -500ms-> 1 -500ms-> ... 9 - * - * @see {@link concatAll} - * @see {@link concatMap} - * @see {@link concatMapTo} - * - * @param {ObservableInput} other An input Observable to concatenate after the source - * Observable. More than one input Observables may be given as argument. - * @param {Scheduler} [scheduler=null] An optional IScheduler to schedule each - * Observable subscription on. - * @return {Observable} All values of each passed Observable merged into a - * single Observable, in order, in serial fashion. - * @method concat - * @owner Observable + * Selection */ -function concat() { - var observables = []; - for (var _i = 0; _i < arguments.length; _i++) { - observables[_i - 0] = arguments[_i]; + +var find = function(sel, node) { + var results = [] + , test = compile(sel) + , scope = node.getElementsByTagName(test.qname) + , i = 0 + , el; + + /*jshint -W084 */ + while (el = scope[i++]) { + if (test(el)) results.push(el); + } + + if (test.sel) { + while (test.sel) { + test = compile(test.sel); + scope = node.getElementsByTagName(test.qname); + i = 0; + /*jshint -W084 */ + while (el = scope[i++]) { + if (test(el) && indexOf.call(results, el) === -1) { + results.push(el); + } + } } - return this.lift.call(concatStatic.apply(void 0, [this].concat(observables))); -} -exports.concat = concat; -/* tslint:enable:max-line-length */ + results.sort(order); + } + + return results; +}; + /** - * Creates an output Observable which sequentially emits all values from given - * Observable and then moves on to the next. - * - * Concatenates multiple Observables together by - * sequentially emitting their values, one Observable after the other. - * - * - * - * `concat` joins multiple Observables together, by subscribing to them one at a time and - * merging their results into the output Observable. You can pass either an array of - * Observables, or put them directly as arguments. Passing an empty array will result - * in Observable that completes immediately. - * - * `concat` will subscribe to first input Observable and emit all its values, without - * changing or affecting them in any way. When that Observable completes, it will - * subscribe to then next Observable passed and, again, emit its values. This will be - * repeated, until the operator runs out of Observables. When last input Observable completes, - * `concat` will complete as well. At any given moment only one Observable passed to operator - * emits values. If you would like to emit values from passed Observables concurrently, check out - * {@link merge} instead, especially with optional `concurrent` parameter. As a matter of fact, - * `concat` is an equivalent of `merge` operator with `concurrent` parameter set to `1`. - * - * Note that if some input Observable never completes, `concat` will also never complete - * and Observables following the one that did not complete will never be subscribed. On the other - * hand, if some Observable simply completes immediately after it is subscribed, it will be - * invisible for `concat`, which will just move on to the next Observable. - * - * If any Observable in chain errors, instead of passing control to the next Observable, - * `concat` will error immediately as well. Observables that would be subscribed after - * the one that emitted error, never will. - * - * If you pass to `concat` the same Observable many times, its stream of values - * will be "replayed" on every subscription, which means you can repeat given Observable - * as many times as you like. If passing the same Observable to `concat` 1000 times becomes tedious, - * you can always use {@link repeat}. - * - * @example Concatenate a timer counting from 0 to 3 with a synchronous sequence from 1 to 10 - * var timer = Rx.Observable.interval(1000).take(4); - * var sequence = Rx.Observable.range(1, 10); - * var result = Rx.Observable.concat(timer, sequence); - * result.subscribe(x => console.log(x)); - * - * // results in: - * // 0 -1000ms-> 1 -1000ms-> 2 -1000ms-> 3 -immediate-> 1 ... 10 - * - * - * @example Concatenate an array of 3 Observables - * var timer1 = Rx.Observable.interval(1000).take(10); - * var timer2 = Rx.Observable.interval(2000).take(6); - * var timer3 = Rx.Observable.interval(500).take(10); - * var result = Rx.Observable.concat([timer1, timer2, timer3]); // note that array is passed - * result.subscribe(x => console.log(x)); - * - * // results in the following: - * // (Prints to console sequentially) - * // -1000ms-> 0 -1000ms-> 1 -1000ms-> ... 9 - * // -2000ms-> 0 -2000ms-> 1 -2000ms-> ... 5 - * // -500ms-> 0 -500ms-> 1 -500ms-> ... 9 - * - * - * @example Concatenate the same Observable to repeat it - * const timer = Rx.Observable.interval(1000).take(2); - * - * Rx.Observable.concat(timer, timer) // concating the same Observable! - * .subscribe( - * value => console.log(value), - * err => {}, - * () => console.log('...and it is done!') - * ); - * - * // Logs: - * // 0 after 1s - * // 1 after 2s - * // 0 after 3s - * // 1 after 4s - * // "...and it is done!" also after 4s - * - * @see {@link concatAll} - * @see {@link concatMap} - * @see {@link concatMapTo} - * - * @param {ObservableInput} input1 An input Observable to concatenate with others. - * @param {ObservableInput} input2 An input Observable to concatenate with others. - * More than one input Observables may be given as argument. - * @param {Scheduler} [scheduler=null] An optional IScheduler to schedule each - * Observable subscription on. - * @return {Observable} All values of each passed Observable merged into a - * single Observable, in order, in serial fashion. - * @static true - * @name concat - * @owner Observable + * Expose */ -function concatStatic() { - var observables = []; - for (var _i = 0; _i < arguments.length; _i++) { - observables[_i - 0] = arguments[_i]; + +module.exports = exports = function(sel, context) { + /* when context isn't a DocumentFragment and the selector is simple: */ + var id, r; + if (context.nodeType !== 11 && sel.indexOf(' ') === -1) { + if (sel[0] === '#' && context.rooted && /^#[A-Z_][-A-Z0-9_]*$/i.test(sel)) { + if (context.doc._hasMultipleElementsWithId) { + id = sel.substring(1); + if (!context.doc._hasMultipleElementsWithId(id)) { + r = context.doc.getElementById(id); + return r ? [r] : []; + } + } } - var scheduler = null; - var args = observables; - if (isScheduler_1.isScheduler(args[observables.length - 1])) { - scheduler = args.pop(); + if (sel[0] === '.' && /^\.\w+$/.test(sel)) { + return context.getElementsByClassName(sel.substring(1)); } - if (scheduler === null && observables.length === 1 && observables[0] instanceof Observable_1.Observable) { - return observables[0]; + if (/^\w+$/.test(sel)) { + return context.getElementsByTagName(sel); } - return new ArrayObservable_1.ArrayObservable(observables, scheduler).lift(new mergeAll_1.MergeAllOperator(1)); -} -exports.concatStatic = concatStatic; -//# sourceMappingURL=concat.js.map + } + /* do things the hard/slow way */ + return find(sel, context); +}; + +exports.selectors = selectors; +exports.operators = operators; +exports.combinators = combinators; + +exports.matches = function(el, sel) { + var test = { sel: sel }; + do { + test = compile(test.sel); + if (test(el)) { return true; } + } while (test.sel); + return false; +}; + /***/ }), -/* 39 */ +/* 24 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; -var ArrayObservable_1 = __webpack_require__(14); -var isArray_1 = __webpack_require__(15); -var Subscriber_1 = __webpack_require__(2); -var OuterSubscriber_1 = __webpack_require__(4); -var subscribeToResult_1 = __webpack_require__(3); -var iterator_1 = __webpack_require__(78); -/* tslint:enable:max-line-length */ +// This grammar is from the XML and XML Namespace specs. It specifies whether +// a string (such as an element or attribute name) is a valid Name or QName. +// +// Name ::= NameStartChar (NameChar)* +// NameStartChar ::= ":" | [A-Z] | "_" | [a-z] | +// [#xC0-#xD6] | [#xD8-#xF6] | [#xF8-#x2FF] | +// [#x370-#x37D] | [#x37F-#x1FFF] | +// [#x200C-#x200D] | [#x2070-#x218F] | +// [#x2C00-#x2FEF] | [#x3001-#xD7FF] | +// [#xF900-#xFDCF] | [#xFDF0-#xFFFD] | +// [#x10000-#xEFFFF] +// +// NameChar ::= NameStartChar | "-" | "." | [0-9] | +// #xB7 | [#x0300-#x036F] | [#x203F-#x2040] +// +// QName ::= PrefixedName| UnprefixedName +// PrefixedName ::= Prefix ':' LocalPart +// UnprefixedName ::= LocalPart +// Prefix ::= NCName +// LocalPart ::= NCName +// NCName ::= Name - (Char* ':' Char*) +// # An XML Name, minus the ":" +// + +exports.isValidName = isValidName; +exports.isValidQName = isValidQName; + +// Most names will be ASCII only. Try matching against simple regexps first +var simplename = /^[_:A-Za-z][-.:\w]+$/; +var simpleqname = /^([_A-Za-z][-.\w]+|[_A-Za-z][-.\w]+:[_A-Za-z][-.\w]+)$/; + +// If the regular expressions above fail, try more complex ones that work +// for any identifiers using codepoints from the Unicode BMP +var ncnamestartchars = "_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02ff\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD"; +var ncnamechars = "-._A-Za-z0-9\u00B7\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02ff\u0300-\u037D\u037F-\u1FFF\u200C\u200D\u203f\u2040\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD"; + +var ncname = "[" + ncnamestartchars + "][" + ncnamechars + "]*"; +var namestartchars = ncnamestartchars + ":"; +var namechars = ncnamechars + ":"; +var name = new RegExp("^[" + namestartchars + "]" + "[" + namechars + "]*$"); +var qname = new RegExp("^(" + ncname + "|" + ncname + ":" + ncname + ")$"); + +// XML says that these characters are also legal: +// [#x10000-#xEFFFF]. So if the patterns above fail, and the +// target string includes surrogates, then try the following +// patterns that allow surrogates and then run an extra validation +// step to make sure that the surrogates are in valid pairs and in +// the right range. Note that since the characters \uf0000 to \u1f0000 +// are not allowed, it means that the high surrogate can only go up to +// \uDB7f instead of \uDBFF. +var hassurrogates = /[\uD800-\uDB7F\uDC00-\uDFFF]/; +var surrogatechars = /[\uD800-\uDB7F\uDC00-\uDFFF]/g; +var surrogatepairs = /[\uD800-\uDB7F][\uDC00-\uDFFF]/g; + +// Modify the variables above to allow surrogates +ncnamestartchars += "\uD800-\uDB7F\uDC00-\uDFFF"; +ncnamechars += "\uD800-\uDB7F\uDC00-\uDFFF"; +ncname = "[" + ncnamestartchars + "][" + ncnamechars + "]*"; +namestartchars = ncnamestartchars + ":"; +namechars = ncnamechars + ":"; + +// Build another set of regexps that include surrogates +var surrogatename = new RegExp("^[" + namestartchars + "]" + "[" + namechars + "]*$"); +var surrogateqname = new RegExp("^(" + ncname + "|" + ncname + ":" + ncname + ")$"); + +function isValidName(s) { + if (simplename.test(s)) return true; // Plain ASCII + if (name.test(s)) return true; // Unicode BMP + + // Maybe the tests above failed because s includes surrogate pairs + // Most likely, though, they failed for some more basic syntax problem + if (!hassurrogates.test(s)) return false; + + // Is the string a valid name if we allow surrogates? + if (!surrogatename.test(s)) return false; + + // Finally, are the surrogates all correctly paired up? + var chars = s.match(surrogatechars), pairs = s.match(surrogatepairs); + return pairs !== null && 2*pairs.length === chars.length; +} + +function isValidQName(s) { + if (simpleqname.test(s)) return true; // Plain ASCII + if (qname.test(s)) return true; // Unicode BMP + + if (!hassurrogates.test(s)) return false; + if (!surrogateqname.test(s)) return false; + var chars = s.match(surrogatechars), pairs = s.match(surrogatepairs); + return pairs !== null && 2*pairs.length === chars.length; +} + + +/***/ }), +/* 25 */ +/***/ (function(module, exports, __webpack_require__) { + /** - * @param observables - * @return {Observable} - * @method zip - * @owner Observable + * @license Angular v5.0.1 + * (c) 2010-2017 Google, Inc. https://angular.io/ + * License: MIT */ -function zipProto() { - var observables = []; - for (var _i = 0; _i < arguments.length; _i++) { - observables[_i - 0] = arguments[_i]; - } - return this.lift.call(zipStatic.apply(void 0, [this].concat(observables))); +(function (global, factory) { + true ? factory(exports, __webpack_require__(4), __webpack_require__(53), __webpack_require__(26), __webpack_require__(5), __webpack_require__(13), __webpack_require__(130), __webpack_require__(131), __webpack_require__(63), __webpack_require__(2), __webpack_require__(132), __webpack_require__(57), __webpack_require__(125), __webpack_require__(126), __webpack_require__(55), __webpack_require__(110)) : + typeof define === 'function' && define.amd ? define('@angular/platform-server', ['exports', '@angular/core', '@angular/platform-browser', '@angular/animations/browser', '@angular/common', '@angular/common/http', '@angular/http', '@angular/platform-browser-dynamic', '@angular/platform-browser/animations', 'rxjs/Observable', 'rxjs/Subject', 'url', '@angular/compiler', 'rxjs/operator/filter', 'rxjs/operator/first', 'rxjs/operator/toPromise'], factory) : + (factory((global.ng = global.ng || {}, global.ng.platformServer = {}),global.ng.core,global.ng.platformBrowser,global.ng.animations.browser,global.ng.common,global.ng.common.http,global.ng.http,global.ng.platformBrowserDynamic,global.ng.platformBrowser.animations,global.Rx,global.Rx,global.url,global.ng.compiler,global.Rx.Observable.prototype,global.Rx.Observable.prototype,global.Rx.Observable.prototype)); +}(this, (function (exports,_angular_core,_angular_platformBrowser,_angular_animations_browser,_angular_common,_angular_common_http,_angular_http,_angular_platformBrowserDynamic,_angular_platformBrowser_animations,rxjs_Observable,rxjs_Subject,url,_angular_compiler,rxjs_operator_filter,rxjs_operator_first,rxjs_operator_toPromise) { '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 __()); } -exports.zipProto = zipProto; -/* tslint:enable:max-line-length */ + /** - * Combines multiple Observables to create an Observable whose values are calculated from the values, in order, of each - * of its input Observables. - * - * If the latest parameter is a function, this function is used to compute the created value from the input values. - * Otherwise, an array of the input values is returned. - * - * @example Combine age and name from different sources - * - * let age$ = Observable.of(27, 25, 29); - * let name$ = Observable.of('Foo', 'Bar', 'Beer'); - * let isDev$ = Observable.of(true, true, false); - * - * Observable - * .zip(age$, - * name$, - * isDev$, - * (age: number, name: string, isDev: boolean) => ({ age, name, isDev })) - * .subscribe(x => console.log(x)); - * - * // outputs - * // { age: 27, name: 'Foo', isDev: true } - * // { age: 25, name: 'Bar', isDev: true } - * // { age: 29, name: 'Beer', isDev: false } + * @license Angular v5.0.1 + * (c) 2010-2017 Google, Inc. https://angular.io/ + * License: MIT + */ +/** + * @fileoverview added by tsickle + * @suppress {checkTypes} checked by tsc + */ +/** + * @license + * Copyright Google Inc. All Rights Reserved. * - * @param observables - * @return {Observable} - * @static true - * @name zip - * @owner Observable + * 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 */ -function zipStatic() { - var observables = []; - for (var _i = 0; _i < arguments.length; _i++) { - observables[_i - 0] = arguments[_i]; - } - var project = observables[observables.length - 1]; - if (typeof project === 'function') { - observables.pop(); - } - return new ArrayObservable_1.ArrayObservable(observables).lift(new ZipOperator(project)); -} -exports.zipStatic = zipStatic; -var ZipOperator = (function () { - function ZipOperator(project) { - this.project = project; - } - ZipOperator.prototype.call = function (subscriber, source) { - return source.subscribe(new ZipSubscriber(subscriber, this.project)); - }; - return ZipOperator; -}()); -exports.ZipOperator = ZipOperator; +var domino = __webpack_require__(82); /** - * We need this JSDoc comment for affecting ESDoc. - * @ignore - * @extends {Ignored} + * @param {?} methodName + * @return {?} */ -var ZipSubscriber = (function (_super) { - __extends(ZipSubscriber, _super); - function ZipSubscriber(destination, project, values) { - if (values === void 0) { values = Object.create(null); } - _super.call(this, destination); - this.iterators = []; - this.active = 0; - this.project = (typeof project === 'function') ? project : null; - this.values = values; - } - ZipSubscriber.prototype._next = function (value) { - var iterators = this.iterators; - if (isArray_1.isArray(value)) { - iterators.push(new StaticArrayIterator(value)); - } - else if (typeof value[iterator_1.iterator] === 'function') { - iterators.push(new StaticIterator(value[iterator_1.iterator]())); - } - else { - iterators.push(new ZipBufferIterator(this.destination, this, value)); - } - }; - ZipSubscriber.prototype._complete = function () { - var iterators = this.iterators; - var len = iterators.length; - if (len === 0) { - this.destination.complete(); - return; - } - this.active = len; - for (var i = 0; i < len; i++) { - var iterator = iterators[i]; - if (iterator.stillUnsubscribed) { - this.add(iterator.subscribe(iterator, i)); - } - else { - this.active--; // not an observable - } - } - }; - ZipSubscriber.prototype.notifyInactive = function () { - this.active--; - if (this.active === 0) { - this.destination.complete(); - } - }; - ZipSubscriber.prototype.checkIterators = function () { - var iterators = this.iterators; - var len = iterators.length; - var destination = this.destination; - // abort if not all of them have values - for (var i = 0; i < len; i++) { - var iterator = iterators[i]; - if (typeof iterator.hasValue === 'function' && !iterator.hasValue()) { - return; - } - } - var shouldComplete = false; - var args = []; - for (var i = 0; i < len; i++) { - var iterator = iterators[i]; - var result = iterator.next(); - // check to see if it's completed now that you've gotten - // the next value. - if (iterator.hasCompleted()) { - shouldComplete = true; - } - if (result.done) { - destination.complete(); - return; - } - args.push(result.value); - } - if (this.project) { - this._tryProject(args); - } - else { - destination.next(args); - } - if (shouldComplete) { - destination.complete(); - } - }; - ZipSubscriber.prototype._tryProject = function (args) { - var result; - try { - result = this.project.apply(this, args); - } - catch (err) { - this.destination.error(err); - return; - } - this.destination.next(result); - }; - return ZipSubscriber; -}(Subscriber_1.Subscriber)); -exports.ZipSubscriber = ZipSubscriber; -var StaticIterator = (function () { - function StaticIterator(iterator) { - this.iterator = iterator; - this.nextResult = iterator.next(); - } - StaticIterator.prototype.hasValue = function () { - return true; - }; - StaticIterator.prototype.next = function () { - var result = this.nextResult; - this.nextResult = this.iterator.next(); - return result; - }; - StaticIterator.prototype.hasCompleted = function () { - var nextResult = this.nextResult; - return nextResult && nextResult.done; - }; - return StaticIterator; -}()); -var StaticArrayIterator = (function () { - function StaticArrayIterator(array) { - this.array = array; - this.index = 0; - this.length = 0; - this.length = array.length; - } - StaticArrayIterator.prototype[iterator_1.iterator] = function () { - return this; - }; - StaticArrayIterator.prototype.next = function (value) { - var i = this.index++; - var array = this.array; - return i < this.length ? { value: array[i], done: false } : { value: null, done: true }; - }; - StaticArrayIterator.prototype.hasValue = function () { - return this.array.length > this.index; - }; - StaticArrayIterator.prototype.hasCompleted = function () { - return this.array.length === this.index; - }; - return StaticArrayIterator; -}()); -/** - * We need this JSDoc comment for affecting ESDoc. - * @ignore - * @extends {Ignored} - */ -var ZipBufferIterator = (function (_super) { - __extends(ZipBufferIterator, _super); - function ZipBufferIterator(destination, parent, observable) { - _super.call(this, destination); - this.parent = parent; - this.observable = observable; - this.stillUnsubscribed = true; - this.buffer = []; - this.isComplete = false; - } - ZipBufferIterator.prototype[iterator_1.iterator] = function () { - return this; - }; - // NOTE: there is actually a name collision here with Subscriber.next and Iterator.next - // this is legit because `next()` will never be called by a subscription in this case. - ZipBufferIterator.prototype.next = function () { - var buffer = this.buffer; - if (buffer.length === 0 && this.isComplete) { - return { value: null, done: true }; - } - else { - return { value: buffer.shift(), done: false }; - } - }; - ZipBufferIterator.prototype.hasValue = function () { - return this.buffer.length > 0; - }; - ZipBufferIterator.prototype.hasCompleted = function () { - return this.buffer.length === 0 && this.isComplete; - }; - ZipBufferIterator.prototype.notifyComplete = function () { - if (this.buffer.length > 0) { - this.isComplete = true; - this.parent.notifyInactive(); - } - else { - this.destination.complete(); - } - }; - ZipBufferIterator.prototype.notifyNext = function (outerValue, innerValue, outerIndex, innerIndex, innerSub) { - this.buffer.push(innerValue); - this.parent.checkIterators(); - }; - ZipBufferIterator.prototype.subscribe = function (value, index) { - return subscribeToResult_1.subscribeToResult(this, this.observable, this, index); - }; - return ZipBufferIterator; -}(OuterSubscriber_1.OuterSubscriber)); -//# sourceMappingURL=zip.js.map - -/***/ }), -/* 40 */ -/***/ (function(module, exports, __webpack_require__) { - -module.exports = (__webpack_require__(1))(26); - -/***/ }), -/* 41 */ -/***/ (function(module, exports, __webpack_require__) { - -module.exports = (__webpack_require__(1))(65); - -/***/ }), -/* 42 */ -/***/ (function(module, exports, __webpack_require__) { - -module.exports = (__webpack_require__(1))(82); - -/***/ }), -/* 43 */ -/***/ (function(module, exports, __webpack_require__) { - -module.exports = (__webpack_require__(1))(88); - -/***/ }), -/* 44 */ -/***/ (function(module, exports, __webpack_require__) { - -/** - * @license Angular v4.2.5 - * (c) 2010-2017 Google, Inc. https://angular.io/ - * License: MIT - */ -(function (global, factory) { - true ? factory(exports, __webpack_require__(10), __webpack_require__(84), __webpack_require__(46), __webpack_require__(17), __webpack_require__(380), __webpack_require__(29), __webpack_require__(93), __webpack_require__(0), __webpack_require__(6), __webpack_require__(88), __webpack_require__(42), __webpack_require__(86), __webpack_require__(68)) : - typeof define === 'function' && define.amd ? define(['exports', '@angular/core', '@angular/platform-browser', '@angular/animations/browser', '@angular/common', '@angular/compiler', '@angular/http', '@angular/platform-browser/animations', 'rxjs/Observable', 'rxjs/Subject', 'url', 'rxjs/operator/filter', 'rxjs/operator/first', 'rxjs/operator/toPromise'], factory) : - (factory((global.ng = global.ng || {}, global.ng.platformServer = global.ng.platformServer || {}),global.ng.core,global.ng.platformBrowser,global._angular_animations_browser,global.ng.common,global.ng.compiler,global._angular_http,global._angular_platformBrowser_animations,global.Rx,global.Rx,global.url,global.Rx.Observable.prototype,global.Rx.Observable.prototype,global.Rx.Observable.prototype)); -}(this, (function (exports,_angular_core,_angular_platformBrowser,_angular_animations_browser,_angular_common,_angular_compiler,_angular_http,_angular_platformBrowser_animations,rxjs_Observable,rxjs_Subject,url,rxjs_operator_filter,rxjs_operator_first,rxjs_operator_toPromise) { '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 __()); +function _notImplemented(methodName) { + return new Error('This method is not implemented in DominoAdapter: ' + methodName); } - /** - * @license Angular v4.2.5 - * (c) 2010-2017 Google, Inc. https://angular.io/ - * License: MIT + * Parses a document string to a Document object. + * @param {?} html + * @param {?=} url + * @return {?} */ +function parseDocument(html, url$$1) { + if (url$$1 === void 0) { url$$1 = '/'; } + var /** @type {?} */ window = domino.createWindow(html, url$$1); + var /** @type {?} */ doc = window.document; + return doc; +} /** - * @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 + * Serializes a document to string. + * @param {?} doc + * @return {?} */ -var parse5 = __webpack_require__(35); +function serializeDocument(doc) { + return (/** @type {?} */ (doc)).serialize(); +} /** - * Representation of the current platform state. - * - * \@experimental + * DOM Adapter for the server platform based on https://github.com/fgnass/domino. */ -var PlatformState = (function () { +var DominoAdapter = (function (_super) { + __extends(DominoAdapter, _super); + function DominoAdapter() { + return _super !== null && _super.apply(this, arguments) || this; + } /** - * @param {?} _doc + * @return {?} */ - function PlatformState(_doc) { - this._doc = _doc; - } + DominoAdapter.makeCurrent = /** + * @return {?} + */ + function () { _angular_platformBrowser.ɵsetRootDomAdapter(new DominoAdapter()); }; /** - * Renders the current state of the platform to string. + * @param {?} error + * @return {?} + */ + DominoAdapter.prototype.logError = /** + * @param {?} error * @return {?} */ - PlatformState.prototype.renderToString = function () { return _angular_platformBrowser.ɵgetDOM().getInnerHTML(this._doc); }; + function (error) { console.error(error); }; /** - * Returns the current DOM state. + * @param {?} error * @return {?} */ - PlatformState.prototype.getDocument = function () { return this._doc; }; - return PlatformState; -}()); -PlatformState.decorators = [ - { type: _angular_core.Injectable }, -]; -/** - * @nocollapse - */ -PlatformState.ctorParameters = function () { return [ - { type: undefined, decorators: [{ type: _angular_core.Inject, args: [_angular_platformBrowser.DOCUMENT,] },] }, -]; }; -/** - * @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 xhr2 = __webpack_require__(377); -var isAbsoluteUrl = /^[a-zA-Z\-\+.]+:\/\//; -/** - * @param {?} url - * @return {?} - */ -function validateRequestUrl(url$$1) { - if (!isAbsoluteUrl.test(url$$1)) { - throw new Error("URLs requested via Http on the server must be absolute. URL: " + url$$1); - } -} -var ServerXhr = (function () { - function ServerXhr() { - } + DominoAdapter.prototype.log = /** + * @param {?} error + * @return {?} + */ + function (error) { + // tslint:disable-next-line:no-console + console.log(error); + }; /** + * @param {?} error * @return {?} */ - ServerXhr.prototype.build = function () { return new xhr2.XMLHttpRequest(); }; - return ServerXhr; -}()); -ServerXhr.decorators = [ - { type: _angular_core.Injectable }, -]; -/** - * @nocollapse - */ -ServerXhr.ctorParameters = function () { return []; }; -var ServerXsrfStrategy = (function () { - function ServerXsrfStrategy() { - } + DominoAdapter.prototype.logGroup = /** + * @param {?} error + * @return {?} + */ + function (error) { console.error(error); }; /** - * @param {?} req * @return {?} */ - ServerXsrfStrategy.prototype.configureRequest = function (req) { }; - return ServerXsrfStrategy; -}()); -ServerXsrfStrategy.decorators = [ - { type: _angular_core.Injectable }, -]; -/** - * @nocollapse - */ -ServerXsrfStrategy.ctorParameters = function () { return []; }; -var ZoneMacroTaskConnection = (function () { + DominoAdapter.prototype.logGroupEnd = /** + * @return {?} + */ + function () { }; /** - * @param {?} request - * @param {?} backend + * @return {?} */ - function ZoneMacroTaskConnection(request, backend) { - var _this = this; - this.request = request; - validateRequestUrl(request.url); - this.response = new rxjs_Observable.Observable(function (observer) { - var task = null; - var scheduled = false; - var sub = null; - var savedResult = null; - var savedError = null; - var scheduleTask = function (_task) { - task = _task; - scheduled = true; - _this.lastConnection = backend.createConnection(request); - sub = _this.lastConnection.response - .subscribe(function (res) { return savedResult = res; }, function (err) { - if (!scheduled) { - throw new Error('invoke twice'); - } - savedError = err; - scheduled = false; - task.invoke(); - }, function () { - if (!scheduled) { - throw new Error('invoke twice'); - } - scheduled = false; - task.invoke(); - }); - }; - var cancelTask = function (_task) { - if (!scheduled) { - return; - } - scheduled = false; - if (sub) { - sub.unsubscribe(); - sub = null; - } - }; - var onComplete = function () { - if (savedError !== null) { - observer.error(savedError); - } - else { - observer.next(savedResult); - observer.complete(); - } - }; - // MockBackend is currently synchronous, which means that if scheduleTask is by - // scheduleMacroTask, the request will hit MockBackend and the response will be - // sent, causing task.invoke() to be called. - var _task = Zone.current.scheduleMacroTask('ZoneMacroTaskConnection.subscribe', onComplete, {}, function () { return null; }, cancelTask); - scheduleTask(_task); - return function () { - if (scheduled && task) { - task.zone.cancelTask(task); - scheduled = false; - } - if (sub) { - sub.unsubscribe(); - sub = null; - } - }; - }); - } - Object.defineProperty(ZoneMacroTaskConnection.prototype, "readyState", { - /** - * @return {?} - */ - get: function () { - return !!this.lastConnection ? this.lastConnection.readyState : _angular_http.ReadyState.Unsent; - }, - enumerable: true, - configurable: true - }); - return ZoneMacroTaskConnection; -}()); -var ZoneMacroTaskBackend = (function () { - /** - * @param {?} backend + DominoAdapter.prototype.supportsDOMEvents = /** + * @return {?} */ - function ZoneMacroTaskBackend(backend) { - this.backend = backend; - } + function () { return false; }; /** - * @param {?} request * @return {?} */ - ZoneMacroTaskBackend.prototype.createConnection = function (request) { - return new ZoneMacroTaskConnection(request, this.backend); - }; - return ZoneMacroTaskBackend; -}()); -/** - * @param {?} xhrBackend - * @param {?} options - * @return {?} - */ -function httpFactory(xhrBackend, options) { - var /** @type {?} */ macroBackend = new ZoneMacroTaskBackend(xhrBackend); - return new _angular_http.Http(macroBackend, options); -} -var SERVER_HTTP_PROVIDERS = [ - { provide: _angular_http.Http, useFactory: httpFactory, deps: [_angular_http.XHRBackend, _angular_http.RequestOptions] }, - { provide: _angular_http.BrowserXhr, useClass: ServerXhr }, - { provide: _angular_http.XSRFStrategy, useClass: ServerXsrfStrategy }, -]; -/** - * @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 - */ -/** - * The DI token for setting the initial config for the platform. - * - * \@experimental - */ -var INITIAL_CONFIG = new _angular_core.InjectionToken('Server.INITIAL_CONFIG'); -/** - * @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 {?} urlStr - * @return {?} - */ -function parseUrl(urlStr) { - var /** @type {?} */ parsedUrl = url.parse(urlStr); - return { - pathname: parsedUrl.pathname || '', - search: parsedUrl.search || '', - hash: parsedUrl.hash || '', - }; -} -/** - * Server-side implementation of URL state. Implements `pathname`, `search`, and `hash` - * but not the state stack. - */ -var ServerPlatformLocation = (function () { + DominoAdapter.prototype.supportsNativeShadowDOM = /** + * @return {?} + */ + function () { return false; }; /** - * @param {?} _doc - * @param {?} _config + * @param {?} nodeA + * @param {?} nodeB + * @return {?} */ - function ServerPlatformLocation(_doc, _config) { - this._doc = _doc; - this._path = '/'; - this._search = ''; - this._hash = ''; - this._hashUpdate = new rxjs_Subject.Subject(); - var config = _config; - if (!!config && !!config.url) { - var parsedUrl = parseUrl(config.url); - this._path = parsedUrl.pathname; - this._search = parsedUrl.search; - this._hash = parsedUrl.hash; + DominoAdapter.prototype.contains = /** + * @param {?} nodeA + * @param {?} nodeB + * @return {?} + */ + function (nodeA, nodeB) { + var /** @type {?} */ inner = nodeB; + while (inner) { + if (inner === nodeA) + return true; + inner = inner.parent; } - } + return false; + }; /** * @return {?} */ - ServerPlatformLocation.prototype.getBaseHrefFromDOM = function () { return ((_angular_platformBrowser.ɵgetDOM().getBaseHref(this._doc))); }; - /** - * @param {?} fn + DominoAdapter.prototype.createHtmlDocument = /** * @return {?} */ - ServerPlatformLocation.prototype.onPopState = function (fn) { - // No-op: a state stack is not implemented, so - // no events will ever come. + function () { + return parseDocument('fakeTitle'); }; /** - * @param {?} fn * @return {?} */ - ServerPlatformLocation.prototype.onHashChange = function (fn) { this._hashUpdate.subscribe(fn); }; - Object.defineProperty(ServerPlatformLocation.prototype, "pathname", { - /** - * @return {?} - */ - get: function () { return this._path; }, - enumerable: true, - configurable: true - }); - Object.defineProperty(ServerPlatformLocation.prototype, "search", { - /** - * @return {?} - */ - get: function () { return this._search; }, - enumerable: true, - configurable: true - }); - Object.defineProperty(ServerPlatformLocation.prototype, "hash", { - /** - * @return {?} - */ - get: function () { return this._hash; }, - enumerable: true, - configurable: true - }); - Object.defineProperty(ServerPlatformLocation.prototype, "url", { - /** - * @return {?} - */ - get: function () { return "" + this.pathname + this.search + this.hash; }, - enumerable: true, - configurable: true - }); - /** - * @param {?} value - * @param {?} oldUrl + DominoAdapter.prototype.getDefaultDocument = /** * @return {?} */ - ServerPlatformLocation.prototype.setHash = function (value, oldUrl) { - var _this = this; - if (this._hash === value) { - // Don't fire events if the hash has not changed. - return; + function () { + if (!DominoAdapter.defaultDoc) { + DominoAdapter.defaultDoc = domino.createDocument(); } - this._hash = value; - var /** @type {?} */ newUrl = this.url; - scheduleMicroTask(function () { return _this._hashUpdate.next(/** @type {?} */ ({ type: 'hashchange', oldUrl: oldUrl, newUrl: newUrl })); }); + return DominoAdapter.defaultDoc; }; /** - * @param {?} state - * @param {?} title - * @param {?} newUrl + * @param {?} el + * @param {?=} doc * @return {?} */ - ServerPlatformLocation.prototype.replaceState = function (state, title, newUrl) { - var /** @type {?} */ oldUrl = this.url; - var /** @type {?} */ parsedUrl = parseUrl(newUrl); - this._path = parsedUrl.pathname; - this._search = parsedUrl.search; - this.setHash(parsedUrl.hash, oldUrl); - }; - /** - * @param {?} state - * @param {?} title - * @param {?} newUrl + DominoAdapter.prototype.createShadowRoot = /** + * @param {?} el + * @param {?=} doc * @return {?} */ - ServerPlatformLocation.prototype.pushState = function (state, title, newUrl) { - this.replaceState(state, title, newUrl); + function (el, doc) { + if (doc === void 0) { doc = document; } + el.shadowRoot = doc.createDocumentFragment(); + el.shadowRoot.parent = el; + return el.shadowRoot; }; /** + * @param {?} el * @return {?} */ - ServerPlatformLocation.prototype.forward = function () { throw new Error('Not implemented'); }; - /** + DominoAdapter.prototype.getShadowRoot = /** + * @param {?} el * @return {?} */ - ServerPlatformLocation.prototype.back = function () { throw new Error('Not implemented'); }; - return ServerPlatformLocation; -}()); -ServerPlatformLocation.decorators = [ - { type: _angular_core.Injectable }, -]; -/** - * @nocollapse - */ -ServerPlatformLocation.ctorParameters = function () { return [ - { type: undefined, decorators: [{ type: _angular_core.Inject, args: [_angular_platformBrowser.DOCUMENT,] },] }, - { type: undefined, decorators: [{ type: _angular_core.Optional }, { type: _angular_core.Inject, args: [INITIAL_CONFIG,] },] }, -]; }; -/** - * @param {?} fn - * @return {?} - */ -function scheduleMicroTask(fn) { - Zone.current.scheduleMicroTask('scheduleMicrotask', fn); -} -/** - * @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 parse5$1 = __webpack_require__(35); -var treeAdapter; -var _attrToPropMap = { - 'class': 'className', - 'innerHtml': 'innerHTML', - 'readonly': 'readOnly', - 'tabindex': 'tabIndex', -}; -var mapProps = ['attribs', 'x-attribsNamespace', 'x-attribsPrefix']; -/** - * @param {?} methodName - * @return {?} - */ -function _notImplemented(methodName) { - return new Error('This method is not implemented in Parse5DomAdapter: ' + methodName); -} -/** - * @param {?} el - * @param {?} name - * @return {?} - */ -function _getElement(el, name) { - for (var /** @type {?} */ i = 0; i < el.childNodes.length; i++) { - var /** @type {?} */ node = el.childNodes[i]; - if (node.name === name) { - return node; - } - } - return null; -} -/** - * Parses a document string to a Document object. - * @param {?} html - * @return {?} - */ -function parseDocument(html) { - var /** @type {?} */ doc = parse5$1.parse(html, { treeAdapter: parse5$1.treeAdapters.htmlparser2 }); - var /** @type {?} */ docElement = _getElement(doc, 'html'); - doc['head'] = _getElement(docElement, 'head'); - doc['body'] = _getElement(docElement, 'body'); - doc['_window'] = {}; - return doc; -} -/** - * A `DomAdapter` powered by the `parse5` NodeJS module. - * - * \@security Tread carefully! Interacting with the DOM directly is dangerous and - * can introduce XSS risks. - */ -var Parse5DomAdapter = (function (_super) { - __extends(Parse5DomAdapter, _super); - function Parse5DomAdapter() { - return _super !== null && _super.apply(this, arguments) || this; - } + function (el) { return el.shadowRoot; }; /** + * @param {?} node * @return {?} */ - Parse5DomAdapter.makeCurrent = function () { - treeAdapter = parse5$1.treeAdapters.htmlparser2; - _angular_platformBrowser.ɵsetRootDomAdapter(new Parse5DomAdapter()); - }; - /** - * @param {?} nodeA - * @param {?} nodeB + DominoAdapter.prototype.isTextNode = /** + * @param {?} node * @return {?} */ - Parse5DomAdapter.prototype.contains = function (nodeA, nodeB) { - var /** @type {?} */ inner = nodeB; - while (inner) { - if (inner === nodeA) - return true; - inner = inner.parent; - } - return false; - }; + function (node) { return node.nodeType === DominoAdapter.defaultDoc.TEXT_NODE; }; /** - * @param {?} element - * @param {?} name + * @param {?} node + * @return {?} + */ + DominoAdapter.prototype.isCommentNode = /** + * @param {?} node * @return {?} */ - Parse5DomAdapter.prototype.hasProperty = function (element, name) { - return _HTMLElementPropertyList.indexOf(name) > -1; + function (node) { + return node.nodeType === DominoAdapter.defaultDoc.COMMENT_NODE; }; /** - * @param {?} el - * @param {?} name - * @param {?} value + * @param {?} node * @return {?} */ - Parse5DomAdapter.prototype.setProperty = function (el, name, value) { - if (name === 'innerHTML') { - this.setInnerHTML(el, value); - } - else if (name === 'innerText') { - this.setText(el, value); - } - else if (name === 'className') { - el.attribs['class'] = el.className = value; - } - else { - el[name] = value; - } + DominoAdapter.prototype.isElementNode = /** + * @param {?} node + * @return {?} + */ + function (node) { + return node ? node.nodeType === DominoAdapter.defaultDoc.ELEMENT_NODE : false; }; /** - * @param {?} el - * @param {?} name + * @param {?} node * @return {?} */ - Parse5DomAdapter.prototype.getProperty = function (el, name) { return el[name]; }; - /** - * @param {?} error + DominoAdapter.prototype.hasShadowRoot = /** + * @param {?} node * @return {?} */ - Parse5DomAdapter.prototype.logError = function (error) { console.error(error); }; + function (node) { return node.shadowRoot != null; }; /** - * @param {?} error + * @param {?} node * @return {?} */ - Parse5DomAdapter.prototype.log = function (error) { console.log(error); }; - /** - * @param {?} error + DominoAdapter.prototype.isShadowRoot = /** + * @param {?} node * @return {?} */ - Parse5DomAdapter.prototype.logGroup = function (error) { console.error(error); }; + function (node) { return this.getShadowRoot(node) == node; }; /** + * @param {?} el + * @param {?} name * @return {?} */ - Parse5DomAdapter.prototype.logGroupEnd = function () { }; - Object.defineProperty(Parse5DomAdapter.prototype, "attrToPropMap", { - /** - * @return {?} - */ - get: function () { return _attrToPropMap; }, - enumerable: true, - configurable: true - }); - /** + DominoAdapter.prototype.getProperty = /** * @param {?} el - * @param {?} selector + * @param {?} name * @return {?} */ - Parse5DomAdapter.prototype.querySelector = function (el, selector) { - return this.querySelectorAll(el, selector)[0] || null; + function (el, name) { + if (name === 'href') { + // Domino tries tp resolve href-s which we do not want. Just return the + // atribute value. + return this.getAttribute(el, 'href'); + } + else if (name === 'innerText') { + // Domino does not support innerText. Just map it to textContent. + return el.textContent; + } + return (/** @type {?} */ (el))[name]; }; /** * @param {?} el - * @param {?} selector + * @param {?} name + * @param {?} value * @return {?} */ - Parse5DomAdapter.prototype.querySelectorAll = function (el, selector) { - var _this = this; - var /** @type {?} */ res = []; - var /** @type {?} */ _recursive = function (result, node, selector, matcher) { - var /** @type {?} */ cNodes = node.childNodes; - if (cNodes && cNodes.length > 0) { - for (var /** @type {?} */ i = 0; i < cNodes.length; i++) { - var /** @type {?} */ childNode = cNodes[i]; - if (_this.elementMatches(childNode, selector, matcher)) { - result.push(childNode); - } - _recursive(result, childNode, selector, matcher); - } - } - }; - var /** @type {?} */ matcher = new _angular_compiler.SelectorMatcher(); - matcher.addSelectables(_angular_compiler.CssSelector.parse(selector)); - _recursive(res, el, selector, matcher); - return res; + DominoAdapter.prototype.setProperty = /** + * @param {?} el + * @param {?} name + * @param {?} value + * @return {?} + */ + function (el, name, value) { + if (name === 'href') { + // Eventhough the server renderer reflects any properties to attributes + // map 'href' to atribute just to handle when setProperty is directly called. + this.setAttribute(el, 'href', value); + } + else if (name === 'innerText') { + // Domino does not support innerText. Just map it to textContent. + el.textContent = value; + } + (/** @type {?} */ (el))[name] = value; }; /** - * @param {?} node - * @param {?} selector - * @param {?=} matcher + * @param {?} doc + * @param {?} target * @return {?} */ - Parse5DomAdapter.prototype.elementMatches = function (node, selector, matcher) { - if (matcher === void 0) { matcher = null; } - if (this.isElementNode(node) && selector === '*') { - return true; + DominoAdapter.prototype.getGlobalEventTarget = /** + * @param {?} doc + * @param {?} target + * @return {?} + */ + function (doc, target) { + if (target === 'window') { + return doc.defaultView; } - var /** @type {?} */ result = false; - if (selector && selector.charAt(0) == '#') { - result = this.getAttribute(node, 'id') == selector.substring(1); + if (target === 'document') { + return doc; } - else if (selector) { - if (!matcher) { - matcher = new _angular_compiler.SelectorMatcher(); - matcher.addSelectables(_angular_compiler.CssSelector.parse(selector)); - } - var /** @type {?} */ cssSelector = new _angular_compiler.CssSelector(); - cssSelector.setElement(this.tagName(node)); - if (node.attribs) { - for (var /** @type {?} */ attrName in node.attribs) { - cssSelector.addAttribute(attrName, node.attribs[attrName]); - } - } - var /** @type {?} */ classList = this.classList(node); - for (var /** @type {?} */ i = 0; i < classList.length; i++) { - cssSelector.addClassName(classList[i]); - } - matcher.match(cssSelector, function (selector, cb) { result = true; }); + if (target === 'body') { + return doc.body; } - return result; + return null; }; /** - * @param {?} el - * @param {?} evt - * @param {?} listener + * @param {?} doc * @return {?} */ - Parse5DomAdapter.prototype.on = function (el, evt, listener) { - var /** @type {?} */ listenersMap = el._eventListenersMap; - if (!listenersMap) { - listenersMap = {}; - el._eventListenersMap = listenersMap; + DominoAdapter.prototype.getBaseHref = /** + * @param {?} doc + * @return {?} + */ + function (doc) { + var /** @type {?} */ base = this.querySelector(doc.documentElement, 'base'); + var /** @type {?} */ href = ''; + if (base) { + href = this.getHref(base); } - var /** @type {?} */ listeners = listenersMap[evt] || []; - listenersMap[evt] = listeners.concat([listener]); + // TODO(alxhub): Need relative path logic from BrowserDomAdapter here? + return href; }; + /** @internal */ /** - * @param {?} el - * @param {?} evt - * @param {?} listener + * \@internal + * @param {?} element * @return {?} */ - Parse5DomAdapter.prototype.onAndCancel = function (el, evt, listener) { - this.on(el, evt, listener); - return function () { remove(/** @type {?} */ ((el._eventListenersMap[evt])), listener); }; - }; - /** - * @param {?} el - * @param {?} evt + DominoAdapter.prototype._readStyleAttribute = /** + * \@internal + * @param {?} element * @return {?} */ - Parse5DomAdapter.prototype.dispatchEvent = function (el, evt) { - if (!evt.target) { - evt.target = el; - } - if (el._eventListenersMap) { - var /** @type {?} */ listeners = el._eventListenersMap[evt.type]; - if (listeners) { - for (var /** @type {?} */ i = 0; i < listeners.length; i++) { - listeners[i](evt); + function (element) { + var /** @type {?} */ styleMap = {}; + var /** @type {?} */ styleAttribute = element.getAttribute('style'); + if (styleAttribute) { + var /** @type {?} */ styleList = styleAttribute.split(/;+/g); + for (var /** @type {?} */ i = 0; i < styleList.length; i++) { + if (styleList[i].length > 0) { + var /** @type {?} */ style = /** @type {?} */ (styleList[i]); + var /** @type {?} */ colon = style.indexOf(':'); + if (colon === -1) { + throw new Error("Invalid CSS style: " + style); + } + (/** @type {?} */ (styleMap))[style.substr(0, colon).trim()] = style.substr(colon + 1).trim(); } } } - if (el.parent) { - this.dispatchEvent(el.parent, evt); - } - if (el._window) { - this.dispatchEvent(el._window, evt); - } + return styleMap; }; + /** @internal */ /** - * @param {?} eventType + * \@internal + * @param {?} element + * @param {?} styleMap * @return {?} */ - Parse5DomAdapter.prototype.createMouseEvent = function (eventType) { return this.createEvent(eventType); }; - /** - * @param {?} eventType + DominoAdapter.prototype._writeStyleAttribute = /** + * \@internal + * @param {?} element + * @param {?} styleMap * @return {?} */ - Parse5DomAdapter.prototype.createEvent = function (eventType) { - var /** @type {?} */ event = ({ - type: eventType, - defaultPrevented: false, - preventDefault: function () { ((event)).defaultPrevented = true; } - }); - return event; + function (element, styleMap) { + var /** @type {?} */ styleAttrValue = ''; + for (var /** @type {?} */ key in styleMap) { + var /** @type {?} */ newValue = styleMap[key]; + if (newValue) { + styleAttrValue += key + ':' + styleMap[key] + ';'; + } + } + element.setAttribute('style', styleAttrValue); }; /** - * @param {?} event - * @return {?} - */ - Parse5DomAdapter.prototype.preventDefault = function (event) { event.returnValue = false; }; - /** - * @param {?} event + * @param {?} element + * @param {?} styleName + * @param {?=} styleValue * @return {?} */ - Parse5DomAdapter.prototype.isPrevented = function (event) { return event.returnValue != null && !event.returnValue; }; - /** - * @param {?} el + DominoAdapter.prototype.setStyle = /** + * @param {?} element + * @param {?} styleName + * @param {?=} styleValue * @return {?} */ - Parse5DomAdapter.prototype.getInnerHTML = function (el) { - return parse5$1.serialize(this.templateAwareRoot(el), { treeAdapter: treeAdapter }); + function (element, styleName, styleValue) { + var /** @type {?} */ styleMap = this._readStyleAttribute(element); + (/** @type {?} */ (styleMap))[styleName] = styleValue; + this._writeStyleAttribute(element, styleMap); }; /** - * @param {?} el + * @param {?} element + * @param {?} styleName * @return {?} */ - Parse5DomAdapter.prototype.getTemplateContent = function (el) { return null; }; - /** - * @param {?} el + DominoAdapter.prototype.removeStyle = /** + * @param {?} element + * @param {?} styleName * @return {?} */ - Parse5DomAdapter.prototype.getOuterHTML = function (el) { - var /** @type {?} */ fragment = treeAdapter.createDocumentFragment(); - this.appendChild(fragment, el); - return parse5$1.serialize(fragment, { treeAdapter: treeAdapter }); - }; + function (element, styleName) { this.setStyle(element, styleName, null); }; /** - * @param {?} node + * @param {?} element + * @param {?} styleName * @return {?} */ - Parse5DomAdapter.prototype.nodeName = function (node) { return node.tagName; }; - /** - * @param {?} node + DominoAdapter.prototype.getStyle = /** + * @param {?} element + * @param {?} styleName * @return {?} */ - Parse5DomAdapter.prototype.nodeValue = function (node) { return node.nodeValue; }; + function (element, styleName) { + var /** @type {?} */ styleMap = this._readStyleAttribute(element); + return styleMap.hasOwnProperty(styleName) ? (/** @type {?} */ (styleMap))[styleName] : ''; + }; /** - * @param {?} node + * @param {?} element + * @param {?} styleName + * @param {?=} styleValue * @return {?} */ - Parse5DomAdapter.prototype.type = function (node) { throw _notImplemented('type'); }; - /** - * @param {?} node + DominoAdapter.prototype.hasStyle = /** + * @param {?} element + * @param {?} styleName + * @param {?=} styleValue * @return {?} */ - Parse5DomAdapter.prototype.content = function (node) { return node.childNodes[0]; }; + function (element, styleName, styleValue) { + var /** @type {?} */ value = this.getStyle(element, styleName) || ''; + return styleValue ? value == styleValue : value.length > 0; + }; /** * @param {?} el + * @param {?} evt * @return {?} */ - Parse5DomAdapter.prototype.firstChild = function (el) { return el.firstChild; }; - /** + DominoAdapter.prototype.dispatchEvent = /** * @param {?} el + * @param {?} evt * @return {?} */ - Parse5DomAdapter.prototype.nextSibling = function (el) { return el.nextSibling; }; + function (el, evt) { + el.dispatchEvent(evt); + // Dispatch the event to the window also. + var /** @type {?} */ doc = el.ownerDocument || el; + var /** @type {?} */ win = (/** @type {?} */ (doc)).defaultView; + if (win) { + win.dispatchEvent(evt); + } + }; /** - * @param {?} el * @return {?} */ - Parse5DomAdapter.prototype.parentElement = function (el) { return el.parent; }; - /** - * @param {?} el + DominoAdapter.prototype.getHistory = /** * @return {?} */ - Parse5DomAdapter.prototype.childNodes = function (el) { return el.childNodes; }; + function () { throw _notImplemented('getHistory'); }; /** - * @param {?} el * @return {?} */ - Parse5DomAdapter.prototype.childNodesAsList = function (el) { - var /** @type {?} */ childNodes = el.childNodes; - var /** @type {?} */ res = new Array(childNodes.length); - for (var /** @type {?} */ i = 0; i < childNodes.length; i++) { - res[i] = childNodes[i]; - } - return res; - }; - /** - * @param {?} el + DominoAdapter.prototype.getLocation = /** * @return {?} */ - Parse5DomAdapter.prototype.clearNodes = function (el) { - while (el.childNodes.length > 0) { - this.remove(el.childNodes[0]); - } - }; + function () { throw _notImplemented('getLocation'); }; /** - * @param {?} el - * @param {?} node * @return {?} */ - Parse5DomAdapter.prototype.appendChild = function (el, node) { - this.remove(node); - treeAdapter.appendChild(this.templateAwareRoot(el), node); - }; - /** - * @param {?} el - * @param {?} node + DominoAdapter.prototype.getUserAgent = /** * @return {?} */ - Parse5DomAdapter.prototype.removeChild = function (el, node) { - if (el.childNodes.indexOf(node) > -1) { - this.remove(node); - } - }; + function () { return 'Fake user agent'; }; /** - * @param {?} el * @return {?} */ - Parse5DomAdapter.prototype.remove = function (el) { - var /** @type {?} */ parent = el.parent; - if (parent) { - var /** @type {?} */ index = parent.childNodes.indexOf(el); - parent.childNodes.splice(index, 1); - } - var /** @type {?} */ prev = el.previousSibling; - var /** @type {?} */ next = el.nextSibling; - if (prev) { - prev.next = next; - } - if (next) { - next.prev = prev; - } - el.prev = null; - el.next = null; - el.parent = null; - return el; - }; - /** - * @param {?} parent - * @param {?} ref - * @param {?} newNode + DominoAdapter.prototype.supportsWebAnimation = /** * @return {?} */ - Parse5DomAdapter.prototype.insertBefore = function (parent, ref, newNode) { - this.remove(newNode); - if (ref) { - treeAdapter.insertBefore(parent, newNode, ref); - } - else { - this.appendChild(parent, newNode); - } - }; + function () { return false; }; /** - * @param {?} parent - * @param {?} ref - * @param {?} nodes * @return {?} */ - Parse5DomAdapter.prototype.insertAllBefore = function (parent, ref, nodes) { - var _this = this; - nodes.forEach(function (n) { return _this.insertBefore(parent, ref, n); }); - }; - /** - * @param {?} parent - * @param {?} ref - * @param {?} node + DominoAdapter.prototype.performanceNow = /** * @return {?} */ - Parse5DomAdapter.prototype.insertAfter = function (parent, ref, node) { - if (ref.nextSibling) { - this.insertBefore(parent, ref.nextSibling, node); - } - else { - this.appendChild(parent, node); - } - }; + function () { return Date.now(); }; /** - * @param {?} el - * @param {?} value * @return {?} */ - Parse5DomAdapter.prototype.setInnerHTML = function (el, value) { - this.clearNodes(el); - var /** @type {?} */ content = parse5$1.parseFragment(value, { treeAdapter: treeAdapter }); - for (var /** @type {?} */ i = 0; i < content.childNodes.length; i++) { - treeAdapter.appendChild(el, content.childNodes[i]); - } - }; - /** - * @param {?} el - * @param {?=} isRecursive + DominoAdapter.prototype.getAnimationPrefix = /** * @return {?} */ - Parse5DomAdapter.prototype.getText = function (el, isRecursive) { - if (this.isTextNode(el)) { - return el.data; - } - if (this.isCommentNode(el)) { - // In the DOM, comments within an element return an empty string for textContent - // However, comment node instances return the comment content for textContent getter - return isRecursive ? '' : el.data; - } - if (!el.childNodes || el.childNodes.length == 0) { - return ''; - } - var /** @type {?} */ textContent = ''; - for (var /** @type {?} */ i = 0; i < el.childNodes.length; i++) { - textContent += this.getText(el.childNodes[i], true); - } - return textContent; - }; + function () { return ''; }; /** - * @param {?} el - * @param {?} value * @return {?} */ - Parse5DomAdapter.prototype.setText = function (el, value) { - if (this.isTextNode(el) || this.isCommentNode(el)) { - el.data = value; - } - else { - this.clearNodes(el); - if (value !== '') - treeAdapter.insertText(el, value); - } - }; - /** - * @param {?} el + DominoAdapter.prototype.getTransitionEnd = /** * @return {?} */ - Parse5DomAdapter.prototype.getValue = function (el) { return el.value; }; + function () { return 'transitionend'; }; /** - * @param {?} el - * @param {?} value * @return {?} */ - Parse5DomAdapter.prototype.setValue = function (el, value) { el.value = value; }; + DominoAdapter.prototype.supportsAnimation = /** + * @return {?} + */ + function () { return true; }; /** * @param {?} el * @return {?} */ - Parse5DomAdapter.prototype.getChecked = function (el) { return el.checked; }; - /** + DominoAdapter.prototype.getDistributedNodes = /** * @param {?} el - * @param {?} value * @return {?} */ - Parse5DomAdapter.prototype.setChecked = function (el, value) { el.checked = value; }; + function (el) { throw _notImplemented('getDistributedNodes'); }; /** - * @param {?} text * @return {?} */ - Parse5DomAdapter.prototype.createComment = function (text) { return treeAdapter.createCommentNode(text); }; - /** - * @param {?} html + DominoAdapter.prototype.supportsCookies = /** * @return {?} */ - Parse5DomAdapter.prototype.createTemplate = function (html) { - var /** @type {?} */ template = treeAdapter.createElement('template', 'http://www.w3.org/1999/xhtml', []); - var /** @type {?} */ content = parse5$1.parseFragment(html, { treeAdapter: treeAdapter }); - treeAdapter.setTemplateContent(template, content); - return template; - }; + function () { return false; }; /** - * @param {?} tagName + * @param {?} name * @return {?} */ - Parse5DomAdapter.prototype.createElement = function (tagName) { - return treeAdapter.createElement(tagName, 'http://www.w3.org/1999/xhtml', []); - }; - /** - * @param {?} ns - * @param {?} tagName + DominoAdapter.prototype.getCookie = /** + * @param {?} name * @return {?} */ - Parse5DomAdapter.prototype.createElementNS = function (ns, tagName) { - return treeAdapter.createElement(tagName, ns, []); - }; + function (name) { throw _notImplemented('getCookie'); }; /** - * @param {?} text + * @param {?} name + * @param {?} value * @return {?} */ - Parse5DomAdapter.prototype.createTextNode = function (text) { - var /** @type {?} */ t = (this.createComment(text)); - t.type = 'text'; - return t; - }; - /** - * @param {?} attrName - * @param {?} attrValue + DominoAdapter.prototype.setCookie = /** + * @param {?} name + * @param {?} value * @return {?} */ - Parse5DomAdapter.prototype.createScriptTag = function (attrName, attrValue) { - return treeAdapter.createElement('script', 'http://www.w3.org/1999/xhtml', [{ name: attrName, value: attrValue }]); - }; + function (name, value) { throw _notImplemented('setCookie'); }; + return DominoAdapter; +}(_angular_platformBrowser.ɵBrowserDomAdapter)); + +/** + * @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 + */ +/** + * Representation of the current platform state. + * + * \@experimental + */ +var PlatformState = (function () { + function PlatformState(_doc) { + this._doc = _doc; + } /** - * @param {?} css - * @return {?} + * Renders the current state of the platform to string. */ - Parse5DomAdapter.prototype.createStyleElement = function (css) { - var /** @type {?} */ style = this.createElement('style'); - this.setText(style, css); - return (style); - }; /** - * @param {?} el + * Renders the current state of the platform to string. * @return {?} */ - Parse5DomAdapter.prototype.createShadowRoot = function (el) { - el.shadowRoot = treeAdapter.createDocumentFragment(); - el.shadowRoot.parent = el; - return el.shadowRoot; - }; - /** - * @param {?} el + PlatformState.prototype.renderToString = /** + * Renders the current state of the platform to string. * @return {?} */ - Parse5DomAdapter.prototype.getShadowRoot = function (el) { return el.shadowRoot; }; + function () { return serializeDocument(this._doc); }; /** - * @param {?} el - * @return {?} + * Returns the current DOM state. */ - Parse5DomAdapter.prototype.getHost = function (el) { return el.host; }; /** - * @param {?} el + * Returns the current DOM state. * @return {?} */ - Parse5DomAdapter.prototype.getDistributedNodes = function (el) { throw _notImplemented('getDistributedNodes'); }; - /** - * @param {?} node + PlatformState.prototype.getDocument = /** + * Returns the current DOM state. * @return {?} */ - Parse5DomAdapter.prototype.clone = function (node) { - var /** @type {?} */ _recursive = function (node) { - var /** @type {?} */ nodeClone = Object.create(Object.getPrototypeOf(node)); - for (var /** @type {?} */ prop in node) { - var /** @type {?} */ desc = Object.getOwnPropertyDescriptor(node, prop); - if (desc && 'value' in desc && typeof desc.value !== 'object') { - nodeClone[prop] = node[prop]; - } - } - nodeClone.parent = null; - nodeClone.prev = null; - nodeClone.next = null; - nodeClone.children = null; - mapProps.forEach(function (mapName) { - if (node[mapName] != null) { - nodeClone[mapName] = {}; - for (var /** @type {?} */ prop in node[mapName]) { - nodeClone[mapName][prop] = node[mapName][prop]; - } - } - }); - var /** @type {?} */ cNodes = node.children; - if (cNodes) { - var /** @type {?} */ cNodesClone = new Array(cNodes.length); - for (var /** @type {?} */ i = 0; i < cNodes.length; i++) { - var /** @type {?} */ childNode = cNodes[i]; - var /** @type {?} */ childNodeClone = _recursive(childNode); - cNodesClone[i] = childNodeClone; - if (i > 0) { - childNodeClone.prev = cNodesClone[i - 1]; - cNodesClone[i - 1].next = childNodeClone; - } - childNodeClone.parent = nodeClone; - } - nodeClone.children = cNodesClone; - } - return nodeClone; - }; - return _recursive(node); - }; - /** - * @param {?} element - * @param {?} name - * @return {?} - */ - Parse5DomAdapter.prototype.getElementsByClassName = function (element, name) { - return this.querySelectorAll(element, '.' + name); - }; - /** - * @param {?} element - * @param {?} name - * @return {?} - */ - Parse5DomAdapter.prototype.getElementsByTagName = function (element, name) { - return this.querySelectorAll(element, name); - }; + function () { return this._doc; }; + PlatformState.decorators = [ + { type: _angular_core.Injectable }, + ]; + /** @nocollapse */ + PlatformState.ctorParameters = function () { return [ + { type: undefined, decorators: [{ type: _angular_core.Inject, args: [_angular_platformBrowser.DOCUMENT,] },] }, + ]; }; + return PlatformState; +}()); + +/** + * @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 xhr2 = __webpack_require__(120); +var isAbsoluteUrl = /^[a-zA-Z\-\+.]+:\/\//; +/** + * @param {?} url + * @return {?} + */ +function validateRequestUrl(url$$1) { + if (!isAbsoluteUrl.test(url$$1)) { + throw new Error("URLs requested via Http on the server must be absolute. URL: " + url$$1); + } +} +var ServerXhr = (function () { + function ServerXhr() { + } /** - * @param {?} element * @return {?} */ - Parse5DomAdapter.prototype.classList = function (element) { - var /** @type {?} */ classAttrValue = null; - var /** @type {?} */ attributes = element.attribs; - if (attributes && attributes['class'] != null) { - classAttrValue = attributes['class']; - } - return classAttrValue ? classAttrValue.trim().split(/\s+/g) : []; - }; - /** - * @param {?} element - * @param {?} className + ServerXhr.prototype.build = /** * @return {?} */ - Parse5DomAdapter.prototype.addClass = function (element, className) { - var /** @type {?} */ classList = this.classList(element); - var /** @type {?} */ index = classList.indexOf(className); - if (index == -1) { - classList.push(className); - element.attribs['class'] = element.className = classList.join(' '); - } - }; + function () { return new xhr2.XMLHttpRequest(); }; + ServerXhr.decorators = [ + { type: _angular_core.Injectable }, + ]; + /** @nocollapse */ + ServerXhr.ctorParameters = function () { return []; }; + return ServerXhr; +}()); +var ServerXsrfStrategy = (function () { + function ServerXsrfStrategy() { + } /** - * @param {?} element - * @param {?} className + * @param {?} req * @return {?} */ - Parse5DomAdapter.prototype.removeClass = function (element, className) { - var /** @type {?} */ classList = this.classList(element); - var /** @type {?} */ index = classList.indexOf(className); - if (index > -1) { - classList.splice(index, 1); - element.attribs['class'] = element.className = classList.join(' '); - } - }; - /** - * @param {?} element - * @param {?} className + ServerXsrfStrategy.prototype.configureRequest = /** + * @param {?} req * @return {?} */ - Parse5DomAdapter.prototype.hasClass = function (element, className) { - return this.classList(element).indexOf(className) > -1; - }; + function (req) { }; + ServerXsrfStrategy.decorators = [ + { type: _angular_core.Injectable }, + ]; + /** @nocollapse */ + ServerXsrfStrategy.ctorParameters = function () { return []; }; + return ServerXsrfStrategy; +}()); +/** + * @abstract + */ +var ZoneMacroTaskWrapper = (function () { + function ZoneMacroTaskWrapper() { + } /** - * @param {?} element - * @param {?} styleName - * @param {?=} styleValue + * @param {?} request * @return {?} */ - Parse5DomAdapter.prototype.hasStyle = function (element, styleName, styleValue) { - var /** @type {?} */ value = this.getStyle(element, styleName) || ''; - return styleValue ? value == styleValue : value.length > 0; - }; - /** - * \@internal - * @param {?} element + ZoneMacroTaskWrapper.prototype.wrap = /** + * @param {?} request * @return {?} */ - Parse5DomAdapter.prototype._readStyleAttribute = function (element) { - var /** @type {?} */ styleMap = {}; - var /** @type {?} */ attributes = element.attribs; - if (attributes && attributes['style'] != null) { - var /** @type {?} */ styleAttrValue = attributes['style']; - var /** @type {?} */ styleList = styleAttrValue.split(/;+/g); - for (var /** @type {?} */ i = 0; i < styleList.length; i++) { - if (styleList[i].length > 0) { - var /** @type {?} */ style = (styleList[i]); - var /** @type {?} */ colon = style.indexOf(':'); - if (colon === -1) { - throw new Error("Invalid CSS style: " + style); + function (request) { + var _this = this; + return new rxjs_Observable.Observable(function (observer) { + var /** @type {?} */ task = /** @type {?} */ ((null)); + var /** @type {?} */ scheduled = false; + var /** @type {?} */ sub = null; + var /** @type {?} */ savedResult = null; + var /** @type {?} */ savedError = null; + var /** @type {?} */ scheduleTask = function (_task) { + task = _task; + scheduled = true; + var /** @type {?} */ delegate = _this.delegate(request); + sub = delegate.subscribe(function (res) { return savedResult = res; }, function (err) { + if (!scheduled) { + throw new Error('An http observable was completed twice. This shouldn\'t happen, please file a bug.'); + } + savedError = err; + scheduled = false; + task.invoke(); + }, function () { + if (!scheduled) { + throw new Error('An http observable was completed twice. This shouldn\'t happen, please file a bug.'); } - ((styleMap))[style.substr(0, colon).trim()] = style.substr(colon + 1).trim(); + scheduled = false; + task.invoke(); + }); + }; + var /** @type {?} */ cancelTask = function (_task) { + if (!scheduled) { + return; } - } - } - return styleMap; + scheduled = false; + if (sub) { + sub.unsubscribe(); + sub = null; + } + }; + var /** @type {?} */ onComplete = function () { + if (savedError !== null) { + observer.error(savedError); + } + else { + observer.next(savedResult); + observer.complete(); + } + }; + // MockBackend for Http is synchronous, which means that if scheduleTask is by + // scheduleMacroTask, the request will hit MockBackend and the response will be + // sent, causing task.invoke() to be called. + var /** @type {?} */ _task = Zone.current.scheduleMacroTask('ZoneMacroTaskWrapper.subscribe', onComplete, {}, function () { return null; }, cancelTask); + scheduleTask(_task); + return function () { + if (scheduled && task) { + task.zone.cancelTask(task); + scheduled = false; + } + if (sub) { + sub.unsubscribe(); + sub = null; + } + }; + }); }; + return ZoneMacroTaskWrapper; +}()); +var ZoneMacroTaskConnection = (function (_super) { + __extends(ZoneMacroTaskConnection, _super); + function ZoneMacroTaskConnection(request, backend) { + var _this = _super.call(this) || this; + _this.request = request; + _this.backend = backend; + validateRequestUrl(request.url); + _this.response = _this.wrap(request); + return _this; + } /** - * \@internal - * @param {?} element - * @param {?} styleMap + * @param {?} request * @return {?} */ - Parse5DomAdapter.prototype._writeStyleAttribute = function (element, styleMap) { - var /** @type {?} */ styleAttrValue = ''; - for (var /** @type {?} */ key in styleMap) { - var /** @type {?} */ newValue = styleMap[key]; - if (newValue) { - styleAttrValue += key + ':' + styleMap[key] + ';'; - } - } - element.attribs['style'] = styleAttrValue; - }; - /** - * @param {?} element - * @param {?} styleName - * @param {?=} styleValue + ZoneMacroTaskConnection.prototype.delegate = /** + * @param {?} request * @return {?} */ - Parse5DomAdapter.prototype.setStyle = function (element, styleName, styleValue) { - var /** @type {?} */ styleMap = this._readStyleAttribute(element); - ((styleMap))[styleName] = styleValue; - this._writeStyleAttribute(element, styleMap); + function (request) { + this.lastConnection = this.backend.createConnection(request); + return /** @type {?} */ (this.lastConnection.response); }; + Object.defineProperty(ZoneMacroTaskConnection.prototype, "readyState", { + get: /** + * @return {?} + */ + function () { + return !!this.lastConnection ? this.lastConnection.readyState : _angular_http.ReadyState.Unsent; + }, + enumerable: true, + configurable: true + }); + return ZoneMacroTaskConnection; +}(ZoneMacroTaskWrapper)); +var ZoneMacroTaskBackend = (function () { + function ZoneMacroTaskBackend(backend) { + this.backend = backend; + } /** - * @param {?} element - * @param {?} styleName + * @param {?} request * @return {?} */ - Parse5DomAdapter.prototype.removeStyle = function (element, styleName) { this.setStyle(element, styleName, null); }; - /** - * @param {?} element - * @param {?} styleName + ZoneMacroTaskBackend.prototype.createConnection = /** + * @param {?} request * @return {?} */ - Parse5DomAdapter.prototype.getStyle = function (element, styleName) { - var /** @type {?} */ styleMap = this._readStyleAttribute(element); - return styleMap.hasOwnProperty(styleName) ? ((styleMap))[styleName] : ''; + function (request) { + return new ZoneMacroTaskConnection(request, this.backend); }; + return ZoneMacroTaskBackend; +}()); +var ZoneClientBackend = (function (_super) { + __extends(ZoneClientBackend, _super); + function ZoneClientBackend(backend) { + var _this = _super.call(this) || this; + _this.backend = backend; + return _this; + } /** - * @param {?} element + * @param {?} request * @return {?} */ - Parse5DomAdapter.prototype.tagName = function (element) { return element.tagName == 'style' ? 'STYLE' : element.tagName; }; - /** - * @param {?} element + ZoneClientBackend.prototype.handle = /** + * @param {?} request * @return {?} */ - Parse5DomAdapter.prototype.attributeMap = function (element) { - var /** @type {?} */ res = new Map(); - var /** @type {?} */ elAttrs = treeAdapter.getAttrList(element); - for (var /** @type {?} */ i = 0; i < elAttrs.length; i++) { - var /** @type {?} */ attrib = elAttrs[i]; - res.set(attrib.name, attrib.value); - } - return res; - }; + function (request) { return this.wrap(request); }; /** - * @param {?} element - * @param {?} attribute + * @param {?} request * @return {?} */ - Parse5DomAdapter.prototype.hasAttribute = function (element, attribute) { - return element.attribs && element.attribs[attribute] != null; - }; - /** - * @param {?} element - * @param {?} ns - * @param {?} attribute + ZoneClientBackend.prototype.delegate = /** + * @param {?} request * @return {?} */ - Parse5DomAdapter.prototype.hasAttributeNS = function (element, ns, attribute) { - return this.hasAttribute(element, attribute); + function (request) { + return this.backend.handle(request); }; - /** - * @param {?} element - * @param {?} attribute - * @return {?} - */ - Parse5DomAdapter.prototype.getAttribute = function (element, attribute) { - return this.hasAttribute(element, attribute) ? element.attribs[attribute] : null; + return ZoneClientBackend; +}(ZoneMacroTaskWrapper)); +/** + * @param {?} xhrBackend + * @param {?} options + * @return {?} + */ +function httpFactory(xhrBackend, options) { + var /** @type {?} */ macroBackend = new ZoneMacroTaskBackend(xhrBackend); + return new _angular_http.Http(macroBackend, options); +} +/** + * @param {?} backend + * @param {?} interceptors + * @return {?} + */ +function zoneWrappedInterceptingHandler(backend, interceptors) { + var /** @type {?} */ realBackend = _angular_common_http.ɵinterceptingHandler(backend, interceptors); + return new ZoneClientBackend(realBackend); +} +var SERVER_HTTP_PROVIDERS = [ + { provide: _angular_http.Http, useFactory: httpFactory, deps: [_angular_http.XHRBackend, _angular_http.RequestOptions] }, + { provide: _angular_http.BrowserXhr, useClass: ServerXhr }, { provide: _angular_http.XSRFStrategy, useClass: ServerXsrfStrategy }, + { provide: _angular_common_http.XhrFactory, useClass: ServerXhr }, { + provide: _angular_common_http.HttpHandler, + useFactory: zoneWrappedInterceptingHandler, + deps: [_angular_common_http.HttpBackend, [new _angular_core.Optional(), _angular_common_http.HTTP_INTERCEPTORS]] + } +]; + +/** + * @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 + */ +/** + * Config object passed to initialize the platform. + * + * \@experimental + * @record + */ + +/** + * The DI token for setting the initial config for the platform. + * + * \@experimental + */ +var INITIAL_CONFIG = new _angular_core.InjectionToken('Server.INITIAL_CONFIG'); +/** + * A function that will be executed when calling `renderModuleFactory` or `renderModule` just + * before current platform state is rendered to string. + * + * \@experimental + */ +var BEFORE_APP_SERIALIZED = new _angular_core.InjectionToken('Server.RENDER_MODULE_HOOK'); + +/** + * @fileoverview added by tsickle + * @suppress {checkTypes} checked by tsc + */ +/** + * @param {?} urlStr + * @return {?} + */ +function parseUrl(urlStr) { + var /** @type {?} */ parsedUrl = url.parse(urlStr); + return { + pathname: parsedUrl.pathname || '', + search: parsedUrl.search || '', + hash: parsedUrl.hash || '', }; - /** - * @param {?} element - * @param {?} ns - * @param {?} attribute - * @return {?} - */ - Parse5DomAdapter.prototype.getAttributeNS = function (element, ns, attribute) { - return this.getAttribute(element, attribute); - }; - /** - * @param {?} element - * @param {?} attribute - * @param {?} value - * @return {?} - */ - Parse5DomAdapter.prototype.setAttribute = function (element, attribute, value) { - if (attribute) { - element.attribs[attribute] = value; - if (attribute === 'class') { - element.className = value; - } - } - }; - /** - * @param {?} element - * @param {?} ns - * @param {?} attribute - * @param {?} value - * @return {?} - */ - Parse5DomAdapter.prototype.setAttributeNS = function (element, ns, attribute, value) { - this.setAttribute(element, attribute, value); - }; - /** - * @param {?} element - * @param {?} attribute - * @return {?} - */ - Parse5DomAdapter.prototype.removeAttribute = function (element, attribute) { - if (attribute) { - delete element.attribs[attribute]; +} +/** + * Server-side implementation of URL state. Implements `pathname`, `search`, and `hash` + * but not the state stack. + */ +var ServerPlatformLocation = (function () { + function ServerPlatformLocation(_doc, _config) { + this._doc = _doc; + this.pathname = '/'; + this.search = ''; + this.hash = ''; + this._hashUpdate = new rxjs_Subject.Subject(); + var /** @type {?} */ config = /** @type {?} */ (_config); + if (!!config && !!config.url) { + var /** @type {?} */ parsedUrl = parseUrl(config.url); + this.pathname = parsedUrl.pathname; + this.search = parsedUrl.search; + this.hash = parsedUrl.hash; } - }; - /** - * @param {?} element - * @param {?} ns - * @param {?} name - * @return {?} - */ - Parse5DomAdapter.prototype.removeAttributeNS = function (element, ns, name) { throw 'not implemented'; }; - /** - * @param {?} el - * @return {?} - */ - Parse5DomAdapter.prototype.templateAwareRoot = function (el) { - return this.isTemplateElement(el) ? treeAdapter.getTemplateContent(el) : el; - }; - /** - * @return {?} - */ - Parse5DomAdapter.prototype.createHtmlDocument = function () { - var /** @type {?} */ newDoc = treeAdapter.createDocument(); - newDoc.title = 'fakeTitle'; - var /** @type {?} */ head = treeAdapter.createElement('head', null, []); - var /** @type {?} */ body = treeAdapter.createElement('body', 'http://www.w3.org/1999/xhtml', []); - this.appendChild(newDoc, head); - this.appendChild(newDoc, body); - newDoc['head'] = head; - newDoc['body'] = body; - newDoc['_window'] = {}; - return newDoc; - }; + } /** - * @param {?} el * @return {?} */ - Parse5DomAdapter.prototype.getBoundingClientRect = function (el) { return { left: 0, top: 0, width: 0, height: 0 }; }; - /** - * @param {?} doc + ServerPlatformLocation.prototype.getBaseHrefFromDOM = /** * @return {?} */ - Parse5DomAdapter.prototype.getTitle = function (doc) { return this.getText(this.getTitleNode(doc)) || ''; }; + function () { return /** @type {?} */ ((_angular_platformBrowser.ɵgetDOM().getBaseHref(this._doc))); }; /** - * @param {?} doc - * @param {?} newTitle + * @param {?} fn * @return {?} */ - Parse5DomAdapter.prototype.setTitle = function (doc, newTitle) { - this.setText(this.getTitleNode(doc), newTitle || ''); - }; - /** - * @param {?} el + ServerPlatformLocation.prototype.onPopState = /** + * @param {?} fn * @return {?} */ - Parse5DomAdapter.prototype.isTemplateElement = function (el) { - return this.isElementNode(el) && this.tagName(el) === 'template'; + function (fn) { + // No-op: a state stack is not implemented, so + // no events will ever come. }; /** - * @param {?} node - * @return {?} - */ - Parse5DomAdapter.prototype.isTextNode = function (node) { return treeAdapter.isTextNode(node); }; - /** - * @param {?} node - * @return {?} - */ - Parse5DomAdapter.prototype.isCommentNode = function (node) { return treeAdapter.isCommentNode(node); }; - /** - * @param {?} node - * @return {?} - */ - Parse5DomAdapter.prototype.isElementNode = function (node) { return node ? treeAdapter.isElementNode(node) : false; }; - /** - * @param {?} node - * @return {?} - */ - Parse5DomAdapter.prototype.hasShadowRoot = function (node) { return node.shadowRoot != null; }; - /** - * @param {?} node - * @return {?} - */ - Parse5DomAdapter.prototype.isShadowRoot = function (node) { return this.getShadowRoot(node) == node; }; - /** - * @param {?} node + * @param {?} fn * @return {?} */ - Parse5DomAdapter.prototype.importIntoDoc = function (node) { return this.clone(node); }; - /** - * @param {?} node + ServerPlatformLocation.prototype.onHashChange = /** + * @param {?} fn * @return {?} */ - Parse5DomAdapter.prototype.adoptNode = function (node) { return node; }; + function (fn) { this._hashUpdate.subscribe(fn); }; + Object.defineProperty(ServerPlatformLocation.prototype, "url", { + get: /** + * @return {?} + */ + function () { return "" + this.pathname + this.search + this.hash; }, + enumerable: true, + configurable: true + }); /** - * @param {?} el + * @param {?} value + * @param {?} oldUrl * @return {?} */ - Parse5DomAdapter.prototype.getHref = function (el) { return this.getAttribute(el, 'href'); }; - /** - * @param {?} el - * @param {?} baseUrl - * @param {?} href + ServerPlatformLocation.prototype.setHash = /** + * @param {?} value + * @param {?} oldUrl * @return {?} */ - Parse5DomAdapter.prototype.resolveAndSetHref = function (el, baseUrl, href) { - if (href == null) { - el.href = baseUrl; - } - else { - el.href = baseUrl + '/../' + href; - } - }; - /** - * \@internal - * @param {?} parsedRules - * @param {?=} css - * @return {?} - */ - Parse5DomAdapter.prototype._buildRules = function (parsedRules, css) { - var /** @type {?} */ rules = []; - for (var /** @type {?} */ i = 0; i < parsedRules.length; i++) { - var /** @type {?} */ parsedRule = parsedRules[i]; - var /** @type {?} */ rule = {}; - rule['cssText'] = css; - rule['style'] = { content: '', cssText: '' }; - if (parsedRule.type == 'rule') { - rule['type'] = 1; - rule['selectorText'] = - parsedRule.selectors.join(', '.replace(/\s{2,}/g, ' ') - .replace(/\s*~\s*/g, ' ~ ') - .replace(/\s*\+\s*/g, ' + ') - .replace(/\s*>\s*/g, ' > ') - .replace(/\[(\w+)=(\w+)\]/g, '[$1="$2"]')); - if (parsedRule.declarations == null) { - continue; - } - for (var /** @type {?} */ j = 0; j < parsedRule.declarations.length; j++) { - var /** @type {?} */ declaration = parsedRule.declarations[j]; - rule['style'] = declaration.property[declaration.value]; - rule['style'].cssText += declaration.property + ': ' + declaration.value + ';'; - } - } - else if (parsedRule.type == 'media') { - rule['type'] = 4; - rule['media'] = { mediaText: parsedRule.media }; - if (parsedRule.rules) { - rule['cssRules'] = this._buildRules(parsedRule.rules); - } - } - rules.push(rule); + function (value, oldUrl) { + var _this = this; + if (this.hash === value) { + // Don't fire events if the hash has not changed. + return; } - return rules; + (/** @type {?} */ (this)).hash = value; + var /** @type {?} */ newUrl = this.url; + scheduleMicroTask(function () { return _this._hashUpdate.next(/** @type {?} */ ({ type: 'hashchange', oldUrl: oldUrl, newUrl: newUrl })); }); }; /** + * @param {?} state + * @param {?} title + * @param {?} newUrl * @return {?} */ - Parse5DomAdapter.prototype.supportsDOMEvents = function () { return false; }; - /** - * @return {?} - */ - Parse5DomAdapter.prototype.supportsNativeShadowDOM = function () { return false; }; - /** - * @param {?} doc - * @param {?} target - * @return {?} - */ - Parse5DomAdapter.prototype.getGlobalEventTarget = function (doc, target) { - if (target == 'window') { - return ((doc))._window; - } - else if (target == 'document') { - return doc; - } - else if (target == 'body') { - return doc.body; - } - }; - /** - * @param {?} doc + ServerPlatformLocation.prototype.replaceState = /** + * @param {?} state + * @param {?} title + * @param {?} newUrl * @return {?} */ - Parse5DomAdapter.prototype.getBaseHref = function (doc) { - var /** @type {?} */ base = this.querySelector(doc, 'base'); - var /** @type {?} */ href = ''; - if (base) { - href = this.getHref(base); - } - // TODO(alxhub): Need relative path logic from BrowserDomAdapter here? - return href == null ? null : href; + function (state, title, newUrl) { + var /** @type {?} */ oldUrl = this.url; + var /** @type {?} */ parsedUrl = parseUrl(newUrl); + (/** @type {?} */ (this)).pathname = parsedUrl.pathname; + (/** @type {?} */ (this)).search = parsedUrl.search; + this.setHash(parsedUrl.hash, oldUrl); }; /** + * @param {?} state + * @param {?} title + * @param {?} newUrl * @return {?} */ - Parse5DomAdapter.prototype.resetBaseElement = function () { throw 'not implemented'; }; - /** - * @return {?} - */ - Parse5DomAdapter.prototype.getHistory = function () { throw 'not implemented'; }; - /** - * @return {?} - */ - Parse5DomAdapter.prototype.getLocation = function () { throw 'not implemented'; }; - /** - * @return {?} - */ - Parse5DomAdapter.prototype.getUserAgent = function () { return 'Fake user agent'; }; - /** - * @param {?} el - * @param {?} name - * @return {?} - */ - Parse5DomAdapter.prototype.getData = function (el, name) { return this.getAttribute(el, 'data-' + name); }; - /** - * @param {?} el - * @return {?} - */ - Parse5DomAdapter.prototype.getComputedStyle = function (el) { throw 'not implemented'; }; - /** - * @param {?} el - * @param {?} name - * @param {?} value - * @return {?} - */ - Parse5DomAdapter.prototype.setData = function (el, name, value) { this.setAttribute(el, 'data-' + name, value); }; - /** - * @return {?} - */ - Parse5DomAdapter.prototype.supportsWebAnimation = function () { return false; }; - /** - * @return {?} - */ - Parse5DomAdapter.prototype.performanceNow = function () { return Date.now(); }; - /** - * @return {?} - */ - Parse5DomAdapter.prototype.getAnimationPrefix = function () { return ''; }; - /** - * @return {?} - */ - Parse5DomAdapter.prototype.getTransitionEnd = function () { return 'transitionend'; }; - /** - * @return {?} - */ - Parse5DomAdapter.prototype.supportsAnimation = function () { return true; }; - /** - * @param {?} el - * @param {?} newNode - * @param {?} oldNode - * @return {?} - */ - Parse5DomAdapter.prototype.replaceChild = function (el, newNode, oldNode) { throw new Error('not implemented'); }; - /** - * @param {?} templateHtml - * @return {?} - */ - Parse5DomAdapter.prototype.parse = function (templateHtml) { throw new Error('not implemented'); }; - /** - * @param {?} el - * @param {?} methodName - * @param {?} args - * @return {?} - */ - Parse5DomAdapter.prototype.invoke = function (el, methodName, args) { throw new Error('not implemented'); }; - /** - * @param {?} event - * @return {?} - */ - Parse5DomAdapter.prototype.getEventKey = function (event) { throw new Error('not implemented'); }; - /** + ServerPlatformLocation.prototype.pushState = /** + * @param {?} state + * @param {?} title + * @param {?} newUrl * @return {?} */ - Parse5DomAdapter.prototype.supportsCookies = function () { return false; }; + function (state, title, newUrl) { + this.replaceState(state, title, newUrl); + }; /** - * @param {?} name * @return {?} */ - Parse5DomAdapter.prototype.getCookie = function (name) { throw new Error('not implemented'); }; - /** - * @param {?} name - * @param {?} value + ServerPlatformLocation.prototype.forward = /** * @return {?} */ - Parse5DomAdapter.prototype.setCookie = function (name, value) { throw new Error('not implemented'); }; + function () { throw new Error('Not implemented'); }; /** - * @param {?} element - * @param {?} keyframes - * @param {?} options * @return {?} */ - Parse5DomAdapter.prototype.animate = function (element, keyframes, options) { throw new Error('not implemented'); }; - /** - * @param {?} doc + ServerPlatformLocation.prototype.back = /** * @return {?} */ - Parse5DomAdapter.prototype.getTitleNode = function (doc) { - var /** @type {?} */ title = this.querySelector(doc, 'title'); - if (!title) { - title = (this.createElement('title')); - this.appendChild(this.querySelector(doc, 'head'), title); - } - return title; - }; - return Parse5DomAdapter; -}(_angular_platformBrowser.ɵDomAdapter)); -// TODO: build a proper list, this one is all the keys of a HTMLInputElement -var _HTMLElementPropertyList = [ - 'webkitEntries', - 'incremental', - 'webkitdirectory', - 'selectionDirection', - 'selectionEnd', - 'selectionStart', - 'labels', - 'validationMessage', - 'validity', - 'willValidate', - 'width', - 'valueAsNumber', - 'valueAsDate', - 'value', - 'useMap', - 'defaultValue', - 'type', - 'step', - 'src', - 'size', - 'required', - 'readOnly', - 'placeholder', - 'pattern', - 'name', - 'multiple', - 'min', - 'minLength', - 'maxLength', - 'max', - 'list', - 'indeterminate', - 'height', - 'formTarget', - 'formNoValidate', - 'formMethod', - 'formEnctype', - 'formAction', - 'files', - 'form', - 'disabled', - 'dirName', - 'checked', - 'defaultChecked', - 'autofocus', - 'autocomplete', - 'alt', - 'align', - 'accept', - 'onautocompleteerror', - 'onautocomplete', - 'onwaiting', - 'onvolumechange', - 'ontoggle', - 'ontimeupdate', - 'onsuspend', - 'onsubmit', - 'onstalled', - 'onshow', - 'onselect', - 'onseeking', - 'onseeked', - 'onscroll', - 'onresize', - 'onreset', - 'onratechange', - 'onprogress', - 'onplaying', - 'onplay', - 'onpause', - 'onmousewheel', - 'onmouseup', - 'onmouseover', - 'onmouseout', - 'onmousemove', - 'onmouseleave', - 'onmouseenter', - 'onmousedown', - 'onloadstart', - 'onloadedmetadata', - 'onloadeddata', - 'onload', - 'onkeyup', - 'onkeypress', - 'onkeydown', - 'oninvalid', - 'oninput', - 'onfocus', - 'onerror', - 'onended', - 'onemptied', - 'ondurationchange', - 'ondrop', - 'ondragstart', - 'ondragover', - 'ondragleave', - 'ondragenter', - 'ondragend', - 'ondrag', - 'ondblclick', - 'oncuechange', - 'oncontextmenu', - 'onclose', - 'onclick', - 'onchange', - 'oncanplaythrough', - 'oncanplay', - 'oncancel', - 'onblur', - 'onabort', - 'spellcheck', - 'isContentEditable', - 'contentEditable', - 'outerText', - 'innerText', - 'accessKey', - 'hidden', - 'webkitdropzone', - 'draggable', - 'tabIndex', - 'dir', - 'translate', - 'lang', - 'title', - 'childElementCount', - 'lastElementChild', - 'firstElementChild', - 'children', - 'onwebkitfullscreenerror', - 'onwebkitfullscreenchange', - 'nextElementSibling', - 'previousElementSibling', - 'onwheel', - 'onselectstart', - 'onsearch', - 'onpaste', - 'oncut', - 'oncopy', - 'onbeforepaste', - 'onbeforecut', - 'onbeforecopy', - 'shadowRoot', - 'dataset', - 'classList', - 'className', - 'outerHTML', - 'innerHTML', - 'scrollHeight', - 'scrollWidth', - 'scrollTop', - 'scrollLeft', - 'clientHeight', - 'clientWidth', - 'clientTop', - 'clientLeft', - 'offsetParent', - 'offsetHeight', - 'offsetWidth', - 'offsetTop', - 'offsetLeft', - 'localName', - 'prefix', - 'namespaceURI', - 'id', - 'style', - 'attributes', - 'tagName', - 'parentElement', - 'textContent', - 'baseURI', - 'ownerDocument', - 'nextSibling', - 'previousSibling', - 'lastChild', - 'firstChild', - 'childNodes', - 'parentNode', - 'nodeType', - 'nodeValue', - 'nodeName', - 'closure_lm_714617', - '__jsaction', -]; + function () { throw new Error('Not implemented'); }; + ServerPlatformLocation.decorators = [ + { type: _angular_core.Injectable }, + ]; + /** @nocollapse */ + ServerPlatformLocation.ctorParameters = function () { return [ + { type: undefined, decorators: [{ type: _angular_core.Inject, args: [_angular_platformBrowser.DOCUMENT,] },] }, + { type: undefined, decorators: [{ type: _angular_core.Optional }, { type: _angular_core.Inject, args: [INITIAL_CONFIG,] },] }, + ]; }; + return ServerPlatformLocation; +}()); /** - * @template T - * @param {?} list - * @param {?} el + * @param {?} fn * @return {?} */ -function remove(list, el) { - var /** @type {?} */ index = list.indexOf(el); - if (index > -1) { - list.splice(index, 1); - } +function scheduleMicroTask(fn) { + Zone.current.scheduleMicroTask('scheduleMicrotask', fn); } + +/** + * @fileoverview added by tsickle + * @suppress {checkTypes} checked by tsc + */ /** * @license * Copyright Google Inc. All Rights Reserved. @@ -6196,11 +14721,6 @@ function remove(list, el) { */ var EMPTY_ARRAY = []; var ServerRendererFactory2 = (function () { - /** - * @param {?} ngZone - * @param {?} document - * @param {?} sharedStylesHost - */ function ServerRendererFactory2(ngZone, document, sharedStylesHost) { this.ngZone = ngZone; this.document = document; @@ -6209,13 +14729,17 @@ var ServerRendererFactory2 = (function () { this.schema = new _angular_compiler.DomElementSchemaRegistry(); this.defaultRenderer = new DefaultServerRenderer2(document, ngZone, this.schema); } - /** * @param {?} element * @param {?} type * @return {?} */ - ServerRendererFactory2.prototype.createRenderer = function (element, type) { + ServerRendererFactory2.prototype.createRenderer = /** + * @param {?} element + * @param {?} type + * @return {?} + */ + function (element, type) { if (!element || !type) { return this.defaultRenderer; } @@ -6227,7 +14751,7 @@ var ServerRendererFactory2 = (function () { renderer = new EmulatedEncapsulationServerRenderer2(this.document, this.ngZone, this.sharedStylesHost, this.schema, type); this.rendererByCompId.set(type.id, renderer); } - ((renderer)).applyToHost(element); + (/** @type {?} */ (renderer)).applyToHost(element); return renderer; } case _angular_core.ViewEncapsulation.Native: @@ -6245,30 +14769,29 @@ var ServerRendererFactory2 = (function () { /** * @return {?} */ - ServerRendererFactory2.prototype.begin = function () { }; + ServerRendererFactory2.prototype.begin = /** + * @return {?} + */ + function () { }; /** * @return {?} */ - ServerRendererFactory2.prototype.end = function () { }; + ServerRendererFactory2.prototype.end = /** + * @return {?} + */ + function () { }; + ServerRendererFactory2.decorators = [ + { type: _angular_core.Injectable }, + ]; + /** @nocollapse */ + ServerRendererFactory2.ctorParameters = function () { return [ + { type: _angular_core.NgZone, }, + { type: undefined, decorators: [{ type: _angular_core.Inject, args: [_angular_platformBrowser.DOCUMENT,] },] }, + { type: _angular_platformBrowser.ɵSharedStylesHost, }, + ]; }; return ServerRendererFactory2; }()); -ServerRendererFactory2.decorators = [ - { type: _angular_core.Injectable }, -]; -/** - * @nocollapse - */ -ServerRendererFactory2.ctorParameters = function () { return [ - { type: _angular_core.NgZone, }, - { type: undefined, decorators: [{ type: _angular_core.Inject, args: [_angular_platformBrowser.DOCUMENT,] },] }, - { type: _angular_platformBrowser.ɵSharedStylesHost, }, -]; }; var DefaultServerRenderer2 = (function () { - /** - * @param {?} document - * @param {?} ngZone - * @param {?} schema - */ function DefaultServerRenderer2(document, ngZone, schema) { this.document = document; this.ngZone = ngZone; @@ -6278,14 +14801,23 @@ var DefaultServerRenderer2 = (function () { /** * @return {?} */ - DefaultServerRenderer2.prototype.destroy = function () { }; + DefaultServerRenderer2.prototype.destroy = /** + * @return {?} + */ + function () { }; /** * @param {?} name * @param {?=} namespace * @param {?=} debugInfo * @return {?} */ - DefaultServerRenderer2.prototype.createElement = function (name, namespace, debugInfo) { + DefaultServerRenderer2.prototype.createElement = /** + * @param {?} name + * @param {?=} namespace + * @param {?=} debugInfo + * @return {?} + */ + function (name, namespace, debugInfo) { if (namespace) { return _angular_platformBrowser.ɵgetDOM().createElementNS(_angular_platformBrowser.ɵNAMESPACE_URIS[namespace], name); } @@ -6296,26 +14828,47 @@ var DefaultServerRenderer2 = (function () { * @param {?=} debugInfo * @return {?} */ - DefaultServerRenderer2.prototype.createComment = function (value, debugInfo) { return _angular_platformBrowser.ɵgetDOM().createComment(value); }; - /** + DefaultServerRenderer2.prototype.createComment = /** * @param {?} value * @param {?=} debugInfo * @return {?} */ - DefaultServerRenderer2.prototype.createText = function (value, debugInfo) { return _angular_platformBrowser.ɵgetDOM().createTextNode(value); }; + function (value, debugInfo) { return _angular_platformBrowser.ɵgetDOM().createComment(value); }; /** - * @param {?} parent - * @param {?} newChild + * @param {?} value + * @param {?=} debugInfo + * @return {?} + */ + DefaultServerRenderer2.prototype.createText = /** + * @param {?} value + * @param {?=} debugInfo + * @return {?} + */ + function (value, debugInfo) { return _angular_platformBrowser.ɵgetDOM().createTextNode(value); }; + /** + * @param {?} parent + * @param {?} newChild + * @return {?} + */ + DefaultServerRenderer2.prototype.appendChild = /** + * @param {?} parent + * @param {?} newChild * @return {?} */ - DefaultServerRenderer2.prototype.appendChild = function (parent, newChild) { _angular_platformBrowser.ɵgetDOM().appendChild(parent, newChild); }; + function (parent, newChild) { _angular_platformBrowser.ɵgetDOM().appendChild(parent, newChild); }; /** * @param {?} parent * @param {?} newChild * @param {?} refChild * @return {?} */ - DefaultServerRenderer2.prototype.insertBefore = function (parent, newChild, refChild) { + DefaultServerRenderer2.prototype.insertBefore = /** + * @param {?} parent + * @param {?} newChild + * @param {?} refChild + * @return {?} + */ + function (parent, newChild, refChild) { if (parent) { _angular_platformBrowser.ɵgetDOM().insertBefore(parent, refChild, newChild); } @@ -6325,7 +14878,12 @@ var DefaultServerRenderer2 = (function () { * @param {?} oldChild * @return {?} */ - DefaultServerRenderer2.prototype.removeChild = function (parent, oldChild) { + DefaultServerRenderer2.prototype.removeChild = /** + * @param {?} parent + * @param {?} oldChild + * @return {?} + */ + function (parent, oldChild) { if (parent) { _angular_platformBrowser.ɵgetDOM().removeChild(parent, oldChild); } @@ -6335,7 +14893,12 @@ var DefaultServerRenderer2 = (function () { * @param {?=} debugInfo * @return {?} */ - DefaultServerRenderer2.prototype.selectRootElement = function (selectorOrNode, debugInfo) { + DefaultServerRenderer2.prototype.selectRootElement = /** + * @param {?} selectorOrNode + * @param {?=} debugInfo + * @return {?} + */ + function (selectorOrNode, debugInfo) { var /** @type {?} */ el; if (typeof selectorOrNode === 'string') { el = _angular_platformBrowser.ɵgetDOM().querySelector(this.document, selectorOrNode); @@ -6353,12 +14916,20 @@ var DefaultServerRenderer2 = (function () { * @param {?} node * @return {?} */ - DefaultServerRenderer2.prototype.parentNode = function (node) { return _angular_platformBrowser.ɵgetDOM().parentElement(node); }; + DefaultServerRenderer2.prototype.parentNode = /** + * @param {?} node + * @return {?} + */ + function (node) { return _angular_platformBrowser.ɵgetDOM().parentElement(node); }; /** * @param {?} node * @return {?} */ - DefaultServerRenderer2.prototype.nextSibling = function (node) { return _angular_platformBrowser.ɵgetDOM().nextSibling(node); }; + DefaultServerRenderer2.prototype.nextSibling = /** + * @param {?} node + * @return {?} + */ + function (node) { return _angular_platformBrowser.ɵgetDOM().nextSibling(node); }; /** * @param {?} el * @param {?} name @@ -6366,7 +14937,14 @@ var DefaultServerRenderer2 = (function () { * @param {?=} namespace * @return {?} */ - DefaultServerRenderer2.prototype.setAttribute = function (el, name, value, namespace) { + DefaultServerRenderer2.prototype.setAttribute = /** + * @param {?} el + * @param {?} name + * @param {?} value + * @param {?=} namespace + * @return {?} + */ + function (el, name, value, namespace) { if (namespace) { _angular_platformBrowser.ɵgetDOM().setAttributeNS(el, _angular_platformBrowser.ɵNAMESPACE_URIS[namespace], namespace + ':' + name, value); } @@ -6380,7 +14958,13 @@ var DefaultServerRenderer2 = (function () { * @param {?=} namespace * @return {?} */ - DefaultServerRenderer2.prototype.removeAttribute = function (el, name, namespace) { + DefaultServerRenderer2.prototype.removeAttribute = /** + * @param {?} el + * @param {?} name + * @param {?=} namespace + * @return {?} + */ + function (el, name, namespace) { if (namespace) { _angular_platformBrowser.ɵgetDOM().removeAttributeNS(el, _angular_platformBrowser.ɵNAMESPACE_URIS[namespace], name); } @@ -6393,13 +14977,23 @@ var DefaultServerRenderer2 = (function () { * @param {?} name * @return {?} */ - DefaultServerRenderer2.prototype.addClass = function (el, name) { _angular_platformBrowser.ɵgetDOM().addClass(el, name); }; + DefaultServerRenderer2.prototype.addClass = /** + * @param {?} el + * @param {?} name + * @return {?} + */ + function (el, name) { _angular_platformBrowser.ɵgetDOM().addClass(el, name); }; /** * @param {?} el * @param {?} name * @return {?} */ - DefaultServerRenderer2.prototype.removeClass = function (el, name) { _angular_platformBrowser.ɵgetDOM().removeClass(el, name); }; + DefaultServerRenderer2.prototype.removeClass = /** + * @param {?} el + * @param {?} name + * @return {?} + */ + function (el, name) { _angular_platformBrowser.ɵgetDOM().removeClass(el, name); }; /** * @param {?} el * @param {?} style @@ -6407,7 +15001,14 @@ var DefaultServerRenderer2 = (function () { * @param {?} flags * @return {?} */ - DefaultServerRenderer2.prototype.setStyle = function (el, style, value, flags) { + DefaultServerRenderer2.prototype.setStyle = /** + * @param {?} el + * @param {?} style + * @param {?} value + * @param {?} flags + * @return {?} + */ + function (el, style, value, flags) { _angular_platformBrowser.ɵgetDOM().setStyle(el, style, value); }; /** @@ -6416,7 +15017,13 @@ var DefaultServerRenderer2 = (function () { * @param {?} flags * @return {?} */ - DefaultServerRenderer2.prototype.removeStyle = function (el, style, flags) { + DefaultServerRenderer2.prototype.removeStyle = /** + * @param {?} el + * @param {?} style + * @param {?} flags + * @return {?} + */ + function (el, style, flags) { _angular_platformBrowser.ɵgetDOM().removeStyle(el, style); }; /** @@ -6424,7 +15031,12 @@ var DefaultServerRenderer2 = (function () { * @param {?} propertyName * @return {?} */ - DefaultServerRenderer2.prototype._isSafeToReflectProperty = function (tagName, propertyName) { + DefaultServerRenderer2.prototype._isSafeToReflectProperty = /** + * @param {?} tagName + * @param {?} propertyName + * @return {?} + */ + function (tagName, propertyName) { return this.schema.securityContext(tagName, propertyName, true) === this.schema.securityContext(tagName, propertyName, false); }; @@ -6434,11 +15046,17 @@ var DefaultServerRenderer2 = (function () { * @param {?} value * @return {?} */ - DefaultServerRenderer2.prototype.setProperty = function (el, name, value) { + DefaultServerRenderer2.prototype.setProperty = /** + * @param {?} el + * @param {?} name + * @param {?} value + * @return {?} + */ + function (el, name, value) { checkNoSyntheticProp(name, 'property'); _angular_platformBrowser.ɵgetDOM().setProperty(el, name, value); // Mirror property values for known HTML element properties in the attributes. - var /** @type {?} */ tagName = ((el.tagName)).toLowerCase(); + var /** @type {?} */ tagName = (/** @type {?} */ (el.tagName)).toLowerCase(); if (value != null && (typeof value === 'number' || typeof value == 'string') && this.schema.hasElement(tagName, EMPTY_ARRAY) && this.schema.hasProperty(tagName, name, EMPTY_ARRAY) && @@ -6451,21 +15069,32 @@ var DefaultServerRenderer2 = (function () { * @param {?} value * @return {?} */ - DefaultServerRenderer2.prototype.setValue = function (node, value) { _angular_platformBrowser.ɵgetDOM().setText(node, value); }; + DefaultServerRenderer2.prototype.setValue = /** + * @param {?} node + * @param {?} value + * @return {?} + */ + function (node, value) { _angular_platformBrowser.ɵgetDOM().setText(node, value); }; /** * @param {?} target * @param {?} eventName * @param {?} callback * @return {?} */ - DefaultServerRenderer2.prototype.listen = function (target, eventName, callback) { + DefaultServerRenderer2.prototype.listen = /** + * @param {?} target + * @param {?} eventName + * @param {?} callback + * @return {?} + */ + function (target, eventName, callback) { var _this = this; // Note: We are not using the EventsPlugin here as this is not needed // to run our tests. checkNoSyntheticProp(eventName, 'listener'); var /** @type {?} */ el = typeof target === 'string' ? _angular_platformBrowser.ɵgetDOM().getGlobalEventTarget(this.document, target) : target; var /** @type {?} */ outsideHandler = function (event) { return _this.ngZone.runGuarded(function () { return callback(event); }); }; - return this.ngZone.runOutsideAngular(function () { return _angular_platformBrowser.ɵgetDOM().onAndCancel(el, eventName, outsideHandler); }); + return this.ngZone.runOutsideAngular(function () { return /** @type {?} */ (_angular_platformBrowser.ɵgetDOM().onAndCancel(el, eventName, outsideHandler)); }); }; return DefaultServerRenderer2; }()); @@ -6482,17 +15111,10 @@ function checkNoSyntheticProp(name, nameKind) { } var EmulatedEncapsulationServerRenderer2 = (function (_super) { __extends(EmulatedEncapsulationServerRenderer2, _super); - /** - * @param {?} document - * @param {?} ngZone - * @param {?} sharedStylesHost - * @param {?} schema - * @param {?} component - */ function EmulatedEncapsulationServerRenderer2(document, ngZone, sharedStylesHost, schema, component) { var _this = _super.call(this, document, ngZone, schema) || this; _this.component = component; - var styles = _angular_platformBrowser.ɵflattenStyles(component.id, component.styles, []); + var /** @type {?} */ styles = _angular_platformBrowser.ɵflattenStyles(component.id, component.styles, []); sharedStylesHost.addStyles(styles); _this.contentAttr = _angular_platformBrowser.ɵshimContentAttribute(component.id); _this.hostAttr = _angular_platformBrowser.ɵshimHostAttribute(component.id); @@ -6502,19 +15124,33 @@ var EmulatedEncapsulationServerRenderer2 = (function (_super) { * @param {?} element * @return {?} */ - EmulatedEncapsulationServerRenderer2.prototype.applyToHost = function (element) { _super.prototype.setAttribute.call(this, element, this.hostAttr, ''); }; + EmulatedEncapsulationServerRenderer2.prototype.applyToHost = /** + * @param {?} element + * @return {?} + */ + function (element) { _super.prototype.setAttribute.call(this, element, this.hostAttr, ''); }; /** * @param {?} parent * @param {?} name * @return {?} */ - EmulatedEncapsulationServerRenderer2.prototype.createElement = function (parent, name) { + EmulatedEncapsulationServerRenderer2.prototype.createElement = /** + * @param {?} parent + * @param {?} name + * @return {?} + */ + function (parent, name) { var /** @type {?} */ el = _super.prototype.createElement.call(this, parent, name); _super.prototype.setAttribute.call(this, el, this.contentAttr, ''); return el; }; return EmulatedEncapsulationServerRenderer2; }(DefaultServerRenderer2)); + +/** + * @fileoverview added by tsickle + * @suppress {checkTypes} checked by tsc + */ /** * @license * Copyright Google Inc. All Rights Reserved. @@ -6524,10 +15160,6 @@ var EmulatedEncapsulationServerRenderer2 = (function (_super) { */ var ServerStylesHost = (function (_super) { __extends(ServerStylesHost, _super); - /** - * @param {?} doc - * @param {?} transitionId - */ function ServerStylesHost(doc, transitionId) { var _this = _super.call(this) || this; _this.doc = doc; @@ -6540,8 +15172,12 @@ var ServerStylesHost = (function (_super) { * @param {?} style * @return {?} */ - ServerStylesHost.prototype._addStyle = function (style) { - var /** @type {?} */ adapter = (_angular_platformBrowser.ɵgetDOM()); + ServerStylesHost.prototype._addStyle = /** + * @param {?} style + * @return {?} + */ + function (style) { + var /** @type {?} */ adapter = _angular_platformBrowser.ɵgetDOM(); var /** @type {?} */ el = adapter.createElement('style'); adapter.setText(el, style); if (!!this.transitionId) { @@ -6553,22 +15189,29 @@ var ServerStylesHost = (function (_super) { * @param {?} additions * @return {?} */ - ServerStylesHost.prototype.onStylesAdded = function (additions) { + ServerStylesHost.prototype.onStylesAdded = /** + * @param {?} additions + * @return {?} + */ + function (additions) { var _this = this; additions.forEach(function (style) { return _this._addStyle(style); }); }; + ServerStylesHost.decorators = [ + { type: _angular_core.Injectable }, + ]; + /** @nocollapse */ + ServerStylesHost.ctorParameters = function () { return [ + { type: undefined, decorators: [{ type: _angular_core.Inject, args: [_angular_platformBrowser.DOCUMENT,] },] }, + { type: undefined, decorators: [{ type: _angular_core.Optional }, { type: _angular_core.Inject, args: [_angular_platformBrowser.ɵTRANSITION_ID,] },] }, + ]; }; return ServerStylesHost; }(_angular_platformBrowser.ɵSharedStylesHost)); -ServerStylesHost.decorators = [ - { type: _angular_core.Injectable }, -]; + /** - * @nocollapse + * @fileoverview added by tsickle + * @suppress {checkTypes} checked by tsc */ -ServerStylesHost.ctorParameters = function () { return [ - { type: undefined, decorators: [{ type: _angular_core.Inject, args: [_angular_platformBrowser.DOCUMENT,] },] }, - { type: undefined, decorators: [{ type: _angular_core.Optional }, { type: _angular_core.Inject, args: [_angular_platformBrowser.ɵTRANSITION_ID,] },] }, -]; }; /** * @license * Copyright Google Inc. All Rights Reserved. @@ -6579,8 +15222,12 @@ ServerStylesHost.ctorParameters = function () { return [ var INTERNAL_SERVER_PLATFORM_PROVIDERS = [ { provide: _angular_platformBrowser.DOCUMENT, useFactory: _document, deps: [_angular_core.Injector] }, { provide: _angular_core.PLATFORM_ID, useValue: _angular_common.ɵPLATFORM_SERVER_ID }, - { provide: _angular_core.PLATFORM_INITIALIZER, useFactory: initParse5Adapter, multi: true, deps: [_angular_core.Injector] }, - { provide: _angular_common.PlatformLocation, useClass: ServerPlatformLocation }, PlatformState, + { provide: _angular_core.PLATFORM_INITIALIZER, useFactory: initDominoAdapter, multi: true, deps: [_angular_core.Injector] }, { + provide: _angular_common.PlatformLocation, + useClass: ServerPlatformLocation, + deps: [_angular_platformBrowser.DOCUMENT, [_angular_core.Optional, INITIAL_CONFIG]] + }, + { provide: PlatformState, deps: [_angular_platformBrowser.DOCUMENT] }, // Add special provider that allows multiple instances of platformServer* to be created. { provide: _angular_core.ɵALLOW_MULTIPLE_PLATFORMS, useValue: true } ]; @@ -6588,8 +15235,8 @@ var INTERNAL_SERVER_PLATFORM_PROVIDERS = [ * @param {?} injector * @return {?} */ -function initParse5Adapter(injector) { - return function () { Parse5DomAdapter.makeCurrent(); }; +function initDominoAdapter(injector) { + return function () { DominoAdapter.makeCurrent(); }; } /** * @param {?} renderer @@ -6618,23 +15265,21 @@ var SERVER_RENDER_PROVIDERS = [ var ServerModule = (function () { function ServerModule() { } + ServerModule.decorators = [ + { type: _angular_core.NgModule, args: [{ + exports: [_angular_platformBrowser.BrowserModule], + imports: [_angular_http.HttpModule, _angular_common_http.HttpClientModule, _angular_platformBrowser_animations.NoopAnimationsModule], + providers: [ + SERVER_RENDER_PROVIDERS, + SERVER_HTTP_PROVIDERS, + { provide: _angular_core.Testability, useValue: null }, + ], + },] }, + ]; + /** @nocollapse */ + ServerModule.ctorParameters = function () { return []; }; return ServerModule; }()); -ServerModule.decorators = [ - { type: _angular_core.NgModule, args: [{ - exports: [_angular_platformBrowser.BrowserModule], - imports: [_angular_http.HttpModule, _angular_platformBrowser_animations.NoopAnimationsModule], - providers: [ - SERVER_RENDER_PROVIDERS, - SERVER_HTTP_PROVIDERS, - { provide: _angular_core.Testability, useValue: null }, - ], - },] }, -]; -/** - * @nocollapse - */ -ServerModule.ctorParameters = function () { return []; }; /** * @param {?} injector * @return {?} @@ -6642,7 +15287,7 @@ ServerModule.ctorParameters = function () { return []; }; function _document(injector) { var /** @type {?} */ config = injector.get(INITIAL_CONFIG, null); if (config && config.document) { - return parseDocument(config.document); + return parseDocument(config.document, config.url); } else { return _angular_platformBrowser.ɵgetDOM().createHtmlDocument(); @@ -6657,7 +15302,64 @@ var platformServer = _angular_core.createPlatformFactory(_angular_core.platformC * * \@experimental */ -var platformDynamicServer = _angular_core.createPlatformFactory(_angular_compiler.platformCoreDynamic, 'serverDynamic', INTERNAL_SERVER_PLATFORM_PROVIDERS); +var platformDynamicServer = _angular_core.createPlatformFactory(_angular_platformBrowserDynamic.ɵplatformCoreDynamic, 'serverDynamic', INTERNAL_SERVER_PLATFORM_PROVIDERS); + +/** + * @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 {?} doc + * @param {?} appId + * @param {?} transferStore + * @return {?} + */ +function serializeTransferStateFactory(doc, appId, transferStore) { + return function () { + var /** @type {?} */ script = doc.createElement('script'); + script.id = appId + '-state'; + script.setAttribute('type', 'application/json'); + script.textContent = _angular_platformBrowser.ɵescapeHtml(transferStore.toJson()); + doc.body.appendChild(script); + }; +} +/** + * NgModule to install on the server side while using the `TransferState` to transfer state from + * server to client. + * + * \@experimental + */ +var ServerTransferStateModule = (function () { + function ServerTransferStateModule() { + } + ServerTransferStateModule.decorators = [ + { type: _angular_core.NgModule, args: [{ + providers: [ + _angular_platformBrowser.TransferState, { + provide: BEFORE_APP_SERIALIZED, + useFactory: serializeTransferStateFactory, + deps: [_angular_platformBrowser.DOCUMENT, _angular_core.APP_ID, _angular_platformBrowser.TransferState], + multi: true, + } + ] + },] }, + ]; + /** @nocollapse */ + ServerTransferStateModule.ctorParameters = function () { return []; }; + return ServerTransferStateModule; +}()); + +/** + * @fileoverview added by tsickle + * @suppress {checkTypes} checked by tsc + */ /** * @license * Copyright Google Inc. All Rights Reserved. @@ -6665,7 +15367,6 @@ var platformDynamicServer = _angular_core.createPlatformFactory(_angular_compile * 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 parse5$2 = __webpack_require__(35); /** * @param {?} platformFactory * @param {?} options @@ -6694,7 +15395,22 @@ function _render(platform, moduleRefPromise) { return rxjs_operator_toPromise.toPromise .call(rxjs_operator_first.first.call(rxjs_operator_filter.filter.call(applicationRef.isStable, function (isStable) { return isStable; }))) .then(function () { - var /** @type {?} */ output = platform.injector.get(PlatformState).renderToString(); + var /** @type {?} */ platformState = platform.injector.get(PlatformState); + // Run any BEFORE_APP_SERIALIZED callbacks just before rendering to string. + var /** @type {?} */ callbacks = moduleRef.injector.get(BEFORE_APP_SERIALIZED, null); + if (callbacks) { + for (var _i = 0, callbacks_1 = callbacks; _i < callbacks_1.length; _i++) { + var callback = callbacks_1[_i]; + try { + callback(); + } + catch (/** @type {?} */ e) { + // Ignore exceptions. + console.warn('Ignoring BEFORE_APP_SERIALIZED Exception: ', e); + } + } + } + var /** @type {?} */ output = platformState.renderToString(); platform.destroy(); return output; }); @@ -6703,8 +15419,12 @@ function _render(platform, moduleRefPromise) { /** * Renders a Module to string. * + * `document` is the full document HTML of the page to render, as a string. + * `url` is the URL for the current render request. + * `extraProviders` are the platform level providers for the current render request. + * * Do not use this in a production server environment. Use pre-compiled {\@link NgModuleFactory} with - * {link renderModuleFactory} instead. + * {\@link renderModuleFactory} instead. * * \@experimental * @template T @@ -6719,6 +15439,10 @@ function renderModule(module, options) { /** * Renders a {\@link NgModuleFactory} to string. * + * `document` is the full document HTML of the page to render, as a string. + * `url` is the URL for the current render request. + * `extraProviders` are the platform level providers for the current render request. + * * \@experimental * @template T * @param {?} moduleFactory @@ -6729,6 +15453,11 @@ function renderModuleFactory(moduleFactory, options) { var /** @type {?} */ platform = _getPlatform(platformServer, options); return _render(platform, platform.bootstrapModuleFactory(moduleFactory)); } + +/** + * @fileoverview added by tsickle + * @suppress {checkTypes} checked by tsc + */ /** * @license * Copyright Google Inc. All Rights Reserved. @@ -6736,6 +15465,11 @@ function renderModuleFactory(moduleFactory, options) { * 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 */ + +/** + * @fileoverview added by tsickle + * @suppress {checkTypes} checked by tsc + */ /** * @license * Copyright Google Inc. All Rights Reserved. @@ -6751,25 +15485,29 @@ function renderModuleFactory(moduleFactory, options) { /** * \@stable */ -var VERSION = new _angular_core.Version('4.2.5'); +var VERSION = new _angular_core.Version('5.0.1'); exports.PlatformState = PlatformState; exports.ServerModule = ServerModule; exports.platformDynamicServer = platformDynamicServer; exports.platformServer = platformServer; +exports.BEFORE_APP_SERIALIZED = BEFORE_APP_SERIALIZED; exports.INITIAL_CONFIG = INITIAL_CONFIG; +exports.ServerTransferStateModule = ServerTransferStateModule; exports.renderModule = renderModule; exports.renderModuleFactory = renderModuleFactory; exports.VERSION = VERSION; exports.ɵINTERNAL_SERVER_PLATFORM_PROVIDERS = INTERNAL_SERVER_PLATFORM_PROVIDERS; exports.ɵSERVER_RENDER_PROVIDERS = SERVER_RENDER_PROVIDERS; exports.ɵServerRendererFactory2 = ServerRendererFactory2; -exports.ɵf = SERVER_HTTP_PROVIDERS; -exports.ɵc = ServerXhr; -exports.ɵd = ServerXsrfStrategy; -exports.ɵe = httpFactory; +exports.ɵh = SERVER_HTTP_PROVIDERS; +exports.ɵd = ServerXhr; +exports.ɵe = ServerXsrfStrategy; +exports.ɵf = httpFactory; +exports.ɵg = zoneWrappedInterceptingHandler; exports.ɵa = instantiateServerRendererFactory; -exports.ɵb = ServerStylesHost; +exports.ɵc = ServerStylesHost; +exports.ɵb = serializeTransferStateFactory; Object.defineProperty(exports, '__esModule', { value: true }); @@ -6778,29 +15516,18 @@ Object.defineProperty(exports, '__esModule', { value: true }); /***/ }), -/* 45 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var first_1 = __webpack_require__(86); -Observable_1.Observable.prototype.first = first_1.first; -//# sourceMappingURL=first.js.map - -/***/ }), -/* 46 */ +/* 26 */ /***/ (function(module, exports, __webpack_require__) { /** - * @license Angular v4.2.5 + * @license Angular v5.0.1 * (c) 2010-2017 Google, Inc. https://angular.io/ * License: MIT */ (function (global, factory) { - true ? factory(exports, __webpack_require__(82)) : - typeof define === 'function' && define.amd ? define(['exports', '@angular/animations'], factory) : - (factory((global.ng = global.ng || {}, global.ng.animations = global.ng.animations || {}, global.ng.animations.browser = global.ng.animations.browser || {}),global.ng.animations)); + true ? factory(exports, __webpack_require__(51)) : + typeof define === 'function' && define.amd ? define('@angular/animations/browser', ['exports', '@angular/animations'], factory) : + (factory((global.ng = global.ng || {}, global.ng.animations = global.ng.animations || {}, global.ng.animations.browser = {}),global.ng.animations)); }(this, (function (exports,_angular_animations) { 'use strict'; /*! ***************************************************************************** @@ -6827,13 +15554,25 @@ function __extends(d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -} +} + +var __assign = Object.assign || function __assign(t) { + for (var s, i = 1, n = arguments.length; i < n; i++) { + s = arguments[i]; + for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; + } + return t; +}; /** - * @license Angular v4.2.5 + * @license Angular v5.0.1 * (c) 2010-2017 Google, Inc. https://angular.io/ * License: MIT */ +/** + * @fileoverview added by tsickle + * @suppress {checkTypes} checked by tsc + */ /** * @license * Copyright Google Inc. All Rights Reserved. @@ -6841,6 +15580,10 @@ function __extends(d, b) { * 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 {?} players + * @return {?} + */ function optimizeGroupPlayer(players) { switch (players.length) { case 0: @@ -6851,29 +15594,43 @@ function optimizeGroupPlayer(players) { return new _angular_animations.ɵAnimationGroupPlayer(players); } } +/** + * @param {?} driver + * @param {?} normalizer + * @param {?} element + * @param {?} keyframes + * @param {?=} preStyles + * @param {?=} postStyles + * @return {?} + */ function normalizeKeyframes(driver, normalizer, element, keyframes, preStyles, postStyles) { if (preStyles === void 0) { preStyles = {}; } if (postStyles === void 0) { postStyles = {}; } - var errors = []; - var normalizedKeyframes = []; - var previousOffset = -1; - var previousKeyframe = null; + var /** @type {?} */ errors = []; + var /** @type {?} */ normalizedKeyframes = []; + var /** @type {?} */ previousOffset = -1; + var /** @type {?} */ previousKeyframe = null; keyframes.forEach(function (kf) { - var offset = kf['offset']; - var isSameOffset = offset == previousOffset; - var normalizedKeyframe = (isSameOffset && previousKeyframe) || {}; + var /** @type {?} */ offset = /** @type {?} */ (kf['offset']); + var /** @type {?} */ isSameOffset = offset == previousOffset; + var /** @type {?} */ normalizedKeyframe = (isSameOffset && previousKeyframe) || {}; Object.keys(kf).forEach(function (prop) { - var normalizedProp = prop; - var normalizedValue = kf[prop]; - if (normalizedValue == _angular_animations.ɵPRE_STYLE) { - normalizedValue = preStyles[prop]; - } - else if (normalizedValue == _angular_animations.AUTO_STYLE) { - normalizedValue = postStyles[prop]; - } - else if (prop != 'offset') { - normalizedProp = normalizer.normalizePropertyName(prop, errors); - normalizedValue = normalizer.normalizeStyleValue(prop, normalizedProp, kf[prop], errors); + var /** @type {?} */ normalizedProp = prop; + var /** @type {?} */ normalizedValue = kf[prop]; + if (prop !== 'offset') { + normalizedProp = normalizer.normalizePropertyName(normalizedProp, errors); + switch (normalizedValue) { + case _angular_animations.ɵPRE_STYLE: + normalizedValue = preStyles[prop]; + break; + case _angular_animations.AUTO_STYLE: + normalizedValue = postStyles[prop]; + break; + default: + normalizedValue = + normalizer.normalizeStyleValue(prop, normalizedProp, normalizedValue, errors); + break; + } } normalizedKeyframe[normalizedProp] = normalizedValue; }); @@ -6884,11 +15641,18 @@ function normalizeKeyframes(driver, normalizer, element, keyframes, preStyles, p previousOffset = offset; }); if (errors.length) { - var LINE_START = '\n - '; + var /** @type {?} */ LINE_START = '\n - '; throw new Error("Unable to animate due to the following errors:" + LINE_START + errors.join(LINE_START)); } return normalizedKeyframes; } +/** + * @param {?} player + * @param {?} eventName + * @param {?} event + * @param {?} callback + * @return {?} + */ function listenOnPlayer(player, eventName, event, callback) { switch (eventName) { case 'start': @@ -6902,21 +15666,42 @@ function listenOnPlayer(player, eventName, event, callback) { break; } } +/** + * @param {?} e + * @param {?=} phaseName + * @param {?=} totalTime + * @return {?} + */ function copyAnimationEvent(e, phaseName, totalTime) { - var event = makeAnimationEvent(e.element, e.triggerName, e.fromState, e.toState, phaseName || e.phaseName, totalTime == undefined ? e.totalTime : totalTime); - var data = e['_data']; + var /** @type {?} */ event = makeAnimationEvent(e.element, e.triggerName, e.fromState, e.toState, phaseName || e.phaseName, totalTime == undefined ? e.totalTime : totalTime); + var /** @type {?} */ data = (/** @type {?} */ (e))['_data']; if (data != null) { - event['_data'] = data; + (/** @type {?} */ (event))['_data'] = data; } return event; } +/** + * @param {?} element + * @param {?} triggerName + * @param {?} fromState + * @param {?} toState + * @param {?=} phaseName + * @param {?=} totalTime + * @return {?} + */ function makeAnimationEvent(element, triggerName, fromState, toState, phaseName, totalTime) { if (phaseName === void 0) { phaseName = ''; } if (totalTime === void 0) { totalTime = 0; } return { element: element, triggerName: triggerName, fromState: fromState, toState: toState, phaseName: phaseName, totalTime: totalTime }; } +/** + * @param {?} map + * @param {?} key + * @param {?} defaultValue + * @return {?} + */ function getOrSetAsInMap(map, key, defaultValue) { - var value; + var /** @type {?} */ value; if (map instanceof Map) { value = map.get(key); if (!value) { @@ -6931,38 +15716,44 @@ function getOrSetAsInMap(map, key, defaultValue) { } return value; } +/** + * @param {?} command + * @return {?} + */ function parseTimelineCommand(command) { - var separatorPos = command.indexOf(':'); - var id = command.substring(1, separatorPos); - var action = command.substr(separatorPos + 1); + var /** @type {?} */ separatorPos = command.indexOf(':'); + var /** @type {?} */ id = command.substring(1, separatorPos); + var /** @type {?} */ action = command.substr(separatorPos + 1); return [id, action]; } var _contains = function (elm1, elm2) { return false; }; -var _matches = function (element, selector) { return false; }; +var _matches = function (element, selector) { + return false; +}; var _query = function (element, selector, multi) { return []; }; if (typeof Element != 'undefined') { // this is well supported in all browsers - _contains = function (elm1, elm2) { return elm1.contains(elm2); }; + _contains = function (elm1, elm2) { return /** @type {?} */ (elm1.contains(elm2)); }; if (Element.prototype.matches) { _matches = function (element, selector) { return element.matches(selector); }; } else { - var proto = Element.prototype; - var fn_1 = proto.matchesSelector || proto.mozMatchesSelector || proto.msMatchesSelector || + var /** @type {?} */ proto = /** @type {?} */ (Element.prototype); + var /** @type {?} */ fn_1 = proto.matchesSelector || proto.mozMatchesSelector || proto.msMatchesSelector || proto.oMatchesSelector || proto.webkitMatchesSelector; if (fn_1) { _matches = function (element, selector) { return fn_1.apply(element, [selector]); }; } } _query = function (element, selector, multi) { - var results = []; + var /** @type {?} */ results = []; if (multi) { results.push.apply(results, element.querySelectorAll(selector)); } else { - var elm = element.querySelector(selector); + var /** @type {?} */ elm = element.querySelector(selector); if (elm) { results.push(elm); } @@ -6970,9 +15761,34 @@ if (typeof Element != 'undefined') { return results; }; } +var _CACHED_BODY = null; +/** + * @param {?} prop + * @return {?} + */ +function validateStyleProperty(prop) { + if (!_CACHED_BODY) { + _CACHED_BODY = getBodyNode() || {}; + } + return /** @type {?} */ ((_CACHED_BODY)).style ? prop in /** @type {?} */ ((_CACHED_BODY)).style : true; +} +/** + * @return {?} + */ +function getBodyNode() { + if (typeof document != 'undefined') { + return document.body; + } + return null; +} var matchesElement = _matches; var containsElement = _contains; var invokeQuery = _query; + +/** + * @fileoverview added by tsickle + * @suppress {checkTypes} checked by tsc + */ /** * @license * Copyright Google Inc. All Rights Reserved. @@ -6981,36 +15797,113 @@ var invokeQuery = _query; * found in the LICENSE file at https://angular.io/license */ /** - * @experimental + * \@experimental */ var NoopAnimationDriver = (function () { function NoopAnimationDriver() { } - NoopAnimationDriver.prototype.matchesElement = function (element, selector) { + /** + * @param {?} prop + * @return {?} + */ + NoopAnimationDriver.prototype.validateStyleProperty = /** + * @param {?} prop + * @return {?} + */ + function (prop) { return validateStyleProperty(prop); }; + /** + * @param {?} element + * @param {?} selector + * @return {?} + */ + NoopAnimationDriver.prototype.matchesElement = /** + * @param {?} element + * @param {?} selector + * @return {?} + */ + function (element, selector) { return matchesElement(element, selector); }; - NoopAnimationDriver.prototype.containsElement = function (elm1, elm2) { return containsElement(elm1, elm2); }; - NoopAnimationDriver.prototype.query = function (element, selector, multi) { - return invokeQuery(element, selector, multi); - }; - NoopAnimationDriver.prototype.computeStyle = function (element, prop, defaultValue) { - return defaultValue || ''; - }; - NoopAnimationDriver.prototype.animate = function (element, keyframes, duration, delay, easing, previousPlayers) { - if (previousPlayers === void 0) { previousPlayers = []; } - return new _angular_animations.NoopAnimationPlayer(); - }; - return NoopAnimationDriver; -}()); -/** - * @experimental - */ -var AnimationDriver = (function () { - function AnimationDriver() { - } + /** + * @param {?} elm1 + * @param {?} elm2 + * @return {?} + */ + NoopAnimationDriver.prototype.containsElement = /** + * @param {?} elm1 + * @param {?} elm2 + * @return {?} + */ + function (elm1, elm2) { return containsElement(elm1, elm2); }; + /** + * @param {?} element + * @param {?} selector + * @param {?} multi + * @return {?} + */ + NoopAnimationDriver.prototype.query = /** + * @param {?} element + * @param {?} selector + * @param {?} multi + * @return {?} + */ + function (element, selector, multi) { + return invokeQuery(element, selector, multi); + }; + /** + * @param {?} element + * @param {?} prop + * @param {?=} defaultValue + * @return {?} + */ + NoopAnimationDriver.prototype.computeStyle = /** + * @param {?} element + * @param {?} prop + * @param {?=} defaultValue + * @return {?} + */ + function (element, prop, defaultValue) { + return defaultValue || ''; + }; + /** + * @param {?} element + * @param {?} keyframes + * @param {?} duration + * @param {?} delay + * @param {?} easing + * @param {?=} previousPlayers + * @return {?} + */ + NoopAnimationDriver.prototype.animate = /** + * @param {?} element + * @param {?} keyframes + * @param {?} duration + * @param {?} delay + * @param {?} easing + * @param {?=} previousPlayers + * @return {?} + */ + function (element, keyframes, duration, delay, easing, previousPlayers) { + if (previousPlayers === void 0) { previousPlayers = []; } + return new _angular_animations.NoopAnimationPlayer(); + }; + return NoopAnimationDriver; +}()); +/** + * \@experimental + * @abstract + */ +var AnimationDriver = (function () { + function AnimationDriver() { + } + AnimationDriver.NOOP = new NoopAnimationDriver(); return AnimationDriver; }()); -AnimationDriver.NOOP = new NoopAnimationDriver(); + +/** + * @fileoverview added by tsickle + * @suppress {checkTypes} checked by tsc + */ /** * @license * Copyright Google Inc. All Rights Reserved. @@ -7019,6 +15912,8 @@ AnimationDriver.NOOP = new NoopAnimationDriver(); * found in the LICENSE file at https://angular.io/license */ var ONE_SECOND = 1000; +var SUBSTITUTION_EXPR_START = '{{'; +var SUBSTITUTION_EXPR_END = '}}'; var ENTER_CLASSNAME = 'ng-enter'; var LEAVE_CLASSNAME = 'ng-leave'; var ENTER_SELECTOR = '.ng-enter'; @@ -7034,7 +15929,7 @@ var NG_ANIMATING_SELECTOR = '.ng-animating'; function resolveTimingValue(value) { if (typeof value == 'number') return value; - var /** @type {?} */ matches = ((value)).match(/^(-?[\.\d]+)(m?s)/); + var /** @type {?} */ matches = (/** @type {?} */ (value)).match(/^(-?[\.\d]+)(m?s)/); if (!matches || matches.length < 2) return 0; return _convertTimeValueToMS(parseFloat(matches[1]), matches[2]); @@ -7049,6 +15944,7 @@ function _convertTimeValueToMS(value, unit) { case 's': return value * ONE_SECOND; default: + // ms or something else return value; } } @@ -7059,7 +15955,7 @@ function _convertTimeValueToMS(value, unit) { * @return {?} */ function resolveTiming(timings, errors, allowNegativeValues) { - return timings.hasOwnProperty('duration') ? (timings) : + return timings.hasOwnProperty('duration') ? /** @type {?} */ (timings) : parseTimeExpression(/** @type {?} */ (timings), errors, allowNegativeValues); } /** @@ -7090,7 +15986,7 @@ function parseTimeExpression(exp, errors, allowNegativeValues) { } } else { - duration = (exp); + duration = /** @type {?} */ (exp); } if (!allowNegativeValues) { var /** @type {?} */ containsErrors = false; @@ -7190,7 +16086,7 @@ function normalizeAnimationEntry(steps) { return steps[0]; return _angular_animations.sequence(steps); } - return (steps); + return /** @type {?} */ (steps); } /** * @param {?} value @@ -7200,10 +16096,8 @@ function normalizeAnimationEntry(steps) { */ function validateStyleParams(value, options, errors) { var /** @type {?} */ params = options.params || {}; - if (typeof value !== 'string') - return; - var /** @type {?} */ matches = value.toString().match(PARAM_REGEX); - if (matches) { + var /** @type {?} */ matches = extractStyleParams(value); + if (matches.length) { matches.forEach(function (varName) { if (!params.hasOwnProperty(varName)) { errors.push("Unable to resolve the local animation param " + varName + " in the given list of values"); @@ -7211,7 +16105,23 @@ function validateStyleParams(value, options, errors) { }); } } -var PARAM_REGEX = /\{\{\s*(.+?)\s*\}\}/g; +var PARAM_REGEX = new RegExp(SUBSTITUTION_EXPR_START + "\\s*(.+?)\\s*" + SUBSTITUTION_EXPR_END, 'g'); +/** + * @param {?} value + * @return {?} + */ +function extractStyleParams(value) { + var /** @type {?} */ params = []; + if (typeof value === 'string') { + var /** @type {?} */ val = value.toString(); + var /** @type {?} */ match = void 0; + while (match = PARAM_REGEX.exec(val)) { + params.push(/** @type {?} */ (match[1])); + } + PARAM_REGEX.lastIndex = 0; + } + return params; +} /** * @param {?} value * @param {?} params @@ -7250,21 +16160,7 @@ function iteratorToArray(iterator) { * @param {?} destination * @return {?} */ -function mergeAnimationOptions(source, destination) { - if (source.params) { - var /** @type {?} */ p0_1 = source.params; - if (!destination.params) { - destination.params = {}; - } - var /** @type {?} */ p1_1 = destination.params; - Object.keys(p0_1).forEach(function (param) { - if (!p1_1.hasOwnProperty(param)) { - p1_1[param] = p0_1[param]; - } - }); - } - return destination; -} + var DASH_CASE_REGEXP = /-+([a-z0-9])/g; /** * @param {?} input @@ -7279,6 +16175,57 @@ function dashCaseToCamelCase(input) { return m[1].toUpperCase(); }); } +/** + * @param {?} duration + * @param {?} delay + * @return {?} + */ +function allowPreviousPlayerStylesMerge(duration, delay) { + return duration === 0 || delay === 0; +} +/** + * @param {?} visitor + * @param {?} node + * @param {?} context + * @return {?} + */ +function visitDslNode(visitor, node, context) { + switch (node.type) { + case 7 /* Trigger */: + return visitor.visitTrigger(node, context); + case 0 /* State */: + return visitor.visitState(node, context); + case 1 /* Transition */: + return visitor.visitTransition(node, context); + case 2 /* Sequence */: + return visitor.visitSequence(node, context); + case 3 /* Group */: + return visitor.visitGroup(node, context); + case 4 /* Animate */: + return visitor.visitAnimate(node, context); + case 5 /* Keyframes */: + return visitor.visitKeyframes(node, context); + case 6 /* Style */: + return visitor.visitStyle(node, context); + case 8 /* Reference */: + return visitor.visitReference(node, context); + case 9 /* AnimateChild */: + return visitor.visitAnimateChild(node, context); + case 10 /* AnimateRef */: + return visitor.visitAnimateRef(node, context); + case 11 /* Query */: + return visitor.visitQuery(node, context); + case 12 /* Stagger */: + return visitor.visitStagger(node, context); + default: + throw new Error("Unable to resolve animation metadata node #" + node.type); + } +} + +/** + * @fileoverview added by tsickle + * @suppress {checkTypes} checked by tsc + */ /** * @license * Copyright Google Inc. All Rights Reserved. @@ -7286,844 +16233,647 @@ function dashCaseToCamelCase(input) { * 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 EMPTY_ANIMATION_OPTIONS = {}; +var ANY_STATE = '*'; /** - * @abstract + * @param {?} transitionValue + * @param {?} errors + * @return {?} + */ +function parseTransitionExpr(transitionValue, errors) { + var /** @type {?} */ expressions = []; + if (typeof transitionValue == 'string') { + (/** @type {?} */ (transitionValue)) + .split(/\s*,\s*/) + .forEach(function (str) { return parseInnerTransitionStr(str, expressions, errors); }); + } + else { + expressions.push(/** @type {?} */ (transitionValue)); + } + return expressions; +} +/** + * @param {?} eventStr + * @param {?} expressions + * @param {?} errors + * @return {?} + */ +function parseInnerTransitionStr(eventStr, expressions, errors) { + if (eventStr[0] == ':') { + var /** @type {?} */ result = parseAnimationAlias(eventStr, errors); + if (typeof result == 'function') { + expressions.push(result); + return; + } + eventStr = /** @type {?} */ (result); + } + var /** @type {?} */ match = eventStr.match(/^(\*|[-\w]+)\s*([=-]>)\s*(\*|[-\w]+)$/); + if (match == null || match.length < 4) { + errors.push("The provided transition expression \"" + eventStr + "\" is not supported"); + return expressions; + } + var /** @type {?} */ fromState = match[1]; + var /** @type {?} */ separator = match[2]; + var /** @type {?} */ toState = match[3]; + expressions.push(makeLambdaFromStates(fromState, toState)); + var /** @type {?} */ isFullAnyStateExpr = fromState == ANY_STATE && toState == ANY_STATE; + if (separator[0] == '<' && !isFullAnyStateExpr) { + expressions.push(makeLambdaFromStates(toState, fromState)); + } +} +/** + * @param {?} alias + * @param {?} errors + * @return {?} + */ +function parseAnimationAlias(alias, errors) { + switch (alias) { + case ':enter': + return 'void => *'; + case ':leave': + return '* => void'; + case ':increment': + return function (fromState, toState) { return parseFloat(toState) > parseFloat(fromState); }; + case ':decrement': + return function (fromState, toState) { return parseFloat(toState) < parseFloat(fromState); }; + default: + errors.push("The transition alias value \"" + alias + "\" is not supported"); + return '* => *'; + } +} +var TRUE_BOOLEAN_VALUES = new Set(); +TRUE_BOOLEAN_VALUES.add('true'); +TRUE_BOOLEAN_VALUES.add('1'); +var FALSE_BOOLEAN_VALUES = new Set(); +FALSE_BOOLEAN_VALUES.add('false'); +FALSE_BOOLEAN_VALUES.add('0'); +/** + * @param {?} lhs + * @param {?} rhs + * @return {?} + */ +function makeLambdaFromStates(lhs, rhs) { + var /** @type {?} */ LHS_MATCH_BOOLEAN = TRUE_BOOLEAN_VALUES.has(lhs) || FALSE_BOOLEAN_VALUES.has(lhs); + var /** @type {?} */ RHS_MATCH_BOOLEAN = TRUE_BOOLEAN_VALUES.has(rhs) || FALSE_BOOLEAN_VALUES.has(rhs); + return function (fromState, toState) { + var /** @type {?} */ lhsMatch = lhs == ANY_STATE || lhs == fromState; + var /** @type {?} */ rhsMatch = rhs == ANY_STATE || rhs == toState; + if (!lhsMatch && LHS_MATCH_BOOLEAN && typeof fromState === 'boolean') { + lhsMatch = fromState ? TRUE_BOOLEAN_VALUES.has(lhs) : FALSE_BOOLEAN_VALUES.has(lhs); + } + if (!rhsMatch && RHS_MATCH_BOOLEAN && typeof toState === 'boolean') { + rhsMatch = toState ? TRUE_BOOLEAN_VALUES.has(rhs) : FALSE_BOOLEAN_VALUES.has(rhs); + } + return lhsMatch && rhsMatch; + }; +} + +/** + * @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 SELF_TOKEN = ':self'; +var SELF_TOKEN_REGEX = new RegExp("s*" + SELF_TOKEN + "s*,?", 'g'); +/** + * @param {?} driver + * @param {?} metadata + * @param {?} errors + * @return {?} */ -var Ast = (function () { - function Ast() { - this.options = EMPTY_ANIMATION_OPTIONS; +function buildAnimationAst(driver, metadata, errors) { + return new AnimationAstBuilderVisitor(driver).build(metadata, errors); +} +var LEAVE_TOKEN = ':leave'; +var LEAVE_TOKEN_REGEX = new RegExp(LEAVE_TOKEN, 'g'); +var ENTER_TOKEN = ':enter'; +var ENTER_TOKEN_REGEX = new RegExp(ENTER_TOKEN, 'g'); +var ROOT_SELECTOR = ''; +var AnimationAstBuilderVisitor = (function () { + function AnimationAstBuilderVisitor(_driver) { + this._driver = _driver; } /** - * @abstract - * @param {?} ast - * @param {?} context + * @param {?} metadata + * @param {?} errors * @return {?} */ - Ast.prototype.visit = function (ast, context) { }; - Object.defineProperty(Ast.prototype, "params", { - /** - * @return {?} - */ - get: function () { return this.options['params'] || null; }, - enumerable: true, - configurable: true - }); - return Ast; -}()); -var TriggerAst = (function (_super) { - __extends(TriggerAst, _super); - /** - * @param {?} name - * @param {?} states - * @param {?} transitions + AnimationAstBuilderVisitor.prototype.build = /** + * @param {?} metadata + * @param {?} errors + * @return {?} */ - function TriggerAst(name, states, transitions) { - var _this = _super.call(this) || this; - _this.name = name; - _this.states = states; - _this.transitions = transitions; - _this.queryCount = 0; - _this.depCount = 0; - return _this; - } + function (metadata, errors) { + var /** @type {?} */ context = new AnimationAstBuilderContext(errors); + this._resetContextStyleTimingState(context); + return /** @type {?} */ (visitDslNode(this, normalizeAnimationEntry(metadata), context)); + }; /** - * @param {?} visitor * @param {?} context * @return {?} */ - TriggerAst.prototype.visit = function (visitor, context) { return visitor.visitTrigger(this, context); }; - return TriggerAst; -}(Ast)); -var StateAst = (function (_super) { - __extends(StateAst, _super); - /** - * @param {?} name - * @param {?} style - */ - function StateAst(name, style$$1) { - var _this = _super.call(this) || this; - _this.name = name; - _this.style = style$$1; - return _this; - } - /** - * @param {?} visitor + AnimationAstBuilderVisitor.prototype._resetContextStyleTimingState = /** * @param {?} context * @return {?} */ - StateAst.prototype.visit = function (visitor, context) { return visitor.visitState(this, context); }; - return StateAst; -}(Ast)); -var TransitionAst = (function (_super) { - __extends(TransitionAst, _super); + function (context) { + context.currentQuerySelector = ROOT_SELECTOR; + context.collectedStyles = {}; + context.collectedStyles[ROOT_SELECTOR] = {}; + context.currentTime = 0; + }; /** - * @param {?} matchers - * @param {?} animation + * @param {?} metadata + * @param {?} context + * @return {?} */ - function TransitionAst(matchers, animation) { - var _this = _super.call(this) || this; - _this.matchers = matchers; - _this.animation = animation; - _this.queryCount = 0; - _this.depCount = 0; - return _this; - } - /** - * @param {?} visitor + AnimationAstBuilderVisitor.prototype.visitTrigger = /** + * @param {?} metadata * @param {?} context * @return {?} */ - TransitionAst.prototype.visit = function (visitor, context) { return visitor.visitTransition(this, context); }; - return TransitionAst; -}(Ast)); -var SequenceAst = (function (_super) { - __extends(SequenceAst, _super); - /** - * @param {?} steps - */ - function SequenceAst(steps) { - var _this = _super.call(this) || this; - _this.steps = steps; - return _this; - } + function (metadata, context) { + var _this = this; + var /** @type {?} */ queryCount = context.queryCount = 0; + var /** @type {?} */ depCount = context.depCount = 0; + var /** @type {?} */ states = []; + var /** @type {?} */ transitions = []; + metadata.definitions.forEach(function (def) { + _this._resetContextStyleTimingState(context); + if (def.type == 0 /* State */) { + var /** @type {?} */ stateDef_1 = /** @type {?} */ (def); + var /** @type {?} */ name_1 = stateDef_1.name; + name_1.split(/\s*,\s*/).forEach(function (n) { + stateDef_1.name = n; + states.push(_this.visitState(stateDef_1, context)); + }); + stateDef_1.name = name_1; + } + else if (def.type == 1 /* Transition */) { + var /** @type {?} */ transition = _this.visitTransition(/** @type {?} */ (def), context); + queryCount += transition.queryCount; + depCount += transition.depCount; + transitions.push(transition); + } + else { + context.errors.push('only state() and transition() definitions can sit inside of a trigger()'); + } + }); + return { + type: 7 /* Trigger */, + name: metadata.name, states: states, transitions: transitions, queryCount: queryCount, depCount: depCount, + options: null + }; + }; /** - * @param {?} visitor + * @param {?} metadata * @param {?} context * @return {?} */ - SequenceAst.prototype.visit = function (visitor, context) { return visitor.visitSequence(this, context); }; - return SequenceAst; -}(Ast)); -var GroupAst = (function (_super) { - __extends(GroupAst, _super); - /** - * @param {?} steps - */ - function GroupAst(steps) { - var _this = _super.call(this) || this; - _this.steps = steps; - return _this; - } - /** - * @param {?} visitor + AnimationAstBuilderVisitor.prototype.visitState = /** + * @param {?} metadata * @param {?} context * @return {?} */ - GroupAst.prototype.visit = function (visitor, context) { return visitor.visitGroup(this, context); }; - return GroupAst; -}(Ast)); -var AnimateAst = (function (_super) { - __extends(AnimateAst, _super); - /** - * @param {?} timings - * @param {?} style - */ - function AnimateAst(timings, style$$1) { - var _this = _super.call(this) || this; - _this.timings = timings; - _this.style = style$$1; - return _this; - } + function (metadata, context) { + var /** @type {?} */ styleAst = this.visitStyle(metadata.styles, context); + var /** @type {?} */ astParams = (metadata.options && metadata.options.params) || null; + if (styleAst.containsDynamicStyles) { + var /** @type {?} */ missingSubs_1 = new Set(); + var /** @type {?} */ params_1 = astParams || {}; + styleAst.styles.forEach(function (value) { + if (isObject(value)) { + var /** @type {?} */ stylesObj_1 = /** @type {?} */ (value); + Object.keys(stylesObj_1).forEach(function (prop) { + extractStyleParams(stylesObj_1[prop]).forEach(function (sub) { + if (!params_1.hasOwnProperty(sub)) { + missingSubs_1.add(sub); + } + }); + }); + } + }); + if (missingSubs_1.size) { + var /** @type {?} */ missingSubsArr = iteratorToArray(missingSubs_1.values()); + context.errors.push("state(\"" + metadata.name + "\", ...) must define default values for all the following style substitutions: " + missingSubsArr.join(', ')); + } + } + return { + type: 0 /* State */, + name: metadata.name, + style: styleAst, + options: astParams ? { params: astParams } : null + }; + }; /** - * @param {?} visitor + * @param {?} metadata * @param {?} context * @return {?} */ - AnimateAst.prototype.visit = function (visitor, context) { return visitor.visitAnimate(this, context); }; - return AnimateAst; -}(Ast)); -var StyleAst = (function (_super) { - __extends(StyleAst, _super); - /** - * @param {?} styles - * @param {?} easing - * @param {?} offset - */ - function StyleAst(styles, easing, offset) { - var _this = _super.call(this) || this; - _this.styles = styles; - _this.easing = easing; - _this.offset = offset; - _this.isEmptyStep = false; - return _this; - } - /** - * @param {?} visitor + AnimationAstBuilderVisitor.prototype.visitTransition = /** + * @param {?} metadata * @param {?} context * @return {?} */ - StyleAst.prototype.visit = function (visitor, context) { return visitor.visitStyle(this, context); }; - return StyleAst; -}(Ast)); -var KeyframesAst = (function (_super) { - __extends(KeyframesAst, _super); - /** - * @param {?} styles - */ - function KeyframesAst(styles) { - var _this = _super.call(this) || this; - _this.styles = styles; - return _this; - } + function (metadata, context) { + context.queryCount = 0; + context.depCount = 0; + var /** @type {?} */ animation = visitDslNode(this, normalizeAnimationEntry(metadata.animation), context); + var /** @type {?} */ matchers = parseTransitionExpr(metadata.expr, context.errors); + return { + type: 1 /* Transition */, + matchers: matchers, + animation: animation, + queryCount: context.queryCount, + depCount: context.depCount, + options: normalizeAnimationOptions(metadata.options) + }; + }; /** - * @param {?} visitor + * @param {?} metadata * @param {?} context * @return {?} */ - KeyframesAst.prototype.visit = function (visitor, context) { return visitor.visitKeyframes(this, context); }; - return KeyframesAst; -}(Ast)); -var ReferenceAst = (function (_super) { - __extends(ReferenceAst, _super); - /** - * @param {?} animation + AnimationAstBuilderVisitor.prototype.visitSequence = /** + * @param {?} metadata + * @param {?} context + * @return {?} */ - function ReferenceAst(animation) { - var _this = _super.call(this) || this; - _this.animation = animation; - return _this; - } + function (metadata, context) { + var _this = this; + return { + type: 2 /* Sequence */, + steps: metadata.steps.map(function (s) { return visitDslNode(_this, s, context); }), + options: normalizeAnimationOptions(metadata.options) + }; + }; /** - * @param {?} visitor + * @param {?} metadata * @param {?} context * @return {?} */ - ReferenceAst.prototype.visit = function (visitor, context) { return visitor.visitReference(this, context); }; - return ReferenceAst; -}(Ast)); -var AnimateChildAst = (function (_super) { - __extends(AnimateChildAst, _super); - function AnimateChildAst() { - return _super.call(this) || this; - } - /** - * @param {?} visitor + AnimationAstBuilderVisitor.prototype.visitGroup = /** + * @param {?} metadata * @param {?} context * @return {?} */ - AnimateChildAst.prototype.visit = function (visitor, context) { return visitor.visitAnimateChild(this, context); }; - return AnimateChildAst; -}(Ast)); -var AnimateRefAst = (function (_super) { - __extends(AnimateRefAst, _super); + function (metadata, context) { + var _this = this; + var /** @type {?} */ currentTime = context.currentTime; + var /** @type {?} */ furthestTime = 0; + var /** @type {?} */ steps = metadata.steps.map(function (step) { + context.currentTime = currentTime; + var /** @type {?} */ innerAst = visitDslNode(_this, step, context); + furthestTime = Math.max(furthestTime, context.currentTime); + return innerAst; + }); + context.currentTime = furthestTime; + return { + type: 3 /* Group */, + steps: steps, + options: normalizeAnimationOptions(metadata.options) + }; + }; /** - * @param {?} animation + * @param {?} metadata + * @param {?} context + * @return {?} */ - function AnimateRefAst(animation) { - var _this = _super.call(this) || this; - _this.animation = animation; - return _this; - } - /** - * @param {?} visitor + AnimationAstBuilderVisitor.prototype.visitAnimate = /** + * @param {?} metadata * @param {?} context * @return {?} */ - AnimateRefAst.prototype.visit = function (visitor, context) { return visitor.visitAnimateRef(this, context); }; - return AnimateRefAst; -}(Ast)); -var QueryAst = (function (_super) { - __extends(QueryAst, _super); + function (metadata, context) { + var /** @type {?} */ timingAst = constructTimingAst(metadata.timings, context.errors); + context.currentAnimateTimings = timingAst; + var /** @type {?} */ styleAst; + var /** @type {?} */ styleMetadata = metadata.styles ? metadata.styles : _angular_animations.style({}); + if (styleMetadata.type == 5 /* Keyframes */) { + styleAst = this.visitKeyframes(/** @type {?} */ (styleMetadata), context); + } + else { + var /** @type {?} */ styleMetadata_1 = /** @type {?} */ (metadata.styles); + var /** @type {?} */ isEmpty = false; + if (!styleMetadata_1) { + isEmpty = true; + var /** @type {?} */ newStyleData = {}; + if (timingAst.easing) { + newStyleData['easing'] = timingAst.easing; + } + styleMetadata_1 = _angular_animations.style(newStyleData); + } + context.currentTime += timingAst.duration + timingAst.delay; + var /** @type {?} */ _styleAst = this.visitStyle(styleMetadata_1, context); + _styleAst.isEmptyStep = isEmpty; + styleAst = _styleAst; + } + context.currentAnimateTimings = null; + return { + type: 4 /* Animate */, + timings: timingAst, + style: styleAst, + options: null + }; + }; /** - * @param {?} selector - * @param {?} limit - * @param {?} optional - * @param {?} includeSelf - * @param {?} animation + * @param {?} metadata + * @param {?} context + * @return {?} */ - function QueryAst(selector, limit, optional, includeSelf, animation) { - var _this = _super.call(this) || this; - _this.selector = selector; - _this.limit = limit; - _this.optional = optional; - _this.includeSelf = includeSelf; - _this.animation = animation; - return _this; - } - /** - * @param {?} visitor + AnimationAstBuilderVisitor.prototype.visitStyle = /** + * @param {?} metadata * @param {?} context * @return {?} */ - QueryAst.prototype.visit = function (visitor, context) { return visitor.visitQuery(this, context); }; - return QueryAst; -}(Ast)); -var StaggerAst = (function (_super) { - __extends(StaggerAst, _super); + function (metadata, context) { + var /** @type {?} */ ast = this._makeStyleAst(metadata, context); + this._validateStyleAst(ast, context); + return ast; + }; /** - * @param {?} timings - * @param {?} animation + * @param {?} metadata + * @param {?} context + * @return {?} */ - function StaggerAst(timings, animation) { - var _this = _super.call(this) || this; - _this.timings = timings; - _this.animation = animation; - return _this; - } - /** - * @param {?} visitor + AnimationAstBuilderVisitor.prototype._makeStyleAst = /** + * @param {?} metadata * @param {?} context * @return {?} */ - StaggerAst.prototype.visit = function (visitor, context) { return visitor.visitStagger(this, context); }; - return StaggerAst; -}(Ast)); -var TimingAst = (function (_super) { - __extends(TimingAst, _super); + function (metadata, context) { + var /** @type {?} */ styles = []; + if (Array.isArray(metadata.styles)) { + (/** @type {?} */ (metadata.styles)).forEach(function (styleTuple) { + if (typeof styleTuple == 'string') { + if (styleTuple == _angular_animations.AUTO_STYLE) { + styles.push(/** @type {?} */ (styleTuple)); + } + else { + context.errors.push("The provided style string value " + styleTuple + " is not allowed."); + } + } + else { + styles.push(/** @type {?} */ (styleTuple)); + } + }); + } + else { + styles.push(metadata.styles); + } + var /** @type {?} */ containsDynamicStyles = false; + var /** @type {?} */ collectedEasing = null; + styles.forEach(function (styleData) { + if (isObject(styleData)) { + var /** @type {?} */ styleMap = /** @type {?} */ (styleData); + var /** @type {?} */ easing = styleMap['easing']; + if (easing) { + collectedEasing = /** @type {?} */ (easing); + delete styleMap['easing']; + } + if (!containsDynamicStyles) { + for (var /** @type {?} */ prop in styleMap) { + var /** @type {?} */ value = styleMap[prop]; + if (value.toString().indexOf(SUBSTITUTION_EXPR_START) >= 0) { + containsDynamicStyles = true; + break; + } + } + } + } + }); + return { + type: 6 /* Style */, + styles: styles, + easing: collectedEasing, + offset: metadata.offset, containsDynamicStyles: containsDynamicStyles, + options: null + }; + }; /** - * @param {?} duration - * @param {?=} delay - * @param {?=} easing + * @param {?} ast + * @param {?} context + * @return {?} */ - function TimingAst(duration, delay, easing) { - if (delay === void 0) { delay = 0; } - if (easing === void 0) { easing = null; } - var _this = _super.call(this) || this; - _this.duration = duration; - _this.delay = delay; - _this.easing = easing; - return _this; - } - /** - * @param {?} visitor + AnimationAstBuilderVisitor.prototype._validateStyleAst = /** + * @param {?} ast * @param {?} context * @return {?} */ - TimingAst.prototype.visit = function (visitor, context) { return visitor.visitTiming(this, context); }; - return TimingAst; -}(Ast)); -var DynamicTimingAst = (function (_super) { - __extends(DynamicTimingAst, _super); + function (ast, context) { + var _this = this; + var /** @type {?} */ timings = context.currentAnimateTimings; + var /** @type {?} */ endTime = context.currentTime; + var /** @type {?} */ startTime = context.currentTime; + if (timings && startTime > 0) { + startTime -= timings.duration + timings.delay; + } + ast.styles.forEach(function (tuple) { + if (typeof tuple == 'string') + return; + Object.keys(tuple).forEach(function (prop) { + if (!_this._driver.validateStyleProperty(prop)) { + context.errors.push("The provided animation property \"" + prop + "\" is not a supported CSS property for animations"); + return; + } + var /** @type {?} */ collectedStyles = context.collectedStyles[/** @type {?} */ ((context.currentQuerySelector))]; + var /** @type {?} */ collectedEntry = collectedStyles[prop]; + var /** @type {?} */ updateCollectedStyle = true; + if (collectedEntry) { + if (startTime != endTime && startTime >= collectedEntry.startTime && + endTime <= collectedEntry.endTime) { + context.errors.push("The CSS property \"" + prop + "\" that exists between the times of \"" + collectedEntry.startTime + "ms\" and \"" + collectedEntry.endTime + "ms\" is also being animated in a parallel animation between the times of \"" + startTime + "ms\" and \"" + endTime + "ms\""); + updateCollectedStyle = false; + } + // we always choose the smaller start time value since we + // want to have a record of the entire animation window where + // the style property is being animated in between + startTime = collectedEntry.startTime; + } + if (updateCollectedStyle) { + collectedStyles[prop] = { startTime: startTime, endTime: endTime }; + } + if (context.options) { + validateStyleParams(tuple[prop], context.options, context.errors); + } + }); + }); + }; /** - * @param {?} value + * @param {?} metadata + * @param {?} context + * @return {?} */ - function DynamicTimingAst(value) { - var _this = _super.call(this, 0, 0, '') || this; - _this.value = value; - return _this; - } - /** - * @param {?} visitor + AnimationAstBuilderVisitor.prototype.visitKeyframes = /** + * @param {?} metadata * @param {?} context * @return {?} */ - DynamicTimingAst.prototype.visit = function (visitor, context) { return visitor.visitTiming(this, context); }; - return DynamicTimingAst; -}(TimingAst)); -/** - * @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 {?} visitor - * @param {?} node - * @param {?} context - * @return {?} - */ -function visitAnimationNode(visitor, node, context) { - switch (node.type) { - case 7 /* Trigger */: - return visitor.visitTrigger(/** @type {?} */ (node), context); - case 0 /* State */: - return visitor.visitState(/** @type {?} */ (node), context); - case 1 /* Transition */: - return visitor.visitTransition(/** @type {?} */ (node), context); - case 2 /* Sequence */: - return visitor.visitSequence(/** @type {?} */ (node), context); - case 3 /* Group */: - return visitor.visitGroup(/** @type {?} */ (node), context); - case 4 /* Animate */: - return visitor.visitAnimate(/** @type {?} */ (node), context); - case 5 /* Keyframes */: - return visitor.visitKeyframes(/** @type {?} */ (node), context); - case 6 /* Style */: - return visitor.visitStyle(/** @type {?} */ (node), context); - case 8 /* Reference */: - return visitor.visitReference(/** @type {?} */ (node), context); - case 9 /* AnimateChild */: - return visitor.visitAnimateChild(/** @type {?} */ (node), context); - case 10 /* AnimateRef */: - return visitor.visitAnimateRef(/** @type {?} */ (node), context); - case 11 /* Query */: - return visitor.visitQuery(/** @type {?} */ (node), context); - case 12 /* Stagger */: - return visitor.visitStagger(/** @type {?} */ (node), context); - default: - throw new Error("Unable to resolve animation metadata node #" + node.type); - } -} -/** - * @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 ANY_STATE = '*'; -/** - * @param {?} transitionValue - * @param {?} errors - * @return {?} - */ -function parseTransitionExpr(transitionValue, errors) { - var /** @type {?} */ expressions = []; - if (typeof transitionValue == 'string') { - ((transitionValue)) - .split(/\s*,\s*/) - .forEach(function (str) { return parseInnerTransitionStr(str, expressions, errors); }); - } - else { - expressions.push(/** @type {?} */ (transitionValue)); - } - return expressions; -} -/** - * @param {?} eventStr - * @param {?} expressions - * @param {?} errors - * @return {?} - */ -function parseInnerTransitionStr(eventStr, expressions, errors) { - if (eventStr[0] == ':') { - eventStr = parseAnimationAlias(eventStr, errors); - } - var /** @type {?} */ match = eventStr.match(/^(\*|[-\w]+)\s*([=-]>)\s*(\*|[-\w]+)$/); - if (match == null || match.length < 4) { - errors.push("The provided transition expression \"" + eventStr + "\" is not supported"); - return expressions; - } - var /** @type {?} */ fromState = match[1]; - var /** @type {?} */ separator = match[2]; - var /** @type {?} */ toState = match[3]; - expressions.push(makeLambdaFromStates(fromState, toState)); - var /** @type {?} */ isFullAnyStateExpr = fromState == ANY_STATE && toState == ANY_STATE; - if (separator[0] == '<' && !isFullAnyStateExpr) { - expressions.push(makeLambdaFromStates(toState, fromState)); - } -} -/** - * @param {?} alias - * @param {?} errors - * @return {?} - */ -function parseAnimationAlias(alias, errors) { - switch (alias) { - case ':enter': - return 'void => *'; - case ':leave': - return '* => void'; - default: - errors.push("The transition alias value \"" + alias + "\" is not supported"); - return '* => *'; - } -} -/** - * @param {?} lhs - * @param {?} rhs - * @return {?} - */ -function makeLambdaFromStates(lhs, rhs) { - return function (fromState, toState) { - var /** @type {?} */ lhsMatch = lhs == ANY_STATE || lhs == fromState; - var /** @type {?} */ rhsMatch = rhs == ANY_STATE || rhs == toState; - if (!lhsMatch && typeof fromState === 'boolean') { - lhsMatch = fromState ? lhs === 'true' : lhs === 'false'; + function (metadata, context) { + var _this = this; + var /** @type {?} */ ast = { type: 5 /* Keyframes */, styles: [], options: null }; + if (!context.currentAnimateTimings) { + context.errors.push("keyframes() must be placed inside of a call to animate()"); + return ast; + } + var /** @type {?} */ MAX_KEYFRAME_OFFSET = 1; + var /** @type {?} */ totalKeyframesWithOffsets = 0; + var /** @type {?} */ offsets = []; + var /** @type {?} */ offsetsOutOfOrder = false; + var /** @type {?} */ keyframesOutOfRange = false; + var /** @type {?} */ previousOffset = 0; + var /** @type {?} */ keyframes = metadata.steps.map(function (styles) { + var /** @type {?} */ style$$1 = _this._makeStyleAst(styles, context); + var /** @type {?} */ offsetVal = style$$1.offset != null ? style$$1.offset : consumeOffset(style$$1.styles); + var /** @type {?} */ offset = 0; + if (offsetVal != null) { + totalKeyframesWithOffsets++; + offset = style$$1.offset = offsetVal; + } + keyframesOutOfRange = keyframesOutOfRange || offset < 0 || offset > 1; + offsetsOutOfOrder = offsetsOutOfOrder || offset < previousOffset; + previousOffset = offset; + offsets.push(offset); + return style$$1; + }); + if (keyframesOutOfRange) { + context.errors.push("Please ensure that all keyframe offsets are between 0 and 1"); } - if (!rhsMatch && typeof toState === 'boolean') { - rhsMatch = toState ? rhs === 'true' : rhs === 'false'; + if (offsetsOutOfOrder) { + context.errors.push("Please ensure that all keyframe offsets are in order"); } - return lhsMatch && rhsMatch; + var /** @type {?} */ length = metadata.steps.length; + var /** @type {?} */ generatedOffset = 0; + if (totalKeyframesWithOffsets > 0 && totalKeyframesWithOffsets < length) { + context.errors.push("Not all style() steps within the declared keyframes() contain offsets"); + } + else if (totalKeyframesWithOffsets == 0) { + generatedOffset = MAX_KEYFRAME_OFFSET / (length - 1); + } + var /** @type {?} */ limit = length - 1; + var /** @type {?} */ currentTime = context.currentTime; + var /** @type {?} */ currentAnimateTimings = /** @type {?} */ ((context.currentAnimateTimings)); + var /** @type {?} */ animateDuration = currentAnimateTimings.duration; + keyframes.forEach(function (kf, i) { + var /** @type {?} */ offset = generatedOffset > 0 ? (i == limit ? 1 : (generatedOffset * i)) : offsets[i]; + var /** @type {?} */ durationUpToThisFrame = offset * animateDuration; + context.currentTime = currentTime + currentAnimateTimings.delay + durationUpToThisFrame; + currentAnimateTimings.duration = durationUpToThisFrame; + _this._validateStyleAst(kf, context); + kf.offset = offset; + ast.styles.push(kf); + }); + return ast; }; -} -/** - * @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 SELF_TOKEN = ':self'; -var SELF_TOKEN_REGEX = new RegExp("s*" + SELF_TOKEN + "s*,?", 'g'); -/** - * @param {?} metadata - * @param {?} errors - * @return {?} - */ -function buildAnimationAst(metadata, errors) { - return new AnimationAstBuilderVisitor().build(metadata, errors); -} -var LEAVE_TOKEN = ':leave'; -var LEAVE_TOKEN_REGEX = new RegExp(LEAVE_TOKEN, 'g'); -var ENTER_TOKEN = ':enter'; -var ENTER_TOKEN_REGEX = new RegExp(ENTER_TOKEN, 'g'); -var ROOT_SELECTOR = ''; -var AnimationAstBuilderVisitor = (function () { - function AnimationAstBuilderVisitor() { - } /** * @param {?} metadata - * @param {?} errors + * @param {?} context * @return {?} */ - AnimationAstBuilderVisitor.prototype.build = function (metadata, errors) { - var /** @type {?} */ context = new AnimationAstBuilderContext(errors); - this._resetContextStyleTimingState(context); - return (visitAnimationNode(this, normalizeAnimationEntry(metadata), context)); - }; - /** + AnimationAstBuilderVisitor.prototype.visitReference = /** + * @param {?} metadata * @param {?} context * @return {?} */ - AnimationAstBuilderVisitor.prototype._resetContextStyleTimingState = function (context) { - context.currentQuerySelector = ROOT_SELECTOR; - context.collectedStyles = {}; - context.collectedStyles[ROOT_SELECTOR] = {}; - context.currentTime = 0; + function (metadata, context) { + return { + type: 8 /* Reference */, + animation: visitDslNode(this, normalizeAnimationEntry(metadata.animation), context), + options: normalizeAnimationOptions(metadata.options) + }; }; /** * @param {?} metadata * @param {?} context * @return {?} */ - AnimationAstBuilderVisitor.prototype.visitTrigger = function (metadata, context) { - var _this = this; - var /** @type {?} */ queryCount = context.queryCount = 0; - var /** @type {?} */ depCount = context.depCount = 0; - var /** @type {?} */ states = []; - var /** @type {?} */ transitions = []; - metadata.definitions.forEach(function (def) { - _this._resetContextStyleTimingState(context); - if (def.type == 0 /* State */) { - var /** @type {?} */ stateDef_1 = (def); - var /** @type {?} */ name = stateDef_1.name; - name.split(/\s*,\s*/).forEach(function (n) { - stateDef_1.name = n; - states.push(_this.visitState(stateDef_1, context)); - }); - stateDef_1.name = name; - } - else if (def.type == 1 /* Transition */) { - var /** @type {?} */ transition = _this.visitTransition(/** @type {?} */ (def), context); - queryCount += transition.queryCount; - depCount += transition.depCount; - transitions.push(transition); - } - else { - context.errors.push('only state() and transition() definitions can sit inside of a trigger()'); - } - }); - var /** @type {?} */ ast = new TriggerAst(metadata.name, states, transitions); - ast.options = normalizeAnimationOptions(metadata.options); - ast.queryCount = queryCount; - ast.depCount = depCount; - return ast; - }; - /** + AnimationAstBuilderVisitor.prototype.visitAnimateChild = /** * @param {?} metadata * @param {?} context * @return {?} */ - AnimationAstBuilderVisitor.prototype.visitState = function (metadata, context) { - return new StateAst(metadata.name, this.visitStyle(metadata.styles, context)); + function (metadata, context) { + context.depCount++; + return { + type: 9 /* AnimateChild */, + options: normalizeAnimationOptions(metadata.options) + }; }; /** * @param {?} metadata * @param {?} context * @return {?} */ - AnimationAstBuilderVisitor.prototype.visitTransition = function (metadata, context) { - context.queryCount = 0; - context.depCount = 0; - var /** @type {?} */ entry = visitAnimationNode(this, normalizeAnimationEntry(metadata.animation), context); - var /** @type {?} */ matchers = parseTransitionExpr(metadata.expr, context.errors); - var /** @type {?} */ ast = new TransitionAst(matchers, entry); - ast.options = normalizeAnimationOptions(metadata.options); - ast.queryCount = context.queryCount; - ast.depCount = context.depCount; - return ast; - }; - /** + AnimationAstBuilderVisitor.prototype.visitAnimateRef = /** * @param {?} metadata * @param {?} context * @return {?} */ - AnimationAstBuilderVisitor.prototype.visitSequence = function (metadata, context) { - var _this = this; - var /** @type {?} */ ast = new SequenceAst(metadata.steps.map(function (s) { return visitAnimationNode(_this, s, context); })); - ast.options = normalizeAnimationOptions(metadata.options); - return ast; + function (metadata, context) { + return { + type: 10 /* AnimateRef */, + animation: this.visitReference(metadata.animation, context), + options: normalizeAnimationOptions(metadata.options) + }; }; /** * @param {?} metadata * @param {?} context * @return {?} */ - AnimationAstBuilderVisitor.prototype.visitGroup = function (metadata, context) { - var _this = this; - var /** @type {?} */ currentTime = context.currentTime; - var /** @type {?} */ furthestTime = 0; - var /** @type {?} */ steps = metadata.steps.map(function (step) { - context.currentTime = currentTime; - var /** @type {?} */ innerAst = visitAnimationNode(_this, step, context); - furthestTime = Math.max(furthestTime, context.currentTime); - return innerAst; - }); - context.currentTime = furthestTime; - var /** @type {?} */ ast = new GroupAst(steps); - ast.options = normalizeAnimationOptions(metadata.options); - return ast; - }; - /** + AnimationAstBuilderVisitor.prototype.visitQuery = /** * @param {?} metadata * @param {?} context * @return {?} */ - AnimationAstBuilderVisitor.prototype.visitAnimate = function (metadata, context) { - var /** @type {?} */ timingAst = constructTimingAst(metadata.timings, context.errors); - context.currentAnimateTimings = timingAst; - var /** @type {?} */ styles; - var /** @type {?} */ styleMetadata = metadata.styles ? metadata.styles : _angular_animations.style({}); - if (styleMetadata.type == 5 /* Keyframes */) { - styles = this.visitKeyframes(/** @type {?} */ (styleMetadata), context); - } - else { - var /** @type {?} */ styleMetadata_1 = (metadata.styles); - var /** @type {?} */ isEmpty = false; - if (!styleMetadata_1) { - isEmpty = true; - var /** @type {?} */ newStyleData = {}; - if (timingAst.easing) { - newStyleData['easing'] = timingAst.easing; - } - styleMetadata_1 = _angular_animations.style(newStyleData); - } - context.currentTime += timingAst.duration + timingAst.delay; - var /** @type {?} */ styleAst = this.visitStyle(styleMetadata_1, context); - styleAst.isEmptyStep = isEmpty; - styles = styleAst; - } - context.currentAnimateTimings = null; - return new AnimateAst(timingAst, styles); + function (metadata, context) { + var /** @type {?} */ parentSelector = /** @type {?} */ ((context.currentQuerySelector)); + var /** @type {?} */ options = /** @type {?} */ ((metadata.options || {})); + context.queryCount++; + context.currentQuery = metadata; + var _a = normalizeSelector(metadata.selector), selector = _a[0], includeSelf = _a[1]; + context.currentQuerySelector = + parentSelector.length ? (parentSelector + ' ' + selector) : selector; + getOrSetAsInMap(context.collectedStyles, context.currentQuerySelector, {}); + var /** @type {?} */ animation = visitDslNode(this, normalizeAnimationEntry(metadata.animation), context); + context.currentQuery = null; + context.currentQuerySelector = parentSelector; + return { + type: 11 /* Query */, + selector: selector, + limit: options.limit || 0, + optional: !!options.optional, includeSelf: includeSelf, animation: animation, + originalSelector: metadata.selector, + options: normalizeAnimationOptions(metadata.options) + }; }; /** * @param {?} metadata * @param {?} context * @return {?} */ - AnimationAstBuilderVisitor.prototype.visitStyle = function (metadata, context) { - var /** @type {?} */ ast = this._makeStyleAst(metadata, context); - this._validateStyleAst(ast, context); - return ast; - }; - /** - * @param {?} metadata - * @param {?} context - * @return {?} - */ - AnimationAstBuilderVisitor.prototype._makeStyleAst = function (metadata, context) { - var /** @type {?} */ styles = []; - if (Array.isArray(metadata.styles)) { - ((metadata.styles)).forEach(function (styleTuple) { - if (typeof styleTuple == 'string') { - if (styleTuple == _angular_animations.AUTO_STYLE) { - styles.push(/** @type {?} */ (styleTuple)); - } - else { - context.errors.push("The provided style string value " + styleTuple + " is not allowed."); - } - } - else { - styles.push(/** @type {?} */ (styleTuple)); - } - }); - } - else { - styles.push(metadata.styles); - } - var /** @type {?} */ collectedEasing = null; - styles.forEach(function (styleData) { - if (isObject(styleData)) { - var /** @type {?} */ styleMap = (styleData); - var /** @type {?} */ easing = styleMap['easing']; - if (easing) { - collectedEasing = (easing); - delete styleMap['easing']; - } - } - }); - return new StyleAst(styles, collectedEasing, metadata.offset); - }; - /** - * @param {?} ast - * @param {?} context - * @return {?} - */ - AnimationAstBuilderVisitor.prototype._validateStyleAst = function (ast, context) { - var /** @type {?} */ timings = context.currentAnimateTimings; - var /** @type {?} */ endTime = context.currentTime; - var /** @type {?} */ startTime = context.currentTime; - if (timings && startTime > 0) { - startTime -= timings.duration + timings.delay; - } - ast.styles.forEach(function (tuple) { - if (typeof tuple == 'string') - return; - Object.keys(tuple).forEach(function (prop) { - var /** @type {?} */ collectedStyles = context.collectedStyles[((context.currentQuerySelector))]; - var /** @type {?} */ collectedEntry = collectedStyles[prop]; - var /** @type {?} */ updateCollectedStyle = true; - if (collectedEntry) { - if (startTime != endTime && startTime >= collectedEntry.startTime && - endTime <= collectedEntry.endTime) { - context.errors.push("The CSS property \"" + prop + "\" that exists between the times of \"" + collectedEntry.startTime + "ms\" and \"" + collectedEntry.endTime + "ms\" is also being animated in a parallel animation between the times of \"" + startTime + "ms\" and \"" + endTime + "ms\""); - updateCollectedStyle = false; - } - // we always choose the smaller start time value since we - // want to have a record of the entire animation window where - // the style property is being animated in between - startTime = collectedEntry.startTime; - } - if (updateCollectedStyle) { - collectedStyles[prop] = { startTime: startTime, endTime: endTime }; - } - if (context.options) { - validateStyleParams(tuple[prop], context.options, context.errors); - } - }); - }); - }; - /** - * @param {?} metadata - * @param {?} context - * @return {?} - */ - AnimationAstBuilderVisitor.prototype.visitKeyframes = function (metadata, context) { - var _this = this; - if (!context.currentAnimateTimings) { - context.errors.push("keyframes() must be placed inside of a call to animate()"); - return new KeyframesAst([]); - } - var /** @type {?} */ MAX_KEYFRAME_OFFSET = 1; - var /** @type {?} */ totalKeyframesWithOffsets = 0; - var /** @type {?} */ offsets = []; - var /** @type {?} */ offsetsOutOfOrder = false; - var /** @type {?} */ keyframesOutOfRange = false; - var /** @type {?} */ previousOffset = 0; - var /** @type {?} */ keyframes = metadata.steps.map(function (styles) { - var /** @type {?} */ style$$1 = _this._makeStyleAst(styles, context); - var /** @type {?} */ offsetVal = style$$1.offset != null ? style$$1.offset : consumeOffset(style$$1.styles); - var /** @type {?} */ offset = 0; - if (offsetVal != null) { - totalKeyframesWithOffsets++; - offset = style$$1.offset = offsetVal; - } - keyframesOutOfRange = keyframesOutOfRange || offset < 0 || offset > 1; - offsetsOutOfOrder = offsetsOutOfOrder || offset < previousOffset; - previousOffset = offset; - offsets.push(offset); - return style$$1; - }); - if (keyframesOutOfRange) { - context.errors.push("Please ensure that all keyframe offsets are between 0 and 1"); - } - if (offsetsOutOfOrder) { - context.errors.push("Please ensure that all keyframe offsets are in order"); - } - var /** @type {?} */ length = metadata.steps.length; - var /** @type {?} */ generatedOffset = 0; - if (totalKeyframesWithOffsets > 0 && totalKeyframesWithOffsets < length) { - context.errors.push("Not all style() steps within the declared keyframes() contain offsets"); - } - else if (totalKeyframesWithOffsets == 0) { - generatedOffset = MAX_KEYFRAME_OFFSET / (length - 1); - } - var /** @type {?} */ limit = length - 1; - var /** @type {?} */ currentTime = context.currentTime; - var /** @type {?} */ currentAnimateTimings = ((context.currentAnimateTimings)); - var /** @type {?} */ animateDuration = currentAnimateTimings.duration; - keyframes.forEach(function (kf, i) { - var /** @type {?} */ offset = generatedOffset > 0 ? (i == limit ? 1 : (generatedOffset * i)) : offsets[i]; - var /** @type {?} */ durationUpToThisFrame = offset * animateDuration; - context.currentTime = currentTime + currentAnimateTimings.delay + durationUpToThisFrame; - currentAnimateTimings.duration = durationUpToThisFrame; - _this._validateStyleAst(kf, context); - kf.offset = offset; - }); - return new KeyframesAst(keyframes); - }; - /** - * @param {?} metadata - * @param {?} context - * @return {?} - */ - AnimationAstBuilderVisitor.prototype.visitReference = function (metadata, context) { - var /** @type {?} */ entry = visitAnimationNode(this, normalizeAnimationEntry(metadata.animation), context); - var /** @type {?} */ ast = new ReferenceAst(entry); - ast.options = normalizeAnimationOptions(metadata.options); - return ast; - }; - /** - * @param {?} metadata - * @param {?} context - * @return {?} - */ - AnimationAstBuilderVisitor.prototype.visitAnimateChild = function (metadata, context) { - context.depCount++; - var /** @type {?} */ ast = new AnimateChildAst(); - ast.options = normalizeAnimationOptions(metadata.options); - return ast; - }; - /** - * @param {?} metadata - * @param {?} context - * @return {?} - */ - AnimationAstBuilderVisitor.prototype.visitAnimateRef = function (metadata, context) { - var /** @type {?} */ animation = this.visitReference(metadata.animation, context); - var /** @type {?} */ ast = new AnimateRefAst(animation); - ast.options = normalizeAnimationOptions(metadata.options); - return ast; - }; - /** - * @param {?} metadata - * @param {?} context - * @return {?} - */ - AnimationAstBuilderVisitor.prototype.visitQuery = function (metadata, context) { - var /** @type {?} */ parentSelector = ((context.currentQuerySelector)); - var /** @type {?} */ options = ((metadata.options || {})); - context.queryCount++; - context.currentQuery = metadata; - var _a = normalizeSelector(metadata.selector), selector = _a[0], includeSelf = _a[1]; - context.currentQuerySelector = - parentSelector.length ? (parentSelector + ' ' + selector) : selector; - getOrSetAsInMap(context.collectedStyles, context.currentQuerySelector, {}); - var /** @type {?} */ entry = visitAnimationNode(this, normalizeAnimationEntry(metadata.animation), context); - context.currentQuery = null; - context.currentQuerySelector = parentSelector; - var /** @type {?} */ ast = new QueryAst(selector, options.limit || 0, !!options.optional, includeSelf, entry); - ast.originalSelector = metadata.selector; - ast.options = normalizeAnimationOptions(metadata.options); - return ast; - }; - /** + AnimationAstBuilderVisitor.prototype.visitStagger = /** * @param {?} metadata * @param {?} context * @return {?} */ - AnimationAstBuilderVisitor.prototype.visitStagger = function (metadata, context) { + function (metadata, context) { if (!context.currentQuery) { context.errors.push("stagger() can only be used inside of query()"); } var /** @type {?} */ timings = metadata.timings === 'full' ? { duration: 0, delay: 0, easing: 'full' } : resolveTiming(metadata.timings, context.errors, true); - var /** @type {?} */ animation = visitAnimationNode(this, normalizeAnimationEntry(metadata.animation), context); - return new StaggerAst(timings, animation); + return { + type: 12 /* Stagger */, + animation: visitDslNode(this, normalizeAnimationEntry(metadata.animation), context), timings: timings, + options: null + }; }; return AnimationAstBuilderVisitor; }()); @@ -8151,9 +16901,6 @@ function normalizeParams(obj) { return obj ? copyObj(obj) : null; } var AnimationAstBuilderContext = (function () { - /** - * @param {?} errors - */ function AnimationAstBuilderContext(errors) { this.errors = errors; this.queryCount = 0; @@ -8179,14 +16926,14 @@ function consumeOffset(styles) { if (Array.isArray(styles)) { styles.forEach(function (styleTuple) { if (isObject(styleTuple) && styleTuple.hasOwnProperty('offset')) { - var /** @type {?} */ obj = (styleTuple); + var /** @type {?} */ obj = /** @type {?} */ (styleTuple); offset = parseFloat(/** @type {?} */ (obj['offset'])); delete obj['offset']; } }); } else if (isObject(styles) && styles.hasOwnProperty('offset')) { - var /** @type {?} */ obj = (styles); + var /** @type {?} */ obj = /** @type {?} */ (styles); offset = parseFloat(/** @type {?} */ (obj['offset'])); delete obj['offset']; } @@ -8207,19 +16954,22 @@ function isObject(value) { function constructTimingAst(value, errors) { var /** @type {?} */ timings = null; if (value.hasOwnProperty('duration')) { - timings = (value); + timings = /** @type {?} */ (value); } else if (typeof value == 'number') { var /** @type {?} */ duration = resolveTiming(/** @type {?} */ (value), errors).duration; - return new TimingAst(/** @type {?} */ (value), 0, ''); + return makeTimingAst(/** @type {?} */ (duration), 0, ''); } - var /** @type {?} */ strValue = (value); + var /** @type {?} */ strValue = /** @type {?} */ (value); var /** @type {?} */ isDynamic = strValue.split(/\s+/).some(function (v) { return v.charAt(0) == '{' && v.charAt(1) == '{'; }); if (isDynamic) { - return new DynamicTimingAst(strValue); + var /** @type {?} */ ast = /** @type {?} */ (makeTimingAst(0, 0, '')); + ast.dynamic = true; + ast.strValue = strValue; + return /** @type {?} */ (ast); } timings = timings || resolveTiming(strValue, errors); - return new TimingAst(timings.duration, timings.delay, timings.easing); + return makeTimingAst(timings.duration, timings.delay, timings.easing); } /** * @param {?} options @@ -8229,7 +16979,7 @@ function normalizeAnimationOptions(options) { if (options) { options = copyObj(options); if (options['params']) { - options['params'] = ((normalizeParams(options['params']))); + options['params'] = /** @type {?} */ ((normalizeParams(options['params']))); } } else { @@ -8238,12 +16988,23 @@ function normalizeAnimationOptions(options) { return options; } /** - * @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 {?} duration + * @param {?} delay + * @param {?} easing + * @return {?} + */ +function makeTimingAst(duration, delay, easing) { + return { duration: duration, delay: delay, easing: easing }; +} + +/** + * @fileoverview added by tsickle + * @suppress {checkTypes} checked by tsc + */ +/** + * @record */ + /** * @param {?} element * @param {?} keyframes @@ -8269,12 +17030,10 @@ function createTimelineInstruction(element, keyframes, preStyleProps, postStyleP totalTime: duration + delay, easing: easing, subTimeline: subTimeline }; } + /** - * @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 + * @fileoverview added by tsickle + * @suppress {checkTypes} checked by tsc */ var ElementInstructionMap = (function () { function ElementInstructionMap() { @@ -8284,7 +17043,11 @@ var ElementInstructionMap = (function () { * @param {?} element * @return {?} */ - ElementInstructionMap.prototype.consume = function (element) { + ElementInstructionMap.prototype.consume = /** + * @param {?} element + * @return {?} + */ + function (element) { var /** @type {?} */ instructions = this._map.get(element); if (instructions) { this._map.delete(element); @@ -8299,7 +17062,12 @@ var ElementInstructionMap = (function () { * @param {?} instructions * @return {?} */ - ElementInstructionMap.prototype.append = function (element, instructions) { + ElementInstructionMap.prototype.append = /** + * @param {?} element + * @param {?} instructions + * @return {?} + */ + function (element, instructions) { var /** @type {?} */ existingInstructions = this._map.get(element); if (!existingInstructions) { this._map.set(element, existingInstructions = []); @@ -8310,13 +17078,25 @@ var ElementInstructionMap = (function () { * @param {?} element * @return {?} */ - ElementInstructionMap.prototype.has = function (element) { return this._map.has(element); }; + ElementInstructionMap.prototype.has = /** + * @param {?} element + * @return {?} + */ + function (element) { return this._map.has(element); }; /** * @return {?} */ - ElementInstructionMap.prototype.clear = function () { this._map.clear(); }; + ElementInstructionMap.prototype.clear = /** + * @return {?} + */ + function () { this._map.clear(); }; return ElementInstructionMap; }()); + +/** + * @fileoverview added by tsickle + * @suppress {checkTypes} checked by tsc + */ /** * @license * Copyright Google Inc. All Rights Reserved. @@ -8356,13 +17136,24 @@ var AnimationTimelineBuilderVisitor = (function () { * @param {?=} errors * @return {?} */ - AnimationTimelineBuilderVisitor.prototype.buildKeyframes = function (driver, rootElement, ast, startingStyles, finalStyles, options, subInstructions, errors) { + AnimationTimelineBuilderVisitor.prototype.buildKeyframes = /** + * @param {?} driver + * @param {?} rootElement + * @param {?} ast + * @param {?} startingStyles + * @param {?} finalStyles + * @param {?} options + * @param {?=} subInstructions + * @param {?=} errors + * @return {?} + */ + function (driver, rootElement, ast, startingStyles, finalStyles, options, subInstructions, errors) { if (errors === void 0) { errors = []; } subInstructions = subInstructions || new ElementInstructionMap(); var /** @type {?} */ context = new AnimationTimelineContext(driver, rootElement, subInstructions, errors, []); context.options = options; context.currentTimeline.setStyles([startingStyles], null, context.errors, options); - ast.visit(this, context); + visitDslNode(this, ast, context); // this checks to see if an actual animation happened var /** @type {?} */ timelines = context.timelines.filter(function (timeline) { return timeline.containsAnimation(); }); if (timelines.length && Object.keys(finalStyles).length) { @@ -8379,7 +17170,12 @@ var AnimationTimelineBuilderVisitor = (function () { * @param {?} context * @return {?} */ - AnimationTimelineBuilderVisitor.prototype.visitTrigger = function (ast, context) { + AnimationTimelineBuilderVisitor.prototype.visitTrigger = /** + * @param {?} ast + * @param {?} context + * @return {?} + */ + function (ast, context) { // these values are not visited in this AST }; /** @@ -8387,7 +17183,12 @@ var AnimationTimelineBuilderVisitor = (function () { * @param {?} context * @return {?} */ - AnimationTimelineBuilderVisitor.prototype.visitState = function (ast, context) { + AnimationTimelineBuilderVisitor.prototype.visitState = /** + * @param {?} ast + * @param {?} context + * @return {?} + */ + function (ast, context) { // these values are not visited in this AST }; /** @@ -8395,7 +17196,12 @@ var AnimationTimelineBuilderVisitor = (function () { * @param {?} context * @return {?} */ - AnimationTimelineBuilderVisitor.prototype.visitTransition = function (ast, context) { + AnimationTimelineBuilderVisitor.prototype.visitTransition = /** + * @param {?} ast + * @param {?} context + * @return {?} + */ + function (ast, context) { // these values are not visited in this AST }; /** @@ -8403,7 +17209,12 @@ var AnimationTimelineBuilderVisitor = (function () { * @param {?} context * @return {?} */ - AnimationTimelineBuilderVisitor.prototype.visitAnimateChild = function (ast, context) { + AnimationTimelineBuilderVisitor.prototype.visitAnimateChild = /** + * @param {?} ast + * @param {?} context + * @return {?} + */ + function (ast, context) { var /** @type {?} */ elementInstructions = context.subInstructions.consume(context.element); if (elementInstructions) { var /** @type {?} */ innerContext = context.createSubContext(ast.options); @@ -8422,7 +17233,12 @@ var AnimationTimelineBuilderVisitor = (function () { * @param {?} context * @return {?} */ - AnimationTimelineBuilderVisitor.prototype.visitAnimateRef = function (ast, context) { + AnimationTimelineBuilderVisitor.prototype.visitAnimateRef = /** + * @param {?} ast + * @param {?} context + * @return {?} + */ + function (ast, context) { var /** @type {?} */ innerContext = context.createSubContext(ast.options); innerContext.transformIntoNewTimeline(); this.visitReference(ast.animation, innerContext); @@ -8435,7 +17251,13 @@ var AnimationTimelineBuilderVisitor = (function () { * @param {?} options * @return {?} */ - AnimationTimelineBuilderVisitor.prototype._visitSubInstructions = function (instructions, context, options) { + AnimationTimelineBuilderVisitor.prototype._visitSubInstructions = /** + * @param {?} instructions + * @param {?} context + * @param {?} options + * @return {?} + */ + function (instructions, context, options) { var /** @type {?} */ startTime = context.currentTimeline.currentTime; var /** @type {?} */ furthestTime = startTime; // this is a special-case for when a user wants to skip a sub @@ -8456,9 +17278,14 @@ var AnimationTimelineBuilderVisitor = (function () { * @param {?} context * @return {?} */ - AnimationTimelineBuilderVisitor.prototype.visitReference = function (ast, context) { + AnimationTimelineBuilderVisitor.prototype.visitReference = /** + * @param {?} ast + * @param {?} context + * @return {?} + */ + function (ast, context) { context.updateOptions(ast.options, true); - ast.animation.visit(this, context); + visitDslNode(this, ast.animation, context); context.previousNode = ast; }; /** @@ -8466,7 +17293,12 @@ var AnimationTimelineBuilderVisitor = (function () { * @param {?} context * @return {?} */ - AnimationTimelineBuilderVisitor.prototype.visitSequence = function (ast, context) { + AnimationTimelineBuilderVisitor.prototype.visitSequence = /** + * @param {?} ast + * @param {?} context + * @return {?} + */ + function (ast, context) { var _this = this; var /** @type {?} */ subContextCount = context.subContextCount; var /** @type {?} */ ctx = context; @@ -8475,7 +17307,7 @@ var AnimationTimelineBuilderVisitor = (function () { ctx = context.createSubContext(options); ctx.transformIntoNewTimeline(); if (options.delay != null) { - if (ctx.previousNode instanceof StyleAst) { + if (ctx.previousNode.type == 6 /* Style */) { ctx.currentTimeline.snapshotCurrentStyles(); ctx.previousNode = DEFAULT_NOOP_PREVIOUS_NODE; } @@ -8484,7 +17316,7 @@ var AnimationTimelineBuilderVisitor = (function () { } } if (ast.steps.length) { - ast.steps.forEach(function (s) { return s.visit(_this, ctx); }); + ast.steps.forEach(function (s) { return visitDslNode(_this, s, ctx); }); // this is here just incase the inner steps only contain or end with a style() call ctx.currentTimeline.applyStylesToKeyframe(); // this means that some animation function within the sequence @@ -8501,7 +17333,12 @@ var AnimationTimelineBuilderVisitor = (function () { * @param {?} context * @return {?} */ - AnimationTimelineBuilderVisitor.prototype.visitGroup = function (ast, context) { + AnimationTimelineBuilderVisitor.prototype.visitGroup = /** + * @param {?} ast + * @param {?} context + * @return {?} + */ + function (ast, context) { var _this = this; var /** @type {?} */ innerTimelines = []; var /** @type {?} */ furthestTime = context.currentTimeline.currentTime; @@ -8511,7 +17348,7 @@ var AnimationTimelineBuilderVisitor = (function () { if (delay) { innerContext.delayNextStep(delay); } - s.visit(_this, innerContext); + visitDslNode(_this, s, innerContext); furthestTime = Math.max(furthestTime, innerContext.currentTimeline.currentTime); innerTimelines.push(innerContext.currentTimeline); }); @@ -8527,15 +17364,19 @@ var AnimationTimelineBuilderVisitor = (function () { * @param {?} context * @return {?} */ - AnimationTimelineBuilderVisitor.prototype.visitTiming = function (ast, context) { - if (ast instanceof DynamicTimingAst) { - var /** @type {?} */ strValue = context.params ? - interpolateParams(ast.value, context.params, context.errors) : - ast.value.toString(); - return resolveTiming(strValue, context.errors); - } - else { - return { duration: ast.duration, delay: ast.delay, easing: ast.easing }; + AnimationTimelineBuilderVisitor.prototype._visitTiming = /** + * @param {?} ast + * @param {?} context + * @return {?} + */ + function (ast, context) { + if ((/** @type {?} */ (ast)).dynamic) { + var /** @type {?} */ strValue = (/** @type {?} */ (ast)).strValue; + var /** @type {?} */ timingValue = context.params ? interpolateParams(strValue, context.params, context.errors) : strValue; + return resolveTiming(timingValue, context.errors); + } + else { + return { duration: ast.duration, delay: ast.delay, easing: ast.easing }; } }; /** @@ -8543,15 +17384,20 @@ var AnimationTimelineBuilderVisitor = (function () { * @param {?} context * @return {?} */ - AnimationTimelineBuilderVisitor.prototype.visitAnimate = function (ast, context) { - var /** @type {?} */ timings = context.currentAnimateTimings = this.visitTiming(ast.timings, context); + AnimationTimelineBuilderVisitor.prototype.visitAnimate = /** + * @param {?} ast + * @param {?} context + * @return {?} + */ + function (ast, context) { + var /** @type {?} */ timings = context.currentAnimateTimings = this._visitTiming(ast.timings, context); var /** @type {?} */ timeline = context.currentTimeline; if (timings.delay) { context.incrementTime(timings.delay); timeline.snapshotCurrentStyles(); } var /** @type {?} */ style$$1 = ast.style; - if (style$$1 instanceof KeyframesAst) { + if (style$$1.type == 5 /* Keyframes */) { this.visitKeyframes(style$$1, context); } else { @@ -8567,9 +17413,14 @@ var AnimationTimelineBuilderVisitor = (function () { * @param {?} context * @return {?} */ - AnimationTimelineBuilderVisitor.prototype.visitStyle = function (ast, context) { + AnimationTimelineBuilderVisitor.prototype.visitStyle = /** + * @param {?} ast + * @param {?} context + * @return {?} + */ + function (ast, context) { var /** @type {?} */ timeline = context.currentTimeline; - var /** @type {?} */ timings = ((context.currentAnimateTimings)); + var /** @type {?} */ timings = /** @type {?} */ ((context.currentAnimateTimings)); // this is a special case for when a style() call // directly follows an animate() call (but not inside of an animate() call) if (!timings && timeline.getCurrentStyleProperties().length) { @@ -8589,9 +17440,14 @@ var AnimationTimelineBuilderVisitor = (function () { * @param {?} context * @return {?} */ - AnimationTimelineBuilderVisitor.prototype.visitKeyframes = function (ast, context) { - var /** @type {?} */ currentAnimateTimings = ((context.currentAnimateTimings)); - var /** @type {?} */ startTime = (((context.currentTimeline))).duration; + AnimationTimelineBuilderVisitor.prototype.visitKeyframes = /** + * @param {?} ast + * @param {?} context + * @return {?} + */ + function (ast, context) { + var /** @type {?} */ currentAnimateTimings = /** @type {?} */ ((context.currentAnimateTimings)); + var /** @type {?} */ startTime = (/** @type {?} */ ((context.currentTimeline))).duration; var /** @type {?} */ duration = currentAnimateTimings.duration; var /** @type {?} */ innerContext = context.createSubContext(); var /** @type {?} */ innerTimeline = innerContext.currentTimeline; @@ -8615,14 +17471,19 @@ var AnimationTimelineBuilderVisitor = (function () { * @param {?} context * @return {?} */ - AnimationTimelineBuilderVisitor.prototype.visitQuery = function (ast, context) { + AnimationTimelineBuilderVisitor.prototype.visitQuery = /** + * @param {?} ast + * @param {?} context + * @return {?} + */ + function (ast, context) { var _this = this; // in the event that the first step before this is a style step we need // to ensure the styles are applied before the children are animated var /** @type {?} */ startTime = context.currentTimeline.currentTime; - var /** @type {?} */ options = ((ast.options || {})); + var /** @type {?} */ options = /** @type {?} */ ((ast.options || {})); var /** @type {?} */ delay = options.delay ? resolveTimingValue(options.delay) : 0; - if (delay && (context.previousNode instanceof StyleAst || + if (delay && (context.previousNode.type === 6 /* Style */ || (startTime == 0 && context.currentTimeline.getCurrentStyleProperties().length))) { context.currentTimeline.snapshotCurrentStyles(); context.previousNode = DEFAULT_NOOP_PREVIOUS_NODE; @@ -8640,7 +17501,7 @@ var AnimationTimelineBuilderVisitor = (function () { if (element === context.element) { sameElementTimeline = innerContext.currentTimeline; } - ast.animation.visit(_this, innerContext); + visitDslNode(_this, ast.animation, innerContext); // this is here just incase the inner steps only contain or end // with a style() call (which is here to signal that this is a preparatory // call to style an element before it is animated again) @@ -8662,8 +17523,13 @@ var AnimationTimelineBuilderVisitor = (function () { * @param {?} context * @return {?} */ - AnimationTimelineBuilderVisitor.prototype.visitStagger = function (ast, context) { - var /** @type {?} */ parentContext = ((context.parentContext)); + AnimationTimelineBuilderVisitor.prototype.visitStagger = /** + * @param {?} ast + * @param {?} context + * @return {?} + */ + function (ast, context) { + var /** @type {?} */ parentContext = /** @type {?} */ ((context.parentContext)); var /** @type {?} */ tl = context.currentTimeline; var /** @type {?} */ timings = ast.timings; var /** @type {?} */ duration = Math.abs(timings.duration); @@ -8683,7 +17549,7 @@ var AnimationTimelineBuilderVisitor = (function () { timeline.delayNextStep(delay); } var /** @type {?} */ startingTime = timeline.currentTime; - ast.animation.visit(this, context); + visitDslNode(this, ast.animation, context); context.previousNode = ast; // time = duration + delay // the reason why this computation is so complex is because @@ -8694,16 +17560,8 @@ var AnimationTimelineBuilderVisitor = (function () { }; return AnimationTimelineBuilderVisitor; }()); -var DEFAULT_NOOP_PREVIOUS_NODE = ({}); +var DEFAULT_NOOP_PREVIOUS_NODE = /** @type {?} */ ({}); var AnimationTimelineContext = (function () { - /** - * @param {?} _driver - * @param {?} element - * @param {?} subInstructions - * @param {?} errors - * @param {?} timelines - * @param {?=} initialTimeline - */ function AnimationTimelineContext(_driver, element, subInstructions, errors, timelines, initialTimeline) { this._driver = _driver; this.element = element; @@ -8718,14 +17576,14 @@ var AnimationTimelineContext = (function () { this.currentQueryIndex = 0; this.currentQueryTotal = 0; this.currentStaggerTime = 0; - this.currentTimeline = initialTimeline || new TimelineBuilder(element, 0); + this.currentTimeline = initialTimeline || new TimelineBuilder(this._driver, element, 0); timelines.push(this.currentTimeline); } Object.defineProperty(AnimationTimelineContext.prototype, "params", { - /** + get: /** * @return {?} */ - get: function () { return this.options.params; }, + function () { return this.options.params; }, enumerable: true, configurable: true }); @@ -8734,22 +17592,27 @@ var AnimationTimelineContext = (function () { * @param {?=} skipIfExists * @return {?} */ - AnimationTimelineContext.prototype.updateOptions = function (options, skipIfExists) { + AnimationTimelineContext.prototype.updateOptions = /** + * @param {?} options + * @param {?=} skipIfExists + * @return {?} + */ + function (options, skipIfExists) { var _this = this; if (!options) return; - var /** @type {?} */ newOptions = (options); + var /** @type {?} */ newOptions = /** @type {?} */ (options); var /** @type {?} */ optionsToUpdate = this.options; // NOTE: this will get patched up when other animation methods support duration overrides if (newOptions.duration != null) { - ((optionsToUpdate)).duration = resolveTimingValue(newOptions.duration); + (/** @type {?} */ (optionsToUpdate)).duration = resolveTimingValue(newOptions.duration); } if (newOptions.delay != null) { optionsToUpdate.delay = resolveTimingValue(newOptions.delay); } var /** @type {?} */ newParams = newOptions.params; if (newParams) { - var /** @type {?} */ paramsToUpdate_1 = ((optionsToUpdate.params)); + var /** @type {?} */ paramsToUpdate_1 = /** @type {?} */ ((optionsToUpdate.params)); if (!paramsToUpdate_1) { paramsToUpdate_1 = this.options.params = {}; } @@ -8763,13 +17626,16 @@ var AnimationTimelineContext = (function () { /** * @return {?} */ - AnimationTimelineContext.prototype._copyOptions = function () { + AnimationTimelineContext.prototype._copyOptions = /** + * @return {?} + */ + function () { var /** @type {?} */ options = {}; if (this.options) { var /** @type {?} */ oldParams_1 = this.options.params; if (oldParams_1) { var /** @type {?} */ params_1 = options['params'] = {}; - Object.keys(this.options.params).forEach(function (name) { params_1[name] = oldParams_1[name]; }); + Object.keys(oldParams_1).forEach(function (name) { params_1[name] = oldParams_1[name]; }); } } return options; @@ -8780,7 +17646,13 @@ var AnimationTimelineContext = (function () { * @param {?=} newTime * @return {?} */ - AnimationTimelineContext.prototype.createSubContext = function (options, element, newTime) { + AnimationTimelineContext.prototype.createSubContext = /** + * @param {?=} options + * @param {?=} element + * @param {?=} newTime + * @return {?} + */ + function (options, element, newTime) { if (options === void 0) { options = null; } var /** @type {?} */ target = element || this.element; var /** @type {?} */ context = new AnimationTimelineContext(this._driver, target, this.subInstructions, this.errors, this.timelines, this.currentTimeline.fork(target, newTime || 0)); @@ -8798,7 +17670,11 @@ var AnimationTimelineContext = (function () { * @param {?=} newTime * @return {?} */ - AnimationTimelineContext.prototype.transformIntoNewTimeline = function (newTime) { + AnimationTimelineContext.prototype.transformIntoNewTimeline = /** + * @param {?=} newTime + * @return {?} + */ + function (newTime) { this.previousNode = DEFAULT_NOOP_PREVIOUS_NODE; this.currentTimeline = this.currentTimeline.fork(this.element, newTime); this.timelines.push(this.currentTimeline); @@ -8810,13 +17686,19 @@ var AnimationTimelineContext = (function () { * @param {?} delay * @return {?} */ - AnimationTimelineContext.prototype.appendInstructionToTimeline = function (instruction, duration, delay) { + AnimationTimelineContext.prototype.appendInstructionToTimeline = /** + * @param {?} instruction + * @param {?} duration + * @param {?} delay + * @return {?} + */ + function (instruction, duration, delay) { var /** @type {?} */ updatedTimings = { duration: duration != null ? duration : instruction.duration, delay: this.currentTimeline.currentTime + (delay != null ? delay : 0) + instruction.delay, easing: '' }; - var /** @type {?} */ builder = new SubTimelineBuilder(instruction.element, instruction.keyframes, instruction.preStyleProps, instruction.postStyleProps, updatedTimings, instruction.stretchStartingKeyframe); + var /** @type {?} */ builder = new SubTimelineBuilder(this._driver, instruction.element, instruction.keyframes, instruction.preStyleProps, instruction.postStyleProps, updatedTimings, instruction.stretchStartingKeyframe); this.timelines.push(builder); return updatedTimings; }; @@ -8824,14 +17706,22 @@ var AnimationTimelineContext = (function () { * @param {?} time * @return {?} */ - AnimationTimelineContext.prototype.incrementTime = function (time) { + AnimationTimelineContext.prototype.incrementTime = /** + * @param {?} time + * @return {?} + */ + function (time) { this.currentTimeline.forwardTime(this.currentTimeline.duration + time); }; /** * @param {?} delay * @return {?} */ - AnimationTimelineContext.prototype.delayNextStep = function (delay) { + AnimationTimelineContext.prototype.delayNextStep = /** + * @param {?} delay + * @return {?} + */ + function (delay) { // negative delays are not yet supported if (delay > 0) { this.currentTimeline.delayNextStep(delay); @@ -8846,14 +17736,29 @@ var AnimationTimelineContext = (function () { * @param {?} errors * @return {?} */ - AnimationTimelineContext.prototype.invokeQuery = function (selector, originalSelector, limit, includeSelf, optional, errors) { + AnimationTimelineContext.prototype.invokeQuery = /** + * @param {?} selector + * @param {?} originalSelector + * @param {?} limit + * @param {?} includeSelf + * @param {?} optional + * @param {?} errors + * @return {?} + */ + function (selector, originalSelector, limit, includeSelf, optional, errors) { var /** @type {?} */ results = []; if (includeSelf) { results.push(this.element); } if (selector.length > 0) { + // if :self is only used then the selector is empty var /** @type {?} */ multi = limit != 1; - results.push.apply(results, this._driver.query(this.element, selector, multi)); + var /** @type {?} */ elements = this._driver.query(this.element, selector, multi); + if (limit !== 0) { + elements = limit < 0 ? elements.slice(elements.length + limit, elements.length) : + elements.slice(0, limit); + } + results.push.apply(results, elements); } if (!optional && results.length == 0) { errors.push("`query(\"" + originalSelector + "\")` returned zero elements. (Use `query(\"" + originalSelector + "\", { optional: true })` if you wish to allow this.)"); @@ -8863,12 +17768,8 @@ var AnimationTimelineContext = (function () { return AnimationTimelineContext; }()); var TimelineBuilder = (function () { - /** - * @param {?} element - * @param {?} startTime - * @param {?=} _elementTimelineStylesLookup - */ - function TimelineBuilder(element, startTime, _elementTimelineStylesLookup) { + function TimelineBuilder(_driver, element, startTime, _elementTimelineStylesLookup) { + this._driver = _driver; this.element = element; this.startTime = startTime; this._elementTimelineStylesLookup = _elementTimelineStylesLookup; @@ -8884,7 +17785,7 @@ var TimelineBuilder = (function () { this._elementTimelineStylesLookup = new Map(); } this._localTimelineStyles = Object.create(this._backFill, {}); - this._globalTimelineStyles = this._elementTimelineStylesLookup.get(element); + this._globalTimelineStyles = /** @type {?} */ ((this._elementTimelineStylesLookup.get(element))); if (!this._globalTimelineStyles) { this._globalTimelineStyles = this._localTimelineStyles; this._elementTimelineStylesLookup.set(element, this._localTimelineStyles); @@ -8894,7 +17795,10 @@ var TimelineBuilder = (function () { /** * @return {?} */ - TimelineBuilder.prototype.containsAnimation = function () { + TimelineBuilder.prototype.containsAnimation = /** + * @return {?} + */ + function () { switch (this._keyframes.size) { case 0: return false; @@ -8907,12 +17811,15 @@ var TimelineBuilder = (function () { /** * @return {?} */ - TimelineBuilder.prototype.getCurrentStyleProperties = function () { return Object.keys(this._currentKeyframe); }; + TimelineBuilder.prototype.getCurrentStyleProperties = /** + * @return {?} + */ + function () { return Object.keys(this._currentKeyframe); }; Object.defineProperty(TimelineBuilder.prototype, "currentTime", { - /** + get: /** * @return {?} */ - get: function () { return this.startTime + this.duration; }, + function () { return this.startTime + this.duration; }, enumerable: true, configurable: true }); @@ -8920,7 +17827,11 @@ var TimelineBuilder = (function () { * @param {?} delay * @return {?} */ - TimelineBuilder.prototype.delayNextStep = function (delay) { + TimelineBuilder.prototype.delayNextStep = /** + * @param {?} delay + * @return {?} + */ + function (delay) { // in the event that a style() step is placed right before a stagger() // and that style() step is the very first style() value in the animation // then we need to make a copy of the keyframe [0, copy, 1] so that the delay @@ -8941,18 +17852,26 @@ var TimelineBuilder = (function () { * @param {?=} currentTime * @return {?} */ - TimelineBuilder.prototype.fork = function (element, currentTime) { + TimelineBuilder.prototype.fork = /** + * @param {?} element + * @param {?=} currentTime + * @return {?} + */ + function (element, currentTime) { this.applyStylesToKeyframe(); - return new TimelineBuilder(element, currentTime || this.currentTime, this._elementTimelineStylesLookup); + return new TimelineBuilder(this._driver, element, currentTime || this.currentTime, this._elementTimelineStylesLookup); }; /** * @return {?} */ - TimelineBuilder.prototype._loadKeyframe = function () { + TimelineBuilder.prototype._loadKeyframe = /** + * @return {?} + */ + function () { if (this._currentKeyframe) { this._previousKeyframe = this._currentKeyframe; } - this._currentKeyframe = ((this._keyframes.get(this.duration))); + this._currentKeyframe = /** @type {?} */ ((this._keyframes.get(this.duration))); if (!this._currentKeyframe) { this._currentKeyframe = Object.create(this._backFill, {}); this._keyframes.set(this.duration, this._currentKeyframe); @@ -8961,7 +17880,10 @@ var TimelineBuilder = (function () { /** * @return {?} */ - TimelineBuilder.prototype.forwardFrame = function () { + TimelineBuilder.prototype.forwardFrame = /** + * @return {?} + */ + function () { this.duration += ONE_FRAME_IN_MILLISECONDS; this._loadKeyframe(); }; @@ -8969,7 +17891,11 @@ var TimelineBuilder = (function () { * @param {?} time * @return {?} */ - TimelineBuilder.prototype.forwardTime = function (time) { + TimelineBuilder.prototype.forwardTime = /** + * @param {?} time + * @return {?} + */ + function (time) { this.applyStylesToKeyframe(); this.duration = time; this._loadKeyframe(); @@ -8979,7 +17905,12 @@ var TimelineBuilder = (function () { * @param {?} value * @return {?} */ - TimelineBuilder.prototype._updateStyle = function (prop, value) { + TimelineBuilder.prototype._updateStyle = /** + * @param {?} prop + * @param {?} value + * @return {?} + */ + function (prop, value) { this._localTimelineStyles[prop] = value; this._globalTimelineStyles[prop] = value; this._styleSummary[prop] = { time: this.currentTime, value: value }; @@ -8987,12 +17918,19 @@ var TimelineBuilder = (function () { /** * @return {?} */ - TimelineBuilder.prototype.allowOnlyTimelineStyles = function () { return this._currentEmptyStepKeyframe !== this._currentKeyframe; }; + TimelineBuilder.prototype.allowOnlyTimelineStyles = /** + * @return {?} + */ + function () { return this._currentEmptyStepKeyframe !== this._currentKeyframe; }; /** * @param {?} easing * @return {?} */ - TimelineBuilder.prototype.applyEmptyStep = function (easing) { + TimelineBuilder.prototype.applyEmptyStep = /** + * @param {?} easing + * @return {?} + */ + function (easing) { var _this = this; if (easing) { this._previousKeyframe['easing'] = easing; @@ -9016,7 +17954,14 @@ var TimelineBuilder = (function () { * @param {?=} options * @return {?} */ - TimelineBuilder.prototype.setStyles = function (input, easing, errors, options) { + TimelineBuilder.prototype.setStyles = /** + * @param {?} input + * @param {?} easing + * @param {?} errors + * @param {?=} options + * @return {?} + */ + function (input, easing, errors, options) { var _this = this; if (easing) { this._previousKeyframe['easing'] = easing; @@ -9037,7 +17982,10 @@ var TimelineBuilder = (function () { /** * @return {?} */ - TimelineBuilder.prototype.applyStylesToKeyframe = function () { + TimelineBuilder.prototype.applyStylesToKeyframe = /** + * @return {?} + */ + function () { var _this = this; var /** @type {?} */ styles = this._pendingStyles; var /** @type {?} */ props = Object.keys(styles); @@ -9057,7 +18005,10 @@ var TimelineBuilder = (function () { /** * @return {?} */ - TimelineBuilder.prototype.snapshotCurrentStyles = function () { + TimelineBuilder.prototype.snapshotCurrentStyles = /** + * @return {?} + */ + function () { var _this = this; Object.keys(this._localTimelineStyles).forEach(function (prop) { var /** @type {?} */ val = _this._localTimelineStyles[prop]; @@ -9068,12 +18019,15 @@ var TimelineBuilder = (function () { /** * @return {?} */ - TimelineBuilder.prototype.getFinalKeyframe = function () { return this._keyframes.get(this.duration); }; + TimelineBuilder.prototype.getFinalKeyframe = /** + * @return {?} + */ + function () { return this._keyframes.get(this.duration); }; Object.defineProperty(TimelineBuilder.prototype, "properties", { - /** + get: /** * @return {?} */ - get: function () { + function () { var /** @type {?} */ properties = []; for (var /** @type {?} */ prop in this._currentKeyframe) { properties.push(prop); @@ -9087,7 +18041,11 @@ var TimelineBuilder = (function () { * @param {?} timeline * @return {?} */ - TimelineBuilder.prototype.mergeTimelineCollectedStyles = function (timeline) { + TimelineBuilder.prototype.mergeTimelineCollectedStyles = /** + * @param {?} timeline + * @return {?} + */ + function (timeline) { var _this = this; Object.keys(timeline._styleSummary).forEach(function (prop) { var /** @type {?} */ details0 = _this._styleSummary[prop]; @@ -9100,7 +18058,10 @@ var TimelineBuilder = (function () { /** * @return {?} */ - TimelineBuilder.prototype.buildKeyframes = function () { + TimelineBuilder.prototype.buildKeyframes = /** + * @return {?} + */ + function () { var _this = this; this.applyStylesToKeyframe(); var /** @type {?} */ preStyleProps = new Set(); @@ -9139,17 +18100,9 @@ var TimelineBuilder = (function () { }()); var SubTimelineBuilder = (function (_super) { __extends(SubTimelineBuilder, _super); - /** - * @param {?} element - * @param {?} keyframes - * @param {?} preStyleProps - * @param {?} postStyleProps - * @param {?} timings - * @param {?=} _stretchStartingKeyframe - */ - function SubTimelineBuilder(element, keyframes, preStyleProps, postStyleProps, timings, _stretchStartingKeyframe) { + function SubTimelineBuilder(driver, element, keyframes, preStyleProps, postStyleProps, timings, _stretchStartingKeyframe) { if (_stretchStartingKeyframe === void 0) { _stretchStartingKeyframe = false; } - var _this = _super.call(this, element, timings.delay) || this; + var _this = _super.call(this, driver, element, timings.delay) || this; _this.element = element; _this.keyframes = keyframes; _this.preStyleProps = preStyleProps; @@ -9161,11 +18114,17 @@ var SubTimelineBuilder = (function (_super) { /** * @return {?} */ - SubTimelineBuilder.prototype.containsAnimation = function () { return this.keyframes.length > 1; }; + SubTimelineBuilder.prototype.containsAnimation = /** + * @return {?} + */ + function () { return this.keyframes.length > 1; }; /** * @return {?} */ - SubTimelineBuilder.prototype.buildKeyframes = function () { + SubTimelineBuilder.prototype.buildKeyframes = /** + * @return {?} + */ + function () { var /** @type {?} */ keyframes = this.keyframes; var _a = this.timings, delay = _a.delay, duration = _a.duration, easing = _a.easing; if (this._stretchStartingKeyframe && delay) { @@ -9180,24 +18139,24 @@ var SubTimelineBuilder = (function (_super) { oldFirstKeyframe['offset'] = roundOffset(startingGap); newKeyframes.push(oldFirstKeyframe); /* - When the keyframe is stretched then it means that the delay before the animation - starts is gone. Instead the first keyframe is placed at the start of the animation - and it is then copied to where it starts when the original delay is over. This basically - means nothing animates during that delay, but the styles are still renderered. For this - to work the original offset values that exist in the original keyframes must be "warped" - so that they can take the new keyframe + delay into account. - - delay=1000, duration=1000, keyframes = 0 .5 1 - - turns into - - delay=0, duration=2000, keyframes = 0 .33 .66 1 - */ + When the keyframe is stretched then it means that the delay before the animation + starts is gone. Instead the first keyframe is placed at the start of the animation + and it is then copied to where it starts when the original delay is over. This basically + means nothing animates during that delay, but the styles are still renderered. For this + to work the original offset values that exist in the original keyframes must be "warped" + so that they can take the new keyframe + delay into account. + + delay=1000, duration=1000, keyframes = 0 .5 1 + + turns into + + delay=0, duration=2000, keyframes = 0 .33 .66 1 + */ // offsets between 1 ... n -1 are all warped by the keyframe stretch var /** @type {?} */ limit = keyframes.length - 1; for (var /** @type {?} */ i = 1; i <= limit; i++) { var /** @type {?} */ kf = copyStyles(keyframes[i], false); - var /** @type {?} */ oldOffset = (kf['offset']); + var /** @type {?} */ oldOffset = /** @type {?} */ (kf['offset']); var /** @type {?} */ timeAtKeyframe = delay + oldOffset * duration; kf['offset'] = roundOffset(timeAtKeyframe / totalTime); newKeyframes.push(kf); @@ -9241,24 +18200,18 @@ function flattenStyles(input, allStyles) { }); return styles; } + /** - * @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 + * @fileoverview added by tsickle + * @suppress {checkTypes} checked by tsc */ var Animation = (function () { - /** - * @param {?} _driver - * @param {?} input - */ function Animation(_driver, input) { this._driver = _driver; - var errors = []; - var ast = buildAnimationAst(input, errors); + var /** @type {?} */ errors = []; + var /** @type {?} */ ast = buildAnimationAst(_driver, input, errors); if (errors.length) { - var errorMessage = "animation validation failed:\n" + errors.join("\n"); + var /** @type {?} */ errorMessage = "animation validation failed:\n" + errors.join("\n"); throw new Error(errorMessage); } this._animationAst = ast; @@ -9271,9 +18224,17 @@ var Animation = (function () { * @param {?=} subInstructions * @return {?} */ - Animation.prototype.buildTimelines = function (element, startingStyles, destinationStyles, options, subInstructions) { - var /** @type {?} */ start = Array.isArray(startingStyles) ? normalizeStyles(startingStyles) : (startingStyles); - var /** @type {?} */ dest = Array.isArray(destinationStyles) ? normalizeStyles(destinationStyles) : (destinationStyles); + Animation.prototype.buildTimelines = /** + * @param {?} element + * @param {?} startingStyles + * @param {?} destinationStyles + * @param {?} options + * @param {?=} subInstructions + * @return {?} + */ + function (element, startingStyles, destinationStyles, options, subInstructions) { + var /** @type {?} */ start = Array.isArray(startingStyles) ? normalizeStyles(startingStyles) : /** @type {?} */ (startingStyles); + var /** @type {?} */ dest = Array.isArray(destinationStyles) ? normalizeStyles(destinationStyles) : /** @type {?} */ (destinationStyles); var /** @type {?} */ errors = []; subInstructions = subInstructions || new ElementInstructionMap(); var /** @type {?} */ result = buildAnimationTimelines(this._driver, element, this._animationAst, start, dest, options, subInstructions, errors); @@ -9285,39 +18246,61 @@ var Animation = (function () { }; return Animation; }()); + /** - * @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 + * @fileoverview added by tsickle + * @suppress {checkTypes} checked by tsc */ /** - * @experimental Animation support is experimental. + * \@experimental Animation support is experimental. + * @abstract */ -/** - * @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 AnimationStyleNormalizer = (function () { +var AnimationStyleNormalizer = (function () { function AnimationStyleNormalizer() { } return AnimationStyleNormalizer; }()); /** - * @experimental Animation support is experimental. + * \@experimental Animation support is experimental. */ var NoopAnimationStyleNormalizer = (function () { function NoopAnimationStyleNormalizer() { } - NoopAnimationStyleNormalizer.prototype.normalizePropertyName = function (propertyName, errors) { return propertyName; }; - NoopAnimationStyleNormalizer.prototype.normalizeStyleValue = function (userProvidedProperty, normalizedProperty, value, errors) { - return value; + /** + * @param {?} propertyName + * @param {?} errors + * @return {?} + */ + NoopAnimationStyleNormalizer.prototype.normalizePropertyName = /** + * @param {?} propertyName + * @param {?} errors + * @return {?} + */ + function (propertyName, errors) { return propertyName; }; + /** + * @param {?} userProvidedProperty + * @param {?} normalizedProperty + * @param {?} value + * @param {?} errors + * @return {?} + */ + NoopAnimationStyleNormalizer.prototype.normalizeStyleValue = /** + * @param {?} userProvidedProperty + * @param {?} normalizedProperty + * @param {?} value + * @param {?} errors + * @return {?} + */ + function (userProvidedProperty, normalizedProperty, value, errors) { + return /** @type {?} */ (value); }; return NoopAnimationStyleNormalizer; }()); + +/** + * @fileoverview added by tsickle + * @suppress {checkTypes} checked by tsc + */ /** * @license * Copyright Google Inc. All Rights Reserved. @@ -9335,7 +18318,12 @@ var WebAnimationsStyleNormalizer = (function (_super) { * @param {?} errors * @return {?} */ - WebAnimationsStyleNormalizer.prototype.normalizePropertyName = function (propertyName, errors) { + WebAnimationsStyleNormalizer.prototype.normalizePropertyName = /** + * @param {?} propertyName + * @param {?} errors + * @return {?} + */ + function (propertyName, errors) { return dashCaseToCamelCase(propertyName); }; /** @@ -9345,7 +18333,14 @@ var WebAnimationsStyleNormalizer = (function (_super) { * @param {?} errors * @return {?} */ - WebAnimationsStyleNormalizer.prototype.normalizeStyleValue = function (userProvidedProperty, normalizedProperty, value, errors) { + WebAnimationsStyleNormalizer.prototype.normalizeStyleValue = /** + * @param {?} userProvidedProperty + * @param {?} normalizedProperty + * @param {?} value + * @param {?} errors + * @return {?} + */ + function (userProvidedProperty, normalizedProperty, value, errors) { var /** @type {?} */ unit = ''; var /** @type {?} */ strVal = value.toString().trim(); if (DIMENSIONAL_PROP_MAP[normalizedProperty] && value !== 0 && value !== '0') { @@ -9374,13 +18369,15 @@ function makeBooleanMap(keys) { keys.forEach(function (key) { return map[key] = true; }); return map; } + /** - * @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 + * @fileoverview added by tsickle + * @suppress {checkTypes} checked by tsc + */ +/** + * @record */ + /** * @param {?} element * @param {?} triggerName @@ -9393,9 +18390,10 @@ function makeBooleanMap(keys) { * @param {?} queriedElements * @param {?} preStyleProps * @param {?} postStyleProps + * @param {?=} errors * @return {?} */ -function createTransitionInstruction(element, triggerName, fromState, toState, isRemovalTransition, fromStyles, toStyles, timelines, queriedElements, preStyleProps, postStyleProps) { +function createTransitionInstruction(element, triggerName, fromState, toState, isRemovalTransition, fromStyles, toStyles, timelines, queriedElements, preStyleProps, postStyleProps, errors) { return { type: 0 /* TransitionAnimation */, element: element, @@ -9408,22 +18406,17 @@ function createTransitionInstruction(element, triggerName, fromState, toState, i timelines: timelines, queriedElements: queriedElements, preStyleProps: preStyleProps, - postStyleProps: postStyleProps + postStyleProps: postStyleProps, + errors: errors }; } + /** - * @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 + * @fileoverview added by tsickle + * @suppress {checkTypes} checked by tsc */ +var EMPTY_OBJECT = {}; var AnimationTransitionFactory = (function () { - /** - * @param {?} _triggerName - * @param {?} ast - * @param {?} _stateStyles - */ function AnimationTransitionFactory(_triggerName, ast, _stateStyles) { this._triggerName = _triggerName; this.ast = ast; @@ -9434,32 +18427,68 @@ var AnimationTransitionFactory = (function () { * @param {?} nextState * @return {?} */ - AnimationTransitionFactory.prototype.match = function (currentState, nextState) { + AnimationTransitionFactory.prototype.match = /** + * @param {?} currentState + * @param {?} nextState + * @return {?} + */ + function (currentState, nextState) { return oneOrMoreTransitionsMatch(this.ast.matchers, currentState, nextState); }; + /** + * @param {?} stateName + * @param {?} params + * @param {?} errors + * @return {?} + */ + AnimationTransitionFactory.prototype.buildStyles = /** + * @param {?} stateName + * @param {?} params + * @param {?} errors + * @return {?} + */ + function (stateName, params, errors) { + var /** @type {?} */ backupStateStyler = this._stateStyles['*']; + var /** @type {?} */ stateStyler = this._stateStyles[stateName]; + var /** @type {?} */ backupStyles = backupStateStyler ? backupStateStyler.buildStyles(params, errors) : {}; + return stateStyler ? stateStyler.buildStyles(params, errors) : backupStyles; + }; /** * @param {?} driver * @param {?} element * @param {?} currentState * @param {?} nextState - * @param {?=} options + * @param {?=} currentOptions + * @param {?=} nextOptions + * @param {?=} subInstructions + * @return {?} + */ + AnimationTransitionFactory.prototype.build = /** + * @param {?} driver + * @param {?} element + * @param {?} currentState + * @param {?} nextState + * @param {?=} currentOptions + * @param {?=} nextOptions * @param {?=} subInstructions * @return {?} */ - AnimationTransitionFactory.prototype.build = function (driver, element, currentState, nextState, options, subInstructions) { - var /** @type {?} */ animationOptions = mergeAnimationOptions(this.ast.options || {}, options || {}); - var /** @type {?} */ backupStateStyles = this._stateStyles['*'] || {}; - var /** @type {?} */ currentStateStyles = this._stateStyles[currentState] || backupStateStyles; - var /** @type {?} */ nextStateStyles = this._stateStyles[nextState] || backupStateStyles; + function (driver, element, currentState, nextState, currentOptions, nextOptions, subInstructions) { var /** @type {?} */ errors = []; + var /** @type {?} */ transitionAnimationParams = this.ast.options && this.ast.options.params || EMPTY_OBJECT; + var /** @type {?} */ currentAnimationParams = currentOptions && currentOptions.params || EMPTY_OBJECT; + var /** @type {?} */ currentStateStyles = this.buildStyles(currentState, currentAnimationParams, errors); + var /** @type {?} */ nextAnimationParams = nextOptions && nextOptions.params || EMPTY_OBJECT; + var /** @type {?} */ nextStateStyles = this.buildStyles(nextState, nextAnimationParams, errors); + var /** @type {?} */ queriedElements = new Set(); + var /** @type {?} */ preStyleMap = new Map(); + var /** @type {?} */ postStyleMap = new Map(); + var /** @type {?} */ isRemoval = nextState === 'void'; + var /** @type {?} */ animationOptions = { params: __assign({}, transitionAnimationParams, nextAnimationParams) }; var /** @type {?} */ timelines = buildAnimationTimelines(driver, element, this.ast.animation, currentStateStyles, nextStateStyles, animationOptions, subInstructions, errors); if (errors.length) { - var /** @type {?} */ errorMessage = "animation building failed:\n" + errors.join("\n"); - throw new Error(errorMessage); + return createTransitionInstruction(element, this._triggerName, currentState, nextState, isRemoval, currentStateStyles, nextStateStyles, [], [], preStyleMap, postStyleMap, errors); } - var /** @type {?} */ preStyleMap = new Map(); - var /** @type {?} */ postStyleMap = new Map(); - var /** @type {?} */ queriedElements = new Set(); timelines.forEach(function (tl) { var /** @type {?} */ elm = tl.element; var /** @type {?} */ preProps = getOrSetAsInMap(preStyleMap, elm, {}); @@ -9471,7 +18500,7 @@ var AnimationTransitionFactory = (function () { } }); var /** @type {?} */ queriedElementsList = iteratorToArray(queriedElements.values()); - return createTransitionInstruction(element, this._triggerName, currentState, nextState, nextState === 'void', currentStateStyles, nextStateStyles, timelines, queriedElementsList, preStyleMap, postStyleMap); + return createTransitionInstruction(element, this._triggerName, currentState, nextState, isRemoval, currentStateStyles, nextStateStyles, timelines, queriedElementsList, preStyleMap, postStyleMap); }; return AnimationTransitionFactory; }()); @@ -9484,30 +18513,64 @@ var AnimationTransitionFactory = (function () { function oneOrMoreTransitionsMatch(matchFns, currentState, nextState) { return matchFns.some(function (fn) { return fn(currentState, nextState); }); } -/** - * @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 - */ -/** - * \@experimental Animation support is experimental. - * @param {?} name - * @param {?} ast - * @return {?} - */ -function buildTrigger(name, ast) { - return new AnimationTrigger(name, ast); +var AnimationStateStyles = (function () { + function AnimationStateStyles(styles, defaultParams) { + this.styles = styles; + this.defaultParams = defaultParams; + } + /** + * @param {?} params + * @param {?} errors + * @return {?} + */ + AnimationStateStyles.prototype.buildStyles = /** + * @param {?} params + * @param {?} errors + * @return {?} + */ + function (params, errors) { + var /** @type {?} */ finalStyles = {}; + var /** @type {?} */ combinedParams = copyObj(this.defaultParams); + Object.keys(params).forEach(function (key) { + var /** @type {?} */ value = params[key]; + if (value != null) { + combinedParams[key] = value; + } + }); + this.styles.styles.forEach(function (value) { + if (typeof value !== 'string') { + var /** @type {?} */ styleObj_1 = /** @type {?} */ (value); + Object.keys(styleObj_1).forEach(function (prop) { + var /** @type {?} */ val = styleObj_1[prop]; + if (val.length > 1) { + val = interpolateParams(val, combinedParams, errors); + } + finalStyles[prop] = val; + }); + } + }); + return finalStyles; + }; + return AnimationStateStyles; +}()); + +/** + * @fileoverview added by tsickle + * @suppress {checkTypes} checked by tsc + */ +/** + * \@experimental Animation support is experimental. + * @param {?} name + * @param {?} ast + * @return {?} + */ +function buildTrigger(name, ast) { + return new AnimationTrigger(name, ast); } /** * \@experimental Animation support is experimental. */ var AnimationTrigger = (function () { - /** - * @param {?} name - * @param {?} ast - */ function AnimationTrigger(name, ast) { var _this = this; this.name = name; @@ -9515,12 +18578,8 @@ var AnimationTrigger = (function () { this.transitionFactories = []; this.states = {}; ast.states.forEach(function (ast) { - var obj = _this.states[ast.name] = {}; - ast.style.styles.forEach(function (styleTuple) { - if (typeof styleTuple == 'object') { - copyStyles(styleTuple, false, obj); - } - }); + var /** @type {?} */ defaultParams = (ast.options && ast.options.params) || {}; + _this.states[ast.name] = new AnimationStateStyles(ast.style, defaultParams); }); balanceProperties(this.states, 'true', '1'); balanceProperties(this.states, 'false', '0'); @@ -9530,10 +18589,10 @@ var AnimationTrigger = (function () { this.fallbackTransition = createFallbackTransition(name, this.states); } Object.defineProperty(AnimationTrigger.prototype, "containsQueries", { - /** + get: /** * @return {?} */ - get: function () { return this.ast.queryCount > 0; }, + function () { return this.ast.queryCount > 0; }, enumerable: true, configurable: true }); @@ -9542,10 +18601,30 @@ var AnimationTrigger = (function () { * @param {?} nextState * @return {?} */ - AnimationTrigger.prototype.matchTransition = function (currentState, nextState) { + AnimationTrigger.prototype.matchTransition = /** + * @param {?} currentState + * @param {?} nextState + * @return {?} + */ + function (currentState, nextState) { var /** @type {?} */ entry = this.transitionFactories.find(function (f) { return f.match(currentState, nextState); }); return entry || null; }; + /** + * @param {?} currentState + * @param {?} params + * @param {?} errors + * @return {?} + */ + AnimationTrigger.prototype.matchStyles = /** + * @param {?} currentState + * @param {?} params + * @param {?} errors + * @return {?} + */ + function (currentState, params, errors) { + return this.fallbackTransition.buildStyles(currentState, params, errors); + }; return AnimationTrigger; }()); /** @@ -9555,8 +18634,15 @@ var AnimationTrigger = (function () { */ function createFallbackTransition(triggerName, states) { var /** @type {?} */ matchers = [function (fromState, toState) { return true; }]; - var /** @type {?} */ animation = new SequenceAst([]); - var /** @type {?} */ transition = new TransitionAst(matchers, animation); + var /** @type {?} */ animation = { type: 2 /* Sequence */, steps: [], options: null }; + var /** @type {?} */ transition = { + type: 1 /* Transition */, + animation: animation, + matchers: matchers, + options: null, + queryCount: 0, + depCount: 0 + }; return new AnimationTransitionFactory(triggerName, transition, states); } /** @@ -9575,6 +18661,11 @@ function balanceProperties(obj, key1, key2) { obj[key1] = obj[key2]; } } + +/** + * @fileoverview added by tsickle + * @suppress {checkTypes} checked by tsc + */ /** * @license * Copyright Google Inc. All Rights Reserved. @@ -9584,10 +18675,6 @@ function balanceProperties(obj, key1, key2) { */ var EMPTY_INSTRUCTION_MAP = new ElementInstructionMap(); var TimelineAnimationEngine = (function () { - /** - * @param {?} _driver - * @param {?} _normalizer - */ function TimelineAnimationEngine(_driver, _normalizer) { this._driver = _driver; this._normalizer = _normalizer; @@ -9600,9 +18687,14 @@ var TimelineAnimationEngine = (function () { * @param {?} metadata * @return {?} */ - TimelineAnimationEngine.prototype.register = function (id, metadata) { + TimelineAnimationEngine.prototype.register = /** + * @param {?} id + * @param {?} metadata + * @return {?} + */ + function (id, metadata) { var /** @type {?} */ errors = []; - var /** @type {?} */ ast = buildAnimationAst(metadata, errors); + var /** @type {?} */ ast = buildAnimationAst(this._driver, metadata, errors); if (errors.length) { throw new Error("Unable to build the animation due to the following errors: " + errors.join("\n")); } @@ -9616,7 +18708,13 @@ var TimelineAnimationEngine = (function () { * @param {?=} postStyles * @return {?} */ - TimelineAnimationEngine.prototype._buildPlayer = function (i, preStyles, postStyles) { + TimelineAnimationEngine.prototype._buildPlayer = /** + * @param {?} i + * @param {?} preStyles + * @param {?=} postStyles + * @return {?} + */ + function (i, preStyles, postStyles) { var /** @type {?} */ element = i.element; var /** @type {?} */ keyframes = normalizeKeyframes(this._driver, this._normalizer, element, i.keyframes, preStyles, postStyles); return this._driver.animate(element, keyframes, i.duration, i.delay, i.easing, []); @@ -9627,7 +18725,13 @@ var TimelineAnimationEngine = (function () { * @param {?=} options * @return {?} */ - TimelineAnimationEngine.prototype.create = function (id, element, options) { + TimelineAnimationEngine.prototype.create = /** + * @param {?} id + * @param {?} element + * @param {?=} options + * @return {?} + */ + function (id, element, options) { var _this = this; if (options === void 0) { options = {}; } var /** @type {?} */ errors = []; @@ -9665,7 +18769,11 @@ var TimelineAnimationEngine = (function () { * @param {?} id * @return {?} */ - TimelineAnimationEngine.prototype.destroy = function (id) { + TimelineAnimationEngine.prototype.destroy = /** + * @param {?} id + * @return {?} + */ + function (id) { var /** @type {?} */ player = this._getPlayer(id); player.destroy(); delete this._playersById[id]; @@ -9678,7 +18786,11 @@ var TimelineAnimationEngine = (function () { * @param {?} id * @return {?} */ - TimelineAnimationEngine.prototype._getPlayer = function (id) { + TimelineAnimationEngine.prototype._getPlayer = /** + * @param {?} id + * @return {?} + */ + function (id) { var /** @type {?} */ player = this._playersById[id]; if (!player) { throw new Error("Unable to find the timeline player referenced by " + id); @@ -9692,7 +18804,14 @@ var TimelineAnimationEngine = (function () { * @param {?} callback * @return {?} */ - TimelineAnimationEngine.prototype.listen = function (id, element, eventName, callback) { + TimelineAnimationEngine.prototype.listen = /** + * @param {?} id + * @param {?} element + * @param {?} eventName + * @param {?} callback + * @return {?} + */ + function (id, element, eventName, callback) { // triggerName, fromState, toState are all ignored for timeline animations var /** @type {?} */ baseEvent = makeAnimationEvent(element, '', '', ''); listenOnPlayer(this._getPlayer(id), eventName, baseEvent, callback); @@ -9705,13 +18824,20 @@ var TimelineAnimationEngine = (function () { * @param {?} args * @return {?} */ - TimelineAnimationEngine.prototype.command = function (id, element, command, args) { + TimelineAnimationEngine.prototype.command = /** + * @param {?} id + * @param {?} element + * @param {?} command + * @param {?} args + * @return {?} + */ + function (id, element, command, args) { if (command == 'register') { this.register(id, /** @type {?} */ (args[0])); return; } if (command == 'create') { - var /** @type {?} */ options = ((args[0] || {})); + var /** @type {?} */ options = /** @type {?} */ ((args[0] || {})); this.create(id, element, options); return; } @@ -9745,6 +18871,11 @@ var TimelineAnimationEngine = (function () { }; return TimelineAnimationEngine; }()); + +/** + * @fileoverview added by tsickle + * @suppress {checkTypes} checked by tsc + */ /** * @license * Copyright Google Inc. All Rights Reserved. @@ -9752,6 +18883,10 @@ var TimelineAnimationEngine = (function () { * 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 QUEUED_CLASSNAME = 'ng-animate-queued'; +var QUEUED_SELECTOR = '.ng-animate-queued'; +var DISABLED_CLASSNAME = 'ng-animate-disabled'; +var DISABLED_SELECTOR = '.ng-animate-disabled'; var EMPTY_PLAYER_ARRAY = []; var NULL_REMOVAL_STATE = { namespaceId: '', @@ -9765,19 +18900,26 @@ var NULL_REMOVED_QUERIED_STATE = { hasAnimation: false, removedBeforeQueried: true }; +/** + * @record + */ + var REMOVAL_FLAG = '__ng_removed'; +/** + * @record + */ + var StateValue = (function () { - /** - * @param {?} input - */ - function StateValue(input) { - var isObj = input && input.hasOwnProperty('value'); - var value = isObj ? input['value'] : input; + function StateValue(input, namespaceId) { + if (namespaceId === void 0) { namespaceId = ''; } + this.namespaceId = namespaceId; + var /** @type {?} */ isObj = input && input.hasOwnProperty('value'); + var /** @type {?} */ value = isObj ? input['value'] : input; this.value = normalizeTriggerValue(value); if (isObj) { - var options = copyObj(input); + var /** @type {?} */ options = copyObj(/** @type {?} */ (input)); delete options['value']; - this.options = options; + this.options = /** @type {?} */ (options); } else { this.options = {}; @@ -9786,17 +18928,29 @@ var StateValue = (function () { this.options.params = {}; } } + Object.defineProperty(StateValue.prototype, "params", { + get: /** + * @return {?} + */ + function () { return /** @type {?} */ (this.options.params); }, + enumerable: true, + configurable: true + }); /** * @param {?} options * @return {?} */ - StateValue.prototype.absorbOptions = function (options) { + StateValue.prototype.absorbOptions = /** + * @param {?} options + * @return {?} + */ + function (options) { var /** @type {?} */ newParams = options.params; if (newParams) { - var /** @type {?} */ oldParams_2 = ((this.options.params)); + var /** @type {?} */ oldParams_1 = /** @type {?} */ ((this.options.params)); Object.keys(newParams).forEach(function (prop) { - if (oldParams_2[prop] == null) { - oldParams_2[prop] = newParams[prop]; + if (oldParams_1[prop] == null) { + oldParams_1[prop] = newParams[prop]; } }); } @@ -9807,11 +18961,6 @@ var VOID_VALUE = 'void'; var DEFAULT_STATE_VALUE = new StateValue(VOID_VALUE); var DELETED_STATE_VALUE = new StateValue('DELETED'); var AnimationTransitionNamespace = (function () { - /** - * @param {?} id - * @param {?} hostElement - * @param {?} _engine - */ function AnimationTransitionNamespace(id, hostElement, _engine) { this.id = id; this.hostElement = hostElement; @@ -9830,7 +18979,14 @@ var AnimationTransitionNamespace = (function () { * @param {?} callback * @return {?} */ - AnimationTransitionNamespace.prototype.listen = function (element, name, phase, callback) { + AnimationTransitionNamespace.prototype.listen = /** + * @param {?} element + * @param {?} name + * @param {?} phase + * @param {?} callback + * @return {?} + */ + function (element, name, phase, callback) { var _this = this; if (!this._triggers.hasOwnProperty(name)) { throw new Error("Unable to listen on the animation trigger event \"" + phase + "\" because the animation trigger \"" + name + "\" doesn't exist!"); @@ -9848,9 +19004,12 @@ var AnimationTransitionNamespace = (function () { if (!triggersWithStates.hasOwnProperty(name)) { addClass(element, NG_TRIGGER_CLASSNAME); addClass(element, NG_TRIGGER_CLASSNAME + '-' + name); - triggersWithStates[name] = null; + triggersWithStates[name] = DEFAULT_STATE_VALUE; } return function () { + // the event listener is removed AFTER the flush has occurred such + // that leave animations callbacks can fire (otherwise if the node + // is removed in between then the listeners would be deregistered) // the event listener is removed AFTER the flush has occurred such // that leave animations callbacks can fire (otherwise if the node // is removed in between then the listeners would be deregistered) @@ -9870,7 +19029,12 @@ var AnimationTransitionNamespace = (function () { * @param {?} ast * @return {?} */ - AnimationTransitionNamespace.prototype.register = function (name, ast) { + AnimationTransitionNamespace.prototype.register = /** + * @param {?} name + * @param {?} ast + * @return {?} + */ + function (name, ast) { if (this._triggers[name]) { // throw return false; @@ -9884,7 +19048,11 @@ var AnimationTransitionNamespace = (function () { * @param {?} name * @return {?} */ - AnimationTransitionNamespace.prototype._getTrigger = function (name) { + AnimationTransitionNamespace.prototype._getTrigger = /** + * @param {?} name + * @return {?} + */ + function (name) { var /** @type {?} */ trigger = this._triggers[name]; if (!trigger) { throw new Error("The provided animation trigger \"" + name + "\" has not been registered!"); @@ -9898,7 +19066,14 @@ var AnimationTransitionNamespace = (function () { * @param {?=} defaultToFallback * @return {?} */ - AnimationTransitionNamespace.prototype.trigger = function (element, triggerName, value, defaultToFallback) { + AnimationTransitionNamespace.prototype.trigger = /** + * @param {?} element + * @param {?} triggerName + * @param {?} value + * @param {?=} defaultToFallback + * @return {?} + */ + function (element, triggerName, value, defaultToFallback) { var _this = this; if (defaultToFallback === void 0) { defaultToFallback = true; } var /** @type {?} */ trigger = this._getTrigger(triggerName); @@ -9910,7 +19085,7 @@ var AnimationTransitionNamespace = (function () { this._engine.statesByElement.set(element, triggersWithStates = {}); } var /** @type {?} */ fromState = triggersWithStates[triggerName]; - var /** @type {?} */ toState = new StateValue(value); + var /** @type {?} */ toState = new StateValue(value, this.id); var /** @type {?} */ isObj = value && value.hasOwnProperty('value'); if (!isObj && fromState) { toState.absorbOptions(fromState.options); @@ -9922,6 +19097,32 @@ var AnimationTransitionNamespace = (function () { else if (fromState === DELETED_STATE_VALUE) { return player; } + var /** @type {?} */ isRemoval = toState.value === VOID_VALUE; + // normally this isn't reached by here, however, if an object expression + // is passed in then it may be a new object each time. Comparing the value + // is important since that will stay the same despite there being a new object. + // The removal arc here is special cased because the same element is triggered + // twice in the event that it contains animations on the outer/inner portions + // of the host container + if (!isRemoval && fromState.value === toState.value) { + // this means that despite the value not changing, some inner params + // have changed which means that the animation final styles need to be applied + if (!objEquals(fromState.params, toState.params)) { + var /** @type {?} */ errors = []; + var /** @type {?} */ fromStyles_1 = trigger.matchStyles(fromState.value, fromState.params, errors); + var /** @type {?} */ toStyles_1 = trigger.matchStyles(toState.value, toState.params, errors); + if (errors.length) { + this._engine.reportError(errors); + } + else { + this._engine.afterFlush(function () { + eraseStyles(element, fromStyles_1); + setStyles(element, toStyles_1); + }); + } + } + return; + } var /** @type {?} */ playersOnElement = getOrSetAsInMap(this._engine.playersByElement, element, []); playersOnElement.forEach(function (player) { // only remove the player if it is queued on the EXACT same trigger/namespace @@ -9943,10 +19144,10 @@ var AnimationTransitionNamespace = (function () { this._engine.totalQueuedPlayers++; this._queue.push({ element: element, triggerName: triggerName, transition: transition, fromState: fromState, toState: toState, player: player, isFallbackTransition: isFallbackTransition }); if (!isFallbackTransition) { - addClass(element, NG_ANIMATING_CLASSNAME); + addClass(element, QUEUED_CLASSNAME); + player.onStart(function () { removeClass(element, QUEUED_CLASSNAME); }); } player.onDone(function () { - removeClass(element, NG_ANIMATING_CLASSNAME); var /** @type {?} */ index = _this.players.indexOf(player); if (index >= 0) { _this.players.splice(index, 1); @@ -9967,7 +19168,11 @@ var AnimationTransitionNamespace = (function () { * @param {?} name * @return {?} */ - AnimationTransitionNamespace.prototype.deregister = function (name) { + AnimationTransitionNamespace.prototype.deregister = /** + * @param {?} name + * @return {?} + */ + function (name) { var _this = this; delete this._triggers[name]; this._engine.statesByElement.forEach(function (stateMap, element) { delete stateMap[name]; }); @@ -9979,7 +19184,11 @@ var AnimationTransitionNamespace = (function () { * @param {?} element * @return {?} */ - AnimationTransitionNamespace.prototype.clearElementCache = function (element) { + AnimationTransitionNamespace.prototype.clearElementCache = /** + * @param {?} element + * @return {?} + */ + function (element) { this._engine.statesByElement.delete(element); this._elementListeners.delete(element); var /** @type {?} */ elementPlayers = this._engine.playersByElement.get(element); @@ -9994,17 +19203,22 @@ var AnimationTransitionNamespace = (function () { * @param {?=} animate * @return {?} */ - AnimationTransitionNamespace.prototype._destroyInnerNodes = function (rootElement, context, animate) { + AnimationTransitionNamespace.prototype._signalRemovalForInnerTriggers = /** + * @param {?} rootElement + * @param {?} context + * @param {?=} animate + * @return {?} + */ + function (rootElement, context, animate) { var _this = this; if (animate === void 0) { animate = false; } + // emulate a leave animation for all inner nodes within this node. + // If there are no animations found for any of the nodes then clear the cache + // for the element. this._engine.driver.query(rootElement, NG_TRIGGER_SELECTOR, true).forEach(function (elm) { - if (animate && containsClass(elm, _this._hostClassName)) { - var /** @type {?} */ innerNs = _this._engine.namespacesByHostElement.get(elm); - // special case for a host element with animations on the same element - if (innerNs) { - innerNs.removeNode(elm, context, true); - } - _this.removeNode(elm, context, true); + var /** @type {?} */ namespaces = _this._engine.fetchNamespacesByElement(elm); + if (namespaces.size) { + namespaces.forEach(function (ns) { ns.triggerLeaveAnimation(elm, context, false, true); }); } else { _this.clearElementCache(elm); @@ -10014,61 +19228,52 @@ var AnimationTransitionNamespace = (function () { /** * @param {?} element * @param {?} context - * @param {?=} doNotRecurse + * @param {?=} destroyAfterComplete + * @param {?=} defaultToFallback + * @return {?} + */ + AnimationTransitionNamespace.prototype.triggerLeaveAnimation = /** + * @param {?} element + * @param {?} context + * @param {?=} destroyAfterComplete + * @param {?=} defaultToFallback * @return {?} */ - AnimationTransitionNamespace.prototype.removeNode = function (element, context, doNotRecurse) { + function (element, context, destroyAfterComplete, defaultToFallback) { var _this = this; - var /** @type {?} */ engine = this._engine; - if (!doNotRecurse && element.childElementCount) { - this._destroyInnerNodes(element, context, true); - } - var /** @type {?} */ triggerStates = engine.statesByElement.get(element); + var /** @type {?} */ triggerStates = this._engine.statesByElement.get(element); if (triggerStates) { var /** @type {?} */ players_1 = []; Object.keys(triggerStates).forEach(function (triggerName) { // this check is here in the event that an element is removed // twice (both on the host level and the component level) if (_this._triggers[triggerName]) { - var /** @type {?} */ player = _this.trigger(element, triggerName, VOID_VALUE, false); + var /** @type {?} */ player = _this.trigger(element, triggerName, VOID_VALUE, defaultToFallback); if (player) { players_1.push(player); } } }); if (players_1.length) { - engine.markElementAsRemoved(this.id, element, true, context); - optimizeGroupPlayer(players_1).onDone(function () { return engine.processLeaveNode(element); }); - return; - } - } - // find the player that is animating and make sure that the - // removal is delayed until that player has completed - var /** @type {?} */ containsPotentialParentTransition = false; - if (engine.totalAnimations) { - var /** @type {?} */ currentPlayers = engine.players.length ? engine.playersByQueriedElement.get(element) : []; - // when this `if statement` does not continue forward it means that - // a previous animation query has selected the current element and - // is animating it. In this situation want to continue fowards and - // allow the element to be queued up for animation later. - if (currentPlayers && currentPlayers.length) { - containsPotentialParentTransition = true; - } - else { - var /** @type {?} */ parent = element; - while (parent = parent.parentNode) { - var /** @type {?} */ triggers = engine.statesByElement.get(parent); - if (triggers) { - containsPotentialParentTransition = true; - break; - } + this._engine.markElementAsRemoved(this.id, element, true, context); + if (destroyAfterComplete) { + optimizeGroupPlayer(players_1).onDone(function () { return _this._engine.processLeaveNode(element); }); } + return true; } } - // at this stage we know that the element will either get removed - // during flush or will be picked up by a parent query. Either way - // we need to fire the listeners for this element when it DOES get - // removed (once the query parent animation is done or after flush) + return false; + }; + /** + * @param {?} element + * @return {?} + */ + AnimationTransitionNamespace.prototype.prepareLeaveAnimationListeners = /** + * @param {?} element + * @return {?} + */ + function (element) { + var _this = this; var /** @type {?} */ listeners = this._elementListeners.get(element); if (listeners) { var /** @type {?} */ visitedTriggers_1 = new Set(); @@ -10079,7 +19284,7 @@ var AnimationTransitionNamespace = (function () { visitedTriggers_1.add(triggerName); var /** @type {?} */ trigger = _this._triggers[triggerName]; var /** @type {?} */ transition = trigger.fallbackTransition; - var /** @type {?} */ elementStates = ((engine.statesByElement.get(element))); + var /** @type {?} */ elementStates = /** @type {?} */ ((_this._engine.statesByElement.get(element))); var /** @type {?} */ fromState = elementStates[triggerName] || DEFAULT_STATE_VALUE; var /** @type {?} */ toState = new StateValue(VOID_VALUE); var /** @type {?} */ player = new TransitionAnimationPlayer(_this.id, triggerName, element); @@ -10095,6 +19300,54 @@ var AnimationTransitionNamespace = (function () { }); }); } + }; + /** + * @param {?} element + * @param {?} context + * @return {?} + */ + AnimationTransitionNamespace.prototype.removeNode = /** + * @param {?} element + * @param {?} context + * @return {?} + */ + function (element, context) { + var _this = this; + var /** @type {?} */ engine = this._engine; + if (element.childElementCount) { + this._signalRemovalForInnerTriggers(element, context, true); + } + // this means that a * => VOID animation was detected and kicked off + if (this.triggerLeaveAnimation(element, context, true)) + return; + // find the player that is animating and make sure that the + // removal is delayed until that player has completed + var /** @type {?} */ containsPotentialParentTransition = false; + if (engine.totalAnimations) { + var /** @type {?} */ currentPlayers = engine.players.length ? engine.playersByQueriedElement.get(element) : []; + // when this `if statement` does not continue forward it means that + // a previous animation query has selected the current element and + // is animating it. In this situation want to continue fowards and + // allow the element to be queued up for animation later. + if (currentPlayers && currentPlayers.length) { + containsPotentialParentTransition = true; + } + else { + var /** @type {?} */ parent_1 = element; + while (parent_1 = parent_1.parentNode) { + var /** @type {?} */ triggers = engine.statesByElement.get(parent_1); + if (triggers) { + containsPotentialParentTransition = true; + break; + } + } + } + } + // at this stage we know that the element will either get removed + // during flush or will be picked up by a parent query. Either way + // we need to fire the listeners for this element when it DOES get + // removed (once the query parent animation is done or after flush) + this.prepareLeaveAnimationListeners(element); // whether or not a parent has an animation we need to delay the deferral of the leave // operation until we have more information (which we do after flush() has been called) if (containsPotentialParentTransition) { @@ -10113,12 +19366,21 @@ var AnimationTransitionNamespace = (function () { * @param {?} parent * @return {?} */ - AnimationTransitionNamespace.prototype.insertNode = function (element, parent) { addClass(element, this._hostClassName); }; + AnimationTransitionNamespace.prototype.insertNode = /** + * @param {?} element + * @param {?} parent + * @return {?} + */ + function (element, parent) { addClass(element, this._hostClassName); }; /** * @param {?} microtaskId * @return {?} */ - AnimationTransitionNamespace.prototype.drainQueuedTransitions = function (microtaskId) { + AnimationTransitionNamespace.prototype.drainQueuedTransitions = /** + * @param {?} microtaskId + * @return {?} + */ + function (microtaskId) { var _this = this; var /** @type {?} */ instructions = []; this._queue.forEach(function (entry) { @@ -10131,7 +19393,7 @@ var AnimationTransitionNamespace = (function () { listeners.forEach(function (listener) { if (listener.name == entry.triggerName) { var /** @type {?} */ baseEvent = makeAnimationEvent(element, entry.triggerName, entry.fromState.value, entry.toState.value); - ((baseEvent))['_data'] = microtaskId; + (/** @type {?} */ (baseEvent))['_data'] = microtaskId; listenOnPlayer(entry.player, listener.phase, baseEvent, listener.callback); } }); @@ -10163,15 +19425,23 @@ var AnimationTransitionNamespace = (function () { * @param {?} context * @return {?} */ - AnimationTransitionNamespace.prototype.destroy = function (context) { + AnimationTransitionNamespace.prototype.destroy = /** + * @param {?} context + * @return {?} + */ + function (context) { this.players.forEach(function (p) { return p.destroy(); }); - this._destroyInnerNodes(this.hostElement, context); + this._signalRemovalForInnerTriggers(this.hostElement, context); }; /** * @param {?} element * @return {?} */ - AnimationTransitionNamespace.prototype.elementContainsData = function (element) { + AnimationTransitionNamespace.prototype.elementContainsData = /** + * @param {?} element + * @return {?} + */ + function (element) { var /** @type {?} */ containsData = false; if (this._elementListeners.has(element)) containsData = true; @@ -10181,11 +19451,11 @@ var AnimationTransitionNamespace = (function () { }; return AnimationTransitionNamespace; }()); +/** + * @record + */ + var TransitionAnimationEngine = (function () { - /** - * @param {?} driver - * @param {?} _normalizer - */ function TransitionAnimationEngine(driver, _normalizer) { this.driver = driver; this._normalizer = _normalizer; @@ -10194,6 +19464,7 @@ var TransitionAnimationEngine = (function () { this.playersByElement = new Map(); this.playersByQueriedElement = new Map(); this.statesByElement = new Map(); + this.disabledNodes = new Set(); this.totalAnimations = 0; this.totalQueuedPlayers = 0; this._namespaceLookup = {}; @@ -10205,17 +19476,25 @@ var TransitionAnimationEngine = (function () { this.collectedLeaveElements = []; this.onRemovalComplete = function (element, context) { }; } + /** @internal */ /** + * \@internal * @param {?} element * @param {?} context * @return {?} */ - TransitionAnimationEngine.prototype._onRemovalComplete = function (element, context) { this.onRemovalComplete(element, context); }; - Object.defineProperty(TransitionAnimationEngine.prototype, "queuedPlayers", { - /** - * @return {?} + TransitionAnimationEngine.prototype._onRemovalComplete = /** + * \@internal + * @param {?} element + * @param {?} context + * @return {?} + */ + function (element, context) { this.onRemovalComplete(element, context); }; + Object.defineProperty(TransitionAnimationEngine.prototype, "queuedPlayers", { + get: /** + * @return {?} */ - get: function () { + function () { var /** @type {?} */ players = []; this._namespaceList.forEach(function (ns) { ns.players.forEach(function (player) { @@ -10234,7 +19513,12 @@ var TransitionAnimationEngine = (function () { * @param {?} hostElement * @return {?} */ - TransitionAnimationEngine.prototype.createNamespace = function (namespaceId, hostElement) { + TransitionAnimationEngine.prototype.createNamespace = /** + * @param {?} namespaceId + * @param {?} hostElement + * @return {?} + */ + function (namespaceId, hostElement) { var /** @type {?} */ ns = new AnimationTransitionNamespace(namespaceId, hostElement, this); if (hostElement.parentNode) { this._balanceNamespaceList(ns, hostElement); @@ -10258,7 +19542,12 @@ var TransitionAnimationEngine = (function () { * @param {?} hostElement * @return {?} */ - TransitionAnimationEngine.prototype._balanceNamespaceList = function (ns, hostElement) { + TransitionAnimationEngine.prototype._balanceNamespaceList = /** + * @param {?} ns + * @param {?} hostElement + * @return {?} + */ + function (ns, hostElement) { var /** @type {?} */ limit = this._namespaceList.length - 1; if (limit >= 0) { var /** @type {?} */ found = false; @@ -10285,7 +19574,12 @@ var TransitionAnimationEngine = (function () { * @param {?} hostElement * @return {?} */ - TransitionAnimationEngine.prototype.register = function (namespaceId, hostElement) { + TransitionAnimationEngine.prototype.register = /** + * @param {?} namespaceId + * @param {?} hostElement + * @return {?} + */ + function (namespaceId, hostElement) { var /** @type {?} */ ns = this._namespaceLookup[namespaceId]; if (!ns) { ns = this.createNamespace(namespaceId, hostElement); @@ -10298,7 +19592,13 @@ var TransitionAnimationEngine = (function () { * @param {?} trigger * @return {?} */ - TransitionAnimationEngine.prototype.registerTrigger = function (namespaceId, name, trigger) { + TransitionAnimationEngine.prototype.registerTrigger = /** + * @param {?} namespaceId + * @param {?} name + * @param {?} trigger + * @return {?} + */ + function (namespaceId, name, trigger) { var /** @type {?} */ ns = this._namespaceLookup[namespaceId]; if (ns && ns.register(name, trigger)) { this.totalAnimations++; @@ -10309,7 +19609,12 @@ var TransitionAnimationEngine = (function () { * @param {?} context * @return {?} */ - TransitionAnimationEngine.prototype.destroy = function (namespaceId, context) { + TransitionAnimationEngine.prototype.destroy = /** + * @param {?} namespaceId + * @param {?} context + * @return {?} + */ + function (namespaceId, context) { var _this = this; if (!namespaceId) return; @@ -10328,7 +19633,41 @@ var TransitionAnimationEngine = (function () { * @param {?} id * @return {?} */ - TransitionAnimationEngine.prototype._fetchNamespace = function (id) { return this._namespaceLookup[id]; }; + TransitionAnimationEngine.prototype._fetchNamespace = /** + * @param {?} id + * @return {?} + */ + function (id) { return this._namespaceLookup[id]; }; + /** + * @param {?} element + * @return {?} + */ + TransitionAnimationEngine.prototype.fetchNamespacesByElement = /** + * @param {?} element + * @return {?} + */ + function (element) { + // normally there should only be one namespace per element, however + // if @triggers are placed on both the component element and then + // its host element (within the component code) then there will be + // two namespaces returned. We use a set here to simply the dedupe + // of namespaces incase there are multiple triggers both the elm and host + var /** @type {?} */ namespaces = new Set(); + var /** @type {?} */ elementStates = this.statesByElement.get(element); + if (elementStates) { + var /** @type {?} */ keys = Object.keys(elementStates); + for (var /** @type {?} */ i = 0; i < keys.length; i++) { + var /** @type {?} */ nsId = elementStates[keys[i]].namespaceId; + if (nsId) { + var /** @type {?} */ ns = this._fetchNamespace(nsId); + if (ns) { + namespaces.add(ns); + } + } + } + } + return namespaces; + }; /** * @param {?} namespaceId * @param {?} element @@ -10336,7 +19675,14 @@ var TransitionAnimationEngine = (function () { * @param {?} value * @return {?} */ - TransitionAnimationEngine.prototype.trigger = function (namespaceId, element, name, value) { + TransitionAnimationEngine.prototype.trigger = /** + * @param {?} namespaceId + * @param {?} element + * @param {?} name + * @param {?} value + * @return {?} + */ + function (namespaceId, element, name, value) { if (isElementNode(element)) { this._fetchNamespace(namespaceId).trigger(element, name, value); return true; @@ -10350,12 +19696,19 @@ var TransitionAnimationEngine = (function () { * @param {?} insertBefore * @return {?} */ - TransitionAnimationEngine.prototype.insertNode = function (namespaceId, element, parent, insertBefore) { + TransitionAnimationEngine.prototype.insertNode = /** + * @param {?} namespaceId + * @param {?} element + * @param {?} parent + * @param {?} insertBefore + * @return {?} + */ + function (namespaceId, element, parent, insertBefore) { if (!isElementNode(element)) return; // special case for when an element is removed and reinserted (move operation) // when this occurs we do not want to use the element for deletion later - var /** @type {?} */ details = (element[REMOVAL_FLAG]); + var /** @type {?} */ details = /** @type {?} */ (element[REMOVAL_FLAG]); if (details && details.setForRemoval) { details.setForRemoval = false; } @@ -10374,22 +19727,53 @@ var TransitionAnimationEngine = (function () { * @param {?} element * @return {?} */ - TransitionAnimationEngine.prototype.collectEnterElement = function (element) { this.collectedEnterElements.push(element); }; + TransitionAnimationEngine.prototype.collectEnterElement = /** + * @param {?} element + * @return {?} + */ + function (element) { this.collectedEnterElements.push(element); }; + /** + * @param {?} element + * @param {?} value + * @return {?} + */ + TransitionAnimationEngine.prototype.markElementAsDisabled = /** + * @param {?} element + * @param {?} value + * @return {?} + */ + function (element, value) { + if (value) { + if (!this.disabledNodes.has(element)) { + this.disabledNodes.add(element); + addClass(element, DISABLED_CLASSNAME); + } + } + else if (this.disabledNodes.has(element)) { + this.disabledNodes.delete(element); + removeClass(element, DISABLED_CLASSNAME); + } + }; /** * @param {?} namespaceId * @param {?} element * @param {?} context - * @param {?=} doNotRecurse * @return {?} */ - TransitionAnimationEngine.prototype.removeNode = function (namespaceId, element, context, doNotRecurse) { + TransitionAnimationEngine.prototype.removeNode = /** + * @param {?} namespaceId + * @param {?} element + * @param {?} context + * @return {?} + */ + function (namespaceId, element, context) { if (!isElementNode(element)) { this._onRemovalComplete(element, context); return; } var /** @type {?} */ ns = namespaceId ? this._fetchNamespace(namespaceId) : null; if (ns) { - ns.removeNode(element, context, doNotRecurse); + ns.removeNode(element, context); } else { this.markElementAsRemoved(namespaceId, element, false, context); @@ -10402,7 +19786,14 @@ var TransitionAnimationEngine = (function () { * @param {?=} context * @return {?} */ - TransitionAnimationEngine.prototype.markElementAsRemoved = function (namespaceId, element, hasAnimation, context) { + TransitionAnimationEngine.prototype.markElementAsRemoved = /** + * @param {?} namespaceId + * @param {?} element + * @param {?=} hasAnimation + * @param {?=} context + * @return {?} + */ + function (namespaceId, element, hasAnimation, context) { this.collectedLeaveElements.push(element); element[REMOVAL_FLAG] = { namespaceId: namespaceId, @@ -10418,7 +19809,15 @@ var TransitionAnimationEngine = (function () { * @param {?} callback * @return {?} */ - TransitionAnimationEngine.prototype.listen = function (namespaceId, element, name, phase, callback) { + TransitionAnimationEngine.prototype.listen = /** + * @param {?} namespaceId + * @param {?} element + * @param {?} name + * @param {?} phase + * @param {?} callback + * @return {?} + */ + function (namespaceId, element, name, phase, callback) { if (isElementNode(element)) { return this._fetchNamespace(namespaceId).listen(element, name, phase, callback); } @@ -10429,52 +19828,80 @@ var TransitionAnimationEngine = (function () { * @param {?} subTimelines * @return {?} */ - TransitionAnimationEngine.prototype._buildInstruction = function (entry, subTimelines) { - return entry.transition.build(this.driver, entry.element, entry.fromState.value, entry.toState.value, entry.toState.options, subTimelines); + TransitionAnimationEngine.prototype._buildInstruction = /** + * @param {?} entry + * @param {?} subTimelines + * @return {?} + */ + function (entry, subTimelines) { + return entry.transition.build(this.driver, entry.element, entry.fromState.value, entry.toState.value, entry.fromState.options, entry.toState.options, subTimelines); }; /** * @param {?} containerElement * @return {?} */ - TransitionAnimationEngine.prototype.destroyInnerAnimations = function (containerElement) { + TransitionAnimationEngine.prototype.destroyInnerAnimations = /** + * @param {?} containerElement + * @return {?} + */ + function (containerElement) { var _this = this; var /** @type {?} */ elements = this.driver.query(containerElement, NG_TRIGGER_SELECTOR, true); - elements.forEach(function (element) { - var /** @type {?} */ players = _this.playersByElement.get(element); - if (players) { - players.forEach(function (player) { - // special case for when an element is set for destruction, but hasn't started. - // in this situation we want to delay the destruction until the flush occurs - // so that any event listeners attached to the player are triggered. - if (player.queued) { - player.markedForDestroy = true; - } - else { - player.destroy(); - } - }); - } - var /** @type {?} */ stateMap = _this.statesByElement.get(element); - if (stateMap) { - Object.keys(stateMap).forEach(function (triggerName) { return stateMap[triggerName] = DELETED_STATE_VALUE; }); - } - }); + elements.forEach(function (element) { return _this.destroyActiveAnimationsForElement(element); }); if (this.playersByQueriedElement.size == 0) return; elements = this.driver.query(containerElement, NG_ANIMATING_SELECTOR, true); - if (elements.length) { - elements.forEach(function (element) { - var /** @type {?} */ players = _this.playersByQueriedElement.get(element); - if (players) { - players.forEach(function (player) { return player.finish(); }); + elements.forEach(function (element) { return _this.finishActiveQueriedAnimationOnElement(element); }); + }; + /** + * @param {?} element + * @return {?} + */ + TransitionAnimationEngine.prototype.destroyActiveAnimationsForElement = /** + * @param {?} element + * @return {?} + */ + function (element) { + var /** @type {?} */ players = this.playersByElement.get(element); + if (players) { + players.forEach(function (player) { + // special case for when an element is set for destruction, but hasn't started. + // in this situation we want to delay the destruction until the flush occurs + // so that any event listeners attached to the player are triggered. + if (player.queued) { + player.markedForDestroy = true; + } + else { + player.destroy(); } }); } + var /** @type {?} */ stateMap = this.statesByElement.get(element); + if (stateMap) { + Object.keys(stateMap).forEach(function (triggerName) { return stateMap[triggerName] = DELETED_STATE_VALUE; }); + } + }; + /** + * @param {?} element + * @return {?} + */ + TransitionAnimationEngine.prototype.finishActiveQueriedAnimationOnElement = /** + * @param {?} element + * @return {?} + */ + function (element) { + var /** @type {?} */ players = this.playersByQueriedElement.get(element); + if (players) { + players.forEach(function (player) { return player.finish(); }); + } }; /** * @return {?} */ - TransitionAnimationEngine.prototype.whenRenderingDone = function () { + TransitionAnimationEngine.prototype.whenRenderingDone = /** + * @return {?} + */ + function () { var _this = this; return new Promise(function (resolve) { if (_this.players.length) { @@ -10489,8 +19916,13 @@ var TransitionAnimationEngine = (function () { * @param {?} element * @return {?} */ - TransitionAnimationEngine.prototype.processLeaveNode = function (element) { - var /** @type {?} */ details = (element[REMOVAL_FLAG]); + TransitionAnimationEngine.prototype.processLeaveNode = /** + * @param {?} element + * @return {?} + */ + function (element) { + var _this = this; + var /** @type {?} */ details = /** @type {?} */ (element[REMOVAL_FLAG]); if (details && details.setForRemoval) { // this will prevent it from removing it twice element[REMOVAL_FLAG] = NULL_REMOVAL_STATE; @@ -10503,12 +19935,22 @@ var TransitionAnimationEngine = (function () { } this._onRemovalComplete(element, details.setForRemoval); } + if (this.driver.matchesElement(element, DISABLED_SELECTOR)) { + this.markElementAsDisabled(element, false); + } + this.driver.query(element, DISABLED_SELECTOR, true).forEach(function (node) { + _this.markElementAsDisabled(element, false); + }); }; /** * @param {?=} microtaskId * @return {?} */ - TransitionAnimationEngine.prototype.flush = function (microtaskId) { + TransitionAnimationEngine.prototype.flush = /** + * @param {?=} microtaskId + * @return {?} + */ + function (microtaskId) { var _this = this; if (microtaskId === void 0) { microtaskId = -1; } var /** @type {?} */ players = []; @@ -10518,7 +19960,15 @@ var TransitionAnimationEngine = (function () { } if (this._namespaceList.length && (this.totalQueuedPlayers || this.collectedLeaveElements.length)) { - players = this._flushAnimations(microtaskId); + var /** @type {?} */ cleanupFns = []; + try { + players = this._flushAnimations(cleanupFns, microtaskId); + } + finally { + for (var /** @type {?} */ i = 0; i < cleanupFns.length; i++) { + cleanupFns[i](); + } + } } else { for (var /** @type {?} */ i = 0; i < this.collectedLeaveElements.length; i++) { @@ -10546,10 +19996,27 @@ var TransitionAnimationEngine = (function () { } }; /** + * @param {?} errors + * @return {?} + */ + TransitionAnimationEngine.prototype.reportError = /** + * @param {?} errors + * @return {?} + */ + function (errors) { + throw new Error("Unable to process animations due to the following failed trigger transitions\n " + errors.join('\n')); + }; + /** + * @param {?} cleanupFns + * @param {?} microtaskId + * @return {?} + */ + TransitionAnimationEngine.prototype._flushAnimations = /** + * @param {?} cleanupFns * @param {?} microtaskId * @return {?} */ - TransitionAnimationEngine.prototype._flushAnimations = function (microtaskId) { + function (cleanupFns, microtaskId) { var _this = this; var /** @type {?} */ subTimelines = new ElementInstructionMap(); var /** @type {?} */ skippedPlayers = []; @@ -10558,6 +20025,14 @@ var TransitionAnimationEngine = (function () { var /** @type {?} */ queriedElements = new Map(); var /** @type {?} */ allPreStyleElements = new Map(); var /** @type {?} */ allPostStyleElements = new Map(); + var /** @type {?} */ disabledElementsSet = new Set(); + this.disabledNodes.forEach(function (node) { + disabledElementsSet.add(node); + var /** @type {?} */ nodesThatAreDisabled = _this.driver.query(node, QUEUED_SELECTOR, true); + for (var /** @type {?} */ i = 0; i < nodesThatAreDisabled.length; i++) { + disabledElementsSet.add(nodesThatAreDisabled[i]); + } + }); var /** @type {?} */ bodyNode = getBodyNode(); var /** @type {?} */ allEnterNodes = this.collectedEnterElements.length ? this.collectedEnterElements.filter(createIsRootFilterFn(this.collectedEnterElements)) : @@ -10569,30 +20044,42 @@ var TransitionAnimationEngine = (function () { addClass(allEnterNodes[i], ENTER_CLASSNAME); } var /** @type {?} */ allLeaveNodes = []; - var /** @type {?} */ leaveNodesWithoutAnimations = []; + var /** @type {?} */ leaveNodesWithoutAnimations = new Set(); for (var /** @type {?} */ i = 0; i < this.collectedLeaveElements.length; i++) { var /** @type {?} */ element = this.collectedLeaveElements[i]; - var /** @type {?} */ details = (element[REMOVAL_FLAG]); + var /** @type {?} */ details = /** @type {?} */ (element[REMOVAL_FLAG]); if (details && details.setForRemoval) { addClass(element, LEAVE_CLASSNAME); allLeaveNodes.push(element); if (!details.hasAnimation) { - leaveNodesWithoutAnimations.push(element); + leaveNodesWithoutAnimations.add(element); } } } + cleanupFns.push(function () { + allEnterNodes.forEach(function (element) { return removeClass(element, ENTER_CLASSNAME); }); + allLeaveNodes.forEach(function (element) { + removeClass(element, LEAVE_CLASSNAME); + _this.processLeaveNode(element); + }); + }); + var /** @type {?} */ allPlayers = []; + var /** @type {?} */ erroneousTransitions = []; for (var /** @type {?} */ i = this._namespaceList.length - 1; i >= 0; i--) { var /** @type {?} */ ns = this._namespaceList[i]; ns.drainQueuedTransitions(microtaskId).forEach(function (entry) { var /** @type {?} */ player = entry.player; + allPlayers.push(player); var /** @type {?} */ element = entry.element; if (!bodyNode || !_this.driver.containsElement(bodyNode, element)) { player.destroy(); return; } - var /** @type {?} */ instruction = _this._buildInstruction(entry, subTimelines); - if (!instruction) + var /** @type {?} */ instruction = /** @type {?} */ ((_this._buildInstruction(entry, subTimelines))); + if (instruction.errors && instruction.errors.length) { + erroneousTransitions.push(instruction); return; + } // if a unmatched transition is queued to go then it SHOULD NOT render // an animation and cancel the previously running animations. if (entry.isFallbackTransition) { @@ -10614,7 +20101,7 @@ var TransitionAnimationEngine = (function () { instruction.preStyleProps.forEach(function (stringMap, element) { var /** @type {?} */ props = Object.keys(stringMap); if (props.length) { - var /** @type {?} */ setVal_1 = ((allPreStyleElements.get(element))); + var /** @type {?} */ setVal_1 = /** @type {?} */ ((allPreStyleElements.get(element))); if (!setVal_1) { allPreStyleElements.set(element, setVal_1 = new Set()); } @@ -10623,7 +20110,7 @@ var TransitionAnimationEngine = (function () { }); instruction.postStyleProps.forEach(function (stringMap, element) { var /** @type {?} */ props = Object.keys(stringMap); - var /** @type {?} */ setVal = ((allPostStyleElements.get(element))); + var /** @type {?} */ setVal = /** @type {?} */ ((allPostStyleElements.get(element))); if (!setVal) { allPostStyleElements.set(element, setVal = new Set()); } @@ -10631,13 +20118,24 @@ var TransitionAnimationEngine = (function () { }); }); } + if (erroneousTransitions.length) { + var /** @type {?} */ errors_1 = []; + erroneousTransitions.forEach(function (instruction) { + errors_1.push("@" + instruction.triggerName + " has failed due to:\n"); /** @type {?} */ + ((instruction.errors)).forEach(function (error) { return errors_1.push("- " + error + "\n"); }); + }); + allPlayers.forEach(function (player) { return player.destroy(); }); + this.reportError(errors_1); + } // these can only be detected here since we have a map of all the elements - // that have animations attached to them... - var /** @type {?} */ enterNodesWithoutAnimations = []; + // that have animations attached to them... We use a set here in the event + // multiple enter captures on the same element were caught in different + // renderer namespaces (e.g. when a @trigger was on a host binding that had *ngIf) + var /** @type {?} */ enterNodesWithoutAnimations = new Set(); for (var /** @type {?} */ i = 0; i < allEnterNodes.length; i++) { var /** @type {?} */ element = allEnterNodes[i]; if (!subTimelines.has(element)) { - enterNodesWithoutAnimations.push(element); + enterNodesWithoutAnimations.add(element); } } var /** @type {?} */ allPreviousPlayersMap = new Map(); @@ -10652,15 +20150,37 @@ var TransitionAnimationEngine = (function () { skippedPlayers.forEach(function (player) { var /** @type {?} */ element = player.element; var /** @type {?} */ previousPlayers = _this._getPreviousPlayers(element, false, player.namespaceId, player.triggerName, null); - previousPlayers.forEach(function (prevPlayer) { getOrSetAsInMap(allPreviousPlayersMap, element, []).push(prevPlayer); }); + previousPlayers.forEach(function (prevPlayer) { + getOrSetAsInMap(allPreviousPlayersMap, element, []).push(prevPlayer); + prevPlayer.destroy(); + }); + }); + // this is a special case for nodes that will be removed (either by) + // having their own leave animations or by being queried in a container + // that will be removed once a parent animation is complete. The idea + // here is that * styles must be identical to ! styles because of + // backwards compatibility (* is also filled in by default in many places). + // Otherwise * styles will return an empty value or auto since the element + // that is being getComputedStyle'd will not be visible (since * = destination) + var /** @type {?} */ replaceNodes = allLeaveNodes.filter(function (node) { + return replacePostStylesAsPre(node, allPreStyleElements, allPostStyleElements); + }); + // POST STAGE: fill the * styles + var _a = cloakAndComputeStyles(this.driver, leaveNodesWithoutAnimations, allPostStyleElements, _angular_animations.AUTO_STYLE), postStylesMap = _a[0], allLeaveQueriedNodes = _a[1]; + allLeaveQueriedNodes.forEach(function (node) { + if (replacePostStylesAsPre(node, allPreStyleElements, allPostStyleElements)) { + replaceNodes.push(node); + } }); - allPreviousPlayersMap.forEach(function (players) { return players.forEach(function (player) { return player.destroy(); }); }); // PRE STAGE: fill the ! styles - var /** @type {?} */ preStylesMap = allPreStyleElements.size ? + var preStylesMap = (allPreStyleElements.size ? cloakAndComputeStyles(this.driver, enterNodesWithoutAnimations, allPreStyleElements, _angular_animations.ɵPRE_STYLE) : - new Map(); - // POST STAGE: fill the * styles - var /** @type {?} */ postStylesMap = cloakAndComputeStyles(this.driver, leaveNodesWithoutAnimations, allPostStyleElements, _angular_animations.AUTO_STYLE); + [new Map()])[0]; + replaceNodes.forEach(function (node) { + var /** @type {?} */ post = postStylesMap.get(node); + var /** @type {?} */ pre = preStylesMap.get(node); + postStylesMap.set(node, /** @type {?} */ (__assign({}, post, pre))); + }); var /** @type {?} */ rootPlayers = []; var /** @type {?} */ subPlayers = []; queuedInstructions.forEach(function (entry) { @@ -10668,15 +20188,19 @@ var TransitionAnimationEngine = (function () { // this means that it was never consumed by a parent animation which // means that it is independent and therefore should be set for animation if (subTimelines.has(element)) { + if (disabledElementsSet.has(element)) { + skippedPlayers.push(player); + return; + } var /** @type {?} */ innerPlayer = _this._buildAnimation(player.namespaceId, instruction, allPreviousPlayersMap, skippedPlayersMap, preStylesMap, postStylesMap); player.setRealPlayer(innerPlayer); var /** @type {?} */ parentHasPriority = null; for (var /** @type {?} */ i = 0; i < sortedParentElements.length; i++) { - var /** @type {?} */ parent = sortedParentElements[i]; - if (parent === element) + var /** @type {?} */ parent_2 = sortedParentElements[i]; + if (parent_2 === element) break; - if (_this.driver.containsElement(parent, element)) { - parentHasPriority = parent; + if (_this.driver.containsElement(parent_2, element)) { + parentHasPriority = parent_2; break; } } @@ -10694,10 +20218,19 @@ var TransitionAnimationEngine = (function () { else { eraseStyles(element, instruction.fromStyles); player.onDestroy(function () { return setStyles(element, instruction.toStyles); }); + // there still might be a ancestor player animating this + // element therefore we will still add it as a sub player + // even if its animation may be disabled subPlayers.push(player); + if (disabledElementsSet.has(element)) { + skippedPlayers.push(player); + } } }); + // find all of the sub players' corresponding inner animation player subPlayers.forEach(function (player) { + // even if any players are not found for a sub animation then it + // will still complete itself after the next tick since it's Noop var /** @type {?} */ playersForElement = skippedPlayersMap.get(player.element); if (playersForElement && playersForElement.length) { var /** @type {?} */ innerPlayer = optimizeGroupPlayer(playersForElement); @@ -10720,7 +20253,8 @@ var TransitionAnimationEngine = (function () { // operation right away unless a parent animation is ongoing. for (var /** @type {?} */ i = 0; i < allLeaveNodes.length; i++) { var /** @type {?} */ element = allLeaveNodes[i]; - var /** @type {?} */ details = (element[REMOVAL_FLAG]); + var /** @type {?} */ details = /** @type {?} */ (element[REMOVAL_FLAG]); + removeClass(element, LEAVE_CLASSNAME); // this means the element has a removal animation that is being // taken care of and therefore the inner elements will hang around // until that animation is over (or the parent queried animation) @@ -10743,13 +20277,16 @@ var TransitionAnimationEngine = (function () { } } } - if (players.length) { - removeNodesAfterAnimationDone(this, element, players); + var /** @type {?} */ activePlayers = players.filter(function (p) { return !p.destroyed; }); + if (activePlayers.length) { + removeNodesAfterAnimationDone(this, element, activePlayers); } else { this.processLeaveNode(element); } } + // this is required so the cleanup method doesn't remove them + allLeaveNodes.length = 0; rootPlayers.forEach(function (player) { _this.players.push(player); player.onDone(function () { @@ -10759,7 +20296,6 @@ var TransitionAnimationEngine = (function () { }); player.play(); }); - allEnterNodes.forEach(function (element) { return removeClass(element, ENTER_CLASSNAME); }); return rootPlayers; }; /** @@ -10767,9 +20303,14 @@ var TransitionAnimationEngine = (function () { * @param {?} element * @return {?} */ - TransitionAnimationEngine.prototype.elementContainsData = function (namespaceId, element) { + TransitionAnimationEngine.prototype.elementContainsData = /** + * @param {?} namespaceId + * @param {?} element + * @return {?} + */ + function (namespaceId, element) { var /** @type {?} */ containsData = false; - var /** @type {?} */ details = (element[REMOVAL_FLAG]); + var /** @type {?} */ details = /** @type {?} */ (element[REMOVAL_FLAG]); if (details && details.setForRemoval) containsData = true; if (this.playersByElement.has(element)) @@ -10784,12 +20325,20 @@ var TransitionAnimationEngine = (function () { * @param {?} callback * @return {?} */ - TransitionAnimationEngine.prototype.afterFlush = function (callback) { this._flushFns.push(callback); }; + TransitionAnimationEngine.prototype.afterFlush = /** + * @param {?} callback + * @return {?} + */ + function (callback) { this._flushFns.push(callback); }; /** * @param {?} callback * @return {?} */ - TransitionAnimationEngine.prototype.afterFlushAnimationsDone = function (callback) { this._whenQuietFns.push(callback); }; + TransitionAnimationEngine.prototype.afterFlushAnimationsDone = /** + * @param {?} callback + * @return {?} + */ + function (callback) { this._whenQuietFns.push(callback); }; /** * @param {?} element * @param {?} isQueriedElement @@ -10798,7 +20347,15 @@ var TransitionAnimationEngine = (function () { * @param {?=} toStateValue * @return {?} */ - TransitionAnimationEngine.prototype._getPreviousPlayers = function (element, isQueriedElement, namespaceId, triggerName, toStateValue) { + TransitionAnimationEngine.prototype._getPreviousPlayers = /** + * @param {?} element + * @param {?} isQueriedElement + * @param {?=} namespaceId + * @param {?=} triggerName + * @param {?=} toStateValue + * @return {?} + */ + function (element, isQueriedElement, namespaceId, triggerName, toStateValue) { var /** @type {?} */ players = []; if (isQueriedElement) { var /** @type {?} */ queriedElementPlayers = this.playersByQueriedElement.get(element); @@ -10836,11 +20393,14 @@ var TransitionAnimationEngine = (function () { * @param {?} allPreviousPlayersMap * @return {?} */ - TransitionAnimationEngine.prototype._beforeAnimationBuild = function (namespaceId, instruction, allPreviousPlayersMap) { + TransitionAnimationEngine.prototype._beforeAnimationBuild = /** + * @param {?} namespaceId + * @param {?} instruction + * @param {?} allPreviousPlayersMap + * @return {?} + */ + function (namespaceId, instruction, allPreviousPlayersMap) { var _this = this; - // it's important to do this step before destroying the players - // so that the onDone callback below won't fire before this - eraseStyles(instruction.element, instruction.fromStyles); var /** @type {?} */ triggerName = instruction.triggerName; var /** @type {?} */ rootElement = instruction.element; // when a removal animation occurs, ALL previous players are collected @@ -10853,13 +20413,17 @@ var TransitionAnimationEngine = (function () { var /** @type {?} */ players = getOrSetAsInMap(allPreviousPlayersMap, element, []); var /** @type {?} */ previousPlayers = _this._getPreviousPlayers(element, isQueriedElement, targetNameSpaceId, targetTriggerName, instruction.toState); previousPlayers.forEach(function (player) { - var /** @type {?} */ realPlayer = (player.getRealPlayer()); + var /** @type {?} */ realPlayer = /** @type {?} */ (player.getRealPlayer()); if (realPlayer.beforeDestroy) { realPlayer.beforeDestroy(); } + player.destroy(); players.push(player); }); }); + // this needs to be done so that the PRE/POST styles can be + // computed properly without interfering with the previous animation + eraseStyles(rootElement, instruction.fromStyles); }; /** * @param {?} namespaceId @@ -10870,7 +20434,16 @@ var TransitionAnimationEngine = (function () { * @param {?} postStylesMap * @return {?} */ - TransitionAnimationEngine.prototype._buildAnimation = function (namespaceId, instruction, allPreviousPlayersMap, skippedPlayersMap, preStylesMap, postStylesMap) { + TransitionAnimationEngine.prototype._buildAnimation = /** + * @param {?} namespaceId + * @param {?} instruction + * @param {?} allPreviousPlayersMap + * @param {?} skippedPlayersMap + * @param {?} preStylesMap + * @param {?} postStylesMap + * @return {?} + */ + function (namespaceId, instruction, allPreviousPlayersMap, skippedPlayersMap, preStylesMap, postStylesMap) { var _this = this; var /** @type {?} */ triggerName = instruction.triggerName; var /** @type {?} */ rootElement = instruction.element; @@ -10881,19 +20454,22 @@ var TransitionAnimationEngine = (function () { var /** @type {?} */ allSubElements = new Set(); var /** @type {?} */ allNewPlayers = instruction.timelines.map(function (timelineInstruction) { var /** @type {?} */ element = timelineInstruction.element; + allConsumedElements.add(element); // FIXME (matsko): make sure to-be-removed animations are removed properly var /** @type {?} */ details = element[REMOVAL_FLAG]; if (details && details.removedBeforeQueried) return new _angular_animations.NoopAnimationPlayer(); var /** @type {?} */ isQueriedElement = element !== rootElement; - var /** @type {?} */ previousPlayers = EMPTY_PLAYER_ARRAY; - if (!allConsumedElements.has(element)) { - allConsumedElements.add(element); - var /** @type {?} */ _previousPlayers = allPreviousPlayersMap.get(element); - if (_previousPlayers) { - previousPlayers = _previousPlayers.map(function (p) { return p.getRealPlayer(); }); - } - } + var /** @type {?} */ previousPlayers = flattenGroupPlayers((allPreviousPlayersMap.get(element) || EMPTY_PLAYER_ARRAY) + .map(function (p) { return p.getRealPlayer(); })) + .filter(function (p) { + // the `element` is not apart of the AnimationPlayer definition, but + // Mock/WebAnimations + // use the element within their implementation. This will be added in Angular5 to + // AnimationPlayer + var /** @type {?} */ pp = /** @type {?} */ (p); + return pp.element ? pp.element === element : false; + }); var /** @type {?} */ preStyles = preStylesMap.get(element); var /** @type {?} */ postStyles = postStylesMap.get(element); var /** @type {?} */ keyframes = normalizeKeyframes(_this.driver, _this._normalizer, element, timelineInstruction.keyframes, preStyles, postStyles); @@ -10931,7 +20507,13 @@ var TransitionAnimationEngine = (function () { * @param {?} previousPlayers * @return {?} */ - TransitionAnimationEngine.prototype._buildPlayer = function (instruction, keyframes, previousPlayers) { + TransitionAnimationEngine.prototype._buildPlayer = /** + * @param {?} instruction + * @param {?} keyframes + * @param {?} previousPlayers + * @return {?} + */ + function (instruction, keyframes, previousPlayers) { if (keyframes.length > 0) { return this.driver.animate(instruction.element, keyframes, instruction.duration, instruction.delay, instruction.easing, previousPlayers); } @@ -10942,11 +20524,6 @@ var TransitionAnimationEngine = (function () { return TransitionAnimationEngine; }()); var TransitionAnimationPlayer = (function () { - /** - * @param {?} namespaceId - * @param {?} triggerName - * @param {?} element - */ function TransitionAnimationPlayer(namespaceId, triggerName, element) { this.namespaceId = namespaceId; this.triggerName = triggerName; @@ -10954,22 +20531,14 @@ var TransitionAnimationPlayer = (function () { this._player = new _angular_animations.NoopAnimationPlayer(); this._containsRealPlayer = false; this._queuedCallbacks = {}; - this._destroyed = false; + this.destroyed = false; this.markedForDestroy = false; } Object.defineProperty(TransitionAnimationPlayer.prototype, "queued", { - /** - * @return {?} - */ - get: function () { return this._containsRealPlayer == false; }, - enumerable: true, - configurable: true - }); - Object.defineProperty(TransitionAnimationPlayer.prototype, "destroyed", { - /** + get: /** * @return {?} */ - get: function () { return this._destroyed; }, + function () { return this._containsRealPlayer == false; }, enumerable: true, configurable: true }); @@ -10977,7 +20546,11 @@ var TransitionAnimationPlayer = (function () { * @param {?} player * @return {?} */ - TransitionAnimationPlayer.prototype.setRealPlayer = function (player) { + TransitionAnimationPlayer.prototype.setRealPlayer = /** + * @param {?} player + * @return {?} + */ + function (player) { var _this = this; if (this._containsRealPlayer) return; @@ -10991,20 +20564,32 @@ var TransitionAnimationPlayer = (function () { /** * @return {?} */ - TransitionAnimationPlayer.prototype.getRealPlayer = function () { return this._player; }; + TransitionAnimationPlayer.prototype.getRealPlayer = /** + * @return {?} + */ + function () { return this._player; }; /** * @param {?} name * @param {?} callback * @return {?} */ - TransitionAnimationPlayer.prototype._queueEvent = function (name, callback) { + TransitionAnimationPlayer.prototype._queueEvent = /** + * @param {?} name + * @param {?} callback + * @return {?} + */ + function (name, callback) { getOrSetAsInMap(this._queuedCallbacks, name, []).push(callback); }; /** * @param {?} fn * @return {?} */ - TransitionAnimationPlayer.prototype.onDone = function (fn) { + TransitionAnimationPlayer.prototype.onDone = /** + * @param {?} fn + * @return {?} + */ + function (fn) { if (this.queued) { this._queueEvent('done', fn); } @@ -11014,7 +20599,11 @@ var TransitionAnimationPlayer = (function () { * @param {?} fn * @return {?} */ - TransitionAnimationPlayer.prototype.onStart = function (fn) { + TransitionAnimationPlayer.prototype.onStart = /** + * @param {?} fn + * @return {?} + */ + function (fn) { if (this.queued) { this._queueEvent('start', fn); } @@ -11024,7 +20613,11 @@ var TransitionAnimationPlayer = (function () { * @param {?} fn * @return {?} */ - TransitionAnimationPlayer.prototype.onDestroy = function (fn) { + TransitionAnimationPlayer.prototype.onDestroy = /** + * @param {?} fn + * @return {?} + */ + function (fn) { if (this.queued) { this._queueEvent('destroy', fn); } @@ -11033,56 +20626,87 @@ var TransitionAnimationPlayer = (function () { /** * @return {?} */ - TransitionAnimationPlayer.prototype.init = function () { this._player.init(); }; - /** + TransitionAnimationPlayer.prototype.init = /** * @return {?} */ - TransitionAnimationPlayer.prototype.hasStarted = function () { return this.queued ? false : this._player.hasStarted(); }; + function () { this._player.init(); }; /** * @return {?} */ - TransitionAnimationPlayer.prototype.play = function () { !this.queued && this._player.play(); }; - /** + TransitionAnimationPlayer.prototype.hasStarted = /** * @return {?} */ - TransitionAnimationPlayer.prototype.pause = function () { !this.queued && this._player.pause(); }; + function () { return this.queued ? false : this._player.hasStarted(); }; /** * @return {?} */ - TransitionAnimationPlayer.prototype.restart = function () { !this.queued && this._player.restart(); }; - /** + TransitionAnimationPlayer.prototype.play = /** * @return {?} */ - TransitionAnimationPlayer.prototype.finish = function () { this._player.finish(); }; + function () { !this.queued && this._player.play(); }; /** * @return {?} */ - TransitionAnimationPlayer.prototype.destroy = function () { - this._destroyed = true; - this._player.destroy(); - }; - /** + TransitionAnimationPlayer.prototype.pause = /** * @return {?} */ - TransitionAnimationPlayer.prototype.reset = function () { !this.queued && this._player.reset(); }; + function () { !this.queued && this._player.pause(); }; /** - * @param {?} p * @return {?} */ - TransitionAnimationPlayer.prototype.setPosition = function (p) { - if (!this.queued) { - this._player.setPosition(p); - } - }; + TransitionAnimationPlayer.prototype.restart = /** + * @return {?} + */ + function () { !this.queued && this._player.restart(); }; /** * @return {?} */ - TransitionAnimationPlayer.prototype.getPosition = function () { return this.queued ? 0 : this._player.getPosition(); }; + TransitionAnimationPlayer.prototype.finish = /** + * @return {?} + */ + function () { this._player.finish(); }; + /** + * @return {?} + */ + TransitionAnimationPlayer.prototype.destroy = /** + * @return {?} + */ + function () { + (/** @type {?} */ (this)).destroyed = true; + this._player.destroy(); + }; + /** + * @return {?} + */ + TransitionAnimationPlayer.prototype.reset = /** + * @return {?} + */ + function () { !this.queued && this._player.reset(); }; + /** + * @param {?} p + * @return {?} + */ + TransitionAnimationPlayer.prototype.setPosition = /** + * @param {?} p + * @return {?} + */ + function (p) { + if (!this.queued) { + this._player.setPosition(p); + } + }; + /** + * @return {?} + */ + TransitionAnimationPlayer.prototype.getPosition = /** + * @return {?} + */ + function () { return this.queued ? 0 : this._player.getPosition(); }; Object.defineProperty(TransitionAnimationPlayer.prototype, "totalTime", { - /** + get: /** * @return {?} */ - get: function () { return this._player.totalTime; }, + function () { return this._player.totalTime; }, enumerable: true, configurable: true }); @@ -11127,12 +20751,10 @@ function deleteOrUnsetInMap(map, key, value) { * @return {?} */ function normalizeTriggerValue(value) { - switch (typeof value) { - case 'boolean': - return value ? '1' : '0'; - default: - return value != null ? value.toString() : null; - } + // we use `!= null` here because it's the most simple + // way to test against a "falsy" value without mixing + // in empty strings or a zero value. DO NOT OPTIMIZE. + return value != null ? value : null; } /** * @param {?} node @@ -11166,8 +20788,10 @@ function cloakElement(element, value) { * @return {?} */ function cloakAndComputeStyles(driver, elements, elementPropsMap, defaultStyle) { - var /** @type {?} */ cloakVals = elements.map(function (element) { return cloakElement(element); }); + var /** @type {?} */ cloakVals = []; + elements.forEach(function (element) { return cloakVals.push(cloakElement(element)); }); var /** @type {?} */ valuesMap = new Map(); + var /** @type {?} */ failedElements = []; elementPropsMap.forEach(function (props, element) { var /** @type {?} */ styles = {}; props.forEach(function (prop) { @@ -11176,12 +20800,16 @@ function cloakAndComputeStyles(driver, elements, elementPropsMap, defaultStyle) // by a parent animation element being detached. if (!value || value.length == 0) { element[REMOVAL_FLAG] = NULL_REMOVED_QUERIED_STATE; + failedElements.push(element); } }); valuesMap.set(element, styles); }); - elements.forEach(function (element, i) { return cloakElement(element, cloakVals[i]); }); - return valuesMap; + // we use a index variable here since Set.forEach(a, i) does not return + // an index value for the closure (but instead just the value) + var /** @type {?} */ i = 0; + elements.forEach(function (element) { return cloakElement(element, cloakVals[i++]); }); + return [valuesMap, failedElements]; } /** * @param {?} nodes @@ -11207,20 +20835,6 @@ function createIsRootFilterFn(nodes) { return isRoot; } var CLASSES_CACHE_KEY = '$$classes'; -/** - * @param {?} element - * @param {?} className - * @return {?} - */ -function containsClass(element, className) { - if (element.classList) { - return element.classList.contains(className); - } - else { - var /** @type {?} */ classes = element[CLASSES_CACHE_KEY]; - return classes && classes[className]; - } -} /** * @param {?} element * @param {?} className @@ -11255,43 +20869,92 @@ function removeClass(element, className) { } } /** + * @param {?} engine + * @param {?} element + * @param {?} players * @return {?} */ -function getBodyNode() { - if (typeof document != 'undefined') { - return document.body; +function removeNodesAfterAnimationDone(engine, element, players) { + optimizeGroupPlayer(players).onDone(function () { return engine.processLeaveNode(element); }); +} +/** + * @param {?} players + * @return {?} + */ +function flattenGroupPlayers(players) { + var /** @type {?} */ finalPlayers = []; + _flattenGroupPlayersRecur(players, finalPlayers); + return finalPlayers; +} +/** + * @param {?} players + * @param {?} finalPlayers + * @return {?} + */ +function _flattenGroupPlayersRecur(players, finalPlayers) { + for (var /** @type {?} */ i = 0; i < players.length; i++) { + var /** @type {?} */ player = players[i]; + if (player instanceof _angular_animations.ɵAnimationGroupPlayer) { + _flattenGroupPlayersRecur(player.players, finalPlayers); + } + else { + finalPlayers.push(/** @type {?} */ (player)); + } } - return null; } /** - * @param {?} engine + * @param {?} a + * @param {?} b + * @return {?} + */ +function objEquals(a, b) { + var /** @type {?} */ k1 = Object.keys(a); + var /** @type {?} */ k2 = Object.keys(b); + if (k1.length != k2.length) + return false; + for (var /** @type {?} */ i = 0; i < k1.length; i++) { + var /** @type {?} */ prop = k1[i]; + if (!b.hasOwnProperty(prop) || a[prop] !== b[prop]) + return false; + } + return true; +} +/** * @param {?} element - * @param {?} players + * @param {?} allPreStyleElements + * @param {?} allPostStyleElements * @return {?} */ -function removeNodesAfterAnimationDone(engine, element, players) { - optimizeGroupPlayer(players).onDone(function () { return engine.processLeaveNode(element); }); +function replacePostStylesAsPre(element, allPreStyleElements, allPostStyleElements) { + var /** @type {?} */ postEntry = allPostStyleElements.get(element); + if (!postEntry) + return false; + var /** @type {?} */ preEntry = allPreStyleElements.get(element); + if (preEntry) { + postEntry.forEach(function (data) { return /** @type {?} */ ((preEntry)).add(data); }); + } + else { + allPreStyleElements.set(element, postEntry); + } + allPostStyleElements.delete(element); + return true; } + /** - * @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 + * @fileoverview added by tsickle + * @suppress {checkTypes} checked by tsc */ var AnimationEngine = (function () { - /** - * @param {?} driver - * @param {?} normalizer - */ - function AnimationEngine(driver, normalizer) { + function AnimationEngine(_driver, normalizer) { var _this = this; + this._driver = _driver; this._triggerCache = {}; this.onRemovalComplete = function (element, context) { }; - this._transitionEngine = new TransitionAnimationEngine(driver, normalizer); - this._timelineEngine = new TimelineAnimationEngine(driver, normalizer); - this._transitionEngine.onRemovalComplete = - function (element, context) { _this.onRemovalComplete(element, context); }; + this._transitionEngine = new TransitionAnimationEngine(_driver, normalizer); + this._timelineEngine = new TimelineAnimationEngine(_driver, normalizer); + this._transitionEngine.onRemovalComplete = function (element, context) { + return _this.onRemovalComplete(element, context); + }; } /** * @param {?} componentId @@ -11301,12 +20964,20 @@ var AnimationEngine = (function () { * @param {?} metadata * @return {?} */ - AnimationEngine.prototype.registerTrigger = function (componentId, namespaceId, hostElement, name, metadata) { + AnimationEngine.prototype.registerTrigger = /** + * @param {?} componentId + * @param {?} namespaceId + * @param {?} hostElement + * @param {?} name + * @param {?} metadata + * @return {?} + */ + function (componentId, namespaceId, hostElement, name, metadata) { var /** @type {?} */ cacheKey = componentId + '-' + name; var /** @type {?} */ trigger = this._triggerCache[cacheKey]; if (!trigger) { var /** @type {?} */ errors = []; - var /** @type {?} */ ast = (buildAnimationAst(/** @type {?} */ (metadata), errors)); + var /** @type {?} */ ast = /** @type {?} */ (buildAnimationAst(this._driver, /** @type {?} */ (metadata), errors)); if (errors.length) { throw new Error("The animation trigger \"" + name + "\" has failed to build due to the following errors:\n - " + errors.join("\n - ")); } @@ -11320,7 +20991,12 @@ var AnimationEngine = (function () { * @param {?} hostElement * @return {?} */ - AnimationEngine.prototype.register = function (namespaceId, hostElement) { + AnimationEngine.prototype.register = /** + * @param {?} namespaceId + * @param {?} hostElement + * @return {?} + */ + function (namespaceId, hostElement) { this._transitionEngine.register(namespaceId, hostElement); }; /** @@ -11328,7 +21004,12 @@ var AnimationEngine = (function () { * @param {?} context * @return {?} */ - AnimationEngine.prototype.destroy = function (namespaceId, context) { + AnimationEngine.prototype.destroy = /** + * @param {?} namespaceId + * @param {?} context + * @return {?} + */ + function (namespaceId, context) { this._transitionEngine.destroy(namespaceId, context); }; /** @@ -11338,7 +21019,14 @@ var AnimationEngine = (function () { * @param {?} insertBefore * @return {?} */ - AnimationEngine.prototype.onInsert = function (namespaceId, element, parent, insertBefore) { + AnimationEngine.prototype.onInsert = /** + * @param {?} namespaceId + * @param {?} element + * @param {?} parent + * @param {?} insertBefore + * @return {?} + */ + function (namespaceId, element, parent, insertBefore) { this._transitionEngine.insertNode(namespaceId, element, parent, insertBefore); }; /** @@ -11347,9 +21035,28 @@ var AnimationEngine = (function () { * @param {?} context * @return {?} */ - AnimationEngine.prototype.onRemove = function (namespaceId, element, context) { + AnimationEngine.prototype.onRemove = /** + * @param {?} namespaceId + * @param {?} element + * @param {?} context + * @return {?} + */ + function (namespaceId, element, context) { this._transitionEngine.removeNode(namespaceId, element, context); }; + /** + * @param {?} element + * @param {?} disable + * @return {?} + */ + AnimationEngine.prototype.disableAnimations = /** + * @param {?} element + * @param {?} disable + * @return {?} + */ + function (element, disable) { + this._transitionEngine.markElementAsDisabled(element, disable); + }; /** * @param {?} namespaceId * @param {?} element @@ -11357,15 +21064,22 @@ var AnimationEngine = (function () { * @param {?} value * @return {?} */ - AnimationEngine.prototype.setProperty = function (namespaceId, element, property, value) { - // @@property + AnimationEngine.prototype.process = /** + * @param {?} namespaceId + * @param {?} element + * @param {?} property + * @param {?} value + * @return {?} + */ + function (namespaceId, element, property, value) { if (property.charAt(0) == '@') { var _a = parseTimelineCommand(property), id = _a[0], action = _a[1]; - var /** @type {?} */ args = (value); + var /** @type {?} */ args = /** @type {?} */ (value); this._timelineEngine.command(id, element, action, args); - return false; } - return this._transitionEngine.trigger(namespaceId, element, property, value); + else { + this._transitionEngine.trigger(namespaceId, element, property, value); + } }; /** * @param {?} namespaceId @@ -11375,7 +21089,15 @@ var AnimationEngine = (function () { * @param {?} callback * @return {?} */ - AnimationEngine.prototype.listen = function (namespaceId, element, eventName, eventPhase, callback) { + AnimationEngine.prototype.listen = /** + * @param {?} namespaceId + * @param {?} element + * @param {?} eventName + * @param {?} eventPhase + * @param {?} callback + * @return {?} + */ + function (namespaceId, element, eventName, eventPhase, callback) { // @@listen if (eventName.charAt(0) == '@') { var _a = parseTimelineCommand(eventName), id = _a[0], action = _a[1]; @@ -11387,16 +21109,20 @@ var AnimationEngine = (function () { * @param {?=} microtaskId * @return {?} */ - AnimationEngine.prototype.flush = function (microtaskId) { + AnimationEngine.prototype.flush = /** + * @param {?=} microtaskId + * @return {?} + */ + function (microtaskId) { if (microtaskId === void 0) { microtaskId = -1; } this._transitionEngine.flush(microtaskId); }; Object.defineProperty(AnimationEngine.prototype, "players", { - /** + get: /** * @return {?} */ - get: function () { - return ((this._transitionEngine.players)) + function () { + return (/** @type {?} */ (this._transitionEngine.players)) .concat(/** @type {?} */ (this._timelineEngine.players)); }, enumerable: true, @@ -11405,23 +21131,18 @@ var AnimationEngine = (function () { /** * @return {?} */ - AnimationEngine.prototype.whenRenderingDone = function () { return this._transitionEngine.whenRenderingDone(); }; + AnimationEngine.prototype.whenRenderingDone = /** + * @return {?} + */ + function () { return this._transitionEngine.whenRenderingDone(); }; return AnimationEngine; }()); + /** - * @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 + * @fileoverview added by tsickle + * @suppress {checkTypes} checked by tsc */ var WebAnimationsPlayer = (function () { - /** - * @param {?} element - * @param {?} keyframes - * @param {?} options - * @param {?=} previousPlayers - */ function WebAnimationsPlayer(element, keyframes, options, previousPlayers) { if (previousPlayers === void 0) { previousPlayers = []; } var _this = this; @@ -11438,20 +21159,25 @@ var WebAnimationsPlayer = (function () { this._destroyed = false; this.time = 0; this.parentPlayer = null; + this.previousStyles = {}; this.currentSnapshot = {}; - this._duration = options['duration']; - this._delay = options['delay'] || 0; + this._duration = /** @type {?} */ (options['duration']); + this._delay = /** @type {?} */ (options['delay']) || 0; this.time = this._duration + this._delay; - this.previousStyles = {}; - previousPlayers.forEach(function (player) { - var styles = player.currentSnapshot; - Object.keys(styles).forEach(function (prop) { return _this.previousStyles[prop] = styles[prop]; }); - }); + if (allowPreviousPlayerStylesMerge(this._duration, this._delay)) { + previousPlayers.forEach(function (player) { + var /** @type {?} */ styles = player.currentSnapshot; + Object.keys(styles).forEach(function (prop) { return _this.previousStyles[prop] = styles[prop]; }); + }); + } } /** * @return {?} */ - WebAnimationsPlayer.prototype._onFinish = function () { + WebAnimationsPlayer.prototype._onFinish = /** + * @return {?} + */ + function () { if (!this._finished) { this._finished = true; this._onDoneFns.forEach(function (fn) { return fn(); }); @@ -11461,14 +21187,20 @@ var WebAnimationsPlayer = (function () { /** * @return {?} */ - WebAnimationsPlayer.prototype.init = function () { + WebAnimationsPlayer.prototype.init = /** + * @return {?} + */ + function () { this._buildPlayer(); this._preparePlayerBeforeStart(); }; /** * @return {?} */ - WebAnimationsPlayer.prototype._buildPlayer = function () { + WebAnimationsPlayer.prototype._buildPlayer = /** + * @return {?} + */ + function () { var _this = this; if (this._initialized) return; @@ -11498,22 +21230,27 @@ var WebAnimationsPlayer = (function () { } } } - this._player = this._triggerWebAnimation(this.element, keyframes, this.options); + (/** @type {?} */ (this)).domPlayer = + this._triggerWebAnimation(this.element, keyframes, this.options); this._finalKeyframe = keyframes.length ? keyframes[keyframes.length - 1] : {}; - this._player.addEventListener('finish', function () { return _this._onFinish(); }); + this.domPlayer.addEventListener('finish', function () { return _this._onFinish(); }); }; /** * @return {?} */ - WebAnimationsPlayer.prototype._preparePlayerBeforeStart = function () { + WebAnimationsPlayer.prototype._preparePlayerBeforeStart = /** + * @return {?} + */ + function () { // this is required so that the player doesn't start to animate right away if (this._delay) { this._resetDomPlayerState(); } else { - this._player.pause(); + this.domPlayer.pause(); } }; + /** @internal */ /** * \@internal * @param {?} element @@ -11521,65 +21258,88 @@ var WebAnimationsPlayer = (function () { * @param {?} options * @return {?} */ - WebAnimationsPlayer.prototype._triggerWebAnimation = function (element, keyframes, options) { + WebAnimationsPlayer.prototype._triggerWebAnimation = /** + * \@internal + * @param {?} element + * @param {?} keyframes + * @param {?} options + * @return {?} + */ + function (element, keyframes, options) { // jscompiler doesn't seem to know animate is a native property because it's not fully // supported yet across common browsers (we polyfill it for Edge/Safari) [CL #143630929] - return (element['animate'](keyframes, options)); + return /** @type {?} */ (element['animate'](keyframes, options)); }; - Object.defineProperty(WebAnimationsPlayer.prototype, "domPlayer", { - /** - * @return {?} - */ - get: function () { return this._player; }, - enumerable: true, - configurable: true - }); /** * @param {?} fn * @return {?} */ - WebAnimationsPlayer.prototype.onStart = function (fn) { this._onStartFns.push(fn); }; + WebAnimationsPlayer.prototype.onStart = /** + * @param {?} fn + * @return {?} + */ + function (fn) { this._onStartFns.push(fn); }; /** * @param {?} fn * @return {?} */ - WebAnimationsPlayer.prototype.onDone = function (fn) { this._onDoneFns.push(fn); }; + WebAnimationsPlayer.prototype.onDone = /** + * @param {?} fn + * @return {?} + */ + function (fn) { this._onDoneFns.push(fn); }; /** * @param {?} fn * @return {?} */ - WebAnimationsPlayer.prototype.onDestroy = function (fn) { this._onDestroyFns.push(fn); }; + WebAnimationsPlayer.prototype.onDestroy = /** + * @param {?} fn + * @return {?} + */ + function (fn) { this._onDestroyFns.push(fn); }; /** * @return {?} */ - WebAnimationsPlayer.prototype.play = function () { + WebAnimationsPlayer.prototype.play = /** + * @return {?} + */ + function () { this._buildPlayer(); if (!this.hasStarted()) { this._onStartFns.forEach(function (fn) { return fn(); }); this._onStartFns = []; this._started = true; } - this._player.play(); + this.domPlayer.play(); }; /** * @return {?} */ - WebAnimationsPlayer.prototype.pause = function () { + WebAnimationsPlayer.prototype.pause = /** + * @return {?} + */ + function () { this.init(); - this._player.pause(); + this.domPlayer.pause(); }; /** * @return {?} */ - WebAnimationsPlayer.prototype.finish = function () { + WebAnimationsPlayer.prototype.finish = /** + * @return {?} + */ + function () { this.init(); this._onFinish(); - this._player.finish(); + this.domPlayer.finish(); }; /** * @return {?} */ - WebAnimationsPlayer.prototype.reset = function () { + WebAnimationsPlayer.prototype.reset = /** + * @return {?} + */ + function () { this._resetDomPlayerState(); this._destroyed = false; this._finished = false; @@ -11588,30 +21348,42 @@ var WebAnimationsPlayer = (function () { /** * @return {?} */ - WebAnimationsPlayer.prototype._resetDomPlayerState = function () { - if (this._player) { - this._player.cancel(); + WebAnimationsPlayer.prototype._resetDomPlayerState = /** + * @return {?} + */ + function () { + if (this.domPlayer) { + this.domPlayer.cancel(); } }; /** * @return {?} */ - WebAnimationsPlayer.prototype.restart = function () { + WebAnimationsPlayer.prototype.restart = /** + * @return {?} + */ + function () { this.reset(); this.play(); }; /** * @return {?} */ - WebAnimationsPlayer.prototype.hasStarted = function () { return this._started; }; + WebAnimationsPlayer.prototype.hasStarted = /** + * @return {?} + */ + function () { return this._started; }; /** * @return {?} */ - WebAnimationsPlayer.prototype.destroy = function () { + WebAnimationsPlayer.prototype.destroy = /** + * @return {?} + */ + function () { if (!this._destroyed) { + this._destroyed = true; this._resetDomPlayerState(); this._onFinish(); - this._destroyed = true; this._onDestroyFns.forEach(function (fn) { return fn(); }); this._onDestroyFns = []; } @@ -11620,23 +21392,33 @@ var WebAnimationsPlayer = (function () { * @param {?} p * @return {?} */ - WebAnimationsPlayer.prototype.setPosition = function (p) { this._player.currentTime = p * this.time; }; + WebAnimationsPlayer.prototype.setPosition = /** + * @param {?} p + * @return {?} + */ + function (p) { this.domPlayer.currentTime = p * this.time; }; /** * @return {?} */ - WebAnimationsPlayer.prototype.getPosition = function () { return this._player.currentTime / this.time; }; + WebAnimationsPlayer.prototype.getPosition = /** + * @return {?} + */ + function () { return this.domPlayer.currentTime / this.time; }; Object.defineProperty(WebAnimationsPlayer.prototype, "totalTime", { - /** + get: /** * @return {?} */ - get: function () { return this._delay + this._duration; }, + function () { return this._delay + this._duration; }, enumerable: true, configurable: true }); /** * @return {?} */ - WebAnimationsPlayer.prototype.beforeDestroy = function () { + WebAnimationsPlayer.prototype.beforeDestroy = /** + * @return {?} + */ + function () { var _this = this; var /** @type {?} */ styles = {}; if (this.hasStarted()) { @@ -11657,24 +21439,36 @@ var WebAnimationsPlayer = (function () { * @return {?} */ function _computeStyle(element, prop) { - return ((window.getComputedStyle(element)))[prop]; + return (/** @type {?} */ (window.getComputedStyle(element)))[prop]; } + /** - * @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 + * @fileoverview added by tsickle + * @suppress {checkTypes} checked by tsc */ var WebAnimationsDriver = (function () { function WebAnimationsDriver() { } /** + * @param {?} prop + * @return {?} + */ + WebAnimationsDriver.prototype.validateStyleProperty = /** + * @param {?} prop + * @return {?} + */ + function (prop) { return validateStyleProperty(prop); }; + /** + * @param {?} element + * @param {?} selector + * @return {?} + */ + WebAnimationsDriver.prototype.matchesElement = /** * @param {?} element * @param {?} selector * @return {?} */ - WebAnimationsDriver.prototype.matchesElement = function (element, selector) { + function (element, selector) { return matchesElement(element, selector); }; /** @@ -11682,14 +21476,25 @@ var WebAnimationsDriver = (function () { * @param {?} elm2 * @return {?} */ - WebAnimationsDriver.prototype.containsElement = function (elm1, elm2) { return containsElement(elm1, elm2); }; + WebAnimationsDriver.prototype.containsElement = /** + * @param {?} elm1 + * @param {?} elm2 + * @return {?} + */ + function (elm1, elm2) { return containsElement(elm1, elm2); }; /** * @param {?} element * @param {?} selector * @param {?} multi * @return {?} */ - WebAnimationsDriver.prototype.query = function (element, selector, multi) { + WebAnimationsDriver.prototype.query = /** + * @param {?} element + * @param {?} selector + * @param {?} multi + * @return {?} + */ + function (element, selector, multi) { return invokeQuery(element, selector, multi); }; /** @@ -11698,8 +21503,14 @@ var WebAnimationsDriver = (function () { * @param {?=} defaultValue * @return {?} */ - WebAnimationsDriver.prototype.computeStyle = function (element, prop, defaultValue) { - return (((window.getComputedStyle(element)))[prop]); + WebAnimationsDriver.prototype.computeStyle = /** + * @param {?} element + * @param {?} prop + * @param {?=} defaultValue + * @return {?} + */ + function (element, prop, defaultValue) { + return /** @type {?} */ ((/** @type {?} */ (window.getComputedStyle(element)))[prop]); }; /** * @param {?} element @@ -11710,16 +21521,25 @@ var WebAnimationsDriver = (function () { * @param {?=} previousPlayers * @return {?} */ - WebAnimationsDriver.prototype.animate = function (element, keyframes, duration, delay, easing, previousPlayers) { - if (previousPlayers === void 0) { previousPlayers = []; } - var /** @type {?} */ fill = delay == 0 ? 'both' : 'forwards'; + WebAnimationsDriver.prototype.animate = /** + * @param {?} element + * @param {?} keyframes + * @param {?} duration + * @param {?} delay + * @param {?} easing + * @param {?=} previousPlayers + * @return {?} + */ + function (element, keyframes, duration, delay, easing, previousPlayers) { + if (previousPlayers === void 0) { previousPlayers = []; } + var /** @type {?} */ fill = delay == 0 ? 'both' : 'forwards'; var /** @type {?} */ playerOptions = { duration: duration, delay: delay, fill: fill }; // we check for this to avoid having a null|undefined value be present // for the easing (which results in an error for certain browsers #9752) if (easing) { playerOptions['easing'] = easing; } - var /** @type {?} */ previousWebAnimationPlayers = (previousPlayers.filter(function (player) { return player instanceof WebAnimationsPlayer; })); + var /** @type {?} */ previousWebAnimationPlayers = /** @type {?} */ (previousPlayers.filter(function (player) { return player instanceof WebAnimationsPlayer; })); return new WebAnimationsPlayer(element, keyframes, playerOptions, previousWebAnimationPlayers); }; return WebAnimationsDriver; @@ -11728,7 +21548,7 @@ var WebAnimationsDriver = (function () { * @return {?} */ function supportsWebAnimations() { - return typeof Element !== 'undefined' && typeof ((Element)).prototype['animate'] === 'function'; + return typeof Element !== 'undefined' && typeof (/** @type {?} */ (Element)).prototype['animate'] === 'function'; } exports.AnimationDriver = AnimationDriver; @@ -11749,16 +21569,16 @@ Object.defineProperty(exports, '__esModule', { value: true }); /***/ }), -/* 47 */ +/* 27 */ /***/ (function(module, exports, __webpack_require__) { (function (global, factory) { - true ? factory(exports, __webpack_require__(10), __webpack_require__(17), __webpack_require__(29), __webpack_require__(58), __webpack_require__(57), __webpack_require__(121), __webpack_require__(41), __webpack_require__(83), __webpack_require__(109), __webpack_require__(0), __webpack_require__(55), __webpack_require__(54), __webpack_require__(56)) : - typeof define === 'function' && define.amd ? define(['exports', '@angular/core', '@angular/common', '@angular/http', 'rxjs/add/operator/map', 'rxjs/add/operator/catch', 'rxjs/Rx', 'rxjs/BehaviorSubject', '@angular/router', 'jsrsasign', 'rxjs/Observable', 'rxjs/add/observable/throw', 'rxjs/add/observable/interval', 'rxjs/add/observable/timer'], factory) : - (factory((global.ng = global.ng || {}, global.ng.angularAuthOidcClient = global.ng.angularAuthOidcClient || {}),global.ng.core,global.ng.common,global.ng.http,global.Rx,global.Rx,global.Rx,global.Rx,global.ng.router,global.jsrsasign,global.Rx)); -}(this, (function (exports,_angular_core,_angular_common,_angular_http,rxjs_add_operator_map,rxjs_add_operator_catch,rxjs_Rx,rxjs_BehaviorSubject,_angular_router,jsrsasign,rxjs_Observable) { 'use strict'; + true ? factory(exports, __webpack_require__(4), __webpack_require__(13), __webpack_require__(5), __webpack_require__(96), __webpack_require__(95), __webpack_require__(99), __webpack_require__(97), __webpack_require__(98), __webpack_require__(92), __webpack_require__(94), __webpack_require__(2), __webpack_require__(133), __webpack_require__(52), __webpack_require__(89), __webpack_require__(93), __webpack_require__(91)) : + typeof define === 'function' && define.amd ? define(['exports', '@angular/core', '@angular/common/http', '@angular/common', 'rxjs/add/operator/map', 'rxjs/add/operator/catch', 'rxjs/add/operator/timeInterval', 'rxjs/add/operator/pluck', 'rxjs/add/operator/take', 'rxjs/add/observable/interval', 'rxjs/add/observable/timer', 'rxjs/Observable', 'rxjs/BehaviorSubject', '@angular/router', 'jsrsasign', 'rxjs/add/observable/throw', 'rxjs/add/observable/empty'], factory) : + (factory((global.ng = global.ng || {}, global.ng.angularAuthOidcClient = global.ng.angularAuthOidcClient || {}),global.ng.core,global.ng.http,global.ng.common,global.Rx.Observable.prototype,global.Rx.Observable.prototype,global.Rx.Observable.prototype,global.Rx.Observable.prototype,global.Rx.Observable.prototype,global.Rx.Observable,global.Rx.Observable,global.Rx,global.Rx,global.ng.router,global.jsrsasign)); +}(this, (function (exports,_angular_core,_angular_common_http,_angular_common,rxjs_add_operator_map,rxjs_add_operator_catch,rxjs_add_operator_timeInterval,rxjs_add_operator_pluck,rxjs_add_operator_take,rxjs_add_observable_interval,rxjs_add_observable_timer,rxjs_Observable,rxjs_BehaviorSubject,_angular_router,jsrsasign) { 'use strict'; -var DefaultConfiguration = (function () { +var DefaultConfiguration = /** @class */ (function () { function DefaultConfiguration() { this.stsServer = 'https://localhost:44318'; this.redirect_url = 'https://localhost:44311'; @@ -11769,10 +21589,13 @@ var DefaultConfiguration = (function () { // For some oidc, we require resource identifier to be provided along with the request. this.resource = ''; this.scope = 'openid email profile'; + // Only for Google Auth with particular G Suite domain, see https://developers.google.com/identity/protocols/OpenIDConnect#hd-param + this.hd_param = ''; this.post_logout_redirect_uri = 'https://localhost:44311/unauthorized'; this.start_checksession = false; this.silent_renew = true; - this.startup_route = '/dataeventrecords'; + this.silent_renew_offset_in_seconds = 0; + this.post_login_route = '/'; // HTTP 403 this.forbidden_route = '/forbidden'; // HTTP 401 @@ -11789,12 +21612,12 @@ var DefaultConfiguration = (function () { } return DefaultConfiguration; }()); -var OpenIDImplicitFlowConfiguration = (function () { +var OpenIDImplicitFlowConfiguration = /** @class */ (function () { function OpenIDImplicitFlowConfiguration() { } return OpenIDImplicitFlowConfiguration; }()); -var AuthConfiguration = (function () { +var AuthConfiguration = /** @class */ (function () { /** * @param {?} defaultConfig */ @@ -11861,6 +21684,16 @@ var AuthConfiguration = (function () { enumerable: true, configurable: true }); + Object.defineProperty(AuthConfiguration.prototype, "hd_param", { + /** + * @return {?} + */ + get: function () { + return this.openIDImplicitFlowConfiguration.hd_param || this.defaultConfig.hd_param; + }, + enumerable: true, + configurable: true + }); Object.defineProperty(AuthConfiguration.prototype, "post_logout_redirect_uri", { /** * @return {?} @@ -11891,12 +21724,22 @@ var AuthConfiguration = (function () { enumerable: true, configurable: true }); - Object.defineProperty(AuthConfiguration.prototype, "startup_route", { + Object.defineProperty(AuthConfiguration.prototype, "silent_renew_offset_in_seconds", { + /** + * @return {?} + */ + get: function () { + return this.openIDImplicitFlowConfiguration.silent_renew_offset_in_seconds || this.defaultConfig.silent_renew_offset_in_seconds; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(AuthConfiguration.prototype, "post_login_route", { /** * @return {?} */ get: function () { - return this.openIDImplicitFlowConfiguration.startup_route || this.defaultConfig.startup_route; + return this.openIDImplicitFlowConfiguration.post_login_route || this.defaultConfig.post_login_route; }, enumerable: true, configurable: true @@ -12033,7 +21876,7 @@ AuthConfiguration.ctorParameters = function () { return [ * Implement this class-interface to create a custom storage. * @abstract */ -var OidcSecurityStorage = (function () { +var OidcSecurityStorage = /** @class */ (function () { function OidcSecurityStorage() { } /** @@ -12060,7 +21903,7 @@ OidcSecurityStorage.decorators = [ * @nocollapse */ OidcSecurityStorage.ctorParameters = function () { return []; }; -var BrowserStorage = (function () { +var BrowserStorage = /** @class */ (function () { /** * @param {?} authConfiguration */ @@ -12085,6 +21928,7 @@ var BrowserStorage = (function () { */ BrowserStorage.prototype.write = function (key, value) { if (this.hasStorage) { + value = value === undefined ? null : value; this.authConfiguration.storage.setItem(key, JSON.stringify(value)); } }; @@ -12099,7 +21943,7 @@ BrowserStorage.decorators = [ BrowserStorage.ctorParameters = function () { return [ { type: AuthConfiguration, }, ]; }; -var OidcSecurityCommon = (function () { +var OidcSecurityCommon = /** @class */ (function () { /** * @param {?} authConfiguration * @param {?} oidcSecurityStorage @@ -12119,6 +21963,193 @@ var OidcSecurityCommon = (function () { this.storage_silent_renew_running = 'storage_silent_renew_running'; this.storage_custom_request_params = 'storage_custom_request_params'; } + Object.defineProperty(OidcSecurityCommon.prototype, "authResult", { + /** + * @return {?} + */ + get: function () { + return this.retrieve(this.storage_auth_result); + }, + /** + * @param {?} value + * @return {?} + */ + set: function (value) { + this.store(this.storage_auth_result, value); + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(OidcSecurityCommon.prototype, "accessToken", { + /** + * @return {?} + */ + get: function () { + return this.retrieve(this.storage_access_token) || ''; + }, + /** + * @param {?} value + * @return {?} + */ + set: function (value) { + this.store(this.storage_access_token, value); + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(OidcSecurityCommon.prototype, "idToken", { + /** + * @return {?} + */ + get: function () { + return this.retrieve(this.storage_id_token) || ''; + }, + /** + * @param {?} value + * @return {?} + */ + set: function (value) { + this.store(this.storage_id_token, value); + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(OidcSecurityCommon.prototype, "isAuthorized", { + /** + * @return {?} + */ + get: function () { + return this.retrieve(this.storage_is_authorized); + }, + /** + * @param {?} value + * @return {?} + */ + set: function (value) { + this.store(this.storage_is_authorized, value); + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(OidcSecurityCommon.prototype, "userData", { + /** + * @return {?} + */ + get: function () { + return this.retrieve(this.storage_user_data); + }, + /** + * @param {?} value + * @return {?} + */ + set: function (value) { + this.store(this.storage_user_data, value); + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(OidcSecurityCommon.prototype, "authNonce", { + /** + * @return {?} + */ + get: function () { + return this.retrieve(this.storage_auth_nonce) || ''; + }, + /** + * @param {?} value + * @return {?} + */ + set: function (value) { + this.store(this.storage_auth_nonce, value); + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(OidcSecurityCommon.prototype, "authStateControl", { + /** + * @return {?} + */ + get: function () { + return this.retrieve(this.storage_auth_state_control) || ''; + }, + /** + * @param {?} value + * @return {?} + */ + set: function (value) { + this.store(this.storage_auth_state_control, value); + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(OidcSecurityCommon.prototype, "wellKnownEndpoints", { + /** + * @return {?} + */ + get: function () { + return this.retrieve(this.storage_well_known_endpoints); + }, + /** + * @param {?} value + * @return {?} + */ + set: function (value) { + this.store(this.storage_well_known_endpoints, value); + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(OidcSecurityCommon.prototype, "sessionState", { + /** + * @return {?} + */ + get: function () { + return this.retrieve(this.storage_session_state); + }, + /** + * @param {?} value + * @return {?} + */ + set: function (value) { + this.store(this.storage_session_state, value); + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(OidcSecurityCommon.prototype, "silentRenewRunning", { + /** + * @return {?} + */ + get: function () { + return this.retrieve(this.storage_silent_renew_running) || ''; + }, + /** + * @param {?} value + * @return {?} + */ + set: function (value) { + this.store(this.storage_silent_renew_running, value); + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(OidcSecurityCommon.prototype, "customRequestParams", { + /** + * @return {?} + */ + get: function () { + return this.retrieve(this.storage_custom_request_params); + }, + /** + * @param {?} value + * @return {?} + */ + set: function (value) { + this.store(this.storage_custom_request_params, value); + }, + enumerable: true, + configurable: true + }); /** * @return {?} */ @@ -12202,7 +22233,7 @@ OidcSecurityCommon.ctorParameters = function () { return [ { type: AuthConfiguration, }, { type: OidcSecurityStorage, }, ]; }; -var OidcSecurityValidation = (function () { +var OidcSecurityValidation = /** @class */ (function () { /** * @param {?} oidcSecurityCommon */ @@ -12397,6 +22428,10 @@ var OidcSecurityValidation = (function () { return false; } var /** @type {?} */ header_data = this.getHeaderFromToken(id_token, false); + if ((Object.keys(header_data).length === 0 && header_data.constructor === Object)) { + this.oidcSecurityCommon.logWarning('id token has no header data'); + return false; + } var /** @type {?} */ kid = header_data.kid; var /** @type {?} */ alg = header_data.alg; if ('RS256' != alg) { @@ -12537,7 +22572,7 @@ OidcSecurityValidation.decorators = [ OidcSecurityValidation.ctorParameters = function () { return [ { type: OidcSecurityCommon, }, ]; }; -var AuthWellKnownEndpoints = (function () { +var AuthWellKnownEndpoints = /** @class */ (function () { /** * @param {?} http * @param {?} authConfiguration @@ -12550,15 +22585,15 @@ var AuthWellKnownEndpoints = (function () { this.oidcSecurityCommon = oidcSecurityCommon; this.onWellKnownEndpointsLoaded = new _angular_core.EventEmitter(true); this.getWellKnownEndpoints = function () { - var /** @type {?} */ headers = new _angular_http.Headers(); - headers.append('Accept', 'application/json'); + var /** @type {?} */ headers = new _angular_common_http.HttpHeaders(); + headers = headers.set('Accept', 'application/json'); var /** @type {?} */ url = _this.authConfiguration.stsServer + '/.well-known/openid-configuration'; if (_this.authConfiguration.override_well_known_configuration) { url = _this.authConfiguration.override_well_known_configuration_url; } return _this.http.get(url, { headers: headers, - }).map(function (res) { return res.json(); }); + }); }; } /** @@ -12566,7 +22601,7 @@ var AuthWellKnownEndpoints = (function () { */ AuthWellKnownEndpoints.prototype.setupModule = function () { var _this = this; - var /** @type {?} */ data = this.oidcSecurityCommon.retrieve(this.oidcSecurityCommon.storage_well_known_endpoints); + var /** @type {?} */ data = this.oidcSecurityCommon.wellKnownEndpoints; this.oidcSecurityCommon.logDebug(data); if (data && data !== '') { this.oidcSecurityCommon.logDebug('AuthWellKnownEndpoints already defined'); @@ -12610,7 +22645,7 @@ var AuthWellKnownEndpoints = (function () { if (data.introspection_endpoint) { _this.introspection_endpoint = data.introspection_endpoint; } - _this.oidcSecurityCommon.store(_this.oidcSecurityCommon.storage_well_known_endpoints, data); + _this.oidcSecurityCommon.wellKnownEndpoints = data; _this.oidcSecurityCommon.logDebug(data); _this.onWellKnownEndpointsLoaded.emit(); }); @@ -12625,14 +22660,14 @@ AuthWellKnownEndpoints.decorators = [ * @nocollapse */ AuthWellKnownEndpoints.ctorParameters = function () { return [ - { type: _angular_http.Http, }, + { type: _angular_common_http.HttpClient, }, { type: AuthConfiguration, }, { type: OidcSecurityCommon, }, ]; }; AuthWellKnownEndpoints.propDecorators = { 'onWellKnownEndpointsLoaded': [{ type: _angular_core.Output },], }; -var OidcSecurityCheckSession = (function () { +var OidcSecurityCheckSession = /** @class */ (function () { /** * @param {?} authConfiguration * @param {?} oidcSecurityCommon @@ -12678,9 +22713,9 @@ var OidcSecurityCheckSession = (function () { .timeInterval() .pluck('interval') .take(10000); - var /** @type {?} */ subscription = source.subscribe(function () { + source.subscribe(function () { _this.oidcSecurityCommon.logDebug(_this.sessionIframe); - var /** @type {?} */ session_state = _this.oidcSecurityCommon.retrieve(_this.oidcSecurityCommon.storage_session_state); + var /** @type {?} */ session_state = _this.oidcSecurityCommon.sessionState; if (session_state && session_state !== '') { _this.sessionIframe.contentWindow.postMessage(clientId + ' ' + session_state, _this.authConfiguration.stsServer); } @@ -12724,7 +22759,7 @@ OidcSecurityCheckSession.ctorParameters = function () { return [ OidcSecurityCheckSession.propDecorators = { 'onCheckSessionChanged': [{ type: _angular_core.Output },], }; -var OidcSecuritySilentRenew = (function () { +var OidcSecuritySilentRenew = /** @class */ (function () { /** * @param {?} oidcSecurityCommon */ @@ -12805,31 +22840,28 @@ OidcSecuritySilentRenew.decorators = [ OidcSecuritySilentRenew.ctorParameters = function () { return [ { type: OidcSecurityCommon, }, ]; }; -var OidcSecurityUserService = (function () { +var OidcSecurityUserService = /** @class */ (function () { /** * @param {?} http - * @param {?} authConfiguration * @param {?} oidcSecurityCommon * @param {?} authWellKnownEndpoints */ - function OidcSecurityUserService(http, authConfiguration, oidcSecurityCommon, authWellKnownEndpoints) { + function OidcSecurityUserService(http, oidcSecurityCommon, authWellKnownEndpoints) { var _this = this; this.http = http; - this.authConfiguration = authConfiguration; this.oidcSecurityCommon = oidcSecurityCommon; this.authWellKnownEndpoints = authWellKnownEndpoints; this.userData = ''; this.getIdentityUserData = function () { - var /** @type {?} */ headers = new _angular_http.Headers(); - headers.append('Accept', 'application/json'); + var /** @type {?} */ headers = new _angular_common_http.HttpHeaders(); + headers = headers.set('Accept', 'application/json'); var /** @type {?} */ token = _this.oidcSecurityCommon.getAccessToken(); if (token !== '') { - headers.append('Authorization', 'Bearer ' + decodeURIComponent(token)); + headers = headers.set('Authorization', 'Bearer ' + decodeURIComponent(token)); } return _this.http.get(_this.authWellKnownEndpoints.userinfo_endpoint, { headers: headers, - body: '' - }).map(function (res) { return res.json(); }); + }); }; } /** @@ -12840,13 +22872,6 @@ var OidcSecurityUserService = (function () { return this.getIdentityUserData() .map(function (data) { return _this.userData = data; }); }; - /** - * @param {?} error - * @return {?} - */ - OidcSecurityUserService.prototype.handleError = function (error) { - this.oidcSecurityCommon.logError(error); - }; return OidcSecurityUserService; }()); OidcSecurityUserService.decorators = [ @@ -12856,8 +22881,7 @@ OidcSecurityUserService.decorators = [ * @nocollapse */ OidcSecurityUserService.ctorParameters = function () { return [ - { type: _angular_http.Http, }, - { type: AuthConfiguration, }, + { type: _angular_common_http.HttpClient, }, { type: OidcSecurityCommon, }, { type: AuthWellKnownEndpoints, }, ]; }; @@ -12868,7 +22892,40 @@ AuthorizationResult.unauthorized = 3; AuthorizationResult[AuthorizationResult.authorized] = "authorized"; AuthorizationResult[AuthorizationResult.forbidden] = "forbidden"; AuthorizationResult[AuthorizationResult.unauthorized] = "unauthorized"; -var OidcSecurityService = (function () { +var UriEncoder = /** @class */ (function () { + function UriEncoder() { + } + /** + * @param {?} key + * @return {?} + */ + UriEncoder.prototype.encodeKey = function (key) { + return encodeURIComponent(key); + }; + /** + * @param {?} value + * @return {?} + */ + UriEncoder.prototype.encodeValue = function (value) { + return encodeURIComponent(value); + }; + /** + * @param {?} key + * @return {?} + */ + UriEncoder.prototype.decodeKey = function (key) { + return decodeURIComponent(key); + }; + /** + * @param {?} value + * @return {?} + */ + UriEncoder.prototype.decodeValue = function (value) { + return decodeURIComponent(value); + }; + return UriEncoder; +}()); +var OidcSecurityService = /** @class */ (function () { /** * @param {?} platformId * @param {?} http @@ -12894,6 +22951,7 @@ var OidcSecurityService = (function () { this.onAuthorizationResult = new _angular_core.EventEmitter(true); this.moduleSetup = false; this._isAuthorized = new rxjs_BehaviorSubject.BehaviorSubject(false); + this.lastUserData = undefined; this._userData = new rxjs_BehaviorSubject.BehaviorSubject(''); this.authWellKnownEndpointsLoaded = false; } @@ -12907,28 +22965,39 @@ var OidcSecurityService = (function () { this.oidcSecurityValidation = new OidcSecurityValidation(this.oidcSecurityCommon); this.oidcSecurityCheckSession.onCheckSessionChanged.subscribe(function () { _this.onCheckSessionChanged(); }); this.authWellKnownEndpoints.onWellKnownEndpointsLoaded.subscribe(function () { _this.onWellKnownEndpointsLoaded(); }); + this._userData.subscribe(function () { _this.onUserDataChanged(); }); this.oidcSecurityCommon.setupModule(); - if (this.oidcSecurityCommon.retrieve(this.oidcSecurityCommon.storage_user_data) !== '') { - this.setUserData(this.oidcSecurityCommon.retrieve(this.oidcSecurityCommon.storage_user_data)); + var /** @type {?} */ userData = this.oidcSecurityCommon.userData; + if (userData !== '') { + this.setUserData(userData); } - if (this.oidcSecurityCommon.retrieve(this.oidcSecurityCommon.storage_is_authorized) !== '') { - this.setIsAuthorized(this.oidcSecurityCommon.retrieve(this.oidcSecurityCommon.storage_is_authorized)); + var /** @type {?} */ isAuthorized = this.oidcSecurityCommon.isAuthorized; + if (isAuthorized !== undefined) { + this.setIsAuthorized(isAuthorized); + // Start the silent renew + this.runTokenValidation(); } this.oidcSecurityCommon.logDebug('STS server: ' + this.authConfiguration.stsServer); if (_angular_common.isPlatformBrowser(this.platformId)) { // Client only code. + this.authWellKnownEndpoints.onWellKnownEndpointsLoaded.subscribe(function () { + _this.moduleSetup = true; + _this.onModuleSetup.emit(); + if (_this.authConfiguration.silent_renew) { + _this.oidcSecuritySilentRenew.initRenew(); + } + if (_this.authConfiguration.start_checksession) { + _this.oidcSecurityCheckSession.init().subscribe(function () { + _this.oidcSecurityCheckSession.pollServerSession(_this.authConfiguration.client_id); + }); + } + }); this.authWellKnownEndpoints.setupModule(); - if (this.authConfiguration.silent_renew) { - this.oidcSecuritySilentRenew.initRenew(); - } - if (this.authConfiguration.start_checksession) { - this.oidcSecurityCheckSession.init().subscribe(function () { - _this.oidcSecurityCheckSession.pollServerSession(_this.authConfiguration.client_id); - }); - } } - this.moduleSetup = true; - this.onModuleSetup.emit(); + else { + this.moduleSetup = true; + this.onModuleSetup.emit(); + } }; /** * @return {?} @@ -12941,7 +23010,7 @@ var OidcSecurityService = (function () { * @return {?} */ OidcSecurityService.prototype.setUserData = function (userData) { - this.oidcSecurityCommon.store(this.oidcSecurityCommon.storage_user_data, userData); + this.oidcSecurityCommon.userData = userData; this._userData.next(userData); }; /** @@ -12992,26 +23061,26 @@ var OidcSecurityService = (function () { * @return {?} */ OidcSecurityService.prototype.setState = function (state) { - this.oidcSecurityCommon.store(this.oidcSecurityCommon.storage_auth_state_control, state); + this.oidcSecurityCommon.authStateControl = state; }; /** * @return {?} */ OidcSecurityService.prototype.getState = function () { - return this.oidcSecurityCommon.retrieve(this.oidcSecurityCommon.storage_auth_state_control); + return this.oidcSecurityCommon.authStateControl; }; /** * @param {?} params * @return {?} */ OidcSecurityService.prototype.setCustomRequestParameters = function (params) { - this.oidcSecurityCommon.store(this.oidcSecurityCommon.storage_custom_request_params, params); + this.oidcSecurityCommon.customRequestParams = params; }; /** * @return {?} */ OidcSecurityService.prototype.authorize = function () { - var /** @type {?} */ data = this.oidcSecurityCommon.retrieve(this.oidcSecurityCommon.storage_well_known_endpoints); + var /** @type {?} */ data = this.oidcSecurityCommon.wellKnownEndpoints; if (data && data !== '') { this.authWellKnownEndpointsLoaded = true; } @@ -13025,14 +23094,14 @@ var OidcSecurityService = (function () { } this.resetAuthorizationData(false); this.oidcSecurityCommon.logDebug('BEGIN Authorize, no auth data'); - var /** @type {?} */ state = this.oidcSecurityCommon.retrieve(this.oidcSecurityCommon.storage_auth_state_control); - if (state === '') { + var /** @type {?} */ state = this.oidcSecurityCommon.authStateControl; + if (state === '' || state === null) { state = Date.now() + '' + Math.random(); - this.oidcSecurityCommon.store(this.oidcSecurityCommon.storage_auth_state_control, state); + this.oidcSecurityCommon.authStateControl = state; } var /** @type {?} */ nonce = 'N' + Math.random() + '' + Date.now(); - this.oidcSecurityCommon.store(this.oidcSecurityCommon.storage_auth_nonce, nonce); - this.oidcSecurityCommon.logDebug('AuthorizedController created. local state: ' + this.oidcSecurityCommon.retrieve(this.oidcSecurityCommon.storage_auth_state_control)); + this.oidcSecurityCommon.authNonce = nonce; + this.oidcSecurityCommon.logDebug('AuthorizedController created. local state: ' + this.oidcSecurityCommon.authStateControl); var /** @type {?} */ url = this.createAuthorizeUrl(nonce, state, this.authWellKnownEndpoints.authorization_endpoint); window.location.href = url; }; @@ -13042,7 +23111,7 @@ var OidcSecurityService = (function () { */ OidcSecurityService.prototype.authorizedCallback = function (hash) { var _this = this; - var /** @type {?} */ silentRenew = this.oidcSecurityCommon.retrieve(this.oidcSecurityCommon.storage_silent_renew_running); + var /** @type {?} */ silentRenew = this.oidcSecurityCommon.silentRenewRunning; var /** @type {?} */ isRenewProcess = (silentRenew === 'running'); this.oidcSecurityCommon.logDebug('BEGIN authorizedCallback, no auth data'); this.resetAuthorizationData(isRenewProcess); @@ -13052,7 +23121,7 @@ var OidcSecurityService = (function () { result[parts[0]] = parts[1]; return result; }, {}); - this.oidcSecurityCommon.store(this.oidcSecurityCommon.storage_auth_result, result); + this.oidcSecurityCommon.authResult = result; this.oidcSecurityCommon.logDebug(result); this.oidcSecurityCommon.logDebug('authorizedCallback created, begin token validation'); var /** @type {?} */ access_token = ''; @@ -13064,18 +23133,16 @@ var OidcSecurityService = (function () { _this.jwtKeys = jwtKeys; if (!result.error) { // validate state - if (_this.oidcSecurityValidation.validateStateFromHashCallback(result.state, _this.oidcSecurityCommon.retrieve(_this.oidcSecurityCommon.storage_auth_state_control))) { + if (_this.oidcSecurityValidation.validateStateFromHashCallback(result.state, _this.oidcSecurityCommon.authStateControl)) { if (_this.authConfiguration.response_type === 'id_token token') { access_token = result.access_token; } id_token = result.id_token; - var /** @type {?} */ headerDecoded = void 0; decoded_id_token = _this.oidcSecurityValidation.getPayloadFromToken(id_token, false); - headerDecoded = _this.oidcSecurityValidation.getHeaderFromToken(id_token, false); // validate jwt signature if (_this.oidcSecurityValidation.validate_signature_id_token(id_token, _this.jwtKeys)) { // validate nonce - if (_this.oidcSecurityValidation.validate_id_token_nonce(decoded_id_token, _this.oidcSecurityCommon.retrieve(_this.oidcSecurityCommon.storage_auth_nonce))) { + if (_this.oidcSecurityValidation.validate_id_token_nonce(decoded_id_token, _this.oidcSecurityCommon.authNonce)) { // validate required fields id_token if (_this.oidcSecurityValidation.validate_required_id_token(decoded_id_token)) { // validate max offset from the id_token issue to now @@ -13134,7 +23201,7 @@ var OidcSecurityService = (function () { _this.oidcSecurityCommon.logWarning('authorizedCallback incorrect state'); } } - _this.oidcSecurityCommon.store(_this.oidcSecurityCommon.storage_silent_renew_running, ''); + _this.oidcSecurityCommon.silentRenewRunning = ''; if (authResponseIsValid) { _this.setAuthorizationData(access_token, id_token); if (_this.authConfiguration.auto_userinfo) { @@ -13144,7 +23211,7 @@ var OidcSecurityService = (function () { _this.onAuthorizationResult.emit(AuthorizationResult.authorized); } else { - _this.router.navigate([_this.authConfiguration.startup_route]); + _this.router.navigate([_this.authConfiguration.post_login_route]); } } else { @@ -13158,11 +23225,12 @@ var OidcSecurityService = (function () { }); } else { + _this.runTokenValidation(); if (_this.authConfiguration.trigger_authorization_result_event) { _this.onAuthorizationResult.emit(AuthorizationResult.authorized); } else { - _this.router.navigate([_this.authConfiguration.startup_route]); + _this.router.navigate([_this.authConfiguration.post_login_route]); } } } @@ -13188,14 +23256,14 @@ var OidcSecurityService = (function () { OidcSecurityService.prototype.getUserinfo = function (isRenewProcess, result, id_token, decoded_id_token) { var _this = this; if (isRenewProcess === void 0) { isRenewProcess = false; } - result = result ? result : this.oidcSecurityCommon.retrieve(this.oidcSecurityCommon.storage_auth_result); - id_token = id_token ? id_token : this.oidcSecurityCommon.retrieve(this.oidcSecurityCommon.storage_id_token); + result = result ? result : this.oidcSecurityCommon.authResult; + id_token = id_token ? id_token : this.oidcSecurityCommon.idToken; decoded_id_token = decoded_id_token ? decoded_id_token : this.oidcSecurityValidation.getPayloadFromToken(id_token, false); - return new rxjs_Rx.Observable(function (observer) { + return new rxjs_Observable.Observable(function (observer) { // flow id_token token if (_this.authConfiguration.response_type === 'id_token token') { if (isRenewProcess) { - _this.oidcSecurityCommon.store(_this.oidcSecurityCommon.storage_session_state, result.session_state); + _this.oidcSecurityCommon.sessionState = result.session_state; observer.next(true); observer.complete(); } @@ -13205,10 +23273,10 @@ var OidcSecurityService = (function () { _this.oidcSecurityCommon.logDebug('authorizedCallback id_token token flow'); if (_this.oidcSecurityValidation.validate_userdata_sub_id_token(decoded_id_token.sub, _this.oidcSecurityUserService.userData.sub)) { _this.setUserData(_this.oidcSecurityUserService.userData); - _this.oidcSecurityCommon.logDebug(_this.oidcSecurityCommon.retrieve(_this.oidcSecurityCommon.storage_access_token)); + _this.oidcSecurityCommon.logDebug(_this.oidcSecurityCommon.accessToken); _this.oidcSecurityCommon.logDebug(_this.oidcSecurityUserService.userData); - _this.oidcSecurityCommon.store(_this.oidcSecurityCommon.storage_session_state, result.session_state); - _this.runTokenValidatation(); + _this.oidcSecurityCommon.sessionState = result.session_state; + _this.runTokenValidation(); observer.next(true); } else { @@ -13223,13 +23291,13 @@ var OidcSecurityService = (function () { } else { _this.oidcSecurityCommon.logDebug('authorizedCallback id_token flow'); - _this.oidcSecurityCommon.logDebug(_this.oidcSecurityCommon.retrieve(_this.oidcSecurityCommon.storage_access_token)); + _this.oidcSecurityCommon.logDebug(_this.oidcSecurityCommon.accessToken); // userData is set to the id_token decoded. No access_token. _this.oidcSecurityUserService.userData = decoded_id_token; _this.setUserData(_this.oidcSecurityUserService.userData); - _this.oidcSecurityCommon.store(_this.oidcSecurityCommon.storage_session_state, result.session_state); + _this.oidcSecurityCommon.sessionState = result.session_state; if (!isRenewProcess) { - _this.runTokenValidatation(); + _this.runTokenValidation(); } observer.next(true); observer.complete(); @@ -13244,7 +23312,7 @@ var OidcSecurityService = (function () { this.oidcSecurityCommon.logDebug('BEGIN Authorize, no auth data'); if (this.authWellKnownEndpoints.end_session_endpoint) { var /** @type {?} */ end_session_endpoint = this.authWellKnownEndpoints.end_session_endpoint; - var /** @type {?} */ id_token_hint = this.oidcSecurityCommon.retrieve(this.oidcSecurityCommon.storage_id_token); + var /** @type {?} */ id_token_hint = this.oidcSecurityCommon.idToken; var /** @type {?} */ url = this.createEndSessionUrl(end_session_endpoint, id_token_hint); this.resetAuthorizationData(false); if (this.authConfiguration.start_checksession && this.checkSessionChanged) { @@ -13263,9 +23331,9 @@ var OidcSecurityService = (function () { * @return {?} */ OidcSecurityService.prototype.successful_validation = function () { - this.oidcSecurityCommon.store(this.oidcSecurityCommon.storage_auth_nonce, ''); + this.oidcSecurityCommon.authNonce = ''; if (this.authConfiguration.auto_clean_state_after_authentication) { - this.oidcSecurityCommon.store(this.oidcSecurityCommon.storage_auth_state_control, ''); + this.oidcSecurityCommon.authStateControl = ''; } this.oidcSecurityCommon.logDebug('AuthorizedCallback token(s) validated, continue'); }; @@ -13274,16 +23342,16 @@ var OidcSecurityService = (function () { */ OidcSecurityService.prototype.refreshSession = function () { this.oidcSecurityCommon.logDebug('BEGIN refresh session Authorize'); - var /** @type {?} */ state = this.oidcSecurityCommon.retrieve(this.oidcSecurityCommon.storage_auth_state_control); - if (state === '') { + var /** @type {?} */ state = this.oidcSecurityCommon.authStateControl; + if (state === '' || state === null) { state = Date.now() + '' + Math.random(); - this.oidcSecurityCommon.store(this.oidcSecurityCommon.storage_auth_state_control, state); + this.oidcSecurityCommon.authStateControl = state; } var /** @type {?} */ nonce = 'N' + Math.random() + '' + Date.now(); - this.oidcSecurityCommon.store(this.oidcSecurityCommon.storage_auth_nonce, nonce); - this.oidcSecurityCommon.logDebug('RefreshSession created. adding myautostate: ' + this.oidcSecurityCommon.retrieve(this.oidcSecurityCommon.storage_auth_state_control)); - var /** @type {?} */ url = this.createAuthorizeUrl(nonce, state, this.authWellKnownEndpoints.authorization_endpoint); - this.oidcSecurityCommon.store(this.oidcSecurityCommon.storage_silent_renew_running, 'running'); + this.oidcSecurityCommon.authNonce = nonce; + this.oidcSecurityCommon.logDebug('RefreshSession created. adding myautostate: ' + this.oidcSecurityCommon.authStateControl); + var /** @type {?} */ url = this.createAuthorizeUrl(nonce, state, this.authWellKnownEndpoints.authorization_endpoint, 'none'); + this.oidcSecurityCommon.silentRenewRunning = 'running'; this.oidcSecuritySilentRenew.startRenew(url); }; /** @@ -13292,36 +23360,43 @@ var OidcSecurityService = (function () { * @return {?} */ OidcSecurityService.prototype.setAuthorizationData = function (access_token, id_token) { - if (this.oidcSecurityCommon.retrieve(this.oidcSecurityCommon.storage_access_token) !== '') { - this.oidcSecurityCommon.store(this.oidcSecurityCommon.storage_access_token, ''); + if (this.oidcSecurityCommon.accessToken !== '') { + this.oidcSecurityCommon.accessToken = ''; } this.oidcSecurityCommon.logDebug(access_token); this.oidcSecurityCommon.logDebug(id_token); this.oidcSecurityCommon.logDebug('storing to storage, getting the roles'); - this.oidcSecurityCommon.store(this.oidcSecurityCommon.storage_access_token, access_token); - this.oidcSecurityCommon.store(this.oidcSecurityCommon.storage_id_token, id_token); + this.oidcSecurityCommon.accessToken = access_token; + this.oidcSecurityCommon.idToken = id_token; this.setIsAuthorized(true); - this.oidcSecurityCommon.store(this.oidcSecurityCommon.storage_is_authorized, true); + this.oidcSecurityCommon.isAuthorized = true; }; /** * @param {?} nonce * @param {?} state * @param {?} authorization_endpoint + * @param {?=} prompt * @return {?} */ - OidcSecurityService.prototype.createAuthorizeUrl = function (nonce, state, authorization_endpoint) { + OidcSecurityService.prototype.createAuthorizeUrl = function (nonce, state, authorization_endpoint, prompt) { var /** @type {?} */ urlParts = authorization_endpoint.split('?'); var /** @type {?} */ authorizationUrl = urlParts[0]; - var /** @type {?} */ params = new _angular_http.URLSearchParams(urlParts[1]); - params.set('client_id', this.authConfiguration.client_id); - params.set('redirect_uri', this.authConfiguration.redirect_url); - params.set('response_type', this.authConfiguration.response_type); - params.set('scope', this.authConfiguration.scope); - params.set('nonce', nonce); - params.set('state', state); - var /** @type {?} */ customParams = Object.assign({}, this.oidcSecurityCommon.retrieve(this.oidcSecurityCommon.storage_custom_request_params)); + var /** @type {?} */ params = new _angular_common_http.HttpParams({ fromString: urlParts[1], encoder: new UriEncoder() }); + params = params.set('client_id', this.authConfiguration.client_id); + params = params.append('redirect_uri', this.authConfiguration.redirect_url); + params = params.append('response_type', this.authConfiguration.response_type); + params = params.append('scope', this.authConfiguration.scope); + params = params.append('nonce', nonce); + params = params.append('state', state); + if (prompt) { + params = params.append('prompt', prompt); + } + if (this.authConfiguration.hd_param) { + params = params.append('hd', this.authConfiguration.hd_param); + } + var /** @type {?} */ customParams = Object.assign({}, this.oidcSecurityCommon.customRequestParams); Object.keys(customParams).forEach(function (key) { - params.set(key, customParams[key]); + params = params.append(key, customParams[key].toString()); }); return authorizationUrl + "?" + params; }; @@ -13333,9 +23408,9 @@ var OidcSecurityService = (function () { OidcSecurityService.prototype.createEndSessionUrl = function (end_session_endpoint, id_token_hint) { var /** @type {?} */ urlParts = end_session_endpoint.split('?'); var /** @type {?} */ authorizationEndsessionUrl = urlParts[0]; - var /** @type {?} */ params = new _angular_http.URLSearchParams(urlParts[1]); - params.set('id_token_hint', id_token_hint); - params.set('post_logout_redirect_uri', this.authConfiguration.post_logout_redirect_uri); + var /** @type {?} */ params = new _angular_common_http.HttpParams({ fromString: urlParts[1], encoder: new UriEncoder() }); + params = params.set('id_token_hint', id_token_hint); + params = params.append('post_logout_redirect_uri', this.authConfiguration.post_logout_redirect_uri); return authorizationEndsessionUrl + "?" + params; }; /** @@ -13344,6 +23419,10 @@ var OidcSecurityService = (function () { */ OidcSecurityService.prototype.resetAuthorizationData = function (isRenewProcess) { if (!isRenewProcess) { + if (this.authConfiguration.auto_userinfo) { + // Clear user data. Fixes #97. + this.setUserData(''); + } this.setIsAuthorized(false); this.oidcSecurityCommon.resetStorageData(isRenewProcess); this.checkSessionChanged = false; @@ -13364,8 +23443,8 @@ var OidcSecurityService = (function () { } } else if (error.status == 401) { - var /** @type {?} */ silentRenew = this.oidcSecurityCommon.retrieve(this.oidcSecurityCommon.storage_silent_renew_running); - this.resetAuthorizationData(silentRenew); + var /** @type {?} */ silentRenew = this.oidcSecurityCommon.silentRenewRunning; + this.resetAuthorizationData(silentRenew !== ''); if (this.authConfiguration.trigger_authorization_result_event) { this.onAuthorizationResult.emit(AuthorizationResult.unauthorized); } @@ -13391,10 +23470,13 @@ var OidcSecurityService = (function () { /** * @return {?} */ - OidcSecurityService.prototype.runGetSigningKeys = function () { - var _this = this; - this.getSigningKeys() - .subscribe(function (jwtKeys) { return _this.jwtKeys = jwtKeys; }, function (error) { return _this.errorMessage = (error); }); + OidcSecurityService.prototype.onUserDataChanged = function () { + this.oidcSecurityCommon.logDebug("onUserDataChanged: last = " + this.lastUserData + ", new = " + this._userData.value); + if (this.lastUserData && !this._userData.value) { + this.oidcSecurityCommon.logDebug('onUserDataChanged: Logout detected.'); + // TODO should we have an action here + } + this.lastUserData = this._userData.value; }; /** * @return {?} @@ -13402,46 +23484,41 @@ var OidcSecurityService = (function () { OidcSecurityService.prototype.getSigningKeys = function () { this.oidcSecurityCommon.logDebug('jwks_uri: ' + this.authWellKnownEndpoints.jwks_uri); return this.http.get(this.authWellKnownEndpoints.jwks_uri) - .map(this.extractData) .catch(this.handleErrorGetSigningKeys); }; - /** - * @param {?} res - * @return {?} - */ - OidcSecurityService.prototype.extractData = function (res) { - var /** @type {?} */ body = res.json(); - return body; - }; /** * @param {?} error * @return {?} */ OidcSecurityService.prototype.handleErrorGetSigningKeys = function (error) { var /** @type {?} */ errMsg; - if (error instanceof _angular_http.Response) { + if (error instanceof Response) { var /** @type {?} */ body = error.json() || {}; - var /** @type {?} */ err = body.error || JSON.stringify(body); + var /** @type {?} */ err = JSON.stringify(body); errMsg = error.status + " - " + (error.statusText || '') + " " + err; } else { errMsg = error.message ? error.message : error.toString(); } console.error(errMsg); - return rxjs_Rx.Observable.throw(errMsg); + return rxjs_Observable.Observable.throw(errMsg); }; /** * @return {?} */ - OidcSecurityService.prototype.runTokenValidatation = function () { + OidcSecurityService.prototype.runTokenValidation = function () { var _this = this; - var /** @type {?} */ source = rxjs_Rx.Observable.timer(3000, 3000) + if (this.runTokenValidationRunning) { + return; + } + this.runTokenValidationRunning = true; + var /** @type {?} */ source = rxjs_Observable.Observable.timer(5000, 3000) .timeInterval() .pluck('interval') .take(10000); - var /** @type {?} */ subscription = source.subscribe(function () { - if (_this._isAuthorizedValue) { - if (_this.oidcSecurityValidation.isTokenExpired(_this.oidcSecurityCommon.retrieve(_this.oidcSecurityCommon.storage_id_token))) { + source.subscribe(function () { + if (_this._userData.value) { + if (_this.oidcSecurityValidation.isTokenExpired(_this.oidcSecurityCommon.idToken, _this.authConfiguration.silent_renew_offset_in_seconds)) { _this.oidcSecurityCommon.logDebug('IsAuthorized: id_token isTokenExpired, start silent renew if active'); if (_this.authConfiguration.silent_renew) { _this.refreshSession(); @@ -13467,7 +23544,7 @@ OidcSecurityService.decorators = [ */ OidcSecurityService.ctorParameters = function () { return [ { type: Object, decorators: [{ type: _angular_core.Inject, args: [_angular_core.PLATFORM_ID,] },] }, - { type: _angular_http.Http, }, + { type: _angular_common_http.HttpClient, }, { type: AuthConfiguration, }, { type: _angular_router.Router, }, { type: OidcSecurityCheckSession, }, @@ -13480,7 +23557,7 @@ OidcSecurityService.propDecorators = { 'onModuleSetup': [{ type: _angular_core.Output },], 'onAuthorizationResult': [{ type: _angular_core.Output },], }; -var AuthModule = (function () { +var AuthModule = /** @class */ (function () { function AuthModule() { } /** @@ -13508,30 +23585,6 @@ var AuthModule = (function () { ] }; }; - /** - * @param {?=} token - * @return {?} - */ - AuthModule.forChild = function (token) { - if (token === void 0) { token = {}; } - return { - ngModule: AuthModule, - providers: [ - OidcSecurityService, - OidcSecurityValidation, - OidcSecurityCheckSession, - OidcSecuritySilentRenew, - OidcSecurityUserService, - OidcSecurityCommon, - AuthConfiguration, - AuthWellKnownEndpoints, - { - provide: OidcSecurityStorage, - useClass: token.storage || BrowserStorage - } - ] - }; - }; return AuthModule; }()); AuthModule.decorators = [ @@ -13551,11 +23604,11 @@ exports.OidcSecurityCommon = OidcSecurityCommon; exports.OidcSecurityStorage = OidcSecurityStorage; exports.BrowserStorage = BrowserStorage; exports.AuthWellKnownEndpoints = AuthWellKnownEndpoints; +exports.AuthorizationResult = AuthorizationResult; exports.AuthConfiguration = AuthConfiguration; exports.OpenIDImplicitFlowConfiguration = OpenIDImplicitFlowConfiguration; exports.DefaultConfiguration = DefaultConfiguration; exports.AuthModule = AuthModule; -exports.AuthorizationResult = AuthorizationResult; Object.defineProperty(exports, '__esModule', { value: true }); @@ -13564,12 +23617,12 @@ Object.defineProperty(exports, '__esModule', { value: true }); /***/ }), -/* 48 */ +/* 28 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return AppComponent; }); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__(10); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__(4); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0__angular_core__); var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; @@ -13584,8 +23637,8 @@ var AppComponent = (function () { AppComponent = __decorate([ __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Component"])({ selector: 'app', - template: __webpack_require__(103), - styles: [__webpack_require__(375)] + template: __webpack_require__(83), + styles: [__webpack_require__(118)] }) ], AppComponent); return AppComponent; @@ -13594,20474 +23647,12143 @@ var AppComponent = (function () { /***/ }), -/* 49 */ +/* 29 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; +module.exports = Comment; -var Tokenizer = __webpack_require__(19), - HTML = __webpack_require__(11); - -//Aliases -var $ = HTML.TAG_NAMES, - NS = HTML.NAMESPACES, - ATTRS = HTML.ATTRS; +var Node = __webpack_require__(3); +var CharacterData = __webpack_require__(8); +function Comment(doc, data) { + this.nodeType = Node.COMMENT_NODE; + this.ownerDocument = doc; + this._data = data; + this._index = undefined; +} -//MIME types -var MIME_TYPES = { - TEXT_HTML: 'text/html', - APPLICATION_XML: 'application/xhtml+xml' +var nodeValue = { + get: function() { return this._data; }, + set: function(v) { + this._data = v; + if (this.rooted) + this.ownerDocument.mutateValue(this); + } }; -//Attributes -var DEFINITION_URL_ATTR = 'definitionurl', - ADJUSTED_DEFINITION_URL_ATTR = 'definitionURL', - SVG_ATTRS_ADJUSTMENT_MAP = { - 'attributename': 'attributeName', - 'attributetype': 'attributeType', - 'basefrequency': 'baseFrequency', - 'baseprofile': 'baseProfile', - 'calcmode': 'calcMode', - 'clippathunits': 'clipPathUnits', - 'diffuseconstant': 'diffuseConstant', - 'edgemode': 'edgeMode', - 'filterunits': 'filterUnits', - 'glyphref': 'glyphRef', - 'gradienttransform': 'gradientTransform', - 'gradientunits': 'gradientUnits', - 'kernelmatrix': 'kernelMatrix', - 'kernelunitlength': 'kernelUnitLength', - 'keypoints': 'keyPoints', - 'keysplines': 'keySplines', - 'keytimes': 'keyTimes', - 'lengthadjust': 'lengthAdjust', - 'limitingconeangle': 'limitingConeAngle', - 'markerheight': 'markerHeight', - 'markerunits': 'markerUnits', - 'markerwidth': 'markerWidth', - 'maskcontentunits': 'maskContentUnits', - 'maskunits': 'maskUnits', - 'numoctaves': 'numOctaves', - 'pathlength': 'pathLength', - 'patterncontentunits': 'patternContentUnits', - 'patterntransform': 'patternTransform', - 'patternunits': 'patternUnits', - 'pointsatx': 'pointsAtX', - 'pointsaty': 'pointsAtY', - 'pointsatz': 'pointsAtZ', - 'preservealpha': 'preserveAlpha', - 'preserveaspectratio': 'preserveAspectRatio', - 'primitiveunits': 'primitiveUnits', - 'refx': 'refX', - 'refy': 'refY', - 'repeatcount': 'repeatCount', - 'repeatdur': 'repeatDur', - 'requiredextensions': 'requiredExtensions', - 'requiredfeatures': 'requiredFeatures', - 'specularconstant': 'specularConstant', - 'specularexponent': 'specularExponent', - 'spreadmethod': 'spreadMethod', - 'startoffset': 'startOffset', - 'stddeviation': 'stdDeviation', - 'stitchtiles': 'stitchTiles', - 'surfacescale': 'surfaceScale', - 'systemlanguage': 'systemLanguage', - 'tablevalues': 'tableValues', - 'targetx': 'targetX', - 'targety': 'targetY', - 'textlength': 'textLength', - 'viewbox': 'viewBox', - 'viewtarget': 'viewTarget', - 'xchannelselector': 'xChannelSelector', - 'ychannelselector': 'yChannelSelector', - 'zoomandpan': 'zoomAndPan' - }, - XML_ATTRS_ADJUSTMENT_MAP = { - 'xlink:actuate': {prefix: 'xlink', name: 'actuate', namespace: NS.XLINK}, - 'xlink:arcrole': {prefix: 'xlink', name: 'arcrole', namespace: NS.XLINK}, - 'xlink:href': {prefix: 'xlink', name: 'href', namespace: NS.XLINK}, - 'xlink:role': {prefix: 'xlink', name: 'role', namespace: NS.XLINK}, - 'xlink:show': {prefix: 'xlink', name: 'show', namespace: NS.XLINK}, - 'xlink:title': {prefix: 'xlink', name: 'title', namespace: NS.XLINK}, - 'xlink:type': {prefix: 'xlink', name: 'type', namespace: NS.XLINK}, - 'xml:base': {prefix: 'xml', name: 'base', namespace: NS.XML}, - 'xml:lang': {prefix: 'xml', name: 'lang', namespace: NS.XML}, - 'xml:space': {prefix: 'xml', name: 'space', namespace: NS.XML}, - 'xmlns': {prefix: '', name: 'xmlns', namespace: NS.XMLNS}, - 'xmlns:xlink': {prefix: 'xmlns', name: 'xlink', namespace: NS.XMLNS} - - }; - -//SVG tag names adjustment map -var SVG_TAG_NAMES_ADJUSTMENT_MAP = exports.SVG_TAG_NAMES_ADJUSTMENT_MAP = { - 'altglyph': 'altGlyph', - 'altglyphdef': 'altGlyphDef', - 'altglyphitem': 'altGlyphItem', - 'animatecolor': 'animateColor', - 'animatemotion': 'animateMotion', - 'animatetransform': 'animateTransform', - 'clippath': 'clipPath', - 'feblend': 'feBlend', - 'fecolormatrix': 'feColorMatrix', - 'fecomponenttransfer': 'feComponentTransfer', - 'fecomposite': 'feComposite', - 'feconvolvematrix': 'feConvolveMatrix', - 'fediffuselighting': 'feDiffuseLighting', - 'fedisplacementmap': 'feDisplacementMap', - 'fedistantlight': 'feDistantLight', - 'feflood': 'feFlood', - 'fefunca': 'feFuncA', - 'fefuncb': 'feFuncB', - 'fefuncg': 'feFuncG', - 'fefuncr': 'feFuncR', - 'fegaussianblur': 'feGaussianBlur', - 'feimage': 'feImage', - 'femerge': 'feMerge', - 'femergenode': 'feMergeNode', - 'femorphology': 'feMorphology', - 'feoffset': 'feOffset', - 'fepointlight': 'fePointLight', - 'fespecularlighting': 'feSpecularLighting', - 'fespotlight': 'feSpotLight', - 'fetile': 'feTile', - 'feturbulence': 'feTurbulence', - 'foreignobject': 'foreignObject', - 'glyphref': 'glyphRef', - 'lineargradient': 'linearGradient', - 'radialgradient': 'radialGradient', - 'textpath': 'textPath' -}; +Comment.prototype = Object.create(CharacterData.prototype, { + nodeName: { value: '#comment' }, + nodeValue: nodeValue, + textContent: nodeValue, + data: nodeValue, -//Tags that causes exit from foreign content -var EXITS_FOREIGN_CONTENT = Object.create(null); - -EXITS_FOREIGN_CONTENT[$.B] = true; -EXITS_FOREIGN_CONTENT[$.BIG] = true; -EXITS_FOREIGN_CONTENT[$.BLOCKQUOTE] = true; -EXITS_FOREIGN_CONTENT[$.BODY] = true; -EXITS_FOREIGN_CONTENT[$.BR] = true; -EXITS_FOREIGN_CONTENT[$.CENTER] = true; -EXITS_FOREIGN_CONTENT[$.CODE] = true; -EXITS_FOREIGN_CONTENT[$.DD] = true; -EXITS_FOREIGN_CONTENT[$.DIV] = true; -EXITS_FOREIGN_CONTENT[$.DL] = true; -EXITS_FOREIGN_CONTENT[$.DT] = true; -EXITS_FOREIGN_CONTENT[$.EM] = true; -EXITS_FOREIGN_CONTENT[$.EMBED] = true; -EXITS_FOREIGN_CONTENT[$.H1] = true; -EXITS_FOREIGN_CONTENT[$.H2] = true; -EXITS_FOREIGN_CONTENT[$.H3] = true; -EXITS_FOREIGN_CONTENT[$.H4] = true; -EXITS_FOREIGN_CONTENT[$.H5] = true; -EXITS_FOREIGN_CONTENT[$.H6] = true; -EXITS_FOREIGN_CONTENT[$.HEAD] = true; -EXITS_FOREIGN_CONTENT[$.HR] = true; -EXITS_FOREIGN_CONTENT[$.I] = true; -EXITS_FOREIGN_CONTENT[$.IMG] = true; -EXITS_FOREIGN_CONTENT[$.LI] = true; -EXITS_FOREIGN_CONTENT[$.LISTING] = true; -EXITS_FOREIGN_CONTENT[$.MENU] = true; -EXITS_FOREIGN_CONTENT[$.META] = true; -EXITS_FOREIGN_CONTENT[$.NOBR] = true; -EXITS_FOREIGN_CONTENT[$.OL] = true; -EXITS_FOREIGN_CONTENT[$.P] = true; -EXITS_FOREIGN_CONTENT[$.PRE] = true; -EXITS_FOREIGN_CONTENT[$.RUBY] = true; -EXITS_FOREIGN_CONTENT[$.S] = true; -EXITS_FOREIGN_CONTENT[$.SMALL] = true; -EXITS_FOREIGN_CONTENT[$.SPAN] = true; -EXITS_FOREIGN_CONTENT[$.STRONG] = true; -EXITS_FOREIGN_CONTENT[$.STRIKE] = true; -EXITS_FOREIGN_CONTENT[$.SUB] = true; -EXITS_FOREIGN_CONTENT[$.SUP] = true; -EXITS_FOREIGN_CONTENT[$.TABLE] = true; -EXITS_FOREIGN_CONTENT[$.TT] = true; -EXITS_FOREIGN_CONTENT[$.U] = true; -EXITS_FOREIGN_CONTENT[$.UL] = true; -EXITS_FOREIGN_CONTENT[$.VAR] = true; - -//Check exit from foreign content -exports.causesExit = function (startTagToken) { - var tn = startTagToken.tagName; - var isFontWithAttrs = tn === $.FONT && (Tokenizer.getTokenAttr(startTagToken, ATTRS.COLOR) !== null || - Tokenizer.getTokenAttr(startTagToken, ATTRS.SIZE) !== null || - Tokenizer.getTokenAttr(startTagToken, ATTRS.FACE) !== null); - - return isFontWithAttrs ? true : EXITS_FOREIGN_CONTENT[tn]; -}; + // Utility methods + clone: { value: function clone() { + return new Comment(this.ownerDocument, this._data); + }}, +}); -//Token adjustments -exports.adjustTokenMathMLAttrs = function (token) { - for (var i = 0; i < token.attrs.length; i++) { - if (token.attrs[i].name === DEFINITION_URL_ATTR) { - token.attrs[i].name = ADJUSTED_DEFINITION_URL_ATTR; - break; - } - } -}; -exports.adjustTokenSVGAttrs = function (token) { - for (var i = 0; i < token.attrs.length; i++) { - var adjustedAttrName = SVG_ATTRS_ADJUSTMENT_MAP[token.attrs[i].name]; - - if (adjustedAttrName) - token.attrs[i].name = adjustedAttrName; - } -}; - -exports.adjustTokenXMLAttrs = function (token) { - for (var i = 0; i < token.attrs.length; i++) { - var adjustedAttrEntry = XML_ATTRS_ADJUSTMENT_MAP[token.attrs[i].name]; - - if (adjustedAttrEntry) { - token.attrs[i].prefix = adjustedAttrEntry.prefix; - token.attrs[i].name = adjustedAttrEntry.name; - token.attrs[i].namespace = adjustedAttrEntry.namespace; - } - } -}; - -exports.adjustTokenSVGTagName = function (token) { - var adjustedTagName = SVG_TAG_NAMES_ADJUSTMENT_MAP[token.tagName]; - - if (adjustedTagName) - token.tagName = adjustedTagName; -}; +/***/ }), +/* 30 */ +/***/ (function(module, exports, __webpack_require__) { -//Integration points -function isMathMLTextIntegrationPoint(tn, ns) { - return ns === NS.MATHML && (tn === $.MI || tn === $.MO || tn === $.MN || tn === $.MS || tn === $.MTEXT); -} +"use strict"; -function isHtmlIntegrationPoint(tn, ns, attrs) { - if (ns === NS.MATHML && tn === $.ANNOTATION_XML) { - for (var i = 0; i < attrs.length; i++) { - if (attrs[i].name === ATTRS.ENCODING) { - var value = attrs[i].value.toLowerCase(); +module.exports = DOMException; + +var INDEX_SIZE_ERR = 1; +var HIERARCHY_REQUEST_ERR = 3; +var WRONG_DOCUMENT_ERR = 4; +var INVALID_CHARACTER_ERR = 5; +var NO_MODIFICATION_ALLOWED_ERR = 7; +var NOT_FOUND_ERR = 8; +var NOT_SUPPORTED_ERR = 9; +var INVALID_STATE_ERR = 11; +var SYNTAX_ERR = 12; +var INVALID_MODIFICATION_ERR = 13; +var NAMESPACE_ERR = 14; +var INVALID_ACCESS_ERR = 15; +var TYPE_MISMATCH_ERR = 17; +var SECURITY_ERR = 18; +var NETWORK_ERR = 19; +var ABORT_ERR = 20; +var URL_MISMATCH_ERR = 21; +var QUOTA_EXCEEDED_ERR = 22; +var TIMEOUT_ERR = 23; +var INVALID_NODE_TYPE_ERR = 24; +var DATA_CLONE_ERR = 25; + +// Code to name +var names = [ + null, // No error with code 0 + 'INDEX_SIZE_ERR', + null, // historical + 'HIERARCHY_REQUEST_ERR', + 'WRONG_DOCUMENT_ERR', + 'INVALID_CHARACTER_ERR', + null, // historical + 'NO_MODIFICATION_ALLOWED_ERR', + 'NOT_FOUND_ERR', + 'NOT_SUPPORTED_ERR', + null, // historical + 'INVALID_STATE_ERR', + 'SYNTAX_ERR', + 'INVALID_MODIFICATION_ERR', + 'NAMESPACE_ERR', + 'INVALID_ACCESS_ERR', + null, // historical + 'TYPE_MISMATCH_ERR', + 'SECURITY_ERR', + 'NETWORK_ERR', + 'ABORT_ERR', + 'URL_MISMATCH_ERR', + 'QUOTA_EXCEEDED_ERR', + 'TIMEOUT_ERR', + 'INVALID_NODE_TYPE_ERR', + 'DATA_CLONE_ERR', +]; - return value === MIME_TYPES.TEXT_HTML || value === MIME_TYPES.APPLICATION_XML; - } - } - } +// Code to message +// These strings are from the 13 May 2011 Editor's Draft of DOM Core. +// http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html +// Copyright © 2011 W3C® (MIT, ERCIM, Keio), All Rights Reserved. +// Used under the terms of the W3C Document License: +// http://www.w3.org/Consortium/Legal/2002/copyright-documents-20021231 +var messages = [ + null, // No error with code 0 + 'INDEX_SIZE_ERR (1): the index is not in the allowed range', + null, + 'HIERARCHY_REQUEST_ERR (3): the operation would yield an incorrect nodes model', + 'WRONG_DOCUMENT_ERR (4): the object is in the wrong Document, a call to importNode is required', + 'INVALID_CHARACTER_ERR (5): the string contains invalid characters', + null, + 'NO_MODIFICATION_ALLOWED_ERR (7): the object can not be modified', + 'NOT_FOUND_ERR (8): the object can not be found here', + 'NOT_SUPPORTED_ERR (9): this operation is not supported', + null, + 'INVALID_STATE_ERR (11): the object is in an invalid state', + 'SYNTAX_ERR (12): the string did not match the expected pattern', + 'INVALID_MODIFICATION_ERR (13): the object can not be modified in this way', + 'NAMESPACE_ERR (14): the operation is not allowed by Namespaces in XML', + 'INVALID_ACCESS_ERR (15): the object does not support the operation or argument', + null, + 'TYPE_MISMATCH_ERR (17): the type of the object does not match the expected type', + 'SECURITY_ERR (18): the operation is insecure', + 'NETWORK_ERR (19): a network error occurred', + 'ABORT_ERR (20): the user aborted an operation', + 'URL_MISMATCH_ERR (21): the given URL does not match another URL', + 'QUOTA_EXCEEDED_ERR (22): the quota has been exceeded', + 'TIMEOUT_ERR (23): a timeout occurred', + 'INVALID_NODE_TYPE_ERR (24): the supplied node is invalid or has an invalid ancestor for this operation', + 'DATA_CLONE_ERR (25): the object can not be cloned.' +]; - return ns === NS.SVG && (tn === $.FOREIGN_OBJECT || tn === $.DESC || tn === $.TITLE); +// Name to code +var constants = { + INDEX_SIZE_ERR: INDEX_SIZE_ERR, + DOMSTRING_SIZE_ERR: 2, // historical + HIERARCHY_REQUEST_ERR: HIERARCHY_REQUEST_ERR, + WRONG_DOCUMENT_ERR: WRONG_DOCUMENT_ERR, + INVALID_CHARACTER_ERR: INVALID_CHARACTER_ERR, + NO_DATA_ALLOWED_ERR: 6, // historical + NO_MODIFICATION_ALLOWED_ERR: NO_MODIFICATION_ALLOWED_ERR, + NOT_FOUND_ERR: NOT_FOUND_ERR, + NOT_SUPPORTED_ERR: NOT_SUPPORTED_ERR, + INUSE_ATTRIBUTE_ERR: 10, // historical + INVALID_STATE_ERR: INVALID_STATE_ERR, + SYNTAX_ERR: SYNTAX_ERR, + INVALID_MODIFICATION_ERR: INVALID_MODIFICATION_ERR, + NAMESPACE_ERR: NAMESPACE_ERR, + INVALID_ACCESS_ERR: INVALID_ACCESS_ERR, + VALIDATION_ERR: 16, // historical + TYPE_MISMATCH_ERR: TYPE_MISMATCH_ERR, + SECURITY_ERR: SECURITY_ERR, + NETWORK_ERR: NETWORK_ERR, + ABORT_ERR: ABORT_ERR, + URL_MISMATCH_ERR: URL_MISMATCH_ERR, + QUOTA_EXCEEDED_ERR: QUOTA_EXCEEDED_ERR, + TIMEOUT_ERR: TIMEOUT_ERR, + INVALID_NODE_TYPE_ERR: INVALID_NODE_TYPE_ERR, + DATA_CLONE_ERR: DATA_CLONE_ERR +}; + +function DOMException(code) { + Error.call(this); + Error.captureStackTrace(this, this.constructor); + this.code = code; + this.message = messages[code]; + this.name = names[code]; +} +DOMException.prototype.__proto__ = Error.prototype; + +// Initialize the constants on DOMException and DOMException.prototype +for(var c in constants) { + var v = { value: constants[c] }; + Object.defineProperty(DOMException, c, v); + Object.defineProperty(DOMException.prototype, c, v); } -exports.isIntegrationPoint = function (tn, ns, attrs, foreignNS) { - if ((!foreignNS || foreignNS === NS.HTML) && isHtmlIntegrationPoint(tn, ns, attrs)) - return true; - - if ((!foreignNS || foreignNS === NS.MATHML) && isMathMLTextIntegrationPoint(tn, ns)) - return true; - - return false; -}; - /***/ }), -/* 50 */ +/* 31 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; +// DOMTokenList implementation based on https://github.com/Raynos/DOM-shim +var utils = __webpack_require__(1); -var Tokenizer = __webpack_require__(19), - OpenElementStack = __webpack_require__(51), - FormattingElementList = __webpack_require__(112), - locationInfoMixin = __webpack_require__(110), - defaultTreeAdapter = __webpack_require__(36), - doctype = __webpack_require__(33), - foreignContent = __webpack_require__(49), - mergeOptions = __webpack_require__(34), - UNICODE = __webpack_require__(18), - HTML = __webpack_require__(11); - -//Aliases -var $ = HTML.TAG_NAMES, - NS = HTML.NAMESPACES, - ATTRS = HTML.ATTRS; - -var DEFAULT_OPTIONS = { - locationInfo: false, - treeAdapter: defaultTreeAdapter -}; +module.exports = DOMTokenList; -//Misc constants -var HIDDEN_INPUT_TYPE = 'hidden'; - -//Adoption agency loops iteration count -var AA_OUTER_LOOP_ITER = 8, - AA_INNER_LOOP_ITER = 3; - -//Insertion modes -var INITIAL_MODE = 'INITIAL_MODE', - BEFORE_HTML_MODE = 'BEFORE_HTML_MODE', - BEFORE_HEAD_MODE = 'BEFORE_HEAD_MODE', - IN_HEAD_MODE = 'IN_HEAD_MODE', - AFTER_HEAD_MODE = 'AFTER_HEAD_MODE', - IN_BODY_MODE = 'IN_BODY_MODE', - TEXT_MODE = 'TEXT_MODE', - IN_TABLE_MODE = 'IN_TABLE_MODE', - IN_TABLE_TEXT_MODE = 'IN_TABLE_TEXT_MODE', - IN_CAPTION_MODE = 'IN_CAPTION_MODE', - IN_COLUMN_GROUP_MODE = 'IN_COLUMN_GROUP_MODE', - IN_TABLE_BODY_MODE = 'IN_TABLE_BODY_MODE', - IN_ROW_MODE = 'IN_ROW_MODE', - IN_CELL_MODE = 'IN_CELL_MODE', - IN_SELECT_MODE = 'IN_SELECT_MODE', - IN_SELECT_IN_TABLE_MODE = 'IN_SELECT_IN_TABLE_MODE', - IN_TEMPLATE_MODE = 'IN_TEMPLATE_MODE', - AFTER_BODY_MODE = 'AFTER_BODY_MODE', - IN_FRAMESET_MODE = 'IN_FRAMESET_MODE', - AFTER_FRAMESET_MODE = 'AFTER_FRAMESET_MODE', - AFTER_AFTER_BODY_MODE = 'AFTER_AFTER_BODY_MODE', - AFTER_AFTER_FRAMESET_MODE = 'AFTER_AFTER_FRAMESET_MODE'; - -//Insertion mode reset map -var INSERTION_MODE_RESET_MAP = Object.create(null); - -INSERTION_MODE_RESET_MAP[$.TR] = IN_ROW_MODE; -INSERTION_MODE_RESET_MAP[$.TBODY] = -INSERTION_MODE_RESET_MAP[$.THEAD] = -INSERTION_MODE_RESET_MAP[$.TFOOT] = IN_TABLE_BODY_MODE; -INSERTION_MODE_RESET_MAP[$.CAPTION] = IN_CAPTION_MODE; -INSERTION_MODE_RESET_MAP[$.COLGROUP] = IN_COLUMN_GROUP_MODE; -INSERTION_MODE_RESET_MAP[$.TABLE] = IN_TABLE_MODE; -INSERTION_MODE_RESET_MAP[$.BODY] = IN_BODY_MODE; -INSERTION_MODE_RESET_MAP[$.FRAMESET] = IN_FRAMESET_MODE; - -//Template insertion mode switch map -var TEMPLATE_INSERTION_MODE_SWITCH_MAP = Object.create(null); - -TEMPLATE_INSERTION_MODE_SWITCH_MAP[$.CAPTION] = -TEMPLATE_INSERTION_MODE_SWITCH_MAP[$.COLGROUP] = -TEMPLATE_INSERTION_MODE_SWITCH_MAP[$.TBODY] = -TEMPLATE_INSERTION_MODE_SWITCH_MAP[$.TFOOT] = -TEMPLATE_INSERTION_MODE_SWITCH_MAP[$.THEAD] = IN_TABLE_MODE; -TEMPLATE_INSERTION_MODE_SWITCH_MAP[$.COL] = IN_COLUMN_GROUP_MODE; -TEMPLATE_INSERTION_MODE_SWITCH_MAP[$.TR] = IN_TABLE_BODY_MODE; -TEMPLATE_INSERTION_MODE_SWITCH_MAP[$.TD] = -TEMPLATE_INSERTION_MODE_SWITCH_MAP[$.TH] = IN_ROW_MODE; - -//Token handlers map for insertion modes -var _ = Object.create(null); - -_[INITIAL_MODE] = Object.create(null); -_[INITIAL_MODE][Tokenizer.CHARACTER_TOKEN] = -_[INITIAL_MODE][Tokenizer.NULL_CHARACTER_TOKEN] = tokenInInitialMode; -_[INITIAL_MODE][Tokenizer.WHITESPACE_CHARACTER_TOKEN] = ignoreToken; -_[INITIAL_MODE][Tokenizer.COMMENT_TOKEN] = appendComment; -_[INITIAL_MODE][Tokenizer.DOCTYPE_TOKEN] = doctypeInInitialMode; -_[INITIAL_MODE][Tokenizer.START_TAG_TOKEN] = -_[INITIAL_MODE][Tokenizer.END_TAG_TOKEN] = -_[INITIAL_MODE][Tokenizer.EOF_TOKEN] = tokenInInitialMode; - -_[BEFORE_HTML_MODE] = Object.create(null); -_[BEFORE_HTML_MODE][Tokenizer.CHARACTER_TOKEN] = -_[BEFORE_HTML_MODE][Tokenizer.NULL_CHARACTER_TOKEN] = tokenBeforeHtml; -_[BEFORE_HTML_MODE][Tokenizer.WHITESPACE_CHARACTER_TOKEN] = ignoreToken; -_[BEFORE_HTML_MODE][Tokenizer.COMMENT_TOKEN] = appendComment; -_[BEFORE_HTML_MODE][Tokenizer.DOCTYPE_TOKEN] = ignoreToken; -_[BEFORE_HTML_MODE][Tokenizer.START_TAG_TOKEN] = startTagBeforeHtml; -_[BEFORE_HTML_MODE][Tokenizer.END_TAG_TOKEN] = endTagBeforeHtml; -_[BEFORE_HTML_MODE][Tokenizer.EOF_TOKEN] = tokenBeforeHtml; - -_[BEFORE_HEAD_MODE] = Object.create(null); -_[BEFORE_HEAD_MODE][Tokenizer.CHARACTER_TOKEN] = -_[BEFORE_HEAD_MODE][Tokenizer.NULL_CHARACTER_TOKEN] = tokenBeforeHead; -_[BEFORE_HEAD_MODE][Tokenizer.WHITESPACE_CHARACTER_TOKEN] = ignoreToken; -_[BEFORE_HEAD_MODE][Tokenizer.COMMENT_TOKEN] = appendComment; -_[BEFORE_HEAD_MODE][Tokenizer.DOCTYPE_TOKEN] = ignoreToken; -_[BEFORE_HEAD_MODE][Tokenizer.START_TAG_TOKEN] = startTagBeforeHead; -_[BEFORE_HEAD_MODE][Tokenizer.END_TAG_TOKEN] = endTagBeforeHead; -_[BEFORE_HEAD_MODE][Tokenizer.EOF_TOKEN] = tokenBeforeHead; - -_[IN_HEAD_MODE] = Object.create(null); -_[IN_HEAD_MODE][Tokenizer.CHARACTER_TOKEN] = -_[IN_HEAD_MODE][Tokenizer.NULL_CHARACTER_TOKEN] = tokenInHead; -_[IN_HEAD_MODE][Tokenizer.WHITESPACE_CHARACTER_TOKEN] = insertCharacters; -_[IN_HEAD_MODE][Tokenizer.COMMENT_TOKEN] = appendComment; -_[IN_HEAD_MODE][Tokenizer.DOCTYPE_TOKEN] = ignoreToken; -_[IN_HEAD_MODE][Tokenizer.START_TAG_TOKEN] = startTagInHead; -_[IN_HEAD_MODE][Tokenizer.END_TAG_TOKEN] = endTagInHead; -_[IN_HEAD_MODE][Tokenizer.EOF_TOKEN] = tokenInHead; - -_[AFTER_HEAD_MODE] = Object.create(null); -_[AFTER_HEAD_MODE][Tokenizer.CHARACTER_TOKEN] = -_[AFTER_HEAD_MODE][Tokenizer.NULL_CHARACTER_TOKEN] = tokenAfterHead; -_[AFTER_HEAD_MODE][Tokenizer.WHITESPACE_CHARACTER_TOKEN] = insertCharacters; -_[AFTER_HEAD_MODE][Tokenizer.COMMENT_TOKEN] = appendComment; -_[AFTER_HEAD_MODE][Tokenizer.DOCTYPE_TOKEN] = ignoreToken; -_[AFTER_HEAD_MODE][Tokenizer.START_TAG_TOKEN] = startTagAfterHead; -_[AFTER_HEAD_MODE][Tokenizer.END_TAG_TOKEN] = endTagAfterHead; -_[AFTER_HEAD_MODE][Tokenizer.EOF_TOKEN] = tokenAfterHead; - -_[IN_BODY_MODE] = Object.create(null); -_[IN_BODY_MODE][Tokenizer.CHARACTER_TOKEN] = characterInBody; -_[IN_BODY_MODE][Tokenizer.NULL_CHARACTER_TOKEN] = ignoreToken; -_[IN_BODY_MODE][Tokenizer.WHITESPACE_CHARACTER_TOKEN] = whitespaceCharacterInBody; -_[IN_BODY_MODE][Tokenizer.COMMENT_TOKEN] = appendComment; -_[IN_BODY_MODE][Tokenizer.DOCTYPE_TOKEN] = ignoreToken; -_[IN_BODY_MODE][Tokenizer.START_TAG_TOKEN] = startTagInBody; -_[IN_BODY_MODE][Tokenizer.END_TAG_TOKEN] = endTagInBody; -_[IN_BODY_MODE][Tokenizer.EOF_TOKEN] = eofInBody; - -_[TEXT_MODE] = Object.create(null); -_[TEXT_MODE][Tokenizer.CHARACTER_TOKEN] = -_[TEXT_MODE][Tokenizer.NULL_CHARACTER_TOKEN] = -_[TEXT_MODE][Tokenizer.WHITESPACE_CHARACTER_TOKEN] = insertCharacters; -_[TEXT_MODE][Tokenizer.COMMENT_TOKEN] = -_[TEXT_MODE][Tokenizer.DOCTYPE_TOKEN] = -_[TEXT_MODE][Tokenizer.START_TAG_TOKEN] = ignoreToken; -_[TEXT_MODE][Tokenizer.END_TAG_TOKEN] = endTagInText; -_[TEXT_MODE][Tokenizer.EOF_TOKEN] = eofInText; - -_[IN_TABLE_MODE] = Object.create(null); -_[IN_TABLE_MODE][Tokenizer.CHARACTER_TOKEN] = -_[IN_TABLE_MODE][Tokenizer.NULL_CHARACTER_TOKEN] = -_[IN_TABLE_MODE][Tokenizer.WHITESPACE_CHARACTER_TOKEN] = characterInTable; -_[IN_TABLE_MODE][Tokenizer.COMMENT_TOKEN] = appendComment; -_[IN_TABLE_MODE][Tokenizer.DOCTYPE_TOKEN] = ignoreToken; -_[IN_TABLE_MODE][Tokenizer.START_TAG_TOKEN] = startTagInTable; -_[IN_TABLE_MODE][Tokenizer.END_TAG_TOKEN] = endTagInTable; -_[IN_TABLE_MODE][Tokenizer.EOF_TOKEN] = eofInBody; - -_[IN_TABLE_TEXT_MODE] = Object.create(null); -_[IN_TABLE_TEXT_MODE][Tokenizer.CHARACTER_TOKEN] = characterInTableText; -_[IN_TABLE_TEXT_MODE][Tokenizer.NULL_CHARACTER_TOKEN] = ignoreToken; -_[IN_TABLE_TEXT_MODE][Tokenizer.WHITESPACE_CHARACTER_TOKEN] = whitespaceCharacterInTableText; -_[IN_TABLE_TEXT_MODE][Tokenizer.COMMENT_TOKEN] = -_[IN_TABLE_TEXT_MODE][Tokenizer.DOCTYPE_TOKEN] = -_[IN_TABLE_TEXT_MODE][Tokenizer.START_TAG_TOKEN] = -_[IN_TABLE_TEXT_MODE][Tokenizer.END_TAG_TOKEN] = -_[IN_TABLE_TEXT_MODE][Tokenizer.EOF_TOKEN] = tokenInTableText; - -_[IN_CAPTION_MODE] = Object.create(null); -_[IN_CAPTION_MODE][Tokenizer.CHARACTER_TOKEN] = characterInBody; -_[IN_CAPTION_MODE][Tokenizer.NULL_CHARACTER_TOKEN] = ignoreToken; -_[IN_CAPTION_MODE][Tokenizer.WHITESPACE_CHARACTER_TOKEN] = whitespaceCharacterInBody; -_[IN_CAPTION_MODE][Tokenizer.COMMENT_TOKEN] = appendComment; -_[IN_CAPTION_MODE][Tokenizer.DOCTYPE_TOKEN] = ignoreToken; -_[IN_CAPTION_MODE][Tokenizer.START_TAG_TOKEN] = startTagInCaption; -_[IN_CAPTION_MODE][Tokenizer.END_TAG_TOKEN] = endTagInCaption; -_[IN_CAPTION_MODE][Tokenizer.EOF_TOKEN] = eofInBody; - -_[IN_COLUMN_GROUP_MODE] = Object.create(null); -_[IN_COLUMN_GROUP_MODE][Tokenizer.CHARACTER_TOKEN] = -_[IN_COLUMN_GROUP_MODE][Tokenizer.NULL_CHARACTER_TOKEN] = tokenInColumnGroup; -_[IN_COLUMN_GROUP_MODE][Tokenizer.WHITESPACE_CHARACTER_TOKEN] = insertCharacters; -_[IN_COLUMN_GROUP_MODE][Tokenizer.COMMENT_TOKEN] = appendComment; -_[IN_COLUMN_GROUP_MODE][Tokenizer.DOCTYPE_TOKEN] = ignoreToken; -_[IN_COLUMN_GROUP_MODE][Tokenizer.START_TAG_TOKEN] = startTagInColumnGroup; -_[IN_COLUMN_GROUP_MODE][Tokenizer.END_TAG_TOKEN] = endTagInColumnGroup; -_[IN_COLUMN_GROUP_MODE][Tokenizer.EOF_TOKEN] = eofInBody; - -_[IN_TABLE_BODY_MODE] = Object.create(null); -_[IN_TABLE_BODY_MODE][Tokenizer.CHARACTER_TOKEN] = -_[IN_TABLE_BODY_MODE][Tokenizer.NULL_CHARACTER_TOKEN] = -_[IN_TABLE_BODY_MODE][Tokenizer.WHITESPACE_CHARACTER_TOKEN] = characterInTable; -_[IN_TABLE_BODY_MODE][Tokenizer.COMMENT_TOKEN] = appendComment; -_[IN_TABLE_BODY_MODE][Tokenizer.DOCTYPE_TOKEN] = ignoreToken; -_[IN_TABLE_BODY_MODE][Tokenizer.START_TAG_TOKEN] = startTagInTableBody; -_[IN_TABLE_BODY_MODE][Tokenizer.END_TAG_TOKEN] = endTagInTableBody; -_[IN_TABLE_BODY_MODE][Tokenizer.EOF_TOKEN] = eofInBody; - -_[IN_ROW_MODE] = Object.create(null); -_[IN_ROW_MODE][Tokenizer.CHARACTER_TOKEN] = -_[IN_ROW_MODE][Tokenizer.NULL_CHARACTER_TOKEN] = -_[IN_ROW_MODE][Tokenizer.WHITESPACE_CHARACTER_TOKEN] = characterInTable; -_[IN_ROW_MODE][Tokenizer.COMMENT_TOKEN] = appendComment; -_[IN_ROW_MODE][Tokenizer.DOCTYPE_TOKEN] = ignoreToken; -_[IN_ROW_MODE][Tokenizer.START_TAG_TOKEN] = startTagInRow; -_[IN_ROW_MODE][Tokenizer.END_TAG_TOKEN] = endTagInRow; -_[IN_ROW_MODE][Tokenizer.EOF_TOKEN] = eofInBody; - -_[IN_CELL_MODE] = Object.create(null); -_[IN_CELL_MODE][Tokenizer.CHARACTER_TOKEN] = characterInBody; -_[IN_CELL_MODE][Tokenizer.NULL_CHARACTER_TOKEN] = ignoreToken; -_[IN_CELL_MODE][Tokenizer.WHITESPACE_CHARACTER_TOKEN] = whitespaceCharacterInBody; -_[IN_CELL_MODE][Tokenizer.COMMENT_TOKEN] = appendComment; -_[IN_CELL_MODE][Tokenizer.DOCTYPE_TOKEN] = ignoreToken; -_[IN_CELL_MODE][Tokenizer.START_TAG_TOKEN] = startTagInCell; -_[IN_CELL_MODE][Tokenizer.END_TAG_TOKEN] = endTagInCell; -_[IN_CELL_MODE][Tokenizer.EOF_TOKEN] = eofInBody; - -_[IN_SELECT_MODE] = Object.create(null); -_[IN_SELECT_MODE][Tokenizer.CHARACTER_TOKEN] = insertCharacters; -_[IN_SELECT_MODE][Tokenizer.NULL_CHARACTER_TOKEN] = ignoreToken; -_[IN_SELECT_MODE][Tokenizer.WHITESPACE_CHARACTER_TOKEN] = insertCharacters; -_[IN_SELECT_MODE][Tokenizer.COMMENT_TOKEN] = appendComment; -_[IN_SELECT_MODE][Tokenizer.DOCTYPE_TOKEN] = ignoreToken; -_[IN_SELECT_MODE][Tokenizer.START_TAG_TOKEN] = startTagInSelect; -_[IN_SELECT_MODE][Tokenizer.END_TAG_TOKEN] = endTagInSelect; -_[IN_SELECT_MODE][Tokenizer.EOF_TOKEN] = eofInBody; - -_[IN_SELECT_IN_TABLE_MODE] = Object.create(null); -_[IN_SELECT_IN_TABLE_MODE][Tokenizer.CHARACTER_TOKEN] = insertCharacters; -_[IN_SELECT_IN_TABLE_MODE][Tokenizer.NULL_CHARACTER_TOKEN] = ignoreToken; -_[IN_SELECT_IN_TABLE_MODE][Tokenizer.WHITESPACE_CHARACTER_TOKEN] = insertCharacters; -_[IN_SELECT_IN_TABLE_MODE][Tokenizer.COMMENT_TOKEN] = appendComment; -_[IN_SELECT_IN_TABLE_MODE][Tokenizer.DOCTYPE_TOKEN] = ignoreToken; -_[IN_SELECT_IN_TABLE_MODE][Tokenizer.START_TAG_TOKEN] = startTagInSelectInTable; -_[IN_SELECT_IN_TABLE_MODE][Tokenizer.END_TAG_TOKEN] = endTagInSelectInTable; -_[IN_SELECT_IN_TABLE_MODE][Tokenizer.EOF_TOKEN] = eofInBody; - -_[IN_TEMPLATE_MODE] = Object.create(null); -_[IN_TEMPLATE_MODE][Tokenizer.CHARACTER_TOKEN] = characterInBody; -_[IN_TEMPLATE_MODE][Tokenizer.NULL_CHARACTER_TOKEN] = ignoreToken; -_[IN_TEMPLATE_MODE][Tokenizer.WHITESPACE_CHARACTER_TOKEN] = whitespaceCharacterInBody; -_[IN_TEMPLATE_MODE][Tokenizer.COMMENT_TOKEN] = appendComment; -_[IN_TEMPLATE_MODE][Tokenizer.DOCTYPE_TOKEN] = ignoreToken; -_[IN_TEMPLATE_MODE][Tokenizer.START_TAG_TOKEN] = startTagInTemplate; -_[IN_TEMPLATE_MODE][Tokenizer.END_TAG_TOKEN] = endTagInTemplate; -_[IN_TEMPLATE_MODE][Tokenizer.EOF_TOKEN] = eofInTemplate; - -_[AFTER_BODY_MODE] = Object.create(null); -_[AFTER_BODY_MODE][Tokenizer.CHARACTER_TOKEN] = -_[AFTER_BODY_MODE][Tokenizer.NULL_CHARACTER_TOKEN] = tokenAfterBody; -_[AFTER_BODY_MODE][Tokenizer.WHITESPACE_CHARACTER_TOKEN] = whitespaceCharacterInBody; -_[AFTER_BODY_MODE][Tokenizer.COMMENT_TOKEN] = appendCommentToRootHtmlElement; -_[AFTER_BODY_MODE][Tokenizer.DOCTYPE_TOKEN] = ignoreToken; -_[AFTER_BODY_MODE][Tokenizer.START_TAG_TOKEN] = startTagAfterBody; -_[AFTER_BODY_MODE][Tokenizer.END_TAG_TOKEN] = endTagAfterBody; -_[AFTER_BODY_MODE][Tokenizer.EOF_TOKEN] = stopParsing; - -_[IN_FRAMESET_MODE] = Object.create(null); -_[IN_FRAMESET_MODE][Tokenizer.CHARACTER_TOKEN] = -_[IN_FRAMESET_MODE][Tokenizer.NULL_CHARACTER_TOKEN] = ignoreToken; -_[IN_FRAMESET_MODE][Tokenizer.WHITESPACE_CHARACTER_TOKEN] = insertCharacters; -_[IN_FRAMESET_MODE][Tokenizer.COMMENT_TOKEN] = appendComment; -_[IN_FRAMESET_MODE][Tokenizer.DOCTYPE_TOKEN] = ignoreToken; -_[IN_FRAMESET_MODE][Tokenizer.START_TAG_TOKEN] = startTagInFrameset; -_[IN_FRAMESET_MODE][Tokenizer.END_TAG_TOKEN] = endTagInFrameset; -_[IN_FRAMESET_MODE][Tokenizer.EOF_TOKEN] = stopParsing; - -_[AFTER_FRAMESET_MODE] = Object.create(null); -_[AFTER_FRAMESET_MODE][Tokenizer.CHARACTER_TOKEN] = -_[AFTER_FRAMESET_MODE][Tokenizer.NULL_CHARACTER_TOKEN] = ignoreToken; -_[AFTER_FRAMESET_MODE][Tokenizer.WHITESPACE_CHARACTER_TOKEN] = insertCharacters; -_[AFTER_FRAMESET_MODE][Tokenizer.COMMENT_TOKEN] = appendComment; -_[AFTER_FRAMESET_MODE][Tokenizer.DOCTYPE_TOKEN] = ignoreToken; -_[AFTER_FRAMESET_MODE][Tokenizer.START_TAG_TOKEN] = startTagAfterFrameset; -_[AFTER_FRAMESET_MODE][Tokenizer.END_TAG_TOKEN] = endTagAfterFrameset; -_[AFTER_FRAMESET_MODE][Tokenizer.EOF_TOKEN] = stopParsing; - -_[AFTER_AFTER_BODY_MODE] = Object.create(null); -_[AFTER_AFTER_BODY_MODE][Tokenizer.CHARACTER_TOKEN] = tokenAfterAfterBody; -_[AFTER_AFTER_BODY_MODE][Tokenizer.NULL_CHARACTER_TOKEN] = tokenAfterAfterBody; -_[AFTER_AFTER_BODY_MODE][Tokenizer.WHITESPACE_CHARACTER_TOKEN] = whitespaceCharacterInBody; -_[AFTER_AFTER_BODY_MODE][Tokenizer.COMMENT_TOKEN] = appendCommentToDocument; -_[AFTER_AFTER_BODY_MODE][Tokenizer.DOCTYPE_TOKEN] = ignoreToken; -_[AFTER_AFTER_BODY_MODE][Tokenizer.START_TAG_TOKEN] = startTagAfterAfterBody; -_[AFTER_AFTER_BODY_MODE][Tokenizer.END_TAG_TOKEN] = tokenAfterAfterBody; -_[AFTER_AFTER_BODY_MODE][Tokenizer.EOF_TOKEN] = stopParsing; - -_[AFTER_AFTER_FRAMESET_MODE] = Object.create(null); -_[AFTER_AFTER_FRAMESET_MODE][Tokenizer.CHARACTER_TOKEN] = -_[AFTER_AFTER_FRAMESET_MODE][Tokenizer.NULL_CHARACTER_TOKEN] = ignoreToken; -_[AFTER_AFTER_FRAMESET_MODE][Tokenizer.WHITESPACE_CHARACTER_TOKEN] = whitespaceCharacterInBody; -_[AFTER_AFTER_FRAMESET_MODE][Tokenizer.COMMENT_TOKEN] = appendCommentToDocument; -_[AFTER_AFTER_FRAMESET_MODE][Tokenizer.DOCTYPE_TOKEN] = ignoreToken; -_[AFTER_AFTER_FRAMESET_MODE][Tokenizer.START_TAG_TOKEN] = startTagAfterAfterFrameset; -_[AFTER_AFTER_FRAMESET_MODE][Tokenizer.END_TAG_TOKEN] = ignoreToken; -_[AFTER_AFTER_FRAMESET_MODE][Tokenizer.EOF_TOKEN] = stopParsing; - - -//Parser -var Parser = module.exports = function (options) { - this.options = mergeOptions(DEFAULT_OPTIONS, options); - - this.treeAdapter = this.options.treeAdapter; - this.pendingScript = null; - - if (this.options.locationInfo) - locationInfoMixin.assign(this); -}; +function DOMTokenList(getter, setter) { + this._getString = getter; + this._setString = setter; + fixIndex(this, getList(this)); +} -// API -Parser.prototype.parse = function (html) { - var document = this.treeAdapter.createDocument(); +DOMTokenList.prototype = { + item: function(index) { + if (index >= this.length) { + return null; + } + return this._getString().split(" ")[index]; + }, - this._bootstrap(document, null); - this.tokenizer.write(html, true); - this._runParsingLoop(null); + contains: function(token) { + token = String(token); + handleErrors(token); + var list = getList(this); + return list.indexOf(token) > -1; + }, - return document; -}; + add: function(token) { + handleErrors(token); + var list = getList(this); + if (list.indexOf(token) > -1) { + return; + } + list.push(token); + this._setString(list.join(" ").trim()); + fixIndex(this, list); + }, -Parser.prototype.parseFragment = function (html, fragmentContext) { - //NOTE: use element as a fragment context if context element was not provided, - //so we will parse in "forgiving" manner - if (!fragmentContext) - fragmentContext = this.treeAdapter.createElement($.TEMPLATE, NS.HTML, []); + remove: function(token) { + handleErrors(token); + var list = getList(this); + var index = list.indexOf(token); + if (index > -1) { + list.splice(index, 1); + this._setString(list.join(" ").trim()); + } + fixIndex(this, list); + }, - //NOTE: create fake element which will be used as 'document' for fragment parsing. - //This is important for jsdom there 'document' can't be recreated, therefore - //fragment parsing causes messing of the main `document`. - var documentMock = this.treeAdapter.createElement('documentmock', NS.HTML, []); + toggle: function toggle(token) { + if (this.contains(token)) { + this.remove(token); + return false; + } + else { + this.add(token); + return true; + } + }, - this._bootstrap(documentMock, fragmentContext); + toString: function() { + return this._getString(); + } +}; - if (this.treeAdapter.getTagName(fragmentContext) === $.TEMPLATE) - this._pushTmplInsertionMode(IN_TEMPLATE_MODE); +function fixIndex(clist, list) { + clist.length = list.length; + for (var i = 0; i < list.length; i++) { + clist[i] = list[i]; + } +} - this._initTokenizerForFragmentParsing(); - this._insertFakeRootElement(); - this._resetInsertionMode(); - this._findFormInFragmentContext(); - this.tokenizer.write(html, true); - this._runParsingLoop(null); +function handleErrors(token) { + if (token === "" || token === undefined) { + utils.SyntaxError(); + } + if (token.indexOf(" ") > -1) { + utils.InvalidCharacterError(); + } +} - var rootElement = this.treeAdapter.getFirstChild(documentMock), - fragment = this.treeAdapter.createDocumentFragment(); +function getList(clist) { + var str = clist._getString(); + if (str === "") { + return []; + } + else { + return str.split(" "); + } +} - this._adoptNodes(rootElement, fragment); - return fragment; -}; +/***/ }), +/* 32 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; -//Bootstrap parser -Parser.prototype._bootstrap = function (document, fragmentContext) { - this.tokenizer = new Tokenizer(this.options); +module.exports = DocumentFragment; - this.stopped = false; +var Node = __webpack_require__(3); +var NodeList = __webpack_require__(11); +var Element = __webpack_require__(6); +var select = __webpack_require__(23); +var utils = __webpack_require__(1); - this.insertionMode = INITIAL_MODE; - this.originalInsertionMode = ''; +function DocumentFragment(doc) { + this.nodeType = Node.DOCUMENT_FRAGMENT_NODE; + this.ownerDocument = doc; + this.childNodes = []; +} - this.document = document; - this.fragmentContext = fragmentContext; +DocumentFragment.prototype = Object.create(Node.prototype, { + nodeName: { value: '#document-fragment' }, + nodeValue: { + get: function() { + return null; + }, + set: function() {} + }, + // Copy the text content getter/setter from Element + textContent: Object.getOwnPropertyDescriptor(Element.prototype, 'textContent'), + + querySelector: { value: function(selector) { + // implement in terms of querySelectorAll + var nodes = this.querySelectorAll(selector); + return nodes.length ? nodes[0] : null; + }}, + querySelectorAll: { value: function(selector) { + // create a context + var context = Object.create(this); + // add some methods to the context for zest implementation, without + // adding them to the public DocumentFragment API + context.isHTML = true; // in HTML namespace (case-insensitive match) + context.getElementsByTagName = Element.prototype.getElementsByTagName; + context.nextElement = + Object.getOwnPropertyDescriptor(Element.prototype, 'firstElementChild'). + get; + // invoke zest + var nodes = select(selector, context); + return nodes.item ? nodes : new NodeList(nodes); + }}, + + // Utility methods + clone: { value: function clone() { + return new DocumentFragment(this.ownerDocument); + }}, + isEqual: { value: function isEqual(n) { + // Any two document fragments are shallowly equal. + // Node.isEqualNode() will test their children for equality + return true; + }}, + + // Non-standard, but useful (github issue #73) + innerHTML: { + get: function() { return this.serialize(); }, + set: utils.nyi + }, + outerHTML: { + get: function() { return this.serialize(); }, + set: utils.nyi + }, - this.headElement = null; - this.formElement = null; +}); - this.openElements = new OpenElementStack(this.document, this.treeAdapter); - this.activeFormattingElements = new FormattingElementList(this.treeAdapter); - this.tmplInsertionModeStack = []; - this.tmplInsertionModeStackTop = -1; - this.currentTmplInsertionMode = null; +/***/ }), +/* 33 */ +/***/ (function(module, exports, __webpack_require__) { - this.pendingCharacterTokens = []; - this.hasNonWhitespacePendingCharacterToken = false; +"use strict"; - this.framesetOk = true; - this.skipNextNewLine = false; - this.fosterParentingEnabled = false; -}; +var Event = __webpack_require__(7); +var MouseEvent = __webpack_require__(35); +var utils = __webpack_require__(1); -//Parsing loop -Parser.prototype._runParsingLoop = function (scriptHandler) { - while (!this.stopped) { - this._setupTokenizerCDATAMode(); +module.exports = EventTarget; - var token = this.tokenizer.getNextToken(); +function EventTarget() {} - if (token.type === Tokenizer.HIBERNATION_TOKEN) - break; +EventTarget.prototype = { + // XXX + // See WebIDL §4.8 for details on object event handlers + // and how they should behave. We actually have to accept + // any object to addEventListener... Can't type check it. + // on registration. - if (this.skipNextNewLine) { - this.skipNextNewLine = false; + // XXX: + // Capturing event listeners are sort of rare. I think I can optimize + // them so that dispatchEvent can skip the capturing phase (or much of + // it). Each time a capturing listener is added, increment a flag on + // the target node and each of its ancestors. Decrement when removed. + // And update the counter when nodes are added and removed from the + // tree as well. Then, in dispatch event, the capturing phase can + // abort if it sees any node with a zero count. + addEventListener: function addEventListener(type, listener, capture) { + if (!listener) return; + if (capture === undefined) capture = false; + if (!this._listeners) this._listeners = Object.create(null); + if (!this._listeners[type]) this._listeners[type] = []; + var list = this._listeners[type]; - if (token.type === Tokenizer.WHITESPACE_CHARACTER_TOKEN && token.chars[0] === '\n') { - if (token.chars.length === 1) - continue; + // If this listener has already been registered, just return + for(var i = 0, n = list.length; i < n; i++) { + var l = list[i]; + if (l.listener === listener && l.capture === capture) + return; + } - token.chars = token.chars.substr(1); + // Add an object to the list of listeners + var obj = { listener: listener, capture: capture }; + if (typeof listener === 'function') obj.f = listener; + list.push(obj); + }, + + removeEventListener: function removeEventListener(type, + listener, + capture) { + if (capture === undefined) capture = false; + if (this._listeners) { + var list = this._listeners[type]; + if (list) { + // Find the listener in the list and remove it + for(var i = 0, n = list.length; i < n; i++) { + var l = list[i]; + if (l.listener === listener && l.capture === capture) { + if (list.length === 1) { + this._listeners[type] = undefined; + } + else { + list.splice(i, 1); } + return; + } } + } + } + }, + + // This is the public API for dispatching untrusted public events. + // See _dispatchEvent for the implementation + dispatchEvent: function dispatchEvent(event) { + // Dispatch an untrusted event + return this._dispatchEvent(event, false); + }, + + // + // See DOMCore §4.4 + // XXX: I'll probably need another version of this method for + // internal use, one that does not set isTrusted to false. + // XXX: see Document._dispatchEvent: perhaps that and this could + // call a common internal function with different settings of + // a trusted boolean argument + // + // XXX: + // The spec has changed in how to deal with handlers registered + // on idl or content attributes rather than with addEventListener. + // Used to say that they always ran first. That's how webkit does it + // Spec now says that they run in a position determined by + // when they were first set. FF does it that way. See: + // http://www.whatwg.org/specs/web-apps/current-work/multipage/webappapis.html#event-handlers + // + _dispatchEvent: function _dispatchEvent(event, trusted) { + if (typeof trusted !== 'boolean') trusted = false; + function invoke(target, event) { + var type = event.type, phase = event.eventPhase; + event.currentTarget = target; + + // If there was an individual handler defined, invoke it first + // XXX: see comment above: this shouldn't always be first. + if (phase !== Event.CAPTURING_PHASE && + target._handlers && target._handlers[type]) + { + var handler = target._handlers[type]; + var rv; + if (typeof handler === 'function') { + rv=handler.call(event.currentTarget, event); + } + else { + var f = handler.handleEvent; + if (typeof f !== 'function') + throw new TypeError('handleEvent property of ' + + 'event handler object is' + + 'not a function.'); + rv=f.call(handler, event); + } + + switch(event.type) { + case 'mouseover': + if (rv === true) // Historical baggage + event.preventDefault(); + break; + case 'beforeunload': + // XXX: eventually we need a special case here + /* falls through */ + default: + if (rv === false) + event.preventDefault(); + break; + } + } - this._processInputToken(token); - - if (scriptHandler && this.pendingScript) - break; + // Now invoke list list of listeners for this target and type + var list = target._listeners && target._listeners[type]; + if (!list) return; + list = list.slice(); + for(var i = 0, n = list.length; i < n; i++) { + if (event._immediatePropagationStopped) return; + var l = list[i]; + if ((phase === Event.CAPTURING_PHASE && !l.capture) || + (phase === Event.BUBBLING_PHASE && l.capture)) + continue; + if (l.f) { + l.f.call(event.currentTarget, event); + } + else { + var fn = l.listener.handleEvent; + if (typeof fn !== 'function') + throw new TypeError('handleEvent property of event listener object is not a function.'); + fn.call(l.listener, event); + } + } } -}; -Parser.prototype.runParsingLoopForCurrentChunk = function (writeCallback, scriptHandler) { - this._runParsingLoop(scriptHandler); + if (!event._initialized || event._dispatching) utils.InvalidStateError(); + event.isTrusted = trusted; - if (scriptHandler && this.pendingScript) { - var script = this.pendingScript; + // Begin dispatching the event now + event._dispatching = true; + event.target = this; - this.pendingScript = null; + // Build the list of targets for the capturing and bubbling phases + // XXX: we'll eventually have to add Window to this list. + var ancestors = []; + for(var n = this.parentNode; n; n = n.parentNode) + ancestors.push(n); - scriptHandler(script); + // Capturing phase + event.eventPhase = Event.CAPTURING_PHASE; + for(var i = ancestors.length-1; i >= 0; i--) { + invoke(ancestors[i], event); + if (event._propagationStopped) break; + } - return; + // At target phase + if (!event._propagationStopped) { + event.eventPhase = Event.AT_TARGET; + invoke(this, event); } - if (writeCallback) - writeCallback(); -}; + // Bubbling phase + if (event.bubbles && !event._propagationStopped) { + event.eventPhase = Event.BUBBLING_PHASE; + for(var ii = 0, nn = ancestors.length; ii < nn; ii++) { + invoke(ancestors[ii], event); + if (event._propagationStopped) break; + } + } -//Text parsing -Parser.prototype._setupTokenizerCDATAMode = function () { - var current = this._getAdjustedCurrentElement(); + event._dispatching = false; + event.eventPhase = Event.AT_TARGET; + event.currentTarget = null; - this.tokenizer.allowCDATA = current && current !== this.document && - this.treeAdapter.getNamespaceURI(current) !== NS.HTML && !this._isIntegrationPoint(current); -}; + // Deal with mouse events and figure out when + // a click has happened + if (trusted && !event.defaultPrevented && event instanceof MouseEvent) { + switch(event.type) { + case 'mousedown': + this._armed = { + x: event.clientX, + y: event.clientY, + t: event.timeStamp + }; + break; + case 'mouseout': + case 'mouseover': + this._armed = null; + break; + case 'mouseup': + if (this._isClick(event)) this._doClick(event); + this._armed = null; + break; + } + } -Parser.prototype._switchToTextParsing = function (currentToken, nextTokenizerState) { - this._insertElement(currentToken, NS.HTML); - this.tokenizer.state = nextTokenizerState; - this.originalInsertionMode = this.insertionMode; - this.insertionMode = TEXT_MODE; -}; -Parser.prototype.switchToPlaintextParsing = function () { - this.insertionMode = TEXT_MODE; - this.originalInsertionMode = IN_BODY_MODE; - this.tokenizer.state = Tokenizer.MODE.PLAINTEXT; -}; -//Fragment parsing -Parser.prototype._getAdjustedCurrentElement = function () { - return this.openElements.stackTop === 0 && this.fragmentContext ? - this.fragmentContext : - this.openElements.current; -}; + return !event.defaultPrevented; + }, + + // Determine whether a click occurred + // XXX We don't support double clicks for now + _isClick: function(event) { + return (this._armed !== null && + event.type === 'mouseup' && + event.isTrusted && + event.button === 0 && + event.timeStamp - this._armed.t < 1000 && + Math.abs(event.clientX - this._armed.x) < 10 && + Math.abs(event.clientY - this._armed.Y) < 10); + }, + + // Clicks are handled like this: + // http://www.whatwg.org/specs/web-apps/current-work/multipage/elements.html#interactive-content-0 + // + // Note that this method is similar to the HTMLElement.click() method + // The event argument must be the trusted mouseup event + _doClick: function(event) { + if (this._click_in_progress) return; + this._click_in_progress = true; + + // Find the nearest enclosing element that is activatable + // An element is activatable if it has a + // _post_click_activation_steps hook + var activated = this; + while(activated && !activated._post_click_activation_steps) + activated = activated.parentNode; + + if (activated && activated._pre_click_activation_steps) { + activated._pre_click_activation_steps(); + } + + var click = this.ownerDocument.createEvent('MouseEvent'); + click.initMouseEvent('click', true, true, + this.ownerDocument.defaultView, 1, + event.screenX, event.screenY, + event.clientX, event.clientY, + event.ctrlKey, event.altKey, + event.shiftKey, event.metaKey, + event.button, null); + + var result = this._dispatchEvent(click, true); + + if (activated) { + if (result) { + // This is where hyperlinks get followed, for example. + if (activated._post_click_activation_steps) + activated._post_click_activation_steps(click); + } + else { + if (activated._cancelled_activation_steps) + activated._cancelled_activation_steps(); + } + } + }, -Parser.prototype._findFormInFragmentContext = function () { - var node = this.fragmentContext; + // + // An event handler is like an event listener, but it registered + // by setting an IDL or content attribute like onload or onclick. + // There can only be one of these at a time for any event type. + // This is an internal method for the attribute accessors and + // content attribute handlers that need to register events handlers. + // The type argument is the same as in addEventListener(). + // The handler argument is the same as listeners in addEventListener: + // it can be a function or an object. Pass null to remove any existing + // handler. Handlers are always invoked before any listeners of + // the same type. They are not invoked during the capturing phase + // of event dispatch. + // + _setEventHandler: function _setEventHandler(type, handler) { + if (!this._handlers) this._handlers = Object.create(null); + this._handlers[type] = handler; + }, - do { - if (this.treeAdapter.getTagName(node) === $.FORM) { - this.formElement = node; - break; - } + _getEventHandler: function _getEventHandler(type) { + return (this._handlers && this._handlers[type]) || null; + } - node = this.treeAdapter.getParentNode(node); - } while (node); }; -Parser.prototype._initTokenizerForFragmentParsing = function () { - if (this.treeAdapter.getNamespaceURI(this.fragmentContext) === NS.HTML) { - var tn = this.treeAdapter.getTagName(this.fragmentContext); - - if (tn === $.TITLE || tn === $.TEXTAREA) - this.tokenizer.state = Tokenizer.MODE.RCDATA; - else if (tn === $.STYLE || tn === $.XMP || tn === $.IFRAME || - tn === $.NOEMBED || tn === $.NOFRAMES || tn === $.NOSCRIPT) - this.tokenizer.state = Tokenizer.MODE.RAWTEXT; +/***/ }), +/* 34 */ +/***/ (function(module, exports, __webpack_require__) { - else if (tn === $.SCRIPT) - this.tokenizer.state = Tokenizer.MODE.SCRIPT_DATA; +"use strict"; - else if (tn === $.PLAINTEXT) - this.tokenizer.state = Tokenizer.MODE.PLAINTEXT; - } -}; +module.exports = Leaf; + +var Node = __webpack_require__(3); +var utils = __webpack_require__(1); +var HierarchyRequestError = utils.HierarchyRequestError; +var NotFoundError = utils.NotFoundError; + +// This class defines common functionality for node subtypes that +// can never have children +function Leaf() { +} + +Leaf.prototype = Object.create(Node.prototype, { + hasChildNodes: { value: function() { return false; }}, + firstChild: { value: null }, + lastChild: { value: null }, + insertBefore: { value: function(node, child) { + if (!node.nodeType) throw new TypeError('not a node'); + HierarchyRequestError(); + }}, + replaceChild: { value: function(node, child) { + if (!node.nodeType) throw new TypeError('not a node'); + HierarchyRequestError(); + }}, + removeChild: { value: function(node) { + if (!node.nodeType) throw new TypeError('not a node'); + NotFoundError(); + }}, + childNodes: { get: function() { + if (!this._childNodes) this._childNodes = []; + return this._childNodes; + }} +}); -//Tree mutation -Parser.prototype._setDocumentType = function (token) { - this.treeAdapter.setDocumentType(this.document, token.name, token.publicId, token.systemId); -}; -Parser.prototype._attachElementToTree = function (element) { - if (this._shouldFosterParentOnInsertion()) - this._fosterParentElement(element); +/***/ }), +/* 35 */ +/***/ (function(module, exports, __webpack_require__) { - else { - var parent = this.openElements.currentTmplContent || this.openElements.current; +"use strict"; - this.treeAdapter.appendChild(parent, element); - } -}; +var UIEvent = __webpack_require__(40); + +module.exports = MouseEvent; + +function MouseEvent() { + // Just use the superclass constructor to initialize + UIEvent.call(this); + + this.screenX = this.screenY = this.clientX = this.clientY = 0; + this.ctrlKey = this.altKey = this.shiftKey = this.metaKey = false; + this.button = 0; + this.buttons = 1; + this.relatedTarget = null; +} +MouseEvent.prototype = Object.create(UIEvent.prototype, { + constructor: { value: MouseEvent }, + initMouseEvent: { value: function(type, bubbles, cancelable, + view, detail, + screenX, screenY, clientX, clientY, + ctrlKey, altKey, shiftKey, metaKey, + button, relatedTarget) { + + this.initEvent(type, bubbles, cancelable, view, detail); + this.screenX = screenX; + this.screenY = screenY; + this.clientX = clientX; + this.clientY = clientY; + this.ctrlKey = ctrlKey; + this.altKey = altKey; + this.shiftKey = shiftKey; + this.metaKey = metaKey; + this.button = button; + switch(button) { + case 0: this.buttons = 1; break; + case 1: this.buttons = 4; break; + case 2: this.buttons = 2; break; + default: this.buttons = 0; break; + } + this.relatedTarget = relatedTarget; + }}, + + getModifierState: { value: function(key) { + switch(key) { + case "Alt": return this.altKey; + case "Control": return this.ctrlKey; + case "Shift": return this.shiftKey; + case "Meta": return this.metaKey; + default: return false; + } + }} +}); -Parser.prototype._appendElement = function (token, namespaceURI) { - var element = this.treeAdapter.createElement(token.tagName, namespaceURI, token.attrs); - this._attachElementToTree(element); -}; +/***/ }), +/* 36 */ +/***/ (function(module, exports, __webpack_require__) { -Parser.prototype._insertElement = function (token, namespaceURI) { - var element = this.treeAdapter.createElement(token.tagName, namespaceURI, token.attrs); +"use strict"; - this._attachElementToTree(element); - this.openElements.push(element); +/* exported NodeTraversal */ +var NodeTraversal = module.exports = { + nextSkippingChildren: nextSkippingChildren, + nextAncestorSibling: nextAncestorSibling, + next: next, + previous: previous, + deepLastChild: deepLastChild }; -Parser.prototype._insertFakeElement = function (tagName) { - var element = this.treeAdapter.createElement(tagName, NS.HTML, []); +/** + * @based on WebKit's NodeTraversal::nextSkippingChildren + * https://trac.webkit.org/browser/trunk/Source/WebCore/dom/NodeTraversal.h?rev=179143#L109 + */ +function nextSkippingChildren(node, stayWithin) { + if (node === stayWithin) { + return null; + } + if (node.nextSibling !== null) { + return node.nextSibling; + } + return nextAncestorSibling(node, stayWithin); +} - this._attachElementToTree(element); - this.openElements.push(element); -}; +/** + * @based on WebKit's NodeTraversal::nextAncestorSibling + * https://trac.webkit.org/browser/trunk/Source/WebCore/dom/NodeTraversal.cpp?rev=179143#L93 + */ +function nextAncestorSibling(node, stayWithin) { + for (node = node.parentNode; node !== null; node = node.parentNode) { + if (node === stayWithin) { + return null; + } + if (node.nextSibling !== null) { + return node.nextSibling; + } + } + return null; +} -Parser.prototype._insertTemplate = function (token) { - var tmpl = this.treeAdapter.createElement(token.tagName, NS.HTML, token.attrs), - content = this.treeAdapter.createDocumentFragment(); +/** + * @based on WebKit's NodeTraversal::next + * https://trac.webkit.org/browser/trunk/Source/WebCore/dom/NodeTraversal.h?rev=179143#L99 + */ +function next(node, stayWithin) { + var n; + n = node.firstChild; + if (n !== null) { + return n; + } + if (node === stayWithin) { + return null; + } + n = node.nextSibling; + if (n !== null) { + return n; + } + return nextAncestorSibling(node, stayWithin); +} - this.treeAdapter.setTemplateContent(tmpl, content); - this._attachElementToTree(tmpl); - this.openElements.push(tmpl); -}; +/** + * @based on WebKit's NodeTraversal::deepLastChild + * https://trac.webkit.org/browser/trunk/Source/WebCore/dom/NodeTraversal.cpp?rev=179143#L116 + */ +function deepLastChild(node) { + while (node.lastChild) { + node = node.lastChild; + } + return node; +} -Parser.prototype._insertFakeRootElement = function () { - var element = this.treeAdapter.createElement($.HTML, NS.HTML, []); +/** + * @based on WebKit's NodeTraversal::previous + * https://trac.webkit.org/browser/trunk/Source/WebCore/dom/NodeTraversal.h?rev=179143#L121 + */ +function previous(node, stayWithin) { + var p; + p = node.previousSibling; + if (p !== null) { + return deepLastChild(p); + } + p = node.parentNode; + if (p === stayWithin) { + return null; + } + return p; +} - this.treeAdapter.appendChild(this.openElements.current, element); - this.openElements.push(element); -}; -Parser.prototype._appendCommentNode = function (token, parent) { - var commentNode = this.treeAdapter.createCommentNode(token.data); +/***/ }), +/* 37 */ +/***/ (function(module, exports, __webpack_require__) { - this.treeAdapter.appendChild(parent, commentNode); -}; +"use strict"; -Parser.prototype._insertCharacters = function (token) { - if (this._shouldFosterParentOnInsertion()) - this._fosterParentText(token.chars); +var Node = __webpack_require__(3); - else { - var parent = this.openElements.currentTmplContent || this.openElements.current; +var NonDocumentTypeChildNode = { - this.treeAdapter.insertText(parent, token.chars); + nextElementSibling: { get: function() { + if (this.parentNode) { + var sibs = this.parentNode.childNodes; + for(var i = this.index+1, n = sibs.length; i < n; i++) { + if (sibs[i].nodeType === Node.ELEMENT_NODE) return sibs[i]; + } } -}; - -Parser.prototype._adoptNodes = function (donor, recipient) { - while (true) { - var child = this.treeAdapter.getFirstChild(donor); - - if (!child) - break; + return null; + }}, - this.treeAdapter.detachNode(child); - this.treeAdapter.appendChild(recipient, child); + previousElementSibling: { get: function() { + if (this.parentNode) { + var sibs = this.parentNode.childNodes; + for(var i = this.index-1; i >= 0; i--) { + if (sibs[i].nodeType === Node.ELEMENT_NODE) return sibs[i]; + } } -}; + return null; + }} -//Token processing -Parser.prototype._shouldProcessTokenInForeignContent = function (token) { - var current = this._getAdjustedCurrentElement(); +}; - if (!current || current === this.document) - return false; +module.exports = NonDocumentTypeChildNode; - var ns = this.treeAdapter.getNamespaceURI(current); - if (ns === NS.HTML) - return false; +/***/ }), +/* 38 */ +/***/ (function(module, exports, __webpack_require__) { - if (this.treeAdapter.getTagName(current) === $.ANNOTATION_XML && ns === NS.MATHML && - token.type === Tokenizer.START_TAG_TOKEN && token.tagName === $.SVG) - return false; +"use strict"; - var isCharacterToken = token.type === Tokenizer.CHARACTER_TOKEN || - token.type === Tokenizer.NULL_CHARACTER_TOKEN || - token.type === Tokenizer.WHITESPACE_CHARACTER_TOKEN, - isMathMLTextStartTag = token.type === Tokenizer.START_TAG_TOKEN && - token.tagName !== $.MGLYPH && - token.tagName !== $.MALIGNMARK; +module.exports = ProcessingInstruction; - if ((isMathMLTextStartTag || isCharacterToken) && this._isIntegrationPoint(current, NS.MATHML)) - return false; +var Node = __webpack_require__(3); +var CharacterData = __webpack_require__(8); - if ((token.type === Tokenizer.START_TAG_TOKEN || isCharacterToken) && this._isIntegrationPoint(current, NS.HTML)) - return false; +function ProcessingInstruction(doc, target, data) { + this.nodeType = Node.PROCESSING_INSTRUCTION_NODE; + this.ownerDocument = doc; + this.target = target; + this._data = data; +} - return token.type !== Tokenizer.EOF_TOKEN; +var nodeValue = { + get: function() { return this._data; }, + set: function(v) { + this._data = v; + if (this.rooted) this.ownerDocument.mutateValue(this); + } }; -Parser.prototype._processToken = function (token) { - _[this.insertionMode][token.type](this, token); -}; +ProcessingInstruction.prototype = Object.create(CharacterData.prototype, { + nodeName: { get: function() { return this.target; }}, + nodeValue: nodeValue, + textContent: nodeValue, + data: nodeValue, -Parser.prototype._processTokenInBodyMode = function (token) { - _[IN_BODY_MODE][token.type](this, token); -}; + // Utility methods + clone: { value: function clone() { + return new ProcessingInstruction(this.ownerDocument, this.target, this._data); + }}, + isEqual: { value: function isEqual(n) { + return this.target === n.target && this._data === n._data; + }} -Parser.prototype._processTokenInForeignContent = function (token) { - if (token.type === Tokenizer.CHARACTER_TOKEN) - characterInForeignContent(this, token); +}); - else if (token.type === Tokenizer.NULL_CHARACTER_TOKEN) - nullCharacterInForeignContent(this, token); - else if (token.type === Tokenizer.WHITESPACE_CHARACTER_TOKEN) - insertCharacters(this, token); +/***/ }), +/* 39 */ +/***/ (function(module, exports, __webpack_require__) { - else if (token.type === Tokenizer.COMMENT_TOKEN) - appendComment(this, token); +"use strict"; - else if (token.type === Tokenizer.START_TAG_TOKEN) - startTagInForeignContent(this, token); +module.exports = Text; - else if (token.type === Tokenizer.END_TAG_TOKEN) - endTagInForeignContent(this, token); -}; +var utils = __webpack_require__(1); +var Node = __webpack_require__(3); +var CharacterData = __webpack_require__(8); -Parser.prototype._processInputToken = function (token) { - if (this._shouldProcessTokenInForeignContent(token)) - this._processTokenInForeignContent(token); +function Text(doc, data) { + this.nodeType = Node.TEXT_NODE; + this.ownerDocument = doc; + this._data = data; + this._index = undefined; +} - else - this._processToken(token); +var nodeValue = { + get: function() { return this._data; }, + set: function(v) { + if (v === this._data) return; + this._data = v; + if (this.rooted) + this.ownerDocument.mutateValue(this); + if (this.parentNode && + this.parentNode._textchangehook) + this.parentNode._textchangehook(this); + } }; -//Integration points -Parser.prototype._isIntegrationPoint = function (element, foreignNS) { - var tn = this.treeAdapter.getTagName(element), - ns = this.treeAdapter.getNamespaceURI(element), - attrs = this.treeAdapter.getAttrList(element); +Text.prototype = Object.create(CharacterData.prototype, { + nodeName: { value: "#text" }, + // These three attributes are all the same. + // The data attribute has a [TreatNullAs=EmptyString] but we'll + // implement that at the interface level + nodeValue: nodeValue, + textContent: nodeValue, + data: nodeValue, - return foreignContent.isIntegrationPoint(tn, ns, attrs, foreignNS); -}; + splitText: { value: function splitText(offset) { + if (offset > this._data.length || offset < 0) utils.IndexSizeError(); -//Active formatting elements reconstruction -Parser.prototype._reconstructActiveFormattingElements = function () { - var listLength = this.activeFormattingElements.length; + var newdata = this._data.substring(offset), + newnode = this.ownerDocument.createTextNode(newdata); + this.data = this.data.substring(0, offset); - if (listLength) { - var unopenIdx = listLength, - entry = null; + var parent = this.parentNode; + if (parent !== null) + parent.insertBefore(newnode, this.nextSibling); - do { - unopenIdx--; - entry = this.activeFormattingElements.entries[unopenIdx]; + return newnode; + }}, - if (entry.type === FormattingElementList.MARKER_ENTRY || this.openElements.contains(entry.element)) { - unopenIdx++; - break; - } - } while (unopenIdx > 0); + // XXX + // wholeText and replaceWholeText() are not implemented yet because + // the DOMCore specification is considering removing or altering them. + wholeText: {get: utils.nyi }, + replaceWholeText: { value: utils.nyi }, - for (var i = unopenIdx; i < listLength; i++) { - entry = this.activeFormattingElements.entries[i]; - this._insertElement(entry.token, this.treeAdapter.getNamespaceURI(entry.element)); - entry.element = this.openElements.current; - } - } -}; + // Utility methods + clone: { value: function clone() { + return new Text(this.ownerDocument, this._data); + }}, -//Close elements -Parser.prototype._closeTableCell = function () { - this.openElements.generateImpliedEndTags(); - this.openElements.popUntilTableCellPopped(); - this.activeFormattingElements.clearToLastMarker(); - this.insertionMode = IN_ROW_MODE; -}; +}); -Parser.prototype._closePElement = function () { - this.openElements.generateImpliedEndTagsWithExclusion($.P); - this.openElements.popUntilTagNamePopped($.P); -}; -//Insertion modes -Parser.prototype._resetInsertionMode = function () { - for (var i = this.openElements.stackTop, last = false; i >= 0; i--) { - var element = this.openElements.items[i]; +/***/ }), +/* 40 */ +/***/ (function(module, exports, __webpack_require__) { - if (i === 0) { - last = true; +"use strict"; - if (this.fragmentContext) - element = this.fragmentContext; - } +var Event = __webpack_require__(7); - var tn = this.treeAdapter.getTagName(element), - newInsertionMode = INSERTION_MODE_RESET_MAP[tn]; +module.exports = UIEvent; - if (newInsertionMode) { - this.insertionMode = newInsertionMode; - break; - } +function UIEvent() { + // Just use the superclass constructor to initialize + Event.call(this); + this.view = null; // FF uses the current window + this.detail = 0; +} +UIEvent.prototype = Object.create(Event.prototype, { + constructor: { value: UIEvent }, + initUIEvent: { value: function(type, bubbles, cancelable, view, detail) { + this.initEvent(type, bubbles, cancelable); + this.view = view; + this.detail = detail; + }} +}); - else if (!last && (tn === $.TD || tn === $.TH)) { - this.insertionMode = IN_CELL_MODE; - break; - } - else if (!last && tn === $.HEAD) { - this.insertionMode = IN_HEAD_MODE; - break; - } +/***/ }), +/* 41 */ +/***/ (function(module, exports, __webpack_require__) { - else if (tn === $.SELECT) { - this._resetInsertionModeForSelect(i); - break; - } +"use strict"; - else if (tn === $.TEMPLATE) { - this.insertionMode = this.currentTmplInsertionMode; - break; - } +var URL = __webpack_require__(20); - else if (tn === $.HTML) { - this.insertionMode = this.headElement ? AFTER_HEAD_MODE : BEFORE_HEAD_MODE; - break; - } +module.exports = URLUtils; - else if (last) { - this.insertionMode = IN_BODY_MODE; - break; - } - } -}; +// This is an abstract superclass for Location, HTMLAnchorElement and +// other types that have the standard complement of "URL decomposition +// IDL attributes". This is now standardized as URLUtils, see: +// https://url.spec.whatwg.org/#urlutils +// Subclasses must define a getter/setter on href. +// The getter and setter methods parse and rebuild the URL on each +// invocation; there is no attempt to cache the value and be more efficient +function URLUtils() {} +URLUtils.prototype = { + constructor: URLUtils, -Parser.prototype._resetInsertionModeForSelect = function (selectIdx) { - if (selectIdx > 0) { - for (var i = selectIdx - 1; i > 0; i--) { - var ancestor = this.openElements.items[i], - tn = this.treeAdapter.getTagName(ancestor); + get protocol() { + var url = new URL(this.href); + if (url.isAbsolute()) return url.scheme + ":"; + else return ""; + }, - if (tn === $.TEMPLATE) - break; + get host() { + var url = new URL(this.href); + if (url.isAbsolute() && url.isAuthorityBased()) + return url.host + (url.port ? (":" + url.port) : ""); + else + return ""; + }, - else if (tn === $.TABLE) { - this.insertionMode = IN_SELECT_IN_TABLE_MODE; - return; - } - } - } + get hostname() { + var url = new URL(this.href); + if (url.isAbsolute() && url.isAuthorityBased()) + return url.host; + else + return ""; + }, - this.insertionMode = IN_SELECT_MODE; -}; + get port() { + var url = new URL(this.href); + if (url.isAbsolute() && url.isAuthorityBased() && url.port!==undefined) + return url.port; + else + return ""; + }, -Parser.prototype._pushTmplInsertionMode = function (mode) { - this.tmplInsertionModeStack.push(mode); - this.tmplInsertionModeStackTop++; - this.currentTmplInsertionMode = mode; -}; + get pathname() { + var url = new URL(this.href); + if (url.isAbsolute() && url.isHierarchical()) + return url.path; + else + return ""; + }, -Parser.prototype._popTmplInsertionMode = function () { - this.tmplInsertionModeStack.pop(); - this.tmplInsertionModeStackTop--; - this.currentTmplInsertionMode = this.tmplInsertionModeStack[this.tmplInsertionModeStackTop]; -}; + get search() { + var url = new URL(this.href); + if (url.isAbsolute() && url.isHierarchical() && url.query!==undefined) + return "?" + url.query; + else + return ""; + }, -//Foster parenting -Parser.prototype._isElementCausesFosterParenting = function (element) { - var tn = this.treeAdapter.getTagName(element); + get hash() { + var url = new URL(this.href); + if (url.isAbsolute() && url.fragment !== undefined) + return "#" + url.fragment; + else + return ""; + }, + + get username() { + var url = new URL(this.href); + return url.username || ''; + }, + + get password() { + var url = new URL(this.href); + return url.password || ''; + }, + + get origin() { + var url = new URL(this.href); + var originForPort = function(defaultPort) { + var origin = [url.scheme, url.host, +url.port || defaultPort]; + // XXX should be "unicode serialization" + return origin[0] + '://' + origin[1] + + (origin[2] === defaultPort ? '' : (':' + origin[2])); + }; + switch (url.scheme) { + case 'ftp': + return originForPort(21); + case 'gopher': + return originForPort(70); + case 'http': + case 'ws': + return originForPort(80); + case 'https': + case 'wss': + return originForPort(443); + default: + // this is what chrome does + return url.scheme + '://'; + } + }, + + /* + get searchParams() { + var url = new URL(this.href); + // XXX + }, + */ + + set protocol(v) { + var output = this.href; + var url = new URL(output); + if (url.isAbsolute()) { + v = v.replace(/:+$/, ""); + v = v.replace(/[^-+\.a-zA-Z0-9]/g, URL.percentEncode); + if (v.length > 0) { + url.scheme = v; + output = url.toString(); + } + } + this.href = output; + }, + + set host(v) { + var output = this.href; + var url = new URL(output); + if (url.isAbsolute() && url.isAuthorityBased()) { + v = v.replace(/[^-+\._~!$&'()*,;:=a-zA-Z0-9]/g, URL.percentEncode); + if (v.length > 0) { + url.host = v; + delete url.port; + output = url.toString(); + } + } + this.href = output; + }, + + set hostname(v) { + var output = this.href; + var url = new URL(output); + if (url.isAbsolute() && url.isAuthorityBased()) { + v = v.replace(/^\/+/, ""); + v = v.replace(/[^-+\._~!$&'()*,;:=a-zA-Z0-9]/g, URL.percentEncode); + if (v.length > 0) { + url.host = v; + output = url.toString(); + } + } + this.href = output; + }, + + set port(v) { + var output = this.href; + var url = new URL(output); + if (url.isAbsolute() && url.isAuthorityBased()) { + v = '' + v; + v = v.replace(/[^0-9].*$/, ""); + v = v.replace(/^0+/, ""); + if (v.length === 0) v = "0"; + if (parseInt(v, 10) <= 65535) { + url.port = v; + output = url.toString(); + } + } + this.href = output; + }, + + set pathname(v) { + var output = this.href; + var url = new URL(output); + if (url.isAbsolute() && url.isHierarchical()) { + if (v.charAt(0) !== "/") + v = "/" + v; + v = v.replace(/[^-+\._~!$&'()*,;:=@\/a-zA-Z0-9]/g, URL.percentEncode); + url.path = v; + output = url.toString(); + } + this.href = output; + }, + + set search(v) { + var output = this.href; + var url = new URL(output); + if (url.isAbsolute() && url.isHierarchical()) { + if (v.charAt(0) === "?") v = v.substring(1); + v = v.replace(/[^-+\._~!$&'()*,;:=@\/?a-zA-Z0-9]/g, URL.percentEncode); + url.query = v; + output = url.toString(); + } + this.href = output; + }, + + set hash(v) { + var output = this.href; + var url = new URL(output); + if (url.isAbsolute()) { + if (v.charAt(0) === "#") v = v.substring(1); + v = v.replace(/[^-+\._~!$&'()*,;:=@\/?a-zA-Z0-9]/g, URL.percentEncode); + url.fragment = v; + output = url.toString(); + } + this.href = output; + }, + + set username(v) { + var output = this.href; + var url = new URL(output); + if (url.isAbsolute()) { + v = v.replace(/[\x00-\x1F\x7F-\uFFFF "#<>?`\/@\\:]/g, URL.percentEncode); + url.username = v; + output = url.toString(); + } + this.href = output; + }, + + set password(v) { + var output = this.href; + var url = new URL(output); + if (url.isAbsolute()) { + if (v==='') { + url.password = null; + } else { + v = v.replace(/[\x00-\x1F\x7F-\uFFFF "#<>?`\/@\\]/g, URL.percentEncode); + url.password = v; + } + output = url.toString(); + } + this.href = output; + }/*, - return tn === $.TABLE || tn === $.TBODY || tn === $.TFOOT || tn === $.THEAD || tn === $.TR; + set searchParams(v) { + var output = this.href; + var url = new URL(output); + // XXX + this.href = output; + } + */ }; -Parser.prototype._shouldFosterParentOnInsertion = function () { - return this.fosterParentingEnabled && this._isElementCausesFosterParenting(this.openElements.current); +URLUtils._inherit = function(proto) { + // copy getters/setters from URLUtils to o. + Object.getOwnPropertyNames(URLUtils.prototype).forEach(function(p) { + if (p==='constructor' || p==='href') { return; } + var desc = Object.getOwnPropertyDescriptor(URLUtils.prototype, p); + Object.defineProperty(proto, p, desc); + }); }; -Parser.prototype._findFosterParentingLocation = function () { - var location = { - parent: null, - beforeElement: null - }; - - for (var i = this.openElements.stackTop; i >= 0; i--) { - var openElement = this.openElements.items[i], - tn = this.treeAdapter.getTagName(openElement), - ns = this.treeAdapter.getNamespaceURI(openElement); - if (tn === $.TEMPLATE && ns === NS.HTML) { - location.parent = this.treeAdapter.getTemplateContent(openElement); - break; - } +/***/ }), +/* 42 */ +/***/ (function(module, exports, __webpack_require__) { - else if (tn === $.TABLE) { - location.parent = this.treeAdapter.getParentNode(openElement); +"use strict"; - if (location.parent) - location.beforeElement = openElement; - else - location.parent = this.openElements.items[i - 1]; +var utils = __webpack_require__(1); - break; - } - } - - if (!location.parent) - location.parent = this.openElements.items[0]; - - return location; -}; - -Parser.prototype._fosterParentElement = function (element) { - var location = this._findFosterParentingLocation(); - - if (location.beforeElement) - this.treeAdapter.insertBefore(location.parent, element, location.beforeElement); - else - this.treeAdapter.appendChild(location.parent, element); -}; - -Parser.prototype._fosterParentText = function (chars) { - var location = this._findFosterParentingLocation(); - - if (location.beforeElement) - this.treeAdapter.insertTextBefore(location.parent, chars, location.beforeElement); - else - this.treeAdapter.insertText(location.parent, chars); -}; - -//Special elements -Parser.prototype._isSpecialElement = function (element) { - var tn = this.treeAdapter.getTagName(element), - ns = this.treeAdapter.getNamespaceURI(element); - - return HTML.SPECIAL_ELEMENTS[ns][tn]; -}; - -//Adoption agency algorithm -//(see: http://www.whatwg.org/specs/web-apps/current-work/multipage/tree-construction.html#adoptionAgency) -//------------------------------------------------------------------ - -//Steps 5-8 of the algorithm -function aaObtainFormattingElementEntry(p, token) { - var formattingElementEntry = p.activeFormattingElements.getElementEntryInScopeWithTagName(token.tagName); - - if (formattingElementEntry) { - if (!p.openElements.contains(formattingElementEntry.element)) { - p.activeFormattingElements.removeEntry(formattingElementEntry); - formattingElementEntry = null; - } - - else if (!p.openElements.hasInScope(token.tagName)) - formattingElementEntry = null; - } - - else - genericEndTagInBody(p, token); - - return formattingElementEntry; -} - -//Steps 9 and 10 of the algorithm -function aaObtainFurthestBlock(p, formattingElementEntry) { - var furthestBlock = null; - - for (var i = p.openElements.stackTop; i >= 0; i--) { - var element = p.openElements.items[i]; - - if (element === formattingElementEntry.element) - break; - - if (p._isSpecialElement(element)) - furthestBlock = element; - } - - if (!furthestBlock) { - p.openElements.popUntilElementPopped(formattingElementEntry.element); - p.activeFormattingElements.removeEntry(formattingElementEntry); - } - - return furthestBlock; -} - -//Step 13 of the algorithm -function aaInnerLoop(p, furthestBlock, formattingElement) { - var lastElement = furthestBlock, - nextElement = p.openElements.getCommonAncestor(furthestBlock); - - for (var i = 0, element = nextElement; element !== formattingElement; i++, element = nextElement) { - //NOTE: store next element for the next loop iteration (it may be deleted from the stack by step 9.5) - nextElement = p.openElements.getCommonAncestor(element); - - var elementEntry = p.activeFormattingElements.getElementEntry(element), - counterOverflow = elementEntry && i >= AA_INNER_LOOP_ITER, - shouldRemoveFromOpenElements = !elementEntry || counterOverflow; - - if (shouldRemoveFromOpenElements) { - if (counterOverflow) - p.activeFormattingElements.removeEntry(elementEntry); - - p.openElements.remove(element); +exports.property = function(attr) { + if (Array.isArray(attr.type)) { + var valid = Object.create(null); + attr.type.forEach(function(val) { + valid[val.value || val] = val.alias || val; + }); + var missingValueDefault = attr.missing; + if (missingValueDefault===undefined) { missingValueDefault = null; } + var invalidValueDefault = attr.invalid; + if (invalidValueDefault===undefined) { invalidValueDefault = missingValueDefault; } + return { + get: function() { + var v = this._getattr(attr.name); + if (v === null) return missingValueDefault; + + v = valid[v.toLowerCase()]; + if (v !== undefined) return v; + if (invalidValueDefault !== null) return invalidValueDefault; + return v; + }, + set: function(v) { + this._setattr(attr.name, v); + } + }; + } + else if (attr.type === Boolean) { + return { + get: function() { + return this.hasAttribute(attr.name); + }, + set: function(v) { + if (v) { + this._setattr(attr.name, ''); } - else { - element = aaRecreateElementFromEntry(p, elementEntry); - - if (lastElement === furthestBlock) - p.activeFormattingElements.bookmark = elementEntry; - - p.treeAdapter.detachNode(lastElement); - p.treeAdapter.appendChild(element, lastElement); - lastElement = element; + this.removeAttribute(attr.name); } + } + }; + } + else if (attr.type === Number || + attr.type === "long" || + attr.type === "unsigned long" || + attr.type === "limited unsigned long with fallback") { + return numberPropDesc(attr); + } + else if (!attr.type || attr.type === String) { + return { + get: function() { return this._getattr(attr.name) || ''; }, + set: function(v) { + if (attr.treatNullAsEmptyString && v === null) { v = ''; } + this._setattr(attr.name, v); + } + }; + } + else if (typeof attr.type === 'function') { + return attr.type(attr.name, attr); + } + throw new Error('Invalid attribute definition'); +}; + +// See http://www.whatwg.org/specs/web-apps/current-work/#reflect +// +// defval is the default value. If it is a function, then that function +// will be invoked as a method of the element to obtain the default. +// If no default is specified for a given attribute, then the default +// depends on the type of the attribute, but since this function handles +// 4 integer cases, you must specify the default value in each call +// +// min and max define a valid range for getting the attribute. +// +// setmin defines a minimum value when setting. If the value is less +// than that, then throw INDEX_SIZE_ERR. +// +// Conveniently, JavaScript's parseInt function appears to be +// compatible with HTML's 'rules for parsing integers' +function numberPropDesc(a) { + var def; + if(typeof a.default === 'function') { + def = a.default; + } + else if(typeof a.default === 'number') { + def = function() { return a.default; }; + } + else { + def = function() { utils.assert(false, typeof a.default); }; + } + var unsigned_long = (a.type === 'unsigned long'); + var signed_long = (a.type === 'long'); + var unsigned_fallback = (a.type === 'limited unsigned long with fallback'); + var min = a.min, max = a.max, setmin = a.setmin; + if (min === undefined) { + if (unsigned_long) min = 0; + if (signed_long) min = -0x80000000; + if (unsigned_fallback) min = 1; + } + if (max === undefined) { + if (unsigned_long || signed_long || unsigned_fallback) max = 0x7FFFFFFF; + } + + return { + get: function() { + var v = this._getattr(a.name); + var n = a.float ? parseFloat(v) : parseInt(v, 10); + if (v === null || !isFinite(n) || (min !== undefined && n < min) || (max !== undefined && n > max)) { + return def.call(this); + } + if (unsigned_long || signed_long || unsigned_fallback) { + if (!/^[ \t\n\f\r]*[-+]?[0-9]/.test(v)) { return def.call(this); } + n = n|0; // jshint ignore:line + } + return n; + }, + set: function(v) { + if (!a.float) { v = Math.floor(v); } + if (setmin !== undefined && v < setmin) { + utils.IndexSizeError(a.name + ' set to ' + v); + } + if (unsigned_long) { + v = (v < 0 || v > 0x7FFFFFFF) ? def.call(this) : + (v|0); // jshint ignore:line + } else if (unsigned_fallback) { + v = (v < 1 || v > 0x7FFFFFFF) ? def.call(this) : + (v|0); // jshint ignore:line + } else if (signed_long) { + v = (v < -0x80000000 || v > 0x7FFFFFFF) ? def.call(this) : + (v|0); // jshint ignore:line + } + this._setattr(a.name, String(v)); } - - return lastElement; -} - -//Step 13.7 of the algorithm -function aaRecreateElementFromEntry(p, elementEntry) { - var ns = p.treeAdapter.getNamespaceURI(elementEntry.element), - newElement = p.treeAdapter.createElement(elementEntry.token.tagName, ns, elementEntry.token.attrs); - - p.openElements.replace(elementEntry.element, newElement); - elementEntry.element = newElement; - - return newElement; + }; } -//Step 14 of the algorithm -function aaInsertLastNodeInCommonAncestor(p, commonAncestor, lastElement) { - if (p._isElementCausesFosterParenting(commonAncestor)) - p._fosterParentElement(lastElement); - - else { - var tn = p.treeAdapter.getTagName(commonAncestor), - ns = p.treeAdapter.getNamespaceURI(commonAncestor); - - if (tn === $.TEMPLATE && ns === NS.HTML) - commonAncestor = p.treeAdapter.getTemplateContent(commonAncestor); +// This is a utility function for setting up change handler functions +// for attributes like 'id' that require special handling when they change. +exports.registerChangeHandler = function(c, name, handler) { + var p = c.prototype; - p.treeAdapter.appendChild(commonAncestor, lastElement); - } -} + // If p does not already have its own _attributeChangeHandlers + // then create one for it, inheriting from the inherited + // _attributeChangeHandlers. At the top (for the Element class) the + // _attributeChangeHandlers object will be created with a null prototype. + if (!Object.prototype.hasOwnProperty.call(p, '_attributeChangeHandlers')) { + p._attributeChangeHandlers = + Object.create(p._attributeChangeHandlers || null); + } -//Steps 15-19 of the algorithm -function aaReplaceFormattingElement(p, furthestBlock, formattingElementEntry) { - var ns = p.treeAdapter.getNamespaceURI(formattingElementEntry.element), - token = formattingElementEntry.token, - newElement = p.treeAdapter.createElement(token.tagName, ns, token.attrs); + p._attributeChangeHandlers[name] = handler; +}; - p._adoptNodes(furthestBlock, newElement); - p.treeAdapter.appendChild(furthestBlock, newElement); - p.activeFormattingElements.insertElementAfterBookmark(newElement, formattingElementEntry.token); - p.activeFormattingElements.removeEntry(formattingElementEntry); +/***/ }), +/* 43 */ +/***/ (function(module, exports) { - p.openElements.remove(formattingElementEntry.element); - p.openElements.insertAfter(furthestBlock, newElement); -} +/* + * This file defines Domino behaviour that can be externally configured. + * To change these settings, set the relevant global property *before* + * you call `require("domino")`. + */ -//Algorithm entry point -function callAdoptionAgency(p, token) { - var formattingElementEntry; +exports.isApiWritable = !global.__domino_frozen__; - for (var i = 0; i < AA_OUTER_LOOP_ITER; i++) { - formattingElementEntry = aaObtainFormattingElementEntry(p, token, formattingElementEntry); - if (!formattingElementEntry) - break; +/***/ }), +/* 44 */ +/***/ (function(module, exports, __webpack_require__) { - var furthestBlock = aaObtainFurthestBlock(p, formattingElementEntry); +"use strict"; - if (!furthestBlock) - break; - p.activeFormattingElements.bookmark = formattingElementEntry; +var attributes = __webpack_require__(42); +var sloppy = __webpack_require__(47); - var lastElement = aaInnerLoop(p, furthestBlock, formattingElementEntry.element), - commonAncestor = p.openElements.getCommonAncestor(formattingElementEntry.element); +module.exports = function(spec, defaultConstructor, tagList, tagNameToImpl) { + var c = spec.ctor; + if (c) { + var props = spec.props || {}; - p.treeAdapter.detachNode(lastElement); - aaInsertLastNodeInCommonAncestor(p, commonAncestor, lastElement); - aaReplaceFormattingElement(p, furthestBlock, formattingElementEntry); + if (spec.attributes) { + for (var n in spec.attributes) { + var attr = spec.attributes[n]; + if (typeof attr !== 'object' || Array.isArray(attr)) attr = {type: attr}; + if (!attr.name) attr.name = n.toLowerCase(); + props[n] = attributes.property(attr); + } } -} - - -//Generic token handlers -//------------------------------------------------------------------ -function ignoreToken() { - //NOTE: do nothing =) -} - -function appendComment(p, token) { - p._appendCommentNode(token, p.openElements.currentTmplContent || p.openElements.current); -} - -function appendCommentToRootHtmlElement(p, token) { - p._appendCommentNode(token, p.openElements.items[0]); -} - -function appendCommentToDocument(p, token) { - p._appendCommentNode(token, p.document); -} - -function insertCharacters(p, token) { - p._insertCharacters(token); -} - -function stopParsing(p) { - p.stopped = true; -} - -//12.2.5.4.1 The "initial" insertion mode -//------------------------------------------------------------------ -function doctypeInInitialMode(p, token) { - p._setDocumentType(token); - var mode = token.forceQuirks ? - HTML.DOCUMENT_MODE.QUIRKS : - doctype.getDocumentMode(token.name, token.publicId, token.systemId); - - p.treeAdapter.setDocumentMode(p.document, mode); - - p.insertionMode = BEFORE_HTML_MODE; -} - -function tokenInInitialMode(p, token) { - p.treeAdapter.setDocumentMode(p.document, HTML.DOCUMENT_MODE.QUIRKS); - p.insertionMode = BEFORE_HTML_MODE; - p._processToken(token); -} - - -//12.2.5.4.2 The "before html" insertion mode -//------------------------------------------------------------------ -function startTagBeforeHtml(p, token) { - if (token.tagName === $.HTML) { - p._insertElement(token, NS.HTML); - p.insertionMode = BEFORE_HEAD_MODE; + props.constructor = { value : c }; + c.prototype = Object.create((spec.superclass || defaultConstructor).prototype, props); + if (spec.events) { + addEventHandlers(c, spec.events); } + tagList[c.name] = c; + } + else { + c = defaultConstructor; + } - else - tokenBeforeHtml(p, token); -} - -function endTagBeforeHtml(p, token) { - var tn = token.tagName; + (spec.tags || spec.tag && [spec.tag] || []).forEach(function(tag) { + tagNameToImpl[tag] = c; + }); - if (tn === $.HTML || tn === $.HEAD || tn === $.BODY || tn === $.BR) - tokenBeforeHtml(p, token); -} + return c; +}; -function tokenBeforeHtml(p, token) { - p._insertFakeRootElement(); - p.insertionMode = BEFORE_HEAD_MODE; - p._processToken(token); +function EventHandlerBuilder(body, document, form, element) { + this.body = body; + this.document = document; + this.form = form; + this.element = element; } +EventHandlerBuilder.prototype.build = sloppy.EventHandlerBuilder_build; -//12.2.5.4.3 The "before head" insertion mode -//------------------------------------------------------------------ -function startTagBeforeHead(p, token) { - var tn = token.tagName; - - if (tn === $.HTML) - startTagInBody(p, token); - - else if (tn === $.HEAD) { - p._insertElement(token, NS.HTML); - p.headElement = p.openElements.current; - p.insertionMode = IN_HEAD_MODE; - } - - else - tokenBeforeHead(p, token); +function EventHandlerChangeHandler(elt, name, oldval, newval) { + var doc = elt.ownerDocument || Object.create(null); + var form = elt.form || Object.create(null); + elt[name] = new EventHandlerBuilder(newval, doc, form, elt).build(); } -function endTagBeforeHead(p, token) { - var tn = token.tagName; - - if (tn === $.HEAD || tn === $.BODY || tn === $.HTML || tn === $.BR) - tokenBeforeHead(p, token); -} +function addEventHandlers(c, eventHandlerTypes) { + var p = c.prototype; + eventHandlerTypes.forEach(function(type) { + // Define the event handler registration IDL attribute for this type + Object.defineProperty(p, "on" + type, { + get: function() { + return this._getEventHandler(type); + }, + set: function(v) { + this._setEventHandler(type, v); + }, + }); -function tokenBeforeHead(p, token) { - p._insertFakeElement($.HEAD); - p.headElement = p.openElements.current; - p.insertionMode = IN_HEAD_MODE; - p._processToken(token); + // Define special behavior for the content attribute as well + attributes.registerChangeHandler(c, "on" + type, EventHandlerChangeHandler); + }); } -//12.2.5.4.4 The "in head" insertion mode -//------------------------------------------------------------------ -function startTagInHead(p, token) { - var tn = token.tagName; - - if (tn === $.HTML) - startTagInBody(p, token); - - else if (tn === $.BASE || tn === $.BASEFONT || tn === $.BGSOUND || tn === $.LINK || tn === $.META) - p._appendElement(token, NS.HTML); - - else if (tn === $.TITLE) - p._switchToTextParsing(token, Tokenizer.MODE.RCDATA); - - //NOTE: here we assume that we always act as an interactive user agent with enabled scripting, so we parse - // as a rawtext. - else if (tn === $.NOSCRIPT || tn === $.NOFRAMES || tn === $.STYLE) - p._switchToTextParsing(token, Tokenizer.MODE.RAWTEXT); - - else if (tn === $.SCRIPT) - p._switchToTextParsing(token, Tokenizer.MODE.SCRIPT_DATA); - - else if (tn === $.TEMPLATE) { - p._insertTemplate(token, NS.HTML); - p.activeFormattingElements.insertMarker(); - p.framesetOk = false; - p.insertionMode = IN_TEMPLATE_MODE; - p._pushTmplInsertionMode(IN_TEMPLATE_MODE); - } +/***/ }), +/* 45 */ +/***/ (function(module, exports, __webpack_require__) { - else if (tn !== $.HEAD) - tokenInHead(p, token); -} +"use strict"; -function endTagInHead(p, token) { - var tn = token.tagName; +module.exports = { + Event: __webpack_require__(7), + UIEvent: __webpack_require__(40), + MouseEvent: __webpack_require__(35), + CustomEvent: __webpack_require__(73) +}; - if (tn === $.HEAD) { - p.openElements.pop(); - p.insertionMode = AFTER_HEAD_MODE; - } - else if (tn === $.BODY || tn === $.BR || tn === $.HTML) - tokenInHead(p, token); +/***/ }), +/* 46 */ +/***/ (function(module, exports, __webpack_require__) { - else if (tn === $.TEMPLATE && p.openElements.tmplCount > 0) { - p.openElements.generateImpliedEndTags(); - p.openElements.popUntilTagNamePopped($.TEMPLATE); - p.activeFormattingElements.clearToLastMarker(); - p._popTmplInsertionMode(); - p._resetInsertionMode(); - } -} +"use strict"; -function tokenInHead(p, token) { - p.openElements.pop(); - p.insertionMode = AFTER_HEAD_MODE; - p._processToken(token); -} +var utils = __webpack_require__(1); +exports = module.exports = { + CSSStyleDeclaration: __webpack_require__(15), + CharacterData: __webpack_require__(8), + Comment: __webpack_require__(29), + DOMException: __webpack_require__(30), + DOMImplementation: __webpack_require__(9), + DOMTokenList: __webpack_require__(31), + Document: __webpack_require__(17), + DocumentFragment: __webpack_require__(32), + DocumentType: __webpack_require__(18), + Element: __webpack_require__(6), + HTMLParser: __webpack_require__(19), + Node: __webpack_require__(3), + NodeList: __webpack_require__(11), + NodeFilter: __webpack_require__(10), + ProcessingInstruction: __webpack_require__(38), + Text: __webpack_require__(39), + Window: __webpack_require__(21) +}; -//12.2.5.4.6 The "after head" insertion mode -//------------------------------------------------------------------ -function startTagAfterHead(p, token) { - var tn = token.tagName; +utils.merge(exports, __webpack_require__(45)); +utils.merge(exports, __webpack_require__(22).elements); +utils.merge(exports, __webpack_require__(48).elements); - if (tn === $.HTML) - startTagInBody(p, token); - else if (tn === $.BODY) { - p._insertElement(token, NS.HTML); - p.framesetOk = false; - p.insertionMode = IN_BODY_MODE; - } +/***/ }), +/* 47 */ +/***/ (function(module, exports) { - else if (tn === $.FRAMESET) { - p._insertElement(token, NS.HTML); - p.insertionMode = IN_FRAMESET_MODE; +/* Domino uses sloppy-mode features (in particular, `with`) for a few + * minor things. This file encapsulates all the sloppiness; every + * other module should be strict. */ +/* jshint strict: false */ +/* jshint evil: true */ +/* jshint -W085 */ +module.exports = { + Window_run: function _run(code, file) { + if (file) code += '\n//@ sourceURL=' + file; + with(this) eval(code); + }, + EventHandlerBuilder_build: function build() { + try { + with(this.document.defaultView || Object.create(null)) + with(this.document) + with(this.form) + with(this.element) + return eval("(function(event){" + this.body + "})"); } - - else if (tn === $.BASE || tn === $.BASEFONT || tn === $.BGSOUND || tn === $.LINK || tn === $.META || - tn === $.NOFRAMES || tn === $.SCRIPT || tn === $.STYLE || tn === $.TEMPLATE || tn === $.TITLE) { - p.openElements.push(p.headElement); - startTagInHead(p, token); - p.openElements.remove(p.headElement); + catch (err) { + return function() { throw err; }; } + } +}; - else if (tn !== $.HEAD) - tokenAfterHead(p, token); -} - -function endTagAfterHead(p, token) { - var tn = token.tagName; - - if (tn === $.BODY || tn === $.HTML || tn === $.BR) - tokenAfterHead(p, token); - - else if (tn === $.TEMPLATE) - endTagInHead(p, token); -} - -function tokenAfterHead(p, token) { - p._insertFakeElement($.BODY); - p.insertionMode = IN_BODY_MODE; - p._processToken(token); -} +/***/ }), +/* 48 */ +/***/ (function(module, exports, __webpack_require__) { -//12.2.5.4.7 The "in body" insertion mode -//------------------------------------------------------------------ -function whitespaceCharacterInBody(p, token) { - p._reconstructActiveFormattingElements(); - p._insertCharacters(token); -} +"use strict"; -function characterInBody(p, token) { - p._reconstructActiveFormattingElements(); - p._insertCharacters(token); - p.framesetOk = false; -} +var Element = __webpack_require__(6); +var defineElement = __webpack_require__(44); +var utils = __webpack_require__(1); +var CSSStyleDeclaration = __webpack_require__(15); -function htmlStartTagInBody(p, token) { - if (p.openElements.tmplCount === 0) - p.treeAdapter.adoptAttributes(p.openElements.items[0], token.attrs); -} +var svgElements = exports.elements = {}; +var svgNameToImpl = Object.create(null); -function bodyStartTagInBody(p, token) { - var bodyElement = p.openElements.tryPeekProperlyNestedBodyElement(); +exports.createElement = function(doc, localName, prefix) { + var impl = svgNameToImpl[localName] || SVGElement; + return new impl(doc, localName, prefix); +}; - if (bodyElement && p.openElements.tmplCount === 0) { - p.framesetOk = false; - p.treeAdapter.adoptAttributes(bodyElement, token.attrs); - } +function define(spec) { + return defineElement(spec, SVGElement, svgElements, svgNameToImpl); } -function framesetStartTagInBody(p, token) { - var bodyElement = p.openElements.tryPeekProperlyNestedBodyElement(); - - if (p.framesetOk && bodyElement) { - p.treeAdapter.detachNode(bodyElement); - p.openElements.popAllUpToHtmlElement(); - p._insertElement(token, NS.HTML); - p.insertionMode = IN_FRAMESET_MODE; - } -} +var SVGElement = define({ + superclass: Element, + ctor: function SVGElement(doc, localName, prefix) { + Element.call(this, doc, localName, utils.NAMESPACE.SVG, prefix); + }, + props: { + style: { get: function() { + if (!this._style) + this._style = new CSSStyleDeclaration(this); + return this._style; + }} + } +}); -function addressStartTagInBody(p, token) { - if (p.openElements.hasInButtonScope($.P)) - p._closePElement(); +define({ + ctor: function SVGSVGElement(doc, localName, prefix) { + SVGElement.call(this, doc, localName, prefix); + }, + tag: 'svg', + props: { + createSVGRect: { value: function () { + return exports.createElement(this.ownerDocument, 'rect', null); + } } + } +}); - p._insertElement(token, NS.HTML); -} +define({ + tags: [ + 'a', 'altGlyph', 'altGlyphDef', 'altGlyphItem', 'animate', 'animateColor', 'animateMotion', 'animateTransform', + 'circle', 'clipPath', 'color-profile', 'cursor', 'defs', 'desc', 'ellipse', 'feBlend', 'feColorMatrix', + 'feComponentTransfer', 'feComposite', 'feConvolveMatrix', 'feDiffuseLighting', 'feDisplacementMap', 'feDistantLight', + 'feFlood', 'feFuncA', 'feFuncB', 'feFuncG', 'feFuncR', 'feGaussianBlur', 'feImage', 'feMerge', 'feMergeNode', + 'feMorphology', 'feOffset', 'fePointLight', 'feSpecularLighting', 'feSpotLight', 'feTile', 'feTurbulence', 'filter', + 'font', 'font-face', 'font-face-format', 'font-face-name', 'font-face-src', 'font-face-uri', 'foreignObject', 'g', + 'glyph', 'glyphRef', 'hkern', 'image', 'line', 'linearGradient', 'marker', 'mask', 'metadata', 'missing-glyph', + 'mpath', 'path', 'pattern', 'polygon', 'polyline', 'radialGradient', 'rect', 'script', 'set', 'stop', 'style', + 'switch', 'symbol', 'text', 'textPath', 'title', 'tref', 'tspan', 'use', 'view', 'vkern' + ] +}); -function numberedHeaderStartTagInBody(p, token) { - if (p.openElements.hasInButtonScope($.P)) - p._closePElement(); - var tn = p.openElements.currentTagName; +/***/ }), +/* 49 */ +/***/ (function(module, exports, __webpack_require__) { - if (tn === $.H1 || tn === $.H2 || tn === $.H3 || tn === $.H4 || tn === $.H5 || tn === $.H6) - p.openElements.pop(); +"use strict"; - p._insertElement(token, NS.HTML); +var isArray_1 = __webpack_require__(124); +function isNumeric(val) { + // parseFloat NaNs numeric-cast false positives (null|true|false|"") + // ...but misinterprets leading-number strings, particularly hex literals ("0x...") + // subtraction forces infinities to NaN + // adding 1 corrects loss of precision from parseFloat (#15100) + return !isArray_1.isArray(val) && (val - parseFloat(val) + 1) >= 0; } +exports.isNumeric = isNumeric; +; +//# sourceMappingURL=isNumeric.js.map -function preStartTagInBody(p, token) { - if (p.openElements.hasInButtonScope($.P)) - p._closePElement(); - - p._insertElement(token, NS.HTML); - //NOTE: If the next token is a U+000A LINE FEED (LF) character token, then ignore that token and move - //on to the next one. (Newlines at the start of pre blocks are ignored as an authoring convenience.) - p.skipNextNewLine = true; - p.framesetOk = false; -} +/***/ }), +/* 50 */ +/***/ (function(module, exports, __webpack_require__) { -function formStartTagInBody(p, token) { - var inTemplate = p.openElements.tmplCount > 0; +module.exports = (__webpack_require__(0))(1); - if (!p.formElement || inTemplate) { - if (p.openElements.hasInButtonScope($.P)) - p._closePElement(); +/***/ }), +/* 51 */ +/***/ (function(module, exports, __webpack_require__) { - p._insertElement(token, NS.HTML); +module.exports = (__webpack_require__(0))(42); - if (!inTemplate) - p.formElement = p.openElements.current; - } -} +/***/ }), +/* 52 */ +/***/ (function(module, exports, __webpack_require__) { -function listItemStartTagInBody(p, token) { - p.framesetOk = false; +module.exports = (__webpack_require__(0))(47); - var tn = token.tagName; +/***/ }), +/* 53 */ +/***/ (function(module, exports, __webpack_require__) { - for (var i = p.openElements.stackTop; i >= 0; i--) { - var element = p.openElements.items[i], - elementTn = p.treeAdapter.getTagName(element), - closeTn = null; +module.exports = (__webpack_require__(0))(6); - if (tn === $.LI && elementTn === $.LI) - closeTn = $.LI; +/***/ }), +/* 54 */ +/***/ (function(module, exports, __webpack_require__) { - else if ((tn === $.DD || tn === $.DT) && (elementTn === $.DD || elementTn === $.DT)) - closeTn = elementTn; +module.exports = (__webpack_require__(0))(69); - if (closeTn) { - p.openElements.generateImpliedEndTagsWithExclusion(closeTn); - p.openElements.popUntilTagNamePopped(closeTn); - break; - } +/***/ }), +/* 55 */ +/***/ (function(module, exports, __webpack_require__) { - if (elementTn !== $.ADDRESS && elementTn !== $.DIV && elementTn !== $.P && p._isSpecialElement(element)) - break; - } +module.exports = (__webpack_require__(0))(87); - if (p.openElements.hasInButtonScope($.P)) - p._closePElement(); +/***/ }), +/* 56 */ +/***/ (function(module, exports, __webpack_require__) { - p._insertElement(token, NS.HTML); -} +module.exports = (__webpack_require__(0))(9); -function plaintextStartTagInBody(p, token) { - if (p.openElements.hasInButtonScope($.P)) - p._closePElement(); +/***/ }), +/* 57 */ +/***/ (function(module, exports) { - p._insertElement(token, NS.HTML); - p.tokenizer.state = Tokenizer.MODE.PLAINTEXT; -} +module.exports = require("url"); -function buttonStartTagInBody(p, token) { - if (p.openElements.hasInScope($.BUTTON)) { - p.openElements.generateImpliedEndTags(); - p.openElements.popUntilTagNamePopped($.BUTTON); - } +/***/ }), +/* 58 */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { - p._reconstructActiveFormattingElements(); - p._insertElement(token, NS.HTML); - p.framesetOk = false; -} +"use strict"; +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return AppModule; }); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__(4); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0__angular_core__); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__angular_platform_server__ = __webpack_require__(25); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__angular_platform_server___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1__angular_platform_server__); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__app_module_shared__ = __webpack_require__(64); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__components_app_app_component__ = __webpack_require__(28); +var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { + var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); + else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; + return c > 3 && r && Object.defineProperty(target, key, r), r; +}; + + + + +var AppModule = (function () { + function AppModule() { + } + AppModule = __decorate([ + __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_0__angular_core__["NgModule"])({ + bootstrap: [__WEBPACK_IMPORTED_MODULE_3__components_app_app_component__["a" /* AppComponent */]], + imports: [ + __WEBPACK_IMPORTED_MODULE_1__angular_platform_server__["ServerModule"], + __WEBPACK_IMPORTED_MODULE_2__app_module_shared__["a" /* AppModuleShared */] + ], + providers: [ + __WEBPACK_IMPORTED_MODULE_2__app_module_shared__["a" /* AppModuleShared */] + ] + }) + ], AppModule); + return AppModule; +}()); + -function aStartTagInBody(p, token) { - var activeElementEntry = p.activeFormattingElements.getElementEntryInScopeWithTagName($.A); - if (activeElementEntry) { - callAdoptionAgency(p, token); - p.openElements.remove(activeElementEntry.element); - p.activeFormattingElements.removeEntry(activeElementEntry); - } +/***/ }), +/* 59 */ +/***/ (function(module, exports) { - p._reconstructActiveFormattingElements(); - p._insertElement(token, NS.HTML); - p.activeFormattingElements.pushElement(p.openElements.current, token); -} - -function bStartTagInBody(p, token) { - p._reconstructActiveFormattingElements(); - p._insertElement(token, NS.HTML); - p.activeFormattingElements.pushElement(p.openElements.current, token); -} - -function nobrStartTagInBody(p, token) { - p._reconstructActiveFormattingElements(); - - if (p.openElements.hasInScope($.NOBR)) { - callAdoptionAgency(p, token); - p._reconstructActiveFormattingElements(); - } - - p._insertElement(token, NS.HTML); - p.activeFormattingElements.pushElement(p.openElements.current, token); -} - -function appletStartTagInBody(p, token) { - p._reconstructActiveFormattingElements(); - p._insertElement(token, NS.HTML); - p.activeFormattingElements.insertMarker(); - p.framesetOk = false; -} - -function tableStartTagInBody(p, token) { - if (p.treeAdapter.getDocumentMode(p.document) !== HTML.DOCUMENT_MODE.QUIRKS && p.openElements.hasInButtonScope($.P)) - p._closePElement(); - - p._insertElement(token, NS.HTML); - p.framesetOk = false; - p.insertionMode = IN_TABLE_MODE; -} - -function areaStartTagInBody(p, token) { - p._reconstructActiveFormattingElements(); - p._appendElement(token, NS.HTML); - p.framesetOk = false; -} - -function inputStartTagInBody(p, token) { - p._reconstructActiveFormattingElements(); - p._appendElement(token, NS.HTML); - - var inputType = Tokenizer.getTokenAttr(token, ATTRS.TYPE); - - if (!inputType || inputType.toLowerCase() !== HIDDEN_INPUT_TYPE) - p.framesetOk = false; - -} - -function paramStartTagInBody(p, token) { - p._appendElement(token, NS.HTML); -} - -function hrStartTagInBody(p, token) { - if (p.openElements.hasInButtonScope($.P)) - p._closePElement(); - - if (p.openElements.currentTagName === $.MENUITEM) - p.openElements.pop(); - - p._appendElement(token, NS.HTML); - p.framesetOk = false; -} - -function imageStartTagInBody(p, token) { - token.tagName = $.IMG; - areaStartTagInBody(p, token); -} - -function textareaStartTagInBody(p, token) { - p._insertElement(token, NS.HTML); - //NOTE: If the next token is a U+000A LINE FEED (LF) character token, then ignore that token and move - //on to the next one. (Newlines at the start of textarea elements are ignored as an authoring convenience.) - p.skipNextNewLine = true; - p.tokenizer.state = Tokenizer.MODE.RCDATA; - p.originalInsertionMode = p.insertionMode; - p.framesetOk = false; - p.insertionMode = TEXT_MODE; -} - -function xmpStartTagInBody(p, token) { - if (p.openElements.hasInButtonScope($.P)) - p._closePElement(); - - p._reconstructActiveFormattingElements(); - p.framesetOk = false; - p._switchToTextParsing(token, Tokenizer.MODE.RAWTEXT); -} - -function iframeStartTagInBody(p, token) { - p.framesetOk = false; - p._switchToTextParsing(token, Tokenizer.MODE.RAWTEXT); -} - -//NOTE: here we assume that we always act as an user agent with enabled plugins, so we parse -// as a rawtext. -function noembedStartTagInBody(p, token) { - p._switchToTextParsing(token, Tokenizer.MODE.RAWTEXT); -} - -function selectStartTagInBody(p, token) { - p._reconstructActiveFormattingElements(); - p._insertElement(token, NS.HTML); - p.framesetOk = false; - - if (p.insertionMode === IN_TABLE_MODE || - p.insertionMode === IN_CAPTION_MODE || - p.insertionMode === IN_TABLE_BODY_MODE || - p.insertionMode === IN_ROW_MODE || - p.insertionMode === IN_CELL_MODE) - - p.insertionMode = IN_SELECT_IN_TABLE_MODE; - - else - p.insertionMode = IN_SELECT_MODE; -} - -function optgroupStartTagInBody(p, token) { - if (p.openElements.currentTagName === $.OPTION) - p.openElements.pop(); - - p._reconstructActiveFormattingElements(); - p._insertElement(token, NS.HTML); -} - -function rbStartTagInBody(p, token) { - if (p.openElements.hasInScope($.RUBY)) - p.openElements.generateImpliedEndTags(); - - p._insertElement(token, NS.HTML); -} - -function rtStartTagInBody(p, token) { - if (p.openElements.hasInScope($.RUBY)) - p.openElements.generateImpliedEndTagsWithExclusion($.RTC); - - p._insertElement(token, NS.HTML); -} - -function menuitemStartTagInBody(p, token) { - if (p.openElements.currentTagName === $.MENUITEM) - p.openElements.pop(); - - // TODO needs clarification, see https://github.com/whatwg/html/pull/907/files#r73505877 - p._reconstructActiveFormattingElements(); - - p._insertElement(token, NS.HTML); -} - -function menuStartTagInBody(p, token) { - if (p.openElements.hasInButtonScope($.P)) - p._closePElement(); - - if (p.openElements.currentTagName === $.MENUITEM) - p.openElements.pop(); - - p._insertElement(token, NS.HTML); -} - -function mathStartTagInBody(p, token) { - p._reconstructActiveFormattingElements(); - - foreignContent.adjustTokenMathMLAttrs(token); - foreignContent.adjustTokenXMLAttrs(token); - - if (token.selfClosing) - p._appendElement(token, NS.MATHML); - else - p._insertElement(token, NS.MATHML); -} - -function svgStartTagInBody(p, token) { - p._reconstructActiveFormattingElements(); - - foreignContent.adjustTokenSVGAttrs(token); - foreignContent.adjustTokenXMLAttrs(token); - - if (token.selfClosing) - p._appendElement(token, NS.SVG); - else - p._insertElement(token, NS.SVG); -} - -function genericStartTagInBody(p, token) { - p._reconstructActiveFormattingElements(); - p._insertElement(token, NS.HTML); -} - -//OPTIMIZATION: Integer comparisons are low-cost, so we can use very fast tag name length filters here. -//It's faster than using dictionary. -function startTagInBody(p, token) { - var tn = token.tagName; - - switch (tn.length) { - case 1: - if (tn === $.I || tn === $.S || tn === $.B || tn === $.U) - bStartTagInBody(p, token); - - else if (tn === $.P) - addressStartTagInBody(p, token); - - else if (tn === $.A) - aStartTagInBody(p, token); - - else - genericStartTagInBody(p, token); - - break; - - case 2: - if (tn === $.DL || tn === $.OL || tn === $.UL) - addressStartTagInBody(p, token); - - else if (tn === $.H1 || tn === $.H2 || tn === $.H3 || tn === $.H4 || tn === $.H5 || tn === $.H6) - numberedHeaderStartTagInBody(p, token); - - else if (tn === $.LI || tn === $.DD || tn === $.DT) - listItemStartTagInBody(p, token); - - else if (tn === $.EM || tn === $.TT) - bStartTagInBody(p, token); - - else if (tn === $.BR) - areaStartTagInBody(p, token); - - else if (tn === $.HR) - hrStartTagInBody(p, token); - - else if (tn === $.RB) - rbStartTagInBody(p, token); - - else if (tn === $.RT || tn === $.RP) - rtStartTagInBody(p, token); - - else if (tn !== $.TH && tn !== $.TD && tn !== $.TR) - genericStartTagInBody(p, token); - - break; - - case 3: - if (tn === $.DIV || tn === $.DIR || tn === $.NAV) - addressStartTagInBody(p, token); - - else if (tn === $.PRE) - preStartTagInBody(p, token); - - else if (tn === $.BIG) - bStartTagInBody(p, token); - - else if (tn === $.IMG || tn === $.WBR) - areaStartTagInBody(p, token); - - else if (tn === $.XMP) - xmpStartTagInBody(p, token); - - else if (tn === $.SVG) - svgStartTagInBody(p, token); - - else if (tn === $.RTC) - rbStartTagInBody(p, token); - - else if (tn !== $.COL) - genericStartTagInBody(p, token); - - break; - - case 4: - if (tn === $.HTML) - htmlStartTagInBody(p, token); - - else if (tn === $.BASE || tn === $.LINK || tn === $.META) - startTagInHead(p, token); - - else if (tn === $.BODY) - bodyStartTagInBody(p, token); - - else if (tn === $.MAIN) - addressStartTagInBody(p, token); - - else if (tn === $.FORM) - formStartTagInBody(p, token); - - else if (tn === $.CODE || tn === $.FONT) - bStartTagInBody(p, token); - - else if (tn === $.NOBR) - nobrStartTagInBody(p, token); - - else if (tn === $.AREA) - areaStartTagInBody(p, token); - - else if (tn === $.MATH) - mathStartTagInBody(p, token); - - else if (tn === $.MENU) - menuStartTagInBody(p, token); - - else if (tn !== $.HEAD) - genericStartTagInBody(p, token); - - break; - - case 5: - if (tn === $.STYLE || tn === $.TITLE) - startTagInHead(p, token); - - else if (tn === $.ASIDE) - addressStartTagInBody(p, token); - - else if (tn === $.SMALL) - bStartTagInBody(p, token); - - else if (tn === $.TABLE) - tableStartTagInBody(p, token); - - else if (tn === $.EMBED) - areaStartTagInBody(p, token); - - else if (tn === $.INPUT) - inputStartTagInBody(p, token); - - else if (tn === $.PARAM || tn === $.TRACK) - paramStartTagInBody(p, token); - - else if (tn === $.IMAGE) - imageStartTagInBody(p, token); - - else if (tn !== $.FRAME && tn !== $.TBODY && tn !== $.TFOOT && tn !== $.THEAD) - genericStartTagInBody(p, token); - - break; - - case 6: - if (tn === $.SCRIPT) - startTagInHead(p, token); - - else if (tn === $.CENTER || tn === $.FIGURE || tn === $.FOOTER || tn === $.HEADER || tn === $.HGROUP) - addressStartTagInBody(p, token); - - else if (tn === $.BUTTON) - buttonStartTagInBody(p, token); - - else if (tn === $.STRIKE || tn === $.STRONG) - bStartTagInBody(p, token); - - else if (tn === $.APPLET || tn === $.OBJECT) - appletStartTagInBody(p, token); - - else if (tn === $.KEYGEN) - areaStartTagInBody(p, token); - - else if (tn === $.SOURCE) - paramStartTagInBody(p, token); - - else if (tn === $.IFRAME) - iframeStartTagInBody(p, token); - - else if (tn === $.SELECT) - selectStartTagInBody(p, token); - - else if (tn === $.OPTION) - optgroupStartTagInBody(p, token); - - else - genericStartTagInBody(p, token); - - break; - - case 7: - if (tn === $.BGSOUND) - startTagInHead(p, token); - - else if (tn === $.DETAILS || tn === $.ADDRESS || tn === $.ARTICLE || tn === $.SECTION || tn === $.SUMMARY) - addressStartTagInBody(p, token); - - else if (tn === $.LISTING) - preStartTagInBody(p, token); - - else if (tn === $.MARQUEE) - appletStartTagInBody(p, token); - - else if (tn === $.NOEMBED) - noembedStartTagInBody(p, token); - - else if (tn !== $.CAPTION) - genericStartTagInBody(p, token); - - break; - - case 8: - if (tn === $.BASEFONT) - startTagInHead(p, token); - - else if (tn === $.MENUITEM) - menuitemStartTagInBody(p, token); - - else if (tn === $.FRAMESET) - framesetStartTagInBody(p, token); - - else if (tn === $.FIELDSET) - addressStartTagInBody(p, token); - - else if (tn === $.TEXTAREA) - textareaStartTagInBody(p, token); - - else if (tn === $.TEMPLATE) - startTagInHead(p, token); - - else if (tn === $.NOSCRIPT) - noembedStartTagInBody(p, token); - - else if (tn === $.OPTGROUP) - optgroupStartTagInBody(p, token); - - else if (tn !== $.COLGROUP) - genericStartTagInBody(p, token); - - break; - - case 9: - if (tn === $.PLAINTEXT) - plaintextStartTagInBody(p, token); - - else - genericStartTagInBody(p, token); - - break; - - case 10: - if (tn === $.BLOCKQUOTE || tn === $.FIGCAPTION) - addressStartTagInBody(p, token); - - else - genericStartTagInBody(p, token); - - break; - - default: - genericStartTagInBody(p, token); - } -} - -function bodyEndTagInBody(p) { - if (p.openElements.hasInScope($.BODY)) - p.insertionMode = AFTER_BODY_MODE; -} - -function htmlEndTagInBody(p, token) { - if (p.openElements.hasInScope($.BODY)) { - p.insertionMode = AFTER_BODY_MODE; - p._processToken(token); - } -} - -function addressEndTagInBody(p, token) { - var tn = token.tagName; - - if (p.openElements.hasInScope(tn)) { - p.openElements.generateImpliedEndTags(); - p.openElements.popUntilTagNamePopped(tn); - } -} - -function formEndTagInBody(p) { - var inTemplate = p.openElements.tmplCount > 0, - formElement = p.formElement; - - if (!inTemplate) - p.formElement = null; - - if ((formElement || inTemplate) && p.openElements.hasInScope($.FORM)) { - p.openElements.generateImpliedEndTags(); - - if (inTemplate) - p.openElements.popUntilTagNamePopped($.FORM); - - else - p.openElements.remove(formElement); - } -} - -function pEndTagInBody(p) { - if (!p.openElements.hasInButtonScope($.P)) - p._insertFakeElement($.P); - - p._closePElement(); -} - -function liEndTagInBody(p) { - if (p.openElements.hasInListItemScope($.LI)) { - p.openElements.generateImpliedEndTagsWithExclusion($.LI); - p.openElements.popUntilTagNamePopped($.LI); - } -} - -function ddEndTagInBody(p, token) { - var tn = token.tagName; - - if (p.openElements.hasInScope(tn)) { - p.openElements.generateImpliedEndTagsWithExclusion(tn); - p.openElements.popUntilTagNamePopped(tn); - } -} - -function numberedHeaderEndTagInBody(p) { - if (p.openElements.hasNumberedHeaderInScope()) { - p.openElements.generateImpliedEndTags(); - p.openElements.popUntilNumberedHeaderPopped(); - } -} - -function appletEndTagInBody(p, token) { - var tn = token.tagName; - - if (p.openElements.hasInScope(tn)) { - p.openElements.generateImpliedEndTags(); - p.openElements.popUntilTagNamePopped(tn); - p.activeFormattingElements.clearToLastMarker(); - } -} - -function brEndTagInBody(p) { - p._reconstructActiveFormattingElements(); - p._insertFakeElement($.BR); - p.openElements.pop(); - p.framesetOk = false; -} - -function genericEndTagInBody(p, token) { - var tn = token.tagName; - - for (var i = p.openElements.stackTop; i > 0; i--) { - var element = p.openElements.items[i]; - - if (p.treeAdapter.getTagName(element) === tn) { - p.openElements.generateImpliedEndTagsWithExclusion(tn); - p.openElements.popUntilElementPopped(element); - break; - } - - if (p._isSpecialElement(element)) - break; - } -} - -//OPTIMIZATION: Integer comparisons are low-cost, so we can use very fast tag name length filters here. -//It's faster than using dictionary. -function endTagInBody(p, token) { - var tn = token.tagName; - - switch (tn.length) { - case 1: - if (tn === $.A || tn === $.B || tn === $.I || tn === $.S || tn === $.U) - callAdoptionAgency(p, token); - - else if (tn === $.P) - pEndTagInBody(p, token); - - else - genericEndTagInBody(p, token); - - break; - - case 2: - if (tn === $.DL || tn === $.UL || tn === $.OL) - addressEndTagInBody(p, token); - - else if (tn === $.LI) - liEndTagInBody(p, token); - - else if (tn === $.DD || tn === $.DT) - ddEndTagInBody(p, token); - - else if (tn === $.H1 || tn === $.H2 || tn === $.H3 || tn === $.H4 || tn === $.H5 || tn === $.H6) - numberedHeaderEndTagInBody(p, token); - - else if (tn === $.BR) - brEndTagInBody(p, token); - - else if (tn === $.EM || tn === $.TT) - callAdoptionAgency(p, token); - - else - genericEndTagInBody(p, token); - - break; - - case 3: - if (tn === $.BIG) - callAdoptionAgency(p, token); - - else if (tn === $.DIR || tn === $.DIV || tn === $.NAV) - addressEndTagInBody(p, token); - - else - genericEndTagInBody(p, token); - - break; - - case 4: - if (tn === $.BODY) - bodyEndTagInBody(p, token); - - else if (tn === $.HTML) - htmlEndTagInBody(p, token); - - else if (tn === $.FORM) - formEndTagInBody(p, token); - - else if (tn === $.CODE || tn === $.FONT || tn === $.NOBR) - callAdoptionAgency(p, token); - - else if (tn === $.MAIN || tn === $.MENU) - addressEndTagInBody(p, token); - - else - genericEndTagInBody(p, token); - - break; - - case 5: - if (tn === $.ASIDE) - addressEndTagInBody(p, token); - - else if (tn === $.SMALL) - callAdoptionAgency(p, token); - - else - genericEndTagInBody(p, token); - - break; - - case 6: - if (tn === $.CENTER || tn === $.FIGURE || tn === $.FOOTER || tn === $.HEADER || tn === $.HGROUP) - addressEndTagInBody(p, token); - - else if (tn === $.APPLET || tn === $.OBJECT) - appletEndTagInBody(p, token); - - else if (tn === $.STRIKE || tn === $.STRONG) - callAdoptionAgency(p, token); - - else - genericEndTagInBody(p, token); - - break; - - case 7: - if (tn === $.ADDRESS || tn === $.ARTICLE || tn === $.DETAILS || tn === $.SECTION || tn === $.SUMMARY) - addressEndTagInBody(p, token); - - else if (tn === $.MARQUEE) - appletEndTagInBody(p, token); - - else - genericEndTagInBody(p, token); - - break; - - case 8: - if (tn === $.FIELDSET) - addressEndTagInBody(p, token); - - else if (tn === $.TEMPLATE) - endTagInHead(p, token); - - else - genericEndTagInBody(p, token); - - break; - - case 10: - if (tn === $.BLOCKQUOTE || tn === $.FIGCAPTION) - addressEndTagInBody(p, token); - - else - genericEndTagInBody(p, token); - - break; - - default : - genericEndTagInBody(p, token); - } -} - -function eofInBody(p, token) { - if (p.tmplInsertionModeStackTop > -1) - eofInTemplate(p, token); - - else - p.stopped = true; -} - -//12.2.5.4.8 The "text" insertion mode -//------------------------------------------------------------------ -function endTagInText(p, token) { - if (token.tagName === $.SCRIPT) - p.pendingScript = p.openElements.current; - - p.openElements.pop(); - p.insertionMode = p.originalInsertionMode; -} - - -function eofInText(p, token) { - p.openElements.pop(); - p.insertionMode = p.originalInsertionMode; - p._processToken(token); -} - - -//12.2.5.4.9 The "in table" insertion mode -//------------------------------------------------------------------ -function characterInTable(p, token) { - var curTn = p.openElements.currentTagName; - - if (curTn === $.TABLE || curTn === $.TBODY || curTn === $.TFOOT || curTn === $.THEAD || curTn === $.TR) { - p.pendingCharacterTokens = []; - p.hasNonWhitespacePendingCharacterToken = false; - p.originalInsertionMode = p.insertionMode; - p.insertionMode = IN_TABLE_TEXT_MODE; - p._processToken(token); - } - - else - tokenInTable(p, token); -} - -function captionStartTagInTable(p, token) { - p.openElements.clearBackToTableContext(); - p.activeFormattingElements.insertMarker(); - p._insertElement(token, NS.HTML); - p.insertionMode = IN_CAPTION_MODE; -} - -function colgroupStartTagInTable(p, token) { - p.openElements.clearBackToTableContext(); - p._insertElement(token, NS.HTML); - p.insertionMode = IN_COLUMN_GROUP_MODE; -} - -function colStartTagInTable(p, token) { - p.openElements.clearBackToTableContext(); - p._insertFakeElement($.COLGROUP); - p.insertionMode = IN_COLUMN_GROUP_MODE; - p._processToken(token); -} - -function tbodyStartTagInTable(p, token) { - p.openElements.clearBackToTableContext(); - p._insertElement(token, NS.HTML); - p.insertionMode = IN_TABLE_BODY_MODE; -} - -function tdStartTagInTable(p, token) { - p.openElements.clearBackToTableContext(); - p._insertFakeElement($.TBODY); - p.insertionMode = IN_TABLE_BODY_MODE; - p._processToken(token); -} - -function tableStartTagInTable(p, token) { - if (p.openElements.hasInTableScope($.TABLE)) { - p.openElements.popUntilTagNamePopped($.TABLE); - p._resetInsertionMode(); - p._processToken(token); - } -} - -function inputStartTagInTable(p, token) { - var inputType = Tokenizer.getTokenAttr(token, ATTRS.TYPE); - - if (inputType && inputType.toLowerCase() === HIDDEN_INPUT_TYPE) - p._appendElement(token, NS.HTML); - - else - tokenInTable(p, token); -} - -function formStartTagInTable(p, token) { - if (!p.formElement && p.openElements.tmplCount === 0) { - p._insertElement(token, NS.HTML); - p.formElement = p.openElements.current; - p.openElements.pop(); - } -} - -function startTagInTable(p, token) { - var tn = token.tagName; - - switch (tn.length) { - case 2: - if (tn === $.TD || tn === $.TH || tn === $.TR) - tdStartTagInTable(p, token); - - else - tokenInTable(p, token); - - break; - - case 3: - if (tn === $.COL) - colStartTagInTable(p, token); - - else - tokenInTable(p, token); - - break; - - case 4: - if (tn === $.FORM) - formStartTagInTable(p, token); - - else - tokenInTable(p, token); - - break; - - case 5: - if (tn === $.TABLE) - tableStartTagInTable(p, token); - - else if (tn === $.STYLE) - startTagInHead(p, token); - - else if (tn === $.TBODY || tn === $.TFOOT || tn === $.THEAD) - tbodyStartTagInTable(p, token); - - else if (tn === $.INPUT) - inputStartTagInTable(p, token); - - else - tokenInTable(p, token); - - break; - - case 6: - if (tn === $.SCRIPT) - startTagInHead(p, token); - - else - tokenInTable(p, token); - - break; - - case 7: - if (tn === $.CAPTION) - captionStartTagInTable(p, token); - - else - tokenInTable(p, token); - - break; - - case 8: - if (tn === $.COLGROUP) - colgroupStartTagInTable(p, token); - - else if (tn === $.TEMPLATE) - startTagInHead(p, token); - - else - tokenInTable(p, token); - - break; - - default: - tokenInTable(p, token); - } - -} - -function endTagInTable(p, token) { - var tn = token.tagName; - - if (tn === $.TABLE) { - if (p.openElements.hasInTableScope($.TABLE)) { - p.openElements.popUntilTagNamePopped($.TABLE); - p._resetInsertionMode(); - } - } - - else if (tn === $.TEMPLATE) - endTagInHead(p, token); - - else if (tn !== $.BODY && tn !== $.CAPTION && tn !== $.COL && tn !== $.COLGROUP && tn !== $.HTML && - tn !== $.TBODY && tn !== $.TD && tn !== $.TFOOT && tn !== $.TH && tn !== $.THEAD && tn !== $.TR) - tokenInTable(p, token); -} - -function tokenInTable(p, token) { - var savedFosterParentingState = p.fosterParentingEnabled; - - p.fosterParentingEnabled = true; - p._processTokenInBodyMode(token); - p.fosterParentingEnabled = savedFosterParentingState; -} - - -//12.2.5.4.10 The "in table text" insertion mode -//------------------------------------------------------------------ -function whitespaceCharacterInTableText(p, token) { - p.pendingCharacterTokens.push(token); -} - -function characterInTableText(p, token) { - p.pendingCharacterTokens.push(token); - p.hasNonWhitespacePendingCharacterToken = true; -} - -function tokenInTableText(p, token) { - var i = 0; - - if (p.hasNonWhitespacePendingCharacterToken) { - for (; i < p.pendingCharacterTokens.length; i++) - tokenInTable(p, p.pendingCharacterTokens[i]); - } - - else { - for (; i < p.pendingCharacterTokens.length; i++) - p._insertCharacters(p.pendingCharacterTokens[i]); - } - - p.insertionMode = p.originalInsertionMode; - p._processToken(token); -} - - -//12.2.5.4.11 The "in caption" insertion mode -//------------------------------------------------------------------ -function startTagInCaption(p, token) { - var tn = token.tagName; - - if (tn === $.CAPTION || tn === $.COL || tn === $.COLGROUP || tn === $.TBODY || - tn === $.TD || tn === $.TFOOT || tn === $.TH || tn === $.THEAD || tn === $.TR) { - if (p.openElements.hasInTableScope($.CAPTION)) { - p.openElements.generateImpliedEndTags(); - p.openElements.popUntilTagNamePopped($.CAPTION); - p.activeFormattingElements.clearToLastMarker(); - p.insertionMode = IN_TABLE_MODE; - p._processToken(token); - } - } - - else - startTagInBody(p, token); -} - -function endTagInCaption(p, token) { - var tn = token.tagName; - - if (tn === $.CAPTION || tn === $.TABLE) { - if (p.openElements.hasInTableScope($.CAPTION)) { - p.openElements.generateImpliedEndTags(); - p.openElements.popUntilTagNamePopped($.CAPTION); - p.activeFormattingElements.clearToLastMarker(); - p.insertionMode = IN_TABLE_MODE; - - if (tn === $.TABLE) - p._processToken(token); - } - } - - else if (tn !== $.BODY && tn !== $.COL && tn !== $.COLGROUP && tn !== $.HTML && tn !== $.TBODY && - tn !== $.TD && tn !== $.TFOOT && tn !== $.TH && tn !== $.THEAD && tn !== $.TR) - endTagInBody(p, token); -} - - -//12.2.5.4.12 The "in column group" insertion mode -//------------------------------------------------------------------ -function startTagInColumnGroup(p, token) { - var tn = token.tagName; - - if (tn === $.HTML) - startTagInBody(p, token); - - else if (tn === $.COL) - p._appendElement(token, NS.HTML); - - else if (tn === $.TEMPLATE) - startTagInHead(p, token); - - else - tokenInColumnGroup(p, token); -} - -function endTagInColumnGroup(p, token) { - var tn = token.tagName; - - if (tn === $.COLGROUP) { - if (p.openElements.currentTagName === $.COLGROUP) { - p.openElements.pop(); - p.insertionMode = IN_TABLE_MODE; - } - } - - else if (tn === $.TEMPLATE) - endTagInHead(p, token); - - else if (tn !== $.COL) - tokenInColumnGroup(p, token); -} - -function tokenInColumnGroup(p, token) { - if (p.openElements.currentTagName === $.COLGROUP) { - p.openElements.pop(); - p.insertionMode = IN_TABLE_MODE; - p._processToken(token); - } -} - -//12.2.5.4.13 The "in table body" insertion mode -//------------------------------------------------------------------ -function startTagInTableBody(p, token) { - var tn = token.tagName; - - if (tn === $.TR) { - p.openElements.clearBackToTableBodyContext(); - p._insertElement(token, NS.HTML); - p.insertionMode = IN_ROW_MODE; - } - - else if (tn === $.TH || tn === $.TD) { - p.openElements.clearBackToTableBodyContext(); - p._insertFakeElement($.TR); - p.insertionMode = IN_ROW_MODE; - p._processToken(token); - } - - else if (tn === $.CAPTION || tn === $.COL || tn === $.COLGROUP || - tn === $.TBODY || tn === $.TFOOT || tn === $.THEAD) { - - if (p.openElements.hasTableBodyContextInTableScope()) { - p.openElements.clearBackToTableBodyContext(); - p.openElements.pop(); - p.insertionMode = IN_TABLE_MODE; - p._processToken(token); - } - } - - else - startTagInTable(p, token); -} - -function endTagInTableBody(p, token) { - var tn = token.tagName; - - if (tn === $.TBODY || tn === $.TFOOT || tn === $.THEAD) { - if (p.openElements.hasInTableScope(tn)) { - p.openElements.clearBackToTableBodyContext(); - p.openElements.pop(); - p.insertionMode = IN_TABLE_MODE; - } - } - - else if (tn === $.TABLE) { - if (p.openElements.hasTableBodyContextInTableScope()) { - p.openElements.clearBackToTableBodyContext(); - p.openElements.pop(); - p.insertionMode = IN_TABLE_MODE; - p._processToken(token); - } - } - - else if (tn !== $.BODY && tn !== $.CAPTION && tn !== $.COL && tn !== $.COLGROUP || - tn !== $.HTML && tn !== $.TD && tn !== $.TH && tn !== $.TR) - endTagInTable(p, token); -} - -//12.2.5.4.14 The "in row" insertion mode -//------------------------------------------------------------------ -function startTagInRow(p, token) { - var tn = token.tagName; - - if (tn === $.TH || tn === $.TD) { - p.openElements.clearBackToTableRowContext(); - p._insertElement(token, NS.HTML); - p.insertionMode = IN_CELL_MODE; - p.activeFormattingElements.insertMarker(); - } - - else if (tn === $.CAPTION || tn === $.COL || tn === $.COLGROUP || tn === $.TBODY || - tn === $.TFOOT || tn === $.THEAD || tn === $.TR) { - if (p.openElements.hasInTableScope($.TR)) { - p.openElements.clearBackToTableRowContext(); - p.openElements.pop(); - p.insertionMode = IN_TABLE_BODY_MODE; - p._processToken(token); - } - } - - else - startTagInTable(p, token); -} - -function endTagInRow(p, token) { - var tn = token.tagName; - - if (tn === $.TR) { - if (p.openElements.hasInTableScope($.TR)) { - p.openElements.clearBackToTableRowContext(); - p.openElements.pop(); - p.insertionMode = IN_TABLE_BODY_MODE; - } - } - - else if (tn === $.TABLE) { - if (p.openElements.hasInTableScope($.TR)) { - p.openElements.clearBackToTableRowContext(); - p.openElements.pop(); - p.insertionMode = IN_TABLE_BODY_MODE; - p._processToken(token); - } - } - - else if (tn === $.TBODY || tn === $.TFOOT || tn === $.THEAD) { - if (p.openElements.hasInTableScope(tn) || p.openElements.hasInTableScope($.TR)) { - p.openElements.clearBackToTableRowContext(); - p.openElements.pop(); - p.insertionMode = IN_TABLE_BODY_MODE; - p._processToken(token); - } - } - - else if (tn !== $.BODY && tn !== $.CAPTION && tn !== $.COL && tn !== $.COLGROUP || - tn !== $.HTML && tn !== $.TD && tn !== $.TH) - endTagInTable(p, token); -} - - -//12.2.5.4.15 The "in cell" insertion mode -//------------------------------------------------------------------ -function startTagInCell(p, token) { - var tn = token.tagName; - - if (tn === $.CAPTION || tn === $.COL || tn === $.COLGROUP || tn === $.TBODY || - tn === $.TD || tn === $.TFOOT || tn === $.TH || tn === $.THEAD || tn === $.TR) { - - if (p.openElements.hasInTableScope($.TD) || p.openElements.hasInTableScope($.TH)) { - p._closeTableCell(); - p._processToken(token); - } - } - - else - startTagInBody(p, token); -} - -function endTagInCell(p, token) { - var tn = token.tagName; - - if (tn === $.TD || tn === $.TH) { - if (p.openElements.hasInTableScope(tn)) { - p.openElements.generateImpliedEndTags(); - p.openElements.popUntilTagNamePopped(tn); - p.activeFormattingElements.clearToLastMarker(); - p.insertionMode = IN_ROW_MODE; - } - } - - else if (tn === $.TABLE || tn === $.TBODY || tn === $.TFOOT || tn === $.THEAD || tn === $.TR) { - if (p.openElements.hasInTableScope(tn)) { - p._closeTableCell(); - p._processToken(token); - } - } - - else if (tn !== $.BODY && tn !== $.CAPTION && tn !== $.COL && tn !== $.COLGROUP && tn !== $.HTML) - endTagInBody(p, token); -} - -//12.2.5.4.16 The "in select" insertion mode -//------------------------------------------------------------------ -function startTagInSelect(p, token) { - var tn = token.tagName; - - if (tn === $.HTML) - startTagInBody(p, token); - - else if (tn === $.OPTION) { - if (p.openElements.currentTagName === $.OPTION) - p.openElements.pop(); - - p._insertElement(token, NS.HTML); - } - - else if (tn === $.OPTGROUP) { - if (p.openElements.currentTagName === $.OPTION) - p.openElements.pop(); - - if (p.openElements.currentTagName === $.OPTGROUP) - p.openElements.pop(); - - p._insertElement(token, NS.HTML); - } - - else if (tn === $.INPUT || tn === $.KEYGEN || tn === $.TEXTAREA || tn === $.SELECT) { - if (p.openElements.hasInSelectScope($.SELECT)) { - p.openElements.popUntilTagNamePopped($.SELECT); - p._resetInsertionMode(); - - if (tn !== $.SELECT) - p._processToken(token); - } - } - - else if (tn === $.SCRIPT || tn === $.TEMPLATE) - startTagInHead(p, token); -} - -function endTagInSelect(p, token) { - var tn = token.tagName; - - if (tn === $.OPTGROUP) { - var prevOpenElement = p.openElements.items[p.openElements.stackTop - 1], - prevOpenElementTn = prevOpenElement && p.treeAdapter.getTagName(prevOpenElement); - - if (p.openElements.currentTagName === $.OPTION && prevOpenElementTn === $.OPTGROUP) - p.openElements.pop(); - - if (p.openElements.currentTagName === $.OPTGROUP) - p.openElements.pop(); - } - - else if (tn === $.OPTION) { - if (p.openElements.currentTagName === $.OPTION) - p.openElements.pop(); - } - - else if (tn === $.SELECT && p.openElements.hasInSelectScope($.SELECT)) { - p.openElements.popUntilTagNamePopped($.SELECT); - p._resetInsertionMode(); - } - - else if (tn === $.TEMPLATE) - endTagInHead(p, token); -} - -//12.2.5.4.17 The "in select in table" insertion mode -//------------------------------------------------------------------ -function startTagInSelectInTable(p, token) { - var tn = token.tagName; - - if (tn === $.CAPTION || tn === $.TABLE || tn === $.TBODY || tn === $.TFOOT || - tn === $.THEAD || tn === $.TR || tn === $.TD || tn === $.TH) { - p.openElements.popUntilTagNamePopped($.SELECT); - p._resetInsertionMode(); - p._processToken(token); - } - - else - startTagInSelect(p, token); -} - -function endTagInSelectInTable(p, token) { - var tn = token.tagName; - - if (tn === $.CAPTION || tn === $.TABLE || tn === $.TBODY || tn === $.TFOOT || - tn === $.THEAD || tn === $.TR || tn === $.TD || tn === $.TH) { - if (p.openElements.hasInTableScope(tn)) { - p.openElements.popUntilTagNamePopped($.SELECT); - p._resetInsertionMode(); - p._processToken(token); - } - } - - else - endTagInSelect(p, token); -} - -//12.2.5.4.18 The "in template" insertion mode -//------------------------------------------------------------------ -function startTagInTemplate(p, token) { - var tn = token.tagName; - - if (tn === $.BASE || tn === $.BASEFONT || tn === $.BGSOUND || tn === $.LINK || tn === $.META || - tn === $.NOFRAMES || tn === $.SCRIPT || tn === $.STYLE || tn === $.TEMPLATE || tn === $.TITLE) - startTagInHead(p, token); - - else { - var newInsertionMode = TEMPLATE_INSERTION_MODE_SWITCH_MAP[tn] || IN_BODY_MODE; - - p._popTmplInsertionMode(); - p._pushTmplInsertionMode(newInsertionMode); - p.insertionMode = newInsertionMode; - p._processToken(token); - } -} - -function endTagInTemplate(p, token) { - if (token.tagName === $.TEMPLATE) - endTagInHead(p, token); -} - -function eofInTemplate(p, token) { - if (p.openElements.tmplCount > 0) { - p.openElements.popUntilTagNamePopped($.TEMPLATE); - p.activeFormattingElements.clearToLastMarker(); - p._popTmplInsertionMode(); - p._resetInsertionMode(); - p._processToken(token); - } - - else - p.stopped = true; -} - - -//12.2.5.4.19 The "after body" insertion mode -//------------------------------------------------------------------ -function startTagAfterBody(p, token) { - if (token.tagName === $.HTML) - startTagInBody(p, token); - - else - tokenAfterBody(p, token); -} - -function endTagAfterBody(p, token) { - if (token.tagName === $.HTML) { - if (!p.fragmentContext) - p.insertionMode = AFTER_AFTER_BODY_MODE; - } - - else - tokenAfterBody(p, token); -} - -function tokenAfterBody(p, token) { - p.insertionMode = IN_BODY_MODE; - p._processToken(token); -} - -//12.2.5.4.20 The "in frameset" insertion mode -//------------------------------------------------------------------ -function startTagInFrameset(p, token) { - var tn = token.tagName; - - if (tn === $.HTML) - startTagInBody(p, token); - - else if (tn === $.FRAMESET) - p._insertElement(token, NS.HTML); - - else if (tn === $.FRAME) - p._appendElement(token, NS.HTML); - - else if (tn === $.NOFRAMES) - startTagInHead(p, token); -} - -function endTagInFrameset(p, token) { - if (token.tagName === $.FRAMESET && !p.openElements.isRootHtmlElementCurrent()) { - p.openElements.pop(); - - if (!p.fragmentContext && p.openElements.currentTagName !== $.FRAMESET) - p.insertionMode = AFTER_FRAMESET_MODE; - } -} - -//12.2.5.4.21 The "after frameset" insertion mode -//------------------------------------------------------------------ -function startTagAfterFrameset(p, token) { - var tn = token.tagName; - - if (tn === $.HTML) - startTagInBody(p, token); - - else if (tn === $.NOFRAMES) - startTagInHead(p, token); -} - -function endTagAfterFrameset(p, token) { - if (token.tagName === $.HTML) - p.insertionMode = AFTER_AFTER_FRAMESET_MODE; -} - -//12.2.5.4.22 The "after after body" insertion mode -//------------------------------------------------------------------ -function startTagAfterAfterBody(p, token) { - if (token.tagName === $.HTML) - startTagInBody(p, token); - - else - tokenAfterAfterBody(p, token); -} - -function tokenAfterAfterBody(p, token) { - p.insertionMode = IN_BODY_MODE; - p._processToken(token); -} - -//12.2.5.4.23 The "after after frameset" insertion mode -//------------------------------------------------------------------ -function startTagAfterAfterFrameset(p, token) { - var tn = token.tagName; - - if (tn === $.HTML) - startTagInBody(p, token); - - else if (tn === $.NOFRAMES) - startTagInHead(p, token); -} - - -//12.2.5.5 The rules for parsing tokens in foreign content -//------------------------------------------------------------------ -function nullCharacterInForeignContent(p, token) { - token.chars = UNICODE.REPLACEMENT_CHARACTER; - p._insertCharacters(token); -} - -function characterInForeignContent(p, token) { - p._insertCharacters(token); - p.framesetOk = false; -} - -function startTagInForeignContent(p, token) { - if (foreignContent.causesExit(token) && !p.fragmentContext) { - while (p.treeAdapter.getNamespaceURI(p.openElements.current) !== NS.HTML && !p._isIntegrationPoint(p.openElements.current)) - p.openElements.pop(); - - p._processToken(token); - } - - else { - var current = p._getAdjustedCurrentElement(), - currentNs = p.treeAdapter.getNamespaceURI(current); - - if (currentNs === NS.MATHML) - foreignContent.adjustTokenMathMLAttrs(token); - - else if (currentNs === NS.SVG) { - foreignContent.adjustTokenSVGTagName(token); - foreignContent.adjustTokenSVGAttrs(token); - } - - foreignContent.adjustTokenXMLAttrs(token); - - if (token.selfClosing) - p._appendElement(token, currentNs); - else - p._insertElement(token, currentNs); - } -} - -function endTagInForeignContent(p, token) { - for (var i = p.openElements.stackTop; i > 0; i--) { - var element = p.openElements.items[i]; - - if (p.treeAdapter.getNamespaceURI(element) === NS.HTML) { - p._processToken(token); - break; - } - - if (p.treeAdapter.getTagName(element).toLowerCase() === token.tagName) { - p.openElements.popUntilElementPopped(element); - break; - } - } -} - - -/***/ }), -/* 51 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -var HTML = __webpack_require__(11); - -//Aliases -var $ = HTML.TAG_NAMES, - NS = HTML.NAMESPACES; - -//Element utils - -//OPTIMIZATION: Integer comparisons are low-cost, so we can use very fast tag name length filters here. -//It's faster than using dictionary. -function isImpliedEndTagRequired(tn) { - switch (tn.length) { - case 1: - return tn === $.P; - - case 2: - return tn === $.RB || tn === $.RP || tn === $.RT || tn === $.DD || tn === $.DT || tn === $.LI; - - case 3: - return tn === $.RTC; - - case 6: - return tn === $.OPTION; - - case 8: - return tn === $.OPTGROUP || tn === $.MENUITEM; - } - - return false; -} - -function isScopingElement(tn, ns) { - switch (tn.length) { - case 2: - if (tn === $.TD || tn === $.TH) - return ns === NS.HTML; - - else if (tn === $.MI || tn === $.MO || tn === $.MN || tn === $.MS) - return ns === NS.MATHML; - - break; - - case 4: - if (tn === $.HTML) - return ns === NS.HTML; - - else if (tn === $.DESC) - return ns === NS.SVG; - - break; - - case 5: - if (tn === $.TABLE) - return ns === NS.HTML; - - else if (tn === $.MTEXT) - return ns === NS.MATHML; - - else if (tn === $.TITLE) - return ns === NS.SVG; - - break; - - case 6: - return (tn === $.APPLET || tn === $.OBJECT) && ns === NS.HTML; - - case 7: - return (tn === $.CAPTION || tn === $.MARQUEE) && ns === NS.HTML; - - case 8: - return tn === $.TEMPLATE && ns === NS.HTML; - - case 13: - return tn === $.FOREIGN_OBJECT && ns === NS.SVG; - - case 14: - return tn === $.ANNOTATION_XML && ns === NS.MATHML; - } - - return false; -} - -//Stack of open elements -var OpenElementStack = module.exports = function (document, treeAdapter) { - this.stackTop = -1; - this.items = []; - this.current = document; - this.currentTagName = null; - this.currentTmplContent = null; - this.tmplCount = 0; - this.treeAdapter = treeAdapter; -}; - -//Index of element -OpenElementStack.prototype._indexOf = function (element) { - var idx = -1; - - for (var i = this.stackTop; i >= 0; i--) { - if (this.items[i] === element) { - idx = i; - break; - } - } - return idx; -}; - -//Update current element -OpenElementStack.prototype._isInTemplate = function () { - return this.currentTagName === $.TEMPLATE && this.treeAdapter.getNamespaceURI(this.current) === NS.HTML; -}; - -OpenElementStack.prototype._updateCurrentElement = function () { - this.current = this.items[this.stackTop]; - this.currentTagName = this.current && this.treeAdapter.getTagName(this.current); - - this.currentTmplContent = this._isInTemplate() ? this.treeAdapter.getTemplateContent(this.current) : null; -}; - -//Mutations -OpenElementStack.prototype.push = function (element) { - this.items[++this.stackTop] = element; - this._updateCurrentElement(); - - if (this._isInTemplate()) - this.tmplCount++; - -}; - -OpenElementStack.prototype.pop = function () { - this.stackTop--; - - if (this.tmplCount > 0 && this._isInTemplate()) - this.tmplCount--; - - this._updateCurrentElement(); -}; - -OpenElementStack.prototype.replace = function (oldElement, newElement) { - var idx = this._indexOf(oldElement); - - this.items[idx] = newElement; - - if (idx === this.stackTop) - this._updateCurrentElement(); -}; - -OpenElementStack.prototype.insertAfter = function (referenceElement, newElement) { - var insertionIdx = this._indexOf(referenceElement) + 1; - - this.items.splice(insertionIdx, 0, newElement); - - if (insertionIdx === ++this.stackTop) - this._updateCurrentElement(); -}; - -OpenElementStack.prototype.popUntilTagNamePopped = function (tagName) { - while (this.stackTop > -1) { - var tn = this.currentTagName, - ns = this.treeAdapter.getNamespaceURI(this.current); - - this.pop(); - - if (tn === tagName && ns === NS.HTML) - break; - } -}; - -OpenElementStack.prototype.popUntilElementPopped = function (element) { - while (this.stackTop > -1) { - var poppedElement = this.current; - - this.pop(); - - if (poppedElement === element) - break; - } -}; - -OpenElementStack.prototype.popUntilNumberedHeaderPopped = function () { - while (this.stackTop > -1) { - var tn = this.currentTagName, - ns = this.treeAdapter.getNamespaceURI(this.current); - - this.pop(); - - if (tn === $.H1 || tn === $.H2 || tn === $.H3 || tn === $.H4 || tn === $.H5 || tn === $.H6 && ns === NS.HTML) - break; - } -}; - -OpenElementStack.prototype.popUntilTableCellPopped = function () { - while (this.stackTop > -1) { - var tn = this.currentTagName, - ns = this.treeAdapter.getNamespaceURI(this.current); - - this.pop(); - - if (tn === $.TD || tn === $.TH && ns === NS.HTML) - break; - } -}; - -OpenElementStack.prototype.popAllUpToHtmlElement = function () { - //NOTE: here we assume that root element is always first in the open element stack, so - //we perform this fast stack clean up. - this.stackTop = 0; - this._updateCurrentElement(); -}; - -OpenElementStack.prototype.clearBackToTableContext = function () { - while (this.currentTagName !== $.TABLE && - this.currentTagName !== $.TEMPLATE && - this.currentTagName !== $.HTML || - this.treeAdapter.getNamespaceURI(this.current) !== NS.HTML) - this.pop(); -}; - -OpenElementStack.prototype.clearBackToTableBodyContext = function () { - while (this.currentTagName !== $.TBODY && - this.currentTagName !== $.TFOOT && - this.currentTagName !== $.THEAD && - this.currentTagName !== $.TEMPLATE && - this.currentTagName !== $.HTML || - this.treeAdapter.getNamespaceURI(this.current) !== NS.HTML) - this.pop(); -}; - -OpenElementStack.prototype.clearBackToTableRowContext = function () { - while (this.currentTagName !== $.TR && - this.currentTagName !== $.TEMPLATE && - this.currentTagName !== $.HTML || - this.treeAdapter.getNamespaceURI(this.current) !== NS.HTML) - this.pop(); -}; - -OpenElementStack.prototype.remove = function (element) { - for (var i = this.stackTop; i >= 0; i--) { - if (this.items[i] === element) { - this.items.splice(i, 1); - this.stackTop--; - this._updateCurrentElement(); - break; - } - } -}; - -//Search -OpenElementStack.prototype.tryPeekProperlyNestedBodyElement = function () { - //Properly nested element (should be second element in stack). - var element = this.items[1]; - - return element && this.treeAdapter.getTagName(element) === $.BODY ? element : null; -}; - -OpenElementStack.prototype.contains = function (element) { - return this._indexOf(element) > -1; -}; - -OpenElementStack.prototype.getCommonAncestor = function (element) { - var elementIdx = this._indexOf(element); - - return --elementIdx >= 0 ? this.items[elementIdx] : null; -}; - -OpenElementStack.prototype.isRootHtmlElementCurrent = function () { - return this.stackTop === 0 && this.currentTagName === $.HTML; -}; - -//Element in scope -OpenElementStack.prototype.hasInScope = function (tagName) { - for (var i = this.stackTop; i >= 0; i--) { - var tn = this.treeAdapter.getTagName(this.items[i]), - ns = this.treeAdapter.getNamespaceURI(this.items[i]); - - if (tn === tagName && ns === NS.HTML) - return true; - - if (isScopingElement(tn, ns)) - return false; - } - - return true; -}; - -OpenElementStack.prototype.hasNumberedHeaderInScope = function () { - for (var i = this.stackTop; i >= 0; i--) { - var tn = this.treeAdapter.getTagName(this.items[i]), - ns = this.treeAdapter.getNamespaceURI(this.items[i]); - - if ((tn === $.H1 || tn === $.H2 || tn === $.H3 || tn === $.H4 || tn === $.H5 || tn === $.H6) && ns === NS.HTML) - return true; - - if (isScopingElement(tn, ns)) - return false; - } - - return true; -}; - -OpenElementStack.prototype.hasInListItemScope = function (tagName) { - for (var i = this.stackTop; i >= 0; i--) { - var tn = this.treeAdapter.getTagName(this.items[i]), - ns = this.treeAdapter.getNamespaceURI(this.items[i]); - - if (tn === tagName && ns === NS.HTML) - return true; - - if ((tn === $.UL || tn === $.OL) && ns === NS.HTML || isScopingElement(tn, ns)) - return false; - } - - return true; -}; - -OpenElementStack.prototype.hasInButtonScope = function (tagName) { - for (var i = this.stackTop; i >= 0; i--) { - var tn = this.treeAdapter.getTagName(this.items[i]), - ns = this.treeAdapter.getNamespaceURI(this.items[i]); - - if (tn === tagName && ns === NS.HTML) - return true; - - if (tn === $.BUTTON && ns === NS.HTML || isScopingElement(tn, ns)) - return false; - } - - return true; -}; - -OpenElementStack.prototype.hasInTableScope = function (tagName) { - for (var i = this.stackTop; i >= 0; i--) { - var tn = this.treeAdapter.getTagName(this.items[i]), - ns = this.treeAdapter.getNamespaceURI(this.items[i]); - - if (ns !== NS.HTML) - continue; - - if (tn === tagName) - return true; - - if (tn === $.TABLE || tn === $.TEMPLATE || tn === $.HTML) - return false; - } - - return true; -}; - -OpenElementStack.prototype.hasTableBodyContextInTableScope = function () { - for (var i = this.stackTop; i >= 0; i--) { - var tn = this.treeAdapter.getTagName(this.items[i]), - ns = this.treeAdapter.getNamespaceURI(this.items[i]); - - if (ns !== NS.HTML) - continue; - - if (tn === $.TBODY || tn === $.THEAD || tn === $.TFOOT) - return true; - - if (tn === $.TABLE || tn === $.HTML) - return false; - } - - return true; -}; - -OpenElementStack.prototype.hasInSelectScope = function (tagName) { - for (var i = this.stackTop; i >= 0; i--) { - var tn = this.treeAdapter.getTagName(this.items[i]), - ns = this.treeAdapter.getNamespaceURI(this.items[i]); - - if (ns !== NS.HTML) - continue; - - if (tn === tagName) - return true; - - if (tn !== $.OPTION && tn !== $.OPTGROUP) - return false; - } - - return true; -}; - -//Implied end tags -OpenElementStack.prototype.generateImpliedEndTags = function () { - while (isImpliedEndTagRequired(this.currentTagName)) - this.pop(); -}; - -OpenElementStack.prototype.generateImpliedEndTagsWithExclusion = function (exclusionTagName) { - while (isImpliedEndTagRequired(this.currentTagName) && this.currentTagName !== exclusionTagName) - this.pop(); -}; - - -/***/ }), -/* 52 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -var WritableStream = __webpack_require__(31).Writable, - inherits = __webpack_require__(24).inherits, - Parser = __webpack_require__(50); - -var ParserStream = module.exports = function (options) { - WritableStream.call(this); - - this.parser = new Parser(options); - - this.lastChunkWritten = false; - this.writeCallback = null; - this.pausedByScript = false; - - this.document = this.parser.treeAdapter.createDocument(); - - this.pendingHtmlInsertions = []; - - this._resume = this._resume.bind(this); - this._documentWrite = this._documentWrite.bind(this); - this._scriptHandler = this._scriptHandler.bind(this); - - this.parser._bootstrap(this.document, null); -}; - -inherits(ParserStream, WritableStream); - -//WritableStream implementation -ParserStream.prototype._write = function (chunk, encoding, callback) { - this.writeCallback = callback; - this.parser.tokenizer.write(chunk.toString('utf8'), this.lastChunkWritten); - this._runParsingLoop(); -}; - -ParserStream.prototype.end = function (chunk, encoding, callback) { - this.lastChunkWritten = true; - WritableStream.prototype.end.call(this, chunk, encoding, callback); -}; - -//Scriptable parser implementation -ParserStream.prototype._runParsingLoop = function () { - this.parser.runParsingLoopForCurrentChunk(this.writeCallback, this._scriptHandler); -}; - -ParserStream.prototype._resume = function () { - if (!this.pausedByScript) - throw new Error('Parser was already resumed'); - - while (this.pendingHtmlInsertions.length) { - var html = this.pendingHtmlInsertions.pop(); - - this.parser.tokenizer.insertHtmlAtCurrentPos(html); - } - - this.pausedByScript = false; - - //NOTE: keep parsing if we don't wait for the next input chunk - if (this.parser.tokenizer.active) - this._runParsingLoop(); -}; - -ParserStream.prototype._documentWrite = function (html) { - if (!this.parser.stopped) - this.pendingHtmlInsertions.push(html); -}; - -ParserStream.prototype._scriptHandler = function (scriptElement) { - if (this.listeners('script').length) { - this.pausedByScript = true; - this.emit('script', scriptElement, this._documentWrite, this._resume); - } - else - this._runParsingLoop(); -}; - - - -/***/ }), -/* 53 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -var defaultTreeAdapter = __webpack_require__(36), - doctype = __webpack_require__(33), - mergeOptions = __webpack_require__(34), - HTML = __webpack_require__(11); - -//Aliases -var $ = HTML.TAG_NAMES, - NS = HTML.NAMESPACES; - -//Default serializer options -var DEFAULT_OPTIONS = { - treeAdapter: defaultTreeAdapter -}; - -//Escaping regexes -var AMP_REGEX = /&/g, - NBSP_REGEX = /\u00a0/g, - DOUBLE_QUOTE_REGEX = /"/g, - LT_REGEX = //g; - -//Serializer -var Serializer = module.exports = function (node, options) { - this.options = mergeOptions(DEFAULT_OPTIONS, options); - this.treeAdapter = this.options.treeAdapter; - - this.html = ''; - this.startNode = node; -}; - -// NOTE: exported as static method for the testing purposes -Serializer.escapeString = function (str, attrMode) { - str = str - .replace(AMP_REGEX, '&') - .replace(NBSP_REGEX, ' '); - - if (attrMode) - str = str.replace(DOUBLE_QUOTE_REGEX, '"'); - - else { - str = str - .replace(LT_REGEX, '<') - .replace(GT_REGEX, '>'); - } - - return str; -}; - - -//API -Serializer.prototype.serialize = function () { - this._serializeChildNodes(this.startNode); - - return this.html; -}; - - -//Internals -Serializer.prototype._serializeChildNodes = function (parentNode) { - var childNodes = this.treeAdapter.getChildNodes(parentNode); - - if (childNodes) { - for (var i = 0, cnLength = childNodes.length; i < cnLength; i++) { - var currentNode = childNodes[i]; - - if (this.treeAdapter.isElementNode(currentNode)) - this._serializeElement(currentNode); - - else if (this.treeAdapter.isTextNode(currentNode)) - this._serializeTextNode(currentNode); - - else if (this.treeAdapter.isCommentNode(currentNode)) - this._serializeCommentNode(currentNode); - - else if (this.treeAdapter.isDocumentTypeNode(currentNode)) - this._serializeDocumentTypeNode(currentNode); - } - } -}; - -Serializer.prototype._serializeElement = function (node) { - var tn = this.treeAdapter.getTagName(node), - ns = this.treeAdapter.getNamespaceURI(node); - - this.html += '<' + tn; - this._serializeAttributes(node); - this.html += '>'; - - if (tn !== $.AREA && tn !== $.BASE && tn !== $.BASEFONT && tn !== $.BGSOUND && tn !== $.BR && tn !== $.BR && - tn !== $.COL && tn !== $.EMBED && tn !== $.FRAME && tn !== $.HR && tn !== $.IMG && tn !== $.INPUT && - tn !== $.KEYGEN && tn !== $.LINK && tn !== $.MENUITEM && tn !== $.META && tn !== $.PARAM && tn !== $.SOURCE && - tn !== $.TRACK && tn !== $.WBR) { - - var childNodesHolder = tn === $.TEMPLATE && ns === NS.HTML ? - this.treeAdapter.getTemplateContent(node) : - node; - - this._serializeChildNodes(childNodesHolder); - this.html += '' + tn + '>'; - } -}; - -Serializer.prototype._serializeAttributes = function (node) { - var attrs = this.treeAdapter.getAttrList(node); - - for (var i = 0, attrsLength = attrs.length; i < attrsLength; i++) { - var attr = attrs[i], - value = Serializer.escapeString(attr.value, true); - - this.html += ' '; - - if (!attr.namespace) - this.html += attr.name; - - else if (attr.namespace === NS.XML) - this.html += 'xml:' + attr.name; - - else if (attr.namespace === NS.XMLNS) { - if (attr.name !== 'xmlns') - this.html += 'xmlns:'; - - this.html += attr.name; - } - - else if (attr.namespace === NS.XLINK) - this.html += 'xlink:' + attr.name; - - else - this.html += attr.namespace + ':' + attr.name; - - this.html += '="' + value + '"'; - } -}; - -Serializer.prototype._serializeTextNode = function (node) { - var content = this.treeAdapter.getTextNodeContent(node), - parent = this.treeAdapter.getParentNode(node), - parentTn = void 0; - - if (parent && this.treeAdapter.isElementNode(parent)) - parentTn = this.treeAdapter.getTagName(parent); - - if (parentTn === $.STYLE || parentTn === $.SCRIPT || parentTn === $.XMP || parentTn === $.IFRAME || - parentTn === $.NOEMBED || parentTn === $.NOFRAMES || parentTn === $.PLAINTEXT || parentTn === $.NOSCRIPT) - - this.html += content; - - else - this.html += Serializer.escapeString(content, false); -}; - -Serializer.prototype._serializeCommentNode = function (node) { - this.html += ''; -}; - -Serializer.prototype._serializeDocumentTypeNode = function (node) { - var name = this.treeAdapter.getDocumentTypeNodeName(node); - - this.html += '<' + doctype.serializeContent(name, null, null) + '>'; -}; - - -/***/ }), -/* 54 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var interval_1 = __webpack_require__(273); -Observable_1.Observable.interval = interval_1.interval; -//# sourceMappingURL=interval.js.map - -/***/ }), -/* 55 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var throw_1 = __webpack_require__(277); -Observable_1.Observable.throw = throw_1._throw; -//# sourceMappingURL=throw.js.map - -/***/ }), -/* 56 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var timer_1 = __webpack_require__(278); -Observable_1.Observable.timer = timer_1.timer; -//# sourceMappingURL=timer.js.map - -/***/ }), -/* 57 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var catch_1 = __webpack_require__(392); -Observable_1.Observable.prototype.catch = catch_1._catch; -Observable_1.Observable.prototype._catch = catch_1._catch; -//# sourceMappingURL=catch.js.map - -/***/ }), -/* 58 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var map_1 = __webpack_require__(40); -Observable_1.Observable.prototype.map = map_1.map; -//# sourceMappingURL=map.js.map - -/***/ }), -/* 59 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; -var root_1 = __webpack_require__(12); -var tryCatch_1 = __webpack_require__(7); -var errorObject_1 = __webpack_require__(5); -var Observable_1 = __webpack_require__(0); -var Subscriber_1 = __webpack_require__(2); -var map_1 = __webpack_require__(40); -function getCORSRequest() { - if (root_1.root.XMLHttpRequest) { - return new root_1.root.XMLHttpRequest(); - } - else if (!!root_1.root.XDomainRequest) { - return new root_1.root.XDomainRequest(); - } - else { - throw new Error('CORS is not supported by your browser'); - } -} -function getXMLHttpRequest() { - if (root_1.root.XMLHttpRequest) { - return new root_1.root.XMLHttpRequest(); - } - else { - var progId = void 0; - try { - var progIds = ['Msxml2.XMLHTTP', 'Microsoft.XMLHTTP', 'Msxml2.XMLHTTP.4.0']; - for (var i = 0; i < 3; i++) { - try { - progId = progIds[i]; - if (new root_1.root.ActiveXObject(progId)) { - break; - } - } - catch (e) { - } - } - return new root_1.root.ActiveXObject(progId); - } - catch (e) { - throw new Error('XMLHttpRequest is not supported by your browser'); - } - } -} -function ajaxGet(url, headers) { - if (headers === void 0) { headers = null; } - return new AjaxObservable({ method: 'GET', url: url, headers: headers }); -} -exports.ajaxGet = ajaxGet; -; -function ajaxPost(url, body, headers) { - return new AjaxObservable({ method: 'POST', url: url, body: body, headers: headers }); -} -exports.ajaxPost = ajaxPost; -; -function ajaxDelete(url, headers) { - return new AjaxObservable({ method: 'DELETE', url: url, headers: headers }); -} -exports.ajaxDelete = ajaxDelete; -; -function ajaxPut(url, body, headers) { - return new AjaxObservable({ method: 'PUT', url: url, body: body, headers: headers }); -} -exports.ajaxPut = ajaxPut; -; -function ajaxPatch(url, body, headers) { - return new AjaxObservable({ method: 'PATCH', url: url, body: body, headers: headers }); -} -exports.ajaxPatch = ajaxPatch; -; -function ajaxGetJSON(url, headers) { - return new AjaxObservable({ method: 'GET', url: url, responseType: 'json', headers: headers }) - .lift(new map_1.MapOperator(function (x, index) { return x.response; }, null)); -} -exports.ajaxGetJSON = ajaxGetJSON; -; -/** - * We need this JSDoc comment for affecting ESDoc. - * @extends {Ignored} - * @hide true - */ -var AjaxObservable = (function (_super) { - __extends(AjaxObservable, _super); - function AjaxObservable(urlOrRequest) { - _super.call(this); - var request = { - async: true, - createXHR: function () { - return this.crossDomain ? getCORSRequest.call(this) : getXMLHttpRequest(); - }, - crossDomain: false, - withCredentials: false, - headers: {}, - method: 'GET', - responseType: 'json', - timeout: 0 - }; - if (typeof urlOrRequest === 'string') { - request.url = urlOrRequest; - } - else { - for (var prop in urlOrRequest) { - if (urlOrRequest.hasOwnProperty(prop)) { - request[prop] = urlOrRequest[prop]; - } - } - } - this.request = request; - } - AjaxObservable.prototype._subscribe = function (subscriber) { - return new AjaxSubscriber(subscriber, this.request); - }; - /** - * Creates an observable for an Ajax request with either a request object with - * url, headers, etc or a string for a URL. - * - * @example - * source = Rx.Observable.ajax('/products'); - * source = Rx.Observable.ajax({ url: 'products', method: 'GET' }); - * - * @param {string|Object} request Can be one of the following: - * A string of the URL to make the Ajax call. - * An object with the following properties - * - url: URL of the request - * - body: The body of the request - * - method: Method of the request, such as GET, POST, PUT, PATCH, DELETE - * - async: Whether the request is async - * - headers: Optional headers - * - crossDomain: true if a cross domain request, else false - * - createXHR: a function to override if you need to use an alternate - * XMLHttpRequest implementation. - * - resultSelector: a function to use to alter the output value type of - * the Observable. Gets {@link AjaxResponse} as an argument. - * @return {Observable} An observable sequence containing the XMLHttpRequest. - * @static true - * @name ajax - * @owner Observable - */ - AjaxObservable.create = (function () { - var create = function (urlOrRequest) { - return new AjaxObservable(urlOrRequest); - }; - create.get = ajaxGet; - create.post = ajaxPost; - create.delete = ajaxDelete; - create.put = ajaxPut; - create.patch = ajaxPatch; - create.getJSON = ajaxGetJSON; - return create; - })(); - return AjaxObservable; -}(Observable_1.Observable)); -exports.AjaxObservable = AjaxObservable; -/** - * We need this JSDoc comment for affecting ESDoc. - * @ignore - * @extends {Ignored} - */ -var AjaxSubscriber = (function (_super) { - __extends(AjaxSubscriber, _super); - function AjaxSubscriber(destination, request) { - _super.call(this, destination); - this.request = request; - this.done = false; - var headers = request.headers = request.headers || {}; - // force CORS if requested - if (!request.crossDomain && !headers['X-Requested-With']) { - headers['X-Requested-With'] = 'XMLHttpRequest'; - } - // ensure content type is set - if (!('Content-Type' in headers) && !(root_1.root.FormData && request.body instanceof root_1.root.FormData) && typeof request.body !== 'undefined') { - headers['Content-Type'] = 'application/x-www-form-urlencoded; charset=UTF-8'; - } - // properly serialize body - request.body = this.serializeBody(request.body, request.headers['Content-Type']); - this.send(); - } - AjaxSubscriber.prototype.next = function (e) { - this.done = true; - var _a = this, xhr = _a.xhr, request = _a.request, destination = _a.destination; - var response = new AjaxResponse(e, xhr, request); - destination.next(response); - }; - AjaxSubscriber.prototype.send = function () { - var _a = this, request = _a.request, _b = _a.request, user = _b.user, method = _b.method, url = _b.url, async = _b.async, password = _b.password, headers = _b.headers, body = _b.body; - var createXHR = request.createXHR; - var xhr = tryCatch_1.tryCatch(createXHR).call(request); - if (xhr === errorObject_1.errorObject) { - this.error(errorObject_1.errorObject.e); - } - else { - this.xhr = xhr; - // set up the events before open XHR - // https://developer.mozilla.org/en/docs/Web/API/XMLHttpRequest/Using_XMLHttpRequest - // You need to add the event listeners before calling open() on the request. - // Otherwise the progress events will not fire. - this.setupEvents(xhr, request); - // open XHR - var result = void 0; - if (user) { - result = tryCatch_1.tryCatch(xhr.open).call(xhr, method, url, async, user, password); - } - else { - result = tryCatch_1.tryCatch(xhr.open).call(xhr, method, url, async); - } - if (result === errorObject_1.errorObject) { - this.error(errorObject_1.errorObject.e); - return null; - } - // timeout, responseType and withCredentials can be set once the XHR is open - if (async) { - xhr.timeout = request.timeout; - xhr.responseType = request.responseType; - } - if ('withCredentials' in xhr) { - xhr.withCredentials = !!request.withCredentials; - } - // set headers - this.setHeaders(xhr, headers); - // finally send the request - result = body ? tryCatch_1.tryCatch(xhr.send).call(xhr, body) : tryCatch_1.tryCatch(xhr.send).call(xhr); - if (result === errorObject_1.errorObject) { - this.error(errorObject_1.errorObject.e); - return null; - } - } - return xhr; - }; - AjaxSubscriber.prototype.serializeBody = function (body, contentType) { - if (!body || typeof body === 'string') { - return body; - } - else if (root_1.root.FormData && body instanceof root_1.root.FormData) { - return body; - } - if (contentType) { - var splitIndex = contentType.indexOf(';'); - if (splitIndex !== -1) { - contentType = contentType.substring(0, splitIndex); - } - } - switch (contentType) { - case 'application/x-www-form-urlencoded': - return Object.keys(body).map(function (key) { return (encodeURI(key) + "=" + encodeURI(body[key])); }).join('&'); - case 'application/json': - return JSON.stringify(body); - default: - return body; - } - }; - AjaxSubscriber.prototype.setHeaders = function (xhr, headers) { - for (var key in headers) { - if (headers.hasOwnProperty(key)) { - xhr.setRequestHeader(key, headers[key]); - } - } - }; - AjaxSubscriber.prototype.setupEvents = function (xhr, request) { - var progressSubscriber = request.progressSubscriber; - function xhrTimeout(e) { - var _a = xhrTimeout, subscriber = _a.subscriber, progressSubscriber = _a.progressSubscriber, request = _a.request; - if (progressSubscriber) { - progressSubscriber.error(e); - } - subscriber.error(new AjaxTimeoutError(this, request)); //TODO: Make betterer. - } - ; - xhr.ontimeout = xhrTimeout; - xhrTimeout.request = request; - xhrTimeout.subscriber = this; - xhrTimeout.progressSubscriber = progressSubscriber; - if (xhr.upload && 'withCredentials' in xhr) { - if (progressSubscriber) { - var xhrProgress_1; - xhrProgress_1 = function (e) { - var progressSubscriber = xhrProgress_1.progressSubscriber; - progressSubscriber.next(e); - }; - if (root_1.root.XDomainRequest) { - xhr.onprogress = xhrProgress_1; - } - else { - xhr.upload.onprogress = xhrProgress_1; - } - xhrProgress_1.progressSubscriber = progressSubscriber; - } - var xhrError_1; - xhrError_1 = function (e) { - var _a = xhrError_1, progressSubscriber = _a.progressSubscriber, subscriber = _a.subscriber, request = _a.request; - if (progressSubscriber) { - progressSubscriber.error(e); - } - subscriber.error(new AjaxError('ajax error', this, request)); - }; - xhr.onerror = xhrError_1; - xhrError_1.request = request; - xhrError_1.subscriber = this; - xhrError_1.progressSubscriber = progressSubscriber; - } - function xhrReadyStateChange(e) { - var _a = xhrReadyStateChange, subscriber = _a.subscriber, progressSubscriber = _a.progressSubscriber, request = _a.request; - if (this.readyState === 4) { - // normalize IE9 bug (http://bugs.jquery.com/ticket/1450) - var status_1 = this.status === 1223 ? 204 : this.status; - var response = (this.responseType === 'text' ? (this.response || this.responseText) : this.response); - // fix status code when it is 0 (0 status is undocumented). - // Occurs when accessing file resources or on Android 4.1 stock browser - // while retrieving files from application cache. - if (status_1 === 0) { - status_1 = response ? 200 : 0; - } - if (200 <= status_1 && status_1 < 300) { - if (progressSubscriber) { - progressSubscriber.complete(); - } - subscriber.next(e); - subscriber.complete(); - } - else { - if (progressSubscriber) { - progressSubscriber.error(e); - } - subscriber.error(new AjaxError('ajax error ' + status_1, this, request)); - } - } - } - ; - xhr.onreadystatechange = xhrReadyStateChange; - xhrReadyStateChange.subscriber = this; - xhrReadyStateChange.progressSubscriber = progressSubscriber; - xhrReadyStateChange.request = request; - }; - AjaxSubscriber.prototype.unsubscribe = function () { - var _a = this, done = _a.done, xhr = _a.xhr; - if (!done && xhr && xhr.readyState !== 4 && typeof xhr.abort === 'function') { - xhr.abort(); - } - _super.prototype.unsubscribe.call(this); - }; - return AjaxSubscriber; -}(Subscriber_1.Subscriber)); -exports.AjaxSubscriber = AjaxSubscriber; -/** - * A normalized AJAX response. - * - * @see {@link ajax} - * - * @class AjaxResponse - */ -var AjaxResponse = (function () { - function AjaxResponse(originalEvent, xhr, request) { - this.originalEvent = originalEvent; - this.xhr = xhr; - this.request = request; - this.status = xhr.status; - this.responseType = xhr.responseType || request.responseType; - switch (this.responseType) { - case 'json': - if ('response' in xhr) { - //IE does not support json as responseType, parse it internally - this.response = xhr.responseType ? xhr.response : JSON.parse(xhr.response || xhr.responseText || 'null'); - } - else { - this.response = JSON.parse(xhr.responseText || 'null'); - } - break; - case 'xml': - this.response = xhr.responseXML; - break; - case 'text': - default: - this.response = ('response' in xhr) ? xhr.response : xhr.responseText; - break; - } - } - return AjaxResponse; -}()); -exports.AjaxResponse = AjaxResponse; -/** - * A normalized AJAX error. - * - * @see {@link ajax} - * - * @class AjaxError - */ -var AjaxError = (function (_super) { - __extends(AjaxError, _super); - function AjaxError(message, xhr, request) { - _super.call(this, message); - this.message = message; - this.xhr = xhr; - this.request = request; - this.status = xhr.status; - } - return AjaxError; -}(Error)); -exports.AjaxError = AjaxError; -/** - * @see {@link ajax} - * - * @class AjaxTimeoutError - */ -var AjaxTimeoutError = (function (_super) { - __extends(AjaxTimeoutError, _super); - function AjaxTimeoutError(xhr, request) { - _super.call(this, 'ajax timeout', xhr, request); - } - return AjaxTimeoutError; -}(AjaxError)); -exports.AjaxTimeoutError = AjaxTimeoutError; -//# sourceMappingURL=AjaxObservable.js.map - -/***/ }), -/* 60 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; -var Subscriber_1 = __webpack_require__(2); -var tryCatch_1 = __webpack_require__(7); -var errorObject_1 = __webpack_require__(5); -/* tslint:enable:max-line-length */ -/** - * Returns an Observable that emits all items emitted by the source Observable that are distinct by comparison from the previous item. - * - * If a comparator function is provided, then it will be called for each item to test for whether or not that value should be emitted. - * - * If a comparator function is not provided, an equality check is used by default. - * - * @example A simple example with numbers - * Observable.of(1, 1, 2, 2, 2, 1, 1, 2, 3, 3, 4) - * .distinctUntilChanged() - * .subscribe(x => console.log(x)); // 1, 2, 1, 2, 3, 4 - * - * @example An example using a compare function - * interface Person { - * age: number, - * name: string - * } - * - * Observable.of( - * { age: 4, name: 'Foo'}, - * { age: 7, name: 'Bar'}, - * { age: 5, name: 'Foo'}) - * { age: 6, name: 'Foo'}) - * .distinctUntilChanged((p: Person, q: Person) => p.name === q.name) - * .subscribe(x => console.log(x)); - * - * // displays: - * // { age: 4, name: 'Foo' } - * // { age: 7, name: 'Bar' } - * // { age: 5, name: 'Foo' } - * - * @see {@link distinct} - * @see {@link distinctUntilKeyChanged} - * - * @param {function} [compare] Optional comparison function called to test if an item is distinct from the previous item in the source. - * @return {Observable} An Observable that emits items from the source Observable with distinct values. - * @method distinctUntilChanged - * @owner Observable - */ -function distinctUntilChanged(compare, keySelector) { - return this.lift(new DistinctUntilChangedOperator(compare, keySelector)); -} -exports.distinctUntilChanged = distinctUntilChanged; -var DistinctUntilChangedOperator = (function () { - function DistinctUntilChangedOperator(compare, keySelector) { - this.compare = compare; - this.keySelector = keySelector; - } - DistinctUntilChangedOperator.prototype.call = function (subscriber, source) { - return source.subscribe(new DistinctUntilChangedSubscriber(subscriber, this.compare, this.keySelector)); - }; - return DistinctUntilChangedOperator; -}()); -/** - * We need this JSDoc comment for affecting ESDoc. - * @ignore - * @extends {Ignored} - */ -var DistinctUntilChangedSubscriber = (function (_super) { - __extends(DistinctUntilChangedSubscriber, _super); - function DistinctUntilChangedSubscriber(destination, compare, keySelector) { - _super.call(this, destination); - this.keySelector = keySelector; - this.hasKey = false; - if (typeof compare === 'function') { - this.compare = compare; - } - } - DistinctUntilChangedSubscriber.prototype.compare = function (x, y) { - return x === y; - }; - DistinctUntilChangedSubscriber.prototype._next = function (value) { - var keySelector = this.keySelector; - var key = value; - if (keySelector) { - key = tryCatch_1.tryCatch(this.keySelector)(value); - if (key === errorObject_1.errorObject) { - return this.destination.error(errorObject_1.errorObject.e); - } - } - var result = false; - if (this.hasKey) { - result = tryCatch_1.tryCatch(this.compare)(this.key, key); - if (result === errorObject_1.errorObject) { - return this.destination.error(errorObject_1.errorObject.e); - } - } - else { - this.hasKey = true; - } - if (Boolean(result) === false) { - this.key = key; - this.destination.next(value); - } - }; - return DistinctUntilChangedSubscriber; -}(Subscriber_1.Subscriber)); -//# sourceMappingURL=distinctUntilChanged.js.map - -/***/ }), -/* 61 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; -var Subscriber_1 = __webpack_require__(2); -/* tslint:enable:max-line-length */ -/** - * Emits only the first value emitted by the source Observable that meets some - * condition. - * - * Finds the first value that passes some test and emits - * that. - * - * - * - * `find` searches for the first item in the source Observable that matches the - * specified condition embodied by the `predicate`, and returns the first - * occurrence in the source. Unlike {@link first}, the `predicate` is required - * in `find`, and does not emit an error if a valid value is not found. - * - * @example Find and emit the first click that happens on a DIV element - * var clicks = Rx.Observable.fromEvent(document, 'click'); - * var result = clicks.find(ev => ev.target.tagName === 'DIV'); - * result.subscribe(x => console.log(x)); - * - * @see {@link filter} - * @see {@link first} - * @see {@link findIndex} - * @see {@link take} - * - * @param {function(value: T, index: number, source: Observable): boolean} predicate - * A function called with each item to test for condition matching. - * @param {any} [thisArg] An optional argument to determine the value of `this` - * in the `predicate` function. - * @return {Observable} An Observable of the first item that matches the - * condition. - * @method find - * @owner Observable - */ -function find(predicate, thisArg) { - if (typeof predicate !== 'function') { - throw new TypeError('predicate is not a function'); - } - return this.lift(new FindValueOperator(predicate, this, false, thisArg)); -} -exports.find = find; -var FindValueOperator = (function () { - function FindValueOperator(predicate, source, yieldIndex, thisArg) { - this.predicate = predicate; - this.source = source; - this.yieldIndex = yieldIndex; - this.thisArg = thisArg; - } - FindValueOperator.prototype.call = function (observer, source) { - return source.subscribe(new FindValueSubscriber(observer, this.predicate, this.source, this.yieldIndex, this.thisArg)); - }; - return FindValueOperator; -}()); -exports.FindValueOperator = FindValueOperator; -/** - * We need this JSDoc comment for affecting ESDoc. - * @ignore - * @extends {Ignored} - */ -var FindValueSubscriber = (function (_super) { - __extends(FindValueSubscriber, _super); - function FindValueSubscriber(destination, predicate, source, yieldIndex, thisArg) { - _super.call(this, destination); - this.predicate = predicate; - this.source = source; - this.yieldIndex = yieldIndex; - this.thisArg = thisArg; - this.index = 0; - } - FindValueSubscriber.prototype.notifyComplete = function (value) { - var destination = this.destination; - destination.next(value); - destination.complete(); - }; - FindValueSubscriber.prototype._next = function (value) { - var _a = this, predicate = _a.predicate, thisArg = _a.thisArg; - var index = this.index++; - try { - var result = predicate.call(thisArg || this, value, index, this.source); - if (result) { - this.notifyComplete(this.yieldIndex ? index : value); - } - } - catch (err) { - this.destination.error(err); - } - }; - FindValueSubscriber.prototype._complete = function () { - this.notifyComplete(this.yieldIndex ? -1 : undefined); - }; - return FindValueSubscriber; -}(Subscriber_1.Subscriber)); -exports.FindValueSubscriber = FindValueSubscriber; -//# sourceMappingURL=find.js.map - -/***/ }), -/* 62 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; -var OuterSubscriber_1 = __webpack_require__(4); -var subscribeToResult_1 = __webpack_require__(3); -/* tslint:enable:max-line-length */ -/** - * Projects each source value to the same Observable which is merged multiple - * times in the output Observable. - * - * It's like {@link mergeMap}, but maps each value always - * to the same inner Observable. - * - * - * - * Maps each source value to the given Observable `innerObservable` regardless - * of the source value, and then merges those resulting Observables into one - * single Observable, which is the output Observable. - * - * @example For each click event, start an interval Observable ticking every 1 second - * var clicks = Rx.Observable.fromEvent(document, 'click'); - * var result = clicks.mergeMapTo(Rx.Observable.interval(1000)); - * result.subscribe(x => console.log(x)); - * - * @see {@link concatMapTo} - * @see {@link merge} - * @see {@link mergeAll} - * @see {@link mergeMap} - * @see {@link mergeScan} - * @see {@link switchMapTo} - * - * @param {ObservableInput} innerObservable An Observable to replace each value from - * the source Observable. - * @param {function(outerValue: T, innerValue: I, outerIndex: number, innerIndex: number): any} [resultSelector] - * A function to produce the value on the output Observable based on the values - * and the indices of the source (outer) emission and the inner Observable - * emission. The arguments passed to this function are: - * - `outerValue`: the value that came from the source - * - `innerValue`: the value that came from the projected Observable - * - `outerIndex`: the "index" of the value that came from the source - * - `innerIndex`: the "index" of the value from the projected Observable - * @param {number} [concurrent=Number.POSITIVE_INFINITY] Maximum number of input - * Observables being subscribed to concurrently. - * @return {Observable} An Observable that emits items from the given - * `innerObservable` (and optionally transformed through `resultSelector`) every - * time a value is emitted on the source Observable. - * @method mergeMapTo - * @owner Observable - */ -function mergeMapTo(innerObservable, resultSelector, concurrent) { - if (concurrent === void 0) { concurrent = Number.POSITIVE_INFINITY; } - if (typeof resultSelector === 'number') { - concurrent = resultSelector; - resultSelector = null; - } - return this.lift(new MergeMapToOperator(innerObservable, resultSelector, concurrent)); -} -exports.mergeMapTo = mergeMapTo; -// TODO: Figure out correct signature here: an Operator, R> -// needs to implement call(observer: Subscriber): Subscriber> -var MergeMapToOperator = (function () { - function MergeMapToOperator(ish, resultSelector, concurrent) { - if (concurrent === void 0) { concurrent = Number.POSITIVE_INFINITY; } - this.ish = ish; - this.resultSelector = resultSelector; - this.concurrent = concurrent; - } - MergeMapToOperator.prototype.call = function (observer, source) { - return source.subscribe(new MergeMapToSubscriber(observer, this.ish, this.resultSelector, this.concurrent)); - }; - return MergeMapToOperator; -}()); -exports.MergeMapToOperator = MergeMapToOperator; -/** - * We need this JSDoc comment for affecting ESDoc. - * @ignore - * @extends {Ignored} - */ -var MergeMapToSubscriber = (function (_super) { - __extends(MergeMapToSubscriber, _super); - function MergeMapToSubscriber(destination, ish, resultSelector, concurrent) { - if (concurrent === void 0) { concurrent = Number.POSITIVE_INFINITY; } - _super.call(this, destination); - this.ish = ish; - this.resultSelector = resultSelector; - this.concurrent = concurrent; - this.hasCompleted = false; - this.buffer = []; - this.active = 0; - this.index = 0; - } - MergeMapToSubscriber.prototype._next = function (value) { - if (this.active < this.concurrent) { - var resultSelector = this.resultSelector; - var index = this.index++; - var ish = this.ish; - var destination = this.destination; - this.active++; - this._innerSub(ish, destination, resultSelector, value, index); - } - else { - this.buffer.push(value); - } - }; - MergeMapToSubscriber.prototype._innerSub = function (ish, destination, resultSelector, value, index) { - this.add(subscribeToResult_1.subscribeToResult(this, ish, value, index)); - }; - MergeMapToSubscriber.prototype._complete = function () { - this.hasCompleted = true; - if (this.active === 0 && this.buffer.length === 0) { - this.destination.complete(); - } - }; - MergeMapToSubscriber.prototype.notifyNext = function (outerValue, innerValue, outerIndex, innerIndex, innerSub) { - var _a = this, resultSelector = _a.resultSelector, destination = _a.destination; - if (resultSelector) { - this.trySelectResult(outerValue, innerValue, outerIndex, innerIndex); - } - else { - destination.next(innerValue); - } - }; - MergeMapToSubscriber.prototype.trySelectResult = function (outerValue, innerValue, outerIndex, innerIndex) { - var _a = this, resultSelector = _a.resultSelector, destination = _a.destination; - var result; - try { - result = resultSelector(outerValue, innerValue, outerIndex, innerIndex); - } - catch (err) { - destination.error(err); - return; - } - destination.next(result); - }; - MergeMapToSubscriber.prototype.notifyError = function (err) { - this.destination.error(err); - }; - MergeMapToSubscriber.prototype.notifyComplete = function (innerSub) { - var buffer = this.buffer; - this.remove(innerSub); - this.active--; - if (buffer.length > 0) { - this._next(buffer.shift()); - } - else if (this.active === 0 && this.hasCompleted) { - this.destination.complete(); - } - }; - return MergeMapToSubscriber; -}(OuterSubscriber_1.OuterSubscriber)); -exports.MergeMapToSubscriber = MergeMapToSubscriber; -//# sourceMappingURL=mergeMapTo.js.map - -/***/ }), -/* 63 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; -var FromObservable_1 = __webpack_require__(387); -var isArray_1 = __webpack_require__(15); -var OuterSubscriber_1 = __webpack_require__(4); -var subscribeToResult_1 = __webpack_require__(3); -/* tslint:enable:max-line-length */ -/** - * When any of the provided Observable emits an complete or error notification, it immediately subscribes to the next one - * that was passed. - * - * Execute series of Observables no matter what, even if it means swallowing errors. - * - * - * - * `onErrorResumeNext` is an operator that accepts a series of Observables, provided either directly as - * arguments or as an array. If no single Observable is provided, returned Observable will simply behave the same - * as the source. - * - * `onErrorResumeNext` returns an Observable that starts by subscribing and re-emitting values from the source Observable. - * When its stream of values ends - no matter if Observable completed or emitted an error - `onErrorResumeNext` - * will subscribe to the first Observable that was passed as an argument to the method. It will start re-emitting - * its values as well and - again - when that stream ends, `onErrorResumeNext` will proceed to subscribing yet another - * Observable in provided series, no matter if previous Observable completed or ended with an error. This will - * be happening until there is no more Observables left in the series, at which point returned Observable will - * complete - even if the last subscribed stream ended with an error. - * - * `onErrorResumeNext` can be therefore though of as version of {@link concat} operator, which is more permissive - * when it comes to the errors emitted by its input Observables. While `concat` subscribes to the next Observable - * in series only if previous one successfully completed, `onErrorResumeNext` subscribes even if it ended with - * an error. - * - * Note that you do not get any access to errors emitted by the Observables. In particular do not - * expect these errors to appear in error callback passed to {@link subscribe}. If you want to take - * specific actions based on what error was emitted by an Observable, you should try out {@link catch} instead. - * - * - * @example Subscribe to the next Observable after map fails - * Rx.Observable.of(1, 2, 3, 0) - * .map(x => { - * if (x === 0) { throw Error(); } - return 10 / x; - * }) - * .onErrorResumeNext(Rx.Observable.of(1, 2, 3)) - * .subscribe( - * val => console.log(val), - * err => console.log(err), // Will never be called. - * () => console.log('that\'s it!') - * ); - * - * // Logs: - * // 10 - * // 5 - * // 3.3333333333333335 - * // 1 - * // 2 - * // 3 - * // "that's it!" - * - * @see {@link concat} - * @see {@link catch} - * - * @param {...ObservableInput} observables Observables passed either directly or as an array. - * @return {Observable} An Observable that emits values from source Observable, but - if it errors - subscribes - * to the next passed Observable and so on, until it completes or runs out of Observables. - * @method onErrorResumeNext - * @owner Observable - */ -function onErrorResumeNext() { - var nextSources = []; - for (var _i = 0; _i < arguments.length; _i++) { - nextSources[_i - 0] = arguments[_i]; - } - if (nextSources.length === 1 && isArray_1.isArray(nextSources[0])) { - nextSources = nextSources[0]; - } - return this.lift(new OnErrorResumeNextOperator(nextSources)); -} -exports.onErrorResumeNext = onErrorResumeNext; -/* tslint:enable:max-line-length */ -function onErrorResumeNextStatic() { - var nextSources = []; - for (var _i = 0; _i < arguments.length; _i++) { - nextSources[_i - 0] = arguments[_i]; - } - var source = null; - if (nextSources.length === 1 && isArray_1.isArray(nextSources[0])) { - nextSources = nextSources[0]; - } - source = nextSources.shift(); - return new FromObservable_1.FromObservable(source, null).lift(new OnErrorResumeNextOperator(nextSources)); -} -exports.onErrorResumeNextStatic = onErrorResumeNextStatic; -var OnErrorResumeNextOperator = (function () { - function OnErrorResumeNextOperator(nextSources) { - this.nextSources = nextSources; - } - OnErrorResumeNextOperator.prototype.call = function (subscriber, source) { - return source.subscribe(new OnErrorResumeNextSubscriber(subscriber, this.nextSources)); - }; - return OnErrorResumeNextOperator; -}()); -var OnErrorResumeNextSubscriber = (function (_super) { - __extends(OnErrorResumeNextSubscriber, _super); - function OnErrorResumeNextSubscriber(destination, nextSources) { - _super.call(this, destination); - this.destination = destination; - this.nextSources = nextSources; - } - OnErrorResumeNextSubscriber.prototype.notifyError = function (error, innerSub) { - this.subscribeToNextSource(); - }; - OnErrorResumeNextSubscriber.prototype.notifyComplete = function (innerSub) { - this.subscribeToNextSource(); - }; - OnErrorResumeNextSubscriber.prototype._error = function (err) { - this.subscribeToNextSource(); - }; - OnErrorResumeNextSubscriber.prototype._complete = function () { - this.subscribeToNextSource(); - }; - OnErrorResumeNextSubscriber.prototype.subscribeToNextSource = function () { - var next = this.nextSources.shift(); - if (next) { - this.add(subscribeToResult_1.subscribeToResult(this, next)); - } - else { - this.destination.complete(); - } - }; - return OnErrorResumeNextSubscriber; -}(OuterSubscriber_1.OuterSubscriber)); -//# sourceMappingURL=onErrorResumeNext.js.map - -/***/ }), -/* 64 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; -var isArray_1 = __webpack_require__(15); -var ArrayObservable_1 = __webpack_require__(14); -var OuterSubscriber_1 = __webpack_require__(4); -var subscribeToResult_1 = __webpack_require__(3); -/* tslint:enable:max-line-length */ -/** - * Returns an Observable that mirrors the first source Observable to emit an item - * from the combination of this Observable and supplied Observables. - * @param {...Observables} ...observables Sources used to race for which Observable emits first. - * @return {Observable} An Observable that mirrors the output of the first Observable to emit an item. - * @method race - * @owner Observable - */ -function race() { - var observables = []; - for (var _i = 0; _i < arguments.length; _i++) { - observables[_i - 0] = arguments[_i]; - } - // if the only argument is an array, it was most likely called with - // `pair([obs1, obs2, ...])` - if (observables.length === 1 && isArray_1.isArray(observables[0])) { - observables = observables[0]; - } - return this.lift.call(raceStatic.apply(void 0, [this].concat(observables))); -} -exports.race = race; -function raceStatic() { - var observables = []; - for (var _i = 0; _i < arguments.length; _i++) { - observables[_i - 0] = arguments[_i]; - } - // if the only argument is an array, it was most likely called with - // `race([obs1, obs2, ...])` - if (observables.length === 1) { - if (isArray_1.isArray(observables[0])) { - observables = observables[0]; - } - else { - return observables[0]; - } - } - return new ArrayObservable_1.ArrayObservable(observables).lift(new RaceOperator()); -} -exports.raceStatic = raceStatic; -var RaceOperator = (function () { - function RaceOperator() { - } - RaceOperator.prototype.call = function (subscriber, source) { - return source.subscribe(new RaceSubscriber(subscriber)); - }; - return RaceOperator; -}()); -exports.RaceOperator = RaceOperator; -/** - * We need this JSDoc comment for affecting ESDoc. - * @ignore - * @extends {Ignored} - */ -var RaceSubscriber = (function (_super) { - __extends(RaceSubscriber, _super); - function RaceSubscriber(destination) { - _super.call(this, destination); - this.hasFirst = false; - this.observables = []; - this.subscriptions = []; - } - RaceSubscriber.prototype._next = function (observable) { - this.observables.push(observable); - }; - RaceSubscriber.prototype._complete = function () { - var observables = this.observables; - var len = observables.length; - if (len === 0) { - this.destination.complete(); - } - else { - for (var i = 0; i < len && !this.hasFirst; i++) { - var observable = observables[i]; - var subscription = subscribeToResult_1.subscribeToResult(this, observable, observable, i); - if (this.subscriptions) { - this.subscriptions.push(subscription); - } - this.add(subscription); - } - this.observables = null; - } - }; - RaceSubscriber.prototype.notifyNext = function (outerValue, innerValue, outerIndex, innerIndex, innerSub) { - if (!this.hasFirst) { - this.hasFirst = true; - for (var i = 0; i < this.subscriptions.length; i++) { - if (i !== outerIndex) { - var subscription = this.subscriptions[i]; - subscription.unsubscribe(); - this.remove(subscription); - } - } - this.subscriptions = null; - } - this.destination.next(innerValue); - }; - return RaceSubscriber; -}(OuterSubscriber_1.OuterSubscriber)); -exports.RaceSubscriber = RaceSubscriber; -//# sourceMappingURL=race.js.map - -/***/ }), -/* 65 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; -var OuterSubscriber_1 = __webpack_require__(4); -var subscribeToResult_1 = __webpack_require__(3); -exports.defaultThrottleConfig = { - leading: true, - trailing: false -}; -/** - * Emits a value from the source Observable, then ignores subsequent source - * values for a duration determined by another Observable, then repeats this - * process. - * - * It's like {@link throttleTime}, but the silencing - * duration is determined by a second Observable. - * - * - * - * `throttle` emits the source Observable values on the output Observable - * when its internal timer is disabled, and ignores source values when the timer - * is enabled. Initially, the timer is disabled. As soon as the first source - * value arrives, it is forwarded to the output Observable, and then the timer - * is enabled by calling the `durationSelector` function with the source value, - * which returns the "duration" Observable. When the duration Observable emits a - * value or completes, the timer is disabled, and this process repeats for the - * next source value. - * - * @example Emit clicks at a rate of at most one click per second - * var clicks = Rx.Observable.fromEvent(document, 'click'); - * var result = clicks.throttle(ev => Rx.Observable.interval(1000)); - * result.subscribe(x => console.log(x)); - * - * @see {@link audit} - * @see {@link debounce} - * @see {@link delayWhen} - * @see {@link sample} - * @see {@link throttleTime} - * - * @param {function(value: T): SubscribableOrPromise} durationSelector A function - * that receives a value from the source Observable, for computing the silencing - * duration for each source value, returned as an Observable or a Promise. - * @param {Object} config a configuration object to define `leading` and `trailing` behavior. Defaults - * to `{ leading: true, trailing: false }`. - * @return {Observable} An Observable that performs the throttle operation to - * limit the rate of emissions from the source. - * @method throttle - * @owner Observable - */ -function throttle(durationSelector, config) { - if (config === void 0) { config = exports.defaultThrottleConfig; } - return this.lift(new ThrottleOperator(durationSelector, config.leading, config.trailing)); -} -exports.throttle = throttle; -var ThrottleOperator = (function () { - function ThrottleOperator(durationSelector, leading, trailing) { - this.durationSelector = durationSelector; - this.leading = leading; - this.trailing = trailing; - } - ThrottleOperator.prototype.call = function (subscriber, source) { - return source.subscribe(new ThrottleSubscriber(subscriber, this.durationSelector, this.leading, this.trailing)); - }; - return ThrottleOperator; -}()); -/** - * We need this JSDoc comment for affecting ESDoc - * @ignore - * @extends {Ignored} - */ -var ThrottleSubscriber = (function (_super) { - __extends(ThrottleSubscriber, _super); - function ThrottleSubscriber(destination, durationSelector, _leading, _trailing) { - _super.call(this, destination); - this.destination = destination; - this.durationSelector = durationSelector; - this._leading = _leading; - this._trailing = _trailing; - this._hasTrailingValue = false; - } - ThrottleSubscriber.prototype._next = function (value) { - if (this.throttled) { - if (this._trailing) { - this._hasTrailingValue = true; - this._trailingValue = value; - } - } - else { - var duration = this.tryDurationSelector(value); - if (duration) { - this.add(this.throttled = subscribeToResult_1.subscribeToResult(this, duration)); - } - if (this._leading) { - this.destination.next(value); - if (this._trailing) { - this._hasTrailingValue = true; - this._trailingValue = value; - } - } - } - }; - ThrottleSubscriber.prototype.tryDurationSelector = function (value) { - try { - return this.durationSelector(value); - } - catch (err) { - this.destination.error(err); - return null; - } - }; - ThrottleSubscriber.prototype._unsubscribe = function () { - var _a = this, throttled = _a.throttled, _trailingValue = _a._trailingValue, _hasTrailingValue = _a._hasTrailingValue, _trailing = _a._trailing; - this._trailingValue = null; - this._hasTrailingValue = false; - if (throttled) { - this.remove(throttled); - this.throttled = null; - throttled.unsubscribe(); - } - }; - ThrottleSubscriber.prototype._sendTrailing = function () { - var _a = this, destination = _a.destination, throttled = _a.throttled, _trailing = _a._trailing, _trailingValue = _a._trailingValue, _hasTrailingValue = _a._hasTrailingValue; - if (throttled && _trailing && _hasTrailingValue) { - destination.next(_trailingValue); - this._trailingValue = null; - this._hasTrailingValue = false; - } - }; - ThrottleSubscriber.prototype.notifyNext = function (outerValue, innerValue, outerIndex, innerIndex, innerSub) { - this._sendTrailing(); - this._unsubscribe(); - }; - ThrottleSubscriber.prototype.notifyComplete = function () { - this._sendTrailing(); - this._unsubscribe(); - }; - return ThrottleSubscriber; -}(OuterSubscriber_1.OuterSubscriber)); -//# sourceMappingURL=throttle.js.map - -/***/ }), -/* 66 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; -var Subscriber_1 = __webpack_require__(2); -var async_1 = __webpack_require__(8); -/** - * @param scheduler - * @return {Observable>|WebSocketSubject|Observable} - * @method timeInterval - * @owner Observable - */ -function timeInterval(scheduler) { - if (scheduler === void 0) { scheduler = async_1.async; } - return this.lift(new TimeIntervalOperator(scheduler)); -} -exports.timeInterval = timeInterval; -var TimeInterval = (function () { - function TimeInterval(value, interval) { - this.value = value; - this.interval = interval; - } - return TimeInterval; -}()); -exports.TimeInterval = TimeInterval; -; -var TimeIntervalOperator = (function () { - function TimeIntervalOperator(scheduler) { - this.scheduler = scheduler; - } - TimeIntervalOperator.prototype.call = function (observer, source) { - return source.subscribe(new TimeIntervalSubscriber(observer, this.scheduler)); - }; - return TimeIntervalOperator; -}()); -/** - * We need this JSDoc comment for affecting ESDoc. - * @ignore - * @extends {Ignored} - */ -var TimeIntervalSubscriber = (function (_super) { - __extends(TimeIntervalSubscriber, _super); - function TimeIntervalSubscriber(destination, scheduler) { - _super.call(this, destination); - this.scheduler = scheduler; - this.lastTime = 0; - this.lastTime = scheduler.now(); - } - TimeIntervalSubscriber.prototype._next = function (value) { - var now = this.scheduler.now(); - var span = now - this.lastTime; - this.lastTime = now; - this.destination.next(new TimeInterval(value, span)); - }; - return TimeIntervalSubscriber; -}(Subscriber_1.Subscriber)); -//# sourceMappingURL=timeInterval.js.map - -/***/ }), -/* 67 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; -var Subscriber_1 = __webpack_require__(2); -var async_1 = __webpack_require__(8); -/** - * @param scheduler - * @return {Observable>|WebSocketSubject|Observable} - * @method timestamp - * @owner Observable - */ -function timestamp(scheduler) { - if (scheduler === void 0) { scheduler = async_1.async; } - return this.lift(new TimestampOperator(scheduler)); -} -exports.timestamp = timestamp; -var Timestamp = (function () { - function Timestamp(value, timestamp) { - this.value = value; - this.timestamp = timestamp; - } - return Timestamp; -}()); -exports.Timestamp = Timestamp; -; -var TimestampOperator = (function () { - function TimestampOperator(scheduler) { - this.scheduler = scheduler; - } - TimestampOperator.prototype.call = function (observer, source) { - return source.subscribe(new TimestampSubscriber(observer, this.scheduler)); - }; - return TimestampOperator; -}()); -var TimestampSubscriber = (function (_super) { - __extends(TimestampSubscriber, _super); - function TimestampSubscriber(destination, scheduler) { - _super.call(this, destination); - this.scheduler = scheduler; - } - TimestampSubscriber.prototype._next = function (value) { - var now = this.scheduler.now(); - this.destination.next(new Timestamp(value, now)); - }; - return TimestampSubscriber; -}(Subscriber_1.Subscriber)); -//# sourceMappingURL=timestamp.js.map - -/***/ }), -/* 68 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var root_1 = __webpack_require__(12); -/* tslint:enable:max-line-length */ -/** - * Converts an Observable sequence to a ES2015 compliant promise. - * - * @example - * // Using normal ES2015 - * let source = Rx.Observable - * .of(42) - * .toPromise(); - * - * source.then((value) => console.log('Value: %s', value)); - * // => Value: 42 - * - * // Rejected Promise - * // Using normal ES2015 - * let source = Rx.Observable - * .throw(new Error('woops')) - * .toPromise(); - * - * source - * .then((value) => console.log('Value: %s', value)) - * .catch((err) => console.log('Error: %s', err)); - * // => Error: Error: woops - * - * // Setting via the config - * Rx.config.Promise = RSVP.Promise; - * - * let source = Rx.Observable - * .of(42) - * .toPromise(); - * - * source.then((value) => console.log('Value: %s', value)); - * // => Value: 42 - * - * // Setting via the method - * let source = Rx.Observable - * .of(42) - * .toPromise(RSVP.Promise); - * - * source.then((value) => console.log('Value: %s', value)); - * // => Value: 42 - * - * @param {PromiseConstructor} [PromiseCtor] The constructor of the promise. If not provided, - * it will look for a constructor first in Rx.config.Promise then fall back to - * the native Promise constructor if available. - * @return {Promise} An ES2015 compatible promise with the last value from - * the observable sequence. - * @method toPromise - * @owner Observable - */ -function toPromise(PromiseCtor) { - var _this = this; - if (!PromiseCtor) { - if (root_1.root.Rx && root_1.root.Rx.config && root_1.root.Rx.config.Promise) { - PromiseCtor = root_1.root.Rx.config.Promise; - } - else if (root_1.root.Promise) { - PromiseCtor = root_1.root.Promise; - } - } - if (!PromiseCtor) { - throw new Error('no Promise impl found'); - } - return new PromiseCtor(function (resolve, reject) { - var value; - _this.subscribe(function (x) { return value = x; }, function (err) { return reject(err); }, function () { return resolve(value); }); - }); -} -exports.toPromise = toPromise; -//# sourceMappingURL=toPromise.js.map - -/***/ }), -/* 69 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; -var AsyncAction_1 = __webpack_require__(20); -var AsyncScheduler_1 = __webpack_require__(21); -var VirtualTimeScheduler = (function (_super) { - __extends(VirtualTimeScheduler, _super); - function VirtualTimeScheduler(SchedulerAction, maxFrames) { - var _this = this; - if (SchedulerAction === void 0) { SchedulerAction = VirtualAction; } - if (maxFrames === void 0) { maxFrames = Number.POSITIVE_INFINITY; } - _super.call(this, SchedulerAction, function () { return _this.frame; }); - this.maxFrames = maxFrames; - this.frame = 0; - this.index = -1; - } - /** - * Prompt the Scheduler to execute all of its queued actions, therefore - * clearing its queue. - * @return {void} - */ - VirtualTimeScheduler.prototype.flush = function () { - var _a = this, actions = _a.actions, maxFrames = _a.maxFrames; - var error, action; - while ((action = actions.shift()) && (this.frame = action.delay) <= maxFrames) { - if (error = action.execute(action.state, action.delay)) { - break; - } - } - if (error) { - while (action = actions.shift()) { - action.unsubscribe(); - } - throw error; - } - }; - VirtualTimeScheduler.frameTimeFactor = 10; - return VirtualTimeScheduler; -}(AsyncScheduler_1.AsyncScheduler)); -exports.VirtualTimeScheduler = VirtualTimeScheduler; -/** - * We need this JSDoc comment for affecting ESDoc. - * @ignore - * @extends {Ignored} - */ -var VirtualAction = (function (_super) { - __extends(VirtualAction, _super); - function VirtualAction(scheduler, work, index) { - if (index === void 0) { index = scheduler.index += 1; } - _super.call(this, scheduler, work); - this.scheduler = scheduler; - this.work = work; - this.index = index; - this.active = true; - this.index = scheduler.index = index; - } - VirtualAction.prototype.schedule = function (state, delay) { - if (delay === void 0) { delay = 0; } - if (!this.id) { - return _super.prototype.schedule.call(this, state, delay); - } - this.active = false; - // If an action is rescheduled, we save allocations by mutating its state, - // pushing it to the end of the scheduler queue, and recycling the action. - // But since the VirtualTimeScheduler is used for testing, VirtualActions - // must be immutable so they can be inspected later. - var action = new VirtualAction(this.scheduler, this.work); - this.add(action); - return action.schedule(state, delay); - }; - VirtualAction.prototype.requestAsyncId = function (scheduler, id, delay) { - if (delay === void 0) { delay = 0; } - this.delay = scheduler.frame + delay; - var actions = scheduler.actions; - actions.push(this); - actions.sort(VirtualAction.sortActions); - return true; - }; - VirtualAction.prototype.recycleAsyncId = function (scheduler, id, delay) { - if (delay === void 0) { delay = 0; } - return undefined; - }; - VirtualAction.prototype._execute = function (state, delay) { - if (this.active === true) { - return _super.prototype._execute.call(this, state, delay); - } - }; - VirtualAction.sortActions = function (a, b) { - if (a.delay === b.delay) { - if (a.index === b.index) { - return 0; - } - else if (a.index > b.index) { - return 1; - } - else { - return -1; - } - } - else if (a.delay > b.delay) { - return 1; - } - else { - return -1; - } - }; - return VirtualAction; -}(AsyncAction_1.AsyncAction)); -exports.VirtualAction = VirtualAction; -//# sourceMappingURL=VirtualTimeScheduler.js.map - -/***/ }), -/* 70 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var AsapAction_1 = __webpack_require__(359); -var AsapScheduler_1 = __webpack_require__(360); -/** - * - * Asap Scheduler - * - * Perform task as fast as it can be performed asynchronously - * - * `asap` scheduler behaves the same as {@link async} scheduler when you use it to delay task - * in time. If however you set delay to `0`, `asap` will wait for current synchronously executing - * code to end and then it will try to execute given task as fast as possible. - * - * `asap` scheduler will do its best to minimize time between end of currently executing code - * and start of scheduled task. This makes it best candidate for performing so called "deferring". - * Traditionally this was achieved by calling `setTimeout(deferredTask, 0)`, but that technique involves - * some (although minimal) unwanted delay. - * - * Note that using `asap` scheduler does not necessarily mean that your task will be first to process - * after currently executing code. In particular, if some task was also scheduled with `asap` before, - * that task will execute first. That being said, if you need to schedule task asynchronously, but - * as soon as possible, `asap` scheduler is your best bet. - * - * @example Compare async and asap scheduler - * - * Rx.Scheduler.async.schedule(() => console.log('async')); // scheduling 'async' first... - * Rx.Scheduler.asap.schedule(() => console.log('asap')); - * - * // Logs: - * // "asap" - * // "async" - * // ... but 'asap' goes first! - * - * @static true - * @name asap - * @owner Scheduler - */ -exports.asap = new AsapScheduler_1.AsapScheduler(AsapAction_1.AsapAction); -//# sourceMappingURL=asap.js.map - -/***/ }), -/* 71 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var QueueAction_1 = __webpack_require__(361); -var QueueScheduler_1 = __webpack_require__(362); -/** - * - * Queue Scheduler - * - * Put every next task on a queue, instead of executing it immediately - * - * `queue` scheduler, when used with delay, behaves the same as {@link async} scheduler. - * - * When used without delay, it schedules given task synchronously - executes it right when - * it is scheduled. However when called recursively, that is when inside the scheduled task, - * another task is scheduled with queue scheduler, instead of executing immediately as well, - * that task will be put on a queue and wait for current one to finish. - * - * This means that when you execute task with `queue` scheduler, you are sure it will end - * before any other task scheduled with that scheduler will start. - * - * @examples Schedule recursively first, then do something - * - * Rx.Scheduler.queue.schedule(() => { - * Rx.Scheduler.queue.schedule(() => console.log('second')); // will not happen now, but will be put on a queue - * - * console.log('first'); - * }); - * - * // Logs: - * // "first" - * // "second" - * - * - * @example Reschedule itself recursively - * - * Rx.Scheduler.queue.schedule(function(state) { - * if (state !== 0) { - * console.log('before', state); - * this.schedule(state - 1); // `this` references currently executing Action, - * // which we reschedule with new state - * console.log('after', state); - * } - * }, 0, 3); - * - * // In scheduler that runs recursively, you would expect: - * // "before", 3 - * // "before", 2 - * // "before", 1 - * // "after", 1 - * // "after", 2 - * // "after", 3 - * - * // But with queue it logs: - * // "before", 3 - * // "after", 3 - * // "before", 2 - * // "after", 2 - * // "before", 1 - * // "after", 1 - * - * - * @static true - * @name queue - * @owner Scheduler - */ -exports.queue = new QueueScheduler_1.QueueScheduler(QueueAction_1.QueueAction); -//# sourceMappingURL=queue.js.map - -/***/ }), -/* 72 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var SubscriptionLog = (function () { - function SubscriptionLog(subscribedFrame, unsubscribedFrame) { - if (unsubscribedFrame === void 0) { unsubscribedFrame = Number.POSITIVE_INFINITY; } - this.subscribedFrame = subscribedFrame; - this.unsubscribedFrame = unsubscribedFrame; - } - return SubscriptionLog; -}()); -exports.SubscriptionLog = SubscriptionLog; -//# sourceMappingURL=SubscriptionLog.js.map - -/***/ }), -/* 73 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var SubscriptionLog_1 = __webpack_require__(72); -var SubscriptionLoggable = (function () { - function SubscriptionLoggable() { - this.subscriptions = []; - } - SubscriptionLoggable.prototype.logSubscribedFrame = function () { - this.subscriptions.push(new SubscriptionLog_1.SubscriptionLog(this.scheduler.now())); - return this.subscriptions.length - 1; - }; - SubscriptionLoggable.prototype.logUnsubscribedFrame = function (index) { - var subscriptionLogs = this.subscriptions; - var oldSubscriptionLog = subscriptionLogs[index]; - subscriptionLogs[index] = new SubscriptionLog_1.SubscriptionLog(oldSubscriptionLog.subscribedFrame, this.scheduler.now()); - }; - return SubscriptionLoggable; -}()); -exports.SubscriptionLoggable = SubscriptionLoggable; -//# sourceMappingURL=SubscriptionLoggable.js.map - -/***/ }), -/* 74 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; -/** - * An error thrown when duetime elapses. - * - * @see {@link timeout} - * - * @class TimeoutError - */ -var TimeoutError = (function (_super) { - __extends(TimeoutError, _super); - function TimeoutError() { - var err = _super.call(this, 'Timeout has occurred'); - this.name = err.name = 'TimeoutError'; - this.stack = err.stack; - this.message = err.message; - } - return TimeoutError; -}(Error)); -exports.TimeoutError = TimeoutError; -//# sourceMappingURL=TimeoutError.js.map - -/***/ }), -/* 75 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -function applyMixins(derivedCtor, baseCtors) { - for (var i = 0, len = baseCtors.length; i < len; i++) { - var baseCtor = baseCtors[i]; - var propertyKeys = Object.getOwnPropertyNames(baseCtor.prototype); - for (var j = 0, len2 = propertyKeys.length; j < len2; j++) { - var name_1 = propertyKeys[j]; - derivedCtor.prototype[name_1] = baseCtor.prototype[name_1]; - } - } -} -exports.applyMixins = applyMixins; -//# sourceMappingURL=applyMixins.js.map - -/***/ }), -/* 76 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -/* tslint:disable:no-empty */ -function noop() { } -exports.noop = noop; -//# sourceMappingURL=noop.js.map - -/***/ }), -/* 77 */ -/***/ (function(module, exports, __webpack_require__) { - -module.exports = (__webpack_require__(1))(13); - -/***/ }), -/* 78 */ -/***/ (function(module, exports, __webpack_require__) { - -module.exports = (__webpack_require__(1))(14); - -/***/ }), -/* 79 */ -/***/ (function(module, exports, __webpack_require__) { - -module.exports = (__webpack_require__(1))(17); - -/***/ }), -/* 80 */ -/***/ (function(module, exports, __webpack_require__) { - -module.exports = (__webpack_require__(1))(28); - -/***/ }), -/* 81 */ -/***/ (function(module, exports, __webpack_require__) { - -module.exports = (__webpack_require__(1))(31); - -/***/ }), -/* 82 */ -/***/ (function(module, exports, __webpack_require__) { - -module.exports = (__webpack_require__(1))(36); - -/***/ }), -/* 83 */ -/***/ (function(module, exports, __webpack_require__) { - -module.exports = (__webpack_require__(1))(40); - -/***/ }), -/* 84 */ -/***/ (function(module, exports, __webpack_require__) { - -module.exports = (__webpack_require__(1))(5); - -/***/ }), -/* 85 */ -/***/ (function(module, exports, __webpack_require__) { - -module.exports = (__webpack_require__(1))(62); - -/***/ }), -/* 86 */ -/***/ (function(module, exports, __webpack_require__) { - -module.exports = (__webpack_require__(1))(83); - -/***/ }), -/* 87 */ -/***/ (function(module, exports, __webpack_require__) { - -module.exports = (__webpack_require__(1))(87); - -/***/ }), -/* 88 */ -/***/ (function(module, exports) { - -module.exports = require("url"); - -/***/ }), -/* 89 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return AppModule; }); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__(10); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0__angular_core__); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__angular_platform_server__ = __webpack_require__(44); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__angular_platform_server___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1__angular_platform_server__); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__app_module_shared__ = __webpack_require__(94); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__components_app_app_component__ = __webpack_require__(48); -var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { - var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; - if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); - else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; - return c > 3 && r && Object.defineProperty(target, key, r), r; -}; - - - - -var AppModule = (function () { - function AppModule() { - } - AppModule = __decorate([ - __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_0__angular_core__["NgModule"])({ - bootstrap: [__WEBPACK_IMPORTED_MODULE_3__components_app_app_component__["a" /* AppComponent */]], - imports: [ - __WEBPACK_IMPORTED_MODULE_1__angular_platform_server__["ServerModule"], - __WEBPACK_IMPORTED_MODULE_2__app_module_shared__["a" /* AppModuleShared */] - ], - providers: [ - __WEBPACK_IMPORTED_MODULE_2__app_module_shared__["a" /* AppModuleShared */] - ] - }) - ], AppModule); - return AppModule; -}()); - - - -/***/ }), -/* 90 */ -/***/ (function(module, exports) { - -/*! ***************************************************************************** -Copyright (C) Microsoft. 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. -***************************************************************************** */ -var Reflect; -(function (Reflect) { - "use strict"; - var hasOwn = Object.prototype.hasOwnProperty; - // feature test for Symbol support - var supportsSymbol = typeof Symbol === "function"; - var toPrimitiveSymbol = supportsSymbol && typeof Symbol.toPrimitive !== "undefined" ? Symbol.toPrimitive : "@@toPrimitive"; - var iteratorSymbol = supportsSymbol && typeof Symbol.iterator !== "undefined" ? Symbol.iterator : "@@iterator"; - var HashMap; - (function (HashMap) { - var supportsCreate = typeof Object.create === "function"; // feature test for Object.create support - var supportsProto = { __proto__: [] } instanceof Array; // feature test for __proto__ support - var downLevel = !supportsCreate && !supportsProto; - // create an object in dictionary mode (a.k.a. "slow" mode in v8) - HashMap.create = supportsCreate - ? function () { return MakeDictionary(Object.create(null)); } - : supportsProto - ? function () { return MakeDictionary({ __proto__: null }); } - : function () { return MakeDictionary({}); }; - HashMap.has = downLevel - ? function (map, key) { return hasOwn.call(map, key); } - : function (map, key) { return key in map; }; - HashMap.get = downLevel - ? function (map, key) { return hasOwn.call(map, key) ? map[key] : undefined; } - : function (map, key) { return map[key]; }; - })(HashMap || (HashMap = {})); - // Load global or shim versions of Map, Set, and WeakMap - var functionPrototype = Object.getPrototypeOf(Function); - var usePolyfill = typeof process === "object" && process.env && process.env["REFLECT_METADATA_USE_MAP_POLYFILL"] === "true"; - var _Map = !usePolyfill && typeof Map === "function" && typeof Map.prototype.entries === "function" ? Map : CreateMapPolyfill(); - var _Set = !usePolyfill && typeof Set === "function" && typeof Set.prototype.entries === "function" ? Set : CreateSetPolyfill(); - var _WeakMap = !usePolyfill && typeof WeakMap === "function" ? WeakMap : CreateWeakMapPolyfill(); - // [[Metadata]] internal slot - // https://rbuckton.github.io/reflect-metadata/#ordinary-object-internal-methods-and-internal-slots - var Metadata = new _WeakMap(); - /** - * Applies a set of decorators to a property of a target object. - * @param decorators An array of decorators. - * @param target The target object. - * @param propertyKey (Optional) The property key to decorate. - * @param attributes (Optional) The property descriptor for the target key. - * @remarks Decorators are applied in reverse order. - * @example - * - * class Example { - * // property declarations are not part of ES6, though they are valid in TypeScript: - * // static staticProperty; - * // property; - * - * constructor(p) { } - * static staticMethod(p) { } - * method(p) { } - * } - * - * // constructor - * Example = Reflect.decorate(decoratorsArray, Example); - * - * // property (on constructor) - * Reflect.decorate(decoratorsArray, Example, "staticProperty"); - * - * // property (on prototype) - * Reflect.decorate(decoratorsArray, Example.prototype, "property"); - * - * // method (on constructor) - * Object.defineProperty(Example, "staticMethod", - * Reflect.decorate(decoratorsArray, Example, "staticMethod", - * Object.getOwnPropertyDescriptor(Example, "staticMethod"))); - * - * // method (on prototype) - * Object.defineProperty(Example.prototype, "method", - * Reflect.decorate(decoratorsArray, Example.prototype, "method", - * Object.getOwnPropertyDescriptor(Example.prototype, "method"))); - * - */ - function decorate(decorators, target, propertyKey, attributes) { - if (!IsUndefined(propertyKey)) { - if (!IsArray(decorators)) - throw new TypeError(); - if (!IsObject(target)) - throw new TypeError(); - if (!IsObject(attributes) && !IsUndefined(attributes) && !IsNull(attributes)) - throw new TypeError(); - if (IsNull(attributes)) - attributes = undefined; - propertyKey = ToPropertyKey(propertyKey); - return DecorateProperty(decorators, target, propertyKey, attributes); - } - else { - if (!IsArray(decorators)) - throw new TypeError(); - if (!IsConstructor(target)) - throw new TypeError(); - return DecorateConstructor(decorators, target); - } - } - Reflect.decorate = decorate; - // 4.1.2 Reflect.metadata(metadataKey, metadataValue) - // https://rbuckton.github.io/reflect-metadata/#reflect.metadata - /** - * A default metadata decorator factory that can be used on a class, class member, or parameter. - * @param metadataKey The key for the metadata entry. - * @param metadataValue The value for the metadata entry. - * @returns A decorator function. - * @remarks - * If `metadataKey` is already defined for the target and target key, the - * metadataValue for that key will be overwritten. - * @example - * - * // constructor - * @Reflect.metadata(key, value) - * class Example { - * } - * - * // property (on constructor, TypeScript only) - * class Example { - * @Reflect.metadata(key, value) - * static staticProperty; - * } - * - * // property (on prototype, TypeScript only) - * class Example { - * @Reflect.metadata(key, value) - * property; - * } - * - * // method (on constructor) - * class Example { - * @Reflect.metadata(key, value) - * static staticMethod() { } - * } - * - * // method (on prototype) - * class Example { - * @Reflect.metadata(key, value) - * method() { } - * } - * - */ - function metadata(metadataKey, metadataValue) { - function decorator(target, propertyKey) { - if (!IsObject(target)) - throw new TypeError(); - if (!IsUndefined(propertyKey) && !IsPropertyKey(propertyKey)) - throw new TypeError(); - OrdinaryDefineOwnMetadata(metadataKey, metadataValue, target, propertyKey); - } - return decorator; - } - Reflect.metadata = metadata; - /** - * Define a unique metadata entry on the target. - * @param metadataKey A key used to store and retrieve metadata. - * @param metadataValue A value that contains attached metadata. - * @param target The target object on which to define metadata. - * @param propertyKey (Optional) The property key for the target. - * @example - * - * class Example { - * // property declarations are not part of ES6, though they are valid in TypeScript: - * // static staticProperty; - * // property; - * - * constructor(p) { } - * static staticMethod(p) { } - * method(p) { } - * } - * - * // constructor - * Reflect.defineMetadata("custom:annotation", options, Example); - * - * // property (on constructor) - * Reflect.defineMetadata("custom:annotation", options, Example, "staticProperty"); - * - * // property (on prototype) - * Reflect.defineMetadata("custom:annotation", options, Example.prototype, "property"); - * - * // method (on constructor) - * Reflect.defineMetadata("custom:annotation", options, Example, "staticMethod"); - * - * // method (on prototype) - * Reflect.defineMetadata("custom:annotation", options, Example.prototype, "method"); - * - * // decorator factory as metadata-producing annotation. - * function MyAnnotation(options): Decorator { - * return (target, key?) => Reflect.defineMetadata("custom:annotation", options, target, key); - * } - * - */ - function defineMetadata(metadataKey, metadataValue, target, propertyKey) { - if (!IsObject(target)) - throw new TypeError(); - if (!IsUndefined(propertyKey)) - propertyKey = ToPropertyKey(propertyKey); - return OrdinaryDefineOwnMetadata(metadataKey, metadataValue, target, propertyKey); - } - Reflect.defineMetadata = defineMetadata; - /** - * Gets a value indicating whether the target object or its prototype chain has the provided metadata key defined. - * @param metadataKey A key used to store and retrieve metadata. - * @param target The target object on which the metadata is defined. - * @param propertyKey (Optional) The property key for the target. - * @returns `true` if the metadata key was defined on the target object or its prototype chain; otherwise, `false`. - * @example - * - * class Example { - * // property declarations are not part of ES6, though they are valid in TypeScript: - * // static staticProperty; - * // property; - * - * constructor(p) { } - * static staticMethod(p) { } - * method(p) { } - * } - * - * // constructor - * result = Reflect.hasMetadata("custom:annotation", Example); - * - * // property (on constructor) - * result = Reflect.hasMetadata("custom:annotation", Example, "staticProperty"); - * - * // property (on prototype) - * result = Reflect.hasMetadata("custom:annotation", Example.prototype, "property"); - * - * // method (on constructor) - * result = Reflect.hasMetadata("custom:annotation", Example, "staticMethod"); - * - * // method (on prototype) - * result = Reflect.hasMetadata("custom:annotation", Example.prototype, "method"); - * - */ - function hasMetadata(metadataKey, target, propertyKey) { - if (!IsObject(target)) - throw new TypeError(); - if (!IsUndefined(propertyKey)) - propertyKey = ToPropertyKey(propertyKey); - return OrdinaryHasMetadata(metadataKey, target, propertyKey); - } - Reflect.hasMetadata = hasMetadata; - /** - * Gets a value indicating whether the target object has the provided metadata key defined. - * @param metadataKey A key used to store and retrieve metadata. - * @param target The target object on which the metadata is defined. - * @param propertyKey (Optional) The property key for the target. - * @returns `true` if the metadata key was defined on the target object; otherwise, `false`. - * @example - * - * class Example { - * // property declarations are not part of ES6, though they are valid in TypeScript: - * // static staticProperty; - * // property; - * - * constructor(p) { } - * static staticMethod(p) { } - * method(p) { } - * } - * - * // constructor - * result = Reflect.hasOwnMetadata("custom:annotation", Example); - * - * // property (on constructor) - * result = Reflect.hasOwnMetadata("custom:annotation", Example, "staticProperty"); - * - * // property (on prototype) - * result = Reflect.hasOwnMetadata("custom:annotation", Example.prototype, "property"); - * - * // method (on constructor) - * result = Reflect.hasOwnMetadata("custom:annotation", Example, "staticMethod"); - * - * // method (on prototype) - * result = Reflect.hasOwnMetadata("custom:annotation", Example.prototype, "method"); - * - */ - function hasOwnMetadata(metadataKey, target, propertyKey) { - if (!IsObject(target)) - throw new TypeError(); - if (!IsUndefined(propertyKey)) - propertyKey = ToPropertyKey(propertyKey); - return OrdinaryHasOwnMetadata(metadataKey, target, propertyKey); - } - Reflect.hasOwnMetadata = hasOwnMetadata; - /** - * Gets the metadata value for the provided metadata key on the target object or its prototype chain. - * @param metadataKey A key used to store and retrieve metadata. - * @param target The target object on which the metadata is defined. - * @param propertyKey (Optional) The property key for the target. - * @returns The metadata value for the metadata key if found; otherwise, `undefined`. - * @example - * - * class Example { - * // property declarations are not part of ES6, though they are valid in TypeScript: - * // static staticProperty; - * // property; - * - * constructor(p) { } - * static staticMethod(p) { } - * method(p) { } - * } - * - * // constructor - * result = Reflect.getMetadata("custom:annotation", Example); - * - * // property (on constructor) - * result = Reflect.getMetadata("custom:annotation", Example, "staticProperty"); - * - * // property (on prototype) - * result = Reflect.getMetadata("custom:annotation", Example.prototype, "property"); - * - * // method (on constructor) - * result = Reflect.getMetadata("custom:annotation", Example, "staticMethod"); - * - * // method (on prototype) - * result = Reflect.getMetadata("custom:annotation", Example.prototype, "method"); - * - */ - function getMetadata(metadataKey, target, propertyKey) { - if (!IsObject(target)) - throw new TypeError(); - if (!IsUndefined(propertyKey)) - propertyKey = ToPropertyKey(propertyKey); - return OrdinaryGetMetadata(metadataKey, target, propertyKey); - } - Reflect.getMetadata = getMetadata; - /** - * Gets the metadata value for the provided metadata key on the target object. - * @param metadataKey A key used to store and retrieve metadata. - * @param target The target object on which the metadata is defined. - * @param propertyKey (Optional) The property key for the target. - * @returns The metadata value for the metadata key if found; otherwise, `undefined`. - * @example - * - * class Example { - * // property declarations are not part of ES6, though they are valid in TypeScript: - * // static staticProperty; - * // property; - * - * constructor(p) { } - * static staticMethod(p) { } - * method(p) { } - * } - * - * // constructor - * result = Reflect.getOwnMetadata("custom:annotation", Example); - * - * // property (on constructor) - * result = Reflect.getOwnMetadata("custom:annotation", Example, "staticProperty"); - * - * // property (on prototype) - * result = Reflect.getOwnMetadata("custom:annotation", Example.prototype, "property"); - * - * // method (on constructor) - * result = Reflect.getOwnMetadata("custom:annotation", Example, "staticMethod"); - * - * // method (on prototype) - * result = Reflect.getOwnMetadata("custom:annotation", Example.prototype, "method"); - * - */ - function getOwnMetadata(metadataKey, target, propertyKey) { - if (!IsObject(target)) - throw new TypeError(); - if (!IsUndefined(propertyKey)) - propertyKey = ToPropertyKey(propertyKey); - return OrdinaryGetOwnMetadata(metadataKey, target, propertyKey); - } - Reflect.getOwnMetadata = getOwnMetadata; - /** - * Gets the metadata keys defined on the target object or its prototype chain. - * @param target The target object on which the metadata is defined. - * @param propertyKey (Optional) The property key for the target. - * @returns An array of unique metadata keys. - * @example - * - * class Example { - * // property declarations are not part of ES6, though they are valid in TypeScript: - * // static staticProperty; - * // property; - * - * constructor(p) { } - * static staticMethod(p) { } - * method(p) { } - * } - * - * // constructor - * result = Reflect.getMetadataKeys(Example); - * - * // property (on constructor) - * result = Reflect.getMetadataKeys(Example, "staticProperty"); - * - * // property (on prototype) - * result = Reflect.getMetadataKeys(Example.prototype, "property"); - * - * // method (on constructor) - * result = Reflect.getMetadataKeys(Example, "staticMethod"); - * - * // method (on prototype) - * result = Reflect.getMetadataKeys(Example.prototype, "method"); - * - */ - function getMetadataKeys(target, propertyKey) { - if (!IsObject(target)) - throw new TypeError(); - if (!IsUndefined(propertyKey)) - propertyKey = ToPropertyKey(propertyKey); - return OrdinaryMetadataKeys(target, propertyKey); - } - Reflect.getMetadataKeys = getMetadataKeys; - /** - * Gets the unique metadata keys defined on the target object. - * @param target The target object on which the metadata is defined. - * @param propertyKey (Optional) The property key for the target. - * @returns An array of unique metadata keys. - * @example - * - * class Example { - * // property declarations are not part of ES6, though they are valid in TypeScript: - * // static staticProperty; - * // property; - * - * constructor(p) { } - * static staticMethod(p) { } - * method(p) { } - * } - * - * // constructor - * result = Reflect.getOwnMetadataKeys(Example); - * - * // property (on constructor) - * result = Reflect.getOwnMetadataKeys(Example, "staticProperty"); - * - * // property (on prototype) - * result = Reflect.getOwnMetadataKeys(Example.prototype, "property"); - * - * // method (on constructor) - * result = Reflect.getOwnMetadataKeys(Example, "staticMethod"); - * - * // method (on prototype) - * result = Reflect.getOwnMetadataKeys(Example.prototype, "method"); - * - */ - function getOwnMetadataKeys(target, propertyKey) { - if (!IsObject(target)) - throw new TypeError(); - if (!IsUndefined(propertyKey)) - propertyKey = ToPropertyKey(propertyKey); - return OrdinaryOwnMetadataKeys(target, propertyKey); - } - Reflect.getOwnMetadataKeys = getOwnMetadataKeys; - /** - * Deletes the metadata entry from the target object with the provided key. - * @param metadataKey A key used to store and retrieve metadata. - * @param target The target object on which the metadata is defined. - * @param propertyKey (Optional) The property key for the target. - * @returns `true` if the metadata entry was found and deleted; otherwise, false. - * @example - * - * class Example { - * // property declarations are not part of ES6, though they are valid in TypeScript: - * // static staticProperty; - * // property; - * - * constructor(p) { } - * static staticMethod(p) { } - * method(p) { } - * } - * - * // constructor - * result = Reflect.deleteMetadata("custom:annotation", Example); - * - * // property (on constructor) - * result = Reflect.deleteMetadata("custom:annotation", Example, "staticProperty"); - * - * // property (on prototype) - * result = Reflect.deleteMetadata("custom:annotation", Example.prototype, "property"); - * - * // method (on constructor) - * result = Reflect.deleteMetadata("custom:annotation", Example, "staticMethod"); - * - * // method (on prototype) - * result = Reflect.deleteMetadata("custom:annotation", Example.prototype, "method"); - * - */ - function deleteMetadata(metadataKey, target, propertyKey) { - if (!IsObject(target)) - throw new TypeError(); - if (!IsUndefined(propertyKey)) - propertyKey = ToPropertyKey(propertyKey); - var metadataMap = GetOrCreateMetadataMap(target, propertyKey, /*Create*/ false); - if (IsUndefined(metadataMap)) - return false; - if (!metadataMap.delete(metadataKey)) - return false; - if (metadataMap.size > 0) - return true; - var targetMetadata = Metadata.get(target); - targetMetadata.delete(propertyKey); - if (targetMetadata.size > 0) - return true; - Metadata.delete(target); - return true; - } - Reflect.deleteMetadata = deleteMetadata; - function DecorateConstructor(decorators, target) { - for (var i = decorators.length - 1; i >= 0; --i) { - var decorator = decorators[i]; - var decorated = decorator(target); - if (!IsUndefined(decorated) && !IsNull(decorated)) { - if (!IsConstructor(decorated)) - throw new TypeError(); - target = decorated; - } - } - return target; - } - function DecorateProperty(decorators, target, propertyKey, descriptor) { - for (var i = decorators.length - 1; i >= 0; --i) { - var decorator = decorators[i]; - var decorated = decorator(target, propertyKey, descriptor); - if (!IsUndefined(decorated) && !IsNull(decorated)) { - if (!IsObject(decorated)) - throw new TypeError(); - descriptor = decorated; - } - } - return descriptor; - } - function GetOrCreateMetadataMap(O, P, Create) { - var targetMetadata = Metadata.get(O); - if (IsUndefined(targetMetadata)) { - if (!Create) - return undefined; - targetMetadata = new _Map(); - Metadata.set(O, targetMetadata); - } - var metadataMap = targetMetadata.get(P); - if (IsUndefined(metadataMap)) { - if (!Create) - return undefined; - metadataMap = new _Map(); - targetMetadata.set(P, metadataMap); - } - return metadataMap; - } - // 3.1.1.1 OrdinaryHasMetadata(MetadataKey, O, P) - // https://rbuckton.github.io/reflect-metadata/#ordinaryhasmetadata - function OrdinaryHasMetadata(MetadataKey, O, P) { - var hasOwn = OrdinaryHasOwnMetadata(MetadataKey, O, P); - if (hasOwn) - return true; - var parent = OrdinaryGetPrototypeOf(O); - if (!IsNull(parent)) - return OrdinaryHasMetadata(MetadataKey, parent, P); - return false; - } - // 3.1.2.1 OrdinaryHasOwnMetadata(MetadataKey, O, P) - // https://rbuckton.github.io/reflect-metadata/#ordinaryhasownmetadata - function OrdinaryHasOwnMetadata(MetadataKey, O, P) { - var metadataMap = GetOrCreateMetadataMap(O, P, /*Create*/ false); - if (IsUndefined(metadataMap)) - return false; - return ToBoolean(metadataMap.has(MetadataKey)); - } - // 3.1.3.1 OrdinaryGetMetadata(MetadataKey, O, P) - // https://rbuckton.github.io/reflect-metadata/#ordinarygetmetadata - function OrdinaryGetMetadata(MetadataKey, O, P) { - var hasOwn = OrdinaryHasOwnMetadata(MetadataKey, O, P); - if (hasOwn) - return OrdinaryGetOwnMetadata(MetadataKey, O, P); - var parent = OrdinaryGetPrototypeOf(O); - if (!IsNull(parent)) - return OrdinaryGetMetadata(MetadataKey, parent, P); - return undefined; - } - // 3.1.4.1 OrdinaryGetOwnMetadata(MetadataKey, O, P) - // https://rbuckton.github.io/reflect-metadata/#ordinarygetownmetadata - function OrdinaryGetOwnMetadata(MetadataKey, O, P) { - var metadataMap = GetOrCreateMetadataMap(O, P, /*Create*/ false); - if (IsUndefined(metadataMap)) - return undefined; - return metadataMap.get(MetadataKey); - } - // 3.1.5.1 OrdinaryDefineOwnMetadata(MetadataKey, MetadataValue, O, P) - // https://rbuckton.github.io/reflect-metadata/#ordinarydefineownmetadata - function OrdinaryDefineOwnMetadata(MetadataKey, MetadataValue, O, P) { - var metadataMap = GetOrCreateMetadataMap(O, P, /*Create*/ true); - metadataMap.set(MetadataKey, MetadataValue); - } - // 3.1.6.1 OrdinaryMetadataKeys(O, P) - // https://rbuckton.github.io/reflect-metadata/#ordinarymetadatakeys - function OrdinaryMetadataKeys(O, P) { - var ownKeys = OrdinaryOwnMetadataKeys(O, P); - var parent = OrdinaryGetPrototypeOf(O); - if (parent === null) - return ownKeys; - var parentKeys = OrdinaryMetadataKeys(parent, P); - if (parentKeys.length <= 0) - return ownKeys; - if (ownKeys.length <= 0) - return parentKeys; - var set = new _Set(); - var keys = []; - for (var _i = 0, ownKeys_1 = ownKeys; _i < ownKeys_1.length; _i++) { - var key = ownKeys_1[_i]; - var hasKey = set.has(key); - if (!hasKey) { - set.add(key); - keys.push(key); - } - } - for (var _a = 0, parentKeys_1 = parentKeys; _a < parentKeys_1.length; _a++) { - var key = parentKeys_1[_a]; - var hasKey = set.has(key); - if (!hasKey) { - set.add(key); - keys.push(key); - } - } - return keys; - } - // 3.1.7.1 OrdinaryOwnMetadataKeys(O, P) - // https://rbuckton.github.io/reflect-metadata/#ordinaryownmetadatakeys - function OrdinaryOwnMetadataKeys(O, P) { - var keys = []; - var metadataMap = GetOrCreateMetadataMap(O, P, /*Create*/ false); - if (IsUndefined(metadataMap)) - return keys; - var keysObj = metadataMap.keys(); - var iterator = GetIterator(keysObj); - var k = 0; - while (true) { - var next = IteratorStep(iterator); - if (!next) { - keys.length = k; - return keys; - } - var nextValue = IteratorValue(next); - try { - keys[k] = nextValue; - } - catch (e) { - try { - IteratorClose(iterator); - } - finally { - throw e; - } - } - k++; - } - } - // 6 ECMAScript Data Typ0es and Values - // https://tc39.github.io/ecma262/#sec-ecmascript-data-types-and-values - function Type(x) { - if (x === null) - return 1 /* Null */; - switch (typeof x) { - case "undefined": return 0 /* Undefined */; - case "boolean": return 2 /* Boolean */; - case "string": return 3 /* String */; - case "symbol": return 4 /* Symbol */; - case "number": return 5 /* Number */; - case "object": return x === null ? 1 /* Null */ : 6 /* Object */; - default: return 6 /* Object */; - } - } - // 6.1.1 The Undefined Type - // https://tc39.github.io/ecma262/#sec-ecmascript-language-types-undefined-type - function IsUndefined(x) { - return x === undefined; - } - // 6.1.2 The Null Type - // https://tc39.github.io/ecma262/#sec-ecmascript-language-types-null-type - function IsNull(x) { - return x === null; - } - // 6.1.5 The Symbol Type - // https://tc39.github.io/ecma262/#sec-ecmascript-language-types-symbol-type - function IsSymbol(x) { - return typeof x === "symbol"; - } - // 6.1.7 The Object Type - // https://tc39.github.io/ecma262/#sec-object-type - function IsObject(x) { - return typeof x === "object" ? x !== null : typeof x === "function"; - } - // 7.1 Type Conversion - // https://tc39.github.io/ecma262/#sec-type-conversion - // 7.1.1 ToPrimitive(input [, PreferredType]) - // https://tc39.github.io/ecma262/#sec-toprimitive - function ToPrimitive(input, PreferredType) { - switch (Type(input)) { - case 0 /* Undefined */: return input; - case 1 /* Null */: return input; - case 2 /* Boolean */: return input; - case 3 /* String */: return input; - case 4 /* Symbol */: return input; - case 5 /* Number */: return input; - } - var hint = PreferredType === 3 /* String */ ? "string" : PreferredType === 5 /* Number */ ? "number" : "default"; - var exoticToPrim = GetMethod(input, toPrimitiveSymbol); - if (exoticToPrim !== undefined) { - var result = exoticToPrim.call(input, hint); - if (IsObject(result)) - throw new TypeError(); - return result; - } - return OrdinaryToPrimitive(input, hint === "default" ? "number" : hint); - } - // 7.1.1.1 OrdinaryToPrimitive(O, hint) - // https://tc39.github.io/ecma262/#sec-ordinarytoprimitive - function OrdinaryToPrimitive(O, hint) { - if (hint === "string") { - var toString_1 = O.toString; - if (IsCallable(toString_1)) { - var result = toString_1.call(O); - if (!IsObject(result)) - return result; - } - var valueOf = O.valueOf; - if (IsCallable(valueOf)) { - var result = valueOf.call(O); - if (!IsObject(result)) - return result; - } - } - else { - var valueOf = O.valueOf; - if (IsCallable(valueOf)) { - var result = valueOf.call(O); - if (!IsObject(result)) - return result; - } - var toString_2 = O.toString; - if (IsCallable(toString_2)) { - var result = toString_2.call(O); - if (!IsObject(result)) - return result; - } - } - throw new TypeError(); - } - // 7.1.2 ToBoolean(argument) - // https://tc39.github.io/ecma262/2016/#sec-toboolean - function ToBoolean(argument) { - return !!argument; - } - // 7.1.12 ToString(argument) - // https://tc39.github.io/ecma262/#sec-tostring - function ToString(argument) { - return "" + argument; - } - // 7.1.14 ToPropertyKey(argument) - // https://tc39.github.io/ecma262/#sec-topropertykey - function ToPropertyKey(argument) { - var key = ToPrimitive(argument, 3 /* String */); - if (IsSymbol(key)) - return key; - return ToString(key); - } - // 7.2 Testing and Comparison Operations - // https://tc39.github.io/ecma262/#sec-testing-and-comparison-operations - // 7.2.2 IsArray(argument) - // https://tc39.github.io/ecma262/#sec-isarray - function IsArray(argument) { - return Array.isArray - ? Array.isArray(argument) - : argument instanceof Object - ? argument instanceof Array - : Object.prototype.toString.call(argument) === "[object Array]"; - } - // 7.2.3 IsCallable(argument) - // https://tc39.github.io/ecma262/#sec-iscallable - function IsCallable(argument) { - // NOTE: This is an approximation as we cannot check for [[Call]] internal method. - return typeof argument === "function"; - } - // 7.2.4 IsConstructor(argument) - // https://tc39.github.io/ecma262/#sec-isconstructor - function IsConstructor(argument) { - // NOTE: This is an approximation as we cannot check for [[Construct]] internal method. - return typeof argument === "function"; - } - // 7.2.7 IsPropertyKey(argument) - // https://tc39.github.io/ecma262/#sec-ispropertykey - function IsPropertyKey(argument) { - switch (Type(argument)) { - case 3 /* String */: return true; - case 4 /* Symbol */: return true; - default: return false; - } - } - // 7.3 Operations on Objects - // https://tc39.github.io/ecma262/#sec-operations-on-objects - // 7.3.9 GetMethod(V, P) - // https://tc39.github.io/ecma262/#sec-getmethod - function GetMethod(V, P) { - var func = V[P]; - if (func === undefined || func === null) - return undefined; - if (!IsCallable(func)) - throw new TypeError(); - return func; - } - // 7.4 Operations on Iterator Objects - // https://tc39.github.io/ecma262/#sec-operations-on-iterator-objects - function GetIterator(obj) { - var method = GetMethod(obj, iteratorSymbol); - if (!IsCallable(method)) - throw new TypeError(); // from Call - var iterator = method.call(obj); - if (!IsObject(iterator)) - throw new TypeError(); - return iterator; - } - // 7.4.4 IteratorValue(iterResult) - // https://tc39.github.io/ecma262/2016/#sec-iteratorvalue - function IteratorValue(iterResult) { - return iterResult.value; - } - // 7.4.5 IteratorStep(iterator) - // https://tc39.github.io/ecma262/#sec-iteratorstep - function IteratorStep(iterator) { - var result = iterator.next(); - return result.done ? false : result; - } - // 7.4.6 IteratorClose(iterator, completion) - // https://tc39.github.io/ecma262/#sec-iteratorclose - function IteratorClose(iterator) { - var f = iterator["return"]; - if (f) - f.call(iterator); - } - // 9.1 Ordinary Object Internal Methods and Internal Slots - // https://tc39.github.io/ecma262/#sec-ordinary-object-internal-methods-and-internal-slots - // 9.1.1.1 OrdinaryGetPrototypeOf(O) - // https://tc39.github.io/ecma262/#sec-ordinarygetprototypeof - function OrdinaryGetPrototypeOf(O) { - var proto = Object.getPrototypeOf(O); - if (typeof O !== "function" || O === functionPrototype) - return proto; - // TypeScript doesn't set __proto__ in ES5, as it's non-standard. - // Try to determine the superclass constructor. Compatible implementations - // must either set __proto__ on a subclass constructor to the superclass constructor, - // or ensure each class has a valid `constructor` property on its prototype that - // points back to the constructor. - // If this is not the same as Function.[[Prototype]], then this is definately inherited. - // This is the case when in ES6 or when using __proto__ in a compatible browser. - if (proto !== functionPrototype) - return proto; - // If the super prototype is Object.prototype, null, or undefined, then we cannot determine the heritage. - var prototype = O.prototype; - var prototypeProto = prototype && Object.getPrototypeOf(prototype); - if (prototypeProto == null || prototypeProto === Object.prototype) - return proto; - // If the constructor was not a function, then we cannot determine the heritage. - var constructor = prototypeProto.constructor; - if (typeof constructor !== "function") - return proto; - // If we have some kind of self-reference, then we cannot determine the heritage. - if (constructor === O) - return proto; - // we have a pretty good guess at the heritage. - return constructor; - } - // naive Map shim - function CreateMapPolyfill() { - var cacheSentinel = {}; - var arraySentinel = []; - var MapIterator = (function () { - function MapIterator(keys, values, selector) { - this._index = 0; - this._keys = keys; - this._values = values; - this._selector = selector; - } - MapIterator.prototype["@@iterator"] = function () { return this; }; - MapIterator.prototype[iteratorSymbol] = function () { return this; }; - MapIterator.prototype.next = function () { - var index = this._index; - if (index >= 0 && index < this._keys.length) { - var result = this._selector(this._keys[index], this._values[index]); - if (index + 1 >= this._keys.length) { - this._index = -1; - this._keys = arraySentinel; - this._values = arraySentinel; - } - else { - this._index++; - } - return { value: result, done: false }; - } - return { value: undefined, done: true }; - }; - MapIterator.prototype.throw = function (error) { - if (this._index >= 0) { - this._index = -1; - this._keys = arraySentinel; - this._values = arraySentinel; - } - throw error; - }; - MapIterator.prototype.return = function (value) { - if (this._index >= 0) { - this._index = -1; - this._keys = arraySentinel; - this._values = arraySentinel; - } - return { value: value, done: true }; - }; - return MapIterator; - }()); - return (function () { - function Map() { - this._keys = []; - this._values = []; - this._cacheKey = cacheSentinel; - this._cacheIndex = -2; - } - Object.defineProperty(Map.prototype, "size", { - get: function () { return this._keys.length; }, - enumerable: true, - configurable: true - }); - Map.prototype.has = function (key) { return this._find(key, /*insert*/ false) >= 0; }; - Map.prototype.get = function (key) { - var index = this._find(key, /*insert*/ false); - return index >= 0 ? this._values[index] : undefined; - }; - Map.prototype.set = function (key, value) { - var index = this._find(key, /*insert*/ true); - this._values[index] = value; - return this; - }; - Map.prototype.delete = function (key) { - var index = this._find(key, /*insert*/ false); - if (index >= 0) { - var size = this._keys.length; - for (var i = index + 1; i < size; i++) { - this._keys[i - 1] = this._keys[i]; - this._values[i - 1] = this._values[i]; - } - this._keys.length--; - this._values.length--; - if (key === this._cacheKey) { - this._cacheKey = cacheSentinel; - this._cacheIndex = -2; - } - return true; - } - return false; - }; - Map.prototype.clear = function () { - this._keys.length = 0; - this._values.length = 0; - this._cacheKey = cacheSentinel; - this._cacheIndex = -2; - }; - Map.prototype.keys = function () { return new MapIterator(this._keys, this._values, getKey); }; - Map.prototype.values = function () { return new MapIterator(this._keys, this._values, getValue); }; - Map.prototype.entries = function () { return new MapIterator(this._keys, this._values, getEntry); }; - Map.prototype["@@iterator"] = function () { return this.entries(); }; - Map.prototype[iteratorSymbol] = function () { return this.entries(); }; - Map.prototype._find = function (key, insert) { - if (this._cacheKey !== key) { - this._cacheIndex = this._keys.indexOf(this._cacheKey = key); - } - if (this._cacheIndex < 0 && insert) { - this._cacheIndex = this._keys.length; - this._keys.push(key); - this._values.push(undefined); - } - return this._cacheIndex; - }; - return Map; - }()); - function getKey(key, _) { - return key; - } - function getValue(_, value) { - return value; - } - function getEntry(key, value) { - return [key, value]; - } - } - // naive Set shim - function CreateSetPolyfill() { - return (function () { - function Set() { - this._map = new _Map(); - } - Object.defineProperty(Set.prototype, "size", { - get: function () { return this._map.size; }, - enumerable: true, - configurable: true - }); - Set.prototype.has = function (value) { return this._map.has(value); }; - Set.prototype.add = function (value) { return this._map.set(value, value), this; }; - Set.prototype.delete = function (value) { return this._map.delete(value); }; - Set.prototype.clear = function () { this._map.clear(); }; - Set.prototype.keys = function () { return this._map.keys(); }; - Set.prototype.values = function () { return this._map.values(); }; - Set.prototype.entries = function () { return this._map.entries(); }; - Set.prototype["@@iterator"] = function () { return this.keys(); }; - Set.prototype[iteratorSymbol] = function () { return this.keys(); }; - return Set; - }()); - } - // naive WeakMap shim - function CreateWeakMapPolyfill() { - var UUID_SIZE = 16; - var keys = HashMap.create(); - var rootKey = CreateUniqueKey(); - return (function () { - function WeakMap() { - this._key = CreateUniqueKey(); - } - WeakMap.prototype.has = function (target) { - var table = GetOrCreateWeakMapTable(target, /*create*/ false); - return table !== undefined ? HashMap.has(table, this._key) : false; - }; - WeakMap.prototype.get = function (target) { - var table = GetOrCreateWeakMapTable(target, /*create*/ false); - return table !== undefined ? HashMap.get(table, this._key) : undefined; - }; - WeakMap.prototype.set = function (target, value) { - var table = GetOrCreateWeakMapTable(target, /*create*/ true); - table[this._key] = value; - return this; - }; - WeakMap.prototype.delete = function (target) { - var table = GetOrCreateWeakMapTable(target, /*create*/ false); - return table !== undefined ? delete table[this._key] : false; - }; - WeakMap.prototype.clear = function () { - // NOTE: not a real clear, just makes the previous data unreachable - this._key = CreateUniqueKey(); - }; - return WeakMap; - }()); - function CreateUniqueKey() { - var key; - do - key = "@@WeakMap@@" + CreateUUID(); - while (HashMap.has(keys, key)); - keys[key] = true; - return key; - } - function GetOrCreateWeakMapTable(target, create) { - if (!hasOwn.call(target, rootKey)) { - if (!create) - return undefined; - Object.defineProperty(target, rootKey, { value: HashMap.create() }); - } - return target[rootKey]; - } - function FillRandomBytes(buffer, size) { - for (var i = 0; i < size; ++i) - buffer[i] = Math.random() * 0xff | 0; - return buffer; - } - function GenRandomBytes(size) { - if (typeof Uint8Array === "function") { - if (typeof crypto !== "undefined") - return crypto.getRandomValues(new Uint8Array(size)); - if (typeof msCrypto !== "undefined") - return msCrypto.getRandomValues(new Uint8Array(size)); - return FillRandomBytes(new Uint8Array(size), size); - } - return FillRandomBytes(new Array(size), size); - } - function CreateUUID() { - var data = GenRandomBytes(UUID_SIZE); - // mark as random - RFC 4122 § 4.4 - data[6] = data[6] & 0x4f | 0x40; - data[8] = data[8] & 0xbf | 0x80; - var result = ""; - for (var offset = 0; offset < UUID_SIZE; ++offset) { - var byte = data[offset]; - if (offset === 4 || offset === 6 || offset === 8) - result += "-"; - if (byte < 16) - result += "0"; - result += byte.toString(16).toLowerCase(); - } - return result; - } - } - // uses a heuristic used by v8 and chakra to force an object into dictionary mode. - function MakeDictionary(obj) { - obj.__ = undefined; - delete obj.__; - return obj; - } - // patch global Reflect - (function (__global) { - if (typeof __global.Reflect !== "undefined") { - if (__global.Reflect !== Reflect) { - for (var p in Reflect) { - if (hasOwn.call(Reflect, p)) { - __global.Reflect[p] = Reflect[p]; - } - } - } - } - else { - __global.Reflect = Reflect; - } - })(typeof global !== "undefined" ? global : - typeof self !== "undefined" ? self : - Function("return this;")()); -})(Reflect || (Reflect = {})); -//# sourceMappingURL=Reflect.js.map - -/***/ }), -/* 91 */ -/***/ (function(module, exports, __webpack_require__) { - -module.exports = (__webpack_require__(1))(41); - -/***/ }), -/* 92 */ -/***/ (function(module, exports, __webpack_require__) { - -module.exports = (__webpack_require__(1))(47); - -/***/ }), -/* 93 */ -/***/ (function(module, exports, __webpack_require__) { - -/** - * @license Angular v4.2.5 - * (c) 2010-2017 Google, Inc. https://angular.io/ - * License: MIT - */ -(function (global, factory) { - true ? factory(exports, __webpack_require__(10), __webpack_require__(84), __webpack_require__(82), __webpack_require__(46)) : - typeof define === 'function' && define.amd ? define(['exports', '@angular/core', '@angular/platform-browser', '@angular/animations', '@angular/animations/browser'], factory) : - (factory((global.ng = global.ng || {}, global.ng.platformBrowser = global.ng.platformBrowser || {}, global.ng.platformBrowser.animations = global.ng.platformBrowser.animations || {}),global.ng.core,global.ng.platformBrowser,global.ng.animations,global.ng.animations.browser)); -}(this, (function (exports,_angular_core,_angular_platformBrowser,_angular_animations,_angular_animations_browser) { '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 v4.2.5 - * (c) 2010-2017 Google, Inc. https://angular.io/ - * License: MIT - */ -/** - * @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 BrowserAnimationBuilder = (function (_super) { - __extends(BrowserAnimationBuilder, _super); - /** - * @param {?} rootRenderer - */ - function BrowserAnimationBuilder(rootRenderer) { - var _this = _super.call(this) || this; - _this._nextAnimationId = 0; - var typeData = { - id: '0', - encapsulation: _angular_core.ViewEncapsulation.None, - styles: [], - data: { animation: [] } - }; - _this._renderer = rootRenderer.createRenderer(document.body, typeData); - return _this; - } - /** - * @param {?} animation - * @return {?} - */ - BrowserAnimationBuilder.prototype.build = function (animation) { - var /** @type {?} */ id = this._nextAnimationId.toString(); - this._nextAnimationId++; - var /** @type {?} */ entry = Array.isArray(animation) ? _angular_animations.sequence(animation) : animation; - issueAnimationCommand(this._renderer, null, id, 'register', [entry]); - return new BrowserAnimationFactory(id, this._renderer); - }; - return BrowserAnimationBuilder; -}(_angular_animations.AnimationBuilder)); -BrowserAnimationBuilder.decorators = [ - { type: _angular_core.Injectable }, -]; -/** - * @nocollapse - */ -BrowserAnimationBuilder.ctorParameters = function () { return [ - { type: _angular_core.RendererFactory2, }, -]; }; -var BrowserAnimationFactory = (function (_super) { - __extends(BrowserAnimationFactory, _super); - /** - * @param {?} _id - * @param {?} _renderer - */ - function BrowserAnimationFactory(_id, _renderer) { - var _this = _super.call(this) || this; - _this._id = _id; - _this._renderer = _renderer; - return _this; - } - /** - * @param {?} element - * @param {?=} options - * @return {?} - */ - BrowserAnimationFactory.prototype.create = function (element, options) { - return new RendererAnimationPlayer(this._id, element, options || {}, this._renderer); - }; - return BrowserAnimationFactory; -}(_angular_animations.AnimationFactory)); -var RendererAnimationPlayer = (function () { - /** - * @param {?} id - * @param {?} element - * @param {?} options - * @param {?} _renderer - */ - function RendererAnimationPlayer(id, element, options, _renderer) { - this.id = id; - this.element = element; - this._renderer = _renderer; - this.parentPlayer = null; - this._started = false; - this.totalTime = 0; - this._command('create', options); - } - /** - * @param {?} eventName - * @param {?} callback - * @return {?} - */ - RendererAnimationPlayer.prototype._listen = function (eventName, callback) { - return this._renderer.listen(this.element, "@@" + this.id + ":" + eventName, callback); - }; - /** - * @param {?} command - * @param {...?} args - * @return {?} - */ - RendererAnimationPlayer.prototype._command = function (command) { - var args = []; - for (var _i = 1; _i < arguments.length; _i++) { - args[_i - 1] = arguments[_i]; - } - return issueAnimationCommand(this._renderer, this.element, this.id, command, args); - }; - /** - * @param {?} fn - * @return {?} - */ - RendererAnimationPlayer.prototype.onDone = function (fn) { this._listen('done', fn); }; - /** - * @param {?} fn - * @return {?} - */ - RendererAnimationPlayer.prototype.onStart = function (fn) { this._listen('start', fn); }; - /** - * @param {?} fn - * @return {?} - */ - RendererAnimationPlayer.prototype.onDestroy = function (fn) { this._listen('destroy', fn); }; - /** - * @return {?} - */ - RendererAnimationPlayer.prototype.init = function () { this._command('init'); }; - /** - * @return {?} - */ - RendererAnimationPlayer.prototype.hasStarted = function () { return this._started; }; - /** - * @return {?} - */ - RendererAnimationPlayer.prototype.play = function () { - this._command('play'); - this._started = true; - }; - /** - * @return {?} - */ - RendererAnimationPlayer.prototype.pause = function () { this._command('pause'); }; - /** - * @return {?} - */ - RendererAnimationPlayer.prototype.restart = function () { this._command('restart'); }; - /** - * @return {?} - */ - RendererAnimationPlayer.prototype.finish = function () { this._command('finish'); }; - /** - * @return {?} - */ - RendererAnimationPlayer.prototype.destroy = function () { this._command('destroy'); }; - /** - * @return {?} - */ - RendererAnimationPlayer.prototype.reset = function () { this._command('reset'); }; - /** - * @param {?} p - * @return {?} - */ - RendererAnimationPlayer.prototype.setPosition = function (p) { this._command('setPosition', p); }; - /** - * @return {?} - */ - RendererAnimationPlayer.prototype.getPosition = function () { return 0; }; - return RendererAnimationPlayer; -}()); -/** - * @param {?} renderer - * @param {?} element - * @param {?} id - * @param {?} command - * @param {?} args - * @return {?} - */ -function issueAnimationCommand(renderer, element, id, command, args) { - return renderer.setProperty(element, "@@" + id + ":" + command, args); -} -/** - * @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 AnimationRendererFactory = (function () { - /** - * @param {?} delegate - * @param {?} engine - * @param {?} _zone - */ - function AnimationRendererFactory(delegate, engine, _zone) { - this.delegate = delegate; - this.engine = engine; - this._zone = _zone; - this._currentId = 0; - this._microtaskId = 1; - this._animationCallbacksBuffer = []; - this._rendererCache = new Map(); - engine.onRemovalComplete = function (element, delegate) { - // Note: if an component element has a leave animation, and the component - // a host leave animation, the view engine will call `removeChild` for the parent - // component renderer as well as for the child component renderer. - // Therefore, we need to check if we already removed the element. - if (delegate && delegate.parentNode(element)) { - delegate.removeChild(element.parentNode, element); - } - }; - } - /** - * @param {?} hostElement - * @param {?} type - * @return {?} - */ - AnimationRendererFactory.prototype.createRenderer = function (hostElement, type) { - var _this = this; - var /** @type {?} */ EMPTY_NAMESPACE_ID = ''; - // cache the delegates to find out which cached delegate can - // be used by which cached renderer - var /** @type {?} */ delegate = this.delegate.createRenderer(hostElement, type); - if (!hostElement || !type || !type.data || !type.data['animation']) { - var /** @type {?} */ renderer = this._rendererCache.get(delegate); - if (!renderer) { - renderer = new BaseAnimationRenderer(EMPTY_NAMESPACE_ID, delegate, this.engine); - // only cache this result when the base renderer is used - this._rendererCache.set(delegate, renderer); - } - return renderer; - } - var /** @type {?} */ componentId = type.id; - var /** @type {?} */ namespaceId = type.id + '-' + this._currentId; - this._currentId++; - this.engine.register(namespaceId, hostElement); - var /** @type {?} */ animationTriggers = (type.data['animation']); - animationTriggers.forEach(function (trigger) { return _this.engine.registerTrigger(componentId, namespaceId, hostElement, trigger.name, trigger); }); - return new AnimationRenderer(this, namespaceId, delegate, this.engine); - }; - /** - * @return {?} - */ - AnimationRendererFactory.prototype.begin = function () { - if (this.delegate.begin) { - this.delegate.begin(); - } - }; - /** - * @return {?} - */ - AnimationRendererFactory.prototype._scheduleCountTask = function () { - var _this = this; - Zone.current.scheduleMicroTask('incremenet the animation microtask', function () { return _this._microtaskId++; }); - }; - /** - * @param {?} count - * @param {?} fn - * @param {?} data - * @return {?} - */ - AnimationRendererFactory.prototype.scheduleListenerCallback = function (count, fn, data) { - var _this = this; - if (count >= 0 && count < this._microtaskId) { - this._zone.run(function () { return fn(data); }); - return; - } - if (this._animationCallbacksBuffer.length == 0) { - Promise.resolve(null).then(function () { - _this._zone.run(function () { - _this._animationCallbacksBuffer.forEach(function (tuple) { - var fn = tuple[0], data = tuple[1]; - fn(data); - }); - _this._animationCallbacksBuffer = []; - }); - }); - } - this._animationCallbacksBuffer.push([fn, data]); - }; - /** - * @return {?} - */ - AnimationRendererFactory.prototype.end = function () { - var _this = this; - this._zone.runOutsideAngular(function () { - _this._scheduleCountTask(); - _this.engine.flush(_this._microtaskId); - }); - if (this.delegate.end) { - this.delegate.end(); - } - }; - /** - * @return {?} - */ - AnimationRendererFactory.prototype.whenRenderingDone = function () { return this.engine.whenRenderingDone(); }; - return AnimationRendererFactory; -}()); -AnimationRendererFactory.decorators = [ - { type: _angular_core.Injectable }, -]; -/** - * @nocollapse - */ -AnimationRendererFactory.ctorParameters = function () { return [ - { type: _angular_core.RendererFactory2, }, - { type: _angular_animations_browser.ɵAnimationEngine, }, - { type: _angular_core.NgZone, }, -]; }; -var BaseAnimationRenderer = (function () { - /** - * @param {?} namespaceId - * @param {?} delegate - * @param {?} engine - */ - function BaseAnimationRenderer(namespaceId, delegate, engine) { - this.namespaceId = namespaceId; - this.delegate = delegate; - this.engine = engine; - this.destroyNode = this.delegate.destroyNode ? function (n) { return delegate.destroyNode(n); } : null; - } - Object.defineProperty(BaseAnimationRenderer.prototype, "data", { - /** - * @return {?} - */ - get: function () { return this.delegate.data; }, - enumerable: true, - configurable: true - }); - /** - * @return {?} - */ - BaseAnimationRenderer.prototype.destroy = function () { - this.engine.destroy(this.namespaceId, this.delegate); - this.delegate.destroy(); - }; - /** - * @param {?} name - * @param {?=} namespace - * @return {?} - */ - BaseAnimationRenderer.prototype.createElement = function (name, namespace) { - return this.delegate.createElement(name, namespace); - }; - /** - * @param {?} value - * @return {?} - */ - BaseAnimationRenderer.prototype.createComment = function (value) { return this.delegate.createComment(value); }; - /** - * @param {?} value - * @return {?} - */ - BaseAnimationRenderer.prototype.createText = function (value) { return this.delegate.createText(value); }; - /** - * @param {?} parent - * @param {?} newChild - * @return {?} - */ - BaseAnimationRenderer.prototype.appendChild = function (parent, newChild) { - this.delegate.appendChild(parent, newChild); - this.engine.onInsert(this.namespaceId, newChild, parent, false); - }; - /** - * @param {?} parent - * @param {?} newChild - * @param {?} refChild - * @return {?} - */ - BaseAnimationRenderer.prototype.insertBefore = function (parent, newChild, refChild) { - this.delegate.insertBefore(parent, newChild, refChild); - this.engine.onInsert(this.namespaceId, newChild, parent, true); - }; - /** - * @param {?} parent - * @param {?} oldChild - * @return {?} - */ - BaseAnimationRenderer.prototype.removeChild = function (parent, oldChild) { - this.engine.onRemove(this.namespaceId, oldChild, this.delegate); - }; - /** - * @param {?} selectorOrNode - * @return {?} - */ - BaseAnimationRenderer.prototype.selectRootElement = function (selectorOrNode) { return this.delegate.selectRootElement(selectorOrNode); }; - /** - * @param {?} node - * @return {?} - */ - BaseAnimationRenderer.prototype.parentNode = function (node) { return this.delegate.parentNode(node); }; - /** - * @param {?} node - * @return {?} - */ - BaseAnimationRenderer.prototype.nextSibling = function (node) { return this.delegate.nextSibling(node); }; - /** - * @param {?} el - * @param {?} name - * @param {?} value - * @param {?=} namespace - * @return {?} - */ - BaseAnimationRenderer.prototype.setAttribute = function (el, name, value, namespace) { - this.delegate.setAttribute(el, name, value, namespace); - }; - /** - * @param {?} el - * @param {?} name - * @param {?=} namespace - * @return {?} - */ - BaseAnimationRenderer.prototype.removeAttribute = function (el, name, namespace) { - this.delegate.removeAttribute(el, name, namespace); - }; - /** - * @param {?} el - * @param {?} name - * @return {?} - */ - BaseAnimationRenderer.prototype.addClass = function (el, name) { this.delegate.addClass(el, name); }; - /** - * @param {?} el - * @param {?} name - * @return {?} - */ - BaseAnimationRenderer.prototype.removeClass = function (el, name) { this.delegate.removeClass(el, name); }; - /** - * @param {?} el - * @param {?} style - * @param {?} value - * @param {?=} flags - * @return {?} - */ - BaseAnimationRenderer.prototype.setStyle = function (el, style, value, flags) { - this.delegate.setStyle(el, style, value, flags); - }; - /** - * @param {?} el - * @param {?} style - * @param {?=} flags - * @return {?} - */ - BaseAnimationRenderer.prototype.removeStyle = function (el, style, flags) { - this.delegate.removeStyle(el, style, flags); - }; - /** - * @param {?} el - * @param {?} name - * @param {?} value - * @return {?} - */ - BaseAnimationRenderer.prototype.setProperty = function (el, name, value) { - this.delegate.setProperty(el, name, value); - }; - /** - * @param {?} node - * @param {?} value - * @return {?} - */ - BaseAnimationRenderer.prototype.setValue = function (node, value) { this.delegate.setValue(node, value); }; - /** - * @param {?} target - * @param {?} eventName - * @param {?} callback - * @return {?} - */ - BaseAnimationRenderer.prototype.listen = function (target, eventName, callback) { - return this.delegate.listen(target, eventName, callback); - }; - return BaseAnimationRenderer; -}()); -var AnimationRenderer = (function (_super) { - __extends(AnimationRenderer, _super); - /** - * @param {?} factory - * @param {?} namespaceId - * @param {?} delegate - * @param {?} engine - */ - function AnimationRenderer(factory, namespaceId, delegate, engine) { - var _this = _super.call(this, namespaceId, delegate, engine) || this; - _this.factory = factory; - _this.namespaceId = namespaceId; - return _this; - } - /** - * @param {?} el - * @param {?} name - * @param {?} value - * @return {?} - */ - AnimationRenderer.prototype.setProperty = function (el, name, value) { - if (name.charAt(0) == '@') { - name = name.substr(1); - this.engine.setProperty(this.namespaceId, el, name, value); - } - else { - this.delegate.setProperty(el, name, value); - } - }; - /** - * @param {?} target - * @param {?} eventName - * @param {?} callback - * @return {?} - */ - AnimationRenderer.prototype.listen = function (target, eventName, callback) { - var _this = this; - if (eventName.charAt(0) == '@') { - var /** @type {?} */ element = resolveElementFromTarget(target); - var /** @type {?} */ name = eventName.substr(1); - var /** @type {?} */ phase = ''; - if (name.charAt(0) != '@') { - _a = parseTriggerCallbackName(name), name = _a[0], phase = _a[1]; - } - return this.engine.listen(this.namespaceId, element, name, phase, function (event) { - var /** @type {?} */ countId = ((event))['_data'] || -1; - _this.factory.scheduleListenerCallback(countId, callback, event); - }); - } - return this.delegate.listen(target, eventName, callback); - var _a; - }; - return AnimationRenderer; -}(BaseAnimationRenderer)); -/** - * @param {?} target - * @return {?} - */ -function resolveElementFromTarget(target) { - switch (target) { - case 'body': - return document.body; - case 'document': - return document; - case 'window': - return window; - default: - return target; - } -} -/** - * @param {?} triggerName - * @return {?} - */ -function parseTriggerCallbackName(triggerName) { - var /** @type {?} */ dotIndex = triggerName.indexOf('.'); - var /** @type {?} */ trigger = triggerName.substring(0, dotIndex); - var /** @type {?} */ phase = triggerName.substr(dotIndex + 1); - return [trigger, phase]; -} -/** - * @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 InjectableAnimationEngine = (function (_super) { - __extends(InjectableAnimationEngine, _super); - /** - * @param {?} driver - * @param {?} normalizer - */ - function InjectableAnimationEngine(driver, normalizer) { - return _super.call(this, driver, normalizer) || this; - } - return InjectableAnimationEngine; -}(_angular_animations_browser.ɵAnimationEngine)); -InjectableAnimationEngine.decorators = [ - { type: _angular_core.Injectable }, -]; -/** - * @nocollapse - */ -InjectableAnimationEngine.ctorParameters = function () { return [ - { type: _angular_animations_browser.AnimationDriver, }, - { type: _angular_animations_browser.ɵAnimationStyleNormalizer, }, -]; }; -/** - * @return {?} - */ -function instantiateSupportedAnimationDriver() { - if (_angular_animations_browser.ɵsupportsWebAnimations()) { - return new _angular_animations_browser.ɵWebAnimationsDriver(); - } - return new _angular_animations_browser.ɵNoopAnimationDriver(); -} -/** - * @return {?} - */ -function instantiateDefaultStyleNormalizer() { - return new _angular_animations_browser.ɵWebAnimationsStyleNormalizer(); -} -/** - * @param {?} renderer - * @param {?} engine - * @param {?} zone - * @return {?} - */ -function instantiateRendererFactory(renderer, engine, zone) { - return new AnimationRendererFactory(renderer, engine, zone); -} -var SHARED_ANIMATION_PROVIDERS = [ - { provide: _angular_animations.AnimationBuilder, useClass: BrowserAnimationBuilder }, - { provide: _angular_animations_browser.ɵAnimationStyleNormalizer, useFactory: instantiateDefaultStyleNormalizer }, - { provide: _angular_animations_browser.ɵAnimationEngine, useClass: InjectableAnimationEngine }, { - provide: _angular_core.RendererFactory2, - useFactory: instantiateRendererFactory, - deps: [_angular_platformBrowser.ɵDomRendererFactory2, _angular_animations_browser.ɵAnimationEngine, _angular_core.NgZone] - } -]; -/** - * Separate providers from the actual module so that we can do a local modification in Google3 to - * include them in the BrowserModule. - */ -var BROWSER_ANIMATIONS_PROVIDERS = [ - { provide: _angular_animations_browser.AnimationDriver, useFactory: instantiateSupportedAnimationDriver } -].concat(SHARED_ANIMATION_PROVIDERS); -/** - * Separate providers from the actual module so that we can do a local modification in Google3 to - * include them in the BrowserTestingModule. - */ -var BROWSER_NOOP_ANIMATIONS_PROVIDERS = [{ provide: _angular_animations_browser.AnimationDriver, useClass: _angular_animations_browser.ɵNoopAnimationDriver }].concat(SHARED_ANIMATION_PROVIDERS); -/** - * @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 - */ -/** - * \@experimental Animation support is experimental. - */ -var BrowserAnimationsModule = (function () { - function BrowserAnimationsModule() { - } - return BrowserAnimationsModule; -}()); -BrowserAnimationsModule.decorators = [ - { type: _angular_core.NgModule, args: [{ - imports: [_angular_platformBrowser.BrowserModule], - providers: BROWSER_ANIMATIONS_PROVIDERS, - },] }, -]; -/** - * @nocollapse - */ -BrowserAnimationsModule.ctorParameters = function () { return []; }; -/** - * \@experimental Animation support is experimental. - */ -var NoopAnimationsModule = (function () { - function NoopAnimationsModule() { - } - return NoopAnimationsModule; -}()); -NoopAnimationsModule.decorators = [ - { type: _angular_core.NgModule, args: [{ - imports: [_angular_platformBrowser.BrowserModule], - providers: BROWSER_NOOP_ANIMATIONS_PROVIDERS, - },] }, -]; -/** - * @nocollapse - */ -NoopAnimationsModule.ctorParameters = function () { return []; }; - -exports.BrowserAnimationsModule = BrowserAnimationsModule; -exports.NoopAnimationsModule = NoopAnimationsModule; -exports.ɵBrowserAnimationBuilder = BrowserAnimationBuilder; -exports.ɵBrowserAnimationFactory = BrowserAnimationFactory; -exports.ɵAnimationRenderer = AnimationRenderer; -exports.ɵAnimationRendererFactory = AnimationRendererFactory; -exports.ɵa = BaseAnimationRenderer; -exports.ɵf = BROWSER_ANIMATIONS_PROVIDERS; -exports.ɵg = BROWSER_NOOP_ANIMATIONS_PROVIDERS; -exports.ɵb = InjectableAnimationEngine; -exports.ɵd = instantiateDefaultStyleNormalizer; -exports.ɵe = instantiateRendererFactory; -exports.ɵc = instantiateSupportedAnimationDriver; - -Object.defineProperty(exports, '__esModule', { value: true }); - -}))); -//# sourceMappingURL=platform-browser-animations.umd.js.map - - -/***/ }), -/* 94 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return AppModuleShared; }); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__(10); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0__angular_core__); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__angular_common__ = __webpack_require__(17); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__angular_common___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1__angular_common__); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__angular_forms__ = __webpack_require__(384); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__angular_forms___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2__angular_forms__); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__angular_http__ = __webpack_require__(29); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__angular_http___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_3__angular_http__); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__angular_router__ = __webpack_require__(83); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__angular_router___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_4__angular_router__); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__components_app_app_component__ = __webpack_require__(48); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__components_navmenu_navmenu_component__ = __webpack_require__(98); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__components_home_home_component__ = __webpack_require__(97); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__components_fetchdata_fetchdata_component__ = __webpack_require__(96); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_9__components_counter_counter_component__ = __webpack_require__(95); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_10__components_unauthorized_unauthorized_component__ = __webpack_require__(99); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_11_angular_auth_oidc_client__ = __webpack_require__(47); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_11_angular_auth_oidc_client___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_11_angular_auth_oidc_client__); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_12__components_services_auth_service__ = __webpack_require__(32); -var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { - var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; - if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); - else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; - return c > 3 && r && Object.defineProperty(target, key, r), r; -}; - - - - - - - - - - - - - -var AppModuleShared = (function () { - function AppModuleShared() { - } - AppModuleShared = __decorate([ - __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_0__angular_core__["NgModule"])({ - declarations: [ - __WEBPACK_IMPORTED_MODULE_5__components_app_app_component__["a" /* AppComponent */], - __WEBPACK_IMPORTED_MODULE_6__components_navmenu_navmenu_component__["a" /* NavMenuComponent */], - __WEBPACK_IMPORTED_MODULE_9__components_counter_counter_component__["a" /* CounterComponent */], - __WEBPACK_IMPORTED_MODULE_8__components_fetchdata_fetchdata_component__["a" /* FetchDataComponent */], - __WEBPACK_IMPORTED_MODULE_7__components_home_home_component__["a" /* HomeComponent */], - __WEBPACK_IMPORTED_MODULE_10__components_unauthorized_unauthorized_component__["a" /* UnauthorizedComponent */] - ], - imports: [ - __WEBPACK_IMPORTED_MODULE_11_angular_auth_oidc_client__["AuthModule"].forRoot(), - __WEBPACK_IMPORTED_MODULE_1__angular_common__["CommonModule"], - __WEBPACK_IMPORTED_MODULE_3__angular_http__["HttpModule"], - __WEBPACK_IMPORTED_MODULE_2__angular_forms__["FormsModule"], - __WEBPACK_IMPORTED_MODULE_4__angular_router__["RouterModule"].forRoot([ - { path: '', redirectTo: 'home', pathMatch: 'full' }, - { path: 'home', component: __WEBPACK_IMPORTED_MODULE_7__components_home_home_component__["a" /* HomeComponent */] }, - { path: 'unauthorized', component: __WEBPACK_IMPORTED_MODULE_10__components_unauthorized_unauthorized_component__["a" /* UnauthorizedComponent */] }, - { path: 'counter', component: __WEBPACK_IMPORTED_MODULE_9__components_counter_counter_component__["a" /* CounterComponent */] }, - { path: 'fetch-data', component: __WEBPACK_IMPORTED_MODULE_8__components_fetchdata_fetchdata_component__["a" /* FetchDataComponent */] }, - { path: '**', redirectTo: 'home' } - ]) - ], - providers: [ - __WEBPACK_IMPORTED_MODULE_12__components_services_auth_service__["a" /* AuthService */], - __WEBPACK_IMPORTED_MODULE_11_angular_auth_oidc_client__["OidcSecurityService"] - ] - }) - ], AppModuleShared); - return AppModuleShared; -}()); - - - -/***/ }), -/* 95 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return CounterComponent; }); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__(10); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0__angular_core__); -var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { - var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; - if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); - else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; - return c > 3 && r && Object.defineProperty(target, key, r), r; -}; - -var CounterComponent = (function () { - function CounterComponent() { - this.currentCount = 0; - } - CounterComponent.prototype.incrementCounter = function () { - this.currentCount++; - }; - CounterComponent = __decorate([ - __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Component"])({ - selector: 'counter', - template: __webpack_require__(104) - }) - ], CounterComponent); - return CounterComponent; -}()); - - - -/***/ }), -/* 96 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return FetchDataComponent; }); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__(10); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0__angular_core__); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__services_auth_service__ = __webpack_require__(32); -var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { - var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; - if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); - else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; - return c > 3 && r && Object.defineProperty(target, key, r), r; -}; -var __metadata = (this && this.__metadata) || function (k, v) { - if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); -}; -var __param = (this && this.__param) || function (paramIndex, decorator) { - return function (target, key) { decorator(target, key, paramIndex); } -}; - - -var FetchDataComponent = (function () { - function FetchDataComponent(authService, apiUrl) { - var _this = this; - authService.get(apiUrl + 'SampleData/WeatherForecasts').subscribe(function (result) { - _this.forecasts = result.json(); - }, function (error) { return console.error(error); }); - } - FetchDataComponent = __decorate([ - __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Component"])({ - selector: 'fetchdata', - template: __webpack_require__(105) - }), - __param(1, __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Inject"])('API_URL')), - __metadata("design:paramtypes", [__WEBPACK_IMPORTED_MODULE_1__services_auth_service__["a" /* AuthService */], String]) - ], FetchDataComponent); - return FetchDataComponent; -}()); - - - -/***/ }), -/* 97 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return HomeComponent; }); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__(10); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0__angular_core__); -var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { - var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; - if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); - else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; - return c > 3 && r && Object.defineProperty(target, key, r), r; -}; - -var HomeComponent = (function () { - function HomeComponent() { - } - HomeComponent = __decorate([ - __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Component"])({ - selector: 'home', - template: __webpack_require__(106) - }) - ], HomeComponent); - return HomeComponent; -}()); - - - -/***/ }), -/* 98 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return NavMenuComponent; }); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__(10); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0__angular_core__); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__services_auth_service__ = __webpack_require__(32); -var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { - var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; - if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); - else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; - return c > 3 && r && Object.defineProperty(target, key, r), r; -}; -var __metadata = (this && this.__metadata) || function (k, v) { - if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); -}; - - -var NavMenuComponent = (function () { - function NavMenuComponent(authService) { - this.authService = authService; - } - NavMenuComponent.prototype.ngOnInit = function () { - var _this = this; - this.isAuthorizedSubscription = this.authService.getIsAuthorized().subscribe(function (isAuthorized) { - _this.isAuthorized = isAuthorized; - }); - }; - NavMenuComponent.prototype.ngOnDestroy = function () { - this.isAuthorizedSubscription.unsubscribe(); - }; - NavMenuComponent.prototype.login = function () { - this.authService.login(); - }; - NavMenuComponent.prototype.refreshSession = function () { - this.authService.refreshSession(); - }; - NavMenuComponent.prototype.logout = function () { - this.authService.logout(); - }; - NavMenuComponent = __decorate([ - __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Component"])({ - selector: 'nav-menu', - template: __webpack_require__(107), - styles: [__webpack_require__(376)] - }), - __metadata("design:paramtypes", [__WEBPACK_IMPORTED_MODULE_1__services_auth_service__["a" /* AuthService */]]) - ], NavMenuComponent); - return NavMenuComponent; -}()); - - - -/***/ }), -/* 99 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return UnauthorizedComponent; }); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__(10); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0__angular_core__); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__angular_common__ = __webpack_require__(17); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__angular_common___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1__angular_common__); -var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { - var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; - if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); - else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; - return c > 3 && r && Object.defineProperty(target, key, r), r; -}; -var __metadata = (this && this.__metadata) || function (k, v) { - if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); -}; - - -var UnauthorizedComponent = (function () { - function UnauthorizedComponent(location) { - this.location = location; - } - UnauthorizedComponent.prototype.ngOnInit = function () { - }; - UnauthorizedComponent.prototype.login = function () { - //this.service.startSigninMainWindow(); - }; - UnauthorizedComponent.prototype.goback = function () { - this.location.back(); - }; - UnauthorizedComponent = __decorate([ - __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Component"])({ - selector: 'app-unauthorized', - template: __webpack_require__(108) - }), - __metadata("design:paramtypes", [__WEBPACK_IMPORTED_MODULE_1__angular_common__["Location"]]) - ], UnauthorizedComponent); - return UnauthorizedComponent; -}()); - - - -/***/ }), -/* 100 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -Object.defineProperty(__webpack_exports__, "__esModule", { value: true }); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_reflect_metadata__ = __webpack_require__(90); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_reflect_metadata___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_reflect_metadata__); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_zone_js__ = __webpack_require__(92); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_zone_js___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_zone_js__); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_rxjs_add_operator_first__ = __webpack_require__(45); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_rxjs_add_operator_first___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2_rxjs_add_operator_first__); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__angular_common__ = __webpack_require__(17); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__angular_common___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_3__angular_common__); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__angular_core__ = __webpack_require__(10); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__angular_core___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_4__angular_core__); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__angular_platform_server__ = __webpack_require__(44); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__angular_platform_server___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_5__angular_platform_server__); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6_aspnet_prerendering__ = __webpack_require__(91); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6_aspnet_prerendering___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_6_aspnet_prerendering__); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__app_app_module_server__ = __webpack_require__(89); - - - - - - - - -__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_4__angular_core__["enableProdMode"])(); -/* harmony default export */ __webpack_exports__["default"] = (__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_6_aspnet_prerendering__["createServerRenderer"])(function (params) { - var providers = [ - { provide: __WEBPACK_IMPORTED_MODULE_5__angular_platform_server__["INITIAL_CONFIG"], useValue: { document: '', url: params.url } }, - { provide: __WEBPACK_IMPORTED_MODULE_3__angular_common__["APP_BASE_HREF"], useValue: params.baseUrl }, - { provide: 'BASE_URL', useValue: params.origin + params.baseUrl }, - { provide: 'ORIGIN_URL', useValue: params.origin + params.baseUrl }, - { provide: 'API_URL', useValue: params.data.apiUrl }, - { provide: 'IDENTITY_URL', useValue: params.data.identityUrl }, - { provide: 'URL_CONFIG', useValue: params.data } - ]; - return __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_5__angular_platform_server__["platformDynamicServer"])(providers).bootstrapModule(__WEBPACK_IMPORTED_MODULE_7__app_app_module_server__["a" /* AppModule */]).then(function (moduleRef) { - var appRef = moduleRef.injector.get(__WEBPACK_IMPORTED_MODULE_4__angular_core__["ApplicationRef"]); - var state = moduleRef.injector.get(__WEBPACK_IMPORTED_MODULE_5__angular_platform_server__["PlatformState"]); - var zone = moduleRef.injector.get(__WEBPACK_IMPORTED_MODULE_4__angular_core__["NgZone"]); - return new Promise(function (resolve, reject) { - zone.onError.subscribe(function (errorInfo) { return reject(errorInfo); }); - appRef.isStable.first(function (isStable) { return isStable; }).subscribe(function () { - // Because 'onStable' fires before 'onError', we have to delay slightly before - // completing the request in case there's an error to report - setImmediate(function () { - resolve({ - html: state.renderToString(), - globals: { url_Config: params.data } - }); - moduleRef.destroy(); - }); - }); - }); - }); -})); - - -/***/ }), -/* 101 */ -/***/ (function(module, exports, __webpack_require__) { - -exports = module.exports = __webpack_require__(85)(undefined); -// imports - - -// module -exports.push([module.i, "@media (max-width: 767px) {\r\n /* On small screens, the nav menu spans the full width of the screen. Leave a space for it. */\r\n .body-content {\r\n padding-top: 50px;\r\n }\r\n}\r\n", ""]); - -// exports - - -/***/ }), -/* 102 */ -/***/ (function(module, exports, __webpack_require__) { - -exports = module.exports = __webpack_require__(85)(undefined); -// imports - - -// module -exports.push([module.i, "li .glyphicon {\r\n margin-right: 10px;\r\n}\r\n\r\n/* Highlighting rules for nav menu items */\r\nli.link-active a,\r\nli.link-active a:hover,\r\nli.link-active a:focus {\r\n background-color: #4189C7;\r\n color: white;\r\n}\r\n\r\n/* Keep the nav menu independent of scrolling and on top of other items */\r\n.main-nav {\r\n position: fixed;\r\n top: 0;\r\n left: 0;\r\n right: 0;\r\n z-index: 1;\r\n}\r\n\r\n@media (min-width: 768px) {\r\n /* On small screens, convert the nav menu to a vertical sidebar */\r\n .main-nav {\r\n height: 100%;\r\n width: calc(25% - 20px);\r\n }\r\n .navbar {\r\n border-radius: 0px;\r\n border-width: 0px;\r\n height: 100%;\r\n }\r\n .navbar-header {\r\n float: none;\r\n }\r\n .navbar-collapse {\r\n border-top: 1px solid #444;\r\n padding: 0px;\r\n }\r\n .navbar ul {\r\n float: none;\r\n }\r\n .navbar li {\r\n float: none;\r\n font-size: 15px;\r\n margin: 6px;\r\n }\r\n .navbar li a {\r\n padding: 10px 16px;\r\n border-radius: 4px;\r\n }\r\n .navbar a {\r\n /* If a menu item's text is too long, truncate it */\r\n width: 100%;\r\n white-space: nowrap;\r\n overflow: hidden;\r\n text-overflow: ellipsis;\r\n }\r\n}\r\n", ""]); - -// exports - - -/***/ }), -/* 103 */ -/***/ (function(module, exports) { - -module.exports = "\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n\r\n"; - -/***/ }), -/* 104 */ -/***/ (function(module, exports) { - -module.exports = "Counter\r\n\r\nThis is a simple example of an Angular component.\r\n\r\nCurrent count: {{ currentCount }}\r\n\r\nIncrement\r\n"; - -/***/ }), -/* 105 */ -/***/ (function(module, exports) { - -module.exports = "Weather forecast\r\n\r\nThis component demonstrates fetching data from the server.\r\n\r\nLoading...\r\n\r\n\r\n \r\n \r\n Date\r\n Temp. (C)\r\n Temp. (F)\r\n Summary\r\n \r\n \r\n \r\n \r\n {{ forecast.dateFormatted }}\r\n {{ forecast.temperatureC }}\r\n {{ forecast.temperatureF }}\r\n {{ forecast.summary }}\r\n \r\n \r\n\r\n"; - -/***/ }), -/* 106 */ -/***/ (function(module, exports) { - -module.exports = "Hello, world!\r\nWelcome to your new single-page application, built with:\r\n\r\n ASP.NET Core and C# for cross-platform server-side code\r\n Angular and TypeScript for client-side code\r\n Webpack for building and bundling client-side resources\r\n Bootstrap for layout and styling\r\n\r\nTo help you get started, we've also set up:\r\n\r\n Client-side navigation. For example, click Counter then Back to return here.\r\n Server-side prerendering. For faster initial loading and improved SEO, your Angular app is prerendered on the server. The resulting HTML is then transferred to the browser where a client-side copy of the app takes over.\r\n Webpack dev middleware. In development mode, there's no need to run the webpack build tool. Your client-side resources are dynamically built on demand. Updates are available as soon as you modify any file.\r\n Hot module replacement. In development mode, you don't even need to reload the page after making most changes. Within seconds of saving changes to files, your Angular app will be rebuilt and a new instance injected is into the page.\r\n Efficient production builds. In production mode, development-time features are disabled, and the webpack build tool produces minified static CSS and JavaScript files.\r\n\r\n"; - -/***/ }), -/* 107 */ -/***/ (function(module, exports) { - -module.exports = "\r\n \r\n \r\n \r\n Toggle navigation\r\n \r\n \r\n \r\n \r\n WebApplicationBasic\r\n \r\n \r\n \r\n \r\n \r\n Home\r\n \r\n \r\n Counter\r\n \r\n \r\n Fetch data\r\n \r\n \r\n Login\r\n \r\n \r\n Logout\r\n \r\n \r\n \r\n \r\n\r\n"; - -/***/ }), -/* 108 */ -/***/ (function(module, exports) { - -module.exports = "\r\n Login is required to access this area\r\n\r\n\r\n Login\r\n Back\r\n"; - -/***/ }), -/* 109 */ -/***/ (function(module, exports) { - - -var navigator = {}; -navigator.userAgent = false; - -var window = {}; -/* - * jsrsasign(all) 8.0.3 (2017-07-11) (c) 2010-2017 Kenji Urushima | kjur.github.com/jsrsasign/license - */ - -/*! -Copyright (c) 2011, Yahoo! Inc. All rights reserved. -Code licensed under the BSD License: -http://developer.yahoo.com/yui/license.html -version: 2.9.0 -*/ -if(YAHOO===undefined){var YAHOO={}}YAHOO.lang={extend:function(g,h,f){if(!h||!g){throw new Error("YAHOO.lang.extend failed, please check that all dependencies are included.")}var d=function(){};d.prototype=h.prototype;g.prototype=new d();g.prototype.constructor=g;g.superclass=h.prototype;if(h.prototype.constructor==Object.prototype.constructor){h.prototype.constructor=h}if(f){var b;for(b in f){g.prototype[b]=f[b]}var e=function(){},c=["toString","valueOf"];try{if(/MSIE/.test(navigator.userAgent)){e=function(j,i){for(b=0;b>>2]>>>(24-(r%4)*8))&255;q[(n+r)>>>2]|=o<<(24-((n+r)%4)*8)}}else{for(var r=0;r>>2]=p[r>>>2]}}this.sigBytes+=s;return this},clamp:function(){var o=this.words;var n=this.sigBytes;o[n>>>2]&=4294967295<<(32-(n%4)*8);o.length=e.ceil(n/4)},clone:function(){var n=j.clone.call(this);n.words=this.words.slice(0);return n},random:function(p){var o=[];for(var n=0;n>>2]>>>(24-(n%4)*8))&255;q.push((s>>>4).toString(16));q.push((s&15).toString(16))}return q.join("")},parse:function(p){var n=p.length;var q=[];for(var o=0;o>>3]|=parseInt(p.substr(o,2),16)<<(24-(o%8)*4)}return new l.init(q,n/2)}};var d=m.Latin1={stringify:function(q){var r=q.words;var p=q.sigBytes;var n=[];for(var o=0;o>>2]>>>(24-(o%4)*8))&255;n.push(String.fromCharCode(s))}return n.join("")},parse:function(p){var n=p.length;var q=[];for(var o=0;o>>2]|=(p.charCodeAt(o)&255)<<(24-(o%4)*8)}return new l.init(q,n)}};var c=m.Utf8={stringify:function(n){try{return decodeURIComponent(escape(d.stringify(n)))}catch(o){throw new Error("Malformed UTF-8 data")}},parse:function(n){return d.parse(unescape(encodeURIComponent(n)))}};var i=b.BufferedBlockAlgorithm=j.extend({reset:function(){this._data=new l.init();this._nDataBytes=0},_append:function(n){if(typeof n=="string"){n=c.parse(n)}this._data.concat(n);this._nDataBytes+=n.sigBytes},_process:function(w){var q=this._data;var x=q.words;var n=q.sigBytes;var t=this.blockSize;var v=t*4;var u=n/v;if(w){u=e.ceil(u)}else{u=e.max((u|0)-this._minBufferSize,0)}var s=u*t;var r=e.min(s*4,n);if(s){for(var p=0;p>>2]&255}};f.BlockCipher=n.extend({cfg:n.cfg.extend({mode:m,padding:h}),reset:function(){n.reset.call(this);var a=this.cfg,b=a.iv,a=a.mode;if(this._xformMode==this._ENC_XFORM_MODE)var c=a.createEncryptor;else c=a.createDecryptor,this._minBufferSize=1; -this._mode=c.call(a,this,b&&b.words)},_doProcessBlock:function(a,b){this._mode.processBlock(a,b)},_doFinalize:function(){var a=this.cfg.padding;if(this._xformMode==this._ENC_XFORM_MODE){a.pad(this._data,this.blockSize);var b=this._process(!0)}else b=this._process(!0),a.unpad(b);return b},blockSize:4});var p=f.CipherParams=k.extend({init:function(a){this.mixIn(a)},toString:function(a){return(a||this.formatter).stringify(this)}}),m=(g.format={}).OpenSSL={stringify:function(a){var b=a.ciphertext;a=a.salt; -return(a?l.create([1398893684,1701076831]).concat(a).concat(b):b).toString(r)},parse:function(a){a=r.parse(a);var b=a.words;if(1398893684==b[0]&&1701076831==b[1]){var c=l.create(b.slice(2,4));b.splice(0,4);a.sigBytes-=16}return p.create({ciphertext:a,salt:c})}},j=f.SerializableCipher=k.extend({cfg:k.extend({format:m}),encrypt:function(a,b,c,d){d=this.cfg.extend(d);var e=a.createEncryptor(c,d);b=e.finalize(b);e=e.cfg;return p.create({ciphertext:b,key:c,iv:e.iv,algorithm:a,mode:e.mode,padding:e.padding, -blockSize:a.blockSize,formatter:d.format})},decrypt:function(a,b,c,d){d=this.cfg.extend(d);b=this._parse(b,d.format);return a.createDecryptor(c,d).finalize(b.ciphertext)},_parse:function(a,b){return"string"==typeof a?b.parse(a,this):a}}),g=(g.kdf={}).OpenSSL={execute:function(a,b,c,d){d||(d=l.random(8));a=v.create({keySize:b+c}).compute(a,d);c=l.create(a.words.slice(b),4*c);a.sigBytes=4*b;return p.create({key:a,iv:c,salt:d})}},s=f.PasswordBasedCipher=j.extend({cfg:j.cfg.extend({kdf:g}),encrypt:function(a, -b,c,d){d=this.cfg.extend(d);c=d.kdf.execute(c,a.keySize,a.ivSize);d.iv=c.iv;a=j.encrypt.call(this,a,b,c.key,d);a.mixIn(c);return a},decrypt:function(a,b,c,d){d=this.cfg.extend(d);b=this._parse(b,d.format);c=d.kdf.execute(c,a.keySize,a.ivSize,b.salt);d.iv=c.iv;return j.decrypt.call(this,a,b,c.key,d)}})}(); - -/* -CryptoJS v3.1.2 aes.js -code.google.com/p/crypto-js -(c) 2009-2013 by Jeff Mott. All rights reserved. -code.google.com/p/crypto-js/wiki/License -*/ -(function(){for(var q=CryptoJS,x=q.lib.BlockCipher,r=q.algo,j=[],y=[],z=[],A=[],B=[],C=[],s=[],u=[],v=[],w=[],g=[],k=0;256>k;k++)g[k]=128>k?k<<1:k<<1^283;for(var n=0,l=0,k=0;256>k;k++){var f=l^l<<1^l<<2^l<<3^l<<4,f=f>>>8^f&255^99;j[n]=f;y[f]=n;var t=g[n],D=g[t],E=g[D],b=257*g[f]^16843008*f;z[n]=b<<24|b>>>8;A[n]=b<<16|b>>>16;B[n]=b<<8|b>>>24;C[n]=b;b=16843009*E^65537*D^257*t^16843008*n;s[f]=b<<24|b>>>8;u[f]=b<<16|b>>>16;v[f]=b<<8|b>>>24;w[f]=b;n?(n=t^g[g[g[E^t]]],l^=g[g[l]]):n=l=1}var F=[0,1,2,4,8, -16,32,64,128,27,54],r=r.AES=x.extend({_doReset:function(){for(var c=this._key,e=c.words,a=c.sigBytes/4,c=4*((this._nRounds=a+6)+1),b=this._keySchedule=[],h=0;h>>24]<<24|j[d>>>16&255]<<16|j[d>>>8&255]<<8|j[d&255]):(d=d<<8|d>>>24,d=j[d>>>24]<<24|j[d>>>16&255]<<16|j[d>>>8&255]<<8|j[d&255],d^=F[h/a|0]<<24);b[h]=b[h-a]^d}e=this._invKeySchedule=[];for(a=0;aa||4>=h?d:s[j[d>>>24]]^u[j[d>>>16&255]]^v[j[d>>> -8&255]]^w[j[d&255]]},encryptBlock:function(c,e){this._doCryptBlock(c,e,this._keySchedule,z,A,B,C,j)},decryptBlock:function(c,e){var a=c[e+1];c[e+1]=c[e+3];c[e+3]=a;this._doCryptBlock(c,e,this._invKeySchedule,s,u,v,w,y);a=c[e+1];c[e+1]=c[e+3];c[e+3]=a},_doCryptBlock:function(c,e,a,b,h,d,j,m){for(var n=this._nRounds,f=c[e]^a[0],g=c[e+1]^a[1],k=c[e+2]^a[2],p=c[e+3]^a[3],l=4,t=1;t>>24]^h[g>>>16&255]^d[k>>>8&255]^j[p&255]^a[l++],r=b[g>>>24]^h[k>>>16&255]^d[p>>>8&255]^j[f&255]^a[l++],s= -b[k>>>24]^h[p>>>16&255]^d[f>>>8&255]^j[g&255]^a[l++],p=b[p>>>24]^h[f>>>16&255]^d[g>>>8&255]^j[k&255]^a[l++],f=q,g=r,k=s;q=(m[f>>>24]<<24|m[g>>>16&255]<<16|m[k>>>8&255]<<8|m[p&255])^a[l++];r=(m[g>>>24]<<24|m[k>>>16&255]<<16|m[p>>>8&255]<<8|m[f&255])^a[l++];s=(m[k>>>24]<<24|m[p>>>16&255]<<16|m[f>>>8&255]<<8|m[g&255])^a[l++];p=(m[p>>>24]<<24|m[f>>>16&255]<<16|m[g>>>8&255]<<8|m[k&255])^a[l++];c[e]=q;c[e+1]=r;c[e+2]=s;c[e+3]=p},keySize:8});q.AES=x._createHelper(r)})(); - -/* -CryptoJS v3.1.2 tripledes-min.js -code.google.com/p/crypto-js -(c) 2009-2013 by Jeff Mott. All rights reserved. -code.google.com/p/crypto-js/wiki/License -*/ -(function(){function j(b,c){var a=(this._lBlock>>>b^this._rBlock)&c;this._rBlock^=a;this._lBlock^=a<>>b^this._lBlock)&c;this._lBlock^=a;this._rBlock^=a<a;a++){var f=q[a]-1;c[a]=b[f>>>5]>>>31-f%32&1}b=this._subKeys=[];for(f=0;16>f;f++){for(var d=b[f]=[],e=r[f],a=0;24>a;a++)d[a/6|0]|=c[(p[a]-1+e)%28]<<31-a%6,d[4+(a/6|0)]|=c[28+(p[a+24]-1+e)%28]<<31-a%6;d[0]=d[0]<<1|d[0]>>>31;for(a=1;7>a;a++)d[a]>>>= -4*(a-1)+3;d[7]=d[7]<<5|d[7]>>>27}c=this._invSubKeys=[];for(a=0;16>a;a++)c[a]=b[15-a]},encryptBlock:function(b,c){this._doCryptBlock(b,c,this._subKeys)},decryptBlock:function(b,c){this._doCryptBlock(b,c,this._invSubKeys)},_doCryptBlock:function(b,c,a){this._lBlock=b[c];this._rBlock=b[c+1];j.call(this,4,252645135);j.call(this,16,65535);l.call(this,2,858993459);l.call(this,8,16711935);j.call(this,1,1431655765);for(var f=0;16>f;f++){for(var d=a[f],e=this._lBlock,h=this._rBlock,g=0,k=0;8>k;k++)g|=s[k][((h^ -d[k])&t[k])>>>0];this._lBlock=h;this._rBlock=e^g}a=this._lBlock;this._lBlock=this._rBlock;this._rBlock=a;j.call(this,1,1431655765);l.call(this,8,16711935);l.call(this,2,858993459);j.call(this,16,65535);j.call(this,4,252645135);b[c]=this._lBlock;b[c+1]=this._rBlock},keySize:2,ivSize:2,blockSize:2});h.DES=e._createHelper(m);g=g.TripleDES=e.extend({_doReset:function(){var b=this._key.words;this._des1=m.createEncryptor(n.create(b.slice(0,2)));this._des2=m.createEncryptor(n.create(b.slice(2,4)));this._des3= -m.createEncryptor(n.create(b.slice(4,6)))},encryptBlock:function(b,c){this._des1.encryptBlock(b,c);this._des2.decryptBlock(b,c);this._des3.encryptBlock(b,c)},decryptBlock:function(b,c){this._des3.decryptBlock(b,c);this._des2.encryptBlock(b,c);this._des1.decryptBlock(b,c)},keySize:6,ivSize:2,blockSize:2});h.TripleDES=e._createHelper(g)})(); - -/* -CryptoJS v3.1.2 enc-base64.js -code.google.com/p/crypto-js -(c) 2009-2013 by Jeff Mott. All rights reserved. -code.google.com/p/crypto-js/wiki/License -*/ -(function(){var h=CryptoJS,j=h.lib.WordArray;h.enc.Base64={stringify:function(b){var e=b.words,f=b.sigBytes,c=this._map;b.clamp();b=[];for(var a=0;a>>2]>>>24-8*(a%4)&255)<<16|(e[a+1>>>2]>>>24-8*((a+1)%4)&255)<<8|e[a+2>>>2]>>>24-8*((a+2)%4)&255,g=0;4>g&&a+0.75*g>>6*(3-g)&63));if(e=c.charAt(64))for(;b.length%4;)b.push(e);return b.join("")},parse:function(b){var e=b.length,f=this._map,c=f.charAt(64);c&&(c=b.indexOf(c),-1!=c&&(e=c));for(var c=[],a=0,d=0;d< -e;d++)if(d%4){var g=f.indexOf(b.charAt(d-1))<<2*(d%4),h=f.indexOf(b.charAt(d))>>>6-2*(d%4);c[a>>>2]|=(g|h)<<24-8*(a%4);a++}return j.create(c,a)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="}})(); - -/* -CryptoJS v3.1.2 md5.js -code.google.com/p/crypto-js -(c) 2009-2013 by Jeff Mott. All rights reserved. -code.google.com/p/crypto-js/wiki/License -*/ -(function(E){function h(a,f,g,j,p,h,k){a=a+(f&g|~f&j)+p+k;return(a<>>32-h)+f}function k(a,f,g,j,p,h,k){a=a+(f&j|g&~j)+p+k;return(a<>>32-h)+f}function l(a,f,g,j,h,k,l){a=a+(f^g^j)+h+l;return(a<>>32-k)+f}function n(a,f,g,j,h,k,l){a=a+(g^(f|~j))+h+l;return(a<>>32-k)+f}for(var r=CryptoJS,q=r.lib,F=q.WordArray,s=q.Hasher,q=r.algo,a=[],t=0;64>t;t++)a[t]=4294967296*E.abs(E.sin(t+1))|0;q=q.MD5=s.extend({_doReset:function(){this._hash=new F.init([1732584193,4023233417,2562383102,271733878])}, -_doProcessBlock:function(m,f){for(var g=0;16>g;g++){var j=f+g,p=m[j];m[j]=(p<<8|p>>>24)&16711935|(p<<24|p>>>8)&4278255360}var g=this._hash.words,j=m[f+0],p=m[f+1],q=m[f+2],r=m[f+3],s=m[f+4],t=m[f+5],u=m[f+6],v=m[f+7],w=m[f+8],x=m[f+9],y=m[f+10],z=m[f+11],A=m[f+12],B=m[f+13],C=m[f+14],D=m[f+15],b=g[0],c=g[1],d=g[2],e=g[3],b=h(b,c,d,e,j,7,a[0]),e=h(e,b,c,d,p,12,a[1]),d=h(d,e,b,c,q,17,a[2]),c=h(c,d,e,b,r,22,a[3]),b=h(b,c,d,e,s,7,a[4]),e=h(e,b,c,d,t,12,a[5]),d=h(d,e,b,c,u,17,a[6]),c=h(c,d,e,b,v,22,a[7]), -b=h(b,c,d,e,w,7,a[8]),e=h(e,b,c,d,x,12,a[9]),d=h(d,e,b,c,y,17,a[10]),c=h(c,d,e,b,z,22,a[11]),b=h(b,c,d,e,A,7,a[12]),e=h(e,b,c,d,B,12,a[13]),d=h(d,e,b,c,C,17,a[14]),c=h(c,d,e,b,D,22,a[15]),b=k(b,c,d,e,p,5,a[16]),e=k(e,b,c,d,u,9,a[17]),d=k(d,e,b,c,z,14,a[18]),c=k(c,d,e,b,j,20,a[19]),b=k(b,c,d,e,t,5,a[20]),e=k(e,b,c,d,y,9,a[21]),d=k(d,e,b,c,D,14,a[22]),c=k(c,d,e,b,s,20,a[23]),b=k(b,c,d,e,x,5,a[24]),e=k(e,b,c,d,C,9,a[25]),d=k(d,e,b,c,r,14,a[26]),c=k(c,d,e,b,w,20,a[27]),b=k(b,c,d,e,B,5,a[28]),e=k(e,b, -c,d,q,9,a[29]),d=k(d,e,b,c,v,14,a[30]),c=k(c,d,e,b,A,20,a[31]),b=l(b,c,d,e,t,4,a[32]),e=l(e,b,c,d,w,11,a[33]),d=l(d,e,b,c,z,16,a[34]),c=l(c,d,e,b,C,23,a[35]),b=l(b,c,d,e,p,4,a[36]),e=l(e,b,c,d,s,11,a[37]),d=l(d,e,b,c,v,16,a[38]),c=l(c,d,e,b,y,23,a[39]),b=l(b,c,d,e,B,4,a[40]),e=l(e,b,c,d,j,11,a[41]),d=l(d,e,b,c,r,16,a[42]),c=l(c,d,e,b,u,23,a[43]),b=l(b,c,d,e,x,4,a[44]),e=l(e,b,c,d,A,11,a[45]),d=l(d,e,b,c,D,16,a[46]),c=l(c,d,e,b,q,23,a[47]),b=n(b,c,d,e,j,6,a[48]),e=n(e,b,c,d,v,10,a[49]),d=n(d,e,b,c, -C,15,a[50]),c=n(c,d,e,b,t,21,a[51]),b=n(b,c,d,e,A,6,a[52]),e=n(e,b,c,d,r,10,a[53]),d=n(d,e,b,c,y,15,a[54]),c=n(c,d,e,b,p,21,a[55]),b=n(b,c,d,e,w,6,a[56]),e=n(e,b,c,d,D,10,a[57]),d=n(d,e,b,c,u,15,a[58]),c=n(c,d,e,b,B,21,a[59]),b=n(b,c,d,e,s,6,a[60]),e=n(e,b,c,d,z,10,a[61]),d=n(d,e,b,c,q,15,a[62]),c=n(c,d,e,b,x,21,a[63]);g[0]=g[0]+b|0;g[1]=g[1]+c|0;g[2]=g[2]+d|0;g[3]=g[3]+e|0},_doFinalize:function(){var a=this._data,f=a.words,g=8*this._nDataBytes,j=8*a.sigBytes;f[j>>>5]|=128<<24-j%32;var h=E.floor(g/ -4294967296);f[(j+64>>>9<<4)+15]=(h<<8|h>>>24)&16711935|(h<<24|h>>>8)&4278255360;f[(j+64>>>9<<4)+14]=(g<<8|g>>>24)&16711935|(g<<24|g>>>8)&4278255360;a.sigBytes=4*(f.length+1);this._process();a=this._hash;f=a.words;for(g=0;4>g;g++)j=f[g],f[g]=(j<<8|j>>>24)&16711935|(j<<24|j>>>8)&4278255360;return a},clone:function(){var a=s.clone.call(this);a._hash=this._hash.clone();return a}});r.MD5=s._createHelper(q);r.HmacMD5=s._createHmacHelper(q)})(Math); - -/* -CryptoJS v3.1.2 sha1-min.js -code.google.com/p/crypto-js -(c) 2009-2013 by Jeff Mott. All rights reserved. -code.google.com/p/crypto-js/wiki/License -*/ -(function(){var k=CryptoJS,b=k.lib,m=b.WordArray,l=b.Hasher,d=[],b=k.algo.SHA1=l.extend({_doReset:function(){this._hash=new m.init([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(n,p){for(var a=this._hash.words,e=a[0],f=a[1],h=a[2],j=a[3],b=a[4],c=0;80>c;c++){if(16>c)d[c]=n[p+c]|0;else{var g=d[c-3]^d[c-8]^d[c-14]^d[c-16];d[c]=g<<1|g>>>31}g=(e<<5|e>>>27)+b+d[c];g=20>c?g+((f&h|~f&j)+1518500249):40>c?g+((f^h^j)+1859775393):60>c?g+((f&h|f&j|h&j)-1894007588):g+((f^h^ -j)-899497514);b=j;j=h;h=f<<30|f>>>2;f=e;e=g}a[0]=a[0]+e|0;a[1]=a[1]+f|0;a[2]=a[2]+h|0;a[3]=a[3]+j|0;a[4]=a[4]+b|0},_doFinalize:function(){var b=this._data,d=b.words,a=8*this._nDataBytes,e=8*b.sigBytes;d[e>>>5]|=128<<24-e%32;d[(e+64>>>9<<4)+14]=Math.floor(a/4294967296);d[(e+64>>>9<<4)+15]=a;b.sigBytes=4*d.length;this._process();return this._hash},clone:function(){var b=l.clone.call(this);b._hash=this._hash.clone();return b}});k.SHA1=l._createHelper(b);k.HmacSHA1=l._createHmacHelper(b)})(); - -/* -CryptoJS v3.1.2 sha256-min.js -code.google.com/p/crypto-js -(c) 2009-2013 by Jeff Mott. All rights reserved. -code.google.com/p/crypto-js/wiki/License -*/ -(function(k){for(var g=CryptoJS,h=g.lib,v=h.WordArray,j=h.Hasher,h=g.algo,s=[],t=[],u=function(q){return 4294967296*(q-(q|0))|0},l=2,b=0;64>b;){var d;a:{d=l;for(var w=k.sqrt(d),r=2;r<=w;r++)if(!(d%r)){d=!1;break a}d=!0}d&&(8>b&&(s[b]=u(k.pow(l,0.5))),t[b]=u(k.pow(l,1/3)),b++);l++}var n=[],h=h.SHA256=j.extend({_doReset:function(){this._hash=new v.init(s.slice(0))},_doProcessBlock:function(q,h){for(var a=this._hash.words,c=a[0],d=a[1],b=a[2],k=a[3],f=a[4],g=a[5],j=a[6],l=a[7],e=0;64>e;e++){if(16>e)n[e]= -q[h+e]|0;else{var m=n[e-15],p=n[e-2];n[e]=((m<<25|m>>>7)^(m<<14|m>>>18)^m>>>3)+n[e-7]+((p<<15|p>>>17)^(p<<13|p>>>19)^p>>>10)+n[e-16]}m=l+((f<<26|f>>>6)^(f<<21|f>>>11)^(f<<7|f>>>25))+(f&g^~f&j)+t[e]+n[e];p=((c<<30|c>>>2)^(c<<19|c>>>13)^(c<<10|c>>>22))+(c&d^c&b^d&b);l=j;j=g;g=f;f=k+m|0;k=b;b=d;d=c;c=m+p|0}a[0]=a[0]+c|0;a[1]=a[1]+d|0;a[2]=a[2]+b|0;a[3]=a[3]+k|0;a[4]=a[4]+f|0;a[5]=a[5]+g|0;a[6]=a[6]+j|0;a[7]=a[7]+l|0},_doFinalize:function(){var d=this._data,b=d.words,a=8*this._nDataBytes,c=8*d.sigBytes; -b[c>>>5]|=128<<24-c%32;b[(c+64>>>9<<4)+14]=k.floor(a/4294967296);b[(c+64>>>9<<4)+15]=a;d.sigBytes=4*b.length;this._process();return this._hash},clone:function(){var b=j.clone.call(this);b._hash=this._hash.clone();return b}});g.SHA256=j._createHelper(h);g.HmacSHA256=j._createHmacHelper(h)})(Math); - -/* -CryptoJS v3.1.2 sha224-min.js -code.google.com/p/crypto-js -(c) 2009-2013 by Jeff Mott. All rights reserved. -code.google.com/p/crypto-js/wiki/License -*/ -(function(){var b=CryptoJS,d=b.lib.WordArray,a=b.algo,c=a.SHA256,a=a.SHA224=c.extend({_doReset:function(){this._hash=new d.init([3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428])},_doFinalize:function(){var a=c._doFinalize.call(this);a.sigBytes-=4;return a}});b.SHA224=c._createHelper(a);b.HmacSHA224=c._createHmacHelper(a)})(); - -/* -CryptoJS v3.1.2 sha512-min.js -code.google.com/p/crypto-js -(c) 2009-2013 by Jeff Mott. All rights reserved. -code.google.com/p/crypto-js/wiki/License -*/ -(function(){function a(){return d.create.apply(d,arguments)}for(var n=CryptoJS,r=n.lib.Hasher,e=n.x64,d=e.Word,T=e.WordArray,e=n.algo,ea=[a(1116352408,3609767458),a(1899447441,602891725),a(3049323471,3964484399),a(3921009573,2173295548),a(961987163,4081628472),a(1508970993,3053834265),a(2453635748,2937671579),a(2870763221,3664609560),a(3624381080,2734883394),a(310598401,1164996542),a(607225278,1323610764),a(1426881987,3590304994),a(1925078388,4068182383),a(2162078206,991336113),a(2614888103,633803317), -a(3248222580,3479774868),a(3835390401,2666613458),a(4022224774,944711139),a(264347078,2341262773),a(604807628,2007800933),a(770255983,1495990901),a(1249150122,1856431235),a(1555081692,3175218132),a(1996064986,2198950837),a(2554220882,3999719339),a(2821834349,766784016),a(2952996808,2566594879),a(3210313671,3203337956),a(3336571891,1034457026),a(3584528711,2466948901),a(113926993,3758326383),a(338241895,168717936),a(666307205,1188179964),a(773529912,1546045734),a(1294757372,1522805485),a(1396182291, -2643833823),a(1695183700,2343527390),a(1986661051,1014477480),a(2177026350,1206759142),a(2456956037,344077627),a(2730485921,1290863460),a(2820302411,3158454273),a(3259730800,3505952657),a(3345764771,106217008),a(3516065817,3606008344),a(3600352804,1432725776),a(4094571909,1467031594),a(275423344,851169720),a(430227734,3100823752),a(506948616,1363258195),a(659060556,3750685593),a(883997877,3785050280),a(958139571,3318307427),a(1322822218,3812723403),a(1537002063,2003034995),a(1747873779,3602036899), -a(1955562222,1575990012),a(2024104815,1125592928),a(2227730452,2716904306),a(2361852424,442776044),a(2428436474,593698344),a(2756734187,3733110249),a(3204031479,2999351573),a(3329325298,3815920427),a(3391569614,3928383900),a(3515267271,566280711),a(3940187606,3454069534),a(4118630271,4000239992),a(116418474,1914138554),a(174292421,2731055270),a(289380356,3203993006),a(460393269,320620315),a(685471733,587496836),a(852142971,1086792851),a(1017036298,365543100),a(1126000580,2618297676),a(1288033470, -3409855158),a(1501505948,4234509866),a(1607167915,987167468),a(1816402316,1246189591)],v=[],w=0;80>w;w++)v[w]=a();e=e.SHA512=r.extend({_doReset:function(){this._hash=new T.init([new d.init(1779033703,4089235720),new d.init(3144134277,2227873595),new d.init(1013904242,4271175723),new d.init(2773480762,1595750129),new d.init(1359893119,2917565137),new d.init(2600822924,725511199),new d.init(528734635,4215389547),new d.init(1541459225,327033209)])},_doProcessBlock:function(a,d){for(var f=this._hash.words, -F=f[0],e=f[1],n=f[2],r=f[3],G=f[4],H=f[5],I=f[6],f=f[7],w=F.high,J=F.low,X=e.high,K=e.low,Y=n.high,L=n.low,Z=r.high,M=r.low,$=G.high,N=G.low,aa=H.high,O=H.low,ba=I.high,P=I.low,ca=f.high,Q=f.low,k=w,g=J,z=X,x=K,A=Y,y=L,U=Z,B=M,l=$,h=N,R=aa,C=O,S=ba,D=P,V=ca,E=Q,m=0;80>m;m++){var s=v[m];if(16>m)var j=s.high=a[d+2*m]|0,b=s.low=a[d+2*m+1]|0;else{var j=v[m-15],b=j.high,p=j.low,j=(b>>>1|p<<31)^(b>>>8|p<<24)^b>>>7,p=(p>>>1|b<<31)^(p>>>8|b<<24)^(p>>>7|b<<25),u=v[m-2],b=u.high,c=u.low,u=(b>>>19|c<<13)^(b<< -3|c>>>29)^b>>>6,c=(c>>>19|b<<13)^(c<<3|b>>>29)^(c>>>6|b<<26),b=v[m-7],W=b.high,t=v[m-16],q=t.high,t=t.low,b=p+b.low,j=j+W+(b>>>0>>0?1:0),b=b+c,j=j+u+(b>>>0>>0?1:0),b=b+t,j=j+q+(b>>>0>>0?1:0);s.high=j;s.low=b}var W=l&R^~l&S,t=h&C^~h&D,s=k&z^k&A^z&A,T=g&x^g&y^x&y,p=(k>>>28|g<<4)^(k<<30|g>>>2)^(k<<25|g>>>7),u=(g>>>28|k<<4)^(g<<30|k>>>2)^(g<<25|k>>>7),c=ea[m],fa=c.high,da=c.low,c=E+((h>>>14|l<<18)^(h>>>18|l<<14)^(h<<23|l>>>9)),q=V+((l>>>14|h<<18)^(l>>>18|h<<14)^(l<<23|h>>>9))+(c>>>0>>0?1: -0),c=c+t,q=q+W+(c>>>0>>0?1:0),c=c+da,q=q+fa+(c>>>0>>0?1:0),c=c+b,q=q+j+(c>>>0>>0?1:0),b=u+T,s=p+s+(b>>>0>>0?1:0),V=S,E=D,S=R,D=C,R=l,C=h,h=B+c|0,l=U+q+(h>>>0>>0?1:0)|0,U=A,B=y,A=z,y=x,z=k,x=g,g=c+b|0,k=q+s+(g>>>0>>0?1:0)|0}J=F.low=J+g;F.high=w+k+(J>>>0>>0?1:0);K=e.low=K+x;e.high=X+z+(K>>>0>>0?1:0);L=n.low=L+y;n.high=Y+A+(L>>>0>>0?1:0);M=r.low=M+B;r.high=Z+U+(M>>>0>>0?1:0);N=G.low=N+h;G.high=$+l+(N>>>0>>0?1:0);O=H.low=O+C;H.high=aa+R+(O>>>0>>0?1:0);P=I.low=P+D; -I.high=ba+S+(P>>>0>>0?1:0);Q=f.low=Q+E;f.high=ca+V+(Q>>>0>>0?1:0)},_doFinalize:function(){var a=this._data,d=a.words,f=8*this._nDataBytes,e=8*a.sigBytes;d[e>>>5]|=128<<24-e%32;d[(e+128>>>10<<5)+30]=Math.floor(f/4294967296);d[(e+128>>>10<<5)+31]=f;a.sigBytes=4*d.length;this._process();return this._hash.toX32()},clone:function(){var a=r.clone.call(this);a._hash=this._hash.clone();return a},blockSize:32});n.SHA512=r._createHelper(e);n.HmacSHA512=r._createHmacHelper(e)})(); - -/* -CryptoJS v3.1.2 sha384-min.js -code.google.com/p/crypto-js -(c) 2009-2013 by Jeff Mott. All rights reserved. -code.google.com/p/crypto-js/wiki/License -*/ -(function(){var c=CryptoJS,a=c.x64,b=a.Word,e=a.WordArray,a=c.algo,d=a.SHA512,a=a.SHA384=d.extend({_doReset:function(){this._hash=new e.init([new b.init(3418070365,3238371032),new b.init(1654270250,914150663),new b.init(2438529370,812702999),new b.init(355462360,4144912697),new b.init(1731405415,4290775857),new b.init(2394180231,1750603025),new b.init(3675008525,1694076839),new b.init(1203062813,3204075428)])},_doFinalize:function(){var a=d._doFinalize.call(this);a.sigBytes-=16;return a}});c.SHA384= -d._createHelper(a);c.HmacSHA384=d._createHmacHelper(a)})(); - -/* -CryptoJS v3.1.2 ripemd160-min.js -code.google.com/p/crypto-js -(c) 2009-2013 by Jeff Mott. All rights reserved. -code.google.com/p/crypto-js/wiki/License -*/ -/* - -(c) 2012 by Cedric Mesnil. All rights reserved. - -Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - - - Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - - 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 THE COPYRIGHT HOLDERS AND CONTRIBUTORS "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 THE COPYRIGHT HOLDER 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. -*/ -(function(){var q=CryptoJS,d=q.lib,n=d.WordArray,p=d.Hasher,d=q.algo,x=n.create([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13]),y=n.create([5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11]),z=n.create([11,14,15,12, -5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6]),A=n.create([8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11]),B=n.create([0,1518500249,1859775393,2400959708,2840853838]),C=n.create([1352829926,1548603684,1836072691, -2053994217,0]),d=d.RIPEMD160=p.extend({_doReset:function(){this._hash=n.create([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(e,v){for(var b=0;16>b;b++){var c=v+b,f=e[c];e[c]=(f<<8|f>>>24)&16711935|(f<<24|f>>>8)&4278255360}var c=this._hash.words,f=B.words,d=C.words,n=x.words,q=y.words,p=z.words,w=A.words,t,g,h,j,r,u,k,l,m,s;u=t=c[0];k=g=c[1];l=h=c[2];m=j=c[3];s=r=c[4];for(var a,b=0;80>b;b+=1)a=t+e[v+n[b]]|0,a=16>b?a+((g^h^j)+f[0]):32>b?a+((g&h|~g&j)+f[1]):48>b? -a+(((g|~h)^j)+f[2]):64>b?a+((g&j|h&~j)+f[3]):a+((g^(h|~j))+f[4]),a|=0,a=a<>>32-p[b],a=a+r|0,t=r,r=j,j=h<<10|h>>>22,h=g,g=a,a=u+e[v+q[b]]|0,a=16>b?a+((k^(l|~m))+d[0]):32>b?a+((k&m|l&~m)+d[1]):48>b?a+(((k|~l)^m)+d[2]):64>b?a+((k&l|~k&m)+d[3]):a+((k^l^m)+d[4]),a|=0,a=a<>>32-w[b],a=a+s|0,u=s,s=m,m=l<<10|l>>>22,l=k,k=a;a=c[1]+h+m|0;c[1]=c[2]+j+s|0;c[2]=c[3]+r+u|0;c[3]=c[4]+t+k|0;c[4]=c[0]+g+l|0;c[0]=a},_doFinalize:function(){var e=this._data,d=e.words,b=8*this._nDataBytes,c=8*e.sigBytes; -d[c>>>5]|=128<<24-c%32;d[(c+64>>>9<<4)+14]=(b<<8|b>>>24)&16711935|(b<<24|b>>>8)&4278255360;e.sigBytes=4*(d.length+1);this._process();e=this._hash;d=e.words;for(b=0;5>b;b++)c=d[b],d[b]=(c<<8|c>>>24)&16711935|(c<<24|c>>>8)&4278255360;return e},clone:function(){var d=p.clone.call(this);d._hash=this._hash.clone();return d}});q.RIPEMD160=p._createHelper(d);q.HmacRIPEMD160=p._createHmacHelper(d)})(Math); - -/* -CryptoJS v3.1.2 hmac.js -code.google.com/p/crypto-js -(c) 2009-2013 by Jeff Mott. All rights reserved. -code.google.com/p/crypto-js/wiki/License -*/ -(function(){var c=CryptoJS,k=c.enc.Utf8;c.algo.HMAC=c.lib.Base.extend({init:function(a,b){a=this._hasher=new a.init;"string"==typeof b&&(b=k.parse(b));var c=a.blockSize,e=4*c;b.sigBytes>e&&(b=a.finalize(b));b.clamp();for(var f=this._oKey=b.clone(),g=this._iKey=b.clone(),h=f.words,j=g.words,d=0;d>6)+b64map.charAt(e&63)}if(b+1==d.length){e=parseInt(d.substring(b,b+1),16);a+=b64map.charAt(e<<2)}else{if(b+2==d.length){e=parseInt(d.substring(b,b+2),16);a+=b64map.charAt(e>>2)+b64map.charAt((e&3)<<4)}}if(b64pad){while((a.length&3)>0){a+=b64pad}}return a}function b64tohex(f){var d="";var e;var b=0;var c;var a;for(e=0;e>2);c=a&3;b=1}else{if(b==1){d+=int2char((c<<2)|(a>>4));c=a&15;b=2}else{if(b==2){d+=int2char(c);d+=int2char(a>>2);c=a&3;b=3}else{d+=int2char((c<<2)|(a>>4));d+=int2char(a&15);b=0}}}}if(b==1){d+=int2char(c<<2)}return d}function b64toBA(e){var d=b64tohex(e);var c;var b=new Array();for(c=0;2*c=0){var d=a*this[f++]+b[e]+h;h=Math.floor(d/67108864);b[e++]=d&67108863}return h}function am2(f,q,r,e,o,a){var k=q&32767,p=q>>15;while(--a>=0){var d=this[f]&32767;var g=this[f++]>>15;var b=p*d+g*k;d=k*d+((b&32767)<<15)+r[e]+(o&1073741823);o=(d>>>30)+(b>>>15)+p*g+(o>>>30);r[e++]=d&1073741823}return o}function am3(f,q,r,e,o,a){var k=q&16383,p=q>>14;while(--a>=0){var d=this[f]&16383;var g=this[f++]>>14;var b=p*d+g*k;d=k*d+((b&16383)<<14)+r[e]+o;o=(d>>28)+(b>>14)+p*g;r[e++]=d&268435455}return o}if(j_lm&&(navigator.appName=="Microsoft Internet Explorer")){BigInteger.prototype.am=am2;dbits=30}else{if(j_lm&&(navigator.appName!="Netscape")){BigInteger.prototype.am=am1;dbits=26}else{BigInteger.prototype.am=am3;dbits=28}}BigInteger.prototype.DB=dbits;BigInteger.prototype.DM=((1<=0;--a){b[a]=this[a]}b.t=this.t;b.s=this.s}function bnpFromInt(a){this.t=1;this.s=(a<0)?-1:0;if(a>0){this[0]=a}else{if(a<-1){this[0]=a+this.DV}else{this.t=0}}}function nbv(a){var b=nbi();b.fromInt(a);return b}function bnpFromString(h,c){var e;if(c==16){e=4}else{if(c==8){e=3}else{if(c==256){e=8}else{if(c==2){e=1}else{if(c==32){e=5}else{if(c==4){e=2}else{this.fromRadix(h,c);return}}}}}}this.t=0;this.s=0;var g=h.length,d=false,f=0;while(--g>=0){var a=(e==8)?h[g]&255:intAt(h,g);if(a<0){if(h.charAt(g)=="-"){d=true}continue}d=false;if(f==0){this[this.t++]=a}else{if(f+e>this.DB){this[this.t-1]|=(a&((1<<(this.DB-f))-1))<>(this.DB-f))}else{this[this.t-1]|=a<=this.DB){f-=this.DB}}if(e==8&&(h[0]&128)!=0){this.s=-1;if(f>0){this[this.t-1]|=((1<<(this.DB-f))-1)<0&&this[this.t-1]==a){--this.t}}function bnToString(c){if(this.s<0){return"-"+this.negate().toString(c)}var e;if(c==16){e=4}else{if(c==8){e=3}else{if(c==2){e=1}else{if(c==32){e=5}else{if(c==4){e=2}else{return this.toRadix(c)}}}}}var g=(1<0){if(j>j)>0){a=true;h=int2char(l)}while(f>=0){if(j>(j+=this.DB-e)}else{l=(this[f]>>(j-=e))&g;if(j<=0){j+=this.DB;--f}}if(l>0){a=true}if(a){h+=int2char(l)}}}return a?h:"0"}function bnNegate(){var a=nbi();BigInteger.ZERO.subTo(this,a);return a}function bnAbs(){return(this.s<0)?this.negate():this}function bnCompareTo(b){var d=this.s-b.s;if(d!=0){return d}var c=this.t;d=c-b.t;if(d!=0){return(this.s<0)?-d:d}while(--c>=0){if((d=this[c]-b[c])!=0){return d}}return 0}function nbits(a){var c=1,b;if((b=a>>>16)!=0){a=b;c+=16}if((b=a>>8)!=0){a=b;c+=8}if((b=a>>4)!=0){a=b;c+=4}if((b=a>>2)!=0){a=b;c+=2}if((b=a>>1)!=0){a=b;c+=1}return c}function bnBitLength(){if(this.t<=0){return 0}return this.DB*(this.t-1)+nbits(this[this.t-1]^(this.s&this.DM))}function bnpDLShiftTo(c,b){var a;for(a=this.t-1;a>=0;--a){b[a+c]=this[a]}for(a=c-1;a>=0;--a){b[a]=0}b.t=this.t+c;b.s=this.s}function bnpDRShiftTo(c,b){for(var a=c;a=0;--d){e[d+f+1]=(this[d]>>a)|h;h=(this[d]&g)<=0;--d){e[d]=0}e[f]=h;e.t=this.t+f+1;e.s=this.s;e.clamp()}function bnpRShiftTo(g,d){d.s=this.s;var e=Math.floor(g/this.DB);if(e>=this.t){d.t=0;return}var b=g%this.DB;var a=this.DB-b;var f=(1<>b;for(var c=e+1;c>b}if(b>0){d[this.t-e-1]|=(this.s&f)<>=this.DB}if(d.t>=this.DB}g+=this.s}else{g+=this.s;while(e>=this.DB}g-=d.s}f.s=(g<0)?-1:0;if(g<-1){f[e++]=this.DV+g}else{if(g>0){f[e++]=g}}f.t=e;f.clamp()}function bnpMultiplyTo(c,e){var b=this.abs(),f=c.abs();var d=b.t;e.t=d+f.t;while(--d>=0){e[d]=0}for(d=0;d=0){d[b]=0}for(b=0;b=a.DV){d[b+a.t]-=a.DV;d[b+a.t+1]=1}}if(d.t>0){d[d.t-1]+=a.am(b,a[b],d,2*b,0,1)}d.s=0;d.clamp()}function bnpDivRemTo(n,h,g){var w=n.abs();if(w.t<=0){return}var k=this.abs();if(k.t0){w.lShiftTo(v,d);k.lShiftTo(v,g)}else{w.copyTo(d);k.copyTo(g)}var p=d.t;var b=d[p-1];if(b==0){return}var o=b*(1<1)?d[p-2]>>this.F2:0);var A=this.FV/o,z=(1<=0){g[g.t++]=1;g.subTo(f,g)}BigInteger.ONE.dlShiftTo(p,f);f.subTo(d,d);while(d.t=0){var c=(g[--u]==b)?this.DM:Math.floor(g[u]*A+(g[u-1]+x)*z);if((g[u]+=d.am(0,c,g,s,0,p))0){g.rShiftTo(v,g)}if(a<0){BigInteger.ZERO.subTo(g,g)}}function bnMod(b){var c=nbi();this.abs().divRemTo(b,null,c);if(this.s<0&&c.compareTo(BigInteger.ZERO)>0){b.subTo(c,c)}return c}function Classic(a){this.m=a}function cConvert(a){if(a.s<0||a.compareTo(this.m)>=0){return a.mod(this.m)}else{return a}}function cRevert(a){return a}function cReduce(a){a.divRemTo(this.m,null,a)}function cMulTo(a,c,b){a.multiplyTo(c,b);this.reduce(b)}function cSqrTo(a,b){a.squareTo(b);this.reduce(b)}Classic.prototype.convert=cConvert;Classic.prototype.revert=cRevert;Classic.prototype.reduce=cReduce;Classic.prototype.mulTo=cMulTo;Classic.prototype.sqrTo=cSqrTo;function bnpInvDigit(){if(this.t<1){return 0}var a=this[0];if((a&1)==0){return 0}var b=a&3;b=(b*(2-(a&15)*b))&15;b=(b*(2-(a&255)*b))&255;b=(b*(2-(((a&65535)*b)&65535)))&65535;b=(b*(2-a*b%this.DV))%this.DV;return(b>0)?this.DV-b:-b}function Montgomery(a){this.m=a;this.mp=a.invDigit();this.mpl=this.mp&32767;this.mph=this.mp>>15;this.um=(1<<(a.DB-15))-1;this.mt2=2*a.t}function montConvert(a){var b=nbi();a.abs().dlShiftTo(this.m.t,b);b.divRemTo(this.m,null,b);if(a.s<0&&b.compareTo(BigInteger.ZERO)>0){this.m.subTo(b,b)}return b}function montRevert(a){var b=nbi();a.copyTo(b);this.reduce(b);return b}function montReduce(a){while(a.t<=this.mt2){a[a.t++]=0}for(var c=0;c>15)*this.mpl)&this.um)<<15))&a.DM;b=c+this.m.t;a[b]+=this.m.am(0,d,a,c,0,this.m.t);while(a[b]>=a.DV){a[b]-=a.DV;a[++b]++}}a.clamp();a.drShiftTo(this.m.t,a);if(a.compareTo(this.m)>=0){a.subTo(this.m,a)}}function montSqrTo(a,b){a.squareTo(b);this.reduce(b)}function montMulTo(a,c,b){a.multiplyTo(c,b);this.reduce(b)}Montgomery.prototype.convert=montConvert;Montgomery.prototype.revert=montRevert;Montgomery.prototype.reduce=montReduce;Montgomery.prototype.mulTo=montMulTo;Montgomery.prototype.sqrTo=montSqrTo;function bnpIsEven(){return((this.t>0)?(this[0]&1):this.s)==0}function bnpExp(h,j){if(h>4294967295||h<1){return BigInteger.ONE}var f=nbi(),a=nbi(),d=j.convert(this),c=nbits(h)-1;d.copyTo(f);while(--c>=0){j.sqrTo(f,a);if((h&(1<0){j.mulTo(a,d,f)}else{var b=f;f=a;a=b}}return j.revert(f)}function bnModPowInt(b,a){var c;if(b<256||a.isEven()){c=new Classic(a)}else{c=new Montgomery(a)}return this.exp(b,c)}BigInteger.prototype.copyTo=bnpCopyTo;BigInteger.prototype.fromInt=bnpFromInt;BigInteger.prototype.fromString=bnpFromString;BigInteger.prototype.clamp=bnpClamp;BigInteger.prototype.dlShiftTo=bnpDLShiftTo;BigInteger.prototype.drShiftTo=bnpDRShiftTo;BigInteger.prototype.lShiftTo=bnpLShiftTo;BigInteger.prototype.rShiftTo=bnpRShiftTo;BigInteger.prototype.subTo=bnpSubTo;BigInteger.prototype.multiplyTo=bnpMultiplyTo;BigInteger.prototype.squareTo=bnpSquareTo;BigInteger.prototype.divRemTo=bnpDivRemTo;BigInteger.prototype.invDigit=bnpInvDigit;BigInteger.prototype.isEven=bnpIsEven;BigInteger.prototype.exp=bnpExp;BigInteger.prototype.toString=bnToString;BigInteger.prototype.negate=bnNegate;BigInteger.prototype.abs=bnAbs;BigInteger.prototype.compareTo=bnCompareTo;BigInteger.prototype.bitLength=bnBitLength;BigInteger.prototype.mod=bnMod;BigInteger.prototype.modPowInt=bnModPowInt;BigInteger.ZERO=nbv(0);BigInteger.ONE=nbv(1); -/*! (c) Tom Wu | http://www-cs-students.stanford.edu/~tjw/jsbn/ - */ -function bnClone(){var a=nbi();this.copyTo(a);return a}function bnIntValue(){if(this.s<0){if(this.t==1){return this[0]-this.DV}else{if(this.t==0){return -1}}}else{if(this.t==1){return this[0]}else{if(this.t==0){return 0}}}return((this[1]&((1<<(32-this.DB))-1))<>24}function bnShortValue(){return(this.t==0)?this.s:(this[0]<<16)>>16}function bnpChunkSize(a){return Math.floor(Math.LN2*this.DB/Math.log(a))}function bnSigNum(){if(this.s<0){return -1}else{if(this.t<=0||(this.t==1&&this[0]<=0)){return 0}else{return 1}}}function bnpToRadix(c){if(c==null){c=10}if(this.signum()==0||c<2||c>36){return"0"}var f=this.chunkSize(c);var e=Math.pow(c,f);var i=nbv(e),j=nbi(),h=nbi(),g="";this.divRemTo(i,j,h);while(j.signum()>0){g=(e+h.intValue()).toString(c).substr(1)+g;j.divRemTo(i,j,h)}return h.intValue().toString(c)+g}function bnpFromRadix(m,h){this.fromInt(0);if(h==null){h=10}var f=this.chunkSize(h);var g=Math.pow(h,f),e=false,a=0,l=0;for(var c=0;c=f){this.dMultiply(g);this.dAddOffset(l,0);a=0;l=0}}if(a>0){this.dMultiply(Math.pow(h,a));this.dAddOffset(l,0)}if(e){BigInteger.ZERO.subTo(this,this)}}function bnpFromNumber(f,e,h){if("number"==typeof e){if(f<2){this.fromInt(1)}else{this.fromNumber(f,h);if(!this.testBit(f-1)){this.bitwiseTo(BigInteger.ONE.shiftLeft(f-1),op_or,this)}if(this.isEven()){this.dAddOffset(1,0)}while(!this.isProbablePrime(e)){this.dAddOffset(2,0);if(this.bitLength()>f){this.subTo(BigInteger.ONE.shiftLeft(f-1),this)}}}}else{var d=new Array(),g=f&7;d.length=(f>>3)+1;e.nextBytes(d);if(g>0){d[0]&=((1<0){if(e>e)!=(this.s&this.DM)>>e){c[a++]=f|(this.s<<(this.DB-e))}while(b>=0){if(e<8){f=(this[b]&((1<>(e+=this.DB-8)}else{f=(this[b]>>(e-=8))&255;if(e<=0){e+=this.DB;--b}}if((f&128)!=0){f|=-256}if(a==0&&(this.s&128)!=(f&128)){++a}if(a>0||f!=this.s){c[a++]=f}}}return c}function bnEquals(b){return(this.compareTo(b)==0)}function bnMin(b){return(this.compareTo(b)<0)?this:b}function bnMax(b){return(this.compareTo(b)>0)?this:b}function bnpBitwiseTo(c,h,e){var d,g,b=Math.min(c.t,this.t);for(d=0;d>=16;b+=16}if((a&255)==0){a>>=8;b+=8}if((a&15)==0){a>>=4;b+=4}if((a&3)==0){a>>=2;b+=2}if((a&1)==0){++b}return b}function bnGetLowestSetBit(){for(var a=0;a=this.t){return(this.s!=0)}return((this[a]&(1<<(b%this.DB)))!=0)}function bnpChangeBit(c,b){var a=BigInteger.ONE.shiftLeft(c);this.bitwiseTo(a,b,a);return a}function bnSetBit(a){return this.changeBit(a,op_or)}function bnClearBit(a){return this.changeBit(a,op_andnot)}function bnFlipBit(a){return this.changeBit(a,op_xor)}function bnpAddTo(d,f){var e=0,g=0,b=Math.min(d.t,this.t);while(e>=this.DB}if(d.t>=this.DB}g+=this.s}else{g+=this.s;while(e>=this.DB}g+=d.s}f.s=(g<0)?-1:0;if(g>0){f[e++]=g}else{if(g<-1){f[e++]=this.DV+g}}f.t=e;f.clamp()}function bnAdd(b){var c=nbi();this.addTo(b,c);return c}function bnSubtract(b){var c=nbi();this.subTo(b,c);return c}function bnMultiply(b){var c=nbi();this.multiplyTo(b,c);return c}function bnSquare(){var a=nbi();this.squareTo(a);return a}function bnDivide(b){var c=nbi();this.divRemTo(b,c,null);return c}function bnRemainder(b){var c=nbi();this.divRemTo(b,null,c);return c}function bnDivideAndRemainder(b){var d=nbi(),c=nbi();this.divRemTo(b,d,c);return new Array(d,c)}function bnpDMultiply(a){this[this.t]=this.am(0,a-1,this,0,0,this.t);++this.t;this.clamp()}function bnpDAddOffset(b,a){if(b==0){return}while(this.t<=a){this[this.t++]=0}this[a]+=b;while(this[a]>=this.DV){this[a]-=this.DV;if(++a>=this.t){this[this.t++]=0}++this[a]}}function NullExp(){}function nNop(a){return a}function nMulTo(a,c,b){a.multiplyTo(c,b)}function nSqrTo(a,b){a.squareTo(b)}NullExp.prototype.convert=nNop;NullExp.prototype.revert=nNop;NullExp.prototype.mulTo=nMulTo;NullExp.prototype.sqrTo=nSqrTo;function bnPow(a){return this.exp(a,new NullExp())}function bnpMultiplyLowerTo(b,f,e){var d=Math.min(this.t+b.t,f);e.s=0;e.t=d;while(d>0){e[--d]=0}var c;for(c=e.t-this.t;d=0){d[c]=0}for(c=Math.max(e-this.t,0);c2*this.m.t){return a.mod(this.m)}else{if(a.compareTo(this.m)<0){return a}else{var b=nbi();a.copyTo(b);this.reduce(b);return b}}}function barrettRevert(a){return a}function barrettReduce(a){a.drShiftTo(this.m.t-1,this.r2);if(a.t>this.m.t+1){a.t=this.m.t+1;a.clamp()}this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3);this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);while(a.compareTo(this.r2)<0){a.dAddOffset(1,this.m.t+1)}a.subTo(this.r2,a);while(a.compareTo(this.m)>=0){a.subTo(this.m,a)}}function barrettSqrTo(a,b){a.squareTo(b);this.reduce(b)}function barrettMulTo(a,c,b){a.multiplyTo(c,b);this.reduce(b)}Barrett.prototype.convert=barrettConvert;Barrett.prototype.revert=barrettRevert;Barrett.prototype.reduce=barrettReduce;Barrett.prototype.mulTo=barrettMulTo;Barrett.prototype.sqrTo=barrettSqrTo;function bnModPow(q,f){var o=q.bitLength(),h,b=nbv(1),v;if(o<=0){return b}else{if(o<18){h=1}else{if(o<48){h=3}else{if(o<144){h=4}else{if(o<768){h=5}else{h=6}}}}}if(o<8){v=new Classic(f)}else{if(f.isEven()){v=new Barrett(f)}else{v=new Montgomery(f)}}var p=new Array(),d=3,s=h-1,a=(1<1){var A=nbi();v.sqrTo(p[1],A);while(d<=a){p[d]=nbi();v.mulTo(A,p[d-2],p[d]);d+=2}}var l=q.t-1,x,u=true,c=nbi(),y;o=nbits(q[l])-1;while(l>=0){if(o>=s){x=(q[l]>>(o-s))&a}else{x=(q[l]&((1<<(o+1))-1))<<(s-o);if(l>0){x|=q[l-1]>>(this.DB+o-s)}}d=h;while((x&1)==0){x>>=1;--d}if((o-=d)<0){o+=this.DB;--l}if(u){p[x].copyTo(b);u=false}else{while(d>1){v.sqrTo(b,c);v.sqrTo(c,b);d-=2}if(d>0){v.sqrTo(b,c)}else{y=b;b=c;c=y}v.mulTo(c,p[x],b)}while(l>=0&&(q[l]&(1<0){b.rShiftTo(f,b);h.rShiftTo(f,h)}while(b.signum()>0){if((d=b.getLowestSetBit())>0){b.rShiftTo(d,b)}if((d=h.getLowestSetBit())>0){h.rShiftTo(d,h)}if(b.compareTo(h)>=0){b.subTo(h,b);b.rShiftTo(1,b)}else{h.subTo(b,h);h.rShiftTo(1,h)}}if(f>0){h.lShiftTo(f,h)}return h}function bnpModInt(e){if(e<=0){return 0}var c=this.DV%e,b=(this.s<0)?e-1:0;if(this.t>0){if(c==0){b=this[0]%e}else{for(var a=this.t-1;a>=0;--a){b=(c*b+this[a])%e}}}return b}function bnModInverse(f){var j=f.isEven();if((this.isEven()&&j)||f.signum()==0){return BigInteger.ZERO}var i=f.clone(),h=this.clone();var g=nbv(1),e=nbv(0),l=nbv(0),k=nbv(1);while(i.signum()!=0){while(i.isEven()){i.rShiftTo(1,i);if(j){if(!g.isEven()||!e.isEven()){g.addTo(this,g);e.subTo(f,e)}g.rShiftTo(1,g)}else{if(!e.isEven()){e.subTo(f,e)}}e.rShiftTo(1,e)}while(h.isEven()){h.rShiftTo(1,h);if(j){if(!l.isEven()||!k.isEven()){l.addTo(this,l);k.subTo(f,k)}l.rShiftTo(1,l)}else{if(!k.isEven()){k.subTo(f,k)}}k.rShiftTo(1,k)}if(i.compareTo(h)>=0){i.subTo(h,i);if(j){g.subTo(l,g)}e.subTo(k,e)}else{h.subTo(i,h);if(j){l.subTo(g,l)}k.subTo(e,k)}}if(h.compareTo(BigInteger.ONE)!=0){return BigInteger.ZERO}if(k.compareTo(f)>=0){return k.subtract(f)}if(k.signum()<0){k.addTo(f,k)}else{return k}if(k.signum()<0){return k.add(f)}else{return k}}var lowprimes=[2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509,521,523,541,547,557,563,569,571,577,587,593,599,601,607,613,617,619,631,641,643,647,653,659,661,673,677,683,691,701,709,719,727,733,739,743,751,757,761,769,773,787,797,809,811,821,823,827,829,839,853,857,859,863,877,881,883,887,907,911,919,929,937,941,947,953,967,971,977,983,991,997];var lplim=(1<<26)/lowprimes[lowprimes.length-1];function bnIsProbablePrime(e){var d,b=this.abs();if(b.t==1&&b[0]<=lowprimes[lowprimes.length-1]){for(d=0;d>1;if(f>lowprimes.length){f=lowprimes.length}var b=nbi();for(var e=0;e>8)&255;rng_pool[rng_pptr++]^=(a>>16)&255;rng_pool[rng_pptr++]^=(a>>24)&255;if(rng_pptr>=rng_psize){rng_pptr-=rng_psize}}function rng_seed_time(){rng_seed_int(new Date().getTime())}if(rng_pool==null){rng_pool=new Array();rng_pptr=0;var t;if(window!==undefined&&(window.crypto!==undefined||window.msCrypto!==undefined)){var crypto=window.crypto||window.msCrypto;if(crypto.getRandomValues){var ua=new Uint8Array(32);crypto.getRandomValues(ua);for(t=0;t<32;++t){rng_pool[rng_pptr++]=ua[t]}}else{if(navigator.appName=="Netscape"&&navigator.appVersion<"5"){var z=window.crypto.random(32);for(t=0;t>>8;rng_pool[rng_pptr++]=t&255}rng_pptr=0;rng_seed_time()}function rng_get_byte(){if(rng_state==null){rng_seed_time();rng_state=prng_newstate();rng_state.init(rng_pool);for(rng_pptr=0;rng_pptr=0&&h>0){var f=e.charCodeAt(d--);if(f<128){g[--h]=f}else{if((f>127)&&(f<2048)){g[--h]=(f&63)|128;g[--h]=(f>>6)|192}else{g[--h]=(f&63)|128;g[--h]=((f>>6)&63)|128;g[--h]=(f>>12)|224}}}g[--h]=0;var b=new SecureRandom();var a=new Array();while(h>2){a[0]=0;while(a[0]==0){b.nextBytes(a)}g[--h]=a[0]}g[--h]=2;g[--h]=0;return new BigInteger(g)}function oaep_mgf1_arr(c,a,e){var b="",d=0;while(b.length>24,(d&16711680)>>16,(d&65280)>>8,d&255])));d+=1}return b}function oaep_pad(q,a,f,l){var c=KJUR.crypto.MessageDigest;var o=KJUR.crypto.Util;var b=null;if(!f){f="sha1"}if(typeof f==="string"){b=c.getCanonicalAlgName(f);l=c.getHashLength(b);f=function(i){return hextorstr(o.hashString(i,b))}}if(q.length+2*l+2>a){throw"Message too long for RSA"}var k="",e;for(e=0;e0&&a.length>0){this.n=parseBigInt(b,16);this.e=parseInt(a,16)}else{throw"Invalid RSA public key"}}}function RSADoPublic(a){return a.modPowInt(this.e,this.n)}function RSAEncrypt(d){var a=pkcs1pad2(d,(this.n.bitLength()+7)>>3);if(a==null){return null}var e=this.doPublic(a);if(e==null){return null}var b=e.toString(16);if((b.length&1)==0){return b}else{return"0"+b}}function RSAEncryptOAEP(f,e,b){var a=oaep_pad(f,(this.n.bitLength()+7)>>3,e,b);if(a==null){return null}var g=this.doPublic(a);if(g==null){return null}var d=g.toString(16);if((d.length&1)==0){return d}else{return"0"+d}}RSAKey.prototype.doPublic=RSADoPublic;RSAKey.prototype.setPublic=RSASetPublic;RSAKey.prototype.encrypt=RSAEncrypt;RSAKey.prototype.encryptOAEP=RSAEncryptOAEP;RSAKey.prototype.type="RSA"; -/*! (c) Tom Wu | http://www-cs-students.stanford.edu/~tjw/jsbn/ - */ -function pkcs1unpad2(g,j){var a=g.toByteArray();var f=0;while(f=a.length){return null}}var e="";while(++f191)&&(h<224)){e+=String.fromCharCode(((h&31)<<6)|(a[f+1]&63));++f}else{e+=String.fromCharCode(((h&15)<<12)|((a[f+1]&63)<<6)|(a[f+2]&63));f+=2}}}return e}function oaep_mgf1_str(c,a,e){var b="",d=0;while(b.length>24,(d&16711680)>>16,(d&65280)>>8,d&255]));d+=1}return b}function oaep_unpad(o,b,g,p){var e=KJUR.crypto.MessageDigest;var r=KJUR.crypto.Util;var c=null;if(!g){g="sha1"}if(typeof g==="string"){c=e.getCanonicalAlgName(g);p=e.getHashLength(c);g=function(d){return hextorstr(r.hashString(d,c))}}o=o.toByteArray();var h;for(h=0;h0&&a.length>0){this.n=parseBigInt(c,16);this.e=parseInt(a,16);this.d=parseBigInt(b,16)}else{alert("Invalid RSA private key")}}}function RSASetPrivateEx(g,d,e,c,b,a,h,f){this.isPrivate=true;this.isPublic=false;if(g==null){throw"RSASetPrivateEx N == null"}if(d==null){throw"RSASetPrivateEx E == null"}if(g.length==0){throw"RSASetPrivateEx N.length == 0"}if(d.length==0){throw"RSASetPrivateEx E.length == 0"}if(g!=null&&d!=null&&g.length>0&&d.length>0){this.n=parseBigInt(g,16);this.e=parseInt(d,16);this.d=parseBigInt(e,16);this.p=parseBigInt(c,16);this.q=parseBigInt(b,16);this.dmp1=parseBigInt(a,16);this.dmq1=parseBigInt(h,16);this.coeff=parseBigInt(f,16)}else{alert("Invalid RSA private key in RSASetPrivateEx")}}function RSAGenerate(b,i){var a=new SecureRandom();var f=b>>1;this.e=parseInt(i,16);var c=new BigInteger(i,16);for(;;){for(;;){this.p=new BigInteger(b-f,1,a);if(this.p.subtract(BigInteger.ONE).gcd(c).compareTo(BigInteger.ONE)==0&&this.p.isProbablePrime(10)){break}}for(;;){this.q=new BigInteger(f,1,a);if(this.q.subtract(BigInteger.ONE).gcd(c).compareTo(BigInteger.ONE)==0&&this.q.isProbablePrime(10)){break}}if(this.p.compareTo(this.q)<=0){var h=this.p;this.p=this.q;this.q=h}var g=this.p.subtract(BigInteger.ONE);var d=this.q.subtract(BigInteger.ONE);var e=g.multiply(d);if(e.gcd(c).compareTo(BigInteger.ONE)==0){this.n=this.p.multiply(this.q);this.d=c.modInverse(e);this.dmp1=this.d.mod(g);this.dmq1=this.d.mod(d);this.coeff=this.q.modInverse(this.p);break}}this.isPrivate=true}function RSADoPrivate(a){if(this.p==null||this.q==null){return a.modPow(this.d,this.n)}var c=a.mod(this.p).modPow(this.dmp1,this.p);var b=a.mod(this.q).modPow(this.dmq1,this.q);while(c.compareTo(b)<0){c=c.add(this.p)}return c.subtract(b).multiply(this.coeff).mod(this.p).multiply(this.q).add(b)}function RSADecrypt(b){var d=parseBigInt(b,16);var a=this.doPrivate(d);if(a==null){return null}return pkcs1unpad2(a,(this.n.bitLength()+7)>>3)}function RSADecryptOAEP(e,d,b){var f=parseBigInt(e,16);var a=this.doPrivate(f);if(a==null){return null}return oaep_unpad(a,(this.n.bitLength()+7)>>3,d,b)}RSAKey.prototype.doPrivate=RSADoPrivate;RSAKey.prototype.setPrivate=RSASetPrivate;RSAKey.prototype.setPrivateEx=RSASetPrivateEx;RSAKey.prototype.generate=RSAGenerate;RSAKey.prototype.decrypt=RSADecrypt;RSAKey.prototype.decryptOAEP=RSADecryptOAEP; -/*! (c) Tom Wu | http://www-cs-students.stanford.edu/~tjw/jsbn/ - */ -function ECFieldElementFp(b,a){this.x=a;this.q=b}function feFpEquals(a){if(a==this){return true}return(this.q.equals(a.q)&&this.x.equals(a.x))}function feFpToBigInteger(){return this.x}function feFpNegate(){return new ECFieldElementFp(this.q,this.x.negate().mod(this.q))}function feFpAdd(a){return new ECFieldElementFp(this.q,this.x.add(a.toBigInteger()).mod(this.q))}function feFpSubtract(a){return new ECFieldElementFp(this.q,this.x.subtract(a.toBigInteger()).mod(this.q))}function feFpMultiply(a){return new ECFieldElementFp(this.q,this.x.multiply(a.toBigInteger()).mod(this.q))}function feFpSquare(){return new ECFieldElementFp(this.q,this.x.square().mod(this.q))}function feFpDivide(a){return new ECFieldElementFp(this.q,this.x.multiply(a.toBigInteger().modInverse(this.q)).mod(this.q))}ECFieldElementFp.prototype.equals=feFpEquals;ECFieldElementFp.prototype.toBigInteger=feFpToBigInteger;ECFieldElementFp.prototype.negate=feFpNegate;ECFieldElementFp.prototype.add=feFpAdd;ECFieldElementFp.prototype.subtract=feFpSubtract;ECFieldElementFp.prototype.multiply=feFpMultiply;ECFieldElementFp.prototype.square=feFpSquare;ECFieldElementFp.prototype.divide=feFpDivide;function ECPointFp(c,a,d,b){this.curve=c;this.x=a;this.y=d;if(b==null){this.z=BigInteger.ONE}else{this.z=b}this.zinv=null}function pointFpGetX(){if(this.zinv==null){this.zinv=this.z.modInverse(this.curve.q)}return this.curve.fromBigInteger(this.x.toBigInteger().multiply(this.zinv).mod(this.curve.q))}function pointFpGetY(){if(this.zinv==null){this.zinv=this.z.modInverse(this.curve.q)}return this.curve.fromBigInteger(this.y.toBigInteger().multiply(this.zinv).mod(this.curve.q))}function pointFpEquals(a){if(a==this){return true}if(this.isInfinity()){return a.isInfinity()}if(a.isInfinity()){return this.isInfinity()}var c,b;c=a.y.toBigInteger().multiply(this.z).subtract(this.y.toBigInteger().multiply(a.z)).mod(this.curve.q);if(!c.equals(BigInteger.ZERO)){return false}b=a.x.toBigInteger().multiply(this.z).subtract(this.x.toBigInteger().multiply(a.z)).mod(this.curve.q);return b.equals(BigInteger.ZERO)}function pointFpIsInfinity(){if((this.x==null)&&(this.y==null)){return true}return this.z.equals(BigInteger.ZERO)&&!this.y.toBigInteger().equals(BigInteger.ZERO)}function pointFpNegate(){return new ECPointFp(this.curve,this.x,this.y.negate(),this.z)}function pointFpAdd(l){if(this.isInfinity()){return l}if(l.isInfinity()){return this}var p=l.y.toBigInteger().multiply(this.z).subtract(this.y.toBigInteger().multiply(l.z)).mod(this.curve.q);var o=l.x.toBigInteger().multiply(this.z).subtract(this.x.toBigInteger().multiply(l.z)).mod(this.curve.q);if(BigInteger.ZERO.equals(o)){if(BigInteger.ZERO.equals(p)){return this.twice()}return this.curve.getInfinity()}var j=new BigInteger("3");var e=this.x.toBigInteger();var n=this.y.toBigInteger();var c=l.x.toBigInteger();var k=l.y.toBigInteger();var m=o.square();var i=m.multiply(o);var d=e.multiply(m);var g=p.square().multiply(this.z);var a=g.subtract(d.shiftLeft(1)).multiply(l.z).subtract(i).multiply(o).mod(this.curve.q);var h=d.multiply(j).multiply(p).subtract(n.multiply(i)).subtract(g.multiply(p)).multiply(l.z).add(p.multiply(i)).mod(this.curve.q);var f=i.multiply(this.z).multiply(l.z).mod(this.curve.q);return new ECPointFp(this.curve,this.curve.fromBigInteger(a),this.curve.fromBigInteger(h),f)}function pointFpTwice(){if(this.isInfinity()){return this}if(this.y.toBigInteger().signum()==0){return this.curve.getInfinity()}var g=new BigInteger("3");var c=this.x.toBigInteger();var h=this.y.toBigInteger();var e=h.multiply(this.z);var j=e.multiply(h).mod(this.curve.q);var i=this.curve.a.toBigInteger();var k=c.square().multiply(g);if(!BigInteger.ZERO.equals(i)){k=k.add(this.z.square().multiply(i))}k=k.mod(this.curve.q);var b=k.square().subtract(c.shiftLeft(3).multiply(j)).shiftLeft(1).multiply(e).mod(this.curve.q);var f=k.multiply(g).multiply(c).subtract(j.shiftLeft(1)).shiftLeft(2).multiply(j).subtract(k.square().multiply(k)).mod(this.curve.q);var d=e.square().multiply(e).shiftLeft(3).mod(this.curve.q);return new ECPointFp(this.curve,this.curve.fromBigInteger(b),this.curve.fromBigInteger(f),d)}function pointFpMultiply(b){if(this.isInfinity()){return this}if(b.signum()==0){return this.curve.getInfinity()}var g=b;var f=g.multiply(new BigInteger("3"));var l=this.negate();var d=this;var c;for(c=f.bitLength()-2;c>0;--c){d=d.twice();var a=f.testBit(c);var j=g.testBit(c);if(a!=j){d=d.add(a?this:l)}}return d}function pointFpMultiplyTwo(c,a,b){var d;if(c.bitLength()>b.bitLength()){d=c.bitLength()-1}else{d=b.bitLength()-1}var f=this.curve.getInfinity();var e=this.add(a);while(d>=0){f=f.twice();if(c.testBit(d)){if(b.testBit(d)){f=f.add(e)}else{f=f.add(this)}}else{if(b.testBit(d)){f=f.add(a)}}--d}return f}ECPointFp.prototype.getX=pointFpGetX;ECPointFp.prototype.getY=pointFpGetY;ECPointFp.prototype.equals=pointFpEquals;ECPointFp.prototype.isInfinity=pointFpIsInfinity;ECPointFp.prototype.negate=pointFpNegate;ECPointFp.prototype.add=pointFpAdd;ECPointFp.prototype.twice=pointFpTwice;ECPointFp.prototype.multiply=pointFpMultiply;ECPointFp.prototype.multiplyTwo=pointFpMultiplyTwo;function ECCurveFp(e,d,c){this.q=e;this.a=this.fromBigInteger(d);this.b=this.fromBigInteger(c);this.infinity=new ECPointFp(this,null,null)}function curveFpGetQ(){return this.q}function curveFpGetA(){return this.a}function curveFpGetB(){return this.b}function curveFpEquals(a){if(a==this){return true}return(this.q.equals(a.q)&&this.a.equals(a.a)&&this.b.equals(a.b))}function curveFpGetInfinity(){return this.infinity}function curveFpFromBigInteger(a){return new ECFieldElementFp(this.q,a)}function curveFpDecodePointHex(d){switch(parseInt(d.substr(0,2),16)){case 0:return this.infinity;case 2:case 3:return null;case 4:case 6:case 7:var a=(d.length-2)/2;var c=d.substr(2,a);var b=d.substr(a+2,a);return new ECPointFp(this,this.fromBigInteger(new BigInteger(c,16)),this.fromBigInteger(new BigInteger(b,16)));default:return null}}ECCurveFp.prototype.getQ=curveFpGetQ;ECCurveFp.prototype.getA=curveFpGetA;ECCurveFp.prototype.getB=curveFpGetB;ECCurveFp.prototype.equals=curveFpEquals;ECCurveFp.prototype.getInfinity=curveFpGetInfinity;ECCurveFp.prototype.fromBigInteger=curveFpFromBigInteger;ECCurveFp.prototype.decodePointHex=curveFpDecodePointHex; -/*! (c) Stefan Thomas | https://github.com/bitcoinjs/bitcoinjs-lib - */ -ECFieldElementFp.prototype.getByteLength=function(){return Math.floor((this.toBigInteger().bitLength()+7)/8)};ECPointFp.prototype.getEncoded=function(c){var d=function(h,f){var g=h.toByteArrayUnsigned();if(fg.length){g.unshift(0)}}return g};var a=this.getX().toBigInteger();var e=this.getY().toBigInteger();var b=d(a,32);if(c){if(e.isEven()){b.unshift(2)}else{b.unshift(3)}}else{b.unshift(4);b=b.concat(d(e,32))}return b};ECPointFp.decodeFrom=function(g,c){var f=c[0];var e=c.length-1;var d=c.slice(1,1+e/2);var b=c.slice(1+e/2,1+e);d.unshift(0);b.unshift(0);var a=new BigInteger(d);var h=new BigInteger(b);return new ECPointFp(g,g.fromBigInteger(a),g.fromBigInteger(h))};ECPointFp.decodeFromHex=function(g,c){var f=c.substr(0,2);var e=c.length-2;var d=c.substr(2,e/2);var b=c.substr(2+e/2,e/2);var a=new BigInteger(d,16);var h=new BigInteger(b,16);return new ECPointFp(g,g.fromBigInteger(a),g.fromBigInteger(h))};ECPointFp.prototype.add2D=function(c){if(this.isInfinity()){return c}if(c.isInfinity()){return this}if(this.x.equals(c.x)){if(this.y.equals(c.y)){return this.twice()}return this.curve.getInfinity()}var g=c.x.subtract(this.x);var e=c.y.subtract(this.y);var a=e.divide(g);var d=a.square().subtract(this.x).subtract(c.x);var f=a.multiply(this.x.subtract(d)).subtract(this.y);return new ECPointFp(this.curve,d,f)};ECPointFp.prototype.twice2D=function(){if(this.isInfinity()){return this}if(this.y.toBigInteger().signum()==0){return this.curve.getInfinity()}var b=this.curve.fromBigInteger(BigInteger.valueOf(2));var e=this.curve.fromBigInteger(BigInteger.valueOf(3));var a=this.x.square().multiply(e).add(this.curve.a).divide(this.y.multiply(b));var c=a.square().subtract(this.x.multiply(b));var d=a.multiply(this.x.subtract(c)).subtract(this.y);return new ECPointFp(this.curve,c,d)};ECPointFp.prototype.multiply2D=function(b){if(this.isInfinity()){return this}if(b.signum()==0){return this.curve.getInfinity()}var g=b;var f=g.multiply(new BigInteger("3"));var l=this.negate();var d=this;var c;for(c=f.bitLength()-2;c>0;--c){d=d.twice();var a=f.testBit(c);var j=g.testBit(c);if(a!=j){d=d.add2D(a?this:l)}}return d};ECPointFp.prototype.isOnCurve=function(){var d=this.getX().toBigInteger();var i=this.getY().toBigInteger();var f=this.curve.getA().toBigInteger();var c=this.curve.getB().toBigInteger();var h=this.curve.getQ();var e=i.multiply(i).mod(h);var g=d.multiply(d).multiply(d).add(f.multiply(d)).add(c).mod(h);return e.equals(g)};ECPointFp.prototype.toString=function(){return"("+this.getX().toBigInteger().toString()+","+this.getY().toBigInteger().toString()+")"};ECPointFp.prototype.validate=function(){var c=this.curve.getQ();if(this.isInfinity()){throw new Error("Point is at infinity.")}var a=this.getX().toBigInteger();var b=this.getY().toBigInteger();if(a.compareTo(BigInteger.ONE)<0||a.compareTo(c.subtract(BigInteger.ONE))>0){throw new Error("x coordinate out of bounds")}if(b.compareTo(BigInteger.ONE)<0||b.compareTo(c.subtract(BigInteger.ONE))>0){throw new Error("y coordinate out of bounds")}if(!this.isOnCurve()){throw new Error("Point is not on the curve.")}if(this.multiply(c).isInfinity()){throw new Error("Point is not a scalar multiple of G.")}return true}; -/*! Mike Samuel (c) 2009 | code.google.com/p/json-sans-eval - */ -var jsonParse=(function(){var e="(?:-?\\b(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?(?:[eE][+-]?[0-9]+)?\\b)";var j='(?:[^\\0-\\x08\\x0a-\\x1f"\\\\]|\\\\(?:["/\\\\bfnrt]|u[0-9A-Fa-f]{4}))';var i='(?:"'+j+'*")';var d=new RegExp("(?:false|true|null|[\\{\\}\\[\\]]|"+e+"|"+i+")","g");var k=new RegExp("\\\\(?:([^u])|u(.{4}))","g");var g={'"':'"',"/":"/","\\":"\\",b:"\b",f:"\f",n:"\n",r:"\r",t:"\t"};function h(l,m,n){return m?g[m]:String.fromCharCode(parseInt(n,16))}var c=new String("");var a="\\";var f={"{":Object,"[":Array};var b=Object.hasOwnProperty;return function(u,q){var p=u.match(d);var x;var v=p[0];var l=false;if("{"===v){x={}}else{if("["===v){x=[]}else{x=[];l=true}}var t;var r=[x];for(var o=1-l,m=p.length;o=0;){delete D[n[A]]}}}return q.call(C,B,D)};x=s({"":x},"")}return x}})(); -if(typeof KJUR=="undefined"||!KJUR){KJUR={}}if(typeof KJUR.asn1=="undefined"||!KJUR.asn1){KJUR.asn1={}}KJUR.asn1.ASN1Util=new function(){this.integerToByteHex=function(a){var b=a.toString(16);if((b.length%2)==1){b="0"+b}return b};this.bigIntToMinTwosComplementsHex=function(j){var f=j.toString(16);if(f.substr(0,1)!="-"){if(f.length%2==1){f="0"+f}else{if(!f.match(/^[0-7]/)){f="00"+f}}}else{var a=f.substr(1);var e=a.length;if(e%2==1){e+=1}else{if(!f.match(/^[0-7]/)){e+=2}}var g="";for(var d=0;d15){throw"ASN.1 length too long to represent by 8x: n = "+i.toString(16)}var f=128+g;return f.toString(16)+h}};this.getEncodedHex=function(){if(this.hTLV==null||this.isModified){this.hV=this.getFreshValueHex();this.hL=this.getLengthHexFromValue();this.hTLV=this.hT+this.hL+this.hV;this.isModified=false}return this.hTLV};this.getValueHex=function(){this.getEncodedHex();return this.hV};this.getFreshValueHex=function(){return""}};KJUR.asn1.DERAbstractString=function(c){KJUR.asn1.DERAbstractString.superclass.constructor.call(this);var b=null;var a=null;this.getString=function(){return this.s};this.setString=function(d){this.hTLV=null;this.isModified=true;this.s=d;this.hV=stohex(this.s)};this.setStringHex=function(d){this.hTLV=null;this.isModified=true;this.s=null;this.hV=d};this.getFreshValueHex=function(){return this.hV};if(typeof c!="undefined"){if(typeof c=="string"){this.setString(c)}else{if(typeof c.str!="undefined"){this.setString(c.str)}else{if(typeof c.hex!="undefined"){this.setStringHex(c.hex)}}}}};YAHOO.lang.extend(KJUR.asn1.DERAbstractString,KJUR.asn1.ASN1Object);KJUR.asn1.DERAbstractTime=function(c){KJUR.asn1.DERAbstractTime.superclass.constructor.call(this);var b=null;var a=null;this.localDateToUTC=function(f){utc=f.getTime()+(f.getTimezoneOffset()*60000);var e=new Date(utc);return e};this.formatDate=function(m,o,e){var g=this.zeroPadding;var n=this.localDateToUTC(m);var p=String(n.getFullYear());if(o=="utc"){p=p.substr(2,2)}var l=g(String(n.getMonth()+1),2);var q=g(String(n.getDate()),2);var h=g(String(n.getHours()),2);var i=g(String(n.getMinutes()),2);var j=g(String(n.getSeconds()),2);var r=p+l+q+h+i+j;if(e===true){var f=n.getMilliseconds();if(f!=0){var k=g(String(f),3);k=k.replace(/[0]+$/,"");r=r+"."+k}}return r+"Z"};this.zeroPadding=function(e,d){if(e.length>=d){return e}return new Array(d-e.length+1).join("0")+e};this.getString=function(){return this.s};this.setString=function(d){this.hTLV=null;this.isModified=true;this.s=d;this.hV=stohex(d)};this.setByDateValue=function(h,j,e,d,f,g){var i=new Date(Date.UTC(h,j-1,e,d,f,g,0));this.setByDate(i)};this.getFreshValueHex=function(){return this.hV}};YAHOO.lang.extend(KJUR.asn1.DERAbstractTime,KJUR.asn1.ASN1Object);KJUR.asn1.DERAbstractStructured=function(b){KJUR.asn1.DERAbstractString.superclass.constructor.call(this);var a=null;this.setByASN1ObjectArray=function(c){this.hTLV=null;this.isModified=true;this.asn1Array=c};this.appendASN1Object=function(c){this.hTLV=null;this.isModified=true;this.asn1Array.push(c)};this.asn1Array=new Array();if(typeof b!="undefined"){if(typeof b.array!="undefined"){this.asn1Array=b.array}}};YAHOO.lang.extend(KJUR.asn1.DERAbstractStructured,KJUR.asn1.ASN1Object);KJUR.asn1.DERBoolean=function(){KJUR.asn1.DERBoolean.superclass.constructor.call(this);this.hT="01";this.hTLV="0101ff"};YAHOO.lang.extend(KJUR.asn1.DERBoolean,KJUR.asn1.ASN1Object);KJUR.asn1.DERInteger=function(a){KJUR.asn1.DERInteger.superclass.constructor.call(this);this.hT="02";this.setByBigInteger=function(b){this.hTLV=null;this.isModified=true;this.hV=KJUR.asn1.ASN1Util.bigIntToMinTwosComplementsHex(b)};this.setByInteger=function(c){var b=new BigInteger(String(c),10);this.setByBigInteger(b)};this.setValueHex=function(b){this.hV=b};this.getFreshValueHex=function(){return this.hV};if(typeof a!="undefined"){if(typeof a.bigint!="undefined"){this.setByBigInteger(a.bigint)}else{if(typeof a["int"]!="undefined"){this.setByInteger(a["int"])}else{if(typeof a=="number"){this.setByInteger(a)}else{if(typeof a.hex!="undefined"){this.setValueHex(a.hex)}}}}}};YAHOO.lang.extend(KJUR.asn1.DERInteger,KJUR.asn1.ASN1Object);KJUR.asn1.DERBitString=function(b){if(b!==undefined&&typeof b.obj!=="undefined"){var a=KJUR.asn1.ASN1Util.newObject(b.obj);b.hex="00"+a.getEncodedHex()}KJUR.asn1.DERBitString.superclass.constructor.call(this);this.hT="03";this.setHexValueIncludingUnusedBits=function(c){this.hTLV=null;this.isModified=true;this.hV=c};this.setUnusedBitsAndHexValue=function(c,e){if(c<0||7=(l*2))){break}if(d>=200){break}g.push(b);c=b;d++}return g};ASN1HEX.getNthChildIdx=function(d,b,e){var c=ASN1HEX.getChildIdx(d,b);return c[e]};ASN1HEX.getIdxbyList=function(e,d,c,i){var g=ASN1HEX;var f,b;if(c.length==0){if(i!==undefined){if(e.substr(d,2)!==i){throw"checking tag doesn't match: "+e.substr(d,2)+"!="+i}}return d}f=c.shift();b=g.getChildIdx(e,d);return g.getIdxbyList(e,b[f],c,i)};ASN1HEX.getTLVbyList=function(d,c,b,f){var e=ASN1HEX;var a=e.getIdxbyList(d,c,b);if(a===undefined){throw"can't find nthList object"}if(f!==undefined){if(d.substr(a,2)!=f){throw"checking tag doesn't match: "+d.substr(a,2)+"!="+f}}return e.getTLV(d,a)};ASN1HEX.getVbyList=function(e,c,b,g,i){var f=ASN1HEX;var a,d;a=f.getIdxbyList(e,c,b,g);if(a===undefined){throw"can't find nthList object"}d=f.getV(e,a);if(i===true){d=d.substr(2)}return d};ASN1HEX.hextooidstr=function(e){var h=function(b,a){if(b.length>=a){return b}return new Array(a-b.length+1).join("0")+b};var l=[];var o=e.substr(0,2);var f=parseInt(o,16);l[0]=new String(Math.floor(f/40));l[1]=new String(f%40);var m=e.substr(2);var k=[];for(var g=0;g0){n=n+"."+j.join(".")}return n};ASN1HEX.dump=function(t,c,l,g){var p=ASN1HEX;var j=p.getV;var y=p.dump;var w=p.getChildIdx;var e=t;if(t instanceof KJUR.asn1.ASN1Object){e=t.getEncodedHex()}var q=function(A,i){if(A.length<=i*2){return A}else{var v=A.substr(0,i)+"..(total "+A.length/2+"bytes).."+A.substr(A.length-i,i);return v}};if(c===undefined){c={ommit_long_octet:32}}if(l===undefined){l=0}if(g===undefined){g=""}var x=c.ommit_long_octet;if(e.substr(l,2)=="01"){var h=j(e,l);if(h=="00"){return g+"BOOLEAN FALSE\n"}else{return g+"BOOLEAN TRUE\n"}}if(e.substr(l,2)=="02"){var h=j(e,l);return g+"INTEGER "+q(h,x)+"\n"}if(e.substr(l,2)=="03"){var h=j(e,l);return g+"BITSTRING "+q(h,x)+"\n"}if(e.substr(l,2)=="04"){var h=j(e,l);if(p.isASN1HEX(h)){var k=g+"OCTETSTRING, encapsulates\n";k=k+y(h,c,0,g+" ");return k}else{return g+"OCTETSTRING "+q(h,x)+"\n"}}if(e.substr(l,2)=="05"){return g+"NULL\n"}if(e.substr(l,2)=="06"){var m=j(e,l);var a=KJUR.asn1.ASN1Util.oidHexToInt(m);var o=KJUR.asn1.x509.OID.oid2name(a);var b=a.replace(/\./g," ");if(o!=""){return g+"ObjectIdentifier "+o+" ("+b+")\n"}else{return g+"ObjectIdentifier ("+b+")\n"}}if(e.substr(l,2)=="0c"){return g+"UTF8String '"+hextoutf8(j(e,l))+"'\n"}if(e.substr(l,2)=="13"){return g+"PrintableString '"+hextoutf8(j(e,l))+"'\n"}if(e.substr(l,2)=="14"){return g+"TeletexString '"+hextoutf8(j(e,l))+"'\n"}if(e.substr(l,2)=="16"){return g+"IA5String '"+hextoutf8(j(e,l))+"'\n"}if(e.substr(l,2)=="17"){return g+"UTCTime "+hextoutf8(j(e,l))+"\n"}if(e.substr(l,2)=="18"){return g+"GeneralizedTime "+hextoutf8(j(e,l))+"\n"}if(e.substr(l,2)=="30"){if(e.substr(l,4)=="3000"){return g+"SEQUENCE {}\n"}var k=g+"SEQUENCE\n";var d=w(e,l);var f=c;if((d.length==2||d.length==3)&&e.substr(d[0],2)=="06"&&e.substr(d[d.length-1],2)=="04"){var o=p.oidname(j(e,d[0]));var r=JSON.parse(JSON.stringify(c));r.x509ExtName=o;f=r}for(var u=0;u0){var m=new f({array:this.extensionsArray});var k=new c({explicit:true,tag:"a3",obj:m});this.asn1Array.push(k)}var n=new f({array:this.asn1Array});this.hTLV=n.getEncodedHex();this.isModified=false;return this.hTLV};this._initialize()};YAHOO.lang.extend(KJUR.asn1.x509.TBSCertificate,KJUR.asn1.ASN1Object);KJUR.asn1.x509.Extension=function(d){KJUR.asn1.x509.Extension.superclass.constructor.call(this);var f=null,a=KJUR,e=a.asn1,h=e.DERObjectIdentifier,i=e.DEROctetString,b=e.DERBitString,g=e.DERBoolean,c=e.DERSequence;this.getEncodedHex=function(){var m=new h({oid:this.oid});var l=new i({hex:this.getExtnValueHex()});var k=new Array();k.push(m);if(this.critical){k.push(new g())}k.push(l);var j=new c({array:k});return j.getEncodedHex()};this.critical=false;if(typeof d!="undefined"){if(typeof d.critical!="undefined"){this.critical=d.critical}}};YAHOO.lang.extend(KJUR.asn1.x509.Extension,KJUR.asn1.ASN1Object);KJUR.asn1.x509.Extension.appendByNameToArray=function(e,c,b){var g=e.toLowerCase(),f=KJUR.asn1.x509;if(g=="basicconstraints"){var d=new f.BasicConstraints(c);b.push(d)}else{if(g=="keyusage"){var d=new f.KeyUsage(c);b.push(d)}else{if(g=="crldistributionpoints"){var d=new f.CRLDistributionPoints(c);b.push(d)}else{if(g=="extkeyusage"){var d=new f.ExtKeyUsage(c);b.push(d)}else{if(g=="authoritykeyidentifier"){var d=new f.AuthorityKeyIdentifier(c);b.push(d)}else{if(g=="authorityinfoaccess"){var d=new f.AuthorityInfoAccess(c);b.push(d)}else{if(g=="subjectaltname"){var d=new f.SubjectAltName(c);b.push(d)}else{if(g=="issueraltname"){var d=new f.IssuerAltName(c);b.push(d)}else{throw"unsupported extension name: "+e}}}}}}}}};KJUR.asn1.x509.KeyUsage=function(a){KJUR.asn1.x509.KeyUsage.superclass.constructor.call(this,a);this.getExtnValueHex=function(){return this.asn1ExtnValue.getEncodedHex()};this.oid="2.5.29.15";if(typeof a!="undefined"){if(typeof a.bin!="undefined"){this.asn1ExtnValue=new KJUR.asn1.DERBitString(a)}}};YAHOO.lang.extend(KJUR.asn1.x509.KeyUsage,KJUR.asn1.x509.Extension);KJUR.asn1.x509.BasicConstraints=function(c){KJUR.asn1.x509.BasicConstraints.superclass.constructor.call(this,c);var a=false;var b=-1;this.getExtnValueHex=function(){var e=new Array();if(this.cA){e.push(new KJUR.asn1.DERBoolean())}if(this.pathLen>-1){e.push(new KJUR.asn1.DERInteger({"int":this.pathLen}))}var d=new KJUR.asn1.DERSequence({array:e});this.asn1ExtnValue=d;return this.asn1ExtnValue.getEncodedHex()};this.oid="2.5.29.19";this.cA=false;this.pathLen=-1;if(typeof c!="undefined"){if(typeof c.cA!="undefined"){this.cA=c.cA}if(typeof c.pathLen!="undefined"){this.pathLen=c.pathLen}}};YAHOO.lang.extend(KJUR.asn1.x509.BasicConstraints,KJUR.asn1.x509.Extension);KJUR.asn1.x509.CRLDistributionPoints=function(d){KJUR.asn1.x509.CRLDistributionPoints.superclass.constructor.call(this,d);var b=KJUR,a=b.asn1,c=a.x509;this.getExtnValueHex=function(){return this.asn1ExtnValue.getEncodedHex()};this.setByDPArray=function(e){this.asn1ExtnValue=new a.DERSequence({array:e})};this.setByOneURI=function(h){var e=new c.GeneralNames([{uri:h}]);var g=new c.DistributionPointName(e);var f=new c.DistributionPoint({dpobj:g});this.setByDPArray([f])};this.oid="2.5.29.31";if(typeof d!="undefined"){if(typeof d.array!="undefined"){this.setByDPArray(d.array)}else{if(typeof d.uri!="undefined"){this.setByOneURI(d.uri)}}}};YAHOO.lang.extend(KJUR.asn1.x509.CRLDistributionPoints,KJUR.asn1.x509.Extension);KJUR.asn1.x509.ExtKeyUsage=function(c){KJUR.asn1.x509.ExtKeyUsage.superclass.constructor.call(this,c);var b=KJUR,a=b.asn1;this.setPurposeArray=function(d){this.asn1ExtnValue=new a.DERSequence();for(var e=0;e0){var h=new b({array:this.aRevokedCert});this.asn1Array.push(h)}var i=new b({array:this.asn1Array});this.hTLV=i.getEncodedHex();this.isModified=false;return this.hTLV};this._initialize=function(){this.asn1Version=null;this.asn1SignatureAlg=null;this.asn1Issuer=null;this.asn1ThisUpdate=null;this.asn1NextUpdate=null;this.aRevokedCert=new Array()};this._initialize()};YAHOO.lang.extend(KJUR.asn1.x509.TBSCertList,KJUR.asn1.ASN1Object);KJUR.asn1.x509.CRLEntry=function(e){KJUR.asn1.x509.CRLEntry.superclass.constructor.call(this);var d=null,c=null,b=KJUR,a=b.asn1;this.setCertSerial=function(f){this.sn=new a.DERInteger(f)};this.setRevocationDate=function(f){this.time=new a.x509.Time(f)};this.getEncodedHex=function(){var f=new a.DERSequence({array:[this.sn,this.time]});this.TLV=f.getEncodedHex();return this.TLV};if(e!==undefined){if(e.time!==undefined){this.setRevocationDate(e.time)}if(e.sn!==undefined){this.setCertSerial(e.sn)}}};YAHOO.lang.extend(KJUR.asn1.x509.CRLEntry,KJUR.asn1.ASN1Object);KJUR.asn1.x509.X500Name=function(f){KJUR.asn1.x509.X500Name.superclass.constructor.call(this);this.asn1Array=new Array();var d=KJUR,c=d.asn1,e=c.x509,b=pemtohex;this.setByString=function(g){var h=g.split("/");h.shift();for(var j=0;j0;f++){var h=c.shift();if(e===true){var d=b.pop();var j=(d+","+h).replace(/\\,/g,",");b.push(j);e=false}else{b.push(h)}if(h.substr(-1,1)==="\\"){e=true}}b=b.map(function(a){return a.replace("/","\\/")});b.reverse();return"/"+b.join("/")};KJUR.asn1.x509.RDN=function(a){KJUR.asn1.x509.RDN.superclass.constructor.call(this);this.asn1Array=new Array();this.addByString=function(b){this.asn1Array.push(new KJUR.asn1.x509.AttributeTypeAndValue({str:b}))};this.addByMultiValuedString=function(d){var b=KJUR.asn1.x509.RDN.parseString(d);for(var c=0;c0;g++){var k=j.shift();if(h===true){var f=c.pop();var d=(f+"+"+k).replace(/\\\+/g,"+");c.push(d);h=false}else{c.push(k)}if(k.substr(-1,1)==="\\"){h=true}}var l=false;var b=[];for(var g=0;c.length>0;g++){var k=c.shift();if(l===true){var e=b.pop();if(k.match(/"$/)){var d=(e+"+"+k).replace(/^([^=]+)="(.*)"$/,"$1=$2");b.push(d);l=false}else{b.push(e+"+"+k)}}else{b.push(k)}if(k.match(/^[^=]+="/)){l=true}}return b};KJUR.asn1.x509.AttributeTypeAndValue=function(d){KJUR.asn1.x509.AttributeTypeAndValue.superclass.constructor.call(this);var f=null,e=null,a="utf8",c=KJUR,b=c.asn1;this.setByString=function(h){var g=h.match(/^([^=]+)=(.+)$/);if(g){this.setByAttrTypeAndValueStr(g[1],g[2])}else{throw"malformed attrTypeAndValueStr: "+h}};this.setByAttrTypeAndValueStr=function(i,h){this.typeObj=KJUR.asn1.x509.OID.atype2obj(i);var g=a;if(i=="C"){g="prn"}this.valueObj=this.getValueObj(g,h)};this.getValueObj=function(h,g){if(h=="utf8"){return new b.DERUTF8String({str:g})}if(h=="prn"){return new b.DERPrintableString({str:g})}if(h=="tel"){return new b.DERTeletexString({str:g})}if(h=="ia5"){return new b.DERIA5String({str:g})}throw"unsupported directory string type: type="+h+" value="+g};this.getEncodedHex=function(){var g=new b.DERSequence({array:[this.typeObj,this.valueObj]});this.TLV=g.getEncodedHex();return this.TLV};if(typeof d!="undefined"){if(typeof d.str!="undefined"){this.setByString(d.str)}}};YAHOO.lang.extend(KJUR.asn1.x509.AttributeTypeAndValue,KJUR.asn1.ASN1Object);KJUR.asn1.x509.SubjectPublicKeyInfo=function(f){KJUR.asn1.x509.SubjectPublicKeyInfo.superclass.constructor.call(this);var l=null,k=null,a=KJUR,j=a.asn1,i=j.DERInteger,b=j.DERBitString,m=j.DERObjectIdentifier,e=j.DERSequence,h=j.ASN1Util.newObject,d=j.x509,o=d.AlgorithmIdentifier,g=a.crypto,n=g.ECDSA,c=g.DSA;this.getASN1Object=function(){if(this.asn1AlgId==null||this.asn1SubjPKey==null){throw"algId and/or subjPubKey not set"}var p=new e({array:[this.asn1AlgId,this.asn1SubjPKey]});return p};this.getEncodedHex=function(){var p=this.getASN1Object();this.hTLV=p.getEncodedHex();return this.hTLV};this.setPubKey=function(q){try{if(q instanceof RSAKey){var u=h({seq:[{"int":{bigint:q.n}},{"int":{"int":q.e}}]});var s=u.getEncodedHex();this.asn1AlgId=new o({name:"rsaEncryption"});this.asn1SubjPKey=new b({hex:"00"+s})}}catch(p){}try{if(q instanceof KJUR.crypto.ECDSA){var r=new m({name:q.curveName});this.asn1AlgId=new o({name:"ecPublicKey",asn1params:r});this.asn1SubjPKey=new b({hex:"00"+q.pubKeyHex})}}catch(p){}try{if(q instanceof KJUR.crypto.DSA){var r=new h({seq:[{"int":{bigint:q.p}},{"int":{bigint:q.q}},{"int":{bigint:q.g}}]});this.asn1AlgId=new o({name:"dsa",asn1params:r});var t=new i({bigint:q.y});this.asn1SubjPKey=new b({hex:"00"+t.getEncodedHex()})}}catch(p){}};if(f!==undefined){this.setPubKey(f)}};YAHOO.lang.extend(KJUR.asn1.x509.SubjectPublicKeyInfo,KJUR.asn1.ASN1Object);KJUR.asn1.x509.Time=function(f){KJUR.asn1.x509.Time.superclass.constructor.call(this);var e=null,a=null,d=KJUR,c=d.asn1,b=c.DERUTCTime,g=c.DERGeneralizedTime;this.setTimeParams=function(h){this.timeParams=h};this.getEncodedHex=function(){var h=null;if(this.timeParams!=null){if(this.type=="utc"){h=new b(this.timeParams)}else{h=new g(this.timeParams)}}else{if(this.type=="utc"){h=new b()}else{h=new g()}}this.TLV=h.getEncodedHex();return this.TLV};this.type="utc";if(f!==undefined){if(f.type!==undefined){this.type=f.type}else{if(f.str!==undefined){if(f.str.match(/^[0-9]{12}Z$/)){this.type="utc"}if(f.str.match(/^[0-9]{14}Z$/)){this.type="gen"}}}this.timeParams=f}};YAHOO.lang.extend(KJUR.asn1.x509.Time,KJUR.asn1.ASN1Object);KJUR.asn1.x509.AlgorithmIdentifier=function(d){KJUR.asn1.x509.AlgorithmIdentifier.superclass.constructor.call(this);this.nameAlg=null;this.asn1Alg=null;this.asn1Params=null;this.paramEmpty=false;var b=KJUR,a=b.asn1;this.getEncodedHex=function(){if(this.nameAlg===null&&this.asn1Alg===null){throw"algorithm not specified"}if(this.nameAlg!==null&&this.asn1Alg===null){this.asn1Alg=a.x509.OID.name2obj(this.nameAlg)}var e=[this.asn1Alg];if(this.asn1Params!==null){e.push(this.asn1Params)}var f=new a.DERSequence({array:e});this.hTLV=f.getEncodedHex();return this.hTLV};if(d!==undefined){if(d.name!==undefined){this.nameAlg=d.name}if(d.asn1params!==undefined){this.asn1Params=d.asn1params}if(d.paramempty!==undefined){this.paramEmpty=d.paramempty}}if(this.asn1Params===null&&this.paramEmpty===false&&this.nameAlg!==null){var c=this.nameAlg.toLowerCase();if(c.substr(-7,7)!=="withdsa"&&c.substr(-9,9)!=="withecdsa"){this.asn1Params=new a.DERNull()}}};YAHOO.lang.extend(KJUR.asn1.x509.AlgorithmIdentifier,KJUR.asn1.ASN1Object);KJUR.asn1.x509.GeneralName=function(e){KJUR.asn1.x509.GeneralName.superclass.constructor.call(this);var k=null,h=null,i={rfc822:"81",dns:"82",dn:"a4",uri:"86"},b=KJUR,f=b.asn1,d=f.DERIA5String,c=f.DERTaggedObject,j=f.ASN1Object,a=f.x509.X500Name,g=pemtohex;this.explicit=false;this.setByParam=function(r){var q=null;var n=null;if(r===undefined){return}if(r.rfc822!==undefined){this.type="rfc822";n=new d({str:r[this.type]})}if(r.dns!==undefined){this.type="dns";n=new d({str:r[this.type]})}if(r.uri!==undefined){this.type="uri";n=new d({str:r[this.type]})}if(r.dn!==undefined){this.type="dn";n=new a({str:r.dn})}if(r.ldapdn!==undefined){this.type="dn";n=new a({ldapstr:r.ldapdn})}if(r.certissuer!==undefined){this.type="dn";this.explicit=true;var o=r.certissuer;var m=null;if(o.match(/^[0-9A-Fa-f]+$/)){m==o}if(o.indexOf("-----BEGIN ")!=-1){m=g(o)}if(m==null){throw"certissuer param not cert"}var l=new X509();l.hex=m;var p=l.getIssuerHex();n=new j();n.hTLV=p}if(r.certsubj!==undefined){this.type="dn";this.explicit=true;var o=r.certsubj;var m=null;if(o.match(/^[0-9A-Fa-f]+$/)){m==o}if(o.indexOf("-----BEGIN ")!=-1){m=g(o)}if(m==null){throw"certsubj param not cert"}var l=new X509();l.hex=m;var p=l.getSubjectHex();n=new j();n.hTLV=p}if(this.type==null){throw"unsupported type in params="+r}this.asn1Obj=new c({explicit:this.explicit,tag:i[this.type],obj:n})};this.getEncodedHex=function(){return this.asn1Obj.getEncodedHex()};if(e!==undefined){this.setByParam(e)}};YAHOO.lang.extend(KJUR.asn1.x509.GeneralName,KJUR.asn1.ASN1Object);KJUR.asn1.x509.GeneralNames=function(d){KJUR.asn1.x509.GeneralNames.superclass.constructor.call(this);var a=null,c=KJUR,b=c.asn1;this.setByParamArray=function(g){for(var e=0;e0){r=new b({obj:this.dUnsignedAttrs,tag:"a1",explicit:false})}var q=[this.dCMSVersion,this.dSignerIdentifier,this.dDigestAlgorithm,o,this.dSigAlg,this.dSig,];if(r!=null){q.push(r)}var p=new h.DERSequence({array:q});this.hTLV=p.getEncodedHex();return this.hTLV}};YAHOO.lang.extend(KJUR.asn1.cms.SignerInfo,KJUR.asn1.ASN1Object);KJUR.asn1.cms.EncapsulatedContentInfo=function(g){var c=KJUR,b=c.asn1,e=b.DERTaggedObject,a=b.DERSequence,h=b.DERObjectIdentifier,d=b.DEROctetString,f=b.cms;f.EncapsulatedContentInfo.superclass.constructor.call(this);this.dEContentType=new h({name:"data"});this.dEContent=null;this.isDetached=false;this.eContentValueHex=null;this.setContentType=function(i){if(i.match(/^[0-2][.][0-9.]+$/)){this.dEContentType=new h({oid:i})}else{this.dEContentType=new h({name:i})}};this.setContentValue=function(i){if(i!==undefined){if(typeof i.hex=="string"){this.eContentValueHex=i.hex}else{if(typeof i.str=="string"){this.eContentValueHex=utf8tohex(i.str)}}}};this.setContentValueHex=function(i){this.eContentValueHex=i};this.setContentValueStr=function(i){this.eContentValueHex=utf8tohex(i)};this.getEncodedHex=function(){if(typeof this.eContentValueHex!="string"){throw"eContentValue not yet set"}var k=new d({hex:this.eContentValueHex});this.dEContent=new e({obj:k,tag:"a0",explicit:true});var i=[this.dEContentType];if(!this.isDetached){i.push(this.dEContent)}var j=new a({array:i});this.hTLV=j.getEncodedHex();return this.hTLV}};YAHOO.lang.extend(KJUR.asn1.cms.EncapsulatedContentInfo,KJUR.asn1.ASN1Object);KJUR.asn1.cms.ContentInfo=function(f){var c=KJUR,b=c.asn1,d=b.DERTaggedObject,a=b.DERSequence,e=b.x509;KJUR.asn1.cms.ContentInfo.superclass.constructor.call(this);this.dContentType=null;this.dContent=null;this.setContentType=function(g){if(typeof g=="string"){this.dContentType=e.OID.name2obj(g)}};this.getEncodedHex=function(){var h=new d({obj:this.dContent,tag:"a0",explicit:true});var g=new a({array:[this.dContentType,h]});this.hTLV=g.getEncodedHex();return this.hTLV};if(f!==undefined){if(f.type){this.setContentType(f.type)}if(f.obj&&f.obj instanceof b.ASN1Object){this.dContent=f.obj}}};YAHOO.lang.extend(KJUR.asn1.cms.ContentInfo,KJUR.asn1.ASN1Object);KJUR.asn1.cms.SignedData=function(e){var a=KJUR,h=a.asn1,j=h.ASN1Object,g=h.DERInteger,m=h.DERSet,f=h.DERSequence,b=h.DERTaggedObject,l=h.cms,i=l.EncapsulatedContentInfo,d=l.SignerInfo,n=l.ContentInfo,c=h.x509,k=c.AlgorithmIdentifier;KJUR.asn1.cms.SignedData.superclass.constructor.call(this);this.dCMSVersion=new g({"int":1});this.dDigestAlgs=null;this.digestAlgNameList=[];this.dEncapContentInfo=new i();this.dCerts=null;this.certificateList=[];this.crlList=[];this.signerInfoList=[new d()];this.addCertificatesByPEM=function(p){var q=pemtohex(p);var r=new j();r.hTLV=q;this.certificateList.push(r)};this.getEncodedHex=function(){if(typeof this.hTLV=="string"){return this.hTLV}if(this.dDigestAlgs==null){var u=[];for(var t=0;t0){var v=new m({array:this.certificateList});this.dCerts=new b({obj:v,tag:"a0",explicit:false})}}if(this.dCerts!=null){p.push(this.dCerts)}var r=new m({array:this.signerInfoList});p.push(r);var q=new f({array:p});this.hTLV=q.getEncodedHex();return this.hTLV};this.getContentInfo=function(){this.getEncodedHex();var o=new n({type:"signed-data",obj:this});return o};this.getContentInfoEncodedHex=function(){var o=this.getContentInfo();var p=o.getEncodedHex();return p};this.getPEM=function(){return hextopem(this.getContentInfoEncodedHex(),"CMS")}};YAHOO.lang.extend(KJUR.asn1.cms.SignedData,KJUR.asn1.ASN1Object);KJUR.asn1.cms.CMSUtil=new function(){};KJUR.asn1.cms.CMSUtil.newSignedData=function(d){var b=KJUR,j=b.asn1,q=j.cms,f=q.SignerInfo,n=q.SignedData,o=q.SigningTime,a=q.SigningCertificate,p=q.SigningCertificateV2,c=j.cades,e=c.SignaturePolicyIdentifier;var m=new n();m.dEncapContentInfo.setContentValue(d.content);if(typeof d.certs=="object"){for(var h=0;h0){var s=new f({array:this.extensionsArray});var r=new m({array:[s]});var q=new f({array:[new k({oid:"1.2.840.113549.1.9.14"}),r]});var p=new c({explicit:true,tag:"a0",obj:q});this.asn1Array.push(p)}else{var p=new c({explicit:false,tag:"a0",obj:new j()});this.asn1Array.push(p)}var t=new f({array:this.asn1Array});this.hTLV=t.getEncodedHex();this.isModified=false;return this.hTLV};this._initialize()};YAHOO.lang.extend(KJUR.asn1.csr.CertificationRequestInfo,KJUR.asn1.ASN1Object);KJUR.asn1.csr.CSRUtil=new function(){};KJUR.asn1.csr.CSRUtil.newCSRPEM=function(h){var c=KEYUTIL,b=KJUR.asn1.csr;if(h.subject===undefined){throw"parameter subject undefined"}if(h.sbjpubkey===undefined){throw"parameter sbjpubkey undefined"}if(h.sigalg===undefined){throw"parameter sigalg undefined"}if(h.sbjprvkey===undefined){throw"parameter sbjpubkey undefined"}var d=new b.CertificationRequestInfo();d.setSubjectByParam(h.subject);d.setSubjectPublicKeyByGetKey(h.sbjpubkey);if(h.ext!==undefined&&h.ext.length!==undefined){for(var e=0;e"7"){return"00"+a}return a}function intarystrtohex(b){b=b.replace(/^\s*\[\s*/,"");b=b.replace(/\s*\]\s*$/,"");b=b.replace(/\s*/g,"");try{var c=b.split(/,/).map(function(g,e,h){var f=parseInt(g);if(f<0||255a.length){d=a.length}for(var b=0;bd){throw"key is too short for SigAlg: keylen="+j+","+a}var b="0001";var k="00"+c;var g="";var l=d-b.length-k.length;for(var f=0;f=0;--p){q=q.twice2D();q.z=BigInteger.ONE;if(o.testBit(p)){if(n.testBit(p)){q=q.add2D(t)}else{q=q.add2D(s)}}else{if(n.testBit(p)){q=q.add2D(r)}}}return q}this.getBigRandom=function(i){return new BigInteger(i.bitLength(),a).mod(i.subtract(BigInteger.ONE)).add(BigInteger.ONE)};this.setNamedCurve=function(i){this.ecparams=KJUR.crypto.ECParameterDB.getByName(i);this.prvKeyHex=null;this.pubKeyHex=null;this.curveName=i};this.setPrivateKeyHex=function(i){this.isPrivate=true;this.prvKeyHex=i};this.setPublicKeyHex=function(i){this.isPublic=true;this.pubKeyHex=i};this.getPublicKeyXYHex=function(){var k=this.pubKeyHex;if(k.substr(0,2)!=="04"){throw"this method supports uncompressed format(04) only"}var j=this.ecparams.keylen/4;if(k.length!==2+j*2){throw"malformed public key hex length"}var i={};i.x=k.substr(2,j);i.y=k.substr(2+j);return i};this.getShortNISTPCurveName=function(){var i=this.curveName;if(i==="secp256r1"||i==="NIST P-256"||i==="P-256"||i==="prime256v1"){return"P-256"}if(i==="secp384r1"||i==="NIST P-384"||i==="P-384"){return"P-384"}return null};this.generateKeyPairHex=function(){var k=this.ecparams.n;var n=this.getBigRandom(k);var l=this.ecparams.G.multiply(n);var q=l.getX().toBigInteger();var o=l.getY().toBigInteger();var i=this.ecparams.keylen/4;var m=("0000000000"+n.toString(16)).slice(-i);var r=("0000000000"+q.toString(16)).slice(-i);var p=("0000000000"+o.toString(16)).slice(-i);var j="04"+r+p;this.setPrivateKeyHex(m);this.setPublicKeyHex(j);return{ecprvhex:m,ecpubhex:j}};this.signWithMessageHash=function(i){return this.signHex(i,this.prvKeyHex)};this.signHex=function(o,j){var t=new BigInteger(j,16);var l=this.ecparams.n;var q=new BigInteger(o,16);do{var m=this.getBigRandom(l);var u=this.ecparams.G;var p=u.multiply(m);var i=p.getX().toBigInteger().mod(l)}while(i.compareTo(BigInteger.ZERO)<=0);var v=m.modInverse(l).multiply(q.add(t.multiply(i))).mod(l);return KJUR.crypto.ECDSA.biRSSigToASN1Sig(i,v)};this.sign=function(m,u){var q=u;var j=this.ecparams.n;var p=BigInteger.fromByteArrayUnsigned(m);do{var l=this.getBigRandom(j);var t=this.ecparams.G;var o=t.multiply(l);var i=o.getX().toBigInteger().mod(j)}while(i.compareTo(BigInteger.ZERO)<=0);var v=l.modInverse(j).multiply(p.add(q.multiply(i))).mod(j);return this.serializeSig(i,v)};this.verifyWithMessageHash=function(j,i){return this.verifyHex(j,i,this.pubKeyHex)};this.verifyHex=function(m,i,p){var l,j;var o=KJUR.crypto.ECDSA.parseSigHex(i);l=o.r;j=o.s;var k;k=ECPointFp.decodeFromHex(this.ecparams.curve,p);var n=new BigInteger(m,16);return this.verifyRaw(n,l,j,k)};this.verify=function(o,p,j){var l,i;if(Bitcoin.Util.isArray(p)){var n=this.parseSig(p);l=n.r;i=n.s}else{if("object"===typeof p&&p.r&&p.s){l=p.r;i=p.s}else{throw"Invalid value for signature"}}var k;if(j instanceof ECPointFp){k=j}else{if(Bitcoin.Util.isArray(j)){k=ECPointFp.decodeFrom(this.ecparams.curve,j)}else{throw"Invalid format for pubkey value, must be byte array or ECPointFp"}}var m=BigInteger.fromByteArrayUnsigned(o);return this.verifyRaw(m,l,i,k)};this.verifyRaw=function(o,i,w,m){var l=this.ecparams.n;var u=this.ecparams.G;if(i.compareTo(BigInteger.ONE)<0||i.compareTo(l)>=0){return false}if(w.compareTo(BigInteger.ONE)<0||w.compareTo(l)>=0){return false}var p=w.modInverse(l);var k=o.multiply(p).mod(l);var j=i.multiply(p).mod(l);var q=u.multiply(k).add(m.multiply(j));var t=q.getX().toBigInteger().mod(l);return t.equals(i)};this.serializeSig=function(k,j){var l=k.toByteArraySigned();var i=j.toByteArraySigned();var m=[];m.push(2);m.push(l.length);m=m.concat(l);m.push(2);m.push(i.length);m=m.concat(i);m.unshift(m.length);m.unshift(48);return m};this.parseSig=function(n){var m;if(n[0]!=48){throw new Error("Signature not a valid DERSequence")}m=2;if(n[m]!=2){throw new Error("First element in signature must be a DERInteger")}var l=n.slice(m+2,m+2+n[m+1]);m+=2+n[m+1];if(n[m]!=2){throw new Error("Second element in signature must be a DERInteger")}var i=n.slice(m+2,m+2+n[m+1]);m+=2+n[m+1];var k=BigInteger.fromByteArrayUnsigned(l);var j=BigInteger.fromByteArrayUnsigned(i);return{r:k,s:j}};this.parseSigCompact=function(m){if(m.length!==65){throw"Signature has the wrong length"}var j=m[0]-27;if(j<0||j>7){throw"Invalid signature type"}var o=this.ecparams.n;var l=BigInteger.fromByteArrayUnsigned(m.slice(1,33)).mod(o);var k=BigInteger.fromByteArrayUnsigned(m.slice(33,65)).mod(o);return{r:l,s:k,i:j}};this.readPKCS5PrvKeyHex=function(l){var n=ASN1HEX;var m=KJUR.crypto.ECDSA.getName;var p=n.getVbyList;if(n.isASN1HEX(l)===false){throw"not ASN.1 hex string"}var i,k,o;try{i=p(l,0,[2,0],"06");k=p(l,0,[1],"04");try{o=p(l,0,[3,0],"03").substr(2)}catch(j){}}catch(j){throw"malformed PKCS#1/5 plain ECC private key"}this.curveName=m(i);if(this.curveName===undefined){throw"unsupported curve name"}this.setNamedCurve(this.curveName);this.setPublicKeyHex(o);this.setPrivateKeyHex(k);this.isPublic=false};this.readPKCS8PrvKeyHex=function(l){var q=ASN1HEX;var i=KJUR.crypto.ECDSA.getName;var n=q.getVbyList;if(q.isASN1HEX(l)===false){throw"not ASN.1 hex string"}var j,p,m,k;try{j=n(l,0,[1,0],"06");p=n(l,0,[1,1],"06");m=n(l,0,[2,0,1],"04");try{k=n(l,0,[2,0,2,0],"03").substr(2)}catch(o){}}catch(o){throw"malformed PKCS#8 plain ECC private key"}this.curveName=i(p);if(this.curveName===undefined){throw"unsupported curve name"}this.setNamedCurve(this.curveName);this.setPublicKeyHex(k);this.setPrivateKeyHex(m);this.isPublic=false};this.readPKCS8PubKeyHex=function(l){var n=ASN1HEX;var m=KJUR.crypto.ECDSA.getName;var p=n.getVbyList;if(n.isASN1HEX(l)===false){throw"not ASN.1 hex string"}var k,i,o;try{k=p(l,0,[0,0],"06");i=p(l,0,[0,1],"06");o=p(l,0,[1],"03").substr(2)}catch(j){throw"malformed PKCS#8 ECC public key"}this.curveName=m(i);if(this.curveName===null){throw"unsupported curve name"}this.setNamedCurve(this.curveName);this.setPublicKeyHex(o)};this.readCertPubKeyHex=function(k,p){if(p!==5){p=6}var m=ASN1HEX;var l=KJUR.crypto.ECDSA.getName;var o=m.getVbyList;if(m.isASN1HEX(k)===false){throw"not ASN.1 hex string"}var i,n;try{i=o(k,0,[0,p,0,1],"06");n=o(k,0,[0,p,1],"03").substr(2)}catch(j){throw"malformed X.509 certificate ECC public key"}this.curveName=l(i);if(this.curveName===null){throw"unsupported curve name"}this.setNamedCurve(this.curveName);this.setPublicKeyHex(n)};if(h!==undefined){if(h.curve!==undefined){this.curveName=h.curve}}if(this.curveName===undefined){this.curveName=e}this.setNamedCurve(this.curveName);if(h!==undefined){if(h.prv!==undefined){this.setPrivateKeyHex(h.prv)}if(h.pub!==undefined){this.setPublicKeyHex(h.pub)}}};KJUR.crypto.ECDSA.parseSigHex=function(a){var b=KJUR.crypto.ECDSA.parseSigHexInHexRS(a);var d=new BigInteger(b.r,16);var c=new BigInteger(b.s,16);return{r:d,s:c}};KJUR.crypto.ECDSA.parseSigHexInHexRS=function(f){var j=ASN1HEX;var i=j.getChildIdx;var g=j.getV;if(f.substr(0,2)!="30"){throw"signature is not a ASN.1 sequence"}var h=i(f,0);if(h.length!=2){throw"number of signature ASN.1 sequence elements seem wrong"}var e=h[0];var d=h[1];if(f.substr(e,2)!="02"){throw"1st item of sequene of signature is not ASN.1 integer"}if(f.substr(d,2)!="02"){throw"2nd item of sequene of signature is not ASN.1 integer"}var c=g(f,e);var b=g(f,d);return{r:c,s:b}};KJUR.crypto.ECDSA.asn1SigToConcatSig=function(c){var d=KJUR.crypto.ECDSA.parseSigHexInHexRS(c);var b=d.r;var a=d.s;if(b.substr(0,2)=="00"&&(((b.length/2)*8)%(16*8))==8){b=b.substr(2)}if(a.substr(0,2)=="00"&&(((a.length/2)*8)%(16*8))==8){a=a.substr(2)}if((((b.length/2)*8)%(16*8))!=0){throw"unknown ECDSA sig r length error"}if((((a.length/2)*8)%(16*8))!=0){throw"unknown ECDSA sig s length error"}return b+a};KJUR.crypto.ECDSA.concatSigToASN1Sig=function(a){if((((a.length/2)*8)%(16*8))!=0){throw"unknown ECDSA concatinated r-s sig length error"}var c=a.substr(0,a.length/2);var b=a.substr(a.length/2);return KJUR.crypto.ECDSA.hexRSSigToASN1Sig(c,b)};KJUR.crypto.ECDSA.hexRSSigToASN1Sig=function(b,a){var d=new BigInteger(b,16);var c=new BigInteger(a,16);return KJUR.crypto.ECDSA.biRSSigToASN1Sig(d,c)};KJUR.crypto.ECDSA.biRSSigToASN1Sig=function(f,d){var c=KJUR.asn1;var b=new c.DERInteger({bigint:f});var a=new c.DERInteger({bigint:d});var e=new c.DERSequence({array:[b,a]});return e.getEncodedHex()};KJUR.crypto.ECDSA.getName=function(a){if(a==="2a8648ce3d030107"){return"secp256r1"}if(a==="2b8104000a"){return"secp256k1"}if(a==="2b81040022"){return"secp384r1"}if("|secp256r1|NIST P-256|P-256|prime256v1|".indexOf(a)!==-1){return"secp256r1"}if("|secp256k1|".indexOf(a)!==-1){return"secp256k1"}if("|secp384r1|NIST P-384|P-384|".indexOf(a)!==-1){return"secp384r1"}return null}; -if(typeof KJUR=="undefined"||!KJUR){KJUR={}}if(typeof KJUR.crypto=="undefined"||!KJUR.crypto){KJUR.crypto={}}KJUR.crypto.ECParameterDB=new function(){var b={};var c={};function a(d){return new BigInteger(d,16)}this.getByName=function(e){var d=e;if(typeof c[d]!="undefined"){d=c[e]}if(typeof b[d]!="undefined"){return b[d]}throw"unregistered EC curve name: "+d};this.regist=function(A,l,o,g,m,e,j,f,k,u,d,x){b[A]={};var s=a(o);var z=a(g);var y=a(m);var t=a(e);var w=a(j);var r=new ECCurveFp(s,z,y);var q=r.decodePointHex("04"+f+k);b[A]["name"]=A;b[A]["keylen"]=l;b[A]["curve"]=r;b[A]["G"]=q;b[A]["n"]=t;b[A]["h"]=w;b[A]["oid"]=d;b[A]["info"]=x;for(var v=0;v1){g=new BigInteger(i,16)}else{g=null}h=new BigInteger(j,16);this.setPrivate(c,a,e,g,h)};this.setPublic=function(c,b,a,d){this.isPublic=true;this.p=c;this.q=b;this.g=a;this.y=d;this.x=null};this.setPublicHex=function(f,e,d,g){var b,a,h,c;b=new BigInteger(f,16);a=new BigInteger(e,16);h=new BigInteger(d,16);c=new BigInteger(g,16);this.setPublic(b,a,h,c)};this.signWithMessageHash=function(d){var c=this.p;var b=this.q;var f=this.g;var i=this.y;var j=this.x;var e=KJUR.crypto.Util.getRandomBigIntegerMinToMax(BigInteger.ONE.add(BigInteger.ONE),b.subtract(BigInteger.ONE));var l=d.substr(0,b.bitLength()/4);var h=new BigInteger(l,16);var a=(f.modPow(e,c)).mod(b);var n=(e.modInverse(b).multiply(h.add(j.multiply(a)))).mod(b);var m=KJUR.asn1.ASN1Util.jsonToASN1HEX({seq:[{"int":{bigint:a}},{"int":{bigint:n}}]});return m};this.verifyWithMessageHash=function(h,f){var d=this.p;var b=this.q;var j=this.g;var l=this.y;var i=this.parseASN1Signature(f);var a=i[0];var t=i[1];var o=h.substr(0,b.bitLength()/4);var k=new BigInteger(o,16);if(BigInteger.ZERO.compareTo(a)>0||a.compareTo(b)>0){throw"invalid DSA signature"}if(BigInteger.ZERO.compareTo(t)>=0||t.compareTo(b)>0){throw"invalid DSA signature"}var m=t.modInverse(b);var e=k.multiply(m).mod(b);var c=a.multiply(m).mod(b);var n=j.modPow(e,d).multiply(l.modPow(c,d)).mod(d).mod(b);return n.compareTo(a)==0};this.parseASN1Signature=function(a){try{var d=new BigInteger(ASN1HEX.getVbyList(a,0,[0],"02"),16);var c=new BigInteger(ASN1HEX.getVbyList(a,0,[1],"02"),16);return[d,c]}catch(b){throw"malformed ASN.1 DSA signature"}};this.readPKCS5PrvKeyHex=function(c){var b,a,f,g,i;var j=ASN1HEX;var d=j.getVbyList;if(j.isASN1HEX(c)===false){throw"not ASN.1 hex string"}try{b=d(c,0,[1],"02");a=d(c,0,[2],"02");f=d(c,0,[3],"02");g=d(c,0,[4],"02");i=d(c,0,[5],"02")}catch(e){console.log("EXCEPTION:"+e);throw"malformed PKCS#1/5 plain DSA private key"}this.setPrivateHex(b,a,f,g,i)};this.readPKCS8PrvKeyHex=function(d){var f,c,b,g;var e=ASN1HEX;var i=e.getVbyList;if(e.isASN1HEX(d)===false){throw"not ASN.1 hex string"}try{f=i(d,0,[1,1,0],"02");c=i(d,0,[1,1,1],"02");b=i(d,0,[1,1,2],"02");g=i(d,0,[2,0],"02")}catch(a){console.log("EXCEPTION:"+a);throw"malformed PKCS#8 plain DSA private key"}this.setPrivateHex(f,c,b,null,g)};this.readPKCS8PubKeyHex=function(d){var f,c,b,g;var e=ASN1HEX;var i=e.getVbyList;if(e.isASN1HEX(d)===false){throw"not ASN.1 hex string"}try{f=i(d,0,[0,1,0],"02");c=i(d,0,[0,1,1],"02");b=i(d,0,[0,1,2],"02");g=i(d,0,[1,0],"02")}catch(a){console.log("EXCEPTION:"+a);throw"malformed PKCS#8 DSA public key"}this.setPublicHex(f,c,b,g)};this.readCertPubKeyHex=function(c,f){if(f!==5){f=6}var b,a,g,i;var j=ASN1HEX;var d=j.getVbyList;if(j.isASN1HEX(c)===false){throw"not ASN.1 hex string"}try{b=d(c,0,[0,f,0,1,0],"02");a=d(c,0,[0,f,0,1,1],"02");g=d(c,0,[0,f,0,1,2],"02");i=d(c,0,[0,f,1,0],"02")}catch(e){console.log("EXCEPTION:"+e);throw"malformed X.509 certificate DSA public key"}this.setPublicHex(b,a,g,i)}}; -var KEYUTIL=function(){var d=function(p,r,q){return k(CryptoJS.AES,p,r,q)};var e=function(p,r,q){return k(CryptoJS.TripleDES,p,r,q)};var a=function(p,r,q){return k(CryptoJS.DES,p,r,q)};var k=function(s,x,u,q){var r=CryptoJS.enc.Hex.parse(x);var w=CryptoJS.enc.Hex.parse(u);var p=CryptoJS.enc.Hex.parse(q);var t={};t.key=w;t.iv=p;t.ciphertext=r;var v=s.decrypt(t,w,{iv:p});return CryptoJS.enc.Hex.stringify(v)};var l=function(p,r,q){return g(CryptoJS.AES,p,r,q)};var o=function(p,r,q){return g(CryptoJS.TripleDES,p,r,q)};var f=function(p,r,q){return g(CryptoJS.DES,p,r,q)};var g=function(t,y,v,q){var s=CryptoJS.enc.Hex.parse(y);var x=CryptoJS.enc.Hex.parse(v);var p=CryptoJS.enc.Hex.parse(q);var w=t.encrypt(s,x,{iv:p});var r=CryptoJS.enc.Hex.parse(w.toString());var u=CryptoJS.enc.Base64.stringify(r);return u};var i={"AES-256-CBC":{proc:d,eproc:l,keylen:32,ivlen:16},"AES-192-CBC":{proc:d,eproc:l,keylen:24,ivlen:16},"AES-128-CBC":{proc:d,eproc:l,keylen:16,ivlen:16},"DES-EDE3-CBC":{proc:e,eproc:o,keylen:24,ivlen:8},"DES-CBC":{proc:a,eproc:f,keylen:8,ivlen:8}};var c=function(p){return i[p]["proc"]};var m=function(p){var r=CryptoJS.lib.WordArray.random(p);var q=CryptoJS.enc.Hex.stringify(r);return q};var n=function(v){var w={};var q=v.match(new RegExp("DEK-Info: ([^,]+),([0-9A-Fa-f]+)","m"));if(q){w.cipher=q[1];w.ivsalt=q[2]}var p=v.match(new RegExp("-----BEGIN ([A-Z]+) PRIVATE KEY-----"));if(p){w.type=p[1]}var u=-1;var x=0;if(v.indexOf("\r\n\r\n")!=-1){u=v.indexOf("\r\n\r\n");x=2}if(v.indexOf("\n\n")!=-1){u=v.indexOf("\n\n");x=1}var t=v.indexOf("-----END");if(u!=-1&&t!=-1){var r=v.substring(u+x*2,t-x);r=r.replace(/\s+/g,"");w.data=r}return w};var j=function(q,y,p){var v=p.substring(0,16);var t=CryptoJS.enc.Hex.parse(v);var r=CryptoJS.enc.Utf8.parse(y);var u=i[q]["keylen"]+i[q]["ivlen"];var x="";var w=null;for(;;){var s=CryptoJS.algo.MD5.create();if(w!=null){s.update(w)}s.update(r);s.update(t);w=s.finalize();x=x+CryptoJS.enc.Hex.stringify(w);if(x.length>=u*2){break}}var z={};z.keyhex=x.substr(0,i[q]["keylen"]*2);z.ivhex=x.substr(i[q]["keylen"]*2,i[q]["ivlen"]*2);return z};var b=function(p,v,r,w){var s=CryptoJS.enc.Base64.parse(p);var q=CryptoJS.enc.Hex.stringify(s);var u=i[v]["proc"];var t=u(q,r,w);return t};var h=function(p,s,q,u){var r=i[s]["eproc"];var t=r(p,q,u);return t};return{version:"1.0.0",parsePKCS5PEM:function(p){return n(p)},getKeyAndUnusedIvByPasscodeAndIvsalt:function(q,p,r){return j(q,p,r)},decryptKeyB64:function(p,r,q,s){return b(p,r,q,s)},getDecryptedKeyHex:function(y,x){var q=n(y);var t=q.type;var r=q.cipher;var p=q.ivsalt;var s=q.data;var w=j(r,x,p);var v=w.keyhex;var u=b(s,r,v,p);return u},getEncryptedPKCS5PEMFromPrvKeyHex:function(x,s,A,t,r){var p="";if(typeof t=="undefined"||t==null){t="AES-256-CBC"}if(typeof i[t]=="undefined"){throw"KEYUTIL unsupported algorithm: "+t}if(typeof r=="undefined"||r==null){var v=i[t]["ivlen"];var u=m(v);r=u.toUpperCase()}var z=j(t,A,r);var y=z.keyhex;var w=h(s,t,y,r);var q=w.replace(/(.{64})/g,"$1\r\n");var p="-----BEGIN "+x+" PRIVATE KEY-----\r\n";p+="Proc-Type: 4,ENCRYPTED\r\n";p+="DEK-Info: "+t+","+r+"\r\n";p+="\r\n";p+=q;p+="\r\n-----END "+x+" PRIVATE KEY-----\r\n";return p},parseHexOfEncryptedPKCS8:function(y){var B=ASN1HEX;var z=B.getChildIdx;var w=B.getV;var t={};var r=z(y,0);if(r.length!=2){throw"malformed format: SEQUENCE(0).items != 2: "+r.length}t.ciphertext=w(y,r[1]);var A=z(y,r[0]);if(A.length!=2){throw"malformed format: SEQUENCE(0.0).items != 2: "+A.length}if(w(y,A[0])!="2a864886f70d01050d"){throw"this only supports pkcs5PBES2"}var p=z(y,A[1]);if(A.length!=2){throw"malformed format: SEQUENCE(0.0.1).items != 2: "+p.length}var q=z(y,p[1]);if(q.length!=2){throw"malformed format: SEQUENCE(0.0.1.1).items != 2: "+q.length}if(w(y,q[0])!="2a864886f70d0307"){throw"this only supports TripleDES"}t.encryptionSchemeAlg="TripleDES";t.encryptionSchemeIV=w(y,q[1]);var s=z(y,p[0]);if(s.length!=2){throw"malformed format: SEQUENCE(0.0.1.0).items != 2: "+s.length}if(w(y,s[0])!="2a864886f70d01050c"){throw"this only supports pkcs5PBKDF2"}var x=z(y,s[1]);if(x.length<2){throw"malformed format: SEQUENCE(0.0.1.0.1).items < 2: "+x.length}t.pbkdf2Salt=w(y,x[0]);var u=w(y,x[1]);try{t.pbkdf2Iter=parseInt(u,16)}catch(v){throw"malformed format pbkdf2Iter: "+u}return t},getPBKDF2KeyHexFromParam:function(u,p){var t=CryptoJS.enc.Hex.parse(u.pbkdf2Salt);var q=u.pbkdf2Iter;var s=CryptoJS.PBKDF2(p,t,{keySize:192/32,iterations:q});var r=CryptoJS.enc.Hex.stringify(s);return r},_getPlainPKCS8HexFromEncryptedPKCS8PEM:function(x,y){var r=pemtohex(x,"ENCRYPTED PRIVATE KEY");var p=this.parseHexOfEncryptedPKCS8(r);var u=KEYUTIL.getPBKDF2KeyHexFromParam(p,y);var v={};v.ciphertext=CryptoJS.enc.Hex.parse(p.ciphertext);var t=CryptoJS.enc.Hex.parse(u);var s=CryptoJS.enc.Hex.parse(p.encryptionSchemeIV);var w=CryptoJS.TripleDES.decrypt(v,t,{iv:s});var q=CryptoJS.enc.Hex.stringify(w);return q},getKeyFromEncryptedPKCS8PEM:function(s,q){var p=this._getPlainPKCS8HexFromEncryptedPKCS8PEM(s,q);var r=this.getKeyFromPlainPrivatePKCS8Hex(p);return r},parsePlainPrivatePKCS8Hex:function(s){var v=ASN1HEX;var u=v.getChildIdx;var t=v.getV;var q={};q.algparam=null;if(s.substr(0,2)!="30"){throw"malformed plain PKCS8 private key(code:001)"}var r=u(s,0);if(r.length!=3){throw"malformed plain PKCS8 private key(code:002)"}if(s.substr(r[1],2)!="30"){throw"malformed PKCS8 private key(code:003)"}var p=u(s,r[1]);if(p.length!=2){throw"malformed PKCS8 private key(code:004)"}if(s.substr(p[0],2)!="06"){throw"malformed PKCS8 private key(code:005)"}q.algoid=t(s,p[0]);if(s.substr(p[1],2)=="06"){q.algparam=t(s,p[1])}if(s.substr(r[2],2)!="04"){throw"malformed PKCS8 private key(code:006)"}q.keyidx=v.getVidx(s,r[2]);return q},getKeyFromPlainPrivatePKCS8PEM:function(q){var p=pemtohex(q,"PRIVATE KEY");var r=this.getKeyFromPlainPrivatePKCS8Hex(p);return r},getKeyFromPlainPrivatePKCS8Hex:function(p){var q=this.parsePlainPrivatePKCS8Hex(p);var r;if(q.algoid=="2a864886f70d010101"){r=new RSAKey()}else{if(q.algoid=="2a8648ce380401"){r=new KJUR.crypto.DSA()}else{if(q.algoid=="2a8648ce3d0201"){r=new KJUR.crypto.ECDSA()}else{throw"unsupported private key algorithm"}}}r.readPKCS8PrvKeyHex(p);return r},_getKeyFromPublicPKCS8Hex:function(q){var p;var r=ASN1HEX.getVbyList(q,0,[0,0],"06");if(r==="2a864886f70d010101"){p=new RSAKey()}else{if(r==="2a8648ce380401"){p=new KJUR.crypto.DSA()}else{if(r==="2a8648ce3d0201"){p=new KJUR.crypto.ECDSA()}else{throw"unsupported PKCS#8 public key hex"}}}p.readPKCS8PubKeyHex(q);return p},parsePublicRawRSAKeyHex:function(r){var u=ASN1HEX;var t=u.getChildIdx;var s=u.getV;var p={};if(r.substr(0,2)!="30"){throw"malformed RSA key(code:001)"}var q=t(r,0);if(q.length!=2){throw"malformed RSA key(code:002)"}if(r.substr(q[0],2)!="02"){throw"malformed RSA key(code:003)"}p.n=s(r,q[0]);if(r.substr(q[1],2)!="02"){throw"malformed RSA key(code:004)"}p.e=s(r,q[1]);return p},parsePublicPKCS8Hex:function(t){var v=ASN1HEX;var u=v.getChildIdx;var s=v.getV;var q={};q.algparam=null;var r=u(t,0);if(r.length!=2){throw"outer DERSequence shall have 2 elements: "+r.length}var w=r[0];if(t.substr(w,2)!="30"){throw"malformed PKCS8 public key(code:001)"}var p=u(t,w);if(p.length!=2){throw"malformed PKCS8 public key(code:002)"}if(t.substr(p[0],2)!="06"){throw"malformed PKCS8 public key(code:003)"}q.algoid=s(t,p[0]);if(t.substr(p[1],2)=="06"){q.algparam=s(t,p[1])}else{if(t.substr(p[1],2)=="30"){q.algparam={};q.algparam.p=v.getVbyList(t,p[1],[0],"02");q.algparam.q=v.getVbyList(t,p[1],[1],"02");q.algparam.g=v.getVbyList(t,p[1],[2],"02")}}if(t.substr(r[1],2)!="03"){throw"malformed PKCS8 public key(code:004)"}q.key=s(t,r[1]).substr(2);return q},}}();KEYUTIL.getKey=function(l,k,n){var G=ASN1HEX,L=G.getChildIdx,v=G.getV,d=G.getVbyList,c=KJUR.crypto,i=c.ECDSA,C=c.DSA,w=RSAKey,M=pemtohex,F=KEYUTIL;if(typeof w!="undefined"&&l instanceof w){return l}if(typeof i!="undefined"&&l instanceof i){return l}if(typeof C!="undefined"&&l instanceof C){return l}if(l.curve!==undefined&&l.xy!==undefined&&l.d===undefined){return new i({pub:l.xy,curve:l.curve})}if(l.curve!==undefined&&l.d!==undefined){return new i({prv:l.d,curve:l.curve})}if(l.kty===undefined&&l.n!==undefined&&l.e!==undefined&&l.d===undefined){var P=new w();P.setPublic(l.n,l.e);return P}if(l.kty===undefined&&l.n!==undefined&&l.e!==undefined&&l.d!==undefined&&l.p!==undefined&&l.q!==undefined&&l.dp!==undefined&&l.dq!==undefined&&l.co!==undefined&&l.qi===undefined){var P=new w();P.setPrivateEx(l.n,l.e,l.d,l.p,l.q,l.dp,l.dq,l.co);return P}if(l.kty===undefined&&l.n!==undefined&&l.e!==undefined&&l.d!==undefined&&l.p===undefined){var P=new w();P.setPrivate(l.n,l.e,l.d);return P}if(l.p!==undefined&&l.q!==undefined&&l.g!==undefined&&l.y!==undefined&&l.x===undefined){var P=new C();P.setPublic(l.p,l.q,l.g,l.y);return P}if(l.p!==undefined&&l.q!==undefined&&l.g!==undefined&&l.y!==undefined&&l.x!==undefined){var P=new C();P.setPrivate(l.p,l.q,l.g,l.y,l.x);return P}if(l.kty==="RSA"&&l.n!==undefined&&l.e!==undefined&&l.d===undefined){var P=new w();P.setPublic(b64utohex(l.n),b64utohex(l.e));return P}if(l.kty==="RSA"&&l.n!==undefined&&l.e!==undefined&&l.d!==undefined&&l.p!==undefined&&l.q!==undefined&&l.dp!==undefined&&l.dq!==undefined&&l.qi!==undefined){var P=new w();P.setPrivateEx(b64utohex(l.n),b64utohex(l.e),b64utohex(l.d),b64utohex(l.p),b64utohex(l.q),b64utohex(l.dp),b64utohex(l.dq),b64utohex(l.qi));return P}if(l.kty==="RSA"&&l.n!==undefined&&l.e!==undefined&&l.d!==undefined){var P=new w();P.setPrivate(b64utohex(l.n),b64utohex(l.e),b64utohex(l.d));return P}if(l.kty==="EC"&&l.crv!==undefined&&l.x!==undefined&&l.y!==undefined&&l.d===undefined){var j=new i({curve:l.crv});var t=j.ecparams.keylen/4;var B=("0000000000"+b64utohex(l.x)).slice(-t);var z=("0000000000"+b64utohex(l.y)).slice(-t);var u="04"+B+z;j.setPublicKeyHex(u);return j}if(l.kty==="EC"&&l.crv!==undefined&&l.x!==undefined&&l.y!==undefined&&l.d!==undefined){var j=new i({curve:l.crv});var t=j.ecparams.keylen/4;var B=("0000000000"+b64utohex(l.x)).slice(-t);var z=("0000000000"+b64utohex(l.y)).slice(-t);var u="04"+B+z;var b=("0000000000"+b64utohex(l.d)).slice(-t);j.setPublicKeyHex(u);j.setPrivateKeyHex(b);return j}if(n==="pkcs5prv"){var J=l,G=ASN1HEX,N,P;N=L(J,0);if(N.length===9){P=new w();P.readPKCS5PrvKeyHex(J)}else{if(N.length===6){P=new C();P.readPKCS5PrvKeyHex(J)}else{if(N.length>2&&J.substr(N[1],2)==="04"){P=new i();P.readPKCS5PrvKeyHex(J)}else{throw"unsupported PKCS#1/5 hexadecimal key"}}}return P}if(n==="pkcs8prv"){var P=F.getKeyFromPlainPrivatePKCS8Hex(l);return P}if(n==="pkcs8pub"){return F._getKeyFromPublicPKCS8Hex(l)}if(n==="x509pub"){return X509.getPublicKeyFromCertHex(l)}if(l.indexOf("-END CERTIFICATE-",0)!=-1||l.indexOf("-END X509 CERTIFICATE-",0)!=-1||l.indexOf("-END TRUSTED CERTIFICATE-",0)!=-1){return X509.getPublicKeyFromCertPEM(l)}if(l.indexOf("-END PUBLIC KEY-")!=-1){var O=pemtohex(l,"PUBLIC KEY");return F._getKeyFromPublicPKCS8Hex(O)}if(l.indexOf("-END RSA PRIVATE KEY-")!=-1&&l.indexOf("4,ENCRYPTED")==-1){var m=M(l,"RSA PRIVATE KEY");return F.getKey(m,null,"pkcs5prv")}if(l.indexOf("-END DSA PRIVATE KEY-")!=-1&&l.indexOf("4,ENCRYPTED")==-1){var I=M(l,"DSA PRIVATE KEY");var E=d(I,0,[1],"02");var D=d(I,0,[2],"02");var K=d(I,0,[3],"02");var r=d(I,0,[4],"02");var s=d(I,0,[5],"02");var P=new C();P.setPrivate(new BigInteger(E,16),new BigInteger(D,16),new BigInteger(K,16),new BigInteger(r,16),new BigInteger(s,16));return P}if(l.indexOf("-END PRIVATE KEY-")!=-1){return F.getKeyFromPlainPrivatePKCS8PEM(l)}if(l.indexOf("-END RSA PRIVATE KEY-")!=-1&&l.indexOf("4,ENCRYPTED")!=-1){var o=F.getDecryptedKeyHex(l,k);var H=new RSAKey();H.readPKCS5PrvKeyHex(o);return H}if(l.indexOf("-END EC PRIVATE KEY-")!=-1&&l.indexOf("4,ENCRYPTED")!=-1){var I=F.getDecryptedKeyHex(l,k);var P=d(I,0,[1],"04");var f=d(I,0,[2,0],"06");var A=d(I,0,[3,0],"03").substr(2);var e="";if(KJUR.crypto.OID.oidhex2name[f]!==undefined){e=KJUR.crypto.OID.oidhex2name[f]}else{throw"undefined OID(hex) in KJUR.crypto.OID: "+f}var j=new i({curve:e});j.setPublicKeyHex(A);j.setPrivateKeyHex(P);j.isPublic=false;return j}if(l.indexOf("-END DSA PRIVATE KEY-")!=-1&&l.indexOf("4,ENCRYPTED")!=-1){var I=F.getDecryptedKeyHex(l,k);var E=d(I,0,[1],"02");var D=d(I,0,[2],"02");var K=d(I,0,[3],"02");var r=d(I,0,[4],"02");var s=d(I,0,[5],"02");var P=new C();P.setPrivate(new BigInteger(E,16),new BigInteger(D,16),new BigInteger(K,16),new BigInteger(r,16),new BigInteger(s,16));return P}if(l.indexOf("-END ENCRYPTED PRIVATE KEY-")!=-1){return F.getKeyFromEncryptedPKCS8PEM(l,k)}throw"not supported argument"};KEYUTIL.generateKeypair=function(a,c){if(a=="RSA"){var b=c;var h=new RSAKey();h.generate(b,"10001");h.isPrivate=true;h.isPublic=true;var f=new RSAKey();var e=h.n.toString(16);var i=h.e.toString(16);f.setPublic(e,i);f.isPrivate=false;f.isPublic=true;var k={};k.prvKeyObj=h;k.pubKeyObj=f;return k}else{if(a=="EC"){var d=c;var g=new KJUR.crypto.ECDSA({curve:d});var j=g.generateKeyPairHex();var h=new KJUR.crypto.ECDSA({curve:d});h.setPublicKeyHex(j.ecpubhex);h.setPrivateKeyHex(j.ecprvhex);h.isPrivate=true;h.isPublic=false;var f=new KJUR.crypto.ECDSA({curve:d});f.setPublicKeyHex(j.ecpubhex);f.isPrivate=false;f.isPublic=true;var k={};k.prvKeyObj=h;k.pubKeyObj=f;return k}else{throw"unknown algorithm: "+a}}};KEYUTIL.getPEM=function(b,D,y,m,q,j){var F=KJUR,k=F.asn1,z=k.DERObjectIdentifier,f=k.DERInteger,l=k.ASN1Util.newObject,a=k.x509,C=a.SubjectPublicKeyInfo,e=F.crypto,u=e.DSA,r=e.ECDSA,n=RSAKey;function A(s){var G=l({seq:[{"int":0},{"int":{bigint:s.n}},{"int":s.e},{"int":{bigint:s.d}},{"int":{bigint:s.p}},{"int":{bigint:s.q}},{"int":{bigint:s.dmp1}},{"int":{bigint:s.dmq1}},{"int":{bigint:s.coeff}}]});return G}function B(G){var s=l({seq:[{"int":1},{octstr:{hex:G.prvKeyHex}},{tag:["a0",true,{oid:{name:G.curveName}}]},{tag:["a1",true,{bitstr:{hex:"00"+G.pubKeyHex}}]}]});return s}function x(s){var G=l({seq:[{"int":0},{"int":{bigint:s.p}},{"int":{bigint:s.q}},{"int":{bigint:s.g}},{"int":{bigint:s.y}},{"int":{bigint:s.x}}]});return G}if(((n!==undefined&&b instanceof n)||(u!==undefined&&b instanceof u)||(r!==undefined&&b instanceof r))&&b.isPublic==true&&(D===undefined||D=="PKCS8PUB")){var E=new C(b);var w=E.getEncodedHex();return hextopem(w,"PUBLIC KEY")}if(D=="PKCS1PRV"&&n!==undefined&&b instanceof n&&(y===undefined||y==null)&&b.isPrivate==true){var E=A(b);var w=E.getEncodedHex();return hextopem(w,"RSA PRIVATE KEY")}if(D=="PKCS1PRV"&&r!==undefined&&b instanceof r&&(y===undefined||y==null)&&b.isPrivate==true){var i=new z({name:b.curveName});var v=i.getEncodedHex();var h=B(b);var t=h.getEncodedHex();var p="";p+=hextopem(v,"EC PARAMETERS");p+=hextopem(t,"EC PRIVATE KEY");return p}if(D=="PKCS1PRV"&&u!==undefined&&b instanceof u&&(y===undefined||y==null)&&b.isPrivate==true){var E=x(b);var w=E.getEncodedHex();return hextopem(w,"DSA PRIVATE KEY")}if(D=="PKCS5PRV"&&n!==undefined&&b instanceof n&&(y!==undefined&&y!=null)&&b.isPrivate==true){var E=A(b);var w=E.getEncodedHex();if(m===undefined){m="DES-EDE3-CBC"}return this.getEncryptedPKCS5PEMFromPrvKeyHex("RSA",w,y,m,j)}if(D=="PKCS5PRV"&&r!==undefined&&b instanceof r&&(y!==undefined&&y!=null)&&b.isPrivate==true){var E=B(b);var w=E.getEncodedHex();if(m===undefined){m="DES-EDE3-CBC"}return this.getEncryptedPKCS5PEMFromPrvKeyHex("EC",w,y,m,j)}if(D=="PKCS5PRV"&&u!==undefined&&b instanceof u&&(y!==undefined&&y!=null)&&b.isPrivate==true){var E=x(b);var w=E.getEncodedHex();if(m===undefined){m="DES-EDE3-CBC"}return this.getEncryptedPKCS5PEMFromPrvKeyHex("DSA",w,y,m,j)}var o=function(G,s){var I=c(G,s);var H=new l({seq:[{seq:[{oid:{name:"pkcs5PBES2"}},{seq:[{seq:[{oid:{name:"pkcs5PBKDF2"}},{seq:[{octstr:{hex:I.pbkdf2Salt}},{"int":I.pbkdf2Iter}]}]},{seq:[{oid:{name:"des-EDE3-CBC"}},{octstr:{hex:I.encryptionSchemeIV}}]}]}]},{octstr:{hex:I.ciphertext}}]});return H.getEncodedHex()};var c=function(N,O){var H=100;var M=CryptoJS.lib.WordArray.random(8);var L="DES-EDE3-CBC";var s=CryptoJS.lib.WordArray.random(8);var I=CryptoJS.PBKDF2(O,M,{keySize:192/32,iterations:H});var J=CryptoJS.enc.Hex.parse(N);var K=CryptoJS.TripleDES.encrypt(J,I,{iv:s})+"";var G={};G.ciphertext=K;G.pbkdf2Salt=CryptoJS.enc.Hex.stringify(M);G.pbkdf2Iter=H;G.encryptionSchemeAlg=L;G.encryptionSchemeIV=CryptoJS.enc.Hex.stringify(s);return G};if(D=="PKCS8PRV"&&n!=undefined&&b instanceof n&&b.isPrivate==true){var g=A(b);var d=g.getEncodedHex();var E=l({seq:[{"int":0},{seq:[{oid:{name:"rsaEncryption"}},{"null":true}]},{octstr:{hex:d}}]});var w=E.getEncodedHex();if(y===undefined||y==null){return hextopem(w,"PRIVATE KEY")}else{var t=o(w,y);return hextopem(t,"ENCRYPTED PRIVATE KEY")}}if(D=="PKCS8PRV"&&r!==undefined&&b instanceof r&&b.isPrivate==true){var g=new l({seq:[{"int":1},{octstr:{hex:b.prvKeyHex}},{tag:["a1",true,{bitstr:{hex:"00"+b.pubKeyHex}}]}]});var d=g.getEncodedHex();var E=l({seq:[{"int":0},{seq:[{oid:{name:"ecPublicKey"}},{oid:{name:b.curveName}}]},{octstr:{hex:d}}]});var w=E.getEncodedHex();if(y===undefined||y==null){return hextopem(w,"PRIVATE KEY")}else{var t=o(w,y);return hextopem(t,"ENCRYPTED PRIVATE KEY")}}if(D=="PKCS8PRV"&&u!==undefined&&b instanceof u&&b.isPrivate==true){var g=new f({bigint:b.x});var d=g.getEncodedHex();var E=l({seq:[{"int":0},{seq:[{oid:{name:"dsa"}},{seq:[{"int":{bigint:b.p}},{"int":{bigint:b.q}},{"int":{bigint:b.g}}]}]},{octstr:{hex:d}}]});var w=E.getEncodedHex();if(y===undefined||y==null){return hextopem(w,"PRIVATE KEY")}else{var t=o(w,y);return hextopem(t,"ENCRYPTED PRIVATE KEY")}}throw"unsupported object nor format"};KEYUTIL.getKeyFromCSRPEM=function(b){var a=pemtohex(b,"CERTIFICATE REQUEST");var c=KEYUTIL.getKeyFromCSRHex(a);return c};KEYUTIL.getKeyFromCSRHex=function(a){var c=KEYUTIL.parseCSRHex(a);var b=KEYUTIL.getKey(c.p8pubkeyhex,null,"pkcs8pub");return b};KEYUTIL.parseCSRHex=function(d){var i=ASN1HEX;var f=i.getChildIdx;var c=i.getTLV;var b={};var g=d;if(g.substr(0,2)!="30"){throw"malformed CSR(code:001)"}var e=f(g,0);if(e.length<1){throw"malformed CSR(code:002)"}if(g.substr(e[0],2)!="30"){throw"malformed CSR(code:003)"}var a=f(g,e[0]);if(a.length<3){throw"malformed CSR(code:004)"}b.p8pubkeyhex=c(g,a[2]);return b};KEYUTIL.getJWKFromKey=function(d){var b={};if(d instanceof RSAKey&&d.isPrivate){b.kty="RSA";b.n=hextob64u(d.n.toString(16));b.e=hextob64u(d.e.toString(16));b.d=hextob64u(d.d.toString(16));b.p=hextob64u(d.p.toString(16));b.q=hextob64u(d.q.toString(16));b.dp=hextob64u(d.dmp1.toString(16));b.dq=hextob64u(d.dmq1.toString(16));b.qi=hextob64u(d.coeff.toString(16));return b}else{if(d instanceof RSAKey&&d.isPublic){b.kty="RSA";b.n=hextob64u(d.n.toString(16));b.e=hextob64u(d.e.toString(16));return b}else{if(d instanceof KJUR.crypto.ECDSA&&d.isPrivate){var a=d.getShortNISTPCurveName();if(a!=="P-256"&&a!=="P-384"){throw"unsupported curve name for JWT: "+a}var c=d.getPublicKeyXYHex();b.kty="EC";b.crv=a;b.x=hextob64u(c.x);b.y=hextob64u(c.y);b.d=hextob64u(d.prvKeyHex);return b}else{if(d instanceof KJUR.crypto.ECDSA&&d.isPublic){var a=d.getShortNISTPCurveName();if(a!=="P-256"&&a!=="P-384"){throw"unsupported curve name for JWT: "+a}var c=d.getPublicKeyXYHex();b.kty="EC";b.crv=a;b.x=hextob64u(c.x);b.y=hextob64u(c.y);return b}}}}throw"not supported key object"}; -RSAKey.getPosArrayOfChildrenFromHex=function(a){return ASN1HEX.getChildIdx(a,0)};RSAKey.getHexValueArrayOfChildrenFromHex=function(f){var n=ASN1HEX;var i=n.getV;var k=RSAKey.getPosArrayOfChildrenFromHex(f);var e=i(f,k[0]);var j=i(f,k[1]);var b=i(f,k[2]);var c=i(f,k[3]);var h=i(f,k[4]);var g=i(f,k[5]);var m=i(f,k[6]);var l=i(f,k[7]);var d=i(f,k[8]);var k=new Array();k.push(e,j,b,c,h,g,m,l,d);return k};RSAKey.prototype.readPrivateKeyFromPEMString=function(d){var c=pemtohex(d);var b=RSAKey.getHexValueArrayOfChildrenFromHex(c);this.setPrivateEx(b[1],b[2],b[3],b[4],b[5],b[6],b[7],b[8])};RSAKey.prototype.readPKCS5PrvKeyHex=function(c){var b=RSAKey.getHexValueArrayOfChildrenFromHex(c);this.setPrivateEx(b[1],b[2],b[3],b[4],b[5],b[6],b[7],b[8])};RSAKey.prototype.readPKCS8PrvKeyHex=function(e){var c,j,l,b,a,f,d,k;var m=ASN1HEX;var g=m.getVbyList;if(m.isASN1HEX(e)===false){throw"not ASN.1 hex string"}try{c=g(e,0,[2,0,1],"02");j=g(e,0,[2,0,2],"02");l=g(e,0,[2,0,3],"02");b=g(e,0,[2,0,4],"02");a=g(e,0,[2,0,5],"02");f=g(e,0,[2,0,6],"02");d=g(e,0,[2,0,7],"02");k=g(e,0,[2,0,8],"02")}catch(i){throw"malformed PKCS#8 plain RSA private key"}this.setPrivateEx(c,j,l,b,a,f,d,k)};RSAKey.prototype.readPKCS5PubKeyHex=function(c){var e=ASN1HEX;var b=e.getV;if(e.isASN1HEX(c)===false){throw"keyHex is not ASN.1 hex string"}var a=e.getChildIdx(c,0);if(a.length!==2||c.substr(a[0],2)!=="02"||c.substr(a[1],2)!=="02"){throw"wrong hex for PKCS#5 public key"}var f=b(c,a[0]);var d=b(c,a[1]);this.setPublic(f,d)};RSAKey.prototype.readPKCS8PubKeyHex=function(b){var c=ASN1HEX;if(c.isASN1HEX(b)===false){throw"not ASN.1 hex string"}if(c.getTLVbyList(b,0,[0,0])!=="06092a864886f70d010101"){throw"not PKCS8 RSA public key"}var a=c.getTLVbyList(b,0,[1,0]);this.readPKCS5PubKeyHex(a)};RSAKey.prototype.readCertPubKeyHex=function(b,d){var a,c;a=new X509();a.readCertHex(b);c=a.getPublicKeyHex();this.readPKCS8PubKeyHex(c)}; -var _RE_HEXDECONLY=new RegExp("");_RE_HEXDECONLY.compile("[^0-9a-f]","gi");function _rsasign_getHexPaddedDigestInfoForString(d,e,a){var b=function(f){return KJUR.crypto.Util.hashString(f,a)};var c=b(d);return KJUR.crypto.Util.getPaddedDigestInfoHex(c,a,e)}function _zeroPaddingOfSignature(e,d){var c="";var a=d/4-e.length;for(var b=0;b>24,(d&16711680)>>16,(d&65280)>>8,d&255]))));d+=1}return b}RSAKey.prototype.signPSS=function(e,a,d){var c=function(f){return KJUR.crypto.Util.hashHex(f,a)};var b=c(rstrtohex(e));if(d===undefined){d=-1}return this.signWithMessageHashPSS(b,a,d)};RSAKey.prototype.signWithMessageHashPSS=function(l,a,k){var b=hextorstr(l);var g=b.length;var m=this.n.bitLength()-1;var c=Math.ceil(m/8);var d;var o=function(i){return KJUR.crypto.Util.hashHex(i,a)};if(k===-1||k===undefined){k=g}else{if(k===-2){k=c-g-2}else{if(k<-2){throw"invalid salt length"}}}if(c<(g+k+2)){throw"data too long"}var f="";if(k>0){f=new Array(k);new SecureRandom().nextBytes(f);f=String.fromCharCode.apply(String,f)}var n=hextorstr(o(rstrtohex("\x00\x00\x00\x00\x00\x00\x00\x00"+b+f)));var j=[];for(d=0;d>(8*c-m))&255;q[0]&=~p;for(d=0;dthis.n.bitLength()){return 0}var i=this.doPublic(b);var e=i.toString(16).replace(/^1f+00/,"");var g=_rsasign_getAlgNameAndHashFromHexDisgestInfo(e);if(g.length==0){return false}var d=g[0];var h=g[1];var a=function(k){return KJUR.crypto.Util.hashString(k,d)};var c=a(f);return(h==c)};RSAKey.prototype.verifyWithMessageHash=function(e,a){a=a.replace(_RE_HEXDECONLY,"");a=a.replace(/[ \n]+/g,"");var b=parseBigInt(a,16);if(b.bitLength()>this.n.bitLength()){return 0}var h=this.doPublic(b);var g=h.toString(16).replace(/^1f+00/,"");var c=_rsasign_getAlgNameAndHashFromHexDisgestInfo(g);if(c.length==0){return false}var d=c[0];var f=c[1];return(f==e)};RSAKey.prototype.verifyPSS=function(c,b,a,f){var e=function(g){return KJUR.crypto.Util.hashHex(g,a)};var d=e(rstrtohex(c));if(f===undefined){f=-1}return this.verifyWithMessageHashPSS(d,b,a,f)};RSAKey.prototype.verifyWithMessageHashPSS=function(f,s,l,c){var k=new BigInteger(s,16);if(k.bitLength()>this.n.bitLength()){return false}var r=function(i){return KJUR.crypto.Util.hashHex(i,l)};var j=hextorstr(f);var h=j.length;var g=this.n.bitLength()-1;var m=Math.ceil(g/8);var q;if(c===-1||c===undefined){c=h}else{if(c===-2){c=m-h-2}else{if(c<-2){throw"invalid salt length"}}}if(m<(h+c+2)){throw"data too long"}var a=this.doPublic(k).toByteArray();for(q=0;q>(8*m-g))&255;if((d.charCodeAt(0)&p)!==0){throw"bits beyond keysize not zero"}var n=pss_mgf1_str(e,d.length,r);var o=[];for(q=0;q0){var b=":"+n.join(":")+":";if(b.indexOf(":"+k+":")==-1){throw"algorithm '"+k+"' not accepted in the list"}}if(k!="none"&&B===null){throw"key shall be specified to verify."}if(typeof B=="string"&&B.indexOf("-----BEGIN ")!=-1){B=KEYUTIL.getKey(B)}if(z=="RS"||z=="PS"){if(!(B instanceof m)){throw"key shall be a RSAKey obj for RS* and PS* algs"}}if(z=="ES"){if(!(B instanceof p)){throw"key shall be a ECDSA obj for ES* algs"}}if(k=="none"){}var u=null;if(t.jwsalg2sigalg[l.alg]===undefined){throw"unsupported alg name: "+k}else{u=t.jwsalg2sigalg[k]}if(u=="none"){throw"not supported"}else{if(u.substr(0,4)=="Hmac"){var o=null;if(B===undefined){throw"hexadecimal key shall be specified for HMAC"}var j=new s({alg:u,pass:B});j.updateString(c);o=j.doFinal();return A==o}else{if(u.indexOf("withECDSA")!=-1){var h=null;try{h=p.concatSigToASN1Sig(A)}catch(v){return false}var g=new d({alg:u});g.init(B);g.updateString(c);return g.verify(h)}else{var g=new d({alg:u});g.init(B);g.updateString(c);return g.verify(A)}}}};KJUR.jws.JWS.parse=function(g){var c=g.split(".");var b={};var f,e,d;if(c.length!=2&&c.length!=3){throw"malformed sJWS: wrong number of '.' splitted elements"}f=c[0];e=c[1];if(c.length==3){d=c[2]}b.headerObj=KJUR.jws.JWS.readSafeJSONString(b64utoutf8(f));b.payloadObj=KJUR.jws.JWS.readSafeJSONString(b64utoutf8(e));b.headerPP=JSON.stringify(b.headerObj,null," ");if(b.payloadObj==null){b.payloadPP=b64utoutf8(e)}else{b.payloadPP=JSON.stringify(b.payloadObj,null," ")}if(d!==undefined){b.sigHex=b64utohex(d)}return b};KJUR.jws.JWS.verifyJWT=function(e,l,r){var d=KJUR,j=d.jws,o=j.JWS,n=o.readSafeJSONString,p=o.inArray,f=o.includedArray;var k=e.split(".");var c=k[0];var i=k[1];var q=c+"."+i;var m=b64utohex(k[2]);var h=n(b64utoutf8(c));var g=n(b64utoutf8(i));if(h.alg===undefined){return false}if(r.alg===undefined){throw"acceptField.alg shall be specified"}if(!p(h.alg,r.alg)){return false}if(g.iss!==undefined&&typeof r.iss==="object"){if(!p(g.iss,r.iss)){return false}}if(g.sub!==undefined&&typeof r.sub==="object"){if(!p(g.sub,r.sub)){return false}}if(g.aud!==undefined&&typeof r.aud==="object"){if(typeof g.aud=="string"){if(!p(g.aud,r.aud)){return false}}else{if(typeof g.aud=="object"){if(!f(g.aud,r.aud)){return false}}}}var b=j.IntDate.getNow();if(r.verifyAt!==undefined&&typeof r.verifyAt==="number"){b=r.verifyAt}if(r.gracePeriod===undefined||typeof r.gracePeriod!=="number"){r.gracePeriod=0}if(g.exp!==undefined&&typeof g.exp=="number"){if(g.exp+r.gracePeriodl){this.aHeader.pop()}if(this.aSignature.length>l){this.aSignature.pop()}throw"addSignature failed: "+i}};this.verifyAll=function(h){if(this.aHeader.length!==h.length||this.aSignature.length!==h.length){return false}for(var g=0;g0){this.aHeader=g.headers}else{throw"malformed header"}if(typeof g.payload==="string"){this.sPayload=g.payload}else{throw"malformed signatures"}if(g.signatures.length>0){this.signatures=g.signatures}else{throw"malformed signatures"}}catch(e){throw"malformed JWS-JS JSON object: "+e}}};this.getJSON=function(){return{headers:this.aHeader,payload:this.sPayload,signatures:this.aSignature}};this.isEmpty=function(){if(this.aHeader.length==0){return 1}return 0}}; -exports.SecureRandom = SecureRandom; -exports.rng_seed_time = rng_seed_time; - -exports.BigInteger = BigInteger; -exports.RSAKey = RSAKey; -exports.ECDSA = KJUR.crypto.ECDSA; -exports.DSA = KJUR.crypto.DSA; -exports.Signature = KJUR.crypto.Signature; -exports.MessageDigest = KJUR.crypto.MessageDigest; -exports.Mac = KJUR.crypto.Mac; -exports.Cipher = KJUR.crypto.Cipher; -exports.KEYUTIL = KEYUTIL; -exports.ASN1HEX = ASN1HEX; -exports.X509 = X509; -exports.CryptoJS = CryptoJS; - -// ext/base64.js -exports.b64tohex = b64tohex; -exports.b64toBA = b64toBA; - -// base64x.js -exports.stoBA = stoBA; -exports.BAtos = BAtos; -exports.BAtohex = BAtohex; -exports.stohex = stohex; -exports.stob64 = stob64; -exports.stob64u = stob64u; -exports.b64utos = b64utos; -exports.b64tob64u = b64tob64u; -exports.b64utob64 = b64utob64; -exports.hex2b64 = hex2b64; -exports.hextob64u = hextob64u; -exports.b64utohex = b64utohex; -exports.utf8tob64u = utf8tob64u; -exports.b64utoutf8 = b64utoutf8; -exports.utf8tob64 = utf8tob64; -exports.b64toutf8 = b64toutf8; -exports.utf8tohex = utf8tohex; -exports.hextoutf8 = hextoutf8; -exports.hextorstr = hextorstr; -exports.rstrtohex = rstrtohex; -exports.hextob64 = hextob64; -exports.hextob64nl = hextob64nl; -exports.b64nltohex = b64nltohex; -exports.hextopem = hextopem; -exports.pemtohex = pemtohex; -exports.hextoArrayBuffer = hextoArrayBuffer; -exports.ArrayBuffertohex = ArrayBuffertohex; -exports.zulutomsec = zulutomsec; -exports.zulutosec = zulutosec; -exports.zulutodate = zulutodate; -exports.datetozulu = datetozulu; -exports.uricmptohex = uricmptohex; -exports.hextouricmp = hextouricmp; -exports.encodeURIComponentAll = encodeURIComponentAll; -exports.newline_toUnix = newline_toUnix; -exports.newline_toDos = newline_toDos; -exports.hextoposhex = hextoposhex; -exports.intarystrtohex = intarystrtohex; -exports.strdiffidx = strdiffidx; - -// name spaces -exports.KJUR = KJUR; -exports.crypto = KJUR.crypto; -exports.asn1 = KJUR.asn1; -exports.jws = KJUR.jws; -exports.lang = KJUR.lang; - - - - -/***/ }), -/* 110 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -var OpenElementStack = __webpack_require__(51), - Tokenizer = __webpack_require__(19), - HTML = __webpack_require__(11); - - -//Aliases -var $ = HTML.TAG_NAMES; - -exports.assign = function (parser) { - //NOTE: obtain Parser proto this way to avoid module circular references - var parserProto = Object.getPrototypeOf(parser), - treeAdapter = parser.treeAdapter, - attachableElementLocation = null, - lastFosterParentingLocation = null, - currentToken = null; - - function setEndLocation(element, closingToken) { - var loc = element.__location; - - if (!loc) - return; - - if (!loc.startTag) { - loc.startTag = { - line: loc.line, - col: loc.col, - startOffset: loc.startOffset, - endOffset: loc.endOffset - }; - - if (loc.attrs) - loc.startTag.attrs = loc.attrs; - } - - if (closingToken.location) { - var ctLocation = closingToken.location, - tn = treeAdapter.getTagName(element), - // NOTE: For cases like - First 'p' closes without a closing tag and - // for cases like - 'p' closes without a closing tag - isClosingEndTag = closingToken.type === Tokenizer.END_TAG_TOKEN && - tn === closingToken.tagName; - - if (isClosingEndTag) { - loc.endTag = { - line: ctLocation.line, - col: ctLocation.col, - startOffset: ctLocation.startOffset, - endOffset: ctLocation.endOffset - }; - } - - if (isClosingEndTag) - loc.endOffset = ctLocation.endOffset; - else - loc.endOffset = ctLocation.startOffset; - } - - else if (closingToken.type === Tokenizer.EOF_TOKEN) - loc.endOffset = parser.tokenizer.preprocessor.sourcePos; - } - - //NOTE: patch _bootstrap method - parser._bootstrap = function (document, fragmentContext) { - parserProto._bootstrap.call(this, document, fragmentContext); - - attachableElementLocation = null; - lastFosterParentingLocation = null; - currentToken = null; - - //OpenElementStack - parser.openElements.pop = function () { - setEndLocation(this.current, currentToken); - OpenElementStack.prototype.pop.call(this); - }; - - parser.openElements.popAllUpToHtmlElement = function () { - for (var i = this.stackTop; i > 0; i--) - setEndLocation(this.items[i], currentToken); - - OpenElementStack.prototype.popAllUpToHtmlElement.call(this); - }; - - parser.openElements.remove = function (element) { - setEndLocation(element, currentToken); - OpenElementStack.prototype.remove.call(this, element); - }; - }; - - parser._runParsingLoop = function (scriptHandler) { - parserProto._runParsingLoop.call(this, scriptHandler); - - // NOTE: generate location info for elements - // that remains on open element stack - for (var i = parser.openElements.stackTop; i >= 0; i--) - setEndLocation(parser.openElements.items[i], currentToken); - }; - - - //Token processing - parser._processTokenInForeignContent = function (token) { - currentToken = token; - parserProto._processTokenInForeignContent.call(this, token); - }; - - parser._processToken = function (token) { - currentToken = token; - parserProto._processToken.call(this, token); - - //NOTE: and are never popped from the stack, so we need to updated - //their end location explicitly. - if (token.type === Tokenizer.END_TAG_TOKEN && - (token.tagName === $.HTML || - token.tagName === $.BODY && this.openElements.hasInScope($.BODY))) { - for (var i = this.openElements.stackTop; i >= 0; i--) { - var element = this.openElements.items[i]; - - if (this.treeAdapter.getTagName(element) === token.tagName) { - setEndLocation(element, token); - break; - } - } - } - }; - - - //Doctype - parser._setDocumentType = function (token) { - parserProto._setDocumentType.call(this, token); - - var documentChildren = this.treeAdapter.getChildNodes(this.document), - cnLength = documentChildren.length; - - for (var i = 0; i < cnLength; i++) { - var node = documentChildren[i]; - - if (this.treeAdapter.isDocumentTypeNode(node)) { - node.__location = token.location; - break; - } - } - }; - - - //Elements - parser._attachElementToTree = function (element) { - //NOTE: _attachElementToTree is called from _appendElement, _insertElement and _insertTemplate methods. - //So we will use token location stored in this methods for the element. - element.__location = attachableElementLocation || null; - attachableElementLocation = null; - parserProto._attachElementToTree.call(this, element); - }; - - parser._appendElement = function (token, namespaceURI) { - attachableElementLocation = token.location; - parserProto._appendElement.call(this, token, namespaceURI); - }; - - parser._insertElement = function (token, namespaceURI) { - attachableElementLocation = token.location; - parserProto._insertElement.call(this, token, namespaceURI); - }; - - parser._insertTemplate = function (token) { - attachableElementLocation = token.location; - parserProto._insertTemplate.call(this, token); - - var tmplContent = this.treeAdapter.getTemplateContent(this.openElements.current); - - tmplContent.__location = null; - }; - - parser._insertFakeRootElement = function () { - parserProto._insertFakeRootElement.call(this); - this.openElements.current.__location = null; - }; - - - //Comments - parser._appendCommentNode = function (token, parent) { - parserProto._appendCommentNode.call(this, token, parent); - - var children = this.treeAdapter.getChildNodes(parent), - commentNode = children[children.length - 1]; - - commentNode.__location = token.location; - }; - - - //Text - parser._findFosterParentingLocation = function () { - //NOTE: store last foster parenting location, so we will be able to find inserted text - //in case of foster parenting - lastFosterParentingLocation = parserProto._findFosterParentingLocation.call(this); - return lastFosterParentingLocation; - }; - - parser._insertCharacters = function (token) { - parserProto._insertCharacters.call(this, token); - - var hasFosterParent = this._shouldFosterParentOnInsertion(), - parent = hasFosterParent && lastFosterParentingLocation.parent || - this.openElements.currentTmplContent || - this.openElements.current, - siblings = this.treeAdapter.getChildNodes(parent), - textNodeIdx = hasFosterParent && lastFosterParentingLocation.beforeElement ? - siblings.indexOf(lastFosterParentingLocation.beforeElement) - 1 : - siblings.length - 1, - textNode = siblings[textNodeIdx]; - - //NOTE: if we have location assigned by another token, then just update end position - if (textNode.__location) - textNode.__location.endOffset = token.location.endOffset; - - else - textNode.__location = token.location; - }; -}; - - - -/***/ }), -/* 111 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -var UNICODE = __webpack_require__(18); - -//Aliases -var $ = UNICODE.CODE_POINTS; - - -exports.assign = function (tokenizer) { - //NOTE: obtain Tokenizer proto this way to avoid module circular references - var tokenizerProto = Object.getPrototypeOf(tokenizer), - tokenStartOffset = -1, - tokenCol = -1, - tokenLine = 1, - isEol = false, - lineStartPos = 0, - col = -1, - line = 1; - - function attachLocationInfo(token) { - token.location = { - line: tokenLine, - col: tokenCol, - startOffset: tokenStartOffset, - endOffset: -1 - }; - } - - //NOTE: patch consumption method to track line/col information - tokenizer._consume = function () { - var cp = tokenizerProto._consume.call(this); - - //NOTE: LF should be in the last column of the line - if (isEol) { - isEol = false; - line++; - lineStartPos = this.preprocessor.sourcePos; - } - - if (cp === $.LINE_FEED) - isEol = true; - - col = this.preprocessor.sourcePos - lineStartPos + 1; - - return cp; - }; - - tokenizer._unconsume = function () { - tokenizerProto._unconsume.call(this); - isEol = false; - - col = this.preprocessor.sourcePos - lineStartPos + 1; - }; - - //NOTE: patch token creation methods and attach location objects - tokenizer._createStartTagToken = function () { - tokenizerProto._createStartTagToken.call(this); - attachLocationInfo(this.currentToken); - }; - - tokenizer._createEndTagToken = function () { - tokenizerProto._createEndTagToken.call(this); - attachLocationInfo(this.currentToken); - }; - - tokenizer._createCommentToken = function () { - tokenizerProto._createCommentToken.call(this); - attachLocationInfo(this.currentToken); - }; - - tokenizer._createDoctypeToken = function (initialName) { - tokenizerProto._createDoctypeToken.call(this, initialName); - attachLocationInfo(this.currentToken); - }; - - tokenizer._createCharacterToken = function (type, ch) { - tokenizerProto._createCharacterToken.call(this, type, ch); - attachLocationInfo(this.currentCharacterToken); - }; - - tokenizer._createAttr = function (attrNameFirstCh) { - tokenizerProto._createAttr.call(this, attrNameFirstCh); - this.currentAttrLocation = { - line: line, - col: col, - startOffset: this.preprocessor.sourcePos, - endOffset: -1 - }; - }; - - tokenizer._leaveAttrName = function (toState) { - tokenizerProto._leaveAttrName.call(this, toState); - this._attachCurrentAttrLocationInfo(); - }; - - tokenizer._leaveAttrValue = function (toState) { - tokenizerProto._leaveAttrValue.call(this, toState); - this._attachCurrentAttrLocationInfo(); - }; - - tokenizer._attachCurrentAttrLocationInfo = function () { - this.currentAttrLocation.endOffset = this.preprocessor.sourcePos; - - if (!this.currentToken.location.attrs) - this.currentToken.location.attrs = Object.create(null); - - this.currentToken.location.attrs[this.currentAttr.name] = this.currentAttrLocation; - }; - - //NOTE: patch token emission methods to determine end location - tokenizer._emitCurrentToken = function () { - //NOTE: if we have pending character token make it's end location equal to the - //current token's start location. - if (this.currentCharacterToken) - this.currentCharacterToken.location.endOffset = this.currentToken.location.startOffset; - - this.currentToken.location.endOffset = this.preprocessor.sourcePos + 1; - tokenizerProto._emitCurrentToken.call(this); - }; - - tokenizer._emitCurrentCharacterToken = function () { - //NOTE: if we have character token and it's location wasn't set in the _emitCurrentToken(), - //then set it's location at the current preprocessor position. - //We don't need to increment preprocessor position, since character token - //emission is always forced by the start of the next character token here. - //So, we already have advanced position. - if (this.currentCharacterToken && this.currentCharacterToken.location.endOffset === -1) - this.currentCharacterToken.location.endOffset = this.preprocessor.sourcePos; - - tokenizerProto._emitCurrentCharacterToken.call(this); - }; - - //NOTE: patch initial states for each mode to obtain token start position - Object.keys(tokenizerProto.MODE) - - .map(function (modeName) { - return tokenizerProto.MODE[modeName]; - }) - - .forEach(function (state) { - tokenizer[state] = function (cp) { - tokenStartOffset = this.preprocessor.sourcePos; - tokenLine = line; - tokenCol = col; - tokenizerProto[state].call(this, cp); - }; - }); -}; - - -/***/ }), -/* 112 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -//Const -var NOAH_ARK_CAPACITY = 3; - -//List of formatting elements -var FormattingElementList = module.exports = function (treeAdapter) { - this.length = 0; - this.entries = []; - this.treeAdapter = treeAdapter; - this.bookmark = null; -}; - -//Entry types -FormattingElementList.MARKER_ENTRY = 'MARKER_ENTRY'; -FormattingElementList.ELEMENT_ENTRY = 'ELEMENT_ENTRY'; - -//Noah Ark's condition -//OPTIMIZATION: at first we try to find possible candidates for exclusion using -//lightweight heuristics without thorough attributes check. -FormattingElementList.prototype._getNoahArkConditionCandidates = function (newElement) { - var candidates = []; - - if (this.length >= NOAH_ARK_CAPACITY) { - var neAttrsLength = this.treeAdapter.getAttrList(newElement).length, - neTagName = this.treeAdapter.getTagName(newElement), - neNamespaceURI = this.treeAdapter.getNamespaceURI(newElement); - - for (var i = this.length - 1; i >= 0; i--) { - var entry = this.entries[i]; - - if (entry.type === FormattingElementList.MARKER_ENTRY) - break; - - var element = entry.element, - elementAttrs = this.treeAdapter.getAttrList(element), - isCandidate = this.treeAdapter.getTagName(element) === neTagName && - this.treeAdapter.getNamespaceURI(element) === neNamespaceURI && - elementAttrs.length === neAttrsLength; - - if (isCandidate) - candidates.push({idx: i, attrs: elementAttrs}); - } - } - - return candidates.length < NOAH_ARK_CAPACITY ? [] : candidates; -}; - -FormattingElementList.prototype._ensureNoahArkCondition = function (newElement) { - var candidates = this._getNoahArkConditionCandidates(newElement), - cLength = candidates.length; - - if (cLength) { - var neAttrs = this.treeAdapter.getAttrList(newElement), - neAttrsLength = neAttrs.length, - neAttrsMap = Object.create(null); - - //NOTE: build attrs map for the new element so we can perform fast lookups - for (var i = 0; i < neAttrsLength; i++) { - var neAttr = neAttrs[i]; - - neAttrsMap[neAttr.name] = neAttr.value; - } - - for (i = 0; i < neAttrsLength; i++) { - for (var j = 0; j < cLength; j++) { - var cAttr = candidates[j].attrs[i]; - - if (neAttrsMap[cAttr.name] !== cAttr.value) { - candidates.splice(j, 1); - cLength--; - } - - if (candidates.length < NOAH_ARK_CAPACITY) - return; - } - } - - //NOTE: remove bottommost candidates until Noah's Ark condition will not be met - for (i = cLength - 1; i >= NOAH_ARK_CAPACITY - 1; i--) { - this.entries.splice(candidates[i].idx, 1); - this.length--; - } - } -}; - -//Mutations -FormattingElementList.prototype.insertMarker = function () { - this.entries.push({type: FormattingElementList.MARKER_ENTRY}); - this.length++; -}; - -FormattingElementList.prototype.pushElement = function (element, token) { - this._ensureNoahArkCondition(element); - - this.entries.push({ - type: FormattingElementList.ELEMENT_ENTRY, - element: element, - token: token - }); - - this.length++; -}; - -FormattingElementList.prototype.insertElementAfterBookmark = function (element, token) { - var bookmarkIdx = this.length - 1; - - for (; bookmarkIdx >= 0; bookmarkIdx--) { - if (this.entries[bookmarkIdx] === this.bookmark) - break; - } - - this.entries.splice(bookmarkIdx + 1, 0, { - type: FormattingElementList.ELEMENT_ENTRY, - element: element, - token: token - }); - - this.length++; -}; - -FormattingElementList.prototype.removeEntry = function (entry) { - for (var i = this.length - 1; i >= 0; i--) { - if (this.entries[i] === entry) { - this.entries.splice(i, 1); - this.length--; - break; - } - } -}; - -FormattingElementList.prototype.clearToLastMarker = function () { - while (this.length) { - var entry = this.entries.pop(); - - this.length--; - - if (entry.type === FormattingElementList.MARKER_ENTRY) - break; - } -}; - -//Search -FormattingElementList.prototype.getElementEntryInScopeWithTagName = function (tagName) { - for (var i = this.length - 1; i >= 0; i--) { - var entry = this.entries[i]; - - if (entry.type === FormattingElementList.MARKER_ENTRY) - return null; - - if (this.treeAdapter.getTagName(entry.element) === tagName) - return entry; - } - - return null; -}; - -FormattingElementList.prototype.getElementEntry = function (element) { - for (var i = this.length - 1; i >= 0; i--) { - var entry = this.entries[i]; - - if (entry.type === FormattingElementList.ELEMENT_ENTRY && entry.element === element) - return entry; - } - - return null; -}; - - -/***/ }), -/* 113 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -var ParserStream = __webpack_require__(52), - inherits = __webpack_require__(24).inherits, - $ = __webpack_require__(11).TAG_NAMES; - -var PlainTextConversionStream = module.exports = function (options) { - ParserStream.call(this, options); - - // NOTE: see https://html.spec.whatwg.org/#read-text - this.parser._insertFakeElement($.HTML); - this.parser._insertFakeElement($.HEAD); - this.parser.openElements.pop(); - this.parser._insertFakeElement($.BODY); - this.parser._insertFakeElement($.PRE); - this.parser.treeAdapter.insertText(this.parser.openElements.current, '\n'); - this.parser.switchToPlaintextParsing(); -}; - -inherits(PlainTextConversionStream, ParserStream); - - -/***/ }), -/* 114 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -var WritableStream = __webpack_require__(31).Writable, - util = __webpack_require__(24); - -var DevNullStream = module.exports = function () { - WritableStream.call(this); -}; - -util.inherits(DevNullStream, WritableStream); - -DevNullStream.prototype._write = function (chunk, encoding, cb) { - cb(); -}; - - -/***/ }), -/* 115 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -var TransformStream = __webpack_require__(31).Transform, - DevNullStream = __webpack_require__(114), - inherits = __webpack_require__(24).inherits, - Tokenizer = __webpack_require__(19), - ParserFeedbackSimulator = __webpack_require__(116), - mergeOptions = __webpack_require__(34); - -var DEFAULT_OPTIONS = { - locationInfo: false -}; - -var SAXParser = module.exports = function (options) { - TransformStream.call(this); - - this.options = mergeOptions(DEFAULT_OPTIONS, options); - - this.tokenizer = new Tokenizer(options); - this.parserFeedbackSimulator = new ParserFeedbackSimulator(this.tokenizer); - - this.pendingText = null; - this.currentTokenLocation = void 0; - - this.lastChunkWritten = false; - this.stopped = false; - - // NOTE: always pipe stream to the /dev/null stream to avoid - // `highWaterMark` hit even if we don't have consumers. - // (see: https://github.com/inikulin/parse5/issues/97#issuecomment-171940774) - this.pipe(new DevNullStream()); -}; - -inherits(SAXParser, TransformStream); - -//TransformStream implementation -SAXParser.prototype._transform = function (chunk, encoding, callback) { - if (!this.stopped) { - this.tokenizer.write(chunk.toString('utf8'), this.lastChunkWritten); - this._runParsingLoop(); - } - - this.push(chunk); - - callback(); -}; - -SAXParser.prototype._flush = function (callback) { - callback(); -}; - -SAXParser.prototype.end = function (chunk, encoding, callback) { - this.lastChunkWritten = true; - TransformStream.prototype.end.call(this, chunk, encoding, callback); -}; - -SAXParser.prototype.stop = function () { - this.stopped = true; -}; - -//Internals -SAXParser.prototype._runParsingLoop = function () { - do { - var token = this.parserFeedbackSimulator.getNextToken(); - - if (token.type === Tokenizer.HIBERNATION_TOKEN) - break; - - if (token.type === Tokenizer.CHARACTER_TOKEN || - token.type === Tokenizer.WHITESPACE_CHARACTER_TOKEN || - token.type === Tokenizer.NULL_CHARACTER_TOKEN) { - - if (this.options.locationInfo) { - if (this.pendingText === null) - this.currentTokenLocation = token.location; - - else - this.currentTokenLocation.endOffset = token.location.endOffset; - } - - this.pendingText = (this.pendingText || '') + token.chars; - } - - else { - this._emitPendingText(); - this._handleToken(token); - } - } while (!this.stopped && token.type !== Tokenizer.EOF_TOKEN); -}; - -SAXParser.prototype._handleToken = function (token) { - if (this.options.locationInfo) - this.currentTokenLocation = token.location; - - if (token.type === Tokenizer.START_TAG_TOKEN) - this.emit('startTag', token.tagName, token.attrs, token.selfClosing, this.currentTokenLocation); - - else if (token.type === Tokenizer.END_TAG_TOKEN) - this.emit('endTag', token.tagName, this.currentTokenLocation); - - else if (token.type === Tokenizer.COMMENT_TOKEN) - this.emit('comment', token.data, this.currentTokenLocation); - - else if (token.type === Tokenizer.DOCTYPE_TOKEN) - this.emit('doctype', token.name, token.publicId, token.systemId, this.currentTokenLocation); -}; - -SAXParser.prototype._emitPendingText = function () { - if (this.pendingText !== null) { - this.emit('text', this.pendingText, this.currentTokenLocation); - this.pendingText = null; - } -}; - - -/***/ }), -/* 116 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -var Tokenizer = __webpack_require__(19), - foreignContent = __webpack_require__(49), - UNICODE = __webpack_require__(18), - HTML = __webpack_require__(11); - - -//Aliases -var $ = HTML.TAG_NAMES, - NS = HTML.NAMESPACES; - - -//ParserFeedbackSimulator -//Simulates adjustment of the Tokenizer which performed by standard parser during tree construction. -var ParserFeedbackSimulator = module.exports = function (tokenizer) { - this.tokenizer = tokenizer; - - this.namespaceStack = []; - this.namespaceStackTop = -1; - this._enterNamespace(NS.HTML); -}; - -ParserFeedbackSimulator.prototype.getNextToken = function () { - var token = this.tokenizer.getNextToken(); - - if (token.type === Tokenizer.START_TAG_TOKEN) - this._handleStartTagToken(token); - - else if (token.type === Tokenizer.END_TAG_TOKEN) - this._handleEndTagToken(token); - - else if (token.type === Tokenizer.NULL_CHARACTER_TOKEN && this.inForeignContent) { - token.type = Tokenizer.CHARACTER_TOKEN; - token.chars = UNICODE.REPLACEMENT_CHARACTER; - } - - else if (this.skipNextNewLine) { - if (token.type !== Tokenizer.HIBERNATION_TOKEN) - this.skipNextNewLine = false; - - if (token.type === Tokenizer.WHITESPACE_CHARACTER_TOKEN && token.chars[0] === '\n') { - if (token.chars.length === 1) - return this.getNextToken(); - - token.chars = token.chars.substr(1); - } - } - - return token; -}; - -//Namespace stack mutations -ParserFeedbackSimulator.prototype._enterNamespace = function (namespace) { - this.namespaceStackTop++; - this.namespaceStack.push(namespace); - - this.inForeignContent = namespace !== NS.HTML; - this.currentNamespace = namespace; - this.tokenizer.allowCDATA = this.inForeignContent; -}; - -ParserFeedbackSimulator.prototype._leaveCurrentNamespace = function () { - this.namespaceStackTop--; - this.namespaceStack.pop(); - - this.currentNamespace = this.namespaceStack[this.namespaceStackTop]; - this.inForeignContent = this.currentNamespace !== NS.HTML; - this.tokenizer.allowCDATA = this.inForeignContent; -}; - -//Token handlers -ParserFeedbackSimulator.prototype._ensureTokenizerMode = function (tn) { - if (tn === $.TEXTAREA || tn === $.TITLE) - this.tokenizer.state = Tokenizer.MODE.RCDATA; - - else if (tn === $.PLAINTEXT) - this.tokenizer.state = Tokenizer.MODE.PLAINTEXT; - - else if (tn === $.SCRIPT) - this.tokenizer.state = Tokenizer.MODE.SCRIPT_DATA; - - else if (tn === $.STYLE || tn === $.IFRAME || tn === $.XMP || - tn === $.NOEMBED || tn === $.NOFRAMES || tn === $.NOSCRIPT) - this.tokenizer.state = Tokenizer.MODE.RAWTEXT; -}; - -ParserFeedbackSimulator.prototype._handleStartTagToken = function (token) { - var tn = token.tagName; - - if (tn === $.SVG) - this._enterNamespace(NS.SVG); - - else if (tn === $.MATH) - this._enterNamespace(NS.MATHML); - - if (this.inForeignContent) { - if (foreignContent.causesExit(token)) { - this._leaveCurrentNamespace(); - return; - } - - var currentNs = this.currentNamespace; - - if (currentNs === NS.MATHML) - foreignContent.adjustTokenMathMLAttrs(token); - - else if (currentNs === NS.SVG) { - foreignContent.adjustTokenSVGTagName(token); - foreignContent.adjustTokenSVGAttrs(token); - } - - foreignContent.adjustTokenXMLAttrs(token); - - tn = token.tagName; - - if (!token.selfClosing && foreignContent.isIntegrationPoint(tn, currentNs, token.attrs)) - this._enterNamespace(NS.HTML); - } - - else { - if (tn === $.PRE || tn === $.TEXTAREA || tn === $.LISTING) - this.skipNextNewLine = true; - - else if (tn === $.IMAGE) - token.tagName = $.IMG; - - this._ensureTokenizerMode(tn); - } -}; - -ParserFeedbackSimulator.prototype._handleEndTagToken = function (token) { - var tn = token.tagName; - - if (!this.inForeignContent) { - var previousNs = this.namespaceStack[this.namespaceStackTop - 1]; - - if (previousNs === NS.SVG && foreignContent.SVG_TAG_NAMES_ADJUSTMENT_MAP[tn]) - tn = foreignContent.SVG_TAG_NAMES_ADJUSTMENT_MAP[tn]; - - //NOTE: check for exit from integration point - if (foreignContent.isIntegrationPoint(tn, previousNs, token.attrs)) - this._leaveCurrentNamespace(); - } - - else if (tn === $.SVG && this.currentNamespace === NS.SVG || - tn === $.MATH && this.currentNamespace === NS.MATHML) - this._leaveCurrentNamespace(); - - // NOTE: adjust end tag name as well for consistency - if (this.currentNamespace === NS.SVG) - foreignContent.adjustTokenSVGTagName(token); -}; - - -/***/ }), -/* 117 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -var ReadableStream = __webpack_require__(31).Readable, - inherits = __webpack_require__(24).inherits, - Serializer = __webpack_require__(53); - -var SerializerStream = module.exports = function (node, options) { - ReadableStream.call(this); - - this.serializer = new Serializer(node, options); - - Object.defineProperty(this.serializer, 'html', { - //NOTE: To make `+=` concat operator work properly we define - //getter which always returns empty string - get: function () { - return ''; - }, - set: this.push.bind(this) - }); -}; - -inherits(SerializerStream, ReadableStream); - -//Readable stream implementation -SerializerStream.prototype._read = function () { - this.serializer.serialize(); - this.push(null); -}; - - -/***/ }), -/* 118 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -//NOTE: this file contains auto-generated array mapped radix tree that is used for the named entity references consumption -//(details: https://github.com/inikulin/parse5/tree/master/scripts/generate_named_entity_data/README.md) -module.exports = new Uint16Array([4,52,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,106,303,412,810,1432,1701,1796,1987,2114,2360,2420,2484,3170,3251,4140,4393,4575,4610,5106,5512,5728,6117,6274,6315,6345,6427,6516,7002,7910,8733,9323,9870,10170,10631,10893,11318,11386,11467,12773,13092,14474,14922,15448,15542,16419,17666,18166,18611,19004,19095,19298,19397,4,16,69,77,97,98,99,102,103,108,109,110,111,112,114,115,116,117,140,150,158,169,176,194,199,210,216,222,226,242,256,266,283,294,108,105,103,5,198,1,59,148,1,198,80,5,38,1,59,156,1,38,99,117,116,101,5,193,1,59,167,1,193,114,101,118,101,59,1,258,4,2,105,121,182,191,114,99,5,194,1,59,189,1,194,59,1,1040,114,59,3,55349,56580,114,97,118,101,5,192,1,59,208,1,192,112,104,97,59,1,913,97,99,114,59,1,256,100,59,1,10835,4,2,103,112,232,237,111,110,59,1,260,102,59,3,55349,56632,112,108,121,70,117,110,99,116,105,111,110,59,1,8289,105,110,103,5,197,1,59,264,1,197,4,2,99,115,272,277,114,59,3,55349,56476,105,103,110,59,1,8788,105,108,100,101,5,195,1,59,292,1,195,109,108,5,196,1,59,301,1,196,4,8,97,99,101,102,111,114,115,117,321,350,354,383,388,394,400,405,4,2,99,114,327,336,107,115,108,97,115,104,59,1,8726,4,2,118,119,342,345,59,1,10983,101,100,59,1,8966,121,59,1,1041,4,3,99,114,116,362,369,379,97,117,115,101,59,1,8757,110,111,117,108,108,105,115,59,1,8492,97,59,1,914,114,59,3,55349,56581,112,102,59,3,55349,56633,101,118,101,59,1,728,99,114,59,1,8492,109,112,101,113,59,1,8782,4,14,72,79,97,99,100,101,102,104,105,108,111,114,115,117,442,447,456,504,542,547,569,573,577,616,678,784,790,796,99,121,59,1,1063,80,89,5,169,1,59,454,1,169,4,3,99,112,121,464,470,497,117,116,101,59,1,262,4,2,59,105,476,478,1,8914,116,97,108,68,105,102,102,101,114,101,110,116,105,97,108,68,59,1,8517,108,101,121,115,59,1,8493,4,4,97,101,105,111,514,520,530,535,114,111,110,59,1,268,100,105,108,5,199,1,59,528,1,199,114,99,59,1,264,110,105,110,116,59,1,8752,111,116,59,1,266,4,2,100,110,553,560,105,108,108,97,59,1,184,116,101,114,68,111,116,59,1,183,114,59,1,8493,105,59,1,935,114,99,108,101,4,4,68,77,80,84,591,596,603,609,111,116,59,1,8857,105,110,117,115,59,1,8854,108,117,115,59,1,8853,105,109,101,115,59,1,8855,111,4,2,99,115,623,646,107,119,105,115,101,67,111,110,116,111,117,114,73,110,116,101,103,114,97,108,59,1,8754,101,67,117,114,108,121,4,2,68,81,658,671,111,117,98,108,101,81,117,111,116,101,59,1,8221,117,111,116,101,59,1,8217,4,4,108,110,112,117,688,701,736,753,111,110,4,2,59,101,696,698,1,8759,59,1,10868,4,3,103,105,116,709,717,722,114,117,101,110,116,59,1,8801,110,116,59,1,8751,111,117,114,73,110,116,101,103,114,97,108,59,1,8750,4,2,102,114,742,745,59,1,8450,111,100,117,99,116,59,1,8720,110,116,101,114,67,108,111,99,107,119,105,115,101,67,111,110,116,111,117,114,73,110,116,101,103,114,97,108,59,1,8755,111,115,115,59,1,10799,99,114,59,3,55349,56478,112,4,2,59,67,803,805,1,8915,97,112,59,1,8781,4,11,68,74,83,90,97,99,101,102,105,111,115,834,850,855,860,865,888,903,916,921,1011,1415,4,2,59,111,840,842,1,8517,116,114,97,104,100,59,1,10513,99,121,59,1,1026,99,121,59,1,1029,99,121,59,1,1039,4,3,103,114,115,873,879,883,103,101,114,59,1,8225,114,59,1,8609,104,118,59,1,10980,4,2,97,121,894,900,114,111,110,59,1,270,59,1,1044,108,4,2,59,116,910,912,1,8711,97,59,1,916,114,59,3,55349,56583,4,2,97,102,927,998,4,2,99,109,933,992,114,105,116,105,99,97,108,4,4,65,68,71,84,950,957,978,985,99,117,116,101,59,1,180,111,4,2,116,117,964,967,59,1,729,98,108,101,65,99,117,116,101,59,1,733,114,97,118,101,59,1,96,105,108,100,101,59,1,732,111,110,100,59,1,8900,102,101,114,101,110,116,105,97,108,68,59,1,8518,4,4,112,116,117,119,1021,1026,1048,1249,102,59,3,55349,56635,4,3,59,68,69,1034,1036,1041,1,168,111,116,59,1,8412,113,117,97,108,59,1,8784,98,108,101,4,6,67,68,76,82,85,86,1065,1082,1101,1189,1211,1236,111,110,116,111,117,114,73,110,116,101,103,114,97,108,59,1,8751,111,4,2,116,119,1089,1092,59,1,168,110,65,114,114,111,119,59,1,8659,4,2,101,111,1107,1141,102,116,4,3,65,82,84,1117,1124,1136,114,114,111,119,59,1,8656,105,103,104,116,65,114,114,111,119,59,1,8660,101,101,59,1,10980,110,103,4,2,76,82,1149,1177,101,102,116,4,2,65,82,1158,1165,114,114,111,119,59,1,10232,105,103,104,116,65,114,114,111,119,59,1,10234,105,103,104,116,65,114,114,111,119,59,1,10233,105,103,104,116,4,2,65,84,1199,1206,114,114,111,119,59,1,8658,101,101,59,1,8872,112,4,2,65,68,1218,1225,114,114,111,119,59,1,8657,111,119,110,65,114,114,111,119,59,1,8661,101,114,116,105,99,97,108,66,97,114,59,1,8741,110,4,6,65,66,76,82,84,97,1264,1292,1299,1352,1391,1408,114,114,111,119,4,3,59,66,85,1276,1278,1283,1,8595,97,114,59,1,10515,112,65,114,114,111,119,59,1,8693,114,101,118,101,59,1,785,101,102,116,4,3,82,84,86,1310,1323,1334,105,103,104,116,86,101,99,116,111,114,59,1,10576,101,101,86,101,99,116,111,114,59,1,10590,101,99,116,111,114,4,2,59,66,1345,1347,1,8637,97,114,59,1,10582,105,103,104,116,4,2,84,86,1362,1373,101,101,86,101,99,116,111,114,59,1,10591,101,99,116,111,114,4,2,59,66,1384,1386,1,8641,97,114,59,1,10583,101,101,4,2,59,65,1399,1401,1,8868,114,114,111,119,59,1,8615,114,114,111,119,59,1,8659,4,2,99,116,1421,1426,114,59,3,55349,56479,114,111,107,59,1,272,4,16,78,84,97,99,100,102,103,108,109,111,112,113,115,116,117,120,1466,1470,1478,1489,1515,1520,1525,1536,1544,1593,1609,1617,1650,1664,1668,1677,71,59,1,330,72,5,208,1,59,1476,1,208,99,117,116,101,5,201,1,59,1487,1,201,4,3,97,105,121,1497,1503,1512,114,111,110,59,1,282,114,99,5,202,1,59,1510,1,202,59,1,1069,111,116,59,1,278,114,59,3,55349,56584,114,97,118,101,5,200,1,59,1534,1,200,101,109,101,110,116,59,1,8712,4,2,97,112,1550,1555,99,114,59,1,274,116,121,4,2,83,86,1563,1576,109,97,108,108,83,113,117,97,114,101,59,1,9723,101,114,121,83,109,97,108,108,83,113,117,97,114,101,59,1,9643,4,2,103,112,1599,1604,111,110,59,1,280,102,59,3,55349,56636,115,105,108,111,110,59,1,917,117,4,2,97,105,1624,1640,108,4,2,59,84,1631,1633,1,10869,105,108,100,101,59,1,8770,108,105,98,114,105,117,109,59,1,8652,4,2,99,105,1656,1660,114,59,1,8496,109,59,1,10867,97,59,1,919,109,108,5,203,1,59,1675,1,203,4,2,105,112,1683,1689,115,116,115,59,1,8707,111,110,101,110,116,105,97,108,69,59,1,8519,4,5,99,102,105,111,115,1713,1717,1722,1762,1791,121,59,1,1060,114,59,3,55349,56585,108,108,101,100,4,2,83,86,1732,1745,109,97,108,108,83,113,117,97,114,101,59,1,9724,101,114,121,83,109,97,108,108,83,113,117,97,114,101,59,1,9642,4,3,112,114,117,1770,1775,1781,102,59,3,55349,56637,65,108,108,59,1,8704,114,105,101,114,116,114,102,59,1,8497,99,114,59,1,8497,4,12,74,84,97,98,99,100,102,103,111,114,115,116,1822,1827,1834,1848,1855,1877,1882,1887,1890,1896,1978,1984,99,121,59,1,1027,5,62,1,59,1832,1,62,109,109,97,4,2,59,100,1843,1845,1,915,59,1,988,114,101,118,101,59,1,286,4,3,101,105,121,1863,1869,1874,100,105,108,59,1,290,114,99,59,1,284,59,1,1043,111,116,59,1,288,114,59,3,55349,56586,59,1,8921,112,102,59,3,55349,56638,101,97,116,101,114,4,6,69,70,71,76,83,84,1915,1933,1944,1953,1959,1971,113,117,97,108,4,2,59,76,1925,1927,1,8805,101,115,115,59,1,8923,117,108,108,69,113,117,97,108,59,1,8807,114,101,97,116,101,114,59,1,10914,101,115,115,59,1,8823,108,97,110,116,69,113,117,97,108,59,1,10878,105,108,100,101,59,1,8819,99,114,59,3,55349,56482,59,1,8811,4,8,65,97,99,102,105,111,115,117,2005,2012,2026,2032,2036,2049,2073,2089,82,68,99,121,59,1,1066,4,2,99,116,2018,2023,101,107,59,1,711,59,1,94,105,114,99,59,1,292,114,59,1,8460,108,98,101,114,116,83,112,97,99,101,59,1,8459,4,2,112,114,2055,2059,102,59,1,8461,105,122,111,110,116,97,108,76,105,110,101,59,1,9472,4,2,99,116,2079,2083,114,59,1,8459,114,111,107,59,1,294,109,112,4,2,68,69,2097,2107,111,119,110,72,117,109,112,59,1,8782,113,117,97,108,59,1,8783,4,14,69,74,79,97,99,100,102,103,109,110,111,115,116,117,2144,2149,2155,2160,2171,2189,2194,2198,2209,2245,2307,2329,2334,2341,99,121,59,1,1045,108,105,103,59,1,306,99,121,59,1,1025,99,117,116,101,5,205,1,59,2169,1,205,4,2,105,121,2177,2186,114,99,5,206,1,59,2184,1,206,59,1,1048,111,116,59,1,304,114,59,1,8465,114,97,118,101,5,204,1,59,2207,1,204,4,3,59,97,112,2217,2219,2238,1,8465,4,2,99,103,2225,2229,114,59,1,298,105,110,97,114,121,73,59,1,8520,108,105,101,115,59,1,8658,4,2,116,118,2251,2281,4,2,59,101,2257,2259,1,8748,4,2,103,114,2265,2271,114,97,108,59,1,8747,115,101,99,116,105,111,110,59,1,8898,105,115,105,98,108,101,4,2,67,84,2293,2300,111,109,109,97,59,1,8291,105,109,101,115,59,1,8290,4,3,103,112,116,2315,2320,2325,111,110,59,1,302,102,59,3,55349,56640,97,59,1,921,99,114,59,1,8464,105,108,100,101,59,1,296,4,2,107,109,2347,2352,99,121,59,1,1030,108,5,207,1,59,2358,1,207,4,5,99,102,111,115,117,2372,2386,2391,2397,2414,4,2,105,121,2378,2383,114,99,59,1,308,59,1,1049,114,59,3,55349,56589,112,102,59,3,55349,56641,4,2,99,101,2403,2408,114,59,3,55349,56485,114,99,121,59,1,1032,107,99,121,59,1,1028,4,7,72,74,97,99,102,111,115,2436,2441,2446,2452,2467,2472,2478,99,121,59,1,1061,99,121,59,1,1036,112,112,97,59,1,922,4,2,101,121,2458,2464,100,105,108,59,1,310,59,1,1050,114,59,3,55349,56590,112,102,59,3,55349,56642,99,114,59,3,55349,56486,4,11,74,84,97,99,101,102,108,109,111,115,116,2508,2513,2520,2562,2585,2981,2986,3004,3011,3146,3167,99,121,59,1,1033,5,60,1,59,2518,1,60,4,5,99,109,110,112,114,2532,2538,2544,2548,2558,117,116,101,59,1,313,98,100,97,59,1,923,103,59,1,10218,108,97,99,101,116,114,102,59,1,8466,114,59,1,8606,4,3,97,101,121,2570,2576,2582,114,111,110,59,1,317,100,105,108,59,1,315,59,1,1051,4,2,102,115,2591,2907,116,4,10,65,67,68,70,82,84,85,86,97,114,2614,2663,2672,2728,2735,2760,2820,2870,2888,2895,4,2,110,114,2620,2633,103,108,101,66,114,97,99,107,101,116,59,1,10216,114,111,119,4,3,59,66,82,2644,2646,2651,1,8592,97,114,59,1,8676,105,103,104,116,65,114,114,111,119,59,1,8646,101,105,108,105,110,103,59,1,8968,111,4,2,117,119,2679,2692,98,108,101,66,114,97,99,107,101,116,59,1,10214,110,4,2,84,86,2699,2710,101,101,86,101,99,116,111,114,59,1,10593,101,99,116,111,114,4,2,59,66,2721,2723,1,8643,97,114,59,1,10585,108,111,111,114,59,1,8970,105,103,104,116,4,2,65,86,2745,2752,114,114,111,119,59,1,8596,101,99,116,111,114,59,1,10574,4,2,101,114,2766,2792,101,4,3,59,65,86,2775,2777,2784,1,8867,114,114,111,119,59,1,8612,101,99,116,111,114,59,1,10586,105,97,110,103,108,101,4,3,59,66,69,2806,2808,2813,1,8882,97,114,59,1,10703,113,117,97,108,59,1,8884,112,4,3,68,84,86,2829,2841,2852,111,119,110,86,101,99,116,111,114,59,1,10577,101,101,86,101,99,116,111,114,59,1,10592,101,99,116,111,114,4,2,59,66,2863,2865,1,8639,97,114,59,1,10584,101,99,116,111,114,4,2,59,66,2881,2883,1,8636,97,114,59,1,10578,114,114,111,119,59,1,8656,105,103,104,116,97,114,114,111,119,59,1,8660,115,4,6,69,70,71,76,83,84,2922,2936,2947,2956,2962,2974,113,117,97,108,71,114,101,97,116,101,114,59,1,8922,117,108,108,69,113,117,97,108,59,1,8806,114,101,97,116,101,114,59,1,8822,101,115,115,59,1,10913,108,97,110,116,69,113,117,97,108,59,1,10877,105,108,100,101,59,1,8818,114,59,3,55349,56591,4,2,59,101,2992,2994,1,8920,102,116,97,114,114,111,119,59,1,8666,105,100,111,116,59,1,319,4,3,110,112,119,3019,3110,3115,103,4,4,76,82,108,114,3030,3058,3070,3098,101,102,116,4,2,65,82,3039,3046,114,114,111,119,59,1,10229,105,103,104,116,65,114,114,111,119,59,1,10231,105,103,104,116,65,114,114,111,119,59,1,10230,101,102,116,4,2,97,114,3079,3086,114,114,111,119,59,1,10232,105,103,104,116,97,114,114,111,119,59,1,10234,105,103,104,116,97,114,114,111,119,59,1,10233,102,59,3,55349,56643,101,114,4,2,76,82,3123,3134,101,102,116,65,114,114,111,119,59,1,8601,105,103,104,116,65,114,114,111,119,59,1,8600,4,3,99,104,116,3154,3158,3161,114,59,1,8466,59,1,8624,114,111,107,59,1,321,59,1,8810,4,8,97,99,101,102,105,111,115,117,3188,3192,3196,3222,3227,3237,3243,3248,112,59,1,10501,121,59,1,1052,4,2,100,108,3202,3213,105,117,109,83,112,97,99,101,59,1,8287,108,105,110,116,114,102,59,1,8499,114,59,3,55349,56592,110,117,115,80,108,117,115,59,1,8723,112,102,59,3,55349,56644,99,114,59,1,8499,59,1,924,4,9,74,97,99,101,102,111,115,116,117,3271,3276,3283,3306,3422,3427,4120,4126,4137,99,121,59,1,1034,99,117,116,101,59,1,323,4,3,97,101,121,3291,3297,3303,114,111,110,59,1,327,100,105,108,59,1,325,59,1,1053,4,3,103,115,119,3314,3380,3415,97,116,105,118,101,4,3,77,84,86,3327,3340,3365,101,100,105,117,109,83,112,97,99,101,59,1,8203,104,105,4,2,99,110,3348,3357,107,83,112,97,99,101,59,1,8203,83,112,97,99,101,59,1,8203,101,114,121,84,104,105,110,83,112,97,99,101,59,1,8203,116,101,100,4,2,71,76,3389,3405,114,101,97,116,101,114,71,114,101,97,116,101,114,59,1,8811,101,115,115,76,101,115,115,59,1,8810,76,105,110,101,59,1,10,114,59,3,55349,56593,4,4,66,110,112,116,3437,3444,3460,3464,114,101,97,107,59,1,8288,66,114,101,97,107,105,110,103,83,112,97,99,101,59,1,160,102,59,1,8469,4,13,59,67,68,69,71,72,76,78,80,82,83,84,86,3492,3494,3517,3536,3578,3657,3685,3784,3823,3860,3915,4066,4107,1,10988,4,2,111,117,3500,3510,110,103,114,117,101,110,116,59,1,8802,112,67,97,112,59,1,8813,111,117,98,108,101,86,101,114,116,105,99,97,108,66,97,114,59,1,8742,4,3,108,113,120,3544,3552,3571,101,109,101,110,116,59,1,8713,117,97,108,4,2,59,84,3561,3563,1,8800,105,108,100,101,59,3,8770,824,105,115,116,115,59,1,8708,114,101,97,116,101,114,4,7,59,69,70,71,76,83,84,3600,3602,3609,3621,3631,3637,3650,1,8815,113,117,97,108,59,1,8817,117,108,108,69,113,117,97,108,59,3,8807,824,114,101,97,116,101,114,59,3,8811,824,101,115,115,59,1,8825,108,97,110,116,69,113,117,97,108,59,3,10878,824,105,108,100,101,59,1,8821,117,109,112,4,2,68,69,3666,3677,111,119,110,72,117,109,112,59,3,8782,824,113,117,97,108,59,3,8783,824,101,4,2,102,115,3692,3724,116,84,114,105,97,110,103,108,101,4,3,59,66,69,3709,3711,3717,1,8938,97,114,59,3,10703,824,113,117,97,108,59,1,8940,115,4,6,59,69,71,76,83,84,3739,3741,3748,3757,3764,3777,1,8814,113,117,97,108,59,1,8816,114,101,97,116,101,114,59,1,8824,101,115,115,59,3,8810,824,108,97,110,116,69,113,117,97,108,59,3,10877,824,105,108,100,101,59,1,8820,101,115,116,101,100,4,2,71,76,3795,3812,114,101,97,116,101,114,71,114,101,97,116,101,114,59,3,10914,824,101,115,115,76,101,115,115,59,3,10913,824,114,101,99,101,100,101,115,4,3,59,69,83,3838,3840,3848,1,8832,113,117,97,108,59,3,10927,824,108,97,110,116,69,113,117,97,108,59,1,8928,4,2,101,105,3866,3881,118,101,114,115,101,69,108,101,109,101,110,116,59,1,8716,103,104,116,84,114,105,97,110,103,108,101,4,3,59,66,69,3900,3902,3908,1,8939,97,114,59,3,10704,824,113,117,97,108,59,1,8941,4,2,113,117,3921,3973,117,97,114,101,83,117,4,2,98,112,3933,3952,115,101,116,4,2,59,69,3942,3945,3,8847,824,113,117,97,108,59,1,8930,101,114,115,101,116,4,2,59,69,3963,3966,3,8848,824,113,117,97,108,59,1,8931,4,3,98,99,112,3981,4000,4045,115,101,116,4,2,59,69,3990,3993,3,8834,8402,113,117,97,108,59,1,8840,99,101,101,100,115,4,4,59,69,83,84,4015,4017,4025,4037,1,8833,113,117,97,108,59,3,10928,824,108,97,110,116,69,113,117,97,108,59,1,8929,105,108,100,101,59,3,8831,824,101,114,115,101,116,4,2,59,69,4056,4059,3,8835,8402,113,117,97,108,59,1,8841,105,108,100,101,4,4,59,69,70,84,4080,4082,4089,4100,1,8769,113,117,97,108,59,1,8772,117,108,108,69,113,117,97,108,59,1,8775,105,108,100,101,59,1,8777,101,114,116,105,99,97,108,66,97,114,59,1,8740,99,114,59,3,55349,56489,105,108,100,101,5,209,1,59,4135,1,209,59,1,925,4,14,69,97,99,100,102,103,109,111,112,114,115,116,117,118,4170,4176,4187,4205,4212,4217,4228,4253,4259,4292,4295,4316,4337,4346,108,105,103,59,1,338,99,117,116,101,5,211,1,59,4185,1,211,4,2,105,121,4193,4202,114,99,5,212,1,59,4200,1,212,59,1,1054,98,108,97,99,59,1,336,114,59,3,55349,56594,114,97,118,101,5,210,1,59,4226,1,210,4,3,97,101,105,4236,4241,4246,99,114,59,1,332,103,97,59,1,937,99,114,111,110,59,1,927,112,102,59,3,55349,56646,101,110,67,117,114,108,121,4,2,68,81,4272,4285,111,117,98,108,101,81,117,111,116,101,59,1,8220,117,111,116,101,59,1,8216,59,1,10836,4,2,99,108,4301,4306,114,59,3,55349,56490,97,115,104,5,216,1,59,4314,1,216,105,4,2,108,109,4323,4332,100,101,5,213,1,59,4330,1,213,101,115,59,1,10807,109,108,5,214,1,59,4344,1,214,101,114,4,2,66,80,4354,4380,4,2,97,114,4360,4364,114,59,1,8254,97,99,4,2,101,107,4372,4375,59,1,9182,101,116,59,1,9140,97,114,101,110,116,104,101,115,105,115,59,1,9180,4,9,97,99,102,104,105,108,111,114,115,4413,4422,4426,4431,4435,4438,4448,4471,4561,114,116,105,97,108,68,59,1,8706,121,59,1,1055,114,59,3,55349,56595,105,59,1,934,59,1,928,117,115,77,105,110,117,115,59,1,177,4,2,105,112,4454,4467,110,99,97,114,101,112,108,97,110,101,59,1,8460,102,59,1,8473,4,4,59,101,105,111,4481,4483,4526,4531,1,10939,99,101,100,101,115,4,4,59,69,83,84,4498,4500,4507,4519,1,8826,113,117,97,108,59,1,10927,108,97,110,116,69,113,117,97,108,59,1,8828,105,108,100,101,59,1,8830,109,101,59,1,8243,4,2,100,112,4537,4543,117,99,116,59,1,8719,111,114,116,105,111,110,4,2,59,97,4555,4557,1,8759,108,59,1,8733,4,2,99,105,4567,4572,114,59,3,55349,56491,59,1,936,4,4,85,102,111,115,4585,4594,4599,4604,79,84,5,34,1,59,4592,1,34,114,59,3,55349,56596,112,102,59,1,8474,99,114,59,3,55349,56492,4,12,66,69,97,99,101,102,104,105,111,114,115,117,4636,4642,4650,4681,4704,4763,4767,4771,5047,5069,5081,5094,97,114,114,59,1,10512,71,5,174,1,59,4648,1,174,4,3,99,110,114,4658,4664,4668,117,116,101,59,1,340,103,59,1,10219,114,4,2,59,116,4675,4677,1,8608,108,59,1,10518,4,3,97,101,121,4689,4695,4701,114,111,110,59,1,344,100,105,108,59,1,342,59,1,1056,4,2,59,118,4710,4712,1,8476,101,114,115,101,4,2,69,85,4722,4748,4,2,108,113,4728,4736,101,109,101,110,116,59,1,8715,117,105,108,105,98,114,105,117,109,59,1,8651,112,69,113,117,105,108,105,98,114,105,117,109,59,1,10607,114,59,1,8476,111,59,1,929,103,104,116,4,8,65,67,68,70,84,85,86,97,4792,4840,4849,4905,4912,4972,5022,5040,4,2,110,114,4798,4811,103,108,101,66,114,97,99,107,101,116,59,1,10217,114,111,119,4,3,59,66,76,4822,4824,4829,1,8594,97,114,59,1,8677,101,102,116,65,114,114,111,119,59,1,8644,101,105,108,105,110,103,59,1,8969,111,4,2,117,119,4856,4869,98,108,101,66,114,97,99,107,101,116,59,1,10215,110,4,2,84,86,4876,4887,101,101,86,101,99,116,111,114,59,1,10589,101,99,116,111,114,4,2,59,66,4898,4900,1,8642,97,114,59,1,10581,108,111,111,114,59,1,8971,4,2,101,114,4918,4944,101,4,3,59,65,86,4927,4929,4936,1,8866,114,114,111,119,59,1,8614,101,99,116,111,114,59,1,10587,105,97,110,103,108,101,4,3,59,66,69,4958,4960,4965,1,8883,97,114,59,1,10704,113,117,97,108,59,1,8885,112,4,3,68,84,86,4981,4993,5004,111,119,110,86,101,99,116,111,114,59,1,10575,101,101,86,101,99,116,111,114,59,1,10588,101,99,116,111,114,4,2,59,66,5015,5017,1,8638,97,114,59,1,10580,101,99,116,111,114,4,2,59,66,5033,5035,1,8640,97,114,59,1,10579,114,114,111,119,59,1,8658,4,2,112,117,5053,5057,102,59,1,8477,110,100,73,109,112,108,105,101,115,59,1,10608,105,103,104,116,97,114,114,111,119,59,1,8667,4,2,99,104,5087,5091,114,59,1,8475,59,1,8625,108,101,68,101,108,97,121,101,100,59,1,10740,4,13,72,79,97,99,102,104,105,109,111,113,115,116,117,5134,5150,5157,5164,5198,5203,5259,5265,5277,5283,5374,5380,5385,4,2,67,99,5140,5146,72,99,121,59,1,1065,121,59,1,1064,70,84,99,121,59,1,1068,99,117,116,101,59,1,346,4,5,59,97,101,105,121,5176,5178,5184,5190,5195,1,10940,114,111,110,59,1,352,100,105,108,59,1,350,114,99,59,1,348,59,1,1057,114,59,3,55349,56598,111,114,116,4,4,68,76,82,85,5216,5227,5238,5250,111,119,110,65,114,114,111,119,59,1,8595,101,102,116,65,114,114,111,119,59,1,8592,105,103,104,116,65,114,114,111,119,59,1,8594,112,65,114,114,111,119,59,1,8593,103,109,97,59,1,931,97,108,108,67,105,114,99,108,101,59,1,8728,112,102,59,3,55349,56650,4,2,114,117,5289,5293,116,59,1,8730,97,114,101,4,4,59,73,83,85,5306,5308,5322,5367,1,9633,110,116,101,114,115,101,99,116,105,111,110,59,1,8851,117,4,2,98,112,5329,5347,115,101,116,4,2,59,69,5338,5340,1,8847,113,117,97,108,59,1,8849,101,114,115,101,116,4,2,59,69,5358,5360,1,8848,113,117,97,108,59,1,8850,110,105,111,110,59,1,8852,99,114,59,3,55349,56494,97,114,59,1,8902,4,4,98,99,109,112,5395,5420,5475,5478,4,2,59,115,5401,5403,1,8912,101,116,4,2,59,69,5411,5413,1,8912,113,117,97,108,59,1,8838,4,2,99,104,5426,5468,101,101,100,115,4,4,59,69,83,84,5440,5442,5449,5461,1,8827,113,117,97,108,59,1,10928,108,97,110,116,69,113,117,97,108,59,1,8829,105,108,100,101,59,1,8831,84,104,97,116,59,1,8715,59,1,8721,4,3,59,101,115,5486,5488,5507,1,8913,114,115,101,116,4,2,59,69,5498,5500,1,8835,113,117,97,108,59,1,8839,101,116,59,1,8913,4,11,72,82,83,97,99,102,104,105,111,114,115,5536,5546,5552,5567,5579,5602,5607,5655,5695,5701,5711,79,82,78,5,222,1,59,5544,1,222,65,68,69,59,1,8482,4,2,72,99,5558,5563,99,121,59,1,1035,121,59,1,1062,4,2,98,117,5573,5576,59,1,9,59,1,932,4,3,97,101,121,5587,5593,5599,114,111,110,59,1,356,100,105,108,59,1,354,59,1,1058,114,59,3,55349,56599,4,2,101,105,5613,5631,4,2,114,116,5619,5627,101,102,111,114,101,59,1,8756,97,59,1,920,4,2,99,110,5637,5647,107,83,112,97,99,101,59,3,8287,8202,83,112,97,99,101,59,1,8201,108,100,101,4,4,59,69,70,84,5668,5670,5677,5688,1,8764,113,117,97,108,59,1,8771,117,108,108,69,113,117,97,108,59,1,8773,105,108,100,101,59,1,8776,112,102,59,3,55349,56651,105,112,108,101,68,111,116,59,1,8411,4,2,99,116,5717,5722,114,59,3,55349,56495,114,111,107,59,1,358,4,14,97,98,99,100,102,103,109,110,111,112,114,115,116,117,5758,5789,5805,5823,5830,5835,5846,5852,5921,5937,6089,6095,6101,6108,4,2,99,114,5764,5774,117,116,101,5,218,1,59,5772,1,218,114,4,2,59,111,5781,5783,1,8607,99,105,114,59,1,10569,114,4,2,99,101,5796,5800,121,59,1,1038,118,101,59,1,364,4,2,105,121,5811,5820,114,99,5,219,1,59,5818,1,219,59,1,1059,98,108,97,99,59,1,368,114,59,3,55349,56600,114,97,118,101,5,217,1,59,5844,1,217,97,99,114,59,1,362,4,2,100,105,5858,5905,101,114,4,2,66,80,5866,5892,4,2,97,114,5872,5876,114,59,1,95,97,99,4,2,101,107,5884,5887,59,1,9183,101,116,59,1,9141,97,114,101,110,116,104,101,115,105,115,59,1,9181,111,110,4,2,59,80,5913,5915,1,8899,108,117,115,59,1,8846,4,2,103,112,5927,5932,111,110,59,1,370,102,59,3,55349,56652,4,8,65,68,69,84,97,100,112,115,5955,5985,5996,6009,6026,6033,6044,6075,114,114,111,119,4,3,59,66,68,5967,5969,5974,1,8593,97,114,59,1,10514,111,119,110,65,114,114,111,119,59,1,8645,111,119,110,65,114,114,111,119,59,1,8597,113,117,105,108,105,98,114,105,117,109,59,1,10606,101,101,4,2,59,65,6017,6019,1,8869,114,114,111,119,59,1,8613,114,114,111,119,59,1,8657,111,119,110,97,114,114,111,119,59,1,8661,101,114,4,2,76,82,6052,6063,101,102,116,65,114,114,111,119,59,1,8598,105,103,104,116,65,114,114,111,119,59,1,8599,105,4,2,59,108,6082,6084,1,978,111,110,59,1,933,105,110,103,59,1,366,99,114,59,3,55349,56496,105,108,100,101,59,1,360,109,108,5,220,1,59,6115,1,220,4,9,68,98,99,100,101,102,111,115,118,6137,6143,6148,6152,6166,6250,6255,6261,6267,97,115,104,59,1,8875,97,114,59,1,10987,121,59,1,1042,97,115,104,4,2,59,108,6161,6163,1,8873,59,1,10982,4,2,101,114,6172,6175,59,1,8897,4,3,98,116,121,6183,6188,6238,97,114,59,1,8214,4,2,59,105,6194,6196,1,8214,99,97,108,4,4,66,76,83,84,6209,6214,6220,6231,97,114,59,1,8739,105,110,101,59,1,124,101,112,97,114,97,116,111,114,59,1,10072,105,108,100,101,59,1,8768,84,104,105,110,83,112,97,99,101,59,1,8202,114,59,3,55349,56601,112,102,59,3,55349,56653,99,114,59,3,55349,56497,100,97,115,104,59,1,8874,4,5,99,101,102,111,115,6286,6292,6298,6303,6309,105,114,99,59,1,372,100,103,101,59,1,8896,114,59,3,55349,56602,112,102,59,3,55349,56654,99,114,59,3,55349,56498,4,4,102,105,111,115,6325,6330,6333,6339,114,59,3,55349,56603,59,1,926,112,102,59,3,55349,56655,99,114,59,3,55349,56499,4,9,65,73,85,97,99,102,111,115,117,6365,6370,6375,6380,6391,6405,6410,6416,6422,99,121,59,1,1071,99,121,59,1,1031,99,121,59,1,1070,99,117,116,101,5,221,1,59,6389,1,221,4,2,105,121,6397,6402,114,99,59,1,374,59,1,1067,114,59,3,55349,56604,112,102,59,3,55349,56656,99,114,59,3,55349,56500,109,108,59,1,376,4,8,72,97,99,100,101,102,111,115,6445,6450,6457,6472,6477,6501,6505,6510,99,121,59,1,1046,99,117,116,101,59,1,377,4,2,97,121,6463,6469,114,111,110,59,1,381,59,1,1047,111,116,59,1,379,4,2,114,116,6483,6497,111,87,105,100,116,104,83,112,97,99,101,59,1,8203,97,59,1,918,114,59,1,8488,112,102,59,1,8484,99,114,59,3,55349,56501,4,16,97,98,99,101,102,103,108,109,110,111,112,114,115,116,117,119,6550,6561,6568,6612,6622,6634,6645,6672,6699,6854,6870,6923,6933,6963,6974,6983,99,117,116,101,5,225,1,59,6559,1,225,114,101,118,101,59,1,259,4,6,59,69,100,105,117,121,6582,6584,6588,6591,6600,6609,1,8766,59,3,8766,819,59,1,8767,114,99,5,226,1,59,6598,1,226,116,101,5,180,1,59,6607,1,180,59,1,1072,108,105,103,5,230,1,59,6620,1,230,4,2,59,114,6628,6630,1,8289,59,3,55349,56606,114,97,118,101,5,224,1,59,6643,1,224,4,2,101,112,6651,6667,4,2,102,112,6657,6663,115,121,109,59,1,8501,104,59,1,8501,104,97,59,1,945,4,2,97,112,6678,6692,4,2,99,108,6684,6688,114,59,1,257,103,59,1,10815,5,38,1,59,6697,1,38,4,2,100,103,6705,6737,4,5,59,97,100,115,118,6717,6719,6724,6727,6734,1,8743,110,100,59,1,10837,59,1,10844,108,111,112,101,59,1,10840,59,1,10842,4,7,59,101,108,109,114,115,122,6753,6755,6758,6762,6814,6835,6848,1,8736,59,1,10660,101,59,1,8736,115,100,4,2,59,97,6770,6772,1,8737,4,8,97,98,99,100,101,102,103,104,6790,6793,6796,6799,6802,6805,6808,6811,59,1,10664,59,1,10665,59,1,10666,59,1,10667,59,1,10668,59,1,10669,59,1,10670,59,1,10671,116,4,2,59,118,6821,6823,1,8735,98,4,2,59,100,6830,6832,1,8894,59,1,10653,4,2,112,116,6841,6845,104,59,1,8738,59,1,197,97,114,114,59,1,9084,4,2,103,112,6860,6865,111,110,59,1,261,102,59,3,55349,56658,4,7,59,69,97,101,105,111,112,6886,6888,6891,6897,6900,6904,6908,1,8776,59,1,10864,99,105,114,59,1,10863,59,1,8778,100,59,1,8779,115,59,1,39,114,111,120,4,2,59,101,6917,6919,1,8776,113,59,1,8778,105,110,103,5,229,1,59,6931,1,229,4,3,99,116,121,6941,6946,6949,114,59,3,55349,56502,59,1,42,109,112,4,2,59,101,6957,6959,1,8776,113,59,1,8781,105,108,100,101,5,227,1,59,6972,1,227,109,108,5,228,1,59,6981,1,228,4,2,99,105,6989,6997,111,110,105,110,116,59,1,8755,110,116,59,1,10769,4,16,78,97,98,99,100,101,102,105,107,108,110,111,112,114,115,117,7036,7041,7119,7135,7149,7155,7219,7224,7347,7354,7463,7489,7786,7793,7814,7866,111,116,59,1,10989,4,2,99,114,7047,7094,107,4,4,99,101,112,115,7058,7064,7073,7080,111,110,103,59,1,8780,112,115,105,108,111,110,59,1,1014,114,105,109,101,59,1,8245,105,109,4,2,59,101,7088,7090,1,8765,113,59,1,8909,4,2,118,119,7100,7105,101,101,59,1,8893,101,100,4,2,59,103,7113,7115,1,8965,101,59,1,8965,114,107,4,2,59,116,7127,7129,1,9141,98,114,107,59,1,9142,4,2,111,121,7141,7146,110,103,59,1,8780,59,1,1073,113,117,111,59,1,8222,4,5,99,109,112,114,116,7167,7181,7188,7193,7199,97,117,115,4,2,59,101,7176,7178,1,8757,59,1,8757,112,116,121,118,59,1,10672,115,105,59,1,1014,110,111,117,59,1,8492,4,3,97,104,119,7207,7210,7213,59,1,946,59,1,8502,101,101,110,59,1,8812,114,59,3,55349,56607,103,4,7,99,111,115,116,117,118,119,7241,7262,7288,7305,7328,7335,7340,4,3,97,105,117,7249,7253,7258,112,59,1,8898,114,99,59,1,9711,112,59,1,8899,4,3,100,112,116,7270,7275,7281,111,116,59,1,10752,108,117,115,59,1,10753,105,109,101,115,59,1,10754,4,2,113,116,7294,7300,99,117,112,59,1,10758,97,114,59,1,9733,114,105,97,110,103,108,101,4,2,100,117,7318,7324,111,119,110,59,1,9661,112,59,1,9651,112,108,117,115,59,1,10756,101,101,59,1,8897,101,100,103,101,59,1,8896,97,114,111,119,59,1,10509,4,3,97,107,111,7362,7436,7458,4,2,99,110,7368,7432,107,4,3,108,115,116,7377,7386,7394,111,122,101,110,103,101,59,1,10731,113,117,97,114,101,59,1,9642,114,105,97,110,103,108,101,4,4,59,100,108,114,7411,7413,7419,7425,1,9652,111,119,110,59,1,9662,101,102,116,59,1,9666,105,103,104,116,59,1,9656,107,59,1,9251,4,2,49,51,7442,7454,4,2,50,52,7448,7451,59,1,9618,59,1,9617,52,59,1,9619,99,107,59,1,9608,4,2,101,111,7469,7485,4,2,59,113,7475,7478,3,61,8421,117,105,118,59,3,8801,8421,116,59,1,8976,4,4,112,116,119,120,7499,7504,7517,7523,102,59,3,55349,56659,4,2,59,116,7510,7512,1,8869,111,109,59,1,8869,116,105,101,59,1,8904,4,12,68,72,85,86,98,100,104,109,112,116,117,118,7549,7571,7597,7619,7655,7660,7682,7708,7715,7721,7728,7750,4,4,76,82,108,114,7559,7562,7565,7568,59,1,9559,59,1,9556,59,1,9558,59,1,9555,4,5,59,68,85,100,117,7583,7585,7588,7591,7594,1,9552,59,1,9574,59,1,9577,59,1,9572,59,1,9575,4,4,76,82,108,114,7607,7610,7613,7616,59,1,9565,59,1,9562,59,1,9564,59,1,9561,4,7,59,72,76,82,104,108,114,7635,7637,7640,7643,7646,7649,7652,1,9553,59,1,9580,59,1,9571,59,1,9568,59,1,9579,59,1,9570,59,1,9567,111,120,59,1,10697,4,4,76,82,108,114,7670,7673,7676,7679,59,1,9557,59,1,9554,59,1,9488,59,1,9484,4,5,59,68,85,100,117,7694,7696,7699,7702,7705,1,9472,59,1,9573,59,1,9576,59,1,9516,59,1,9524,105,110,117,115,59,1,8863,108,117,115,59,1,8862,105,109,101,115,59,1,8864,4,4,76,82,108,114,7738,7741,7744,7747,59,1,9563,59,1,9560,59,1,9496,59,1,9492,4,7,59,72,76,82,104,108,114,7766,7768,7771,7774,7777,7780,7783,1,9474,59,1,9578,59,1,9569,59,1,9566,59,1,9532,59,1,9508,59,1,9500,114,105,109,101,59,1,8245,4,2,101,118,7799,7804,118,101,59,1,728,98,97,114,5,166,1,59,7812,1,166,4,4,99,101,105,111,7824,7829,7834,7846,114,59,3,55349,56503,109,105,59,1,8271,109,4,2,59,101,7841,7843,1,8765,59,1,8909,108,4,3,59,98,104,7855,7857,7860,1,92,59,1,10693,115,117,98,59,1,10184,4,2,108,109,7872,7885,108,4,2,59,101,7879,7881,1,8226,116,59,1,8226,112,4,3,59,69,101,7894,7896,7899,1,8782,59,1,10926,4,2,59,113,7905,7907,1,8783,59,1,8783,4,15,97,99,100,101,102,104,105,108,111,114,115,116,117,119,121,7942,8021,8075,8080,8121,8126,8157,8279,8295,8430,8446,8485,8491,8707,8726,4,3,99,112,114,7950,7956,8007,117,116,101,59,1,263,4,6,59,97,98,99,100,115,7970,7972,7977,7984,7998,8003,1,8745,110,100,59,1,10820,114,99,117,112,59,1,10825,4,2,97,117,7990,7994,112,59,1,10827,112,59,1,10823,111,116,59,1,10816,59,3,8745,65024,4,2,101,111,8013,8017,116,59,1,8257,110,59,1,711,4,4,97,101,105,117,8031,8046,8056,8061,4,2,112,114,8037,8041,115,59,1,10829,111,110,59,1,269,100,105,108,5,231,1,59,8054,1,231,114,99,59,1,265,112,115,4,2,59,115,8069,8071,1,10828,109,59,1,10832,111,116,59,1,267,4,3,100,109,110,8088,8097,8104,105,108,5,184,1,59,8095,1,184,112,116,121,118,59,1,10674,116,5,162,2,59,101,8112,8114,1,162,114,100,111,116,59,1,183,114,59,3,55349,56608,4,3,99,101,105,8134,8138,8154,121,59,1,1095,99,107,4,2,59,109,8146,8148,1,10003,97,114,107,59,1,10003,59,1,967,114,4,7,59,69,99,101,102,109,115,8174,8176,8179,8258,8261,8268,8273,1,9675,59,1,10691,4,3,59,101,108,8187,8189,8193,1,710,113,59,1,8791,101,4,2,97,100,8200,8223,114,114,111,119,4,2,108,114,8210,8216,101,102,116,59,1,8634,105,103,104,116,59,1,8635,4,5,82,83,97,99,100,8235,8238,8241,8246,8252,59,1,174,59,1,9416,115,116,59,1,8859,105,114,99,59,1,8858,97,115,104,59,1,8861,59,1,8791,110,105,110,116,59,1,10768,105,100,59,1,10991,99,105,114,59,1,10690,117,98,115,4,2,59,117,8288,8290,1,9827,105,116,59,1,9827,4,4,108,109,110,112,8305,8326,8376,8400,111,110,4,2,59,101,8313,8315,1,58,4,2,59,113,8321,8323,1,8788,59,1,8788,4,2,109,112,8332,8344,97,4,2,59,116,8339,8341,1,44,59,1,64,4,3,59,102,108,8352,8354,8358,1,8705,110,59,1,8728,101,4,2,109,120,8365,8371,101,110,116,59,1,8705,101,115,59,1,8450,4,2,103,105,8382,8395,4,2,59,100,8388,8390,1,8773,111,116,59,1,10861,110,116,59,1,8750,4,3,102,114,121,8408,8412,8417,59,3,55349,56660,111,100,59,1,8720,5,169,2,59,115,8424,8426,1,169,114,59,1,8471,4,2,97,111,8436,8441,114,114,59,1,8629,115,115,59,1,10007,4,2,99,117,8452,8457,114,59,3,55349,56504,4,2,98,112,8463,8474,4,2,59,101,8469,8471,1,10959,59,1,10961,4,2,59,101,8480,8482,1,10960,59,1,10962,100,111,116,59,1,8943,4,7,100,101,108,112,114,118,119,8507,8522,8536,8550,8600,8697,8702,97,114,114,4,2,108,114,8516,8519,59,1,10552,59,1,10549,4,2,112,115,8528,8532,114,59,1,8926,99,59,1,8927,97,114,114,4,2,59,112,8545,8547,1,8630,59,1,10557,4,6,59,98,99,100,111,115,8564,8566,8573,8587,8592,8596,1,8746,114,99,97,112,59,1,10824,4,2,97,117,8579,8583,112,59,1,10822,112,59,1,10826,111,116,59,1,8845,114,59,1,10821,59,3,8746,65024,4,4,97,108,114,118,8610,8623,8663,8672,114,114,4,2,59,109,8618,8620,1,8631,59,1,10556,121,4,3,101,118,119,8632,8651,8656,113,4,2,112,115,8639,8645,114,101,99,59,1,8926,117,99,99,59,1,8927,101,101,59,1,8910,101,100,103,101,59,1,8911,101,110,5,164,1,59,8670,1,164,101,97,114,114,111,119,4,2,108,114,8684,8690,101,102,116,59,1,8630,105,103,104,116,59,1,8631,101,101,59,1,8910,101,100,59,1,8911,4,2,99,105,8713,8721,111,110,105,110,116,59,1,8754,110,116,59,1,8753,108,99,116,121,59,1,9005,4,19,65,72,97,98,99,100,101,102,104,105,106,108,111,114,115,116,117,119,122,8773,8778,8783,8821,8839,8854,8887,8914,8930,8944,9036,9041,9058,9197,9227,9258,9281,9297,9305,114,114,59,1,8659,97,114,59,1,10597,4,4,103,108,114,115,8793,8799,8805,8809,103,101,114,59,1,8224,101,116,104,59,1,8504,114,59,1,8595,104,4,2,59,118,8816,8818,1,8208,59,1,8867,4,2,107,108,8827,8834,97,114,111,119,59,1,10511,97,99,59,1,733,4,2,97,121,8845,8851,114,111,110,59,1,271,59,1,1076,4,3,59,97,111,8862,8864,8880,1,8518,4,2,103,114,8870,8876,103,101,114,59,1,8225,114,59,1,8650,116,115,101,113,59,1,10871,4,3,103,108,109,8895,8902,8907,5,176,1,59,8900,1,176,116,97,59,1,948,112,116,121,118,59,1,10673,4,2,105,114,8920,8926,115,104,116,59,1,10623,59,3,55349,56609,97,114,4,2,108,114,8938,8941,59,1,8643,59,1,8642,4,5,97,101,103,115,118,8956,8986,8989,8996,9001,109,4,3,59,111,115,8965,8967,8983,1,8900,110,100,4,2,59,115,8975,8977,1,8900,117,105,116,59,1,9830,59,1,9830,59,1,168,97,109,109,97,59,1,989,105,110,59,1,8946,4,3,59,105,111,9009,9011,9031,1,247,100,101,5,247,2,59,111,9020,9022,1,247,110,116,105,109,101,115,59,1,8903,110,120,59,1,8903,99,121,59,1,1106,99,4,2,111,114,9048,9053,114,110,59,1,8990,111,112,59,1,8973,4,5,108,112,116,117,119,9070,9076,9081,9130,9144,108,97,114,59,1,36,102,59,3,55349,56661,4,5,59,101,109,112,115,9093,9095,9109,9116,9122,1,729,113,4,2,59,100,9102,9104,1,8784,111,116,59,1,8785,105,110,117,115,59,1,8760,108,117,115,59,1,8724,113,117,97,114,101,59,1,8865,98,108,101,98,97,114,119,101,100,103,101,59,1,8966,110,4,3,97,100,104,9153,9160,9172,114,114,111,119,59,1,8595,111,119,110,97,114,114,111,119,115,59,1,8650,97,114,112,111,111,110,4,2,108,114,9184,9190,101,102,116,59,1,8643,105,103,104,116,59,1,8642,4,2,98,99,9203,9211,107,97,114,111,119,59,1,10512,4,2,111,114,9217,9222,114,110,59,1,8991,111,112,59,1,8972,4,3,99,111,116,9235,9248,9252,4,2,114,121,9241,9245,59,3,55349,56505,59,1,1109,108,59,1,10742,114,111,107,59,1,273,4,2,100,114,9264,9269,111,116,59,1,8945,105,4,2,59,102,9276,9278,1,9663,59,1,9662,4,2,97,104,9287,9292,114,114,59,1,8693,97,114,59,1,10607,97,110,103,108,101,59,1,10662,4,2,99,105,9311,9315,121,59,1,1119,103,114,97,114,114,59,1,10239,4,18,68,97,99,100,101,102,103,108,109,110,111,112,113,114,115,116,117,120,9361,9376,9398,9439,9444,9447,9462,9495,9531,9585,9598,9614,9659,9755,9771,9792,9808,9826,4,2,68,111,9367,9372,111,116,59,1,10871,116,59,1,8785,4,2,99,115,9382,9392,117,116,101,5,233,1,59,9390,1,233,116,101,114,59,1,10862,4,4,97,105,111,121,9408,9414,9430,9436,114,111,110,59,1,283,114,4,2,59,99,9421,9423,1,8790,5,234,1,59,9428,1,234,108,111,110,59,1,8789,59,1,1101,111,116,59,1,279,59,1,8519,4,2,68,114,9453,9458,111,116,59,1,8786,59,3,55349,56610,4,3,59,114,115,9470,9472,9482,1,10906,97,118,101,5,232,1,59,9480,1,232,4,2,59,100,9488,9490,1,10902,111,116,59,1,10904,4,4,59,105,108,115,9505,9507,9515,9518,1,10905,110,116,101,114,115,59,1,9191,59,1,8467,4,2,59,100,9524,9526,1,10901,111,116,59,1,10903,4,3,97,112,115,9539,9544,9564,99,114,59,1,275,116,121,4,3,59,115,118,9554,9556,9561,1,8709,101,116,59,1,8709,59,1,8709,112,4,2,49,59,9571,9583,4,2,51,52,9577,9580,59,1,8196,59,1,8197,1,8195,4,2,103,115,9591,9594,59,1,331,112,59,1,8194,4,2,103,112,9604,9609,111,110,59,1,281,102,59,3,55349,56662,4,3,97,108,115,9622,9635,9640,114,4,2,59,115,9629,9631,1,8917,108,59,1,10723,117,115,59,1,10865,105,4,3,59,108,118,9649,9651,9656,1,949,111,110,59,1,949,59,1,1013,4,4,99,115,117,118,9669,9686,9716,9747,4,2,105,111,9675,9680,114,99,59,1,8790,108,111,110,59,1,8789,4,2,105,108,9692,9696,109,59,1,8770,97,110,116,4,2,103,108,9705,9710,116,114,59,1,10902,101,115,115,59,1,10901,4,3,97,101,105,9724,9729,9734,108,115,59,1,61,115,116,59,1,8799,118,4,2,59,68,9741,9743,1,8801,68,59,1,10872,112,97,114,115,108,59,1,10725,4,2,68,97,9761,9766,111,116,59,1,8787,114,114,59,1,10609,4,3,99,100,105,9779,9783,9788,114,59,1,8495,111,116,59,1,8784,109,59,1,8770,4,2,97,104,9798,9801,59,1,951,5,240,1,59,9806,1,240,4,2,109,114,9814,9822,108,5,235,1,59,9820,1,235,111,59,1,8364,4,3,99,105,112,9834,9838,9843,108,59,1,33,115,116,59,1,8707,4,2,101,111,9849,9859,99,116,97,116,105,111,110,59,1,8496,110,101,110,116,105,97,108,101,59,1,8519,4,12,97,99,101,102,105,106,108,110,111,112,114,115,9896,9910,9914,9921,9954,9960,9967,9989,9994,10027,10036,10164,108,108,105,110,103,100,111,116,115,101,113,59,1,8786,121,59,1,1092,109,97,108,101,59,1,9792,4,3,105,108,114,9929,9935,9950,108,105,103,59,1,64259,4,2,105,108,9941,9945,103,59,1,64256,105,103,59,1,64260,59,3,55349,56611,108,105,103,59,1,64257,108,105,103,59,3,102,106,4,3,97,108,116,9975,9979,9984,116,59,1,9837,105,103,59,1,64258,110,115,59,1,9649,111,102,59,1,402,4,2,112,114,10000,10005,102,59,3,55349,56663,4,2,97,107,10011,10016,108,108,59,1,8704,4,2,59,118,10022,10024,1,8916,59,1,10969,97,114,116,105,110,116,59,1,10765,4,2,97,111,10042,10159,4,2,99,115,10048,10155,4,6,49,50,51,52,53,55,10062,10102,10114,10135,10139,10151,4,6,50,51,52,53,54,56,10076,10083,10086,10093,10096,10099,5,189,1,59,10081,1,189,59,1,8531,5,188,1,59,10091,1,188,59,1,8533,59,1,8537,59,1,8539,4,2,51,53,10108,10111,59,1,8532,59,1,8534,4,3,52,53,56,10122,10129,10132,5,190,1,59,10127,1,190,59,1,8535,59,1,8540,53,59,1,8536,4,2,54,56,10145,10148,59,1,8538,59,1,8541,56,59,1,8542,108,59,1,8260,119,110,59,1,8994,99,114,59,3,55349,56507,4,17,69,97,98,99,100,101,102,103,105,106,108,110,111,114,115,116,118,10206,10217,10247,10254,10268,10273,10358,10363,10374,10380,10385,10406,10458,10464,10470,10497,10610,4,2,59,108,10212,10214,1,8807,59,1,10892,4,3,99,109,112,10225,10231,10244,117,116,101,59,1,501,109,97,4,2,59,100,10239,10241,1,947,59,1,989,59,1,10886,114,101,118,101,59,1,287,4,2,105,121,10260,10265,114,99,59,1,285,59,1,1075,111,116,59,1,289,4,4,59,108,113,115,10283,10285,10288,10308,1,8805,59,1,8923,4,3,59,113,115,10296,10298,10301,1,8805,59,1,8807,108,97,110,116,59,1,10878,4,4,59,99,100,108,10318,10320,10324,10345,1,10878,99,59,1,10921,111,116,4,2,59,111,10332,10334,1,10880,4,2,59,108,10340,10342,1,10882,59,1,10884,4,2,59,101,10351,10354,3,8923,65024,115,59,1,10900,114,59,3,55349,56612,4,2,59,103,10369,10371,1,8811,59,1,8921,109,101,108,59,1,8503,99,121,59,1,1107,4,4,59,69,97,106,10395,10397,10400,10403,1,8823,59,1,10898,59,1,10917,59,1,10916,4,4,69,97,101,115,10416,10419,10434,10453,59,1,8809,112,4,2,59,112,10426,10428,1,10890,114,111,120,59,1,10890,4,2,59,113,10440,10442,1,10888,4,2,59,113,10448,10450,1,10888,59,1,8809,105,109,59,1,8935,112,102,59,3,55349,56664,97,118,101,59,1,96,4,2,99,105,10476,10480,114,59,1,8458,109,4,3,59,101,108,10489,10491,10494,1,8819,59,1,10894,59,1,10896,5,62,6,59,99,100,108,113,114,10512,10514,10527,10532,10538,10545,1,62,4,2,99,105,10520,10523,59,1,10919,114,59,1,10874,111,116,59,1,8919,80,97,114,59,1,10645,117,101,115,116,59,1,10876,4,5,97,100,101,108,115,10557,10574,10579,10599,10605,4,2,112,114,10563,10570,112,114,111,120,59,1,10886,114,59,1,10616,111,116,59,1,8919,113,4,2,108,113,10586,10592,101,115,115,59,1,8923,108,101,115,115,59,1,10892,101,115,115,59,1,8823,105,109,59,1,8819,4,2,101,110,10616,10626,114,116,110,101,113,113,59,3,8809,65024,69,59,3,8809,65024,4,10,65,97,98,99,101,102,107,111,115,121,10653,10658,10713,10718,10724,10760,10765,10786,10850,10875,114,114,59,1,8660,4,4,105,108,109,114,10668,10674,10678,10684,114,115,112,59,1,8202,102,59,1,189,105,108,116,59,1,8459,4,2,100,114,10690,10695,99,121,59,1,1098,4,3,59,99,119,10703,10705,10710,1,8596,105,114,59,1,10568,59,1,8621,97,114,59,1,8463,105,114,99,59,1,293,4,3,97,108,114,10732,10748,10754,114,116,115,4,2,59,117,10741,10743,1,9829,105,116,59,1,9829,108,105,112,59,1,8230,99,111,110,59,1,8889,114,59,3,55349,56613,115,4,2,101,119,10772,10779,97,114,111,119,59,1,10533,97,114,111,119,59,1,10534,4,5,97,109,111,112,114,10798,10803,10809,10839,10844,114,114,59,1,8703,116,104,116,59,1,8763,107,4,2,108,114,10816,10827,101,102,116,97,114,114,111,119,59,1,8617,105,103,104,116,97,114,114,111,119,59,1,8618,102,59,3,55349,56665,98,97,114,59,1,8213,4,3,99,108,116,10858,10863,10869,114,59,3,55349,56509,97,115,104,59,1,8463,114,111,107,59,1,295,4,2,98,112,10881,10887,117,108,108,59,1,8259,104,101,110,59,1,8208,4,15,97,99,101,102,103,105,106,109,110,111,112,113,115,116,117,10925,10936,10958,10977,10990,11001,11039,11045,11101,11192,11220,11226,11237,11285,11299,99,117,116,101,5,237,1,59,10934,1,237,4,3,59,105,121,10944,10946,10955,1,8291,114,99,5,238,1,59,10953,1,238,59,1,1080,4,2,99,120,10964,10968,121,59,1,1077,99,108,5,161,1,59,10975,1,161,4,2,102,114,10983,10986,59,1,8660,59,3,55349,56614,114,97,118,101,5,236,1,59,10999,1,236,4,4,59,105,110,111,11011,11013,11028,11034,1,8520,4,2,105,110,11019,11024,110,116,59,1,10764,116,59,1,8749,102,105,110,59,1,10716,116,97,59,1,8489,108,105,103,59,1,307,4,3,97,111,112,11053,11092,11096,4,3,99,103,116,11061,11065,11088,114,59,1,299,4,3,101,108,112,11073,11076,11082,59,1,8465,105,110,101,59,1,8464,97,114,116,59,1,8465,104,59,1,305,102,59,1,8887,101,100,59,1,437,4,5,59,99,102,111,116,11113,11115,11121,11136,11142,1,8712,97,114,101,59,1,8453,105,110,4,2,59,116,11129,11131,1,8734,105,101,59,1,10717,100,111,116,59,1,305,4,5,59,99,101,108,112,11154,11156,11161,11179,11186,1,8747,97,108,59,1,8890,4,2,103,114,11167,11173,101,114,115,59,1,8484,99,97,108,59,1,8890,97,114,104,107,59,1,10775,114,111,100,59,1,10812,4,4,99,103,112,116,11202,11206,11211,11216,121,59,1,1105,111,110,59,1,303,102,59,3,55349,56666,97,59,1,953,114,111,100,59,1,10812,117,101,115,116,5,191,1,59,11235,1,191,4,2,99,105,11243,11248,114,59,3,55349,56510,110,4,5,59,69,100,115,118,11261,11263,11266,11271,11282,1,8712,59,1,8953,111,116,59,1,8949,4,2,59,118,11277,11279,1,8948,59,1,8947,59,1,8712,4,2,59,105,11291,11293,1,8290,108,100,101,59,1,297,4,2,107,109,11305,11310,99,121,59,1,1110,108,5,239,1,59,11316,1,239,4,6,99,102,109,111,115,117,11332,11346,11351,11357,11363,11380,4,2,105,121,11338,11343,114,99,59,1,309,59,1,1081,114,59,3,55349,56615,97,116,104,59,1,567,112,102,59,3,55349,56667,4,2,99,101,11369,11374,114,59,3,55349,56511,114,99,121,59,1,1112,107,99,121,59,1,1108,4,8,97,99,102,103,104,106,111,115,11404,11418,11433,11438,11445,11450,11455,11461,112,112,97,4,2,59,118,11413,11415,1,954,59,1,1008,4,2,101,121,11424,11430,100,105,108,59,1,311,59,1,1082,114,59,3,55349,56616,114,101,101,110,59,1,312,99,121,59,1,1093,99,121,59,1,1116,112,102,59,3,55349,56668,99,114,59,3,55349,56512,4,23,65,66,69,72,97,98,99,100,101,102,103,104,106,108,109,110,111,112,114,115,116,117,118,11515,11538,11544,11555,11560,11721,11780,11818,11868,12136,12160,12171,12203,12208,12246,12275,12327,12509,12523,12569,12641,12732,12752,4,3,97,114,116,11523,11528,11532,114,114,59,1,8666,114,59,1,8656,97,105,108,59,1,10523,97,114,114,59,1,10510,4,2,59,103,11550,11552,1,8806,59,1,10891,97,114,59,1,10594,4,9,99,101,103,109,110,112,113,114,116,11580,11586,11594,11600,11606,11624,11627,11636,11694,117,116,101,59,1,314,109,112,116,121,118,59,1,10676,114,97,110,59,1,8466,98,100,97,59,1,955,103,4,3,59,100,108,11615,11617,11620,1,10216,59,1,10641,101,59,1,10216,59,1,10885,117,111,5,171,1,59,11634,1,171,114,4,8,59,98,102,104,108,112,115,116,11655,11657,11669,11673,11677,11681,11685,11690,1,8592,4,2,59,102,11663,11665,1,8676,115,59,1,10527,115,59,1,10525,107,59,1,8617,112,59,1,8619,108,59,1,10553,105,109,59,1,10611,108,59,1,8610,4,3,59,97,101,11702,11704,11709,1,10923,105,108,59,1,10521,4,2,59,115,11715,11717,1,10925,59,3,10925,65024,4,3,97,98,114,11729,11734,11739,114,114,59,1,10508,114,107,59,1,10098,4,2,97,107,11745,11758,99,4,2,101,107,11752,11755,59,1,123,59,1,91,4,2,101,115,11764,11767,59,1,10635,108,4,2,100,117,11774,11777,59,1,10639,59,1,10637,4,4,97,101,117,121,11790,11796,11811,11815,114,111,110,59,1,318,4,2,100,105,11802,11807,105,108,59,1,316,108,59,1,8968,98,59,1,123,59,1,1083,4,4,99,113,114,115,11828,11832,11845,11864,97,59,1,10550,117,111,4,2,59,114,11840,11842,1,8220,59,1,8222,4,2,100,117,11851,11857,104,97,114,59,1,10599,115,104,97,114,59,1,10571,104,59,1,8626,4,5,59,102,103,113,115,11880,11882,12008,12011,12031,1,8804,116,4,5,97,104,108,114,116,11895,11913,11935,11947,11996,114,114,111,119,4,2,59,116,11905,11907,1,8592,97,105,108,59,1,8610,97,114,112,111,111,110,4,2,100,117,11925,11931,111,119,110,59,1,8637,112,59,1,8636,101,102,116,97,114,114,111,119,115,59,1,8647,105,103,104,116,4,3,97,104,115,11959,11974,11984,114,114,111,119,4,2,59,115,11969,11971,1,8596,59,1,8646,97,114,112,111,111,110,115,59,1,8651,113,117,105,103,97,114,114,111,119,59,1,8621,104,114,101,101,116,105,109,101,115,59,1,8907,59,1,8922,4,3,59,113,115,12019,12021,12024,1,8804,59,1,8806,108,97,110,116,59,1,10877,4,5,59,99,100,103,115,12043,12045,12049,12070,12083,1,10877,99,59,1,10920,111,116,4,2,59,111,12057,12059,1,10879,4,2,59,114,12065,12067,1,10881,59,1,10883,4,2,59,101,12076,12079,3,8922,65024,115,59,1,10899,4,5,97,100,101,103,115,12095,12103,12108,12126,12131,112,112,114,111,120,59,1,10885,111,116,59,1,8918,113,4,2,103,113,12115,12120,116,114,59,1,8922,103,116,114,59,1,10891,116,114,59,1,8822,105,109,59,1,8818,4,3,105,108,114,12144,12150,12156,115,104,116,59,1,10620,111,111,114,59,1,8970,59,3,55349,56617,4,2,59,69,12166,12168,1,8822,59,1,10897,4,2,97,98,12177,12198,114,4,2,100,117,12184,12187,59,1,8637,4,2,59,108,12193,12195,1,8636,59,1,10602,108,107,59,1,9604,99,121,59,1,1113,4,5,59,97,99,104,116,12220,12222,12227,12235,12241,1,8810,114,114,59,1,8647,111,114,110,101,114,59,1,8990,97,114,100,59,1,10603,114,105,59,1,9722,4,2,105,111,12252,12258,100,111,116,59,1,320,117,115,116,4,2,59,97,12267,12269,1,9136,99,104,101,59,1,9136,4,4,69,97,101,115,12285,12288,12303,12322,59,1,8808,112,4,2,59,112,12295,12297,1,10889,114,111,120,59,1,10889,4,2,59,113,12309,12311,1,10887,4,2,59,113,12317,12319,1,10887,59,1,8808,105,109,59,1,8934,4,8,97,98,110,111,112,116,119,122,12345,12359,12364,12421,12446,12467,12474,12490,4,2,110,114,12351,12355,103,59,1,10220,114,59,1,8701,114,107,59,1,10214,103,4,3,108,109,114,12373,12401,12409,101,102,116,4,2,97,114,12382,12389,114,114,111,119,59,1,10229,105,103,104,116,97,114,114,111,119,59,1,10231,97,112,115,116,111,59,1,10236,105,103,104,116,97,114,114,111,119,59,1,10230,112,97,114,114,111,119,4,2,108,114,12433,12439,101,102,116,59,1,8619,105,103,104,116,59,1,8620,4,3,97,102,108,12454,12458,12462,114,59,1,10629,59,3,55349,56669,117,115,59,1,10797,105,109,101,115,59,1,10804,4,2,97,98,12480,12485,115,116,59,1,8727,97,114,59,1,95,4,3,59,101,102,12498,12500,12506,1,9674,110,103,101,59,1,9674,59,1,10731,97,114,4,2,59,108,12517,12519,1,40,116,59,1,10643,4,5,97,99,104,109,116,12535,12540,12548,12561,12564,114,114,59,1,8646,111,114,110,101,114,59,1,8991,97,114,4,2,59,100,12556,12558,1,8651,59,1,10605,59,1,8206,114,105,59,1,8895,4,6,97,99,104,105,113,116,12583,12589,12594,12597,12614,12635,113,117,111,59,1,8249,114,59,3,55349,56513,59,1,8624,109,4,3,59,101,103,12606,12608,12611,1,8818,59,1,10893,59,1,10895,4,2,98,117,12620,12623,59,1,91,111,4,2,59,114,12630,12632,1,8216,59,1,8218,114,111,107,59,1,322,5,60,8,59,99,100,104,105,108,113,114,12660,12662,12675,12680,12686,12692,12698,12705,1,60,4,2,99,105,12668,12671,59,1,10918,114,59,1,10873,111,116,59,1,8918,114,101,101,59,1,8907,109,101,115,59,1,8905,97,114,114,59,1,10614,117,101,115,116,59,1,10875,4,2,80,105,12711,12716,97,114,59,1,10646,4,3,59,101,102,12724,12726,12729,1,9667,59,1,8884,59,1,9666,114,4,2,100,117,12739,12746,115,104,97,114,59,1,10570,104,97,114,59,1,10598,4,2,101,110,12758,12768,114,116,110,101,113,113,59,3,8808,65024,69,59,3,8808,65024,4,14,68,97,99,100,101,102,104,105,108,110,111,112,115,117,12803,12809,12893,12908,12914,12928,12933,12937,13011,13025,13032,13049,13052,13069,68,111,116,59,1,8762,4,4,99,108,112,114,12819,12827,12849,12887,114,5,175,1,59,12825,1,175,4,2,101,116,12833,12836,59,1,9794,4,2,59,101,12842,12844,1,10016,115,101,59,1,10016,4,2,59,115,12855,12857,1,8614,116,111,4,4,59,100,108,117,12869,12871,12877,12883,1,8614,111,119,110,59,1,8615,101,102,116,59,1,8612,112,59,1,8613,107,101,114,59,1,9646,4,2,111,121,12899,12905,109,109,97,59,1,10793,59,1,1084,97,115,104,59,1,8212,97,115,117,114,101,100,97,110,103,108,101,59,1,8737,114,59,3,55349,56618,111,59,1,8487,4,3,99,100,110,12945,12954,12985,114,111,5,181,1,59,12952,1,181,4,4,59,97,99,100,12964,12966,12971,12976,1,8739,115,116,59,1,42,105,114,59,1,10992,111,116,5,183,1,59,12983,1,183,117,115,4,3,59,98,100,12995,12997,13000,1,8722,59,1,8863,4,2,59,117,13006,13008,1,8760,59,1,10794,4,2,99,100,13017,13021,112,59,1,10971,114,59,1,8230,112,108,117,115,59,1,8723,4,2,100,112,13038,13044,101,108,115,59,1,8871,102,59,3,55349,56670,59,1,8723,4,2,99,116,13058,13063,114,59,3,55349,56514,112,111,115,59,1,8766,4,3,59,108,109,13077,13079,13087,1,956,116,105,109,97,112,59,1,8888,97,112,59,1,8888,4,24,71,76,82,86,97,98,99,100,101,102,103,104,105,106,108,109,111,112,114,115,116,117,118,119,13142,13165,13217,13229,13247,13330,13359,13414,13420,13508,13513,13579,13602,13626,13631,13762,13767,13855,13936,13995,14214,14285,14312,14432,4,2,103,116,13148,13152,59,3,8921,824,4,2,59,118,13158,13161,3,8811,8402,59,3,8811,824,4,3,101,108,116,13173,13200,13204,102,116,4,2,97,114,13181,13188,114,114,111,119,59,1,8653,105,103,104,116,97,114,114,111,119,59,1,8654,59,3,8920,824,4,2,59,118,13210,13213,3,8810,8402,59,3,8810,824,105,103,104,116,97,114,114,111,119,59,1,8655,4,2,68,100,13235,13241,97,115,104,59,1,8879,97,115,104,59,1,8878,4,5,98,99,110,112,116,13259,13264,13270,13275,13308,108,97,59,1,8711,117,116,101,59,1,324,103,59,3,8736,8402,4,5,59,69,105,111,112,13287,13289,13293,13298,13302,1,8777,59,3,10864,824,100,59,3,8779,824,115,59,1,329,114,111,120,59,1,8777,117,114,4,2,59,97,13316,13318,1,9838,108,4,2,59,115,13325,13327,1,9838,59,1,8469,4,2,115,117,13336,13344,112,5,160,1,59,13342,1,160,109,112,4,2,59,101,13352,13355,3,8782,824,59,3,8783,824,4,5,97,101,111,117,121,13371,13385,13391,13407,13411,4,2,112,114,13377,13380,59,1,10819,111,110,59,1,328,100,105,108,59,1,326,110,103,4,2,59,100,13399,13401,1,8775,111,116,59,3,10861,824,112,59,1,10818,59,1,1085,97,115,104,59,1,8211,4,7,59,65,97,100,113,115,120,13436,13438,13443,13466,13472,13478,13494,1,8800,114,114,59,1,8663,114,4,2,104,114,13450,13454,107,59,1,10532,4,2,59,111,13460,13462,1,8599,119,59,1,8599,111,116,59,3,8784,824,117,105,118,59,1,8802,4,2,101,105,13484,13489,97,114,59,1,10536,109,59,3,8770,824,105,115,116,4,2,59,115,13503,13505,1,8708,59,1,8708,114,59,3,55349,56619,4,4,69,101,115,116,13523,13527,13563,13568,59,3,8807,824,4,3,59,113,115,13535,13537,13559,1,8817,4,3,59,113,115,13545,13547,13551,1,8817,59,3,8807,824,108,97,110,116,59,3,10878,824,59,3,10878,824,105,109,59,1,8821,4,2,59,114,13574,13576,1,8815,59,1,8815,4,3,65,97,112,13587,13592,13597,114,114,59,1,8654,114,114,59,1,8622,97,114,59,1,10994,4,3,59,115,118,13610,13612,13623,1,8715,4,2,59,100,13618,13620,1,8956,59,1,8954,59,1,8715,99,121,59,1,1114,4,7,65,69,97,100,101,115,116,13647,13652,13656,13661,13665,13737,13742,114,114,59,1,8653,59,3,8806,824,114,114,59,1,8602,114,59,1,8229,4,4,59,102,113,115,13675,13677,13703,13725,1,8816,116,4,2,97,114,13684,13691,114,114,111,119,59,1,8602,105,103,104,116,97,114,114,111,119,59,1,8622,4,3,59,113,115,13711,13713,13717,1,8816,59,3,8806,824,108,97,110,116,59,3,10877,824,4,2,59,115,13731,13734,3,10877,824,59,1,8814,105,109,59,1,8820,4,2,59,114,13748,13750,1,8814,105,4,2,59,101,13757,13759,1,8938,59,1,8940,105,100,59,1,8740,4,2,112,116,13773,13778,102,59,3,55349,56671,5,172,3,59,105,110,13787,13789,13829,1,172,110,4,4,59,69,100,118,13800,13802,13806,13812,1,8713,59,3,8953,824,111,116,59,3,8949,824,4,3,97,98,99,13820,13823,13826,59,1,8713,59,1,8951,59,1,8950,105,4,2,59,118,13836,13838,1,8716,4,3,97,98,99,13846,13849,13852,59,1,8716,59,1,8958,59,1,8957,4,3,97,111,114,13863,13892,13899,114,4,4,59,97,115,116,13874,13876,13883,13888,1,8742,108,108,101,108,59,1,8742,108,59,3,11005,8421,59,3,8706,824,108,105,110,116,59,1,10772,4,3,59,99,101,13907,13909,13914,1,8832,117,101,59,1,8928,4,2,59,99,13920,13923,3,10927,824,4,2,59,101,13929,13931,1,8832,113,59,3,10927,824,4,4,65,97,105,116,13946,13951,13971,13982,114,114,59,1,8655,114,114,4,3,59,99,119,13961,13963,13967,1,8603,59,3,10547,824,59,3,8605,824,103,104,116,97,114,114,111,119,59,1,8603,114,105,4,2,59,101,13990,13992,1,8939,59,1,8941,4,7,99,104,105,109,112,113,117,14011,14036,14060,14080,14085,14090,14106,4,4,59,99,101,114,14021,14023,14028,14032,1,8833,117,101,59,1,8929,59,3,10928,824,59,3,55349,56515,111,114,116,4,2,109,112,14045,14050,105,100,59,1,8740,97,114,97,108,108,101,108,59,1,8742,109,4,2,59,101,14067,14069,1,8769,4,2,59,113,14075,14077,1,8772,59,1,8772,105,100,59,1,8740,97,114,59,1,8742,115,117,4,2,98,112,14098,14102,101,59,1,8930,101,59,1,8931,4,3,98,99,112,14114,14157,14171,4,4,59,69,101,115,14124,14126,14130,14133,1,8836,59,3,10949,824,59,1,8840,101,116,4,2,59,101,14141,14144,3,8834,8402,113,4,2,59,113,14151,14153,1,8840,59,3,10949,824,99,4,2,59,101,14164,14166,1,8833,113,59,3,10928,824,4,4,59,69,101,115,14181,14183,14187,14190,1,8837,59,3,10950,824,59,1,8841,101,116,4,2,59,101,14198,14201,3,8835,8402,113,4,2,59,113,14208,14210,1,8841,59,3,10950,824,4,4,103,105,108,114,14224,14228,14238,14242,108,59,1,8825,108,100,101,5,241,1,59,14236,1,241,103,59,1,8824,105,97,110,103,108,101,4,2,108,114,14254,14269,101,102,116,4,2,59,101,14263,14265,1,8938,113,59,1,8940,105,103,104,116,4,2,59,101,14279,14281,1,8939,113,59,1,8941,4,2,59,109,14291,14293,1,957,4,3,59,101,115,14301,14303,14308,1,35,114,111,59,1,8470,112,59,1,8199,4,9,68,72,97,100,103,105,108,114,115,14332,14338,14344,14349,14355,14369,14376,14408,14426,97,115,104,59,1,8877,97,114,114,59,1,10500,112,59,3,8781,8402,97,115,104,59,1,8876,4,2,101,116,14361,14365,59,3,8805,8402,59,3,62,8402,110,102,105,110,59,1,10718,4,3,65,101,116,14384,14389,14393,114,114,59,1,10498,59,3,8804,8402,4,2,59,114,14399,14402,3,60,8402,105,101,59,3,8884,8402,4,2,65,116,14414,14419,114,114,59,1,10499,114,105,101,59,3,8885,8402,105,109,59,3,8764,8402,4,3,65,97,110,14440,14445,14468,114,114,59,1,8662,114,4,2,104,114,14452,14456,107,59,1,10531,4,2,59,111,14462,14464,1,8598,119,59,1,8598,101,97,114,59,1,10535,4,18,83,97,99,100,101,102,103,104,105,108,109,111,112,114,115,116,117,118,14512,14515,14535,14560,14597,14603,14618,14643,14657,14662,14701,14741,14747,14769,14851,14877,14907,14916,59,1,9416,4,2,99,115,14521,14531,117,116,101,5,243,1,59,14529,1,243,116,59,1,8859,4,2,105,121,14541,14557,114,4,2,59,99,14548,14550,1,8858,5,244,1,59,14555,1,244,59,1,1086,4,5,97,98,105,111,115,14572,14577,14583,14587,14591,115,104,59,1,8861,108,97,99,59,1,337,118,59,1,10808,116,59,1,8857,111,108,100,59,1,10684,108,105,103,59,1,339,4,2,99,114,14609,14614,105,114,59,1,10687,59,3,55349,56620,4,3,111,114,116,14626,14630,14640,110,59,1,731,97,118,101,5,242,1,59,14638,1,242,59,1,10689,4,2,98,109,14649,14654,97,114,59,1,10677,59,1,937,110,116,59,1,8750,4,4,97,99,105,116,14672,14677,14693,14698,114,114,59,1,8634,4,2,105,114,14683,14687,114,59,1,10686,111,115,115,59,1,10683,110,101,59,1,8254,59,1,10688,4,3,97,101,105,14709,14714,14719,99,114,59,1,333,103,97,59,1,969,4,3,99,100,110,14727,14733,14736,114,111,110,59,1,959,59,1,10678,117,115,59,1,8854,112,102,59,3,55349,56672,4,3,97,101,108,14755,14759,14764,114,59,1,10679,114,112,59,1,10681,117,115,59,1,8853,4,7,59,97,100,105,111,115,118,14785,14787,14792,14831,14837,14841,14848,1,8744,114,114,59,1,8635,4,4,59,101,102,109,14802,14804,14817,14824,1,10845,114,4,2,59,111,14811,14813,1,8500,102,59,1,8500,5,170,1,59,14822,1,170,5,186,1,59,14829,1,186,103,111,102,59,1,8886,114,59,1,10838,108,111,112,101,59,1,10839,59,1,10843,4,3,99,108,111,14859,14863,14873,114,59,1,8500,97,115,104,5,248,1,59,14871,1,248,108,59,1,8856,105,4,2,108,109,14884,14893,100,101,5,245,1,59,14891,1,245,101,115,4,2,59,97,14901,14903,1,8855,115,59,1,10806,109,108,5,246,1,59,14914,1,246,98,97,114,59,1,9021,4,12,97,99,101,102,104,105,108,109,111,114,115,117,14948,14992,14996,15033,15038,15068,15090,15189,15192,15222,15427,15441,114,4,4,59,97,115,116,14959,14961,14976,14989,1,8741,5,182,2,59,108,14968,14970,1,182,108,101,108,59,1,8741,4,2,105,108,14982,14986,109,59,1,10995,59,1,11005,59,1,8706,121,59,1,1087,114,4,5,99,105,109,112,116,15009,15014,15019,15024,15027,110,116,59,1,37,111,100,59,1,46,105,108,59,1,8240,59,1,8869,101,110,107,59,1,8241,114,59,3,55349,56621,4,3,105,109,111,15046,15057,15063,4,2,59,118,15052,15054,1,966,59,1,981,109,97,116,59,1,8499,110,101,59,1,9742,4,3,59,116,118,15076,15078,15087,1,960,99,104,102,111,114,107,59,1,8916,59,1,982,4,2,97,117,15096,15119,110,4,2,99,107,15103,15115,107,4,2,59,104,15110,15112,1,8463,59,1,8462,118,59,1,8463,115,4,9,59,97,98,99,100,101,109,115,116,15140,15142,15148,15151,15156,15168,15171,15179,15184,1,43,99,105,114,59,1,10787,59,1,8862,105,114,59,1,10786,4,2,111,117,15162,15165,59,1,8724,59,1,10789,59,1,10866,110,5,177,1,59,15177,1,177,105,109,59,1,10790,119,111,59,1,10791,59,1,177,4,3,105,112,117,15200,15208,15213,110,116,105,110,116,59,1,10773,102,59,3,55349,56673,110,100,5,163,1,59,15220,1,163,4,10,59,69,97,99,101,105,110,111,115,117,15244,15246,15249,15253,15258,15334,15347,15367,15416,15421,1,8826,59,1,10931,112,59,1,10935,117,101,59,1,8828,4,2,59,99,15264,15266,1,10927,4,6,59,97,99,101,110,115,15280,15282,15290,15299,15303,15329,1,8826,112,112,114,111,120,59,1,10935,117,114,108,121,101,113,59,1,8828,113,59,1,10927,4,3,97,101,115,15311,15319,15324,112,112,114,111,120,59,1,10937,113,113,59,1,10933,105,109,59,1,8936,105,109,59,1,8830,109,101,4,2,59,115,15342,15344,1,8242,59,1,8473,4,3,69,97,115,15355,15358,15362,59,1,10933,112,59,1,10937,105,109,59,1,8936,4,3,100,102,112,15375,15378,15404,59,1,8719,4,3,97,108,115,15386,15392,15398,108,97,114,59,1,9006,105,110,101,59,1,8978,117,114,102,59,1,8979,4,2,59,116,15410,15412,1,8733,111,59,1,8733,105,109,59,1,8830,114,101,108,59,1,8880,4,2,99,105,15433,15438,114,59,3,55349,56517,59,1,968,110,99,115,112,59,1,8200,4,6,102,105,111,112,115,117,15462,15467,15472,15478,15485,15491,114,59,3,55349,56622,110,116,59,1,10764,112,102,59,3,55349,56674,114,105,109,101,59,1,8279,99,114,59,3,55349,56518,4,3,97,101,111,15499,15520,15534,116,4,2,101,105,15506,15515,114,110,105,111,110,115,59,1,8461,110,116,59,1,10774,115,116,4,2,59,101,15528,15530,1,63,113,59,1,8799,116,5,34,1,59,15540,1,34,4,21,65,66,72,97,98,99,100,101,102,104,105,108,109,110,111,112,114,115,116,117,120,15586,15609,15615,15620,15796,15855,15893,15931,15977,16001,16039,16183,16204,16222,16228,16285,16312,16318,16363,16408,16416,4,3,97,114,116,15594,15599,15603,114,114,59,1,8667,114,59,1,8658,97,105,108,59,1,10524,97,114,114,59,1,10511,97,114,59,1,10596,4,7,99,100,101,110,113,114,116,15636,15651,15656,15664,15687,15696,15770,4,2,101,117,15642,15646,59,3,8765,817,116,101,59,1,341,105,99,59,1,8730,109,112,116,121,118,59,1,10675,103,4,4,59,100,101,108,15675,15677,15680,15683,1,10217,59,1,10642,59,1,10661,101,59,1,10217,117,111,5,187,1,59,15694,1,187,114,4,11,59,97,98,99,102,104,108,112,115,116,119,15721,15723,15727,15739,15742,15746,15750,15754,15758,15763,15767,1,8594,112,59,1,10613,4,2,59,102,15733,15735,1,8677,115,59,1,10528,59,1,10547,115,59,1,10526,107,59,1,8618,112,59,1,8620,108,59,1,10565,105,109,59,1,10612,108,59,1,8611,59,1,8605,4,2,97,105,15776,15781,105,108,59,1,10522,111,4,2,59,110,15788,15790,1,8758,97,108,115,59,1,8474,4,3,97,98,114,15804,15809,15814,114,114,59,1,10509,114,107,59,1,10099,4,2,97,107,15820,15833,99,4,2,101,107,15827,15830,59,1,125,59,1,93,4,2,101,115,15839,15842,59,1,10636,108,4,2,100,117,15849,15852,59,1,10638,59,1,10640,4,4,97,101,117,121,15865,15871,15886,15890,114,111,110,59,1,345,4,2,100,105,15877,15882,105,108,59,1,343,108,59,1,8969,98,59,1,125,59,1,1088,4,4,99,108,113,115,15903,15907,15914,15927,97,59,1,10551,100,104,97,114,59,1,10601,117,111,4,2,59,114,15922,15924,1,8221,59,1,8221,104,59,1,8627,4,3,97,99,103,15939,15966,15970,108,4,4,59,105,112,115,15950,15952,15957,15963,1,8476,110,101,59,1,8475,97,114,116,59,1,8476,59,1,8477,116,59,1,9645,5,174,1,59,15975,1,174,4,3,105,108,114,15985,15991,15997,115,104,116,59,1,10621,111,111,114,59,1,8971,59,3,55349,56623,4,2,97,111,16007,16028,114,4,2,100,117,16014,16017,59,1,8641,4,2,59,108,16023,16025,1,8640,59,1,10604,4,2,59,118,16034,16036,1,961,59,1,1009,4,3,103,110,115,16047,16167,16171,104,116,4,6,97,104,108,114,115,116,16063,16081,16103,16130,16143,16155,114,114,111,119,4,2,59,116,16073,16075,1,8594,97,105,108,59,1,8611,97,114,112,111,111,110,4,2,100,117,16093,16099,111,119,110,59,1,8641,112,59,1,8640,101,102,116,4,2,97,104,16112,16120,114,114,111,119,115,59,1,8644,97,114,112,111,111,110,115,59,1,8652,105,103,104,116,97,114,114,111,119,115,59,1,8649,113,117,105,103,97,114,114,111,119,59,1,8605,104,114,101,101,116,105,109,101,115,59,1,8908,103,59,1,730,105,110,103,100,111,116,115,101,113,59,1,8787,4,3,97,104,109,16191,16196,16201,114,114,59,1,8644,97,114,59,1,8652,59,1,8207,111,117,115,116,4,2,59,97,16214,16216,1,9137,99,104,101,59,1,9137,109,105,100,59,1,10990,4,4,97,98,112,116,16238,16252,16257,16278,4,2,110,114,16244,16248,103,59,1,10221,114,59,1,8702,114,107,59,1,10215,4,3,97,102,108,16265,16269,16273,114,59,1,10630,59,3,55349,56675,117,115,59,1,10798,105,109,101,115,59,1,10805,4,2,97,112,16291,16304,114,4,2,59,103,16298,16300,1,41,116,59,1,10644,111,108,105,110,116,59,1,10770,97,114,114,59,1,8649,4,4,97,99,104,113,16328,16334,16339,16342,113,117,111,59,1,8250,114,59,3,55349,56519,59,1,8625,4,2,98,117,16348,16351,59,1,93,111,4,2,59,114,16358,16360,1,8217,59,1,8217,4,3,104,105,114,16371,16377,16383,114,101,101,59,1,8908,109,101,115,59,1,8906,105,4,4,59,101,102,108,16394,16396,16399,16402,1,9657,59,1,8885,59,1,9656,116,114,105,59,1,10702,108,117,104,97,114,59,1,10600,59,1,8478,4,19,97,98,99,100,101,102,104,105,108,109,111,112,113,114,115,116,117,119,122,16459,16466,16472,16572,16590,16672,16687,16746,16844,16850,16924,16963,16988,17115,17121,17154,17206,17614,17656,99,117,116,101,59,1,347,113,117,111,59,1,8218,4,10,59,69,97,99,101,105,110,112,115,121,16494,16496,16499,16513,16518,16531,16536,16556,16564,16569,1,8827,59,1,10932,4,2,112,114,16505,16508,59,1,10936,111,110,59,1,353,117,101,59,1,8829,4,2,59,100,16524,16526,1,10928,105,108,59,1,351,114,99,59,1,349,4,3,69,97,115,16544,16547,16551,59,1,10934,112,59,1,10938,105,109,59,1,8937,111,108,105,110,116,59,1,10771,105,109,59,1,8831,59,1,1089,111,116,4,3,59,98,101,16582,16584,16587,1,8901,59,1,8865,59,1,10854,4,7,65,97,99,109,115,116,120,16606,16611,16634,16642,16646,16652,16668,114,114,59,1,8664,114,4,2,104,114,16618,16622,107,59,1,10533,4,2,59,111,16628,16630,1,8600,119,59,1,8600,116,5,167,1,59,16640,1,167,105,59,1,59,119,97,114,59,1,10537,109,4,2,105,110,16659,16665,110,117,115,59,1,8726,59,1,8726,116,59,1,10038,114,4,2,59,111,16679,16682,3,55349,56624,119,110,59,1,8994,4,4,97,99,111,121,16697,16702,16716,16739,114,112,59,1,9839,4,2,104,121,16708,16713,99,121,59,1,1097,59,1,1096,114,116,4,2,109,112,16724,16729,105,100,59,1,8739,97,114,97,108,108,101,108,59,1,8741,5,173,1,59,16744,1,173,4,2,103,109,16752,16770,109,97,4,3,59,102,118,16762,16764,16767,1,963,59,1,962,59,1,962,4,8,59,100,101,103,108,110,112,114,16788,16790,16795,16806,16817,16828,16832,16838,1,8764,111,116,59,1,10858,4,2,59,113,16801,16803,1,8771,59,1,8771,4,2,59,69,16812,16814,1,10910,59,1,10912,4,2,59,69,16823,16825,1,10909,59,1,10911,101,59,1,8774,108,117,115,59,1,10788,97,114,114,59,1,10610,97,114,114,59,1,8592,4,4,97,101,105,116,16860,16883,16891,16904,4,2,108,115,16866,16878,108,115,101,116,109,105,110,117,115,59,1,8726,104,112,59,1,10803,112,97,114,115,108,59,1,10724,4,2,100,108,16897,16900,59,1,8739,101,59,1,8995,4,2,59,101,16910,16912,1,10922,4,2,59,115,16918,16920,1,10924,59,3,10924,65024,4,3,102,108,112,16932,16938,16958,116,99,121,59,1,1100,4,2,59,98,16944,16946,1,47,4,2,59,97,16952,16954,1,10692,114,59,1,9023,102,59,3,55349,56676,97,4,2,100,114,16970,16985,101,115,4,2,59,117,16978,16980,1,9824,105,116,59,1,9824,59,1,8741,4,3,99,115,117,16996,17028,17089,4,2,97,117,17002,17015,112,4,2,59,115,17009,17011,1,8851,59,3,8851,65024,112,4,2,59,115,17022,17024,1,8852,59,3,8852,65024,117,4,2,98,112,17035,17062,4,3,59,101,115,17043,17045,17048,1,8847,59,1,8849,101,116,4,2,59,101,17056,17058,1,8847,113,59,1,8849,4,3,59,101,115,17070,17072,17075,1,8848,59,1,8850,101,116,4,2,59,101,17083,17085,1,8848,113,59,1,8850,4,3,59,97,102,17097,17099,17112,1,9633,114,4,2,101,102,17106,17109,59,1,9633,59,1,9642,59,1,9642,97,114,114,59,1,8594,4,4,99,101,109,116,17131,17136,17142,17148,114,59,3,55349,56520,116,109,110,59,1,8726,105,108,101,59,1,8995,97,114,102,59,1,8902,4,2,97,114,17160,17172,114,4,2,59,102,17167,17169,1,9734,59,1,9733,4,2,97,110,17178,17202,105,103,104,116,4,2,101,112,17188,17197,112,115,105,108,111,110,59,1,1013,104,105,59,1,981,115,59,1,175,4,5,98,99,109,110,112,17218,17351,17420,17423,17427,4,9,59,69,100,101,109,110,112,114,115,17238,17240,17243,17248,17261,17267,17279,17285,17291,1,8834,59,1,10949,111,116,59,1,10941,4,2,59,100,17254,17256,1,8838,111,116,59,1,10947,117,108,116,59,1,10945,4,2,69,101,17273,17276,59,1,10955,59,1,8842,108,117,115,59,1,10943,97,114,114,59,1,10617,4,3,101,105,117,17299,17335,17339,116,4,3,59,101,110,17308,17310,17322,1,8834,113,4,2,59,113,17317,17319,1,8838,59,1,10949,101,113,4,2,59,113,17330,17332,1,8842,59,1,10955,109,59,1,10951,4,2,98,112,17345,17348,59,1,10965,59,1,10963,99,4,6,59,97,99,101,110,115,17366,17368,17376,17385,17389,17415,1,8827,112,112,114,111,120,59,1,10936,117,114,108,121,101,113,59,1,8829,113,59,1,10928,4,3,97,101,115,17397,17405,17410,112,112,114,111,120,59,1,10938,113,113,59,1,10934,105,109,59,1,8937,105,109,59,1,8831,59,1,8721,103,59,1,9834,4,13,49,50,51,59,69,100,101,104,108,109,110,112,115,17455,17462,17469,17476,17478,17481,17496,17509,17524,17530,17536,17548,17554,5,185,1,59,17460,1,185,5,178,1,59,17467,1,178,5,179,1,59,17474,1,179,1,8835,59,1,10950,4,2,111,115,17487,17491,116,59,1,10942,117,98,59,1,10968,4,2,59,100,17502,17504,1,8839,111,116,59,1,10948,115,4,2,111,117,17516,17520,108,59,1,10185,98,59,1,10967,97,114,114,59,1,10619,117,108,116,59,1,10946,4,2,69,101,17542,17545,59,1,10956,59,1,8843,108,117,115,59,1,10944,4,3,101,105,117,17562,17598,17602,116,4,3,59,101,110,17571,17573,17585,1,8835,113,4,2,59,113,17580,17582,1,8839,59,1,10950,101,113,4,2,59,113,17593,17595,1,8843,59,1,10956,109,59,1,10952,4,2,98,112,17608,17611,59,1,10964,59,1,10966,4,3,65,97,110,17622,17627,17650,114,114,59,1,8665,114,4,2,104,114,17634,17638,107,59,1,10534,4,2,59,111,17644,17646,1,8601,119,59,1,8601,119,97,114,59,1,10538,108,105,103,5,223,1,59,17664,1,223,4,13,97,98,99,100,101,102,104,105,111,112,114,115,119,17694,17709,17714,17737,17742,17749,17754,17860,17905,17957,17964,18090,18122,4,2,114,117,17700,17706,103,101,116,59,1,8982,59,1,964,114,107,59,1,9140,4,3,97,101,121,17722,17728,17734,114,111,110,59,1,357,100,105,108,59,1,355,59,1,1090,111,116,59,1,8411,108,114,101,99,59,1,8981,114,59,3,55349,56625,4,4,101,105,107,111,17764,17805,17836,17851,4,2,114,116,17770,17786,101,4,2,52,102,17777,17780,59,1,8756,111,114,101,59,1,8756,97,4,3,59,115,118,17795,17797,17802,1,952,121,109,59,1,977,59,1,977,4,2,99,110,17811,17831,107,4,2,97,115,17818,17826,112,112,114,111,120,59,1,8776,105,109,59,1,8764,115,112,59,1,8201,4,2,97,115,17842,17846,112,59,1,8776,105,109,59,1,8764,114,110,5,254,1,59,17858,1,254,4,3,108,109,110,17868,17873,17901,100,101,59,1,732,101,115,5,215,3,59,98,100,17884,17886,17898,1,215,4,2,59,97,17892,17894,1,8864,114,59,1,10801,59,1,10800,116,59,1,8749,4,3,101,112,115,17913,17917,17953,97,59,1,10536,4,4,59,98,99,102,17927,17929,17934,17939,1,8868,111,116,59,1,9014,105,114,59,1,10993,4,2,59,111,17945,17948,3,55349,56677,114,107,59,1,10970,97,59,1,10537,114,105,109,101,59,1,8244,4,3,97,105,112,17972,17977,18082,100,101,59,1,8482,4,7,97,100,101,109,112,115,116,17993,18051,18056,18059,18066,18072,18076,110,103,108,101,4,5,59,100,108,113,114,18009,18011,18017,18032,18035,1,9653,111,119,110,59,1,9663,101,102,116,4,2,59,101,18026,18028,1,9667,113,59,1,8884,59,1,8796,105,103,104,116,4,2,59,101,18045,18047,1,9657,113,59,1,8885,111,116,59,1,9708,59,1,8796,105,110,117,115,59,1,10810,108,117,115,59,1,10809,98,59,1,10701,105,109,101,59,1,10811,101,122,105,117,109,59,1,9186,4,3,99,104,116,18098,18111,18116,4,2,114,121,18104,18108,59,3,55349,56521,59,1,1094,99,121,59,1,1115,114,111,107,59,1,359,4,2,105,111,18128,18133,120,116,59,1,8812,104,101,97,100,4,2,108,114,18143,18154,101,102,116,97,114,114,111,119,59,1,8606,105,103,104,116,97,114,114,111,119,59,1,8608,4,18,65,72,97,98,99,100,102,103,104,108,109,111,112,114,115,116,117,119,18204,18209,18214,18234,18250,18268,18292,18308,18319,18343,18379,18397,18413,18504,18547,18553,18584,18603,114,114,59,1,8657,97,114,59,1,10595,4,2,99,114,18220,18230,117,116,101,5,250,1,59,18228,1,250,114,59,1,8593,114,4,2,99,101,18241,18245,121,59,1,1118,118,101,59,1,365,4,2,105,121,18256,18265,114,99,5,251,1,59,18263,1,251,59,1,1091,4,3,97,98,104,18276,18281,18287,114,114,59,1,8645,108,97,99,59,1,369,97,114,59,1,10606,4,2,105,114,18298,18304,115,104,116,59,1,10622,59,3,55349,56626,114,97,118,101,5,249,1,59,18317,1,249,4,2,97,98,18325,18338,114,4,2,108,114,18332,18335,59,1,8639,59,1,8638,108,107,59,1,9600,4,2,99,116,18349,18374,4,2,111,114,18355,18369,114,110,4,2,59,101,18363,18365,1,8988,114,59,1,8988,111,112,59,1,8975,114,105,59,1,9720,4,2,97,108,18385,18390,99,114,59,1,363,5,168,1,59,18395,1,168,4,2,103,112,18403,18408,111,110,59,1,371,102,59,3,55349,56678,4,6,97,100,104,108,115,117,18427,18434,18445,18470,18475,18494,114,114,111,119,59,1,8593,111,119,110,97,114,114,111,119,59,1,8597,97,114,112,111,111,110,4,2,108,114,18457,18463,101,102,116,59,1,8639,105,103,104,116,59,1,8638,117,115,59,1,8846,105,4,3,59,104,108,18484,18486,18489,1,965,59,1,978,111,110,59,1,965,112,97,114,114,111,119,115,59,1,8648,4,3,99,105,116,18512,18537,18542,4,2,111,114,18518,18532,114,110,4,2,59,101,18526,18528,1,8989,114,59,1,8989,111,112,59,1,8974,110,103,59,1,367,114,105,59,1,9721,99,114,59,3,55349,56522,4,3,100,105,114,18561,18566,18572,111,116,59,1,8944,108,100,101,59,1,361,105,4,2,59,102,18579,18581,1,9653,59,1,9652,4,2,97,109,18590,18595,114,114,59,1,8648,108,5,252,1,59,18601,1,252,97,110,103,108,101,59,1,10663,4,15,65,66,68,97,99,100,101,102,108,110,111,112,114,115,122,18643,18648,18661,18667,18847,18851,18857,18904,18909,18915,18931,18937,18943,18949,18996,114,114,59,1,8661,97,114,4,2,59,118,18656,18658,1,10984,59,1,10985,97,115,104,59,1,8872,4,2,110,114,18673,18679,103,114,116,59,1,10652,4,7,101,107,110,112,114,115,116,18695,18704,18711,18720,18742,18754,18810,112,115,105,108,111,110,59,1,1013,97,112,112,97,59,1,1008,111,116,104,105,110,103,59,1,8709,4,3,104,105,114,18728,18732,18735,105,59,1,981,59,1,982,111,112,116,111,59,1,8733,4,2,59,104,18748,18750,1,8597,111,59,1,1009,4,2,105,117,18760,18766,103,109,97,59,1,962,4,2,98,112,18772,18791,115,101,116,110,101,113,4,2,59,113,18784,18787,3,8842,65024,59,3,10955,65024,115,101,116,110,101,113,4,2,59,113,18803,18806,3,8843,65024,59,3,10956,65024,4,2,104,114,18816,18822,101,116,97,59,1,977,105,97,110,103,108,101,4,2,108,114,18834,18840,101,102,116,59,1,8882,105,103,104,116,59,1,8883,121,59,1,1074,97,115,104,59,1,8866,4,3,101,108,114,18865,18884,18890,4,3,59,98,101,18873,18875,18880,1,8744,97,114,59,1,8891,113,59,1,8794,108,105,112,59,1,8942,4,2,98,116,18896,18901,97,114,59,1,124,59,1,124,114,59,3,55349,56627,116,114,105,59,1,8882,115,117,4,2,98,112,18923,18927,59,3,8834,8402,59,3,8835,8402,112,102,59,3,55349,56679,114,111,112,59,1,8733,116,114,105,59,1,8883,4,2,99,117,18955,18960,114,59,3,55349,56523,4,2,98,112,18966,18981,110,4,2,69,101,18973,18977,59,3,10955,65024,59,3,8842,65024,110,4,2,69,101,18988,18992,59,3,10956,65024,59,3,8843,65024,105,103,122,97,103,59,1,10650,4,7,99,101,102,111,112,114,115,19020,19026,19061,19066,19072,19075,19089,105,114,99,59,1,373,4,2,100,105,19032,19055,4,2,98,103,19038,19043,97,114,59,1,10847,101,4,2,59,113,19050,19052,1,8743,59,1,8793,101,114,112,59,1,8472,114,59,3,55349,56628,112,102,59,3,55349,56680,59,1,8472,4,2,59,101,19081,19083,1,8768,97,116,104,59,1,8768,99,114,59,3,55349,56524,4,14,99,100,102,104,105,108,109,110,111,114,115,117,118,119,19125,19146,19152,19157,19173,19176,19192,19197,19202,19236,19252,19269,19286,19291,4,3,97,105,117,19133,19137,19142,112,59,1,8898,114,99,59,1,9711,112,59,1,8899,116,114,105,59,1,9661,114,59,3,55349,56629,4,2,65,97,19163,19168,114,114,59,1,10234,114,114,59,1,10231,59,1,958,4,2,65,97,19182,19187,114,114,59,1,10232,114,114,59,1,10229,97,112,59,1,10236,105,115,59,1,8955,4,3,100,112,116,19210,19215,19230,111,116,59,1,10752,4,2,102,108,19221,19225,59,3,55349,56681,117,115,59,1,10753,105,109,101,59,1,10754,4,2,65,97,19242,19247,114,114,59,1,10233,114,114,59,1,10230,4,2,99,113,19258,19263,114,59,3,55349,56525,99,117,112,59,1,10758,4,2,112,116,19275,19281,108,117,115,59,1,10756,114,105,59,1,9651,101,101,59,1,8897,101,100,103,101,59,1,8896,4,8,97,99,101,102,105,111,115,117,19316,19335,19349,19357,19362,19367,19373,19379,99,4,2,117,121,19323,19332,116,101,5,253,1,59,19330,1,253,59,1,1103,4,2,105,121,19341,19346,114,99,59,1,375,59,1,1099,110,5,165,1,59,19355,1,165,114,59,3,55349,56630,99,121,59,1,1111,112,102,59,3,55349,56682,99,114,59,3,55349,56526,4,2,99,109,19385,19389,121,59,1,1102,108,5,255,1,59,19395,1,255,4,10,97,99,100,101,102,104,105,111,115,119,19419,19426,19441,19446,19462,19467,19472,19480,19486,19492,99,117,116,101,59,1,378,4,2,97,121,19432,19438,114,111,110,59,1,382,59,1,1079,111,116,59,1,380,4,2,101,116,19452,19458,116,114,102,59,1,8488,97,59,1,950,114,59,3,55349,56631,99,121,59,1,1078,103,114,97,114,114,59,1,8669,112,102,59,3,55349,56683,99,114,59,3,55349,56527,4,2,106,110,19498,19501,59,1,8205,106,59,1,8204]); - -/***/ }), -/* 119 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -var UNICODE = __webpack_require__(18); - -//Aliases -var $ = UNICODE.CODE_POINTS; - -//Utils - -//OPTIMIZATION: these utility functions should not be moved out of this module. V8 Crankshaft will not inline -//this functions if they will be situated in another module due to context switch. -//Always perform inlining check before modifying this functions ('node --trace-inlining'). -function isSurrogatePair(cp1, cp2) { - return cp1 >= 0xD800 && cp1 <= 0xDBFF && cp2 >= 0xDC00 && cp2 <= 0xDFFF; -} - -function getSurrogatePairCodePoint(cp1, cp2) { - return (cp1 - 0xD800) * 0x400 + 0x2400 + cp2; -} - - -//Const -var DEFAULT_BUFFER_WATERLINE = 1 << 16; - - -//Preprocessor -//NOTE: HTML input preprocessing -//(see: http://www.whatwg.org/specs/web-apps/current-work/multipage/parsing.html#preprocessing-the-input-stream) -var Preprocessor = module.exports = function () { - this.html = null; - - this.pos = -1; - this.lastGapPos = -1; - this.lastCharPos = -1; - this.droppedBufferSize = 0; - - this.gapStack = []; - - this.skipNextNewLine = false; - - this.lastChunkWritten = false; - this.endOfChunkHit = false; - this.bufferWaterline = DEFAULT_BUFFER_WATERLINE; -}; - -Object.defineProperty(Preprocessor.prototype, 'sourcePos', { - get: function () { - return this.droppedBufferSize + this.pos; - } -}); - -Preprocessor.prototype.dropParsedChunk = function () { - if (this.pos > this.bufferWaterline) { - this.lastCharPos -= this.pos; - this.droppedBufferSize += this.pos; - this.html = this.html.substring(this.pos); - this.pos = 0; - this.lastGapPos = -1; - this.gapStack = []; - } -}; - -Preprocessor.prototype._addGap = function () { - this.gapStack.push(this.lastGapPos); - this.lastGapPos = this.pos; -}; - -Preprocessor.prototype._processHighRangeCodePoint = function (cp) { - //NOTE: try to peek a surrogate pair - if (this.pos !== this.lastCharPos) { - var nextCp = this.html.charCodeAt(this.pos + 1); - - if (isSurrogatePair(cp, nextCp)) { - //NOTE: we have a surrogate pair. Peek pair character and recalculate code point. - this.pos++; - cp = getSurrogatePairCodePoint(cp, nextCp); - - //NOTE: add gap that should be avoided during retreat - this._addGap(); - } - } - - // NOTE: we've hit the end of chunk, stop processing at this point - else if (!this.lastChunkWritten) { - this.endOfChunkHit = true; - return $.EOF; - } - - return cp; -}; - -Preprocessor.prototype.write = function (chunk, isLastChunk) { - if (this.html) - this.html += chunk; - - else - this.html = chunk; - - this.lastCharPos = this.html.length - 1; - this.endOfChunkHit = false; - this.lastChunkWritten = isLastChunk; -}; - -Preprocessor.prototype.insertHtmlAtCurrentPos = function (chunk) { - this.html = this.html.substring(0, this.pos + 1) + - chunk + - this.html.substring(this.pos + 1, this.html.length); - - this.lastCharPos = this.html.length - 1; - this.endOfChunkHit = false; -}; - - -Preprocessor.prototype.advance = function () { - this.pos++; - - if (this.pos > this.lastCharPos) { - if (!this.lastChunkWritten) - this.endOfChunkHit = true; - - return $.EOF; - } - - var cp = this.html.charCodeAt(this.pos); - - //NOTE: any U+000A LINE FEED (LF) characters that immediately follow a U+000D CARRIAGE RETURN (CR) character - //must be ignored. - if (this.skipNextNewLine && cp === $.LINE_FEED) { - this.skipNextNewLine = false; - this._addGap(); - return this.advance(); - } - - //NOTE: all U+000D CARRIAGE RETURN (CR) characters must be converted to U+000A LINE FEED (LF) characters - if (cp === $.CARRIAGE_RETURN) { - this.skipNextNewLine = true; - return $.LINE_FEED; - } - - this.skipNextNewLine = false; - - //OPTIMIZATION: first perform check if the code point in the allowed range that covers most common - //HTML input (e.g. ASCII codes) to avoid performance-cost operations for high-range code points. - return cp >= 0xD800 ? this._processHighRangeCodePoint(cp) : cp; -}; - -Preprocessor.prototype.retreat = function () { - if (this.pos === this.lastGapPos) { - this.lastGapPos = this.gapStack.pop(); - this.pos--; - } - - this.pos--; -}; - - - -/***/ }), -/* 120 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -var doctype = __webpack_require__(33), - DOCUMENT_MODE = __webpack_require__(11).DOCUMENT_MODE; - - -//Conversion tables for DOM Level1 structure emulation -var nodeTypes = { - element: 1, - text: 3, - cdata: 4, - comment: 8 -}; - -var nodePropertyShorthands = { - tagName: 'name', - childNodes: 'children', - parentNode: 'parent', - previousSibling: 'prev', - nextSibling: 'next', - nodeValue: 'data' -}; - -//Node -var Node = function (props) { - for (var key in props) { - if (props.hasOwnProperty(key)) - this[key] = props[key]; - } -}; - -Node.prototype = { - get firstChild() { - var children = this.children; - - return children && children[0] || null; - }, - - get lastChild() { - var children = this.children; - - return children && children[children.length - 1] || null; - }, - - get nodeType() { - return nodeTypes[this.type] || nodeTypes.element; - } -}; - -Object.keys(nodePropertyShorthands).forEach(function (key) { - var shorthand = nodePropertyShorthands[key]; - - Object.defineProperty(Node.prototype, key, { - get: function () { - return this[shorthand] || null; - }, - set: function (val) { - this[shorthand] = val; - return val; - } - }); -}); - - -//Node construction -exports.createDocument = function () { - return new Node({ - type: 'root', - name: 'root', - parent: null, - prev: null, - next: null, - children: [], - 'x-mode': DOCUMENT_MODE.NO_QUIRKS - }); -}; - -exports.createDocumentFragment = function () { - return new Node({ - type: 'root', - name: 'root', - parent: null, - prev: null, - next: null, - children: [] - }); -}; - -exports.createElement = function (tagName, namespaceURI, attrs) { - var attribs = Object.create(null), - attribsNamespace = Object.create(null), - attribsPrefix = Object.create(null); - - for (var i = 0; i < attrs.length; i++) { - var attrName = attrs[i].name; - - attribs[attrName] = attrs[i].value; - attribsNamespace[attrName] = attrs[i].namespace; - attribsPrefix[attrName] = attrs[i].prefix; - } - - return new Node({ - type: tagName === 'script' || tagName === 'style' ? tagName : 'tag', - name: tagName, - namespace: namespaceURI, - attribs: attribs, - 'x-attribsNamespace': attribsNamespace, - 'x-attribsPrefix': attribsPrefix, - children: [], - parent: null, - prev: null, - next: null - }); -}; - -exports.createCommentNode = function (data) { - return new Node({ - type: 'comment', - data: data, - parent: null, - prev: null, - next: null - }); -}; - -var createTextNode = function (value) { - return new Node({ - type: 'text', - data: value, - parent: null, - prev: null, - next: null - }); -}; - - -//Tree mutation -var appendChild = exports.appendChild = function (parentNode, newNode) { - var prev = parentNode.children[parentNode.children.length - 1]; - - if (prev) { - prev.next = newNode; - newNode.prev = prev; - } - - parentNode.children.push(newNode); - newNode.parent = parentNode; -}; - -var insertBefore = exports.insertBefore = function (parentNode, newNode, referenceNode) { - var insertionIdx = parentNode.children.indexOf(referenceNode), - prev = referenceNode.prev; - - if (prev) { - prev.next = newNode; - newNode.prev = prev; - } - - referenceNode.prev = newNode; - newNode.next = referenceNode; - - parentNode.children.splice(insertionIdx, 0, newNode); - newNode.parent = parentNode; -}; - -exports.setTemplateContent = function (templateElement, contentElement) { - appendChild(templateElement, contentElement); -}; - -exports.getTemplateContent = function (templateElement) { - return templateElement.children[0]; -}; - -exports.setDocumentType = function (document, name, publicId, systemId) { - var data = doctype.serializeContent(name, publicId, systemId), - doctypeNode = null; - - for (var i = 0; i < document.children.length; i++) { - if (document.children[i].type === 'directive' && document.children[i].name === '!doctype') { - doctypeNode = document.children[i]; - break; - } - } - - if (doctypeNode) { - doctypeNode.data = data; - doctypeNode['x-name'] = name; - doctypeNode['x-publicId'] = publicId; - doctypeNode['x-systemId'] = systemId; - } - - else { - appendChild(document, new Node({ - type: 'directive', - name: '!doctype', - data: data, - 'x-name': name, - 'x-publicId': publicId, - 'x-systemId': systemId - })); - } - -}; - -exports.setDocumentMode = function (document, mode) { - document['x-mode'] = mode; -}; - -exports.getDocumentMode = function (document) { - return document['x-mode']; -}; - -exports.detachNode = function (node) { - if (node.parent) { - var idx = node.parent.children.indexOf(node), - prev = node.prev, - next = node.next; - - node.prev = null; - node.next = null; - - if (prev) - prev.next = next; - - if (next) - next.prev = prev; - - node.parent.children.splice(idx, 1); - node.parent = null; - } -}; - -exports.insertText = function (parentNode, text) { - var lastChild = parentNode.children[parentNode.children.length - 1]; - - if (lastChild && lastChild.type === 'text') - lastChild.data += text; - else - appendChild(parentNode, createTextNode(text)); -}; - -exports.insertTextBefore = function (parentNode, text, referenceNode) { - var prevNode = parentNode.children[parentNode.children.indexOf(referenceNode) - 1]; - - if (prevNode && prevNode.type === 'text') - prevNode.data += text; - else - insertBefore(parentNode, createTextNode(text), referenceNode); -}; - -exports.adoptAttributes = function (recipient, attrs) { - for (var i = 0; i < attrs.length; i++) { - var attrName = attrs[i].name; - - if (typeof recipient.attribs[attrName] === 'undefined') { - recipient.attribs[attrName] = attrs[i].value; - recipient['x-attribsNamespace'][attrName] = attrs[i].namespace; - recipient['x-attribsPrefix'][attrName] = attrs[i].prefix; - } - } -}; - - -//Tree traversing -exports.getFirstChild = function (node) { - return node.children[0]; -}; - -exports.getChildNodes = function (node) { - return node.children; -}; - -exports.getParentNode = function (node) { - return node.parent; -}; - -exports.getAttrList = function (element) { - var attrList = []; - - for (var name in element.attribs) { - attrList.push({ - name: name, - value: element.attribs[name], - namespace: element['x-attribsNamespace'][name], - prefix: element['x-attribsPrefix'][name] - }); - } - - return attrList; -}; - - -//Node data -exports.getTagName = function (element) { - return element.name; -}; - -exports.getNamespaceURI = function (element) { - return element.namespace; -}; - -exports.getTextNodeContent = function (textNode) { - return textNode.data; -}; - -exports.getCommentNodeContent = function (commentNode) { - return commentNode.data; -}; - -exports.getDocumentTypeNodeName = function (doctypeNode) { - return doctypeNode['x-name']; -}; - -exports.getDocumentTypeNodePublicId = function (doctypeNode) { - return doctypeNode['x-publicId']; -}; - -exports.getDocumentTypeNodeSystemId = function (doctypeNode) { - return doctypeNode['x-systemId']; -}; - - -//Node types -exports.isTextNode = function (node) { - return node.type === 'text'; -}; - -exports.isCommentNode = function (node) { - return node.type === 'comment'; -}; - -exports.isDocumentTypeNode = function (node) { - return node.type === 'directive' && node.name === '!doctype'; -}; - -exports.isElementNode = function (node) { - return !!node.attribs; -}; - - -/***/ }), -/* 121 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -/* tslint:disable:no-unused-variable */ -// Subject imported before Observable to bypass circular dependency issue since -// Subject extends Observable and Observable references Subject in it's -// definition -var Subject_1 = __webpack_require__(6); -exports.Subject = Subject_1.Subject; -exports.AnonymousSubject = Subject_1.AnonymousSubject; -/* tslint:enable:no-unused-variable */ -var Observable_1 = __webpack_require__(0); -exports.Observable = Observable_1.Observable; -// statics -/* tslint:disable:no-use-before-declare */ -__webpack_require__(123); -__webpack_require__(124); -__webpack_require__(125); -__webpack_require__(126); -__webpack_require__(127); -__webpack_require__(130); -__webpack_require__(131); -__webpack_require__(132); -__webpack_require__(133); -__webpack_require__(134); -__webpack_require__(135); -__webpack_require__(136); -__webpack_require__(137); -__webpack_require__(54); -__webpack_require__(138); -__webpack_require__(143); -__webpack_require__(139); -__webpack_require__(140); -__webpack_require__(141); -__webpack_require__(142); -__webpack_require__(144); -__webpack_require__(145); -__webpack_require__(55); -__webpack_require__(56); -__webpack_require__(146); -//dom -__webpack_require__(128); -__webpack_require__(129); -//operators -__webpack_require__(149); -__webpack_require__(150); -__webpack_require__(151); -__webpack_require__(152); -__webpack_require__(153); -__webpack_require__(57); -__webpack_require__(154); -__webpack_require__(155); -__webpack_require__(156); -__webpack_require__(157); -__webpack_require__(158); -__webpack_require__(159); -__webpack_require__(160); -__webpack_require__(166); -__webpack_require__(161); -__webpack_require__(162); -__webpack_require__(163); -__webpack_require__(164); -__webpack_require__(165); -__webpack_require__(167); -__webpack_require__(168); -__webpack_require__(169); -__webpack_require__(170); -__webpack_require__(173); -__webpack_require__(174); -__webpack_require__(175); -__webpack_require__(171); -__webpack_require__(176); -__webpack_require__(177); -__webpack_require__(178); -__webpack_require__(179); -__webpack_require__(45); -__webpack_require__(180); -__webpack_require__(181); -__webpack_require__(182); -__webpack_require__(147); -__webpack_require__(148); -__webpack_require__(183); -__webpack_require__(184); -__webpack_require__(172); -__webpack_require__(58); -__webpack_require__(185); -__webpack_require__(186); -__webpack_require__(187); -__webpack_require__(188); -__webpack_require__(189); -__webpack_require__(190); -__webpack_require__(191); -__webpack_require__(192); -__webpack_require__(193); -__webpack_require__(194); -__webpack_require__(195); -__webpack_require__(196); -__webpack_require__(197); -__webpack_require__(198); -__webpack_require__(199); -__webpack_require__(200); -__webpack_require__(201); -__webpack_require__(203); -__webpack_require__(202); -__webpack_require__(204); -__webpack_require__(205); -__webpack_require__(206); -__webpack_require__(207); -__webpack_require__(208); -__webpack_require__(209); -__webpack_require__(210); -__webpack_require__(211); -__webpack_require__(212); -__webpack_require__(213); -__webpack_require__(214); -__webpack_require__(215); -__webpack_require__(216); -__webpack_require__(217); -__webpack_require__(218); -__webpack_require__(219); -__webpack_require__(220); -__webpack_require__(221); -__webpack_require__(222); -__webpack_require__(223); -__webpack_require__(224); -__webpack_require__(225); -__webpack_require__(226); -__webpack_require__(227); -__webpack_require__(228); -__webpack_require__(229); -__webpack_require__(230); -__webpack_require__(231); -__webpack_require__(232); -__webpack_require__(233); -__webpack_require__(234); -__webpack_require__(235); -__webpack_require__(236); -__webpack_require__(237); -__webpack_require__(238); -__webpack_require__(239); -__webpack_require__(240); -__webpack_require__(241); -__webpack_require__(242); -__webpack_require__(243); -__webpack_require__(244); -__webpack_require__(245); -/* tslint:disable:no-unused-variable */ -var Subscription_1 = __webpack_require__(9); -exports.Subscription = Subscription_1.Subscription; -var Subscriber_1 = __webpack_require__(2); -exports.Subscriber = Subscriber_1.Subscriber; -var AsyncSubject_1 = __webpack_require__(25); -exports.AsyncSubject = AsyncSubject_1.AsyncSubject; -var ReplaySubject_1 = __webpack_require__(26); -exports.ReplaySubject = ReplaySubject_1.ReplaySubject; -var BehaviorSubject_1 = __webpack_require__(41); -exports.BehaviorSubject = BehaviorSubject_1.BehaviorSubject; -var ConnectableObservable_1 = __webpack_require__(386); -exports.ConnectableObservable = ConnectableObservable_1.ConnectableObservable; -var Notification_1 = __webpack_require__(30); -exports.Notification = Notification_1.Notification; -var EmptyError_1 = __webpack_require__(79); -exports.EmptyError = EmptyError_1.EmptyError; -var ArgumentOutOfRangeError_1 = __webpack_require__(22); -exports.ArgumentOutOfRangeError = ArgumentOutOfRangeError_1.ArgumentOutOfRangeError; -var ObjectUnsubscribedError_1 = __webpack_require__(80); -exports.ObjectUnsubscribedError = ObjectUnsubscribedError_1.ObjectUnsubscribedError; -var TimeoutError_1 = __webpack_require__(74); -exports.TimeoutError = TimeoutError_1.TimeoutError; -var UnsubscriptionError_1 = __webpack_require__(399); -exports.UnsubscriptionError = UnsubscriptionError_1.UnsubscriptionError; -var timeInterval_1 = __webpack_require__(66); -exports.TimeInterval = timeInterval_1.TimeInterval; -var timestamp_1 = __webpack_require__(67); -exports.Timestamp = timestamp_1.Timestamp; -var TestScheduler_1 = __webpack_require__(366); -exports.TestScheduler = TestScheduler_1.TestScheduler; -var VirtualTimeScheduler_1 = __webpack_require__(69); -exports.VirtualTimeScheduler = VirtualTimeScheduler_1.VirtualTimeScheduler; -var AjaxObservable_1 = __webpack_require__(59); -exports.AjaxResponse = AjaxObservable_1.AjaxResponse; -exports.AjaxError = AjaxObservable_1.AjaxError; -exports.AjaxTimeoutError = AjaxObservable_1.AjaxTimeoutError; -var asap_1 = __webpack_require__(70); -var async_1 = __webpack_require__(8); -var queue_1 = __webpack_require__(71); -var animationFrame_1 = __webpack_require__(363); -var rxSubscriber_1 = __webpack_require__(379); -var iterator_1 = __webpack_require__(78); -var observable_1 = __webpack_require__(378); -/* tslint:enable:no-unused-variable */ -/** - * @typedef {Object} Rx.Scheduler - * @property {Scheduler} queue Schedules on a queue in the current event frame - * (trampoline scheduler). Use this for iteration operations. - * @property {Scheduler} asap Schedules on the micro task queue, which uses the - * fastest transport mechanism available, either Node.js' `process.nextTick()` - * or Web Worker MessageChannel or setTimeout or others. Use this for - * asynchronous conversions. - * @property {Scheduler} async Schedules work with `setInterval`. Use this for - * time-based operations. - * @property {Scheduler} animationFrame Schedules work with `requestAnimationFrame`. - * Use this for synchronizing with the platform's painting - */ -var Scheduler = { - asap: asap_1.asap, - queue: queue_1.queue, - animationFrame: animationFrame_1.animationFrame, - async: async_1.async -}; -exports.Scheduler = Scheduler; -/** - * @typedef {Object} Rx.Symbol - * @property {Symbol|string} rxSubscriber A symbol to use as a property name to - * retrieve an "Rx safe" Observer from an object. "Rx safety" can be defined as - * an object that has all of the traits of an Rx Subscriber, including the - * ability to add and remove subscriptions to the subscription chain and - * guarantees involving event triggering (can't "next" after unsubscription, - * etc). - * @property {Symbol|string} observable A symbol to use as a property name to - * retrieve an Observable as defined by the [ECMAScript "Observable" spec](https://github.com/zenparsing/es-observable). - * @property {Symbol|string} iterator The ES6 symbol to use as a property name - * to retrieve an iterator from an object. - */ -var Symbol = { - rxSubscriber: rxSubscriber_1.rxSubscriber, - observable: observable_1.observable, - iterator: iterator_1.iterator -}; -exports.Symbol = Symbol; -//# sourceMappingURL=Rx.js.map - -/***/ }), -/* 122 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -/** - * An execution context and a data structure to order tasks and schedule their - * execution. Provides a notion of (potentially virtual) time, through the - * `now()` getter method. - * - * Each unit of work in a Scheduler is called an {@link Action}. - * - * ```ts - * class Scheduler { - * now(): number; - * schedule(work, delay?, state?): Subscription; - * } - * ``` - * - * @class Scheduler - */ -var Scheduler = (function () { - function Scheduler(SchedulerAction, now) { - if (now === void 0) { now = Scheduler.now; } - this.SchedulerAction = SchedulerAction; - this.now = now; - } - /** - * Schedules a function, `work`, for execution. May happen at some point in - * the future, according to the `delay` parameter, if specified. May be passed - * some context object, `state`, which will be passed to the `work` function. - * - * The given arguments will be processed an stored as an Action object in a - * queue of actions. - * - * @param {function(state: ?T): ?Subscription} work A function representing a - * task, or some unit of work to be executed by the Scheduler. - * @param {number} [delay] Time to wait before executing the work, where the - * time unit is implicit and defined by the Scheduler itself. - * @param {T} [state] Some contextual data that the `work` function uses when - * called by the Scheduler. - * @return {Subscription} A subscription in order to be able to unsubscribe - * the scheduled work. - */ - Scheduler.prototype.schedule = function (work, delay, state) { - if (delay === void 0) { delay = 0; } - return new this.SchedulerAction(this, work).schedule(state, delay); - }; - Scheduler.now = Date.now ? Date.now : function () { return +new Date(); }; - return Scheduler; -}()); -exports.Scheduler = Scheduler; -//# sourceMappingURL=Scheduler.js.map - -/***/ }), -/* 123 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var bindCallback_1 = __webpack_require__(261); -Observable_1.Observable.bindCallback = bindCallback_1.bindCallback; -//# sourceMappingURL=bindCallback.js.map - -/***/ }), -/* 124 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var bindNodeCallback_1 = __webpack_require__(262); -Observable_1.Observable.bindNodeCallback = bindNodeCallback_1.bindNodeCallback; -//# sourceMappingURL=bindNodeCallback.js.map - -/***/ }), -/* 125 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var combineLatest_1 = __webpack_require__(263); -Observable_1.Observable.combineLatest = combineLatest_1.combineLatest; -//# sourceMappingURL=combineLatest.js.map - -/***/ }), -/* 126 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var concat_1 = __webpack_require__(264); -Observable_1.Observable.concat = concat_1.concat; -//# sourceMappingURL=concat.js.map - -/***/ }), -/* 127 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var defer_1 = __webpack_require__(265); -Observable_1.Observable.defer = defer_1.defer; -//# sourceMappingURL=defer.js.map - -/***/ }), -/* 128 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var ajax_1 = __webpack_require__(267); -Observable_1.Observable.ajax = ajax_1.ajax; -//# sourceMappingURL=ajax.js.map - -/***/ }), -/* 129 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var webSocket_1 = __webpack_require__(268); -Observable_1.Observable.webSocket = webSocket_1.webSocket; -//# sourceMappingURL=webSocket.js.map - -/***/ }), -/* 130 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var empty_1 = __webpack_require__(269); -Observable_1.Observable.empty = empty_1.empty; -//# sourceMappingURL=empty.js.map - -/***/ }), -/* 131 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var forkJoin_1 = __webpack_require__(388); -Observable_1.Observable.forkJoin = forkJoin_1.forkJoin; -//# sourceMappingURL=forkJoin.js.map - -/***/ }), -/* 132 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var from_1 = __webpack_require__(389); -Observable_1.Observable.from = from_1.from; -//# sourceMappingURL=from.js.map - -/***/ }), -/* 133 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var fromEvent_1 = __webpack_require__(270); -Observable_1.Observable.fromEvent = fromEvent_1.fromEvent; -//# sourceMappingURL=fromEvent.js.map - -/***/ }), -/* 134 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var fromEventPattern_1 = __webpack_require__(271); -Observable_1.Observable.fromEventPattern = fromEventPattern_1.fromEventPattern; -//# sourceMappingURL=fromEventPattern.js.map - -/***/ }), -/* 135 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var fromPromise_1 = __webpack_require__(382); -Observable_1.Observable.fromPromise = fromPromise_1.fromPromise; -//# sourceMappingURL=fromPromise.js.map - -/***/ }), -/* 136 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var GenerateObservable_1 = __webpack_require__(252); -Observable_1.Observable.generate = GenerateObservable_1.GenerateObservable.create; -//# sourceMappingURL=generate.js.map - -/***/ }), -/* 137 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var if_1 = __webpack_require__(272); -Observable_1.Observable.if = if_1._if; -//# sourceMappingURL=if.js.map - -/***/ }), -/* 138 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var merge_1 = __webpack_require__(390); -Observable_1.Observable.merge = merge_1.merge; -//# sourceMappingURL=merge.js.map - -/***/ }), -/* 139 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var never_1 = __webpack_require__(274); -Observable_1.Observable.never = never_1.never; -//# sourceMappingURL=never.js.map - -/***/ }), -/* 140 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var of_1 = __webpack_require__(391); -Observable_1.Observable.of = of_1.of; -//# sourceMappingURL=of.js.map - -/***/ }), -/* 141 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var onErrorResumeNext_1 = __webpack_require__(63); -Observable_1.Observable.onErrorResumeNext = onErrorResumeNext_1.onErrorResumeNextStatic; -//# sourceMappingURL=onErrorResumeNext.js.map - -/***/ }), -/* 142 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var pairs_1 = __webpack_require__(275); -Observable_1.Observable.pairs = pairs_1.pairs; -//# sourceMappingURL=pairs.js.map - -/***/ }), -/* 143 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var race_1 = __webpack_require__(64); -Observable_1.Observable.race = race_1.raceStatic; -//# sourceMappingURL=race.js.map - -/***/ }), -/* 144 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var range_1 = __webpack_require__(276); -Observable_1.Observable.range = range_1.range; -//# sourceMappingURL=range.js.map - -/***/ }), -/* 145 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var using_1 = __webpack_require__(279); -Observable_1.Observable.using = using_1.using; -//# sourceMappingURL=using.js.map - -/***/ }), -/* 146 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var zip_1 = __webpack_require__(280); -Observable_1.Observable.zip = zip_1.zip; -//# sourceMappingURL=zip.js.map - -/***/ }), -/* 147 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var audit_1 = __webpack_require__(281); -Observable_1.Observable.prototype.audit = audit_1.audit; -//# sourceMappingURL=audit.js.map - -/***/ }), -/* 148 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var auditTime_1 = __webpack_require__(282); -Observable_1.Observable.prototype.auditTime = auditTime_1.auditTime; -//# sourceMappingURL=auditTime.js.map - -/***/ }), -/* 149 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var buffer_1 = __webpack_require__(283); -Observable_1.Observable.prototype.buffer = buffer_1.buffer; -//# sourceMappingURL=buffer.js.map - -/***/ }), -/* 150 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var bufferCount_1 = __webpack_require__(284); -Observable_1.Observable.prototype.bufferCount = bufferCount_1.bufferCount; -//# sourceMappingURL=bufferCount.js.map - -/***/ }), -/* 151 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var bufferTime_1 = __webpack_require__(285); -Observable_1.Observable.prototype.bufferTime = bufferTime_1.bufferTime; -//# sourceMappingURL=bufferTime.js.map - -/***/ }), -/* 152 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var bufferToggle_1 = __webpack_require__(286); -Observable_1.Observable.prototype.bufferToggle = bufferToggle_1.bufferToggle; -//# sourceMappingURL=bufferToggle.js.map - -/***/ }), -/* 153 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var bufferWhen_1 = __webpack_require__(287); -Observable_1.Observable.prototype.bufferWhen = bufferWhen_1.bufferWhen; -//# sourceMappingURL=bufferWhen.js.map - -/***/ }), -/* 154 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var combineAll_1 = __webpack_require__(288); -Observable_1.Observable.prototype.combineAll = combineAll_1.combineAll; -//# sourceMappingURL=combineAll.js.map - -/***/ }), -/* 155 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var combineLatest_1 = __webpack_require__(37); -Observable_1.Observable.prototype.combineLatest = combineLatest_1.combineLatest; -//# sourceMappingURL=combineLatest.js.map - -/***/ }), -/* 156 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var concat_1 = __webpack_require__(38); -Observable_1.Observable.prototype.concat = concat_1.concat; -//# sourceMappingURL=concat.js.map - -/***/ }), -/* 157 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var concatAll_1 = __webpack_require__(393); -Observable_1.Observable.prototype.concatAll = concatAll_1.concatAll; -//# sourceMappingURL=concatAll.js.map - -/***/ }), -/* 158 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var concatMap_1 = __webpack_require__(394); -Observable_1.Observable.prototype.concatMap = concatMap_1.concatMap; -//# sourceMappingURL=concatMap.js.map - -/***/ }), -/* 159 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var concatMapTo_1 = __webpack_require__(289); -Observable_1.Observable.prototype.concatMapTo = concatMapTo_1.concatMapTo; -//# sourceMappingURL=concatMapTo.js.map - -/***/ }), -/* 160 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var count_1 = __webpack_require__(290); -Observable_1.Observable.prototype.count = count_1.count; -//# sourceMappingURL=count.js.map - -/***/ }), -/* 161 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var debounce_1 = __webpack_require__(291); -Observable_1.Observable.prototype.debounce = debounce_1.debounce; -//# sourceMappingURL=debounce.js.map - -/***/ }), -/* 162 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var debounceTime_1 = __webpack_require__(292); -Observable_1.Observable.prototype.debounceTime = debounceTime_1.debounceTime; -//# sourceMappingURL=debounceTime.js.map - -/***/ }), -/* 163 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var defaultIfEmpty_1 = __webpack_require__(293); -Observable_1.Observable.prototype.defaultIfEmpty = defaultIfEmpty_1.defaultIfEmpty; -//# sourceMappingURL=defaultIfEmpty.js.map - -/***/ }), -/* 164 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var delay_1 = __webpack_require__(294); -Observable_1.Observable.prototype.delay = delay_1.delay; -//# sourceMappingURL=delay.js.map - -/***/ }), -/* 165 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var delayWhen_1 = __webpack_require__(295); -Observable_1.Observable.prototype.delayWhen = delayWhen_1.delayWhen; -//# sourceMappingURL=delayWhen.js.map - -/***/ }), -/* 166 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var dematerialize_1 = __webpack_require__(296); -Observable_1.Observable.prototype.dematerialize = dematerialize_1.dematerialize; -//# sourceMappingURL=dematerialize.js.map - -/***/ }), -/* 167 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var distinct_1 = __webpack_require__(297); -Observable_1.Observable.prototype.distinct = distinct_1.distinct; -//# sourceMappingURL=distinct.js.map - -/***/ }), -/* 168 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var distinctUntilChanged_1 = __webpack_require__(60); -Observable_1.Observable.prototype.distinctUntilChanged = distinctUntilChanged_1.distinctUntilChanged; -//# sourceMappingURL=distinctUntilChanged.js.map - -/***/ }), -/* 169 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var distinctUntilKeyChanged_1 = __webpack_require__(298); -Observable_1.Observable.prototype.distinctUntilKeyChanged = distinctUntilKeyChanged_1.distinctUntilKeyChanged; -//# sourceMappingURL=distinctUntilKeyChanged.js.map - -/***/ }), -/* 170 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var do_1 = __webpack_require__(299); -Observable_1.Observable.prototype.do = do_1._do; -Observable_1.Observable.prototype._do = do_1._do; -//# sourceMappingURL=do.js.map - -/***/ }), -/* 171 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var elementAt_1 = __webpack_require__(300); -Observable_1.Observable.prototype.elementAt = elementAt_1.elementAt; -//# sourceMappingURL=elementAt.js.map - -/***/ }), -/* 172 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var every_1 = __webpack_require__(395); -Observable_1.Observable.prototype.every = every_1.every; -//# sourceMappingURL=every.js.map - -/***/ }), -/* 173 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var exhaust_1 = __webpack_require__(301); -Observable_1.Observable.prototype.exhaust = exhaust_1.exhaust; -//# sourceMappingURL=exhaust.js.map - -/***/ }), -/* 174 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var exhaustMap_1 = __webpack_require__(302); -Observable_1.Observable.prototype.exhaustMap = exhaustMap_1.exhaustMap; -//# sourceMappingURL=exhaustMap.js.map - -/***/ }), -/* 175 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var expand_1 = __webpack_require__(303); -Observable_1.Observable.prototype.expand = expand_1.expand; -//# sourceMappingURL=expand.js.map - -/***/ }), -/* 176 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var filter_1 = __webpack_require__(42); -Observable_1.Observable.prototype.filter = filter_1.filter; -//# sourceMappingURL=filter.js.map - -/***/ }), -/* 177 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var finally_1 = __webpack_require__(304); -Observable_1.Observable.prototype.finally = finally_1._finally; -Observable_1.Observable.prototype._finally = finally_1._finally; -//# sourceMappingURL=finally.js.map - -/***/ }), -/* 178 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var find_1 = __webpack_require__(61); -Observable_1.Observable.prototype.find = find_1.find; -//# sourceMappingURL=find.js.map - -/***/ }), -/* 179 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var findIndex_1 = __webpack_require__(305); -Observable_1.Observable.prototype.findIndex = findIndex_1.findIndex; -//# sourceMappingURL=findIndex.js.map - -/***/ }), -/* 180 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var groupBy_1 = __webpack_require__(306); -Observable_1.Observable.prototype.groupBy = groupBy_1.groupBy; -//# sourceMappingURL=groupBy.js.map - -/***/ }), -/* 181 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var ignoreElements_1 = __webpack_require__(307); -Observable_1.Observable.prototype.ignoreElements = ignoreElements_1.ignoreElements; -//# sourceMappingURL=ignoreElements.js.map - -/***/ }), -/* 182 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var isEmpty_1 = __webpack_require__(308); -Observable_1.Observable.prototype.isEmpty = isEmpty_1.isEmpty; -//# sourceMappingURL=isEmpty.js.map - -/***/ }), -/* 183 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var last_1 = __webpack_require__(396); -Observable_1.Observable.prototype.last = last_1.last; -//# sourceMappingURL=last.js.map - -/***/ }), -/* 184 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var let_1 = __webpack_require__(309); -Observable_1.Observable.prototype.let = let_1.letProto; -Observable_1.Observable.prototype.letBind = let_1.letProto; -//# sourceMappingURL=let.js.map - -/***/ }), -/* 185 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var mapTo_1 = __webpack_require__(310); -Observable_1.Observable.prototype.mapTo = mapTo_1.mapTo; -//# sourceMappingURL=mapTo.js.map - -/***/ }), -/* 186 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var materialize_1 = __webpack_require__(311); -Observable_1.Observable.prototype.materialize = materialize_1.materialize; -//# sourceMappingURL=materialize.js.map - -/***/ }), -/* 187 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var max_1 = __webpack_require__(312); -Observable_1.Observable.prototype.max = max_1.max; -//# sourceMappingURL=max.js.map - -/***/ }), -/* 188 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var merge_1 = __webpack_require__(397); -Observable_1.Observable.prototype.merge = merge_1.merge; -//# sourceMappingURL=merge.js.map - -/***/ }), -/* 189 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var mergeAll_1 = __webpack_require__(77); -Observable_1.Observable.prototype.mergeAll = mergeAll_1.mergeAll; -//# sourceMappingURL=mergeAll.js.map - -/***/ }), -/* 190 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var mergeMap_1 = __webpack_require__(383); -Observable_1.Observable.prototype.mergeMap = mergeMap_1.mergeMap; -Observable_1.Observable.prototype.flatMap = mergeMap_1.mergeMap; -//# sourceMappingURL=mergeMap.js.map - -/***/ }), -/* 191 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var mergeMapTo_1 = __webpack_require__(62); -Observable_1.Observable.prototype.flatMapTo = mergeMapTo_1.mergeMapTo; -Observable_1.Observable.prototype.mergeMapTo = mergeMapTo_1.mergeMapTo; -//# sourceMappingURL=mergeMapTo.js.map - -/***/ }), -/* 192 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var mergeScan_1 = __webpack_require__(313); -Observable_1.Observable.prototype.mergeScan = mergeScan_1.mergeScan; -//# sourceMappingURL=mergeScan.js.map - -/***/ }), -/* 193 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var min_1 = __webpack_require__(314); -Observable_1.Observable.prototype.min = min_1.min; -//# sourceMappingURL=min.js.map - -/***/ }), -/* 194 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var multicast_1 = __webpack_require__(16); -Observable_1.Observable.prototype.multicast = multicast_1.multicast; -//# sourceMappingURL=multicast.js.map - -/***/ }), -/* 195 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var observeOn_1 = __webpack_require__(87); -Observable_1.Observable.prototype.observeOn = observeOn_1.observeOn; -//# sourceMappingURL=observeOn.js.map - -/***/ }), -/* 196 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var onErrorResumeNext_1 = __webpack_require__(63); -Observable_1.Observable.prototype.onErrorResumeNext = onErrorResumeNext_1.onErrorResumeNext; -//# sourceMappingURL=onErrorResumeNext.js.map - -/***/ }), -/* 197 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var pairwise_1 = __webpack_require__(315); -Observable_1.Observable.prototype.pairwise = pairwise_1.pairwise; -//# sourceMappingURL=pairwise.js.map +/*! ***************************************************************************** +Copyright (C) Microsoft. 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. +***************************************************************************** */ +var Reflect; +(function (Reflect) { + "use strict"; + var hasOwn = Object.prototype.hasOwnProperty; + // feature test for Symbol support + var supportsSymbol = typeof Symbol === "function"; + var toPrimitiveSymbol = supportsSymbol && typeof Symbol.toPrimitive !== "undefined" ? Symbol.toPrimitive : "@@toPrimitive"; + var iteratorSymbol = supportsSymbol && typeof Symbol.iterator !== "undefined" ? Symbol.iterator : "@@iterator"; + var HashMap; + (function (HashMap) { + var supportsCreate = typeof Object.create === "function"; // feature test for Object.create support + var supportsProto = { __proto__: [] } instanceof Array; // feature test for __proto__ support + var downLevel = !supportsCreate && !supportsProto; + // create an object in dictionary mode (a.k.a. "slow" mode in v8) + HashMap.create = supportsCreate + ? function () { return MakeDictionary(Object.create(null)); } + : supportsProto + ? function () { return MakeDictionary({ __proto__: null }); } + : function () { return MakeDictionary({}); }; + HashMap.has = downLevel + ? function (map, key) { return hasOwn.call(map, key); } + : function (map, key) { return key in map; }; + HashMap.get = downLevel + ? function (map, key) { return hasOwn.call(map, key) ? map[key] : undefined; } + : function (map, key) { return map[key]; }; + })(HashMap || (HashMap = {})); + // Load global or shim versions of Map, Set, and WeakMap + var functionPrototype = Object.getPrototypeOf(Function); + var usePolyfill = typeof process === "object" && process.env && process.env["REFLECT_METADATA_USE_MAP_POLYFILL"] === "true"; + var _Map = !usePolyfill && typeof Map === "function" && typeof Map.prototype.entries === "function" ? Map : CreateMapPolyfill(); + var _Set = !usePolyfill && typeof Set === "function" && typeof Set.prototype.entries === "function" ? Set : CreateSetPolyfill(); + var _WeakMap = !usePolyfill && typeof WeakMap === "function" ? WeakMap : CreateWeakMapPolyfill(); + // [[Metadata]] internal slot + // https://rbuckton.github.io/reflect-metadata/#ordinary-object-internal-methods-and-internal-slots + var Metadata = new _WeakMap(); + /** + * Applies a set of decorators to a property of a target object. + * @param decorators An array of decorators. + * @param target The target object. + * @param propertyKey (Optional) The property key to decorate. + * @param attributes (Optional) The property descriptor for the target key. + * @remarks Decorators are applied in reverse order. + * @example + * + * class Example { + * // property declarations are not part of ES6, though they are valid in TypeScript: + * // static staticProperty; + * // property; + * + * constructor(p) { } + * static staticMethod(p) { } + * method(p) { } + * } + * + * // constructor + * Example = Reflect.decorate(decoratorsArray, Example); + * + * // property (on constructor) + * Reflect.decorate(decoratorsArray, Example, "staticProperty"); + * + * // property (on prototype) + * Reflect.decorate(decoratorsArray, Example.prototype, "property"); + * + * // method (on constructor) + * Object.defineProperty(Example, "staticMethod", + * Reflect.decorate(decoratorsArray, Example, "staticMethod", + * Object.getOwnPropertyDescriptor(Example, "staticMethod"))); + * + * // method (on prototype) + * Object.defineProperty(Example.prototype, "method", + * Reflect.decorate(decoratorsArray, Example.prototype, "method", + * Object.getOwnPropertyDescriptor(Example.prototype, "method"))); + * + */ + function decorate(decorators, target, propertyKey, attributes) { + if (!IsUndefined(propertyKey)) { + if (!IsArray(decorators)) + throw new TypeError(); + if (!IsObject(target)) + throw new TypeError(); + if (!IsObject(attributes) && !IsUndefined(attributes) && !IsNull(attributes)) + throw new TypeError(); + if (IsNull(attributes)) + attributes = undefined; + propertyKey = ToPropertyKey(propertyKey); + return DecorateProperty(decorators, target, propertyKey, attributes); + } + else { + if (!IsArray(decorators)) + throw new TypeError(); + if (!IsConstructor(target)) + throw new TypeError(); + return DecorateConstructor(decorators, target); + } + } + Reflect.decorate = decorate; + // 4.1.2 Reflect.metadata(metadataKey, metadataValue) + // https://rbuckton.github.io/reflect-metadata/#reflect.metadata + /** + * A default metadata decorator factory that can be used on a class, class member, or parameter. + * @param metadataKey The key for the metadata entry. + * @param metadataValue The value for the metadata entry. + * @returns A decorator function. + * @remarks + * If `metadataKey` is already defined for the target and target key, the + * metadataValue for that key will be overwritten. + * @example + * + * // constructor + * @Reflect.metadata(key, value) + * class Example { + * } + * + * // property (on constructor, TypeScript only) + * class Example { + * @Reflect.metadata(key, value) + * static staticProperty; + * } + * + * // property (on prototype, TypeScript only) + * class Example { + * @Reflect.metadata(key, value) + * property; + * } + * + * // method (on constructor) + * class Example { + * @Reflect.metadata(key, value) + * static staticMethod() { } + * } + * + * // method (on prototype) + * class Example { + * @Reflect.metadata(key, value) + * method() { } + * } + * + */ + function metadata(metadataKey, metadataValue) { + function decorator(target, propertyKey) { + if (!IsObject(target)) + throw new TypeError(); + if (!IsUndefined(propertyKey) && !IsPropertyKey(propertyKey)) + throw new TypeError(); + OrdinaryDefineOwnMetadata(metadataKey, metadataValue, target, propertyKey); + } + return decorator; + } + Reflect.metadata = metadata; + /** + * Define a unique metadata entry on the target. + * @param metadataKey A key used to store and retrieve metadata. + * @param metadataValue A value that contains attached metadata. + * @param target The target object on which to define metadata. + * @param propertyKey (Optional) The property key for the target. + * @example + * + * class Example { + * // property declarations are not part of ES6, though they are valid in TypeScript: + * // static staticProperty; + * // property; + * + * constructor(p) { } + * static staticMethod(p) { } + * method(p) { } + * } + * + * // constructor + * Reflect.defineMetadata("custom:annotation", options, Example); + * + * // property (on constructor) + * Reflect.defineMetadata("custom:annotation", options, Example, "staticProperty"); + * + * // property (on prototype) + * Reflect.defineMetadata("custom:annotation", options, Example.prototype, "property"); + * + * // method (on constructor) + * Reflect.defineMetadata("custom:annotation", options, Example, "staticMethod"); + * + * // method (on prototype) + * Reflect.defineMetadata("custom:annotation", options, Example.prototype, "method"); + * + * // decorator factory as metadata-producing annotation. + * function MyAnnotation(options): Decorator { + * return (target, key?) => Reflect.defineMetadata("custom:annotation", options, target, key); + * } + * + */ + function defineMetadata(metadataKey, metadataValue, target, propertyKey) { + if (!IsObject(target)) + throw new TypeError(); + if (!IsUndefined(propertyKey)) + propertyKey = ToPropertyKey(propertyKey); + return OrdinaryDefineOwnMetadata(metadataKey, metadataValue, target, propertyKey); + } + Reflect.defineMetadata = defineMetadata; + /** + * Gets a value indicating whether the target object or its prototype chain has the provided metadata key defined. + * @param metadataKey A key used to store and retrieve metadata. + * @param target The target object on which the metadata is defined. + * @param propertyKey (Optional) The property key for the target. + * @returns `true` if the metadata key was defined on the target object or its prototype chain; otherwise, `false`. + * @example + * + * class Example { + * // property declarations are not part of ES6, though they are valid in TypeScript: + * // static staticProperty; + * // property; + * + * constructor(p) { } + * static staticMethod(p) { } + * method(p) { } + * } + * + * // constructor + * result = Reflect.hasMetadata("custom:annotation", Example); + * + * // property (on constructor) + * result = Reflect.hasMetadata("custom:annotation", Example, "staticProperty"); + * + * // property (on prototype) + * result = Reflect.hasMetadata("custom:annotation", Example.prototype, "property"); + * + * // method (on constructor) + * result = Reflect.hasMetadata("custom:annotation", Example, "staticMethod"); + * + * // method (on prototype) + * result = Reflect.hasMetadata("custom:annotation", Example.prototype, "method"); + * + */ + function hasMetadata(metadataKey, target, propertyKey) { + if (!IsObject(target)) + throw new TypeError(); + if (!IsUndefined(propertyKey)) + propertyKey = ToPropertyKey(propertyKey); + return OrdinaryHasMetadata(metadataKey, target, propertyKey); + } + Reflect.hasMetadata = hasMetadata; + /** + * Gets a value indicating whether the target object has the provided metadata key defined. + * @param metadataKey A key used to store and retrieve metadata. + * @param target The target object on which the metadata is defined. + * @param propertyKey (Optional) The property key for the target. + * @returns `true` if the metadata key was defined on the target object; otherwise, `false`. + * @example + * + * class Example { + * // property declarations are not part of ES6, though they are valid in TypeScript: + * // static staticProperty; + * // property; + * + * constructor(p) { } + * static staticMethod(p) { } + * method(p) { } + * } + * + * // constructor + * result = Reflect.hasOwnMetadata("custom:annotation", Example); + * + * // property (on constructor) + * result = Reflect.hasOwnMetadata("custom:annotation", Example, "staticProperty"); + * + * // property (on prototype) + * result = Reflect.hasOwnMetadata("custom:annotation", Example.prototype, "property"); + * + * // method (on constructor) + * result = Reflect.hasOwnMetadata("custom:annotation", Example, "staticMethod"); + * + * // method (on prototype) + * result = Reflect.hasOwnMetadata("custom:annotation", Example.prototype, "method"); + * + */ + function hasOwnMetadata(metadataKey, target, propertyKey) { + if (!IsObject(target)) + throw new TypeError(); + if (!IsUndefined(propertyKey)) + propertyKey = ToPropertyKey(propertyKey); + return OrdinaryHasOwnMetadata(metadataKey, target, propertyKey); + } + Reflect.hasOwnMetadata = hasOwnMetadata; + /** + * Gets the metadata value for the provided metadata key on the target object or its prototype chain. + * @param metadataKey A key used to store and retrieve metadata. + * @param target The target object on which the metadata is defined. + * @param propertyKey (Optional) The property key for the target. + * @returns The metadata value for the metadata key if found; otherwise, `undefined`. + * @example + * + * class Example { + * // property declarations are not part of ES6, though they are valid in TypeScript: + * // static staticProperty; + * // property; + * + * constructor(p) { } + * static staticMethod(p) { } + * method(p) { } + * } + * + * // constructor + * result = Reflect.getMetadata("custom:annotation", Example); + * + * // property (on constructor) + * result = Reflect.getMetadata("custom:annotation", Example, "staticProperty"); + * + * // property (on prototype) + * result = Reflect.getMetadata("custom:annotation", Example.prototype, "property"); + * + * // method (on constructor) + * result = Reflect.getMetadata("custom:annotation", Example, "staticMethod"); + * + * // method (on prototype) + * result = Reflect.getMetadata("custom:annotation", Example.prototype, "method"); + * + */ + function getMetadata(metadataKey, target, propertyKey) { + if (!IsObject(target)) + throw new TypeError(); + if (!IsUndefined(propertyKey)) + propertyKey = ToPropertyKey(propertyKey); + return OrdinaryGetMetadata(metadataKey, target, propertyKey); + } + Reflect.getMetadata = getMetadata; + /** + * Gets the metadata value for the provided metadata key on the target object. + * @param metadataKey A key used to store and retrieve metadata. + * @param target The target object on which the metadata is defined. + * @param propertyKey (Optional) The property key for the target. + * @returns The metadata value for the metadata key if found; otherwise, `undefined`. + * @example + * + * class Example { + * // property declarations are not part of ES6, though they are valid in TypeScript: + * // static staticProperty; + * // property; + * + * constructor(p) { } + * static staticMethod(p) { } + * method(p) { } + * } + * + * // constructor + * result = Reflect.getOwnMetadata("custom:annotation", Example); + * + * // property (on constructor) + * result = Reflect.getOwnMetadata("custom:annotation", Example, "staticProperty"); + * + * // property (on prototype) + * result = Reflect.getOwnMetadata("custom:annotation", Example.prototype, "property"); + * + * // method (on constructor) + * result = Reflect.getOwnMetadata("custom:annotation", Example, "staticMethod"); + * + * // method (on prototype) + * result = Reflect.getOwnMetadata("custom:annotation", Example.prototype, "method"); + * + */ + function getOwnMetadata(metadataKey, target, propertyKey) { + if (!IsObject(target)) + throw new TypeError(); + if (!IsUndefined(propertyKey)) + propertyKey = ToPropertyKey(propertyKey); + return OrdinaryGetOwnMetadata(metadataKey, target, propertyKey); + } + Reflect.getOwnMetadata = getOwnMetadata; + /** + * Gets the metadata keys defined on the target object or its prototype chain. + * @param target The target object on which the metadata is defined. + * @param propertyKey (Optional) The property key for the target. + * @returns An array of unique metadata keys. + * @example + * + * class Example { + * // property declarations are not part of ES6, though they are valid in TypeScript: + * // static staticProperty; + * // property; + * + * constructor(p) { } + * static staticMethod(p) { } + * method(p) { } + * } + * + * // constructor + * result = Reflect.getMetadataKeys(Example); + * + * // property (on constructor) + * result = Reflect.getMetadataKeys(Example, "staticProperty"); + * + * // property (on prototype) + * result = Reflect.getMetadataKeys(Example.prototype, "property"); + * + * // method (on constructor) + * result = Reflect.getMetadataKeys(Example, "staticMethod"); + * + * // method (on prototype) + * result = Reflect.getMetadataKeys(Example.prototype, "method"); + * + */ + function getMetadataKeys(target, propertyKey) { + if (!IsObject(target)) + throw new TypeError(); + if (!IsUndefined(propertyKey)) + propertyKey = ToPropertyKey(propertyKey); + return OrdinaryMetadataKeys(target, propertyKey); + } + Reflect.getMetadataKeys = getMetadataKeys; + /** + * Gets the unique metadata keys defined on the target object. + * @param target The target object on which the metadata is defined. + * @param propertyKey (Optional) The property key for the target. + * @returns An array of unique metadata keys. + * @example + * + * class Example { + * // property declarations are not part of ES6, though they are valid in TypeScript: + * // static staticProperty; + * // property; + * + * constructor(p) { } + * static staticMethod(p) { } + * method(p) { } + * } + * + * // constructor + * result = Reflect.getOwnMetadataKeys(Example); + * + * // property (on constructor) + * result = Reflect.getOwnMetadataKeys(Example, "staticProperty"); + * + * // property (on prototype) + * result = Reflect.getOwnMetadataKeys(Example.prototype, "property"); + * + * // method (on constructor) + * result = Reflect.getOwnMetadataKeys(Example, "staticMethod"); + * + * // method (on prototype) + * result = Reflect.getOwnMetadataKeys(Example.prototype, "method"); + * + */ + function getOwnMetadataKeys(target, propertyKey) { + if (!IsObject(target)) + throw new TypeError(); + if (!IsUndefined(propertyKey)) + propertyKey = ToPropertyKey(propertyKey); + return OrdinaryOwnMetadataKeys(target, propertyKey); + } + Reflect.getOwnMetadataKeys = getOwnMetadataKeys; + /** + * Deletes the metadata entry from the target object with the provided key. + * @param metadataKey A key used to store and retrieve metadata. + * @param target The target object on which the metadata is defined. + * @param propertyKey (Optional) The property key for the target. + * @returns `true` if the metadata entry was found and deleted; otherwise, false. + * @example + * + * class Example { + * // property declarations are not part of ES6, though they are valid in TypeScript: + * // static staticProperty; + * // property; + * + * constructor(p) { } + * static staticMethod(p) { } + * method(p) { } + * } + * + * // constructor + * result = Reflect.deleteMetadata("custom:annotation", Example); + * + * // property (on constructor) + * result = Reflect.deleteMetadata("custom:annotation", Example, "staticProperty"); + * + * // property (on prototype) + * result = Reflect.deleteMetadata("custom:annotation", Example.prototype, "property"); + * + * // method (on constructor) + * result = Reflect.deleteMetadata("custom:annotation", Example, "staticMethod"); + * + * // method (on prototype) + * result = Reflect.deleteMetadata("custom:annotation", Example.prototype, "method"); + * + */ + function deleteMetadata(metadataKey, target, propertyKey) { + if (!IsObject(target)) + throw new TypeError(); + if (!IsUndefined(propertyKey)) + propertyKey = ToPropertyKey(propertyKey); + var metadataMap = GetOrCreateMetadataMap(target, propertyKey, /*Create*/ false); + if (IsUndefined(metadataMap)) + return false; + if (!metadataMap.delete(metadataKey)) + return false; + if (metadataMap.size > 0) + return true; + var targetMetadata = Metadata.get(target); + targetMetadata.delete(propertyKey); + if (targetMetadata.size > 0) + return true; + Metadata.delete(target); + return true; + } + Reflect.deleteMetadata = deleteMetadata; + function DecorateConstructor(decorators, target) { + for (var i = decorators.length - 1; i >= 0; --i) { + var decorator = decorators[i]; + var decorated = decorator(target); + if (!IsUndefined(decorated) && !IsNull(decorated)) { + if (!IsConstructor(decorated)) + throw new TypeError(); + target = decorated; + } + } + return target; + } + function DecorateProperty(decorators, target, propertyKey, descriptor) { + for (var i = decorators.length - 1; i >= 0; --i) { + var decorator = decorators[i]; + var decorated = decorator(target, propertyKey, descriptor); + if (!IsUndefined(decorated) && !IsNull(decorated)) { + if (!IsObject(decorated)) + throw new TypeError(); + descriptor = decorated; + } + } + return descriptor; + } + function GetOrCreateMetadataMap(O, P, Create) { + var targetMetadata = Metadata.get(O); + if (IsUndefined(targetMetadata)) { + if (!Create) + return undefined; + targetMetadata = new _Map(); + Metadata.set(O, targetMetadata); + } + var metadataMap = targetMetadata.get(P); + if (IsUndefined(metadataMap)) { + if (!Create) + return undefined; + metadataMap = new _Map(); + targetMetadata.set(P, metadataMap); + } + return metadataMap; + } + // 3.1.1.1 OrdinaryHasMetadata(MetadataKey, O, P) + // https://rbuckton.github.io/reflect-metadata/#ordinaryhasmetadata + function OrdinaryHasMetadata(MetadataKey, O, P) { + var hasOwn = OrdinaryHasOwnMetadata(MetadataKey, O, P); + if (hasOwn) + return true; + var parent = OrdinaryGetPrototypeOf(O); + if (!IsNull(parent)) + return OrdinaryHasMetadata(MetadataKey, parent, P); + return false; + } + // 3.1.2.1 OrdinaryHasOwnMetadata(MetadataKey, O, P) + // https://rbuckton.github.io/reflect-metadata/#ordinaryhasownmetadata + function OrdinaryHasOwnMetadata(MetadataKey, O, P) { + var metadataMap = GetOrCreateMetadataMap(O, P, /*Create*/ false); + if (IsUndefined(metadataMap)) + return false; + return ToBoolean(metadataMap.has(MetadataKey)); + } + // 3.1.3.1 OrdinaryGetMetadata(MetadataKey, O, P) + // https://rbuckton.github.io/reflect-metadata/#ordinarygetmetadata + function OrdinaryGetMetadata(MetadataKey, O, P) { + var hasOwn = OrdinaryHasOwnMetadata(MetadataKey, O, P); + if (hasOwn) + return OrdinaryGetOwnMetadata(MetadataKey, O, P); + var parent = OrdinaryGetPrototypeOf(O); + if (!IsNull(parent)) + return OrdinaryGetMetadata(MetadataKey, parent, P); + return undefined; + } + // 3.1.4.1 OrdinaryGetOwnMetadata(MetadataKey, O, P) + // https://rbuckton.github.io/reflect-metadata/#ordinarygetownmetadata + function OrdinaryGetOwnMetadata(MetadataKey, O, P) { + var metadataMap = GetOrCreateMetadataMap(O, P, /*Create*/ false); + if (IsUndefined(metadataMap)) + return undefined; + return metadataMap.get(MetadataKey); + } + // 3.1.5.1 OrdinaryDefineOwnMetadata(MetadataKey, MetadataValue, O, P) + // https://rbuckton.github.io/reflect-metadata/#ordinarydefineownmetadata + function OrdinaryDefineOwnMetadata(MetadataKey, MetadataValue, O, P) { + var metadataMap = GetOrCreateMetadataMap(O, P, /*Create*/ true); + metadataMap.set(MetadataKey, MetadataValue); + } + // 3.1.6.1 OrdinaryMetadataKeys(O, P) + // https://rbuckton.github.io/reflect-metadata/#ordinarymetadatakeys + function OrdinaryMetadataKeys(O, P) { + var ownKeys = OrdinaryOwnMetadataKeys(O, P); + var parent = OrdinaryGetPrototypeOf(O); + if (parent === null) + return ownKeys; + var parentKeys = OrdinaryMetadataKeys(parent, P); + if (parentKeys.length <= 0) + return ownKeys; + if (ownKeys.length <= 0) + return parentKeys; + var set = new _Set(); + var keys = []; + for (var _i = 0, ownKeys_1 = ownKeys; _i < ownKeys_1.length; _i++) { + var key = ownKeys_1[_i]; + var hasKey = set.has(key); + if (!hasKey) { + set.add(key); + keys.push(key); + } + } + for (var _a = 0, parentKeys_1 = parentKeys; _a < parentKeys_1.length; _a++) { + var key = parentKeys_1[_a]; + var hasKey = set.has(key); + if (!hasKey) { + set.add(key); + keys.push(key); + } + } + return keys; + } + // 3.1.7.1 OrdinaryOwnMetadataKeys(O, P) + // https://rbuckton.github.io/reflect-metadata/#ordinaryownmetadatakeys + function OrdinaryOwnMetadataKeys(O, P) { + var keys = []; + var metadataMap = GetOrCreateMetadataMap(O, P, /*Create*/ false); + if (IsUndefined(metadataMap)) + return keys; + var keysObj = metadataMap.keys(); + var iterator = GetIterator(keysObj); + var k = 0; + while (true) { + var next = IteratorStep(iterator); + if (!next) { + keys.length = k; + return keys; + } + var nextValue = IteratorValue(next); + try { + keys[k] = nextValue; + } + catch (e) { + try { + IteratorClose(iterator); + } + finally { + throw e; + } + } + k++; + } + } + // 6 ECMAScript Data Typ0es and Values + // https://tc39.github.io/ecma262/#sec-ecmascript-data-types-and-values + function Type(x) { + if (x === null) + return 1 /* Null */; + switch (typeof x) { + case "undefined": return 0 /* Undefined */; + case "boolean": return 2 /* Boolean */; + case "string": return 3 /* String */; + case "symbol": return 4 /* Symbol */; + case "number": return 5 /* Number */; + case "object": return x === null ? 1 /* Null */ : 6 /* Object */; + default: return 6 /* Object */; + } + } + // 6.1.1 The Undefined Type + // https://tc39.github.io/ecma262/#sec-ecmascript-language-types-undefined-type + function IsUndefined(x) { + return x === undefined; + } + // 6.1.2 The Null Type + // https://tc39.github.io/ecma262/#sec-ecmascript-language-types-null-type + function IsNull(x) { + return x === null; + } + // 6.1.5 The Symbol Type + // https://tc39.github.io/ecma262/#sec-ecmascript-language-types-symbol-type + function IsSymbol(x) { + return typeof x === "symbol"; + } + // 6.1.7 The Object Type + // https://tc39.github.io/ecma262/#sec-object-type + function IsObject(x) { + return typeof x === "object" ? x !== null : typeof x === "function"; + } + // 7.1 Type Conversion + // https://tc39.github.io/ecma262/#sec-type-conversion + // 7.1.1 ToPrimitive(input [, PreferredType]) + // https://tc39.github.io/ecma262/#sec-toprimitive + function ToPrimitive(input, PreferredType) { + switch (Type(input)) { + case 0 /* Undefined */: return input; + case 1 /* Null */: return input; + case 2 /* Boolean */: return input; + case 3 /* String */: return input; + case 4 /* Symbol */: return input; + case 5 /* Number */: return input; + } + var hint = PreferredType === 3 /* String */ ? "string" : PreferredType === 5 /* Number */ ? "number" : "default"; + var exoticToPrim = GetMethod(input, toPrimitiveSymbol); + if (exoticToPrim !== undefined) { + var result = exoticToPrim.call(input, hint); + if (IsObject(result)) + throw new TypeError(); + return result; + } + return OrdinaryToPrimitive(input, hint === "default" ? "number" : hint); + } + // 7.1.1.1 OrdinaryToPrimitive(O, hint) + // https://tc39.github.io/ecma262/#sec-ordinarytoprimitive + function OrdinaryToPrimitive(O, hint) { + if (hint === "string") { + var toString_1 = O.toString; + if (IsCallable(toString_1)) { + var result = toString_1.call(O); + if (!IsObject(result)) + return result; + } + var valueOf = O.valueOf; + if (IsCallable(valueOf)) { + var result = valueOf.call(O); + if (!IsObject(result)) + return result; + } + } + else { + var valueOf = O.valueOf; + if (IsCallable(valueOf)) { + var result = valueOf.call(O); + if (!IsObject(result)) + return result; + } + var toString_2 = O.toString; + if (IsCallable(toString_2)) { + var result = toString_2.call(O); + if (!IsObject(result)) + return result; + } + } + throw new TypeError(); + } + // 7.1.2 ToBoolean(argument) + // https://tc39.github.io/ecma262/2016/#sec-toboolean + function ToBoolean(argument) { + return !!argument; + } + // 7.1.12 ToString(argument) + // https://tc39.github.io/ecma262/#sec-tostring + function ToString(argument) { + return "" + argument; + } + // 7.1.14 ToPropertyKey(argument) + // https://tc39.github.io/ecma262/#sec-topropertykey + function ToPropertyKey(argument) { + var key = ToPrimitive(argument, 3 /* String */); + if (IsSymbol(key)) + return key; + return ToString(key); + } + // 7.2 Testing and Comparison Operations + // https://tc39.github.io/ecma262/#sec-testing-and-comparison-operations + // 7.2.2 IsArray(argument) + // https://tc39.github.io/ecma262/#sec-isarray + function IsArray(argument) { + return Array.isArray + ? Array.isArray(argument) + : argument instanceof Object + ? argument instanceof Array + : Object.prototype.toString.call(argument) === "[object Array]"; + } + // 7.2.3 IsCallable(argument) + // https://tc39.github.io/ecma262/#sec-iscallable + function IsCallable(argument) { + // NOTE: This is an approximation as we cannot check for [[Call]] internal method. + return typeof argument === "function"; + } + // 7.2.4 IsConstructor(argument) + // https://tc39.github.io/ecma262/#sec-isconstructor + function IsConstructor(argument) { + // NOTE: This is an approximation as we cannot check for [[Construct]] internal method. + return typeof argument === "function"; + } + // 7.2.7 IsPropertyKey(argument) + // https://tc39.github.io/ecma262/#sec-ispropertykey + function IsPropertyKey(argument) { + switch (Type(argument)) { + case 3 /* String */: return true; + case 4 /* Symbol */: return true; + default: return false; + } + } + // 7.3 Operations on Objects + // https://tc39.github.io/ecma262/#sec-operations-on-objects + // 7.3.9 GetMethod(V, P) + // https://tc39.github.io/ecma262/#sec-getmethod + function GetMethod(V, P) { + var func = V[P]; + if (func === undefined || func === null) + return undefined; + if (!IsCallable(func)) + throw new TypeError(); + return func; + } + // 7.4 Operations on Iterator Objects + // https://tc39.github.io/ecma262/#sec-operations-on-iterator-objects + function GetIterator(obj) { + var method = GetMethod(obj, iteratorSymbol); + if (!IsCallable(method)) + throw new TypeError(); // from Call + var iterator = method.call(obj); + if (!IsObject(iterator)) + throw new TypeError(); + return iterator; + } + // 7.4.4 IteratorValue(iterResult) + // https://tc39.github.io/ecma262/2016/#sec-iteratorvalue + function IteratorValue(iterResult) { + return iterResult.value; + } + // 7.4.5 IteratorStep(iterator) + // https://tc39.github.io/ecma262/#sec-iteratorstep + function IteratorStep(iterator) { + var result = iterator.next(); + return result.done ? false : result; + } + // 7.4.6 IteratorClose(iterator, completion) + // https://tc39.github.io/ecma262/#sec-iteratorclose + function IteratorClose(iterator) { + var f = iterator["return"]; + if (f) + f.call(iterator); + } + // 9.1 Ordinary Object Internal Methods and Internal Slots + // https://tc39.github.io/ecma262/#sec-ordinary-object-internal-methods-and-internal-slots + // 9.1.1.1 OrdinaryGetPrototypeOf(O) + // https://tc39.github.io/ecma262/#sec-ordinarygetprototypeof + function OrdinaryGetPrototypeOf(O) { + var proto = Object.getPrototypeOf(O); + if (typeof O !== "function" || O === functionPrototype) + return proto; + // TypeScript doesn't set __proto__ in ES5, as it's non-standard. + // Try to determine the superclass constructor. Compatible implementations + // must either set __proto__ on a subclass constructor to the superclass constructor, + // or ensure each class has a valid `constructor` property on its prototype that + // points back to the constructor. + // If this is not the same as Function.[[Prototype]], then this is definately inherited. + // This is the case when in ES6 or when using __proto__ in a compatible browser. + if (proto !== functionPrototype) + return proto; + // If the super prototype is Object.prototype, null, or undefined, then we cannot determine the heritage. + var prototype = O.prototype; + var prototypeProto = prototype && Object.getPrototypeOf(prototype); + if (prototypeProto == null || prototypeProto === Object.prototype) + return proto; + // If the constructor was not a function, then we cannot determine the heritage. + var constructor = prototypeProto.constructor; + if (typeof constructor !== "function") + return proto; + // If we have some kind of self-reference, then we cannot determine the heritage. + if (constructor === O) + return proto; + // we have a pretty good guess at the heritage. + return constructor; + } + // naive Map shim + function CreateMapPolyfill() { + var cacheSentinel = {}; + var arraySentinel = []; + var MapIterator = (function () { + function MapIterator(keys, values, selector) { + this._index = 0; + this._keys = keys; + this._values = values; + this._selector = selector; + } + MapIterator.prototype["@@iterator"] = function () { return this; }; + MapIterator.prototype[iteratorSymbol] = function () { return this; }; + MapIterator.prototype.next = function () { + var index = this._index; + if (index >= 0 && index < this._keys.length) { + var result = this._selector(this._keys[index], this._values[index]); + if (index + 1 >= this._keys.length) { + this._index = -1; + this._keys = arraySentinel; + this._values = arraySentinel; + } + else { + this._index++; + } + return { value: result, done: false }; + } + return { value: undefined, done: true }; + }; + MapIterator.prototype.throw = function (error) { + if (this._index >= 0) { + this._index = -1; + this._keys = arraySentinel; + this._values = arraySentinel; + } + throw error; + }; + MapIterator.prototype.return = function (value) { + if (this._index >= 0) { + this._index = -1; + this._keys = arraySentinel; + this._values = arraySentinel; + } + return { value: value, done: true }; + }; + return MapIterator; + }()); + return (function () { + function Map() { + this._keys = []; + this._values = []; + this._cacheKey = cacheSentinel; + this._cacheIndex = -2; + } + Object.defineProperty(Map.prototype, "size", { + get: function () { return this._keys.length; }, + enumerable: true, + configurable: true + }); + Map.prototype.has = function (key) { return this._find(key, /*insert*/ false) >= 0; }; + Map.prototype.get = function (key) { + var index = this._find(key, /*insert*/ false); + return index >= 0 ? this._values[index] : undefined; + }; + Map.prototype.set = function (key, value) { + var index = this._find(key, /*insert*/ true); + this._values[index] = value; + return this; + }; + Map.prototype.delete = function (key) { + var index = this._find(key, /*insert*/ false); + if (index >= 0) { + var size = this._keys.length; + for (var i = index + 1; i < size; i++) { + this._keys[i - 1] = this._keys[i]; + this._values[i - 1] = this._values[i]; + } + this._keys.length--; + this._values.length--; + if (key === this._cacheKey) { + this._cacheKey = cacheSentinel; + this._cacheIndex = -2; + } + return true; + } + return false; + }; + Map.prototype.clear = function () { + this._keys.length = 0; + this._values.length = 0; + this._cacheKey = cacheSentinel; + this._cacheIndex = -2; + }; + Map.prototype.keys = function () { return new MapIterator(this._keys, this._values, getKey); }; + Map.prototype.values = function () { return new MapIterator(this._keys, this._values, getValue); }; + Map.prototype.entries = function () { return new MapIterator(this._keys, this._values, getEntry); }; + Map.prototype["@@iterator"] = function () { return this.entries(); }; + Map.prototype[iteratorSymbol] = function () { return this.entries(); }; + Map.prototype._find = function (key, insert) { + if (this._cacheKey !== key) { + this._cacheIndex = this._keys.indexOf(this._cacheKey = key); + } + if (this._cacheIndex < 0 && insert) { + this._cacheIndex = this._keys.length; + this._keys.push(key); + this._values.push(undefined); + } + return this._cacheIndex; + }; + return Map; + }()); + function getKey(key, _) { + return key; + } + function getValue(_, value) { + return value; + } + function getEntry(key, value) { + return [key, value]; + } + } + // naive Set shim + function CreateSetPolyfill() { + return (function () { + function Set() { + this._map = new _Map(); + } + Object.defineProperty(Set.prototype, "size", { + get: function () { return this._map.size; }, + enumerable: true, + configurable: true + }); + Set.prototype.has = function (value) { return this._map.has(value); }; + Set.prototype.add = function (value) { return this._map.set(value, value), this; }; + Set.prototype.delete = function (value) { return this._map.delete(value); }; + Set.prototype.clear = function () { this._map.clear(); }; + Set.prototype.keys = function () { return this._map.keys(); }; + Set.prototype.values = function () { return this._map.values(); }; + Set.prototype.entries = function () { return this._map.entries(); }; + Set.prototype["@@iterator"] = function () { return this.keys(); }; + Set.prototype[iteratorSymbol] = function () { return this.keys(); }; + return Set; + }()); + } + // naive WeakMap shim + function CreateWeakMapPolyfill() { + var UUID_SIZE = 16; + var keys = HashMap.create(); + var rootKey = CreateUniqueKey(); + return (function () { + function WeakMap() { + this._key = CreateUniqueKey(); + } + WeakMap.prototype.has = function (target) { + var table = GetOrCreateWeakMapTable(target, /*create*/ false); + return table !== undefined ? HashMap.has(table, this._key) : false; + }; + WeakMap.prototype.get = function (target) { + var table = GetOrCreateWeakMapTable(target, /*create*/ false); + return table !== undefined ? HashMap.get(table, this._key) : undefined; + }; + WeakMap.prototype.set = function (target, value) { + var table = GetOrCreateWeakMapTable(target, /*create*/ true); + table[this._key] = value; + return this; + }; + WeakMap.prototype.delete = function (target) { + var table = GetOrCreateWeakMapTable(target, /*create*/ false); + return table !== undefined ? delete table[this._key] : false; + }; + WeakMap.prototype.clear = function () { + // NOTE: not a real clear, just makes the previous data unreachable + this._key = CreateUniqueKey(); + }; + return WeakMap; + }()); + function CreateUniqueKey() { + var key; + do + key = "@@WeakMap@@" + CreateUUID(); + while (HashMap.has(keys, key)); + keys[key] = true; + return key; + } + function GetOrCreateWeakMapTable(target, create) { + if (!hasOwn.call(target, rootKey)) { + if (!create) + return undefined; + Object.defineProperty(target, rootKey, { value: HashMap.create() }); + } + return target[rootKey]; + } + function FillRandomBytes(buffer, size) { + for (var i = 0; i < size; ++i) + buffer[i] = Math.random() * 0xff | 0; + return buffer; + } + function GenRandomBytes(size) { + if (typeof Uint8Array === "function") { + if (typeof crypto !== "undefined") + return crypto.getRandomValues(new Uint8Array(size)); + if (typeof msCrypto !== "undefined") + return msCrypto.getRandomValues(new Uint8Array(size)); + return FillRandomBytes(new Uint8Array(size), size); + } + return FillRandomBytes(new Array(size), size); + } + function CreateUUID() { + var data = GenRandomBytes(UUID_SIZE); + // mark as random - RFC 4122 § 4.4 + data[6] = data[6] & 0x4f | 0x40; + data[8] = data[8] & 0xbf | 0x80; + var result = ""; + for (var offset = 0; offset < UUID_SIZE; ++offset) { + var byte = data[offset]; + if (offset === 4 || offset === 6 || offset === 8) + result += "-"; + if (byte < 16) + result += "0"; + result += byte.toString(16).toLowerCase(); + } + return result; + } + } + // uses a heuristic used by v8 and chakra to force an object into dictionary mode. + function MakeDictionary(obj) { + obj.__ = undefined; + delete obj.__; + return obj; + } + // patch global Reflect + (function (__global) { + if (typeof __global.Reflect !== "undefined") { + if (__global.Reflect !== Reflect) { + for (var p in Reflect) { + if (hasOwn.call(Reflect, p)) { + __global.Reflect[p] = Reflect[p]; + } + } + } + } + else { + __global.Reflect = Reflect; + } + })(typeof global !== "undefined" ? global : + typeof self !== "undefined" ? self : + Function("return this;")()); +})(Reflect || (Reflect = {})); +//# sourceMappingURL=Reflect.js.map /***/ }), -/* 198 */ +/* 60 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -var Observable_1 = __webpack_require__(0); -var partition_1 = __webpack_require__(316); -Observable_1.Observable.prototype.partition = partition_1.partition; -//# sourceMappingURL=partition.js.map +var Observable_1 = __webpack_require__(2); +var first_1 = __webpack_require__(55); +Observable_1.Observable.prototype.first = first_1.first; +//# sourceMappingURL=first.js.map /***/ }), -/* 199 */ +/* 61 */ /***/ (function(module, exports, __webpack_require__) { -"use strict"; - -var Observable_1 = __webpack_require__(0); -var pluck_1 = __webpack_require__(317); -Observable_1.Observable.prototype.pluck = pluck_1.pluck; -//# sourceMappingURL=pluck.js.map +module.exports = (__webpack_require__(0))(48); /***/ }), -/* 200 */ +/* 62 */ /***/ (function(module, exports, __webpack_require__) { -"use strict"; - -var Observable_1 = __webpack_require__(0); -var publish_1 = __webpack_require__(318); -Observable_1.Observable.prototype.publish = publish_1.publish; -//# sourceMappingURL=publish.js.map +module.exports = (__webpack_require__(0))(54); /***/ }), -/* 201 */ +/* 63 */ /***/ (function(module, exports, __webpack_require__) { -"use strict"; - -var Observable_1 = __webpack_require__(0); -var publishBehavior_1 = __webpack_require__(319); -Observable_1.Observable.prototype.publishBehavior = publishBehavior_1.publishBehavior; -//# sourceMappingURL=publishBehavior.js.map +/** + * @license Angular v5.0.1 + * (c) 2010-2017 Google, Inc. https://angular.io/ + * License: MIT + */ +(function (global, factory) { + true ? factory(exports, __webpack_require__(4), __webpack_require__(53), __webpack_require__(51), __webpack_require__(26)) : + typeof define === 'function' && define.amd ? define('@angular/platform-browser/animations', ['exports', '@angular/core', '@angular/platform-browser', '@angular/animations', '@angular/animations/browser'], factory) : + (factory((global.ng = global.ng || {}, global.ng.platformBrowser = global.ng.platformBrowser || {}, global.ng.platformBrowser.animations = {}),global.ng.core,global.ng.platformBrowser,global.ng.animations,global.ng.animations.browser)); +}(this, (function (exports,_angular_core,_angular_platformBrowser,_angular_animations,_angular_animations_browser) { 'use strict'; -/***/ }), -/* 202 */ -/***/ (function(module, exports, __webpack_require__) { +/*! ***************************************************************************** +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 __()); +} -"use strict"; +/** + * @license Angular v5.0.1 + * (c) 2010-2017 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 + */ +var BrowserAnimationBuilder = (function (_super) { + __extends(BrowserAnimationBuilder, _super); + function BrowserAnimationBuilder(rootRenderer, doc) { + var _this = _super.call(this) || this; + _this._nextAnimationId = 0; + var /** @type {?} */ typeData = /** @type {?} */ ({ + id: '0', + encapsulation: _angular_core.ViewEncapsulation.None, + styles: [], + data: { animation: [] } + }); + _this._renderer = /** @type {?} */ (rootRenderer.createRenderer(doc.body, typeData)); + return _this; + } + /** + * @param {?} animation + * @return {?} + */ + BrowserAnimationBuilder.prototype.build = /** + * @param {?} animation + * @return {?} + */ + function (animation) { + var /** @type {?} */ id = this._nextAnimationId.toString(); + this._nextAnimationId++; + var /** @type {?} */ entry = Array.isArray(animation) ? _angular_animations.sequence(animation) : animation; + issueAnimationCommand(this._renderer, null, id, 'register', [entry]); + return new BrowserAnimationFactory(id, this._renderer); + }; + BrowserAnimationBuilder.decorators = [ + { type: _angular_core.Injectable }, + ]; + /** @nocollapse */ + BrowserAnimationBuilder.ctorParameters = function () { return [ + { type: _angular_core.RendererFactory2, }, + { type: undefined, decorators: [{ type: _angular_core.Inject, args: [_angular_platformBrowser.DOCUMENT,] },] }, + ]; }; + return BrowserAnimationBuilder; +}(_angular_animations.AnimationBuilder)); +var BrowserAnimationFactory = (function (_super) { + __extends(BrowserAnimationFactory, _super); + function BrowserAnimationFactory(_id, _renderer) { + var _this = _super.call(this) || this; + _this._id = _id; + _this._renderer = _renderer; + return _this; + } + /** + * @param {?} element + * @param {?=} options + * @return {?} + */ + BrowserAnimationFactory.prototype.create = /** + * @param {?} element + * @param {?=} options + * @return {?} + */ + function (element, options) { + return new RendererAnimationPlayer(this._id, element, options || {}, this._renderer); + }; + return BrowserAnimationFactory; +}(_angular_animations.AnimationFactory)); +var RendererAnimationPlayer = (function () { + function RendererAnimationPlayer(id, element, options, _renderer) { + this.id = id; + this.element = element; + this._renderer = _renderer; + this.parentPlayer = null; + this._started = false; + this.totalTime = 0; + this._command('create', options); + } + /** + * @param {?} eventName + * @param {?} callback + * @return {?} + */ + RendererAnimationPlayer.prototype._listen = /** + * @param {?} eventName + * @param {?} callback + * @return {?} + */ + function (eventName, callback) { + return this._renderer.listen(this.element, "@@" + this.id + ":" + eventName, callback); + }; + /** + * @param {?} command + * @param {...?} args + * @return {?} + */ + RendererAnimationPlayer.prototype._command = /** + * @param {?} command + * @param {...?} args + * @return {?} + */ + function (command) { + var args = []; + for (var _i = 1; _i < arguments.length; _i++) { + args[_i - 1] = arguments[_i]; + } + return issueAnimationCommand(this._renderer, this.element, this.id, command, args); + }; + /** + * @param {?} fn + * @return {?} + */ + RendererAnimationPlayer.prototype.onDone = /** + * @param {?} fn + * @return {?} + */ + function (fn) { this._listen('done', fn); }; + /** + * @param {?} fn + * @return {?} + */ + RendererAnimationPlayer.prototype.onStart = /** + * @param {?} fn + * @return {?} + */ + function (fn) { this._listen('start', fn); }; + /** + * @param {?} fn + * @return {?} + */ + RendererAnimationPlayer.prototype.onDestroy = /** + * @param {?} fn + * @return {?} + */ + function (fn) { this._listen('destroy', fn); }; + /** + * @return {?} + */ + RendererAnimationPlayer.prototype.init = /** + * @return {?} + */ + function () { this._command('init'); }; + /** + * @return {?} + */ + RendererAnimationPlayer.prototype.hasStarted = /** + * @return {?} + */ + function () { return this._started; }; + /** + * @return {?} + */ + RendererAnimationPlayer.prototype.play = /** + * @return {?} + */ + function () { + this._command('play'); + this._started = true; + }; + /** + * @return {?} + */ + RendererAnimationPlayer.prototype.pause = /** + * @return {?} + */ + function () { this._command('pause'); }; + /** + * @return {?} + */ + RendererAnimationPlayer.prototype.restart = /** + * @return {?} + */ + function () { this._command('restart'); }; + /** + * @return {?} + */ + RendererAnimationPlayer.prototype.finish = /** + * @return {?} + */ + function () { this._command('finish'); }; + /** + * @return {?} + */ + RendererAnimationPlayer.prototype.destroy = /** + * @return {?} + */ + function () { this._command('destroy'); }; + /** + * @return {?} + */ + RendererAnimationPlayer.prototype.reset = /** + * @return {?} + */ + function () { this._command('reset'); }; + /** + * @param {?} p + * @return {?} + */ + RendererAnimationPlayer.prototype.setPosition = /** + * @param {?} p + * @return {?} + */ + function (p) { this._command('setPosition', p); }; + /** + * @return {?} + */ + RendererAnimationPlayer.prototype.getPosition = /** + * @return {?} + */ + function () { return 0; }; + return RendererAnimationPlayer; +}()); +/** + * @param {?} renderer + * @param {?} element + * @param {?} id + * @param {?} command + * @param {?} args + * @return {?} + */ +function issueAnimationCommand(renderer, element, id, command, args) { + return renderer.setProperty(element, "@@" + id + ":" + command, args); +} -var Observable_1 = __webpack_require__(0); -var publishLast_1 = __webpack_require__(320); -Observable_1.Observable.prototype.publishLast = publishLast_1.publishLast; -//# sourceMappingURL=publishLast.js.map +/** + * @fileoverview added by tsickle + * @suppress {checkTypes} checked by tsc + */ +var ANIMATION_PREFIX = '@'; +var DISABLE_ANIMATIONS_FLAG = '@.disabled'; +var AnimationRendererFactory = (function () { + function AnimationRendererFactory(delegate, engine, _zone) { + this.delegate = delegate; + this.engine = engine; + this._zone = _zone; + this._currentId = 0; + this._microtaskId = 1; + this._animationCallbacksBuffer = []; + this._rendererCache = new Map(); + this._cdRecurDepth = 0; + engine.onRemovalComplete = function (element, delegate) { + // Note: if an component element has a leave animation, and the component + // a host leave animation, the view engine will call `removeChild` for the parent + // component renderer as well as for the child component renderer. + // Therefore, we need to check if we already removed the element. + if (delegate && delegate.parentNode(element)) { + delegate.removeChild(element.parentNode, element); + } + }; + } + /** + * @param {?} hostElement + * @param {?} type + * @return {?} + */ + AnimationRendererFactory.prototype.createRenderer = /** + * @param {?} hostElement + * @param {?} type + * @return {?} + */ + function (hostElement, type) { + var _this = this; + var /** @type {?} */ EMPTY_NAMESPACE_ID = ''; + // cache the delegates to find out which cached delegate can + // be used by which cached renderer + var /** @type {?} */ delegate = this.delegate.createRenderer(hostElement, type); + if (!hostElement || !type || !type.data || !type.data['animation']) { + var /** @type {?} */ renderer = this._rendererCache.get(delegate); + if (!renderer) { + renderer = new BaseAnimationRenderer(EMPTY_NAMESPACE_ID, delegate, this.engine); + // only cache this result when the base renderer is used + this._rendererCache.set(delegate, renderer); + } + return renderer; + } + var /** @type {?} */ componentId = type.id; + var /** @type {?} */ namespaceId = type.id + '-' + this._currentId; + this._currentId++; + this.engine.register(namespaceId, hostElement); + var /** @type {?} */ animationTriggers = /** @type {?} */ (type.data['animation']); + animationTriggers.forEach(function (trigger) { + return _this.engine.registerTrigger(componentId, namespaceId, hostElement, trigger.name, trigger); + }); + return new AnimationRenderer(this, namespaceId, delegate, this.engine); + }; + /** + * @return {?} + */ + AnimationRendererFactory.prototype.begin = /** + * @return {?} + */ + function () { + this._cdRecurDepth++; + if (this.delegate.begin) { + this.delegate.begin(); + } + }; + /** + * @return {?} + */ + AnimationRendererFactory.prototype._scheduleCountTask = /** + * @return {?} + */ + function () { + var _this = this; + Zone.current.scheduleMicroTask('incremenet the animation microtask', function () { return _this._microtaskId++; }); + }; + /* @internal */ + /** + * @param {?} count + * @param {?} fn + * @param {?} data + * @return {?} + */ + AnimationRendererFactory.prototype.scheduleListenerCallback = /** + * @param {?} count + * @param {?} fn + * @param {?} data + * @return {?} + */ + function (count, fn, data) { + var _this = this; + if (count >= 0 && count < this._microtaskId) { + this._zone.run(function () { return fn(data); }); + return; + } + if (this._animationCallbacksBuffer.length == 0) { + Promise.resolve(null).then(function () { + _this._zone.run(function () { + _this._animationCallbacksBuffer.forEach(function (tuple) { + var fn = tuple[0], data = tuple[1]; + fn(data); + }); + _this._animationCallbacksBuffer = []; + }); + }); + } + this._animationCallbacksBuffer.push([fn, data]); + }; + /** + * @return {?} + */ + AnimationRendererFactory.prototype.end = /** + * @return {?} + */ + function () { + var _this = this; + this._cdRecurDepth--; + // this is to prevent animations from running twice when an inner + // component does CD when a parent component insted has inserted it + if (this._cdRecurDepth == 0) { + this._zone.runOutsideAngular(function () { + _this._scheduleCountTask(); + _this.engine.flush(_this._microtaskId); + }); + } + if (this.delegate.end) { + this.delegate.end(); + } + }; + /** + * @return {?} + */ + AnimationRendererFactory.prototype.whenRenderingDone = /** + * @return {?} + */ + function () { return this.engine.whenRenderingDone(); }; + AnimationRendererFactory.decorators = [ + { type: _angular_core.Injectable }, + ]; + /** @nocollapse */ + AnimationRendererFactory.ctorParameters = function () { return [ + { type: _angular_core.RendererFactory2, }, + { type: _angular_animations_browser.ɵAnimationEngine, }, + { type: _angular_core.NgZone, }, + ]; }; + return AnimationRendererFactory; +}()); +var BaseAnimationRenderer = (function () { + function BaseAnimationRenderer(namespaceId, delegate, engine) { + this.namespaceId = namespaceId; + this.delegate = delegate; + this.engine = engine; + this.destroyNode = this.delegate.destroyNode ? function (n) { return /** @type {?} */ ((delegate.destroyNode))(n); } : null; + } + Object.defineProperty(BaseAnimationRenderer.prototype, "data", { + get: /** + * @return {?} + */ + function () { return this.delegate.data; }, + enumerable: true, + configurable: true + }); + /** + * @return {?} + */ + BaseAnimationRenderer.prototype.destroy = /** + * @return {?} + */ + function () { + this.engine.destroy(this.namespaceId, this.delegate); + this.delegate.destroy(); + }; + /** + * @param {?} name + * @param {?=} namespace + * @return {?} + */ + BaseAnimationRenderer.prototype.createElement = /** + * @param {?} name + * @param {?=} namespace + * @return {?} + */ + function (name, namespace) { + return this.delegate.createElement(name, namespace); + }; + /** + * @param {?} value + * @return {?} + */ + BaseAnimationRenderer.prototype.createComment = /** + * @param {?} value + * @return {?} + */ + function (value) { return this.delegate.createComment(value); }; + /** + * @param {?} value + * @return {?} + */ + BaseAnimationRenderer.prototype.createText = /** + * @param {?} value + * @return {?} + */ + function (value) { return this.delegate.createText(value); }; + /** + * @param {?} parent + * @param {?} newChild + * @return {?} + */ + BaseAnimationRenderer.prototype.appendChild = /** + * @param {?} parent + * @param {?} newChild + * @return {?} + */ + function (parent, newChild) { + this.delegate.appendChild(parent, newChild); + this.engine.onInsert(this.namespaceId, newChild, parent, false); + }; + /** + * @param {?} parent + * @param {?} newChild + * @param {?} refChild + * @return {?} + */ + BaseAnimationRenderer.prototype.insertBefore = /** + * @param {?} parent + * @param {?} newChild + * @param {?} refChild + * @return {?} + */ + function (parent, newChild, refChild) { + this.delegate.insertBefore(parent, newChild, refChild); + this.engine.onInsert(this.namespaceId, newChild, parent, true); + }; + /** + * @param {?} parent + * @param {?} oldChild + * @return {?} + */ + BaseAnimationRenderer.prototype.removeChild = /** + * @param {?} parent + * @param {?} oldChild + * @return {?} + */ + function (parent, oldChild) { + this.engine.onRemove(this.namespaceId, oldChild, this.delegate); + }; + /** + * @param {?} selectorOrNode + * @return {?} + */ + BaseAnimationRenderer.prototype.selectRootElement = /** + * @param {?} selectorOrNode + * @return {?} + */ + function (selectorOrNode) { return this.delegate.selectRootElement(selectorOrNode); }; + /** + * @param {?} node + * @return {?} + */ + BaseAnimationRenderer.prototype.parentNode = /** + * @param {?} node + * @return {?} + */ + function (node) { return this.delegate.parentNode(node); }; + /** + * @param {?} node + * @return {?} + */ + BaseAnimationRenderer.prototype.nextSibling = /** + * @param {?} node + * @return {?} + */ + function (node) { return this.delegate.nextSibling(node); }; + /** + * @param {?} el + * @param {?} name + * @param {?} value + * @param {?=} namespace + * @return {?} + */ + BaseAnimationRenderer.prototype.setAttribute = /** + * @param {?} el + * @param {?} name + * @param {?} value + * @param {?=} namespace + * @return {?} + */ + function (el, name, value, namespace) { + this.delegate.setAttribute(el, name, value, namespace); + }; + /** + * @param {?} el + * @param {?} name + * @param {?=} namespace + * @return {?} + */ + BaseAnimationRenderer.prototype.removeAttribute = /** + * @param {?} el + * @param {?} name + * @param {?=} namespace + * @return {?} + */ + function (el, name, namespace) { + this.delegate.removeAttribute(el, name, namespace); + }; + /** + * @param {?} el + * @param {?} name + * @return {?} + */ + BaseAnimationRenderer.prototype.addClass = /** + * @param {?} el + * @param {?} name + * @return {?} + */ + function (el, name) { this.delegate.addClass(el, name); }; + /** + * @param {?} el + * @param {?} name + * @return {?} + */ + BaseAnimationRenderer.prototype.removeClass = /** + * @param {?} el + * @param {?} name + * @return {?} + */ + function (el, name) { this.delegate.removeClass(el, name); }; + /** + * @param {?} el + * @param {?} style + * @param {?} value + * @param {?=} flags + * @return {?} + */ + BaseAnimationRenderer.prototype.setStyle = /** + * @param {?} el + * @param {?} style + * @param {?} value + * @param {?=} flags + * @return {?} + */ + function (el, style, value, flags) { + this.delegate.setStyle(el, style, value, flags); + }; + /** + * @param {?} el + * @param {?} style + * @param {?=} flags + * @return {?} + */ + BaseAnimationRenderer.prototype.removeStyle = /** + * @param {?} el + * @param {?} style + * @param {?=} flags + * @return {?} + */ + function (el, style, flags) { + this.delegate.removeStyle(el, style, flags); + }; + /** + * @param {?} el + * @param {?} name + * @param {?} value + * @return {?} + */ + BaseAnimationRenderer.prototype.setProperty = /** + * @param {?} el + * @param {?} name + * @param {?} value + * @return {?} + */ + function (el, name, value) { + if (name.charAt(0) == ANIMATION_PREFIX && name == DISABLE_ANIMATIONS_FLAG) { + this.disableAnimations(el, !!value); + } + else { + this.delegate.setProperty(el, name, value); + } + }; + /** + * @param {?} node + * @param {?} value + * @return {?} + */ + BaseAnimationRenderer.prototype.setValue = /** + * @param {?} node + * @param {?} value + * @return {?} + */ + function (node, value) { this.delegate.setValue(node, value); }; + /** + * @param {?} target + * @param {?} eventName + * @param {?} callback + * @return {?} + */ + BaseAnimationRenderer.prototype.listen = /** + * @param {?} target + * @param {?} eventName + * @param {?} callback + * @return {?} + */ + function (target, eventName, callback) { + return this.delegate.listen(target, eventName, callback); + }; + /** + * @param {?} element + * @param {?} value + * @return {?} + */ + BaseAnimationRenderer.prototype.disableAnimations = /** + * @param {?} element + * @param {?} value + * @return {?} + */ + function (element, value) { + this.engine.disableAnimations(element, value); + }; + return BaseAnimationRenderer; +}()); +var AnimationRenderer = (function (_super) { + __extends(AnimationRenderer, _super); + function AnimationRenderer(factory, namespaceId, delegate, engine) { + var _this = _super.call(this, namespaceId, delegate, engine) || this; + _this.factory = factory; + _this.namespaceId = namespaceId; + return _this; + } + /** + * @param {?} el + * @param {?} name + * @param {?} value + * @return {?} + */ + AnimationRenderer.prototype.setProperty = /** + * @param {?} el + * @param {?} name + * @param {?} value + * @return {?} + */ + function (el, name, value) { + if (name.charAt(0) == ANIMATION_PREFIX) { + if (name.charAt(1) == '.' && name == DISABLE_ANIMATIONS_FLAG) { + value = value === undefined ? true : !!value; + this.disableAnimations(el, /** @type {?} */ (value)); + } + else { + this.engine.process(this.namespaceId, el, name.substr(1), value); + } + } + else { + this.delegate.setProperty(el, name, value); + } + }; + /** + * @param {?} target + * @param {?} eventName + * @param {?} callback + * @return {?} + */ + AnimationRenderer.prototype.listen = /** + * @param {?} target + * @param {?} eventName + * @param {?} callback + * @return {?} + */ + function (target, eventName, callback) { + var _this = this; + if (eventName.charAt(0) == ANIMATION_PREFIX) { + var /** @type {?} */ element = resolveElementFromTarget(target); + var /** @type {?} */ name_1 = eventName.substr(1); + var /** @type {?} */ phase = ''; + // @listener.phase is for trigger animation callbacks + // @@listener is for animation builder callbacks + if (name_1.charAt(0) != ANIMATION_PREFIX) { + _a = parseTriggerCallbackName(name_1), name_1 = _a[0], phase = _a[1]; + } + return this.engine.listen(this.namespaceId, element, name_1, phase, function (event) { + var /** @type {?} */ countId = (/** @type {?} */ (event))['_data'] || -1; + _this.factory.scheduleListenerCallback(countId, callback, event); + }); + } + return this.delegate.listen(target, eventName, callback); + var _a; + }; + return AnimationRenderer; +}(BaseAnimationRenderer)); +/** + * @param {?} target + * @return {?} + */ +function resolveElementFromTarget(target) { + switch (target) { + case 'body': + return document.body; + case 'document': + return document; + case 'window': + return window; + default: + return target; + } +} +/** + * @param {?} triggerName + * @return {?} + */ +function parseTriggerCallbackName(triggerName) { + var /** @type {?} */ dotIndex = triggerName.indexOf('.'); + var /** @type {?} */ trigger = triggerName.substring(0, dotIndex); + var /** @type {?} */ phase = triggerName.substr(dotIndex + 1); + return [trigger, phase]; +} -/***/ }), -/* 203 */ -/***/ (function(module, exports, __webpack_require__) { +/** + * @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 InjectableAnimationEngine = (function (_super) { + __extends(InjectableAnimationEngine, _super); + function InjectableAnimationEngine(driver, normalizer) { + return _super.call(this, driver, normalizer) || this; + } + InjectableAnimationEngine.decorators = [ + { type: _angular_core.Injectable }, + ]; + /** @nocollapse */ + InjectableAnimationEngine.ctorParameters = function () { return [ + { type: _angular_animations_browser.AnimationDriver, }, + { type: _angular_animations_browser.ɵAnimationStyleNormalizer, }, + ]; }; + return InjectableAnimationEngine; +}(_angular_animations_browser.ɵAnimationEngine)); +/** + * @return {?} + */ +function instantiateSupportedAnimationDriver() { + if (_angular_animations_browser.ɵsupportsWebAnimations()) { + return new _angular_animations_browser.ɵWebAnimationsDriver(); + } + return new _angular_animations_browser.ɵNoopAnimationDriver(); +} +/** + * @return {?} + */ +function instantiateDefaultStyleNormalizer() { + return new _angular_animations_browser.ɵWebAnimationsStyleNormalizer(); +} +/** + * @param {?} renderer + * @param {?} engine + * @param {?} zone + * @return {?} + */ +function instantiateRendererFactory(renderer, engine, zone) { + return new AnimationRendererFactory(renderer, engine, zone); +} +var SHARED_ANIMATION_PROVIDERS = [ + { provide: _angular_animations.AnimationBuilder, useClass: BrowserAnimationBuilder }, + { provide: _angular_animations_browser.ɵAnimationStyleNormalizer, useFactory: instantiateDefaultStyleNormalizer }, + { provide: _angular_animations_browser.ɵAnimationEngine, useClass: InjectableAnimationEngine }, { + provide: _angular_core.RendererFactory2, + useFactory: instantiateRendererFactory, + deps: [_angular_platformBrowser.ɵDomRendererFactory2, _angular_animations_browser.ɵAnimationEngine, _angular_core.NgZone] + } +]; +/** + * Separate providers from the actual module so that we can do a local modification in Google3 to + * include them in the BrowserModule. + */ +var BROWSER_ANIMATIONS_PROVIDERS = [ + { provide: _angular_animations_browser.AnimationDriver, useFactory: instantiateSupportedAnimationDriver } +].concat(SHARED_ANIMATION_PROVIDERS); +/** + * Separate providers from the actual module so that we can do a local modification in Google3 to + * include them in the BrowserTestingModule. + */ +var BROWSER_NOOP_ANIMATIONS_PROVIDERS = [{ provide: _angular_animations_browser.AnimationDriver, useClass: _angular_animations_browser.ɵNoopAnimationDriver }].concat(SHARED_ANIMATION_PROVIDERS); -"use strict"; +/** + * @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 + */ +/** + * \@experimental Animation support is experimental. + */ +var BrowserAnimationsModule = (function () { + function BrowserAnimationsModule() { + } + BrowserAnimationsModule.decorators = [ + { type: _angular_core.NgModule, args: [{ + exports: [_angular_platformBrowser.BrowserModule], + providers: BROWSER_ANIMATIONS_PROVIDERS, + },] }, + ]; + /** @nocollapse */ + BrowserAnimationsModule.ctorParameters = function () { return []; }; + return BrowserAnimationsModule; +}()); +/** + * \@experimental Animation support is experimental. + */ +var NoopAnimationsModule = (function () { + function NoopAnimationsModule() { + } + NoopAnimationsModule.decorators = [ + { type: _angular_core.NgModule, args: [{ + exports: [_angular_platformBrowser.BrowserModule], + providers: BROWSER_NOOP_ANIMATIONS_PROVIDERS, + },] }, + ]; + /** @nocollapse */ + NoopAnimationsModule.ctorParameters = function () { return []; }; + return NoopAnimationsModule; +}()); -var Observable_1 = __webpack_require__(0); -var publishReplay_1 = __webpack_require__(321); -Observable_1.Observable.prototype.publishReplay = publishReplay_1.publishReplay; -//# sourceMappingURL=publishReplay.js.map +exports.BrowserAnimationsModule = BrowserAnimationsModule; +exports.NoopAnimationsModule = NoopAnimationsModule; +exports.ɵBrowserAnimationBuilder = BrowserAnimationBuilder; +exports.ɵBrowserAnimationFactory = BrowserAnimationFactory; +exports.ɵAnimationRenderer = AnimationRenderer; +exports.ɵAnimationRendererFactory = AnimationRendererFactory; +exports.ɵa = BaseAnimationRenderer; +exports.ɵf = BROWSER_ANIMATIONS_PROVIDERS; +exports.ɵg = BROWSER_NOOP_ANIMATIONS_PROVIDERS; +exports.ɵb = InjectableAnimationEngine; +exports.ɵd = instantiateDefaultStyleNormalizer; +exports.ɵe = instantiateRendererFactory; +exports.ɵc = instantiateSupportedAnimationDriver; -/***/ }), -/* 204 */ -/***/ (function(module, exports, __webpack_require__) { +Object.defineProperty(exports, '__esModule', { value: true }); -"use strict"; +}))); +//# sourceMappingURL=platform-browser-animations.umd.js.map -var Observable_1 = __webpack_require__(0); -var race_1 = __webpack_require__(64); -Observable_1.Observable.prototype.race = race_1.race; -//# sourceMappingURL=race.js.map /***/ }), -/* 205 */ -/***/ (function(module, exports, __webpack_require__) { +/* 64 */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return AppModuleShared; }); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__(4); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0__angular_core__); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__angular_common__ = __webpack_require__(5); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__angular_common___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1__angular_common__); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__angular_forms__ = __webpack_require__(129); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__angular_forms___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2__angular_forms__); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__angular_common_http__ = __webpack_require__(13); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__angular_common_http___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_3__angular_common_http__); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__angular_router__ = __webpack_require__(52); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__angular_router___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_4__angular_router__); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__components_app_app_component__ = __webpack_require__(28); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__components_navmenu_navmenu_component__ = __webpack_require__(68); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__components_home_home_component__ = __webpack_require__(67); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__components_fetchdata_fetchdata_component__ = __webpack_require__(66); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_9__components_counter_counter_component__ = __webpack_require__(65); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_10__components_unauthorized_unauthorized_component__ = __webpack_require__(69); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_11_angular_auth_oidc_client__ = __webpack_require__(27); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_11_angular_auth_oidc_client___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_11_angular_auth_oidc_client__); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_12__components_services_auth_service__ = __webpack_require__(14); +var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { + var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); + else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; + return c > 3 && r && Object.defineProperty(target, key, r), r; +}; + + + + + + + + + + + + + +var AppModuleShared = (function () { + function AppModuleShared() { + } + AppModuleShared = __decorate([ + __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_0__angular_core__["NgModule"])({ + declarations: [ + __WEBPACK_IMPORTED_MODULE_5__components_app_app_component__["a" /* AppComponent */], + __WEBPACK_IMPORTED_MODULE_6__components_navmenu_navmenu_component__["a" /* NavMenuComponent */], + __WEBPACK_IMPORTED_MODULE_9__components_counter_counter_component__["a" /* CounterComponent */], + __WEBPACK_IMPORTED_MODULE_8__components_fetchdata_fetchdata_component__["a" /* FetchDataComponent */], + __WEBPACK_IMPORTED_MODULE_7__components_home_home_component__["a" /* HomeComponent */], + __WEBPACK_IMPORTED_MODULE_10__components_unauthorized_unauthorized_component__["a" /* UnauthorizedComponent */] + ], + imports: [ + __WEBPACK_IMPORTED_MODULE_11_angular_auth_oidc_client__["AuthModule"].forRoot(), + __WEBPACK_IMPORTED_MODULE_1__angular_common__["CommonModule"], + __WEBPACK_IMPORTED_MODULE_3__angular_common_http__["HttpClientModule"], + __WEBPACK_IMPORTED_MODULE_2__angular_forms__["FormsModule"], + __WEBPACK_IMPORTED_MODULE_4__angular_router__["RouterModule"].forRoot([ + { path: '', redirectTo: 'home', pathMatch: 'full' }, + { path: 'home', component: __WEBPACK_IMPORTED_MODULE_7__components_home_home_component__["a" /* HomeComponent */] }, + { path: 'unauthorized', component: __WEBPACK_IMPORTED_MODULE_10__components_unauthorized_unauthorized_component__["a" /* UnauthorizedComponent */] }, + { path: 'counter', component: __WEBPACK_IMPORTED_MODULE_9__components_counter_counter_component__["a" /* CounterComponent */] }, + { path: 'fetch-data', component: __WEBPACK_IMPORTED_MODULE_8__components_fetchdata_fetchdata_component__["a" /* FetchDataComponent */] }, + { path: '**', redirectTo: 'home' } + ]) + ], + providers: [ + __WEBPACK_IMPORTED_MODULE_12__components_services_auth_service__["a" /* AuthService */], + __WEBPACK_IMPORTED_MODULE_11_angular_auth_oidc_client__["OidcSecurityService"] + ] + }) + ], AppModuleShared); + return AppModuleShared; +}()); + -var Observable_1 = __webpack_require__(0); -var reduce_1 = __webpack_require__(43); -Observable_1.Observable.prototype.reduce = reduce_1.reduce; -//# sourceMappingURL=reduce.js.map /***/ }), -/* 206 */ -/***/ (function(module, exports, __webpack_require__) { +/* 65 */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return CounterComponent; }); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__(4); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0__angular_core__); +var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { + var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); + else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; + return c > 3 && r && Object.defineProperty(target, key, r), r; +}; + +var CounterComponent = (function () { + function CounterComponent() { + this.currentCount = 0; + } + CounterComponent.prototype.incrementCounter = function () { + this.currentCount++; + }; + CounterComponent = __decorate([ + __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Component"])({ + selector: 'counter', + template: __webpack_require__(84) + }) + ], CounterComponent); + return CounterComponent; +}()); + -var Observable_1 = __webpack_require__(0); -var repeat_1 = __webpack_require__(322); -Observable_1.Observable.prototype.repeat = repeat_1.repeat; -//# sourceMappingURL=repeat.js.map /***/ }), -/* 207 */ -/***/ (function(module, exports, __webpack_require__) { +/* 66 */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return FetchDataComponent; }); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__(4); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0__angular_core__); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__services_auth_service__ = __webpack_require__(14); +var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { + var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); + else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; + return c > 3 && r && Object.defineProperty(target, key, r), r; +}; +var __metadata = (this && this.__metadata) || function (k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); +}; +var __param = (this && this.__param) || function (paramIndex, decorator) { + return function (target, key) { decorator(target, key, paramIndex); } +}; + + +var FetchDataComponent = (function () { + function FetchDataComponent(authService, apiUrl) { + var _this = this; + authService.get(apiUrl + 'SampleData/WeatherForecasts').subscribe(function (result) { + _this.forecasts = result; + }, function (error) { return console.error(error); }); + } + FetchDataComponent = __decorate([ + __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Component"])({ + selector: 'fetchdata', + template: __webpack_require__(85) + }), + __param(1, __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Inject"])('API_URL')), + __metadata("design:paramtypes", [__WEBPACK_IMPORTED_MODULE_1__services_auth_service__["a" /* AuthService */], String]) + ], FetchDataComponent); + return FetchDataComponent; +}()); + -var Observable_1 = __webpack_require__(0); -var repeatWhen_1 = __webpack_require__(323); -Observable_1.Observable.prototype.repeatWhen = repeatWhen_1.repeatWhen; -//# sourceMappingURL=repeatWhen.js.map /***/ }), -/* 208 */ -/***/ (function(module, exports, __webpack_require__) { +/* 67 */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return HomeComponent; }); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__(4); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0__angular_core__); +var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { + var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); + else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; + return c > 3 && r && Object.defineProperty(target, key, r), r; +}; + +var HomeComponent = (function () { + function HomeComponent() { + } + HomeComponent = __decorate([ + __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Component"])({ + selector: 'home', + template: __webpack_require__(86) + }) + ], HomeComponent); + return HomeComponent; +}()); + -var Observable_1 = __webpack_require__(0); -var retry_1 = __webpack_require__(324); -Observable_1.Observable.prototype.retry = retry_1.retry; -//# sourceMappingURL=retry.js.map /***/ }), -/* 209 */ -/***/ (function(module, exports, __webpack_require__) { +/* 68 */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return NavMenuComponent; }); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__(4); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0__angular_core__); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__services_auth_service__ = __webpack_require__(14); +var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { + var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); + else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; + return c > 3 && r && Object.defineProperty(target, key, r), r; +}; +var __metadata = (this && this.__metadata) || function (k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); +}; + + +var NavMenuComponent = (function () { + function NavMenuComponent(authService) { + this.authService = authService; + } + NavMenuComponent.prototype.ngOnInit = function () { + var _this = this; + this.isAuthorizedSubscription = this.authService.getIsAuthorized().subscribe(function (isAuthorized) { + _this.isAuthorized = isAuthorized; + }); + }; + NavMenuComponent.prototype.ngOnDestroy = function () { + this.isAuthorizedSubscription.unsubscribe(); + }; + NavMenuComponent.prototype.login = function () { + this.authService.login(); + }; + NavMenuComponent.prototype.refreshSession = function () { + this.authService.refreshSession(); + }; + NavMenuComponent.prototype.logout = function () { + this.authService.logout(); + }; + NavMenuComponent = __decorate([ + __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Component"])({ + selector: 'nav-menu', + template: __webpack_require__(87), + styles: [__webpack_require__(119)] + }), + __metadata("design:paramtypes", [__WEBPACK_IMPORTED_MODULE_1__services_auth_service__["a" /* AuthService */]]) + ], NavMenuComponent); + return NavMenuComponent; +}()); + -var Observable_1 = __webpack_require__(0); -var retryWhen_1 = __webpack_require__(325); -Observable_1.Observable.prototype.retryWhen = retryWhen_1.retryWhen; -//# sourceMappingURL=retryWhen.js.map /***/ }), -/* 210 */ -/***/ (function(module, exports, __webpack_require__) { +/* 69 */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return UnauthorizedComponent; }); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__(4); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0__angular_core__); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__angular_common__ = __webpack_require__(5); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__angular_common___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1__angular_common__); +var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { + var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); + else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; + return c > 3 && r && Object.defineProperty(target, key, r), r; +}; +var __metadata = (this && this.__metadata) || function (k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); +}; + + +var UnauthorizedComponent = (function () { + function UnauthorizedComponent(location) { + this.location = location; + } + UnauthorizedComponent.prototype.ngOnInit = function () { + }; + UnauthorizedComponent.prototype.login = function () { + //this.service.startSigninMainWindow(); + }; + UnauthorizedComponent.prototype.goback = function () { + this.location.back(); + }; + UnauthorizedComponent = __decorate([ + __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Component"])({ + selector: 'app-unauthorized', + template: __webpack_require__(88) + }), + __metadata("design:paramtypes", [__WEBPACK_IMPORTED_MODULE_1__angular_common__["Location"]]) + ], UnauthorizedComponent); + return UnauthorizedComponent; +}()); + -var Observable_1 = __webpack_require__(0); -var sample_1 = __webpack_require__(326); -Observable_1.Observable.prototype.sample = sample_1.sample; -//# sourceMappingURL=sample.js.map /***/ }), -/* 211 */ -/***/ (function(module, exports, __webpack_require__) { +/* 70 */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; +Object.defineProperty(__webpack_exports__, "__esModule", { value: true }); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_reflect_metadata__ = __webpack_require__(59); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_reflect_metadata___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_reflect_metadata__); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_zone_js__ = __webpack_require__(62); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_zone_js___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_zone_js__); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_rxjs_add_operator_first__ = __webpack_require__(60); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_rxjs_add_operator_first___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2_rxjs_add_operator_first__); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__angular_common__ = __webpack_require__(5); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__angular_common___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_3__angular_common__); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__angular_core__ = __webpack_require__(4); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__angular_core___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_4__angular_core__); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__angular_platform_server__ = __webpack_require__(25); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__angular_platform_server___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_5__angular_platform_server__); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6_aspnet_prerendering__ = __webpack_require__(61); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6_aspnet_prerendering___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_6_aspnet_prerendering__); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__app_app_module_server__ = __webpack_require__(58); + + + + + + + + +__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_4__angular_core__["enableProdMode"])(); +/* harmony default export */ __webpack_exports__["default"] = (__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_6_aspnet_prerendering__["createServerRenderer"])(function (params) { + var providers = [ + { provide: __WEBPACK_IMPORTED_MODULE_5__angular_platform_server__["INITIAL_CONFIG"], useValue: { document: '', url: params.url } }, + { provide: __WEBPACK_IMPORTED_MODULE_3__angular_common__["APP_BASE_HREF"], useValue: params.baseUrl }, + { provide: 'BASE_URL', useValue: params.origin + params.baseUrl }, + { provide: 'ORIGIN_URL', useValue: params.origin + params.baseUrl }, + { provide: 'API_URL', useValue: params.data.apiUrl }, + { provide: 'IDENTITY_URL', useValue: params.data.identityUrl }, + { provide: 'URL_CONFIG', useValue: params.data } + ]; + return __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_5__angular_platform_server__["platformDynamicServer"])(providers).bootstrapModule(__WEBPACK_IMPORTED_MODULE_7__app_app_module_server__["a" /* AppModule */]).then(function (moduleRef) { + var appRef = moduleRef.injector.get(__WEBPACK_IMPORTED_MODULE_4__angular_core__["ApplicationRef"]); + var state = moduleRef.injector.get(__WEBPACK_IMPORTED_MODULE_5__angular_platform_server__["PlatformState"]); + var zone = moduleRef.injector.get(__WEBPACK_IMPORTED_MODULE_4__angular_core__["NgZone"]); + return new Promise(function (resolve, reject) { + zone.onError.subscribe(function (errorInfo) { return reject(errorInfo); }); + appRef.isStable.first(function (isStable) { return isStable; }).subscribe(function () { + // Because 'onStable' fires before 'onError', we have to delay slightly before + // completing the request in case there's an error to report + setImmediate(function () { + resolve({ + html: state.renderToString(), + globals: { url_Config: params.data } + }); + moduleRef.destroy(); + }); + }); + }); + }); +})); -var Observable_1 = __webpack_require__(0); -var sampleTime_1 = __webpack_require__(327); -Observable_1.Observable.prototype.sampleTime = sampleTime_1.sampleTime; -//# sourceMappingURL=sampleTime.js.map /***/ }), -/* 212 */ +/* 71 */ /***/ (function(module, exports, __webpack_require__) { -"use strict"; +exports = module.exports = __webpack_require__(54)(undefined); +// imports -var Observable_1 = __webpack_require__(0); -var scan_1 = __webpack_require__(328); -Observable_1.Observable.prototype.scan = scan_1.scan; -//# sourceMappingURL=scan.js.map -/***/ }), -/* 213 */ -/***/ (function(module, exports, __webpack_require__) { +// module +exports.push([module.i, "@media (max-width: 767px) {\r\n /* On small screens, the nav menu spans the full width of the screen. Leave a space for it. */\r\n .body-content {\r\n padding-top: 50px;\r\n }\r\n}\r\n", ""]); -"use strict"; +// exports -var Observable_1 = __webpack_require__(0); -var sequenceEqual_1 = __webpack_require__(329); -Observable_1.Observable.prototype.sequenceEqual = sequenceEqual_1.sequenceEqual; -//# sourceMappingURL=sequenceEqual.js.map /***/ }), -/* 214 */ +/* 72 */ /***/ (function(module, exports, __webpack_require__) { -"use strict"; +exports = module.exports = __webpack_require__(54)(undefined); +// imports -var Observable_1 = __webpack_require__(0); -var share_1 = __webpack_require__(398); -Observable_1.Observable.prototype.share = share_1.share; -//# sourceMappingURL=share.js.map -/***/ }), -/* 215 */ -/***/ (function(module, exports, __webpack_require__) { +// module +exports.push([module.i, "li .glyphicon {\r\n margin-right: 10px;\r\n}\r\n\r\n/* Highlighting rules for nav menu items */\r\nli.link-active a,\r\nli.link-active a:hover,\r\nli.link-active a:focus {\r\n background-color: #4189C7;\r\n color: white;\r\n}\r\n\r\n/* Keep the nav menu independent of scrolling and on top of other items */\r\n.main-nav {\r\n position: fixed;\r\n top: 0;\r\n left: 0;\r\n right: 0;\r\n z-index: 1;\r\n}\r\n\r\n@media (min-width: 768px) {\r\n /* On small screens, convert the nav menu to a vertical sidebar */\r\n .main-nav {\r\n height: 100%;\r\n width: calc(25% - 20px);\r\n }\r\n .navbar {\r\n border-radius: 0px;\r\n border-width: 0px;\r\n height: 100%;\r\n }\r\n .navbar-header {\r\n float: none;\r\n }\r\n .navbar-collapse {\r\n border-top: 1px solid #444;\r\n padding: 0px;\r\n }\r\n .navbar ul {\r\n float: none;\r\n }\r\n .navbar li {\r\n float: none;\r\n font-size: 15px;\r\n margin: 6px;\r\n }\r\n .navbar li a {\r\n padding: 10px 16px;\r\n border-radius: 4px;\r\n }\r\n .navbar a {\r\n /* If a menu item's text is too long, truncate it */\r\n width: 100%;\r\n white-space: nowrap;\r\n overflow: hidden;\r\n text-overflow: ellipsis;\r\n }\r\n}\r\n", ""]); -"use strict"; +// exports -var Observable_1 = __webpack_require__(0); -var shareReplay_1 = __webpack_require__(330); -Observable_1.Observable.prototype.shareReplay = shareReplay_1.shareReplay; -//# sourceMappingURL=shareReplay.js.map /***/ }), -/* 216 */ +/* 73 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -var Observable_1 = __webpack_require__(0); -var single_1 = __webpack_require__(331); -Observable_1.Observable.prototype.single = single_1.single; -//# sourceMappingURL=single.js.map +module.exports = CustomEvent; -/***/ }), -/* 217 */ -/***/ (function(module, exports, __webpack_require__) { +var Event = __webpack_require__(7); -"use strict"; +function CustomEvent(type, dictionary) { + // Just use the superclass constructor to initialize + Event.call(this, type, dictionary); +} +CustomEvent.prototype = Object.create(Event.prototype, { + constructor: { value: CustomEvent } +}); -var Observable_1 = __webpack_require__(0); -var skip_1 = __webpack_require__(332); -Observable_1.Observable.prototype.skip = skip_1.skip; -//# sourceMappingURL=skip.js.map /***/ }), -/* 218 */ +/* 74 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -var Observable_1 = __webpack_require__(0); -var skipLast_1 = __webpack_require__(333); -Observable_1.Observable.prototype.skipLast = skipLast_1.skipLast; -//# sourceMappingURL=skipLast.js.map +module.exports = FilteredElementList; -/***/ }), -/* 219 */ -/***/ (function(module, exports, __webpack_require__) { +var Node = __webpack_require__(3); -"use strict"; +// +// This file defines node list implementation that lazily traverses +// the document tree (or a subtree rooted at any element) and includes +// only those elements for which a specified filter function returns true. +// It is used to implement the +// {Document,Element}.getElementsBy{TagName,ClassName}{,NS} methods. +// -var Observable_1 = __webpack_require__(0); -var skipUntil_1 = __webpack_require__(334); -Observable_1.Observable.prototype.skipUntil = skipUntil_1.skipUntil; -//# sourceMappingURL=skipUntil.js.map +function FilteredElementList(root, filter) { + this.root = root; + this.filter = filter; + this.lastModTime = root.lastModTime; + this.done = false; + this.cache = []; + this.traverse(); +} -/***/ }), -/* 220 */ -/***/ (function(module, exports, __webpack_require__) { +FilteredElementList.prototype = { + get length() { + this.checkcache(); + if (!this.done) this.traverse(); + return this.cache.length; + }, -"use strict"; + item: function(n) { + this.checkcache(); + if (!this.done && n >= this.cache.length) this.traverse(n); + return this.cache[n]; + }, -var Observable_1 = __webpack_require__(0); -var skipWhile_1 = __webpack_require__(335); -Observable_1.Observable.prototype.skipWhile = skipWhile_1.skipWhile; -//# sourceMappingURL=skipWhile.js.map + checkcache: function() { + if (this.lastModTime !== this.root.lastModTime) { + // subtree has changed, so invalidate cache + for (var i = this.cache.length-1; i>=0; i--) { + this[i] = undefined; + } + this.cache.length = 0; + this.done = false; + this.lastModTime = this.root.lastModTime; + } + }, + + // If n is specified, then traverse the tree until we've found the nth + // item (or until we've found all items). If n is not specified, + // traverse until we've found all items. + traverse: function(n) { + // increment n so we can compare to length, and so it is never falsy + if (n !== undefined) n++; + + var elt; + while ((elt = this.next()) !== null) { + this[this.cache.length] = elt; //XXX Use proxy instead + this.cache.push(elt); + if (n && this.cache.length === n) return; + } + + // no next element, so we've found everything + this.done = true; + }, + + // Return the next element under root that matches filter + next: function() { + var start = (this.cache.length === 0) ? this.root // Start at the root or at + : this.cache[this.cache.length-1]; // the last element we found + + var elt; + if (start.nodeType === Node.DOCUMENT_NODE) + elt = start.documentElement; + else + elt = start.nextElement(this.root); -/***/ }), -/* 221 */ -/***/ (function(module, exports, __webpack_require__) { + while(elt) { + if (this.filter(elt)) { + return elt; + } -"use strict"; + elt = elt.nextElement(this.root); + } + return null; + } +}; -var Observable_1 = __webpack_require__(0); -var startWith_1 = __webpack_require__(336); -Observable_1.Observable.prototype.startWith = startWith_1.startWith; -//# sourceMappingURL=startWith.js.map /***/ }), -/* 222 */ +/* 75 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -var Observable_1 = __webpack_require__(0); -var subscribeOn_1 = __webpack_require__(337); -Observable_1.Observable.prototype.subscribeOn = subscribeOn_1.subscribeOn; -//# sourceMappingURL=subscribeOn.js.map +var URL = __webpack_require__(20); +var URLUtils = __webpack_require__(41); -/***/ }), -/* 223 */ -/***/ (function(module, exports, __webpack_require__) { +module.exports = Location; -"use strict"; +function Location(window, href) { + this._window = window; + this._href = href; +} -var Observable_1 = __webpack_require__(0); -var switch_1 = __webpack_require__(338); -Observable_1.Observable.prototype.switch = switch_1._switch; -Observable_1.Observable.prototype._switch = switch_1._switch; -//# sourceMappingURL=switch.js.map +Location.prototype = Object.create(URLUtils.prototype, { + constructor: { value: Location }, -/***/ }), -/* 224 */ -/***/ (function(module, exports, __webpack_require__) { + // Special behavior when href is set + href: { + get: function() { return this._href; }, + set: function(v) { this.assign(v); } + }, -"use strict"; + assign: { value: function(url) { + // Resolve the new url against the current one + // XXX: + // This is not actually correct. It should be resolved against + // the URL of the document of the script. For now, though, I only + // support a single window and there is only one base url. + // So this is good enough for now. + var current = new URL(this._href); + var newurl = current.resolve(url); -var Observable_1 = __webpack_require__(0); -var switchMap_1 = __webpack_require__(339); -Observable_1.Observable.prototype.switchMap = switchMap_1.switchMap; -//# sourceMappingURL=switchMap.js.map + // Save the new url + this._href = newurl; -/***/ }), -/* 225 */ -/***/ (function(module, exports, __webpack_require__) { + // Start loading the new document! + // XXX + // This is just something hacked together. + // The real algorithm is: http://www.whatwg.org/specs/web-apps/current-work/multipage/history.html#navigate + }}, -"use strict"; + replace: { value: function(url) { + // XXX + // Since we aren't tracking history yet, replace is the same as assign + this.assign(url); + }}, -var Observable_1 = __webpack_require__(0); -var switchMapTo_1 = __webpack_require__(340); -Observable_1.Observable.prototype.switchMapTo = switchMapTo_1.switchMapTo; -//# sourceMappingURL=switchMapTo.js.map + reload: { value: function() { + // XXX: + // Actually, the spec is a lot more complicated than this + this.assign(this.href); + }}, -/***/ }), -/* 226 */ -/***/ (function(module, exports, __webpack_require__) { + toString: { value: function() { + return this.href; + }} -"use strict"; +}); -var Observable_1 = __webpack_require__(0); -var take_1 = __webpack_require__(341); -Observable_1.Observable.prototype.take = take_1.take; -//# sourceMappingURL=take.js.map /***/ }), -/* 227 */ +/* 76 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -var Observable_1 = __webpack_require__(0); -var takeLast_1 = __webpack_require__(342); -Observable_1.Observable.prototype.takeLast = takeLast_1.takeLast; -//# sourceMappingURL=takeLast.js.map +module.exports = { + VALUE: 1, // The value of a Text, Comment or PI node changed + ATTR: 2, // A new attribute was added or an attribute value and/or prefix changed + REMOVE_ATTR: 3, // An attribute was removed + REMOVE: 4, // A node was removed + MOVE: 5, // A node was moved + INSERT: 6 // A node (or a subtree of nodes) was inserted +}; /***/ }), -/* 228 */ +/* 77 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -var Observable_1 = __webpack_require__(0); -var takeUntil_1 = __webpack_require__(343); -Observable_1.Observable.prototype.takeUntil = takeUntil_1.takeUntil; -//# sourceMappingURL=takeUntil.js.map -/***/ }), -/* 229 */ -/***/ (function(module, exports, __webpack_require__) { +// https://html.spec.whatwg.org/multipage/webappapis.html#navigatorid +var NavigatorID = Object.create(null, { + appCodeName: { value: "Mozilla" }, + appName: { value: "Netscape" }, + appVersion: { value: "4.0" }, + platform: { value: "" }, + product: { value: "Gecko" }, + productSub: { value: "20100101" }, + userAgent: { value: "" }, + vendor: { value: "" }, + vendorSub: { value: "" }, + taintEnabled: { value: function() { return false; } } +}); -"use strict"; +module.exports = NavigatorID; -var Observable_1 = __webpack_require__(0); -var takeWhile_1 = __webpack_require__(344); -Observable_1.Observable.prototype.takeWhile = takeWhile_1.takeWhile; -//# sourceMappingURL=takeWhile.js.map /***/ }), -/* 230 */ +/* 78 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -var Observable_1 = __webpack_require__(0); -var throttle_1 = __webpack_require__(65); -Observable_1.Observable.prototype.throttle = throttle_1.throttle; -//# sourceMappingURL=throttle.js.map +module.exports = NodeIterator; -/***/ }), -/* 231 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; +var NodeFilter = __webpack_require__(10); +var NodeTraversal = __webpack_require__(36); -var Observable_1 = __webpack_require__(0); -var throttleTime_1 = __webpack_require__(345); -Observable_1.Observable.prototype.throttleTime = throttleTime_1.throttleTime; -//# sourceMappingURL=throttleTime.js.map +/* Private methods and helpers */ -/***/ }), -/* 232 */ -/***/ (function(module, exports, __webpack_require__) { +/** + * @based on WebKit's NodeIterator::moveToNext and NodeIterator::moveToPrevious + * https://trac.webkit.org/browser/trunk/Source/WebCore/dom/NodeIterator.cpp?rev=186279#L51 + */ +function move(node, stayWithin, directionIsNext) { + if (directionIsNext) { + return NodeTraversal.next(node, stayWithin); + } else { + if (node === stayWithin) { + return null; + } + return NodeTraversal.previous(node, null); + } +} -"use strict"; +/** + * @spec http://www.w3.org/TR/dom/#concept-nodeiterator-traverse + * @method + * @access private + * @param {NodeIterator} ni + * @param {string} direction One of 'next' or 'previous'. + * @return {Node|null} + */ +function traverse(ni, directionIsNext) { + var node, beforeNode; + node = ni.referenceNode; + beforeNode = ni.pointerBeforeReferenceNode; + while (true) { + if (beforeNode === directionIsNext) { + beforeNode = !beforeNode; + } else { + node = move(node, ni.root, directionIsNext); + if (node === null) { + return null; + } + } + var result = ni.filter.acceptNode(node); + if (result === NodeFilter.FILTER_ACCEPT) { + break; + } + } + ni.referenceNode = node; + ni.pointerBeforeReferenceNode = beforeNode; + return node; +} -var Observable_1 = __webpack_require__(0); -var timeInterval_1 = __webpack_require__(66); -Observable_1.Observable.prototype.timeInterval = timeInterval_1.timeInterval; -//# sourceMappingURL=timeInterval.js.map +/* Public API */ -/***/ }), -/* 233 */ -/***/ (function(module, exports, __webpack_require__) { +/** + * Implemented version: http://www.w3.org/TR/2015/WD-dom-20150618/#nodeiterator + * Latest version: http://www.w3.org/TR/dom/#nodeiterator + * + * @constructor + * @param {Node} root + * @param {number} whatToShow [optional] + * @param {Function|NodeFilter} filter [optional] + * @throws Error + */ +function NodeIterator(root, whatToShow, filter) { + var ni = this, active = false; -"use strict"; + if (!root || !root.nodeType) { + throw new Error('DOMException: NOT_SUPPORTED_ERR'); + } -var Observable_1 = __webpack_require__(0); -var timeout_1 = __webpack_require__(346); -Observable_1.Observable.prototype.timeout = timeout_1.timeout; -//# sourceMappingURL=timeout.js.map + ni.root = ni.referenceNode = root; + ni.pointerBeforeReferenceNode = true; + ni.whatToShow = Number(whatToShow) || 0; -/***/ }), -/* 234 */ -/***/ (function(module, exports, __webpack_require__) { + if (typeof filter !== 'function') { + filter = null; + } -"use strict"; + ni.filter = Object.create(NodeFilter.prototype); -var Observable_1 = __webpack_require__(0); -var timeoutWith_1 = __webpack_require__(347); -Observable_1.Observable.prototype.timeoutWith = timeoutWith_1.timeoutWith; -//# sourceMappingURL=timeoutWith.js.map + /** + * @method + * @param {Node} node + * @return {Number} Constant NodeFilter.FILTER_ACCEPT, + * NodeFilter.FILTER_REJECT or NodeFilter.FILTER_SKIP. + */ + ni.filter.acceptNode = function (node) { + /* jshint bitwise: false */ + var result; + if (active) { + throw new Error('DOMException: INVALID_STATE_ERR'); + } -/***/ }), -/* 235 */ -/***/ (function(module, exports, __webpack_require__) { + // Maps nodeType to whatToShow + if (!(((1 << (node.nodeType - 1)) & ni.whatToShow))) { + return NodeFilter.FILTER_SKIP; + } -"use strict"; + if (filter === null) { + return NodeFilter.FILTER_ACCEPT; + } -var Observable_1 = __webpack_require__(0); -var timestamp_1 = __webpack_require__(67); -Observable_1.Observable.prototype.timestamp = timestamp_1.timestamp; -//# sourceMappingURL=timestamp.js.map + active = true; + result = filter(node); + active = false; -/***/ }), -/* 236 */ -/***/ (function(module, exports, __webpack_require__) { + return result; + }; +} -"use strict"; +NodeIterator.prototype = { + constructor: NodeIterator, -var Observable_1 = __webpack_require__(0); -var toArray_1 = __webpack_require__(348); -Observable_1.Observable.prototype.toArray = toArray_1.toArray; -//# sourceMappingURL=toArray.js.map + /** + * @spec http://www.w3.org/TR/dom/#dom-nodeiterator-nextnode + * @method + * @return {Node|null} + */ + nextNode: function () { + return traverse(this, true); + }, -/***/ }), -/* 237 */ -/***/ (function(module, exports, __webpack_require__) { + /** + * @spec http://www.w3.org/TR/dom/#dom-nodeiterator-previousnode + * @method + * @return {Node|null} + */ + previousNode: function () { + return traverse(this, false); + }, -"use strict"; + /** + * @spec http://www.w3.org/TR/dom/#dom-nodeiterator-detach + * @method + * @return void + */ + detach: function() { + /* "The detach() method must do nothing. + * Its functionality (disabling a NodeIterator object) was removed, + * but the method itself is preserved for compatibility. + */ + } +}; -var Observable_1 = __webpack_require__(0); -var toPromise_1 = __webpack_require__(68); -Observable_1.Observable.prototype.toPromise = toPromise_1.toPromise; -//# sourceMappingURL=toPromise.js.map /***/ }), -/* 238 */ +/* 79 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -var Observable_1 = __webpack_require__(0); -var window_1 = __webpack_require__(349); -Observable_1.Observable.prototype.window = window_1.window; -//# sourceMappingURL=window.js.map - -/***/ }), -/* 239 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; +module.exports = TreeWalker; -var Observable_1 = __webpack_require__(0); -var windowCount_1 = __webpack_require__(350); -Observable_1.Observable.prototype.windowCount = windowCount_1.windowCount; -//# sourceMappingURL=windowCount.js.map +var NodeFilter = __webpack_require__(10); +var NodeTraversal = __webpack_require__(36); -/***/ }), -/* 240 */ -/***/ (function(module, exports, __webpack_require__) { +var mapChild = { + first: 'firstChild', + last: 'lastChild', + next: 'firstChild', + previous: 'lastChild' +}; -"use strict"; +var mapSibling = { + first: 'nextSibling', + last: 'previousSibling', + next: 'nextSibling', + previous: 'previousSibling' +}; -var Observable_1 = __webpack_require__(0); -var windowTime_1 = __webpack_require__(351); -Observable_1.Observable.prototype.windowTime = windowTime_1.windowTime; -//# sourceMappingURL=windowTime.js.map +/* Private methods and helpers */ -/***/ }), -/* 241 */ -/***/ (function(module, exports, __webpack_require__) { +/** + * @spec http://www.w3.org/TR/dom/#concept-traverse-children + * @method + * @access private + * @param {TreeWalker} tw + * @param {string} type One of 'first' or 'last'. + * @return {Node|null} + */ +function traverseChildren(tw, type) { + var child, node, parent, result, sibling; + node = tw.currentNode[mapChild[type]]; + while (node !== null) { + result = tw.filter.acceptNode(node); + if (result === NodeFilter.FILTER_ACCEPT) { + tw.currentNode = node; + return node; + } + if (result === NodeFilter.FILTER_SKIP) { + child = node[mapChild[type]]; + if (child !== null) { + node = child; + continue; + } + } + while (node !== null) { + sibling = node[mapSibling[type]]; + if (sibling !== null) { + node = sibling; + break; + } + parent = node.parentNode; + if (parent === null || parent === tw.root || parent === tw.currentNode) { + return null; + } + else { + node = parent; + } + } + } + return null; +} -"use strict"; +/** + * @spec http://www.w3.org/TR/dom/#concept-traverse-siblings + * @method + * @access private + * @param {TreeWalker} tw + * @param {TreeWalker} type One of 'next' or 'previous'. + * @return {Node|nul} + */ +function traverseSiblings(tw, type) { + var node, result, sibling; + node = tw.currentNode; + if (node === tw.root) { + return null; + } + while (true) { + sibling = node[mapSibling[type]]; + while (sibling !== null) { + node = sibling; + result = tw.filter.acceptNode(node); + if (result === NodeFilter.FILTER_ACCEPT) { + tw.currentNode = node; + return node; + } + sibling = node[mapChild[type]]; + if (result === NodeFilter.FILTER_REJECT || sibling === null) { + sibling = node[mapSibling[type]]; + } + } + node = node.parentNode; + if (node === null || node === tw.root) { + return null; + } + if (tw.filter.acceptNode(node) === NodeFilter.FILTER_ACCEPT) { + return null; + } + } +} -var Observable_1 = __webpack_require__(0); -var windowToggle_1 = __webpack_require__(352); -Observable_1.Observable.prototype.windowToggle = windowToggle_1.windowToggle; -//# sourceMappingURL=windowToggle.js.map -/***/ }), -/* 242 */ -/***/ (function(module, exports, __webpack_require__) { +/* Public API */ -"use strict"; +/** + * Implemented version: http://www.w3.org/TR/2015/WD-dom-20150618/#interface-treewalker + * Latest version: http://www.w3.org/TR/dom/#interface-treewalker + * + * @constructor + * @param {Node} root + * @param {number} whatToShow [optional] + * @param {Function|NodeFilter} filter [optional] + * @throws Error + */ +function TreeWalker(root, whatToShow, filter) { + var tw = this, active = false; -var Observable_1 = __webpack_require__(0); -var windowWhen_1 = __webpack_require__(353); -Observable_1.Observable.prototype.windowWhen = windowWhen_1.windowWhen; -//# sourceMappingURL=windowWhen.js.map + if (!root || !root.nodeType) { + throw new Error('DOMException: NOT_SUPPORTED_ERR'); + } -/***/ }), -/* 243 */ -/***/ (function(module, exports, __webpack_require__) { + tw.root = root; + tw.whatToShow = Number(whatToShow) || 0; -"use strict"; + tw.currentNode = root; -var Observable_1 = __webpack_require__(0); -var withLatestFrom_1 = __webpack_require__(354); -Observable_1.Observable.prototype.withLatestFrom = withLatestFrom_1.withLatestFrom; -//# sourceMappingURL=withLatestFrom.js.map + if (typeof filter !== 'function') { + filter = null; + } -/***/ }), -/* 244 */ -/***/ (function(module, exports, __webpack_require__) { + tw.filter = Object.create(NodeFilter.prototype); -"use strict"; + /** + * @method + * @param {Node} node + * @return {Number} Constant NodeFilter.FILTER_ACCEPT, + * NodeFilter.FILTER_REJECT or NodeFilter.FILTER_SKIP. + */ + tw.filter.acceptNode = function (node) { + /* jshint bitwise: false */ + var result; + if (active) { + throw new Error('DOMException: INVALID_STATE_ERR'); + } -var Observable_1 = __webpack_require__(0); -var zip_1 = __webpack_require__(39); -Observable_1.Observable.prototype.zip = zip_1.zipProto; -//# sourceMappingURL=zip.js.map + // Maps nodeType to whatToShow + if (!(((1 << (node.nodeType - 1)) & tw.whatToShow))) { + return NodeFilter.FILTER_SKIP; + } -/***/ }), -/* 245 */ -/***/ (function(module, exports, __webpack_require__) { + if (filter === null) { + return NodeFilter.FILTER_ACCEPT; + } -"use strict"; + active = true; + result = filter(node); + active = false; -var Observable_1 = __webpack_require__(0); -var zipAll_1 = __webpack_require__(355); -Observable_1.Observable.prototype.zipAll = zipAll_1.zipAll; -//# sourceMappingURL=zipAll.js.map + return result; + }; +} -/***/ }), -/* 246 */ -/***/ (function(module, exports, __webpack_require__) { +TreeWalker.prototype = { -"use strict"; + constructor: TreeWalker, -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; -var Observable_1 = __webpack_require__(0); -var tryCatch_1 = __webpack_require__(7); -var errorObject_1 = __webpack_require__(5); -var AsyncSubject_1 = __webpack_require__(25); -/** - * We need this JSDoc comment for affecting ESDoc. - * @extends {Ignored} - * @hide true - */ -var BoundCallbackObservable = (function (_super) { - __extends(BoundCallbackObservable, _super); - function BoundCallbackObservable(callbackFunc, selector, args, context, scheduler) { - _super.call(this); - this.callbackFunc = callbackFunc; - this.selector = selector; - this.args = args; - this.context = context; - this.scheduler = scheduler; + /** + * @spec http://www.w3.org/TR/dom/#dom-treewalker-parentnode + * @method + * @return {Node|null} + */ + parentNode: function () { + var node = this.currentNode; + while (node !== null && node !== this.root) { + node = node.parentNode; + if (node !== null && this.filter.acceptNode(node) === NodeFilter.FILTER_ACCEPT) { + this.currentNode = node; + return node; + } } - /* tslint:enable:max-line-length */ - /** - * Converts a callback API to a function that returns an Observable. - * - * Give it a function `f` of type `f(x, callback)` and - * it will return a function `g` that when called as `g(x)` will output an - * Observable. - * - * `bindCallback` is not an operator because its input and output are not - * Observables. The input is a function `func` with some parameters, but the - * last parameter must be a callback function that `func` calls when it is - * done. - * - * The output of `bindCallback` is a function that takes the same parameters - * as `func`, except the last one (the callback). When the output function - * is called with arguments, it will return an Observable. If `func` function - * calls its callback with one argument, the Observable will emit that value. - * If on the other hand callback is called with multiple values, resulting - * Observable will emit an array with these arguments. - * - * It is very important to remember, that input function `func` is not called - * when output function is, but rather when Observable returned by output - * function is subscribed. This means if `func` makes AJAX request, that request - * will be made every time someone subscribes to resulting Observable, but not before. - * - * Optionally, selector function can be passed to `bindObservable`. That function - * takes the same arguments as callback, and returns value - * that will be emitted by Observable instead of callback parameters themselves. - * Even though by default multiple arguments passed to callback appear in the stream as array, - * selector function will be called with arguments directly, just as callback would. - * This means you can imagine default selector (when one is not provided explicitly) - * as function that aggregates all its arguments into array, or simply returns first argument, - * if there is only one. - * - * Last optional parameter - {@link Scheduler} - can be used to control when call - * to `func` happens after someone subscribes to Observable, as well as when results - * passed to callback will be emitted. By default subscription to Observable calls `func` - * synchronously, but using `Scheduler.async` as last parameter will defer call to input function, - * just like wrapping that call in `setTimeout` with time `0` would. So if you use async Scheduler - * and call `subscribe` on output Observable, all function calls that are currently executing, - * will end before `func` is invoked. - * - * When it comes to emitting results passed to callback, by default they are emitted - * immediately after `func` invokes callback. In particular, if callback is called synchronously, - * then subscription to resulting Observable will call `next` function synchronously as well. - * If you want to defer that call, using `Scheduler.async` will, again, do the job. - * This means that by using `Scheduler.async` you can, in a sense, ensure that `func` - * always calls its callback asynchronously, thus avoiding terrifying Zalgo. - * - * Note that Observable created by output function will always emit only one value - * and then complete right after. Even if `func` calls callback multiple times, values from - * second and following calls will never appear in the stream. If you need to - * listen for multiple calls, you probably want to use {@link fromEvent} or - * {@link fromEventPattern} instead. - * - * If `func` depends on some context (`this` property), that context will be set - * to the same context that output function has at call time. In particular, if `func` - * is called as method of some object, in order to preserve proper behaviour, - * it is recommended to set context of output function to that object as well, - * provided `func` is not already bound. - * - * If input function calls its callback in "node style" (i.e. first argument to callback is - * optional error parameter signaling whether call failed or not), {@link bindNodeCallback} - * provides convenient error handling and probably is a better choice. - * `bindCallback` will treat such functions without any difference and error parameter - * (whether passed or not) will always be interpreted as regular callback argument. - * - * - * @example Convert jQuery's getJSON to an Observable API - * // Suppose we have jQuery.getJSON('/my/url', callback) - * var getJSONAsObservable = Rx.Observable.bindCallback(jQuery.getJSON); - * var result = getJSONAsObservable('/my/url'); - * result.subscribe(x => console.log(x), e => console.error(e)); - * - * - * @example Receive array of arguments passed to callback - * someFunction((a, b, c) => { - * console.log(a); // 5 - * console.log(b); // 'some string' - * console.log(c); // {someProperty: 'someValue'} - * }); - * - * const boundSomeFunction = Rx.Observable.bindCallback(someFunction); - * boundSomeFunction().subscribe(values => { - * console.log(values) // [5, 'some string', {someProperty: 'someValue'}] - * }); - * - * - * @example Use bindCallback with selector function - * someFunction((a, b, c) => { - * console.log(a); // 'a' - * console.log(b); // 'b' - * console.log(c); // 'c' - * }); - * - * const boundSomeFunction = Rx.Observable.bindCallback(someFunction, (a, b, c) => a + b + c); - * boundSomeFunction().subscribe(value => { - * console.log(value) // 'abc' - * }); - * - * - * @example Compare behaviour with and without async Scheduler - * function iCallMyCallbackSynchronously(cb) { - * cb(); - * } - * - * const boundSyncFn = Rx.Observable.bindCallback(iCallMyCallbackSynchronously); - * const boundAsyncFn = Rx.Observable.bindCallback(iCallMyCallbackSynchronously, null, Rx.Scheduler.async); - * - * boundSyncFn().subscribe(() => console.log('I was sync!')); - * boundAsyncFn().subscribe(() => console.log('I was async!')); - * console.log('This happened...'); - * - * // Logs: - * // I was sync! - * // This happened... - * // I was async! - * - * - * @example Use bindCallback on object method - * const boundMethod = Rx.Observable.bindCallback(someObject.methodWithCallback); - * boundMethod.call(someObject) // make sure methodWithCallback has access to someObject - * .subscribe(subscriber); - * - * - * @see {@link bindNodeCallback} - * @see {@link from} - * @see {@link fromPromise} - * - * @param {function} func Function with a callback as the last parameter. - * @param {function} [selector] A function which takes the arguments from the - * callback and maps those to a value to emit on the output Observable. - * @param {Scheduler} [scheduler] The scheduler on which to schedule the - * callbacks. - * @return {function(...params: *): Observable} A function which returns the - * Observable that delivers the same values the callback would deliver. - * @static true - * @name bindCallback - * @owner Observable - */ - BoundCallbackObservable.create = function (func, selector, scheduler) { - if (selector === void 0) { selector = undefined; } - return function () { - var args = []; - for (var _i = 0; _i < arguments.length; _i++) { - args[_i - 0] = arguments[_i]; - } - return new BoundCallbackObservable(func, selector, args, this, scheduler); - }; - }; - BoundCallbackObservable.prototype._subscribe = function (subscriber) { - var callbackFunc = this.callbackFunc; - var args = this.args; - var scheduler = this.scheduler; - var subject = this.subject; - if (!scheduler) { - if (!subject) { - subject = this.subject = new AsyncSubject_1.AsyncSubject(); - var handler = function handlerFn() { - var innerArgs = []; - for (var _i = 0; _i < arguments.length; _i++) { - innerArgs[_i - 0] = arguments[_i]; - } - var source = handlerFn.source; - var selector = source.selector, subject = source.subject; - if (selector) { - var result_1 = tryCatch_1.tryCatch(selector).apply(this, innerArgs); - if (result_1 === errorObject_1.errorObject) { - subject.error(errorObject_1.errorObject.e); - } - else { - subject.next(result_1); - subject.complete(); - } - } - else { - subject.next(innerArgs.length <= 1 ? innerArgs[0] : innerArgs); - subject.complete(); - } - }; - // use named function instance to avoid closure. - handler.source = this; - var result = tryCatch_1.tryCatch(callbackFunc).apply(this.context, args.concat(handler)); - if (result === errorObject_1.errorObject) { - subject.error(errorObject_1.errorObject.e); - } - } - return subject.subscribe(subscriber); - } - else { - return scheduler.schedule(BoundCallbackObservable.dispatch, 0, { source: this, subscriber: subscriber, context: this.context }); - } - }; - BoundCallbackObservable.dispatch = function (state) { - var self = this; - var source = state.source, subscriber = state.subscriber, context = state.context; - var callbackFunc = source.callbackFunc, args = source.args, scheduler = source.scheduler; - var subject = source.subject; - if (!subject) { - subject = source.subject = new AsyncSubject_1.AsyncSubject(); - var handler = function handlerFn() { - var innerArgs = []; - for (var _i = 0; _i < arguments.length; _i++) { - innerArgs[_i - 0] = arguments[_i]; - } - var source = handlerFn.source; - var selector = source.selector, subject = source.subject; - if (selector) { - var result_2 = tryCatch_1.tryCatch(selector).apply(this, innerArgs); - if (result_2 === errorObject_1.errorObject) { - self.add(scheduler.schedule(dispatchError, 0, { err: errorObject_1.errorObject.e, subject: subject })); - } - else { - self.add(scheduler.schedule(dispatchNext, 0, { value: result_2, subject: subject })); - } - } - else { - var value = innerArgs.length <= 1 ? innerArgs[0] : innerArgs; - self.add(scheduler.schedule(dispatchNext, 0, { value: value, subject: subject })); - } - }; - // use named function to pass values in without closure - handler.source = source; - var result = tryCatch_1.tryCatch(callbackFunc).apply(context, args.concat(handler)); - if (result === errorObject_1.errorObject) { - subject.error(errorObject_1.errorObject.e); - } - } - self.add(subject.subscribe(subscriber)); - }; - return BoundCallbackObservable; -}(Observable_1.Observable)); -exports.BoundCallbackObservable = BoundCallbackObservable; -function dispatchNext(arg) { - var value = arg.value, subject = arg.subject; - subject.next(value); - subject.complete(); -} -function dispatchError(arg) { - var err = arg.err, subject = arg.subject; - subject.error(err); -} -//# sourceMappingURL=BoundCallbackObservable.js.map + return null; + }, + + /** + * @spec http://www.w3.org/TR/dom/#dom-treewalker-firstchild + * @method + * @return {Node|null} + */ + firstChild: function () { + return traverseChildren(this, 'first'); + }, + + /** + * @spec http://www.w3.org/TR/dom/#dom-treewalker-lastchild + * @method + * @return {Node|null} + */ + lastChild: function () { + return traverseChildren(this, 'last'); + }, + + /** + * @spec http://www.w3.org/TR/dom/#dom-treewalker-previoussibling + * @method + * @return {Node|null} + */ + previousSibling: function () { + return traverseSiblings(this, 'previous'); + }, + + /** + * @spec http://www.w3.org/TR/dom/#dom-treewalker-nextsibling + * @method + * @return {Node|null} + */ + nextSibling: function () { + return traverseSiblings(this, 'next'); + }, + + /** + * @spec http://www.w3.org/TR/dom/#dom-treewalker-previousnode + * @method + * @return {Node|null} + */ + previousNode: function () { + var node, result, sibling; + node = this.currentNode; + while (node !== this.root) { + sibling = node.previousSibling; + while (sibling !== null) { + node = sibling; + result = this.filter.acceptNode(node); + while (result !== NodeFilter.FILTER_REJECT && node.lastChild !== null) { + node = node.lastChild; + result = this.filter.acceptNode(node); + } + if (result === NodeFilter.FILTER_ACCEPT) { + this.currentNode = node; + return node; + } + sibling = node.previousSibling; + } + if (node === this.root || node.parentNode === null) { + return null; + } + node = node.parentNode; + if (this.filter.acceptNode(node) === NodeFilter.FILTER_ACCEPT) { + this.currentNode = node; + return node; + } + } + return null; + }, + + /** + * @spec http://www.w3.org/TR/dom/#dom-treewalker-nextnode + * @based on WebKit's TreeWalker::nextNode + * https://trac.webkit.org/browser/trunk/Source/WebCore/dom/TreeWalker.cpp?rev=179143#L252 + * @method + * @return {Node|null} + */ + nextNode: function () { + var node, result, following; + node = this.currentNode; + result = NodeFilter.FILTER_ACCEPT; + + while (true) { + while (result !== NodeFilter.FILTER_REJECT && node.firstChild !== null) { + node = node.firstChild; + result = this.filter.acceptNode(node); + if (result === NodeFilter.FILTER_ACCEPT) { + this.currentNode = node; + return node; + } + } + following = NodeTraversal.nextSkippingChildren(node, this.root); + if (following !== null) { + node = following; + } + else { + return null; + } + result = this.filter.acceptNode(node); + if (result === NodeFilter.FILTER_ACCEPT) { + this.currentNode = node; + return node; + } + } + } +}; + /***/ }), -/* 247 */ +/* 80 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + +// https://html.spec.whatwg.org/multipage/webappapis.html#windowtimers +var WindowTimers = { + setTimeout: setTimeout, + clearTimeout: clearTimeout, + setInterval: setInterval, + clearInterval: clearInterval }; -var Observable_1 = __webpack_require__(0); -var tryCatch_1 = __webpack_require__(7); -var errorObject_1 = __webpack_require__(5); -var AsyncSubject_1 = __webpack_require__(25); -/** - * We need this JSDoc comment for affecting ESDoc. - * @extends {Ignored} - * @hide true - */ -var BoundNodeCallbackObservable = (function (_super) { - __extends(BoundNodeCallbackObservable, _super); - function BoundNodeCallbackObservable(callbackFunc, selector, args, context, scheduler) { - _super.call(this); - this.callbackFunc = callbackFunc; - this.selector = selector; - this.args = args; - this.context = context; - this.scheduler = scheduler; - } - /* tslint:enable:max-line-length */ - /** - * Converts a Node.js-style callback API to a function that returns an - * Observable. - * - * It's just like {@link bindCallback}, but the - * callback is expected to be of type `callback(error, result)`. - * - * `bindNodeCallback` is not an operator because its input and output are not - * Observables. The input is a function `func` with some parameters, but the - * last parameter must be a callback function that `func` calls when it is - * done. The callback function is expected to follow Node.js conventions, - * where the first argument to the callback is an error object, signaling - * whether call was successful. If that object is passed to callback, it means - * something went wrong. - * - * The output of `bindNodeCallback` is a function that takes the same - * parameters as `func`, except the last one (the callback). When the output - * function is called with arguments, it will return an Observable. - * If `func` calls its callback with error parameter present, Observable will - * error with that value as well. If error parameter is not passed, Observable will emit - * second parameter. If there are more parameters (third and so on), - * Observable will emit an array with all arguments, except first error argument. - * - * Optionally `bindNodeCallback` accepts selector function, which allows you to - * make resulting Observable emit value computed by selector, instead of regular - * callback arguments. It works similarly to {@link bindCallback} selector, but - * Node.js-style error argument will never be passed to that function. - * - * Note that `func` will not be called at the same time output function is, - * but rather whenever resulting Observable is subscribed. By default call to - * `func` will happen synchronously after subscription, but that can be changed - * with proper {@link Scheduler} provided as optional third parameter. Scheduler - * can also control when values from callback will be emitted by Observable. - * To find out more, check out documentation for {@link bindCallback}, where - * Scheduler works exactly the same. - * - * As in {@link bindCallback}, context (`this` property) of input function will be set to context - * of returned function, when it is called. - * - * After Observable emits value, it will complete immediately. This means - * even if `func` calls callback again, values from second and consecutive - * calls will never appear on the stream. If you need to handle functions - * that call callbacks multiple times, check out {@link fromEvent} or - * {@link fromEventPattern} instead. - * - * Note that `bindNodeCallback` can be used in non-Node.js environments as well. - * "Node.js-style" callbacks are just a convention, so if you write for - * browsers or any other environment and API you use implements that callback style, - * `bindNodeCallback` can be safely used on that API functions as well. - * - * Remember that Error object passed to callback does not have to be an instance - * of JavaScript built-in `Error` object. In fact, it does not even have to an object. - * Error parameter of callback function is interpreted as "present", when value - * of that parameter is truthy. It could be, for example, non-zero number, non-empty - * string or boolean `true`. In all of these cases resulting Observable would error - * with that value. This means usually regular style callbacks will fail very often when - * `bindNodeCallback` is used. If your Observable errors much more often then you - * would expect, check if callback really is called in Node.js-style and, if not, - * switch to {@link bindCallback} instead. - * - * Note that even if error parameter is technically present in callback, but its value - * is falsy, it still won't appear in array emitted by Observable or in selector function. - * - * - * @example Read a file from the filesystem and get the data as an Observable - * import * as fs from 'fs'; - * var readFileAsObservable = Rx.Observable.bindNodeCallback(fs.readFile); - * var result = readFileAsObservable('./roadNames.txt', 'utf8'); - * result.subscribe(x => console.log(x), e => console.error(e)); - * - * - * @example Use on function calling callback with multiple arguments - * someFunction((err, a, b) => { - * console.log(err); // null - * console.log(a); // 5 - * console.log(b); // "some string" - * }); - * var boundSomeFunction = Rx.Observable.bindNodeCallback(someFunction); - * boundSomeFunction() - * .subscribe(value => { - * console.log(value); // [5, "some string"] - * }); - * - * - * @example Use with selector function - * someFunction((err, a, b) => { - * console.log(err); // undefined - * console.log(a); // "abc" - * console.log(b); // "DEF" - * }); - * var boundSomeFunction = Rx.Observable.bindNodeCallback(someFunction, (a, b) => a + b); - * boundSomeFunction() - * .subscribe(value => { - * console.log(value); // "abcDEF" - * }); - * - * - * @example Use on function calling callback in regular style - * someFunction(a => { - * console.log(a); // 5 - * }); - * var boundSomeFunction = Rx.Observable.bindNodeCallback(someFunction); - * boundSomeFunction() - * .subscribe( - * value => {} // never gets called - * err => console.log(err) // 5 - *); - * - * - * @see {@link bindCallback} - * @see {@link from} - * @see {@link fromPromise} - * - * @param {function} func Function with a Node.js-style callback as the last parameter. - * @param {function} [selector] A function which takes the arguments from the - * callback and maps those to a value to emit on the output Observable. - * @param {Scheduler} [scheduler] The scheduler on which to schedule the - * callbacks. - * @return {function(...params: *): Observable} A function which returns the - * Observable that delivers the same values the Node.js callback would - * deliver. - * @static true - * @name bindNodeCallback - * @owner Observable - */ - BoundNodeCallbackObservable.create = function (func, selector, scheduler) { - if (selector === void 0) { selector = undefined; } - return function () { - var args = []; - for (var _i = 0; _i < arguments.length; _i++) { - args[_i - 0] = arguments[_i]; - } - return new BoundNodeCallbackObservable(func, selector, args, this, scheduler); - }; - }; - BoundNodeCallbackObservable.prototype._subscribe = function (subscriber) { - var callbackFunc = this.callbackFunc; - var args = this.args; - var scheduler = this.scheduler; - var subject = this.subject; - if (!scheduler) { - if (!subject) { - subject = this.subject = new AsyncSubject_1.AsyncSubject(); - var handler = function handlerFn() { - var innerArgs = []; - for (var _i = 0; _i < arguments.length; _i++) { - innerArgs[_i - 0] = arguments[_i]; - } - var source = handlerFn.source; - var selector = source.selector, subject = source.subject; - var err = innerArgs.shift(); - if (err) { - subject.error(err); - } - else if (selector) { - var result_1 = tryCatch_1.tryCatch(selector).apply(this, innerArgs); - if (result_1 === errorObject_1.errorObject) { - subject.error(errorObject_1.errorObject.e); - } - else { - subject.next(result_1); - subject.complete(); - } - } - else { - subject.next(innerArgs.length <= 1 ? innerArgs[0] : innerArgs); - subject.complete(); - } - }; - // use named function instance to avoid closure. - handler.source = this; - var result = tryCatch_1.tryCatch(callbackFunc).apply(this.context, args.concat(handler)); - if (result === errorObject_1.errorObject) { - subject.error(errorObject_1.errorObject.e); - } - } - return subject.subscribe(subscriber); - } - else { - return scheduler.schedule(dispatch, 0, { source: this, subscriber: subscriber, context: this.context }); - } - }; - return BoundNodeCallbackObservable; -}(Observable_1.Observable)); -exports.BoundNodeCallbackObservable = BoundNodeCallbackObservable; -function dispatch(state) { - var self = this; - var source = state.source, subscriber = state.subscriber, context = state.context; - // XXX: cast to `any` to access to the private field in `source`. - var _a = source, callbackFunc = _a.callbackFunc, args = _a.args, scheduler = _a.scheduler; - var subject = source.subject; - if (!subject) { - subject = source.subject = new AsyncSubject_1.AsyncSubject(); - var handler = function handlerFn() { - var innerArgs = []; - for (var _i = 0; _i < arguments.length; _i++) { - innerArgs[_i - 0] = arguments[_i]; - } - var source = handlerFn.source; - var selector = source.selector, subject = source.subject; - var err = innerArgs.shift(); - if (err) { - self.add(scheduler.schedule(dispatchError, 0, { err: err, subject: subject })); - } - else if (selector) { - var result_2 = tryCatch_1.tryCatch(selector).apply(this, innerArgs); - if (result_2 === errorObject_1.errorObject) { - self.add(scheduler.schedule(dispatchError, 0, { err: errorObject_1.errorObject.e, subject: subject })); - } - else { - self.add(scheduler.schedule(dispatchNext, 0, { value: result_2, subject: subject })); - } - } - else { - var value = innerArgs.length <= 1 ? innerArgs[0] : innerArgs; - self.add(scheduler.schedule(dispatchNext, 0, { value: value, subject: subject })); - } - }; - // use named function to pass values in without closure - handler.source = source; - var result = tryCatch_1.tryCatch(callbackFunc).apply(context, args.concat(handler)); - if (result === errorObject_1.errorObject) { - self.add(scheduler.schedule(dispatchError, 0, { err: errorObject_1.errorObject.e, subject: subject })); - } - } - self.add(subject.subscribe(subscriber)); -} -function dispatchNext(arg) { - var value = arg.value, subject = arg.subject; - subject.next(value); - subject.complete(); -} -function dispatchError(arg) { - var err = arg.err, subject = arg.subject; - subject.error(err); -} -//# sourceMappingURL=BoundNodeCallbackObservable.js.map + +module.exports = WindowTimers; + /***/ }), -/* 248 */ +/* 81 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; +/* jshint node:true, latedef:false */ + // jshint ignore:line +/*! +Parser-Lib +Copyright (c) 2009-2011 Nicholas C. Zakas. All rights reserved. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. + +*/ +/* Version v0.2.5+domino1, Build time: 30-January-2016 05:13:03 */ +var parserlib = Object.create(null); +(function(){ -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; -var Observable_1 = __webpack_require__(0); -var subscribeToResult_1 = __webpack_require__(3); -var OuterSubscriber_1 = __webpack_require__(4); /** - * We need this JSDoc comment for affecting ESDoc. - * @extends {Ignored} - * @hide true + * A generic base to inherit from for any object + * that needs event handling. + * @class EventTarget + * @constructor */ -var DeferObservable = (function (_super) { - __extends(DeferObservable, _super); - function DeferObservable(observableFactory) { - _super.call(this); - this.observableFactory = observableFactory; - } +function EventTarget(){ + /** - * Creates an Observable that, on subscribe, calls an Observable factory to - * make an Observable for each new Observer. - * - * Creates the Observable lazily, that is, only when it - * is subscribed. - * - * - * - * - * `defer` allows you to create the Observable only when the Observer - * subscribes, and create a fresh Observable for each Observer. It waits until - * an Observer subscribes to it, and then it generates an Observable, - * typically with an Observable factory function. It does this afresh for each - * subscriber, so although each subscriber may think it is subscribing to the - * same Observable, in fact each subscriber gets its own individual - * Observable. - * - * @example Subscribe to either an Observable of clicks or an Observable of interval, at random - * var clicksOrInterval = Rx.Observable.defer(function () { - * if (Math.random() > 0.5) { - * return Rx.Observable.fromEvent(document, 'click'); - * } else { - * return Rx.Observable.interval(1000); - * } - * }); - * clicksOrInterval.subscribe(x => console.log(x)); - * - * // Results in the following behavior: - * // If the result of Math.random() is greater than 0.5 it will listen - * // for clicks anywhere on the "document"; when document is clicked it - * // will log a MouseEvent object to the console. If the result is less - * // than 0.5 it will emit ascending numbers, one every second(1000ms). - * - * @see {@link create} - * - * @param {function(): SubscribableOrPromise} observableFactory The Observable - * factory function to invoke for each Observer that subscribes to the output - * Observable. May also return a Promise, which will be converted on the fly - * to an Observable. - * @return {Observable} An Observable whose Observers' subscriptions trigger - * an invocation of the given Observable factory function. - * @static true - * @name defer - * @owner Observable + * The array of listeners for various events. + * @type Object + * @property _listeners + * @private */ - DeferObservable.create = function (observableFactory) { - return new DeferObservable(observableFactory); - }; - DeferObservable.prototype._subscribe = function (subscriber) { - return new DeferSubscriber(subscriber, this.observableFactory); - }; - return DeferObservable; -}(Observable_1.Observable)); -exports.DeferObservable = DeferObservable; -var DeferSubscriber = (function (_super) { - __extends(DeferSubscriber, _super); - function DeferSubscriber(destination, factory) { - _super.call(this, destination); - this.factory = factory; - this.tryDefer(); - } - DeferSubscriber.prototype.tryDefer = function () { - try { - this._callFactory(); + this._listeners = Object.create(null); +} + +EventTarget.prototype = { + + //restore constructor + constructor: EventTarget, + + /** + * Adds a listener for a given event type. + * @param {String} type The type of event to add a listener for. + * @param {Function} listener The function to call when the event occurs. + * @return {void} + * @method addListener + */ + addListener: function(type, listener){ + if (!this._listeners[type]){ + this._listeners[type] = []; + } + + this._listeners[type].push(listener); + }, + + /** + * Fires an event based on the passed-in object. + * @param {Object|String} event An object with at least a 'type' attribute + * or a string indicating the event name. + * @return {void} + * @method fire + */ + fire: function(event){ + if (typeof event === "string"){ + event = { type: event }; } - catch (err) { - this._error(err); + if (typeof event.target !== "undefined"){ + event.target = this; } - }; - DeferSubscriber.prototype._callFactory = function () { - var result = this.factory(); - if (result) { - this.add(subscribeToResult_1.subscribeToResult(this, result)); + + if (typeof event.type === "undefined"){ + throw new Error("Event object missing 'type' property."); } - }; - return DeferSubscriber; -}(OuterSubscriber_1.OuterSubscriber)); -//# sourceMappingURL=DeferObservable.js.map -/***/ }), -/* 249 */ -/***/ (function(module, exports, __webpack_require__) { + if (this._listeners[event.type]){ -"use strict"; + //create a copy of the array and use that so listeners can't chane + var listeners = this._listeners[event.type].concat(); + for (var i=0, len=listeners.length; i < len; i++){ + listeners[i].call(this, event); + } + } + }, -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + /** + * Removes a listener for a given event type. + * @param {String} type The type of event to remove a listener from. + * @param {Function} listener The function to remove from the event. + * @return {void} + * @method removeListener + */ + removeListener: function(type, listener){ + if (this._listeners[type]){ + var listeners = this._listeners[type]; + for (var i=0, len=listeners.length; i < len; i++){ + if (listeners[i] === listener){ + listeners.splice(i, 1); + break; + } + } + + + } + } }; -var Observable_1 = __webpack_require__(0); /** - * We need this JSDoc comment for affecting ESDoc. - * @extends {Ignored} - * @hide true + * Convenient way to read through strings. + * @namespace parserlib.util + * @class StringReader + * @constructor + * @param {String} text The text to read. */ -var ErrorObservable = (function (_super) { - __extends(ErrorObservable, _super); - function ErrorObservable(error, scheduler) { - _super.call(this); - this.error = error; - this.scheduler = scheduler; - } +function StringReader(text){ + /** - * Creates an Observable that emits no items to the Observer and immediately - * emits an error notification. - * - * Just emits 'error', and nothing else. - * - * - * - * - * This static operator is useful for creating a simple Observable that only - * emits the error notification. It can be used for composing with other - * Observables, such as in a {@link mergeMap}. - * - * @example Emit the number 7, then emit an error. - * var result = Rx.Observable.throw(new Error('oops!')).startWith(7); - * result.subscribe(x => console.log(x), e => console.error(e)); - * - * @example Map and flatten numbers to the sequence 'a', 'b', 'c', but throw an error for 13 - * var interval = Rx.Observable.interval(1000); - * var result = interval.mergeMap(x => - * x === 13 ? - * Rx.Observable.throw('Thirteens are bad') : - * Rx.Observable.of('a', 'b', 'c') - * ); - * result.subscribe(x => console.log(x), e => console.error(e)); - * - * @see {@link create} - * @see {@link empty} - * @see {@link never} - * @see {@link of} - * - * @param {any} error The particular Error to pass to the error notification. - * @param {Scheduler} [scheduler] A {@link IScheduler} to use for scheduling - * the emission of the error notification. - * @return {Observable} An error Observable: emits only the error notification - * using the given error argument. - * @static true - * @name throw - * @owner Observable + * The input text with line endings normalized. + * @property _input + * @type String + * @private */ - ErrorObservable.create = function (error, scheduler) { - return new ErrorObservable(error, scheduler); - }; - ErrorObservable.dispatch = function (arg) { - var error = arg.error, subscriber = arg.subscriber; - subscriber.error(error); - }; - ErrorObservable.prototype._subscribe = function (subscriber) { - var error = this.error; - var scheduler = this.scheduler; - subscriber.syncErrorThrowable = true; - if (scheduler) { - return scheduler.schedule(ErrorObservable.dispatch, 0, { - error: error, subscriber: subscriber - }); - } - else { - subscriber.error(error); - } - }; - return ErrorObservable; -}(Observable_1.Observable)); -exports.ErrorObservable = ErrorObservable; -//# sourceMappingURL=ErrorObservable.js.map + this._input = text.replace(/(\r|\n){1,2}/g, "\n"); -/***/ }), -/* 250 */ -/***/ (function(module, exports, __webpack_require__) { -"use strict"; + /** + * The row for the character to be read next. + * @property _line + * @type int + * @private + */ + this._line = 1; + + + /** + * The column for the character to be read next. + * @property _col + * @type int + * @private + */ + this._col = 1; + + /** + * The index of the character in the input to be read next. + * @property _cursor + * @type int + * @private + */ + this._cursor = 0; +} + +StringReader.prototype = { + + //restore constructor + constructor: StringReader, + + //------------------------------------------------------------------------- + // Position info + //------------------------------------------------------------------------- + + /** + * Returns the column of the character to be read next. + * @return {int} The column of the character to be read next. + * @method getCol + */ + getCol: function(){ + return this._col; + }, + + /** + * Returns the row of the character to be read next. + * @return {int} The row of the character to be read next. + * @method getLine + */ + getLine: function(){ + return this._line ; + }, + + /** + * Determines if you're at the end of the input. + * @return {Boolean} True if there's no more input, false otherwise. + * @method eof + */ + eof: function(){ + return (this._cursor === this._input.length); + }, + + //------------------------------------------------------------------------- + // Basic reading + //------------------------------------------------------------------------- -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; -var Observable_1 = __webpack_require__(0); -var tryCatch_1 = __webpack_require__(7); -var isFunction_1 = __webpack_require__(81); -var errorObject_1 = __webpack_require__(5); -var Subscription_1 = __webpack_require__(9); -var toString = Object.prototype.toString; -function isNodeStyleEventEmitter(sourceObj) { - return !!sourceObj && typeof sourceObj.addListener === 'function' && typeof sourceObj.removeListener === 'function'; -} -function isJQueryStyleEventEmitter(sourceObj) { - return !!sourceObj && typeof sourceObj.on === 'function' && typeof sourceObj.off === 'function'; -} -function isNodeList(sourceObj) { - return !!sourceObj && toString.call(sourceObj) === '[object NodeList]'; -} -function isHTMLCollection(sourceObj) { - return !!sourceObj && toString.call(sourceObj) === '[object HTMLCollection]'; -} -function isEventTarget(sourceObj) { - return !!sourceObj && typeof sourceObj.addEventListener === 'function' && typeof sourceObj.removeEventListener === 'function'; -} -/** - * We need this JSDoc comment for affecting ESDoc. - * @extends {Ignored} - * @hide true - */ -var FromEventObservable = (function (_super) { - __extends(FromEventObservable, _super); - function FromEventObservable(sourceObj, eventName, selector, options) { - _super.call(this); - this.sourceObj = sourceObj; - this.eventName = eventName; - this.selector = selector; - this.options = options; - } - /* tslint:enable:max-line-length */ /** - * Creates an Observable that emits events of a specific type coming from the - * given event target. - * - * Creates an Observable from DOM events, or Node - * EventEmitter events or others. - * - * - * - * Creates an Observable by attaching an event listener to an "event target", - * which may be an object with `addEventListener` and `removeEventListener`, - * a Node.js EventEmitter, a jQuery style EventEmitter, a NodeList from the - * DOM, or an HTMLCollection from the DOM. The event handler is attached when - * the output Observable is subscribed, and removed when the Subscription is - * unsubscribed. - * - * @example Emits clicks happening on the DOM document - * var clicks = Rx.Observable.fromEvent(document, 'click'); - * clicks.subscribe(x => console.log(x)); - * - * // Results in: - * // MouseEvent object logged to console everytime a click - * // occurs on the document. - * - * @see {@link from} - * @see {@link fromEventPattern} - * - * @param {EventTargetLike} target The DOMElement, event target, Node.js - * EventEmitter, NodeList or HTMLCollection to attach the event handler to. - * @param {string} eventName The event name of interest, being emitted by the - * `target`. - * @param {EventListenerOptions} [options] Options to pass through to addEventListener - * @param {SelectorMethodSignature} [selector] An optional function to - * post-process results. It takes the arguments from the event handler and - * should return a single value. - * @return {Observable} - * @static true - * @name fromEvent - * @owner Observable + * Reads the next character without advancing the cursor. + * @param {int} count How many characters to look ahead (default is 1). + * @return {String} The next character or null if there is no next character. + * @method peek */ - FromEventObservable.create = function (target, eventName, options, selector) { - if (isFunction_1.isFunction(options)) { - selector = options; - options = undefined; + peek: function(count){ + var c = null; + count = (typeof count === "undefined" ? 1 : count); + + //if we're not at the end of the input... + if (this._cursor < this._input.length){ + + //get character and increment cursor and column + c = this._input.charAt(this._cursor + count - 1); } - return new FromEventObservable(target, eventName, selector, options); - }; - FromEventObservable.setupSubscription = function (sourceObj, eventName, handler, subscriber, options) { - var unsubscribe; - if (isNodeList(sourceObj) || isHTMLCollection(sourceObj)) { - for (var i = 0, len = sourceObj.length; i < len; i++) { - FromEventObservable.setupSubscription(sourceObj[i], eventName, handler, subscriber, options); + + return c; + }, + + /** + * Reads the next character from the input and adjusts the row and column + * accordingly. + * @return {String} The next character or null if there is no next character. + * @method read + */ + read: function(){ + var c = null; + + //if we're not at the end of the input... + if (this._cursor < this._input.length){ + + //if the last character was a newline, increment row count + //and reset column count + if (this._input.charAt(this._cursor) === "\n"){ + this._line++; + this._col=1; + } else { + this._col++; } + + //get character and increment cursor and column + c = this._input.charAt(this._cursor++); } - else if (isEventTarget(sourceObj)) { - var source_1 = sourceObj; - sourceObj.addEventListener(eventName, handler, options); - unsubscribe = function () { return source_1.removeEventListener(eventName, handler); }; + + return c; + }, + + //------------------------------------------------------------------------- + // Misc + //------------------------------------------------------------------------- + + /** + * Saves the current location so it can be returned to later. + * @method mark + * @return {void} + */ + mark: function(){ + this._bookmark = { + cursor: this._cursor, + line: this._line, + col: this._col + }; + }, + + reset: function(){ + if (this._bookmark){ + this._cursor = this._bookmark.cursor; + this._line = this._bookmark.line; + this._col = this._bookmark.col; + delete this._bookmark; } - else if (isJQueryStyleEventEmitter(sourceObj)) { - var source_2 = sourceObj; - sourceObj.on(eventName, handler); - unsubscribe = function () { return source_2.off(eventName, handler); }; + }, + + //------------------------------------------------------------------------- + // Advanced reading + //------------------------------------------------------------------------- + + /** + * Reads up to and including the given string. Throws an error if that + * string is not found. + * @param {String} pattern The string to read. + * @return {String} The string when it is found. + * @throws Error when the string pattern is not found. + * @method readTo + */ + readTo: function(pattern){ + + var buffer = "", + c; + + /* + * First, buffer must be the same length as the pattern. + * Then, buffer must end with the pattern or else reach the + * end of the input. + */ + while (buffer.length < pattern.length || buffer.lastIndexOf(pattern) !== buffer.length - pattern.length){ + c = this.read(); + if (c){ + buffer += c; + } else { + throw new Error("Expected \"" + pattern + "\" at line " + this._line + ", col " + this._col + "."); + } } - else if (isNodeStyleEventEmitter(sourceObj)) { - var source_3 = sourceObj; - sourceObj.addListener(eventName, handler); - unsubscribe = function () { return source_3.removeListener(eventName, handler); }; + + return buffer; + + }, + + /** + * Reads characters while each character causes the given + * filter function to return true. The function is passed + * in each character and either returns true to continue + * reading or false to stop. + * @param {Function} filter The function to read on each character. + * @return {String} The string made up of all characters that passed the + * filter check. + * @method readWhile + */ + readWhile: function(filter){ + + var buffer = "", + c = this.read(); + + while(c !== null && filter(c)){ + buffer += c; + c = this.read(); } - else { - throw new TypeError('Invalid event target'); - } - subscriber.add(new Subscription_1.Subscription(unsubscribe)); - }; - FromEventObservable.prototype._subscribe = function (subscriber) { - var sourceObj = this.sourceObj; - var eventName = this.eventName; - var options = this.options; - var selector = this.selector; - var handler = selector ? function () { - var args = []; - for (var _i = 0; _i < arguments.length; _i++) { - args[_i - 0] = arguments[_i]; - } - var result = tryCatch_1.tryCatch(selector).apply(void 0, args); - if (result === errorObject_1.errorObject) { - subscriber.error(errorObject_1.errorObject.e); + + return buffer; + + }, + + /** + * Reads characters that match either text or a regular expression and + * returns those characters. If a match is found, the row and column + * are adjusted; if no match is found, the reader's state is unchanged. + * reading or false to stop. + * @param {String|RegExp} matchter If a string, then the literal string + * value is searched for. If a regular expression, then any string + * matching the pattern is search for. + * @return {String} The string made up of all characters that matched or + * null if there was no match. + * @method readMatch + */ + readMatch: function(matcher){ + + var source = this._input.substring(this._cursor), + value = null; + + //if it's a string, just do a straight match + if (typeof matcher === "string"){ + if (source.indexOf(matcher) === 0){ + value = this.readCount(matcher.length); } - else { - subscriber.next(result); + } else if (matcher instanceof RegExp){ + if (matcher.test(source)){ + value = this.readCount(RegExp.lastMatch.length); } - } : function (e) { return subscriber.next(e); }; - FromEventObservable.setupSubscription(sourceObj, eventName, handler, subscriber, options); - }; - return FromEventObservable; -}(Observable_1.Observable)); -exports.FromEventObservable = FromEventObservable; -//# sourceMappingURL=FromEventObservable.js.map + } -/***/ }), -/* 251 */ -/***/ (function(module, exports, __webpack_require__) { + return value; + }, -"use strict"; -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + /** + * Reads a given number of characters. If the end of the input is reached, + * it reads only the remaining characters and does not throw an error. + * @param {int} count The number of characters to read. + * @return {String} The string made up the read characters. + * @method readCount + */ + readCount: function(count){ + var buffer = ""; + + while(count--){ + buffer += this.read(); + } + + return buffer; + } + }; -var isFunction_1 = __webpack_require__(81); -var Observable_1 = __webpack_require__(0); -var Subscription_1 = __webpack_require__(9); /** - * We need this JSDoc comment for affecting ESDoc. - * @extends {Ignored} - * @hide true + * Type to use when a syntax error occurs. + * @class SyntaxError + * @namespace parserlib.util + * @constructor + * @param {String} message The error message. + * @param {int} line The line at which the error occurred. + * @param {int} col The column at which the error occurred. */ -var FromEventPatternObservable = (function (_super) { - __extends(FromEventPatternObservable, _super); - function FromEventPatternObservable(addHandler, removeHandler, selector) { - _super.call(this); - this.addHandler = addHandler; - this.removeHandler = removeHandler; - this.selector = selector; - } +function SyntaxError(message, line, col){ + Error.call(this); + this.name = this.constructor.name; + /** - * Creates an Observable from an API based on addHandler/removeHandler - * functions. - * - * Converts any addHandler/removeHandler API to an - * Observable. - * - * - * - * Creates an Observable by using the `addHandler` and `removeHandler` - * functions to add and remove the handlers, with an optional selector - * function to project the event arguments to a result. The `addHandler` is - * called when the output Observable is subscribed, and `removeHandler` is - * called when the Subscription is unsubscribed. - * - * @example Emits clicks happening on the DOM document - * function addClickHandler(handler) { - * document.addEventListener('click', handler); - * } - * - * function removeClickHandler(handler) { - * document.removeEventListener('click', handler); - * } - * - * var clicks = Rx.Observable.fromEventPattern( - * addClickHandler, - * removeClickHandler - * ); - * clicks.subscribe(x => console.log(x)); - * - * @see {@link from} - * @see {@link fromEvent} - * - * @param {function(handler: Function): any} addHandler A function that takes - * a `handler` function as argument and attaches it somehow to the actual - * source of events. - * @param {function(handler: Function, signal?: any): void} [removeHandler] An optional function that - * takes a `handler` function as argument and removes it in case it was - * previously attached using `addHandler`. if addHandler returns signal to teardown when remove, - * removeHandler function will forward it. - * @param {function(...args: any): T} [selector] An optional function to - * post-process results. It takes the arguments from the event handler and - * should return a single value. - * @return {Observable} - * @static true - * @name fromEventPattern - * @owner Observable + * The column at which the error occurred. + * @type int + * @property col */ - FromEventPatternObservable.create = function (addHandler, removeHandler, selector) { - return new FromEventPatternObservable(addHandler, removeHandler, selector); - }; - FromEventPatternObservable.prototype._subscribe = function (subscriber) { - var _this = this; - var removeHandler = this.removeHandler; - var handler = !!this.selector ? function () { - var args = []; - for (var _i = 0; _i < arguments.length; _i++) { - args[_i - 0] = arguments[_i]; - } - _this._callSelector(subscriber, args); - } : function (e) { subscriber.next(e); }; - var retValue = this._callAddHandler(handler, subscriber); - if (!isFunction_1.isFunction(removeHandler)) { - return; - } - subscriber.add(new Subscription_1.Subscription(function () { - //TODO: determine whether or not to forward to error handler - removeHandler(handler, retValue); - })); - }; - FromEventPatternObservable.prototype._callSelector = function (subscriber, args) { - try { - var result = this.selector.apply(this, args); - subscriber.next(result); - } - catch (e) { - subscriber.error(e); - } - }; - FromEventPatternObservable.prototype._callAddHandler = function (handler, errorSubscriber) { - try { - return this.addHandler(handler) || null; - } - catch (e) { - errorSubscriber.error(e); - } - }; - return FromEventPatternObservable; -}(Observable_1.Observable)); -exports.FromEventPatternObservable = FromEventPatternObservable; -//# sourceMappingURL=FromEventPatternObservable.js.map + this.col = col; -/***/ }), -/* 252 */ -/***/ (function(module, exports, __webpack_require__) { + /** + * The line at which the error occurred. + * @type int + * @property line + */ + this.line = line; -"use strict"; + /** + * The text representation of the unit. + * @type String + * @property text + */ + this.message = message; -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; -var Observable_1 = __webpack_require__(0); -var isScheduler_1 = __webpack_require__(13); -var selfSelector = function (value) { return value; }; +} + +//inherit from Error +SyntaxError.prototype = Object.create(Error.prototype); // jshint ignore:line +SyntaxError.prototype.constructor = SyntaxError; // jshint ignore:line /** - * We need this JSDoc comment for affecting ESDoc. - * @extends {Ignored} - * @hide true + * Base type to represent a single syntactic unit. + * @class SyntaxUnit + * @namespace parserlib.util + * @constructor + * @param {String} text The text of the unit. + * @param {int} line The line of text on which the unit resides. + * @param {int} col The column of text on which the unit resides. */ -var GenerateObservable = (function (_super) { - __extends(GenerateObservable, _super); - function GenerateObservable(initialState, condition, iterate, resultSelector, scheduler) { - _super.call(this); - this.initialState = initialState; - this.condition = condition; - this.iterate = iterate; - this.resultSelector = resultSelector; - this.scheduler = scheduler; - } - GenerateObservable.create = function (initialStateOrOptions, condition, iterate, resultSelectorOrObservable, scheduler) { - if (arguments.length == 1) { - return new GenerateObservable(initialStateOrOptions.initialState, initialStateOrOptions.condition, initialStateOrOptions.iterate, initialStateOrOptions.resultSelector || selfSelector, initialStateOrOptions.scheduler); - } - if (resultSelectorOrObservable === undefined || isScheduler_1.isScheduler(resultSelectorOrObservable)) { - return new GenerateObservable(initialStateOrOptions, condition, iterate, selfSelector, resultSelectorOrObservable); - } - return new GenerateObservable(initialStateOrOptions, condition, iterate, resultSelectorOrObservable, scheduler); - }; - GenerateObservable.prototype._subscribe = function (subscriber) { - var state = this.initialState; - if (this.scheduler) { - return this.scheduler.schedule(GenerateObservable.dispatch, 0, { - subscriber: subscriber, - iterate: this.iterate, - condition: this.condition, - resultSelector: this.resultSelector, - state: state }); - } - var _a = this, condition = _a.condition, resultSelector = _a.resultSelector, iterate = _a.iterate; - do { - if (condition) { - var conditionResult = void 0; - try { - conditionResult = condition(state); - } - catch (err) { - subscriber.error(err); - return; - } - if (!conditionResult) { - subscriber.complete(); - break; - } - } - var value = void 0; - try { - value = resultSelector(state); - } - catch (err) { - subscriber.error(err); - return; - } - subscriber.next(value); - if (subscriber.closed) { - break; - } - try { - state = iterate(state); - } - catch (err) { - subscriber.error(err); - return; - } - } while (true); - }; - GenerateObservable.dispatch = function (state) { - var subscriber = state.subscriber, condition = state.condition; - if (subscriber.closed) { - return; - } - if (state.needIterate) { - try { - state.state = state.iterate(state.state); - } - catch (err) { - subscriber.error(err); - return; - } - } - else { - state.needIterate = true; - } - if (condition) { - var conditionResult = void 0; - try { - conditionResult = condition(state.state); - } - catch (err) { - subscriber.error(err); - return; - } - if (!conditionResult) { - subscriber.complete(); - return; - } - if (subscriber.closed) { - return; - } - } - var value; - try { - value = state.resultSelector(state.state); - } - catch (err) { - subscriber.error(err); - return; - } - if (subscriber.closed) { - return; - } - subscriber.next(value); - if (subscriber.closed) { - return; - } - return this.schedule(state); - }; - return GenerateObservable; -}(Observable_1.Observable)); -exports.GenerateObservable = GenerateObservable; -//# sourceMappingURL=GenerateObservable.js.map +function SyntaxUnit(text, line, col, type){ -/***/ }), -/* 253 */ -/***/ (function(module, exports, __webpack_require__) { -"use strict"; + /** + * The column of text on which the unit resides. + * @type int + * @property col + */ + this.col = col; + + /** + * The line of text on which the unit resides. + * @type int + * @property line + */ + this.line = line; + + /** + * The text representation of the unit. + * @type String + * @property text + */ + this.text = text; + + /** + * The type of syntax unit. + * @type int + * @property type + */ + this.type = type; +} + +/** + * Create a new syntax unit based solely on the given token. + * Convenience method for creating a new syntax unit when + * it represents a single token instead of multiple. + * @param {Object} token The token object to represent. + * @return {parserlib.util.SyntaxUnit} The object representing the token. + * @static + * @method fromToken + */ +SyntaxUnit.fromToken = function(token){ + return new SyntaxUnit(token.value, token.startLine, token.startCol); +}; + +SyntaxUnit.prototype = { + + //restore constructor + constructor: SyntaxUnit, + + /** + * Returns the text representation of the unit. + * @return {String} The text representation of the unit. + * @method valueOf + */ + valueOf: function(){ + return this.toString(); + }, + + /** + * Returns the text representation of the unit. + * @return {String} The text representation of the unit. + * @method toString + */ + toString: function(){ + return this.text; + } -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; -var Observable_1 = __webpack_require__(0); -var subscribeToResult_1 = __webpack_require__(3); -var OuterSubscriber_1 = __webpack_require__(4); + +/** + * Generic TokenStream providing base functionality. + * @class TokenStreamBase + * @namespace parserlib.util + * @constructor + * @param {String|StringReader} input The text to tokenize or a reader from + * which to read the input. + */ +function TokenStreamBase(input, tokenData){ + + /** + * The string reader for easy access to the text. + * @type StringReader + * @property _reader + * @private + */ + this._reader = input ? new StringReader(input.toString()) : null; + + /** + * Token object for the last consumed token. + * @type Token + * @property _token + * @private + */ + this._token = null; + + /** + * The array of token information. + * @type Array + * @property _tokenData + * @private + */ + this._tokenData = tokenData; + + /** + * Lookahead token buffer. + * @type Array + * @property _lt + * @private + */ + this._lt = []; + + /** + * Lookahead token buffer index. + * @type int + * @property _ltIndex + * @private + */ + this._ltIndex = 0; + + this._ltIndexCache = []; +} + /** - * We need this JSDoc comment for affecting ESDoc. - * @extends {Ignored} - * @hide true + * Accepts an array of token information and outputs + * an array of token data containing key-value mappings + * and matching functions that the TokenStream needs. + * @param {Array} tokens An array of token descriptors. + * @return {Array} An array of processed token data. + * @method createTokenData + * @static */ -var IfObservable = (function (_super) { - __extends(IfObservable, _super); - function IfObservable(condition, thenSource, elseSource) { - _super.call(this); - this.condition = condition; - this.thenSource = thenSource; - this.elseSource = elseSource; +TokenStreamBase.createTokenData = function(tokens){ + + var nameMap = [], + typeMap = Object.create(null), + tokenData = tokens.concat([]), + i = 0, + len = tokenData.length+1; + + tokenData.UNKNOWN = -1; + tokenData.unshift({name:"EOF"}); + + for (; i < len; i++){ + nameMap.push(tokenData[i].name); + tokenData[tokenData[i].name] = i; + if (tokenData[i].text){ + typeMap[tokenData[i].text] = i; + } } - IfObservable.create = function (condition, thenSource, elseSource) { - return new IfObservable(condition, thenSource, elseSource); - }; - IfObservable.prototype._subscribe = function (subscriber) { - var _a = this, condition = _a.condition, thenSource = _a.thenSource, elseSource = _a.elseSource; - return new IfSubscriber(subscriber, condition, thenSource, elseSource); + + tokenData.name = function(tt){ + return nameMap[tt]; }; - return IfObservable; -}(Observable_1.Observable)); -exports.IfObservable = IfObservable; -var IfSubscriber = (function (_super) { - __extends(IfSubscriber, _super); - function IfSubscriber(destination, condition, thenSource, elseSource) { - _super.call(this, destination); - this.condition = condition; - this.thenSource = thenSource; - this.elseSource = elseSource; - this.tryIf(); - } - IfSubscriber.prototype.tryIf = function () { - var _a = this, condition = _a.condition, thenSource = _a.thenSource, elseSource = _a.elseSource; - var result; - try { - result = condition(); - var source = result ? thenSource : elseSource; - if (source) { - this.add(subscribeToResult_1.subscribeToResult(this, source)); - } - else { - this._complete(); - } - } - catch (err) { - this._error(err); - } + + tokenData.type = function(c){ + return typeMap[c]; }; - return IfSubscriber; -}(OuterSubscriber_1.OuterSubscriber)); -//# sourceMappingURL=IfObservable.js.map -/***/ }), -/* 254 */ -/***/ (function(module, exports, __webpack_require__) { + return tokenData; +}; -"use strict"; +TokenStreamBase.prototype = { -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; -var isNumeric_1 = __webpack_require__(28); -var Observable_1 = __webpack_require__(0); -var async_1 = __webpack_require__(8); -/** - * We need this JSDoc comment for affecting ESDoc. - * @extends {Ignored} - * @hide true - */ -var IntervalObservable = (function (_super) { - __extends(IntervalObservable, _super); - function IntervalObservable(period, scheduler) { - if (period === void 0) { period = 0; } - if (scheduler === void 0) { scheduler = async_1.async; } - _super.call(this); - this.period = period; - this.scheduler = scheduler; - if (!isNumeric_1.isNumeric(period) || period < 0) { - this.period = 0; + //restore constructor + constructor: TokenStreamBase, + + //------------------------------------------------------------------------- + // Matching methods + //------------------------------------------------------------------------- + + /** + * Determines if the next token matches the given token type. + * If so, that token is consumed; if not, the token is placed + * back onto the token stream. You can pass in any number of + * token types and this will return true if any of the token + * types is found. + * @param {int|int[]} tokenTypes Either a single token type or an array of + * token types that the next token might be. If an array is passed, + * it's assumed that the token can be any of these. + * @param {variant} channel (Optional) The channel to read from. If not + * provided, reads from the default (unnamed) channel. + * @return {Boolean} True if the token type matches, false if not. + * @method match + */ + match: function(tokenTypes, channel){ + + //always convert to an array, makes things easier + if (!(tokenTypes instanceof Array)){ + tokenTypes = [tokenTypes]; } - if (!scheduler || typeof scheduler.schedule !== 'function') { - this.scheduler = async_1.async; + + var tt = this.get(channel), + i = 0, + len = tokenTypes.length; + + while(i < len){ + if (tt === tokenTypes[i++]){ + return true; + } } - } + + //no match found, put the token back + this.unget(); + return false; + }, + /** - * Creates an Observable that emits sequential numbers every specified - * interval of time, on a specified IScheduler. - * - * Emits incremental numbers periodically in time. - * - * - * - * - * `interval` returns an Observable that emits an infinite sequence of - * ascending integers, with a constant interval of time of your choosing - * between those emissions. The first emission is not sent immediately, but - * only after the first period has passed. By default, this operator uses the - * `async` IScheduler to provide a notion of time, but you may pass any - * IScheduler to it. - * - * @example Emits ascending numbers, one every second (1000ms) - * var numbers = Rx.Observable.interval(1000); - * numbers.subscribe(x => console.log(x)); - * - * @see {@link timer} - * @see {@link delay} - * - * @param {number} [period=0] The interval size in milliseconds (by default) - * or the time unit determined by the scheduler's clock. - * @param {Scheduler} [scheduler=async] The IScheduler to use for scheduling - * the emission of values, and providing a notion of "time". - * @return {Observable} An Observable that emits a sequential number each time - * interval. - * @static true - * @name interval - * @owner Observable + * Determines if the next token matches the given token type. + * If so, that token is consumed; if not, an error is thrown. + * @param {int|int[]} tokenTypes Either a single token type or an array of + * token types that the next token should be. If an array is passed, + * it's assumed that the token must be one of these. + * @param {variant} channel (Optional) The channel to read from. If not + * provided, reads from the default (unnamed) channel. + * @return {void} + * @method mustMatch */ - IntervalObservable.create = function (period, scheduler) { - if (period === void 0) { period = 0; } - if (scheduler === void 0) { scheduler = async_1.async; } - return new IntervalObservable(period, scheduler); - }; - IntervalObservable.dispatch = function (state) { - var index = state.index, subscriber = state.subscriber, period = state.period; - subscriber.next(index); - if (subscriber.closed) { - return; + mustMatch: function(tokenTypes, channel){ + + var token; + + //always convert to an array, makes things easier + if (!(tokenTypes instanceof Array)){ + tokenTypes = [tokenTypes]; } - state.index += 1; - this.schedule(state, period); - }; - IntervalObservable.prototype._subscribe = function (subscriber) { - var index = 0; - var period = this.period; - var scheduler = this.scheduler; - subscriber.add(scheduler.schedule(IntervalObservable.dispatch, period, { - index: index, subscriber: subscriber, period: period - })); - }; - return IntervalObservable; -}(Observable_1.Observable)); -exports.IntervalObservable = IntervalObservable; -//# sourceMappingURL=IntervalObservable.js.map -/***/ }), -/* 255 */ -/***/ (function(module, exports, __webpack_require__) { + if (!this.match.apply(this, arguments)){ + token = this.LT(1); + throw new SyntaxError("Expected " + this._tokenData[tokenTypes[0]].name + + " at line " + token.startLine + ", col " + token.startCol + ".", token.startLine, token.startCol); + } + }, -"use strict"; + //------------------------------------------------------------------------- + // Consuming methods + //------------------------------------------------------------------------- -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; -var Observable_1 = __webpack_require__(0); -var noop_1 = __webpack_require__(76); -/** - * We need this JSDoc comment for affecting ESDoc. - * @extends {Ignored} - * @hide true - */ -var NeverObservable = (function (_super) { - __extends(NeverObservable, _super); - function NeverObservable() { - _super.call(this); - } /** - * Creates an Observable that emits no items to the Observer. - * - * An Observable that never emits anything. - * - * - * - * This static operator is useful for creating a simple Observable that emits - * neither values nor errors nor the completion notification. It can be used - * for testing purposes or for composing with other Observables. Please note - * that by never emitting a complete notification, this Observable keeps the - * subscription from being disposed automatically. Subscriptions need to be - * manually disposed. - * - * @example Emit the number 7, then never emit anything else (not even complete). - * function info() { - * console.log('Will not be called'); - * } - * var result = Rx.Observable.never().startWith(7); - * result.subscribe(x => console.log(x), info, info); - * - * @see {@link create} - * @see {@link empty} - * @see {@link of} - * @see {@link throw} - * - * @return {Observable} A "never" Observable: never emits anything. - * @static true - * @name never - * @owner Observable + * Keeps reading from the token stream until either one of the specified + * token types is found or until the end of the input is reached. + * @param {int|int[]} tokenTypes Either a single token type or an array of + * token types that the next token should be. If an array is passed, + * it's assumed that the token must be one of these. + * @param {variant} channel (Optional) The channel to read from. If not + * provided, reads from the default (unnamed) channel. + * @return {void} + * @method advance */ - NeverObservable.create = function () { - return new NeverObservable(); - }; - NeverObservable.prototype._subscribe = function (subscriber) { - noop_1.noop(); - }; - return NeverObservable; -}(Observable_1.Observable)); -exports.NeverObservable = NeverObservable; -//# sourceMappingURL=NeverObservable.js.map + advance: function(tokenTypes, channel){ -/***/ }), -/* 256 */ -/***/ (function(module, exports, __webpack_require__) { + while(this.LA(0) !== 0 && !this.match(tokenTypes, channel)){ + this.get(); + } -"use strict"; + return this.LA(0); + }, -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; -var Observable_1 = __webpack_require__(0); -function dispatch(state) { - var obj = state.obj, keys = state.keys, length = state.length, index = state.index, subscriber = state.subscriber; - if (index === length) { - subscriber.complete(); - return; - } - var key = keys[index]; - subscriber.next([key, obj[key]]); - state.index = index + 1; - this.schedule(state); -} -/** - * We need this JSDoc comment for affecting ESDoc. - * @extends {Ignored} - * @hide true - */ -var PairsObservable = (function (_super) { - __extends(PairsObservable, _super); - function PairsObservable(obj, scheduler) { - _super.call(this); - this.obj = obj; - this.scheduler = scheduler; - this.keys = Object.keys(obj); - } /** - * Convert an object into an observable sequence of [key, value] pairs - * using an optional IScheduler to enumerate the object. - * - * @example Converts a javascript object to an Observable - * var obj = { - * foo: 42, - * bar: 56, - * baz: 78 - * }; - * - * var source = Rx.Observable.pairs(obj); - * - * var subscription = source.subscribe( - * function (x) { - * console.log('Next: %s', x); - * }, - * function (err) { - * console.log('Error: %s', err); - * }, - * function () { - * console.log('Completed'); - * }); - * - * @param {Object} obj The object to inspect and turn into an - * Observable sequence. - * @param {Scheduler} [scheduler] An optional IScheduler to run the - * enumeration of the input sequence on. - * @returns {(Observable>)} An observable sequence of - * [key, value] pairs from the object. - */ - PairsObservable.create = function (obj, scheduler) { - return new PairsObservable(obj, scheduler); - }; - PairsObservable.prototype._subscribe = function (subscriber) { - var _a = this, keys = _a.keys, scheduler = _a.scheduler; - var length = keys.length; - if (scheduler) { - return scheduler.schedule(dispatch, 0, { - obj: this.obj, keys: keys, length: length, index: 0, subscriber: subscriber - }); + * Consumes the next token from the token stream. + * @return {int} The token type of the token that was just consumed. + * @method get + */ + get: function(channel){ + + var tokenInfo = this._tokenData, + i =0, + token, + info; + + //check the lookahead buffer first + if (this._lt.length && this._ltIndex >= 0 && this._ltIndex < this._lt.length){ + + i++; + this._token = this._lt[this._ltIndex++]; + info = tokenInfo[this._token.type]; + + //obey channels logic + while((info.channel !== undefined && channel !== info.channel) && + this._ltIndex < this._lt.length){ + this._token = this._lt[this._ltIndex++]; + info = tokenInfo[this._token.type]; + i++; + } + + //here be dragons + if ((info.channel === undefined || channel === info.channel) && + this._ltIndex <= this._lt.length){ + this._ltIndexCache.push(i); + return this._token.type; + } } - else { - for (var idx = 0; idx < length; idx++) { - var key = keys[idx]; - subscriber.next([key, this.obj[key]]); + + //call token retriever method + token = this._getToken(); + + //if it should be hidden, don't save a token + if (token.type > -1 && !tokenInfo[token.type].hide){ + + //apply token channel + token.channel = tokenInfo[token.type].channel; + + //save for later + this._token = token; + this._lt.push(token); + + //save space that will be moved (must be done before array is truncated) + this._ltIndexCache.push(this._lt.length - this._ltIndex + i); + + //keep the buffer under 5 items + if (this._lt.length > 5){ + this._lt.shift(); } - subscriber.complete(); + + //also keep the shift buffer under 5 items + if (this._ltIndexCache.length > 5){ + this._ltIndexCache.shift(); + } + + //update lookahead index + this._ltIndex = this._lt.length; } - }; - return PairsObservable; -}(Observable_1.Observable)); -exports.PairsObservable = PairsObservable; -//# sourceMappingURL=PairsObservable.js.map -/***/ }), -/* 257 */ -/***/ (function(module, exports, __webpack_require__) { + /* + * Skip to the next token if: + * 1. The token type is marked as hidden. + * 2. The token type has a channel specified and it isn't the current channel. + */ + info = tokenInfo[token.type]; + if (info && + (info.hide || + (info.channel !== undefined && channel !== info.channel))){ + return this.get(channel); + } else { + //return just the type + return token.type; + } + }, -"use strict"; + /** + * Looks ahead a certain number of tokens and returns the token type at + * that position. This will throw an error if you lookahead past the + * end of input, past the size of the lookahead buffer, or back past + * the first token in the lookahead buffer. + * @param {int} The index of the token type to retrieve. 0 for the + * current token, 1 for the next, -1 for the previous, etc. + * @return {int} The token type of the token in the given position. + * @method LA + */ + LA: function(index){ + var total = index, + tt; + if (index > 0){ + //TODO: Store 5 somewhere + if (index > 5){ + throw new Error("Too much lookahead."); + } + + //get all those tokens + while(total){ + tt = this.get(); + total--; + } + + //unget all those tokens + while(total < index){ + this.unget(); + total++; + } + } else if (index < 0){ + + if(this._lt[this._ltIndex+index]){ + tt = this._lt[this._ltIndex+index].type; + } else { + throw new Error("Too much lookbehind."); + } + + } else { + tt = this._token.type; + } + + return tt; + + }, -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; -var Observable_1 = __webpack_require__(0); -/** - * We need this JSDoc comment for affecting ESDoc. - * @extends {Ignored} - * @hide true - */ -var RangeObservable = (function (_super) { - __extends(RangeObservable, _super); - function RangeObservable(start, count, scheduler) { - _super.call(this); - this.start = start; - this._count = count; - this.scheduler = scheduler; - } /** - * Creates an Observable that emits a sequence of numbers within a specified - * range. - * - * Emits a sequence of numbers in a range. - * - * - * - * `range` operator emits a range of sequential integers, in order, where you - * select the `start` of the range and its `length`. By default, uses no - * IScheduler and just delivers the notifications synchronously, but may use - * an optional IScheduler to regulate those deliveries. - * - * @example Emits the numbers 1 to 10 - * var numbers = Rx.Observable.range(1, 10); - * numbers.subscribe(x => console.log(x)); - * - * @see {@link timer} - * @see {@link interval} - * - * @param {number} [start=0] The value of the first integer in the sequence. - * @param {number} [count=0] The number of sequential integers to generate. - * @param {Scheduler} [scheduler] A {@link IScheduler} to use for scheduling - * the emissions of the notifications. - * @return {Observable} An Observable of numbers that emits a finite range of - * sequential integers. - * @static true - * @name range - * @owner Observable + * Looks ahead a certain number of tokens and returns the token at + * that position. This will throw an error if you lookahead past the + * end of input, past the size of the lookahead buffer, or back past + * the first token in the lookahead buffer. + * @param {int} The index of the token type to retrieve. 0 for the + * current token, 1 for the next, -1 for the previous, etc. + * @return {Object} The token of the token in the given position. + * @method LA + */ + LT: function(index){ + + //lookahead first to prime the token buffer + this.LA(index); + + //now find the token, subtract one because _ltIndex is already at the next index + return this._lt[this._ltIndex+index-1]; + }, + + /** + * Returns the token type for the next token in the stream without + * consuming it. + * @return {int} The token type of the next token in the stream. + * @method peek + */ + peek: function(){ + return this.LA(1); + }, + + /** + * Returns the actual token object for the last consumed token. + * @return {Token} The token object for the last consumed token. + * @method token */ - RangeObservable.create = function (start, count, scheduler) { - if (start === void 0) { start = 0; } - if (count === void 0) { count = 0; } - return new RangeObservable(start, count, scheduler); - }; - RangeObservable.dispatch = function (state) { - var start = state.start, index = state.index, count = state.count, subscriber = state.subscriber; - if (index >= count) { - subscriber.complete(); - return; - } - subscriber.next(start); - if (subscriber.closed) { - return; - } - state.index = index + 1; - state.start = start + 1; - this.schedule(state); - }; - RangeObservable.prototype._subscribe = function (subscriber) { - var index = 0; - var start = this.start; - var count = this._count; - var scheduler = this.scheduler; - if (scheduler) { - return scheduler.schedule(RangeObservable.dispatch, 0, { - index: index, count: count, start: start, subscriber: subscriber - }); + token: function(){ + return this._token; + }, + + /** + * Returns the name of the token for the given token type. + * @param {int} tokenType The type of token to get the name of. + * @return {String} The name of the token or "UNKNOWN_TOKEN" for any + * invalid token type. + * @method tokenName + */ + tokenName: function(tokenType){ + if (tokenType < 0 || tokenType > this._tokenData.length){ + return "UNKNOWN_TOKEN"; + } else { + return this._tokenData[tokenType].name; } - else { - do { - if (index++ >= count) { - subscriber.complete(); - break; - } - subscriber.next(start++); - if (subscriber.closed) { - break; - } - } while (true); + }, + + /** + * Returns the token type value for the given token name. + * @param {String} tokenName The name of the token whose value should be returned. + * @return {int} The token type value for the given token name or -1 + * for an unknown token. + * @method tokenName + */ + tokenType: function(tokenName){ + return this._tokenData[tokenName] || -1; + }, + + /** + * Returns the last consumed token to the token stream. + * @method unget + */ + unget: function(){ + //if (this._ltIndex > -1){ + if (this._ltIndexCache.length){ + this._ltIndex -= this._ltIndexCache.pop();//--; + this._token = this._lt[this._ltIndex - 1]; + } else { + throw new Error("Too much lookahead."); } - }; - return RangeObservable; -}(Observable_1.Observable)); -exports.RangeObservable = RangeObservable; -//# sourceMappingURL=RangeObservable.js.map + } -/***/ }), -/* 258 */ -/***/ (function(module, exports, __webpack_require__) { +}; -"use strict"; -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); +parserlib.util = { +__proto__ : null, +StringReader: StringReader, +SyntaxError : SyntaxError, +SyntaxUnit : SyntaxUnit, +EventTarget : EventTarget, +TokenStreamBase : TokenStreamBase }; -var Observable_1 = __webpack_require__(0); -var asap_1 = __webpack_require__(70); -var isNumeric_1 = __webpack_require__(28); +})(); +/* +Parser-Lib +Copyright (c) 2009-2011 Nicholas C. Zakas. All rights reserved. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. + +*/ +/* Version v0.2.5+domino1, Build time: 30-January-2016 05:13:03 */ +(function(){ +var EventTarget = parserlib.util.EventTarget, +TokenStreamBase = parserlib.util.TokenStreamBase, +StringReader = parserlib.util.StringReader, // jshint ignore:line +SyntaxError = parserlib.util.SyntaxError, +SyntaxUnit = parserlib.util.SyntaxUnit; + +var Colors = { + __proto__ :null, + aliceblue :"#f0f8ff", + antiquewhite :"#faebd7", + aqua :"#00ffff", + aquamarine :"#7fffd4", + azure :"#f0ffff", + beige :"#f5f5dc", + bisque :"#ffe4c4", + black :"#000000", + blanchedalmond :"#ffebcd", + blue :"#0000ff", + blueviolet :"#8a2be2", + brown :"#a52a2a", + burlywood :"#deb887", + cadetblue :"#5f9ea0", + chartreuse :"#7fff00", + chocolate :"#d2691e", + coral :"#ff7f50", + cornflowerblue :"#6495ed", + cornsilk :"#fff8dc", + crimson :"#dc143c", + cyan :"#00ffff", + darkblue :"#00008b", + darkcyan :"#008b8b", + darkgoldenrod :"#b8860b", + darkgray :"#a9a9a9", + darkgrey :"#a9a9a9", + darkgreen :"#006400", + darkkhaki :"#bdb76b", + darkmagenta :"#8b008b", + darkolivegreen :"#556b2f", + darkorange :"#ff8c00", + darkorchid :"#9932cc", + darkred :"#8b0000", + darksalmon :"#e9967a", + darkseagreen :"#8fbc8f", + darkslateblue :"#483d8b", + darkslategray :"#2f4f4f", + darkslategrey :"#2f4f4f", + darkturquoise :"#00ced1", + darkviolet :"#9400d3", + deeppink :"#ff1493", + deepskyblue :"#00bfff", + dimgray :"#696969", + dimgrey :"#696969", + dodgerblue :"#1e90ff", + firebrick :"#b22222", + floralwhite :"#fffaf0", + forestgreen :"#228b22", + fuchsia :"#ff00ff", + gainsboro :"#dcdcdc", + ghostwhite :"#f8f8ff", + gold :"#ffd700", + goldenrod :"#daa520", + gray :"#808080", + grey :"#808080", + green :"#008000", + greenyellow :"#adff2f", + honeydew :"#f0fff0", + hotpink :"#ff69b4", + indianred :"#cd5c5c", + indigo :"#4b0082", + ivory :"#fffff0", + khaki :"#f0e68c", + lavender :"#e6e6fa", + lavenderblush :"#fff0f5", + lawngreen :"#7cfc00", + lemonchiffon :"#fffacd", + lightblue :"#add8e6", + lightcoral :"#f08080", + lightcyan :"#e0ffff", + lightgoldenrodyellow :"#fafad2", + lightgray :"#d3d3d3", + lightgrey :"#d3d3d3", + lightgreen :"#90ee90", + lightpink :"#ffb6c1", + lightsalmon :"#ffa07a", + lightseagreen :"#20b2aa", + lightskyblue :"#87cefa", + lightslategray :"#778899", + lightslategrey :"#778899", + lightsteelblue :"#b0c4de", + lightyellow :"#ffffe0", + lime :"#00ff00", + limegreen :"#32cd32", + linen :"#faf0e6", + magenta :"#ff00ff", + maroon :"#800000", + mediumaquamarine:"#66cdaa", + mediumblue :"#0000cd", + mediumorchid :"#ba55d3", + mediumpurple :"#9370d8", + mediumseagreen :"#3cb371", + mediumslateblue :"#7b68ee", + mediumspringgreen :"#00fa9a", + mediumturquoise :"#48d1cc", + mediumvioletred :"#c71585", + midnightblue :"#191970", + mintcream :"#f5fffa", + mistyrose :"#ffe4e1", + moccasin :"#ffe4b5", + navajowhite :"#ffdead", + navy :"#000080", + oldlace :"#fdf5e6", + olive :"#808000", + olivedrab :"#6b8e23", + orange :"#ffa500", + orangered :"#ff4500", + orchid :"#da70d6", + palegoldenrod :"#eee8aa", + palegreen :"#98fb98", + paleturquoise :"#afeeee", + palevioletred :"#d87093", + papayawhip :"#ffefd5", + peachpuff :"#ffdab9", + peru :"#cd853f", + pink :"#ffc0cb", + plum :"#dda0dd", + powderblue :"#b0e0e6", + purple :"#800080", + red :"#ff0000", + rosybrown :"#bc8f8f", + royalblue :"#4169e1", + saddlebrown :"#8b4513", + salmon :"#fa8072", + sandybrown :"#f4a460", + seagreen :"#2e8b57", + seashell :"#fff5ee", + sienna :"#a0522d", + silver :"#c0c0c0", + skyblue :"#87ceeb", + slateblue :"#6a5acd", + slategray :"#708090", + slategrey :"#708090", + snow :"#fffafa", + springgreen :"#00ff7f", + steelblue :"#4682b4", + tan :"#d2b48c", + teal :"#008080", + thistle :"#d8bfd8", + tomato :"#ff6347", + turquoise :"#40e0d0", + violet :"#ee82ee", + wheat :"#f5deb3", + white :"#ffffff", + whitesmoke :"#f5f5f5", + yellow :"#ffff00", + yellowgreen :"#9acd32", + //'currentColor' color keyword http://www.w3.org/TR/css3-color/#currentcolor + currentColor :"The value of the 'color' property.", + //CSS2 system colors http://www.w3.org/TR/css3-color/#css2-system + activeBorder :"Active window border.", + activecaption :"Active window caption.", + appworkspace :"Background color of multiple document interface.", + background :"Desktop background.", + buttonface :"The face background color for 3-D elements that appear 3-D due to one layer of surrounding border.", + buttonhighlight :"The color of the border facing the light source for 3-D elements that appear 3-D due to one layer of surrounding border.", + buttonshadow :"The color of the border away from the light source for 3-D elements that appear 3-D due to one layer of surrounding border.", + buttontext :"Text on push buttons.", + captiontext :"Text in caption, size box, and scrollbar arrow box.", + graytext :"Grayed (disabled) text. This color is set to #000 if the current display driver does not support a solid gray color.", + greytext :"Greyed (disabled) text. This color is set to #000 if the current display driver does not support a solid grey color.", + highlight :"Item(s) selected in a control.", + highlighttext :"Text of item(s) selected in a control.", + inactiveborder :"Inactive window border.", + inactivecaption :"Inactive window caption.", + inactivecaptiontext :"Color of text in an inactive caption.", + infobackground :"Background color for tooltip controls.", + infotext :"Text color for tooltip controls.", + menu :"Menu background.", + menutext :"Text in menus.", + scrollbar :"Scroll bar gray area.", + threeddarkshadow :"The color of the darker (generally outer) of the two borders away from the light source for 3-D elements that appear 3-D due to two concentric layers of surrounding border.", + threedface :"The face background color for 3-D elements that appear 3-D due to two concentric layers of surrounding border.", + threedhighlight :"The color of the lighter (generally outer) of the two borders facing the light source for 3-D elements that appear 3-D due to two concentric layers of surrounding border.", + threedlightshadow :"The color of the darker (generally inner) of the two borders facing the light source for 3-D elements that appear 3-D due to two concentric layers of surrounding border.", + threedshadow :"The color of the lighter (generally inner) of the two borders away from the light source for 3-D elements that appear 3-D due to two concentric layers of surrounding border.", + window :"Window background.", + windowframe :"Window frame.", + windowtext :"Text in windows." +}; +/** + * Represents a selector combinator (whitespace, +, >). + * @namespace parserlib.css + * @class Combinator + * @extends parserlib.util.SyntaxUnit + * @constructor + * @param {String} text The text representation of the unit. + * @param {int} line The line of text on which the unit resides. + * @param {int} col The column of text on which the unit resides. + */ +function Combinator(text, line, col){ + + SyntaxUnit.call(this, text, line, col, Parser.COMBINATOR_TYPE); + + /** + * The type of modifier. + * @type String + * @property type + */ + this.type = "unknown"; + + //pretty simple + if (/^\s+$/.test(text)){ + this.type = "descendant"; + } else if (text === ">"){ + this.type = "child"; + } else if (text === "+"){ + this.type = "adjacent-sibling"; + } else if (text === "~"){ + this.type = "sibling"; + } + +} + +Combinator.prototype = new SyntaxUnit(); +Combinator.prototype.constructor = Combinator; + /** - * We need this JSDoc comment for affecting ESDoc. - * @extends {Ignored} - * @hide true + * Represents a media feature, such as max-width:500. + * @namespace parserlib.css + * @class MediaFeature + * @extends parserlib.util.SyntaxUnit + * @constructor + * @param {SyntaxUnit} name The name of the feature. + * @param {SyntaxUnit} value The value of the feature or null if none. */ -var SubscribeOnObservable = (function (_super) { - __extends(SubscribeOnObservable, _super); - function SubscribeOnObservable(source, delayTime, scheduler) { - if (delayTime === void 0) { delayTime = 0; } - if (scheduler === void 0) { scheduler = asap_1.asap; } - _super.call(this); - this.source = source; - this.delayTime = delayTime; - this.scheduler = scheduler; - if (!isNumeric_1.isNumeric(delayTime) || delayTime < 0) { - this.delayTime = 0; - } - if (!scheduler || typeof scheduler.schedule !== 'function') { - this.scheduler = asap_1.asap; - } - } - SubscribeOnObservable.create = function (source, delay, scheduler) { - if (delay === void 0) { delay = 0; } - if (scheduler === void 0) { scheduler = asap_1.asap; } - return new SubscribeOnObservable(source, delay, scheduler); - }; - SubscribeOnObservable.dispatch = function (arg) { - var source = arg.source, subscriber = arg.subscriber; - return this.add(source.subscribe(subscriber)); - }; - SubscribeOnObservable.prototype._subscribe = function (subscriber) { - var delay = this.delayTime; - var source = this.source; - var scheduler = this.scheduler; - return scheduler.schedule(SubscribeOnObservable.dispatch, delay, { - source: source, subscriber: subscriber - }); - }; - return SubscribeOnObservable; -}(Observable_1.Observable)); -exports.SubscribeOnObservable = SubscribeOnObservable; -//# sourceMappingURL=SubscribeOnObservable.js.map +function MediaFeature(name, value){ -/***/ }), -/* 259 */ -/***/ (function(module, exports, __webpack_require__) { + SyntaxUnit.call(this, "(" + name + (value !== null ? ":" + value : "") + ")", name.startLine, name.startCol, Parser.MEDIA_FEATURE_TYPE); -"use strict"; + /** + * The name of the media feature + * @type String + * @property name + */ + this.name = name; + + /** + * The value for the feature or null if there is none. + * @type SyntaxUnit + * @property value + */ + this.value = value; +} + +MediaFeature.prototype = new SyntaxUnit(); +MediaFeature.prototype.constructor = MediaFeature; -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; -var isNumeric_1 = __webpack_require__(28); -var Observable_1 = __webpack_require__(0); -var async_1 = __webpack_require__(8); -var isScheduler_1 = __webpack_require__(13); -var isDate_1 = __webpack_require__(27); /** - * We need this JSDoc comment for affecting ESDoc. - * @extends {Ignored} - * @hide true + * Represents an individual media query. + * @namespace parserlib.css + * @class MediaQuery + * @extends parserlib.util.SyntaxUnit + * @constructor + * @param {String} modifier The modifier "not" or "only" (or null). + * @param {String} mediaType The type of media (i.e., "print"). + * @param {Array} parts Array of selectors parts making up this selector. + * @param {int} line The line of text on which the unit resides. + * @param {int} col The column of text on which the unit resides. */ -var TimerObservable = (function (_super) { - __extends(TimerObservable, _super); - function TimerObservable(dueTime, period, scheduler) { - if (dueTime === void 0) { dueTime = 0; } - _super.call(this); - this.period = -1; - this.dueTime = 0; - if (isNumeric_1.isNumeric(period)) { - this.period = Number(period) < 1 && 1 || Number(period); - } - else if (isScheduler_1.isScheduler(period)) { - scheduler = period; - } - if (!isScheduler_1.isScheduler(scheduler)) { - scheduler = async_1.async; - } - this.scheduler = scheduler; - this.dueTime = isDate_1.isDate(dueTime) ? - (+dueTime - this.scheduler.now()) : - dueTime; - } +function MediaQuery(modifier, mediaType, features, line, col){ + + SyntaxUnit.call(this, (modifier ? modifier + " ": "") + (mediaType ? mediaType : "") + (mediaType && features.length > 0 ? " and " : "") + features.join(" and "), line, col, Parser.MEDIA_QUERY_TYPE); + /** - * Creates an Observable that starts emitting after an `initialDelay` and - * emits ever increasing numbers after each `period` of time thereafter. - * - * Its like {@link interval}, but you can specify when - * should the emissions start. - * - * - * - * `timer` returns an Observable that emits an infinite sequence of ascending - * integers, with a constant interval of time, `period` of your choosing - * between those emissions. The first emission happens after the specified - * `initialDelay`. The initial delay may be a {@link Date}. By default, this - * operator uses the `async` IScheduler to provide a notion of time, but you - * may pass any IScheduler to it. If `period` is not specified, the output - * Observable emits only one value, `0`. Otherwise, it emits an infinite - * sequence. - * - * @example Emits ascending numbers, one every second (1000ms), starting after 3 seconds - * var numbers = Rx.Observable.timer(3000, 1000); - * numbers.subscribe(x => console.log(x)); - * - * @example Emits one number after five seconds - * var numbers = Rx.Observable.timer(5000); - * numbers.subscribe(x => console.log(x)); - * - * @see {@link interval} - * @see {@link delay} - * - * @param {number|Date} initialDelay The initial delay time to wait before - * emitting the first value of `0`. - * @param {number} [period] The period of time between emissions of the - * subsequent numbers. - * @param {Scheduler} [scheduler=async] The IScheduler to use for scheduling - * the emission of values, and providing a notion of "time". - * @return {Observable} An Observable that emits a `0` after the - * `initialDelay` and ever increasing numbers after each `period` of time - * thereafter. - * @static true - * @name timer - * @owner Observable + * The media modifier ("not" or "only") + * @type String + * @property modifier */ - TimerObservable.create = function (initialDelay, period, scheduler) { - if (initialDelay === void 0) { initialDelay = 0; } - return new TimerObservable(initialDelay, period, scheduler); - }; - TimerObservable.dispatch = function (state) { - var index = state.index, period = state.period, subscriber = state.subscriber; - var action = this; - subscriber.next(index); - if (subscriber.closed) { - return; - } - else if (period === -1) { - return subscriber.complete(); - } - state.index = index + 1; - action.schedule(state, period); - }; - TimerObservable.prototype._subscribe = function (subscriber) { - var index = 0; - var _a = this, period = _a.period, dueTime = _a.dueTime, scheduler = _a.scheduler; - return scheduler.schedule(TimerObservable.dispatch, dueTime, { - index: index, period: period, subscriber: subscriber - }); - }; - return TimerObservable; -}(Observable_1.Observable)); -exports.TimerObservable = TimerObservable; -//# sourceMappingURL=TimerObservable.js.map + this.modifier = modifier; + + /** + * The mediaType (i.e., "print") + * @type String + * @property mediaType + */ + this.mediaType = mediaType; + + /** + * The parts that make up the selector. + * @type Array + * @property features + */ + this.features = features; + +} + +MediaQuery.prototype = new SyntaxUnit(); +MediaQuery.prototype.constructor = MediaQuery; + + +/** + * A CSS3 parser. + * @namespace parserlib.css + * @class Parser + * @constructor + * @param {Object} options (Optional) Various options for the parser: + * starHack (true|false) to allow IE6 star hack as valid, + * underscoreHack (true|false) to interpret leading underscores + * as IE6-7 targeting for known properties, ieFilters (true|false) + * to indicate that IE < 8 filters should be accepted and not throw + * syntax errors. + */ +function Parser(options){ + + //inherit event functionality + EventTarget.call(this); + + + this.options = options || {}; + + this._tokenStream = null; +} + +//Static constants +Parser.DEFAULT_TYPE = 0; +Parser.COMBINATOR_TYPE = 1; +Parser.MEDIA_FEATURE_TYPE = 2; +Parser.MEDIA_QUERY_TYPE = 3; +Parser.PROPERTY_NAME_TYPE = 4; +Parser.PROPERTY_VALUE_TYPE = 5; +Parser.PROPERTY_VALUE_PART_TYPE = 6; +Parser.SELECTOR_TYPE = 7; +Parser.SELECTOR_PART_TYPE = 8; +Parser.SELECTOR_SUB_PART_TYPE = 9; + +Parser.prototype = function(){ + + var proto = new EventTarget(), //new prototype + prop, + additions = { + __proto__: null, + + //restore constructor + constructor: Parser, + + //instance constants - yuck + DEFAULT_TYPE : 0, + COMBINATOR_TYPE : 1, + MEDIA_FEATURE_TYPE : 2, + MEDIA_QUERY_TYPE : 3, + PROPERTY_NAME_TYPE : 4, + PROPERTY_VALUE_TYPE : 5, + PROPERTY_VALUE_PART_TYPE : 6, + SELECTOR_TYPE : 7, + SELECTOR_PART_TYPE : 8, + SELECTOR_SUB_PART_TYPE : 9, + + //----------------------------------------------------------------- + // Grammar + //----------------------------------------------------------------- + + _stylesheet: function(){ + + /* + * stylesheet + * : [ CHARSET_SYM S* STRING S* ';' ]? + * [S|CDO|CDC]* [ import [S|CDO|CDC]* ]* + * [ namespace [S|CDO|CDC]* ]* + * [ [ ruleset | media | page | font_face | keyframes ] [S|CDO|CDC]* ]* + * ; + */ + + var tokenStream = this._tokenStream, + count, + token, + tt; + + this.fire("startstylesheet"); + + //try to read character set + this._charset(); + + this._skipCruft(); + + //try to read imports - may be more than one + while (tokenStream.peek() === Tokens.IMPORT_SYM){ + this._import(); + this._skipCruft(); + } + + //try to read namespaces - may be more than one + while (tokenStream.peek() === Tokens.NAMESPACE_SYM){ + this._namespace(); + this._skipCruft(); + } + + //get the next token + tt = tokenStream.peek(); + + //try to read the rest + while(tt > Tokens.EOF){ + + try { + + switch(tt){ + case Tokens.MEDIA_SYM: + this._media(); + this._skipCruft(); + break; + case Tokens.PAGE_SYM: + this._page(); + this._skipCruft(); + break; + case Tokens.FONT_FACE_SYM: + this._font_face(); + this._skipCruft(); + break; + case Tokens.KEYFRAMES_SYM: + this._keyframes(); + this._skipCruft(); + break; + case Tokens.VIEWPORT_SYM: + this._viewport(); + this._skipCruft(); + break; + case Tokens.DOCUMENT_SYM: + this._document(); + this._skipCruft(); + break; + case Tokens.UNKNOWN_SYM: //unknown @ rule + tokenStream.get(); + if (!this.options.strict){ + + //fire error event + this.fire({ + type: "error", + error: null, + message: "Unknown @ rule: " + tokenStream.LT(0).value + ".", + line: tokenStream.LT(0).startLine, + col: tokenStream.LT(0).startCol + }); + + //skip braces + count=0; + while (tokenStream.advance([Tokens.LBRACE, Tokens.RBRACE]) === Tokens.LBRACE){ + count++; //keep track of nesting depth + } + + while(count){ + tokenStream.advance([Tokens.RBRACE]); + count--; + } + + } else { + //not a syntax error, rethrow it + throw new SyntaxError("Unknown @ rule.", tokenStream.LT(0).startLine, tokenStream.LT(0).startCol); + } + break; + case Tokens.S: + this._readWhitespace(); + break; + default: + if(!this._ruleset()){ + + //error handling for known issues + switch(tt){ + case Tokens.CHARSET_SYM: + token = tokenStream.LT(1); + this._charset(false); + throw new SyntaxError("@charset not allowed here.", token.startLine, token.startCol); + case Tokens.IMPORT_SYM: + token = tokenStream.LT(1); + this._import(false); + throw new SyntaxError("@import not allowed here.", token.startLine, token.startCol); + case Tokens.NAMESPACE_SYM: + token = tokenStream.LT(1); + this._namespace(false); + throw new SyntaxError("@namespace not allowed here.", token.startLine, token.startCol); + default: + tokenStream.get(); //get the last token + this._unexpectedToken(tokenStream.token()); + } + + } + } + } catch(ex) { + if (ex instanceof SyntaxError && !this.options.strict){ + this.fire({ + type: "error", + error: ex, + message: ex.message, + line: ex.line, + col: ex.col + }); + } else { + throw ex; + } + } + + tt = tokenStream.peek(); + } + + if (tt !== Tokens.EOF){ + this._unexpectedToken(tokenStream.token()); + } + + this.fire("endstylesheet"); + }, + + _charset: function(emit){ + var tokenStream = this._tokenStream, + charset, + token, + line, + col; + + if (tokenStream.match(Tokens.CHARSET_SYM)){ + line = tokenStream.token().startLine; + col = tokenStream.token().startCol; + + this._readWhitespace(); + tokenStream.mustMatch(Tokens.STRING); + + token = tokenStream.token(); + charset = token.value; + + this._readWhitespace(); + tokenStream.mustMatch(Tokens.SEMICOLON); + + if (emit !== false){ + this.fire({ + type: "charset", + charset:charset, + line: line, + col: col + }); + } + } + }, + + _import: function(emit){ + /* + * import + * : IMPORT_SYM S* + * [STRING|URI] S* media_query_list? ';' S* + */ + + var tokenStream = this._tokenStream, + uri, + importToken, + mediaList = []; + + //read import symbol + tokenStream.mustMatch(Tokens.IMPORT_SYM); + importToken = tokenStream.token(); + this._readWhitespace(); + + tokenStream.mustMatch([Tokens.STRING, Tokens.URI]); + + //grab the URI value + uri = tokenStream.token().value.replace(/^(?:url\()?["']?([^"']+?)["']?\)?$/, "$1"); + + this._readWhitespace(); + + mediaList = this._media_query_list(); + + //must end with a semicolon + tokenStream.mustMatch(Tokens.SEMICOLON); + this._readWhitespace(); + + if (emit !== false){ + this.fire({ + type: "import", + uri: uri, + media: mediaList, + line: importToken.startLine, + col: importToken.startCol + }); + } + + }, + + _namespace: function(emit){ + /* + * namespace + * : NAMESPACE_SYM S* [namespace_prefix S*]? [STRING|URI] S* ';' S* + */ + + var tokenStream = this._tokenStream, + line, + col, + prefix, + uri; + + //read import symbol + tokenStream.mustMatch(Tokens.NAMESPACE_SYM); + line = tokenStream.token().startLine; + col = tokenStream.token().startCol; + this._readWhitespace(); + + //it's a namespace prefix - no _namespace_prefix() method because it's just an IDENT + if (tokenStream.match(Tokens.IDENT)){ + prefix = tokenStream.token().value; + this._readWhitespace(); + } + + tokenStream.mustMatch([Tokens.STRING, Tokens.URI]); + /*if (!tokenStream.match(Tokens.STRING)){ + tokenStream.mustMatch(Tokens.URI); + }*/ + + //grab the URI value + uri = tokenStream.token().value.replace(/(?:url\()?["']([^"']+)["']\)?/, "$1"); + + this._readWhitespace(); + + //must end with a semicolon + tokenStream.mustMatch(Tokens.SEMICOLON); + this._readWhitespace(); + + if (emit !== false){ + this.fire({ + type: "namespace", + prefix: prefix, + uri: uri, + line: line, + col: col + }); + } + + }, + + _media: function(){ + /* + * media + * : MEDIA_SYM S* media_query_list S* '{' S* ruleset* '}' S* + * ; + */ + var tokenStream = this._tokenStream, + line, + col, + mediaList;// = []; + + //look for @media + tokenStream.mustMatch(Tokens.MEDIA_SYM); + line = tokenStream.token().startLine; + col = tokenStream.token().startCol; + + this._readWhitespace(); + + mediaList = this._media_query_list(); + + tokenStream.mustMatch(Tokens.LBRACE); + this._readWhitespace(); + + this.fire({ + type: "startmedia", + media: mediaList, + line: line, + col: col + }); + + while(true) { + if (tokenStream.peek() === Tokens.PAGE_SYM){ + this._page(); + } else if (tokenStream.peek() === Tokens.FONT_FACE_SYM){ + this._font_face(); + } else if (tokenStream.peek() === Tokens.VIEWPORT_SYM){ + this._viewport(); + } else if (tokenStream.peek() === Tokens.DOCUMENT_SYM){ + this._document(); + } else if (!this._ruleset()){ + break; + } + } + + tokenStream.mustMatch(Tokens.RBRACE); + this._readWhitespace(); + + this.fire({ + type: "endmedia", + media: mediaList, + line: line, + col: col + }); + }, -/***/ }), -/* 260 */ -/***/ (function(module, exports, __webpack_require__) { -"use strict"; + //CSS3 Media Queries + _media_query_list: function(){ + /* + * media_query_list + * : S* [media_query [ ',' S* media_query ]* ]? + * ; + */ + var tokenStream = this._tokenStream, + mediaList = []; -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; -var Observable_1 = __webpack_require__(0); -var subscribeToResult_1 = __webpack_require__(3); -var OuterSubscriber_1 = __webpack_require__(4); -/** - * We need this JSDoc comment for affecting ESDoc. - * @extends {Ignored} - * @hide true - */ -var UsingObservable = (function (_super) { - __extends(UsingObservable, _super); - function UsingObservable(resourceFactory, observableFactory) { - _super.call(this); - this.resourceFactory = resourceFactory; - this.observableFactory = observableFactory; - } - UsingObservable.create = function (resourceFactory, observableFactory) { - return new UsingObservable(resourceFactory, observableFactory); - }; - UsingObservable.prototype._subscribe = function (subscriber) { - var _a = this, resourceFactory = _a.resourceFactory, observableFactory = _a.observableFactory; - var resource; - try { - resource = resourceFactory(); - return new UsingSubscriber(subscriber, resource, observableFactory); - } - catch (err) { - subscriber.error(err); - } - }; - return UsingObservable; -}(Observable_1.Observable)); -exports.UsingObservable = UsingObservable; -var UsingSubscriber = (function (_super) { - __extends(UsingSubscriber, _super); - function UsingSubscriber(destination, resource, observableFactory) { - _super.call(this, destination); - this.resource = resource; - this.observableFactory = observableFactory; - destination.add(resource); - this.tryUse(); - } - UsingSubscriber.prototype.tryUse = function () { - try { - var source = this.observableFactory.call(this, this.resource); - if (source) { - this.add(subscribeToResult_1.subscribeToResult(this, source)); - } - } - catch (err) { - this._error(err); - } - }; - return UsingSubscriber; -}(OuterSubscriber_1.OuterSubscriber)); -//# sourceMappingURL=UsingObservable.js.map -/***/ }), -/* 261 */ -/***/ (function(module, exports, __webpack_require__) { + this._readWhitespace(); -"use strict"; + if (tokenStream.peek() === Tokens.IDENT || tokenStream.peek() === Tokens.LPAREN){ + mediaList.push(this._media_query()); + } -var BoundCallbackObservable_1 = __webpack_require__(246); -exports.bindCallback = BoundCallbackObservable_1.BoundCallbackObservable.create; -//# sourceMappingURL=bindCallback.js.map + while(tokenStream.match(Tokens.COMMA)){ + this._readWhitespace(); + mediaList.push(this._media_query()); + } -/***/ }), -/* 262 */ -/***/ (function(module, exports, __webpack_require__) { + return mediaList; + }, -"use strict"; + /* + * Note: "expression" in the grammar maps to the _media_expression + * method. -var BoundNodeCallbackObservable_1 = __webpack_require__(247); -exports.bindNodeCallback = BoundNodeCallbackObservable_1.BoundNodeCallbackObservable.create; -//# sourceMappingURL=bindNodeCallback.js.map + */ + _media_query: function(){ + /* + * media_query + * : [ONLY | NOT]? S* media_type S* [ AND S* expression ]* + * | expression [ AND S* expression ]* + * ; + */ + var tokenStream = this._tokenStream, + type = null, + ident = null, + token = null, + expressions = []; + + if (tokenStream.match(Tokens.IDENT)){ + ident = tokenStream.token().value.toLowerCase(); + + //since there's no custom tokens for these, need to manually check + if (ident !== "only" && ident !== "not"){ + tokenStream.unget(); + ident = null; + } else { + token = tokenStream.token(); + } + } -/***/ }), -/* 263 */ -/***/ (function(module, exports, __webpack_require__) { + this._readWhitespace(); -"use strict"; + if (tokenStream.peek() === Tokens.IDENT){ + type = this._media_type(); + if (token === null){ + token = tokenStream.token(); + } + } else if (tokenStream.peek() === Tokens.LPAREN){ + if (token === null){ + token = tokenStream.LT(1); + } + expressions.push(this._media_expression()); + } -var isScheduler_1 = __webpack_require__(13); -var isArray_1 = __webpack_require__(15); -var ArrayObservable_1 = __webpack_require__(14); -var combineLatest_1 = __webpack_require__(37); -/* tslint:enable:max-line-length */ -/** - * Combines multiple Observables to create an Observable whose values are - * calculated from the latest values of each of its input Observables. - * - * Whenever any input Observable emits a value, it - * computes a formula using the latest values from all the inputs, then emits - * the output of that formula. - * - * - * - * `combineLatest` combines the values from all the Observables passed as - * arguments. This is done by subscribing to each Observable in order and, - * whenever any Observable emits, collecting an array of the most recent - * values from each Observable. So if you pass `n` Observables to operator, - * returned Observable will always emit an array of `n` values, in order - * corresponding to order of passed Observables (value from the first Observable - * on the first place and so on). - * - * Static version of `combineLatest` accepts either an array of Observables - * or each Observable can be put directly as an argument. Note that array of - * Observables is good choice, if you don't know beforehand how many Observables - * you will combine. Passing empty array will result in Observable that - * completes immediately. - * - * To ensure output array has always the same length, `combineLatest` will - * actually wait for all input Observables to emit at least once, - * before it starts emitting results. This means if some Observable emits - * values before other Observables started emitting, all that values but last - * will be lost. On the other hand, is some Observable does not emit value but - * completes, resulting Observable will complete at the same moment without - * emitting anything, since it will be now impossible to include value from - * completed Observable in resulting array. Also, if some input Observable does - * not emit any value and never completes, `combineLatest` will also never emit - * and never complete, since, again, it will wait for all streams to emit some - * value. - * - * If at least one Observable was passed to `combineLatest` and all passed Observables - * emitted something, resulting Observable will complete when all combined - * streams complete. So even if some Observable completes, result of - * `combineLatest` will still emit values when other Observables do. In case - * of completed Observable, its value from now on will always be the last - * emitted value. On the other hand, if any Observable errors, `combineLatest` - * will error immediately as well, and all other Observables will be unsubscribed. - * - * `combineLatest` accepts as optional parameter `project` function, which takes - * as arguments all values that would normally be emitted by resulting Observable. - * `project` can return any kind of value, which will be then emitted by Observable - * instead of default array. Note that `project` does not take as argument that array - * of values, but values themselves. That means default `project` can be imagined - * as function that takes all its arguments and puts them into an array. - * - * - * @example Combine two timer Observables - * const firstTimer = Rx.Observable.timer(0, 1000); // emit 0, 1, 2... after every second, starting from now - * const secondTimer = Rx.Observable.timer(500, 1000); // emit 0, 1, 2... after every second, starting 0,5s from now - * const combinedTimers = Rx.Observable.combineLatest(firstTimer, secondTimer); - * combinedTimers.subscribe(value => console.log(value)); - * // Logs - * // [0, 0] after 0.5s - * // [1, 0] after 1s - * // [1, 1] after 1.5s - * // [2, 1] after 2s - * - * - * @example Combine an array of Observables - * const observables = [1, 5, 10].map( - * n => Rx.Observable.of(n).delay(n * 1000).startWith(0) // emit 0 and then emit n after n seconds - * ); - * const combined = Rx.Observable.combineLatest(observables); - * combined.subscribe(value => console.log(value)); - * // Logs - * // [0, 0, 0] immediately - * // [1, 0, 0] after 1s - * // [1, 5, 0] after 5s - * // [1, 5, 10] after 10s - * - * - * @example Use project function to dynamically calculate the Body-Mass Index - * var weight = Rx.Observable.of(70, 72, 76, 79, 75); - * var height = Rx.Observable.of(1.76, 1.77, 1.78); - * var bmi = Rx.Observable.combineLatest(weight, height, (w, h) => w / (h * h)); - * bmi.subscribe(x => console.log('BMI is ' + x)); - * - * // With output to console: - * // BMI is 24.212293388429753 - * // BMI is 23.93948099205209 - * // BMI is 23.671253629592222 - * - * - * @see {@link combineAll} - * @see {@link merge} - * @see {@link withLatestFrom} - * - * @param {ObservableInput} observable1 An input Observable to combine with other Observables. - * @param {ObservableInput} observable2 An input Observable to combine with other Observables. - * More than one input Observables may be given as arguments - * or an array of Observables may be given as the first argument. - * @param {function} [project] An optional function to project the values from - * the combined latest values into a new value on the output Observable. - * @param {Scheduler} [scheduler=null] The IScheduler to use for subscribing to - * each input Observable. - * @return {Observable} An Observable of projected values from the most recent - * values from each input Observable, or an array of the most recent values from - * each input Observable. - * @static true - * @name combineLatest - * @owner Observable - */ -function combineLatest() { - var observables = []; - for (var _i = 0; _i < arguments.length; _i++) { - observables[_i - 0] = arguments[_i]; - } - var project = null; - var scheduler = null; - if (isScheduler_1.isScheduler(observables[observables.length - 1])) { - scheduler = observables.pop(); - } - if (typeof observables[observables.length - 1] === 'function') { - project = observables.pop(); - } - // if the first and only other argument besides the resultSelector is an array - // assume it's been called with `combineLatest([obs1, obs2, obs3], project)` - if (observables.length === 1 && isArray_1.isArray(observables[0])) { - observables = observables[0]; - } - return new ArrayObservable_1.ArrayObservable(observables, scheduler).lift(new combineLatest_1.CombineLatestOperator(project)); -} -exports.combineLatest = combineLatest; -//# sourceMappingURL=combineLatest.js.map + if (type === null && expressions.length === 0){ + return null; + } else { + this._readWhitespace(); + while (tokenStream.match(Tokens.IDENT)){ + if (tokenStream.token().value.toLowerCase() !== "and"){ + this._unexpectedToken(tokenStream.token()); + } -/***/ }), -/* 264 */ -/***/ (function(module, exports, __webpack_require__) { + this._readWhitespace(); + expressions.push(this._media_expression()); + } + } -"use strict"; + return new MediaQuery(ident, type, expressions, token.startLine, token.startCol); + }, -var concat_1 = __webpack_require__(38); -exports.concat = concat_1.concatStatic; -//# sourceMappingURL=concat.js.map + //CSS3 Media Queries + _media_type: function(){ + /* + * media_type + * : IDENT + * ; + */ + return this._media_feature(); + }, -/***/ }), -/* 265 */ -/***/ (function(module, exports, __webpack_require__) { + /** + * Note: in CSS3 Media Queries, this is called "expression". + * Renamed here to avoid conflict with CSS3 Selectors + * definition of "expression". Also note that "expr" in the + * grammar now maps to "expression" from CSS3 selectors. + * @method _media_expression + * @private + */ + _media_expression: function(){ + /* + * expression + * : '(' S* media_feature S* [ ':' S* expr ]? ')' S* + * ; + */ + var tokenStream = this._tokenStream, + feature = null, + token, + expression = null; + + tokenStream.mustMatch(Tokens.LPAREN); + + feature = this._media_feature(); + this._readWhitespace(); + + if (tokenStream.match(Tokens.COLON)){ + this._readWhitespace(); + token = tokenStream.LT(1); + expression = this._expression(); + } -"use strict"; + tokenStream.mustMatch(Tokens.RPAREN); + this._readWhitespace(); -var DeferObservable_1 = __webpack_require__(248); -exports.defer = DeferObservable_1.DeferObservable.create; -//# sourceMappingURL=defer.js.map + return new MediaFeature(feature, (expression ? new SyntaxUnit(expression, token.startLine, token.startCol) : null)); + }, -/***/ }), -/* 266 */ -/***/ (function(module, exports, __webpack_require__) { + //CSS3 Media Queries + _media_feature: function(){ + /* + * media_feature + * : IDENT + * ; + */ + var tokenStream = this._tokenStream; -"use strict"; + this._readWhitespace(); -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; -var Subject_1 = __webpack_require__(6); -var Subscriber_1 = __webpack_require__(2); -var Observable_1 = __webpack_require__(0); -var Subscription_1 = __webpack_require__(9); -var root_1 = __webpack_require__(12); -var ReplaySubject_1 = __webpack_require__(26); -var tryCatch_1 = __webpack_require__(7); -var errorObject_1 = __webpack_require__(5); -var assign_1 = __webpack_require__(373); -/** - * We need this JSDoc comment for affecting ESDoc. - * @extends {Ignored} - * @hide true - */ -var WebSocketSubject = (function (_super) { - __extends(WebSocketSubject, _super); - function WebSocketSubject(urlConfigOrSource, destination) { - if (urlConfigOrSource instanceof Observable_1.Observable) { - _super.call(this, destination, urlConfigOrSource); - } - else { - _super.call(this); - this.WebSocketCtor = root_1.root.WebSocket; - this._output = new Subject_1.Subject(); - if (typeof urlConfigOrSource === 'string') { - this.url = urlConfigOrSource; - } - else { - // WARNING: config object could override important members here. - assign_1.assign(this, urlConfigOrSource); - } - if (!this.WebSocketCtor) { - throw new Error('no WebSocket constructor can be found'); - } - this.destination = new ReplaySubject_1.ReplaySubject(); - } - } - WebSocketSubject.prototype.resultSelector = function (e) { - return JSON.parse(e.data); - }; - /** - * Wrapper around the w3c-compatible WebSocket object provided by the browser. - * - * @example Wraps browser WebSocket - * - * let socket$ = Observable.webSocket('ws://localhost:8081'); - * - * socket$.subscribe( - * (msg) => console.log('message received: ' + msg), - * (err) => console.log(err), - * () => console.log('complete') - * ); - * - * socket$.next(JSON.stringify({ op: 'hello' })); - * - * @example Wraps WebSocket from nodejs-websocket (using node.js) - * - * import { w3cwebsocket } from 'websocket'; - * - * let socket$ = Observable.webSocket({ - * url: 'ws://localhost:8081', - * WebSocketCtor: w3cwebsocket - * }); - * - * socket$.subscribe( - * (msg) => console.log('message received: ' + msg), - * (err) => console.log(err), - * () => console.log('complete') - * ); - * - * socket$.next(JSON.stringify({ op: 'hello' })); - * - * @param {string | WebSocketSubjectConfig} urlConfigOrSource the source of the websocket as an url or a structure defining the websocket object - * @return {WebSocketSubject} - * @static true - * @name webSocket - * @owner Observable - */ - WebSocketSubject.create = function (urlConfigOrSource) { - return new WebSocketSubject(urlConfigOrSource); - }; - WebSocketSubject.prototype.lift = function (operator) { - var sock = new WebSocketSubject(this, this.destination); - sock.operator = operator; - return sock; - }; - WebSocketSubject.prototype._resetState = function () { - this.socket = null; - if (!this.source) { - this.destination = new ReplaySubject_1.ReplaySubject(); - } - this._output = new Subject_1.Subject(); - }; - // TODO: factor this out to be a proper Operator/Subscriber implementation and eliminate closures - WebSocketSubject.prototype.multiplex = function (subMsg, unsubMsg, messageFilter) { - var self = this; - return new Observable_1.Observable(function (observer) { - var result = tryCatch_1.tryCatch(subMsg)(); - if (result === errorObject_1.errorObject) { - observer.error(errorObject_1.errorObject.e); - } - else { - self.next(result); - } - var subscription = self.subscribe(function (x) { - var result = tryCatch_1.tryCatch(messageFilter)(x); - if (result === errorObject_1.errorObject) { - observer.error(errorObject_1.errorObject.e); + tokenStream.mustMatch(Tokens.IDENT); + + return SyntaxUnit.fromToken(tokenStream.token()); + }, + + //CSS3 Paged Media + _page: function(){ + /* + * page: + * PAGE_SYM S* IDENT? pseudo_page? S* + * '{' S* [ declaration | margin ]? [ ';' S* [ declaration | margin ]? ]* '}' S* + * ; + */ + var tokenStream = this._tokenStream, + line, + col, + identifier = null, + pseudoPage = null; + + //look for @page + tokenStream.mustMatch(Tokens.PAGE_SYM); + line = tokenStream.token().startLine; + col = tokenStream.token().startCol; + + this._readWhitespace(); + + if (tokenStream.match(Tokens.IDENT)){ + identifier = tokenStream.token().value; + + //The value 'auto' may not be used as a page name and MUST be treated as a syntax error. + if (identifier.toLowerCase() === "auto"){ + this._unexpectedToken(tokenStream.token()); + } } - else if (result) { - observer.next(x); + + //see if there's a colon upcoming + if (tokenStream.peek() === Tokens.COLON){ + pseudoPage = this._pseudo_page(); } - }, function (err) { return observer.error(err); }, function () { return observer.complete(); }); - return function () { - var result = tryCatch_1.tryCatch(unsubMsg)(); - if (result === errorObject_1.errorObject) { - observer.error(errorObject_1.errorObject.e); + + this._readWhitespace(); + + this.fire({ + type: "startpage", + id: identifier, + pseudo: pseudoPage, + line: line, + col: col + }); + + this._readDeclarations(true, true); + + this.fire({ + type: "endpage", + id: identifier, + pseudo: pseudoPage, + line: line, + col: col + }); + + }, + + //CSS3 Paged Media + _margin: function(){ + /* + * margin : + * margin_sym S* '{' declaration [ ';' S* declaration? ]* '}' S* + * ; + */ + var tokenStream = this._tokenStream, + line, + col, + marginSym = this._margin_sym(); + + if (marginSym){ + line = tokenStream.token().startLine; + col = tokenStream.token().startCol; + + this.fire({ + type: "startpagemargin", + margin: marginSym, + line: line, + col: col + }); + + this._readDeclarations(true); + + this.fire({ + type: "endpagemargin", + margin: marginSym, + line: line, + col: col + }); + return true; + } else { + return false; } - else { - self.next(result); + }, + + //CSS3 Paged Media + _margin_sym: function(){ + + /* + * margin_sym : + * TOPLEFTCORNER_SYM | + * TOPLEFT_SYM | + * TOPCENTER_SYM | + * TOPRIGHT_SYM | + * TOPRIGHTCORNER_SYM | + * BOTTOMLEFTCORNER_SYM | + * BOTTOMLEFT_SYM | + * BOTTOMCENTER_SYM | + * BOTTOMRIGHT_SYM | + * BOTTOMRIGHTCORNER_SYM | + * LEFTTOP_SYM | + * LEFTMIDDLE_SYM | + * LEFTBOTTOM_SYM | + * RIGHTTOP_SYM | + * RIGHTMIDDLE_SYM | + * RIGHTBOTTOM_SYM + * ; + */ + + var tokenStream = this._tokenStream; + + if(tokenStream.match([Tokens.TOPLEFTCORNER_SYM, Tokens.TOPLEFT_SYM, + Tokens.TOPCENTER_SYM, Tokens.TOPRIGHT_SYM, Tokens.TOPRIGHTCORNER_SYM, + Tokens.BOTTOMLEFTCORNER_SYM, Tokens.BOTTOMLEFT_SYM, + Tokens.BOTTOMCENTER_SYM, Tokens.BOTTOMRIGHT_SYM, + Tokens.BOTTOMRIGHTCORNER_SYM, Tokens.LEFTTOP_SYM, + Tokens.LEFTMIDDLE_SYM, Tokens.LEFTBOTTOM_SYM, Tokens.RIGHTTOP_SYM, + Tokens.RIGHTMIDDLE_SYM, Tokens.RIGHTBOTTOM_SYM])) + { + return SyntaxUnit.fromToken(tokenStream.token()); + } else { + return null; } - subscription.unsubscribe(); - }; - }); - }; - WebSocketSubject.prototype._connectSocket = function () { - var _this = this; - var WebSocketCtor = this.WebSocketCtor; - var observer = this._output; - var socket = null; - try { - socket = this.protocol ? - new WebSocketCtor(this.url, this.protocol) : - new WebSocketCtor(this.url); - this.socket = socket; - if (this.binaryType) { - this.socket.binaryType = this.binaryType; - } - } - catch (e) { - observer.error(e); - return; - } - var subscription = new Subscription_1.Subscription(function () { - _this.socket = null; - if (socket && socket.readyState === 1) { - socket.close(); - } - }); - socket.onopen = function (e) { - var openObserver = _this.openObserver; - if (openObserver) { - openObserver.next(e); - } - var queue = _this.destination; - _this.destination = Subscriber_1.Subscriber.create(function (x) { return socket.readyState === 1 && socket.send(x); }, function (e) { - var closingObserver = _this.closingObserver; - if (closingObserver) { - closingObserver.next(undefined); + + }, + + _pseudo_page: function(){ + /* + * pseudo_page + * : ':' IDENT + * ; + */ + + var tokenStream = this._tokenStream; + + tokenStream.mustMatch(Tokens.COLON); + tokenStream.mustMatch(Tokens.IDENT); + + //TODO: CSS3 Paged Media says only "left", "center", and "right" are allowed + + return tokenStream.token().value; + }, + + _font_face: function(){ + /* + * font_face + * : FONT_FACE_SYM S* + * '{' S* declaration [ ';' S* declaration ]* '}' S* + * ; + */ + var tokenStream = this._tokenStream, + line, + col; + + //look for @page + tokenStream.mustMatch(Tokens.FONT_FACE_SYM); + line = tokenStream.token().startLine; + col = tokenStream.token().startCol; + + this._readWhitespace(); + + this.fire({ + type: "startfontface", + line: line, + col: col + }); + + this._readDeclarations(true); + + this.fire({ + type: "endfontface", + line: line, + col: col + }); + }, + + _viewport: function(){ + /* + * viewport + * : VIEWPORT_SYM S* + * '{' S* declaration? [ ';' S* declaration? ]* '}' S* + * ; + */ + var tokenStream = this._tokenStream, + line, + col; + + tokenStream.mustMatch(Tokens.VIEWPORT_SYM); + line = tokenStream.token().startLine; + col = tokenStream.token().startCol; + + this._readWhitespace(); + + this.fire({ + type: "startviewport", + line: line, + col: col + }); + + this._readDeclarations(true); + + this.fire({ + type: "endviewport", + line: line, + col: col + }); + + }, + + _document: function(){ + /* + * document + * : DOCUMENT_SYM S* + * _document_function [ ',' S* _document_function ]* S* + * '{' S* ruleset* '}' + * ; + */ + + var tokenStream = this._tokenStream, + token, + functions = [], + prefix = ""; + + tokenStream.mustMatch(Tokens.DOCUMENT_SYM); + token = tokenStream.token(); + if (/^@\-([^\-]+)\-/.test(token.value)) { + prefix = RegExp.$1; } - if (e && e.code) { - socket.close(e.code, e.reason); + + this._readWhitespace(); + functions.push(this._document_function()); + + while(tokenStream.match(Tokens.COMMA)) { + this._readWhitespace(); + functions.push(this._document_function()); } - else { - observer.error(new TypeError('WebSocketSubject.error must be called with an object with an error code, ' + - 'and an optional reason: { code: number, reason: string }')); + + tokenStream.mustMatch(Tokens.LBRACE); + this._readWhitespace(); + + this.fire({ + type: "startdocument", + functions: functions, + prefix: prefix, + line: token.startLine, + col: token.startCol + }); + + while(true) { + if (tokenStream.peek() === Tokens.PAGE_SYM){ + this._page(); + } else if (tokenStream.peek() === Tokens.FONT_FACE_SYM){ + this._font_face(); + } else if (tokenStream.peek() === Tokens.VIEWPORT_SYM){ + this._viewport(); + } else if (tokenStream.peek() === Tokens.MEDIA_SYM){ + this._media(); + } else if (!this._ruleset()){ + break; + } } - _this._resetState(); - }, function () { - var closingObserver = _this.closingObserver; - if (closingObserver) { - closingObserver.next(undefined); + + tokenStream.mustMatch(Tokens.RBRACE); + this._readWhitespace(); + + this.fire({ + type: "enddocument", + functions: functions, + prefix: prefix, + line: token.startLine, + col: token.startCol + }); + }, + + _document_function: function(){ + /* + * document_function + * : function | URI S* + * ; + */ + + var tokenStream = this._tokenStream, + value; + + if (tokenStream.match(Tokens.URI)) { + value = tokenStream.token().value; + this._readWhitespace(); + } else { + value = this._function(); } - socket.close(); - _this._resetState(); - }); - if (queue && queue instanceof ReplaySubject_1.ReplaySubject) { - subscription.add(queue.subscribe(_this.destination)); - } - }; - socket.onerror = function (e) { - _this._resetState(); - observer.error(e); - }; - socket.onclose = function (e) { - _this._resetState(); - var closeObserver = _this.closeObserver; - if (closeObserver) { - closeObserver.next(e); - } - if (e.wasClean) { - observer.complete(); - } - else { - observer.error(e); - } - }; - socket.onmessage = function (e) { - var result = tryCatch_1.tryCatch(_this.resultSelector)(e); - if (result === errorObject_1.errorObject) { - observer.error(errorObject_1.errorObject.e); - } - else { - observer.next(result); - } - }; - }; - WebSocketSubject.prototype._subscribe = function (subscriber) { - var _this = this; - var source = this.source; - if (source) { - return source.subscribe(subscriber); - } - if (!this.socket) { - this._connectSocket(); - } - var subscription = new Subscription_1.Subscription(); - subscription.add(this._output.subscribe(subscriber)); - subscription.add(function () { - var socket = _this.socket; - if (_this._output.observers.length === 0) { - if (socket && socket.readyState === 1) { - socket.close(); + + return value; + }, + + _operator: function(inFunction){ + + /* + * operator (outside function) + * : '/' S* | ',' S* | /( empty )/ + * operator (inside function) + * : '/' S* | '+' S* | '*' S* | '-' S* /( empty )/ + * ; + */ + + var tokenStream = this._tokenStream, + token = null; + + if (tokenStream.match([Tokens.SLASH, Tokens.COMMA]) || + (inFunction && tokenStream.match([Tokens.PLUS, Tokens.STAR, Tokens.MINUS]))){ + token = tokenStream.token(); + this._readWhitespace(); } - _this._resetState(); - } - }); - return subscription; - }; - WebSocketSubject.prototype.unsubscribe = function () { - var _a = this, source = _a.source, socket = _a.socket; - if (socket && socket.readyState === 1) { - socket.close(); - this._resetState(); - } - _super.prototype.unsubscribe.call(this); - if (!source) { - this.destination = new ReplaySubject_1.ReplaySubject(); - } - }; - return WebSocketSubject; -}(Subject_1.AnonymousSubject)); -exports.WebSocketSubject = WebSocketSubject; -//# sourceMappingURL=WebSocketSubject.js.map + return token ? PropertyValuePart.fromToken(token) : null; -/***/ }), -/* 267 */ -/***/ (function(module, exports, __webpack_require__) { + }, -"use strict"; + _combinator: function(){ -var AjaxObservable_1 = __webpack_require__(59); -exports.ajax = AjaxObservable_1.AjaxObservable.create; -//# sourceMappingURL=ajax.js.map + /* + * combinator + * : PLUS S* | GREATER S* | TILDE S* | S+ + * ; + */ -/***/ }), -/* 268 */ -/***/ (function(module, exports, __webpack_require__) { + var tokenStream = this._tokenStream, + value = null, + token; -"use strict"; + if(tokenStream.match([Tokens.PLUS, Tokens.GREATER, Tokens.TILDE])){ + token = tokenStream.token(); + value = new Combinator(token.value, token.startLine, token.startCol); + this._readWhitespace(); + } -var WebSocketSubject_1 = __webpack_require__(266); -exports.webSocket = WebSocketSubject_1.WebSocketSubject.create; -//# sourceMappingURL=webSocket.js.map + return value; + }, -/***/ }), -/* 269 */ -/***/ (function(module, exports, __webpack_require__) { + _unary_operator: function(){ -"use strict"; + /* + * unary_operator + * : '-' | '+' + * ; + */ -var EmptyObservable_1 = __webpack_require__(23); -exports.empty = EmptyObservable_1.EmptyObservable.create; -//# sourceMappingURL=empty.js.map + var tokenStream = this._tokenStream; + + if (tokenStream.match([Tokens.MINUS, Tokens.PLUS])){ + return tokenStream.token().value; + } else { + return null; + } + }, + + _property: function(){ + + /* + * property + * : IDENT S* + * ; + */ + + var tokenStream = this._tokenStream, + value = null, + hack = null, + tokenValue, + token, + line, + col; + + //check for star hack - throws error if not allowed + if (tokenStream.peek() === Tokens.STAR && this.options.starHack){ + tokenStream.get(); + token = tokenStream.token(); + hack = token.value; + line = token.startLine; + col = token.startCol; + } + + if(tokenStream.match(Tokens.IDENT)){ + token = tokenStream.token(); + tokenValue = token.value; + + //check for underscore hack - no error if not allowed because it's valid CSS syntax + if (tokenValue.charAt(0) === "_" && this.options.underscoreHack){ + hack = "_"; + tokenValue = tokenValue.substring(1); + } -/***/ }), -/* 270 */ -/***/ (function(module, exports, __webpack_require__) { + value = new PropertyName(tokenValue, hack, (line||token.startLine), (col||token.startCol)); + this._readWhitespace(); + } -"use strict"; + return value; + }, -var FromEventObservable_1 = __webpack_require__(250); -exports.fromEvent = FromEventObservable_1.FromEventObservable.create; -//# sourceMappingURL=fromEvent.js.map + //Augmented with CSS3 Selectors + _ruleset: function(){ + /* + * ruleset + * : selectors_group + * '{' S* declaration? [ ';' S* declaration? ]* '}' S* + * ; + */ -/***/ }), -/* 271 */ -/***/ (function(module, exports, __webpack_require__) { + var tokenStream = this._tokenStream, + tt, + selectors; -"use strict"; -var FromEventPatternObservable_1 = __webpack_require__(251); -exports.fromEventPattern = FromEventPatternObservable_1.FromEventPatternObservable.create; -//# sourceMappingURL=fromEventPattern.js.map + /* + * Error Recovery: If even a single selector fails to parse, + * then the entire ruleset should be thrown away. + */ + try { + selectors = this._selectors_group(); + } catch (ex){ + if (ex instanceof SyntaxError && !this.options.strict){ + + //fire error event + this.fire({ + type: "error", + error: ex, + message: ex.message, + line: ex.line, + col: ex.col + }); + + //skip over everything until closing brace + tt = tokenStream.advance([Tokens.RBRACE]); + if (tt === Tokens.RBRACE){ + //if there's a right brace, the rule is finished so don't do anything + } else { + //otherwise, rethrow the error because it wasn't handled properly + throw ex; + } -/***/ }), -/* 272 */ -/***/ (function(module, exports, __webpack_require__) { + } else { + //not a syntax error, rethrow it + throw ex; + } -"use strict"; + //trigger parser to continue + return true; + } -var IfObservable_1 = __webpack_require__(253); -exports._if = IfObservable_1.IfObservable.create; -//# sourceMappingURL=if.js.map + //if it got here, all selectors parsed + if (selectors){ -/***/ }), -/* 273 */ -/***/ (function(module, exports, __webpack_require__) { + this.fire({ + type: "startrule", + selectors: selectors, + line: selectors[0].line, + col: selectors[0].col + }); -"use strict"; + this._readDeclarations(true); -var IntervalObservable_1 = __webpack_require__(254); -exports.interval = IntervalObservable_1.IntervalObservable.create; -//# sourceMappingURL=interval.js.map + this.fire({ + type: "endrule", + selectors: selectors, + line: selectors[0].line, + col: selectors[0].col + }); -/***/ }), -/* 274 */ -/***/ (function(module, exports, __webpack_require__) { + } -"use strict"; + return selectors; -var NeverObservable_1 = __webpack_require__(255); -exports.never = NeverObservable_1.NeverObservable.create; -//# sourceMappingURL=never.js.map + }, -/***/ }), -/* 275 */ -/***/ (function(module, exports, __webpack_require__) { + //CSS3 Selectors + _selectors_group: function(){ + + /* + * selectors_group + * : selector [ COMMA S* selector ]* + * ; + */ + var tokenStream = this._tokenStream, + selectors = [], + selector; + + selector = this._selector(); + if (selector !== null){ + + selectors.push(selector); + while(tokenStream.match(Tokens.COMMA)){ + this._readWhitespace(); + selector = this._selector(); + if (selector !== null){ + selectors.push(selector); + } else { + this._unexpectedToken(tokenStream.LT(1)); + } + } + } -"use strict"; + return selectors.length ? selectors : null; + }, -var PairsObservable_1 = __webpack_require__(256); -exports.pairs = PairsObservable_1.PairsObservable.create; -//# sourceMappingURL=pairs.js.map + //CSS3 Selectors + _selector: function(){ + /* + * selector + * : simple_selector_sequence [ combinator simple_selector_sequence ]* + * ; + */ + + var tokenStream = this._tokenStream, + selector = [], + nextSelector = null, + combinator = null, + ws = null; + + //if there's no simple selector, then there's no selector + nextSelector = this._simple_selector_sequence(); + if (nextSelector === null){ + return null; + } -/***/ }), -/* 276 */ -/***/ (function(module, exports, __webpack_require__) { + selector.push(nextSelector); -"use strict"; + do { -var RangeObservable_1 = __webpack_require__(257); -exports.range = RangeObservable_1.RangeObservable.create; -//# sourceMappingURL=range.js.map + //look for a combinator + combinator = this._combinator(); -/***/ }), -/* 277 */ -/***/ (function(module, exports, __webpack_require__) { + if (combinator !== null){ + selector.push(combinator); + nextSelector = this._simple_selector_sequence(); -"use strict"; + //there must be a next selector + if (nextSelector === null){ + this._unexpectedToken(tokenStream.LT(1)); + } else { -var ErrorObservable_1 = __webpack_require__(249); -exports._throw = ErrorObservable_1.ErrorObservable.create; -//# sourceMappingURL=throw.js.map + //nextSelector is an instance of SelectorPart + selector.push(nextSelector); + } + } else { + + //if there's not whitespace, we're done + if (this._readWhitespace()){ + + //add whitespace separator + ws = new Combinator(tokenStream.token().value, tokenStream.token().startLine, tokenStream.token().startCol); + + //combinator is not required + combinator = this._combinator(); + + //selector is required if there's a combinator + nextSelector = this._simple_selector_sequence(); + if (nextSelector === null){ + if (combinator !== null){ + this._unexpectedToken(tokenStream.LT(1)); + } + } else { + + if (combinator !== null){ + selector.push(combinator); + } else { + selector.push(ws); + } + + selector.push(nextSelector); + } + } else { + break; + } -/***/ }), -/* 278 */ -/***/ (function(module, exports, __webpack_require__) { + } + } while(true); -"use strict"; + return new Selector(selector, selector[0].line, selector[0].col); + }, -var TimerObservable_1 = __webpack_require__(259); -exports.timer = TimerObservable_1.TimerObservable.create; -//# sourceMappingURL=timer.js.map + //CSS3 Selectors + _simple_selector_sequence: function(){ + /* + * simple_selector_sequence + * : [ type_selector | universal ] + * [ HASH | class | attrib | pseudo | negation ]* + * | [ HASH | class | attrib | pseudo | negation ]+ + * ; + */ + + var tokenStream = this._tokenStream, + + //parts of a simple selector + elementName = null, + modifiers = [], + + //complete selector text + selectorText= "", + + //the different parts after the element name to search for + components = [ + //HASH + function(){ + return tokenStream.match(Tokens.HASH) ? + new SelectorSubPart(tokenStream.token().value, "id", tokenStream.token().startLine, tokenStream.token().startCol) : + null; + }, + this._class, + this._attrib, + this._pseudo, + this._negation + ], + i = 0, + len = components.length, + component = null, + line, + col; + + + //get starting line and column for the selector + line = tokenStream.LT(1).startLine; + col = tokenStream.LT(1).startCol; + + elementName = this._type_selector(); + if (!elementName){ + elementName = this._universal(); + } -/***/ }), -/* 279 */ -/***/ (function(module, exports, __webpack_require__) { + if (elementName !== null){ + selectorText += elementName; + } -"use strict"; + while(true){ -var UsingObservable_1 = __webpack_require__(260); -exports.using = UsingObservable_1.UsingObservable.create; -//# sourceMappingURL=using.js.map + //whitespace means we're done + if (tokenStream.peek() === Tokens.S){ + break; + } -/***/ }), -/* 280 */ -/***/ (function(module, exports, __webpack_require__) { + //check for each component + while(i < len && component === null){ + component = components[i++].call(this); + } -"use strict"; + if (component === null){ -var zip_1 = __webpack_require__(39); -exports.zip = zip_1.zipStatic; -//# sourceMappingURL=zip.js.map + //we don't have a selector + if (selectorText === ""){ + return null; + } else { + break; + } + } else { + i = 0; + modifiers.push(component); + selectorText += component.toString(); + component = null; + } + } -/***/ }), -/* 281 */ -/***/ (function(module, exports, __webpack_require__) { -"use strict"; + return selectorText !== "" ? + new SelectorPart(elementName, modifiers, selectorText, line, col) : + null; + }, -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; -var tryCatch_1 = __webpack_require__(7); -var errorObject_1 = __webpack_require__(5); -var OuterSubscriber_1 = __webpack_require__(4); -var subscribeToResult_1 = __webpack_require__(3); -/** - * Ignores source values for a duration determined by another Observable, then - * emits the most recent value from the source Observable, then repeats this - * process. - * - * It's like {@link auditTime}, but the silencing - * duration is determined by a second Observable. - * - * - * - * `audit` is similar to `throttle`, but emits the last value from the silenced - * time window, instead of the first value. `audit` emits the most recent value - * from the source Observable on the output Observable as soon as its internal - * timer becomes disabled, and ignores source values while the timer is enabled. - * Initially, the timer is disabled. As soon as the first source value arrives, - * the timer is enabled by calling the `durationSelector` function with the - * source value, which returns the "duration" Observable. When the duration - * Observable emits a value or completes, the timer is disabled, then the most - * recent source value is emitted on the output Observable, and this process - * repeats for the next source value. - * - * @example Emit clicks at a rate of at most one click per second - * var clicks = Rx.Observable.fromEvent(document, 'click'); - * var result = clicks.audit(ev => Rx.Observable.interval(1000)); - * result.subscribe(x => console.log(x)); - * - * @see {@link auditTime} - * @see {@link debounce} - * @see {@link delayWhen} - * @see {@link sample} - * @see {@link throttle} - * - * @param {function(value: T): SubscribableOrPromise} durationSelector A function - * that receives a value from the source Observable, for computing the silencing - * duration, returned as an Observable or a Promise. - * @return {Observable} An Observable that performs rate-limiting of - * emissions from the source Observable. - * @method audit - * @owner Observable - */ -function audit(durationSelector) { - return this.lift(new AuditOperator(durationSelector)); -} -exports.audit = audit; -var AuditOperator = (function () { - function AuditOperator(durationSelector) { - this.durationSelector = durationSelector; - } - AuditOperator.prototype.call = function (subscriber, source) { - return source.subscribe(new AuditSubscriber(subscriber, this.durationSelector)); - }; - return AuditOperator; -}()); -/** - * We need this JSDoc comment for affecting ESDoc. - * @ignore - * @extends {Ignored} - */ -var AuditSubscriber = (function (_super) { - __extends(AuditSubscriber, _super); - function AuditSubscriber(destination, durationSelector) { - _super.call(this, destination); - this.durationSelector = durationSelector; - this.hasValue = false; - } - AuditSubscriber.prototype._next = function (value) { - this.value = value; - this.hasValue = true; - if (!this.throttled) { - var duration = tryCatch_1.tryCatch(this.durationSelector)(value); - if (duration === errorObject_1.errorObject) { - this.destination.error(errorObject_1.errorObject.e); - } - else { - var innerSubscription = subscribeToResult_1.subscribeToResult(this, duration); - if (innerSubscription.closed) { - this.clearThrottle(); + //CSS3 Selectors + _type_selector: function(){ + /* + * type_selector + * : [ namespace_prefix ]? element_name + * ; + */ + + var tokenStream = this._tokenStream, + ns = this._namespace_prefix(), + elementName = this._element_name(); + + if (!elementName){ + /* + * Need to back out the namespace that was read due to both + * type_selector and universal reading namespace_prefix + * first. Kind of hacky, but only way I can figure out + * right now how to not change the grammar. + */ + if (ns){ + tokenStream.unget(); + if (ns.length > 1){ + tokenStream.unget(); + } + } + + return null; + } else { + if (ns){ + elementName.text = ns + elementName.text; + elementName.col -= ns.length; + } + return elementName; } - else { - this.add(this.throttled = innerSubscription); + }, + + //CSS3 Selectors + _class: function(){ + /* + * class + * : '.' IDENT + * ; + */ + + var tokenStream = this._tokenStream, + token; + + if (tokenStream.match(Tokens.DOT)){ + tokenStream.mustMatch(Tokens.IDENT); + token = tokenStream.token(); + return new SelectorSubPart("." + token.value, "class", token.startLine, token.startCol - 1); + } else { + return null; } - } - } - }; - AuditSubscriber.prototype.clearThrottle = function () { - var _a = this, value = _a.value, hasValue = _a.hasValue, throttled = _a.throttled; - if (throttled) { - this.remove(throttled); - this.throttled = null; - throttled.unsubscribe(); - } - if (hasValue) { - this.value = null; - this.hasValue = false; - this.destination.next(value); - } - }; - AuditSubscriber.prototype.notifyNext = function (outerValue, innerValue, outerIndex, innerIndex) { - this.clearThrottle(); - }; - AuditSubscriber.prototype.notifyComplete = function () { - this.clearThrottle(); - }; - return AuditSubscriber; -}(OuterSubscriber_1.OuterSubscriber)); -//# sourceMappingURL=audit.js.map -/***/ }), -/* 282 */ -/***/ (function(module, exports, __webpack_require__) { + }, -"use strict"; + //CSS3 Selectors + _element_name: function(){ + /* + * element_name + * : IDENT + * ; + */ -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; -var async_1 = __webpack_require__(8); -var Subscriber_1 = __webpack_require__(2); -/** - * Ignores source values for `duration` milliseconds, then emits the most recent - * value from the source Observable, then repeats this process. - * - * When it sees a source values, it ignores that plus - * the next ones for `duration` milliseconds, and then it emits the most recent - * value from the source. - * - * - * - * `auditTime` is similar to `throttleTime`, but emits the last value from the - * silenced time window, instead of the first value. `auditTime` emits the most - * recent value from the source Observable on the output Observable as soon as - * its internal timer becomes disabled, and ignores source values while the - * timer is enabled. Initially, the timer is disabled. As soon as the first - * source value arrives, the timer is enabled. After `duration` milliseconds (or - * the time unit determined internally by the optional `scheduler`) has passed, - * the timer is disabled, then the most recent source value is emitted on the - * output Observable, and this process repeats for the next source value. - * Optionally takes a {@link IScheduler} for managing timers. - * - * @example Emit clicks at a rate of at most one click per second - * var clicks = Rx.Observable.fromEvent(document, 'click'); - * var result = clicks.auditTime(1000); - * result.subscribe(x => console.log(x)); - * - * @see {@link audit} - * @see {@link debounceTime} - * @see {@link delay} - * @see {@link sampleTime} - * @see {@link throttleTime} - * - * @param {number} duration Time to wait before emitting the most recent source - * value, measured in milliseconds or the time unit determined internally - * by the optional `scheduler`. - * @param {Scheduler} [scheduler=async] The {@link IScheduler} to use for - * managing the timers that handle the rate-limiting behavior. - * @return {Observable} An Observable that performs rate-limiting of - * emissions from the source Observable. - * @method auditTime - * @owner Observable - */ -function auditTime(duration, scheduler) { - if (scheduler === void 0) { scheduler = async_1.async; } - return this.lift(new AuditTimeOperator(duration, scheduler)); -} -exports.auditTime = auditTime; -var AuditTimeOperator = (function () { - function AuditTimeOperator(duration, scheduler) { - this.duration = duration; - this.scheduler = scheduler; - } - AuditTimeOperator.prototype.call = function (subscriber, source) { - return source.subscribe(new AuditTimeSubscriber(subscriber, this.duration, this.scheduler)); - }; - return AuditTimeOperator; -}()); -/** - * We need this JSDoc comment for affecting ESDoc. - * @ignore - * @extends {Ignored} - */ -var AuditTimeSubscriber = (function (_super) { - __extends(AuditTimeSubscriber, _super); - function AuditTimeSubscriber(destination, duration, scheduler) { - _super.call(this, destination); - this.duration = duration; - this.scheduler = scheduler; - this.hasValue = false; - } - AuditTimeSubscriber.prototype._next = function (value) { - this.value = value; - this.hasValue = true; - if (!this.throttled) { - this.add(this.throttled = this.scheduler.schedule(dispatchNext, this.duration, this)); - } - }; - AuditTimeSubscriber.prototype.clearThrottle = function () { - var _a = this, value = _a.value, hasValue = _a.hasValue, throttled = _a.throttled; - if (throttled) { - this.remove(throttled); - this.throttled = null; - throttled.unsubscribe(); - } - if (hasValue) { - this.value = null; - this.hasValue = false; - this.destination.next(value); - } - }; - return AuditTimeSubscriber; -}(Subscriber_1.Subscriber)); -function dispatchNext(subscriber) { - subscriber.clearThrottle(); -} -//# sourceMappingURL=auditTime.js.map + var tokenStream = this._tokenStream, + token; -/***/ }), -/* 283 */ -/***/ (function(module, exports, __webpack_require__) { + if (tokenStream.match(Tokens.IDENT)){ + token = tokenStream.token(); + return new SelectorSubPart(token.value, "elementName", token.startLine, token.startCol); -"use strict"; + } else { + return null; + } + }, -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; -var OuterSubscriber_1 = __webpack_require__(4); -var subscribeToResult_1 = __webpack_require__(3); -/** - * Buffers the source Observable values until `closingNotifier` emits. - * - * Collects values from the past as an array, and emits - * that array only when another Observable emits. - * - * - * - * Buffers the incoming Observable values until the given `closingNotifier` - * Observable emits a value, at which point it emits the buffer on the output - * Observable and starts a new buffer internally, awaiting the next time - * `closingNotifier` emits. - * - * @example On every click, emit array of most recent interval events - * var clicks = Rx.Observable.fromEvent(document, 'click'); - * var interval = Rx.Observable.interval(1000); - * var buffered = interval.buffer(clicks); - * buffered.subscribe(x => console.log(x)); - * - * @see {@link bufferCount} - * @see {@link bufferTime} - * @see {@link bufferToggle} - * @see {@link bufferWhen} - * @see {@link window} - * - * @param {Observable} closingNotifier An Observable that signals the - * buffer to be emitted on the output Observable. - * @return {Observable} An Observable of buffers, which are arrays of - * values. - * @method buffer - * @owner Observable - */ -function buffer(closingNotifier) { - return this.lift(new BufferOperator(closingNotifier)); -} -exports.buffer = buffer; -var BufferOperator = (function () { - function BufferOperator(closingNotifier) { - this.closingNotifier = closingNotifier; - } - BufferOperator.prototype.call = function (subscriber, source) { - return source.subscribe(new BufferSubscriber(subscriber, this.closingNotifier)); - }; - return BufferOperator; -}()); -/** - * We need this JSDoc comment for affecting ESDoc. - * @ignore - * @extends {Ignored} - */ -var BufferSubscriber = (function (_super) { - __extends(BufferSubscriber, _super); - function BufferSubscriber(destination, closingNotifier) { - _super.call(this, destination); - this.buffer = []; - this.add(subscribeToResult_1.subscribeToResult(this, closingNotifier)); - } - BufferSubscriber.prototype._next = function (value) { - this.buffer.push(value); - }; - BufferSubscriber.prototype.notifyNext = function (outerValue, innerValue, outerIndex, innerIndex, innerSub) { - var buffer = this.buffer; - this.buffer = []; - this.destination.next(buffer); - }; - return BufferSubscriber; -}(OuterSubscriber_1.OuterSubscriber)); -//# sourceMappingURL=buffer.js.map + //CSS3 Selectors + _namespace_prefix: function(){ + /* + * namespace_prefix + * : [ IDENT | '*' ]? '|' + * ; + */ + var tokenStream = this._tokenStream, + value = ""; + + //verify that this is a namespace prefix + if (tokenStream.LA(1) === Tokens.PIPE || tokenStream.LA(2) === Tokens.PIPE){ + + if(tokenStream.match([Tokens.IDENT, Tokens.STAR])){ + value += tokenStream.token().value; + } -/***/ }), -/* 284 */ -/***/ (function(module, exports, __webpack_require__) { + tokenStream.mustMatch(Tokens.PIPE); + value += "|"; -"use strict"; + } -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; -var Subscriber_1 = __webpack_require__(2); -/** - * Buffers the source Observable values until the size hits the maximum - * `bufferSize` given. - * - * Collects values from the past as an array, and emits - * that array only when its size reaches `bufferSize`. - * - * - * - * Buffers a number of values from the source Observable by `bufferSize` then - * emits the buffer and clears it, and starts a new buffer each - * `startBufferEvery` values. If `startBufferEvery` is not provided or is - * `null`, then new buffers are started immediately at the start of the source - * and when each buffer closes and is emitted. - * - * @example Emit the last two click events as an array - * var clicks = Rx.Observable.fromEvent(document, 'click'); - * var buffered = clicks.bufferCount(2); - * buffered.subscribe(x => console.log(x)); - * - * @example On every click, emit the last two click events as an array - * var clicks = Rx.Observable.fromEvent(document, 'click'); - * var buffered = clicks.bufferCount(2, 1); - * buffered.subscribe(x => console.log(x)); - * - * @see {@link buffer} - * @see {@link bufferTime} - * @see {@link bufferToggle} - * @see {@link bufferWhen} - * @see {@link pairwise} - * @see {@link windowCount} - * - * @param {number} bufferSize The maximum size of the buffer emitted. - * @param {number} [startBufferEvery] Interval at which to start a new buffer. - * For example if `startBufferEvery` is `2`, then a new buffer will be started - * on every other value from the source. A new buffer is started at the - * beginning of the source by default. - * @return {Observable} An Observable of arrays of buffered values. - * @method bufferCount - * @owner Observable - */ -function bufferCount(bufferSize, startBufferEvery) { - if (startBufferEvery === void 0) { startBufferEvery = null; } - return this.lift(new BufferCountOperator(bufferSize, startBufferEvery)); -} -exports.bufferCount = bufferCount; -var BufferCountOperator = (function () { - function BufferCountOperator(bufferSize, startBufferEvery) { - this.bufferSize = bufferSize; - this.startBufferEvery = startBufferEvery; - if (!startBufferEvery || bufferSize === startBufferEvery) { - this.subscriberClass = BufferCountSubscriber; - } - else { - this.subscriberClass = BufferSkipCountSubscriber; - } - } - BufferCountOperator.prototype.call = function (subscriber, source) { - return source.subscribe(new this.subscriberClass(subscriber, this.bufferSize, this.startBufferEvery)); - }; - return BufferCountOperator; -}()); -/** - * We need this JSDoc comment for affecting ESDoc. - * @ignore - * @extends {Ignored} - */ -var BufferCountSubscriber = (function (_super) { - __extends(BufferCountSubscriber, _super); - function BufferCountSubscriber(destination, bufferSize) { - _super.call(this, destination); - this.bufferSize = bufferSize; - this.buffer = []; - } - BufferCountSubscriber.prototype._next = function (value) { - var buffer = this.buffer; - buffer.push(value); - if (buffer.length == this.bufferSize) { - this.destination.next(buffer); - this.buffer = []; - } - }; - BufferCountSubscriber.prototype._complete = function () { - var buffer = this.buffer; - if (buffer.length > 0) { - this.destination.next(buffer); - } - _super.prototype._complete.call(this); - }; - return BufferCountSubscriber; -}(Subscriber_1.Subscriber)); -/** - * We need this JSDoc comment for affecting ESDoc. - * @ignore - * @extends {Ignored} - */ -var BufferSkipCountSubscriber = (function (_super) { - __extends(BufferSkipCountSubscriber, _super); - function BufferSkipCountSubscriber(destination, bufferSize, startBufferEvery) { - _super.call(this, destination); - this.bufferSize = bufferSize; - this.startBufferEvery = startBufferEvery; - this.buffers = []; - this.count = 0; - } - BufferSkipCountSubscriber.prototype._next = function (value) { - var _a = this, bufferSize = _a.bufferSize, startBufferEvery = _a.startBufferEvery, buffers = _a.buffers, count = _a.count; - this.count++; - if (count % startBufferEvery === 0) { - buffers.push([]); - } - for (var i = buffers.length; i--;) { - var buffer = buffers[i]; - buffer.push(value); - if (buffer.length === bufferSize) { - buffers.splice(i, 1); - this.destination.next(buffer); - } - } - }; - BufferSkipCountSubscriber.prototype._complete = function () { - var _a = this, buffers = _a.buffers, destination = _a.destination; - while (buffers.length > 0) { - var buffer = buffers.shift(); - if (buffer.length > 0) { - destination.next(buffer); - } - } - _super.prototype._complete.call(this); - }; - return BufferSkipCountSubscriber; -}(Subscriber_1.Subscriber)); -//# sourceMappingURL=bufferCount.js.map + return value.length ? value : null; + }, + + //CSS3 Selectors + _universal: function(){ + /* + * universal + * : [ namespace_prefix ]? '*' + * ; + */ + var tokenStream = this._tokenStream, + value = "", + ns; + + ns = this._namespace_prefix(); + if(ns){ + value += ns; + } + + if(tokenStream.match(Tokens.STAR)){ + value += "*"; + } -/***/ }), -/* 285 */ -/***/ (function(module, exports, __webpack_require__) { + return value.length ? value : null; + + }, + + //CSS3 Selectors + _attrib: function(){ + /* + * attrib + * : '[' S* [ namespace_prefix ]? IDENT S* + * [ [ PREFIXMATCH | + * SUFFIXMATCH | + * SUBSTRINGMATCH | + * '=' | + * INCLUDES | + * DASHMATCH ] S* [ IDENT | STRING ] S* + * ]? ']' + * ; + */ + + var tokenStream = this._tokenStream, + value = null, + ns, + token; + + if (tokenStream.match(Tokens.LBRACKET)){ + token = tokenStream.token(); + value = token.value; + value += this._readWhitespace(); + + ns = this._namespace_prefix(); + + if (ns){ + value += ns; + } -"use strict"; + tokenStream.mustMatch(Tokens.IDENT); + value += tokenStream.token().value; + value += this._readWhitespace(); -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; -var async_1 = __webpack_require__(8); -var Subscriber_1 = __webpack_require__(2); -var isScheduler_1 = __webpack_require__(13); -/* tslint:enable:max-line-length */ -/** - * Buffers the source Observable values for a specific time period. - * - * Collects values from the past as an array, and emits - * those arrays periodically in time. - * - * - * - * Buffers values from the source for a specific time duration `bufferTimeSpan`. - * Unless the optional argument `bufferCreationInterval` is given, it emits and - * resets the buffer every `bufferTimeSpan` milliseconds. If - * `bufferCreationInterval` is given, this operator opens the buffer every - * `bufferCreationInterval` milliseconds and closes (emits and resets) the - * buffer every `bufferTimeSpan` milliseconds. When the optional argument - * `maxBufferSize` is specified, the buffer will be closed either after - * `bufferTimeSpan` milliseconds or when it contains `maxBufferSize` elements. - * - * @example Every second, emit an array of the recent click events - * var clicks = Rx.Observable.fromEvent(document, 'click'); - * var buffered = clicks.bufferTime(1000); - * buffered.subscribe(x => console.log(x)); - * - * @example Every 5 seconds, emit the click events from the next 2 seconds - * var clicks = Rx.Observable.fromEvent(document, 'click'); - * var buffered = clicks.bufferTime(2000, 5000); - * buffered.subscribe(x => console.log(x)); - * - * @see {@link buffer} - * @see {@link bufferCount} - * @see {@link bufferToggle} - * @see {@link bufferWhen} - * @see {@link windowTime} - * - * @param {number} bufferTimeSpan The amount of time to fill each buffer array. - * @param {number} [bufferCreationInterval] The interval at which to start new - * buffers. - * @param {number} [maxBufferSize] The maximum buffer size. - * @param {Scheduler} [scheduler=async] The scheduler on which to schedule the - * intervals that determine buffer boundaries. - * @return {Observable} An observable of arrays of buffered values. - * @method bufferTime - * @owner Observable - */ -function bufferTime(bufferTimeSpan) { - var length = arguments.length; - var scheduler = async_1.async; - if (isScheduler_1.isScheduler(arguments[arguments.length - 1])) { - scheduler = arguments[arguments.length - 1]; - length--; - } - var bufferCreationInterval = null; - if (length >= 2) { - bufferCreationInterval = arguments[1]; - } - var maxBufferSize = Number.POSITIVE_INFINITY; - if (length >= 3) { - maxBufferSize = arguments[2]; - } - return this.lift(new BufferTimeOperator(bufferTimeSpan, bufferCreationInterval, maxBufferSize, scheduler)); -} -exports.bufferTime = bufferTime; -var BufferTimeOperator = (function () { - function BufferTimeOperator(bufferTimeSpan, bufferCreationInterval, maxBufferSize, scheduler) { - this.bufferTimeSpan = bufferTimeSpan; - this.bufferCreationInterval = bufferCreationInterval; - this.maxBufferSize = maxBufferSize; - this.scheduler = scheduler; - } - BufferTimeOperator.prototype.call = function (subscriber, source) { - return source.subscribe(new BufferTimeSubscriber(subscriber, this.bufferTimeSpan, this.bufferCreationInterval, this.maxBufferSize, this.scheduler)); - }; - return BufferTimeOperator; -}()); -var Context = (function () { - function Context() { - this.buffer = []; - } - return Context; -}()); -/** - * We need this JSDoc comment for affecting ESDoc. - * @ignore - * @extends {Ignored} - */ -var BufferTimeSubscriber = (function (_super) { - __extends(BufferTimeSubscriber, _super); - function BufferTimeSubscriber(destination, bufferTimeSpan, bufferCreationInterval, maxBufferSize, scheduler) { - _super.call(this, destination); - this.bufferTimeSpan = bufferTimeSpan; - this.bufferCreationInterval = bufferCreationInterval; - this.maxBufferSize = maxBufferSize; - this.scheduler = scheduler; - this.contexts = []; - var context = this.openContext(); - this.timespanOnly = bufferCreationInterval == null || bufferCreationInterval < 0; - if (this.timespanOnly) { - var timeSpanOnlyState = { subscriber: this, context: context, bufferTimeSpan: bufferTimeSpan }; - this.add(context.closeAction = scheduler.schedule(dispatchBufferTimeSpanOnly, bufferTimeSpan, timeSpanOnlyState)); - } - else { - var closeState = { subscriber: this, context: context }; - var creationState = { bufferTimeSpan: bufferTimeSpan, bufferCreationInterval: bufferCreationInterval, subscriber: this, scheduler: scheduler }; - this.add(context.closeAction = scheduler.schedule(dispatchBufferClose, bufferTimeSpan, closeState)); - this.add(scheduler.schedule(dispatchBufferCreation, bufferCreationInterval, creationState)); - } - } - BufferTimeSubscriber.prototype._next = function (value) { - var contexts = this.contexts; - var len = contexts.length; - var filledBufferContext; - for (var i = 0; i < len; i++) { - var context = contexts[i]; - var buffer = context.buffer; - buffer.push(value); - if (buffer.length == this.maxBufferSize) { - filledBufferContext = context; - } - } - if (filledBufferContext) { - this.onBufferFull(filledBufferContext); - } - }; - BufferTimeSubscriber.prototype._error = function (err) { - this.contexts.length = 0; - _super.prototype._error.call(this, err); - }; - BufferTimeSubscriber.prototype._complete = function () { - var _a = this, contexts = _a.contexts, destination = _a.destination; - while (contexts.length > 0) { - var context = contexts.shift(); - destination.next(context.buffer); - } - _super.prototype._complete.call(this); - }; - BufferTimeSubscriber.prototype._unsubscribe = function () { - this.contexts = null; - }; - BufferTimeSubscriber.prototype.onBufferFull = function (context) { - this.closeContext(context); - var closeAction = context.closeAction; - closeAction.unsubscribe(); - this.remove(closeAction); - if (!this.closed && this.timespanOnly) { - context = this.openContext(); - var bufferTimeSpan = this.bufferTimeSpan; - var timeSpanOnlyState = { subscriber: this, context: context, bufferTimeSpan: bufferTimeSpan }; - this.add(context.closeAction = this.scheduler.schedule(dispatchBufferTimeSpanOnly, bufferTimeSpan, timeSpanOnlyState)); - } - }; - BufferTimeSubscriber.prototype.openContext = function () { - var context = new Context(); - this.contexts.push(context); - return context; - }; - BufferTimeSubscriber.prototype.closeContext = function (context) { - this.destination.next(context.buffer); - var contexts = this.contexts; - var spliceIndex = contexts ? contexts.indexOf(context) : -1; - if (spliceIndex >= 0) { - contexts.splice(contexts.indexOf(context), 1); - } - }; - return BufferTimeSubscriber; -}(Subscriber_1.Subscriber)); -function dispatchBufferTimeSpanOnly(state) { - var subscriber = state.subscriber; - var prevContext = state.context; - if (prevContext) { - subscriber.closeContext(prevContext); - } - if (!subscriber.closed) { - state.context = subscriber.openContext(); - state.context.closeAction = this.schedule(state, state.bufferTimeSpan); - } -} -function dispatchBufferCreation(state) { - var bufferCreationInterval = state.bufferCreationInterval, bufferTimeSpan = state.bufferTimeSpan, subscriber = state.subscriber, scheduler = state.scheduler; - var context = subscriber.openContext(); - var action = this; - if (!subscriber.closed) { - subscriber.add(context.closeAction = scheduler.schedule(dispatchBufferClose, bufferTimeSpan, { subscriber: subscriber, context: context })); - action.schedule(state, bufferCreationInterval); - } -} -function dispatchBufferClose(arg) { - var subscriber = arg.subscriber, context = arg.context; - subscriber.closeContext(context); -} -//# sourceMappingURL=bufferTime.js.map + if(tokenStream.match([Tokens.PREFIXMATCH, Tokens.SUFFIXMATCH, Tokens.SUBSTRINGMATCH, + Tokens.EQUALS, Tokens.INCLUDES, Tokens.DASHMATCH])){ -/***/ }), -/* 286 */ -/***/ (function(module, exports, __webpack_require__) { + value += tokenStream.token().value; + value += this._readWhitespace(); -"use strict"; + tokenStream.mustMatch([Tokens.IDENT, Tokens.STRING]); + value += tokenStream.token().value; + value += this._readWhitespace(); + } -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; -var Subscription_1 = __webpack_require__(9); -var subscribeToResult_1 = __webpack_require__(3); -var OuterSubscriber_1 = __webpack_require__(4); -/** - * Buffers the source Observable values starting from an emission from - * `openings` and ending when the output of `closingSelector` emits. - * - * Collects values from the past as an array. Starts - * collecting only when `opening` emits, and calls the `closingSelector` - * function to get an Observable that tells when to close the buffer. - * - * - * - * Buffers values from the source by opening the buffer via signals from an - * Observable provided to `openings`, and closing and sending the buffers when - * a Subscribable or Promise returned by the `closingSelector` function emits. - * - * @example Every other second, emit the click events from the next 500ms - * var clicks = Rx.Observable.fromEvent(document, 'click'); - * var openings = Rx.Observable.interval(1000); - * var buffered = clicks.bufferToggle(openings, i => - * i % 2 ? Rx.Observable.interval(500) : Rx.Observable.empty() - * ); - * buffered.subscribe(x => console.log(x)); - * - * @see {@link buffer} - * @see {@link bufferCount} - * @see {@link bufferTime} - * @see {@link bufferWhen} - * @see {@link windowToggle} - * - * @param {SubscribableOrPromise} openings A Subscribable or Promise of notifications to start new - * buffers. - * @param {function(value: O): SubscribableOrPromise} closingSelector A function that takes - * the value emitted by the `openings` observable and returns a Subscribable or Promise, - * which, when it emits, signals that the associated buffer should be emitted - * and cleared. - * @return {Observable} An observable of arrays of buffered values. - * @method bufferToggle - * @owner Observable - */ -function bufferToggle(openings, closingSelector) { - return this.lift(new BufferToggleOperator(openings, closingSelector)); -} -exports.bufferToggle = bufferToggle; -var BufferToggleOperator = (function () { - function BufferToggleOperator(openings, closingSelector) { - this.openings = openings; - this.closingSelector = closingSelector; - } - BufferToggleOperator.prototype.call = function (subscriber, source) { - return source.subscribe(new BufferToggleSubscriber(subscriber, this.openings, this.closingSelector)); - }; - return BufferToggleOperator; -}()); -/** - * We need this JSDoc comment for affecting ESDoc. - * @ignore - * @extends {Ignored} - */ -var BufferToggleSubscriber = (function (_super) { - __extends(BufferToggleSubscriber, _super); - function BufferToggleSubscriber(destination, openings, closingSelector) { - _super.call(this, destination); - this.openings = openings; - this.closingSelector = closingSelector; - this.contexts = []; - this.add(subscribeToResult_1.subscribeToResult(this, openings)); - } - BufferToggleSubscriber.prototype._next = function (value) { - var contexts = this.contexts; - var len = contexts.length; - for (var i = 0; i < len; i++) { - contexts[i].buffer.push(value); - } - }; - BufferToggleSubscriber.prototype._error = function (err) { - var contexts = this.contexts; - while (contexts.length > 0) { - var context = contexts.shift(); - context.subscription.unsubscribe(); - context.buffer = null; - context.subscription = null; - } - this.contexts = null; - _super.prototype._error.call(this, err); - }; - BufferToggleSubscriber.prototype._complete = function () { - var contexts = this.contexts; - while (contexts.length > 0) { - var context = contexts.shift(); - this.destination.next(context.buffer); - context.subscription.unsubscribe(); - context.buffer = null; - context.subscription = null; - } - this.contexts = null; - _super.prototype._complete.call(this); - }; - BufferToggleSubscriber.prototype.notifyNext = function (outerValue, innerValue, outerIndex, innerIndex, innerSub) { - outerValue ? this.closeBuffer(outerValue) : this.openBuffer(innerValue); - }; - BufferToggleSubscriber.prototype.notifyComplete = function (innerSub) { - this.closeBuffer(innerSub.context); - }; - BufferToggleSubscriber.prototype.openBuffer = function (value) { - try { - var closingSelector = this.closingSelector; - var closingNotifier = closingSelector.call(this, value); - if (closingNotifier) { - this.trySubscribe(closingNotifier); - } - } - catch (err) { - this._error(err); - } - }; - BufferToggleSubscriber.prototype.closeBuffer = function (context) { - var contexts = this.contexts; - if (contexts && context) { - var buffer = context.buffer, subscription = context.subscription; - this.destination.next(buffer); - contexts.splice(contexts.indexOf(context), 1); - this.remove(subscription); - subscription.unsubscribe(); - } - }; - BufferToggleSubscriber.prototype.trySubscribe = function (closingNotifier) { - var contexts = this.contexts; - var buffer = []; - var subscription = new Subscription_1.Subscription(); - var context = { buffer: buffer, subscription: subscription }; - contexts.push(context); - var innerSubscription = subscribeToResult_1.subscribeToResult(this, closingNotifier, context); - if (!innerSubscription || innerSubscription.closed) { - this.closeBuffer(context); - } - else { - innerSubscription.context = context; - this.add(innerSubscription); - subscription.add(innerSubscription); - } - }; - return BufferToggleSubscriber; -}(OuterSubscriber_1.OuterSubscriber)); -//# sourceMappingURL=bufferToggle.js.map + tokenStream.mustMatch(Tokens.RBRACKET); -/***/ }), -/* 287 */ -/***/ (function(module, exports, __webpack_require__) { + return new SelectorSubPart(value + "]", "attribute", token.startLine, token.startCol); + } else { + return null; + } + }, -"use strict"; + //CSS3 Selectors + _pseudo: function(){ -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; -var Subscription_1 = __webpack_require__(9); -var tryCatch_1 = __webpack_require__(7); -var errorObject_1 = __webpack_require__(5); -var OuterSubscriber_1 = __webpack_require__(4); -var subscribeToResult_1 = __webpack_require__(3); -/** - * Buffers the source Observable values, using a factory function of closing - * Observables to determine when to close, emit, and reset the buffer. - * - * Collects values from the past as an array. When it - * starts collecting values, it calls a function that returns an Observable that - * tells when to close the buffer and restart collecting. - * - * - * - * Opens a buffer immediately, then closes the buffer when the observable - * returned by calling `closingSelector` function emits a value. When it closes - * the buffer, it immediately opens a new buffer and repeats the process. - * - * @example Emit an array of the last clicks every [1-5] random seconds - * var clicks = Rx.Observable.fromEvent(document, 'click'); - * var buffered = clicks.bufferWhen(() => - * Rx.Observable.interval(1000 + Math.random() * 4000) - * ); - * buffered.subscribe(x => console.log(x)); - * - * @see {@link buffer} - * @see {@link bufferCount} - * @see {@link bufferTime} - * @see {@link bufferToggle} - * @see {@link windowWhen} - * - * @param {function(): Observable} closingSelector A function that takes no - * arguments and returns an Observable that signals buffer closure. - * @return {Observable} An observable of arrays of buffered values. - * @method bufferWhen - * @owner Observable - */ -function bufferWhen(closingSelector) { - return this.lift(new BufferWhenOperator(closingSelector)); -} -exports.bufferWhen = bufferWhen; -var BufferWhenOperator = (function () { - function BufferWhenOperator(closingSelector) { - this.closingSelector = closingSelector; - } - BufferWhenOperator.prototype.call = function (subscriber, source) { - return source.subscribe(new BufferWhenSubscriber(subscriber, this.closingSelector)); - }; - return BufferWhenOperator; -}()); -/** - * We need this JSDoc comment for affecting ESDoc. - * @ignore - * @extends {Ignored} - */ -var BufferWhenSubscriber = (function (_super) { - __extends(BufferWhenSubscriber, _super); - function BufferWhenSubscriber(destination, closingSelector) { - _super.call(this, destination); - this.closingSelector = closingSelector; - this.subscribing = false; - this.openBuffer(); - } - BufferWhenSubscriber.prototype._next = function (value) { - this.buffer.push(value); - }; - BufferWhenSubscriber.prototype._complete = function () { - var buffer = this.buffer; - if (buffer) { - this.destination.next(buffer); - } - _super.prototype._complete.call(this); - }; - BufferWhenSubscriber.prototype._unsubscribe = function () { - this.buffer = null; - this.subscribing = false; - }; - BufferWhenSubscriber.prototype.notifyNext = function (outerValue, innerValue, outerIndex, innerIndex, innerSub) { - this.openBuffer(); - }; - BufferWhenSubscriber.prototype.notifyComplete = function () { - if (this.subscribing) { - this.complete(); - } - else { - this.openBuffer(); - } - }; - BufferWhenSubscriber.prototype.openBuffer = function () { - var closingSubscription = this.closingSubscription; - if (closingSubscription) { - this.remove(closingSubscription); - closingSubscription.unsubscribe(); - } - var buffer = this.buffer; - if (this.buffer) { - this.destination.next(buffer); - } - this.buffer = []; - var closingNotifier = tryCatch_1.tryCatch(this.closingSelector)(); - if (closingNotifier === errorObject_1.errorObject) { - this.error(errorObject_1.errorObject.e); - } - else { - closingSubscription = new Subscription_1.Subscription(); - this.closingSubscription = closingSubscription; - this.add(closingSubscription); - this.subscribing = true; - closingSubscription.add(subscribeToResult_1.subscribeToResult(this, closingNotifier)); - this.subscribing = false; - } - }; - return BufferWhenSubscriber; -}(OuterSubscriber_1.OuterSubscriber)); -//# sourceMappingURL=bufferWhen.js.map + /* + * pseudo + * : ':' ':'? [ IDENT | functional_pseudo ] + * ; + */ -/***/ }), -/* 288 */ -/***/ (function(module, exports, __webpack_require__) { + var tokenStream = this._tokenStream, + pseudo = null, + colons = ":", + line, + col; -"use strict"; + if (tokenStream.match(Tokens.COLON)){ -var combineLatest_1 = __webpack_require__(37); -/** - * Converts a higher-order Observable into a first-order Observable by waiting - * for the outer Observable to complete, then applying {@link combineLatest}. - * - * Flattens an Observable-of-Observables by applying - * {@link combineLatest} when the Observable-of-Observables completes. - * - * - * - * Takes an Observable of Observables, and collects all Observables from it. - * Once the outer Observable completes, it subscribes to all collected - * Observables and combines their values using the {@link combineLatest} - * strategy, such that: - * - Every time an inner Observable emits, the output Observable emits. - * - When the returned observable emits, it emits all of the latest values by: - * - If a `project` function is provided, it is called with each recent value - * from each inner Observable in whatever order they arrived, and the result - * of the `project` function is what is emitted by the output Observable. - * - If there is no `project` function, an array of all of the most recent - * values is emitted by the output Observable. - * - * @example Map two click events to a finite interval Observable, then apply combineAll - * var clicks = Rx.Observable.fromEvent(document, 'click'); - * var higherOrder = clicks.map(ev => - * Rx.Observable.interval(Math.random()*2000).take(3) - * ).take(2); - * var result = higherOrder.combineAll(); - * result.subscribe(x => console.log(x)); - * - * @see {@link combineLatest} - * @see {@link mergeAll} - * - * @param {function} [project] An optional function to map the most recent - * values from each inner Observable into a new result. Takes each of the most - * recent values from each collected inner Observable as arguments, in order. - * @return {Observable} An Observable of projected results or arrays of recent - * values. - * @method combineAll - * @owner Observable - */ -function combineAll(project) { - return this.lift(new combineLatest_1.CombineLatestOperator(project)); -} -exports.combineAll = combineAll; -//# sourceMappingURL=combineAll.js.map + if (tokenStream.match(Tokens.COLON)){ + colons += ":"; + } -/***/ }), -/* 289 */ -/***/ (function(module, exports, __webpack_require__) { + if (tokenStream.match(Tokens.IDENT)){ + pseudo = tokenStream.token().value; + line = tokenStream.token().startLine; + col = tokenStream.token().startCol - colons.length; + } else if (tokenStream.peek() === Tokens.FUNCTION){ + line = tokenStream.LT(1).startLine; + col = tokenStream.LT(1).startCol - colons.length; + pseudo = this._functional_pseudo(); + } -"use strict"; + if (pseudo){ + pseudo = new SelectorSubPart(colons + pseudo, "pseudo", line, col); + } + } -var mergeMapTo_1 = __webpack_require__(62); -/* tslint:enable:max-line-length */ -/** - * Projects each source value to the same Observable which is merged multiple - * times in a serialized fashion on the output Observable. - * - * It's like {@link concatMap}, but maps each value - * always to the same inner Observable. - * - * - * - * Maps each source value to the given Observable `innerObservable` regardless - * of the source value, and then flattens those resulting Observables into one - * single Observable, which is the output Observable. Each new `innerObservable` - * instance emitted on the output Observable is concatenated with the previous - * `innerObservable` instance. - * - * __Warning:__ if source values arrive endlessly and faster than their - * corresponding inner Observables can complete, it will result in memory issues - * as inner Observables amass in an unbounded buffer waiting for their turn to - * be subscribed to. - * - * Note: `concatMapTo` is equivalent to `mergeMapTo` with concurrency parameter - * set to `1`. - * - * @example For each click event, tick every second from 0 to 3, with no concurrency - * var clicks = Rx.Observable.fromEvent(document, 'click'); - * var result = clicks.concatMapTo(Rx.Observable.interval(1000).take(4)); - * result.subscribe(x => console.log(x)); - * - * // Results in the following: - * // (results are not concurrent) - * // For every click on the "document" it will emit values 0 to 3 spaced - * // on a 1000ms interval - * // one click = 1000ms-> 0 -1000ms-> 1 -1000ms-> 2 -1000ms-> 3 - * - * @see {@link concat} - * @see {@link concatAll} - * @see {@link concatMap} - * @see {@link mergeMapTo} - * @see {@link switchMapTo} - * - * @param {ObservableInput} innerObservable An Observable to replace each value from - * the source Observable. - * @param {function(outerValue: T, innerValue: I, outerIndex: number, innerIndex: number): any} [resultSelector] - * A function to produce the value on the output Observable based on the values - * and the indices of the source (outer) emission and the inner Observable - * emission. The arguments passed to this function are: - * - `outerValue`: the value that came from the source - * - `innerValue`: the value that came from the projected Observable - * - `outerIndex`: the "index" of the value that came from the source - * - `innerIndex`: the "index" of the value from the projected Observable - * @return {Observable} An observable of values merged together by joining the - * passed observable with itself, one after the other, for each value emitted - * from the source. - * @method concatMapTo - * @owner Observable - */ -function concatMapTo(innerObservable, resultSelector) { - return this.lift(new mergeMapTo_1.MergeMapToOperator(innerObservable, resultSelector, 1)); -} -exports.concatMapTo = concatMapTo; -//# sourceMappingURL=concatMapTo.js.map + return pseudo; + }, -/***/ }), -/* 290 */ -/***/ (function(module, exports, __webpack_require__) { + //CSS3 Selectors + _functional_pseudo: function(){ + /* + * functional_pseudo + * : FUNCTION S* expression ')' + * ; + */ + + var tokenStream = this._tokenStream, + value = null; + + if(tokenStream.match(Tokens.FUNCTION)){ + value = tokenStream.token().value; + value += this._readWhitespace(); + value += this._expression(); + tokenStream.mustMatch(Tokens.RPAREN); + value += ")"; + } -"use strict"; + return value; + }, -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; -var Subscriber_1 = __webpack_require__(2); -/** - * Counts the number of emissions on the source and emits that number when the - * source completes. - * - * Tells how many values were emitted, when the source - * completes. - * - * - * - * `count` transforms an Observable that emits values into an Observable that - * emits a single value that represents the number of values emitted by the - * source Observable. If the source Observable terminates with an error, `count` - * will pass this error notification along without emitting a value first. If - * the source Observable does not terminate at all, `count` will neither emit - * a value nor terminate. This operator takes an optional `predicate` function - * as argument, in which case the output emission will represent the number of - * source values that matched `true` with the `predicate`. - * - * @example Counts how many seconds have passed before the first click happened - * var seconds = Rx.Observable.interval(1000); - * var clicks = Rx.Observable.fromEvent(document, 'click'); - * var secondsBeforeClick = seconds.takeUntil(clicks); - * var result = secondsBeforeClick.count(); - * result.subscribe(x => console.log(x)); - * - * @example Counts how many odd numbers are there between 1 and 7 - * var numbers = Rx.Observable.range(1, 7); - * var result = numbers.count(i => i % 2 === 1); - * result.subscribe(x => console.log(x)); - * - * // Results in: - * // 4 - * - * @see {@link max} - * @see {@link min} - * @see {@link reduce} - * - * @param {function(value: T, i: number, source: Observable): boolean} [predicate] A - * boolean function to select what values are to be counted. It is provided with - * arguments of: - * - `value`: the value from the source Observable. - * - `index`: the (zero-based) "index" of the value from the source Observable. - * - `source`: the source Observable instance itself. - * @return {Observable} An Observable of one number that represents the count as - * described above. - * @method count - * @owner Observable - */ -function count(predicate) { - return this.lift(new CountOperator(predicate, this)); -} -exports.count = count; -var CountOperator = (function () { - function CountOperator(predicate, source) { - this.predicate = predicate; - this.source = source; - } - CountOperator.prototype.call = function (subscriber, source) { - return source.subscribe(new CountSubscriber(subscriber, this.predicate, this.source)); - }; - return CountOperator; -}()); -/** - * We need this JSDoc comment for affecting ESDoc. - * @ignore - * @extends {Ignored} - */ -var CountSubscriber = (function (_super) { - __extends(CountSubscriber, _super); - function CountSubscriber(destination, predicate, source) { - _super.call(this, destination); - this.predicate = predicate; - this.source = source; - this.count = 0; - this.index = 0; - } - CountSubscriber.prototype._next = function (value) { - if (this.predicate) { - this._tryPredicate(value); - } - else { - this.count++; - } - }; - CountSubscriber.prototype._tryPredicate = function (value) { - var result; - try { - result = this.predicate(value, this.index++, this.source); - } - catch (err) { - this.destination.error(err); - return; - } - if (result) { - this.count++; - } - }; - CountSubscriber.prototype._complete = function () { - this.destination.next(this.count); - this.destination.complete(); - }; - return CountSubscriber; -}(Subscriber_1.Subscriber)); -//# sourceMappingURL=count.js.map + //CSS3 Selectors + _expression: function(){ + /* + * expression + * : [ [ PLUS | '-' | DIMENSION | NUMBER | STRING | IDENT ] S* ]+ + * ; + */ + + var tokenStream = this._tokenStream, + value = ""; + + while(tokenStream.match([Tokens.PLUS, Tokens.MINUS, Tokens.DIMENSION, + Tokens.NUMBER, Tokens.STRING, Tokens.IDENT, Tokens.LENGTH, + Tokens.FREQ, Tokens.ANGLE, Tokens.TIME, + Tokens.RESOLUTION, Tokens.SLASH])){ + + value += tokenStream.token().value; + value += this._readWhitespace(); + } + + return value.length ? value : null; + + }, + + //CSS3 Selectors + _negation: function(){ + /* + * negation + * : NOT S* negation_arg S* ')' + * ; + */ + + var tokenStream = this._tokenStream, + line, + col, + value = "", + arg, + subpart = null; + + if (tokenStream.match(Tokens.NOT)){ + value = tokenStream.token().value; + line = tokenStream.token().startLine; + col = tokenStream.token().startCol; + value += this._readWhitespace(); + arg = this._negation_arg(); + value += arg; + value += this._readWhitespace(); + tokenStream.match(Tokens.RPAREN); + value += tokenStream.token().value; + + subpart = new SelectorSubPart(value, "not", line, col); + subpart.args.push(arg); + } + + return subpart; + }, + + //CSS3 Selectors + _negation_arg: function(){ + /* + * negation_arg + * : type_selector | universal | HASH | class | attrib | pseudo + * ; + */ + + var tokenStream = this._tokenStream, + args = [ + this._type_selector, + this._universal, + function(){ + return tokenStream.match(Tokens.HASH) ? + new SelectorSubPart(tokenStream.token().value, "id", tokenStream.token().startLine, tokenStream.token().startCol) : + null; + }, + this._class, + this._attrib, + this._pseudo + ], + arg = null, + i = 0, + len = args.length, + line, + col, + part; + + line = tokenStream.LT(1).startLine; + col = tokenStream.LT(1).startCol; + + while(i < len && arg === null){ + + arg = args[i].call(this); + i++; + } + + //must be a negation arg + if (arg === null){ + this._unexpectedToken(tokenStream.LT(1)); + } + + //it's an element name + if (arg.type === "elementName"){ + part = new SelectorPart(arg, [], arg.toString(), line, col); + } else { + part = new SelectorPart(null, [arg], arg.toString(), line, col); + } + + return part; + }, + + _declaration: function(){ + + /* + * declaration + * : property ':' S* expr prio? + * | /( empty )/ + * ; + */ + + var tokenStream = this._tokenStream, + property = null, + expr = null, + prio = null, + invalid = null, + propertyName= ""; + + property = this._property(); + if (property !== null){ -/***/ }), -/* 291 */ -/***/ (function(module, exports, __webpack_require__) { + tokenStream.mustMatch(Tokens.COLON); + this._readWhitespace(); -"use strict"; + expr = this._expr(); -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; -var OuterSubscriber_1 = __webpack_require__(4); -var subscribeToResult_1 = __webpack_require__(3); -/** - * Emits a value from the source Observable only after a particular time span - * determined by another Observable has passed without another source emission. - * - * It's like {@link debounceTime}, but the time span of - * emission silence is determined by a second Observable. - * - * - * - * `debounce` delays values emitted by the source Observable, but drops previous - * pending delayed emissions if a new value arrives on the source Observable. - * This operator keeps track of the most recent value from the source - * Observable, and spawns a duration Observable by calling the - * `durationSelector` function. The value is emitted only when the duration - * Observable emits a value or completes, and if no other value was emitted on - * the source Observable since the duration Observable was spawned. If a new - * value appears before the duration Observable emits, the previous value will - * be dropped and will not be emitted on the output Observable. - * - * Like {@link debounceTime}, this is a rate-limiting operator, and also a - * delay-like operator since output emissions do not necessarily occur at the - * same time as they did on the source Observable. - * - * @example Emit the most recent click after a burst of clicks - * var clicks = Rx.Observable.fromEvent(document, 'click'); - * var result = clicks.debounce(() => Rx.Observable.interval(1000)); - * result.subscribe(x => console.log(x)); - * - * @see {@link audit} - * @see {@link debounceTime} - * @see {@link delayWhen} - * @see {@link throttle} - * - * @param {function(value: T): SubscribableOrPromise} durationSelector A function - * that receives a value from the source Observable, for computing the timeout - * duration for each source value, returned as an Observable or a Promise. - * @return {Observable} An Observable that delays the emissions of the source - * Observable by the specified duration Observable returned by - * `durationSelector`, and may drop some values if they occur too frequently. - * @method debounce - * @owner Observable - */ -function debounce(durationSelector) { - return this.lift(new DebounceOperator(durationSelector)); -} -exports.debounce = debounce; -var DebounceOperator = (function () { - function DebounceOperator(durationSelector) { - this.durationSelector = durationSelector; - } - DebounceOperator.prototype.call = function (subscriber, source) { - return source.subscribe(new DebounceSubscriber(subscriber, this.durationSelector)); - }; - return DebounceOperator; -}()); -/** - * We need this JSDoc comment for affecting ESDoc. - * @ignore - * @extends {Ignored} - */ -var DebounceSubscriber = (function (_super) { - __extends(DebounceSubscriber, _super); - function DebounceSubscriber(destination, durationSelector) { - _super.call(this, destination); - this.durationSelector = durationSelector; - this.hasValue = false; - this.durationSubscription = null; - } - DebounceSubscriber.prototype._next = function (value) { - try { - var result = this.durationSelector.call(this, value); - if (result) { - this._tryNext(value, result); - } - } - catch (err) { - this.destination.error(err); - } - }; - DebounceSubscriber.prototype._complete = function () { - this.emitValue(); - this.destination.complete(); - }; - DebounceSubscriber.prototype._tryNext = function (value, duration) { - var subscription = this.durationSubscription; - this.value = value; - this.hasValue = true; - if (subscription) { - subscription.unsubscribe(); - this.remove(subscription); - } - subscription = subscribeToResult_1.subscribeToResult(this, duration); - if (!subscription.closed) { - this.add(this.durationSubscription = subscription); - } - }; - DebounceSubscriber.prototype.notifyNext = function (outerValue, innerValue, outerIndex, innerIndex, innerSub) { - this.emitValue(); - }; - DebounceSubscriber.prototype.notifyComplete = function () { - this.emitValue(); - }; - DebounceSubscriber.prototype.emitValue = function () { - if (this.hasValue) { - var value = this.value; - var subscription = this.durationSubscription; - if (subscription) { - this.durationSubscription = null; - subscription.unsubscribe(); - this.remove(subscription); - } - this.value = null; - this.hasValue = false; - _super.prototype._next.call(this, value); - } - }; - return DebounceSubscriber; -}(OuterSubscriber_1.OuterSubscriber)); -//# sourceMappingURL=debounce.js.map + //if there's no parts for the value, it's an error + if (!expr || expr.length === 0){ + this._unexpectedToken(tokenStream.LT(1)); + } -/***/ }), -/* 292 */ -/***/ (function(module, exports, __webpack_require__) { + prio = this._prio(); -"use strict"; + /* + * If hacks should be allowed, then only check the root + * property. If hacks should not be allowed, treat + * _property or *property as invalid properties. + */ + propertyName = property.toString(); + if (this.options.starHack && property.hack === "*" || + this.options.underscoreHack && property.hack === "_") { -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; -var Subscriber_1 = __webpack_require__(2); -var async_1 = __webpack_require__(8); -/** - * Emits a value from the source Observable only after a particular time span - * has passed without another source emission. - * - * It's like {@link delay}, but passes only the most - * recent value from each burst of emissions. - * - * - * - * `debounceTime` delays values emitted by the source Observable, but drops - * previous pending delayed emissions if a new value arrives on the source - * Observable. This operator keeps track of the most recent value from the - * source Observable, and emits that only when `dueTime` enough time has passed - * without any other value appearing on the source Observable. If a new value - * appears before `dueTime` silence occurs, the previous value will be dropped - * and will not be emitted on the output Observable. - * - * This is a rate-limiting operator, because it is impossible for more than one - * value to be emitted in any time window of duration `dueTime`, but it is also - * a delay-like operator since output emissions do not occur at the same time as - * they did on the source Observable. Optionally takes a {@link IScheduler} for - * managing timers. - * - * @example Emit the most recent click after a burst of clicks - * var clicks = Rx.Observable.fromEvent(document, 'click'); - * var result = clicks.debounceTime(1000); - * result.subscribe(x => console.log(x)); - * - * @see {@link auditTime} - * @see {@link debounce} - * @see {@link delay} - * @see {@link sampleTime} - * @see {@link throttleTime} - * - * @param {number} dueTime The timeout duration in milliseconds (or the time - * unit determined internally by the optional `scheduler`) for the window of - * time required to wait for emission silence before emitting the most recent - * source value. - * @param {Scheduler} [scheduler=async] The {@link IScheduler} to use for - * managing the timers that handle the timeout for each value. - * @return {Observable} An Observable that delays the emissions of the source - * Observable by the specified `dueTime`, and may drop some values if they occur - * too frequently. - * @method debounceTime - * @owner Observable - */ -function debounceTime(dueTime, scheduler) { - if (scheduler === void 0) { scheduler = async_1.async; } - return this.lift(new DebounceTimeOperator(dueTime, scheduler)); -} -exports.debounceTime = debounceTime; -var DebounceTimeOperator = (function () { - function DebounceTimeOperator(dueTime, scheduler) { - this.dueTime = dueTime; - this.scheduler = scheduler; - } - DebounceTimeOperator.prototype.call = function (subscriber, source) { - return source.subscribe(new DebounceTimeSubscriber(subscriber, this.dueTime, this.scheduler)); - }; - return DebounceTimeOperator; -}()); -/** - * We need this JSDoc comment for affecting ESDoc. - * @ignore - * @extends {Ignored} - */ -var DebounceTimeSubscriber = (function (_super) { - __extends(DebounceTimeSubscriber, _super); - function DebounceTimeSubscriber(destination, dueTime, scheduler) { - _super.call(this, destination); - this.dueTime = dueTime; - this.scheduler = scheduler; - this.debouncedSubscription = null; - this.lastValue = null; - this.hasValue = false; - } - DebounceTimeSubscriber.prototype._next = function (value) { - this.clearDebounce(); - this.lastValue = value; - this.hasValue = true; - this.add(this.debouncedSubscription = this.scheduler.schedule(dispatchNext, this.dueTime, this)); - }; - DebounceTimeSubscriber.prototype._complete = function () { - this.debouncedNext(); - this.destination.complete(); - }; - DebounceTimeSubscriber.prototype.debouncedNext = function () { - this.clearDebounce(); - if (this.hasValue) { - this.destination.next(this.lastValue); - this.lastValue = null; - this.hasValue = false; - } - }; - DebounceTimeSubscriber.prototype.clearDebounce = function () { - var debouncedSubscription = this.debouncedSubscription; - if (debouncedSubscription !== null) { - this.remove(debouncedSubscription); - debouncedSubscription.unsubscribe(); - this.debouncedSubscription = null; - } - }; - return DebounceTimeSubscriber; -}(Subscriber_1.Subscriber)); -function dispatchNext(subscriber) { - subscriber.debouncedNext(); -} -//# sourceMappingURL=debounceTime.js.map + propertyName = property.text; + } -/***/ }), -/* 293 */ -/***/ (function(module, exports, __webpack_require__) { + try { + this._validateProperty(propertyName, expr); + } catch (ex) { + invalid = ex; + } -"use strict"; + this.fire({ + type: "property", + property: property, + value: expr, + important: prio, + line: property.line, + col: property.col, + invalid: invalid + }); -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; -var Subscriber_1 = __webpack_require__(2); -/* tslint:enable:max-line-length */ -/** - * Emits a given value if the source Observable completes without emitting any - * `next` value, otherwise mirrors the source Observable. - * - * If the source Observable turns out to be empty, then - * this operator will emit a default value. - * - * - * - * `defaultIfEmpty` emits the values emitted by the source Observable or a - * specified default value if the source Observable is empty (completes without - * having emitted any `next` value). - * - * @example If no clicks happen in 5 seconds, then emit "no clicks" - * var clicks = Rx.Observable.fromEvent(document, 'click'); - * var clicksBeforeFive = clicks.takeUntil(Rx.Observable.interval(5000)); - * var result = clicksBeforeFive.defaultIfEmpty('no clicks'); - * result.subscribe(x => console.log(x)); - * - * @see {@link empty} - * @see {@link last} - * - * @param {any} [defaultValue=null] The default value used if the source - * Observable is empty. - * @return {Observable} An Observable that emits either the specified - * `defaultValue` if the source Observable emits no items, or the values emitted - * by the source Observable. - * @method defaultIfEmpty - * @owner Observable - */ -function defaultIfEmpty(defaultValue) { - if (defaultValue === void 0) { defaultValue = null; } - return this.lift(new DefaultIfEmptyOperator(defaultValue)); -} -exports.defaultIfEmpty = defaultIfEmpty; -var DefaultIfEmptyOperator = (function () { - function DefaultIfEmptyOperator(defaultValue) { - this.defaultValue = defaultValue; - } - DefaultIfEmptyOperator.prototype.call = function (subscriber, source) { - return source.subscribe(new DefaultIfEmptySubscriber(subscriber, this.defaultValue)); - }; - return DefaultIfEmptyOperator; -}()); -/** - * We need this JSDoc comment for affecting ESDoc. - * @ignore - * @extends {Ignored} - */ -var DefaultIfEmptySubscriber = (function (_super) { - __extends(DefaultIfEmptySubscriber, _super); - function DefaultIfEmptySubscriber(destination, defaultValue) { - _super.call(this, destination); - this.defaultValue = defaultValue; - this.isEmpty = true; - } - DefaultIfEmptySubscriber.prototype._next = function (value) { - this.isEmpty = false; - this.destination.next(value); - }; - DefaultIfEmptySubscriber.prototype._complete = function () { - if (this.isEmpty) { - this.destination.next(this.defaultValue); - } - this.destination.complete(); - }; - return DefaultIfEmptySubscriber; -}(Subscriber_1.Subscriber)); -//# sourceMappingURL=defaultIfEmpty.js.map + return true; + } else { + return false; + } + }, -/***/ }), -/* 294 */ -/***/ (function(module, exports, __webpack_require__) { + _prio: function(){ + /* + * prio + * : IMPORTANT_SYM S* + * ; + */ -"use strict"; + var tokenStream = this._tokenStream, + result = tokenStream.match(Tokens.IMPORTANT_SYM); -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; -var async_1 = __webpack_require__(8); -var isDate_1 = __webpack_require__(27); -var Subscriber_1 = __webpack_require__(2); -var Notification_1 = __webpack_require__(30); -/** - * Delays the emission of items from the source Observable by a given timeout or - * until a given Date. - * - * Time shifts each item by some specified amount of - * milliseconds. - * - * - * - * If the delay argument is a Number, this operator time shifts the source - * Observable by that amount of time expressed in milliseconds. The relative - * time intervals between the values are preserved. - * - * If the delay argument is a Date, this operator time shifts the start of the - * Observable execution until the given date occurs. - * - * @example Delay each click by one second - * var clicks = Rx.Observable.fromEvent(document, 'click'); - * var delayedClicks = clicks.delay(1000); // each click emitted after 1 second - * delayedClicks.subscribe(x => console.log(x)); - * - * @example Delay all clicks until a future date happens - * var clicks = Rx.Observable.fromEvent(document, 'click'); - * var date = new Date('March 15, 2050 12:00:00'); // in the future - * var delayedClicks = clicks.delay(date); // click emitted only after that date - * delayedClicks.subscribe(x => console.log(x)); - * - * @see {@link debounceTime} - * @see {@link delayWhen} - * - * @param {number|Date} delay The delay duration in milliseconds (a `number`) or - * a `Date` until which the emission of the source items is delayed. - * @param {Scheduler} [scheduler=async] The IScheduler to use for - * managing the timers that handle the time-shift for each item. - * @return {Observable} An Observable that delays the emissions of the source - * Observable by the specified timeout or Date. - * @method delay - * @owner Observable - */ -function delay(delay, scheduler) { - if (scheduler === void 0) { scheduler = async_1.async; } - var absoluteDelay = isDate_1.isDate(delay); - var delayFor = absoluteDelay ? (+delay - scheduler.now()) : Math.abs(delay); - return this.lift(new DelayOperator(delayFor, scheduler)); -} -exports.delay = delay; -var DelayOperator = (function () { - function DelayOperator(delay, scheduler) { - this.delay = delay; - this.scheduler = scheduler; - } - DelayOperator.prototype.call = function (subscriber, source) { - return source.subscribe(new DelaySubscriber(subscriber, this.delay, this.scheduler)); - }; - return DelayOperator; -}()); -/** - * We need this JSDoc comment for affecting ESDoc. - * @ignore - * @extends {Ignored} - */ -var DelaySubscriber = (function (_super) { - __extends(DelaySubscriber, _super); - function DelaySubscriber(destination, delay, scheduler) { - _super.call(this, destination); - this.delay = delay; - this.scheduler = scheduler; - this.queue = []; - this.active = false; - this.errored = false; - } - DelaySubscriber.dispatch = function (state) { - var source = state.source; - var queue = source.queue; - var scheduler = state.scheduler; - var destination = state.destination; - while (queue.length > 0 && (queue[0].time - scheduler.now()) <= 0) { - queue.shift().notification.observe(destination); - } - if (queue.length > 0) { - var delay_1 = Math.max(0, queue[0].time - scheduler.now()); - this.schedule(state, delay_1); - } - else { - source.active = false; - } - }; - DelaySubscriber.prototype._schedule = function (scheduler) { - this.active = true; - this.add(scheduler.schedule(DelaySubscriber.dispatch, this.delay, { - source: this, destination: this.destination, scheduler: scheduler - })); - }; - DelaySubscriber.prototype.scheduleNotification = function (notification) { - if (this.errored === true) { - return; - } - var scheduler = this.scheduler; - var message = new DelayMessage(scheduler.now() + this.delay, notification); - this.queue.push(message); - if (this.active === false) { - this._schedule(scheduler); - } - }; - DelaySubscriber.prototype._next = function (value) { - this.scheduleNotification(Notification_1.Notification.createNext(value)); - }; - DelaySubscriber.prototype._error = function (err) { - this.errored = true; - this.queue = []; - this.destination.error(err); - }; - DelaySubscriber.prototype._complete = function () { - this.scheduleNotification(Notification_1.Notification.createComplete()); - }; - return DelaySubscriber; -}(Subscriber_1.Subscriber)); -var DelayMessage = (function () { - function DelayMessage(time, notification) { - this.time = time; - this.notification = notification; - } - return DelayMessage; -}()); -//# sourceMappingURL=delay.js.map + this._readWhitespace(); + return result; + }, -/***/ }), -/* 295 */ -/***/ (function(module, exports, __webpack_require__) { + _expr: function(inFunction){ + /* + * expr + * : term [ operator term ]* + * ; + */ + + var values = [], + //valueParts = [], + value = null, + operator = null; + + value = this._term(inFunction); + if (value !== null){ + + values.push(value); + + do { + operator = this._operator(inFunction); + + //if there's an operator, keep building up the value parts + if (operator){ + values.push(operator); + } /*else { + //if there's not an operator, you have a full value + values.push(new PropertyValue(valueParts, valueParts[0].line, valueParts[0].col)); + valueParts = []; + }*/ + + value = this._term(inFunction); + + if (value === null){ + break; + } else { + values.push(value); + } + } while(true); + } -"use strict"; + //cleanup + /*if (valueParts.length){ + values.push(new PropertyValue(valueParts, valueParts[0].line, valueParts[0].col)); + }*/ -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; -var Subscriber_1 = __webpack_require__(2); -var Observable_1 = __webpack_require__(0); -var OuterSubscriber_1 = __webpack_require__(4); -var subscribeToResult_1 = __webpack_require__(3); -/** - * Delays the emission of items from the source Observable by a given time span - * determined by the emissions of another Observable. - * - * It's like {@link delay}, but the time span of the - * delay duration is determined by a second Observable. - * - * - * - * `delayWhen` time shifts each emitted value from the source Observable by a - * time span determined by another Observable. When the source emits a value, - * the `delayDurationSelector` function is called with the source value as - * argument, and should return an Observable, called the "duration" Observable. - * The source value is emitted on the output Observable only when the duration - * Observable emits a value or completes. - * - * Optionally, `delayWhen` takes a second argument, `subscriptionDelay`, which - * is an Observable. When `subscriptionDelay` emits its first value or - * completes, the source Observable is subscribed to and starts behaving like - * described in the previous paragraph. If `subscriptionDelay` is not provided, - * `delayWhen` will subscribe to the source Observable as soon as the output - * Observable is subscribed. - * - * @example Delay each click by a random amount of time, between 0 and 5 seconds - * var clicks = Rx.Observable.fromEvent(document, 'click'); - * var delayedClicks = clicks.delayWhen(event => - * Rx.Observable.interval(Math.random() * 5000) - * ); - * delayedClicks.subscribe(x => console.log(x)); - * - * @see {@link debounce} - * @see {@link delay} - * - * @param {function(value: T): Observable} delayDurationSelector A function that - * returns an Observable for each value emitted by the source Observable, which - * is then used to delay the emission of that item on the output Observable - * until the Observable returned from this function emits a value. - * @param {Observable} subscriptionDelay An Observable that triggers the - * subscription to the source Observable once it emits any value. - * @return {Observable} An Observable that delays the emissions of the source - * Observable by an amount of time specified by the Observable returned by - * `delayDurationSelector`. - * @method delayWhen - * @owner Observable - */ -function delayWhen(delayDurationSelector, subscriptionDelay) { - if (subscriptionDelay) { - return new SubscriptionDelayObservable(this, subscriptionDelay) - .lift(new DelayWhenOperator(delayDurationSelector)); - } - return this.lift(new DelayWhenOperator(delayDurationSelector)); -} -exports.delayWhen = delayWhen; -var DelayWhenOperator = (function () { - function DelayWhenOperator(delayDurationSelector) { - this.delayDurationSelector = delayDurationSelector; - } - DelayWhenOperator.prototype.call = function (subscriber, source) { - return source.subscribe(new DelayWhenSubscriber(subscriber, this.delayDurationSelector)); - }; - return DelayWhenOperator; -}()); -/** - * We need this JSDoc comment for affecting ESDoc. - * @ignore - * @extends {Ignored} - */ -var DelayWhenSubscriber = (function (_super) { - __extends(DelayWhenSubscriber, _super); - function DelayWhenSubscriber(destination, delayDurationSelector) { - _super.call(this, destination); - this.delayDurationSelector = delayDurationSelector; - this.completed = false; - this.delayNotifierSubscriptions = []; - this.values = []; - } - DelayWhenSubscriber.prototype.notifyNext = function (outerValue, innerValue, outerIndex, innerIndex, innerSub) { - this.destination.next(outerValue); - this.removeSubscription(innerSub); - this.tryComplete(); - }; - DelayWhenSubscriber.prototype.notifyError = function (error, innerSub) { - this._error(error); - }; - DelayWhenSubscriber.prototype.notifyComplete = function (innerSub) { - var value = this.removeSubscription(innerSub); - if (value) { - this.destination.next(value); - } - this.tryComplete(); - }; - DelayWhenSubscriber.prototype._next = function (value) { - try { - var delayNotifier = this.delayDurationSelector(value); - if (delayNotifier) { - this.tryDelay(delayNotifier, value); - } - } - catch (err) { - this.destination.error(err); - } - }; - DelayWhenSubscriber.prototype._complete = function () { - this.completed = true; - this.tryComplete(); - }; - DelayWhenSubscriber.prototype.removeSubscription = function (subscription) { - subscription.unsubscribe(); - var subscriptionIdx = this.delayNotifierSubscriptions.indexOf(subscription); - var value = null; - if (subscriptionIdx !== -1) { - value = this.values[subscriptionIdx]; - this.delayNotifierSubscriptions.splice(subscriptionIdx, 1); - this.values.splice(subscriptionIdx, 1); - } - return value; - }; - DelayWhenSubscriber.prototype.tryDelay = function (delayNotifier, value) { - var notifierSubscription = subscribeToResult_1.subscribeToResult(this, delayNotifier, value); - if (notifierSubscription && !notifierSubscription.closed) { - this.add(notifierSubscription); - this.delayNotifierSubscriptions.push(notifierSubscription); - } - this.values.push(value); - }; - DelayWhenSubscriber.prototype.tryComplete = function () { - if (this.completed && this.delayNotifierSubscriptions.length === 0) { - this.destination.complete(); - } - }; - return DelayWhenSubscriber; -}(OuterSubscriber_1.OuterSubscriber)); -/** - * We need this JSDoc comment for affecting ESDoc. - * @ignore - * @extends {Ignored} - */ -var SubscriptionDelayObservable = (function (_super) { - __extends(SubscriptionDelayObservable, _super); - function SubscriptionDelayObservable(source, subscriptionDelay) { - _super.call(this); - this.source = source; - this.subscriptionDelay = subscriptionDelay; - } - SubscriptionDelayObservable.prototype._subscribe = function (subscriber) { - this.subscriptionDelay.subscribe(new SubscriptionDelaySubscriber(subscriber, this.source)); - }; - return SubscriptionDelayObservable; -}(Observable_1.Observable)); -/** - * We need this JSDoc comment for affecting ESDoc. - * @ignore - * @extends {Ignored} - */ -var SubscriptionDelaySubscriber = (function (_super) { - __extends(SubscriptionDelaySubscriber, _super); - function SubscriptionDelaySubscriber(parent, source) { - _super.call(this); - this.parent = parent; - this.source = source; - this.sourceSubscribed = false; - } - SubscriptionDelaySubscriber.prototype._next = function (unused) { - this.subscribeToSource(); - }; - SubscriptionDelaySubscriber.prototype._error = function (err) { - this.unsubscribe(); - this.parent.error(err); - }; - SubscriptionDelaySubscriber.prototype._complete = function () { - this.subscribeToSource(); - }; - SubscriptionDelaySubscriber.prototype.subscribeToSource = function () { - if (!this.sourceSubscribed) { - this.sourceSubscribed = true; - this.unsubscribe(); - this.source.subscribe(this.parent); - } - }; - return SubscriptionDelaySubscriber; -}(Subscriber_1.Subscriber)); -//# sourceMappingURL=delayWhen.js.map + return values.length > 0 ? new PropertyValue(values, values[0].line, values[0].col) : null; + }, -/***/ }), -/* 296 */ -/***/ (function(module, exports, __webpack_require__) { + _term: function(inFunction){ + + /* + * term + * : unary_operator? + * [ NUMBER S* | PERCENTAGE S* | LENGTH S* | ANGLE S* | + * TIME S* | FREQ S* | function | ie_function ] + * | STRING S* | IDENT S* | URI S* | UNICODERANGE S* | hexcolor + * ; + */ + + var tokenStream = this._tokenStream, + unary = null, + value = null, + endChar = null, + token, + line, + col; + + //returns the operator or null + unary = this._unary_operator(); + if (unary !== null){ + line = tokenStream.token().startLine; + col = tokenStream.token().startCol; + } -"use strict"; + //exception for IE filters + if (tokenStream.peek() === Tokens.IE_FUNCTION && this.options.ieFilters){ -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; -var Subscriber_1 = __webpack_require__(2); -/** - * Converts an Observable of {@link Notification} objects into the emissions - * that they represent. - * - * Unwraps {@link Notification} objects as actual `next`, - * `error` and `complete` emissions. The opposite of {@link materialize}. - * - * - * - * `dematerialize` is assumed to operate an Observable that only emits - * {@link Notification} objects as `next` emissions, and does not emit any - * `error`. Such Observable is the output of a `materialize` operation. Those - * notifications are then unwrapped using the metadata they contain, and emitted - * as `next`, `error`, and `complete` on the output Observable. - * - * Use this operator in conjunction with {@link materialize}. - * - * @example Convert an Observable of Notifications to an actual Observable - * var notifA = new Rx.Notification('N', 'A'); - * var notifB = new Rx.Notification('N', 'B'); - * var notifE = new Rx.Notification('E', void 0, - * new TypeError('x.toUpperCase is not a function') - * ); - * var materialized = Rx.Observable.of(notifA, notifB, notifE); - * var upperCase = materialized.dematerialize(); - * upperCase.subscribe(x => console.log(x), e => console.error(e)); - * - * // Results in: - * // A - * // B - * // TypeError: x.toUpperCase is not a function - * - * @see {@link Notification} - * @see {@link materialize} - * - * @return {Observable} An Observable that emits items and notifications - * embedded in Notification objects emitted by the source Observable. - * @method dematerialize - * @owner Observable - */ -function dematerialize() { - return this.lift(new DeMaterializeOperator()); -} -exports.dematerialize = dematerialize; -var DeMaterializeOperator = (function () { - function DeMaterializeOperator() { - } - DeMaterializeOperator.prototype.call = function (subscriber, source) { - return source.subscribe(new DeMaterializeSubscriber(subscriber)); - }; - return DeMaterializeOperator; -}()); -/** - * We need this JSDoc comment for affecting ESDoc. - * @ignore - * @extends {Ignored} - */ -var DeMaterializeSubscriber = (function (_super) { - __extends(DeMaterializeSubscriber, _super); - function DeMaterializeSubscriber(destination) { - _super.call(this, destination); - } - DeMaterializeSubscriber.prototype._next = function (value) { - value.observe(this.destination); - }; - return DeMaterializeSubscriber; -}(Subscriber_1.Subscriber)); -//# sourceMappingURL=dematerialize.js.map + value = this._ie_function(); + if (unary === null){ + line = tokenStream.token().startLine; + col = tokenStream.token().startCol; + } -/***/ }), -/* 297 */ -/***/ (function(module, exports, __webpack_require__) { + //see if it's a simple block + } else if (inFunction && tokenStream.match([Tokens.LPAREN, Tokens.LBRACE, Tokens.LBRACKET])){ -"use strict"; + token = tokenStream.token(); + endChar = token.endChar; + value = token.value + this._expr(inFunction).text; + if (unary === null){ + line = tokenStream.token().startLine; + col = tokenStream.token().startCol; + } + tokenStream.mustMatch(Tokens.type(endChar)); + value += endChar; + this._readWhitespace(); + + //see if there's a simple match + } else if (tokenStream.match([Tokens.NUMBER, Tokens.PERCENTAGE, Tokens.LENGTH, + Tokens.ANGLE, Tokens.TIME, + Tokens.FREQ, Tokens.STRING, Tokens.IDENT, Tokens.URI, Tokens.UNICODE_RANGE])){ + + value = tokenStream.token().value; + if (unary === null){ + line = tokenStream.token().startLine; + col = tokenStream.token().startCol; + } + this._readWhitespace(); + } else { -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; -var OuterSubscriber_1 = __webpack_require__(4); -var subscribeToResult_1 = __webpack_require__(3); -var Set_1 = __webpack_require__(372); -/** - * Returns an Observable that emits all items emitted by the source Observable that are distinct by comparison from previous items. - * - * If a keySelector function is provided, then it will project each value from the source observable into a new value that it will - * check for equality with previously projected values. If a keySelector function is not provided, it will use each value from the - * source observable directly with an equality check against previous values. - * - * In JavaScript runtimes that support `Set`, this operator will use a `Set` to improve performance of the distinct value checking. - * - * In other runtimes, this operator will use a minimal implementation of `Set` that relies on an `Array` and `indexOf` under the - * hood, so performance will degrade as more values are checked for distinction. Even in newer browsers, a long-running `distinct` - * use might result in memory leaks. To help alleviate this in some scenarios, an optional `flushes` parameter is also provided so - * that the internal `Set` can be "flushed", basically clearing it of values. - * - * @example A simple example with numbers - * Observable.of(1, 1, 2, 2, 2, 1, 2, 3, 4, 3, 2, 1) - * .distinct() - * .subscribe(x => console.log(x)); // 1, 2, 3, 4 - * - * @example An example using a keySelector function - * interface Person { - * age: number, - * name: string - * } - * - * Observable.of( - * { age: 4, name: 'Foo'}, - * { age: 7, name: 'Bar'}, - * { age: 5, name: 'Foo'}) - * .distinct((p: Person) => p.name) - * .subscribe(x => console.log(x)); - * - * // displays: - * // { age: 4, name: 'Foo' } - * // { age: 7, name: 'Bar' } - * - * @see {@link distinctUntilChanged} - * @see {@link distinctUntilKeyChanged} - * - * @param {function} [keySelector] Optional function to select which value you want to check as distinct. - * @param {Observable} [flushes] Optional Observable for flushing the internal HashSet of the operator. - * @return {Observable} An Observable that emits items from the source Observable with distinct values. - * @method distinct - * @owner Observable - */ -function distinct(keySelector, flushes) { - return this.lift(new DistinctOperator(keySelector, flushes)); -} -exports.distinct = distinct; -var DistinctOperator = (function () { - function DistinctOperator(keySelector, flushes) { - this.keySelector = keySelector; - this.flushes = flushes; - } - DistinctOperator.prototype.call = function (subscriber, source) { - return source.subscribe(new DistinctSubscriber(subscriber, this.keySelector, this.flushes)); - }; - return DistinctOperator; -}()); -/** - * We need this JSDoc comment for affecting ESDoc. - * @ignore - * @extends {Ignored} - */ -var DistinctSubscriber = (function (_super) { - __extends(DistinctSubscriber, _super); - function DistinctSubscriber(destination, keySelector, flushes) { - _super.call(this, destination); - this.keySelector = keySelector; - this.values = new Set_1.Set(); - if (flushes) { - this.add(subscribeToResult_1.subscribeToResult(this, flushes)); - } - } - DistinctSubscriber.prototype.notifyNext = function (outerValue, innerValue, outerIndex, innerIndex, innerSub) { - this.values.clear(); - }; - DistinctSubscriber.prototype.notifyError = function (error, innerSub) { - this._error(error); - }; - DistinctSubscriber.prototype._next = function (value) { - if (this.keySelector) { - this._useKeySelector(value); - } - else { - this._finalizeNext(value, value); - } - }; - DistinctSubscriber.prototype._useKeySelector = function (value) { - var key; - var destination = this.destination; - try { - key = this.keySelector(value); - } - catch (err) { - destination.error(err); - return; - } - this._finalizeNext(key, value); - }; - DistinctSubscriber.prototype._finalizeNext = function (key, value) { - var values = this.values; - if (!values.has(key)) { - values.add(key); - this.destination.next(value); - } - }; - return DistinctSubscriber; -}(OuterSubscriber_1.OuterSubscriber)); -exports.DistinctSubscriber = DistinctSubscriber; -//# sourceMappingURL=distinct.js.map + //see if it's a color + token = this._hexcolor(); + if (token === null){ -/***/ }), -/* 298 */ -/***/ (function(module, exports, __webpack_require__) { + //if there's no unary, get the start of the next token for line/col info + if (unary === null){ + line = tokenStream.LT(1).startLine; + col = tokenStream.LT(1).startCol; + } -"use strict"; + //has to be a function + if (value === null){ + + /* + * This checks for alpha(opacity=0) style of IE + * functions. IE_FUNCTION only presents progid: style. + */ + if (tokenStream.LA(3) === Tokens.EQUALS && this.options.ieFilters){ + value = this._ie_function(); + } else { + value = this._function(); + } + } -var distinctUntilChanged_1 = __webpack_require__(60); -/* tslint:enable:max-line-length */ -/** - * Returns an Observable that emits all items emitted by the source Observable that are distinct by comparison from the previous item, - * using a property accessed by using the key provided to check if the two items are distinct. - * - * If a comparator function is provided, then it will be called for each item to test for whether or not that value should be emitted. - * - * If a comparator function is not provided, an equality check is used by default. - * - * @example An example comparing the name of persons - * - * interface Person { - * age: number, - * name: string - * } - * - * Observable.of( - * { age: 4, name: 'Foo'}, - * { age: 7, name: 'Bar'}, - * { age: 5, name: 'Foo'}, - * { age: 6, name: 'Foo'}) - * .distinctUntilKeyChanged('name') - * .subscribe(x => console.log(x)); - * - * // displays: - * // { age: 4, name: 'Foo' } - * // { age: 7, name: 'Bar' } - * // { age: 5, name: 'Foo' } - * - * @example An example comparing the first letters of the name - * - * interface Person { - * age: number, - * name: string - * } - * - * Observable.of( - * { age: 4, name: 'Foo1'}, - * { age: 7, name: 'Bar'}, - * { age: 5, name: 'Foo2'}, - * { age: 6, name: 'Foo3'}) - * .distinctUntilKeyChanged('name', (x: string, y: string) => x.substring(0, 3) === y.substring(0, 3)) - * .subscribe(x => console.log(x)); - * - * // displays: - * // { age: 4, name: 'Foo1' } - * // { age: 7, name: 'Bar' } - * // { age: 5, name: 'Foo2' } - * - * @see {@link distinct} - * @see {@link distinctUntilChanged} - * - * @param {string} key String key for object property lookup on each item. - * @param {function} [compare] Optional comparison function called to test if an item is distinct from the previous item in the source. - * @return {Observable} An Observable that emits items from the source Observable with distinct values based on the key specified. - * @method distinctUntilKeyChanged - * @owner Observable - */ -function distinctUntilKeyChanged(key, compare) { - return distinctUntilChanged_1.distinctUntilChanged.call(this, function (x, y) { - if (compare) { - return compare(x[key], y[key]); - } - return x[key] === y[key]; - }); -} -exports.distinctUntilKeyChanged = distinctUntilKeyChanged; -//# sourceMappingURL=distinctUntilKeyChanged.js.map + /*if (value === null){ + return null; + //throw new Error("Expected identifier at line " + tokenStream.token().startLine + ", character " + tokenStream.token().startCol + "."); + }*/ -/***/ }), -/* 299 */ -/***/ (function(module, exports, __webpack_require__) { + } else { + value = token.value; + if (unary === null){ + line = token.startLine; + col = token.startCol; + } + } -"use strict"; + } -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; -var Subscriber_1 = __webpack_require__(2); -/* tslint:enable:max-line-length */ -/** - * Perform a side effect for every emission on the source Observable, but return - * an Observable that is identical to the source. - * - * Intercepts each emission on the source and runs a - * function, but returns an output which is identical to the source as long as errors don't occur. - * - * - * - * Returns a mirrored Observable of the source Observable, but modified so that - * the provided Observer is called to perform a side effect for every value, - * error, and completion emitted by the source. Any errors that are thrown in - * the aforementioned Observer or handlers are safely sent down the error path - * of the output Observable. - * - * This operator is useful for debugging your Observables for the correct values - * or performing other side effects. - * - * Note: this is different to a `subscribe` on the Observable. If the Observable - * returned by `do` is not subscribed, the side effects specified by the - * Observer will never happen. `do` therefore simply spies on existing - * execution, it does not trigger an execution to happen like `subscribe` does. - * - * @example Map every click to the clientX position of that click, while also logging the click event - * var clicks = Rx.Observable.fromEvent(document, 'click'); - * var positions = clicks - * .do(ev => console.log(ev)) - * .map(ev => ev.clientX); - * positions.subscribe(x => console.log(x)); - * - * @see {@link map} - * @see {@link subscribe} - * - * @param {Observer|function} [nextOrObserver] A normal Observer object or a - * callback for `next`. - * @param {function} [error] Callback for errors in the source. - * @param {function} [complete] Callback for the completion of the source. - * @return {Observable} An Observable identical to the source, but runs the - * specified Observer or callback(s) for each item. - * @method do - * @name do - * @owner Observable - */ -function _do(nextOrObserver, error, complete) { - return this.lift(new DoOperator(nextOrObserver, error, complete)); -} -exports._do = _do; -var DoOperator = (function () { - function DoOperator(nextOrObserver, error, complete) { - this.nextOrObserver = nextOrObserver; - this.error = error; - this.complete = complete; - } - DoOperator.prototype.call = function (subscriber, source) { - return source.subscribe(new DoSubscriber(subscriber, this.nextOrObserver, this.error, this.complete)); - }; - return DoOperator; -}()); -/** - * We need this JSDoc comment for affecting ESDoc. - * @ignore - * @extends {Ignored} - */ -var DoSubscriber = (function (_super) { - __extends(DoSubscriber, _super); - function DoSubscriber(destination, nextOrObserver, error, complete) { - _super.call(this, destination); - var safeSubscriber = new Subscriber_1.Subscriber(nextOrObserver, error, complete); - safeSubscriber.syncErrorThrowable = true; - this.add(safeSubscriber); - this.safeSubscriber = safeSubscriber; - } - DoSubscriber.prototype._next = function (value) { - var safeSubscriber = this.safeSubscriber; - safeSubscriber.next(value); - if (safeSubscriber.syncErrorThrown) { - this.destination.error(safeSubscriber.syncErrorValue); - } - else { - this.destination.next(value); - } - }; - DoSubscriber.prototype._error = function (err) { - var safeSubscriber = this.safeSubscriber; - safeSubscriber.error(err); - if (safeSubscriber.syncErrorThrown) { - this.destination.error(safeSubscriber.syncErrorValue); - } - else { - this.destination.error(err); - } - }; - DoSubscriber.prototype._complete = function () { - var safeSubscriber = this.safeSubscriber; - safeSubscriber.complete(); - if (safeSubscriber.syncErrorThrown) { - this.destination.error(safeSubscriber.syncErrorValue); - } - else { - this.destination.complete(); - } - }; - return DoSubscriber; -}(Subscriber_1.Subscriber)); -//# sourceMappingURL=do.js.map + return value !== null ? + new PropertyValuePart(unary !== null ? unary + value : value, line, col) : + null; -/***/ }), -/* 300 */ -/***/ (function(module, exports, __webpack_require__) { + }, -"use strict"; + _function: function(){ + + /* + * function + * : FUNCTION S* expr ')' S* + * ; + */ + + var tokenStream = this._tokenStream, + functionText = null, + expr = null, + lt; + + if (tokenStream.match(Tokens.FUNCTION)){ + functionText = tokenStream.token().value; + this._readWhitespace(); + expr = this._expr(true); + functionText += expr; + + //START: Horrible hack in case it's an IE filter + if (this.options.ieFilters && tokenStream.peek() === Tokens.EQUALS){ + do { + + if (this._readWhitespace()){ + functionText += tokenStream.token().value; + } + + //might be second time in the loop + if (tokenStream.LA(0) === Tokens.COMMA){ + functionText += tokenStream.token().value; + } + + tokenStream.match(Tokens.IDENT); + functionText += tokenStream.token().value; + + tokenStream.match(Tokens.EQUALS); + functionText += tokenStream.token().value; + + //functionText += this._term(); + lt = tokenStream.peek(); + while(lt !== Tokens.COMMA && lt !== Tokens.S && lt !== Tokens.RPAREN){ + tokenStream.get(); + functionText += tokenStream.token().value; + lt = tokenStream.peek(); + } + } while(tokenStream.match([Tokens.COMMA, Tokens.S])); + } -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; -var Subscriber_1 = __webpack_require__(2); -var ArgumentOutOfRangeError_1 = __webpack_require__(22); -/** - * Emits the single value at the specified `index` in a sequence of emissions - * from the source Observable. - * - * Emits only the i-th value, then completes. - * - * - * - * `elementAt` returns an Observable that emits the item at the specified - * `index` in the source Observable, or a default value if that `index` is out - * of range and the `default` argument is provided. If the `default` argument is - * not given and the `index` is out of range, the output Observable will emit an - * `ArgumentOutOfRangeError` error. - * - * @example Emit only the third click event - * var clicks = Rx.Observable.fromEvent(document, 'click'); - * var result = clicks.elementAt(2); - * result.subscribe(x => console.log(x)); - * - * // Results in: - * // click 1 = nothing - * // click 2 = nothing - * // click 3 = MouseEvent object logged to console - * - * @see {@link first} - * @see {@link last} - * @see {@link skip} - * @see {@link single} - * @see {@link take} - * - * @throws {ArgumentOutOfRangeError} When using `elementAt(i)`, it delivers an - * ArgumentOutOrRangeError to the Observer's `error` callback if `i < 0` or the - * Observable has completed before emitting the i-th `next` notification. - * - * @param {number} index Is the number `i` for the i-th source emission that has - * happened since the subscription, starting from the number `0`. - * @param {T} [defaultValue] The default value returned for missing indices. - * @return {Observable} An Observable that emits a single item, if it is found. - * Otherwise, will emit the default value if given. If not, then emits an error. - * @method elementAt - * @owner Observable - */ -function elementAt(index, defaultValue) { - return this.lift(new ElementAtOperator(index, defaultValue)); -} -exports.elementAt = elementAt; -var ElementAtOperator = (function () { - function ElementAtOperator(index, defaultValue) { - this.index = index; - this.defaultValue = defaultValue; - if (index < 0) { - throw new ArgumentOutOfRangeError_1.ArgumentOutOfRangeError; - } - } - ElementAtOperator.prototype.call = function (subscriber, source) { - return source.subscribe(new ElementAtSubscriber(subscriber, this.index, this.defaultValue)); - }; - return ElementAtOperator; -}()); -/** - * We need this JSDoc comment for affecting ESDoc. - * @ignore - * @extends {Ignored} - */ -var ElementAtSubscriber = (function (_super) { - __extends(ElementAtSubscriber, _super); - function ElementAtSubscriber(destination, index, defaultValue) { - _super.call(this, destination); - this.index = index; - this.defaultValue = defaultValue; - } - ElementAtSubscriber.prototype._next = function (x) { - if (this.index-- === 0) { - this.destination.next(x); - this.destination.complete(); - } - }; - ElementAtSubscriber.prototype._complete = function () { - var destination = this.destination; - if (this.index >= 0) { - if (typeof this.defaultValue !== 'undefined') { - destination.next(this.defaultValue); - } - else { - destination.error(new ArgumentOutOfRangeError_1.ArgumentOutOfRangeError); - } - } - destination.complete(); - }; - return ElementAtSubscriber; -}(Subscriber_1.Subscriber)); -//# sourceMappingURL=elementAt.js.map + //END: Horrible Hack + + tokenStream.match(Tokens.RPAREN); + functionText += ")"; + this._readWhitespace(); + } + + return functionText; + }, + + _ie_function: function(){ + + /* (My own extension) + * ie_function + * : IE_FUNCTION S* IDENT '=' term [S* ','? IDENT '=' term]+ ')' S* + * ; + */ + + var tokenStream = this._tokenStream, + functionText = null, + lt; + + //IE function can begin like a regular function, too + if (tokenStream.match([Tokens.IE_FUNCTION, Tokens.FUNCTION])){ + functionText = tokenStream.token().value; + + do { + + if (this._readWhitespace()){ + functionText += tokenStream.token().value; + } + + //might be second time in the loop + if (tokenStream.LA(0) === Tokens.COMMA){ + functionText += tokenStream.token().value; + } + + tokenStream.match(Tokens.IDENT); + functionText += tokenStream.token().value; + + tokenStream.match(Tokens.EQUALS); + functionText += tokenStream.token().value; + + //functionText += this._term(); + lt = tokenStream.peek(); + while(lt !== Tokens.COMMA && lt !== Tokens.S && lt !== Tokens.RPAREN){ + tokenStream.get(); + functionText += tokenStream.token().value; + lt = tokenStream.peek(); + } + } while(tokenStream.match([Tokens.COMMA, Tokens.S])); + + tokenStream.match(Tokens.RPAREN); + functionText += ")"; + this._readWhitespace(); + } + + return functionText; + }, + + _hexcolor: function(){ + /* + * There is a constraint on the color that it must + * have either 3 or 6 hex-digits (i.e., [0-9a-fA-F]) + * after the "#"; e.g., "#000" is OK, but "#abcd" is not. + * + * hexcolor + * : HASH S* + * ; + */ + + var tokenStream = this._tokenStream, + token = null, + color; + + if(tokenStream.match(Tokens.HASH)){ + + //need to do some validation here + + token = tokenStream.token(); + color = token.value; + if (!/#[a-f0-9]{3,6}/i.test(color)){ + throw new SyntaxError("Expected a hex color but found '" + color + "' at line " + token.startLine + ", col " + token.startCol + ".", token.startLine, token.startCol); + } + this._readWhitespace(); + } + + return token; + }, + + //----------------------------------------------------------------- + // Animations methods + //----------------------------------------------------------------- + + _keyframes: function(){ + + /* + * keyframes: + * : KEYFRAMES_SYM S* keyframe_name S* '{' S* keyframe_rule* '}' { + * ; + */ + var tokenStream = this._tokenStream, + token, + tt, + name, + prefix = ""; + + tokenStream.mustMatch(Tokens.KEYFRAMES_SYM); + token = tokenStream.token(); + if (/^@\-([^\-]+)\-/.test(token.value)) { + prefix = RegExp.$1; + } + + this._readWhitespace(); + name = this._keyframe_name(); + + this._readWhitespace(); + tokenStream.mustMatch(Tokens.LBRACE); + + this.fire({ + type: "startkeyframes", + name: name, + prefix: prefix, + line: token.startLine, + col: token.startCol + }); + + this._readWhitespace(); + tt = tokenStream.peek(); + + //check for key + while(tt === Tokens.IDENT || tt === Tokens.PERCENTAGE) { + this._keyframe_rule(); + this._readWhitespace(); + tt = tokenStream.peek(); + } + + this.fire({ + type: "endkeyframes", + name: name, + prefix: prefix, + line: token.startLine, + col: token.startCol + }); + + this._readWhitespace(); + tokenStream.mustMatch(Tokens.RBRACE); + + }, + + _keyframe_name: function(){ + + /* + * keyframe_name: + * : IDENT + * | STRING + * ; + */ + var tokenStream = this._tokenStream; + + tokenStream.mustMatch([Tokens.IDENT, Tokens.STRING]); + return SyntaxUnit.fromToken(tokenStream.token()); + }, + + _keyframe_rule: function(){ + + /* + * keyframe_rule: + * : key_list S* + * '{' S* declaration [ ';' S* declaration ]* '}' S* + * ; + */ + var keyList = this._key_list(); + + this.fire({ + type: "startkeyframerule", + keys: keyList, + line: keyList[0].line, + col: keyList[0].col + }); + + this._readDeclarations(true); + + this.fire({ + type: "endkeyframerule", + keys: keyList, + line: keyList[0].line, + col: keyList[0].col + }); + + }, + + _key_list: function(){ + + /* + * key_list: + * : key [ S* ',' S* key]* + * ; + */ + var tokenStream = this._tokenStream, + keyList = []; + + //must be least one key + keyList.push(this._key()); + + this._readWhitespace(); + + while(tokenStream.match(Tokens.COMMA)){ + this._readWhitespace(); + keyList.push(this._key()); + this._readWhitespace(); + } -/***/ }), -/* 301 */ -/***/ (function(module, exports, __webpack_require__) { + return keyList; + }, -"use strict"; + _key: function(){ + /* + * There is a restriction that IDENT can be only "from" or "to". + * + * key + * : PERCENTAGE + * | IDENT + * ; + */ + + var tokenStream = this._tokenStream, + token; + + if (tokenStream.match(Tokens.PERCENTAGE)){ + return SyntaxUnit.fromToken(tokenStream.token()); + } else if (tokenStream.match(Tokens.IDENT)){ + token = tokenStream.token(); + + if (/from|to/i.test(token.value)){ + return SyntaxUnit.fromToken(token); + } -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; -var OuterSubscriber_1 = __webpack_require__(4); -var subscribeToResult_1 = __webpack_require__(3); -/** - * Converts a higher-order Observable into a first-order Observable by dropping - * inner Observables while the previous inner Observable has not yet completed. - * - * Flattens an Observable-of-Observables by dropping the - * next inner Observables while the current inner is still executing. - * - * - * - * `exhaust` subscribes to an Observable that emits Observables, also known as a - * higher-order Observable. Each time it observes one of these emitted inner - * Observables, the output Observable begins emitting the items emitted by that - * inner Observable. So far, it behaves like {@link mergeAll}. However, - * `exhaust` ignores every new inner Observable if the previous Observable has - * not yet completed. Once that one completes, it will accept and flatten the - * next inner Observable and repeat this process. - * - * @example Run a finite timer for each click, only if there is no currently active timer - * var clicks = Rx.Observable.fromEvent(document, 'click'); - * var higherOrder = clicks.map((ev) => Rx.Observable.interval(1000).take(5)); - * var result = higherOrder.exhaust(); - * result.subscribe(x => console.log(x)); - * - * @see {@link combineAll} - * @see {@link concatAll} - * @see {@link switch} - * @see {@link mergeAll} - * @see {@link exhaustMap} - * @see {@link zipAll} - * - * @return {Observable} An Observable that takes a source of Observables and propagates the first observable - * exclusively until it completes before subscribing to the next. - * @method exhaust - * @owner Observable - */ -function exhaust() { - return this.lift(new SwitchFirstOperator()); -} -exports.exhaust = exhaust; -var SwitchFirstOperator = (function () { - function SwitchFirstOperator() { - } - SwitchFirstOperator.prototype.call = function (subscriber, source) { - return source.subscribe(new SwitchFirstSubscriber(subscriber)); - }; - return SwitchFirstOperator; -}()); -/** - * We need this JSDoc comment for affecting ESDoc. - * @ignore - * @extends {Ignored} - */ -var SwitchFirstSubscriber = (function (_super) { - __extends(SwitchFirstSubscriber, _super); - function SwitchFirstSubscriber(destination) { - _super.call(this, destination); - this.hasCompleted = false; - this.hasSubscription = false; - } - SwitchFirstSubscriber.prototype._next = function (value) { - if (!this.hasSubscription) { - this.hasSubscription = true; - this.add(subscribeToResult_1.subscribeToResult(this, value)); - } - }; - SwitchFirstSubscriber.prototype._complete = function () { - this.hasCompleted = true; - if (!this.hasSubscription) { - this.destination.complete(); - } - }; - SwitchFirstSubscriber.prototype.notifyComplete = function (innerSub) { - this.remove(innerSub); - this.hasSubscription = false; - if (this.hasCompleted) { - this.destination.complete(); - } - }; - return SwitchFirstSubscriber; -}(OuterSubscriber_1.OuterSubscriber)); -//# sourceMappingURL=exhaust.js.map + tokenStream.unget(); + } -/***/ }), -/* 302 */ -/***/ (function(module, exports, __webpack_require__) { + //if it gets here, there wasn't a valid token, so time to explode + this._unexpectedToken(tokenStream.LT(1)); + }, -"use strict"; + //----------------------------------------------------------------- + // Helper methods + //----------------------------------------------------------------- -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; -var OuterSubscriber_1 = __webpack_require__(4); -var subscribeToResult_1 = __webpack_require__(3); -/* tslint:enable:max-line-length */ -/** - * Projects each source value to an Observable which is merged in the output - * Observable only if the previous projected Observable has completed. - * - * Maps each value to an Observable, then flattens all of - * these inner Observables using {@link exhaust}. - * - * - * - * Returns an Observable that emits items based on applying a function that you - * supply to each item emitted by the source Observable, where that function - * returns an (so-called "inner") Observable. When it projects a source value to - * an Observable, the output Observable begins emitting the items emitted by - * that projected Observable. However, `exhaustMap` ignores every new projected - * Observable if the previous projected Observable has not yet completed. Once - * that one completes, it will accept and flatten the next projected Observable - * and repeat this process. - * - * @example Run a finite timer for each click, only if there is no currently active timer - * var clicks = Rx.Observable.fromEvent(document, 'click'); - * var result = clicks.exhaustMap((ev) => Rx.Observable.interval(1000).take(5)); - * result.subscribe(x => console.log(x)); - * - * @see {@link concatMap} - * @see {@link exhaust} - * @see {@link mergeMap} - * @see {@link switchMap} - * - * @param {function(value: T, ?index: number): ObservableInput} project A function - * that, when applied to an item emitted by the source Observable, returns an - * Observable. - * @param {function(outerValue: T, innerValue: I, outerIndex: number, innerIndex: number): any} [resultSelector] - * A function to produce the value on the output Observable based on the values - * and the indices of the source (outer) emission and the inner Observable - * emission. The arguments passed to this function are: - * - `outerValue`: the value that came from the source - * - `innerValue`: the value that came from the projected Observable - * - `outerIndex`: the "index" of the value that came from the source - * - `innerIndex`: the "index" of the value from the projected Observable - * @return {Observable} An Observable containing projected Observables - * of each item of the source, ignoring projected Observables that start before - * their preceding Observable has completed. - * @method exhaustMap - * @owner Observable - */ -function exhaustMap(project, resultSelector) { - return this.lift(new SwitchFirstMapOperator(project, resultSelector)); -} -exports.exhaustMap = exhaustMap; -var SwitchFirstMapOperator = (function () { - function SwitchFirstMapOperator(project, resultSelector) { - this.project = project; - this.resultSelector = resultSelector; - } - SwitchFirstMapOperator.prototype.call = function (subscriber, source) { - return source.subscribe(new SwitchFirstMapSubscriber(subscriber, this.project, this.resultSelector)); - }; - return SwitchFirstMapOperator; -}()); -/** - * We need this JSDoc comment for affecting ESDoc. - * @ignore - * @extends {Ignored} - */ -var SwitchFirstMapSubscriber = (function (_super) { - __extends(SwitchFirstMapSubscriber, _super); - function SwitchFirstMapSubscriber(destination, project, resultSelector) { - _super.call(this, destination); - this.project = project; - this.resultSelector = resultSelector; - this.hasSubscription = false; - this.hasCompleted = false; - this.index = 0; - } - SwitchFirstMapSubscriber.prototype._next = function (value) { - if (!this.hasSubscription) { - this.tryNext(value); - } - }; - SwitchFirstMapSubscriber.prototype.tryNext = function (value) { - var index = this.index++; - var destination = this.destination; - try { - var result = this.project(value, index); - this.hasSubscription = true; - this.add(subscribeToResult_1.subscribeToResult(this, result, value, index)); - } - catch (err) { - destination.error(err); - } - }; - SwitchFirstMapSubscriber.prototype._complete = function () { - this.hasCompleted = true; - if (!this.hasSubscription) { - this.destination.complete(); - } - }; - SwitchFirstMapSubscriber.prototype.notifyNext = function (outerValue, innerValue, outerIndex, innerIndex, innerSub) { - var _a = this, resultSelector = _a.resultSelector, destination = _a.destination; - if (resultSelector) { - this.trySelectResult(outerValue, innerValue, outerIndex, innerIndex); - } - else { - destination.next(innerValue); - } - }; - SwitchFirstMapSubscriber.prototype.trySelectResult = function (outerValue, innerValue, outerIndex, innerIndex) { - var _a = this, resultSelector = _a.resultSelector, destination = _a.destination; - try { - var result = resultSelector(outerValue, innerValue, outerIndex, innerIndex); - destination.next(result); - } - catch (err) { - destination.error(err); - } - }; - SwitchFirstMapSubscriber.prototype.notifyError = function (err) { - this.destination.error(err); - }; - SwitchFirstMapSubscriber.prototype.notifyComplete = function (innerSub) { - this.remove(innerSub); - this.hasSubscription = false; - if (this.hasCompleted) { - this.destination.complete(); - } - }; - return SwitchFirstMapSubscriber; -}(OuterSubscriber_1.OuterSubscriber)); -//# sourceMappingURL=exhaustMap.js.map + /** + * Not part of CSS grammar, but useful for skipping over + * combination of white space and HTML-style comments. + * @return {void} + * @method _skipCruft + * @private + */ + _skipCruft: function(){ + while(this._tokenStream.match([Tokens.S, Tokens.CDO, Tokens.CDC])){ + //noop + } + }, -/***/ }), -/* 303 */ -/***/ (function(module, exports, __webpack_require__) { + /** + * Not part of CSS grammar, but this pattern occurs frequently + * in the official CSS grammar. Split out here to eliminate + * duplicate code. + * @param {Boolean} checkStart Indicates if the rule should check + * for the left brace at the beginning. + * @param {Boolean} readMargins Indicates if the rule should check + * for margin patterns. + * @return {void} + * @method _readDeclarations + * @private + */ + _readDeclarations: function(checkStart, readMargins){ + /* + * Reads the pattern + * S* '{' S* declaration [ ';' S* declaration ]* '}' S* + * or + * S* '{' S* [ declaration | margin ]? [ ';' S* [ declaration | margin ]? ]* '}' S* + * Note that this is how it is described in CSS3 Paged Media, but is actually incorrect. + * A semicolon is only necessary following a declaration if there's another declaration + * or margin afterwards. + */ + var tokenStream = this._tokenStream, + tt; + + + this._readWhitespace(); + + if (checkStart){ + tokenStream.mustMatch(Tokens.LBRACE); + } -"use strict"; + this._readWhitespace(); -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; -var tryCatch_1 = __webpack_require__(7); -var errorObject_1 = __webpack_require__(5); -var OuterSubscriber_1 = __webpack_require__(4); -var subscribeToResult_1 = __webpack_require__(3); -/* tslint:enable:max-line-length */ -/** - * Recursively projects each source value to an Observable which is merged in - * the output Observable. - * - * It's similar to {@link mergeMap}, but applies the - * projection function to every source value as well as every output value. - * It's recursive. - * - * - * - * Returns an Observable that emits items based on applying a function that you - * supply to each item emitted by the source Observable, where that function - * returns an Observable, and then merging those resulting Observables and - * emitting the results of this merger. *Expand* will re-emit on the output - * Observable every source value. Then, each output value is given to the - * `project` function which returns an inner Observable to be merged on the - * output Observable. Those output values resulting from the projection are also - * given to the `project` function to produce new output values. This is how - * *expand* behaves recursively. - * - * @example Start emitting the powers of two on every click, at most 10 of them - * var clicks = Rx.Observable.fromEvent(document, 'click'); - * var powersOfTwo = clicks - * .mapTo(1) - * .expand(x => Rx.Observable.of(2 * x).delay(1000)) - * .take(10); - * powersOfTwo.subscribe(x => console.log(x)); - * - * @see {@link mergeMap} - * @see {@link mergeScan} - * - * @param {function(value: T, index: number) => Observable} project A function - * that, when applied to an item emitted by the source or the output Observable, - * returns an Observable. - * @param {number} [concurrent=Number.POSITIVE_INFINITY] Maximum number of input - * Observables being subscribed to concurrently. - * @param {Scheduler} [scheduler=null] The IScheduler to use for subscribing to - * each projected inner Observable. - * @return {Observable} An Observable that emits the source values and also - * result of applying the projection function to each value emitted on the - * output Observable and and merging the results of the Observables obtained - * from this transformation. - * @method expand - * @owner Observable - */ -function expand(project, concurrent, scheduler) { - if (concurrent === void 0) { concurrent = Number.POSITIVE_INFINITY; } - if (scheduler === void 0) { scheduler = undefined; } - concurrent = (concurrent || 0) < 1 ? Number.POSITIVE_INFINITY : concurrent; - return this.lift(new ExpandOperator(project, concurrent, scheduler)); -} -exports.expand = expand; -var ExpandOperator = (function () { - function ExpandOperator(project, concurrent, scheduler) { - this.project = project; - this.concurrent = concurrent; - this.scheduler = scheduler; - } - ExpandOperator.prototype.call = function (subscriber, source) { - return source.subscribe(new ExpandSubscriber(subscriber, this.project, this.concurrent, this.scheduler)); - }; - return ExpandOperator; -}()); -exports.ExpandOperator = ExpandOperator; -/** - * We need this JSDoc comment for affecting ESDoc. - * @ignore - * @extends {Ignored} - */ -var ExpandSubscriber = (function (_super) { - __extends(ExpandSubscriber, _super); - function ExpandSubscriber(destination, project, concurrent, scheduler) { - _super.call(this, destination); - this.project = project; - this.concurrent = concurrent; - this.scheduler = scheduler; - this.index = 0; - this.active = 0; - this.hasCompleted = false; - if (concurrent < Number.POSITIVE_INFINITY) { - this.buffer = []; - } - } - ExpandSubscriber.dispatch = function (arg) { - var subscriber = arg.subscriber, result = arg.result, value = arg.value, index = arg.index; - subscriber.subscribeToProjection(result, value, index); - }; - ExpandSubscriber.prototype._next = function (value) { - var destination = this.destination; - if (destination.closed) { - this._complete(); - return; - } - var index = this.index++; - if (this.active < this.concurrent) { - destination.next(value); - var result = tryCatch_1.tryCatch(this.project)(value, index); - if (result === errorObject_1.errorObject) { - destination.error(errorObject_1.errorObject.e); - } - else if (!this.scheduler) { - this.subscribeToProjection(result, value, index); - } - else { - var state = { subscriber: this, result: result, value: value, index: index }; - this.add(this.scheduler.schedule(ExpandSubscriber.dispatch, 0, state)); - } - } - else { - this.buffer.push(value); - } - }; - ExpandSubscriber.prototype.subscribeToProjection = function (result, value, index) { - this.active++; - this.add(subscribeToResult_1.subscribeToResult(this, result, value, index)); - }; - ExpandSubscriber.prototype._complete = function () { - this.hasCompleted = true; - if (this.hasCompleted && this.active === 0) { - this.destination.complete(); - } - }; - ExpandSubscriber.prototype.notifyNext = function (outerValue, innerValue, outerIndex, innerIndex, innerSub) { - this._next(innerValue); - }; - ExpandSubscriber.prototype.notifyComplete = function (innerSub) { - var buffer = this.buffer; - this.remove(innerSub); - this.active--; - if (buffer && buffer.length > 0) { - this._next(buffer.shift()); - } - if (this.hasCompleted && this.active === 0) { - this.destination.complete(); - } - }; - return ExpandSubscriber; -}(OuterSubscriber_1.OuterSubscriber)); -exports.ExpandSubscriber = ExpandSubscriber; -//# sourceMappingURL=expand.js.map + try { -/***/ }), -/* 304 */ -/***/ (function(module, exports, __webpack_require__) { + while(true){ -"use strict"; + if (tokenStream.match(Tokens.SEMICOLON) || (readMargins && this._margin())){ + //noop + } else if (this._declaration()){ + if (!tokenStream.match(Tokens.SEMICOLON)){ + break; + } + } else { + break; + } -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; -var Subscriber_1 = __webpack_require__(2); -var Subscription_1 = __webpack_require__(9); -/** - * Returns an Observable that mirrors the source Observable, but will call a specified function when - * the source terminates on complete or error. - * @param {function} callback Function to be called when source terminates. - * @return {Observable} An Observable that mirrors the source, but will call the specified function on termination. - * @method finally - * @owner Observable - */ -function _finally(callback) { - return this.lift(new FinallyOperator(callback)); -} -exports._finally = _finally; -var FinallyOperator = (function () { - function FinallyOperator(callback) { - this.callback = callback; - } - FinallyOperator.prototype.call = function (subscriber, source) { - return source.subscribe(new FinallySubscriber(subscriber, this.callback)); - }; - return FinallyOperator; -}()); -/** - * We need this JSDoc comment for affecting ESDoc. - * @ignore - * @extends {Ignored} - */ -var FinallySubscriber = (function (_super) { - __extends(FinallySubscriber, _super); - function FinallySubscriber(destination, callback) { - _super.call(this, destination); - this.add(new Subscription_1.Subscription(callback)); - } - return FinallySubscriber; -}(Subscriber_1.Subscriber)); -//# sourceMappingURL=finally.js.map + //if ((!this._margin() && !this._declaration()) || !tokenStream.match(Tokens.SEMICOLON)){ + // break; + //} + this._readWhitespace(); + } -/***/ }), -/* 305 */ -/***/ (function(module, exports, __webpack_require__) { + tokenStream.mustMatch(Tokens.RBRACE); + this._readWhitespace(); + + } catch (ex) { + if (ex instanceof SyntaxError && !this.options.strict){ + + //fire error event + this.fire({ + type: "error", + error: ex, + message: ex.message, + line: ex.line, + col: ex.col + }); + + //see if there's another declaration + tt = tokenStream.advance([Tokens.SEMICOLON, Tokens.RBRACE]); + if (tt === Tokens.SEMICOLON){ + //if there's a semicolon, then there might be another declaration + this._readDeclarations(false, readMargins); + } else if (tt !== Tokens.RBRACE){ + //if there's a right brace, the rule is finished so don't do anything + //otherwise, rethrow the error because it wasn't handled properly + throw ex; + } -"use strict"; + } else { + //not a syntax error, rethrow it + throw ex; + } + } -var find_1 = __webpack_require__(61); -/** - * Emits only the index of the first value emitted by the source Observable that - * meets some condition. - * - * It's like {@link find}, but emits the index of the - * found value, not the value itself. - * - * - * - * `findIndex` searches for the first item in the source Observable that matches - * the specified condition embodied by the `predicate`, and returns the - * (zero-based) index of the first occurrence in the source. Unlike - * {@link first}, the `predicate` is required in `findIndex`, and does not emit - * an error if a valid value is not found. - * - * @example Emit the index of first click that happens on a DIV element - * var clicks = Rx.Observable.fromEvent(document, 'click'); - * var result = clicks.findIndex(ev => ev.target.tagName === 'DIV'); - * result.subscribe(x => console.log(x)); - * - * @see {@link filter} - * @see {@link find} - * @see {@link first} - * @see {@link take} - * - * @param {function(value: T, index: number, source: Observable): boolean} predicate - * A function called with each item to test for condition matching. - * @param {any} [thisArg] An optional argument to determine the value of `this` - * in the `predicate` function. - * @return {Observable} An Observable of the index of the first item that - * matches the condition. - * @method find - * @owner Observable - */ -function findIndex(predicate, thisArg) { - return this.lift(new find_1.FindValueOperator(predicate, this, true, thisArg)); -} -exports.findIndex = findIndex; -//# sourceMappingURL=findIndex.js.map + }, -/***/ }), -/* 306 */ -/***/ (function(module, exports, __webpack_require__) { + /** + * In some cases, you can end up with two white space tokens in a + * row. Instead of making a change in every function that looks for + * white space, this function is used to match as much white space + * as necessary. + * @method _readWhitespace + * @return {String} The white space if found, empty string if not. + * @private + */ + _readWhitespace: function(){ -"use strict"; + var tokenStream = this._tokenStream, + ws = ""; -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; -var Subscriber_1 = __webpack_require__(2); -var Subscription_1 = __webpack_require__(9); -var Observable_1 = __webpack_require__(0); -var Subject_1 = __webpack_require__(6); -var Map_1 = __webpack_require__(370); -var FastMap_1 = __webpack_require__(368); -/* tslint:enable:max-line-length */ -/** - * Groups the items emitted by an Observable according to a specified criterion, - * and emits these grouped items as `GroupedObservables`, one - * {@link GroupedObservable} per group. - * - * - * - * @example Group objects by id and return as array - * Observable.of({id: 1, name: 'aze1'}, - * {id: 2, name: 'sf2'}, - * {id: 2, name: 'dg2'}, - * {id: 1, name: 'erg1'}, - * {id: 1, name: 'df1'}, - * {id: 2, name: 'sfqfb2'}, - * {id: 3, name: 'qfs3'}, - * {id: 2, name: 'qsgqsfg2'} - * ) - * .groupBy(p => p.id) - * .flatMap( (group$) => group$.reduce((acc, cur) => [...acc, cur], [])) - * .subscribe(p => console.log(p)); - * - * // displays: - * // [ { id: 1, name: 'aze1' }, - * // { id: 1, name: 'erg1' }, - * // { id: 1, name: 'df1' } ] - * // - * // [ { id: 2, name: 'sf2' }, - * // { id: 2, name: 'dg2' }, - * // { id: 2, name: 'sfqfb2' }, - * // { id: 2, name: 'qsgqsfg2' } ] - * // - * // [ { id: 3, name: 'qfs3' } ] - * - * @example Pivot data on the id field - * Observable.of({id: 1, name: 'aze1'}, - * {id: 2, name: 'sf2'}, - * {id: 2, name: 'dg2'}, - * {id: 1, name: 'erg1'}, - * {id: 1, name: 'df1'}, - * {id: 2, name: 'sfqfb2'}, - * {id: 3, name: 'qfs1'}, - * {id: 2, name: 'qsgqsfg2'} - * ) - * .groupBy(p => p.id, p => p.name) - * .flatMap( (group$) => group$.reduce((acc, cur) => [...acc, cur], ["" + group$.key])) - * .map(arr => ({'id': parseInt(arr[0]), 'values': arr.slice(1)})) - * .subscribe(p => console.log(p)); - * - * // displays: - * // { id: 1, values: [ 'aze1', 'erg1', 'df1' ] } - * // { id: 2, values: [ 'sf2', 'dg2', 'sfqfb2', 'qsgqsfg2' ] } - * // { id: 3, values: [ 'qfs1' ] } - * - * @param {function(value: T): K} keySelector A function that extracts the key - * for each item. - * @param {function(value: T): R} [elementSelector] A function that extracts the - * return element for each item. - * @param {function(grouped: GroupedObservable): Observable} [durationSelector] - * A function that returns an Observable to determine how long each group should - * exist. - * @return {Observable>} An Observable that emits - * GroupedObservables, each of which corresponds to a unique key value and each - * of which emits those items from the source Observable that share that key - * value. - * @method groupBy - * @owner Observable - */ -function groupBy(keySelector, elementSelector, durationSelector, subjectSelector) { - return this.lift(new GroupByOperator(keySelector, elementSelector, durationSelector, subjectSelector)); -} -exports.groupBy = groupBy; -var GroupByOperator = (function () { - function GroupByOperator(keySelector, elementSelector, durationSelector, subjectSelector) { - this.keySelector = keySelector; - this.elementSelector = elementSelector; - this.durationSelector = durationSelector; - this.subjectSelector = subjectSelector; - } - GroupByOperator.prototype.call = function (subscriber, source) { - return source.subscribe(new GroupBySubscriber(subscriber, this.keySelector, this.elementSelector, this.durationSelector, this.subjectSelector)); - }; - return GroupByOperator; -}()); -/** - * We need this JSDoc comment for affecting ESDoc. - * @ignore - * @extends {Ignored} - */ -var GroupBySubscriber = (function (_super) { - __extends(GroupBySubscriber, _super); - function GroupBySubscriber(destination, keySelector, elementSelector, durationSelector, subjectSelector) { - _super.call(this, destination); - this.keySelector = keySelector; - this.elementSelector = elementSelector; - this.durationSelector = durationSelector; - this.subjectSelector = subjectSelector; - this.groups = null; - this.attemptedToUnsubscribe = false; - this.count = 0; - } - GroupBySubscriber.prototype._next = function (value) { - var key; - try { - key = this.keySelector(value); - } - catch (err) { - this.error(err); - return; - } - this._group(value, key); - }; - GroupBySubscriber.prototype._group = function (value, key) { - var groups = this.groups; - if (!groups) { - groups = this.groups = typeof key === 'string' ? new FastMap_1.FastMap() : new Map_1.Map(); - } - var group = groups.get(key); - var element; - if (this.elementSelector) { - try { - element = this.elementSelector(value); - } - catch (err) { - this.error(err); + while(tokenStream.match(Tokens.S)){ + ws += tokenStream.token().value; + } + + return ws; + }, + + + /** + * Throws an error when an unexpected token is found. + * @param {Object} token The token that was found. + * @method _unexpectedToken + * @return {void} + * @private + */ + _unexpectedToken: function(token){ + throw new SyntaxError("Unexpected token '" + token.value + "' at line " + token.startLine + ", col " + token.startCol + ".", token.startLine, token.startCol); + }, + + /** + * Helper method used for parsing subparts of a style sheet. + * @return {void} + * @method _verifyEnd + * @private + */ + _verifyEnd: function(){ + if (this._tokenStream.LA(1) !== Tokens.EOF){ + this._unexpectedToken(this._tokenStream.LT(1)); + } + }, + + //----------------------------------------------------------------- + // Validation methods + //----------------------------------------------------------------- + _validateProperty: function(property, value){ + Validation.validate(property, value); + }, + + //----------------------------------------------------------------- + // Parsing methods + //----------------------------------------------------------------- + + parse: function(input){ + this._tokenStream = new TokenStream(input, Tokens); + this._stylesheet(); + }, + + parseStyleSheet: function(input){ + //just passthrough + return this.parse(input); + }, + + parseMediaQuery: function(input){ + this._tokenStream = new TokenStream(input, Tokens); + var result = this._media_query(); + + //if there's anything more, then it's an invalid selector + this._verifyEnd(); + + //otherwise return result + return result; + }, + + /** + * Parses a property value (everything after the semicolon). + * @return {parserlib.css.PropertyValue} The property value. + * @throws parserlib.util.SyntaxError If an unexpected token is found. + * @method parserPropertyValue + */ + parsePropertyValue: function(input){ + + this._tokenStream = new TokenStream(input, Tokens); + this._readWhitespace(); + + var result = this._expr(); + + //okay to have a trailing white space + this._readWhitespace(); + + //if there's anything more, then it's an invalid selector + this._verifyEnd(); + + //otherwise return result + return result; + }, + + /** + * Parses a complete CSS rule, including selectors and + * properties. + * @param {String} input The text to parser. + * @return {Boolean} True if the parse completed successfully, false if not. + * @method parseRule + */ + parseRule: function(input){ + this._tokenStream = new TokenStream(input, Tokens); + + //skip any leading white space + this._readWhitespace(); + + var result = this._ruleset(); + + //skip any trailing white space + this._readWhitespace(); + + //if there's anything more, then it's an invalid selector + this._verifyEnd(); + + //otherwise return result + return result; + }, + + /** + * Parses a single CSS selector (no comma) + * @param {String} input The text to parse as a CSS selector. + * @return {Selector} An object representing the selector. + * @throws parserlib.util.SyntaxError If an unexpected token is found. + * @method parseSelector + */ + parseSelector: function(input){ + + this._tokenStream = new TokenStream(input, Tokens); + + //skip any leading white space + this._readWhitespace(); + + var result = this._selector(); + + //skip any trailing white space + this._readWhitespace(); + + //if there's anything more, then it's an invalid selector + this._verifyEnd(); + + //otherwise return result + return result; + }, + + /** + * Parses an HTML style attribute: a set of CSS declarations + * separated by semicolons. + * @param {String} input The text to parse as a style attribute + * @return {void} + * @method parseStyleAttribute + */ + parseStyleAttribute: function(input){ + input += "}"; // for error recovery in _readDeclarations() + this._tokenStream = new TokenStream(input, Tokens); + this._readDeclarations(); } + }; + + //copy over onto prototype + for (prop in additions){ + if (Object.prototype.hasOwnProperty.call(additions, prop)){ + proto[prop] = additions[prop]; } - else { - element = value; - } - if (!group) { - group = this.subjectSelector ? this.subjectSelector() : new Subject_1.Subject(); - groups.set(key, group); - var groupedObservable = new GroupedObservable(key, group, this); - this.destination.next(groupedObservable); - if (this.durationSelector) { - var duration = void 0; - try { - duration = this.durationSelector(new GroupedObservable(key, group)); - } - catch (err) { - this.error(err); - return; + } + + return proto; +}(); + + +/* +nth + : S* [ ['-'|'+']? INTEGER? {N} [ S* ['-'|'+'] S* INTEGER ]? | + ['-'|'+']? INTEGER | {O}{D}{D} | {E}{V}{E}{N} ] S* + ; +*/ +var Properties = { + __proto__: null, + + //A + "align-items" : "flex-start | flex-end | center | baseline | stretch", + "align-content" : "flex-start | flex-end | center | space-between | space-around | stretch", + "align-self" : "auto | flex-start | flex-end | center | baseline | stretch", + "-webkit-align-items" : "flex-start | flex-end | center | baseline | stretch", + "-webkit-align-content" : "flex-start | flex-end | center | space-between | space-around | stretch", + "-webkit-align-self" : "auto | flex-start | flex-end | center | baseline | stretch", + "alignment-adjust" : "auto | baseline | before-edge | text-before-edge | middle | central | after-edge | text-after-edge | ideographic | alphabetic | hanging | mathematical | | ", + "alignment-baseline" : "baseline | use-script | before-edge | text-before-edge | after-edge | text-after-edge | central | middle | ideographic | alphabetic | hanging | mathematical", + "animation" : 1, + "animation-delay" : { multi: "", comma: true }, + "animation-direction" : { multi: "normal | alternate", comma: true }, + "animation-duration" : { multi: "", comma: true }, + "animation-fill-mode" : { multi: "none | forwards | backwards | both", comma: true }, + "animation-iteration-count" : { multi: " | infinite", comma: true }, + "animation-name" : { multi: "none | ", comma: true }, + "animation-play-state" : { multi: "running | paused", comma: true }, + "animation-timing-function" : 1, + + //vendor prefixed + "-moz-animation-delay" : { multi: "", comma: true }, + "-moz-animation-direction" : { multi: "normal | alternate", comma: true }, + "-moz-animation-duration" : { multi: "", comma: true }, + "-moz-animation-iteration-count" : { multi: " | infinite", comma: true }, + "-moz-animation-name" : { multi: "none | ", comma: true }, + "-moz-animation-play-state" : { multi: "running | paused", comma: true }, + + "-ms-animation-delay" : { multi: "", comma: true }, + "-ms-animation-direction" : { multi: "normal | alternate", comma: true }, + "-ms-animation-duration" : { multi: "", comma: true }, + "-ms-animation-iteration-count" : { multi: " | infinite", comma: true }, + "-ms-animation-name" : { multi: "none | ", comma: true }, + "-ms-animation-play-state" : { multi: "running | paused", comma: true }, + + "-webkit-animation-delay" : { multi: "", comma: true }, + "-webkit-animation-direction" : { multi: "normal | alternate", comma: true }, + "-webkit-animation-duration" : { multi: "", comma: true }, + "-webkit-animation-fill-mode" : { multi: "none | forwards | backwards | both", comma: true }, + "-webkit-animation-iteration-count" : { multi: " | infinite", comma: true }, + "-webkit-animation-name" : { multi: "none | ", comma: true }, + "-webkit-animation-play-state" : { multi: "running | paused", comma: true }, + + "-o-animation-delay" : { multi: "", comma: true }, + "-o-animation-direction" : { multi: "normal | alternate", comma: true }, + "-o-animation-duration" : { multi: "", comma: true }, + "-o-animation-iteration-count" : { multi: " | infinite", comma: true }, + "-o-animation-name" : { multi: "none | ", comma: true }, + "-o-animation-play-state" : { multi: "running | paused", comma: true }, + + "appearance" : "icon | window | desktop | workspace | document | tooltip | dialog | button | push-button | hyperlink | radio | radio-button | checkbox | menu-item | tab | menu | menubar | pull-down-menu | pop-up-menu | list-menu | radio-group | checkbox-group | outline-tree | range | field | combo-box | signature | password | normal | none | inherit", + "azimuth" : function (expression) { + var simple = " | leftwards | rightwards | inherit", + direction = "left-side | far-left | left | center-left | center | center-right | right | far-right | right-side", + behind = false, + valid = false, + part; + + if (!ValidationTypes.isAny(expression, simple)) { + if (ValidationTypes.isAny(expression, "behind")) { + behind = true; + valid = true; + } + + if (ValidationTypes.isAny(expression, direction)) { + valid = true; + if (!behind) { + ValidationTypes.isAny(expression, "behind"); } - this.add(duration.subscribe(new GroupDurationSubscriber(key, group, this))); } } - if (!group.closed) { - group.next(element); + + if (expression.hasNext()) { + part = expression.next(); + if (valid) { + throw new ValidationError("Expected end of value but found '" + part + "'.", part.line, part.col); + } else { + throw new ValidationError("Expected (<'azimuth'>) but found '" + part + "'.", part.line, part.col); + } } - }; - GroupBySubscriber.prototype._error = function (err) { - var groups = this.groups; - if (groups) { - groups.forEach(function (group, key) { - group.error(err); - }); - groups.clear(); + }, + + //B + "backface-visibility" : "visible | hidden", + "background" : 1, + "background-attachment" : { multi: "", comma: true }, + "background-clip" : { multi: "", comma: true }, + "background-color" : " | inherit", + "background-image" : { multi: "", comma: true }, + "background-origin" : { multi: "", comma: true }, + "background-position" : { multi: "", comma: true }, + "background-repeat" : { multi: "" }, + "background-size" : { multi: "", comma: true }, + "baseline-shift" : "baseline | sub | super | | ", + "behavior" : 1, + "binding" : 1, + "bleed" : "", + "bookmark-label" : " | | ", + "bookmark-level" : "none | ", + "bookmark-state" : "open | closed", + "bookmark-target" : "none | | ", + "border" : " || || ", + "border-bottom" : " || || ", + "border-bottom-color" : " | inherit", + "border-bottom-left-radius" : "", + "border-bottom-right-radius" : "", + "border-bottom-style" : "", + "border-bottom-width" : "", + "border-collapse" : "collapse | separate | inherit", + "border-color" : { multi: " | inherit", max: 4 }, + "border-image" : 1, + "border-image-outset" : { multi: " | ", max: 4 }, + "border-image-repeat" : { multi: "stretch | repeat | round", max: 2 }, + "border-image-slice" : function(expression) { + + var valid = false, + numeric = " | ", + fill = false, + count = 0, + max = 4, + part; + + if (ValidationTypes.isAny(expression, "fill")) { + fill = true; + valid = true; + } + + while (expression.hasNext() && count < max) { + valid = ValidationTypes.isAny(expression, numeric); + if (!valid) { + break; + } + count++; } - this.destination.error(err); - }; - GroupBySubscriber.prototype._complete = function () { - var groups = this.groups; - if (groups) { - groups.forEach(function (group, key) { - group.complete(); - }); - groups.clear(); + + + if (!fill) { + ValidationTypes.isAny(expression, "fill"); + } else { + valid = true; } - this.destination.complete(); - }; - GroupBySubscriber.prototype.removeGroup = function (key) { - this.groups.delete(key); - }; - GroupBySubscriber.prototype.unsubscribe = function () { - if (!this.closed) { - this.attemptedToUnsubscribe = true; - if (this.count === 0) { - _super.prototype.unsubscribe.call(this); + + if (expression.hasNext()) { + part = expression.next(); + if (valid) { + throw new ValidationError("Expected end of value but found '" + part + "'.", part.line, part.col); + } else { + throw new ValidationError("Expected ([ | ]{1,4} && fill?) but found '" + part + "'.", part.line, part.col); } } - }; - return GroupBySubscriber; -}(Subscriber_1.Subscriber)); -/** - * We need this JSDoc comment for affecting ESDoc. - * @ignore - * @extends {Ignored} - */ -var GroupDurationSubscriber = (function (_super) { - __extends(GroupDurationSubscriber, _super); - function GroupDurationSubscriber(key, group, parent) { - _super.call(this, group); - this.key = key; - this.group = group; - this.parent = parent; - } - GroupDurationSubscriber.prototype._next = function (value) { - this.complete(); - }; - GroupDurationSubscriber.prototype._unsubscribe = function () { - var _a = this, parent = _a.parent, key = _a.key; - this.key = this.parent = null; - if (parent) { - parent.removeGroup(key); + }, + "border-image-source" : " | none", + "border-image-width" : { multi: " | | | auto", max: 4 }, + "border-left" : " || || ", + "border-left-color" : " | inherit", + "border-left-style" : "", + "border-left-width" : "", + "border-radius" : function(expression) { + + var valid = false, + simple = " | | inherit", + slash = false, + count = 0, + max = 8, + part; + + while (expression.hasNext() && count < max) { + valid = ValidationTypes.isAny(expression, simple); + if (!valid) { + + if (String(expression.peek()) === "/" && count > 0 && !slash) { + slash = true; + max = count + 5; + expression.next(); + } else { + break; + } + } + count++; } - }; - return GroupDurationSubscriber; -}(Subscriber_1.Subscriber)); -/** - * An Observable representing values belonging to the same group represented by - * a common key. The values emitted by a GroupedObservable come from the source - * Observable. The common key is available as the field `key` on a - * GroupedObservable instance. - * - * @class GroupedObservable - */ -var GroupedObservable = (function (_super) { - __extends(GroupedObservable, _super); - function GroupedObservable(key, groupSubject, refCountSubscription) { - _super.call(this); - this.key = key; - this.groupSubject = groupSubject; - this.refCountSubscription = refCountSubscription; - } - GroupedObservable.prototype._subscribe = function (subscriber) { - var subscription = new Subscription_1.Subscription(); - var _a = this, refCountSubscription = _a.refCountSubscription, groupSubject = _a.groupSubject; - if (refCountSubscription && !refCountSubscription.closed) { - subscription.add(new InnerRefCountSubscription(refCountSubscription)); + + if (expression.hasNext()) { + part = expression.next(); + if (valid) { + throw new ValidationError("Expected end of value but found '" + part + "'.", part.line, part.col); + } else { + throw new ValidationError("Expected (<'border-radius'>) but found '" + part + "'.", part.line, part.col); + } } - subscription.add(groupSubject.subscribe(subscriber)); - return subscription; - }; - return GroupedObservable; -}(Observable_1.Observable)); -exports.GroupedObservable = GroupedObservable; -/** - * We need this JSDoc comment for affecting ESDoc. - * @ignore - * @extends {Ignored} - */ -var InnerRefCountSubscription = (function (_super) { - __extends(InnerRefCountSubscription, _super); - function InnerRefCountSubscription(parent) { - _super.call(this); - this.parent = parent; - parent.count++; - } - InnerRefCountSubscription.prototype.unsubscribe = function () { - var parent = this.parent; - if (!parent.closed && !this.closed) { - _super.prototype.unsubscribe.call(this); - parent.count -= 1; - if (parent.count === 0 && parent.attemptedToUnsubscribe) { - parent.unsubscribe(); + }, + "border-right" : "
,
This is a simple example of an Angular component.
Current count: {{ currentCount }}
This component demonstrates fetching data from the server.
Loading...
Welcome to your new single-page application, built with:
To help you get started, we've also set up:
webpack
>>2]>>>(24-(n%4)*8))&255;q.push((s>>>4).toString(16));q.push((s&15).toString(16))}return q.join("")},parse:function(p){var n=p.length;var q=[];for(var o=0;o>>3]|=parseInt(p.substr(o,2),16)<<(24-(o%8)*4)}return new l.init(q,n/2)}};var d=m.Latin1={stringify:function(q){var r=q.words;var p=q.sigBytes;var n=[];for(var o=0;o>>2]>>>(24-(o%4)*8))&255;n.push(String.fromCharCode(s))}return n.join("")},parse:function(p){var n=p.length;var q=[];for(var o=0;o>>2]|=(p.charCodeAt(o)&255)<<(24-(o%4)*8)}return new l.init(q,n)}};var c=m.Utf8={stringify:function(n){try{return decodeURIComponent(escape(d.stringify(n)))}catch(o){throw new Error("Malformed UTF-8 data")}},parse:function(n){return d.parse(unescape(encodeURIComponent(n)))}};var i=b.BufferedBlockAlgorithm=j.extend({reset:function(){this._data=new l.init();this._nDataBytes=0},_append:function(n){if(typeof n=="string"){n=c.parse(n)}this._data.concat(n);this._nDataBytes+=n.sigBytes},_process:function(w){var q=this._data;var x=q.words;var n=q.sigBytes;var t=this.blockSize;var v=t*4;var u=n/v;if(w){u=e.ceil(u)}else{u=e.max((u|0)-this._minBufferSize,0)}var s=u*t;var r=e.min(s*4,n);if(s){for(var p=0;p>>2]&255}};f.BlockCipher=n.extend({cfg:n.cfg.extend({mode:m,padding:h}),reset:function(){n.reset.call(this);var a=this.cfg,b=a.iv,a=a.mode;if(this._xformMode==this._ENC_XFORM_MODE)var c=a.createEncryptor;else c=a.createDecryptor,this._minBufferSize=1; -this._mode=c.call(a,this,b&&b.words)},_doProcessBlock:function(a,b){this._mode.processBlock(a,b)},_doFinalize:function(){var a=this.cfg.padding;if(this._xformMode==this._ENC_XFORM_MODE){a.pad(this._data,this.blockSize);var b=this._process(!0)}else b=this._process(!0),a.unpad(b);return b},blockSize:4});var p=f.CipherParams=k.extend({init:function(a){this.mixIn(a)},toString:function(a){return(a||this.formatter).stringify(this)}}),m=(g.format={}).OpenSSL={stringify:function(a){var b=a.ciphertext;a=a.salt; -return(a?l.create([1398893684,1701076831]).concat(a).concat(b):b).toString(r)},parse:function(a){a=r.parse(a);var b=a.words;if(1398893684==b[0]&&1701076831==b[1]){var c=l.create(b.slice(2,4));b.splice(0,4);a.sigBytes-=16}return p.create({ciphertext:a,salt:c})}},j=f.SerializableCipher=k.extend({cfg:k.extend({format:m}),encrypt:function(a,b,c,d){d=this.cfg.extend(d);var e=a.createEncryptor(c,d);b=e.finalize(b);e=e.cfg;return p.create({ciphertext:b,key:c,iv:e.iv,algorithm:a,mode:e.mode,padding:e.padding, -blockSize:a.blockSize,formatter:d.format})},decrypt:function(a,b,c,d){d=this.cfg.extend(d);b=this._parse(b,d.format);return a.createDecryptor(c,d).finalize(b.ciphertext)},_parse:function(a,b){return"string"==typeof a?b.parse(a,this):a}}),g=(g.kdf={}).OpenSSL={execute:function(a,b,c,d){d||(d=l.random(8));a=v.create({keySize:b+c}).compute(a,d);c=l.create(a.words.slice(b),4*c);a.sigBytes=4*b;return p.create({key:a,iv:c,salt:d})}},s=f.PasswordBasedCipher=j.extend({cfg:j.cfg.extend({kdf:g}),encrypt:function(a, -b,c,d){d=this.cfg.extend(d);c=d.kdf.execute(c,a.keySize,a.ivSize);d.iv=c.iv;a=j.encrypt.call(this,a,b,c.key,d);a.mixIn(c);return a},decrypt:function(a,b,c,d){d=this.cfg.extend(d);b=this._parse(b,d.format);c=d.kdf.execute(c,a.keySize,a.ivSize,b.salt);d.iv=c.iv;return j.decrypt.call(this,a,b,c.key,d)}})}(); - -/* -CryptoJS v3.1.2 aes.js -code.google.com/p/crypto-js -(c) 2009-2013 by Jeff Mott. All rights reserved. -code.google.com/p/crypto-js/wiki/License -*/ -(function(){for(var q=CryptoJS,x=q.lib.BlockCipher,r=q.algo,j=[],y=[],z=[],A=[],B=[],C=[],s=[],u=[],v=[],w=[],g=[],k=0;256>k;k++)g[k]=128>k?k<<1:k<<1^283;for(var n=0,l=0,k=0;256>k;k++){var f=l^l<<1^l<<2^l<<3^l<<4,f=f>>>8^f&255^99;j[n]=f;y[f]=n;var t=g[n],D=g[t],E=g[D],b=257*g[f]^16843008*f;z[n]=b<<24|b>>>8;A[n]=b<<16|b>>>16;B[n]=b<<8|b>>>24;C[n]=b;b=16843009*E^65537*D^257*t^16843008*n;s[f]=b<<24|b>>>8;u[f]=b<<16|b>>>16;v[f]=b<<8|b>>>24;w[f]=b;n?(n=t^g[g[g[E^t]]],l^=g[g[l]]):n=l=1}var F=[0,1,2,4,8, -16,32,64,128,27,54],r=r.AES=x.extend({_doReset:function(){for(var c=this._key,e=c.words,a=c.sigBytes/4,c=4*((this._nRounds=a+6)+1),b=this._keySchedule=[],h=0;h>>24]<<24|j[d>>>16&255]<<16|j[d>>>8&255]<<8|j[d&255]):(d=d<<8|d>>>24,d=j[d>>>24]<<24|j[d>>>16&255]<<16|j[d>>>8&255]<<8|j[d&255],d^=F[h/a|0]<<24);b[h]=b[h-a]^d}e=this._invKeySchedule=[];for(a=0;aa||4>=h?d:s[j[d>>>24]]^u[j[d>>>16&255]]^v[j[d>>> -8&255]]^w[j[d&255]]},encryptBlock:function(c,e){this._doCryptBlock(c,e,this._keySchedule,z,A,B,C,j)},decryptBlock:function(c,e){var a=c[e+1];c[e+1]=c[e+3];c[e+3]=a;this._doCryptBlock(c,e,this._invKeySchedule,s,u,v,w,y);a=c[e+1];c[e+1]=c[e+3];c[e+3]=a},_doCryptBlock:function(c,e,a,b,h,d,j,m){for(var n=this._nRounds,f=c[e]^a[0],g=c[e+1]^a[1],k=c[e+2]^a[2],p=c[e+3]^a[3],l=4,t=1;t>>24]^h[g>>>16&255]^d[k>>>8&255]^j[p&255]^a[l++],r=b[g>>>24]^h[k>>>16&255]^d[p>>>8&255]^j[f&255]^a[l++],s= -b[k>>>24]^h[p>>>16&255]^d[f>>>8&255]^j[g&255]^a[l++],p=b[p>>>24]^h[f>>>16&255]^d[g>>>8&255]^j[k&255]^a[l++],f=q,g=r,k=s;q=(m[f>>>24]<<24|m[g>>>16&255]<<16|m[k>>>8&255]<<8|m[p&255])^a[l++];r=(m[g>>>24]<<24|m[k>>>16&255]<<16|m[p>>>8&255]<<8|m[f&255])^a[l++];s=(m[k>>>24]<<24|m[p>>>16&255]<<16|m[f>>>8&255]<<8|m[g&255])^a[l++];p=(m[p>>>24]<<24|m[f>>>16&255]<<16|m[g>>>8&255]<<8|m[k&255])^a[l++];c[e]=q;c[e+1]=r;c[e+2]=s;c[e+3]=p},keySize:8});q.AES=x._createHelper(r)})(); - -/* -CryptoJS v3.1.2 tripledes-min.js -code.google.com/p/crypto-js -(c) 2009-2013 by Jeff Mott. All rights reserved. -code.google.com/p/crypto-js/wiki/License -*/ -(function(){function j(b,c){var a=(this._lBlock>>>b^this._rBlock)&c;this._rBlock^=a;this._lBlock^=a<>>b^this._lBlock)&c;this._lBlock^=a;this._rBlock^=a<a;a++){var f=q[a]-1;c[a]=b[f>>>5]>>>31-f%32&1}b=this._subKeys=[];for(f=0;16>f;f++){for(var d=b[f]=[],e=r[f],a=0;24>a;a++)d[a/6|0]|=c[(p[a]-1+e)%28]<<31-a%6,d[4+(a/6|0)]|=c[28+(p[a+24]-1+e)%28]<<31-a%6;d[0]=d[0]<<1|d[0]>>>31;for(a=1;7>a;a++)d[a]>>>= -4*(a-1)+3;d[7]=d[7]<<5|d[7]>>>27}c=this._invSubKeys=[];for(a=0;16>a;a++)c[a]=b[15-a]},encryptBlock:function(b,c){this._doCryptBlock(b,c,this._subKeys)},decryptBlock:function(b,c){this._doCryptBlock(b,c,this._invSubKeys)},_doCryptBlock:function(b,c,a){this._lBlock=b[c];this._rBlock=b[c+1];j.call(this,4,252645135);j.call(this,16,65535);l.call(this,2,858993459);l.call(this,8,16711935);j.call(this,1,1431655765);for(var f=0;16>f;f++){for(var d=a[f],e=this._lBlock,h=this._rBlock,g=0,k=0;8>k;k++)g|=s[k][((h^ -d[k])&t[k])>>>0];this._lBlock=h;this._rBlock=e^g}a=this._lBlock;this._lBlock=this._rBlock;this._rBlock=a;j.call(this,1,1431655765);l.call(this,8,16711935);l.call(this,2,858993459);j.call(this,16,65535);j.call(this,4,252645135);b[c]=this._lBlock;b[c+1]=this._rBlock},keySize:2,ivSize:2,blockSize:2});h.DES=e._createHelper(m);g=g.TripleDES=e.extend({_doReset:function(){var b=this._key.words;this._des1=m.createEncryptor(n.create(b.slice(0,2)));this._des2=m.createEncryptor(n.create(b.slice(2,4)));this._des3= -m.createEncryptor(n.create(b.slice(4,6)))},encryptBlock:function(b,c){this._des1.encryptBlock(b,c);this._des2.decryptBlock(b,c);this._des3.encryptBlock(b,c)},decryptBlock:function(b,c){this._des3.decryptBlock(b,c);this._des2.encryptBlock(b,c);this._des1.decryptBlock(b,c)},keySize:6,ivSize:2,blockSize:2});h.TripleDES=e._createHelper(g)})(); - -/* -CryptoJS v3.1.2 enc-base64.js -code.google.com/p/crypto-js -(c) 2009-2013 by Jeff Mott. All rights reserved. -code.google.com/p/crypto-js/wiki/License -*/ -(function(){var h=CryptoJS,j=h.lib.WordArray;h.enc.Base64={stringify:function(b){var e=b.words,f=b.sigBytes,c=this._map;b.clamp();b=[];for(var a=0;a>>2]>>>24-8*(a%4)&255)<<16|(e[a+1>>>2]>>>24-8*((a+1)%4)&255)<<8|e[a+2>>>2]>>>24-8*((a+2)%4)&255,g=0;4>g&&a+0.75*g>>6*(3-g)&63));if(e=c.charAt(64))for(;b.length%4;)b.push(e);return b.join("")},parse:function(b){var e=b.length,f=this._map,c=f.charAt(64);c&&(c=b.indexOf(c),-1!=c&&(e=c));for(var c=[],a=0,d=0;d< -e;d++)if(d%4){var g=f.indexOf(b.charAt(d-1))<<2*(d%4),h=f.indexOf(b.charAt(d))>>>6-2*(d%4);c[a>>>2]|=(g|h)<<24-8*(a%4);a++}return j.create(c,a)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="}})(); - -/* -CryptoJS v3.1.2 md5.js -code.google.com/p/crypto-js -(c) 2009-2013 by Jeff Mott. All rights reserved. -code.google.com/p/crypto-js/wiki/License -*/ -(function(E){function h(a,f,g,j,p,h,k){a=a+(f&g|~f&j)+p+k;return(a<>>32-h)+f}function k(a,f,g,j,p,h,k){a=a+(f&j|g&~j)+p+k;return(a<>>32-h)+f}function l(a,f,g,j,h,k,l){a=a+(f^g^j)+h+l;return(a<>>32-k)+f}function n(a,f,g,j,h,k,l){a=a+(g^(f|~j))+h+l;return(a<>>32-k)+f}for(var r=CryptoJS,q=r.lib,F=q.WordArray,s=q.Hasher,q=r.algo,a=[],t=0;64>t;t++)a[t]=4294967296*E.abs(E.sin(t+1))|0;q=q.MD5=s.extend({_doReset:function(){this._hash=new F.init([1732584193,4023233417,2562383102,271733878])}, -_doProcessBlock:function(m,f){for(var g=0;16>g;g++){var j=f+g,p=m[j];m[j]=(p<<8|p>>>24)&16711935|(p<<24|p>>>8)&4278255360}var g=this._hash.words,j=m[f+0],p=m[f+1],q=m[f+2],r=m[f+3],s=m[f+4],t=m[f+5],u=m[f+6],v=m[f+7],w=m[f+8],x=m[f+9],y=m[f+10],z=m[f+11],A=m[f+12],B=m[f+13],C=m[f+14],D=m[f+15],b=g[0],c=g[1],d=g[2],e=g[3],b=h(b,c,d,e,j,7,a[0]),e=h(e,b,c,d,p,12,a[1]),d=h(d,e,b,c,q,17,a[2]),c=h(c,d,e,b,r,22,a[3]),b=h(b,c,d,e,s,7,a[4]),e=h(e,b,c,d,t,12,a[5]),d=h(d,e,b,c,u,17,a[6]),c=h(c,d,e,b,v,22,a[7]), -b=h(b,c,d,e,w,7,a[8]),e=h(e,b,c,d,x,12,a[9]),d=h(d,e,b,c,y,17,a[10]),c=h(c,d,e,b,z,22,a[11]),b=h(b,c,d,e,A,7,a[12]),e=h(e,b,c,d,B,12,a[13]),d=h(d,e,b,c,C,17,a[14]),c=h(c,d,e,b,D,22,a[15]),b=k(b,c,d,e,p,5,a[16]),e=k(e,b,c,d,u,9,a[17]),d=k(d,e,b,c,z,14,a[18]),c=k(c,d,e,b,j,20,a[19]),b=k(b,c,d,e,t,5,a[20]),e=k(e,b,c,d,y,9,a[21]),d=k(d,e,b,c,D,14,a[22]),c=k(c,d,e,b,s,20,a[23]),b=k(b,c,d,e,x,5,a[24]),e=k(e,b,c,d,C,9,a[25]),d=k(d,e,b,c,r,14,a[26]),c=k(c,d,e,b,w,20,a[27]),b=k(b,c,d,e,B,5,a[28]),e=k(e,b, -c,d,q,9,a[29]),d=k(d,e,b,c,v,14,a[30]),c=k(c,d,e,b,A,20,a[31]),b=l(b,c,d,e,t,4,a[32]),e=l(e,b,c,d,w,11,a[33]),d=l(d,e,b,c,z,16,a[34]),c=l(c,d,e,b,C,23,a[35]),b=l(b,c,d,e,p,4,a[36]),e=l(e,b,c,d,s,11,a[37]),d=l(d,e,b,c,v,16,a[38]),c=l(c,d,e,b,y,23,a[39]),b=l(b,c,d,e,B,4,a[40]),e=l(e,b,c,d,j,11,a[41]),d=l(d,e,b,c,r,16,a[42]),c=l(c,d,e,b,u,23,a[43]),b=l(b,c,d,e,x,4,a[44]),e=l(e,b,c,d,A,11,a[45]),d=l(d,e,b,c,D,16,a[46]),c=l(c,d,e,b,q,23,a[47]),b=n(b,c,d,e,j,6,a[48]),e=n(e,b,c,d,v,10,a[49]),d=n(d,e,b,c, -C,15,a[50]),c=n(c,d,e,b,t,21,a[51]),b=n(b,c,d,e,A,6,a[52]),e=n(e,b,c,d,r,10,a[53]),d=n(d,e,b,c,y,15,a[54]),c=n(c,d,e,b,p,21,a[55]),b=n(b,c,d,e,w,6,a[56]),e=n(e,b,c,d,D,10,a[57]),d=n(d,e,b,c,u,15,a[58]),c=n(c,d,e,b,B,21,a[59]),b=n(b,c,d,e,s,6,a[60]),e=n(e,b,c,d,z,10,a[61]),d=n(d,e,b,c,q,15,a[62]),c=n(c,d,e,b,x,21,a[63]);g[0]=g[0]+b|0;g[1]=g[1]+c|0;g[2]=g[2]+d|0;g[3]=g[3]+e|0},_doFinalize:function(){var a=this._data,f=a.words,g=8*this._nDataBytes,j=8*a.sigBytes;f[j>>>5]|=128<<24-j%32;var h=E.floor(g/ -4294967296);f[(j+64>>>9<<4)+15]=(h<<8|h>>>24)&16711935|(h<<24|h>>>8)&4278255360;f[(j+64>>>9<<4)+14]=(g<<8|g>>>24)&16711935|(g<<24|g>>>8)&4278255360;a.sigBytes=4*(f.length+1);this._process();a=this._hash;f=a.words;for(g=0;4>g;g++)j=f[g],f[g]=(j<<8|j>>>24)&16711935|(j<<24|j>>>8)&4278255360;return a},clone:function(){var a=s.clone.call(this);a._hash=this._hash.clone();return a}});r.MD5=s._createHelper(q);r.HmacMD5=s._createHmacHelper(q)})(Math); - -/* -CryptoJS v3.1.2 sha1-min.js -code.google.com/p/crypto-js -(c) 2009-2013 by Jeff Mott. All rights reserved. -code.google.com/p/crypto-js/wiki/License -*/ -(function(){var k=CryptoJS,b=k.lib,m=b.WordArray,l=b.Hasher,d=[],b=k.algo.SHA1=l.extend({_doReset:function(){this._hash=new m.init([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(n,p){for(var a=this._hash.words,e=a[0],f=a[1],h=a[2],j=a[3],b=a[4],c=0;80>c;c++){if(16>c)d[c]=n[p+c]|0;else{var g=d[c-3]^d[c-8]^d[c-14]^d[c-16];d[c]=g<<1|g>>>31}g=(e<<5|e>>>27)+b+d[c];g=20>c?g+((f&h|~f&j)+1518500249):40>c?g+((f^h^j)+1859775393):60>c?g+((f&h|f&j|h&j)-1894007588):g+((f^h^ -j)-899497514);b=j;j=h;h=f<<30|f>>>2;f=e;e=g}a[0]=a[0]+e|0;a[1]=a[1]+f|0;a[2]=a[2]+h|0;a[3]=a[3]+j|0;a[4]=a[4]+b|0},_doFinalize:function(){var b=this._data,d=b.words,a=8*this._nDataBytes,e=8*b.sigBytes;d[e>>>5]|=128<<24-e%32;d[(e+64>>>9<<4)+14]=Math.floor(a/4294967296);d[(e+64>>>9<<4)+15]=a;b.sigBytes=4*d.length;this._process();return this._hash},clone:function(){var b=l.clone.call(this);b._hash=this._hash.clone();return b}});k.SHA1=l._createHelper(b);k.HmacSHA1=l._createHmacHelper(b)})(); - -/* -CryptoJS v3.1.2 sha256-min.js -code.google.com/p/crypto-js -(c) 2009-2013 by Jeff Mott. All rights reserved. -code.google.com/p/crypto-js/wiki/License -*/ -(function(k){for(var g=CryptoJS,h=g.lib,v=h.WordArray,j=h.Hasher,h=g.algo,s=[],t=[],u=function(q){return 4294967296*(q-(q|0))|0},l=2,b=0;64>b;){var d;a:{d=l;for(var w=k.sqrt(d),r=2;r<=w;r++)if(!(d%r)){d=!1;break a}d=!0}d&&(8>b&&(s[b]=u(k.pow(l,0.5))),t[b]=u(k.pow(l,1/3)),b++);l++}var n=[],h=h.SHA256=j.extend({_doReset:function(){this._hash=new v.init(s.slice(0))},_doProcessBlock:function(q,h){for(var a=this._hash.words,c=a[0],d=a[1],b=a[2],k=a[3],f=a[4],g=a[5],j=a[6],l=a[7],e=0;64>e;e++){if(16>e)n[e]= -q[h+e]|0;else{var m=n[e-15],p=n[e-2];n[e]=((m<<25|m>>>7)^(m<<14|m>>>18)^m>>>3)+n[e-7]+((p<<15|p>>>17)^(p<<13|p>>>19)^p>>>10)+n[e-16]}m=l+((f<<26|f>>>6)^(f<<21|f>>>11)^(f<<7|f>>>25))+(f&g^~f&j)+t[e]+n[e];p=((c<<30|c>>>2)^(c<<19|c>>>13)^(c<<10|c>>>22))+(c&d^c&b^d&b);l=j;j=g;g=f;f=k+m|0;k=b;b=d;d=c;c=m+p|0}a[0]=a[0]+c|0;a[1]=a[1]+d|0;a[2]=a[2]+b|0;a[3]=a[3]+k|0;a[4]=a[4]+f|0;a[5]=a[5]+g|0;a[6]=a[6]+j|0;a[7]=a[7]+l|0},_doFinalize:function(){var d=this._data,b=d.words,a=8*this._nDataBytes,c=8*d.sigBytes; -b[c>>>5]|=128<<24-c%32;b[(c+64>>>9<<4)+14]=k.floor(a/4294967296);b[(c+64>>>9<<4)+15]=a;d.sigBytes=4*b.length;this._process();return this._hash},clone:function(){var b=j.clone.call(this);b._hash=this._hash.clone();return b}});g.SHA256=j._createHelper(h);g.HmacSHA256=j._createHmacHelper(h)})(Math); - -/* -CryptoJS v3.1.2 sha224-min.js -code.google.com/p/crypto-js -(c) 2009-2013 by Jeff Mott. All rights reserved. -code.google.com/p/crypto-js/wiki/License -*/ -(function(){var b=CryptoJS,d=b.lib.WordArray,a=b.algo,c=a.SHA256,a=a.SHA224=c.extend({_doReset:function(){this._hash=new d.init([3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428])},_doFinalize:function(){var a=c._doFinalize.call(this);a.sigBytes-=4;return a}});b.SHA224=c._createHelper(a);b.HmacSHA224=c._createHmacHelper(a)})(); - -/* -CryptoJS v3.1.2 sha512-min.js -code.google.com/p/crypto-js -(c) 2009-2013 by Jeff Mott. All rights reserved. -code.google.com/p/crypto-js/wiki/License -*/ -(function(){function a(){return d.create.apply(d,arguments)}for(var n=CryptoJS,r=n.lib.Hasher,e=n.x64,d=e.Word,T=e.WordArray,e=n.algo,ea=[a(1116352408,3609767458),a(1899447441,602891725),a(3049323471,3964484399),a(3921009573,2173295548),a(961987163,4081628472),a(1508970993,3053834265),a(2453635748,2937671579),a(2870763221,3664609560),a(3624381080,2734883394),a(310598401,1164996542),a(607225278,1323610764),a(1426881987,3590304994),a(1925078388,4068182383),a(2162078206,991336113),a(2614888103,633803317), -a(3248222580,3479774868),a(3835390401,2666613458),a(4022224774,944711139),a(264347078,2341262773),a(604807628,2007800933),a(770255983,1495990901),a(1249150122,1856431235),a(1555081692,3175218132),a(1996064986,2198950837),a(2554220882,3999719339),a(2821834349,766784016),a(2952996808,2566594879),a(3210313671,3203337956),a(3336571891,1034457026),a(3584528711,2466948901),a(113926993,3758326383),a(338241895,168717936),a(666307205,1188179964),a(773529912,1546045734),a(1294757372,1522805485),a(1396182291, -2643833823),a(1695183700,2343527390),a(1986661051,1014477480),a(2177026350,1206759142),a(2456956037,344077627),a(2730485921,1290863460),a(2820302411,3158454273),a(3259730800,3505952657),a(3345764771,106217008),a(3516065817,3606008344),a(3600352804,1432725776),a(4094571909,1467031594),a(275423344,851169720),a(430227734,3100823752),a(506948616,1363258195),a(659060556,3750685593),a(883997877,3785050280),a(958139571,3318307427),a(1322822218,3812723403),a(1537002063,2003034995),a(1747873779,3602036899), -a(1955562222,1575990012),a(2024104815,1125592928),a(2227730452,2716904306),a(2361852424,442776044),a(2428436474,593698344),a(2756734187,3733110249),a(3204031479,2999351573),a(3329325298,3815920427),a(3391569614,3928383900),a(3515267271,566280711),a(3940187606,3454069534),a(4118630271,4000239992),a(116418474,1914138554),a(174292421,2731055270),a(289380356,3203993006),a(460393269,320620315),a(685471733,587496836),a(852142971,1086792851),a(1017036298,365543100),a(1126000580,2618297676),a(1288033470, -3409855158),a(1501505948,4234509866),a(1607167915,987167468),a(1816402316,1246189591)],v=[],w=0;80>w;w++)v[w]=a();e=e.SHA512=r.extend({_doReset:function(){this._hash=new T.init([new d.init(1779033703,4089235720),new d.init(3144134277,2227873595),new d.init(1013904242,4271175723),new d.init(2773480762,1595750129),new d.init(1359893119,2917565137),new d.init(2600822924,725511199),new d.init(528734635,4215389547),new d.init(1541459225,327033209)])},_doProcessBlock:function(a,d){for(var f=this._hash.words, -F=f[0],e=f[1],n=f[2],r=f[3],G=f[4],H=f[5],I=f[6],f=f[7],w=F.high,J=F.low,X=e.high,K=e.low,Y=n.high,L=n.low,Z=r.high,M=r.low,$=G.high,N=G.low,aa=H.high,O=H.low,ba=I.high,P=I.low,ca=f.high,Q=f.low,k=w,g=J,z=X,x=K,A=Y,y=L,U=Z,B=M,l=$,h=N,R=aa,C=O,S=ba,D=P,V=ca,E=Q,m=0;80>m;m++){var s=v[m];if(16>m)var j=s.high=a[d+2*m]|0,b=s.low=a[d+2*m+1]|0;else{var j=v[m-15],b=j.high,p=j.low,j=(b>>>1|p<<31)^(b>>>8|p<<24)^b>>>7,p=(p>>>1|b<<31)^(p>>>8|b<<24)^(p>>>7|b<<25),u=v[m-2],b=u.high,c=u.low,u=(b>>>19|c<<13)^(b<< -3|c>>>29)^b>>>6,c=(c>>>19|b<<13)^(c<<3|b>>>29)^(c>>>6|b<<26),b=v[m-7],W=b.high,t=v[m-16],q=t.high,t=t.low,b=p+b.low,j=j+W+(b>>>0>>0?1:0),b=b+c,j=j+u+(b>>>0>>0?1:0),b=b+t,j=j+q+(b>>>0>>0?1:0);s.high=j;s.low=b}var W=l&R^~l&S,t=h&C^~h&D,s=k&z^k&A^z&A,T=g&x^g&y^x&y,p=(k>>>28|g<<4)^(k<<30|g>>>2)^(k<<25|g>>>7),u=(g>>>28|k<<4)^(g<<30|k>>>2)^(g<<25|k>>>7),c=ea[m],fa=c.high,da=c.low,c=E+((h>>>14|l<<18)^(h>>>18|l<<14)^(h<<23|l>>>9)),q=V+((l>>>14|h<<18)^(l>>>18|h<<14)^(l<<23|h>>>9))+(c>>>0>>0?1: -0),c=c+t,q=q+W+(c>>>0>>0?1:0),c=c+da,q=q+fa+(c>>>0>>0?1:0),c=c+b,q=q+j+(c>>>0>>0?1:0),b=u+T,s=p+s+(b>>>0>>0?1:0),V=S,E=D,S=R,D=C,R=l,C=h,h=B+c|0,l=U+q+(h>>>0>>0?1:0)|0,U=A,B=y,A=z,y=x,z=k,x=g,g=c+b|0,k=q+s+(g>>>0>>0?1:0)|0}J=F.low=J+g;F.high=w+k+(J>>>0>>0?1:0);K=e.low=K+x;e.high=X+z+(K>>>0>>0?1:0);L=n.low=L+y;n.high=Y+A+(L>>>0>>0?1:0);M=r.low=M+B;r.high=Z+U+(M>>>0>>0?1:0);N=G.low=N+h;G.high=$+l+(N>>>0>>0?1:0);O=H.low=O+C;H.high=aa+R+(O>>>0>>0?1:0);P=I.low=P+D; -I.high=ba+S+(P>>>0>>0?1:0);Q=f.low=Q+E;f.high=ca+V+(Q>>>0>>0?1:0)},_doFinalize:function(){var a=this._data,d=a.words,f=8*this._nDataBytes,e=8*a.sigBytes;d[e>>>5]|=128<<24-e%32;d[(e+128>>>10<<5)+30]=Math.floor(f/4294967296);d[(e+128>>>10<<5)+31]=f;a.sigBytes=4*d.length;this._process();return this._hash.toX32()},clone:function(){var a=r.clone.call(this);a._hash=this._hash.clone();return a},blockSize:32});n.SHA512=r._createHelper(e);n.HmacSHA512=r._createHmacHelper(e)})(); - -/* -CryptoJS v3.1.2 sha384-min.js -code.google.com/p/crypto-js -(c) 2009-2013 by Jeff Mott. All rights reserved. -code.google.com/p/crypto-js/wiki/License -*/ -(function(){var c=CryptoJS,a=c.x64,b=a.Word,e=a.WordArray,a=c.algo,d=a.SHA512,a=a.SHA384=d.extend({_doReset:function(){this._hash=new e.init([new b.init(3418070365,3238371032),new b.init(1654270250,914150663),new b.init(2438529370,812702999),new b.init(355462360,4144912697),new b.init(1731405415,4290775857),new b.init(2394180231,1750603025),new b.init(3675008525,1694076839),new b.init(1203062813,3204075428)])},_doFinalize:function(){var a=d._doFinalize.call(this);a.sigBytes-=16;return a}});c.SHA384= -d._createHelper(a);c.HmacSHA384=d._createHmacHelper(a)})(); - -/* -CryptoJS v3.1.2 ripemd160-min.js -code.google.com/p/crypto-js -(c) 2009-2013 by Jeff Mott. All rights reserved. -code.google.com/p/crypto-js/wiki/License -*/ -/* - -(c) 2012 by Cedric Mesnil. All rights reserved. - -Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - - - Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - - 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 THE COPYRIGHT HOLDERS AND CONTRIBUTORS "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 THE COPYRIGHT HOLDER 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. -*/ -(function(){var q=CryptoJS,d=q.lib,n=d.WordArray,p=d.Hasher,d=q.algo,x=n.create([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13]),y=n.create([5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11]),z=n.create([11,14,15,12, -5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6]),A=n.create([8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11]),B=n.create([0,1518500249,1859775393,2400959708,2840853838]),C=n.create([1352829926,1548603684,1836072691, -2053994217,0]),d=d.RIPEMD160=p.extend({_doReset:function(){this._hash=n.create([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(e,v){for(var b=0;16>b;b++){var c=v+b,f=e[c];e[c]=(f<<8|f>>>24)&16711935|(f<<24|f>>>8)&4278255360}var c=this._hash.words,f=B.words,d=C.words,n=x.words,q=y.words,p=z.words,w=A.words,t,g,h,j,r,u,k,l,m,s;u=t=c[0];k=g=c[1];l=h=c[2];m=j=c[3];s=r=c[4];for(var a,b=0;80>b;b+=1)a=t+e[v+n[b]]|0,a=16>b?a+((g^h^j)+f[0]):32>b?a+((g&h|~g&j)+f[1]):48>b? -a+(((g|~h)^j)+f[2]):64>b?a+((g&j|h&~j)+f[3]):a+((g^(h|~j))+f[4]),a|=0,a=a<>>32-p[b],a=a+r|0,t=r,r=j,j=h<<10|h>>>22,h=g,g=a,a=u+e[v+q[b]]|0,a=16>b?a+((k^(l|~m))+d[0]):32>b?a+((k&m|l&~m)+d[1]):48>b?a+(((k|~l)^m)+d[2]):64>b?a+((k&l|~k&m)+d[3]):a+((k^l^m)+d[4]),a|=0,a=a<>>32-w[b],a=a+s|0,u=s,s=m,m=l<<10|l>>>22,l=k,k=a;a=c[1]+h+m|0;c[1]=c[2]+j+s|0;c[2]=c[3]+r+u|0;c[3]=c[4]+t+k|0;c[4]=c[0]+g+l|0;c[0]=a},_doFinalize:function(){var e=this._data,d=e.words,b=8*this._nDataBytes,c=8*e.sigBytes; -d[c>>>5]|=128<<24-c%32;d[(c+64>>>9<<4)+14]=(b<<8|b>>>24)&16711935|(b<<24|b>>>8)&4278255360;e.sigBytes=4*(d.length+1);this._process();e=this._hash;d=e.words;for(b=0;5>b;b++)c=d[b],d[b]=(c<<8|c>>>24)&16711935|(c<<24|c>>>8)&4278255360;return e},clone:function(){var d=p.clone.call(this);d._hash=this._hash.clone();return d}});q.RIPEMD160=p._createHelper(d);q.HmacRIPEMD160=p._createHmacHelper(d)})(Math); - -/* -CryptoJS v3.1.2 hmac.js -code.google.com/p/crypto-js -(c) 2009-2013 by Jeff Mott. All rights reserved. -code.google.com/p/crypto-js/wiki/License -*/ -(function(){var c=CryptoJS,k=c.enc.Utf8;c.algo.HMAC=c.lib.Base.extend({init:function(a,b){a=this._hasher=new a.init;"string"==typeof b&&(b=k.parse(b));var c=a.blockSize,e=4*c;b.sigBytes>e&&(b=a.finalize(b));b.clamp();for(var f=this._oKey=b.clone(),g=this._iKey=b.clone(),h=f.words,j=g.words,d=0;d>6)+b64map.charAt(e&63)}if(b+1==d.length){e=parseInt(d.substring(b,b+1),16);a+=b64map.charAt(e<<2)}else{if(b+2==d.length){e=parseInt(d.substring(b,b+2),16);a+=b64map.charAt(e>>2)+b64map.charAt((e&3)<<4)}}if(b64pad){while((a.length&3)>0){a+=b64pad}}return a}function b64tohex(f){var d="";var e;var b=0;var c;var a;for(e=0;e>2);c=a&3;b=1}else{if(b==1){d+=int2char((c<<2)|(a>>4));c=a&15;b=2}else{if(b==2){d+=int2char(c);d+=int2char(a>>2);c=a&3;b=3}else{d+=int2char((c<<2)|(a>>4));d+=int2char(a&15);b=0}}}}if(b==1){d+=int2char(c<<2)}return d}function b64toBA(e){var d=b64tohex(e);var c;var b=new Array();for(c=0;2*c=0){var d=a*this[f++]+b[e]+h;h=Math.floor(d/67108864);b[e++]=d&67108863}return h}function am2(f,q,r,e,o,a){var k=q&32767,p=q>>15;while(--a>=0){var d=this[f]&32767;var g=this[f++]>>15;var b=p*d+g*k;d=k*d+((b&32767)<<15)+r[e]+(o&1073741823);o=(d>>>30)+(b>>>15)+p*g+(o>>>30);r[e++]=d&1073741823}return o}function am3(f,q,r,e,o,a){var k=q&16383,p=q>>14;while(--a>=0){var d=this[f]&16383;var g=this[f++]>>14;var b=p*d+g*k;d=k*d+((b&16383)<<14)+r[e]+o;o=(d>>28)+(b>>14)+p*g;r[e++]=d&268435455}return o}if(j_lm&&(navigator.appName=="Microsoft Internet Explorer")){BigInteger.prototype.am=am2;dbits=30}else{if(j_lm&&(navigator.appName!="Netscape")){BigInteger.prototype.am=am1;dbits=26}else{BigInteger.prototype.am=am3;dbits=28}}BigInteger.prototype.DB=dbits;BigInteger.prototype.DM=((1<=0;--a){b[a]=this[a]}b.t=this.t;b.s=this.s}function bnpFromInt(a){this.t=1;this.s=(a<0)?-1:0;if(a>0){this[0]=a}else{if(a<-1){this[0]=a+this.DV}else{this.t=0}}}function nbv(a){var b=nbi();b.fromInt(a);return b}function bnpFromString(h,c){var e;if(c==16){e=4}else{if(c==8){e=3}else{if(c==256){e=8}else{if(c==2){e=1}else{if(c==32){e=5}else{if(c==4){e=2}else{this.fromRadix(h,c);return}}}}}}this.t=0;this.s=0;var g=h.length,d=false,f=0;while(--g>=0){var a=(e==8)?h[g]&255:intAt(h,g);if(a<0){if(h.charAt(g)=="-"){d=true}continue}d=false;if(f==0){this[this.t++]=a}else{if(f+e>this.DB){this[this.t-1]|=(a&((1<<(this.DB-f))-1))<>(this.DB-f))}else{this[this.t-1]|=a<=this.DB){f-=this.DB}}if(e==8&&(h[0]&128)!=0){this.s=-1;if(f>0){this[this.t-1]|=((1<<(this.DB-f))-1)<0&&this[this.t-1]==a){--this.t}}function bnToString(c){if(this.s<0){return"-"+this.negate().toString(c)}var e;if(c==16){e=4}else{if(c==8){e=3}else{if(c==2){e=1}else{if(c==32){e=5}else{if(c==4){e=2}else{return this.toRadix(c)}}}}}var g=(1<0){if(j>j)>0){a=true;h=int2char(l)}while(f>=0){if(j>(j+=this.DB-e)}else{l=(this[f]>>(j-=e))&g;if(j<=0){j+=this.DB;--f}}if(l>0){a=true}if(a){h+=int2char(l)}}}return a?h:"0"}function bnNegate(){var a=nbi();BigInteger.ZERO.subTo(this,a);return a}function bnAbs(){return(this.s<0)?this.negate():this}function bnCompareTo(b){var d=this.s-b.s;if(d!=0){return d}var c=this.t;d=c-b.t;if(d!=0){return(this.s<0)?-d:d}while(--c>=0){if((d=this[c]-b[c])!=0){return d}}return 0}function nbits(a){var c=1,b;if((b=a>>>16)!=0){a=b;c+=16}if((b=a>>8)!=0){a=b;c+=8}if((b=a>>4)!=0){a=b;c+=4}if((b=a>>2)!=0){a=b;c+=2}if((b=a>>1)!=0){a=b;c+=1}return c}function bnBitLength(){if(this.t<=0){return 0}return this.DB*(this.t-1)+nbits(this[this.t-1]^(this.s&this.DM))}function bnpDLShiftTo(c,b){var a;for(a=this.t-1;a>=0;--a){b[a+c]=this[a]}for(a=c-1;a>=0;--a){b[a]=0}b.t=this.t+c;b.s=this.s}function bnpDRShiftTo(c,b){for(var a=c;a=0;--d){e[d+f+1]=(this[d]>>a)|h;h=(this[d]&g)<=0;--d){e[d]=0}e[f]=h;e.t=this.t+f+1;e.s=this.s;e.clamp()}function bnpRShiftTo(g,d){d.s=this.s;var e=Math.floor(g/this.DB);if(e>=this.t){d.t=0;return}var b=g%this.DB;var a=this.DB-b;var f=(1<>b;for(var c=e+1;c>b}if(b>0){d[this.t-e-1]|=(this.s&f)<>=this.DB}if(d.t>=this.DB}g+=this.s}else{g+=this.s;while(e>=this.DB}g-=d.s}f.s=(g<0)?-1:0;if(g<-1){f[e++]=this.DV+g}else{if(g>0){f[e++]=g}}f.t=e;f.clamp()}function bnpMultiplyTo(c,e){var b=this.abs(),f=c.abs();var d=b.t;e.t=d+f.t;while(--d>=0){e[d]=0}for(d=0;d=0){d[b]=0}for(b=0;b=a.DV){d[b+a.t]-=a.DV;d[b+a.t+1]=1}}if(d.t>0){d[d.t-1]+=a.am(b,a[b],d,2*b,0,1)}d.s=0;d.clamp()}function bnpDivRemTo(n,h,g){var w=n.abs();if(w.t<=0){return}var k=this.abs();if(k.t0){w.lShiftTo(v,d);k.lShiftTo(v,g)}else{w.copyTo(d);k.copyTo(g)}var p=d.t;var b=d[p-1];if(b==0){return}var o=b*(1<1)?d[p-2]>>this.F2:0);var A=this.FV/o,z=(1<=0){g[g.t++]=1;g.subTo(f,g)}BigInteger.ONE.dlShiftTo(p,f);f.subTo(d,d);while(d.t=0){var c=(g[--u]==b)?this.DM:Math.floor(g[u]*A+(g[u-1]+x)*z);if((g[u]+=d.am(0,c,g,s,0,p))0){g.rShiftTo(v,g)}if(a<0){BigInteger.ZERO.subTo(g,g)}}function bnMod(b){var c=nbi();this.abs().divRemTo(b,null,c);if(this.s<0&&c.compareTo(BigInteger.ZERO)>0){b.subTo(c,c)}return c}function Classic(a){this.m=a}function cConvert(a){if(a.s<0||a.compareTo(this.m)>=0){return a.mod(this.m)}else{return a}}function cRevert(a){return a}function cReduce(a){a.divRemTo(this.m,null,a)}function cMulTo(a,c,b){a.multiplyTo(c,b);this.reduce(b)}function cSqrTo(a,b){a.squareTo(b);this.reduce(b)}Classic.prototype.convert=cConvert;Classic.prototype.revert=cRevert;Classic.prototype.reduce=cReduce;Classic.prototype.mulTo=cMulTo;Classic.prototype.sqrTo=cSqrTo;function bnpInvDigit(){if(this.t<1){return 0}var a=this[0];if((a&1)==0){return 0}var b=a&3;b=(b*(2-(a&15)*b))&15;b=(b*(2-(a&255)*b))&255;b=(b*(2-(((a&65535)*b)&65535)))&65535;b=(b*(2-a*b%this.DV))%this.DV;return(b>0)?this.DV-b:-b}function Montgomery(a){this.m=a;this.mp=a.invDigit();this.mpl=this.mp&32767;this.mph=this.mp>>15;this.um=(1<<(a.DB-15))-1;this.mt2=2*a.t}function montConvert(a){var b=nbi();a.abs().dlShiftTo(this.m.t,b);b.divRemTo(this.m,null,b);if(a.s<0&&b.compareTo(BigInteger.ZERO)>0){this.m.subTo(b,b)}return b}function montRevert(a){var b=nbi();a.copyTo(b);this.reduce(b);return b}function montReduce(a){while(a.t<=this.mt2){a[a.t++]=0}for(var c=0;c>15)*this.mpl)&this.um)<<15))&a.DM;b=c+this.m.t;a[b]+=this.m.am(0,d,a,c,0,this.m.t);while(a[b]>=a.DV){a[b]-=a.DV;a[++b]++}}a.clamp();a.drShiftTo(this.m.t,a);if(a.compareTo(this.m)>=0){a.subTo(this.m,a)}}function montSqrTo(a,b){a.squareTo(b);this.reduce(b)}function montMulTo(a,c,b){a.multiplyTo(c,b);this.reduce(b)}Montgomery.prototype.convert=montConvert;Montgomery.prototype.revert=montRevert;Montgomery.prototype.reduce=montReduce;Montgomery.prototype.mulTo=montMulTo;Montgomery.prototype.sqrTo=montSqrTo;function bnpIsEven(){return((this.t>0)?(this[0]&1):this.s)==0}function bnpExp(h,j){if(h>4294967295||h<1){return BigInteger.ONE}var f=nbi(),a=nbi(),d=j.convert(this),c=nbits(h)-1;d.copyTo(f);while(--c>=0){j.sqrTo(f,a);if((h&(1<0){j.mulTo(a,d,f)}else{var b=f;f=a;a=b}}return j.revert(f)}function bnModPowInt(b,a){var c;if(b<256||a.isEven()){c=new Classic(a)}else{c=new Montgomery(a)}return this.exp(b,c)}BigInteger.prototype.copyTo=bnpCopyTo;BigInteger.prototype.fromInt=bnpFromInt;BigInteger.prototype.fromString=bnpFromString;BigInteger.prototype.clamp=bnpClamp;BigInteger.prototype.dlShiftTo=bnpDLShiftTo;BigInteger.prototype.drShiftTo=bnpDRShiftTo;BigInteger.prototype.lShiftTo=bnpLShiftTo;BigInteger.prototype.rShiftTo=bnpRShiftTo;BigInteger.prototype.subTo=bnpSubTo;BigInteger.prototype.multiplyTo=bnpMultiplyTo;BigInteger.prototype.squareTo=bnpSquareTo;BigInteger.prototype.divRemTo=bnpDivRemTo;BigInteger.prototype.invDigit=bnpInvDigit;BigInteger.prototype.isEven=bnpIsEven;BigInteger.prototype.exp=bnpExp;BigInteger.prototype.toString=bnToString;BigInteger.prototype.negate=bnNegate;BigInteger.prototype.abs=bnAbs;BigInteger.prototype.compareTo=bnCompareTo;BigInteger.prototype.bitLength=bnBitLength;BigInteger.prototype.mod=bnMod;BigInteger.prototype.modPowInt=bnModPowInt;BigInteger.ZERO=nbv(0);BigInteger.ONE=nbv(1); -/*! (c) Tom Wu | http://www-cs-students.stanford.edu/~tjw/jsbn/ - */ -function bnClone(){var a=nbi();this.copyTo(a);return a}function bnIntValue(){if(this.s<0){if(this.t==1){return this[0]-this.DV}else{if(this.t==0){return -1}}}else{if(this.t==1){return this[0]}else{if(this.t==0){return 0}}}return((this[1]&((1<<(32-this.DB))-1))<>24}function bnShortValue(){return(this.t==0)?this.s:(this[0]<<16)>>16}function bnpChunkSize(a){return Math.floor(Math.LN2*this.DB/Math.log(a))}function bnSigNum(){if(this.s<0){return -1}else{if(this.t<=0||(this.t==1&&this[0]<=0)){return 0}else{return 1}}}function bnpToRadix(c){if(c==null){c=10}if(this.signum()==0||c<2||c>36){return"0"}var f=this.chunkSize(c);var e=Math.pow(c,f);var i=nbv(e),j=nbi(),h=nbi(),g="";this.divRemTo(i,j,h);while(j.signum()>0){g=(e+h.intValue()).toString(c).substr(1)+g;j.divRemTo(i,j,h)}return h.intValue().toString(c)+g}function bnpFromRadix(m,h){this.fromInt(0);if(h==null){h=10}var f=this.chunkSize(h);var g=Math.pow(h,f),e=false,a=0,l=0;for(var c=0;c=f){this.dMultiply(g);this.dAddOffset(l,0);a=0;l=0}}if(a>0){this.dMultiply(Math.pow(h,a));this.dAddOffset(l,0)}if(e){BigInteger.ZERO.subTo(this,this)}}function bnpFromNumber(f,e,h){if("number"==typeof e){if(f<2){this.fromInt(1)}else{this.fromNumber(f,h);if(!this.testBit(f-1)){this.bitwiseTo(BigInteger.ONE.shiftLeft(f-1),op_or,this)}if(this.isEven()){this.dAddOffset(1,0)}while(!this.isProbablePrime(e)){this.dAddOffset(2,0);if(this.bitLength()>f){this.subTo(BigInteger.ONE.shiftLeft(f-1),this)}}}}else{var d=new Array(),g=f&7;d.length=(f>>3)+1;e.nextBytes(d);if(g>0){d[0]&=((1<0){if(e>e)!=(this.s&this.DM)>>e){c[a++]=f|(this.s<<(this.DB-e))}while(b>=0){if(e<8){f=(this[b]&((1<>(e+=this.DB-8)}else{f=(this[b]>>(e-=8))&255;if(e<=0){e+=this.DB;--b}}if((f&128)!=0){f|=-256}if(a==0&&(this.s&128)!=(f&128)){++a}if(a>0||f!=this.s){c[a++]=f}}}return c}function bnEquals(b){return(this.compareTo(b)==0)}function bnMin(b){return(this.compareTo(b)<0)?this:b}function bnMax(b){return(this.compareTo(b)>0)?this:b}function bnpBitwiseTo(c,h,e){var d,g,b=Math.min(c.t,this.t);for(d=0;d>=16;b+=16}if((a&255)==0){a>>=8;b+=8}if((a&15)==0){a>>=4;b+=4}if((a&3)==0){a>>=2;b+=2}if((a&1)==0){++b}return b}function bnGetLowestSetBit(){for(var a=0;a=this.t){return(this.s!=0)}return((this[a]&(1<<(b%this.DB)))!=0)}function bnpChangeBit(c,b){var a=BigInteger.ONE.shiftLeft(c);this.bitwiseTo(a,b,a);return a}function bnSetBit(a){return this.changeBit(a,op_or)}function bnClearBit(a){return this.changeBit(a,op_andnot)}function bnFlipBit(a){return this.changeBit(a,op_xor)}function bnpAddTo(d,f){var e=0,g=0,b=Math.min(d.t,this.t);while(e>=this.DB}if(d.t>=this.DB}g+=this.s}else{g+=this.s;while(e>=this.DB}g+=d.s}f.s=(g<0)?-1:0;if(g>0){f[e++]=g}else{if(g<-1){f[e++]=this.DV+g}}f.t=e;f.clamp()}function bnAdd(b){var c=nbi();this.addTo(b,c);return c}function bnSubtract(b){var c=nbi();this.subTo(b,c);return c}function bnMultiply(b){var c=nbi();this.multiplyTo(b,c);return c}function bnSquare(){var a=nbi();this.squareTo(a);return a}function bnDivide(b){var c=nbi();this.divRemTo(b,c,null);return c}function bnRemainder(b){var c=nbi();this.divRemTo(b,null,c);return c}function bnDivideAndRemainder(b){var d=nbi(),c=nbi();this.divRemTo(b,d,c);return new Array(d,c)}function bnpDMultiply(a){this[this.t]=this.am(0,a-1,this,0,0,this.t);++this.t;this.clamp()}function bnpDAddOffset(b,a){if(b==0){return}while(this.t<=a){this[this.t++]=0}this[a]+=b;while(this[a]>=this.DV){this[a]-=this.DV;if(++a>=this.t){this[this.t++]=0}++this[a]}}function NullExp(){}function nNop(a){return a}function nMulTo(a,c,b){a.multiplyTo(c,b)}function nSqrTo(a,b){a.squareTo(b)}NullExp.prototype.convert=nNop;NullExp.prototype.revert=nNop;NullExp.prototype.mulTo=nMulTo;NullExp.prototype.sqrTo=nSqrTo;function bnPow(a){return this.exp(a,new NullExp())}function bnpMultiplyLowerTo(b,f,e){var d=Math.min(this.t+b.t,f);e.s=0;e.t=d;while(d>0){e[--d]=0}var c;for(c=e.t-this.t;d=0){d[c]=0}for(c=Math.max(e-this.t,0);c2*this.m.t){return a.mod(this.m)}else{if(a.compareTo(this.m)<0){return a}else{var b=nbi();a.copyTo(b);this.reduce(b);return b}}}function barrettRevert(a){return a}function barrettReduce(a){a.drShiftTo(this.m.t-1,this.r2);if(a.t>this.m.t+1){a.t=this.m.t+1;a.clamp()}this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3);this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);while(a.compareTo(this.r2)<0){a.dAddOffset(1,this.m.t+1)}a.subTo(this.r2,a);while(a.compareTo(this.m)>=0){a.subTo(this.m,a)}}function barrettSqrTo(a,b){a.squareTo(b);this.reduce(b)}function barrettMulTo(a,c,b){a.multiplyTo(c,b);this.reduce(b)}Barrett.prototype.convert=barrettConvert;Barrett.prototype.revert=barrettRevert;Barrett.prototype.reduce=barrettReduce;Barrett.prototype.mulTo=barrettMulTo;Barrett.prototype.sqrTo=barrettSqrTo;function bnModPow(q,f){var o=q.bitLength(),h,b=nbv(1),v;if(o<=0){return b}else{if(o<18){h=1}else{if(o<48){h=3}else{if(o<144){h=4}else{if(o<768){h=5}else{h=6}}}}}if(o<8){v=new Classic(f)}else{if(f.isEven()){v=new Barrett(f)}else{v=new Montgomery(f)}}var p=new Array(),d=3,s=h-1,a=(1<1){var A=nbi();v.sqrTo(p[1],A);while(d<=a){p[d]=nbi();v.mulTo(A,p[d-2],p[d]);d+=2}}var l=q.t-1,x,u=true,c=nbi(),y;o=nbits(q[l])-1;while(l>=0){if(o>=s){x=(q[l]>>(o-s))&a}else{x=(q[l]&((1<<(o+1))-1))<<(s-o);if(l>0){x|=q[l-1]>>(this.DB+o-s)}}d=h;while((x&1)==0){x>>=1;--d}if((o-=d)<0){o+=this.DB;--l}if(u){p[x].copyTo(b);u=false}else{while(d>1){v.sqrTo(b,c);v.sqrTo(c,b);d-=2}if(d>0){v.sqrTo(b,c)}else{y=b;b=c;c=y}v.mulTo(c,p[x],b)}while(l>=0&&(q[l]&(1<0){b.rShiftTo(f,b);h.rShiftTo(f,h)}while(b.signum()>0){if((d=b.getLowestSetBit())>0){b.rShiftTo(d,b)}if((d=h.getLowestSetBit())>0){h.rShiftTo(d,h)}if(b.compareTo(h)>=0){b.subTo(h,b);b.rShiftTo(1,b)}else{h.subTo(b,h);h.rShiftTo(1,h)}}if(f>0){h.lShiftTo(f,h)}return h}function bnpModInt(e){if(e<=0){return 0}var c=this.DV%e,b=(this.s<0)?e-1:0;if(this.t>0){if(c==0){b=this[0]%e}else{for(var a=this.t-1;a>=0;--a){b=(c*b+this[a])%e}}}return b}function bnModInverse(f){var j=f.isEven();if((this.isEven()&&j)||f.signum()==0){return BigInteger.ZERO}var i=f.clone(),h=this.clone();var g=nbv(1),e=nbv(0),l=nbv(0),k=nbv(1);while(i.signum()!=0){while(i.isEven()){i.rShiftTo(1,i);if(j){if(!g.isEven()||!e.isEven()){g.addTo(this,g);e.subTo(f,e)}g.rShiftTo(1,g)}else{if(!e.isEven()){e.subTo(f,e)}}e.rShiftTo(1,e)}while(h.isEven()){h.rShiftTo(1,h);if(j){if(!l.isEven()||!k.isEven()){l.addTo(this,l);k.subTo(f,k)}l.rShiftTo(1,l)}else{if(!k.isEven()){k.subTo(f,k)}}k.rShiftTo(1,k)}if(i.compareTo(h)>=0){i.subTo(h,i);if(j){g.subTo(l,g)}e.subTo(k,e)}else{h.subTo(i,h);if(j){l.subTo(g,l)}k.subTo(e,k)}}if(h.compareTo(BigInteger.ONE)!=0){return BigInteger.ZERO}if(k.compareTo(f)>=0){return k.subtract(f)}if(k.signum()<0){k.addTo(f,k)}else{return k}if(k.signum()<0){return k.add(f)}else{return k}}var lowprimes=[2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509,521,523,541,547,557,563,569,571,577,587,593,599,601,607,613,617,619,631,641,643,647,653,659,661,673,677,683,691,701,709,719,727,733,739,743,751,757,761,769,773,787,797,809,811,821,823,827,829,839,853,857,859,863,877,881,883,887,907,911,919,929,937,941,947,953,967,971,977,983,991,997];var lplim=(1<<26)/lowprimes[lowprimes.length-1];function bnIsProbablePrime(e){var d,b=this.abs();if(b.t==1&&b[0]<=lowprimes[lowprimes.length-1]){for(d=0;d>1;if(f>lowprimes.length){f=lowprimes.length}var b=nbi();for(var e=0;e>8)&255;rng_pool[rng_pptr++]^=(a>>16)&255;rng_pool[rng_pptr++]^=(a>>24)&255;if(rng_pptr>=rng_psize){rng_pptr-=rng_psize}}function rng_seed_time(){rng_seed_int(new Date().getTime())}if(rng_pool==null){rng_pool=new Array();rng_pptr=0;var t;if(window!==undefined&&(window.crypto!==undefined||window.msCrypto!==undefined)){var crypto=window.crypto||window.msCrypto;if(crypto.getRandomValues){var ua=new Uint8Array(32);crypto.getRandomValues(ua);for(t=0;t<32;++t){rng_pool[rng_pptr++]=ua[t]}}else{if(navigator.appName=="Netscape"&&navigator.appVersion<"5"){var z=window.crypto.random(32);for(t=0;t>>8;rng_pool[rng_pptr++]=t&255}rng_pptr=0;rng_seed_time()}function rng_get_byte(){if(rng_state==null){rng_seed_time();rng_state=prng_newstate();rng_state.init(rng_pool);for(rng_pptr=0;rng_pptr=0&&h>0){var f=e.charCodeAt(d--);if(f<128){g[--h]=f}else{if((f>127)&&(f<2048)){g[--h]=(f&63)|128;g[--h]=(f>>6)|192}else{g[--h]=(f&63)|128;g[--h]=((f>>6)&63)|128;g[--h]=(f>>12)|224}}}g[--h]=0;var b=new SecureRandom();var a=new Array();while(h>2){a[0]=0;while(a[0]==0){b.nextBytes(a)}g[--h]=a[0]}g[--h]=2;g[--h]=0;return new BigInteger(g)}function oaep_mgf1_arr(c,a,e){var b="",d=0;while(b.length>24,(d&16711680)>>16,(d&65280)>>8,d&255])));d+=1}return b}function oaep_pad(q,a,f,l){var c=KJUR.crypto.MessageDigest;var o=KJUR.crypto.Util;var b=null;if(!f){f="sha1"}if(typeof f==="string"){b=c.getCanonicalAlgName(f);l=c.getHashLength(b);f=function(i){return hextorstr(o.hashString(i,b))}}if(q.length+2*l+2>a){throw"Message too long for RSA"}var k="",e;for(e=0;e0&&a.length>0){this.n=parseBigInt(b,16);this.e=parseInt(a,16)}else{throw"Invalid RSA public key"}}}function RSADoPublic(a){return a.modPowInt(this.e,this.n)}function RSAEncrypt(d){var a=pkcs1pad2(d,(this.n.bitLength()+7)>>3);if(a==null){return null}var e=this.doPublic(a);if(e==null){return null}var b=e.toString(16);if((b.length&1)==0){return b}else{return"0"+b}}function RSAEncryptOAEP(f,e,b){var a=oaep_pad(f,(this.n.bitLength()+7)>>3,e,b);if(a==null){return null}var g=this.doPublic(a);if(g==null){return null}var d=g.toString(16);if((d.length&1)==0){return d}else{return"0"+d}}RSAKey.prototype.doPublic=RSADoPublic;RSAKey.prototype.setPublic=RSASetPublic;RSAKey.prototype.encrypt=RSAEncrypt;RSAKey.prototype.encryptOAEP=RSAEncryptOAEP;RSAKey.prototype.type="RSA"; -/*! (c) Tom Wu | http://www-cs-students.stanford.edu/~tjw/jsbn/ - */ -function pkcs1unpad2(g,j){var a=g.toByteArray();var f=0;while(f=a.length){return null}}var e="";while(++f191)&&(h<224)){e+=String.fromCharCode(((h&31)<<6)|(a[f+1]&63));++f}else{e+=String.fromCharCode(((h&15)<<12)|((a[f+1]&63)<<6)|(a[f+2]&63));f+=2}}}return e}function oaep_mgf1_str(c,a,e){var b="",d=0;while(b.length>24,(d&16711680)>>16,(d&65280)>>8,d&255]));d+=1}return b}function oaep_unpad(o,b,g,p){var e=KJUR.crypto.MessageDigest;var r=KJUR.crypto.Util;var c=null;if(!g){g="sha1"}if(typeof g==="string"){c=e.getCanonicalAlgName(g);p=e.getHashLength(c);g=function(d){return hextorstr(r.hashString(d,c))}}o=o.toByteArray();var h;for(h=0;h0&&a.length>0){this.n=parseBigInt(c,16);this.e=parseInt(a,16);this.d=parseBigInt(b,16)}else{alert("Invalid RSA private key")}}}function RSASetPrivateEx(g,d,e,c,b,a,h,f){this.isPrivate=true;this.isPublic=false;if(g==null){throw"RSASetPrivateEx N == null"}if(d==null){throw"RSASetPrivateEx E == null"}if(g.length==0){throw"RSASetPrivateEx N.length == 0"}if(d.length==0){throw"RSASetPrivateEx E.length == 0"}if(g!=null&&d!=null&&g.length>0&&d.length>0){this.n=parseBigInt(g,16);this.e=parseInt(d,16);this.d=parseBigInt(e,16);this.p=parseBigInt(c,16);this.q=parseBigInt(b,16);this.dmp1=parseBigInt(a,16);this.dmq1=parseBigInt(h,16);this.coeff=parseBigInt(f,16)}else{alert("Invalid RSA private key in RSASetPrivateEx")}}function RSAGenerate(b,i){var a=new SecureRandom();var f=b>>1;this.e=parseInt(i,16);var c=new BigInteger(i,16);for(;;){for(;;){this.p=new BigInteger(b-f,1,a);if(this.p.subtract(BigInteger.ONE).gcd(c).compareTo(BigInteger.ONE)==0&&this.p.isProbablePrime(10)){break}}for(;;){this.q=new BigInteger(f,1,a);if(this.q.subtract(BigInteger.ONE).gcd(c).compareTo(BigInteger.ONE)==0&&this.q.isProbablePrime(10)){break}}if(this.p.compareTo(this.q)<=0){var h=this.p;this.p=this.q;this.q=h}var g=this.p.subtract(BigInteger.ONE);var d=this.q.subtract(BigInteger.ONE);var e=g.multiply(d);if(e.gcd(c).compareTo(BigInteger.ONE)==0){this.n=this.p.multiply(this.q);this.d=c.modInverse(e);this.dmp1=this.d.mod(g);this.dmq1=this.d.mod(d);this.coeff=this.q.modInverse(this.p);break}}this.isPrivate=true}function RSADoPrivate(a){if(this.p==null||this.q==null){return a.modPow(this.d,this.n)}var c=a.mod(this.p).modPow(this.dmp1,this.p);var b=a.mod(this.q).modPow(this.dmq1,this.q);while(c.compareTo(b)<0){c=c.add(this.p)}return c.subtract(b).multiply(this.coeff).mod(this.p).multiply(this.q).add(b)}function RSADecrypt(b){var d=parseBigInt(b,16);var a=this.doPrivate(d);if(a==null){return null}return pkcs1unpad2(a,(this.n.bitLength()+7)>>3)}function RSADecryptOAEP(e,d,b){var f=parseBigInt(e,16);var a=this.doPrivate(f);if(a==null){return null}return oaep_unpad(a,(this.n.bitLength()+7)>>3,d,b)}RSAKey.prototype.doPrivate=RSADoPrivate;RSAKey.prototype.setPrivate=RSASetPrivate;RSAKey.prototype.setPrivateEx=RSASetPrivateEx;RSAKey.prototype.generate=RSAGenerate;RSAKey.prototype.decrypt=RSADecrypt;RSAKey.prototype.decryptOAEP=RSADecryptOAEP; -/*! (c) Tom Wu | http://www-cs-students.stanford.edu/~tjw/jsbn/ - */ -function ECFieldElementFp(b,a){this.x=a;this.q=b}function feFpEquals(a){if(a==this){return true}return(this.q.equals(a.q)&&this.x.equals(a.x))}function feFpToBigInteger(){return this.x}function feFpNegate(){return new ECFieldElementFp(this.q,this.x.negate().mod(this.q))}function feFpAdd(a){return new ECFieldElementFp(this.q,this.x.add(a.toBigInteger()).mod(this.q))}function feFpSubtract(a){return new ECFieldElementFp(this.q,this.x.subtract(a.toBigInteger()).mod(this.q))}function feFpMultiply(a){return new ECFieldElementFp(this.q,this.x.multiply(a.toBigInteger()).mod(this.q))}function feFpSquare(){return new ECFieldElementFp(this.q,this.x.square().mod(this.q))}function feFpDivide(a){return new ECFieldElementFp(this.q,this.x.multiply(a.toBigInteger().modInverse(this.q)).mod(this.q))}ECFieldElementFp.prototype.equals=feFpEquals;ECFieldElementFp.prototype.toBigInteger=feFpToBigInteger;ECFieldElementFp.prototype.negate=feFpNegate;ECFieldElementFp.prototype.add=feFpAdd;ECFieldElementFp.prototype.subtract=feFpSubtract;ECFieldElementFp.prototype.multiply=feFpMultiply;ECFieldElementFp.prototype.square=feFpSquare;ECFieldElementFp.prototype.divide=feFpDivide;function ECPointFp(c,a,d,b){this.curve=c;this.x=a;this.y=d;if(b==null){this.z=BigInteger.ONE}else{this.z=b}this.zinv=null}function pointFpGetX(){if(this.zinv==null){this.zinv=this.z.modInverse(this.curve.q)}return this.curve.fromBigInteger(this.x.toBigInteger().multiply(this.zinv).mod(this.curve.q))}function pointFpGetY(){if(this.zinv==null){this.zinv=this.z.modInverse(this.curve.q)}return this.curve.fromBigInteger(this.y.toBigInteger().multiply(this.zinv).mod(this.curve.q))}function pointFpEquals(a){if(a==this){return true}if(this.isInfinity()){return a.isInfinity()}if(a.isInfinity()){return this.isInfinity()}var c,b;c=a.y.toBigInteger().multiply(this.z).subtract(this.y.toBigInteger().multiply(a.z)).mod(this.curve.q);if(!c.equals(BigInteger.ZERO)){return false}b=a.x.toBigInteger().multiply(this.z).subtract(this.x.toBigInteger().multiply(a.z)).mod(this.curve.q);return b.equals(BigInteger.ZERO)}function pointFpIsInfinity(){if((this.x==null)&&(this.y==null)){return true}return this.z.equals(BigInteger.ZERO)&&!this.y.toBigInteger().equals(BigInteger.ZERO)}function pointFpNegate(){return new ECPointFp(this.curve,this.x,this.y.negate(),this.z)}function pointFpAdd(l){if(this.isInfinity()){return l}if(l.isInfinity()){return this}var p=l.y.toBigInteger().multiply(this.z).subtract(this.y.toBigInteger().multiply(l.z)).mod(this.curve.q);var o=l.x.toBigInteger().multiply(this.z).subtract(this.x.toBigInteger().multiply(l.z)).mod(this.curve.q);if(BigInteger.ZERO.equals(o)){if(BigInteger.ZERO.equals(p)){return this.twice()}return this.curve.getInfinity()}var j=new BigInteger("3");var e=this.x.toBigInteger();var n=this.y.toBigInteger();var c=l.x.toBigInteger();var k=l.y.toBigInteger();var m=o.square();var i=m.multiply(o);var d=e.multiply(m);var g=p.square().multiply(this.z);var a=g.subtract(d.shiftLeft(1)).multiply(l.z).subtract(i).multiply(o).mod(this.curve.q);var h=d.multiply(j).multiply(p).subtract(n.multiply(i)).subtract(g.multiply(p)).multiply(l.z).add(p.multiply(i)).mod(this.curve.q);var f=i.multiply(this.z).multiply(l.z).mod(this.curve.q);return new ECPointFp(this.curve,this.curve.fromBigInteger(a),this.curve.fromBigInteger(h),f)}function pointFpTwice(){if(this.isInfinity()){return this}if(this.y.toBigInteger().signum()==0){return this.curve.getInfinity()}var g=new BigInteger("3");var c=this.x.toBigInteger();var h=this.y.toBigInteger();var e=h.multiply(this.z);var j=e.multiply(h).mod(this.curve.q);var i=this.curve.a.toBigInteger();var k=c.square().multiply(g);if(!BigInteger.ZERO.equals(i)){k=k.add(this.z.square().multiply(i))}k=k.mod(this.curve.q);var b=k.square().subtract(c.shiftLeft(3).multiply(j)).shiftLeft(1).multiply(e).mod(this.curve.q);var f=k.multiply(g).multiply(c).subtract(j.shiftLeft(1)).shiftLeft(2).multiply(j).subtract(k.square().multiply(k)).mod(this.curve.q);var d=e.square().multiply(e).shiftLeft(3).mod(this.curve.q);return new ECPointFp(this.curve,this.curve.fromBigInteger(b),this.curve.fromBigInteger(f),d)}function pointFpMultiply(b){if(this.isInfinity()){return this}if(b.signum()==0){return this.curve.getInfinity()}var g=b;var f=g.multiply(new BigInteger("3"));var l=this.negate();var d=this;var c;for(c=f.bitLength()-2;c>0;--c){d=d.twice();var a=f.testBit(c);var j=g.testBit(c);if(a!=j){d=d.add(a?this:l)}}return d}function pointFpMultiplyTwo(c,a,b){var d;if(c.bitLength()>b.bitLength()){d=c.bitLength()-1}else{d=b.bitLength()-1}var f=this.curve.getInfinity();var e=this.add(a);while(d>=0){f=f.twice();if(c.testBit(d)){if(b.testBit(d)){f=f.add(e)}else{f=f.add(this)}}else{if(b.testBit(d)){f=f.add(a)}}--d}return f}ECPointFp.prototype.getX=pointFpGetX;ECPointFp.prototype.getY=pointFpGetY;ECPointFp.prototype.equals=pointFpEquals;ECPointFp.prototype.isInfinity=pointFpIsInfinity;ECPointFp.prototype.negate=pointFpNegate;ECPointFp.prototype.add=pointFpAdd;ECPointFp.prototype.twice=pointFpTwice;ECPointFp.prototype.multiply=pointFpMultiply;ECPointFp.prototype.multiplyTwo=pointFpMultiplyTwo;function ECCurveFp(e,d,c){this.q=e;this.a=this.fromBigInteger(d);this.b=this.fromBigInteger(c);this.infinity=new ECPointFp(this,null,null)}function curveFpGetQ(){return this.q}function curveFpGetA(){return this.a}function curveFpGetB(){return this.b}function curveFpEquals(a){if(a==this){return true}return(this.q.equals(a.q)&&this.a.equals(a.a)&&this.b.equals(a.b))}function curveFpGetInfinity(){return this.infinity}function curveFpFromBigInteger(a){return new ECFieldElementFp(this.q,a)}function curveFpDecodePointHex(d){switch(parseInt(d.substr(0,2),16)){case 0:return this.infinity;case 2:case 3:return null;case 4:case 6:case 7:var a=(d.length-2)/2;var c=d.substr(2,a);var b=d.substr(a+2,a);return new ECPointFp(this,this.fromBigInteger(new BigInteger(c,16)),this.fromBigInteger(new BigInteger(b,16)));default:return null}}ECCurveFp.prototype.getQ=curveFpGetQ;ECCurveFp.prototype.getA=curveFpGetA;ECCurveFp.prototype.getB=curveFpGetB;ECCurveFp.prototype.equals=curveFpEquals;ECCurveFp.prototype.getInfinity=curveFpGetInfinity;ECCurveFp.prototype.fromBigInteger=curveFpFromBigInteger;ECCurveFp.prototype.decodePointHex=curveFpDecodePointHex; -/*! (c) Stefan Thomas | https://github.com/bitcoinjs/bitcoinjs-lib - */ -ECFieldElementFp.prototype.getByteLength=function(){return Math.floor((this.toBigInteger().bitLength()+7)/8)};ECPointFp.prototype.getEncoded=function(c){var d=function(h,f){var g=h.toByteArrayUnsigned();if(fg.length){g.unshift(0)}}return g};var a=this.getX().toBigInteger();var e=this.getY().toBigInteger();var b=d(a,32);if(c){if(e.isEven()){b.unshift(2)}else{b.unshift(3)}}else{b.unshift(4);b=b.concat(d(e,32))}return b};ECPointFp.decodeFrom=function(g,c){var f=c[0];var e=c.length-1;var d=c.slice(1,1+e/2);var b=c.slice(1+e/2,1+e);d.unshift(0);b.unshift(0);var a=new BigInteger(d);var h=new BigInteger(b);return new ECPointFp(g,g.fromBigInteger(a),g.fromBigInteger(h))};ECPointFp.decodeFromHex=function(g,c){var f=c.substr(0,2);var e=c.length-2;var d=c.substr(2,e/2);var b=c.substr(2+e/2,e/2);var a=new BigInteger(d,16);var h=new BigInteger(b,16);return new ECPointFp(g,g.fromBigInteger(a),g.fromBigInteger(h))};ECPointFp.prototype.add2D=function(c){if(this.isInfinity()){return c}if(c.isInfinity()){return this}if(this.x.equals(c.x)){if(this.y.equals(c.y)){return this.twice()}return this.curve.getInfinity()}var g=c.x.subtract(this.x);var e=c.y.subtract(this.y);var a=e.divide(g);var d=a.square().subtract(this.x).subtract(c.x);var f=a.multiply(this.x.subtract(d)).subtract(this.y);return new ECPointFp(this.curve,d,f)};ECPointFp.prototype.twice2D=function(){if(this.isInfinity()){return this}if(this.y.toBigInteger().signum()==0){return this.curve.getInfinity()}var b=this.curve.fromBigInteger(BigInteger.valueOf(2));var e=this.curve.fromBigInteger(BigInteger.valueOf(3));var a=this.x.square().multiply(e).add(this.curve.a).divide(this.y.multiply(b));var c=a.square().subtract(this.x.multiply(b));var d=a.multiply(this.x.subtract(c)).subtract(this.y);return new ECPointFp(this.curve,c,d)};ECPointFp.prototype.multiply2D=function(b){if(this.isInfinity()){return this}if(b.signum()==0){return this.curve.getInfinity()}var g=b;var f=g.multiply(new BigInteger("3"));var l=this.negate();var d=this;var c;for(c=f.bitLength()-2;c>0;--c){d=d.twice();var a=f.testBit(c);var j=g.testBit(c);if(a!=j){d=d.add2D(a?this:l)}}return d};ECPointFp.prototype.isOnCurve=function(){var d=this.getX().toBigInteger();var i=this.getY().toBigInteger();var f=this.curve.getA().toBigInteger();var c=this.curve.getB().toBigInteger();var h=this.curve.getQ();var e=i.multiply(i).mod(h);var g=d.multiply(d).multiply(d).add(f.multiply(d)).add(c).mod(h);return e.equals(g)};ECPointFp.prototype.toString=function(){return"("+this.getX().toBigInteger().toString()+","+this.getY().toBigInteger().toString()+")"};ECPointFp.prototype.validate=function(){var c=this.curve.getQ();if(this.isInfinity()){throw new Error("Point is at infinity.")}var a=this.getX().toBigInteger();var b=this.getY().toBigInteger();if(a.compareTo(BigInteger.ONE)<0||a.compareTo(c.subtract(BigInteger.ONE))>0){throw new Error("x coordinate out of bounds")}if(b.compareTo(BigInteger.ONE)<0||b.compareTo(c.subtract(BigInteger.ONE))>0){throw new Error("y coordinate out of bounds")}if(!this.isOnCurve()){throw new Error("Point is not on the curve.")}if(this.multiply(c).isInfinity()){throw new Error("Point is not a scalar multiple of G.")}return true}; -/*! Mike Samuel (c) 2009 | code.google.com/p/json-sans-eval - */ -var jsonParse=(function(){var e="(?:-?\\b(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?(?:[eE][+-]?[0-9]+)?\\b)";var j='(?:[^\\0-\\x08\\x0a-\\x1f"\\\\]|\\\\(?:["/\\\\bfnrt]|u[0-9A-Fa-f]{4}))';var i='(?:"'+j+'*")';var d=new RegExp("(?:false|true|null|[\\{\\}\\[\\]]|"+e+"|"+i+")","g");var k=new RegExp("\\\\(?:([^u])|u(.{4}))","g");var g={'"':'"',"/":"/","\\":"\\",b:"\b",f:"\f",n:"\n",r:"\r",t:"\t"};function h(l,m,n){return m?g[m]:String.fromCharCode(parseInt(n,16))}var c=new String("");var a="\\";var f={"{":Object,"[":Array};var b=Object.hasOwnProperty;return function(u,q){var p=u.match(d);var x;var v=p[0];var l=false;if("{"===v){x={}}else{if("["===v){x=[]}else{x=[];l=true}}var t;var r=[x];for(var o=1-l,m=p.length;o=0;){delete D[n[A]]}}}return q.call(C,B,D)};x=s({"":x},"")}return x}})(); -if(typeof KJUR=="undefined"||!KJUR){KJUR={}}if(typeof KJUR.asn1=="undefined"||!KJUR.asn1){KJUR.asn1={}}KJUR.asn1.ASN1Util=new function(){this.integerToByteHex=function(a){var b=a.toString(16);if((b.length%2)==1){b="0"+b}return b};this.bigIntToMinTwosComplementsHex=function(j){var f=j.toString(16);if(f.substr(0,1)!="-"){if(f.length%2==1){f="0"+f}else{if(!f.match(/^[0-7]/)){f="00"+f}}}else{var a=f.substr(1);var e=a.length;if(e%2==1){e+=1}else{if(!f.match(/^[0-7]/)){e+=2}}var g="";for(var d=0;d15){throw"ASN.1 length too long to represent by 8x: n = "+i.toString(16)}var f=128+g;return f.toString(16)+h}};this.getEncodedHex=function(){if(this.hTLV==null||this.isModified){this.hV=this.getFreshValueHex();this.hL=this.getLengthHexFromValue();this.hTLV=this.hT+this.hL+this.hV;this.isModified=false}return this.hTLV};this.getValueHex=function(){this.getEncodedHex();return this.hV};this.getFreshValueHex=function(){return""}};KJUR.asn1.DERAbstractString=function(c){KJUR.asn1.DERAbstractString.superclass.constructor.call(this);var b=null;var a=null;this.getString=function(){return this.s};this.setString=function(d){this.hTLV=null;this.isModified=true;this.s=d;this.hV=stohex(this.s)};this.setStringHex=function(d){this.hTLV=null;this.isModified=true;this.s=null;this.hV=d};this.getFreshValueHex=function(){return this.hV};if(typeof c!="undefined"){if(typeof c=="string"){this.setString(c)}else{if(typeof c.str!="undefined"){this.setString(c.str)}else{if(typeof c.hex!="undefined"){this.setStringHex(c.hex)}}}}};YAHOO.lang.extend(KJUR.asn1.DERAbstractString,KJUR.asn1.ASN1Object);KJUR.asn1.DERAbstractTime=function(c){KJUR.asn1.DERAbstractTime.superclass.constructor.call(this);var b=null;var a=null;this.localDateToUTC=function(f){utc=f.getTime()+(f.getTimezoneOffset()*60000);var e=new Date(utc);return e};this.formatDate=function(m,o,e){var g=this.zeroPadding;var n=this.localDateToUTC(m);var p=String(n.getFullYear());if(o=="utc"){p=p.substr(2,2)}var l=g(String(n.getMonth()+1),2);var q=g(String(n.getDate()),2);var h=g(String(n.getHours()),2);var i=g(String(n.getMinutes()),2);var j=g(String(n.getSeconds()),2);var r=p+l+q+h+i+j;if(e===true){var f=n.getMilliseconds();if(f!=0){var k=g(String(f),3);k=k.replace(/[0]+$/,"");r=r+"."+k}}return r+"Z"};this.zeroPadding=function(e,d){if(e.length>=d){return e}return new Array(d-e.length+1).join("0")+e};this.getString=function(){return this.s};this.setString=function(d){this.hTLV=null;this.isModified=true;this.s=d;this.hV=stohex(d)};this.setByDateValue=function(h,j,e,d,f,g){var i=new Date(Date.UTC(h,j-1,e,d,f,g,0));this.setByDate(i)};this.getFreshValueHex=function(){return this.hV}};YAHOO.lang.extend(KJUR.asn1.DERAbstractTime,KJUR.asn1.ASN1Object);KJUR.asn1.DERAbstractStructured=function(b){KJUR.asn1.DERAbstractString.superclass.constructor.call(this);var a=null;this.setByASN1ObjectArray=function(c){this.hTLV=null;this.isModified=true;this.asn1Array=c};this.appendASN1Object=function(c){this.hTLV=null;this.isModified=true;this.asn1Array.push(c)};this.asn1Array=new Array();if(typeof b!="undefined"){if(typeof b.array!="undefined"){this.asn1Array=b.array}}};YAHOO.lang.extend(KJUR.asn1.DERAbstractStructured,KJUR.asn1.ASN1Object);KJUR.asn1.DERBoolean=function(){KJUR.asn1.DERBoolean.superclass.constructor.call(this);this.hT="01";this.hTLV="0101ff"};YAHOO.lang.extend(KJUR.asn1.DERBoolean,KJUR.asn1.ASN1Object);KJUR.asn1.DERInteger=function(a){KJUR.asn1.DERInteger.superclass.constructor.call(this);this.hT="02";this.setByBigInteger=function(b){this.hTLV=null;this.isModified=true;this.hV=KJUR.asn1.ASN1Util.bigIntToMinTwosComplementsHex(b)};this.setByInteger=function(c){var b=new BigInteger(String(c),10);this.setByBigInteger(b)};this.setValueHex=function(b){this.hV=b};this.getFreshValueHex=function(){return this.hV};if(typeof a!="undefined"){if(typeof a.bigint!="undefined"){this.setByBigInteger(a.bigint)}else{if(typeof a["int"]!="undefined"){this.setByInteger(a["int"])}else{if(typeof a=="number"){this.setByInteger(a)}else{if(typeof a.hex!="undefined"){this.setValueHex(a.hex)}}}}}};YAHOO.lang.extend(KJUR.asn1.DERInteger,KJUR.asn1.ASN1Object);KJUR.asn1.DERBitString=function(b){if(b!==undefined&&typeof b.obj!=="undefined"){var a=KJUR.asn1.ASN1Util.newObject(b.obj);b.hex="00"+a.getEncodedHex()}KJUR.asn1.DERBitString.superclass.constructor.call(this);this.hT="03";this.setHexValueIncludingUnusedBits=function(c){this.hTLV=null;this.isModified=true;this.hV=c};this.setUnusedBitsAndHexValue=function(c,e){if(c<0||7=(l*2))){break}if(d>=200){break}g.push(b);c=b;d++}return g};ASN1HEX.getNthChildIdx=function(d,b,e){var c=ASN1HEX.getChildIdx(d,b);return c[e]};ASN1HEX.getIdxbyList=function(e,d,c,i){var g=ASN1HEX;var f,b;if(c.length==0){if(i!==undefined){if(e.substr(d,2)!==i){throw"checking tag doesn't match: "+e.substr(d,2)+"!="+i}}return d}f=c.shift();b=g.getChildIdx(e,d);return g.getIdxbyList(e,b[f],c,i)};ASN1HEX.getTLVbyList=function(d,c,b,f){var e=ASN1HEX;var a=e.getIdxbyList(d,c,b);if(a===undefined){throw"can't find nthList object"}if(f!==undefined){if(d.substr(a,2)!=f){throw"checking tag doesn't match: "+d.substr(a,2)+"!="+f}}return e.getTLV(d,a)};ASN1HEX.getVbyList=function(e,c,b,g,i){var f=ASN1HEX;var a,d;a=f.getIdxbyList(e,c,b,g);if(a===undefined){throw"can't find nthList object"}d=f.getV(e,a);if(i===true){d=d.substr(2)}return d};ASN1HEX.hextooidstr=function(e){var h=function(b,a){if(b.length>=a){return b}return new Array(a-b.length+1).join("0")+b};var l=[];var o=e.substr(0,2);var f=parseInt(o,16);l[0]=new String(Math.floor(f/40));l[1]=new String(f%40);var m=e.substr(2);var k=[];for(var g=0;g0){n=n+"."+j.join(".")}return n};ASN1HEX.dump=function(t,c,l,g){var p=ASN1HEX;var j=p.getV;var y=p.dump;var w=p.getChildIdx;var e=t;if(t instanceof KJUR.asn1.ASN1Object){e=t.getEncodedHex()}var q=function(A,i){if(A.length<=i*2){return A}else{var v=A.substr(0,i)+"..(total "+A.length/2+"bytes).."+A.substr(A.length-i,i);return v}};if(c===undefined){c={ommit_long_octet:32}}if(l===undefined){l=0}if(g===undefined){g=""}var x=c.ommit_long_octet;if(e.substr(l,2)=="01"){var h=j(e,l);if(h=="00"){return g+"BOOLEAN FALSE\n"}else{return g+"BOOLEAN TRUE\n"}}if(e.substr(l,2)=="02"){var h=j(e,l);return g+"INTEGER "+q(h,x)+"\n"}if(e.substr(l,2)=="03"){var h=j(e,l);return g+"BITSTRING "+q(h,x)+"\n"}if(e.substr(l,2)=="04"){var h=j(e,l);if(p.isASN1HEX(h)){var k=g+"OCTETSTRING, encapsulates\n";k=k+y(h,c,0,g+" ");return k}else{return g+"OCTETSTRING "+q(h,x)+"\n"}}if(e.substr(l,2)=="05"){return g+"NULL\n"}if(e.substr(l,2)=="06"){var m=j(e,l);var a=KJUR.asn1.ASN1Util.oidHexToInt(m);var o=KJUR.asn1.x509.OID.oid2name(a);var b=a.replace(/\./g," ");if(o!=""){return g+"ObjectIdentifier "+o+" ("+b+")\n"}else{return g+"ObjectIdentifier ("+b+")\n"}}if(e.substr(l,2)=="0c"){return g+"UTF8String '"+hextoutf8(j(e,l))+"'\n"}if(e.substr(l,2)=="13"){return g+"PrintableString '"+hextoutf8(j(e,l))+"'\n"}if(e.substr(l,2)=="14"){return g+"TeletexString '"+hextoutf8(j(e,l))+"'\n"}if(e.substr(l,2)=="16"){return g+"IA5String '"+hextoutf8(j(e,l))+"'\n"}if(e.substr(l,2)=="17"){return g+"UTCTime "+hextoutf8(j(e,l))+"\n"}if(e.substr(l,2)=="18"){return g+"GeneralizedTime "+hextoutf8(j(e,l))+"\n"}if(e.substr(l,2)=="30"){if(e.substr(l,4)=="3000"){return g+"SEQUENCE {}\n"}var k=g+"SEQUENCE\n";var d=w(e,l);var f=c;if((d.length==2||d.length==3)&&e.substr(d[0],2)=="06"&&e.substr(d[d.length-1],2)=="04"){var o=p.oidname(j(e,d[0]));var r=JSON.parse(JSON.stringify(c));r.x509ExtName=o;f=r}for(var u=0;u0){var m=new f({array:this.extensionsArray});var k=new c({explicit:true,tag:"a3",obj:m});this.asn1Array.push(k)}var n=new f({array:this.asn1Array});this.hTLV=n.getEncodedHex();this.isModified=false;return this.hTLV};this._initialize()};YAHOO.lang.extend(KJUR.asn1.x509.TBSCertificate,KJUR.asn1.ASN1Object);KJUR.asn1.x509.Extension=function(d){KJUR.asn1.x509.Extension.superclass.constructor.call(this);var f=null,a=KJUR,e=a.asn1,h=e.DERObjectIdentifier,i=e.DEROctetString,b=e.DERBitString,g=e.DERBoolean,c=e.DERSequence;this.getEncodedHex=function(){var m=new h({oid:this.oid});var l=new i({hex:this.getExtnValueHex()});var k=new Array();k.push(m);if(this.critical){k.push(new g())}k.push(l);var j=new c({array:k});return j.getEncodedHex()};this.critical=false;if(typeof d!="undefined"){if(typeof d.critical!="undefined"){this.critical=d.critical}}};YAHOO.lang.extend(KJUR.asn1.x509.Extension,KJUR.asn1.ASN1Object);KJUR.asn1.x509.Extension.appendByNameToArray=function(e,c,b){var g=e.toLowerCase(),f=KJUR.asn1.x509;if(g=="basicconstraints"){var d=new f.BasicConstraints(c);b.push(d)}else{if(g=="keyusage"){var d=new f.KeyUsage(c);b.push(d)}else{if(g=="crldistributionpoints"){var d=new f.CRLDistributionPoints(c);b.push(d)}else{if(g=="extkeyusage"){var d=new f.ExtKeyUsage(c);b.push(d)}else{if(g=="authoritykeyidentifier"){var d=new f.AuthorityKeyIdentifier(c);b.push(d)}else{if(g=="authorityinfoaccess"){var d=new f.AuthorityInfoAccess(c);b.push(d)}else{if(g=="subjectaltname"){var d=new f.SubjectAltName(c);b.push(d)}else{if(g=="issueraltname"){var d=new f.IssuerAltName(c);b.push(d)}else{throw"unsupported extension name: "+e}}}}}}}}};KJUR.asn1.x509.KeyUsage=function(a){KJUR.asn1.x509.KeyUsage.superclass.constructor.call(this,a);this.getExtnValueHex=function(){return this.asn1ExtnValue.getEncodedHex()};this.oid="2.5.29.15";if(typeof a!="undefined"){if(typeof a.bin!="undefined"){this.asn1ExtnValue=new KJUR.asn1.DERBitString(a)}}};YAHOO.lang.extend(KJUR.asn1.x509.KeyUsage,KJUR.asn1.x509.Extension);KJUR.asn1.x509.BasicConstraints=function(c){KJUR.asn1.x509.BasicConstraints.superclass.constructor.call(this,c);var a=false;var b=-1;this.getExtnValueHex=function(){var e=new Array();if(this.cA){e.push(new KJUR.asn1.DERBoolean())}if(this.pathLen>-1){e.push(new KJUR.asn1.DERInteger({"int":this.pathLen}))}var d=new KJUR.asn1.DERSequence({array:e});this.asn1ExtnValue=d;return this.asn1ExtnValue.getEncodedHex()};this.oid="2.5.29.19";this.cA=false;this.pathLen=-1;if(typeof c!="undefined"){if(typeof c.cA!="undefined"){this.cA=c.cA}if(typeof c.pathLen!="undefined"){this.pathLen=c.pathLen}}};YAHOO.lang.extend(KJUR.asn1.x509.BasicConstraints,KJUR.asn1.x509.Extension);KJUR.asn1.x509.CRLDistributionPoints=function(d){KJUR.asn1.x509.CRLDistributionPoints.superclass.constructor.call(this,d);var b=KJUR,a=b.asn1,c=a.x509;this.getExtnValueHex=function(){return this.asn1ExtnValue.getEncodedHex()};this.setByDPArray=function(e){this.asn1ExtnValue=new a.DERSequence({array:e})};this.setByOneURI=function(h){var e=new c.GeneralNames([{uri:h}]);var g=new c.DistributionPointName(e);var f=new c.DistributionPoint({dpobj:g});this.setByDPArray([f])};this.oid="2.5.29.31";if(typeof d!="undefined"){if(typeof d.array!="undefined"){this.setByDPArray(d.array)}else{if(typeof d.uri!="undefined"){this.setByOneURI(d.uri)}}}};YAHOO.lang.extend(KJUR.asn1.x509.CRLDistributionPoints,KJUR.asn1.x509.Extension);KJUR.asn1.x509.ExtKeyUsage=function(c){KJUR.asn1.x509.ExtKeyUsage.superclass.constructor.call(this,c);var b=KJUR,a=b.asn1;this.setPurposeArray=function(d){this.asn1ExtnValue=new a.DERSequence();for(var e=0;e0){var h=new b({array:this.aRevokedCert});this.asn1Array.push(h)}var i=new b({array:this.asn1Array});this.hTLV=i.getEncodedHex();this.isModified=false;return this.hTLV};this._initialize=function(){this.asn1Version=null;this.asn1SignatureAlg=null;this.asn1Issuer=null;this.asn1ThisUpdate=null;this.asn1NextUpdate=null;this.aRevokedCert=new Array()};this._initialize()};YAHOO.lang.extend(KJUR.asn1.x509.TBSCertList,KJUR.asn1.ASN1Object);KJUR.asn1.x509.CRLEntry=function(e){KJUR.asn1.x509.CRLEntry.superclass.constructor.call(this);var d=null,c=null,b=KJUR,a=b.asn1;this.setCertSerial=function(f){this.sn=new a.DERInteger(f)};this.setRevocationDate=function(f){this.time=new a.x509.Time(f)};this.getEncodedHex=function(){var f=new a.DERSequence({array:[this.sn,this.time]});this.TLV=f.getEncodedHex();return this.TLV};if(e!==undefined){if(e.time!==undefined){this.setRevocationDate(e.time)}if(e.sn!==undefined){this.setCertSerial(e.sn)}}};YAHOO.lang.extend(KJUR.asn1.x509.CRLEntry,KJUR.asn1.ASN1Object);KJUR.asn1.x509.X500Name=function(f){KJUR.asn1.x509.X500Name.superclass.constructor.call(this);this.asn1Array=new Array();var d=KJUR,c=d.asn1,e=c.x509,b=pemtohex;this.setByString=function(g){var h=g.split("/");h.shift();for(var j=0;j0;f++){var h=c.shift();if(e===true){var d=b.pop();var j=(d+","+h).replace(/\\,/g,",");b.push(j);e=false}else{b.push(h)}if(h.substr(-1,1)==="\\"){e=true}}b=b.map(function(a){return a.replace("/","\\/")});b.reverse();return"/"+b.join("/")};KJUR.asn1.x509.RDN=function(a){KJUR.asn1.x509.RDN.superclass.constructor.call(this);this.asn1Array=new Array();this.addByString=function(b){this.asn1Array.push(new KJUR.asn1.x509.AttributeTypeAndValue({str:b}))};this.addByMultiValuedString=function(d){var b=KJUR.asn1.x509.RDN.parseString(d);for(var c=0;c0;g++){var k=j.shift();if(h===true){var f=c.pop();var d=(f+"+"+k).replace(/\\\+/g,"+");c.push(d);h=false}else{c.push(k)}if(k.substr(-1,1)==="\\"){h=true}}var l=false;var b=[];for(var g=0;c.length>0;g++){var k=c.shift();if(l===true){var e=b.pop();if(k.match(/"$/)){var d=(e+"+"+k).replace(/^([^=]+)="(.*)"$/,"$1=$2");b.push(d);l=false}else{b.push(e+"+"+k)}}else{b.push(k)}if(k.match(/^[^=]+="/)){l=true}}return b};KJUR.asn1.x509.AttributeTypeAndValue=function(d){KJUR.asn1.x509.AttributeTypeAndValue.superclass.constructor.call(this);var f=null,e=null,a="utf8",c=KJUR,b=c.asn1;this.setByString=function(h){var g=h.match(/^([^=]+)=(.+)$/);if(g){this.setByAttrTypeAndValueStr(g[1],g[2])}else{throw"malformed attrTypeAndValueStr: "+h}};this.setByAttrTypeAndValueStr=function(i,h){this.typeObj=KJUR.asn1.x509.OID.atype2obj(i);var g=a;if(i=="C"){g="prn"}this.valueObj=this.getValueObj(g,h)};this.getValueObj=function(h,g){if(h=="utf8"){return new b.DERUTF8String({str:g})}if(h=="prn"){return new b.DERPrintableString({str:g})}if(h=="tel"){return new b.DERTeletexString({str:g})}if(h=="ia5"){return new b.DERIA5String({str:g})}throw"unsupported directory string type: type="+h+" value="+g};this.getEncodedHex=function(){var g=new b.DERSequence({array:[this.typeObj,this.valueObj]});this.TLV=g.getEncodedHex();return this.TLV};if(typeof d!="undefined"){if(typeof d.str!="undefined"){this.setByString(d.str)}}};YAHOO.lang.extend(KJUR.asn1.x509.AttributeTypeAndValue,KJUR.asn1.ASN1Object);KJUR.asn1.x509.SubjectPublicKeyInfo=function(f){KJUR.asn1.x509.SubjectPublicKeyInfo.superclass.constructor.call(this);var l=null,k=null,a=KJUR,j=a.asn1,i=j.DERInteger,b=j.DERBitString,m=j.DERObjectIdentifier,e=j.DERSequence,h=j.ASN1Util.newObject,d=j.x509,o=d.AlgorithmIdentifier,g=a.crypto,n=g.ECDSA,c=g.DSA;this.getASN1Object=function(){if(this.asn1AlgId==null||this.asn1SubjPKey==null){throw"algId and/or subjPubKey not set"}var p=new e({array:[this.asn1AlgId,this.asn1SubjPKey]});return p};this.getEncodedHex=function(){var p=this.getASN1Object();this.hTLV=p.getEncodedHex();return this.hTLV};this.setPubKey=function(q){try{if(q instanceof RSAKey){var u=h({seq:[{"int":{bigint:q.n}},{"int":{"int":q.e}}]});var s=u.getEncodedHex();this.asn1AlgId=new o({name:"rsaEncryption"});this.asn1SubjPKey=new b({hex:"00"+s})}}catch(p){}try{if(q instanceof KJUR.crypto.ECDSA){var r=new m({name:q.curveName});this.asn1AlgId=new o({name:"ecPublicKey",asn1params:r});this.asn1SubjPKey=new b({hex:"00"+q.pubKeyHex})}}catch(p){}try{if(q instanceof KJUR.crypto.DSA){var r=new h({seq:[{"int":{bigint:q.p}},{"int":{bigint:q.q}},{"int":{bigint:q.g}}]});this.asn1AlgId=new o({name:"dsa",asn1params:r});var t=new i({bigint:q.y});this.asn1SubjPKey=new b({hex:"00"+t.getEncodedHex()})}}catch(p){}};if(f!==undefined){this.setPubKey(f)}};YAHOO.lang.extend(KJUR.asn1.x509.SubjectPublicKeyInfo,KJUR.asn1.ASN1Object);KJUR.asn1.x509.Time=function(f){KJUR.asn1.x509.Time.superclass.constructor.call(this);var e=null,a=null,d=KJUR,c=d.asn1,b=c.DERUTCTime,g=c.DERGeneralizedTime;this.setTimeParams=function(h){this.timeParams=h};this.getEncodedHex=function(){var h=null;if(this.timeParams!=null){if(this.type=="utc"){h=new b(this.timeParams)}else{h=new g(this.timeParams)}}else{if(this.type=="utc"){h=new b()}else{h=new g()}}this.TLV=h.getEncodedHex();return this.TLV};this.type="utc";if(f!==undefined){if(f.type!==undefined){this.type=f.type}else{if(f.str!==undefined){if(f.str.match(/^[0-9]{12}Z$/)){this.type="utc"}if(f.str.match(/^[0-9]{14}Z$/)){this.type="gen"}}}this.timeParams=f}};YAHOO.lang.extend(KJUR.asn1.x509.Time,KJUR.asn1.ASN1Object);KJUR.asn1.x509.AlgorithmIdentifier=function(d){KJUR.asn1.x509.AlgorithmIdentifier.superclass.constructor.call(this);this.nameAlg=null;this.asn1Alg=null;this.asn1Params=null;this.paramEmpty=false;var b=KJUR,a=b.asn1;this.getEncodedHex=function(){if(this.nameAlg===null&&this.asn1Alg===null){throw"algorithm not specified"}if(this.nameAlg!==null&&this.asn1Alg===null){this.asn1Alg=a.x509.OID.name2obj(this.nameAlg)}var e=[this.asn1Alg];if(this.asn1Params!==null){e.push(this.asn1Params)}var f=new a.DERSequence({array:e});this.hTLV=f.getEncodedHex();return this.hTLV};if(d!==undefined){if(d.name!==undefined){this.nameAlg=d.name}if(d.asn1params!==undefined){this.asn1Params=d.asn1params}if(d.paramempty!==undefined){this.paramEmpty=d.paramempty}}if(this.asn1Params===null&&this.paramEmpty===false&&this.nameAlg!==null){var c=this.nameAlg.toLowerCase();if(c.substr(-7,7)!=="withdsa"&&c.substr(-9,9)!=="withecdsa"){this.asn1Params=new a.DERNull()}}};YAHOO.lang.extend(KJUR.asn1.x509.AlgorithmIdentifier,KJUR.asn1.ASN1Object);KJUR.asn1.x509.GeneralName=function(e){KJUR.asn1.x509.GeneralName.superclass.constructor.call(this);var k=null,h=null,i={rfc822:"81",dns:"82",dn:"a4",uri:"86"},b=KJUR,f=b.asn1,d=f.DERIA5String,c=f.DERTaggedObject,j=f.ASN1Object,a=f.x509.X500Name,g=pemtohex;this.explicit=false;this.setByParam=function(r){var q=null;var n=null;if(r===undefined){return}if(r.rfc822!==undefined){this.type="rfc822";n=new d({str:r[this.type]})}if(r.dns!==undefined){this.type="dns";n=new d({str:r[this.type]})}if(r.uri!==undefined){this.type="uri";n=new d({str:r[this.type]})}if(r.dn!==undefined){this.type="dn";n=new a({str:r.dn})}if(r.ldapdn!==undefined){this.type="dn";n=new a({ldapstr:r.ldapdn})}if(r.certissuer!==undefined){this.type="dn";this.explicit=true;var o=r.certissuer;var m=null;if(o.match(/^[0-9A-Fa-f]+$/)){m==o}if(o.indexOf("-----BEGIN ")!=-1){m=g(o)}if(m==null){throw"certissuer param not cert"}var l=new X509();l.hex=m;var p=l.getIssuerHex();n=new j();n.hTLV=p}if(r.certsubj!==undefined){this.type="dn";this.explicit=true;var o=r.certsubj;var m=null;if(o.match(/^[0-9A-Fa-f]+$/)){m==o}if(o.indexOf("-----BEGIN ")!=-1){m=g(o)}if(m==null){throw"certsubj param not cert"}var l=new X509();l.hex=m;var p=l.getSubjectHex();n=new j();n.hTLV=p}if(this.type==null){throw"unsupported type in params="+r}this.asn1Obj=new c({explicit:this.explicit,tag:i[this.type],obj:n})};this.getEncodedHex=function(){return this.asn1Obj.getEncodedHex()};if(e!==undefined){this.setByParam(e)}};YAHOO.lang.extend(KJUR.asn1.x509.GeneralName,KJUR.asn1.ASN1Object);KJUR.asn1.x509.GeneralNames=function(d){KJUR.asn1.x509.GeneralNames.superclass.constructor.call(this);var a=null,c=KJUR,b=c.asn1;this.setByParamArray=function(g){for(var e=0;e0){r=new b({obj:this.dUnsignedAttrs,tag:"a1",explicit:false})}var q=[this.dCMSVersion,this.dSignerIdentifier,this.dDigestAlgorithm,o,this.dSigAlg,this.dSig,];if(r!=null){q.push(r)}var p=new h.DERSequence({array:q});this.hTLV=p.getEncodedHex();return this.hTLV}};YAHOO.lang.extend(KJUR.asn1.cms.SignerInfo,KJUR.asn1.ASN1Object);KJUR.asn1.cms.EncapsulatedContentInfo=function(g){var c=KJUR,b=c.asn1,e=b.DERTaggedObject,a=b.DERSequence,h=b.DERObjectIdentifier,d=b.DEROctetString,f=b.cms;f.EncapsulatedContentInfo.superclass.constructor.call(this);this.dEContentType=new h({name:"data"});this.dEContent=null;this.isDetached=false;this.eContentValueHex=null;this.setContentType=function(i){if(i.match(/^[0-2][.][0-9.]+$/)){this.dEContentType=new h({oid:i})}else{this.dEContentType=new h({name:i})}};this.setContentValue=function(i){if(i!==undefined){if(typeof i.hex=="string"){this.eContentValueHex=i.hex}else{if(typeof i.str=="string"){this.eContentValueHex=utf8tohex(i.str)}}}};this.setContentValueHex=function(i){this.eContentValueHex=i};this.setContentValueStr=function(i){this.eContentValueHex=utf8tohex(i)};this.getEncodedHex=function(){if(typeof this.eContentValueHex!="string"){throw"eContentValue not yet set"}var k=new d({hex:this.eContentValueHex});this.dEContent=new e({obj:k,tag:"a0",explicit:true});var i=[this.dEContentType];if(!this.isDetached){i.push(this.dEContent)}var j=new a({array:i});this.hTLV=j.getEncodedHex();return this.hTLV}};YAHOO.lang.extend(KJUR.asn1.cms.EncapsulatedContentInfo,KJUR.asn1.ASN1Object);KJUR.asn1.cms.ContentInfo=function(f){var c=KJUR,b=c.asn1,d=b.DERTaggedObject,a=b.DERSequence,e=b.x509;KJUR.asn1.cms.ContentInfo.superclass.constructor.call(this);this.dContentType=null;this.dContent=null;this.setContentType=function(g){if(typeof g=="string"){this.dContentType=e.OID.name2obj(g)}};this.getEncodedHex=function(){var h=new d({obj:this.dContent,tag:"a0",explicit:true});var g=new a({array:[this.dContentType,h]});this.hTLV=g.getEncodedHex();return this.hTLV};if(f!==undefined){if(f.type){this.setContentType(f.type)}if(f.obj&&f.obj instanceof b.ASN1Object){this.dContent=f.obj}}};YAHOO.lang.extend(KJUR.asn1.cms.ContentInfo,KJUR.asn1.ASN1Object);KJUR.asn1.cms.SignedData=function(e){var a=KJUR,h=a.asn1,j=h.ASN1Object,g=h.DERInteger,m=h.DERSet,f=h.DERSequence,b=h.DERTaggedObject,l=h.cms,i=l.EncapsulatedContentInfo,d=l.SignerInfo,n=l.ContentInfo,c=h.x509,k=c.AlgorithmIdentifier;KJUR.asn1.cms.SignedData.superclass.constructor.call(this);this.dCMSVersion=new g({"int":1});this.dDigestAlgs=null;this.digestAlgNameList=[];this.dEncapContentInfo=new i();this.dCerts=null;this.certificateList=[];this.crlList=[];this.signerInfoList=[new d()];this.addCertificatesByPEM=function(p){var q=pemtohex(p);var r=new j();r.hTLV=q;this.certificateList.push(r)};this.getEncodedHex=function(){if(typeof this.hTLV=="string"){return this.hTLV}if(this.dDigestAlgs==null){var u=[];for(var t=0;t0){var v=new m({array:this.certificateList});this.dCerts=new b({obj:v,tag:"a0",explicit:false})}}if(this.dCerts!=null){p.push(this.dCerts)}var r=new m({array:this.signerInfoList});p.push(r);var q=new f({array:p});this.hTLV=q.getEncodedHex();return this.hTLV};this.getContentInfo=function(){this.getEncodedHex();var o=new n({type:"signed-data",obj:this});return o};this.getContentInfoEncodedHex=function(){var o=this.getContentInfo();var p=o.getEncodedHex();return p};this.getPEM=function(){return hextopem(this.getContentInfoEncodedHex(),"CMS")}};YAHOO.lang.extend(KJUR.asn1.cms.SignedData,KJUR.asn1.ASN1Object);KJUR.asn1.cms.CMSUtil=new function(){};KJUR.asn1.cms.CMSUtil.newSignedData=function(d){var b=KJUR,j=b.asn1,q=j.cms,f=q.SignerInfo,n=q.SignedData,o=q.SigningTime,a=q.SigningCertificate,p=q.SigningCertificateV2,c=j.cades,e=c.SignaturePolicyIdentifier;var m=new n();m.dEncapContentInfo.setContentValue(d.content);if(typeof d.certs=="object"){for(var h=0;h0){var s=new f({array:this.extensionsArray});var r=new m({array:[s]});var q=new f({array:[new k({oid:"1.2.840.113549.1.9.14"}),r]});var p=new c({explicit:true,tag:"a0",obj:q});this.asn1Array.push(p)}else{var p=new c({explicit:false,tag:"a0",obj:new j()});this.asn1Array.push(p)}var t=new f({array:this.asn1Array});this.hTLV=t.getEncodedHex();this.isModified=false;return this.hTLV};this._initialize()};YAHOO.lang.extend(KJUR.asn1.csr.CertificationRequestInfo,KJUR.asn1.ASN1Object);KJUR.asn1.csr.CSRUtil=new function(){};KJUR.asn1.csr.CSRUtil.newCSRPEM=function(h){var c=KEYUTIL,b=KJUR.asn1.csr;if(h.subject===undefined){throw"parameter subject undefined"}if(h.sbjpubkey===undefined){throw"parameter sbjpubkey undefined"}if(h.sigalg===undefined){throw"parameter sigalg undefined"}if(h.sbjprvkey===undefined){throw"parameter sbjpubkey undefined"}var d=new b.CertificationRequestInfo();d.setSubjectByParam(h.subject);d.setSubjectPublicKeyByGetKey(h.sbjpubkey);if(h.ext!==undefined&&h.ext.length!==undefined){for(var e=0;e"7"){return"00"+a}return a}function intarystrtohex(b){b=b.replace(/^\s*\[\s*/,"");b=b.replace(/\s*\]\s*$/,"");b=b.replace(/\s*/g,"");try{var c=b.split(/,/).map(function(g,e,h){var f=parseInt(g);if(f<0||255a.length){d=a.length}for(var b=0;bd){throw"key is too short for SigAlg: keylen="+j+","+a}var b="0001";var k="00"+c;var g="";var l=d-b.length-k.length;for(var f=0;f=0;--p){q=q.twice2D();q.z=BigInteger.ONE;if(o.testBit(p)){if(n.testBit(p)){q=q.add2D(t)}else{q=q.add2D(s)}}else{if(n.testBit(p)){q=q.add2D(r)}}}return q}this.getBigRandom=function(i){return new BigInteger(i.bitLength(),a).mod(i.subtract(BigInteger.ONE)).add(BigInteger.ONE)};this.setNamedCurve=function(i){this.ecparams=KJUR.crypto.ECParameterDB.getByName(i);this.prvKeyHex=null;this.pubKeyHex=null;this.curveName=i};this.setPrivateKeyHex=function(i){this.isPrivate=true;this.prvKeyHex=i};this.setPublicKeyHex=function(i){this.isPublic=true;this.pubKeyHex=i};this.getPublicKeyXYHex=function(){var k=this.pubKeyHex;if(k.substr(0,2)!=="04"){throw"this method supports uncompressed format(04) only"}var j=this.ecparams.keylen/4;if(k.length!==2+j*2){throw"malformed public key hex length"}var i={};i.x=k.substr(2,j);i.y=k.substr(2+j);return i};this.getShortNISTPCurveName=function(){var i=this.curveName;if(i==="secp256r1"||i==="NIST P-256"||i==="P-256"||i==="prime256v1"){return"P-256"}if(i==="secp384r1"||i==="NIST P-384"||i==="P-384"){return"P-384"}return null};this.generateKeyPairHex=function(){var k=this.ecparams.n;var n=this.getBigRandom(k);var l=this.ecparams.G.multiply(n);var q=l.getX().toBigInteger();var o=l.getY().toBigInteger();var i=this.ecparams.keylen/4;var m=("0000000000"+n.toString(16)).slice(-i);var r=("0000000000"+q.toString(16)).slice(-i);var p=("0000000000"+o.toString(16)).slice(-i);var j="04"+r+p;this.setPrivateKeyHex(m);this.setPublicKeyHex(j);return{ecprvhex:m,ecpubhex:j}};this.signWithMessageHash=function(i){return this.signHex(i,this.prvKeyHex)};this.signHex=function(o,j){var t=new BigInteger(j,16);var l=this.ecparams.n;var q=new BigInteger(o,16);do{var m=this.getBigRandom(l);var u=this.ecparams.G;var p=u.multiply(m);var i=p.getX().toBigInteger().mod(l)}while(i.compareTo(BigInteger.ZERO)<=0);var v=m.modInverse(l).multiply(q.add(t.multiply(i))).mod(l);return KJUR.crypto.ECDSA.biRSSigToASN1Sig(i,v)};this.sign=function(m,u){var q=u;var j=this.ecparams.n;var p=BigInteger.fromByteArrayUnsigned(m);do{var l=this.getBigRandom(j);var t=this.ecparams.G;var o=t.multiply(l);var i=o.getX().toBigInteger().mod(j)}while(i.compareTo(BigInteger.ZERO)<=0);var v=l.modInverse(j).multiply(p.add(q.multiply(i))).mod(j);return this.serializeSig(i,v)};this.verifyWithMessageHash=function(j,i){return this.verifyHex(j,i,this.pubKeyHex)};this.verifyHex=function(m,i,p){var l,j;var o=KJUR.crypto.ECDSA.parseSigHex(i);l=o.r;j=o.s;var k;k=ECPointFp.decodeFromHex(this.ecparams.curve,p);var n=new BigInteger(m,16);return this.verifyRaw(n,l,j,k)};this.verify=function(o,p,j){var l,i;if(Bitcoin.Util.isArray(p)){var n=this.parseSig(p);l=n.r;i=n.s}else{if("object"===typeof p&&p.r&&p.s){l=p.r;i=p.s}else{throw"Invalid value for signature"}}var k;if(j instanceof ECPointFp){k=j}else{if(Bitcoin.Util.isArray(j)){k=ECPointFp.decodeFrom(this.ecparams.curve,j)}else{throw"Invalid format for pubkey value, must be byte array or ECPointFp"}}var m=BigInteger.fromByteArrayUnsigned(o);return this.verifyRaw(m,l,i,k)};this.verifyRaw=function(o,i,w,m){var l=this.ecparams.n;var u=this.ecparams.G;if(i.compareTo(BigInteger.ONE)<0||i.compareTo(l)>=0){return false}if(w.compareTo(BigInteger.ONE)<0||w.compareTo(l)>=0){return false}var p=w.modInverse(l);var k=o.multiply(p).mod(l);var j=i.multiply(p).mod(l);var q=u.multiply(k).add(m.multiply(j));var t=q.getX().toBigInteger().mod(l);return t.equals(i)};this.serializeSig=function(k,j){var l=k.toByteArraySigned();var i=j.toByteArraySigned();var m=[];m.push(2);m.push(l.length);m=m.concat(l);m.push(2);m.push(i.length);m=m.concat(i);m.unshift(m.length);m.unshift(48);return m};this.parseSig=function(n){var m;if(n[0]!=48){throw new Error("Signature not a valid DERSequence")}m=2;if(n[m]!=2){throw new Error("First element in signature must be a DERInteger")}var l=n.slice(m+2,m+2+n[m+1]);m+=2+n[m+1];if(n[m]!=2){throw new Error("Second element in signature must be a DERInteger")}var i=n.slice(m+2,m+2+n[m+1]);m+=2+n[m+1];var k=BigInteger.fromByteArrayUnsigned(l);var j=BigInteger.fromByteArrayUnsigned(i);return{r:k,s:j}};this.parseSigCompact=function(m){if(m.length!==65){throw"Signature has the wrong length"}var j=m[0]-27;if(j<0||j>7){throw"Invalid signature type"}var o=this.ecparams.n;var l=BigInteger.fromByteArrayUnsigned(m.slice(1,33)).mod(o);var k=BigInteger.fromByteArrayUnsigned(m.slice(33,65)).mod(o);return{r:l,s:k,i:j}};this.readPKCS5PrvKeyHex=function(l){var n=ASN1HEX;var m=KJUR.crypto.ECDSA.getName;var p=n.getVbyList;if(n.isASN1HEX(l)===false){throw"not ASN.1 hex string"}var i,k,o;try{i=p(l,0,[2,0],"06");k=p(l,0,[1],"04");try{o=p(l,0,[3,0],"03").substr(2)}catch(j){}}catch(j){throw"malformed PKCS#1/5 plain ECC private key"}this.curveName=m(i);if(this.curveName===undefined){throw"unsupported curve name"}this.setNamedCurve(this.curveName);this.setPublicKeyHex(o);this.setPrivateKeyHex(k);this.isPublic=false};this.readPKCS8PrvKeyHex=function(l){var q=ASN1HEX;var i=KJUR.crypto.ECDSA.getName;var n=q.getVbyList;if(q.isASN1HEX(l)===false){throw"not ASN.1 hex string"}var j,p,m,k;try{j=n(l,0,[1,0],"06");p=n(l,0,[1,1],"06");m=n(l,0,[2,0,1],"04");try{k=n(l,0,[2,0,2,0],"03").substr(2)}catch(o){}}catch(o){throw"malformed PKCS#8 plain ECC private key"}this.curveName=i(p);if(this.curveName===undefined){throw"unsupported curve name"}this.setNamedCurve(this.curveName);this.setPublicKeyHex(k);this.setPrivateKeyHex(m);this.isPublic=false};this.readPKCS8PubKeyHex=function(l){var n=ASN1HEX;var m=KJUR.crypto.ECDSA.getName;var p=n.getVbyList;if(n.isASN1HEX(l)===false){throw"not ASN.1 hex string"}var k,i,o;try{k=p(l,0,[0,0],"06");i=p(l,0,[0,1],"06");o=p(l,0,[1],"03").substr(2)}catch(j){throw"malformed PKCS#8 ECC public key"}this.curveName=m(i);if(this.curveName===null){throw"unsupported curve name"}this.setNamedCurve(this.curveName);this.setPublicKeyHex(o)};this.readCertPubKeyHex=function(k,p){if(p!==5){p=6}var m=ASN1HEX;var l=KJUR.crypto.ECDSA.getName;var o=m.getVbyList;if(m.isASN1HEX(k)===false){throw"not ASN.1 hex string"}var i,n;try{i=o(k,0,[0,p,0,1],"06");n=o(k,0,[0,p,1],"03").substr(2)}catch(j){throw"malformed X.509 certificate ECC public key"}this.curveName=l(i);if(this.curveName===null){throw"unsupported curve name"}this.setNamedCurve(this.curveName);this.setPublicKeyHex(n)};if(h!==undefined){if(h.curve!==undefined){this.curveName=h.curve}}if(this.curveName===undefined){this.curveName=e}this.setNamedCurve(this.curveName);if(h!==undefined){if(h.prv!==undefined){this.setPrivateKeyHex(h.prv)}if(h.pub!==undefined){this.setPublicKeyHex(h.pub)}}};KJUR.crypto.ECDSA.parseSigHex=function(a){var b=KJUR.crypto.ECDSA.parseSigHexInHexRS(a);var d=new BigInteger(b.r,16);var c=new BigInteger(b.s,16);return{r:d,s:c}};KJUR.crypto.ECDSA.parseSigHexInHexRS=function(f){var j=ASN1HEX;var i=j.getChildIdx;var g=j.getV;if(f.substr(0,2)!="30"){throw"signature is not a ASN.1 sequence"}var h=i(f,0);if(h.length!=2){throw"number of signature ASN.1 sequence elements seem wrong"}var e=h[0];var d=h[1];if(f.substr(e,2)!="02"){throw"1st item of sequene of signature is not ASN.1 integer"}if(f.substr(d,2)!="02"){throw"2nd item of sequene of signature is not ASN.1 integer"}var c=g(f,e);var b=g(f,d);return{r:c,s:b}};KJUR.crypto.ECDSA.asn1SigToConcatSig=function(c){var d=KJUR.crypto.ECDSA.parseSigHexInHexRS(c);var b=d.r;var a=d.s;if(b.substr(0,2)=="00"&&(((b.length/2)*8)%(16*8))==8){b=b.substr(2)}if(a.substr(0,2)=="00"&&(((a.length/2)*8)%(16*8))==8){a=a.substr(2)}if((((b.length/2)*8)%(16*8))!=0){throw"unknown ECDSA sig r length error"}if((((a.length/2)*8)%(16*8))!=0){throw"unknown ECDSA sig s length error"}return b+a};KJUR.crypto.ECDSA.concatSigToASN1Sig=function(a){if((((a.length/2)*8)%(16*8))!=0){throw"unknown ECDSA concatinated r-s sig length error"}var c=a.substr(0,a.length/2);var b=a.substr(a.length/2);return KJUR.crypto.ECDSA.hexRSSigToASN1Sig(c,b)};KJUR.crypto.ECDSA.hexRSSigToASN1Sig=function(b,a){var d=new BigInteger(b,16);var c=new BigInteger(a,16);return KJUR.crypto.ECDSA.biRSSigToASN1Sig(d,c)};KJUR.crypto.ECDSA.biRSSigToASN1Sig=function(f,d){var c=KJUR.asn1;var b=new c.DERInteger({bigint:f});var a=new c.DERInteger({bigint:d});var e=new c.DERSequence({array:[b,a]});return e.getEncodedHex()};KJUR.crypto.ECDSA.getName=function(a){if(a==="2a8648ce3d030107"){return"secp256r1"}if(a==="2b8104000a"){return"secp256k1"}if(a==="2b81040022"){return"secp384r1"}if("|secp256r1|NIST P-256|P-256|prime256v1|".indexOf(a)!==-1){return"secp256r1"}if("|secp256k1|".indexOf(a)!==-1){return"secp256k1"}if("|secp384r1|NIST P-384|P-384|".indexOf(a)!==-1){return"secp384r1"}return null}; -if(typeof KJUR=="undefined"||!KJUR){KJUR={}}if(typeof KJUR.crypto=="undefined"||!KJUR.crypto){KJUR.crypto={}}KJUR.crypto.ECParameterDB=new function(){var b={};var c={};function a(d){return new BigInteger(d,16)}this.getByName=function(e){var d=e;if(typeof c[d]!="undefined"){d=c[e]}if(typeof b[d]!="undefined"){return b[d]}throw"unregistered EC curve name: "+d};this.regist=function(A,l,o,g,m,e,j,f,k,u,d,x){b[A]={};var s=a(o);var z=a(g);var y=a(m);var t=a(e);var w=a(j);var r=new ECCurveFp(s,z,y);var q=r.decodePointHex("04"+f+k);b[A]["name"]=A;b[A]["keylen"]=l;b[A]["curve"]=r;b[A]["G"]=q;b[A]["n"]=t;b[A]["h"]=w;b[A]["oid"]=d;b[A]["info"]=x;for(var v=0;v1){g=new BigInteger(i,16)}else{g=null}h=new BigInteger(j,16);this.setPrivate(c,a,e,g,h)};this.setPublic=function(c,b,a,d){this.isPublic=true;this.p=c;this.q=b;this.g=a;this.y=d;this.x=null};this.setPublicHex=function(f,e,d,g){var b,a,h,c;b=new BigInteger(f,16);a=new BigInteger(e,16);h=new BigInteger(d,16);c=new BigInteger(g,16);this.setPublic(b,a,h,c)};this.signWithMessageHash=function(d){var c=this.p;var b=this.q;var f=this.g;var i=this.y;var j=this.x;var e=KJUR.crypto.Util.getRandomBigIntegerMinToMax(BigInteger.ONE.add(BigInteger.ONE),b.subtract(BigInteger.ONE));var l=d.substr(0,b.bitLength()/4);var h=new BigInteger(l,16);var a=(f.modPow(e,c)).mod(b);var n=(e.modInverse(b).multiply(h.add(j.multiply(a)))).mod(b);var m=KJUR.asn1.ASN1Util.jsonToASN1HEX({seq:[{"int":{bigint:a}},{"int":{bigint:n}}]});return m};this.verifyWithMessageHash=function(h,f){var d=this.p;var b=this.q;var j=this.g;var l=this.y;var i=this.parseASN1Signature(f);var a=i[0];var t=i[1];var o=h.substr(0,b.bitLength()/4);var k=new BigInteger(o,16);if(BigInteger.ZERO.compareTo(a)>0||a.compareTo(b)>0){throw"invalid DSA signature"}if(BigInteger.ZERO.compareTo(t)>=0||t.compareTo(b)>0){throw"invalid DSA signature"}var m=t.modInverse(b);var e=k.multiply(m).mod(b);var c=a.multiply(m).mod(b);var n=j.modPow(e,d).multiply(l.modPow(c,d)).mod(d).mod(b);return n.compareTo(a)==0};this.parseASN1Signature=function(a){try{var d=new BigInteger(ASN1HEX.getVbyList(a,0,[0],"02"),16);var c=new BigInteger(ASN1HEX.getVbyList(a,0,[1],"02"),16);return[d,c]}catch(b){throw"malformed ASN.1 DSA signature"}};this.readPKCS5PrvKeyHex=function(c){var b,a,f,g,i;var j=ASN1HEX;var d=j.getVbyList;if(j.isASN1HEX(c)===false){throw"not ASN.1 hex string"}try{b=d(c,0,[1],"02");a=d(c,0,[2],"02");f=d(c,0,[3],"02");g=d(c,0,[4],"02");i=d(c,0,[5],"02")}catch(e){console.log("EXCEPTION:"+e);throw"malformed PKCS#1/5 plain DSA private key"}this.setPrivateHex(b,a,f,g,i)};this.readPKCS8PrvKeyHex=function(d){var f,c,b,g;var e=ASN1HEX;var i=e.getVbyList;if(e.isASN1HEX(d)===false){throw"not ASN.1 hex string"}try{f=i(d,0,[1,1,0],"02");c=i(d,0,[1,1,1],"02");b=i(d,0,[1,1,2],"02");g=i(d,0,[2,0],"02")}catch(a){console.log("EXCEPTION:"+a);throw"malformed PKCS#8 plain DSA private key"}this.setPrivateHex(f,c,b,null,g)};this.readPKCS8PubKeyHex=function(d){var f,c,b,g;var e=ASN1HEX;var i=e.getVbyList;if(e.isASN1HEX(d)===false){throw"not ASN.1 hex string"}try{f=i(d,0,[0,1,0],"02");c=i(d,0,[0,1,1],"02");b=i(d,0,[0,1,2],"02");g=i(d,0,[1,0],"02")}catch(a){console.log("EXCEPTION:"+a);throw"malformed PKCS#8 DSA public key"}this.setPublicHex(f,c,b,g)};this.readCertPubKeyHex=function(c,f){if(f!==5){f=6}var b,a,g,i;var j=ASN1HEX;var d=j.getVbyList;if(j.isASN1HEX(c)===false){throw"not ASN.1 hex string"}try{b=d(c,0,[0,f,0,1,0],"02");a=d(c,0,[0,f,0,1,1],"02");g=d(c,0,[0,f,0,1,2],"02");i=d(c,0,[0,f,1,0],"02")}catch(e){console.log("EXCEPTION:"+e);throw"malformed X.509 certificate DSA public key"}this.setPublicHex(b,a,g,i)}}; -var KEYUTIL=function(){var d=function(p,r,q){return k(CryptoJS.AES,p,r,q)};var e=function(p,r,q){return k(CryptoJS.TripleDES,p,r,q)};var a=function(p,r,q){return k(CryptoJS.DES,p,r,q)};var k=function(s,x,u,q){var r=CryptoJS.enc.Hex.parse(x);var w=CryptoJS.enc.Hex.parse(u);var p=CryptoJS.enc.Hex.parse(q);var t={};t.key=w;t.iv=p;t.ciphertext=r;var v=s.decrypt(t,w,{iv:p});return CryptoJS.enc.Hex.stringify(v)};var l=function(p,r,q){return g(CryptoJS.AES,p,r,q)};var o=function(p,r,q){return g(CryptoJS.TripleDES,p,r,q)};var f=function(p,r,q){return g(CryptoJS.DES,p,r,q)};var g=function(t,y,v,q){var s=CryptoJS.enc.Hex.parse(y);var x=CryptoJS.enc.Hex.parse(v);var p=CryptoJS.enc.Hex.parse(q);var w=t.encrypt(s,x,{iv:p});var r=CryptoJS.enc.Hex.parse(w.toString());var u=CryptoJS.enc.Base64.stringify(r);return u};var i={"AES-256-CBC":{proc:d,eproc:l,keylen:32,ivlen:16},"AES-192-CBC":{proc:d,eproc:l,keylen:24,ivlen:16},"AES-128-CBC":{proc:d,eproc:l,keylen:16,ivlen:16},"DES-EDE3-CBC":{proc:e,eproc:o,keylen:24,ivlen:8},"DES-CBC":{proc:a,eproc:f,keylen:8,ivlen:8}};var c=function(p){return i[p]["proc"]};var m=function(p){var r=CryptoJS.lib.WordArray.random(p);var q=CryptoJS.enc.Hex.stringify(r);return q};var n=function(v){var w={};var q=v.match(new RegExp("DEK-Info: ([^,]+),([0-9A-Fa-f]+)","m"));if(q){w.cipher=q[1];w.ivsalt=q[2]}var p=v.match(new RegExp("-----BEGIN ([A-Z]+) PRIVATE KEY-----"));if(p){w.type=p[1]}var u=-1;var x=0;if(v.indexOf("\r\n\r\n")!=-1){u=v.indexOf("\r\n\r\n");x=2}if(v.indexOf("\n\n")!=-1){u=v.indexOf("\n\n");x=1}var t=v.indexOf("-----END");if(u!=-1&&t!=-1){var r=v.substring(u+x*2,t-x);r=r.replace(/\s+/g,"");w.data=r}return w};var j=function(q,y,p){var v=p.substring(0,16);var t=CryptoJS.enc.Hex.parse(v);var r=CryptoJS.enc.Utf8.parse(y);var u=i[q]["keylen"]+i[q]["ivlen"];var x="";var w=null;for(;;){var s=CryptoJS.algo.MD5.create();if(w!=null){s.update(w)}s.update(r);s.update(t);w=s.finalize();x=x+CryptoJS.enc.Hex.stringify(w);if(x.length>=u*2){break}}var z={};z.keyhex=x.substr(0,i[q]["keylen"]*2);z.ivhex=x.substr(i[q]["keylen"]*2,i[q]["ivlen"]*2);return z};var b=function(p,v,r,w){var s=CryptoJS.enc.Base64.parse(p);var q=CryptoJS.enc.Hex.stringify(s);var u=i[v]["proc"];var t=u(q,r,w);return t};var h=function(p,s,q,u){var r=i[s]["eproc"];var t=r(p,q,u);return t};return{version:"1.0.0",parsePKCS5PEM:function(p){return n(p)},getKeyAndUnusedIvByPasscodeAndIvsalt:function(q,p,r){return j(q,p,r)},decryptKeyB64:function(p,r,q,s){return b(p,r,q,s)},getDecryptedKeyHex:function(y,x){var q=n(y);var t=q.type;var r=q.cipher;var p=q.ivsalt;var s=q.data;var w=j(r,x,p);var v=w.keyhex;var u=b(s,r,v,p);return u},getEncryptedPKCS5PEMFromPrvKeyHex:function(x,s,A,t,r){var p="";if(typeof t=="undefined"||t==null){t="AES-256-CBC"}if(typeof i[t]=="undefined"){throw"KEYUTIL unsupported algorithm: "+t}if(typeof r=="undefined"||r==null){var v=i[t]["ivlen"];var u=m(v);r=u.toUpperCase()}var z=j(t,A,r);var y=z.keyhex;var w=h(s,t,y,r);var q=w.replace(/(.{64})/g,"$1\r\n");var p="-----BEGIN "+x+" PRIVATE KEY-----\r\n";p+="Proc-Type: 4,ENCRYPTED\r\n";p+="DEK-Info: "+t+","+r+"\r\n";p+="\r\n";p+=q;p+="\r\n-----END "+x+" PRIVATE KEY-----\r\n";return p},parseHexOfEncryptedPKCS8:function(y){var B=ASN1HEX;var z=B.getChildIdx;var w=B.getV;var t={};var r=z(y,0);if(r.length!=2){throw"malformed format: SEQUENCE(0).items != 2: "+r.length}t.ciphertext=w(y,r[1]);var A=z(y,r[0]);if(A.length!=2){throw"malformed format: SEQUENCE(0.0).items != 2: "+A.length}if(w(y,A[0])!="2a864886f70d01050d"){throw"this only supports pkcs5PBES2"}var p=z(y,A[1]);if(A.length!=2){throw"malformed format: SEQUENCE(0.0.1).items != 2: "+p.length}var q=z(y,p[1]);if(q.length!=2){throw"malformed format: SEQUENCE(0.0.1.1).items != 2: "+q.length}if(w(y,q[0])!="2a864886f70d0307"){throw"this only supports TripleDES"}t.encryptionSchemeAlg="TripleDES";t.encryptionSchemeIV=w(y,q[1]);var s=z(y,p[0]);if(s.length!=2){throw"malformed format: SEQUENCE(0.0.1.0).items != 2: "+s.length}if(w(y,s[0])!="2a864886f70d01050c"){throw"this only supports pkcs5PBKDF2"}var x=z(y,s[1]);if(x.length<2){throw"malformed format: SEQUENCE(0.0.1.0.1).items < 2: "+x.length}t.pbkdf2Salt=w(y,x[0]);var u=w(y,x[1]);try{t.pbkdf2Iter=parseInt(u,16)}catch(v){throw"malformed format pbkdf2Iter: "+u}return t},getPBKDF2KeyHexFromParam:function(u,p){var t=CryptoJS.enc.Hex.parse(u.pbkdf2Salt);var q=u.pbkdf2Iter;var s=CryptoJS.PBKDF2(p,t,{keySize:192/32,iterations:q});var r=CryptoJS.enc.Hex.stringify(s);return r},_getPlainPKCS8HexFromEncryptedPKCS8PEM:function(x,y){var r=pemtohex(x,"ENCRYPTED PRIVATE KEY");var p=this.parseHexOfEncryptedPKCS8(r);var u=KEYUTIL.getPBKDF2KeyHexFromParam(p,y);var v={};v.ciphertext=CryptoJS.enc.Hex.parse(p.ciphertext);var t=CryptoJS.enc.Hex.parse(u);var s=CryptoJS.enc.Hex.parse(p.encryptionSchemeIV);var w=CryptoJS.TripleDES.decrypt(v,t,{iv:s});var q=CryptoJS.enc.Hex.stringify(w);return q},getKeyFromEncryptedPKCS8PEM:function(s,q){var p=this._getPlainPKCS8HexFromEncryptedPKCS8PEM(s,q);var r=this.getKeyFromPlainPrivatePKCS8Hex(p);return r},parsePlainPrivatePKCS8Hex:function(s){var v=ASN1HEX;var u=v.getChildIdx;var t=v.getV;var q={};q.algparam=null;if(s.substr(0,2)!="30"){throw"malformed plain PKCS8 private key(code:001)"}var r=u(s,0);if(r.length!=3){throw"malformed plain PKCS8 private key(code:002)"}if(s.substr(r[1],2)!="30"){throw"malformed PKCS8 private key(code:003)"}var p=u(s,r[1]);if(p.length!=2){throw"malformed PKCS8 private key(code:004)"}if(s.substr(p[0],2)!="06"){throw"malformed PKCS8 private key(code:005)"}q.algoid=t(s,p[0]);if(s.substr(p[1],2)=="06"){q.algparam=t(s,p[1])}if(s.substr(r[2],2)!="04"){throw"malformed PKCS8 private key(code:006)"}q.keyidx=v.getVidx(s,r[2]);return q},getKeyFromPlainPrivatePKCS8PEM:function(q){var p=pemtohex(q,"PRIVATE KEY");var r=this.getKeyFromPlainPrivatePKCS8Hex(p);return r},getKeyFromPlainPrivatePKCS8Hex:function(p){var q=this.parsePlainPrivatePKCS8Hex(p);var r;if(q.algoid=="2a864886f70d010101"){r=new RSAKey()}else{if(q.algoid=="2a8648ce380401"){r=new KJUR.crypto.DSA()}else{if(q.algoid=="2a8648ce3d0201"){r=new KJUR.crypto.ECDSA()}else{throw"unsupported private key algorithm"}}}r.readPKCS8PrvKeyHex(p);return r},_getKeyFromPublicPKCS8Hex:function(q){var p;var r=ASN1HEX.getVbyList(q,0,[0,0],"06");if(r==="2a864886f70d010101"){p=new RSAKey()}else{if(r==="2a8648ce380401"){p=new KJUR.crypto.DSA()}else{if(r==="2a8648ce3d0201"){p=new KJUR.crypto.ECDSA()}else{throw"unsupported PKCS#8 public key hex"}}}p.readPKCS8PubKeyHex(q);return p},parsePublicRawRSAKeyHex:function(r){var u=ASN1HEX;var t=u.getChildIdx;var s=u.getV;var p={};if(r.substr(0,2)!="30"){throw"malformed RSA key(code:001)"}var q=t(r,0);if(q.length!=2){throw"malformed RSA key(code:002)"}if(r.substr(q[0],2)!="02"){throw"malformed RSA key(code:003)"}p.n=s(r,q[0]);if(r.substr(q[1],2)!="02"){throw"malformed RSA key(code:004)"}p.e=s(r,q[1]);return p},parsePublicPKCS8Hex:function(t){var v=ASN1HEX;var u=v.getChildIdx;var s=v.getV;var q={};q.algparam=null;var r=u(t,0);if(r.length!=2){throw"outer DERSequence shall have 2 elements: "+r.length}var w=r[0];if(t.substr(w,2)!="30"){throw"malformed PKCS8 public key(code:001)"}var p=u(t,w);if(p.length!=2){throw"malformed PKCS8 public key(code:002)"}if(t.substr(p[0],2)!="06"){throw"malformed PKCS8 public key(code:003)"}q.algoid=s(t,p[0]);if(t.substr(p[1],2)=="06"){q.algparam=s(t,p[1])}else{if(t.substr(p[1],2)=="30"){q.algparam={};q.algparam.p=v.getVbyList(t,p[1],[0],"02");q.algparam.q=v.getVbyList(t,p[1],[1],"02");q.algparam.g=v.getVbyList(t,p[1],[2],"02")}}if(t.substr(r[1],2)!="03"){throw"malformed PKCS8 public key(code:004)"}q.key=s(t,r[1]).substr(2);return q},}}();KEYUTIL.getKey=function(l,k,n){var G=ASN1HEX,L=G.getChildIdx,v=G.getV,d=G.getVbyList,c=KJUR.crypto,i=c.ECDSA,C=c.DSA,w=RSAKey,M=pemtohex,F=KEYUTIL;if(typeof w!="undefined"&&l instanceof w){return l}if(typeof i!="undefined"&&l instanceof i){return l}if(typeof C!="undefined"&&l instanceof C){return l}if(l.curve!==undefined&&l.xy!==undefined&&l.d===undefined){return new i({pub:l.xy,curve:l.curve})}if(l.curve!==undefined&&l.d!==undefined){return new i({prv:l.d,curve:l.curve})}if(l.kty===undefined&&l.n!==undefined&&l.e!==undefined&&l.d===undefined){var P=new w();P.setPublic(l.n,l.e);return P}if(l.kty===undefined&&l.n!==undefined&&l.e!==undefined&&l.d!==undefined&&l.p!==undefined&&l.q!==undefined&&l.dp!==undefined&&l.dq!==undefined&&l.co!==undefined&&l.qi===undefined){var P=new w();P.setPrivateEx(l.n,l.e,l.d,l.p,l.q,l.dp,l.dq,l.co);return P}if(l.kty===undefined&&l.n!==undefined&&l.e!==undefined&&l.d!==undefined&&l.p===undefined){var P=new w();P.setPrivate(l.n,l.e,l.d);return P}if(l.p!==undefined&&l.q!==undefined&&l.g!==undefined&&l.y!==undefined&&l.x===undefined){var P=new C();P.setPublic(l.p,l.q,l.g,l.y);return P}if(l.p!==undefined&&l.q!==undefined&&l.g!==undefined&&l.y!==undefined&&l.x!==undefined){var P=new C();P.setPrivate(l.p,l.q,l.g,l.y,l.x);return P}if(l.kty==="RSA"&&l.n!==undefined&&l.e!==undefined&&l.d===undefined){var P=new w();P.setPublic(b64utohex(l.n),b64utohex(l.e));return P}if(l.kty==="RSA"&&l.n!==undefined&&l.e!==undefined&&l.d!==undefined&&l.p!==undefined&&l.q!==undefined&&l.dp!==undefined&&l.dq!==undefined&&l.qi!==undefined){var P=new w();P.setPrivateEx(b64utohex(l.n),b64utohex(l.e),b64utohex(l.d),b64utohex(l.p),b64utohex(l.q),b64utohex(l.dp),b64utohex(l.dq),b64utohex(l.qi));return P}if(l.kty==="RSA"&&l.n!==undefined&&l.e!==undefined&&l.d!==undefined){var P=new w();P.setPrivate(b64utohex(l.n),b64utohex(l.e),b64utohex(l.d));return P}if(l.kty==="EC"&&l.crv!==undefined&&l.x!==undefined&&l.y!==undefined&&l.d===undefined){var j=new i({curve:l.crv});var t=j.ecparams.keylen/4;var B=("0000000000"+b64utohex(l.x)).slice(-t);var z=("0000000000"+b64utohex(l.y)).slice(-t);var u="04"+B+z;j.setPublicKeyHex(u);return j}if(l.kty==="EC"&&l.crv!==undefined&&l.x!==undefined&&l.y!==undefined&&l.d!==undefined){var j=new i({curve:l.crv});var t=j.ecparams.keylen/4;var B=("0000000000"+b64utohex(l.x)).slice(-t);var z=("0000000000"+b64utohex(l.y)).slice(-t);var u="04"+B+z;var b=("0000000000"+b64utohex(l.d)).slice(-t);j.setPublicKeyHex(u);j.setPrivateKeyHex(b);return j}if(n==="pkcs5prv"){var J=l,G=ASN1HEX,N,P;N=L(J,0);if(N.length===9){P=new w();P.readPKCS5PrvKeyHex(J)}else{if(N.length===6){P=new C();P.readPKCS5PrvKeyHex(J)}else{if(N.length>2&&J.substr(N[1],2)==="04"){P=new i();P.readPKCS5PrvKeyHex(J)}else{throw"unsupported PKCS#1/5 hexadecimal key"}}}return P}if(n==="pkcs8prv"){var P=F.getKeyFromPlainPrivatePKCS8Hex(l);return P}if(n==="pkcs8pub"){return F._getKeyFromPublicPKCS8Hex(l)}if(n==="x509pub"){return X509.getPublicKeyFromCertHex(l)}if(l.indexOf("-END CERTIFICATE-",0)!=-1||l.indexOf("-END X509 CERTIFICATE-",0)!=-1||l.indexOf("-END TRUSTED CERTIFICATE-",0)!=-1){return X509.getPublicKeyFromCertPEM(l)}if(l.indexOf("-END PUBLIC KEY-")!=-1){var O=pemtohex(l,"PUBLIC KEY");return F._getKeyFromPublicPKCS8Hex(O)}if(l.indexOf("-END RSA PRIVATE KEY-")!=-1&&l.indexOf("4,ENCRYPTED")==-1){var m=M(l,"RSA PRIVATE KEY");return F.getKey(m,null,"pkcs5prv")}if(l.indexOf("-END DSA PRIVATE KEY-")!=-1&&l.indexOf("4,ENCRYPTED")==-1){var I=M(l,"DSA PRIVATE KEY");var E=d(I,0,[1],"02");var D=d(I,0,[2],"02");var K=d(I,0,[3],"02");var r=d(I,0,[4],"02");var s=d(I,0,[5],"02");var P=new C();P.setPrivate(new BigInteger(E,16),new BigInteger(D,16),new BigInteger(K,16),new BigInteger(r,16),new BigInteger(s,16));return P}if(l.indexOf("-END PRIVATE KEY-")!=-1){return F.getKeyFromPlainPrivatePKCS8PEM(l)}if(l.indexOf("-END RSA PRIVATE KEY-")!=-1&&l.indexOf("4,ENCRYPTED")!=-1){var o=F.getDecryptedKeyHex(l,k);var H=new RSAKey();H.readPKCS5PrvKeyHex(o);return H}if(l.indexOf("-END EC PRIVATE KEY-")!=-1&&l.indexOf("4,ENCRYPTED")!=-1){var I=F.getDecryptedKeyHex(l,k);var P=d(I,0,[1],"04");var f=d(I,0,[2,0],"06");var A=d(I,0,[3,0],"03").substr(2);var e="";if(KJUR.crypto.OID.oidhex2name[f]!==undefined){e=KJUR.crypto.OID.oidhex2name[f]}else{throw"undefined OID(hex) in KJUR.crypto.OID: "+f}var j=new i({curve:e});j.setPublicKeyHex(A);j.setPrivateKeyHex(P);j.isPublic=false;return j}if(l.indexOf("-END DSA PRIVATE KEY-")!=-1&&l.indexOf("4,ENCRYPTED")!=-1){var I=F.getDecryptedKeyHex(l,k);var E=d(I,0,[1],"02");var D=d(I,0,[2],"02");var K=d(I,0,[3],"02");var r=d(I,0,[4],"02");var s=d(I,0,[5],"02");var P=new C();P.setPrivate(new BigInteger(E,16),new BigInteger(D,16),new BigInteger(K,16),new BigInteger(r,16),new BigInteger(s,16));return P}if(l.indexOf("-END ENCRYPTED PRIVATE KEY-")!=-1){return F.getKeyFromEncryptedPKCS8PEM(l,k)}throw"not supported argument"};KEYUTIL.generateKeypair=function(a,c){if(a=="RSA"){var b=c;var h=new RSAKey();h.generate(b,"10001");h.isPrivate=true;h.isPublic=true;var f=new RSAKey();var e=h.n.toString(16);var i=h.e.toString(16);f.setPublic(e,i);f.isPrivate=false;f.isPublic=true;var k={};k.prvKeyObj=h;k.pubKeyObj=f;return k}else{if(a=="EC"){var d=c;var g=new KJUR.crypto.ECDSA({curve:d});var j=g.generateKeyPairHex();var h=new KJUR.crypto.ECDSA({curve:d});h.setPublicKeyHex(j.ecpubhex);h.setPrivateKeyHex(j.ecprvhex);h.isPrivate=true;h.isPublic=false;var f=new KJUR.crypto.ECDSA({curve:d});f.setPublicKeyHex(j.ecpubhex);f.isPrivate=false;f.isPublic=true;var k={};k.prvKeyObj=h;k.pubKeyObj=f;return k}else{throw"unknown algorithm: "+a}}};KEYUTIL.getPEM=function(b,D,y,m,q,j){var F=KJUR,k=F.asn1,z=k.DERObjectIdentifier,f=k.DERInteger,l=k.ASN1Util.newObject,a=k.x509,C=a.SubjectPublicKeyInfo,e=F.crypto,u=e.DSA,r=e.ECDSA,n=RSAKey;function A(s){var G=l({seq:[{"int":0},{"int":{bigint:s.n}},{"int":s.e},{"int":{bigint:s.d}},{"int":{bigint:s.p}},{"int":{bigint:s.q}},{"int":{bigint:s.dmp1}},{"int":{bigint:s.dmq1}},{"int":{bigint:s.coeff}}]});return G}function B(G){var s=l({seq:[{"int":1},{octstr:{hex:G.prvKeyHex}},{tag:["a0",true,{oid:{name:G.curveName}}]},{tag:["a1",true,{bitstr:{hex:"00"+G.pubKeyHex}}]}]});return s}function x(s){var G=l({seq:[{"int":0},{"int":{bigint:s.p}},{"int":{bigint:s.q}},{"int":{bigint:s.g}},{"int":{bigint:s.y}},{"int":{bigint:s.x}}]});return G}if(((n!==undefined&&b instanceof n)||(u!==undefined&&b instanceof u)||(r!==undefined&&b instanceof r))&&b.isPublic==true&&(D===undefined||D=="PKCS8PUB")){var E=new C(b);var w=E.getEncodedHex();return hextopem(w,"PUBLIC KEY")}if(D=="PKCS1PRV"&&n!==undefined&&b instanceof n&&(y===undefined||y==null)&&b.isPrivate==true){var E=A(b);var w=E.getEncodedHex();return hextopem(w,"RSA PRIVATE KEY")}if(D=="PKCS1PRV"&&r!==undefined&&b instanceof r&&(y===undefined||y==null)&&b.isPrivate==true){var i=new z({name:b.curveName});var v=i.getEncodedHex();var h=B(b);var t=h.getEncodedHex();var p="";p+=hextopem(v,"EC PARAMETERS");p+=hextopem(t,"EC PRIVATE KEY");return p}if(D=="PKCS1PRV"&&u!==undefined&&b instanceof u&&(y===undefined||y==null)&&b.isPrivate==true){var E=x(b);var w=E.getEncodedHex();return hextopem(w,"DSA PRIVATE KEY")}if(D=="PKCS5PRV"&&n!==undefined&&b instanceof n&&(y!==undefined&&y!=null)&&b.isPrivate==true){var E=A(b);var w=E.getEncodedHex();if(m===undefined){m="DES-EDE3-CBC"}return this.getEncryptedPKCS5PEMFromPrvKeyHex("RSA",w,y,m,j)}if(D=="PKCS5PRV"&&r!==undefined&&b instanceof r&&(y!==undefined&&y!=null)&&b.isPrivate==true){var E=B(b);var w=E.getEncodedHex();if(m===undefined){m="DES-EDE3-CBC"}return this.getEncryptedPKCS5PEMFromPrvKeyHex("EC",w,y,m,j)}if(D=="PKCS5PRV"&&u!==undefined&&b instanceof u&&(y!==undefined&&y!=null)&&b.isPrivate==true){var E=x(b);var w=E.getEncodedHex();if(m===undefined){m="DES-EDE3-CBC"}return this.getEncryptedPKCS5PEMFromPrvKeyHex("DSA",w,y,m,j)}var o=function(G,s){var I=c(G,s);var H=new l({seq:[{seq:[{oid:{name:"pkcs5PBES2"}},{seq:[{seq:[{oid:{name:"pkcs5PBKDF2"}},{seq:[{octstr:{hex:I.pbkdf2Salt}},{"int":I.pbkdf2Iter}]}]},{seq:[{oid:{name:"des-EDE3-CBC"}},{octstr:{hex:I.encryptionSchemeIV}}]}]}]},{octstr:{hex:I.ciphertext}}]});return H.getEncodedHex()};var c=function(N,O){var H=100;var M=CryptoJS.lib.WordArray.random(8);var L="DES-EDE3-CBC";var s=CryptoJS.lib.WordArray.random(8);var I=CryptoJS.PBKDF2(O,M,{keySize:192/32,iterations:H});var J=CryptoJS.enc.Hex.parse(N);var K=CryptoJS.TripleDES.encrypt(J,I,{iv:s})+"";var G={};G.ciphertext=K;G.pbkdf2Salt=CryptoJS.enc.Hex.stringify(M);G.pbkdf2Iter=H;G.encryptionSchemeAlg=L;G.encryptionSchemeIV=CryptoJS.enc.Hex.stringify(s);return G};if(D=="PKCS8PRV"&&n!=undefined&&b instanceof n&&b.isPrivate==true){var g=A(b);var d=g.getEncodedHex();var E=l({seq:[{"int":0},{seq:[{oid:{name:"rsaEncryption"}},{"null":true}]},{octstr:{hex:d}}]});var w=E.getEncodedHex();if(y===undefined||y==null){return hextopem(w,"PRIVATE KEY")}else{var t=o(w,y);return hextopem(t,"ENCRYPTED PRIVATE KEY")}}if(D=="PKCS8PRV"&&r!==undefined&&b instanceof r&&b.isPrivate==true){var g=new l({seq:[{"int":1},{octstr:{hex:b.prvKeyHex}},{tag:["a1",true,{bitstr:{hex:"00"+b.pubKeyHex}}]}]});var d=g.getEncodedHex();var E=l({seq:[{"int":0},{seq:[{oid:{name:"ecPublicKey"}},{oid:{name:b.curveName}}]},{octstr:{hex:d}}]});var w=E.getEncodedHex();if(y===undefined||y==null){return hextopem(w,"PRIVATE KEY")}else{var t=o(w,y);return hextopem(t,"ENCRYPTED PRIVATE KEY")}}if(D=="PKCS8PRV"&&u!==undefined&&b instanceof u&&b.isPrivate==true){var g=new f({bigint:b.x});var d=g.getEncodedHex();var E=l({seq:[{"int":0},{seq:[{oid:{name:"dsa"}},{seq:[{"int":{bigint:b.p}},{"int":{bigint:b.q}},{"int":{bigint:b.g}}]}]},{octstr:{hex:d}}]});var w=E.getEncodedHex();if(y===undefined||y==null){return hextopem(w,"PRIVATE KEY")}else{var t=o(w,y);return hextopem(t,"ENCRYPTED PRIVATE KEY")}}throw"unsupported object nor format"};KEYUTIL.getKeyFromCSRPEM=function(b){var a=pemtohex(b,"CERTIFICATE REQUEST");var c=KEYUTIL.getKeyFromCSRHex(a);return c};KEYUTIL.getKeyFromCSRHex=function(a){var c=KEYUTIL.parseCSRHex(a);var b=KEYUTIL.getKey(c.p8pubkeyhex,null,"pkcs8pub");return b};KEYUTIL.parseCSRHex=function(d){var i=ASN1HEX;var f=i.getChildIdx;var c=i.getTLV;var b={};var g=d;if(g.substr(0,2)!="30"){throw"malformed CSR(code:001)"}var e=f(g,0);if(e.length<1){throw"malformed CSR(code:002)"}if(g.substr(e[0],2)!="30"){throw"malformed CSR(code:003)"}var a=f(g,e[0]);if(a.length<3){throw"malformed CSR(code:004)"}b.p8pubkeyhex=c(g,a[2]);return b};KEYUTIL.getJWKFromKey=function(d){var b={};if(d instanceof RSAKey&&d.isPrivate){b.kty="RSA";b.n=hextob64u(d.n.toString(16));b.e=hextob64u(d.e.toString(16));b.d=hextob64u(d.d.toString(16));b.p=hextob64u(d.p.toString(16));b.q=hextob64u(d.q.toString(16));b.dp=hextob64u(d.dmp1.toString(16));b.dq=hextob64u(d.dmq1.toString(16));b.qi=hextob64u(d.coeff.toString(16));return b}else{if(d instanceof RSAKey&&d.isPublic){b.kty="RSA";b.n=hextob64u(d.n.toString(16));b.e=hextob64u(d.e.toString(16));return b}else{if(d instanceof KJUR.crypto.ECDSA&&d.isPrivate){var a=d.getShortNISTPCurveName();if(a!=="P-256"&&a!=="P-384"){throw"unsupported curve name for JWT: "+a}var c=d.getPublicKeyXYHex();b.kty="EC";b.crv=a;b.x=hextob64u(c.x);b.y=hextob64u(c.y);b.d=hextob64u(d.prvKeyHex);return b}else{if(d instanceof KJUR.crypto.ECDSA&&d.isPublic){var a=d.getShortNISTPCurveName();if(a!=="P-256"&&a!=="P-384"){throw"unsupported curve name for JWT: "+a}var c=d.getPublicKeyXYHex();b.kty="EC";b.crv=a;b.x=hextob64u(c.x);b.y=hextob64u(c.y);return b}}}}throw"not supported key object"}; -RSAKey.getPosArrayOfChildrenFromHex=function(a){return ASN1HEX.getChildIdx(a,0)};RSAKey.getHexValueArrayOfChildrenFromHex=function(f){var n=ASN1HEX;var i=n.getV;var k=RSAKey.getPosArrayOfChildrenFromHex(f);var e=i(f,k[0]);var j=i(f,k[1]);var b=i(f,k[2]);var c=i(f,k[3]);var h=i(f,k[4]);var g=i(f,k[5]);var m=i(f,k[6]);var l=i(f,k[7]);var d=i(f,k[8]);var k=new Array();k.push(e,j,b,c,h,g,m,l,d);return k};RSAKey.prototype.readPrivateKeyFromPEMString=function(d){var c=pemtohex(d);var b=RSAKey.getHexValueArrayOfChildrenFromHex(c);this.setPrivateEx(b[1],b[2],b[3],b[4],b[5],b[6],b[7],b[8])};RSAKey.prototype.readPKCS5PrvKeyHex=function(c){var b=RSAKey.getHexValueArrayOfChildrenFromHex(c);this.setPrivateEx(b[1],b[2],b[3],b[4],b[5],b[6],b[7],b[8])};RSAKey.prototype.readPKCS8PrvKeyHex=function(e){var c,j,l,b,a,f,d,k;var m=ASN1HEX;var g=m.getVbyList;if(m.isASN1HEX(e)===false){throw"not ASN.1 hex string"}try{c=g(e,0,[2,0,1],"02");j=g(e,0,[2,0,2],"02");l=g(e,0,[2,0,3],"02");b=g(e,0,[2,0,4],"02");a=g(e,0,[2,0,5],"02");f=g(e,0,[2,0,6],"02");d=g(e,0,[2,0,7],"02");k=g(e,0,[2,0,8],"02")}catch(i){throw"malformed PKCS#8 plain RSA private key"}this.setPrivateEx(c,j,l,b,a,f,d,k)};RSAKey.prototype.readPKCS5PubKeyHex=function(c){var e=ASN1HEX;var b=e.getV;if(e.isASN1HEX(c)===false){throw"keyHex is not ASN.1 hex string"}var a=e.getChildIdx(c,0);if(a.length!==2||c.substr(a[0],2)!=="02"||c.substr(a[1],2)!=="02"){throw"wrong hex for PKCS#5 public key"}var f=b(c,a[0]);var d=b(c,a[1]);this.setPublic(f,d)};RSAKey.prototype.readPKCS8PubKeyHex=function(b){var c=ASN1HEX;if(c.isASN1HEX(b)===false){throw"not ASN.1 hex string"}if(c.getTLVbyList(b,0,[0,0])!=="06092a864886f70d010101"){throw"not PKCS8 RSA public key"}var a=c.getTLVbyList(b,0,[1,0]);this.readPKCS5PubKeyHex(a)};RSAKey.prototype.readCertPubKeyHex=function(b,d){var a,c;a=new X509();a.readCertHex(b);c=a.getPublicKeyHex();this.readPKCS8PubKeyHex(c)}; -var _RE_HEXDECONLY=new RegExp("");_RE_HEXDECONLY.compile("[^0-9a-f]","gi");function _rsasign_getHexPaddedDigestInfoForString(d,e,a){var b=function(f){return KJUR.crypto.Util.hashString(f,a)};var c=b(d);return KJUR.crypto.Util.getPaddedDigestInfoHex(c,a,e)}function _zeroPaddingOfSignature(e,d){var c="";var a=d/4-e.length;for(var b=0;b>24,(d&16711680)>>16,(d&65280)>>8,d&255]))));d+=1}return b}RSAKey.prototype.signPSS=function(e,a,d){var c=function(f){return KJUR.crypto.Util.hashHex(f,a)};var b=c(rstrtohex(e));if(d===undefined){d=-1}return this.signWithMessageHashPSS(b,a,d)};RSAKey.prototype.signWithMessageHashPSS=function(l,a,k){var b=hextorstr(l);var g=b.length;var m=this.n.bitLength()-1;var c=Math.ceil(m/8);var d;var o=function(i){return KJUR.crypto.Util.hashHex(i,a)};if(k===-1||k===undefined){k=g}else{if(k===-2){k=c-g-2}else{if(k<-2){throw"invalid salt length"}}}if(c<(g+k+2)){throw"data too long"}var f="";if(k>0){f=new Array(k);new SecureRandom().nextBytes(f);f=String.fromCharCode.apply(String,f)}var n=hextorstr(o(rstrtohex("\x00\x00\x00\x00\x00\x00\x00\x00"+b+f)));var j=[];for(d=0;d>(8*c-m))&255;q[0]&=~p;for(d=0;dthis.n.bitLength()){return 0}var i=this.doPublic(b);var e=i.toString(16).replace(/^1f+00/,"");var g=_rsasign_getAlgNameAndHashFromHexDisgestInfo(e);if(g.length==0){return false}var d=g[0];var h=g[1];var a=function(k){return KJUR.crypto.Util.hashString(k,d)};var c=a(f);return(h==c)};RSAKey.prototype.verifyWithMessageHash=function(e,a){a=a.replace(_RE_HEXDECONLY,"");a=a.replace(/[ \n]+/g,"");var b=parseBigInt(a,16);if(b.bitLength()>this.n.bitLength()){return 0}var h=this.doPublic(b);var g=h.toString(16).replace(/^1f+00/,"");var c=_rsasign_getAlgNameAndHashFromHexDisgestInfo(g);if(c.length==0){return false}var d=c[0];var f=c[1];return(f==e)};RSAKey.prototype.verifyPSS=function(c,b,a,f){var e=function(g){return KJUR.crypto.Util.hashHex(g,a)};var d=e(rstrtohex(c));if(f===undefined){f=-1}return this.verifyWithMessageHashPSS(d,b,a,f)};RSAKey.prototype.verifyWithMessageHashPSS=function(f,s,l,c){var k=new BigInteger(s,16);if(k.bitLength()>this.n.bitLength()){return false}var r=function(i){return KJUR.crypto.Util.hashHex(i,l)};var j=hextorstr(f);var h=j.length;var g=this.n.bitLength()-1;var m=Math.ceil(g/8);var q;if(c===-1||c===undefined){c=h}else{if(c===-2){c=m-h-2}else{if(c<-2){throw"invalid salt length"}}}if(m<(h+c+2)){throw"data too long"}var a=this.doPublic(k).toByteArray();for(q=0;q>(8*m-g))&255;if((d.charCodeAt(0)&p)!==0){throw"bits beyond keysize not zero"}var n=pss_mgf1_str(e,d.length,r);var o=[];for(q=0;q0){var b=":"+n.join(":")+":";if(b.indexOf(":"+k+":")==-1){throw"algorithm '"+k+"' not accepted in the list"}}if(k!="none"&&B===null){throw"key shall be specified to verify."}if(typeof B=="string"&&B.indexOf("-----BEGIN ")!=-1){B=KEYUTIL.getKey(B)}if(z=="RS"||z=="PS"){if(!(B instanceof m)){throw"key shall be a RSAKey obj for RS* and PS* algs"}}if(z=="ES"){if(!(B instanceof p)){throw"key shall be a ECDSA obj for ES* algs"}}if(k=="none"){}var u=null;if(t.jwsalg2sigalg[l.alg]===undefined){throw"unsupported alg name: "+k}else{u=t.jwsalg2sigalg[k]}if(u=="none"){throw"not supported"}else{if(u.substr(0,4)=="Hmac"){var o=null;if(B===undefined){throw"hexadecimal key shall be specified for HMAC"}var j=new s({alg:u,pass:B});j.updateString(c);o=j.doFinal();return A==o}else{if(u.indexOf("withECDSA")!=-1){var h=null;try{h=p.concatSigToASN1Sig(A)}catch(v){return false}var g=new d({alg:u});g.init(B);g.updateString(c);return g.verify(h)}else{var g=new d({alg:u});g.init(B);g.updateString(c);return g.verify(A)}}}};KJUR.jws.JWS.parse=function(g){var c=g.split(".");var b={};var f,e,d;if(c.length!=2&&c.length!=3){throw"malformed sJWS: wrong number of '.' splitted elements"}f=c[0];e=c[1];if(c.length==3){d=c[2]}b.headerObj=KJUR.jws.JWS.readSafeJSONString(b64utoutf8(f));b.payloadObj=KJUR.jws.JWS.readSafeJSONString(b64utoutf8(e));b.headerPP=JSON.stringify(b.headerObj,null," ");if(b.payloadObj==null){b.payloadPP=b64utoutf8(e)}else{b.payloadPP=JSON.stringify(b.payloadObj,null," ")}if(d!==undefined){b.sigHex=b64utohex(d)}return b};KJUR.jws.JWS.verifyJWT=function(e,l,r){var d=KJUR,j=d.jws,o=j.JWS,n=o.readSafeJSONString,p=o.inArray,f=o.includedArray;var k=e.split(".");var c=k[0];var i=k[1];var q=c+"."+i;var m=b64utohex(k[2]);var h=n(b64utoutf8(c));var g=n(b64utoutf8(i));if(h.alg===undefined){return false}if(r.alg===undefined){throw"acceptField.alg shall be specified"}if(!p(h.alg,r.alg)){return false}if(g.iss!==undefined&&typeof r.iss==="object"){if(!p(g.iss,r.iss)){return false}}if(g.sub!==undefined&&typeof r.sub==="object"){if(!p(g.sub,r.sub)){return false}}if(g.aud!==undefined&&typeof r.aud==="object"){if(typeof g.aud=="string"){if(!p(g.aud,r.aud)){return false}}else{if(typeof g.aud=="object"){if(!f(g.aud,r.aud)){return false}}}}var b=j.IntDate.getNow();if(r.verifyAt!==undefined&&typeof r.verifyAt==="number"){b=r.verifyAt}if(r.gracePeriod===undefined||typeof r.gracePeriod!=="number"){r.gracePeriod=0}if(g.exp!==undefined&&typeof g.exp=="number"){if(g.exp+r.gracePeriodl){this.aHeader.pop()}if(this.aSignature.length>l){this.aSignature.pop()}throw"addSignature failed: "+i}};this.verifyAll=function(h){if(this.aHeader.length!==h.length||this.aSignature.length!==h.length){return false}for(var g=0;g0){this.aHeader=g.headers}else{throw"malformed header"}if(typeof g.payload==="string"){this.sPayload=g.payload}else{throw"malformed signatures"}if(g.signatures.length>0){this.signatures=g.signatures}else{throw"malformed signatures"}}catch(e){throw"malformed JWS-JS JSON object: "+e}}};this.getJSON=function(){return{headers:this.aHeader,payload:this.sPayload,signatures:this.aSignature}};this.isEmpty=function(){if(this.aHeader.length==0){return 1}return 0}}; -exports.SecureRandom = SecureRandom; -exports.rng_seed_time = rng_seed_time; - -exports.BigInteger = BigInteger; -exports.RSAKey = RSAKey; -exports.ECDSA = KJUR.crypto.ECDSA; -exports.DSA = KJUR.crypto.DSA; -exports.Signature = KJUR.crypto.Signature; -exports.MessageDigest = KJUR.crypto.MessageDigest; -exports.Mac = KJUR.crypto.Mac; -exports.Cipher = KJUR.crypto.Cipher; -exports.KEYUTIL = KEYUTIL; -exports.ASN1HEX = ASN1HEX; -exports.X509 = X509; -exports.CryptoJS = CryptoJS; - -// ext/base64.js -exports.b64tohex = b64tohex; -exports.b64toBA = b64toBA; - -// base64x.js -exports.stoBA = stoBA; -exports.BAtos = BAtos; -exports.BAtohex = BAtohex; -exports.stohex = stohex; -exports.stob64 = stob64; -exports.stob64u = stob64u; -exports.b64utos = b64utos; -exports.b64tob64u = b64tob64u; -exports.b64utob64 = b64utob64; -exports.hex2b64 = hex2b64; -exports.hextob64u = hextob64u; -exports.b64utohex = b64utohex; -exports.utf8tob64u = utf8tob64u; -exports.b64utoutf8 = b64utoutf8; -exports.utf8tob64 = utf8tob64; -exports.b64toutf8 = b64toutf8; -exports.utf8tohex = utf8tohex; -exports.hextoutf8 = hextoutf8; -exports.hextorstr = hextorstr; -exports.rstrtohex = rstrtohex; -exports.hextob64 = hextob64; -exports.hextob64nl = hextob64nl; -exports.b64nltohex = b64nltohex; -exports.hextopem = hextopem; -exports.pemtohex = pemtohex; -exports.hextoArrayBuffer = hextoArrayBuffer; -exports.ArrayBuffertohex = ArrayBuffertohex; -exports.zulutomsec = zulutomsec; -exports.zulutosec = zulutosec; -exports.zulutodate = zulutodate; -exports.datetozulu = datetozulu; -exports.uricmptohex = uricmptohex; -exports.hextouricmp = hextouricmp; -exports.encodeURIComponentAll = encodeURIComponentAll; -exports.newline_toUnix = newline_toUnix; -exports.newline_toDos = newline_toDos; -exports.hextoposhex = hextoposhex; -exports.intarystrtohex = intarystrtohex; -exports.strdiffidx = strdiffidx; - -// name spaces -exports.KJUR = KJUR; -exports.crypto = KJUR.crypto; -exports.asn1 = KJUR.asn1; -exports.jws = KJUR.jws; -exports.lang = KJUR.lang; - - - - -/***/ }), -/* 110 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -var OpenElementStack = __webpack_require__(51), - Tokenizer = __webpack_require__(19), - HTML = __webpack_require__(11); - - -//Aliases -var $ = HTML.TAG_NAMES; - -exports.assign = function (parser) { - //NOTE: obtain Parser proto this way to avoid module circular references - var parserProto = Object.getPrototypeOf(parser), - treeAdapter = parser.treeAdapter, - attachableElementLocation = null, - lastFosterParentingLocation = null, - currentToken = null; - - function setEndLocation(element, closingToken) { - var loc = element.__location; - - if (!loc) - return; - - if (!loc.startTag) { - loc.startTag = { - line: loc.line, - col: loc.col, - startOffset: loc.startOffset, - endOffset: loc.endOffset - }; - - if (loc.attrs) - loc.startTag.attrs = loc.attrs; - } - - if (closingToken.location) { - var ctLocation = closingToken.location, - tn = treeAdapter.getTagName(element), - // NOTE: For cases like - First 'p' closes without a closing tag and - // for cases like - 'p' closes without a closing tag - isClosingEndTag = closingToken.type === Tokenizer.END_TAG_TOKEN && - tn === closingToken.tagName; - - if (isClosingEndTag) { - loc.endTag = { - line: ctLocation.line, - col: ctLocation.col, - startOffset: ctLocation.startOffset, - endOffset: ctLocation.endOffset - }; - } - - if (isClosingEndTag) - loc.endOffset = ctLocation.endOffset; - else - loc.endOffset = ctLocation.startOffset; - } - - else if (closingToken.type === Tokenizer.EOF_TOKEN) - loc.endOffset = parser.tokenizer.preprocessor.sourcePos; - } - - //NOTE: patch _bootstrap method - parser._bootstrap = function (document, fragmentContext) { - parserProto._bootstrap.call(this, document, fragmentContext); - - attachableElementLocation = null; - lastFosterParentingLocation = null; - currentToken = null; - - //OpenElementStack - parser.openElements.pop = function () { - setEndLocation(this.current, currentToken); - OpenElementStack.prototype.pop.call(this); - }; - - parser.openElements.popAllUpToHtmlElement = function () { - for (var i = this.stackTop; i > 0; i--) - setEndLocation(this.items[i], currentToken); - - OpenElementStack.prototype.popAllUpToHtmlElement.call(this); - }; - - parser.openElements.remove = function (element) { - setEndLocation(element, currentToken); - OpenElementStack.prototype.remove.call(this, element); - }; - }; - - parser._runParsingLoop = function (scriptHandler) { - parserProto._runParsingLoop.call(this, scriptHandler); - - // NOTE: generate location info for elements - // that remains on open element stack - for (var i = parser.openElements.stackTop; i >= 0; i--) - setEndLocation(parser.openElements.items[i], currentToken); - }; - - - //Token processing - parser._processTokenInForeignContent = function (token) { - currentToken = token; - parserProto._processTokenInForeignContent.call(this, token); - }; - - parser._processToken = function (token) { - currentToken = token; - parserProto._processToken.call(this, token); - - //NOTE: and are never popped from the stack, so we need to updated - //their end location explicitly. - if (token.type === Tokenizer.END_TAG_TOKEN && - (token.tagName === $.HTML || - token.tagName === $.BODY && this.openElements.hasInScope($.BODY))) { - for (var i = this.openElements.stackTop; i >= 0; i--) { - var element = this.openElements.items[i]; - - if (this.treeAdapter.getTagName(element) === token.tagName) { - setEndLocation(element, token); - break; - } - } - } - }; - - - //Doctype - parser._setDocumentType = function (token) { - parserProto._setDocumentType.call(this, token); - - var documentChildren = this.treeAdapter.getChildNodes(this.document), - cnLength = documentChildren.length; - - for (var i = 0; i < cnLength; i++) { - var node = documentChildren[i]; - - if (this.treeAdapter.isDocumentTypeNode(node)) { - node.__location = token.location; - break; - } - } - }; - - - //Elements - parser._attachElementToTree = function (element) { - //NOTE: _attachElementToTree is called from _appendElement, _insertElement and _insertTemplate methods. - //So we will use token location stored in this methods for the element. - element.__location = attachableElementLocation || null; - attachableElementLocation = null; - parserProto._attachElementToTree.call(this, element); - }; - - parser._appendElement = function (token, namespaceURI) { - attachableElementLocation = token.location; - parserProto._appendElement.call(this, token, namespaceURI); - }; - - parser._insertElement = function (token, namespaceURI) { - attachableElementLocation = token.location; - parserProto._insertElement.call(this, token, namespaceURI); - }; - - parser._insertTemplate = function (token) { - attachableElementLocation = token.location; - parserProto._insertTemplate.call(this, token); - - var tmplContent = this.treeAdapter.getTemplateContent(this.openElements.current); - - tmplContent.__location = null; - }; - - parser._insertFakeRootElement = function () { - parserProto._insertFakeRootElement.call(this); - this.openElements.current.__location = null; - }; - - - //Comments - parser._appendCommentNode = function (token, parent) { - parserProto._appendCommentNode.call(this, token, parent); - - var children = this.treeAdapter.getChildNodes(parent), - commentNode = children[children.length - 1]; - - commentNode.__location = token.location; - }; - - - //Text - parser._findFosterParentingLocation = function () { - //NOTE: store last foster parenting location, so we will be able to find inserted text - //in case of foster parenting - lastFosterParentingLocation = parserProto._findFosterParentingLocation.call(this); - return lastFosterParentingLocation; - }; - - parser._insertCharacters = function (token) { - parserProto._insertCharacters.call(this, token); - - var hasFosterParent = this._shouldFosterParentOnInsertion(), - parent = hasFosterParent && lastFosterParentingLocation.parent || - this.openElements.currentTmplContent || - this.openElements.current, - siblings = this.treeAdapter.getChildNodes(parent), - textNodeIdx = hasFosterParent && lastFosterParentingLocation.beforeElement ? - siblings.indexOf(lastFosterParentingLocation.beforeElement) - 1 : - siblings.length - 1, - textNode = siblings[textNodeIdx]; - - //NOTE: if we have location assigned by another token, then just update end position - if (textNode.__location) - textNode.__location.endOffset = token.location.endOffset; - - else - textNode.__location = token.location; - }; -}; - - - -/***/ }), -/* 111 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -var UNICODE = __webpack_require__(18); - -//Aliases -var $ = UNICODE.CODE_POINTS; - - -exports.assign = function (tokenizer) { - //NOTE: obtain Tokenizer proto this way to avoid module circular references - var tokenizerProto = Object.getPrototypeOf(tokenizer), - tokenStartOffset = -1, - tokenCol = -1, - tokenLine = 1, - isEol = false, - lineStartPos = 0, - col = -1, - line = 1; - - function attachLocationInfo(token) { - token.location = { - line: tokenLine, - col: tokenCol, - startOffset: tokenStartOffset, - endOffset: -1 - }; - } - - //NOTE: patch consumption method to track line/col information - tokenizer._consume = function () { - var cp = tokenizerProto._consume.call(this); - - //NOTE: LF should be in the last column of the line - if (isEol) { - isEol = false; - line++; - lineStartPos = this.preprocessor.sourcePos; - } - - if (cp === $.LINE_FEED) - isEol = true; - - col = this.preprocessor.sourcePos - lineStartPos + 1; - - return cp; - }; - - tokenizer._unconsume = function () { - tokenizerProto._unconsume.call(this); - isEol = false; - - col = this.preprocessor.sourcePos - lineStartPos + 1; - }; - - //NOTE: patch token creation methods and attach location objects - tokenizer._createStartTagToken = function () { - tokenizerProto._createStartTagToken.call(this); - attachLocationInfo(this.currentToken); - }; - - tokenizer._createEndTagToken = function () { - tokenizerProto._createEndTagToken.call(this); - attachLocationInfo(this.currentToken); - }; - - tokenizer._createCommentToken = function () { - tokenizerProto._createCommentToken.call(this); - attachLocationInfo(this.currentToken); - }; - - tokenizer._createDoctypeToken = function (initialName) { - tokenizerProto._createDoctypeToken.call(this, initialName); - attachLocationInfo(this.currentToken); - }; - - tokenizer._createCharacterToken = function (type, ch) { - tokenizerProto._createCharacterToken.call(this, type, ch); - attachLocationInfo(this.currentCharacterToken); - }; - - tokenizer._createAttr = function (attrNameFirstCh) { - tokenizerProto._createAttr.call(this, attrNameFirstCh); - this.currentAttrLocation = { - line: line, - col: col, - startOffset: this.preprocessor.sourcePos, - endOffset: -1 - }; - }; - - tokenizer._leaveAttrName = function (toState) { - tokenizerProto._leaveAttrName.call(this, toState); - this._attachCurrentAttrLocationInfo(); - }; - - tokenizer._leaveAttrValue = function (toState) { - tokenizerProto._leaveAttrValue.call(this, toState); - this._attachCurrentAttrLocationInfo(); - }; - - tokenizer._attachCurrentAttrLocationInfo = function () { - this.currentAttrLocation.endOffset = this.preprocessor.sourcePos; - - if (!this.currentToken.location.attrs) - this.currentToken.location.attrs = Object.create(null); - - this.currentToken.location.attrs[this.currentAttr.name] = this.currentAttrLocation; - }; - - //NOTE: patch token emission methods to determine end location - tokenizer._emitCurrentToken = function () { - //NOTE: if we have pending character token make it's end location equal to the - //current token's start location. - if (this.currentCharacterToken) - this.currentCharacterToken.location.endOffset = this.currentToken.location.startOffset; - - this.currentToken.location.endOffset = this.preprocessor.sourcePos + 1; - tokenizerProto._emitCurrentToken.call(this); - }; - - tokenizer._emitCurrentCharacterToken = function () { - //NOTE: if we have character token and it's location wasn't set in the _emitCurrentToken(), - //then set it's location at the current preprocessor position. - //We don't need to increment preprocessor position, since character token - //emission is always forced by the start of the next character token here. - //So, we already have advanced position. - if (this.currentCharacterToken && this.currentCharacterToken.location.endOffset === -1) - this.currentCharacterToken.location.endOffset = this.preprocessor.sourcePos; - - tokenizerProto._emitCurrentCharacterToken.call(this); - }; - - //NOTE: patch initial states for each mode to obtain token start position - Object.keys(tokenizerProto.MODE) - - .map(function (modeName) { - return tokenizerProto.MODE[modeName]; - }) - - .forEach(function (state) { - tokenizer[state] = function (cp) { - tokenStartOffset = this.preprocessor.sourcePos; - tokenLine = line; - tokenCol = col; - tokenizerProto[state].call(this, cp); - }; - }); -}; - - -/***/ }), -/* 112 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -//Const -var NOAH_ARK_CAPACITY = 3; - -//List of formatting elements -var FormattingElementList = module.exports = function (treeAdapter) { - this.length = 0; - this.entries = []; - this.treeAdapter = treeAdapter; - this.bookmark = null; -}; - -//Entry types -FormattingElementList.MARKER_ENTRY = 'MARKER_ENTRY'; -FormattingElementList.ELEMENT_ENTRY = 'ELEMENT_ENTRY'; - -//Noah Ark's condition -//OPTIMIZATION: at first we try to find possible candidates for exclusion using -//lightweight heuristics without thorough attributes check. -FormattingElementList.prototype._getNoahArkConditionCandidates = function (newElement) { - var candidates = []; - - if (this.length >= NOAH_ARK_CAPACITY) { - var neAttrsLength = this.treeAdapter.getAttrList(newElement).length, - neTagName = this.treeAdapter.getTagName(newElement), - neNamespaceURI = this.treeAdapter.getNamespaceURI(newElement); - - for (var i = this.length - 1; i >= 0; i--) { - var entry = this.entries[i]; - - if (entry.type === FormattingElementList.MARKER_ENTRY) - break; - - var element = entry.element, - elementAttrs = this.treeAdapter.getAttrList(element), - isCandidate = this.treeAdapter.getTagName(element) === neTagName && - this.treeAdapter.getNamespaceURI(element) === neNamespaceURI && - elementAttrs.length === neAttrsLength; - - if (isCandidate) - candidates.push({idx: i, attrs: elementAttrs}); - } - } - - return candidates.length < NOAH_ARK_CAPACITY ? [] : candidates; -}; - -FormattingElementList.prototype._ensureNoahArkCondition = function (newElement) { - var candidates = this._getNoahArkConditionCandidates(newElement), - cLength = candidates.length; - - if (cLength) { - var neAttrs = this.treeAdapter.getAttrList(newElement), - neAttrsLength = neAttrs.length, - neAttrsMap = Object.create(null); - - //NOTE: build attrs map for the new element so we can perform fast lookups - for (var i = 0; i < neAttrsLength; i++) { - var neAttr = neAttrs[i]; - - neAttrsMap[neAttr.name] = neAttr.value; - } - - for (i = 0; i < neAttrsLength; i++) { - for (var j = 0; j < cLength; j++) { - var cAttr = candidates[j].attrs[i]; - - if (neAttrsMap[cAttr.name] !== cAttr.value) { - candidates.splice(j, 1); - cLength--; - } - - if (candidates.length < NOAH_ARK_CAPACITY) - return; - } - } - - //NOTE: remove bottommost candidates until Noah's Ark condition will not be met - for (i = cLength - 1; i >= NOAH_ARK_CAPACITY - 1; i--) { - this.entries.splice(candidates[i].idx, 1); - this.length--; - } - } -}; - -//Mutations -FormattingElementList.prototype.insertMarker = function () { - this.entries.push({type: FormattingElementList.MARKER_ENTRY}); - this.length++; -}; - -FormattingElementList.prototype.pushElement = function (element, token) { - this._ensureNoahArkCondition(element); - - this.entries.push({ - type: FormattingElementList.ELEMENT_ENTRY, - element: element, - token: token - }); - - this.length++; -}; - -FormattingElementList.prototype.insertElementAfterBookmark = function (element, token) { - var bookmarkIdx = this.length - 1; - - for (; bookmarkIdx >= 0; bookmarkIdx--) { - if (this.entries[bookmarkIdx] === this.bookmark) - break; - } - - this.entries.splice(bookmarkIdx + 1, 0, { - type: FormattingElementList.ELEMENT_ENTRY, - element: element, - token: token - }); - - this.length++; -}; - -FormattingElementList.prototype.removeEntry = function (entry) { - for (var i = this.length - 1; i >= 0; i--) { - if (this.entries[i] === entry) { - this.entries.splice(i, 1); - this.length--; - break; - } - } -}; - -FormattingElementList.prototype.clearToLastMarker = function () { - while (this.length) { - var entry = this.entries.pop(); - - this.length--; - - if (entry.type === FormattingElementList.MARKER_ENTRY) - break; - } -}; - -//Search -FormattingElementList.prototype.getElementEntryInScopeWithTagName = function (tagName) { - for (var i = this.length - 1; i >= 0; i--) { - var entry = this.entries[i]; - - if (entry.type === FormattingElementList.MARKER_ENTRY) - return null; - - if (this.treeAdapter.getTagName(entry.element) === tagName) - return entry; - } - - return null; -}; - -FormattingElementList.prototype.getElementEntry = function (element) { - for (var i = this.length - 1; i >= 0; i--) { - var entry = this.entries[i]; - - if (entry.type === FormattingElementList.ELEMENT_ENTRY && entry.element === element) - return entry; - } - - return null; -}; - - -/***/ }), -/* 113 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -var ParserStream = __webpack_require__(52), - inherits = __webpack_require__(24).inherits, - $ = __webpack_require__(11).TAG_NAMES; - -var PlainTextConversionStream = module.exports = function (options) { - ParserStream.call(this, options); - - // NOTE: see https://html.spec.whatwg.org/#read-text - this.parser._insertFakeElement($.HTML); - this.parser._insertFakeElement($.HEAD); - this.parser.openElements.pop(); - this.parser._insertFakeElement($.BODY); - this.parser._insertFakeElement($.PRE); - this.parser.treeAdapter.insertText(this.parser.openElements.current, '\n'); - this.parser.switchToPlaintextParsing(); -}; - -inherits(PlainTextConversionStream, ParserStream); - - -/***/ }), -/* 114 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -var WritableStream = __webpack_require__(31).Writable, - util = __webpack_require__(24); - -var DevNullStream = module.exports = function () { - WritableStream.call(this); -}; - -util.inherits(DevNullStream, WritableStream); - -DevNullStream.prototype._write = function (chunk, encoding, cb) { - cb(); -}; - - -/***/ }), -/* 115 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -var TransformStream = __webpack_require__(31).Transform, - DevNullStream = __webpack_require__(114), - inherits = __webpack_require__(24).inherits, - Tokenizer = __webpack_require__(19), - ParserFeedbackSimulator = __webpack_require__(116), - mergeOptions = __webpack_require__(34); - -var DEFAULT_OPTIONS = { - locationInfo: false -}; - -var SAXParser = module.exports = function (options) { - TransformStream.call(this); - - this.options = mergeOptions(DEFAULT_OPTIONS, options); - - this.tokenizer = new Tokenizer(options); - this.parserFeedbackSimulator = new ParserFeedbackSimulator(this.tokenizer); - - this.pendingText = null; - this.currentTokenLocation = void 0; - - this.lastChunkWritten = false; - this.stopped = false; - - // NOTE: always pipe stream to the /dev/null stream to avoid - // `highWaterMark` hit even if we don't have consumers. - // (see: https://github.com/inikulin/parse5/issues/97#issuecomment-171940774) - this.pipe(new DevNullStream()); -}; - -inherits(SAXParser, TransformStream); - -//TransformStream implementation -SAXParser.prototype._transform = function (chunk, encoding, callback) { - if (!this.stopped) { - this.tokenizer.write(chunk.toString('utf8'), this.lastChunkWritten); - this._runParsingLoop(); - } - - this.push(chunk); - - callback(); -}; - -SAXParser.prototype._flush = function (callback) { - callback(); -}; - -SAXParser.prototype.end = function (chunk, encoding, callback) { - this.lastChunkWritten = true; - TransformStream.prototype.end.call(this, chunk, encoding, callback); -}; - -SAXParser.prototype.stop = function () { - this.stopped = true; -}; - -//Internals -SAXParser.prototype._runParsingLoop = function () { - do { - var token = this.parserFeedbackSimulator.getNextToken(); - - if (token.type === Tokenizer.HIBERNATION_TOKEN) - break; - - if (token.type === Tokenizer.CHARACTER_TOKEN || - token.type === Tokenizer.WHITESPACE_CHARACTER_TOKEN || - token.type === Tokenizer.NULL_CHARACTER_TOKEN) { - - if (this.options.locationInfo) { - if (this.pendingText === null) - this.currentTokenLocation = token.location; - - else - this.currentTokenLocation.endOffset = token.location.endOffset; - } - - this.pendingText = (this.pendingText || '') + token.chars; - } - - else { - this._emitPendingText(); - this._handleToken(token); - } - } while (!this.stopped && token.type !== Tokenizer.EOF_TOKEN); -}; - -SAXParser.prototype._handleToken = function (token) { - if (this.options.locationInfo) - this.currentTokenLocation = token.location; - - if (token.type === Tokenizer.START_TAG_TOKEN) - this.emit('startTag', token.tagName, token.attrs, token.selfClosing, this.currentTokenLocation); - - else if (token.type === Tokenizer.END_TAG_TOKEN) - this.emit('endTag', token.tagName, this.currentTokenLocation); - - else if (token.type === Tokenizer.COMMENT_TOKEN) - this.emit('comment', token.data, this.currentTokenLocation); - - else if (token.type === Tokenizer.DOCTYPE_TOKEN) - this.emit('doctype', token.name, token.publicId, token.systemId, this.currentTokenLocation); -}; - -SAXParser.prototype._emitPendingText = function () { - if (this.pendingText !== null) { - this.emit('text', this.pendingText, this.currentTokenLocation); - this.pendingText = null; - } -}; - - -/***/ }), -/* 116 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -var Tokenizer = __webpack_require__(19), - foreignContent = __webpack_require__(49), - UNICODE = __webpack_require__(18), - HTML = __webpack_require__(11); - - -//Aliases -var $ = HTML.TAG_NAMES, - NS = HTML.NAMESPACES; - - -//ParserFeedbackSimulator -//Simulates adjustment of the Tokenizer which performed by standard parser during tree construction. -var ParserFeedbackSimulator = module.exports = function (tokenizer) { - this.tokenizer = tokenizer; - - this.namespaceStack = []; - this.namespaceStackTop = -1; - this._enterNamespace(NS.HTML); -}; - -ParserFeedbackSimulator.prototype.getNextToken = function () { - var token = this.tokenizer.getNextToken(); - - if (token.type === Tokenizer.START_TAG_TOKEN) - this._handleStartTagToken(token); - - else if (token.type === Tokenizer.END_TAG_TOKEN) - this._handleEndTagToken(token); - - else if (token.type === Tokenizer.NULL_CHARACTER_TOKEN && this.inForeignContent) { - token.type = Tokenizer.CHARACTER_TOKEN; - token.chars = UNICODE.REPLACEMENT_CHARACTER; - } - - else if (this.skipNextNewLine) { - if (token.type !== Tokenizer.HIBERNATION_TOKEN) - this.skipNextNewLine = false; - - if (token.type === Tokenizer.WHITESPACE_CHARACTER_TOKEN && token.chars[0] === '\n') { - if (token.chars.length === 1) - return this.getNextToken(); - - token.chars = token.chars.substr(1); - } - } - - return token; -}; - -//Namespace stack mutations -ParserFeedbackSimulator.prototype._enterNamespace = function (namespace) { - this.namespaceStackTop++; - this.namespaceStack.push(namespace); - - this.inForeignContent = namespace !== NS.HTML; - this.currentNamespace = namespace; - this.tokenizer.allowCDATA = this.inForeignContent; -}; - -ParserFeedbackSimulator.prototype._leaveCurrentNamespace = function () { - this.namespaceStackTop--; - this.namespaceStack.pop(); - - this.currentNamespace = this.namespaceStack[this.namespaceStackTop]; - this.inForeignContent = this.currentNamespace !== NS.HTML; - this.tokenizer.allowCDATA = this.inForeignContent; -}; - -//Token handlers -ParserFeedbackSimulator.prototype._ensureTokenizerMode = function (tn) { - if (tn === $.TEXTAREA || tn === $.TITLE) - this.tokenizer.state = Tokenizer.MODE.RCDATA; - - else if (tn === $.PLAINTEXT) - this.tokenizer.state = Tokenizer.MODE.PLAINTEXT; - - else if (tn === $.SCRIPT) - this.tokenizer.state = Tokenizer.MODE.SCRIPT_DATA; - - else if (tn === $.STYLE || tn === $.IFRAME || tn === $.XMP || - tn === $.NOEMBED || tn === $.NOFRAMES || tn === $.NOSCRIPT) - this.tokenizer.state = Tokenizer.MODE.RAWTEXT; -}; - -ParserFeedbackSimulator.prototype._handleStartTagToken = function (token) { - var tn = token.tagName; - - if (tn === $.SVG) - this._enterNamespace(NS.SVG); - - else if (tn === $.MATH) - this._enterNamespace(NS.MATHML); - - if (this.inForeignContent) { - if (foreignContent.causesExit(token)) { - this._leaveCurrentNamespace(); - return; - } - - var currentNs = this.currentNamespace; - - if (currentNs === NS.MATHML) - foreignContent.adjustTokenMathMLAttrs(token); - - else if (currentNs === NS.SVG) { - foreignContent.adjustTokenSVGTagName(token); - foreignContent.adjustTokenSVGAttrs(token); - } - - foreignContent.adjustTokenXMLAttrs(token); - - tn = token.tagName; - - if (!token.selfClosing && foreignContent.isIntegrationPoint(tn, currentNs, token.attrs)) - this._enterNamespace(NS.HTML); - } - - else { - if (tn === $.PRE || tn === $.TEXTAREA || tn === $.LISTING) - this.skipNextNewLine = true; - - else if (tn === $.IMAGE) - token.tagName = $.IMG; - - this._ensureTokenizerMode(tn); - } -}; - -ParserFeedbackSimulator.prototype._handleEndTagToken = function (token) { - var tn = token.tagName; - - if (!this.inForeignContent) { - var previousNs = this.namespaceStack[this.namespaceStackTop - 1]; - - if (previousNs === NS.SVG && foreignContent.SVG_TAG_NAMES_ADJUSTMENT_MAP[tn]) - tn = foreignContent.SVG_TAG_NAMES_ADJUSTMENT_MAP[tn]; - - //NOTE: check for exit from integration point - if (foreignContent.isIntegrationPoint(tn, previousNs, token.attrs)) - this._leaveCurrentNamespace(); - } - - else if (tn === $.SVG && this.currentNamespace === NS.SVG || - tn === $.MATH && this.currentNamespace === NS.MATHML) - this._leaveCurrentNamespace(); - - // NOTE: adjust end tag name as well for consistency - if (this.currentNamespace === NS.SVG) - foreignContent.adjustTokenSVGTagName(token); -}; - - -/***/ }), -/* 117 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -var ReadableStream = __webpack_require__(31).Readable, - inherits = __webpack_require__(24).inherits, - Serializer = __webpack_require__(53); - -var SerializerStream = module.exports = function (node, options) { - ReadableStream.call(this); - - this.serializer = new Serializer(node, options); - - Object.defineProperty(this.serializer, 'html', { - //NOTE: To make `+=` concat operator work properly we define - //getter which always returns empty string - get: function () { - return ''; - }, - set: this.push.bind(this) - }); -}; - -inherits(SerializerStream, ReadableStream); - -//Readable stream implementation -SerializerStream.prototype._read = function () { - this.serializer.serialize(); - this.push(null); -}; - - -/***/ }), -/* 118 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -//NOTE: this file contains auto-generated array mapped radix tree that is used for the named entity references consumption -//(details: https://github.com/inikulin/parse5/tree/master/scripts/generate_named_entity_data/README.md) -module.exports = new Uint16Array([4,52,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,106,303,412,810,1432,1701,1796,1987,2114,2360,2420,2484,3170,3251,4140,4393,4575,4610,5106,5512,5728,6117,6274,6315,6345,6427,6516,7002,7910,8733,9323,9870,10170,10631,10893,11318,11386,11467,12773,13092,14474,14922,15448,15542,16419,17666,18166,18611,19004,19095,19298,19397,4,16,69,77,97,98,99,102,103,108,109,110,111,112,114,115,116,117,140,150,158,169,176,194,199,210,216,222,226,242,256,266,283,294,108,105,103,5,198,1,59,148,1,198,80,5,38,1,59,156,1,38,99,117,116,101,5,193,1,59,167,1,193,114,101,118,101,59,1,258,4,2,105,121,182,191,114,99,5,194,1,59,189,1,194,59,1,1040,114,59,3,55349,56580,114,97,118,101,5,192,1,59,208,1,192,112,104,97,59,1,913,97,99,114,59,1,256,100,59,1,10835,4,2,103,112,232,237,111,110,59,1,260,102,59,3,55349,56632,112,108,121,70,117,110,99,116,105,111,110,59,1,8289,105,110,103,5,197,1,59,264,1,197,4,2,99,115,272,277,114,59,3,55349,56476,105,103,110,59,1,8788,105,108,100,101,5,195,1,59,292,1,195,109,108,5,196,1,59,301,1,196,4,8,97,99,101,102,111,114,115,117,321,350,354,383,388,394,400,405,4,2,99,114,327,336,107,115,108,97,115,104,59,1,8726,4,2,118,119,342,345,59,1,10983,101,100,59,1,8966,121,59,1,1041,4,3,99,114,116,362,369,379,97,117,115,101,59,1,8757,110,111,117,108,108,105,115,59,1,8492,97,59,1,914,114,59,3,55349,56581,112,102,59,3,55349,56633,101,118,101,59,1,728,99,114,59,1,8492,109,112,101,113,59,1,8782,4,14,72,79,97,99,100,101,102,104,105,108,111,114,115,117,442,447,456,504,542,547,569,573,577,616,678,784,790,796,99,121,59,1,1063,80,89,5,169,1,59,454,1,169,4,3,99,112,121,464,470,497,117,116,101,59,1,262,4,2,59,105,476,478,1,8914,116,97,108,68,105,102,102,101,114,101,110,116,105,97,108,68,59,1,8517,108,101,121,115,59,1,8493,4,4,97,101,105,111,514,520,530,535,114,111,110,59,1,268,100,105,108,5,199,1,59,528,1,199,114,99,59,1,264,110,105,110,116,59,1,8752,111,116,59,1,266,4,2,100,110,553,560,105,108,108,97,59,1,184,116,101,114,68,111,116,59,1,183,114,59,1,8493,105,59,1,935,114,99,108,101,4,4,68,77,80,84,591,596,603,609,111,116,59,1,8857,105,110,117,115,59,1,8854,108,117,115,59,1,8853,105,109,101,115,59,1,8855,111,4,2,99,115,623,646,107,119,105,115,101,67,111,110,116,111,117,114,73,110,116,101,103,114,97,108,59,1,8754,101,67,117,114,108,121,4,2,68,81,658,671,111,117,98,108,101,81,117,111,116,101,59,1,8221,117,111,116,101,59,1,8217,4,4,108,110,112,117,688,701,736,753,111,110,4,2,59,101,696,698,1,8759,59,1,10868,4,3,103,105,116,709,717,722,114,117,101,110,116,59,1,8801,110,116,59,1,8751,111,117,114,73,110,116,101,103,114,97,108,59,1,8750,4,2,102,114,742,745,59,1,8450,111,100,117,99,116,59,1,8720,110,116,101,114,67,108,111,99,107,119,105,115,101,67,111,110,116,111,117,114,73,110,116,101,103,114,97,108,59,1,8755,111,115,115,59,1,10799,99,114,59,3,55349,56478,112,4,2,59,67,803,805,1,8915,97,112,59,1,8781,4,11,68,74,83,90,97,99,101,102,105,111,115,834,850,855,860,865,888,903,916,921,1011,1415,4,2,59,111,840,842,1,8517,116,114,97,104,100,59,1,10513,99,121,59,1,1026,99,121,59,1,1029,99,121,59,1,1039,4,3,103,114,115,873,879,883,103,101,114,59,1,8225,114,59,1,8609,104,118,59,1,10980,4,2,97,121,894,900,114,111,110,59,1,270,59,1,1044,108,4,2,59,116,910,912,1,8711,97,59,1,916,114,59,3,55349,56583,4,2,97,102,927,998,4,2,99,109,933,992,114,105,116,105,99,97,108,4,4,65,68,71,84,950,957,978,985,99,117,116,101,59,1,180,111,4,2,116,117,964,967,59,1,729,98,108,101,65,99,117,116,101,59,1,733,114,97,118,101,59,1,96,105,108,100,101,59,1,732,111,110,100,59,1,8900,102,101,114,101,110,116,105,97,108,68,59,1,8518,4,4,112,116,117,119,1021,1026,1048,1249,102,59,3,55349,56635,4,3,59,68,69,1034,1036,1041,1,168,111,116,59,1,8412,113,117,97,108,59,1,8784,98,108,101,4,6,67,68,76,82,85,86,1065,1082,1101,1189,1211,1236,111,110,116,111,117,114,73,110,116,101,103,114,97,108,59,1,8751,111,4,2,116,119,1089,1092,59,1,168,110,65,114,114,111,119,59,1,8659,4,2,101,111,1107,1141,102,116,4,3,65,82,84,1117,1124,1136,114,114,111,119,59,1,8656,105,103,104,116,65,114,114,111,119,59,1,8660,101,101,59,1,10980,110,103,4,2,76,82,1149,1177,101,102,116,4,2,65,82,1158,1165,114,114,111,119,59,1,10232,105,103,104,116,65,114,114,111,119,59,1,10234,105,103,104,116,65,114,114,111,119,59,1,10233,105,103,104,116,4,2,65,84,1199,1206,114,114,111,119,59,1,8658,101,101,59,1,8872,112,4,2,65,68,1218,1225,114,114,111,119,59,1,8657,111,119,110,65,114,114,111,119,59,1,8661,101,114,116,105,99,97,108,66,97,114,59,1,8741,110,4,6,65,66,76,82,84,97,1264,1292,1299,1352,1391,1408,114,114,111,119,4,3,59,66,85,1276,1278,1283,1,8595,97,114,59,1,10515,112,65,114,114,111,119,59,1,8693,114,101,118,101,59,1,785,101,102,116,4,3,82,84,86,1310,1323,1334,105,103,104,116,86,101,99,116,111,114,59,1,10576,101,101,86,101,99,116,111,114,59,1,10590,101,99,116,111,114,4,2,59,66,1345,1347,1,8637,97,114,59,1,10582,105,103,104,116,4,2,84,86,1362,1373,101,101,86,101,99,116,111,114,59,1,10591,101,99,116,111,114,4,2,59,66,1384,1386,1,8641,97,114,59,1,10583,101,101,4,2,59,65,1399,1401,1,8868,114,114,111,119,59,1,8615,114,114,111,119,59,1,8659,4,2,99,116,1421,1426,114,59,3,55349,56479,114,111,107,59,1,272,4,16,78,84,97,99,100,102,103,108,109,111,112,113,115,116,117,120,1466,1470,1478,1489,1515,1520,1525,1536,1544,1593,1609,1617,1650,1664,1668,1677,71,59,1,330,72,5,208,1,59,1476,1,208,99,117,116,101,5,201,1,59,1487,1,201,4,3,97,105,121,1497,1503,1512,114,111,110,59,1,282,114,99,5,202,1,59,1510,1,202,59,1,1069,111,116,59,1,278,114,59,3,55349,56584,114,97,118,101,5,200,1,59,1534,1,200,101,109,101,110,116,59,1,8712,4,2,97,112,1550,1555,99,114,59,1,274,116,121,4,2,83,86,1563,1576,109,97,108,108,83,113,117,97,114,101,59,1,9723,101,114,121,83,109,97,108,108,83,113,117,97,114,101,59,1,9643,4,2,103,112,1599,1604,111,110,59,1,280,102,59,3,55349,56636,115,105,108,111,110,59,1,917,117,4,2,97,105,1624,1640,108,4,2,59,84,1631,1633,1,10869,105,108,100,101,59,1,8770,108,105,98,114,105,117,109,59,1,8652,4,2,99,105,1656,1660,114,59,1,8496,109,59,1,10867,97,59,1,919,109,108,5,203,1,59,1675,1,203,4,2,105,112,1683,1689,115,116,115,59,1,8707,111,110,101,110,116,105,97,108,69,59,1,8519,4,5,99,102,105,111,115,1713,1717,1722,1762,1791,121,59,1,1060,114,59,3,55349,56585,108,108,101,100,4,2,83,86,1732,1745,109,97,108,108,83,113,117,97,114,101,59,1,9724,101,114,121,83,109,97,108,108,83,113,117,97,114,101,59,1,9642,4,3,112,114,117,1770,1775,1781,102,59,3,55349,56637,65,108,108,59,1,8704,114,105,101,114,116,114,102,59,1,8497,99,114,59,1,8497,4,12,74,84,97,98,99,100,102,103,111,114,115,116,1822,1827,1834,1848,1855,1877,1882,1887,1890,1896,1978,1984,99,121,59,1,1027,5,62,1,59,1832,1,62,109,109,97,4,2,59,100,1843,1845,1,915,59,1,988,114,101,118,101,59,1,286,4,3,101,105,121,1863,1869,1874,100,105,108,59,1,290,114,99,59,1,284,59,1,1043,111,116,59,1,288,114,59,3,55349,56586,59,1,8921,112,102,59,3,55349,56638,101,97,116,101,114,4,6,69,70,71,76,83,84,1915,1933,1944,1953,1959,1971,113,117,97,108,4,2,59,76,1925,1927,1,8805,101,115,115,59,1,8923,117,108,108,69,113,117,97,108,59,1,8807,114,101,97,116,101,114,59,1,10914,101,115,115,59,1,8823,108,97,110,116,69,113,117,97,108,59,1,10878,105,108,100,101,59,1,8819,99,114,59,3,55349,56482,59,1,8811,4,8,65,97,99,102,105,111,115,117,2005,2012,2026,2032,2036,2049,2073,2089,82,68,99,121,59,1,1066,4,2,99,116,2018,2023,101,107,59,1,711,59,1,94,105,114,99,59,1,292,114,59,1,8460,108,98,101,114,116,83,112,97,99,101,59,1,8459,4,2,112,114,2055,2059,102,59,1,8461,105,122,111,110,116,97,108,76,105,110,101,59,1,9472,4,2,99,116,2079,2083,114,59,1,8459,114,111,107,59,1,294,109,112,4,2,68,69,2097,2107,111,119,110,72,117,109,112,59,1,8782,113,117,97,108,59,1,8783,4,14,69,74,79,97,99,100,102,103,109,110,111,115,116,117,2144,2149,2155,2160,2171,2189,2194,2198,2209,2245,2307,2329,2334,2341,99,121,59,1,1045,108,105,103,59,1,306,99,121,59,1,1025,99,117,116,101,5,205,1,59,2169,1,205,4,2,105,121,2177,2186,114,99,5,206,1,59,2184,1,206,59,1,1048,111,116,59,1,304,114,59,1,8465,114,97,118,101,5,204,1,59,2207,1,204,4,3,59,97,112,2217,2219,2238,1,8465,4,2,99,103,2225,2229,114,59,1,298,105,110,97,114,121,73,59,1,8520,108,105,101,115,59,1,8658,4,2,116,118,2251,2281,4,2,59,101,2257,2259,1,8748,4,2,103,114,2265,2271,114,97,108,59,1,8747,115,101,99,116,105,111,110,59,1,8898,105,115,105,98,108,101,4,2,67,84,2293,2300,111,109,109,97,59,1,8291,105,109,101,115,59,1,8290,4,3,103,112,116,2315,2320,2325,111,110,59,1,302,102,59,3,55349,56640,97,59,1,921,99,114,59,1,8464,105,108,100,101,59,1,296,4,2,107,109,2347,2352,99,121,59,1,1030,108,5,207,1,59,2358,1,207,4,5,99,102,111,115,117,2372,2386,2391,2397,2414,4,2,105,121,2378,2383,114,99,59,1,308,59,1,1049,114,59,3,55349,56589,112,102,59,3,55349,56641,4,2,99,101,2403,2408,114,59,3,55349,56485,114,99,121,59,1,1032,107,99,121,59,1,1028,4,7,72,74,97,99,102,111,115,2436,2441,2446,2452,2467,2472,2478,99,121,59,1,1061,99,121,59,1,1036,112,112,97,59,1,922,4,2,101,121,2458,2464,100,105,108,59,1,310,59,1,1050,114,59,3,55349,56590,112,102,59,3,55349,56642,99,114,59,3,55349,56486,4,11,74,84,97,99,101,102,108,109,111,115,116,2508,2513,2520,2562,2585,2981,2986,3004,3011,3146,3167,99,121,59,1,1033,5,60,1,59,2518,1,60,4,5,99,109,110,112,114,2532,2538,2544,2548,2558,117,116,101,59,1,313,98,100,97,59,1,923,103,59,1,10218,108,97,99,101,116,114,102,59,1,8466,114,59,1,8606,4,3,97,101,121,2570,2576,2582,114,111,110,59,1,317,100,105,108,59,1,315,59,1,1051,4,2,102,115,2591,2907,116,4,10,65,67,68,70,82,84,85,86,97,114,2614,2663,2672,2728,2735,2760,2820,2870,2888,2895,4,2,110,114,2620,2633,103,108,101,66,114,97,99,107,101,116,59,1,10216,114,111,119,4,3,59,66,82,2644,2646,2651,1,8592,97,114,59,1,8676,105,103,104,116,65,114,114,111,119,59,1,8646,101,105,108,105,110,103,59,1,8968,111,4,2,117,119,2679,2692,98,108,101,66,114,97,99,107,101,116,59,1,10214,110,4,2,84,86,2699,2710,101,101,86,101,99,116,111,114,59,1,10593,101,99,116,111,114,4,2,59,66,2721,2723,1,8643,97,114,59,1,10585,108,111,111,114,59,1,8970,105,103,104,116,4,2,65,86,2745,2752,114,114,111,119,59,1,8596,101,99,116,111,114,59,1,10574,4,2,101,114,2766,2792,101,4,3,59,65,86,2775,2777,2784,1,8867,114,114,111,119,59,1,8612,101,99,116,111,114,59,1,10586,105,97,110,103,108,101,4,3,59,66,69,2806,2808,2813,1,8882,97,114,59,1,10703,113,117,97,108,59,1,8884,112,4,3,68,84,86,2829,2841,2852,111,119,110,86,101,99,116,111,114,59,1,10577,101,101,86,101,99,116,111,114,59,1,10592,101,99,116,111,114,4,2,59,66,2863,2865,1,8639,97,114,59,1,10584,101,99,116,111,114,4,2,59,66,2881,2883,1,8636,97,114,59,1,10578,114,114,111,119,59,1,8656,105,103,104,116,97,114,114,111,119,59,1,8660,115,4,6,69,70,71,76,83,84,2922,2936,2947,2956,2962,2974,113,117,97,108,71,114,101,97,116,101,114,59,1,8922,117,108,108,69,113,117,97,108,59,1,8806,114,101,97,116,101,114,59,1,8822,101,115,115,59,1,10913,108,97,110,116,69,113,117,97,108,59,1,10877,105,108,100,101,59,1,8818,114,59,3,55349,56591,4,2,59,101,2992,2994,1,8920,102,116,97,114,114,111,119,59,1,8666,105,100,111,116,59,1,319,4,3,110,112,119,3019,3110,3115,103,4,4,76,82,108,114,3030,3058,3070,3098,101,102,116,4,2,65,82,3039,3046,114,114,111,119,59,1,10229,105,103,104,116,65,114,114,111,119,59,1,10231,105,103,104,116,65,114,114,111,119,59,1,10230,101,102,116,4,2,97,114,3079,3086,114,114,111,119,59,1,10232,105,103,104,116,97,114,114,111,119,59,1,10234,105,103,104,116,97,114,114,111,119,59,1,10233,102,59,3,55349,56643,101,114,4,2,76,82,3123,3134,101,102,116,65,114,114,111,119,59,1,8601,105,103,104,116,65,114,114,111,119,59,1,8600,4,3,99,104,116,3154,3158,3161,114,59,1,8466,59,1,8624,114,111,107,59,1,321,59,1,8810,4,8,97,99,101,102,105,111,115,117,3188,3192,3196,3222,3227,3237,3243,3248,112,59,1,10501,121,59,1,1052,4,2,100,108,3202,3213,105,117,109,83,112,97,99,101,59,1,8287,108,105,110,116,114,102,59,1,8499,114,59,3,55349,56592,110,117,115,80,108,117,115,59,1,8723,112,102,59,3,55349,56644,99,114,59,1,8499,59,1,924,4,9,74,97,99,101,102,111,115,116,117,3271,3276,3283,3306,3422,3427,4120,4126,4137,99,121,59,1,1034,99,117,116,101,59,1,323,4,3,97,101,121,3291,3297,3303,114,111,110,59,1,327,100,105,108,59,1,325,59,1,1053,4,3,103,115,119,3314,3380,3415,97,116,105,118,101,4,3,77,84,86,3327,3340,3365,101,100,105,117,109,83,112,97,99,101,59,1,8203,104,105,4,2,99,110,3348,3357,107,83,112,97,99,101,59,1,8203,83,112,97,99,101,59,1,8203,101,114,121,84,104,105,110,83,112,97,99,101,59,1,8203,116,101,100,4,2,71,76,3389,3405,114,101,97,116,101,114,71,114,101,97,116,101,114,59,1,8811,101,115,115,76,101,115,115,59,1,8810,76,105,110,101,59,1,10,114,59,3,55349,56593,4,4,66,110,112,116,3437,3444,3460,3464,114,101,97,107,59,1,8288,66,114,101,97,107,105,110,103,83,112,97,99,101,59,1,160,102,59,1,8469,4,13,59,67,68,69,71,72,76,78,80,82,83,84,86,3492,3494,3517,3536,3578,3657,3685,3784,3823,3860,3915,4066,4107,1,10988,4,2,111,117,3500,3510,110,103,114,117,101,110,116,59,1,8802,112,67,97,112,59,1,8813,111,117,98,108,101,86,101,114,116,105,99,97,108,66,97,114,59,1,8742,4,3,108,113,120,3544,3552,3571,101,109,101,110,116,59,1,8713,117,97,108,4,2,59,84,3561,3563,1,8800,105,108,100,101,59,3,8770,824,105,115,116,115,59,1,8708,114,101,97,116,101,114,4,7,59,69,70,71,76,83,84,3600,3602,3609,3621,3631,3637,3650,1,8815,113,117,97,108,59,1,8817,117,108,108,69,113,117,97,108,59,3,8807,824,114,101,97,116,101,114,59,3,8811,824,101,115,115,59,1,8825,108,97,110,116,69,113,117,97,108,59,3,10878,824,105,108,100,101,59,1,8821,117,109,112,4,2,68,69,3666,3677,111,119,110,72,117,109,112,59,3,8782,824,113,117,97,108,59,3,8783,824,101,4,2,102,115,3692,3724,116,84,114,105,97,110,103,108,101,4,3,59,66,69,3709,3711,3717,1,8938,97,114,59,3,10703,824,113,117,97,108,59,1,8940,115,4,6,59,69,71,76,83,84,3739,3741,3748,3757,3764,3777,1,8814,113,117,97,108,59,1,8816,114,101,97,116,101,114,59,1,8824,101,115,115,59,3,8810,824,108,97,110,116,69,113,117,97,108,59,3,10877,824,105,108,100,101,59,1,8820,101,115,116,101,100,4,2,71,76,3795,3812,114,101,97,116,101,114,71,114,101,97,116,101,114,59,3,10914,824,101,115,115,76,101,115,115,59,3,10913,824,114,101,99,101,100,101,115,4,3,59,69,83,3838,3840,3848,1,8832,113,117,97,108,59,3,10927,824,108,97,110,116,69,113,117,97,108,59,1,8928,4,2,101,105,3866,3881,118,101,114,115,101,69,108,101,109,101,110,116,59,1,8716,103,104,116,84,114,105,97,110,103,108,101,4,3,59,66,69,3900,3902,3908,1,8939,97,114,59,3,10704,824,113,117,97,108,59,1,8941,4,2,113,117,3921,3973,117,97,114,101,83,117,4,2,98,112,3933,3952,115,101,116,4,2,59,69,3942,3945,3,8847,824,113,117,97,108,59,1,8930,101,114,115,101,116,4,2,59,69,3963,3966,3,8848,824,113,117,97,108,59,1,8931,4,3,98,99,112,3981,4000,4045,115,101,116,4,2,59,69,3990,3993,3,8834,8402,113,117,97,108,59,1,8840,99,101,101,100,115,4,4,59,69,83,84,4015,4017,4025,4037,1,8833,113,117,97,108,59,3,10928,824,108,97,110,116,69,113,117,97,108,59,1,8929,105,108,100,101,59,3,8831,824,101,114,115,101,116,4,2,59,69,4056,4059,3,8835,8402,113,117,97,108,59,1,8841,105,108,100,101,4,4,59,69,70,84,4080,4082,4089,4100,1,8769,113,117,97,108,59,1,8772,117,108,108,69,113,117,97,108,59,1,8775,105,108,100,101,59,1,8777,101,114,116,105,99,97,108,66,97,114,59,1,8740,99,114,59,3,55349,56489,105,108,100,101,5,209,1,59,4135,1,209,59,1,925,4,14,69,97,99,100,102,103,109,111,112,114,115,116,117,118,4170,4176,4187,4205,4212,4217,4228,4253,4259,4292,4295,4316,4337,4346,108,105,103,59,1,338,99,117,116,101,5,211,1,59,4185,1,211,4,2,105,121,4193,4202,114,99,5,212,1,59,4200,1,212,59,1,1054,98,108,97,99,59,1,336,114,59,3,55349,56594,114,97,118,101,5,210,1,59,4226,1,210,4,3,97,101,105,4236,4241,4246,99,114,59,1,332,103,97,59,1,937,99,114,111,110,59,1,927,112,102,59,3,55349,56646,101,110,67,117,114,108,121,4,2,68,81,4272,4285,111,117,98,108,101,81,117,111,116,101,59,1,8220,117,111,116,101,59,1,8216,59,1,10836,4,2,99,108,4301,4306,114,59,3,55349,56490,97,115,104,5,216,1,59,4314,1,216,105,4,2,108,109,4323,4332,100,101,5,213,1,59,4330,1,213,101,115,59,1,10807,109,108,5,214,1,59,4344,1,214,101,114,4,2,66,80,4354,4380,4,2,97,114,4360,4364,114,59,1,8254,97,99,4,2,101,107,4372,4375,59,1,9182,101,116,59,1,9140,97,114,101,110,116,104,101,115,105,115,59,1,9180,4,9,97,99,102,104,105,108,111,114,115,4413,4422,4426,4431,4435,4438,4448,4471,4561,114,116,105,97,108,68,59,1,8706,121,59,1,1055,114,59,3,55349,56595,105,59,1,934,59,1,928,117,115,77,105,110,117,115,59,1,177,4,2,105,112,4454,4467,110,99,97,114,101,112,108,97,110,101,59,1,8460,102,59,1,8473,4,4,59,101,105,111,4481,4483,4526,4531,1,10939,99,101,100,101,115,4,4,59,69,83,84,4498,4500,4507,4519,1,8826,113,117,97,108,59,1,10927,108,97,110,116,69,113,117,97,108,59,1,8828,105,108,100,101,59,1,8830,109,101,59,1,8243,4,2,100,112,4537,4543,117,99,116,59,1,8719,111,114,116,105,111,110,4,2,59,97,4555,4557,1,8759,108,59,1,8733,4,2,99,105,4567,4572,114,59,3,55349,56491,59,1,936,4,4,85,102,111,115,4585,4594,4599,4604,79,84,5,34,1,59,4592,1,34,114,59,3,55349,56596,112,102,59,1,8474,99,114,59,3,55349,56492,4,12,66,69,97,99,101,102,104,105,111,114,115,117,4636,4642,4650,4681,4704,4763,4767,4771,5047,5069,5081,5094,97,114,114,59,1,10512,71,5,174,1,59,4648,1,174,4,3,99,110,114,4658,4664,4668,117,116,101,59,1,340,103,59,1,10219,114,4,2,59,116,4675,4677,1,8608,108,59,1,10518,4,3,97,101,121,4689,4695,4701,114,111,110,59,1,344,100,105,108,59,1,342,59,1,1056,4,2,59,118,4710,4712,1,8476,101,114,115,101,4,2,69,85,4722,4748,4,2,108,113,4728,4736,101,109,101,110,116,59,1,8715,117,105,108,105,98,114,105,117,109,59,1,8651,112,69,113,117,105,108,105,98,114,105,117,109,59,1,10607,114,59,1,8476,111,59,1,929,103,104,116,4,8,65,67,68,70,84,85,86,97,4792,4840,4849,4905,4912,4972,5022,5040,4,2,110,114,4798,4811,103,108,101,66,114,97,99,107,101,116,59,1,10217,114,111,119,4,3,59,66,76,4822,4824,4829,1,8594,97,114,59,1,8677,101,102,116,65,114,114,111,119,59,1,8644,101,105,108,105,110,103,59,1,8969,111,4,2,117,119,4856,4869,98,108,101,66,114,97,99,107,101,116,59,1,10215,110,4,2,84,86,4876,4887,101,101,86,101,99,116,111,114,59,1,10589,101,99,116,111,114,4,2,59,66,4898,4900,1,8642,97,114,59,1,10581,108,111,111,114,59,1,8971,4,2,101,114,4918,4944,101,4,3,59,65,86,4927,4929,4936,1,8866,114,114,111,119,59,1,8614,101,99,116,111,114,59,1,10587,105,97,110,103,108,101,4,3,59,66,69,4958,4960,4965,1,8883,97,114,59,1,10704,113,117,97,108,59,1,8885,112,4,3,68,84,86,4981,4993,5004,111,119,110,86,101,99,116,111,114,59,1,10575,101,101,86,101,99,116,111,114,59,1,10588,101,99,116,111,114,4,2,59,66,5015,5017,1,8638,97,114,59,1,10580,101,99,116,111,114,4,2,59,66,5033,5035,1,8640,97,114,59,1,10579,114,114,111,119,59,1,8658,4,2,112,117,5053,5057,102,59,1,8477,110,100,73,109,112,108,105,101,115,59,1,10608,105,103,104,116,97,114,114,111,119,59,1,8667,4,2,99,104,5087,5091,114,59,1,8475,59,1,8625,108,101,68,101,108,97,121,101,100,59,1,10740,4,13,72,79,97,99,102,104,105,109,111,113,115,116,117,5134,5150,5157,5164,5198,5203,5259,5265,5277,5283,5374,5380,5385,4,2,67,99,5140,5146,72,99,121,59,1,1065,121,59,1,1064,70,84,99,121,59,1,1068,99,117,116,101,59,1,346,4,5,59,97,101,105,121,5176,5178,5184,5190,5195,1,10940,114,111,110,59,1,352,100,105,108,59,1,350,114,99,59,1,348,59,1,1057,114,59,3,55349,56598,111,114,116,4,4,68,76,82,85,5216,5227,5238,5250,111,119,110,65,114,114,111,119,59,1,8595,101,102,116,65,114,114,111,119,59,1,8592,105,103,104,116,65,114,114,111,119,59,1,8594,112,65,114,114,111,119,59,1,8593,103,109,97,59,1,931,97,108,108,67,105,114,99,108,101,59,1,8728,112,102,59,3,55349,56650,4,2,114,117,5289,5293,116,59,1,8730,97,114,101,4,4,59,73,83,85,5306,5308,5322,5367,1,9633,110,116,101,114,115,101,99,116,105,111,110,59,1,8851,117,4,2,98,112,5329,5347,115,101,116,4,2,59,69,5338,5340,1,8847,113,117,97,108,59,1,8849,101,114,115,101,116,4,2,59,69,5358,5360,1,8848,113,117,97,108,59,1,8850,110,105,111,110,59,1,8852,99,114,59,3,55349,56494,97,114,59,1,8902,4,4,98,99,109,112,5395,5420,5475,5478,4,2,59,115,5401,5403,1,8912,101,116,4,2,59,69,5411,5413,1,8912,113,117,97,108,59,1,8838,4,2,99,104,5426,5468,101,101,100,115,4,4,59,69,83,84,5440,5442,5449,5461,1,8827,113,117,97,108,59,1,10928,108,97,110,116,69,113,117,97,108,59,1,8829,105,108,100,101,59,1,8831,84,104,97,116,59,1,8715,59,1,8721,4,3,59,101,115,5486,5488,5507,1,8913,114,115,101,116,4,2,59,69,5498,5500,1,8835,113,117,97,108,59,1,8839,101,116,59,1,8913,4,11,72,82,83,97,99,102,104,105,111,114,115,5536,5546,5552,5567,5579,5602,5607,5655,5695,5701,5711,79,82,78,5,222,1,59,5544,1,222,65,68,69,59,1,8482,4,2,72,99,5558,5563,99,121,59,1,1035,121,59,1,1062,4,2,98,117,5573,5576,59,1,9,59,1,932,4,3,97,101,121,5587,5593,5599,114,111,110,59,1,356,100,105,108,59,1,354,59,1,1058,114,59,3,55349,56599,4,2,101,105,5613,5631,4,2,114,116,5619,5627,101,102,111,114,101,59,1,8756,97,59,1,920,4,2,99,110,5637,5647,107,83,112,97,99,101,59,3,8287,8202,83,112,97,99,101,59,1,8201,108,100,101,4,4,59,69,70,84,5668,5670,5677,5688,1,8764,113,117,97,108,59,1,8771,117,108,108,69,113,117,97,108,59,1,8773,105,108,100,101,59,1,8776,112,102,59,3,55349,56651,105,112,108,101,68,111,116,59,1,8411,4,2,99,116,5717,5722,114,59,3,55349,56495,114,111,107,59,1,358,4,14,97,98,99,100,102,103,109,110,111,112,114,115,116,117,5758,5789,5805,5823,5830,5835,5846,5852,5921,5937,6089,6095,6101,6108,4,2,99,114,5764,5774,117,116,101,5,218,1,59,5772,1,218,114,4,2,59,111,5781,5783,1,8607,99,105,114,59,1,10569,114,4,2,99,101,5796,5800,121,59,1,1038,118,101,59,1,364,4,2,105,121,5811,5820,114,99,5,219,1,59,5818,1,219,59,1,1059,98,108,97,99,59,1,368,114,59,3,55349,56600,114,97,118,101,5,217,1,59,5844,1,217,97,99,114,59,1,362,4,2,100,105,5858,5905,101,114,4,2,66,80,5866,5892,4,2,97,114,5872,5876,114,59,1,95,97,99,4,2,101,107,5884,5887,59,1,9183,101,116,59,1,9141,97,114,101,110,116,104,101,115,105,115,59,1,9181,111,110,4,2,59,80,5913,5915,1,8899,108,117,115,59,1,8846,4,2,103,112,5927,5932,111,110,59,1,370,102,59,3,55349,56652,4,8,65,68,69,84,97,100,112,115,5955,5985,5996,6009,6026,6033,6044,6075,114,114,111,119,4,3,59,66,68,5967,5969,5974,1,8593,97,114,59,1,10514,111,119,110,65,114,114,111,119,59,1,8645,111,119,110,65,114,114,111,119,59,1,8597,113,117,105,108,105,98,114,105,117,109,59,1,10606,101,101,4,2,59,65,6017,6019,1,8869,114,114,111,119,59,1,8613,114,114,111,119,59,1,8657,111,119,110,97,114,114,111,119,59,1,8661,101,114,4,2,76,82,6052,6063,101,102,116,65,114,114,111,119,59,1,8598,105,103,104,116,65,114,114,111,119,59,1,8599,105,4,2,59,108,6082,6084,1,978,111,110,59,1,933,105,110,103,59,1,366,99,114,59,3,55349,56496,105,108,100,101,59,1,360,109,108,5,220,1,59,6115,1,220,4,9,68,98,99,100,101,102,111,115,118,6137,6143,6148,6152,6166,6250,6255,6261,6267,97,115,104,59,1,8875,97,114,59,1,10987,121,59,1,1042,97,115,104,4,2,59,108,6161,6163,1,8873,59,1,10982,4,2,101,114,6172,6175,59,1,8897,4,3,98,116,121,6183,6188,6238,97,114,59,1,8214,4,2,59,105,6194,6196,1,8214,99,97,108,4,4,66,76,83,84,6209,6214,6220,6231,97,114,59,1,8739,105,110,101,59,1,124,101,112,97,114,97,116,111,114,59,1,10072,105,108,100,101,59,1,8768,84,104,105,110,83,112,97,99,101,59,1,8202,114,59,3,55349,56601,112,102,59,3,55349,56653,99,114,59,3,55349,56497,100,97,115,104,59,1,8874,4,5,99,101,102,111,115,6286,6292,6298,6303,6309,105,114,99,59,1,372,100,103,101,59,1,8896,114,59,3,55349,56602,112,102,59,3,55349,56654,99,114,59,3,55349,56498,4,4,102,105,111,115,6325,6330,6333,6339,114,59,3,55349,56603,59,1,926,112,102,59,3,55349,56655,99,114,59,3,55349,56499,4,9,65,73,85,97,99,102,111,115,117,6365,6370,6375,6380,6391,6405,6410,6416,6422,99,121,59,1,1071,99,121,59,1,1031,99,121,59,1,1070,99,117,116,101,5,221,1,59,6389,1,221,4,2,105,121,6397,6402,114,99,59,1,374,59,1,1067,114,59,3,55349,56604,112,102,59,3,55349,56656,99,114,59,3,55349,56500,109,108,59,1,376,4,8,72,97,99,100,101,102,111,115,6445,6450,6457,6472,6477,6501,6505,6510,99,121,59,1,1046,99,117,116,101,59,1,377,4,2,97,121,6463,6469,114,111,110,59,1,381,59,1,1047,111,116,59,1,379,4,2,114,116,6483,6497,111,87,105,100,116,104,83,112,97,99,101,59,1,8203,97,59,1,918,114,59,1,8488,112,102,59,1,8484,99,114,59,3,55349,56501,4,16,97,98,99,101,102,103,108,109,110,111,112,114,115,116,117,119,6550,6561,6568,6612,6622,6634,6645,6672,6699,6854,6870,6923,6933,6963,6974,6983,99,117,116,101,5,225,1,59,6559,1,225,114,101,118,101,59,1,259,4,6,59,69,100,105,117,121,6582,6584,6588,6591,6600,6609,1,8766,59,3,8766,819,59,1,8767,114,99,5,226,1,59,6598,1,226,116,101,5,180,1,59,6607,1,180,59,1,1072,108,105,103,5,230,1,59,6620,1,230,4,2,59,114,6628,6630,1,8289,59,3,55349,56606,114,97,118,101,5,224,1,59,6643,1,224,4,2,101,112,6651,6667,4,2,102,112,6657,6663,115,121,109,59,1,8501,104,59,1,8501,104,97,59,1,945,4,2,97,112,6678,6692,4,2,99,108,6684,6688,114,59,1,257,103,59,1,10815,5,38,1,59,6697,1,38,4,2,100,103,6705,6737,4,5,59,97,100,115,118,6717,6719,6724,6727,6734,1,8743,110,100,59,1,10837,59,1,10844,108,111,112,101,59,1,10840,59,1,10842,4,7,59,101,108,109,114,115,122,6753,6755,6758,6762,6814,6835,6848,1,8736,59,1,10660,101,59,1,8736,115,100,4,2,59,97,6770,6772,1,8737,4,8,97,98,99,100,101,102,103,104,6790,6793,6796,6799,6802,6805,6808,6811,59,1,10664,59,1,10665,59,1,10666,59,1,10667,59,1,10668,59,1,10669,59,1,10670,59,1,10671,116,4,2,59,118,6821,6823,1,8735,98,4,2,59,100,6830,6832,1,8894,59,1,10653,4,2,112,116,6841,6845,104,59,1,8738,59,1,197,97,114,114,59,1,9084,4,2,103,112,6860,6865,111,110,59,1,261,102,59,3,55349,56658,4,7,59,69,97,101,105,111,112,6886,6888,6891,6897,6900,6904,6908,1,8776,59,1,10864,99,105,114,59,1,10863,59,1,8778,100,59,1,8779,115,59,1,39,114,111,120,4,2,59,101,6917,6919,1,8776,113,59,1,8778,105,110,103,5,229,1,59,6931,1,229,4,3,99,116,121,6941,6946,6949,114,59,3,55349,56502,59,1,42,109,112,4,2,59,101,6957,6959,1,8776,113,59,1,8781,105,108,100,101,5,227,1,59,6972,1,227,109,108,5,228,1,59,6981,1,228,4,2,99,105,6989,6997,111,110,105,110,116,59,1,8755,110,116,59,1,10769,4,16,78,97,98,99,100,101,102,105,107,108,110,111,112,114,115,117,7036,7041,7119,7135,7149,7155,7219,7224,7347,7354,7463,7489,7786,7793,7814,7866,111,116,59,1,10989,4,2,99,114,7047,7094,107,4,4,99,101,112,115,7058,7064,7073,7080,111,110,103,59,1,8780,112,115,105,108,111,110,59,1,1014,114,105,109,101,59,1,8245,105,109,4,2,59,101,7088,7090,1,8765,113,59,1,8909,4,2,118,119,7100,7105,101,101,59,1,8893,101,100,4,2,59,103,7113,7115,1,8965,101,59,1,8965,114,107,4,2,59,116,7127,7129,1,9141,98,114,107,59,1,9142,4,2,111,121,7141,7146,110,103,59,1,8780,59,1,1073,113,117,111,59,1,8222,4,5,99,109,112,114,116,7167,7181,7188,7193,7199,97,117,115,4,2,59,101,7176,7178,1,8757,59,1,8757,112,116,121,118,59,1,10672,115,105,59,1,1014,110,111,117,59,1,8492,4,3,97,104,119,7207,7210,7213,59,1,946,59,1,8502,101,101,110,59,1,8812,114,59,3,55349,56607,103,4,7,99,111,115,116,117,118,119,7241,7262,7288,7305,7328,7335,7340,4,3,97,105,117,7249,7253,7258,112,59,1,8898,114,99,59,1,9711,112,59,1,8899,4,3,100,112,116,7270,7275,7281,111,116,59,1,10752,108,117,115,59,1,10753,105,109,101,115,59,1,10754,4,2,113,116,7294,7300,99,117,112,59,1,10758,97,114,59,1,9733,114,105,97,110,103,108,101,4,2,100,117,7318,7324,111,119,110,59,1,9661,112,59,1,9651,112,108,117,115,59,1,10756,101,101,59,1,8897,101,100,103,101,59,1,8896,97,114,111,119,59,1,10509,4,3,97,107,111,7362,7436,7458,4,2,99,110,7368,7432,107,4,3,108,115,116,7377,7386,7394,111,122,101,110,103,101,59,1,10731,113,117,97,114,101,59,1,9642,114,105,97,110,103,108,101,4,4,59,100,108,114,7411,7413,7419,7425,1,9652,111,119,110,59,1,9662,101,102,116,59,1,9666,105,103,104,116,59,1,9656,107,59,1,9251,4,2,49,51,7442,7454,4,2,50,52,7448,7451,59,1,9618,59,1,9617,52,59,1,9619,99,107,59,1,9608,4,2,101,111,7469,7485,4,2,59,113,7475,7478,3,61,8421,117,105,118,59,3,8801,8421,116,59,1,8976,4,4,112,116,119,120,7499,7504,7517,7523,102,59,3,55349,56659,4,2,59,116,7510,7512,1,8869,111,109,59,1,8869,116,105,101,59,1,8904,4,12,68,72,85,86,98,100,104,109,112,116,117,118,7549,7571,7597,7619,7655,7660,7682,7708,7715,7721,7728,7750,4,4,76,82,108,114,7559,7562,7565,7568,59,1,9559,59,1,9556,59,1,9558,59,1,9555,4,5,59,68,85,100,117,7583,7585,7588,7591,7594,1,9552,59,1,9574,59,1,9577,59,1,9572,59,1,9575,4,4,76,82,108,114,7607,7610,7613,7616,59,1,9565,59,1,9562,59,1,9564,59,1,9561,4,7,59,72,76,82,104,108,114,7635,7637,7640,7643,7646,7649,7652,1,9553,59,1,9580,59,1,9571,59,1,9568,59,1,9579,59,1,9570,59,1,9567,111,120,59,1,10697,4,4,76,82,108,114,7670,7673,7676,7679,59,1,9557,59,1,9554,59,1,9488,59,1,9484,4,5,59,68,85,100,117,7694,7696,7699,7702,7705,1,9472,59,1,9573,59,1,9576,59,1,9516,59,1,9524,105,110,117,115,59,1,8863,108,117,115,59,1,8862,105,109,101,115,59,1,8864,4,4,76,82,108,114,7738,7741,7744,7747,59,1,9563,59,1,9560,59,1,9496,59,1,9492,4,7,59,72,76,82,104,108,114,7766,7768,7771,7774,7777,7780,7783,1,9474,59,1,9578,59,1,9569,59,1,9566,59,1,9532,59,1,9508,59,1,9500,114,105,109,101,59,1,8245,4,2,101,118,7799,7804,118,101,59,1,728,98,97,114,5,166,1,59,7812,1,166,4,4,99,101,105,111,7824,7829,7834,7846,114,59,3,55349,56503,109,105,59,1,8271,109,4,2,59,101,7841,7843,1,8765,59,1,8909,108,4,3,59,98,104,7855,7857,7860,1,92,59,1,10693,115,117,98,59,1,10184,4,2,108,109,7872,7885,108,4,2,59,101,7879,7881,1,8226,116,59,1,8226,112,4,3,59,69,101,7894,7896,7899,1,8782,59,1,10926,4,2,59,113,7905,7907,1,8783,59,1,8783,4,15,97,99,100,101,102,104,105,108,111,114,115,116,117,119,121,7942,8021,8075,8080,8121,8126,8157,8279,8295,8430,8446,8485,8491,8707,8726,4,3,99,112,114,7950,7956,8007,117,116,101,59,1,263,4,6,59,97,98,99,100,115,7970,7972,7977,7984,7998,8003,1,8745,110,100,59,1,10820,114,99,117,112,59,1,10825,4,2,97,117,7990,7994,112,59,1,10827,112,59,1,10823,111,116,59,1,10816,59,3,8745,65024,4,2,101,111,8013,8017,116,59,1,8257,110,59,1,711,4,4,97,101,105,117,8031,8046,8056,8061,4,2,112,114,8037,8041,115,59,1,10829,111,110,59,1,269,100,105,108,5,231,1,59,8054,1,231,114,99,59,1,265,112,115,4,2,59,115,8069,8071,1,10828,109,59,1,10832,111,116,59,1,267,4,3,100,109,110,8088,8097,8104,105,108,5,184,1,59,8095,1,184,112,116,121,118,59,1,10674,116,5,162,2,59,101,8112,8114,1,162,114,100,111,116,59,1,183,114,59,3,55349,56608,4,3,99,101,105,8134,8138,8154,121,59,1,1095,99,107,4,2,59,109,8146,8148,1,10003,97,114,107,59,1,10003,59,1,967,114,4,7,59,69,99,101,102,109,115,8174,8176,8179,8258,8261,8268,8273,1,9675,59,1,10691,4,3,59,101,108,8187,8189,8193,1,710,113,59,1,8791,101,4,2,97,100,8200,8223,114,114,111,119,4,2,108,114,8210,8216,101,102,116,59,1,8634,105,103,104,116,59,1,8635,4,5,82,83,97,99,100,8235,8238,8241,8246,8252,59,1,174,59,1,9416,115,116,59,1,8859,105,114,99,59,1,8858,97,115,104,59,1,8861,59,1,8791,110,105,110,116,59,1,10768,105,100,59,1,10991,99,105,114,59,1,10690,117,98,115,4,2,59,117,8288,8290,1,9827,105,116,59,1,9827,4,4,108,109,110,112,8305,8326,8376,8400,111,110,4,2,59,101,8313,8315,1,58,4,2,59,113,8321,8323,1,8788,59,1,8788,4,2,109,112,8332,8344,97,4,2,59,116,8339,8341,1,44,59,1,64,4,3,59,102,108,8352,8354,8358,1,8705,110,59,1,8728,101,4,2,109,120,8365,8371,101,110,116,59,1,8705,101,115,59,1,8450,4,2,103,105,8382,8395,4,2,59,100,8388,8390,1,8773,111,116,59,1,10861,110,116,59,1,8750,4,3,102,114,121,8408,8412,8417,59,3,55349,56660,111,100,59,1,8720,5,169,2,59,115,8424,8426,1,169,114,59,1,8471,4,2,97,111,8436,8441,114,114,59,1,8629,115,115,59,1,10007,4,2,99,117,8452,8457,114,59,3,55349,56504,4,2,98,112,8463,8474,4,2,59,101,8469,8471,1,10959,59,1,10961,4,2,59,101,8480,8482,1,10960,59,1,10962,100,111,116,59,1,8943,4,7,100,101,108,112,114,118,119,8507,8522,8536,8550,8600,8697,8702,97,114,114,4,2,108,114,8516,8519,59,1,10552,59,1,10549,4,2,112,115,8528,8532,114,59,1,8926,99,59,1,8927,97,114,114,4,2,59,112,8545,8547,1,8630,59,1,10557,4,6,59,98,99,100,111,115,8564,8566,8573,8587,8592,8596,1,8746,114,99,97,112,59,1,10824,4,2,97,117,8579,8583,112,59,1,10822,112,59,1,10826,111,116,59,1,8845,114,59,1,10821,59,3,8746,65024,4,4,97,108,114,118,8610,8623,8663,8672,114,114,4,2,59,109,8618,8620,1,8631,59,1,10556,121,4,3,101,118,119,8632,8651,8656,113,4,2,112,115,8639,8645,114,101,99,59,1,8926,117,99,99,59,1,8927,101,101,59,1,8910,101,100,103,101,59,1,8911,101,110,5,164,1,59,8670,1,164,101,97,114,114,111,119,4,2,108,114,8684,8690,101,102,116,59,1,8630,105,103,104,116,59,1,8631,101,101,59,1,8910,101,100,59,1,8911,4,2,99,105,8713,8721,111,110,105,110,116,59,1,8754,110,116,59,1,8753,108,99,116,121,59,1,9005,4,19,65,72,97,98,99,100,101,102,104,105,106,108,111,114,115,116,117,119,122,8773,8778,8783,8821,8839,8854,8887,8914,8930,8944,9036,9041,9058,9197,9227,9258,9281,9297,9305,114,114,59,1,8659,97,114,59,1,10597,4,4,103,108,114,115,8793,8799,8805,8809,103,101,114,59,1,8224,101,116,104,59,1,8504,114,59,1,8595,104,4,2,59,118,8816,8818,1,8208,59,1,8867,4,2,107,108,8827,8834,97,114,111,119,59,1,10511,97,99,59,1,733,4,2,97,121,8845,8851,114,111,110,59,1,271,59,1,1076,4,3,59,97,111,8862,8864,8880,1,8518,4,2,103,114,8870,8876,103,101,114,59,1,8225,114,59,1,8650,116,115,101,113,59,1,10871,4,3,103,108,109,8895,8902,8907,5,176,1,59,8900,1,176,116,97,59,1,948,112,116,121,118,59,1,10673,4,2,105,114,8920,8926,115,104,116,59,1,10623,59,3,55349,56609,97,114,4,2,108,114,8938,8941,59,1,8643,59,1,8642,4,5,97,101,103,115,118,8956,8986,8989,8996,9001,109,4,3,59,111,115,8965,8967,8983,1,8900,110,100,4,2,59,115,8975,8977,1,8900,117,105,116,59,1,9830,59,1,9830,59,1,168,97,109,109,97,59,1,989,105,110,59,1,8946,4,3,59,105,111,9009,9011,9031,1,247,100,101,5,247,2,59,111,9020,9022,1,247,110,116,105,109,101,115,59,1,8903,110,120,59,1,8903,99,121,59,1,1106,99,4,2,111,114,9048,9053,114,110,59,1,8990,111,112,59,1,8973,4,5,108,112,116,117,119,9070,9076,9081,9130,9144,108,97,114,59,1,36,102,59,3,55349,56661,4,5,59,101,109,112,115,9093,9095,9109,9116,9122,1,729,113,4,2,59,100,9102,9104,1,8784,111,116,59,1,8785,105,110,117,115,59,1,8760,108,117,115,59,1,8724,113,117,97,114,101,59,1,8865,98,108,101,98,97,114,119,101,100,103,101,59,1,8966,110,4,3,97,100,104,9153,9160,9172,114,114,111,119,59,1,8595,111,119,110,97,114,114,111,119,115,59,1,8650,97,114,112,111,111,110,4,2,108,114,9184,9190,101,102,116,59,1,8643,105,103,104,116,59,1,8642,4,2,98,99,9203,9211,107,97,114,111,119,59,1,10512,4,2,111,114,9217,9222,114,110,59,1,8991,111,112,59,1,8972,4,3,99,111,116,9235,9248,9252,4,2,114,121,9241,9245,59,3,55349,56505,59,1,1109,108,59,1,10742,114,111,107,59,1,273,4,2,100,114,9264,9269,111,116,59,1,8945,105,4,2,59,102,9276,9278,1,9663,59,1,9662,4,2,97,104,9287,9292,114,114,59,1,8693,97,114,59,1,10607,97,110,103,108,101,59,1,10662,4,2,99,105,9311,9315,121,59,1,1119,103,114,97,114,114,59,1,10239,4,18,68,97,99,100,101,102,103,108,109,110,111,112,113,114,115,116,117,120,9361,9376,9398,9439,9444,9447,9462,9495,9531,9585,9598,9614,9659,9755,9771,9792,9808,9826,4,2,68,111,9367,9372,111,116,59,1,10871,116,59,1,8785,4,2,99,115,9382,9392,117,116,101,5,233,1,59,9390,1,233,116,101,114,59,1,10862,4,4,97,105,111,121,9408,9414,9430,9436,114,111,110,59,1,283,114,4,2,59,99,9421,9423,1,8790,5,234,1,59,9428,1,234,108,111,110,59,1,8789,59,1,1101,111,116,59,1,279,59,1,8519,4,2,68,114,9453,9458,111,116,59,1,8786,59,3,55349,56610,4,3,59,114,115,9470,9472,9482,1,10906,97,118,101,5,232,1,59,9480,1,232,4,2,59,100,9488,9490,1,10902,111,116,59,1,10904,4,4,59,105,108,115,9505,9507,9515,9518,1,10905,110,116,101,114,115,59,1,9191,59,1,8467,4,2,59,100,9524,9526,1,10901,111,116,59,1,10903,4,3,97,112,115,9539,9544,9564,99,114,59,1,275,116,121,4,3,59,115,118,9554,9556,9561,1,8709,101,116,59,1,8709,59,1,8709,112,4,2,49,59,9571,9583,4,2,51,52,9577,9580,59,1,8196,59,1,8197,1,8195,4,2,103,115,9591,9594,59,1,331,112,59,1,8194,4,2,103,112,9604,9609,111,110,59,1,281,102,59,3,55349,56662,4,3,97,108,115,9622,9635,9640,114,4,2,59,115,9629,9631,1,8917,108,59,1,10723,117,115,59,1,10865,105,4,3,59,108,118,9649,9651,9656,1,949,111,110,59,1,949,59,1,1013,4,4,99,115,117,118,9669,9686,9716,9747,4,2,105,111,9675,9680,114,99,59,1,8790,108,111,110,59,1,8789,4,2,105,108,9692,9696,109,59,1,8770,97,110,116,4,2,103,108,9705,9710,116,114,59,1,10902,101,115,115,59,1,10901,4,3,97,101,105,9724,9729,9734,108,115,59,1,61,115,116,59,1,8799,118,4,2,59,68,9741,9743,1,8801,68,59,1,10872,112,97,114,115,108,59,1,10725,4,2,68,97,9761,9766,111,116,59,1,8787,114,114,59,1,10609,4,3,99,100,105,9779,9783,9788,114,59,1,8495,111,116,59,1,8784,109,59,1,8770,4,2,97,104,9798,9801,59,1,951,5,240,1,59,9806,1,240,4,2,109,114,9814,9822,108,5,235,1,59,9820,1,235,111,59,1,8364,4,3,99,105,112,9834,9838,9843,108,59,1,33,115,116,59,1,8707,4,2,101,111,9849,9859,99,116,97,116,105,111,110,59,1,8496,110,101,110,116,105,97,108,101,59,1,8519,4,12,97,99,101,102,105,106,108,110,111,112,114,115,9896,9910,9914,9921,9954,9960,9967,9989,9994,10027,10036,10164,108,108,105,110,103,100,111,116,115,101,113,59,1,8786,121,59,1,1092,109,97,108,101,59,1,9792,4,3,105,108,114,9929,9935,9950,108,105,103,59,1,64259,4,2,105,108,9941,9945,103,59,1,64256,105,103,59,1,64260,59,3,55349,56611,108,105,103,59,1,64257,108,105,103,59,3,102,106,4,3,97,108,116,9975,9979,9984,116,59,1,9837,105,103,59,1,64258,110,115,59,1,9649,111,102,59,1,402,4,2,112,114,10000,10005,102,59,3,55349,56663,4,2,97,107,10011,10016,108,108,59,1,8704,4,2,59,118,10022,10024,1,8916,59,1,10969,97,114,116,105,110,116,59,1,10765,4,2,97,111,10042,10159,4,2,99,115,10048,10155,4,6,49,50,51,52,53,55,10062,10102,10114,10135,10139,10151,4,6,50,51,52,53,54,56,10076,10083,10086,10093,10096,10099,5,189,1,59,10081,1,189,59,1,8531,5,188,1,59,10091,1,188,59,1,8533,59,1,8537,59,1,8539,4,2,51,53,10108,10111,59,1,8532,59,1,8534,4,3,52,53,56,10122,10129,10132,5,190,1,59,10127,1,190,59,1,8535,59,1,8540,53,59,1,8536,4,2,54,56,10145,10148,59,1,8538,59,1,8541,56,59,1,8542,108,59,1,8260,119,110,59,1,8994,99,114,59,3,55349,56507,4,17,69,97,98,99,100,101,102,103,105,106,108,110,111,114,115,116,118,10206,10217,10247,10254,10268,10273,10358,10363,10374,10380,10385,10406,10458,10464,10470,10497,10610,4,2,59,108,10212,10214,1,8807,59,1,10892,4,3,99,109,112,10225,10231,10244,117,116,101,59,1,501,109,97,4,2,59,100,10239,10241,1,947,59,1,989,59,1,10886,114,101,118,101,59,1,287,4,2,105,121,10260,10265,114,99,59,1,285,59,1,1075,111,116,59,1,289,4,4,59,108,113,115,10283,10285,10288,10308,1,8805,59,1,8923,4,3,59,113,115,10296,10298,10301,1,8805,59,1,8807,108,97,110,116,59,1,10878,4,4,59,99,100,108,10318,10320,10324,10345,1,10878,99,59,1,10921,111,116,4,2,59,111,10332,10334,1,10880,4,2,59,108,10340,10342,1,10882,59,1,10884,4,2,59,101,10351,10354,3,8923,65024,115,59,1,10900,114,59,3,55349,56612,4,2,59,103,10369,10371,1,8811,59,1,8921,109,101,108,59,1,8503,99,121,59,1,1107,4,4,59,69,97,106,10395,10397,10400,10403,1,8823,59,1,10898,59,1,10917,59,1,10916,4,4,69,97,101,115,10416,10419,10434,10453,59,1,8809,112,4,2,59,112,10426,10428,1,10890,114,111,120,59,1,10890,4,2,59,113,10440,10442,1,10888,4,2,59,113,10448,10450,1,10888,59,1,8809,105,109,59,1,8935,112,102,59,3,55349,56664,97,118,101,59,1,96,4,2,99,105,10476,10480,114,59,1,8458,109,4,3,59,101,108,10489,10491,10494,1,8819,59,1,10894,59,1,10896,5,62,6,59,99,100,108,113,114,10512,10514,10527,10532,10538,10545,1,62,4,2,99,105,10520,10523,59,1,10919,114,59,1,10874,111,116,59,1,8919,80,97,114,59,1,10645,117,101,115,116,59,1,10876,4,5,97,100,101,108,115,10557,10574,10579,10599,10605,4,2,112,114,10563,10570,112,114,111,120,59,1,10886,114,59,1,10616,111,116,59,1,8919,113,4,2,108,113,10586,10592,101,115,115,59,1,8923,108,101,115,115,59,1,10892,101,115,115,59,1,8823,105,109,59,1,8819,4,2,101,110,10616,10626,114,116,110,101,113,113,59,3,8809,65024,69,59,3,8809,65024,4,10,65,97,98,99,101,102,107,111,115,121,10653,10658,10713,10718,10724,10760,10765,10786,10850,10875,114,114,59,1,8660,4,4,105,108,109,114,10668,10674,10678,10684,114,115,112,59,1,8202,102,59,1,189,105,108,116,59,1,8459,4,2,100,114,10690,10695,99,121,59,1,1098,4,3,59,99,119,10703,10705,10710,1,8596,105,114,59,1,10568,59,1,8621,97,114,59,1,8463,105,114,99,59,1,293,4,3,97,108,114,10732,10748,10754,114,116,115,4,2,59,117,10741,10743,1,9829,105,116,59,1,9829,108,105,112,59,1,8230,99,111,110,59,1,8889,114,59,3,55349,56613,115,4,2,101,119,10772,10779,97,114,111,119,59,1,10533,97,114,111,119,59,1,10534,4,5,97,109,111,112,114,10798,10803,10809,10839,10844,114,114,59,1,8703,116,104,116,59,1,8763,107,4,2,108,114,10816,10827,101,102,116,97,114,114,111,119,59,1,8617,105,103,104,116,97,114,114,111,119,59,1,8618,102,59,3,55349,56665,98,97,114,59,1,8213,4,3,99,108,116,10858,10863,10869,114,59,3,55349,56509,97,115,104,59,1,8463,114,111,107,59,1,295,4,2,98,112,10881,10887,117,108,108,59,1,8259,104,101,110,59,1,8208,4,15,97,99,101,102,103,105,106,109,110,111,112,113,115,116,117,10925,10936,10958,10977,10990,11001,11039,11045,11101,11192,11220,11226,11237,11285,11299,99,117,116,101,5,237,1,59,10934,1,237,4,3,59,105,121,10944,10946,10955,1,8291,114,99,5,238,1,59,10953,1,238,59,1,1080,4,2,99,120,10964,10968,121,59,1,1077,99,108,5,161,1,59,10975,1,161,4,2,102,114,10983,10986,59,1,8660,59,3,55349,56614,114,97,118,101,5,236,1,59,10999,1,236,4,4,59,105,110,111,11011,11013,11028,11034,1,8520,4,2,105,110,11019,11024,110,116,59,1,10764,116,59,1,8749,102,105,110,59,1,10716,116,97,59,1,8489,108,105,103,59,1,307,4,3,97,111,112,11053,11092,11096,4,3,99,103,116,11061,11065,11088,114,59,1,299,4,3,101,108,112,11073,11076,11082,59,1,8465,105,110,101,59,1,8464,97,114,116,59,1,8465,104,59,1,305,102,59,1,8887,101,100,59,1,437,4,5,59,99,102,111,116,11113,11115,11121,11136,11142,1,8712,97,114,101,59,1,8453,105,110,4,2,59,116,11129,11131,1,8734,105,101,59,1,10717,100,111,116,59,1,305,4,5,59,99,101,108,112,11154,11156,11161,11179,11186,1,8747,97,108,59,1,8890,4,2,103,114,11167,11173,101,114,115,59,1,8484,99,97,108,59,1,8890,97,114,104,107,59,1,10775,114,111,100,59,1,10812,4,4,99,103,112,116,11202,11206,11211,11216,121,59,1,1105,111,110,59,1,303,102,59,3,55349,56666,97,59,1,953,114,111,100,59,1,10812,117,101,115,116,5,191,1,59,11235,1,191,4,2,99,105,11243,11248,114,59,3,55349,56510,110,4,5,59,69,100,115,118,11261,11263,11266,11271,11282,1,8712,59,1,8953,111,116,59,1,8949,4,2,59,118,11277,11279,1,8948,59,1,8947,59,1,8712,4,2,59,105,11291,11293,1,8290,108,100,101,59,1,297,4,2,107,109,11305,11310,99,121,59,1,1110,108,5,239,1,59,11316,1,239,4,6,99,102,109,111,115,117,11332,11346,11351,11357,11363,11380,4,2,105,121,11338,11343,114,99,59,1,309,59,1,1081,114,59,3,55349,56615,97,116,104,59,1,567,112,102,59,3,55349,56667,4,2,99,101,11369,11374,114,59,3,55349,56511,114,99,121,59,1,1112,107,99,121,59,1,1108,4,8,97,99,102,103,104,106,111,115,11404,11418,11433,11438,11445,11450,11455,11461,112,112,97,4,2,59,118,11413,11415,1,954,59,1,1008,4,2,101,121,11424,11430,100,105,108,59,1,311,59,1,1082,114,59,3,55349,56616,114,101,101,110,59,1,312,99,121,59,1,1093,99,121,59,1,1116,112,102,59,3,55349,56668,99,114,59,3,55349,56512,4,23,65,66,69,72,97,98,99,100,101,102,103,104,106,108,109,110,111,112,114,115,116,117,118,11515,11538,11544,11555,11560,11721,11780,11818,11868,12136,12160,12171,12203,12208,12246,12275,12327,12509,12523,12569,12641,12732,12752,4,3,97,114,116,11523,11528,11532,114,114,59,1,8666,114,59,1,8656,97,105,108,59,1,10523,97,114,114,59,1,10510,4,2,59,103,11550,11552,1,8806,59,1,10891,97,114,59,1,10594,4,9,99,101,103,109,110,112,113,114,116,11580,11586,11594,11600,11606,11624,11627,11636,11694,117,116,101,59,1,314,109,112,116,121,118,59,1,10676,114,97,110,59,1,8466,98,100,97,59,1,955,103,4,3,59,100,108,11615,11617,11620,1,10216,59,1,10641,101,59,1,10216,59,1,10885,117,111,5,171,1,59,11634,1,171,114,4,8,59,98,102,104,108,112,115,116,11655,11657,11669,11673,11677,11681,11685,11690,1,8592,4,2,59,102,11663,11665,1,8676,115,59,1,10527,115,59,1,10525,107,59,1,8617,112,59,1,8619,108,59,1,10553,105,109,59,1,10611,108,59,1,8610,4,3,59,97,101,11702,11704,11709,1,10923,105,108,59,1,10521,4,2,59,115,11715,11717,1,10925,59,3,10925,65024,4,3,97,98,114,11729,11734,11739,114,114,59,1,10508,114,107,59,1,10098,4,2,97,107,11745,11758,99,4,2,101,107,11752,11755,59,1,123,59,1,91,4,2,101,115,11764,11767,59,1,10635,108,4,2,100,117,11774,11777,59,1,10639,59,1,10637,4,4,97,101,117,121,11790,11796,11811,11815,114,111,110,59,1,318,4,2,100,105,11802,11807,105,108,59,1,316,108,59,1,8968,98,59,1,123,59,1,1083,4,4,99,113,114,115,11828,11832,11845,11864,97,59,1,10550,117,111,4,2,59,114,11840,11842,1,8220,59,1,8222,4,2,100,117,11851,11857,104,97,114,59,1,10599,115,104,97,114,59,1,10571,104,59,1,8626,4,5,59,102,103,113,115,11880,11882,12008,12011,12031,1,8804,116,4,5,97,104,108,114,116,11895,11913,11935,11947,11996,114,114,111,119,4,2,59,116,11905,11907,1,8592,97,105,108,59,1,8610,97,114,112,111,111,110,4,2,100,117,11925,11931,111,119,110,59,1,8637,112,59,1,8636,101,102,116,97,114,114,111,119,115,59,1,8647,105,103,104,116,4,3,97,104,115,11959,11974,11984,114,114,111,119,4,2,59,115,11969,11971,1,8596,59,1,8646,97,114,112,111,111,110,115,59,1,8651,113,117,105,103,97,114,114,111,119,59,1,8621,104,114,101,101,116,105,109,101,115,59,1,8907,59,1,8922,4,3,59,113,115,12019,12021,12024,1,8804,59,1,8806,108,97,110,116,59,1,10877,4,5,59,99,100,103,115,12043,12045,12049,12070,12083,1,10877,99,59,1,10920,111,116,4,2,59,111,12057,12059,1,10879,4,2,59,114,12065,12067,1,10881,59,1,10883,4,2,59,101,12076,12079,3,8922,65024,115,59,1,10899,4,5,97,100,101,103,115,12095,12103,12108,12126,12131,112,112,114,111,120,59,1,10885,111,116,59,1,8918,113,4,2,103,113,12115,12120,116,114,59,1,8922,103,116,114,59,1,10891,116,114,59,1,8822,105,109,59,1,8818,4,3,105,108,114,12144,12150,12156,115,104,116,59,1,10620,111,111,114,59,1,8970,59,3,55349,56617,4,2,59,69,12166,12168,1,8822,59,1,10897,4,2,97,98,12177,12198,114,4,2,100,117,12184,12187,59,1,8637,4,2,59,108,12193,12195,1,8636,59,1,10602,108,107,59,1,9604,99,121,59,1,1113,4,5,59,97,99,104,116,12220,12222,12227,12235,12241,1,8810,114,114,59,1,8647,111,114,110,101,114,59,1,8990,97,114,100,59,1,10603,114,105,59,1,9722,4,2,105,111,12252,12258,100,111,116,59,1,320,117,115,116,4,2,59,97,12267,12269,1,9136,99,104,101,59,1,9136,4,4,69,97,101,115,12285,12288,12303,12322,59,1,8808,112,4,2,59,112,12295,12297,1,10889,114,111,120,59,1,10889,4,2,59,113,12309,12311,1,10887,4,2,59,113,12317,12319,1,10887,59,1,8808,105,109,59,1,8934,4,8,97,98,110,111,112,116,119,122,12345,12359,12364,12421,12446,12467,12474,12490,4,2,110,114,12351,12355,103,59,1,10220,114,59,1,8701,114,107,59,1,10214,103,4,3,108,109,114,12373,12401,12409,101,102,116,4,2,97,114,12382,12389,114,114,111,119,59,1,10229,105,103,104,116,97,114,114,111,119,59,1,10231,97,112,115,116,111,59,1,10236,105,103,104,116,97,114,114,111,119,59,1,10230,112,97,114,114,111,119,4,2,108,114,12433,12439,101,102,116,59,1,8619,105,103,104,116,59,1,8620,4,3,97,102,108,12454,12458,12462,114,59,1,10629,59,3,55349,56669,117,115,59,1,10797,105,109,101,115,59,1,10804,4,2,97,98,12480,12485,115,116,59,1,8727,97,114,59,1,95,4,3,59,101,102,12498,12500,12506,1,9674,110,103,101,59,1,9674,59,1,10731,97,114,4,2,59,108,12517,12519,1,40,116,59,1,10643,4,5,97,99,104,109,116,12535,12540,12548,12561,12564,114,114,59,1,8646,111,114,110,101,114,59,1,8991,97,114,4,2,59,100,12556,12558,1,8651,59,1,10605,59,1,8206,114,105,59,1,8895,4,6,97,99,104,105,113,116,12583,12589,12594,12597,12614,12635,113,117,111,59,1,8249,114,59,3,55349,56513,59,1,8624,109,4,3,59,101,103,12606,12608,12611,1,8818,59,1,10893,59,1,10895,4,2,98,117,12620,12623,59,1,91,111,4,2,59,114,12630,12632,1,8216,59,1,8218,114,111,107,59,1,322,5,60,8,59,99,100,104,105,108,113,114,12660,12662,12675,12680,12686,12692,12698,12705,1,60,4,2,99,105,12668,12671,59,1,10918,114,59,1,10873,111,116,59,1,8918,114,101,101,59,1,8907,109,101,115,59,1,8905,97,114,114,59,1,10614,117,101,115,116,59,1,10875,4,2,80,105,12711,12716,97,114,59,1,10646,4,3,59,101,102,12724,12726,12729,1,9667,59,1,8884,59,1,9666,114,4,2,100,117,12739,12746,115,104,97,114,59,1,10570,104,97,114,59,1,10598,4,2,101,110,12758,12768,114,116,110,101,113,113,59,3,8808,65024,69,59,3,8808,65024,4,14,68,97,99,100,101,102,104,105,108,110,111,112,115,117,12803,12809,12893,12908,12914,12928,12933,12937,13011,13025,13032,13049,13052,13069,68,111,116,59,1,8762,4,4,99,108,112,114,12819,12827,12849,12887,114,5,175,1,59,12825,1,175,4,2,101,116,12833,12836,59,1,9794,4,2,59,101,12842,12844,1,10016,115,101,59,1,10016,4,2,59,115,12855,12857,1,8614,116,111,4,4,59,100,108,117,12869,12871,12877,12883,1,8614,111,119,110,59,1,8615,101,102,116,59,1,8612,112,59,1,8613,107,101,114,59,1,9646,4,2,111,121,12899,12905,109,109,97,59,1,10793,59,1,1084,97,115,104,59,1,8212,97,115,117,114,101,100,97,110,103,108,101,59,1,8737,114,59,3,55349,56618,111,59,1,8487,4,3,99,100,110,12945,12954,12985,114,111,5,181,1,59,12952,1,181,4,4,59,97,99,100,12964,12966,12971,12976,1,8739,115,116,59,1,42,105,114,59,1,10992,111,116,5,183,1,59,12983,1,183,117,115,4,3,59,98,100,12995,12997,13000,1,8722,59,1,8863,4,2,59,117,13006,13008,1,8760,59,1,10794,4,2,99,100,13017,13021,112,59,1,10971,114,59,1,8230,112,108,117,115,59,1,8723,4,2,100,112,13038,13044,101,108,115,59,1,8871,102,59,3,55349,56670,59,1,8723,4,2,99,116,13058,13063,114,59,3,55349,56514,112,111,115,59,1,8766,4,3,59,108,109,13077,13079,13087,1,956,116,105,109,97,112,59,1,8888,97,112,59,1,8888,4,24,71,76,82,86,97,98,99,100,101,102,103,104,105,106,108,109,111,112,114,115,116,117,118,119,13142,13165,13217,13229,13247,13330,13359,13414,13420,13508,13513,13579,13602,13626,13631,13762,13767,13855,13936,13995,14214,14285,14312,14432,4,2,103,116,13148,13152,59,3,8921,824,4,2,59,118,13158,13161,3,8811,8402,59,3,8811,824,4,3,101,108,116,13173,13200,13204,102,116,4,2,97,114,13181,13188,114,114,111,119,59,1,8653,105,103,104,116,97,114,114,111,119,59,1,8654,59,3,8920,824,4,2,59,118,13210,13213,3,8810,8402,59,3,8810,824,105,103,104,116,97,114,114,111,119,59,1,8655,4,2,68,100,13235,13241,97,115,104,59,1,8879,97,115,104,59,1,8878,4,5,98,99,110,112,116,13259,13264,13270,13275,13308,108,97,59,1,8711,117,116,101,59,1,324,103,59,3,8736,8402,4,5,59,69,105,111,112,13287,13289,13293,13298,13302,1,8777,59,3,10864,824,100,59,3,8779,824,115,59,1,329,114,111,120,59,1,8777,117,114,4,2,59,97,13316,13318,1,9838,108,4,2,59,115,13325,13327,1,9838,59,1,8469,4,2,115,117,13336,13344,112,5,160,1,59,13342,1,160,109,112,4,2,59,101,13352,13355,3,8782,824,59,3,8783,824,4,5,97,101,111,117,121,13371,13385,13391,13407,13411,4,2,112,114,13377,13380,59,1,10819,111,110,59,1,328,100,105,108,59,1,326,110,103,4,2,59,100,13399,13401,1,8775,111,116,59,3,10861,824,112,59,1,10818,59,1,1085,97,115,104,59,1,8211,4,7,59,65,97,100,113,115,120,13436,13438,13443,13466,13472,13478,13494,1,8800,114,114,59,1,8663,114,4,2,104,114,13450,13454,107,59,1,10532,4,2,59,111,13460,13462,1,8599,119,59,1,8599,111,116,59,3,8784,824,117,105,118,59,1,8802,4,2,101,105,13484,13489,97,114,59,1,10536,109,59,3,8770,824,105,115,116,4,2,59,115,13503,13505,1,8708,59,1,8708,114,59,3,55349,56619,4,4,69,101,115,116,13523,13527,13563,13568,59,3,8807,824,4,3,59,113,115,13535,13537,13559,1,8817,4,3,59,113,115,13545,13547,13551,1,8817,59,3,8807,824,108,97,110,116,59,3,10878,824,59,3,10878,824,105,109,59,1,8821,4,2,59,114,13574,13576,1,8815,59,1,8815,4,3,65,97,112,13587,13592,13597,114,114,59,1,8654,114,114,59,1,8622,97,114,59,1,10994,4,3,59,115,118,13610,13612,13623,1,8715,4,2,59,100,13618,13620,1,8956,59,1,8954,59,1,8715,99,121,59,1,1114,4,7,65,69,97,100,101,115,116,13647,13652,13656,13661,13665,13737,13742,114,114,59,1,8653,59,3,8806,824,114,114,59,1,8602,114,59,1,8229,4,4,59,102,113,115,13675,13677,13703,13725,1,8816,116,4,2,97,114,13684,13691,114,114,111,119,59,1,8602,105,103,104,116,97,114,114,111,119,59,1,8622,4,3,59,113,115,13711,13713,13717,1,8816,59,3,8806,824,108,97,110,116,59,3,10877,824,4,2,59,115,13731,13734,3,10877,824,59,1,8814,105,109,59,1,8820,4,2,59,114,13748,13750,1,8814,105,4,2,59,101,13757,13759,1,8938,59,1,8940,105,100,59,1,8740,4,2,112,116,13773,13778,102,59,3,55349,56671,5,172,3,59,105,110,13787,13789,13829,1,172,110,4,4,59,69,100,118,13800,13802,13806,13812,1,8713,59,3,8953,824,111,116,59,3,8949,824,4,3,97,98,99,13820,13823,13826,59,1,8713,59,1,8951,59,1,8950,105,4,2,59,118,13836,13838,1,8716,4,3,97,98,99,13846,13849,13852,59,1,8716,59,1,8958,59,1,8957,4,3,97,111,114,13863,13892,13899,114,4,4,59,97,115,116,13874,13876,13883,13888,1,8742,108,108,101,108,59,1,8742,108,59,3,11005,8421,59,3,8706,824,108,105,110,116,59,1,10772,4,3,59,99,101,13907,13909,13914,1,8832,117,101,59,1,8928,4,2,59,99,13920,13923,3,10927,824,4,2,59,101,13929,13931,1,8832,113,59,3,10927,824,4,4,65,97,105,116,13946,13951,13971,13982,114,114,59,1,8655,114,114,4,3,59,99,119,13961,13963,13967,1,8603,59,3,10547,824,59,3,8605,824,103,104,116,97,114,114,111,119,59,1,8603,114,105,4,2,59,101,13990,13992,1,8939,59,1,8941,4,7,99,104,105,109,112,113,117,14011,14036,14060,14080,14085,14090,14106,4,4,59,99,101,114,14021,14023,14028,14032,1,8833,117,101,59,1,8929,59,3,10928,824,59,3,55349,56515,111,114,116,4,2,109,112,14045,14050,105,100,59,1,8740,97,114,97,108,108,101,108,59,1,8742,109,4,2,59,101,14067,14069,1,8769,4,2,59,113,14075,14077,1,8772,59,1,8772,105,100,59,1,8740,97,114,59,1,8742,115,117,4,2,98,112,14098,14102,101,59,1,8930,101,59,1,8931,4,3,98,99,112,14114,14157,14171,4,4,59,69,101,115,14124,14126,14130,14133,1,8836,59,3,10949,824,59,1,8840,101,116,4,2,59,101,14141,14144,3,8834,8402,113,4,2,59,113,14151,14153,1,8840,59,3,10949,824,99,4,2,59,101,14164,14166,1,8833,113,59,3,10928,824,4,4,59,69,101,115,14181,14183,14187,14190,1,8837,59,3,10950,824,59,1,8841,101,116,4,2,59,101,14198,14201,3,8835,8402,113,4,2,59,113,14208,14210,1,8841,59,3,10950,824,4,4,103,105,108,114,14224,14228,14238,14242,108,59,1,8825,108,100,101,5,241,1,59,14236,1,241,103,59,1,8824,105,97,110,103,108,101,4,2,108,114,14254,14269,101,102,116,4,2,59,101,14263,14265,1,8938,113,59,1,8940,105,103,104,116,4,2,59,101,14279,14281,1,8939,113,59,1,8941,4,2,59,109,14291,14293,1,957,4,3,59,101,115,14301,14303,14308,1,35,114,111,59,1,8470,112,59,1,8199,4,9,68,72,97,100,103,105,108,114,115,14332,14338,14344,14349,14355,14369,14376,14408,14426,97,115,104,59,1,8877,97,114,114,59,1,10500,112,59,3,8781,8402,97,115,104,59,1,8876,4,2,101,116,14361,14365,59,3,8805,8402,59,3,62,8402,110,102,105,110,59,1,10718,4,3,65,101,116,14384,14389,14393,114,114,59,1,10498,59,3,8804,8402,4,2,59,114,14399,14402,3,60,8402,105,101,59,3,8884,8402,4,2,65,116,14414,14419,114,114,59,1,10499,114,105,101,59,3,8885,8402,105,109,59,3,8764,8402,4,3,65,97,110,14440,14445,14468,114,114,59,1,8662,114,4,2,104,114,14452,14456,107,59,1,10531,4,2,59,111,14462,14464,1,8598,119,59,1,8598,101,97,114,59,1,10535,4,18,83,97,99,100,101,102,103,104,105,108,109,111,112,114,115,116,117,118,14512,14515,14535,14560,14597,14603,14618,14643,14657,14662,14701,14741,14747,14769,14851,14877,14907,14916,59,1,9416,4,2,99,115,14521,14531,117,116,101,5,243,1,59,14529,1,243,116,59,1,8859,4,2,105,121,14541,14557,114,4,2,59,99,14548,14550,1,8858,5,244,1,59,14555,1,244,59,1,1086,4,5,97,98,105,111,115,14572,14577,14583,14587,14591,115,104,59,1,8861,108,97,99,59,1,337,118,59,1,10808,116,59,1,8857,111,108,100,59,1,10684,108,105,103,59,1,339,4,2,99,114,14609,14614,105,114,59,1,10687,59,3,55349,56620,4,3,111,114,116,14626,14630,14640,110,59,1,731,97,118,101,5,242,1,59,14638,1,242,59,1,10689,4,2,98,109,14649,14654,97,114,59,1,10677,59,1,937,110,116,59,1,8750,4,4,97,99,105,116,14672,14677,14693,14698,114,114,59,1,8634,4,2,105,114,14683,14687,114,59,1,10686,111,115,115,59,1,10683,110,101,59,1,8254,59,1,10688,4,3,97,101,105,14709,14714,14719,99,114,59,1,333,103,97,59,1,969,4,3,99,100,110,14727,14733,14736,114,111,110,59,1,959,59,1,10678,117,115,59,1,8854,112,102,59,3,55349,56672,4,3,97,101,108,14755,14759,14764,114,59,1,10679,114,112,59,1,10681,117,115,59,1,8853,4,7,59,97,100,105,111,115,118,14785,14787,14792,14831,14837,14841,14848,1,8744,114,114,59,1,8635,4,4,59,101,102,109,14802,14804,14817,14824,1,10845,114,4,2,59,111,14811,14813,1,8500,102,59,1,8500,5,170,1,59,14822,1,170,5,186,1,59,14829,1,186,103,111,102,59,1,8886,114,59,1,10838,108,111,112,101,59,1,10839,59,1,10843,4,3,99,108,111,14859,14863,14873,114,59,1,8500,97,115,104,5,248,1,59,14871,1,248,108,59,1,8856,105,4,2,108,109,14884,14893,100,101,5,245,1,59,14891,1,245,101,115,4,2,59,97,14901,14903,1,8855,115,59,1,10806,109,108,5,246,1,59,14914,1,246,98,97,114,59,1,9021,4,12,97,99,101,102,104,105,108,109,111,114,115,117,14948,14992,14996,15033,15038,15068,15090,15189,15192,15222,15427,15441,114,4,4,59,97,115,116,14959,14961,14976,14989,1,8741,5,182,2,59,108,14968,14970,1,182,108,101,108,59,1,8741,4,2,105,108,14982,14986,109,59,1,10995,59,1,11005,59,1,8706,121,59,1,1087,114,4,5,99,105,109,112,116,15009,15014,15019,15024,15027,110,116,59,1,37,111,100,59,1,46,105,108,59,1,8240,59,1,8869,101,110,107,59,1,8241,114,59,3,55349,56621,4,3,105,109,111,15046,15057,15063,4,2,59,118,15052,15054,1,966,59,1,981,109,97,116,59,1,8499,110,101,59,1,9742,4,3,59,116,118,15076,15078,15087,1,960,99,104,102,111,114,107,59,1,8916,59,1,982,4,2,97,117,15096,15119,110,4,2,99,107,15103,15115,107,4,2,59,104,15110,15112,1,8463,59,1,8462,118,59,1,8463,115,4,9,59,97,98,99,100,101,109,115,116,15140,15142,15148,15151,15156,15168,15171,15179,15184,1,43,99,105,114,59,1,10787,59,1,8862,105,114,59,1,10786,4,2,111,117,15162,15165,59,1,8724,59,1,10789,59,1,10866,110,5,177,1,59,15177,1,177,105,109,59,1,10790,119,111,59,1,10791,59,1,177,4,3,105,112,117,15200,15208,15213,110,116,105,110,116,59,1,10773,102,59,3,55349,56673,110,100,5,163,1,59,15220,1,163,4,10,59,69,97,99,101,105,110,111,115,117,15244,15246,15249,15253,15258,15334,15347,15367,15416,15421,1,8826,59,1,10931,112,59,1,10935,117,101,59,1,8828,4,2,59,99,15264,15266,1,10927,4,6,59,97,99,101,110,115,15280,15282,15290,15299,15303,15329,1,8826,112,112,114,111,120,59,1,10935,117,114,108,121,101,113,59,1,8828,113,59,1,10927,4,3,97,101,115,15311,15319,15324,112,112,114,111,120,59,1,10937,113,113,59,1,10933,105,109,59,1,8936,105,109,59,1,8830,109,101,4,2,59,115,15342,15344,1,8242,59,1,8473,4,3,69,97,115,15355,15358,15362,59,1,10933,112,59,1,10937,105,109,59,1,8936,4,3,100,102,112,15375,15378,15404,59,1,8719,4,3,97,108,115,15386,15392,15398,108,97,114,59,1,9006,105,110,101,59,1,8978,117,114,102,59,1,8979,4,2,59,116,15410,15412,1,8733,111,59,1,8733,105,109,59,1,8830,114,101,108,59,1,8880,4,2,99,105,15433,15438,114,59,3,55349,56517,59,1,968,110,99,115,112,59,1,8200,4,6,102,105,111,112,115,117,15462,15467,15472,15478,15485,15491,114,59,3,55349,56622,110,116,59,1,10764,112,102,59,3,55349,56674,114,105,109,101,59,1,8279,99,114,59,3,55349,56518,4,3,97,101,111,15499,15520,15534,116,4,2,101,105,15506,15515,114,110,105,111,110,115,59,1,8461,110,116,59,1,10774,115,116,4,2,59,101,15528,15530,1,63,113,59,1,8799,116,5,34,1,59,15540,1,34,4,21,65,66,72,97,98,99,100,101,102,104,105,108,109,110,111,112,114,115,116,117,120,15586,15609,15615,15620,15796,15855,15893,15931,15977,16001,16039,16183,16204,16222,16228,16285,16312,16318,16363,16408,16416,4,3,97,114,116,15594,15599,15603,114,114,59,1,8667,114,59,1,8658,97,105,108,59,1,10524,97,114,114,59,1,10511,97,114,59,1,10596,4,7,99,100,101,110,113,114,116,15636,15651,15656,15664,15687,15696,15770,4,2,101,117,15642,15646,59,3,8765,817,116,101,59,1,341,105,99,59,1,8730,109,112,116,121,118,59,1,10675,103,4,4,59,100,101,108,15675,15677,15680,15683,1,10217,59,1,10642,59,1,10661,101,59,1,10217,117,111,5,187,1,59,15694,1,187,114,4,11,59,97,98,99,102,104,108,112,115,116,119,15721,15723,15727,15739,15742,15746,15750,15754,15758,15763,15767,1,8594,112,59,1,10613,4,2,59,102,15733,15735,1,8677,115,59,1,10528,59,1,10547,115,59,1,10526,107,59,1,8618,112,59,1,8620,108,59,1,10565,105,109,59,1,10612,108,59,1,8611,59,1,8605,4,2,97,105,15776,15781,105,108,59,1,10522,111,4,2,59,110,15788,15790,1,8758,97,108,115,59,1,8474,4,3,97,98,114,15804,15809,15814,114,114,59,1,10509,114,107,59,1,10099,4,2,97,107,15820,15833,99,4,2,101,107,15827,15830,59,1,125,59,1,93,4,2,101,115,15839,15842,59,1,10636,108,4,2,100,117,15849,15852,59,1,10638,59,1,10640,4,4,97,101,117,121,15865,15871,15886,15890,114,111,110,59,1,345,4,2,100,105,15877,15882,105,108,59,1,343,108,59,1,8969,98,59,1,125,59,1,1088,4,4,99,108,113,115,15903,15907,15914,15927,97,59,1,10551,100,104,97,114,59,1,10601,117,111,4,2,59,114,15922,15924,1,8221,59,1,8221,104,59,1,8627,4,3,97,99,103,15939,15966,15970,108,4,4,59,105,112,115,15950,15952,15957,15963,1,8476,110,101,59,1,8475,97,114,116,59,1,8476,59,1,8477,116,59,1,9645,5,174,1,59,15975,1,174,4,3,105,108,114,15985,15991,15997,115,104,116,59,1,10621,111,111,114,59,1,8971,59,3,55349,56623,4,2,97,111,16007,16028,114,4,2,100,117,16014,16017,59,1,8641,4,2,59,108,16023,16025,1,8640,59,1,10604,4,2,59,118,16034,16036,1,961,59,1,1009,4,3,103,110,115,16047,16167,16171,104,116,4,6,97,104,108,114,115,116,16063,16081,16103,16130,16143,16155,114,114,111,119,4,2,59,116,16073,16075,1,8594,97,105,108,59,1,8611,97,114,112,111,111,110,4,2,100,117,16093,16099,111,119,110,59,1,8641,112,59,1,8640,101,102,116,4,2,97,104,16112,16120,114,114,111,119,115,59,1,8644,97,114,112,111,111,110,115,59,1,8652,105,103,104,116,97,114,114,111,119,115,59,1,8649,113,117,105,103,97,114,114,111,119,59,1,8605,104,114,101,101,116,105,109,101,115,59,1,8908,103,59,1,730,105,110,103,100,111,116,115,101,113,59,1,8787,4,3,97,104,109,16191,16196,16201,114,114,59,1,8644,97,114,59,1,8652,59,1,8207,111,117,115,116,4,2,59,97,16214,16216,1,9137,99,104,101,59,1,9137,109,105,100,59,1,10990,4,4,97,98,112,116,16238,16252,16257,16278,4,2,110,114,16244,16248,103,59,1,10221,114,59,1,8702,114,107,59,1,10215,4,3,97,102,108,16265,16269,16273,114,59,1,10630,59,3,55349,56675,117,115,59,1,10798,105,109,101,115,59,1,10805,4,2,97,112,16291,16304,114,4,2,59,103,16298,16300,1,41,116,59,1,10644,111,108,105,110,116,59,1,10770,97,114,114,59,1,8649,4,4,97,99,104,113,16328,16334,16339,16342,113,117,111,59,1,8250,114,59,3,55349,56519,59,1,8625,4,2,98,117,16348,16351,59,1,93,111,4,2,59,114,16358,16360,1,8217,59,1,8217,4,3,104,105,114,16371,16377,16383,114,101,101,59,1,8908,109,101,115,59,1,8906,105,4,4,59,101,102,108,16394,16396,16399,16402,1,9657,59,1,8885,59,1,9656,116,114,105,59,1,10702,108,117,104,97,114,59,1,10600,59,1,8478,4,19,97,98,99,100,101,102,104,105,108,109,111,112,113,114,115,116,117,119,122,16459,16466,16472,16572,16590,16672,16687,16746,16844,16850,16924,16963,16988,17115,17121,17154,17206,17614,17656,99,117,116,101,59,1,347,113,117,111,59,1,8218,4,10,59,69,97,99,101,105,110,112,115,121,16494,16496,16499,16513,16518,16531,16536,16556,16564,16569,1,8827,59,1,10932,4,2,112,114,16505,16508,59,1,10936,111,110,59,1,353,117,101,59,1,8829,4,2,59,100,16524,16526,1,10928,105,108,59,1,351,114,99,59,1,349,4,3,69,97,115,16544,16547,16551,59,1,10934,112,59,1,10938,105,109,59,1,8937,111,108,105,110,116,59,1,10771,105,109,59,1,8831,59,1,1089,111,116,4,3,59,98,101,16582,16584,16587,1,8901,59,1,8865,59,1,10854,4,7,65,97,99,109,115,116,120,16606,16611,16634,16642,16646,16652,16668,114,114,59,1,8664,114,4,2,104,114,16618,16622,107,59,1,10533,4,2,59,111,16628,16630,1,8600,119,59,1,8600,116,5,167,1,59,16640,1,167,105,59,1,59,119,97,114,59,1,10537,109,4,2,105,110,16659,16665,110,117,115,59,1,8726,59,1,8726,116,59,1,10038,114,4,2,59,111,16679,16682,3,55349,56624,119,110,59,1,8994,4,4,97,99,111,121,16697,16702,16716,16739,114,112,59,1,9839,4,2,104,121,16708,16713,99,121,59,1,1097,59,1,1096,114,116,4,2,109,112,16724,16729,105,100,59,1,8739,97,114,97,108,108,101,108,59,1,8741,5,173,1,59,16744,1,173,4,2,103,109,16752,16770,109,97,4,3,59,102,118,16762,16764,16767,1,963,59,1,962,59,1,962,4,8,59,100,101,103,108,110,112,114,16788,16790,16795,16806,16817,16828,16832,16838,1,8764,111,116,59,1,10858,4,2,59,113,16801,16803,1,8771,59,1,8771,4,2,59,69,16812,16814,1,10910,59,1,10912,4,2,59,69,16823,16825,1,10909,59,1,10911,101,59,1,8774,108,117,115,59,1,10788,97,114,114,59,1,10610,97,114,114,59,1,8592,4,4,97,101,105,116,16860,16883,16891,16904,4,2,108,115,16866,16878,108,115,101,116,109,105,110,117,115,59,1,8726,104,112,59,1,10803,112,97,114,115,108,59,1,10724,4,2,100,108,16897,16900,59,1,8739,101,59,1,8995,4,2,59,101,16910,16912,1,10922,4,2,59,115,16918,16920,1,10924,59,3,10924,65024,4,3,102,108,112,16932,16938,16958,116,99,121,59,1,1100,4,2,59,98,16944,16946,1,47,4,2,59,97,16952,16954,1,10692,114,59,1,9023,102,59,3,55349,56676,97,4,2,100,114,16970,16985,101,115,4,2,59,117,16978,16980,1,9824,105,116,59,1,9824,59,1,8741,4,3,99,115,117,16996,17028,17089,4,2,97,117,17002,17015,112,4,2,59,115,17009,17011,1,8851,59,3,8851,65024,112,4,2,59,115,17022,17024,1,8852,59,3,8852,65024,117,4,2,98,112,17035,17062,4,3,59,101,115,17043,17045,17048,1,8847,59,1,8849,101,116,4,2,59,101,17056,17058,1,8847,113,59,1,8849,4,3,59,101,115,17070,17072,17075,1,8848,59,1,8850,101,116,4,2,59,101,17083,17085,1,8848,113,59,1,8850,4,3,59,97,102,17097,17099,17112,1,9633,114,4,2,101,102,17106,17109,59,1,9633,59,1,9642,59,1,9642,97,114,114,59,1,8594,4,4,99,101,109,116,17131,17136,17142,17148,114,59,3,55349,56520,116,109,110,59,1,8726,105,108,101,59,1,8995,97,114,102,59,1,8902,4,2,97,114,17160,17172,114,4,2,59,102,17167,17169,1,9734,59,1,9733,4,2,97,110,17178,17202,105,103,104,116,4,2,101,112,17188,17197,112,115,105,108,111,110,59,1,1013,104,105,59,1,981,115,59,1,175,4,5,98,99,109,110,112,17218,17351,17420,17423,17427,4,9,59,69,100,101,109,110,112,114,115,17238,17240,17243,17248,17261,17267,17279,17285,17291,1,8834,59,1,10949,111,116,59,1,10941,4,2,59,100,17254,17256,1,8838,111,116,59,1,10947,117,108,116,59,1,10945,4,2,69,101,17273,17276,59,1,10955,59,1,8842,108,117,115,59,1,10943,97,114,114,59,1,10617,4,3,101,105,117,17299,17335,17339,116,4,3,59,101,110,17308,17310,17322,1,8834,113,4,2,59,113,17317,17319,1,8838,59,1,10949,101,113,4,2,59,113,17330,17332,1,8842,59,1,10955,109,59,1,10951,4,2,98,112,17345,17348,59,1,10965,59,1,10963,99,4,6,59,97,99,101,110,115,17366,17368,17376,17385,17389,17415,1,8827,112,112,114,111,120,59,1,10936,117,114,108,121,101,113,59,1,8829,113,59,1,10928,4,3,97,101,115,17397,17405,17410,112,112,114,111,120,59,1,10938,113,113,59,1,10934,105,109,59,1,8937,105,109,59,1,8831,59,1,8721,103,59,1,9834,4,13,49,50,51,59,69,100,101,104,108,109,110,112,115,17455,17462,17469,17476,17478,17481,17496,17509,17524,17530,17536,17548,17554,5,185,1,59,17460,1,185,5,178,1,59,17467,1,178,5,179,1,59,17474,1,179,1,8835,59,1,10950,4,2,111,115,17487,17491,116,59,1,10942,117,98,59,1,10968,4,2,59,100,17502,17504,1,8839,111,116,59,1,10948,115,4,2,111,117,17516,17520,108,59,1,10185,98,59,1,10967,97,114,114,59,1,10619,117,108,116,59,1,10946,4,2,69,101,17542,17545,59,1,10956,59,1,8843,108,117,115,59,1,10944,4,3,101,105,117,17562,17598,17602,116,4,3,59,101,110,17571,17573,17585,1,8835,113,4,2,59,113,17580,17582,1,8839,59,1,10950,101,113,4,2,59,113,17593,17595,1,8843,59,1,10956,109,59,1,10952,4,2,98,112,17608,17611,59,1,10964,59,1,10966,4,3,65,97,110,17622,17627,17650,114,114,59,1,8665,114,4,2,104,114,17634,17638,107,59,1,10534,4,2,59,111,17644,17646,1,8601,119,59,1,8601,119,97,114,59,1,10538,108,105,103,5,223,1,59,17664,1,223,4,13,97,98,99,100,101,102,104,105,111,112,114,115,119,17694,17709,17714,17737,17742,17749,17754,17860,17905,17957,17964,18090,18122,4,2,114,117,17700,17706,103,101,116,59,1,8982,59,1,964,114,107,59,1,9140,4,3,97,101,121,17722,17728,17734,114,111,110,59,1,357,100,105,108,59,1,355,59,1,1090,111,116,59,1,8411,108,114,101,99,59,1,8981,114,59,3,55349,56625,4,4,101,105,107,111,17764,17805,17836,17851,4,2,114,116,17770,17786,101,4,2,52,102,17777,17780,59,1,8756,111,114,101,59,1,8756,97,4,3,59,115,118,17795,17797,17802,1,952,121,109,59,1,977,59,1,977,4,2,99,110,17811,17831,107,4,2,97,115,17818,17826,112,112,114,111,120,59,1,8776,105,109,59,1,8764,115,112,59,1,8201,4,2,97,115,17842,17846,112,59,1,8776,105,109,59,1,8764,114,110,5,254,1,59,17858,1,254,4,3,108,109,110,17868,17873,17901,100,101,59,1,732,101,115,5,215,3,59,98,100,17884,17886,17898,1,215,4,2,59,97,17892,17894,1,8864,114,59,1,10801,59,1,10800,116,59,1,8749,4,3,101,112,115,17913,17917,17953,97,59,1,10536,4,4,59,98,99,102,17927,17929,17934,17939,1,8868,111,116,59,1,9014,105,114,59,1,10993,4,2,59,111,17945,17948,3,55349,56677,114,107,59,1,10970,97,59,1,10537,114,105,109,101,59,1,8244,4,3,97,105,112,17972,17977,18082,100,101,59,1,8482,4,7,97,100,101,109,112,115,116,17993,18051,18056,18059,18066,18072,18076,110,103,108,101,4,5,59,100,108,113,114,18009,18011,18017,18032,18035,1,9653,111,119,110,59,1,9663,101,102,116,4,2,59,101,18026,18028,1,9667,113,59,1,8884,59,1,8796,105,103,104,116,4,2,59,101,18045,18047,1,9657,113,59,1,8885,111,116,59,1,9708,59,1,8796,105,110,117,115,59,1,10810,108,117,115,59,1,10809,98,59,1,10701,105,109,101,59,1,10811,101,122,105,117,109,59,1,9186,4,3,99,104,116,18098,18111,18116,4,2,114,121,18104,18108,59,3,55349,56521,59,1,1094,99,121,59,1,1115,114,111,107,59,1,359,4,2,105,111,18128,18133,120,116,59,1,8812,104,101,97,100,4,2,108,114,18143,18154,101,102,116,97,114,114,111,119,59,1,8606,105,103,104,116,97,114,114,111,119,59,1,8608,4,18,65,72,97,98,99,100,102,103,104,108,109,111,112,114,115,116,117,119,18204,18209,18214,18234,18250,18268,18292,18308,18319,18343,18379,18397,18413,18504,18547,18553,18584,18603,114,114,59,1,8657,97,114,59,1,10595,4,2,99,114,18220,18230,117,116,101,5,250,1,59,18228,1,250,114,59,1,8593,114,4,2,99,101,18241,18245,121,59,1,1118,118,101,59,1,365,4,2,105,121,18256,18265,114,99,5,251,1,59,18263,1,251,59,1,1091,4,3,97,98,104,18276,18281,18287,114,114,59,1,8645,108,97,99,59,1,369,97,114,59,1,10606,4,2,105,114,18298,18304,115,104,116,59,1,10622,59,3,55349,56626,114,97,118,101,5,249,1,59,18317,1,249,4,2,97,98,18325,18338,114,4,2,108,114,18332,18335,59,1,8639,59,1,8638,108,107,59,1,9600,4,2,99,116,18349,18374,4,2,111,114,18355,18369,114,110,4,2,59,101,18363,18365,1,8988,114,59,1,8988,111,112,59,1,8975,114,105,59,1,9720,4,2,97,108,18385,18390,99,114,59,1,363,5,168,1,59,18395,1,168,4,2,103,112,18403,18408,111,110,59,1,371,102,59,3,55349,56678,4,6,97,100,104,108,115,117,18427,18434,18445,18470,18475,18494,114,114,111,119,59,1,8593,111,119,110,97,114,114,111,119,59,1,8597,97,114,112,111,111,110,4,2,108,114,18457,18463,101,102,116,59,1,8639,105,103,104,116,59,1,8638,117,115,59,1,8846,105,4,3,59,104,108,18484,18486,18489,1,965,59,1,978,111,110,59,1,965,112,97,114,114,111,119,115,59,1,8648,4,3,99,105,116,18512,18537,18542,4,2,111,114,18518,18532,114,110,4,2,59,101,18526,18528,1,8989,114,59,1,8989,111,112,59,1,8974,110,103,59,1,367,114,105,59,1,9721,99,114,59,3,55349,56522,4,3,100,105,114,18561,18566,18572,111,116,59,1,8944,108,100,101,59,1,361,105,4,2,59,102,18579,18581,1,9653,59,1,9652,4,2,97,109,18590,18595,114,114,59,1,8648,108,5,252,1,59,18601,1,252,97,110,103,108,101,59,1,10663,4,15,65,66,68,97,99,100,101,102,108,110,111,112,114,115,122,18643,18648,18661,18667,18847,18851,18857,18904,18909,18915,18931,18937,18943,18949,18996,114,114,59,1,8661,97,114,4,2,59,118,18656,18658,1,10984,59,1,10985,97,115,104,59,1,8872,4,2,110,114,18673,18679,103,114,116,59,1,10652,4,7,101,107,110,112,114,115,116,18695,18704,18711,18720,18742,18754,18810,112,115,105,108,111,110,59,1,1013,97,112,112,97,59,1,1008,111,116,104,105,110,103,59,1,8709,4,3,104,105,114,18728,18732,18735,105,59,1,981,59,1,982,111,112,116,111,59,1,8733,4,2,59,104,18748,18750,1,8597,111,59,1,1009,4,2,105,117,18760,18766,103,109,97,59,1,962,4,2,98,112,18772,18791,115,101,116,110,101,113,4,2,59,113,18784,18787,3,8842,65024,59,3,10955,65024,115,101,116,110,101,113,4,2,59,113,18803,18806,3,8843,65024,59,3,10956,65024,4,2,104,114,18816,18822,101,116,97,59,1,977,105,97,110,103,108,101,4,2,108,114,18834,18840,101,102,116,59,1,8882,105,103,104,116,59,1,8883,121,59,1,1074,97,115,104,59,1,8866,4,3,101,108,114,18865,18884,18890,4,3,59,98,101,18873,18875,18880,1,8744,97,114,59,1,8891,113,59,1,8794,108,105,112,59,1,8942,4,2,98,116,18896,18901,97,114,59,1,124,59,1,124,114,59,3,55349,56627,116,114,105,59,1,8882,115,117,4,2,98,112,18923,18927,59,3,8834,8402,59,3,8835,8402,112,102,59,3,55349,56679,114,111,112,59,1,8733,116,114,105,59,1,8883,4,2,99,117,18955,18960,114,59,3,55349,56523,4,2,98,112,18966,18981,110,4,2,69,101,18973,18977,59,3,10955,65024,59,3,8842,65024,110,4,2,69,101,18988,18992,59,3,10956,65024,59,3,8843,65024,105,103,122,97,103,59,1,10650,4,7,99,101,102,111,112,114,115,19020,19026,19061,19066,19072,19075,19089,105,114,99,59,1,373,4,2,100,105,19032,19055,4,2,98,103,19038,19043,97,114,59,1,10847,101,4,2,59,113,19050,19052,1,8743,59,1,8793,101,114,112,59,1,8472,114,59,3,55349,56628,112,102,59,3,55349,56680,59,1,8472,4,2,59,101,19081,19083,1,8768,97,116,104,59,1,8768,99,114,59,3,55349,56524,4,14,99,100,102,104,105,108,109,110,111,114,115,117,118,119,19125,19146,19152,19157,19173,19176,19192,19197,19202,19236,19252,19269,19286,19291,4,3,97,105,117,19133,19137,19142,112,59,1,8898,114,99,59,1,9711,112,59,1,8899,116,114,105,59,1,9661,114,59,3,55349,56629,4,2,65,97,19163,19168,114,114,59,1,10234,114,114,59,1,10231,59,1,958,4,2,65,97,19182,19187,114,114,59,1,10232,114,114,59,1,10229,97,112,59,1,10236,105,115,59,1,8955,4,3,100,112,116,19210,19215,19230,111,116,59,1,10752,4,2,102,108,19221,19225,59,3,55349,56681,117,115,59,1,10753,105,109,101,59,1,10754,4,2,65,97,19242,19247,114,114,59,1,10233,114,114,59,1,10230,4,2,99,113,19258,19263,114,59,3,55349,56525,99,117,112,59,1,10758,4,2,112,116,19275,19281,108,117,115,59,1,10756,114,105,59,1,9651,101,101,59,1,8897,101,100,103,101,59,1,8896,4,8,97,99,101,102,105,111,115,117,19316,19335,19349,19357,19362,19367,19373,19379,99,4,2,117,121,19323,19332,116,101,5,253,1,59,19330,1,253,59,1,1103,4,2,105,121,19341,19346,114,99,59,1,375,59,1,1099,110,5,165,1,59,19355,1,165,114,59,3,55349,56630,99,121,59,1,1111,112,102,59,3,55349,56682,99,114,59,3,55349,56526,4,2,99,109,19385,19389,121,59,1,1102,108,5,255,1,59,19395,1,255,4,10,97,99,100,101,102,104,105,111,115,119,19419,19426,19441,19446,19462,19467,19472,19480,19486,19492,99,117,116,101,59,1,378,4,2,97,121,19432,19438,114,111,110,59,1,382,59,1,1079,111,116,59,1,380,4,2,101,116,19452,19458,116,114,102,59,1,8488,97,59,1,950,114,59,3,55349,56631,99,121,59,1,1078,103,114,97,114,114,59,1,8669,112,102,59,3,55349,56683,99,114,59,3,55349,56527,4,2,106,110,19498,19501,59,1,8205,106,59,1,8204]); - -/***/ }), -/* 119 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -var UNICODE = __webpack_require__(18); - -//Aliases -var $ = UNICODE.CODE_POINTS; - -//Utils - -//OPTIMIZATION: these utility functions should not be moved out of this module. V8 Crankshaft will not inline -//this functions if they will be situated in another module due to context switch. -//Always perform inlining check before modifying this functions ('node --trace-inlining'). -function isSurrogatePair(cp1, cp2) { - return cp1 >= 0xD800 && cp1 <= 0xDBFF && cp2 >= 0xDC00 && cp2 <= 0xDFFF; -} - -function getSurrogatePairCodePoint(cp1, cp2) { - return (cp1 - 0xD800) * 0x400 + 0x2400 + cp2; -} - - -//Const -var DEFAULT_BUFFER_WATERLINE = 1 << 16; - - -//Preprocessor -//NOTE: HTML input preprocessing -//(see: http://www.whatwg.org/specs/web-apps/current-work/multipage/parsing.html#preprocessing-the-input-stream) -var Preprocessor = module.exports = function () { - this.html = null; - - this.pos = -1; - this.lastGapPos = -1; - this.lastCharPos = -1; - this.droppedBufferSize = 0; - - this.gapStack = []; - - this.skipNextNewLine = false; - - this.lastChunkWritten = false; - this.endOfChunkHit = false; - this.bufferWaterline = DEFAULT_BUFFER_WATERLINE; -}; - -Object.defineProperty(Preprocessor.prototype, 'sourcePos', { - get: function () { - return this.droppedBufferSize + this.pos; - } -}); - -Preprocessor.prototype.dropParsedChunk = function () { - if (this.pos > this.bufferWaterline) { - this.lastCharPos -= this.pos; - this.droppedBufferSize += this.pos; - this.html = this.html.substring(this.pos); - this.pos = 0; - this.lastGapPos = -1; - this.gapStack = []; - } -}; - -Preprocessor.prototype._addGap = function () { - this.gapStack.push(this.lastGapPos); - this.lastGapPos = this.pos; -}; - -Preprocessor.prototype._processHighRangeCodePoint = function (cp) { - //NOTE: try to peek a surrogate pair - if (this.pos !== this.lastCharPos) { - var nextCp = this.html.charCodeAt(this.pos + 1); - - if (isSurrogatePair(cp, nextCp)) { - //NOTE: we have a surrogate pair. Peek pair character and recalculate code point. - this.pos++; - cp = getSurrogatePairCodePoint(cp, nextCp); - - //NOTE: add gap that should be avoided during retreat - this._addGap(); - } - } - - // NOTE: we've hit the end of chunk, stop processing at this point - else if (!this.lastChunkWritten) { - this.endOfChunkHit = true; - return $.EOF; - } - - return cp; -}; - -Preprocessor.prototype.write = function (chunk, isLastChunk) { - if (this.html) - this.html += chunk; - - else - this.html = chunk; - - this.lastCharPos = this.html.length - 1; - this.endOfChunkHit = false; - this.lastChunkWritten = isLastChunk; -}; - -Preprocessor.prototype.insertHtmlAtCurrentPos = function (chunk) { - this.html = this.html.substring(0, this.pos + 1) + - chunk + - this.html.substring(this.pos + 1, this.html.length); - - this.lastCharPos = this.html.length - 1; - this.endOfChunkHit = false; -}; - - -Preprocessor.prototype.advance = function () { - this.pos++; - - if (this.pos > this.lastCharPos) { - if (!this.lastChunkWritten) - this.endOfChunkHit = true; - - return $.EOF; - } - - var cp = this.html.charCodeAt(this.pos); - - //NOTE: any U+000A LINE FEED (LF) characters that immediately follow a U+000D CARRIAGE RETURN (CR) character - //must be ignored. - if (this.skipNextNewLine && cp === $.LINE_FEED) { - this.skipNextNewLine = false; - this._addGap(); - return this.advance(); - } - - //NOTE: all U+000D CARRIAGE RETURN (CR) characters must be converted to U+000A LINE FEED (LF) characters - if (cp === $.CARRIAGE_RETURN) { - this.skipNextNewLine = true; - return $.LINE_FEED; - } - - this.skipNextNewLine = false; - - //OPTIMIZATION: first perform check if the code point in the allowed range that covers most common - //HTML input (e.g. ASCII codes) to avoid performance-cost operations for high-range code points. - return cp >= 0xD800 ? this._processHighRangeCodePoint(cp) : cp; -}; - -Preprocessor.prototype.retreat = function () { - if (this.pos === this.lastGapPos) { - this.lastGapPos = this.gapStack.pop(); - this.pos--; - } - - this.pos--; -}; - - - -/***/ }), -/* 120 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -var doctype = __webpack_require__(33), - DOCUMENT_MODE = __webpack_require__(11).DOCUMENT_MODE; - - -//Conversion tables for DOM Level1 structure emulation -var nodeTypes = { - element: 1, - text: 3, - cdata: 4, - comment: 8 -}; - -var nodePropertyShorthands = { - tagName: 'name', - childNodes: 'children', - parentNode: 'parent', - previousSibling: 'prev', - nextSibling: 'next', - nodeValue: 'data' -}; - -//Node -var Node = function (props) { - for (var key in props) { - if (props.hasOwnProperty(key)) - this[key] = props[key]; - } -}; - -Node.prototype = { - get firstChild() { - var children = this.children; - - return children && children[0] || null; - }, - - get lastChild() { - var children = this.children; - - return children && children[children.length - 1] || null; - }, - - get nodeType() { - return nodeTypes[this.type] || nodeTypes.element; - } -}; - -Object.keys(nodePropertyShorthands).forEach(function (key) { - var shorthand = nodePropertyShorthands[key]; - - Object.defineProperty(Node.prototype, key, { - get: function () { - return this[shorthand] || null; - }, - set: function (val) { - this[shorthand] = val; - return val; - } - }); -}); - - -//Node construction -exports.createDocument = function () { - return new Node({ - type: 'root', - name: 'root', - parent: null, - prev: null, - next: null, - children: [], - 'x-mode': DOCUMENT_MODE.NO_QUIRKS - }); -}; - -exports.createDocumentFragment = function () { - return new Node({ - type: 'root', - name: 'root', - parent: null, - prev: null, - next: null, - children: [] - }); -}; - -exports.createElement = function (tagName, namespaceURI, attrs) { - var attribs = Object.create(null), - attribsNamespace = Object.create(null), - attribsPrefix = Object.create(null); - - for (var i = 0; i < attrs.length; i++) { - var attrName = attrs[i].name; - - attribs[attrName] = attrs[i].value; - attribsNamespace[attrName] = attrs[i].namespace; - attribsPrefix[attrName] = attrs[i].prefix; - } - - return new Node({ - type: tagName === 'script' || tagName === 'style' ? tagName : 'tag', - name: tagName, - namespace: namespaceURI, - attribs: attribs, - 'x-attribsNamespace': attribsNamespace, - 'x-attribsPrefix': attribsPrefix, - children: [], - parent: null, - prev: null, - next: null - }); -}; - -exports.createCommentNode = function (data) { - return new Node({ - type: 'comment', - data: data, - parent: null, - prev: null, - next: null - }); -}; - -var createTextNode = function (value) { - return new Node({ - type: 'text', - data: value, - parent: null, - prev: null, - next: null - }); -}; - - -//Tree mutation -var appendChild = exports.appendChild = function (parentNode, newNode) { - var prev = parentNode.children[parentNode.children.length - 1]; - - if (prev) { - prev.next = newNode; - newNode.prev = prev; - } - - parentNode.children.push(newNode); - newNode.parent = parentNode; -}; - -var insertBefore = exports.insertBefore = function (parentNode, newNode, referenceNode) { - var insertionIdx = parentNode.children.indexOf(referenceNode), - prev = referenceNode.prev; - - if (prev) { - prev.next = newNode; - newNode.prev = prev; - } - - referenceNode.prev = newNode; - newNode.next = referenceNode; - - parentNode.children.splice(insertionIdx, 0, newNode); - newNode.parent = parentNode; -}; - -exports.setTemplateContent = function (templateElement, contentElement) { - appendChild(templateElement, contentElement); -}; - -exports.getTemplateContent = function (templateElement) { - return templateElement.children[0]; -}; - -exports.setDocumentType = function (document, name, publicId, systemId) { - var data = doctype.serializeContent(name, publicId, systemId), - doctypeNode = null; - - for (var i = 0; i < document.children.length; i++) { - if (document.children[i].type === 'directive' && document.children[i].name === '!doctype') { - doctypeNode = document.children[i]; - break; - } - } - - if (doctypeNode) { - doctypeNode.data = data; - doctypeNode['x-name'] = name; - doctypeNode['x-publicId'] = publicId; - doctypeNode['x-systemId'] = systemId; - } - - else { - appendChild(document, new Node({ - type: 'directive', - name: '!doctype', - data: data, - 'x-name': name, - 'x-publicId': publicId, - 'x-systemId': systemId - })); - } - -}; - -exports.setDocumentMode = function (document, mode) { - document['x-mode'] = mode; -}; - -exports.getDocumentMode = function (document) { - return document['x-mode']; -}; - -exports.detachNode = function (node) { - if (node.parent) { - var idx = node.parent.children.indexOf(node), - prev = node.prev, - next = node.next; - - node.prev = null; - node.next = null; - - if (prev) - prev.next = next; - - if (next) - next.prev = prev; - - node.parent.children.splice(idx, 1); - node.parent = null; - } -}; - -exports.insertText = function (parentNode, text) { - var lastChild = parentNode.children[parentNode.children.length - 1]; - - if (lastChild && lastChild.type === 'text') - lastChild.data += text; - else - appendChild(parentNode, createTextNode(text)); -}; - -exports.insertTextBefore = function (parentNode, text, referenceNode) { - var prevNode = parentNode.children[parentNode.children.indexOf(referenceNode) - 1]; - - if (prevNode && prevNode.type === 'text') - prevNode.data += text; - else - insertBefore(parentNode, createTextNode(text), referenceNode); -}; - -exports.adoptAttributes = function (recipient, attrs) { - for (var i = 0; i < attrs.length; i++) { - var attrName = attrs[i].name; - - if (typeof recipient.attribs[attrName] === 'undefined') { - recipient.attribs[attrName] = attrs[i].value; - recipient['x-attribsNamespace'][attrName] = attrs[i].namespace; - recipient['x-attribsPrefix'][attrName] = attrs[i].prefix; - } - } -}; - - -//Tree traversing -exports.getFirstChild = function (node) { - return node.children[0]; -}; - -exports.getChildNodes = function (node) { - return node.children; -}; - -exports.getParentNode = function (node) { - return node.parent; -}; - -exports.getAttrList = function (element) { - var attrList = []; - - for (var name in element.attribs) { - attrList.push({ - name: name, - value: element.attribs[name], - namespace: element['x-attribsNamespace'][name], - prefix: element['x-attribsPrefix'][name] - }); - } - - return attrList; -}; - - -//Node data -exports.getTagName = function (element) { - return element.name; -}; - -exports.getNamespaceURI = function (element) { - return element.namespace; -}; - -exports.getTextNodeContent = function (textNode) { - return textNode.data; -}; - -exports.getCommentNodeContent = function (commentNode) { - return commentNode.data; -}; - -exports.getDocumentTypeNodeName = function (doctypeNode) { - return doctypeNode['x-name']; -}; - -exports.getDocumentTypeNodePublicId = function (doctypeNode) { - return doctypeNode['x-publicId']; -}; - -exports.getDocumentTypeNodeSystemId = function (doctypeNode) { - return doctypeNode['x-systemId']; -}; - - -//Node types -exports.isTextNode = function (node) { - return node.type === 'text'; -}; - -exports.isCommentNode = function (node) { - return node.type === 'comment'; -}; - -exports.isDocumentTypeNode = function (node) { - return node.type === 'directive' && node.name === '!doctype'; -}; - -exports.isElementNode = function (node) { - return !!node.attribs; -}; - - -/***/ }), -/* 121 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -/* tslint:disable:no-unused-variable */ -// Subject imported before Observable to bypass circular dependency issue since -// Subject extends Observable and Observable references Subject in it's -// definition -var Subject_1 = __webpack_require__(6); -exports.Subject = Subject_1.Subject; -exports.AnonymousSubject = Subject_1.AnonymousSubject; -/* tslint:enable:no-unused-variable */ -var Observable_1 = __webpack_require__(0); -exports.Observable = Observable_1.Observable; -// statics -/* tslint:disable:no-use-before-declare */ -__webpack_require__(123); -__webpack_require__(124); -__webpack_require__(125); -__webpack_require__(126); -__webpack_require__(127); -__webpack_require__(130); -__webpack_require__(131); -__webpack_require__(132); -__webpack_require__(133); -__webpack_require__(134); -__webpack_require__(135); -__webpack_require__(136); -__webpack_require__(137); -__webpack_require__(54); -__webpack_require__(138); -__webpack_require__(143); -__webpack_require__(139); -__webpack_require__(140); -__webpack_require__(141); -__webpack_require__(142); -__webpack_require__(144); -__webpack_require__(145); -__webpack_require__(55); -__webpack_require__(56); -__webpack_require__(146); -//dom -__webpack_require__(128); -__webpack_require__(129); -//operators -__webpack_require__(149); -__webpack_require__(150); -__webpack_require__(151); -__webpack_require__(152); -__webpack_require__(153); -__webpack_require__(57); -__webpack_require__(154); -__webpack_require__(155); -__webpack_require__(156); -__webpack_require__(157); -__webpack_require__(158); -__webpack_require__(159); -__webpack_require__(160); -__webpack_require__(166); -__webpack_require__(161); -__webpack_require__(162); -__webpack_require__(163); -__webpack_require__(164); -__webpack_require__(165); -__webpack_require__(167); -__webpack_require__(168); -__webpack_require__(169); -__webpack_require__(170); -__webpack_require__(173); -__webpack_require__(174); -__webpack_require__(175); -__webpack_require__(171); -__webpack_require__(176); -__webpack_require__(177); -__webpack_require__(178); -__webpack_require__(179); -__webpack_require__(45); -__webpack_require__(180); -__webpack_require__(181); -__webpack_require__(182); -__webpack_require__(147); -__webpack_require__(148); -__webpack_require__(183); -__webpack_require__(184); -__webpack_require__(172); -__webpack_require__(58); -__webpack_require__(185); -__webpack_require__(186); -__webpack_require__(187); -__webpack_require__(188); -__webpack_require__(189); -__webpack_require__(190); -__webpack_require__(191); -__webpack_require__(192); -__webpack_require__(193); -__webpack_require__(194); -__webpack_require__(195); -__webpack_require__(196); -__webpack_require__(197); -__webpack_require__(198); -__webpack_require__(199); -__webpack_require__(200); -__webpack_require__(201); -__webpack_require__(203); -__webpack_require__(202); -__webpack_require__(204); -__webpack_require__(205); -__webpack_require__(206); -__webpack_require__(207); -__webpack_require__(208); -__webpack_require__(209); -__webpack_require__(210); -__webpack_require__(211); -__webpack_require__(212); -__webpack_require__(213); -__webpack_require__(214); -__webpack_require__(215); -__webpack_require__(216); -__webpack_require__(217); -__webpack_require__(218); -__webpack_require__(219); -__webpack_require__(220); -__webpack_require__(221); -__webpack_require__(222); -__webpack_require__(223); -__webpack_require__(224); -__webpack_require__(225); -__webpack_require__(226); -__webpack_require__(227); -__webpack_require__(228); -__webpack_require__(229); -__webpack_require__(230); -__webpack_require__(231); -__webpack_require__(232); -__webpack_require__(233); -__webpack_require__(234); -__webpack_require__(235); -__webpack_require__(236); -__webpack_require__(237); -__webpack_require__(238); -__webpack_require__(239); -__webpack_require__(240); -__webpack_require__(241); -__webpack_require__(242); -__webpack_require__(243); -__webpack_require__(244); -__webpack_require__(245); -/* tslint:disable:no-unused-variable */ -var Subscription_1 = __webpack_require__(9); -exports.Subscription = Subscription_1.Subscription; -var Subscriber_1 = __webpack_require__(2); -exports.Subscriber = Subscriber_1.Subscriber; -var AsyncSubject_1 = __webpack_require__(25); -exports.AsyncSubject = AsyncSubject_1.AsyncSubject; -var ReplaySubject_1 = __webpack_require__(26); -exports.ReplaySubject = ReplaySubject_1.ReplaySubject; -var BehaviorSubject_1 = __webpack_require__(41); -exports.BehaviorSubject = BehaviorSubject_1.BehaviorSubject; -var ConnectableObservable_1 = __webpack_require__(386); -exports.ConnectableObservable = ConnectableObservable_1.ConnectableObservable; -var Notification_1 = __webpack_require__(30); -exports.Notification = Notification_1.Notification; -var EmptyError_1 = __webpack_require__(79); -exports.EmptyError = EmptyError_1.EmptyError; -var ArgumentOutOfRangeError_1 = __webpack_require__(22); -exports.ArgumentOutOfRangeError = ArgumentOutOfRangeError_1.ArgumentOutOfRangeError; -var ObjectUnsubscribedError_1 = __webpack_require__(80); -exports.ObjectUnsubscribedError = ObjectUnsubscribedError_1.ObjectUnsubscribedError; -var TimeoutError_1 = __webpack_require__(74); -exports.TimeoutError = TimeoutError_1.TimeoutError; -var UnsubscriptionError_1 = __webpack_require__(399); -exports.UnsubscriptionError = UnsubscriptionError_1.UnsubscriptionError; -var timeInterval_1 = __webpack_require__(66); -exports.TimeInterval = timeInterval_1.TimeInterval; -var timestamp_1 = __webpack_require__(67); -exports.Timestamp = timestamp_1.Timestamp; -var TestScheduler_1 = __webpack_require__(366); -exports.TestScheduler = TestScheduler_1.TestScheduler; -var VirtualTimeScheduler_1 = __webpack_require__(69); -exports.VirtualTimeScheduler = VirtualTimeScheduler_1.VirtualTimeScheduler; -var AjaxObservable_1 = __webpack_require__(59); -exports.AjaxResponse = AjaxObservable_1.AjaxResponse; -exports.AjaxError = AjaxObservable_1.AjaxError; -exports.AjaxTimeoutError = AjaxObservable_1.AjaxTimeoutError; -var asap_1 = __webpack_require__(70); -var async_1 = __webpack_require__(8); -var queue_1 = __webpack_require__(71); -var animationFrame_1 = __webpack_require__(363); -var rxSubscriber_1 = __webpack_require__(379); -var iterator_1 = __webpack_require__(78); -var observable_1 = __webpack_require__(378); -/* tslint:enable:no-unused-variable */ -/** - * @typedef {Object} Rx.Scheduler - * @property {Scheduler} queue Schedules on a queue in the current event frame - * (trampoline scheduler). Use this for iteration operations. - * @property {Scheduler} asap Schedules on the micro task queue, which uses the - * fastest transport mechanism available, either Node.js' `process.nextTick()` - * or Web Worker MessageChannel or setTimeout or others. Use this for - * asynchronous conversions. - * @property {Scheduler} async Schedules work with `setInterval`. Use this for - * time-based operations. - * @property {Scheduler} animationFrame Schedules work with `requestAnimationFrame`. - * Use this for synchronizing with the platform's painting - */ -var Scheduler = { - asap: asap_1.asap, - queue: queue_1.queue, - animationFrame: animationFrame_1.animationFrame, - async: async_1.async -}; -exports.Scheduler = Scheduler; -/** - * @typedef {Object} Rx.Symbol - * @property {Symbol|string} rxSubscriber A symbol to use as a property name to - * retrieve an "Rx safe" Observer from an object. "Rx safety" can be defined as - * an object that has all of the traits of an Rx Subscriber, including the - * ability to add and remove subscriptions to the subscription chain and - * guarantees involving event triggering (can't "next" after unsubscription, - * etc). - * @property {Symbol|string} observable A symbol to use as a property name to - * retrieve an Observable as defined by the [ECMAScript "Observable" spec](https://github.com/zenparsing/es-observable). - * @property {Symbol|string} iterator The ES6 symbol to use as a property name - * to retrieve an iterator from an object. - */ -var Symbol = { - rxSubscriber: rxSubscriber_1.rxSubscriber, - observable: observable_1.observable, - iterator: iterator_1.iterator -}; -exports.Symbol = Symbol; -//# sourceMappingURL=Rx.js.map - -/***/ }), -/* 122 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -/** - * An execution context and a data structure to order tasks and schedule their - * execution. Provides a notion of (potentially virtual) time, through the - * `now()` getter method. - * - * Each unit of work in a Scheduler is called an {@link Action}. - * - * ```ts - * class Scheduler { - * now(): number; - * schedule(work, delay?, state?): Subscription; - * } - * ``` - * - * @class Scheduler - */ -var Scheduler = (function () { - function Scheduler(SchedulerAction, now) { - if (now === void 0) { now = Scheduler.now; } - this.SchedulerAction = SchedulerAction; - this.now = now; - } - /** - * Schedules a function, `work`, for execution. May happen at some point in - * the future, according to the `delay` parameter, if specified. May be passed - * some context object, `state`, which will be passed to the `work` function. - * - * The given arguments will be processed an stored as an Action object in a - * queue of actions. - * - * @param {function(state: ?T): ?Subscription} work A function representing a - * task, or some unit of work to be executed by the Scheduler. - * @param {number} [delay] Time to wait before executing the work, where the - * time unit is implicit and defined by the Scheduler itself. - * @param {T} [state] Some contextual data that the `work` function uses when - * called by the Scheduler. - * @return {Subscription} A subscription in order to be able to unsubscribe - * the scheduled work. - */ - Scheduler.prototype.schedule = function (work, delay, state) { - if (delay === void 0) { delay = 0; } - return new this.SchedulerAction(this, work).schedule(state, delay); - }; - Scheduler.now = Date.now ? Date.now : function () { return +new Date(); }; - return Scheduler; -}()); -exports.Scheduler = Scheduler; -//# sourceMappingURL=Scheduler.js.map - -/***/ }), -/* 123 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var bindCallback_1 = __webpack_require__(261); -Observable_1.Observable.bindCallback = bindCallback_1.bindCallback; -//# sourceMappingURL=bindCallback.js.map - -/***/ }), -/* 124 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var bindNodeCallback_1 = __webpack_require__(262); -Observable_1.Observable.bindNodeCallback = bindNodeCallback_1.bindNodeCallback; -//# sourceMappingURL=bindNodeCallback.js.map - -/***/ }), -/* 125 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var combineLatest_1 = __webpack_require__(263); -Observable_1.Observable.combineLatest = combineLatest_1.combineLatest; -//# sourceMappingURL=combineLatest.js.map - -/***/ }), -/* 126 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var concat_1 = __webpack_require__(264); -Observable_1.Observable.concat = concat_1.concat; -//# sourceMappingURL=concat.js.map - -/***/ }), -/* 127 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var defer_1 = __webpack_require__(265); -Observable_1.Observable.defer = defer_1.defer; -//# sourceMappingURL=defer.js.map - -/***/ }), -/* 128 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var ajax_1 = __webpack_require__(267); -Observable_1.Observable.ajax = ajax_1.ajax; -//# sourceMappingURL=ajax.js.map - -/***/ }), -/* 129 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var webSocket_1 = __webpack_require__(268); -Observable_1.Observable.webSocket = webSocket_1.webSocket; -//# sourceMappingURL=webSocket.js.map - -/***/ }), -/* 130 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var empty_1 = __webpack_require__(269); -Observable_1.Observable.empty = empty_1.empty; -//# sourceMappingURL=empty.js.map - -/***/ }), -/* 131 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var forkJoin_1 = __webpack_require__(388); -Observable_1.Observable.forkJoin = forkJoin_1.forkJoin; -//# sourceMappingURL=forkJoin.js.map - -/***/ }), -/* 132 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var from_1 = __webpack_require__(389); -Observable_1.Observable.from = from_1.from; -//# sourceMappingURL=from.js.map - -/***/ }), -/* 133 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var fromEvent_1 = __webpack_require__(270); -Observable_1.Observable.fromEvent = fromEvent_1.fromEvent; -//# sourceMappingURL=fromEvent.js.map - -/***/ }), -/* 134 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var fromEventPattern_1 = __webpack_require__(271); -Observable_1.Observable.fromEventPattern = fromEventPattern_1.fromEventPattern; -//# sourceMappingURL=fromEventPattern.js.map - -/***/ }), -/* 135 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var fromPromise_1 = __webpack_require__(382); -Observable_1.Observable.fromPromise = fromPromise_1.fromPromise; -//# sourceMappingURL=fromPromise.js.map - -/***/ }), -/* 136 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var GenerateObservable_1 = __webpack_require__(252); -Observable_1.Observable.generate = GenerateObservable_1.GenerateObservable.create; -//# sourceMappingURL=generate.js.map - -/***/ }), -/* 137 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var if_1 = __webpack_require__(272); -Observable_1.Observable.if = if_1._if; -//# sourceMappingURL=if.js.map - -/***/ }), -/* 138 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var merge_1 = __webpack_require__(390); -Observable_1.Observable.merge = merge_1.merge; -//# sourceMappingURL=merge.js.map - -/***/ }), -/* 139 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var never_1 = __webpack_require__(274); -Observable_1.Observable.never = never_1.never; -//# sourceMappingURL=never.js.map - -/***/ }), -/* 140 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var of_1 = __webpack_require__(391); -Observable_1.Observable.of = of_1.of; -//# sourceMappingURL=of.js.map - -/***/ }), -/* 141 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var onErrorResumeNext_1 = __webpack_require__(63); -Observable_1.Observable.onErrorResumeNext = onErrorResumeNext_1.onErrorResumeNextStatic; -//# sourceMappingURL=onErrorResumeNext.js.map - -/***/ }), -/* 142 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var pairs_1 = __webpack_require__(275); -Observable_1.Observable.pairs = pairs_1.pairs; -//# sourceMappingURL=pairs.js.map - -/***/ }), -/* 143 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var race_1 = __webpack_require__(64); -Observable_1.Observable.race = race_1.raceStatic; -//# sourceMappingURL=race.js.map - -/***/ }), -/* 144 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var range_1 = __webpack_require__(276); -Observable_1.Observable.range = range_1.range; -//# sourceMappingURL=range.js.map - -/***/ }), -/* 145 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var using_1 = __webpack_require__(279); -Observable_1.Observable.using = using_1.using; -//# sourceMappingURL=using.js.map - -/***/ }), -/* 146 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var zip_1 = __webpack_require__(280); -Observable_1.Observable.zip = zip_1.zip; -//# sourceMappingURL=zip.js.map - -/***/ }), -/* 147 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var audit_1 = __webpack_require__(281); -Observable_1.Observable.prototype.audit = audit_1.audit; -//# sourceMappingURL=audit.js.map - -/***/ }), -/* 148 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var auditTime_1 = __webpack_require__(282); -Observable_1.Observable.prototype.auditTime = auditTime_1.auditTime; -//# sourceMappingURL=auditTime.js.map - -/***/ }), -/* 149 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var buffer_1 = __webpack_require__(283); -Observable_1.Observable.prototype.buffer = buffer_1.buffer; -//# sourceMappingURL=buffer.js.map - -/***/ }), -/* 150 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var bufferCount_1 = __webpack_require__(284); -Observable_1.Observable.prototype.bufferCount = bufferCount_1.bufferCount; -//# sourceMappingURL=bufferCount.js.map - -/***/ }), -/* 151 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var bufferTime_1 = __webpack_require__(285); -Observable_1.Observable.prototype.bufferTime = bufferTime_1.bufferTime; -//# sourceMappingURL=bufferTime.js.map - -/***/ }), -/* 152 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var bufferToggle_1 = __webpack_require__(286); -Observable_1.Observable.prototype.bufferToggle = bufferToggle_1.bufferToggle; -//# sourceMappingURL=bufferToggle.js.map - -/***/ }), -/* 153 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var bufferWhen_1 = __webpack_require__(287); -Observable_1.Observable.prototype.bufferWhen = bufferWhen_1.bufferWhen; -//# sourceMappingURL=bufferWhen.js.map - -/***/ }), -/* 154 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var combineAll_1 = __webpack_require__(288); -Observable_1.Observable.prototype.combineAll = combineAll_1.combineAll; -//# sourceMappingURL=combineAll.js.map - -/***/ }), -/* 155 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var combineLatest_1 = __webpack_require__(37); -Observable_1.Observable.prototype.combineLatest = combineLatest_1.combineLatest; -//# sourceMappingURL=combineLatest.js.map - -/***/ }), -/* 156 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var concat_1 = __webpack_require__(38); -Observable_1.Observable.prototype.concat = concat_1.concat; -//# sourceMappingURL=concat.js.map - -/***/ }), -/* 157 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var concatAll_1 = __webpack_require__(393); -Observable_1.Observable.prototype.concatAll = concatAll_1.concatAll; -//# sourceMappingURL=concatAll.js.map - -/***/ }), -/* 158 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var concatMap_1 = __webpack_require__(394); -Observable_1.Observable.prototype.concatMap = concatMap_1.concatMap; -//# sourceMappingURL=concatMap.js.map - -/***/ }), -/* 159 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var concatMapTo_1 = __webpack_require__(289); -Observable_1.Observable.prototype.concatMapTo = concatMapTo_1.concatMapTo; -//# sourceMappingURL=concatMapTo.js.map - -/***/ }), -/* 160 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var count_1 = __webpack_require__(290); -Observable_1.Observable.prototype.count = count_1.count; -//# sourceMappingURL=count.js.map - -/***/ }), -/* 161 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var debounce_1 = __webpack_require__(291); -Observable_1.Observable.prototype.debounce = debounce_1.debounce; -//# sourceMappingURL=debounce.js.map - -/***/ }), -/* 162 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var debounceTime_1 = __webpack_require__(292); -Observable_1.Observable.prototype.debounceTime = debounceTime_1.debounceTime; -//# sourceMappingURL=debounceTime.js.map - -/***/ }), -/* 163 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var defaultIfEmpty_1 = __webpack_require__(293); -Observable_1.Observable.prototype.defaultIfEmpty = defaultIfEmpty_1.defaultIfEmpty; -//# sourceMappingURL=defaultIfEmpty.js.map - -/***/ }), -/* 164 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var delay_1 = __webpack_require__(294); -Observable_1.Observable.prototype.delay = delay_1.delay; -//# sourceMappingURL=delay.js.map - -/***/ }), -/* 165 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var delayWhen_1 = __webpack_require__(295); -Observable_1.Observable.prototype.delayWhen = delayWhen_1.delayWhen; -//# sourceMappingURL=delayWhen.js.map - -/***/ }), -/* 166 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var dematerialize_1 = __webpack_require__(296); -Observable_1.Observable.prototype.dematerialize = dematerialize_1.dematerialize; -//# sourceMappingURL=dematerialize.js.map - -/***/ }), -/* 167 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var distinct_1 = __webpack_require__(297); -Observable_1.Observable.prototype.distinct = distinct_1.distinct; -//# sourceMappingURL=distinct.js.map - -/***/ }), -/* 168 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var distinctUntilChanged_1 = __webpack_require__(60); -Observable_1.Observable.prototype.distinctUntilChanged = distinctUntilChanged_1.distinctUntilChanged; -//# sourceMappingURL=distinctUntilChanged.js.map - -/***/ }), -/* 169 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var distinctUntilKeyChanged_1 = __webpack_require__(298); -Observable_1.Observable.prototype.distinctUntilKeyChanged = distinctUntilKeyChanged_1.distinctUntilKeyChanged; -//# sourceMappingURL=distinctUntilKeyChanged.js.map - -/***/ }), -/* 170 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var do_1 = __webpack_require__(299); -Observable_1.Observable.prototype.do = do_1._do; -Observable_1.Observable.prototype._do = do_1._do; -//# sourceMappingURL=do.js.map - -/***/ }), -/* 171 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var elementAt_1 = __webpack_require__(300); -Observable_1.Observable.prototype.elementAt = elementAt_1.elementAt; -//# sourceMappingURL=elementAt.js.map - -/***/ }), -/* 172 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var every_1 = __webpack_require__(395); -Observable_1.Observable.prototype.every = every_1.every; -//# sourceMappingURL=every.js.map - -/***/ }), -/* 173 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var exhaust_1 = __webpack_require__(301); -Observable_1.Observable.prototype.exhaust = exhaust_1.exhaust; -//# sourceMappingURL=exhaust.js.map - -/***/ }), -/* 174 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var exhaustMap_1 = __webpack_require__(302); -Observable_1.Observable.prototype.exhaustMap = exhaustMap_1.exhaustMap; -//# sourceMappingURL=exhaustMap.js.map - -/***/ }), -/* 175 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var expand_1 = __webpack_require__(303); -Observable_1.Observable.prototype.expand = expand_1.expand; -//# sourceMappingURL=expand.js.map - -/***/ }), -/* 176 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var filter_1 = __webpack_require__(42); -Observable_1.Observable.prototype.filter = filter_1.filter; -//# sourceMappingURL=filter.js.map - -/***/ }), -/* 177 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var finally_1 = __webpack_require__(304); -Observable_1.Observable.prototype.finally = finally_1._finally; -Observable_1.Observable.prototype._finally = finally_1._finally; -//# sourceMappingURL=finally.js.map - -/***/ }), -/* 178 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var find_1 = __webpack_require__(61); -Observable_1.Observable.prototype.find = find_1.find; -//# sourceMappingURL=find.js.map - -/***/ }), -/* 179 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var findIndex_1 = __webpack_require__(305); -Observable_1.Observable.prototype.findIndex = findIndex_1.findIndex; -//# sourceMappingURL=findIndex.js.map - -/***/ }), -/* 180 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var groupBy_1 = __webpack_require__(306); -Observable_1.Observable.prototype.groupBy = groupBy_1.groupBy; -//# sourceMappingURL=groupBy.js.map - -/***/ }), -/* 181 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var ignoreElements_1 = __webpack_require__(307); -Observable_1.Observable.prototype.ignoreElements = ignoreElements_1.ignoreElements; -//# sourceMappingURL=ignoreElements.js.map - -/***/ }), -/* 182 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var isEmpty_1 = __webpack_require__(308); -Observable_1.Observable.prototype.isEmpty = isEmpty_1.isEmpty; -//# sourceMappingURL=isEmpty.js.map - -/***/ }), -/* 183 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var last_1 = __webpack_require__(396); -Observable_1.Observable.prototype.last = last_1.last; -//# sourceMappingURL=last.js.map - -/***/ }), -/* 184 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var let_1 = __webpack_require__(309); -Observable_1.Observable.prototype.let = let_1.letProto; -Observable_1.Observable.prototype.letBind = let_1.letProto; -//# sourceMappingURL=let.js.map - -/***/ }), -/* 185 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var mapTo_1 = __webpack_require__(310); -Observable_1.Observable.prototype.mapTo = mapTo_1.mapTo; -//# sourceMappingURL=mapTo.js.map - -/***/ }), -/* 186 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var materialize_1 = __webpack_require__(311); -Observable_1.Observable.prototype.materialize = materialize_1.materialize; -//# sourceMappingURL=materialize.js.map - -/***/ }), -/* 187 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var max_1 = __webpack_require__(312); -Observable_1.Observable.prototype.max = max_1.max; -//# sourceMappingURL=max.js.map - -/***/ }), -/* 188 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var merge_1 = __webpack_require__(397); -Observable_1.Observable.prototype.merge = merge_1.merge; -//# sourceMappingURL=merge.js.map - -/***/ }), -/* 189 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var mergeAll_1 = __webpack_require__(77); -Observable_1.Observable.prototype.mergeAll = mergeAll_1.mergeAll; -//# sourceMappingURL=mergeAll.js.map - -/***/ }), -/* 190 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var mergeMap_1 = __webpack_require__(383); -Observable_1.Observable.prototype.mergeMap = mergeMap_1.mergeMap; -Observable_1.Observable.prototype.flatMap = mergeMap_1.mergeMap; -//# sourceMappingURL=mergeMap.js.map - -/***/ }), -/* 191 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var mergeMapTo_1 = __webpack_require__(62); -Observable_1.Observable.prototype.flatMapTo = mergeMapTo_1.mergeMapTo; -Observable_1.Observable.prototype.mergeMapTo = mergeMapTo_1.mergeMapTo; -//# sourceMappingURL=mergeMapTo.js.map - -/***/ }), -/* 192 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var mergeScan_1 = __webpack_require__(313); -Observable_1.Observable.prototype.mergeScan = mergeScan_1.mergeScan; -//# sourceMappingURL=mergeScan.js.map - -/***/ }), -/* 193 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var min_1 = __webpack_require__(314); -Observable_1.Observable.prototype.min = min_1.min; -//# sourceMappingURL=min.js.map - -/***/ }), -/* 194 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var multicast_1 = __webpack_require__(16); -Observable_1.Observable.prototype.multicast = multicast_1.multicast; -//# sourceMappingURL=multicast.js.map - -/***/ }), -/* 195 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var observeOn_1 = __webpack_require__(87); -Observable_1.Observable.prototype.observeOn = observeOn_1.observeOn; -//# sourceMappingURL=observeOn.js.map - -/***/ }), -/* 196 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var onErrorResumeNext_1 = __webpack_require__(63); -Observable_1.Observable.prototype.onErrorResumeNext = onErrorResumeNext_1.onErrorResumeNext; -//# sourceMappingURL=onErrorResumeNext.js.map - -/***/ }), -/* 197 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var pairwise_1 = __webpack_require__(315); -Observable_1.Observable.prototype.pairwise = pairwise_1.pairwise; -//# sourceMappingURL=pairwise.js.map +/*! ***************************************************************************** +Copyright (C) Microsoft. 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. +***************************************************************************** */ +var Reflect; +(function (Reflect) { + "use strict"; + var hasOwn = Object.prototype.hasOwnProperty; + // feature test for Symbol support + var supportsSymbol = typeof Symbol === "function"; + var toPrimitiveSymbol = supportsSymbol && typeof Symbol.toPrimitive !== "undefined" ? Symbol.toPrimitive : "@@toPrimitive"; + var iteratorSymbol = supportsSymbol && typeof Symbol.iterator !== "undefined" ? Symbol.iterator : "@@iterator"; + var HashMap; + (function (HashMap) { + var supportsCreate = typeof Object.create === "function"; // feature test for Object.create support + var supportsProto = { __proto__: [] } instanceof Array; // feature test for __proto__ support + var downLevel = !supportsCreate && !supportsProto; + // create an object in dictionary mode (a.k.a. "slow" mode in v8) + HashMap.create = supportsCreate + ? function () { return MakeDictionary(Object.create(null)); } + : supportsProto + ? function () { return MakeDictionary({ __proto__: null }); } + : function () { return MakeDictionary({}); }; + HashMap.has = downLevel + ? function (map, key) { return hasOwn.call(map, key); } + : function (map, key) { return key in map; }; + HashMap.get = downLevel + ? function (map, key) { return hasOwn.call(map, key) ? map[key] : undefined; } + : function (map, key) { return map[key]; }; + })(HashMap || (HashMap = {})); + // Load global or shim versions of Map, Set, and WeakMap + var functionPrototype = Object.getPrototypeOf(Function); + var usePolyfill = typeof process === "object" && process.env && process.env["REFLECT_METADATA_USE_MAP_POLYFILL"] === "true"; + var _Map = !usePolyfill && typeof Map === "function" && typeof Map.prototype.entries === "function" ? Map : CreateMapPolyfill(); + var _Set = !usePolyfill && typeof Set === "function" && typeof Set.prototype.entries === "function" ? Set : CreateSetPolyfill(); + var _WeakMap = !usePolyfill && typeof WeakMap === "function" ? WeakMap : CreateWeakMapPolyfill(); + // [[Metadata]] internal slot + // https://rbuckton.github.io/reflect-metadata/#ordinary-object-internal-methods-and-internal-slots + var Metadata = new _WeakMap(); + /** + * Applies a set of decorators to a property of a target object. + * @param decorators An array of decorators. + * @param target The target object. + * @param propertyKey (Optional) The property key to decorate. + * @param attributes (Optional) The property descriptor for the target key. + * @remarks Decorators are applied in reverse order. + * @example + * + * class Example { + * // property declarations are not part of ES6, though they are valid in TypeScript: + * // static staticProperty; + * // property; + * + * constructor(p) { } + * static staticMethod(p) { } + * method(p) { } + * } + * + * // constructor + * Example = Reflect.decorate(decoratorsArray, Example); + * + * // property (on constructor) + * Reflect.decorate(decoratorsArray, Example, "staticProperty"); + * + * // property (on prototype) + * Reflect.decorate(decoratorsArray, Example.prototype, "property"); + * + * // method (on constructor) + * Object.defineProperty(Example, "staticMethod", + * Reflect.decorate(decoratorsArray, Example, "staticMethod", + * Object.getOwnPropertyDescriptor(Example, "staticMethod"))); + * + * // method (on prototype) + * Object.defineProperty(Example.prototype, "method", + * Reflect.decorate(decoratorsArray, Example.prototype, "method", + * Object.getOwnPropertyDescriptor(Example.prototype, "method"))); + * + */ + function decorate(decorators, target, propertyKey, attributes) { + if (!IsUndefined(propertyKey)) { + if (!IsArray(decorators)) + throw new TypeError(); + if (!IsObject(target)) + throw new TypeError(); + if (!IsObject(attributes) && !IsUndefined(attributes) && !IsNull(attributes)) + throw new TypeError(); + if (IsNull(attributes)) + attributes = undefined; + propertyKey = ToPropertyKey(propertyKey); + return DecorateProperty(decorators, target, propertyKey, attributes); + } + else { + if (!IsArray(decorators)) + throw new TypeError(); + if (!IsConstructor(target)) + throw new TypeError(); + return DecorateConstructor(decorators, target); + } + } + Reflect.decorate = decorate; + // 4.1.2 Reflect.metadata(metadataKey, metadataValue) + // https://rbuckton.github.io/reflect-metadata/#reflect.metadata + /** + * A default metadata decorator factory that can be used on a class, class member, or parameter. + * @param metadataKey The key for the metadata entry. + * @param metadataValue The value for the metadata entry. + * @returns A decorator function. + * @remarks + * If `metadataKey` is already defined for the target and target key, the + * metadataValue for that key will be overwritten. + * @example + * + * // constructor + * @Reflect.metadata(key, value) + * class Example { + * } + * + * // property (on constructor, TypeScript only) + * class Example { + * @Reflect.metadata(key, value) + * static staticProperty; + * } + * + * // property (on prototype, TypeScript only) + * class Example { + * @Reflect.metadata(key, value) + * property; + * } + * + * // method (on constructor) + * class Example { + * @Reflect.metadata(key, value) + * static staticMethod() { } + * } + * + * // method (on prototype) + * class Example { + * @Reflect.metadata(key, value) + * method() { } + * } + * + */ + function metadata(metadataKey, metadataValue) { + function decorator(target, propertyKey) { + if (!IsObject(target)) + throw new TypeError(); + if (!IsUndefined(propertyKey) && !IsPropertyKey(propertyKey)) + throw new TypeError(); + OrdinaryDefineOwnMetadata(metadataKey, metadataValue, target, propertyKey); + } + return decorator; + } + Reflect.metadata = metadata; + /** + * Define a unique metadata entry on the target. + * @param metadataKey A key used to store and retrieve metadata. + * @param metadataValue A value that contains attached metadata. + * @param target The target object on which to define metadata. + * @param propertyKey (Optional) The property key for the target. + * @example + * + * class Example { + * // property declarations are not part of ES6, though they are valid in TypeScript: + * // static staticProperty; + * // property; + * + * constructor(p) { } + * static staticMethod(p) { } + * method(p) { } + * } + * + * // constructor + * Reflect.defineMetadata("custom:annotation", options, Example); + * + * // property (on constructor) + * Reflect.defineMetadata("custom:annotation", options, Example, "staticProperty"); + * + * // property (on prototype) + * Reflect.defineMetadata("custom:annotation", options, Example.prototype, "property"); + * + * // method (on constructor) + * Reflect.defineMetadata("custom:annotation", options, Example, "staticMethod"); + * + * // method (on prototype) + * Reflect.defineMetadata("custom:annotation", options, Example.prototype, "method"); + * + * // decorator factory as metadata-producing annotation. + * function MyAnnotation(options): Decorator { + * return (target, key?) => Reflect.defineMetadata("custom:annotation", options, target, key); + * } + * + */ + function defineMetadata(metadataKey, metadataValue, target, propertyKey) { + if (!IsObject(target)) + throw new TypeError(); + if (!IsUndefined(propertyKey)) + propertyKey = ToPropertyKey(propertyKey); + return OrdinaryDefineOwnMetadata(metadataKey, metadataValue, target, propertyKey); + } + Reflect.defineMetadata = defineMetadata; + /** + * Gets a value indicating whether the target object or its prototype chain has the provided metadata key defined. + * @param metadataKey A key used to store and retrieve metadata. + * @param target The target object on which the metadata is defined. + * @param propertyKey (Optional) The property key for the target. + * @returns `true` if the metadata key was defined on the target object or its prototype chain; otherwise, `false`. + * @example + * + * class Example { + * // property declarations are not part of ES6, though they are valid in TypeScript: + * // static staticProperty; + * // property; + * + * constructor(p) { } + * static staticMethod(p) { } + * method(p) { } + * } + * + * // constructor + * result = Reflect.hasMetadata("custom:annotation", Example); + * + * // property (on constructor) + * result = Reflect.hasMetadata("custom:annotation", Example, "staticProperty"); + * + * // property (on prototype) + * result = Reflect.hasMetadata("custom:annotation", Example.prototype, "property"); + * + * // method (on constructor) + * result = Reflect.hasMetadata("custom:annotation", Example, "staticMethod"); + * + * // method (on prototype) + * result = Reflect.hasMetadata("custom:annotation", Example.prototype, "method"); + * + */ + function hasMetadata(metadataKey, target, propertyKey) { + if (!IsObject(target)) + throw new TypeError(); + if (!IsUndefined(propertyKey)) + propertyKey = ToPropertyKey(propertyKey); + return OrdinaryHasMetadata(metadataKey, target, propertyKey); + } + Reflect.hasMetadata = hasMetadata; + /** + * Gets a value indicating whether the target object has the provided metadata key defined. + * @param metadataKey A key used to store and retrieve metadata. + * @param target The target object on which the metadata is defined. + * @param propertyKey (Optional) The property key for the target. + * @returns `true` if the metadata key was defined on the target object; otherwise, `false`. + * @example + * + * class Example { + * // property declarations are not part of ES6, though they are valid in TypeScript: + * // static staticProperty; + * // property; + * + * constructor(p) { } + * static staticMethod(p) { } + * method(p) { } + * } + * + * // constructor + * result = Reflect.hasOwnMetadata("custom:annotation", Example); + * + * // property (on constructor) + * result = Reflect.hasOwnMetadata("custom:annotation", Example, "staticProperty"); + * + * // property (on prototype) + * result = Reflect.hasOwnMetadata("custom:annotation", Example.prototype, "property"); + * + * // method (on constructor) + * result = Reflect.hasOwnMetadata("custom:annotation", Example, "staticMethod"); + * + * // method (on prototype) + * result = Reflect.hasOwnMetadata("custom:annotation", Example.prototype, "method"); + * + */ + function hasOwnMetadata(metadataKey, target, propertyKey) { + if (!IsObject(target)) + throw new TypeError(); + if (!IsUndefined(propertyKey)) + propertyKey = ToPropertyKey(propertyKey); + return OrdinaryHasOwnMetadata(metadataKey, target, propertyKey); + } + Reflect.hasOwnMetadata = hasOwnMetadata; + /** + * Gets the metadata value for the provided metadata key on the target object or its prototype chain. + * @param metadataKey A key used to store and retrieve metadata. + * @param target The target object on which the metadata is defined. + * @param propertyKey (Optional) The property key for the target. + * @returns The metadata value for the metadata key if found; otherwise, `undefined`. + * @example + * + * class Example { + * // property declarations are not part of ES6, though they are valid in TypeScript: + * // static staticProperty; + * // property; + * + * constructor(p) { } + * static staticMethod(p) { } + * method(p) { } + * } + * + * // constructor + * result = Reflect.getMetadata("custom:annotation", Example); + * + * // property (on constructor) + * result = Reflect.getMetadata("custom:annotation", Example, "staticProperty"); + * + * // property (on prototype) + * result = Reflect.getMetadata("custom:annotation", Example.prototype, "property"); + * + * // method (on constructor) + * result = Reflect.getMetadata("custom:annotation", Example, "staticMethod"); + * + * // method (on prototype) + * result = Reflect.getMetadata("custom:annotation", Example.prototype, "method"); + * + */ + function getMetadata(metadataKey, target, propertyKey) { + if (!IsObject(target)) + throw new TypeError(); + if (!IsUndefined(propertyKey)) + propertyKey = ToPropertyKey(propertyKey); + return OrdinaryGetMetadata(metadataKey, target, propertyKey); + } + Reflect.getMetadata = getMetadata; + /** + * Gets the metadata value for the provided metadata key on the target object. + * @param metadataKey A key used to store and retrieve metadata. + * @param target The target object on which the metadata is defined. + * @param propertyKey (Optional) The property key for the target. + * @returns The metadata value for the metadata key if found; otherwise, `undefined`. + * @example + * + * class Example { + * // property declarations are not part of ES6, though they are valid in TypeScript: + * // static staticProperty; + * // property; + * + * constructor(p) { } + * static staticMethod(p) { } + * method(p) { } + * } + * + * // constructor + * result = Reflect.getOwnMetadata("custom:annotation", Example); + * + * // property (on constructor) + * result = Reflect.getOwnMetadata("custom:annotation", Example, "staticProperty"); + * + * // property (on prototype) + * result = Reflect.getOwnMetadata("custom:annotation", Example.prototype, "property"); + * + * // method (on constructor) + * result = Reflect.getOwnMetadata("custom:annotation", Example, "staticMethod"); + * + * // method (on prototype) + * result = Reflect.getOwnMetadata("custom:annotation", Example.prototype, "method"); + * + */ + function getOwnMetadata(metadataKey, target, propertyKey) { + if (!IsObject(target)) + throw new TypeError(); + if (!IsUndefined(propertyKey)) + propertyKey = ToPropertyKey(propertyKey); + return OrdinaryGetOwnMetadata(metadataKey, target, propertyKey); + } + Reflect.getOwnMetadata = getOwnMetadata; + /** + * Gets the metadata keys defined on the target object or its prototype chain. + * @param target The target object on which the metadata is defined. + * @param propertyKey (Optional) The property key for the target. + * @returns An array of unique metadata keys. + * @example + * + * class Example { + * // property declarations are not part of ES6, though they are valid in TypeScript: + * // static staticProperty; + * // property; + * + * constructor(p) { } + * static staticMethod(p) { } + * method(p) { } + * } + * + * // constructor + * result = Reflect.getMetadataKeys(Example); + * + * // property (on constructor) + * result = Reflect.getMetadataKeys(Example, "staticProperty"); + * + * // property (on prototype) + * result = Reflect.getMetadataKeys(Example.prototype, "property"); + * + * // method (on constructor) + * result = Reflect.getMetadataKeys(Example, "staticMethod"); + * + * // method (on prototype) + * result = Reflect.getMetadataKeys(Example.prototype, "method"); + * + */ + function getMetadataKeys(target, propertyKey) { + if (!IsObject(target)) + throw new TypeError(); + if (!IsUndefined(propertyKey)) + propertyKey = ToPropertyKey(propertyKey); + return OrdinaryMetadataKeys(target, propertyKey); + } + Reflect.getMetadataKeys = getMetadataKeys; + /** + * Gets the unique metadata keys defined on the target object. + * @param target The target object on which the metadata is defined. + * @param propertyKey (Optional) The property key for the target. + * @returns An array of unique metadata keys. + * @example + * + * class Example { + * // property declarations are not part of ES6, though they are valid in TypeScript: + * // static staticProperty; + * // property; + * + * constructor(p) { } + * static staticMethod(p) { } + * method(p) { } + * } + * + * // constructor + * result = Reflect.getOwnMetadataKeys(Example); + * + * // property (on constructor) + * result = Reflect.getOwnMetadataKeys(Example, "staticProperty"); + * + * // property (on prototype) + * result = Reflect.getOwnMetadataKeys(Example.prototype, "property"); + * + * // method (on constructor) + * result = Reflect.getOwnMetadataKeys(Example, "staticMethod"); + * + * // method (on prototype) + * result = Reflect.getOwnMetadataKeys(Example.prototype, "method"); + * + */ + function getOwnMetadataKeys(target, propertyKey) { + if (!IsObject(target)) + throw new TypeError(); + if (!IsUndefined(propertyKey)) + propertyKey = ToPropertyKey(propertyKey); + return OrdinaryOwnMetadataKeys(target, propertyKey); + } + Reflect.getOwnMetadataKeys = getOwnMetadataKeys; + /** + * Deletes the metadata entry from the target object with the provided key. + * @param metadataKey A key used to store and retrieve metadata. + * @param target The target object on which the metadata is defined. + * @param propertyKey (Optional) The property key for the target. + * @returns `true` if the metadata entry was found and deleted; otherwise, false. + * @example + * + * class Example { + * // property declarations are not part of ES6, though they are valid in TypeScript: + * // static staticProperty; + * // property; + * + * constructor(p) { } + * static staticMethod(p) { } + * method(p) { } + * } + * + * // constructor + * result = Reflect.deleteMetadata("custom:annotation", Example); + * + * // property (on constructor) + * result = Reflect.deleteMetadata("custom:annotation", Example, "staticProperty"); + * + * // property (on prototype) + * result = Reflect.deleteMetadata("custom:annotation", Example.prototype, "property"); + * + * // method (on constructor) + * result = Reflect.deleteMetadata("custom:annotation", Example, "staticMethod"); + * + * // method (on prototype) + * result = Reflect.deleteMetadata("custom:annotation", Example.prototype, "method"); + * + */ + function deleteMetadata(metadataKey, target, propertyKey) { + if (!IsObject(target)) + throw new TypeError(); + if (!IsUndefined(propertyKey)) + propertyKey = ToPropertyKey(propertyKey); + var metadataMap = GetOrCreateMetadataMap(target, propertyKey, /*Create*/ false); + if (IsUndefined(metadataMap)) + return false; + if (!metadataMap.delete(metadataKey)) + return false; + if (metadataMap.size > 0) + return true; + var targetMetadata = Metadata.get(target); + targetMetadata.delete(propertyKey); + if (targetMetadata.size > 0) + return true; + Metadata.delete(target); + return true; + } + Reflect.deleteMetadata = deleteMetadata; + function DecorateConstructor(decorators, target) { + for (var i = decorators.length - 1; i >= 0; --i) { + var decorator = decorators[i]; + var decorated = decorator(target); + if (!IsUndefined(decorated) && !IsNull(decorated)) { + if (!IsConstructor(decorated)) + throw new TypeError(); + target = decorated; + } + } + return target; + } + function DecorateProperty(decorators, target, propertyKey, descriptor) { + for (var i = decorators.length - 1; i >= 0; --i) { + var decorator = decorators[i]; + var decorated = decorator(target, propertyKey, descriptor); + if (!IsUndefined(decorated) && !IsNull(decorated)) { + if (!IsObject(decorated)) + throw new TypeError(); + descriptor = decorated; + } + } + return descriptor; + } + function GetOrCreateMetadataMap(O, P, Create) { + var targetMetadata = Metadata.get(O); + if (IsUndefined(targetMetadata)) { + if (!Create) + return undefined; + targetMetadata = new _Map(); + Metadata.set(O, targetMetadata); + } + var metadataMap = targetMetadata.get(P); + if (IsUndefined(metadataMap)) { + if (!Create) + return undefined; + metadataMap = new _Map(); + targetMetadata.set(P, metadataMap); + } + return metadataMap; + } + // 3.1.1.1 OrdinaryHasMetadata(MetadataKey, O, P) + // https://rbuckton.github.io/reflect-metadata/#ordinaryhasmetadata + function OrdinaryHasMetadata(MetadataKey, O, P) { + var hasOwn = OrdinaryHasOwnMetadata(MetadataKey, O, P); + if (hasOwn) + return true; + var parent = OrdinaryGetPrototypeOf(O); + if (!IsNull(parent)) + return OrdinaryHasMetadata(MetadataKey, parent, P); + return false; + } + // 3.1.2.1 OrdinaryHasOwnMetadata(MetadataKey, O, P) + // https://rbuckton.github.io/reflect-metadata/#ordinaryhasownmetadata + function OrdinaryHasOwnMetadata(MetadataKey, O, P) { + var metadataMap = GetOrCreateMetadataMap(O, P, /*Create*/ false); + if (IsUndefined(metadataMap)) + return false; + return ToBoolean(metadataMap.has(MetadataKey)); + } + // 3.1.3.1 OrdinaryGetMetadata(MetadataKey, O, P) + // https://rbuckton.github.io/reflect-metadata/#ordinarygetmetadata + function OrdinaryGetMetadata(MetadataKey, O, P) { + var hasOwn = OrdinaryHasOwnMetadata(MetadataKey, O, P); + if (hasOwn) + return OrdinaryGetOwnMetadata(MetadataKey, O, P); + var parent = OrdinaryGetPrototypeOf(O); + if (!IsNull(parent)) + return OrdinaryGetMetadata(MetadataKey, parent, P); + return undefined; + } + // 3.1.4.1 OrdinaryGetOwnMetadata(MetadataKey, O, P) + // https://rbuckton.github.io/reflect-metadata/#ordinarygetownmetadata + function OrdinaryGetOwnMetadata(MetadataKey, O, P) { + var metadataMap = GetOrCreateMetadataMap(O, P, /*Create*/ false); + if (IsUndefined(metadataMap)) + return undefined; + return metadataMap.get(MetadataKey); + } + // 3.1.5.1 OrdinaryDefineOwnMetadata(MetadataKey, MetadataValue, O, P) + // https://rbuckton.github.io/reflect-metadata/#ordinarydefineownmetadata + function OrdinaryDefineOwnMetadata(MetadataKey, MetadataValue, O, P) { + var metadataMap = GetOrCreateMetadataMap(O, P, /*Create*/ true); + metadataMap.set(MetadataKey, MetadataValue); + } + // 3.1.6.1 OrdinaryMetadataKeys(O, P) + // https://rbuckton.github.io/reflect-metadata/#ordinarymetadatakeys + function OrdinaryMetadataKeys(O, P) { + var ownKeys = OrdinaryOwnMetadataKeys(O, P); + var parent = OrdinaryGetPrototypeOf(O); + if (parent === null) + return ownKeys; + var parentKeys = OrdinaryMetadataKeys(parent, P); + if (parentKeys.length <= 0) + return ownKeys; + if (ownKeys.length <= 0) + return parentKeys; + var set = new _Set(); + var keys = []; + for (var _i = 0, ownKeys_1 = ownKeys; _i < ownKeys_1.length; _i++) { + var key = ownKeys_1[_i]; + var hasKey = set.has(key); + if (!hasKey) { + set.add(key); + keys.push(key); + } + } + for (var _a = 0, parentKeys_1 = parentKeys; _a < parentKeys_1.length; _a++) { + var key = parentKeys_1[_a]; + var hasKey = set.has(key); + if (!hasKey) { + set.add(key); + keys.push(key); + } + } + return keys; + } + // 3.1.7.1 OrdinaryOwnMetadataKeys(O, P) + // https://rbuckton.github.io/reflect-metadata/#ordinaryownmetadatakeys + function OrdinaryOwnMetadataKeys(O, P) { + var keys = []; + var metadataMap = GetOrCreateMetadataMap(O, P, /*Create*/ false); + if (IsUndefined(metadataMap)) + return keys; + var keysObj = metadataMap.keys(); + var iterator = GetIterator(keysObj); + var k = 0; + while (true) { + var next = IteratorStep(iterator); + if (!next) { + keys.length = k; + return keys; + } + var nextValue = IteratorValue(next); + try { + keys[k] = nextValue; + } + catch (e) { + try { + IteratorClose(iterator); + } + finally { + throw e; + } + } + k++; + } + } + // 6 ECMAScript Data Typ0es and Values + // https://tc39.github.io/ecma262/#sec-ecmascript-data-types-and-values + function Type(x) { + if (x === null) + return 1 /* Null */; + switch (typeof x) { + case "undefined": return 0 /* Undefined */; + case "boolean": return 2 /* Boolean */; + case "string": return 3 /* String */; + case "symbol": return 4 /* Symbol */; + case "number": return 5 /* Number */; + case "object": return x === null ? 1 /* Null */ : 6 /* Object */; + default: return 6 /* Object */; + } + } + // 6.1.1 The Undefined Type + // https://tc39.github.io/ecma262/#sec-ecmascript-language-types-undefined-type + function IsUndefined(x) { + return x === undefined; + } + // 6.1.2 The Null Type + // https://tc39.github.io/ecma262/#sec-ecmascript-language-types-null-type + function IsNull(x) { + return x === null; + } + // 6.1.5 The Symbol Type + // https://tc39.github.io/ecma262/#sec-ecmascript-language-types-symbol-type + function IsSymbol(x) { + return typeof x === "symbol"; + } + // 6.1.7 The Object Type + // https://tc39.github.io/ecma262/#sec-object-type + function IsObject(x) { + return typeof x === "object" ? x !== null : typeof x === "function"; + } + // 7.1 Type Conversion + // https://tc39.github.io/ecma262/#sec-type-conversion + // 7.1.1 ToPrimitive(input [, PreferredType]) + // https://tc39.github.io/ecma262/#sec-toprimitive + function ToPrimitive(input, PreferredType) { + switch (Type(input)) { + case 0 /* Undefined */: return input; + case 1 /* Null */: return input; + case 2 /* Boolean */: return input; + case 3 /* String */: return input; + case 4 /* Symbol */: return input; + case 5 /* Number */: return input; + } + var hint = PreferredType === 3 /* String */ ? "string" : PreferredType === 5 /* Number */ ? "number" : "default"; + var exoticToPrim = GetMethod(input, toPrimitiveSymbol); + if (exoticToPrim !== undefined) { + var result = exoticToPrim.call(input, hint); + if (IsObject(result)) + throw new TypeError(); + return result; + } + return OrdinaryToPrimitive(input, hint === "default" ? "number" : hint); + } + // 7.1.1.1 OrdinaryToPrimitive(O, hint) + // https://tc39.github.io/ecma262/#sec-ordinarytoprimitive + function OrdinaryToPrimitive(O, hint) { + if (hint === "string") { + var toString_1 = O.toString; + if (IsCallable(toString_1)) { + var result = toString_1.call(O); + if (!IsObject(result)) + return result; + } + var valueOf = O.valueOf; + if (IsCallable(valueOf)) { + var result = valueOf.call(O); + if (!IsObject(result)) + return result; + } + } + else { + var valueOf = O.valueOf; + if (IsCallable(valueOf)) { + var result = valueOf.call(O); + if (!IsObject(result)) + return result; + } + var toString_2 = O.toString; + if (IsCallable(toString_2)) { + var result = toString_2.call(O); + if (!IsObject(result)) + return result; + } + } + throw new TypeError(); + } + // 7.1.2 ToBoolean(argument) + // https://tc39.github.io/ecma262/2016/#sec-toboolean + function ToBoolean(argument) { + return !!argument; + } + // 7.1.12 ToString(argument) + // https://tc39.github.io/ecma262/#sec-tostring + function ToString(argument) { + return "" + argument; + } + // 7.1.14 ToPropertyKey(argument) + // https://tc39.github.io/ecma262/#sec-topropertykey + function ToPropertyKey(argument) { + var key = ToPrimitive(argument, 3 /* String */); + if (IsSymbol(key)) + return key; + return ToString(key); + } + // 7.2 Testing and Comparison Operations + // https://tc39.github.io/ecma262/#sec-testing-and-comparison-operations + // 7.2.2 IsArray(argument) + // https://tc39.github.io/ecma262/#sec-isarray + function IsArray(argument) { + return Array.isArray + ? Array.isArray(argument) + : argument instanceof Object + ? argument instanceof Array + : Object.prototype.toString.call(argument) === "[object Array]"; + } + // 7.2.3 IsCallable(argument) + // https://tc39.github.io/ecma262/#sec-iscallable + function IsCallable(argument) { + // NOTE: This is an approximation as we cannot check for [[Call]] internal method. + return typeof argument === "function"; + } + // 7.2.4 IsConstructor(argument) + // https://tc39.github.io/ecma262/#sec-isconstructor + function IsConstructor(argument) { + // NOTE: This is an approximation as we cannot check for [[Construct]] internal method. + return typeof argument === "function"; + } + // 7.2.7 IsPropertyKey(argument) + // https://tc39.github.io/ecma262/#sec-ispropertykey + function IsPropertyKey(argument) { + switch (Type(argument)) { + case 3 /* String */: return true; + case 4 /* Symbol */: return true; + default: return false; + } + } + // 7.3 Operations on Objects + // https://tc39.github.io/ecma262/#sec-operations-on-objects + // 7.3.9 GetMethod(V, P) + // https://tc39.github.io/ecma262/#sec-getmethod + function GetMethod(V, P) { + var func = V[P]; + if (func === undefined || func === null) + return undefined; + if (!IsCallable(func)) + throw new TypeError(); + return func; + } + // 7.4 Operations on Iterator Objects + // https://tc39.github.io/ecma262/#sec-operations-on-iterator-objects + function GetIterator(obj) { + var method = GetMethod(obj, iteratorSymbol); + if (!IsCallable(method)) + throw new TypeError(); // from Call + var iterator = method.call(obj); + if (!IsObject(iterator)) + throw new TypeError(); + return iterator; + } + // 7.4.4 IteratorValue(iterResult) + // https://tc39.github.io/ecma262/2016/#sec-iteratorvalue + function IteratorValue(iterResult) { + return iterResult.value; + } + // 7.4.5 IteratorStep(iterator) + // https://tc39.github.io/ecma262/#sec-iteratorstep + function IteratorStep(iterator) { + var result = iterator.next(); + return result.done ? false : result; + } + // 7.4.6 IteratorClose(iterator, completion) + // https://tc39.github.io/ecma262/#sec-iteratorclose + function IteratorClose(iterator) { + var f = iterator["return"]; + if (f) + f.call(iterator); + } + // 9.1 Ordinary Object Internal Methods and Internal Slots + // https://tc39.github.io/ecma262/#sec-ordinary-object-internal-methods-and-internal-slots + // 9.1.1.1 OrdinaryGetPrototypeOf(O) + // https://tc39.github.io/ecma262/#sec-ordinarygetprototypeof + function OrdinaryGetPrototypeOf(O) { + var proto = Object.getPrototypeOf(O); + if (typeof O !== "function" || O === functionPrototype) + return proto; + // TypeScript doesn't set __proto__ in ES5, as it's non-standard. + // Try to determine the superclass constructor. Compatible implementations + // must either set __proto__ on a subclass constructor to the superclass constructor, + // or ensure each class has a valid `constructor` property on its prototype that + // points back to the constructor. + // If this is not the same as Function.[[Prototype]], then this is definately inherited. + // This is the case when in ES6 or when using __proto__ in a compatible browser. + if (proto !== functionPrototype) + return proto; + // If the super prototype is Object.prototype, null, or undefined, then we cannot determine the heritage. + var prototype = O.prototype; + var prototypeProto = prototype && Object.getPrototypeOf(prototype); + if (prototypeProto == null || prototypeProto === Object.prototype) + return proto; + // If the constructor was not a function, then we cannot determine the heritage. + var constructor = prototypeProto.constructor; + if (typeof constructor !== "function") + return proto; + // If we have some kind of self-reference, then we cannot determine the heritage. + if (constructor === O) + return proto; + // we have a pretty good guess at the heritage. + return constructor; + } + // naive Map shim + function CreateMapPolyfill() { + var cacheSentinel = {}; + var arraySentinel = []; + var MapIterator = (function () { + function MapIterator(keys, values, selector) { + this._index = 0; + this._keys = keys; + this._values = values; + this._selector = selector; + } + MapIterator.prototype["@@iterator"] = function () { return this; }; + MapIterator.prototype[iteratorSymbol] = function () { return this; }; + MapIterator.prototype.next = function () { + var index = this._index; + if (index >= 0 && index < this._keys.length) { + var result = this._selector(this._keys[index], this._values[index]); + if (index + 1 >= this._keys.length) { + this._index = -1; + this._keys = arraySentinel; + this._values = arraySentinel; + } + else { + this._index++; + } + return { value: result, done: false }; + } + return { value: undefined, done: true }; + }; + MapIterator.prototype.throw = function (error) { + if (this._index >= 0) { + this._index = -1; + this._keys = arraySentinel; + this._values = arraySentinel; + } + throw error; + }; + MapIterator.prototype.return = function (value) { + if (this._index >= 0) { + this._index = -1; + this._keys = arraySentinel; + this._values = arraySentinel; + } + return { value: value, done: true }; + }; + return MapIterator; + }()); + return (function () { + function Map() { + this._keys = []; + this._values = []; + this._cacheKey = cacheSentinel; + this._cacheIndex = -2; + } + Object.defineProperty(Map.prototype, "size", { + get: function () { return this._keys.length; }, + enumerable: true, + configurable: true + }); + Map.prototype.has = function (key) { return this._find(key, /*insert*/ false) >= 0; }; + Map.prototype.get = function (key) { + var index = this._find(key, /*insert*/ false); + return index >= 0 ? this._values[index] : undefined; + }; + Map.prototype.set = function (key, value) { + var index = this._find(key, /*insert*/ true); + this._values[index] = value; + return this; + }; + Map.prototype.delete = function (key) { + var index = this._find(key, /*insert*/ false); + if (index >= 0) { + var size = this._keys.length; + for (var i = index + 1; i < size; i++) { + this._keys[i - 1] = this._keys[i]; + this._values[i - 1] = this._values[i]; + } + this._keys.length--; + this._values.length--; + if (key === this._cacheKey) { + this._cacheKey = cacheSentinel; + this._cacheIndex = -2; + } + return true; + } + return false; + }; + Map.prototype.clear = function () { + this._keys.length = 0; + this._values.length = 0; + this._cacheKey = cacheSentinel; + this._cacheIndex = -2; + }; + Map.prototype.keys = function () { return new MapIterator(this._keys, this._values, getKey); }; + Map.prototype.values = function () { return new MapIterator(this._keys, this._values, getValue); }; + Map.prototype.entries = function () { return new MapIterator(this._keys, this._values, getEntry); }; + Map.prototype["@@iterator"] = function () { return this.entries(); }; + Map.prototype[iteratorSymbol] = function () { return this.entries(); }; + Map.prototype._find = function (key, insert) { + if (this._cacheKey !== key) { + this._cacheIndex = this._keys.indexOf(this._cacheKey = key); + } + if (this._cacheIndex < 0 && insert) { + this._cacheIndex = this._keys.length; + this._keys.push(key); + this._values.push(undefined); + } + return this._cacheIndex; + }; + return Map; + }()); + function getKey(key, _) { + return key; + } + function getValue(_, value) { + return value; + } + function getEntry(key, value) { + return [key, value]; + } + } + // naive Set shim + function CreateSetPolyfill() { + return (function () { + function Set() { + this._map = new _Map(); + } + Object.defineProperty(Set.prototype, "size", { + get: function () { return this._map.size; }, + enumerable: true, + configurable: true + }); + Set.prototype.has = function (value) { return this._map.has(value); }; + Set.prototype.add = function (value) { return this._map.set(value, value), this; }; + Set.prototype.delete = function (value) { return this._map.delete(value); }; + Set.prototype.clear = function () { this._map.clear(); }; + Set.prototype.keys = function () { return this._map.keys(); }; + Set.prototype.values = function () { return this._map.values(); }; + Set.prototype.entries = function () { return this._map.entries(); }; + Set.prototype["@@iterator"] = function () { return this.keys(); }; + Set.prototype[iteratorSymbol] = function () { return this.keys(); }; + return Set; + }()); + } + // naive WeakMap shim + function CreateWeakMapPolyfill() { + var UUID_SIZE = 16; + var keys = HashMap.create(); + var rootKey = CreateUniqueKey(); + return (function () { + function WeakMap() { + this._key = CreateUniqueKey(); + } + WeakMap.prototype.has = function (target) { + var table = GetOrCreateWeakMapTable(target, /*create*/ false); + return table !== undefined ? HashMap.has(table, this._key) : false; + }; + WeakMap.prototype.get = function (target) { + var table = GetOrCreateWeakMapTable(target, /*create*/ false); + return table !== undefined ? HashMap.get(table, this._key) : undefined; + }; + WeakMap.prototype.set = function (target, value) { + var table = GetOrCreateWeakMapTable(target, /*create*/ true); + table[this._key] = value; + return this; + }; + WeakMap.prototype.delete = function (target) { + var table = GetOrCreateWeakMapTable(target, /*create*/ false); + return table !== undefined ? delete table[this._key] : false; + }; + WeakMap.prototype.clear = function () { + // NOTE: not a real clear, just makes the previous data unreachable + this._key = CreateUniqueKey(); + }; + return WeakMap; + }()); + function CreateUniqueKey() { + var key; + do + key = "@@WeakMap@@" + CreateUUID(); + while (HashMap.has(keys, key)); + keys[key] = true; + return key; + } + function GetOrCreateWeakMapTable(target, create) { + if (!hasOwn.call(target, rootKey)) { + if (!create) + return undefined; + Object.defineProperty(target, rootKey, { value: HashMap.create() }); + } + return target[rootKey]; + } + function FillRandomBytes(buffer, size) { + for (var i = 0; i < size; ++i) + buffer[i] = Math.random() * 0xff | 0; + return buffer; + } + function GenRandomBytes(size) { + if (typeof Uint8Array === "function") { + if (typeof crypto !== "undefined") + return crypto.getRandomValues(new Uint8Array(size)); + if (typeof msCrypto !== "undefined") + return msCrypto.getRandomValues(new Uint8Array(size)); + return FillRandomBytes(new Uint8Array(size), size); + } + return FillRandomBytes(new Array(size), size); + } + function CreateUUID() { + var data = GenRandomBytes(UUID_SIZE); + // mark as random - RFC 4122 § 4.4 + data[6] = data[6] & 0x4f | 0x40; + data[8] = data[8] & 0xbf | 0x80; + var result = ""; + for (var offset = 0; offset < UUID_SIZE; ++offset) { + var byte = data[offset]; + if (offset === 4 || offset === 6 || offset === 8) + result += "-"; + if (byte < 16) + result += "0"; + result += byte.toString(16).toLowerCase(); + } + return result; + } + } + // uses a heuristic used by v8 and chakra to force an object into dictionary mode. + function MakeDictionary(obj) { + obj.__ = undefined; + delete obj.__; + return obj; + } + // patch global Reflect + (function (__global) { + if (typeof __global.Reflect !== "undefined") { + if (__global.Reflect !== Reflect) { + for (var p in Reflect) { + if (hasOwn.call(Reflect, p)) { + __global.Reflect[p] = Reflect[p]; + } + } + } + } + else { + __global.Reflect = Reflect; + } + })(typeof global !== "undefined" ? global : + typeof self !== "undefined" ? self : + Function("return this;")()); +})(Reflect || (Reflect = {})); +//# sourceMappingURL=Reflect.js.map /***/ }), -/* 198 */ +/* 60 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -var Observable_1 = __webpack_require__(0); -var partition_1 = __webpack_require__(316); -Observable_1.Observable.prototype.partition = partition_1.partition; -//# sourceMappingURL=partition.js.map +var Observable_1 = __webpack_require__(2); +var first_1 = __webpack_require__(55); +Observable_1.Observable.prototype.first = first_1.first; +//# sourceMappingURL=first.js.map /***/ }), -/* 199 */ +/* 61 */ /***/ (function(module, exports, __webpack_require__) { -"use strict"; - -var Observable_1 = __webpack_require__(0); -var pluck_1 = __webpack_require__(317); -Observable_1.Observable.prototype.pluck = pluck_1.pluck; -//# sourceMappingURL=pluck.js.map +module.exports = (__webpack_require__(0))(48); /***/ }), -/* 200 */ +/* 62 */ /***/ (function(module, exports, __webpack_require__) { -"use strict"; - -var Observable_1 = __webpack_require__(0); -var publish_1 = __webpack_require__(318); -Observable_1.Observable.prototype.publish = publish_1.publish; -//# sourceMappingURL=publish.js.map +module.exports = (__webpack_require__(0))(54); /***/ }), -/* 201 */ +/* 63 */ /***/ (function(module, exports, __webpack_require__) { -"use strict"; - -var Observable_1 = __webpack_require__(0); -var publishBehavior_1 = __webpack_require__(319); -Observable_1.Observable.prototype.publishBehavior = publishBehavior_1.publishBehavior; -//# sourceMappingURL=publishBehavior.js.map +/** + * @license Angular v5.0.1 + * (c) 2010-2017 Google, Inc. https://angular.io/ + * License: MIT + */ +(function (global, factory) { + true ? factory(exports, __webpack_require__(4), __webpack_require__(53), __webpack_require__(51), __webpack_require__(26)) : + typeof define === 'function' && define.amd ? define('@angular/platform-browser/animations', ['exports', '@angular/core', '@angular/platform-browser', '@angular/animations', '@angular/animations/browser'], factory) : + (factory((global.ng = global.ng || {}, global.ng.platformBrowser = global.ng.platformBrowser || {}, global.ng.platformBrowser.animations = {}),global.ng.core,global.ng.platformBrowser,global.ng.animations,global.ng.animations.browser)); +}(this, (function (exports,_angular_core,_angular_platformBrowser,_angular_animations,_angular_animations_browser) { 'use strict'; -/***/ }), -/* 202 */ -/***/ (function(module, exports, __webpack_require__) { +/*! ***************************************************************************** +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 __()); +} -"use strict"; +/** + * @license Angular v5.0.1 + * (c) 2010-2017 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 + */ +var BrowserAnimationBuilder = (function (_super) { + __extends(BrowserAnimationBuilder, _super); + function BrowserAnimationBuilder(rootRenderer, doc) { + var _this = _super.call(this) || this; + _this._nextAnimationId = 0; + var /** @type {?} */ typeData = /** @type {?} */ ({ + id: '0', + encapsulation: _angular_core.ViewEncapsulation.None, + styles: [], + data: { animation: [] } + }); + _this._renderer = /** @type {?} */ (rootRenderer.createRenderer(doc.body, typeData)); + return _this; + } + /** + * @param {?} animation + * @return {?} + */ + BrowserAnimationBuilder.prototype.build = /** + * @param {?} animation + * @return {?} + */ + function (animation) { + var /** @type {?} */ id = this._nextAnimationId.toString(); + this._nextAnimationId++; + var /** @type {?} */ entry = Array.isArray(animation) ? _angular_animations.sequence(animation) : animation; + issueAnimationCommand(this._renderer, null, id, 'register', [entry]); + return new BrowserAnimationFactory(id, this._renderer); + }; + BrowserAnimationBuilder.decorators = [ + { type: _angular_core.Injectable }, + ]; + /** @nocollapse */ + BrowserAnimationBuilder.ctorParameters = function () { return [ + { type: _angular_core.RendererFactory2, }, + { type: undefined, decorators: [{ type: _angular_core.Inject, args: [_angular_platformBrowser.DOCUMENT,] },] }, + ]; }; + return BrowserAnimationBuilder; +}(_angular_animations.AnimationBuilder)); +var BrowserAnimationFactory = (function (_super) { + __extends(BrowserAnimationFactory, _super); + function BrowserAnimationFactory(_id, _renderer) { + var _this = _super.call(this) || this; + _this._id = _id; + _this._renderer = _renderer; + return _this; + } + /** + * @param {?} element + * @param {?=} options + * @return {?} + */ + BrowserAnimationFactory.prototype.create = /** + * @param {?} element + * @param {?=} options + * @return {?} + */ + function (element, options) { + return new RendererAnimationPlayer(this._id, element, options || {}, this._renderer); + }; + return BrowserAnimationFactory; +}(_angular_animations.AnimationFactory)); +var RendererAnimationPlayer = (function () { + function RendererAnimationPlayer(id, element, options, _renderer) { + this.id = id; + this.element = element; + this._renderer = _renderer; + this.parentPlayer = null; + this._started = false; + this.totalTime = 0; + this._command('create', options); + } + /** + * @param {?} eventName + * @param {?} callback + * @return {?} + */ + RendererAnimationPlayer.prototype._listen = /** + * @param {?} eventName + * @param {?} callback + * @return {?} + */ + function (eventName, callback) { + return this._renderer.listen(this.element, "@@" + this.id + ":" + eventName, callback); + }; + /** + * @param {?} command + * @param {...?} args + * @return {?} + */ + RendererAnimationPlayer.prototype._command = /** + * @param {?} command + * @param {...?} args + * @return {?} + */ + function (command) { + var args = []; + for (var _i = 1; _i < arguments.length; _i++) { + args[_i - 1] = arguments[_i]; + } + return issueAnimationCommand(this._renderer, this.element, this.id, command, args); + }; + /** + * @param {?} fn + * @return {?} + */ + RendererAnimationPlayer.prototype.onDone = /** + * @param {?} fn + * @return {?} + */ + function (fn) { this._listen('done', fn); }; + /** + * @param {?} fn + * @return {?} + */ + RendererAnimationPlayer.prototype.onStart = /** + * @param {?} fn + * @return {?} + */ + function (fn) { this._listen('start', fn); }; + /** + * @param {?} fn + * @return {?} + */ + RendererAnimationPlayer.prototype.onDestroy = /** + * @param {?} fn + * @return {?} + */ + function (fn) { this._listen('destroy', fn); }; + /** + * @return {?} + */ + RendererAnimationPlayer.prototype.init = /** + * @return {?} + */ + function () { this._command('init'); }; + /** + * @return {?} + */ + RendererAnimationPlayer.prototype.hasStarted = /** + * @return {?} + */ + function () { return this._started; }; + /** + * @return {?} + */ + RendererAnimationPlayer.prototype.play = /** + * @return {?} + */ + function () { + this._command('play'); + this._started = true; + }; + /** + * @return {?} + */ + RendererAnimationPlayer.prototype.pause = /** + * @return {?} + */ + function () { this._command('pause'); }; + /** + * @return {?} + */ + RendererAnimationPlayer.prototype.restart = /** + * @return {?} + */ + function () { this._command('restart'); }; + /** + * @return {?} + */ + RendererAnimationPlayer.prototype.finish = /** + * @return {?} + */ + function () { this._command('finish'); }; + /** + * @return {?} + */ + RendererAnimationPlayer.prototype.destroy = /** + * @return {?} + */ + function () { this._command('destroy'); }; + /** + * @return {?} + */ + RendererAnimationPlayer.prototype.reset = /** + * @return {?} + */ + function () { this._command('reset'); }; + /** + * @param {?} p + * @return {?} + */ + RendererAnimationPlayer.prototype.setPosition = /** + * @param {?} p + * @return {?} + */ + function (p) { this._command('setPosition', p); }; + /** + * @return {?} + */ + RendererAnimationPlayer.prototype.getPosition = /** + * @return {?} + */ + function () { return 0; }; + return RendererAnimationPlayer; +}()); +/** + * @param {?} renderer + * @param {?} element + * @param {?} id + * @param {?} command + * @param {?} args + * @return {?} + */ +function issueAnimationCommand(renderer, element, id, command, args) { + return renderer.setProperty(element, "@@" + id + ":" + command, args); +} -var Observable_1 = __webpack_require__(0); -var publishLast_1 = __webpack_require__(320); -Observable_1.Observable.prototype.publishLast = publishLast_1.publishLast; -//# sourceMappingURL=publishLast.js.map +/** + * @fileoverview added by tsickle + * @suppress {checkTypes} checked by tsc + */ +var ANIMATION_PREFIX = '@'; +var DISABLE_ANIMATIONS_FLAG = '@.disabled'; +var AnimationRendererFactory = (function () { + function AnimationRendererFactory(delegate, engine, _zone) { + this.delegate = delegate; + this.engine = engine; + this._zone = _zone; + this._currentId = 0; + this._microtaskId = 1; + this._animationCallbacksBuffer = []; + this._rendererCache = new Map(); + this._cdRecurDepth = 0; + engine.onRemovalComplete = function (element, delegate) { + // Note: if an component element has a leave animation, and the component + // a host leave animation, the view engine will call `removeChild` for the parent + // component renderer as well as for the child component renderer. + // Therefore, we need to check if we already removed the element. + if (delegate && delegate.parentNode(element)) { + delegate.removeChild(element.parentNode, element); + } + }; + } + /** + * @param {?} hostElement + * @param {?} type + * @return {?} + */ + AnimationRendererFactory.prototype.createRenderer = /** + * @param {?} hostElement + * @param {?} type + * @return {?} + */ + function (hostElement, type) { + var _this = this; + var /** @type {?} */ EMPTY_NAMESPACE_ID = ''; + // cache the delegates to find out which cached delegate can + // be used by which cached renderer + var /** @type {?} */ delegate = this.delegate.createRenderer(hostElement, type); + if (!hostElement || !type || !type.data || !type.data['animation']) { + var /** @type {?} */ renderer = this._rendererCache.get(delegate); + if (!renderer) { + renderer = new BaseAnimationRenderer(EMPTY_NAMESPACE_ID, delegate, this.engine); + // only cache this result when the base renderer is used + this._rendererCache.set(delegate, renderer); + } + return renderer; + } + var /** @type {?} */ componentId = type.id; + var /** @type {?} */ namespaceId = type.id + '-' + this._currentId; + this._currentId++; + this.engine.register(namespaceId, hostElement); + var /** @type {?} */ animationTriggers = /** @type {?} */ (type.data['animation']); + animationTriggers.forEach(function (trigger) { + return _this.engine.registerTrigger(componentId, namespaceId, hostElement, trigger.name, trigger); + }); + return new AnimationRenderer(this, namespaceId, delegate, this.engine); + }; + /** + * @return {?} + */ + AnimationRendererFactory.prototype.begin = /** + * @return {?} + */ + function () { + this._cdRecurDepth++; + if (this.delegate.begin) { + this.delegate.begin(); + } + }; + /** + * @return {?} + */ + AnimationRendererFactory.prototype._scheduleCountTask = /** + * @return {?} + */ + function () { + var _this = this; + Zone.current.scheduleMicroTask('incremenet the animation microtask', function () { return _this._microtaskId++; }); + }; + /* @internal */ + /** + * @param {?} count + * @param {?} fn + * @param {?} data + * @return {?} + */ + AnimationRendererFactory.prototype.scheduleListenerCallback = /** + * @param {?} count + * @param {?} fn + * @param {?} data + * @return {?} + */ + function (count, fn, data) { + var _this = this; + if (count >= 0 && count < this._microtaskId) { + this._zone.run(function () { return fn(data); }); + return; + } + if (this._animationCallbacksBuffer.length == 0) { + Promise.resolve(null).then(function () { + _this._zone.run(function () { + _this._animationCallbacksBuffer.forEach(function (tuple) { + var fn = tuple[0], data = tuple[1]; + fn(data); + }); + _this._animationCallbacksBuffer = []; + }); + }); + } + this._animationCallbacksBuffer.push([fn, data]); + }; + /** + * @return {?} + */ + AnimationRendererFactory.prototype.end = /** + * @return {?} + */ + function () { + var _this = this; + this._cdRecurDepth--; + // this is to prevent animations from running twice when an inner + // component does CD when a parent component insted has inserted it + if (this._cdRecurDepth == 0) { + this._zone.runOutsideAngular(function () { + _this._scheduleCountTask(); + _this.engine.flush(_this._microtaskId); + }); + } + if (this.delegate.end) { + this.delegate.end(); + } + }; + /** + * @return {?} + */ + AnimationRendererFactory.prototype.whenRenderingDone = /** + * @return {?} + */ + function () { return this.engine.whenRenderingDone(); }; + AnimationRendererFactory.decorators = [ + { type: _angular_core.Injectable }, + ]; + /** @nocollapse */ + AnimationRendererFactory.ctorParameters = function () { return [ + { type: _angular_core.RendererFactory2, }, + { type: _angular_animations_browser.ɵAnimationEngine, }, + { type: _angular_core.NgZone, }, + ]; }; + return AnimationRendererFactory; +}()); +var BaseAnimationRenderer = (function () { + function BaseAnimationRenderer(namespaceId, delegate, engine) { + this.namespaceId = namespaceId; + this.delegate = delegate; + this.engine = engine; + this.destroyNode = this.delegate.destroyNode ? function (n) { return /** @type {?} */ ((delegate.destroyNode))(n); } : null; + } + Object.defineProperty(BaseAnimationRenderer.prototype, "data", { + get: /** + * @return {?} + */ + function () { return this.delegate.data; }, + enumerable: true, + configurable: true + }); + /** + * @return {?} + */ + BaseAnimationRenderer.prototype.destroy = /** + * @return {?} + */ + function () { + this.engine.destroy(this.namespaceId, this.delegate); + this.delegate.destroy(); + }; + /** + * @param {?} name + * @param {?=} namespace + * @return {?} + */ + BaseAnimationRenderer.prototype.createElement = /** + * @param {?} name + * @param {?=} namespace + * @return {?} + */ + function (name, namespace) { + return this.delegate.createElement(name, namespace); + }; + /** + * @param {?} value + * @return {?} + */ + BaseAnimationRenderer.prototype.createComment = /** + * @param {?} value + * @return {?} + */ + function (value) { return this.delegate.createComment(value); }; + /** + * @param {?} value + * @return {?} + */ + BaseAnimationRenderer.prototype.createText = /** + * @param {?} value + * @return {?} + */ + function (value) { return this.delegate.createText(value); }; + /** + * @param {?} parent + * @param {?} newChild + * @return {?} + */ + BaseAnimationRenderer.prototype.appendChild = /** + * @param {?} parent + * @param {?} newChild + * @return {?} + */ + function (parent, newChild) { + this.delegate.appendChild(parent, newChild); + this.engine.onInsert(this.namespaceId, newChild, parent, false); + }; + /** + * @param {?} parent + * @param {?} newChild + * @param {?} refChild + * @return {?} + */ + BaseAnimationRenderer.prototype.insertBefore = /** + * @param {?} parent + * @param {?} newChild + * @param {?} refChild + * @return {?} + */ + function (parent, newChild, refChild) { + this.delegate.insertBefore(parent, newChild, refChild); + this.engine.onInsert(this.namespaceId, newChild, parent, true); + }; + /** + * @param {?} parent + * @param {?} oldChild + * @return {?} + */ + BaseAnimationRenderer.prototype.removeChild = /** + * @param {?} parent + * @param {?} oldChild + * @return {?} + */ + function (parent, oldChild) { + this.engine.onRemove(this.namespaceId, oldChild, this.delegate); + }; + /** + * @param {?} selectorOrNode + * @return {?} + */ + BaseAnimationRenderer.prototype.selectRootElement = /** + * @param {?} selectorOrNode + * @return {?} + */ + function (selectorOrNode) { return this.delegate.selectRootElement(selectorOrNode); }; + /** + * @param {?} node + * @return {?} + */ + BaseAnimationRenderer.prototype.parentNode = /** + * @param {?} node + * @return {?} + */ + function (node) { return this.delegate.parentNode(node); }; + /** + * @param {?} node + * @return {?} + */ + BaseAnimationRenderer.prototype.nextSibling = /** + * @param {?} node + * @return {?} + */ + function (node) { return this.delegate.nextSibling(node); }; + /** + * @param {?} el + * @param {?} name + * @param {?} value + * @param {?=} namespace + * @return {?} + */ + BaseAnimationRenderer.prototype.setAttribute = /** + * @param {?} el + * @param {?} name + * @param {?} value + * @param {?=} namespace + * @return {?} + */ + function (el, name, value, namespace) { + this.delegate.setAttribute(el, name, value, namespace); + }; + /** + * @param {?} el + * @param {?} name + * @param {?=} namespace + * @return {?} + */ + BaseAnimationRenderer.prototype.removeAttribute = /** + * @param {?} el + * @param {?} name + * @param {?=} namespace + * @return {?} + */ + function (el, name, namespace) { + this.delegate.removeAttribute(el, name, namespace); + }; + /** + * @param {?} el + * @param {?} name + * @return {?} + */ + BaseAnimationRenderer.prototype.addClass = /** + * @param {?} el + * @param {?} name + * @return {?} + */ + function (el, name) { this.delegate.addClass(el, name); }; + /** + * @param {?} el + * @param {?} name + * @return {?} + */ + BaseAnimationRenderer.prototype.removeClass = /** + * @param {?} el + * @param {?} name + * @return {?} + */ + function (el, name) { this.delegate.removeClass(el, name); }; + /** + * @param {?} el + * @param {?} style + * @param {?} value + * @param {?=} flags + * @return {?} + */ + BaseAnimationRenderer.prototype.setStyle = /** + * @param {?} el + * @param {?} style + * @param {?} value + * @param {?=} flags + * @return {?} + */ + function (el, style, value, flags) { + this.delegate.setStyle(el, style, value, flags); + }; + /** + * @param {?} el + * @param {?} style + * @param {?=} flags + * @return {?} + */ + BaseAnimationRenderer.prototype.removeStyle = /** + * @param {?} el + * @param {?} style + * @param {?=} flags + * @return {?} + */ + function (el, style, flags) { + this.delegate.removeStyle(el, style, flags); + }; + /** + * @param {?} el + * @param {?} name + * @param {?} value + * @return {?} + */ + BaseAnimationRenderer.prototype.setProperty = /** + * @param {?} el + * @param {?} name + * @param {?} value + * @return {?} + */ + function (el, name, value) { + if (name.charAt(0) == ANIMATION_PREFIX && name == DISABLE_ANIMATIONS_FLAG) { + this.disableAnimations(el, !!value); + } + else { + this.delegate.setProperty(el, name, value); + } + }; + /** + * @param {?} node + * @param {?} value + * @return {?} + */ + BaseAnimationRenderer.prototype.setValue = /** + * @param {?} node + * @param {?} value + * @return {?} + */ + function (node, value) { this.delegate.setValue(node, value); }; + /** + * @param {?} target + * @param {?} eventName + * @param {?} callback + * @return {?} + */ + BaseAnimationRenderer.prototype.listen = /** + * @param {?} target + * @param {?} eventName + * @param {?} callback + * @return {?} + */ + function (target, eventName, callback) { + return this.delegate.listen(target, eventName, callback); + }; + /** + * @param {?} element + * @param {?} value + * @return {?} + */ + BaseAnimationRenderer.prototype.disableAnimations = /** + * @param {?} element + * @param {?} value + * @return {?} + */ + function (element, value) { + this.engine.disableAnimations(element, value); + }; + return BaseAnimationRenderer; +}()); +var AnimationRenderer = (function (_super) { + __extends(AnimationRenderer, _super); + function AnimationRenderer(factory, namespaceId, delegate, engine) { + var _this = _super.call(this, namespaceId, delegate, engine) || this; + _this.factory = factory; + _this.namespaceId = namespaceId; + return _this; + } + /** + * @param {?} el + * @param {?} name + * @param {?} value + * @return {?} + */ + AnimationRenderer.prototype.setProperty = /** + * @param {?} el + * @param {?} name + * @param {?} value + * @return {?} + */ + function (el, name, value) { + if (name.charAt(0) == ANIMATION_PREFIX) { + if (name.charAt(1) == '.' && name == DISABLE_ANIMATIONS_FLAG) { + value = value === undefined ? true : !!value; + this.disableAnimations(el, /** @type {?} */ (value)); + } + else { + this.engine.process(this.namespaceId, el, name.substr(1), value); + } + } + else { + this.delegate.setProperty(el, name, value); + } + }; + /** + * @param {?} target + * @param {?} eventName + * @param {?} callback + * @return {?} + */ + AnimationRenderer.prototype.listen = /** + * @param {?} target + * @param {?} eventName + * @param {?} callback + * @return {?} + */ + function (target, eventName, callback) { + var _this = this; + if (eventName.charAt(0) == ANIMATION_PREFIX) { + var /** @type {?} */ element = resolveElementFromTarget(target); + var /** @type {?} */ name_1 = eventName.substr(1); + var /** @type {?} */ phase = ''; + // @listener.phase is for trigger animation callbacks + // @@listener is for animation builder callbacks + if (name_1.charAt(0) != ANIMATION_PREFIX) { + _a = parseTriggerCallbackName(name_1), name_1 = _a[0], phase = _a[1]; + } + return this.engine.listen(this.namespaceId, element, name_1, phase, function (event) { + var /** @type {?} */ countId = (/** @type {?} */ (event))['_data'] || -1; + _this.factory.scheduleListenerCallback(countId, callback, event); + }); + } + return this.delegate.listen(target, eventName, callback); + var _a; + }; + return AnimationRenderer; +}(BaseAnimationRenderer)); +/** + * @param {?} target + * @return {?} + */ +function resolveElementFromTarget(target) { + switch (target) { + case 'body': + return document.body; + case 'document': + return document; + case 'window': + return window; + default: + return target; + } +} +/** + * @param {?} triggerName + * @return {?} + */ +function parseTriggerCallbackName(triggerName) { + var /** @type {?} */ dotIndex = triggerName.indexOf('.'); + var /** @type {?} */ trigger = triggerName.substring(0, dotIndex); + var /** @type {?} */ phase = triggerName.substr(dotIndex + 1); + return [trigger, phase]; +} -/***/ }), -/* 203 */ -/***/ (function(module, exports, __webpack_require__) { +/** + * @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 InjectableAnimationEngine = (function (_super) { + __extends(InjectableAnimationEngine, _super); + function InjectableAnimationEngine(driver, normalizer) { + return _super.call(this, driver, normalizer) || this; + } + InjectableAnimationEngine.decorators = [ + { type: _angular_core.Injectable }, + ]; + /** @nocollapse */ + InjectableAnimationEngine.ctorParameters = function () { return [ + { type: _angular_animations_browser.AnimationDriver, }, + { type: _angular_animations_browser.ɵAnimationStyleNormalizer, }, + ]; }; + return InjectableAnimationEngine; +}(_angular_animations_browser.ɵAnimationEngine)); +/** + * @return {?} + */ +function instantiateSupportedAnimationDriver() { + if (_angular_animations_browser.ɵsupportsWebAnimations()) { + return new _angular_animations_browser.ɵWebAnimationsDriver(); + } + return new _angular_animations_browser.ɵNoopAnimationDriver(); +} +/** + * @return {?} + */ +function instantiateDefaultStyleNormalizer() { + return new _angular_animations_browser.ɵWebAnimationsStyleNormalizer(); +} +/** + * @param {?} renderer + * @param {?} engine + * @param {?} zone + * @return {?} + */ +function instantiateRendererFactory(renderer, engine, zone) { + return new AnimationRendererFactory(renderer, engine, zone); +} +var SHARED_ANIMATION_PROVIDERS = [ + { provide: _angular_animations.AnimationBuilder, useClass: BrowserAnimationBuilder }, + { provide: _angular_animations_browser.ɵAnimationStyleNormalizer, useFactory: instantiateDefaultStyleNormalizer }, + { provide: _angular_animations_browser.ɵAnimationEngine, useClass: InjectableAnimationEngine }, { + provide: _angular_core.RendererFactory2, + useFactory: instantiateRendererFactory, + deps: [_angular_platformBrowser.ɵDomRendererFactory2, _angular_animations_browser.ɵAnimationEngine, _angular_core.NgZone] + } +]; +/** + * Separate providers from the actual module so that we can do a local modification in Google3 to + * include them in the BrowserModule. + */ +var BROWSER_ANIMATIONS_PROVIDERS = [ + { provide: _angular_animations_browser.AnimationDriver, useFactory: instantiateSupportedAnimationDriver } +].concat(SHARED_ANIMATION_PROVIDERS); +/** + * Separate providers from the actual module so that we can do a local modification in Google3 to + * include them in the BrowserTestingModule. + */ +var BROWSER_NOOP_ANIMATIONS_PROVIDERS = [{ provide: _angular_animations_browser.AnimationDriver, useClass: _angular_animations_browser.ɵNoopAnimationDriver }].concat(SHARED_ANIMATION_PROVIDERS); -"use strict"; +/** + * @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 + */ +/** + * \@experimental Animation support is experimental. + */ +var BrowserAnimationsModule = (function () { + function BrowserAnimationsModule() { + } + BrowserAnimationsModule.decorators = [ + { type: _angular_core.NgModule, args: [{ + exports: [_angular_platformBrowser.BrowserModule], + providers: BROWSER_ANIMATIONS_PROVIDERS, + },] }, + ]; + /** @nocollapse */ + BrowserAnimationsModule.ctorParameters = function () { return []; }; + return BrowserAnimationsModule; +}()); +/** + * \@experimental Animation support is experimental. + */ +var NoopAnimationsModule = (function () { + function NoopAnimationsModule() { + } + NoopAnimationsModule.decorators = [ + { type: _angular_core.NgModule, args: [{ + exports: [_angular_platformBrowser.BrowserModule], + providers: BROWSER_NOOP_ANIMATIONS_PROVIDERS, + },] }, + ]; + /** @nocollapse */ + NoopAnimationsModule.ctorParameters = function () { return []; }; + return NoopAnimationsModule; +}()); -var Observable_1 = __webpack_require__(0); -var publishReplay_1 = __webpack_require__(321); -Observable_1.Observable.prototype.publishReplay = publishReplay_1.publishReplay; -//# sourceMappingURL=publishReplay.js.map +exports.BrowserAnimationsModule = BrowserAnimationsModule; +exports.NoopAnimationsModule = NoopAnimationsModule; +exports.ɵBrowserAnimationBuilder = BrowserAnimationBuilder; +exports.ɵBrowserAnimationFactory = BrowserAnimationFactory; +exports.ɵAnimationRenderer = AnimationRenderer; +exports.ɵAnimationRendererFactory = AnimationRendererFactory; +exports.ɵa = BaseAnimationRenderer; +exports.ɵf = BROWSER_ANIMATIONS_PROVIDERS; +exports.ɵg = BROWSER_NOOP_ANIMATIONS_PROVIDERS; +exports.ɵb = InjectableAnimationEngine; +exports.ɵd = instantiateDefaultStyleNormalizer; +exports.ɵe = instantiateRendererFactory; +exports.ɵc = instantiateSupportedAnimationDriver; -/***/ }), -/* 204 */ -/***/ (function(module, exports, __webpack_require__) { +Object.defineProperty(exports, '__esModule', { value: true }); -"use strict"; +}))); +//# sourceMappingURL=platform-browser-animations.umd.js.map -var Observable_1 = __webpack_require__(0); -var race_1 = __webpack_require__(64); -Observable_1.Observable.prototype.race = race_1.race; -//# sourceMappingURL=race.js.map /***/ }), -/* 205 */ -/***/ (function(module, exports, __webpack_require__) { +/* 64 */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return AppModuleShared; }); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__(4); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0__angular_core__); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__angular_common__ = __webpack_require__(5); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__angular_common___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1__angular_common__); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__angular_forms__ = __webpack_require__(129); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__angular_forms___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2__angular_forms__); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__angular_common_http__ = __webpack_require__(13); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__angular_common_http___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_3__angular_common_http__); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__angular_router__ = __webpack_require__(52); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__angular_router___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_4__angular_router__); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__components_app_app_component__ = __webpack_require__(28); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__components_navmenu_navmenu_component__ = __webpack_require__(68); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__components_home_home_component__ = __webpack_require__(67); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__components_fetchdata_fetchdata_component__ = __webpack_require__(66); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_9__components_counter_counter_component__ = __webpack_require__(65); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_10__components_unauthorized_unauthorized_component__ = __webpack_require__(69); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_11_angular_auth_oidc_client__ = __webpack_require__(27); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_11_angular_auth_oidc_client___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_11_angular_auth_oidc_client__); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_12__components_services_auth_service__ = __webpack_require__(14); +var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { + var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); + else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; + return c > 3 && r && Object.defineProperty(target, key, r), r; +}; + + + + + + + + + + + + + +var AppModuleShared = (function () { + function AppModuleShared() { + } + AppModuleShared = __decorate([ + __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_0__angular_core__["NgModule"])({ + declarations: [ + __WEBPACK_IMPORTED_MODULE_5__components_app_app_component__["a" /* AppComponent */], + __WEBPACK_IMPORTED_MODULE_6__components_navmenu_navmenu_component__["a" /* NavMenuComponent */], + __WEBPACK_IMPORTED_MODULE_9__components_counter_counter_component__["a" /* CounterComponent */], + __WEBPACK_IMPORTED_MODULE_8__components_fetchdata_fetchdata_component__["a" /* FetchDataComponent */], + __WEBPACK_IMPORTED_MODULE_7__components_home_home_component__["a" /* HomeComponent */], + __WEBPACK_IMPORTED_MODULE_10__components_unauthorized_unauthorized_component__["a" /* UnauthorizedComponent */] + ], + imports: [ + __WEBPACK_IMPORTED_MODULE_11_angular_auth_oidc_client__["AuthModule"].forRoot(), + __WEBPACK_IMPORTED_MODULE_1__angular_common__["CommonModule"], + __WEBPACK_IMPORTED_MODULE_3__angular_common_http__["HttpClientModule"], + __WEBPACK_IMPORTED_MODULE_2__angular_forms__["FormsModule"], + __WEBPACK_IMPORTED_MODULE_4__angular_router__["RouterModule"].forRoot([ + { path: '', redirectTo: 'home', pathMatch: 'full' }, + { path: 'home', component: __WEBPACK_IMPORTED_MODULE_7__components_home_home_component__["a" /* HomeComponent */] }, + { path: 'unauthorized', component: __WEBPACK_IMPORTED_MODULE_10__components_unauthorized_unauthorized_component__["a" /* UnauthorizedComponent */] }, + { path: 'counter', component: __WEBPACK_IMPORTED_MODULE_9__components_counter_counter_component__["a" /* CounterComponent */] }, + { path: 'fetch-data', component: __WEBPACK_IMPORTED_MODULE_8__components_fetchdata_fetchdata_component__["a" /* FetchDataComponent */] }, + { path: '**', redirectTo: 'home' } + ]) + ], + providers: [ + __WEBPACK_IMPORTED_MODULE_12__components_services_auth_service__["a" /* AuthService */], + __WEBPACK_IMPORTED_MODULE_11_angular_auth_oidc_client__["OidcSecurityService"] + ] + }) + ], AppModuleShared); + return AppModuleShared; +}()); + -var Observable_1 = __webpack_require__(0); -var reduce_1 = __webpack_require__(43); -Observable_1.Observable.prototype.reduce = reduce_1.reduce; -//# sourceMappingURL=reduce.js.map /***/ }), -/* 206 */ -/***/ (function(module, exports, __webpack_require__) { +/* 65 */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return CounterComponent; }); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__(4); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0__angular_core__); +var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { + var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); + else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; + return c > 3 && r && Object.defineProperty(target, key, r), r; +}; + +var CounterComponent = (function () { + function CounterComponent() { + this.currentCount = 0; + } + CounterComponent.prototype.incrementCounter = function () { + this.currentCount++; + }; + CounterComponent = __decorate([ + __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Component"])({ + selector: 'counter', + template: __webpack_require__(84) + }) + ], CounterComponent); + return CounterComponent; +}()); + -var Observable_1 = __webpack_require__(0); -var repeat_1 = __webpack_require__(322); -Observable_1.Observable.prototype.repeat = repeat_1.repeat; -//# sourceMappingURL=repeat.js.map /***/ }), -/* 207 */ -/***/ (function(module, exports, __webpack_require__) { +/* 66 */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return FetchDataComponent; }); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__(4); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0__angular_core__); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__services_auth_service__ = __webpack_require__(14); +var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { + var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); + else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; + return c > 3 && r && Object.defineProperty(target, key, r), r; +}; +var __metadata = (this && this.__metadata) || function (k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); +}; +var __param = (this && this.__param) || function (paramIndex, decorator) { + return function (target, key) { decorator(target, key, paramIndex); } +}; + + +var FetchDataComponent = (function () { + function FetchDataComponent(authService, apiUrl) { + var _this = this; + authService.get(apiUrl + 'SampleData/WeatherForecasts').subscribe(function (result) { + _this.forecasts = result; + }, function (error) { return console.error(error); }); + } + FetchDataComponent = __decorate([ + __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Component"])({ + selector: 'fetchdata', + template: __webpack_require__(85) + }), + __param(1, __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Inject"])('API_URL')), + __metadata("design:paramtypes", [__WEBPACK_IMPORTED_MODULE_1__services_auth_service__["a" /* AuthService */], String]) + ], FetchDataComponent); + return FetchDataComponent; +}()); + -var Observable_1 = __webpack_require__(0); -var repeatWhen_1 = __webpack_require__(323); -Observable_1.Observable.prototype.repeatWhen = repeatWhen_1.repeatWhen; -//# sourceMappingURL=repeatWhen.js.map /***/ }), -/* 208 */ -/***/ (function(module, exports, __webpack_require__) { +/* 67 */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return HomeComponent; }); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__(4); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0__angular_core__); +var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { + var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); + else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; + return c > 3 && r && Object.defineProperty(target, key, r), r; +}; + +var HomeComponent = (function () { + function HomeComponent() { + } + HomeComponent = __decorate([ + __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Component"])({ + selector: 'home', + template: __webpack_require__(86) + }) + ], HomeComponent); + return HomeComponent; +}()); + -var Observable_1 = __webpack_require__(0); -var retry_1 = __webpack_require__(324); -Observable_1.Observable.prototype.retry = retry_1.retry; -//# sourceMappingURL=retry.js.map /***/ }), -/* 209 */ -/***/ (function(module, exports, __webpack_require__) { +/* 68 */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return NavMenuComponent; }); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__(4); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0__angular_core__); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__services_auth_service__ = __webpack_require__(14); +var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { + var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); + else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; + return c > 3 && r && Object.defineProperty(target, key, r), r; +}; +var __metadata = (this && this.__metadata) || function (k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); +}; + + +var NavMenuComponent = (function () { + function NavMenuComponent(authService) { + this.authService = authService; + } + NavMenuComponent.prototype.ngOnInit = function () { + var _this = this; + this.isAuthorizedSubscription = this.authService.getIsAuthorized().subscribe(function (isAuthorized) { + _this.isAuthorized = isAuthorized; + }); + }; + NavMenuComponent.prototype.ngOnDestroy = function () { + this.isAuthorizedSubscription.unsubscribe(); + }; + NavMenuComponent.prototype.login = function () { + this.authService.login(); + }; + NavMenuComponent.prototype.refreshSession = function () { + this.authService.refreshSession(); + }; + NavMenuComponent.prototype.logout = function () { + this.authService.logout(); + }; + NavMenuComponent = __decorate([ + __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Component"])({ + selector: 'nav-menu', + template: __webpack_require__(87), + styles: [__webpack_require__(119)] + }), + __metadata("design:paramtypes", [__WEBPACK_IMPORTED_MODULE_1__services_auth_service__["a" /* AuthService */]]) + ], NavMenuComponent); + return NavMenuComponent; +}()); + -var Observable_1 = __webpack_require__(0); -var retryWhen_1 = __webpack_require__(325); -Observable_1.Observable.prototype.retryWhen = retryWhen_1.retryWhen; -//# sourceMappingURL=retryWhen.js.map /***/ }), -/* 210 */ -/***/ (function(module, exports, __webpack_require__) { +/* 69 */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return UnauthorizedComponent; }); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__(4); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0__angular_core__); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__angular_common__ = __webpack_require__(5); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__angular_common___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1__angular_common__); +var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { + var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); + else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; + return c > 3 && r && Object.defineProperty(target, key, r), r; +}; +var __metadata = (this && this.__metadata) || function (k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); +}; + + +var UnauthorizedComponent = (function () { + function UnauthorizedComponent(location) { + this.location = location; + } + UnauthorizedComponent.prototype.ngOnInit = function () { + }; + UnauthorizedComponent.prototype.login = function () { + //this.service.startSigninMainWindow(); + }; + UnauthorizedComponent.prototype.goback = function () { + this.location.back(); + }; + UnauthorizedComponent = __decorate([ + __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Component"])({ + selector: 'app-unauthorized', + template: __webpack_require__(88) + }), + __metadata("design:paramtypes", [__WEBPACK_IMPORTED_MODULE_1__angular_common__["Location"]]) + ], UnauthorizedComponent); + return UnauthorizedComponent; +}()); + -var Observable_1 = __webpack_require__(0); -var sample_1 = __webpack_require__(326); -Observable_1.Observable.prototype.sample = sample_1.sample; -//# sourceMappingURL=sample.js.map /***/ }), -/* 211 */ -/***/ (function(module, exports, __webpack_require__) { +/* 70 */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; +Object.defineProperty(__webpack_exports__, "__esModule", { value: true }); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_reflect_metadata__ = __webpack_require__(59); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_reflect_metadata___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_reflect_metadata__); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_zone_js__ = __webpack_require__(62); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_zone_js___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_zone_js__); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_rxjs_add_operator_first__ = __webpack_require__(60); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_rxjs_add_operator_first___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2_rxjs_add_operator_first__); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__angular_common__ = __webpack_require__(5); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__angular_common___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_3__angular_common__); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__angular_core__ = __webpack_require__(4); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__angular_core___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_4__angular_core__); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__angular_platform_server__ = __webpack_require__(25); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__angular_platform_server___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_5__angular_platform_server__); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6_aspnet_prerendering__ = __webpack_require__(61); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6_aspnet_prerendering___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_6_aspnet_prerendering__); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__app_app_module_server__ = __webpack_require__(58); + + + + + + + + +__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_4__angular_core__["enableProdMode"])(); +/* harmony default export */ __webpack_exports__["default"] = (__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_6_aspnet_prerendering__["createServerRenderer"])(function (params) { + var providers = [ + { provide: __WEBPACK_IMPORTED_MODULE_5__angular_platform_server__["INITIAL_CONFIG"], useValue: { document: '', url: params.url } }, + { provide: __WEBPACK_IMPORTED_MODULE_3__angular_common__["APP_BASE_HREF"], useValue: params.baseUrl }, + { provide: 'BASE_URL', useValue: params.origin + params.baseUrl }, + { provide: 'ORIGIN_URL', useValue: params.origin + params.baseUrl }, + { provide: 'API_URL', useValue: params.data.apiUrl }, + { provide: 'IDENTITY_URL', useValue: params.data.identityUrl }, + { provide: 'URL_CONFIG', useValue: params.data } + ]; + return __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_5__angular_platform_server__["platformDynamicServer"])(providers).bootstrapModule(__WEBPACK_IMPORTED_MODULE_7__app_app_module_server__["a" /* AppModule */]).then(function (moduleRef) { + var appRef = moduleRef.injector.get(__WEBPACK_IMPORTED_MODULE_4__angular_core__["ApplicationRef"]); + var state = moduleRef.injector.get(__WEBPACK_IMPORTED_MODULE_5__angular_platform_server__["PlatformState"]); + var zone = moduleRef.injector.get(__WEBPACK_IMPORTED_MODULE_4__angular_core__["NgZone"]); + return new Promise(function (resolve, reject) { + zone.onError.subscribe(function (errorInfo) { return reject(errorInfo); }); + appRef.isStable.first(function (isStable) { return isStable; }).subscribe(function () { + // Because 'onStable' fires before 'onError', we have to delay slightly before + // completing the request in case there's an error to report + setImmediate(function () { + resolve({ + html: state.renderToString(), + globals: { url_Config: params.data } + }); + moduleRef.destroy(); + }); + }); + }); + }); +})); -var Observable_1 = __webpack_require__(0); -var sampleTime_1 = __webpack_require__(327); -Observable_1.Observable.prototype.sampleTime = sampleTime_1.sampleTime; -//# sourceMappingURL=sampleTime.js.map /***/ }), -/* 212 */ +/* 71 */ /***/ (function(module, exports, __webpack_require__) { -"use strict"; +exports = module.exports = __webpack_require__(54)(undefined); +// imports -var Observable_1 = __webpack_require__(0); -var scan_1 = __webpack_require__(328); -Observable_1.Observable.prototype.scan = scan_1.scan; -//# sourceMappingURL=scan.js.map -/***/ }), -/* 213 */ -/***/ (function(module, exports, __webpack_require__) { +// module +exports.push([module.i, "@media (max-width: 767px) {\r\n /* On small screens, the nav menu spans the full width of the screen. Leave a space for it. */\r\n .body-content {\r\n padding-top: 50px;\r\n }\r\n}\r\n", ""]); -"use strict"; +// exports -var Observable_1 = __webpack_require__(0); -var sequenceEqual_1 = __webpack_require__(329); -Observable_1.Observable.prototype.sequenceEqual = sequenceEqual_1.sequenceEqual; -//# sourceMappingURL=sequenceEqual.js.map /***/ }), -/* 214 */ +/* 72 */ /***/ (function(module, exports, __webpack_require__) { -"use strict"; +exports = module.exports = __webpack_require__(54)(undefined); +// imports -var Observable_1 = __webpack_require__(0); -var share_1 = __webpack_require__(398); -Observable_1.Observable.prototype.share = share_1.share; -//# sourceMappingURL=share.js.map -/***/ }), -/* 215 */ -/***/ (function(module, exports, __webpack_require__) { +// module +exports.push([module.i, "li .glyphicon {\r\n margin-right: 10px;\r\n}\r\n\r\n/* Highlighting rules for nav menu items */\r\nli.link-active a,\r\nli.link-active a:hover,\r\nli.link-active a:focus {\r\n background-color: #4189C7;\r\n color: white;\r\n}\r\n\r\n/* Keep the nav menu independent of scrolling and on top of other items */\r\n.main-nav {\r\n position: fixed;\r\n top: 0;\r\n left: 0;\r\n right: 0;\r\n z-index: 1;\r\n}\r\n\r\n@media (min-width: 768px) {\r\n /* On small screens, convert the nav menu to a vertical sidebar */\r\n .main-nav {\r\n height: 100%;\r\n width: calc(25% - 20px);\r\n }\r\n .navbar {\r\n border-radius: 0px;\r\n border-width: 0px;\r\n height: 100%;\r\n }\r\n .navbar-header {\r\n float: none;\r\n }\r\n .navbar-collapse {\r\n border-top: 1px solid #444;\r\n padding: 0px;\r\n }\r\n .navbar ul {\r\n float: none;\r\n }\r\n .navbar li {\r\n float: none;\r\n font-size: 15px;\r\n margin: 6px;\r\n }\r\n .navbar li a {\r\n padding: 10px 16px;\r\n border-radius: 4px;\r\n }\r\n .navbar a {\r\n /* If a menu item's text is too long, truncate it */\r\n width: 100%;\r\n white-space: nowrap;\r\n overflow: hidden;\r\n text-overflow: ellipsis;\r\n }\r\n}\r\n", ""]); -"use strict"; +// exports -var Observable_1 = __webpack_require__(0); -var shareReplay_1 = __webpack_require__(330); -Observable_1.Observable.prototype.shareReplay = shareReplay_1.shareReplay; -//# sourceMappingURL=shareReplay.js.map /***/ }), -/* 216 */ +/* 73 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -var Observable_1 = __webpack_require__(0); -var single_1 = __webpack_require__(331); -Observable_1.Observable.prototype.single = single_1.single; -//# sourceMappingURL=single.js.map +module.exports = CustomEvent; -/***/ }), -/* 217 */ -/***/ (function(module, exports, __webpack_require__) { +var Event = __webpack_require__(7); -"use strict"; +function CustomEvent(type, dictionary) { + // Just use the superclass constructor to initialize + Event.call(this, type, dictionary); +} +CustomEvent.prototype = Object.create(Event.prototype, { + constructor: { value: CustomEvent } +}); -var Observable_1 = __webpack_require__(0); -var skip_1 = __webpack_require__(332); -Observable_1.Observable.prototype.skip = skip_1.skip; -//# sourceMappingURL=skip.js.map /***/ }), -/* 218 */ +/* 74 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -var Observable_1 = __webpack_require__(0); -var skipLast_1 = __webpack_require__(333); -Observable_1.Observable.prototype.skipLast = skipLast_1.skipLast; -//# sourceMappingURL=skipLast.js.map +module.exports = FilteredElementList; -/***/ }), -/* 219 */ -/***/ (function(module, exports, __webpack_require__) { +var Node = __webpack_require__(3); -"use strict"; +// +// This file defines node list implementation that lazily traverses +// the document tree (or a subtree rooted at any element) and includes +// only those elements for which a specified filter function returns true. +// It is used to implement the +// {Document,Element}.getElementsBy{TagName,ClassName}{,NS} methods. +// -var Observable_1 = __webpack_require__(0); -var skipUntil_1 = __webpack_require__(334); -Observable_1.Observable.prototype.skipUntil = skipUntil_1.skipUntil; -//# sourceMappingURL=skipUntil.js.map +function FilteredElementList(root, filter) { + this.root = root; + this.filter = filter; + this.lastModTime = root.lastModTime; + this.done = false; + this.cache = []; + this.traverse(); +} -/***/ }), -/* 220 */ -/***/ (function(module, exports, __webpack_require__) { +FilteredElementList.prototype = { + get length() { + this.checkcache(); + if (!this.done) this.traverse(); + return this.cache.length; + }, -"use strict"; + item: function(n) { + this.checkcache(); + if (!this.done && n >= this.cache.length) this.traverse(n); + return this.cache[n]; + }, -var Observable_1 = __webpack_require__(0); -var skipWhile_1 = __webpack_require__(335); -Observable_1.Observable.prototype.skipWhile = skipWhile_1.skipWhile; -//# sourceMappingURL=skipWhile.js.map + checkcache: function() { + if (this.lastModTime !== this.root.lastModTime) { + // subtree has changed, so invalidate cache + for (var i = this.cache.length-1; i>=0; i--) { + this[i] = undefined; + } + this.cache.length = 0; + this.done = false; + this.lastModTime = this.root.lastModTime; + } + }, + + // If n is specified, then traverse the tree until we've found the nth + // item (or until we've found all items). If n is not specified, + // traverse until we've found all items. + traverse: function(n) { + // increment n so we can compare to length, and so it is never falsy + if (n !== undefined) n++; + + var elt; + while ((elt = this.next()) !== null) { + this[this.cache.length] = elt; //XXX Use proxy instead + this.cache.push(elt); + if (n && this.cache.length === n) return; + } + + // no next element, so we've found everything + this.done = true; + }, + + // Return the next element under root that matches filter + next: function() { + var start = (this.cache.length === 0) ? this.root // Start at the root or at + : this.cache[this.cache.length-1]; // the last element we found + + var elt; + if (start.nodeType === Node.DOCUMENT_NODE) + elt = start.documentElement; + else + elt = start.nextElement(this.root); -/***/ }), -/* 221 */ -/***/ (function(module, exports, __webpack_require__) { + while(elt) { + if (this.filter(elt)) { + return elt; + } -"use strict"; + elt = elt.nextElement(this.root); + } + return null; + } +}; -var Observable_1 = __webpack_require__(0); -var startWith_1 = __webpack_require__(336); -Observable_1.Observable.prototype.startWith = startWith_1.startWith; -//# sourceMappingURL=startWith.js.map /***/ }), -/* 222 */ +/* 75 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -var Observable_1 = __webpack_require__(0); -var subscribeOn_1 = __webpack_require__(337); -Observable_1.Observable.prototype.subscribeOn = subscribeOn_1.subscribeOn; -//# sourceMappingURL=subscribeOn.js.map +var URL = __webpack_require__(20); +var URLUtils = __webpack_require__(41); -/***/ }), -/* 223 */ -/***/ (function(module, exports, __webpack_require__) { +module.exports = Location; -"use strict"; +function Location(window, href) { + this._window = window; + this._href = href; +} -var Observable_1 = __webpack_require__(0); -var switch_1 = __webpack_require__(338); -Observable_1.Observable.prototype.switch = switch_1._switch; -Observable_1.Observable.prototype._switch = switch_1._switch; -//# sourceMappingURL=switch.js.map +Location.prototype = Object.create(URLUtils.prototype, { + constructor: { value: Location }, -/***/ }), -/* 224 */ -/***/ (function(module, exports, __webpack_require__) { + // Special behavior when href is set + href: { + get: function() { return this._href; }, + set: function(v) { this.assign(v); } + }, -"use strict"; + assign: { value: function(url) { + // Resolve the new url against the current one + // XXX: + // This is not actually correct. It should be resolved against + // the URL of the document of the script. For now, though, I only + // support a single window and there is only one base url. + // So this is good enough for now. + var current = new URL(this._href); + var newurl = current.resolve(url); -var Observable_1 = __webpack_require__(0); -var switchMap_1 = __webpack_require__(339); -Observable_1.Observable.prototype.switchMap = switchMap_1.switchMap; -//# sourceMappingURL=switchMap.js.map + // Save the new url + this._href = newurl; -/***/ }), -/* 225 */ -/***/ (function(module, exports, __webpack_require__) { + // Start loading the new document! + // XXX + // This is just something hacked together. + // The real algorithm is: http://www.whatwg.org/specs/web-apps/current-work/multipage/history.html#navigate + }}, -"use strict"; + replace: { value: function(url) { + // XXX + // Since we aren't tracking history yet, replace is the same as assign + this.assign(url); + }}, -var Observable_1 = __webpack_require__(0); -var switchMapTo_1 = __webpack_require__(340); -Observable_1.Observable.prototype.switchMapTo = switchMapTo_1.switchMapTo; -//# sourceMappingURL=switchMapTo.js.map + reload: { value: function() { + // XXX: + // Actually, the spec is a lot more complicated than this + this.assign(this.href); + }}, -/***/ }), -/* 226 */ -/***/ (function(module, exports, __webpack_require__) { + toString: { value: function() { + return this.href; + }} -"use strict"; +}); -var Observable_1 = __webpack_require__(0); -var take_1 = __webpack_require__(341); -Observable_1.Observable.prototype.take = take_1.take; -//# sourceMappingURL=take.js.map /***/ }), -/* 227 */ +/* 76 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -var Observable_1 = __webpack_require__(0); -var takeLast_1 = __webpack_require__(342); -Observable_1.Observable.prototype.takeLast = takeLast_1.takeLast; -//# sourceMappingURL=takeLast.js.map +module.exports = { + VALUE: 1, // The value of a Text, Comment or PI node changed + ATTR: 2, // A new attribute was added or an attribute value and/or prefix changed + REMOVE_ATTR: 3, // An attribute was removed + REMOVE: 4, // A node was removed + MOVE: 5, // A node was moved + INSERT: 6 // A node (or a subtree of nodes) was inserted +}; /***/ }), -/* 228 */ +/* 77 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -var Observable_1 = __webpack_require__(0); -var takeUntil_1 = __webpack_require__(343); -Observable_1.Observable.prototype.takeUntil = takeUntil_1.takeUntil; -//# sourceMappingURL=takeUntil.js.map -/***/ }), -/* 229 */ -/***/ (function(module, exports, __webpack_require__) { +// https://html.spec.whatwg.org/multipage/webappapis.html#navigatorid +var NavigatorID = Object.create(null, { + appCodeName: { value: "Mozilla" }, + appName: { value: "Netscape" }, + appVersion: { value: "4.0" }, + platform: { value: "" }, + product: { value: "Gecko" }, + productSub: { value: "20100101" }, + userAgent: { value: "" }, + vendor: { value: "" }, + vendorSub: { value: "" }, + taintEnabled: { value: function() { return false; } } +}); -"use strict"; +module.exports = NavigatorID; -var Observable_1 = __webpack_require__(0); -var takeWhile_1 = __webpack_require__(344); -Observable_1.Observable.prototype.takeWhile = takeWhile_1.takeWhile; -//# sourceMappingURL=takeWhile.js.map /***/ }), -/* 230 */ +/* 78 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -var Observable_1 = __webpack_require__(0); -var throttle_1 = __webpack_require__(65); -Observable_1.Observable.prototype.throttle = throttle_1.throttle; -//# sourceMappingURL=throttle.js.map +module.exports = NodeIterator; -/***/ }), -/* 231 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; +var NodeFilter = __webpack_require__(10); +var NodeTraversal = __webpack_require__(36); -var Observable_1 = __webpack_require__(0); -var throttleTime_1 = __webpack_require__(345); -Observable_1.Observable.prototype.throttleTime = throttleTime_1.throttleTime; -//# sourceMappingURL=throttleTime.js.map +/* Private methods and helpers */ -/***/ }), -/* 232 */ -/***/ (function(module, exports, __webpack_require__) { +/** + * @based on WebKit's NodeIterator::moveToNext and NodeIterator::moveToPrevious + * https://trac.webkit.org/browser/trunk/Source/WebCore/dom/NodeIterator.cpp?rev=186279#L51 + */ +function move(node, stayWithin, directionIsNext) { + if (directionIsNext) { + return NodeTraversal.next(node, stayWithin); + } else { + if (node === stayWithin) { + return null; + } + return NodeTraversal.previous(node, null); + } +} -"use strict"; +/** + * @spec http://www.w3.org/TR/dom/#concept-nodeiterator-traverse + * @method + * @access private + * @param {NodeIterator} ni + * @param {string} direction One of 'next' or 'previous'. + * @return {Node|null} + */ +function traverse(ni, directionIsNext) { + var node, beforeNode; + node = ni.referenceNode; + beforeNode = ni.pointerBeforeReferenceNode; + while (true) { + if (beforeNode === directionIsNext) { + beforeNode = !beforeNode; + } else { + node = move(node, ni.root, directionIsNext); + if (node === null) { + return null; + } + } + var result = ni.filter.acceptNode(node); + if (result === NodeFilter.FILTER_ACCEPT) { + break; + } + } + ni.referenceNode = node; + ni.pointerBeforeReferenceNode = beforeNode; + return node; +} -var Observable_1 = __webpack_require__(0); -var timeInterval_1 = __webpack_require__(66); -Observable_1.Observable.prototype.timeInterval = timeInterval_1.timeInterval; -//# sourceMappingURL=timeInterval.js.map +/* Public API */ -/***/ }), -/* 233 */ -/***/ (function(module, exports, __webpack_require__) { +/** + * Implemented version: http://www.w3.org/TR/2015/WD-dom-20150618/#nodeiterator + * Latest version: http://www.w3.org/TR/dom/#nodeiterator + * + * @constructor + * @param {Node} root + * @param {number} whatToShow [optional] + * @param {Function|NodeFilter} filter [optional] + * @throws Error + */ +function NodeIterator(root, whatToShow, filter) { + var ni = this, active = false; -"use strict"; + if (!root || !root.nodeType) { + throw new Error('DOMException: NOT_SUPPORTED_ERR'); + } -var Observable_1 = __webpack_require__(0); -var timeout_1 = __webpack_require__(346); -Observable_1.Observable.prototype.timeout = timeout_1.timeout; -//# sourceMappingURL=timeout.js.map + ni.root = ni.referenceNode = root; + ni.pointerBeforeReferenceNode = true; + ni.whatToShow = Number(whatToShow) || 0; -/***/ }), -/* 234 */ -/***/ (function(module, exports, __webpack_require__) { + if (typeof filter !== 'function') { + filter = null; + } -"use strict"; + ni.filter = Object.create(NodeFilter.prototype); -var Observable_1 = __webpack_require__(0); -var timeoutWith_1 = __webpack_require__(347); -Observable_1.Observable.prototype.timeoutWith = timeoutWith_1.timeoutWith; -//# sourceMappingURL=timeoutWith.js.map + /** + * @method + * @param {Node} node + * @return {Number} Constant NodeFilter.FILTER_ACCEPT, + * NodeFilter.FILTER_REJECT or NodeFilter.FILTER_SKIP. + */ + ni.filter.acceptNode = function (node) { + /* jshint bitwise: false */ + var result; + if (active) { + throw new Error('DOMException: INVALID_STATE_ERR'); + } -/***/ }), -/* 235 */ -/***/ (function(module, exports, __webpack_require__) { + // Maps nodeType to whatToShow + if (!(((1 << (node.nodeType - 1)) & ni.whatToShow))) { + return NodeFilter.FILTER_SKIP; + } -"use strict"; + if (filter === null) { + return NodeFilter.FILTER_ACCEPT; + } -var Observable_1 = __webpack_require__(0); -var timestamp_1 = __webpack_require__(67); -Observable_1.Observable.prototype.timestamp = timestamp_1.timestamp; -//# sourceMappingURL=timestamp.js.map + active = true; + result = filter(node); + active = false; -/***/ }), -/* 236 */ -/***/ (function(module, exports, __webpack_require__) { + return result; + }; +} -"use strict"; +NodeIterator.prototype = { + constructor: NodeIterator, -var Observable_1 = __webpack_require__(0); -var toArray_1 = __webpack_require__(348); -Observable_1.Observable.prototype.toArray = toArray_1.toArray; -//# sourceMappingURL=toArray.js.map + /** + * @spec http://www.w3.org/TR/dom/#dom-nodeiterator-nextnode + * @method + * @return {Node|null} + */ + nextNode: function () { + return traverse(this, true); + }, -/***/ }), -/* 237 */ -/***/ (function(module, exports, __webpack_require__) { + /** + * @spec http://www.w3.org/TR/dom/#dom-nodeiterator-previousnode + * @method + * @return {Node|null} + */ + previousNode: function () { + return traverse(this, false); + }, -"use strict"; + /** + * @spec http://www.w3.org/TR/dom/#dom-nodeiterator-detach + * @method + * @return void + */ + detach: function() { + /* "The detach() method must do nothing. + * Its functionality (disabling a NodeIterator object) was removed, + * but the method itself is preserved for compatibility. + */ + } +}; -var Observable_1 = __webpack_require__(0); -var toPromise_1 = __webpack_require__(68); -Observable_1.Observable.prototype.toPromise = toPromise_1.toPromise; -//# sourceMappingURL=toPromise.js.map /***/ }), -/* 238 */ +/* 79 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -var Observable_1 = __webpack_require__(0); -var window_1 = __webpack_require__(349); -Observable_1.Observable.prototype.window = window_1.window; -//# sourceMappingURL=window.js.map - -/***/ }), -/* 239 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; +module.exports = TreeWalker; -var Observable_1 = __webpack_require__(0); -var windowCount_1 = __webpack_require__(350); -Observable_1.Observable.prototype.windowCount = windowCount_1.windowCount; -//# sourceMappingURL=windowCount.js.map +var NodeFilter = __webpack_require__(10); +var NodeTraversal = __webpack_require__(36); -/***/ }), -/* 240 */ -/***/ (function(module, exports, __webpack_require__) { +var mapChild = { + first: 'firstChild', + last: 'lastChild', + next: 'firstChild', + previous: 'lastChild' +}; -"use strict"; +var mapSibling = { + first: 'nextSibling', + last: 'previousSibling', + next: 'nextSibling', + previous: 'previousSibling' +}; -var Observable_1 = __webpack_require__(0); -var windowTime_1 = __webpack_require__(351); -Observable_1.Observable.prototype.windowTime = windowTime_1.windowTime; -//# sourceMappingURL=windowTime.js.map +/* Private methods and helpers */ -/***/ }), -/* 241 */ -/***/ (function(module, exports, __webpack_require__) { +/** + * @spec http://www.w3.org/TR/dom/#concept-traverse-children + * @method + * @access private + * @param {TreeWalker} tw + * @param {string} type One of 'first' or 'last'. + * @return {Node|null} + */ +function traverseChildren(tw, type) { + var child, node, parent, result, sibling; + node = tw.currentNode[mapChild[type]]; + while (node !== null) { + result = tw.filter.acceptNode(node); + if (result === NodeFilter.FILTER_ACCEPT) { + tw.currentNode = node; + return node; + } + if (result === NodeFilter.FILTER_SKIP) { + child = node[mapChild[type]]; + if (child !== null) { + node = child; + continue; + } + } + while (node !== null) { + sibling = node[mapSibling[type]]; + if (sibling !== null) { + node = sibling; + break; + } + parent = node.parentNode; + if (parent === null || parent === tw.root || parent === tw.currentNode) { + return null; + } + else { + node = parent; + } + } + } + return null; +} -"use strict"; +/** + * @spec http://www.w3.org/TR/dom/#concept-traverse-siblings + * @method + * @access private + * @param {TreeWalker} tw + * @param {TreeWalker} type One of 'next' or 'previous'. + * @return {Node|nul} + */ +function traverseSiblings(tw, type) { + var node, result, sibling; + node = tw.currentNode; + if (node === tw.root) { + return null; + } + while (true) { + sibling = node[mapSibling[type]]; + while (sibling !== null) { + node = sibling; + result = tw.filter.acceptNode(node); + if (result === NodeFilter.FILTER_ACCEPT) { + tw.currentNode = node; + return node; + } + sibling = node[mapChild[type]]; + if (result === NodeFilter.FILTER_REJECT || sibling === null) { + sibling = node[mapSibling[type]]; + } + } + node = node.parentNode; + if (node === null || node === tw.root) { + return null; + } + if (tw.filter.acceptNode(node) === NodeFilter.FILTER_ACCEPT) { + return null; + } + } +} -var Observable_1 = __webpack_require__(0); -var windowToggle_1 = __webpack_require__(352); -Observable_1.Observable.prototype.windowToggle = windowToggle_1.windowToggle; -//# sourceMappingURL=windowToggle.js.map -/***/ }), -/* 242 */ -/***/ (function(module, exports, __webpack_require__) { +/* Public API */ -"use strict"; +/** + * Implemented version: http://www.w3.org/TR/2015/WD-dom-20150618/#interface-treewalker + * Latest version: http://www.w3.org/TR/dom/#interface-treewalker + * + * @constructor + * @param {Node} root + * @param {number} whatToShow [optional] + * @param {Function|NodeFilter} filter [optional] + * @throws Error + */ +function TreeWalker(root, whatToShow, filter) { + var tw = this, active = false; -var Observable_1 = __webpack_require__(0); -var windowWhen_1 = __webpack_require__(353); -Observable_1.Observable.prototype.windowWhen = windowWhen_1.windowWhen; -//# sourceMappingURL=windowWhen.js.map + if (!root || !root.nodeType) { + throw new Error('DOMException: NOT_SUPPORTED_ERR'); + } -/***/ }), -/* 243 */ -/***/ (function(module, exports, __webpack_require__) { + tw.root = root; + tw.whatToShow = Number(whatToShow) || 0; -"use strict"; + tw.currentNode = root; -var Observable_1 = __webpack_require__(0); -var withLatestFrom_1 = __webpack_require__(354); -Observable_1.Observable.prototype.withLatestFrom = withLatestFrom_1.withLatestFrom; -//# sourceMappingURL=withLatestFrom.js.map + if (typeof filter !== 'function') { + filter = null; + } -/***/ }), -/* 244 */ -/***/ (function(module, exports, __webpack_require__) { + tw.filter = Object.create(NodeFilter.prototype); -"use strict"; + /** + * @method + * @param {Node} node + * @return {Number} Constant NodeFilter.FILTER_ACCEPT, + * NodeFilter.FILTER_REJECT or NodeFilter.FILTER_SKIP. + */ + tw.filter.acceptNode = function (node) { + /* jshint bitwise: false */ + var result; + if (active) { + throw new Error('DOMException: INVALID_STATE_ERR'); + } -var Observable_1 = __webpack_require__(0); -var zip_1 = __webpack_require__(39); -Observable_1.Observable.prototype.zip = zip_1.zipProto; -//# sourceMappingURL=zip.js.map + // Maps nodeType to whatToShow + if (!(((1 << (node.nodeType - 1)) & tw.whatToShow))) { + return NodeFilter.FILTER_SKIP; + } -/***/ }), -/* 245 */ -/***/ (function(module, exports, __webpack_require__) { + if (filter === null) { + return NodeFilter.FILTER_ACCEPT; + } -"use strict"; + active = true; + result = filter(node); + active = false; -var Observable_1 = __webpack_require__(0); -var zipAll_1 = __webpack_require__(355); -Observable_1.Observable.prototype.zipAll = zipAll_1.zipAll; -//# sourceMappingURL=zipAll.js.map + return result; + }; +} -/***/ }), -/* 246 */ -/***/ (function(module, exports, __webpack_require__) { +TreeWalker.prototype = { -"use strict"; + constructor: TreeWalker, -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; -var Observable_1 = __webpack_require__(0); -var tryCatch_1 = __webpack_require__(7); -var errorObject_1 = __webpack_require__(5); -var AsyncSubject_1 = __webpack_require__(25); -/** - * We need this JSDoc comment for affecting ESDoc. - * @extends {Ignored} - * @hide true - */ -var BoundCallbackObservable = (function (_super) { - __extends(BoundCallbackObservable, _super); - function BoundCallbackObservable(callbackFunc, selector, args, context, scheduler) { - _super.call(this); - this.callbackFunc = callbackFunc; - this.selector = selector; - this.args = args; - this.context = context; - this.scheduler = scheduler; + /** + * @spec http://www.w3.org/TR/dom/#dom-treewalker-parentnode + * @method + * @return {Node|null} + */ + parentNode: function () { + var node = this.currentNode; + while (node !== null && node !== this.root) { + node = node.parentNode; + if (node !== null && this.filter.acceptNode(node) === NodeFilter.FILTER_ACCEPT) { + this.currentNode = node; + return node; + } } - /* tslint:enable:max-line-length */ - /** - * Converts a callback API to a function that returns an Observable. - * - * Give it a function `f` of type `f(x, callback)` and - * it will return a function `g` that when called as `g(x)` will output an - * Observable. - * - * `bindCallback` is not an operator because its input and output are not - * Observables. The input is a function `func` with some parameters, but the - * last parameter must be a callback function that `func` calls when it is - * done. - * - * The output of `bindCallback` is a function that takes the same parameters - * as `func`, except the last one (the callback). When the output function - * is called with arguments, it will return an Observable. If `func` function - * calls its callback with one argument, the Observable will emit that value. - * If on the other hand callback is called with multiple values, resulting - * Observable will emit an array with these arguments. - * - * It is very important to remember, that input function `func` is not called - * when output function is, but rather when Observable returned by output - * function is subscribed. This means if `func` makes AJAX request, that request - * will be made every time someone subscribes to resulting Observable, but not before. - * - * Optionally, selector function can be passed to `bindObservable`. That function - * takes the same arguments as callback, and returns value - * that will be emitted by Observable instead of callback parameters themselves. - * Even though by default multiple arguments passed to callback appear in the stream as array, - * selector function will be called with arguments directly, just as callback would. - * This means you can imagine default selector (when one is not provided explicitly) - * as function that aggregates all its arguments into array, or simply returns first argument, - * if there is only one. - * - * Last optional parameter - {@link Scheduler} - can be used to control when call - * to `func` happens after someone subscribes to Observable, as well as when results - * passed to callback will be emitted. By default subscription to Observable calls `func` - * synchronously, but using `Scheduler.async` as last parameter will defer call to input function, - * just like wrapping that call in `setTimeout` with time `0` would. So if you use async Scheduler - * and call `subscribe` on output Observable, all function calls that are currently executing, - * will end before `func` is invoked. - * - * When it comes to emitting results passed to callback, by default they are emitted - * immediately after `func` invokes callback. In particular, if callback is called synchronously, - * then subscription to resulting Observable will call `next` function synchronously as well. - * If you want to defer that call, using `Scheduler.async` will, again, do the job. - * This means that by using `Scheduler.async` you can, in a sense, ensure that `func` - * always calls its callback asynchronously, thus avoiding terrifying Zalgo. - * - * Note that Observable created by output function will always emit only one value - * and then complete right after. Even if `func` calls callback multiple times, values from - * second and following calls will never appear in the stream. If you need to - * listen for multiple calls, you probably want to use {@link fromEvent} or - * {@link fromEventPattern} instead. - * - * If `func` depends on some context (`this` property), that context will be set - * to the same context that output function has at call time. In particular, if `func` - * is called as method of some object, in order to preserve proper behaviour, - * it is recommended to set context of output function to that object as well, - * provided `func` is not already bound. - * - * If input function calls its callback in "node style" (i.e. first argument to callback is - * optional error parameter signaling whether call failed or not), {@link bindNodeCallback} - * provides convenient error handling and probably is a better choice. - * `bindCallback` will treat such functions without any difference and error parameter - * (whether passed or not) will always be interpreted as regular callback argument. - * - * - * @example Convert jQuery's getJSON to an Observable API - * // Suppose we have jQuery.getJSON('/my/url', callback) - * var getJSONAsObservable = Rx.Observable.bindCallback(jQuery.getJSON); - * var result = getJSONAsObservable('/my/url'); - * result.subscribe(x => console.log(x), e => console.error(e)); - * - * - * @example Receive array of arguments passed to callback - * someFunction((a, b, c) => { - * console.log(a); // 5 - * console.log(b); // 'some string' - * console.log(c); // {someProperty: 'someValue'} - * }); - * - * const boundSomeFunction = Rx.Observable.bindCallback(someFunction); - * boundSomeFunction().subscribe(values => { - * console.log(values) // [5, 'some string', {someProperty: 'someValue'}] - * }); - * - * - * @example Use bindCallback with selector function - * someFunction((a, b, c) => { - * console.log(a); // 'a' - * console.log(b); // 'b' - * console.log(c); // 'c' - * }); - * - * const boundSomeFunction = Rx.Observable.bindCallback(someFunction, (a, b, c) => a + b + c); - * boundSomeFunction().subscribe(value => { - * console.log(value) // 'abc' - * }); - * - * - * @example Compare behaviour with and without async Scheduler - * function iCallMyCallbackSynchronously(cb) { - * cb(); - * } - * - * const boundSyncFn = Rx.Observable.bindCallback(iCallMyCallbackSynchronously); - * const boundAsyncFn = Rx.Observable.bindCallback(iCallMyCallbackSynchronously, null, Rx.Scheduler.async); - * - * boundSyncFn().subscribe(() => console.log('I was sync!')); - * boundAsyncFn().subscribe(() => console.log('I was async!')); - * console.log('This happened...'); - * - * // Logs: - * // I was sync! - * // This happened... - * // I was async! - * - * - * @example Use bindCallback on object method - * const boundMethod = Rx.Observable.bindCallback(someObject.methodWithCallback); - * boundMethod.call(someObject) // make sure methodWithCallback has access to someObject - * .subscribe(subscriber); - * - * - * @see {@link bindNodeCallback} - * @see {@link from} - * @see {@link fromPromise} - * - * @param {function} func Function with a callback as the last parameter. - * @param {function} [selector] A function which takes the arguments from the - * callback and maps those to a value to emit on the output Observable. - * @param {Scheduler} [scheduler] The scheduler on which to schedule the - * callbacks. - * @return {function(...params: *): Observable} A function which returns the - * Observable that delivers the same values the callback would deliver. - * @static true - * @name bindCallback - * @owner Observable - */ - BoundCallbackObservable.create = function (func, selector, scheduler) { - if (selector === void 0) { selector = undefined; } - return function () { - var args = []; - for (var _i = 0; _i < arguments.length; _i++) { - args[_i - 0] = arguments[_i]; - } - return new BoundCallbackObservable(func, selector, args, this, scheduler); - }; - }; - BoundCallbackObservable.prototype._subscribe = function (subscriber) { - var callbackFunc = this.callbackFunc; - var args = this.args; - var scheduler = this.scheduler; - var subject = this.subject; - if (!scheduler) { - if (!subject) { - subject = this.subject = new AsyncSubject_1.AsyncSubject(); - var handler = function handlerFn() { - var innerArgs = []; - for (var _i = 0; _i < arguments.length; _i++) { - innerArgs[_i - 0] = arguments[_i]; - } - var source = handlerFn.source; - var selector = source.selector, subject = source.subject; - if (selector) { - var result_1 = tryCatch_1.tryCatch(selector).apply(this, innerArgs); - if (result_1 === errorObject_1.errorObject) { - subject.error(errorObject_1.errorObject.e); - } - else { - subject.next(result_1); - subject.complete(); - } - } - else { - subject.next(innerArgs.length <= 1 ? innerArgs[0] : innerArgs); - subject.complete(); - } - }; - // use named function instance to avoid closure. - handler.source = this; - var result = tryCatch_1.tryCatch(callbackFunc).apply(this.context, args.concat(handler)); - if (result === errorObject_1.errorObject) { - subject.error(errorObject_1.errorObject.e); - } - } - return subject.subscribe(subscriber); - } - else { - return scheduler.schedule(BoundCallbackObservable.dispatch, 0, { source: this, subscriber: subscriber, context: this.context }); - } - }; - BoundCallbackObservable.dispatch = function (state) { - var self = this; - var source = state.source, subscriber = state.subscriber, context = state.context; - var callbackFunc = source.callbackFunc, args = source.args, scheduler = source.scheduler; - var subject = source.subject; - if (!subject) { - subject = source.subject = new AsyncSubject_1.AsyncSubject(); - var handler = function handlerFn() { - var innerArgs = []; - for (var _i = 0; _i < arguments.length; _i++) { - innerArgs[_i - 0] = arguments[_i]; - } - var source = handlerFn.source; - var selector = source.selector, subject = source.subject; - if (selector) { - var result_2 = tryCatch_1.tryCatch(selector).apply(this, innerArgs); - if (result_2 === errorObject_1.errorObject) { - self.add(scheduler.schedule(dispatchError, 0, { err: errorObject_1.errorObject.e, subject: subject })); - } - else { - self.add(scheduler.schedule(dispatchNext, 0, { value: result_2, subject: subject })); - } - } - else { - var value = innerArgs.length <= 1 ? innerArgs[0] : innerArgs; - self.add(scheduler.schedule(dispatchNext, 0, { value: value, subject: subject })); - } - }; - // use named function to pass values in without closure - handler.source = source; - var result = tryCatch_1.tryCatch(callbackFunc).apply(context, args.concat(handler)); - if (result === errorObject_1.errorObject) { - subject.error(errorObject_1.errorObject.e); - } - } - self.add(subject.subscribe(subscriber)); - }; - return BoundCallbackObservable; -}(Observable_1.Observable)); -exports.BoundCallbackObservable = BoundCallbackObservable; -function dispatchNext(arg) { - var value = arg.value, subject = arg.subject; - subject.next(value); - subject.complete(); -} -function dispatchError(arg) { - var err = arg.err, subject = arg.subject; - subject.error(err); -} -//# sourceMappingURL=BoundCallbackObservable.js.map + return null; + }, + + /** + * @spec http://www.w3.org/TR/dom/#dom-treewalker-firstchild + * @method + * @return {Node|null} + */ + firstChild: function () { + return traverseChildren(this, 'first'); + }, + + /** + * @spec http://www.w3.org/TR/dom/#dom-treewalker-lastchild + * @method + * @return {Node|null} + */ + lastChild: function () { + return traverseChildren(this, 'last'); + }, + + /** + * @spec http://www.w3.org/TR/dom/#dom-treewalker-previoussibling + * @method + * @return {Node|null} + */ + previousSibling: function () { + return traverseSiblings(this, 'previous'); + }, + + /** + * @spec http://www.w3.org/TR/dom/#dom-treewalker-nextsibling + * @method + * @return {Node|null} + */ + nextSibling: function () { + return traverseSiblings(this, 'next'); + }, + + /** + * @spec http://www.w3.org/TR/dom/#dom-treewalker-previousnode + * @method + * @return {Node|null} + */ + previousNode: function () { + var node, result, sibling; + node = this.currentNode; + while (node !== this.root) { + sibling = node.previousSibling; + while (sibling !== null) { + node = sibling; + result = this.filter.acceptNode(node); + while (result !== NodeFilter.FILTER_REJECT && node.lastChild !== null) { + node = node.lastChild; + result = this.filter.acceptNode(node); + } + if (result === NodeFilter.FILTER_ACCEPT) { + this.currentNode = node; + return node; + } + sibling = node.previousSibling; + } + if (node === this.root || node.parentNode === null) { + return null; + } + node = node.parentNode; + if (this.filter.acceptNode(node) === NodeFilter.FILTER_ACCEPT) { + this.currentNode = node; + return node; + } + } + return null; + }, + + /** + * @spec http://www.w3.org/TR/dom/#dom-treewalker-nextnode + * @based on WebKit's TreeWalker::nextNode + * https://trac.webkit.org/browser/trunk/Source/WebCore/dom/TreeWalker.cpp?rev=179143#L252 + * @method + * @return {Node|null} + */ + nextNode: function () { + var node, result, following; + node = this.currentNode; + result = NodeFilter.FILTER_ACCEPT; + + while (true) { + while (result !== NodeFilter.FILTER_REJECT && node.firstChild !== null) { + node = node.firstChild; + result = this.filter.acceptNode(node); + if (result === NodeFilter.FILTER_ACCEPT) { + this.currentNode = node; + return node; + } + } + following = NodeTraversal.nextSkippingChildren(node, this.root); + if (following !== null) { + node = following; + } + else { + return null; + } + result = this.filter.acceptNode(node); + if (result === NodeFilter.FILTER_ACCEPT) { + this.currentNode = node; + return node; + } + } + } +}; + /***/ }), -/* 247 */ +/* 80 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + +// https://html.spec.whatwg.org/multipage/webappapis.html#windowtimers +var WindowTimers = { + setTimeout: setTimeout, + clearTimeout: clearTimeout, + setInterval: setInterval, + clearInterval: clearInterval }; -var Observable_1 = __webpack_require__(0); -var tryCatch_1 = __webpack_require__(7); -var errorObject_1 = __webpack_require__(5); -var AsyncSubject_1 = __webpack_require__(25); -/** - * We need this JSDoc comment for affecting ESDoc. - * @extends {Ignored} - * @hide true - */ -var BoundNodeCallbackObservable = (function (_super) { - __extends(BoundNodeCallbackObservable, _super); - function BoundNodeCallbackObservable(callbackFunc, selector, args, context, scheduler) { - _super.call(this); - this.callbackFunc = callbackFunc; - this.selector = selector; - this.args = args; - this.context = context; - this.scheduler = scheduler; - } - /* tslint:enable:max-line-length */ - /** - * Converts a Node.js-style callback API to a function that returns an - * Observable. - * - * It's just like {@link bindCallback}, but the - * callback is expected to be of type `callback(error, result)`. - * - * `bindNodeCallback` is not an operator because its input and output are not - * Observables. The input is a function `func` with some parameters, but the - * last parameter must be a callback function that `func` calls when it is - * done. The callback function is expected to follow Node.js conventions, - * where the first argument to the callback is an error object, signaling - * whether call was successful. If that object is passed to callback, it means - * something went wrong. - * - * The output of `bindNodeCallback` is a function that takes the same - * parameters as `func`, except the last one (the callback). When the output - * function is called with arguments, it will return an Observable. - * If `func` calls its callback with error parameter present, Observable will - * error with that value as well. If error parameter is not passed, Observable will emit - * second parameter. If there are more parameters (third and so on), - * Observable will emit an array with all arguments, except first error argument. - * - * Optionally `bindNodeCallback` accepts selector function, which allows you to - * make resulting Observable emit value computed by selector, instead of regular - * callback arguments. It works similarly to {@link bindCallback} selector, but - * Node.js-style error argument will never be passed to that function. - * - * Note that `func` will not be called at the same time output function is, - * but rather whenever resulting Observable is subscribed. By default call to - * `func` will happen synchronously after subscription, but that can be changed - * with proper {@link Scheduler} provided as optional third parameter. Scheduler - * can also control when values from callback will be emitted by Observable. - * To find out more, check out documentation for {@link bindCallback}, where - * Scheduler works exactly the same. - * - * As in {@link bindCallback}, context (`this` property) of input function will be set to context - * of returned function, when it is called. - * - * After Observable emits value, it will complete immediately. This means - * even if `func` calls callback again, values from second and consecutive - * calls will never appear on the stream. If you need to handle functions - * that call callbacks multiple times, check out {@link fromEvent} or - * {@link fromEventPattern} instead. - * - * Note that `bindNodeCallback` can be used in non-Node.js environments as well. - * "Node.js-style" callbacks are just a convention, so if you write for - * browsers or any other environment and API you use implements that callback style, - * `bindNodeCallback` can be safely used on that API functions as well. - * - * Remember that Error object passed to callback does not have to be an instance - * of JavaScript built-in `Error` object. In fact, it does not even have to an object. - * Error parameter of callback function is interpreted as "present", when value - * of that parameter is truthy. It could be, for example, non-zero number, non-empty - * string or boolean `true`. In all of these cases resulting Observable would error - * with that value. This means usually regular style callbacks will fail very often when - * `bindNodeCallback` is used. If your Observable errors much more often then you - * would expect, check if callback really is called in Node.js-style and, if not, - * switch to {@link bindCallback} instead. - * - * Note that even if error parameter is technically present in callback, but its value - * is falsy, it still won't appear in array emitted by Observable or in selector function. - * - * - * @example Read a file from the filesystem and get the data as an Observable - * import * as fs from 'fs'; - * var readFileAsObservable = Rx.Observable.bindNodeCallback(fs.readFile); - * var result = readFileAsObservable('./roadNames.txt', 'utf8'); - * result.subscribe(x => console.log(x), e => console.error(e)); - * - * - * @example Use on function calling callback with multiple arguments - * someFunction((err, a, b) => { - * console.log(err); // null - * console.log(a); // 5 - * console.log(b); // "some string" - * }); - * var boundSomeFunction = Rx.Observable.bindNodeCallback(someFunction); - * boundSomeFunction() - * .subscribe(value => { - * console.log(value); // [5, "some string"] - * }); - * - * - * @example Use with selector function - * someFunction((err, a, b) => { - * console.log(err); // undefined - * console.log(a); // "abc" - * console.log(b); // "DEF" - * }); - * var boundSomeFunction = Rx.Observable.bindNodeCallback(someFunction, (a, b) => a + b); - * boundSomeFunction() - * .subscribe(value => { - * console.log(value); // "abcDEF" - * }); - * - * - * @example Use on function calling callback in regular style - * someFunction(a => { - * console.log(a); // 5 - * }); - * var boundSomeFunction = Rx.Observable.bindNodeCallback(someFunction); - * boundSomeFunction() - * .subscribe( - * value => {} // never gets called - * err => console.log(err) // 5 - *); - * - * - * @see {@link bindCallback} - * @see {@link from} - * @see {@link fromPromise} - * - * @param {function} func Function with a Node.js-style callback as the last parameter. - * @param {function} [selector] A function which takes the arguments from the - * callback and maps those to a value to emit on the output Observable. - * @param {Scheduler} [scheduler] The scheduler on which to schedule the - * callbacks. - * @return {function(...params: *): Observable} A function which returns the - * Observable that delivers the same values the Node.js callback would - * deliver. - * @static true - * @name bindNodeCallback - * @owner Observable - */ - BoundNodeCallbackObservable.create = function (func, selector, scheduler) { - if (selector === void 0) { selector = undefined; } - return function () { - var args = []; - for (var _i = 0; _i < arguments.length; _i++) { - args[_i - 0] = arguments[_i]; - } - return new BoundNodeCallbackObservable(func, selector, args, this, scheduler); - }; - }; - BoundNodeCallbackObservable.prototype._subscribe = function (subscriber) { - var callbackFunc = this.callbackFunc; - var args = this.args; - var scheduler = this.scheduler; - var subject = this.subject; - if (!scheduler) { - if (!subject) { - subject = this.subject = new AsyncSubject_1.AsyncSubject(); - var handler = function handlerFn() { - var innerArgs = []; - for (var _i = 0; _i < arguments.length; _i++) { - innerArgs[_i - 0] = arguments[_i]; - } - var source = handlerFn.source; - var selector = source.selector, subject = source.subject; - var err = innerArgs.shift(); - if (err) { - subject.error(err); - } - else if (selector) { - var result_1 = tryCatch_1.tryCatch(selector).apply(this, innerArgs); - if (result_1 === errorObject_1.errorObject) { - subject.error(errorObject_1.errorObject.e); - } - else { - subject.next(result_1); - subject.complete(); - } - } - else { - subject.next(innerArgs.length <= 1 ? innerArgs[0] : innerArgs); - subject.complete(); - } - }; - // use named function instance to avoid closure. - handler.source = this; - var result = tryCatch_1.tryCatch(callbackFunc).apply(this.context, args.concat(handler)); - if (result === errorObject_1.errorObject) { - subject.error(errorObject_1.errorObject.e); - } - } - return subject.subscribe(subscriber); - } - else { - return scheduler.schedule(dispatch, 0, { source: this, subscriber: subscriber, context: this.context }); - } - }; - return BoundNodeCallbackObservable; -}(Observable_1.Observable)); -exports.BoundNodeCallbackObservable = BoundNodeCallbackObservable; -function dispatch(state) { - var self = this; - var source = state.source, subscriber = state.subscriber, context = state.context; - // XXX: cast to `any` to access to the private field in `source`. - var _a = source, callbackFunc = _a.callbackFunc, args = _a.args, scheduler = _a.scheduler; - var subject = source.subject; - if (!subject) { - subject = source.subject = new AsyncSubject_1.AsyncSubject(); - var handler = function handlerFn() { - var innerArgs = []; - for (var _i = 0; _i < arguments.length; _i++) { - innerArgs[_i - 0] = arguments[_i]; - } - var source = handlerFn.source; - var selector = source.selector, subject = source.subject; - var err = innerArgs.shift(); - if (err) { - self.add(scheduler.schedule(dispatchError, 0, { err: err, subject: subject })); - } - else if (selector) { - var result_2 = tryCatch_1.tryCatch(selector).apply(this, innerArgs); - if (result_2 === errorObject_1.errorObject) { - self.add(scheduler.schedule(dispatchError, 0, { err: errorObject_1.errorObject.e, subject: subject })); - } - else { - self.add(scheduler.schedule(dispatchNext, 0, { value: result_2, subject: subject })); - } - } - else { - var value = innerArgs.length <= 1 ? innerArgs[0] : innerArgs; - self.add(scheduler.schedule(dispatchNext, 0, { value: value, subject: subject })); - } - }; - // use named function to pass values in without closure - handler.source = source; - var result = tryCatch_1.tryCatch(callbackFunc).apply(context, args.concat(handler)); - if (result === errorObject_1.errorObject) { - self.add(scheduler.schedule(dispatchError, 0, { err: errorObject_1.errorObject.e, subject: subject })); - } - } - self.add(subject.subscribe(subscriber)); -} -function dispatchNext(arg) { - var value = arg.value, subject = arg.subject; - subject.next(value); - subject.complete(); -} -function dispatchError(arg) { - var err = arg.err, subject = arg.subject; - subject.error(err); -} -//# sourceMappingURL=BoundNodeCallbackObservable.js.map + +module.exports = WindowTimers; + /***/ }), -/* 248 */ +/* 81 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; +/* jshint node:true, latedef:false */ + // jshint ignore:line +/*! +Parser-Lib +Copyright (c) 2009-2011 Nicholas C. Zakas. All rights reserved. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. + +*/ +/* Version v0.2.5+domino1, Build time: 30-January-2016 05:13:03 */ +var parserlib = Object.create(null); +(function(){ -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; -var Observable_1 = __webpack_require__(0); -var subscribeToResult_1 = __webpack_require__(3); -var OuterSubscriber_1 = __webpack_require__(4); /** - * We need this JSDoc comment for affecting ESDoc. - * @extends {Ignored} - * @hide true + * A generic base to inherit from for any object + * that needs event handling. + * @class EventTarget + * @constructor */ -var DeferObservable = (function (_super) { - __extends(DeferObservable, _super); - function DeferObservable(observableFactory) { - _super.call(this); - this.observableFactory = observableFactory; - } +function EventTarget(){ + /** - * Creates an Observable that, on subscribe, calls an Observable factory to - * make an Observable for each new Observer. - * - * Creates the Observable lazily, that is, only when it - * is subscribed. - * - * - * - * - * `defer` allows you to create the Observable only when the Observer - * subscribes, and create a fresh Observable for each Observer. It waits until - * an Observer subscribes to it, and then it generates an Observable, - * typically with an Observable factory function. It does this afresh for each - * subscriber, so although each subscriber may think it is subscribing to the - * same Observable, in fact each subscriber gets its own individual - * Observable. - * - * @example Subscribe to either an Observable of clicks or an Observable of interval, at random - * var clicksOrInterval = Rx.Observable.defer(function () { - * if (Math.random() > 0.5) { - * return Rx.Observable.fromEvent(document, 'click'); - * } else { - * return Rx.Observable.interval(1000); - * } - * }); - * clicksOrInterval.subscribe(x => console.log(x)); - * - * // Results in the following behavior: - * // If the result of Math.random() is greater than 0.5 it will listen - * // for clicks anywhere on the "document"; when document is clicked it - * // will log a MouseEvent object to the console. If the result is less - * // than 0.5 it will emit ascending numbers, one every second(1000ms). - * - * @see {@link create} - * - * @param {function(): SubscribableOrPromise} observableFactory The Observable - * factory function to invoke for each Observer that subscribes to the output - * Observable. May also return a Promise, which will be converted on the fly - * to an Observable. - * @return {Observable} An Observable whose Observers' subscriptions trigger - * an invocation of the given Observable factory function. - * @static true - * @name defer - * @owner Observable + * The array of listeners for various events. + * @type Object + * @property _listeners + * @private */ - DeferObservable.create = function (observableFactory) { - return new DeferObservable(observableFactory); - }; - DeferObservable.prototype._subscribe = function (subscriber) { - return new DeferSubscriber(subscriber, this.observableFactory); - }; - return DeferObservable; -}(Observable_1.Observable)); -exports.DeferObservable = DeferObservable; -var DeferSubscriber = (function (_super) { - __extends(DeferSubscriber, _super); - function DeferSubscriber(destination, factory) { - _super.call(this, destination); - this.factory = factory; - this.tryDefer(); - } - DeferSubscriber.prototype.tryDefer = function () { - try { - this._callFactory(); + this._listeners = Object.create(null); +} + +EventTarget.prototype = { + + //restore constructor + constructor: EventTarget, + + /** + * Adds a listener for a given event type. + * @param {String} type The type of event to add a listener for. + * @param {Function} listener The function to call when the event occurs. + * @return {void} + * @method addListener + */ + addListener: function(type, listener){ + if (!this._listeners[type]){ + this._listeners[type] = []; + } + + this._listeners[type].push(listener); + }, + + /** + * Fires an event based on the passed-in object. + * @param {Object|String} event An object with at least a 'type' attribute + * or a string indicating the event name. + * @return {void} + * @method fire + */ + fire: function(event){ + if (typeof event === "string"){ + event = { type: event }; } - catch (err) { - this._error(err); + if (typeof event.target !== "undefined"){ + event.target = this; } - }; - DeferSubscriber.prototype._callFactory = function () { - var result = this.factory(); - if (result) { - this.add(subscribeToResult_1.subscribeToResult(this, result)); + + if (typeof event.type === "undefined"){ + throw new Error("Event object missing 'type' property."); } - }; - return DeferSubscriber; -}(OuterSubscriber_1.OuterSubscriber)); -//# sourceMappingURL=DeferObservable.js.map -/***/ }), -/* 249 */ -/***/ (function(module, exports, __webpack_require__) { + if (this._listeners[event.type]){ -"use strict"; + //create a copy of the array and use that so listeners can't chane + var listeners = this._listeners[event.type].concat(); + for (var i=0, len=listeners.length; i < len; i++){ + listeners[i].call(this, event); + } + } + }, -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + /** + * Removes a listener for a given event type. + * @param {String} type The type of event to remove a listener from. + * @param {Function} listener The function to remove from the event. + * @return {void} + * @method removeListener + */ + removeListener: function(type, listener){ + if (this._listeners[type]){ + var listeners = this._listeners[type]; + for (var i=0, len=listeners.length; i < len; i++){ + if (listeners[i] === listener){ + listeners.splice(i, 1); + break; + } + } + + + } + } }; -var Observable_1 = __webpack_require__(0); /** - * We need this JSDoc comment for affecting ESDoc. - * @extends {Ignored} - * @hide true + * Convenient way to read through strings. + * @namespace parserlib.util + * @class StringReader + * @constructor + * @param {String} text The text to read. */ -var ErrorObservable = (function (_super) { - __extends(ErrorObservable, _super); - function ErrorObservable(error, scheduler) { - _super.call(this); - this.error = error; - this.scheduler = scheduler; - } +function StringReader(text){ + /** - * Creates an Observable that emits no items to the Observer and immediately - * emits an error notification. - * - * Just emits 'error', and nothing else. - * - * - * - * - * This static operator is useful for creating a simple Observable that only - * emits the error notification. It can be used for composing with other - * Observables, such as in a {@link mergeMap}. - * - * @example Emit the number 7, then emit an error. - * var result = Rx.Observable.throw(new Error('oops!')).startWith(7); - * result.subscribe(x => console.log(x), e => console.error(e)); - * - * @example Map and flatten numbers to the sequence 'a', 'b', 'c', but throw an error for 13 - * var interval = Rx.Observable.interval(1000); - * var result = interval.mergeMap(x => - * x === 13 ? - * Rx.Observable.throw('Thirteens are bad') : - * Rx.Observable.of('a', 'b', 'c') - * ); - * result.subscribe(x => console.log(x), e => console.error(e)); - * - * @see {@link create} - * @see {@link empty} - * @see {@link never} - * @see {@link of} - * - * @param {any} error The particular Error to pass to the error notification. - * @param {Scheduler} [scheduler] A {@link IScheduler} to use for scheduling - * the emission of the error notification. - * @return {Observable} An error Observable: emits only the error notification - * using the given error argument. - * @static true - * @name throw - * @owner Observable + * The input text with line endings normalized. + * @property _input + * @type String + * @private */ - ErrorObservable.create = function (error, scheduler) { - return new ErrorObservable(error, scheduler); - }; - ErrorObservable.dispatch = function (arg) { - var error = arg.error, subscriber = arg.subscriber; - subscriber.error(error); - }; - ErrorObservable.prototype._subscribe = function (subscriber) { - var error = this.error; - var scheduler = this.scheduler; - subscriber.syncErrorThrowable = true; - if (scheduler) { - return scheduler.schedule(ErrorObservable.dispatch, 0, { - error: error, subscriber: subscriber - }); - } - else { - subscriber.error(error); - } - }; - return ErrorObservable; -}(Observable_1.Observable)); -exports.ErrorObservable = ErrorObservable; -//# sourceMappingURL=ErrorObservable.js.map + this._input = text.replace(/(\r|\n){1,2}/g, "\n"); -/***/ }), -/* 250 */ -/***/ (function(module, exports, __webpack_require__) { -"use strict"; + /** + * The row for the character to be read next. + * @property _line + * @type int + * @private + */ + this._line = 1; + + + /** + * The column for the character to be read next. + * @property _col + * @type int + * @private + */ + this._col = 1; + + /** + * The index of the character in the input to be read next. + * @property _cursor + * @type int + * @private + */ + this._cursor = 0; +} + +StringReader.prototype = { + + //restore constructor + constructor: StringReader, + + //------------------------------------------------------------------------- + // Position info + //------------------------------------------------------------------------- + + /** + * Returns the column of the character to be read next. + * @return {int} The column of the character to be read next. + * @method getCol + */ + getCol: function(){ + return this._col; + }, + + /** + * Returns the row of the character to be read next. + * @return {int} The row of the character to be read next. + * @method getLine + */ + getLine: function(){ + return this._line ; + }, + + /** + * Determines if you're at the end of the input. + * @return {Boolean} True if there's no more input, false otherwise. + * @method eof + */ + eof: function(){ + return (this._cursor === this._input.length); + }, + + //------------------------------------------------------------------------- + // Basic reading + //------------------------------------------------------------------------- -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; -var Observable_1 = __webpack_require__(0); -var tryCatch_1 = __webpack_require__(7); -var isFunction_1 = __webpack_require__(81); -var errorObject_1 = __webpack_require__(5); -var Subscription_1 = __webpack_require__(9); -var toString = Object.prototype.toString; -function isNodeStyleEventEmitter(sourceObj) { - return !!sourceObj && typeof sourceObj.addListener === 'function' && typeof sourceObj.removeListener === 'function'; -} -function isJQueryStyleEventEmitter(sourceObj) { - return !!sourceObj && typeof sourceObj.on === 'function' && typeof sourceObj.off === 'function'; -} -function isNodeList(sourceObj) { - return !!sourceObj && toString.call(sourceObj) === '[object NodeList]'; -} -function isHTMLCollection(sourceObj) { - return !!sourceObj && toString.call(sourceObj) === '[object HTMLCollection]'; -} -function isEventTarget(sourceObj) { - return !!sourceObj && typeof sourceObj.addEventListener === 'function' && typeof sourceObj.removeEventListener === 'function'; -} -/** - * We need this JSDoc comment for affecting ESDoc. - * @extends {Ignored} - * @hide true - */ -var FromEventObservable = (function (_super) { - __extends(FromEventObservable, _super); - function FromEventObservable(sourceObj, eventName, selector, options) { - _super.call(this); - this.sourceObj = sourceObj; - this.eventName = eventName; - this.selector = selector; - this.options = options; - } - /* tslint:enable:max-line-length */ /** - * Creates an Observable that emits events of a specific type coming from the - * given event target. - * - * Creates an Observable from DOM events, or Node - * EventEmitter events or others. - * - * - * - * Creates an Observable by attaching an event listener to an "event target", - * which may be an object with `addEventListener` and `removeEventListener`, - * a Node.js EventEmitter, a jQuery style EventEmitter, a NodeList from the - * DOM, or an HTMLCollection from the DOM. The event handler is attached when - * the output Observable is subscribed, and removed when the Subscription is - * unsubscribed. - * - * @example Emits clicks happening on the DOM document - * var clicks = Rx.Observable.fromEvent(document, 'click'); - * clicks.subscribe(x => console.log(x)); - * - * // Results in: - * // MouseEvent object logged to console everytime a click - * // occurs on the document. - * - * @see {@link from} - * @see {@link fromEventPattern} - * - * @param {EventTargetLike} target The DOMElement, event target, Node.js - * EventEmitter, NodeList or HTMLCollection to attach the event handler to. - * @param {string} eventName The event name of interest, being emitted by the - * `target`. - * @param {EventListenerOptions} [options] Options to pass through to addEventListener - * @param {SelectorMethodSignature} [selector] An optional function to - * post-process results. It takes the arguments from the event handler and - * should return a single value. - * @return {Observable} - * @static true - * @name fromEvent - * @owner Observable + * Reads the next character without advancing the cursor. + * @param {int} count How many characters to look ahead (default is 1). + * @return {String} The next character or null if there is no next character. + * @method peek */ - FromEventObservable.create = function (target, eventName, options, selector) { - if (isFunction_1.isFunction(options)) { - selector = options; - options = undefined; + peek: function(count){ + var c = null; + count = (typeof count === "undefined" ? 1 : count); + + //if we're not at the end of the input... + if (this._cursor < this._input.length){ + + //get character and increment cursor and column + c = this._input.charAt(this._cursor + count - 1); } - return new FromEventObservable(target, eventName, selector, options); - }; - FromEventObservable.setupSubscription = function (sourceObj, eventName, handler, subscriber, options) { - var unsubscribe; - if (isNodeList(sourceObj) || isHTMLCollection(sourceObj)) { - for (var i = 0, len = sourceObj.length; i < len; i++) { - FromEventObservable.setupSubscription(sourceObj[i], eventName, handler, subscriber, options); + + return c; + }, + + /** + * Reads the next character from the input and adjusts the row and column + * accordingly. + * @return {String} The next character or null if there is no next character. + * @method read + */ + read: function(){ + var c = null; + + //if we're not at the end of the input... + if (this._cursor < this._input.length){ + + //if the last character was a newline, increment row count + //and reset column count + if (this._input.charAt(this._cursor) === "\n"){ + this._line++; + this._col=1; + } else { + this._col++; } + + //get character and increment cursor and column + c = this._input.charAt(this._cursor++); } - else if (isEventTarget(sourceObj)) { - var source_1 = sourceObj; - sourceObj.addEventListener(eventName, handler, options); - unsubscribe = function () { return source_1.removeEventListener(eventName, handler); }; + + return c; + }, + + //------------------------------------------------------------------------- + // Misc + //------------------------------------------------------------------------- + + /** + * Saves the current location so it can be returned to later. + * @method mark + * @return {void} + */ + mark: function(){ + this._bookmark = { + cursor: this._cursor, + line: this._line, + col: this._col + }; + }, + + reset: function(){ + if (this._bookmark){ + this._cursor = this._bookmark.cursor; + this._line = this._bookmark.line; + this._col = this._bookmark.col; + delete this._bookmark; } - else if (isJQueryStyleEventEmitter(sourceObj)) { - var source_2 = sourceObj; - sourceObj.on(eventName, handler); - unsubscribe = function () { return source_2.off(eventName, handler); }; + }, + + //------------------------------------------------------------------------- + // Advanced reading + //------------------------------------------------------------------------- + + /** + * Reads up to and including the given string. Throws an error if that + * string is not found. + * @param {String} pattern The string to read. + * @return {String} The string when it is found. + * @throws Error when the string pattern is not found. + * @method readTo + */ + readTo: function(pattern){ + + var buffer = "", + c; + + /* + * First, buffer must be the same length as the pattern. + * Then, buffer must end with the pattern or else reach the + * end of the input. + */ + while (buffer.length < pattern.length || buffer.lastIndexOf(pattern) !== buffer.length - pattern.length){ + c = this.read(); + if (c){ + buffer += c; + } else { + throw new Error("Expected \"" + pattern + "\" at line " + this._line + ", col " + this._col + "."); + } } - else if (isNodeStyleEventEmitter(sourceObj)) { - var source_3 = sourceObj; - sourceObj.addListener(eventName, handler); - unsubscribe = function () { return source_3.removeListener(eventName, handler); }; + + return buffer; + + }, + + /** + * Reads characters while each character causes the given + * filter function to return true. The function is passed + * in each character and either returns true to continue + * reading or false to stop. + * @param {Function} filter The function to read on each character. + * @return {String} The string made up of all characters that passed the + * filter check. + * @method readWhile + */ + readWhile: function(filter){ + + var buffer = "", + c = this.read(); + + while(c !== null && filter(c)){ + buffer += c; + c = this.read(); } - else { - throw new TypeError('Invalid event target'); - } - subscriber.add(new Subscription_1.Subscription(unsubscribe)); - }; - FromEventObservable.prototype._subscribe = function (subscriber) { - var sourceObj = this.sourceObj; - var eventName = this.eventName; - var options = this.options; - var selector = this.selector; - var handler = selector ? function () { - var args = []; - for (var _i = 0; _i < arguments.length; _i++) { - args[_i - 0] = arguments[_i]; - } - var result = tryCatch_1.tryCatch(selector).apply(void 0, args); - if (result === errorObject_1.errorObject) { - subscriber.error(errorObject_1.errorObject.e); + + return buffer; + + }, + + /** + * Reads characters that match either text or a regular expression and + * returns those characters. If a match is found, the row and column + * are adjusted; if no match is found, the reader's state is unchanged. + * reading or false to stop. + * @param {String|RegExp} matchter If a string, then the literal string + * value is searched for. If a regular expression, then any string + * matching the pattern is search for. + * @return {String} The string made up of all characters that matched or + * null if there was no match. + * @method readMatch + */ + readMatch: function(matcher){ + + var source = this._input.substring(this._cursor), + value = null; + + //if it's a string, just do a straight match + if (typeof matcher === "string"){ + if (source.indexOf(matcher) === 0){ + value = this.readCount(matcher.length); } - else { - subscriber.next(result); + } else if (matcher instanceof RegExp){ + if (matcher.test(source)){ + value = this.readCount(RegExp.lastMatch.length); } - } : function (e) { return subscriber.next(e); }; - FromEventObservable.setupSubscription(sourceObj, eventName, handler, subscriber, options); - }; - return FromEventObservable; -}(Observable_1.Observable)); -exports.FromEventObservable = FromEventObservable; -//# sourceMappingURL=FromEventObservable.js.map + } -/***/ }), -/* 251 */ -/***/ (function(module, exports, __webpack_require__) { + return value; + }, -"use strict"; -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + /** + * Reads a given number of characters. If the end of the input is reached, + * it reads only the remaining characters and does not throw an error. + * @param {int} count The number of characters to read. + * @return {String} The string made up the read characters. + * @method readCount + */ + readCount: function(count){ + var buffer = ""; + + while(count--){ + buffer += this.read(); + } + + return buffer; + } + }; -var isFunction_1 = __webpack_require__(81); -var Observable_1 = __webpack_require__(0); -var Subscription_1 = __webpack_require__(9); /** - * We need this JSDoc comment for affecting ESDoc. - * @extends {Ignored} - * @hide true + * Type to use when a syntax error occurs. + * @class SyntaxError + * @namespace parserlib.util + * @constructor + * @param {String} message The error message. + * @param {int} line The line at which the error occurred. + * @param {int} col The column at which the error occurred. */ -var FromEventPatternObservable = (function (_super) { - __extends(FromEventPatternObservable, _super); - function FromEventPatternObservable(addHandler, removeHandler, selector) { - _super.call(this); - this.addHandler = addHandler; - this.removeHandler = removeHandler; - this.selector = selector; - } +function SyntaxError(message, line, col){ + Error.call(this); + this.name = this.constructor.name; + /** - * Creates an Observable from an API based on addHandler/removeHandler - * functions. - * - * Converts any addHandler/removeHandler API to an - * Observable. - * - * - * - * Creates an Observable by using the `addHandler` and `removeHandler` - * functions to add and remove the handlers, with an optional selector - * function to project the event arguments to a result. The `addHandler` is - * called when the output Observable is subscribed, and `removeHandler` is - * called when the Subscription is unsubscribed. - * - * @example Emits clicks happening on the DOM document - * function addClickHandler(handler) { - * document.addEventListener('click', handler); - * } - * - * function removeClickHandler(handler) { - * document.removeEventListener('click', handler); - * } - * - * var clicks = Rx.Observable.fromEventPattern( - * addClickHandler, - * removeClickHandler - * ); - * clicks.subscribe(x => console.log(x)); - * - * @see {@link from} - * @see {@link fromEvent} - * - * @param {function(handler: Function): any} addHandler A function that takes - * a `handler` function as argument and attaches it somehow to the actual - * source of events. - * @param {function(handler: Function, signal?: any): void} [removeHandler] An optional function that - * takes a `handler` function as argument and removes it in case it was - * previously attached using `addHandler`. if addHandler returns signal to teardown when remove, - * removeHandler function will forward it. - * @param {function(...args: any): T} [selector] An optional function to - * post-process results. It takes the arguments from the event handler and - * should return a single value. - * @return {Observable} - * @static true - * @name fromEventPattern - * @owner Observable + * The column at which the error occurred. + * @type int + * @property col */ - FromEventPatternObservable.create = function (addHandler, removeHandler, selector) { - return new FromEventPatternObservable(addHandler, removeHandler, selector); - }; - FromEventPatternObservable.prototype._subscribe = function (subscriber) { - var _this = this; - var removeHandler = this.removeHandler; - var handler = !!this.selector ? function () { - var args = []; - for (var _i = 0; _i < arguments.length; _i++) { - args[_i - 0] = arguments[_i]; - } - _this._callSelector(subscriber, args); - } : function (e) { subscriber.next(e); }; - var retValue = this._callAddHandler(handler, subscriber); - if (!isFunction_1.isFunction(removeHandler)) { - return; - } - subscriber.add(new Subscription_1.Subscription(function () { - //TODO: determine whether or not to forward to error handler - removeHandler(handler, retValue); - })); - }; - FromEventPatternObservable.prototype._callSelector = function (subscriber, args) { - try { - var result = this.selector.apply(this, args); - subscriber.next(result); - } - catch (e) { - subscriber.error(e); - } - }; - FromEventPatternObservable.prototype._callAddHandler = function (handler, errorSubscriber) { - try { - return this.addHandler(handler) || null; - } - catch (e) { - errorSubscriber.error(e); - } - }; - return FromEventPatternObservable; -}(Observable_1.Observable)); -exports.FromEventPatternObservable = FromEventPatternObservable; -//# sourceMappingURL=FromEventPatternObservable.js.map + this.col = col; -/***/ }), -/* 252 */ -/***/ (function(module, exports, __webpack_require__) { + /** + * The line at which the error occurred. + * @type int + * @property line + */ + this.line = line; -"use strict"; + /** + * The text representation of the unit. + * @type String + * @property text + */ + this.message = message; -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; -var Observable_1 = __webpack_require__(0); -var isScheduler_1 = __webpack_require__(13); -var selfSelector = function (value) { return value; }; +} + +//inherit from Error +SyntaxError.prototype = Object.create(Error.prototype); // jshint ignore:line +SyntaxError.prototype.constructor = SyntaxError; // jshint ignore:line /** - * We need this JSDoc comment for affecting ESDoc. - * @extends {Ignored} - * @hide true + * Base type to represent a single syntactic unit. + * @class SyntaxUnit + * @namespace parserlib.util + * @constructor + * @param {String} text The text of the unit. + * @param {int} line The line of text on which the unit resides. + * @param {int} col The column of text on which the unit resides. */ -var GenerateObservable = (function (_super) { - __extends(GenerateObservable, _super); - function GenerateObservable(initialState, condition, iterate, resultSelector, scheduler) { - _super.call(this); - this.initialState = initialState; - this.condition = condition; - this.iterate = iterate; - this.resultSelector = resultSelector; - this.scheduler = scheduler; - } - GenerateObservable.create = function (initialStateOrOptions, condition, iterate, resultSelectorOrObservable, scheduler) { - if (arguments.length == 1) { - return new GenerateObservable(initialStateOrOptions.initialState, initialStateOrOptions.condition, initialStateOrOptions.iterate, initialStateOrOptions.resultSelector || selfSelector, initialStateOrOptions.scheduler); - } - if (resultSelectorOrObservable === undefined || isScheduler_1.isScheduler(resultSelectorOrObservable)) { - return new GenerateObservable(initialStateOrOptions, condition, iterate, selfSelector, resultSelectorOrObservable); - } - return new GenerateObservable(initialStateOrOptions, condition, iterate, resultSelectorOrObservable, scheduler); - }; - GenerateObservable.prototype._subscribe = function (subscriber) { - var state = this.initialState; - if (this.scheduler) { - return this.scheduler.schedule(GenerateObservable.dispatch, 0, { - subscriber: subscriber, - iterate: this.iterate, - condition: this.condition, - resultSelector: this.resultSelector, - state: state }); - } - var _a = this, condition = _a.condition, resultSelector = _a.resultSelector, iterate = _a.iterate; - do { - if (condition) { - var conditionResult = void 0; - try { - conditionResult = condition(state); - } - catch (err) { - subscriber.error(err); - return; - } - if (!conditionResult) { - subscriber.complete(); - break; - } - } - var value = void 0; - try { - value = resultSelector(state); - } - catch (err) { - subscriber.error(err); - return; - } - subscriber.next(value); - if (subscriber.closed) { - break; - } - try { - state = iterate(state); - } - catch (err) { - subscriber.error(err); - return; - } - } while (true); - }; - GenerateObservable.dispatch = function (state) { - var subscriber = state.subscriber, condition = state.condition; - if (subscriber.closed) { - return; - } - if (state.needIterate) { - try { - state.state = state.iterate(state.state); - } - catch (err) { - subscriber.error(err); - return; - } - } - else { - state.needIterate = true; - } - if (condition) { - var conditionResult = void 0; - try { - conditionResult = condition(state.state); - } - catch (err) { - subscriber.error(err); - return; - } - if (!conditionResult) { - subscriber.complete(); - return; - } - if (subscriber.closed) { - return; - } - } - var value; - try { - value = state.resultSelector(state.state); - } - catch (err) { - subscriber.error(err); - return; - } - if (subscriber.closed) { - return; - } - subscriber.next(value); - if (subscriber.closed) { - return; - } - return this.schedule(state); - }; - return GenerateObservable; -}(Observable_1.Observable)); -exports.GenerateObservable = GenerateObservable; -//# sourceMappingURL=GenerateObservable.js.map +function SyntaxUnit(text, line, col, type){ -/***/ }), -/* 253 */ -/***/ (function(module, exports, __webpack_require__) { -"use strict"; + /** + * The column of text on which the unit resides. + * @type int + * @property col + */ + this.col = col; + + /** + * The line of text on which the unit resides. + * @type int + * @property line + */ + this.line = line; + + /** + * The text representation of the unit. + * @type String + * @property text + */ + this.text = text; + + /** + * The type of syntax unit. + * @type int + * @property type + */ + this.type = type; +} + +/** + * Create a new syntax unit based solely on the given token. + * Convenience method for creating a new syntax unit when + * it represents a single token instead of multiple. + * @param {Object} token The token object to represent. + * @return {parserlib.util.SyntaxUnit} The object representing the token. + * @static + * @method fromToken + */ +SyntaxUnit.fromToken = function(token){ + return new SyntaxUnit(token.value, token.startLine, token.startCol); +}; + +SyntaxUnit.prototype = { + + //restore constructor + constructor: SyntaxUnit, + + /** + * Returns the text representation of the unit. + * @return {String} The text representation of the unit. + * @method valueOf + */ + valueOf: function(){ + return this.toString(); + }, + + /** + * Returns the text representation of the unit. + * @return {String} The text representation of the unit. + * @method toString + */ + toString: function(){ + return this.text; + } -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; -var Observable_1 = __webpack_require__(0); -var subscribeToResult_1 = __webpack_require__(3); -var OuterSubscriber_1 = __webpack_require__(4); + +/** + * Generic TokenStream providing base functionality. + * @class TokenStreamBase + * @namespace parserlib.util + * @constructor + * @param {String|StringReader} input The text to tokenize or a reader from + * which to read the input. + */ +function TokenStreamBase(input, tokenData){ + + /** + * The string reader for easy access to the text. + * @type StringReader + * @property _reader + * @private + */ + this._reader = input ? new StringReader(input.toString()) : null; + + /** + * Token object for the last consumed token. + * @type Token + * @property _token + * @private + */ + this._token = null; + + /** + * The array of token information. + * @type Array + * @property _tokenData + * @private + */ + this._tokenData = tokenData; + + /** + * Lookahead token buffer. + * @type Array + * @property _lt + * @private + */ + this._lt = []; + + /** + * Lookahead token buffer index. + * @type int + * @property _ltIndex + * @private + */ + this._ltIndex = 0; + + this._ltIndexCache = []; +} + /** - * We need this JSDoc comment for affecting ESDoc. - * @extends {Ignored} - * @hide true + * Accepts an array of token information and outputs + * an array of token data containing key-value mappings + * and matching functions that the TokenStream needs. + * @param {Array} tokens An array of token descriptors. + * @return {Array} An array of processed token data. + * @method createTokenData + * @static */ -var IfObservable = (function (_super) { - __extends(IfObservable, _super); - function IfObservable(condition, thenSource, elseSource) { - _super.call(this); - this.condition = condition; - this.thenSource = thenSource; - this.elseSource = elseSource; +TokenStreamBase.createTokenData = function(tokens){ + + var nameMap = [], + typeMap = Object.create(null), + tokenData = tokens.concat([]), + i = 0, + len = tokenData.length+1; + + tokenData.UNKNOWN = -1; + tokenData.unshift({name:"EOF"}); + + for (; i < len; i++){ + nameMap.push(tokenData[i].name); + tokenData[tokenData[i].name] = i; + if (tokenData[i].text){ + typeMap[tokenData[i].text] = i; + } } - IfObservable.create = function (condition, thenSource, elseSource) { - return new IfObservable(condition, thenSource, elseSource); - }; - IfObservable.prototype._subscribe = function (subscriber) { - var _a = this, condition = _a.condition, thenSource = _a.thenSource, elseSource = _a.elseSource; - return new IfSubscriber(subscriber, condition, thenSource, elseSource); + + tokenData.name = function(tt){ + return nameMap[tt]; }; - return IfObservable; -}(Observable_1.Observable)); -exports.IfObservable = IfObservable; -var IfSubscriber = (function (_super) { - __extends(IfSubscriber, _super); - function IfSubscriber(destination, condition, thenSource, elseSource) { - _super.call(this, destination); - this.condition = condition; - this.thenSource = thenSource; - this.elseSource = elseSource; - this.tryIf(); - } - IfSubscriber.prototype.tryIf = function () { - var _a = this, condition = _a.condition, thenSource = _a.thenSource, elseSource = _a.elseSource; - var result; - try { - result = condition(); - var source = result ? thenSource : elseSource; - if (source) { - this.add(subscribeToResult_1.subscribeToResult(this, source)); - } - else { - this._complete(); - } - } - catch (err) { - this._error(err); - } + + tokenData.type = function(c){ + return typeMap[c]; }; - return IfSubscriber; -}(OuterSubscriber_1.OuterSubscriber)); -//# sourceMappingURL=IfObservable.js.map -/***/ }), -/* 254 */ -/***/ (function(module, exports, __webpack_require__) { + return tokenData; +}; -"use strict"; +TokenStreamBase.prototype = { -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; -var isNumeric_1 = __webpack_require__(28); -var Observable_1 = __webpack_require__(0); -var async_1 = __webpack_require__(8); -/** - * We need this JSDoc comment for affecting ESDoc. - * @extends {Ignored} - * @hide true - */ -var IntervalObservable = (function (_super) { - __extends(IntervalObservable, _super); - function IntervalObservable(period, scheduler) { - if (period === void 0) { period = 0; } - if (scheduler === void 0) { scheduler = async_1.async; } - _super.call(this); - this.period = period; - this.scheduler = scheduler; - if (!isNumeric_1.isNumeric(period) || period < 0) { - this.period = 0; + //restore constructor + constructor: TokenStreamBase, + + //------------------------------------------------------------------------- + // Matching methods + //------------------------------------------------------------------------- + + /** + * Determines if the next token matches the given token type. + * If so, that token is consumed; if not, the token is placed + * back onto the token stream. You can pass in any number of + * token types and this will return true if any of the token + * types is found. + * @param {int|int[]} tokenTypes Either a single token type or an array of + * token types that the next token might be. If an array is passed, + * it's assumed that the token can be any of these. + * @param {variant} channel (Optional) The channel to read from. If not + * provided, reads from the default (unnamed) channel. + * @return {Boolean} True if the token type matches, false if not. + * @method match + */ + match: function(tokenTypes, channel){ + + //always convert to an array, makes things easier + if (!(tokenTypes instanceof Array)){ + tokenTypes = [tokenTypes]; } - if (!scheduler || typeof scheduler.schedule !== 'function') { - this.scheduler = async_1.async; + + var tt = this.get(channel), + i = 0, + len = tokenTypes.length; + + while(i < len){ + if (tt === tokenTypes[i++]){ + return true; + } } - } + + //no match found, put the token back + this.unget(); + return false; + }, + /** - * Creates an Observable that emits sequential numbers every specified - * interval of time, on a specified IScheduler. - * - * Emits incremental numbers periodically in time. - * - * - * - * - * `interval` returns an Observable that emits an infinite sequence of - * ascending integers, with a constant interval of time of your choosing - * between those emissions. The first emission is not sent immediately, but - * only after the first period has passed. By default, this operator uses the - * `async` IScheduler to provide a notion of time, but you may pass any - * IScheduler to it. - * - * @example Emits ascending numbers, one every second (1000ms) - * var numbers = Rx.Observable.interval(1000); - * numbers.subscribe(x => console.log(x)); - * - * @see {@link timer} - * @see {@link delay} - * - * @param {number} [period=0] The interval size in milliseconds (by default) - * or the time unit determined by the scheduler's clock. - * @param {Scheduler} [scheduler=async] The IScheduler to use for scheduling - * the emission of values, and providing a notion of "time". - * @return {Observable} An Observable that emits a sequential number each time - * interval. - * @static true - * @name interval - * @owner Observable + * Determines if the next token matches the given token type. + * If so, that token is consumed; if not, an error is thrown. + * @param {int|int[]} tokenTypes Either a single token type or an array of + * token types that the next token should be. If an array is passed, + * it's assumed that the token must be one of these. + * @param {variant} channel (Optional) The channel to read from. If not + * provided, reads from the default (unnamed) channel. + * @return {void} + * @method mustMatch */ - IntervalObservable.create = function (period, scheduler) { - if (period === void 0) { period = 0; } - if (scheduler === void 0) { scheduler = async_1.async; } - return new IntervalObservable(period, scheduler); - }; - IntervalObservable.dispatch = function (state) { - var index = state.index, subscriber = state.subscriber, period = state.period; - subscriber.next(index); - if (subscriber.closed) { - return; + mustMatch: function(tokenTypes, channel){ + + var token; + + //always convert to an array, makes things easier + if (!(tokenTypes instanceof Array)){ + tokenTypes = [tokenTypes]; } - state.index += 1; - this.schedule(state, period); - }; - IntervalObservable.prototype._subscribe = function (subscriber) { - var index = 0; - var period = this.period; - var scheduler = this.scheduler; - subscriber.add(scheduler.schedule(IntervalObservable.dispatch, period, { - index: index, subscriber: subscriber, period: period - })); - }; - return IntervalObservable; -}(Observable_1.Observable)); -exports.IntervalObservable = IntervalObservable; -//# sourceMappingURL=IntervalObservable.js.map -/***/ }), -/* 255 */ -/***/ (function(module, exports, __webpack_require__) { + if (!this.match.apply(this, arguments)){ + token = this.LT(1); + throw new SyntaxError("Expected " + this._tokenData[tokenTypes[0]].name + + " at line " + token.startLine + ", col " + token.startCol + ".", token.startLine, token.startCol); + } + }, -"use strict"; + //------------------------------------------------------------------------- + // Consuming methods + //------------------------------------------------------------------------- -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; -var Observable_1 = __webpack_require__(0); -var noop_1 = __webpack_require__(76); -/** - * We need this JSDoc comment for affecting ESDoc. - * @extends {Ignored} - * @hide true - */ -var NeverObservable = (function (_super) { - __extends(NeverObservable, _super); - function NeverObservable() { - _super.call(this); - } /** - * Creates an Observable that emits no items to the Observer. - * - * An Observable that never emits anything. - * - * - * - * This static operator is useful for creating a simple Observable that emits - * neither values nor errors nor the completion notification. It can be used - * for testing purposes or for composing with other Observables. Please note - * that by never emitting a complete notification, this Observable keeps the - * subscription from being disposed automatically. Subscriptions need to be - * manually disposed. - * - * @example Emit the number 7, then never emit anything else (not even complete). - * function info() { - * console.log('Will not be called'); - * } - * var result = Rx.Observable.never().startWith(7); - * result.subscribe(x => console.log(x), info, info); - * - * @see {@link create} - * @see {@link empty} - * @see {@link of} - * @see {@link throw} - * - * @return {Observable} A "never" Observable: never emits anything. - * @static true - * @name never - * @owner Observable + * Keeps reading from the token stream until either one of the specified + * token types is found or until the end of the input is reached. + * @param {int|int[]} tokenTypes Either a single token type or an array of + * token types that the next token should be. If an array is passed, + * it's assumed that the token must be one of these. + * @param {variant} channel (Optional) The channel to read from. If not + * provided, reads from the default (unnamed) channel. + * @return {void} + * @method advance */ - NeverObservable.create = function () { - return new NeverObservable(); - }; - NeverObservable.prototype._subscribe = function (subscriber) { - noop_1.noop(); - }; - return NeverObservable; -}(Observable_1.Observable)); -exports.NeverObservable = NeverObservable; -//# sourceMappingURL=NeverObservable.js.map + advance: function(tokenTypes, channel){ -/***/ }), -/* 256 */ -/***/ (function(module, exports, __webpack_require__) { + while(this.LA(0) !== 0 && !this.match(tokenTypes, channel)){ + this.get(); + } -"use strict"; + return this.LA(0); + }, -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; -var Observable_1 = __webpack_require__(0); -function dispatch(state) { - var obj = state.obj, keys = state.keys, length = state.length, index = state.index, subscriber = state.subscriber; - if (index === length) { - subscriber.complete(); - return; - } - var key = keys[index]; - subscriber.next([key, obj[key]]); - state.index = index + 1; - this.schedule(state); -} -/** - * We need this JSDoc comment for affecting ESDoc. - * @extends {Ignored} - * @hide true - */ -var PairsObservable = (function (_super) { - __extends(PairsObservable, _super); - function PairsObservable(obj, scheduler) { - _super.call(this); - this.obj = obj; - this.scheduler = scheduler; - this.keys = Object.keys(obj); - } /** - * Convert an object into an observable sequence of [key, value] pairs - * using an optional IScheduler to enumerate the object. - * - * @example Converts a javascript object to an Observable - * var obj = { - * foo: 42, - * bar: 56, - * baz: 78 - * }; - * - * var source = Rx.Observable.pairs(obj); - * - * var subscription = source.subscribe( - * function (x) { - * console.log('Next: %s', x); - * }, - * function (err) { - * console.log('Error: %s', err); - * }, - * function () { - * console.log('Completed'); - * }); - * - * @param {Object} obj The object to inspect and turn into an - * Observable sequence. - * @param {Scheduler} [scheduler] An optional IScheduler to run the - * enumeration of the input sequence on. - * @returns {(Observable>)} An observable sequence of - * [key, value] pairs from the object. - */ - PairsObservable.create = function (obj, scheduler) { - return new PairsObservable(obj, scheduler); - }; - PairsObservable.prototype._subscribe = function (subscriber) { - var _a = this, keys = _a.keys, scheduler = _a.scheduler; - var length = keys.length; - if (scheduler) { - return scheduler.schedule(dispatch, 0, { - obj: this.obj, keys: keys, length: length, index: 0, subscriber: subscriber - }); + * Consumes the next token from the token stream. + * @return {int} The token type of the token that was just consumed. + * @method get + */ + get: function(channel){ + + var tokenInfo = this._tokenData, + i =0, + token, + info; + + //check the lookahead buffer first + if (this._lt.length && this._ltIndex >= 0 && this._ltIndex < this._lt.length){ + + i++; + this._token = this._lt[this._ltIndex++]; + info = tokenInfo[this._token.type]; + + //obey channels logic + while((info.channel !== undefined && channel !== info.channel) && + this._ltIndex < this._lt.length){ + this._token = this._lt[this._ltIndex++]; + info = tokenInfo[this._token.type]; + i++; + } + + //here be dragons + if ((info.channel === undefined || channel === info.channel) && + this._ltIndex <= this._lt.length){ + this._ltIndexCache.push(i); + return this._token.type; + } } - else { - for (var idx = 0; idx < length; idx++) { - var key = keys[idx]; - subscriber.next([key, this.obj[key]]); + + //call token retriever method + token = this._getToken(); + + //if it should be hidden, don't save a token + if (token.type > -1 && !tokenInfo[token.type].hide){ + + //apply token channel + token.channel = tokenInfo[token.type].channel; + + //save for later + this._token = token; + this._lt.push(token); + + //save space that will be moved (must be done before array is truncated) + this._ltIndexCache.push(this._lt.length - this._ltIndex + i); + + //keep the buffer under 5 items + if (this._lt.length > 5){ + this._lt.shift(); } - subscriber.complete(); + + //also keep the shift buffer under 5 items + if (this._ltIndexCache.length > 5){ + this._ltIndexCache.shift(); + } + + //update lookahead index + this._ltIndex = this._lt.length; } - }; - return PairsObservable; -}(Observable_1.Observable)); -exports.PairsObservable = PairsObservable; -//# sourceMappingURL=PairsObservable.js.map -/***/ }), -/* 257 */ -/***/ (function(module, exports, __webpack_require__) { + /* + * Skip to the next token if: + * 1. The token type is marked as hidden. + * 2. The token type has a channel specified and it isn't the current channel. + */ + info = tokenInfo[token.type]; + if (info && + (info.hide || + (info.channel !== undefined && channel !== info.channel))){ + return this.get(channel); + } else { + //return just the type + return token.type; + } + }, -"use strict"; + /** + * Looks ahead a certain number of tokens and returns the token type at + * that position. This will throw an error if you lookahead past the + * end of input, past the size of the lookahead buffer, or back past + * the first token in the lookahead buffer. + * @param {int} The index of the token type to retrieve. 0 for the + * current token, 1 for the next, -1 for the previous, etc. + * @return {int} The token type of the token in the given position. + * @method LA + */ + LA: function(index){ + var total = index, + tt; + if (index > 0){ + //TODO: Store 5 somewhere + if (index > 5){ + throw new Error("Too much lookahead."); + } + + //get all those tokens + while(total){ + tt = this.get(); + total--; + } + + //unget all those tokens + while(total < index){ + this.unget(); + total++; + } + } else if (index < 0){ + + if(this._lt[this._ltIndex+index]){ + tt = this._lt[this._ltIndex+index].type; + } else { + throw new Error("Too much lookbehind."); + } + + } else { + tt = this._token.type; + } + + return tt; + + }, -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; -var Observable_1 = __webpack_require__(0); -/** - * We need this JSDoc comment for affecting ESDoc. - * @extends {Ignored} - * @hide true - */ -var RangeObservable = (function (_super) { - __extends(RangeObservable, _super); - function RangeObservable(start, count, scheduler) { - _super.call(this); - this.start = start; - this._count = count; - this.scheduler = scheduler; - } /** - * Creates an Observable that emits a sequence of numbers within a specified - * range. - * - * Emits a sequence of numbers in a range. - * - * - * - * `range` operator emits a range of sequential integers, in order, where you - * select the `start` of the range and its `length`. By default, uses no - * IScheduler and just delivers the notifications synchronously, but may use - * an optional IScheduler to regulate those deliveries. - * - * @example Emits the numbers 1 to 10 - * var numbers = Rx.Observable.range(1, 10); - * numbers.subscribe(x => console.log(x)); - * - * @see {@link timer} - * @see {@link interval} - * - * @param {number} [start=0] The value of the first integer in the sequence. - * @param {number} [count=0] The number of sequential integers to generate. - * @param {Scheduler} [scheduler] A {@link IScheduler} to use for scheduling - * the emissions of the notifications. - * @return {Observable} An Observable of numbers that emits a finite range of - * sequential integers. - * @static true - * @name range - * @owner Observable + * Looks ahead a certain number of tokens and returns the token at + * that position. This will throw an error if you lookahead past the + * end of input, past the size of the lookahead buffer, or back past + * the first token in the lookahead buffer. + * @param {int} The index of the token type to retrieve. 0 for the + * current token, 1 for the next, -1 for the previous, etc. + * @return {Object} The token of the token in the given position. + * @method LA + */ + LT: function(index){ + + //lookahead first to prime the token buffer + this.LA(index); + + //now find the token, subtract one because _ltIndex is already at the next index + return this._lt[this._ltIndex+index-1]; + }, + + /** + * Returns the token type for the next token in the stream without + * consuming it. + * @return {int} The token type of the next token in the stream. + * @method peek + */ + peek: function(){ + return this.LA(1); + }, + + /** + * Returns the actual token object for the last consumed token. + * @return {Token} The token object for the last consumed token. + * @method token */ - RangeObservable.create = function (start, count, scheduler) { - if (start === void 0) { start = 0; } - if (count === void 0) { count = 0; } - return new RangeObservable(start, count, scheduler); - }; - RangeObservable.dispatch = function (state) { - var start = state.start, index = state.index, count = state.count, subscriber = state.subscriber; - if (index >= count) { - subscriber.complete(); - return; - } - subscriber.next(start); - if (subscriber.closed) { - return; - } - state.index = index + 1; - state.start = start + 1; - this.schedule(state); - }; - RangeObservable.prototype._subscribe = function (subscriber) { - var index = 0; - var start = this.start; - var count = this._count; - var scheduler = this.scheduler; - if (scheduler) { - return scheduler.schedule(RangeObservable.dispatch, 0, { - index: index, count: count, start: start, subscriber: subscriber - }); + token: function(){ + return this._token; + }, + + /** + * Returns the name of the token for the given token type. + * @param {int} tokenType The type of token to get the name of. + * @return {String} The name of the token or "UNKNOWN_TOKEN" for any + * invalid token type. + * @method tokenName + */ + tokenName: function(tokenType){ + if (tokenType < 0 || tokenType > this._tokenData.length){ + return "UNKNOWN_TOKEN"; + } else { + return this._tokenData[tokenType].name; } - else { - do { - if (index++ >= count) { - subscriber.complete(); - break; - } - subscriber.next(start++); - if (subscriber.closed) { - break; - } - } while (true); + }, + + /** + * Returns the token type value for the given token name. + * @param {String} tokenName The name of the token whose value should be returned. + * @return {int} The token type value for the given token name or -1 + * for an unknown token. + * @method tokenName + */ + tokenType: function(tokenName){ + return this._tokenData[tokenName] || -1; + }, + + /** + * Returns the last consumed token to the token stream. + * @method unget + */ + unget: function(){ + //if (this._ltIndex > -1){ + if (this._ltIndexCache.length){ + this._ltIndex -= this._ltIndexCache.pop();//--; + this._token = this._lt[this._ltIndex - 1]; + } else { + throw new Error("Too much lookahead."); } - }; - return RangeObservable; -}(Observable_1.Observable)); -exports.RangeObservable = RangeObservable; -//# sourceMappingURL=RangeObservable.js.map + } -/***/ }), -/* 258 */ -/***/ (function(module, exports, __webpack_require__) { +}; -"use strict"; -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); +parserlib.util = { +__proto__ : null, +StringReader: StringReader, +SyntaxError : SyntaxError, +SyntaxUnit : SyntaxUnit, +EventTarget : EventTarget, +TokenStreamBase : TokenStreamBase }; -var Observable_1 = __webpack_require__(0); -var asap_1 = __webpack_require__(70); -var isNumeric_1 = __webpack_require__(28); +})(); +/* +Parser-Lib +Copyright (c) 2009-2011 Nicholas C. Zakas. All rights reserved. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. + +*/ +/* Version v0.2.5+domino1, Build time: 30-January-2016 05:13:03 */ +(function(){ +var EventTarget = parserlib.util.EventTarget, +TokenStreamBase = parserlib.util.TokenStreamBase, +StringReader = parserlib.util.StringReader, // jshint ignore:line +SyntaxError = parserlib.util.SyntaxError, +SyntaxUnit = parserlib.util.SyntaxUnit; + +var Colors = { + __proto__ :null, + aliceblue :"#f0f8ff", + antiquewhite :"#faebd7", + aqua :"#00ffff", + aquamarine :"#7fffd4", + azure :"#f0ffff", + beige :"#f5f5dc", + bisque :"#ffe4c4", + black :"#000000", + blanchedalmond :"#ffebcd", + blue :"#0000ff", + blueviolet :"#8a2be2", + brown :"#a52a2a", + burlywood :"#deb887", + cadetblue :"#5f9ea0", + chartreuse :"#7fff00", + chocolate :"#d2691e", + coral :"#ff7f50", + cornflowerblue :"#6495ed", + cornsilk :"#fff8dc", + crimson :"#dc143c", + cyan :"#00ffff", + darkblue :"#00008b", + darkcyan :"#008b8b", + darkgoldenrod :"#b8860b", + darkgray :"#a9a9a9", + darkgrey :"#a9a9a9", + darkgreen :"#006400", + darkkhaki :"#bdb76b", + darkmagenta :"#8b008b", + darkolivegreen :"#556b2f", + darkorange :"#ff8c00", + darkorchid :"#9932cc", + darkred :"#8b0000", + darksalmon :"#e9967a", + darkseagreen :"#8fbc8f", + darkslateblue :"#483d8b", + darkslategray :"#2f4f4f", + darkslategrey :"#2f4f4f", + darkturquoise :"#00ced1", + darkviolet :"#9400d3", + deeppink :"#ff1493", + deepskyblue :"#00bfff", + dimgray :"#696969", + dimgrey :"#696969", + dodgerblue :"#1e90ff", + firebrick :"#b22222", + floralwhite :"#fffaf0", + forestgreen :"#228b22", + fuchsia :"#ff00ff", + gainsboro :"#dcdcdc", + ghostwhite :"#f8f8ff", + gold :"#ffd700", + goldenrod :"#daa520", + gray :"#808080", + grey :"#808080", + green :"#008000", + greenyellow :"#adff2f", + honeydew :"#f0fff0", + hotpink :"#ff69b4", + indianred :"#cd5c5c", + indigo :"#4b0082", + ivory :"#fffff0", + khaki :"#f0e68c", + lavender :"#e6e6fa", + lavenderblush :"#fff0f5", + lawngreen :"#7cfc00", + lemonchiffon :"#fffacd", + lightblue :"#add8e6", + lightcoral :"#f08080", + lightcyan :"#e0ffff", + lightgoldenrodyellow :"#fafad2", + lightgray :"#d3d3d3", + lightgrey :"#d3d3d3", + lightgreen :"#90ee90", + lightpink :"#ffb6c1", + lightsalmon :"#ffa07a", + lightseagreen :"#20b2aa", + lightskyblue :"#87cefa", + lightslategray :"#778899", + lightslategrey :"#778899", + lightsteelblue :"#b0c4de", + lightyellow :"#ffffe0", + lime :"#00ff00", + limegreen :"#32cd32", + linen :"#faf0e6", + magenta :"#ff00ff", + maroon :"#800000", + mediumaquamarine:"#66cdaa", + mediumblue :"#0000cd", + mediumorchid :"#ba55d3", + mediumpurple :"#9370d8", + mediumseagreen :"#3cb371", + mediumslateblue :"#7b68ee", + mediumspringgreen :"#00fa9a", + mediumturquoise :"#48d1cc", + mediumvioletred :"#c71585", + midnightblue :"#191970", + mintcream :"#f5fffa", + mistyrose :"#ffe4e1", + moccasin :"#ffe4b5", + navajowhite :"#ffdead", + navy :"#000080", + oldlace :"#fdf5e6", + olive :"#808000", + olivedrab :"#6b8e23", + orange :"#ffa500", + orangered :"#ff4500", + orchid :"#da70d6", + palegoldenrod :"#eee8aa", + palegreen :"#98fb98", + paleturquoise :"#afeeee", + palevioletred :"#d87093", + papayawhip :"#ffefd5", + peachpuff :"#ffdab9", + peru :"#cd853f", + pink :"#ffc0cb", + plum :"#dda0dd", + powderblue :"#b0e0e6", + purple :"#800080", + red :"#ff0000", + rosybrown :"#bc8f8f", + royalblue :"#4169e1", + saddlebrown :"#8b4513", + salmon :"#fa8072", + sandybrown :"#f4a460", + seagreen :"#2e8b57", + seashell :"#fff5ee", + sienna :"#a0522d", + silver :"#c0c0c0", + skyblue :"#87ceeb", + slateblue :"#6a5acd", + slategray :"#708090", + slategrey :"#708090", + snow :"#fffafa", + springgreen :"#00ff7f", + steelblue :"#4682b4", + tan :"#d2b48c", + teal :"#008080", + thistle :"#d8bfd8", + tomato :"#ff6347", + turquoise :"#40e0d0", + violet :"#ee82ee", + wheat :"#f5deb3", + white :"#ffffff", + whitesmoke :"#f5f5f5", + yellow :"#ffff00", + yellowgreen :"#9acd32", + //'currentColor' color keyword http://www.w3.org/TR/css3-color/#currentcolor + currentColor :"The value of the 'color' property.", + //CSS2 system colors http://www.w3.org/TR/css3-color/#css2-system + activeBorder :"Active window border.", + activecaption :"Active window caption.", + appworkspace :"Background color of multiple document interface.", + background :"Desktop background.", + buttonface :"The face background color for 3-D elements that appear 3-D due to one layer of surrounding border.", + buttonhighlight :"The color of the border facing the light source for 3-D elements that appear 3-D due to one layer of surrounding border.", + buttonshadow :"The color of the border away from the light source for 3-D elements that appear 3-D due to one layer of surrounding border.", + buttontext :"Text on push buttons.", + captiontext :"Text in caption, size box, and scrollbar arrow box.", + graytext :"Grayed (disabled) text. This color is set to #000 if the current display driver does not support a solid gray color.", + greytext :"Greyed (disabled) text. This color is set to #000 if the current display driver does not support a solid grey color.", + highlight :"Item(s) selected in a control.", + highlighttext :"Text of item(s) selected in a control.", + inactiveborder :"Inactive window border.", + inactivecaption :"Inactive window caption.", + inactivecaptiontext :"Color of text in an inactive caption.", + infobackground :"Background color for tooltip controls.", + infotext :"Text color for tooltip controls.", + menu :"Menu background.", + menutext :"Text in menus.", + scrollbar :"Scroll bar gray area.", + threeddarkshadow :"The color of the darker (generally outer) of the two borders away from the light source for 3-D elements that appear 3-D due to two concentric layers of surrounding border.", + threedface :"The face background color for 3-D elements that appear 3-D due to two concentric layers of surrounding border.", + threedhighlight :"The color of the lighter (generally outer) of the two borders facing the light source for 3-D elements that appear 3-D due to two concentric layers of surrounding border.", + threedlightshadow :"The color of the darker (generally inner) of the two borders facing the light source for 3-D elements that appear 3-D due to two concentric layers of surrounding border.", + threedshadow :"The color of the lighter (generally inner) of the two borders away from the light source for 3-D elements that appear 3-D due to two concentric layers of surrounding border.", + window :"Window background.", + windowframe :"Window frame.", + windowtext :"Text in windows." +}; +/** + * Represents a selector combinator (whitespace, +, >). + * @namespace parserlib.css + * @class Combinator + * @extends parserlib.util.SyntaxUnit + * @constructor + * @param {String} text The text representation of the unit. + * @param {int} line The line of text on which the unit resides. + * @param {int} col The column of text on which the unit resides. + */ +function Combinator(text, line, col){ + + SyntaxUnit.call(this, text, line, col, Parser.COMBINATOR_TYPE); + + /** + * The type of modifier. + * @type String + * @property type + */ + this.type = "unknown"; + + //pretty simple + if (/^\s+$/.test(text)){ + this.type = "descendant"; + } else if (text === ">"){ + this.type = "child"; + } else if (text === "+"){ + this.type = "adjacent-sibling"; + } else if (text === "~"){ + this.type = "sibling"; + } + +} + +Combinator.prototype = new SyntaxUnit(); +Combinator.prototype.constructor = Combinator; + /** - * We need this JSDoc comment for affecting ESDoc. - * @extends {Ignored} - * @hide true + * Represents a media feature, such as max-width:500. + * @namespace parserlib.css + * @class MediaFeature + * @extends parserlib.util.SyntaxUnit + * @constructor + * @param {SyntaxUnit} name The name of the feature. + * @param {SyntaxUnit} value The value of the feature or null if none. */ -var SubscribeOnObservable = (function (_super) { - __extends(SubscribeOnObservable, _super); - function SubscribeOnObservable(source, delayTime, scheduler) { - if (delayTime === void 0) { delayTime = 0; } - if (scheduler === void 0) { scheduler = asap_1.asap; } - _super.call(this); - this.source = source; - this.delayTime = delayTime; - this.scheduler = scheduler; - if (!isNumeric_1.isNumeric(delayTime) || delayTime < 0) { - this.delayTime = 0; - } - if (!scheduler || typeof scheduler.schedule !== 'function') { - this.scheduler = asap_1.asap; - } - } - SubscribeOnObservable.create = function (source, delay, scheduler) { - if (delay === void 0) { delay = 0; } - if (scheduler === void 0) { scheduler = asap_1.asap; } - return new SubscribeOnObservable(source, delay, scheduler); - }; - SubscribeOnObservable.dispatch = function (arg) { - var source = arg.source, subscriber = arg.subscriber; - return this.add(source.subscribe(subscriber)); - }; - SubscribeOnObservable.prototype._subscribe = function (subscriber) { - var delay = this.delayTime; - var source = this.source; - var scheduler = this.scheduler; - return scheduler.schedule(SubscribeOnObservable.dispatch, delay, { - source: source, subscriber: subscriber - }); - }; - return SubscribeOnObservable; -}(Observable_1.Observable)); -exports.SubscribeOnObservable = SubscribeOnObservable; -//# sourceMappingURL=SubscribeOnObservable.js.map +function MediaFeature(name, value){ -/***/ }), -/* 259 */ -/***/ (function(module, exports, __webpack_require__) { + SyntaxUnit.call(this, "(" + name + (value !== null ? ":" + value : "") + ")", name.startLine, name.startCol, Parser.MEDIA_FEATURE_TYPE); -"use strict"; + /** + * The name of the media feature + * @type String + * @property name + */ + this.name = name; + + /** + * The value for the feature or null if there is none. + * @type SyntaxUnit + * @property value + */ + this.value = value; +} + +MediaFeature.prototype = new SyntaxUnit(); +MediaFeature.prototype.constructor = MediaFeature; -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; -var isNumeric_1 = __webpack_require__(28); -var Observable_1 = __webpack_require__(0); -var async_1 = __webpack_require__(8); -var isScheduler_1 = __webpack_require__(13); -var isDate_1 = __webpack_require__(27); /** - * We need this JSDoc comment for affecting ESDoc. - * @extends {Ignored} - * @hide true + * Represents an individual media query. + * @namespace parserlib.css + * @class MediaQuery + * @extends parserlib.util.SyntaxUnit + * @constructor + * @param {String} modifier The modifier "not" or "only" (or null). + * @param {String} mediaType The type of media (i.e., "print"). + * @param {Array} parts Array of selectors parts making up this selector. + * @param {int} line The line of text on which the unit resides. + * @param {int} col The column of text on which the unit resides. */ -var TimerObservable = (function (_super) { - __extends(TimerObservable, _super); - function TimerObservable(dueTime, period, scheduler) { - if (dueTime === void 0) { dueTime = 0; } - _super.call(this); - this.period = -1; - this.dueTime = 0; - if (isNumeric_1.isNumeric(period)) { - this.period = Number(period) < 1 && 1 || Number(period); - } - else if (isScheduler_1.isScheduler(period)) { - scheduler = period; - } - if (!isScheduler_1.isScheduler(scheduler)) { - scheduler = async_1.async; - } - this.scheduler = scheduler; - this.dueTime = isDate_1.isDate(dueTime) ? - (+dueTime - this.scheduler.now()) : - dueTime; - } +function MediaQuery(modifier, mediaType, features, line, col){ + + SyntaxUnit.call(this, (modifier ? modifier + " ": "") + (mediaType ? mediaType : "") + (mediaType && features.length > 0 ? " and " : "") + features.join(" and "), line, col, Parser.MEDIA_QUERY_TYPE); + /** - * Creates an Observable that starts emitting after an `initialDelay` and - * emits ever increasing numbers after each `period` of time thereafter. - * - * Its like {@link interval}, but you can specify when - * should the emissions start. - * - * - * - * `timer` returns an Observable that emits an infinite sequence of ascending - * integers, with a constant interval of time, `period` of your choosing - * between those emissions. The first emission happens after the specified - * `initialDelay`. The initial delay may be a {@link Date}. By default, this - * operator uses the `async` IScheduler to provide a notion of time, but you - * may pass any IScheduler to it. If `period` is not specified, the output - * Observable emits only one value, `0`. Otherwise, it emits an infinite - * sequence. - * - * @example Emits ascending numbers, one every second (1000ms), starting after 3 seconds - * var numbers = Rx.Observable.timer(3000, 1000); - * numbers.subscribe(x => console.log(x)); - * - * @example Emits one number after five seconds - * var numbers = Rx.Observable.timer(5000); - * numbers.subscribe(x => console.log(x)); - * - * @see {@link interval} - * @see {@link delay} - * - * @param {number|Date} initialDelay The initial delay time to wait before - * emitting the first value of `0`. - * @param {number} [period] The period of time between emissions of the - * subsequent numbers. - * @param {Scheduler} [scheduler=async] The IScheduler to use for scheduling - * the emission of values, and providing a notion of "time". - * @return {Observable} An Observable that emits a `0` after the - * `initialDelay` and ever increasing numbers after each `period` of time - * thereafter. - * @static true - * @name timer - * @owner Observable + * The media modifier ("not" or "only") + * @type String + * @property modifier */ - TimerObservable.create = function (initialDelay, period, scheduler) { - if (initialDelay === void 0) { initialDelay = 0; } - return new TimerObservable(initialDelay, period, scheduler); - }; - TimerObservable.dispatch = function (state) { - var index = state.index, period = state.period, subscriber = state.subscriber; - var action = this; - subscriber.next(index); - if (subscriber.closed) { - return; - } - else if (period === -1) { - return subscriber.complete(); - } - state.index = index + 1; - action.schedule(state, period); - }; - TimerObservable.prototype._subscribe = function (subscriber) { - var index = 0; - var _a = this, period = _a.period, dueTime = _a.dueTime, scheduler = _a.scheduler; - return scheduler.schedule(TimerObservable.dispatch, dueTime, { - index: index, period: period, subscriber: subscriber - }); - }; - return TimerObservable; -}(Observable_1.Observable)); -exports.TimerObservable = TimerObservable; -//# sourceMappingURL=TimerObservable.js.map + this.modifier = modifier; + + /** + * The mediaType (i.e., "print") + * @type String + * @property mediaType + */ + this.mediaType = mediaType; + + /** + * The parts that make up the selector. + * @type Array + * @property features + */ + this.features = features; + +} + +MediaQuery.prototype = new SyntaxUnit(); +MediaQuery.prototype.constructor = MediaQuery; + + +/** + * A CSS3 parser. + * @namespace parserlib.css + * @class Parser + * @constructor + * @param {Object} options (Optional) Various options for the parser: + * starHack (true|false) to allow IE6 star hack as valid, + * underscoreHack (true|false) to interpret leading underscores + * as IE6-7 targeting for known properties, ieFilters (true|false) + * to indicate that IE < 8 filters should be accepted and not throw + * syntax errors. + */ +function Parser(options){ + + //inherit event functionality + EventTarget.call(this); + + + this.options = options || {}; + + this._tokenStream = null; +} + +//Static constants +Parser.DEFAULT_TYPE = 0; +Parser.COMBINATOR_TYPE = 1; +Parser.MEDIA_FEATURE_TYPE = 2; +Parser.MEDIA_QUERY_TYPE = 3; +Parser.PROPERTY_NAME_TYPE = 4; +Parser.PROPERTY_VALUE_TYPE = 5; +Parser.PROPERTY_VALUE_PART_TYPE = 6; +Parser.SELECTOR_TYPE = 7; +Parser.SELECTOR_PART_TYPE = 8; +Parser.SELECTOR_SUB_PART_TYPE = 9; + +Parser.prototype = function(){ + + var proto = new EventTarget(), //new prototype + prop, + additions = { + __proto__: null, + + //restore constructor + constructor: Parser, + + //instance constants - yuck + DEFAULT_TYPE : 0, + COMBINATOR_TYPE : 1, + MEDIA_FEATURE_TYPE : 2, + MEDIA_QUERY_TYPE : 3, + PROPERTY_NAME_TYPE : 4, + PROPERTY_VALUE_TYPE : 5, + PROPERTY_VALUE_PART_TYPE : 6, + SELECTOR_TYPE : 7, + SELECTOR_PART_TYPE : 8, + SELECTOR_SUB_PART_TYPE : 9, + + //----------------------------------------------------------------- + // Grammar + //----------------------------------------------------------------- + + _stylesheet: function(){ + + /* + * stylesheet + * : [ CHARSET_SYM S* STRING S* ';' ]? + * [S|CDO|CDC]* [ import [S|CDO|CDC]* ]* + * [ namespace [S|CDO|CDC]* ]* + * [ [ ruleset | media | page | font_face | keyframes ] [S|CDO|CDC]* ]* + * ; + */ + + var tokenStream = this._tokenStream, + count, + token, + tt; + + this.fire("startstylesheet"); + + //try to read character set + this._charset(); + + this._skipCruft(); + + //try to read imports - may be more than one + while (tokenStream.peek() === Tokens.IMPORT_SYM){ + this._import(); + this._skipCruft(); + } + + //try to read namespaces - may be more than one + while (tokenStream.peek() === Tokens.NAMESPACE_SYM){ + this._namespace(); + this._skipCruft(); + } + + //get the next token + tt = tokenStream.peek(); + + //try to read the rest + while(tt > Tokens.EOF){ + + try { + + switch(tt){ + case Tokens.MEDIA_SYM: + this._media(); + this._skipCruft(); + break; + case Tokens.PAGE_SYM: + this._page(); + this._skipCruft(); + break; + case Tokens.FONT_FACE_SYM: + this._font_face(); + this._skipCruft(); + break; + case Tokens.KEYFRAMES_SYM: + this._keyframes(); + this._skipCruft(); + break; + case Tokens.VIEWPORT_SYM: + this._viewport(); + this._skipCruft(); + break; + case Tokens.DOCUMENT_SYM: + this._document(); + this._skipCruft(); + break; + case Tokens.UNKNOWN_SYM: //unknown @ rule + tokenStream.get(); + if (!this.options.strict){ + + //fire error event + this.fire({ + type: "error", + error: null, + message: "Unknown @ rule: " + tokenStream.LT(0).value + ".", + line: tokenStream.LT(0).startLine, + col: tokenStream.LT(0).startCol + }); + + //skip braces + count=0; + while (tokenStream.advance([Tokens.LBRACE, Tokens.RBRACE]) === Tokens.LBRACE){ + count++; //keep track of nesting depth + } + + while(count){ + tokenStream.advance([Tokens.RBRACE]); + count--; + } + + } else { + //not a syntax error, rethrow it + throw new SyntaxError("Unknown @ rule.", tokenStream.LT(0).startLine, tokenStream.LT(0).startCol); + } + break; + case Tokens.S: + this._readWhitespace(); + break; + default: + if(!this._ruleset()){ + + //error handling for known issues + switch(tt){ + case Tokens.CHARSET_SYM: + token = tokenStream.LT(1); + this._charset(false); + throw new SyntaxError("@charset not allowed here.", token.startLine, token.startCol); + case Tokens.IMPORT_SYM: + token = tokenStream.LT(1); + this._import(false); + throw new SyntaxError("@import not allowed here.", token.startLine, token.startCol); + case Tokens.NAMESPACE_SYM: + token = tokenStream.LT(1); + this._namespace(false); + throw new SyntaxError("@namespace not allowed here.", token.startLine, token.startCol); + default: + tokenStream.get(); //get the last token + this._unexpectedToken(tokenStream.token()); + } + + } + } + } catch(ex) { + if (ex instanceof SyntaxError && !this.options.strict){ + this.fire({ + type: "error", + error: ex, + message: ex.message, + line: ex.line, + col: ex.col + }); + } else { + throw ex; + } + } + + tt = tokenStream.peek(); + } + + if (tt !== Tokens.EOF){ + this._unexpectedToken(tokenStream.token()); + } + + this.fire("endstylesheet"); + }, + + _charset: function(emit){ + var tokenStream = this._tokenStream, + charset, + token, + line, + col; + + if (tokenStream.match(Tokens.CHARSET_SYM)){ + line = tokenStream.token().startLine; + col = tokenStream.token().startCol; + + this._readWhitespace(); + tokenStream.mustMatch(Tokens.STRING); + + token = tokenStream.token(); + charset = token.value; + + this._readWhitespace(); + tokenStream.mustMatch(Tokens.SEMICOLON); + + if (emit !== false){ + this.fire({ + type: "charset", + charset:charset, + line: line, + col: col + }); + } + } + }, + + _import: function(emit){ + /* + * import + * : IMPORT_SYM S* + * [STRING|URI] S* media_query_list? ';' S* + */ + + var tokenStream = this._tokenStream, + uri, + importToken, + mediaList = []; + + //read import symbol + tokenStream.mustMatch(Tokens.IMPORT_SYM); + importToken = tokenStream.token(); + this._readWhitespace(); + + tokenStream.mustMatch([Tokens.STRING, Tokens.URI]); + + //grab the URI value + uri = tokenStream.token().value.replace(/^(?:url\()?["']?([^"']+?)["']?\)?$/, "$1"); + + this._readWhitespace(); + + mediaList = this._media_query_list(); + + //must end with a semicolon + tokenStream.mustMatch(Tokens.SEMICOLON); + this._readWhitespace(); + + if (emit !== false){ + this.fire({ + type: "import", + uri: uri, + media: mediaList, + line: importToken.startLine, + col: importToken.startCol + }); + } + + }, + + _namespace: function(emit){ + /* + * namespace + * : NAMESPACE_SYM S* [namespace_prefix S*]? [STRING|URI] S* ';' S* + */ + + var tokenStream = this._tokenStream, + line, + col, + prefix, + uri; + + //read import symbol + tokenStream.mustMatch(Tokens.NAMESPACE_SYM); + line = tokenStream.token().startLine; + col = tokenStream.token().startCol; + this._readWhitespace(); + + //it's a namespace prefix - no _namespace_prefix() method because it's just an IDENT + if (tokenStream.match(Tokens.IDENT)){ + prefix = tokenStream.token().value; + this._readWhitespace(); + } + + tokenStream.mustMatch([Tokens.STRING, Tokens.URI]); + /*if (!tokenStream.match(Tokens.STRING)){ + tokenStream.mustMatch(Tokens.URI); + }*/ + + //grab the URI value + uri = tokenStream.token().value.replace(/(?:url\()?["']([^"']+)["']\)?/, "$1"); + + this._readWhitespace(); + + //must end with a semicolon + tokenStream.mustMatch(Tokens.SEMICOLON); + this._readWhitespace(); + + if (emit !== false){ + this.fire({ + type: "namespace", + prefix: prefix, + uri: uri, + line: line, + col: col + }); + } + + }, + + _media: function(){ + /* + * media + * : MEDIA_SYM S* media_query_list S* '{' S* ruleset* '}' S* + * ; + */ + var tokenStream = this._tokenStream, + line, + col, + mediaList;// = []; + + //look for @media + tokenStream.mustMatch(Tokens.MEDIA_SYM); + line = tokenStream.token().startLine; + col = tokenStream.token().startCol; + + this._readWhitespace(); + + mediaList = this._media_query_list(); + + tokenStream.mustMatch(Tokens.LBRACE); + this._readWhitespace(); + + this.fire({ + type: "startmedia", + media: mediaList, + line: line, + col: col + }); + + while(true) { + if (tokenStream.peek() === Tokens.PAGE_SYM){ + this._page(); + } else if (tokenStream.peek() === Tokens.FONT_FACE_SYM){ + this._font_face(); + } else if (tokenStream.peek() === Tokens.VIEWPORT_SYM){ + this._viewport(); + } else if (tokenStream.peek() === Tokens.DOCUMENT_SYM){ + this._document(); + } else if (!this._ruleset()){ + break; + } + } + + tokenStream.mustMatch(Tokens.RBRACE); + this._readWhitespace(); + + this.fire({ + type: "endmedia", + media: mediaList, + line: line, + col: col + }); + }, -/***/ }), -/* 260 */ -/***/ (function(module, exports, __webpack_require__) { -"use strict"; + //CSS3 Media Queries + _media_query_list: function(){ + /* + * media_query_list + * : S* [media_query [ ',' S* media_query ]* ]? + * ; + */ + var tokenStream = this._tokenStream, + mediaList = []; -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; -var Observable_1 = __webpack_require__(0); -var subscribeToResult_1 = __webpack_require__(3); -var OuterSubscriber_1 = __webpack_require__(4); -/** - * We need this JSDoc comment for affecting ESDoc. - * @extends {Ignored} - * @hide true - */ -var UsingObservable = (function (_super) { - __extends(UsingObservable, _super); - function UsingObservable(resourceFactory, observableFactory) { - _super.call(this); - this.resourceFactory = resourceFactory; - this.observableFactory = observableFactory; - } - UsingObservable.create = function (resourceFactory, observableFactory) { - return new UsingObservable(resourceFactory, observableFactory); - }; - UsingObservable.prototype._subscribe = function (subscriber) { - var _a = this, resourceFactory = _a.resourceFactory, observableFactory = _a.observableFactory; - var resource; - try { - resource = resourceFactory(); - return new UsingSubscriber(subscriber, resource, observableFactory); - } - catch (err) { - subscriber.error(err); - } - }; - return UsingObservable; -}(Observable_1.Observable)); -exports.UsingObservable = UsingObservable; -var UsingSubscriber = (function (_super) { - __extends(UsingSubscriber, _super); - function UsingSubscriber(destination, resource, observableFactory) { - _super.call(this, destination); - this.resource = resource; - this.observableFactory = observableFactory; - destination.add(resource); - this.tryUse(); - } - UsingSubscriber.prototype.tryUse = function () { - try { - var source = this.observableFactory.call(this, this.resource); - if (source) { - this.add(subscribeToResult_1.subscribeToResult(this, source)); - } - } - catch (err) { - this._error(err); - } - }; - return UsingSubscriber; -}(OuterSubscriber_1.OuterSubscriber)); -//# sourceMappingURL=UsingObservable.js.map -/***/ }), -/* 261 */ -/***/ (function(module, exports, __webpack_require__) { + this._readWhitespace(); -"use strict"; + if (tokenStream.peek() === Tokens.IDENT || tokenStream.peek() === Tokens.LPAREN){ + mediaList.push(this._media_query()); + } -var BoundCallbackObservable_1 = __webpack_require__(246); -exports.bindCallback = BoundCallbackObservable_1.BoundCallbackObservable.create; -//# sourceMappingURL=bindCallback.js.map + while(tokenStream.match(Tokens.COMMA)){ + this._readWhitespace(); + mediaList.push(this._media_query()); + } -/***/ }), -/* 262 */ -/***/ (function(module, exports, __webpack_require__) { + return mediaList; + }, -"use strict"; + /* + * Note: "expression" in the grammar maps to the _media_expression + * method. -var BoundNodeCallbackObservable_1 = __webpack_require__(247); -exports.bindNodeCallback = BoundNodeCallbackObservable_1.BoundNodeCallbackObservable.create; -//# sourceMappingURL=bindNodeCallback.js.map + */ + _media_query: function(){ + /* + * media_query + * : [ONLY | NOT]? S* media_type S* [ AND S* expression ]* + * | expression [ AND S* expression ]* + * ; + */ + var tokenStream = this._tokenStream, + type = null, + ident = null, + token = null, + expressions = []; + + if (tokenStream.match(Tokens.IDENT)){ + ident = tokenStream.token().value.toLowerCase(); + + //since there's no custom tokens for these, need to manually check + if (ident !== "only" && ident !== "not"){ + tokenStream.unget(); + ident = null; + } else { + token = tokenStream.token(); + } + } -/***/ }), -/* 263 */ -/***/ (function(module, exports, __webpack_require__) { + this._readWhitespace(); -"use strict"; + if (tokenStream.peek() === Tokens.IDENT){ + type = this._media_type(); + if (token === null){ + token = tokenStream.token(); + } + } else if (tokenStream.peek() === Tokens.LPAREN){ + if (token === null){ + token = tokenStream.LT(1); + } + expressions.push(this._media_expression()); + } -var isScheduler_1 = __webpack_require__(13); -var isArray_1 = __webpack_require__(15); -var ArrayObservable_1 = __webpack_require__(14); -var combineLatest_1 = __webpack_require__(37); -/* tslint:enable:max-line-length */ -/** - * Combines multiple Observables to create an Observable whose values are - * calculated from the latest values of each of its input Observables. - * - * Whenever any input Observable emits a value, it - * computes a formula using the latest values from all the inputs, then emits - * the output of that formula. - * - * - * - * `combineLatest` combines the values from all the Observables passed as - * arguments. This is done by subscribing to each Observable in order and, - * whenever any Observable emits, collecting an array of the most recent - * values from each Observable. So if you pass `n` Observables to operator, - * returned Observable will always emit an array of `n` values, in order - * corresponding to order of passed Observables (value from the first Observable - * on the first place and so on). - * - * Static version of `combineLatest` accepts either an array of Observables - * or each Observable can be put directly as an argument. Note that array of - * Observables is good choice, if you don't know beforehand how many Observables - * you will combine. Passing empty array will result in Observable that - * completes immediately. - * - * To ensure output array has always the same length, `combineLatest` will - * actually wait for all input Observables to emit at least once, - * before it starts emitting results. This means if some Observable emits - * values before other Observables started emitting, all that values but last - * will be lost. On the other hand, is some Observable does not emit value but - * completes, resulting Observable will complete at the same moment without - * emitting anything, since it will be now impossible to include value from - * completed Observable in resulting array. Also, if some input Observable does - * not emit any value and never completes, `combineLatest` will also never emit - * and never complete, since, again, it will wait for all streams to emit some - * value. - * - * If at least one Observable was passed to `combineLatest` and all passed Observables - * emitted something, resulting Observable will complete when all combined - * streams complete. So even if some Observable completes, result of - * `combineLatest` will still emit values when other Observables do. In case - * of completed Observable, its value from now on will always be the last - * emitted value. On the other hand, if any Observable errors, `combineLatest` - * will error immediately as well, and all other Observables will be unsubscribed. - * - * `combineLatest` accepts as optional parameter `project` function, which takes - * as arguments all values that would normally be emitted by resulting Observable. - * `project` can return any kind of value, which will be then emitted by Observable - * instead of default array. Note that `project` does not take as argument that array - * of values, but values themselves. That means default `project` can be imagined - * as function that takes all its arguments and puts them into an array. - * - * - * @example Combine two timer Observables - * const firstTimer = Rx.Observable.timer(0, 1000); // emit 0, 1, 2... after every second, starting from now - * const secondTimer = Rx.Observable.timer(500, 1000); // emit 0, 1, 2... after every second, starting 0,5s from now - * const combinedTimers = Rx.Observable.combineLatest(firstTimer, secondTimer); - * combinedTimers.subscribe(value => console.log(value)); - * // Logs - * // [0, 0] after 0.5s - * // [1, 0] after 1s - * // [1, 1] after 1.5s - * // [2, 1] after 2s - * - * - * @example Combine an array of Observables - * const observables = [1, 5, 10].map( - * n => Rx.Observable.of(n).delay(n * 1000).startWith(0) // emit 0 and then emit n after n seconds - * ); - * const combined = Rx.Observable.combineLatest(observables); - * combined.subscribe(value => console.log(value)); - * // Logs - * // [0, 0, 0] immediately - * // [1, 0, 0] after 1s - * // [1, 5, 0] after 5s - * // [1, 5, 10] after 10s - * - * - * @example Use project function to dynamically calculate the Body-Mass Index - * var weight = Rx.Observable.of(70, 72, 76, 79, 75); - * var height = Rx.Observable.of(1.76, 1.77, 1.78); - * var bmi = Rx.Observable.combineLatest(weight, height, (w, h) => w / (h * h)); - * bmi.subscribe(x => console.log('BMI is ' + x)); - * - * // With output to console: - * // BMI is 24.212293388429753 - * // BMI is 23.93948099205209 - * // BMI is 23.671253629592222 - * - * - * @see {@link combineAll} - * @see {@link merge} - * @see {@link withLatestFrom} - * - * @param {ObservableInput} observable1 An input Observable to combine with other Observables. - * @param {ObservableInput} observable2 An input Observable to combine with other Observables. - * More than one input Observables may be given as arguments - * or an array of Observables may be given as the first argument. - * @param {function} [project] An optional function to project the values from - * the combined latest values into a new value on the output Observable. - * @param {Scheduler} [scheduler=null] The IScheduler to use for subscribing to - * each input Observable. - * @return {Observable} An Observable of projected values from the most recent - * values from each input Observable, or an array of the most recent values from - * each input Observable. - * @static true - * @name combineLatest - * @owner Observable - */ -function combineLatest() { - var observables = []; - for (var _i = 0; _i < arguments.length; _i++) { - observables[_i - 0] = arguments[_i]; - } - var project = null; - var scheduler = null; - if (isScheduler_1.isScheduler(observables[observables.length - 1])) { - scheduler = observables.pop(); - } - if (typeof observables[observables.length - 1] === 'function') { - project = observables.pop(); - } - // if the first and only other argument besides the resultSelector is an array - // assume it's been called with `combineLatest([obs1, obs2, obs3], project)` - if (observables.length === 1 && isArray_1.isArray(observables[0])) { - observables = observables[0]; - } - return new ArrayObservable_1.ArrayObservable(observables, scheduler).lift(new combineLatest_1.CombineLatestOperator(project)); -} -exports.combineLatest = combineLatest; -//# sourceMappingURL=combineLatest.js.map + if (type === null && expressions.length === 0){ + return null; + } else { + this._readWhitespace(); + while (tokenStream.match(Tokens.IDENT)){ + if (tokenStream.token().value.toLowerCase() !== "and"){ + this._unexpectedToken(tokenStream.token()); + } -/***/ }), -/* 264 */ -/***/ (function(module, exports, __webpack_require__) { + this._readWhitespace(); + expressions.push(this._media_expression()); + } + } -"use strict"; + return new MediaQuery(ident, type, expressions, token.startLine, token.startCol); + }, -var concat_1 = __webpack_require__(38); -exports.concat = concat_1.concatStatic; -//# sourceMappingURL=concat.js.map + //CSS3 Media Queries + _media_type: function(){ + /* + * media_type + * : IDENT + * ; + */ + return this._media_feature(); + }, -/***/ }), -/* 265 */ -/***/ (function(module, exports, __webpack_require__) { + /** + * Note: in CSS3 Media Queries, this is called "expression". + * Renamed here to avoid conflict with CSS3 Selectors + * definition of "expression". Also note that "expr" in the + * grammar now maps to "expression" from CSS3 selectors. + * @method _media_expression + * @private + */ + _media_expression: function(){ + /* + * expression + * : '(' S* media_feature S* [ ':' S* expr ]? ')' S* + * ; + */ + var tokenStream = this._tokenStream, + feature = null, + token, + expression = null; + + tokenStream.mustMatch(Tokens.LPAREN); + + feature = this._media_feature(); + this._readWhitespace(); + + if (tokenStream.match(Tokens.COLON)){ + this._readWhitespace(); + token = tokenStream.LT(1); + expression = this._expression(); + } -"use strict"; + tokenStream.mustMatch(Tokens.RPAREN); + this._readWhitespace(); -var DeferObservable_1 = __webpack_require__(248); -exports.defer = DeferObservable_1.DeferObservable.create; -//# sourceMappingURL=defer.js.map + return new MediaFeature(feature, (expression ? new SyntaxUnit(expression, token.startLine, token.startCol) : null)); + }, -/***/ }), -/* 266 */ -/***/ (function(module, exports, __webpack_require__) { + //CSS3 Media Queries + _media_feature: function(){ + /* + * media_feature + * : IDENT + * ; + */ + var tokenStream = this._tokenStream; -"use strict"; + this._readWhitespace(); -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; -var Subject_1 = __webpack_require__(6); -var Subscriber_1 = __webpack_require__(2); -var Observable_1 = __webpack_require__(0); -var Subscription_1 = __webpack_require__(9); -var root_1 = __webpack_require__(12); -var ReplaySubject_1 = __webpack_require__(26); -var tryCatch_1 = __webpack_require__(7); -var errorObject_1 = __webpack_require__(5); -var assign_1 = __webpack_require__(373); -/** - * We need this JSDoc comment for affecting ESDoc. - * @extends {Ignored} - * @hide true - */ -var WebSocketSubject = (function (_super) { - __extends(WebSocketSubject, _super); - function WebSocketSubject(urlConfigOrSource, destination) { - if (urlConfigOrSource instanceof Observable_1.Observable) { - _super.call(this, destination, urlConfigOrSource); - } - else { - _super.call(this); - this.WebSocketCtor = root_1.root.WebSocket; - this._output = new Subject_1.Subject(); - if (typeof urlConfigOrSource === 'string') { - this.url = urlConfigOrSource; - } - else { - // WARNING: config object could override important members here. - assign_1.assign(this, urlConfigOrSource); - } - if (!this.WebSocketCtor) { - throw new Error('no WebSocket constructor can be found'); - } - this.destination = new ReplaySubject_1.ReplaySubject(); - } - } - WebSocketSubject.prototype.resultSelector = function (e) { - return JSON.parse(e.data); - }; - /** - * Wrapper around the w3c-compatible WebSocket object provided by the browser. - * - * @example Wraps browser WebSocket - * - * let socket$ = Observable.webSocket('ws://localhost:8081'); - * - * socket$.subscribe( - * (msg) => console.log('message received: ' + msg), - * (err) => console.log(err), - * () => console.log('complete') - * ); - * - * socket$.next(JSON.stringify({ op: 'hello' })); - * - * @example Wraps WebSocket from nodejs-websocket (using node.js) - * - * import { w3cwebsocket } from 'websocket'; - * - * let socket$ = Observable.webSocket({ - * url: 'ws://localhost:8081', - * WebSocketCtor: w3cwebsocket - * }); - * - * socket$.subscribe( - * (msg) => console.log('message received: ' + msg), - * (err) => console.log(err), - * () => console.log('complete') - * ); - * - * socket$.next(JSON.stringify({ op: 'hello' })); - * - * @param {string | WebSocketSubjectConfig} urlConfigOrSource the source of the websocket as an url or a structure defining the websocket object - * @return {WebSocketSubject} - * @static true - * @name webSocket - * @owner Observable - */ - WebSocketSubject.create = function (urlConfigOrSource) { - return new WebSocketSubject(urlConfigOrSource); - }; - WebSocketSubject.prototype.lift = function (operator) { - var sock = new WebSocketSubject(this, this.destination); - sock.operator = operator; - return sock; - }; - WebSocketSubject.prototype._resetState = function () { - this.socket = null; - if (!this.source) { - this.destination = new ReplaySubject_1.ReplaySubject(); - } - this._output = new Subject_1.Subject(); - }; - // TODO: factor this out to be a proper Operator/Subscriber implementation and eliminate closures - WebSocketSubject.prototype.multiplex = function (subMsg, unsubMsg, messageFilter) { - var self = this; - return new Observable_1.Observable(function (observer) { - var result = tryCatch_1.tryCatch(subMsg)(); - if (result === errorObject_1.errorObject) { - observer.error(errorObject_1.errorObject.e); - } - else { - self.next(result); - } - var subscription = self.subscribe(function (x) { - var result = tryCatch_1.tryCatch(messageFilter)(x); - if (result === errorObject_1.errorObject) { - observer.error(errorObject_1.errorObject.e); + tokenStream.mustMatch(Tokens.IDENT); + + return SyntaxUnit.fromToken(tokenStream.token()); + }, + + //CSS3 Paged Media + _page: function(){ + /* + * page: + * PAGE_SYM S* IDENT? pseudo_page? S* + * '{' S* [ declaration | margin ]? [ ';' S* [ declaration | margin ]? ]* '}' S* + * ; + */ + var tokenStream = this._tokenStream, + line, + col, + identifier = null, + pseudoPage = null; + + //look for @page + tokenStream.mustMatch(Tokens.PAGE_SYM); + line = tokenStream.token().startLine; + col = tokenStream.token().startCol; + + this._readWhitespace(); + + if (tokenStream.match(Tokens.IDENT)){ + identifier = tokenStream.token().value; + + //The value 'auto' may not be used as a page name and MUST be treated as a syntax error. + if (identifier.toLowerCase() === "auto"){ + this._unexpectedToken(tokenStream.token()); + } } - else if (result) { - observer.next(x); + + //see if there's a colon upcoming + if (tokenStream.peek() === Tokens.COLON){ + pseudoPage = this._pseudo_page(); } - }, function (err) { return observer.error(err); }, function () { return observer.complete(); }); - return function () { - var result = tryCatch_1.tryCatch(unsubMsg)(); - if (result === errorObject_1.errorObject) { - observer.error(errorObject_1.errorObject.e); + + this._readWhitespace(); + + this.fire({ + type: "startpage", + id: identifier, + pseudo: pseudoPage, + line: line, + col: col + }); + + this._readDeclarations(true, true); + + this.fire({ + type: "endpage", + id: identifier, + pseudo: pseudoPage, + line: line, + col: col + }); + + }, + + //CSS3 Paged Media + _margin: function(){ + /* + * margin : + * margin_sym S* '{' declaration [ ';' S* declaration? ]* '}' S* + * ; + */ + var tokenStream = this._tokenStream, + line, + col, + marginSym = this._margin_sym(); + + if (marginSym){ + line = tokenStream.token().startLine; + col = tokenStream.token().startCol; + + this.fire({ + type: "startpagemargin", + margin: marginSym, + line: line, + col: col + }); + + this._readDeclarations(true); + + this.fire({ + type: "endpagemargin", + margin: marginSym, + line: line, + col: col + }); + return true; + } else { + return false; } - else { - self.next(result); + }, + + //CSS3 Paged Media + _margin_sym: function(){ + + /* + * margin_sym : + * TOPLEFTCORNER_SYM | + * TOPLEFT_SYM | + * TOPCENTER_SYM | + * TOPRIGHT_SYM | + * TOPRIGHTCORNER_SYM | + * BOTTOMLEFTCORNER_SYM | + * BOTTOMLEFT_SYM | + * BOTTOMCENTER_SYM | + * BOTTOMRIGHT_SYM | + * BOTTOMRIGHTCORNER_SYM | + * LEFTTOP_SYM | + * LEFTMIDDLE_SYM | + * LEFTBOTTOM_SYM | + * RIGHTTOP_SYM | + * RIGHTMIDDLE_SYM | + * RIGHTBOTTOM_SYM + * ; + */ + + var tokenStream = this._tokenStream; + + if(tokenStream.match([Tokens.TOPLEFTCORNER_SYM, Tokens.TOPLEFT_SYM, + Tokens.TOPCENTER_SYM, Tokens.TOPRIGHT_SYM, Tokens.TOPRIGHTCORNER_SYM, + Tokens.BOTTOMLEFTCORNER_SYM, Tokens.BOTTOMLEFT_SYM, + Tokens.BOTTOMCENTER_SYM, Tokens.BOTTOMRIGHT_SYM, + Tokens.BOTTOMRIGHTCORNER_SYM, Tokens.LEFTTOP_SYM, + Tokens.LEFTMIDDLE_SYM, Tokens.LEFTBOTTOM_SYM, Tokens.RIGHTTOP_SYM, + Tokens.RIGHTMIDDLE_SYM, Tokens.RIGHTBOTTOM_SYM])) + { + return SyntaxUnit.fromToken(tokenStream.token()); + } else { + return null; } - subscription.unsubscribe(); - }; - }); - }; - WebSocketSubject.prototype._connectSocket = function () { - var _this = this; - var WebSocketCtor = this.WebSocketCtor; - var observer = this._output; - var socket = null; - try { - socket = this.protocol ? - new WebSocketCtor(this.url, this.protocol) : - new WebSocketCtor(this.url); - this.socket = socket; - if (this.binaryType) { - this.socket.binaryType = this.binaryType; - } - } - catch (e) { - observer.error(e); - return; - } - var subscription = new Subscription_1.Subscription(function () { - _this.socket = null; - if (socket && socket.readyState === 1) { - socket.close(); - } - }); - socket.onopen = function (e) { - var openObserver = _this.openObserver; - if (openObserver) { - openObserver.next(e); - } - var queue = _this.destination; - _this.destination = Subscriber_1.Subscriber.create(function (x) { return socket.readyState === 1 && socket.send(x); }, function (e) { - var closingObserver = _this.closingObserver; - if (closingObserver) { - closingObserver.next(undefined); + + }, + + _pseudo_page: function(){ + /* + * pseudo_page + * : ':' IDENT + * ; + */ + + var tokenStream = this._tokenStream; + + tokenStream.mustMatch(Tokens.COLON); + tokenStream.mustMatch(Tokens.IDENT); + + //TODO: CSS3 Paged Media says only "left", "center", and "right" are allowed + + return tokenStream.token().value; + }, + + _font_face: function(){ + /* + * font_face + * : FONT_FACE_SYM S* + * '{' S* declaration [ ';' S* declaration ]* '}' S* + * ; + */ + var tokenStream = this._tokenStream, + line, + col; + + //look for @page + tokenStream.mustMatch(Tokens.FONT_FACE_SYM); + line = tokenStream.token().startLine; + col = tokenStream.token().startCol; + + this._readWhitespace(); + + this.fire({ + type: "startfontface", + line: line, + col: col + }); + + this._readDeclarations(true); + + this.fire({ + type: "endfontface", + line: line, + col: col + }); + }, + + _viewport: function(){ + /* + * viewport + * : VIEWPORT_SYM S* + * '{' S* declaration? [ ';' S* declaration? ]* '}' S* + * ; + */ + var tokenStream = this._tokenStream, + line, + col; + + tokenStream.mustMatch(Tokens.VIEWPORT_SYM); + line = tokenStream.token().startLine; + col = tokenStream.token().startCol; + + this._readWhitespace(); + + this.fire({ + type: "startviewport", + line: line, + col: col + }); + + this._readDeclarations(true); + + this.fire({ + type: "endviewport", + line: line, + col: col + }); + + }, + + _document: function(){ + /* + * document + * : DOCUMENT_SYM S* + * _document_function [ ',' S* _document_function ]* S* + * '{' S* ruleset* '}' + * ; + */ + + var tokenStream = this._tokenStream, + token, + functions = [], + prefix = ""; + + tokenStream.mustMatch(Tokens.DOCUMENT_SYM); + token = tokenStream.token(); + if (/^@\-([^\-]+)\-/.test(token.value)) { + prefix = RegExp.$1; } - if (e && e.code) { - socket.close(e.code, e.reason); + + this._readWhitespace(); + functions.push(this._document_function()); + + while(tokenStream.match(Tokens.COMMA)) { + this._readWhitespace(); + functions.push(this._document_function()); } - else { - observer.error(new TypeError('WebSocketSubject.error must be called with an object with an error code, ' + - 'and an optional reason: { code: number, reason: string }')); + + tokenStream.mustMatch(Tokens.LBRACE); + this._readWhitespace(); + + this.fire({ + type: "startdocument", + functions: functions, + prefix: prefix, + line: token.startLine, + col: token.startCol + }); + + while(true) { + if (tokenStream.peek() === Tokens.PAGE_SYM){ + this._page(); + } else if (tokenStream.peek() === Tokens.FONT_FACE_SYM){ + this._font_face(); + } else if (tokenStream.peek() === Tokens.VIEWPORT_SYM){ + this._viewport(); + } else if (tokenStream.peek() === Tokens.MEDIA_SYM){ + this._media(); + } else if (!this._ruleset()){ + break; + } } - _this._resetState(); - }, function () { - var closingObserver = _this.closingObserver; - if (closingObserver) { - closingObserver.next(undefined); + + tokenStream.mustMatch(Tokens.RBRACE); + this._readWhitespace(); + + this.fire({ + type: "enddocument", + functions: functions, + prefix: prefix, + line: token.startLine, + col: token.startCol + }); + }, + + _document_function: function(){ + /* + * document_function + * : function | URI S* + * ; + */ + + var tokenStream = this._tokenStream, + value; + + if (tokenStream.match(Tokens.URI)) { + value = tokenStream.token().value; + this._readWhitespace(); + } else { + value = this._function(); } - socket.close(); - _this._resetState(); - }); - if (queue && queue instanceof ReplaySubject_1.ReplaySubject) { - subscription.add(queue.subscribe(_this.destination)); - } - }; - socket.onerror = function (e) { - _this._resetState(); - observer.error(e); - }; - socket.onclose = function (e) { - _this._resetState(); - var closeObserver = _this.closeObserver; - if (closeObserver) { - closeObserver.next(e); - } - if (e.wasClean) { - observer.complete(); - } - else { - observer.error(e); - } - }; - socket.onmessage = function (e) { - var result = tryCatch_1.tryCatch(_this.resultSelector)(e); - if (result === errorObject_1.errorObject) { - observer.error(errorObject_1.errorObject.e); - } - else { - observer.next(result); - } - }; - }; - WebSocketSubject.prototype._subscribe = function (subscriber) { - var _this = this; - var source = this.source; - if (source) { - return source.subscribe(subscriber); - } - if (!this.socket) { - this._connectSocket(); - } - var subscription = new Subscription_1.Subscription(); - subscription.add(this._output.subscribe(subscriber)); - subscription.add(function () { - var socket = _this.socket; - if (_this._output.observers.length === 0) { - if (socket && socket.readyState === 1) { - socket.close(); + + return value; + }, + + _operator: function(inFunction){ + + /* + * operator (outside function) + * : '/' S* | ',' S* | /( empty )/ + * operator (inside function) + * : '/' S* | '+' S* | '*' S* | '-' S* /( empty )/ + * ; + */ + + var tokenStream = this._tokenStream, + token = null; + + if (tokenStream.match([Tokens.SLASH, Tokens.COMMA]) || + (inFunction && tokenStream.match([Tokens.PLUS, Tokens.STAR, Tokens.MINUS]))){ + token = tokenStream.token(); + this._readWhitespace(); } - _this._resetState(); - } - }); - return subscription; - }; - WebSocketSubject.prototype.unsubscribe = function () { - var _a = this, source = _a.source, socket = _a.socket; - if (socket && socket.readyState === 1) { - socket.close(); - this._resetState(); - } - _super.prototype.unsubscribe.call(this); - if (!source) { - this.destination = new ReplaySubject_1.ReplaySubject(); - } - }; - return WebSocketSubject; -}(Subject_1.AnonymousSubject)); -exports.WebSocketSubject = WebSocketSubject; -//# sourceMappingURL=WebSocketSubject.js.map + return token ? PropertyValuePart.fromToken(token) : null; -/***/ }), -/* 267 */ -/***/ (function(module, exports, __webpack_require__) { + }, -"use strict"; + _combinator: function(){ -var AjaxObservable_1 = __webpack_require__(59); -exports.ajax = AjaxObservable_1.AjaxObservable.create; -//# sourceMappingURL=ajax.js.map + /* + * combinator + * : PLUS S* | GREATER S* | TILDE S* | S+ + * ; + */ -/***/ }), -/* 268 */ -/***/ (function(module, exports, __webpack_require__) { + var tokenStream = this._tokenStream, + value = null, + token; -"use strict"; + if(tokenStream.match([Tokens.PLUS, Tokens.GREATER, Tokens.TILDE])){ + token = tokenStream.token(); + value = new Combinator(token.value, token.startLine, token.startCol); + this._readWhitespace(); + } -var WebSocketSubject_1 = __webpack_require__(266); -exports.webSocket = WebSocketSubject_1.WebSocketSubject.create; -//# sourceMappingURL=webSocket.js.map + return value; + }, -/***/ }), -/* 269 */ -/***/ (function(module, exports, __webpack_require__) { + _unary_operator: function(){ -"use strict"; + /* + * unary_operator + * : '-' | '+' + * ; + */ -var EmptyObservable_1 = __webpack_require__(23); -exports.empty = EmptyObservable_1.EmptyObservable.create; -//# sourceMappingURL=empty.js.map + var tokenStream = this._tokenStream; + + if (tokenStream.match([Tokens.MINUS, Tokens.PLUS])){ + return tokenStream.token().value; + } else { + return null; + } + }, + + _property: function(){ + + /* + * property + * : IDENT S* + * ; + */ + + var tokenStream = this._tokenStream, + value = null, + hack = null, + tokenValue, + token, + line, + col; + + //check for star hack - throws error if not allowed + if (tokenStream.peek() === Tokens.STAR && this.options.starHack){ + tokenStream.get(); + token = tokenStream.token(); + hack = token.value; + line = token.startLine; + col = token.startCol; + } + + if(tokenStream.match(Tokens.IDENT)){ + token = tokenStream.token(); + tokenValue = token.value; + + //check for underscore hack - no error if not allowed because it's valid CSS syntax + if (tokenValue.charAt(0) === "_" && this.options.underscoreHack){ + hack = "_"; + tokenValue = tokenValue.substring(1); + } -/***/ }), -/* 270 */ -/***/ (function(module, exports, __webpack_require__) { + value = new PropertyName(tokenValue, hack, (line||token.startLine), (col||token.startCol)); + this._readWhitespace(); + } -"use strict"; + return value; + }, -var FromEventObservable_1 = __webpack_require__(250); -exports.fromEvent = FromEventObservable_1.FromEventObservable.create; -//# sourceMappingURL=fromEvent.js.map + //Augmented with CSS3 Selectors + _ruleset: function(){ + /* + * ruleset + * : selectors_group + * '{' S* declaration? [ ';' S* declaration? ]* '}' S* + * ; + */ -/***/ }), -/* 271 */ -/***/ (function(module, exports, __webpack_require__) { + var tokenStream = this._tokenStream, + tt, + selectors; -"use strict"; -var FromEventPatternObservable_1 = __webpack_require__(251); -exports.fromEventPattern = FromEventPatternObservable_1.FromEventPatternObservable.create; -//# sourceMappingURL=fromEventPattern.js.map + /* + * Error Recovery: If even a single selector fails to parse, + * then the entire ruleset should be thrown away. + */ + try { + selectors = this._selectors_group(); + } catch (ex){ + if (ex instanceof SyntaxError && !this.options.strict){ + + //fire error event + this.fire({ + type: "error", + error: ex, + message: ex.message, + line: ex.line, + col: ex.col + }); + + //skip over everything until closing brace + tt = tokenStream.advance([Tokens.RBRACE]); + if (tt === Tokens.RBRACE){ + //if there's a right brace, the rule is finished so don't do anything + } else { + //otherwise, rethrow the error because it wasn't handled properly + throw ex; + } -/***/ }), -/* 272 */ -/***/ (function(module, exports, __webpack_require__) { + } else { + //not a syntax error, rethrow it + throw ex; + } -"use strict"; + //trigger parser to continue + return true; + } -var IfObservable_1 = __webpack_require__(253); -exports._if = IfObservable_1.IfObservable.create; -//# sourceMappingURL=if.js.map + //if it got here, all selectors parsed + if (selectors){ -/***/ }), -/* 273 */ -/***/ (function(module, exports, __webpack_require__) { + this.fire({ + type: "startrule", + selectors: selectors, + line: selectors[0].line, + col: selectors[0].col + }); -"use strict"; + this._readDeclarations(true); -var IntervalObservable_1 = __webpack_require__(254); -exports.interval = IntervalObservable_1.IntervalObservable.create; -//# sourceMappingURL=interval.js.map + this.fire({ + type: "endrule", + selectors: selectors, + line: selectors[0].line, + col: selectors[0].col + }); -/***/ }), -/* 274 */ -/***/ (function(module, exports, __webpack_require__) { + } -"use strict"; + return selectors; -var NeverObservable_1 = __webpack_require__(255); -exports.never = NeverObservable_1.NeverObservable.create; -//# sourceMappingURL=never.js.map + }, -/***/ }), -/* 275 */ -/***/ (function(module, exports, __webpack_require__) { + //CSS3 Selectors + _selectors_group: function(){ + + /* + * selectors_group + * : selector [ COMMA S* selector ]* + * ; + */ + var tokenStream = this._tokenStream, + selectors = [], + selector; + + selector = this._selector(); + if (selector !== null){ + + selectors.push(selector); + while(tokenStream.match(Tokens.COMMA)){ + this._readWhitespace(); + selector = this._selector(); + if (selector !== null){ + selectors.push(selector); + } else { + this._unexpectedToken(tokenStream.LT(1)); + } + } + } -"use strict"; + return selectors.length ? selectors : null; + }, -var PairsObservable_1 = __webpack_require__(256); -exports.pairs = PairsObservable_1.PairsObservable.create; -//# sourceMappingURL=pairs.js.map + //CSS3 Selectors + _selector: function(){ + /* + * selector + * : simple_selector_sequence [ combinator simple_selector_sequence ]* + * ; + */ + + var tokenStream = this._tokenStream, + selector = [], + nextSelector = null, + combinator = null, + ws = null; + + //if there's no simple selector, then there's no selector + nextSelector = this._simple_selector_sequence(); + if (nextSelector === null){ + return null; + } -/***/ }), -/* 276 */ -/***/ (function(module, exports, __webpack_require__) { + selector.push(nextSelector); -"use strict"; + do { -var RangeObservable_1 = __webpack_require__(257); -exports.range = RangeObservable_1.RangeObservable.create; -//# sourceMappingURL=range.js.map + //look for a combinator + combinator = this._combinator(); -/***/ }), -/* 277 */ -/***/ (function(module, exports, __webpack_require__) { + if (combinator !== null){ + selector.push(combinator); + nextSelector = this._simple_selector_sequence(); -"use strict"; + //there must be a next selector + if (nextSelector === null){ + this._unexpectedToken(tokenStream.LT(1)); + } else { -var ErrorObservable_1 = __webpack_require__(249); -exports._throw = ErrorObservable_1.ErrorObservable.create; -//# sourceMappingURL=throw.js.map + //nextSelector is an instance of SelectorPart + selector.push(nextSelector); + } + } else { + + //if there's not whitespace, we're done + if (this._readWhitespace()){ + + //add whitespace separator + ws = new Combinator(tokenStream.token().value, tokenStream.token().startLine, tokenStream.token().startCol); + + //combinator is not required + combinator = this._combinator(); + + //selector is required if there's a combinator + nextSelector = this._simple_selector_sequence(); + if (nextSelector === null){ + if (combinator !== null){ + this._unexpectedToken(tokenStream.LT(1)); + } + } else { + + if (combinator !== null){ + selector.push(combinator); + } else { + selector.push(ws); + } + + selector.push(nextSelector); + } + } else { + break; + } -/***/ }), -/* 278 */ -/***/ (function(module, exports, __webpack_require__) { + } + } while(true); -"use strict"; + return new Selector(selector, selector[0].line, selector[0].col); + }, -var TimerObservable_1 = __webpack_require__(259); -exports.timer = TimerObservable_1.TimerObservable.create; -//# sourceMappingURL=timer.js.map + //CSS3 Selectors + _simple_selector_sequence: function(){ + /* + * simple_selector_sequence + * : [ type_selector | universal ] + * [ HASH | class | attrib | pseudo | negation ]* + * | [ HASH | class | attrib | pseudo | negation ]+ + * ; + */ + + var tokenStream = this._tokenStream, + + //parts of a simple selector + elementName = null, + modifiers = [], + + //complete selector text + selectorText= "", + + //the different parts after the element name to search for + components = [ + //HASH + function(){ + return tokenStream.match(Tokens.HASH) ? + new SelectorSubPart(tokenStream.token().value, "id", tokenStream.token().startLine, tokenStream.token().startCol) : + null; + }, + this._class, + this._attrib, + this._pseudo, + this._negation + ], + i = 0, + len = components.length, + component = null, + line, + col; + + + //get starting line and column for the selector + line = tokenStream.LT(1).startLine; + col = tokenStream.LT(1).startCol; + + elementName = this._type_selector(); + if (!elementName){ + elementName = this._universal(); + } -/***/ }), -/* 279 */ -/***/ (function(module, exports, __webpack_require__) { + if (elementName !== null){ + selectorText += elementName; + } -"use strict"; + while(true){ -var UsingObservable_1 = __webpack_require__(260); -exports.using = UsingObservable_1.UsingObservable.create; -//# sourceMappingURL=using.js.map + //whitespace means we're done + if (tokenStream.peek() === Tokens.S){ + break; + } -/***/ }), -/* 280 */ -/***/ (function(module, exports, __webpack_require__) { + //check for each component + while(i < len && component === null){ + component = components[i++].call(this); + } -"use strict"; + if (component === null){ -var zip_1 = __webpack_require__(39); -exports.zip = zip_1.zipStatic; -//# sourceMappingURL=zip.js.map + //we don't have a selector + if (selectorText === ""){ + return null; + } else { + break; + } + } else { + i = 0; + modifiers.push(component); + selectorText += component.toString(); + component = null; + } + } -/***/ }), -/* 281 */ -/***/ (function(module, exports, __webpack_require__) { -"use strict"; + return selectorText !== "" ? + new SelectorPart(elementName, modifiers, selectorText, line, col) : + null; + }, -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; -var tryCatch_1 = __webpack_require__(7); -var errorObject_1 = __webpack_require__(5); -var OuterSubscriber_1 = __webpack_require__(4); -var subscribeToResult_1 = __webpack_require__(3); -/** - * Ignores source values for a duration determined by another Observable, then - * emits the most recent value from the source Observable, then repeats this - * process. - * - * It's like {@link auditTime}, but the silencing - * duration is determined by a second Observable. - * - * - * - * `audit` is similar to `throttle`, but emits the last value from the silenced - * time window, instead of the first value. `audit` emits the most recent value - * from the source Observable on the output Observable as soon as its internal - * timer becomes disabled, and ignores source values while the timer is enabled. - * Initially, the timer is disabled. As soon as the first source value arrives, - * the timer is enabled by calling the `durationSelector` function with the - * source value, which returns the "duration" Observable. When the duration - * Observable emits a value or completes, the timer is disabled, then the most - * recent source value is emitted on the output Observable, and this process - * repeats for the next source value. - * - * @example Emit clicks at a rate of at most one click per second - * var clicks = Rx.Observable.fromEvent(document, 'click'); - * var result = clicks.audit(ev => Rx.Observable.interval(1000)); - * result.subscribe(x => console.log(x)); - * - * @see {@link auditTime} - * @see {@link debounce} - * @see {@link delayWhen} - * @see {@link sample} - * @see {@link throttle} - * - * @param {function(value: T): SubscribableOrPromise} durationSelector A function - * that receives a value from the source Observable, for computing the silencing - * duration, returned as an Observable or a Promise. - * @return {Observable} An Observable that performs rate-limiting of - * emissions from the source Observable. - * @method audit - * @owner Observable - */ -function audit(durationSelector) { - return this.lift(new AuditOperator(durationSelector)); -} -exports.audit = audit; -var AuditOperator = (function () { - function AuditOperator(durationSelector) { - this.durationSelector = durationSelector; - } - AuditOperator.prototype.call = function (subscriber, source) { - return source.subscribe(new AuditSubscriber(subscriber, this.durationSelector)); - }; - return AuditOperator; -}()); -/** - * We need this JSDoc comment for affecting ESDoc. - * @ignore - * @extends {Ignored} - */ -var AuditSubscriber = (function (_super) { - __extends(AuditSubscriber, _super); - function AuditSubscriber(destination, durationSelector) { - _super.call(this, destination); - this.durationSelector = durationSelector; - this.hasValue = false; - } - AuditSubscriber.prototype._next = function (value) { - this.value = value; - this.hasValue = true; - if (!this.throttled) { - var duration = tryCatch_1.tryCatch(this.durationSelector)(value); - if (duration === errorObject_1.errorObject) { - this.destination.error(errorObject_1.errorObject.e); - } - else { - var innerSubscription = subscribeToResult_1.subscribeToResult(this, duration); - if (innerSubscription.closed) { - this.clearThrottle(); + //CSS3 Selectors + _type_selector: function(){ + /* + * type_selector + * : [ namespace_prefix ]? element_name + * ; + */ + + var tokenStream = this._tokenStream, + ns = this._namespace_prefix(), + elementName = this._element_name(); + + if (!elementName){ + /* + * Need to back out the namespace that was read due to both + * type_selector and universal reading namespace_prefix + * first. Kind of hacky, but only way I can figure out + * right now how to not change the grammar. + */ + if (ns){ + tokenStream.unget(); + if (ns.length > 1){ + tokenStream.unget(); + } + } + + return null; + } else { + if (ns){ + elementName.text = ns + elementName.text; + elementName.col -= ns.length; + } + return elementName; } - else { - this.add(this.throttled = innerSubscription); + }, + + //CSS3 Selectors + _class: function(){ + /* + * class + * : '.' IDENT + * ; + */ + + var tokenStream = this._tokenStream, + token; + + if (tokenStream.match(Tokens.DOT)){ + tokenStream.mustMatch(Tokens.IDENT); + token = tokenStream.token(); + return new SelectorSubPart("." + token.value, "class", token.startLine, token.startCol - 1); + } else { + return null; } - } - } - }; - AuditSubscriber.prototype.clearThrottle = function () { - var _a = this, value = _a.value, hasValue = _a.hasValue, throttled = _a.throttled; - if (throttled) { - this.remove(throttled); - this.throttled = null; - throttled.unsubscribe(); - } - if (hasValue) { - this.value = null; - this.hasValue = false; - this.destination.next(value); - } - }; - AuditSubscriber.prototype.notifyNext = function (outerValue, innerValue, outerIndex, innerIndex) { - this.clearThrottle(); - }; - AuditSubscriber.prototype.notifyComplete = function () { - this.clearThrottle(); - }; - return AuditSubscriber; -}(OuterSubscriber_1.OuterSubscriber)); -//# sourceMappingURL=audit.js.map -/***/ }), -/* 282 */ -/***/ (function(module, exports, __webpack_require__) { + }, -"use strict"; + //CSS3 Selectors + _element_name: function(){ + /* + * element_name + * : IDENT + * ; + */ -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; -var async_1 = __webpack_require__(8); -var Subscriber_1 = __webpack_require__(2); -/** - * Ignores source values for `duration` milliseconds, then emits the most recent - * value from the source Observable, then repeats this process. - * - * When it sees a source values, it ignores that plus - * the next ones for `duration` milliseconds, and then it emits the most recent - * value from the source. - * - * - * - * `auditTime` is similar to `throttleTime`, but emits the last value from the - * silenced time window, instead of the first value. `auditTime` emits the most - * recent value from the source Observable on the output Observable as soon as - * its internal timer becomes disabled, and ignores source values while the - * timer is enabled. Initially, the timer is disabled. As soon as the first - * source value arrives, the timer is enabled. After `duration` milliseconds (or - * the time unit determined internally by the optional `scheduler`) has passed, - * the timer is disabled, then the most recent source value is emitted on the - * output Observable, and this process repeats for the next source value. - * Optionally takes a {@link IScheduler} for managing timers. - * - * @example Emit clicks at a rate of at most one click per second - * var clicks = Rx.Observable.fromEvent(document, 'click'); - * var result = clicks.auditTime(1000); - * result.subscribe(x => console.log(x)); - * - * @see {@link audit} - * @see {@link debounceTime} - * @see {@link delay} - * @see {@link sampleTime} - * @see {@link throttleTime} - * - * @param {number} duration Time to wait before emitting the most recent source - * value, measured in milliseconds or the time unit determined internally - * by the optional `scheduler`. - * @param {Scheduler} [scheduler=async] The {@link IScheduler} to use for - * managing the timers that handle the rate-limiting behavior. - * @return {Observable} An Observable that performs rate-limiting of - * emissions from the source Observable. - * @method auditTime - * @owner Observable - */ -function auditTime(duration, scheduler) { - if (scheduler === void 0) { scheduler = async_1.async; } - return this.lift(new AuditTimeOperator(duration, scheduler)); -} -exports.auditTime = auditTime; -var AuditTimeOperator = (function () { - function AuditTimeOperator(duration, scheduler) { - this.duration = duration; - this.scheduler = scheduler; - } - AuditTimeOperator.prototype.call = function (subscriber, source) { - return source.subscribe(new AuditTimeSubscriber(subscriber, this.duration, this.scheduler)); - }; - return AuditTimeOperator; -}()); -/** - * We need this JSDoc comment for affecting ESDoc. - * @ignore - * @extends {Ignored} - */ -var AuditTimeSubscriber = (function (_super) { - __extends(AuditTimeSubscriber, _super); - function AuditTimeSubscriber(destination, duration, scheduler) { - _super.call(this, destination); - this.duration = duration; - this.scheduler = scheduler; - this.hasValue = false; - } - AuditTimeSubscriber.prototype._next = function (value) { - this.value = value; - this.hasValue = true; - if (!this.throttled) { - this.add(this.throttled = this.scheduler.schedule(dispatchNext, this.duration, this)); - } - }; - AuditTimeSubscriber.prototype.clearThrottle = function () { - var _a = this, value = _a.value, hasValue = _a.hasValue, throttled = _a.throttled; - if (throttled) { - this.remove(throttled); - this.throttled = null; - throttled.unsubscribe(); - } - if (hasValue) { - this.value = null; - this.hasValue = false; - this.destination.next(value); - } - }; - return AuditTimeSubscriber; -}(Subscriber_1.Subscriber)); -function dispatchNext(subscriber) { - subscriber.clearThrottle(); -} -//# sourceMappingURL=auditTime.js.map + var tokenStream = this._tokenStream, + token; -/***/ }), -/* 283 */ -/***/ (function(module, exports, __webpack_require__) { + if (tokenStream.match(Tokens.IDENT)){ + token = tokenStream.token(); + return new SelectorSubPart(token.value, "elementName", token.startLine, token.startCol); -"use strict"; + } else { + return null; + } + }, -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; -var OuterSubscriber_1 = __webpack_require__(4); -var subscribeToResult_1 = __webpack_require__(3); -/** - * Buffers the source Observable values until `closingNotifier` emits. - * - * Collects values from the past as an array, and emits - * that array only when another Observable emits. - * - * - * - * Buffers the incoming Observable values until the given `closingNotifier` - * Observable emits a value, at which point it emits the buffer on the output - * Observable and starts a new buffer internally, awaiting the next time - * `closingNotifier` emits. - * - * @example On every click, emit array of most recent interval events - * var clicks = Rx.Observable.fromEvent(document, 'click'); - * var interval = Rx.Observable.interval(1000); - * var buffered = interval.buffer(clicks); - * buffered.subscribe(x => console.log(x)); - * - * @see {@link bufferCount} - * @see {@link bufferTime} - * @see {@link bufferToggle} - * @see {@link bufferWhen} - * @see {@link window} - * - * @param {Observable} closingNotifier An Observable that signals the - * buffer to be emitted on the output Observable. - * @return {Observable} An Observable of buffers, which are arrays of - * values. - * @method buffer - * @owner Observable - */ -function buffer(closingNotifier) { - return this.lift(new BufferOperator(closingNotifier)); -} -exports.buffer = buffer; -var BufferOperator = (function () { - function BufferOperator(closingNotifier) { - this.closingNotifier = closingNotifier; - } - BufferOperator.prototype.call = function (subscriber, source) { - return source.subscribe(new BufferSubscriber(subscriber, this.closingNotifier)); - }; - return BufferOperator; -}()); -/** - * We need this JSDoc comment for affecting ESDoc. - * @ignore - * @extends {Ignored} - */ -var BufferSubscriber = (function (_super) { - __extends(BufferSubscriber, _super); - function BufferSubscriber(destination, closingNotifier) { - _super.call(this, destination); - this.buffer = []; - this.add(subscribeToResult_1.subscribeToResult(this, closingNotifier)); - } - BufferSubscriber.prototype._next = function (value) { - this.buffer.push(value); - }; - BufferSubscriber.prototype.notifyNext = function (outerValue, innerValue, outerIndex, innerIndex, innerSub) { - var buffer = this.buffer; - this.buffer = []; - this.destination.next(buffer); - }; - return BufferSubscriber; -}(OuterSubscriber_1.OuterSubscriber)); -//# sourceMappingURL=buffer.js.map + //CSS3 Selectors + _namespace_prefix: function(){ + /* + * namespace_prefix + * : [ IDENT | '*' ]? '|' + * ; + */ + var tokenStream = this._tokenStream, + value = ""; + + //verify that this is a namespace prefix + if (tokenStream.LA(1) === Tokens.PIPE || tokenStream.LA(2) === Tokens.PIPE){ + + if(tokenStream.match([Tokens.IDENT, Tokens.STAR])){ + value += tokenStream.token().value; + } -/***/ }), -/* 284 */ -/***/ (function(module, exports, __webpack_require__) { + tokenStream.mustMatch(Tokens.PIPE); + value += "|"; -"use strict"; + } -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; -var Subscriber_1 = __webpack_require__(2); -/** - * Buffers the source Observable values until the size hits the maximum - * `bufferSize` given. - * - * Collects values from the past as an array, and emits - * that array only when its size reaches `bufferSize`. - * - * - * - * Buffers a number of values from the source Observable by `bufferSize` then - * emits the buffer and clears it, and starts a new buffer each - * `startBufferEvery` values. If `startBufferEvery` is not provided or is - * `null`, then new buffers are started immediately at the start of the source - * and when each buffer closes and is emitted. - * - * @example Emit the last two click events as an array - * var clicks = Rx.Observable.fromEvent(document, 'click'); - * var buffered = clicks.bufferCount(2); - * buffered.subscribe(x => console.log(x)); - * - * @example On every click, emit the last two click events as an array - * var clicks = Rx.Observable.fromEvent(document, 'click'); - * var buffered = clicks.bufferCount(2, 1); - * buffered.subscribe(x => console.log(x)); - * - * @see {@link buffer} - * @see {@link bufferTime} - * @see {@link bufferToggle} - * @see {@link bufferWhen} - * @see {@link pairwise} - * @see {@link windowCount} - * - * @param {number} bufferSize The maximum size of the buffer emitted. - * @param {number} [startBufferEvery] Interval at which to start a new buffer. - * For example if `startBufferEvery` is `2`, then a new buffer will be started - * on every other value from the source. A new buffer is started at the - * beginning of the source by default. - * @return {Observable} An Observable of arrays of buffered values. - * @method bufferCount - * @owner Observable - */ -function bufferCount(bufferSize, startBufferEvery) { - if (startBufferEvery === void 0) { startBufferEvery = null; } - return this.lift(new BufferCountOperator(bufferSize, startBufferEvery)); -} -exports.bufferCount = bufferCount; -var BufferCountOperator = (function () { - function BufferCountOperator(bufferSize, startBufferEvery) { - this.bufferSize = bufferSize; - this.startBufferEvery = startBufferEvery; - if (!startBufferEvery || bufferSize === startBufferEvery) { - this.subscriberClass = BufferCountSubscriber; - } - else { - this.subscriberClass = BufferSkipCountSubscriber; - } - } - BufferCountOperator.prototype.call = function (subscriber, source) { - return source.subscribe(new this.subscriberClass(subscriber, this.bufferSize, this.startBufferEvery)); - }; - return BufferCountOperator; -}()); -/** - * We need this JSDoc comment for affecting ESDoc. - * @ignore - * @extends {Ignored} - */ -var BufferCountSubscriber = (function (_super) { - __extends(BufferCountSubscriber, _super); - function BufferCountSubscriber(destination, bufferSize) { - _super.call(this, destination); - this.bufferSize = bufferSize; - this.buffer = []; - } - BufferCountSubscriber.prototype._next = function (value) { - var buffer = this.buffer; - buffer.push(value); - if (buffer.length == this.bufferSize) { - this.destination.next(buffer); - this.buffer = []; - } - }; - BufferCountSubscriber.prototype._complete = function () { - var buffer = this.buffer; - if (buffer.length > 0) { - this.destination.next(buffer); - } - _super.prototype._complete.call(this); - }; - return BufferCountSubscriber; -}(Subscriber_1.Subscriber)); -/** - * We need this JSDoc comment for affecting ESDoc. - * @ignore - * @extends {Ignored} - */ -var BufferSkipCountSubscriber = (function (_super) { - __extends(BufferSkipCountSubscriber, _super); - function BufferSkipCountSubscriber(destination, bufferSize, startBufferEvery) { - _super.call(this, destination); - this.bufferSize = bufferSize; - this.startBufferEvery = startBufferEvery; - this.buffers = []; - this.count = 0; - } - BufferSkipCountSubscriber.prototype._next = function (value) { - var _a = this, bufferSize = _a.bufferSize, startBufferEvery = _a.startBufferEvery, buffers = _a.buffers, count = _a.count; - this.count++; - if (count % startBufferEvery === 0) { - buffers.push([]); - } - for (var i = buffers.length; i--;) { - var buffer = buffers[i]; - buffer.push(value); - if (buffer.length === bufferSize) { - buffers.splice(i, 1); - this.destination.next(buffer); - } - } - }; - BufferSkipCountSubscriber.prototype._complete = function () { - var _a = this, buffers = _a.buffers, destination = _a.destination; - while (buffers.length > 0) { - var buffer = buffers.shift(); - if (buffer.length > 0) { - destination.next(buffer); - } - } - _super.prototype._complete.call(this); - }; - return BufferSkipCountSubscriber; -}(Subscriber_1.Subscriber)); -//# sourceMappingURL=bufferCount.js.map + return value.length ? value : null; + }, + + //CSS3 Selectors + _universal: function(){ + /* + * universal + * : [ namespace_prefix ]? '*' + * ; + */ + var tokenStream = this._tokenStream, + value = "", + ns; + + ns = this._namespace_prefix(); + if(ns){ + value += ns; + } + + if(tokenStream.match(Tokens.STAR)){ + value += "*"; + } -/***/ }), -/* 285 */ -/***/ (function(module, exports, __webpack_require__) { + return value.length ? value : null; + + }, + + //CSS3 Selectors + _attrib: function(){ + /* + * attrib + * : '[' S* [ namespace_prefix ]? IDENT S* + * [ [ PREFIXMATCH | + * SUFFIXMATCH | + * SUBSTRINGMATCH | + * '=' | + * INCLUDES | + * DASHMATCH ] S* [ IDENT | STRING ] S* + * ]? ']' + * ; + */ + + var tokenStream = this._tokenStream, + value = null, + ns, + token; + + if (tokenStream.match(Tokens.LBRACKET)){ + token = tokenStream.token(); + value = token.value; + value += this._readWhitespace(); + + ns = this._namespace_prefix(); + + if (ns){ + value += ns; + } -"use strict"; + tokenStream.mustMatch(Tokens.IDENT); + value += tokenStream.token().value; + value += this._readWhitespace(); -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; -var async_1 = __webpack_require__(8); -var Subscriber_1 = __webpack_require__(2); -var isScheduler_1 = __webpack_require__(13); -/* tslint:enable:max-line-length */ -/** - * Buffers the source Observable values for a specific time period. - * - * Collects values from the past as an array, and emits - * those arrays periodically in time. - * - * - * - * Buffers values from the source for a specific time duration `bufferTimeSpan`. - * Unless the optional argument `bufferCreationInterval` is given, it emits and - * resets the buffer every `bufferTimeSpan` milliseconds. If - * `bufferCreationInterval` is given, this operator opens the buffer every - * `bufferCreationInterval` milliseconds and closes (emits and resets) the - * buffer every `bufferTimeSpan` milliseconds. When the optional argument - * `maxBufferSize` is specified, the buffer will be closed either after - * `bufferTimeSpan` milliseconds or when it contains `maxBufferSize` elements. - * - * @example Every second, emit an array of the recent click events - * var clicks = Rx.Observable.fromEvent(document, 'click'); - * var buffered = clicks.bufferTime(1000); - * buffered.subscribe(x => console.log(x)); - * - * @example Every 5 seconds, emit the click events from the next 2 seconds - * var clicks = Rx.Observable.fromEvent(document, 'click'); - * var buffered = clicks.bufferTime(2000, 5000); - * buffered.subscribe(x => console.log(x)); - * - * @see {@link buffer} - * @see {@link bufferCount} - * @see {@link bufferToggle} - * @see {@link bufferWhen} - * @see {@link windowTime} - * - * @param {number} bufferTimeSpan The amount of time to fill each buffer array. - * @param {number} [bufferCreationInterval] The interval at which to start new - * buffers. - * @param {number} [maxBufferSize] The maximum buffer size. - * @param {Scheduler} [scheduler=async] The scheduler on which to schedule the - * intervals that determine buffer boundaries. - * @return {Observable} An observable of arrays of buffered values. - * @method bufferTime - * @owner Observable - */ -function bufferTime(bufferTimeSpan) { - var length = arguments.length; - var scheduler = async_1.async; - if (isScheduler_1.isScheduler(arguments[arguments.length - 1])) { - scheduler = arguments[arguments.length - 1]; - length--; - } - var bufferCreationInterval = null; - if (length >= 2) { - bufferCreationInterval = arguments[1]; - } - var maxBufferSize = Number.POSITIVE_INFINITY; - if (length >= 3) { - maxBufferSize = arguments[2]; - } - return this.lift(new BufferTimeOperator(bufferTimeSpan, bufferCreationInterval, maxBufferSize, scheduler)); -} -exports.bufferTime = bufferTime; -var BufferTimeOperator = (function () { - function BufferTimeOperator(bufferTimeSpan, bufferCreationInterval, maxBufferSize, scheduler) { - this.bufferTimeSpan = bufferTimeSpan; - this.bufferCreationInterval = bufferCreationInterval; - this.maxBufferSize = maxBufferSize; - this.scheduler = scheduler; - } - BufferTimeOperator.prototype.call = function (subscriber, source) { - return source.subscribe(new BufferTimeSubscriber(subscriber, this.bufferTimeSpan, this.bufferCreationInterval, this.maxBufferSize, this.scheduler)); - }; - return BufferTimeOperator; -}()); -var Context = (function () { - function Context() { - this.buffer = []; - } - return Context; -}()); -/** - * We need this JSDoc comment for affecting ESDoc. - * @ignore - * @extends {Ignored} - */ -var BufferTimeSubscriber = (function (_super) { - __extends(BufferTimeSubscriber, _super); - function BufferTimeSubscriber(destination, bufferTimeSpan, bufferCreationInterval, maxBufferSize, scheduler) { - _super.call(this, destination); - this.bufferTimeSpan = bufferTimeSpan; - this.bufferCreationInterval = bufferCreationInterval; - this.maxBufferSize = maxBufferSize; - this.scheduler = scheduler; - this.contexts = []; - var context = this.openContext(); - this.timespanOnly = bufferCreationInterval == null || bufferCreationInterval < 0; - if (this.timespanOnly) { - var timeSpanOnlyState = { subscriber: this, context: context, bufferTimeSpan: bufferTimeSpan }; - this.add(context.closeAction = scheduler.schedule(dispatchBufferTimeSpanOnly, bufferTimeSpan, timeSpanOnlyState)); - } - else { - var closeState = { subscriber: this, context: context }; - var creationState = { bufferTimeSpan: bufferTimeSpan, bufferCreationInterval: bufferCreationInterval, subscriber: this, scheduler: scheduler }; - this.add(context.closeAction = scheduler.schedule(dispatchBufferClose, bufferTimeSpan, closeState)); - this.add(scheduler.schedule(dispatchBufferCreation, bufferCreationInterval, creationState)); - } - } - BufferTimeSubscriber.prototype._next = function (value) { - var contexts = this.contexts; - var len = contexts.length; - var filledBufferContext; - for (var i = 0; i < len; i++) { - var context = contexts[i]; - var buffer = context.buffer; - buffer.push(value); - if (buffer.length == this.maxBufferSize) { - filledBufferContext = context; - } - } - if (filledBufferContext) { - this.onBufferFull(filledBufferContext); - } - }; - BufferTimeSubscriber.prototype._error = function (err) { - this.contexts.length = 0; - _super.prototype._error.call(this, err); - }; - BufferTimeSubscriber.prototype._complete = function () { - var _a = this, contexts = _a.contexts, destination = _a.destination; - while (contexts.length > 0) { - var context = contexts.shift(); - destination.next(context.buffer); - } - _super.prototype._complete.call(this); - }; - BufferTimeSubscriber.prototype._unsubscribe = function () { - this.contexts = null; - }; - BufferTimeSubscriber.prototype.onBufferFull = function (context) { - this.closeContext(context); - var closeAction = context.closeAction; - closeAction.unsubscribe(); - this.remove(closeAction); - if (!this.closed && this.timespanOnly) { - context = this.openContext(); - var bufferTimeSpan = this.bufferTimeSpan; - var timeSpanOnlyState = { subscriber: this, context: context, bufferTimeSpan: bufferTimeSpan }; - this.add(context.closeAction = this.scheduler.schedule(dispatchBufferTimeSpanOnly, bufferTimeSpan, timeSpanOnlyState)); - } - }; - BufferTimeSubscriber.prototype.openContext = function () { - var context = new Context(); - this.contexts.push(context); - return context; - }; - BufferTimeSubscriber.prototype.closeContext = function (context) { - this.destination.next(context.buffer); - var contexts = this.contexts; - var spliceIndex = contexts ? contexts.indexOf(context) : -1; - if (spliceIndex >= 0) { - contexts.splice(contexts.indexOf(context), 1); - } - }; - return BufferTimeSubscriber; -}(Subscriber_1.Subscriber)); -function dispatchBufferTimeSpanOnly(state) { - var subscriber = state.subscriber; - var prevContext = state.context; - if (prevContext) { - subscriber.closeContext(prevContext); - } - if (!subscriber.closed) { - state.context = subscriber.openContext(); - state.context.closeAction = this.schedule(state, state.bufferTimeSpan); - } -} -function dispatchBufferCreation(state) { - var bufferCreationInterval = state.bufferCreationInterval, bufferTimeSpan = state.bufferTimeSpan, subscriber = state.subscriber, scheduler = state.scheduler; - var context = subscriber.openContext(); - var action = this; - if (!subscriber.closed) { - subscriber.add(context.closeAction = scheduler.schedule(dispatchBufferClose, bufferTimeSpan, { subscriber: subscriber, context: context })); - action.schedule(state, bufferCreationInterval); - } -} -function dispatchBufferClose(arg) { - var subscriber = arg.subscriber, context = arg.context; - subscriber.closeContext(context); -} -//# sourceMappingURL=bufferTime.js.map + if(tokenStream.match([Tokens.PREFIXMATCH, Tokens.SUFFIXMATCH, Tokens.SUBSTRINGMATCH, + Tokens.EQUALS, Tokens.INCLUDES, Tokens.DASHMATCH])){ -/***/ }), -/* 286 */ -/***/ (function(module, exports, __webpack_require__) { + value += tokenStream.token().value; + value += this._readWhitespace(); -"use strict"; + tokenStream.mustMatch([Tokens.IDENT, Tokens.STRING]); + value += tokenStream.token().value; + value += this._readWhitespace(); + } -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; -var Subscription_1 = __webpack_require__(9); -var subscribeToResult_1 = __webpack_require__(3); -var OuterSubscriber_1 = __webpack_require__(4); -/** - * Buffers the source Observable values starting from an emission from - * `openings` and ending when the output of `closingSelector` emits. - * - * Collects values from the past as an array. Starts - * collecting only when `opening` emits, and calls the `closingSelector` - * function to get an Observable that tells when to close the buffer. - * - * - * - * Buffers values from the source by opening the buffer via signals from an - * Observable provided to `openings`, and closing and sending the buffers when - * a Subscribable or Promise returned by the `closingSelector` function emits. - * - * @example Every other second, emit the click events from the next 500ms - * var clicks = Rx.Observable.fromEvent(document, 'click'); - * var openings = Rx.Observable.interval(1000); - * var buffered = clicks.bufferToggle(openings, i => - * i % 2 ? Rx.Observable.interval(500) : Rx.Observable.empty() - * ); - * buffered.subscribe(x => console.log(x)); - * - * @see {@link buffer} - * @see {@link bufferCount} - * @see {@link bufferTime} - * @see {@link bufferWhen} - * @see {@link windowToggle} - * - * @param {SubscribableOrPromise} openings A Subscribable or Promise of notifications to start new - * buffers. - * @param {function(value: O): SubscribableOrPromise} closingSelector A function that takes - * the value emitted by the `openings` observable and returns a Subscribable or Promise, - * which, when it emits, signals that the associated buffer should be emitted - * and cleared. - * @return {Observable} An observable of arrays of buffered values. - * @method bufferToggle - * @owner Observable - */ -function bufferToggle(openings, closingSelector) { - return this.lift(new BufferToggleOperator(openings, closingSelector)); -} -exports.bufferToggle = bufferToggle; -var BufferToggleOperator = (function () { - function BufferToggleOperator(openings, closingSelector) { - this.openings = openings; - this.closingSelector = closingSelector; - } - BufferToggleOperator.prototype.call = function (subscriber, source) { - return source.subscribe(new BufferToggleSubscriber(subscriber, this.openings, this.closingSelector)); - }; - return BufferToggleOperator; -}()); -/** - * We need this JSDoc comment for affecting ESDoc. - * @ignore - * @extends {Ignored} - */ -var BufferToggleSubscriber = (function (_super) { - __extends(BufferToggleSubscriber, _super); - function BufferToggleSubscriber(destination, openings, closingSelector) { - _super.call(this, destination); - this.openings = openings; - this.closingSelector = closingSelector; - this.contexts = []; - this.add(subscribeToResult_1.subscribeToResult(this, openings)); - } - BufferToggleSubscriber.prototype._next = function (value) { - var contexts = this.contexts; - var len = contexts.length; - for (var i = 0; i < len; i++) { - contexts[i].buffer.push(value); - } - }; - BufferToggleSubscriber.prototype._error = function (err) { - var contexts = this.contexts; - while (contexts.length > 0) { - var context = contexts.shift(); - context.subscription.unsubscribe(); - context.buffer = null; - context.subscription = null; - } - this.contexts = null; - _super.prototype._error.call(this, err); - }; - BufferToggleSubscriber.prototype._complete = function () { - var contexts = this.contexts; - while (contexts.length > 0) { - var context = contexts.shift(); - this.destination.next(context.buffer); - context.subscription.unsubscribe(); - context.buffer = null; - context.subscription = null; - } - this.contexts = null; - _super.prototype._complete.call(this); - }; - BufferToggleSubscriber.prototype.notifyNext = function (outerValue, innerValue, outerIndex, innerIndex, innerSub) { - outerValue ? this.closeBuffer(outerValue) : this.openBuffer(innerValue); - }; - BufferToggleSubscriber.prototype.notifyComplete = function (innerSub) { - this.closeBuffer(innerSub.context); - }; - BufferToggleSubscriber.prototype.openBuffer = function (value) { - try { - var closingSelector = this.closingSelector; - var closingNotifier = closingSelector.call(this, value); - if (closingNotifier) { - this.trySubscribe(closingNotifier); - } - } - catch (err) { - this._error(err); - } - }; - BufferToggleSubscriber.prototype.closeBuffer = function (context) { - var contexts = this.contexts; - if (contexts && context) { - var buffer = context.buffer, subscription = context.subscription; - this.destination.next(buffer); - contexts.splice(contexts.indexOf(context), 1); - this.remove(subscription); - subscription.unsubscribe(); - } - }; - BufferToggleSubscriber.prototype.trySubscribe = function (closingNotifier) { - var contexts = this.contexts; - var buffer = []; - var subscription = new Subscription_1.Subscription(); - var context = { buffer: buffer, subscription: subscription }; - contexts.push(context); - var innerSubscription = subscribeToResult_1.subscribeToResult(this, closingNotifier, context); - if (!innerSubscription || innerSubscription.closed) { - this.closeBuffer(context); - } - else { - innerSubscription.context = context; - this.add(innerSubscription); - subscription.add(innerSubscription); - } - }; - return BufferToggleSubscriber; -}(OuterSubscriber_1.OuterSubscriber)); -//# sourceMappingURL=bufferToggle.js.map + tokenStream.mustMatch(Tokens.RBRACKET); -/***/ }), -/* 287 */ -/***/ (function(module, exports, __webpack_require__) { + return new SelectorSubPart(value + "]", "attribute", token.startLine, token.startCol); + } else { + return null; + } + }, -"use strict"; + //CSS3 Selectors + _pseudo: function(){ -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; -var Subscription_1 = __webpack_require__(9); -var tryCatch_1 = __webpack_require__(7); -var errorObject_1 = __webpack_require__(5); -var OuterSubscriber_1 = __webpack_require__(4); -var subscribeToResult_1 = __webpack_require__(3); -/** - * Buffers the source Observable values, using a factory function of closing - * Observables to determine when to close, emit, and reset the buffer. - * - * Collects values from the past as an array. When it - * starts collecting values, it calls a function that returns an Observable that - * tells when to close the buffer and restart collecting. - * - * - * - * Opens a buffer immediately, then closes the buffer when the observable - * returned by calling `closingSelector` function emits a value. When it closes - * the buffer, it immediately opens a new buffer and repeats the process. - * - * @example Emit an array of the last clicks every [1-5] random seconds - * var clicks = Rx.Observable.fromEvent(document, 'click'); - * var buffered = clicks.bufferWhen(() => - * Rx.Observable.interval(1000 + Math.random() * 4000) - * ); - * buffered.subscribe(x => console.log(x)); - * - * @see {@link buffer} - * @see {@link bufferCount} - * @see {@link bufferTime} - * @see {@link bufferToggle} - * @see {@link windowWhen} - * - * @param {function(): Observable} closingSelector A function that takes no - * arguments and returns an Observable that signals buffer closure. - * @return {Observable} An observable of arrays of buffered values. - * @method bufferWhen - * @owner Observable - */ -function bufferWhen(closingSelector) { - return this.lift(new BufferWhenOperator(closingSelector)); -} -exports.bufferWhen = bufferWhen; -var BufferWhenOperator = (function () { - function BufferWhenOperator(closingSelector) { - this.closingSelector = closingSelector; - } - BufferWhenOperator.prototype.call = function (subscriber, source) { - return source.subscribe(new BufferWhenSubscriber(subscriber, this.closingSelector)); - }; - return BufferWhenOperator; -}()); -/** - * We need this JSDoc comment for affecting ESDoc. - * @ignore - * @extends {Ignored} - */ -var BufferWhenSubscriber = (function (_super) { - __extends(BufferWhenSubscriber, _super); - function BufferWhenSubscriber(destination, closingSelector) { - _super.call(this, destination); - this.closingSelector = closingSelector; - this.subscribing = false; - this.openBuffer(); - } - BufferWhenSubscriber.prototype._next = function (value) { - this.buffer.push(value); - }; - BufferWhenSubscriber.prototype._complete = function () { - var buffer = this.buffer; - if (buffer) { - this.destination.next(buffer); - } - _super.prototype._complete.call(this); - }; - BufferWhenSubscriber.prototype._unsubscribe = function () { - this.buffer = null; - this.subscribing = false; - }; - BufferWhenSubscriber.prototype.notifyNext = function (outerValue, innerValue, outerIndex, innerIndex, innerSub) { - this.openBuffer(); - }; - BufferWhenSubscriber.prototype.notifyComplete = function () { - if (this.subscribing) { - this.complete(); - } - else { - this.openBuffer(); - } - }; - BufferWhenSubscriber.prototype.openBuffer = function () { - var closingSubscription = this.closingSubscription; - if (closingSubscription) { - this.remove(closingSubscription); - closingSubscription.unsubscribe(); - } - var buffer = this.buffer; - if (this.buffer) { - this.destination.next(buffer); - } - this.buffer = []; - var closingNotifier = tryCatch_1.tryCatch(this.closingSelector)(); - if (closingNotifier === errorObject_1.errorObject) { - this.error(errorObject_1.errorObject.e); - } - else { - closingSubscription = new Subscription_1.Subscription(); - this.closingSubscription = closingSubscription; - this.add(closingSubscription); - this.subscribing = true; - closingSubscription.add(subscribeToResult_1.subscribeToResult(this, closingNotifier)); - this.subscribing = false; - } - }; - return BufferWhenSubscriber; -}(OuterSubscriber_1.OuterSubscriber)); -//# sourceMappingURL=bufferWhen.js.map + /* + * pseudo + * : ':' ':'? [ IDENT | functional_pseudo ] + * ; + */ -/***/ }), -/* 288 */ -/***/ (function(module, exports, __webpack_require__) { + var tokenStream = this._tokenStream, + pseudo = null, + colons = ":", + line, + col; -"use strict"; + if (tokenStream.match(Tokens.COLON)){ -var combineLatest_1 = __webpack_require__(37); -/** - * Converts a higher-order Observable into a first-order Observable by waiting - * for the outer Observable to complete, then applying {@link combineLatest}. - * - * Flattens an Observable-of-Observables by applying - * {@link combineLatest} when the Observable-of-Observables completes. - * - * - * - * Takes an Observable of Observables, and collects all Observables from it. - * Once the outer Observable completes, it subscribes to all collected - * Observables and combines their values using the {@link combineLatest} - * strategy, such that: - * - Every time an inner Observable emits, the output Observable emits. - * - When the returned observable emits, it emits all of the latest values by: - * - If a `project` function is provided, it is called with each recent value - * from each inner Observable in whatever order they arrived, and the result - * of the `project` function is what is emitted by the output Observable. - * - If there is no `project` function, an array of all of the most recent - * values is emitted by the output Observable. - * - * @example Map two click events to a finite interval Observable, then apply combineAll - * var clicks = Rx.Observable.fromEvent(document, 'click'); - * var higherOrder = clicks.map(ev => - * Rx.Observable.interval(Math.random()*2000).take(3) - * ).take(2); - * var result = higherOrder.combineAll(); - * result.subscribe(x => console.log(x)); - * - * @see {@link combineLatest} - * @see {@link mergeAll} - * - * @param {function} [project] An optional function to map the most recent - * values from each inner Observable into a new result. Takes each of the most - * recent values from each collected inner Observable as arguments, in order. - * @return {Observable} An Observable of projected results or arrays of recent - * values. - * @method combineAll - * @owner Observable - */ -function combineAll(project) { - return this.lift(new combineLatest_1.CombineLatestOperator(project)); -} -exports.combineAll = combineAll; -//# sourceMappingURL=combineAll.js.map + if (tokenStream.match(Tokens.COLON)){ + colons += ":"; + } -/***/ }), -/* 289 */ -/***/ (function(module, exports, __webpack_require__) { + if (tokenStream.match(Tokens.IDENT)){ + pseudo = tokenStream.token().value; + line = tokenStream.token().startLine; + col = tokenStream.token().startCol - colons.length; + } else if (tokenStream.peek() === Tokens.FUNCTION){ + line = tokenStream.LT(1).startLine; + col = tokenStream.LT(1).startCol - colons.length; + pseudo = this._functional_pseudo(); + } -"use strict"; + if (pseudo){ + pseudo = new SelectorSubPart(colons + pseudo, "pseudo", line, col); + } + } -var mergeMapTo_1 = __webpack_require__(62); -/* tslint:enable:max-line-length */ -/** - * Projects each source value to the same Observable which is merged multiple - * times in a serialized fashion on the output Observable. - * - * It's like {@link concatMap}, but maps each value - * always to the same inner Observable. - * - * - * - * Maps each source value to the given Observable `innerObservable` regardless - * of the source value, and then flattens those resulting Observables into one - * single Observable, which is the output Observable. Each new `innerObservable` - * instance emitted on the output Observable is concatenated with the previous - * `innerObservable` instance. - * - * __Warning:__ if source values arrive endlessly and faster than their - * corresponding inner Observables can complete, it will result in memory issues - * as inner Observables amass in an unbounded buffer waiting for their turn to - * be subscribed to. - * - * Note: `concatMapTo` is equivalent to `mergeMapTo` with concurrency parameter - * set to `1`. - * - * @example For each click event, tick every second from 0 to 3, with no concurrency - * var clicks = Rx.Observable.fromEvent(document, 'click'); - * var result = clicks.concatMapTo(Rx.Observable.interval(1000).take(4)); - * result.subscribe(x => console.log(x)); - * - * // Results in the following: - * // (results are not concurrent) - * // For every click on the "document" it will emit values 0 to 3 spaced - * // on a 1000ms interval - * // one click = 1000ms-> 0 -1000ms-> 1 -1000ms-> 2 -1000ms-> 3 - * - * @see {@link concat} - * @see {@link concatAll} - * @see {@link concatMap} - * @see {@link mergeMapTo} - * @see {@link switchMapTo} - * - * @param {ObservableInput} innerObservable An Observable to replace each value from - * the source Observable. - * @param {function(outerValue: T, innerValue: I, outerIndex: number, innerIndex: number): any} [resultSelector] - * A function to produce the value on the output Observable based on the values - * and the indices of the source (outer) emission and the inner Observable - * emission. The arguments passed to this function are: - * - `outerValue`: the value that came from the source - * - `innerValue`: the value that came from the projected Observable - * - `outerIndex`: the "index" of the value that came from the source - * - `innerIndex`: the "index" of the value from the projected Observable - * @return {Observable} An observable of values merged together by joining the - * passed observable with itself, one after the other, for each value emitted - * from the source. - * @method concatMapTo - * @owner Observable - */ -function concatMapTo(innerObservable, resultSelector) { - return this.lift(new mergeMapTo_1.MergeMapToOperator(innerObservable, resultSelector, 1)); -} -exports.concatMapTo = concatMapTo; -//# sourceMappingURL=concatMapTo.js.map + return pseudo; + }, -/***/ }), -/* 290 */ -/***/ (function(module, exports, __webpack_require__) { + //CSS3 Selectors + _functional_pseudo: function(){ + /* + * functional_pseudo + * : FUNCTION S* expression ')' + * ; + */ + + var tokenStream = this._tokenStream, + value = null; + + if(tokenStream.match(Tokens.FUNCTION)){ + value = tokenStream.token().value; + value += this._readWhitespace(); + value += this._expression(); + tokenStream.mustMatch(Tokens.RPAREN); + value += ")"; + } -"use strict"; + return value; + }, -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; -var Subscriber_1 = __webpack_require__(2); -/** - * Counts the number of emissions on the source and emits that number when the - * source completes. - * - * Tells how many values were emitted, when the source - * completes. - * - * - * - * `count` transforms an Observable that emits values into an Observable that - * emits a single value that represents the number of values emitted by the - * source Observable. If the source Observable terminates with an error, `count` - * will pass this error notification along without emitting a value first. If - * the source Observable does not terminate at all, `count` will neither emit - * a value nor terminate. This operator takes an optional `predicate` function - * as argument, in which case the output emission will represent the number of - * source values that matched `true` with the `predicate`. - * - * @example Counts how many seconds have passed before the first click happened - * var seconds = Rx.Observable.interval(1000); - * var clicks = Rx.Observable.fromEvent(document, 'click'); - * var secondsBeforeClick = seconds.takeUntil(clicks); - * var result = secondsBeforeClick.count(); - * result.subscribe(x => console.log(x)); - * - * @example Counts how many odd numbers are there between 1 and 7 - * var numbers = Rx.Observable.range(1, 7); - * var result = numbers.count(i => i % 2 === 1); - * result.subscribe(x => console.log(x)); - * - * // Results in: - * // 4 - * - * @see {@link max} - * @see {@link min} - * @see {@link reduce} - * - * @param {function(value: T, i: number, source: Observable): boolean} [predicate] A - * boolean function to select what values are to be counted. It is provided with - * arguments of: - * - `value`: the value from the source Observable. - * - `index`: the (zero-based) "index" of the value from the source Observable. - * - `source`: the source Observable instance itself. - * @return {Observable} An Observable of one number that represents the count as - * described above. - * @method count - * @owner Observable - */ -function count(predicate) { - return this.lift(new CountOperator(predicate, this)); -} -exports.count = count; -var CountOperator = (function () { - function CountOperator(predicate, source) { - this.predicate = predicate; - this.source = source; - } - CountOperator.prototype.call = function (subscriber, source) { - return source.subscribe(new CountSubscriber(subscriber, this.predicate, this.source)); - }; - return CountOperator; -}()); -/** - * We need this JSDoc comment for affecting ESDoc. - * @ignore - * @extends {Ignored} - */ -var CountSubscriber = (function (_super) { - __extends(CountSubscriber, _super); - function CountSubscriber(destination, predicate, source) { - _super.call(this, destination); - this.predicate = predicate; - this.source = source; - this.count = 0; - this.index = 0; - } - CountSubscriber.prototype._next = function (value) { - if (this.predicate) { - this._tryPredicate(value); - } - else { - this.count++; - } - }; - CountSubscriber.prototype._tryPredicate = function (value) { - var result; - try { - result = this.predicate(value, this.index++, this.source); - } - catch (err) { - this.destination.error(err); - return; - } - if (result) { - this.count++; - } - }; - CountSubscriber.prototype._complete = function () { - this.destination.next(this.count); - this.destination.complete(); - }; - return CountSubscriber; -}(Subscriber_1.Subscriber)); -//# sourceMappingURL=count.js.map + //CSS3 Selectors + _expression: function(){ + /* + * expression + * : [ [ PLUS | '-' | DIMENSION | NUMBER | STRING | IDENT ] S* ]+ + * ; + */ + + var tokenStream = this._tokenStream, + value = ""; + + while(tokenStream.match([Tokens.PLUS, Tokens.MINUS, Tokens.DIMENSION, + Tokens.NUMBER, Tokens.STRING, Tokens.IDENT, Tokens.LENGTH, + Tokens.FREQ, Tokens.ANGLE, Tokens.TIME, + Tokens.RESOLUTION, Tokens.SLASH])){ + + value += tokenStream.token().value; + value += this._readWhitespace(); + } + + return value.length ? value : null; + + }, + + //CSS3 Selectors + _negation: function(){ + /* + * negation + * : NOT S* negation_arg S* ')' + * ; + */ + + var tokenStream = this._tokenStream, + line, + col, + value = "", + arg, + subpart = null; + + if (tokenStream.match(Tokens.NOT)){ + value = tokenStream.token().value; + line = tokenStream.token().startLine; + col = tokenStream.token().startCol; + value += this._readWhitespace(); + arg = this._negation_arg(); + value += arg; + value += this._readWhitespace(); + tokenStream.match(Tokens.RPAREN); + value += tokenStream.token().value; + + subpart = new SelectorSubPart(value, "not", line, col); + subpart.args.push(arg); + } + + return subpart; + }, + + //CSS3 Selectors + _negation_arg: function(){ + /* + * negation_arg + * : type_selector | universal | HASH | class | attrib | pseudo + * ; + */ + + var tokenStream = this._tokenStream, + args = [ + this._type_selector, + this._universal, + function(){ + return tokenStream.match(Tokens.HASH) ? + new SelectorSubPart(tokenStream.token().value, "id", tokenStream.token().startLine, tokenStream.token().startCol) : + null; + }, + this._class, + this._attrib, + this._pseudo + ], + arg = null, + i = 0, + len = args.length, + line, + col, + part; + + line = tokenStream.LT(1).startLine; + col = tokenStream.LT(1).startCol; + + while(i < len && arg === null){ + + arg = args[i].call(this); + i++; + } + + //must be a negation arg + if (arg === null){ + this._unexpectedToken(tokenStream.LT(1)); + } + + //it's an element name + if (arg.type === "elementName"){ + part = new SelectorPart(arg, [], arg.toString(), line, col); + } else { + part = new SelectorPart(null, [arg], arg.toString(), line, col); + } + + return part; + }, + + _declaration: function(){ + + /* + * declaration + * : property ':' S* expr prio? + * | /( empty )/ + * ; + */ + + var tokenStream = this._tokenStream, + property = null, + expr = null, + prio = null, + invalid = null, + propertyName= ""; + + property = this._property(); + if (property !== null){ -/***/ }), -/* 291 */ -/***/ (function(module, exports, __webpack_require__) { + tokenStream.mustMatch(Tokens.COLON); + this._readWhitespace(); -"use strict"; + expr = this._expr(); -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; -var OuterSubscriber_1 = __webpack_require__(4); -var subscribeToResult_1 = __webpack_require__(3); -/** - * Emits a value from the source Observable only after a particular time span - * determined by another Observable has passed without another source emission. - * - * It's like {@link debounceTime}, but the time span of - * emission silence is determined by a second Observable. - * - * - * - * `debounce` delays values emitted by the source Observable, but drops previous - * pending delayed emissions if a new value arrives on the source Observable. - * This operator keeps track of the most recent value from the source - * Observable, and spawns a duration Observable by calling the - * `durationSelector` function. The value is emitted only when the duration - * Observable emits a value or completes, and if no other value was emitted on - * the source Observable since the duration Observable was spawned. If a new - * value appears before the duration Observable emits, the previous value will - * be dropped and will not be emitted on the output Observable. - * - * Like {@link debounceTime}, this is a rate-limiting operator, and also a - * delay-like operator since output emissions do not necessarily occur at the - * same time as they did on the source Observable. - * - * @example Emit the most recent click after a burst of clicks - * var clicks = Rx.Observable.fromEvent(document, 'click'); - * var result = clicks.debounce(() => Rx.Observable.interval(1000)); - * result.subscribe(x => console.log(x)); - * - * @see {@link audit} - * @see {@link debounceTime} - * @see {@link delayWhen} - * @see {@link throttle} - * - * @param {function(value: T): SubscribableOrPromise} durationSelector A function - * that receives a value from the source Observable, for computing the timeout - * duration for each source value, returned as an Observable or a Promise. - * @return {Observable} An Observable that delays the emissions of the source - * Observable by the specified duration Observable returned by - * `durationSelector`, and may drop some values if they occur too frequently. - * @method debounce - * @owner Observable - */ -function debounce(durationSelector) { - return this.lift(new DebounceOperator(durationSelector)); -} -exports.debounce = debounce; -var DebounceOperator = (function () { - function DebounceOperator(durationSelector) { - this.durationSelector = durationSelector; - } - DebounceOperator.prototype.call = function (subscriber, source) { - return source.subscribe(new DebounceSubscriber(subscriber, this.durationSelector)); - }; - return DebounceOperator; -}()); -/** - * We need this JSDoc comment for affecting ESDoc. - * @ignore - * @extends {Ignored} - */ -var DebounceSubscriber = (function (_super) { - __extends(DebounceSubscriber, _super); - function DebounceSubscriber(destination, durationSelector) { - _super.call(this, destination); - this.durationSelector = durationSelector; - this.hasValue = false; - this.durationSubscription = null; - } - DebounceSubscriber.prototype._next = function (value) { - try { - var result = this.durationSelector.call(this, value); - if (result) { - this._tryNext(value, result); - } - } - catch (err) { - this.destination.error(err); - } - }; - DebounceSubscriber.prototype._complete = function () { - this.emitValue(); - this.destination.complete(); - }; - DebounceSubscriber.prototype._tryNext = function (value, duration) { - var subscription = this.durationSubscription; - this.value = value; - this.hasValue = true; - if (subscription) { - subscription.unsubscribe(); - this.remove(subscription); - } - subscription = subscribeToResult_1.subscribeToResult(this, duration); - if (!subscription.closed) { - this.add(this.durationSubscription = subscription); - } - }; - DebounceSubscriber.prototype.notifyNext = function (outerValue, innerValue, outerIndex, innerIndex, innerSub) { - this.emitValue(); - }; - DebounceSubscriber.prototype.notifyComplete = function () { - this.emitValue(); - }; - DebounceSubscriber.prototype.emitValue = function () { - if (this.hasValue) { - var value = this.value; - var subscription = this.durationSubscription; - if (subscription) { - this.durationSubscription = null; - subscription.unsubscribe(); - this.remove(subscription); - } - this.value = null; - this.hasValue = false; - _super.prototype._next.call(this, value); - } - }; - return DebounceSubscriber; -}(OuterSubscriber_1.OuterSubscriber)); -//# sourceMappingURL=debounce.js.map + //if there's no parts for the value, it's an error + if (!expr || expr.length === 0){ + this._unexpectedToken(tokenStream.LT(1)); + } -/***/ }), -/* 292 */ -/***/ (function(module, exports, __webpack_require__) { + prio = this._prio(); -"use strict"; + /* + * If hacks should be allowed, then only check the root + * property. If hacks should not be allowed, treat + * _property or *property as invalid properties. + */ + propertyName = property.toString(); + if (this.options.starHack && property.hack === "*" || + this.options.underscoreHack && property.hack === "_") { -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; -var Subscriber_1 = __webpack_require__(2); -var async_1 = __webpack_require__(8); -/** - * Emits a value from the source Observable only after a particular time span - * has passed without another source emission. - * - * It's like {@link delay}, but passes only the most - * recent value from each burst of emissions. - * - * - * - * `debounceTime` delays values emitted by the source Observable, but drops - * previous pending delayed emissions if a new value arrives on the source - * Observable. This operator keeps track of the most recent value from the - * source Observable, and emits that only when `dueTime` enough time has passed - * without any other value appearing on the source Observable. If a new value - * appears before `dueTime` silence occurs, the previous value will be dropped - * and will not be emitted on the output Observable. - * - * This is a rate-limiting operator, because it is impossible for more than one - * value to be emitted in any time window of duration `dueTime`, but it is also - * a delay-like operator since output emissions do not occur at the same time as - * they did on the source Observable. Optionally takes a {@link IScheduler} for - * managing timers. - * - * @example Emit the most recent click after a burst of clicks - * var clicks = Rx.Observable.fromEvent(document, 'click'); - * var result = clicks.debounceTime(1000); - * result.subscribe(x => console.log(x)); - * - * @see {@link auditTime} - * @see {@link debounce} - * @see {@link delay} - * @see {@link sampleTime} - * @see {@link throttleTime} - * - * @param {number} dueTime The timeout duration in milliseconds (or the time - * unit determined internally by the optional `scheduler`) for the window of - * time required to wait for emission silence before emitting the most recent - * source value. - * @param {Scheduler} [scheduler=async] The {@link IScheduler} to use for - * managing the timers that handle the timeout for each value. - * @return {Observable} An Observable that delays the emissions of the source - * Observable by the specified `dueTime`, and may drop some values if they occur - * too frequently. - * @method debounceTime - * @owner Observable - */ -function debounceTime(dueTime, scheduler) { - if (scheduler === void 0) { scheduler = async_1.async; } - return this.lift(new DebounceTimeOperator(dueTime, scheduler)); -} -exports.debounceTime = debounceTime; -var DebounceTimeOperator = (function () { - function DebounceTimeOperator(dueTime, scheduler) { - this.dueTime = dueTime; - this.scheduler = scheduler; - } - DebounceTimeOperator.prototype.call = function (subscriber, source) { - return source.subscribe(new DebounceTimeSubscriber(subscriber, this.dueTime, this.scheduler)); - }; - return DebounceTimeOperator; -}()); -/** - * We need this JSDoc comment for affecting ESDoc. - * @ignore - * @extends {Ignored} - */ -var DebounceTimeSubscriber = (function (_super) { - __extends(DebounceTimeSubscriber, _super); - function DebounceTimeSubscriber(destination, dueTime, scheduler) { - _super.call(this, destination); - this.dueTime = dueTime; - this.scheduler = scheduler; - this.debouncedSubscription = null; - this.lastValue = null; - this.hasValue = false; - } - DebounceTimeSubscriber.prototype._next = function (value) { - this.clearDebounce(); - this.lastValue = value; - this.hasValue = true; - this.add(this.debouncedSubscription = this.scheduler.schedule(dispatchNext, this.dueTime, this)); - }; - DebounceTimeSubscriber.prototype._complete = function () { - this.debouncedNext(); - this.destination.complete(); - }; - DebounceTimeSubscriber.prototype.debouncedNext = function () { - this.clearDebounce(); - if (this.hasValue) { - this.destination.next(this.lastValue); - this.lastValue = null; - this.hasValue = false; - } - }; - DebounceTimeSubscriber.prototype.clearDebounce = function () { - var debouncedSubscription = this.debouncedSubscription; - if (debouncedSubscription !== null) { - this.remove(debouncedSubscription); - debouncedSubscription.unsubscribe(); - this.debouncedSubscription = null; - } - }; - return DebounceTimeSubscriber; -}(Subscriber_1.Subscriber)); -function dispatchNext(subscriber) { - subscriber.debouncedNext(); -} -//# sourceMappingURL=debounceTime.js.map + propertyName = property.text; + } -/***/ }), -/* 293 */ -/***/ (function(module, exports, __webpack_require__) { + try { + this._validateProperty(propertyName, expr); + } catch (ex) { + invalid = ex; + } -"use strict"; + this.fire({ + type: "property", + property: property, + value: expr, + important: prio, + line: property.line, + col: property.col, + invalid: invalid + }); -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; -var Subscriber_1 = __webpack_require__(2); -/* tslint:enable:max-line-length */ -/** - * Emits a given value if the source Observable completes without emitting any - * `next` value, otherwise mirrors the source Observable. - * - * If the source Observable turns out to be empty, then - * this operator will emit a default value. - * - * - * - * `defaultIfEmpty` emits the values emitted by the source Observable or a - * specified default value if the source Observable is empty (completes without - * having emitted any `next` value). - * - * @example If no clicks happen in 5 seconds, then emit "no clicks" - * var clicks = Rx.Observable.fromEvent(document, 'click'); - * var clicksBeforeFive = clicks.takeUntil(Rx.Observable.interval(5000)); - * var result = clicksBeforeFive.defaultIfEmpty('no clicks'); - * result.subscribe(x => console.log(x)); - * - * @see {@link empty} - * @see {@link last} - * - * @param {any} [defaultValue=null] The default value used if the source - * Observable is empty. - * @return {Observable} An Observable that emits either the specified - * `defaultValue` if the source Observable emits no items, or the values emitted - * by the source Observable. - * @method defaultIfEmpty - * @owner Observable - */ -function defaultIfEmpty(defaultValue) { - if (defaultValue === void 0) { defaultValue = null; } - return this.lift(new DefaultIfEmptyOperator(defaultValue)); -} -exports.defaultIfEmpty = defaultIfEmpty; -var DefaultIfEmptyOperator = (function () { - function DefaultIfEmptyOperator(defaultValue) { - this.defaultValue = defaultValue; - } - DefaultIfEmptyOperator.prototype.call = function (subscriber, source) { - return source.subscribe(new DefaultIfEmptySubscriber(subscriber, this.defaultValue)); - }; - return DefaultIfEmptyOperator; -}()); -/** - * We need this JSDoc comment for affecting ESDoc. - * @ignore - * @extends {Ignored} - */ -var DefaultIfEmptySubscriber = (function (_super) { - __extends(DefaultIfEmptySubscriber, _super); - function DefaultIfEmptySubscriber(destination, defaultValue) { - _super.call(this, destination); - this.defaultValue = defaultValue; - this.isEmpty = true; - } - DefaultIfEmptySubscriber.prototype._next = function (value) { - this.isEmpty = false; - this.destination.next(value); - }; - DefaultIfEmptySubscriber.prototype._complete = function () { - if (this.isEmpty) { - this.destination.next(this.defaultValue); - } - this.destination.complete(); - }; - return DefaultIfEmptySubscriber; -}(Subscriber_1.Subscriber)); -//# sourceMappingURL=defaultIfEmpty.js.map + return true; + } else { + return false; + } + }, -/***/ }), -/* 294 */ -/***/ (function(module, exports, __webpack_require__) { + _prio: function(){ + /* + * prio + * : IMPORTANT_SYM S* + * ; + */ -"use strict"; + var tokenStream = this._tokenStream, + result = tokenStream.match(Tokens.IMPORTANT_SYM); -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; -var async_1 = __webpack_require__(8); -var isDate_1 = __webpack_require__(27); -var Subscriber_1 = __webpack_require__(2); -var Notification_1 = __webpack_require__(30); -/** - * Delays the emission of items from the source Observable by a given timeout or - * until a given Date. - * - * Time shifts each item by some specified amount of - * milliseconds. - * - * - * - * If the delay argument is a Number, this operator time shifts the source - * Observable by that amount of time expressed in milliseconds. The relative - * time intervals between the values are preserved. - * - * If the delay argument is a Date, this operator time shifts the start of the - * Observable execution until the given date occurs. - * - * @example Delay each click by one second - * var clicks = Rx.Observable.fromEvent(document, 'click'); - * var delayedClicks = clicks.delay(1000); // each click emitted after 1 second - * delayedClicks.subscribe(x => console.log(x)); - * - * @example Delay all clicks until a future date happens - * var clicks = Rx.Observable.fromEvent(document, 'click'); - * var date = new Date('March 15, 2050 12:00:00'); // in the future - * var delayedClicks = clicks.delay(date); // click emitted only after that date - * delayedClicks.subscribe(x => console.log(x)); - * - * @see {@link debounceTime} - * @see {@link delayWhen} - * - * @param {number|Date} delay The delay duration in milliseconds (a `number`) or - * a `Date` until which the emission of the source items is delayed. - * @param {Scheduler} [scheduler=async] The IScheduler to use for - * managing the timers that handle the time-shift for each item. - * @return {Observable} An Observable that delays the emissions of the source - * Observable by the specified timeout or Date. - * @method delay - * @owner Observable - */ -function delay(delay, scheduler) { - if (scheduler === void 0) { scheduler = async_1.async; } - var absoluteDelay = isDate_1.isDate(delay); - var delayFor = absoluteDelay ? (+delay - scheduler.now()) : Math.abs(delay); - return this.lift(new DelayOperator(delayFor, scheduler)); -} -exports.delay = delay; -var DelayOperator = (function () { - function DelayOperator(delay, scheduler) { - this.delay = delay; - this.scheduler = scheduler; - } - DelayOperator.prototype.call = function (subscriber, source) { - return source.subscribe(new DelaySubscriber(subscriber, this.delay, this.scheduler)); - }; - return DelayOperator; -}()); -/** - * We need this JSDoc comment for affecting ESDoc. - * @ignore - * @extends {Ignored} - */ -var DelaySubscriber = (function (_super) { - __extends(DelaySubscriber, _super); - function DelaySubscriber(destination, delay, scheduler) { - _super.call(this, destination); - this.delay = delay; - this.scheduler = scheduler; - this.queue = []; - this.active = false; - this.errored = false; - } - DelaySubscriber.dispatch = function (state) { - var source = state.source; - var queue = source.queue; - var scheduler = state.scheduler; - var destination = state.destination; - while (queue.length > 0 && (queue[0].time - scheduler.now()) <= 0) { - queue.shift().notification.observe(destination); - } - if (queue.length > 0) { - var delay_1 = Math.max(0, queue[0].time - scheduler.now()); - this.schedule(state, delay_1); - } - else { - source.active = false; - } - }; - DelaySubscriber.prototype._schedule = function (scheduler) { - this.active = true; - this.add(scheduler.schedule(DelaySubscriber.dispatch, this.delay, { - source: this, destination: this.destination, scheduler: scheduler - })); - }; - DelaySubscriber.prototype.scheduleNotification = function (notification) { - if (this.errored === true) { - return; - } - var scheduler = this.scheduler; - var message = new DelayMessage(scheduler.now() + this.delay, notification); - this.queue.push(message); - if (this.active === false) { - this._schedule(scheduler); - } - }; - DelaySubscriber.prototype._next = function (value) { - this.scheduleNotification(Notification_1.Notification.createNext(value)); - }; - DelaySubscriber.prototype._error = function (err) { - this.errored = true; - this.queue = []; - this.destination.error(err); - }; - DelaySubscriber.prototype._complete = function () { - this.scheduleNotification(Notification_1.Notification.createComplete()); - }; - return DelaySubscriber; -}(Subscriber_1.Subscriber)); -var DelayMessage = (function () { - function DelayMessage(time, notification) { - this.time = time; - this.notification = notification; - } - return DelayMessage; -}()); -//# sourceMappingURL=delay.js.map + this._readWhitespace(); + return result; + }, -/***/ }), -/* 295 */ -/***/ (function(module, exports, __webpack_require__) { + _expr: function(inFunction){ + /* + * expr + * : term [ operator term ]* + * ; + */ + + var values = [], + //valueParts = [], + value = null, + operator = null; + + value = this._term(inFunction); + if (value !== null){ + + values.push(value); + + do { + operator = this._operator(inFunction); + + //if there's an operator, keep building up the value parts + if (operator){ + values.push(operator); + } /*else { + //if there's not an operator, you have a full value + values.push(new PropertyValue(valueParts, valueParts[0].line, valueParts[0].col)); + valueParts = []; + }*/ + + value = this._term(inFunction); + + if (value === null){ + break; + } else { + values.push(value); + } + } while(true); + } -"use strict"; + //cleanup + /*if (valueParts.length){ + values.push(new PropertyValue(valueParts, valueParts[0].line, valueParts[0].col)); + }*/ -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; -var Subscriber_1 = __webpack_require__(2); -var Observable_1 = __webpack_require__(0); -var OuterSubscriber_1 = __webpack_require__(4); -var subscribeToResult_1 = __webpack_require__(3); -/** - * Delays the emission of items from the source Observable by a given time span - * determined by the emissions of another Observable. - * - * It's like {@link delay}, but the time span of the - * delay duration is determined by a second Observable. - * - * - * - * `delayWhen` time shifts each emitted value from the source Observable by a - * time span determined by another Observable. When the source emits a value, - * the `delayDurationSelector` function is called with the source value as - * argument, and should return an Observable, called the "duration" Observable. - * The source value is emitted on the output Observable only when the duration - * Observable emits a value or completes. - * - * Optionally, `delayWhen` takes a second argument, `subscriptionDelay`, which - * is an Observable. When `subscriptionDelay` emits its first value or - * completes, the source Observable is subscribed to and starts behaving like - * described in the previous paragraph. If `subscriptionDelay` is not provided, - * `delayWhen` will subscribe to the source Observable as soon as the output - * Observable is subscribed. - * - * @example Delay each click by a random amount of time, between 0 and 5 seconds - * var clicks = Rx.Observable.fromEvent(document, 'click'); - * var delayedClicks = clicks.delayWhen(event => - * Rx.Observable.interval(Math.random() * 5000) - * ); - * delayedClicks.subscribe(x => console.log(x)); - * - * @see {@link debounce} - * @see {@link delay} - * - * @param {function(value: T): Observable} delayDurationSelector A function that - * returns an Observable for each value emitted by the source Observable, which - * is then used to delay the emission of that item on the output Observable - * until the Observable returned from this function emits a value. - * @param {Observable} subscriptionDelay An Observable that triggers the - * subscription to the source Observable once it emits any value. - * @return {Observable} An Observable that delays the emissions of the source - * Observable by an amount of time specified by the Observable returned by - * `delayDurationSelector`. - * @method delayWhen - * @owner Observable - */ -function delayWhen(delayDurationSelector, subscriptionDelay) { - if (subscriptionDelay) { - return new SubscriptionDelayObservable(this, subscriptionDelay) - .lift(new DelayWhenOperator(delayDurationSelector)); - } - return this.lift(new DelayWhenOperator(delayDurationSelector)); -} -exports.delayWhen = delayWhen; -var DelayWhenOperator = (function () { - function DelayWhenOperator(delayDurationSelector) { - this.delayDurationSelector = delayDurationSelector; - } - DelayWhenOperator.prototype.call = function (subscriber, source) { - return source.subscribe(new DelayWhenSubscriber(subscriber, this.delayDurationSelector)); - }; - return DelayWhenOperator; -}()); -/** - * We need this JSDoc comment for affecting ESDoc. - * @ignore - * @extends {Ignored} - */ -var DelayWhenSubscriber = (function (_super) { - __extends(DelayWhenSubscriber, _super); - function DelayWhenSubscriber(destination, delayDurationSelector) { - _super.call(this, destination); - this.delayDurationSelector = delayDurationSelector; - this.completed = false; - this.delayNotifierSubscriptions = []; - this.values = []; - } - DelayWhenSubscriber.prototype.notifyNext = function (outerValue, innerValue, outerIndex, innerIndex, innerSub) { - this.destination.next(outerValue); - this.removeSubscription(innerSub); - this.tryComplete(); - }; - DelayWhenSubscriber.prototype.notifyError = function (error, innerSub) { - this._error(error); - }; - DelayWhenSubscriber.prototype.notifyComplete = function (innerSub) { - var value = this.removeSubscription(innerSub); - if (value) { - this.destination.next(value); - } - this.tryComplete(); - }; - DelayWhenSubscriber.prototype._next = function (value) { - try { - var delayNotifier = this.delayDurationSelector(value); - if (delayNotifier) { - this.tryDelay(delayNotifier, value); - } - } - catch (err) { - this.destination.error(err); - } - }; - DelayWhenSubscriber.prototype._complete = function () { - this.completed = true; - this.tryComplete(); - }; - DelayWhenSubscriber.prototype.removeSubscription = function (subscription) { - subscription.unsubscribe(); - var subscriptionIdx = this.delayNotifierSubscriptions.indexOf(subscription); - var value = null; - if (subscriptionIdx !== -1) { - value = this.values[subscriptionIdx]; - this.delayNotifierSubscriptions.splice(subscriptionIdx, 1); - this.values.splice(subscriptionIdx, 1); - } - return value; - }; - DelayWhenSubscriber.prototype.tryDelay = function (delayNotifier, value) { - var notifierSubscription = subscribeToResult_1.subscribeToResult(this, delayNotifier, value); - if (notifierSubscription && !notifierSubscription.closed) { - this.add(notifierSubscription); - this.delayNotifierSubscriptions.push(notifierSubscription); - } - this.values.push(value); - }; - DelayWhenSubscriber.prototype.tryComplete = function () { - if (this.completed && this.delayNotifierSubscriptions.length === 0) { - this.destination.complete(); - } - }; - return DelayWhenSubscriber; -}(OuterSubscriber_1.OuterSubscriber)); -/** - * We need this JSDoc comment for affecting ESDoc. - * @ignore - * @extends {Ignored} - */ -var SubscriptionDelayObservable = (function (_super) { - __extends(SubscriptionDelayObservable, _super); - function SubscriptionDelayObservable(source, subscriptionDelay) { - _super.call(this); - this.source = source; - this.subscriptionDelay = subscriptionDelay; - } - SubscriptionDelayObservable.prototype._subscribe = function (subscriber) { - this.subscriptionDelay.subscribe(new SubscriptionDelaySubscriber(subscriber, this.source)); - }; - return SubscriptionDelayObservable; -}(Observable_1.Observable)); -/** - * We need this JSDoc comment for affecting ESDoc. - * @ignore - * @extends {Ignored} - */ -var SubscriptionDelaySubscriber = (function (_super) { - __extends(SubscriptionDelaySubscriber, _super); - function SubscriptionDelaySubscriber(parent, source) { - _super.call(this); - this.parent = parent; - this.source = source; - this.sourceSubscribed = false; - } - SubscriptionDelaySubscriber.prototype._next = function (unused) { - this.subscribeToSource(); - }; - SubscriptionDelaySubscriber.prototype._error = function (err) { - this.unsubscribe(); - this.parent.error(err); - }; - SubscriptionDelaySubscriber.prototype._complete = function () { - this.subscribeToSource(); - }; - SubscriptionDelaySubscriber.prototype.subscribeToSource = function () { - if (!this.sourceSubscribed) { - this.sourceSubscribed = true; - this.unsubscribe(); - this.source.subscribe(this.parent); - } - }; - return SubscriptionDelaySubscriber; -}(Subscriber_1.Subscriber)); -//# sourceMappingURL=delayWhen.js.map + return values.length > 0 ? new PropertyValue(values, values[0].line, values[0].col) : null; + }, -/***/ }), -/* 296 */ -/***/ (function(module, exports, __webpack_require__) { + _term: function(inFunction){ + + /* + * term + * : unary_operator? + * [ NUMBER S* | PERCENTAGE S* | LENGTH S* | ANGLE S* | + * TIME S* | FREQ S* | function | ie_function ] + * | STRING S* | IDENT S* | URI S* | UNICODERANGE S* | hexcolor + * ; + */ + + var tokenStream = this._tokenStream, + unary = null, + value = null, + endChar = null, + token, + line, + col; + + //returns the operator or null + unary = this._unary_operator(); + if (unary !== null){ + line = tokenStream.token().startLine; + col = tokenStream.token().startCol; + } -"use strict"; + //exception for IE filters + if (tokenStream.peek() === Tokens.IE_FUNCTION && this.options.ieFilters){ -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; -var Subscriber_1 = __webpack_require__(2); -/** - * Converts an Observable of {@link Notification} objects into the emissions - * that they represent. - * - * Unwraps {@link Notification} objects as actual `next`, - * `error` and `complete` emissions. The opposite of {@link materialize}. - * - * - * - * `dematerialize` is assumed to operate an Observable that only emits - * {@link Notification} objects as `next` emissions, and does not emit any - * `error`. Such Observable is the output of a `materialize` operation. Those - * notifications are then unwrapped using the metadata they contain, and emitted - * as `next`, `error`, and `complete` on the output Observable. - * - * Use this operator in conjunction with {@link materialize}. - * - * @example Convert an Observable of Notifications to an actual Observable - * var notifA = new Rx.Notification('N', 'A'); - * var notifB = new Rx.Notification('N', 'B'); - * var notifE = new Rx.Notification('E', void 0, - * new TypeError('x.toUpperCase is not a function') - * ); - * var materialized = Rx.Observable.of(notifA, notifB, notifE); - * var upperCase = materialized.dematerialize(); - * upperCase.subscribe(x => console.log(x), e => console.error(e)); - * - * // Results in: - * // A - * // B - * // TypeError: x.toUpperCase is not a function - * - * @see {@link Notification} - * @see {@link materialize} - * - * @return {Observable} An Observable that emits items and notifications - * embedded in Notification objects emitted by the source Observable. - * @method dematerialize - * @owner Observable - */ -function dematerialize() { - return this.lift(new DeMaterializeOperator()); -} -exports.dematerialize = dematerialize; -var DeMaterializeOperator = (function () { - function DeMaterializeOperator() { - } - DeMaterializeOperator.prototype.call = function (subscriber, source) { - return source.subscribe(new DeMaterializeSubscriber(subscriber)); - }; - return DeMaterializeOperator; -}()); -/** - * We need this JSDoc comment for affecting ESDoc. - * @ignore - * @extends {Ignored} - */ -var DeMaterializeSubscriber = (function (_super) { - __extends(DeMaterializeSubscriber, _super); - function DeMaterializeSubscriber(destination) { - _super.call(this, destination); - } - DeMaterializeSubscriber.prototype._next = function (value) { - value.observe(this.destination); - }; - return DeMaterializeSubscriber; -}(Subscriber_1.Subscriber)); -//# sourceMappingURL=dematerialize.js.map + value = this._ie_function(); + if (unary === null){ + line = tokenStream.token().startLine; + col = tokenStream.token().startCol; + } -/***/ }), -/* 297 */ -/***/ (function(module, exports, __webpack_require__) { + //see if it's a simple block + } else if (inFunction && tokenStream.match([Tokens.LPAREN, Tokens.LBRACE, Tokens.LBRACKET])){ -"use strict"; + token = tokenStream.token(); + endChar = token.endChar; + value = token.value + this._expr(inFunction).text; + if (unary === null){ + line = tokenStream.token().startLine; + col = tokenStream.token().startCol; + } + tokenStream.mustMatch(Tokens.type(endChar)); + value += endChar; + this._readWhitespace(); + + //see if there's a simple match + } else if (tokenStream.match([Tokens.NUMBER, Tokens.PERCENTAGE, Tokens.LENGTH, + Tokens.ANGLE, Tokens.TIME, + Tokens.FREQ, Tokens.STRING, Tokens.IDENT, Tokens.URI, Tokens.UNICODE_RANGE])){ + + value = tokenStream.token().value; + if (unary === null){ + line = tokenStream.token().startLine; + col = tokenStream.token().startCol; + } + this._readWhitespace(); + } else { -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; -var OuterSubscriber_1 = __webpack_require__(4); -var subscribeToResult_1 = __webpack_require__(3); -var Set_1 = __webpack_require__(372); -/** - * Returns an Observable that emits all items emitted by the source Observable that are distinct by comparison from previous items. - * - * If a keySelector function is provided, then it will project each value from the source observable into a new value that it will - * check for equality with previously projected values. If a keySelector function is not provided, it will use each value from the - * source observable directly with an equality check against previous values. - * - * In JavaScript runtimes that support `Set`, this operator will use a `Set` to improve performance of the distinct value checking. - * - * In other runtimes, this operator will use a minimal implementation of `Set` that relies on an `Array` and `indexOf` under the - * hood, so performance will degrade as more values are checked for distinction. Even in newer browsers, a long-running `distinct` - * use might result in memory leaks. To help alleviate this in some scenarios, an optional `flushes` parameter is also provided so - * that the internal `Set` can be "flushed", basically clearing it of values. - * - * @example A simple example with numbers - * Observable.of(1, 1, 2, 2, 2, 1, 2, 3, 4, 3, 2, 1) - * .distinct() - * .subscribe(x => console.log(x)); // 1, 2, 3, 4 - * - * @example An example using a keySelector function - * interface Person { - * age: number, - * name: string - * } - * - * Observable.of( - * { age: 4, name: 'Foo'}, - * { age: 7, name: 'Bar'}, - * { age: 5, name: 'Foo'}) - * .distinct((p: Person) => p.name) - * .subscribe(x => console.log(x)); - * - * // displays: - * // { age: 4, name: 'Foo' } - * // { age: 7, name: 'Bar' } - * - * @see {@link distinctUntilChanged} - * @see {@link distinctUntilKeyChanged} - * - * @param {function} [keySelector] Optional function to select which value you want to check as distinct. - * @param {Observable} [flushes] Optional Observable for flushing the internal HashSet of the operator. - * @return {Observable} An Observable that emits items from the source Observable with distinct values. - * @method distinct - * @owner Observable - */ -function distinct(keySelector, flushes) { - return this.lift(new DistinctOperator(keySelector, flushes)); -} -exports.distinct = distinct; -var DistinctOperator = (function () { - function DistinctOperator(keySelector, flushes) { - this.keySelector = keySelector; - this.flushes = flushes; - } - DistinctOperator.prototype.call = function (subscriber, source) { - return source.subscribe(new DistinctSubscriber(subscriber, this.keySelector, this.flushes)); - }; - return DistinctOperator; -}()); -/** - * We need this JSDoc comment for affecting ESDoc. - * @ignore - * @extends {Ignored} - */ -var DistinctSubscriber = (function (_super) { - __extends(DistinctSubscriber, _super); - function DistinctSubscriber(destination, keySelector, flushes) { - _super.call(this, destination); - this.keySelector = keySelector; - this.values = new Set_1.Set(); - if (flushes) { - this.add(subscribeToResult_1.subscribeToResult(this, flushes)); - } - } - DistinctSubscriber.prototype.notifyNext = function (outerValue, innerValue, outerIndex, innerIndex, innerSub) { - this.values.clear(); - }; - DistinctSubscriber.prototype.notifyError = function (error, innerSub) { - this._error(error); - }; - DistinctSubscriber.prototype._next = function (value) { - if (this.keySelector) { - this._useKeySelector(value); - } - else { - this._finalizeNext(value, value); - } - }; - DistinctSubscriber.prototype._useKeySelector = function (value) { - var key; - var destination = this.destination; - try { - key = this.keySelector(value); - } - catch (err) { - destination.error(err); - return; - } - this._finalizeNext(key, value); - }; - DistinctSubscriber.prototype._finalizeNext = function (key, value) { - var values = this.values; - if (!values.has(key)) { - values.add(key); - this.destination.next(value); - } - }; - return DistinctSubscriber; -}(OuterSubscriber_1.OuterSubscriber)); -exports.DistinctSubscriber = DistinctSubscriber; -//# sourceMappingURL=distinct.js.map + //see if it's a color + token = this._hexcolor(); + if (token === null){ -/***/ }), -/* 298 */ -/***/ (function(module, exports, __webpack_require__) { + //if there's no unary, get the start of the next token for line/col info + if (unary === null){ + line = tokenStream.LT(1).startLine; + col = tokenStream.LT(1).startCol; + } -"use strict"; + //has to be a function + if (value === null){ + + /* + * This checks for alpha(opacity=0) style of IE + * functions. IE_FUNCTION only presents progid: style. + */ + if (tokenStream.LA(3) === Tokens.EQUALS && this.options.ieFilters){ + value = this._ie_function(); + } else { + value = this._function(); + } + } -var distinctUntilChanged_1 = __webpack_require__(60); -/* tslint:enable:max-line-length */ -/** - * Returns an Observable that emits all items emitted by the source Observable that are distinct by comparison from the previous item, - * using a property accessed by using the key provided to check if the two items are distinct. - * - * If a comparator function is provided, then it will be called for each item to test for whether or not that value should be emitted. - * - * If a comparator function is not provided, an equality check is used by default. - * - * @example An example comparing the name of persons - * - * interface Person { - * age: number, - * name: string - * } - * - * Observable.of( - * { age: 4, name: 'Foo'}, - * { age: 7, name: 'Bar'}, - * { age: 5, name: 'Foo'}, - * { age: 6, name: 'Foo'}) - * .distinctUntilKeyChanged('name') - * .subscribe(x => console.log(x)); - * - * // displays: - * // { age: 4, name: 'Foo' } - * // { age: 7, name: 'Bar' } - * // { age: 5, name: 'Foo' } - * - * @example An example comparing the first letters of the name - * - * interface Person { - * age: number, - * name: string - * } - * - * Observable.of( - * { age: 4, name: 'Foo1'}, - * { age: 7, name: 'Bar'}, - * { age: 5, name: 'Foo2'}, - * { age: 6, name: 'Foo3'}) - * .distinctUntilKeyChanged('name', (x: string, y: string) => x.substring(0, 3) === y.substring(0, 3)) - * .subscribe(x => console.log(x)); - * - * // displays: - * // { age: 4, name: 'Foo1' } - * // { age: 7, name: 'Bar' } - * // { age: 5, name: 'Foo2' } - * - * @see {@link distinct} - * @see {@link distinctUntilChanged} - * - * @param {string} key String key for object property lookup on each item. - * @param {function} [compare] Optional comparison function called to test if an item is distinct from the previous item in the source. - * @return {Observable} An Observable that emits items from the source Observable with distinct values based on the key specified. - * @method distinctUntilKeyChanged - * @owner Observable - */ -function distinctUntilKeyChanged(key, compare) { - return distinctUntilChanged_1.distinctUntilChanged.call(this, function (x, y) { - if (compare) { - return compare(x[key], y[key]); - } - return x[key] === y[key]; - }); -} -exports.distinctUntilKeyChanged = distinctUntilKeyChanged; -//# sourceMappingURL=distinctUntilKeyChanged.js.map + /*if (value === null){ + return null; + //throw new Error("Expected identifier at line " + tokenStream.token().startLine + ", character " + tokenStream.token().startCol + "."); + }*/ -/***/ }), -/* 299 */ -/***/ (function(module, exports, __webpack_require__) { + } else { + value = token.value; + if (unary === null){ + line = token.startLine; + col = token.startCol; + } + } -"use strict"; + } -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; -var Subscriber_1 = __webpack_require__(2); -/* tslint:enable:max-line-length */ -/** - * Perform a side effect for every emission on the source Observable, but return - * an Observable that is identical to the source. - * - * Intercepts each emission on the source and runs a - * function, but returns an output which is identical to the source as long as errors don't occur. - * - * - * - * Returns a mirrored Observable of the source Observable, but modified so that - * the provided Observer is called to perform a side effect for every value, - * error, and completion emitted by the source. Any errors that are thrown in - * the aforementioned Observer or handlers are safely sent down the error path - * of the output Observable. - * - * This operator is useful for debugging your Observables for the correct values - * or performing other side effects. - * - * Note: this is different to a `subscribe` on the Observable. If the Observable - * returned by `do` is not subscribed, the side effects specified by the - * Observer will never happen. `do` therefore simply spies on existing - * execution, it does not trigger an execution to happen like `subscribe` does. - * - * @example Map every click to the clientX position of that click, while also logging the click event - * var clicks = Rx.Observable.fromEvent(document, 'click'); - * var positions = clicks - * .do(ev => console.log(ev)) - * .map(ev => ev.clientX); - * positions.subscribe(x => console.log(x)); - * - * @see {@link map} - * @see {@link subscribe} - * - * @param {Observer|function} [nextOrObserver] A normal Observer object or a - * callback for `next`. - * @param {function} [error] Callback for errors in the source. - * @param {function} [complete] Callback for the completion of the source. - * @return {Observable} An Observable identical to the source, but runs the - * specified Observer or callback(s) for each item. - * @method do - * @name do - * @owner Observable - */ -function _do(nextOrObserver, error, complete) { - return this.lift(new DoOperator(nextOrObserver, error, complete)); -} -exports._do = _do; -var DoOperator = (function () { - function DoOperator(nextOrObserver, error, complete) { - this.nextOrObserver = nextOrObserver; - this.error = error; - this.complete = complete; - } - DoOperator.prototype.call = function (subscriber, source) { - return source.subscribe(new DoSubscriber(subscriber, this.nextOrObserver, this.error, this.complete)); - }; - return DoOperator; -}()); -/** - * We need this JSDoc comment for affecting ESDoc. - * @ignore - * @extends {Ignored} - */ -var DoSubscriber = (function (_super) { - __extends(DoSubscriber, _super); - function DoSubscriber(destination, nextOrObserver, error, complete) { - _super.call(this, destination); - var safeSubscriber = new Subscriber_1.Subscriber(nextOrObserver, error, complete); - safeSubscriber.syncErrorThrowable = true; - this.add(safeSubscriber); - this.safeSubscriber = safeSubscriber; - } - DoSubscriber.prototype._next = function (value) { - var safeSubscriber = this.safeSubscriber; - safeSubscriber.next(value); - if (safeSubscriber.syncErrorThrown) { - this.destination.error(safeSubscriber.syncErrorValue); - } - else { - this.destination.next(value); - } - }; - DoSubscriber.prototype._error = function (err) { - var safeSubscriber = this.safeSubscriber; - safeSubscriber.error(err); - if (safeSubscriber.syncErrorThrown) { - this.destination.error(safeSubscriber.syncErrorValue); - } - else { - this.destination.error(err); - } - }; - DoSubscriber.prototype._complete = function () { - var safeSubscriber = this.safeSubscriber; - safeSubscriber.complete(); - if (safeSubscriber.syncErrorThrown) { - this.destination.error(safeSubscriber.syncErrorValue); - } - else { - this.destination.complete(); - } - }; - return DoSubscriber; -}(Subscriber_1.Subscriber)); -//# sourceMappingURL=do.js.map + return value !== null ? + new PropertyValuePart(unary !== null ? unary + value : value, line, col) : + null; -/***/ }), -/* 300 */ -/***/ (function(module, exports, __webpack_require__) { + }, -"use strict"; + _function: function(){ + + /* + * function + * : FUNCTION S* expr ')' S* + * ; + */ + + var tokenStream = this._tokenStream, + functionText = null, + expr = null, + lt; + + if (tokenStream.match(Tokens.FUNCTION)){ + functionText = tokenStream.token().value; + this._readWhitespace(); + expr = this._expr(true); + functionText += expr; + + //START: Horrible hack in case it's an IE filter + if (this.options.ieFilters && tokenStream.peek() === Tokens.EQUALS){ + do { + + if (this._readWhitespace()){ + functionText += tokenStream.token().value; + } + + //might be second time in the loop + if (tokenStream.LA(0) === Tokens.COMMA){ + functionText += tokenStream.token().value; + } + + tokenStream.match(Tokens.IDENT); + functionText += tokenStream.token().value; + + tokenStream.match(Tokens.EQUALS); + functionText += tokenStream.token().value; + + //functionText += this._term(); + lt = tokenStream.peek(); + while(lt !== Tokens.COMMA && lt !== Tokens.S && lt !== Tokens.RPAREN){ + tokenStream.get(); + functionText += tokenStream.token().value; + lt = tokenStream.peek(); + } + } while(tokenStream.match([Tokens.COMMA, Tokens.S])); + } -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; -var Subscriber_1 = __webpack_require__(2); -var ArgumentOutOfRangeError_1 = __webpack_require__(22); -/** - * Emits the single value at the specified `index` in a sequence of emissions - * from the source Observable. - * - * Emits only the i-th value, then completes. - * - * - * - * `elementAt` returns an Observable that emits the item at the specified - * `index` in the source Observable, or a default value if that `index` is out - * of range and the `default` argument is provided. If the `default` argument is - * not given and the `index` is out of range, the output Observable will emit an - * `ArgumentOutOfRangeError` error. - * - * @example Emit only the third click event - * var clicks = Rx.Observable.fromEvent(document, 'click'); - * var result = clicks.elementAt(2); - * result.subscribe(x => console.log(x)); - * - * // Results in: - * // click 1 = nothing - * // click 2 = nothing - * // click 3 = MouseEvent object logged to console - * - * @see {@link first} - * @see {@link last} - * @see {@link skip} - * @see {@link single} - * @see {@link take} - * - * @throws {ArgumentOutOfRangeError} When using `elementAt(i)`, it delivers an - * ArgumentOutOrRangeError to the Observer's `error` callback if `i < 0` or the - * Observable has completed before emitting the i-th `next` notification. - * - * @param {number} index Is the number `i` for the i-th source emission that has - * happened since the subscription, starting from the number `0`. - * @param {T} [defaultValue] The default value returned for missing indices. - * @return {Observable} An Observable that emits a single item, if it is found. - * Otherwise, will emit the default value if given. If not, then emits an error. - * @method elementAt - * @owner Observable - */ -function elementAt(index, defaultValue) { - return this.lift(new ElementAtOperator(index, defaultValue)); -} -exports.elementAt = elementAt; -var ElementAtOperator = (function () { - function ElementAtOperator(index, defaultValue) { - this.index = index; - this.defaultValue = defaultValue; - if (index < 0) { - throw new ArgumentOutOfRangeError_1.ArgumentOutOfRangeError; - } - } - ElementAtOperator.prototype.call = function (subscriber, source) { - return source.subscribe(new ElementAtSubscriber(subscriber, this.index, this.defaultValue)); - }; - return ElementAtOperator; -}()); -/** - * We need this JSDoc comment for affecting ESDoc. - * @ignore - * @extends {Ignored} - */ -var ElementAtSubscriber = (function (_super) { - __extends(ElementAtSubscriber, _super); - function ElementAtSubscriber(destination, index, defaultValue) { - _super.call(this, destination); - this.index = index; - this.defaultValue = defaultValue; - } - ElementAtSubscriber.prototype._next = function (x) { - if (this.index-- === 0) { - this.destination.next(x); - this.destination.complete(); - } - }; - ElementAtSubscriber.prototype._complete = function () { - var destination = this.destination; - if (this.index >= 0) { - if (typeof this.defaultValue !== 'undefined') { - destination.next(this.defaultValue); - } - else { - destination.error(new ArgumentOutOfRangeError_1.ArgumentOutOfRangeError); - } - } - destination.complete(); - }; - return ElementAtSubscriber; -}(Subscriber_1.Subscriber)); -//# sourceMappingURL=elementAt.js.map + //END: Horrible Hack + + tokenStream.match(Tokens.RPAREN); + functionText += ")"; + this._readWhitespace(); + } + + return functionText; + }, + + _ie_function: function(){ + + /* (My own extension) + * ie_function + * : IE_FUNCTION S* IDENT '=' term [S* ','? IDENT '=' term]+ ')' S* + * ; + */ + + var tokenStream = this._tokenStream, + functionText = null, + lt; + + //IE function can begin like a regular function, too + if (tokenStream.match([Tokens.IE_FUNCTION, Tokens.FUNCTION])){ + functionText = tokenStream.token().value; + + do { + + if (this._readWhitespace()){ + functionText += tokenStream.token().value; + } + + //might be second time in the loop + if (tokenStream.LA(0) === Tokens.COMMA){ + functionText += tokenStream.token().value; + } + + tokenStream.match(Tokens.IDENT); + functionText += tokenStream.token().value; + + tokenStream.match(Tokens.EQUALS); + functionText += tokenStream.token().value; + + //functionText += this._term(); + lt = tokenStream.peek(); + while(lt !== Tokens.COMMA && lt !== Tokens.S && lt !== Tokens.RPAREN){ + tokenStream.get(); + functionText += tokenStream.token().value; + lt = tokenStream.peek(); + } + } while(tokenStream.match([Tokens.COMMA, Tokens.S])); + + tokenStream.match(Tokens.RPAREN); + functionText += ")"; + this._readWhitespace(); + } + + return functionText; + }, + + _hexcolor: function(){ + /* + * There is a constraint on the color that it must + * have either 3 or 6 hex-digits (i.e., [0-9a-fA-F]) + * after the "#"; e.g., "#000" is OK, but "#abcd" is not. + * + * hexcolor + * : HASH S* + * ; + */ + + var tokenStream = this._tokenStream, + token = null, + color; + + if(tokenStream.match(Tokens.HASH)){ + + //need to do some validation here + + token = tokenStream.token(); + color = token.value; + if (!/#[a-f0-9]{3,6}/i.test(color)){ + throw new SyntaxError("Expected a hex color but found '" + color + "' at line " + token.startLine + ", col " + token.startCol + ".", token.startLine, token.startCol); + } + this._readWhitespace(); + } + + return token; + }, + + //----------------------------------------------------------------- + // Animations methods + //----------------------------------------------------------------- + + _keyframes: function(){ + + /* + * keyframes: + * : KEYFRAMES_SYM S* keyframe_name S* '{' S* keyframe_rule* '}' { + * ; + */ + var tokenStream = this._tokenStream, + token, + tt, + name, + prefix = ""; + + tokenStream.mustMatch(Tokens.KEYFRAMES_SYM); + token = tokenStream.token(); + if (/^@\-([^\-]+)\-/.test(token.value)) { + prefix = RegExp.$1; + } + + this._readWhitespace(); + name = this._keyframe_name(); + + this._readWhitespace(); + tokenStream.mustMatch(Tokens.LBRACE); + + this.fire({ + type: "startkeyframes", + name: name, + prefix: prefix, + line: token.startLine, + col: token.startCol + }); + + this._readWhitespace(); + tt = tokenStream.peek(); + + //check for key + while(tt === Tokens.IDENT || tt === Tokens.PERCENTAGE) { + this._keyframe_rule(); + this._readWhitespace(); + tt = tokenStream.peek(); + } + + this.fire({ + type: "endkeyframes", + name: name, + prefix: prefix, + line: token.startLine, + col: token.startCol + }); + + this._readWhitespace(); + tokenStream.mustMatch(Tokens.RBRACE); + + }, + + _keyframe_name: function(){ + + /* + * keyframe_name: + * : IDENT + * | STRING + * ; + */ + var tokenStream = this._tokenStream; + + tokenStream.mustMatch([Tokens.IDENT, Tokens.STRING]); + return SyntaxUnit.fromToken(tokenStream.token()); + }, + + _keyframe_rule: function(){ + + /* + * keyframe_rule: + * : key_list S* + * '{' S* declaration [ ';' S* declaration ]* '}' S* + * ; + */ + var keyList = this._key_list(); + + this.fire({ + type: "startkeyframerule", + keys: keyList, + line: keyList[0].line, + col: keyList[0].col + }); + + this._readDeclarations(true); + + this.fire({ + type: "endkeyframerule", + keys: keyList, + line: keyList[0].line, + col: keyList[0].col + }); + + }, + + _key_list: function(){ + + /* + * key_list: + * : key [ S* ',' S* key]* + * ; + */ + var tokenStream = this._tokenStream, + keyList = []; + + //must be least one key + keyList.push(this._key()); + + this._readWhitespace(); + + while(tokenStream.match(Tokens.COMMA)){ + this._readWhitespace(); + keyList.push(this._key()); + this._readWhitespace(); + } -/***/ }), -/* 301 */ -/***/ (function(module, exports, __webpack_require__) { + return keyList; + }, -"use strict"; + _key: function(){ + /* + * There is a restriction that IDENT can be only "from" or "to". + * + * key + * : PERCENTAGE + * | IDENT + * ; + */ + + var tokenStream = this._tokenStream, + token; + + if (tokenStream.match(Tokens.PERCENTAGE)){ + return SyntaxUnit.fromToken(tokenStream.token()); + } else if (tokenStream.match(Tokens.IDENT)){ + token = tokenStream.token(); + + if (/from|to/i.test(token.value)){ + return SyntaxUnit.fromToken(token); + } -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; -var OuterSubscriber_1 = __webpack_require__(4); -var subscribeToResult_1 = __webpack_require__(3); -/** - * Converts a higher-order Observable into a first-order Observable by dropping - * inner Observables while the previous inner Observable has not yet completed. - * - * Flattens an Observable-of-Observables by dropping the - * next inner Observables while the current inner is still executing. - * - * - * - * `exhaust` subscribes to an Observable that emits Observables, also known as a - * higher-order Observable. Each time it observes one of these emitted inner - * Observables, the output Observable begins emitting the items emitted by that - * inner Observable. So far, it behaves like {@link mergeAll}. However, - * `exhaust` ignores every new inner Observable if the previous Observable has - * not yet completed. Once that one completes, it will accept and flatten the - * next inner Observable and repeat this process. - * - * @example Run a finite timer for each click, only if there is no currently active timer - * var clicks = Rx.Observable.fromEvent(document, 'click'); - * var higherOrder = clicks.map((ev) => Rx.Observable.interval(1000).take(5)); - * var result = higherOrder.exhaust(); - * result.subscribe(x => console.log(x)); - * - * @see {@link combineAll} - * @see {@link concatAll} - * @see {@link switch} - * @see {@link mergeAll} - * @see {@link exhaustMap} - * @see {@link zipAll} - * - * @return {Observable} An Observable that takes a source of Observables and propagates the first observable - * exclusively until it completes before subscribing to the next. - * @method exhaust - * @owner Observable - */ -function exhaust() { - return this.lift(new SwitchFirstOperator()); -} -exports.exhaust = exhaust; -var SwitchFirstOperator = (function () { - function SwitchFirstOperator() { - } - SwitchFirstOperator.prototype.call = function (subscriber, source) { - return source.subscribe(new SwitchFirstSubscriber(subscriber)); - }; - return SwitchFirstOperator; -}()); -/** - * We need this JSDoc comment for affecting ESDoc. - * @ignore - * @extends {Ignored} - */ -var SwitchFirstSubscriber = (function (_super) { - __extends(SwitchFirstSubscriber, _super); - function SwitchFirstSubscriber(destination) { - _super.call(this, destination); - this.hasCompleted = false; - this.hasSubscription = false; - } - SwitchFirstSubscriber.prototype._next = function (value) { - if (!this.hasSubscription) { - this.hasSubscription = true; - this.add(subscribeToResult_1.subscribeToResult(this, value)); - } - }; - SwitchFirstSubscriber.prototype._complete = function () { - this.hasCompleted = true; - if (!this.hasSubscription) { - this.destination.complete(); - } - }; - SwitchFirstSubscriber.prototype.notifyComplete = function (innerSub) { - this.remove(innerSub); - this.hasSubscription = false; - if (this.hasCompleted) { - this.destination.complete(); - } - }; - return SwitchFirstSubscriber; -}(OuterSubscriber_1.OuterSubscriber)); -//# sourceMappingURL=exhaust.js.map + tokenStream.unget(); + } -/***/ }), -/* 302 */ -/***/ (function(module, exports, __webpack_require__) { + //if it gets here, there wasn't a valid token, so time to explode + this._unexpectedToken(tokenStream.LT(1)); + }, -"use strict"; + //----------------------------------------------------------------- + // Helper methods + //----------------------------------------------------------------- -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; -var OuterSubscriber_1 = __webpack_require__(4); -var subscribeToResult_1 = __webpack_require__(3); -/* tslint:enable:max-line-length */ -/** - * Projects each source value to an Observable which is merged in the output - * Observable only if the previous projected Observable has completed. - * - * Maps each value to an Observable, then flattens all of - * these inner Observables using {@link exhaust}. - * - * - * - * Returns an Observable that emits items based on applying a function that you - * supply to each item emitted by the source Observable, where that function - * returns an (so-called "inner") Observable. When it projects a source value to - * an Observable, the output Observable begins emitting the items emitted by - * that projected Observable. However, `exhaustMap` ignores every new projected - * Observable if the previous projected Observable has not yet completed. Once - * that one completes, it will accept and flatten the next projected Observable - * and repeat this process. - * - * @example Run a finite timer for each click, only if there is no currently active timer - * var clicks = Rx.Observable.fromEvent(document, 'click'); - * var result = clicks.exhaustMap((ev) => Rx.Observable.interval(1000).take(5)); - * result.subscribe(x => console.log(x)); - * - * @see {@link concatMap} - * @see {@link exhaust} - * @see {@link mergeMap} - * @see {@link switchMap} - * - * @param {function(value: T, ?index: number): ObservableInput} project A function - * that, when applied to an item emitted by the source Observable, returns an - * Observable. - * @param {function(outerValue: T, innerValue: I, outerIndex: number, innerIndex: number): any} [resultSelector] - * A function to produce the value on the output Observable based on the values - * and the indices of the source (outer) emission and the inner Observable - * emission. The arguments passed to this function are: - * - `outerValue`: the value that came from the source - * - `innerValue`: the value that came from the projected Observable - * - `outerIndex`: the "index" of the value that came from the source - * - `innerIndex`: the "index" of the value from the projected Observable - * @return {Observable} An Observable containing projected Observables - * of each item of the source, ignoring projected Observables that start before - * their preceding Observable has completed. - * @method exhaustMap - * @owner Observable - */ -function exhaustMap(project, resultSelector) { - return this.lift(new SwitchFirstMapOperator(project, resultSelector)); -} -exports.exhaustMap = exhaustMap; -var SwitchFirstMapOperator = (function () { - function SwitchFirstMapOperator(project, resultSelector) { - this.project = project; - this.resultSelector = resultSelector; - } - SwitchFirstMapOperator.prototype.call = function (subscriber, source) { - return source.subscribe(new SwitchFirstMapSubscriber(subscriber, this.project, this.resultSelector)); - }; - return SwitchFirstMapOperator; -}()); -/** - * We need this JSDoc comment for affecting ESDoc. - * @ignore - * @extends {Ignored} - */ -var SwitchFirstMapSubscriber = (function (_super) { - __extends(SwitchFirstMapSubscriber, _super); - function SwitchFirstMapSubscriber(destination, project, resultSelector) { - _super.call(this, destination); - this.project = project; - this.resultSelector = resultSelector; - this.hasSubscription = false; - this.hasCompleted = false; - this.index = 0; - } - SwitchFirstMapSubscriber.prototype._next = function (value) { - if (!this.hasSubscription) { - this.tryNext(value); - } - }; - SwitchFirstMapSubscriber.prototype.tryNext = function (value) { - var index = this.index++; - var destination = this.destination; - try { - var result = this.project(value, index); - this.hasSubscription = true; - this.add(subscribeToResult_1.subscribeToResult(this, result, value, index)); - } - catch (err) { - destination.error(err); - } - }; - SwitchFirstMapSubscriber.prototype._complete = function () { - this.hasCompleted = true; - if (!this.hasSubscription) { - this.destination.complete(); - } - }; - SwitchFirstMapSubscriber.prototype.notifyNext = function (outerValue, innerValue, outerIndex, innerIndex, innerSub) { - var _a = this, resultSelector = _a.resultSelector, destination = _a.destination; - if (resultSelector) { - this.trySelectResult(outerValue, innerValue, outerIndex, innerIndex); - } - else { - destination.next(innerValue); - } - }; - SwitchFirstMapSubscriber.prototype.trySelectResult = function (outerValue, innerValue, outerIndex, innerIndex) { - var _a = this, resultSelector = _a.resultSelector, destination = _a.destination; - try { - var result = resultSelector(outerValue, innerValue, outerIndex, innerIndex); - destination.next(result); - } - catch (err) { - destination.error(err); - } - }; - SwitchFirstMapSubscriber.prototype.notifyError = function (err) { - this.destination.error(err); - }; - SwitchFirstMapSubscriber.prototype.notifyComplete = function (innerSub) { - this.remove(innerSub); - this.hasSubscription = false; - if (this.hasCompleted) { - this.destination.complete(); - } - }; - return SwitchFirstMapSubscriber; -}(OuterSubscriber_1.OuterSubscriber)); -//# sourceMappingURL=exhaustMap.js.map + /** + * Not part of CSS grammar, but useful for skipping over + * combination of white space and HTML-style comments. + * @return {void} + * @method _skipCruft + * @private + */ + _skipCruft: function(){ + while(this._tokenStream.match([Tokens.S, Tokens.CDO, Tokens.CDC])){ + //noop + } + }, -/***/ }), -/* 303 */ -/***/ (function(module, exports, __webpack_require__) { + /** + * Not part of CSS grammar, but this pattern occurs frequently + * in the official CSS grammar. Split out here to eliminate + * duplicate code. + * @param {Boolean} checkStart Indicates if the rule should check + * for the left brace at the beginning. + * @param {Boolean} readMargins Indicates if the rule should check + * for margin patterns. + * @return {void} + * @method _readDeclarations + * @private + */ + _readDeclarations: function(checkStart, readMargins){ + /* + * Reads the pattern + * S* '{' S* declaration [ ';' S* declaration ]* '}' S* + * or + * S* '{' S* [ declaration | margin ]? [ ';' S* [ declaration | margin ]? ]* '}' S* + * Note that this is how it is described in CSS3 Paged Media, but is actually incorrect. + * A semicolon is only necessary following a declaration if there's another declaration + * or margin afterwards. + */ + var tokenStream = this._tokenStream, + tt; + + + this._readWhitespace(); + + if (checkStart){ + tokenStream.mustMatch(Tokens.LBRACE); + } -"use strict"; + this._readWhitespace(); -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; -var tryCatch_1 = __webpack_require__(7); -var errorObject_1 = __webpack_require__(5); -var OuterSubscriber_1 = __webpack_require__(4); -var subscribeToResult_1 = __webpack_require__(3); -/* tslint:enable:max-line-length */ -/** - * Recursively projects each source value to an Observable which is merged in - * the output Observable. - * - * It's similar to {@link mergeMap}, but applies the - * projection function to every source value as well as every output value. - * It's recursive. - * - * - * - * Returns an Observable that emits items based on applying a function that you - * supply to each item emitted by the source Observable, where that function - * returns an Observable, and then merging those resulting Observables and - * emitting the results of this merger. *Expand* will re-emit on the output - * Observable every source value. Then, each output value is given to the - * `project` function which returns an inner Observable to be merged on the - * output Observable. Those output values resulting from the projection are also - * given to the `project` function to produce new output values. This is how - * *expand* behaves recursively. - * - * @example Start emitting the powers of two on every click, at most 10 of them - * var clicks = Rx.Observable.fromEvent(document, 'click'); - * var powersOfTwo = clicks - * .mapTo(1) - * .expand(x => Rx.Observable.of(2 * x).delay(1000)) - * .take(10); - * powersOfTwo.subscribe(x => console.log(x)); - * - * @see {@link mergeMap} - * @see {@link mergeScan} - * - * @param {function(value: T, index: number) => Observable} project A function - * that, when applied to an item emitted by the source or the output Observable, - * returns an Observable. - * @param {number} [concurrent=Number.POSITIVE_INFINITY] Maximum number of input - * Observables being subscribed to concurrently. - * @param {Scheduler} [scheduler=null] The IScheduler to use for subscribing to - * each projected inner Observable. - * @return {Observable} An Observable that emits the source values and also - * result of applying the projection function to each value emitted on the - * output Observable and and merging the results of the Observables obtained - * from this transformation. - * @method expand - * @owner Observable - */ -function expand(project, concurrent, scheduler) { - if (concurrent === void 0) { concurrent = Number.POSITIVE_INFINITY; } - if (scheduler === void 0) { scheduler = undefined; } - concurrent = (concurrent || 0) < 1 ? Number.POSITIVE_INFINITY : concurrent; - return this.lift(new ExpandOperator(project, concurrent, scheduler)); -} -exports.expand = expand; -var ExpandOperator = (function () { - function ExpandOperator(project, concurrent, scheduler) { - this.project = project; - this.concurrent = concurrent; - this.scheduler = scheduler; - } - ExpandOperator.prototype.call = function (subscriber, source) { - return source.subscribe(new ExpandSubscriber(subscriber, this.project, this.concurrent, this.scheduler)); - }; - return ExpandOperator; -}()); -exports.ExpandOperator = ExpandOperator; -/** - * We need this JSDoc comment for affecting ESDoc. - * @ignore - * @extends {Ignored} - */ -var ExpandSubscriber = (function (_super) { - __extends(ExpandSubscriber, _super); - function ExpandSubscriber(destination, project, concurrent, scheduler) { - _super.call(this, destination); - this.project = project; - this.concurrent = concurrent; - this.scheduler = scheduler; - this.index = 0; - this.active = 0; - this.hasCompleted = false; - if (concurrent < Number.POSITIVE_INFINITY) { - this.buffer = []; - } - } - ExpandSubscriber.dispatch = function (arg) { - var subscriber = arg.subscriber, result = arg.result, value = arg.value, index = arg.index; - subscriber.subscribeToProjection(result, value, index); - }; - ExpandSubscriber.prototype._next = function (value) { - var destination = this.destination; - if (destination.closed) { - this._complete(); - return; - } - var index = this.index++; - if (this.active < this.concurrent) { - destination.next(value); - var result = tryCatch_1.tryCatch(this.project)(value, index); - if (result === errorObject_1.errorObject) { - destination.error(errorObject_1.errorObject.e); - } - else if (!this.scheduler) { - this.subscribeToProjection(result, value, index); - } - else { - var state = { subscriber: this, result: result, value: value, index: index }; - this.add(this.scheduler.schedule(ExpandSubscriber.dispatch, 0, state)); - } - } - else { - this.buffer.push(value); - } - }; - ExpandSubscriber.prototype.subscribeToProjection = function (result, value, index) { - this.active++; - this.add(subscribeToResult_1.subscribeToResult(this, result, value, index)); - }; - ExpandSubscriber.prototype._complete = function () { - this.hasCompleted = true; - if (this.hasCompleted && this.active === 0) { - this.destination.complete(); - } - }; - ExpandSubscriber.prototype.notifyNext = function (outerValue, innerValue, outerIndex, innerIndex, innerSub) { - this._next(innerValue); - }; - ExpandSubscriber.prototype.notifyComplete = function (innerSub) { - var buffer = this.buffer; - this.remove(innerSub); - this.active--; - if (buffer && buffer.length > 0) { - this._next(buffer.shift()); - } - if (this.hasCompleted && this.active === 0) { - this.destination.complete(); - } - }; - return ExpandSubscriber; -}(OuterSubscriber_1.OuterSubscriber)); -exports.ExpandSubscriber = ExpandSubscriber; -//# sourceMappingURL=expand.js.map + try { -/***/ }), -/* 304 */ -/***/ (function(module, exports, __webpack_require__) { + while(true){ -"use strict"; + if (tokenStream.match(Tokens.SEMICOLON) || (readMargins && this._margin())){ + //noop + } else if (this._declaration()){ + if (!tokenStream.match(Tokens.SEMICOLON)){ + break; + } + } else { + break; + } -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; -var Subscriber_1 = __webpack_require__(2); -var Subscription_1 = __webpack_require__(9); -/** - * Returns an Observable that mirrors the source Observable, but will call a specified function when - * the source terminates on complete or error. - * @param {function} callback Function to be called when source terminates. - * @return {Observable} An Observable that mirrors the source, but will call the specified function on termination. - * @method finally - * @owner Observable - */ -function _finally(callback) { - return this.lift(new FinallyOperator(callback)); -} -exports._finally = _finally; -var FinallyOperator = (function () { - function FinallyOperator(callback) { - this.callback = callback; - } - FinallyOperator.prototype.call = function (subscriber, source) { - return source.subscribe(new FinallySubscriber(subscriber, this.callback)); - }; - return FinallyOperator; -}()); -/** - * We need this JSDoc comment for affecting ESDoc. - * @ignore - * @extends {Ignored} - */ -var FinallySubscriber = (function (_super) { - __extends(FinallySubscriber, _super); - function FinallySubscriber(destination, callback) { - _super.call(this, destination); - this.add(new Subscription_1.Subscription(callback)); - } - return FinallySubscriber; -}(Subscriber_1.Subscriber)); -//# sourceMappingURL=finally.js.map + //if ((!this._margin() && !this._declaration()) || !tokenStream.match(Tokens.SEMICOLON)){ + // break; + //} + this._readWhitespace(); + } -/***/ }), -/* 305 */ -/***/ (function(module, exports, __webpack_require__) { + tokenStream.mustMatch(Tokens.RBRACE); + this._readWhitespace(); + + } catch (ex) { + if (ex instanceof SyntaxError && !this.options.strict){ + + //fire error event + this.fire({ + type: "error", + error: ex, + message: ex.message, + line: ex.line, + col: ex.col + }); + + //see if there's another declaration + tt = tokenStream.advance([Tokens.SEMICOLON, Tokens.RBRACE]); + if (tt === Tokens.SEMICOLON){ + //if there's a semicolon, then there might be another declaration + this._readDeclarations(false, readMargins); + } else if (tt !== Tokens.RBRACE){ + //if there's a right brace, the rule is finished so don't do anything + //otherwise, rethrow the error because it wasn't handled properly + throw ex; + } -"use strict"; + } else { + //not a syntax error, rethrow it + throw ex; + } + } -var find_1 = __webpack_require__(61); -/** - * Emits only the index of the first value emitted by the source Observable that - * meets some condition. - * - * It's like {@link find}, but emits the index of the - * found value, not the value itself. - * - * - * - * `findIndex` searches for the first item in the source Observable that matches - * the specified condition embodied by the `predicate`, and returns the - * (zero-based) index of the first occurrence in the source. Unlike - * {@link first}, the `predicate` is required in `findIndex`, and does not emit - * an error if a valid value is not found. - * - * @example Emit the index of first click that happens on a DIV element - * var clicks = Rx.Observable.fromEvent(document, 'click'); - * var result = clicks.findIndex(ev => ev.target.tagName === 'DIV'); - * result.subscribe(x => console.log(x)); - * - * @see {@link filter} - * @see {@link find} - * @see {@link first} - * @see {@link take} - * - * @param {function(value: T, index: number, source: Observable): boolean} predicate - * A function called with each item to test for condition matching. - * @param {any} [thisArg] An optional argument to determine the value of `this` - * in the `predicate` function. - * @return {Observable} An Observable of the index of the first item that - * matches the condition. - * @method find - * @owner Observable - */ -function findIndex(predicate, thisArg) { - return this.lift(new find_1.FindValueOperator(predicate, this, true, thisArg)); -} -exports.findIndex = findIndex; -//# sourceMappingURL=findIndex.js.map + }, -/***/ }), -/* 306 */ -/***/ (function(module, exports, __webpack_require__) { + /** + * In some cases, you can end up with two white space tokens in a + * row. Instead of making a change in every function that looks for + * white space, this function is used to match as much white space + * as necessary. + * @method _readWhitespace + * @return {String} The white space if found, empty string if not. + * @private + */ + _readWhitespace: function(){ -"use strict"; + var tokenStream = this._tokenStream, + ws = ""; -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; -var Subscriber_1 = __webpack_require__(2); -var Subscription_1 = __webpack_require__(9); -var Observable_1 = __webpack_require__(0); -var Subject_1 = __webpack_require__(6); -var Map_1 = __webpack_require__(370); -var FastMap_1 = __webpack_require__(368); -/* tslint:enable:max-line-length */ -/** - * Groups the items emitted by an Observable according to a specified criterion, - * and emits these grouped items as `GroupedObservables`, one - * {@link GroupedObservable} per group. - * - * - * - * @example Group objects by id and return as array - * Observable.of({id: 1, name: 'aze1'}, - * {id: 2, name: 'sf2'}, - * {id: 2, name: 'dg2'}, - * {id: 1, name: 'erg1'}, - * {id: 1, name: 'df1'}, - * {id: 2, name: 'sfqfb2'}, - * {id: 3, name: 'qfs3'}, - * {id: 2, name: 'qsgqsfg2'} - * ) - * .groupBy(p => p.id) - * .flatMap( (group$) => group$.reduce((acc, cur) => [...acc, cur], [])) - * .subscribe(p => console.log(p)); - * - * // displays: - * // [ { id: 1, name: 'aze1' }, - * // { id: 1, name: 'erg1' }, - * // { id: 1, name: 'df1' } ] - * // - * // [ { id: 2, name: 'sf2' }, - * // { id: 2, name: 'dg2' }, - * // { id: 2, name: 'sfqfb2' }, - * // { id: 2, name: 'qsgqsfg2' } ] - * // - * // [ { id: 3, name: 'qfs3' } ] - * - * @example Pivot data on the id field - * Observable.of({id: 1, name: 'aze1'}, - * {id: 2, name: 'sf2'}, - * {id: 2, name: 'dg2'}, - * {id: 1, name: 'erg1'}, - * {id: 1, name: 'df1'}, - * {id: 2, name: 'sfqfb2'}, - * {id: 3, name: 'qfs1'}, - * {id: 2, name: 'qsgqsfg2'} - * ) - * .groupBy(p => p.id, p => p.name) - * .flatMap( (group$) => group$.reduce((acc, cur) => [...acc, cur], ["" + group$.key])) - * .map(arr => ({'id': parseInt(arr[0]), 'values': arr.slice(1)})) - * .subscribe(p => console.log(p)); - * - * // displays: - * // { id: 1, values: [ 'aze1', 'erg1', 'df1' ] } - * // { id: 2, values: [ 'sf2', 'dg2', 'sfqfb2', 'qsgqsfg2' ] } - * // { id: 3, values: [ 'qfs1' ] } - * - * @param {function(value: T): K} keySelector A function that extracts the key - * for each item. - * @param {function(value: T): R} [elementSelector] A function that extracts the - * return element for each item. - * @param {function(grouped: GroupedObservable): Observable} [durationSelector] - * A function that returns an Observable to determine how long each group should - * exist. - * @return {Observable>} An Observable that emits - * GroupedObservables, each of which corresponds to a unique key value and each - * of which emits those items from the source Observable that share that key - * value. - * @method groupBy - * @owner Observable - */ -function groupBy(keySelector, elementSelector, durationSelector, subjectSelector) { - return this.lift(new GroupByOperator(keySelector, elementSelector, durationSelector, subjectSelector)); -} -exports.groupBy = groupBy; -var GroupByOperator = (function () { - function GroupByOperator(keySelector, elementSelector, durationSelector, subjectSelector) { - this.keySelector = keySelector; - this.elementSelector = elementSelector; - this.durationSelector = durationSelector; - this.subjectSelector = subjectSelector; - } - GroupByOperator.prototype.call = function (subscriber, source) { - return source.subscribe(new GroupBySubscriber(subscriber, this.keySelector, this.elementSelector, this.durationSelector, this.subjectSelector)); - }; - return GroupByOperator; -}()); -/** - * We need this JSDoc comment for affecting ESDoc. - * @ignore - * @extends {Ignored} - */ -var GroupBySubscriber = (function (_super) { - __extends(GroupBySubscriber, _super); - function GroupBySubscriber(destination, keySelector, elementSelector, durationSelector, subjectSelector) { - _super.call(this, destination); - this.keySelector = keySelector; - this.elementSelector = elementSelector; - this.durationSelector = durationSelector; - this.subjectSelector = subjectSelector; - this.groups = null; - this.attemptedToUnsubscribe = false; - this.count = 0; - } - GroupBySubscriber.prototype._next = function (value) { - var key; - try { - key = this.keySelector(value); - } - catch (err) { - this.error(err); - return; - } - this._group(value, key); - }; - GroupBySubscriber.prototype._group = function (value, key) { - var groups = this.groups; - if (!groups) { - groups = this.groups = typeof key === 'string' ? new FastMap_1.FastMap() : new Map_1.Map(); - } - var group = groups.get(key); - var element; - if (this.elementSelector) { - try { - element = this.elementSelector(value); - } - catch (err) { - this.error(err); + while(tokenStream.match(Tokens.S)){ + ws += tokenStream.token().value; + } + + return ws; + }, + + + /** + * Throws an error when an unexpected token is found. + * @param {Object} token The token that was found. + * @method _unexpectedToken + * @return {void} + * @private + */ + _unexpectedToken: function(token){ + throw new SyntaxError("Unexpected token '" + token.value + "' at line " + token.startLine + ", col " + token.startCol + ".", token.startLine, token.startCol); + }, + + /** + * Helper method used for parsing subparts of a style sheet. + * @return {void} + * @method _verifyEnd + * @private + */ + _verifyEnd: function(){ + if (this._tokenStream.LA(1) !== Tokens.EOF){ + this._unexpectedToken(this._tokenStream.LT(1)); + } + }, + + //----------------------------------------------------------------- + // Validation methods + //----------------------------------------------------------------- + _validateProperty: function(property, value){ + Validation.validate(property, value); + }, + + //----------------------------------------------------------------- + // Parsing methods + //----------------------------------------------------------------- + + parse: function(input){ + this._tokenStream = new TokenStream(input, Tokens); + this._stylesheet(); + }, + + parseStyleSheet: function(input){ + //just passthrough + return this.parse(input); + }, + + parseMediaQuery: function(input){ + this._tokenStream = new TokenStream(input, Tokens); + var result = this._media_query(); + + //if there's anything more, then it's an invalid selector + this._verifyEnd(); + + //otherwise return result + return result; + }, + + /** + * Parses a property value (everything after the semicolon). + * @return {parserlib.css.PropertyValue} The property value. + * @throws parserlib.util.SyntaxError If an unexpected token is found. + * @method parserPropertyValue + */ + parsePropertyValue: function(input){ + + this._tokenStream = new TokenStream(input, Tokens); + this._readWhitespace(); + + var result = this._expr(); + + //okay to have a trailing white space + this._readWhitespace(); + + //if there's anything more, then it's an invalid selector + this._verifyEnd(); + + //otherwise return result + return result; + }, + + /** + * Parses a complete CSS rule, including selectors and + * properties. + * @param {String} input The text to parser. + * @return {Boolean} True if the parse completed successfully, false if not. + * @method parseRule + */ + parseRule: function(input){ + this._tokenStream = new TokenStream(input, Tokens); + + //skip any leading white space + this._readWhitespace(); + + var result = this._ruleset(); + + //skip any trailing white space + this._readWhitespace(); + + //if there's anything more, then it's an invalid selector + this._verifyEnd(); + + //otherwise return result + return result; + }, + + /** + * Parses a single CSS selector (no comma) + * @param {String} input The text to parse as a CSS selector. + * @return {Selector} An object representing the selector. + * @throws parserlib.util.SyntaxError If an unexpected token is found. + * @method parseSelector + */ + parseSelector: function(input){ + + this._tokenStream = new TokenStream(input, Tokens); + + //skip any leading white space + this._readWhitespace(); + + var result = this._selector(); + + //skip any trailing white space + this._readWhitespace(); + + //if there's anything more, then it's an invalid selector + this._verifyEnd(); + + //otherwise return result + return result; + }, + + /** + * Parses an HTML style attribute: a set of CSS declarations + * separated by semicolons. + * @param {String} input The text to parse as a style attribute + * @return {void} + * @method parseStyleAttribute + */ + parseStyleAttribute: function(input){ + input += "}"; // for error recovery in _readDeclarations() + this._tokenStream = new TokenStream(input, Tokens); + this._readDeclarations(); } + }; + + //copy over onto prototype + for (prop in additions){ + if (Object.prototype.hasOwnProperty.call(additions, prop)){ + proto[prop] = additions[prop]; } - else { - element = value; - } - if (!group) { - group = this.subjectSelector ? this.subjectSelector() : new Subject_1.Subject(); - groups.set(key, group); - var groupedObservable = new GroupedObservable(key, group, this); - this.destination.next(groupedObservable); - if (this.durationSelector) { - var duration = void 0; - try { - duration = this.durationSelector(new GroupedObservable(key, group)); - } - catch (err) { - this.error(err); - return; + } + + return proto; +}(); + + +/* +nth + : S* [ ['-'|'+']? INTEGER? {N} [ S* ['-'|'+'] S* INTEGER ]? | + ['-'|'+']? INTEGER | {O}{D}{D} | {E}{V}{E}{N} ] S* + ; +*/ +var Properties = { + __proto__: null, + + //A + "align-items" : "flex-start | flex-end | center | baseline | stretch", + "align-content" : "flex-start | flex-end | center | space-between | space-around | stretch", + "align-self" : "auto | flex-start | flex-end | center | baseline | stretch", + "-webkit-align-items" : "flex-start | flex-end | center | baseline | stretch", + "-webkit-align-content" : "flex-start | flex-end | center | space-between | space-around | stretch", + "-webkit-align-self" : "auto | flex-start | flex-end | center | baseline | stretch", + "alignment-adjust" : "auto | baseline | before-edge | text-before-edge | middle | central | after-edge | text-after-edge | ideographic | alphabetic | hanging | mathematical | | ", + "alignment-baseline" : "baseline | use-script | before-edge | text-before-edge | after-edge | text-after-edge | central | middle | ideographic | alphabetic | hanging | mathematical", + "animation" : 1, + "animation-delay" : { multi: "", comma: true }, + "animation-direction" : { multi: "normal | alternate", comma: true }, + "animation-duration" : { multi: "", comma: true }, + "animation-fill-mode" : { multi: "none | forwards | backwards | both", comma: true }, + "animation-iteration-count" : { multi: " | infinite", comma: true }, + "animation-name" : { multi: "none | ", comma: true }, + "animation-play-state" : { multi: "running | paused", comma: true }, + "animation-timing-function" : 1, + + //vendor prefixed + "-moz-animation-delay" : { multi: "", comma: true }, + "-moz-animation-direction" : { multi: "normal | alternate", comma: true }, + "-moz-animation-duration" : { multi: "", comma: true }, + "-moz-animation-iteration-count" : { multi: " | infinite", comma: true }, + "-moz-animation-name" : { multi: "none | ", comma: true }, + "-moz-animation-play-state" : { multi: "running | paused", comma: true }, + + "-ms-animation-delay" : { multi: "", comma: true }, + "-ms-animation-direction" : { multi: "normal | alternate", comma: true }, + "-ms-animation-duration" : { multi: "", comma: true }, + "-ms-animation-iteration-count" : { multi: " | infinite", comma: true }, + "-ms-animation-name" : { multi: "none | ", comma: true }, + "-ms-animation-play-state" : { multi: "running | paused", comma: true }, + + "-webkit-animation-delay" : { multi: "", comma: true }, + "-webkit-animation-direction" : { multi: "normal | alternate", comma: true }, + "-webkit-animation-duration" : { multi: "", comma: true }, + "-webkit-animation-fill-mode" : { multi: "none | forwards | backwards | both", comma: true }, + "-webkit-animation-iteration-count" : { multi: " | infinite", comma: true }, + "-webkit-animation-name" : { multi: "none | ", comma: true }, + "-webkit-animation-play-state" : { multi: "running | paused", comma: true }, + + "-o-animation-delay" : { multi: "", comma: true }, + "-o-animation-direction" : { multi: "normal | alternate", comma: true }, + "-o-animation-duration" : { multi: "", comma: true }, + "-o-animation-iteration-count" : { multi: " | infinite", comma: true }, + "-o-animation-name" : { multi: "none | ", comma: true }, + "-o-animation-play-state" : { multi: "running | paused", comma: true }, + + "appearance" : "icon | window | desktop | workspace | document | tooltip | dialog | button | push-button | hyperlink | radio | radio-button | checkbox | menu-item | tab | menu | menubar | pull-down-menu | pop-up-menu | list-menu | radio-group | checkbox-group | outline-tree | range | field | combo-box | signature | password | normal | none | inherit", + "azimuth" : function (expression) { + var simple = " | leftwards | rightwards | inherit", + direction = "left-side | far-left | left | center-left | center | center-right | right | far-right | right-side", + behind = false, + valid = false, + part; + + if (!ValidationTypes.isAny(expression, simple)) { + if (ValidationTypes.isAny(expression, "behind")) { + behind = true; + valid = true; + } + + if (ValidationTypes.isAny(expression, direction)) { + valid = true; + if (!behind) { + ValidationTypes.isAny(expression, "behind"); } - this.add(duration.subscribe(new GroupDurationSubscriber(key, group, this))); } } - if (!group.closed) { - group.next(element); + + if (expression.hasNext()) { + part = expression.next(); + if (valid) { + throw new ValidationError("Expected end of value but found '" + part + "'.", part.line, part.col); + } else { + throw new ValidationError("Expected (<'azimuth'>) but found '" + part + "'.", part.line, part.col); + } } - }; - GroupBySubscriber.prototype._error = function (err) { - var groups = this.groups; - if (groups) { - groups.forEach(function (group, key) { - group.error(err); - }); - groups.clear(); + }, + + //B + "backface-visibility" : "visible | hidden", + "background" : 1, + "background-attachment" : { multi: "", comma: true }, + "background-clip" : { multi: "", comma: true }, + "background-color" : " | inherit", + "background-image" : { multi: "", comma: true }, + "background-origin" : { multi: "", comma: true }, + "background-position" : { multi: "", comma: true }, + "background-repeat" : { multi: "" }, + "background-size" : { multi: "", comma: true }, + "baseline-shift" : "baseline | sub | super | | ", + "behavior" : 1, + "binding" : 1, + "bleed" : "", + "bookmark-label" : " | | ", + "bookmark-level" : "none | ", + "bookmark-state" : "open | closed", + "bookmark-target" : "none | | ", + "border" : " || || ", + "border-bottom" : " || || ", + "border-bottom-color" : " | inherit", + "border-bottom-left-radius" : "", + "border-bottom-right-radius" : "", + "border-bottom-style" : "", + "border-bottom-width" : "", + "border-collapse" : "collapse | separate | inherit", + "border-color" : { multi: " | inherit", max: 4 }, + "border-image" : 1, + "border-image-outset" : { multi: " | ", max: 4 }, + "border-image-repeat" : { multi: "stretch | repeat | round", max: 2 }, + "border-image-slice" : function(expression) { + + var valid = false, + numeric = " | ", + fill = false, + count = 0, + max = 4, + part; + + if (ValidationTypes.isAny(expression, "fill")) { + fill = true; + valid = true; + } + + while (expression.hasNext() && count < max) { + valid = ValidationTypes.isAny(expression, numeric); + if (!valid) { + break; + } + count++; } - this.destination.error(err); - }; - GroupBySubscriber.prototype._complete = function () { - var groups = this.groups; - if (groups) { - groups.forEach(function (group, key) { - group.complete(); - }); - groups.clear(); + + + if (!fill) { + ValidationTypes.isAny(expression, "fill"); + } else { + valid = true; } - this.destination.complete(); - }; - GroupBySubscriber.prototype.removeGroup = function (key) { - this.groups.delete(key); - }; - GroupBySubscriber.prototype.unsubscribe = function () { - if (!this.closed) { - this.attemptedToUnsubscribe = true; - if (this.count === 0) { - _super.prototype.unsubscribe.call(this); + + if (expression.hasNext()) { + part = expression.next(); + if (valid) { + throw new ValidationError("Expected end of value but found '" + part + "'.", part.line, part.col); + } else { + throw new ValidationError("Expected ([ | ]{1,4} && fill?) but found '" + part + "'.", part.line, part.col); } } - }; - return GroupBySubscriber; -}(Subscriber_1.Subscriber)); -/** - * We need this JSDoc comment for affecting ESDoc. - * @ignore - * @extends {Ignored} - */ -var GroupDurationSubscriber = (function (_super) { - __extends(GroupDurationSubscriber, _super); - function GroupDurationSubscriber(key, group, parent) { - _super.call(this, group); - this.key = key; - this.group = group; - this.parent = parent; - } - GroupDurationSubscriber.prototype._next = function (value) { - this.complete(); - }; - GroupDurationSubscriber.prototype._unsubscribe = function () { - var _a = this, parent = _a.parent, key = _a.key; - this.key = this.parent = null; - if (parent) { - parent.removeGroup(key); + }, + "border-image-source" : " | none", + "border-image-width" : { multi: " | | | auto", max: 4 }, + "border-left" : " || || ", + "border-left-color" : " | inherit", + "border-left-style" : "", + "border-left-width" : "", + "border-radius" : function(expression) { + + var valid = false, + simple = " | | inherit", + slash = false, + count = 0, + max = 8, + part; + + while (expression.hasNext() && count < max) { + valid = ValidationTypes.isAny(expression, simple); + if (!valid) { + + if (String(expression.peek()) === "/" && count > 0 && !slash) { + slash = true; + max = count + 5; + expression.next(); + } else { + break; + } + } + count++; } - }; - return GroupDurationSubscriber; -}(Subscriber_1.Subscriber)); -/** - * An Observable representing values belonging to the same group represented by - * a common key. The values emitted by a GroupedObservable come from the source - * Observable. The common key is available as the field `key` on a - * GroupedObservable instance. - * - * @class GroupedObservable - */ -var GroupedObservable = (function (_super) { - __extends(GroupedObservable, _super); - function GroupedObservable(key, groupSubject, refCountSubscription) { - _super.call(this); - this.key = key; - this.groupSubject = groupSubject; - this.refCountSubscription = refCountSubscription; - } - GroupedObservable.prototype._subscribe = function (subscriber) { - var subscription = new Subscription_1.Subscription(); - var _a = this, refCountSubscription = _a.refCountSubscription, groupSubject = _a.groupSubject; - if (refCountSubscription && !refCountSubscription.closed) { - subscription.add(new InnerRefCountSubscription(refCountSubscription)); + + if (expression.hasNext()) { + part = expression.next(); + if (valid) { + throw new ValidationError("Expected end of value but found '" + part + "'.", part.line, part.col); + } else { + throw new ValidationError("Expected (<'border-radius'>) but found '" + part + "'.", part.line, part.col); + } } - subscription.add(groupSubject.subscribe(subscriber)); - return subscription; - }; - return GroupedObservable; -}(Observable_1.Observable)); -exports.GroupedObservable = GroupedObservable; -/** - * We need this JSDoc comment for affecting ESDoc. - * @ignore - * @extends {Ignored} - */ -var InnerRefCountSubscription = (function (_super) { - __extends(InnerRefCountSubscription, _super); - function InnerRefCountSubscription(parent) { - _super.call(this); - this.parent = parent; - parent.count++; - } - InnerRefCountSubscription.prototype.unsubscribe = function () { - var parent = this.parent; - if (!parent.closed && !this.closed) { - _super.prototype.unsubscribe.call(this); - parent.count -= 1; - if (parent.count === 0 && parent.attemptedToUnsubscribe) { - parent.unsubscribe(); + }, + "border-right" : "
>>2]>>>(24-(o%4)*8))&255;n.push(String.fromCharCode(s))}return n.join("")},parse:function(p){var n=p.length;var q=[];for(var o=0;o>>2]|=(p.charCodeAt(o)&255)<<(24-(o%4)*8)}return new l.init(q,n)}};var c=m.Utf8={stringify:function(n){try{return decodeURIComponent(escape(d.stringify(n)))}catch(o){throw new Error("Malformed UTF-8 data")}},parse:function(n){return d.parse(unescape(encodeURIComponent(n)))}};var i=b.BufferedBlockAlgorithm=j.extend({reset:function(){this._data=new l.init();this._nDataBytes=0},_append:function(n){if(typeof n=="string"){n=c.parse(n)}this._data.concat(n);this._nDataBytes+=n.sigBytes},_process:function(w){var q=this._data;var x=q.words;var n=q.sigBytes;var t=this.blockSize;var v=t*4;var u=n/v;if(w){u=e.ceil(u)}else{u=e.max((u|0)-this._minBufferSize,0)}var s=u*t;var r=e.min(s*4,n);if(s){for(var p=0;p>>2]&255}};f.BlockCipher=n.extend({cfg:n.cfg.extend({mode:m,padding:h}),reset:function(){n.reset.call(this);var a=this.cfg,b=a.iv,a=a.mode;if(this._xformMode==this._ENC_XFORM_MODE)var c=a.createEncryptor;else c=a.createDecryptor,this._minBufferSize=1; -this._mode=c.call(a,this,b&&b.words)},_doProcessBlock:function(a,b){this._mode.processBlock(a,b)},_doFinalize:function(){var a=this.cfg.padding;if(this._xformMode==this._ENC_XFORM_MODE){a.pad(this._data,this.blockSize);var b=this._process(!0)}else b=this._process(!0),a.unpad(b);return b},blockSize:4});var p=f.CipherParams=k.extend({init:function(a){this.mixIn(a)},toString:function(a){return(a||this.formatter).stringify(this)}}),m=(g.format={}).OpenSSL={stringify:function(a){var b=a.ciphertext;a=a.salt; -return(a?l.create([1398893684,1701076831]).concat(a).concat(b):b).toString(r)},parse:function(a){a=r.parse(a);var b=a.words;if(1398893684==b[0]&&1701076831==b[1]){var c=l.create(b.slice(2,4));b.splice(0,4);a.sigBytes-=16}return p.create({ciphertext:a,salt:c})}},j=f.SerializableCipher=k.extend({cfg:k.extend({format:m}),encrypt:function(a,b,c,d){d=this.cfg.extend(d);var e=a.createEncryptor(c,d);b=e.finalize(b);e=e.cfg;return p.create({ciphertext:b,key:c,iv:e.iv,algorithm:a,mode:e.mode,padding:e.padding, -blockSize:a.blockSize,formatter:d.format})},decrypt:function(a,b,c,d){d=this.cfg.extend(d);b=this._parse(b,d.format);return a.createDecryptor(c,d).finalize(b.ciphertext)},_parse:function(a,b){return"string"==typeof a?b.parse(a,this):a}}),g=(g.kdf={}).OpenSSL={execute:function(a,b,c,d){d||(d=l.random(8));a=v.create({keySize:b+c}).compute(a,d);c=l.create(a.words.slice(b),4*c);a.sigBytes=4*b;return p.create({key:a,iv:c,salt:d})}},s=f.PasswordBasedCipher=j.extend({cfg:j.cfg.extend({kdf:g}),encrypt:function(a, -b,c,d){d=this.cfg.extend(d);c=d.kdf.execute(c,a.keySize,a.ivSize);d.iv=c.iv;a=j.encrypt.call(this,a,b,c.key,d);a.mixIn(c);return a},decrypt:function(a,b,c,d){d=this.cfg.extend(d);b=this._parse(b,d.format);c=d.kdf.execute(c,a.keySize,a.ivSize,b.salt);d.iv=c.iv;return j.decrypt.call(this,a,b,c.key,d)}})}(); - -/* -CryptoJS v3.1.2 aes.js -code.google.com/p/crypto-js -(c) 2009-2013 by Jeff Mott. All rights reserved. -code.google.com/p/crypto-js/wiki/License -*/ -(function(){for(var q=CryptoJS,x=q.lib.BlockCipher,r=q.algo,j=[],y=[],z=[],A=[],B=[],C=[],s=[],u=[],v=[],w=[],g=[],k=0;256>k;k++)g[k]=128>k?k<<1:k<<1^283;for(var n=0,l=0,k=0;256>k;k++){var f=l^l<<1^l<<2^l<<3^l<<4,f=f>>>8^f&255^99;j[n]=f;y[f]=n;var t=g[n],D=g[t],E=g[D],b=257*g[f]^16843008*f;z[n]=b<<24|b>>>8;A[n]=b<<16|b>>>16;B[n]=b<<8|b>>>24;C[n]=b;b=16843009*E^65537*D^257*t^16843008*n;s[f]=b<<24|b>>>8;u[f]=b<<16|b>>>16;v[f]=b<<8|b>>>24;w[f]=b;n?(n=t^g[g[g[E^t]]],l^=g[g[l]]):n=l=1}var F=[0,1,2,4,8, -16,32,64,128,27,54],r=r.AES=x.extend({_doReset:function(){for(var c=this._key,e=c.words,a=c.sigBytes/4,c=4*((this._nRounds=a+6)+1),b=this._keySchedule=[],h=0;h>>24]<<24|j[d>>>16&255]<<16|j[d>>>8&255]<<8|j[d&255]):(d=d<<8|d>>>24,d=j[d>>>24]<<24|j[d>>>16&255]<<16|j[d>>>8&255]<<8|j[d&255],d^=F[h/a|0]<<24);b[h]=b[h-a]^d}e=this._invKeySchedule=[];for(a=0;aa||4>=h?d:s[j[d>>>24]]^u[j[d>>>16&255]]^v[j[d>>> -8&255]]^w[j[d&255]]},encryptBlock:function(c,e){this._doCryptBlock(c,e,this._keySchedule,z,A,B,C,j)},decryptBlock:function(c,e){var a=c[e+1];c[e+1]=c[e+3];c[e+3]=a;this._doCryptBlock(c,e,this._invKeySchedule,s,u,v,w,y);a=c[e+1];c[e+1]=c[e+3];c[e+3]=a},_doCryptBlock:function(c,e,a,b,h,d,j,m){for(var n=this._nRounds,f=c[e]^a[0],g=c[e+1]^a[1],k=c[e+2]^a[2],p=c[e+3]^a[3],l=4,t=1;t>>24]^h[g>>>16&255]^d[k>>>8&255]^j[p&255]^a[l++],r=b[g>>>24]^h[k>>>16&255]^d[p>>>8&255]^j[f&255]^a[l++],s= -b[k>>>24]^h[p>>>16&255]^d[f>>>8&255]^j[g&255]^a[l++],p=b[p>>>24]^h[f>>>16&255]^d[g>>>8&255]^j[k&255]^a[l++],f=q,g=r,k=s;q=(m[f>>>24]<<24|m[g>>>16&255]<<16|m[k>>>8&255]<<8|m[p&255])^a[l++];r=(m[g>>>24]<<24|m[k>>>16&255]<<16|m[p>>>8&255]<<8|m[f&255])^a[l++];s=(m[k>>>24]<<24|m[p>>>16&255]<<16|m[f>>>8&255]<<8|m[g&255])^a[l++];p=(m[p>>>24]<<24|m[f>>>16&255]<<16|m[g>>>8&255]<<8|m[k&255])^a[l++];c[e]=q;c[e+1]=r;c[e+2]=s;c[e+3]=p},keySize:8});q.AES=x._createHelper(r)})(); - -/* -CryptoJS v3.1.2 tripledes-min.js -code.google.com/p/crypto-js -(c) 2009-2013 by Jeff Mott. All rights reserved. -code.google.com/p/crypto-js/wiki/License -*/ -(function(){function j(b,c){var a=(this._lBlock>>>b^this._rBlock)&c;this._rBlock^=a;this._lBlock^=a<>>b^this._lBlock)&c;this._lBlock^=a;this._rBlock^=a<a;a++){var f=q[a]-1;c[a]=b[f>>>5]>>>31-f%32&1}b=this._subKeys=[];for(f=0;16>f;f++){for(var d=b[f]=[],e=r[f],a=0;24>a;a++)d[a/6|0]|=c[(p[a]-1+e)%28]<<31-a%6,d[4+(a/6|0)]|=c[28+(p[a+24]-1+e)%28]<<31-a%6;d[0]=d[0]<<1|d[0]>>>31;for(a=1;7>a;a++)d[a]>>>= -4*(a-1)+3;d[7]=d[7]<<5|d[7]>>>27}c=this._invSubKeys=[];for(a=0;16>a;a++)c[a]=b[15-a]},encryptBlock:function(b,c){this._doCryptBlock(b,c,this._subKeys)},decryptBlock:function(b,c){this._doCryptBlock(b,c,this._invSubKeys)},_doCryptBlock:function(b,c,a){this._lBlock=b[c];this._rBlock=b[c+1];j.call(this,4,252645135);j.call(this,16,65535);l.call(this,2,858993459);l.call(this,8,16711935);j.call(this,1,1431655765);for(var f=0;16>f;f++){for(var d=a[f],e=this._lBlock,h=this._rBlock,g=0,k=0;8>k;k++)g|=s[k][((h^ -d[k])&t[k])>>>0];this._lBlock=h;this._rBlock=e^g}a=this._lBlock;this._lBlock=this._rBlock;this._rBlock=a;j.call(this,1,1431655765);l.call(this,8,16711935);l.call(this,2,858993459);j.call(this,16,65535);j.call(this,4,252645135);b[c]=this._lBlock;b[c+1]=this._rBlock},keySize:2,ivSize:2,blockSize:2});h.DES=e._createHelper(m);g=g.TripleDES=e.extend({_doReset:function(){var b=this._key.words;this._des1=m.createEncryptor(n.create(b.slice(0,2)));this._des2=m.createEncryptor(n.create(b.slice(2,4)));this._des3= -m.createEncryptor(n.create(b.slice(4,6)))},encryptBlock:function(b,c){this._des1.encryptBlock(b,c);this._des2.decryptBlock(b,c);this._des3.encryptBlock(b,c)},decryptBlock:function(b,c){this._des3.decryptBlock(b,c);this._des2.encryptBlock(b,c);this._des1.decryptBlock(b,c)},keySize:6,ivSize:2,blockSize:2});h.TripleDES=e._createHelper(g)})(); - -/* -CryptoJS v3.1.2 enc-base64.js -code.google.com/p/crypto-js -(c) 2009-2013 by Jeff Mott. All rights reserved. -code.google.com/p/crypto-js/wiki/License -*/ -(function(){var h=CryptoJS,j=h.lib.WordArray;h.enc.Base64={stringify:function(b){var e=b.words,f=b.sigBytes,c=this._map;b.clamp();b=[];for(var a=0;a>>2]>>>24-8*(a%4)&255)<<16|(e[a+1>>>2]>>>24-8*((a+1)%4)&255)<<8|e[a+2>>>2]>>>24-8*((a+2)%4)&255,g=0;4>g&&a+0.75*g>>6*(3-g)&63));if(e=c.charAt(64))for(;b.length%4;)b.push(e);return b.join("")},parse:function(b){var e=b.length,f=this._map,c=f.charAt(64);c&&(c=b.indexOf(c),-1!=c&&(e=c));for(var c=[],a=0,d=0;d< -e;d++)if(d%4){var g=f.indexOf(b.charAt(d-1))<<2*(d%4),h=f.indexOf(b.charAt(d))>>>6-2*(d%4);c[a>>>2]|=(g|h)<<24-8*(a%4);a++}return j.create(c,a)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="}})(); - -/* -CryptoJS v3.1.2 md5.js -code.google.com/p/crypto-js -(c) 2009-2013 by Jeff Mott. All rights reserved. -code.google.com/p/crypto-js/wiki/License -*/ -(function(E){function h(a,f,g,j,p,h,k){a=a+(f&g|~f&j)+p+k;return(a<>>32-h)+f}function k(a,f,g,j,p,h,k){a=a+(f&j|g&~j)+p+k;return(a<>>32-h)+f}function l(a,f,g,j,h,k,l){a=a+(f^g^j)+h+l;return(a<>>32-k)+f}function n(a,f,g,j,h,k,l){a=a+(g^(f|~j))+h+l;return(a<>>32-k)+f}for(var r=CryptoJS,q=r.lib,F=q.WordArray,s=q.Hasher,q=r.algo,a=[],t=0;64>t;t++)a[t]=4294967296*E.abs(E.sin(t+1))|0;q=q.MD5=s.extend({_doReset:function(){this._hash=new F.init([1732584193,4023233417,2562383102,271733878])}, -_doProcessBlock:function(m,f){for(var g=0;16>g;g++){var j=f+g,p=m[j];m[j]=(p<<8|p>>>24)&16711935|(p<<24|p>>>8)&4278255360}var g=this._hash.words,j=m[f+0],p=m[f+1],q=m[f+2],r=m[f+3],s=m[f+4],t=m[f+5],u=m[f+6],v=m[f+7],w=m[f+8],x=m[f+9],y=m[f+10],z=m[f+11],A=m[f+12],B=m[f+13],C=m[f+14],D=m[f+15],b=g[0],c=g[1],d=g[2],e=g[3],b=h(b,c,d,e,j,7,a[0]),e=h(e,b,c,d,p,12,a[1]),d=h(d,e,b,c,q,17,a[2]),c=h(c,d,e,b,r,22,a[3]),b=h(b,c,d,e,s,7,a[4]),e=h(e,b,c,d,t,12,a[5]),d=h(d,e,b,c,u,17,a[6]),c=h(c,d,e,b,v,22,a[7]), -b=h(b,c,d,e,w,7,a[8]),e=h(e,b,c,d,x,12,a[9]),d=h(d,e,b,c,y,17,a[10]),c=h(c,d,e,b,z,22,a[11]),b=h(b,c,d,e,A,7,a[12]),e=h(e,b,c,d,B,12,a[13]),d=h(d,e,b,c,C,17,a[14]),c=h(c,d,e,b,D,22,a[15]),b=k(b,c,d,e,p,5,a[16]),e=k(e,b,c,d,u,9,a[17]),d=k(d,e,b,c,z,14,a[18]),c=k(c,d,e,b,j,20,a[19]),b=k(b,c,d,e,t,5,a[20]),e=k(e,b,c,d,y,9,a[21]),d=k(d,e,b,c,D,14,a[22]),c=k(c,d,e,b,s,20,a[23]),b=k(b,c,d,e,x,5,a[24]),e=k(e,b,c,d,C,9,a[25]),d=k(d,e,b,c,r,14,a[26]),c=k(c,d,e,b,w,20,a[27]),b=k(b,c,d,e,B,5,a[28]),e=k(e,b, -c,d,q,9,a[29]),d=k(d,e,b,c,v,14,a[30]),c=k(c,d,e,b,A,20,a[31]),b=l(b,c,d,e,t,4,a[32]),e=l(e,b,c,d,w,11,a[33]),d=l(d,e,b,c,z,16,a[34]),c=l(c,d,e,b,C,23,a[35]),b=l(b,c,d,e,p,4,a[36]),e=l(e,b,c,d,s,11,a[37]),d=l(d,e,b,c,v,16,a[38]),c=l(c,d,e,b,y,23,a[39]),b=l(b,c,d,e,B,4,a[40]),e=l(e,b,c,d,j,11,a[41]),d=l(d,e,b,c,r,16,a[42]),c=l(c,d,e,b,u,23,a[43]),b=l(b,c,d,e,x,4,a[44]),e=l(e,b,c,d,A,11,a[45]),d=l(d,e,b,c,D,16,a[46]),c=l(c,d,e,b,q,23,a[47]),b=n(b,c,d,e,j,6,a[48]),e=n(e,b,c,d,v,10,a[49]),d=n(d,e,b,c, -C,15,a[50]),c=n(c,d,e,b,t,21,a[51]),b=n(b,c,d,e,A,6,a[52]),e=n(e,b,c,d,r,10,a[53]),d=n(d,e,b,c,y,15,a[54]),c=n(c,d,e,b,p,21,a[55]),b=n(b,c,d,e,w,6,a[56]),e=n(e,b,c,d,D,10,a[57]),d=n(d,e,b,c,u,15,a[58]),c=n(c,d,e,b,B,21,a[59]),b=n(b,c,d,e,s,6,a[60]),e=n(e,b,c,d,z,10,a[61]),d=n(d,e,b,c,q,15,a[62]),c=n(c,d,e,b,x,21,a[63]);g[0]=g[0]+b|0;g[1]=g[1]+c|0;g[2]=g[2]+d|0;g[3]=g[3]+e|0},_doFinalize:function(){var a=this._data,f=a.words,g=8*this._nDataBytes,j=8*a.sigBytes;f[j>>>5]|=128<<24-j%32;var h=E.floor(g/ -4294967296);f[(j+64>>>9<<4)+15]=(h<<8|h>>>24)&16711935|(h<<24|h>>>8)&4278255360;f[(j+64>>>9<<4)+14]=(g<<8|g>>>24)&16711935|(g<<24|g>>>8)&4278255360;a.sigBytes=4*(f.length+1);this._process();a=this._hash;f=a.words;for(g=0;4>g;g++)j=f[g],f[g]=(j<<8|j>>>24)&16711935|(j<<24|j>>>8)&4278255360;return a},clone:function(){var a=s.clone.call(this);a._hash=this._hash.clone();return a}});r.MD5=s._createHelper(q);r.HmacMD5=s._createHmacHelper(q)})(Math); - -/* -CryptoJS v3.1.2 sha1-min.js -code.google.com/p/crypto-js -(c) 2009-2013 by Jeff Mott. All rights reserved. -code.google.com/p/crypto-js/wiki/License -*/ -(function(){var k=CryptoJS,b=k.lib,m=b.WordArray,l=b.Hasher,d=[],b=k.algo.SHA1=l.extend({_doReset:function(){this._hash=new m.init([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(n,p){for(var a=this._hash.words,e=a[0],f=a[1],h=a[2],j=a[3],b=a[4],c=0;80>c;c++){if(16>c)d[c]=n[p+c]|0;else{var g=d[c-3]^d[c-8]^d[c-14]^d[c-16];d[c]=g<<1|g>>>31}g=(e<<5|e>>>27)+b+d[c];g=20>c?g+((f&h|~f&j)+1518500249):40>c?g+((f^h^j)+1859775393):60>c?g+((f&h|f&j|h&j)-1894007588):g+((f^h^ -j)-899497514);b=j;j=h;h=f<<30|f>>>2;f=e;e=g}a[0]=a[0]+e|0;a[1]=a[1]+f|0;a[2]=a[2]+h|0;a[3]=a[3]+j|0;a[4]=a[4]+b|0},_doFinalize:function(){var b=this._data,d=b.words,a=8*this._nDataBytes,e=8*b.sigBytes;d[e>>>5]|=128<<24-e%32;d[(e+64>>>9<<4)+14]=Math.floor(a/4294967296);d[(e+64>>>9<<4)+15]=a;b.sigBytes=4*d.length;this._process();return this._hash},clone:function(){var b=l.clone.call(this);b._hash=this._hash.clone();return b}});k.SHA1=l._createHelper(b);k.HmacSHA1=l._createHmacHelper(b)})(); - -/* -CryptoJS v3.1.2 sha256-min.js -code.google.com/p/crypto-js -(c) 2009-2013 by Jeff Mott. All rights reserved. -code.google.com/p/crypto-js/wiki/License -*/ -(function(k){for(var g=CryptoJS,h=g.lib,v=h.WordArray,j=h.Hasher,h=g.algo,s=[],t=[],u=function(q){return 4294967296*(q-(q|0))|0},l=2,b=0;64>b;){var d;a:{d=l;for(var w=k.sqrt(d),r=2;r<=w;r++)if(!(d%r)){d=!1;break a}d=!0}d&&(8>b&&(s[b]=u(k.pow(l,0.5))),t[b]=u(k.pow(l,1/3)),b++);l++}var n=[],h=h.SHA256=j.extend({_doReset:function(){this._hash=new v.init(s.slice(0))},_doProcessBlock:function(q,h){for(var a=this._hash.words,c=a[0],d=a[1],b=a[2],k=a[3],f=a[4],g=a[5],j=a[6],l=a[7],e=0;64>e;e++){if(16>e)n[e]= -q[h+e]|0;else{var m=n[e-15],p=n[e-2];n[e]=((m<<25|m>>>7)^(m<<14|m>>>18)^m>>>3)+n[e-7]+((p<<15|p>>>17)^(p<<13|p>>>19)^p>>>10)+n[e-16]}m=l+((f<<26|f>>>6)^(f<<21|f>>>11)^(f<<7|f>>>25))+(f&g^~f&j)+t[e]+n[e];p=((c<<30|c>>>2)^(c<<19|c>>>13)^(c<<10|c>>>22))+(c&d^c&b^d&b);l=j;j=g;g=f;f=k+m|0;k=b;b=d;d=c;c=m+p|0}a[0]=a[0]+c|0;a[1]=a[1]+d|0;a[2]=a[2]+b|0;a[3]=a[3]+k|0;a[4]=a[4]+f|0;a[5]=a[5]+g|0;a[6]=a[6]+j|0;a[7]=a[7]+l|0},_doFinalize:function(){var d=this._data,b=d.words,a=8*this._nDataBytes,c=8*d.sigBytes; -b[c>>>5]|=128<<24-c%32;b[(c+64>>>9<<4)+14]=k.floor(a/4294967296);b[(c+64>>>9<<4)+15]=a;d.sigBytes=4*b.length;this._process();return this._hash},clone:function(){var b=j.clone.call(this);b._hash=this._hash.clone();return b}});g.SHA256=j._createHelper(h);g.HmacSHA256=j._createHmacHelper(h)})(Math); - -/* -CryptoJS v3.1.2 sha224-min.js -code.google.com/p/crypto-js -(c) 2009-2013 by Jeff Mott. All rights reserved. -code.google.com/p/crypto-js/wiki/License -*/ -(function(){var b=CryptoJS,d=b.lib.WordArray,a=b.algo,c=a.SHA256,a=a.SHA224=c.extend({_doReset:function(){this._hash=new d.init([3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428])},_doFinalize:function(){var a=c._doFinalize.call(this);a.sigBytes-=4;return a}});b.SHA224=c._createHelper(a);b.HmacSHA224=c._createHmacHelper(a)})(); - -/* -CryptoJS v3.1.2 sha512-min.js -code.google.com/p/crypto-js -(c) 2009-2013 by Jeff Mott. All rights reserved. -code.google.com/p/crypto-js/wiki/License -*/ -(function(){function a(){return d.create.apply(d,arguments)}for(var n=CryptoJS,r=n.lib.Hasher,e=n.x64,d=e.Word,T=e.WordArray,e=n.algo,ea=[a(1116352408,3609767458),a(1899447441,602891725),a(3049323471,3964484399),a(3921009573,2173295548),a(961987163,4081628472),a(1508970993,3053834265),a(2453635748,2937671579),a(2870763221,3664609560),a(3624381080,2734883394),a(310598401,1164996542),a(607225278,1323610764),a(1426881987,3590304994),a(1925078388,4068182383),a(2162078206,991336113),a(2614888103,633803317), -a(3248222580,3479774868),a(3835390401,2666613458),a(4022224774,944711139),a(264347078,2341262773),a(604807628,2007800933),a(770255983,1495990901),a(1249150122,1856431235),a(1555081692,3175218132),a(1996064986,2198950837),a(2554220882,3999719339),a(2821834349,766784016),a(2952996808,2566594879),a(3210313671,3203337956),a(3336571891,1034457026),a(3584528711,2466948901),a(113926993,3758326383),a(338241895,168717936),a(666307205,1188179964),a(773529912,1546045734),a(1294757372,1522805485),a(1396182291, -2643833823),a(1695183700,2343527390),a(1986661051,1014477480),a(2177026350,1206759142),a(2456956037,344077627),a(2730485921,1290863460),a(2820302411,3158454273),a(3259730800,3505952657),a(3345764771,106217008),a(3516065817,3606008344),a(3600352804,1432725776),a(4094571909,1467031594),a(275423344,851169720),a(430227734,3100823752),a(506948616,1363258195),a(659060556,3750685593),a(883997877,3785050280),a(958139571,3318307427),a(1322822218,3812723403),a(1537002063,2003034995),a(1747873779,3602036899), -a(1955562222,1575990012),a(2024104815,1125592928),a(2227730452,2716904306),a(2361852424,442776044),a(2428436474,593698344),a(2756734187,3733110249),a(3204031479,2999351573),a(3329325298,3815920427),a(3391569614,3928383900),a(3515267271,566280711),a(3940187606,3454069534),a(4118630271,4000239992),a(116418474,1914138554),a(174292421,2731055270),a(289380356,3203993006),a(460393269,320620315),a(685471733,587496836),a(852142971,1086792851),a(1017036298,365543100),a(1126000580,2618297676),a(1288033470, -3409855158),a(1501505948,4234509866),a(1607167915,987167468),a(1816402316,1246189591)],v=[],w=0;80>w;w++)v[w]=a();e=e.SHA512=r.extend({_doReset:function(){this._hash=new T.init([new d.init(1779033703,4089235720),new d.init(3144134277,2227873595),new d.init(1013904242,4271175723),new d.init(2773480762,1595750129),new d.init(1359893119,2917565137),new d.init(2600822924,725511199),new d.init(528734635,4215389547),new d.init(1541459225,327033209)])},_doProcessBlock:function(a,d){for(var f=this._hash.words, -F=f[0],e=f[1],n=f[2],r=f[3],G=f[4],H=f[5],I=f[6],f=f[7],w=F.high,J=F.low,X=e.high,K=e.low,Y=n.high,L=n.low,Z=r.high,M=r.low,$=G.high,N=G.low,aa=H.high,O=H.low,ba=I.high,P=I.low,ca=f.high,Q=f.low,k=w,g=J,z=X,x=K,A=Y,y=L,U=Z,B=M,l=$,h=N,R=aa,C=O,S=ba,D=P,V=ca,E=Q,m=0;80>m;m++){var s=v[m];if(16>m)var j=s.high=a[d+2*m]|0,b=s.low=a[d+2*m+1]|0;else{var j=v[m-15],b=j.high,p=j.low,j=(b>>>1|p<<31)^(b>>>8|p<<24)^b>>>7,p=(p>>>1|b<<31)^(p>>>8|b<<24)^(p>>>7|b<<25),u=v[m-2],b=u.high,c=u.low,u=(b>>>19|c<<13)^(b<< -3|c>>>29)^b>>>6,c=(c>>>19|b<<13)^(c<<3|b>>>29)^(c>>>6|b<<26),b=v[m-7],W=b.high,t=v[m-16],q=t.high,t=t.low,b=p+b.low,j=j+W+(b>>>0>>0?1:0),b=b+c,j=j+u+(b>>>0>>0?1:0),b=b+t,j=j+q+(b>>>0>>0?1:0);s.high=j;s.low=b}var W=l&R^~l&S,t=h&C^~h&D,s=k&z^k&A^z&A,T=g&x^g&y^x&y,p=(k>>>28|g<<4)^(k<<30|g>>>2)^(k<<25|g>>>7),u=(g>>>28|k<<4)^(g<<30|k>>>2)^(g<<25|k>>>7),c=ea[m],fa=c.high,da=c.low,c=E+((h>>>14|l<<18)^(h>>>18|l<<14)^(h<<23|l>>>9)),q=V+((l>>>14|h<<18)^(l>>>18|h<<14)^(l<<23|h>>>9))+(c>>>0>>0?1: -0),c=c+t,q=q+W+(c>>>0>>0?1:0),c=c+da,q=q+fa+(c>>>0>>0?1:0),c=c+b,q=q+j+(c>>>0>>0?1:0),b=u+T,s=p+s+(b>>>0>>0?1:0),V=S,E=D,S=R,D=C,R=l,C=h,h=B+c|0,l=U+q+(h>>>0>>0?1:0)|0,U=A,B=y,A=z,y=x,z=k,x=g,g=c+b|0,k=q+s+(g>>>0>>0?1:0)|0}J=F.low=J+g;F.high=w+k+(J>>>0>>0?1:0);K=e.low=K+x;e.high=X+z+(K>>>0>>0?1:0);L=n.low=L+y;n.high=Y+A+(L>>>0>>0?1:0);M=r.low=M+B;r.high=Z+U+(M>>>0>>0?1:0);N=G.low=N+h;G.high=$+l+(N>>>0>>0?1:0);O=H.low=O+C;H.high=aa+R+(O>>>0>>0?1:0);P=I.low=P+D; -I.high=ba+S+(P>>>0>>0?1:0);Q=f.low=Q+E;f.high=ca+V+(Q>>>0>>0?1:0)},_doFinalize:function(){var a=this._data,d=a.words,f=8*this._nDataBytes,e=8*a.sigBytes;d[e>>>5]|=128<<24-e%32;d[(e+128>>>10<<5)+30]=Math.floor(f/4294967296);d[(e+128>>>10<<5)+31]=f;a.sigBytes=4*d.length;this._process();return this._hash.toX32()},clone:function(){var a=r.clone.call(this);a._hash=this._hash.clone();return a},blockSize:32});n.SHA512=r._createHelper(e);n.HmacSHA512=r._createHmacHelper(e)})(); - -/* -CryptoJS v3.1.2 sha384-min.js -code.google.com/p/crypto-js -(c) 2009-2013 by Jeff Mott. All rights reserved. -code.google.com/p/crypto-js/wiki/License -*/ -(function(){var c=CryptoJS,a=c.x64,b=a.Word,e=a.WordArray,a=c.algo,d=a.SHA512,a=a.SHA384=d.extend({_doReset:function(){this._hash=new e.init([new b.init(3418070365,3238371032),new b.init(1654270250,914150663),new b.init(2438529370,812702999),new b.init(355462360,4144912697),new b.init(1731405415,4290775857),new b.init(2394180231,1750603025),new b.init(3675008525,1694076839),new b.init(1203062813,3204075428)])},_doFinalize:function(){var a=d._doFinalize.call(this);a.sigBytes-=16;return a}});c.SHA384= -d._createHelper(a);c.HmacSHA384=d._createHmacHelper(a)})(); - -/* -CryptoJS v3.1.2 ripemd160-min.js -code.google.com/p/crypto-js -(c) 2009-2013 by Jeff Mott. All rights reserved. -code.google.com/p/crypto-js/wiki/License -*/ -/* - -(c) 2012 by Cedric Mesnil. All rights reserved. - -Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - - - Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - - 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 THE COPYRIGHT HOLDERS AND CONTRIBUTORS "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 THE COPYRIGHT HOLDER 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. -*/ -(function(){var q=CryptoJS,d=q.lib,n=d.WordArray,p=d.Hasher,d=q.algo,x=n.create([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13]),y=n.create([5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11]),z=n.create([11,14,15,12, -5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6]),A=n.create([8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11]),B=n.create([0,1518500249,1859775393,2400959708,2840853838]),C=n.create([1352829926,1548603684,1836072691, -2053994217,0]),d=d.RIPEMD160=p.extend({_doReset:function(){this._hash=n.create([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(e,v){for(var b=0;16>b;b++){var c=v+b,f=e[c];e[c]=(f<<8|f>>>24)&16711935|(f<<24|f>>>8)&4278255360}var c=this._hash.words,f=B.words,d=C.words,n=x.words,q=y.words,p=z.words,w=A.words,t,g,h,j,r,u,k,l,m,s;u=t=c[0];k=g=c[1];l=h=c[2];m=j=c[3];s=r=c[4];for(var a,b=0;80>b;b+=1)a=t+e[v+n[b]]|0,a=16>b?a+((g^h^j)+f[0]):32>b?a+((g&h|~g&j)+f[1]):48>b? -a+(((g|~h)^j)+f[2]):64>b?a+((g&j|h&~j)+f[3]):a+((g^(h|~j))+f[4]),a|=0,a=a<>>32-p[b],a=a+r|0,t=r,r=j,j=h<<10|h>>>22,h=g,g=a,a=u+e[v+q[b]]|0,a=16>b?a+((k^(l|~m))+d[0]):32>b?a+((k&m|l&~m)+d[1]):48>b?a+(((k|~l)^m)+d[2]):64>b?a+((k&l|~k&m)+d[3]):a+((k^l^m)+d[4]),a|=0,a=a<>>32-w[b],a=a+s|0,u=s,s=m,m=l<<10|l>>>22,l=k,k=a;a=c[1]+h+m|0;c[1]=c[2]+j+s|0;c[2]=c[3]+r+u|0;c[3]=c[4]+t+k|0;c[4]=c[0]+g+l|0;c[0]=a},_doFinalize:function(){var e=this._data,d=e.words,b=8*this._nDataBytes,c=8*e.sigBytes; -d[c>>>5]|=128<<24-c%32;d[(c+64>>>9<<4)+14]=(b<<8|b>>>24)&16711935|(b<<24|b>>>8)&4278255360;e.sigBytes=4*(d.length+1);this._process();e=this._hash;d=e.words;for(b=0;5>b;b++)c=d[b],d[b]=(c<<8|c>>>24)&16711935|(c<<24|c>>>8)&4278255360;return e},clone:function(){var d=p.clone.call(this);d._hash=this._hash.clone();return d}});q.RIPEMD160=p._createHelper(d);q.HmacRIPEMD160=p._createHmacHelper(d)})(Math); - -/* -CryptoJS v3.1.2 hmac.js -code.google.com/p/crypto-js -(c) 2009-2013 by Jeff Mott. All rights reserved. -code.google.com/p/crypto-js/wiki/License -*/ -(function(){var c=CryptoJS,k=c.enc.Utf8;c.algo.HMAC=c.lib.Base.extend({init:function(a,b){a=this._hasher=new a.init;"string"==typeof b&&(b=k.parse(b));var c=a.blockSize,e=4*c;b.sigBytes>e&&(b=a.finalize(b));b.clamp();for(var f=this._oKey=b.clone(),g=this._iKey=b.clone(),h=f.words,j=g.words,d=0;d>6)+b64map.charAt(e&63)}if(b+1==d.length){e=parseInt(d.substring(b,b+1),16);a+=b64map.charAt(e<<2)}else{if(b+2==d.length){e=parseInt(d.substring(b,b+2),16);a+=b64map.charAt(e>>2)+b64map.charAt((e&3)<<4)}}if(b64pad){while((a.length&3)>0){a+=b64pad}}return a}function b64tohex(f){var d="";var e;var b=0;var c;var a;for(e=0;e>2);c=a&3;b=1}else{if(b==1){d+=int2char((c<<2)|(a>>4));c=a&15;b=2}else{if(b==2){d+=int2char(c);d+=int2char(a>>2);c=a&3;b=3}else{d+=int2char((c<<2)|(a>>4));d+=int2char(a&15);b=0}}}}if(b==1){d+=int2char(c<<2)}return d}function b64toBA(e){var d=b64tohex(e);var c;var b=new Array();for(c=0;2*c=0){var d=a*this[f++]+b[e]+h;h=Math.floor(d/67108864);b[e++]=d&67108863}return h}function am2(f,q,r,e,o,a){var k=q&32767,p=q>>15;while(--a>=0){var d=this[f]&32767;var g=this[f++]>>15;var b=p*d+g*k;d=k*d+((b&32767)<<15)+r[e]+(o&1073741823);o=(d>>>30)+(b>>>15)+p*g+(o>>>30);r[e++]=d&1073741823}return o}function am3(f,q,r,e,o,a){var k=q&16383,p=q>>14;while(--a>=0){var d=this[f]&16383;var g=this[f++]>>14;var b=p*d+g*k;d=k*d+((b&16383)<<14)+r[e]+o;o=(d>>28)+(b>>14)+p*g;r[e++]=d&268435455}return o}if(j_lm&&(navigator.appName=="Microsoft Internet Explorer")){BigInteger.prototype.am=am2;dbits=30}else{if(j_lm&&(navigator.appName!="Netscape")){BigInteger.prototype.am=am1;dbits=26}else{BigInteger.prototype.am=am3;dbits=28}}BigInteger.prototype.DB=dbits;BigInteger.prototype.DM=((1<=0;--a){b[a]=this[a]}b.t=this.t;b.s=this.s}function bnpFromInt(a){this.t=1;this.s=(a<0)?-1:0;if(a>0){this[0]=a}else{if(a<-1){this[0]=a+this.DV}else{this.t=0}}}function nbv(a){var b=nbi();b.fromInt(a);return b}function bnpFromString(h,c){var e;if(c==16){e=4}else{if(c==8){e=3}else{if(c==256){e=8}else{if(c==2){e=1}else{if(c==32){e=5}else{if(c==4){e=2}else{this.fromRadix(h,c);return}}}}}}this.t=0;this.s=0;var g=h.length,d=false,f=0;while(--g>=0){var a=(e==8)?h[g]&255:intAt(h,g);if(a<0){if(h.charAt(g)=="-"){d=true}continue}d=false;if(f==0){this[this.t++]=a}else{if(f+e>this.DB){this[this.t-1]|=(a&((1<<(this.DB-f))-1))<>(this.DB-f))}else{this[this.t-1]|=a<=this.DB){f-=this.DB}}if(e==8&&(h[0]&128)!=0){this.s=-1;if(f>0){this[this.t-1]|=((1<<(this.DB-f))-1)<0&&this[this.t-1]==a){--this.t}}function bnToString(c){if(this.s<0){return"-"+this.negate().toString(c)}var e;if(c==16){e=4}else{if(c==8){e=3}else{if(c==2){e=1}else{if(c==32){e=5}else{if(c==4){e=2}else{return this.toRadix(c)}}}}}var g=(1<0){if(j>j)>0){a=true;h=int2char(l)}while(f>=0){if(j>(j+=this.DB-e)}else{l=(this[f]>>(j-=e))&g;if(j<=0){j+=this.DB;--f}}if(l>0){a=true}if(a){h+=int2char(l)}}}return a?h:"0"}function bnNegate(){var a=nbi();BigInteger.ZERO.subTo(this,a);return a}function bnAbs(){return(this.s<0)?this.negate():this}function bnCompareTo(b){var d=this.s-b.s;if(d!=0){return d}var c=this.t;d=c-b.t;if(d!=0){return(this.s<0)?-d:d}while(--c>=0){if((d=this[c]-b[c])!=0){return d}}return 0}function nbits(a){var c=1,b;if((b=a>>>16)!=0){a=b;c+=16}if((b=a>>8)!=0){a=b;c+=8}if((b=a>>4)!=0){a=b;c+=4}if((b=a>>2)!=0){a=b;c+=2}if((b=a>>1)!=0){a=b;c+=1}return c}function bnBitLength(){if(this.t<=0){return 0}return this.DB*(this.t-1)+nbits(this[this.t-1]^(this.s&this.DM))}function bnpDLShiftTo(c,b){var a;for(a=this.t-1;a>=0;--a){b[a+c]=this[a]}for(a=c-1;a>=0;--a){b[a]=0}b.t=this.t+c;b.s=this.s}function bnpDRShiftTo(c,b){for(var a=c;a=0;--d){e[d+f+1]=(this[d]>>a)|h;h=(this[d]&g)<=0;--d){e[d]=0}e[f]=h;e.t=this.t+f+1;e.s=this.s;e.clamp()}function bnpRShiftTo(g,d){d.s=this.s;var e=Math.floor(g/this.DB);if(e>=this.t){d.t=0;return}var b=g%this.DB;var a=this.DB-b;var f=(1<>b;for(var c=e+1;c>b}if(b>0){d[this.t-e-1]|=(this.s&f)<>=this.DB}if(d.t>=this.DB}g+=this.s}else{g+=this.s;while(e>=this.DB}g-=d.s}f.s=(g<0)?-1:0;if(g<-1){f[e++]=this.DV+g}else{if(g>0){f[e++]=g}}f.t=e;f.clamp()}function bnpMultiplyTo(c,e){var b=this.abs(),f=c.abs();var d=b.t;e.t=d+f.t;while(--d>=0){e[d]=0}for(d=0;d=0){d[b]=0}for(b=0;b=a.DV){d[b+a.t]-=a.DV;d[b+a.t+1]=1}}if(d.t>0){d[d.t-1]+=a.am(b,a[b],d,2*b,0,1)}d.s=0;d.clamp()}function bnpDivRemTo(n,h,g){var w=n.abs();if(w.t<=0){return}var k=this.abs();if(k.t0){w.lShiftTo(v,d);k.lShiftTo(v,g)}else{w.copyTo(d);k.copyTo(g)}var p=d.t;var b=d[p-1];if(b==0){return}var o=b*(1<1)?d[p-2]>>this.F2:0);var A=this.FV/o,z=(1<=0){g[g.t++]=1;g.subTo(f,g)}BigInteger.ONE.dlShiftTo(p,f);f.subTo(d,d);while(d.t=0){var c=(g[--u]==b)?this.DM:Math.floor(g[u]*A+(g[u-1]+x)*z);if((g[u]+=d.am(0,c,g,s,0,p))0){g.rShiftTo(v,g)}if(a<0){BigInteger.ZERO.subTo(g,g)}}function bnMod(b){var c=nbi();this.abs().divRemTo(b,null,c);if(this.s<0&&c.compareTo(BigInteger.ZERO)>0){b.subTo(c,c)}return c}function Classic(a){this.m=a}function cConvert(a){if(a.s<0||a.compareTo(this.m)>=0){return a.mod(this.m)}else{return a}}function cRevert(a){return a}function cReduce(a){a.divRemTo(this.m,null,a)}function cMulTo(a,c,b){a.multiplyTo(c,b);this.reduce(b)}function cSqrTo(a,b){a.squareTo(b);this.reduce(b)}Classic.prototype.convert=cConvert;Classic.prototype.revert=cRevert;Classic.prototype.reduce=cReduce;Classic.prototype.mulTo=cMulTo;Classic.prototype.sqrTo=cSqrTo;function bnpInvDigit(){if(this.t<1){return 0}var a=this[0];if((a&1)==0){return 0}var b=a&3;b=(b*(2-(a&15)*b))&15;b=(b*(2-(a&255)*b))&255;b=(b*(2-(((a&65535)*b)&65535)))&65535;b=(b*(2-a*b%this.DV))%this.DV;return(b>0)?this.DV-b:-b}function Montgomery(a){this.m=a;this.mp=a.invDigit();this.mpl=this.mp&32767;this.mph=this.mp>>15;this.um=(1<<(a.DB-15))-1;this.mt2=2*a.t}function montConvert(a){var b=nbi();a.abs().dlShiftTo(this.m.t,b);b.divRemTo(this.m,null,b);if(a.s<0&&b.compareTo(BigInteger.ZERO)>0){this.m.subTo(b,b)}return b}function montRevert(a){var b=nbi();a.copyTo(b);this.reduce(b);return b}function montReduce(a){while(a.t<=this.mt2){a[a.t++]=0}for(var c=0;c>15)*this.mpl)&this.um)<<15))&a.DM;b=c+this.m.t;a[b]+=this.m.am(0,d,a,c,0,this.m.t);while(a[b]>=a.DV){a[b]-=a.DV;a[++b]++}}a.clamp();a.drShiftTo(this.m.t,a);if(a.compareTo(this.m)>=0){a.subTo(this.m,a)}}function montSqrTo(a,b){a.squareTo(b);this.reduce(b)}function montMulTo(a,c,b){a.multiplyTo(c,b);this.reduce(b)}Montgomery.prototype.convert=montConvert;Montgomery.prototype.revert=montRevert;Montgomery.prototype.reduce=montReduce;Montgomery.prototype.mulTo=montMulTo;Montgomery.prototype.sqrTo=montSqrTo;function bnpIsEven(){return((this.t>0)?(this[0]&1):this.s)==0}function bnpExp(h,j){if(h>4294967295||h<1){return BigInteger.ONE}var f=nbi(),a=nbi(),d=j.convert(this),c=nbits(h)-1;d.copyTo(f);while(--c>=0){j.sqrTo(f,a);if((h&(1<0){j.mulTo(a,d,f)}else{var b=f;f=a;a=b}}return j.revert(f)}function bnModPowInt(b,a){var c;if(b<256||a.isEven()){c=new Classic(a)}else{c=new Montgomery(a)}return this.exp(b,c)}BigInteger.prototype.copyTo=bnpCopyTo;BigInteger.prototype.fromInt=bnpFromInt;BigInteger.prototype.fromString=bnpFromString;BigInteger.prototype.clamp=bnpClamp;BigInteger.prototype.dlShiftTo=bnpDLShiftTo;BigInteger.prototype.drShiftTo=bnpDRShiftTo;BigInteger.prototype.lShiftTo=bnpLShiftTo;BigInteger.prototype.rShiftTo=bnpRShiftTo;BigInteger.prototype.subTo=bnpSubTo;BigInteger.prototype.multiplyTo=bnpMultiplyTo;BigInteger.prototype.squareTo=bnpSquareTo;BigInteger.prototype.divRemTo=bnpDivRemTo;BigInteger.prototype.invDigit=bnpInvDigit;BigInteger.prototype.isEven=bnpIsEven;BigInteger.prototype.exp=bnpExp;BigInteger.prototype.toString=bnToString;BigInteger.prototype.negate=bnNegate;BigInteger.prototype.abs=bnAbs;BigInteger.prototype.compareTo=bnCompareTo;BigInteger.prototype.bitLength=bnBitLength;BigInteger.prototype.mod=bnMod;BigInteger.prototype.modPowInt=bnModPowInt;BigInteger.ZERO=nbv(0);BigInteger.ONE=nbv(1); -/*! (c) Tom Wu | http://www-cs-students.stanford.edu/~tjw/jsbn/ - */ -function bnClone(){var a=nbi();this.copyTo(a);return a}function bnIntValue(){if(this.s<0){if(this.t==1){return this[0]-this.DV}else{if(this.t==0){return -1}}}else{if(this.t==1){return this[0]}else{if(this.t==0){return 0}}}return((this[1]&((1<<(32-this.DB))-1))<>24}function bnShortValue(){return(this.t==0)?this.s:(this[0]<<16)>>16}function bnpChunkSize(a){return Math.floor(Math.LN2*this.DB/Math.log(a))}function bnSigNum(){if(this.s<0){return -1}else{if(this.t<=0||(this.t==1&&this[0]<=0)){return 0}else{return 1}}}function bnpToRadix(c){if(c==null){c=10}if(this.signum()==0||c<2||c>36){return"0"}var f=this.chunkSize(c);var e=Math.pow(c,f);var i=nbv(e),j=nbi(),h=nbi(),g="";this.divRemTo(i,j,h);while(j.signum()>0){g=(e+h.intValue()).toString(c).substr(1)+g;j.divRemTo(i,j,h)}return h.intValue().toString(c)+g}function bnpFromRadix(m,h){this.fromInt(0);if(h==null){h=10}var f=this.chunkSize(h);var g=Math.pow(h,f),e=false,a=0,l=0;for(var c=0;c=f){this.dMultiply(g);this.dAddOffset(l,0);a=0;l=0}}if(a>0){this.dMultiply(Math.pow(h,a));this.dAddOffset(l,0)}if(e){BigInteger.ZERO.subTo(this,this)}}function bnpFromNumber(f,e,h){if("number"==typeof e){if(f<2){this.fromInt(1)}else{this.fromNumber(f,h);if(!this.testBit(f-1)){this.bitwiseTo(BigInteger.ONE.shiftLeft(f-1),op_or,this)}if(this.isEven()){this.dAddOffset(1,0)}while(!this.isProbablePrime(e)){this.dAddOffset(2,0);if(this.bitLength()>f){this.subTo(BigInteger.ONE.shiftLeft(f-1),this)}}}}else{var d=new Array(),g=f&7;d.length=(f>>3)+1;e.nextBytes(d);if(g>0){d[0]&=((1<0){if(e>e)!=(this.s&this.DM)>>e){c[a++]=f|(this.s<<(this.DB-e))}while(b>=0){if(e<8){f=(this[b]&((1<>(e+=this.DB-8)}else{f=(this[b]>>(e-=8))&255;if(e<=0){e+=this.DB;--b}}if((f&128)!=0){f|=-256}if(a==0&&(this.s&128)!=(f&128)){++a}if(a>0||f!=this.s){c[a++]=f}}}return c}function bnEquals(b){return(this.compareTo(b)==0)}function bnMin(b){return(this.compareTo(b)<0)?this:b}function bnMax(b){return(this.compareTo(b)>0)?this:b}function bnpBitwiseTo(c,h,e){var d,g,b=Math.min(c.t,this.t);for(d=0;d>=16;b+=16}if((a&255)==0){a>>=8;b+=8}if((a&15)==0){a>>=4;b+=4}if((a&3)==0){a>>=2;b+=2}if((a&1)==0){++b}return b}function bnGetLowestSetBit(){for(var a=0;a=this.t){return(this.s!=0)}return((this[a]&(1<<(b%this.DB)))!=0)}function bnpChangeBit(c,b){var a=BigInteger.ONE.shiftLeft(c);this.bitwiseTo(a,b,a);return a}function bnSetBit(a){return this.changeBit(a,op_or)}function bnClearBit(a){return this.changeBit(a,op_andnot)}function bnFlipBit(a){return this.changeBit(a,op_xor)}function bnpAddTo(d,f){var e=0,g=0,b=Math.min(d.t,this.t);while(e>=this.DB}if(d.t>=this.DB}g+=this.s}else{g+=this.s;while(e>=this.DB}g+=d.s}f.s=(g<0)?-1:0;if(g>0){f[e++]=g}else{if(g<-1){f[e++]=this.DV+g}}f.t=e;f.clamp()}function bnAdd(b){var c=nbi();this.addTo(b,c);return c}function bnSubtract(b){var c=nbi();this.subTo(b,c);return c}function bnMultiply(b){var c=nbi();this.multiplyTo(b,c);return c}function bnSquare(){var a=nbi();this.squareTo(a);return a}function bnDivide(b){var c=nbi();this.divRemTo(b,c,null);return c}function bnRemainder(b){var c=nbi();this.divRemTo(b,null,c);return c}function bnDivideAndRemainder(b){var d=nbi(),c=nbi();this.divRemTo(b,d,c);return new Array(d,c)}function bnpDMultiply(a){this[this.t]=this.am(0,a-1,this,0,0,this.t);++this.t;this.clamp()}function bnpDAddOffset(b,a){if(b==0){return}while(this.t<=a){this[this.t++]=0}this[a]+=b;while(this[a]>=this.DV){this[a]-=this.DV;if(++a>=this.t){this[this.t++]=0}++this[a]}}function NullExp(){}function nNop(a){return a}function nMulTo(a,c,b){a.multiplyTo(c,b)}function nSqrTo(a,b){a.squareTo(b)}NullExp.prototype.convert=nNop;NullExp.prototype.revert=nNop;NullExp.prototype.mulTo=nMulTo;NullExp.prototype.sqrTo=nSqrTo;function bnPow(a){return this.exp(a,new NullExp())}function bnpMultiplyLowerTo(b,f,e){var d=Math.min(this.t+b.t,f);e.s=0;e.t=d;while(d>0){e[--d]=0}var c;for(c=e.t-this.t;d=0){d[c]=0}for(c=Math.max(e-this.t,0);c2*this.m.t){return a.mod(this.m)}else{if(a.compareTo(this.m)<0){return a}else{var b=nbi();a.copyTo(b);this.reduce(b);return b}}}function barrettRevert(a){return a}function barrettReduce(a){a.drShiftTo(this.m.t-1,this.r2);if(a.t>this.m.t+1){a.t=this.m.t+1;a.clamp()}this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3);this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);while(a.compareTo(this.r2)<0){a.dAddOffset(1,this.m.t+1)}a.subTo(this.r2,a);while(a.compareTo(this.m)>=0){a.subTo(this.m,a)}}function barrettSqrTo(a,b){a.squareTo(b);this.reduce(b)}function barrettMulTo(a,c,b){a.multiplyTo(c,b);this.reduce(b)}Barrett.prototype.convert=barrettConvert;Barrett.prototype.revert=barrettRevert;Barrett.prototype.reduce=barrettReduce;Barrett.prototype.mulTo=barrettMulTo;Barrett.prototype.sqrTo=barrettSqrTo;function bnModPow(q,f){var o=q.bitLength(),h,b=nbv(1),v;if(o<=0){return b}else{if(o<18){h=1}else{if(o<48){h=3}else{if(o<144){h=4}else{if(o<768){h=5}else{h=6}}}}}if(o<8){v=new Classic(f)}else{if(f.isEven()){v=new Barrett(f)}else{v=new Montgomery(f)}}var p=new Array(),d=3,s=h-1,a=(1<1){var A=nbi();v.sqrTo(p[1],A);while(d<=a){p[d]=nbi();v.mulTo(A,p[d-2],p[d]);d+=2}}var l=q.t-1,x,u=true,c=nbi(),y;o=nbits(q[l])-1;while(l>=0){if(o>=s){x=(q[l]>>(o-s))&a}else{x=(q[l]&((1<<(o+1))-1))<<(s-o);if(l>0){x|=q[l-1]>>(this.DB+o-s)}}d=h;while((x&1)==0){x>>=1;--d}if((o-=d)<0){o+=this.DB;--l}if(u){p[x].copyTo(b);u=false}else{while(d>1){v.sqrTo(b,c);v.sqrTo(c,b);d-=2}if(d>0){v.sqrTo(b,c)}else{y=b;b=c;c=y}v.mulTo(c,p[x],b)}while(l>=0&&(q[l]&(1<0){b.rShiftTo(f,b);h.rShiftTo(f,h)}while(b.signum()>0){if((d=b.getLowestSetBit())>0){b.rShiftTo(d,b)}if((d=h.getLowestSetBit())>0){h.rShiftTo(d,h)}if(b.compareTo(h)>=0){b.subTo(h,b);b.rShiftTo(1,b)}else{h.subTo(b,h);h.rShiftTo(1,h)}}if(f>0){h.lShiftTo(f,h)}return h}function bnpModInt(e){if(e<=0){return 0}var c=this.DV%e,b=(this.s<0)?e-1:0;if(this.t>0){if(c==0){b=this[0]%e}else{for(var a=this.t-1;a>=0;--a){b=(c*b+this[a])%e}}}return b}function bnModInverse(f){var j=f.isEven();if((this.isEven()&&j)||f.signum()==0){return BigInteger.ZERO}var i=f.clone(),h=this.clone();var g=nbv(1),e=nbv(0),l=nbv(0),k=nbv(1);while(i.signum()!=0){while(i.isEven()){i.rShiftTo(1,i);if(j){if(!g.isEven()||!e.isEven()){g.addTo(this,g);e.subTo(f,e)}g.rShiftTo(1,g)}else{if(!e.isEven()){e.subTo(f,e)}}e.rShiftTo(1,e)}while(h.isEven()){h.rShiftTo(1,h);if(j){if(!l.isEven()||!k.isEven()){l.addTo(this,l);k.subTo(f,k)}l.rShiftTo(1,l)}else{if(!k.isEven()){k.subTo(f,k)}}k.rShiftTo(1,k)}if(i.compareTo(h)>=0){i.subTo(h,i);if(j){g.subTo(l,g)}e.subTo(k,e)}else{h.subTo(i,h);if(j){l.subTo(g,l)}k.subTo(e,k)}}if(h.compareTo(BigInteger.ONE)!=0){return BigInteger.ZERO}if(k.compareTo(f)>=0){return k.subtract(f)}if(k.signum()<0){k.addTo(f,k)}else{return k}if(k.signum()<0){return k.add(f)}else{return k}}var lowprimes=[2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509,521,523,541,547,557,563,569,571,577,587,593,599,601,607,613,617,619,631,641,643,647,653,659,661,673,677,683,691,701,709,719,727,733,739,743,751,757,761,769,773,787,797,809,811,821,823,827,829,839,853,857,859,863,877,881,883,887,907,911,919,929,937,941,947,953,967,971,977,983,991,997];var lplim=(1<<26)/lowprimes[lowprimes.length-1];function bnIsProbablePrime(e){var d,b=this.abs();if(b.t==1&&b[0]<=lowprimes[lowprimes.length-1]){for(d=0;d>1;if(f>lowprimes.length){f=lowprimes.length}var b=nbi();for(var e=0;e>8)&255;rng_pool[rng_pptr++]^=(a>>16)&255;rng_pool[rng_pptr++]^=(a>>24)&255;if(rng_pptr>=rng_psize){rng_pptr-=rng_psize}}function rng_seed_time(){rng_seed_int(new Date().getTime())}if(rng_pool==null){rng_pool=new Array();rng_pptr=0;var t;if(window!==undefined&&(window.crypto!==undefined||window.msCrypto!==undefined)){var crypto=window.crypto||window.msCrypto;if(crypto.getRandomValues){var ua=new Uint8Array(32);crypto.getRandomValues(ua);for(t=0;t<32;++t){rng_pool[rng_pptr++]=ua[t]}}else{if(navigator.appName=="Netscape"&&navigator.appVersion<"5"){var z=window.crypto.random(32);for(t=0;t>>8;rng_pool[rng_pptr++]=t&255}rng_pptr=0;rng_seed_time()}function rng_get_byte(){if(rng_state==null){rng_seed_time();rng_state=prng_newstate();rng_state.init(rng_pool);for(rng_pptr=0;rng_pptr=0&&h>0){var f=e.charCodeAt(d--);if(f<128){g[--h]=f}else{if((f>127)&&(f<2048)){g[--h]=(f&63)|128;g[--h]=(f>>6)|192}else{g[--h]=(f&63)|128;g[--h]=((f>>6)&63)|128;g[--h]=(f>>12)|224}}}g[--h]=0;var b=new SecureRandom();var a=new Array();while(h>2){a[0]=0;while(a[0]==0){b.nextBytes(a)}g[--h]=a[0]}g[--h]=2;g[--h]=0;return new BigInteger(g)}function oaep_mgf1_arr(c,a,e){var b="",d=0;while(b.length>24,(d&16711680)>>16,(d&65280)>>8,d&255])));d+=1}return b}function oaep_pad(q,a,f,l){var c=KJUR.crypto.MessageDigest;var o=KJUR.crypto.Util;var b=null;if(!f){f="sha1"}if(typeof f==="string"){b=c.getCanonicalAlgName(f);l=c.getHashLength(b);f=function(i){return hextorstr(o.hashString(i,b))}}if(q.length+2*l+2>a){throw"Message too long for RSA"}var k="",e;for(e=0;e0&&a.length>0){this.n=parseBigInt(b,16);this.e=parseInt(a,16)}else{throw"Invalid RSA public key"}}}function RSADoPublic(a){return a.modPowInt(this.e,this.n)}function RSAEncrypt(d){var a=pkcs1pad2(d,(this.n.bitLength()+7)>>3);if(a==null){return null}var e=this.doPublic(a);if(e==null){return null}var b=e.toString(16);if((b.length&1)==0){return b}else{return"0"+b}}function RSAEncryptOAEP(f,e,b){var a=oaep_pad(f,(this.n.bitLength()+7)>>3,e,b);if(a==null){return null}var g=this.doPublic(a);if(g==null){return null}var d=g.toString(16);if((d.length&1)==0){return d}else{return"0"+d}}RSAKey.prototype.doPublic=RSADoPublic;RSAKey.prototype.setPublic=RSASetPublic;RSAKey.prototype.encrypt=RSAEncrypt;RSAKey.prototype.encryptOAEP=RSAEncryptOAEP;RSAKey.prototype.type="RSA"; -/*! (c) Tom Wu | http://www-cs-students.stanford.edu/~tjw/jsbn/ - */ -function pkcs1unpad2(g,j){var a=g.toByteArray();var f=0;while(f=a.length){return null}}var e="";while(++f191)&&(h<224)){e+=String.fromCharCode(((h&31)<<6)|(a[f+1]&63));++f}else{e+=String.fromCharCode(((h&15)<<12)|((a[f+1]&63)<<6)|(a[f+2]&63));f+=2}}}return e}function oaep_mgf1_str(c,a,e){var b="",d=0;while(b.length>24,(d&16711680)>>16,(d&65280)>>8,d&255]));d+=1}return b}function oaep_unpad(o,b,g,p){var e=KJUR.crypto.MessageDigest;var r=KJUR.crypto.Util;var c=null;if(!g){g="sha1"}if(typeof g==="string"){c=e.getCanonicalAlgName(g);p=e.getHashLength(c);g=function(d){return hextorstr(r.hashString(d,c))}}o=o.toByteArray();var h;for(h=0;h0&&a.length>0){this.n=parseBigInt(c,16);this.e=parseInt(a,16);this.d=parseBigInt(b,16)}else{alert("Invalid RSA private key")}}}function RSASetPrivateEx(g,d,e,c,b,a,h,f){this.isPrivate=true;this.isPublic=false;if(g==null){throw"RSASetPrivateEx N == null"}if(d==null){throw"RSASetPrivateEx E == null"}if(g.length==0){throw"RSASetPrivateEx N.length == 0"}if(d.length==0){throw"RSASetPrivateEx E.length == 0"}if(g!=null&&d!=null&&g.length>0&&d.length>0){this.n=parseBigInt(g,16);this.e=parseInt(d,16);this.d=parseBigInt(e,16);this.p=parseBigInt(c,16);this.q=parseBigInt(b,16);this.dmp1=parseBigInt(a,16);this.dmq1=parseBigInt(h,16);this.coeff=parseBigInt(f,16)}else{alert("Invalid RSA private key in RSASetPrivateEx")}}function RSAGenerate(b,i){var a=new SecureRandom();var f=b>>1;this.e=parseInt(i,16);var c=new BigInteger(i,16);for(;;){for(;;){this.p=new BigInteger(b-f,1,a);if(this.p.subtract(BigInteger.ONE).gcd(c).compareTo(BigInteger.ONE)==0&&this.p.isProbablePrime(10)){break}}for(;;){this.q=new BigInteger(f,1,a);if(this.q.subtract(BigInteger.ONE).gcd(c).compareTo(BigInteger.ONE)==0&&this.q.isProbablePrime(10)){break}}if(this.p.compareTo(this.q)<=0){var h=this.p;this.p=this.q;this.q=h}var g=this.p.subtract(BigInteger.ONE);var d=this.q.subtract(BigInteger.ONE);var e=g.multiply(d);if(e.gcd(c).compareTo(BigInteger.ONE)==0){this.n=this.p.multiply(this.q);this.d=c.modInverse(e);this.dmp1=this.d.mod(g);this.dmq1=this.d.mod(d);this.coeff=this.q.modInverse(this.p);break}}this.isPrivate=true}function RSADoPrivate(a){if(this.p==null||this.q==null){return a.modPow(this.d,this.n)}var c=a.mod(this.p).modPow(this.dmp1,this.p);var b=a.mod(this.q).modPow(this.dmq1,this.q);while(c.compareTo(b)<0){c=c.add(this.p)}return c.subtract(b).multiply(this.coeff).mod(this.p).multiply(this.q).add(b)}function RSADecrypt(b){var d=parseBigInt(b,16);var a=this.doPrivate(d);if(a==null){return null}return pkcs1unpad2(a,(this.n.bitLength()+7)>>3)}function RSADecryptOAEP(e,d,b){var f=parseBigInt(e,16);var a=this.doPrivate(f);if(a==null){return null}return oaep_unpad(a,(this.n.bitLength()+7)>>3,d,b)}RSAKey.prototype.doPrivate=RSADoPrivate;RSAKey.prototype.setPrivate=RSASetPrivate;RSAKey.prototype.setPrivateEx=RSASetPrivateEx;RSAKey.prototype.generate=RSAGenerate;RSAKey.prototype.decrypt=RSADecrypt;RSAKey.prototype.decryptOAEP=RSADecryptOAEP; -/*! (c) Tom Wu | http://www-cs-students.stanford.edu/~tjw/jsbn/ - */ -function ECFieldElementFp(b,a){this.x=a;this.q=b}function feFpEquals(a){if(a==this){return true}return(this.q.equals(a.q)&&this.x.equals(a.x))}function feFpToBigInteger(){return this.x}function feFpNegate(){return new ECFieldElementFp(this.q,this.x.negate().mod(this.q))}function feFpAdd(a){return new ECFieldElementFp(this.q,this.x.add(a.toBigInteger()).mod(this.q))}function feFpSubtract(a){return new ECFieldElementFp(this.q,this.x.subtract(a.toBigInteger()).mod(this.q))}function feFpMultiply(a){return new ECFieldElementFp(this.q,this.x.multiply(a.toBigInteger()).mod(this.q))}function feFpSquare(){return new ECFieldElementFp(this.q,this.x.square().mod(this.q))}function feFpDivide(a){return new ECFieldElementFp(this.q,this.x.multiply(a.toBigInteger().modInverse(this.q)).mod(this.q))}ECFieldElementFp.prototype.equals=feFpEquals;ECFieldElementFp.prototype.toBigInteger=feFpToBigInteger;ECFieldElementFp.prototype.negate=feFpNegate;ECFieldElementFp.prototype.add=feFpAdd;ECFieldElementFp.prototype.subtract=feFpSubtract;ECFieldElementFp.prototype.multiply=feFpMultiply;ECFieldElementFp.prototype.square=feFpSquare;ECFieldElementFp.prototype.divide=feFpDivide;function ECPointFp(c,a,d,b){this.curve=c;this.x=a;this.y=d;if(b==null){this.z=BigInteger.ONE}else{this.z=b}this.zinv=null}function pointFpGetX(){if(this.zinv==null){this.zinv=this.z.modInverse(this.curve.q)}return this.curve.fromBigInteger(this.x.toBigInteger().multiply(this.zinv).mod(this.curve.q))}function pointFpGetY(){if(this.zinv==null){this.zinv=this.z.modInverse(this.curve.q)}return this.curve.fromBigInteger(this.y.toBigInteger().multiply(this.zinv).mod(this.curve.q))}function pointFpEquals(a){if(a==this){return true}if(this.isInfinity()){return a.isInfinity()}if(a.isInfinity()){return this.isInfinity()}var c,b;c=a.y.toBigInteger().multiply(this.z).subtract(this.y.toBigInteger().multiply(a.z)).mod(this.curve.q);if(!c.equals(BigInteger.ZERO)){return false}b=a.x.toBigInteger().multiply(this.z).subtract(this.x.toBigInteger().multiply(a.z)).mod(this.curve.q);return b.equals(BigInteger.ZERO)}function pointFpIsInfinity(){if((this.x==null)&&(this.y==null)){return true}return this.z.equals(BigInteger.ZERO)&&!this.y.toBigInteger().equals(BigInteger.ZERO)}function pointFpNegate(){return new ECPointFp(this.curve,this.x,this.y.negate(),this.z)}function pointFpAdd(l){if(this.isInfinity()){return l}if(l.isInfinity()){return this}var p=l.y.toBigInteger().multiply(this.z).subtract(this.y.toBigInteger().multiply(l.z)).mod(this.curve.q);var o=l.x.toBigInteger().multiply(this.z).subtract(this.x.toBigInteger().multiply(l.z)).mod(this.curve.q);if(BigInteger.ZERO.equals(o)){if(BigInteger.ZERO.equals(p)){return this.twice()}return this.curve.getInfinity()}var j=new BigInteger("3");var e=this.x.toBigInteger();var n=this.y.toBigInteger();var c=l.x.toBigInteger();var k=l.y.toBigInteger();var m=o.square();var i=m.multiply(o);var d=e.multiply(m);var g=p.square().multiply(this.z);var a=g.subtract(d.shiftLeft(1)).multiply(l.z).subtract(i).multiply(o).mod(this.curve.q);var h=d.multiply(j).multiply(p).subtract(n.multiply(i)).subtract(g.multiply(p)).multiply(l.z).add(p.multiply(i)).mod(this.curve.q);var f=i.multiply(this.z).multiply(l.z).mod(this.curve.q);return new ECPointFp(this.curve,this.curve.fromBigInteger(a),this.curve.fromBigInteger(h),f)}function pointFpTwice(){if(this.isInfinity()){return this}if(this.y.toBigInteger().signum()==0){return this.curve.getInfinity()}var g=new BigInteger("3");var c=this.x.toBigInteger();var h=this.y.toBigInteger();var e=h.multiply(this.z);var j=e.multiply(h).mod(this.curve.q);var i=this.curve.a.toBigInteger();var k=c.square().multiply(g);if(!BigInteger.ZERO.equals(i)){k=k.add(this.z.square().multiply(i))}k=k.mod(this.curve.q);var b=k.square().subtract(c.shiftLeft(3).multiply(j)).shiftLeft(1).multiply(e).mod(this.curve.q);var f=k.multiply(g).multiply(c).subtract(j.shiftLeft(1)).shiftLeft(2).multiply(j).subtract(k.square().multiply(k)).mod(this.curve.q);var d=e.square().multiply(e).shiftLeft(3).mod(this.curve.q);return new ECPointFp(this.curve,this.curve.fromBigInteger(b),this.curve.fromBigInteger(f),d)}function pointFpMultiply(b){if(this.isInfinity()){return this}if(b.signum()==0){return this.curve.getInfinity()}var g=b;var f=g.multiply(new BigInteger("3"));var l=this.negate();var d=this;var c;for(c=f.bitLength()-2;c>0;--c){d=d.twice();var a=f.testBit(c);var j=g.testBit(c);if(a!=j){d=d.add(a?this:l)}}return d}function pointFpMultiplyTwo(c,a,b){var d;if(c.bitLength()>b.bitLength()){d=c.bitLength()-1}else{d=b.bitLength()-1}var f=this.curve.getInfinity();var e=this.add(a);while(d>=0){f=f.twice();if(c.testBit(d)){if(b.testBit(d)){f=f.add(e)}else{f=f.add(this)}}else{if(b.testBit(d)){f=f.add(a)}}--d}return f}ECPointFp.prototype.getX=pointFpGetX;ECPointFp.prototype.getY=pointFpGetY;ECPointFp.prototype.equals=pointFpEquals;ECPointFp.prototype.isInfinity=pointFpIsInfinity;ECPointFp.prototype.negate=pointFpNegate;ECPointFp.prototype.add=pointFpAdd;ECPointFp.prototype.twice=pointFpTwice;ECPointFp.prototype.multiply=pointFpMultiply;ECPointFp.prototype.multiplyTwo=pointFpMultiplyTwo;function ECCurveFp(e,d,c){this.q=e;this.a=this.fromBigInteger(d);this.b=this.fromBigInteger(c);this.infinity=new ECPointFp(this,null,null)}function curveFpGetQ(){return this.q}function curveFpGetA(){return this.a}function curveFpGetB(){return this.b}function curveFpEquals(a){if(a==this){return true}return(this.q.equals(a.q)&&this.a.equals(a.a)&&this.b.equals(a.b))}function curveFpGetInfinity(){return this.infinity}function curveFpFromBigInteger(a){return new ECFieldElementFp(this.q,a)}function curveFpDecodePointHex(d){switch(parseInt(d.substr(0,2),16)){case 0:return this.infinity;case 2:case 3:return null;case 4:case 6:case 7:var a=(d.length-2)/2;var c=d.substr(2,a);var b=d.substr(a+2,a);return new ECPointFp(this,this.fromBigInteger(new BigInteger(c,16)),this.fromBigInteger(new BigInteger(b,16)));default:return null}}ECCurveFp.prototype.getQ=curveFpGetQ;ECCurveFp.prototype.getA=curveFpGetA;ECCurveFp.prototype.getB=curveFpGetB;ECCurveFp.prototype.equals=curveFpEquals;ECCurveFp.prototype.getInfinity=curveFpGetInfinity;ECCurveFp.prototype.fromBigInteger=curveFpFromBigInteger;ECCurveFp.prototype.decodePointHex=curveFpDecodePointHex; -/*! (c) Stefan Thomas | https://github.com/bitcoinjs/bitcoinjs-lib - */ -ECFieldElementFp.prototype.getByteLength=function(){return Math.floor((this.toBigInteger().bitLength()+7)/8)};ECPointFp.prototype.getEncoded=function(c){var d=function(h,f){var g=h.toByteArrayUnsigned();if(fg.length){g.unshift(0)}}return g};var a=this.getX().toBigInteger();var e=this.getY().toBigInteger();var b=d(a,32);if(c){if(e.isEven()){b.unshift(2)}else{b.unshift(3)}}else{b.unshift(4);b=b.concat(d(e,32))}return b};ECPointFp.decodeFrom=function(g,c){var f=c[0];var e=c.length-1;var d=c.slice(1,1+e/2);var b=c.slice(1+e/2,1+e);d.unshift(0);b.unshift(0);var a=new BigInteger(d);var h=new BigInteger(b);return new ECPointFp(g,g.fromBigInteger(a),g.fromBigInteger(h))};ECPointFp.decodeFromHex=function(g,c){var f=c.substr(0,2);var e=c.length-2;var d=c.substr(2,e/2);var b=c.substr(2+e/2,e/2);var a=new BigInteger(d,16);var h=new BigInteger(b,16);return new ECPointFp(g,g.fromBigInteger(a),g.fromBigInteger(h))};ECPointFp.prototype.add2D=function(c){if(this.isInfinity()){return c}if(c.isInfinity()){return this}if(this.x.equals(c.x)){if(this.y.equals(c.y)){return this.twice()}return this.curve.getInfinity()}var g=c.x.subtract(this.x);var e=c.y.subtract(this.y);var a=e.divide(g);var d=a.square().subtract(this.x).subtract(c.x);var f=a.multiply(this.x.subtract(d)).subtract(this.y);return new ECPointFp(this.curve,d,f)};ECPointFp.prototype.twice2D=function(){if(this.isInfinity()){return this}if(this.y.toBigInteger().signum()==0){return this.curve.getInfinity()}var b=this.curve.fromBigInteger(BigInteger.valueOf(2));var e=this.curve.fromBigInteger(BigInteger.valueOf(3));var a=this.x.square().multiply(e).add(this.curve.a).divide(this.y.multiply(b));var c=a.square().subtract(this.x.multiply(b));var d=a.multiply(this.x.subtract(c)).subtract(this.y);return new ECPointFp(this.curve,c,d)};ECPointFp.prototype.multiply2D=function(b){if(this.isInfinity()){return this}if(b.signum()==0){return this.curve.getInfinity()}var g=b;var f=g.multiply(new BigInteger("3"));var l=this.negate();var d=this;var c;for(c=f.bitLength()-2;c>0;--c){d=d.twice();var a=f.testBit(c);var j=g.testBit(c);if(a!=j){d=d.add2D(a?this:l)}}return d};ECPointFp.prototype.isOnCurve=function(){var d=this.getX().toBigInteger();var i=this.getY().toBigInteger();var f=this.curve.getA().toBigInteger();var c=this.curve.getB().toBigInteger();var h=this.curve.getQ();var e=i.multiply(i).mod(h);var g=d.multiply(d).multiply(d).add(f.multiply(d)).add(c).mod(h);return e.equals(g)};ECPointFp.prototype.toString=function(){return"("+this.getX().toBigInteger().toString()+","+this.getY().toBigInteger().toString()+")"};ECPointFp.prototype.validate=function(){var c=this.curve.getQ();if(this.isInfinity()){throw new Error("Point is at infinity.")}var a=this.getX().toBigInteger();var b=this.getY().toBigInteger();if(a.compareTo(BigInteger.ONE)<0||a.compareTo(c.subtract(BigInteger.ONE))>0){throw new Error("x coordinate out of bounds")}if(b.compareTo(BigInteger.ONE)<0||b.compareTo(c.subtract(BigInteger.ONE))>0){throw new Error("y coordinate out of bounds")}if(!this.isOnCurve()){throw new Error("Point is not on the curve.")}if(this.multiply(c).isInfinity()){throw new Error("Point is not a scalar multiple of G.")}return true}; -/*! Mike Samuel (c) 2009 | code.google.com/p/json-sans-eval - */ -var jsonParse=(function(){var e="(?:-?\\b(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?(?:[eE][+-]?[0-9]+)?\\b)";var j='(?:[^\\0-\\x08\\x0a-\\x1f"\\\\]|\\\\(?:["/\\\\bfnrt]|u[0-9A-Fa-f]{4}))';var i='(?:"'+j+'*")';var d=new RegExp("(?:false|true|null|[\\{\\}\\[\\]]|"+e+"|"+i+")","g");var k=new RegExp("\\\\(?:([^u])|u(.{4}))","g");var g={'"':'"',"/":"/","\\":"\\",b:"\b",f:"\f",n:"\n",r:"\r",t:"\t"};function h(l,m,n){return m?g[m]:String.fromCharCode(parseInt(n,16))}var c=new String("");var a="\\";var f={"{":Object,"[":Array};var b=Object.hasOwnProperty;return function(u,q){var p=u.match(d);var x;var v=p[0];var l=false;if("{"===v){x={}}else{if("["===v){x=[]}else{x=[];l=true}}var t;var r=[x];for(var o=1-l,m=p.length;o=0;){delete D[n[A]]}}}return q.call(C,B,D)};x=s({"":x},"")}return x}})(); -if(typeof KJUR=="undefined"||!KJUR){KJUR={}}if(typeof KJUR.asn1=="undefined"||!KJUR.asn1){KJUR.asn1={}}KJUR.asn1.ASN1Util=new function(){this.integerToByteHex=function(a){var b=a.toString(16);if((b.length%2)==1){b="0"+b}return b};this.bigIntToMinTwosComplementsHex=function(j){var f=j.toString(16);if(f.substr(0,1)!="-"){if(f.length%2==1){f="0"+f}else{if(!f.match(/^[0-7]/)){f="00"+f}}}else{var a=f.substr(1);var e=a.length;if(e%2==1){e+=1}else{if(!f.match(/^[0-7]/)){e+=2}}var g="";for(var d=0;d15){throw"ASN.1 length too long to represent by 8x: n = "+i.toString(16)}var f=128+g;return f.toString(16)+h}};this.getEncodedHex=function(){if(this.hTLV==null||this.isModified){this.hV=this.getFreshValueHex();this.hL=this.getLengthHexFromValue();this.hTLV=this.hT+this.hL+this.hV;this.isModified=false}return this.hTLV};this.getValueHex=function(){this.getEncodedHex();return this.hV};this.getFreshValueHex=function(){return""}};KJUR.asn1.DERAbstractString=function(c){KJUR.asn1.DERAbstractString.superclass.constructor.call(this);var b=null;var a=null;this.getString=function(){return this.s};this.setString=function(d){this.hTLV=null;this.isModified=true;this.s=d;this.hV=stohex(this.s)};this.setStringHex=function(d){this.hTLV=null;this.isModified=true;this.s=null;this.hV=d};this.getFreshValueHex=function(){return this.hV};if(typeof c!="undefined"){if(typeof c=="string"){this.setString(c)}else{if(typeof c.str!="undefined"){this.setString(c.str)}else{if(typeof c.hex!="undefined"){this.setStringHex(c.hex)}}}}};YAHOO.lang.extend(KJUR.asn1.DERAbstractString,KJUR.asn1.ASN1Object);KJUR.asn1.DERAbstractTime=function(c){KJUR.asn1.DERAbstractTime.superclass.constructor.call(this);var b=null;var a=null;this.localDateToUTC=function(f){utc=f.getTime()+(f.getTimezoneOffset()*60000);var e=new Date(utc);return e};this.formatDate=function(m,o,e){var g=this.zeroPadding;var n=this.localDateToUTC(m);var p=String(n.getFullYear());if(o=="utc"){p=p.substr(2,2)}var l=g(String(n.getMonth()+1),2);var q=g(String(n.getDate()),2);var h=g(String(n.getHours()),2);var i=g(String(n.getMinutes()),2);var j=g(String(n.getSeconds()),2);var r=p+l+q+h+i+j;if(e===true){var f=n.getMilliseconds();if(f!=0){var k=g(String(f),3);k=k.replace(/[0]+$/,"");r=r+"."+k}}return r+"Z"};this.zeroPadding=function(e,d){if(e.length>=d){return e}return new Array(d-e.length+1).join("0")+e};this.getString=function(){return this.s};this.setString=function(d){this.hTLV=null;this.isModified=true;this.s=d;this.hV=stohex(d)};this.setByDateValue=function(h,j,e,d,f,g){var i=new Date(Date.UTC(h,j-1,e,d,f,g,0));this.setByDate(i)};this.getFreshValueHex=function(){return this.hV}};YAHOO.lang.extend(KJUR.asn1.DERAbstractTime,KJUR.asn1.ASN1Object);KJUR.asn1.DERAbstractStructured=function(b){KJUR.asn1.DERAbstractString.superclass.constructor.call(this);var a=null;this.setByASN1ObjectArray=function(c){this.hTLV=null;this.isModified=true;this.asn1Array=c};this.appendASN1Object=function(c){this.hTLV=null;this.isModified=true;this.asn1Array.push(c)};this.asn1Array=new Array();if(typeof b!="undefined"){if(typeof b.array!="undefined"){this.asn1Array=b.array}}};YAHOO.lang.extend(KJUR.asn1.DERAbstractStructured,KJUR.asn1.ASN1Object);KJUR.asn1.DERBoolean=function(){KJUR.asn1.DERBoolean.superclass.constructor.call(this);this.hT="01";this.hTLV="0101ff"};YAHOO.lang.extend(KJUR.asn1.DERBoolean,KJUR.asn1.ASN1Object);KJUR.asn1.DERInteger=function(a){KJUR.asn1.DERInteger.superclass.constructor.call(this);this.hT="02";this.setByBigInteger=function(b){this.hTLV=null;this.isModified=true;this.hV=KJUR.asn1.ASN1Util.bigIntToMinTwosComplementsHex(b)};this.setByInteger=function(c){var b=new BigInteger(String(c),10);this.setByBigInteger(b)};this.setValueHex=function(b){this.hV=b};this.getFreshValueHex=function(){return this.hV};if(typeof a!="undefined"){if(typeof a.bigint!="undefined"){this.setByBigInteger(a.bigint)}else{if(typeof a["int"]!="undefined"){this.setByInteger(a["int"])}else{if(typeof a=="number"){this.setByInteger(a)}else{if(typeof a.hex!="undefined"){this.setValueHex(a.hex)}}}}}};YAHOO.lang.extend(KJUR.asn1.DERInteger,KJUR.asn1.ASN1Object);KJUR.asn1.DERBitString=function(b){if(b!==undefined&&typeof b.obj!=="undefined"){var a=KJUR.asn1.ASN1Util.newObject(b.obj);b.hex="00"+a.getEncodedHex()}KJUR.asn1.DERBitString.superclass.constructor.call(this);this.hT="03";this.setHexValueIncludingUnusedBits=function(c){this.hTLV=null;this.isModified=true;this.hV=c};this.setUnusedBitsAndHexValue=function(c,e){if(c<0||7=(l*2))){break}if(d>=200){break}g.push(b);c=b;d++}return g};ASN1HEX.getNthChildIdx=function(d,b,e){var c=ASN1HEX.getChildIdx(d,b);return c[e]};ASN1HEX.getIdxbyList=function(e,d,c,i){var g=ASN1HEX;var f,b;if(c.length==0){if(i!==undefined){if(e.substr(d,2)!==i){throw"checking tag doesn't match: "+e.substr(d,2)+"!="+i}}return d}f=c.shift();b=g.getChildIdx(e,d);return g.getIdxbyList(e,b[f],c,i)};ASN1HEX.getTLVbyList=function(d,c,b,f){var e=ASN1HEX;var a=e.getIdxbyList(d,c,b);if(a===undefined){throw"can't find nthList object"}if(f!==undefined){if(d.substr(a,2)!=f){throw"checking tag doesn't match: "+d.substr(a,2)+"!="+f}}return e.getTLV(d,a)};ASN1HEX.getVbyList=function(e,c,b,g,i){var f=ASN1HEX;var a,d;a=f.getIdxbyList(e,c,b,g);if(a===undefined){throw"can't find nthList object"}d=f.getV(e,a);if(i===true){d=d.substr(2)}return d};ASN1HEX.hextooidstr=function(e){var h=function(b,a){if(b.length>=a){return b}return new Array(a-b.length+1).join("0")+b};var l=[];var o=e.substr(0,2);var f=parseInt(o,16);l[0]=new String(Math.floor(f/40));l[1]=new String(f%40);var m=e.substr(2);var k=[];for(var g=0;g0){n=n+"."+j.join(".")}return n};ASN1HEX.dump=function(t,c,l,g){var p=ASN1HEX;var j=p.getV;var y=p.dump;var w=p.getChildIdx;var e=t;if(t instanceof KJUR.asn1.ASN1Object){e=t.getEncodedHex()}var q=function(A,i){if(A.length<=i*2){return A}else{var v=A.substr(0,i)+"..(total "+A.length/2+"bytes).."+A.substr(A.length-i,i);return v}};if(c===undefined){c={ommit_long_octet:32}}if(l===undefined){l=0}if(g===undefined){g=""}var x=c.ommit_long_octet;if(e.substr(l,2)=="01"){var h=j(e,l);if(h=="00"){return g+"BOOLEAN FALSE\n"}else{return g+"BOOLEAN TRUE\n"}}if(e.substr(l,2)=="02"){var h=j(e,l);return g+"INTEGER "+q(h,x)+"\n"}if(e.substr(l,2)=="03"){var h=j(e,l);return g+"BITSTRING "+q(h,x)+"\n"}if(e.substr(l,2)=="04"){var h=j(e,l);if(p.isASN1HEX(h)){var k=g+"OCTETSTRING, encapsulates\n";k=k+y(h,c,0,g+" ");return k}else{return g+"OCTETSTRING "+q(h,x)+"\n"}}if(e.substr(l,2)=="05"){return g+"NULL\n"}if(e.substr(l,2)=="06"){var m=j(e,l);var a=KJUR.asn1.ASN1Util.oidHexToInt(m);var o=KJUR.asn1.x509.OID.oid2name(a);var b=a.replace(/\./g," ");if(o!=""){return g+"ObjectIdentifier "+o+" ("+b+")\n"}else{return g+"ObjectIdentifier ("+b+")\n"}}if(e.substr(l,2)=="0c"){return g+"UTF8String '"+hextoutf8(j(e,l))+"'\n"}if(e.substr(l,2)=="13"){return g+"PrintableString '"+hextoutf8(j(e,l))+"'\n"}if(e.substr(l,2)=="14"){return g+"TeletexString '"+hextoutf8(j(e,l))+"'\n"}if(e.substr(l,2)=="16"){return g+"IA5String '"+hextoutf8(j(e,l))+"'\n"}if(e.substr(l,2)=="17"){return g+"UTCTime "+hextoutf8(j(e,l))+"\n"}if(e.substr(l,2)=="18"){return g+"GeneralizedTime "+hextoutf8(j(e,l))+"\n"}if(e.substr(l,2)=="30"){if(e.substr(l,4)=="3000"){return g+"SEQUENCE {}\n"}var k=g+"SEQUENCE\n";var d=w(e,l);var f=c;if((d.length==2||d.length==3)&&e.substr(d[0],2)=="06"&&e.substr(d[d.length-1],2)=="04"){var o=p.oidname(j(e,d[0]));var r=JSON.parse(JSON.stringify(c));r.x509ExtName=o;f=r}for(var u=0;u0){var m=new f({array:this.extensionsArray});var k=new c({explicit:true,tag:"a3",obj:m});this.asn1Array.push(k)}var n=new f({array:this.asn1Array});this.hTLV=n.getEncodedHex();this.isModified=false;return this.hTLV};this._initialize()};YAHOO.lang.extend(KJUR.asn1.x509.TBSCertificate,KJUR.asn1.ASN1Object);KJUR.asn1.x509.Extension=function(d){KJUR.asn1.x509.Extension.superclass.constructor.call(this);var f=null,a=KJUR,e=a.asn1,h=e.DERObjectIdentifier,i=e.DEROctetString,b=e.DERBitString,g=e.DERBoolean,c=e.DERSequence;this.getEncodedHex=function(){var m=new h({oid:this.oid});var l=new i({hex:this.getExtnValueHex()});var k=new Array();k.push(m);if(this.critical){k.push(new g())}k.push(l);var j=new c({array:k});return j.getEncodedHex()};this.critical=false;if(typeof d!="undefined"){if(typeof d.critical!="undefined"){this.critical=d.critical}}};YAHOO.lang.extend(KJUR.asn1.x509.Extension,KJUR.asn1.ASN1Object);KJUR.asn1.x509.Extension.appendByNameToArray=function(e,c,b){var g=e.toLowerCase(),f=KJUR.asn1.x509;if(g=="basicconstraints"){var d=new f.BasicConstraints(c);b.push(d)}else{if(g=="keyusage"){var d=new f.KeyUsage(c);b.push(d)}else{if(g=="crldistributionpoints"){var d=new f.CRLDistributionPoints(c);b.push(d)}else{if(g=="extkeyusage"){var d=new f.ExtKeyUsage(c);b.push(d)}else{if(g=="authoritykeyidentifier"){var d=new f.AuthorityKeyIdentifier(c);b.push(d)}else{if(g=="authorityinfoaccess"){var d=new f.AuthorityInfoAccess(c);b.push(d)}else{if(g=="subjectaltname"){var d=new f.SubjectAltName(c);b.push(d)}else{if(g=="issueraltname"){var d=new f.IssuerAltName(c);b.push(d)}else{throw"unsupported extension name: "+e}}}}}}}}};KJUR.asn1.x509.KeyUsage=function(a){KJUR.asn1.x509.KeyUsage.superclass.constructor.call(this,a);this.getExtnValueHex=function(){return this.asn1ExtnValue.getEncodedHex()};this.oid="2.5.29.15";if(typeof a!="undefined"){if(typeof a.bin!="undefined"){this.asn1ExtnValue=new KJUR.asn1.DERBitString(a)}}};YAHOO.lang.extend(KJUR.asn1.x509.KeyUsage,KJUR.asn1.x509.Extension);KJUR.asn1.x509.BasicConstraints=function(c){KJUR.asn1.x509.BasicConstraints.superclass.constructor.call(this,c);var a=false;var b=-1;this.getExtnValueHex=function(){var e=new Array();if(this.cA){e.push(new KJUR.asn1.DERBoolean())}if(this.pathLen>-1){e.push(new KJUR.asn1.DERInteger({"int":this.pathLen}))}var d=new KJUR.asn1.DERSequence({array:e});this.asn1ExtnValue=d;return this.asn1ExtnValue.getEncodedHex()};this.oid="2.5.29.19";this.cA=false;this.pathLen=-1;if(typeof c!="undefined"){if(typeof c.cA!="undefined"){this.cA=c.cA}if(typeof c.pathLen!="undefined"){this.pathLen=c.pathLen}}};YAHOO.lang.extend(KJUR.asn1.x509.BasicConstraints,KJUR.asn1.x509.Extension);KJUR.asn1.x509.CRLDistributionPoints=function(d){KJUR.asn1.x509.CRLDistributionPoints.superclass.constructor.call(this,d);var b=KJUR,a=b.asn1,c=a.x509;this.getExtnValueHex=function(){return this.asn1ExtnValue.getEncodedHex()};this.setByDPArray=function(e){this.asn1ExtnValue=new a.DERSequence({array:e})};this.setByOneURI=function(h){var e=new c.GeneralNames([{uri:h}]);var g=new c.DistributionPointName(e);var f=new c.DistributionPoint({dpobj:g});this.setByDPArray([f])};this.oid="2.5.29.31";if(typeof d!="undefined"){if(typeof d.array!="undefined"){this.setByDPArray(d.array)}else{if(typeof d.uri!="undefined"){this.setByOneURI(d.uri)}}}};YAHOO.lang.extend(KJUR.asn1.x509.CRLDistributionPoints,KJUR.asn1.x509.Extension);KJUR.asn1.x509.ExtKeyUsage=function(c){KJUR.asn1.x509.ExtKeyUsage.superclass.constructor.call(this,c);var b=KJUR,a=b.asn1;this.setPurposeArray=function(d){this.asn1ExtnValue=new a.DERSequence();for(var e=0;e0){var h=new b({array:this.aRevokedCert});this.asn1Array.push(h)}var i=new b({array:this.asn1Array});this.hTLV=i.getEncodedHex();this.isModified=false;return this.hTLV};this._initialize=function(){this.asn1Version=null;this.asn1SignatureAlg=null;this.asn1Issuer=null;this.asn1ThisUpdate=null;this.asn1NextUpdate=null;this.aRevokedCert=new Array()};this._initialize()};YAHOO.lang.extend(KJUR.asn1.x509.TBSCertList,KJUR.asn1.ASN1Object);KJUR.asn1.x509.CRLEntry=function(e){KJUR.asn1.x509.CRLEntry.superclass.constructor.call(this);var d=null,c=null,b=KJUR,a=b.asn1;this.setCertSerial=function(f){this.sn=new a.DERInteger(f)};this.setRevocationDate=function(f){this.time=new a.x509.Time(f)};this.getEncodedHex=function(){var f=new a.DERSequence({array:[this.sn,this.time]});this.TLV=f.getEncodedHex();return this.TLV};if(e!==undefined){if(e.time!==undefined){this.setRevocationDate(e.time)}if(e.sn!==undefined){this.setCertSerial(e.sn)}}};YAHOO.lang.extend(KJUR.asn1.x509.CRLEntry,KJUR.asn1.ASN1Object);KJUR.asn1.x509.X500Name=function(f){KJUR.asn1.x509.X500Name.superclass.constructor.call(this);this.asn1Array=new Array();var d=KJUR,c=d.asn1,e=c.x509,b=pemtohex;this.setByString=function(g){var h=g.split("/");h.shift();for(var j=0;j0;f++){var h=c.shift();if(e===true){var d=b.pop();var j=(d+","+h).replace(/\\,/g,",");b.push(j);e=false}else{b.push(h)}if(h.substr(-1,1)==="\\"){e=true}}b=b.map(function(a){return a.replace("/","\\/")});b.reverse();return"/"+b.join("/")};KJUR.asn1.x509.RDN=function(a){KJUR.asn1.x509.RDN.superclass.constructor.call(this);this.asn1Array=new Array();this.addByString=function(b){this.asn1Array.push(new KJUR.asn1.x509.AttributeTypeAndValue({str:b}))};this.addByMultiValuedString=function(d){var b=KJUR.asn1.x509.RDN.parseString(d);for(var c=0;c0;g++){var k=j.shift();if(h===true){var f=c.pop();var d=(f+"+"+k).replace(/\\\+/g,"+");c.push(d);h=false}else{c.push(k)}if(k.substr(-1,1)==="\\"){h=true}}var l=false;var b=[];for(var g=0;c.length>0;g++){var k=c.shift();if(l===true){var e=b.pop();if(k.match(/"$/)){var d=(e+"+"+k).replace(/^([^=]+)="(.*)"$/,"$1=$2");b.push(d);l=false}else{b.push(e+"+"+k)}}else{b.push(k)}if(k.match(/^[^=]+="/)){l=true}}return b};KJUR.asn1.x509.AttributeTypeAndValue=function(d){KJUR.asn1.x509.AttributeTypeAndValue.superclass.constructor.call(this);var f=null,e=null,a="utf8",c=KJUR,b=c.asn1;this.setByString=function(h){var g=h.match(/^([^=]+)=(.+)$/);if(g){this.setByAttrTypeAndValueStr(g[1],g[2])}else{throw"malformed attrTypeAndValueStr: "+h}};this.setByAttrTypeAndValueStr=function(i,h){this.typeObj=KJUR.asn1.x509.OID.atype2obj(i);var g=a;if(i=="C"){g="prn"}this.valueObj=this.getValueObj(g,h)};this.getValueObj=function(h,g){if(h=="utf8"){return new b.DERUTF8String({str:g})}if(h=="prn"){return new b.DERPrintableString({str:g})}if(h=="tel"){return new b.DERTeletexString({str:g})}if(h=="ia5"){return new b.DERIA5String({str:g})}throw"unsupported directory string type: type="+h+" value="+g};this.getEncodedHex=function(){var g=new b.DERSequence({array:[this.typeObj,this.valueObj]});this.TLV=g.getEncodedHex();return this.TLV};if(typeof d!="undefined"){if(typeof d.str!="undefined"){this.setByString(d.str)}}};YAHOO.lang.extend(KJUR.asn1.x509.AttributeTypeAndValue,KJUR.asn1.ASN1Object);KJUR.asn1.x509.SubjectPublicKeyInfo=function(f){KJUR.asn1.x509.SubjectPublicKeyInfo.superclass.constructor.call(this);var l=null,k=null,a=KJUR,j=a.asn1,i=j.DERInteger,b=j.DERBitString,m=j.DERObjectIdentifier,e=j.DERSequence,h=j.ASN1Util.newObject,d=j.x509,o=d.AlgorithmIdentifier,g=a.crypto,n=g.ECDSA,c=g.DSA;this.getASN1Object=function(){if(this.asn1AlgId==null||this.asn1SubjPKey==null){throw"algId and/or subjPubKey not set"}var p=new e({array:[this.asn1AlgId,this.asn1SubjPKey]});return p};this.getEncodedHex=function(){var p=this.getASN1Object();this.hTLV=p.getEncodedHex();return this.hTLV};this.setPubKey=function(q){try{if(q instanceof RSAKey){var u=h({seq:[{"int":{bigint:q.n}},{"int":{"int":q.e}}]});var s=u.getEncodedHex();this.asn1AlgId=new o({name:"rsaEncryption"});this.asn1SubjPKey=new b({hex:"00"+s})}}catch(p){}try{if(q instanceof KJUR.crypto.ECDSA){var r=new m({name:q.curveName});this.asn1AlgId=new o({name:"ecPublicKey",asn1params:r});this.asn1SubjPKey=new b({hex:"00"+q.pubKeyHex})}}catch(p){}try{if(q instanceof KJUR.crypto.DSA){var r=new h({seq:[{"int":{bigint:q.p}},{"int":{bigint:q.q}},{"int":{bigint:q.g}}]});this.asn1AlgId=new o({name:"dsa",asn1params:r});var t=new i({bigint:q.y});this.asn1SubjPKey=new b({hex:"00"+t.getEncodedHex()})}}catch(p){}};if(f!==undefined){this.setPubKey(f)}};YAHOO.lang.extend(KJUR.asn1.x509.SubjectPublicKeyInfo,KJUR.asn1.ASN1Object);KJUR.asn1.x509.Time=function(f){KJUR.asn1.x509.Time.superclass.constructor.call(this);var e=null,a=null,d=KJUR,c=d.asn1,b=c.DERUTCTime,g=c.DERGeneralizedTime;this.setTimeParams=function(h){this.timeParams=h};this.getEncodedHex=function(){var h=null;if(this.timeParams!=null){if(this.type=="utc"){h=new b(this.timeParams)}else{h=new g(this.timeParams)}}else{if(this.type=="utc"){h=new b()}else{h=new g()}}this.TLV=h.getEncodedHex();return this.TLV};this.type="utc";if(f!==undefined){if(f.type!==undefined){this.type=f.type}else{if(f.str!==undefined){if(f.str.match(/^[0-9]{12}Z$/)){this.type="utc"}if(f.str.match(/^[0-9]{14}Z$/)){this.type="gen"}}}this.timeParams=f}};YAHOO.lang.extend(KJUR.asn1.x509.Time,KJUR.asn1.ASN1Object);KJUR.asn1.x509.AlgorithmIdentifier=function(d){KJUR.asn1.x509.AlgorithmIdentifier.superclass.constructor.call(this);this.nameAlg=null;this.asn1Alg=null;this.asn1Params=null;this.paramEmpty=false;var b=KJUR,a=b.asn1;this.getEncodedHex=function(){if(this.nameAlg===null&&this.asn1Alg===null){throw"algorithm not specified"}if(this.nameAlg!==null&&this.asn1Alg===null){this.asn1Alg=a.x509.OID.name2obj(this.nameAlg)}var e=[this.asn1Alg];if(this.asn1Params!==null){e.push(this.asn1Params)}var f=new a.DERSequence({array:e});this.hTLV=f.getEncodedHex();return this.hTLV};if(d!==undefined){if(d.name!==undefined){this.nameAlg=d.name}if(d.asn1params!==undefined){this.asn1Params=d.asn1params}if(d.paramempty!==undefined){this.paramEmpty=d.paramempty}}if(this.asn1Params===null&&this.paramEmpty===false&&this.nameAlg!==null){var c=this.nameAlg.toLowerCase();if(c.substr(-7,7)!=="withdsa"&&c.substr(-9,9)!=="withecdsa"){this.asn1Params=new a.DERNull()}}};YAHOO.lang.extend(KJUR.asn1.x509.AlgorithmIdentifier,KJUR.asn1.ASN1Object);KJUR.asn1.x509.GeneralName=function(e){KJUR.asn1.x509.GeneralName.superclass.constructor.call(this);var k=null,h=null,i={rfc822:"81",dns:"82",dn:"a4",uri:"86"},b=KJUR,f=b.asn1,d=f.DERIA5String,c=f.DERTaggedObject,j=f.ASN1Object,a=f.x509.X500Name,g=pemtohex;this.explicit=false;this.setByParam=function(r){var q=null;var n=null;if(r===undefined){return}if(r.rfc822!==undefined){this.type="rfc822";n=new d({str:r[this.type]})}if(r.dns!==undefined){this.type="dns";n=new d({str:r[this.type]})}if(r.uri!==undefined){this.type="uri";n=new d({str:r[this.type]})}if(r.dn!==undefined){this.type="dn";n=new a({str:r.dn})}if(r.ldapdn!==undefined){this.type="dn";n=new a({ldapstr:r.ldapdn})}if(r.certissuer!==undefined){this.type="dn";this.explicit=true;var o=r.certissuer;var m=null;if(o.match(/^[0-9A-Fa-f]+$/)){m==o}if(o.indexOf("-----BEGIN ")!=-1){m=g(o)}if(m==null){throw"certissuer param not cert"}var l=new X509();l.hex=m;var p=l.getIssuerHex();n=new j();n.hTLV=p}if(r.certsubj!==undefined){this.type="dn";this.explicit=true;var o=r.certsubj;var m=null;if(o.match(/^[0-9A-Fa-f]+$/)){m==o}if(o.indexOf("-----BEGIN ")!=-1){m=g(o)}if(m==null){throw"certsubj param not cert"}var l=new X509();l.hex=m;var p=l.getSubjectHex();n=new j();n.hTLV=p}if(this.type==null){throw"unsupported type in params="+r}this.asn1Obj=new c({explicit:this.explicit,tag:i[this.type],obj:n})};this.getEncodedHex=function(){return this.asn1Obj.getEncodedHex()};if(e!==undefined){this.setByParam(e)}};YAHOO.lang.extend(KJUR.asn1.x509.GeneralName,KJUR.asn1.ASN1Object);KJUR.asn1.x509.GeneralNames=function(d){KJUR.asn1.x509.GeneralNames.superclass.constructor.call(this);var a=null,c=KJUR,b=c.asn1;this.setByParamArray=function(g){for(var e=0;e0){r=new b({obj:this.dUnsignedAttrs,tag:"a1",explicit:false})}var q=[this.dCMSVersion,this.dSignerIdentifier,this.dDigestAlgorithm,o,this.dSigAlg,this.dSig,];if(r!=null){q.push(r)}var p=new h.DERSequence({array:q});this.hTLV=p.getEncodedHex();return this.hTLV}};YAHOO.lang.extend(KJUR.asn1.cms.SignerInfo,KJUR.asn1.ASN1Object);KJUR.asn1.cms.EncapsulatedContentInfo=function(g){var c=KJUR,b=c.asn1,e=b.DERTaggedObject,a=b.DERSequence,h=b.DERObjectIdentifier,d=b.DEROctetString,f=b.cms;f.EncapsulatedContentInfo.superclass.constructor.call(this);this.dEContentType=new h({name:"data"});this.dEContent=null;this.isDetached=false;this.eContentValueHex=null;this.setContentType=function(i){if(i.match(/^[0-2][.][0-9.]+$/)){this.dEContentType=new h({oid:i})}else{this.dEContentType=new h({name:i})}};this.setContentValue=function(i){if(i!==undefined){if(typeof i.hex=="string"){this.eContentValueHex=i.hex}else{if(typeof i.str=="string"){this.eContentValueHex=utf8tohex(i.str)}}}};this.setContentValueHex=function(i){this.eContentValueHex=i};this.setContentValueStr=function(i){this.eContentValueHex=utf8tohex(i)};this.getEncodedHex=function(){if(typeof this.eContentValueHex!="string"){throw"eContentValue not yet set"}var k=new d({hex:this.eContentValueHex});this.dEContent=new e({obj:k,tag:"a0",explicit:true});var i=[this.dEContentType];if(!this.isDetached){i.push(this.dEContent)}var j=new a({array:i});this.hTLV=j.getEncodedHex();return this.hTLV}};YAHOO.lang.extend(KJUR.asn1.cms.EncapsulatedContentInfo,KJUR.asn1.ASN1Object);KJUR.asn1.cms.ContentInfo=function(f){var c=KJUR,b=c.asn1,d=b.DERTaggedObject,a=b.DERSequence,e=b.x509;KJUR.asn1.cms.ContentInfo.superclass.constructor.call(this);this.dContentType=null;this.dContent=null;this.setContentType=function(g){if(typeof g=="string"){this.dContentType=e.OID.name2obj(g)}};this.getEncodedHex=function(){var h=new d({obj:this.dContent,tag:"a0",explicit:true});var g=new a({array:[this.dContentType,h]});this.hTLV=g.getEncodedHex();return this.hTLV};if(f!==undefined){if(f.type){this.setContentType(f.type)}if(f.obj&&f.obj instanceof b.ASN1Object){this.dContent=f.obj}}};YAHOO.lang.extend(KJUR.asn1.cms.ContentInfo,KJUR.asn1.ASN1Object);KJUR.asn1.cms.SignedData=function(e){var a=KJUR,h=a.asn1,j=h.ASN1Object,g=h.DERInteger,m=h.DERSet,f=h.DERSequence,b=h.DERTaggedObject,l=h.cms,i=l.EncapsulatedContentInfo,d=l.SignerInfo,n=l.ContentInfo,c=h.x509,k=c.AlgorithmIdentifier;KJUR.asn1.cms.SignedData.superclass.constructor.call(this);this.dCMSVersion=new g({"int":1});this.dDigestAlgs=null;this.digestAlgNameList=[];this.dEncapContentInfo=new i();this.dCerts=null;this.certificateList=[];this.crlList=[];this.signerInfoList=[new d()];this.addCertificatesByPEM=function(p){var q=pemtohex(p);var r=new j();r.hTLV=q;this.certificateList.push(r)};this.getEncodedHex=function(){if(typeof this.hTLV=="string"){return this.hTLV}if(this.dDigestAlgs==null){var u=[];for(var t=0;t0){var v=new m({array:this.certificateList});this.dCerts=new b({obj:v,tag:"a0",explicit:false})}}if(this.dCerts!=null){p.push(this.dCerts)}var r=new m({array:this.signerInfoList});p.push(r);var q=new f({array:p});this.hTLV=q.getEncodedHex();return this.hTLV};this.getContentInfo=function(){this.getEncodedHex();var o=new n({type:"signed-data",obj:this});return o};this.getContentInfoEncodedHex=function(){var o=this.getContentInfo();var p=o.getEncodedHex();return p};this.getPEM=function(){return hextopem(this.getContentInfoEncodedHex(),"CMS")}};YAHOO.lang.extend(KJUR.asn1.cms.SignedData,KJUR.asn1.ASN1Object);KJUR.asn1.cms.CMSUtil=new function(){};KJUR.asn1.cms.CMSUtil.newSignedData=function(d){var b=KJUR,j=b.asn1,q=j.cms,f=q.SignerInfo,n=q.SignedData,o=q.SigningTime,a=q.SigningCertificate,p=q.SigningCertificateV2,c=j.cades,e=c.SignaturePolicyIdentifier;var m=new n();m.dEncapContentInfo.setContentValue(d.content);if(typeof d.certs=="object"){for(var h=0;h0){var s=new f({array:this.extensionsArray});var r=new m({array:[s]});var q=new f({array:[new k({oid:"1.2.840.113549.1.9.14"}),r]});var p=new c({explicit:true,tag:"a0",obj:q});this.asn1Array.push(p)}else{var p=new c({explicit:false,tag:"a0",obj:new j()});this.asn1Array.push(p)}var t=new f({array:this.asn1Array});this.hTLV=t.getEncodedHex();this.isModified=false;return this.hTLV};this._initialize()};YAHOO.lang.extend(KJUR.asn1.csr.CertificationRequestInfo,KJUR.asn1.ASN1Object);KJUR.asn1.csr.CSRUtil=new function(){};KJUR.asn1.csr.CSRUtil.newCSRPEM=function(h){var c=KEYUTIL,b=KJUR.asn1.csr;if(h.subject===undefined){throw"parameter subject undefined"}if(h.sbjpubkey===undefined){throw"parameter sbjpubkey undefined"}if(h.sigalg===undefined){throw"parameter sigalg undefined"}if(h.sbjprvkey===undefined){throw"parameter sbjpubkey undefined"}var d=new b.CertificationRequestInfo();d.setSubjectByParam(h.subject);d.setSubjectPublicKeyByGetKey(h.sbjpubkey);if(h.ext!==undefined&&h.ext.length!==undefined){for(var e=0;e"7"){return"00"+a}return a}function intarystrtohex(b){b=b.replace(/^\s*\[\s*/,"");b=b.replace(/\s*\]\s*$/,"");b=b.replace(/\s*/g,"");try{var c=b.split(/,/).map(function(g,e,h){var f=parseInt(g);if(f<0||255a.length){d=a.length}for(var b=0;bd){throw"key is too short for SigAlg: keylen="+j+","+a}var b="0001";var k="00"+c;var g="";var l=d-b.length-k.length;for(var f=0;f=0;--p){q=q.twice2D();q.z=BigInteger.ONE;if(o.testBit(p)){if(n.testBit(p)){q=q.add2D(t)}else{q=q.add2D(s)}}else{if(n.testBit(p)){q=q.add2D(r)}}}return q}this.getBigRandom=function(i){return new BigInteger(i.bitLength(),a).mod(i.subtract(BigInteger.ONE)).add(BigInteger.ONE)};this.setNamedCurve=function(i){this.ecparams=KJUR.crypto.ECParameterDB.getByName(i);this.prvKeyHex=null;this.pubKeyHex=null;this.curveName=i};this.setPrivateKeyHex=function(i){this.isPrivate=true;this.prvKeyHex=i};this.setPublicKeyHex=function(i){this.isPublic=true;this.pubKeyHex=i};this.getPublicKeyXYHex=function(){var k=this.pubKeyHex;if(k.substr(0,2)!=="04"){throw"this method supports uncompressed format(04) only"}var j=this.ecparams.keylen/4;if(k.length!==2+j*2){throw"malformed public key hex length"}var i={};i.x=k.substr(2,j);i.y=k.substr(2+j);return i};this.getShortNISTPCurveName=function(){var i=this.curveName;if(i==="secp256r1"||i==="NIST P-256"||i==="P-256"||i==="prime256v1"){return"P-256"}if(i==="secp384r1"||i==="NIST P-384"||i==="P-384"){return"P-384"}return null};this.generateKeyPairHex=function(){var k=this.ecparams.n;var n=this.getBigRandom(k);var l=this.ecparams.G.multiply(n);var q=l.getX().toBigInteger();var o=l.getY().toBigInteger();var i=this.ecparams.keylen/4;var m=("0000000000"+n.toString(16)).slice(-i);var r=("0000000000"+q.toString(16)).slice(-i);var p=("0000000000"+o.toString(16)).slice(-i);var j="04"+r+p;this.setPrivateKeyHex(m);this.setPublicKeyHex(j);return{ecprvhex:m,ecpubhex:j}};this.signWithMessageHash=function(i){return this.signHex(i,this.prvKeyHex)};this.signHex=function(o,j){var t=new BigInteger(j,16);var l=this.ecparams.n;var q=new BigInteger(o,16);do{var m=this.getBigRandom(l);var u=this.ecparams.G;var p=u.multiply(m);var i=p.getX().toBigInteger().mod(l)}while(i.compareTo(BigInteger.ZERO)<=0);var v=m.modInverse(l).multiply(q.add(t.multiply(i))).mod(l);return KJUR.crypto.ECDSA.biRSSigToASN1Sig(i,v)};this.sign=function(m,u){var q=u;var j=this.ecparams.n;var p=BigInteger.fromByteArrayUnsigned(m);do{var l=this.getBigRandom(j);var t=this.ecparams.G;var o=t.multiply(l);var i=o.getX().toBigInteger().mod(j)}while(i.compareTo(BigInteger.ZERO)<=0);var v=l.modInverse(j).multiply(p.add(q.multiply(i))).mod(j);return this.serializeSig(i,v)};this.verifyWithMessageHash=function(j,i){return this.verifyHex(j,i,this.pubKeyHex)};this.verifyHex=function(m,i,p){var l,j;var o=KJUR.crypto.ECDSA.parseSigHex(i);l=o.r;j=o.s;var k;k=ECPointFp.decodeFromHex(this.ecparams.curve,p);var n=new BigInteger(m,16);return this.verifyRaw(n,l,j,k)};this.verify=function(o,p,j){var l,i;if(Bitcoin.Util.isArray(p)){var n=this.parseSig(p);l=n.r;i=n.s}else{if("object"===typeof p&&p.r&&p.s){l=p.r;i=p.s}else{throw"Invalid value for signature"}}var k;if(j instanceof ECPointFp){k=j}else{if(Bitcoin.Util.isArray(j)){k=ECPointFp.decodeFrom(this.ecparams.curve,j)}else{throw"Invalid format for pubkey value, must be byte array or ECPointFp"}}var m=BigInteger.fromByteArrayUnsigned(o);return this.verifyRaw(m,l,i,k)};this.verifyRaw=function(o,i,w,m){var l=this.ecparams.n;var u=this.ecparams.G;if(i.compareTo(BigInteger.ONE)<0||i.compareTo(l)>=0){return false}if(w.compareTo(BigInteger.ONE)<0||w.compareTo(l)>=0){return false}var p=w.modInverse(l);var k=o.multiply(p).mod(l);var j=i.multiply(p).mod(l);var q=u.multiply(k).add(m.multiply(j));var t=q.getX().toBigInteger().mod(l);return t.equals(i)};this.serializeSig=function(k,j){var l=k.toByteArraySigned();var i=j.toByteArraySigned();var m=[];m.push(2);m.push(l.length);m=m.concat(l);m.push(2);m.push(i.length);m=m.concat(i);m.unshift(m.length);m.unshift(48);return m};this.parseSig=function(n){var m;if(n[0]!=48){throw new Error("Signature not a valid DERSequence")}m=2;if(n[m]!=2){throw new Error("First element in signature must be a DERInteger")}var l=n.slice(m+2,m+2+n[m+1]);m+=2+n[m+1];if(n[m]!=2){throw new Error("Second element in signature must be a DERInteger")}var i=n.slice(m+2,m+2+n[m+1]);m+=2+n[m+1];var k=BigInteger.fromByteArrayUnsigned(l);var j=BigInteger.fromByteArrayUnsigned(i);return{r:k,s:j}};this.parseSigCompact=function(m){if(m.length!==65){throw"Signature has the wrong length"}var j=m[0]-27;if(j<0||j>7){throw"Invalid signature type"}var o=this.ecparams.n;var l=BigInteger.fromByteArrayUnsigned(m.slice(1,33)).mod(o);var k=BigInteger.fromByteArrayUnsigned(m.slice(33,65)).mod(o);return{r:l,s:k,i:j}};this.readPKCS5PrvKeyHex=function(l){var n=ASN1HEX;var m=KJUR.crypto.ECDSA.getName;var p=n.getVbyList;if(n.isASN1HEX(l)===false){throw"not ASN.1 hex string"}var i,k,o;try{i=p(l,0,[2,0],"06");k=p(l,0,[1],"04");try{o=p(l,0,[3,0],"03").substr(2)}catch(j){}}catch(j){throw"malformed PKCS#1/5 plain ECC private key"}this.curveName=m(i);if(this.curveName===undefined){throw"unsupported curve name"}this.setNamedCurve(this.curveName);this.setPublicKeyHex(o);this.setPrivateKeyHex(k);this.isPublic=false};this.readPKCS8PrvKeyHex=function(l){var q=ASN1HEX;var i=KJUR.crypto.ECDSA.getName;var n=q.getVbyList;if(q.isASN1HEX(l)===false){throw"not ASN.1 hex string"}var j,p,m,k;try{j=n(l,0,[1,0],"06");p=n(l,0,[1,1],"06");m=n(l,0,[2,0,1],"04");try{k=n(l,0,[2,0,2,0],"03").substr(2)}catch(o){}}catch(o){throw"malformed PKCS#8 plain ECC private key"}this.curveName=i(p);if(this.curveName===undefined){throw"unsupported curve name"}this.setNamedCurve(this.curveName);this.setPublicKeyHex(k);this.setPrivateKeyHex(m);this.isPublic=false};this.readPKCS8PubKeyHex=function(l){var n=ASN1HEX;var m=KJUR.crypto.ECDSA.getName;var p=n.getVbyList;if(n.isASN1HEX(l)===false){throw"not ASN.1 hex string"}var k,i,o;try{k=p(l,0,[0,0],"06");i=p(l,0,[0,1],"06");o=p(l,0,[1],"03").substr(2)}catch(j){throw"malformed PKCS#8 ECC public key"}this.curveName=m(i);if(this.curveName===null){throw"unsupported curve name"}this.setNamedCurve(this.curveName);this.setPublicKeyHex(o)};this.readCertPubKeyHex=function(k,p){if(p!==5){p=6}var m=ASN1HEX;var l=KJUR.crypto.ECDSA.getName;var o=m.getVbyList;if(m.isASN1HEX(k)===false){throw"not ASN.1 hex string"}var i,n;try{i=o(k,0,[0,p,0,1],"06");n=o(k,0,[0,p,1],"03").substr(2)}catch(j){throw"malformed X.509 certificate ECC public key"}this.curveName=l(i);if(this.curveName===null){throw"unsupported curve name"}this.setNamedCurve(this.curveName);this.setPublicKeyHex(n)};if(h!==undefined){if(h.curve!==undefined){this.curveName=h.curve}}if(this.curveName===undefined){this.curveName=e}this.setNamedCurve(this.curveName);if(h!==undefined){if(h.prv!==undefined){this.setPrivateKeyHex(h.prv)}if(h.pub!==undefined){this.setPublicKeyHex(h.pub)}}};KJUR.crypto.ECDSA.parseSigHex=function(a){var b=KJUR.crypto.ECDSA.parseSigHexInHexRS(a);var d=new BigInteger(b.r,16);var c=new BigInteger(b.s,16);return{r:d,s:c}};KJUR.crypto.ECDSA.parseSigHexInHexRS=function(f){var j=ASN1HEX;var i=j.getChildIdx;var g=j.getV;if(f.substr(0,2)!="30"){throw"signature is not a ASN.1 sequence"}var h=i(f,0);if(h.length!=2){throw"number of signature ASN.1 sequence elements seem wrong"}var e=h[0];var d=h[1];if(f.substr(e,2)!="02"){throw"1st item of sequene of signature is not ASN.1 integer"}if(f.substr(d,2)!="02"){throw"2nd item of sequene of signature is not ASN.1 integer"}var c=g(f,e);var b=g(f,d);return{r:c,s:b}};KJUR.crypto.ECDSA.asn1SigToConcatSig=function(c){var d=KJUR.crypto.ECDSA.parseSigHexInHexRS(c);var b=d.r;var a=d.s;if(b.substr(0,2)=="00"&&(((b.length/2)*8)%(16*8))==8){b=b.substr(2)}if(a.substr(0,2)=="00"&&(((a.length/2)*8)%(16*8))==8){a=a.substr(2)}if((((b.length/2)*8)%(16*8))!=0){throw"unknown ECDSA sig r length error"}if((((a.length/2)*8)%(16*8))!=0){throw"unknown ECDSA sig s length error"}return b+a};KJUR.crypto.ECDSA.concatSigToASN1Sig=function(a){if((((a.length/2)*8)%(16*8))!=0){throw"unknown ECDSA concatinated r-s sig length error"}var c=a.substr(0,a.length/2);var b=a.substr(a.length/2);return KJUR.crypto.ECDSA.hexRSSigToASN1Sig(c,b)};KJUR.crypto.ECDSA.hexRSSigToASN1Sig=function(b,a){var d=new BigInteger(b,16);var c=new BigInteger(a,16);return KJUR.crypto.ECDSA.biRSSigToASN1Sig(d,c)};KJUR.crypto.ECDSA.biRSSigToASN1Sig=function(f,d){var c=KJUR.asn1;var b=new c.DERInteger({bigint:f});var a=new c.DERInteger({bigint:d});var e=new c.DERSequence({array:[b,a]});return e.getEncodedHex()};KJUR.crypto.ECDSA.getName=function(a){if(a==="2a8648ce3d030107"){return"secp256r1"}if(a==="2b8104000a"){return"secp256k1"}if(a==="2b81040022"){return"secp384r1"}if("|secp256r1|NIST P-256|P-256|prime256v1|".indexOf(a)!==-1){return"secp256r1"}if("|secp256k1|".indexOf(a)!==-1){return"secp256k1"}if("|secp384r1|NIST P-384|P-384|".indexOf(a)!==-1){return"secp384r1"}return null}; -if(typeof KJUR=="undefined"||!KJUR){KJUR={}}if(typeof KJUR.crypto=="undefined"||!KJUR.crypto){KJUR.crypto={}}KJUR.crypto.ECParameterDB=new function(){var b={};var c={};function a(d){return new BigInteger(d,16)}this.getByName=function(e){var d=e;if(typeof c[d]!="undefined"){d=c[e]}if(typeof b[d]!="undefined"){return b[d]}throw"unregistered EC curve name: "+d};this.regist=function(A,l,o,g,m,e,j,f,k,u,d,x){b[A]={};var s=a(o);var z=a(g);var y=a(m);var t=a(e);var w=a(j);var r=new ECCurveFp(s,z,y);var q=r.decodePointHex("04"+f+k);b[A]["name"]=A;b[A]["keylen"]=l;b[A]["curve"]=r;b[A]["G"]=q;b[A]["n"]=t;b[A]["h"]=w;b[A]["oid"]=d;b[A]["info"]=x;for(var v=0;v1){g=new BigInteger(i,16)}else{g=null}h=new BigInteger(j,16);this.setPrivate(c,a,e,g,h)};this.setPublic=function(c,b,a,d){this.isPublic=true;this.p=c;this.q=b;this.g=a;this.y=d;this.x=null};this.setPublicHex=function(f,e,d,g){var b,a,h,c;b=new BigInteger(f,16);a=new BigInteger(e,16);h=new BigInteger(d,16);c=new BigInteger(g,16);this.setPublic(b,a,h,c)};this.signWithMessageHash=function(d){var c=this.p;var b=this.q;var f=this.g;var i=this.y;var j=this.x;var e=KJUR.crypto.Util.getRandomBigIntegerMinToMax(BigInteger.ONE.add(BigInteger.ONE),b.subtract(BigInteger.ONE));var l=d.substr(0,b.bitLength()/4);var h=new BigInteger(l,16);var a=(f.modPow(e,c)).mod(b);var n=(e.modInverse(b).multiply(h.add(j.multiply(a)))).mod(b);var m=KJUR.asn1.ASN1Util.jsonToASN1HEX({seq:[{"int":{bigint:a}},{"int":{bigint:n}}]});return m};this.verifyWithMessageHash=function(h,f){var d=this.p;var b=this.q;var j=this.g;var l=this.y;var i=this.parseASN1Signature(f);var a=i[0];var t=i[1];var o=h.substr(0,b.bitLength()/4);var k=new BigInteger(o,16);if(BigInteger.ZERO.compareTo(a)>0||a.compareTo(b)>0){throw"invalid DSA signature"}if(BigInteger.ZERO.compareTo(t)>=0||t.compareTo(b)>0){throw"invalid DSA signature"}var m=t.modInverse(b);var e=k.multiply(m).mod(b);var c=a.multiply(m).mod(b);var n=j.modPow(e,d).multiply(l.modPow(c,d)).mod(d).mod(b);return n.compareTo(a)==0};this.parseASN1Signature=function(a){try{var d=new BigInteger(ASN1HEX.getVbyList(a,0,[0],"02"),16);var c=new BigInteger(ASN1HEX.getVbyList(a,0,[1],"02"),16);return[d,c]}catch(b){throw"malformed ASN.1 DSA signature"}};this.readPKCS5PrvKeyHex=function(c){var b,a,f,g,i;var j=ASN1HEX;var d=j.getVbyList;if(j.isASN1HEX(c)===false){throw"not ASN.1 hex string"}try{b=d(c,0,[1],"02");a=d(c,0,[2],"02");f=d(c,0,[3],"02");g=d(c,0,[4],"02");i=d(c,0,[5],"02")}catch(e){console.log("EXCEPTION:"+e);throw"malformed PKCS#1/5 plain DSA private key"}this.setPrivateHex(b,a,f,g,i)};this.readPKCS8PrvKeyHex=function(d){var f,c,b,g;var e=ASN1HEX;var i=e.getVbyList;if(e.isASN1HEX(d)===false){throw"not ASN.1 hex string"}try{f=i(d,0,[1,1,0],"02");c=i(d,0,[1,1,1],"02");b=i(d,0,[1,1,2],"02");g=i(d,0,[2,0],"02")}catch(a){console.log("EXCEPTION:"+a);throw"malformed PKCS#8 plain DSA private key"}this.setPrivateHex(f,c,b,null,g)};this.readPKCS8PubKeyHex=function(d){var f,c,b,g;var e=ASN1HEX;var i=e.getVbyList;if(e.isASN1HEX(d)===false){throw"not ASN.1 hex string"}try{f=i(d,0,[0,1,0],"02");c=i(d,0,[0,1,1],"02");b=i(d,0,[0,1,2],"02");g=i(d,0,[1,0],"02")}catch(a){console.log("EXCEPTION:"+a);throw"malformed PKCS#8 DSA public key"}this.setPublicHex(f,c,b,g)};this.readCertPubKeyHex=function(c,f){if(f!==5){f=6}var b,a,g,i;var j=ASN1HEX;var d=j.getVbyList;if(j.isASN1HEX(c)===false){throw"not ASN.1 hex string"}try{b=d(c,0,[0,f,0,1,0],"02");a=d(c,0,[0,f,0,1,1],"02");g=d(c,0,[0,f,0,1,2],"02");i=d(c,0,[0,f,1,0],"02")}catch(e){console.log("EXCEPTION:"+e);throw"malformed X.509 certificate DSA public key"}this.setPublicHex(b,a,g,i)}}; -var KEYUTIL=function(){var d=function(p,r,q){return k(CryptoJS.AES,p,r,q)};var e=function(p,r,q){return k(CryptoJS.TripleDES,p,r,q)};var a=function(p,r,q){return k(CryptoJS.DES,p,r,q)};var k=function(s,x,u,q){var r=CryptoJS.enc.Hex.parse(x);var w=CryptoJS.enc.Hex.parse(u);var p=CryptoJS.enc.Hex.parse(q);var t={};t.key=w;t.iv=p;t.ciphertext=r;var v=s.decrypt(t,w,{iv:p});return CryptoJS.enc.Hex.stringify(v)};var l=function(p,r,q){return g(CryptoJS.AES,p,r,q)};var o=function(p,r,q){return g(CryptoJS.TripleDES,p,r,q)};var f=function(p,r,q){return g(CryptoJS.DES,p,r,q)};var g=function(t,y,v,q){var s=CryptoJS.enc.Hex.parse(y);var x=CryptoJS.enc.Hex.parse(v);var p=CryptoJS.enc.Hex.parse(q);var w=t.encrypt(s,x,{iv:p});var r=CryptoJS.enc.Hex.parse(w.toString());var u=CryptoJS.enc.Base64.stringify(r);return u};var i={"AES-256-CBC":{proc:d,eproc:l,keylen:32,ivlen:16},"AES-192-CBC":{proc:d,eproc:l,keylen:24,ivlen:16},"AES-128-CBC":{proc:d,eproc:l,keylen:16,ivlen:16},"DES-EDE3-CBC":{proc:e,eproc:o,keylen:24,ivlen:8},"DES-CBC":{proc:a,eproc:f,keylen:8,ivlen:8}};var c=function(p){return i[p]["proc"]};var m=function(p){var r=CryptoJS.lib.WordArray.random(p);var q=CryptoJS.enc.Hex.stringify(r);return q};var n=function(v){var w={};var q=v.match(new RegExp("DEK-Info: ([^,]+),([0-9A-Fa-f]+)","m"));if(q){w.cipher=q[1];w.ivsalt=q[2]}var p=v.match(new RegExp("-----BEGIN ([A-Z]+) PRIVATE KEY-----"));if(p){w.type=p[1]}var u=-1;var x=0;if(v.indexOf("\r\n\r\n")!=-1){u=v.indexOf("\r\n\r\n");x=2}if(v.indexOf("\n\n")!=-1){u=v.indexOf("\n\n");x=1}var t=v.indexOf("-----END");if(u!=-1&&t!=-1){var r=v.substring(u+x*2,t-x);r=r.replace(/\s+/g,"");w.data=r}return w};var j=function(q,y,p){var v=p.substring(0,16);var t=CryptoJS.enc.Hex.parse(v);var r=CryptoJS.enc.Utf8.parse(y);var u=i[q]["keylen"]+i[q]["ivlen"];var x="";var w=null;for(;;){var s=CryptoJS.algo.MD5.create();if(w!=null){s.update(w)}s.update(r);s.update(t);w=s.finalize();x=x+CryptoJS.enc.Hex.stringify(w);if(x.length>=u*2){break}}var z={};z.keyhex=x.substr(0,i[q]["keylen"]*2);z.ivhex=x.substr(i[q]["keylen"]*2,i[q]["ivlen"]*2);return z};var b=function(p,v,r,w){var s=CryptoJS.enc.Base64.parse(p);var q=CryptoJS.enc.Hex.stringify(s);var u=i[v]["proc"];var t=u(q,r,w);return t};var h=function(p,s,q,u){var r=i[s]["eproc"];var t=r(p,q,u);return t};return{version:"1.0.0",parsePKCS5PEM:function(p){return n(p)},getKeyAndUnusedIvByPasscodeAndIvsalt:function(q,p,r){return j(q,p,r)},decryptKeyB64:function(p,r,q,s){return b(p,r,q,s)},getDecryptedKeyHex:function(y,x){var q=n(y);var t=q.type;var r=q.cipher;var p=q.ivsalt;var s=q.data;var w=j(r,x,p);var v=w.keyhex;var u=b(s,r,v,p);return u},getEncryptedPKCS5PEMFromPrvKeyHex:function(x,s,A,t,r){var p="";if(typeof t=="undefined"||t==null){t="AES-256-CBC"}if(typeof i[t]=="undefined"){throw"KEYUTIL unsupported algorithm: "+t}if(typeof r=="undefined"||r==null){var v=i[t]["ivlen"];var u=m(v);r=u.toUpperCase()}var z=j(t,A,r);var y=z.keyhex;var w=h(s,t,y,r);var q=w.replace(/(.{64})/g,"$1\r\n");var p="-----BEGIN "+x+" PRIVATE KEY-----\r\n";p+="Proc-Type: 4,ENCRYPTED\r\n";p+="DEK-Info: "+t+","+r+"\r\n";p+="\r\n";p+=q;p+="\r\n-----END "+x+" PRIVATE KEY-----\r\n";return p},parseHexOfEncryptedPKCS8:function(y){var B=ASN1HEX;var z=B.getChildIdx;var w=B.getV;var t={};var r=z(y,0);if(r.length!=2){throw"malformed format: SEQUENCE(0).items != 2: "+r.length}t.ciphertext=w(y,r[1]);var A=z(y,r[0]);if(A.length!=2){throw"malformed format: SEQUENCE(0.0).items != 2: "+A.length}if(w(y,A[0])!="2a864886f70d01050d"){throw"this only supports pkcs5PBES2"}var p=z(y,A[1]);if(A.length!=2){throw"malformed format: SEQUENCE(0.0.1).items != 2: "+p.length}var q=z(y,p[1]);if(q.length!=2){throw"malformed format: SEQUENCE(0.0.1.1).items != 2: "+q.length}if(w(y,q[0])!="2a864886f70d0307"){throw"this only supports TripleDES"}t.encryptionSchemeAlg="TripleDES";t.encryptionSchemeIV=w(y,q[1]);var s=z(y,p[0]);if(s.length!=2){throw"malformed format: SEQUENCE(0.0.1.0).items != 2: "+s.length}if(w(y,s[0])!="2a864886f70d01050c"){throw"this only supports pkcs5PBKDF2"}var x=z(y,s[1]);if(x.length<2){throw"malformed format: SEQUENCE(0.0.1.0.1).items < 2: "+x.length}t.pbkdf2Salt=w(y,x[0]);var u=w(y,x[1]);try{t.pbkdf2Iter=parseInt(u,16)}catch(v){throw"malformed format pbkdf2Iter: "+u}return t},getPBKDF2KeyHexFromParam:function(u,p){var t=CryptoJS.enc.Hex.parse(u.pbkdf2Salt);var q=u.pbkdf2Iter;var s=CryptoJS.PBKDF2(p,t,{keySize:192/32,iterations:q});var r=CryptoJS.enc.Hex.stringify(s);return r},_getPlainPKCS8HexFromEncryptedPKCS8PEM:function(x,y){var r=pemtohex(x,"ENCRYPTED PRIVATE KEY");var p=this.parseHexOfEncryptedPKCS8(r);var u=KEYUTIL.getPBKDF2KeyHexFromParam(p,y);var v={};v.ciphertext=CryptoJS.enc.Hex.parse(p.ciphertext);var t=CryptoJS.enc.Hex.parse(u);var s=CryptoJS.enc.Hex.parse(p.encryptionSchemeIV);var w=CryptoJS.TripleDES.decrypt(v,t,{iv:s});var q=CryptoJS.enc.Hex.stringify(w);return q},getKeyFromEncryptedPKCS8PEM:function(s,q){var p=this._getPlainPKCS8HexFromEncryptedPKCS8PEM(s,q);var r=this.getKeyFromPlainPrivatePKCS8Hex(p);return r},parsePlainPrivatePKCS8Hex:function(s){var v=ASN1HEX;var u=v.getChildIdx;var t=v.getV;var q={};q.algparam=null;if(s.substr(0,2)!="30"){throw"malformed plain PKCS8 private key(code:001)"}var r=u(s,0);if(r.length!=3){throw"malformed plain PKCS8 private key(code:002)"}if(s.substr(r[1],2)!="30"){throw"malformed PKCS8 private key(code:003)"}var p=u(s,r[1]);if(p.length!=2){throw"malformed PKCS8 private key(code:004)"}if(s.substr(p[0],2)!="06"){throw"malformed PKCS8 private key(code:005)"}q.algoid=t(s,p[0]);if(s.substr(p[1],2)=="06"){q.algparam=t(s,p[1])}if(s.substr(r[2],2)!="04"){throw"malformed PKCS8 private key(code:006)"}q.keyidx=v.getVidx(s,r[2]);return q},getKeyFromPlainPrivatePKCS8PEM:function(q){var p=pemtohex(q,"PRIVATE KEY");var r=this.getKeyFromPlainPrivatePKCS8Hex(p);return r},getKeyFromPlainPrivatePKCS8Hex:function(p){var q=this.parsePlainPrivatePKCS8Hex(p);var r;if(q.algoid=="2a864886f70d010101"){r=new RSAKey()}else{if(q.algoid=="2a8648ce380401"){r=new KJUR.crypto.DSA()}else{if(q.algoid=="2a8648ce3d0201"){r=new KJUR.crypto.ECDSA()}else{throw"unsupported private key algorithm"}}}r.readPKCS8PrvKeyHex(p);return r},_getKeyFromPublicPKCS8Hex:function(q){var p;var r=ASN1HEX.getVbyList(q,0,[0,0],"06");if(r==="2a864886f70d010101"){p=new RSAKey()}else{if(r==="2a8648ce380401"){p=new KJUR.crypto.DSA()}else{if(r==="2a8648ce3d0201"){p=new KJUR.crypto.ECDSA()}else{throw"unsupported PKCS#8 public key hex"}}}p.readPKCS8PubKeyHex(q);return p},parsePublicRawRSAKeyHex:function(r){var u=ASN1HEX;var t=u.getChildIdx;var s=u.getV;var p={};if(r.substr(0,2)!="30"){throw"malformed RSA key(code:001)"}var q=t(r,0);if(q.length!=2){throw"malformed RSA key(code:002)"}if(r.substr(q[0],2)!="02"){throw"malformed RSA key(code:003)"}p.n=s(r,q[0]);if(r.substr(q[1],2)!="02"){throw"malformed RSA key(code:004)"}p.e=s(r,q[1]);return p},parsePublicPKCS8Hex:function(t){var v=ASN1HEX;var u=v.getChildIdx;var s=v.getV;var q={};q.algparam=null;var r=u(t,0);if(r.length!=2){throw"outer DERSequence shall have 2 elements: "+r.length}var w=r[0];if(t.substr(w,2)!="30"){throw"malformed PKCS8 public key(code:001)"}var p=u(t,w);if(p.length!=2){throw"malformed PKCS8 public key(code:002)"}if(t.substr(p[0],2)!="06"){throw"malformed PKCS8 public key(code:003)"}q.algoid=s(t,p[0]);if(t.substr(p[1],2)=="06"){q.algparam=s(t,p[1])}else{if(t.substr(p[1],2)=="30"){q.algparam={};q.algparam.p=v.getVbyList(t,p[1],[0],"02");q.algparam.q=v.getVbyList(t,p[1],[1],"02");q.algparam.g=v.getVbyList(t,p[1],[2],"02")}}if(t.substr(r[1],2)!="03"){throw"malformed PKCS8 public key(code:004)"}q.key=s(t,r[1]).substr(2);return q},}}();KEYUTIL.getKey=function(l,k,n){var G=ASN1HEX,L=G.getChildIdx,v=G.getV,d=G.getVbyList,c=KJUR.crypto,i=c.ECDSA,C=c.DSA,w=RSAKey,M=pemtohex,F=KEYUTIL;if(typeof w!="undefined"&&l instanceof w){return l}if(typeof i!="undefined"&&l instanceof i){return l}if(typeof C!="undefined"&&l instanceof C){return l}if(l.curve!==undefined&&l.xy!==undefined&&l.d===undefined){return new i({pub:l.xy,curve:l.curve})}if(l.curve!==undefined&&l.d!==undefined){return new i({prv:l.d,curve:l.curve})}if(l.kty===undefined&&l.n!==undefined&&l.e!==undefined&&l.d===undefined){var P=new w();P.setPublic(l.n,l.e);return P}if(l.kty===undefined&&l.n!==undefined&&l.e!==undefined&&l.d!==undefined&&l.p!==undefined&&l.q!==undefined&&l.dp!==undefined&&l.dq!==undefined&&l.co!==undefined&&l.qi===undefined){var P=new w();P.setPrivateEx(l.n,l.e,l.d,l.p,l.q,l.dp,l.dq,l.co);return P}if(l.kty===undefined&&l.n!==undefined&&l.e!==undefined&&l.d!==undefined&&l.p===undefined){var P=new w();P.setPrivate(l.n,l.e,l.d);return P}if(l.p!==undefined&&l.q!==undefined&&l.g!==undefined&&l.y!==undefined&&l.x===undefined){var P=new C();P.setPublic(l.p,l.q,l.g,l.y);return P}if(l.p!==undefined&&l.q!==undefined&&l.g!==undefined&&l.y!==undefined&&l.x!==undefined){var P=new C();P.setPrivate(l.p,l.q,l.g,l.y,l.x);return P}if(l.kty==="RSA"&&l.n!==undefined&&l.e!==undefined&&l.d===undefined){var P=new w();P.setPublic(b64utohex(l.n),b64utohex(l.e));return P}if(l.kty==="RSA"&&l.n!==undefined&&l.e!==undefined&&l.d!==undefined&&l.p!==undefined&&l.q!==undefined&&l.dp!==undefined&&l.dq!==undefined&&l.qi!==undefined){var P=new w();P.setPrivateEx(b64utohex(l.n),b64utohex(l.e),b64utohex(l.d),b64utohex(l.p),b64utohex(l.q),b64utohex(l.dp),b64utohex(l.dq),b64utohex(l.qi));return P}if(l.kty==="RSA"&&l.n!==undefined&&l.e!==undefined&&l.d!==undefined){var P=new w();P.setPrivate(b64utohex(l.n),b64utohex(l.e),b64utohex(l.d));return P}if(l.kty==="EC"&&l.crv!==undefined&&l.x!==undefined&&l.y!==undefined&&l.d===undefined){var j=new i({curve:l.crv});var t=j.ecparams.keylen/4;var B=("0000000000"+b64utohex(l.x)).slice(-t);var z=("0000000000"+b64utohex(l.y)).slice(-t);var u="04"+B+z;j.setPublicKeyHex(u);return j}if(l.kty==="EC"&&l.crv!==undefined&&l.x!==undefined&&l.y!==undefined&&l.d!==undefined){var j=new i({curve:l.crv});var t=j.ecparams.keylen/4;var B=("0000000000"+b64utohex(l.x)).slice(-t);var z=("0000000000"+b64utohex(l.y)).slice(-t);var u="04"+B+z;var b=("0000000000"+b64utohex(l.d)).slice(-t);j.setPublicKeyHex(u);j.setPrivateKeyHex(b);return j}if(n==="pkcs5prv"){var J=l,G=ASN1HEX,N,P;N=L(J,0);if(N.length===9){P=new w();P.readPKCS5PrvKeyHex(J)}else{if(N.length===6){P=new C();P.readPKCS5PrvKeyHex(J)}else{if(N.length>2&&J.substr(N[1],2)==="04"){P=new i();P.readPKCS5PrvKeyHex(J)}else{throw"unsupported PKCS#1/5 hexadecimal key"}}}return P}if(n==="pkcs8prv"){var P=F.getKeyFromPlainPrivatePKCS8Hex(l);return P}if(n==="pkcs8pub"){return F._getKeyFromPublicPKCS8Hex(l)}if(n==="x509pub"){return X509.getPublicKeyFromCertHex(l)}if(l.indexOf("-END CERTIFICATE-",0)!=-1||l.indexOf("-END X509 CERTIFICATE-",0)!=-1||l.indexOf("-END TRUSTED CERTIFICATE-",0)!=-1){return X509.getPublicKeyFromCertPEM(l)}if(l.indexOf("-END PUBLIC KEY-")!=-1){var O=pemtohex(l,"PUBLIC KEY");return F._getKeyFromPublicPKCS8Hex(O)}if(l.indexOf("-END RSA PRIVATE KEY-")!=-1&&l.indexOf("4,ENCRYPTED")==-1){var m=M(l,"RSA PRIVATE KEY");return F.getKey(m,null,"pkcs5prv")}if(l.indexOf("-END DSA PRIVATE KEY-")!=-1&&l.indexOf("4,ENCRYPTED")==-1){var I=M(l,"DSA PRIVATE KEY");var E=d(I,0,[1],"02");var D=d(I,0,[2],"02");var K=d(I,0,[3],"02");var r=d(I,0,[4],"02");var s=d(I,0,[5],"02");var P=new C();P.setPrivate(new BigInteger(E,16),new BigInteger(D,16),new BigInteger(K,16),new BigInteger(r,16),new BigInteger(s,16));return P}if(l.indexOf("-END PRIVATE KEY-")!=-1){return F.getKeyFromPlainPrivatePKCS8PEM(l)}if(l.indexOf("-END RSA PRIVATE KEY-")!=-1&&l.indexOf("4,ENCRYPTED")!=-1){var o=F.getDecryptedKeyHex(l,k);var H=new RSAKey();H.readPKCS5PrvKeyHex(o);return H}if(l.indexOf("-END EC PRIVATE KEY-")!=-1&&l.indexOf("4,ENCRYPTED")!=-1){var I=F.getDecryptedKeyHex(l,k);var P=d(I,0,[1],"04");var f=d(I,0,[2,0],"06");var A=d(I,0,[3,0],"03").substr(2);var e="";if(KJUR.crypto.OID.oidhex2name[f]!==undefined){e=KJUR.crypto.OID.oidhex2name[f]}else{throw"undefined OID(hex) in KJUR.crypto.OID: "+f}var j=new i({curve:e});j.setPublicKeyHex(A);j.setPrivateKeyHex(P);j.isPublic=false;return j}if(l.indexOf("-END DSA PRIVATE KEY-")!=-1&&l.indexOf("4,ENCRYPTED")!=-1){var I=F.getDecryptedKeyHex(l,k);var E=d(I,0,[1],"02");var D=d(I,0,[2],"02");var K=d(I,0,[3],"02");var r=d(I,0,[4],"02");var s=d(I,0,[5],"02");var P=new C();P.setPrivate(new BigInteger(E,16),new BigInteger(D,16),new BigInteger(K,16),new BigInteger(r,16),new BigInteger(s,16));return P}if(l.indexOf("-END ENCRYPTED PRIVATE KEY-")!=-1){return F.getKeyFromEncryptedPKCS8PEM(l,k)}throw"not supported argument"};KEYUTIL.generateKeypair=function(a,c){if(a=="RSA"){var b=c;var h=new RSAKey();h.generate(b,"10001");h.isPrivate=true;h.isPublic=true;var f=new RSAKey();var e=h.n.toString(16);var i=h.e.toString(16);f.setPublic(e,i);f.isPrivate=false;f.isPublic=true;var k={};k.prvKeyObj=h;k.pubKeyObj=f;return k}else{if(a=="EC"){var d=c;var g=new KJUR.crypto.ECDSA({curve:d});var j=g.generateKeyPairHex();var h=new KJUR.crypto.ECDSA({curve:d});h.setPublicKeyHex(j.ecpubhex);h.setPrivateKeyHex(j.ecprvhex);h.isPrivate=true;h.isPublic=false;var f=new KJUR.crypto.ECDSA({curve:d});f.setPublicKeyHex(j.ecpubhex);f.isPrivate=false;f.isPublic=true;var k={};k.prvKeyObj=h;k.pubKeyObj=f;return k}else{throw"unknown algorithm: "+a}}};KEYUTIL.getPEM=function(b,D,y,m,q,j){var F=KJUR,k=F.asn1,z=k.DERObjectIdentifier,f=k.DERInteger,l=k.ASN1Util.newObject,a=k.x509,C=a.SubjectPublicKeyInfo,e=F.crypto,u=e.DSA,r=e.ECDSA,n=RSAKey;function A(s){var G=l({seq:[{"int":0},{"int":{bigint:s.n}},{"int":s.e},{"int":{bigint:s.d}},{"int":{bigint:s.p}},{"int":{bigint:s.q}},{"int":{bigint:s.dmp1}},{"int":{bigint:s.dmq1}},{"int":{bigint:s.coeff}}]});return G}function B(G){var s=l({seq:[{"int":1},{octstr:{hex:G.prvKeyHex}},{tag:["a0",true,{oid:{name:G.curveName}}]},{tag:["a1",true,{bitstr:{hex:"00"+G.pubKeyHex}}]}]});return s}function x(s){var G=l({seq:[{"int":0},{"int":{bigint:s.p}},{"int":{bigint:s.q}},{"int":{bigint:s.g}},{"int":{bigint:s.y}},{"int":{bigint:s.x}}]});return G}if(((n!==undefined&&b instanceof n)||(u!==undefined&&b instanceof u)||(r!==undefined&&b instanceof r))&&b.isPublic==true&&(D===undefined||D=="PKCS8PUB")){var E=new C(b);var w=E.getEncodedHex();return hextopem(w,"PUBLIC KEY")}if(D=="PKCS1PRV"&&n!==undefined&&b instanceof n&&(y===undefined||y==null)&&b.isPrivate==true){var E=A(b);var w=E.getEncodedHex();return hextopem(w,"RSA PRIVATE KEY")}if(D=="PKCS1PRV"&&r!==undefined&&b instanceof r&&(y===undefined||y==null)&&b.isPrivate==true){var i=new z({name:b.curveName});var v=i.getEncodedHex();var h=B(b);var t=h.getEncodedHex();var p="";p+=hextopem(v,"EC PARAMETERS");p+=hextopem(t,"EC PRIVATE KEY");return p}if(D=="PKCS1PRV"&&u!==undefined&&b instanceof u&&(y===undefined||y==null)&&b.isPrivate==true){var E=x(b);var w=E.getEncodedHex();return hextopem(w,"DSA PRIVATE KEY")}if(D=="PKCS5PRV"&&n!==undefined&&b instanceof n&&(y!==undefined&&y!=null)&&b.isPrivate==true){var E=A(b);var w=E.getEncodedHex();if(m===undefined){m="DES-EDE3-CBC"}return this.getEncryptedPKCS5PEMFromPrvKeyHex("RSA",w,y,m,j)}if(D=="PKCS5PRV"&&r!==undefined&&b instanceof r&&(y!==undefined&&y!=null)&&b.isPrivate==true){var E=B(b);var w=E.getEncodedHex();if(m===undefined){m="DES-EDE3-CBC"}return this.getEncryptedPKCS5PEMFromPrvKeyHex("EC",w,y,m,j)}if(D=="PKCS5PRV"&&u!==undefined&&b instanceof u&&(y!==undefined&&y!=null)&&b.isPrivate==true){var E=x(b);var w=E.getEncodedHex();if(m===undefined){m="DES-EDE3-CBC"}return this.getEncryptedPKCS5PEMFromPrvKeyHex("DSA",w,y,m,j)}var o=function(G,s){var I=c(G,s);var H=new l({seq:[{seq:[{oid:{name:"pkcs5PBES2"}},{seq:[{seq:[{oid:{name:"pkcs5PBKDF2"}},{seq:[{octstr:{hex:I.pbkdf2Salt}},{"int":I.pbkdf2Iter}]}]},{seq:[{oid:{name:"des-EDE3-CBC"}},{octstr:{hex:I.encryptionSchemeIV}}]}]}]},{octstr:{hex:I.ciphertext}}]});return H.getEncodedHex()};var c=function(N,O){var H=100;var M=CryptoJS.lib.WordArray.random(8);var L="DES-EDE3-CBC";var s=CryptoJS.lib.WordArray.random(8);var I=CryptoJS.PBKDF2(O,M,{keySize:192/32,iterations:H});var J=CryptoJS.enc.Hex.parse(N);var K=CryptoJS.TripleDES.encrypt(J,I,{iv:s})+"";var G={};G.ciphertext=K;G.pbkdf2Salt=CryptoJS.enc.Hex.stringify(M);G.pbkdf2Iter=H;G.encryptionSchemeAlg=L;G.encryptionSchemeIV=CryptoJS.enc.Hex.stringify(s);return G};if(D=="PKCS8PRV"&&n!=undefined&&b instanceof n&&b.isPrivate==true){var g=A(b);var d=g.getEncodedHex();var E=l({seq:[{"int":0},{seq:[{oid:{name:"rsaEncryption"}},{"null":true}]},{octstr:{hex:d}}]});var w=E.getEncodedHex();if(y===undefined||y==null){return hextopem(w,"PRIVATE KEY")}else{var t=o(w,y);return hextopem(t,"ENCRYPTED PRIVATE KEY")}}if(D=="PKCS8PRV"&&r!==undefined&&b instanceof r&&b.isPrivate==true){var g=new l({seq:[{"int":1},{octstr:{hex:b.prvKeyHex}},{tag:["a1",true,{bitstr:{hex:"00"+b.pubKeyHex}}]}]});var d=g.getEncodedHex();var E=l({seq:[{"int":0},{seq:[{oid:{name:"ecPublicKey"}},{oid:{name:b.curveName}}]},{octstr:{hex:d}}]});var w=E.getEncodedHex();if(y===undefined||y==null){return hextopem(w,"PRIVATE KEY")}else{var t=o(w,y);return hextopem(t,"ENCRYPTED PRIVATE KEY")}}if(D=="PKCS8PRV"&&u!==undefined&&b instanceof u&&b.isPrivate==true){var g=new f({bigint:b.x});var d=g.getEncodedHex();var E=l({seq:[{"int":0},{seq:[{oid:{name:"dsa"}},{seq:[{"int":{bigint:b.p}},{"int":{bigint:b.q}},{"int":{bigint:b.g}}]}]},{octstr:{hex:d}}]});var w=E.getEncodedHex();if(y===undefined||y==null){return hextopem(w,"PRIVATE KEY")}else{var t=o(w,y);return hextopem(t,"ENCRYPTED PRIVATE KEY")}}throw"unsupported object nor format"};KEYUTIL.getKeyFromCSRPEM=function(b){var a=pemtohex(b,"CERTIFICATE REQUEST");var c=KEYUTIL.getKeyFromCSRHex(a);return c};KEYUTIL.getKeyFromCSRHex=function(a){var c=KEYUTIL.parseCSRHex(a);var b=KEYUTIL.getKey(c.p8pubkeyhex,null,"pkcs8pub");return b};KEYUTIL.parseCSRHex=function(d){var i=ASN1HEX;var f=i.getChildIdx;var c=i.getTLV;var b={};var g=d;if(g.substr(0,2)!="30"){throw"malformed CSR(code:001)"}var e=f(g,0);if(e.length<1){throw"malformed CSR(code:002)"}if(g.substr(e[0],2)!="30"){throw"malformed CSR(code:003)"}var a=f(g,e[0]);if(a.length<3){throw"malformed CSR(code:004)"}b.p8pubkeyhex=c(g,a[2]);return b};KEYUTIL.getJWKFromKey=function(d){var b={};if(d instanceof RSAKey&&d.isPrivate){b.kty="RSA";b.n=hextob64u(d.n.toString(16));b.e=hextob64u(d.e.toString(16));b.d=hextob64u(d.d.toString(16));b.p=hextob64u(d.p.toString(16));b.q=hextob64u(d.q.toString(16));b.dp=hextob64u(d.dmp1.toString(16));b.dq=hextob64u(d.dmq1.toString(16));b.qi=hextob64u(d.coeff.toString(16));return b}else{if(d instanceof RSAKey&&d.isPublic){b.kty="RSA";b.n=hextob64u(d.n.toString(16));b.e=hextob64u(d.e.toString(16));return b}else{if(d instanceof KJUR.crypto.ECDSA&&d.isPrivate){var a=d.getShortNISTPCurveName();if(a!=="P-256"&&a!=="P-384"){throw"unsupported curve name for JWT: "+a}var c=d.getPublicKeyXYHex();b.kty="EC";b.crv=a;b.x=hextob64u(c.x);b.y=hextob64u(c.y);b.d=hextob64u(d.prvKeyHex);return b}else{if(d instanceof KJUR.crypto.ECDSA&&d.isPublic){var a=d.getShortNISTPCurveName();if(a!=="P-256"&&a!=="P-384"){throw"unsupported curve name for JWT: "+a}var c=d.getPublicKeyXYHex();b.kty="EC";b.crv=a;b.x=hextob64u(c.x);b.y=hextob64u(c.y);return b}}}}throw"not supported key object"}; -RSAKey.getPosArrayOfChildrenFromHex=function(a){return ASN1HEX.getChildIdx(a,0)};RSAKey.getHexValueArrayOfChildrenFromHex=function(f){var n=ASN1HEX;var i=n.getV;var k=RSAKey.getPosArrayOfChildrenFromHex(f);var e=i(f,k[0]);var j=i(f,k[1]);var b=i(f,k[2]);var c=i(f,k[3]);var h=i(f,k[4]);var g=i(f,k[5]);var m=i(f,k[6]);var l=i(f,k[7]);var d=i(f,k[8]);var k=new Array();k.push(e,j,b,c,h,g,m,l,d);return k};RSAKey.prototype.readPrivateKeyFromPEMString=function(d){var c=pemtohex(d);var b=RSAKey.getHexValueArrayOfChildrenFromHex(c);this.setPrivateEx(b[1],b[2],b[3],b[4],b[5],b[6],b[7],b[8])};RSAKey.prototype.readPKCS5PrvKeyHex=function(c){var b=RSAKey.getHexValueArrayOfChildrenFromHex(c);this.setPrivateEx(b[1],b[2],b[3],b[4],b[5],b[6],b[7],b[8])};RSAKey.prototype.readPKCS8PrvKeyHex=function(e){var c,j,l,b,a,f,d,k;var m=ASN1HEX;var g=m.getVbyList;if(m.isASN1HEX(e)===false){throw"not ASN.1 hex string"}try{c=g(e,0,[2,0,1],"02");j=g(e,0,[2,0,2],"02");l=g(e,0,[2,0,3],"02");b=g(e,0,[2,0,4],"02");a=g(e,0,[2,0,5],"02");f=g(e,0,[2,0,6],"02");d=g(e,0,[2,0,7],"02");k=g(e,0,[2,0,8],"02")}catch(i){throw"malformed PKCS#8 plain RSA private key"}this.setPrivateEx(c,j,l,b,a,f,d,k)};RSAKey.prototype.readPKCS5PubKeyHex=function(c){var e=ASN1HEX;var b=e.getV;if(e.isASN1HEX(c)===false){throw"keyHex is not ASN.1 hex string"}var a=e.getChildIdx(c,0);if(a.length!==2||c.substr(a[0],2)!=="02"||c.substr(a[1],2)!=="02"){throw"wrong hex for PKCS#5 public key"}var f=b(c,a[0]);var d=b(c,a[1]);this.setPublic(f,d)};RSAKey.prototype.readPKCS8PubKeyHex=function(b){var c=ASN1HEX;if(c.isASN1HEX(b)===false){throw"not ASN.1 hex string"}if(c.getTLVbyList(b,0,[0,0])!=="06092a864886f70d010101"){throw"not PKCS8 RSA public key"}var a=c.getTLVbyList(b,0,[1,0]);this.readPKCS5PubKeyHex(a)};RSAKey.prototype.readCertPubKeyHex=function(b,d){var a,c;a=new X509();a.readCertHex(b);c=a.getPublicKeyHex();this.readPKCS8PubKeyHex(c)}; -var _RE_HEXDECONLY=new RegExp("");_RE_HEXDECONLY.compile("[^0-9a-f]","gi");function _rsasign_getHexPaddedDigestInfoForString(d,e,a){var b=function(f){return KJUR.crypto.Util.hashString(f,a)};var c=b(d);return KJUR.crypto.Util.getPaddedDigestInfoHex(c,a,e)}function _zeroPaddingOfSignature(e,d){var c="";var a=d/4-e.length;for(var b=0;b>24,(d&16711680)>>16,(d&65280)>>8,d&255]))));d+=1}return b}RSAKey.prototype.signPSS=function(e,a,d){var c=function(f){return KJUR.crypto.Util.hashHex(f,a)};var b=c(rstrtohex(e));if(d===undefined){d=-1}return this.signWithMessageHashPSS(b,a,d)};RSAKey.prototype.signWithMessageHashPSS=function(l,a,k){var b=hextorstr(l);var g=b.length;var m=this.n.bitLength()-1;var c=Math.ceil(m/8);var d;var o=function(i){return KJUR.crypto.Util.hashHex(i,a)};if(k===-1||k===undefined){k=g}else{if(k===-2){k=c-g-2}else{if(k<-2){throw"invalid salt length"}}}if(c<(g+k+2)){throw"data too long"}var f="";if(k>0){f=new Array(k);new SecureRandom().nextBytes(f);f=String.fromCharCode.apply(String,f)}var n=hextorstr(o(rstrtohex("\x00\x00\x00\x00\x00\x00\x00\x00"+b+f)));var j=[];for(d=0;d>(8*c-m))&255;q[0]&=~p;for(d=0;dthis.n.bitLength()){return 0}var i=this.doPublic(b);var e=i.toString(16).replace(/^1f+00/,"");var g=_rsasign_getAlgNameAndHashFromHexDisgestInfo(e);if(g.length==0){return false}var d=g[0];var h=g[1];var a=function(k){return KJUR.crypto.Util.hashString(k,d)};var c=a(f);return(h==c)};RSAKey.prototype.verifyWithMessageHash=function(e,a){a=a.replace(_RE_HEXDECONLY,"");a=a.replace(/[ \n]+/g,"");var b=parseBigInt(a,16);if(b.bitLength()>this.n.bitLength()){return 0}var h=this.doPublic(b);var g=h.toString(16).replace(/^1f+00/,"");var c=_rsasign_getAlgNameAndHashFromHexDisgestInfo(g);if(c.length==0){return false}var d=c[0];var f=c[1];return(f==e)};RSAKey.prototype.verifyPSS=function(c,b,a,f){var e=function(g){return KJUR.crypto.Util.hashHex(g,a)};var d=e(rstrtohex(c));if(f===undefined){f=-1}return this.verifyWithMessageHashPSS(d,b,a,f)};RSAKey.prototype.verifyWithMessageHashPSS=function(f,s,l,c){var k=new BigInteger(s,16);if(k.bitLength()>this.n.bitLength()){return false}var r=function(i){return KJUR.crypto.Util.hashHex(i,l)};var j=hextorstr(f);var h=j.length;var g=this.n.bitLength()-1;var m=Math.ceil(g/8);var q;if(c===-1||c===undefined){c=h}else{if(c===-2){c=m-h-2}else{if(c<-2){throw"invalid salt length"}}}if(m<(h+c+2)){throw"data too long"}var a=this.doPublic(k).toByteArray();for(q=0;q>(8*m-g))&255;if((d.charCodeAt(0)&p)!==0){throw"bits beyond keysize not zero"}var n=pss_mgf1_str(e,d.length,r);var o=[];for(q=0;q0){var b=":"+n.join(":")+":";if(b.indexOf(":"+k+":")==-1){throw"algorithm '"+k+"' not accepted in the list"}}if(k!="none"&&B===null){throw"key shall be specified to verify."}if(typeof B=="string"&&B.indexOf("-----BEGIN ")!=-1){B=KEYUTIL.getKey(B)}if(z=="RS"||z=="PS"){if(!(B instanceof m)){throw"key shall be a RSAKey obj for RS* and PS* algs"}}if(z=="ES"){if(!(B instanceof p)){throw"key shall be a ECDSA obj for ES* algs"}}if(k=="none"){}var u=null;if(t.jwsalg2sigalg[l.alg]===undefined){throw"unsupported alg name: "+k}else{u=t.jwsalg2sigalg[k]}if(u=="none"){throw"not supported"}else{if(u.substr(0,4)=="Hmac"){var o=null;if(B===undefined){throw"hexadecimal key shall be specified for HMAC"}var j=new s({alg:u,pass:B});j.updateString(c);o=j.doFinal();return A==o}else{if(u.indexOf("withECDSA")!=-1){var h=null;try{h=p.concatSigToASN1Sig(A)}catch(v){return false}var g=new d({alg:u});g.init(B);g.updateString(c);return g.verify(h)}else{var g=new d({alg:u});g.init(B);g.updateString(c);return g.verify(A)}}}};KJUR.jws.JWS.parse=function(g){var c=g.split(".");var b={};var f,e,d;if(c.length!=2&&c.length!=3){throw"malformed sJWS: wrong number of '.' splitted elements"}f=c[0];e=c[1];if(c.length==3){d=c[2]}b.headerObj=KJUR.jws.JWS.readSafeJSONString(b64utoutf8(f));b.payloadObj=KJUR.jws.JWS.readSafeJSONString(b64utoutf8(e));b.headerPP=JSON.stringify(b.headerObj,null," ");if(b.payloadObj==null){b.payloadPP=b64utoutf8(e)}else{b.payloadPP=JSON.stringify(b.payloadObj,null," ")}if(d!==undefined){b.sigHex=b64utohex(d)}return b};KJUR.jws.JWS.verifyJWT=function(e,l,r){var d=KJUR,j=d.jws,o=j.JWS,n=o.readSafeJSONString,p=o.inArray,f=o.includedArray;var k=e.split(".");var c=k[0];var i=k[1];var q=c+"."+i;var m=b64utohex(k[2]);var h=n(b64utoutf8(c));var g=n(b64utoutf8(i));if(h.alg===undefined){return false}if(r.alg===undefined){throw"acceptField.alg shall be specified"}if(!p(h.alg,r.alg)){return false}if(g.iss!==undefined&&typeof r.iss==="object"){if(!p(g.iss,r.iss)){return false}}if(g.sub!==undefined&&typeof r.sub==="object"){if(!p(g.sub,r.sub)){return false}}if(g.aud!==undefined&&typeof r.aud==="object"){if(typeof g.aud=="string"){if(!p(g.aud,r.aud)){return false}}else{if(typeof g.aud=="object"){if(!f(g.aud,r.aud)){return false}}}}var b=j.IntDate.getNow();if(r.verifyAt!==undefined&&typeof r.verifyAt==="number"){b=r.verifyAt}if(r.gracePeriod===undefined||typeof r.gracePeriod!=="number"){r.gracePeriod=0}if(g.exp!==undefined&&typeof g.exp=="number"){if(g.exp+r.gracePeriodl){this.aHeader.pop()}if(this.aSignature.length>l){this.aSignature.pop()}throw"addSignature failed: "+i}};this.verifyAll=function(h){if(this.aHeader.length!==h.length||this.aSignature.length!==h.length){return false}for(var g=0;g0){this.aHeader=g.headers}else{throw"malformed header"}if(typeof g.payload==="string"){this.sPayload=g.payload}else{throw"malformed signatures"}if(g.signatures.length>0){this.signatures=g.signatures}else{throw"malformed signatures"}}catch(e){throw"malformed JWS-JS JSON object: "+e}}};this.getJSON=function(){return{headers:this.aHeader,payload:this.sPayload,signatures:this.aSignature}};this.isEmpty=function(){if(this.aHeader.length==0){return 1}return 0}}; -exports.SecureRandom = SecureRandom; -exports.rng_seed_time = rng_seed_time; - -exports.BigInteger = BigInteger; -exports.RSAKey = RSAKey; -exports.ECDSA = KJUR.crypto.ECDSA; -exports.DSA = KJUR.crypto.DSA; -exports.Signature = KJUR.crypto.Signature; -exports.MessageDigest = KJUR.crypto.MessageDigest; -exports.Mac = KJUR.crypto.Mac; -exports.Cipher = KJUR.crypto.Cipher; -exports.KEYUTIL = KEYUTIL; -exports.ASN1HEX = ASN1HEX; -exports.X509 = X509; -exports.CryptoJS = CryptoJS; - -// ext/base64.js -exports.b64tohex = b64tohex; -exports.b64toBA = b64toBA; - -// base64x.js -exports.stoBA = stoBA; -exports.BAtos = BAtos; -exports.BAtohex = BAtohex; -exports.stohex = stohex; -exports.stob64 = stob64; -exports.stob64u = stob64u; -exports.b64utos = b64utos; -exports.b64tob64u = b64tob64u; -exports.b64utob64 = b64utob64; -exports.hex2b64 = hex2b64; -exports.hextob64u = hextob64u; -exports.b64utohex = b64utohex; -exports.utf8tob64u = utf8tob64u; -exports.b64utoutf8 = b64utoutf8; -exports.utf8tob64 = utf8tob64; -exports.b64toutf8 = b64toutf8; -exports.utf8tohex = utf8tohex; -exports.hextoutf8 = hextoutf8; -exports.hextorstr = hextorstr; -exports.rstrtohex = rstrtohex; -exports.hextob64 = hextob64; -exports.hextob64nl = hextob64nl; -exports.b64nltohex = b64nltohex; -exports.hextopem = hextopem; -exports.pemtohex = pemtohex; -exports.hextoArrayBuffer = hextoArrayBuffer; -exports.ArrayBuffertohex = ArrayBuffertohex; -exports.zulutomsec = zulutomsec; -exports.zulutosec = zulutosec; -exports.zulutodate = zulutodate; -exports.datetozulu = datetozulu; -exports.uricmptohex = uricmptohex; -exports.hextouricmp = hextouricmp; -exports.encodeURIComponentAll = encodeURIComponentAll; -exports.newline_toUnix = newline_toUnix; -exports.newline_toDos = newline_toDos; -exports.hextoposhex = hextoposhex; -exports.intarystrtohex = intarystrtohex; -exports.strdiffidx = strdiffidx; - -// name spaces -exports.KJUR = KJUR; -exports.crypto = KJUR.crypto; -exports.asn1 = KJUR.asn1; -exports.jws = KJUR.jws; -exports.lang = KJUR.lang; - - - - -/***/ }), -/* 110 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -var OpenElementStack = __webpack_require__(51), - Tokenizer = __webpack_require__(19), - HTML = __webpack_require__(11); - - -//Aliases -var $ = HTML.TAG_NAMES; - -exports.assign = function (parser) { - //NOTE: obtain Parser proto this way to avoid module circular references - var parserProto = Object.getPrototypeOf(parser), - treeAdapter = parser.treeAdapter, - attachableElementLocation = null, - lastFosterParentingLocation = null, - currentToken = null; - - function setEndLocation(element, closingToken) { - var loc = element.__location; - - if (!loc) - return; - - if (!loc.startTag) { - loc.startTag = { - line: loc.line, - col: loc.col, - startOffset: loc.startOffset, - endOffset: loc.endOffset - }; - - if (loc.attrs) - loc.startTag.attrs = loc.attrs; - } - - if (closingToken.location) { - var ctLocation = closingToken.location, - tn = treeAdapter.getTagName(element), - // NOTE: For cases like - First 'p' closes without a closing tag and - // for cases like - 'p' closes without a closing tag - isClosingEndTag = closingToken.type === Tokenizer.END_TAG_TOKEN && - tn === closingToken.tagName; - - if (isClosingEndTag) { - loc.endTag = { - line: ctLocation.line, - col: ctLocation.col, - startOffset: ctLocation.startOffset, - endOffset: ctLocation.endOffset - }; - } - - if (isClosingEndTag) - loc.endOffset = ctLocation.endOffset; - else - loc.endOffset = ctLocation.startOffset; - } - - else if (closingToken.type === Tokenizer.EOF_TOKEN) - loc.endOffset = parser.tokenizer.preprocessor.sourcePos; - } - - //NOTE: patch _bootstrap method - parser._bootstrap = function (document, fragmentContext) { - parserProto._bootstrap.call(this, document, fragmentContext); - - attachableElementLocation = null; - lastFosterParentingLocation = null; - currentToken = null; - - //OpenElementStack - parser.openElements.pop = function () { - setEndLocation(this.current, currentToken); - OpenElementStack.prototype.pop.call(this); - }; - - parser.openElements.popAllUpToHtmlElement = function () { - for (var i = this.stackTop; i > 0; i--) - setEndLocation(this.items[i], currentToken); - - OpenElementStack.prototype.popAllUpToHtmlElement.call(this); - }; - - parser.openElements.remove = function (element) { - setEndLocation(element, currentToken); - OpenElementStack.prototype.remove.call(this, element); - }; - }; - - parser._runParsingLoop = function (scriptHandler) { - parserProto._runParsingLoop.call(this, scriptHandler); - - // NOTE: generate location info for elements - // that remains on open element stack - for (var i = parser.openElements.stackTop; i >= 0; i--) - setEndLocation(parser.openElements.items[i], currentToken); - }; - - - //Token processing - parser._processTokenInForeignContent = function (token) { - currentToken = token; - parserProto._processTokenInForeignContent.call(this, token); - }; - - parser._processToken = function (token) { - currentToken = token; - parserProto._processToken.call(this, token); - - //NOTE: and are never popped from the stack, so we need to updated - //their end location explicitly. - if (token.type === Tokenizer.END_TAG_TOKEN && - (token.tagName === $.HTML || - token.tagName === $.BODY && this.openElements.hasInScope($.BODY))) { - for (var i = this.openElements.stackTop; i >= 0; i--) { - var element = this.openElements.items[i]; - - if (this.treeAdapter.getTagName(element) === token.tagName) { - setEndLocation(element, token); - break; - } - } - } - }; - - - //Doctype - parser._setDocumentType = function (token) { - parserProto._setDocumentType.call(this, token); - - var documentChildren = this.treeAdapter.getChildNodes(this.document), - cnLength = documentChildren.length; - - for (var i = 0; i < cnLength; i++) { - var node = documentChildren[i]; - - if (this.treeAdapter.isDocumentTypeNode(node)) { - node.__location = token.location; - break; - } - } - }; - - - //Elements - parser._attachElementToTree = function (element) { - //NOTE: _attachElementToTree is called from _appendElement, _insertElement and _insertTemplate methods. - //So we will use token location stored in this methods for the element. - element.__location = attachableElementLocation || null; - attachableElementLocation = null; - parserProto._attachElementToTree.call(this, element); - }; - - parser._appendElement = function (token, namespaceURI) { - attachableElementLocation = token.location; - parserProto._appendElement.call(this, token, namespaceURI); - }; - - parser._insertElement = function (token, namespaceURI) { - attachableElementLocation = token.location; - parserProto._insertElement.call(this, token, namespaceURI); - }; - - parser._insertTemplate = function (token) { - attachableElementLocation = token.location; - parserProto._insertTemplate.call(this, token); - - var tmplContent = this.treeAdapter.getTemplateContent(this.openElements.current); - - tmplContent.__location = null; - }; - - parser._insertFakeRootElement = function () { - parserProto._insertFakeRootElement.call(this); - this.openElements.current.__location = null; - }; - - - //Comments - parser._appendCommentNode = function (token, parent) { - parserProto._appendCommentNode.call(this, token, parent); - - var children = this.treeAdapter.getChildNodes(parent), - commentNode = children[children.length - 1]; - - commentNode.__location = token.location; - }; - - - //Text - parser._findFosterParentingLocation = function () { - //NOTE: store last foster parenting location, so we will be able to find inserted text - //in case of foster parenting - lastFosterParentingLocation = parserProto._findFosterParentingLocation.call(this); - return lastFosterParentingLocation; - }; - - parser._insertCharacters = function (token) { - parserProto._insertCharacters.call(this, token); - - var hasFosterParent = this._shouldFosterParentOnInsertion(), - parent = hasFosterParent && lastFosterParentingLocation.parent || - this.openElements.currentTmplContent || - this.openElements.current, - siblings = this.treeAdapter.getChildNodes(parent), - textNodeIdx = hasFosterParent && lastFosterParentingLocation.beforeElement ? - siblings.indexOf(lastFosterParentingLocation.beforeElement) - 1 : - siblings.length - 1, - textNode = siblings[textNodeIdx]; - - //NOTE: if we have location assigned by another token, then just update end position - if (textNode.__location) - textNode.__location.endOffset = token.location.endOffset; - - else - textNode.__location = token.location; - }; -}; - - - -/***/ }), -/* 111 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -var UNICODE = __webpack_require__(18); - -//Aliases -var $ = UNICODE.CODE_POINTS; - - -exports.assign = function (tokenizer) { - //NOTE: obtain Tokenizer proto this way to avoid module circular references - var tokenizerProto = Object.getPrototypeOf(tokenizer), - tokenStartOffset = -1, - tokenCol = -1, - tokenLine = 1, - isEol = false, - lineStartPos = 0, - col = -1, - line = 1; - - function attachLocationInfo(token) { - token.location = { - line: tokenLine, - col: tokenCol, - startOffset: tokenStartOffset, - endOffset: -1 - }; - } - - //NOTE: patch consumption method to track line/col information - tokenizer._consume = function () { - var cp = tokenizerProto._consume.call(this); - - //NOTE: LF should be in the last column of the line - if (isEol) { - isEol = false; - line++; - lineStartPos = this.preprocessor.sourcePos; - } - - if (cp === $.LINE_FEED) - isEol = true; - - col = this.preprocessor.sourcePos - lineStartPos + 1; - - return cp; - }; - - tokenizer._unconsume = function () { - tokenizerProto._unconsume.call(this); - isEol = false; - - col = this.preprocessor.sourcePos - lineStartPos + 1; - }; - - //NOTE: patch token creation methods and attach location objects - tokenizer._createStartTagToken = function () { - tokenizerProto._createStartTagToken.call(this); - attachLocationInfo(this.currentToken); - }; - - tokenizer._createEndTagToken = function () { - tokenizerProto._createEndTagToken.call(this); - attachLocationInfo(this.currentToken); - }; - - tokenizer._createCommentToken = function () { - tokenizerProto._createCommentToken.call(this); - attachLocationInfo(this.currentToken); - }; - - tokenizer._createDoctypeToken = function (initialName) { - tokenizerProto._createDoctypeToken.call(this, initialName); - attachLocationInfo(this.currentToken); - }; - - tokenizer._createCharacterToken = function (type, ch) { - tokenizerProto._createCharacterToken.call(this, type, ch); - attachLocationInfo(this.currentCharacterToken); - }; - - tokenizer._createAttr = function (attrNameFirstCh) { - tokenizerProto._createAttr.call(this, attrNameFirstCh); - this.currentAttrLocation = { - line: line, - col: col, - startOffset: this.preprocessor.sourcePos, - endOffset: -1 - }; - }; - - tokenizer._leaveAttrName = function (toState) { - tokenizerProto._leaveAttrName.call(this, toState); - this._attachCurrentAttrLocationInfo(); - }; - - tokenizer._leaveAttrValue = function (toState) { - tokenizerProto._leaveAttrValue.call(this, toState); - this._attachCurrentAttrLocationInfo(); - }; - - tokenizer._attachCurrentAttrLocationInfo = function () { - this.currentAttrLocation.endOffset = this.preprocessor.sourcePos; - - if (!this.currentToken.location.attrs) - this.currentToken.location.attrs = Object.create(null); - - this.currentToken.location.attrs[this.currentAttr.name] = this.currentAttrLocation; - }; - - //NOTE: patch token emission methods to determine end location - tokenizer._emitCurrentToken = function () { - //NOTE: if we have pending character token make it's end location equal to the - //current token's start location. - if (this.currentCharacterToken) - this.currentCharacterToken.location.endOffset = this.currentToken.location.startOffset; - - this.currentToken.location.endOffset = this.preprocessor.sourcePos + 1; - tokenizerProto._emitCurrentToken.call(this); - }; - - tokenizer._emitCurrentCharacterToken = function () { - //NOTE: if we have character token and it's location wasn't set in the _emitCurrentToken(), - //then set it's location at the current preprocessor position. - //We don't need to increment preprocessor position, since character token - //emission is always forced by the start of the next character token here. - //So, we already have advanced position. - if (this.currentCharacterToken && this.currentCharacterToken.location.endOffset === -1) - this.currentCharacterToken.location.endOffset = this.preprocessor.sourcePos; - - tokenizerProto._emitCurrentCharacterToken.call(this); - }; - - //NOTE: patch initial states for each mode to obtain token start position - Object.keys(tokenizerProto.MODE) - - .map(function (modeName) { - return tokenizerProto.MODE[modeName]; - }) - - .forEach(function (state) { - tokenizer[state] = function (cp) { - tokenStartOffset = this.preprocessor.sourcePos; - tokenLine = line; - tokenCol = col; - tokenizerProto[state].call(this, cp); - }; - }); -}; - - -/***/ }), -/* 112 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -//Const -var NOAH_ARK_CAPACITY = 3; - -//List of formatting elements -var FormattingElementList = module.exports = function (treeAdapter) { - this.length = 0; - this.entries = []; - this.treeAdapter = treeAdapter; - this.bookmark = null; -}; - -//Entry types -FormattingElementList.MARKER_ENTRY = 'MARKER_ENTRY'; -FormattingElementList.ELEMENT_ENTRY = 'ELEMENT_ENTRY'; - -//Noah Ark's condition -//OPTIMIZATION: at first we try to find possible candidates for exclusion using -//lightweight heuristics without thorough attributes check. -FormattingElementList.prototype._getNoahArkConditionCandidates = function (newElement) { - var candidates = []; - - if (this.length >= NOAH_ARK_CAPACITY) { - var neAttrsLength = this.treeAdapter.getAttrList(newElement).length, - neTagName = this.treeAdapter.getTagName(newElement), - neNamespaceURI = this.treeAdapter.getNamespaceURI(newElement); - - for (var i = this.length - 1; i >= 0; i--) { - var entry = this.entries[i]; - - if (entry.type === FormattingElementList.MARKER_ENTRY) - break; - - var element = entry.element, - elementAttrs = this.treeAdapter.getAttrList(element), - isCandidate = this.treeAdapter.getTagName(element) === neTagName && - this.treeAdapter.getNamespaceURI(element) === neNamespaceURI && - elementAttrs.length === neAttrsLength; - - if (isCandidate) - candidates.push({idx: i, attrs: elementAttrs}); - } - } - - return candidates.length < NOAH_ARK_CAPACITY ? [] : candidates; -}; - -FormattingElementList.prototype._ensureNoahArkCondition = function (newElement) { - var candidates = this._getNoahArkConditionCandidates(newElement), - cLength = candidates.length; - - if (cLength) { - var neAttrs = this.treeAdapter.getAttrList(newElement), - neAttrsLength = neAttrs.length, - neAttrsMap = Object.create(null); - - //NOTE: build attrs map for the new element so we can perform fast lookups - for (var i = 0; i < neAttrsLength; i++) { - var neAttr = neAttrs[i]; - - neAttrsMap[neAttr.name] = neAttr.value; - } - - for (i = 0; i < neAttrsLength; i++) { - for (var j = 0; j < cLength; j++) { - var cAttr = candidates[j].attrs[i]; - - if (neAttrsMap[cAttr.name] !== cAttr.value) { - candidates.splice(j, 1); - cLength--; - } - - if (candidates.length < NOAH_ARK_CAPACITY) - return; - } - } - - //NOTE: remove bottommost candidates until Noah's Ark condition will not be met - for (i = cLength - 1; i >= NOAH_ARK_CAPACITY - 1; i--) { - this.entries.splice(candidates[i].idx, 1); - this.length--; - } - } -}; - -//Mutations -FormattingElementList.prototype.insertMarker = function () { - this.entries.push({type: FormattingElementList.MARKER_ENTRY}); - this.length++; -}; - -FormattingElementList.prototype.pushElement = function (element, token) { - this._ensureNoahArkCondition(element); - - this.entries.push({ - type: FormattingElementList.ELEMENT_ENTRY, - element: element, - token: token - }); - - this.length++; -}; - -FormattingElementList.prototype.insertElementAfterBookmark = function (element, token) { - var bookmarkIdx = this.length - 1; - - for (; bookmarkIdx >= 0; bookmarkIdx--) { - if (this.entries[bookmarkIdx] === this.bookmark) - break; - } - - this.entries.splice(bookmarkIdx + 1, 0, { - type: FormattingElementList.ELEMENT_ENTRY, - element: element, - token: token - }); - - this.length++; -}; - -FormattingElementList.prototype.removeEntry = function (entry) { - for (var i = this.length - 1; i >= 0; i--) { - if (this.entries[i] === entry) { - this.entries.splice(i, 1); - this.length--; - break; - } - } -}; - -FormattingElementList.prototype.clearToLastMarker = function () { - while (this.length) { - var entry = this.entries.pop(); - - this.length--; - - if (entry.type === FormattingElementList.MARKER_ENTRY) - break; - } -}; - -//Search -FormattingElementList.prototype.getElementEntryInScopeWithTagName = function (tagName) { - for (var i = this.length - 1; i >= 0; i--) { - var entry = this.entries[i]; - - if (entry.type === FormattingElementList.MARKER_ENTRY) - return null; - - if (this.treeAdapter.getTagName(entry.element) === tagName) - return entry; - } - - return null; -}; - -FormattingElementList.prototype.getElementEntry = function (element) { - for (var i = this.length - 1; i >= 0; i--) { - var entry = this.entries[i]; - - if (entry.type === FormattingElementList.ELEMENT_ENTRY && entry.element === element) - return entry; - } - - return null; -}; - - -/***/ }), -/* 113 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -var ParserStream = __webpack_require__(52), - inherits = __webpack_require__(24).inherits, - $ = __webpack_require__(11).TAG_NAMES; - -var PlainTextConversionStream = module.exports = function (options) { - ParserStream.call(this, options); - - // NOTE: see https://html.spec.whatwg.org/#read-text - this.parser._insertFakeElement($.HTML); - this.parser._insertFakeElement($.HEAD); - this.parser.openElements.pop(); - this.parser._insertFakeElement($.BODY); - this.parser._insertFakeElement($.PRE); - this.parser.treeAdapter.insertText(this.parser.openElements.current, '\n'); - this.parser.switchToPlaintextParsing(); -}; - -inherits(PlainTextConversionStream, ParserStream); - - -/***/ }), -/* 114 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -var WritableStream = __webpack_require__(31).Writable, - util = __webpack_require__(24); - -var DevNullStream = module.exports = function () { - WritableStream.call(this); -}; - -util.inherits(DevNullStream, WritableStream); - -DevNullStream.prototype._write = function (chunk, encoding, cb) { - cb(); -}; - - -/***/ }), -/* 115 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -var TransformStream = __webpack_require__(31).Transform, - DevNullStream = __webpack_require__(114), - inherits = __webpack_require__(24).inherits, - Tokenizer = __webpack_require__(19), - ParserFeedbackSimulator = __webpack_require__(116), - mergeOptions = __webpack_require__(34); - -var DEFAULT_OPTIONS = { - locationInfo: false -}; - -var SAXParser = module.exports = function (options) { - TransformStream.call(this); - - this.options = mergeOptions(DEFAULT_OPTIONS, options); - - this.tokenizer = new Tokenizer(options); - this.parserFeedbackSimulator = new ParserFeedbackSimulator(this.tokenizer); - - this.pendingText = null; - this.currentTokenLocation = void 0; - - this.lastChunkWritten = false; - this.stopped = false; - - // NOTE: always pipe stream to the /dev/null stream to avoid - // `highWaterMark` hit even if we don't have consumers. - // (see: https://github.com/inikulin/parse5/issues/97#issuecomment-171940774) - this.pipe(new DevNullStream()); -}; - -inherits(SAXParser, TransformStream); - -//TransformStream implementation -SAXParser.prototype._transform = function (chunk, encoding, callback) { - if (!this.stopped) { - this.tokenizer.write(chunk.toString('utf8'), this.lastChunkWritten); - this._runParsingLoop(); - } - - this.push(chunk); - - callback(); -}; - -SAXParser.prototype._flush = function (callback) { - callback(); -}; - -SAXParser.prototype.end = function (chunk, encoding, callback) { - this.lastChunkWritten = true; - TransformStream.prototype.end.call(this, chunk, encoding, callback); -}; - -SAXParser.prototype.stop = function () { - this.stopped = true; -}; - -//Internals -SAXParser.prototype._runParsingLoop = function () { - do { - var token = this.parserFeedbackSimulator.getNextToken(); - - if (token.type === Tokenizer.HIBERNATION_TOKEN) - break; - - if (token.type === Tokenizer.CHARACTER_TOKEN || - token.type === Tokenizer.WHITESPACE_CHARACTER_TOKEN || - token.type === Tokenizer.NULL_CHARACTER_TOKEN) { - - if (this.options.locationInfo) { - if (this.pendingText === null) - this.currentTokenLocation = token.location; - - else - this.currentTokenLocation.endOffset = token.location.endOffset; - } - - this.pendingText = (this.pendingText || '') + token.chars; - } - - else { - this._emitPendingText(); - this._handleToken(token); - } - } while (!this.stopped && token.type !== Tokenizer.EOF_TOKEN); -}; - -SAXParser.prototype._handleToken = function (token) { - if (this.options.locationInfo) - this.currentTokenLocation = token.location; - - if (token.type === Tokenizer.START_TAG_TOKEN) - this.emit('startTag', token.tagName, token.attrs, token.selfClosing, this.currentTokenLocation); - - else if (token.type === Tokenizer.END_TAG_TOKEN) - this.emit('endTag', token.tagName, this.currentTokenLocation); - - else if (token.type === Tokenizer.COMMENT_TOKEN) - this.emit('comment', token.data, this.currentTokenLocation); - - else if (token.type === Tokenizer.DOCTYPE_TOKEN) - this.emit('doctype', token.name, token.publicId, token.systemId, this.currentTokenLocation); -}; - -SAXParser.prototype._emitPendingText = function () { - if (this.pendingText !== null) { - this.emit('text', this.pendingText, this.currentTokenLocation); - this.pendingText = null; - } -}; - - -/***/ }), -/* 116 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -var Tokenizer = __webpack_require__(19), - foreignContent = __webpack_require__(49), - UNICODE = __webpack_require__(18), - HTML = __webpack_require__(11); - - -//Aliases -var $ = HTML.TAG_NAMES, - NS = HTML.NAMESPACES; - - -//ParserFeedbackSimulator -//Simulates adjustment of the Tokenizer which performed by standard parser during tree construction. -var ParserFeedbackSimulator = module.exports = function (tokenizer) { - this.tokenizer = tokenizer; - - this.namespaceStack = []; - this.namespaceStackTop = -1; - this._enterNamespace(NS.HTML); -}; - -ParserFeedbackSimulator.prototype.getNextToken = function () { - var token = this.tokenizer.getNextToken(); - - if (token.type === Tokenizer.START_TAG_TOKEN) - this._handleStartTagToken(token); - - else if (token.type === Tokenizer.END_TAG_TOKEN) - this._handleEndTagToken(token); - - else if (token.type === Tokenizer.NULL_CHARACTER_TOKEN && this.inForeignContent) { - token.type = Tokenizer.CHARACTER_TOKEN; - token.chars = UNICODE.REPLACEMENT_CHARACTER; - } - - else if (this.skipNextNewLine) { - if (token.type !== Tokenizer.HIBERNATION_TOKEN) - this.skipNextNewLine = false; - - if (token.type === Tokenizer.WHITESPACE_CHARACTER_TOKEN && token.chars[0] === '\n') { - if (token.chars.length === 1) - return this.getNextToken(); - - token.chars = token.chars.substr(1); - } - } - - return token; -}; - -//Namespace stack mutations -ParserFeedbackSimulator.prototype._enterNamespace = function (namespace) { - this.namespaceStackTop++; - this.namespaceStack.push(namespace); - - this.inForeignContent = namespace !== NS.HTML; - this.currentNamespace = namespace; - this.tokenizer.allowCDATA = this.inForeignContent; -}; - -ParserFeedbackSimulator.prototype._leaveCurrentNamespace = function () { - this.namespaceStackTop--; - this.namespaceStack.pop(); - - this.currentNamespace = this.namespaceStack[this.namespaceStackTop]; - this.inForeignContent = this.currentNamespace !== NS.HTML; - this.tokenizer.allowCDATA = this.inForeignContent; -}; - -//Token handlers -ParserFeedbackSimulator.prototype._ensureTokenizerMode = function (tn) { - if (tn === $.TEXTAREA || tn === $.TITLE) - this.tokenizer.state = Tokenizer.MODE.RCDATA; - - else if (tn === $.PLAINTEXT) - this.tokenizer.state = Tokenizer.MODE.PLAINTEXT; - - else if (tn === $.SCRIPT) - this.tokenizer.state = Tokenizer.MODE.SCRIPT_DATA; - - else if (tn === $.STYLE || tn === $.IFRAME || tn === $.XMP || - tn === $.NOEMBED || tn === $.NOFRAMES || tn === $.NOSCRIPT) - this.tokenizer.state = Tokenizer.MODE.RAWTEXT; -}; - -ParserFeedbackSimulator.prototype._handleStartTagToken = function (token) { - var tn = token.tagName; - - if (tn === $.SVG) - this._enterNamespace(NS.SVG); - - else if (tn === $.MATH) - this._enterNamespace(NS.MATHML); - - if (this.inForeignContent) { - if (foreignContent.causesExit(token)) { - this._leaveCurrentNamespace(); - return; - } - - var currentNs = this.currentNamespace; - - if (currentNs === NS.MATHML) - foreignContent.adjustTokenMathMLAttrs(token); - - else if (currentNs === NS.SVG) { - foreignContent.adjustTokenSVGTagName(token); - foreignContent.adjustTokenSVGAttrs(token); - } - - foreignContent.adjustTokenXMLAttrs(token); - - tn = token.tagName; - - if (!token.selfClosing && foreignContent.isIntegrationPoint(tn, currentNs, token.attrs)) - this._enterNamespace(NS.HTML); - } - - else { - if (tn === $.PRE || tn === $.TEXTAREA || tn === $.LISTING) - this.skipNextNewLine = true; - - else if (tn === $.IMAGE) - token.tagName = $.IMG; - - this._ensureTokenizerMode(tn); - } -}; - -ParserFeedbackSimulator.prototype._handleEndTagToken = function (token) { - var tn = token.tagName; - - if (!this.inForeignContent) { - var previousNs = this.namespaceStack[this.namespaceStackTop - 1]; - - if (previousNs === NS.SVG && foreignContent.SVG_TAG_NAMES_ADJUSTMENT_MAP[tn]) - tn = foreignContent.SVG_TAG_NAMES_ADJUSTMENT_MAP[tn]; - - //NOTE: check for exit from integration point - if (foreignContent.isIntegrationPoint(tn, previousNs, token.attrs)) - this._leaveCurrentNamespace(); - } - - else if (tn === $.SVG && this.currentNamespace === NS.SVG || - tn === $.MATH && this.currentNamespace === NS.MATHML) - this._leaveCurrentNamespace(); - - // NOTE: adjust end tag name as well for consistency - if (this.currentNamespace === NS.SVG) - foreignContent.adjustTokenSVGTagName(token); -}; - - -/***/ }), -/* 117 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -var ReadableStream = __webpack_require__(31).Readable, - inherits = __webpack_require__(24).inherits, - Serializer = __webpack_require__(53); - -var SerializerStream = module.exports = function (node, options) { - ReadableStream.call(this); - - this.serializer = new Serializer(node, options); - - Object.defineProperty(this.serializer, 'html', { - //NOTE: To make `+=` concat operator work properly we define - //getter which always returns empty string - get: function () { - return ''; - }, - set: this.push.bind(this) - }); -}; - -inherits(SerializerStream, ReadableStream); - -//Readable stream implementation -SerializerStream.prototype._read = function () { - this.serializer.serialize(); - this.push(null); -}; - - -/***/ }), -/* 118 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -//NOTE: this file contains auto-generated array mapped radix tree that is used for the named entity references consumption -//(details: https://github.com/inikulin/parse5/tree/master/scripts/generate_named_entity_data/README.md) -module.exports = new Uint16Array([4,52,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,106,303,412,810,1432,1701,1796,1987,2114,2360,2420,2484,3170,3251,4140,4393,4575,4610,5106,5512,5728,6117,6274,6315,6345,6427,6516,7002,7910,8733,9323,9870,10170,10631,10893,11318,11386,11467,12773,13092,14474,14922,15448,15542,16419,17666,18166,18611,19004,19095,19298,19397,4,16,69,77,97,98,99,102,103,108,109,110,111,112,114,115,116,117,140,150,158,169,176,194,199,210,216,222,226,242,256,266,283,294,108,105,103,5,198,1,59,148,1,198,80,5,38,1,59,156,1,38,99,117,116,101,5,193,1,59,167,1,193,114,101,118,101,59,1,258,4,2,105,121,182,191,114,99,5,194,1,59,189,1,194,59,1,1040,114,59,3,55349,56580,114,97,118,101,5,192,1,59,208,1,192,112,104,97,59,1,913,97,99,114,59,1,256,100,59,1,10835,4,2,103,112,232,237,111,110,59,1,260,102,59,3,55349,56632,112,108,121,70,117,110,99,116,105,111,110,59,1,8289,105,110,103,5,197,1,59,264,1,197,4,2,99,115,272,277,114,59,3,55349,56476,105,103,110,59,1,8788,105,108,100,101,5,195,1,59,292,1,195,109,108,5,196,1,59,301,1,196,4,8,97,99,101,102,111,114,115,117,321,350,354,383,388,394,400,405,4,2,99,114,327,336,107,115,108,97,115,104,59,1,8726,4,2,118,119,342,345,59,1,10983,101,100,59,1,8966,121,59,1,1041,4,3,99,114,116,362,369,379,97,117,115,101,59,1,8757,110,111,117,108,108,105,115,59,1,8492,97,59,1,914,114,59,3,55349,56581,112,102,59,3,55349,56633,101,118,101,59,1,728,99,114,59,1,8492,109,112,101,113,59,1,8782,4,14,72,79,97,99,100,101,102,104,105,108,111,114,115,117,442,447,456,504,542,547,569,573,577,616,678,784,790,796,99,121,59,1,1063,80,89,5,169,1,59,454,1,169,4,3,99,112,121,464,470,497,117,116,101,59,1,262,4,2,59,105,476,478,1,8914,116,97,108,68,105,102,102,101,114,101,110,116,105,97,108,68,59,1,8517,108,101,121,115,59,1,8493,4,4,97,101,105,111,514,520,530,535,114,111,110,59,1,268,100,105,108,5,199,1,59,528,1,199,114,99,59,1,264,110,105,110,116,59,1,8752,111,116,59,1,266,4,2,100,110,553,560,105,108,108,97,59,1,184,116,101,114,68,111,116,59,1,183,114,59,1,8493,105,59,1,935,114,99,108,101,4,4,68,77,80,84,591,596,603,609,111,116,59,1,8857,105,110,117,115,59,1,8854,108,117,115,59,1,8853,105,109,101,115,59,1,8855,111,4,2,99,115,623,646,107,119,105,115,101,67,111,110,116,111,117,114,73,110,116,101,103,114,97,108,59,1,8754,101,67,117,114,108,121,4,2,68,81,658,671,111,117,98,108,101,81,117,111,116,101,59,1,8221,117,111,116,101,59,1,8217,4,4,108,110,112,117,688,701,736,753,111,110,4,2,59,101,696,698,1,8759,59,1,10868,4,3,103,105,116,709,717,722,114,117,101,110,116,59,1,8801,110,116,59,1,8751,111,117,114,73,110,116,101,103,114,97,108,59,1,8750,4,2,102,114,742,745,59,1,8450,111,100,117,99,116,59,1,8720,110,116,101,114,67,108,111,99,107,119,105,115,101,67,111,110,116,111,117,114,73,110,116,101,103,114,97,108,59,1,8755,111,115,115,59,1,10799,99,114,59,3,55349,56478,112,4,2,59,67,803,805,1,8915,97,112,59,1,8781,4,11,68,74,83,90,97,99,101,102,105,111,115,834,850,855,860,865,888,903,916,921,1011,1415,4,2,59,111,840,842,1,8517,116,114,97,104,100,59,1,10513,99,121,59,1,1026,99,121,59,1,1029,99,121,59,1,1039,4,3,103,114,115,873,879,883,103,101,114,59,1,8225,114,59,1,8609,104,118,59,1,10980,4,2,97,121,894,900,114,111,110,59,1,270,59,1,1044,108,4,2,59,116,910,912,1,8711,97,59,1,916,114,59,3,55349,56583,4,2,97,102,927,998,4,2,99,109,933,992,114,105,116,105,99,97,108,4,4,65,68,71,84,950,957,978,985,99,117,116,101,59,1,180,111,4,2,116,117,964,967,59,1,729,98,108,101,65,99,117,116,101,59,1,733,114,97,118,101,59,1,96,105,108,100,101,59,1,732,111,110,100,59,1,8900,102,101,114,101,110,116,105,97,108,68,59,1,8518,4,4,112,116,117,119,1021,1026,1048,1249,102,59,3,55349,56635,4,3,59,68,69,1034,1036,1041,1,168,111,116,59,1,8412,113,117,97,108,59,1,8784,98,108,101,4,6,67,68,76,82,85,86,1065,1082,1101,1189,1211,1236,111,110,116,111,117,114,73,110,116,101,103,114,97,108,59,1,8751,111,4,2,116,119,1089,1092,59,1,168,110,65,114,114,111,119,59,1,8659,4,2,101,111,1107,1141,102,116,4,3,65,82,84,1117,1124,1136,114,114,111,119,59,1,8656,105,103,104,116,65,114,114,111,119,59,1,8660,101,101,59,1,10980,110,103,4,2,76,82,1149,1177,101,102,116,4,2,65,82,1158,1165,114,114,111,119,59,1,10232,105,103,104,116,65,114,114,111,119,59,1,10234,105,103,104,116,65,114,114,111,119,59,1,10233,105,103,104,116,4,2,65,84,1199,1206,114,114,111,119,59,1,8658,101,101,59,1,8872,112,4,2,65,68,1218,1225,114,114,111,119,59,1,8657,111,119,110,65,114,114,111,119,59,1,8661,101,114,116,105,99,97,108,66,97,114,59,1,8741,110,4,6,65,66,76,82,84,97,1264,1292,1299,1352,1391,1408,114,114,111,119,4,3,59,66,85,1276,1278,1283,1,8595,97,114,59,1,10515,112,65,114,114,111,119,59,1,8693,114,101,118,101,59,1,785,101,102,116,4,3,82,84,86,1310,1323,1334,105,103,104,116,86,101,99,116,111,114,59,1,10576,101,101,86,101,99,116,111,114,59,1,10590,101,99,116,111,114,4,2,59,66,1345,1347,1,8637,97,114,59,1,10582,105,103,104,116,4,2,84,86,1362,1373,101,101,86,101,99,116,111,114,59,1,10591,101,99,116,111,114,4,2,59,66,1384,1386,1,8641,97,114,59,1,10583,101,101,4,2,59,65,1399,1401,1,8868,114,114,111,119,59,1,8615,114,114,111,119,59,1,8659,4,2,99,116,1421,1426,114,59,3,55349,56479,114,111,107,59,1,272,4,16,78,84,97,99,100,102,103,108,109,111,112,113,115,116,117,120,1466,1470,1478,1489,1515,1520,1525,1536,1544,1593,1609,1617,1650,1664,1668,1677,71,59,1,330,72,5,208,1,59,1476,1,208,99,117,116,101,5,201,1,59,1487,1,201,4,3,97,105,121,1497,1503,1512,114,111,110,59,1,282,114,99,5,202,1,59,1510,1,202,59,1,1069,111,116,59,1,278,114,59,3,55349,56584,114,97,118,101,5,200,1,59,1534,1,200,101,109,101,110,116,59,1,8712,4,2,97,112,1550,1555,99,114,59,1,274,116,121,4,2,83,86,1563,1576,109,97,108,108,83,113,117,97,114,101,59,1,9723,101,114,121,83,109,97,108,108,83,113,117,97,114,101,59,1,9643,4,2,103,112,1599,1604,111,110,59,1,280,102,59,3,55349,56636,115,105,108,111,110,59,1,917,117,4,2,97,105,1624,1640,108,4,2,59,84,1631,1633,1,10869,105,108,100,101,59,1,8770,108,105,98,114,105,117,109,59,1,8652,4,2,99,105,1656,1660,114,59,1,8496,109,59,1,10867,97,59,1,919,109,108,5,203,1,59,1675,1,203,4,2,105,112,1683,1689,115,116,115,59,1,8707,111,110,101,110,116,105,97,108,69,59,1,8519,4,5,99,102,105,111,115,1713,1717,1722,1762,1791,121,59,1,1060,114,59,3,55349,56585,108,108,101,100,4,2,83,86,1732,1745,109,97,108,108,83,113,117,97,114,101,59,1,9724,101,114,121,83,109,97,108,108,83,113,117,97,114,101,59,1,9642,4,3,112,114,117,1770,1775,1781,102,59,3,55349,56637,65,108,108,59,1,8704,114,105,101,114,116,114,102,59,1,8497,99,114,59,1,8497,4,12,74,84,97,98,99,100,102,103,111,114,115,116,1822,1827,1834,1848,1855,1877,1882,1887,1890,1896,1978,1984,99,121,59,1,1027,5,62,1,59,1832,1,62,109,109,97,4,2,59,100,1843,1845,1,915,59,1,988,114,101,118,101,59,1,286,4,3,101,105,121,1863,1869,1874,100,105,108,59,1,290,114,99,59,1,284,59,1,1043,111,116,59,1,288,114,59,3,55349,56586,59,1,8921,112,102,59,3,55349,56638,101,97,116,101,114,4,6,69,70,71,76,83,84,1915,1933,1944,1953,1959,1971,113,117,97,108,4,2,59,76,1925,1927,1,8805,101,115,115,59,1,8923,117,108,108,69,113,117,97,108,59,1,8807,114,101,97,116,101,114,59,1,10914,101,115,115,59,1,8823,108,97,110,116,69,113,117,97,108,59,1,10878,105,108,100,101,59,1,8819,99,114,59,3,55349,56482,59,1,8811,4,8,65,97,99,102,105,111,115,117,2005,2012,2026,2032,2036,2049,2073,2089,82,68,99,121,59,1,1066,4,2,99,116,2018,2023,101,107,59,1,711,59,1,94,105,114,99,59,1,292,114,59,1,8460,108,98,101,114,116,83,112,97,99,101,59,1,8459,4,2,112,114,2055,2059,102,59,1,8461,105,122,111,110,116,97,108,76,105,110,101,59,1,9472,4,2,99,116,2079,2083,114,59,1,8459,114,111,107,59,1,294,109,112,4,2,68,69,2097,2107,111,119,110,72,117,109,112,59,1,8782,113,117,97,108,59,1,8783,4,14,69,74,79,97,99,100,102,103,109,110,111,115,116,117,2144,2149,2155,2160,2171,2189,2194,2198,2209,2245,2307,2329,2334,2341,99,121,59,1,1045,108,105,103,59,1,306,99,121,59,1,1025,99,117,116,101,5,205,1,59,2169,1,205,4,2,105,121,2177,2186,114,99,5,206,1,59,2184,1,206,59,1,1048,111,116,59,1,304,114,59,1,8465,114,97,118,101,5,204,1,59,2207,1,204,4,3,59,97,112,2217,2219,2238,1,8465,4,2,99,103,2225,2229,114,59,1,298,105,110,97,114,121,73,59,1,8520,108,105,101,115,59,1,8658,4,2,116,118,2251,2281,4,2,59,101,2257,2259,1,8748,4,2,103,114,2265,2271,114,97,108,59,1,8747,115,101,99,116,105,111,110,59,1,8898,105,115,105,98,108,101,4,2,67,84,2293,2300,111,109,109,97,59,1,8291,105,109,101,115,59,1,8290,4,3,103,112,116,2315,2320,2325,111,110,59,1,302,102,59,3,55349,56640,97,59,1,921,99,114,59,1,8464,105,108,100,101,59,1,296,4,2,107,109,2347,2352,99,121,59,1,1030,108,5,207,1,59,2358,1,207,4,5,99,102,111,115,117,2372,2386,2391,2397,2414,4,2,105,121,2378,2383,114,99,59,1,308,59,1,1049,114,59,3,55349,56589,112,102,59,3,55349,56641,4,2,99,101,2403,2408,114,59,3,55349,56485,114,99,121,59,1,1032,107,99,121,59,1,1028,4,7,72,74,97,99,102,111,115,2436,2441,2446,2452,2467,2472,2478,99,121,59,1,1061,99,121,59,1,1036,112,112,97,59,1,922,4,2,101,121,2458,2464,100,105,108,59,1,310,59,1,1050,114,59,3,55349,56590,112,102,59,3,55349,56642,99,114,59,3,55349,56486,4,11,74,84,97,99,101,102,108,109,111,115,116,2508,2513,2520,2562,2585,2981,2986,3004,3011,3146,3167,99,121,59,1,1033,5,60,1,59,2518,1,60,4,5,99,109,110,112,114,2532,2538,2544,2548,2558,117,116,101,59,1,313,98,100,97,59,1,923,103,59,1,10218,108,97,99,101,116,114,102,59,1,8466,114,59,1,8606,4,3,97,101,121,2570,2576,2582,114,111,110,59,1,317,100,105,108,59,1,315,59,1,1051,4,2,102,115,2591,2907,116,4,10,65,67,68,70,82,84,85,86,97,114,2614,2663,2672,2728,2735,2760,2820,2870,2888,2895,4,2,110,114,2620,2633,103,108,101,66,114,97,99,107,101,116,59,1,10216,114,111,119,4,3,59,66,82,2644,2646,2651,1,8592,97,114,59,1,8676,105,103,104,116,65,114,114,111,119,59,1,8646,101,105,108,105,110,103,59,1,8968,111,4,2,117,119,2679,2692,98,108,101,66,114,97,99,107,101,116,59,1,10214,110,4,2,84,86,2699,2710,101,101,86,101,99,116,111,114,59,1,10593,101,99,116,111,114,4,2,59,66,2721,2723,1,8643,97,114,59,1,10585,108,111,111,114,59,1,8970,105,103,104,116,4,2,65,86,2745,2752,114,114,111,119,59,1,8596,101,99,116,111,114,59,1,10574,4,2,101,114,2766,2792,101,4,3,59,65,86,2775,2777,2784,1,8867,114,114,111,119,59,1,8612,101,99,116,111,114,59,1,10586,105,97,110,103,108,101,4,3,59,66,69,2806,2808,2813,1,8882,97,114,59,1,10703,113,117,97,108,59,1,8884,112,4,3,68,84,86,2829,2841,2852,111,119,110,86,101,99,116,111,114,59,1,10577,101,101,86,101,99,116,111,114,59,1,10592,101,99,116,111,114,4,2,59,66,2863,2865,1,8639,97,114,59,1,10584,101,99,116,111,114,4,2,59,66,2881,2883,1,8636,97,114,59,1,10578,114,114,111,119,59,1,8656,105,103,104,116,97,114,114,111,119,59,1,8660,115,4,6,69,70,71,76,83,84,2922,2936,2947,2956,2962,2974,113,117,97,108,71,114,101,97,116,101,114,59,1,8922,117,108,108,69,113,117,97,108,59,1,8806,114,101,97,116,101,114,59,1,8822,101,115,115,59,1,10913,108,97,110,116,69,113,117,97,108,59,1,10877,105,108,100,101,59,1,8818,114,59,3,55349,56591,4,2,59,101,2992,2994,1,8920,102,116,97,114,114,111,119,59,1,8666,105,100,111,116,59,1,319,4,3,110,112,119,3019,3110,3115,103,4,4,76,82,108,114,3030,3058,3070,3098,101,102,116,4,2,65,82,3039,3046,114,114,111,119,59,1,10229,105,103,104,116,65,114,114,111,119,59,1,10231,105,103,104,116,65,114,114,111,119,59,1,10230,101,102,116,4,2,97,114,3079,3086,114,114,111,119,59,1,10232,105,103,104,116,97,114,114,111,119,59,1,10234,105,103,104,116,97,114,114,111,119,59,1,10233,102,59,3,55349,56643,101,114,4,2,76,82,3123,3134,101,102,116,65,114,114,111,119,59,1,8601,105,103,104,116,65,114,114,111,119,59,1,8600,4,3,99,104,116,3154,3158,3161,114,59,1,8466,59,1,8624,114,111,107,59,1,321,59,1,8810,4,8,97,99,101,102,105,111,115,117,3188,3192,3196,3222,3227,3237,3243,3248,112,59,1,10501,121,59,1,1052,4,2,100,108,3202,3213,105,117,109,83,112,97,99,101,59,1,8287,108,105,110,116,114,102,59,1,8499,114,59,3,55349,56592,110,117,115,80,108,117,115,59,1,8723,112,102,59,3,55349,56644,99,114,59,1,8499,59,1,924,4,9,74,97,99,101,102,111,115,116,117,3271,3276,3283,3306,3422,3427,4120,4126,4137,99,121,59,1,1034,99,117,116,101,59,1,323,4,3,97,101,121,3291,3297,3303,114,111,110,59,1,327,100,105,108,59,1,325,59,1,1053,4,3,103,115,119,3314,3380,3415,97,116,105,118,101,4,3,77,84,86,3327,3340,3365,101,100,105,117,109,83,112,97,99,101,59,1,8203,104,105,4,2,99,110,3348,3357,107,83,112,97,99,101,59,1,8203,83,112,97,99,101,59,1,8203,101,114,121,84,104,105,110,83,112,97,99,101,59,1,8203,116,101,100,4,2,71,76,3389,3405,114,101,97,116,101,114,71,114,101,97,116,101,114,59,1,8811,101,115,115,76,101,115,115,59,1,8810,76,105,110,101,59,1,10,114,59,3,55349,56593,4,4,66,110,112,116,3437,3444,3460,3464,114,101,97,107,59,1,8288,66,114,101,97,107,105,110,103,83,112,97,99,101,59,1,160,102,59,1,8469,4,13,59,67,68,69,71,72,76,78,80,82,83,84,86,3492,3494,3517,3536,3578,3657,3685,3784,3823,3860,3915,4066,4107,1,10988,4,2,111,117,3500,3510,110,103,114,117,101,110,116,59,1,8802,112,67,97,112,59,1,8813,111,117,98,108,101,86,101,114,116,105,99,97,108,66,97,114,59,1,8742,4,3,108,113,120,3544,3552,3571,101,109,101,110,116,59,1,8713,117,97,108,4,2,59,84,3561,3563,1,8800,105,108,100,101,59,3,8770,824,105,115,116,115,59,1,8708,114,101,97,116,101,114,4,7,59,69,70,71,76,83,84,3600,3602,3609,3621,3631,3637,3650,1,8815,113,117,97,108,59,1,8817,117,108,108,69,113,117,97,108,59,3,8807,824,114,101,97,116,101,114,59,3,8811,824,101,115,115,59,1,8825,108,97,110,116,69,113,117,97,108,59,3,10878,824,105,108,100,101,59,1,8821,117,109,112,4,2,68,69,3666,3677,111,119,110,72,117,109,112,59,3,8782,824,113,117,97,108,59,3,8783,824,101,4,2,102,115,3692,3724,116,84,114,105,97,110,103,108,101,4,3,59,66,69,3709,3711,3717,1,8938,97,114,59,3,10703,824,113,117,97,108,59,1,8940,115,4,6,59,69,71,76,83,84,3739,3741,3748,3757,3764,3777,1,8814,113,117,97,108,59,1,8816,114,101,97,116,101,114,59,1,8824,101,115,115,59,3,8810,824,108,97,110,116,69,113,117,97,108,59,3,10877,824,105,108,100,101,59,1,8820,101,115,116,101,100,4,2,71,76,3795,3812,114,101,97,116,101,114,71,114,101,97,116,101,114,59,3,10914,824,101,115,115,76,101,115,115,59,3,10913,824,114,101,99,101,100,101,115,4,3,59,69,83,3838,3840,3848,1,8832,113,117,97,108,59,3,10927,824,108,97,110,116,69,113,117,97,108,59,1,8928,4,2,101,105,3866,3881,118,101,114,115,101,69,108,101,109,101,110,116,59,1,8716,103,104,116,84,114,105,97,110,103,108,101,4,3,59,66,69,3900,3902,3908,1,8939,97,114,59,3,10704,824,113,117,97,108,59,1,8941,4,2,113,117,3921,3973,117,97,114,101,83,117,4,2,98,112,3933,3952,115,101,116,4,2,59,69,3942,3945,3,8847,824,113,117,97,108,59,1,8930,101,114,115,101,116,4,2,59,69,3963,3966,3,8848,824,113,117,97,108,59,1,8931,4,3,98,99,112,3981,4000,4045,115,101,116,4,2,59,69,3990,3993,3,8834,8402,113,117,97,108,59,1,8840,99,101,101,100,115,4,4,59,69,83,84,4015,4017,4025,4037,1,8833,113,117,97,108,59,3,10928,824,108,97,110,116,69,113,117,97,108,59,1,8929,105,108,100,101,59,3,8831,824,101,114,115,101,116,4,2,59,69,4056,4059,3,8835,8402,113,117,97,108,59,1,8841,105,108,100,101,4,4,59,69,70,84,4080,4082,4089,4100,1,8769,113,117,97,108,59,1,8772,117,108,108,69,113,117,97,108,59,1,8775,105,108,100,101,59,1,8777,101,114,116,105,99,97,108,66,97,114,59,1,8740,99,114,59,3,55349,56489,105,108,100,101,5,209,1,59,4135,1,209,59,1,925,4,14,69,97,99,100,102,103,109,111,112,114,115,116,117,118,4170,4176,4187,4205,4212,4217,4228,4253,4259,4292,4295,4316,4337,4346,108,105,103,59,1,338,99,117,116,101,5,211,1,59,4185,1,211,4,2,105,121,4193,4202,114,99,5,212,1,59,4200,1,212,59,1,1054,98,108,97,99,59,1,336,114,59,3,55349,56594,114,97,118,101,5,210,1,59,4226,1,210,4,3,97,101,105,4236,4241,4246,99,114,59,1,332,103,97,59,1,937,99,114,111,110,59,1,927,112,102,59,3,55349,56646,101,110,67,117,114,108,121,4,2,68,81,4272,4285,111,117,98,108,101,81,117,111,116,101,59,1,8220,117,111,116,101,59,1,8216,59,1,10836,4,2,99,108,4301,4306,114,59,3,55349,56490,97,115,104,5,216,1,59,4314,1,216,105,4,2,108,109,4323,4332,100,101,5,213,1,59,4330,1,213,101,115,59,1,10807,109,108,5,214,1,59,4344,1,214,101,114,4,2,66,80,4354,4380,4,2,97,114,4360,4364,114,59,1,8254,97,99,4,2,101,107,4372,4375,59,1,9182,101,116,59,1,9140,97,114,101,110,116,104,101,115,105,115,59,1,9180,4,9,97,99,102,104,105,108,111,114,115,4413,4422,4426,4431,4435,4438,4448,4471,4561,114,116,105,97,108,68,59,1,8706,121,59,1,1055,114,59,3,55349,56595,105,59,1,934,59,1,928,117,115,77,105,110,117,115,59,1,177,4,2,105,112,4454,4467,110,99,97,114,101,112,108,97,110,101,59,1,8460,102,59,1,8473,4,4,59,101,105,111,4481,4483,4526,4531,1,10939,99,101,100,101,115,4,4,59,69,83,84,4498,4500,4507,4519,1,8826,113,117,97,108,59,1,10927,108,97,110,116,69,113,117,97,108,59,1,8828,105,108,100,101,59,1,8830,109,101,59,1,8243,4,2,100,112,4537,4543,117,99,116,59,1,8719,111,114,116,105,111,110,4,2,59,97,4555,4557,1,8759,108,59,1,8733,4,2,99,105,4567,4572,114,59,3,55349,56491,59,1,936,4,4,85,102,111,115,4585,4594,4599,4604,79,84,5,34,1,59,4592,1,34,114,59,3,55349,56596,112,102,59,1,8474,99,114,59,3,55349,56492,4,12,66,69,97,99,101,102,104,105,111,114,115,117,4636,4642,4650,4681,4704,4763,4767,4771,5047,5069,5081,5094,97,114,114,59,1,10512,71,5,174,1,59,4648,1,174,4,3,99,110,114,4658,4664,4668,117,116,101,59,1,340,103,59,1,10219,114,4,2,59,116,4675,4677,1,8608,108,59,1,10518,4,3,97,101,121,4689,4695,4701,114,111,110,59,1,344,100,105,108,59,1,342,59,1,1056,4,2,59,118,4710,4712,1,8476,101,114,115,101,4,2,69,85,4722,4748,4,2,108,113,4728,4736,101,109,101,110,116,59,1,8715,117,105,108,105,98,114,105,117,109,59,1,8651,112,69,113,117,105,108,105,98,114,105,117,109,59,1,10607,114,59,1,8476,111,59,1,929,103,104,116,4,8,65,67,68,70,84,85,86,97,4792,4840,4849,4905,4912,4972,5022,5040,4,2,110,114,4798,4811,103,108,101,66,114,97,99,107,101,116,59,1,10217,114,111,119,4,3,59,66,76,4822,4824,4829,1,8594,97,114,59,1,8677,101,102,116,65,114,114,111,119,59,1,8644,101,105,108,105,110,103,59,1,8969,111,4,2,117,119,4856,4869,98,108,101,66,114,97,99,107,101,116,59,1,10215,110,4,2,84,86,4876,4887,101,101,86,101,99,116,111,114,59,1,10589,101,99,116,111,114,4,2,59,66,4898,4900,1,8642,97,114,59,1,10581,108,111,111,114,59,1,8971,4,2,101,114,4918,4944,101,4,3,59,65,86,4927,4929,4936,1,8866,114,114,111,119,59,1,8614,101,99,116,111,114,59,1,10587,105,97,110,103,108,101,4,3,59,66,69,4958,4960,4965,1,8883,97,114,59,1,10704,113,117,97,108,59,1,8885,112,4,3,68,84,86,4981,4993,5004,111,119,110,86,101,99,116,111,114,59,1,10575,101,101,86,101,99,116,111,114,59,1,10588,101,99,116,111,114,4,2,59,66,5015,5017,1,8638,97,114,59,1,10580,101,99,116,111,114,4,2,59,66,5033,5035,1,8640,97,114,59,1,10579,114,114,111,119,59,1,8658,4,2,112,117,5053,5057,102,59,1,8477,110,100,73,109,112,108,105,101,115,59,1,10608,105,103,104,116,97,114,114,111,119,59,1,8667,4,2,99,104,5087,5091,114,59,1,8475,59,1,8625,108,101,68,101,108,97,121,101,100,59,1,10740,4,13,72,79,97,99,102,104,105,109,111,113,115,116,117,5134,5150,5157,5164,5198,5203,5259,5265,5277,5283,5374,5380,5385,4,2,67,99,5140,5146,72,99,121,59,1,1065,121,59,1,1064,70,84,99,121,59,1,1068,99,117,116,101,59,1,346,4,5,59,97,101,105,121,5176,5178,5184,5190,5195,1,10940,114,111,110,59,1,352,100,105,108,59,1,350,114,99,59,1,348,59,1,1057,114,59,3,55349,56598,111,114,116,4,4,68,76,82,85,5216,5227,5238,5250,111,119,110,65,114,114,111,119,59,1,8595,101,102,116,65,114,114,111,119,59,1,8592,105,103,104,116,65,114,114,111,119,59,1,8594,112,65,114,114,111,119,59,1,8593,103,109,97,59,1,931,97,108,108,67,105,114,99,108,101,59,1,8728,112,102,59,3,55349,56650,4,2,114,117,5289,5293,116,59,1,8730,97,114,101,4,4,59,73,83,85,5306,5308,5322,5367,1,9633,110,116,101,114,115,101,99,116,105,111,110,59,1,8851,117,4,2,98,112,5329,5347,115,101,116,4,2,59,69,5338,5340,1,8847,113,117,97,108,59,1,8849,101,114,115,101,116,4,2,59,69,5358,5360,1,8848,113,117,97,108,59,1,8850,110,105,111,110,59,1,8852,99,114,59,3,55349,56494,97,114,59,1,8902,4,4,98,99,109,112,5395,5420,5475,5478,4,2,59,115,5401,5403,1,8912,101,116,4,2,59,69,5411,5413,1,8912,113,117,97,108,59,1,8838,4,2,99,104,5426,5468,101,101,100,115,4,4,59,69,83,84,5440,5442,5449,5461,1,8827,113,117,97,108,59,1,10928,108,97,110,116,69,113,117,97,108,59,1,8829,105,108,100,101,59,1,8831,84,104,97,116,59,1,8715,59,1,8721,4,3,59,101,115,5486,5488,5507,1,8913,114,115,101,116,4,2,59,69,5498,5500,1,8835,113,117,97,108,59,1,8839,101,116,59,1,8913,4,11,72,82,83,97,99,102,104,105,111,114,115,5536,5546,5552,5567,5579,5602,5607,5655,5695,5701,5711,79,82,78,5,222,1,59,5544,1,222,65,68,69,59,1,8482,4,2,72,99,5558,5563,99,121,59,1,1035,121,59,1,1062,4,2,98,117,5573,5576,59,1,9,59,1,932,4,3,97,101,121,5587,5593,5599,114,111,110,59,1,356,100,105,108,59,1,354,59,1,1058,114,59,3,55349,56599,4,2,101,105,5613,5631,4,2,114,116,5619,5627,101,102,111,114,101,59,1,8756,97,59,1,920,4,2,99,110,5637,5647,107,83,112,97,99,101,59,3,8287,8202,83,112,97,99,101,59,1,8201,108,100,101,4,4,59,69,70,84,5668,5670,5677,5688,1,8764,113,117,97,108,59,1,8771,117,108,108,69,113,117,97,108,59,1,8773,105,108,100,101,59,1,8776,112,102,59,3,55349,56651,105,112,108,101,68,111,116,59,1,8411,4,2,99,116,5717,5722,114,59,3,55349,56495,114,111,107,59,1,358,4,14,97,98,99,100,102,103,109,110,111,112,114,115,116,117,5758,5789,5805,5823,5830,5835,5846,5852,5921,5937,6089,6095,6101,6108,4,2,99,114,5764,5774,117,116,101,5,218,1,59,5772,1,218,114,4,2,59,111,5781,5783,1,8607,99,105,114,59,1,10569,114,4,2,99,101,5796,5800,121,59,1,1038,118,101,59,1,364,4,2,105,121,5811,5820,114,99,5,219,1,59,5818,1,219,59,1,1059,98,108,97,99,59,1,368,114,59,3,55349,56600,114,97,118,101,5,217,1,59,5844,1,217,97,99,114,59,1,362,4,2,100,105,5858,5905,101,114,4,2,66,80,5866,5892,4,2,97,114,5872,5876,114,59,1,95,97,99,4,2,101,107,5884,5887,59,1,9183,101,116,59,1,9141,97,114,101,110,116,104,101,115,105,115,59,1,9181,111,110,4,2,59,80,5913,5915,1,8899,108,117,115,59,1,8846,4,2,103,112,5927,5932,111,110,59,1,370,102,59,3,55349,56652,4,8,65,68,69,84,97,100,112,115,5955,5985,5996,6009,6026,6033,6044,6075,114,114,111,119,4,3,59,66,68,5967,5969,5974,1,8593,97,114,59,1,10514,111,119,110,65,114,114,111,119,59,1,8645,111,119,110,65,114,114,111,119,59,1,8597,113,117,105,108,105,98,114,105,117,109,59,1,10606,101,101,4,2,59,65,6017,6019,1,8869,114,114,111,119,59,1,8613,114,114,111,119,59,1,8657,111,119,110,97,114,114,111,119,59,1,8661,101,114,4,2,76,82,6052,6063,101,102,116,65,114,114,111,119,59,1,8598,105,103,104,116,65,114,114,111,119,59,1,8599,105,4,2,59,108,6082,6084,1,978,111,110,59,1,933,105,110,103,59,1,366,99,114,59,3,55349,56496,105,108,100,101,59,1,360,109,108,5,220,1,59,6115,1,220,4,9,68,98,99,100,101,102,111,115,118,6137,6143,6148,6152,6166,6250,6255,6261,6267,97,115,104,59,1,8875,97,114,59,1,10987,121,59,1,1042,97,115,104,4,2,59,108,6161,6163,1,8873,59,1,10982,4,2,101,114,6172,6175,59,1,8897,4,3,98,116,121,6183,6188,6238,97,114,59,1,8214,4,2,59,105,6194,6196,1,8214,99,97,108,4,4,66,76,83,84,6209,6214,6220,6231,97,114,59,1,8739,105,110,101,59,1,124,101,112,97,114,97,116,111,114,59,1,10072,105,108,100,101,59,1,8768,84,104,105,110,83,112,97,99,101,59,1,8202,114,59,3,55349,56601,112,102,59,3,55349,56653,99,114,59,3,55349,56497,100,97,115,104,59,1,8874,4,5,99,101,102,111,115,6286,6292,6298,6303,6309,105,114,99,59,1,372,100,103,101,59,1,8896,114,59,3,55349,56602,112,102,59,3,55349,56654,99,114,59,3,55349,56498,4,4,102,105,111,115,6325,6330,6333,6339,114,59,3,55349,56603,59,1,926,112,102,59,3,55349,56655,99,114,59,3,55349,56499,4,9,65,73,85,97,99,102,111,115,117,6365,6370,6375,6380,6391,6405,6410,6416,6422,99,121,59,1,1071,99,121,59,1,1031,99,121,59,1,1070,99,117,116,101,5,221,1,59,6389,1,221,4,2,105,121,6397,6402,114,99,59,1,374,59,1,1067,114,59,3,55349,56604,112,102,59,3,55349,56656,99,114,59,3,55349,56500,109,108,59,1,376,4,8,72,97,99,100,101,102,111,115,6445,6450,6457,6472,6477,6501,6505,6510,99,121,59,1,1046,99,117,116,101,59,1,377,4,2,97,121,6463,6469,114,111,110,59,1,381,59,1,1047,111,116,59,1,379,4,2,114,116,6483,6497,111,87,105,100,116,104,83,112,97,99,101,59,1,8203,97,59,1,918,114,59,1,8488,112,102,59,1,8484,99,114,59,3,55349,56501,4,16,97,98,99,101,102,103,108,109,110,111,112,114,115,116,117,119,6550,6561,6568,6612,6622,6634,6645,6672,6699,6854,6870,6923,6933,6963,6974,6983,99,117,116,101,5,225,1,59,6559,1,225,114,101,118,101,59,1,259,4,6,59,69,100,105,117,121,6582,6584,6588,6591,6600,6609,1,8766,59,3,8766,819,59,1,8767,114,99,5,226,1,59,6598,1,226,116,101,5,180,1,59,6607,1,180,59,1,1072,108,105,103,5,230,1,59,6620,1,230,4,2,59,114,6628,6630,1,8289,59,3,55349,56606,114,97,118,101,5,224,1,59,6643,1,224,4,2,101,112,6651,6667,4,2,102,112,6657,6663,115,121,109,59,1,8501,104,59,1,8501,104,97,59,1,945,4,2,97,112,6678,6692,4,2,99,108,6684,6688,114,59,1,257,103,59,1,10815,5,38,1,59,6697,1,38,4,2,100,103,6705,6737,4,5,59,97,100,115,118,6717,6719,6724,6727,6734,1,8743,110,100,59,1,10837,59,1,10844,108,111,112,101,59,1,10840,59,1,10842,4,7,59,101,108,109,114,115,122,6753,6755,6758,6762,6814,6835,6848,1,8736,59,1,10660,101,59,1,8736,115,100,4,2,59,97,6770,6772,1,8737,4,8,97,98,99,100,101,102,103,104,6790,6793,6796,6799,6802,6805,6808,6811,59,1,10664,59,1,10665,59,1,10666,59,1,10667,59,1,10668,59,1,10669,59,1,10670,59,1,10671,116,4,2,59,118,6821,6823,1,8735,98,4,2,59,100,6830,6832,1,8894,59,1,10653,4,2,112,116,6841,6845,104,59,1,8738,59,1,197,97,114,114,59,1,9084,4,2,103,112,6860,6865,111,110,59,1,261,102,59,3,55349,56658,4,7,59,69,97,101,105,111,112,6886,6888,6891,6897,6900,6904,6908,1,8776,59,1,10864,99,105,114,59,1,10863,59,1,8778,100,59,1,8779,115,59,1,39,114,111,120,4,2,59,101,6917,6919,1,8776,113,59,1,8778,105,110,103,5,229,1,59,6931,1,229,4,3,99,116,121,6941,6946,6949,114,59,3,55349,56502,59,1,42,109,112,4,2,59,101,6957,6959,1,8776,113,59,1,8781,105,108,100,101,5,227,1,59,6972,1,227,109,108,5,228,1,59,6981,1,228,4,2,99,105,6989,6997,111,110,105,110,116,59,1,8755,110,116,59,1,10769,4,16,78,97,98,99,100,101,102,105,107,108,110,111,112,114,115,117,7036,7041,7119,7135,7149,7155,7219,7224,7347,7354,7463,7489,7786,7793,7814,7866,111,116,59,1,10989,4,2,99,114,7047,7094,107,4,4,99,101,112,115,7058,7064,7073,7080,111,110,103,59,1,8780,112,115,105,108,111,110,59,1,1014,114,105,109,101,59,1,8245,105,109,4,2,59,101,7088,7090,1,8765,113,59,1,8909,4,2,118,119,7100,7105,101,101,59,1,8893,101,100,4,2,59,103,7113,7115,1,8965,101,59,1,8965,114,107,4,2,59,116,7127,7129,1,9141,98,114,107,59,1,9142,4,2,111,121,7141,7146,110,103,59,1,8780,59,1,1073,113,117,111,59,1,8222,4,5,99,109,112,114,116,7167,7181,7188,7193,7199,97,117,115,4,2,59,101,7176,7178,1,8757,59,1,8757,112,116,121,118,59,1,10672,115,105,59,1,1014,110,111,117,59,1,8492,4,3,97,104,119,7207,7210,7213,59,1,946,59,1,8502,101,101,110,59,1,8812,114,59,3,55349,56607,103,4,7,99,111,115,116,117,118,119,7241,7262,7288,7305,7328,7335,7340,4,3,97,105,117,7249,7253,7258,112,59,1,8898,114,99,59,1,9711,112,59,1,8899,4,3,100,112,116,7270,7275,7281,111,116,59,1,10752,108,117,115,59,1,10753,105,109,101,115,59,1,10754,4,2,113,116,7294,7300,99,117,112,59,1,10758,97,114,59,1,9733,114,105,97,110,103,108,101,4,2,100,117,7318,7324,111,119,110,59,1,9661,112,59,1,9651,112,108,117,115,59,1,10756,101,101,59,1,8897,101,100,103,101,59,1,8896,97,114,111,119,59,1,10509,4,3,97,107,111,7362,7436,7458,4,2,99,110,7368,7432,107,4,3,108,115,116,7377,7386,7394,111,122,101,110,103,101,59,1,10731,113,117,97,114,101,59,1,9642,114,105,97,110,103,108,101,4,4,59,100,108,114,7411,7413,7419,7425,1,9652,111,119,110,59,1,9662,101,102,116,59,1,9666,105,103,104,116,59,1,9656,107,59,1,9251,4,2,49,51,7442,7454,4,2,50,52,7448,7451,59,1,9618,59,1,9617,52,59,1,9619,99,107,59,1,9608,4,2,101,111,7469,7485,4,2,59,113,7475,7478,3,61,8421,117,105,118,59,3,8801,8421,116,59,1,8976,4,4,112,116,119,120,7499,7504,7517,7523,102,59,3,55349,56659,4,2,59,116,7510,7512,1,8869,111,109,59,1,8869,116,105,101,59,1,8904,4,12,68,72,85,86,98,100,104,109,112,116,117,118,7549,7571,7597,7619,7655,7660,7682,7708,7715,7721,7728,7750,4,4,76,82,108,114,7559,7562,7565,7568,59,1,9559,59,1,9556,59,1,9558,59,1,9555,4,5,59,68,85,100,117,7583,7585,7588,7591,7594,1,9552,59,1,9574,59,1,9577,59,1,9572,59,1,9575,4,4,76,82,108,114,7607,7610,7613,7616,59,1,9565,59,1,9562,59,1,9564,59,1,9561,4,7,59,72,76,82,104,108,114,7635,7637,7640,7643,7646,7649,7652,1,9553,59,1,9580,59,1,9571,59,1,9568,59,1,9579,59,1,9570,59,1,9567,111,120,59,1,10697,4,4,76,82,108,114,7670,7673,7676,7679,59,1,9557,59,1,9554,59,1,9488,59,1,9484,4,5,59,68,85,100,117,7694,7696,7699,7702,7705,1,9472,59,1,9573,59,1,9576,59,1,9516,59,1,9524,105,110,117,115,59,1,8863,108,117,115,59,1,8862,105,109,101,115,59,1,8864,4,4,76,82,108,114,7738,7741,7744,7747,59,1,9563,59,1,9560,59,1,9496,59,1,9492,4,7,59,72,76,82,104,108,114,7766,7768,7771,7774,7777,7780,7783,1,9474,59,1,9578,59,1,9569,59,1,9566,59,1,9532,59,1,9508,59,1,9500,114,105,109,101,59,1,8245,4,2,101,118,7799,7804,118,101,59,1,728,98,97,114,5,166,1,59,7812,1,166,4,4,99,101,105,111,7824,7829,7834,7846,114,59,3,55349,56503,109,105,59,1,8271,109,4,2,59,101,7841,7843,1,8765,59,1,8909,108,4,3,59,98,104,7855,7857,7860,1,92,59,1,10693,115,117,98,59,1,10184,4,2,108,109,7872,7885,108,4,2,59,101,7879,7881,1,8226,116,59,1,8226,112,4,3,59,69,101,7894,7896,7899,1,8782,59,1,10926,4,2,59,113,7905,7907,1,8783,59,1,8783,4,15,97,99,100,101,102,104,105,108,111,114,115,116,117,119,121,7942,8021,8075,8080,8121,8126,8157,8279,8295,8430,8446,8485,8491,8707,8726,4,3,99,112,114,7950,7956,8007,117,116,101,59,1,263,4,6,59,97,98,99,100,115,7970,7972,7977,7984,7998,8003,1,8745,110,100,59,1,10820,114,99,117,112,59,1,10825,4,2,97,117,7990,7994,112,59,1,10827,112,59,1,10823,111,116,59,1,10816,59,3,8745,65024,4,2,101,111,8013,8017,116,59,1,8257,110,59,1,711,4,4,97,101,105,117,8031,8046,8056,8061,4,2,112,114,8037,8041,115,59,1,10829,111,110,59,1,269,100,105,108,5,231,1,59,8054,1,231,114,99,59,1,265,112,115,4,2,59,115,8069,8071,1,10828,109,59,1,10832,111,116,59,1,267,4,3,100,109,110,8088,8097,8104,105,108,5,184,1,59,8095,1,184,112,116,121,118,59,1,10674,116,5,162,2,59,101,8112,8114,1,162,114,100,111,116,59,1,183,114,59,3,55349,56608,4,3,99,101,105,8134,8138,8154,121,59,1,1095,99,107,4,2,59,109,8146,8148,1,10003,97,114,107,59,1,10003,59,1,967,114,4,7,59,69,99,101,102,109,115,8174,8176,8179,8258,8261,8268,8273,1,9675,59,1,10691,4,3,59,101,108,8187,8189,8193,1,710,113,59,1,8791,101,4,2,97,100,8200,8223,114,114,111,119,4,2,108,114,8210,8216,101,102,116,59,1,8634,105,103,104,116,59,1,8635,4,5,82,83,97,99,100,8235,8238,8241,8246,8252,59,1,174,59,1,9416,115,116,59,1,8859,105,114,99,59,1,8858,97,115,104,59,1,8861,59,1,8791,110,105,110,116,59,1,10768,105,100,59,1,10991,99,105,114,59,1,10690,117,98,115,4,2,59,117,8288,8290,1,9827,105,116,59,1,9827,4,4,108,109,110,112,8305,8326,8376,8400,111,110,4,2,59,101,8313,8315,1,58,4,2,59,113,8321,8323,1,8788,59,1,8788,4,2,109,112,8332,8344,97,4,2,59,116,8339,8341,1,44,59,1,64,4,3,59,102,108,8352,8354,8358,1,8705,110,59,1,8728,101,4,2,109,120,8365,8371,101,110,116,59,1,8705,101,115,59,1,8450,4,2,103,105,8382,8395,4,2,59,100,8388,8390,1,8773,111,116,59,1,10861,110,116,59,1,8750,4,3,102,114,121,8408,8412,8417,59,3,55349,56660,111,100,59,1,8720,5,169,2,59,115,8424,8426,1,169,114,59,1,8471,4,2,97,111,8436,8441,114,114,59,1,8629,115,115,59,1,10007,4,2,99,117,8452,8457,114,59,3,55349,56504,4,2,98,112,8463,8474,4,2,59,101,8469,8471,1,10959,59,1,10961,4,2,59,101,8480,8482,1,10960,59,1,10962,100,111,116,59,1,8943,4,7,100,101,108,112,114,118,119,8507,8522,8536,8550,8600,8697,8702,97,114,114,4,2,108,114,8516,8519,59,1,10552,59,1,10549,4,2,112,115,8528,8532,114,59,1,8926,99,59,1,8927,97,114,114,4,2,59,112,8545,8547,1,8630,59,1,10557,4,6,59,98,99,100,111,115,8564,8566,8573,8587,8592,8596,1,8746,114,99,97,112,59,1,10824,4,2,97,117,8579,8583,112,59,1,10822,112,59,1,10826,111,116,59,1,8845,114,59,1,10821,59,3,8746,65024,4,4,97,108,114,118,8610,8623,8663,8672,114,114,4,2,59,109,8618,8620,1,8631,59,1,10556,121,4,3,101,118,119,8632,8651,8656,113,4,2,112,115,8639,8645,114,101,99,59,1,8926,117,99,99,59,1,8927,101,101,59,1,8910,101,100,103,101,59,1,8911,101,110,5,164,1,59,8670,1,164,101,97,114,114,111,119,4,2,108,114,8684,8690,101,102,116,59,1,8630,105,103,104,116,59,1,8631,101,101,59,1,8910,101,100,59,1,8911,4,2,99,105,8713,8721,111,110,105,110,116,59,1,8754,110,116,59,1,8753,108,99,116,121,59,1,9005,4,19,65,72,97,98,99,100,101,102,104,105,106,108,111,114,115,116,117,119,122,8773,8778,8783,8821,8839,8854,8887,8914,8930,8944,9036,9041,9058,9197,9227,9258,9281,9297,9305,114,114,59,1,8659,97,114,59,1,10597,4,4,103,108,114,115,8793,8799,8805,8809,103,101,114,59,1,8224,101,116,104,59,1,8504,114,59,1,8595,104,4,2,59,118,8816,8818,1,8208,59,1,8867,4,2,107,108,8827,8834,97,114,111,119,59,1,10511,97,99,59,1,733,4,2,97,121,8845,8851,114,111,110,59,1,271,59,1,1076,4,3,59,97,111,8862,8864,8880,1,8518,4,2,103,114,8870,8876,103,101,114,59,1,8225,114,59,1,8650,116,115,101,113,59,1,10871,4,3,103,108,109,8895,8902,8907,5,176,1,59,8900,1,176,116,97,59,1,948,112,116,121,118,59,1,10673,4,2,105,114,8920,8926,115,104,116,59,1,10623,59,3,55349,56609,97,114,4,2,108,114,8938,8941,59,1,8643,59,1,8642,4,5,97,101,103,115,118,8956,8986,8989,8996,9001,109,4,3,59,111,115,8965,8967,8983,1,8900,110,100,4,2,59,115,8975,8977,1,8900,117,105,116,59,1,9830,59,1,9830,59,1,168,97,109,109,97,59,1,989,105,110,59,1,8946,4,3,59,105,111,9009,9011,9031,1,247,100,101,5,247,2,59,111,9020,9022,1,247,110,116,105,109,101,115,59,1,8903,110,120,59,1,8903,99,121,59,1,1106,99,4,2,111,114,9048,9053,114,110,59,1,8990,111,112,59,1,8973,4,5,108,112,116,117,119,9070,9076,9081,9130,9144,108,97,114,59,1,36,102,59,3,55349,56661,4,5,59,101,109,112,115,9093,9095,9109,9116,9122,1,729,113,4,2,59,100,9102,9104,1,8784,111,116,59,1,8785,105,110,117,115,59,1,8760,108,117,115,59,1,8724,113,117,97,114,101,59,1,8865,98,108,101,98,97,114,119,101,100,103,101,59,1,8966,110,4,3,97,100,104,9153,9160,9172,114,114,111,119,59,1,8595,111,119,110,97,114,114,111,119,115,59,1,8650,97,114,112,111,111,110,4,2,108,114,9184,9190,101,102,116,59,1,8643,105,103,104,116,59,1,8642,4,2,98,99,9203,9211,107,97,114,111,119,59,1,10512,4,2,111,114,9217,9222,114,110,59,1,8991,111,112,59,1,8972,4,3,99,111,116,9235,9248,9252,4,2,114,121,9241,9245,59,3,55349,56505,59,1,1109,108,59,1,10742,114,111,107,59,1,273,4,2,100,114,9264,9269,111,116,59,1,8945,105,4,2,59,102,9276,9278,1,9663,59,1,9662,4,2,97,104,9287,9292,114,114,59,1,8693,97,114,59,1,10607,97,110,103,108,101,59,1,10662,4,2,99,105,9311,9315,121,59,1,1119,103,114,97,114,114,59,1,10239,4,18,68,97,99,100,101,102,103,108,109,110,111,112,113,114,115,116,117,120,9361,9376,9398,9439,9444,9447,9462,9495,9531,9585,9598,9614,9659,9755,9771,9792,9808,9826,4,2,68,111,9367,9372,111,116,59,1,10871,116,59,1,8785,4,2,99,115,9382,9392,117,116,101,5,233,1,59,9390,1,233,116,101,114,59,1,10862,4,4,97,105,111,121,9408,9414,9430,9436,114,111,110,59,1,283,114,4,2,59,99,9421,9423,1,8790,5,234,1,59,9428,1,234,108,111,110,59,1,8789,59,1,1101,111,116,59,1,279,59,1,8519,4,2,68,114,9453,9458,111,116,59,1,8786,59,3,55349,56610,4,3,59,114,115,9470,9472,9482,1,10906,97,118,101,5,232,1,59,9480,1,232,4,2,59,100,9488,9490,1,10902,111,116,59,1,10904,4,4,59,105,108,115,9505,9507,9515,9518,1,10905,110,116,101,114,115,59,1,9191,59,1,8467,4,2,59,100,9524,9526,1,10901,111,116,59,1,10903,4,3,97,112,115,9539,9544,9564,99,114,59,1,275,116,121,4,3,59,115,118,9554,9556,9561,1,8709,101,116,59,1,8709,59,1,8709,112,4,2,49,59,9571,9583,4,2,51,52,9577,9580,59,1,8196,59,1,8197,1,8195,4,2,103,115,9591,9594,59,1,331,112,59,1,8194,4,2,103,112,9604,9609,111,110,59,1,281,102,59,3,55349,56662,4,3,97,108,115,9622,9635,9640,114,4,2,59,115,9629,9631,1,8917,108,59,1,10723,117,115,59,1,10865,105,4,3,59,108,118,9649,9651,9656,1,949,111,110,59,1,949,59,1,1013,4,4,99,115,117,118,9669,9686,9716,9747,4,2,105,111,9675,9680,114,99,59,1,8790,108,111,110,59,1,8789,4,2,105,108,9692,9696,109,59,1,8770,97,110,116,4,2,103,108,9705,9710,116,114,59,1,10902,101,115,115,59,1,10901,4,3,97,101,105,9724,9729,9734,108,115,59,1,61,115,116,59,1,8799,118,4,2,59,68,9741,9743,1,8801,68,59,1,10872,112,97,114,115,108,59,1,10725,4,2,68,97,9761,9766,111,116,59,1,8787,114,114,59,1,10609,4,3,99,100,105,9779,9783,9788,114,59,1,8495,111,116,59,1,8784,109,59,1,8770,4,2,97,104,9798,9801,59,1,951,5,240,1,59,9806,1,240,4,2,109,114,9814,9822,108,5,235,1,59,9820,1,235,111,59,1,8364,4,3,99,105,112,9834,9838,9843,108,59,1,33,115,116,59,1,8707,4,2,101,111,9849,9859,99,116,97,116,105,111,110,59,1,8496,110,101,110,116,105,97,108,101,59,1,8519,4,12,97,99,101,102,105,106,108,110,111,112,114,115,9896,9910,9914,9921,9954,9960,9967,9989,9994,10027,10036,10164,108,108,105,110,103,100,111,116,115,101,113,59,1,8786,121,59,1,1092,109,97,108,101,59,1,9792,4,3,105,108,114,9929,9935,9950,108,105,103,59,1,64259,4,2,105,108,9941,9945,103,59,1,64256,105,103,59,1,64260,59,3,55349,56611,108,105,103,59,1,64257,108,105,103,59,3,102,106,4,3,97,108,116,9975,9979,9984,116,59,1,9837,105,103,59,1,64258,110,115,59,1,9649,111,102,59,1,402,4,2,112,114,10000,10005,102,59,3,55349,56663,4,2,97,107,10011,10016,108,108,59,1,8704,4,2,59,118,10022,10024,1,8916,59,1,10969,97,114,116,105,110,116,59,1,10765,4,2,97,111,10042,10159,4,2,99,115,10048,10155,4,6,49,50,51,52,53,55,10062,10102,10114,10135,10139,10151,4,6,50,51,52,53,54,56,10076,10083,10086,10093,10096,10099,5,189,1,59,10081,1,189,59,1,8531,5,188,1,59,10091,1,188,59,1,8533,59,1,8537,59,1,8539,4,2,51,53,10108,10111,59,1,8532,59,1,8534,4,3,52,53,56,10122,10129,10132,5,190,1,59,10127,1,190,59,1,8535,59,1,8540,53,59,1,8536,4,2,54,56,10145,10148,59,1,8538,59,1,8541,56,59,1,8542,108,59,1,8260,119,110,59,1,8994,99,114,59,3,55349,56507,4,17,69,97,98,99,100,101,102,103,105,106,108,110,111,114,115,116,118,10206,10217,10247,10254,10268,10273,10358,10363,10374,10380,10385,10406,10458,10464,10470,10497,10610,4,2,59,108,10212,10214,1,8807,59,1,10892,4,3,99,109,112,10225,10231,10244,117,116,101,59,1,501,109,97,4,2,59,100,10239,10241,1,947,59,1,989,59,1,10886,114,101,118,101,59,1,287,4,2,105,121,10260,10265,114,99,59,1,285,59,1,1075,111,116,59,1,289,4,4,59,108,113,115,10283,10285,10288,10308,1,8805,59,1,8923,4,3,59,113,115,10296,10298,10301,1,8805,59,1,8807,108,97,110,116,59,1,10878,4,4,59,99,100,108,10318,10320,10324,10345,1,10878,99,59,1,10921,111,116,4,2,59,111,10332,10334,1,10880,4,2,59,108,10340,10342,1,10882,59,1,10884,4,2,59,101,10351,10354,3,8923,65024,115,59,1,10900,114,59,3,55349,56612,4,2,59,103,10369,10371,1,8811,59,1,8921,109,101,108,59,1,8503,99,121,59,1,1107,4,4,59,69,97,106,10395,10397,10400,10403,1,8823,59,1,10898,59,1,10917,59,1,10916,4,4,69,97,101,115,10416,10419,10434,10453,59,1,8809,112,4,2,59,112,10426,10428,1,10890,114,111,120,59,1,10890,4,2,59,113,10440,10442,1,10888,4,2,59,113,10448,10450,1,10888,59,1,8809,105,109,59,1,8935,112,102,59,3,55349,56664,97,118,101,59,1,96,4,2,99,105,10476,10480,114,59,1,8458,109,4,3,59,101,108,10489,10491,10494,1,8819,59,1,10894,59,1,10896,5,62,6,59,99,100,108,113,114,10512,10514,10527,10532,10538,10545,1,62,4,2,99,105,10520,10523,59,1,10919,114,59,1,10874,111,116,59,1,8919,80,97,114,59,1,10645,117,101,115,116,59,1,10876,4,5,97,100,101,108,115,10557,10574,10579,10599,10605,4,2,112,114,10563,10570,112,114,111,120,59,1,10886,114,59,1,10616,111,116,59,1,8919,113,4,2,108,113,10586,10592,101,115,115,59,1,8923,108,101,115,115,59,1,10892,101,115,115,59,1,8823,105,109,59,1,8819,4,2,101,110,10616,10626,114,116,110,101,113,113,59,3,8809,65024,69,59,3,8809,65024,4,10,65,97,98,99,101,102,107,111,115,121,10653,10658,10713,10718,10724,10760,10765,10786,10850,10875,114,114,59,1,8660,4,4,105,108,109,114,10668,10674,10678,10684,114,115,112,59,1,8202,102,59,1,189,105,108,116,59,1,8459,4,2,100,114,10690,10695,99,121,59,1,1098,4,3,59,99,119,10703,10705,10710,1,8596,105,114,59,1,10568,59,1,8621,97,114,59,1,8463,105,114,99,59,1,293,4,3,97,108,114,10732,10748,10754,114,116,115,4,2,59,117,10741,10743,1,9829,105,116,59,1,9829,108,105,112,59,1,8230,99,111,110,59,1,8889,114,59,3,55349,56613,115,4,2,101,119,10772,10779,97,114,111,119,59,1,10533,97,114,111,119,59,1,10534,4,5,97,109,111,112,114,10798,10803,10809,10839,10844,114,114,59,1,8703,116,104,116,59,1,8763,107,4,2,108,114,10816,10827,101,102,116,97,114,114,111,119,59,1,8617,105,103,104,116,97,114,114,111,119,59,1,8618,102,59,3,55349,56665,98,97,114,59,1,8213,4,3,99,108,116,10858,10863,10869,114,59,3,55349,56509,97,115,104,59,1,8463,114,111,107,59,1,295,4,2,98,112,10881,10887,117,108,108,59,1,8259,104,101,110,59,1,8208,4,15,97,99,101,102,103,105,106,109,110,111,112,113,115,116,117,10925,10936,10958,10977,10990,11001,11039,11045,11101,11192,11220,11226,11237,11285,11299,99,117,116,101,5,237,1,59,10934,1,237,4,3,59,105,121,10944,10946,10955,1,8291,114,99,5,238,1,59,10953,1,238,59,1,1080,4,2,99,120,10964,10968,121,59,1,1077,99,108,5,161,1,59,10975,1,161,4,2,102,114,10983,10986,59,1,8660,59,3,55349,56614,114,97,118,101,5,236,1,59,10999,1,236,4,4,59,105,110,111,11011,11013,11028,11034,1,8520,4,2,105,110,11019,11024,110,116,59,1,10764,116,59,1,8749,102,105,110,59,1,10716,116,97,59,1,8489,108,105,103,59,1,307,4,3,97,111,112,11053,11092,11096,4,3,99,103,116,11061,11065,11088,114,59,1,299,4,3,101,108,112,11073,11076,11082,59,1,8465,105,110,101,59,1,8464,97,114,116,59,1,8465,104,59,1,305,102,59,1,8887,101,100,59,1,437,4,5,59,99,102,111,116,11113,11115,11121,11136,11142,1,8712,97,114,101,59,1,8453,105,110,4,2,59,116,11129,11131,1,8734,105,101,59,1,10717,100,111,116,59,1,305,4,5,59,99,101,108,112,11154,11156,11161,11179,11186,1,8747,97,108,59,1,8890,4,2,103,114,11167,11173,101,114,115,59,1,8484,99,97,108,59,1,8890,97,114,104,107,59,1,10775,114,111,100,59,1,10812,4,4,99,103,112,116,11202,11206,11211,11216,121,59,1,1105,111,110,59,1,303,102,59,3,55349,56666,97,59,1,953,114,111,100,59,1,10812,117,101,115,116,5,191,1,59,11235,1,191,4,2,99,105,11243,11248,114,59,3,55349,56510,110,4,5,59,69,100,115,118,11261,11263,11266,11271,11282,1,8712,59,1,8953,111,116,59,1,8949,4,2,59,118,11277,11279,1,8948,59,1,8947,59,1,8712,4,2,59,105,11291,11293,1,8290,108,100,101,59,1,297,4,2,107,109,11305,11310,99,121,59,1,1110,108,5,239,1,59,11316,1,239,4,6,99,102,109,111,115,117,11332,11346,11351,11357,11363,11380,4,2,105,121,11338,11343,114,99,59,1,309,59,1,1081,114,59,3,55349,56615,97,116,104,59,1,567,112,102,59,3,55349,56667,4,2,99,101,11369,11374,114,59,3,55349,56511,114,99,121,59,1,1112,107,99,121,59,1,1108,4,8,97,99,102,103,104,106,111,115,11404,11418,11433,11438,11445,11450,11455,11461,112,112,97,4,2,59,118,11413,11415,1,954,59,1,1008,4,2,101,121,11424,11430,100,105,108,59,1,311,59,1,1082,114,59,3,55349,56616,114,101,101,110,59,1,312,99,121,59,1,1093,99,121,59,1,1116,112,102,59,3,55349,56668,99,114,59,3,55349,56512,4,23,65,66,69,72,97,98,99,100,101,102,103,104,106,108,109,110,111,112,114,115,116,117,118,11515,11538,11544,11555,11560,11721,11780,11818,11868,12136,12160,12171,12203,12208,12246,12275,12327,12509,12523,12569,12641,12732,12752,4,3,97,114,116,11523,11528,11532,114,114,59,1,8666,114,59,1,8656,97,105,108,59,1,10523,97,114,114,59,1,10510,4,2,59,103,11550,11552,1,8806,59,1,10891,97,114,59,1,10594,4,9,99,101,103,109,110,112,113,114,116,11580,11586,11594,11600,11606,11624,11627,11636,11694,117,116,101,59,1,314,109,112,116,121,118,59,1,10676,114,97,110,59,1,8466,98,100,97,59,1,955,103,4,3,59,100,108,11615,11617,11620,1,10216,59,1,10641,101,59,1,10216,59,1,10885,117,111,5,171,1,59,11634,1,171,114,4,8,59,98,102,104,108,112,115,116,11655,11657,11669,11673,11677,11681,11685,11690,1,8592,4,2,59,102,11663,11665,1,8676,115,59,1,10527,115,59,1,10525,107,59,1,8617,112,59,1,8619,108,59,1,10553,105,109,59,1,10611,108,59,1,8610,4,3,59,97,101,11702,11704,11709,1,10923,105,108,59,1,10521,4,2,59,115,11715,11717,1,10925,59,3,10925,65024,4,3,97,98,114,11729,11734,11739,114,114,59,1,10508,114,107,59,1,10098,4,2,97,107,11745,11758,99,4,2,101,107,11752,11755,59,1,123,59,1,91,4,2,101,115,11764,11767,59,1,10635,108,4,2,100,117,11774,11777,59,1,10639,59,1,10637,4,4,97,101,117,121,11790,11796,11811,11815,114,111,110,59,1,318,4,2,100,105,11802,11807,105,108,59,1,316,108,59,1,8968,98,59,1,123,59,1,1083,4,4,99,113,114,115,11828,11832,11845,11864,97,59,1,10550,117,111,4,2,59,114,11840,11842,1,8220,59,1,8222,4,2,100,117,11851,11857,104,97,114,59,1,10599,115,104,97,114,59,1,10571,104,59,1,8626,4,5,59,102,103,113,115,11880,11882,12008,12011,12031,1,8804,116,4,5,97,104,108,114,116,11895,11913,11935,11947,11996,114,114,111,119,4,2,59,116,11905,11907,1,8592,97,105,108,59,1,8610,97,114,112,111,111,110,4,2,100,117,11925,11931,111,119,110,59,1,8637,112,59,1,8636,101,102,116,97,114,114,111,119,115,59,1,8647,105,103,104,116,4,3,97,104,115,11959,11974,11984,114,114,111,119,4,2,59,115,11969,11971,1,8596,59,1,8646,97,114,112,111,111,110,115,59,1,8651,113,117,105,103,97,114,114,111,119,59,1,8621,104,114,101,101,116,105,109,101,115,59,1,8907,59,1,8922,4,3,59,113,115,12019,12021,12024,1,8804,59,1,8806,108,97,110,116,59,1,10877,4,5,59,99,100,103,115,12043,12045,12049,12070,12083,1,10877,99,59,1,10920,111,116,4,2,59,111,12057,12059,1,10879,4,2,59,114,12065,12067,1,10881,59,1,10883,4,2,59,101,12076,12079,3,8922,65024,115,59,1,10899,4,5,97,100,101,103,115,12095,12103,12108,12126,12131,112,112,114,111,120,59,1,10885,111,116,59,1,8918,113,4,2,103,113,12115,12120,116,114,59,1,8922,103,116,114,59,1,10891,116,114,59,1,8822,105,109,59,1,8818,4,3,105,108,114,12144,12150,12156,115,104,116,59,1,10620,111,111,114,59,1,8970,59,3,55349,56617,4,2,59,69,12166,12168,1,8822,59,1,10897,4,2,97,98,12177,12198,114,4,2,100,117,12184,12187,59,1,8637,4,2,59,108,12193,12195,1,8636,59,1,10602,108,107,59,1,9604,99,121,59,1,1113,4,5,59,97,99,104,116,12220,12222,12227,12235,12241,1,8810,114,114,59,1,8647,111,114,110,101,114,59,1,8990,97,114,100,59,1,10603,114,105,59,1,9722,4,2,105,111,12252,12258,100,111,116,59,1,320,117,115,116,4,2,59,97,12267,12269,1,9136,99,104,101,59,1,9136,4,4,69,97,101,115,12285,12288,12303,12322,59,1,8808,112,4,2,59,112,12295,12297,1,10889,114,111,120,59,1,10889,4,2,59,113,12309,12311,1,10887,4,2,59,113,12317,12319,1,10887,59,1,8808,105,109,59,1,8934,4,8,97,98,110,111,112,116,119,122,12345,12359,12364,12421,12446,12467,12474,12490,4,2,110,114,12351,12355,103,59,1,10220,114,59,1,8701,114,107,59,1,10214,103,4,3,108,109,114,12373,12401,12409,101,102,116,4,2,97,114,12382,12389,114,114,111,119,59,1,10229,105,103,104,116,97,114,114,111,119,59,1,10231,97,112,115,116,111,59,1,10236,105,103,104,116,97,114,114,111,119,59,1,10230,112,97,114,114,111,119,4,2,108,114,12433,12439,101,102,116,59,1,8619,105,103,104,116,59,1,8620,4,3,97,102,108,12454,12458,12462,114,59,1,10629,59,3,55349,56669,117,115,59,1,10797,105,109,101,115,59,1,10804,4,2,97,98,12480,12485,115,116,59,1,8727,97,114,59,1,95,4,3,59,101,102,12498,12500,12506,1,9674,110,103,101,59,1,9674,59,1,10731,97,114,4,2,59,108,12517,12519,1,40,116,59,1,10643,4,5,97,99,104,109,116,12535,12540,12548,12561,12564,114,114,59,1,8646,111,114,110,101,114,59,1,8991,97,114,4,2,59,100,12556,12558,1,8651,59,1,10605,59,1,8206,114,105,59,1,8895,4,6,97,99,104,105,113,116,12583,12589,12594,12597,12614,12635,113,117,111,59,1,8249,114,59,3,55349,56513,59,1,8624,109,4,3,59,101,103,12606,12608,12611,1,8818,59,1,10893,59,1,10895,4,2,98,117,12620,12623,59,1,91,111,4,2,59,114,12630,12632,1,8216,59,1,8218,114,111,107,59,1,322,5,60,8,59,99,100,104,105,108,113,114,12660,12662,12675,12680,12686,12692,12698,12705,1,60,4,2,99,105,12668,12671,59,1,10918,114,59,1,10873,111,116,59,1,8918,114,101,101,59,1,8907,109,101,115,59,1,8905,97,114,114,59,1,10614,117,101,115,116,59,1,10875,4,2,80,105,12711,12716,97,114,59,1,10646,4,3,59,101,102,12724,12726,12729,1,9667,59,1,8884,59,1,9666,114,4,2,100,117,12739,12746,115,104,97,114,59,1,10570,104,97,114,59,1,10598,4,2,101,110,12758,12768,114,116,110,101,113,113,59,3,8808,65024,69,59,3,8808,65024,4,14,68,97,99,100,101,102,104,105,108,110,111,112,115,117,12803,12809,12893,12908,12914,12928,12933,12937,13011,13025,13032,13049,13052,13069,68,111,116,59,1,8762,4,4,99,108,112,114,12819,12827,12849,12887,114,5,175,1,59,12825,1,175,4,2,101,116,12833,12836,59,1,9794,4,2,59,101,12842,12844,1,10016,115,101,59,1,10016,4,2,59,115,12855,12857,1,8614,116,111,4,4,59,100,108,117,12869,12871,12877,12883,1,8614,111,119,110,59,1,8615,101,102,116,59,1,8612,112,59,1,8613,107,101,114,59,1,9646,4,2,111,121,12899,12905,109,109,97,59,1,10793,59,1,1084,97,115,104,59,1,8212,97,115,117,114,101,100,97,110,103,108,101,59,1,8737,114,59,3,55349,56618,111,59,1,8487,4,3,99,100,110,12945,12954,12985,114,111,5,181,1,59,12952,1,181,4,4,59,97,99,100,12964,12966,12971,12976,1,8739,115,116,59,1,42,105,114,59,1,10992,111,116,5,183,1,59,12983,1,183,117,115,4,3,59,98,100,12995,12997,13000,1,8722,59,1,8863,4,2,59,117,13006,13008,1,8760,59,1,10794,4,2,99,100,13017,13021,112,59,1,10971,114,59,1,8230,112,108,117,115,59,1,8723,4,2,100,112,13038,13044,101,108,115,59,1,8871,102,59,3,55349,56670,59,1,8723,4,2,99,116,13058,13063,114,59,3,55349,56514,112,111,115,59,1,8766,4,3,59,108,109,13077,13079,13087,1,956,116,105,109,97,112,59,1,8888,97,112,59,1,8888,4,24,71,76,82,86,97,98,99,100,101,102,103,104,105,106,108,109,111,112,114,115,116,117,118,119,13142,13165,13217,13229,13247,13330,13359,13414,13420,13508,13513,13579,13602,13626,13631,13762,13767,13855,13936,13995,14214,14285,14312,14432,4,2,103,116,13148,13152,59,3,8921,824,4,2,59,118,13158,13161,3,8811,8402,59,3,8811,824,4,3,101,108,116,13173,13200,13204,102,116,4,2,97,114,13181,13188,114,114,111,119,59,1,8653,105,103,104,116,97,114,114,111,119,59,1,8654,59,3,8920,824,4,2,59,118,13210,13213,3,8810,8402,59,3,8810,824,105,103,104,116,97,114,114,111,119,59,1,8655,4,2,68,100,13235,13241,97,115,104,59,1,8879,97,115,104,59,1,8878,4,5,98,99,110,112,116,13259,13264,13270,13275,13308,108,97,59,1,8711,117,116,101,59,1,324,103,59,3,8736,8402,4,5,59,69,105,111,112,13287,13289,13293,13298,13302,1,8777,59,3,10864,824,100,59,3,8779,824,115,59,1,329,114,111,120,59,1,8777,117,114,4,2,59,97,13316,13318,1,9838,108,4,2,59,115,13325,13327,1,9838,59,1,8469,4,2,115,117,13336,13344,112,5,160,1,59,13342,1,160,109,112,4,2,59,101,13352,13355,3,8782,824,59,3,8783,824,4,5,97,101,111,117,121,13371,13385,13391,13407,13411,4,2,112,114,13377,13380,59,1,10819,111,110,59,1,328,100,105,108,59,1,326,110,103,4,2,59,100,13399,13401,1,8775,111,116,59,3,10861,824,112,59,1,10818,59,1,1085,97,115,104,59,1,8211,4,7,59,65,97,100,113,115,120,13436,13438,13443,13466,13472,13478,13494,1,8800,114,114,59,1,8663,114,4,2,104,114,13450,13454,107,59,1,10532,4,2,59,111,13460,13462,1,8599,119,59,1,8599,111,116,59,3,8784,824,117,105,118,59,1,8802,4,2,101,105,13484,13489,97,114,59,1,10536,109,59,3,8770,824,105,115,116,4,2,59,115,13503,13505,1,8708,59,1,8708,114,59,3,55349,56619,4,4,69,101,115,116,13523,13527,13563,13568,59,3,8807,824,4,3,59,113,115,13535,13537,13559,1,8817,4,3,59,113,115,13545,13547,13551,1,8817,59,3,8807,824,108,97,110,116,59,3,10878,824,59,3,10878,824,105,109,59,1,8821,4,2,59,114,13574,13576,1,8815,59,1,8815,4,3,65,97,112,13587,13592,13597,114,114,59,1,8654,114,114,59,1,8622,97,114,59,1,10994,4,3,59,115,118,13610,13612,13623,1,8715,4,2,59,100,13618,13620,1,8956,59,1,8954,59,1,8715,99,121,59,1,1114,4,7,65,69,97,100,101,115,116,13647,13652,13656,13661,13665,13737,13742,114,114,59,1,8653,59,3,8806,824,114,114,59,1,8602,114,59,1,8229,4,4,59,102,113,115,13675,13677,13703,13725,1,8816,116,4,2,97,114,13684,13691,114,114,111,119,59,1,8602,105,103,104,116,97,114,114,111,119,59,1,8622,4,3,59,113,115,13711,13713,13717,1,8816,59,3,8806,824,108,97,110,116,59,3,10877,824,4,2,59,115,13731,13734,3,10877,824,59,1,8814,105,109,59,1,8820,4,2,59,114,13748,13750,1,8814,105,4,2,59,101,13757,13759,1,8938,59,1,8940,105,100,59,1,8740,4,2,112,116,13773,13778,102,59,3,55349,56671,5,172,3,59,105,110,13787,13789,13829,1,172,110,4,4,59,69,100,118,13800,13802,13806,13812,1,8713,59,3,8953,824,111,116,59,3,8949,824,4,3,97,98,99,13820,13823,13826,59,1,8713,59,1,8951,59,1,8950,105,4,2,59,118,13836,13838,1,8716,4,3,97,98,99,13846,13849,13852,59,1,8716,59,1,8958,59,1,8957,4,3,97,111,114,13863,13892,13899,114,4,4,59,97,115,116,13874,13876,13883,13888,1,8742,108,108,101,108,59,1,8742,108,59,3,11005,8421,59,3,8706,824,108,105,110,116,59,1,10772,4,3,59,99,101,13907,13909,13914,1,8832,117,101,59,1,8928,4,2,59,99,13920,13923,3,10927,824,4,2,59,101,13929,13931,1,8832,113,59,3,10927,824,4,4,65,97,105,116,13946,13951,13971,13982,114,114,59,1,8655,114,114,4,3,59,99,119,13961,13963,13967,1,8603,59,3,10547,824,59,3,8605,824,103,104,116,97,114,114,111,119,59,1,8603,114,105,4,2,59,101,13990,13992,1,8939,59,1,8941,4,7,99,104,105,109,112,113,117,14011,14036,14060,14080,14085,14090,14106,4,4,59,99,101,114,14021,14023,14028,14032,1,8833,117,101,59,1,8929,59,3,10928,824,59,3,55349,56515,111,114,116,4,2,109,112,14045,14050,105,100,59,1,8740,97,114,97,108,108,101,108,59,1,8742,109,4,2,59,101,14067,14069,1,8769,4,2,59,113,14075,14077,1,8772,59,1,8772,105,100,59,1,8740,97,114,59,1,8742,115,117,4,2,98,112,14098,14102,101,59,1,8930,101,59,1,8931,4,3,98,99,112,14114,14157,14171,4,4,59,69,101,115,14124,14126,14130,14133,1,8836,59,3,10949,824,59,1,8840,101,116,4,2,59,101,14141,14144,3,8834,8402,113,4,2,59,113,14151,14153,1,8840,59,3,10949,824,99,4,2,59,101,14164,14166,1,8833,113,59,3,10928,824,4,4,59,69,101,115,14181,14183,14187,14190,1,8837,59,3,10950,824,59,1,8841,101,116,4,2,59,101,14198,14201,3,8835,8402,113,4,2,59,113,14208,14210,1,8841,59,3,10950,824,4,4,103,105,108,114,14224,14228,14238,14242,108,59,1,8825,108,100,101,5,241,1,59,14236,1,241,103,59,1,8824,105,97,110,103,108,101,4,2,108,114,14254,14269,101,102,116,4,2,59,101,14263,14265,1,8938,113,59,1,8940,105,103,104,116,4,2,59,101,14279,14281,1,8939,113,59,1,8941,4,2,59,109,14291,14293,1,957,4,3,59,101,115,14301,14303,14308,1,35,114,111,59,1,8470,112,59,1,8199,4,9,68,72,97,100,103,105,108,114,115,14332,14338,14344,14349,14355,14369,14376,14408,14426,97,115,104,59,1,8877,97,114,114,59,1,10500,112,59,3,8781,8402,97,115,104,59,1,8876,4,2,101,116,14361,14365,59,3,8805,8402,59,3,62,8402,110,102,105,110,59,1,10718,4,3,65,101,116,14384,14389,14393,114,114,59,1,10498,59,3,8804,8402,4,2,59,114,14399,14402,3,60,8402,105,101,59,3,8884,8402,4,2,65,116,14414,14419,114,114,59,1,10499,114,105,101,59,3,8885,8402,105,109,59,3,8764,8402,4,3,65,97,110,14440,14445,14468,114,114,59,1,8662,114,4,2,104,114,14452,14456,107,59,1,10531,4,2,59,111,14462,14464,1,8598,119,59,1,8598,101,97,114,59,1,10535,4,18,83,97,99,100,101,102,103,104,105,108,109,111,112,114,115,116,117,118,14512,14515,14535,14560,14597,14603,14618,14643,14657,14662,14701,14741,14747,14769,14851,14877,14907,14916,59,1,9416,4,2,99,115,14521,14531,117,116,101,5,243,1,59,14529,1,243,116,59,1,8859,4,2,105,121,14541,14557,114,4,2,59,99,14548,14550,1,8858,5,244,1,59,14555,1,244,59,1,1086,4,5,97,98,105,111,115,14572,14577,14583,14587,14591,115,104,59,1,8861,108,97,99,59,1,337,118,59,1,10808,116,59,1,8857,111,108,100,59,1,10684,108,105,103,59,1,339,4,2,99,114,14609,14614,105,114,59,1,10687,59,3,55349,56620,4,3,111,114,116,14626,14630,14640,110,59,1,731,97,118,101,5,242,1,59,14638,1,242,59,1,10689,4,2,98,109,14649,14654,97,114,59,1,10677,59,1,937,110,116,59,1,8750,4,4,97,99,105,116,14672,14677,14693,14698,114,114,59,1,8634,4,2,105,114,14683,14687,114,59,1,10686,111,115,115,59,1,10683,110,101,59,1,8254,59,1,10688,4,3,97,101,105,14709,14714,14719,99,114,59,1,333,103,97,59,1,969,4,3,99,100,110,14727,14733,14736,114,111,110,59,1,959,59,1,10678,117,115,59,1,8854,112,102,59,3,55349,56672,4,3,97,101,108,14755,14759,14764,114,59,1,10679,114,112,59,1,10681,117,115,59,1,8853,4,7,59,97,100,105,111,115,118,14785,14787,14792,14831,14837,14841,14848,1,8744,114,114,59,1,8635,4,4,59,101,102,109,14802,14804,14817,14824,1,10845,114,4,2,59,111,14811,14813,1,8500,102,59,1,8500,5,170,1,59,14822,1,170,5,186,1,59,14829,1,186,103,111,102,59,1,8886,114,59,1,10838,108,111,112,101,59,1,10839,59,1,10843,4,3,99,108,111,14859,14863,14873,114,59,1,8500,97,115,104,5,248,1,59,14871,1,248,108,59,1,8856,105,4,2,108,109,14884,14893,100,101,5,245,1,59,14891,1,245,101,115,4,2,59,97,14901,14903,1,8855,115,59,1,10806,109,108,5,246,1,59,14914,1,246,98,97,114,59,1,9021,4,12,97,99,101,102,104,105,108,109,111,114,115,117,14948,14992,14996,15033,15038,15068,15090,15189,15192,15222,15427,15441,114,4,4,59,97,115,116,14959,14961,14976,14989,1,8741,5,182,2,59,108,14968,14970,1,182,108,101,108,59,1,8741,4,2,105,108,14982,14986,109,59,1,10995,59,1,11005,59,1,8706,121,59,1,1087,114,4,5,99,105,109,112,116,15009,15014,15019,15024,15027,110,116,59,1,37,111,100,59,1,46,105,108,59,1,8240,59,1,8869,101,110,107,59,1,8241,114,59,3,55349,56621,4,3,105,109,111,15046,15057,15063,4,2,59,118,15052,15054,1,966,59,1,981,109,97,116,59,1,8499,110,101,59,1,9742,4,3,59,116,118,15076,15078,15087,1,960,99,104,102,111,114,107,59,1,8916,59,1,982,4,2,97,117,15096,15119,110,4,2,99,107,15103,15115,107,4,2,59,104,15110,15112,1,8463,59,1,8462,118,59,1,8463,115,4,9,59,97,98,99,100,101,109,115,116,15140,15142,15148,15151,15156,15168,15171,15179,15184,1,43,99,105,114,59,1,10787,59,1,8862,105,114,59,1,10786,4,2,111,117,15162,15165,59,1,8724,59,1,10789,59,1,10866,110,5,177,1,59,15177,1,177,105,109,59,1,10790,119,111,59,1,10791,59,1,177,4,3,105,112,117,15200,15208,15213,110,116,105,110,116,59,1,10773,102,59,3,55349,56673,110,100,5,163,1,59,15220,1,163,4,10,59,69,97,99,101,105,110,111,115,117,15244,15246,15249,15253,15258,15334,15347,15367,15416,15421,1,8826,59,1,10931,112,59,1,10935,117,101,59,1,8828,4,2,59,99,15264,15266,1,10927,4,6,59,97,99,101,110,115,15280,15282,15290,15299,15303,15329,1,8826,112,112,114,111,120,59,1,10935,117,114,108,121,101,113,59,1,8828,113,59,1,10927,4,3,97,101,115,15311,15319,15324,112,112,114,111,120,59,1,10937,113,113,59,1,10933,105,109,59,1,8936,105,109,59,1,8830,109,101,4,2,59,115,15342,15344,1,8242,59,1,8473,4,3,69,97,115,15355,15358,15362,59,1,10933,112,59,1,10937,105,109,59,1,8936,4,3,100,102,112,15375,15378,15404,59,1,8719,4,3,97,108,115,15386,15392,15398,108,97,114,59,1,9006,105,110,101,59,1,8978,117,114,102,59,1,8979,4,2,59,116,15410,15412,1,8733,111,59,1,8733,105,109,59,1,8830,114,101,108,59,1,8880,4,2,99,105,15433,15438,114,59,3,55349,56517,59,1,968,110,99,115,112,59,1,8200,4,6,102,105,111,112,115,117,15462,15467,15472,15478,15485,15491,114,59,3,55349,56622,110,116,59,1,10764,112,102,59,3,55349,56674,114,105,109,101,59,1,8279,99,114,59,3,55349,56518,4,3,97,101,111,15499,15520,15534,116,4,2,101,105,15506,15515,114,110,105,111,110,115,59,1,8461,110,116,59,1,10774,115,116,4,2,59,101,15528,15530,1,63,113,59,1,8799,116,5,34,1,59,15540,1,34,4,21,65,66,72,97,98,99,100,101,102,104,105,108,109,110,111,112,114,115,116,117,120,15586,15609,15615,15620,15796,15855,15893,15931,15977,16001,16039,16183,16204,16222,16228,16285,16312,16318,16363,16408,16416,4,3,97,114,116,15594,15599,15603,114,114,59,1,8667,114,59,1,8658,97,105,108,59,1,10524,97,114,114,59,1,10511,97,114,59,1,10596,4,7,99,100,101,110,113,114,116,15636,15651,15656,15664,15687,15696,15770,4,2,101,117,15642,15646,59,3,8765,817,116,101,59,1,341,105,99,59,1,8730,109,112,116,121,118,59,1,10675,103,4,4,59,100,101,108,15675,15677,15680,15683,1,10217,59,1,10642,59,1,10661,101,59,1,10217,117,111,5,187,1,59,15694,1,187,114,4,11,59,97,98,99,102,104,108,112,115,116,119,15721,15723,15727,15739,15742,15746,15750,15754,15758,15763,15767,1,8594,112,59,1,10613,4,2,59,102,15733,15735,1,8677,115,59,1,10528,59,1,10547,115,59,1,10526,107,59,1,8618,112,59,1,8620,108,59,1,10565,105,109,59,1,10612,108,59,1,8611,59,1,8605,4,2,97,105,15776,15781,105,108,59,1,10522,111,4,2,59,110,15788,15790,1,8758,97,108,115,59,1,8474,4,3,97,98,114,15804,15809,15814,114,114,59,1,10509,114,107,59,1,10099,4,2,97,107,15820,15833,99,4,2,101,107,15827,15830,59,1,125,59,1,93,4,2,101,115,15839,15842,59,1,10636,108,4,2,100,117,15849,15852,59,1,10638,59,1,10640,4,4,97,101,117,121,15865,15871,15886,15890,114,111,110,59,1,345,4,2,100,105,15877,15882,105,108,59,1,343,108,59,1,8969,98,59,1,125,59,1,1088,4,4,99,108,113,115,15903,15907,15914,15927,97,59,1,10551,100,104,97,114,59,1,10601,117,111,4,2,59,114,15922,15924,1,8221,59,1,8221,104,59,1,8627,4,3,97,99,103,15939,15966,15970,108,4,4,59,105,112,115,15950,15952,15957,15963,1,8476,110,101,59,1,8475,97,114,116,59,1,8476,59,1,8477,116,59,1,9645,5,174,1,59,15975,1,174,4,3,105,108,114,15985,15991,15997,115,104,116,59,1,10621,111,111,114,59,1,8971,59,3,55349,56623,4,2,97,111,16007,16028,114,4,2,100,117,16014,16017,59,1,8641,4,2,59,108,16023,16025,1,8640,59,1,10604,4,2,59,118,16034,16036,1,961,59,1,1009,4,3,103,110,115,16047,16167,16171,104,116,4,6,97,104,108,114,115,116,16063,16081,16103,16130,16143,16155,114,114,111,119,4,2,59,116,16073,16075,1,8594,97,105,108,59,1,8611,97,114,112,111,111,110,4,2,100,117,16093,16099,111,119,110,59,1,8641,112,59,1,8640,101,102,116,4,2,97,104,16112,16120,114,114,111,119,115,59,1,8644,97,114,112,111,111,110,115,59,1,8652,105,103,104,116,97,114,114,111,119,115,59,1,8649,113,117,105,103,97,114,114,111,119,59,1,8605,104,114,101,101,116,105,109,101,115,59,1,8908,103,59,1,730,105,110,103,100,111,116,115,101,113,59,1,8787,4,3,97,104,109,16191,16196,16201,114,114,59,1,8644,97,114,59,1,8652,59,1,8207,111,117,115,116,4,2,59,97,16214,16216,1,9137,99,104,101,59,1,9137,109,105,100,59,1,10990,4,4,97,98,112,116,16238,16252,16257,16278,4,2,110,114,16244,16248,103,59,1,10221,114,59,1,8702,114,107,59,1,10215,4,3,97,102,108,16265,16269,16273,114,59,1,10630,59,3,55349,56675,117,115,59,1,10798,105,109,101,115,59,1,10805,4,2,97,112,16291,16304,114,4,2,59,103,16298,16300,1,41,116,59,1,10644,111,108,105,110,116,59,1,10770,97,114,114,59,1,8649,4,4,97,99,104,113,16328,16334,16339,16342,113,117,111,59,1,8250,114,59,3,55349,56519,59,1,8625,4,2,98,117,16348,16351,59,1,93,111,4,2,59,114,16358,16360,1,8217,59,1,8217,4,3,104,105,114,16371,16377,16383,114,101,101,59,1,8908,109,101,115,59,1,8906,105,4,4,59,101,102,108,16394,16396,16399,16402,1,9657,59,1,8885,59,1,9656,116,114,105,59,1,10702,108,117,104,97,114,59,1,10600,59,1,8478,4,19,97,98,99,100,101,102,104,105,108,109,111,112,113,114,115,116,117,119,122,16459,16466,16472,16572,16590,16672,16687,16746,16844,16850,16924,16963,16988,17115,17121,17154,17206,17614,17656,99,117,116,101,59,1,347,113,117,111,59,1,8218,4,10,59,69,97,99,101,105,110,112,115,121,16494,16496,16499,16513,16518,16531,16536,16556,16564,16569,1,8827,59,1,10932,4,2,112,114,16505,16508,59,1,10936,111,110,59,1,353,117,101,59,1,8829,4,2,59,100,16524,16526,1,10928,105,108,59,1,351,114,99,59,1,349,4,3,69,97,115,16544,16547,16551,59,1,10934,112,59,1,10938,105,109,59,1,8937,111,108,105,110,116,59,1,10771,105,109,59,1,8831,59,1,1089,111,116,4,3,59,98,101,16582,16584,16587,1,8901,59,1,8865,59,1,10854,4,7,65,97,99,109,115,116,120,16606,16611,16634,16642,16646,16652,16668,114,114,59,1,8664,114,4,2,104,114,16618,16622,107,59,1,10533,4,2,59,111,16628,16630,1,8600,119,59,1,8600,116,5,167,1,59,16640,1,167,105,59,1,59,119,97,114,59,1,10537,109,4,2,105,110,16659,16665,110,117,115,59,1,8726,59,1,8726,116,59,1,10038,114,4,2,59,111,16679,16682,3,55349,56624,119,110,59,1,8994,4,4,97,99,111,121,16697,16702,16716,16739,114,112,59,1,9839,4,2,104,121,16708,16713,99,121,59,1,1097,59,1,1096,114,116,4,2,109,112,16724,16729,105,100,59,1,8739,97,114,97,108,108,101,108,59,1,8741,5,173,1,59,16744,1,173,4,2,103,109,16752,16770,109,97,4,3,59,102,118,16762,16764,16767,1,963,59,1,962,59,1,962,4,8,59,100,101,103,108,110,112,114,16788,16790,16795,16806,16817,16828,16832,16838,1,8764,111,116,59,1,10858,4,2,59,113,16801,16803,1,8771,59,1,8771,4,2,59,69,16812,16814,1,10910,59,1,10912,4,2,59,69,16823,16825,1,10909,59,1,10911,101,59,1,8774,108,117,115,59,1,10788,97,114,114,59,1,10610,97,114,114,59,1,8592,4,4,97,101,105,116,16860,16883,16891,16904,4,2,108,115,16866,16878,108,115,101,116,109,105,110,117,115,59,1,8726,104,112,59,1,10803,112,97,114,115,108,59,1,10724,4,2,100,108,16897,16900,59,1,8739,101,59,1,8995,4,2,59,101,16910,16912,1,10922,4,2,59,115,16918,16920,1,10924,59,3,10924,65024,4,3,102,108,112,16932,16938,16958,116,99,121,59,1,1100,4,2,59,98,16944,16946,1,47,4,2,59,97,16952,16954,1,10692,114,59,1,9023,102,59,3,55349,56676,97,4,2,100,114,16970,16985,101,115,4,2,59,117,16978,16980,1,9824,105,116,59,1,9824,59,1,8741,4,3,99,115,117,16996,17028,17089,4,2,97,117,17002,17015,112,4,2,59,115,17009,17011,1,8851,59,3,8851,65024,112,4,2,59,115,17022,17024,1,8852,59,3,8852,65024,117,4,2,98,112,17035,17062,4,3,59,101,115,17043,17045,17048,1,8847,59,1,8849,101,116,4,2,59,101,17056,17058,1,8847,113,59,1,8849,4,3,59,101,115,17070,17072,17075,1,8848,59,1,8850,101,116,4,2,59,101,17083,17085,1,8848,113,59,1,8850,4,3,59,97,102,17097,17099,17112,1,9633,114,4,2,101,102,17106,17109,59,1,9633,59,1,9642,59,1,9642,97,114,114,59,1,8594,4,4,99,101,109,116,17131,17136,17142,17148,114,59,3,55349,56520,116,109,110,59,1,8726,105,108,101,59,1,8995,97,114,102,59,1,8902,4,2,97,114,17160,17172,114,4,2,59,102,17167,17169,1,9734,59,1,9733,4,2,97,110,17178,17202,105,103,104,116,4,2,101,112,17188,17197,112,115,105,108,111,110,59,1,1013,104,105,59,1,981,115,59,1,175,4,5,98,99,109,110,112,17218,17351,17420,17423,17427,4,9,59,69,100,101,109,110,112,114,115,17238,17240,17243,17248,17261,17267,17279,17285,17291,1,8834,59,1,10949,111,116,59,1,10941,4,2,59,100,17254,17256,1,8838,111,116,59,1,10947,117,108,116,59,1,10945,4,2,69,101,17273,17276,59,1,10955,59,1,8842,108,117,115,59,1,10943,97,114,114,59,1,10617,4,3,101,105,117,17299,17335,17339,116,4,3,59,101,110,17308,17310,17322,1,8834,113,4,2,59,113,17317,17319,1,8838,59,1,10949,101,113,4,2,59,113,17330,17332,1,8842,59,1,10955,109,59,1,10951,4,2,98,112,17345,17348,59,1,10965,59,1,10963,99,4,6,59,97,99,101,110,115,17366,17368,17376,17385,17389,17415,1,8827,112,112,114,111,120,59,1,10936,117,114,108,121,101,113,59,1,8829,113,59,1,10928,4,3,97,101,115,17397,17405,17410,112,112,114,111,120,59,1,10938,113,113,59,1,10934,105,109,59,1,8937,105,109,59,1,8831,59,1,8721,103,59,1,9834,4,13,49,50,51,59,69,100,101,104,108,109,110,112,115,17455,17462,17469,17476,17478,17481,17496,17509,17524,17530,17536,17548,17554,5,185,1,59,17460,1,185,5,178,1,59,17467,1,178,5,179,1,59,17474,1,179,1,8835,59,1,10950,4,2,111,115,17487,17491,116,59,1,10942,117,98,59,1,10968,4,2,59,100,17502,17504,1,8839,111,116,59,1,10948,115,4,2,111,117,17516,17520,108,59,1,10185,98,59,1,10967,97,114,114,59,1,10619,117,108,116,59,1,10946,4,2,69,101,17542,17545,59,1,10956,59,1,8843,108,117,115,59,1,10944,4,3,101,105,117,17562,17598,17602,116,4,3,59,101,110,17571,17573,17585,1,8835,113,4,2,59,113,17580,17582,1,8839,59,1,10950,101,113,4,2,59,113,17593,17595,1,8843,59,1,10956,109,59,1,10952,4,2,98,112,17608,17611,59,1,10964,59,1,10966,4,3,65,97,110,17622,17627,17650,114,114,59,1,8665,114,4,2,104,114,17634,17638,107,59,1,10534,4,2,59,111,17644,17646,1,8601,119,59,1,8601,119,97,114,59,1,10538,108,105,103,5,223,1,59,17664,1,223,4,13,97,98,99,100,101,102,104,105,111,112,114,115,119,17694,17709,17714,17737,17742,17749,17754,17860,17905,17957,17964,18090,18122,4,2,114,117,17700,17706,103,101,116,59,1,8982,59,1,964,114,107,59,1,9140,4,3,97,101,121,17722,17728,17734,114,111,110,59,1,357,100,105,108,59,1,355,59,1,1090,111,116,59,1,8411,108,114,101,99,59,1,8981,114,59,3,55349,56625,4,4,101,105,107,111,17764,17805,17836,17851,4,2,114,116,17770,17786,101,4,2,52,102,17777,17780,59,1,8756,111,114,101,59,1,8756,97,4,3,59,115,118,17795,17797,17802,1,952,121,109,59,1,977,59,1,977,4,2,99,110,17811,17831,107,4,2,97,115,17818,17826,112,112,114,111,120,59,1,8776,105,109,59,1,8764,115,112,59,1,8201,4,2,97,115,17842,17846,112,59,1,8776,105,109,59,1,8764,114,110,5,254,1,59,17858,1,254,4,3,108,109,110,17868,17873,17901,100,101,59,1,732,101,115,5,215,3,59,98,100,17884,17886,17898,1,215,4,2,59,97,17892,17894,1,8864,114,59,1,10801,59,1,10800,116,59,1,8749,4,3,101,112,115,17913,17917,17953,97,59,1,10536,4,4,59,98,99,102,17927,17929,17934,17939,1,8868,111,116,59,1,9014,105,114,59,1,10993,4,2,59,111,17945,17948,3,55349,56677,114,107,59,1,10970,97,59,1,10537,114,105,109,101,59,1,8244,4,3,97,105,112,17972,17977,18082,100,101,59,1,8482,4,7,97,100,101,109,112,115,116,17993,18051,18056,18059,18066,18072,18076,110,103,108,101,4,5,59,100,108,113,114,18009,18011,18017,18032,18035,1,9653,111,119,110,59,1,9663,101,102,116,4,2,59,101,18026,18028,1,9667,113,59,1,8884,59,1,8796,105,103,104,116,4,2,59,101,18045,18047,1,9657,113,59,1,8885,111,116,59,1,9708,59,1,8796,105,110,117,115,59,1,10810,108,117,115,59,1,10809,98,59,1,10701,105,109,101,59,1,10811,101,122,105,117,109,59,1,9186,4,3,99,104,116,18098,18111,18116,4,2,114,121,18104,18108,59,3,55349,56521,59,1,1094,99,121,59,1,1115,114,111,107,59,1,359,4,2,105,111,18128,18133,120,116,59,1,8812,104,101,97,100,4,2,108,114,18143,18154,101,102,116,97,114,114,111,119,59,1,8606,105,103,104,116,97,114,114,111,119,59,1,8608,4,18,65,72,97,98,99,100,102,103,104,108,109,111,112,114,115,116,117,119,18204,18209,18214,18234,18250,18268,18292,18308,18319,18343,18379,18397,18413,18504,18547,18553,18584,18603,114,114,59,1,8657,97,114,59,1,10595,4,2,99,114,18220,18230,117,116,101,5,250,1,59,18228,1,250,114,59,1,8593,114,4,2,99,101,18241,18245,121,59,1,1118,118,101,59,1,365,4,2,105,121,18256,18265,114,99,5,251,1,59,18263,1,251,59,1,1091,4,3,97,98,104,18276,18281,18287,114,114,59,1,8645,108,97,99,59,1,369,97,114,59,1,10606,4,2,105,114,18298,18304,115,104,116,59,1,10622,59,3,55349,56626,114,97,118,101,5,249,1,59,18317,1,249,4,2,97,98,18325,18338,114,4,2,108,114,18332,18335,59,1,8639,59,1,8638,108,107,59,1,9600,4,2,99,116,18349,18374,4,2,111,114,18355,18369,114,110,4,2,59,101,18363,18365,1,8988,114,59,1,8988,111,112,59,1,8975,114,105,59,1,9720,4,2,97,108,18385,18390,99,114,59,1,363,5,168,1,59,18395,1,168,4,2,103,112,18403,18408,111,110,59,1,371,102,59,3,55349,56678,4,6,97,100,104,108,115,117,18427,18434,18445,18470,18475,18494,114,114,111,119,59,1,8593,111,119,110,97,114,114,111,119,59,1,8597,97,114,112,111,111,110,4,2,108,114,18457,18463,101,102,116,59,1,8639,105,103,104,116,59,1,8638,117,115,59,1,8846,105,4,3,59,104,108,18484,18486,18489,1,965,59,1,978,111,110,59,1,965,112,97,114,114,111,119,115,59,1,8648,4,3,99,105,116,18512,18537,18542,4,2,111,114,18518,18532,114,110,4,2,59,101,18526,18528,1,8989,114,59,1,8989,111,112,59,1,8974,110,103,59,1,367,114,105,59,1,9721,99,114,59,3,55349,56522,4,3,100,105,114,18561,18566,18572,111,116,59,1,8944,108,100,101,59,1,361,105,4,2,59,102,18579,18581,1,9653,59,1,9652,4,2,97,109,18590,18595,114,114,59,1,8648,108,5,252,1,59,18601,1,252,97,110,103,108,101,59,1,10663,4,15,65,66,68,97,99,100,101,102,108,110,111,112,114,115,122,18643,18648,18661,18667,18847,18851,18857,18904,18909,18915,18931,18937,18943,18949,18996,114,114,59,1,8661,97,114,4,2,59,118,18656,18658,1,10984,59,1,10985,97,115,104,59,1,8872,4,2,110,114,18673,18679,103,114,116,59,1,10652,4,7,101,107,110,112,114,115,116,18695,18704,18711,18720,18742,18754,18810,112,115,105,108,111,110,59,1,1013,97,112,112,97,59,1,1008,111,116,104,105,110,103,59,1,8709,4,3,104,105,114,18728,18732,18735,105,59,1,981,59,1,982,111,112,116,111,59,1,8733,4,2,59,104,18748,18750,1,8597,111,59,1,1009,4,2,105,117,18760,18766,103,109,97,59,1,962,4,2,98,112,18772,18791,115,101,116,110,101,113,4,2,59,113,18784,18787,3,8842,65024,59,3,10955,65024,115,101,116,110,101,113,4,2,59,113,18803,18806,3,8843,65024,59,3,10956,65024,4,2,104,114,18816,18822,101,116,97,59,1,977,105,97,110,103,108,101,4,2,108,114,18834,18840,101,102,116,59,1,8882,105,103,104,116,59,1,8883,121,59,1,1074,97,115,104,59,1,8866,4,3,101,108,114,18865,18884,18890,4,3,59,98,101,18873,18875,18880,1,8744,97,114,59,1,8891,113,59,1,8794,108,105,112,59,1,8942,4,2,98,116,18896,18901,97,114,59,1,124,59,1,124,114,59,3,55349,56627,116,114,105,59,1,8882,115,117,4,2,98,112,18923,18927,59,3,8834,8402,59,3,8835,8402,112,102,59,3,55349,56679,114,111,112,59,1,8733,116,114,105,59,1,8883,4,2,99,117,18955,18960,114,59,3,55349,56523,4,2,98,112,18966,18981,110,4,2,69,101,18973,18977,59,3,10955,65024,59,3,8842,65024,110,4,2,69,101,18988,18992,59,3,10956,65024,59,3,8843,65024,105,103,122,97,103,59,1,10650,4,7,99,101,102,111,112,114,115,19020,19026,19061,19066,19072,19075,19089,105,114,99,59,1,373,4,2,100,105,19032,19055,4,2,98,103,19038,19043,97,114,59,1,10847,101,4,2,59,113,19050,19052,1,8743,59,1,8793,101,114,112,59,1,8472,114,59,3,55349,56628,112,102,59,3,55349,56680,59,1,8472,4,2,59,101,19081,19083,1,8768,97,116,104,59,1,8768,99,114,59,3,55349,56524,4,14,99,100,102,104,105,108,109,110,111,114,115,117,118,119,19125,19146,19152,19157,19173,19176,19192,19197,19202,19236,19252,19269,19286,19291,4,3,97,105,117,19133,19137,19142,112,59,1,8898,114,99,59,1,9711,112,59,1,8899,116,114,105,59,1,9661,114,59,3,55349,56629,4,2,65,97,19163,19168,114,114,59,1,10234,114,114,59,1,10231,59,1,958,4,2,65,97,19182,19187,114,114,59,1,10232,114,114,59,1,10229,97,112,59,1,10236,105,115,59,1,8955,4,3,100,112,116,19210,19215,19230,111,116,59,1,10752,4,2,102,108,19221,19225,59,3,55349,56681,117,115,59,1,10753,105,109,101,59,1,10754,4,2,65,97,19242,19247,114,114,59,1,10233,114,114,59,1,10230,4,2,99,113,19258,19263,114,59,3,55349,56525,99,117,112,59,1,10758,4,2,112,116,19275,19281,108,117,115,59,1,10756,114,105,59,1,9651,101,101,59,1,8897,101,100,103,101,59,1,8896,4,8,97,99,101,102,105,111,115,117,19316,19335,19349,19357,19362,19367,19373,19379,99,4,2,117,121,19323,19332,116,101,5,253,1,59,19330,1,253,59,1,1103,4,2,105,121,19341,19346,114,99,59,1,375,59,1,1099,110,5,165,1,59,19355,1,165,114,59,3,55349,56630,99,121,59,1,1111,112,102,59,3,55349,56682,99,114,59,3,55349,56526,4,2,99,109,19385,19389,121,59,1,1102,108,5,255,1,59,19395,1,255,4,10,97,99,100,101,102,104,105,111,115,119,19419,19426,19441,19446,19462,19467,19472,19480,19486,19492,99,117,116,101,59,1,378,4,2,97,121,19432,19438,114,111,110,59,1,382,59,1,1079,111,116,59,1,380,4,2,101,116,19452,19458,116,114,102,59,1,8488,97,59,1,950,114,59,3,55349,56631,99,121,59,1,1078,103,114,97,114,114,59,1,8669,112,102,59,3,55349,56683,99,114,59,3,55349,56527,4,2,106,110,19498,19501,59,1,8205,106,59,1,8204]); - -/***/ }), -/* 119 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -var UNICODE = __webpack_require__(18); - -//Aliases -var $ = UNICODE.CODE_POINTS; - -//Utils - -//OPTIMIZATION: these utility functions should not be moved out of this module. V8 Crankshaft will not inline -//this functions if they will be situated in another module due to context switch. -//Always perform inlining check before modifying this functions ('node --trace-inlining'). -function isSurrogatePair(cp1, cp2) { - return cp1 >= 0xD800 && cp1 <= 0xDBFF && cp2 >= 0xDC00 && cp2 <= 0xDFFF; -} - -function getSurrogatePairCodePoint(cp1, cp2) { - return (cp1 - 0xD800) * 0x400 + 0x2400 + cp2; -} - - -//Const -var DEFAULT_BUFFER_WATERLINE = 1 << 16; - - -//Preprocessor -//NOTE: HTML input preprocessing -//(see: http://www.whatwg.org/specs/web-apps/current-work/multipage/parsing.html#preprocessing-the-input-stream) -var Preprocessor = module.exports = function () { - this.html = null; - - this.pos = -1; - this.lastGapPos = -1; - this.lastCharPos = -1; - this.droppedBufferSize = 0; - - this.gapStack = []; - - this.skipNextNewLine = false; - - this.lastChunkWritten = false; - this.endOfChunkHit = false; - this.bufferWaterline = DEFAULT_BUFFER_WATERLINE; -}; - -Object.defineProperty(Preprocessor.prototype, 'sourcePos', { - get: function () { - return this.droppedBufferSize + this.pos; - } -}); - -Preprocessor.prototype.dropParsedChunk = function () { - if (this.pos > this.bufferWaterline) { - this.lastCharPos -= this.pos; - this.droppedBufferSize += this.pos; - this.html = this.html.substring(this.pos); - this.pos = 0; - this.lastGapPos = -1; - this.gapStack = []; - } -}; - -Preprocessor.prototype._addGap = function () { - this.gapStack.push(this.lastGapPos); - this.lastGapPos = this.pos; -}; - -Preprocessor.prototype._processHighRangeCodePoint = function (cp) { - //NOTE: try to peek a surrogate pair - if (this.pos !== this.lastCharPos) { - var nextCp = this.html.charCodeAt(this.pos + 1); - - if (isSurrogatePair(cp, nextCp)) { - //NOTE: we have a surrogate pair. Peek pair character and recalculate code point. - this.pos++; - cp = getSurrogatePairCodePoint(cp, nextCp); - - //NOTE: add gap that should be avoided during retreat - this._addGap(); - } - } - - // NOTE: we've hit the end of chunk, stop processing at this point - else if (!this.lastChunkWritten) { - this.endOfChunkHit = true; - return $.EOF; - } - - return cp; -}; - -Preprocessor.prototype.write = function (chunk, isLastChunk) { - if (this.html) - this.html += chunk; - - else - this.html = chunk; - - this.lastCharPos = this.html.length - 1; - this.endOfChunkHit = false; - this.lastChunkWritten = isLastChunk; -}; - -Preprocessor.prototype.insertHtmlAtCurrentPos = function (chunk) { - this.html = this.html.substring(0, this.pos + 1) + - chunk + - this.html.substring(this.pos + 1, this.html.length); - - this.lastCharPos = this.html.length - 1; - this.endOfChunkHit = false; -}; - - -Preprocessor.prototype.advance = function () { - this.pos++; - - if (this.pos > this.lastCharPos) { - if (!this.lastChunkWritten) - this.endOfChunkHit = true; - - return $.EOF; - } - - var cp = this.html.charCodeAt(this.pos); - - //NOTE: any U+000A LINE FEED (LF) characters that immediately follow a U+000D CARRIAGE RETURN (CR) character - //must be ignored. - if (this.skipNextNewLine && cp === $.LINE_FEED) { - this.skipNextNewLine = false; - this._addGap(); - return this.advance(); - } - - //NOTE: all U+000D CARRIAGE RETURN (CR) characters must be converted to U+000A LINE FEED (LF) characters - if (cp === $.CARRIAGE_RETURN) { - this.skipNextNewLine = true; - return $.LINE_FEED; - } - - this.skipNextNewLine = false; - - //OPTIMIZATION: first perform check if the code point in the allowed range that covers most common - //HTML input (e.g. ASCII codes) to avoid performance-cost operations for high-range code points. - return cp >= 0xD800 ? this._processHighRangeCodePoint(cp) : cp; -}; - -Preprocessor.prototype.retreat = function () { - if (this.pos === this.lastGapPos) { - this.lastGapPos = this.gapStack.pop(); - this.pos--; - } - - this.pos--; -}; - - - -/***/ }), -/* 120 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -var doctype = __webpack_require__(33), - DOCUMENT_MODE = __webpack_require__(11).DOCUMENT_MODE; - - -//Conversion tables for DOM Level1 structure emulation -var nodeTypes = { - element: 1, - text: 3, - cdata: 4, - comment: 8 -}; - -var nodePropertyShorthands = { - tagName: 'name', - childNodes: 'children', - parentNode: 'parent', - previousSibling: 'prev', - nextSibling: 'next', - nodeValue: 'data' -}; - -//Node -var Node = function (props) { - for (var key in props) { - if (props.hasOwnProperty(key)) - this[key] = props[key]; - } -}; - -Node.prototype = { - get firstChild() { - var children = this.children; - - return children && children[0] || null; - }, - - get lastChild() { - var children = this.children; - - return children && children[children.length - 1] || null; - }, - - get nodeType() { - return nodeTypes[this.type] || nodeTypes.element; - } -}; - -Object.keys(nodePropertyShorthands).forEach(function (key) { - var shorthand = nodePropertyShorthands[key]; - - Object.defineProperty(Node.prototype, key, { - get: function () { - return this[shorthand] || null; - }, - set: function (val) { - this[shorthand] = val; - return val; - } - }); -}); - - -//Node construction -exports.createDocument = function () { - return new Node({ - type: 'root', - name: 'root', - parent: null, - prev: null, - next: null, - children: [], - 'x-mode': DOCUMENT_MODE.NO_QUIRKS - }); -}; - -exports.createDocumentFragment = function () { - return new Node({ - type: 'root', - name: 'root', - parent: null, - prev: null, - next: null, - children: [] - }); -}; - -exports.createElement = function (tagName, namespaceURI, attrs) { - var attribs = Object.create(null), - attribsNamespace = Object.create(null), - attribsPrefix = Object.create(null); - - for (var i = 0; i < attrs.length; i++) { - var attrName = attrs[i].name; - - attribs[attrName] = attrs[i].value; - attribsNamespace[attrName] = attrs[i].namespace; - attribsPrefix[attrName] = attrs[i].prefix; - } - - return new Node({ - type: tagName === 'script' || tagName === 'style' ? tagName : 'tag', - name: tagName, - namespace: namespaceURI, - attribs: attribs, - 'x-attribsNamespace': attribsNamespace, - 'x-attribsPrefix': attribsPrefix, - children: [], - parent: null, - prev: null, - next: null - }); -}; - -exports.createCommentNode = function (data) { - return new Node({ - type: 'comment', - data: data, - parent: null, - prev: null, - next: null - }); -}; - -var createTextNode = function (value) { - return new Node({ - type: 'text', - data: value, - parent: null, - prev: null, - next: null - }); -}; - - -//Tree mutation -var appendChild = exports.appendChild = function (parentNode, newNode) { - var prev = parentNode.children[parentNode.children.length - 1]; - - if (prev) { - prev.next = newNode; - newNode.prev = prev; - } - - parentNode.children.push(newNode); - newNode.parent = parentNode; -}; - -var insertBefore = exports.insertBefore = function (parentNode, newNode, referenceNode) { - var insertionIdx = parentNode.children.indexOf(referenceNode), - prev = referenceNode.prev; - - if (prev) { - prev.next = newNode; - newNode.prev = prev; - } - - referenceNode.prev = newNode; - newNode.next = referenceNode; - - parentNode.children.splice(insertionIdx, 0, newNode); - newNode.parent = parentNode; -}; - -exports.setTemplateContent = function (templateElement, contentElement) { - appendChild(templateElement, contentElement); -}; - -exports.getTemplateContent = function (templateElement) { - return templateElement.children[0]; -}; - -exports.setDocumentType = function (document, name, publicId, systemId) { - var data = doctype.serializeContent(name, publicId, systemId), - doctypeNode = null; - - for (var i = 0; i < document.children.length; i++) { - if (document.children[i].type === 'directive' && document.children[i].name === '!doctype') { - doctypeNode = document.children[i]; - break; - } - } - - if (doctypeNode) { - doctypeNode.data = data; - doctypeNode['x-name'] = name; - doctypeNode['x-publicId'] = publicId; - doctypeNode['x-systemId'] = systemId; - } - - else { - appendChild(document, new Node({ - type: 'directive', - name: '!doctype', - data: data, - 'x-name': name, - 'x-publicId': publicId, - 'x-systemId': systemId - })); - } - -}; - -exports.setDocumentMode = function (document, mode) { - document['x-mode'] = mode; -}; - -exports.getDocumentMode = function (document) { - return document['x-mode']; -}; - -exports.detachNode = function (node) { - if (node.parent) { - var idx = node.parent.children.indexOf(node), - prev = node.prev, - next = node.next; - - node.prev = null; - node.next = null; - - if (prev) - prev.next = next; - - if (next) - next.prev = prev; - - node.parent.children.splice(idx, 1); - node.parent = null; - } -}; - -exports.insertText = function (parentNode, text) { - var lastChild = parentNode.children[parentNode.children.length - 1]; - - if (lastChild && lastChild.type === 'text') - lastChild.data += text; - else - appendChild(parentNode, createTextNode(text)); -}; - -exports.insertTextBefore = function (parentNode, text, referenceNode) { - var prevNode = parentNode.children[parentNode.children.indexOf(referenceNode) - 1]; - - if (prevNode && prevNode.type === 'text') - prevNode.data += text; - else - insertBefore(parentNode, createTextNode(text), referenceNode); -}; - -exports.adoptAttributes = function (recipient, attrs) { - for (var i = 0; i < attrs.length; i++) { - var attrName = attrs[i].name; - - if (typeof recipient.attribs[attrName] === 'undefined') { - recipient.attribs[attrName] = attrs[i].value; - recipient['x-attribsNamespace'][attrName] = attrs[i].namespace; - recipient['x-attribsPrefix'][attrName] = attrs[i].prefix; - } - } -}; - - -//Tree traversing -exports.getFirstChild = function (node) { - return node.children[0]; -}; - -exports.getChildNodes = function (node) { - return node.children; -}; - -exports.getParentNode = function (node) { - return node.parent; -}; - -exports.getAttrList = function (element) { - var attrList = []; - - for (var name in element.attribs) { - attrList.push({ - name: name, - value: element.attribs[name], - namespace: element['x-attribsNamespace'][name], - prefix: element['x-attribsPrefix'][name] - }); - } - - return attrList; -}; - - -//Node data -exports.getTagName = function (element) { - return element.name; -}; - -exports.getNamespaceURI = function (element) { - return element.namespace; -}; - -exports.getTextNodeContent = function (textNode) { - return textNode.data; -}; - -exports.getCommentNodeContent = function (commentNode) { - return commentNode.data; -}; - -exports.getDocumentTypeNodeName = function (doctypeNode) { - return doctypeNode['x-name']; -}; - -exports.getDocumentTypeNodePublicId = function (doctypeNode) { - return doctypeNode['x-publicId']; -}; - -exports.getDocumentTypeNodeSystemId = function (doctypeNode) { - return doctypeNode['x-systemId']; -}; - - -//Node types -exports.isTextNode = function (node) { - return node.type === 'text'; -}; - -exports.isCommentNode = function (node) { - return node.type === 'comment'; -}; - -exports.isDocumentTypeNode = function (node) { - return node.type === 'directive' && node.name === '!doctype'; -}; - -exports.isElementNode = function (node) { - return !!node.attribs; -}; - - -/***/ }), -/* 121 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -/* tslint:disable:no-unused-variable */ -// Subject imported before Observable to bypass circular dependency issue since -// Subject extends Observable and Observable references Subject in it's -// definition -var Subject_1 = __webpack_require__(6); -exports.Subject = Subject_1.Subject; -exports.AnonymousSubject = Subject_1.AnonymousSubject; -/* tslint:enable:no-unused-variable */ -var Observable_1 = __webpack_require__(0); -exports.Observable = Observable_1.Observable; -// statics -/* tslint:disable:no-use-before-declare */ -__webpack_require__(123); -__webpack_require__(124); -__webpack_require__(125); -__webpack_require__(126); -__webpack_require__(127); -__webpack_require__(130); -__webpack_require__(131); -__webpack_require__(132); -__webpack_require__(133); -__webpack_require__(134); -__webpack_require__(135); -__webpack_require__(136); -__webpack_require__(137); -__webpack_require__(54); -__webpack_require__(138); -__webpack_require__(143); -__webpack_require__(139); -__webpack_require__(140); -__webpack_require__(141); -__webpack_require__(142); -__webpack_require__(144); -__webpack_require__(145); -__webpack_require__(55); -__webpack_require__(56); -__webpack_require__(146); -//dom -__webpack_require__(128); -__webpack_require__(129); -//operators -__webpack_require__(149); -__webpack_require__(150); -__webpack_require__(151); -__webpack_require__(152); -__webpack_require__(153); -__webpack_require__(57); -__webpack_require__(154); -__webpack_require__(155); -__webpack_require__(156); -__webpack_require__(157); -__webpack_require__(158); -__webpack_require__(159); -__webpack_require__(160); -__webpack_require__(166); -__webpack_require__(161); -__webpack_require__(162); -__webpack_require__(163); -__webpack_require__(164); -__webpack_require__(165); -__webpack_require__(167); -__webpack_require__(168); -__webpack_require__(169); -__webpack_require__(170); -__webpack_require__(173); -__webpack_require__(174); -__webpack_require__(175); -__webpack_require__(171); -__webpack_require__(176); -__webpack_require__(177); -__webpack_require__(178); -__webpack_require__(179); -__webpack_require__(45); -__webpack_require__(180); -__webpack_require__(181); -__webpack_require__(182); -__webpack_require__(147); -__webpack_require__(148); -__webpack_require__(183); -__webpack_require__(184); -__webpack_require__(172); -__webpack_require__(58); -__webpack_require__(185); -__webpack_require__(186); -__webpack_require__(187); -__webpack_require__(188); -__webpack_require__(189); -__webpack_require__(190); -__webpack_require__(191); -__webpack_require__(192); -__webpack_require__(193); -__webpack_require__(194); -__webpack_require__(195); -__webpack_require__(196); -__webpack_require__(197); -__webpack_require__(198); -__webpack_require__(199); -__webpack_require__(200); -__webpack_require__(201); -__webpack_require__(203); -__webpack_require__(202); -__webpack_require__(204); -__webpack_require__(205); -__webpack_require__(206); -__webpack_require__(207); -__webpack_require__(208); -__webpack_require__(209); -__webpack_require__(210); -__webpack_require__(211); -__webpack_require__(212); -__webpack_require__(213); -__webpack_require__(214); -__webpack_require__(215); -__webpack_require__(216); -__webpack_require__(217); -__webpack_require__(218); -__webpack_require__(219); -__webpack_require__(220); -__webpack_require__(221); -__webpack_require__(222); -__webpack_require__(223); -__webpack_require__(224); -__webpack_require__(225); -__webpack_require__(226); -__webpack_require__(227); -__webpack_require__(228); -__webpack_require__(229); -__webpack_require__(230); -__webpack_require__(231); -__webpack_require__(232); -__webpack_require__(233); -__webpack_require__(234); -__webpack_require__(235); -__webpack_require__(236); -__webpack_require__(237); -__webpack_require__(238); -__webpack_require__(239); -__webpack_require__(240); -__webpack_require__(241); -__webpack_require__(242); -__webpack_require__(243); -__webpack_require__(244); -__webpack_require__(245); -/* tslint:disable:no-unused-variable */ -var Subscription_1 = __webpack_require__(9); -exports.Subscription = Subscription_1.Subscription; -var Subscriber_1 = __webpack_require__(2); -exports.Subscriber = Subscriber_1.Subscriber; -var AsyncSubject_1 = __webpack_require__(25); -exports.AsyncSubject = AsyncSubject_1.AsyncSubject; -var ReplaySubject_1 = __webpack_require__(26); -exports.ReplaySubject = ReplaySubject_1.ReplaySubject; -var BehaviorSubject_1 = __webpack_require__(41); -exports.BehaviorSubject = BehaviorSubject_1.BehaviorSubject; -var ConnectableObservable_1 = __webpack_require__(386); -exports.ConnectableObservable = ConnectableObservable_1.ConnectableObservable; -var Notification_1 = __webpack_require__(30); -exports.Notification = Notification_1.Notification; -var EmptyError_1 = __webpack_require__(79); -exports.EmptyError = EmptyError_1.EmptyError; -var ArgumentOutOfRangeError_1 = __webpack_require__(22); -exports.ArgumentOutOfRangeError = ArgumentOutOfRangeError_1.ArgumentOutOfRangeError; -var ObjectUnsubscribedError_1 = __webpack_require__(80); -exports.ObjectUnsubscribedError = ObjectUnsubscribedError_1.ObjectUnsubscribedError; -var TimeoutError_1 = __webpack_require__(74); -exports.TimeoutError = TimeoutError_1.TimeoutError; -var UnsubscriptionError_1 = __webpack_require__(399); -exports.UnsubscriptionError = UnsubscriptionError_1.UnsubscriptionError; -var timeInterval_1 = __webpack_require__(66); -exports.TimeInterval = timeInterval_1.TimeInterval; -var timestamp_1 = __webpack_require__(67); -exports.Timestamp = timestamp_1.Timestamp; -var TestScheduler_1 = __webpack_require__(366); -exports.TestScheduler = TestScheduler_1.TestScheduler; -var VirtualTimeScheduler_1 = __webpack_require__(69); -exports.VirtualTimeScheduler = VirtualTimeScheduler_1.VirtualTimeScheduler; -var AjaxObservable_1 = __webpack_require__(59); -exports.AjaxResponse = AjaxObservable_1.AjaxResponse; -exports.AjaxError = AjaxObservable_1.AjaxError; -exports.AjaxTimeoutError = AjaxObservable_1.AjaxTimeoutError; -var asap_1 = __webpack_require__(70); -var async_1 = __webpack_require__(8); -var queue_1 = __webpack_require__(71); -var animationFrame_1 = __webpack_require__(363); -var rxSubscriber_1 = __webpack_require__(379); -var iterator_1 = __webpack_require__(78); -var observable_1 = __webpack_require__(378); -/* tslint:enable:no-unused-variable */ -/** - * @typedef {Object} Rx.Scheduler - * @property {Scheduler} queue Schedules on a queue in the current event frame - * (trampoline scheduler). Use this for iteration operations. - * @property {Scheduler} asap Schedules on the micro task queue, which uses the - * fastest transport mechanism available, either Node.js' `process.nextTick()` - * or Web Worker MessageChannel or setTimeout or others. Use this for - * asynchronous conversions. - * @property {Scheduler} async Schedules work with `setInterval`. Use this for - * time-based operations. - * @property {Scheduler} animationFrame Schedules work with `requestAnimationFrame`. - * Use this for synchronizing with the platform's painting - */ -var Scheduler = { - asap: asap_1.asap, - queue: queue_1.queue, - animationFrame: animationFrame_1.animationFrame, - async: async_1.async -}; -exports.Scheduler = Scheduler; -/** - * @typedef {Object} Rx.Symbol - * @property {Symbol|string} rxSubscriber A symbol to use as a property name to - * retrieve an "Rx safe" Observer from an object. "Rx safety" can be defined as - * an object that has all of the traits of an Rx Subscriber, including the - * ability to add and remove subscriptions to the subscription chain and - * guarantees involving event triggering (can't "next" after unsubscription, - * etc). - * @property {Symbol|string} observable A symbol to use as a property name to - * retrieve an Observable as defined by the [ECMAScript "Observable" spec](https://github.com/zenparsing/es-observable). - * @property {Symbol|string} iterator The ES6 symbol to use as a property name - * to retrieve an iterator from an object. - */ -var Symbol = { - rxSubscriber: rxSubscriber_1.rxSubscriber, - observable: observable_1.observable, - iterator: iterator_1.iterator -}; -exports.Symbol = Symbol; -//# sourceMappingURL=Rx.js.map - -/***/ }), -/* 122 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -/** - * An execution context and a data structure to order tasks and schedule their - * execution. Provides a notion of (potentially virtual) time, through the - * `now()` getter method. - * - * Each unit of work in a Scheduler is called an {@link Action}. - * - * ```ts - * class Scheduler { - * now(): number; - * schedule(work, delay?, state?): Subscription; - * } - * ``` - * - * @class Scheduler - */ -var Scheduler = (function () { - function Scheduler(SchedulerAction, now) { - if (now === void 0) { now = Scheduler.now; } - this.SchedulerAction = SchedulerAction; - this.now = now; - } - /** - * Schedules a function, `work`, for execution. May happen at some point in - * the future, according to the `delay` parameter, if specified. May be passed - * some context object, `state`, which will be passed to the `work` function. - * - * The given arguments will be processed an stored as an Action object in a - * queue of actions. - * - * @param {function(state: ?T): ?Subscription} work A function representing a - * task, or some unit of work to be executed by the Scheduler. - * @param {number} [delay] Time to wait before executing the work, where the - * time unit is implicit and defined by the Scheduler itself. - * @param {T} [state] Some contextual data that the `work` function uses when - * called by the Scheduler. - * @return {Subscription} A subscription in order to be able to unsubscribe - * the scheduled work. - */ - Scheduler.prototype.schedule = function (work, delay, state) { - if (delay === void 0) { delay = 0; } - return new this.SchedulerAction(this, work).schedule(state, delay); - }; - Scheduler.now = Date.now ? Date.now : function () { return +new Date(); }; - return Scheduler; -}()); -exports.Scheduler = Scheduler; -//# sourceMappingURL=Scheduler.js.map - -/***/ }), -/* 123 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var bindCallback_1 = __webpack_require__(261); -Observable_1.Observable.bindCallback = bindCallback_1.bindCallback; -//# sourceMappingURL=bindCallback.js.map - -/***/ }), -/* 124 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var bindNodeCallback_1 = __webpack_require__(262); -Observable_1.Observable.bindNodeCallback = bindNodeCallback_1.bindNodeCallback; -//# sourceMappingURL=bindNodeCallback.js.map - -/***/ }), -/* 125 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var combineLatest_1 = __webpack_require__(263); -Observable_1.Observable.combineLatest = combineLatest_1.combineLatest; -//# sourceMappingURL=combineLatest.js.map - -/***/ }), -/* 126 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var concat_1 = __webpack_require__(264); -Observable_1.Observable.concat = concat_1.concat; -//# sourceMappingURL=concat.js.map - -/***/ }), -/* 127 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var defer_1 = __webpack_require__(265); -Observable_1.Observable.defer = defer_1.defer; -//# sourceMappingURL=defer.js.map - -/***/ }), -/* 128 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var ajax_1 = __webpack_require__(267); -Observable_1.Observable.ajax = ajax_1.ajax; -//# sourceMappingURL=ajax.js.map - -/***/ }), -/* 129 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var webSocket_1 = __webpack_require__(268); -Observable_1.Observable.webSocket = webSocket_1.webSocket; -//# sourceMappingURL=webSocket.js.map - -/***/ }), -/* 130 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var empty_1 = __webpack_require__(269); -Observable_1.Observable.empty = empty_1.empty; -//# sourceMappingURL=empty.js.map - -/***/ }), -/* 131 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var forkJoin_1 = __webpack_require__(388); -Observable_1.Observable.forkJoin = forkJoin_1.forkJoin; -//# sourceMappingURL=forkJoin.js.map - -/***/ }), -/* 132 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var from_1 = __webpack_require__(389); -Observable_1.Observable.from = from_1.from; -//# sourceMappingURL=from.js.map - -/***/ }), -/* 133 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var fromEvent_1 = __webpack_require__(270); -Observable_1.Observable.fromEvent = fromEvent_1.fromEvent; -//# sourceMappingURL=fromEvent.js.map - -/***/ }), -/* 134 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var fromEventPattern_1 = __webpack_require__(271); -Observable_1.Observable.fromEventPattern = fromEventPattern_1.fromEventPattern; -//# sourceMappingURL=fromEventPattern.js.map - -/***/ }), -/* 135 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var fromPromise_1 = __webpack_require__(382); -Observable_1.Observable.fromPromise = fromPromise_1.fromPromise; -//# sourceMappingURL=fromPromise.js.map - -/***/ }), -/* 136 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var GenerateObservable_1 = __webpack_require__(252); -Observable_1.Observable.generate = GenerateObservable_1.GenerateObservable.create; -//# sourceMappingURL=generate.js.map - -/***/ }), -/* 137 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var if_1 = __webpack_require__(272); -Observable_1.Observable.if = if_1._if; -//# sourceMappingURL=if.js.map - -/***/ }), -/* 138 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var merge_1 = __webpack_require__(390); -Observable_1.Observable.merge = merge_1.merge; -//# sourceMappingURL=merge.js.map - -/***/ }), -/* 139 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var never_1 = __webpack_require__(274); -Observable_1.Observable.never = never_1.never; -//# sourceMappingURL=never.js.map - -/***/ }), -/* 140 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var of_1 = __webpack_require__(391); -Observable_1.Observable.of = of_1.of; -//# sourceMappingURL=of.js.map - -/***/ }), -/* 141 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var onErrorResumeNext_1 = __webpack_require__(63); -Observable_1.Observable.onErrorResumeNext = onErrorResumeNext_1.onErrorResumeNextStatic; -//# sourceMappingURL=onErrorResumeNext.js.map - -/***/ }), -/* 142 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var pairs_1 = __webpack_require__(275); -Observable_1.Observable.pairs = pairs_1.pairs; -//# sourceMappingURL=pairs.js.map - -/***/ }), -/* 143 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var race_1 = __webpack_require__(64); -Observable_1.Observable.race = race_1.raceStatic; -//# sourceMappingURL=race.js.map - -/***/ }), -/* 144 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var range_1 = __webpack_require__(276); -Observable_1.Observable.range = range_1.range; -//# sourceMappingURL=range.js.map - -/***/ }), -/* 145 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var using_1 = __webpack_require__(279); -Observable_1.Observable.using = using_1.using; -//# sourceMappingURL=using.js.map - -/***/ }), -/* 146 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var zip_1 = __webpack_require__(280); -Observable_1.Observable.zip = zip_1.zip; -//# sourceMappingURL=zip.js.map - -/***/ }), -/* 147 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var audit_1 = __webpack_require__(281); -Observable_1.Observable.prototype.audit = audit_1.audit; -//# sourceMappingURL=audit.js.map - -/***/ }), -/* 148 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var auditTime_1 = __webpack_require__(282); -Observable_1.Observable.prototype.auditTime = auditTime_1.auditTime; -//# sourceMappingURL=auditTime.js.map - -/***/ }), -/* 149 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var buffer_1 = __webpack_require__(283); -Observable_1.Observable.prototype.buffer = buffer_1.buffer; -//# sourceMappingURL=buffer.js.map - -/***/ }), -/* 150 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var bufferCount_1 = __webpack_require__(284); -Observable_1.Observable.prototype.bufferCount = bufferCount_1.bufferCount; -//# sourceMappingURL=bufferCount.js.map - -/***/ }), -/* 151 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var bufferTime_1 = __webpack_require__(285); -Observable_1.Observable.prototype.bufferTime = bufferTime_1.bufferTime; -//# sourceMappingURL=bufferTime.js.map - -/***/ }), -/* 152 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var bufferToggle_1 = __webpack_require__(286); -Observable_1.Observable.prototype.bufferToggle = bufferToggle_1.bufferToggle; -//# sourceMappingURL=bufferToggle.js.map - -/***/ }), -/* 153 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var bufferWhen_1 = __webpack_require__(287); -Observable_1.Observable.prototype.bufferWhen = bufferWhen_1.bufferWhen; -//# sourceMappingURL=bufferWhen.js.map - -/***/ }), -/* 154 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var combineAll_1 = __webpack_require__(288); -Observable_1.Observable.prototype.combineAll = combineAll_1.combineAll; -//# sourceMappingURL=combineAll.js.map - -/***/ }), -/* 155 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var combineLatest_1 = __webpack_require__(37); -Observable_1.Observable.prototype.combineLatest = combineLatest_1.combineLatest; -//# sourceMappingURL=combineLatest.js.map - -/***/ }), -/* 156 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var concat_1 = __webpack_require__(38); -Observable_1.Observable.prototype.concat = concat_1.concat; -//# sourceMappingURL=concat.js.map - -/***/ }), -/* 157 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var concatAll_1 = __webpack_require__(393); -Observable_1.Observable.prototype.concatAll = concatAll_1.concatAll; -//# sourceMappingURL=concatAll.js.map - -/***/ }), -/* 158 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var concatMap_1 = __webpack_require__(394); -Observable_1.Observable.prototype.concatMap = concatMap_1.concatMap; -//# sourceMappingURL=concatMap.js.map - -/***/ }), -/* 159 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var concatMapTo_1 = __webpack_require__(289); -Observable_1.Observable.prototype.concatMapTo = concatMapTo_1.concatMapTo; -//# sourceMappingURL=concatMapTo.js.map - -/***/ }), -/* 160 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var count_1 = __webpack_require__(290); -Observable_1.Observable.prototype.count = count_1.count; -//# sourceMappingURL=count.js.map - -/***/ }), -/* 161 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var debounce_1 = __webpack_require__(291); -Observable_1.Observable.prototype.debounce = debounce_1.debounce; -//# sourceMappingURL=debounce.js.map - -/***/ }), -/* 162 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var debounceTime_1 = __webpack_require__(292); -Observable_1.Observable.prototype.debounceTime = debounceTime_1.debounceTime; -//# sourceMappingURL=debounceTime.js.map - -/***/ }), -/* 163 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var defaultIfEmpty_1 = __webpack_require__(293); -Observable_1.Observable.prototype.defaultIfEmpty = defaultIfEmpty_1.defaultIfEmpty; -//# sourceMappingURL=defaultIfEmpty.js.map - -/***/ }), -/* 164 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var delay_1 = __webpack_require__(294); -Observable_1.Observable.prototype.delay = delay_1.delay; -//# sourceMappingURL=delay.js.map - -/***/ }), -/* 165 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var delayWhen_1 = __webpack_require__(295); -Observable_1.Observable.prototype.delayWhen = delayWhen_1.delayWhen; -//# sourceMappingURL=delayWhen.js.map - -/***/ }), -/* 166 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var dematerialize_1 = __webpack_require__(296); -Observable_1.Observable.prototype.dematerialize = dematerialize_1.dematerialize; -//# sourceMappingURL=dematerialize.js.map - -/***/ }), -/* 167 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var distinct_1 = __webpack_require__(297); -Observable_1.Observable.prototype.distinct = distinct_1.distinct; -//# sourceMappingURL=distinct.js.map - -/***/ }), -/* 168 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var distinctUntilChanged_1 = __webpack_require__(60); -Observable_1.Observable.prototype.distinctUntilChanged = distinctUntilChanged_1.distinctUntilChanged; -//# sourceMappingURL=distinctUntilChanged.js.map - -/***/ }), -/* 169 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var distinctUntilKeyChanged_1 = __webpack_require__(298); -Observable_1.Observable.prototype.distinctUntilKeyChanged = distinctUntilKeyChanged_1.distinctUntilKeyChanged; -//# sourceMappingURL=distinctUntilKeyChanged.js.map - -/***/ }), -/* 170 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var do_1 = __webpack_require__(299); -Observable_1.Observable.prototype.do = do_1._do; -Observable_1.Observable.prototype._do = do_1._do; -//# sourceMappingURL=do.js.map - -/***/ }), -/* 171 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var elementAt_1 = __webpack_require__(300); -Observable_1.Observable.prototype.elementAt = elementAt_1.elementAt; -//# sourceMappingURL=elementAt.js.map - -/***/ }), -/* 172 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var every_1 = __webpack_require__(395); -Observable_1.Observable.prototype.every = every_1.every; -//# sourceMappingURL=every.js.map - -/***/ }), -/* 173 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var exhaust_1 = __webpack_require__(301); -Observable_1.Observable.prototype.exhaust = exhaust_1.exhaust; -//# sourceMappingURL=exhaust.js.map - -/***/ }), -/* 174 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var exhaustMap_1 = __webpack_require__(302); -Observable_1.Observable.prototype.exhaustMap = exhaustMap_1.exhaustMap; -//# sourceMappingURL=exhaustMap.js.map - -/***/ }), -/* 175 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var expand_1 = __webpack_require__(303); -Observable_1.Observable.prototype.expand = expand_1.expand; -//# sourceMappingURL=expand.js.map - -/***/ }), -/* 176 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var filter_1 = __webpack_require__(42); -Observable_1.Observable.prototype.filter = filter_1.filter; -//# sourceMappingURL=filter.js.map - -/***/ }), -/* 177 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var finally_1 = __webpack_require__(304); -Observable_1.Observable.prototype.finally = finally_1._finally; -Observable_1.Observable.prototype._finally = finally_1._finally; -//# sourceMappingURL=finally.js.map - -/***/ }), -/* 178 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var find_1 = __webpack_require__(61); -Observable_1.Observable.prototype.find = find_1.find; -//# sourceMappingURL=find.js.map - -/***/ }), -/* 179 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var findIndex_1 = __webpack_require__(305); -Observable_1.Observable.prototype.findIndex = findIndex_1.findIndex; -//# sourceMappingURL=findIndex.js.map - -/***/ }), -/* 180 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var groupBy_1 = __webpack_require__(306); -Observable_1.Observable.prototype.groupBy = groupBy_1.groupBy; -//# sourceMappingURL=groupBy.js.map - -/***/ }), -/* 181 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var ignoreElements_1 = __webpack_require__(307); -Observable_1.Observable.prototype.ignoreElements = ignoreElements_1.ignoreElements; -//# sourceMappingURL=ignoreElements.js.map - -/***/ }), -/* 182 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var isEmpty_1 = __webpack_require__(308); -Observable_1.Observable.prototype.isEmpty = isEmpty_1.isEmpty; -//# sourceMappingURL=isEmpty.js.map - -/***/ }), -/* 183 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var last_1 = __webpack_require__(396); -Observable_1.Observable.prototype.last = last_1.last; -//# sourceMappingURL=last.js.map - -/***/ }), -/* 184 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var let_1 = __webpack_require__(309); -Observable_1.Observable.prototype.let = let_1.letProto; -Observable_1.Observable.prototype.letBind = let_1.letProto; -//# sourceMappingURL=let.js.map - -/***/ }), -/* 185 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var mapTo_1 = __webpack_require__(310); -Observable_1.Observable.prototype.mapTo = mapTo_1.mapTo; -//# sourceMappingURL=mapTo.js.map - -/***/ }), -/* 186 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var materialize_1 = __webpack_require__(311); -Observable_1.Observable.prototype.materialize = materialize_1.materialize; -//# sourceMappingURL=materialize.js.map - -/***/ }), -/* 187 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var max_1 = __webpack_require__(312); -Observable_1.Observable.prototype.max = max_1.max; -//# sourceMappingURL=max.js.map - -/***/ }), -/* 188 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var merge_1 = __webpack_require__(397); -Observable_1.Observable.prototype.merge = merge_1.merge; -//# sourceMappingURL=merge.js.map - -/***/ }), -/* 189 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var mergeAll_1 = __webpack_require__(77); -Observable_1.Observable.prototype.mergeAll = mergeAll_1.mergeAll; -//# sourceMappingURL=mergeAll.js.map - -/***/ }), -/* 190 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var mergeMap_1 = __webpack_require__(383); -Observable_1.Observable.prototype.mergeMap = mergeMap_1.mergeMap; -Observable_1.Observable.prototype.flatMap = mergeMap_1.mergeMap; -//# sourceMappingURL=mergeMap.js.map - -/***/ }), -/* 191 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var mergeMapTo_1 = __webpack_require__(62); -Observable_1.Observable.prototype.flatMapTo = mergeMapTo_1.mergeMapTo; -Observable_1.Observable.prototype.mergeMapTo = mergeMapTo_1.mergeMapTo; -//# sourceMappingURL=mergeMapTo.js.map - -/***/ }), -/* 192 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var mergeScan_1 = __webpack_require__(313); -Observable_1.Observable.prototype.mergeScan = mergeScan_1.mergeScan; -//# sourceMappingURL=mergeScan.js.map - -/***/ }), -/* 193 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var min_1 = __webpack_require__(314); -Observable_1.Observable.prototype.min = min_1.min; -//# sourceMappingURL=min.js.map - -/***/ }), -/* 194 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var multicast_1 = __webpack_require__(16); -Observable_1.Observable.prototype.multicast = multicast_1.multicast; -//# sourceMappingURL=multicast.js.map - -/***/ }), -/* 195 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var observeOn_1 = __webpack_require__(87); -Observable_1.Observable.prototype.observeOn = observeOn_1.observeOn; -//# sourceMappingURL=observeOn.js.map - -/***/ }), -/* 196 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var onErrorResumeNext_1 = __webpack_require__(63); -Observable_1.Observable.prototype.onErrorResumeNext = onErrorResumeNext_1.onErrorResumeNext; -//# sourceMappingURL=onErrorResumeNext.js.map - -/***/ }), -/* 197 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var pairwise_1 = __webpack_require__(315); -Observable_1.Observable.prototype.pairwise = pairwise_1.pairwise; -//# sourceMappingURL=pairwise.js.map +/*! ***************************************************************************** +Copyright (C) Microsoft. 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. +***************************************************************************** */ +var Reflect; +(function (Reflect) { + "use strict"; + var hasOwn = Object.prototype.hasOwnProperty; + // feature test for Symbol support + var supportsSymbol = typeof Symbol === "function"; + var toPrimitiveSymbol = supportsSymbol && typeof Symbol.toPrimitive !== "undefined" ? Symbol.toPrimitive : "@@toPrimitive"; + var iteratorSymbol = supportsSymbol && typeof Symbol.iterator !== "undefined" ? Symbol.iterator : "@@iterator"; + var HashMap; + (function (HashMap) { + var supportsCreate = typeof Object.create === "function"; // feature test for Object.create support + var supportsProto = { __proto__: [] } instanceof Array; // feature test for __proto__ support + var downLevel = !supportsCreate && !supportsProto; + // create an object in dictionary mode (a.k.a. "slow" mode in v8) + HashMap.create = supportsCreate + ? function () { return MakeDictionary(Object.create(null)); } + : supportsProto + ? function () { return MakeDictionary({ __proto__: null }); } + : function () { return MakeDictionary({}); }; + HashMap.has = downLevel + ? function (map, key) { return hasOwn.call(map, key); } + : function (map, key) { return key in map; }; + HashMap.get = downLevel + ? function (map, key) { return hasOwn.call(map, key) ? map[key] : undefined; } + : function (map, key) { return map[key]; }; + })(HashMap || (HashMap = {})); + // Load global or shim versions of Map, Set, and WeakMap + var functionPrototype = Object.getPrototypeOf(Function); + var usePolyfill = typeof process === "object" && process.env && process.env["REFLECT_METADATA_USE_MAP_POLYFILL"] === "true"; + var _Map = !usePolyfill && typeof Map === "function" && typeof Map.prototype.entries === "function" ? Map : CreateMapPolyfill(); + var _Set = !usePolyfill && typeof Set === "function" && typeof Set.prototype.entries === "function" ? Set : CreateSetPolyfill(); + var _WeakMap = !usePolyfill && typeof WeakMap === "function" ? WeakMap : CreateWeakMapPolyfill(); + // [[Metadata]] internal slot + // https://rbuckton.github.io/reflect-metadata/#ordinary-object-internal-methods-and-internal-slots + var Metadata = new _WeakMap(); + /** + * Applies a set of decorators to a property of a target object. + * @param decorators An array of decorators. + * @param target The target object. + * @param propertyKey (Optional) The property key to decorate. + * @param attributes (Optional) The property descriptor for the target key. + * @remarks Decorators are applied in reverse order. + * @example + * + * class Example { + * // property declarations are not part of ES6, though they are valid in TypeScript: + * // static staticProperty; + * // property; + * + * constructor(p) { } + * static staticMethod(p) { } + * method(p) { } + * } + * + * // constructor + * Example = Reflect.decorate(decoratorsArray, Example); + * + * // property (on constructor) + * Reflect.decorate(decoratorsArray, Example, "staticProperty"); + * + * // property (on prototype) + * Reflect.decorate(decoratorsArray, Example.prototype, "property"); + * + * // method (on constructor) + * Object.defineProperty(Example, "staticMethod", + * Reflect.decorate(decoratorsArray, Example, "staticMethod", + * Object.getOwnPropertyDescriptor(Example, "staticMethod"))); + * + * // method (on prototype) + * Object.defineProperty(Example.prototype, "method", + * Reflect.decorate(decoratorsArray, Example.prototype, "method", + * Object.getOwnPropertyDescriptor(Example.prototype, "method"))); + * + */ + function decorate(decorators, target, propertyKey, attributes) { + if (!IsUndefined(propertyKey)) { + if (!IsArray(decorators)) + throw new TypeError(); + if (!IsObject(target)) + throw new TypeError(); + if (!IsObject(attributes) && !IsUndefined(attributes) && !IsNull(attributes)) + throw new TypeError(); + if (IsNull(attributes)) + attributes = undefined; + propertyKey = ToPropertyKey(propertyKey); + return DecorateProperty(decorators, target, propertyKey, attributes); + } + else { + if (!IsArray(decorators)) + throw new TypeError(); + if (!IsConstructor(target)) + throw new TypeError(); + return DecorateConstructor(decorators, target); + } + } + Reflect.decorate = decorate; + // 4.1.2 Reflect.metadata(metadataKey, metadataValue) + // https://rbuckton.github.io/reflect-metadata/#reflect.metadata + /** + * A default metadata decorator factory that can be used on a class, class member, or parameter. + * @param metadataKey The key for the metadata entry. + * @param metadataValue The value for the metadata entry. + * @returns A decorator function. + * @remarks + * If `metadataKey` is already defined for the target and target key, the + * metadataValue for that key will be overwritten. + * @example + * + * // constructor + * @Reflect.metadata(key, value) + * class Example { + * } + * + * // property (on constructor, TypeScript only) + * class Example { + * @Reflect.metadata(key, value) + * static staticProperty; + * } + * + * // property (on prototype, TypeScript only) + * class Example { + * @Reflect.metadata(key, value) + * property; + * } + * + * // method (on constructor) + * class Example { + * @Reflect.metadata(key, value) + * static staticMethod() { } + * } + * + * // method (on prototype) + * class Example { + * @Reflect.metadata(key, value) + * method() { } + * } + * + */ + function metadata(metadataKey, metadataValue) { + function decorator(target, propertyKey) { + if (!IsObject(target)) + throw new TypeError(); + if (!IsUndefined(propertyKey) && !IsPropertyKey(propertyKey)) + throw new TypeError(); + OrdinaryDefineOwnMetadata(metadataKey, metadataValue, target, propertyKey); + } + return decorator; + } + Reflect.metadata = metadata; + /** + * Define a unique metadata entry on the target. + * @param metadataKey A key used to store and retrieve metadata. + * @param metadataValue A value that contains attached metadata. + * @param target The target object on which to define metadata. + * @param propertyKey (Optional) The property key for the target. + * @example + * + * class Example { + * // property declarations are not part of ES6, though they are valid in TypeScript: + * // static staticProperty; + * // property; + * + * constructor(p) { } + * static staticMethod(p) { } + * method(p) { } + * } + * + * // constructor + * Reflect.defineMetadata("custom:annotation", options, Example); + * + * // property (on constructor) + * Reflect.defineMetadata("custom:annotation", options, Example, "staticProperty"); + * + * // property (on prototype) + * Reflect.defineMetadata("custom:annotation", options, Example.prototype, "property"); + * + * // method (on constructor) + * Reflect.defineMetadata("custom:annotation", options, Example, "staticMethod"); + * + * // method (on prototype) + * Reflect.defineMetadata("custom:annotation", options, Example.prototype, "method"); + * + * // decorator factory as metadata-producing annotation. + * function MyAnnotation(options): Decorator { + * return (target, key?) => Reflect.defineMetadata("custom:annotation", options, target, key); + * } + * + */ + function defineMetadata(metadataKey, metadataValue, target, propertyKey) { + if (!IsObject(target)) + throw new TypeError(); + if (!IsUndefined(propertyKey)) + propertyKey = ToPropertyKey(propertyKey); + return OrdinaryDefineOwnMetadata(metadataKey, metadataValue, target, propertyKey); + } + Reflect.defineMetadata = defineMetadata; + /** + * Gets a value indicating whether the target object or its prototype chain has the provided metadata key defined. + * @param metadataKey A key used to store and retrieve metadata. + * @param target The target object on which the metadata is defined. + * @param propertyKey (Optional) The property key for the target. + * @returns `true` if the metadata key was defined on the target object or its prototype chain; otherwise, `false`. + * @example + * + * class Example { + * // property declarations are not part of ES6, though they are valid in TypeScript: + * // static staticProperty; + * // property; + * + * constructor(p) { } + * static staticMethod(p) { } + * method(p) { } + * } + * + * // constructor + * result = Reflect.hasMetadata("custom:annotation", Example); + * + * // property (on constructor) + * result = Reflect.hasMetadata("custom:annotation", Example, "staticProperty"); + * + * // property (on prototype) + * result = Reflect.hasMetadata("custom:annotation", Example.prototype, "property"); + * + * // method (on constructor) + * result = Reflect.hasMetadata("custom:annotation", Example, "staticMethod"); + * + * // method (on prototype) + * result = Reflect.hasMetadata("custom:annotation", Example.prototype, "method"); + * + */ + function hasMetadata(metadataKey, target, propertyKey) { + if (!IsObject(target)) + throw new TypeError(); + if (!IsUndefined(propertyKey)) + propertyKey = ToPropertyKey(propertyKey); + return OrdinaryHasMetadata(metadataKey, target, propertyKey); + } + Reflect.hasMetadata = hasMetadata; + /** + * Gets a value indicating whether the target object has the provided metadata key defined. + * @param metadataKey A key used to store and retrieve metadata. + * @param target The target object on which the metadata is defined. + * @param propertyKey (Optional) The property key for the target. + * @returns `true` if the metadata key was defined on the target object; otherwise, `false`. + * @example + * + * class Example { + * // property declarations are not part of ES6, though they are valid in TypeScript: + * // static staticProperty; + * // property; + * + * constructor(p) { } + * static staticMethod(p) { } + * method(p) { } + * } + * + * // constructor + * result = Reflect.hasOwnMetadata("custom:annotation", Example); + * + * // property (on constructor) + * result = Reflect.hasOwnMetadata("custom:annotation", Example, "staticProperty"); + * + * // property (on prototype) + * result = Reflect.hasOwnMetadata("custom:annotation", Example.prototype, "property"); + * + * // method (on constructor) + * result = Reflect.hasOwnMetadata("custom:annotation", Example, "staticMethod"); + * + * // method (on prototype) + * result = Reflect.hasOwnMetadata("custom:annotation", Example.prototype, "method"); + * + */ + function hasOwnMetadata(metadataKey, target, propertyKey) { + if (!IsObject(target)) + throw new TypeError(); + if (!IsUndefined(propertyKey)) + propertyKey = ToPropertyKey(propertyKey); + return OrdinaryHasOwnMetadata(metadataKey, target, propertyKey); + } + Reflect.hasOwnMetadata = hasOwnMetadata; + /** + * Gets the metadata value for the provided metadata key on the target object or its prototype chain. + * @param metadataKey A key used to store and retrieve metadata. + * @param target The target object on which the metadata is defined. + * @param propertyKey (Optional) The property key for the target. + * @returns The metadata value for the metadata key if found; otherwise, `undefined`. + * @example + * + * class Example { + * // property declarations are not part of ES6, though they are valid in TypeScript: + * // static staticProperty; + * // property; + * + * constructor(p) { } + * static staticMethod(p) { } + * method(p) { } + * } + * + * // constructor + * result = Reflect.getMetadata("custom:annotation", Example); + * + * // property (on constructor) + * result = Reflect.getMetadata("custom:annotation", Example, "staticProperty"); + * + * // property (on prototype) + * result = Reflect.getMetadata("custom:annotation", Example.prototype, "property"); + * + * // method (on constructor) + * result = Reflect.getMetadata("custom:annotation", Example, "staticMethod"); + * + * // method (on prototype) + * result = Reflect.getMetadata("custom:annotation", Example.prototype, "method"); + * + */ + function getMetadata(metadataKey, target, propertyKey) { + if (!IsObject(target)) + throw new TypeError(); + if (!IsUndefined(propertyKey)) + propertyKey = ToPropertyKey(propertyKey); + return OrdinaryGetMetadata(metadataKey, target, propertyKey); + } + Reflect.getMetadata = getMetadata; + /** + * Gets the metadata value for the provided metadata key on the target object. + * @param metadataKey A key used to store and retrieve metadata. + * @param target The target object on which the metadata is defined. + * @param propertyKey (Optional) The property key for the target. + * @returns The metadata value for the metadata key if found; otherwise, `undefined`. + * @example + * + * class Example { + * // property declarations are not part of ES6, though they are valid in TypeScript: + * // static staticProperty; + * // property; + * + * constructor(p) { } + * static staticMethod(p) { } + * method(p) { } + * } + * + * // constructor + * result = Reflect.getOwnMetadata("custom:annotation", Example); + * + * // property (on constructor) + * result = Reflect.getOwnMetadata("custom:annotation", Example, "staticProperty"); + * + * // property (on prototype) + * result = Reflect.getOwnMetadata("custom:annotation", Example.prototype, "property"); + * + * // method (on constructor) + * result = Reflect.getOwnMetadata("custom:annotation", Example, "staticMethod"); + * + * // method (on prototype) + * result = Reflect.getOwnMetadata("custom:annotation", Example.prototype, "method"); + * + */ + function getOwnMetadata(metadataKey, target, propertyKey) { + if (!IsObject(target)) + throw new TypeError(); + if (!IsUndefined(propertyKey)) + propertyKey = ToPropertyKey(propertyKey); + return OrdinaryGetOwnMetadata(metadataKey, target, propertyKey); + } + Reflect.getOwnMetadata = getOwnMetadata; + /** + * Gets the metadata keys defined on the target object or its prototype chain. + * @param target The target object on which the metadata is defined. + * @param propertyKey (Optional) The property key for the target. + * @returns An array of unique metadata keys. + * @example + * + * class Example { + * // property declarations are not part of ES6, though they are valid in TypeScript: + * // static staticProperty; + * // property; + * + * constructor(p) { } + * static staticMethod(p) { } + * method(p) { } + * } + * + * // constructor + * result = Reflect.getMetadataKeys(Example); + * + * // property (on constructor) + * result = Reflect.getMetadataKeys(Example, "staticProperty"); + * + * // property (on prototype) + * result = Reflect.getMetadataKeys(Example.prototype, "property"); + * + * // method (on constructor) + * result = Reflect.getMetadataKeys(Example, "staticMethod"); + * + * // method (on prototype) + * result = Reflect.getMetadataKeys(Example.prototype, "method"); + * + */ + function getMetadataKeys(target, propertyKey) { + if (!IsObject(target)) + throw new TypeError(); + if (!IsUndefined(propertyKey)) + propertyKey = ToPropertyKey(propertyKey); + return OrdinaryMetadataKeys(target, propertyKey); + } + Reflect.getMetadataKeys = getMetadataKeys; + /** + * Gets the unique metadata keys defined on the target object. + * @param target The target object on which the metadata is defined. + * @param propertyKey (Optional) The property key for the target. + * @returns An array of unique metadata keys. + * @example + * + * class Example { + * // property declarations are not part of ES6, though they are valid in TypeScript: + * // static staticProperty; + * // property; + * + * constructor(p) { } + * static staticMethod(p) { } + * method(p) { } + * } + * + * // constructor + * result = Reflect.getOwnMetadataKeys(Example); + * + * // property (on constructor) + * result = Reflect.getOwnMetadataKeys(Example, "staticProperty"); + * + * // property (on prototype) + * result = Reflect.getOwnMetadataKeys(Example.prototype, "property"); + * + * // method (on constructor) + * result = Reflect.getOwnMetadataKeys(Example, "staticMethod"); + * + * // method (on prototype) + * result = Reflect.getOwnMetadataKeys(Example.prototype, "method"); + * + */ + function getOwnMetadataKeys(target, propertyKey) { + if (!IsObject(target)) + throw new TypeError(); + if (!IsUndefined(propertyKey)) + propertyKey = ToPropertyKey(propertyKey); + return OrdinaryOwnMetadataKeys(target, propertyKey); + } + Reflect.getOwnMetadataKeys = getOwnMetadataKeys; + /** + * Deletes the metadata entry from the target object with the provided key. + * @param metadataKey A key used to store and retrieve metadata. + * @param target The target object on which the metadata is defined. + * @param propertyKey (Optional) The property key for the target. + * @returns `true` if the metadata entry was found and deleted; otherwise, false. + * @example + * + * class Example { + * // property declarations are not part of ES6, though they are valid in TypeScript: + * // static staticProperty; + * // property; + * + * constructor(p) { } + * static staticMethod(p) { } + * method(p) { } + * } + * + * // constructor + * result = Reflect.deleteMetadata("custom:annotation", Example); + * + * // property (on constructor) + * result = Reflect.deleteMetadata("custom:annotation", Example, "staticProperty"); + * + * // property (on prototype) + * result = Reflect.deleteMetadata("custom:annotation", Example.prototype, "property"); + * + * // method (on constructor) + * result = Reflect.deleteMetadata("custom:annotation", Example, "staticMethod"); + * + * // method (on prototype) + * result = Reflect.deleteMetadata("custom:annotation", Example.prototype, "method"); + * + */ + function deleteMetadata(metadataKey, target, propertyKey) { + if (!IsObject(target)) + throw new TypeError(); + if (!IsUndefined(propertyKey)) + propertyKey = ToPropertyKey(propertyKey); + var metadataMap = GetOrCreateMetadataMap(target, propertyKey, /*Create*/ false); + if (IsUndefined(metadataMap)) + return false; + if (!metadataMap.delete(metadataKey)) + return false; + if (metadataMap.size > 0) + return true; + var targetMetadata = Metadata.get(target); + targetMetadata.delete(propertyKey); + if (targetMetadata.size > 0) + return true; + Metadata.delete(target); + return true; + } + Reflect.deleteMetadata = deleteMetadata; + function DecorateConstructor(decorators, target) { + for (var i = decorators.length - 1; i >= 0; --i) { + var decorator = decorators[i]; + var decorated = decorator(target); + if (!IsUndefined(decorated) && !IsNull(decorated)) { + if (!IsConstructor(decorated)) + throw new TypeError(); + target = decorated; + } + } + return target; + } + function DecorateProperty(decorators, target, propertyKey, descriptor) { + for (var i = decorators.length - 1; i >= 0; --i) { + var decorator = decorators[i]; + var decorated = decorator(target, propertyKey, descriptor); + if (!IsUndefined(decorated) && !IsNull(decorated)) { + if (!IsObject(decorated)) + throw new TypeError(); + descriptor = decorated; + } + } + return descriptor; + } + function GetOrCreateMetadataMap(O, P, Create) { + var targetMetadata = Metadata.get(O); + if (IsUndefined(targetMetadata)) { + if (!Create) + return undefined; + targetMetadata = new _Map(); + Metadata.set(O, targetMetadata); + } + var metadataMap = targetMetadata.get(P); + if (IsUndefined(metadataMap)) { + if (!Create) + return undefined; + metadataMap = new _Map(); + targetMetadata.set(P, metadataMap); + } + return metadataMap; + } + // 3.1.1.1 OrdinaryHasMetadata(MetadataKey, O, P) + // https://rbuckton.github.io/reflect-metadata/#ordinaryhasmetadata + function OrdinaryHasMetadata(MetadataKey, O, P) { + var hasOwn = OrdinaryHasOwnMetadata(MetadataKey, O, P); + if (hasOwn) + return true; + var parent = OrdinaryGetPrototypeOf(O); + if (!IsNull(parent)) + return OrdinaryHasMetadata(MetadataKey, parent, P); + return false; + } + // 3.1.2.1 OrdinaryHasOwnMetadata(MetadataKey, O, P) + // https://rbuckton.github.io/reflect-metadata/#ordinaryhasownmetadata + function OrdinaryHasOwnMetadata(MetadataKey, O, P) { + var metadataMap = GetOrCreateMetadataMap(O, P, /*Create*/ false); + if (IsUndefined(metadataMap)) + return false; + return ToBoolean(metadataMap.has(MetadataKey)); + } + // 3.1.3.1 OrdinaryGetMetadata(MetadataKey, O, P) + // https://rbuckton.github.io/reflect-metadata/#ordinarygetmetadata + function OrdinaryGetMetadata(MetadataKey, O, P) { + var hasOwn = OrdinaryHasOwnMetadata(MetadataKey, O, P); + if (hasOwn) + return OrdinaryGetOwnMetadata(MetadataKey, O, P); + var parent = OrdinaryGetPrototypeOf(O); + if (!IsNull(parent)) + return OrdinaryGetMetadata(MetadataKey, parent, P); + return undefined; + } + // 3.1.4.1 OrdinaryGetOwnMetadata(MetadataKey, O, P) + // https://rbuckton.github.io/reflect-metadata/#ordinarygetownmetadata + function OrdinaryGetOwnMetadata(MetadataKey, O, P) { + var metadataMap = GetOrCreateMetadataMap(O, P, /*Create*/ false); + if (IsUndefined(metadataMap)) + return undefined; + return metadataMap.get(MetadataKey); + } + // 3.1.5.1 OrdinaryDefineOwnMetadata(MetadataKey, MetadataValue, O, P) + // https://rbuckton.github.io/reflect-metadata/#ordinarydefineownmetadata + function OrdinaryDefineOwnMetadata(MetadataKey, MetadataValue, O, P) { + var metadataMap = GetOrCreateMetadataMap(O, P, /*Create*/ true); + metadataMap.set(MetadataKey, MetadataValue); + } + // 3.1.6.1 OrdinaryMetadataKeys(O, P) + // https://rbuckton.github.io/reflect-metadata/#ordinarymetadatakeys + function OrdinaryMetadataKeys(O, P) { + var ownKeys = OrdinaryOwnMetadataKeys(O, P); + var parent = OrdinaryGetPrototypeOf(O); + if (parent === null) + return ownKeys; + var parentKeys = OrdinaryMetadataKeys(parent, P); + if (parentKeys.length <= 0) + return ownKeys; + if (ownKeys.length <= 0) + return parentKeys; + var set = new _Set(); + var keys = []; + for (var _i = 0, ownKeys_1 = ownKeys; _i < ownKeys_1.length; _i++) { + var key = ownKeys_1[_i]; + var hasKey = set.has(key); + if (!hasKey) { + set.add(key); + keys.push(key); + } + } + for (var _a = 0, parentKeys_1 = parentKeys; _a < parentKeys_1.length; _a++) { + var key = parentKeys_1[_a]; + var hasKey = set.has(key); + if (!hasKey) { + set.add(key); + keys.push(key); + } + } + return keys; + } + // 3.1.7.1 OrdinaryOwnMetadataKeys(O, P) + // https://rbuckton.github.io/reflect-metadata/#ordinaryownmetadatakeys + function OrdinaryOwnMetadataKeys(O, P) { + var keys = []; + var metadataMap = GetOrCreateMetadataMap(O, P, /*Create*/ false); + if (IsUndefined(metadataMap)) + return keys; + var keysObj = metadataMap.keys(); + var iterator = GetIterator(keysObj); + var k = 0; + while (true) { + var next = IteratorStep(iterator); + if (!next) { + keys.length = k; + return keys; + } + var nextValue = IteratorValue(next); + try { + keys[k] = nextValue; + } + catch (e) { + try { + IteratorClose(iterator); + } + finally { + throw e; + } + } + k++; + } + } + // 6 ECMAScript Data Typ0es and Values + // https://tc39.github.io/ecma262/#sec-ecmascript-data-types-and-values + function Type(x) { + if (x === null) + return 1 /* Null */; + switch (typeof x) { + case "undefined": return 0 /* Undefined */; + case "boolean": return 2 /* Boolean */; + case "string": return 3 /* String */; + case "symbol": return 4 /* Symbol */; + case "number": return 5 /* Number */; + case "object": return x === null ? 1 /* Null */ : 6 /* Object */; + default: return 6 /* Object */; + } + } + // 6.1.1 The Undefined Type + // https://tc39.github.io/ecma262/#sec-ecmascript-language-types-undefined-type + function IsUndefined(x) { + return x === undefined; + } + // 6.1.2 The Null Type + // https://tc39.github.io/ecma262/#sec-ecmascript-language-types-null-type + function IsNull(x) { + return x === null; + } + // 6.1.5 The Symbol Type + // https://tc39.github.io/ecma262/#sec-ecmascript-language-types-symbol-type + function IsSymbol(x) { + return typeof x === "symbol"; + } + // 6.1.7 The Object Type + // https://tc39.github.io/ecma262/#sec-object-type + function IsObject(x) { + return typeof x === "object" ? x !== null : typeof x === "function"; + } + // 7.1 Type Conversion + // https://tc39.github.io/ecma262/#sec-type-conversion + // 7.1.1 ToPrimitive(input [, PreferredType]) + // https://tc39.github.io/ecma262/#sec-toprimitive + function ToPrimitive(input, PreferredType) { + switch (Type(input)) { + case 0 /* Undefined */: return input; + case 1 /* Null */: return input; + case 2 /* Boolean */: return input; + case 3 /* String */: return input; + case 4 /* Symbol */: return input; + case 5 /* Number */: return input; + } + var hint = PreferredType === 3 /* String */ ? "string" : PreferredType === 5 /* Number */ ? "number" : "default"; + var exoticToPrim = GetMethod(input, toPrimitiveSymbol); + if (exoticToPrim !== undefined) { + var result = exoticToPrim.call(input, hint); + if (IsObject(result)) + throw new TypeError(); + return result; + } + return OrdinaryToPrimitive(input, hint === "default" ? "number" : hint); + } + // 7.1.1.1 OrdinaryToPrimitive(O, hint) + // https://tc39.github.io/ecma262/#sec-ordinarytoprimitive + function OrdinaryToPrimitive(O, hint) { + if (hint === "string") { + var toString_1 = O.toString; + if (IsCallable(toString_1)) { + var result = toString_1.call(O); + if (!IsObject(result)) + return result; + } + var valueOf = O.valueOf; + if (IsCallable(valueOf)) { + var result = valueOf.call(O); + if (!IsObject(result)) + return result; + } + } + else { + var valueOf = O.valueOf; + if (IsCallable(valueOf)) { + var result = valueOf.call(O); + if (!IsObject(result)) + return result; + } + var toString_2 = O.toString; + if (IsCallable(toString_2)) { + var result = toString_2.call(O); + if (!IsObject(result)) + return result; + } + } + throw new TypeError(); + } + // 7.1.2 ToBoolean(argument) + // https://tc39.github.io/ecma262/2016/#sec-toboolean + function ToBoolean(argument) { + return !!argument; + } + // 7.1.12 ToString(argument) + // https://tc39.github.io/ecma262/#sec-tostring + function ToString(argument) { + return "" + argument; + } + // 7.1.14 ToPropertyKey(argument) + // https://tc39.github.io/ecma262/#sec-topropertykey + function ToPropertyKey(argument) { + var key = ToPrimitive(argument, 3 /* String */); + if (IsSymbol(key)) + return key; + return ToString(key); + } + // 7.2 Testing and Comparison Operations + // https://tc39.github.io/ecma262/#sec-testing-and-comparison-operations + // 7.2.2 IsArray(argument) + // https://tc39.github.io/ecma262/#sec-isarray + function IsArray(argument) { + return Array.isArray + ? Array.isArray(argument) + : argument instanceof Object + ? argument instanceof Array + : Object.prototype.toString.call(argument) === "[object Array]"; + } + // 7.2.3 IsCallable(argument) + // https://tc39.github.io/ecma262/#sec-iscallable + function IsCallable(argument) { + // NOTE: This is an approximation as we cannot check for [[Call]] internal method. + return typeof argument === "function"; + } + // 7.2.4 IsConstructor(argument) + // https://tc39.github.io/ecma262/#sec-isconstructor + function IsConstructor(argument) { + // NOTE: This is an approximation as we cannot check for [[Construct]] internal method. + return typeof argument === "function"; + } + // 7.2.7 IsPropertyKey(argument) + // https://tc39.github.io/ecma262/#sec-ispropertykey + function IsPropertyKey(argument) { + switch (Type(argument)) { + case 3 /* String */: return true; + case 4 /* Symbol */: return true; + default: return false; + } + } + // 7.3 Operations on Objects + // https://tc39.github.io/ecma262/#sec-operations-on-objects + // 7.3.9 GetMethod(V, P) + // https://tc39.github.io/ecma262/#sec-getmethod + function GetMethod(V, P) { + var func = V[P]; + if (func === undefined || func === null) + return undefined; + if (!IsCallable(func)) + throw new TypeError(); + return func; + } + // 7.4 Operations on Iterator Objects + // https://tc39.github.io/ecma262/#sec-operations-on-iterator-objects + function GetIterator(obj) { + var method = GetMethod(obj, iteratorSymbol); + if (!IsCallable(method)) + throw new TypeError(); // from Call + var iterator = method.call(obj); + if (!IsObject(iterator)) + throw new TypeError(); + return iterator; + } + // 7.4.4 IteratorValue(iterResult) + // https://tc39.github.io/ecma262/2016/#sec-iteratorvalue + function IteratorValue(iterResult) { + return iterResult.value; + } + // 7.4.5 IteratorStep(iterator) + // https://tc39.github.io/ecma262/#sec-iteratorstep + function IteratorStep(iterator) { + var result = iterator.next(); + return result.done ? false : result; + } + // 7.4.6 IteratorClose(iterator, completion) + // https://tc39.github.io/ecma262/#sec-iteratorclose + function IteratorClose(iterator) { + var f = iterator["return"]; + if (f) + f.call(iterator); + } + // 9.1 Ordinary Object Internal Methods and Internal Slots + // https://tc39.github.io/ecma262/#sec-ordinary-object-internal-methods-and-internal-slots + // 9.1.1.1 OrdinaryGetPrototypeOf(O) + // https://tc39.github.io/ecma262/#sec-ordinarygetprototypeof + function OrdinaryGetPrototypeOf(O) { + var proto = Object.getPrototypeOf(O); + if (typeof O !== "function" || O === functionPrototype) + return proto; + // TypeScript doesn't set __proto__ in ES5, as it's non-standard. + // Try to determine the superclass constructor. Compatible implementations + // must either set __proto__ on a subclass constructor to the superclass constructor, + // or ensure each class has a valid `constructor` property on its prototype that + // points back to the constructor. + // If this is not the same as Function.[[Prototype]], then this is definately inherited. + // This is the case when in ES6 or when using __proto__ in a compatible browser. + if (proto !== functionPrototype) + return proto; + // If the super prototype is Object.prototype, null, or undefined, then we cannot determine the heritage. + var prototype = O.prototype; + var prototypeProto = prototype && Object.getPrototypeOf(prototype); + if (prototypeProto == null || prototypeProto === Object.prototype) + return proto; + // If the constructor was not a function, then we cannot determine the heritage. + var constructor = prototypeProto.constructor; + if (typeof constructor !== "function") + return proto; + // If we have some kind of self-reference, then we cannot determine the heritage. + if (constructor === O) + return proto; + // we have a pretty good guess at the heritage. + return constructor; + } + // naive Map shim + function CreateMapPolyfill() { + var cacheSentinel = {}; + var arraySentinel = []; + var MapIterator = (function () { + function MapIterator(keys, values, selector) { + this._index = 0; + this._keys = keys; + this._values = values; + this._selector = selector; + } + MapIterator.prototype["@@iterator"] = function () { return this; }; + MapIterator.prototype[iteratorSymbol] = function () { return this; }; + MapIterator.prototype.next = function () { + var index = this._index; + if (index >= 0 && index < this._keys.length) { + var result = this._selector(this._keys[index], this._values[index]); + if (index + 1 >= this._keys.length) { + this._index = -1; + this._keys = arraySentinel; + this._values = arraySentinel; + } + else { + this._index++; + } + return { value: result, done: false }; + } + return { value: undefined, done: true }; + }; + MapIterator.prototype.throw = function (error) { + if (this._index >= 0) { + this._index = -1; + this._keys = arraySentinel; + this._values = arraySentinel; + } + throw error; + }; + MapIterator.prototype.return = function (value) { + if (this._index >= 0) { + this._index = -1; + this._keys = arraySentinel; + this._values = arraySentinel; + } + return { value: value, done: true }; + }; + return MapIterator; + }()); + return (function () { + function Map() { + this._keys = []; + this._values = []; + this._cacheKey = cacheSentinel; + this._cacheIndex = -2; + } + Object.defineProperty(Map.prototype, "size", { + get: function () { return this._keys.length; }, + enumerable: true, + configurable: true + }); + Map.prototype.has = function (key) { return this._find(key, /*insert*/ false) >= 0; }; + Map.prototype.get = function (key) { + var index = this._find(key, /*insert*/ false); + return index >= 0 ? this._values[index] : undefined; + }; + Map.prototype.set = function (key, value) { + var index = this._find(key, /*insert*/ true); + this._values[index] = value; + return this; + }; + Map.prototype.delete = function (key) { + var index = this._find(key, /*insert*/ false); + if (index >= 0) { + var size = this._keys.length; + for (var i = index + 1; i < size; i++) { + this._keys[i - 1] = this._keys[i]; + this._values[i - 1] = this._values[i]; + } + this._keys.length--; + this._values.length--; + if (key === this._cacheKey) { + this._cacheKey = cacheSentinel; + this._cacheIndex = -2; + } + return true; + } + return false; + }; + Map.prototype.clear = function () { + this._keys.length = 0; + this._values.length = 0; + this._cacheKey = cacheSentinel; + this._cacheIndex = -2; + }; + Map.prototype.keys = function () { return new MapIterator(this._keys, this._values, getKey); }; + Map.prototype.values = function () { return new MapIterator(this._keys, this._values, getValue); }; + Map.prototype.entries = function () { return new MapIterator(this._keys, this._values, getEntry); }; + Map.prototype["@@iterator"] = function () { return this.entries(); }; + Map.prototype[iteratorSymbol] = function () { return this.entries(); }; + Map.prototype._find = function (key, insert) { + if (this._cacheKey !== key) { + this._cacheIndex = this._keys.indexOf(this._cacheKey = key); + } + if (this._cacheIndex < 0 && insert) { + this._cacheIndex = this._keys.length; + this._keys.push(key); + this._values.push(undefined); + } + return this._cacheIndex; + }; + return Map; + }()); + function getKey(key, _) { + return key; + } + function getValue(_, value) { + return value; + } + function getEntry(key, value) { + return [key, value]; + } + } + // naive Set shim + function CreateSetPolyfill() { + return (function () { + function Set() { + this._map = new _Map(); + } + Object.defineProperty(Set.prototype, "size", { + get: function () { return this._map.size; }, + enumerable: true, + configurable: true + }); + Set.prototype.has = function (value) { return this._map.has(value); }; + Set.prototype.add = function (value) { return this._map.set(value, value), this; }; + Set.prototype.delete = function (value) { return this._map.delete(value); }; + Set.prototype.clear = function () { this._map.clear(); }; + Set.prototype.keys = function () { return this._map.keys(); }; + Set.prototype.values = function () { return this._map.values(); }; + Set.prototype.entries = function () { return this._map.entries(); }; + Set.prototype["@@iterator"] = function () { return this.keys(); }; + Set.prototype[iteratorSymbol] = function () { return this.keys(); }; + return Set; + }()); + } + // naive WeakMap shim + function CreateWeakMapPolyfill() { + var UUID_SIZE = 16; + var keys = HashMap.create(); + var rootKey = CreateUniqueKey(); + return (function () { + function WeakMap() { + this._key = CreateUniqueKey(); + } + WeakMap.prototype.has = function (target) { + var table = GetOrCreateWeakMapTable(target, /*create*/ false); + return table !== undefined ? HashMap.has(table, this._key) : false; + }; + WeakMap.prototype.get = function (target) { + var table = GetOrCreateWeakMapTable(target, /*create*/ false); + return table !== undefined ? HashMap.get(table, this._key) : undefined; + }; + WeakMap.prototype.set = function (target, value) { + var table = GetOrCreateWeakMapTable(target, /*create*/ true); + table[this._key] = value; + return this; + }; + WeakMap.prototype.delete = function (target) { + var table = GetOrCreateWeakMapTable(target, /*create*/ false); + return table !== undefined ? delete table[this._key] : false; + }; + WeakMap.prototype.clear = function () { + // NOTE: not a real clear, just makes the previous data unreachable + this._key = CreateUniqueKey(); + }; + return WeakMap; + }()); + function CreateUniqueKey() { + var key; + do + key = "@@WeakMap@@" + CreateUUID(); + while (HashMap.has(keys, key)); + keys[key] = true; + return key; + } + function GetOrCreateWeakMapTable(target, create) { + if (!hasOwn.call(target, rootKey)) { + if (!create) + return undefined; + Object.defineProperty(target, rootKey, { value: HashMap.create() }); + } + return target[rootKey]; + } + function FillRandomBytes(buffer, size) { + for (var i = 0; i < size; ++i) + buffer[i] = Math.random() * 0xff | 0; + return buffer; + } + function GenRandomBytes(size) { + if (typeof Uint8Array === "function") { + if (typeof crypto !== "undefined") + return crypto.getRandomValues(new Uint8Array(size)); + if (typeof msCrypto !== "undefined") + return msCrypto.getRandomValues(new Uint8Array(size)); + return FillRandomBytes(new Uint8Array(size), size); + } + return FillRandomBytes(new Array(size), size); + } + function CreateUUID() { + var data = GenRandomBytes(UUID_SIZE); + // mark as random - RFC 4122 § 4.4 + data[6] = data[6] & 0x4f | 0x40; + data[8] = data[8] & 0xbf | 0x80; + var result = ""; + for (var offset = 0; offset < UUID_SIZE; ++offset) { + var byte = data[offset]; + if (offset === 4 || offset === 6 || offset === 8) + result += "-"; + if (byte < 16) + result += "0"; + result += byte.toString(16).toLowerCase(); + } + return result; + } + } + // uses a heuristic used by v8 and chakra to force an object into dictionary mode. + function MakeDictionary(obj) { + obj.__ = undefined; + delete obj.__; + return obj; + } + // patch global Reflect + (function (__global) { + if (typeof __global.Reflect !== "undefined") { + if (__global.Reflect !== Reflect) { + for (var p in Reflect) { + if (hasOwn.call(Reflect, p)) { + __global.Reflect[p] = Reflect[p]; + } + } + } + } + else { + __global.Reflect = Reflect; + } + })(typeof global !== "undefined" ? global : + typeof self !== "undefined" ? self : + Function("return this;")()); +})(Reflect || (Reflect = {})); +//# sourceMappingURL=Reflect.js.map /***/ }), -/* 198 */ +/* 60 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -var Observable_1 = __webpack_require__(0); -var partition_1 = __webpack_require__(316); -Observable_1.Observable.prototype.partition = partition_1.partition; -//# sourceMappingURL=partition.js.map +var Observable_1 = __webpack_require__(2); +var first_1 = __webpack_require__(55); +Observable_1.Observable.prototype.first = first_1.first; +//# sourceMappingURL=first.js.map /***/ }), -/* 199 */ +/* 61 */ /***/ (function(module, exports, __webpack_require__) { -"use strict"; - -var Observable_1 = __webpack_require__(0); -var pluck_1 = __webpack_require__(317); -Observable_1.Observable.prototype.pluck = pluck_1.pluck; -//# sourceMappingURL=pluck.js.map +module.exports = (__webpack_require__(0))(48); /***/ }), -/* 200 */ +/* 62 */ /***/ (function(module, exports, __webpack_require__) { -"use strict"; - -var Observable_1 = __webpack_require__(0); -var publish_1 = __webpack_require__(318); -Observable_1.Observable.prototype.publish = publish_1.publish; -//# sourceMappingURL=publish.js.map +module.exports = (__webpack_require__(0))(54); /***/ }), -/* 201 */ +/* 63 */ /***/ (function(module, exports, __webpack_require__) { -"use strict"; - -var Observable_1 = __webpack_require__(0); -var publishBehavior_1 = __webpack_require__(319); -Observable_1.Observable.prototype.publishBehavior = publishBehavior_1.publishBehavior; -//# sourceMappingURL=publishBehavior.js.map +/** + * @license Angular v5.0.1 + * (c) 2010-2017 Google, Inc. https://angular.io/ + * License: MIT + */ +(function (global, factory) { + true ? factory(exports, __webpack_require__(4), __webpack_require__(53), __webpack_require__(51), __webpack_require__(26)) : + typeof define === 'function' && define.amd ? define('@angular/platform-browser/animations', ['exports', '@angular/core', '@angular/platform-browser', '@angular/animations', '@angular/animations/browser'], factory) : + (factory((global.ng = global.ng || {}, global.ng.platformBrowser = global.ng.platformBrowser || {}, global.ng.platformBrowser.animations = {}),global.ng.core,global.ng.platformBrowser,global.ng.animations,global.ng.animations.browser)); +}(this, (function (exports,_angular_core,_angular_platformBrowser,_angular_animations,_angular_animations_browser) { 'use strict'; -/***/ }), -/* 202 */ -/***/ (function(module, exports, __webpack_require__) { +/*! ***************************************************************************** +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 __()); +} -"use strict"; +/** + * @license Angular v5.0.1 + * (c) 2010-2017 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 + */ +var BrowserAnimationBuilder = (function (_super) { + __extends(BrowserAnimationBuilder, _super); + function BrowserAnimationBuilder(rootRenderer, doc) { + var _this = _super.call(this) || this; + _this._nextAnimationId = 0; + var /** @type {?} */ typeData = /** @type {?} */ ({ + id: '0', + encapsulation: _angular_core.ViewEncapsulation.None, + styles: [], + data: { animation: [] } + }); + _this._renderer = /** @type {?} */ (rootRenderer.createRenderer(doc.body, typeData)); + return _this; + } + /** + * @param {?} animation + * @return {?} + */ + BrowserAnimationBuilder.prototype.build = /** + * @param {?} animation + * @return {?} + */ + function (animation) { + var /** @type {?} */ id = this._nextAnimationId.toString(); + this._nextAnimationId++; + var /** @type {?} */ entry = Array.isArray(animation) ? _angular_animations.sequence(animation) : animation; + issueAnimationCommand(this._renderer, null, id, 'register', [entry]); + return new BrowserAnimationFactory(id, this._renderer); + }; + BrowserAnimationBuilder.decorators = [ + { type: _angular_core.Injectable }, + ]; + /** @nocollapse */ + BrowserAnimationBuilder.ctorParameters = function () { return [ + { type: _angular_core.RendererFactory2, }, + { type: undefined, decorators: [{ type: _angular_core.Inject, args: [_angular_platformBrowser.DOCUMENT,] },] }, + ]; }; + return BrowserAnimationBuilder; +}(_angular_animations.AnimationBuilder)); +var BrowserAnimationFactory = (function (_super) { + __extends(BrowserAnimationFactory, _super); + function BrowserAnimationFactory(_id, _renderer) { + var _this = _super.call(this) || this; + _this._id = _id; + _this._renderer = _renderer; + return _this; + } + /** + * @param {?} element + * @param {?=} options + * @return {?} + */ + BrowserAnimationFactory.prototype.create = /** + * @param {?} element + * @param {?=} options + * @return {?} + */ + function (element, options) { + return new RendererAnimationPlayer(this._id, element, options || {}, this._renderer); + }; + return BrowserAnimationFactory; +}(_angular_animations.AnimationFactory)); +var RendererAnimationPlayer = (function () { + function RendererAnimationPlayer(id, element, options, _renderer) { + this.id = id; + this.element = element; + this._renderer = _renderer; + this.parentPlayer = null; + this._started = false; + this.totalTime = 0; + this._command('create', options); + } + /** + * @param {?} eventName + * @param {?} callback + * @return {?} + */ + RendererAnimationPlayer.prototype._listen = /** + * @param {?} eventName + * @param {?} callback + * @return {?} + */ + function (eventName, callback) { + return this._renderer.listen(this.element, "@@" + this.id + ":" + eventName, callback); + }; + /** + * @param {?} command + * @param {...?} args + * @return {?} + */ + RendererAnimationPlayer.prototype._command = /** + * @param {?} command + * @param {...?} args + * @return {?} + */ + function (command) { + var args = []; + for (var _i = 1; _i < arguments.length; _i++) { + args[_i - 1] = arguments[_i]; + } + return issueAnimationCommand(this._renderer, this.element, this.id, command, args); + }; + /** + * @param {?} fn + * @return {?} + */ + RendererAnimationPlayer.prototype.onDone = /** + * @param {?} fn + * @return {?} + */ + function (fn) { this._listen('done', fn); }; + /** + * @param {?} fn + * @return {?} + */ + RendererAnimationPlayer.prototype.onStart = /** + * @param {?} fn + * @return {?} + */ + function (fn) { this._listen('start', fn); }; + /** + * @param {?} fn + * @return {?} + */ + RendererAnimationPlayer.prototype.onDestroy = /** + * @param {?} fn + * @return {?} + */ + function (fn) { this._listen('destroy', fn); }; + /** + * @return {?} + */ + RendererAnimationPlayer.prototype.init = /** + * @return {?} + */ + function () { this._command('init'); }; + /** + * @return {?} + */ + RendererAnimationPlayer.prototype.hasStarted = /** + * @return {?} + */ + function () { return this._started; }; + /** + * @return {?} + */ + RendererAnimationPlayer.prototype.play = /** + * @return {?} + */ + function () { + this._command('play'); + this._started = true; + }; + /** + * @return {?} + */ + RendererAnimationPlayer.prototype.pause = /** + * @return {?} + */ + function () { this._command('pause'); }; + /** + * @return {?} + */ + RendererAnimationPlayer.prototype.restart = /** + * @return {?} + */ + function () { this._command('restart'); }; + /** + * @return {?} + */ + RendererAnimationPlayer.prototype.finish = /** + * @return {?} + */ + function () { this._command('finish'); }; + /** + * @return {?} + */ + RendererAnimationPlayer.prototype.destroy = /** + * @return {?} + */ + function () { this._command('destroy'); }; + /** + * @return {?} + */ + RendererAnimationPlayer.prototype.reset = /** + * @return {?} + */ + function () { this._command('reset'); }; + /** + * @param {?} p + * @return {?} + */ + RendererAnimationPlayer.prototype.setPosition = /** + * @param {?} p + * @return {?} + */ + function (p) { this._command('setPosition', p); }; + /** + * @return {?} + */ + RendererAnimationPlayer.prototype.getPosition = /** + * @return {?} + */ + function () { return 0; }; + return RendererAnimationPlayer; +}()); +/** + * @param {?} renderer + * @param {?} element + * @param {?} id + * @param {?} command + * @param {?} args + * @return {?} + */ +function issueAnimationCommand(renderer, element, id, command, args) { + return renderer.setProperty(element, "@@" + id + ":" + command, args); +} -var Observable_1 = __webpack_require__(0); -var publishLast_1 = __webpack_require__(320); -Observable_1.Observable.prototype.publishLast = publishLast_1.publishLast; -//# sourceMappingURL=publishLast.js.map +/** + * @fileoverview added by tsickle + * @suppress {checkTypes} checked by tsc + */ +var ANIMATION_PREFIX = '@'; +var DISABLE_ANIMATIONS_FLAG = '@.disabled'; +var AnimationRendererFactory = (function () { + function AnimationRendererFactory(delegate, engine, _zone) { + this.delegate = delegate; + this.engine = engine; + this._zone = _zone; + this._currentId = 0; + this._microtaskId = 1; + this._animationCallbacksBuffer = []; + this._rendererCache = new Map(); + this._cdRecurDepth = 0; + engine.onRemovalComplete = function (element, delegate) { + // Note: if an component element has a leave animation, and the component + // a host leave animation, the view engine will call `removeChild` for the parent + // component renderer as well as for the child component renderer. + // Therefore, we need to check if we already removed the element. + if (delegate && delegate.parentNode(element)) { + delegate.removeChild(element.parentNode, element); + } + }; + } + /** + * @param {?} hostElement + * @param {?} type + * @return {?} + */ + AnimationRendererFactory.prototype.createRenderer = /** + * @param {?} hostElement + * @param {?} type + * @return {?} + */ + function (hostElement, type) { + var _this = this; + var /** @type {?} */ EMPTY_NAMESPACE_ID = ''; + // cache the delegates to find out which cached delegate can + // be used by which cached renderer + var /** @type {?} */ delegate = this.delegate.createRenderer(hostElement, type); + if (!hostElement || !type || !type.data || !type.data['animation']) { + var /** @type {?} */ renderer = this._rendererCache.get(delegate); + if (!renderer) { + renderer = new BaseAnimationRenderer(EMPTY_NAMESPACE_ID, delegate, this.engine); + // only cache this result when the base renderer is used + this._rendererCache.set(delegate, renderer); + } + return renderer; + } + var /** @type {?} */ componentId = type.id; + var /** @type {?} */ namespaceId = type.id + '-' + this._currentId; + this._currentId++; + this.engine.register(namespaceId, hostElement); + var /** @type {?} */ animationTriggers = /** @type {?} */ (type.data['animation']); + animationTriggers.forEach(function (trigger) { + return _this.engine.registerTrigger(componentId, namespaceId, hostElement, trigger.name, trigger); + }); + return new AnimationRenderer(this, namespaceId, delegate, this.engine); + }; + /** + * @return {?} + */ + AnimationRendererFactory.prototype.begin = /** + * @return {?} + */ + function () { + this._cdRecurDepth++; + if (this.delegate.begin) { + this.delegate.begin(); + } + }; + /** + * @return {?} + */ + AnimationRendererFactory.prototype._scheduleCountTask = /** + * @return {?} + */ + function () { + var _this = this; + Zone.current.scheduleMicroTask('incremenet the animation microtask', function () { return _this._microtaskId++; }); + }; + /* @internal */ + /** + * @param {?} count + * @param {?} fn + * @param {?} data + * @return {?} + */ + AnimationRendererFactory.prototype.scheduleListenerCallback = /** + * @param {?} count + * @param {?} fn + * @param {?} data + * @return {?} + */ + function (count, fn, data) { + var _this = this; + if (count >= 0 && count < this._microtaskId) { + this._zone.run(function () { return fn(data); }); + return; + } + if (this._animationCallbacksBuffer.length == 0) { + Promise.resolve(null).then(function () { + _this._zone.run(function () { + _this._animationCallbacksBuffer.forEach(function (tuple) { + var fn = tuple[0], data = tuple[1]; + fn(data); + }); + _this._animationCallbacksBuffer = []; + }); + }); + } + this._animationCallbacksBuffer.push([fn, data]); + }; + /** + * @return {?} + */ + AnimationRendererFactory.prototype.end = /** + * @return {?} + */ + function () { + var _this = this; + this._cdRecurDepth--; + // this is to prevent animations from running twice when an inner + // component does CD when a parent component insted has inserted it + if (this._cdRecurDepth == 0) { + this._zone.runOutsideAngular(function () { + _this._scheduleCountTask(); + _this.engine.flush(_this._microtaskId); + }); + } + if (this.delegate.end) { + this.delegate.end(); + } + }; + /** + * @return {?} + */ + AnimationRendererFactory.prototype.whenRenderingDone = /** + * @return {?} + */ + function () { return this.engine.whenRenderingDone(); }; + AnimationRendererFactory.decorators = [ + { type: _angular_core.Injectable }, + ]; + /** @nocollapse */ + AnimationRendererFactory.ctorParameters = function () { return [ + { type: _angular_core.RendererFactory2, }, + { type: _angular_animations_browser.ɵAnimationEngine, }, + { type: _angular_core.NgZone, }, + ]; }; + return AnimationRendererFactory; +}()); +var BaseAnimationRenderer = (function () { + function BaseAnimationRenderer(namespaceId, delegate, engine) { + this.namespaceId = namespaceId; + this.delegate = delegate; + this.engine = engine; + this.destroyNode = this.delegate.destroyNode ? function (n) { return /** @type {?} */ ((delegate.destroyNode))(n); } : null; + } + Object.defineProperty(BaseAnimationRenderer.prototype, "data", { + get: /** + * @return {?} + */ + function () { return this.delegate.data; }, + enumerable: true, + configurable: true + }); + /** + * @return {?} + */ + BaseAnimationRenderer.prototype.destroy = /** + * @return {?} + */ + function () { + this.engine.destroy(this.namespaceId, this.delegate); + this.delegate.destroy(); + }; + /** + * @param {?} name + * @param {?=} namespace + * @return {?} + */ + BaseAnimationRenderer.prototype.createElement = /** + * @param {?} name + * @param {?=} namespace + * @return {?} + */ + function (name, namespace) { + return this.delegate.createElement(name, namespace); + }; + /** + * @param {?} value + * @return {?} + */ + BaseAnimationRenderer.prototype.createComment = /** + * @param {?} value + * @return {?} + */ + function (value) { return this.delegate.createComment(value); }; + /** + * @param {?} value + * @return {?} + */ + BaseAnimationRenderer.prototype.createText = /** + * @param {?} value + * @return {?} + */ + function (value) { return this.delegate.createText(value); }; + /** + * @param {?} parent + * @param {?} newChild + * @return {?} + */ + BaseAnimationRenderer.prototype.appendChild = /** + * @param {?} parent + * @param {?} newChild + * @return {?} + */ + function (parent, newChild) { + this.delegate.appendChild(parent, newChild); + this.engine.onInsert(this.namespaceId, newChild, parent, false); + }; + /** + * @param {?} parent + * @param {?} newChild + * @param {?} refChild + * @return {?} + */ + BaseAnimationRenderer.prototype.insertBefore = /** + * @param {?} parent + * @param {?} newChild + * @param {?} refChild + * @return {?} + */ + function (parent, newChild, refChild) { + this.delegate.insertBefore(parent, newChild, refChild); + this.engine.onInsert(this.namespaceId, newChild, parent, true); + }; + /** + * @param {?} parent + * @param {?} oldChild + * @return {?} + */ + BaseAnimationRenderer.prototype.removeChild = /** + * @param {?} parent + * @param {?} oldChild + * @return {?} + */ + function (parent, oldChild) { + this.engine.onRemove(this.namespaceId, oldChild, this.delegate); + }; + /** + * @param {?} selectorOrNode + * @return {?} + */ + BaseAnimationRenderer.prototype.selectRootElement = /** + * @param {?} selectorOrNode + * @return {?} + */ + function (selectorOrNode) { return this.delegate.selectRootElement(selectorOrNode); }; + /** + * @param {?} node + * @return {?} + */ + BaseAnimationRenderer.prototype.parentNode = /** + * @param {?} node + * @return {?} + */ + function (node) { return this.delegate.parentNode(node); }; + /** + * @param {?} node + * @return {?} + */ + BaseAnimationRenderer.prototype.nextSibling = /** + * @param {?} node + * @return {?} + */ + function (node) { return this.delegate.nextSibling(node); }; + /** + * @param {?} el + * @param {?} name + * @param {?} value + * @param {?=} namespace + * @return {?} + */ + BaseAnimationRenderer.prototype.setAttribute = /** + * @param {?} el + * @param {?} name + * @param {?} value + * @param {?=} namespace + * @return {?} + */ + function (el, name, value, namespace) { + this.delegate.setAttribute(el, name, value, namespace); + }; + /** + * @param {?} el + * @param {?} name + * @param {?=} namespace + * @return {?} + */ + BaseAnimationRenderer.prototype.removeAttribute = /** + * @param {?} el + * @param {?} name + * @param {?=} namespace + * @return {?} + */ + function (el, name, namespace) { + this.delegate.removeAttribute(el, name, namespace); + }; + /** + * @param {?} el + * @param {?} name + * @return {?} + */ + BaseAnimationRenderer.prototype.addClass = /** + * @param {?} el + * @param {?} name + * @return {?} + */ + function (el, name) { this.delegate.addClass(el, name); }; + /** + * @param {?} el + * @param {?} name + * @return {?} + */ + BaseAnimationRenderer.prototype.removeClass = /** + * @param {?} el + * @param {?} name + * @return {?} + */ + function (el, name) { this.delegate.removeClass(el, name); }; + /** + * @param {?} el + * @param {?} style + * @param {?} value + * @param {?=} flags + * @return {?} + */ + BaseAnimationRenderer.prototype.setStyle = /** + * @param {?} el + * @param {?} style + * @param {?} value + * @param {?=} flags + * @return {?} + */ + function (el, style, value, flags) { + this.delegate.setStyle(el, style, value, flags); + }; + /** + * @param {?} el + * @param {?} style + * @param {?=} flags + * @return {?} + */ + BaseAnimationRenderer.prototype.removeStyle = /** + * @param {?} el + * @param {?} style + * @param {?=} flags + * @return {?} + */ + function (el, style, flags) { + this.delegate.removeStyle(el, style, flags); + }; + /** + * @param {?} el + * @param {?} name + * @param {?} value + * @return {?} + */ + BaseAnimationRenderer.prototype.setProperty = /** + * @param {?} el + * @param {?} name + * @param {?} value + * @return {?} + */ + function (el, name, value) { + if (name.charAt(0) == ANIMATION_PREFIX && name == DISABLE_ANIMATIONS_FLAG) { + this.disableAnimations(el, !!value); + } + else { + this.delegate.setProperty(el, name, value); + } + }; + /** + * @param {?} node + * @param {?} value + * @return {?} + */ + BaseAnimationRenderer.prototype.setValue = /** + * @param {?} node + * @param {?} value + * @return {?} + */ + function (node, value) { this.delegate.setValue(node, value); }; + /** + * @param {?} target + * @param {?} eventName + * @param {?} callback + * @return {?} + */ + BaseAnimationRenderer.prototype.listen = /** + * @param {?} target + * @param {?} eventName + * @param {?} callback + * @return {?} + */ + function (target, eventName, callback) { + return this.delegate.listen(target, eventName, callback); + }; + /** + * @param {?} element + * @param {?} value + * @return {?} + */ + BaseAnimationRenderer.prototype.disableAnimations = /** + * @param {?} element + * @param {?} value + * @return {?} + */ + function (element, value) { + this.engine.disableAnimations(element, value); + }; + return BaseAnimationRenderer; +}()); +var AnimationRenderer = (function (_super) { + __extends(AnimationRenderer, _super); + function AnimationRenderer(factory, namespaceId, delegate, engine) { + var _this = _super.call(this, namespaceId, delegate, engine) || this; + _this.factory = factory; + _this.namespaceId = namespaceId; + return _this; + } + /** + * @param {?} el + * @param {?} name + * @param {?} value + * @return {?} + */ + AnimationRenderer.prototype.setProperty = /** + * @param {?} el + * @param {?} name + * @param {?} value + * @return {?} + */ + function (el, name, value) { + if (name.charAt(0) == ANIMATION_PREFIX) { + if (name.charAt(1) == '.' && name == DISABLE_ANIMATIONS_FLAG) { + value = value === undefined ? true : !!value; + this.disableAnimations(el, /** @type {?} */ (value)); + } + else { + this.engine.process(this.namespaceId, el, name.substr(1), value); + } + } + else { + this.delegate.setProperty(el, name, value); + } + }; + /** + * @param {?} target + * @param {?} eventName + * @param {?} callback + * @return {?} + */ + AnimationRenderer.prototype.listen = /** + * @param {?} target + * @param {?} eventName + * @param {?} callback + * @return {?} + */ + function (target, eventName, callback) { + var _this = this; + if (eventName.charAt(0) == ANIMATION_PREFIX) { + var /** @type {?} */ element = resolveElementFromTarget(target); + var /** @type {?} */ name_1 = eventName.substr(1); + var /** @type {?} */ phase = ''; + // @listener.phase is for trigger animation callbacks + // @@listener is for animation builder callbacks + if (name_1.charAt(0) != ANIMATION_PREFIX) { + _a = parseTriggerCallbackName(name_1), name_1 = _a[0], phase = _a[1]; + } + return this.engine.listen(this.namespaceId, element, name_1, phase, function (event) { + var /** @type {?} */ countId = (/** @type {?} */ (event))['_data'] || -1; + _this.factory.scheduleListenerCallback(countId, callback, event); + }); + } + return this.delegate.listen(target, eventName, callback); + var _a; + }; + return AnimationRenderer; +}(BaseAnimationRenderer)); +/** + * @param {?} target + * @return {?} + */ +function resolveElementFromTarget(target) { + switch (target) { + case 'body': + return document.body; + case 'document': + return document; + case 'window': + return window; + default: + return target; + } +} +/** + * @param {?} triggerName + * @return {?} + */ +function parseTriggerCallbackName(triggerName) { + var /** @type {?} */ dotIndex = triggerName.indexOf('.'); + var /** @type {?} */ trigger = triggerName.substring(0, dotIndex); + var /** @type {?} */ phase = triggerName.substr(dotIndex + 1); + return [trigger, phase]; +} -/***/ }), -/* 203 */ -/***/ (function(module, exports, __webpack_require__) { +/** + * @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 InjectableAnimationEngine = (function (_super) { + __extends(InjectableAnimationEngine, _super); + function InjectableAnimationEngine(driver, normalizer) { + return _super.call(this, driver, normalizer) || this; + } + InjectableAnimationEngine.decorators = [ + { type: _angular_core.Injectable }, + ]; + /** @nocollapse */ + InjectableAnimationEngine.ctorParameters = function () { return [ + { type: _angular_animations_browser.AnimationDriver, }, + { type: _angular_animations_browser.ɵAnimationStyleNormalizer, }, + ]; }; + return InjectableAnimationEngine; +}(_angular_animations_browser.ɵAnimationEngine)); +/** + * @return {?} + */ +function instantiateSupportedAnimationDriver() { + if (_angular_animations_browser.ɵsupportsWebAnimations()) { + return new _angular_animations_browser.ɵWebAnimationsDriver(); + } + return new _angular_animations_browser.ɵNoopAnimationDriver(); +} +/** + * @return {?} + */ +function instantiateDefaultStyleNormalizer() { + return new _angular_animations_browser.ɵWebAnimationsStyleNormalizer(); +} +/** + * @param {?} renderer + * @param {?} engine + * @param {?} zone + * @return {?} + */ +function instantiateRendererFactory(renderer, engine, zone) { + return new AnimationRendererFactory(renderer, engine, zone); +} +var SHARED_ANIMATION_PROVIDERS = [ + { provide: _angular_animations.AnimationBuilder, useClass: BrowserAnimationBuilder }, + { provide: _angular_animations_browser.ɵAnimationStyleNormalizer, useFactory: instantiateDefaultStyleNormalizer }, + { provide: _angular_animations_browser.ɵAnimationEngine, useClass: InjectableAnimationEngine }, { + provide: _angular_core.RendererFactory2, + useFactory: instantiateRendererFactory, + deps: [_angular_platformBrowser.ɵDomRendererFactory2, _angular_animations_browser.ɵAnimationEngine, _angular_core.NgZone] + } +]; +/** + * Separate providers from the actual module so that we can do a local modification in Google3 to + * include them in the BrowserModule. + */ +var BROWSER_ANIMATIONS_PROVIDERS = [ + { provide: _angular_animations_browser.AnimationDriver, useFactory: instantiateSupportedAnimationDriver } +].concat(SHARED_ANIMATION_PROVIDERS); +/** + * Separate providers from the actual module so that we can do a local modification in Google3 to + * include them in the BrowserTestingModule. + */ +var BROWSER_NOOP_ANIMATIONS_PROVIDERS = [{ provide: _angular_animations_browser.AnimationDriver, useClass: _angular_animations_browser.ɵNoopAnimationDriver }].concat(SHARED_ANIMATION_PROVIDERS); -"use strict"; +/** + * @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 + */ +/** + * \@experimental Animation support is experimental. + */ +var BrowserAnimationsModule = (function () { + function BrowserAnimationsModule() { + } + BrowserAnimationsModule.decorators = [ + { type: _angular_core.NgModule, args: [{ + exports: [_angular_platformBrowser.BrowserModule], + providers: BROWSER_ANIMATIONS_PROVIDERS, + },] }, + ]; + /** @nocollapse */ + BrowserAnimationsModule.ctorParameters = function () { return []; }; + return BrowserAnimationsModule; +}()); +/** + * \@experimental Animation support is experimental. + */ +var NoopAnimationsModule = (function () { + function NoopAnimationsModule() { + } + NoopAnimationsModule.decorators = [ + { type: _angular_core.NgModule, args: [{ + exports: [_angular_platformBrowser.BrowserModule], + providers: BROWSER_NOOP_ANIMATIONS_PROVIDERS, + },] }, + ]; + /** @nocollapse */ + NoopAnimationsModule.ctorParameters = function () { return []; }; + return NoopAnimationsModule; +}()); -var Observable_1 = __webpack_require__(0); -var publishReplay_1 = __webpack_require__(321); -Observable_1.Observable.prototype.publishReplay = publishReplay_1.publishReplay; -//# sourceMappingURL=publishReplay.js.map +exports.BrowserAnimationsModule = BrowserAnimationsModule; +exports.NoopAnimationsModule = NoopAnimationsModule; +exports.ɵBrowserAnimationBuilder = BrowserAnimationBuilder; +exports.ɵBrowserAnimationFactory = BrowserAnimationFactory; +exports.ɵAnimationRenderer = AnimationRenderer; +exports.ɵAnimationRendererFactory = AnimationRendererFactory; +exports.ɵa = BaseAnimationRenderer; +exports.ɵf = BROWSER_ANIMATIONS_PROVIDERS; +exports.ɵg = BROWSER_NOOP_ANIMATIONS_PROVIDERS; +exports.ɵb = InjectableAnimationEngine; +exports.ɵd = instantiateDefaultStyleNormalizer; +exports.ɵe = instantiateRendererFactory; +exports.ɵc = instantiateSupportedAnimationDriver; -/***/ }), -/* 204 */ -/***/ (function(module, exports, __webpack_require__) { +Object.defineProperty(exports, '__esModule', { value: true }); -"use strict"; +}))); +//# sourceMappingURL=platform-browser-animations.umd.js.map -var Observable_1 = __webpack_require__(0); -var race_1 = __webpack_require__(64); -Observable_1.Observable.prototype.race = race_1.race; -//# sourceMappingURL=race.js.map /***/ }), -/* 205 */ -/***/ (function(module, exports, __webpack_require__) { +/* 64 */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return AppModuleShared; }); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__(4); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0__angular_core__); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__angular_common__ = __webpack_require__(5); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__angular_common___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1__angular_common__); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__angular_forms__ = __webpack_require__(129); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__angular_forms___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2__angular_forms__); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__angular_common_http__ = __webpack_require__(13); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__angular_common_http___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_3__angular_common_http__); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__angular_router__ = __webpack_require__(52); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__angular_router___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_4__angular_router__); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__components_app_app_component__ = __webpack_require__(28); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__components_navmenu_navmenu_component__ = __webpack_require__(68); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__components_home_home_component__ = __webpack_require__(67); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__components_fetchdata_fetchdata_component__ = __webpack_require__(66); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_9__components_counter_counter_component__ = __webpack_require__(65); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_10__components_unauthorized_unauthorized_component__ = __webpack_require__(69); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_11_angular_auth_oidc_client__ = __webpack_require__(27); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_11_angular_auth_oidc_client___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_11_angular_auth_oidc_client__); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_12__components_services_auth_service__ = __webpack_require__(14); +var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { + var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); + else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; + return c > 3 && r && Object.defineProperty(target, key, r), r; +}; + + + + + + + + + + + + + +var AppModuleShared = (function () { + function AppModuleShared() { + } + AppModuleShared = __decorate([ + __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_0__angular_core__["NgModule"])({ + declarations: [ + __WEBPACK_IMPORTED_MODULE_5__components_app_app_component__["a" /* AppComponent */], + __WEBPACK_IMPORTED_MODULE_6__components_navmenu_navmenu_component__["a" /* NavMenuComponent */], + __WEBPACK_IMPORTED_MODULE_9__components_counter_counter_component__["a" /* CounterComponent */], + __WEBPACK_IMPORTED_MODULE_8__components_fetchdata_fetchdata_component__["a" /* FetchDataComponent */], + __WEBPACK_IMPORTED_MODULE_7__components_home_home_component__["a" /* HomeComponent */], + __WEBPACK_IMPORTED_MODULE_10__components_unauthorized_unauthorized_component__["a" /* UnauthorizedComponent */] + ], + imports: [ + __WEBPACK_IMPORTED_MODULE_11_angular_auth_oidc_client__["AuthModule"].forRoot(), + __WEBPACK_IMPORTED_MODULE_1__angular_common__["CommonModule"], + __WEBPACK_IMPORTED_MODULE_3__angular_common_http__["HttpClientModule"], + __WEBPACK_IMPORTED_MODULE_2__angular_forms__["FormsModule"], + __WEBPACK_IMPORTED_MODULE_4__angular_router__["RouterModule"].forRoot([ + { path: '', redirectTo: 'home', pathMatch: 'full' }, + { path: 'home', component: __WEBPACK_IMPORTED_MODULE_7__components_home_home_component__["a" /* HomeComponent */] }, + { path: 'unauthorized', component: __WEBPACK_IMPORTED_MODULE_10__components_unauthorized_unauthorized_component__["a" /* UnauthorizedComponent */] }, + { path: 'counter', component: __WEBPACK_IMPORTED_MODULE_9__components_counter_counter_component__["a" /* CounterComponent */] }, + { path: 'fetch-data', component: __WEBPACK_IMPORTED_MODULE_8__components_fetchdata_fetchdata_component__["a" /* FetchDataComponent */] }, + { path: '**', redirectTo: 'home' } + ]) + ], + providers: [ + __WEBPACK_IMPORTED_MODULE_12__components_services_auth_service__["a" /* AuthService */], + __WEBPACK_IMPORTED_MODULE_11_angular_auth_oidc_client__["OidcSecurityService"] + ] + }) + ], AppModuleShared); + return AppModuleShared; +}()); + -var Observable_1 = __webpack_require__(0); -var reduce_1 = __webpack_require__(43); -Observable_1.Observable.prototype.reduce = reduce_1.reduce; -//# sourceMappingURL=reduce.js.map /***/ }), -/* 206 */ -/***/ (function(module, exports, __webpack_require__) { +/* 65 */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return CounterComponent; }); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__(4); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0__angular_core__); +var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { + var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); + else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; + return c > 3 && r && Object.defineProperty(target, key, r), r; +}; + +var CounterComponent = (function () { + function CounterComponent() { + this.currentCount = 0; + } + CounterComponent.prototype.incrementCounter = function () { + this.currentCount++; + }; + CounterComponent = __decorate([ + __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Component"])({ + selector: 'counter', + template: __webpack_require__(84) + }) + ], CounterComponent); + return CounterComponent; +}()); + -var Observable_1 = __webpack_require__(0); -var repeat_1 = __webpack_require__(322); -Observable_1.Observable.prototype.repeat = repeat_1.repeat; -//# sourceMappingURL=repeat.js.map /***/ }), -/* 207 */ -/***/ (function(module, exports, __webpack_require__) { +/* 66 */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return FetchDataComponent; }); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__(4); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0__angular_core__); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__services_auth_service__ = __webpack_require__(14); +var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { + var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); + else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; + return c > 3 && r && Object.defineProperty(target, key, r), r; +}; +var __metadata = (this && this.__metadata) || function (k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); +}; +var __param = (this && this.__param) || function (paramIndex, decorator) { + return function (target, key) { decorator(target, key, paramIndex); } +}; + + +var FetchDataComponent = (function () { + function FetchDataComponent(authService, apiUrl) { + var _this = this; + authService.get(apiUrl + 'SampleData/WeatherForecasts').subscribe(function (result) { + _this.forecasts = result; + }, function (error) { return console.error(error); }); + } + FetchDataComponent = __decorate([ + __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Component"])({ + selector: 'fetchdata', + template: __webpack_require__(85) + }), + __param(1, __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Inject"])('API_URL')), + __metadata("design:paramtypes", [__WEBPACK_IMPORTED_MODULE_1__services_auth_service__["a" /* AuthService */], String]) + ], FetchDataComponent); + return FetchDataComponent; +}()); + -var Observable_1 = __webpack_require__(0); -var repeatWhen_1 = __webpack_require__(323); -Observable_1.Observable.prototype.repeatWhen = repeatWhen_1.repeatWhen; -//# sourceMappingURL=repeatWhen.js.map /***/ }), -/* 208 */ -/***/ (function(module, exports, __webpack_require__) { +/* 67 */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return HomeComponent; }); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__(4); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0__angular_core__); +var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { + var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); + else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; + return c > 3 && r && Object.defineProperty(target, key, r), r; +}; + +var HomeComponent = (function () { + function HomeComponent() { + } + HomeComponent = __decorate([ + __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Component"])({ + selector: 'home', + template: __webpack_require__(86) + }) + ], HomeComponent); + return HomeComponent; +}()); + -var Observable_1 = __webpack_require__(0); -var retry_1 = __webpack_require__(324); -Observable_1.Observable.prototype.retry = retry_1.retry; -//# sourceMappingURL=retry.js.map /***/ }), -/* 209 */ -/***/ (function(module, exports, __webpack_require__) { +/* 68 */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return NavMenuComponent; }); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__(4); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0__angular_core__); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__services_auth_service__ = __webpack_require__(14); +var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { + var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); + else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; + return c > 3 && r && Object.defineProperty(target, key, r), r; +}; +var __metadata = (this && this.__metadata) || function (k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); +}; + + +var NavMenuComponent = (function () { + function NavMenuComponent(authService) { + this.authService = authService; + } + NavMenuComponent.prototype.ngOnInit = function () { + var _this = this; + this.isAuthorizedSubscription = this.authService.getIsAuthorized().subscribe(function (isAuthorized) { + _this.isAuthorized = isAuthorized; + }); + }; + NavMenuComponent.prototype.ngOnDestroy = function () { + this.isAuthorizedSubscription.unsubscribe(); + }; + NavMenuComponent.prototype.login = function () { + this.authService.login(); + }; + NavMenuComponent.prototype.refreshSession = function () { + this.authService.refreshSession(); + }; + NavMenuComponent.prototype.logout = function () { + this.authService.logout(); + }; + NavMenuComponent = __decorate([ + __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Component"])({ + selector: 'nav-menu', + template: __webpack_require__(87), + styles: [__webpack_require__(119)] + }), + __metadata("design:paramtypes", [__WEBPACK_IMPORTED_MODULE_1__services_auth_service__["a" /* AuthService */]]) + ], NavMenuComponent); + return NavMenuComponent; +}()); + -var Observable_1 = __webpack_require__(0); -var retryWhen_1 = __webpack_require__(325); -Observable_1.Observable.prototype.retryWhen = retryWhen_1.retryWhen; -//# sourceMappingURL=retryWhen.js.map /***/ }), -/* 210 */ -/***/ (function(module, exports, __webpack_require__) { +/* 69 */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return UnauthorizedComponent; }); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__(4); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0__angular_core__); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__angular_common__ = __webpack_require__(5); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__angular_common___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1__angular_common__); +var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { + var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); + else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; + return c > 3 && r && Object.defineProperty(target, key, r), r; +}; +var __metadata = (this && this.__metadata) || function (k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); +}; + + +var UnauthorizedComponent = (function () { + function UnauthorizedComponent(location) { + this.location = location; + } + UnauthorizedComponent.prototype.ngOnInit = function () { + }; + UnauthorizedComponent.prototype.login = function () { + //this.service.startSigninMainWindow(); + }; + UnauthorizedComponent.prototype.goback = function () { + this.location.back(); + }; + UnauthorizedComponent = __decorate([ + __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Component"])({ + selector: 'app-unauthorized', + template: __webpack_require__(88) + }), + __metadata("design:paramtypes", [__WEBPACK_IMPORTED_MODULE_1__angular_common__["Location"]]) + ], UnauthorizedComponent); + return UnauthorizedComponent; +}()); + -var Observable_1 = __webpack_require__(0); -var sample_1 = __webpack_require__(326); -Observable_1.Observable.prototype.sample = sample_1.sample; -//# sourceMappingURL=sample.js.map /***/ }), -/* 211 */ -/***/ (function(module, exports, __webpack_require__) { +/* 70 */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; +Object.defineProperty(__webpack_exports__, "__esModule", { value: true }); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_reflect_metadata__ = __webpack_require__(59); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_reflect_metadata___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_reflect_metadata__); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_zone_js__ = __webpack_require__(62); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_zone_js___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_zone_js__); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_rxjs_add_operator_first__ = __webpack_require__(60); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_rxjs_add_operator_first___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2_rxjs_add_operator_first__); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__angular_common__ = __webpack_require__(5); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__angular_common___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_3__angular_common__); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__angular_core__ = __webpack_require__(4); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__angular_core___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_4__angular_core__); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__angular_platform_server__ = __webpack_require__(25); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__angular_platform_server___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_5__angular_platform_server__); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6_aspnet_prerendering__ = __webpack_require__(61); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6_aspnet_prerendering___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_6_aspnet_prerendering__); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__app_app_module_server__ = __webpack_require__(58); + + + + + + + + +__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_4__angular_core__["enableProdMode"])(); +/* harmony default export */ __webpack_exports__["default"] = (__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_6_aspnet_prerendering__["createServerRenderer"])(function (params) { + var providers = [ + { provide: __WEBPACK_IMPORTED_MODULE_5__angular_platform_server__["INITIAL_CONFIG"], useValue: { document: '', url: params.url } }, + { provide: __WEBPACK_IMPORTED_MODULE_3__angular_common__["APP_BASE_HREF"], useValue: params.baseUrl }, + { provide: 'BASE_URL', useValue: params.origin + params.baseUrl }, + { provide: 'ORIGIN_URL', useValue: params.origin + params.baseUrl }, + { provide: 'API_URL', useValue: params.data.apiUrl }, + { provide: 'IDENTITY_URL', useValue: params.data.identityUrl }, + { provide: 'URL_CONFIG', useValue: params.data } + ]; + return __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_5__angular_platform_server__["platformDynamicServer"])(providers).bootstrapModule(__WEBPACK_IMPORTED_MODULE_7__app_app_module_server__["a" /* AppModule */]).then(function (moduleRef) { + var appRef = moduleRef.injector.get(__WEBPACK_IMPORTED_MODULE_4__angular_core__["ApplicationRef"]); + var state = moduleRef.injector.get(__WEBPACK_IMPORTED_MODULE_5__angular_platform_server__["PlatformState"]); + var zone = moduleRef.injector.get(__WEBPACK_IMPORTED_MODULE_4__angular_core__["NgZone"]); + return new Promise(function (resolve, reject) { + zone.onError.subscribe(function (errorInfo) { return reject(errorInfo); }); + appRef.isStable.first(function (isStable) { return isStable; }).subscribe(function () { + // Because 'onStable' fires before 'onError', we have to delay slightly before + // completing the request in case there's an error to report + setImmediate(function () { + resolve({ + html: state.renderToString(), + globals: { url_Config: params.data } + }); + moduleRef.destroy(); + }); + }); + }); + }); +})); -var Observable_1 = __webpack_require__(0); -var sampleTime_1 = __webpack_require__(327); -Observable_1.Observable.prototype.sampleTime = sampleTime_1.sampleTime; -//# sourceMappingURL=sampleTime.js.map /***/ }), -/* 212 */ +/* 71 */ /***/ (function(module, exports, __webpack_require__) { -"use strict"; +exports = module.exports = __webpack_require__(54)(undefined); +// imports -var Observable_1 = __webpack_require__(0); -var scan_1 = __webpack_require__(328); -Observable_1.Observable.prototype.scan = scan_1.scan; -//# sourceMappingURL=scan.js.map -/***/ }), -/* 213 */ -/***/ (function(module, exports, __webpack_require__) { +// module +exports.push([module.i, "@media (max-width: 767px) {\r\n /* On small screens, the nav menu spans the full width of the screen. Leave a space for it. */\r\n .body-content {\r\n padding-top: 50px;\r\n }\r\n}\r\n", ""]); -"use strict"; +// exports -var Observable_1 = __webpack_require__(0); -var sequenceEqual_1 = __webpack_require__(329); -Observable_1.Observable.prototype.sequenceEqual = sequenceEqual_1.sequenceEqual; -//# sourceMappingURL=sequenceEqual.js.map /***/ }), -/* 214 */ +/* 72 */ /***/ (function(module, exports, __webpack_require__) { -"use strict"; +exports = module.exports = __webpack_require__(54)(undefined); +// imports -var Observable_1 = __webpack_require__(0); -var share_1 = __webpack_require__(398); -Observable_1.Observable.prototype.share = share_1.share; -//# sourceMappingURL=share.js.map -/***/ }), -/* 215 */ -/***/ (function(module, exports, __webpack_require__) { +// module +exports.push([module.i, "li .glyphicon {\r\n margin-right: 10px;\r\n}\r\n\r\n/* Highlighting rules for nav menu items */\r\nli.link-active a,\r\nli.link-active a:hover,\r\nli.link-active a:focus {\r\n background-color: #4189C7;\r\n color: white;\r\n}\r\n\r\n/* Keep the nav menu independent of scrolling and on top of other items */\r\n.main-nav {\r\n position: fixed;\r\n top: 0;\r\n left: 0;\r\n right: 0;\r\n z-index: 1;\r\n}\r\n\r\n@media (min-width: 768px) {\r\n /* On small screens, convert the nav menu to a vertical sidebar */\r\n .main-nav {\r\n height: 100%;\r\n width: calc(25% - 20px);\r\n }\r\n .navbar {\r\n border-radius: 0px;\r\n border-width: 0px;\r\n height: 100%;\r\n }\r\n .navbar-header {\r\n float: none;\r\n }\r\n .navbar-collapse {\r\n border-top: 1px solid #444;\r\n padding: 0px;\r\n }\r\n .navbar ul {\r\n float: none;\r\n }\r\n .navbar li {\r\n float: none;\r\n font-size: 15px;\r\n margin: 6px;\r\n }\r\n .navbar li a {\r\n padding: 10px 16px;\r\n border-radius: 4px;\r\n }\r\n .navbar a {\r\n /* If a menu item's text is too long, truncate it */\r\n width: 100%;\r\n white-space: nowrap;\r\n overflow: hidden;\r\n text-overflow: ellipsis;\r\n }\r\n}\r\n", ""]); -"use strict"; +// exports -var Observable_1 = __webpack_require__(0); -var shareReplay_1 = __webpack_require__(330); -Observable_1.Observable.prototype.shareReplay = shareReplay_1.shareReplay; -//# sourceMappingURL=shareReplay.js.map /***/ }), -/* 216 */ +/* 73 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -var Observable_1 = __webpack_require__(0); -var single_1 = __webpack_require__(331); -Observable_1.Observable.prototype.single = single_1.single; -//# sourceMappingURL=single.js.map +module.exports = CustomEvent; -/***/ }), -/* 217 */ -/***/ (function(module, exports, __webpack_require__) { +var Event = __webpack_require__(7); -"use strict"; +function CustomEvent(type, dictionary) { + // Just use the superclass constructor to initialize + Event.call(this, type, dictionary); +} +CustomEvent.prototype = Object.create(Event.prototype, { + constructor: { value: CustomEvent } +}); -var Observable_1 = __webpack_require__(0); -var skip_1 = __webpack_require__(332); -Observable_1.Observable.prototype.skip = skip_1.skip; -//# sourceMappingURL=skip.js.map /***/ }), -/* 218 */ +/* 74 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -var Observable_1 = __webpack_require__(0); -var skipLast_1 = __webpack_require__(333); -Observable_1.Observable.prototype.skipLast = skipLast_1.skipLast; -//# sourceMappingURL=skipLast.js.map +module.exports = FilteredElementList; -/***/ }), -/* 219 */ -/***/ (function(module, exports, __webpack_require__) { +var Node = __webpack_require__(3); -"use strict"; +// +// This file defines node list implementation that lazily traverses +// the document tree (or a subtree rooted at any element) and includes +// only those elements for which a specified filter function returns true. +// It is used to implement the +// {Document,Element}.getElementsBy{TagName,ClassName}{,NS} methods. +// -var Observable_1 = __webpack_require__(0); -var skipUntil_1 = __webpack_require__(334); -Observable_1.Observable.prototype.skipUntil = skipUntil_1.skipUntil; -//# sourceMappingURL=skipUntil.js.map +function FilteredElementList(root, filter) { + this.root = root; + this.filter = filter; + this.lastModTime = root.lastModTime; + this.done = false; + this.cache = []; + this.traverse(); +} -/***/ }), -/* 220 */ -/***/ (function(module, exports, __webpack_require__) { +FilteredElementList.prototype = { + get length() { + this.checkcache(); + if (!this.done) this.traverse(); + return this.cache.length; + }, -"use strict"; + item: function(n) { + this.checkcache(); + if (!this.done && n >= this.cache.length) this.traverse(n); + return this.cache[n]; + }, -var Observable_1 = __webpack_require__(0); -var skipWhile_1 = __webpack_require__(335); -Observable_1.Observable.prototype.skipWhile = skipWhile_1.skipWhile; -//# sourceMappingURL=skipWhile.js.map + checkcache: function() { + if (this.lastModTime !== this.root.lastModTime) { + // subtree has changed, so invalidate cache + for (var i = this.cache.length-1; i>=0; i--) { + this[i] = undefined; + } + this.cache.length = 0; + this.done = false; + this.lastModTime = this.root.lastModTime; + } + }, + + // If n is specified, then traverse the tree until we've found the nth + // item (or until we've found all items). If n is not specified, + // traverse until we've found all items. + traverse: function(n) { + // increment n so we can compare to length, and so it is never falsy + if (n !== undefined) n++; + + var elt; + while ((elt = this.next()) !== null) { + this[this.cache.length] = elt; //XXX Use proxy instead + this.cache.push(elt); + if (n && this.cache.length === n) return; + } + + // no next element, so we've found everything + this.done = true; + }, + + // Return the next element under root that matches filter + next: function() { + var start = (this.cache.length === 0) ? this.root // Start at the root or at + : this.cache[this.cache.length-1]; // the last element we found + + var elt; + if (start.nodeType === Node.DOCUMENT_NODE) + elt = start.documentElement; + else + elt = start.nextElement(this.root); -/***/ }), -/* 221 */ -/***/ (function(module, exports, __webpack_require__) { + while(elt) { + if (this.filter(elt)) { + return elt; + } -"use strict"; + elt = elt.nextElement(this.root); + } + return null; + } +}; -var Observable_1 = __webpack_require__(0); -var startWith_1 = __webpack_require__(336); -Observable_1.Observable.prototype.startWith = startWith_1.startWith; -//# sourceMappingURL=startWith.js.map /***/ }), -/* 222 */ +/* 75 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -var Observable_1 = __webpack_require__(0); -var subscribeOn_1 = __webpack_require__(337); -Observable_1.Observable.prototype.subscribeOn = subscribeOn_1.subscribeOn; -//# sourceMappingURL=subscribeOn.js.map +var URL = __webpack_require__(20); +var URLUtils = __webpack_require__(41); -/***/ }), -/* 223 */ -/***/ (function(module, exports, __webpack_require__) { +module.exports = Location; -"use strict"; +function Location(window, href) { + this._window = window; + this._href = href; +} -var Observable_1 = __webpack_require__(0); -var switch_1 = __webpack_require__(338); -Observable_1.Observable.prototype.switch = switch_1._switch; -Observable_1.Observable.prototype._switch = switch_1._switch; -//# sourceMappingURL=switch.js.map +Location.prototype = Object.create(URLUtils.prototype, { + constructor: { value: Location }, -/***/ }), -/* 224 */ -/***/ (function(module, exports, __webpack_require__) { + // Special behavior when href is set + href: { + get: function() { return this._href; }, + set: function(v) { this.assign(v); } + }, -"use strict"; + assign: { value: function(url) { + // Resolve the new url against the current one + // XXX: + // This is not actually correct. It should be resolved against + // the URL of the document of the script. For now, though, I only + // support a single window and there is only one base url. + // So this is good enough for now. + var current = new URL(this._href); + var newurl = current.resolve(url); -var Observable_1 = __webpack_require__(0); -var switchMap_1 = __webpack_require__(339); -Observable_1.Observable.prototype.switchMap = switchMap_1.switchMap; -//# sourceMappingURL=switchMap.js.map + // Save the new url + this._href = newurl; -/***/ }), -/* 225 */ -/***/ (function(module, exports, __webpack_require__) { + // Start loading the new document! + // XXX + // This is just something hacked together. + // The real algorithm is: http://www.whatwg.org/specs/web-apps/current-work/multipage/history.html#navigate + }}, -"use strict"; + replace: { value: function(url) { + // XXX + // Since we aren't tracking history yet, replace is the same as assign + this.assign(url); + }}, -var Observable_1 = __webpack_require__(0); -var switchMapTo_1 = __webpack_require__(340); -Observable_1.Observable.prototype.switchMapTo = switchMapTo_1.switchMapTo; -//# sourceMappingURL=switchMapTo.js.map + reload: { value: function() { + // XXX: + // Actually, the spec is a lot more complicated than this + this.assign(this.href); + }}, -/***/ }), -/* 226 */ -/***/ (function(module, exports, __webpack_require__) { + toString: { value: function() { + return this.href; + }} -"use strict"; +}); -var Observable_1 = __webpack_require__(0); -var take_1 = __webpack_require__(341); -Observable_1.Observable.prototype.take = take_1.take; -//# sourceMappingURL=take.js.map /***/ }), -/* 227 */ +/* 76 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -var Observable_1 = __webpack_require__(0); -var takeLast_1 = __webpack_require__(342); -Observable_1.Observable.prototype.takeLast = takeLast_1.takeLast; -//# sourceMappingURL=takeLast.js.map +module.exports = { + VALUE: 1, // The value of a Text, Comment or PI node changed + ATTR: 2, // A new attribute was added or an attribute value and/or prefix changed + REMOVE_ATTR: 3, // An attribute was removed + REMOVE: 4, // A node was removed + MOVE: 5, // A node was moved + INSERT: 6 // A node (or a subtree of nodes) was inserted +}; /***/ }), -/* 228 */ +/* 77 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -var Observable_1 = __webpack_require__(0); -var takeUntil_1 = __webpack_require__(343); -Observable_1.Observable.prototype.takeUntil = takeUntil_1.takeUntil; -//# sourceMappingURL=takeUntil.js.map -/***/ }), -/* 229 */ -/***/ (function(module, exports, __webpack_require__) { +// https://html.spec.whatwg.org/multipage/webappapis.html#navigatorid +var NavigatorID = Object.create(null, { + appCodeName: { value: "Mozilla" }, + appName: { value: "Netscape" }, + appVersion: { value: "4.0" }, + platform: { value: "" }, + product: { value: "Gecko" }, + productSub: { value: "20100101" }, + userAgent: { value: "" }, + vendor: { value: "" }, + vendorSub: { value: "" }, + taintEnabled: { value: function() { return false; } } +}); -"use strict"; +module.exports = NavigatorID; -var Observable_1 = __webpack_require__(0); -var takeWhile_1 = __webpack_require__(344); -Observable_1.Observable.prototype.takeWhile = takeWhile_1.takeWhile; -//# sourceMappingURL=takeWhile.js.map /***/ }), -/* 230 */ +/* 78 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -var Observable_1 = __webpack_require__(0); -var throttle_1 = __webpack_require__(65); -Observable_1.Observable.prototype.throttle = throttle_1.throttle; -//# sourceMappingURL=throttle.js.map +module.exports = NodeIterator; -/***/ }), -/* 231 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; +var NodeFilter = __webpack_require__(10); +var NodeTraversal = __webpack_require__(36); -var Observable_1 = __webpack_require__(0); -var throttleTime_1 = __webpack_require__(345); -Observable_1.Observable.prototype.throttleTime = throttleTime_1.throttleTime; -//# sourceMappingURL=throttleTime.js.map +/* Private methods and helpers */ -/***/ }), -/* 232 */ -/***/ (function(module, exports, __webpack_require__) { +/** + * @based on WebKit's NodeIterator::moveToNext and NodeIterator::moveToPrevious + * https://trac.webkit.org/browser/trunk/Source/WebCore/dom/NodeIterator.cpp?rev=186279#L51 + */ +function move(node, stayWithin, directionIsNext) { + if (directionIsNext) { + return NodeTraversal.next(node, stayWithin); + } else { + if (node === stayWithin) { + return null; + } + return NodeTraversal.previous(node, null); + } +} -"use strict"; +/** + * @spec http://www.w3.org/TR/dom/#concept-nodeiterator-traverse + * @method + * @access private + * @param {NodeIterator} ni + * @param {string} direction One of 'next' or 'previous'. + * @return {Node|null} + */ +function traverse(ni, directionIsNext) { + var node, beforeNode; + node = ni.referenceNode; + beforeNode = ni.pointerBeforeReferenceNode; + while (true) { + if (beforeNode === directionIsNext) { + beforeNode = !beforeNode; + } else { + node = move(node, ni.root, directionIsNext); + if (node === null) { + return null; + } + } + var result = ni.filter.acceptNode(node); + if (result === NodeFilter.FILTER_ACCEPT) { + break; + } + } + ni.referenceNode = node; + ni.pointerBeforeReferenceNode = beforeNode; + return node; +} -var Observable_1 = __webpack_require__(0); -var timeInterval_1 = __webpack_require__(66); -Observable_1.Observable.prototype.timeInterval = timeInterval_1.timeInterval; -//# sourceMappingURL=timeInterval.js.map +/* Public API */ -/***/ }), -/* 233 */ -/***/ (function(module, exports, __webpack_require__) { +/** + * Implemented version: http://www.w3.org/TR/2015/WD-dom-20150618/#nodeiterator + * Latest version: http://www.w3.org/TR/dom/#nodeiterator + * + * @constructor + * @param {Node} root + * @param {number} whatToShow [optional] + * @param {Function|NodeFilter} filter [optional] + * @throws Error + */ +function NodeIterator(root, whatToShow, filter) { + var ni = this, active = false; -"use strict"; + if (!root || !root.nodeType) { + throw new Error('DOMException: NOT_SUPPORTED_ERR'); + } -var Observable_1 = __webpack_require__(0); -var timeout_1 = __webpack_require__(346); -Observable_1.Observable.prototype.timeout = timeout_1.timeout; -//# sourceMappingURL=timeout.js.map + ni.root = ni.referenceNode = root; + ni.pointerBeforeReferenceNode = true; + ni.whatToShow = Number(whatToShow) || 0; -/***/ }), -/* 234 */ -/***/ (function(module, exports, __webpack_require__) { + if (typeof filter !== 'function') { + filter = null; + } -"use strict"; + ni.filter = Object.create(NodeFilter.prototype); -var Observable_1 = __webpack_require__(0); -var timeoutWith_1 = __webpack_require__(347); -Observable_1.Observable.prototype.timeoutWith = timeoutWith_1.timeoutWith; -//# sourceMappingURL=timeoutWith.js.map + /** + * @method + * @param {Node} node + * @return {Number} Constant NodeFilter.FILTER_ACCEPT, + * NodeFilter.FILTER_REJECT or NodeFilter.FILTER_SKIP. + */ + ni.filter.acceptNode = function (node) { + /* jshint bitwise: false */ + var result; + if (active) { + throw new Error('DOMException: INVALID_STATE_ERR'); + } -/***/ }), -/* 235 */ -/***/ (function(module, exports, __webpack_require__) { + // Maps nodeType to whatToShow + if (!(((1 << (node.nodeType - 1)) & ni.whatToShow))) { + return NodeFilter.FILTER_SKIP; + } -"use strict"; + if (filter === null) { + return NodeFilter.FILTER_ACCEPT; + } -var Observable_1 = __webpack_require__(0); -var timestamp_1 = __webpack_require__(67); -Observable_1.Observable.prototype.timestamp = timestamp_1.timestamp; -//# sourceMappingURL=timestamp.js.map + active = true; + result = filter(node); + active = false; -/***/ }), -/* 236 */ -/***/ (function(module, exports, __webpack_require__) { + return result; + }; +} -"use strict"; +NodeIterator.prototype = { + constructor: NodeIterator, -var Observable_1 = __webpack_require__(0); -var toArray_1 = __webpack_require__(348); -Observable_1.Observable.prototype.toArray = toArray_1.toArray; -//# sourceMappingURL=toArray.js.map + /** + * @spec http://www.w3.org/TR/dom/#dom-nodeiterator-nextnode + * @method + * @return {Node|null} + */ + nextNode: function () { + return traverse(this, true); + }, -/***/ }), -/* 237 */ -/***/ (function(module, exports, __webpack_require__) { + /** + * @spec http://www.w3.org/TR/dom/#dom-nodeiterator-previousnode + * @method + * @return {Node|null} + */ + previousNode: function () { + return traverse(this, false); + }, -"use strict"; + /** + * @spec http://www.w3.org/TR/dom/#dom-nodeiterator-detach + * @method + * @return void + */ + detach: function() { + /* "The detach() method must do nothing. + * Its functionality (disabling a NodeIterator object) was removed, + * but the method itself is preserved for compatibility. + */ + } +}; -var Observable_1 = __webpack_require__(0); -var toPromise_1 = __webpack_require__(68); -Observable_1.Observable.prototype.toPromise = toPromise_1.toPromise; -//# sourceMappingURL=toPromise.js.map /***/ }), -/* 238 */ +/* 79 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -var Observable_1 = __webpack_require__(0); -var window_1 = __webpack_require__(349); -Observable_1.Observable.prototype.window = window_1.window; -//# sourceMappingURL=window.js.map - -/***/ }), -/* 239 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; +module.exports = TreeWalker; -var Observable_1 = __webpack_require__(0); -var windowCount_1 = __webpack_require__(350); -Observable_1.Observable.prototype.windowCount = windowCount_1.windowCount; -//# sourceMappingURL=windowCount.js.map +var NodeFilter = __webpack_require__(10); +var NodeTraversal = __webpack_require__(36); -/***/ }), -/* 240 */ -/***/ (function(module, exports, __webpack_require__) { +var mapChild = { + first: 'firstChild', + last: 'lastChild', + next: 'firstChild', + previous: 'lastChild' +}; -"use strict"; +var mapSibling = { + first: 'nextSibling', + last: 'previousSibling', + next: 'nextSibling', + previous: 'previousSibling' +}; -var Observable_1 = __webpack_require__(0); -var windowTime_1 = __webpack_require__(351); -Observable_1.Observable.prototype.windowTime = windowTime_1.windowTime; -//# sourceMappingURL=windowTime.js.map +/* Private methods and helpers */ -/***/ }), -/* 241 */ -/***/ (function(module, exports, __webpack_require__) { +/** + * @spec http://www.w3.org/TR/dom/#concept-traverse-children + * @method + * @access private + * @param {TreeWalker} tw + * @param {string} type One of 'first' or 'last'. + * @return {Node|null} + */ +function traverseChildren(tw, type) { + var child, node, parent, result, sibling; + node = tw.currentNode[mapChild[type]]; + while (node !== null) { + result = tw.filter.acceptNode(node); + if (result === NodeFilter.FILTER_ACCEPT) { + tw.currentNode = node; + return node; + } + if (result === NodeFilter.FILTER_SKIP) { + child = node[mapChild[type]]; + if (child !== null) { + node = child; + continue; + } + } + while (node !== null) { + sibling = node[mapSibling[type]]; + if (sibling !== null) { + node = sibling; + break; + } + parent = node.parentNode; + if (parent === null || parent === tw.root || parent === tw.currentNode) { + return null; + } + else { + node = parent; + } + } + } + return null; +} -"use strict"; +/** + * @spec http://www.w3.org/TR/dom/#concept-traverse-siblings + * @method + * @access private + * @param {TreeWalker} tw + * @param {TreeWalker} type One of 'next' or 'previous'. + * @return {Node|nul} + */ +function traverseSiblings(tw, type) { + var node, result, sibling; + node = tw.currentNode; + if (node === tw.root) { + return null; + } + while (true) { + sibling = node[mapSibling[type]]; + while (sibling !== null) { + node = sibling; + result = tw.filter.acceptNode(node); + if (result === NodeFilter.FILTER_ACCEPT) { + tw.currentNode = node; + return node; + } + sibling = node[mapChild[type]]; + if (result === NodeFilter.FILTER_REJECT || sibling === null) { + sibling = node[mapSibling[type]]; + } + } + node = node.parentNode; + if (node === null || node === tw.root) { + return null; + } + if (tw.filter.acceptNode(node) === NodeFilter.FILTER_ACCEPT) { + return null; + } + } +} -var Observable_1 = __webpack_require__(0); -var windowToggle_1 = __webpack_require__(352); -Observable_1.Observable.prototype.windowToggle = windowToggle_1.windowToggle; -//# sourceMappingURL=windowToggle.js.map -/***/ }), -/* 242 */ -/***/ (function(module, exports, __webpack_require__) { +/* Public API */ -"use strict"; +/** + * Implemented version: http://www.w3.org/TR/2015/WD-dom-20150618/#interface-treewalker + * Latest version: http://www.w3.org/TR/dom/#interface-treewalker + * + * @constructor + * @param {Node} root + * @param {number} whatToShow [optional] + * @param {Function|NodeFilter} filter [optional] + * @throws Error + */ +function TreeWalker(root, whatToShow, filter) { + var tw = this, active = false; -var Observable_1 = __webpack_require__(0); -var windowWhen_1 = __webpack_require__(353); -Observable_1.Observable.prototype.windowWhen = windowWhen_1.windowWhen; -//# sourceMappingURL=windowWhen.js.map + if (!root || !root.nodeType) { + throw new Error('DOMException: NOT_SUPPORTED_ERR'); + } -/***/ }), -/* 243 */ -/***/ (function(module, exports, __webpack_require__) { + tw.root = root; + tw.whatToShow = Number(whatToShow) || 0; -"use strict"; + tw.currentNode = root; -var Observable_1 = __webpack_require__(0); -var withLatestFrom_1 = __webpack_require__(354); -Observable_1.Observable.prototype.withLatestFrom = withLatestFrom_1.withLatestFrom; -//# sourceMappingURL=withLatestFrom.js.map + if (typeof filter !== 'function') { + filter = null; + } -/***/ }), -/* 244 */ -/***/ (function(module, exports, __webpack_require__) { + tw.filter = Object.create(NodeFilter.prototype); -"use strict"; + /** + * @method + * @param {Node} node + * @return {Number} Constant NodeFilter.FILTER_ACCEPT, + * NodeFilter.FILTER_REJECT or NodeFilter.FILTER_SKIP. + */ + tw.filter.acceptNode = function (node) { + /* jshint bitwise: false */ + var result; + if (active) { + throw new Error('DOMException: INVALID_STATE_ERR'); + } -var Observable_1 = __webpack_require__(0); -var zip_1 = __webpack_require__(39); -Observable_1.Observable.prototype.zip = zip_1.zipProto; -//# sourceMappingURL=zip.js.map + // Maps nodeType to whatToShow + if (!(((1 << (node.nodeType - 1)) & tw.whatToShow))) { + return NodeFilter.FILTER_SKIP; + } -/***/ }), -/* 245 */ -/***/ (function(module, exports, __webpack_require__) { + if (filter === null) { + return NodeFilter.FILTER_ACCEPT; + } -"use strict"; + active = true; + result = filter(node); + active = false; -var Observable_1 = __webpack_require__(0); -var zipAll_1 = __webpack_require__(355); -Observable_1.Observable.prototype.zipAll = zipAll_1.zipAll; -//# sourceMappingURL=zipAll.js.map + return result; + }; +} -/***/ }), -/* 246 */ -/***/ (function(module, exports, __webpack_require__) { +TreeWalker.prototype = { -"use strict"; + constructor: TreeWalker, -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; -var Observable_1 = __webpack_require__(0); -var tryCatch_1 = __webpack_require__(7); -var errorObject_1 = __webpack_require__(5); -var AsyncSubject_1 = __webpack_require__(25); -/** - * We need this JSDoc comment for affecting ESDoc. - * @extends {Ignored} - * @hide true - */ -var BoundCallbackObservable = (function (_super) { - __extends(BoundCallbackObservable, _super); - function BoundCallbackObservable(callbackFunc, selector, args, context, scheduler) { - _super.call(this); - this.callbackFunc = callbackFunc; - this.selector = selector; - this.args = args; - this.context = context; - this.scheduler = scheduler; + /** + * @spec http://www.w3.org/TR/dom/#dom-treewalker-parentnode + * @method + * @return {Node|null} + */ + parentNode: function () { + var node = this.currentNode; + while (node !== null && node !== this.root) { + node = node.parentNode; + if (node !== null && this.filter.acceptNode(node) === NodeFilter.FILTER_ACCEPT) { + this.currentNode = node; + return node; + } } - /* tslint:enable:max-line-length */ - /** - * Converts a callback API to a function that returns an Observable. - * - * Give it a function `f` of type `f(x, callback)` and - * it will return a function `g` that when called as `g(x)` will output an - * Observable. - * - * `bindCallback` is not an operator because its input and output are not - * Observables. The input is a function `func` with some parameters, but the - * last parameter must be a callback function that `func` calls when it is - * done. - * - * The output of `bindCallback` is a function that takes the same parameters - * as `func`, except the last one (the callback). When the output function - * is called with arguments, it will return an Observable. If `func` function - * calls its callback with one argument, the Observable will emit that value. - * If on the other hand callback is called with multiple values, resulting - * Observable will emit an array with these arguments. - * - * It is very important to remember, that input function `func` is not called - * when output function is, but rather when Observable returned by output - * function is subscribed. This means if `func` makes AJAX request, that request - * will be made every time someone subscribes to resulting Observable, but not before. - * - * Optionally, selector function can be passed to `bindObservable`. That function - * takes the same arguments as callback, and returns value - * that will be emitted by Observable instead of callback parameters themselves. - * Even though by default multiple arguments passed to callback appear in the stream as array, - * selector function will be called with arguments directly, just as callback would. - * This means you can imagine default selector (when one is not provided explicitly) - * as function that aggregates all its arguments into array, or simply returns first argument, - * if there is only one. - * - * Last optional parameter - {@link Scheduler} - can be used to control when call - * to `func` happens after someone subscribes to Observable, as well as when results - * passed to callback will be emitted. By default subscription to Observable calls `func` - * synchronously, but using `Scheduler.async` as last parameter will defer call to input function, - * just like wrapping that call in `setTimeout` with time `0` would. So if you use async Scheduler - * and call `subscribe` on output Observable, all function calls that are currently executing, - * will end before `func` is invoked. - * - * When it comes to emitting results passed to callback, by default they are emitted - * immediately after `func` invokes callback. In particular, if callback is called synchronously, - * then subscription to resulting Observable will call `next` function synchronously as well. - * If you want to defer that call, using `Scheduler.async` will, again, do the job. - * This means that by using `Scheduler.async` you can, in a sense, ensure that `func` - * always calls its callback asynchronously, thus avoiding terrifying Zalgo. - * - * Note that Observable created by output function will always emit only one value - * and then complete right after. Even if `func` calls callback multiple times, values from - * second and following calls will never appear in the stream. If you need to - * listen for multiple calls, you probably want to use {@link fromEvent} or - * {@link fromEventPattern} instead. - * - * If `func` depends on some context (`this` property), that context will be set - * to the same context that output function has at call time. In particular, if `func` - * is called as method of some object, in order to preserve proper behaviour, - * it is recommended to set context of output function to that object as well, - * provided `func` is not already bound. - * - * If input function calls its callback in "node style" (i.e. first argument to callback is - * optional error parameter signaling whether call failed or not), {@link bindNodeCallback} - * provides convenient error handling and probably is a better choice. - * `bindCallback` will treat such functions without any difference and error parameter - * (whether passed or not) will always be interpreted as regular callback argument. - * - * - * @example Convert jQuery's getJSON to an Observable API - * // Suppose we have jQuery.getJSON('/my/url', callback) - * var getJSONAsObservable = Rx.Observable.bindCallback(jQuery.getJSON); - * var result = getJSONAsObservable('/my/url'); - * result.subscribe(x => console.log(x), e => console.error(e)); - * - * - * @example Receive array of arguments passed to callback - * someFunction((a, b, c) => { - * console.log(a); // 5 - * console.log(b); // 'some string' - * console.log(c); // {someProperty: 'someValue'} - * }); - * - * const boundSomeFunction = Rx.Observable.bindCallback(someFunction); - * boundSomeFunction().subscribe(values => { - * console.log(values) // [5, 'some string', {someProperty: 'someValue'}] - * }); - * - * - * @example Use bindCallback with selector function - * someFunction((a, b, c) => { - * console.log(a); // 'a' - * console.log(b); // 'b' - * console.log(c); // 'c' - * }); - * - * const boundSomeFunction = Rx.Observable.bindCallback(someFunction, (a, b, c) => a + b + c); - * boundSomeFunction().subscribe(value => { - * console.log(value) // 'abc' - * }); - * - * - * @example Compare behaviour with and without async Scheduler - * function iCallMyCallbackSynchronously(cb) { - * cb(); - * } - * - * const boundSyncFn = Rx.Observable.bindCallback(iCallMyCallbackSynchronously); - * const boundAsyncFn = Rx.Observable.bindCallback(iCallMyCallbackSynchronously, null, Rx.Scheduler.async); - * - * boundSyncFn().subscribe(() => console.log('I was sync!')); - * boundAsyncFn().subscribe(() => console.log('I was async!')); - * console.log('This happened...'); - * - * // Logs: - * // I was sync! - * // This happened... - * // I was async! - * - * - * @example Use bindCallback on object method - * const boundMethod = Rx.Observable.bindCallback(someObject.methodWithCallback); - * boundMethod.call(someObject) // make sure methodWithCallback has access to someObject - * .subscribe(subscriber); - * - * - * @see {@link bindNodeCallback} - * @see {@link from} - * @see {@link fromPromise} - * - * @param {function} func Function with a callback as the last parameter. - * @param {function} [selector] A function which takes the arguments from the - * callback and maps those to a value to emit on the output Observable. - * @param {Scheduler} [scheduler] The scheduler on which to schedule the - * callbacks. - * @return {function(...params: *): Observable} A function which returns the - * Observable that delivers the same values the callback would deliver. - * @static true - * @name bindCallback - * @owner Observable - */ - BoundCallbackObservable.create = function (func, selector, scheduler) { - if (selector === void 0) { selector = undefined; } - return function () { - var args = []; - for (var _i = 0; _i < arguments.length; _i++) { - args[_i - 0] = arguments[_i]; - } - return new BoundCallbackObservable(func, selector, args, this, scheduler); - }; - }; - BoundCallbackObservable.prototype._subscribe = function (subscriber) { - var callbackFunc = this.callbackFunc; - var args = this.args; - var scheduler = this.scheduler; - var subject = this.subject; - if (!scheduler) { - if (!subject) { - subject = this.subject = new AsyncSubject_1.AsyncSubject(); - var handler = function handlerFn() { - var innerArgs = []; - for (var _i = 0; _i < arguments.length; _i++) { - innerArgs[_i - 0] = arguments[_i]; - } - var source = handlerFn.source; - var selector = source.selector, subject = source.subject; - if (selector) { - var result_1 = tryCatch_1.tryCatch(selector).apply(this, innerArgs); - if (result_1 === errorObject_1.errorObject) { - subject.error(errorObject_1.errorObject.e); - } - else { - subject.next(result_1); - subject.complete(); - } - } - else { - subject.next(innerArgs.length <= 1 ? innerArgs[0] : innerArgs); - subject.complete(); - } - }; - // use named function instance to avoid closure. - handler.source = this; - var result = tryCatch_1.tryCatch(callbackFunc).apply(this.context, args.concat(handler)); - if (result === errorObject_1.errorObject) { - subject.error(errorObject_1.errorObject.e); - } - } - return subject.subscribe(subscriber); - } - else { - return scheduler.schedule(BoundCallbackObservable.dispatch, 0, { source: this, subscriber: subscriber, context: this.context }); - } - }; - BoundCallbackObservable.dispatch = function (state) { - var self = this; - var source = state.source, subscriber = state.subscriber, context = state.context; - var callbackFunc = source.callbackFunc, args = source.args, scheduler = source.scheduler; - var subject = source.subject; - if (!subject) { - subject = source.subject = new AsyncSubject_1.AsyncSubject(); - var handler = function handlerFn() { - var innerArgs = []; - for (var _i = 0; _i < arguments.length; _i++) { - innerArgs[_i - 0] = arguments[_i]; - } - var source = handlerFn.source; - var selector = source.selector, subject = source.subject; - if (selector) { - var result_2 = tryCatch_1.tryCatch(selector).apply(this, innerArgs); - if (result_2 === errorObject_1.errorObject) { - self.add(scheduler.schedule(dispatchError, 0, { err: errorObject_1.errorObject.e, subject: subject })); - } - else { - self.add(scheduler.schedule(dispatchNext, 0, { value: result_2, subject: subject })); - } - } - else { - var value = innerArgs.length <= 1 ? innerArgs[0] : innerArgs; - self.add(scheduler.schedule(dispatchNext, 0, { value: value, subject: subject })); - } - }; - // use named function to pass values in without closure - handler.source = source; - var result = tryCatch_1.tryCatch(callbackFunc).apply(context, args.concat(handler)); - if (result === errorObject_1.errorObject) { - subject.error(errorObject_1.errorObject.e); - } - } - self.add(subject.subscribe(subscriber)); - }; - return BoundCallbackObservable; -}(Observable_1.Observable)); -exports.BoundCallbackObservable = BoundCallbackObservable; -function dispatchNext(arg) { - var value = arg.value, subject = arg.subject; - subject.next(value); - subject.complete(); -} -function dispatchError(arg) { - var err = arg.err, subject = arg.subject; - subject.error(err); -} -//# sourceMappingURL=BoundCallbackObservable.js.map + return null; + }, + + /** + * @spec http://www.w3.org/TR/dom/#dom-treewalker-firstchild + * @method + * @return {Node|null} + */ + firstChild: function () { + return traverseChildren(this, 'first'); + }, + + /** + * @spec http://www.w3.org/TR/dom/#dom-treewalker-lastchild + * @method + * @return {Node|null} + */ + lastChild: function () { + return traverseChildren(this, 'last'); + }, + + /** + * @spec http://www.w3.org/TR/dom/#dom-treewalker-previoussibling + * @method + * @return {Node|null} + */ + previousSibling: function () { + return traverseSiblings(this, 'previous'); + }, + + /** + * @spec http://www.w3.org/TR/dom/#dom-treewalker-nextsibling + * @method + * @return {Node|null} + */ + nextSibling: function () { + return traverseSiblings(this, 'next'); + }, + + /** + * @spec http://www.w3.org/TR/dom/#dom-treewalker-previousnode + * @method + * @return {Node|null} + */ + previousNode: function () { + var node, result, sibling; + node = this.currentNode; + while (node !== this.root) { + sibling = node.previousSibling; + while (sibling !== null) { + node = sibling; + result = this.filter.acceptNode(node); + while (result !== NodeFilter.FILTER_REJECT && node.lastChild !== null) { + node = node.lastChild; + result = this.filter.acceptNode(node); + } + if (result === NodeFilter.FILTER_ACCEPT) { + this.currentNode = node; + return node; + } + sibling = node.previousSibling; + } + if (node === this.root || node.parentNode === null) { + return null; + } + node = node.parentNode; + if (this.filter.acceptNode(node) === NodeFilter.FILTER_ACCEPT) { + this.currentNode = node; + return node; + } + } + return null; + }, + + /** + * @spec http://www.w3.org/TR/dom/#dom-treewalker-nextnode + * @based on WebKit's TreeWalker::nextNode + * https://trac.webkit.org/browser/trunk/Source/WebCore/dom/TreeWalker.cpp?rev=179143#L252 + * @method + * @return {Node|null} + */ + nextNode: function () { + var node, result, following; + node = this.currentNode; + result = NodeFilter.FILTER_ACCEPT; + + while (true) { + while (result !== NodeFilter.FILTER_REJECT && node.firstChild !== null) { + node = node.firstChild; + result = this.filter.acceptNode(node); + if (result === NodeFilter.FILTER_ACCEPT) { + this.currentNode = node; + return node; + } + } + following = NodeTraversal.nextSkippingChildren(node, this.root); + if (following !== null) { + node = following; + } + else { + return null; + } + result = this.filter.acceptNode(node); + if (result === NodeFilter.FILTER_ACCEPT) { + this.currentNode = node; + return node; + } + } + } +}; + /***/ }), -/* 247 */ +/* 80 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + +// https://html.spec.whatwg.org/multipage/webappapis.html#windowtimers +var WindowTimers = { + setTimeout: setTimeout, + clearTimeout: clearTimeout, + setInterval: setInterval, + clearInterval: clearInterval }; -var Observable_1 = __webpack_require__(0); -var tryCatch_1 = __webpack_require__(7); -var errorObject_1 = __webpack_require__(5); -var AsyncSubject_1 = __webpack_require__(25); -/** - * We need this JSDoc comment for affecting ESDoc. - * @extends {Ignored} - * @hide true - */ -var BoundNodeCallbackObservable = (function (_super) { - __extends(BoundNodeCallbackObservable, _super); - function BoundNodeCallbackObservable(callbackFunc, selector, args, context, scheduler) { - _super.call(this); - this.callbackFunc = callbackFunc; - this.selector = selector; - this.args = args; - this.context = context; - this.scheduler = scheduler; - } - /* tslint:enable:max-line-length */ - /** - * Converts a Node.js-style callback API to a function that returns an - * Observable. - * - * It's just like {@link bindCallback}, but the - * callback is expected to be of type `callback(error, result)`. - * - * `bindNodeCallback` is not an operator because its input and output are not - * Observables. The input is a function `func` with some parameters, but the - * last parameter must be a callback function that `func` calls when it is - * done. The callback function is expected to follow Node.js conventions, - * where the first argument to the callback is an error object, signaling - * whether call was successful. If that object is passed to callback, it means - * something went wrong. - * - * The output of `bindNodeCallback` is a function that takes the same - * parameters as `func`, except the last one (the callback). When the output - * function is called with arguments, it will return an Observable. - * If `func` calls its callback with error parameter present, Observable will - * error with that value as well. If error parameter is not passed, Observable will emit - * second parameter. If there are more parameters (third and so on), - * Observable will emit an array with all arguments, except first error argument. - * - * Optionally `bindNodeCallback` accepts selector function, which allows you to - * make resulting Observable emit value computed by selector, instead of regular - * callback arguments. It works similarly to {@link bindCallback} selector, but - * Node.js-style error argument will never be passed to that function. - * - * Note that `func` will not be called at the same time output function is, - * but rather whenever resulting Observable is subscribed. By default call to - * `func` will happen synchronously after subscription, but that can be changed - * with proper {@link Scheduler} provided as optional third parameter. Scheduler - * can also control when values from callback will be emitted by Observable. - * To find out more, check out documentation for {@link bindCallback}, where - * Scheduler works exactly the same. - * - * As in {@link bindCallback}, context (`this` property) of input function will be set to context - * of returned function, when it is called. - * - * After Observable emits value, it will complete immediately. This means - * even if `func` calls callback again, values from second and consecutive - * calls will never appear on the stream. If you need to handle functions - * that call callbacks multiple times, check out {@link fromEvent} or - * {@link fromEventPattern} instead. - * - * Note that `bindNodeCallback` can be used in non-Node.js environments as well. - * "Node.js-style" callbacks are just a convention, so if you write for - * browsers or any other environment and API you use implements that callback style, - * `bindNodeCallback` can be safely used on that API functions as well. - * - * Remember that Error object passed to callback does not have to be an instance - * of JavaScript built-in `Error` object. In fact, it does not even have to an object. - * Error parameter of callback function is interpreted as "present", when value - * of that parameter is truthy. It could be, for example, non-zero number, non-empty - * string or boolean `true`. In all of these cases resulting Observable would error - * with that value. This means usually regular style callbacks will fail very often when - * `bindNodeCallback` is used. If your Observable errors much more often then you - * would expect, check if callback really is called in Node.js-style and, if not, - * switch to {@link bindCallback} instead. - * - * Note that even if error parameter is technically present in callback, but its value - * is falsy, it still won't appear in array emitted by Observable or in selector function. - * - * - * @example Read a file from the filesystem and get the data as an Observable - * import * as fs from 'fs'; - * var readFileAsObservable = Rx.Observable.bindNodeCallback(fs.readFile); - * var result = readFileAsObservable('./roadNames.txt', 'utf8'); - * result.subscribe(x => console.log(x), e => console.error(e)); - * - * - * @example Use on function calling callback with multiple arguments - * someFunction((err, a, b) => { - * console.log(err); // null - * console.log(a); // 5 - * console.log(b); // "some string" - * }); - * var boundSomeFunction = Rx.Observable.bindNodeCallback(someFunction); - * boundSomeFunction() - * .subscribe(value => { - * console.log(value); // [5, "some string"] - * }); - * - * - * @example Use with selector function - * someFunction((err, a, b) => { - * console.log(err); // undefined - * console.log(a); // "abc" - * console.log(b); // "DEF" - * }); - * var boundSomeFunction = Rx.Observable.bindNodeCallback(someFunction, (a, b) => a + b); - * boundSomeFunction() - * .subscribe(value => { - * console.log(value); // "abcDEF" - * }); - * - * - * @example Use on function calling callback in regular style - * someFunction(a => { - * console.log(a); // 5 - * }); - * var boundSomeFunction = Rx.Observable.bindNodeCallback(someFunction); - * boundSomeFunction() - * .subscribe( - * value => {} // never gets called - * err => console.log(err) // 5 - *); - * - * - * @see {@link bindCallback} - * @see {@link from} - * @see {@link fromPromise} - * - * @param {function} func Function with a Node.js-style callback as the last parameter. - * @param {function} [selector] A function which takes the arguments from the - * callback and maps those to a value to emit on the output Observable. - * @param {Scheduler} [scheduler] The scheduler on which to schedule the - * callbacks. - * @return {function(...params: *): Observable} A function which returns the - * Observable that delivers the same values the Node.js callback would - * deliver. - * @static true - * @name bindNodeCallback - * @owner Observable - */ - BoundNodeCallbackObservable.create = function (func, selector, scheduler) { - if (selector === void 0) { selector = undefined; } - return function () { - var args = []; - for (var _i = 0; _i < arguments.length; _i++) { - args[_i - 0] = arguments[_i]; - } - return new BoundNodeCallbackObservable(func, selector, args, this, scheduler); - }; - }; - BoundNodeCallbackObservable.prototype._subscribe = function (subscriber) { - var callbackFunc = this.callbackFunc; - var args = this.args; - var scheduler = this.scheduler; - var subject = this.subject; - if (!scheduler) { - if (!subject) { - subject = this.subject = new AsyncSubject_1.AsyncSubject(); - var handler = function handlerFn() { - var innerArgs = []; - for (var _i = 0; _i < arguments.length; _i++) { - innerArgs[_i - 0] = arguments[_i]; - } - var source = handlerFn.source; - var selector = source.selector, subject = source.subject; - var err = innerArgs.shift(); - if (err) { - subject.error(err); - } - else if (selector) { - var result_1 = tryCatch_1.tryCatch(selector).apply(this, innerArgs); - if (result_1 === errorObject_1.errorObject) { - subject.error(errorObject_1.errorObject.e); - } - else { - subject.next(result_1); - subject.complete(); - } - } - else { - subject.next(innerArgs.length <= 1 ? innerArgs[0] : innerArgs); - subject.complete(); - } - }; - // use named function instance to avoid closure. - handler.source = this; - var result = tryCatch_1.tryCatch(callbackFunc).apply(this.context, args.concat(handler)); - if (result === errorObject_1.errorObject) { - subject.error(errorObject_1.errorObject.e); - } - } - return subject.subscribe(subscriber); - } - else { - return scheduler.schedule(dispatch, 0, { source: this, subscriber: subscriber, context: this.context }); - } - }; - return BoundNodeCallbackObservable; -}(Observable_1.Observable)); -exports.BoundNodeCallbackObservable = BoundNodeCallbackObservable; -function dispatch(state) { - var self = this; - var source = state.source, subscriber = state.subscriber, context = state.context; - // XXX: cast to `any` to access to the private field in `source`. - var _a = source, callbackFunc = _a.callbackFunc, args = _a.args, scheduler = _a.scheduler; - var subject = source.subject; - if (!subject) { - subject = source.subject = new AsyncSubject_1.AsyncSubject(); - var handler = function handlerFn() { - var innerArgs = []; - for (var _i = 0; _i < arguments.length; _i++) { - innerArgs[_i - 0] = arguments[_i]; - } - var source = handlerFn.source; - var selector = source.selector, subject = source.subject; - var err = innerArgs.shift(); - if (err) { - self.add(scheduler.schedule(dispatchError, 0, { err: err, subject: subject })); - } - else if (selector) { - var result_2 = tryCatch_1.tryCatch(selector).apply(this, innerArgs); - if (result_2 === errorObject_1.errorObject) { - self.add(scheduler.schedule(dispatchError, 0, { err: errorObject_1.errorObject.e, subject: subject })); - } - else { - self.add(scheduler.schedule(dispatchNext, 0, { value: result_2, subject: subject })); - } - } - else { - var value = innerArgs.length <= 1 ? innerArgs[0] : innerArgs; - self.add(scheduler.schedule(dispatchNext, 0, { value: value, subject: subject })); - } - }; - // use named function to pass values in without closure - handler.source = source; - var result = tryCatch_1.tryCatch(callbackFunc).apply(context, args.concat(handler)); - if (result === errorObject_1.errorObject) { - self.add(scheduler.schedule(dispatchError, 0, { err: errorObject_1.errorObject.e, subject: subject })); - } - } - self.add(subject.subscribe(subscriber)); -} -function dispatchNext(arg) { - var value = arg.value, subject = arg.subject; - subject.next(value); - subject.complete(); -} -function dispatchError(arg) { - var err = arg.err, subject = arg.subject; - subject.error(err); -} -//# sourceMappingURL=BoundNodeCallbackObservable.js.map + +module.exports = WindowTimers; + /***/ }), -/* 248 */ +/* 81 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; +/* jshint node:true, latedef:false */ + // jshint ignore:line +/*! +Parser-Lib +Copyright (c) 2009-2011 Nicholas C. Zakas. All rights reserved. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. + +*/ +/* Version v0.2.5+domino1, Build time: 30-January-2016 05:13:03 */ +var parserlib = Object.create(null); +(function(){ -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; -var Observable_1 = __webpack_require__(0); -var subscribeToResult_1 = __webpack_require__(3); -var OuterSubscriber_1 = __webpack_require__(4); /** - * We need this JSDoc comment for affecting ESDoc. - * @extends {Ignored} - * @hide true + * A generic base to inherit from for any object + * that needs event handling. + * @class EventTarget + * @constructor */ -var DeferObservable = (function (_super) { - __extends(DeferObservable, _super); - function DeferObservable(observableFactory) { - _super.call(this); - this.observableFactory = observableFactory; - } +function EventTarget(){ + /** - * Creates an Observable that, on subscribe, calls an Observable factory to - * make an Observable for each new Observer. - * - * Creates the Observable lazily, that is, only when it - * is subscribed. - * - * - * - * - * `defer` allows you to create the Observable only when the Observer - * subscribes, and create a fresh Observable for each Observer. It waits until - * an Observer subscribes to it, and then it generates an Observable, - * typically with an Observable factory function. It does this afresh for each - * subscriber, so although each subscriber may think it is subscribing to the - * same Observable, in fact each subscriber gets its own individual - * Observable. - * - * @example Subscribe to either an Observable of clicks or an Observable of interval, at random - * var clicksOrInterval = Rx.Observable.defer(function () { - * if (Math.random() > 0.5) { - * return Rx.Observable.fromEvent(document, 'click'); - * } else { - * return Rx.Observable.interval(1000); - * } - * }); - * clicksOrInterval.subscribe(x => console.log(x)); - * - * // Results in the following behavior: - * // If the result of Math.random() is greater than 0.5 it will listen - * // for clicks anywhere on the "document"; when document is clicked it - * // will log a MouseEvent object to the console. If the result is less - * // than 0.5 it will emit ascending numbers, one every second(1000ms). - * - * @see {@link create} - * - * @param {function(): SubscribableOrPromise} observableFactory The Observable - * factory function to invoke for each Observer that subscribes to the output - * Observable. May also return a Promise, which will be converted on the fly - * to an Observable. - * @return {Observable} An Observable whose Observers' subscriptions trigger - * an invocation of the given Observable factory function. - * @static true - * @name defer - * @owner Observable + * The array of listeners for various events. + * @type Object + * @property _listeners + * @private */ - DeferObservable.create = function (observableFactory) { - return new DeferObservable(observableFactory); - }; - DeferObservable.prototype._subscribe = function (subscriber) { - return new DeferSubscriber(subscriber, this.observableFactory); - }; - return DeferObservable; -}(Observable_1.Observable)); -exports.DeferObservable = DeferObservable; -var DeferSubscriber = (function (_super) { - __extends(DeferSubscriber, _super); - function DeferSubscriber(destination, factory) { - _super.call(this, destination); - this.factory = factory; - this.tryDefer(); - } - DeferSubscriber.prototype.tryDefer = function () { - try { - this._callFactory(); + this._listeners = Object.create(null); +} + +EventTarget.prototype = { + + //restore constructor + constructor: EventTarget, + + /** + * Adds a listener for a given event type. + * @param {String} type The type of event to add a listener for. + * @param {Function} listener The function to call when the event occurs. + * @return {void} + * @method addListener + */ + addListener: function(type, listener){ + if (!this._listeners[type]){ + this._listeners[type] = []; + } + + this._listeners[type].push(listener); + }, + + /** + * Fires an event based on the passed-in object. + * @param {Object|String} event An object with at least a 'type' attribute + * or a string indicating the event name. + * @return {void} + * @method fire + */ + fire: function(event){ + if (typeof event === "string"){ + event = { type: event }; } - catch (err) { - this._error(err); + if (typeof event.target !== "undefined"){ + event.target = this; } - }; - DeferSubscriber.prototype._callFactory = function () { - var result = this.factory(); - if (result) { - this.add(subscribeToResult_1.subscribeToResult(this, result)); + + if (typeof event.type === "undefined"){ + throw new Error("Event object missing 'type' property."); } - }; - return DeferSubscriber; -}(OuterSubscriber_1.OuterSubscriber)); -//# sourceMappingURL=DeferObservable.js.map -/***/ }), -/* 249 */ -/***/ (function(module, exports, __webpack_require__) { + if (this._listeners[event.type]){ -"use strict"; + //create a copy of the array and use that so listeners can't chane + var listeners = this._listeners[event.type].concat(); + for (var i=0, len=listeners.length; i < len; i++){ + listeners[i].call(this, event); + } + } + }, -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + /** + * Removes a listener for a given event type. + * @param {String} type The type of event to remove a listener from. + * @param {Function} listener The function to remove from the event. + * @return {void} + * @method removeListener + */ + removeListener: function(type, listener){ + if (this._listeners[type]){ + var listeners = this._listeners[type]; + for (var i=0, len=listeners.length; i < len; i++){ + if (listeners[i] === listener){ + listeners.splice(i, 1); + break; + } + } + + + } + } }; -var Observable_1 = __webpack_require__(0); /** - * We need this JSDoc comment for affecting ESDoc. - * @extends {Ignored} - * @hide true + * Convenient way to read through strings. + * @namespace parserlib.util + * @class StringReader + * @constructor + * @param {String} text The text to read. */ -var ErrorObservable = (function (_super) { - __extends(ErrorObservable, _super); - function ErrorObservable(error, scheduler) { - _super.call(this); - this.error = error; - this.scheduler = scheduler; - } +function StringReader(text){ + /** - * Creates an Observable that emits no items to the Observer and immediately - * emits an error notification. - * - * Just emits 'error', and nothing else. - * - * - * - * - * This static operator is useful for creating a simple Observable that only - * emits the error notification. It can be used for composing with other - * Observables, such as in a {@link mergeMap}. - * - * @example Emit the number 7, then emit an error. - * var result = Rx.Observable.throw(new Error('oops!')).startWith(7); - * result.subscribe(x => console.log(x), e => console.error(e)); - * - * @example Map and flatten numbers to the sequence 'a', 'b', 'c', but throw an error for 13 - * var interval = Rx.Observable.interval(1000); - * var result = interval.mergeMap(x => - * x === 13 ? - * Rx.Observable.throw('Thirteens are bad') : - * Rx.Observable.of('a', 'b', 'c') - * ); - * result.subscribe(x => console.log(x), e => console.error(e)); - * - * @see {@link create} - * @see {@link empty} - * @see {@link never} - * @see {@link of} - * - * @param {any} error The particular Error to pass to the error notification. - * @param {Scheduler} [scheduler] A {@link IScheduler} to use for scheduling - * the emission of the error notification. - * @return {Observable} An error Observable: emits only the error notification - * using the given error argument. - * @static true - * @name throw - * @owner Observable + * The input text with line endings normalized. + * @property _input + * @type String + * @private */ - ErrorObservable.create = function (error, scheduler) { - return new ErrorObservable(error, scheduler); - }; - ErrorObservable.dispatch = function (arg) { - var error = arg.error, subscriber = arg.subscriber; - subscriber.error(error); - }; - ErrorObservable.prototype._subscribe = function (subscriber) { - var error = this.error; - var scheduler = this.scheduler; - subscriber.syncErrorThrowable = true; - if (scheduler) { - return scheduler.schedule(ErrorObservable.dispatch, 0, { - error: error, subscriber: subscriber - }); - } - else { - subscriber.error(error); - } - }; - return ErrorObservable; -}(Observable_1.Observable)); -exports.ErrorObservable = ErrorObservable; -//# sourceMappingURL=ErrorObservable.js.map + this._input = text.replace(/(\r|\n){1,2}/g, "\n"); -/***/ }), -/* 250 */ -/***/ (function(module, exports, __webpack_require__) { -"use strict"; + /** + * The row for the character to be read next. + * @property _line + * @type int + * @private + */ + this._line = 1; + + + /** + * The column for the character to be read next. + * @property _col + * @type int + * @private + */ + this._col = 1; + + /** + * The index of the character in the input to be read next. + * @property _cursor + * @type int + * @private + */ + this._cursor = 0; +} + +StringReader.prototype = { + + //restore constructor + constructor: StringReader, + + //------------------------------------------------------------------------- + // Position info + //------------------------------------------------------------------------- + + /** + * Returns the column of the character to be read next. + * @return {int} The column of the character to be read next. + * @method getCol + */ + getCol: function(){ + return this._col; + }, + + /** + * Returns the row of the character to be read next. + * @return {int} The row of the character to be read next. + * @method getLine + */ + getLine: function(){ + return this._line ; + }, + + /** + * Determines if you're at the end of the input. + * @return {Boolean} True if there's no more input, false otherwise. + * @method eof + */ + eof: function(){ + return (this._cursor === this._input.length); + }, + + //------------------------------------------------------------------------- + // Basic reading + //------------------------------------------------------------------------- -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; -var Observable_1 = __webpack_require__(0); -var tryCatch_1 = __webpack_require__(7); -var isFunction_1 = __webpack_require__(81); -var errorObject_1 = __webpack_require__(5); -var Subscription_1 = __webpack_require__(9); -var toString = Object.prototype.toString; -function isNodeStyleEventEmitter(sourceObj) { - return !!sourceObj && typeof sourceObj.addListener === 'function' && typeof sourceObj.removeListener === 'function'; -} -function isJQueryStyleEventEmitter(sourceObj) { - return !!sourceObj && typeof sourceObj.on === 'function' && typeof sourceObj.off === 'function'; -} -function isNodeList(sourceObj) { - return !!sourceObj && toString.call(sourceObj) === '[object NodeList]'; -} -function isHTMLCollection(sourceObj) { - return !!sourceObj && toString.call(sourceObj) === '[object HTMLCollection]'; -} -function isEventTarget(sourceObj) { - return !!sourceObj && typeof sourceObj.addEventListener === 'function' && typeof sourceObj.removeEventListener === 'function'; -} -/** - * We need this JSDoc comment for affecting ESDoc. - * @extends {Ignored} - * @hide true - */ -var FromEventObservable = (function (_super) { - __extends(FromEventObservable, _super); - function FromEventObservable(sourceObj, eventName, selector, options) { - _super.call(this); - this.sourceObj = sourceObj; - this.eventName = eventName; - this.selector = selector; - this.options = options; - } - /* tslint:enable:max-line-length */ /** - * Creates an Observable that emits events of a specific type coming from the - * given event target. - * - * Creates an Observable from DOM events, or Node - * EventEmitter events or others. - * - * - * - * Creates an Observable by attaching an event listener to an "event target", - * which may be an object with `addEventListener` and `removeEventListener`, - * a Node.js EventEmitter, a jQuery style EventEmitter, a NodeList from the - * DOM, or an HTMLCollection from the DOM. The event handler is attached when - * the output Observable is subscribed, and removed when the Subscription is - * unsubscribed. - * - * @example Emits clicks happening on the DOM document - * var clicks = Rx.Observable.fromEvent(document, 'click'); - * clicks.subscribe(x => console.log(x)); - * - * // Results in: - * // MouseEvent object logged to console everytime a click - * // occurs on the document. - * - * @see {@link from} - * @see {@link fromEventPattern} - * - * @param {EventTargetLike} target The DOMElement, event target, Node.js - * EventEmitter, NodeList or HTMLCollection to attach the event handler to. - * @param {string} eventName The event name of interest, being emitted by the - * `target`. - * @param {EventListenerOptions} [options] Options to pass through to addEventListener - * @param {SelectorMethodSignature} [selector] An optional function to - * post-process results. It takes the arguments from the event handler and - * should return a single value. - * @return {Observable} - * @static true - * @name fromEvent - * @owner Observable + * Reads the next character without advancing the cursor. + * @param {int} count How many characters to look ahead (default is 1). + * @return {String} The next character or null if there is no next character. + * @method peek */ - FromEventObservable.create = function (target, eventName, options, selector) { - if (isFunction_1.isFunction(options)) { - selector = options; - options = undefined; + peek: function(count){ + var c = null; + count = (typeof count === "undefined" ? 1 : count); + + //if we're not at the end of the input... + if (this._cursor < this._input.length){ + + //get character and increment cursor and column + c = this._input.charAt(this._cursor + count - 1); } - return new FromEventObservable(target, eventName, selector, options); - }; - FromEventObservable.setupSubscription = function (sourceObj, eventName, handler, subscriber, options) { - var unsubscribe; - if (isNodeList(sourceObj) || isHTMLCollection(sourceObj)) { - for (var i = 0, len = sourceObj.length; i < len; i++) { - FromEventObservable.setupSubscription(sourceObj[i], eventName, handler, subscriber, options); + + return c; + }, + + /** + * Reads the next character from the input and adjusts the row and column + * accordingly. + * @return {String} The next character or null if there is no next character. + * @method read + */ + read: function(){ + var c = null; + + //if we're not at the end of the input... + if (this._cursor < this._input.length){ + + //if the last character was a newline, increment row count + //and reset column count + if (this._input.charAt(this._cursor) === "\n"){ + this._line++; + this._col=1; + } else { + this._col++; } + + //get character and increment cursor and column + c = this._input.charAt(this._cursor++); } - else if (isEventTarget(sourceObj)) { - var source_1 = sourceObj; - sourceObj.addEventListener(eventName, handler, options); - unsubscribe = function () { return source_1.removeEventListener(eventName, handler); }; + + return c; + }, + + //------------------------------------------------------------------------- + // Misc + //------------------------------------------------------------------------- + + /** + * Saves the current location so it can be returned to later. + * @method mark + * @return {void} + */ + mark: function(){ + this._bookmark = { + cursor: this._cursor, + line: this._line, + col: this._col + }; + }, + + reset: function(){ + if (this._bookmark){ + this._cursor = this._bookmark.cursor; + this._line = this._bookmark.line; + this._col = this._bookmark.col; + delete this._bookmark; } - else if (isJQueryStyleEventEmitter(sourceObj)) { - var source_2 = sourceObj; - sourceObj.on(eventName, handler); - unsubscribe = function () { return source_2.off(eventName, handler); }; + }, + + //------------------------------------------------------------------------- + // Advanced reading + //------------------------------------------------------------------------- + + /** + * Reads up to and including the given string. Throws an error if that + * string is not found. + * @param {String} pattern The string to read. + * @return {String} The string when it is found. + * @throws Error when the string pattern is not found. + * @method readTo + */ + readTo: function(pattern){ + + var buffer = "", + c; + + /* + * First, buffer must be the same length as the pattern. + * Then, buffer must end with the pattern or else reach the + * end of the input. + */ + while (buffer.length < pattern.length || buffer.lastIndexOf(pattern) !== buffer.length - pattern.length){ + c = this.read(); + if (c){ + buffer += c; + } else { + throw new Error("Expected \"" + pattern + "\" at line " + this._line + ", col " + this._col + "."); + } } - else if (isNodeStyleEventEmitter(sourceObj)) { - var source_3 = sourceObj; - sourceObj.addListener(eventName, handler); - unsubscribe = function () { return source_3.removeListener(eventName, handler); }; + + return buffer; + + }, + + /** + * Reads characters while each character causes the given + * filter function to return true. The function is passed + * in each character and either returns true to continue + * reading or false to stop. + * @param {Function} filter The function to read on each character. + * @return {String} The string made up of all characters that passed the + * filter check. + * @method readWhile + */ + readWhile: function(filter){ + + var buffer = "", + c = this.read(); + + while(c !== null && filter(c)){ + buffer += c; + c = this.read(); } - else { - throw new TypeError('Invalid event target'); - } - subscriber.add(new Subscription_1.Subscription(unsubscribe)); - }; - FromEventObservable.prototype._subscribe = function (subscriber) { - var sourceObj = this.sourceObj; - var eventName = this.eventName; - var options = this.options; - var selector = this.selector; - var handler = selector ? function () { - var args = []; - for (var _i = 0; _i < arguments.length; _i++) { - args[_i - 0] = arguments[_i]; - } - var result = tryCatch_1.tryCatch(selector).apply(void 0, args); - if (result === errorObject_1.errorObject) { - subscriber.error(errorObject_1.errorObject.e); + + return buffer; + + }, + + /** + * Reads characters that match either text or a regular expression and + * returns those characters. If a match is found, the row and column + * are adjusted; if no match is found, the reader's state is unchanged. + * reading or false to stop. + * @param {String|RegExp} matchter If a string, then the literal string + * value is searched for. If a regular expression, then any string + * matching the pattern is search for. + * @return {String} The string made up of all characters that matched or + * null if there was no match. + * @method readMatch + */ + readMatch: function(matcher){ + + var source = this._input.substring(this._cursor), + value = null; + + //if it's a string, just do a straight match + if (typeof matcher === "string"){ + if (source.indexOf(matcher) === 0){ + value = this.readCount(matcher.length); } - else { - subscriber.next(result); + } else if (matcher instanceof RegExp){ + if (matcher.test(source)){ + value = this.readCount(RegExp.lastMatch.length); } - } : function (e) { return subscriber.next(e); }; - FromEventObservable.setupSubscription(sourceObj, eventName, handler, subscriber, options); - }; - return FromEventObservable; -}(Observable_1.Observable)); -exports.FromEventObservable = FromEventObservable; -//# sourceMappingURL=FromEventObservable.js.map + } -/***/ }), -/* 251 */ -/***/ (function(module, exports, __webpack_require__) { + return value; + }, -"use strict"; -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + /** + * Reads a given number of characters. If the end of the input is reached, + * it reads only the remaining characters and does not throw an error. + * @param {int} count The number of characters to read. + * @return {String} The string made up the read characters. + * @method readCount + */ + readCount: function(count){ + var buffer = ""; + + while(count--){ + buffer += this.read(); + } + + return buffer; + } + }; -var isFunction_1 = __webpack_require__(81); -var Observable_1 = __webpack_require__(0); -var Subscription_1 = __webpack_require__(9); /** - * We need this JSDoc comment for affecting ESDoc. - * @extends {Ignored} - * @hide true + * Type to use when a syntax error occurs. + * @class SyntaxError + * @namespace parserlib.util + * @constructor + * @param {String} message The error message. + * @param {int} line The line at which the error occurred. + * @param {int} col The column at which the error occurred. */ -var FromEventPatternObservable = (function (_super) { - __extends(FromEventPatternObservable, _super); - function FromEventPatternObservable(addHandler, removeHandler, selector) { - _super.call(this); - this.addHandler = addHandler; - this.removeHandler = removeHandler; - this.selector = selector; - } +function SyntaxError(message, line, col){ + Error.call(this); + this.name = this.constructor.name; + /** - * Creates an Observable from an API based on addHandler/removeHandler - * functions. - * - * Converts any addHandler/removeHandler API to an - * Observable. - * - * - * - * Creates an Observable by using the `addHandler` and `removeHandler` - * functions to add and remove the handlers, with an optional selector - * function to project the event arguments to a result. The `addHandler` is - * called when the output Observable is subscribed, and `removeHandler` is - * called when the Subscription is unsubscribed. - * - * @example Emits clicks happening on the DOM document - * function addClickHandler(handler) { - * document.addEventListener('click', handler); - * } - * - * function removeClickHandler(handler) { - * document.removeEventListener('click', handler); - * } - * - * var clicks = Rx.Observable.fromEventPattern( - * addClickHandler, - * removeClickHandler - * ); - * clicks.subscribe(x => console.log(x)); - * - * @see {@link from} - * @see {@link fromEvent} - * - * @param {function(handler: Function): any} addHandler A function that takes - * a `handler` function as argument and attaches it somehow to the actual - * source of events. - * @param {function(handler: Function, signal?: any): void} [removeHandler] An optional function that - * takes a `handler` function as argument and removes it in case it was - * previously attached using `addHandler`. if addHandler returns signal to teardown when remove, - * removeHandler function will forward it. - * @param {function(...args: any): T} [selector] An optional function to - * post-process results. It takes the arguments from the event handler and - * should return a single value. - * @return {Observable} - * @static true - * @name fromEventPattern - * @owner Observable + * The column at which the error occurred. + * @type int + * @property col */ - FromEventPatternObservable.create = function (addHandler, removeHandler, selector) { - return new FromEventPatternObservable(addHandler, removeHandler, selector); - }; - FromEventPatternObservable.prototype._subscribe = function (subscriber) { - var _this = this; - var removeHandler = this.removeHandler; - var handler = !!this.selector ? function () { - var args = []; - for (var _i = 0; _i < arguments.length; _i++) { - args[_i - 0] = arguments[_i]; - } - _this._callSelector(subscriber, args); - } : function (e) { subscriber.next(e); }; - var retValue = this._callAddHandler(handler, subscriber); - if (!isFunction_1.isFunction(removeHandler)) { - return; - } - subscriber.add(new Subscription_1.Subscription(function () { - //TODO: determine whether or not to forward to error handler - removeHandler(handler, retValue); - })); - }; - FromEventPatternObservable.prototype._callSelector = function (subscriber, args) { - try { - var result = this.selector.apply(this, args); - subscriber.next(result); - } - catch (e) { - subscriber.error(e); - } - }; - FromEventPatternObservable.prototype._callAddHandler = function (handler, errorSubscriber) { - try { - return this.addHandler(handler) || null; - } - catch (e) { - errorSubscriber.error(e); - } - }; - return FromEventPatternObservable; -}(Observable_1.Observable)); -exports.FromEventPatternObservable = FromEventPatternObservable; -//# sourceMappingURL=FromEventPatternObservable.js.map + this.col = col; -/***/ }), -/* 252 */ -/***/ (function(module, exports, __webpack_require__) { + /** + * The line at which the error occurred. + * @type int + * @property line + */ + this.line = line; -"use strict"; + /** + * The text representation of the unit. + * @type String + * @property text + */ + this.message = message; -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; -var Observable_1 = __webpack_require__(0); -var isScheduler_1 = __webpack_require__(13); -var selfSelector = function (value) { return value; }; +} + +//inherit from Error +SyntaxError.prototype = Object.create(Error.prototype); // jshint ignore:line +SyntaxError.prototype.constructor = SyntaxError; // jshint ignore:line /** - * We need this JSDoc comment for affecting ESDoc. - * @extends {Ignored} - * @hide true + * Base type to represent a single syntactic unit. + * @class SyntaxUnit + * @namespace parserlib.util + * @constructor + * @param {String} text The text of the unit. + * @param {int} line The line of text on which the unit resides. + * @param {int} col The column of text on which the unit resides. */ -var GenerateObservable = (function (_super) { - __extends(GenerateObservable, _super); - function GenerateObservable(initialState, condition, iterate, resultSelector, scheduler) { - _super.call(this); - this.initialState = initialState; - this.condition = condition; - this.iterate = iterate; - this.resultSelector = resultSelector; - this.scheduler = scheduler; - } - GenerateObservable.create = function (initialStateOrOptions, condition, iterate, resultSelectorOrObservable, scheduler) { - if (arguments.length == 1) { - return new GenerateObservable(initialStateOrOptions.initialState, initialStateOrOptions.condition, initialStateOrOptions.iterate, initialStateOrOptions.resultSelector || selfSelector, initialStateOrOptions.scheduler); - } - if (resultSelectorOrObservable === undefined || isScheduler_1.isScheduler(resultSelectorOrObservable)) { - return new GenerateObservable(initialStateOrOptions, condition, iterate, selfSelector, resultSelectorOrObservable); - } - return new GenerateObservable(initialStateOrOptions, condition, iterate, resultSelectorOrObservable, scheduler); - }; - GenerateObservable.prototype._subscribe = function (subscriber) { - var state = this.initialState; - if (this.scheduler) { - return this.scheduler.schedule(GenerateObservable.dispatch, 0, { - subscriber: subscriber, - iterate: this.iterate, - condition: this.condition, - resultSelector: this.resultSelector, - state: state }); - } - var _a = this, condition = _a.condition, resultSelector = _a.resultSelector, iterate = _a.iterate; - do { - if (condition) { - var conditionResult = void 0; - try { - conditionResult = condition(state); - } - catch (err) { - subscriber.error(err); - return; - } - if (!conditionResult) { - subscriber.complete(); - break; - } - } - var value = void 0; - try { - value = resultSelector(state); - } - catch (err) { - subscriber.error(err); - return; - } - subscriber.next(value); - if (subscriber.closed) { - break; - } - try { - state = iterate(state); - } - catch (err) { - subscriber.error(err); - return; - } - } while (true); - }; - GenerateObservable.dispatch = function (state) { - var subscriber = state.subscriber, condition = state.condition; - if (subscriber.closed) { - return; - } - if (state.needIterate) { - try { - state.state = state.iterate(state.state); - } - catch (err) { - subscriber.error(err); - return; - } - } - else { - state.needIterate = true; - } - if (condition) { - var conditionResult = void 0; - try { - conditionResult = condition(state.state); - } - catch (err) { - subscriber.error(err); - return; - } - if (!conditionResult) { - subscriber.complete(); - return; - } - if (subscriber.closed) { - return; - } - } - var value; - try { - value = state.resultSelector(state.state); - } - catch (err) { - subscriber.error(err); - return; - } - if (subscriber.closed) { - return; - } - subscriber.next(value); - if (subscriber.closed) { - return; - } - return this.schedule(state); - }; - return GenerateObservable; -}(Observable_1.Observable)); -exports.GenerateObservable = GenerateObservable; -//# sourceMappingURL=GenerateObservable.js.map +function SyntaxUnit(text, line, col, type){ -/***/ }), -/* 253 */ -/***/ (function(module, exports, __webpack_require__) { -"use strict"; + /** + * The column of text on which the unit resides. + * @type int + * @property col + */ + this.col = col; + + /** + * The line of text on which the unit resides. + * @type int + * @property line + */ + this.line = line; + + /** + * The text representation of the unit. + * @type String + * @property text + */ + this.text = text; + + /** + * The type of syntax unit. + * @type int + * @property type + */ + this.type = type; +} + +/** + * Create a new syntax unit based solely on the given token. + * Convenience method for creating a new syntax unit when + * it represents a single token instead of multiple. + * @param {Object} token The token object to represent. + * @return {parserlib.util.SyntaxUnit} The object representing the token. + * @static + * @method fromToken + */ +SyntaxUnit.fromToken = function(token){ + return new SyntaxUnit(token.value, token.startLine, token.startCol); +}; + +SyntaxUnit.prototype = { + + //restore constructor + constructor: SyntaxUnit, + + /** + * Returns the text representation of the unit. + * @return {String} The text representation of the unit. + * @method valueOf + */ + valueOf: function(){ + return this.toString(); + }, + + /** + * Returns the text representation of the unit. + * @return {String} The text representation of the unit. + * @method toString + */ + toString: function(){ + return this.text; + } -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; -var Observable_1 = __webpack_require__(0); -var subscribeToResult_1 = __webpack_require__(3); -var OuterSubscriber_1 = __webpack_require__(4); + +/** + * Generic TokenStream providing base functionality. + * @class TokenStreamBase + * @namespace parserlib.util + * @constructor + * @param {String|StringReader} input The text to tokenize or a reader from + * which to read the input. + */ +function TokenStreamBase(input, tokenData){ + + /** + * The string reader for easy access to the text. + * @type StringReader + * @property _reader + * @private + */ + this._reader = input ? new StringReader(input.toString()) : null; + + /** + * Token object for the last consumed token. + * @type Token + * @property _token + * @private + */ + this._token = null; + + /** + * The array of token information. + * @type Array + * @property _tokenData + * @private + */ + this._tokenData = tokenData; + + /** + * Lookahead token buffer. + * @type Array + * @property _lt + * @private + */ + this._lt = []; + + /** + * Lookahead token buffer index. + * @type int + * @property _ltIndex + * @private + */ + this._ltIndex = 0; + + this._ltIndexCache = []; +} + /** - * We need this JSDoc comment for affecting ESDoc. - * @extends {Ignored} - * @hide true + * Accepts an array of token information and outputs + * an array of token data containing key-value mappings + * and matching functions that the TokenStream needs. + * @param {Array} tokens An array of token descriptors. + * @return {Array} An array of processed token data. + * @method createTokenData + * @static */ -var IfObservable = (function (_super) { - __extends(IfObservable, _super); - function IfObservable(condition, thenSource, elseSource) { - _super.call(this); - this.condition = condition; - this.thenSource = thenSource; - this.elseSource = elseSource; +TokenStreamBase.createTokenData = function(tokens){ + + var nameMap = [], + typeMap = Object.create(null), + tokenData = tokens.concat([]), + i = 0, + len = tokenData.length+1; + + tokenData.UNKNOWN = -1; + tokenData.unshift({name:"EOF"}); + + for (; i < len; i++){ + nameMap.push(tokenData[i].name); + tokenData[tokenData[i].name] = i; + if (tokenData[i].text){ + typeMap[tokenData[i].text] = i; + } } - IfObservable.create = function (condition, thenSource, elseSource) { - return new IfObservable(condition, thenSource, elseSource); - }; - IfObservable.prototype._subscribe = function (subscriber) { - var _a = this, condition = _a.condition, thenSource = _a.thenSource, elseSource = _a.elseSource; - return new IfSubscriber(subscriber, condition, thenSource, elseSource); + + tokenData.name = function(tt){ + return nameMap[tt]; }; - return IfObservable; -}(Observable_1.Observable)); -exports.IfObservable = IfObservable; -var IfSubscriber = (function (_super) { - __extends(IfSubscriber, _super); - function IfSubscriber(destination, condition, thenSource, elseSource) { - _super.call(this, destination); - this.condition = condition; - this.thenSource = thenSource; - this.elseSource = elseSource; - this.tryIf(); - } - IfSubscriber.prototype.tryIf = function () { - var _a = this, condition = _a.condition, thenSource = _a.thenSource, elseSource = _a.elseSource; - var result; - try { - result = condition(); - var source = result ? thenSource : elseSource; - if (source) { - this.add(subscribeToResult_1.subscribeToResult(this, source)); - } - else { - this._complete(); - } - } - catch (err) { - this._error(err); - } + + tokenData.type = function(c){ + return typeMap[c]; }; - return IfSubscriber; -}(OuterSubscriber_1.OuterSubscriber)); -//# sourceMappingURL=IfObservable.js.map -/***/ }), -/* 254 */ -/***/ (function(module, exports, __webpack_require__) { + return tokenData; +}; -"use strict"; +TokenStreamBase.prototype = { -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; -var isNumeric_1 = __webpack_require__(28); -var Observable_1 = __webpack_require__(0); -var async_1 = __webpack_require__(8); -/** - * We need this JSDoc comment for affecting ESDoc. - * @extends {Ignored} - * @hide true - */ -var IntervalObservable = (function (_super) { - __extends(IntervalObservable, _super); - function IntervalObservable(period, scheduler) { - if (period === void 0) { period = 0; } - if (scheduler === void 0) { scheduler = async_1.async; } - _super.call(this); - this.period = period; - this.scheduler = scheduler; - if (!isNumeric_1.isNumeric(period) || period < 0) { - this.period = 0; + //restore constructor + constructor: TokenStreamBase, + + //------------------------------------------------------------------------- + // Matching methods + //------------------------------------------------------------------------- + + /** + * Determines if the next token matches the given token type. + * If so, that token is consumed; if not, the token is placed + * back onto the token stream. You can pass in any number of + * token types and this will return true if any of the token + * types is found. + * @param {int|int[]} tokenTypes Either a single token type or an array of + * token types that the next token might be. If an array is passed, + * it's assumed that the token can be any of these. + * @param {variant} channel (Optional) The channel to read from. If not + * provided, reads from the default (unnamed) channel. + * @return {Boolean} True if the token type matches, false if not. + * @method match + */ + match: function(tokenTypes, channel){ + + //always convert to an array, makes things easier + if (!(tokenTypes instanceof Array)){ + tokenTypes = [tokenTypes]; } - if (!scheduler || typeof scheduler.schedule !== 'function') { - this.scheduler = async_1.async; + + var tt = this.get(channel), + i = 0, + len = tokenTypes.length; + + while(i < len){ + if (tt === tokenTypes[i++]){ + return true; + } } - } + + //no match found, put the token back + this.unget(); + return false; + }, + /** - * Creates an Observable that emits sequential numbers every specified - * interval of time, on a specified IScheduler. - * - * Emits incremental numbers periodically in time. - * - * - * - * - * `interval` returns an Observable that emits an infinite sequence of - * ascending integers, with a constant interval of time of your choosing - * between those emissions. The first emission is not sent immediately, but - * only after the first period has passed. By default, this operator uses the - * `async` IScheduler to provide a notion of time, but you may pass any - * IScheduler to it. - * - * @example Emits ascending numbers, one every second (1000ms) - * var numbers = Rx.Observable.interval(1000); - * numbers.subscribe(x => console.log(x)); - * - * @see {@link timer} - * @see {@link delay} - * - * @param {number} [period=0] The interval size in milliseconds (by default) - * or the time unit determined by the scheduler's clock. - * @param {Scheduler} [scheduler=async] The IScheduler to use for scheduling - * the emission of values, and providing a notion of "time". - * @return {Observable} An Observable that emits a sequential number each time - * interval. - * @static true - * @name interval - * @owner Observable + * Determines if the next token matches the given token type. + * If so, that token is consumed; if not, an error is thrown. + * @param {int|int[]} tokenTypes Either a single token type or an array of + * token types that the next token should be. If an array is passed, + * it's assumed that the token must be one of these. + * @param {variant} channel (Optional) The channel to read from. If not + * provided, reads from the default (unnamed) channel. + * @return {void} + * @method mustMatch */ - IntervalObservable.create = function (period, scheduler) { - if (period === void 0) { period = 0; } - if (scheduler === void 0) { scheduler = async_1.async; } - return new IntervalObservable(period, scheduler); - }; - IntervalObservable.dispatch = function (state) { - var index = state.index, subscriber = state.subscriber, period = state.period; - subscriber.next(index); - if (subscriber.closed) { - return; + mustMatch: function(tokenTypes, channel){ + + var token; + + //always convert to an array, makes things easier + if (!(tokenTypes instanceof Array)){ + tokenTypes = [tokenTypes]; } - state.index += 1; - this.schedule(state, period); - }; - IntervalObservable.prototype._subscribe = function (subscriber) { - var index = 0; - var period = this.period; - var scheduler = this.scheduler; - subscriber.add(scheduler.schedule(IntervalObservable.dispatch, period, { - index: index, subscriber: subscriber, period: period - })); - }; - return IntervalObservable; -}(Observable_1.Observable)); -exports.IntervalObservable = IntervalObservable; -//# sourceMappingURL=IntervalObservable.js.map -/***/ }), -/* 255 */ -/***/ (function(module, exports, __webpack_require__) { + if (!this.match.apply(this, arguments)){ + token = this.LT(1); + throw new SyntaxError("Expected " + this._tokenData[tokenTypes[0]].name + + " at line " + token.startLine + ", col " + token.startCol + ".", token.startLine, token.startCol); + } + }, -"use strict"; + //------------------------------------------------------------------------- + // Consuming methods + //------------------------------------------------------------------------- -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; -var Observable_1 = __webpack_require__(0); -var noop_1 = __webpack_require__(76); -/** - * We need this JSDoc comment for affecting ESDoc. - * @extends {Ignored} - * @hide true - */ -var NeverObservable = (function (_super) { - __extends(NeverObservable, _super); - function NeverObservable() { - _super.call(this); - } /** - * Creates an Observable that emits no items to the Observer. - * - * An Observable that never emits anything. - * - * - * - * This static operator is useful for creating a simple Observable that emits - * neither values nor errors nor the completion notification. It can be used - * for testing purposes or for composing with other Observables. Please note - * that by never emitting a complete notification, this Observable keeps the - * subscription from being disposed automatically. Subscriptions need to be - * manually disposed. - * - * @example Emit the number 7, then never emit anything else (not even complete). - * function info() { - * console.log('Will not be called'); - * } - * var result = Rx.Observable.never().startWith(7); - * result.subscribe(x => console.log(x), info, info); - * - * @see {@link create} - * @see {@link empty} - * @see {@link of} - * @see {@link throw} - * - * @return {Observable} A "never" Observable: never emits anything. - * @static true - * @name never - * @owner Observable + * Keeps reading from the token stream until either one of the specified + * token types is found or until the end of the input is reached. + * @param {int|int[]} tokenTypes Either a single token type or an array of + * token types that the next token should be. If an array is passed, + * it's assumed that the token must be one of these. + * @param {variant} channel (Optional) The channel to read from. If not + * provided, reads from the default (unnamed) channel. + * @return {void} + * @method advance */ - NeverObservable.create = function () { - return new NeverObservable(); - }; - NeverObservable.prototype._subscribe = function (subscriber) { - noop_1.noop(); - }; - return NeverObservable; -}(Observable_1.Observable)); -exports.NeverObservable = NeverObservable; -//# sourceMappingURL=NeverObservable.js.map + advance: function(tokenTypes, channel){ -/***/ }), -/* 256 */ -/***/ (function(module, exports, __webpack_require__) { + while(this.LA(0) !== 0 && !this.match(tokenTypes, channel)){ + this.get(); + } -"use strict"; + return this.LA(0); + }, -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; -var Observable_1 = __webpack_require__(0); -function dispatch(state) { - var obj = state.obj, keys = state.keys, length = state.length, index = state.index, subscriber = state.subscriber; - if (index === length) { - subscriber.complete(); - return; - } - var key = keys[index]; - subscriber.next([key, obj[key]]); - state.index = index + 1; - this.schedule(state); -} -/** - * We need this JSDoc comment for affecting ESDoc. - * @extends {Ignored} - * @hide true - */ -var PairsObservable = (function (_super) { - __extends(PairsObservable, _super); - function PairsObservable(obj, scheduler) { - _super.call(this); - this.obj = obj; - this.scheduler = scheduler; - this.keys = Object.keys(obj); - } /** - * Convert an object into an observable sequence of [key, value] pairs - * using an optional IScheduler to enumerate the object. - * - * @example Converts a javascript object to an Observable - * var obj = { - * foo: 42, - * bar: 56, - * baz: 78 - * }; - * - * var source = Rx.Observable.pairs(obj); - * - * var subscription = source.subscribe( - * function (x) { - * console.log('Next: %s', x); - * }, - * function (err) { - * console.log('Error: %s', err); - * }, - * function () { - * console.log('Completed'); - * }); - * - * @param {Object} obj The object to inspect and turn into an - * Observable sequence. - * @param {Scheduler} [scheduler] An optional IScheduler to run the - * enumeration of the input sequence on. - * @returns {(Observable>)} An observable sequence of - * [key, value] pairs from the object. - */ - PairsObservable.create = function (obj, scheduler) { - return new PairsObservable(obj, scheduler); - }; - PairsObservable.prototype._subscribe = function (subscriber) { - var _a = this, keys = _a.keys, scheduler = _a.scheduler; - var length = keys.length; - if (scheduler) { - return scheduler.schedule(dispatch, 0, { - obj: this.obj, keys: keys, length: length, index: 0, subscriber: subscriber - }); + * Consumes the next token from the token stream. + * @return {int} The token type of the token that was just consumed. + * @method get + */ + get: function(channel){ + + var tokenInfo = this._tokenData, + i =0, + token, + info; + + //check the lookahead buffer first + if (this._lt.length && this._ltIndex >= 0 && this._ltIndex < this._lt.length){ + + i++; + this._token = this._lt[this._ltIndex++]; + info = tokenInfo[this._token.type]; + + //obey channels logic + while((info.channel !== undefined && channel !== info.channel) && + this._ltIndex < this._lt.length){ + this._token = this._lt[this._ltIndex++]; + info = tokenInfo[this._token.type]; + i++; + } + + //here be dragons + if ((info.channel === undefined || channel === info.channel) && + this._ltIndex <= this._lt.length){ + this._ltIndexCache.push(i); + return this._token.type; + } } - else { - for (var idx = 0; idx < length; idx++) { - var key = keys[idx]; - subscriber.next([key, this.obj[key]]); + + //call token retriever method + token = this._getToken(); + + //if it should be hidden, don't save a token + if (token.type > -1 && !tokenInfo[token.type].hide){ + + //apply token channel + token.channel = tokenInfo[token.type].channel; + + //save for later + this._token = token; + this._lt.push(token); + + //save space that will be moved (must be done before array is truncated) + this._ltIndexCache.push(this._lt.length - this._ltIndex + i); + + //keep the buffer under 5 items + if (this._lt.length > 5){ + this._lt.shift(); } - subscriber.complete(); + + //also keep the shift buffer under 5 items + if (this._ltIndexCache.length > 5){ + this._ltIndexCache.shift(); + } + + //update lookahead index + this._ltIndex = this._lt.length; } - }; - return PairsObservable; -}(Observable_1.Observable)); -exports.PairsObservable = PairsObservable; -//# sourceMappingURL=PairsObservable.js.map -/***/ }), -/* 257 */ -/***/ (function(module, exports, __webpack_require__) { + /* + * Skip to the next token if: + * 1. The token type is marked as hidden. + * 2. The token type has a channel specified and it isn't the current channel. + */ + info = tokenInfo[token.type]; + if (info && + (info.hide || + (info.channel !== undefined && channel !== info.channel))){ + return this.get(channel); + } else { + //return just the type + return token.type; + } + }, -"use strict"; + /** + * Looks ahead a certain number of tokens and returns the token type at + * that position. This will throw an error if you lookahead past the + * end of input, past the size of the lookahead buffer, or back past + * the first token in the lookahead buffer. + * @param {int} The index of the token type to retrieve. 0 for the + * current token, 1 for the next, -1 for the previous, etc. + * @return {int} The token type of the token in the given position. + * @method LA + */ + LA: function(index){ + var total = index, + tt; + if (index > 0){ + //TODO: Store 5 somewhere + if (index > 5){ + throw new Error("Too much lookahead."); + } + + //get all those tokens + while(total){ + tt = this.get(); + total--; + } + + //unget all those tokens + while(total < index){ + this.unget(); + total++; + } + } else if (index < 0){ + + if(this._lt[this._ltIndex+index]){ + tt = this._lt[this._ltIndex+index].type; + } else { + throw new Error("Too much lookbehind."); + } + + } else { + tt = this._token.type; + } + + return tt; + + }, -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; -var Observable_1 = __webpack_require__(0); -/** - * We need this JSDoc comment for affecting ESDoc. - * @extends {Ignored} - * @hide true - */ -var RangeObservable = (function (_super) { - __extends(RangeObservable, _super); - function RangeObservable(start, count, scheduler) { - _super.call(this); - this.start = start; - this._count = count; - this.scheduler = scheduler; - } /** - * Creates an Observable that emits a sequence of numbers within a specified - * range. - * - * Emits a sequence of numbers in a range. - * - * - * - * `range` operator emits a range of sequential integers, in order, where you - * select the `start` of the range and its `length`. By default, uses no - * IScheduler and just delivers the notifications synchronously, but may use - * an optional IScheduler to regulate those deliveries. - * - * @example Emits the numbers 1 to 10 - * var numbers = Rx.Observable.range(1, 10); - * numbers.subscribe(x => console.log(x)); - * - * @see {@link timer} - * @see {@link interval} - * - * @param {number} [start=0] The value of the first integer in the sequence. - * @param {number} [count=0] The number of sequential integers to generate. - * @param {Scheduler} [scheduler] A {@link IScheduler} to use for scheduling - * the emissions of the notifications. - * @return {Observable} An Observable of numbers that emits a finite range of - * sequential integers. - * @static true - * @name range - * @owner Observable + * Looks ahead a certain number of tokens and returns the token at + * that position. This will throw an error if you lookahead past the + * end of input, past the size of the lookahead buffer, or back past + * the first token in the lookahead buffer. + * @param {int} The index of the token type to retrieve. 0 for the + * current token, 1 for the next, -1 for the previous, etc. + * @return {Object} The token of the token in the given position. + * @method LA + */ + LT: function(index){ + + //lookahead first to prime the token buffer + this.LA(index); + + //now find the token, subtract one because _ltIndex is already at the next index + return this._lt[this._ltIndex+index-1]; + }, + + /** + * Returns the token type for the next token in the stream without + * consuming it. + * @return {int} The token type of the next token in the stream. + * @method peek + */ + peek: function(){ + return this.LA(1); + }, + + /** + * Returns the actual token object for the last consumed token. + * @return {Token} The token object for the last consumed token. + * @method token */ - RangeObservable.create = function (start, count, scheduler) { - if (start === void 0) { start = 0; } - if (count === void 0) { count = 0; } - return new RangeObservable(start, count, scheduler); - }; - RangeObservable.dispatch = function (state) { - var start = state.start, index = state.index, count = state.count, subscriber = state.subscriber; - if (index >= count) { - subscriber.complete(); - return; - } - subscriber.next(start); - if (subscriber.closed) { - return; - } - state.index = index + 1; - state.start = start + 1; - this.schedule(state); - }; - RangeObservable.prototype._subscribe = function (subscriber) { - var index = 0; - var start = this.start; - var count = this._count; - var scheduler = this.scheduler; - if (scheduler) { - return scheduler.schedule(RangeObservable.dispatch, 0, { - index: index, count: count, start: start, subscriber: subscriber - }); + token: function(){ + return this._token; + }, + + /** + * Returns the name of the token for the given token type. + * @param {int} tokenType The type of token to get the name of. + * @return {String} The name of the token or "UNKNOWN_TOKEN" for any + * invalid token type. + * @method tokenName + */ + tokenName: function(tokenType){ + if (tokenType < 0 || tokenType > this._tokenData.length){ + return "UNKNOWN_TOKEN"; + } else { + return this._tokenData[tokenType].name; } - else { - do { - if (index++ >= count) { - subscriber.complete(); - break; - } - subscriber.next(start++); - if (subscriber.closed) { - break; - } - } while (true); + }, + + /** + * Returns the token type value for the given token name. + * @param {String} tokenName The name of the token whose value should be returned. + * @return {int} The token type value for the given token name or -1 + * for an unknown token. + * @method tokenName + */ + tokenType: function(tokenName){ + return this._tokenData[tokenName] || -1; + }, + + /** + * Returns the last consumed token to the token stream. + * @method unget + */ + unget: function(){ + //if (this._ltIndex > -1){ + if (this._ltIndexCache.length){ + this._ltIndex -= this._ltIndexCache.pop();//--; + this._token = this._lt[this._ltIndex - 1]; + } else { + throw new Error("Too much lookahead."); } - }; - return RangeObservable; -}(Observable_1.Observable)); -exports.RangeObservable = RangeObservable; -//# sourceMappingURL=RangeObservable.js.map + } -/***/ }), -/* 258 */ -/***/ (function(module, exports, __webpack_require__) { +}; -"use strict"; -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); +parserlib.util = { +__proto__ : null, +StringReader: StringReader, +SyntaxError : SyntaxError, +SyntaxUnit : SyntaxUnit, +EventTarget : EventTarget, +TokenStreamBase : TokenStreamBase }; -var Observable_1 = __webpack_require__(0); -var asap_1 = __webpack_require__(70); -var isNumeric_1 = __webpack_require__(28); +})(); +/* +Parser-Lib +Copyright (c) 2009-2011 Nicholas C. Zakas. All rights reserved. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. + +*/ +/* Version v0.2.5+domino1, Build time: 30-January-2016 05:13:03 */ +(function(){ +var EventTarget = parserlib.util.EventTarget, +TokenStreamBase = parserlib.util.TokenStreamBase, +StringReader = parserlib.util.StringReader, // jshint ignore:line +SyntaxError = parserlib.util.SyntaxError, +SyntaxUnit = parserlib.util.SyntaxUnit; + +var Colors = { + __proto__ :null, + aliceblue :"#f0f8ff", + antiquewhite :"#faebd7", + aqua :"#00ffff", + aquamarine :"#7fffd4", + azure :"#f0ffff", + beige :"#f5f5dc", + bisque :"#ffe4c4", + black :"#000000", + blanchedalmond :"#ffebcd", + blue :"#0000ff", + blueviolet :"#8a2be2", + brown :"#a52a2a", + burlywood :"#deb887", + cadetblue :"#5f9ea0", + chartreuse :"#7fff00", + chocolate :"#d2691e", + coral :"#ff7f50", + cornflowerblue :"#6495ed", + cornsilk :"#fff8dc", + crimson :"#dc143c", + cyan :"#00ffff", + darkblue :"#00008b", + darkcyan :"#008b8b", + darkgoldenrod :"#b8860b", + darkgray :"#a9a9a9", + darkgrey :"#a9a9a9", + darkgreen :"#006400", + darkkhaki :"#bdb76b", + darkmagenta :"#8b008b", + darkolivegreen :"#556b2f", + darkorange :"#ff8c00", + darkorchid :"#9932cc", + darkred :"#8b0000", + darksalmon :"#e9967a", + darkseagreen :"#8fbc8f", + darkslateblue :"#483d8b", + darkslategray :"#2f4f4f", + darkslategrey :"#2f4f4f", + darkturquoise :"#00ced1", + darkviolet :"#9400d3", + deeppink :"#ff1493", + deepskyblue :"#00bfff", + dimgray :"#696969", + dimgrey :"#696969", + dodgerblue :"#1e90ff", + firebrick :"#b22222", + floralwhite :"#fffaf0", + forestgreen :"#228b22", + fuchsia :"#ff00ff", + gainsboro :"#dcdcdc", + ghostwhite :"#f8f8ff", + gold :"#ffd700", + goldenrod :"#daa520", + gray :"#808080", + grey :"#808080", + green :"#008000", + greenyellow :"#adff2f", + honeydew :"#f0fff0", + hotpink :"#ff69b4", + indianred :"#cd5c5c", + indigo :"#4b0082", + ivory :"#fffff0", + khaki :"#f0e68c", + lavender :"#e6e6fa", + lavenderblush :"#fff0f5", + lawngreen :"#7cfc00", + lemonchiffon :"#fffacd", + lightblue :"#add8e6", + lightcoral :"#f08080", + lightcyan :"#e0ffff", + lightgoldenrodyellow :"#fafad2", + lightgray :"#d3d3d3", + lightgrey :"#d3d3d3", + lightgreen :"#90ee90", + lightpink :"#ffb6c1", + lightsalmon :"#ffa07a", + lightseagreen :"#20b2aa", + lightskyblue :"#87cefa", + lightslategray :"#778899", + lightslategrey :"#778899", + lightsteelblue :"#b0c4de", + lightyellow :"#ffffe0", + lime :"#00ff00", + limegreen :"#32cd32", + linen :"#faf0e6", + magenta :"#ff00ff", + maroon :"#800000", + mediumaquamarine:"#66cdaa", + mediumblue :"#0000cd", + mediumorchid :"#ba55d3", + mediumpurple :"#9370d8", + mediumseagreen :"#3cb371", + mediumslateblue :"#7b68ee", + mediumspringgreen :"#00fa9a", + mediumturquoise :"#48d1cc", + mediumvioletred :"#c71585", + midnightblue :"#191970", + mintcream :"#f5fffa", + mistyrose :"#ffe4e1", + moccasin :"#ffe4b5", + navajowhite :"#ffdead", + navy :"#000080", + oldlace :"#fdf5e6", + olive :"#808000", + olivedrab :"#6b8e23", + orange :"#ffa500", + orangered :"#ff4500", + orchid :"#da70d6", + palegoldenrod :"#eee8aa", + palegreen :"#98fb98", + paleturquoise :"#afeeee", + palevioletred :"#d87093", + papayawhip :"#ffefd5", + peachpuff :"#ffdab9", + peru :"#cd853f", + pink :"#ffc0cb", + plum :"#dda0dd", + powderblue :"#b0e0e6", + purple :"#800080", + red :"#ff0000", + rosybrown :"#bc8f8f", + royalblue :"#4169e1", + saddlebrown :"#8b4513", + salmon :"#fa8072", + sandybrown :"#f4a460", + seagreen :"#2e8b57", + seashell :"#fff5ee", + sienna :"#a0522d", + silver :"#c0c0c0", + skyblue :"#87ceeb", + slateblue :"#6a5acd", + slategray :"#708090", + slategrey :"#708090", + snow :"#fffafa", + springgreen :"#00ff7f", + steelblue :"#4682b4", + tan :"#d2b48c", + teal :"#008080", + thistle :"#d8bfd8", + tomato :"#ff6347", + turquoise :"#40e0d0", + violet :"#ee82ee", + wheat :"#f5deb3", + white :"#ffffff", + whitesmoke :"#f5f5f5", + yellow :"#ffff00", + yellowgreen :"#9acd32", + //'currentColor' color keyword http://www.w3.org/TR/css3-color/#currentcolor + currentColor :"The value of the 'color' property.", + //CSS2 system colors http://www.w3.org/TR/css3-color/#css2-system + activeBorder :"Active window border.", + activecaption :"Active window caption.", + appworkspace :"Background color of multiple document interface.", + background :"Desktop background.", + buttonface :"The face background color for 3-D elements that appear 3-D due to one layer of surrounding border.", + buttonhighlight :"The color of the border facing the light source for 3-D elements that appear 3-D due to one layer of surrounding border.", + buttonshadow :"The color of the border away from the light source for 3-D elements that appear 3-D due to one layer of surrounding border.", + buttontext :"Text on push buttons.", + captiontext :"Text in caption, size box, and scrollbar arrow box.", + graytext :"Grayed (disabled) text. This color is set to #000 if the current display driver does not support a solid gray color.", + greytext :"Greyed (disabled) text. This color is set to #000 if the current display driver does not support a solid grey color.", + highlight :"Item(s) selected in a control.", + highlighttext :"Text of item(s) selected in a control.", + inactiveborder :"Inactive window border.", + inactivecaption :"Inactive window caption.", + inactivecaptiontext :"Color of text in an inactive caption.", + infobackground :"Background color for tooltip controls.", + infotext :"Text color for tooltip controls.", + menu :"Menu background.", + menutext :"Text in menus.", + scrollbar :"Scroll bar gray area.", + threeddarkshadow :"The color of the darker (generally outer) of the two borders away from the light source for 3-D elements that appear 3-D due to two concentric layers of surrounding border.", + threedface :"The face background color for 3-D elements that appear 3-D due to two concentric layers of surrounding border.", + threedhighlight :"The color of the lighter (generally outer) of the two borders facing the light source for 3-D elements that appear 3-D due to two concentric layers of surrounding border.", + threedlightshadow :"The color of the darker (generally inner) of the two borders facing the light source for 3-D elements that appear 3-D due to two concentric layers of surrounding border.", + threedshadow :"The color of the lighter (generally inner) of the two borders away from the light source for 3-D elements that appear 3-D due to two concentric layers of surrounding border.", + window :"Window background.", + windowframe :"Window frame.", + windowtext :"Text in windows." +}; +/** + * Represents a selector combinator (whitespace, +, >). + * @namespace parserlib.css + * @class Combinator + * @extends parserlib.util.SyntaxUnit + * @constructor + * @param {String} text The text representation of the unit. + * @param {int} line The line of text on which the unit resides. + * @param {int} col The column of text on which the unit resides. + */ +function Combinator(text, line, col){ + + SyntaxUnit.call(this, text, line, col, Parser.COMBINATOR_TYPE); + + /** + * The type of modifier. + * @type String + * @property type + */ + this.type = "unknown"; + + //pretty simple + if (/^\s+$/.test(text)){ + this.type = "descendant"; + } else if (text === ">"){ + this.type = "child"; + } else if (text === "+"){ + this.type = "adjacent-sibling"; + } else if (text === "~"){ + this.type = "sibling"; + } + +} + +Combinator.prototype = new SyntaxUnit(); +Combinator.prototype.constructor = Combinator; + /** - * We need this JSDoc comment for affecting ESDoc. - * @extends {Ignored} - * @hide true + * Represents a media feature, such as max-width:500. + * @namespace parserlib.css + * @class MediaFeature + * @extends parserlib.util.SyntaxUnit + * @constructor + * @param {SyntaxUnit} name The name of the feature. + * @param {SyntaxUnit} value The value of the feature or null if none. */ -var SubscribeOnObservable = (function (_super) { - __extends(SubscribeOnObservable, _super); - function SubscribeOnObservable(source, delayTime, scheduler) { - if (delayTime === void 0) { delayTime = 0; } - if (scheduler === void 0) { scheduler = asap_1.asap; } - _super.call(this); - this.source = source; - this.delayTime = delayTime; - this.scheduler = scheduler; - if (!isNumeric_1.isNumeric(delayTime) || delayTime < 0) { - this.delayTime = 0; - } - if (!scheduler || typeof scheduler.schedule !== 'function') { - this.scheduler = asap_1.asap; - } - } - SubscribeOnObservable.create = function (source, delay, scheduler) { - if (delay === void 0) { delay = 0; } - if (scheduler === void 0) { scheduler = asap_1.asap; } - return new SubscribeOnObservable(source, delay, scheduler); - }; - SubscribeOnObservable.dispatch = function (arg) { - var source = arg.source, subscriber = arg.subscriber; - return this.add(source.subscribe(subscriber)); - }; - SubscribeOnObservable.prototype._subscribe = function (subscriber) { - var delay = this.delayTime; - var source = this.source; - var scheduler = this.scheduler; - return scheduler.schedule(SubscribeOnObservable.dispatch, delay, { - source: source, subscriber: subscriber - }); - }; - return SubscribeOnObservable; -}(Observable_1.Observable)); -exports.SubscribeOnObservable = SubscribeOnObservable; -//# sourceMappingURL=SubscribeOnObservable.js.map +function MediaFeature(name, value){ -/***/ }), -/* 259 */ -/***/ (function(module, exports, __webpack_require__) { + SyntaxUnit.call(this, "(" + name + (value !== null ? ":" + value : "") + ")", name.startLine, name.startCol, Parser.MEDIA_FEATURE_TYPE); -"use strict"; + /** + * The name of the media feature + * @type String + * @property name + */ + this.name = name; + + /** + * The value for the feature or null if there is none. + * @type SyntaxUnit + * @property value + */ + this.value = value; +} + +MediaFeature.prototype = new SyntaxUnit(); +MediaFeature.prototype.constructor = MediaFeature; -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; -var isNumeric_1 = __webpack_require__(28); -var Observable_1 = __webpack_require__(0); -var async_1 = __webpack_require__(8); -var isScheduler_1 = __webpack_require__(13); -var isDate_1 = __webpack_require__(27); /** - * We need this JSDoc comment for affecting ESDoc. - * @extends {Ignored} - * @hide true + * Represents an individual media query. + * @namespace parserlib.css + * @class MediaQuery + * @extends parserlib.util.SyntaxUnit + * @constructor + * @param {String} modifier The modifier "not" or "only" (or null). + * @param {String} mediaType The type of media (i.e., "print"). + * @param {Array} parts Array of selectors parts making up this selector. + * @param {int} line The line of text on which the unit resides. + * @param {int} col The column of text on which the unit resides. */ -var TimerObservable = (function (_super) { - __extends(TimerObservable, _super); - function TimerObservable(dueTime, period, scheduler) { - if (dueTime === void 0) { dueTime = 0; } - _super.call(this); - this.period = -1; - this.dueTime = 0; - if (isNumeric_1.isNumeric(period)) { - this.period = Number(period) < 1 && 1 || Number(period); - } - else if (isScheduler_1.isScheduler(period)) { - scheduler = period; - } - if (!isScheduler_1.isScheduler(scheduler)) { - scheduler = async_1.async; - } - this.scheduler = scheduler; - this.dueTime = isDate_1.isDate(dueTime) ? - (+dueTime - this.scheduler.now()) : - dueTime; - } +function MediaQuery(modifier, mediaType, features, line, col){ + + SyntaxUnit.call(this, (modifier ? modifier + " ": "") + (mediaType ? mediaType : "") + (mediaType && features.length > 0 ? " and " : "") + features.join(" and "), line, col, Parser.MEDIA_QUERY_TYPE); + /** - * Creates an Observable that starts emitting after an `initialDelay` and - * emits ever increasing numbers after each `period` of time thereafter. - * - * Its like {@link interval}, but you can specify when - * should the emissions start. - * - * - * - * `timer` returns an Observable that emits an infinite sequence of ascending - * integers, with a constant interval of time, `period` of your choosing - * between those emissions. The first emission happens after the specified - * `initialDelay`. The initial delay may be a {@link Date}. By default, this - * operator uses the `async` IScheduler to provide a notion of time, but you - * may pass any IScheduler to it. If `period` is not specified, the output - * Observable emits only one value, `0`. Otherwise, it emits an infinite - * sequence. - * - * @example Emits ascending numbers, one every second (1000ms), starting after 3 seconds - * var numbers = Rx.Observable.timer(3000, 1000); - * numbers.subscribe(x => console.log(x)); - * - * @example Emits one number after five seconds - * var numbers = Rx.Observable.timer(5000); - * numbers.subscribe(x => console.log(x)); - * - * @see {@link interval} - * @see {@link delay} - * - * @param {number|Date} initialDelay The initial delay time to wait before - * emitting the first value of `0`. - * @param {number} [period] The period of time between emissions of the - * subsequent numbers. - * @param {Scheduler} [scheduler=async] The IScheduler to use for scheduling - * the emission of values, and providing a notion of "time". - * @return {Observable} An Observable that emits a `0` after the - * `initialDelay` and ever increasing numbers after each `period` of time - * thereafter. - * @static true - * @name timer - * @owner Observable + * The media modifier ("not" or "only") + * @type String + * @property modifier */ - TimerObservable.create = function (initialDelay, period, scheduler) { - if (initialDelay === void 0) { initialDelay = 0; } - return new TimerObservable(initialDelay, period, scheduler); - }; - TimerObservable.dispatch = function (state) { - var index = state.index, period = state.period, subscriber = state.subscriber; - var action = this; - subscriber.next(index); - if (subscriber.closed) { - return; - } - else if (period === -1) { - return subscriber.complete(); - } - state.index = index + 1; - action.schedule(state, period); - }; - TimerObservable.prototype._subscribe = function (subscriber) { - var index = 0; - var _a = this, period = _a.period, dueTime = _a.dueTime, scheduler = _a.scheduler; - return scheduler.schedule(TimerObservable.dispatch, dueTime, { - index: index, period: period, subscriber: subscriber - }); - }; - return TimerObservable; -}(Observable_1.Observable)); -exports.TimerObservable = TimerObservable; -//# sourceMappingURL=TimerObservable.js.map + this.modifier = modifier; + + /** + * The mediaType (i.e., "print") + * @type String + * @property mediaType + */ + this.mediaType = mediaType; + + /** + * The parts that make up the selector. + * @type Array + * @property features + */ + this.features = features; + +} + +MediaQuery.prototype = new SyntaxUnit(); +MediaQuery.prototype.constructor = MediaQuery; + + +/** + * A CSS3 parser. + * @namespace parserlib.css + * @class Parser + * @constructor + * @param {Object} options (Optional) Various options for the parser: + * starHack (true|false) to allow IE6 star hack as valid, + * underscoreHack (true|false) to interpret leading underscores + * as IE6-7 targeting for known properties, ieFilters (true|false) + * to indicate that IE < 8 filters should be accepted and not throw + * syntax errors. + */ +function Parser(options){ + + //inherit event functionality + EventTarget.call(this); + + + this.options = options || {}; + + this._tokenStream = null; +} + +//Static constants +Parser.DEFAULT_TYPE = 0; +Parser.COMBINATOR_TYPE = 1; +Parser.MEDIA_FEATURE_TYPE = 2; +Parser.MEDIA_QUERY_TYPE = 3; +Parser.PROPERTY_NAME_TYPE = 4; +Parser.PROPERTY_VALUE_TYPE = 5; +Parser.PROPERTY_VALUE_PART_TYPE = 6; +Parser.SELECTOR_TYPE = 7; +Parser.SELECTOR_PART_TYPE = 8; +Parser.SELECTOR_SUB_PART_TYPE = 9; + +Parser.prototype = function(){ + + var proto = new EventTarget(), //new prototype + prop, + additions = { + __proto__: null, + + //restore constructor + constructor: Parser, + + //instance constants - yuck + DEFAULT_TYPE : 0, + COMBINATOR_TYPE : 1, + MEDIA_FEATURE_TYPE : 2, + MEDIA_QUERY_TYPE : 3, + PROPERTY_NAME_TYPE : 4, + PROPERTY_VALUE_TYPE : 5, + PROPERTY_VALUE_PART_TYPE : 6, + SELECTOR_TYPE : 7, + SELECTOR_PART_TYPE : 8, + SELECTOR_SUB_PART_TYPE : 9, + + //----------------------------------------------------------------- + // Grammar + //----------------------------------------------------------------- + + _stylesheet: function(){ + + /* + * stylesheet + * : [ CHARSET_SYM S* STRING S* ';' ]? + * [S|CDO|CDC]* [ import [S|CDO|CDC]* ]* + * [ namespace [S|CDO|CDC]* ]* + * [ [ ruleset | media | page | font_face | keyframes ] [S|CDO|CDC]* ]* + * ; + */ + + var tokenStream = this._tokenStream, + count, + token, + tt; + + this.fire("startstylesheet"); + + //try to read character set + this._charset(); + + this._skipCruft(); + + //try to read imports - may be more than one + while (tokenStream.peek() === Tokens.IMPORT_SYM){ + this._import(); + this._skipCruft(); + } + + //try to read namespaces - may be more than one + while (tokenStream.peek() === Tokens.NAMESPACE_SYM){ + this._namespace(); + this._skipCruft(); + } + + //get the next token + tt = tokenStream.peek(); + + //try to read the rest + while(tt > Tokens.EOF){ + + try { + + switch(tt){ + case Tokens.MEDIA_SYM: + this._media(); + this._skipCruft(); + break; + case Tokens.PAGE_SYM: + this._page(); + this._skipCruft(); + break; + case Tokens.FONT_FACE_SYM: + this._font_face(); + this._skipCruft(); + break; + case Tokens.KEYFRAMES_SYM: + this._keyframes(); + this._skipCruft(); + break; + case Tokens.VIEWPORT_SYM: + this._viewport(); + this._skipCruft(); + break; + case Tokens.DOCUMENT_SYM: + this._document(); + this._skipCruft(); + break; + case Tokens.UNKNOWN_SYM: //unknown @ rule + tokenStream.get(); + if (!this.options.strict){ + + //fire error event + this.fire({ + type: "error", + error: null, + message: "Unknown @ rule: " + tokenStream.LT(0).value + ".", + line: tokenStream.LT(0).startLine, + col: tokenStream.LT(0).startCol + }); + + //skip braces + count=0; + while (tokenStream.advance([Tokens.LBRACE, Tokens.RBRACE]) === Tokens.LBRACE){ + count++; //keep track of nesting depth + } + + while(count){ + tokenStream.advance([Tokens.RBRACE]); + count--; + } + + } else { + //not a syntax error, rethrow it + throw new SyntaxError("Unknown @ rule.", tokenStream.LT(0).startLine, tokenStream.LT(0).startCol); + } + break; + case Tokens.S: + this._readWhitespace(); + break; + default: + if(!this._ruleset()){ + + //error handling for known issues + switch(tt){ + case Tokens.CHARSET_SYM: + token = tokenStream.LT(1); + this._charset(false); + throw new SyntaxError("@charset not allowed here.", token.startLine, token.startCol); + case Tokens.IMPORT_SYM: + token = tokenStream.LT(1); + this._import(false); + throw new SyntaxError("@import not allowed here.", token.startLine, token.startCol); + case Tokens.NAMESPACE_SYM: + token = tokenStream.LT(1); + this._namespace(false); + throw new SyntaxError("@namespace not allowed here.", token.startLine, token.startCol); + default: + tokenStream.get(); //get the last token + this._unexpectedToken(tokenStream.token()); + } + + } + } + } catch(ex) { + if (ex instanceof SyntaxError && !this.options.strict){ + this.fire({ + type: "error", + error: ex, + message: ex.message, + line: ex.line, + col: ex.col + }); + } else { + throw ex; + } + } + + tt = tokenStream.peek(); + } + + if (tt !== Tokens.EOF){ + this._unexpectedToken(tokenStream.token()); + } + + this.fire("endstylesheet"); + }, + + _charset: function(emit){ + var tokenStream = this._tokenStream, + charset, + token, + line, + col; + + if (tokenStream.match(Tokens.CHARSET_SYM)){ + line = tokenStream.token().startLine; + col = tokenStream.token().startCol; + + this._readWhitespace(); + tokenStream.mustMatch(Tokens.STRING); + + token = tokenStream.token(); + charset = token.value; + + this._readWhitespace(); + tokenStream.mustMatch(Tokens.SEMICOLON); + + if (emit !== false){ + this.fire({ + type: "charset", + charset:charset, + line: line, + col: col + }); + } + } + }, + + _import: function(emit){ + /* + * import + * : IMPORT_SYM S* + * [STRING|URI] S* media_query_list? ';' S* + */ + + var tokenStream = this._tokenStream, + uri, + importToken, + mediaList = []; + + //read import symbol + tokenStream.mustMatch(Tokens.IMPORT_SYM); + importToken = tokenStream.token(); + this._readWhitespace(); + + tokenStream.mustMatch([Tokens.STRING, Tokens.URI]); + + //grab the URI value + uri = tokenStream.token().value.replace(/^(?:url\()?["']?([^"']+?)["']?\)?$/, "$1"); + + this._readWhitespace(); + + mediaList = this._media_query_list(); + + //must end with a semicolon + tokenStream.mustMatch(Tokens.SEMICOLON); + this._readWhitespace(); + + if (emit !== false){ + this.fire({ + type: "import", + uri: uri, + media: mediaList, + line: importToken.startLine, + col: importToken.startCol + }); + } + + }, + + _namespace: function(emit){ + /* + * namespace + * : NAMESPACE_SYM S* [namespace_prefix S*]? [STRING|URI] S* ';' S* + */ + + var tokenStream = this._tokenStream, + line, + col, + prefix, + uri; + + //read import symbol + tokenStream.mustMatch(Tokens.NAMESPACE_SYM); + line = tokenStream.token().startLine; + col = tokenStream.token().startCol; + this._readWhitespace(); + + //it's a namespace prefix - no _namespace_prefix() method because it's just an IDENT + if (tokenStream.match(Tokens.IDENT)){ + prefix = tokenStream.token().value; + this._readWhitespace(); + } + + tokenStream.mustMatch([Tokens.STRING, Tokens.URI]); + /*if (!tokenStream.match(Tokens.STRING)){ + tokenStream.mustMatch(Tokens.URI); + }*/ + + //grab the URI value + uri = tokenStream.token().value.replace(/(?:url\()?["']([^"']+)["']\)?/, "$1"); + + this._readWhitespace(); + + //must end with a semicolon + tokenStream.mustMatch(Tokens.SEMICOLON); + this._readWhitespace(); + + if (emit !== false){ + this.fire({ + type: "namespace", + prefix: prefix, + uri: uri, + line: line, + col: col + }); + } + + }, + + _media: function(){ + /* + * media + * : MEDIA_SYM S* media_query_list S* '{' S* ruleset* '}' S* + * ; + */ + var tokenStream = this._tokenStream, + line, + col, + mediaList;// = []; + + //look for @media + tokenStream.mustMatch(Tokens.MEDIA_SYM); + line = tokenStream.token().startLine; + col = tokenStream.token().startCol; + + this._readWhitespace(); + + mediaList = this._media_query_list(); + + tokenStream.mustMatch(Tokens.LBRACE); + this._readWhitespace(); + + this.fire({ + type: "startmedia", + media: mediaList, + line: line, + col: col + }); + + while(true) { + if (tokenStream.peek() === Tokens.PAGE_SYM){ + this._page(); + } else if (tokenStream.peek() === Tokens.FONT_FACE_SYM){ + this._font_face(); + } else if (tokenStream.peek() === Tokens.VIEWPORT_SYM){ + this._viewport(); + } else if (tokenStream.peek() === Tokens.DOCUMENT_SYM){ + this._document(); + } else if (!this._ruleset()){ + break; + } + } + + tokenStream.mustMatch(Tokens.RBRACE); + this._readWhitespace(); + + this.fire({ + type: "endmedia", + media: mediaList, + line: line, + col: col + }); + }, -/***/ }), -/* 260 */ -/***/ (function(module, exports, __webpack_require__) { -"use strict"; + //CSS3 Media Queries + _media_query_list: function(){ + /* + * media_query_list + * : S* [media_query [ ',' S* media_query ]* ]? + * ; + */ + var tokenStream = this._tokenStream, + mediaList = []; -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; -var Observable_1 = __webpack_require__(0); -var subscribeToResult_1 = __webpack_require__(3); -var OuterSubscriber_1 = __webpack_require__(4); -/** - * We need this JSDoc comment for affecting ESDoc. - * @extends {Ignored} - * @hide true - */ -var UsingObservable = (function (_super) { - __extends(UsingObservable, _super); - function UsingObservable(resourceFactory, observableFactory) { - _super.call(this); - this.resourceFactory = resourceFactory; - this.observableFactory = observableFactory; - } - UsingObservable.create = function (resourceFactory, observableFactory) { - return new UsingObservable(resourceFactory, observableFactory); - }; - UsingObservable.prototype._subscribe = function (subscriber) { - var _a = this, resourceFactory = _a.resourceFactory, observableFactory = _a.observableFactory; - var resource; - try { - resource = resourceFactory(); - return new UsingSubscriber(subscriber, resource, observableFactory); - } - catch (err) { - subscriber.error(err); - } - }; - return UsingObservable; -}(Observable_1.Observable)); -exports.UsingObservable = UsingObservable; -var UsingSubscriber = (function (_super) { - __extends(UsingSubscriber, _super); - function UsingSubscriber(destination, resource, observableFactory) { - _super.call(this, destination); - this.resource = resource; - this.observableFactory = observableFactory; - destination.add(resource); - this.tryUse(); - } - UsingSubscriber.prototype.tryUse = function () { - try { - var source = this.observableFactory.call(this, this.resource); - if (source) { - this.add(subscribeToResult_1.subscribeToResult(this, source)); - } - } - catch (err) { - this._error(err); - } - }; - return UsingSubscriber; -}(OuterSubscriber_1.OuterSubscriber)); -//# sourceMappingURL=UsingObservable.js.map -/***/ }), -/* 261 */ -/***/ (function(module, exports, __webpack_require__) { + this._readWhitespace(); -"use strict"; + if (tokenStream.peek() === Tokens.IDENT || tokenStream.peek() === Tokens.LPAREN){ + mediaList.push(this._media_query()); + } -var BoundCallbackObservable_1 = __webpack_require__(246); -exports.bindCallback = BoundCallbackObservable_1.BoundCallbackObservable.create; -//# sourceMappingURL=bindCallback.js.map + while(tokenStream.match(Tokens.COMMA)){ + this._readWhitespace(); + mediaList.push(this._media_query()); + } -/***/ }), -/* 262 */ -/***/ (function(module, exports, __webpack_require__) { + return mediaList; + }, -"use strict"; + /* + * Note: "expression" in the grammar maps to the _media_expression + * method. -var BoundNodeCallbackObservable_1 = __webpack_require__(247); -exports.bindNodeCallback = BoundNodeCallbackObservable_1.BoundNodeCallbackObservable.create; -//# sourceMappingURL=bindNodeCallback.js.map + */ + _media_query: function(){ + /* + * media_query + * : [ONLY | NOT]? S* media_type S* [ AND S* expression ]* + * | expression [ AND S* expression ]* + * ; + */ + var tokenStream = this._tokenStream, + type = null, + ident = null, + token = null, + expressions = []; + + if (tokenStream.match(Tokens.IDENT)){ + ident = tokenStream.token().value.toLowerCase(); + + //since there's no custom tokens for these, need to manually check + if (ident !== "only" && ident !== "not"){ + tokenStream.unget(); + ident = null; + } else { + token = tokenStream.token(); + } + } -/***/ }), -/* 263 */ -/***/ (function(module, exports, __webpack_require__) { + this._readWhitespace(); -"use strict"; + if (tokenStream.peek() === Tokens.IDENT){ + type = this._media_type(); + if (token === null){ + token = tokenStream.token(); + } + } else if (tokenStream.peek() === Tokens.LPAREN){ + if (token === null){ + token = tokenStream.LT(1); + } + expressions.push(this._media_expression()); + } -var isScheduler_1 = __webpack_require__(13); -var isArray_1 = __webpack_require__(15); -var ArrayObservable_1 = __webpack_require__(14); -var combineLatest_1 = __webpack_require__(37); -/* tslint:enable:max-line-length */ -/** - * Combines multiple Observables to create an Observable whose values are - * calculated from the latest values of each of its input Observables. - * - * Whenever any input Observable emits a value, it - * computes a formula using the latest values from all the inputs, then emits - * the output of that formula. - * - * - * - * `combineLatest` combines the values from all the Observables passed as - * arguments. This is done by subscribing to each Observable in order and, - * whenever any Observable emits, collecting an array of the most recent - * values from each Observable. So if you pass `n` Observables to operator, - * returned Observable will always emit an array of `n` values, in order - * corresponding to order of passed Observables (value from the first Observable - * on the first place and so on). - * - * Static version of `combineLatest` accepts either an array of Observables - * or each Observable can be put directly as an argument. Note that array of - * Observables is good choice, if you don't know beforehand how many Observables - * you will combine. Passing empty array will result in Observable that - * completes immediately. - * - * To ensure output array has always the same length, `combineLatest` will - * actually wait for all input Observables to emit at least once, - * before it starts emitting results. This means if some Observable emits - * values before other Observables started emitting, all that values but last - * will be lost. On the other hand, is some Observable does not emit value but - * completes, resulting Observable will complete at the same moment without - * emitting anything, since it will be now impossible to include value from - * completed Observable in resulting array. Also, if some input Observable does - * not emit any value and never completes, `combineLatest` will also never emit - * and never complete, since, again, it will wait for all streams to emit some - * value. - * - * If at least one Observable was passed to `combineLatest` and all passed Observables - * emitted something, resulting Observable will complete when all combined - * streams complete. So even if some Observable completes, result of - * `combineLatest` will still emit values when other Observables do. In case - * of completed Observable, its value from now on will always be the last - * emitted value. On the other hand, if any Observable errors, `combineLatest` - * will error immediately as well, and all other Observables will be unsubscribed. - * - * `combineLatest` accepts as optional parameter `project` function, which takes - * as arguments all values that would normally be emitted by resulting Observable. - * `project` can return any kind of value, which will be then emitted by Observable - * instead of default array. Note that `project` does not take as argument that array - * of values, but values themselves. That means default `project` can be imagined - * as function that takes all its arguments and puts them into an array. - * - * - * @example Combine two timer Observables - * const firstTimer = Rx.Observable.timer(0, 1000); // emit 0, 1, 2... after every second, starting from now - * const secondTimer = Rx.Observable.timer(500, 1000); // emit 0, 1, 2... after every second, starting 0,5s from now - * const combinedTimers = Rx.Observable.combineLatest(firstTimer, secondTimer); - * combinedTimers.subscribe(value => console.log(value)); - * // Logs - * // [0, 0] after 0.5s - * // [1, 0] after 1s - * // [1, 1] after 1.5s - * // [2, 1] after 2s - * - * - * @example Combine an array of Observables - * const observables = [1, 5, 10].map( - * n => Rx.Observable.of(n).delay(n * 1000).startWith(0) // emit 0 and then emit n after n seconds - * ); - * const combined = Rx.Observable.combineLatest(observables); - * combined.subscribe(value => console.log(value)); - * // Logs - * // [0, 0, 0] immediately - * // [1, 0, 0] after 1s - * // [1, 5, 0] after 5s - * // [1, 5, 10] after 10s - * - * - * @example Use project function to dynamically calculate the Body-Mass Index - * var weight = Rx.Observable.of(70, 72, 76, 79, 75); - * var height = Rx.Observable.of(1.76, 1.77, 1.78); - * var bmi = Rx.Observable.combineLatest(weight, height, (w, h) => w / (h * h)); - * bmi.subscribe(x => console.log('BMI is ' + x)); - * - * // With output to console: - * // BMI is 24.212293388429753 - * // BMI is 23.93948099205209 - * // BMI is 23.671253629592222 - * - * - * @see {@link combineAll} - * @see {@link merge} - * @see {@link withLatestFrom} - * - * @param {ObservableInput} observable1 An input Observable to combine with other Observables. - * @param {ObservableInput} observable2 An input Observable to combine with other Observables. - * More than one input Observables may be given as arguments - * or an array of Observables may be given as the first argument. - * @param {function} [project] An optional function to project the values from - * the combined latest values into a new value on the output Observable. - * @param {Scheduler} [scheduler=null] The IScheduler to use for subscribing to - * each input Observable. - * @return {Observable} An Observable of projected values from the most recent - * values from each input Observable, or an array of the most recent values from - * each input Observable. - * @static true - * @name combineLatest - * @owner Observable - */ -function combineLatest() { - var observables = []; - for (var _i = 0; _i < arguments.length; _i++) { - observables[_i - 0] = arguments[_i]; - } - var project = null; - var scheduler = null; - if (isScheduler_1.isScheduler(observables[observables.length - 1])) { - scheduler = observables.pop(); - } - if (typeof observables[observables.length - 1] === 'function') { - project = observables.pop(); - } - // if the first and only other argument besides the resultSelector is an array - // assume it's been called with `combineLatest([obs1, obs2, obs3], project)` - if (observables.length === 1 && isArray_1.isArray(observables[0])) { - observables = observables[0]; - } - return new ArrayObservable_1.ArrayObservable(observables, scheduler).lift(new combineLatest_1.CombineLatestOperator(project)); -} -exports.combineLatest = combineLatest; -//# sourceMappingURL=combineLatest.js.map + if (type === null && expressions.length === 0){ + return null; + } else { + this._readWhitespace(); + while (tokenStream.match(Tokens.IDENT)){ + if (tokenStream.token().value.toLowerCase() !== "and"){ + this._unexpectedToken(tokenStream.token()); + } -/***/ }), -/* 264 */ -/***/ (function(module, exports, __webpack_require__) { + this._readWhitespace(); + expressions.push(this._media_expression()); + } + } -"use strict"; + return new MediaQuery(ident, type, expressions, token.startLine, token.startCol); + }, -var concat_1 = __webpack_require__(38); -exports.concat = concat_1.concatStatic; -//# sourceMappingURL=concat.js.map + //CSS3 Media Queries + _media_type: function(){ + /* + * media_type + * : IDENT + * ; + */ + return this._media_feature(); + }, -/***/ }), -/* 265 */ -/***/ (function(module, exports, __webpack_require__) { + /** + * Note: in CSS3 Media Queries, this is called "expression". + * Renamed here to avoid conflict with CSS3 Selectors + * definition of "expression". Also note that "expr" in the + * grammar now maps to "expression" from CSS3 selectors. + * @method _media_expression + * @private + */ + _media_expression: function(){ + /* + * expression + * : '(' S* media_feature S* [ ':' S* expr ]? ')' S* + * ; + */ + var tokenStream = this._tokenStream, + feature = null, + token, + expression = null; + + tokenStream.mustMatch(Tokens.LPAREN); + + feature = this._media_feature(); + this._readWhitespace(); + + if (tokenStream.match(Tokens.COLON)){ + this._readWhitespace(); + token = tokenStream.LT(1); + expression = this._expression(); + } -"use strict"; + tokenStream.mustMatch(Tokens.RPAREN); + this._readWhitespace(); -var DeferObservable_1 = __webpack_require__(248); -exports.defer = DeferObservable_1.DeferObservable.create; -//# sourceMappingURL=defer.js.map + return new MediaFeature(feature, (expression ? new SyntaxUnit(expression, token.startLine, token.startCol) : null)); + }, -/***/ }), -/* 266 */ -/***/ (function(module, exports, __webpack_require__) { + //CSS3 Media Queries + _media_feature: function(){ + /* + * media_feature + * : IDENT + * ; + */ + var tokenStream = this._tokenStream; -"use strict"; + this._readWhitespace(); -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; -var Subject_1 = __webpack_require__(6); -var Subscriber_1 = __webpack_require__(2); -var Observable_1 = __webpack_require__(0); -var Subscription_1 = __webpack_require__(9); -var root_1 = __webpack_require__(12); -var ReplaySubject_1 = __webpack_require__(26); -var tryCatch_1 = __webpack_require__(7); -var errorObject_1 = __webpack_require__(5); -var assign_1 = __webpack_require__(373); -/** - * We need this JSDoc comment for affecting ESDoc. - * @extends {Ignored} - * @hide true - */ -var WebSocketSubject = (function (_super) { - __extends(WebSocketSubject, _super); - function WebSocketSubject(urlConfigOrSource, destination) { - if (urlConfigOrSource instanceof Observable_1.Observable) { - _super.call(this, destination, urlConfigOrSource); - } - else { - _super.call(this); - this.WebSocketCtor = root_1.root.WebSocket; - this._output = new Subject_1.Subject(); - if (typeof urlConfigOrSource === 'string') { - this.url = urlConfigOrSource; - } - else { - // WARNING: config object could override important members here. - assign_1.assign(this, urlConfigOrSource); - } - if (!this.WebSocketCtor) { - throw new Error('no WebSocket constructor can be found'); - } - this.destination = new ReplaySubject_1.ReplaySubject(); - } - } - WebSocketSubject.prototype.resultSelector = function (e) { - return JSON.parse(e.data); - }; - /** - * Wrapper around the w3c-compatible WebSocket object provided by the browser. - * - * @example Wraps browser WebSocket - * - * let socket$ = Observable.webSocket('ws://localhost:8081'); - * - * socket$.subscribe( - * (msg) => console.log('message received: ' + msg), - * (err) => console.log(err), - * () => console.log('complete') - * ); - * - * socket$.next(JSON.stringify({ op: 'hello' })); - * - * @example Wraps WebSocket from nodejs-websocket (using node.js) - * - * import { w3cwebsocket } from 'websocket'; - * - * let socket$ = Observable.webSocket({ - * url: 'ws://localhost:8081', - * WebSocketCtor: w3cwebsocket - * }); - * - * socket$.subscribe( - * (msg) => console.log('message received: ' + msg), - * (err) => console.log(err), - * () => console.log('complete') - * ); - * - * socket$.next(JSON.stringify({ op: 'hello' })); - * - * @param {string | WebSocketSubjectConfig} urlConfigOrSource the source of the websocket as an url or a structure defining the websocket object - * @return {WebSocketSubject} - * @static true - * @name webSocket - * @owner Observable - */ - WebSocketSubject.create = function (urlConfigOrSource) { - return new WebSocketSubject(urlConfigOrSource); - }; - WebSocketSubject.prototype.lift = function (operator) { - var sock = new WebSocketSubject(this, this.destination); - sock.operator = operator; - return sock; - }; - WebSocketSubject.prototype._resetState = function () { - this.socket = null; - if (!this.source) { - this.destination = new ReplaySubject_1.ReplaySubject(); - } - this._output = new Subject_1.Subject(); - }; - // TODO: factor this out to be a proper Operator/Subscriber implementation and eliminate closures - WebSocketSubject.prototype.multiplex = function (subMsg, unsubMsg, messageFilter) { - var self = this; - return new Observable_1.Observable(function (observer) { - var result = tryCatch_1.tryCatch(subMsg)(); - if (result === errorObject_1.errorObject) { - observer.error(errorObject_1.errorObject.e); - } - else { - self.next(result); - } - var subscription = self.subscribe(function (x) { - var result = tryCatch_1.tryCatch(messageFilter)(x); - if (result === errorObject_1.errorObject) { - observer.error(errorObject_1.errorObject.e); + tokenStream.mustMatch(Tokens.IDENT); + + return SyntaxUnit.fromToken(tokenStream.token()); + }, + + //CSS3 Paged Media + _page: function(){ + /* + * page: + * PAGE_SYM S* IDENT? pseudo_page? S* + * '{' S* [ declaration | margin ]? [ ';' S* [ declaration | margin ]? ]* '}' S* + * ; + */ + var tokenStream = this._tokenStream, + line, + col, + identifier = null, + pseudoPage = null; + + //look for @page + tokenStream.mustMatch(Tokens.PAGE_SYM); + line = tokenStream.token().startLine; + col = tokenStream.token().startCol; + + this._readWhitespace(); + + if (tokenStream.match(Tokens.IDENT)){ + identifier = tokenStream.token().value; + + //The value 'auto' may not be used as a page name and MUST be treated as a syntax error. + if (identifier.toLowerCase() === "auto"){ + this._unexpectedToken(tokenStream.token()); + } } - else if (result) { - observer.next(x); + + //see if there's a colon upcoming + if (tokenStream.peek() === Tokens.COLON){ + pseudoPage = this._pseudo_page(); } - }, function (err) { return observer.error(err); }, function () { return observer.complete(); }); - return function () { - var result = tryCatch_1.tryCatch(unsubMsg)(); - if (result === errorObject_1.errorObject) { - observer.error(errorObject_1.errorObject.e); + + this._readWhitespace(); + + this.fire({ + type: "startpage", + id: identifier, + pseudo: pseudoPage, + line: line, + col: col + }); + + this._readDeclarations(true, true); + + this.fire({ + type: "endpage", + id: identifier, + pseudo: pseudoPage, + line: line, + col: col + }); + + }, + + //CSS3 Paged Media + _margin: function(){ + /* + * margin : + * margin_sym S* '{' declaration [ ';' S* declaration? ]* '}' S* + * ; + */ + var tokenStream = this._tokenStream, + line, + col, + marginSym = this._margin_sym(); + + if (marginSym){ + line = tokenStream.token().startLine; + col = tokenStream.token().startCol; + + this.fire({ + type: "startpagemargin", + margin: marginSym, + line: line, + col: col + }); + + this._readDeclarations(true); + + this.fire({ + type: "endpagemargin", + margin: marginSym, + line: line, + col: col + }); + return true; + } else { + return false; } - else { - self.next(result); + }, + + //CSS3 Paged Media + _margin_sym: function(){ + + /* + * margin_sym : + * TOPLEFTCORNER_SYM | + * TOPLEFT_SYM | + * TOPCENTER_SYM | + * TOPRIGHT_SYM | + * TOPRIGHTCORNER_SYM | + * BOTTOMLEFTCORNER_SYM | + * BOTTOMLEFT_SYM | + * BOTTOMCENTER_SYM | + * BOTTOMRIGHT_SYM | + * BOTTOMRIGHTCORNER_SYM | + * LEFTTOP_SYM | + * LEFTMIDDLE_SYM | + * LEFTBOTTOM_SYM | + * RIGHTTOP_SYM | + * RIGHTMIDDLE_SYM | + * RIGHTBOTTOM_SYM + * ; + */ + + var tokenStream = this._tokenStream; + + if(tokenStream.match([Tokens.TOPLEFTCORNER_SYM, Tokens.TOPLEFT_SYM, + Tokens.TOPCENTER_SYM, Tokens.TOPRIGHT_SYM, Tokens.TOPRIGHTCORNER_SYM, + Tokens.BOTTOMLEFTCORNER_SYM, Tokens.BOTTOMLEFT_SYM, + Tokens.BOTTOMCENTER_SYM, Tokens.BOTTOMRIGHT_SYM, + Tokens.BOTTOMRIGHTCORNER_SYM, Tokens.LEFTTOP_SYM, + Tokens.LEFTMIDDLE_SYM, Tokens.LEFTBOTTOM_SYM, Tokens.RIGHTTOP_SYM, + Tokens.RIGHTMIDDLE_SYM, Tokens.RIGHTBOTTOM_SYM])) + { + return SyntaxUnit.fromToken(tokenStream.token()); + } else { + return null; } - subscription.unsubscribe(); - }; - }); - }; - WebSocketSubject.prototype._connectSocket = function () { - var _this = this; - var WebSocketCtor = this.WebSocketCtor; - var observer = this._output; - var socket = null; - try { - socket = this.protocol ? - new WebSocketCtor(this.url, this.protocol) : - new WebSocketCtor(this.url); - this.socket = socket; - if (this.binaryType) { - this.socket.binaryType = this.binaryType; - } - } - catch (e) { - observer.error(e); - return; - } - var subscription = new Subscription_1.Subscription(function () { - _this.socket = null; - if (socket && socket.readyState === 1) { - socket.close(); - } - }); - socket.onopen = function (e) { - var openObserver = _this.openObserver; - if (openObserver) { - openObserver.next(e); - } - var queue = _this.destination; - _this.destination = Subscriber_1.Subscriber.create(function (x) { return socket.readyState === 1 && socket.send(x); }, function (e) { - var closingObserver = _this.closingObserver; - if (closingObserver) { - closingObserver.next(undefined); + + }, + + _pseudo_page: function(){ + /* + * pseudo_page + * : ':' IDENT + * ; + */ + + var tokenStream = this._tokenStream; + + tokenStream.mustMatch(Tokens.COLON); + tokenStream.mustMatch(Tokens.IDENT); + + //TODO: CSS3 Paged Media says only "left", "center", and "right" are allowed + + return tokenStream.token().value; + }, + + _font_face: function(){ + /* + * font_face + * : FONT_FACE_SYM S* + * '{' S* declaration [ ';' S* declaration ]* '}' S* + * ; + */ + var tokenStream = this._tokenStream, + line, + col; + + //look for @page + tokenStream.mustMatch(Tokens.FONT_FACE_SYM); + line = tokenStream.token().startLine; + col = tokenStream.token().startCol; + + this._readWhitespace(); + + this.fire({ + type: "startfontface", + line: line, + col: col + }); + + this._readDeclarations(true); + + this.fire({ + type: "endfontface", + line: line, + col: col + }); + }, + + _viewport: function(){ + /* + * viewport + * : VIEWPORT_SYM S* + * '{' S* declaration? [ ';' S* declaration? ]* '}' S* + * ; + */ + var tokenStream = this._tokenStream, + line, + col; + + tokenStream.mustMatch(Tokens.VIEWPORT_SYM); + line = tokenStream.token().startLine; + col = tokenStream.token().startCol; + + this._readWhitespace(); + + this.fire({ + type: "startviewport", + line: line, + col: col + }); + + this._readDeclarations(true); + + this.fire({ + type: "endviewport", + line: line, + col: col + }); + + }, + + _document: function(){ + /* + * document + * : DOCUMENT_SYM S* + * _document_function [ ',' S* _document_function ]* S* + * '{' S* ruleset* '}' + * ; + */ + + var tokenStream = this._tokenStream, + token, + functions = [], + prefix = ""; + + tokenStream.mustMatch(Tokens.DOCUMENT_SYM); + token = tokenStream.token(); + if (/^@\-([^\-]+)\-/.test(token.value)) { + prefix = RegExp.$1; } - if (e && e.code) { - socket.close(e.code, e.reason); + + this._readWhitespace(); + functions.push(this._document_function()); + + while(tokenStream.match(Tokens.COMMA)) { + this._readWhitespace(); + functions.push(this._document_function()); } - else { - observer.error(new TypeError('WebSocketSubject.error must be called with an object with an error code, ' + - 'and an optional reason: { code: number, reason: string }')); + + tokenStream.mustMatch(Tokens.LBRACE); + this._readWhitespace(); + + this.fire({ + type: "startdocument", + functions: functions, + prefix: prefix, + line: token.startLine, + col: token.startCol + }); + + while(true) { + if (tokenStream.peek() === Tokens.PAGE_SYM){ + this._page(); + } else if (tokenStream.peek() === Tokens.FONT_FACE_SYM){ + this._font_face(); + } else if (tokenStream.peek() === Tokens.VIEWPORT_SYM){ + this._viewport(); + } else if (tokenStream.peek() === Tokens.MEDIA_SYM){ + this._media(); + } else if (!this._ruleset()){ + break; + } } - _this._resetState(); - }, function () { - var closingObserver = _this.closingObserver; - if (closingObserver) { - closingObserver.next(undefined); + + tokenStream.mustMatch(Tokens.RBRACE); + this._readWhitespace(); + + this.fire({ + type: "enddocument", + functions: functions, + prefix: prefix, + line: token.startLine, + col: token.startCol + }); + }, + + _document_function: function(){ + /* + * document_function + * : function | URI S* + * ; + */ + + var tokenStream = this._tokenStream, + value; + + if (tokenStream.match(Tokens.URI)) { + value = tokenStream.token().value; + this._readWhitespace(); + } else { + value = this._function(); } - socket.close(); - _this._resetState(); - }); - if (queue && queue instanceof ReplaySubject_1.ReplaySubject) { - subscription.add(queue.subscribe(_this.destination)); - } - }; - socket.onerror = function (e) { - _this._resetState(); - observer.error(e); - }; - socket.onclose = function (e) { - _this._resetState(); - var closeObserver = _this.closeObserver; - if (closeObserver) { - closeObserver.next(e); - } - if (e.wasClean) { - observer.complete(); - } - else { - observer.error(e); - } - }; - socket.onmessage = function (e) { - var result = tryCatch_1.tryCatch(_this.resultSelector)(e); - if (result === errorObject_1.errorObject) { - observer.error(errorObject_1.errorObject.e); - } - else { - observer.next(result); - } - }; - }; - WebSocketSubject.prototype._subscribe = function (subscriber) { - var _this = this; - var source = this.source; - if (source) { - return source.subscribe(subscriber); - } - if (!this.socket) { - this._connectSocket(); - } - var subscription = new Subscription_1.Subscription(); - subscription.add(this._output.subscribe(subscriber)); - subscription.add(function () { - var socket = _this.socket; - if (_this._output.observers.length === 0) { - if (socket && socket.readyState === 1) { - socket.close(); + + return value; + }, + + _operator: function(inFunction){ + + /* + * operator (outside function) + * : '/' S* | ',' S* | /( empty )/ + * operator (inside function) + * : '/' S* | '+' S* | '*' S* | '-' S* /( empty )/ + * ; + */ + + var tokenStream = this._tokenStream, + token = null; + + if (tokenStream.match([Tokens.SLASH, Tokens.COMMA]) || + (inFunction && tokenStream.match([Tokens.PLUS, Tokens.STAR, Tokens.MINUS]))){ + token = tokenStream.token(); + this._readWhitespace(); } - _this._resetState(); - } - }); - return subscription; - }; - WebSocketSubject.prototype.unsubscribe = function () { - var _a = this, source = _a.source, socket = _a.socket; - if (socket && socket.readyState === 1) { - socket.close(); - this._resetState(); - } - _super.prototype.unsubscribe.call(this); - if (!source) { - this.destination = new ReplaySubject_1.ReplaySubject(); - } - }; - return WebSocketSubject; -}(Subject_1.AnonymousSubject)); -exports.WebSocketSubject = WebSocketSubject; -//# sourceMappingURL=WebSocketSubject.js.map + return token ? PropertyValuePart.fromToken(token) : null; -/***/ }), -/* 267 */ -/***/ (function(module, exports, __webpack_require__) { + }, -"use strict"; + _combinator: function(){ -var AjaxObservable_1 = __webpack_require__(59); -exports.ajax = AjaxObservable_1.AjaxObservable.create; -//# sourceMappingURL=ajax.js.map + /* + * combinator + * : PLUS S* | GREATER S* | TILDE S* | S+ + * ; + */ -/***/ }), -/* 268 */ -/***/ (function(module, exports, __webpack_require__) { + var tokenStream = this._tokenStream, + value = null, + token; -"use strict"; + if(tokenStream.match([Tokens.PLUS, Tokens.GREATER, Tokens.TILDE])){ + token = tokenStream.token(); + value = new Combinator(token.value, token.startLine, token.startCol); + this._readWhitespace(); + } -var WebSocketSubject_1 = __webpack_require__(266); -exports.webSocket = WebSocketSubject_1.WebSocketSubject.create; -//# sourceMappingURL=webSocket.js.map + return value; + }, -/***/ }), -/* 269 */ -/***/ (function(module, exports, __webpack_require__) { + _unary_operator: function(){ -"use strict"; + /* + * unary_operator + * : '-' | '+' + * ; + */ -var EmptyObservable_1 = __webpack_require__(23); -exports.empty = EmptyObservable_1.EmptyObservable.create; -//# sourceMappingURL=empty.js.map + var tokenStream = this._tokenStream; + + if (tokenStream.match([Tokens.MINUS, Tokens.PLUS])){ + return tokenStream.token().value; + } else { + return null; + } + }, + + _property: function(){ + + /* + * property + * : IDENT S* + * ; + */ + + var tokenStream = this._tokenStream, + value = null, + hack = null, + tokenValue, + token, + line, + col; + + //check for star hack - throws error if not allowed + if (tokenStream.peek() === Tokens.STAR && this.options.starHack){ + tokenStream.get(); + token = tokenStream.token(); + hack = token.value; + line = token.startLine; + col = token.startCol; + } + + if(tokenStream.match(Tokens.IDENT)){ + token = tokenStream.token(); + tokenValue = token.value; + + //check for underscore hack - no error if not allowed because it's valid CSS syntax + if (tokenValue.charAt(0) === "_" && this.options.underscoreHack){ + hack = "_"; + tokenValue = tokenValue.substring(1); + } -/***/ }), -/* 270 */ -/***/ (function(module, exports, __webpack_require__) { + value = new PropertyName(tokenValue, hack, (line||token.startLine), (col||token.startCol)); + this._readWhitespace(); + } -"use strict"; + return value; + }, -var FromEventObservable_1 = __webpack_require__(250); -exports.fromEvent = FromEventObservable_1.FromEventObservable.create; -//# sourceMappingURL=fromEvent.js.map + //Augmented with CSS3 Selectors + _ruleset: function(){ + /* + * ruleset + * : selectors_group + * '{' S* declaration? [ ';' S* declaration? ]* '}' S* + * ; + */ -/***/ }), -/* 271 */ -/***/ (function(module, exports, __webpack_require__) { + var tokenStream = this._tokenStream, + tt, + selectors; -"use strict"; -var FromEventPatternObservable_1 = __webpack_require__(251); -exports.fromEventPattern = FromEventPatternObservable_1.FromEventPatternObservable.create; -//# sourceMappingURL=fromEventPattern.js.map + /* + * Error Recovery: If even a single selector fails to parse, + * then the entire ruleset should be thrown away. + */ + try { + selectors = this._selectors_group(); + } catch (ex){ + if (ex instanceof SyntaxError && !this.options.strict){ + + //fire error event + this.fire({ + type: "error", + error: ex, + message: ex.message, + line: ex.line, + col: ex.col + }); + + //skip over everything until closing brace + tt = tokenStream.advance([Tokens.RBRACE]); + if (tt === Tokens.RBRACE){ + //if there's a right brace, the rule is finished so don't do anything + } else { + //otherwise, rethrow the error because it wasn't handled properly + throw ex; + } -/***/ }), -/* 272 */ -/***/ (function(module, exports, __webpack_require__) { + } else { + //not a syntax error, rethrow it + throw ex; + } -"use strict"; + //trigger parser to continue + return true; + } -var IfObservable_1 = __webpack_require__(253); -exports._if = IfObservable_1.IfObservable.create; -//# sourceMappingURL=if.js.map + //if it got here, all selectors parsed + if (selectors){ -/***/ }), -/* 273 */ -/***/ (function(module, exports, __webpack_require__) { + this.fire({ + type: "startrule", + selectors: selectors, + line: selectors[0].line, + col: selectors[0].col + }); -"use strict"; + this._readDeclarations(true); -var IntervalObservable_1 = __webpack_require__(254); -exports.interval = IntervalObservable_1.IntervalObservable.create; -//# sourceMappingURL=interval.js.map + this.fire({ + type: "endrule", + selectors: selectors, + line: selectors[0].line, + col: selectors[0].col + }); -/***/ }), -/* 274 */ -/***/ (function(module, exports, __webpack_require__) { + } -"use strict"; + return selectors; -var NeverObservable_1 = __webpack_require__(255); -exports.never = NeverObservable_1.NeverObservable.create; -//# sourceMappingURL=never.js.map + }, -/***/ }), -/* 275 */ -/***/ (function(module, exports, __webpack_require__) { + //CSS3 Selectors + _selectors_group: function(){ + + /* + * selectors_group + * : selector [ COMMA S* selector ]* + * ; + */ + var tokenStream = this._tokenStream, + selectors = [], + selector; + + selector = this._selector(); + if (selector !== null){ + + selectors.push(selector); + while(tokenStream.match(Tokens.COMMA)){ + this._readWhitespace(); + selector = this._selector(); + if (selector !== null){ + selectors.push(selector); + } else { + this._unexpectedToken(tokenStream.LT(1)); + } + } + } -"use strict"; + return selectors.length ? selectors : null; + }, -var PairsObservable_1 = __webpack_require__(256); -exports.pairs = PairsObservable_1.PairsObservable.create; -//# sourceMappingURL=pairs.js.map + //CSS3 Selectors + _selector: function(){ + /* + * selector + * : simple_selector_sequence [ combinator simple_selector_sequence ]* + * ; + */ + + var tokenStream = this._tokenStream, + selector = [], + nextSelector = null, + combinator = null, + ws = null; + + //if there's no simple selector, then there's no selector + nextSelector = this._simple_selector_sequence(); + if (nextSelector === null){ + return null; + } -/***/ }), -/* 276 */ -/***/ (function(module, exports, __webpack_require__) { + selector.push(nextSelector); -"use strict"; + do { -var RangeObservable_1 = __webpack_require__(257); -exports.range = RangeObservable_1.RangeObservable.create; -//# sourceMappingURL=range.js.map + //look for a combinator + combinator = this._combinator(); -/***/ }), -/* 277 */ -/***/ (function(module, exports, __webpack_require__) { + if (combinator !== null){ + selector.push(combinator); + nextSelector = this._simple_selector_sequence(); -"use strict"; + //there must be a next selector + if (nextSelector === null){ + this._unexpectedToken(tokenStream.LT(1)); + } else { -var ErrorObservable_1 = __webpack_require__(249); -exports._throw = ErrorObservable_1.ErrorObservable.create; -//# sourceMappingURL=throw.js.map + //nextSelector is an instance of SelectorPart + selector.push(nextSelector); + } + } else { + + //if there's not whitespace, we're done + if (this._readWhitespace()){ + + //add whitespace separator + ws = new Combinator(tokenStream.token().value, tokenStream.token().startLine, tokenStream.token().startCol); + + //combinator is not required + combinator = this._combinator(); + + //selector is required if there's a combinator + nextSelector = this._simple_selector_sequence(); + if (nextSelector === null){ + if (combinator !== null){ + this._unexpectedToken(tokenStream.LT(1)); + } + } else { + + if (combinator !== null){ + selector.push(combinator); + } else { + selector.push(ws); + } + + selector.push(nextSelector); + } + } else { + break; + } -/***/ }), -/* 278 */ -/***/ (function(module, exports, __webpack_require__) { + } + } while(true); -"use strict"; + return new Selector(selector, selector[0].line, selector[0].col); + }, -var TimerObservable_1 = __webpack_require__(259); -exports.timer = TimerObservable_1.TimerObservable.create; -//# sourceMappingURL=timer.js.map + //CSS3 Selectors + _simple_selector_sequence: function(){ + /* + * simple_selector_sequence + * : [ type_selector | universal ] + * [ HASH | class | attrib | pseudo | negation ]* + * | [ HASH | class | attrib | pseudo | negation ]+ + * ; + */ + + var tokenStream = this._tokenStream, + + //parts of a simple selector + elementName = null, + modifiers = [], + + //complete selector text + selectorText= "", + + //the different parts after the element name to search for + components = [ + //HASH + function(){ + return tokenStream.match(Tokens.HASH) ? + new SelectorSubPart(tokenStream.token().value, "id", tokenStream.token().startLine, tokenStream.token().startCol) : + null; + }, + this._class, + this._attrib, + this._pseudo, + this._negation + ], + i = 0, + len = components.length, + component = null, + line, + col; + + + //get starting line and column for the selector + line = tokenStream.LT(1).startLine; + col = tokenStream.LT(1).startCol; + + elementName = this._type_selector(); + if (!elementName){ + elementName = this._universal(); + } -/***/ }), -/* 279 */ -/***/ (function(module, exports, __webpack_require__) { + if (elementName !== null){ + selectorText += elementName; + } -"use strict"; + while(true){ -var UsingObservable_1 = __webpack_require__(260); -exports.using = UsingObservable_1.UsingObservable.create; -//# sourceMappingURL=using.js.map + //whitespace means we're done + if (tokenStream.peek() === Tokens.S){ + break; + } -/***/ }), -/* 280 */ -/***/ (function(module, exports, __webpack_require__) { + //check for each component + while(i < len && component === null){ + component = components[i++].call(this); + } -"use strict"; + if (component === null){ -var zip_1 = __webpack_require__(39); -exports.zip = zip_1.zipStatic; -//# sourceMappingURL=zip.js.map + //we don't have a selector + if (selectorText === ""){ + return null; + } else { + break; + } + } else { + i = 0; + modifiers.push(component); + selectorText += component.toString(); + component = null; + } + } -/***/ }), -/* 281 */ -/***/ (function(module, exports, __webpack_require__) { -"use strict"; + return selectorText !== "" ? + new SelectorPart(elementName, modifiers, selectorText, line, col) : + null; + }, -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; -var tryCatch_1 = __webpack_require__(7); -var errorObject_1 = __webpack_require__(5); -var OuterSubscriber_1 = __webpack_require__(4); -var subscribeToResult_1 = __webpack_require__(3); -/** - * Ignores source values for a duration determined by another Observable, then - * emits the most recent value from the source Observable, then repeats this - * process. - * - * It's like {@link auditTime}, but the silencing - * duration is determined by a second Observable. - * - * - * - * `audit` is similar to `throttle`, but emits the last value from the silenced - * time window, instead of the first value. `audit` emits the most recent value - * from the source Observable on the output Observable as soon as its internal - * timer becomes disabled, and ignores source values while the timer is enabled. - * Initially, the timer is disabled. As soon as the first source value arrives, - * the timer is enabled by calling the `durationSelector` function with the - * source value, which returns the "duration" Observable. When the duration - * Observable emits a value or completes, the timer is disabled, then the most - * recent source value is emitted on the output Observable, and this process - * repeats for the next source value. - * - * @example Emit clicks at a rate of at most one click per second - * var clicks = Rx.Observable.fromEvent(document, 'click'); - * var result = clicks.audit(ev => Rx.Observable.interval(1000)); - * result.subscribe(x => console.log(x)); - * - * @see {@link auditTime} - * @see {@link debounce} - * @see {@link delayWhen} - * @see {@link sample} - * @see {@link throttle} - * - * @param {function(value: T): SubscribableOrPromise} durationSelector A function - * that receives a value from the source Observable, for computing the silencing - * duration, returned as an Observable or a Promise. - * @return {Observable} An Observable that performs rate-limiting of - * emissions from the source Observable. - * @method audit - * @owner Observable - */ -function audit(durationSelector) { - return this.lift(new AuditOperator(durationSelector)); -} -exports.audit = audit; -var AuditOperator = (function () { - function AuditOperator(durationSelector) { - this.durationSelector = durationSelector; - } - AuditOperator.prototype.call = function (subscriber, source) { - return source.subscribe(new AuditSubscriber(subscriber, this.durationSelector)); - }; - return AuditOperator; -}()); -/** - * We need this JSDoc comment for affecting ESDoc. - * @ignore - * @extends {Ignored} - */ -var AuditSubscriber = (function (_super) { - __extends(AuditSubscriber, _super); - function AuditSubscriber(destination, durationSelector) { - _super.call(this, destination); - this.durationSelector = durationSelector; - this.hasValue = false; - } - AuditSubscriber.prototype._next = function (value) { - this.value = value; - this.hasValue = true; - if (!this.throttled) { - var duration = tryCatch_1.tryCatch(this.durationSelector)(value); - if (duration === errorObject_1.errorObject) { - this.destination.error(errorObject_1.errorObject.e); - } - else { - var innerSubscription = subscribeToResult_1.subscribeToResult(this, duration); - if (innerSubscription.closed) { - this.clearThrottle(); + //CSS3 Selectors + _type_selector: function(){ + /* + * type_selector + * : [ namespace_prefix ]? element_name + * ; + */ + + var tokenStream = this._tokenStream, + ns = this._namespace_prefix(), + elementName = this._element_name(); + + if (!elementName){ + /* + * Need to back out the namespace that was read due to both + * type_selector and universal reading namespace_prefix + * first. Kind of hacky, but only way I can figure out + * right now how to not change the grammar. + */ + if (ns){ + tokenStream.unget(); + if (ns.length > 1){ + tokenStream.unget(); + } + } + + return null; + } else { + if (ns){ + elementName.text = ns + elementName.text; + elementName.col -= ns.length; + } + return elementName; } - else { - this.add(this.throttled = innerSubscription); + }, + + //CSS3 Selectors + _class: function(){ + /* + * class + * : '.' IDENT + * ; + */ + + var tokenStream = this._tokenStream, + token; + + if (tokenStream.match(Tokens.DOT)){ + tokenStream.mustMatch(Tokens.IDENT); + token = tokenStream.token(); + return new SelectorSubPart("." + token.value, "class", token.startLine, token.startCol - 1); + } else { + return null; } - } - } - }; - AuditSubscriber.prototype.clearThrottle = function () { - var _a = this, value = _a.value, hasValue = _a.hasValue, throttled = _a.throttled; - if (throttled) { - this.remove(throttled); - this.throttled = null; - throttled.unsubscribe(); - } - if (hasValue) { - this.value = null; - this.hasValue = false; - this.destination.next(value); - } - }; - AuditSubscriber.prototype.notifyNext = function (outerValue, innerValue, outerIndex, innerIndex) { - this.clearThrottle(); - }; - AuditSubscriber.prototype.notifyComplete = function () { - this.clearThrottle(); - }; - return AuditSubscriber; -}(OuterSubscriber_1.OuterSubscriber)); -//# sourceMappingURL=audit.js.map -/***/ }), -/* 282 */ -/***/ (function(module, exports, __webpack_require__) { + }, -"use strict"; + //CSS3 Selectors + _element_name: function(){ + /* + * element_name + * : IDENT + * ; + */ -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; -var async_1 = __webpack_require__(8); -var Subscriber_1 = __webpack_require__(2); -/** - * Ignores source values for `duration` milliseconds, then emits the most recent - * value from the source Observable, then repeats this process. - * - * When it sees a source values, it ignores that plus - * the next ones for `duration` milliseconds, and then it emits the most recent - * value from the source. - * - * - * - * `auditTime` is similar to `throttleTime`, but emits the last value from the - * silenced time window, instead of the first value. `auditTime` emits the most - * recent value from the source Observable on the output Observable as soon as - * its internal timer becomes disabled, and ignores source values while the - * timer is enabled. Initially, the timer is disabled. As soon as the first - * source value arrives, the timer is enabled. After `duration` milliseconds (or - * the time unit determined internally by the optional `scheduler`) has passed, - * the timer is disabled, then the most recent source value is emitted on the - * output Observable, and this process repeats for the next source value. - * Optionally takes a {@link IScheduler} for managing timers. - * - * @example Emit clicks at a rate of at most one click per second - * var clicks = Rx.Observable.fromEvent(document, 'click'); - * var result = clicks.auditTime(1000); - * result.subscribe(x => console.log(x)); - * - * @see {@link audit} - * @see {@link debounceTime} - * @see {@link delay} - * @see {@link sampleTime} - * @see {@link throttleTime} - * - * @param {number} duration Time to wait before emitting the most recent source - * value, measured in milliseconds or the time unit determined internally - * by the optional `scheduler`. - * @param {Scheduler} [scheduler=async] The {@link IScheduler} to use for - * managing the timers that handle the rate-limiting behavior. - * @return {Observable} An Observable that performs rate-limiting of - * emissions from the source Observable. - * @method auditTime - * @owner Observable - */ -function auditTime(duration, scheduler) { - if (scheduler === void 0) { scheduler = async_1.async; } - return this.lift(new AuditTimeOperator(duration, scheduler)); -} -exports.auditTime = auditTime; -var AuditTimeOperator = (function () { - function AuditTimeOperator(duration, scheduler) { - this.duration = duration; - this.scheduler = scheduler; - } - AuditTimeOperator.prototype.call = function (subscriber, source) { - return source.subscribe(new AuditTimeSubscriber(subscriber, this.duration, this.scheduler)); - }; - return AuditTimeOperator; -}()); -/** - * We need this JSDoc comment for affecting ESDoc. - * @ignore - * @extends {Ignored} - */ -var AuditTimeSubscriber = (function (_super) { - __extends(AuditTimeSubscriber, _super); - function AuditTimeSubscriber(destination, duration, scheduler) { - _super.call(this, destination); - this.duration = duration; - this.scheduler = scheduler; - this.hasValue = false; - } - AuditTimeSubscriber.prototype._next = function (value) { - this.value = value; - this.hasValue = true; - if (!this.throttled) { - this.add(this.throttled = this.scheduler.schedule(dispatchNext, this.duration, this)); - } - }; - AuditTimeSubscriber.prototype.clearThrottle = function () { - var _a = this, value = _a.value, hasValue = _a.hasValue, throttled = _a.throttled; - if (throttled) { - this.remove(throttled); - this.throttled = null; - throttled.unsubscribe(); - } - if (hasValue) { - this.value = null; - this.hasValue = false; - this.destination.next(value); - } - }; - return AuditTimeSubscriber; -}(Subscriber_1.Subscriber)); -function dispatchNext(subscriber) { - subscriber.clearThrottle(); -} -//# sourceMappingURL=auditTime.js.map + var tokenStream = this._tokenStream, + token; -/***/ }), -/* 283 */ -/***/ (function(module, exports, __webpack_require__) { + if (tokenStream.match(Tokens.IDENT)){ + token = tokenStream.token(); + return new SelectorSubPart(token.value, "elementName", token.startLine, token.startCol); -"use strict"; + } else { + return null; + } + }, -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; -var OuterSubscriber_1 = __webpack_require__(4); -var subscribeToResult_1 = __webpack_require__(3); -/** - * Buffers the source Observable values until `closingNotifier` emits. - * - * Collects values from the past as an array, and emits - * that array only when another Observable emits. - * - * - * - * Buffers the incoming Observable values until the given `closingNotifier` - * Observable emits a value, at which point it emits the buffer on the output - * Observable and starts a new buffer internally, awaiting the next time - * `closingNotifier` emits. - * - * @example On every click, emit array of most recent interval events - * var clicks = Rx.Observable.fromEvent(document, 'click'); - * var interval = Rx.Observable.interval(1000); - * var buffered = interval.buffer(clicks); - * buffered.subscribe(x => console.log(x)); - * - * @see {@link bufferCount} - * @see {@link bufferTime} - * @see {@link bufferToggle} - * @see {@link bufferWhen} - * @see {@link window} - * - * @param {Observable} closingNotifier An Observable that signals the - * buffer to be emitted on the output Observable. - * @return {Observable} An Observable of buffers, which are arrays of - * values. - * @method buffer - * @owner Observable - */ -function buffer(closingNotifier) { - return this.lift(new BufferOperator(closingNotifier)); -} -exports.buffer = buffer; -var BufferOperator = (function () { - function BufferOperator(closingNotifier) { - this.closingNotifier = closingNotifier; - } - BufferOperator.prototype.call = function (subscriber, source) { - return source.subscribe(new BufferSubscriber(subscriber, this.closingNotifier)); - }; - return BufferOperator; -}()); -/** - * We need this JSDoc comment for affecting ESDoc. - * @ignore - * @extends {Ignored} - */ -var BufferSubscriber = (function (_super) { - __extends(BufferSubscriber, _super); - function BufferSubscriber(destination, closingNotifier) { - _super.call(this, destination); - this.buffer = []; - this.add(subscribeToResult_1.subscribeToResult(this, closingNotifier)); - } - BufferSubscriber.prototype._next = function (value) { - this.buffer.push(value); - }; - BufferSubscriber.prototype.notifyNext = function (outerValue, innerValue, outerIndex, innerIndex, innerSub) { - var buffer = this.buffer; - this.buffer = []; - this.destination.next(buffer); - }; - return BufferSubscriber; -}(OuterSubscriber_1.OuterSubscriber)); -//# sourceMappingURL=buffer.js.map + //CSS3 Selectors + _namespace_prefix: function(){ + /* + * namespace_prefix + * : [ IDENT | '*' ]? '|' + * ; + */ + var tokenStream = this._tokenStream, + value = ""; + + //verify that this is a namespace prefix + if (tokenStream.LA(1) === Tokens.PIPE || tokenStream.LA(2) === Tokens.PIPE){ + + if(tokenStream.match([Tokens.IDENT, Tokens.STAR])){ + value += tokenStream.token().value; + } -/***/ }), -/* 284 */ -/***/ (function(module, exports, __webpack_require__) { + tokenStream.mustMatch(Tokens.PIPE); + value += "|"; -"use strict"; + } -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; -var Subscriber_1 = __webpack_require__(2); -/** - * Buffers the source Observable values until the size hits the maximum - * `bufferSize` given. - * - * Collects values from the past as an array, and emits - * that array only when its size reaches `bufferSize`. - * - * - * - * Buffers a number of values from the source Observable by `bufferSize` then - * emits the buffer and clears it, and starts a new buffer each - * `startBufferEvery` values. If `startBufferEvery` is not provided or is - * `null`, then new buffers are started immediately at the start of the source - * and when each buffer closes and is emitted. - * - * @example Emit the last two click events as an array - * var clicks = Rx.Observable.fromEvent(document, 'click'); - * var buffered = clicks.bufferCount(2); - * buffered.subscribe(x => console.log(x)); - * - * @example On every click, emit the last two click events as an array - * var clicks = Rx.Observable.fromEvent(document, 'click'); - * var buffered = clicks.bufferCount(2, 1); - * buffered.subscribe(x => console.log(x)); - * - * @see {@link buffer} - * @see {@link bufferTime} - * @see {@link bufferToggle} - * @see {@link bufferWhen} - * @see {@link pairwise} - * @see {@link windowCount} - * - * @param {number} bufferSize The maximum size of the buffer emitted. - * @param {number} [startBufferEvery] Interval at which to start a new buffer. - * For example if `startBufferEvery` is `2`, then a new buffer will be started - * on every other value from the source. A new buffer is started at the - * beginning of the source by default. - * @return {Observable} An Observable of arrays of buffered values. - * @method bufferCount - * @owner Observable - */ -function bufferCount(bufferSize, startBufferEvery) { - if (startBufferEvery === void 0) { startBufferEvery = null; } - return this.lift(new BufferCountOperator(bufferSize, startBufferEvery)); -} -exports.bufferCount = bufferCount; -var BufferCountOperator = (function () { - function BufferCountOperator(bufferSize, startBufferEvery) { - this.bufferSize = bufferSize; - this.startBufferEvery = startBufferEvery; - if (!startBufferEvery || bufferSize === startBufferEvery) { - this.subscriberClass = BufferCountSubscriber; - } - else { - this.subscriberClass = BufferSkipCountSubscriber; - } - } - BufferCountOperator.prototype.call = function (subscriber, source) { - return source.subscribe(new this.subscriberClass(subscriber, this.bufferSize, this.startBufferEvery)); - }; - return BufferCountOperator; -}()); -/** - * We need this JSDoc comment for affecting ESDoc. - * @ignore - * @extends {Ignored} - */ -var BufferCountSubscriber = (function (_super) { - __extends(BufferCountSubscriber, _super); - function BufferCountSubscriber(destination, bufferSize) { - _super.call(this, destination); - this.bufferSize = bufferSize; - this.buffer = []; - } - BufferCountSubscriber.prototype._next = function (value) { - var buffer = this.buffer; - buffer.push(value); - if (buffer.length == this.bufferSize) { - this.destination.next(buffer); - this.buffer = []; - } - }; - BufferCountSubscriber.prototype._complete = function () { - var buffer = this.buffer; - if (buffer.length > 0) { - this.destination.next(buffer); - } - _super.prototype._complete.call(this); - }; - return BufferCountSubscriber; -}(Subscriber_1.Subscriber)); -/** - * We need this JSDoc comment for affecting ESDoc. - * @ignore - * @extends {Ignored} - */ -var BufferSkipCountSubscriber = (function (_super) { - __extends(BufferSkipCountSubscriber, _super); - function BufferSkipCountSubscriber(destination, bufferSize, startBufferEvery) { - _super.call(this, destination); - this.bufferSize = bufferSize; - this.startBufferEvery = startBufferEvery; - this.buffers = []; - this.count = 0; - } - BufferSkipCountSubscriber.prototype._next = function (value) { - var _a = this, bufferSize = _a.bufferSize, startBufferEvery = _a.startBufferEvery, buffers = _a.buffers, count = _a.count; - this.count++; - if (count % startBufferEvery === 0) { - buffers.push([]); - } - for (var i = buffers.length; i--;) { - var buffer = buffers[i]; - buffer.push(value); - if (buffer.length === bufferSize) { - buffers.splice(i, 1); - this.destination.next(buffer); - } - } - }; - BufferSkipCountSubscriber.prototype._complete = function () { - var _a = this, buffers = _a.buffers, destination = _a.destination; - while (buffers.length > 0) { - var buffer = buffers.shift(); - if (buffer.length > 0) { - destination.next(buffer); - } - } - _super.prototype._complete.call(this); - }; - return BufferSkipCountSubscriber; -}(Subscriber_1.Subscriber)); -//# sourceMappingURL=bufferCount.js.map + return value.length ? value : null; + }, + + //CSS3 Selectors + _universal: function(){ + /* + * universal + * : [ namespace_prefix ]? '*' + * ; + */ + var tokenStream = this._tokenStream, + value = "", + ns; + + ns = this._namespace_prefix(); + if(ns){ + value += ns; + } + + if(tokenStream.match(Tokens.STAR)){ + value += "*"; + } -/***/ }), -/* 285 */ -/***/ (function(module, exports, __webpack_require__) { + return value.length ? value : null; + + }, + + //CSS3 Selectors + _attrib: function(){ + /* + * attrib + * : '[' S* [ namespace_prefix ]? IDENT S* + * [ [ PREFIXMATCH | + * SUFFIXMATCH | + * SUBSTRINGMATCH | + * '=' | + * INCLUDES | + * DASHMATCH ] S* [ IDENT | STRING ] S* + * ]? ']' + * ; + */ + + var tokenStream = this._tokenStream, + value = null, + ns, + token; + + if (tokenStream.match(Tokens.LBRACKET)){ + token = tokenStream.token(); + value = token.value; + value += this._readWhitespace(); + + ns = this._namespace_prefix(); + + if (ns){ + value += ns; + } -"use strict"; + tokenStream.mustMatch(Tokens.IDENT); + value += tokenStream.token().value; + value += this._readWhitespace(); -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; -var async_1 = __webpack_require__(8); -var Subscriber_1 = __webpack_require__(2); -var isScheduler_1 = __webpack_require__(13); -/* tslint:enable:max-line-length */ -/** - * Buffers the source Observable values for a specific time period. - * - * Collects values from the past as an array, and emits - * those arrays periodically in time. - * - * - * - * Buffers values from the source for a specific time duration `bufferTimeSpan`. - * Unless the optional argument `bufferCreationInterval` is given, it emits and - * resets the buffer every `bufferTimeSpan` milliseconds. If - * `bufferCreationInterval` is given, this operator opens the buffer every - * `bufferCreationInterval` milliseconds and closes (emits and resets) the - * buffer every `bufferTimeSpan` milliseconds. When the optional argument - * `maxBufferSize` is specified, the buffer will be closed either after - * `bufferTimeSpan` milliseconds or when it contains `maxBufferSize` elements. - * - * @example Every second, emit an array of the recent click events - * var clicks = Rx.Observable.fromEvent(document, 'click'); - * var buffered = clicks.bufferTime(1000); - * buffered.subscribe(x => console.log(x)); - * - * @example Every 5 seconds, emit the click events from the next 2 seconds - * var clicks = Rx.Observable.fromEvent(document, 'click'); - * var buffered = clicks.bufferTime(2000, 5000); - * buffered.subscribe(x => console.log(x)); - * - * @see {@link buffer} - * @see {@link bufferCount} - * @see {@link bufferToggle} - * @see {@link bufferWhen} - * @see {@link windowTime} - * - * @param {number} bufferTimeSpan The amount of time to fill each buffer array. - * @param {number} [bufferCreationInterval] The interval at which to start new - * buffers. - * @param {number} [maxBufferSize] The maximum buffer size. - * @param {Scheduler} [scheduler=async] The scheduler on which to schedule the - * intervals that determine buffer boundaries. - * @return {Observable} An observable of arrays of buffered values. - * @method bufferTime - * @owner Observable - */ -function bufferTime(bufferTimeSpan) { - var length = arguments.length; - var scheduler = async_1.async; - if (isScheduler_1.isScheduler(arguments[arguments.length - 1])) { - scheduler = arguments[arguments.length - 1]; - length--; - } - var bufferCreationInterval = null; - if (length >= 2) { - bufferCreationInterval = arguments[1]; - } - var maxBufferSize = Number.POSITIVE_INFINITY; - if (length >= 3) { - maxBufferSize = arguments[2]; - } - return this.lift(new BufferTimeOperator(bufferTimeSpan, bufferCreationInterval, maxBufferSize, scheduler)); -} -exports.bufferTime = bufferTime; -var BufferTimeOperator = (function () { - function BufferTimeOperator(bufferTimeSpan, bufferCreationInterval, maxBufferSize, scheduler) { - this.bufferTimeSpan = bufferTimeSpan; - this.bufferCreationInterval = bufferCreationInterval; - this.maxBufferSize = maxBufferSize; - this.scheduler = scheduler; - } - BufferTimeOperator.prototype.call = function (subscriber, source) { - return source.subscribe(new BufferTimeSubscriber(subscriber, this.bufferTimeSpan, this.bufferCreationInterval, this.maxBufferSize, this.scheduler)); - }; - return BufferTimeOperator; -}()); -var Context = (function () { - function Context() { - this.buffer = []; - } - return Context; -}()); -/** - * We need this JSDoc comment for affecting ESDoc. - * @ignore - * @extends {Ignored} - */ -var BufferTimeSubscriber = (function (_super) { - __extends(BufferTimeSubscriber, _super); - function BufferTimeSubscriber(destination, bufferTimeSpan, bufferCreationInterval, maxBufferSize, scheduler) { - _super.call(this, destination); - this.bufferTimeSpan = bufferTimeSpan; - this.bufferCreationInterval = bufferCreationInterval; - this.maxBufferSize = maxBufferSize; - this.scheduler = scheduler; - this.contexts = []; - var context = this.openContext(); - this.timespanOnly = bufferCreationInterval == null || bufferCreationInterval < 0; - if (this.timespanOnly) { - var timeSpanOnlyState = { subscriber: this, context: context, bufferTimeSpan: bufferTimeSpan }; - this.add(context.closeAction = scheduler.schedule(dispatchBufferTimeSpanOnly, bufferTimeSpan, timeSpanOnlyState)); - } - else { - var closeState = { subscriber: this, context: context }; - var creationState = { bufferTimeSpan: bufferTimeSpan, bufferCreationInterval: bufferCreationInterval, subscriber: this, scheduler: scheduler }; - this.add(context.closeAction = scheduler.schedule(dispatchBufferClose, bufferTimeSpan, closeState)); - this.add(scheduler.schedule(dispatchBufferCreation, bufferCreationInterval, creationState)); - } - } - BufferTimeSubscriber.prototype._next = function (value) { - var contexts = this.contexts; - var len = contexts.length; - var filledBufferContext; - for (var i = 0; i < len; i++) { - var context = contexts[i]; - var buffer = context.buffer; - buffer.push(value); - if (buffer.length == this.maxBufferSize) { - filledBufferContext = context; - } - } - if (filledBufferContext) { - this.onBufferFull(filledBufferContext); - } - }; - BufferTimeSubscriber.prototype._error = function (err) { - this.contexts.length = 0; - _super.prototype._error.call(this, err); - }; - BufferTimeSubscriber.prototype._complete = function () { - var _a = this, contexts = _a.contexts, destination = _a.destination; - while (contexts.length > 0) { - var context = contexts.shift(); - destination.next(context.buffer); - } - _super.prototype._complete.call(this); - }; - BufferTimeSubscriber.prototype._unsubscribe = function () { - this.contexts = null; - }; - BufferTimeSubscriber.prototype.onBufferFull = function (context) { - this.closeContext(context); - var closeAction = context.closeAction; - closeAction.unsubscribe(); - this.remove(closeAction); - if (!this.closed && this.timespanOnly) { - context = this.openContext(); - var bufferTimeSpan = this.bufferTimeSpan; - var timeSpanOnlyState = { subscriber: this, context: context, bufferTimeSpan: bufferTimeSpan }; - this.add(context.closeAction = this.scheduler.schedule(dispatchBufferTimeSpanOnly, bufferTimeSpan, timeSpanOnlyState)); - } - }; - BufferTimeSubscriber.prototype.openContext = function () { - var context = new Context(); - this.contexts.push(context); - return context; - }; - BufferTimeSubscriber.prototype.closeContext = function (context) { - this.destination.next(context.buffer); - var contexts = this.contexts; - var spliceIndex = contexts ? contexts.indexOf(context) : -1; - if (spliceIndex >= 0) { - contexts.splice(contexts.indexOf(context), 1); - } - }; - return BufferTimeSubscriber; -}(Subscriber_1.Subscriber)); -function dispatchBufferTimeSpanOnly(state) { - var subscriber = state.subscriber; - var prevContext = state.context; - if (prevContext) { - subscriber.closeContext(prevContext); - } - if (!subscriber.closed) { - state.context = subscriber.openContext(); - state.context.closeAction = this.schedule(state, state.bufferTimeSpan); - } -} -function dispatchBufferCreation(state) { - var bufferCreationInterval = state.bufferCreationInterval, bufferTimeSpan = state.bufferTimeSpan, subscriber = state.subscriber, scheduler = state.scheduler; - var context = subscriber.openContext(); - var action = this; - if (!subscriber.closed) { - subscriber.add(context.closeAction = scheduler.schedule(dispatchBufferClose, bufferTimeSpan, { subscriber: subscriber, context: context })); - action.schedule(state, bufferCreationInterval); - } -} -function dispatchBufferClose(arg) { - var subscriber = arg.subscriber, context = arg.context; - subscriber.closeContext(context); -} -//# sourceMappingURL=bufferTime.js.map + if(tokenStream.match([Tokens.PREFIXMATCH, Tokens.SUFFIXMATCH, Tokens.SUBSTRINGMATCH, + Tokens.EQUALS, Tokens.INCLUDES, Tokens.DASHMATCH])){ -/***/ }), -/* 286 */ -/***/ (function(module, exports, __webpack_require__) { + value += tokenStream.token().value; + value += this._readWhitespace(); -"use strict"; + tokenStream.mustMatch([Tokens.IDENT, Tokens.STRING]); + value += tokenStream.token().value; + value += this._readWhitespace(); + } -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; -var Subscription_1 = __webpack_require__(9); -var subscribeToResult_1 = __webpack_require__(3); -var OuterSubscriber_1 = __webpack_require__(4); -/** - * Buffers the source Observable values starting from an emission from - * `openings` and ending when the output of `closingSelector` emits. - * - * Collects values from the past as an array. Starts - * collecting only when `opening` emits, and calls the `closingSelector` - * function to get an Observable that tells when to close the buffer. - * - * - * - * Buffers values from the source by opening the buffer via signals from an - * Observable provided to `openings`, and closing and sending the buffers when - * a Subscribable or Promise returned by the `closingSelector` function emits. - * - * @example Every other second, emit the click events from the next 500ms - * var clicks = Rx.Observable.fromEvent(document, 'click'); - * var openings = Rx.Observable.interval(1000); - * var buffered = clicks.bufferToggle(openings, i => - * i % 2 ? Rx.Observable.interval(500) : Rx.Observable.empty() - * ); - * buffered.subscribe(x => console.log(x)); - * - * @see {@link buffer} - * @see {@link bufferCount} - * @see {@link bufferTime} - * @see {@link bufferWhen} - * @see {@link windowToggle} - * - * @param {SubscribableOrPromise} openings A Subscribable or Promise of notifications to start new - * buffers. - * @param {function(value: O): SubscribableOrPromise} closingSelector A function that takes - * the value emitted by the `openings` observable and returns a Subscribable or Promise, - * which, when it emits, signals that the associated buffer should be emitted - * and cleared. - * @return {Observable} An observable of arrays of buffered values. - * @method bufferToggle - * @owner Observable - */ -function bufferToggle(openings, closingSelector) { - return this.lift(new BufferToggleOperator(openings, closingSelector)); -} -exports.bufferToggle = bufferToggle; -var BufferToggleOperator = (function () { - function BufferToggleOperator(openings, closingSelector) { - this.openings = openings; - this.closingSelector = closingSelector; - } - BufferToggleOperator.prototype.call = function (subscriber, source) { - return source.subscribe(new BufferToggleSubscriber(subscriber, this.openings, this.closingSelector)); - }; - return BufferToggleOperator; -}()); -/** - * We need this JSDoc comment for affecting ESDoc. - * @ignore - * @extends {Ignored} - */ -var BufferToggleSubscriber = (function (_super) { - __extends(BufferToggleSubscriber, _super); - function BufferToggleSubscriber(destination, openings, closingSelector) { - _super.call(this, destination); - this.openings = openings; - this.closingSelector = closingSelector; - this.contexts = []; - this.add(subscribeToResult_1.subscribeToResult(this, openings)); - } - BufferToggleSubscriber.prototype._next = function (value) { - var contexts = this.contexts; - var len = contexts.length; - for (var i = 0; i < len; i++) { - contexts[i].buffer.push(value); - } - }; - BufferToggleSubscriber.prototype._error = function (err) { - var contexts = this.contexts; - while (contexts.length > 0) { - var context = contexts.shift(); - context.subscription.unsubscribe(); - context.buffer = null; - context.subscription = null; - } - this.contexts = null; - _super.prototype._error.call(this, err); - }; - BufferToggleSubscriber.prototype._complete = function () { - var contexts = this.contexts; - while (contexts.length > 0) { - var context = contexts.shift(); - this.destination.next(context.buffer); - context.subscription.unsubscribe(); - context.buffer = null; - context.subscription = null; - } - this.contexts = null; - _super.prototype._complete.call(this); - }; - BufferToggleSubscriber.prototype.notifyNext = function (outerValue, innerValue, outerIndex, innerIndex, innerSub) { - outerValue ? this.closeBuffer(outerValue) : this.openBuffer(innerValue); - }; - BufferToggleSubscriber.prototype.notifyComplete = function (innerSub) { - this.closeBuffer(innerSub.context); - }; - BufferToggleSubscriber.prototype.openBuffer = function (value) { - try { - var closingSelector = this.closingSelector; - var closingNotifier = closingSelector.call(this, value); - if (closingNotifier) { - this.trySubscribe(closingNotifier); - } - } - catch (err) { - this._error(err); - } - }; - BufferToggleSubscriber.prototype.closeBuffer = function (context) { - var contexts = this.contexts; - if (contexts && context) { - var buffer = context.buffer, subscription = context.subscription; - this.destination.next(buffer); - contexts.splice(contexts.indexOf(context), 1); - this.remove(subscription); - subscription.unsubscribe(); - } - }; - BufferToggleSubscriber.prototype.trySubscribe = function (closingNotifier) { - var contexts = this.contexts; - var buffer = []; - var subscription = new Subscription_1.Subscription(); - var context = { buffer: buffer, subscription: subscription }; - contexts.push(context); - var innerSubscription = subscribeToResult_1.subscribeToResult(this, closingNotifier, context); - if (!innerSubscription || innerSubscription.closed) { - this.closeBuffer(context); - } - else { - innerSubscription.context = context; - this.add(innerSubscription); - subscription.add(innerSubscription); - } - }; - return BufferToggleSubscriber; -}(OuterSubscriber_1.OuterSubscriber)); -//# sourceMappingURL=bufferToggle.js.map + tokenStream.mustMatch(Tokens.RBRACKET); -/***/ }), -/* 287 */ -/***/ (function(module, exports, __webpack_require__) { + return new SelectorSubPart(value + "]", "attribute", token.startLine, token.startCol); + } else { + return null; + } + }, -"use strict"; + //CSS3 Selectors + _pseudo: function(){ -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; -var Subscription_1 = __webpack_require__(9); -var tryCatch_1 = __webpack_require__(7); -var errorObject_1 = __webpack_require__(5); -var OuterSubscriber_1 = __webpack_require__(4); -var subscribeToResult_1 = __webpack_require__(3); -/** - * Buffers the source Observable values, using a factory function of closing - * Observables to determine when to close, emit, and reset the buffer. - * - * Collects values from the past as an array. When it - * starts collecting values, it calls a function that returns an Observable that - * tells when to close the buffer and restart collecting. - * - * - * - * Opens a buffer immediately, then closes the buffer when the observable - * returned by calling `closingSelector` function emits a value. When it closes - * the buffer, it immediately opens a new buffer and repeats the process. - * - * @example Emit an array of the last clicks every [1-5] random seconds - * var clicks = Rx.Observable.fromEvent(document, 'click'); - * var buffered = clicks.bufferWhen(() => - * Rx.Observable.interval(1000 + Math.random() * 4000) - * ); - * buffered.subscribe(x => console.log(x)); - * - * @see {@link buffer} - * @see {@link bufferCount} - * @see {@link bufferTime} - * @see {@link bufferToggle} - * @see {@link windowWhen} - * - * @param {function(): Observable} closingSelector A function that takes no - * arguments and returns an Observable that signals buffer closure. - * @return {Observable} An observable of arrays of buffered values. - * @method bufferWhen - * @owner Observable - */ -function bufferWhen(closingSelector) { - return this.lift(new BufferWhenOperator(closingSelector)); -} -exports.bufferWhen = bufferWhen; -var BufferWhenOperator = (function () { - function BufferWhenOperator(closingSelector) { - this.closingSelector = closingSelector; - } - BufferWhenOperator.prototype.call = function (subscriber, source) { - return source.subscribe(new BufferWhenSubscriber(subscriber, this.closingSelector)); - }; - return BufferWhenOperator; -}()); -/** - * We need this JSDoc comment for affecting ESDoc. - * @ignore - * @extends {Ignored} - */ -var BufferWhenSubscriber = (function (_super) { - __extends(BufferWhenSubscriber, _super); - function BufferWhenSubscriber(destination, closingSelector) { - _super.call(this, destination); - this.closingSelector = closingSelector; - this.subscribing = false; - this.openBuffer(); - } - BufferWhenSubscriber.prototype._next = function (value) { - this.buffer.push(value); - }; - BufferWhenSubscriber.prototype._complete = function () { - var buffer = this.buffer; - if (buffer) { - this.destination.next(buffer); - } - _super.prototype._complete.call(this); - }; - BufferWhenSubscriber.prototype._unsubscribe = function () { - this.buffer = null; - this.subscribing = false; - }; - BufferWhenSubscriber.prototype.notifyNext = function (outerValue, innerValue, outerIndex, innerIndex, innerSub) { - this.openBuffer(); - }; - BufferWhenSubscriber.prototype.notifyComplete = function () { - if (this.subscribing) { - this.complete(); - } - else { - this.openBuffer(); - } - }; - BufferWhenSubscriber.prototype.openBuffer = function () { - var closingSubscription = this.closingSubscription; - if (closingSubscription) { - this.remove(closingSubscription); - closingSubscription.unsubscribe(); - } - var buffer = this.buffer; - if (this.buffer) { - this.destination.next(buffer); - } - this.buffer = []; - var closingNotifier = tryCatch_1.tryCatch(this.closingSelector)(); - if (closingNotifier === errorObject_1.errorObject) { - this.error(errorObject_1.errorObject.e); - } - else { - closingSubscription = new Subscription_1.Subscription(); - this.closingSubscription = closingSubscription; - this.add(closingSubscription); - this.subscribing = true; - closingSubscription.add(subscribeToResult_1.subscribeToResult(this, closingNotifier)); - this.subscribing = false; - } - }; - return BufferWhenSubscriber; -}(OuterSubscriber_1.OuterSubscriber)); -//# sourceMappingURL=bufferWhen.js.map + /* + * pseudo + * : ':' ':'? [ IDENT | functional_pseudo ] + * ; + */ -/***/ }), -/* 288 */ -/***/ (function(module, exports, __webpack_require__) { + var tokenStream = this._tokenStream, + pseudo = null, + colons = ":", + line, + col; -"use strict"; + if (tokenStream.match(Tokens.COLON)){ -var combineLatest_1 = __webpack_require__(37); -/** - * Converts a higher-order Observable into a first-order Observable by waiting - * for the outer Observable to complete, then applying {@link combineLatest}. - * - * Flattens an Observable-of-Observables by applying - * {@link combineLatest} when the Observable-of-Observables completes. - * - * - * - * Takes an Observable of Observables, and collects all Observables from it. - * Once the outer Observable completes, it subscribes to all collected - * Observables and combines their values using the {@link combineLatest} - * strategy, such that: - * - Every time an inner Observable emits, the output Observable emits. - * - When the returned observable emits, it emits all of the latest values by: - * - If a `project` function is provided, it is called with each recent value - * from each inner Observable in whatever order they arrived, and the result - * of the `project` function is what is emitted by the output Observable. - * - If there is no `project` function, an array of all of the most recent - * values is emitted by the output Observable. - * - * @example Map two click events to a finite interval Observable, then apply combineAll - * var clicks = Rx.Observable.fromEvent(document, 'click'); - * var higherOrder = clicks.map(ev => - * Rx.Observable.interval(Math.random()*2000).take(3) - * ).take(2); - * var result = higherOrder.combineAll(); - * result.subscribe(x => console.log(x)); - * - * @see {@link combineLatest} - * @see {@link mergeAll} - * - * @param {function} [project] An optional function to map the most recent - * values from each inner Observable into a new result. Takes each of the most - * recent values from each collected inner Observable as arguments, in order. - * @return {Observable} An Observable of projected results or arrays of recent - * values. - * @method combineAll - * @owner Observable - */ -function combineAll(project) { - return this.lift(new combineLatest_1.CombineLatestOperator(project)); -} -exports.combineAll = combineAll; -//# sourceMappingURL=combineAll.js.map + if (tokenStream.match(Tokens.COLON)){ + colons += ":"; + } -/***/ }), -/* 289 */ -/***/ (function(module, exports, __webpack_require__) { + if (tokenStream.match(Tokens.IDENT)){ + pseudo = tokenStream.token().value; + line = tokenStream.token().startLine; + col = tokenStream.token().startCol - colons.length; + } else if (tokenStream.peek() === Tokens.FUNCTION){ + line = tokenStream.LT(1).startLine; + col = tokenStream.LT(1).startCol - colons.length; + pseudo = this._functional_pseudo(); + } -"use strict"; + if (pseudo){ + pseudo = new SelectorSubPart(colons + pseudo, "pseudo", line, col); + } + } -var mergeMapTo_1 = __webpack_require__(62); -/* tslint:enable:max-line-length */ -/** - * Projects each source value to the same Observable which is merged multiple - * times in a serialized fashion on the output Observable. - * - * It's like {@link concatMap}, but maps each value - * always to the same inner Observable. - * - * - * - * Maps each source value to the given Observable `innerObservable` regardless - * of the source value, and then flattens those resulting Observables into one - * single Observable, which is the output Observable. Each new `innerObservable` - * instance emitted on the output Observable is concatenated with the previous - * `innerObservable` instance. - * - * __Warning:__ if source values arrive endlessly and faster than their - * corresponding inner Observables can complete, it will result in memory issues - * as inner Observables amass in an unbounded buffer waiting for their turn to - * be subscribed to. - * - * Note: `concatMapTo` is equivalent to `mergeMapTo` with concurrency parameter - * set to `1`. - * - * @example For each click event, tick every second from 0 to 3, with no concurrency - * var clicks = Rx.Observable.fromEvent(document, 'click'); - * var result = clicks.concatMapTo(Rx.Observable.interval(1000).take(4)); - * result.subscribe(x => console.log(x)); - * - * // Results in the following: - * // (results are not concurrent) - * // For every click on the "document" it will emit values 0 to 3 spaced - * // on a 1000ms interval - * // one click = 1000ms-> 0 -1000ms-> 1 -1000ms-> 2 -1000ms-> 3 - * - * @see {@link concat} - * @see {@link concatAll} - * @see {@link concatMap} - * @see {@link mergeMapTo} - * @see {@link switchMapTo} - * - * @param {ObservableInput} innerObservable An Observable to replace each value from - * the source Observable. - * @param {function(outerValue: T, innerValue: I, outerIndex: number, innerIndex: number): any} [resultSelector] - * A function to produce the value on the output Observable based on the values - * and the indices of the source (outer) emission and the inner Observable - * emission. The arguments passed to this function are: - * - `outerValue`: the value that came from the source - * - `innerValue`: the value that came from the projected Observable - * - `outerIndex`: the "index" of the value that came from the source - * - `innerIndex`: the "index" of the value from the projected Observable - * @return {Observable} An observable of values merged together by joining the - * passed observable with itself, one after the other, for each value emitted - * from the source. - * @method concatMapTo - * @owner Observable - */ -function concatMapTo(innerObservable, resultSelector) { - return this.lift(new mergeMapTo_1.MergeMapToOperator(innerObservable, resultSelector, 1)); -} -exports.concatMapTo = concatMapTo; -//# sourceMappingURL=concatMapTo.js.map + return pseudo; + }, -/***/ }), -/* 290 */ -/***/ (function(module, exports, __webpack_require__) { + //CSS3 Selectors + _functional_pseudo: function(){ + /* + * functional_pseudo + * : FUNCTION S* expression ')' + * ; + */ + + var tokenStream = this._tokenStream, + value = null; + + if(tokenStream.match(Tokens.FUNCTION)){ + value = tokenStream.token().value; + value += this._readWhitespace(); + value += this._expression(); + tokenStream.mustMatch(Tokens.RPAREN); + value += ")"; + } -"use strict"; + return value; + }, -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; -var Subscriber_1 = __webpack_require__(2); -/** - * Counts the number of emissions on the source and emits that number when the - * source completes. - * - * Tells how many values were emitted, when the source - * completes. - * - * - * - * `count` transforms an Observable that emits values into an Observable that - * emits a single value that represents the number of values emitted by the - * source Observable. If the source Observable terminates with an error, `count` - * will pass this error notification along without emitting a value first. If - * the source Observable does not terminate at all, `count` will neither emit - * a value nor terminate. This operator takes an optional `predicate` function - * as argument, in which case the output emission will represent the number of - * source values that matched `true` with the `predicate`. - * - * @example Counts how many seconds have passed before the first click happened - * var seconds = Rx.Observable.interval(1000); - * var clicks = Rx.Observable.fromEvent(document, 'click'); - * var secondsBeforeClick = seconds.takeUntil(clicks); - * var result = secondsBeforeClick.count(); - * result.subscribe(x => console.log(x)); - * - * @example Counts how many odd numbers are there between 1 and 7 - * var numbers = Rx.Observable.range(1, 7); - * var result = numbers.count(i => i % 2 === 1); - * result.subscribe(x => console.log(x)); - * - * // Results in: - * // 4 - * - * @see {@link max} - * @see {@link min} - * @see {@link reduce} - * - * @param {function(value: T, i: number, source: Observable): boolean} [predicate] A - * boolean function to select what values are to be counted. It is provided with - * arguments of: - * - `value`: the value from the source Observable. - * - `index`: the (zero-based) "index" of the value from the source Observable. - * - `source`: the source Observable instance itself. - * @return {Observable} An Observable of one number that represents the count as - * described above. - * @method count - * @owner Observable - */ -function count(predicate) { - return this.lift(new CountOperator(predicate, this)); -} -exports.count = count; -var CountOperator = (function () { - function CountOperator(predicate, source) { - this.predicate = predicate; - this.source = source; - } - CountOperator.prototype.call = function (subscriber, source) { - return source.subscribe(new CountSubscriber(subscriber, this.predicate, this.source)); - }; - return CountOperator; -}()); -/** - * We need this JSDoc comment for affecting ESDoc. - * @ignore - * @extends {Ignored} - */ -var CountSubscriber = (function (_super) { - __extends(CountSubscriber, _super); - function CountSubscriber(destination, predicate, source) { - _super.call(this, destination); - this.predicate = predicate; - this.source = source; - this.count = 0; - this.index = 0; - } - CountSubscriber.prototype._next = function (value) { - if (this.predicate) { - this._tryPredicate(value); - } - else { - this.count++; - } - }; - CountSubscriber.prototype._tryPredicate = function (value) { - var result; - try { - result = this.predicate(value, this.index++, this.source); - } - catch (err) { - this.destination.error(err); - return; - } - if (result) { - this.count++; - } - }; - CountSubscriber.prototype._complete = function () { - this.destination.next(this.count); - this.destination.complete(); - }; - return CountSubscriber; -}(Subscriber_1.Subscriber)); -//# sourceMappingURL=count.js.map + //CSS3 Selectors + _expression: function(){ + /* + * expression + * : [ [ PLUS | '-' | DIMENSION | NUMBER | STRING | IDENT ] S* ]+ + * ; + */ + + var tokenStream = this._tokenStream, + value = ""; + + while(tokenStream.match([Tokens.PLUS, Tokens.MINUS, Tokens.DIMENSION, + Tokens.NUMBER, Tokens.STRING, Tokens.IDENT, Tokens.LENGTH, + Tokens.FREQ, Tokens.ANGLE, Tokens.TIME, + Tokens.RESOLUTION, Tokens.SLASH])){ + + value += tokenStream.token().value; + value += this._readWhitespace(); + } + + return value.length ? value : null; + + }, + + //CSS3 Selectors + _negation: function(){ + /* + * negation + * : NOT S* negation_arg S* ')' + * ; + */ + + var tokenStream = this._tokenStream, + line, + col, + value = "", + arg, + subpart = null; + + if (tokenStream.match(Tokens.NOT)){ + value = tokenStream.token().value; + line = tokenStream.token().startLine; + col = tokenStream.token().startCol; + value += this._readWhitespace(); + arg = this._negation_arg(); + value += arg; + value += this._readWhitespace(); + tokenStream.match(Tokens.RPAREN); + value += tokenStream.token().value; + + subpart = new SelectorSubPart(value, "not", line, col); + subpart.args.push(arg); + } + + return subpart; + }, + + //CSS3 Selectors + _negation_arg: function(){ + /* + * negation_arg + * : type_selector | universal | HASH | class | attrib | pseudo + * ; + */ + + var tokenStream = this._tokenStream, + args = [ + this._type_selector, + this._universal, + function(){ + return tokenStream.match(Tokens.HASH) ? + new SelectorSubPart(tokenStream.token().value, "id", tokenStream.token().startLine, tokenStream.token().startCol) : + null; + }, + this._class, + this._attrib, + this._pseudo + ], + arg = null, + i = 0, + len = args.length, + line, + col, + part; + + line = tokenStream.LT(1).startLine; + col = tokenStream.LT(1).startCol; + + while(i < len && arg === null){ + + arg = args[i].call(this); + i++; + } + + //must be a negation arg + if (arg === null){ + this._unexpectedToken(tokenStream.LT(1)); + } + + //it's an element name + if (arg.type === "elementName"){ + part = new SelectorPart(arg, [], arg.toString(), line, col); + } else { + part = new SelectorPart(null, [arg], arg.toString(), line, col); + } + + return part; + }, + + _declaration: function(){ + + /* + * declaration + * : property ':' S* expr prio? + * | /( empty )/ + * ; + */ + + var tokenStream = this._tokenStream, + property = null, + expr = null, + prio = null, + invalid = null, + propertyName= ""; + + property = this._property(); + if (property !== null){ -/***/ }), -/* 291 */ -/***/ (function(module, exports, __webpack_require__) { + tokenStream.mustMatch(Tokens.COLON); + this._readWhitespace(); -"use strict"; + expr = this._expr(); -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; -var OuterSubscriber_1 = __webpack_require__(4); -var subscribeToResult_1 = __webpack_require__(3); -/** - * Emits a value from the source Observable only after a particular time span - * determined by another Observable has passed without another source emission. - * - * It's like {@link debounceTime}, but the time span of - * emission silence is determined by a second Observable. - * - * - * - * `debounce` delays values emitted by the source Observable, but drops previous - * pending delayed emissions if a new value arrives on the source Observable. - * This operator keeps track of the most recent value from the source - * Observable, and spawns a duration Observable by calling the - * `durationSelector` function. The value is emitted only when the duration - * Observable emits a value or completes, and if no other value was emitted on - * the source Observable since the duration Observable was spawned. If a new - * value appears before the duration Observable emits, the previous value will - * be dropped and will not be emitted on the output Observable. - * - * Like {@link debounceTime}, this is a rate-limiting operator, and also a - * delay-like operator since output emissions do not necessarily occur at the - * same time as they did on the source Observable. - * - * @example Emit the most recent click after a burst of clicks - * var clicks = Rx.Observable.fromEvent(document, 'click'); - * var result = clicks.debounce(() => Rx.Observable.interval(1000)); - * result.subscribe(x => console.log(x)); - * - * @see {@link audit} - * @see {@link debounceTime} - * @see {@link delayWhen} - * @see {@link throttle} - * - * @param {function(value: T): SubscribableOrPromise} durationSelector A function - * that receives a value from the source Observable, for computing the timeout - * duration for each source value, returned as an Observable or a Promise. - * @return {Observable} An Observable that delays the emissions of the source - * Observable by the specified duration Observable returned by - * `durationSelector`, and may drop some values if they occur too frequently. - * @method debounce - * @owner Observable - */ -function debounce(durationSelector) { - return this.lift(new DebounceOperator(durationSelector)); -} -exports.debounce = debounce; -var DebounceOperator = (function () { - function DebounceOperator(durationSelector) { - this.durationSelector = durationSelector; - } - DebounceOperator.prototype.call = function (subscriber, source) { - return source.subscribe(new DebounceSubscriber(subscriber, this.durationSelector)); - }; - return DebounceOperator; -}()); -/** - * We need this JSDoc comment for affecting ESDoc. - * @ignore - * @extends {Ignored} - */ -var DebounceSubscriber = (function (_super) { - __extends(DebounceSubscriber, _super); - function DebounceSubscriber(destination, durationSelector) { - _super.call(this, destination); - this.durationSelector = durationSelector; - this.hasValue = false; - this.durationSubscription = null; - } - DebounceSubscriber.prototype._next = function (value) { - try { - var result = this.durationSelector.call(this, value); - if (result) { - this._tryNext(value, result); - } - } - catch (err) { - this.destination.error(err); - } - }; - DebounceSubscriber.prototype._complete = function () { - this.emitValue(); - this.destination.complete(); - }; - DebounceSubscriber.prototype._tryNext = function (value, duration) { - var subscription = this.durationSubscription; - this.value = value; - this.hasValue = true; - if (subscription) { - subscription.unsubscribe(); - this.remove(subscription); - } - subscription = subscribeToResult_1.subscribeToResult(this, duration); - if (!subscription.closed) { - this.add(this.durationSubscription = subscription); - } - }; - DebounceSubscriber.prototype.notifyNext = function (outerValue, innerValue, outerIndex, innerIndex, innerSub) { - this.emitValue(); - }; - DebounceSubscriber.prototype.notifyComplete = function () { - this.emitValue(); - }; - DebounceSubscriber.prototype.emitValue = function () { - if (this.hasValue) { - var value = this.value; - var subscription = this.durationSubscription; - if (subscription) { - this.durationSubscription = null; - subscription.unsubscribe(); - this.remove(subscription); - } - this.value = null; - this.hasValue = false; - _super.prototype._next.call(this, value); - } - }; - return DebounceSubscriber; -}(OuterSubscriber_1.OuterSubscriber)); -//# sourceMappingURL=debounce.js.map + //if there's no parts for the value, it's an error + if (!expr || expr.length === 0){ + this._unexpectedToken(tokenStream.LT(1)); + } -/***/ }), -/* 292 */ -/***/ (function(module, exports, __webpack_require__) { + prio = this._prio(); -"use strict"; + /* + * If hacks should be allowed, then only check the root + * property. If hacks should not be allowed, treat + * _property or *property as invalid properties. + */ + propertyName = property.toString(); + if (this.options.starHack && property.hack === "*" || + this.options.underscoreHack && property.hack === "_") { -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; -var Subscriber_1 = __webpack_require__(2); -var async_1 = __webpack_require__(8); -/** - * Emits a value from the source Observable only after a particular time span - * has passed without another source emission. - * - * It's like {@link delay}, but passes only the most - * recent value from each burst of emissions. - * - * - * - * `debounceTime` delays values emitted by the source Observable, but drops - * previous pending delayed emissions if a new value arrives on the source - * Observable. This operator keeps track of the most recent value from the - * source Observable, and emits that only when `dueTime` enough time has passed - * without any other value appearing on the source Observable. If a new value - * appears before `dueTime` silence occurs, the previous value will be dropped - * and will not be emitted on the output Observable. - * - * This is a rate-limiting operator, because it is impossible for more than one - * value to be emitted in any time window of duration `dueTime`, but it is also - * a delay-like operator since output emissions do not occur at the same time as - * they did on the source Observable. Optionally takes a {@link IScheduler} for - * managing timers. - * - * @example Emit the most recent click after a burst of clicks - * var clicks = Rx.Observable.fromEvent(document, 'click'); - * var result = clicks.debounceTime(1000); - * result.subscribe(x => console.log(x)); - * - * @see {@link auditTime} - * @see {@link debounce} - * @see {@link delay} - * @see {@link sampleTime} - * @see {@link throttleTime} - * - * @param {number} dueTime The timeout duration in milliseconds (or the time - * unit determined internally by the optional `scheduler`) for the window of - * time required to wait for emission silence before emitting the most recent - * source value. - * @param {Scheduler} [scheduler=async] The {@link IScheduler} to use for - * managing the timers that handle the timeout for each value. - * @return {Observable} An Observable that delays the emissions of the source - * Observable by the specified `dueTime`, and may drop some values if they occur - * too frequently. - * @method debounceTime - * @owner Observable - */ -function debounceTime(dueTime, scheduler) { - if (scheduler === void 0) { scheduler = async_1.async; } - return this.lift(new DebounceTimeOperator(dueTime, scheduler)); -} -exports.debounceTime = debounceTime; -var DebounceTimeOperator = (function () { - function DebounceTimeOperator(dueTime, scheduler) { - this.dueTime = dueTime; - this.scheduler = scheduler; - } - DebounceTimeOperator.prototype.call = function (subscriber, source) { - return source.subscribe(new DebounceTimeSubscriber(subscriber, this.dueTime, this.scheduler)); - }; - return DebounceTimeOperator; -}()); -/** - * We need this JSDoc comment for affecting ESDoc. - * @ignore - * @extends {Ignored} - */ -var DebounceTimeSubscriber = (function (_super) { - __extends(DebounceTimeSubscriber, _super); - function DebounceTimeSubscriber(destination, dueTime, scheduler) { - _super.call(this, destination); - this.dueTime = dueTime; - this.scheduler = scheduler; - this.debouncedSubscription = null; - this.lastValue = null; - this.hasValue = false; - } - DebounceTimeSubscriber.prototype._next = function (value) { - this.clearDebounce(); - this.lastValue = value; - this.hasValue = true; - this.add(this.debouncedSubscription = this.scheduler.schedule(dispatchNext, this.dueTime, this)); - }; - DebounceTimeSubscriber.prototype._complete = function () { - this.debouncedNext(); - this.destination.complete(); - }; - DebounceTimeSubscriber.prototype.debouncedNext = function () { - this.clearDebounce(); - if (this.hasValue) { - this.destination.next(this.lastValue); - this.lastValue = null; - this.hasValue = false; - } - }; - DebounceTimeSubscriber.prototype.clearDebounce = function () { - var debouncedSubscription = this.debouncedSubscription; - if (debouncedSubscription !== null) { - this.remove(debouncedSubscription); - debouncedSubscription.unsubscribe(); - this.debouncedSubscription = null; - } - }; - return DebounceTimeSubscriber; -}(Subscriber_1.Subscriber)); -function dispatchNext(subscriber) { - subscriber.debouncedNext(); -} -//# sourceMappingURL=debounceTime.js.map + propertyName = property.text; + } -/***/ }), -/* 293 */ -/***/ (function(module, exports, __webpack_require__) { + try { + this._validateProperty(propertyName, expr); + } catch (ex) { + invalid = ex; + } -"use strict"; + this.fire({ + type: "property", + property: property, + value: expr, + important: prio, + line: property.line, + col: property.col, + invalid: invalid + }); -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; -var Subscriber_1 = __webpack_require__(2); -/* tslint:enable:max-line-length */ -/** - * Emits a given value if the source Observable completes without emitting any - * `next` value, otherwise mirrors the source Observable. - * - * If the source Observable turns out to be empty, then - * this operator will emit a default value. - * - * - * - * `defaultIfEmpty` emits the values emitted by the source Observable or a - * specified default value if the source Observable is empty (completes without - * having emitted any `next` value). - * - * @example If no clicks happen in 5 seconds, then emit "no clicks" - * var clicks = Rx.Observable.fromEvent(document, 'click'); - * var clicksBeforeFive = clicks.takeUntil(Rx.Observable.interval(5000)); - * var result = clicksBeforeFive.defaultIfEmpty('no clicks'); - * result.subscribe(x => console.log(x)); - * - * @see {@link empty} - * @see {@link last} - * - * @param {any} [defaultValue=null] The default value used if the source - * Observable is empty. - * @return {Observable} An Observable that emits either the specified - * `defaultValue` if the source Observable emits no items, or the values emitted - * by the source Observable. - * @method defaultIfEmpty - * @owner Observable - */ -function defaultIfEmpty(defaultValue) { - if (defaultValue === void 0) { defaultValue = null; } - return this.lift(new DefaultIfEmptyOperator(defaultValue)); -} -exports.defaultIfEmpty = defaultIfEmpty; -var DefaultIfEmptyOperator = (function () { - function DefaultIfEmptyOperator(defaultValue) { - this.defaultValue = defaultValue; - } - DefaultIfEmptyOperator.prototype.call = function (subscriber, source) { - return source.subscribe(new DefaultIfEmptySubscriber(subscriber, this.defaultValue)); - }; - return DefaultIfEmptyOperator; -}()); -/** - * We need this JSDoc comment for affecting ESDoc. - * @ignore - * @extends {Ignored} - */ -var DefaultIfEmptySubscriber = (function (_super) { - __extends(DefaultIfEmptySubscriber, _super); - function DefaultIfEmptySubscriber(destination, defaultValue) { - _super.call(this, destination); - this.defaultValue = defaultValue; - this.isEmpty = true; - } - DefaultIfEmptySubscriber.prototype._next = function (value) { - this.isEmpty = false; - this.destination.next(value); - }; - DefaultIfEmptySubscriber.prototype._complete = function () { - if (this.isEmpty) { - this.destination.next(this.defaultValue); - } - this.destination.complete(); - }; - return DefaultIfEmptySubscriber; -}(Subscriber_1.Subscriber)); -//# sourceMappingURL=defaultIfEmpty.js.map + return true; + } else { + return false; + } + }, -/***/ }), -/* 294 */ -/***/ (function(module, exports, __webpack_require__) { + _prio: function(){ + /* + * prio + * : IMPORTANT_SYM S* + * ; + */ -"use strict"; + var tokenStream = this._tokenStream, + result = tokenStream.match(Tokens.IMPORTANT_SYM); -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; -var async_1 = __webpack_require__(8); -var isDate_1 = __webpack_require__(27); -var Subscriber_1 = __webpack_require__(2); -var Notification_1 = __webpack_require__(30); -/** - * Delays the emission of items from the source Observable by a given timeout or - * until a given Date. - * - * Time shifts each item by some specified amount of - * milliseconds. - * - * - * - * If the delay argument is a Number, this operator time shifts the source - * Observable by that amount of time expressed in milliseconds. The relative - * time intervals between the values are preserved. - * - * If the delay argument is a Date, this operator time shifts the start of the - * Observable execution until the given date occurs. - * - * @example Delay each click by one second - * var clicks = Rx.Observable.fromEvent(document, 'click'); - * var delayedClicks = clicks.delay(1000); // each click emitted after 1 second - * delayedClicks.subscribe(x => console.log(x)); - * - * @example Delay all clicks until a future date happens - * var clicks = Rx.Observable.fromEvent(document, 'click'); - * var date = new Date('March 15, 2050 12:00:00'); // in the future - * var delayedClicks = clicks.delay(date); // click emitted only after that date - * delayedClicks.subscribe(x => console.log(x)); - * - * @see {@link debounceTime} - * @see {@link delayWhen} - * - * @param {number|Date} delay The delay duration in milliseconds (a `number`) or - * a `Date` until which the emission of the source items is delayed. - * @param {Scheduler} [scheduler=async] The IScheduler to use for - * managing the timers that handle the time-shift for each item. - * @return {Observable} An Observable that delays the emissions of the source - * Observable by the specified timeout or Date. - * @method delay - * @owner Observable - */ -function delay(delay, scheduler) { - if (scheduler === void 0) { scheduler = async_1.async; } - var absoluteDelay = isDate_1.isDate(delay); - var delayFor = absoluteDelay ? (+delay - scheduler.now()) : Math.abs(delay); - return this.lift(new DelayOperator(delayFor, scheduler)); -} -exports.delay = delay; -var DelayOperator = (function () { - function DelayOperator(delay, scheduler) { - this.delay = delay; - this.scheduler = scheduler; - } - DelayOperator.prototype.call = function (subscriber, source) { - return source.subscribe(new DelaySubscriber(subscriber, this.delay, this.scheduler)); - }; - return DelayOperator; -}()); -/** - * We need this JSDoc comment for affecting ESDoc. - * @ignore - * @extends {Ignored} - */ -var DelaySubscriber = (function (_super) { - __extends(DelaySubscriber, _super); - function DelaySubscriber(destination, delay, scheduler) { - _super.call(this, destination); - this.delay = delay; - this.scheduler = scheduler; - this.queue = []; - this.active = false; - this.errored = false; - } - DelaySubscriber.dispatch = function (state) { - var source = state.source; - var queue = source.queue; - var scheduler = state.scheduler; - var destination = state.destination; - while (queue.length > 0 && (queue[0].time - scheduler.now()) <= 0) { - queue.shift().notification.observe(destination); - } - if (queue.length > 0) { - var delay_1 = Math.max(0, queue[0].time - scheduler.now()); - this.schedule(state, delay_1); - } - else { - source.active = false; - } - }; - DelaySubscriber.prototype._schedule = function (scheduler) { - this.active = true; - this.add(scheduler.schedule(DelaySubscriber.dispatch, this.delay, { - source: this, destination: this.destination, scheduler: scheduler - })); - }; - DelaySubscriber.prototype.scheduleNotification = function (notification) { - if (this.errored === true) { - return; - } - var scheduler = this.scheduler; - var message = new DelayMessage(scheduler.now() + this.delay, notification); - this.queue.push(message); - if (this.active === false) { - this._schedule(scheduler); - } - }; - DelaySubscriber.prototype._next = function (value) { - this.scheduleNotification(Notification_1.Notification.createNext(value)); - }; - DelaySubscriber.prototype._error = function (err) { - this.errored = true; - this.queue = []; - this.destination.error(err); - }; - DelaySubscriber.prototype._complete = function () { - this.scheduleNotification(Notification_1.Notification.createComplete()); - }; - return DelaySubscriber; -}(Subscriber_1.Subscriber)); -var DelayMessage = (function () { - function DelayMessage(time, notification) { - this.time = time; - this.notification = notification; - } - return DelayMessage; -}()); -//# sourceMappingURL=delay.js.map + this._readWhitespace(); + return result; + }, -/***/ }), -/* 295 */ -/***/ (function(module, exports, __webpack_require__) { + _expr: function(inFunction){ + /* + * expr + * : term [ operator term ]* + * ; + */ + + var values = [], + //valueParts = [], + value = null, + operator = null; + + value = this._term(inFunction); + if (value !== null){ + + values.push(value); + + do { + operator = this._operator(inFunction); + + //if there's an operator, keep building up the value parts + if (operator){ + values.push(operator); + } /*else { + //if there's not an operator, you have a full value + values.push(new PropertyValue(valueParts, valueParts[0].line, valueParts[0].col)); + valueParts = []; + }*/ + + value = this._term(inFunction); + + if (value === null){ + break; + } else { + values.push(value); + } + } while(true); + } -"use strict"; + //cleanup + /*if (valueParts.length){ + values.push(new PropertyValue(valueParts, valueParts[0].line, valueParts[0].col)); + }*/ -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; -var Subscriber_1 = __webpack_require__(2); -var Observable_1 = __webpack_require__(0); -var OuterSubscriber_1 = __webpack_require__(4); -var subscribeToResult_1 = __webpack_require__(3); -/** - * Delays the emission of items from the source Observable by a given time span - * determined by the emissions of another Observable. - * - * It's like {@link delay}, but the time span of the - * delay duration is determined by a second Observable. - * - * - * - * `delayWhen` time shifts each emitted value from the source Observable by a - * time span determined by another Observable. When the source emits a value, - * the `delayDurationSelector` function is called with the source value as - * argument, and should return an Observable, called the "duration" Observable. - * The source value is emitted on the output Observable only when the duration - * Observable emits a value or completes. - * - * Optionally, `delayWhen` takes a second argument, `subscriptionDelay`, which - * is an Observable. When `subscriptionDelay` emits its first value or - * completes, the source Observable is subscribed to and starts behaving like - * described in the previous paragraph. If `subscriptionDelay` is not provided, - * `delayWhen` will subscribe to the source Observable as soon as the output - * Observable is subscribed. - * - * @example Delay each click by a random amount of time, between 0 and 5 seconds - * var clicks = Rx.Observable.fromEvent(document, 'click'); - * var delayedClicks = clicks.delayWhen(event => - * Rx.Observable.interval(Math.random() * 5000) - * ); - * delayedClicks.subscribe(x => console.log(x)); - * - * @see {@link debounce} - * @see {@link delay} - * - * @param {function(value: T): Observable} delayDurationSelector A function that - * returns an Observable for each value emitted by the source Observable, which - * is then used to delay the emission of that item on the output Observable - * until the Observable returned from this function emits a value. - * @param {Observable} subscriptionDelay An Observable that triggers the - * subscription to the source Observable once it emits any value. - * @return {Observable} An Observable that delays the emissions of the source - * Observable by an amount of time specified by the Observable returned by - * `delayDurationSelector`. - * @method delayWhen - * @owner Observable - */ -function delayWhen(delayDurationSelector, subscriptionDelay) { - if (subscriptionDelay) { - return new SubscriptionDelayObservable(this, subscriptionDelay) - .lift(new DelayWhenOperator(delayDurationSelector)); - } - return this.lift(new DelayWhenOperator(delayDurationSelector)); -} -exports.delayWhen = delayWhen; -var DelayWhenOperator = (function () { - function DelayWhenOperator(delayDurationSelector) { - this.delayDurationSelector = delayDurationSelector; - } - DelayWhenOperator.prototype.call = function (subscriber, source) { - return source.subscribe(new DelayWhenSubscriber(subscriber, this.delayDurationSelector)); - }; - return DelayWhenOperator; -}()); -/** - * We need this JSDoc comment for affecting ESDoc. - * @ignore - * @extends {Ignored} - */ -var DelayWhenSubscriber = (function (_super) { - __extends(DelayWhenSubscriber, _super); - function DelayWhenSubscriber(destination, delayDurationSelector) { - _super.call(this, destination); - this.delayDurationSelector = delayDurationSelector; - this.completed = false; - this.delayNotifierSubscriptions = []; - this.values = []; - } - DelayWhenSubscriber.prototype.notifyNext = function (outerValue, innerValue, outerIndex, innerIndex, innerSub) { - this.destination.next(outerValue); - this.removeSubscription(innerSub); - this.tryComplete(); - }; - DelayWhenSubscriber.prototype.notifyError = function (error, innerSub) { - this._error(error); - }; - DelayWhenSubscriber.prototype.notifyComplete = function (innerSub) { - var value = this.removeSubscription(innerSub); - if (value) { - this.destination.next(value); - } - this.tryComplete(); - }; - DelayWhenSubscriber.prototype._next = function (value) { - try { - var delayNotifier = this.delayDurationSelector(value); - if (delayNotifier) { - this.tryDelay(delayNotifier, value); - } - } - catch (err) { - this.destination.error(err); - } - }; - DelayWhenSubscriber.prototype._complete = function () { - this.completed = true; - this.tryComplete(); - }; - DelayWhenSubscriber.prototype.removeSubscription = function (subscription) { - subscription.unsubscribe(); - var subscriptionIdx = this.delayNotifierSubscriptions.indexOf(subscription); - var value = null; - if (subscriptionIdx !== -1) { - value = this.values[subscriptionIdx]; - this.delayNotifierSubscriptions.splice(subscriptionIdx, 1); - this.values.splice(subscriptionIdx, 1); - } - return value; - }; - DelayWhenSubscriber.prototype.tryDelay = function (delayNotifier, value) { - var notifierSubscription = subscribeToResult_1.subscribeToResult(this, delayNotifier, value); - if (notifierSubscription && !notifierSubscription.closed) { - this.add(notifierSubscription); - this.delayNotifierSubscriptions.push(notifierSubscription); - } - this.values.push(value); - }; - DelayWhenSubscriber.prototype.tryComplete = function () { - if (this.completed && this.delayNotifierSubscriptions.length === 0) { - this.destination.complete(); - } - }; - return DelayWhenSubscriber; -}(OuterSubscriber_1.OuterSubscriber)); -/** - * We need this JSDoc comment for affecting ESDoc. - * @ignore - * @extends {Ignored} - */ -var SubscriptionDelayObservable = (function (_super) { - __extends(SubscriptionDelayObservable, _super); - function SubscriptionDelayObservable(source, subscriptionDelay) { - _super.call(this); - this.source = source; - this.subscriptionDelay = subscriptionDelay; - } - SubscriptionDelayObservable.prototype._subscribe = function (subscriber) { - this.subscriptionDelay.subscribe(new SubscriptionDelaySubscriber(subscriber, this.source)); - }; - return SubscriptionDelayObservable; -}(Observable_1.Observable)); -/** - * We need this JSDoc comment for affecting ESDoc. - * @ignore - * @extends {Ignored} - */ -var SubscriptionDelaySubscriber = (function (_super) { - __extends(SubscriptionDelaySubscriber, _super); - function SubscriptionDelaySubscriber(parent, source) { - _super.call(this); - this.parent = parent; - this.source = source; - this.sourceSubscribed = false; - } - SubscriptionDelaySubscriber.prototype._next = function (unused) { - this.subscribeToSource(); - }; - SubscriptionDelaySubscriber.prototype._error = function (err) { - this.unsubscribe(); - this.parent.error(err); - }; - SubscriptionDelaySubscriber.prototype._complete = function () { - this.subscribeToSource(); - }; - SubscriptionDelaySubscriber.prototype.subscribeToSource = function () { - if (!this.sourceSubscribed) { - this.sourceSubscribed = true; - this.unsubscribe(); - this.source.subscribe(this.parent); - } - }; - return SubscriptionDelaySubscriber; -}(Subscriber_1.Subscriber)); -//# sourceMappingURL=delayWhen.js.map + return values.length > 0 ? new PropertyValue(values, values[0].line, values[0].col) : null; + }, -/***/ }), -/* 296 */ -/***/ (function(module, exports, __webpack_require__) { + _term: function(inFunction){ + + /* + * term + * : unary_operator? + * [ NUMBER S* | PERCENTAGE S* | LENGTH S* | ANGLE S* | + * TIME S* | FREQ S* | function | ie_function ] + * | STRING S* | IDENT S* | URI S* | UNICODERANGE S* | hexcolor + * ; + */ + + var tokenStream = this._tokenStream, + unary = null, + value = null, + endChar = null, + token, + line, + col; + + //returns the operator or null + unary = this._unary_operator(); + if (unary !== null){ + line = tokenStream.token().startLine; + col = tokenStream.token().startCol; + } -"use strict"; + //exception for IE filters + if (tokenStream.peek() === Tokens.IE_FUNCTION && this.options.ieFilters){ -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; -var Subscriber_1 = __webpack_require__(2); -/** - * Converts an Observable of {@link Notification} objects into the emissions - * that they represent. - * - * Unwraps {@link Notification} objects as actual `next`, - * `error` and `complete` emissions. The opposite of {@link materialize}. - * - * - * - * `dematerialize` is assumed to operate an Observable that only emits - * {@link Notification} objects as `next` emissions, and does not emit any - * `error`. Such Observable is the output of a `materialize` operation. Those - * notifications are then unwrapped using the metadata they contain, and emitted - * as `next`, `error`, and `complete` on the output Observable. - * - * Use this operator in conjunction with {@link materialize}. - * - * @example Convert an Observable of Notifications to an actual Observable - * var notifA = new Rx.Notification('N', 'A'); - * var notifB = new Rx.Notification('N', 'B'); - * var notifE = new Rx.Notification('E', void 0, - * new TypeError('x.toUpperCase is not a function') - * ); - * var materialized = Rx.Observable.of(notifA, notifB, notifE); - * var upperCase = materialized.dematerialize(); - * upperCase.subscribe(x => console.log(x), e => console.error(e)); - * - * // Results in: - * // A - * // B - * // TypeError: x.toUpperCase is not a function - * - * @see {@link Notification} - * @see {@link materialize} - * - * @return {Observable} An Observable that emits items and notifications - * embedded in Notification objects emitted by the source Observable. - * @method dematerialize - * @owner Observable - */ -function dematerialize() { - return this.lift(new DeMaterializeOperator()); -} -exports.dematerialize = dematerialize; -var DeMaterializeOperator = (function () { - function DeMaterializeOperator() { - } - DeMaterializeOperator.prototype.call = function (subscriber, source) { - return source.subscribe(new DeMaterializeSubscriber(subscriber)); - }; - return DeMaterializeOperator; -}()); -/** - * We need this JSDoc comment for affecting ESDoc. - * @ignore - * @extends {Ignored} - */ -var DeMaterializeSubscriber = (function (_super) { - __extends(DeMaterializeSubscriber, _super); - function DeMaterializeSubscriber(destination) { - _super.call(this, destination); - } - DeMaterializeSubscriber.prototype._next = function (value) { - value.observe(this.destination); - }; - return DeMaterializeSubscriber; -}(Subscriber_1.Subscriber)); -//# sourceMappingURL=dematerialize.js.map + value = this._ie_function(); + if (unary === null){ + line = tokenStream.token().startLine; + col = tokenStream.token().startCol; + } -/***/ }), -/* 297 */ -/***/ (function(module, exports, __webpack_require__) { + //see if it's a simple block + } else if (inFunction && tokenStream.match([Tokens.LPAREN, Tokens.LBRACE, Tokens.LBRACKET])){ -"use strict"; + token = tokenStream.token(); + endChar = token.endChar; + value = token.value + this._expr(inFunction).text; + if (unary === null){ + line = tokenStream.token().startLine; + col = tokenStream.token().startCol; + } + tokenStream.mustMatch(Tokens.type(endChar)); + value += endChar; + this._readWhitespace(); + + //see if there's a simple match + } else if (tokenStream.match([Tokens.NUMBER, Tokens.PERCENTAGE, Tokens.LENGTH, + Tokens.ANGLE, Tokens.TIME, + Tokens.FREQ, Tokens.STRING, Tokens.IDENT, Tokens.URI, Tokens.UNICODE_RANGE])){ + + value = tokenStream.token().value; + if (unary === null){ + line = tokenStream.token().startLine; + col = tokenStream.token().startCol; + } + this._readWhitespace(); + } else { -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; -var OuterSubscriber_1 = __webpack_require__(4); -var subscribeToResult_1 = __webpack_require__(3); -var Set_1 = __webpack_require__(372); -/** - * Returns an Observable that emits all items emitted by the source Observable that are distinct by comparison from previous items. - * - * If a keySelector function is provided, then it will project each value from the source observable into a new value that it will - * check for equality with previously projected values. If a keySelector function is not provided, it will use each value from the - * source observable directly with an equality check against previous values. - * - * In JavaScript runtimes that support `Set`, this operator will use a `Set` to improve performance of the distinct value checking. - * - * In other runtimes, this operator will use a minimal implementation of `Set` that relies on an `Array` and `indexOf` under the - * hood, so performance will degrade as more values are checked for distinction. Even in newer browsers, a long-running `distinct` - * use might result in memory leaks. To help alleviate this in some scenarios, an optional `flushes` parameter is also provided so - * that the internal `Set` can be "flushed", basically clearing it of values. - * - * @example A simple example with numbers - * Observable.of(1, 1, 2, 2, 2, 1, 2, 3, 4, 3, 2, 1) - * .distinct() - * .subscribe(x => console.log(x)); // 1, 2, 3, 4 - * - * @example An example using a keySelector function - * interface Person { - * age: number, - * name: string - * } - * - * Observable.of( - * { age: 4, name: 'Foo'}, - * { age: 7, name: 'Bar'}, - * { age: 5, name: 'Foo'}) - * .distinct((p: Person) => p.name) - * .subscribe(x => console.log(x)); - * - * // displays: - * // { age: 4, name: 'Foo' } - * // { age: 7, name: 'Bar' } - * - * @see {@link distinctUntilChanged} - * @see {@link distinctUntilKeyChanged} - * - * @param {function} [keySelector] Optional function to select which value you want to check as distinct. - * @param {Observable} [flushes] Optional Observable for flushing the internal HashSet of the operator. - * @return {Observable} An Observable that emits items from the source Observable with distinct values. - * @method distinct - * @owner Observable - */ -function distinct(keySelector, flushes) { - return this.lift(new DistinctOperator(keySelector, flushes)); -} -exports.distinct = distinct; -var DistinctOperator = (function () { - function DistinctOperator(keySelector, flushes) { - this.keySelector = keySelector; - this.flushes = flushes; - } - DistinctOperator.prototype.call = function (subscriber, source) { - return source.subscribe(new DistinctSubscriber(subscriber, this.keySelector, this.flushes)); - }; - return DistinctOperator; -}()); -/** - * We need this JSDoc comment for affecting ESDoc. - * @ignore - * @extends {Ignored} - */ -var DistinctSubscriber = (function (_super) { - __extends(DistinctSubscriber, _super); - function DistinctSubscriber(destination, keySelector, flushes) { - _super.call(this, destination); - this.keySelector = keySelector; - this.values = new Set_1.Set(); - if (flushes) { - this.add(subscribeToResult_1.subscribeToResult(this, flushes)); - } - } - DistinctSubscriber.prototype.notifyNext = function (outerValue, innerValue, outerIndex, innerIndex, innerSub) { - this.values.clear(); - }; - DistinctSubscriber.prototype.notifyError = function (error, innerSub) { - this._error(error); - }; - DistinctSubscriber.prototype._next = function (value) { - if (this.keySelector) { - this._useKeySelector(value); - } - else { - this._finalizeNext(value, value); - } - }; - DistinctSubscriber.prototype._useKeySelector = function (value) { - var key; - var destination = this.destination; - try { - key = this.keySelector(value); - } - catch (err) { - destination.error(err); - return; - } - this._finalizeNext(key, value); - }; - DistinctSubscriber.prototype._finalizeNext = function (key, value) { - var values = this.values; - if (!values.has(key)) { - values.add(key); - this.destination.next(value); - } - }; - return DistinctSubscriber; -}(OuterSubscriber_1.OuterSubscriber)); -exports.DistinctSubscriber = DistinctSubscriber; -//# sourceMappingURL=distinct.js.map + //see if it's a color + token = this._hexcolor(); + if (token === null){ -/***/ }), -/* 298 */ -/***/ (function(module, exports, __webpack_require__) { + //if there's no unary, get the start of the next token for line/col info + if (unary === null){ + line = tokenStream.LT(1).startLine; + col = tokenStream.LT(1).startCol; + } -"use strict"; + //has to be a function + if (value === null){ + + /* + * This checks for alpha(opacity=0) style of IE + * functions. IE_FUNCTION only presents progid: style. + */ + if (tokenStream.LA(3) === Tokens.EQUALS && this.options.ieFilters){ + value = this._ie_function(); + } else { + value = this._function(); + } + } -var distinctUntilChanged_1 = __webpack_require__(60); -/* tslint:enable:max-line-length */ -/** - * Returns an Observable that emits all items emitted by the source Observable that are distinct by comparison from the previous item, - * using a property accessed by using the key provided to check if the two items are distinct. - * - * If a comparator function is provided, then it will be called for each item to test for whether or not that value should be emitted. - * - * If a comparator function is not provided, an equality check is used by default. - * - * @example An example comparing the name of persons - * - * interface Person { - * age: number, - * name: string - * } - * - * Observable.of( - * { age: 4, name: 'Foo'}, - * { age: 7, name: 'Bar'}, - * { age: 5, name: 'Foo'}, - * { age: 6, name: 'Foo'}) - * .distinctUntilKeyChanged('name') - * .subscribe(x => console.log(x)); - * - * // displays: - * // { age: 4, name: 'Foo' } - * // { age: 7, name: 'Bar' } - * // { age: 5, name: 'Foo' } - * - * @example An example comparing the first letters of the name - * - * interface Person { - * age: number, - * name: string - * } - * - * Observable.of( - * { age: 4, name: 'Foo1'}, - * { age: 7, name: 'Bar'}, - * { age: 5, name: 'Foo2'}, - * { age: 6, name: 'Foo3'}) - * .distinctUntilKeyChanged('name', (x: string, y: string) => x.substring(0, 3) === y.substring(0, 3)) - * .subscribe(x => console.log(x)); - * - * // displays: - * // { age: 4, name: 'Foo1' } - * // { age: 7, name: 'Bar' } - * // { age: 5, name: 'Foo2' } - * - * @see {@link distinct} - * @see {@link distinctUntilChanged} - * - * @param {string} key String key for object property lookup on each item. - * @param {function} [compare] Optional comparison function called to test if an item is distinct from the previous item in the source. - * @return {Observable} An Observable that emits items from the source Observable with distinct values based on the key specified. - * @method distinctUntilKeyChanged - * @owner Observable - */ -function distinctUntilKeyChanged(key, compare) { - return distinctUntilChanged_1.distinctUntilChanged.call(this, function (x, y) { - if (compare) { - return compare(x[key], y[key]); - } - return x[key] === y[key]; - }); -} -exports.distinctUntilKeyChanged = distinctUntilKeyChanged; -//# sourceMappingURL=distinctUntilKeyChanged.js.map + /*if (value === null){ + return null; + //throw new Error("Expected identifier at line " + tokenStream.token().startLine + ", character " + tokenStream.token().startCol + "."); + }*/ -/***/ }), -/* 299 */ -/***/ (function(module, exports, __webpack_require__) { + } else { + value = token.value; + if (unary === null){ + line = token.startLine; + col = token.startCol; + } + } -"use strict"; + } -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; -var Subscriber_1 = __webpack_require__(2); -/* tslint:enable:max-line-length */ -/** - * Perform a side effect for every emission on the source Observable, but return - * an Observable that is identical to the source. - * - * Intercepts each emission on the source and runs a - * function, but returns an output which is identical to the source as long as errors don't occur. - * - * - * - * Returns a mirrored Observable of the source Observable, but modified so that - * the provided Observer is called to perform a side effect for every value, - * error, and completion emitted by the source. Any errors that are thrown in - * the aforementioned Observer or handlers are safely sent down the error path - * of the output Observable. - * - * This operator is useful for debugging your Observables for the correct values - * or performing other side effects. - * - * Note: this is different to a `subscribe` on the Observable. If the Observable - * returned by `do` is not subscribed, the side effects specified by the - * Observer will never happen. `do` therefore simply spies on existing - * execution, it does not trigger an execution to happen like `subscribe` does. - * - * @example Map every click to the clientX position of that click, while also logging the click event - * var clicks = Rx.Observable.fromEvent(document, 'click'); - * var positions = clicks - * .do(ev => console.log(ev)) - * .map(ev => ev.clientX); - * positions.subscribe(x => console.log(x)); - * - * @see {@link map} - * @see {@link subscribe} - * - * @param {Observer|function} [nextOrObserver] A normal Observer object or a - * callback for `next`. - * @param {function} [error] Callback for errors in the source. - * @param {function} [complete] Callback for the completion of the source. - * @return {Observable} An Observable identical to the source, but runs the - * specified Observer or callback(s) for each item. - * @method do - * @name do - * @owner Observable - */ -function _do(nextOrObserver, error, complete) { - return this.lift(new DoOperator(nextOrObserver, error, complete)); -} -exports._do = _do; -var DoOperator = (function () { - function DoOperator(nextOrObserver, error, complete) { - this.nextOrObserver = nextOrObserver; - this.error = error; - this.complete = complete; - } - DoOperator.prototype.call = function (subscriber, source) { - return source.subscribe(new DoSubscriber(subscriber, this.nextOrObserver, this.error, this.complete)); - }; - return DoOperator; -}()); -/** - * We need this JSDoc comment for affecting ESDoc. - * @ignore - * @extends {Ignored} - */ -var DoSubscriber = (function (_super) { - __extends(DoSubscriber, _super); - function DoSubscriber(destination, nextOrObserver, error, complete) { - _super.call(this, destination); - var safeSubscriber = new Subscriber_1.Subscriber(nextOrObserver, error, complete); - safeSubscriber.syncErrorThrowable = true; - this.add(safeSubscriber); - this.safeSubscriber = safeSubscriber; - } - DoSubscriber.prototype._next = function (value) { - var safeSubscriber = this.safeSubscriber; - safeSubscriber.next(value); - if (safeSubscriber.syncErrorThrown) { - this.destination.error(safeSubscriber.syncErrorValue); - } - else { - this.destination.next(value); - } - }; - DoSubscriber.prototype._error = function (err) { - var safeSubscriber = this.safeSubscriber; - safeSubscriber.error(err); - if (safeSubscriber.syncErrorThrown) { - this.destination.error(safeSubscriber.syncErrorValue); - } - else { - this.destination.error(err); - } - }; - DoSubscriber.prototype._complete = function () { - var safeSubscriber = this.safeSubscriber; - safeSubscriber.complete(); - if (safeSubscriber.syncErrorThrown) { - this.destination.error(safeSubscriber.syncErrorValue); - } - else { - this.destination.complete(); - } - }; - return DoSubscriber; -}(Subscriber_1.Subscriber)); -//# sourceMappingURL=do.js.map + return value !== null ? + new PropertyValuePart(unary !== null ? unary + value : value, line, col) : + null; -/***/ }), -/* 300 */ -/***/ (function(module, exports, __webpack_require__) { + }, -"use strict"; + _function: function(){ + + /* + * function + * : FUNCTION S* expr ')' S* + * ; + */ + + var tokenStream = this._tokenStream, + functionText = null, + expr = null, + lt; + + if (tokenStream.match(Tokens.FUNCTION)){ + functionText = tokenStream.token().value; + this._readWhitespace(); + expr = this._expr(true); + functionText += expr; + + //START: Horrible hack in case it's an IE filter + if (this.options.ieFilters && tokenStream.peek() === Tokens.EQUALS){ + do { + + if (this._readWhitespace()){ + functionText += tokenStream.token().value; + } + + //might be second time in the loop + if (tokenStream.LA(0) === Tokens.COMMA){ + functionText += tokenStream.token().value; + } + + tokenStream.match(Tokens.IDENT); + functionText += tokenStream.token().value; + + tokenStream.match(Tokens.EQUALS); + functionText += tokenStream.token().value; + + //functionText += this._term(); + lt = tokenStream.peek(); + while(lt !== Tokens.COMMA && lt !== Tokens.S && lt !== Tokens.RPAREN){ + tokenStream.get(); + functionText += tokenStream.token().value; + lt = tokenStream.peek(); + } + } while(tokenStream.match([Tokens.COMMA, Tokens.S])); + } -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; -var Subscriber_1 = __webpack_require__(2); -var ArgumentOutOfRangeError_1 = __webpack_require__(22); -/** - * Emits the single value at the specified `index` in a sequence of emissions - * from the source Observable. - * - * Emits only the i-th value, then completes. - * - * - * - * `elementAt` returns an Observable that emits the item at the specified - * `index` in the source Observable, or a default value if that `index` is out - * of range and the `default` argument is provided. If the `default` argument is - * not given and the `index` is out of range, the output Observable will emit an - * `ArgumentOutOfRangeError` error. - * - * @example Emit only the third click event - * var clicks = Rx.Observable.fromEvent(document, 'click'); - * var result = clicks.elementAt(2); - * result.subscribe(x => console.log(x)); - * - * // Results in: - * // click 1 = nothing - * // click 2 = nothing - * // click 3 = MouseEvent object logged to console - * - * @see {@link first} - * @see {@link last} - * @see {@link skip} - * @see {@link single} - * @see {@link take} - * - * @throws {ArgumentOutOfRangeError} When using `elementAt(i)`, it delivers an - * ArgumentOutOrRangeError to the Observer's `error` callback if `i < 0` or the - * Observable has completed before emitting the i-th `next` notification. - * - * @param {number} index Is the number `i` for the i-th source emission that has - * happened since the subscription, starting from the number `0`. - * @param {T} [defaultValue] The default value returned for missing indices. - * @return {Observable} An Observable that emits a single item, if it is found. - * Otherwise, will emit the default value if given. If not, then emits an error. - * @method elementAt - * @owner Observable - */ -function elementAt(index, defaultValue) { - return this.lift(new ElementAtOperator(index, defaultValue)); -} -exports.elementAt = elementAt; -var ElementAtOperator = (function () { - function ElementAtOperator(index, defaultValue) { - this.index = index; - this.defaultValue = defaultValue; - if (index < 0) { - throw new ArgumentOutOfRangeError_1.ArgumentOutOfRangeError; - } - } - ElementAtOperator.prototype.call = function (subscriber, source) { - return source.subscribe(new ElementAtSubscriber(subscriber, this.index, this.defaultValue)); - }; - return ElementAtOperator; -}()); -/** - * We need this JSDoc comment for affecting ESDoc. - * @ignore - * @extends {Ignored} - */ -var ElementAtSubscriber = (function (_super) { - __extends(ElementAtSubscriber, _super); - function ElementAtSubscriber(destination, index, defaultValue) { - _super.call(this, destination); - this.index = index; - this.defaultValue = defaultValue; - } - ElementAtSubscriber.prototype._next = function (x) { - if (this.index-- === 0) { - this.destination.next(x); - this.destination.complete(); - } - }; - ElementAtSubscriber.prototype._complete = function () { - var destination = this.destination; - if (this.index >= 0) { - if (typeof this.defaultValue !== 'undefined') { - destination.next(this.defaultValue); - } - else { - destination.error(new ArgumentOutOfRangeError_1.ArgumentOutOfRangeError); - } - } - destination.complete(); - }; - return ElementAtSubscriber; -}(Subscriber_1.Subscriber)); -//# sourceMappingURL=elementAt.js.map + //END: Horrible Hack + + tokenStream.match(Tokens.RPAREN); + functionText += ")"; + this._readWhitespace(); + } + + return functionText; + }, + + _ie_function: function(){ + + /* (My own extension) + * ie_function + * : IE_FUNCTION S* IDENT '=' term [S* ','? IDENT '=' term]+ ')' S* + * ; + */ + + var tokenStream = this._tokenStream, + functionText = null, + lt; + + //IE function can begin like a regular function, too + if (tokenStream.match([Tokens.IE_FUNCTION, Tokens.FUNCTION])){ + functionText = tokenStream.token().value; + + do { + + if (this._readWhitespace()){ + functionText += tokenStream.token().value; + } + + //might be second time in the loop + if (tokenStream.LA(0) === Tokens.COMMA){ + functionText += tokenStream.token().value; + } + + tokenStream.match(Tokens.IDENT); + functionText += tokenStream.token().value; + + tokenStream.match(Tokens.EQUALS); + functionText += tokenStream.token().value; + + //functionText += this._term(); + lt = tokenStream.peek(); + while(lt !== Tokens.COMMA && lt !== Tokens.S && lt !== Tokens.RPAREN){ + tokenStream.get(); + functionText += tokenStream.token().value; + lt = tokenStream.peek(); + } + } while(tokenStream.match([Tokens.COMMA, Tokens.S])); + + tokenStream.match(Tokens.RPAREN); + functionText += ")"; + this._readWhitespace(); + } + + return functionText; + }, + + _hexcolor: function(){ + /* + * There is a constraint on the color that it must + * have either 3 or 6 hex-digits (i.e., [0-9a-fA-F]) + * after the "#"; e.g., "#000" is OK, but "#abcd" is not. + * + * hexcolor + * : HASH S* + * ; + */ + + var tokenStream = this._tokenStream, + token = null, + color; + + if(tokenStream.match(Tokens.HASH)){ + + //need to do some validation here + + token = tokenStream.token(); + color = token.value; + if (!/#[a-f0-9]{3,6}/i.test(color)){ + throw new SyntaxError("Expected a hex color but found '" + color + "' at line " + token.startLine + ", col " + token.startCol + ".", token.startLine, token.startCol); + } + this._readWhitespace(); + } + + return token; + }, + + //----------------------------------------------------------------- + // Animations methods + //----------------------------------------------------------------- + + _keyframes: function(){ + + /* + * keyframes: + * : KEYFRAMES_SYM S* keyframe_name S* '{' S* keyframe_rule* '}' { + * ; + */ + var tokenStream = this._tokenStream, + token, + tt, + name, + prefix = ""; + + tokenStream.mustMatch(Tokens.KEYFRAMES_SYM); + token = tokenStream.token(); + if (/^@\-([^\-]+)\-/.test(token.value)) { + prefix = RegExp.$1; + } + + this._readWhitespace(); + name = this._keyframe_name(); + + this._readWhitespace(); + tokenStream.mustMatch(Tokens.LBRACE); + + this.fire({ + type: "startkeyframes", + name: name, + prefix: prefix, + line: token.startLine, + col: token.startCol + }); + + this._readWhitespace(); + tt = tokenStream.peek(); + + //check for key + while(tt === Tokens.IDENT || tt === Tokens.PERCENTAGE) { + this._keyframe_rule(); + this._readWhitespace(); + tt = tokenStream.peek(); + } + + this.fire({ + type: "endkeyframes", + name: name, + prefix: prefix, + line: token.startLine, + col: token.startCol + }); + + this._readWhitespace(); + tokenStream.mustMatch(Tokens.RBRACE); + + }, + + _keyframe_name: function(){ + + /* + * keyframe_name: + * : IDENT + * | STRING + * ; + */ + var tokenStream = this._tokenStream; + + tokenStream.mustMatch([Tokens.IDENT, Tokens.STRING]); + return SyntaxUnit.fromToken(tokenStream.token()); + }, + + _keyframe_rule: function(){ + + /* + * keyframe_rule: + * : key_list S* + * '{' S* declaration [ ';' S* declaration ]* '}' S* + * ; + */ + var keyList = this._key_list(); + + this.fire({ + type: "startkeyframerule", + keys: keyList, + line: keyList[0].line, + col: keyList[0].col + }); + + this._readDeclarations(true); + + this.fire({ + type: "endkeyframerule", + keys: keyList, + line: keyList[0].line, + col: keyList[0].col + }); + + }, + + _key_list: function(){ + + /* + * key_list: + * : key [ S* ',' S* key]* + * ; + */ + var tokenStream = this._tokenStream, + keyList = []; + + //must be least one key + keyList.push(this._key()); + + this._readWhitespace(); + + while(tokenStream.match(Tokens.COMMA)){ + this._readWhitespace(); + keyList.push(this._key()); + this._readWhitespace(); + } -/***/ }), -/* 301 */ -/***/ (function(module, exports, __webpack_require__) { + return keyList; + }, -"use strict"; + _key: function(){ + /* + * There is a restriction that IDENT can be only "from" or "to". + * + * key + * : PERCENTAGE + * | IDENT + * ; + */ + + var tokenStream = this._tokenStream, + token; + + if (tokenStream.match(Tokens.PERCENTAGE)){ + return SyntaxUnit.fromToken(tokenStream.token()); + } else if (tokenStream.match(Tokens.IDENT)){ + token = tokenStream.token(); + + if (/from|to/i.test(token.value)){ + return SyntaxUnit.fromToken(token); + } -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; -var OuterSubscriber_1 = __webpack_require__(4); -var subscribeToResult_1 = __webpack_require__(3); -/** - * Converts a higher-order Observable into a first-order Observable by dropping - * inner Observables while the previous inner Observable has not yet completed. - * - * Flattens an Observable-of-Observables by dropping the - * next inner Observables while the current inner is still executing. - * - * - * - * `exhaust` subscribes to an Observable that emits Observables, also known as a - * higher-order Observable. Each time it observes one of these emitted inner - * Observables, the output Observable begins emitting the items emitted by that - * inner Observable. So far, it behaves like {@link mergeAll}. However, - * `exhaust` ignores every new inner Observable if the previous Observable has - * not yet completed. Once that one completes, it will accept and flatten the - * next inner Observable and repeat this process. - * - * @example Run a finite timer for each click, only if there is no currently active timer - * var clicks = Rx.Observable.fromEvent(document, 'click'); - * var higherOrder = clicks.map((ev) => Rx.Observable.interval(1000).take(5)); - * var result = higherOrder.exhaust(); - * result.subscribe(x => console.log(x)); - * - * @see {@link combineAll} - * @see {@link concatAll} - * @see {@link switch} - * @see {@link mergeAll} - * @see {@link exhaustMap} - * @see {@link zipAll} - * - * @return {Observable} An Observable that takes a source of Observables and propagates the first observable - * exclusively until it completes before subscribing to the next. - * @method exhaust - * @owner Observable - */ -function exhaust() { - return this.lift(new SwitchFirstOperator()); -} -exports.exhaust = exhaust; -var SwitchFirstOperator = (function () { - function SwitchFirstOperator() { - } - SwitchFirstOperator.prototype.call = function (subscriber, source) { - return source.subscribe(new SwitchFirstSubscriber(subscriber)); - }; - return SwitchFirstOperator; -}()); -/** - * We need this JSDoc comment for affecting ESDoc. - * @ignore - * @extends {Ignored} - */ -var SwitchFirstSubscriber = (function (_super) { - __extends(SwitchFirstSubscriber, _super); - function SwitchFirstSubscriber(destination) { - _super.call(this, destination); - this.hasCompleted = false; - this.hasSubscription = false; - } - SwitchFirstSubscriber.prototype._next = function (value) { - if (!this.hasSubscription) { - this.hasSubscription = true; - this.add(subscribeToResult_1.subscribeToResult(this, value)); - } - }; - SwitchFirstSubscriber.prototype._complete = function () { - this.hasCompleted = true; - if (!this.hasSubscription) { - this.destination.complete(); - } - }; - SwitchFirstSubscriber.prototype.notifyComplete = function (innerSub) { - this.remove(innerSub); - this.hasSubscription = false; - if (this.hasCompleted) { - this.destination.complete(); - } - }; - return SwitchFirstSubscriber; -}(OuterSubscriber_1.OuterSubscriber)); -//# sourceMappingURL=exhaust.js.map + tokenStream.unget(); + } -/***/ }), -/* 302 */ -/***/ (function(module, exports, __webpack_require__) { + //if it gets here, there wasn't a valid token, so time to explode + this._unexpectedToken(tokenStream.LT(1)); + }, -"use strict"; + //----------------------------------------------------------------- + // Helper methods + //----------------------------------------------------------------- -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; -var OuterSubscriber_1 = __webpack_require__(4); -var subscribeToResult_1 = __webpack_require__(3); -/* tslint:enable:max-line-length */ -/** - * Projects each source value to an Observable which is merged in the output - * Observable only if the previous projected Observable has completed. - * - * Maps each value to an Observable, then flattens all of - * these inner Observables using {@link exhaust}. - * - * - * - * Returns an Observable that emits items based on applying a function that you - * supply to each item emitted by the source Observable, where that function - * returns an (so-called "inner") Observable. When it projects a source value to - * an Observable, the output Observable begins emitting the items emitted by - * that projected Observable. However, `exhaustMap` ignores every new projected - * Observable if the previous projected Observable has not yet completed. Once - * that one completes, it will accept and flatten the next projected Observable - * and repeat this process. - * - * @example Run a finite timer for each click, only if there is no currently active timer - * var clicks = Rx.Observable.fromEvent(document, 'click'); - * var result = clicks.exhaustMap((ev) => Rx.Observable.interval(1000).take(5)); - * result.subscribe(x => console.log(x)); - * - * @see {@link concatMap} - * @see {@link exhaust} - * @see {@link mergeMap} - * @see {@link switchMap} - * - * @param {function(value: T, ?index: number): ObservableInput} project A function - * that, when applied to an item emitted by the source Observable, returns an - * Observable. - * @param {function(outerValue: T, innerValue: I, outerIndex: number, innerIndex: number): any} [resultSelector] - * A function to produce the value on the output Observable based on the values - * and the indices of the source (outer) emission and the inner Observable - * emission. The arguments passed to this function are: - * - `outerValue`: the value that came from the source - * - `innerValue`: the value that came from the projected Observable - * - `outerIndex`: the "index" of the value that came from the source - * - `innerIndex`: the "index" of the value from the projected Observable - * @return {Observable} An Observable containing projected Observables - * of each item of the source, ignoring projected Observables that start before - * their preceding Observable has completed. - * @method exhaustMap - * @owner Observable - */ -function exhaustMap(project, resultSelector) { - return this.lift(new SwitchFirstMapOperator(project, resultSelector)); -} -exports.exhaustMap = exhaustMap; -var SwitchFirstMapOperator = (function () { - function SwitchFirstMapOperator(project, resultSelector) { - this.project = project; - this.resultSelector = resultSelector; - } - SwitchFirstMapOperator.prototype.call = function (subscriber, source) { - return source.subscribe(new SwitchFirstMapSubscriber(subscriber, this.project, this.resultSelector)); - }; - return SwitchFirstMapOperator; -}()); -/** - * We need this JSDoc comment for affecting ESDoc. - * @ignore - * @extends {Ignored} - */ -var SwitchFirstMapSubscriber = (function (_super) { - __extends(SwitchFirstMapSubscriber, _super); - function SwitchFirstMapSubscriber(destination, project, resultSelector) { - _super.call(this, destination); - this.project = project; - this.resultSelector = resultSelector; - this.hasSubscription = false; - this.hasCompleted = false; - this.index = 0; - } - SwitchFirstMapSubscriber.prototype._next = function (value) { - if (!this.hasSubscription) { - this.tryNext(value); - } - }; - SwitchFirstMapSubscriber.prototype.tryNext = function (value) { - var index = this.index++; - var destination = this.destination; - try { - var result = this.project(value, index); - this.hasSubscription = true; - this.add(subscribeToResult_1.subscribeToResult(this, result, value, index)); - } - catch (err) { - destination.error(err); - } - }; - SwitchFirstMapSubscriber.prototype._complete = function () { - this.hasCompleted = true; - if (!this.hasSubscription) { - this.destination.complete(); - } - }; - SwitchFirstMapSubscriber.prototype.notifyNext = function (outerValue, innerValue, outerIndex, innerIndex, innerSub) { - var _a = this, resultSelector = _a.resultSelector, destination = _a.destination; - if (resultSelector) { - this.trySelectResult(outerValue, innerValue, outerIndex, innerIndex); - } - else { - destination.next(innerValue); - } - }; - SwitchFirstMapSubscriber.prototype.trySelectResult = function (outerValue, innerValue, outerIndex, innerIndex) { - var _a = this, resultSelector = _a.resultSelector, destination = _a.destination; - try { - var result = resultSelector(outerValue, innerValue, outerIndex, innerIndex); - destination.next(result); - } - catch (err) { - destination.error(err); - } - }; - SwitchFirstMapSubscriber.prototype.notifyError = function (err) { - this.destination.error(err); - }; - SwitchFirstMapSubscriber.prototype.notifyComplete = function (innerSub) { - this.remove(innerSub); - this.hasSubscription = false; - if (this.hasCompleted) { - this.destination.complete(); - } - }; - return SwitchFirstMapSubscriber; -}(OuterSubscriber_1.OuterSubscriber)); -//# sourceMappingURL=exhaustMap.js.map + /** + * Not part of CSS grammar, but useful for skipping over + * combination of white space and HTML-style comments. + * @return {void} + * @method _skipCruft + * @private + */ + _skipCruft: function(){ + while(this._tokenStream.match([Tokens.S, Tokens.CDO, Tokens.CDC])){ + //noop + } + }, -/***/ }), -/* 303 */ -/***/ (function(module, exports, __webpack_require__) { + /** + * Not part of CSS grammar, but this pattern occurs frequently + * in the official CSS grammar. Split out here to eliminate + * duplicate code. + * @param {Boolean} checkStart Indicates if the rule should check + * for the left brace at the beginning. + * @param {Boolean} readMargins Indicates if the rule should check + * for margin patterns. + * @return {void} + * @method _readDeclarations + * @private + */ + _readDeclarations: function(checkStart, readMargins){ + /* + * Reads the pattern + * S* '{' S* declaration [ ';' S* declaration ]* '}' S* + * or + * S* '{' S* [ declaration | margin ]? [ ';' S* [ declaration | margin ]? ]* '}' S* + * Note that this is how it is described in CSS3 Paged Media, but is actually incorrect. + * A semicolon is only necessary following a declaration if there's another declaration + * or margin afterwards. + */ + var tokenStream = this._tokenStream, + tt; + + + this._readWhitespace(); + + if (checkStart){ + tokenStream.mustMatch(Tokens.LBRACE); + } -"use strict"; + this._readWhitespace(); -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; -var tryCatch_1 = __webpack_require__(7); -var errorObject_1 = __webpack_require__(5); -var OuterSubscriber_1 = __webpack_require__(4); -var subscribeToResult_1 = __webpack_require__(3); -/* tslint:enable:max-line-length */ -/** - * Recursively projects each source value to an Observable which is merged in - * the output Observable. - * - * It's similar to {@link mergeMap}, but applies the - * projection function to every source value as well as every output value. - * It's recursive. - * - * - * - * Returns an Observable that emits items based on applying a function that you - * supply to each item emitted by the source Observable, where that function - * returns an Observable, and then merging those resulting Observables and - * emitting the results of this merger. *Expand* will re-emit on the output - * Observable every source value. Then, each output value is given to the - * `project` function which returns an inner Observable to be merged on the - * output Observable. Those output values resulting from the projection are also - * given to the `project` function to produce new output values. This is how - * *expand* behaves recursively. - * - * @example Start emitting the powers of two on every click, at most 10 of them - * var clicks = Rx.Observable.fromEvent(document, 'click'); - * var powersOfTwo = clicks - * .mapTo(1) - * .expand(x => Rx.Observable.of(2 * x).delay(1000)) - * .take(10); - * powersOfTwo.subscribe(x => console.log(x)); - * - * @see {@link mergeMap} - * @see {@link mergeScan} - * - * @param {function(value: T, index: number) => Observable} project A function - * that, when applied to an item emitted by the source or the output Observable, - * returns an Observable. - * @param {number} [concurrent=Number.POSITIVE_INFINITY] Maximum number of input - * Observables being subscribed to concurrently. - * @param {Scheduler} [scheduler=null] The IScheduler to use for subscribing to - * each projected inner Observable. - * @return {Observable} An Observable that emits the source values and also - * result of applying the projection function to each value emitted on the - * output Observable and and merging the results of the Observables obtained - * from this transformation. - * @method expand - * @owner Observable - */ -function expand(project, concurrent, scheduler) { - if (concurrent === void 0) { concurrent = Number.POSITIVE_INFINITY; } - if (scheduler === void 0) { scheduler = undefined; } - concurrent = (concurrent || 0) < 1 ? Number.POSITIVE_INFINITY : concurrent; - return this.lift(new ExpandOperator(project, concurrent, scheduler)); -} -exports.expand = expand; -var ExpandOperator = (function () { - function ExpandOperator(project, concurrent, scheduler) { - this.project = project; - this.concurrent = concurrent; - this.scheduler = scheduler; - } - ExpandOperator.prototype.call = function (subscriber, source) { - return source.subscribe(new ExpandSubscriber(subscriber, this.project, this.concurrent, this.scheduler)); - }; - return ExpandOperator; -}()); -exports.ExpandOperator = ExpandOperator; -/** - * We need this JSDoc comment for affecting ESDoc. - * @ignore - * @extends {Ignored} - */ -var ExpandSubscriber = (function (_super) { - __extends(ExpandSubscriber, _super); - function ExpandSubscriber(destination, project, concurrent, scheduler) { - _super.call(this, destination); - this.project = project; - this.concurrent = concurrent; - this.scheduler = scheduler; - this.index = 0; - this.active = 0; - this.hasCompleted = false; - if (concurrent < Number.POSITIVE_INFINITY) { - this.buffer = []; - } - } - ExpandSubscriber.dispatch = function (arg) { - var subscriber = arg.subscriber, result = arg.result, value = arg.value, index = arg.index; - subscriber.subscribeToProjection(result, value, index); - }; - ExpandSubscriber.prototype._next = function (value) { - var destination = this.destination; - if (destination.closed) { - this._complete(); - return; - } - var index = this.index++; - if (this.active < this.concurrent) { - destination.next(value); - var result = tryCatch_1.tryCatch(this.project)(value, index); - if (result === errorObject_1.errorObject) { - destination.error(errorObject_1.errorObject.e); - } - else if (!this.scheduler) { - this.subscribeToProjection(result, value, index); - } - else { - var state = { subscriber: this, result: result, value: value, index: index }; - this.add(this.scheduler.schedule(ExpandSubscriber.dispatch, 0, state)); - } - } - else { - this.buffer.push(value); - } - }; - ExpandSubscriber.prototype.subscribeToProjection = function (result, value, index) { - this.active++; - this.add(subscribeToResult_1.subscribeToResult(this, result, value, index)); - }; - ExpandSubscriber.prototype._complete = function () { - this.hasCompleted = true; - if (this.hasCompleted && this.active === 0) { - this.destination.complete(); - } - }; - ExpandSubscriber.prototype.notifyNext = function (outerValue, innerValue, outerIndex, innerIndex, innerSub) { - this._next(innerValue); - }; - ExpandSubscriber.prototype.notifyComplete = function (innerSub) { - var buffer = this.buffer; - this.remove(innerSub); - this.active--; - if (buffer && buffer.length > 0) { - this._next(buffer.shift()); - } - if (this.hasCompleted && this.active === 0) { - this.destination.complete(); - } - }; - return ExpandSubscriber; -}(OuterSubscriber_1.OuterSubscriber)); -exports.ExpandSubscriber = ExpandSubscriber; -//# sourceMappingURL=expand.js.map + try { -/***/ }), -/* 304 */ -/***/ (function(module, exports, __webpack_require__) { + while(true){ -"use strict"; + if (tokenStream.match(Tokens.SEMICOLON) || (readMargins && this._margin())){ + //noop + } else if (this._declaration()){ + if (!tokenStream.match(Tokens.SEMICOLON)){ + break; + } + } else { + break; + } -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; -var Subscriber_1 = __webpack_require__(2); -var Subscription_1 = __webpack_require__(9); -/** - * Returns an Observable that mirrors the source Observable, but will call a specified function when - * the source terminates on complete or error. - * @param {function} callback Function to be called when source terminates. - * @return {Observable} An Observable that mirrors the source, but will call the specified function on termination. - * @method finally - * @owner Observable - */ -function _finally(callback) { - return this.lift(new FinallyOperator(callback)); -} -exports._finally = _finally; -var FinallyOperator = (function () { - function FinallyOperator(callback) { - this.callback = callback; - } - FinallyOperator.prototype.call = function (subscriber, source) { - return source.subscribe(new FinallySubscriber(subscriber, this.callback)); - }; - return FinallyOperator; -}()); -/** - * We need this JSDoc comment for affecting ESDoc. - * @ignore - * @extends {Ignored} - */ -var FinallySubscriber = (function (_super) { - __extends(FinallySubscriber, _super); - function FinallySubscriber(destination, callback) { - _super.call(this, destination); - this.add(new Subscription_1.Subscription(callback)); - } - return FinallySubscriber; -}(Subscriber_1.Subscriber)); -//# sourceMappingURL=finally.js.map + //if ((!this._margin() && !this._declaration()) || !tokenStream.match(Tokens.SEMICOLON)){ + // break; + //} + this._readWhitespace(); + } -/***/ }), -/* 305 */ -/***/ (function(module, exports, __webpack_require__) { + tokenStream.mustMatch(Tokens.RBRACE); + this._readWhitespace(); + + } catch (ex) { + if (ex instanceof SyntaxError && !this.options.strict){ + + //fire error event + this.fire({ + type: "error", + error: ex, + message: ex.message, + line: ex.line, + col: ex.col + }); + + //see if there's another declaration + tt = tokenStream.advance([Tokens.SEMICOLON, Tokens.RBRACE]); + if (tt === Tokens.SEMICOLON){ + //if there's a semicolon, then there might be another declaration + this._readDeclarations(false, readMargins); + } else if (tt !== Tokens.RBRACE){ + //if there's a right brace, the rule is finished so don't do anything + //otherwise, rethrow the error because it wasn't handled properly + throw ex; + } -"use strict"; + } else { + //not a syntax error, rethrow it + throw ex; + } + } -var find_1 = __webpack_require__(61); -/** - * Emits only the index of the first value emitted by the source Observable that - * meets some condition. - * - * It's like {@link find}, but emits the index of the - * found value, not the value itself. - * - * - * - * `findIndex` searches for the first item in the source Observable that matches - * the specified condition embodied by the `predicate`, and returns the - * (zero-based) index of the first occurrence in the source. Unlike - * {@link first}, the `predicate` is required in `findIndex`, and does not emit - * an error if a valid value is not found. - * - * @example Emit the index of first click that happens on a DIV element - * var clicks = Rx.Observable.fromEvent(document, 'click'); - * var result = clicks.findIndex(ev => ev.target.tagName === 'DIV'); - * result.subscribe(x => console.log(x)); - * - * @see {@link filter} - * @see {@link find} - * @see {@link first} - * @see {@link take} - * - * @param {function(value: T, index: number, source: Observable): boolean} predicate - * A function called with each item to test for condition matching. - * @param {any} [thisArg] An optional argument to determine the value of `this` - * in the `predicate` function. - * @return {Observable} An Observable of the index of the first item that - * matches the condition. - * @method find - * @owner Observable - */ -function findIndex(predicate, thisArg) { - return this.lift(new find_1.FindValueOperator(predicate, this, true, thisArg)); -} -exports.findIndex = findIndex; -//# sourceMappingURL=findIndex.js.map + }, -/***/ }), -/* 306 */ -/***/ (function(module, exports, __webpack_require__) { + /** + * In some cases, you can end up with two white space tokens in a + * row. Instead of making a change in every function that looks for + * white space, this function is used to match as much white space + * as necessary. + * @method _readWhitespace + * @return {String} The white space if found, empty string if not. + * @private + */ + _readWhitespace: function(){ -"use strict"; + var tokenStream = this._tokenStream, + ws = ""; -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; -var Subscriber_1 = __webpack_require__(2); -var Subscription_1 = __webpack_require__(9); -var Observable_1 = __webpack_require__(0); -var Subject_1 = __webpack_require__(6); -var Map_1 = __webpack_require__(370); -var FastMap_1 = __webpack_require__(368); -/* tslint:enable:max-line-length */ -/** - * Groups the items emitted by an Observable according to a specified criterion, - * and emits these grouped items as `GroupedObservables`, one - * {@link GroupedObservable} per group. - * - * - * - * @example Group objects by id and return as array - * Observable.of({id: 1, name: 'aze1'}, - * {id: 2, name: 'sf2'}, - * {id: 2, name: 'dg2'}, - * {id: 1, name: 'erg1'}, - * {id: 1, name: 'df1'}, - * {id: 2, name: 'sfqfb2'}, - * {id: 3, name: 'qfs3'}, - * {id: 2, name: 'qsgqsfg2'} - * ) - * .groupBy(p => p.id) - * .flatMap( (group$) => group$.reduce((acc, cur) => [...acc, cur], [])) - * .subscribe(p => console.log(p)); - * - * // displays: - * // [ { id: 1, name: 'aze1' }, - * // { id: 1, name: 'erg1' }, - * // { id: 1, name: 'df1' } ] - * // - * // [ { id: 2, name: 'sf2' }, - * // { id: 2, name: 'dg2' }, - * // { id: 2, name: 'sfqfb2' }, - * // { id: 2, name: 'qsgqsfg2' } ] - * // - * // [ { id: 3, name: 'qfs3' } ] - * - * @example Pivot data on the id field - * Observable.of({id: 1, name: 'aze1'}, - * {id: 2, name: 'sf2'}, - * {id: 2, name: 'dg2'}, - * {id: 1, name: 'erg1'}, - * {id: 1, name: 'df1'}, - * {id: 2, name: 'sfqfb2'}, - * {id: 3, name: 'qfs1'}, - * {id: 2, name: 'qsgqsfg2'} - * ) - * .groupBy(p => p.id, p => p.name) - * .flatMap( (group$) => group$.reduce((acc, cur) => [...acc, cur], ["" + group$.key])) - * .map(arr => ({'id': parseInt(arr[0]), 'values': arr.slice(1)})) - * .subscribe(p => console.log(p)); - * - * // displays: - * // { id: 1, values: [ 'aze1', 'erg1', 'df1' ] } - * // { id: 2, values: [ 'sf2', 'dg2', 'sfqfb2', 'qsgqsfg2' ] } - * // { id: 3, values: [ 'qfs1' ] } - * - * @param {function(value: T): K} keySelector A function that extracts the key - * for each item. - * @param {function(value: T): R} [elementSelector] A function that extracts the - * return element for each item. - * @param {function(grouped: GroupedObservable): Observable} [durationSelector] - * A function that returns an Observable to determine how long each group should - * exist. - * @return {Observable>} An Observable that emits - * GroupedObservables, each of which corresponds to a unique key value and each - * of which emits those items from the source Observable that share that key - * value. - * @method groupBy - * @owner Observable - */ -function groupBy(keySelector, elementSelector, durationSelector, subjectSelector) { - return this.lift(new GroupByOperator(keySelector, elementSelector, durationSelector, subjectSelector)); -} -exports.groupBy = groupBy; -var GroupByOperator = (function () { - function GroupByOperator(keySelector, elementSelector, durationSelector, subjectSelector) { - this.keySelector = keySelector; - this.elementSelector = elementSelector; - this.durationSelector = durationSelector; - this.subjectSelector = subjectSelector; - } - GroupByOperator.prototype.call = function (subscriber, source) { - return source.subscribe(new GroupBySubscriber(subscriber, this.keySelector, this.elementSelector, this.durationSelector, this.subjectSelector)); - }; - return GroupByOperator; -}()); -/** - * We need this JSDoc comment for affecting ESDoc. - * @ignore - * @extends {Ignored} - */ -var GroupBySubscriber = (function (_super) { - __extends(GroupBySubscriber, _super); - function GroupBySubscriber(destination, keySelector, elementSelector, durationSelector, subjectSelector) { - _super.call(this, destination); - this.keySelector = keySelector; - this.elementSelector = elementSelector; - this.durationSelector = durationSelector; - this.subjectSelector = subjectSelector; - this.groups = null; - this.attemptedToUnsubscribe = false; - this.count = 0; - } - GroupBySubscriber.prototype._next = function (value) { - var key; - try { - key = this.keySelector(value); - } - catch (err) { - this.error(err); - return; - } - this._group(value, key); - }; - GroupBySubscriber.prototype._group = function (value, key) { - var groups = this.groups; - if (!groups) { - groups = this.groups = typeof key === 'string' ? new FastMap_1.FastMap() : new Map_1.Map(); - } - var group = groups.get(key); - var element; - if (this.elementSelector) { - try { - element = this.elementSelector(value); - } - catch (err) { - this.error(err); + while(tokenStream.match(Tokens.S)){ + ws += tokenStream.token().value; + } + + return ws; + }, + + + /** + * Throws an error when an unexpected token is found. + * @param {Object} token The token that was found. + * @method _unexpectedToken + * @return {void} + * @private + */ + _unexpectedToken: function(token){ + throw new SyntaxError("Unexpected token '" + token.value + "' at line " + token.startLine + ", col " + token.startCol + ".", token.startLine, token.startCol); + }, + + /** + * Helper method used for parsing subparts of a style sheet. + * @return {void} + * @method _verifyEnd + * @private + */ + _verifyEnd: function(){ + if (this._tokenStream.LA(1) !== Tokens.EOF){ + this._unexpectedToken(this._tokenStream.LT(1)); + } + }, + + //----------------------------------------------------------------- + // Validation methods + //----------------------------------------------------------------- + _validateProperty: function(property, value){ + Validation.validate(property, value); + }, + + //----------------------------------------------------------------- + // Parsing methods + //----------------------------------------------------------------- + + parse: function(input){ + this._tokenStream = new TokenStream(input, Tokens); + this._stylesheet(); + }, + + parseStyleSheet: function(input){ + //just passthrough + return this.parse(input); + }, + + parseMediaQuery: function(input){ + this._tokenStream = new TokenStream(input, Tokens); + var result = this._media_query(); + + //if there's anything more, then it's an invalid selector + this._verifyEnd(); + + //otherwise return result + return result; + }, + + /** + * Parses a property value (everything after the semicolon). + * @return {parserlib.css.PropertyValue} The property value. + * @throws parserlib.util.SyntaxError If an unexpected token is found. + * @method parserPropertyValue + */ + parsePropertyValue: function(input){ + + this._tokenStream = new TokenStream(input, Tokens); + this._readWhitespace(); + + var result = this._expr(); + + //okay to have a trailing white space + this._readWhitespace(); + + //if there's anything more, then it's an invalid selector + this._verifyEnd(); + + //otherwise return result + return result; + }, + + /** + * Parses a complete CSS rule, including selectors and + * properties. + * @param {String} input The text to parser. + * @return {Boolean} True if the parse completed successfully, false if not. + * @method parseRule + */ + parseRule: function(input){ + this._tokenStream = new TokenStream(input, Tokens); + + //skip any leading white space + this._readWhitespace(); + + var result = this._ruleset(); + + //skip any trailing white space + this._readWhitespace(); + + //if there's anything more, then it's an invalid selector + this._verifyEnd(); + + //otherwise return result + return result; + }, + + /** + * Parses a single CSS selector (no comma) + * @param {String} input The text to parse as a CSS selector. + * @return {Selector} An object representing the selector. + * @throws parserlib.util.SyntaxError If an unexpected token is found. + * @method parseSelector + */ + parseSelector: function(input){ + + this._tokenStream = new TokenStream(input, Tokens); + + //skip any leading white space + this._readWhitespace(); + + var result = this._selector(); + + //skip any trailing white space + this._readWhitespace(); + + //if there's anything more, then it's an invalid selector + this._verifyEnd(); + + //otherwise return result + return result; + }, + + /** + * Parses an HTML style attribute: a set of CSS declarations + * separated by semicolons. + * @param {String} input The text to parse as a style attribute + * @return {void} + * @method parseStyleAttribute + */ + parseStyleAttribute: function(input){ + input += "}"; // for error recovery in _readDeclarations() + this._tokenStream = new TokenStream(input, Tokens); + this._readDeclarations(); } + }; + + //copy over onto prototype + for (prop in additions){ + if (Object.prototype.hasOwnProperty.call(additions, prop)){ + proto[prop] = additions[prop]; } - else { - element = value; - } - if (!group) { - group = this.subjectSelector ? this.subjectSelector() : new Subject_1.Subject(); - groups.set(key, group); - var groupedObservable = new GroupedObservable(key, group, this); - this.destination.next(groupedObservable); - if (this.durationSelector) { - var duration = void 0; - try { - duration = this.durationSelector(new GroupedObservable(key, group)); - } - catch (err) { - this.error(err); - return; + } + + return proto; +}(); + + +/* +nth + : S* [ ['-'|'+']? INTEGER? {N} [ S* ['-'|'+'] S* INTEGER ]? | + ['-'|'+']? INTEGER | {O}{D}{D} | {E}{V}{E}{N} ] S* + ; +*/ +var Properties = { + __proto__: null, + + //A + "align-items" : "flex-start | flex-end | center | baseline | stretch", + "align-content" : "flex-start | flex-end | center | space-between | space-around | stretch", + "align-self" : "auto | flex-start | flex-end | center | baseline | stretch", + "-webkit-align-items" : "flex-start | flex-end | center | baseline | stretch", + "-webkit-align-content" : "flex-start | flex-end | center | space-between | space-around | stretch", + "-webkit-align-self" : "auto | flex-start | flex-end | center | baseline | stretch", + "alignment-adjust" : "auto | baseline | before-edge | text-before-edge | middle | central | after-edge | text-after-edge | ideographic | alphabetic | hanging | mathematical | | ", + "alignment-baseline" : "baseline | use-script | before-edge | text-before-edge | after-edge | text-after-edge | central | middle | ideographic | alphabetic | hanging | mathematical", + "animation" : 1, + "animation-delay" : { multi: "", comma: true }, + "animation-direction" : { multi: "normal | alternate", comma: true }, + "animation-duration" : { multi: "", comma: true }, + "animation-fill-mode" : { multi: "none | forwards | backwards | both", comma: true }, + "animation-iteration-count" : { multi: " | infinite", comma: true }, + "animation-name" : { multi: "none | ", comma: true }, + "animation-play-state" : { multi: "running | paused", comma: true }, + "animation-timing-function" : 1, + + //vendor prefixed + "-moz-animation-delay" : { multi: "", comma: true }, + "-moz-animation-direction" : { multi: "normal | alternate", comma: true }, + "-moz-animation-duration" : { multi: "", comma: true }, + "-moz-animation-iteration-count" : { multi: " | infinite", comma: true }, + "-moz-animation-name" : { multi: "none | ", comma: true }, + "-moz-animation-play-state" : { multi: "running | paused", comma: true }, + + "-ms-animation-delay" : { multi: "", comma: true }, + "-ms-animation-direction" : { multi: "normal | alternate", comma: true }, + "-ms-animation-duration" : { multi: "", comma: true }, + "-ms-animation-iteration-count" : { multi: " | infinite", comma: true }, + "-ms-animation-name" : { multi: "none | ", comma: true }, + "-ms-animation-play-state" : { multi: "running | paused", comma: true }, + + "-webkit-animation-delay" : { multi: "", comma: true }, + "-webkit-animation-direction" : { multi: "normal | alternate", comma: true }, + "-webkit-animation-duration" : { multi: "", comma: true }, + "-webkit-animation-fill-mode" : { multi: "none | forwards | backwards | both", comma: true }, + "-webkit-animation-iteration-count" : { multi: " | infinite", comma: true }, + "-webkit-animation-name" : { multi: "none | ", comma: true }, + "-webkit-animation-play-state" : { multi: "running | paused", comma: true }, + + "-o-animation-delay" : { multi: "", comma: true }, + "-o-animation-direction" : { multi: "normal | alternate", comma: true }, + "-o-animation-duration" : { multi: "", comma: true }, + "-o-animation-iteration-count" : { multi: " | infinite", comma: true }, + "-o-animation-name" : { multi: "none | ", comma: true }, + "-o-animation-play-state" : { multi: "running | paused", comma: true }, + + "appearance" : "icon | window | desktop | workspace | document | tooltip | dialog | button | push-button | hyperlink | radio | radio-button | checkbox | menu-item | tab | menu | menubar | pull-down-menu | pop-up-menu | list-menu | radio-group | checkbox-group | outline-tree | range | field | combo-box | signature | password | normal | none | inherit", + "azimuth" : function (expression) { + var simple = " | leftwards | rightwards | inherit", + direction = "left-side | far-left | left | center-left | center | center-right | right | far-right | right-side", + behind = false, + valid = false, + part; + + if (!ValidationTypes.isAny(expression, simple)) { + if (ValidationTypes.isAny(expression, "behind")) { + behind = true; + valid = true; + } + + if (ValidationTypes.isAny(expression, direction)) { + valid = true; + if (!behind) { + ValidationTypes.isAny(expression, "behind"); } - this.add(duration.subscribe(new GroupDurationSubscriber(key, group, this))); } } - if (!group.closed) { - group.next(element); + + if (expression.hasNext()) { + part = expression.next(); + if (valid) { + throw new ValidationError("Expected end of value but found '" + part + "'.", part.line, part.col); + } else { + throw new ValidationError("Expected (<'azimuth'>) but found '" + part + "'.", part.line, part.col); + } } - }; - GroupBySubscriber.prototype._error = function (err) { - var groups = this.groups; - if (groups) { - groups.forEach(function (group, key) { - group.error(err); - }); - groups.clear(); + }, + + //B + "backface-visibility" : "visible | hidden", + "background" : 1, + "background-attachment" : { multi: "", comma: true }, + "background-clip" : { multi: "", comma: true }, + "background-color" : " | inherit", + "background-image" : { multi: "", comma: true }, + "background-origin" : { multi: "", comma: true }, + "background-position" : { multi: "", comma: true }, + "background-repeat" : { multi: "" }, + "background-size" : { multi: "", comma: true }, + "baseline-shift" : "baseline | sub | super | | ", + "behavior" : 1, + "binding" : 1, + "bleed" : "", + "bookmark-label" : " | | ", + "bookmark-level" : "none | ", + "bookmark-state" : "open | closed", + "bookmark-target" : "none | | ", + "border" : " || || ", + "border-bottom" : " || || ", + "border-bottom-color" : " | inherit", + "border-bottom-left-radius" : "", + "border-bottom-right-radius" : "", + "border-bottom-style" : "", + "border-bottom-width" : "", + "border-collapse" : "collapse | separate | inherit", + "border-color" : { multi: " | inherit", max: 4 }, + "border-image" : 1, + "border-image-outset" : { multi: " | ", max: 4 }, + "border-image-repeat" : { multi: "stretch | repeat | round", max: 2 }, + "border-image-slice" : function(expression) { + + var valid = false, + numeric = " | ", + fill = false, + count = 0, + max = 4, + part; + + if (ValidationTypes.isAny(expression, "fill")) { + fill = true; + valid = true; + } + + while (expression.hasNext() && count < max) { + valid = ValidationTypes.isAny(expression, numeric); + if (!valid) { + break; + } + count++; } - this.destination.error(err); - }; - GroupBySubscriber.prototype._complete = function () { - var groups = this.groups; - if (groups) { - groups.forEach(function (group, key) { - group.complete(); - }); - groups.clear(); + + + if (!fill) { + ValidationTypes.isAny(expression, "fill"); + } else { + valid = true; } - this.destination.complete(); - }; - GroupBySubscriber.prototype.removeGroup = function (key) { - this.groups.delete(key); - }; - GroupBySubscriber.prototype.unsubscribe = function () { - if (!this.closed) { - this.attemptedToUnsubscribe = true; - if (this.count === 0) { - _super.prototype.unsubscribe.call(this); + + if (expression.hasNext()) { + part = expression.next(); + if (valid) { + throw new ValidationError("Expected end of value but found '" + part + "'.", part.line, part.col); + } else { + throw new ValidationError("Expected ([ | ]{1,4} && fill?) but found '" + part + "'.", part.line, part.col); } } - }; - return GroupBySubscriber; -}(Subscriber_1.Subscriber)); -/** - * We need this JSDoc comment for affecting ESDoc. - * @ignore - * @extends {Ignored} - */ -var GroupDurationSubscriber = (function (_super) { - __extends(GroupDurationSubscriber, _super); - function GroupDurationSubscriber(key, group, parent) { - _super.call(this, group); - this.key = key; - this.group = group; - this.parent = parent; - } - GroupDurationSubscriber.prototype._next = function (value) { - this.complete(); - }; - GroupDurationSubscriber.prototype._unsubscribe = function () { - var _a = this, parent = _a.parent, key = _a.key; - this.key = this.parent = null; - if (parent) { - parent.removeGroup(key); + }, + "border-image-source" : " | none", + "border-image-width" : { multi: " | | | auto", max: 4 }, + "border-left" : " || || ", + "border-left-color" : " | inherit", + "border-left-style" : "", + "border-left-width" : "", + "border-radius" : function(expression) { + + var valid = false, + simple = " | | inherit", + slash = false, + count = 0, + max = 8, + part; + + while (expression.hasNext() && count < max) { + valid = ValidationTypes.isAny(expression, simple); + if (!valid) { + + if (String(expression.peek()) === "/" && count > 0 && !slash) { + slash = true; + max = count + 5; + expression.next(); + } else { + break; + } + } + count++; } - }; - return GroupDurationSubscriber; -}(Subscriber_1.Subscriber)); -/** - * An Observable representing values belonging to the same group represented by - * a common key. The values emitted by a GroupedObservable come from the source - * Observable. The common key is available as the field `key` on a - * GroupedObservable instance. - * - * @class GroupedObservable - */ -var GroupedObservable = (function (_super) { - __extends(GroupedObservable, _super); - function GroupedObservable(key, groupSubject, refCountSubscription) { - _super.call(this); - this.key = key; - this.groupSubject = groupSubject; - this.refCountSubscription = refCountSubscription; - } - GroupedObservable.prototype._subscribe = function (subscriber) { - var subscription = new Subscription_1.Subscription(); - var _a = this, refCountSubscription = _a.refCountSubscription, groupSubject = _a.groupSubject; - if (refCountSubscription && !refCountSubscription.closed) { - subscription.add(new InnerRefCountSubscription(refCountSubscription)); + + if (expression.hasNext()) { + part = expression.next(); + if (valid) { + throw new ValidationError("Expected end of value but found '" + part + "'.", part.line, part.col); + } else { + throw new ValidationError("Expected (<'border-radius'>) but found '" + part + "'.", part.line, part.col); + } } - subscription.add(groupSubject.subscribe(subscriber)); - return subscription; - }; - return GroupedObservable; -}(Observable_1.Observable)); -exports.GroupedObservable = GroupedObservable; -/** - * We need this JSDoc comment for affecting ESDoc. - * @ignore - * @extends {Ignored} - */ -var InnerRefCountSubscription = (function (_super) { - __extends(InnerRefCountSubscription, _super); - function InnerRefCountSubscription(parent) { - _super.call(this); - this.parent = parent; - parent.count++; - } - InnerRefCountSubscription.prototype.unsubscribe = function () { - var parent = this.parent; - if (!parent.closed && !this.closed) { - _super.prototype.unsubscribe.call(this); - parent.count -= 1; - if (parent.count === 0 && parent.attemptedToUnsubscribe) { - parent.unsubscribe(); + }, + "border-right" : "
>>0?1:0),b=b+c,j=j+u+(b>>>0>>0?1:0),b=b+t,j=j+q+(b>>>0>>0?1:0);s.high=j;s.low=b}var W=l&R^~l&S,t=h&C^~h&D,s=k&z^k&A^z&A,T=g&x^g&y^x&y,p=(k>>>28|g<<4)^(k<<30|g>>>2)^(k<<25|g>>>7),u=(g>>>28|k<<4)^(g<<30|k>>>2)^(g<<25|k>>>7),c=ea[m],fa=c.high,da=c.low,c=E+((h>>>14|l<<18)^(h>>>18|l<<14)^(h<<23|l>>>9)),q=V+((l>>>14|h<<18)^(l>>>18|h<<14)^(l<<23|h>>>9))+(c>>>0>>0?1: -0),c=c+t,q=q+W+(c>>>0>>0?1:0),c=c+da,q=q+fa+(c>>>0>>0?1:0),c=c+b,q=q+j+(c>>>0>>0?1:0),b=u+T,s=p+s+(b>>>0>>0?1:0),V=S,E=D,S=R,D=C,R=l,C=h,h=B+c|0,l=U+q+(h>>>0>>0?1:0)|0,U=A,B=y,A=z,y=x,z=k,x=g,g=c+b|0,k=q+s+(g>>>0>>0?1:0)|0}J=F.low=J+g;F.high=w+k+(J>>>0>>0?1:0);K=e.low=K+x;e.high=X+z+(K>>>0>>0?1:0);L=n.low=L+y;n.high=Y+A+(L>>>0>>0?1:0);M=r.low=M+B;r.high=Z+U+(M>>>0>>0?1:0);N=G.low=N+h;G.high=$+l+(N>>>0>>0?1:0);O=H.low=O+C;H.high=aa+R+(O>>>0>>0?1:0);P=I.low=P+D; -I.high=ba+S+(P>>>0>>0?1:0);Q=f.low=Q+E;f.high=ca+V+(Q>>>0>>0?1:0)},_doFinalize:function(){var a=this._data,d=a.words,f=8*this._nDataBytes,e=8*a.sigBytes;d[e>>>5]|=128<<24-e%32;d[(e+128>>>10<<5)+30]=Math.floor(f/4294967296);d[(e+128>>>10<<5)+31]=f;a.sigBytes=4*d.length;this._process();return this._hash.toX32()},clone:function(){var a=r.clone.call(this);a._hash=this._hash.clone();return a},blockSize:32});n.SHA512=r._createHelper(e);n.HmacSHA512=r._createHmacHelper(e)})(); - -/* -CryptoJS v3.1.2 sha384-min.js -code.google.com/p/crypto-js -(c) 2009-2013 by Jeff Mott. All rights reserved. -code.google.com/p/crypto-js/wiki/License -*/ -(function(){var c=CryptoJS,a=c.x64,b=a.Word,e=a.WordArray,a=c.algo,d=a.SHA512,a=a.SHA384=d.extend({_doReset:function(){this._hash=new e.init([new b.init(3418070365,3238371032),new b.init(1654270250,914150663),new b.init(2438529370,812702999),new b.init(355462360,4144912697),new b.init(1731405415,4290775857),new b.init(2394180231,1750603025),new b.init(3675008525,1694076839),new b.init(1203062813,3204075428)])},_doFinalize:function(){var a=d._doFinalize.call(this);a.sigBytes-=16;return a}});c.SHA384= -d._createHelper(a);c.HmacSHA384=d._createHmacHelper(a)})(); - -/* -CryptoJS v3.1.2 ripemd160-min.js -code.google.com/p/crypto-js -(c) 2009-2013 by Jeff Mott. All rights reserved. -code.google.com/p/crypto-js/wiki/License -*/ -/* - -(c) 2012 by Cedric Mesnil. All rights reserved. - -Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - - - Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - - 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 THE COPYRIGHT HOLDERS AND CONTRIBUTORS "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 THE COPYRIGHT HOLDER 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. -*/ -(function(){var q=CryptoJS,d=q.lib,n=d.WordArray,p=d.Hasher,d=q.algo,x=n.create([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13]),y=n.create([5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11]),z=n.create([11,14,15,12, -5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6]),A=n.create([8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11]),B=n.create([0,1518500249,1859775393,2400959708,2840853838]),C=n.create([1352829926,1548603684,1836072691, -2053994217,0]),d=d.RIPEMD160=p.extend({_doReset:function(){this._hash=n.create([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(e,v){for(var b=0;16>b;b++){var c=v+b,f=e[c];e[c]=(f<<8|f>>>24)&16711935|(f<<24|f>>>8)&4278255360}var c=this._hash.words,f=B.words,d=C.words,n=x.words,q=y.words,p=z.words,w=A.words,t,g,h,j,r,u,k,l,m,s;u=t=c[0];k=g=c[1];l=h=c[2];m=j=c[3];s=r=c[4];for(var a,b=0;80>b;b+=1)a=t+e[v+n[b]]|0,a=16>b?a+((g^h^j)+f[0]):32>b?a+((g&h|~g&j)+f[1]):48>b? -a+(((g|~h)^j)+f[2]):64>b?a+((g&j|h&~j)+f[3]):a+((g^(h|~j))+f[4]),a|=0,a=a<>>32-p[b],a=a+r|0,t=r,r=j,j=h<<10|h>>>22,h=g,g=a,a=u+e[v+q[b]]|0,a=16>b?a+((k^(l|~m))+d[0]):32>b?a+((k&m|l&~m)+d[1]):48>b?a+(((k|~l)^m)+d[2]):64>b?a+((k&l|~k&m)+d[3]):a+((k^l^m)+d[4]),a|=0,a=a<>>32-w[b],a=a+s|0,u=s,s=m,m=l<<10|l>>>22,l=k,k=a;a=c[1]+h+m|0;c[1]=c[2]+j+s|0;c[2]=c[3]+r+u|0;c[3]=c[4]+t+k|0;c[4]=c[0]+g+l|0;c[0]=a},_doFinalize:function(){var e=this._data,d=e.words,b=8*this._nDataBytes,c=8*e.sigBytes; -d[c>>>5]|=128<<24-c%32;d[(c+64>>>9<<4)+14]=(b<<8|b>>>24)&16711935|(b<<24|b>>>8)&4278255360;e.sigBytes=4*(d.length+1);this._process();e=this._hash;d=e.words;for(b=0;5>b;b++)c=d[b],d[b]=(c<<8|c>>>24)&16711935|(c<<24|c>>>8)&4278255360;return e},clone:function(){var d=p.clone.call(this);d._hash=this._hash.clone();return d}});q.RIPEMD160=p._createHelper(d);q.HmacRIPEMD160=p._createHmacHelper(d)})(Math); - -/* -CryptoJS v3.1.2 hmac.js -code.google.com/p/crypto-js -(c) 2009-2013 by Jeff Mott. All rights reserved. -code.google.com/p/crypto-js/wiki/License -*/ -(function(){var c=CryptoJS,k=c.enc.Utf8;c.algo.HMAC=c.lib.Base.extend({init:function(a,b){a=this._hasher=new a.init;"string"==typeof b&&(b=k.parse(b));var c=a.blockSize,e=4*c;b.sigBytes>e&&(b=a.finalize(b));b.clamp();for(var f=this._oKey=b.clone(),g=this._iKey=b.clone(),h=f.words,j=g.words,d=0;d>6)+b64map.charAt(e&63)}if(b+1==d.length){e=parseInt(d.substring(b,b+1),16);a+=b64map.charAt(e<<2)}else{if(b+2==d.length){e=parseInt(d.substring(b,b+2),16);a+=b64map.charAt(e>>2)+b64map.charAt((e&3)<<4)}}if(b64pad){while((a.length&3)>0){a+=b64pad}}return a}function b64tohex(f){var d="";var e;var b=0;var c;var a;for(e=0;e>2);c=a&3;b=1}else{if(b==1){d+=int2char((c<<2)|(a>>4));c=a&15;b=2}else{if(b==2){d+=int2char(c);d+=int2char(a>>2);c=a&3;b=3}else{d+=int2char((c<<2)|(a>>4));d+=int2char(a&15);b=0}}}}if(b==1){d+=int2char(c<<2)}return d}function b64toBA(e){var d=b64tohex(e);var c;var b=new Array();for(c=0;2*c=0){var d=a*this[f++]+b[e]+h;h=Math.floor(d/67108864);b[e++]=d&67108863}return h}function am2(f,q,r,e,o,a){var k=q&32767,p=q>>15;while(--a>=0){var d=this[f]&32767;var g=this[f++]>>15;var b=p*d+g*k;d=k*d+((b&32767)<<15)+r[e]+(o&1073741823);o=(d>>>30)+(b>>>15)+p*g+(o>>>30);r[e++]=d&1073741823}return o}function am3(f,q,r,e,o,a){var k=q&16383,p=q>>14;while(--a>=0){var d=this[f]&16383;var g=this[f++]>>14;var b=p*d+g*k;d=k*d+((b&16383)<<14)+r[e]+o;o=(d>>28)+(b>>14)+p*g;r[e++]=d&268435455}return o}if(j_lm&&(navigator.appName=="Microsoft Internet Explorer")){BigInteger.prototype.am=am2;dbits=30}else{if(j_lm&&(navigator.appName!="Netscape")){BigInteger.prototype.am=am1;dbits=26}else{BigInteger.prototype.am=am3;dbits=28}}BigInteger.prototype.DB=dbits;BigInteger.prototype.DM=((1<=0;--a){b[a]=this[a]}b.t=this.t;b.s=this.s}function bnpFromInt(a){this.t=1;this.s=(a<0)?-1:0;if(a>0){this[0]=a}else{if(a<-1){this[0]=a+this.DV}else{this.t=0}}}function nbv(a){var b=nbi();b.fromInt(a);return b}function bnpFromString(h,c){var e;if(c==16){e=4}else{if(c==8){e=3}else{if(c==256){e=8}else{if(c==2){e=1}else{if(c==32){e=5}else{if(c==4){e=2}else{this.fromRadix(h,c);return}}}}}}this.t=0;this.s=0;var g=h.length,d=false,f=0;while(--g>=0){var a=(e==8)?h[g]&255:intAt(h,g);if(a<0){if(h.charAt(g)=="-"){d=true}continue}d=false;if(f==0){this[this.t++]=a}else{if(f+e>this.DB){this[this.t-1]|=(a&((1<<(this.DB-f))-1))<>(this.DB-f))}else{this[this.t-1]|=a<=this.DB){f-=this.DB}}if(e==8&&(h[0]&128)!=0){this.s=-1;if(f>0){this[this.t-1]|=((1<<(this.DB-f))-1)<0&&this[this.t-1]==a){--this.t}}function bnToString(c){if(this.s<0){return"-"+this.negate().toString(c)}var e;if(c==16){e=4}else{if(c==8){e=3}else{if(c==2){e=1}else{if(c==32){e=5}else{if(c==4){e=2}else{return this.toRadix(c)}}}}}var g=(1<0){if(j>j)>0){a=true;h=int2char(l)}while(f>=0){if(j>(j+=this.DB-e)}else{l=(this[f]>>(j-=e))&g;if(j<=0){j+=this.DB;--f}}if(l>0){a=true}if(a){h+=int2char(l)}}}return a?h:"0"}function bnNegate(){var a=nbi();BigInteger.ZERO.subTo(this,a);return a}function bnAbs(){return(this.s<0)?this.negate():this}function bnCompareTo(b){var d=this.s-b.s;if(d!=0){return d}var c=this.t;d=c-b.t;if(d!=0){return(this.s<0)?-d:d}while(--c>=0){if((d=this[c]-b[c])!=0){return d}}return 0}function nbits(a){var c=1,b;if((b=a>>>16)!=0){a=b;c+=16}if((b=a>>8)!=0){a=b;c+=8}if((b=a>>4)!=0){a=b;c+=4}if((b=a>>2)!=0){a=b;c+=2}if((b=a>>1)!=0){a=b;c+=1}return c}function bnBitLength(){if(this.t<=0){return 0}return this.DB*(this.t-1)+nbits(this[this.t-1]^(this.s&this.DM))}function bnpDLShiftTo(c,b){var a;for(a=this.t-1;a>=0;--a){b[a+c]=this[a]}for(a=c-1;a>=0;--a){b[a]=0}b.t=this.t+c;b.s=this.s}function bnpDRShiftTo(c,b){for(var a=c;a=0;--d){e[d+f+1]=(this[d]>>a)|h;h=(this[d]&g)<=0;--d){e[d]=0}e[f]=h;e.t=this.t+f+1;e.s=this.s;e.clamp()}function bnpRShiftTo(g,d){d.s=this.s;var e=Math.floor(g/this.DB);if(e>=this.t){d.t=0;return}var b=g%this.DB;var a=this.DB-b;var f=(1<>b;for(var c=e+1;c>b}if(b>0){d[this.t-e-1]|=(this.s&f)<>=this.DB}if(d.t>=this.DB}g+=this.s}else{g+=this.s;while(e>=this.DB}g-=d.s}f.s=(g<0)?-1:0;if(g<-1){f[e++]=this.DV+g}else{if(g>0){f[e++]=g}}f.t=e;f.clamp()}function bnpMultiplyTo(c,e){var b=this.abs(),f=c.abs();var d=b.t;e.t=d+f.t;while(--d>=0){e[d]=0}for(d=0;d=0){d[b]=0}for(b=0;b=a.DV){d[b+a.t]-=a.DV;d[b+a.t+1]=1}}if(d.t>0){d[d.t-1]+=a.am(b,a[b],d,2*b,0,1)}d.s=0;d.clamp()}function bnpDivRemTo(n,h,g){var w=n.abs();if(w.t<=0){return}var k=this.abs();if(k.t0){w.lShiftTo(v,d);k.lShiftTo(v,g)}else{w.copyTo(d);k.copyTo(g)}var p=d.t;var b=d[p-1];if(b==0){return}var o=b*(1<1)?d[p-2]>>this.F2:0);var A=this.FV/o,z=(1<=0){g[g.t++]=1;g.subTo(f,g)}BigInteger.ONE.dlShiftTo(p,f);f.subTo(d,d);while(d.t=0){var c=(g[--u]==b)?this.DM:Math.floor(g[u]*A+(g[u-1]+x)*z);if((g[u]+=d.am(0,c,g,s,0,p))0){g.rShiftTo(v,g)}if(a<0){BigInteger.ZERO.subTo(g,g)}}function bnMod(b){var c=nbi();this.abs().divRemTo(b,null,c);if(this.s<0&&c.compareTo(BigInteger.ZERO)>0){b.subTo(c,c)}return c}function Classic(a){this.m=a}function cConvert(a){if(a.s<0||a.compareTo(this.m)>=0){return a.mod(this.m)}else{return a}}function cRevert(a){return a}function cReduce(a){a.divRemTo(this.m,null,a)}function cMulTo(a,c,b){a.multiplyTo(c,b);this.reduce(b)}function cSqrTo(a,b){a.squareTo(b);this.reduce(b)}Classic.prototype.convert=cConvert;Classic.prototype.revert=cRevert;Classic.prototype.reduce=cReduce;Classic.prototype.mulTo=cMulTo;Classic.prototype.sqrTo=cSqrTo;function bnpInvDigit(){if(this.t<1){return 0}var a=this[0];if((a&1)==0){return 0}var b=a&3;b=(b*(2-(a&15)*b))&15;b=(b*(2-(a&255)*b))&255;b=(b*(2-(((a&65535)*b)&65535)))&65535;b=(b*(2-a*b%this.DV))%this.DV;return(b>0)?this.DV-b:-b}function Montgomery(a){this.m=a;this.mp=a.invDigit();this.mpl=this.mp&32767;this.mph=this.mp>>15;this.um=(1<<(a.DB-15))-1;this.mt2=2*a.t}function montConvert(a){var b=nbi();a.abs().dlShiftTo(this.m.t,b);b.divRemTo(this.m,null,b);if(a.s<0&&b.compareTo(BigInteger.ZERO)>0){this.m.subTo(b,b)}return b}function montRevert(a){var b=nbi();a.copyTo(b);this.reduce(b);return b}function montReduce(a){while(a.t<=this.mt2){a[a.t++]=0}for(var c=0;c>15)*this.mpl)&this.um)<<15))&a.DM;b=c+this.m.t;a[b]+=this.m.am(0,d,a,c,0,this.m.t);while(a[b]>=a.DV){a[b]-=a.DV;a[++b]++}}a.clamp();a.drShiftTo(this.m.t,a);if(a.compareTo(this.m)>=0){a.subTo(this.m,a)}}function montSqrTo(a,b){a.squareTo(b);this.reduce(b)}function montMulTo(a,c,b){a.multiplyTo(c,b);this.reduce(b)}Montgomery.prototype.convert=montConvert;Montgomery.prototype.revert=montRevert;Montgomery.prototype.reduce=montReduce;Montgomery.prototype.mulTo=montMulTo;Montgomery.prototype.sqrTo=montSqrTo;function bnpIsEven(){return((this.t>0)?(this[0]&1):this.s)==0}function bnpExp(h,j){if(h>4294967295||h<1){return BigInteger.ONE}var f=nbi(),a=nbi(),d=j.convert(this),c=nbits(h)-1;d.copyTo(f);while(--c>=0){j.sqrTo(f,a);if((h&(1<0){j.mulTo(a,d,f)}else{var b=f;f=a;a=b}}return j.revert(f)}function bnModPowInt(b,a){var c;if(b<256||a.isEven()){c=new Classic(a)}else{c=new Montgomery(a)}return this.exp(b,c)}BigInteger.prototype.copyTo=bnpCopyTo;BigInteger.prototype.fromInt=bnpFromInt;BigInteger.prototype.fromString=bnpFromString;BigInteger.prototype.clamp=bnpClamp;BigInteger.prototype.dlShiftTo=bnpDLShiftTo;BigInteger.prototype.drShiftTo=bnpDRShiftTo;BigInteger.prototype.lShiftTo=bnpLShiftTo;BigInteger.prototype.rShiftTo=bnpRShiftTo;BigInteger.prototype.subTo=bnpSubTo;BigInteger.prototype.multiplyTo=bnpMultiplyTo;BigInteger.prototype.squareTo=bnpSquareTo;BigInteger.prototype.divRemTo=bnpDivRemTo;BigInteger.prototype.invDigit=bnpInvDigit;BigInteger.prototype.isEven=bnpIsEven;BigInteger.prototype.exp=bnpExp;BigInteger.prototype.toString=bnToString;BigInteger.prototype.negate=bnNegate;BigInteger.prototype.abs=bnAbs;BigInteger.prototype.compareTo=bnCompareTo;BigInteger.prototype.bitLength=bnBitLength;BigInteger.prototype.mod=bnMod;BigInteger.prototype.modPowInt=bnModPowInt;BigInteger.ZERO=nbv(0);BigInteger.ONE=nbv(1); -/*! (c) Tom Wu | http://www-cs-students.stanford.edu/~tjw/jsbn/ - */ -function bnClone(){var a=nbi();this.copyTo(a);return a}function bnIntValue(){if(this.s<0){if(this.t==1){return this[0]-this.DV}else{if(this.t==0){return -1}}}else{if(this.t==1){return this[0]}else{if(this.t==0){return 0}}}return((this[1]&((1<<(32-this.DB))-1))<>24}function bnShortValue(){return(this.t==0)?this.s:(this[0]<<16)>>16}function bnpChunkSize(a){return Math.floor(Math.LN2*this.DB/Math.log(a))}function bnSigNum(){if(this.s<0){return -1}else{if(this.t<=0||(this.t==1&&this[0]<=0)){return 0}else{return 1}}}function bnpToRadix(c){if(c==null){c=10}if(this.signum()==0||c<2||c>36){return"0"}var f=this.chunkSize(c);var e=Math.pow(c,f);var i=nbv(e),j=nbi(),h=nbi(),g="";this.divRemTo(i,j,h);while(j.signum()>0){g=(e+h.intValue()).toString(c).substr(1)+g;j.divRemTo(i,j,h)}return h.intValue().toString(c)+g}function bnpFromRadix(m,h){this.fromInt(0);if(h==null){h=10}var f=this.chunkSize(h);var g=Math.pow(h,f),e=false,a=0,l=0;for(var c=0;c=f){this.dMultiply(g);this.dAddOffset(l,0);a=0;l=0}}if(a>0){this.dMultiply(Math.pow(h,a));this.dAddOffset(l,0)}if(e){BigInteger.ZERO.subTo(this,this)}}function bnpFromNumber(f,e,h){if("number"==typeof e){if(f<2){this.fromInt(1)}else{this.fromNumber(f,h);if(!this.testBit(f-1)){this.bitwiseTo(BigInteger.ONE.shiftLeft(f-1),op_or,this)}if(this.isEven()){this.dAddOffset(1,0)}while(!this.isProbablePrime(e)){this.dAddOffset(2,0);if(this.bitLength()>f){this.subTo(BigInteger.ONE.shiftLeft(f-1),this)}}}}else{var d=new Array(),g=f&7;d.length=(f>>3)+1;e.nextBytes(d);if(g>0){d[0]&=((1<0){if(e>e)!=(this.s&this.DM)>>e){c[a++]=f|(this.s<<(this.DB-e))}while(b>=0){if(e<8){f=(this[b]&((1<>(e+=this.DB-8)}else{f=(this[b]>>(e-=8))&255;if(e<=0){e+=this.DB;--b}}if((f&128)!=0){f|=-256}if(a==0&&(this.s&128)!=(f&128)){++a}if(a>0||f!=this.s){c[a++]=f}}}return c}function bnEquals(b){return(this.compareTo(b)==0)}function bnMin(b){return(this.compareTo(b)<0)?this:b}function bnMax(b){return(this.compareTo(b)>0)?this:b}function bnpBitwiseTo(c,h,e){var d,g,b=Math.min(c.t,this.t);for(d=0;d>=16;b+=16}if((a&255)==0){a>>=8;b+=8}if((a&15)==0){a>>=4;b+=4}if((a&3)==0){a>>=2;b+=2}if((a&1)==0){++b}return b}function bnGetLowestSetBit(){for(var a=0;a=this.t){return(this.s!=0)}return((this[a]&(1<<(b%this.DB)))!=0)}function bnpChangeBit(c,b){var a=BigInteger.ONE.shiftLeft(c);this.bitwiseTo(a,b,a);return a}function bnSetBit(a){return this.changeBit(a,op_or)}function bnClearBit(a){return this.changeBit(a,op_andnot)}function bnFlipBit(a){return this.changeBit(a,op_xor)}function bnpAddTo(d,f){var e=0,g=0,b=Math.min(d.t,this.t);while(e>=this.DB}if(d.t>=this.DB}g+=this.s}else{g+=this.s;while(e>=this.DB}g+=d.s}f.s=(g<0)?-1:0;if(g>0){f[e++]=g}else{if(g<-1){f[e++]=this.DV+g}}f.t=e;f.clamp()}function bnAdd(b){var c=nbi();this.addTo(b,c);return c}function bnSubtract(b){var c=nbi();this.subTo(b,c);return c}function bnMultiply(b){var c=nbi();this.multiplyTo(b,c);return c}function bnSquare(){var a=nbi();this.squareTo(a);return a}function bnDivide(b){var c=nbi();this.divRemTo(b,c,null);return c}function bnRemainder(b){var c=nbi();this.divRemTo(b,null,c);return c}function bnDivideAndRemainder(b){var d=nbi(),c=nbi();this.divRemTo(b,d,c);return new Array(d,c)}function bnpDMultiply(a){this[this.t]=this.am(0,a-1,this,0,0,this.t);++this.t;this.clamp()}function bnpDAddOffset(b,a){if(b==0){return}while(this.t<=a){this[this.t++]=0}this[a]+=b;while(this[a]>=this.DV){this[a]-=this.DV;if(++a>=this.t){this[this.t++]=0}++this[a]}}function NullExp(){}function nNop(a){return a}function nMulTo(a,c,b){a.multiplyTo(c,b)}function nSqrTo(a,b){a.squareTo(b)}NullExp.prototype.convert=nNop;NullExp.prototype.revert=nNop;NullExp.prototype.mulTo=nMulTo;NullExp.prototype.sqrTo=nSqrTo;function bnPow(a){return this.exp(a,new NullExp())}function bnpMultiplyLowerTo(b,f,e){var d=Math.min(this.t+b.t,f);e.s=0;e.t=d;while(d>0){e[--d]=0}var c;for(c=e.t-this.t;d=0){d[c]=0}for(c=Math.max(e-this.t,0);c2*this.m.t){return a.mod(this.m)}else{if(a.compareTo(this.m)<0){return a}else{var b=nbi();a.copyTo(b);this.reduce(b);return b}}}function barrettRevert(a){return a}function barrettReduce(a){a.drShiftTo(this.m.t-1,this.r2);if(a.t>this.m.t+1){a.t=this.m.t+1;a.clamp()}this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3);this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);while(a.compareTo(this.r2)<0){a.dAddOffset(1,this.m.t+1)}a.subTo(this.r2,a);while(a.compareTo(this.m)>=0){a.subTo(this.m,a)}}function barrettSqrTo(a,b){a.squareTo(b);this.reduce(b)}function barrettMulTo(a,c,b){a.multiplyTo(c,b);this.reduce(b)}Barrett.prototype.convert=barrettConvert;Barrett.prototype.revert=barrettRevert;Barrett.prototype.reduce=barrettReduce;Barrett.prototype.mulTo=barrettMulTo;Barrett.prototype.sqrTo=barrettSqrTo;function bnModPow(q,f){var o=q.bitLength(),h,b=nbv(1),v;if(o<=0){return b}else{if(o<18){h=1}else{if(o<48){h=3}else{if(o<144){h=4}else{if(o<768){h=5}else{h=6}}}}}if(o<8){v=new Classic(f)}else{if(f.isEven()){v=new Barrett(f)}else{v=new Montgomery(f)}}var p=new Array(),d=3,s=h-1,a=(1<1){var A=nbi();v.sqrTo(p[1],A);while(d<=a){p[d]=nbi();v.mulTo(A,p[d-2],p[d]);d+=2}}var l=q.t-1,x,u=true,c=nbi(),y;o=nbits(q[l])-1;while(l>=0){if(o>=s){x=(q[l]>>(o-s))&a}else{x=(q[l]&((1<<(o+1))-1))<<(s-o);if(l>0){x|=q[l-1]>>(this.DB+o-s)}}d=h;while((x&1)==0){x>>=1;--d}if((o-=d)<0){o+=this.DB;--l}if(u){p[x].copyTo(b);u=false}else{while(d>1){v.sqrTo(b,c);v.sqrTo(c,b);d-=2}if(d>0){v.sqrTo(b,c)}else{y=b;b=c;c=y}v.mulTo(c,p[x],b)}while(l>=0&&(q[l]&(1<0){b.rShiftTo(f,b);h.rShiftTo(f,h)}while(b.signum()>0){if((d=b.getLowestSetBit())>0){b.rShiftTo(d,b)}if((d=h.getLowestSetBit())>0){h.rShiftTo(d,h)}if(b.compareTo(h)>=0){b.subTo(h,b);b.rShiftTo(1,b)}else{h.subTo(b,h);h.rShiftTo(1,h)}}if(f>0){h.lShiftTo(f,h)}return h}function bnpModInt(e){if(e<=0){return 0}var c=this.DV%e,b=(this.s<0)?e-1:0;if(this.t>0){if(c==0){b=this[0]%e}else{for(var a=this.t-1;a>=0;--a){b=(c*b+this[a])%e}}}return b}function bnModInverse(f){var j=f.isEven();if((this.isEven()&&j)||f.signum()==0){return BigInteger.ZERO}var i=f.clone(),h=this.clone();var g=nbv(1),e=nbv(0),l=nbv(0),k=nbv(1);while(i.signum()!=0){while(i.isEven()){i.rShiftTo(1,i);if(j){if(!g.isEven()||!e.isEven()){g.addTo(this,g);e.subTo(f,e)}g.rShiftTo(1,g)}else{if(!e.isEven()){e.subTo(f,e)}}e.rShiftTo(1,e)}while(h.isEven()){h.rShiftTo(1,h);if(j){if(!l.isEven()||!k.isEven()){l.addTo(this,l);k.subTo(f,k)}l.rShiftTo(1,l)}else{if(!k.isEven()){k.subTo(f,k)}}k.rShiftTo(1,k)}if(i.compareTo(h)>=0){i.subTo(h,i);if(j){g.subTo(l,g)}e.subTo(k,e)}else{h.subTo(i,h);if(j){l.subTo(g,l)}k.subTo(e,k)}}if(h.compareTo(BigInteger.ONE)!=0){return BigInteger.ZERO}if(k.compareTo(f)>=0){return k.subtract(f)}if(k.signum()<0){k.addTo(f,k)}else{return k}if(k.signum()<0){return k.add(f)}else{return k}}var lowprimes=[2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509,521,523,541,547,557,563,569,571,577,587,593,599,601,607,613,617,619,631,641,643,647,653,659,661,673,677,683,691,701,709,719,727,733,739,743,751,757,761,769,773,787,797,809,811,821,823,827,829,839,853,857,859,863,877,881,883,887,907,911,919,929,937,941,947,953,967,971,977,983,991,997];var lplim=(1<<26)/lowprimes[lowprimes.length-1];function bnIsProbablePrime(e){var d,b=this.abs();if(b.t==1&&b[0]<=lowprimes[lowprimes.length-1]){for(d=0;d>1;if(f>lowprimes.length){f=lowprimes.length}var b=nbi();for(var e=0;e>8)&255;rng_pool[rng_pptr++]^=(a>>16)&255;rng_pool[rng_pptr++]^=(a>>24)&255;if(rng_pptr>=rng_psize){rng_pptr-=rng_psize}}function rng_seed_time(){rng_seed_int(new Date().getTime())}if(rng_pool==null){rng_pool=new Array();rng_pptr=0;var t;if(window!==undefined&&(window.crypto!==undefined||window.msCrypto!==undefined)){var crypto=window.crypto||window.msCrypto;if(crypto.getRandomValues){var ua=new Uint8Array(32);crypto.getRandomValues(ua);for(t=0;t<32;++t){rng_pool[rng_pptr++]=ua[t]}}else{if(navigator.appName=="Netscape"&&navigator.appVersion<"5"){var z=window.crypto.random(32);for(t=0;t>>8;rng_pool[rng_pptr++]=t&255}rng_pptr=0;rng_seed_time()}function rng_get_byte(){if(rng_state==null){rng_seed_time();rng_state=prng_newstate();rng_state.init(rng_pool);for(rng_pptr=0;rng_pptr=0&&h>0){var f=e.charCodeAt(d--);if(f<128){g[--h]=f}else{if((f>127)&&(f<2048)){g[--h]=(f&63)|128;g[--h]=(f>>6)|192}else{g[--h]=(f&63)|128;g[--h]=((f>>6)&63)|128;g[--h]=(f>>12)|224}}}g[--h]=0;var b=new SecureRandom();var a=new Array();while(h>2){a[0]=0;while(a[0]==0){b.nextBytes(a)}g[--h]=a[0]}g[--h]=2;g[--h]=0;return new BigInteger(g)}function oaep_mgf1_arr(c,a,e){var b="",d=0;while(b.length>24,(d&16711680)>>16,(d&65280)>>8,d&255])));d+=1}return b}function oaep_pad(q,a,f,l){var c=KJUR.crypto.MessageDigest;var o=KJUR.crypto.Util;var b=null;if(!f){f="sha1"}if(typeof f==="string"){b=c.getCanonicalAlgName(f);l=c.getHashLength(b);f=function(i){return hextorstr(o.hashString(i,b))}}if(q.length+2*l+2>a){throw"Message too long for RSA"}var k="",e;for(e=0;e0&&a.length>0){this.n=parseBigInt(b,16);this.e=parseInt(a,16)}else{throw"Invalid RSA public key"}}}function RSADoPublic(a){return a.modPowInt(this.e,this.n)}function RSAEncrypt(d){var a=pkcs1pad2(d,(this.n.bitLength()+7)>>3);if(a==null){return null}var e=this.doPublic(a);if(e==null){return null}var b=e.toString(16);if((b.length&1)==0){return b}else{return"0"+b}}function RSAEncryptOAEP(f,e,b){var a=oaep_pad(f,(this.n.bitLength()+7)>>3,e,b);if(a==null){return null}var g=this.doPublic(a);if(g==null){return null}var d=g.toString(16);if((d.length&1)==0){return d}else{return"0"+d}}RSAKey.prototype.doPublic=RSADoPublic;RSAKey.prototype.setPublic=RSASetPublic;RSAKey.prototype.encrypt=RSAEncrypt;RSAKey.prototype.encryptOAEP=RSAEncryptOAEP;RSAKey.prototype.type="RSA"; -/*! (c) Tom Wu | http://www-cs-students.stanford.edu/~tjw/jsbn/ - */ -function pkcs1unpad2(g,j){var a=g.toByteArray();var f=0;while(f=a.length){return null}}var e="";while(++f191)&&(h<224)){e+=String.fromCharCode(((h&31)<<6)|(a[f+1]&63));++f}else{e+=String.fromCharCode(((h&15)<<12)|((a[f+1]&63)<<6)|(a[f+2]&63));f+=2}}}return e}function oaep_mgf1_str(c,a,e){var b="",d=0;while(b.length>24,(d&16711680)>>16,(d&65280)>>8,d&255]));d+=1}return b}function oaep_unpad(o,b,g,p){var e=KJUR.crypto.MessageDigest;var r=KJUR.crypto.Util;var c=null;if(!g){g="sha1"}if(typeof g==="string"){c=e.getCanonicalAlgName(g);p=e.getHashLength(c);g=function(d){return hextorstr(r.hashString(d,c))}}o=o.toByteArray();var h;for(h=0;h0&&a.length>0){this.n=parseBigInt(c,16);this.e=parseInt(a,16);this.d=parseBigInt(b,16)}else{alert("Invalid RSA private key")}}}function RSASetPrivateEx(g,d,e,c,b,a,h,f){this.isPrivate=true;this.isPublic=false;if(g==null){throw"RSASetPrivateEx N == null"}if(d==null){throw"RSASetPrivateEx E == null"}if(g.length==0){throw"RSASetPrivateEx N.length == 0"}if(d.length==0){throw"RSASetPrivateEx E.length == 0"}if(g!=null&&d!=null&&g.length>0&&d.length>0){this.n=parseBigInt(g,16);this.e=parseInt(d,16);this.d=parseBigInt(e,16);this.p=parseBigInt(c,16);this.q=parseBigInt(b,16);this.dmp1=parseBigInt(a,16);this.dmq1=parseBigInt(h,16);this.coeff=parseBigInt(f,16)}else{alert("Invalid RSA private key in RSASetPrivateEx")}}function RSAGenerate(b,i){var a=new SecureRandom();var f=b>>1;this.e=parseInt(i,16);var c=new BigInteger(i,16);for(;;){for(;;){this.p=new BigInteger(b-f,1,a);if(this.p.subtract(BigInteger.ONE).gcd(c).compareTo(BigInteger.ONE)==0&&this.p.isProbablePrime(10)){break}}for(;;){this.q=new BigInteger(f,1,a);if(this.q.subtract(BigInteger.ONE).gcd(c).compareTo(BigInteger.ONE)==0&&this.q.isProbablePrime(10)){break}}if(this.p.compareTo(this.q)<=0){var h=this.p;this.p=this.q;this.q=h}var g=this.p.subtract(BigInteger.ONE);var d=this.q.subtract(BigInteger.ONE);var e=g.multiply(d);if(e.gcd(c).compareTo(BigInteger.ONE)==0){this.n=this.p.multiply(this.q);this.d=c.modInverse(e);this.dmp1=this.d.mod(g);this.dmq1=this.d.mod(d);this.coeff=this.q.modInverse(this.p);break}}this.isPrivate=true}function RSADoPrivate(a){if(this.p==null||this.q==null){return a.modPow(this.d,this.n)}var c=a.mod(this.p).modPow(this.dmp1,this.p);var b=a.mod(this.q).modPow(this.dmq1,this.q);while(c.compareTo(b)<0){c=c.add(this.p)}return c.subtract(b).multiply(this.coeff).mod(this.p).multiply(this.q).add(b)}function RSADecrypt(b){var d=parseBigInt(b,16);var a=this.doPrivate(d);if(a==null){return null}return pkcs1unpad2(a,(this.n.bitLength()+7)>>3)}function RSADecryptOAEP(e,d,b){var f=parseBigInt(e,16);var a=this.doPrivate(f);if(a==null){return null}return oaep_unpad(a,(this.n.bitLength()+7)>>3,d,b)}RSAKey.prototype.doPrivate=RSADoPrivate;RSAKey.prototype.setPrivate=RSASetPrivate;RSAKey.prototype.setPrivateEx=RSASetPrivateEx;RSAKey.prototype.generate=RSAGenerate;RSAKey.prototype.decrypt=RSADecrypt;RSAKey.prototype.decryptOAEP=RSADecryptOAEP; -/*! (c) Tom Wu | http://www-cs-students.stanford.edu/~tjw/jsbn/ - */ -function ECFieldElementFp(b,a){this.x=a;this.q=b}function feFpEquals(a){if(a==this){return true}return(this.q.equals(a.q)&&this.x.equals(a.x))}function feFpToBigInteger(){return this.x}function feFpNegate(){return new ECFieldElementFp(this.q,this.x.negate().mod(this.q))}function feFpAdd(a){return new ECFieldElementFp(this.q,this.x.add(a.toBigInteger()).mod(this.q))}function feFpSubtract(a){return new ECFieldElementFp(this.q,this.x.subtract(a.toBigInteger()).mod(this.q))}function feFpMultiply(a){return new ECFieldElementFp(this.q,this.x.multiply(a.toBigInteger()).mod(this.q))}function feFpSquare(){return new ECFieldElementFp(this.q,this.x.square().mod(this.q))}function feFpDivide(a){return new ECFieldElementFp(this.q,this.x.multiply(a.toBigInteger().modInverse(this.q)).mod(this.q))}ECFieldElementFp.prototype.equals=feFpEquals;ECFieldElementFp.prototype.toBigInteger=feFpToBigInteger;ECFieldElementFp.prototype.negate=feFpNegate;ECFieldElementFp.prototype.add=feFpAdd;ECFieldElementFp.prototype.subtract=feFpSubtract;ECFieldElementFp.prototype.multiply=feFpMultiply;ECFieldElementFp.prototype.square=feFpSquare;ECFieldElementFp.prototype.divide=feFpDivide;function ECPointFp(c,a,d,b){this.curve=c;this.x=a;this.y=d;if(b==null){this.z=BigInteger.ONE}else{this.z=b}this.zinv=null}function pointFpGetX(){if(this.zinv==null){this.zinv=this.z.modInverse(this.curve.q)}return this.curve.fromBigInteger(this.x.toBigInteger().multiply(this.zinv).mod(this.curve.q))}function pointFpGetY(){if(this.zinv==null){this.zinv=this.z.modInverse(this.curve.q)}return this.curve.fromBigInteger(this.y.toBigInteger().multiply(this.zinv).mod(this.curve.q))}function pointFpEquals(a){if(a==this){return true}if(this.isInfinity()){return a.isInfinity()}if(a.isInfinity()){return this.isInfinity()}var c,b;c=a.y.toBigInteger().multiply(this.z).subtract(this.y.toBigInteger().multiply(a.z)).mod(this.curve.q);if(!c.equals(BigInteger.ZERO)){return false}b=a.x.toBigInteger().multiply(this.z).subtract(this.x.toBigInteger().multiply(a.z)).mod(this.curve.q);return b.equals(BigInteger.ZERO)}function pointFpIsInfinity(){if((this.x==null)&&(this.y==null)){return true}return this.z.equals(BigInteger.ZERO)&&!this.y.toBigInteger().equals(BigInteger.ZERO)}function pointFpNegate(){return new ECPointFp(this.curve,this.x,this.y.negate(),this.z)}function pointFpAdd(l){if(this.isInfinity()){return l}if(l.isInfinity()){return this}var p=l.y.toBigInteger().multiply(this.z).subtract(this.y.toBigInteger().multiply(l.z)).mod(this.curve.q);var o=l.x.toBigInteger().multiply(this.z).subtract(this.x.toBigInteger().multiply(l.z)).mod(this.curve.q);if(BigInteger.ZERO.equals(o)){if(BigInteger.ZERO.equals(p)){return this.twice()}return this.curve.getInfinity()}var j=new BigInteger("3");var e=this.x.toBigInteger();var n=this.y.toBigInteger();var c=l.x.toBigInteger();var k=l.y.toBigInteger();var m=o.square();var i=m.multiply(o);var d=e.multiply(m);var g=p.square().multiply(this.z);var a=g.subtract(d.shiftLeft(1)).multiply(l.z).subtract(i).multiply(o).mod(this.curve.q);var h=d.multiply(j).multiply(p).subtract(n.multiply(i)).subtract(g.multiply(p)).multiply(l.z).add(p.multiply(i)).mod(this.curve.q);var f=i.multiply(this.z).multiply(l.z).mod(this.curve.q);return new ECPointFp(this.curve,this.curve.fromBigInteger(a),this.curve.fromBigInteger(h),f)}function pointFpTwice(){if(this.isInfinity()){return this}if(this.y.toBigInteger().signum()==0){return this.curve.getInfinity()}var g=new BigInteger("3");var c=this.x.toBigInteger();var h=this.y.toBigInteger();var e=h.multiply(this.z);var j=e.multiply(h).mod(this.curve.q);var i=this.curve.a.toBigInteger();var k=c.square().multiply(g);if(!BigInteger.ZERO.equals(i)){k=k.add(this.z.square().multiply(i))}k=k.mod(this.curve.q);var b=k.square().subtract(c.shiftLeft(3).multiply(j)).shiftLeft(1).multiply(e).mod(this.curve.q);var f=k.multiply(g).multiply(c).subtract(j.shiftLeft(1)).shiftLeft(2).multiply(j).subtract(k.square().multiply(k)).mod(this.curve.q);var d=e.square().multiply(e).shiftLeft(3).mod(this.curve.q);return new ECPointFp(this.curve,this.curve.fromBigInteger(b),this.curve.fromBigInteger(f),d)}function pointFpMultiply(b){if(this.isInfinity()){return this}if(b.signum()==0){return this.curve.getInfinity()}var g=b;var f=g.multiply(new BigInteger("3"));var l=this.negate();var d=this;var c;for(c=f.bitLength()-2;c>0;--c){d=d.twice();var a=f.testBit(c);var j=g.testBit(c);if(a!=j){d=d.add(a?this:l)}}return d}function pointFpMultiplyTwo(c,a,b){var d;if(c.bitLength()>b.bitLength()){d=c.bitLength()-1}else{d=b.bitLength()-1}var f=this.curve.getInfinity();var e=this.add(a);while(d>=0){f=f.twice();if(c.testBit(d)){if(b.testBit(d)){f=f.add(e)}else{f=f.add(this)}}else{if(b.testBit(d)){f=f.add(a)}}--d}return f}ECPointFp.prototype.getX=pointFpGetX;ECPointFp.prototype.getY=pointFpGetY;ECPointFp.prototype.equals=pointFpEquals;ECPointFp.prototype.isInfinity=pointFpIsInfinity;ECPointFp.prototype.negate=pointFpNegate;ECPointFp.prototype.add=pointFpAdd;ECPointFp.prototype.twice=pointFpTwice;ECPointFp.prototype.multiply=pointFpMultiply;ECPointFp.prototype.multiplyTwo=pointFpMultiplyTwo;function ECCurveFp(e,d,c){this.q=e;this.a=this.fromBigInteger(d);this.b=this.fromBigInteger(c);this.infinity=new ECPointFp(this,null,null)}function curveFpGetQ(){return this.q}function curveFpGetA(){return this.a}function curveFpGetB(){return this.b}function curveFpEquals(a){if(a==this){return true}return(this.q.equals(a.q)&&this.a.equals(a.a)&&this.b.equals(a.b))}function curveFpGetInfinity(){return this.infinity}function curveFpFromBigInteger(a){return new ECFieldElementFp(this.q,a)}function curveFpDecodePointHex(d){switch(parseInt(d.substr(0,2),16)){case 0:return this.infinity;case 2:case 3:return null;case 4:case 6:case 7:var a=(d.length-2)/2;var c=d.substr(2,a);var b=d.substr(a+2,a);return new ECPointFp(this,this.fromBigInteger(new BigInteger(c,16)),this.fromBigInteger(new BigInteger(b,16)));default:return null}}ECCurveFp.prototype.getQ=curveFpGetQ;ECCurveFp.prototype.getA=curveFpGetA;ECCurveFp.prototype.getB=curveFpGetB;ECCurveFp.prototype.equals=curveFpEquals;ECCurveFp.prototype.getInfinity=curveFpGetInfinity;ECCurveFp.prototype.fromBigInteger=curveFpFromBigInteger;ECCurveFp.prototype.decodePointHex=curveFpDecodePointHex; -/*! (c) Stefan Thomas | https://github.com/bitcoinjs/bitcoinjs-lib - */ -ECFieldElementFp.prototype.getByteLength=function(){return Math.floor((this.toBigInteger().bitLength()+7)/8)};ECPointFp.prototype.getEncoded=function(c){var d=function(h,f){var g=h.toByteArrayUnsigned();if(fg.length){g.unshift(0)}}return g};var a=this.getX().toBigInteger();var e=this.getY().toBigInteger();var b=d(a,32);if(c){if(e.isEven()){b.unshift(2)}else{b.unshift(3)}}else{b.unshift(4);b=b.concat(d(e,32))}return b};ECPointFp.decodeFrom=function(g,c){var f=c[0];var e=c.length-1;var d=c.slice(1,1+e/2);var b=c.slice(1+e/2,1+e);d.unshift(0);b.unshift(0);var a=new BigInteger(d);var h=new BigInteger(b);return new ECPointFp(g,g.fromBigInteger(a),g.fromBigInteger(h))};ECPointFp.decodeFromHex=function(g,c){var f=c.substr(0,2);var e=c.length-2;var d=c.substr(2,e/2);var b=c.substr(2+e/2,e/2);var a=new BigInteger(d,16);var h=new BigInteger(b,16);return new ECPointFp(g,g.fromBigInteger(a),g.fromBigInteger(h))};ECPointFp.prototype.add2D=function(c){if(this.isInfinity()){return c}if(c.isInfinity()){return this}if(this.x.equals(c.x)){if(this.y.equals(c.y)){return this.twice()}return this.curve.getInfinity()}var g=c.x.subtract(this.x);var e=c.y.subtract(this.y);var a=e.divide(g);var d=a.square().subtract(this.x).subtract(c.x);var f=a.multiply(this.x.subtract(d)).subtract(this.y);return new ECPointFp(this.curve,d,f)};ECPointFp.prototype.twice2D=function(){if(this.isInfinity()){return this}if(this.y.toBigInteger().signum()==0){return this.curve.getInfinity()}var b=this.curve.fromBigInteger(BigInteger.valueOf(2));var e=this.curve.fromBigInteger(BigInteger.valueOf(3));var a=this.x.square().multiply(e).add(this.curve.a).divide(this.y.multiply(b));var c=a.square().subtract(this.x.multiply(b));var d=a.multiply(this.x.subtract(c)).subtract(this.y);return new ECPointFp(this.curve,c,d)};ECPointFp.prototype.multiply2D=function(b){if(this.isInfinity()){return this}if(b.signum()==0){return this.curve.getInfinity()}var g=b;var f=g.multiply(new BigInteger("3"));var l=this.negate();var d=this;var c;for(c=f.bitLength()-2;c>0;--c){d=d.twice();var a=f.testBit(c);var j=g.testBit(c);if(a!=j){d=d.add2D(a?this:l)}}return d};ECPointFp.prototype.isOnCurve=function(){var d=this.getX().toBigInteger();var i=this.getY().toBigInteger();var f=this.curve.getA().toBigInteger();var c=this.curve.getB().toBigInteger();var h=this.curve.getQ();var e=i.multiply(i).mod(h);var g=d.multiply(d).multiply(d).add(f.multiply(d)).add(c).mod(h);return e.equals(g)};ECPointFp.prototype.toString=function(){return"("+this.getX().toBigInteger().toString()+","+this.getY().toBigInteger().toString()+")"};ECPointFp.prototype.validate=function(){var c=this.curve.getQ();if(this.isInfinity()){throw new Error("Point is at infinity.")}var a=this.getX().toBigInteger();var b=this.getY().toBigInteger();if(a.compareTo(BigInteger.ONE)<0||a.compareTo(c.subtract(BigInteger.ONE))>0){throw new Error("x coordinate out of bounds")}if(b.compareTo(BigInteger.ONE)<0||b.compareTo(c.subtract(BigInteger.ONE))>0){throw new Error("y coordinate out of bounds")}if(!this.isOnCurve()){throw new Error("Point is not on the curve.")}if(this.multiply(c).isInfinity()){throw new Error("Point is not a scalar multiple of G.")}return true}; -/*! Mike Samuel (c) 2009 | code.google.com/p/json-sans-eval - */ -var jsonParse=(function(){var e="(?:-?\\b(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?(?:[eE][+-]?[0-9]+)?\\b)";var j='(?:[^\\0-\\x08\\x0a-\\x1f"\\\\]|\\\\(?:["/\\\\bfnrt]|u[0-9A-Fa-f]{4}))';var i='(?:"'+j+'*")';var d=new RegExp("(?:false|true|null|[\\{\\}\\[\\]]|"+e+"|"+i+")","g");var k=new RegExp("\\\\(?:([^u])|u(.{4}))","g");var g={'"':'"',"/":"/","\\":"\\",b:"\b",f:"\f",n:"\n",r:"\r",t:"\t"};function h(l,m,n){return m?g[m]:String.fromCharCode(parseInt(n,16))}var c=new String("");var a="\\";var f={"{":Object,"[":Array};var b=Object.hasOwnProperty;return function(u,q){var p=u.match(d);var x;var v=p[0];var l=false;if("{"===v){x={}}else{if("["===v){x=[]}else{x=[];l=true}}var t;var r=[x];for(var o=1-l,m=p.length;o=0;){delete D[n[A]]}}}return q.call(C,B,D)};x=s({"":x},"")}return x}})(); -if(typeof KJUR=="undefined"||!KJUR){KJUR={}}if(typeof KJUR.asn1=="undefined"||!KJUR.asn1){KJUR.asn1={}}KJUR.asn1.ASN1Util=new function(){this.integerToByteHex=function(a){var b=a.toString(16);if((b.length%2)==1){b="0"+b}return b};this.bigIntToMinTwosComplementsHex=function(j){var f=j.toString(16);if(f.substr(0,1)!="-"){if(f.length%2==1){f="0"+f}else{if(!f.match(/^[0-7]/)){f="00"+f}}}else{var a=f.substr(1);var e=a.length;if(e%2==1){e+=1}else{if(!f.match(/^[0-7]/)){e+=2}}var g="";for(var d=0;d15){throw"ASN.1 length too long to represent by 8x: n = "+i.toString(16)}var f=128+g;return f.toString(16)+h}};this.getEncodedHex=function(){if(this.hTLV==null||this.isModified){this.hV=this.getFreshValueHex();this.hL=this.getLengthHexFromValue();this.hTLV=this.hT+this.hL+this.hV;this.isModified=false}return this.hTLV};this.getValueHex=function(){this.getEncodedHex();return this.hV};this.getFreshValueHex=function(){return""}};KJUR.asn1.DERAbstractString=function(c){KJUR.asn1.DERAbstractString.superclass.constructor.call(this);var b=null;var a=null;this.getString=function(){return this.s};this.setString=function(d){this.hTLV=null;this.isModified=true;this.s=d;this.hV=stohex(this.s)};this.setStringHex=function(d){this.hTLV=null;this.isModified=true;this.s=null;this.hV=d};this.getFreshValueHex=function(){return this.hV};if(typeof c!="undefined"){if(typeof c=="string"){this.setString(c)}else{if(typeof c.str!="undefined"){this.setString(c.str)}else{if(typeof c.hex!="undefined"){this.setStringHex(c.hex)}}}}};YAHOO.lang.extend(KJUR.asn1.DERAbstractString,KJUR.asn1.ASN1Object);KJUR.asn1.DERAbstractTime=function(c){KJUR.asn1.DERAbstractTime.superclass.constructor.call(this);var b=null;var a=null;this.localDateToUTC=function(f){utc=f.getTime()+(f.getTimezoneOffset()*60000);var e=new Date(utc);return e};this.formatDate=function(m,o,e){var g=this.zeroPadding;var n=this.localDateToUTC(m);var p=String(n.getFullYear());if(o=="utc"){p=p.substr(2,2)}var l=g(String(n.getMonth()+1),2);var q=g(String(n.getDate()),2);var h=g(String(n.getHours()),2);var i=g(String(n.getMinutes()),2);var j=g(String(n.getSeconds()),2);var r=p+l+q+h+i+j;if(e===true){var f=n.getMilliseconds();if(f!=0){var k=g(String(f),3);k=k.replace(/[0]+$/,"");r=r+"."+k}}return r+"Z"};this.zeroPadding=function(e,d){if(e.length>=d){return e}return new Array(d-e.length+1).join("0")+e};this.getString=function(){return this.s};this.setString=function(d){this.hTLV=null;this.isModified=true;this.s=d;this.hV=stohex(d)};this.setByDateValue=function(h,j,e,d,f,g){var i=new Date(Date.UTC(h,j-1,e,d,f,g,0));this.setByDate(i)};this.getFreshValueHex=function(){return this.hV}};YAHOO.lang.extend(KJUR.asn1.DERAbstractTime,KJUR.asn1.ASN1Object);KJUR.asn1.DERAbstractStructured=function(b){KJUR.asn1.DERAbstractString.superclass.constructor.call(this);var a=null;this.setByASN1ObjectArray=function(c){this.hTLV=null;this.isModified=true;this.asn1Array=c};this.appendASN1Object=function(c){this.hTLV=null;this.isModified=true;this.asn1Array.push(c)};this.asn1Array=new Array();if(typeof b!="undefined"){if(typeof b.array!="undefined"){this.asn1Array=b.array}}};YAHOO.lang.extend(KJUR.asn1.DERAbstractStructured,KJUR.asn1.ASN1Object);KJUR.asn1.DERBoolean=function(){KJUR.asn1.DERBoolean.superclass.constructor.call(this);this.hT="01";this.hTLV="0101ff"};YAHOO.lang.extend(KJUR.asn1.DERBoolean,KJUR.asn1.ASN1Object);KJUR.asn1.DERInteger=function(a){KJUR.asn1.DERInteger.superclass.constructor.call(this);this.hT="02";this.setByBigInteger=function(b){this.hTLV=null;this.isModified=true;this.hV=KJUR.asn1.ASN1Util.bigIntToMinTwosComplementsHex(b)};this.setByInteger=function(c){var b=new BigInteger(String(c),10);this.setByBigInteger(b)};this.setValueHex=function(b){this.hV=b};this.getFreshValueHex=function(){return this.hV};if(typeof a!="undefined"){if(typeof a.bigint!="undefined"){this.setByBigInteger(a.bigint)}else{if(typeof a["int"]!="undefined"){this.setByInteger(a["int"])}else{if(typeof a=="number"){this.setByInteger(a)}else{if(typeof a.hex!="undefined"){this.setValueHex(a.hex)}}}}}};YAHOO.lang.extend(KJUR.asn1.DERInteger,KJUR.asn1.ASN1Object);KJUR.asn1.DERBitString=function(b){if(b!==undefined&&typeof b.obj!=="undefined"){var a=KJUR.asn1.ASN1Util.newObject(b.obj);b.hex="00"+a.getEncodedHex()}KJUR.asn1.DERBitString.superclass.constructor.call(this);this.hT="03";this.setHexValueIncludingUnusedBits=function(c){this.hTLV=null;this.isModified=true;this.hV=c};this.setUnusedBitsAndHexValue=function(c,e){if(c<0||7=(l*2))){break}if(d>=200){break}g.push(b);c=b;d++}return g};ASN1HEX.getNthChildIdx=function(d,b,e){var c=ASN1HEX.getChildIdx(d,b);return c[e]};ASN1HEX.getIdxbyList=function(e,d,c,i){var g=ASN1HEX;var f,b;if(c.length==0){if(i!==undefined){if(e.substr(d,2)!==i){throw"checking tag doesn't match: "+e.substr(d,2)+"!="+i}}return d}f=c.shift();b=g.getChildIdx(e,d);return g.getIdxbyList(e,b[f],c,i)};ASN1HEX.getTLVbyList=function(d,c,b,f){var e=ASN1HEX;var a=e.getIdxbyList(d,c,b);if(a===undefined){throw"can't find nthList object"}if(f!==undefined){if(d.substr(a,2)!=f){throw"checking tag doesn't match: "+d.substr(a,2)+"!="+f}}return e.getTLV(d,a)};ASN1HEX.getVbyList=function(e,c,b,g,i){var f=ASN1HEX;var a,d;a=f.getIdxbyList(e,c,b,g);if(a===undefined){throw"can't find nthList object"}d=f.getV(e,a);if(i===true){d=d.substr(2)}return d};ASN1HEX.hextooidstr=function(e){var h=function(b,a){if(b.length>=a){return b}return new Array(a-b.length+1).join("0")+b};var l=[];var o=e.substr(0,2);var f=parseInt(o,16);l[0]=new String(Math.floor(f/40));l[1]=new String(f%40);var m=e.substr(2);var k=[];for(var g=0;g0){n=n+"."+j.join(".")}return n};ASN1HEX.dump=function(t,c,l,g){var p=ASN1HEX;var j=p.getV;var y=p.dump;var w=p.getChildIdx;var e=t;if(t instanceof KJUR.asn1.ASN1Object){e=t.getEncodedHex()}var q=function(A,i){if(A.length<=i*2){return A}else{var v=A.substr(0,i)+"..(total "+A.length/2+"bytes).."+A.substr(A.length-i,i);return v}};if(c===undefined){c={ommit_long_octet:32}}if(l===undefined){l=0}if(g===undefined){g=""}var x=c.ommit_long_octet;if(e.substr(l,2)=="01"){var h=j(e,l);if(h=="00"){return g+"BOOLEAN FALSE\n"}else{return g+"BOOLEAN TRUE\n"}}if(e.substr(l,2)=="02"){var h=j(e,l);return g+"INTEGER "+q(h,x)+"\n"}if(e.substr(l,2)=="03"){var h=j(e,l);return g+"BITSTRING "+q(h,x)+"\n"}if(e.substr(l,2)=="04"){var h=j(e,l);if(p.isASN1HEX(h)){var k=g+"OCTETSTRING, encapsulates\n";k=k+y(h,c,0,g+" ");return k}else{return g+"OCTETSTRING "+q(h,x)+"\n"}}if(e.substr(l,2)=="05"){return g+"NULL\n"}if(e.substr(l,2)=="06"){var m=j(e,l);var a=KJUR.asn1.ASN1Util.oidHexToInt(m);var o=KJUR.asn1.x509.OID.oid2name(a);var b=a.replace(/\./g," ");if(o!=""){return g+"ObjectIdentifier "+o+" ("+b+")\n"}else{return g+"ObjectIdentifier ("+b+")\n"}}if(e.substr(l,2)=="0c"){return g+"UTF8String '"+hextoutf8(j(e,l))+"'\n"}if(e.substr(l,2)=="13"){return g+"PrintableString '"+hextoutf8(j(e,l))+"'\n"}if(e.substr(l,2)=="14"){return g+"TeletexString '"+hextoutf8(j(e,l))+"'\n"}if(e.substr(l,2)=="16"){return g+"IA5String '"+hextoutf8(j(e,l))+"'\n"}if(e.substr(l,2)=="17"){return g+"UTCTime "+hextoutf8(j(e,l))+"\n"}if(e.substr(l,2)=="18"){return g+"GeneralizedTime "+hextoutf8(j(e,l))+"\n"}if(e.substr(l,2)=="30"){if(e.substr(l,4)=="3000"){return g+"SEQUENCE {}\n"}var k=g+"SEQUENCE\n";var d=w(e,l);var f=c;if((d.length==2||d.length==3)&&e.substr(d[0],2)=="06"&&e.substr(d[d.length-1],2)=="04"){var o=p.oidname(j(e,d[0]));var r=JSON.parse(JSON.stringify(c));r.x509ExtName=o;f=r}for(var u=0;u0){var m=new f({array:this.extensionsArray});var k=new c({explicit:true,tag:"a3",obj:m});this.asn1Array.push(k)}var n=new f({array:this.asn1Array});this.hTLV=n.getEncodedHex();this.isModified=false;return this.hTLV};this._initialize()};YAHOO.lang.extend(KJUR.asn1.x509.TBSCertificate,KJUR.asn1.ASN1Object);KJUR.asn1.x509.Extension=function(d){KJUR.asn1.x509.Extension.superclass.constructor.call(this);var f=null,a=KJUR,e=a.asn1,h=e.DERObjectIdentifier,i=e.DEROctetString,b=e.DERBitString,g=e.DERBoolean,c=e.DERSequence;this.getEncodedHex=function(){var m=new h({oid:this.oid});var l=new i({hex:this.getExtnValueHex()});var k=new Array();k.push(m);if(this.critical){k.push(new g())}k.push(l);var j=new c({array:k});return j.getEncodedHex()};this.critical=false;if(typeof d!="undefined"){if(typeof d.critical!="undefined"){this.critical=d.critical}}};YAHOO.lang.extend(KJUR.asn1.x509.Extension,KJUR.asn1.ASN1Object);KJUR.asn1.x509.Extension.appendByNameToArray=function(e,c,b){var g=e.toLowerCase(),f=KJUR.asn1.x509;if(g=="basicconstraints"){var d=new f.BasicConstraints(c);b.push(d)}else{if(g=="keyusage"){var d=new f.KeyUsage(c);b.push(d)}else{if(g=="crldistributionpoints"){var d=new f.CRLDistributionPoints(c);b.push(d)}else{if(g=="extkeyusage"){var d=new f.ExtKeyUsage(c);b.push(d)}else{if(g=="authoritykeyidentifier"){var d=new f.AuthorityKeyIdentifier(c);b.push(d)}else{if(g=="authorityinfoaccess"){var d=new f.AuthorityInfoAccess(c);b.push(d)}else{if(g=="subjectaltname"){var d=new f.SubjectAltName(c);b.push(d)}else{if(g=="issueraltname"){var d=new f.IssuerAltName(c);b.push(d)}else{throw"unsupported extension name: "+e}}}}}}}}};KJUR.asn1.x509.KeyUsage=function(a){KJUR.asn1.x509.KeyUsage.superclass.constructor.call(this,a);this.getExtnValueHex=function(){return this.asn1ExtnValue.getEncodedHex()};this.oid="2.5.29.15";if(typeof a!="undefined"){if(typeof a.bin!="undefined"){this.asn1ExtnValue=new KJUR.asn1.DERBitString(a)}}};YAHOO.lang.extend(KJUR.asn1.x509.KeyUsage,KJUR.asn1.x509.Extension);KJUR.asn1.x509.BasicConstraints=function(c){KJUR.asn1.x509.BasicConstraints.superclass.constructor.call(this,c);var a=false;var b=-1;this.getExtnValueHex=function(){var e=new Array();if(this.cA){e.push(new KJUR.asn1.DERBoolean())}if(this.pathLen>-1){e.push(new KJUR.asn1.DERInteger({"int":this.pathLen}))}var d=new KJUR.asn1.DERSequence({array:e});this.asn1ExtnValue=d;return this.asn1ExtnValue.getEncodedHex()};this.oid="2.5.29.19";this.cA=false;this.pathLen=-1;if(typeof c!="undefined"){if(typeof c.cA!="undefined"){this.cA=c.cA}if(typeof c.pathLen!="undefined"){this.pathLen=c.pathLen}}};YAHOO.lang.extend(KJUR.asn1.x509.BasicConstraints,KJUR.asn1.x509.Extension);KJUR.asn1.x509.CRLDistributionPoints=function(d){KJUR.asn1.x509.CRLDistributionPoints.superclass.constructor.call(this,d);var b=KJUR,a=b.asn1,c=a.x509;this.getExtnValueHex=function(){return this.asn1ExtnValue.getEncodedHex()};this.setByDPArray=function(e){this.asn1ExtnValue=new a.DERSequence({array:e})};this.setByOneURI=function(h){var e=new c.GeneralNames([{uri:h}]);var g=new c.DistributionPointName(e);var f=new c.DistributionPoint({dpobj:g});this.setByDPArray([f])};this.oid="2.5.29.31";if(typeof d!="undefined"){if(typeof d.array!="undefined"){this.setByDPArray(d.array)}else{if(typeof d.uri!="undefined"){this.setByOneURI(d.uri)}}}};YAHOO.lang.extend(KJUR.asn1.x509.CRLDistributionPoints,KJUR.asn1.x509.Extension);KJUR.asn1.x509.ExtKeyUsage=function(c){KJUR.asn1.x509.ExtKeyUsage.superclass.constructor.call(this,c);var b=KJUR,a=b.asn1;this.setPurposeArray=function(d){this.asn1ExtnValue=new a.DERSequence();for(var e=0;e0){var h=new b({array:this.aRevokedCert});this.asn1Array.push(h)}var i=new b({array:this.asn1Array});this.hTLV=i.getEncodedHex();this.isModified=false;return this.hTLV};this._initialize=function(){this.asn1Version=null;this.asn1SignatureAlg=null;this.asn1Issuer=null;this.asn1ThisUpdate=null;this.asn1NextUpdate=null;this.aRevokedCert=new Array()};this._initialize()};YAHOO.lang.extend(KJUR.asn1.x509.TBSCertList,KJUR.asn1.ASN1Object);KJUR.asn1.x509.CRLEntry=function(e){KJUR.asn1.x509.CRLEntry.superclass.constructor.call(this);var d=null,c=null,b=KJUR,a=b.asn1;this.setCertSerial=function(f){this.sn=new a.DERInteger(f)};this.setRevocationDate=function(f){this.time=new a.x509.Time(f)};this.getEncodedHex=function(){var f=new a.DERSequence({array:[this.sn,this.time]});this.TLV=f.getEncodedHex();return this.TLV};if(e!==undefined){if(e.time!==undefined){this.setRevocationDate(e.time)}if(e.sn!==undefined){this.setCertSerial(e.sn)}}};YAHOO.lang.extend(KJUR.asn1.x509.CRLEntry,KJUR.asn1.ASN1Object);KJUR.asn1.x509.X500Name=function(f){KJUR.asn1.x509.X500Name.superclass.constructor.call(this);this.asn1Array=new Array();var d=KJUR,c=d.asn1,e=c.x509,b=pemtohex;this.setByString=function(g){var h=g.split("/");h.shift();for(var j=0;j0;f++){var h=c.shift();if(e===true){var d=b.pop();var j=(d+","+h).replace(/\\,/g,",");b.push(j);e=false}else{b.push(h)}if(h.substr(-1,1)==="\\"){e=true}}b=b.map(function(a){return a.replace("/","\\/")});b.reverse();return"/"+b.join("/")};KJUR.asn1.x509.RDN=function(a){KJUR.asn1.x509.RDN.superclass.constructor.call(this);this.asn1Array=new Array();this.addByString=function(b){this.asn1Array.push(new KJUR.asn1.x509.AttributeTypeAndValue({str:b}))};this.addByMultiValuedString=function(d){var b=KJUR.asn1.x509.RDN.parseString(d);for(var c=0;c0;g++){var k=j.shift();if(h===true){var f=c.pop();var d=(f+"+"+k).replace(/\\\+/g,"+");c.push(d);h=false}else{c.push(k)}if(k.substr(-1,1)==="\\"){h=true}}var l=false;var b=[];for(var g=0;c.length>0;g++){var k=c.shift();if(l===true){var e=b.pop();if(k.match(/"$/)){var d=(e+"+"+k).replace(/^([^=]+)="(.*)"$/,"$1=$2");b.push(d);l=false}else{b.push(e+"+"+k)}}else{b.push(k)}if(k.match(/^[^=]+="/)){l=true}}return b};KJUR.asn1.x509.AttributeTypeAndValue=function(d){KJUR.asn1.x509.AttributeTypeAndValue.superclass.constructor.call(this);var f=null,e=null,a="utf8",c=KJUR,b=c.asn1;this.setByString=function(h){var g=h.match(/^([^=]+)=(.+)$/);if(g){this.setByAttrTypeAndValueStr(g[1],g[2])}else{throw"malformed attrTypeAndValueStr: "+h}};this.setByAttrTypeAndValueStr=function(i,h){this.typeObj=KJUR.asn1.x509.OID.atype2obj(i);var g=a;if(i=="C"){g="prn"}this.valueObj=this.getValueObj(g,h)};this.getValueObj=function(h,g){if(h=="utf8"){return new b.DERUTF8String({str:g})}if(h=="prn"){return new b.DERPrintableString({str:g})}if(h=="tel"){return new b.DERTeletexString({str:g})}if(h=="ia5"){return new b.DERIA5String({str:g})}throw"unsupported directory string type: type="+h+" value="+g};this.getEncodedHex=function(){var g=new b.DERSequence({array:[this.typeObj,this.valueObj]});this.TLV=g.getEncodedHex();return this.TLV};if(typeof d!="undefined"){if(typeof d.str!="undefined"){this.setByString(d.str)}}};YAHOO.lang.extend(KJUR.asn1.x509.AttributeTypeAndValue,KJUR.asn1.ASN1Object);KJUR.asn1.x509.SubjectPublicKeyInfo=function(f){KJUR.asn1.x509.SubjectPublicKeyInfo.superclass.constructor.call(this);var l=null,k=null,a=KJUR,j=a.asn1,i=j.DERInteger,b=j.DERBitString,m=j.DERObjectIdentifier,e=j.DERSequence,h=j.ASN1Util.newObject,d=j.x509,o=d.AlgorithmIdentifier,g=a.crypto,n=g.ECDSA,c=g.DSA;this.getASN1Object=function(){if(this.asn1AlgId==null||this.asn1SubjPKey==null){throw"algId and/or subjPubKey not set"}var p=new e({array:[this.asn1AlgId,this.asn1SubjPKey]});return p};this.getEncodedHex=function(){var p=this.getASN1Object();this.hTLV=p.getEncodedHex();return this.hTLV};this.setPubKey=function(q){try{if(q instanceof RSAKey){var u=h({seq:[{"int":{bigint:q.n}},{"int":{"int":q.e}}]});var s=u.getEncodedHex();this.asn1AlgId=new o({name:"rsaEncryption"});this.asn1SubjPKey=new b({hex:"00"+s})}}catch(p){}try{if(q instanceof KJUR.crypto.ECDSA){var r=new m({name:q.curveName});this.asn1AlgId=new o({name:"ecPublicKey",asn1params:r});this.asn1SubjPKey=new b({hex:"00"+q.pubKeyHex})}}catch(p){}try{if(q instanceof KJUR.crypto.DSA){var r=new h({seq:[{"int":{bigint:q.p}},{"int":{bigint:q.q}},{"int":{bigint:q.g}}]});this.asn1AlgId=new o({name:"dsa",asn1params:r});var t=new i({bigint:q.y});this.asn1SubjPKey=new b({hex:"00"+t.getEncodedHex()})}}catch(p){}};if(f!==undefined){this.setPubKey(f)}};YAHOO.lang.extend(KJUR.asn1.x509.SubjectPublicKeyInfo,KJUR.asn1.ASN1Object);KJUR.asn1.x509.Time=function(f){KJUR.asn1.x509.Time.superclass.constructor.call(this);var e=null,a=null,d=KJUR,c=d.asn1,b=c.DERUTCTime,g=c.DERGeneralizedTime;this.setTimeParams=function(h){this.timeParams=h};this.getEncodedHex=function(){var h=null;if(this.timeParams!=null){if(this.type=="utc"){h=new b(this.timeParams)}else{h=new g(this.timeParams)}}else{if(this.type=="utc"){h=new b()}else{h=new g()}}this.TLV=h.getEncodedHex();return this.TLV};this.type="utc";if(f!==undefined){if(f.type!==undefined){this.type=f.type}else{if(f.str!==undefined){if(f.str.match(/^[0-9]{12}Z$/)){this.type="utc"}if(f.str.match(/^[0-9]{14}Z$/)){this.type="gen"}}}this.timeParams=f}};YAHOO.lang.extend(KJUR.asn1.x509.Time,KJUR.asn1.ASN1Object);KJUR.asn1.x509.AlgorithmIdentifier=function(d){KJUR.asn1.x509.AlgorithmIdentifier.superclass.constructor.call(this);this.nameAlg=null;this.asn1Alg=null;this.asn1Params=null;this.paramEmpty=false;var b=KJUR,a=b.asn1;this.getEncodedHex=function(){if(this.nameAlg===null&&this.asn1Alg===null){throw"algorithm not specified"}if(this.nameAlg!==null&&this.asn1Alg===null){this.asn1Alg=a.x509.OID.name2obj(this.nameAlg)}var e=[this.asn1Alg];if(this.asn1Params!==null){e.push(this.asn1Params)}var f=new a.DERSequence({array:e});this.hTLV=f.getEncodedHex();return this.hTLV};if(d!==undefined){if(d.name!==undefined){this.nameAlg=d.name}if(d.asn1params!==undefined){this.asn1Params=d.asn1params}if(d.paramempty!==undefined){this.paramEmpty=d.paramempty}}if(this.asn1Params===null&&this.paramEmpty===false&&this.nameAlg!==null){var c=this.nameAlg.toLowerCase();if(c.substr(-7,7)!=="withdsa"&&c.substr(-9,9)!=="withecdsa"){this.asn1Params=new a.DERNull()}}};YAHOO.lang.extend(KJUR.asn1.x509.AlgorithmIdentifier,KJUR.asn1.ASN1Object);KJUR.asn1.x509.GeneralName=function(e){KJUR.asn1.x509.GeneralName.superclass.constructor.call(this);var k=null,h=null,i={rfc822:"81",dns:"82",dn:"a4",uri:"86"},b=KJUR,f=b.asn1,d=f.DERIA5String,c=f.DERTaggedObject,j=f.ASN1Object,a=f.x509.X500Name,g=pemtohex;this.explicit=false;this.setByParam=function(r){var q=null;var n=null;if(r===undefined){return}if(r.rfc822!==undefined){this.type="rfc822";n=new d({str:r[this.type]})}if(r.dns!==undefined){this.type="dns";n=new d({str:r[this.type]})}if(r.uri!==undefined){this.type="uri";n=new d({str:r[this.type]})}if(r.dn!==undefined){this.type="dn";n=new a({str:r.dn})}if(r.ldapdn!==undefined){this.type="dn";n=new a({ldapstr:r.ldapdn})}if(r.certissuer!==undefined){this.type="dn";this.explicit=true;var o=r.certissuer;var m=null;if(o.match(/^[0-9A-Fa-f]+$/)){m==o}if(o.indexOf("-----BEGIN ")!=-1){m=g(o)}if(m==null){throw"certissuer param not cert"}var l=new X509();l.hex=m;var p=l.getIssuerHex();n=new j();n.hTLV=p}if(r.certsubj!==undefined){this.type="dn";this.explicit=true;var o=r.certsubj;var m=null;if(o.match(/^[0-9A-Fa-f]+$/)){m==o}if(o.indexOf("-----BEGIN ")!=-1){m=g(o)}if(m==null){throw"certsubj param not cert"}var l=new X509();l.hex=m;var p=l.getSubjectHex();n=new j();n.hTLV=p}if(this.type==null){throw"unsupported type in params="+r}this.asn1Obj=new c({explicit:this.explicit,tag:i[this.type],obj:n})};this.getEncodedHex=function(){return this.asn1Obj.getEncodedHex()};if(e!==undefined){this.setByParam(e)}};YAHOO.lang.extend(KJUR.asn1.x509.GeneralName,KJUR.asn1.ASN1Object);KJUR.asn1.x509.GeneralNames=function(d){KJUR.asn1.x509.GeneralNames.superclass.constructor.call(this);var a=null,c=KJUR,b=c.asn1;this.setByParamArray=function(g){for(var e=0;e0){r=new b({obj:this.dUnsignedAttrs,tag:"a1",explicit:false})}var q=[this.dCMSVersion,this.dSignerIdentifier,this.dDigestAlgorithm,o,this.dSigAlg,this.dSig,];if(r!=null){q.push(r)}var p=new h.DERSequence({array:q});this.hTLV=p.getEncodedHex();return this.hTLV}};YAHOO.lang.extend(KJUR.asn1.cms.SignerInfo,KJUR.asn1.ASN1Object);KJUR.asn1.cms.EncapsulatedContentInfo=function(g){var c=KJUR,b=c.asn1,e=b.DERTaggedObject,a=b.DERSequence,h=b.DERObjectIdentifier,d=b.DEROctetString,f=b.cms;f.EncapsulatedContentInfo.superclass.constructor.call(this);this.dEContentType=new h({name:"data"});this.dEContent=null;this.isDetached=false;this.eContentValueHex=null;this.setContentType=function(i){if(i.match(/^[0-2][.][0-9.]+$/)){this.dEContentType=new h({oid:i})}else{this.dEContentType=new h({name:i})}};this.setContentValue=function(i){if(i!==undefined){if(typeof i.hex=="string"){this.eContentValueHex=i.hex}else{if(typeof i.str=="string"){this.eContentValueHex=utf8tohex(i.str)}}}};this.setContentValueHex=function(i){this.eContentValueHex=i};this.setContentValueStr=function(i){this.eContentValueHex=utf8tohex(i)};this.getEncodedHex=function(){if(typeof this.eContentValueHex!="string"){throw"eContentValue not yet set"}var k=new d({hex:this.eContentValueHex});this.dEContent=new e({obj:k,tag:"a0",explicit:true});var i=[this.dEContentType];if(!this.isDetached){i.push(this.dEContent)}var j=new a({array:i});this.hTLV=j.getEncodedHex();return this.hTLV}};YAHOO.lang.extend(KJUR.asn1.cms.EncapsulatedContentInfo,KJUR.asn1.ASN1Object);KJUR.asn1.cms.ContentInfo=function(f){var c=KJUR,b=c.asn1,d=b.DERTaggedObject,a=b.DERSequence,e=b.x509;KJUR.asn1.cms.ContentInfo.superclass.constructor.call(this);this.dContentType=null;this.dContent=null;this.setContentType=function(g){if(typeof g=="string"){this.dContentType=e.OID.name2obj(g)}};this.getEncodedHex=function(){var h=new d({obj:this.dContent,tag:"a0",explicit:true});var g=new a({array:[this.dContentType,h]});this.hTLV=g.getEncodedHex();return this.hTLV};if(f!==undefined){if(f.type){this.setContentType(f.type)}if(f.obj&&f.obj instanceof b.ASN1Object){this.dContent=f.obj}}};YAHOO.lang.extend(KJUR.asn1.cms.ContentInfo,KJUR.asn1.ASN1Object);KJUR.asn1.cms.SignedData=function(e){var a=KJUR,h=a.asn1,j=h.ASN1Object,g=h.DERInteger,m=h.DERSet,f=h.DERSequence,b=h.DERTaggedObject,l=h.cms,i=l.EncapsulatedContentInfo,d=l.SignerInfo,n=l.ContentInfo,c=h.x509,k=c.AlgorithmIdentifier;KJUR.asn1.cms.SignedData.superclass.constructor.call(this);this.dCMSVersion=new g({"int":1});this.dDigestAlgs=null;this.digestAlgNameList=[];this.dEncapContentInfo=new i();this.dCerts=null;this.certificateList=[];this.crlList=[];this.signerInfoList=[new d()];this.addCertificatesByPEM=function(p){var q=pemtohex(p);var r=new j();r.hTLV=q;this.certificateList.push(r)};this.getEncodedHex=function(){if(typeof this.hTLV=="string"){return this.hTLV}if(this.dDigestAlgs==null){var u=[];for(var t=0;t0){var v=new m({array:this.certificateList});this.dCerts=new b({obj:v,tag:"a0",explicit:false})}}if(this.dCerts!=null){p.push(this.dCerts)}var r=new m({array:this.signerInfoList});p.push(r);var q=new f({array:p});this.hTLV=q.getEncodedHex();return this.hTLV};this.getContentInfo=function(){this.getEncodedHex();var o=new n({type:"signed-data",obj:this});return o};this.getContentInfoEncodedHex=function(){var o=this.getContentInfo();var p=o.getEncodedHex();return p};this.getPEM=function(){return hextopem(this.getContentInfoEncodedHex(),"CMS")}};YAHOO.lang.extend(KJUR.asn1.cms.SignedData,KJUR.asn1.ASN1Object);KJUR.asn1.cms.CMSUtil=new function(){};KJUR.asn1.cms.CMSUtil.newSignedData=function(d){var b=KJUR,j=b.asn1,q=j.cms,f=q.SignerInfo,n=q.SignedData,o=q.SigningTime,a=q.SigningCertificate,p=q.SigningCertificateV2,c=j.cades,e=c.SignaturePolicyIdentifier;var m=new n();m.dEncapContentInfo.setContentValue(d.content);if(typeof d.certs=="object"){for(var h=0;h0){var s=new f({array:this.extensionsArray});var r=new m({array:[s]});var q=new f({array:[new k({oid:"1.2.840.113549.1.9.14"}),r]});var p=new c({explicit:true,tag:"a0",obj:q});this.asn1Array.push(p)}else{var p=new c({explicit:false,tag:"a0",obj:new j()});this.asn1Array.push(p)}var t=new f({array:this.asn1Array});this.hTLV=t.getEncodedHex();this.isModified=false;return this.hTLV};this._initialize()};YAHOO.lang.extend(KJUR.asn1.csr.CertificationRequestInfo,KJUR.asn1.ASN1Object);KJUR.asn1.csr.CSRUtil=new function(){};KJUR.asn1.csr.CSRUtil.newCSRPEM=function(h){var c=KEYUTIL,b=KJUR.asn1.csr;if(h.subject===undefined){throw"parameter subject undefined"}if(h.sbjpubkey===undefined){throw"parameter sbjpubkey undefined"}if(h.sigalg===undefined){throw"parameter sigalg undefined"}if(h.sbjprvkey===undefined){throw"parameter sbjpubkey undefined"}var d=new b.CertificationRequestInfo();d.setSubjectByParam(h.subject);d.setSubjectPublicKeyByGetKey(h.sbjpubkey);if(h.ext!==undefined&&h.ext.length!==undefined){for(var e=0;e"7"){return"00"+a}return a}function intarystrtohex(b){b=b.replace(/^\s*\[\s*/,"");b=b.replace(/\s*\]\s*$/,"");b=b.replace(/\s*/g,"");try{var c=b.split(/,/).map(function(g,e,h){var f=parseInt(g);if(f<0||255a.length){d=a.length}for(var b=0;bd){throw"key is too short for SigAlg: keylen="+j+","+a}var b="0001";var k="00"+c;var g="";var l=d-b.length-k.length;for(var f=0;f=0;--p){q=q.twice2D();q.z=BigInteger.ONE;if(o.testBit(p)){if(n.testBit(p)){q=q.add2D(t)}else{q=q.add2D(s)}}else{if(n.testBit(p)){q=q.add2D(r)}}}return q}this.getBigRandom=function(i){return new BigInteger(i.bitLength(),a).mod(i.subtract(BigInteger.ONE)).add(BigInteger.ONE)};this.setNamedCurve=function(i){this.ecparams=KJUR.crypto.ECParameterDB.getByName(i);this.prvKeyHex=null;this.pubKeyHex=null;this.curveName=i};this.setPrivateKeyHex=function(i){this.isPrivate=true;this.prvKeyHex=i};this.setPublicKeyHex=function(i){this.isPublic=true;this.pubKeyHex=i};this.getPublicKeyXYHex=function(){var k=this.pubKeyHex;if(k.substr(0,2)!=="04"){throw"this method supports uncompressed format(04) only"}var j=this.ecparams.keylen/4;if(k.length!==2+j*2){throw"malformed public key hex length"}var i={};i.x=k.substr(2,j);i.y=k.substr(2+j);return i};this.getShortNISTPCurveName=function(){var i=this.curveName;if(i==="secp256r1"||i==="NIST P-256"||i==="P-256"||i==="prime256v1"){return"P-256"}if(i==="secp384r1"||i==="NIST P-384"||i==="P-384"){return"P-384"}return null};this.generateKeyPairHex=function(){var k=this.ecparams.n;var n=this.getBigRandom(k);var l=this.ecparams.G.multiply(n);var q=l.getX().toBigInteger();var o=l.getY().toBigInteger();var i=this.ecparams.keylen/4;var m=("0000000000"+n.toString(16)).slice(-i);var r=("0000000000"+q.toString(16)).slice(-i);var p=("0000000000"+o.toString(16)).slice(-i);var j="04"+r+p;this.setPrivateKeyHex(m);this.setPublicKeyHex(j);return{ecprvhex:m,ecpubhex:j}};this.signWithMessageHash=function(i){return this.signHex(i,this.prvKeyHex)};this.signHex=function(o,j){var t=new BigInteger(j,16);var l=this.ecparams.n;var q=new BigInteger(o,16);do{var m=this.getBigRandom(l);var u=this.ecparams.G;var p=u.multiply(m);var i=p.getX().toBigInteger().mod(l)}while(i.compareTo(BigInteger.ZERO)<=0);var v=m.modInverse(l).multiply(q.add(t.multiply(i))).mod(l);return KJUR.crypto.ECDSA.biRSSigToASN1Sig(i,v)};this.sign=function(m,u){var q=u;var j=this.ecparams.n;var p=BigInteger.fromByteArrayUnsigned(m);do{var l=this.getBigRandom(j);var t=this.ecparams.G;var o=t.multiply(l);var i=o.getX().toBigInteger().mod(j)}while(i.compareTo(BigInteger.ZERO)<=0);var v=l.modInverse(j).multiply(p.add(q.multiply(i))).mod(j);return this.serializeSig(i,v)};this.verifyWithMessageHash=function(j,i){return this.verifyHex(j,i,this.pubKeyHex)};this.verifyHex=function(m,i,p){var l,j;var o=KJUR.crypto.ECDSA.parseSigHex(i);l=o.r;j=o.s;var k;k=ECPointFp.decodeFromHex(this.ecparams.curve,p);var n=new BigInteger(m,16);return this.verifyRaw(n,l,j,k)};this.verify=function(o,p,j){var l,i;if(Bitcoin.Util.isArray(p)){var n=this.parseSig(p);l=n.r;i=n.s}else{if("object"===typeof p&&p.r&&p.s){l=p.r;i=p.s}else{throw"Invalid value for signature"}}var k;if(j instanceof ECPointFp){k=j}else{if(Bitcoin.Util.isArray(j)){k=ECPointFp.decodeFrom(this.ecparams.curve,j)}else{throw"Invalid format for pubkey value, must be byte array or ECPointFp"}}var m=BigInteger.fromByteArrayUnsigned(o);return this.verifyRaw(m,l,i,k)};this.verifyRaw=function(o,i,w,m){var l=this.ecparams.n;var u=this.ecparams.G;if(i.compareTo(BigInteger.ONE)<0||i.compareTo(l)>=0){return false}if(w.compareTo(BigInteger.ONE)<0||w.compareTo(l)>=0){return false}var p=w.modInverse(l);var k=o.multiply(p).mod(l);var j=i.multiply(p).mod(l);var q=u.multiply(k).add(m.multiply(j));var t=q.getX().toBigInteger().mod(l);return t.equals(i)};this.serializeSig=function(k,j){var l=k.toByteArraySigned();var i=j.toByteArraySigned();var m=[];m.push(2);m.push(l.length);m=m.concat(l);m.push(2);m.push(i.length);m=m.concat(i);m.unshift(m.length);m.unshift(48);return m};this.parseSig=function(n){var m;if(n[0]!=48){throw new Error("Signature not a valid DERSequence")}m=2;if(n[m]!=2){throw new Error("First element in signature must be a DERInteger")}var l=n.slice(m+2,m+2+n[m+1]);m+=2+n[m+1];if(n[m]!=2){throw new Error("Second element in signature must be a DERInteger")}var i=n.slice(m+2,m+2+n[m+1]);m+=2+n[m+1];var k=BigInteger.fromByteArrayUnsigned(l);var j=BigInteger.fromByteArrayUnsigned(i);return{r:k,s:j}};this.parseSigCompact=function(m){if(m.length!==65){throw"Signature has the wrong length"}var j=m[0]-27;if(j<0||j>7){throw"Invalid signature type"}var o=this.ecparams.n;var l=BigInteger.fromByteArrayUnsigned(m.slice(1,33)).mod(o);var k=BigInteger.fromByteArrayUnsigned(m.slice(33,65)).mod(o);return{r:l,s:k,i:j}};this.readPKCS5PrvKeyHex=function(l){var n=ASN1HEX;var m=KJUR.crypto.ECDSA.getName;var p=n.getVbyList;if(n.isASN1HEX(l)===false){throw"not ASN.1 hex string"}var i,k,o;try{i=p(l,0,[2,0],"06");k=p(l,0,[1],"04");try{o=p(l,0,[3,0],"03").substr(2)}catch(j){}}catch(j){throw"malformed PKCS#1/5 plain ECC private key"}this.curveName=m(i);if(this.curveName===undefined){throw"unsupported curve name"}this.setNamedCurve(this.curveName);this.setPublicKeyHex(o);this.setPrivateKeyHex(k);this.isPublic=false};this.readPKCS8PrvKeyHex=function(l){var q=ASN1HEX;var i=KJUR.crypto.ECDSA.getName;var n=q.getVbyList;if(q.isASN1HEX(l)===false){throw"not ASN.1 hex string"}var j,p,m,k;try{j=n(l,0,[1,0],"06");p=n(l,0,[1,1],"06");m=n(l,0,[2,0,1],"04");try{k=n(l,0,[2,0,2,0],"03").substr(2)}catch(o){}}catch(o){throw"malformed PKCS#8 plain ECC private key"}this.curveName=i(p);if(this.curveName===undefined){throw"unsupported curve name"}this.setNamedCurve(this.curveName);this.setPublicKeyHex(k);this.setPrivateKeyHex(m);this.isPublic=false};this.readPKCS8PubKeyHex=function(l){var n=ASN1HEX;var m=KJUR.crypto.ECDSA.getName;var p=n.getVbyList;if(n.isASN1HEX(l)===false){throw"not ASN.1 hex string"}var k,i,o;try{k=p(l,0,[0,0],"06");i=p(l,0,[0,1],"06");o=p(l,0,[1],"03").substr(2)}catch(j){throw"malformed PKCS#8 ECC public key"}this.curveName=m(i);if(this.curveName===null){throw"unsupported curve name"}this.setNamedCurve(this.curveName);this.setPublicKeyHex(o)};this.readCertPubKeyHex=function(k,p){if(p!==5){p=6}var m=ASN1HEX;var l=KJUR.crypto.ECDSA.getName;var o=m.getVbyList;if(m.isASN1HEX(k)===false){throw"not ASN.1 hex string"}var i,n;try{i=o(k,0,[0,p,0,1],"06");n=o(k,0,[0,p,1],"03").substr(2)}catch(j){throw"malformed X.509 certificate ECC public key"}this.curveName=l(i);if(this.curveName===null){throw"unsupported curve name"}this.setNamedCurve(this.curveName);this.setPublicKeyHex(n)};if(h!==undefined){if(h.curve!==undefined){this.curveName=h.curve}}if(this.curveName===undefined){this.curveName=e}this.setNamedCurve(this.curveName);if(h!==undefined){if(h.prv!==undefined){this.setPrivateKeyHex(h.prv)}if(h.pub!==undefined){this.setPublicKeyHex(h.pub)}}};KJUR.crypto.ECDSA.parseSigHex=function(a){var b=KJUR.crypto.ECDSA.parseSigHexInHexRS(a);var d=new BigInteger(b.r,16);var c=new BigInteger(b.s,16);return{r:d,s:c}};KJUR.crypto.ECDSA.parseSigHexInHexRS=function(f){var j=ASN1HEX;var i=j.getChildIdx;var g=j.getV;if(f.substr(0,2)!="30"){throw"signature is not a ASN.1 sequence"}var h=i(f,0);if(h.length!=2){throw"number of signature ASN.1 sequence elements seem wrong"}var e=h[0];var d=h[1];if(f.substr(e,2)!="02"){throw"1st item of sequene of signature is not ASN.1 integer"}if(f.substr(d,2)!="02"){throw"2nd item of sequene of signature is not ASN.1 integer"}var c=g(f,e);var b=g(f,d);return{r:c,s:b}};KJUR.crypto.ECDSA.asn1SigToConcatSig=function(c){var d=KJUR.crypto.ECDSA.parseSigHexInHexRS(c);var b=d.r;var a=d.s;if(b.substr(0,2)=="00"&&(((b.length/2)*8)%(16*8))==8){b=b.substr(2)}if(a.substr(0,2)=="00"&&(((a.length/2)*8)%(16*8))==8){a=a.substr(2)}if((((b.length/2)*8)%(16*8))!=0){throw"unknown ECDSA sig r length error"}if((((a.length/2)*8)%(16*8))!=0){throw"unknown ECDSA sig s length error"}return b+a};KJUR.crypto.ECDSA.concatSigToASN1Sig=function(a){if((((a.length/2)*8)%(16*8))!=0){throw"unknown ECDSA concatinated r-s sig length error"}var c=a.substr(0,a.length/2);var b=a.substr(a.length/2);return KJUR.crypto.ECDSA.hexRSSigToASN1Sig(c,b)};KJUR.crypto.ECDSA.hexRSSigToASN1Sig=function(b,a){var d=new BigInteger(b,16);var c=new BigInteger(a,16);return KJUR.crypto.ECDSA.biRSSigToASN1Sig(d,c)};KJUR.crypto.ECDSA.biRSSigToASN1Sig=function(f,d){var c=KJUR.asn1;var b=new c.DERInteger({bigint:f});var a=new c.DERInteger({bigint:d});var e=new c.DERSequence({array:[b,a]});return e.getEncodedHex()};KJUR.crypto.ECDSA.getName=function(a){if(a==="2a8648ce3d030107"){return"secp256r1"}if(a==="2b8104000a"){return"secp256k1"}if(a==="2b81040022"){return"secp384r1"}if("|secp256r1|NIST P-256|P-256|prime256v1|".indexOf(a)!==-1){return"secp256r1"}if("|secp256k1|".indexOf(a)!==-1){return"secp256k1"}if("|secp384r1|NIST P-384|P-384|".indexOf(a)!==-1){return"secp384r1"}return null}; -if(typeof KJUR=="undefined"||!KJUR){KJUR={}}if(typeof KJUR.crypto=="undefined"||!KJUR.crypto){KJUR.crypto={}}KJUR.crypto.ECParameterDB=new function(){var b={};var c={};function a(d){return new BigInteger(d,16)}this.getByName=function(e){var d=e;if(typeof c[d]!="undefined"){d=c[e]}if(typeof b[d]!="undefined"){return b[d]}throw"unregistered EC curve name: "+d};this.regist=function(A,l,o,g,m,e,j,f,k,u,d,x){b[A]={};var s=a(o);var z=a(g);var y=a(m);var t=a(e);var w=a(j);var r=new ECCurveFp(s,z,y);var q=r.decodePointHex("04"+f+k);b[A]["name"]=A;b[A]["keylen"]=l;b[A]["curve"]=r;b[A]["G"]=q;b[A]["n"]=t;b[A]["h"]=w;b[A]["oid"]=d;b[A]["info"]=x;for(var v=0;v1){g=new BigInteger(i,16)}else{g=null}h=new BigInteger(j,16);this.setPrivate(c,a,e,g,h)};this.setPublic=function(c,b,a,d){this.isPublic=true;this.p=c;this.q=b;this.g=a;this.y=d;this.x=null};this.setPublicHex=function(f,e,d,g){var b,a,h,c;b=new BigInteger(f,16);a=new BigInteger(e,16);h=new BigInteger(d,16);c=new BigInteger(g,16);this.setPublic(b,a,h,c)};this.signWithMessageHash=function(d){var c=this.p;var b=this.q;var f=this.g;var i=this.y;var j=this.x;var e=KJUR.crypto.Util.getRandomBigIntegerMinToMax(BigInteger.ONE.add(BigInteger.ONE),b.subtract(BigInteger.ONE));var l=d.substr(0,b.bitLength()/4);var h=new BigInteger(l,16);var a=(f.modPow(e,c)).mod(b);var n=(e.modInverse(b).multiply(h.add(j.multiply(a)))).mod(b);var m=KJUR.asn1.ASN1Util.jsonToASN1HEX({seq:[{"int":{bigint:a}},{"int":{bigint:n}}]});return m};this.verifyWithMessageHash=function(h,f){var d=this.p;var b=this.q;var j=this.g;var l=this.y;var i=this.parseASN1Signature(f);var a=i[0];var t=i[1];var o=h.substr(0,b.bitLength()/4);var k=new BigInteger(o,16);if(BigInteger.ZERO.compareTo(a)>0||a.compareTo(b)>0){throw"invalid DSA signature"}if(BigInteger.ZERO.compareTo(t)>=0||t.compareTo(b)>0){throw"invalid DSA signature"}var m=t.modInverse(b);var e=k.multiply(m).mod(b);var c=a.multiply(m).mod(b);var n=j.modPow(e,d).multiply(l.modPow(c,d)).mod(d).mod(b);return n.compareTo(a)==0};this.parseASN1Signature=function(a){try{var d=new BigInteger(ASN1HEX.getVbyList(a,0,[0],"02"),16);var c=new BigInteger(ASN1HEX.getVbyList(a,0,[1],"02"),16);return[d,c]}catch(b){throw"malformed ASN.1 DSA signature"}};this.readPKCS5PrvKeyHex=function(c){var b,a,f,g,i;var j=ASN1HEX;var d=j.getVbyList;if(j.isASN1HEX(c)===false){throw"not ASN.1 hex string"}try{b=d(c,0,[1],"02");a=d(c,0,[2],"02");f=d(c,0,[3],"02");g=d(c,0,[4],"02");i=d(c,0,[5],"02")}catch(e){console.log("EXCEPTION:"+e);throw"malformed PKCS#1/5 plain DSA private key"}this.setPrivateHex(b,a,f,g,i)};this.readPKCS8PrvKeyHex=function(d){var f,c,b,g;var e=ASN1HEX;var i=e.getVbyList;if(e.isASN1HEX(d)===false){throw"not ASN.1 hex string"}try{f=i(d,0,[1,1,0],"02");c=i(d,0,[1,1,1],"02");b=i(d,0,[1,1,2],"02");g=i(d,0,[2,0],"02")}catch(a){console.log("EXCEPTION:"+a);throw"malformed PKCS#8 plain DSA private key"}this.setPrivateHex(f,c,b,null,g)};this.readPKCS8PubKeyHex=function(d){var f,c,b,g;var e=ASN1HEX;var i=e.getVbyList;if(e.isASN1HEX(d)===false){throw"not ASN.1 hex string"}try{f=i(d,0,[0,1,0],"02");c=i(d,0,[0,1,1],"02");b=i(d,0,[0,1,2],"02");g=i(d,0,[1,0],"02")}catch(a){console.log("EXCEPTION:"+a);throw"malformed PKCS#8 DSA public key"}this.setPublicHex(f,c,b,g)};this.readCertPubKeyHex=function(c,f){if(f!==5){f=6}var b,a,g,i;var j=ASN1HEX;var d=j.getVbyList;if(j.isASN1HEX(c)===false){throw"not ASN.1 hex string"}try{b=d(c,0,[0,f,0,1,0],"02");a=d(c,0,[0,f,0,1,1],"02");g=d(c,0,[0,f,0,1,2],"02");i=d(c,0,[0,f,1,0],"02")}catch(e){console.log("EXCEPTION:"+e);throw"malformed X.509 certificate DSA public key"}this.setPublicHex(b,a,g,i)}}; -var KEYUTIL=function(){var d=function(p,r,q){return k(CryptoJS.AES,p,r,q)};var e=function(p,r,q){return k(CryptoJS.TripleDES,p,r,q)};var a=function(p,r,q){return k(CryptoJS.DES,p,r,q)};var k=function(s,x,u,q){var r=CryptoJS.enc.Hex.parse(x);var w=CryptoJS.enc.Hex.parse(u);var p=CryptoJS.enc.Hex.parse(q);var t={};t.key=w;t.iv=p;t.ciphertext=r;var v=s.decrypt(t,w,{iv:p});return CryptoJS.enc.Hex.stringify(v)};var l=function(p,r,q){return g(CryptoJS.AES,p,r,q)};var o=function(p,r,q){return g(CryptoJS.TripleDES,p,r,q)};var f=function(p,r,q){return g(CryptoJS.DES,p,r,q)};var g=function(t,y,v,q){var s=CryptoJS.enc.Hex.parse(y);var x=CryptoJS.enc.Hex.parse(v);var p=CryptoJS.enc.Hex.parse(q);var w=t.encrypt(s,x,{iv:p});var r=CryptoJS.enc.Hex.parse(w.toString());var u=CryptoJS.enc.Base64.stringify(r);return u};var i={"AES-256-CBC":{proc:d,eproc:l,keylen:32,ivlen:16},"AES-192-CBC":{proc:d,eproc:l,keylen:24,ivlen:16},"AES-128-CBC":{proc:d,eproc:l,keylen:16,ivlen:16},"DES-EDE3-CBC":{proc:e,eproc:o,keylen:24,ivlen:8},"DES-CBC":{proc:a,eproc:f,keylen:8,ivlen:8}};var c=function(p){return i[p]["proc"]};var m=function(p){var r=CryptoJS.lib.WordArray.random(p);var q=CryptoJS.enc.Hex.stringify(r);return q};var n=function(v){var w={};var q=v.match(new RegExp("DEK-Info: ([^,]+),([0-9A-Fa-f]+)","m"));if(q){w.cipher=q[1];w.ivsalt=q[2]}var p=v.match(new RegExp("-----BEGIN ([A-Z]+) PRIVATE KEY-----"));if(p){w.type=p[1]}var u=-1;var x=0;if(v.indexOf("\r\n\r\n")!=-1){u=v.indexOf("\r\n\r\n");x=2}if(v.indexOf("\n\n")!=-1){u=v.indexOf("\n\n");x=1}var t=v.indexOf("-----END");if(u!=-1&&t!=-1){var r=v.substring(u+x*2,t-x);r=r.replace(/\s+/g,"");w.data=r}return w};var j=function(q,y,p){var v=p.substring(0,16);var t=CryptoJS.enc.Hex.parse(v);var r=CryptoJS.enc.Utf8.parse(y);var u=i[q]["keylen"]+i[q]["ivlen"];var x="";var w=null;for(;;){var s=CryptoJS.algo.MD5.create();if(w!=null){s.update(w)}s.update(r);s.update(t);w=s.finalize();x=x+CryptoJS.enc.Hex.stringify(w);if(x.length>=u*2){break}}var z={};z.keyhex=x.substr(0,i[q]["keylen"]*2);z.ivhex=x.substr(i[q]["keylen"]*2,i[q]["ivlen"]*2);return z};var b=function(p,v,r,w){var s=CryptoJS.enc.Base64.parse(p);var q=CryptoJS.enc.Hex.stringify(s);var u=i[v]["proc"];var t=u(q,r,w);return t};var h=function(p,s,q,u){var r=i[s]["eproc"];var t=r(p,q,u);return t};return{version:"1.0.0",parsePKCS5PEM:function(p){return n(p)},getKeyAndUnusedIvByPasscodeAndIvsalt:function(q,p,r){return j(q,p,r)},decryptKeyB64:function(p,r,q,s){return b(p,r,q,s)},getDecryptedKeyHex:function(y,x){var q=n(y);var t=q.type;var r=q.cipher;var p=q.ivsalt;var s=q.data;var w=j(r,x,p);var v=w.keyhex;var u=b(s,r,v,p);return u},getEncryptedPKCS5PEMFromPrvKeyHex:function(x,s,A,t,r){var p="";if(typeof t=="undefined"||t==null){t="AES-256-CBC"}if(typeof i[t]=="undefined"){throw"KEYUTIL unsupported algorithm: "+t}if(typeof r=="undefined"||r==null){var v=i[t]["ivlen"];var u=m(v);r=u.toUpperCase()}var z=j(t,A,r);var y=z.keyhex;var w=h(s,t,y,r);var q=w.replace(/(.{64})/g,"$1\r\n");var p="-----BEGIN "+x+" PRIVATE KEY-----\r\n";p+="Proc-Type: 4,ENCRYPTED\r\n";p+="DEK-Info: "+t+","+r+"\r\n";p+="\r\n";p+=q;p+="\r\n-----END "+x+" PRIVATE KEY-----\r\n";return p},parseHexOfEncryptedPKCS8:function(y){var B=ASN1HEX;var z=B.getChildIdx;var w=B.getV;var t={};var r=z(y,0);if(r.length!=2){throw"malformed format: SEQUENCE(0).items != 2: "+r.length}t.ciphertext=w(y,r[1]);var A=z(y,r[0]);if(A.length!=2){throw"malformed format: SEQUENCE(0.0).items != 2: "+A.length}if(w(y,A[0])!="2a864886f70d01050d"){throw"this only supports pkcs5PBES2"}var p=z(y,A[1]);if(A.length!=2){throw"malformed format: SEQUENCE(0.0.1).items != 2: "+p.length}var q=z(y,p[1]);if(q.length!=2){throw"malformed format: SEQUENCE(0.0.1.1).items != 2: "+q.length}if(w(y,q[0])!="2a864886f70d0307"){throw"this only supports TripleDES"}t.encryptionSchemeAlg="TripleDES";t.encryptionSchemeIV=w(y,q[1]);var s=z(y,p[0]);if(s.length!=2){throw"malformed format: SEQUENCE(0.0.1.0).items != 2: "+s.length}if(w(y,s[0])!="2a864886f70d01050c"){throw"this only supports pkcs5PBKDF2"}var x=z(y,s[1]);if(x.length<2){throw"malformed format: SEQUENCE(0.0.1.0.1).items < 2: "+x.length}t.pbkdf2Salt=w(y,x[0]);var u=w(y,x[1]);try{t.pbkdf2Iter=parseInt(u,16)}catch(v){throw"malformed format pbkdf2Iter: "+u}return t},getPBKDF2KeyHexFromParam:function(u,p){var t=CryptoJS.enc.Hex.parse(u.pbkdf2Salt);var q=u.pbkdf2Iter;var s=CryptoJS.PBKDF2(p,t,{keySize:192/32,iterations:q});var r=CryptoJS.enc.Hex.stringify(s);return r},_getPlainPKCS8HexFromEncryptedPKCS8PEM:function(x,y){var r=pemtohex(x,"ENCRYPTED PRIVATE KEY");var p=this.parseHexOfEncryptedPKCS8(r);var u=KEYUTIL.getPBKDF2KeyHexFromParam(p,y);var v={};v.ciphertext=CryptoJS.enc.Hex.parse(p.ciphertext);var t=CryptoJS.enc.Hex.parse(u);var s=CryptoJS.enc.Hex.parse(p.encryptionSchemeIV);var w=CryptoJS.TripleDES.decrypt(v,t,{iv:s});var q=CryptoJS.enc.Hex.stringify(w);return q},getKeyFromEncryptedPKCS8PEM:function(s,q){var p=this._getPlainPKCS8HexFromEncryptedPKCS8PEM(s,q);var r=this.getKeyFromPlainPrivatePKCS8Hex(p);return r},parsePlainPrivatePKCS8Hex:function(s){var v=ASN1HEX;var u=v.getChildIdx;var t=v.getV;var q={};q.algparam=null;if(s.substr(0,2)!="30"){throw"malformed plain PKCS8 private key(code:001)"}var r=u(s,0);if(r.length!=3){throw"malformed plain PKCS8 private key(code:002)"}if(s.substr(r[1],2)!="30"){throw"malformed PKCS8 private key(code:003)"}var p=u(s,r[1]);if(p.length!=2){throw"malformed PKCS8 private key(code:004)"}if(s.substr(p[0],2)!="06"){throw"malformed PKCS8 private key(code:005)"}q.algoid=t(s,p[0]);if(s.substr(p[1],2)=="06"){q.algparam=t(s,p[1])}if(s.substr(r[2],2)!="04"){throw"malformed PKCS8 private key(code:006)"}q.keyidx=v.getVidx(s,r[2]);return q},getKeyFromPlainPrivatePKCS8PEM:function(q){var p=pemtohex(q,"PRIVATE KEY");var r=this.getKeyFromPlainPrivatePKCS8Hex(p);return r},getKeyFromPlainPrivatePKCS8Hex:function(p){var q=this.parsePlainPrivatePKCS8Hex(p);var r;if(q.algoid=="2a864886f70d010101"){r=new RSAKey()}else{if(q.algoid=="2a8648ce380401"){r=new KJUR.crypto.DSA()}else{if(q.algoid=="2a8648ce3d0201"){r=new KJUR.crypto.ECDSA()}else{throw"unsupported private key algorithm"}}}r.readPKCS8PrvKeyHex(p);return r},_getKeyFromPublicPKCS8Hex:function(q){var p;var r=ASN1HEX.getVbyList(q,0,[0,0],"06");if(r==="2a864886f70d010101"){p=new RSAKey()}else{if(r==="2a8648ce380401"){p=new KJUR.crypto.DSA()}else{if(r==="2a8648ce3d0201"){p=new KJUR.crypto.ECDSA()}else{throw"unsupported PKCS#8 public key hex"}}}p.readPKCS8PubKeyHex(q);return p},parsePublicRawRSAKeyHex:function(r){var u=ASN1HEX;var t=u.getChildIdx;var s=u.getV;var p={};if(r.substr(0,2)!="30"){throw"malformed RSA key(code:001)"}var q=t(r,0);if(q.length!=2){throw"malformed RSA key(code:002)"}if(r.substr(q[0],2)!="02"){throw"malformed RSA key(code:003)"}p.n=s(r,q[0]);if(r.substr(q[1],2)!="02"){throw"malformed RSA key(code:004)"}p.e=s(r,q[1]);return p},parsePublicPKCS8Hex:function(t){var v=ASN1HEX;var u=v.getChildIdx;var s=v.getV;var q={};q.algparam=null;var r=u(t,0);if(r.length!=2){throw"outer DERSequence shall have 2 elements: "+r.length}var w=r[0];if(t.substr(w,2)!="30"){throw"malformed PKCS8 public key(code:001)"}var p=u(t,w);if(p.length!=2){throw"malformed PKCS8 public key(code:002)"}if(t.substr(p[0],2)!="06"){throw"malformed PKCS8 public key(code:003)"}q.algoid=s(t,p[0]);if(t.substr(p[1],2)=="06"){q.algparam=s(t,p[1])}else{if(t.substr(p[1],2)=="30"){q.algparam={};q.algparam.p=v.getVbyList(t,p[1],[0],"02");q.algparam.q=v.getVbyList(t,p[1],[1],"02");q.algparam.g=v.getVbyList(t,p[1],[2],"02")}}if(t.substr(r[1],2)!="03"){throw"malformed PKCS8 public key(code:004)"}q.key=s(t,r[1]).substr(2);return q},}}();KEYUTIL.getKey=function(l,k,n){var G=ASN1HEX,L=G.getChildIdx,v=G.getV,d=G.getVbyList,c=KJUR.crypto,i=c.ECDSA,C=c.DSA,w=RSAKey,M=pemtohex,F=KEYUTIL;if(typeof w!="undefined"&&l instanceof w){return l}if(typeof i!="undefined"&&l instanceof i){return l}if(typeof C!="undefined"&&l instanceof C){return l}if(l.curve!==undefined&&l.xy!==undefined&&l.d===undefined){return new i({pub:l.xy,curve:l.curve})}if(l.curve!==undefined&&l.d!==undefined){return new i({prv:l.d,curve:l.curve})}if(l.kty===undefined&&l.n!==undefined&&l.e!==undefined&&l.d===undefined){var P=new w();P.setPublic(l.n,l.e);return P}if(l.kty===undefined&&l.n!==undefined&&l.e!==undefined&&l.d!==undefined&&l.p!==undefined&&l.q!==undefined&&l.dp!==undefined&&l.dq!==undefined&&l.co!==undefined&&l.qi===undefined){var P=new w();P.setPrivateEx(l.n,l.e,l.d,l.p,l.q,l.dp,l.dq,l.co);return P}if(l.kty===undefined&&l.n!==undefined&&l.e!==undefined&&l.d!==undefined&&l.p===undefined){var P=new w();P.setPrivate(l.n,l.e,l.d);return P}if(l.p!==undefined&&l.q!==undefined&&l.g!==undefined&&l.y!==undefined&&l.x===undefined){var P=new C();P.setPublic(l.p,l.q,l.g,l.y);return P}if(l.p!==undefined&&l.q!==undefined&&l.g!==undefined&&l.y!==undefined&&l.x!==undefined){var P=new C();P.setPrivate(l.p,l.q,l.g,l.y,l.x);return P}if(l.kty==="RSA"&&l.n!==undefined&&l.e!==undefined&&l.d===undefined){var P=new w();P.setPublic(b64utohex(l.n),b64utohex(l.e));return P}if(l.kty==="RSA"&&l.n!==undefined&&l.e!==undefined&&l.d!==undefined&&l.p!==undefined&&l.q!==undefined&&l.dp!==undefined&&l.dq!==undefined&&l.qi!==undefined){var P=new w();P.setPrivateEx(b64utohex(l.n),b64utohex(l.e),b64utohex(l.d),b64utohex(l.p),b64utohex(l.q),b64utohex(l.dp),b64utohex(l.dq),b64utohex(l.qi));return P}if(l.kty==="RSA"&&l.n!==undefined&&l.e!==undefined&&l.d!==undefined){var P=new w();P.setPrivate(b64utohex(l.n),b64utohex(l.e),b64utohex(l.d));return P}if(l.kty==="EC"&&l.crv!==undefined&&l.x!==undefined&&l.y!==undefined&&l.d===undefined){var j=new i({curve:l.crv});var t=j.ecparams.keylen/4;var B=("0000000000"+b64utohex(l.x)).slice(-t);var z=("0000000000"+b64utohex(l.y)).slice(-t);var u="04"+B+z;j.setPublicKeyHex(u);return j}if(l.kty==="EC"&&l.crv!==undefined&&l.x!==undefined&&l.y!==undefined&&l.d!==undefined){var j=new i({curve:l.crv});var t=j.ecparams.keylen/4;var B=("0000000000"+b64utohex(l.x)).slice(-t);var z=("0000000000"+b64utohex(l.y)).slice(-t);var u="04"+B+z;var b=("0000000000"+b64utohex(l.d)).slice(-t);j.setPublicKeyHex(u);j.setPrivateKeyHex(b);return j}if(n==="pkcs5prv"){var J=l,G=ASN1HEX,N,P;N=L(J,0);if(N.length===9){P=new w();P.readPKCS5PrvKeyHex(J)}else{if(N.length===6){P=new C();P.readPKCS5PrvKeyHex(J)}else{if(N.length>2&&J.substr(N[1],2)==="04"){P=new i();P.readPKCS5PrvKeyHex(J)}else{throw"unsupported PKCS#1/5 hexadecimal key"}}}return P}if(n==="pkcs8prv"){var P=F.getKeyFromPlainPrivatePKCS8Hex(l);return P}if(n==="pkcs8pub"){return F._getKeyFromPublicPKCS8Hex(l)}if(n==="x509pub"){return X509.getPublicKeyFromCertHex(l)}if(l.indexOf("-END CERTIFICATE-",0)!=-1||l.indexOf("-END X509 CERTIFICATE-",0)!=-1||l.indexOf("-END TRUSTED CERTIFICATE-",0)!=-1){return X509.getPublicKeyFromCertPEM(l)}if(l.indexOf("-END PUBLIC KEY-")!=-1){var O=pemtohex(l,"PUBLIC KEY");return F._getKeyFromPublicPKCS8Hex(O)}if(l.indexOf("-END RSA PRIVATE KEY-")!=-1&&l.indexOf("4,ENCRYPTED")==-1){var m=M(l,"RSA PRIVATE KEY");return F.getKey(m,null,"pkcs5prv")}if(l.indexOf("-END DSA PRIVATE KEY-")!=-1&&l.indexOf("4,ENCRYPTED")==-1){var I=M(l,"DSA PRIVATE KEY");var E=d(I,0,[1],"02");var D=d(I,0,[2],"02");var K=d(I,0,[3],"02");var r=d(I,0,[4],"02");var s=d(I,0,[5],"02");var P=new C();P.setPrivate(new BigInteger(E,16),new BigInteger(D,16),new BigInteger(K,16),new BigInteger(r,16),new BigInteger(s,16));return P}if(l.indexOf("-END PRIVATE KEY-")!=-1){return F.getKeyFromPlainPrivatePKCS8PEM(l)}if(l.indexOf("-END RSA PRIVATE KEY-")!=-1&&l.indexOf("4,ENCRYPTED")!=-1){var o=F.getDecryptedKeyHex(l,k);var H=new RSAKey();H.readPKCS5PrvKeyHex(o);return H}if(l.indexOf("-END EC PRIVATE KEY-")!=-1&&l.indexOf("4,ENCRYPTED")!=-1){var I=F.getDecryptedKeyHex(l,k);var P=d(I,0,[1],"04");var f=d(I,0,[2,0],"06");var A=d(I,0,[3,0],"03").substr(2);var e="";if(KJUR.crypto.OID.oidhex2name[f]!==undefined){e=KJUR.crypto.OID.oidhex2name[f]}else{throw"undefined OID(hex) in KJUR.crypto.OID: "+f}var j=new i({curve:e});j.setPublicKeyHex(A);j.setPrivateKeyHex(P);j.isPublic=false;return j}if(l.indexOf("-END DSA PRIVATE KEY-")!=-1&&l.indexOf("4,ENCRYPTED")!=-1){var I=F.getDecryptedKeyHex(l,k);var E=d(I,0,[1],"02");var D=d(I,0,[2],"02");var K=d(I,0,[3],"02");var r=d(I,0,[4],"02");var s=d(I,0,[5],"02");var P=new C();P.setPrivate(new BigInteger(E,16),new BigInteger(D,16),new BigInteger(K,16),new BigInteger(r,16),new BigInteger(s,16));return P}if(l.indexOf("-END ENCRYPTED PRIVATE KEY-")!=-1){return F.getKeyFromEncryptedPKCS8PEM(l,k)}throw"not supported argument"};KEYUTIL.generateKeypair=function(a,c){if(a=="RSA"){var b=c;var h=new RSAKey();h.generate(b,"10001");h.isPrivate=true;h.isPublic=true;var f=new RSAKey();var e=h.n.toString(16);var i=h.e.toString(16);f.setPublic(e,i);f.isPrivate=false;f.isPublic=true;var k={};k.prvKeyObj=h;k.pubKeyObj=f;return k}else{if(a=="EC"){var d=c;var g=new KJUR.crypto.ECDSA({curve:d});var j=g.generateKeyPairHex();var h=new KJUR.crypto.ECDSA({curve:d});h.setPublicKeyHex(j.ecpubhex);h.setPrivateKeyHex(j.ecprvhex);h.isPrivate=true;h.isPublic=false;var f=new KJUR.crypto.ECDSA({curve:d});f.setPublicKeyHex(j.ecpubhex);f.isPrivate=false;f.isPublic=true;var k={};k.prvKeyObj=h;k.pubKeyObj=f;return k}else{throw"unknown algorithm: "+a}}};KEYUTIL.getPEM=function(b,D,y,m,q,j){var F=KJUR,k=F.asn1,z=k.DERObjectIdentifier,f=k.DERInteger,l=k.ASN1Util.newObject,a=k.x509,C=a.SubjectPublicKeyInfo,e=F.crypto,u=e.DSA,r=e.ECDSA,n=RSAKey;function A(s){var G=l({seq:[{"int":0},{"int":{bigint:s.n}},{"int":s.e},{"int":{bigint:s.d}},{"int":{bigint:s.p}},{"int":{bigint:s.q}},{"int":{bigint:s.dmp1}},{"int":{bigint:s.dmq1}},{"int":{bigint:s.coeff}}]});return G}function B(G){var s=l({seq:[{"int":1},{octstr:{hex:G.prvKeyHex}},{tag:["a0",true,{oid:{name:G.curveName}}]},{tag:["a1",true,{bitstr:{hex:"00"+G.pubKeyHex}}]}]});return s}function x(s){var G=l({seq:[{"int":0},{"int":{bigint:s.p}},{"int":{bigint:s.q}},{"int":{bigint:s.g}},{"int":{bigint:s.y}},{"int":{bigint:s.x}}]});return G}if(((n!==undefined&&b instanceof n)||(u!==undefined&&b instanceof u)||(r!==undefined&&b instanceof r))&&b.isPublic==true&&(D===undefined||D=="PKCS8PUB")){var E=new C(b);var w=E.getEncodedHex();return hextopem(w,"PUBLIC KEY")}if(D=="PKCS1PRV"&&n!==undefined&&b instanceof n&&(y===undefined||y==null)&&b.isPrivate==true){var E=A(b);var w=E.getEncodedHex();return hextopem(w,"RSA PRIVATE KEY")}if(D=="PKCS1PRV"&&r!==undefined&&b instanceof r&&(y===undefined||y==null)&&b.isPrivate==true){var i=new z({name:b.curveName});var v=i.getEncodedHex();var h=B(b);var t=h.getEncodedHex();var p="";p+=hextopem(v,"EC PARAMETERS");p+=hextopem(t,"EC PRIVATE KEY");return p}if(D=="PKCS1PRV"&&u!==undefined&&b instanceof u&&(y===undefined||y==null)&&b.isPrivate==true){var E=x(b);var w=E.getEncodedHex();return hextopem(w,"DSA PRIVATE KEY")}if(D=="PKCS5PRV"&&n!==undefined&&b instanceof n&&(y!==undefined&&y!=null)&&b.isPrivate==true){var E=A(b);var w=E.getEncodedHex();if(m===undefined){m="DES-EDE3-CBC"}return this.getEncryptedPKCS5PEMFromPrvKeyHex("RSA",w,y,m,j)}if(D=="PKCS5PRV"&&r!==undefined&&b instanceof r&&(y!==undefined&&y!=null)&&b.isPrivate==true){var E=B(b);var w=E.getEncodedHex();if(m===undefined){m="DES-EDE3-CBC"}return this.getEncryptedPKCS5PEMFromPrvKeyHex("EC",w,y,m,j)}if(D=="PKCS5PRV"&&u!==undefined&&b instanceof u&&(y!==undefined&&y!=null)&&b.isPrivate==true){var E=x(b);var w=E.getEncodedHex();if(m===undefined){m="DES-EDE3-CBC"}return this.getEncryptedPKCS5PEMFromPrvKeyHex("DSA",w,y,m,j)}var o=function(G,s){var I=c(G,s);var H=new l({seq:[{seq:[{oid:{name:"pkcs5PBES2"}},{seq:[{seq:[{oid:{name:"pkcs5PBKDF2"}},{seq:[{octstr:{hex:I.pbkdf2Salt}},{"int":I.pbkdf2Iter}]}]},{seq:[{oid:{name:"des-EDE3-CBC"}},{octstr:{hex:I.encryptionSchemeIV}}]}]}]},{octstr:{hex:I.ciphertext}}]});return H.getEncodedHex()};var c=function(N,O){var H=100;var M=CryptoJS.lib.WordArray.random(8);var L="DES-EDE3-CBC";var s=CryptoJS.lib.WordArray.random(8);var I=CryptoJS.PBKDF2(O,M,{keySize:192/32,iterations:H});var J=CryptoJS.enc.Hex.parse(N);var K=CryptoJS.TripleDES.encrypt(J,I,{iv:s})+"";var G={};G.ciphertext=K;G.pbkdf2Salt=CryptoJS.enc.Hex.stringify(M);G.pbkdf2Iter=H;G.encryptionSchemeAlg=L;G.encryptionSchemeIV=CryptoJS.enc.Hex.stringify(s);return G};if(D=="PKCS8PRV"&&n!=undefined&&b instanceof n&&b.isPrivate==true){var g=A(b);var d=g.getEncodedHex();var E=l({seq:[{"int":0},{seq:[{oid:{name:"rsaEncryption"}},{"null":true}]},{octstr:{hex:d}}]});var w=E.getEncodedHex();if(y===undefined||y==null){return hextopem(w,"PRIVATE KEY")}else{var t=o(w,y);return hextopem(t,"ENCRYPTED PRIVATE KEY")}}if(D=="PKCS8PRV"&&r!==undefined&&b instanceof r&&b.isPrivate==true){var g=new l({seq:[{"int":1},{octstr:{hex:b.prvKeyHex}},{tag:["a1",true,{bitstr:{hex:"00"+b.pubKeyHex}}]}]});var d=g.getEncodedHex();var E=l({seq:[{"int":0},{seq:[{oid:{name:"ecPublicKey"}},{oid:{name:b.curveName}}]},{octstr:{hex:d}}]});var w=E.getEncodedHex();if(y===undefined||y==null){return hextopem(w,"PRIVATE KEY")}else{var t=o(w,y);return hextopem(t,"ENCRYPTED PRIVATE KEY")}}if(D=="PKCS8PRV"&&u!==undefined&&b instanceof u&&b.isPrivate==true){var g=new f({bigint:b.x});var d=g.getEncodedHex();var E=l({seq:[{"int":0},{seq:[{oid:{name:"dsa"}},{seq:[{"int":{bigint:b.p}},{"int":{bigint:b.q}},{"int":{bigint:b.g}}]}]},{octstr:{hex:d}}]});var w=E.getEncodedHex();if(y===undefined||y==null){return hextopem(w,"PRIVATE KEY")}else{var t=o(w,y);return hextopem(t,"ENCRYPTED PRIVATE KEY")}}throw"unsupported object nor format"};KEYUTIL.getKeyFromCSRPEM=function(b){var a=pemtohex(b,"CERTIFICATE REQUEST");var c=KEYUTIL.getKeyFromCSRHex(a);return c};KEYUTIL.getKeyFromCSRHex=function(a){var c=KEYUTIL.parseCSRHex(a);var b=KEYUTIL.getKey(c.p8pubkeyhex,null,"pkcs8pub");return b};KEYUTIL.parseCSRHex=function(d){var i=ASN1HEX;var f=i.getChildIdx;var c=i.getTLV;var b={};var g=d;if(g.substr(0,2)!="30"){throw"malformed CSR(code:001)"}var e=f(g,0);if(e.length<1){throw"malformed CSR(code:002)"}if(g.substr(e[0],2)!="30"){throw"malformed CSR(code:003)"}var a=f(g,e[0]);if(a.length<3){throw"malformed CSR(code:004)"}b.p8pubkeyhex=c(g,a[2]);return b};KEYUTIL.getJWKFromKey=function(d){var b={};if(d instanceof RSAKey&&d.isPrivate){b.kty="RSA";b.n=hextob64u(d.n.toString(16));b.e=hextob64u(d.e.toString(16));b.d=hextob64u(d.d.toString(16));b.p=hextob64u(d.p.toString(16));b.q=hextob64u(d.q.toString(16));b.dp=hextob64u(d.dmp1.toString(16));b.dq=hextob64u(d.dmq1.toString(16));b.qi=hextob64u(d.coeff.toString(16));return b}else{if(d instanceof RSAKey&&d.isPublic){b.kty="RSA";b.n=hextob64u(d.n.toString(16));b.e=hextob64u(d.e.toString(16));return b}else{if(d instanceof KJUR.crypto.ECDSA&&d.isPrivate){var a=d.getShortNISTPCurveName();if(a!=="P-256"&&a!=="P-384"){throw"unsupported curve name for JWT: "+a}var c=d.getPublicKeyXYHex();b.kty="EC";b.crv=a;b.x=hextob64u(c.x);b.y=hextob64u(c.y);b.d=hextob64u(d.prvKeyHex);return b}else{if(d instanceof KJUR.crypto.ECDSA&&d.isPublic){var a=d.getShortNISTPCurveName();if(a!=="P-256"&&a!=="P-384"){throw"unsupported curve name for JWT: "+a}var c=d.getPublicKeyXYHex();b.kty="EC";b.crv=a;b.x=hextob64u(c.x);b.y=hextob64u(c.y);return b}}}}throw"not supported key object"}; -RSAKey.getPosArrayOfChildrenFromHex=function(a){return ASN1HEX.getChildIdx(a,0)};RSAKey.getHexValueArrayOfChildrenFromHex=function(f){var n=ASN1HEX;var i=n.getV;var k=RSAKey.getPosArrayOfChildrenFromHex(f);var e=i(f,k[0]);var j=i(f,k[1]);var b=i(f,k[2]);var c=i(f,k[3]);var h=i(f,k[4]);var g=i(f,k[5]);var m=i(f,k[6]);var l=i(f,k[7]);var d=i(f,k[8]);var k=new Array();k.push(e,j,b,c,h,g,m,l,d);return k};RSAKey.prototype.readPrivateKeyFromPEMString=function(d){var c=pemtohex(d);var b=RSAKey.getHexValueArrayOfChildrenFromHex(c);this.setPrivateEx(b[1],b[2],b[3],b[4],b[5],b[6],b[7],b[8])};RSAKey.prototype.readPKCS5PrvKeyHex=function(c){var b=RSAKey.getHexValueArrayOfChildrenFromHex(c);this.setPrivateEx(b[1],b[2],b[3],b[4],b[5],b[6],b[7],b[8])};RSAKey.prototype.readPKCS8PrvKeyHex=function(e){var c,j,l,b,a,f,d,k;var m=ASN1HEX;var g=m.getVbyList;if(m.isASN1HEX(e)===false){throw"not ASN.1 hex string"}try{c=g(e,0,[2,0,1],"02");j=g(e,0,[2,0,2],"02");l=g(e,0,[2,0,3],"02");b=g(e,0,[2,0,4],"02");a=g(e,0,[2,0,5],"02");f=g(e,0,[2,0,6],"02");d=g(e,0,[2,0,7],"02");k=g(e,0,[2,0,8],"02")}catch(i){throw"malformed PKCS#8 plain RSA private key"}this.setPrivateEx(c,j,l,b,a,f,d,k)};RSAKey.prototype.readPKCS5PubKeyHex=function(c){var e=ASN1HEX;var b=e.getV;if(e.isASN1HEX(c)===false){throw"keyHex is not ASN.1 hex string"}var a=e.getChildIdx(c,0);if(a.length!==2||c.substr(a[0],2)!=="02"||c.substr(a[1],2)!=="02"){throw"wrong hex for PKCS#5 public key"}var f=b(c,a[0]);var d=b(c,a[1]);this.setPublic(f,d)};RSAKey.prototype.readPKCS8PubKeyHex=function(b){var c=ASN1HEX;if(c.isASN1HEX(b)===false){throw"not ASN.1 hex string"}if(c.getTLVbyList(b,0,[0,0])!=="06092a864886f70d010101"){throw"not PKCS8 RSA public key"}var a=c.getTLVbyList(b,0,[1,0]);this.readPKCS5PubKeyHex(a)};RSAKey.prototype.readCertPubKeyHex=function(b,d){var a,c;a=new X509();a.readCertHex(b);c=a.getPublicKeyHex();this.readPKCS8PubKeyHex(c)}; -var _RE_HEXDECONLY=new RegExp("");_RE_HEXDECONLY.compile("[^0-9a-f]","gi");function _rsasign_getHexPaddedDigestInfoForString(d,e,a){var b=function(f){return KJUR.crypto.Util.hashString(f,a)};var c=b(d);return KJUR.crypto.Util.getPaddedDigestInfoHex(c,a,e)}function _zeroPaddingOfSignature(e,d){var c="";var a=d/4-e.length;for(var b=0;b>24,(d&16711680)>>16,(d&65280)>>8,d&255]))));d+=1}return b}RSAKey.prototype.signPSS=function(e,a,d){var c=function(f){return KJUR.crypto.Util.hashHex(f,a)};var b=c(rstrtohex(e));if(d===undefined){d=-1}return this.signWithMessageHashPSS(b,a,d)};RSAKey.prototype.signWithMessageHashPSS=function(l,a,k){var b=hextorstr(l);var g=b.length;var m=this.n.bitLength()-1;var c=Math.ceil(m/8);var d;var o=function(i){return KJUR.crypto.Util.hashHex(i,a)};if(k===-1||k===undefined){k=g}else{if(k===-2){k=c-g-2}else{if(k<-2){throw"invalid salt length"}}}if(c<(g+k+2)){throw"data too long"}var f="";if(k>0){f=new Array(k);new SecureRandom().nextBytes(f);f=String.fromCharCode.apply(String,f)}var n=hextorstr(o(rstrtohex("\x00\x00\x00\x00\x00\x00\x00\x00"+b+f)));var j=[];for(d=0;d>(8*c-m))&255;q[0]&=~p;for(d=0;dthis.n.bitLength()){return 0}var i=this.doPublic(b);var e=i.toString(16).replace(/^1f+00/,"");var g=_rsasign_getAlgNameAndHashFromHexDisgestInfo(e);if(g.length==0){return false}var d=g[0];var h=g[1];var a=function(k){return KJUR.crypto.Util.hashString(k,d)};var c=a(f);return(h==c)};RSAKey.prototype.verifyWithMessageHash=function(e,a){a=a.replace(_RE_HEXDECONLY,"");a=a.replace(/[ \n]+/g,"");var b=parseBigInt(a,16);if(b.bitLength()>this.n.bitLength()){return 0}var h=this.doPublic(b);var g=h.toString(16).replace(/^1f+00/,"");var c=_rsasign_getAlgNameAndHashFromHexDisgestInfo(g);if(c.length==0){return false}var d=c[0];var f=c[1];return(f==e)};RSAKey.prototype.verifyPSS=function(c,b,a,f){var e=function(g){return KJUR.crypto.Util.hashHex(g,a)};var d=e(rstrtohex(c));if(f===undefined){f=-1}return this.verifyWithMessageHashPSS(d,b,a,f)};RSAKey.prototype.verifyWithMessageHashPSS=function(f,s,l,c){var k=new BigInteger(s,16);if(k.bitLength()>this.n.bitLength()){return false}var r=function(i){return KJUR.crypto.Util.hashHex(i,l)};var j=hextorstr(f);var h=j.length;var g=this.n.bitLength()-1;var m=Math.ceil(g/8);var q;if(c===-1||c===undefined){c=h}else{if(c===-2){c=m-h-2}else{if(c<-2){throw"invalid salt length"}}}if(m<(h+c+2)){throw"data too long"}var a=this.doPublic(k).toByteArray();for(q=0;q>(8*m-g))&255;if((d.charCodeAt(0)&p)!==0){throw"bits beyond keysize not zero"}var n=pss_mgf1_str(e,d.length,r);var o=[];for(q=0;q0){var b=":"+n.join(":")+":";if(b.indexOf(":"+k+":")==-1){throw"algorithm '"+k+"' not accepted in the list"}}if(k!="none"&&B===null){throw"key shall be specified to verify."}if(typeof B=="string"&&B.indexOf("-----BEGIN ")!=-1){B=KEYUTIL.getKey(B)}if(z=="RS"||z=="PS"){if(!(B instanceof m)){throw"key shall be a RSAKey obj for RS* and PS* algs"}}if(z=="ES"){if(!(B instanceof p)){throw"key shall be a ECDSA obj for ES* algs"}}if(k=="none"){}var u=null;if(t.jwsalg2sigalg[l.alg]===undefined){throw"unsupported alg name: "+k}else{u=t.jwsalg2sigalg[k]}if(u=="none"){throw"not supported"}else{if(u.substr(0,4)=="Hmac"){var o=null;if(B===undefined){throw"hexadecimal key shall be specified for HMAC"}var j=new s({alg:u,pass:B});j.updateString(c);o=j.doFinal();return A==o}else{if(u.indexOf("withECDSA")!=-1){var h=null;try{h=p.concatSigToASN1Sig(A)}catch(v){return false}var g=new d({alg:u});g.init(B);g.updateString(c);return g.verify(h)}else{var g=new d({alg:u});g.init(B);g.updateString(c);return g.verify(A)}}}};KJUR.jws.JWS.parse=function(g){var c=g.split(".");var b={};var f,e,d;if(c.length!=2&&c.length!=3){throw"malformed sJWS: wrong number of '.' splitted elements"}f=c[0];e=c[1];if(c.length==3){d=c[2]}b.headerObj=KJUR.jws.JWS.readSafeJSONString(b64utoutf8(f));b.payloadObj=KJUR.jws.JWS.readSafeJSONString(b64utoutf8(e));b.headerPP=JSON.stringify(b.headerObj,null," ");if(b.payloadObj==null){b.payloadPP=b64utoutf8(e)}else{b.payloadPP=JSON.stringify(b.payloadObj,null," ")}if(d!==undefined){b.sigHex=b64utohex(d)}return b};KJUR.jws.JWS.verifyJWT=function(e,l,r){var d=KJUR,j=d.jws,o=j.JWS,n=o.readSafeJSONString,p=o.inArray,f=o.includedArray;var k=e.split(".");var c=k[0];var i=k[1];var q=c+"."+i;var m=b64utohex(k[2]);var h=n(b64utoutf8(c));var g=n(b64utoutf8(i));if(h.alg===undefined){return false}if(r.alg===undefined){throw"acceptField.alg shall be specified"}if(!p(h.alg,r.alg)){return false}if(g.iss!==undefined&&typeof r.iss==="object"){if(!p(g.iss,r.iss)){return false}}if(g.sub!==undefined&&typeof r.sub==="object"){if(!p(g.sub,r.sub)){return false}}if(g.aud!==undefined&&typeof r.aud==="object"){if(typeof g.aud=="string"){if(!p(g.aud,r.aud)){return false}}else{if(typeof g.aud=="object"){if(!f(g.aud,r.aud)){return false}}}}var b=j.IntDate.getNow();if(r.verifyAt!==undefined&&typeof r.verifyAt==="number"){b=r.verifyAt}if(r.gracePeriod===undefined||typeof r.gracePeriod!=="number"){r.gracePeriod=0}if(g.exp!==undefined&&typeof g.exp=="number"){if(g.exp+r.gracePeriodl){this.aHeader.pop()}if(this.aSignature.length>l){this.aSignature.pop()}throw"addSignature failed: "+i}};this.verifyAll=function(h){if(this.aHeader.length!==h.length||this.aSignature.length!==h.length){return false}for(var g=0;g0){this.aHeader=g.headers}else{throw"malformed header"}if(typeof g.payload==="string"){this.sPayload=g.payload}else{throw"malformed signatures"}if(g.signatures.length>0){this.signatures=g.signatures}else{throw"malformed signatures"}}catch(e){throw"malformed JWS-JS JSON object: "+e}}};this.getJSON=function(){return{headers:this.aHeader,payload:this.sPayload,signatures:this.aSignature}};this.isEmpty=function(){if(this.aHeader.length==0){return 1}return 0}}; -exports.SecureRandom = SecureRandom; -exports.rng_seed_time = rng_seed_time; - -exports.BigInteger = BigInteger; -exports.RSAKey = RSAKey; -exports.ECDSA = KJUR.crypto.ECDSA; -exports.DSA = KJUR.crypto.DSA; -exports.Signature = KJUR.crypto.Signature; -exports.MessageDigest = KJUR.crypto.MessageDigest; -exports.Mac = KJUR.crypto.Mac; -exports.Cipher = KJUR.crypto.Cipher; -exports.KEYUTIL = KEYUTIL; -exports.ASN1HEX = ASN1HEX; -exports.X509 = X509; -exports.CryptoJS = CryptoJS; - -// ext/base64.js -exports.b64tohex = b64tohex; -exports.b64toBA = b64toBA; - -// base64x.js -exports.stoBA = stoBA; -exports.BAtos = BAtos; -exports.BAtohex = BAtohex; -exports.stohex = stohex; -exports.stob64 = stob64; -exports.stob64u = stob64u; -exports.b64utos = b64utos; -exports.b64tob64u = b64tob64u; -exports.b64utob64 = b64utob64; -exports.hex2b64 = hex2b64; -exports.hextob64u = hextob64u; -exports.b64utohex = b64utohex; -exports.utf8tob64u = utf8tob64u; -exports.b64utoutf8 = b64utoutf8; -exports.utf8tob64 = utf8tob64; -exports.b64toutf8 = b64toutf8; -exports.utf8tohex = utf8tohex; -exports.hextoutf8 = hextoutf8; -exports.hextorstr = hextorstr; -exports.rstrtohex = rstrtohex; -exports.hextob64 = hextob64; -exports.hextob64nl = hextob64nl; -exports.b64nltohex = b64nltohex; -exports.hextopem = hextopem; -exports.pemtohex = pemtohex; -exports.hextoArrayBuffer = hextoArrayBuffer; -exports.ArrayBuffertohex = ArrayBuffertohex; -exports.zulutomsec = zulutomsec; -exports.zulutosec = zulutosec; -exports.zulutodate = zulutodate; -exports.datetozulu = datetozulu; -exports.uricmptohex = uricmptohex; -exports.hextouricmp = hextouricmp; -exports.encodeURIComponentAll = encodeURIComponentAll; -exports.newline_toUnix = newline_toUnix; -exports.newline_toDos = newline_toDos; -exports.hextoposhex = hextoposhex; -exports.intarystrtohex = intarystrtohex; -exports.strdiffidx = strdiffidx; - -// name spaces -exports.KJUR = KJUR; -exports.crypto = KJUR.crypto; -exports.asn1 = KJUR.asn1; -exports.jws = KJUR.jws; -exports.lang = KJUR.lang; - - - - -/***/ }), -/* 110 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -var OpenElementStack = __webpack_require__(51), - Tokenizer = __webpack_require__(19), - HTML = __webpack_require__(11); - - -//Aliases -var $ = HTML.TAG_NAMES; - -exports.assign = function (parser) { - //NOTE: obtain Parser proto this way to avoid module circular references - var parserProto = Object.getPrototypeOf(parser), - treeAdapter = parser.treeAdapter, - attachableElementLocation = null, - lastFosterParentingLocation = null, - currentToken = null; - - function setEndLocation(element, closingToken) { - var loc = element.__location; - - if (!loc) - return; - - if (!loc.startTag) { - loc.startTag = { - line: loc.line, - col: loc.col, - startOffset: loc.startOffset, - endOffset: loc.endOffset - }; - - if (loc.attrs) - loc.startTag.attrs = loc.attrs; - } - - if (closingToken.location) { - var ctLocation = closingToken.location, - tn = treeAdapter.getTagName(element), - // NOTE: For cases like - First 'p' closes without a closing tag and - // for cases like - 'p' closes without a closing tag - isClosingEndTag = closingToken.type === Tokenizer.END_TAG_TOKEN && - tn === closingToken.tagName; - - if (isClosingEndTag) { - loc.endTag = { - line: ctLocation.line, - col: ctLocation.col, - startOffset: ctLocation.startOffset, - endOffset: ctLocation.endOffset - }; - } - - if (isClosingEndTag) - loc.endOffset = ctLocation.endOffset; - else - loc.endOffset = ctLocation.startOffset; - } - - else if (closingToken.type === Tokenizer.EOF_TOKEN) - loc.endOffset = parser.tokenizer.preprocessor.sourcePos; - } - - //NOTE: patch _bootstrap method - parser._bootstrap = function (document, fragmentContext) { - parserProto._bootstrap.call(this, document, fragmentContext); - - attachableElementLocation = null; - lastFosterParentingLocation = null; - currentToken = null; - - //OpenElementStack - parser.openElements.pop = function () { - setEndLocation(this.current, currentToken); - OpenElementStack.prototype.pop.call(this); - }; - - parser.openElements.popAllUpToHtmlElement = function () { - for (var i = this.stackTop; i > 0; i--) - setEndLocation(this.items[i], currentToken); - - OpenElementStack.prototype.popAllUpToHtmlElement.call(this); - }; - - parser.openElements.remove = function (element) { - setEndLocation(element, currentToken); - OpenElementStack.prototype.remove.call(this, element); - }; - }; - - parser._runParsingLoop = function (scriptHandler) { - parserProto._runParsingLoop.call(this, scriptHandler); - - // NOTE: generate location info for elements - // that remains on open element stack - for (var i = parser.openElements.stackTop; i >= 0; i--) - setEndLocation(parser.openElements.items[i], currentToken); - }; - - - //Token processing - parser._processTokenInForeignContent = function (token) { - currentToken = token; - parserProto._processTokenInForeignContent.call(this, token); - }; - - parser._processToken = function (token) { - currentToken = token; - parserProto._processToken.call(this, token); - - //NOTE: and are never popped from the stack, so we need to updated - //their end location explicitly. - if (token.type === Tokenizer.END_TAG_TOKEN && - (token.tagName === $.HTML || - token.tagName === $.BODY && this.openElements.hasInScope($.BODY))) { - for (var i = this.openElements.stackTop; i >= 0; i--) { - var element = this.openElements.items[i]; - - if (this.treeAdapter.getTagName(element) === token.tagName) { - setEndLocation(element, token); - break; - } - } - } - }; - - - //Doctype - parser._setDocumentType = function (token) { - parserProto._setDocumentType.call(this, token); - - var documentChildren = this.treeAdapter.getChildNodes(this.document), - cnLength = documentChildren.length; - - for (var i = 0; i < cnLength; i++) { - var node = documentChildren[i]; - - if (this.treeAdapter.isDocumentTypeNode(node)) { - node.__location = token.location; - break; - } - } - }; - - - //Elements - parser._attachElementToTree = function (element) { - //NOTE: _attachElementToTree is called from _appendElement, _insertElement and _insertTemplate methods. - //So we will use token location stored in this methods for the element. - element.__location = attachableElementLocation || null; - attachableElementLocation = null; - parserProto._attachElementToTree.call(this, element); - }; - - parser._appendElement = function (token, namespaceURI) { - attachableElementLocation = token.location; - parserProto._appendElement.call(this, token, namespaceURI); - }; - - parser._insertElement = function (token, namespaceURI) { - attachableElementLocation = token.location; - parserProto._insertElement.call(this, token, namespaceURI); - }; - - parser._insertTemplate = function (token) { - attachableElementLocation = token.location; - parserProto._insertTemplate.call(this, token); - - var tmplContent = this.treeAdapter.getTemplateContent(this.openElements.current); - - tmplContent.__location = null; - }; - - parser._insertFakeRootElement = function () { - parserProto._insertFakeRootElement.call(this); - this.openElements.current.__location = null; - }; - - - //Comments - parser._appendCommentNode = function (token, parent) { - parserProto._appendCommentNode.call(this, token, parent); - - var children = this.treeAdapter.getChildNodes(parent), - commentNode = children[children.length - 1]; - - commentNode.__location = token.location; - }; - - - //Text - parser._findFosterParentingLocation = function () { - //NOTE: store last foster parenting location, so we will be able to find inserted text - //in case of foster parenting - lastFosterParentingLocation = parserProto._findFosterParentingLocation.call(this); - return lastFosterParentingLocation; - }; - - parser._insertCharacters = function (token) { - parserProto._insertCharacters.call(this, token); - - var hasFosterParent = this._shouldFosterParentOnInsertion(), - parent = hasFosterParent && lastFosterParentingLocation.parent || - this.openElements.currentTmplContent || - this.openElements.current, - siblings = this.treeAdapter.getChildNodes(parent), - textNodeIdx = hasFosterParent && lastFosterParentingLocation.beforeElement ? - siblings.indexOf(lastFosterParentingLocation.beforeElement) - 1 : - siblings.length - 1, - textNode = siblings[textNodeIdx]; - - //NOTE: if we have location assigned by another token, then just update end position - if (textNode.__location) - textNode.__location.endOffset = token.location.endOffset; - - else - textNode.__location = token.location; - }; -}; - - - -/***/ }), -/* 111 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -var UNICODE = __webpack_require__(18); - -//Aliases -var $ = UNICODE.CODE_POINTS; - - -exports.assign = function (tokenizer) { - //NOTE: obtain Tokenizer proto this way to avoid module circular references - var tokenizerProto = Object.getPrototypeOf(tokenizer), - tokenStartOffset = -1, - tokenCol = -1, - tokenLine = 1, - isEol = false, - lineStartPos = 0, - col = -1, - line = 1; - - function attachLocationInfo(token) { - token.location = { - line: tokenLine, - col: tokenCol, - startOffset: tokenStartOffset, - endOffset: -1 - }; - } - - //NOTE: patch consumption method to track line/col information - tokenizer._consume = function () { - var cp = tokenizerProto._consume.call(this); - - //NOTE: LF should be in the last column of the line - if (isEol) { - isEol = false; - line++; - lineStartPos = this.preprocessor.sourcePos; - } - - if (cp === $.LINE_FEED) - isEol = true; - - col = this.preprocessor.sourcePos - lineStartPos + 1; - - return cp; - }; - - tokenizer._unconsume = function () { - tokenizerProto._unconsume.call(this); - isEol = false; - - col = this.preprocessor.sourcePos - lineStartPos + 1; - }; - - //NOTE: patch token creation methods and attach location objects - tokenizer._createStartTagToken = function () { - tokenizerProto._createStartTagToken.call(this); - attachLocationInfo(this.currentToken); - }; - - tokenizer._createEndTagToken = function () { - tokenizerProto._createEndTagToken.call(this); - attachLocationInfo(this.currentToken); - }; - - tokenizer._createCommentToken = function () { - tokenizerProto._createCommentToken.call(this); - attachLocationInfo(this.currentToken); - }; - - tokenizer._createDoctypeToken = function (initialName) { - tokenizerProto._createDoctypeToken.call(this, initialName); - attachLocationInfo(this.currentToken); - }; - - tokenizer._createCharacterToken = function (type, ch) { - tokenizerProto._createCharacterToken.call(this, type, ch); - attachLocationInfo(this.currentCharacterToken); - }; - - tokenizer._createAttr = function (attrNameFirstCh) { - tokenizerProto._createAttr.call(this, attrNameFirstCh); - this.currentAttrLocation = { - line: line, - col: col, - startOffset: this.preprocessor.sourcePos, - endOffset: -1 - }; - }; - - tokenizer._leaveAttrName = function (toState) { - tokenizerProto._leaveAttrName.call(this, toState); - this._attachCurrentAttrLocationInfo(); - }; - - tokenizer._leaveAttrValue = function (toState) { - tokenizerProto._leaveAttrValue.call(this, toState); - this._attachCurrentAttrLocationInfo(); - }; - - tokenizer._attachCurrentAttrLocationInfo = function () { - this.currentAttrLocation.endOffset = this.preprocessor.sourcePos; - - if (!this.currentToken.location.attrs) - this.currentToken.location.attrs = Object.create(null); - - this.currentToken.location.attrs[this.currentAttr.name] = this.currentAttrLocation; - }; - - //NOTE: patch token emission methods to determine end location - tokenizer._emitCurrentToken = function () { - //NOTE: if we have pending character token make it's end location equal to the - //current token's start location. - if (this.currentCharacterToken) - this.currentCharacterToken.location.endOffset = this.currentToken.location.startOffset; - - this.currentToken.location.endOffset = this.preprocessor.sourcePos + 1; - tokenizerProto._emitCurrentToken.call(this); - }; - - tokenizer._emitCurrentCharacterToken = function () { - //NOTE: if we have character token and it's location wasn't set in the _emitCurrentToken(), - //then set it's location at the current preprocessor position. - //We don't need to increment preprocessor position, since character token - //emission is always forced by the start of the next character token here. - //So, we already have advanced position. - if (this.currentCharacterToken && this.currentCharacterToken.location.endOffset === -1) - this.currentCharacterToken.location.endOffset = this.preprocessor.sourcePos; - - tokenizerProto._emitCurrentCharacterToken.call(this); - }; - - //NOTE: patch initial states for each mode to obtain token start position - Object.keys(tokenizerProto.MODE) - - .map(function (modeName) { - return tokenizerProto.MODE[modeName]; - }) - - .forEach(function (state) { - tokenizer[state] = function (cp) { - tokenStartOffset = this.preprocessor.sourcePos; - tokenLine = line; - tokenCol = col; - tokenizerProto[state].call(this, cp); - }; - }); -}; - - -/***/ }), -/* 112 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -//Const -var NOAH_ARK_CAPACITY = 3; - -//List of formatting elements -var FormattingElementList = module.exports = function (treeAdapter) { - this.length = 0; - this.entries = []; - this.treeAdapter = treeAdapter; - this.bookmark = null; -}; - -//Entry types -FormattingElementList.MARKER_ENTRY = 'MARKER_ENTRY'; -FormattingElementList.ELEMENT_ENTRY = 'ELEMENT_ENTRY'; - -//Noah Ark's condition -//OPTIMIZATION: at first we try to find possible candidates for exclusion using -//lightweight heuristics without thorough attributes check. -FormattingElementList.prototype._getNoahArkConditionCandidates = function (newElement) { - var candidates = []; - - if (this.length >= NOAH_ARK_CAPACITY) { - var neAttrsLength = this.treeAdapter.getAttrList(newElement).length, - neTagName = this.treeAdapter.getTagName(newElement), - neNamespaceURI = this.treeAdapter.getNamespaceURI(newElement); - - for (var i = this.length - 1; i >= 0; i--) { - var entry = this.entries[i]; - - if (entry.type === FormattingElementList.MARKER_ENTRY) - break; - - var element = entry.element, - elementAttrs = this.treeAdapter.getAttrList(element), - isCandidate = this.treeAdapter.getTagName(element) === neTagName && - this.treeAdapter.getNamespaceURI(element) === neNamespaceURI && - elementAttrs.length === neAttrsLength; - - if (isCandidate) - candidates.push({idx: i, attrs: elementAttrs}); - } - } - - return candidates.length < NOAH_ARK_CAPACITY ? [] : candidates; -}; - -FormattingElementList.prototype._ensureNoahArkCondition = function (newElement) { - var candidates = this._getNoahArkConditionCandidates(newElement), - cLength = candidates.length; - - if (cLength) { - var neAttrs = this.treeAdapter.getAttrList(newElement), - neAttrsLength = neAttrs.length, - neAttrsMap = Object.create(null); - - //NOTE: build attrs map for the new element so we can perform fast lookups - for (var i = 0; i < neAttrsLength; i++) { - var neAttr = neAttrs[i]; - - neAttrsMap[neAttr.name] = neAttr.value; - } - - for (i = 0; i < neAttrsLength; i++) { - for (var j = 0; j < cLength; j++) { - var cAttr = candidates[j].attrs[i]; - - if (neAttrsMap[cAttr.name] !== cAttr.value) { - candidates.splice(j, 1); - cLength--; - } - - if (candidates.length < NOAH_ARK_CAPACITY) - return; - } - } - - //NOTE: remove bottommost candidates until Noah's Ark condition will not be met - for (i = cLength - 1; i >= NOAH_ARK_CAPACITY - 1; i--) { - this.entries.splice(candidates[i].idx, 1); - this.length--; - } - } -}; - -//Mutations -FormattingElementList.prototype.insertMarker = function () { - this.entries.push({type: FormattingElementList.MARKER_ENTRY}); - this.length++; -}; - -FormattingElementList.prototype.pushElement = function (element, token) { - this._ensureNoahArkCondition(element); - - this.entries.push({ - type: FormattingElementList.ELEMENT_ENTRY, - element: element, - token: token - }); - - this.length++; -}; - -FormattingElementList.prototype.insertElementAfterBookmark = function (element, token) { - var bookmarkIdx = this.length - 1; - - for (; bookmarkIdx >= 0; bookmarkIdx--) { - if (this.entries[bookmarkIdx] === this.bookmark) - break; - } - - this.entries.splice(bookmarkIdx + 1, 0, { - type: FormattingElementList.ELEMENT_ENTRY, - element: element, - token: token - }); - - this.length++; -}; - -FormattingElementList.prototype.removeEntry = function (entry) { - for (var i = this.length - 1; i >= 0; i--) { - if (this.entries[i] === entry) { - this.entries.splice(i, 1); - this.length--; - break; - } - } -}; - -FormattingElementList.prototype.clearToLastMarker = function () { - while (this.length) { - var entry = this.entries.pop(); - - this.length--; - - if (entry.type === FormattingElementList.MARKER_ENTRY) - break; - } -}; - -//Search -FormattingElementList.prototype.getElementEntryInScopeWithTagName = function (tagName) { - for (var i = this.length - 1; i >= 0; i--) { - var entry = this.entries[i]; - - if (entry.type === FormattingElementList.MARKER_ENTRY) - return null; - - if (this.treeAdapter.getTagName(entry.element) === tagName) - return entry; - } - - return null; -}; - -FormattingElementList.prototype.getElementEntry = function (element) { - for (var i = this.length - 1; i >= 0; i--) { - var entry = this.entries[i]; - - if (entry.type === FormattingElementList.ELEMENT_ENTRY && entry.element === element) - return entry; - } - - return null; -}; - - -/***/ }), -/* 113 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -var ParserStream = __webpack_require__(52), - inherits = __webpack_require__(24).inherits, - $ = __webpack_require__(11).TAG_NAMES; - -var PlainTextConversionStream = module.exports = function (options) { - ParserStream.call(this, options); - - // NOTE: see https://html.spec.whatwg.org/#read-text - this.parser._insertFakeElement($.HTML); - this.parser._insertFakeElement($.HEAD); - this.parser.openElements.pop(); - this.parser._insertFakeElement($.BODY); - this.parser._insertFakeElement($.PRE); - this.parser.treeAdapter.insertText(this.parser.openElements.current, '\n'); - this.parser.switchToPlaintextParsing(); -}; - -inherits(PlainTextConversionStream, ParserStream); - - -/***/ }), -/* 114 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -var WritableStream = __webpack_require__(31).Writable, - util = __webpack_require__(24); - -var DevNullStream = module.exports = function () { - WritableStream.call(this); -}; - -util.inherits(DevNullStream, WritableStream); - -DevNullStream.prototype._write = function (chunk, encoding, cb) { - cb(); -}; - - -/***/ }), -/* 115 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -var TransformStream = __webpack_require__(31).Transform, - DevNullStream = __webpack_require__(114), - inherits = __webpack_require__(24).inherits, - Tokenizer = __webpack_require__(19), - ParserFeedbackSimulator = __webpack_require__(116), - mergeOptions = __webpack_require__(34); - -var DEFAULT_OPTIONS = { - locationInfo: false -}; - -var SAXParser = module.exports = function (options) { - TransformStream.call(this); - - this.options = mergeOptions(DEFAULT_OPTIONS, options); - - this.tokenizer = new Tokenizer(options); - this.parserFeedbackSimulator = new ParserFeedbackSimulator(this.tokenizer); - - this.pendingText = null; - this.currentTokenLocation = void 0; - - this.lastChunkWritten = false; - this.stopped = false; - - // NOTE: always pipe stream to the /dev/null stream to avoid - // `highWaterMark` hit even if we don't have consumers. - // (see: https://github.com/inikulin/parse5/issues/97#issuecomment-171940774) - this.pipe(new DevNullStream()); -}; - -inherits(SAXParser, TransformStream); - -//TransformStream implementation -SAXParser.prototype._transform = function (chunk, encoding, callback) { - if (!this.stopped) { - this.tokenizer.write(chunk.toString('utf8'), this.lastChunkWritten); - this._runParsingLoop(); - } - - this.push(chunk); - - callback(); -}; - -SAXParser.prototype._flush = function (callback) { - callback(); -}; - -SAXParser.prototype.end = function (chunk, encoding, callback) { - this.lastChunkWritten = true; - TransformStream.prototype.end.call(this, chunk, encoding, callback); -}; - -SAXParser.prototype.stop = function () { - this.stopped = true; -}; - -//Internals -SAXParser.prototype._runParsingLoop = function () { - do { - var token = this.parserFeedbackSimulator.getNextToken(); - - if (token.type === Tokenizer.HIBERNATION_TOKEN) - break; - - if (token.type === Tokenizer.CHARACTER_TOKEN || - token.type === Tokenizer.WHITESPACE_CHARACTER_TOKEN || - token.type === Tokenizer.NULL_CHARACTER_TOKEN) { - - if (this.options.locationInfo) { - if (this.pendingText === null) - this.currentTokenLocation = token.location; - - else - this.currentTokenLocation.endOffset = token.location.endOffset; - } - - this.pendingText = (this.pendingText || '') + token.chars; - } - - else { - this._emitPendingText(); - this._handleToken(token); - } - } while (!this.stopped && token.type !== Tokenizer.EOF_TOKEN); -}; - -SAXParser.prototype._handleToken = function (token) { - if (this.options.locationInfo) - this.currentTokenLocation = token.location; - - if (token.type === Tokenizer.START_TAG_TOKEN) - this.emit('startTag', token.tagName, token.attrs, token.selfClosing, this.currentTokenLocation); - - else if (token.type === Tokenizer.END_TAG_TOKEN) - this.emit('endTag', token.tagName, this.currentTokenLocation); - - else if (token.type === Tokenizer.COMMENT_TOKEN) - this.emit('comment', token.data, this.currentTokenLocation); - - else if (token.type === Tokenizer.DOCTYPE_TOKEN) - this.emit('doctype', token.name, token.publicId, token.systemId, this.currentTokenLocation); -}; - -SAXParser.prototype._emitPendingText = function () { - if (this.pendingText !== null) { - this.emit('text', this.pendingText, this.currentTokenLocation); - this.pendingText = null; - } -}; - - -/***/ }), -/* 116 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -var Tokenizer = __webpack_require__(19), - foreignContent = __webpack_require__(49), - UNICODE = __webpack_require__(18), - HTML = __webpack_require__(11); - - -//Aliases -var $ = HTML.TAG_NAMES, - NS = HTML.NAMESPACES; - - -//ParserFeedbackSimulator -//Simulates adjustment of the Tokenizer which performed by standard parser during tree construction. -var ParserFeedbackSimulator = module.exports = function (tokenizer) { - this.tokenizer = tokenizer; - - this.namespaceStack = []; - this.namespaceStackTop = -1; - this._enterNamespace(NS.HTML); -}; - -ParserFeedbackSimulator.prototype.getNextToken = function () { - var token = this.tokenizer.getNextToken(); - - if (token.type === Tokenizer.START_TAG_TOKEN) - this._handleStartTagToken(token); - - else if (token.type === Tokenizer.END_TAG_TOKEN) - this._handleEndTagToken(token); - - else if (token.type === Tokenizer.NULL_CHARACTER_TOKEN && this.inForeignContent) { - token.type = Tokenizer.CHARACTER_TOKEN; - token.chars = UNICODE.REPLACEMENT_CHARACTER; - } - - else if (this.skipNextNewLine) { - if (token.type !== Tokenizer.HIBERNATION_TOKEN) - this.skipNextNewLine = false; - - if (token.type === Tokenizer.WHITESPACE_CHARACTER_TOKEN && token.chars[0] === '\n') { - if (token.chars.length === 1) - return this.getNextToken(); - - token.chars = token.chars.substr(1); - } - } - - return token; -}; - -//Namespace stack mutations -ParserFeedbackSimulator.prototype._enterNamespace = function (namespace) { - this.namespaceStackTop++; - this.namespaceStack.push(namespace); - - this.inForeignContent = namespace !== NS.HTML; - this.currentNamespace = namespace; - this.tokenizer.allowCDATA = this.inForeignContent; -}; - -ParserFeedbackSimulator.prototype._leaveCurrentNamespace = function () { - this.namespaceStackTop--; - this.namespaceStack.pop(); - - this.currentNamespace = this.namespaceStack[this.namespaceStackTop]; - this.inForeignContent = this.currentNamespace !== NS.HTML; - this.tokenizer.allowCDATA = this.inForeignContent; -}; - -//Token handlers -ParserFeedbackSimulator.prototype._ensureTokenizerMode = function (tn) { - if (tn === $.TEXTAREA || tn === $.TITLE) - this.tokenizer.state = Tokenizer.MODE.RCDATA; - - else if (tn === $.PLAINTEXT) - this.tokenizer.state = Tokenizer.MODE.PLAINTEXT; - - else if (tn === $.SCRIPT) - this.tokenizer.state = Tokenizer.MODE.SCRIPT_DATA; - - else if (tn === $.STYLE || tn === $.IFRAME || tn === $.XMP || - tn === $.NOEMBED || tn === $.NOFRAMES || tn === $.NOSCRIPT) - this.tokenizer.state = Tokenizer.MODE.RAWTEXT; -}; - -ParserFeedbackSimulator.prototype._handleStartTagToken = function (token) { - var tn = token.tagName; - - if (tn === $.SVG) - this._enterNamespace(NS.SVG); - - else if (tn === $.MATH) - this._enterNamespace(NS.MATHML); - - if (this.inForeignContent) { - if (foreignContent.causesExit(token)) { - this._leaveCurrentNamespace(); - return; - } - - var currentNs = this.currentNamespace; - - if (currentNs === NS.MATHML) - foreignContent.adjustTokenMathMLAttrs(token); - - else if (currentNs === NS.SVG) { - foreignContent.adjustTokenSVGTagName(token); - foreignContent.adjustTokenSVGAttrs(token); - } - - foreignContent.adjustTokenXMLAttrs(token); - - tn = token.tagName; - - if (!token.selfClosing && foreignContent.isIntegrationPoint(tn, currentNs, token.attrs)) - this._enterNamespace(NS.HTML); - } - - else { - if (tn === $.PRE || tn === $.TEXTAREA || tn === $.LISTING) - this.skipNextNewLine = true; - - else if (tn === $.IMAGE) - token.tagName = $.IMG; - - this._ensureTokenizerMode(tn); - } -}; - -ParserFeedbackSimulator.prototype._handleEndTagToken = function (token) { - var tn = token.tagName; - - if (!this.inForeignContent) { - var previousNs = this.namespaceStack[this.namespaceStackTop - 1]; - - if (previousNs === NS.SVG && foreignContent.SVG_TAG_NAMES_ADJUSTMENT_MAP[tn]) - tn = foreignContent.SVG_TAG_NAMES_ADJUSTMENT_MAP[tn]; - - //NOTE: check for exit from integration point - if (foreignContent.isIntegrationPoint(tn, previousNs, token.attrs)) - this._leaveCurrentNamespace(); - } - - else if (tn === $.SVG && this.currentNamespace === NS.SVG || - tn === $.MATH && this.currentNamespace === NS.MATHML) - this._leaveCurrentNamespace(); - - // NOTE: adjust end tag name as well for consistency - if (this.currentNamespace === NS.SVG) - foreignContent.adjustTokenSVGTagName(token); -}; - - -/***/ }), -/* 117 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -var ReadableStream = __webpack_require__(31).Readable, - inherits = __webpack_require__(24).inherits, - Serializer = __webpack_require__(53); - -var SerializerStream = module.exports = function (node, options) { - ReadableStream.call(this); - - this.serializer = new Serializer(node, options); - - Object.defineProperty(this.serializer, 'html', { - //NOTE: To make `+=` concat operator work properly we define - //getter which always returns empty string - get: function () { - return ''; - }, - set: this.push.bind(this) - }); -}; - -inherits(SerializerStream, ReadableStream); - -//Readable stream implementation -SerializerStream.prototype._read = function () { - this.serializer.serialize(); - this.push(null); -}; - - -/***/ }), -/* 118 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -//NOTE: this file contains auto-generated array mapped radix tree that is used for the named entity references consumption -//(details: https://github.com/inikulin/parse5/tree/master/scripts/generate_named_entity_data/README.md) -module.exports = new Uint16Array([4,52,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,106,303,412,810,1432,1701,1796,1987,2114,2360,2420,2484,3170,3251,4140,4393,4575,4610,5106,5512,5728,6117,6274,6315,6345,6427,6516,7002,7910,8733,9323,9870,10170,10631,10893,11318,11386,11467,12773,13092,14474,14922,15448,15542,16419,17666,18166,18611,19004,19095,19298,19397,4,16,69,77,97,98,99,102,103,108,109,110,111,112,114,115,116,117,140,150,158,169,176,194,199,210,216,222,226,242,256,266,283,294,108,105,103,5,198,1,59,148,1,198,80,5,38,1,59,156,1,38,99,117,116,101,5,193,1,59,167,1,193,114,101,118,101,59,1,258,4,2,105,121,182,191,114,99,5,194,1,59,189,1,194,59,1,1040,114,59,3,55349,56580,114,97,118,101,5,192,1,59,208,1,192,112,104,97,59,1,913,97,99,114,59,1,256,100,59,1,10835,4,2,103,112,232,237,111,110,59,1,260,102,59,3,55349,56632,112,108,121,70,117,110,99,116,105,111,110,59,1,8289,105,110,103,5,197,1,59,264,1,197,4,2,99,115,272,277,114,59,3,55349,56476,105,103,110,59,1,8788,105,108,100,101,5,195,1,59,292,1,195,109,108,5,196,1,59,301,1,196,4,8,97,99,101,102,111,114,115,117,321,350,354,383,388,394,400,405,4,2,99,114,327,336,107,115,108,97,115,104,59,1,8726,4,2,118,119,342,345,59,1,10983,101,100,59,1,8966,121,59,1,1041,4,3,99,114,116,362,369,379,97,117,115,101,59,1,8757,110,111,117,108,108,105,115,59,1,8492,97,59,1,914,114,59,3,55349,56581,112,102,59,3,55349,56633,101,118,101,59,1,728,99,114,59,1,8492,109,112,101,113,59,1,8782,4,14,72,79,97,99,100,101,102,104,105,108,111,114,115,117,442,447,456,504,542,547,569,573,577,616,678,784,790,796,99,121,59,1,1063,80,89,5,169,1,59,454,1,169,4,3,99,112,121,464,470,497,117,116,101,59,1,262,4,2,59,105,476,478,1,8914,116,97,108,68,105,102,102,101,114,101,110,116,105,97,108,68,59,1,8517,108,101,121,115,59,1,8493,4,4,97,101,105,111,514,520,530,535,114,111,110,59,1,268,100,105,108,5,199,1,59,528,1,199,114,99,59,1,264,110,105,110,116,59,1,8752,111,116,59,1,266,4,2,100,110,553,560,105,108,108,97,59,1,184,116,101,114,68,111,116,59,1,183,114,59,1,8493,105,59,1,935,114,99,108,101,4,4,68,77,80,84,591,596,603,609,111,116,59,1,8857,105,110,117,115,59,1,8854,108,117,115,59,1,8853,105,109,101,115,59,1,8855,111,4,2,99,115,623,646,107,119,105,115,101,67,111,110,116,111,117,114,73,110,116,101,103,114,97,108,59,1,8754,101,67,117,114,108,121,4,2,68,81,658,671,111,117,98,108,101,81,117,111,116,101,59,1,8221,117,111,116,101,59,1,8217,4,4,108,110,112,117,688,701,736,753,111,110,4,2,59,101,696,698,1,8759,59,1,10868,4,3,103,105,116,709,717,722,114,117,101,110,116,59,1,8801,110,116,59,1,8751,111,117,114,73,110,116,101,103,114,97,108,59,1,8750,4,2,102,114,742,745,59,1,8450,111,100,117,99,116,59,1,8720,110,116,101,114,67,108,111,99,107,119,105,115,101,67,111,110,116,111,117,114,73,110,116,101,103,114,97,108,59,1,8755,111,115,115,59,1,10799,99,114,59,3,55349,56478,112,4,2,59,67,803,805,1,8915,97,112,59,1,8781,4,11,68,74,83,90,97,99,101,102,105,111,115,834,850,855,860,865,888,903,916,921,1011,1415,4,2,59,111,840,842,1,8517,116,114,97,104,100,59,1,10513,99,121,59,1,1026,99,121,59,1,1029,99,121,59,1,1039,4,3,103,114,115,873,879,883,103,101,114,59,1,8225,114,59,1,8609,104,118,59,1,10980,4,2,97,121,894,900,114,111,110,59,1,270,59,1,1044,108,4,2,59,116,910,912,1,8711,97,59,1,916,114,59,3,55349,56583,4,2,97,102,927,998,4,2,99,109,933,992,114,105,116,105,99,97,108,4,4,65,68,71,84,950,957,978,985,99,117,116,101,59,1,180,111,4,2,116,117,964,967,59,1,729,98,108,101,65,99,117,116,101,59,1,733,114,97,118,101,59,1,96,105,108,100,101,59,1,732,111,110,100,59,1,8900,102,101,114,101,110,116,105,97,108,68,59,1,8518,4,4,112,116,117,119,1021,1026,1048,1249,102,59,3,55349,56635,4,3,59,68,69,1034,1036,1041,1,168,111,116,59,1,8412,113,117,97,108,59,1,8784,98,108,101,4,6,67,68,76,82,85,86,1065,1082,1101,1189,1211,1236,111,110,116,111,117,114,73,110,116,101,103,114,97,108,59,1,8751,111,4,2,116,119,1089,1092,59,1,168,110,65,114,114,111,119,59,1,8659,4,2,101,111,1107,1141,102,116,4,3,65,82,84,1117,1124,1136,114,114,111,119,59,1,8656,105,103,104,116,65,114,114,111,119,59,1,8660,101,101,59,1,10980,110,103,4,2,76,82,1149,1177,101,102,116,4,2,65,82,1158,1165,114,114,111,119,59,1,10232,105,103,104,116,65,114,114,111,119,59,1,10234,105,103,104,116,65,114,114,111,119,59,1,10233,105,103,104,116,4,2,65,84,1199,1206,114,114,111,119,59,1,8658,101,101,59,1,8872,112,4,2,65,68,1218,1225,114,114,111,119,59,1,8657,111,119,110,65,114,114,111,119,59,1,8661,101,114,116,105,99,97,108,66,97,114,59,1,8741,110,4,6,65,66,76,82,84,97,1264,1292,1299,1352,1391,1408,114,114,111,119,4,3,59,66,85,1276,1278,1283,1,8595,97,114,59,1,10515,112,65,114,114,111,119,59,1,8693,114,101,118,101,59,1,785,101,102,116,4,3,82,84,86,1310,1323,1334,105,103,104,116,86,101,99,116,111,114,59,1,10576,101,101,86,101,99,116,111,114,59,1,10590,101,99,116,111,114,4,2,59,66,1345,1347,1,8637,97,114,59,1,10582,105,103,104,116,4,2,84,86,1362,1373,101,101,86,101,99,116,111,114,59,1,10591,101,99,116,111,114,4,2,59,66,1384,1386,1,8641,97,114,59,1,10583,101,101,4,2,59,65,1399,1401,1,8868,114,114,111,119,59,1,8615,114,114,111,119,59,1,8659,4,2,99,116,1421,1426,114,59,3,55349,56479,114,111,107,59,1,272,4,16,78,84,97,99,100,102,103,108,109,111,112,113,115,116,117,120,1466,1470,1478,1489,1515,1520,1525,1536,1544,1593,1609,1617,1650,1664,1668,1677,71,59,1,330,72,5,208,1,59,1476,1,208,99,117,116,101,5,201,1,59,1487,1,201,4,3,97,105,121,1497,1503,1512,114,111,110,59,1,282,114,99,5,202,1,59,1510,1,202,59,1,1069,111,116,59,1,278,114,59,3,55349,56584,114,97,118,101,5,200,1,59,1534,1,200,101,109,101,110,116,59,1,8712,4,2,97,112,1550,1555,99,114,59,1,274,116,121,4,2,83,86,1563,1576,109,97,108,108,83,113,117,97,114,101,59,1,9723,101,114,121,83,109,97,108,108,83,113,117,97,114,101,59,1,9643,4,2,103,112,1599,1604,111,110,59,1,280,102,59,3,55349,56636,115,105,108,111,110,59,1,917,117,4,2,97,105,1624,1640,108,4,2,59,84,1631,1633,1,10869,105,108,100,101,59,1,8770,108,105,98,114,105,117,109,59,1,8652,4,2,99,105,1656,1660,114,59,1,8496,109,59,1,10867,97,59,1,919,109,108,5,203,1,59,1675,1,203,4,2,105,112,1683,1689,115,116,115,59,1,8707,111,110,101,110,116,105,97,108,69,59,1,8519,4,5,99,102,105,111,115,1713,1717,1722,1762,1791,121,59,1,1060,114,59,3,55349,56585,108,108,101,100,4,2,83,86,1732,1745,109,97,108,108,83,113,117,97,114,101,59,1,9724,101,114,121,83,109,97,108,108,83,113,117,97,114,101,59,1,9642,4,3,112,114,117,1770,1775,1781,102,59,3,55349,56637,65,108,108,59,1,8704,114,105,101,114,116,114,102,59,1,8497,99,114,59,1,8497,4,12,74,84,97,98,99,100,102,103,111,114,115,116,1822,1827,1834,1848,1855,1877,1882,1887,1890,1896,1978,1984,99,121,59,1,1027,5,62,1,59,1832,1,62,109,109,97,4,2,59,100,1843,1845,1,915,59,1,988,114,101,118,101,59,1,286,4,3,101,105,121,1863,1869,1874,100,105,108,59,1,290,114,99,59,1,284,59,1,1043,111,116,59,1,288,114,59,3,55349,56586,59,1,8921,112,102,59,3,55349,56638,101,97,116,101,114,4,6,69,70,71,76,83,84,1915,1933,1944,1953,1959,1971,113,117,97,108,4,2,59,76,1925,1927,1,8805,101,115,115,59,1,8923,117,108,108,69,113,117,97,108,59,1,8807,114,101,97,116,101,114,59,1,10914,101,115,115,59,1,8823,108,97,110,116,69,113,117,97,108,59,1,10878,105,108,100,101,59,1,8819,99,114,59,3,55349,56482,59,1,8811,4,8,65,97,99,102,105,111,115,117,2005,2012,2026,2032,2036,2049,2073,2089,82,68,99,121,59,1,1066,4,2,99,116,2018,2023,101,107,59,1,711,59,1,94,105,114,99,59,1,292,114,59,1,8460,108,98,101,114,116,83,112,97,99,101,59,1,8459,4,2,112,114,2055,2059,102,59,1,8461,105,122,111,110,116,97,108,76,105,110,101,59,1,9472,4,2,99,116,2079,2083,114,59,1,8459,114,111,107,59,1,294,109,112,4,2,68,69,2097,2107,111,119,110,72,117,109,112,59,1,8782,113,117,97,108,59,1,8783,4,14,69,74,79,97,99,100,102,103,109,110,111,115,116,117,2144,2149,2155,2160,2171,2189,2194,2198,2209,2245,2307,2329,2334,2341,99,121,59,1,1045,108,105,103,59,1,306,99,121,59,1,1025,99,117,116,101,5,205,1,59,2169,1,205,4,2,105,121,2177,2186,114,99,5,206,1,59,2184,1,206,59,1,1048,111,116,59,1,304,114,59,1,8465,114,97,118,101,5,204,1,59,2207,1,204,4,3,59,97,112,2217,2219,2238,1,8465,4,2,99,103,2225,2229,114,59,1,298,105,110,97,114,121,73,59,1,8520,108,105,101,115,59,1,8658,4,2,116,118,2251,2281,4,2,59,101,2257,2259,1,8748,4,2,103,114,2265,2271,114,97,108,59,1,8747,115,101,99,116,105,111,110,59,1,8898,105,115,105,98,108,101,4,2,67,84,2293,2300,111,109,109,97,59,1,8291,105,109,101,115,59,1,8290,4,3,103,112,116,2315,2320,2325,111,110,59,1,302,102,59,3,55349,56640,97,59,1,921,99,114,59,1,8464,105,108,100,101,59,1,296,4,2,107,109,2347,2352,99,121,59,1,1030,108,5,207,1,59,2358,1,207,4,5,99,102,111,115,117,2372,2386,2391,2397,2414,4,2,105,121,2378,2383,114,99,59,1,308,59,1,1049,114,59,3,55349,56589,112,102,59,3,55349,56641,4,2,99,101,2403,2408,114,59,3,55349,56485,114,99,121,59,1,1032,107,99,121,59,1,1028,4,7,72,74,97,99,102,111,115,2436,2441,2446,2452,2467,2472,2478,99,121,59,1,1061,99,121,59,1,1036,112,112,97,59,1,922,4,2,101,121,2458,2464,100,105,108,59,1,310,59,1,1050,114,59,3,55349,56590,112,102,59,3,55349,56642,99,114,59,3,55349,56486,4,11,74,84,97,99,101,102,108,109,111,115,116,2508,2513,2520,2562,2585,2981,2986,3004,3011,3146,3167,99,121,59,1,1033,5,60,1,59,2518,1,60,4,5,99,109,110,112,114,2532,2538,2544,2548,2558,117,116,101,59,1,313,98,100,97,59,1,923,103,59,1,10218,108,97,99,101,116,114,102,59,1,8466,114,59,1,8606,4,3,97,101,121,2570,2576,2582,114,111,110,59,1,317,100,105,108,59,1,315,59,1,1051,4,2,102,115,2591,2907,116,4,10,65,67,68,70,82,84,85,86,97,114,2614,2663,2672,2728,2735,2760,2820,2870,2888,2895,4,2,110,114,2620,2633,103,108,101,66,114,97,99,107,101,116,59,1,10216,114,111,119,4,3,59,66,82,2644,2646,2651,1,8592,97,114,59,1,8676,105,103,104,116,65,114,114,111,119,59,1,8646,101,105,108,105,110,103,59,1,8968,111,4,2,117,119,2679,2692,98,108,101,66,114,97,99,107,101,116,59,1,10214,110,4,2,84,86,2699,2710,101,101,86,101,99,116,111,114,59,1,10593,101,99,116,111,114,4,2,59,66,2721,2723,1,8643,97,114,59,1,10585,108,111,111,114,59,1,8970,105,103,104,116,4,2,65,86,2745,2752,114,114,111,119,59,1,8596,101,99,116,111,114,59,1,10574,4,2,101,114,2766,2792,101,4,3,59,65,86,2775,2777,2784,1,8867,114,114,111,119,59,1,8612,101,99,116,111,114,59,1,10586,105,97,110,103,108,101,4,3,59,66,69,2806,2808,2813,1,8882,97,114,59,1,10703,113,117,97,108,59,1,8884,112,4,3,68,84,86,2829,2841,2852,111,119,110,86,101,99,116,111,114,59,1,10577,101,101,86,101,99,116,111,114,59,1,10592,101,99,116,111,114,4,2,59,66,2863,2865,1,8639,97,114,59,1,10584,101,99,116,111,114,4,2,59,66,2881,2883,1,8636,97,114,59,1,10578,114,114,111,119,59,1,8656,105,103,104,116,97,114,114,111,119,59,1,8660,115,4,6,69,70,71,76,83,84,2922,2936,2947,2956,2962,2974,113,117,97,108,71,114,101,97,116,101,114,59,1,8922,117,108,108,69,113,117,97,108,59,1,8806,114,101,97,116,101,114,59,1,8822,101,115,115,59,1,10913,108,97,110,116,69,113,117,97,108,59,1,10877,105,108,100,101,59,1,8818,114,59,3,55349,56591,4,2,59,101,2992,2994,1,8920,102,116,97,114,114,111,119,59,1,8666,105,100,111,116,59,1,319,4,3,110,112,119,3019,3110,3115,103,4,4,76,82,108,114,3030,3058,3070,3098,101,102,116,4,2,65,82,3039,3046,114,114,111,119,59,1,10229,105,103,104,116,65,114,114,111,119,59,1,10231,105,103,104,116,65,114,114,111,119,59,1,10230,101,102,116,4,2,97,114,3079,3086,114,114,111,119,59,1,10232,105,103,104,116,97,114,114,111,119,59,1,10234,105,103,104,116,97,114,114,111,119,59,1,10233,102,59,3,55349,56643,101,114,4,2,76,82,3123,3134,101,102,116,65,114,114,111,119,59,1,8601,105,103,104,116,65,114,114,111,119,59,1,8600,4,3,99,104,116,3154,3158,3161,114,59,1,8466,59,1,8624,114,111,107,59,1,321,59,1,8810,4,8,97,99,101,102,105,111,115,117,3188,3192,3196,3222,3227,3237,3243,3248,112,59,1,10501,121,59,1,1052,4,2,100,108,3202,3213,105,117,109,83,112,97,99,101,59,1,8287,108,105,110,116,114,102,59,1,8499,114,59,3,55349,56592,110,117,115,80,108,117,115,59,1,8723,112,102,59,3,55349,56644,99,114,59,1,8499,59,1,924,4,9,74,97,99,101,102,111,115,116,117,3271,3276,3283,3306,3422,3427,4120,4126,4137,99,121,59,1,1034,99,117,116,101,59,1,323,4,3,97,101,121,3291,3297,3303,114,111,110,59,1,327,100,105,108,59,1,325,59,1,1053,4,3,103,115,119,3314,3380,3415,97,116,105,118,101,4,3,77,84,86,3327,3340,3365,101,100,105,117,109,83,112,97,99,101,59,1,8203,104,105,4,2,99,110,3348,3357,107,83,112,97,99,101,59,1,8203,83,112,97,99,101,59,1,8203,101,114,121,84,104,105,110,83,112,97,99,101,59,1,8203,116,101,100,4,2,71,76,3389,3405,114,101,97,116,101,114,71,114,101,97,116,101,114,59,1,8811,101,115,115,76,101,115,115,59,1,8810,76,105,110,101,59,1,10,114,59,3,55349,56593,4,4,66,110,112,116,3437,3444,3460,3464,114,101,97,107,59,1,8288,66,114,101,97,107,105,110,103,83,112,97,99,101,59,1,160,102,59,1,8469,4,13,59,67,68,69,71,72,76,78,80,82,83,84,86,3492,3494,3517,3536,3578,3657,3685,3784,3823,3860,3915,4066,4107,1,10988,4,2,111,117,3500,3510,110,103,114,117,101,110,116,59,1,8802,112,67,97,112,59,1,8813,111,117,98,108,101,86,101,114,116,105,99,97,108,66,97,114,59,1,8742,4,3,108,113,120,3544,3552,3571,101,109,101,110,116,59,1,8713,117,97,108,4,2,59,84,3561,3563,1,8800,105,108,100,101,59,3,8770,824,105,115,116,115,59,1,8708,114,101,97,116,101,114,4,7,59,69,70,71,76,83,84,3600,3602,3609,3621,3631,3637,3650,1,8815,113,117,97,108,59,1,8817,117,108,108,69,113,117,97,108,59,3,8807,824,114,101,97,116,101,114,59,3,8811,824,101,115,115,59,1,8825,108,97,110,116,69,113,117,97,108,59,3,10878,824,105,108,100,101,59,1,8821,117,109,112,4,2,68,69,3666,3677,111,119,110,72,117,109,112,59,3,8782,824,113,117,97,108,59,3,8783,824,101,4,2,102,115,3692,3724,116,84,114,105,97,110,103,108,101,4,3,59,66,69,3709,3711,3717,1,8938,97,114,59,3,10703,824,113,117,97,108,59,1,8940,115,4,6,59,69,71,76,83,84,3739,3741,3748,3757,3764,3777,1,8814,113,117,97,108,59,1,8816,114,101,97,116,101,114,59,1,8824,101,115,115,59,3,8810,824,108,97,110,116,69,113,117,97,108,59,3,10877,824,105,108,100,101,59,1,8820,101,115,116,101,100,4,2,71,76,3795,3812,114,101,97,116,101,114,71,114,101,97,116,101,114,59,3,10914,824,101,115,115,76,101,115,115,59,3,10913,824,114,101,99,101,100,101,115,4,3,59,69,83,3838,3840,3848,1,8832,113,117,97,108,59,3,10927,824,108,97,110,116,69,113,117,97,108,59,1,8928,4,2,101,105,3866,3881,118,101,114,115,101,69,108,101,109,101,110,116,59,1,8716,103,104,116,84,114,105,97,110,103,108,101,4,3,59,66,69,3900,3902,3908,1,8939,97,114,59,3,10704,824,113,117,97,108,59,1,8941,4,2,113,117,3921,3973,117,97,114,101,83,117,4,2,98,112,3933,3952,115,101,116,4,2,59,69,3942,3945,3,8847,824,113,117,97,108,59,1,8930,101,114,115,101,116,4,2,59,69,3963,3966,3,8848,824,113,117,97,108,59,1,8931,4,3,98,99,112,3981,4000,4045,115,101,116,4,2,59,69,3990,3993,3,8834,8402,113,117,97,108,59,1,8840,99,101,101,100,115,4,4,59,69,83,84,4015,4017,4025,4037,1,8833,113,117,97,108,59,3,10928,824,108,97,110,116,69,113,117,97,108,59,1,8929,105,108,100,101,59,3,8831,824,101,114,115,101,116,4,2,59,69,4056,4059,3,8835,8402,113,117,97,108,59,1,8841,105,108,100,101,4,4,59,69,70,84,4080,4082,4089,4100,1,8769,113,117,97,108,59,1,8772,117,108,108,69,113,117,97,108,59,1,8775,105,108,100,101,59,1,8777,101,114,116,105,99,97,108,66,97,114,59,1,8740,99,114,59,3,55349,56489,105,108,100,101,5,209,1,59,4135,1,209,59,1,925,4,14,69,97,99,100,102,103,109,111,112,114,115,116,117,118,4170,4176,4187,4205,4212,4217,4228,4253,4259,4292,4295,4316,4337,4346,108,105,103,59,1,338,99,117,116,101,5,211,1,59,4185,1,211,4,2,105,121,4193,4202,114,99,5,212,1,59,4200,1,212,59,1,1054,98,108,97,99,59,1,336,114,59,3,55349,56594,114,97,118,101,5,210,1,59,4226,1,210,4,3,97,101,105,4236,4241,4246,99,114,59,1,332,103,97,59,1,937,99,114,111,110,59,1,927,112,102,59,3,55349,56646,101,110,67,117,114,108,121,4,2,68,81,4272,4285,111,117,98,108,101,81,117,111,116,101,59,1,8220,117,111,116,101,59,1,8216,59,1,10836,4,2,99,108,4301,4306,114,59,3,55349,56490,97,115,104,5,216,1,59,4314,1,216,105,4,2,108,109,4323,4332,100,101,5,213,1,59,4330,1,213,101,115,59,1,10807,109,108,5,214,1,59,4344,1,214,101,114,4,2,66,80,4354,4380,4,2,97,114,4360,4364,114,59,1,8254,97,99,4,2,101,107,4372,4375,59,1,9182,101,116,59,1,9140,97,114,101,110,116,104,101,115,105,115,59,1,9180,4,9,97,99,102,104,105,108,111,114,115,4413,4422,4426,4431,4435,4438,4448,4471,4561,114,116,105,97,108,68,59,1,8706,121,59,1,1055,114,59,3,55349,56595,105,59,1,934,59,1,928,117,115,77,105,110,117,115,59,1,177,4,2,105,112,4454,4467,110,99,97,114,101,112,108,97,110,101,59,1,8460,102,59,1,8473,4,4,59,101,105,111,4481,4483,4526,4531,1,10939,99,101,100,101,115,4,4,59,69,83,84,4498,4500,4507,4519,1,8826,113,117,97,108,59,1,10927,108,97,110,116,69,113,117,97,108,59,1,8828,105,108,100,101,59,1,8830,109,101,59,1,8243,4,2,100,112,4537,4543,117,99,116,59,1,8719,111,114,116,105,111,110,4,2,59,97,4555,4557,1,8759,108,59,1,8733,4,2,99,105,4567,4572,114,59,3,55349,56491,59,1,936,4,4,85,102,111,115,4585,4594,4599,4604,79,84,5,34,1,59,4592,1,34,114,59,3,55349,56596,112,102,59,1,8474,99,114,59,3,55349,56492,4,12,66,69,97,99,101,102,104,105,111,114,115,117,4636,4642,4650,4681,4704,4763,4767,4771,5047,5069,5081,5094,97,114,114,59,1,10512,71,5,174,1,59,4648,1,174,4,3,99,110,114,4658,4664,4668,117,116,101,59,1,340,103,59,1,10219,114,4,2,59,116,4675,4677,1,8608,108,59,1,10518,4,3,97,101,121,4689,4695,4701,114,111,110,59,1,344,100,105,108,59,1,342,59,1,1056,4,2,59,118,4710,4712,1,8476,101,114,115,101,4,2,69,85,4722,4748,4,2,108,113,4728,4736,101,109,101,110,116,59,1,8715,117,105,108,105,98,114,105,117,109,59,1,8651,112,69,113,117,105,108,105,98,114,105,117,109,59,1,10607,114,59,1,8476,111,59,1,929,103,104,116,4,8,65,67,68,70,84,85,86,97,4792,4840,4849,4905,4912,4972,5022,5040,4,2,110,114,4798,4811,103,108,101,66,114,97,99,107,101,116,59,1,10217,114,111,119,4,3,59,66,76,4822,4824,4829,1,8594,97,114,59,1,8677,101,102,116,65,114,114,111,119,59,1,8644,101,105,108,105,110,103,59,1,8969,111,4,2,117,119,4856,4869,98,108,101,66,114,97,99,107,101,116,59,1,10215,110,4,2,84,86,4876,4887,101,101,86,101,99,116,111,114,59,1,10589,101,99,116,111,114,4,2,59,66,4898,4900,1,8642,97,114,59,1,10581,108,111,111,114,59,1,8971,4,2,101,114,4918,4944,101,4,3,59,65,86,4927,4929,4936,1,8866,114,114,111,119,59,1,8614,101,99,116,111,114,59,1,10587,105,97,110,103,108,101,4,3,59,66,69,4958,4960,4965,1,8883,97,114,59,1,10704,113,117,97,108,59,1,8885,112,4,3,68,84,86,4981,4993,5004,111,119,110,86,101,99,116,111,114,59,1,10575,101,101,86,101,99,116,111,114,59,1,10588,101,99,116,111,114,4,2,59,66,5015,5017,1,8638,97,114,59,1,10580,101,99,116,111,114,4,2,59,66,5033,5035,1,8640,97,114,59,1,10579,114,114,111,119,59,1,8658,4,2,112,117,5053,5057,102,59,1,8477,110,100,73,109,112,108,105,101,115,59,1,10608,105,103,104,116,97,114,114,111,119,59,1,8667,4,2,99,104,5087,5091,114,59,1,8475,59,1,8625,108,101,68,101,108,97,121,101,100,59,1,10740,4,13,72,79,97,99,102,104,105,109,111,113,115,116,117,5134,5150,5157,5164,5198,5203,5259,5265,5277,5283,5374,5380,5385,4,2,67,99,5140,5146,72,99,121,59,1,1065,121,59,1,1064,70,84,99,121,59,1,1068,99,117,116,101,59,1,346,4,5,59,97,101,105,121,5176,5178,5184,5190,5195,1,10940,114,111,110,59,1,352,100,105,108,59,1,350,114,99,59,1,348,59,1,1057,114,59,3,55349,56598,111,114,116,4,4,68,76,82,85,5216,5227,5238,5250,111,119,110,65,114,114,111,119,59,1,8595,101,102,116,65,114,114,111,119,59,1,8592,105,103,104,116,65,114,114,111,119,59,1,8594,112,65,114,114,111,119,59,1,8593,103,109,97,59,1,931,97,108,108,67,105,114,99,108,101,59,1,8728,112,102,59,3,55349,56650,4,2,114,117,5289,5293,116,59,1,8730,97,114,101,4,4,59,73,83,85,5306,5308,5322,5367,1,9633,110,116,101,114,115,101,99,116,105,111,110,59,1,8851,117,4,2,98,112,5329,5347,115,101,116,4,2,59,69,5338,5340,1,8847,113,117,97,108,59,1,8849,101,114,115,101,116,4,2,59,69,5358,5360,1,8848,113,117,97,108,59,1,8850,110,105,111,110,59,1,8852,99,114,59,3,55349,56494,97,114,59,1,8902,4,4,98,99,109,112,5395,5420,5475,5478,4,2,59,115,5401,5403,1,8912,101,116,4,2,59,69,5411,5413,1,8912,113,117,97,108,59,1,8838,4,2,99,104,5426,5468,101,101,100,115,4,4,59,69,83,84,5440,5442,5449,5461,1,8827,113,117,97,108,59,1,10928,108,97,110,116,69,113,117,97,108,59,1,8829,105,108,100,101,59,1,8831,84,104,97,116,59,1,8715,59,1,8721,4,3,59,101,115,5486,5488,5507,1,8913,114,115,101,116,4,2,59,69,5498,5500,1,8835,113,117,97,108,59,1,8839,101,116,59,1,8913,4,11,72,82,83,97,99,102,104,105,111,114,115,5536,5546,5552,5567,5579,5602,5607,5655,5695,5701,5711,79,82,78,5,222,1,59,5544,1,222,65,68,69,59,1,8482,4,2,72,99,5558,5563,99,121,59,1,1035,121,59,1,1062,4,2,98,117,5573,5576,59,1,9,59,1,932,4,3,97,101,121,5587,5593,5599,114,111,110,59,1,356,100,105,108,59,1,354,59,1,1058,114,59,3,55349,56599,4,2,101,105,5613,5631,4,2,114,116,5619,5627,101,102,111,114,101,59,1,8756,97,59,1,920,4,2,99,110,5637,5647,107,83,112,97,99,101,59,3,8287,8202,83,112,97,99,101,59,1,8201,108,100,101,4,4,59,69,70,84,5668,5670,5677,5688,1,8764,113,117,97,108,59,1,8771,117,108,108,69,113,117,97,108,59,1,8773,105,108,100,101,59,1,8776,112,102,59,3,55349,56651,105,112,108,101,68,111,116,59,1,8411,4,2,99,116,5717,5722,114,59,3,55349,56495,114,111,107,59,1,358,4,14,97,98,99,100,102,103,109,110,111,112,114,115,116,117,5758,5789,5805,5823,5830,5835,5846,5852,5921,5937,6089,6095,6101,6108,4,2,99,114,5764,5774,117,116,101,5,218,1,59,5772,1,218,114,4,2,59,111,5781,5783,1,8607,99,105,114,59,1,10569,114,4,2,99,101,5796,5800,121,59,1,1038,118,101,59,1,364,4,2,105,121,5811,5820,114,99,5,219,1,59,5818,1,219,59,1,1059,98,108,97,99,59,1,368,114,59,3,55349,56600,114,97,118,101,5,217,1,59,5844,1,217,97,99,114,59,1,362,4,2,100,105,5858,5905,101,114,4,2,66,80,5866,5892,4,2,97,114,5872,5876,114,59,1,95,97,99,4,2,101,107,5884,5887,59,1,9183,101,116,59,1,9141,97,114,101,110,116,104,101,115,105,115,59,1,9181,111,110,4,2,59,80,5913,5915,1,8899,108,117,115,59,1,8846,4,2,103,112,5927,5932,111,110,59,1,370,102,59,3,55349,56652,4,8,65,68,69,84,97,100,112,115,5955,5985,5996,6009,6026,6033,6044,6075,114,114,111,119,4,3,59,66,68,5967,5969,5974,1,8593,97,114,59,1,10514,111,119,110,65,114,114,111,119,59,1,8645,111,119,110,65,114,114,111,119,59,1,8597,113,117,105,108,105,98,114,105,117,109,59,1,10606,101,101,4,2,59,65,6017,6019,1,8869,114,114,111,119,59,1,8613,114,114,111,119,59,1,8657,111,119,110,97,114,114,111,119,59,1,8661,101,114,4,2,76,82,6052,6063,101,102,116,65,114,114,111,119,59,1,8598,105,103,104,116,65,114,114,111,119,59,1,8599,105,4,2,59,108,6082,6084,1,978,111,110,59,1,933,105,110,103,59,1,366,99,114,59,3,55349,56496,105,108,100,101,59,1,360,109,108,5,220,1,59,6115,1,220,4,9,68,98,99,100,101,102,111,115,118,6137,6143,6148,6152,6166,6250,6255,6261,6267,97,115,104,59,1,8875,97,114,59,1,10987,121,59,1,1042,97,115,104,4,2,59,108,6161,6163,1,8873,59,1,10982,4,2,101,114,6172,6175,59,1,8897,4,3,98,116,121,6183,6188,6238,97,114,59,1,8214,4,2,59,105,6194,6196,1,8214,99,97,108,4,4,66,76,83,84,6209,6214,6220,6231,97,114,59,1,8739,105,110,101,59,1,124,101,112,97,114,97,116,111,114,59,1,10072,105,108,100,101,59,1,8768,84,104,105,110,83,112,97,99,101,59,1,8202,114,59,3,55349,56601,112,102,59,3,55349,56653,99,114,59,3,55349,56497,100,97,115,104,59,1,8874,4,5,99,101,102,111,115,6286,6292,6298,6303,6309,105,114,99,59,1,372,100,103,101,59,1,8896,114,59,3,55349,56602,112,102,59,3,55349,56654,99,114,59,3,55349,56498,4,4,102,105,111,115,6325,6330,6333,6339,114,59,3,55349,56603,59,1,926,112,102,59,3,55349,56655,99,114,59,3,55349,56499,4,9,65,73,85,97,99,102,111,115,117,6365,6370,6375,6380,6391,6405,6410,6416,6422,99,121,59,1,1071,99,121,59,1,1031,99,121,59,1,1070,99,117,116,101,5,221,1,59,6389,1,221,4,2,105,121,6397,6402,114,99,59,1,374,59,1,1067,114,59,3,55349,56604,112,102,59,3,55349,56656,99,114,59,3,55349,56500,109,108,59,1,376,4,8,72,97,99,100,101,102,111,115,6445,6450,6457,6472,6477,6501,6505,6510,99,121,59,1,1046,99,117,116,101,59,1,377,4,2,97,121,6463,6469,114,111,110,59,1,381,59,1,1047,111,116,59,1,379,4,2,114,116,6483,6497,111,87,105,100,116,104,83,112,97,99,101,59,1,8203,97,59,1,918,114,59,1,8488,112,102,59,1,8484,99,114,59,3,55349,56501,4,16,97,98,99,101,102,103,108,109,110,111,112,114,115,116,117,119,6550,6561,6568,6612,6622,6634,6645,6672,6699,6854,6870,6923,6933,6963,6974,6983,99,117,116,101,5,225,1,59,6559,1,225,114,101,118,101,59,1,259,4,6,59,69,100,105,117,121,6582,6584,6588,6591,6600,6609,1,8766,59,3,8766,819,59,1,8767,114,99,5,226,1,59,6598,1,226,116,101,5,180,1,59,6607,1,180,59,1,1072,108,105,103,5,230,1,59,6620,1,230,4,2,59,114,6628,6630,1,8289,59,3,55349,56606,114,97,118,101,5,224,1,59,6643,1,224,4,2,101,112,6651,6667,4,2,102,112,6657,6663,115,121,109,59,1,8501,104,59,1,8501,104,97,59,1,945,4,2,97,112,6678,6692,4,2,99,108,6684,6688,114,59,1,257,103,59,1,10815,5,38,1,59,6697,1,38,4,2,100,103,6705,6737,4,5,59,97,100,115,118,6717,6719,6724,6727,6734,1,8743,110,100,59,1,10837,59,1,10844,108,111,112,101,59,1,10840,59,1,10842,4,7,59,101,108,109,114,115,122,6753,6755,6758,6762,6814,6835,6848,1,8736,59,1,10660,101,59,1,8736,115,100,4,2,59,97,6770,6772,1,8737,4,8,97,98,99,100,101,102,103,104,6790,6793,6796,6799,6802,6805,6808,6811,59,1,10664,59,1,10665,59,1,10666,59,1,10667,59,1,10668,59,1,10669,59,1,10670,59,1,10671,116,4,2,59,118,6821,6823,1,8735,98,4,2,59,100,6830,6832,1,8894,59,1,10653,4,2,112,116,6841,6845,104,59,1,8738,59,1,197,97,114,114,59,1,9084,4,2,103,112,6860,6865,111,110,59,1,261,102,59,3,55349,56658,4,7,59,69,97,101,105,111,112,6886,6888,6891,6897,6900,6904,6908,1,8776,59,1,10864,99,105,114,59,1,10863,59,1,8778,100,59,1,8779,115,59,1,39,114,111,120,4,2,59,101,6917,6919,1,8776,113,59,1,8778,105,110,103,5,229,1,59,6931,1,229,4,3,99,116,121,6941,6946,6949,114,59,3,55349,56502,59,1,42,109,112,4,2,59,101,6957,6959,1,8776,113,59,1,8781,105,108,100,101,5,227,1,59,6972,1,227,109,108,5,228,1,59,6981,1,228,4,2,99,105,6989,6997,111,110,105,110,116,59,1,8755,110,116,59,1,10769,4,16,78,97,98,99,100,101,102,105,107,108,110,111,112,114,115,117,7036,7041,7119,7135,7149,7155,7219,7224,7347,7354,7463,7489,7786,7793,7814,7866,111,116,59,1,10989,4,2,99,114,7047,7094,107,4,4,99,101,112,115,7058,7064,7073,7080,111,110,103,59,1,8780,112,115,105,108,111,110,59,1,1014,114,105,109,101,59,1,8245,105,109,4,2,59,101,7088,7090,1,8765,113,59,1,8909,4,2,118,119,7100,7105,101,101,59,1,8893,101,100,4,2,59,103,7113,7115,1,8965,101,59,1,8965,114,107,4,2,59,116,7127,7129,1,9141,98,114,107,59,1,9142,4,2,111,121,7141,7146,110,103,59,1,8780,59,1,1073,113,117,111,59,1,8222,4,5,99,109,112,114,116,7167,7181,7188,7193,7199,97,117,115,4,2,59,101,7176,7178,1,8757,59,1,8757,112,116,121,118,59,1,10672,115,105,59,1,1014,110,111,117,59,1,8492,4,3,97,104,119,7207,7210,7213,59,1,946,59,1,8502,101,101,110,59,1,8812,114,59,3,55349,56607,103,4,7,99,111,115,116,117,118,119,7241,7262,7288,7305,7328,7335,7340,4,3,97,105,117,7249,7253,7258,112,59,1,8898,114,99,59,1,9711,112,59,1,8899,4,3,100,112,116,7270,7275,7281,111,116,59,1,10752,108,117,115,59,1,10753,105,109,101,115,59,1,10754,4,2,113,116,7294,7300,99,117,112,59,1,10758,97,114,59,1,9733,114,105,97,110,103,108,101,4,2,100,117,7318,7324,111,119,110,59,1,9661,112,59,1,9651,112,108,117,115,59,1,10756,101,101,59,1,8897,101,100,103,101,59,1,8896,97,114,111,119,59,1,10509,4,3,97,107,111,7362,7436,7458,4,2,99,110,7368,7432,107,4,3,108,115,116,7377,7386,7394,111,122,101,110,103,101,59,1,10731,113,117,97,114,101,59,1,9642,114,105,97,110,103,108,101,4,4,59,100,108,114,7411,7413,7419,7425,1,9652,111,119,110,59,1,9662,101,102,116,59,1,9666,105,103,104,116,59,1,9656,107,59,1,9251,4,2,49,51,7442,7454,4,2,50,52,7448,7451,59,1,9618,59,1,9617,52,59,1,9619,99,107,59,1,9608,4,2,101,111,7469,7485,4,2,59,113,7475,7478,3,61,8421,117,105,118,59,3,8801,8421,116,59,1,8976,4,4,112,116,119,120,7499,7504,7517,7523,102,59,3,55349,56659,4,2,59,116,7510,7512,1,8869,111,109,59,1,8869,116,105,101,59,1,8904,4,12,68,72,85,86,98,100,104,109,112,116,117,118,7549,7571,7597,7619,7655,7660,7682,7708,7715,7721,7728,7750,4,4,76,82,108,114,7559,7562,7565,7568,59,1,9559,59,1,9556,59,1,9558,59,1,9555,4,5,59,68,85,100,117,7583,7585,7588,7591,7594,1,9552,59,1,9574,59,1,9577,59,1,9572,59,1,9575,4,4,76,82,108,114,7607,7610,7613,7616,59,1,9565,59,1,9562,59,1,9564,59,1,9561,4,7,59,72,76,82,104,108,114,7635,7637,7640,7643,7646,7649,7652,1,9553,59,1,9580,59,1,9571,59,1,9568,59,1,9579,59,1,9570,59,1,9567,111,120,59,1,10697,4,4,76,82,108,114,7670,7673,7676,7679,59,1,9557,59,1,9554,59,1,9488,59,1,9484,4,5,59,68,85,100,117,7694,7696,7699,7702,7705,1,9472,59,1,9573,59,1,9576,59,1,9516,59,1,9524,105,110,117,115,59,1,8863,108,117,115,59,1,8862,105,109,101,115,59,1,8864,4,4,76,82,108,114,7738,7741,7744,7747,59,1,9563,59,1,9560,59,1,9496,59,1,9492,4,7,59,72,76,82,104,108,114,7766,7768,7771,7774,7777,7780,7783,1,9474,59,1,9578,59,1,9569,59,1,9566,59,1,9532,59,1,9508,59,1,9500,114,105,109,101,59,1,8245,4,2,101,118,7799,7804,118,101,59,1,728,98,97,114,5,166,1,59,7812,1,166,4,4,99,101,105,111,7824,7829,7834,7846,114,59,3,55349,56503,109,105,59,1,8271,109,4,2,59,101,7841,7843,1,8765,59,1,8909,108,4,3,59,98,104,7855,7857,7860,1,92,59,1,10693,115,117,98,59,1,10184,4,2,108,109,7872,7885,108,4,2,59,101,7879,7881,1,8226,116,59,1,8226,112,4,3,59,69,101,7894,7896,7899,1,8782,59,1,10926,4,2,59,113,7905,7907,1,8783,59,1,8783,4,15,97,99,100,101,102,104,105,108,111,114,115,116,117,119,121,7942,8021,8075,8080,8121,8126,8157,8279,8295,8430,8446,8485,8491,8707,8726,4,3,99,112,114,7950,7956,8007,117,116,101,59,1,263,4,6,59,97,98,99,100,115,7970,7972,7977,7984,7998,8003,1,8745,110,100,59,1,10820,114,99,117,112,59,1,10825,4,2,97,117,7990,7994,112,59,1,10827,112,59,1,10823,111,116,59,1,10816,59,3,8745,65024,4,2,101,111,8013,8017,116,59,1,8257,110,59,1,711,4,4,97,101,105,117,8031,8046,8056,8061,4,2,112,114,8037,8041,115,59,1,10829,111,110,59,1,269,100,105,108,5,231,1,59,8054,1,231,114,99,59,1,265,112,115,4,2,59,115,8069,8071,1,10828,109,59,1,10832,111,116,59,1,267,4,3,100,109,110,8088,8097,8104,105,108,5,184,1,59,8095,1,184,112,116,121,118,59,1,10674,116,5,162,2,59,101,8112,8114,1,162,114,100,111,116,59,1,183,114,59,3,55349,56608,4,3,99,101,105,8134,8138,8154,121,59,1,1095,99,107,4,2,59,109,8146,8148,1,10003,97,114,107,59,1,10003,59,1,967,114,4,7,59,69,99,101,102,109,115,8174,8176,8179,8258,8261,8268,8273,1,9675,59,1,10691,4,3,59,101,108,8187,8189,8193,1,710,113,59,1,8791,101,4,2,97,100,8200,8223,114,114,111,119,4,2,108,114,8210,8216,101,102,116,59,1,8634,105,103,104,116,59,1,8635,4,5,82,83,97,99,100,8235,8238,8241,8246,8252,59,1,174,59,1,9416,115,116,59,1,8859,105,114,99,59,1,8858,97,115,104,59,1,8861,59,1,8791,110,105,110,116,59,1,10768,105,100,59,1,10991,99,105,114,59,1,10690,117,98,115,4,2,59,117,8288,8290,1,9827,105,116,59,1,9827,4,4,108,109,110,112,8305,8326,8376,8400,111,110,4,2,59,101,8313,8315,1,58,4,2,59,113,8321,8323,1,8788,59,1,8788,4,2,109,112,8332,8344,97,4,2,59,116,8339,8341,1,44,59,1,64,4,3,59,102,108,8352,8354,8358,1,8705,110,59,1,8728,101,4,2,109,120,8365,8371,101,110,116,59,1,8705,101,115,59,1,8450,4,2,103,105,8382,8395,4,2,59,100,8388,8390,1,8773,111,116,59,1,10861,110,116,59,1,8750,4,3,102,114,121,8408,8412,8417,59,3,55349,56660,111,100,59,1,8720,5,169,2,59,115,8424,8426,1,169,114,59,1,8471,4,2,97,111,8436,8441,114,114,59,1,8629,115,115,59,1,10007,4,2,99,117,8452,8457,114,59,3,55349,56504,4,2,98,112,8463,8474,4,2,59,101,8469,8471,1,10959,59,1,10961,4,2,59,101,8480,8482,1,10960,59,1,10962,100,111,116,59,1,8943,4,7,100,101,108,112,114,118,119,8507,8522,8536,8550,8600,8697,8702,97,114,114,4,2,108,114,8516,8519,59,1,10552,59,1,10549,4,2,112,115,8528,8532,114,59,1,8926,99,59,1,8927,97,114,114,4,2,59,112,8545,8547,1,8630,59,1,10557,4,6,59,98,99,100,111,115,8564,8566,8573,8587,8592,8596,1,8746,114,99,97,112,59,1,10824,4,2,97,117,8579,8583,112,59,1,10822,112,59,1,10826,111,116,59,1,8845,114,59,1,10821,59,3,8746,65024,4,4,97,108,114,118,8610,8623,8663,8672,114,114,4,2,59,109,8618,8620,1,8631,59,1,10556,121,4,3,101,118,119,8632,8651,8656,113,4,2,112,115,8639,8645,114,101,99,59,1,8926,117,99,99,59,1,8927,101,101,59,1,8910,101,100,103,101,59,1,8911,101,110,5,164,1,59,8670,1,164,101,97,114,114,111,119,4,2,108,114,8684,8690,101,102,116,59,1,8630,105,103,104,116,59,1,8631,101,101,59,1,8910,101,100,59,1,8911,4,2,99,105,8713,8721,111,110,105,110,116,59,1,8754,110,116,59,1,8753,108,99,116,121,59,1,9005,4,19,65,72,97,98,99,100,101,102,104,105,106,108,111,114,115,116,117,119,122,8773,8778,8783,8821,8839,8854,8887,8914,8930,8944,9036,9041,9058,9197,9227,9258,9281,9297,9305,114,114,59,1,8659,97,114,59,1,10597,4,4,103,108,114,115,8793,8799,8805,8809,103,101,114,59,1,8224,101,116,104,59,1,8504,114,59,1,8595,104,4,2,59,118,8816,8818,1,8208,59,1,8867,4,2,107,108,8827,8834,97,114,111,119,59,1,10511,97,99,59,1,733,4,2,97,121,8845,8851,114,111,110,59,1,271,59,1,1076,4,3,59,97,111,8862,8864,8880,1,8518,4,2,103,114,8870,8876,103,101,114,59,1,8225,114,59,1,8650,116,115,101,113,59,1,10871,4,3,103,108,109,8895,8902,8907,5,176,1,59,8900,1,176,116,97,59,1,948,112,116,121,118,59,1,10673,4,2,105,114,8920,8926,115,104,116,59,1,10623,59,3,55349,56609,97,114,4,2,108,114,8938,8941,59,1,8643,59,1,8642,4,5,97,101,103,115,118,8956,8986,8989,8996,9001,109,4,3,59,111,115,8965,8967,8983,1,8900,110,100,4,2,59,115,8975,8977,1,8900,117,105,116,59,1,9830,59,1,9830,59,1,168,97,109,109,97,59,1,989,105,110,59,1,8946,4,3,59,105,111,9009,9011,9031,1,247,100,101,5,247,2,59,111,9020,9022,1,247,110,116,105,109,101,115,59,1,8903,110,120,59,1,8903,99,121,59,1,1106,99,4,2,111,114,9048,9053,114,110,59,1,8990,111,112,59,1,8973,4,5,108,112,116,117,119,9070,9076,9081,9130,9144,108,97,114,59,1,36,102,59,3,55349,56661,4,5,59,101,109,112,115,9093,9095,9109,9116,9122,1,729,113,4,2,59,100,9102,9104,1,8784,111,116,59,1,8785,105,110,117,115,59,1,8760,108,117,115,59,1,8724,113,117,97,114,101,59,1,8865,98,108,101,98,97,114,119,101,100,103,101,59,1,8966,110,4,3,97,100,104,9153,9160,9172,114,114,111,119,59,1,8595,111,119,110,97,114,114,111,119,115,59,1,8650,97,114,112,111,111,110,4,2,108,114,9184,9190,101,102,116,59,1,8643,105,103,104,116,59,1,8642,4,2,98,99,9203,9211,107,97,114,111,119,59,1,10512,4,2,111,114,9217,9222,114,110,59,1,8991,111,112,59,1,8972,4,3,99,111,116,9235,9248,9252,4,2,114,121,9241,9245,59,3,55349,56505,59,1,1109,108,59,1,10742,114,111,107,59,1,273,4,2,100,114,9264,9269,111,116,59,1,8945,105,4,2,59,102,9276,9278,1,9663,59,1,9662,4,2,97,104,9287,9292,114,114,59,1,8693,97,114,59,1,10607,97,110,103,108,101,59,1,10662,4,2,99,105,9311,9315,121,59,1,1119,103,114,97,114,114,59,1,10239,4,18,68,97,99,100,101,102,103,108,109,110,111,112,113,114,115,116,117,120,9361,9376,9398,9439,9444,9447,9462,9495,9531,9585,9598,9614,9659,9755,9771,9792,9808,9826,4,2,68,111,9367,9372,111,116,59,1,10871,116,59,1,8785,4,2,99,115,9382,9392,117,116,101,5,233,1,59,9390,1,233,116,101,114,59,1,10862,4,4,97,105,111,121,9408,9414,9430,9436,114,111,110,59,1,283,114,4,2,59,99,9421,9423,1,8790,5,234,1,59,9428,1,234,108,111,110,59,1,8789,59,1,1101,111,116,59,1,279,59,1,8519,4,2,68,114,9453,9458,111,116,59,1,8786,59,3,55349,56610,4,3,59,114,115,9470,9472,9482,1,10906,97,118,101,5,232,1,59,9480,1,232,4,2,59,100,9488,9490,1,10902,111,116,59,1,10904,4,4,59,105,108,115,9505,9507,9515,9518,1,10905,110,116,101,114,115,59,1,9191,59,1,8467,4,2,59,100,9524,9526,1,10901,111,116,59,1,10903,4,3,97,112,115,9539,9544,9564,99,114,59,1,275,116,121,4,3,59,115,118,9554,9556,9561,1,8709,101,116,59,1,8709,59,1,8709,112,4,2,49,59,9571,9583,4,2,51,52,9577,9580,59,1,8196,59,1,8197,1,8195,4,2,103,115,9591,9594,59,1,331,112,59,1,8194,4,2,103,112,9604,9609,111,110,59,1,281,102,59,3,55349,56662,4,3,97,108,115,9622,9635,9640,114,4,2,59,115,9629,9631,1,8917,108,59,1,10723,117,115,59,1,10865,105,4,3,59,108,118,9649,9651,9656,1,949,111,110,59,1,949,59,1,1013,4,4,99,115,117,118,9669,9686,9716,9747,4,2,105,111,9675,9680,114,99,59,1,8790,108,111,110,59,1,8789,4,2,105,108,9692,9696,109,59,1,8770,97,110,116,4,2,103,108,9705,9710,116,114,59,1,10902,101,115,115,59,1,10901,4,3,97,101,105,9724,9729,9734,108,115,59,1,61,115,116,59,1,8799,118,4,2,59,68,9741,9743,1,8801,68,59,1,10872,112,97,114,115,108,59,1,10725,4,2,68,97,9761,9766,111,116,59,1,8787,114,114,59,1,10609,4,3,99,100,105,9779,9783,9788,114,59,1,8495,111,116,59,1,8784,109,59,1,8770,4,2,97,104,9798,9801,59,1,951,5,240,1,59,9806,1,240,4,2,109,114,9814,9822,108,5,235,1,59,9820,1,235,111,59,1,8364,4,3,99,105,112,9834,9838,9843,108,59,1,33,115,116,59,1,8707,4,2,101,111,9849,9859,99,116,97,116,105,111,110,59,1,8496,110,101,110,116,105,97,108,101,59,1,8519,4,12,97,99,101,102,105,106,108,110,111,112,114,115,9896,9910,9914,9921,9954,9960,9967,9989,9994,10027,10036,10164,108,108,105,110,103,100,111,116,115,101,113,59,1,8786,121,59,1,1092,109,97,108,101,59,1,9792,4,3,105,108,114,9929,9935,9950,108,105,103,59,1,64259,4,2,105,108,9941,9945,103,59,1,64256,105,103,59,1,64260,59,3,55349,56611,108,105,103,59,1,64257,108,105,103,59,3,102,106,4,3,97,108,116,9975,9979,9984,116,59,1,9837,105,103,59,1,64258,110,115,59,1,9649,111,102,59,1,402,4,2,112,114,10000,10005,102,59,3,55349,56663,4,2,97,107,10011,10016,108,108,59,1,8704,4,2,59,118,10022,10024,1,8916,59,1,10969,97,114,116,105,110,116,59,1,10765,4,2,97,111,10042,10159,4,2,99,115,10048,10155,4,6,49,50,51,52,53,55,10062,10102,10114,10135,10139,10151,4,6,50,51,52,53,54,56,10076,10083,10086,10093,10096,10099,5,189,1,59,10081,1,189,59,1,8531,5,188,1,59,10091,1,188,59,1,8533,59,1,8537,59,1,8539,4,2,51,53,10108,10111,59,1,8532,59,1,8534,4,3,52,53,56,10122,10129,10132,5,190,1,59,10127,1,190,59,1,8535,59,1,8540,53,59,1,8536,4,2,54,56,10145,10148,59,1,8538,59,1,8541,56,59,1,8542,108,59,1,8260,119,110,59,1,8994,99,114,59,3,55349,56507,4,17,69,97,98,99,100,101,102,103,105,106,108,110,111,114,115,116,118,10206,10217,10247,10254,10268,10273,10358,10363,10374,10380,10385,10406,10458,10464,10470,10497,10610,4,2,59,108,10212,10214,1,8807,59,1,10892,4,3,99,109,112,10225,10231,10244,117,116,101,59,1,501,109,97,4,2,59,100,10239,10241,1,947,59,1,989,59,1,10886,114,101,118,101,59,1,287,4,2,105,121,10260,10265,114,99,59,1,285,59,1,1075,111,116,59,1,289,4,4,59,108,113,115,10283,10285,10288,10308,1,8805,59,1,8923,4,3,59,113,115,10296,10298,10301,1,8805,59,1,8807,108,97,110,116,59,1,10878,4,4,59,99,100,108,10318,10320,10324,10345,1,10878,99,59,1,10921,111,116,4,2,59,111,10332,10334,1,10880,4,2,59,108,10340,10342,1,10882,59,1,10884,4,2,59,101,10351,10354,3,8923,65024,115,59,1,10900,114,59,3,55349,56612,4,2,59,103,10369,10371,1,8811,59,1,8921,109,101,108,59,1,8503,99,121,59,1,1107,4,4,59,69,97,106,10395,10397,10400,10403,1,8823,59,1,10898,59,1,10917,59,1,10916,4,4,69,97,101,115,10416,10419,10434,10453,59,1,8809,112,4,2,59,112,10426,10428,1,10890,114,111,120,59,1,10890,4,2,59,113,10440,10442,1,10888,4,2,59,113,10448,10450,1,10888,59,1,8809,105,109,59,1,8935,112,102,59,3,55349,56664,97,118,101,59,1,96,4,2,99,105,10476,10480,114,59,1,8458,109,4,3,59,101,108,10489,10491,10494,1,8819,59,1,10894,59,1,10896,5,62,6,59,99,100,108,113,114,10512,10514,10527,10532,10538,10545,1,62,4,2,99,105,10520,10523,59,1,10919,114,59,1,10874,111,116,59,1,8919,80,97,114,59,1,10645,117,101,115,116,59,1,10876,4,5,97,100,101,108,115,10557,10574,10579,10599,10605,4,2,112,114,10563,10570,112,114,111,120,59,1,10886,114,59,1,10616,111,116,59,1,8919,113,4,2,108,113,10586,10592,101,115,115,59,1,8923,108,101,115,115,59,1,10892,101,115,115,59,1,8823,105,109,59,1,8819,4,2,101,110,10616,10626,114,116,110,101,113,113,59,3,8809,65024,69,59,3,8809,65024,4,10,65,97,98,99,101,102,107,111,115,121,10653,10658,10713,10718,10724,10760,10765,10786,10850,10875,114,114,59,1,8660,4,4,105,108,109,114,10668,10674,10678,10684,114,115,112,59,1,8202,102,59,1,189,105,108,116,59,1,8459,4,2,100,114,10690,10695,99,121,59,1,1098,4,3,59,99,119,10703,10705,10710,1,8596,105,114,59,1,10568,59,1,8621,97,114,59,1,8463,105,114,99,59,1,293,4,3,97,108,114,10732,10748,10754,114,116,115,4,2,59,117,10741,10743,1,9829,105,116,59,1,9829,108,105,112,59,1,8230,99,111,110,59,1,8889,114,59,3,55349,56613,115,4,2,101,119,10772,10779,97,114,111,119,59,1,10533,97,114,111,119,59,1,10534,4,5,97,109,111,112,114,10798,10803,10809,10839,10844,114,114,59,1,8703,116,104,116,59,1,8763,107,4,2,108,114,10816,10827,101,102,116,97,114,114,111,119,59,1,8617,105,103,104,116,97,114,114,111,119,59,1,8618,102,59,3,55349,56665,98,97,114,59,1,8213,4,3,99,108,116,10858,10863,10869,114,59,3,55349,56509,97,115,104,59,1,8463,114,111,107,59,1,295,4,2,98,112,10881,10887,117,108,108,59,1,8259,104,101,110,59,1,8208,4,15,97,99,101,102,103,105,106,109,110,111,112,113,115,116,117,10925,10936,10958,10977,10990,11001,11039,11045,11101,11192,11220,11226,11237,11285,11299,99,117,116,101,5,237,1,59,10934,1,237,4,3,59,105,121,10944,10946,10955,1,8291,114,99,5,238,1,59,10953,1,238,59,1,1080,4,2,99,120,10964,10968,121,59,1,1077,99,108,5,161,1,59,10975,1,161,4,2,102,114,10983,10986,59,1,8660,59,3,55349,56614,114,97,118,101,5,236,1,59,10999,1,236,4,4,59,105,110,111,11011,11013,11028,11034,1,8520,4,2,105,110,11019,11024,110,116,59,1,10764,116,59,1,8749,102,105,110,59,1,10716,116,97,59,1,8489,108,105,103,59,1,307,4,3,97,111,112,11053,11092,11096,4,3,99,103,116,11061,11065,11088,114,59,1,299,4,3,101,108,112,11073,11076,11082,59,1,8465,105,110,101,59,1,8464,97,114,116,59,1,8465,104,59,1,305,102,59,1,8887,101,100,59,1,437,4,5,59,99,102,111,116,11113,11115,11121,11136,11142,1,8712,97,114,101,59,1,8453,105,110,4,2,59,116,11129,11131,1,8734,105,101,59,1,10717,100,111,116,59,1,305,4,5,59,99,101,108,112,11154,11156,11161,11179,11186,1,8747,97,108,59,1,8890,4,2,103,114,11167,11173,101,114,115,59,1,8484,99,97,108,59,1,8890,97,114,104,107,59,1,10775,114,111,100,59,1,10812,4,4,99,103,112,116,11202,11206,11211,11216,121,59,1,1105,111,110,59,1,303,102,59,3,55349,56666,97,59,1,953,114,111,100,59,1,10812,117,101,115,116,5,191,1,59,11235,1,191,4,2,99,105,11243,11248,114,59,3,55349,56510,110,4,5,59,69,100,115,118,11261,11263,11266,11271,11282,1,8712,59,1,8953,111,116,59,1,8949,4,2,59,118,11277,11279,1,8948,59,1,8947,59,1,8712,4,2,59,105,11291,11293,1,8290,108,100,101,59,1,297,4,2,107,109,11305,11310,99,121,59,1,1110,108,5,239,1,59,11316,1,239,4,6,99,102,109,111,115,117,11332,11346,11351,11357,11363,11380,4,2,105,121,11338,11343,114,99,59,1,309,59,1,1081,114,59,3,55349,56615,97,116,104,59,1,567,112,102,59,3,55349,56667,4,2,99,101,11369,11374,114,59,3,55349,56511,114,99,121,59,1,1112,107,99,121,59,1,1108,4,8,97,99,102,103,104,106,111,115,11404,11418,11433,11438,11445,11450,11455,11461,112,112,97,4,2,59,118,11413,11415,1,954,59,1,1008,4,2,101,121,11424,11430,100,105,108,59,1,311,59,1,1082,114,59,3,55349,56616,114,101,101,110,59,1,312,99,121,59,1,1093,99,121,59,1,1116,112,102,59,3,55349,56668,99,114,59,3,55349,56512,4,23,65,66,69,72,97,98,99,100,101,102,103,104,106,108,109,110,111,112,114,115,116,117,118,11515,11538,11544,11555,11560,11721,11780,11818,11868,12136,12160,12171,12203,12208,12246,12275,12327,12509,12523,12569,12641,12732,12752,4,3,97,114,116,11523,11528,11532,114,114,59,1,8666,114,59,1,8656,97,105,108,59,1,10523,97,114,114,59,1,10510,4,2,59,103,11550,11552,1,8806,59,1,10891,97,114,59,1,10594,4,9,99,101,103,109,110,112,113,114,116,11580,11586,11594,11600,11606,11624,11627,11636,11694,117,116,101,59,1,314,109,112,116,121,118,59,1,10676,114,97,110,59,1,8466,98,100,97,59,1,955,103,4,3,59,100,108,11615,11617,11620,1,10216,59,1,10641,101,59,1,10216,59,1,10885,117,111,5,171,1,59,11634,1,171,114,4,8,59,98,102,104,108,112,115,116,11655,11657,11669,11673,11677,11681,11685,11690,1,8592,4,2,59,102,11663,11665,1,8676,115,59,1,10527,115,59,1,10525,107,59,1,8617,112,59,1,8619,108,59,1,10553,105,109,59,1,10611,108,59,1,8610,4,3,59,97,101,11702,11704,11709,1,10923,105,108,59,1,10521,4,2,59,115,11715,11717,1,10925,59,3,10925,65024,4,3,97,98,114,11729,11734,11739,114,114,59,1,10508,114,107,59,1,10098,4,2,97,107,11745,11758,99,4,2,101,107,11752,11755,59,1,123,59,1,91,4,2,101,115,11764,11767,59,1,10635,108,4,2,100,117,11774,11777,59,1,10639,59,1,10637,4,4,97,101,117,121,11790,11796,11811,11815,114,111,110,59,1,318,4,2,100,105,11802,11807,105,108,59,1,316,108,59,1,8968,98,59,1,123,59,1,1083,4,4,99,113,114,115,11828,11832,11845,11864,97,59,1,10550,117,111,4,2,59,114,11840,11842,1,8220,59,1,8222,4,2,100,117,11851,11857,104,97,114,59,1,10599,115,104,97,114,59,1,10571,104,59,1,8626,4,5,59,102,103,113,115,11880,11882,12008,12011,12031,1,8804,116,4,5,97,104,108,114,116,11895,11913,11935,11947,11996,114,114,111,119,4,2,59,116,11905,11907,1,8592,97,105,108,59,1,8610,97,114,112,111,111,110,4,2,100,117,11925,11931,111,119,110,59,1,8637,112,59,1,8636,101,102,116,97,114,114,111,119,115,59,1,8647,105,103,104,116,4,3,97,104,115,11959,11974,11984,114,114,111,119,4,2,59,115,11969,11971,1,8596,59,1,8646,97,114,112,111,111,110,115,59,1,8651,113,117,105,103,97,114,114,111,119,59,1,8621,104,114,101,101,116,105,109,101,115,59,1,8907,59,1,8922,4,3,59,113,115,12019,12021,12024,1,8804,59,1,8806,108,97,110,116,59,1,10877,4,5,59,99,100,103,115,12043,12045,12049,12070,12083,1,10877,99,59,1,10920,111,116,4,2,59,111,12057,12059,1,10879,4,2,59,114,12065,12067,1,10881,59,1,10883,4,2,59,101,12076,12079,3,8922,65024,115,59,1,10899,4,5,97,100,101,103,115,12095,12103,12108,12126,12131,112,112,114,111,120,59,1,10885,111,116,59,1,8918,113,4,2,103,113,12115,12120,116,114,59,1,8922,103,116,114,59,1,10891,116,114,59,1,8822,105,109,59,1,8818,4,3,105,108,114,12144,12150,12156,115,104,116,59,1,10620,111,111,114,59,1,8970,59,3,55349,56617,4,2,59,69,12166,12168,1,8822,59,1,10897,4,2,97,98,12177,12198,114,4,2,100,117,12184,12187,59,1,8637,4,2,59,108,12193,12195,1,8636,59,1,10602,108,107,59,1,9604,99,121,59,1,1113,4,5,59,97,99,104,116,12220,12222,12227,12235,12241,1,8810,114,114,59,1,8647,111,114,110,101,114,59,1,8990,97,114,100,59,1,10603,114,105,59,1,9722,4,2,105,111,12252,12258,100,111,116,59,1,320,117,115,116,4,2,59,97,12267,12269,1,9136,99,104,101,59,1,9136,4,4,69,97,101,115,12285,12288,12303,12322,59,1,8808,112,4,2,59,112,12295,12297,1,10889,114,111,120,59,1,10889,4,2,59,113,12309,12311,1,10887,4,2,59,113,12317,12319,1,10887,59,1,8808,105,109,59,1,8934,4,8,97,98,110,111,112,116,119,122,12345,12359,12364,12421,12446,12467,12474,12490,4,2,110,114,12351,12355,103,59,1,10220,114,59,1,8701,114,107,59,1,10214,103,4,3,108,109,114,12373,12401,12409,101,102,116,4,2,97,114,12382,12389,114,114,111,119,59,1,10229,105,103,104,116,97,114,114,111,119,59,1,10231,97,112,115,116,111,59,1,10236,105,103,104,116,97,114,114,111,119,59,1,10230,112,97,114,114,111,119,4,2,108,114,12433,12439,101,102,116,59,1,8619,105,103,104,116,59,1,8620,4,3,97,102,108,12454,12458,12462,114,59,1,10629,59,3,55349,56669,117,115,59,1,10797,105,109,101,115,59,1,10804,4,2,97,98,12480,12485,115,116,59,1,8727,97,114,59,1,95,4,3,59,101,102,12498,12500,12506,1,9674,110,103,101,59,1,9674,59,1,10731,97,114,4,2,59,108,12517,12519,1,40,116,59,1,10643,4,5,97,99,104,109,116,12535,12540,12548,12561,12564,114,114,59,1,8646,111,114,110,101,114,59,1,8991,97,114,4,2,59,100,12556,12558,1,8651,59,1,10605,59,1,8206,114,105,59,1,8895,4,6,97,99,104,105,113,116,12583,12589,12594,12597,12614,12635,113,117,111,59,1,8249,114,59,3,55349,56513,59,1,8624,109,4,3,59,101,103,12606,12608,12611,1,8818,59,1,10893,59,1,10895,4,2,98,117,12620,12623,59,1,91,111,4,2,59,114,12630,12632,1,8216,59,1,8218,114,111,107,59,1,322,5,60,8,59,99,100,104,105,108,113,114,12660,12662,12675,12680,12686,12692,12698,12705,1,60,4,2,99,105,12668,12671,59,1,10918,114,59,1,10873,111,116,59,1,8918,114,101,101,59,1,8907,109,101,115,59,1,8905,97,114,114,59,1,10614,117,101,115,116,59,1,10875,4,2,80,105,12711,12716,97,114,59,1,10646,4,3,59,101,102,12724,12726,12729,1,9667,59,1,8884,59,1,9666,114,4,2,100,117,12739,12746,115,104,97,114,59,1,10570,104,97,114,59,1,10598,4,2,101,110,12758,12768,114,116,110,101,113,113,59,3,8808,65024,69,59,3,8808,65024,4,14,68,97,99,100,101,102,104,105,108,110,111,112,115,117,12803,12809,12893,12908,12914,12928,12933,12937,13011,13025,13032,13049,13052,13069,68,111,116,59,1,8762,4,4,99,108,112,114,12819,12827,12849,12887,114,5,175,1,59,12825,1,175,4,2,101,116,12833,12836,59,1,9794,4,2,59,101,12842,12844,1,10016,115,101,59,1,10016,4,2,59,115,12855,12857,1,8614,116,111,4,4,59,100,108,117,12869,12871,12877,12883,1,8614,111,119,110,59,1,8615,101,102,116,59,1,8612,112,59,1,8613,107,101,114,59,1,9646,4,2,111,121,12899,12905,109,109,97,59,1,10793,59,1,1084,97,115,104,59,1,8212,97,115,117,114,101,100,97,110,103,108,101,59,1,8737,114,59,3,55349,56618,111,59,1,8487,4,3,99,100,110,12945,12954,12985,114,111,5,181,1,59,12952,1,181,4,4,59,97,99,100,12964,12966,12971,12976,1,8739,115,116,59,1,42,105,114,59,1,10992,111,116,5,183,1,59,12983,1,183,117,115,4,3,59,98,100,12995,12997,13000,1,8722,59,1,8863,4,2,59,117,13006,13008,1,8760,59,1,10794,4,2,99,100,13017,13021,112,59,1,10971,114,59,1,8230,112,108,117,115,59,1,8723,4,2,100,112,13038,13044,101,108,115,59,1,8871,102,59,3,55349,56670,59,1,8723,4,2,99,116,13058,13063,114,59,3,55349,56514,112,111,115,59,1,8766,4,3,59,108,109,13077,13079,13087,1,956,116,105,109,97,112,59,1,8888,97,112,59,1,8888,4,24,71,76,82,86,97,98,99,100,101,102,103,104,105,106,108,109,111,112,114,115,116,117,118,119,13142,13165,13217,13229,13247,13330,13359,13414,13420,13508,13513,13579,13602,13626,13631,13762,13767,13855,13936,13995,14214,14285,14312,14432,4,2,103,116,13148,13152,59,3,8921,824,4,2,59,118,13158,13161,3,8811,8402,59,3,8811,824,4,3,101,108,116,13173,13200,13204,102,116,4,2,97,114,13181,13188,114,114,111,119,59,1,8653,105,103,104,116,97,114,114,111,119,59,1,8654,59,3,8920,824,4,2,59,118,13210,13213,3,8810,8402,59,3,8810,824,105,103,104,116,97,114,114,111,119,59,1,8655,4,2,68,100,13235,13241,97,115,104,59,1,8879,97,115,104,59,1,8878,4,5,98,99,110,112,116,13259,13264,13270,13275,13308,108,97,59,1,8711,117,116,101,59,1,324,103,59,3,8736,8402,4,5,59,69,105,111,112,13287,13289,13293,13298,13302,1,8777,59,3,10864,824,100,59,3,8779,824,115,59,1,329,114,111,120,59,1,8777,117,114,4,2,59,97,13316,13318,1,9838,108,4,2,59,115,13325,13327,1,9838,59,1,8469,4,2,115,117,13336,13344,112,5,160,1,59,13342,1,160,109,112,4,2,59,101,13352,13355,3,8782,824,59,3,8783,824,4,5,97,101,111,117,121,13371,13385,13391,13407,13411,4,2,112,114,13377,13380,59,1,10819,111,110,59,1,328,100,105,108,59,1,326,110,103,4,2,59,100,13399,13401,1,8775,111,116,59,3,10861,824,112,59,1,10818,59,1,1085,97,115,104,59,1,8211,4,7,59,65,97,100,113,115,120,13436,13438,13443,13466,13472,13478,13494,1,8800,114,114,59,1,8663,114,4,2,104,114,13450,13454,107,59,1,10532,4,2,59,111,13460,13462,1,8599,119,59,1,8599,111,116,59,3,8784,824,117,105,118,59,1,8802,4,2,101,105,13484,13489,97,114,59,1,10536,109,59,3,8770,824,105,115,116,4,2,59,115,13503,13505,1,8708,59,1,8708,114,59,3,55349,56619,4,4,69,101,115,116,13523,13527,13563,13568,59,3,8807,824,4,3,59,113,115,13535,13537,13559,1,8817,4,3,59,113,115,13545,13547,13551,1,8817,59,3,8807,824,108,97,110,116,59,3,10878,824,59,3,10878,824,105,109,59,1,8821,4,2,59,114,13574,13576,1,8815,59,1,8815,4,3,65,97,112,13587,13592,13597,114,114,59,1,8654,114,114,59,1,8622,97,114,59,1,10994,4,3,59,115,118,13610,13612,13623,1,8715,4,2,59,100,13618,13620,1,8956,59,1,8954,59,1,8715,99,121,59,1,1114,4,7,65,69,97,100,101,115,116,13647,13652,13656,13661,13665,13737,13742,114,114,59,1,8653,59,3,8806,824,114,114,59,1,8602,114,59,1,8229,4,4,59,102,113,115,13675,13677,13703,13725,1,8816,116,4,2,97,114,13684,13691,114,114,111,119,59,1,8602,105,103,104,116,97,114,114,111,119,59,1,8622,4,3,59,113,115,13711,13713,13717,1,8816,59,3,8806,824,108,97,110,116,59,3,10877,824,4,2,59,115,13731,13734,3,10877,824,59,1,8814,105,109,59,1,8820,4,2,59,114,13748,13750,1,8814,105,4,2,59,101,13757,13759,1,8938,59,1,8940,105,100,59,1,8740,4,2,112,116,13773,13778,102,59,3,55349,56671,5,172,3,59,105,110,13787,13789,13829,1,172,110,4,4,59,69,100,118,13800,13802,13806,13812,1,8713,59,3,8953,824,111,116,59,3,8949,824,4,3,97,98,99,13820,13823,13826,59,1,8713,59,1,8951,59,1,8950,105,4,2,59,118,13836,13838,1,8716,4,3,97,98,99,13846,13849,13852,59,1,8716,59,1,8958,59,1,8957,4,3,97,111,114,13863,13892,13899,114,4,4,59,97,115,116,13874,13876,13883,13888,1,8742,108,108,101,108,59,1,8742,108,59,3,11005,8421,59,3,8706,824,108,105,110,116,59,1,10772,4,3,59,99,101,13907,13909,13914,1,8832,117,101,59,1,8928,4,2,59,99,13920,13923,3,10927,824,4,2,59,101,13929,13931,1,8832,113,59,3,10927,824,4,4,65,97,105,116,13946,13951,13971,13982,114,114,59,1,8655,114,114,4,3,59,99,119,13961,13963,13967,1,8603,59,3,10547,824,59,3,8605,824,103,104,116,97,114,114,111,119,59,1,8603,114,105,4,2,59,101,13990,13992,1,8939,59,1,8941,4,7,99,104,105,109,112,113,117,14011,14036,14060,14080,14085,14090,14106,4,4,59,99,101,114,14021,14023,14028,14032,1,8833,117,101,59,1,8929,59,3,10928,824,59,3,55349,56515,111,114,116,4,2,109,112,14045,14050,105,100,59,1,8740,97,114,97,108,108,101,108,59,1,8742,109,4,2,59,101,14067,14069,1,8769,4,2,59,113,14075,14077,1,8772,59,1,8772,105,100,59,1,8740,97,114,59,1,8742,115,117,4,2,98,112,14098,14102,101,59,1,8930,101,59,1,8931,4,3,98,99,112,14114,14157,14171,4,4,59,69,101,115,14124,14126,14130,14133,1,8836,59,3,10949,824,59,1,8840,101,116,4,2,59,101,14141,14144,3,8834,8402,113,4,2,59,113,14151,14153,1,8840,59,3,10949,824,99,4,2,59,101,14164,14166,1,8833,113,59,3,10928,824,4,4,59,69,101,115,14181,14183,14187,14190,1,8837,59,3,10950,824,59,1,8841,101,116,4,2,59,101,14198,14201,3,8835,8402,113,4,2,59,113,14208,14210,1,8841,59,3,10950,824,4,4,103,105,108,114,14224,14228,14238,14242,108,59,1,8825,108,100,101,5,241,1,59,14236,1,241,103,59,1,8824,105,97,110,103,108,101,4,2,108,114,14254,14269,101,102,116,4,2,59,101,14263,14265,1,8938,113,59,1,8940,105,103,104,116,4,2,59,101,14279,14281,1,8939,113,59,1,8941,4,2,59,109,14291,14293,1,957,4,3,59,101,115,14301,14303,14308,1,35,114,111,59,1,8470,112,59,1,8199,4,9,68,72,97,100,103,105,108,114,115,14332,14338,14344,14349,14355,14369,14376,14408,14426,97,115,104,59,1,8877,97,114,114,59,1,10500,112,59,3,8781,8402,97,115,104,59,1,8876,4,2,101,116,14361,14365,59,3,8805,8402,59,3,62,8402,110,102,105,110,59,1,10718,4,3,65,101,116,14384,14389,14393,114,114,59,1,10498,59,3,8804,8402,4,2,59,114,14399,14402,3,60,8402,105,101,59,3,8884,8402,4,2,65,116,14414,14419,114,114,59,1,10499,114,105,101,59,3,8885,8402,105,109,59,3,8764,8402,4,3,65,97,110,14440,14445,14468,114,114,59,1,8662,114,4,2,104,114,14452,14456,107,59,1,10531,4,2,59,111,14462,14464,1,8598,119,59,1,8598,101,97,114,59,1,10535,4,18,83,97,99,100,101,102,103,104,105,108,109,111,112,114,115,116,117,118,14512,14515,14535,14560,14597,14603,14618,14643,14657,14662,14701,14741,14747,14769,14851,14877,14907,14916,59,1,9416,4,2,99,115,14521,14531,117,116,101,5,243,1,59,14529,1,243,116,59,1,8859,4,2,105,121,14541,14557,114,4,2,59,99,14548,14550,1,8858,5,244,1,59,14555,1,244,59,1,1086,4,5,97,98,105,111,115,14572,14577,14583,14587,14591,115,104,59,1,8861,108,97,99,59,1,337,118,59,1,10808,116,59,1,8857,111,108,100,59,1,10684,108,105,103,59,1,339,4,2,99,114,14609,14614,105,114,59,1,10687,59,3,55349,56620,4,3,111,114,116,14626,14630,14640,110,59,1,731,97,118,101,5,242,1,59,14638,1,242,59,1,10689,4,2,98,109,14649,14654,97,114,59,1,10677,59,1,937,110,116,59,1,8750,4,4,97,99,105,116,14672,14677,14693,14698,114,114,59,1,8634,4,2,105,114,14683,14687,114,59,1,10686,111,115,115,59,1,10683,110,101,59,1,8254,59,1,10688,4,3,97,101,105,14709,14714,14719,99,114,59,1,333,103,97,59,1,969,4,3,99,100,110,14727,14733,14736,114,111,110,59,1,959,59,1,10678,117,115,59,1,8854,112,102,59,3,55349,56672,4,3,97,101,108,14755,14759,14764,114,59,1,10679,114,112,59,1,10681,117,115,59,1,8853,4,7,59,97,100,105,111,115,118,14785,14787,14792,14831,14837,14841,14848,1,8744,114,114,59,1,8635,4,4,59,101,102,109,14802,14804,14817,14824,1,10845,114,4,2,59,111,14811,14813,1,8500,102,59,1,8500,5,170,1,59,14822,1,170,5,186,1,59,14829,1,186,103,111,102,59,1,8886,114,59,1,10838,108,111,112,101,59,1,10839,59,1,10843,4,3,99,108,111,14859,14863,14873,114,59,1,8500,97,115,104,5,248,1,59,14871,1,248,108,59,1,8856,105,4,2,108,109,14884,14893,100,101,5,245,1,59,14891,1,245,101,115,4,2,59,97,14901,14903,1,8855,115,59,1,10806,109,108,5,246,1,59,14914,1,246,98,97,114,59,1,9021,4,12,97,99,101,102,104,105,108,109,111,114,115,117,14948,14992,14996,15033,15038,15068,15090,15189,15192,15222,15427,15441,114,4,4,59,97,115,116,14959,14961,14976,14989,1,8741,5,182,2,59,108,14968,14970,1,182,108,101,108,59,1,8741,4,2,105,108,14982,14986,109,59,1,10995,59,1,11005,59,1,8706,121,59,1,1087,114,4,5,99,105,109,112,116,15009,15014,15019,15024,15027,110,116,59,1,37,111,100,59,1,46,105,108,59,1,8240,59,1,8869,101,110,107,59,1,8241,114,59,3,55349,56621,4,3,105,109,111,15046,15057,15063,4,2,59,118,15052,15054,1,966,59,1,981,109,97,116,59,1,8499,110,101,59,1,9742,4,3,59,116,118,15076,15078,15087,1,960,99,104,102,111,114,107,59,1,8916,59,1,982,4,2,97,117,15096,15119,110,4,2,99,107,15103,15115,107,4,2,59,104,15110,15112,1,8463,59,1,8462,118,59,1,8463,115,4,9,59,97,98,99,100,101,109,115,116,15140,15142,15148,15151,15156,15168,15171,15179,15184,1,43,99,105,114,59,1,10787,59,1,8862,105,114,59,1,10786,4,2,111,117,15162,15165,59,1,8724,59,1,10789,59,1,10866,110,5,177,1,59,15177,1,177,105,109,59,1,10790,119,111,59,1,10791,59,1,177,4,3,105,112,117,15200,15208,15213,110,116,105,110,116,59,1,10773,102,59,3,55349,56673,110,100,5,163,1,59,15220,1,163,4,10,59,69,97,99,101,105,110,111,115,117,15244,15246,15249,15253,15258,15334,15347,15367,15416,15421,1,8826,59,1,10931,112,59,1,10935,117,101,59,1,8828,4,2,59,99,15264,15266,1,10927,4,6,59,97,99,101,110,115,15280,15282,15290,15299,15303,15329,1,8826,112,112,114,111,120,59,1,10935,117,114,108,121,101,113,59,1,8828,113,59,1,10927,4,3,97,101,115,15311,15319,15324,112,112,114,111,120,59,1,10937,113,113,59,1,10933,105,109,59,1,8936,105,109,59,1,8830,109,101,4,2,59,115,15342,15344,1,8242,59,1,8473,4,3,69,97,115,15355,15358,15362,59,1,10933,112,59,1,10937,105,109,59,1,8936,4,3,100,102,112,15375,15378,15404,59,1,8719,4,3,97,108,115,15386,15392,15398,108,97,114,59,1,9006,105,110,101,59,1,8978,117,114,102,59,1,8979,4,2,59,116,15410,15412,1,8733,111,59,1,8733,105,109,59,1,8830,114,101,108,59,1,8880,4,2,99,105,15433,15438,114,59,3,55349,56517,59,1,968,110,99,115,112,59,1,8200,4,6,102,105,111,112,115,117,15462,15467,15472,15478,15485,15491,114,59,3,55349,56622,110,116,59,1,10764,112,102,59,3,55349,56674,114,105,109,101,59,1,8279,99,114,59,3,55349,56518,4,3,97,101,111,15499,15520,15534,116,4,2,101,105,15506,15515,114,110,105,111,110,115,59,1,8461,110,116,59,1,10774,115,116,4,2,59,101,15528,15530,1,63,113,59,1,8799,116,5,34,1,59,15540,1,34,4,21,65,66,72,97,98,99,100,101,102,104,105,108,109,110,111,112,114,115,116,117,120,15586,15609,15615,15620,15796,15855,15893,15931,15977,16001,16039,16183,16204,16222,16228,16285,16312,16318,16363,16408,16416,4,3,97,114,116,15594,15599,15603,114,114,59,1,8667,114,59,1,8658,97,105,108,59,1,10524,97,114,114,59,1,10511,97,114,59,1,10596,4,7,99,100,101,110,113,114,116,15636,15651,15656,15664,15687,15696,15770,4,2,101,117,15642,15646,59,3,8765,817,116,101,59,1,341,105,99,59,1,8730,109,112,116,121,118,59,1,10675,103,4,4,59,100,101,108,15675,15677,15680,15683,1,10217,59,1,10642,59,1,10661,101,59,1,10217,117,111,5,187,1,59,15694,1,187,114,4,11,59,97,98,99,102,104,108,112,115,116,119,15721,15723,15727,15739,15742,15746,15750,15754,15758,15763,15767,1,8594,112,59,1,10613,4,2,59,102,15733,15735,1,8677,115,59,1,10528,59,1,10547,115,59,1,10526,107,59,1,8618,112,59,1,8620,108,59,1,10565,105,109,59,1,10612,108,59,1,8611,59,1,8605,4,2,97,105,15776,15781,105,108,59,1,10522,111,4,2,59,110,15788,15790,1,8758,97,108,115,59,1,8474,4,3,97,98,114,15804,15809,15814,114,114,59,1,10509,114,107,59,1,10099,4,2,97,107,15820,15833,99,4,2,101,107,15827,15830,59,1,125,59,1,93,4,2,101,115,15839,15842,59,1,10636,108,4,2,100,117,15849,15852,59,1,10638,59,1,10640,4,4,97,101,117,121,15865,15871,15886,15890,114,111,110,59,1,345,4,2,100,105,15877,15882,105,108,59,1,343,108,59,1,8969,98,59,1,125,59,1,1088,4,4,99,108,113,115,15903,15907,15914,15927,97,59,1,10551,100,104,97,114,59,1,10601,117,111,4,2,59,114,15922,15924,1,8221,59,1,8221,104,59,1,8627,4,3,97,99,103,15939,15966,15970,108,4,4,59,105,112,115,15950,15952,15957,15963,1,8476,110,101,59,1,8475,97,114,116,59,1,8476,59,1,8477,116,59,1,9645,5,174,1,59,15975,1,174,4,3,105,108,114,15985,15991,15997,115,104,116,59,1,10621,111,111,114,59,1,8971,59,3,55349,56623,4,2,97,111,16007,16028,114,4,2,100,117,16014,16017,59,1,8641,4,2,59,108,16023,16025,1,8640,59,1,10604,4,2,59,118,16034,16036,1,961,59,1,1009,4,3,103,110,115,16047,16167,16171,104,116,4,6,97,104,108,114,115,116,16063,16081,16103,16130,16143,16155,114,114,111,119,4,2,59,116,16073,16075,1,8594,97,105,108,59,1,8611,97,114,112,111,111,110,4,2,100,117,16093,16099,111,119,110,59,1,8641,112,59,1,8640,101,102,116,4,2,97,104,16112,16120,114,114,111,119,115,59,1,8644,97,114,112,111,111,110,115,59,1,8652,105,103,104,116,97,114,114,111,119,115,59,1,8649,113,117,105,103,97,114,114,111,119,59,1,8605,104,114,101,101,116,105,109,101,115,59,1,8908,103,59,1,730,105,110,103,100,111,116,115,101,113,59,1,8787,4,3,97,104,109,16191,16196,16201,114,114,59,1,8644,97,114,59,1,8652,59,1,8207,111,117,115,116,4,2,59,97,16214,16216,1,9137,99,104,101,59,1,9137,109,105,100,59,1,10990,4,4,97,98,112,116,16238,16252,16257,16278,4,2,110,114,16244,16248,103,59,1,10221,114,59,1,8702,114,107,59,1,10215,4,3,97,102,108,16265,16269,16273,114,59,1,10630,59,3,55349,56675,117,115,59,1,10798,105,109,101,115,59,1,10805,4,2,97,112,16291,16304,114,4,2,59,103,16298,16300,1,41,116,59,1,10644,111,108,105,110,116,59,1,10770,97,114,114,59,1,8649,4,4,97,99,104,113,16328,16334,16339,16342,113,117,111,59,1,8250,114,59,3,55349,56519,59,1,8625,4,2,98,117,16348,16351,59,1,93,111,4,2,59,114,16358,16360,1,8217,59,1,8217,4,3,104,105,114,16371,16377,16383,114,101,101,59,1,8908,109,101,115,59,1,8906,105,4,4,59,101,102,108,16394,16396,16399,16402,1,9657,59,1,8885,59,1,9656,116,114,105,59,1,10702,108,117,104,97,114,59,1,10600,59,1,8478,4,19,97,98,99,100,101,102,104,105,108,109,111,112,113,114,115,116,117,119,122,16459,16466,16472,16572,16590,16672,16687,16746,16844,16850,16924,16963,16988,17115,17121,17154,17206,17614,17656,99,117,116,101,59,1,347,113,117,111,59,1,8218,4,10,59,69,97,99,101,105,110,112,115,121,16494,16496,16499,16513,16518,16531,16536,16556,16564,16569,1,8827,59,1,10932,4,2,112,114,16505,16508,59,1,10936,111,110,59,1,353,117,101,59,1,8829,4,2,59,100,16524,16526,1,10928,105,108,59,1,351,114,99,59,1,349,4,3,69,97,115,16544,16547,16551,59,1,10934,112,59,1,10938,105,109,59,1,8937,111,108,105,110,116,59,1,10771,105,109,59,1,8831,59,1,1089,111,116,4,3,59,98,101,16582,16584,16587,1,8901,59,1,8865,59,1,10854,4,7,65,97,99,109,115,116,120,16606,16611,16634,16642,16646,16652,16668,114,114,59,1,8664,114,4,2,104,114,16618,16622,107,59,1,10533,4,2,59,111,16628,16630,1,8600,119,59,1,8600,116,5,167,1,59,16640,1,167,105,59,1,59,119,97,114,59,1,10537,109,4,2,105,110,16659,16665,110,117,115,59,1,8726,59,1,8726,116,59,1,10038,114,4,2,59,111,16679,16682,3,55349,56624,119,110,59,1,8994,4,4,97,99,111,121,16697,16702,16716,16739,114,112,59,1,9839,4,2,104,121,16708,16713,99,121,59,1,1097,59,1,1096,114,116,4,2,109,112,16724,16729,105,100,59,1,8739,97,114,97,108,108,101,108,59,1,8741,5,173,1,59,16744,1,173,4,2,103,109,16752,16770,109,97,4,3,59,102,118,16762,16764,16767,1,963,59,1,962,59,1,962,4,8,59,100,101,103,108,110,112,114,16788,16790,16795,16806,16817,16828,16832,16838,1,8764,111,116,59,1,10858,4,2,59,113,16801,16803,1,8771,59,1,8771,4,2,59,69,16812,16814,1,10910,59,1,10912,4,2,59,69,16823,16825,1,10909,59,1,10911,101,59,1,8774,108,117,115,59,1,10788,97,114,114,59,1,10610,97,114,114,59,1,8592,4,4,97,101,105,116,16860,16883,16891,16904,4,2,108,115,16866,16878,108,115,101,116,109,105,110,117,115,59,1,8726,104,112,59,1,10803,112,97,114,115,108,59,1,10724,4,2,100,108,16897,16900,59,1,8739,101,59,1,8995,4,2,59,101,16910,16912,1,10922,4,2,59,115,16918,16920,1,10924,59,3,10924,65024,4,3,102,108,112,16932,16938,16958,116,99,121,59,1,1100,4,2,59,98,16944,16946,1,47,4,2,59,97,16952,16954,1,10692,114,59,1,9023,102,59,3,55349,56676,97,4,2,100,114,16970,16985,101,115,4,2,59,117,16978,16980,1,9824,105,116,59,1,9824,59,1,8741,4,3,99,115,117,16996,17028,17089,4,2,97,117,17002,17015,112,4,2,59,115,17009,17011,1,8851,59,3,8851,65024,112,4,2,59,115,17022,17024,1,8852,59,3,8852,65024,117,4,2,98,112,17035,17062,4,3,59,101,115,17043,17045,17048,1,8847,59,1,8849,101,116,4,2,59,101,17056,17058,1,8847,113,59,1,8849,4,3,59,101,115,17070,17072,17075,1,8848,59,1,8850,101,116,4,2,59,101,17083,17085,1,8848,113,59,1,8850,4,3,59,97,102,17097,17099,17112,1,9633,114,4,2,101,102,17106,17109,59,1,9633,59,1,9642,59,1,9642,97,114,114,59,1,8594,4,4,99,101,109,116,17131,17136,17142,17148,114,59,3,55349,56520,116,109,110,59,1,8726,105,108,101,59,1,8995,97,114,102,59,1,8902,4,2,97,114,17160,17172,114,4,2,59,102,17167,17169,1,9734,59,1,9733,4,2,97,110,17178,17202,105,103,104,116,4,2,101,112,17188,17197,112,115,105,108,111,110,59,1,1013,104,105,59,1,981,115,59,1,175,4,5,98,99,109,110,112,17218,17351,17420,17423,17427,4,9,59,69,100,101,109,110,112,114,115,17238,17240,17243,17248,17261,17267,17279,17285,17291,1,8834,59,1,10949,111,116,59,1,10941,4,2,59,100,17254,17256,1,8838,111,116,59,1,10947,117,108,116,59,1,10945,4,2,69,101,17273,17276,59,1,10955,59,1,8842,108,117,115,59,1,10943,97,114,114,59,1,10617,4,3,101,105,117,17299,17335,17339,116,4,3,59,101,110,17308,17310,17322,1,8834,113,4,2,59,113,17317,17319,1,8838,59,1,10949,101,113,4,2,59,113,17330,17332,1,8842,59,1,10955,109,59,1,10951,4,2,98,112,17345,17348,59,1,10965,59,1,10963,99,4,6,59,97,99,101,110,115,17366,17368,17376,17385,17389,17415,1,8827,112,112,114,111,120,59,1,10936,117,114,108,121,101,113,59,1,8829,113,59,1,10928,4,3,97,101,115,17397,17405,17410,112,112,114,111,120,59,1,10938,113,113,59,1,10934,105,109,59,1,8937,105,109,59,1,8831,59,1,8721,103,59,1,9834,4,13,49,50,51,59,69,100,101,104,108,109,110,112,115,17455,17462,17469,17476,17478,17481,17496,17509,17524,17530,17536,17548,17554,5,185,1,59,17460,1,185,5,178,1,59,17467,1,178,5,179,1,59,17474,1,179,1,8835,59,1,10950,4,2,111,115,17487,17491,116,59,1,10942,117,98,59,1,10968,4,2,59,100,17502,17504,1,8839,111,116,59,1,10948,115,4,2,111,117,17516,17520,108,59,1,10185,98,59,1,10967,97,114,114,59,1,10619,117,108,116,59,1,10946,4,2,69,101,17542,17545,59,1,10956,59,1,8843,108,117,115,59,1,10944,4,3,101,105,117,17562,17598,17602,116,4,3,59,101,110,17571,17573,17585,1,8835,113,4,2,59,113,17580,17582,1,8839,59,1,10950,101,113,4,2,59,113,17593,17595,1,8843,59,1,10956,109,59,1,10952,4,2,98,112,17608,17611,59,1,10964,59,1,10966,4,3,65,97,110,17622,17627,17650,114,114,59,1,8665,114,4,2,104,114,17634,17638,107,59,1,10534,4,2,59,111,17644,17646,1,8601,119,59,1,8601,119,97,114,59,1,10538,108,105,103,5,223,1,59,17664,1,223,4,13,97,98,99,100,101,102,104,105,111,112,114,115,119,17694,17709,17714,17737,17742,17749,17754,17860,17905,17957,17964,18090,18122,4,2,114,117,17700,17706,103,101,116,59,1,8982,59,1,964,114,107,59,1,9140,4,3,97,101,121,17722,17728,17734,114,111,110,59,1,357,100,105,108,59,1,355,59,1,1090,111,116,59,1,8411,108,114,101,99,59,1,8981,114,59,3,55349,56625,4,4,101,105,107,111,17764,17805,17836,17851,4,2,114,116,17770,17786,101,4,2,52,102,17777,17780,59,1,8756,111,114,101,59,1,8756,97,4,3,59,115,118,17795,17797,17802,1,952,121,109,59,1,977,59,1,977,4,2,99,110,17811,17831,107,4,2,97,115,17818,17826,112,112,114,111,120,59,1,8776,105,109,59,1,8764,115,112,59,1,8201,4,2,97,115,17842,17846,112,59,1,8776,105,109,59,1,8764,114,110,5,254,1,59,17858,1,254,4,3,108,109,110,17868,17873,17901,100,101,59,1,732,101,115,5,215,3,59,98,100,17884,17886,17898,1,215,4,2,59,97,17892,17894,1,8864,114,59,1,10801,59,1,10800,116,59,1,8749,4,3,101,112,115,17913,17917,17953,97,59,1,10536,4,4,59,98,99,102,17927,17929,17934,17939,1,8868,111,116,59,1,9014,105,114,59,1,10993,4,2,59,111,17945,17948,3,55349,56677,114,107,59,1,10970,97,59,1,10537,114,105,109,101,59,1,8244,4,3,97,105,112,17972,17977,18082,100,101,59,1,8482,4,7,97,100,101,109,112,115,116,17993,18051,18056,18059,18066,18072,18076,110,103,108,101,4,5,59,100,108,113,114,18009,18011,18017,18032,18035,1,9653,111,119,110,59,1,9663,101,102,116,4,2,59,101,18026,18028,1,9667,113,59,1,8884,59,1,8796,105,103,104,116,4,2,59,101,18045,18047,1,9657,113,59,1,8885,111,116,59,1,9708,59,1,8796,105,110,117,115,59,1,10810,108,117,115,59,1,10809,98,59,1,10701,105,109,101,59,1,10811,101,122,105,117,109,59,1,9186,4,3,99,104,116,18098,18111,18116,4,2,114,121,18104,18108,59,3,55349,56521,59,1,1094,99,121,59,1,1115,114,111,107,59,1,359,4,2,105,111,18128,18133,120,116,59,1,8812,104,101,97,100,4,2,108,114,18143,18154,101,102,116,97,114,114,111,119,59,1,8606,105,103,104,116,97,114,114,111,119,59,1,8608,4,18,65,72,97,98,99,100,102,103,104,108,109,111,112,114,115,116,117,119,18204,18209,18214,18234,18250,18268,18292,18308,18319,18343,18379,18397,18413,18504,18547,18553,18584,18603,114,114,59,1,8657,97,114,59,1,10595,4,2,99,114,18220,18230,117,116,101,5,250,1,59,18228,1,250,114,59,1,8593,114,4,2,99,101,18241,18245,121,59,1,1118,118,101,59,1,365,4,2,105,121,18256,18265,114,99,5,251,1,59,18263,1,251,59,1,1091,4,3,97,98,104,18276,18281,18287,114,114,59,1,8645,108,97,99,59,1,369,97,114,59,1,10606,4,2,105,114,18298,18304,115,104,116,59,1,10622,59,3,55349,56626,114,97,118,101,5,249,1,59,18317,1,249,4,2,97,98,18325,18338,114,4,2,108,114,18332,18335,59,1,8639,59,1,8638,108,107,59,1,9600,4,2,99,116,18349,18374,4,2,111,114,18355,18369,114,110,4,2,59,101,18363,18365,1,8988,114,59,1,8988,111,112,59,1,8975,114,105,59,1,9720,4,2,97,108,18385,18390,99,114,59,1,363,5,168,1,59,18395,1,168,4,2,103,112,18403,18408,111,110,59,1,371,102,59,3,55349,56678,4,6,97,100,104,108,115,117,18427,18434,18445,18470,18475,18494,114,114,111,119,59,1,8593,111,119,110,97,114,114,111,119,59,1,8597,97,114,112,111,111,110,4,2,108,114,18457,18463,101,102,116,59,1,8639,105,103,104,116,59,1,8638,117,115,59,1,8846,105,4,3,59,104,108,18484,18486,18489,1,965,59,1,978,111,110,59,1,965,112,97,114,114,111,119,115,59,1,8648,4,3,99,105,116,18512,18537,18542,4,2,111,114,18518,18532,114,110,4,2,59,101,18526,18528,1,8989,114,59,1,8989,111,112,59,1,8974,110,103,59,1,367,114,105,59,1,9721,99,114,59,3,55349,56522,4,3,100,105,114,18561,18566,18572,111,116,59,1,8944,108,100,101,59,1,361,105,4,2,59,102,18579,18581,1,9653,59,1,9652,4,2,97,109,18590,18595,114,114,59,1,8648,108,5,252,1,59,18601,1,252,97,110,103,108,101,59,1,10663,4,15,65,66,68,97,99,100,101,102,108,110,111,112,114,115,122,18643,18648,18661,18667,18847,18851,18857,18904,18909,18915,18931,18937,18943,18949,18996,114,114,59,1,8661,97,114,4,2,59,118,18656,18658,1,10984,59,1,10985,97,115,104,59,1,8872,4,2,110,114,18673,18679,103,114,116,59,1,10652,4,7,101,107,110,112,114,115,116,18695,18704,18711,18720,18742,18754,18810,112,115,105,108,111,110,59,1,1013,97,112,112,97,59,1,1008,111,116,104,105,110,103,59,1,8709,4,3,104,105,114,18728,18732,18735,105,59,1,981,59,1,982,111,112,116,111,59,1,8733,4,2,59,104,18748,18750,1,8597,111,59,1,1009,4,2,105,117,18760,18766,103,109,97,59,1,962,4,2,98,112,18772,18791,115,101,116,110,101,113,4,2,59,113,18784,18787,3,8842,65024,59,3,10955,65024,115,101,116,110,101,113,4,2,59,113,18803,18806,3,8843,65024,59,3,10956,65024,4,2,104,114,18816,18822,101,116,97,59,1,977,105,97,110,103,108,101,4,2,108,114,18834,18840,101,102,116,59,1,8882,105,103,104,116,59,1,8883,121,59,1,1074,97,115,104,59,1,8866,4,3,101,108,114,18865,18884,18890,4,3,59,98,101,18873,18875,18880,1,8744,97,114,59,1,8891,113,59,1,8794,108,105,112,59,1,8942,4,2,98,116,18896,18901,97,114,59,1,124,59,1,124,114,59,3,55349,56627,116,114,105,59,1,8882,115,117,4,2,98,112,18923,18927,59,3,8834,8402,59,3,8835,8402,112,102,59,3,55349,56679,114,111,112,59,1,8733,116,114,105,59,1,8883,4,2,99,117,18955,18960,114,59,3,55349,56523,4,2,98,112,18966,18981,110,4,2,69,101,18973,18977,59,3,10955,65024,59,3,8842,65024,110,4,2,69,101,18988,18992,59,3,10956,65024,59,3,8843,65024,105,103,122,97,103,59,1,10650,4,7,99,101,102,111,112,114,115,19020,19026,19061,19066,19072,19075,19089,105,114,99,59,1,373,4,2,100,105,19032,19055,4,2,98,103,19038,19043,97,114,59,1,10847,101,4,2,59,113,19050,19052,1,8743,59,1,8793,101,114,112,59,1,8472,114,59,3,55349,56628,112,102,59,3,55349,56680,59,1,8472,4,2,59,101,19081,19083,1,8768,97,116,104,59,1,8768,99,114,59,3,55349,56524,4,14,99,100,102,104,105,108,109,110,111,114,115,117,118,119,19125,19146,19152,19157,19173,19176,19192,19197,19202,19236,19252,19269,19286,19291,4,3,97,105,117,19133,19137,19142,112,59,1,8898,114,99,59,1,9711,112,59,1,8899,116,114,105,59,1,9661,114,59,3,55349,56629,4,2,65,97,19163,19168,114,114,59,1,10234,114,114,59,1,10231,59,1,958,4,2,65,97,19182,19187,114,114,59,1,10232,114,114,59,1,10229,97,112,59,1,10236,105,115,59,1,8955,4,3,100,112,116,19210,19215,19230,111,116,59,1,10752,4,2,102,108,19221,19225,59,3,55349,56681,117,115,59,1,10753,105,109,101,59,1,10754,4,2,65,97,19242,19247,114,114,59,1,10233,114,114,59,1,10230,4,2,99,113,19258,19263,114,59,3,55349,56525,99,117,112,59,1,10758,4,2,112,116,19275,19281,108,117,115,59,1,10756,114,105,59,1,9651,101,101,59,1,8897,101,100,103,101,59,1,8896,4,8,97,99,101,102,105,111,115,117,19316,19335,19349,19357,19362,19367,19373,19379,99,4,2,117,121,19323,19332,116,101,5,253,1,59,19330,1,253,59,1,1103,4,2,105,121,19341,19346,114,99,59,1,375,59,1,1099,110,5,165,1,59,19355,1,165,114,59,3,55349,56630,99,121,59,1,1111,112,102,59,3,55349,56682,99,114,59,3,55349,56526,4,2,99,109,19385,19389,121,59,1,1102,108,5,255,1,59,19395,1,255,4,10,97,99,100,101,102,104,105,111,115,119,19419,19426,19441,19446,19462,19467,19472,19480,19486,19492,99,117,116,101,59,1,378,4,2,97,121,19432,19438,114,111,110,59,1,382,59,1,1079,111,116,59,1,380,4,2,101,116,19452,19458,116,114,102,59,1,8488,97,59,1,950,114,59,3,55349,56631,99,121,59,1,1078,103,114,97,114,114,59,1,8669,112,102,59,3,55349,56683,99,114,59,3,55349,56527,4,2,106,110,19498,19501,59,1,8205,106,59,1,8204]); - -/***/ }), -/* 119 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -var UNICODE = __webpack_require__(18); - -//Aliases -var $ = UNICODE.CODE_POINTS; - -//Utils - -//OPTIMIZATION: these utility functions should not be moved out of this module. V8 Crankshaft will not inline -//this functions if they will be situated in another module due to context switch. -//Always perform inlining check before modifying this functions ('node --trace-inlining'). -function isSurrogatePair(cp1, cp2) { - return cp1 >= 0xD800 && cp1 <= 0xDBFF && cp2 >= 0xDC00 && cp2 <= 0xDFFF; -} - -function getSurrogatePairCodePoint(cp1, cp2) { - return (cp1 - 0xD800) * 0x400 + 0x2400 + cp2; -} - - -//Const -var DEFAULT_BUFFER_WATERLINE = 1 << 16; - - -//Preprocessor -//NOTE: HTML input preprocessing -//(see: http://www.whatwg.org/specs/web-apps/current-work/multipage/parsing.html#preprocessing-the-input-stream) -var Preprocessor = module.exports = function () { - this.html = null; - - this.pos = -1; - this.lastGapPos = -1; - this.lastCharPos = -1; - this.droppedBufferSize = 0; - - this.gapStack = []; - - this.skipNextNewLine = false; - - this.lastChunkWritten = false; - this.endOfChunkHit = false; - this.bufferWaterline = DEFAULT_BUFFER_WATERLINE; -}; - -Object.defineProperty(Preprocessor.prototype, 'sourcePos', { - get: function () { - return this.droppedBufferSize + this.pos; - } -}); - -Preprocessor.prototype.dropParsedChunk = function () { - if (this.pos > this.bufferWaterline) { - this.lastCharPos -= this.pos; - this.droppedBufferSize += this.pos; - this.html = this.html.substring(this.pos); - this.pos = 0; - this.lastGapPos = -1; - this.gapStack = []; - } -}; - -Preprocessor.prototype._addGap = function () { - this.gapStack.push(this.lastGapPos); - this.lastGapPos = this.pos; -}; - -Preprocessor.prototype._processHighRangeCodePoint = function (cp) { - //NOTE: try to peek a surrogate pair - if (this.pos !== this.lastCharPos) { - var nextCp = this.html.charCodeAt(this.pos + 1); - - if (isSurrogatePair(cp, nextCp)) { - //NOTE: we have a surrogate pair. Peek pair character and recalculate code point. - this.pos++; - cp = getSurrogatePairCodePoint(cp, nextCp); - - //NOTE: add gap that should be avoided during retreat - this._addGap(); - } - } - - // NOTE: we've hit the end of chunk, stop processing at this point - else if (!this.lastChunkWritten) { - this.endOfChunkHit = true; - return $.EOF; - } - - return cp; -}; - -Preprocessor.prototype.write = function (chunk, isLastChunk) { - if (this.html) - this.html += chunk; - - else - this.html = chunk; - - this.lastCharPos = this.html.length - 1; - this.endOfChunkHit = false; - this.lastChunkWritten = isLastChunk; -}; - -Preprocessor.prototype.insertHtmlAtCurrentPos = function (chunk) { - this.html = this.html.substring(0, this.pos + 1) + - chunk + - this.html.substring(this.pos + 1, this.html.length); - - this.lastCharPos = this.html.length - 1; - this.endOfChunkHit = false; -}; - - -Preprocessor.prototype.advance = function () { - this.pos++; - - if (this.pos > this.lastCharPos) { - if (!this.lastChunkWritten) - this.endOfChunkHit = true; - - return $.EOF; - } - - var cp = this.html.charCodeAt(this.pos); - - //NOTE: any U+000A LINE FEED (LF) characters that immediately follow a U+000D CARRIAGE RETURN (CR) character - //must be ignored. - if (this.skipNextNewLine && cp === $.LINE_FEED) { - this.skipNextNewLine = false; - this._addGap(); - return this.advance(); - } - - //NOTE: all U+000D CARRIAGE RETURN (CR) characters must be converted to U+000A LINE FEED (LF) characters - if (cp === $.CARRIAGE_RETURN) { - this.skipNextNewLine = true; - return $.LINE_FEED; - } - - this.skipNextNewLine = false; - - //OPTIMIZATION: first perform check if the code point in the allowed range that covers most common - //HTML input (e.g. ASCII codes) to avoid performance-cost operations for high-range code points. - return cp >= 0xD800 ? this._processHighRangeCodePoint(cp) : cp; -}; - -Preprocessor.prototype.retreat = function () { - if (this.pos === this.lastGapPos) { - this.lastGapPos = this.gapStack.pop(); - this.pos--; - } - - this.pos--; -}; - - - -/***/ }), -/* 120 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -var doctype = __webpack_require__(33), - DOCUMENT_MODE = __webpack_require__(11).DOCUMENT_MODE; - - -//Conversion tables for DOM Level1 structure emulation -var nodeTypes = { - element: 1, - text: 3, - cdata: 4, - comment: 8 -}; - -var nodePropertyShorthands = { - tagName: 'name', - childNodes: 'children', - parentNode: 'parent', - previousSibling: 'prev', - nextSibling: 'next', - nodeValue: 'data' -}; - -//Node -var Node = function (props) { - for (var key in props) { - if (props.hasOwnProperty(key)) - this[key] = props[key]; - } -}; - -Node.prototype = { - get firstChild() { - var children = this.children; - - return children && children[0] || null; - }, - - get lastChild() { - var children = this.children; - - return children && children[children.length - 1] || null; - }, - - get nodeType() { - return nodeTypes[this.type] || nodeTypes.element; - } -}; - -Object.keys(nodePropertyShorthands).forEach(function (key) { - var shorthand = nodePropertyShorthands[key]; - - Object.defineProperty(Node.prototype, key, { - get: function () { - return this[shorthand] || null; - }, - set: function (val) { - this[shorthand] = val; - return val; - } - }); -}); - - -//Node construction -exports.createDocument = function () { - return new Node({ - type: 'root', - name: 'root', - parent: null, - prev: null, - next: null, - children: [], - 'x-mode': DOCUMENT_MODE.NO_QUIRKS - }); -}; - -exports.createDocumentFragment = function () { - return new Node({ - type: 'root', - name: 'root', - parent: null, - prev: null, - next: null, - children: [] - }); -}; - -exports.createElement = function (tagName, namespaceURI, attrs) { - var attribs = Object.create(null), - attribsNamespace = Object.create(null), - attribsPrefix = Object.create(null); - - for (var i = 0; i < attrs.length; i++) { - var attrName = attrs[i].name; - - attribs[attrName] = attrs[i].value; - attribsNamespace[attrName] = attrs[i].namespace; - attribsPrefix[attrName] = attrs[i].prefix; - } - - return new Node({ - type: tagName === 'script' || tagName === 'style' ? tagName : 'tag', - name: tagName, - namespace: namespaceURI, - attribs: attribs, - 'x-attribsNamespace': attribsNamespace, - 'x-attribsPrefix': attribsPrefix, - children: [], - parent: null, - prev: null, - next: null - }); -}; - -exports.createCommentNode = function (data) { - return new Node({ - type: 'comment', - data: data, - parent: null, - prev: null, - next: null - }); -}; - -var createTextNode = function (value) { - return new Node({ - type: 'text', - data: value, - parent: null, - prev: null, - next: null - }); -}; - - -//Tree mutation -var appendChild = exports.appendChild = function (parentNode, newNode) { - var prev = parentNode.children[parentNode.children.length - 1]; - - if (prev) { - prev.next = newNode; - newNode.prev = prev; - } - - parentNode.children.push(newNode); - newNode.parent = parentNode; -}; - -var insertBefore = exports.insertBefore = function (parentNode, newNode, referenceNode) { - var insertionIdx = parentNode.children.indexOf(referenceNode), - prev = referenceNode.prev; - - if (prev) { - prev.next = newNode; - newNode.prev = prev; - } - - referenceNode.prev = newNode; - newNode.next = referenceNode; - - parentNode.children.splice(insertionIdx, 0, newNode); - newNode.parent = parentNode; -}; - -exports.setTemplateContent = function (templateElement, contentElement) { - appendChild(templateElement, contentElement); -}; - -exports.getTemplateContent = function (templateElement) { - return templateElement.children[0]; -}; - -exports.setDocumentType = function (document, name, publicId, systemId) { - var data = doctype.serializeContent(name, publicId, systemId), - doctypeNode = null; - - for (var i = 0; i < document.children.length; i++) { - if (document.children[i].type === 'directive' && document.children[i].name === '!doctype') { - doctypeNode = document.children[i]; - break; - } - } - - if (doctypeNode) { - doctypeNode.data = data; - doctypeNode['x-name'] = name; - doctypeNode['x-publicId'] = publicId; - doctypeNode['x-systemId'] = systemId; - } - - else { - appendChild(document, new Node({ - type: 'directive', - name: '!doctype', - data: data, - 'x-name': name, - 'x-publicId': publicId, - 'x-systemId': systemId - })); - } - -}; - -exports.setDocumentMode = function (document, mode) { - document['x-mode'] = mode; -}; - -exports.getDocumentMode = function (document) { - return document['x-mode']; -}; - -exports.detachNode = function (node) { - if (node.parent) { - var idx = node.parent.children.indexOf(node), - prev = node.prev, - next = node.next; - - node.prev = null; - node.next = null; - - if (prev) - prev.next = next; - - if (next) - next.prev = prev; - - node.parent.children.splice(idx, 1); - node.parent = null; - } -}; - -exports.insertText = function (parentNode, text) { - var lastChild = parentNode.children[parentNode.children.length - 1]; - - if (lastChild && lastChild.type === 'text') - lastChild.data += text; - else - appendChild(parentNode, createTextNode(text)); -}; - -exports.insertTextBefore = function (parentNode, text, referenceNode) { - var prevNode = parentNode.children[parentNode.children.indexOf(referenceNode) - 1]; - - if (prevNode && prevNode.type === 'text') - prevNode.data += text; - else - insertBefore(parentNode, createTextNode(text), referenceNode); -}; - -exports.adoptAttributes = function (recipient, attrs) { - for (var i = 0; i < attrs.length; i++) { - var attrName = attrs[i].name; - - if (typeof recipient.attribs[attrName] === 'undefined') { - recipient.attribs[attrName] = attrs[i].value; - recipient['x-attribsNamespace'][attrName] = attrs[i].namespace; - recipient['x-attribsPrefix'][attrName] = attrs[i].prefix; - } - } -}; - - -//Tree traversing -exports.getFirstChild = function (node) { - return node.children[0]; -}; - -exports.getChildNodes = function (node) { - return node.children; -}; - -exports.getParentNode = function (node) { - return node.parent; -}; - -exports.getAttrList = function (element) { - var attrList = []; - - for (var name in element.attribs) { - attrList.push({ - name: name, - value: element.attribs[name], - namespace: element['x-attribsNamespace'][name], - prefix: element['x-attribsPrefix'][name] - }); - } - - return attrList; -}; - - -//Node data -exports.getTagName = function (element) { - return element.name; -}; - -exports.getNamespaceURI = function (element) { - return element.namespace; -}; - -exports.getTextNodeContent = function (textNode) { - return textNode.data; -}; - -exports.getCommentNodeContent = function (commentNode) { - return commentNode.data; -}; - -exports.getDocumentTypeNodeName = function (doctypeNode) { - return doctypeNode['x-name']; -}; - -exports.getDocumentTypeNodePublicId = function (doctypeNode) { - return doctypeNode['x-publicId']; -}; - -exports.getDocumentTypeNodeSystemId = function (doctypeNode) { - return doctypeNode['x-systemId']; -}; - - -//Node types -exports.isTextNode = function (node) { - return node.type === 'text'; -}; - -exports.isCommentNode = function (node) { - return node.type === 'comment'; -}; - -exports.isDocumentTypeNode = function (node) { - return node.type === 'directive' && node.name === '!doctype'; -}; - -exports.isElementNode = function (node) { - return !!node.attribs; -}; - - -/***/ }), -/* 121 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -/* tslint:disable:no-unused-variable */ -// Subject imported before Observable to bypass circular dependency issue since -// Subject extends Observable and Observable references Subject in it's -// definition -var Subject_1 = __webpack_require__(6); -exports.Subject = Subject_1.Subject; -exports.AnonymousSubject = Subject_1.AnonymousSubject; -/* tslint:enable:no-unused-variable */ -var Observable_1 = __webpack_require__(0); -exports.Observable = Observable_1.Observable; -// statics -/* tslint:disable:no-use-before-declare */ -__webpack_require__(123); -__webpack_require__(124); -__webpack_require__(125); -__webpack_require__(126); -__webpack_require__(127); -__webpack_require__(130); -__webpack_require__(131); -__webpack_require__(132); -__webpack_require__(133); -__webpack_require__(134); -__webpack_require__(135); -__webpack_require__(136); -__webpack_require__(137); -__webpack_require__(54); -__webpack_require__(138); -__webpack_require__(143); -__webpack_require__(139); -__webpack_require__(140); -__webpack_require__(141); -__webpack_require__(142); -__webpack_require__(144); -__webpack_require__(145); -__webpack_require__(55); -__webpack_require__(56); -__webpack_require__(146); -//dom -__webpack_require__(128); -__webpack_require__(129); -//operators -__webpack_require__(149); -__webpack_require__(150); -__webpack_require__(151); -__webpack_require__(152); -__webpack_require__(153); -__webpack_require__(57); -__webpack_require__(154); -__webpack_require__(155); -__webpack_require__(156); -__webpack_require__(157); -__webpack_require__(158); -__webpack_require__(159); -__webpack_require__(160); -__webpack_require__(166); -__webpack_require__(161); -__webpack_require__(162); -__webpack_require__(163); -__webpack_require__(164); -__webpack_require__(165); -__webpack_require__(167); -__webpack_require__(168); -__webpack_require__(169); -__webpack_require__(170); -__webpack_require__(173); -__webpack_require__(174); -__webpack_require__(175); -__webpack_require__(171); -__webpack_require__(176); -__webpack_require__(177); -__webpack_require__(178); -__webpack_require__(179); -__webpack_require__(45); -__webpack_require__(180); -__webpack_require__(181); -__webpack_require__(182); -__webpack_require__(147); -__webpack_require__(148); -__webpack_require__(183); -__webpack_require__(184); -__webpack_require__(172); -__webpack_require__(58); -__webpack_require__(185); -__webpack_require__(186); -__webpack_require__(187); -__webpack_require__(188); -__webpack_require__(189); -__webpack_require__(190); -__webpack_require__(191); -__webpack_require__(192); -__webpack_require__(193); -__webpack_require__(194); -__webpack_require__(195); -__webpack_require__(196); -__webpack_require__(197); -__webpack_require__(198); -__webpack_require__(199); -__webpack_require__(200); -__webpack_require__(201); -__webpack_require__(203); -__webpack_require__(202); -__webpack_require__(204); -__webpack_require__(205); -__webpack_require__(206); -__webpack_require__(207); -__webpack_require__(208); -__webpack_require__(209); -__webpack_require__(210); -__webpack_require__(211); -__webpack_require__(212); -__webpack_require__(213); -__webpack_require__(214); -__webpack_require__(215); -__webpack_require__(216); -__webpack_require__(217); -__webpack_require__(218); -__webpack_require__(219); -__webpack_require__(220); -__webpack_require__(221); -__webpack_require__(222); -__webpack_require__(223); -__webpack_require__(224); -__webpack_require__(225); -__webpack_require__(226); -__webpack_require__(227); -__webpack_require__(228); -__webpack_require__(229); -__webpack_require__(230); -__webpack_require__(231); -__webpack_require__(232); -__webpack_require__(233); -__webpack_require__(234); -__webpack_require__(235); -__webpack_require__(236); -__webpack_require__(237); -__webpack_require__(238); -__webpack_require__(239); -__webpack_require__(240); -__webpack_require__(241); -__webpack_require__(242); -__webpack_require__(243); -__webpack_require__(244); -__webpack_require__(245); -/* tslint:disable:no-unused-variable */ -var Subscription_1 = __webpack_require__(9); -exports.Subscription = Subscription_1.Subscription; -var Subscriber_1 = __webpack_require__(2); -exports.Subscriber = Subscriber_1.Subscriber; -var AsyncSubject_1 = __webpack_require__(25); -exports.AsyncSubject = AsyncSubject_1.AsyncSubject; -var ReplaySubject_1 = __webpack_require__(26); -exports.ReplaySubject = ReplaySubject_1.ReplaySubject; -var BehaviorSubject_1 = __webpack_require__(41); -exports.BehaviorSubject = BehaviorSubject_1.BehaviorSubject; -var ConnectableObservable_1 = __webpack_require__(386); -exports.ConnectableObservable = ConnectableObservable_1.ConnectableObservable; -var Notification_1 = __webpack_require__(30); -exports.Notification = Notification_1.Notification; -var EmptyError_1 = __webpack_require__(79); -exports.EmptyError = EmptyError_1.EmptyError; -var ArgumentOutOfRangeError_1 = __webpack_require__(22); -exports.ArgumentOutOfRangeError = ArgumentOutOfRangeError_1.ArgumentOutOfRangeError; -var ObjectUnsubscribedError_1 = __webpack_require__(80); -exports.ObjectUnsubscribedError = ObjectUnsubscribedError_1.ObjectUnsubscribedError; -var TimeoutError_1 = __webpack_require__(74); -exports.TimeoutError = TimeoutError_1.TimeoutError; -var UnsubscriptionError_1 = __webpack_require__(399); -exports.UnsubscriptionError = UnsubscriptionError_1.UnsubscriptionError; -var timeInterval_1 = __webpack_require__(66); -exports.TimeInterval = timeInterval_1.TimeInterval; -var timestamp_1 = __webpack_require__(67); -exports.Timestamp = timestamp_1.Timestamp; -var TestScheduler_1 = __webpack_require__(366); -exports.TestScheduler = TestScheduler_1.TestScheduler; -var VirtualTimeScheduler_1 = __webpack_require__(69); -exports.VirtualTimeScheduler = VirtualTimeScheduler_1.VirtualTimeScheduler; -var AjaxObservable_1 = __webpack_require__(59); -exports.AjaxResponse = AjaxObservable_1.AjaxResponse; -exports.AjaxError = AjaxObservable_1.AjaxError; -exports.AjaxTimeoutError = AjaxObservable_1.AjaxTimeoutError; -var asap_1 = __webpack_require__(70); -var async_1 = __webpack_require__(8); -var queue_1 = __webpack_require__(71); -var animationFrame_1 = __webpack_require__(363); -var rxSubscriber_1 = __webpack_require__(379); -var iterator_1 = __webpack_require__(78); -var observable_1 = __webpack_require__(378); -/* tslint:enable:no-unused-variable */ -/** - * @typedef {Object} Rx.Scheduler - * @property {Scheduler} queue Schedules on a queue in the current event frame - * (trampoline scheduler). Use this for iteration operations. - * @property {Scheduler} asap Schedules on the micro task queue, which uses the - * fastest transport mechanism available, either Node.js' `process.nextTick()` - * or Web Worker MessageChannel or setTimeout or others. Use this for - * asynchronous conversions. - * @property {Scheduler} async Schedules work with `setInterval`. Use this for - * time-based operations. - * @property {Scheduler} animationFrame Schedules work with `requestAnimationFrame`. - * Use this for synchronizing with the platform's painting - */ -var Scheduler = { - asap: asap_1.asap, - queue: queue_1.queue, - animationFrame: animationFrame_1.animationFrame, - async: async_1.async -}; -exports.Scheduler = Scheduler; -/** - * @typedef {Object} Rx.Symbol - * @property {Symbol|string} rxSubscriber A symbol to use as a property name to - * retrieve an "Rx safe" Observer from an object. "Rx safety" can be defined as - * an object that has all of the traits of an Rx Subscriber, including the - * ability to add and remove subscriptions to the subscription chain and - * guarantees involving event triggering (can't "next" after unsubscription, - * etc). - * @property {Symbol|string} observable A symbol to use as a property name to - * retrieve an Observable as defined by the [ECMAScript "Observable" spec](https://github.com/zenparsing/es-observable). - * @property {Symbol|string} iterator The ES6 symbol to use as a property name - * to retrieve an iterator from an object. - */ -var Symbol = { - rxSubscriber: rxSubscriber_1.rxSubscriber, - observable: observable_1.observable, - iterator: iterator_1.iterator -}; -exports.Symbol = Symbol; -//# sourceMappingURL=Rx.js.map - -/***/ }), -/* 122 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -/** - * An execution context and a data structure to order tasks and schedule their - * execution. Provides a notion of (potentially virtual) time, through the - * `now()` getter method. - * - * Each unit of work in a Scheduler is called an {@link Action}. - * - * ```ts - * class Scheduler { - * now(): number; - * schedule(work, delay?, state?): Subscription; - * } - * ``` - * - * @class Scheduler - */ -var Scheduler = (function () { - function Scheduler(SchedulerAction, now) { - if (now === void 0) { now = Scheduler.now; } - this.SchedulerAction = SchedulerAction; - this.now = now; - } - /** - * Schedules a function, `work`, for execution. May happen at some point in - * the future, according to the `delay` parameter, if specified. May be passed - * some context object, `state`, which will be passed to the `work` function. - * - * The given arguments will be processed an stored as an Action object in a - * queue of actions. - * - * @param {function(state: ?T): ?Subscription} work A function representing a - * task, or some unit of work to be executed by the Scheduler. - * @param {number} [delay] Time to wait before executing the work, where the - * time unit is implicit and defined by the Scheduler itself. - * @param {T} [state] Some contextual data that the `work` function uses when - * called by the Scheduler. - * @return {Subscription} A subscription in order to be able to unsubscribe - * the scheduled work. - */ - Scheduler.prototype.schedule = function (work, delay, state) { - if (delay === void 0) { delay = 0; } - return new this.SchedulerAction(this, work).schedule(state, delay); - }; - Scheduler.now = Date.now ? Date.now : function () { return +new Date(); }; - return Scheduler; -}()); -exports.Scheduler = Scheduler; -//# sourceMappingURL=Scheduler.js.map - -/***/ }), -/* 123 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var bindCallback_1 = __webpack_require__(261); -Observable_1.Observable.bindCallback = bindCallback_1.bindCallback; -//# sourceMappingURL=bindCallback.js.map - -/***/ }), -/* 124 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var bindNodeCallback_1 = __webpack_require__(262); -Observable_1.Observable.bindNodeCallback = bindNodeCallback_1.bindNodeCallback; -//# sourceMappingURL=bindNodeCallback.js.map - -/***/ }), -/* 125 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var combineLatest_1 = __webpack_require__(263); -Observable_1.Observable.combineLatest = combineLatest_1.combineLatest; -//# sourceMappingURL=combineLatest.js.map - -/***/ }), -/* 126 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var concat_1 = __webpack_require__(264); -Observable_1.Observable.concat = concat_1.concat; -//# sourceMappingURL=concat.js.map - -/***/ }), -/* 127 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var defer_1 = __webpack_require__(265); -Observable_1.Observable.defer = defer_1.defer; -//# sourceMappingURL=defer.js.map - -/***/ }), -/* 128 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var ajax_1 = __webpack_require__(267); -Observable_1.Observable.ajax = ajax_1.ajax; -//# sourceMappingURL=ajax.js.map - -/***/ }), -/* 129 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var webSocket_1 = __webpack_require__(268); -Observable_1.Observable.webSocket = webSocket_1.webSocket; -//# sourceMappingURL=webSocket.js.map - -/***/ }), -/* 130 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var empty_1 = __webpack_require__(269); -Observable_1.Observable.empty = empty_1.empty; -//# sourceMappingURL=empty.js.map - -/***/ }), -/* 131 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var forkJoin_1 = __webpack_require__(388); -Observable_1.Observable.forkJoin = forkJoin_1.forkJoin; -//# sourceMappingURL=forkJoin.js.map - -/***/ }), -/* 132 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var from_1 = __webpack_require__(389); -Observable_1.Observable.from = from_1.from; -//# sourceMappingURL=from.js.map - -/***/ }), -/* 133 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var fromEvent_1 = __webpack_require__(270); -Observable_1.Observable.fromEvent = fromEvent_1.fromEvent; -//# sourceMappingURL=fromEvent.js.map - -/***/ }), -/* 134 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var fromEventPattern_1 = __webpack_require__(271); -Observable_1.Observable.fromEventPattern = fromEventPattern_1.fromEventPattern; -//# sourceMappingURL=fromEventPattern.js.map - -/***/ }), -/* 135 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var fromPromise_1 = __webpack_require__(382); -Observable_1.Observable.fromPromise = fromPromise_1.fromPromise; -//# sourceMappingURL=fromPromise.js.map - -/***/ }), -/* 136 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var GenerateObservable_1 = __webpack_require__(252); -Observable_1.Observable.generate = GenerateObservable_1.GenerateObservable.create; -//# sourceMappingURL=generate.js.map - -/***/ }), -/* 137 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var if_1 = __webpack_require__(272); -Observable_1.Observable.if = if_1._if; -//# sourceMappingURL=if.js.map - -/***/ }), -/* 138 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var merge_1 = __webpack_require__(390); -Observable_1.Observable.merge = merge_1.merge; -//# sourceMappingURL=merge.js.map - -/***/ }), -/* 139 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var never_1 = __webpack_require__(274); -Observable_1.Observable.never = never_1.never; -//# sourceMappingURL=never.js.map - -/***/ }), -/* 140 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var of_1 = __webpack_require__(391); -Observable_1.Observable.of = of_1.of; -//# sourceMappingURL=of.js.map - -/***/ }), -/* 141 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var onErrorResumeNext_1 = __webpack_require__(63); -Observable_1.Observable.onErrorResumeNext = onErrorResumeNext_1.onErrorResumeNextStatic; -//# sourceMappingURL=onErrorResumeNext.js.map - -/***/ }), -/* 142 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var pairs_1 = __webpack_require__(275); -Observable_1.Observable.pairs = pairs_1.pairs; -//# sourceMappingURL=pairs.js.map - -/***/ }), -/* 143 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var race_1 = __webpack_require__(64); -Observable_1.Observable.race = race_1.raceStatic; -//# sourceMappingURL=race.js.map - -/***/ }), -/* 144 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var range_1 = __webpack_require__(276); -Observable_1.Observable.range = range_1.range; -//# sourceMappingURL=range.js.map - -/***/ }), -/* 145 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var using_1 = __webpack_require__(279); -Observable_1.Observable.using = using_1.using; -//# sourceMappingURL=using.js.map - -/***/ }), -/* 146 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var zip_1 = __webpack_require__(280); -Observable_1.Observable.zip = zip_1.zip; -//# sourceMappingURL=zip.js.map - -/***/ }), -/* 147 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var audit_1 = __webpack_require__(281); -Observable_1.Observable.prototype.audit = audit_1.audit; -//# sourceMappingURL=audit.js.map - -/***/ }), -/* 148 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var auditTime_1 = __webpack_require__(282); -Observable_1.Observable.prototype.auditTime = auditTime_1.auditTime; -//# sourceMappingURL=auditTime.js.map - -/***/ }), -/* 149 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var buffer_1 = __webpack_require__(283); -Observable_1.Observable.prototype.buffer = buffer_1.buffer; -//# sourceMappingURL=buffer.js.map - -/***/ }), -/* 150 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var bufferCount_1 = __webpack_require__(284); -Observable_1.Observable.prototype.bufferCount = bufferCount_1.bufferCount; -//# sourceMappingURL=bufferCount.js.map - -/***/ }), -/* 151 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var bufferTime_1 = __webpack_require__(285); -Observable_1.Observable.prototype.bufferTime = bufferTime_1.bufferTime; -//# sourceMappingURL=bufferTime.js.map - -/***/ }), -/* 152 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var bufferToggle_1 = __webpack_require__(286); -Observable_1.Observable.prototype.bufferToggle = bufferToggle_1.bufferToggle; -//# sourceMappingURL=bufferToggle.js.map - -/***/ }), -/* 153 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var bufferWhen_1 = __webpack_require__(287); -Observable_1.Observable.prototype.bufferWhen = bufferWhen_1.bufferWhen; -//# sourceMappingURL=bufferWhen.js.map - -/***/ }), -/* 154 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var combineAll_1 = __webpack_require__(288); -Observable_1.Observable.prototype.combineAll = combineAll_1.combineAll; -//# sourceMappingURL=combineAll.js.map - -/***/ }), -/* 155 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var combineLatest_1 = __webpack_require__(37); -Observable_1.Observable.prototype.combineLatest = combineLatest_1.combineLatest; -//# sourceMappingURL=combineLatest.js.map - -/***/ }), -/* 156 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var concat_1 = __webpack_require__(38); -Observable_1.Observable.prototype.concat = concat_1.concat; -//# sourceMappingURL=concat.js.map - -/***/ }), -/* 157 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var concatAll_1 = __webpack_require__(393); -Observable_1.Observable.prototype.concatAll = concatAll_1.concatAll; -//# sourceMappingURL=concatAll.js.map - -/***/ }), -/* 158 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var concatMap_1 = __webpack_require__(394); -Observable_1.Observable.prototype.concatMap = concatMap_1.concatMap; -//# sourceMappingURL=concatMap.js.map - -/***/ }), -/* 159 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var concatMapTo_1 = __webpack_require__(289); -Observable_1.Observable.prototype.concatMapTo = concatMapTo_1.concatMapTo; -//# sourceMappingURL=concatMapTo.js.map - -/***/ }), -/* 160 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var count_1 = __webpack_require__(290); -Observable_1.Observable.prototype.count = count_1.count; -//# sourceMappingURL=count.js.map - -/***/ }), -/* 161 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var debounce_1 = __webpack_require__(291); -Observable_1.Observable.prototype.debounce = debounce_1.debounce; -//# sourceMappingURL=debounce.js.map - -/***/ }), -/* 162 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var debounceTime_1 = __webpack_require__(292); -Observable_1.Observable.prototype.debounceTime = debounceTime_1.debounceTime; -//# sourceMappingURL=debounceTime.js.map - -/***/ }), -/* 163 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var defaultIfEmpty_1 = __webpack_require__(293); -Observable_1.Observable.prototype.defaultIfEmpty = defaultIfEmpty_1.defaultIfEmpty; -//# sourceMappingURL=defaultIfEmpty.js.map - -/***/ }), -/* 164 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var delay_1 = __webpack_require__(294); -Observable_1.Observable.prototype.delay = delay_1.delay; -//# sourceMappingURL=delay.js.map - -/***/ }), -/* 165 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var delayWhen_1 = __webpack_require__(295); -Observable_1.Observable.prototype.delayWhen = delayWhen_1.delayWhen; -//# sourceMappingURL=delayWhen.js.map - -/***/ }), -/* 166 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var dematerialize_1 = __webpack_require__(296); -Observable_1.Observable.prototype.dematerialize = dematerialize_1.dematerialize; -//# sourceMappingURL=dematerialize.js.map - -/***/ }), -/* 167 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var distinct_1 = __webpack_require__(297); -Observable_1.Observable.prototype.distinct = distinct_1.distinct; -//# sourceMappingURL=distinct.js.map - -/***/ }), -/* 168 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var distinctUntilChanged_1 = __webpack_require__(60); -Observable_1.Observable.prototype.distinctUntilChanged = distinctUntilChanged_1.distinctUntilChanged; -//# sourceMappingURL=distinctUntilChanged.js.map - -/***/ }), -/* 169 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var distinctUntilKeyChanged_1 = __webpack_require__(298); -Observable_1.Observable.prototype.distinctUntilKeyChanged = distinctUntilKeyChanged_1.distinctUntilKeyChanged; -//# sourceMappingURL=distinctUntilKeyChanged.js.map - -/***/ }), -/* 170 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var do_1 = __webpack_require__(299); -Observable_1.Observable.prototype.do = do_1._do; -Observable_1.Observable.prototype._do = do_1._do; -//# sourceMappingURL=do.js.map - -/***/ }), -/* 171 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var elementAt_1 = __webpack_require__(300); -Observable_1.Observable.prototype.elementAt = elementAt_1.elementAt; -//# sourceMappingURL=elementAt.js.map - -/***/ }), -/* 172 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var every_1 = __webpack_require__(395); -Observable_1.Observable.prototype.every = every_1.every; -//# sourceMappingURL=every.js.map - -/***/ }), -/* 173 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var exhaust_1 = __webpack_require__(301); -Observable_1.Observable.prototype.exhaust = exhaust_1.exhaust; -//# sourceMappingURL=exhaust.js.map - -/***/ }), -/* 174 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var exhaustMap_1 = __webpack_require__(302); -Observable_1.Observable.prototype.exhaustMap = exhaustMap_1.exhaustMap; -//# sourceMappingURL=exhaustMap.js.map - -/***/ }), -/* 175 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var expand_1 = __webpack_require__(303); -Observable_1.Observable.prototype.expand = expand_1.expand; -//# sourceMappingURL=expand.js.map - -/***/ }), -/* 176 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var filter_1 = __webpack_require__(42); -Observable_1.Observable.prototype.filter = filter_1.filter; -//# sourceMappingURL=filter.js.map - -/***/ }), -/* 177 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var finally_1 = __webpack_require__(304); -Observable_1.Observable.prototype.finally = finally_1._finally; -Observable_1.Observable.prototype._finally = finally_1._finally; -//# sourceMappingURL=finally.js.map - -/***/ }), -/* 178 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var find_1 = __webpack_require__(61); -Observable_1.Observable.prototype.find = find_1.find; -//# sourceMappingURL=find.js.map - -/***/ }), -/* 179 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var findIndex_1 = __webpack_require__(305); -Observable_1.Observable.prototype.findIndex = findIndex_1.findIndex; -//# sourceMappingURL=findIndex.js.map - -/***/ }), -/* 180 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var groupBy_1 = __webpack_require__(306); -Observable_1.Observable.prototype.groupBy = groupBy_1.groupBy; -//# sourceMappingURL=groupBy.js.map - -/***/ }), -/* 181 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var ignoreElements_1 = __webpack_require__(307); -Observable_1.Observable.prototype.ignoreElements = ignoreElements_1.ignoreElements; -//# sourceMappingURL=ignoreElements.js.map - -/***/ }), -/* 182 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var isEmpty_1 = __webpack_require__(308); -Observable_1.Observable.prototype.isEmpty = isEmpty_1.isEmpty; -//# sourceMappingURL=isEmpty.js.map - -/***/ }), -/* 183 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var last_1 = __webpack_require__(396); -Observable_1.Observable.prototype.last = last_1.last; -//# sourceMappingURL=last.js.map - -/***/ }), -/* 184 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var let_1 = __webpack_require__(309); -Observable_1.Observable.prototype.let = let_1.letProto; -Observable_1.Observable.prototype.letBind = let_1.letProto; -//# sourceMappingURL=let.js.map - -/***/ }), -/* 185 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var mapTo_1 = __webpack_require__(310); -Observable_1.Observable.prototype.mapTo = mapTo_1.mapTo; -//# sourceMappingURL=mapTo.js.map - -/***/ }), -/* 186 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var materialize_1 = __webpack_require__(311); -Observable_1.Observable.prototype.materialize = materialize_1.materialize; -//# sourceMappingURL=materialize.js.map - -/***/ }), -/* 187 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var max_1 = __webpack_require__(312); -Observable_1.Observable.prototype.max = max_1.max; -//# sourceMappingURL=max.js.map - -/***/ }), -/* 188 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var merge_1 = __webpack_require__(397); -Observable_1.Observable.prototype.merge = merge_1.merge; -//# sourceMappingURL=merge.js.map - -/***/ }), -/* 189 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var mergeAll_1 = __webpack_require__(77); -Observable_1.Observable.prototype.mergeAll = mergeAll_1.mergeAll; -//# sourceMappingURL=mergeAll.js.map - -/***/ }), -/* 190 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var mergeMap_1 = __webpack_require__(383); -Observable_1.Observable.prototype.mergeMap = mergeMap_1.mergeMap; -Observable_1.Observable.prototype.flatMap = mergeMap_1.mergeMap; -//# sourceMappingURL=mergeMap.js.map - -/***/ }), -/* 191 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var mergeMapTo_1 = __webpack_require__(62); -Observable_1.Observable.prototype.flatMapTo = mergeMapTo_1.mergeMapTo; -Observable_1.Observable.prototype.mergeMapTo = mergeMapTo_1.mergeMapTo; -//# sourceMappingURL=mergeMapTo.js.map - -/***/ }), -/* 192 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var mergeScan_1 = __webpack_require__(313); -Observable_1.Observable.prototype.mergeScan = mergeScan_1.mergeScan; -//# sourceMappingURL=mergeScan.js.map - -/***/ }), -/* 193 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var min_1 = __webpack_require__(314); -Observable_1.Observable.prototype.min = min_1.min; -//# sourceMappingURL=min.js.map - -/***/ }), -/* 194 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var multicast_1 = __webpack_require__(16); -Observable_1.Observable.prototype.multicast = multicast_1.multicast; -//# sourceMappingURL=multicast.js.map - -/***/ }), -/* 195 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var observeOn_1 = __webpack_require__(87); -Observable_1.Observable.prototype.observeOn = observeOn_1.observeOn; -//# sourceMappingURL=observeOn.js.map - -/***/ }), -/* 196 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var onErrorResumeNext_1 = __webpack_require__(63); -Observable_1.Observable.prototype.onErrorResumeNext = onErrorResumeNext_1.onErrorResumeNext; -//# sourceMappingURL=onErrorResumeNext.js.map - -/***/ }), -/* 197 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var pairwise_1 = __webpack_require__(315); -Observable_1.Observable.prototype.pairwise = pairwise_1.pairwise; -//# sourceMappingURL=pairwise.js.map +/*! ***************************************************************************** +Copyright (C) Microsoft. 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. +***************************************************************************** */ +var Reflect; +(function (Reflect) { + "use strict"; + var hasOwn = Object.prototype.hasOwnProperty; + // feature test for Symbol support + var supportsSymbol = typeof Symbol === "function"; + var toPrimitiveSymbol = supportsSymbol && typeof Symbol.toPrimitive !== "undefined" ? Symbol.toPrimitive : "@@toPrimitive"; + var iteratorSymbol = supportsSymbol && typeof Symbol.iterator !== "undefined" ? Symbol.iterator : "@@iterator"; + var HashMap; + (function (HashMap) { + var supportsCreate = typeof Object.create === "function"; // feature test for Object.create support + var supportsProto = { __proto__: [] } instanceof Array; // feature test for __proto__ support + var downLevel = !supportsCreate && !supportsProto; + // create an object in dictionary mode (a.k.a. "slow" mode in v8) + HashMap.create = supportsCreate + ? function () { return MakeDictionary(Object.create(null)); } + : supportsProto + ? function () { return MakeDictionary({ __proto__: null }); } + : function () { return MakeDictionary({}); }; + HashMap.has = downLevel + ? function (map, key) { return hasOwn.call(map, key); } + : function (map, key) { return key in map; }; + HashMap.get = downLevel + ? function (map, key) { return hasOwn.call(map, key) ? map[key] : undefined; } + : function (map, key) { return map[key]; }; + })(HashMap || (HashMap = {})); + // Load global or shim versions of Map, Set, and WeakMap + var functionPrototype = Object.getPrototypeOf(Function); + var usePolyfill = typeof process === "object" && process.env && process.env["REFLECT_METADATA_USE_MAP_POLYFILL"] === "true"; + var _Map = !usePolyfill && typeof Map === "function" && typeof Map.prototype.entries === "function" ? Map : CreateMapPolyfill(); + var _Set = !usePolyfill && typeof Set === "function" && typeof Set.prototype.entries === "function" ? Set : CreateSetPolyfill(); + var _WeakMap = !usePolyfill && typeof WeakMap === "function" ? WeakMap : CreateWeakMapPolyfill(); + // [[Metadata]] internal slot + // https://rbuckton.github.io/reflect-metadata/#ordinary-object-internal-methods-and-internal-slots + var Metadata = new _WeakMap(); + /** + * Applies a set of decorators to a property of a target object. + * @param decorators An array of decorators. + * @param target The target object. + * @param propertyKey (Optional) The property key to decorate. + * @param attributes (Optional) The property descriptor for the target key. + * @remarks Decorators are applied in reverse order. + * @example + * + * class Example { + * // property declarations are not part of ES6, though they are valid in TypeScript: + * // static staticProperty; + * // property; + * + * constructor(p) { } + * static staticMethod(p) { } + * method(p) { } + * } + * + * // constructor + * Example = Reflect.decorate(decoratorsArray, Example); + * + * // property (on constructor) + * Reflect.decorate(decoratorsArray, Example, "staticProperty"); + * + * // property (on prototype) + * Reflect.decorate(decoratorsArray, Example.prototype, "property"); + * + * // method (on constructor) + * Object.defineProperty(Example, "staticMethod", + * Reflect.decorate(decoratorsArray, Example, "staticMethod", + * Object.getOwnPropertyDescriptor(Example, "staticMethod"))); + * + * // method (on prototype) + * Object.defineProperty(Example.prototype, "method", + * Reflect.decorate(decoratorsArray, Example.prototype, "method", + * Object.getOwnPropertyDescriptor(Example.prototype, "method"))); + * + */ + function decorate(decorators, target, propertyKey, attributes) { + if (!IsUndefined(propertyKey)) { + if (!IsArray(decorators)) + throw new TypeError(); + if (!IsObject(target)) + throw new TypeError(); + if (!IsObject(attributes) && !IsUndefined(attributes) && !IsNull(attributes)) + throw new TypeError(); + if (IsNull(attributes)) + attributes = undefined; + propertyKey = ToPropertyKey(propertyKey); + return DecorateProperty(decorators, target, propertyKey, attributes); + } + else { + if (!IsArray(decorators)) + throw new TypeError(); + if (!IsConstructor(target)) + throw new TypeError(); + return DecorateConstructor(decorators, target); + } + } + Reflect.decorate = decorate; + // 4.1.2 Reflect.metadata(metadataKey, metadataValue) + // https://rbuckton.github.io/reflect-metadata/#reflect.metadata + /** + * A default metadata decorator factory that can be used on a class, class member, or parameter. + * @param metadataKey The key for the metadata entry. + * @param metadataValue The value for the metadata entry. + * @returns A decorator function. + * @remarks + * If `metadataKey` is already defined for the target and target key, the + * metadataValue for that key will be overwritten. + * @example + * + * // constructor + * @Reflect.metadata(key, value) + * class Example { + * } + * + * // property (on constructor, TypeScript only) + * class Example { + * @Reflect.metadata(key, value) + * static staticProperty; + * } + * + * // property (on prototype, TypeScript only) + * class Example { + * @Reflect.metadata(key, value) + * property; + * } + * + * // method (on constructor) + * class Example { + * @Reflect.metadata(key, value) + * static staticMethod() { } + * } + * + * // method (on prototype) + * class Example { + * @Reflect.metadata(key, value) + * method() { } + * } + * + */ + function metadata(metadataKey, metadataValue) { + function decorator(target, propertyKey) { + if (!IsObject(target)) + throw new TypeError(); + if (!IsUndefined(propertyKey) && !IsPropertyKey(propertyKey)) + throw new TypeError(); + OrdinaryDefineOwnMetadata(metadataKey, metadataValue, target, propertyKey); + } + return decorator; + } + Reflect.metadata = metadata; + /** + * Define a unique metadata entry on the target. + * @param metadataKey A key used to store and retrieve metadata. + * @param metadataValue A value that contains attached metadata. + * @param target The target object on which to define metadata. + * @param propertyKey (Optional) The property key for the target. + * @example + * + * class Example { + * // property declarations are not part of ES6, though they are valid in TypeScript: + * // static staticProperty; + * // property; + * + * constructor(p) { } + * static staticMethod(p) { } + * method(p) { } + * } + * + * // constructor + * Reflect.defineMetadata("custom:annotation", options, Example); + * + * // property (on constructor) + * Reflect.defineMetadata("custom:annotation", options, Example, "staticProperty"); + * + * // property (on prototype) + * Reflect.defineMetadata("custom:annotation", options, Example.prototype, "property"); + * + * // method (on constructor) + * Reflect.defineMetadata("custom:annotation", options, Example, "staticMethod"); + * + * // method (on prototype) + * Reflect.defineMetadata("custom:annotation", options, Example.prototype, "method"); + * + * // decorator factory as metadata-producing annotation. + * function MyAnnotation(options): Decorator { + * return (target, key?) => Reflect.defineMetadata("custom:annotation", options, target, key); + * } + * + */ + function defineMetadata(metadataKey, metadataValue, target, propertyKey) { + if (!IsObject(target)) + throw new TypeError(); + if (!IsUndefined(propertyKey)) + propertyKey = ToPropertyKey(propertyKey); + return OrdinaryDefineOwnMetadata(metadataKey, metadataValue, target, propertyKey); + } + Reflect.defineMetadata = defineMetadata; + /** + * Gets a value indicating whether the target object or its prototype chain has the provided metadata key defined. + * @param metadataKey A key used to store and retrieve metadata. + * @param target The target object on which the metadata is defined. + * @param propertyKey (Optional) The property key for the target. + * @returns `true` if the metadata key was defined on the target object or its prototype chain; otherwise, `false`. + * @example + * + * class Example { + * // property declarations are not part of ES6, though they are valid in TypeScript: + * // static staticProperty; + * // property; + * + * constructor(p) { } + * static staticMethod(p) { } + * method(p) { } + * } + * + * // constructor + * result = Reflect.hasMetadata("custom:annotation", Example); + * + * // property (on constructor) + * result = Reflect.hasMetadata("custom:annotation", Example, "staticProperty"); + * + * // property (on prototype) + * result = Reflect.hasMetadata("custom:annotation", Example.prototype, "property"); + * + * // method (on constructor) + * result = Reflect.hasMetadata("custom:annotation", Example, "staticMethod"); + * + * // method (on prototype) + * result = Reflect.hasMetadata("custom:annotation", Example.prototype, "method"); + * + */ + function hasMetadata(metadataKey, target, propertyKey) { + if (!IsObject(target)) + throw new TypeError(); + if (!IsUndefined(propertyKey)) + propertyKey = ToPropertyKey(propertyKey); + return OrdinaryHasMetadata(metadataKey, target, propertyKey); + } + Reflect.hasMetadata = hasMetadata; + /** + * Gets a value indicating whether the target object has the provided metadata key defined. + * @param metadataKey A key used to store and retrieve metadata. + * @param target The target object on which the metadata is defined. + * @param propertyKey (Optional) The property key for the target. + * @returns `true` if the metadata key was defined on the target object; otherwise, `false`. + * @example + * + * class Example { + * // property declarations are not part of ES6, though they are valid in TypeScript: + * // static staticProperty; + * // property; + * + * constructor(p) { } + * static staticMethod(p) { } + * method(p) { } + * } + * + * // constructor + * result = Reflect.hasOwnMetadata("custom:annotation", Example); + * + * // property (on constructor) + * result = Reflect.hasOwnMetadata("custom:annotation", Example, "staticProperty"); + * + * // property (on prototype) + * result = Reflect.hasOwnMetadata("custom:annotation", Example.prototype, "property"); + * + * // method (on constructor) + * result = Reflect.hasOwnMetadata("custom:annotation", Example, "staticMethod"); + * + * // method (on prototype) + * result = Reflect.hasOwnMetadata("custom:annotation", Example.prototype, "method"); + * + */ + function hasOwnMetadata(metadataKey, target, propertyKey) { + if (!IsObject(target)) + throw new TypeError(); + if (!IsUndefined(propertyKey)) + propertyKey = ToPropertyKey(propertyKey); + return OrdinaryHasOwnMetadata(metadataKey, target, propertyKey); + } + Reflect.hasOwnMetadata = hasOwnMetadata; + /** + * Gets the metadata value for the provided metadata key on the target object or its prototype chain. + * @param metadataKey A key used to store and retrieve metadata. + * @param target The target object on which the metadata is defined. + * @param propertyKey (Optional) The property key for the target. + * @returns The metadata value for the metadata key if found; otherwise, `undefined`. + * @example + * + * class Example { + * // property declarations are not part of ES6, though they are valid in TypeScript: + * // static staticProperty; + * // property; + * + * constructor(p) { } + * static staticMethod(p) { } + * method(p) { } + * } + * + * // constructor + * result = Reflect.getMetadata("custom:annotation", Example); + * + * // property (on constructor) + * result = Reflect.getMetadata("custom:annotation", Example, "staticProperty"); + * + * // property (on prototype) + * result = Reflect.getMetadata("custom:annotation", Example.prototype, "property"); + * + * // method (on constructor) + * result = Reflect.getMetadata("custom:annotation", Example, "staticMethod"); + * + * // method (on prototype) + * result = Reflect.getMetadata("custom:annotation", Example.prototype, "method"); + * + */ + function getMetadata(metadataKey, target, propertyKey) { + if (!IsObject(target)) + throw new TypeError(); + if (!IsUndefined(propertyKey)) + propertyKey = ToPropertyKey(propertyKey); + return OrdinaryGetMetadata(metadataKey, target, propertyKey); + } + Reflect.getMetadata = getMetadata; + /** + * Gets the metadata value for the provided metadata key on the target object. + * @param metadataKey A key used to store and retrieve metadata. + * @param target The target object on which the metadata is defined. + * @param propertyKey (Optional) The property key for the target. + * @returns The metadata value for the metadata key if found; otherwise, `undefined`. + * @example + * + * class Example { + * // property declarations are not part of ES6, though they are valid in TypeScript: + * // static staticProperty; + * // property; + * + * constructor(p) { } + * static staticMethod(p) { } + * method(p) { } + * } + * + * // constructor + * result = Reflect.getOwnMetadata("custom:annotation", Example); + * + * // property (on constructor) + * result = Reflect.getOwnMetadata("custom:annotation", Example, "staticProperty"); + * + * // property (on prototype) + * result = Reflect.getOwnMetadata("custom:annotation", Example.prototype, "property"); + * + * // method (on constructor) + * result = Reflect.getOwnMetadata("custom:annotation", Example, "staticMethod"); + * + * // method (on prototype) + * result = Reflect.getOwnMetadata("custom:annotation", Example.prototype, "method"); + * + */ + function getOwnMetadata(metadataKey, target, propertyKey) { + if (!IsObject(target)) + throw new TypeError(); + if (!IsUndefined(propertyKey)) + propertyKey = ToPropertyKey(propertyKey); + return OrdinaryGetOwnMetadata(metadataKey, target, propertyKey); + } + Reflect.getOwnMetadata = getOwnMetadata; + /** + * Gets the metadata keys defined on the target object or its prototype chain. + * @param target The target object on which the metadata is defined. + * @param propertyKey (Optional) The property key for the target. + * @returns An array of unique metadata keys. + * @example + * + * class Example { + * // property declarations are not part of ES6, though they are valid in TypeScript: + * // static staticProperty; + * // property; + * + * constructor(p) { } + * static staticMethod(p) { } + * method(p) { } + * } + * + * // constructor + * result = Reflect.getMetadataKeys(Example); + * + * // property (on constructor) + * result = Reflect.getMetadataKeys(Example, "staticProperty"); + * + * // property (on prototype) + * result = Reflect.getMetadataKeys(Example.prototype, "property"); + * + * // method (on constructor) + * result = Reflect.getMetadataKeys(Example, "staticMethod"); + * + * // method (on prototype) + * result = Reflect.getMetadataKeys(Example.prototype, "method"); + * + */ + function getMetadataKeys(target, propertyKey) { + if (!IsObject(target)) + throw new TypeError(); + if (!IsUndefined(propertyKey)) + propertyKey = ToPropertyKey(propertyKey); + return OrdinaryMetadataKeys(target, propertyKey); + } + Reflect.getMetadataKeys = getMetadataKeys; + /** + * Gets the unique metadata keys defined on the target object. + * @param target The target object on which the metadata is defined. + * @param propertyKey (Optional) The property key for the target. + * @returns An array of unique metadata keys. + * @example + * + * class Example { + * // property declarations are not part of ES6, though they are valid in TypeScript: + * // static staticProperty; + * // property; + * + * constructor(p) { } + * static staticMethod(p) { } + * method(p) { } + * } + * + * // constructor + * result = Reflect.getOwnMetadataKeys(Example); + * + * // property (on constructor) + * result = Reflect.getOwnMetadataKeys(Example, "staticProperty"); + * + * // property (on prototype) + * result = Reflect.getOwnMetadataKeys(Example.prototype, "property"); + * + * // method (on constructor) + * result = Reflect.getOwnMetadataKeys(Example, "staticMethod"); + * + * // method (on prototype) + * result = Reflect.getOwnMetadataKeys(Example.prototype, "method"); + * + */ + function getOwnMetadataKeys(target, propertyKey) { + if (!IsObject(target)) + throw new TypeError(); + if (!IsUndefined(propertyKey)) + propertyKey = ToPropertyKey(propertyKey); + return OrdinaryOwnMetadataKeys(target, propertyKey); + } + Reflect.getOwnMetadataKeys = getOwnMetadataKeys; + /** + * Deletes the metadata entry from the target object with the provided key. + * @param metadataKey A key used to store and retrieve metadata. + * @param target The target object on which the metadata is defined. + * @param propertyKey (Optional) The property key for the target. + * @returns `true` if the metadata entry was found and deleted; otherwise, false. + * @example + * + * class Example { + * // property declarations are not part of ES6, though they are valid in TypeScript: + * // static staticProperty; + * // property; + * + * constructor(p) { } + * static staticMethod(p) { } + * method(p) { } + * } + * + * // constructor + * result = Reflect.deleteMetadata("custom:annotation", Example); + * + * // property (on constructor) + * result = Reflect.deleteMetadata("custom:annotation", Example, "staticProperty"); + * + * // property (on prototype) + * result = Reflect.deleteMetadata("custom:annotation", Example.prototype, "property"); + * + * // method (on constructor) + * result = Reflect.deleteMetadata("custom:annotation", Example, "staticMethod"); + * + * // method (on prototype) + * result = Reflect.deleteMetadata("custom:annotation", Example.prototype, "method"); + * + */ + function deleteMetadata(metadataKey, target, propertyKey) { + if (!IsObject(target)) + throw new TypeError(); + if (!IsUndefined(propertyKey)) + propertyKey = ToPropertyKey(propertyKey); + var metadataMap = GetOrCreateMetadataMap(target, propertyKey, /*Create*/ false); + if (IsUndefined(metadataMap)) + return false; + if (!metadataMap.delete(metadataKey)) + return false; + if (metadataMap.size > 0) + return true; + var targetMetadata = Metadata.get(target); + targetMetadata.delete(propertyKey); + if (targetMetadata.size > 0) + return true; + Metadata.delete(target); + return true; + } + Reflect.deleteMetadata = deleteMetadata; + function DecorateConstructor(decorators, target) { + for (var i = decorators.length - 1; i >= 0; --i) { + var decorator = decorators[i]; + var decorated = decorator(target); + if (!IsUndefined(decorated) && !IsNull(decorated)) { + if (!IsConstructor(decorated)) + throw new TypeError(); + target = decorated; + } + } + return target; + } + function DecorateProperty(decorators, target, propertyKey, descriptor) { + for (var i = decorators.length - 1; i >= 0; --i) { + var decorator = decorators[i]; + var decorated = decorator(target, propertyKey, descriptor); + if (!IsUndefined(decorated) && !IsNull(decorated)) { + if (!IsObject(decorated)) + throw new TypeError(); + descriptor = decorated; + } + } + return descriptor; + } + function GetOrCreateMetadataMap(O, P, Create) { + var targetMetadata = Metadata.get(O); + if (IsUndefined(targetMetadata)) { + if (!Create) + return undefined; + targetMetadata = new _Map(); + Metadata.set(O, targetMetadata); + } + var metadataMap = targetMetadata.get(P); + if (IsUndefined(metadataMap)) { + if (!Create) + return undefined; + metadataMap = new _Map(); + targetMetadata.set(P, metadataMap); + } + return metadataMap; + } + // 3.1.1.1 OrdinaryHasMetadata(MetadataKey, O, P) + // https://rbuckton.github.io/reflect-metadata/#ordinaryhasmetadata + function OrdinaryHasMetadata(MetadataKey, O, P) { + var hasOwn = OrdinaryHasOwnMetadata(MetadataKey, O, P); + if (hasOwn) + return true; + var parent = OrdinaryGetPrototypeOf(O); + if (!IsNull(parent)) + return OrdinaryHasMetadata(MetadataKey, parent, P); + return false; + } + // 3.1.2.1 OrdinaryHasOwnMetadata(MetadataKey, O, P) + // https://rbuckton.github.io/reflect-metadata/#ordinaryhasownmetadata + function OrdinaryHasOwnMetadata(MetadataKey, O, P) { + var metadataMap = GetOrCreateMetadataMap(O, P, /*Create*/ false); + if (IsUndefined(metadataMap)) + return false; + return ToBoolean(metadataMap.has(MetadataKey)); + } + // 3.1.3.1 OrdinaryGetMetadata(MetadataKey, O, P) + // https://rbuckton.github.io/reflect-metadata/#ordinarygetmetadata + function OrdinaryGetMetadata(MetadataKey, O, P) { + var hasOwn = OrdinaryHasOwnMetadata(MetadataKey, O, P); + if (hasOwn) + return OrdinaryGetOwnMetadata(MetadataKey, O, P); + var parent = OrdinaryGetPrototypeOf(O); + if (!IsNull(parent)) + return OrdinaryGetMetadata(MetadataKey, parent, P); + return undefined; + } + // 3.1.4.1 OrdinaryGetOwnMetadata(MetadataKey, O, P) + // https://rbuckton.github.io/reflect-metadata/#ordinarygetownmetadata + function OrdinaryGetOwnMetadata(MetadataKey, O, P) { + var metadataMap = GetOrCreateMetadataMap(O, P, /*Create*/ false); + if (IsUndefined(metadataMap)) + return undefined; + return metadataMap.get(MetadataKey); + } + // 3.1.5.1 OrdinaryDefineOwnMetadata(MetadataKey, MetadataValue, O, P) + // https://rbuckton.github.io/reflect-metadata/#ordinarydefineownmetadata + function OrdinaryDefineOwnMetadata(MetadataKey, MetadataValue, O, P) { + var metadataMap = GetOrCreateMetadataMap(O, P, /*Create*/ true); + metadataMap.set(MetadataKey, MetadataValue); + } + // 3.1.6.1 OrdinaryMetadataKeys(O, P) + // https://rbuckton.github.io/reflect-metadata/#ordinarymetadatakeys + function OrdinaryMetadataKeys(O, P) { + var ownKeys = OrdinaryOwnMetadataKeys(O, P); + var parent = OrdinaryGetPrototypeOf(O); + if (parent === null) + return ownKeys; + var parentKeys = OrdinaryMetadataKeys(parent, P); + if (parentKeys.length <= 0) + return ownKeys; + if (ownKeys.length <= 0) + return parentKeys; + var set = new _Set(); + var keys = []; + for (var _i = 0, ownKeys_1 = ownKeys; _i < ownKeys_1.length; _i++) { + var key = ownKeys_1[_i]; + var hasKey = set.has(key); + if (!hasKey) { + set.add(key); + keys.push(key); + } + } + for (var _a = 0, parentKeys_1 = parentKeys; _a < parentKeys_1.length; _a++) { + var key = parentKeys_1[_a]; + var hasKey = set.has(key); + if (!hasKey) { + set.add(key); + keys.push(key); + } + } + return keys; + } + // 3.1.7.1 OrdinaryOwnMetadataKeys(O, P) + // https://rbuckton.github.io/reflect-metadata/#ordinaryownmetadatakeys + function OrdinaryOwnMetadataKeys(O, P) { + var keys = []; + var metadataMap = GetOrCreateMetadataMap(O, P, /*Create*/ false); + if (IsUndefined(metadataMap)) + return keys; + var keysObj = metadataMap.keys(); + var iterator = GetIterator(keysObj); + var k = 0; + while (true) { + var next = IteratorStep(iterator); + if (!next) { + keys.length = k; + return keys; + } + var nextValue = IteratorValue(next); + try { + keys[k] = nextValue; + } + catch (e) { + try { + IteratorClose(iterator); + } + finally { + throw e; + } + } + k++; + } + } + // 6 ECMAScript Data Typ0es and Values + // https://tc39.github.io/ecma262/#sec-ecmascript-data-types-and-values + function Type(x) { + if (x === null) + return 1 /* Null */; + switch (typeof x) { + case "undefined": return 0 /* Undefined */; + case "boolean": return 2 /* Boolean */; + case "string": return 3 /* String */; + case "symbol": return 4 /* Symbol */; + case "number": return 5 /* Number */; + case "object": return x === null ? 1 /* Null */ : 6 /* Object */; + default: return 6 /* Object */; + } + } + // 6.1.1 The Undefined Type + // https://tc39.github.io/ecma262/#sec-ecmascript-language-types-undefined-type + function IsUndefined(x) { + return x === undefined; + } + // 6.1.2 The Null Type + // https://tc39.github.io/ecma262/#sec-ecmascript-language-types-null-type + function IsNull(x) { + return x === null; + } + // 6.1.5 The Symbol Type + // https://tc39.github.io/ecma262/#sec-ecmascript-language-types-symbol-type + function IsSymbol(x) { + return typeof x === "symbol"; + } + // 6.1.7 The Object Type + // https://tc39.github.io/ecma262/#sec-object-type + function IsObject(x) { + return typeof x === "object" ? x !== null : typeof x === "function"; + } + // 7.1 Type Conversion + // https://tc39.github.io/ecma262/#sec-type-conversion + // 7.1.1 ToPrimitive(input [, PreferredType]) + // https://tc39.github.io/ecma262/#sec-toprimitive + function ToPrimitive(input, PreferredType) { + switch (Type(input)) { + case 0 /* Undefined */: return input; + case 1 /* Null */: return input; + case 2 /* Boolean */: return input; + case 3 /* String */: return input; + case 4 /* Symbol */: return input; + case 5 /* Number */: return input; + } + var hint = PreferredType === 3 /* String */ ? "string" : PreferredType === 5 /* Number */ ? "number" : "default"; + var exoticToPrim = GetMethod(input, toPrimitiveSymbol); + if (exoticToPrim !== undefined) { + var result = exoticToPrim.call(input, hint); + if (IsObject(result)) + throw new TypeError(); + return result; + } + return OrdinaryToPrimitive(input, hint === "default" ? "number" : hint); + } + // 7.1.1.1 OrdinaryToPrimitive(O, hint) + // https://tc39.github.io/ecma262/#sec-ordinarytoprimitive + function OrdinaryToPrimitive(O, hint) { + if (hint === "string") { + var toString_1 = O.toString; + if (IsCallable(toString_1)) { + var result = toString_1.call(O); + if (!IsObject(result)) + return result; + } + var valueOf = O.valueOf; + if (IsCallable(valueOf)) { + var result = valueOf.call(O); + if (!IsObject(result)) + return result; + } + } + else { + var valueOf = O.valueOf; + if (IsCallable(valueOf)) { + var result = valueOf.call(O); + if (!IsObject(result)) + return result; + } + var toString_2 = O.toString; + if (IsCallable(toString_2)) { + var result = toString_2.call(O); + if (!IsObject(result)) + return result; + } + } + throw new TypeError(); + } + // 7.1.2 ToBoolean(argument) + // https://tc39.github.io/ecma262/2016/#sec-toboolean + function ToBoolean(argument) { + return !!argument; + } + // 7.1.12 ToString(argument) + // https://tc39.github.io/ecma262/#sec-tostring + function ToString(argument) { + return "" + argument; + } + // 7.1.14 ToPropertyKey(argument) + // https://tc39.github.io/ecma262/#sec-topropertykey + function ToPropertyKey(argument) { + var key = ToPrimitive(argument, 3 /* String */); + if (IsSymbol(key)) + return key; + return ToString(key); + } + // 7.2 Testing and Comparison Operations + // https://tc39.github.io/ecma262/#sec-testing-and-comparison-operations + // 7.2.2 IsArray(argument) + // https://tc39.github.io/ecma262/#sec-isarray + function IsArray(argument) { + return Array.isArray + ? Array.isArray(argument) + : argument instanceof Object + ? argument instanceof Array + : Object.prototype.toString.call(argument) === "[object Array]"; + } + // 7.2.3 IsCallable(argument) + // https://tc39.github.io/ecma262/#sec-iscallable + function IsCallable(argument) { + // NOTE: This is an approximation as we cannot check for [[Call]] internal method. + return typeof argument === "function"; + } + // 7.2.4 IsConstructor(argument) + // https://tc39.github.io/ecma262/#sec-isconstructor + function IsConstructor(argument) { + // NOTE: This is an approximation as we cannot check for [[Construct]] internal method. + return typeof argument === "function"; + } + // 7.2.7 IsPropertyKey(argument) + // https://tc39.github.io/ecma262/#sec-ispropertykey + function IsPropertyKey(argument) { + switch (Type(argument)) { + case 3 /* String */: return true; + case 4 /* Symbol */: return true; + default: return false; + } + } + // 7.3 Operations on Objects + // https://tc39.github.io/ecma262/#sec-operations-on-objects + // 7.3.9 GetMethod(V, P) + // https://tc39.github.io/ecma262/#sec-getmethod + function GetMethod(V, P) { + var func = V[P]; + if (func === undefined || func === null) + return undefined; + if (!IsCallable(func)) + throw new TypeError(); + return func; + } + // 7.4 Operations on Iterator Objects + // https://tc39.github.io/ecma262/#sec-operations-on-iterator-objects + function GetIterator(obj) { + var method = GetMethod(obj, iteratorSymbol); + if (!IsCallable(method)) + throw new TypeError(); // from Call + var iterator = method.call(obj); + if (!IsObject(iterator)) + throw new TypeError(); + return iterator; + } + // 7.4.4 IteratorValue(iterResult) + // https://tc39.github.io/ecma262/2016/#sec-iteratorvalue + function IteratorValue(iterResult) { + return iterResult.value; + } + // 7.4.5 IteratorStep(iterator) + // https://tc39.github.io/ecma262/#sec-iteratorstep + function IteratorStep(iterator) { + var result = iterator.next(); + return result.done ? false : result; + } + // 7.4.6 IteratorClose(iterator, completion) + // https://tc39.github.io/ecma262/#sec-iteratorclose + function IteratorClose(iterator) { + var f = iterator["return"]; + if (f) + f.call(iterator); + } + // 9.1 Ordinary Object Internal Methods and Internal Slots + // https://tc39.github.io/ecma262/#sec-ordinary-object-internal-methods-and-internal-slots + // 9.1.1.1 OrdinaryGetPrototypeOf(O) + // https://tc39.github.io/ecma262/#sec-ordinarygetprototypeof + function OrdinaryGetPrototypeOf(O) { + var proto = Object.getPrototypeOf(O); + if (typeof O !== "function" || O === functionPrototype) + return proto; + // TypeScript doesn't set __proto__ in ES5, as it's non-standard. + // Try to determine the superclass constructor. Compatible implementations + // must either set __proto__ on a subclass constructor to the superclass constructor, + // or ensure each class has a valid `constructor` property on its prototype that + // points back to the constructor. + // If this is not the same as Function.[[Prototype]], then this is definately inherited. + // This is the case when in ES6 or when using __proto__ in a compatible browser. + if (proto !== functionPrototype) + return proto; + // If the super prototype is Object.prototype, null, or undefined, then we cannot determine the heritage. + var prototype = O.prototype; + var prototypeProto = prototype && Object.getPrototypeOf(prototype); + if (prototypeProto == null || prototypeProto === Object.prototype) + return proto; + // If the constructor was not a function, then we cannot determine the heritage. + var constructor = prototypeProto.constructor; + if (typeof constructor !== "function") + return proto; + // If we have some kind of self-reference, then we cannot determine the heritage. + if (constructor === O) + return proto; + // we have a pretty good guess at the heritage. + return constructor; + } + // naive Map shim + function CreateMapPolyfill() { + var cacheSentinel = {}; + var arraySentinel = []; + var MapIterator = (function () { + function MapIterator(keys, values, selector) { + this._index = 0; + this._keys = keys; + this._values = values; + this._selector = selector; + } + MapIterator.prototype["@@iterator"] = function () { return this; }; + MapIterator.prototype[iteratorSymbol] = function () { return this; }; + MapIterator.prototype.next = function () { + var index = this._index; + if (index >= 0 && index < this._keys.length) { + var result = this._selector(this._keys[index], this._values[index]); + if (index + 1 >= this._keys.length) { + this._index = -1; + this._keys = arraySentinel; + this._values = arraySentinel; + } + else { + this._index++; + } + return { value: result, done: false }; + } + return { value: undefined, done: true }; + }; + MapIterator.prototype.throw = function (error) { + if (this._index >= 0) { + this._index = -1; + this._keys = arraySentinel; + this._values = arraySentinel; + } + throw error; + }; + MapIterator.prototype.return = function (value) { + if (this._index >= 0) { + this._index = -1; + this._keys = arraySentinel; + this._values = arraySentinel; + } + return { value: value, done: true }; + }; + return MapIterator; + }()); + return (function () { + function Map() { + this._keys = []; + this._values = []; + this._cacheKey = cacheSentinel; + this._cacheIndex = -2; + } + Object.defineProperty(Map.prototype, "size", { + get: function () { return this._keys.length; }, + enumerable: true, + configurable: true + }); + Map.prototype.has = function (key) { return this._find(key, /*insert*/ false) >= 0; }; + Map.prototype.get = function (key) { + var index = this._find(key, /*insert*/ false); + return index >= 0 ? this._values[index] : undefined; + }; + Map.prototype.set = function (key, value) { + var index = this._find(key, /*insert*/ true); + this._values[index] = value; + return this; + }; + Map.prototype.delete = function (key) { + var index = this._find(key, /*insert*/ false); + if (index >= 0) { + var size = this._keys.length; + for (var i = index + 1; i < size; i++) { + this._keys[i - 1] = this._keys[i]; + this._values[i - 1] = this._values[i]; + } + this._keys.length--; + this._values.length--; + if (key === this._cacheKey) { + this._cacheKey = cacheSentinel; + this._cacheIndex = -2; + } + return true; + } + return false; + }; + Map.prototype.clear = function () { + this._keys.length = 0; + this._values.length = 0; + this._cacheKey = cacheSentinel; + this._cacheIndex = -2; + }; + Map.prototype.keys = function () { return new MapIterator(this._keys, this._values, getKey); }; + Map.prototype.values = function () { return new MapIterator(this._keys, this._values, getValue); }; + Map.prototype.entries = function () { return new MapIterator(this._keys, this._values, getEntry); }; + Map.prototype["@@iterator"] = function () { return this.entries(); }; + Map.prototype[iteratorSymbol] = function () { return this.entries(); }; + Map.prototype._find = function (key, insert) { + if (this._cacheKey !== key) { + this._cacheIndex = this._keys.indexOf(this._cacheKey = key); + } + if (this._cacheIndex < 0 && insert) { + this._cacheIndex = this._keys.length; + this._keys.push(key); + this._values.push(undefined); + } + return this._cacheIndex; + }; + return Map; + }()); + function getKey(key, _) { + return key; + } + function getValue(_, value) { + return value; + } + function getEntry(key, value) { + return [key, value]; + } + } + // naive Set shim + function CreateSetPolyfill() { + return (function () { + function Set() { + this._map = new _Map(); + } + Object.defineProperty(Set.prototype, "size", { + get: function () { return this._map.size; }, + enumerable: true, + configurable: true + }); + Set.prototype.has = function (value) { return this._map.has(value); }; + Set.prototype.add = function (value) { return this._map.set(value, value), this; }; + Set.prototype.delete = function (value) { return this._map.delete(value); }; + Set.prototype.clear = function () { this._map.clear(); }; + Set.prototype.keys = function () { return this._map.keys(); }; + Set.prototype.values = function () { return this._map.values(); }; + Set.prototype.entries = function () { return this._map.entries(); }; + Set.prototype["@@iterator"] = function () { return this.keys(); }; + Set.prototype[iteratorSymbol] = function () { return this.keys(); }; + return Set; + }()); + } + // naive WeakMap shim + function CreateWeakMapPolyfill() { + var UUID_SIZE = 16; + var keys = HashMap.create(); + var rootKey = CreateUniqueKey(); + return (function () { + function WeakMap() { + this._key = CreateUniqueKey(); + } + WeakMap.prototype.has = function (target) { + var table = GetOrCreateWeakMapTable(target, /*create*/ false); + return table !== undefined ? HashMap.has(table, this._key) : false; + }; + WeakMap.prototype.get = function (target) { + var table = GetOrCreateWeakMapTable(target, /*create*/ false); + return table !== undefined ? HashMap.get(table, this._key) : undefined; + }; + WeakMap.prototype.set = function (target, value) { + var table = GetOrCreateWeakMapTable(target, /*create*/ true); + table[this._key] = value; + return this; + }; + WeakMap.prototype.delete = function (target) { + var table = GetOrCreateWeakMapTable(target, /*create*/ false); + return table !== undefined ? delete table[this._key] : false; + }; + WeakMap.prototype.clear = function () { + // NOTE: not a real clear, just makes the previous data unreachable + this._key = CreateUniqueKey(); + }; + return WeakMap; + }()); + function CreateUniqueKey() { + var key; + do + key = "@@WeakMap@@" + CreateUUID(); + while (HashMap.has(keys, key)); + keys[key] = true; + return key; + } + function GetOrCreateWeakMapTable(target, create) { + if (!hasOwn.call(target, rootKey)) { + if (!create) + return undefined; + Object.defineProperty(target, rootKey, { value: HashMap.create() }); + } + return target[rootKey]; + } + function FillRandomBytes(buffer, size) { + for (var i = 0; i < size; ++i) + buffer[i] = Math.random() * 0xff | 0; + return buffer; + } + function GenRandomBytes(size) { + if (typeof Uint8Array === "function") { + if (typeof crypto !== "undefined") + return crypto.getRandomValues(new Uint8Array(size)); + if (typeof msCrypto !== "undefined") + return msCrypto.getRandomValues(new Uint8Array(size)); + return FillRandomBytes(new Uint8Array(size), size); + } + return FillRandomBytes(new Array(size), size); + } + function CreateUUID() { + var data = GenRandomBytes(UUID_SIZE); + // mark as random - RFC 4122 § 4.4 + data[6] = data[6] & 0x4f | 0x40; + data[8] = data[8] & 0xbf | 0x80; + var result = ""; + for (var offset = 0; offset < UUID_SIZE; ++offset) { + var byte = data[offset]; + if (offset === 4 || offset === 6 || offset === 8) + result += "-"; + if (byte < 16) + result += "0"; + result += byte.toString(16).toLowerCase(); + } + return result; + } + } + // uses a heuristic used by v8 and chakra to force an object into dictionary mode. + function MakeDictionary(obj) { + obj.__ = undefined; + delete obj.__; + return obj; + } + // patch global Reflect + (function (__global) { + if (typeof __global.Reflect !== "undefined") { + if (__global.Reflect !== Reflect) { + for (var p in Reflect) { + if (hasOwn.call(Reflect, p)) { + __global.Reflect[p] = Reflect[p]; + } + } + } + } + else { + __global.Reflect = Reflect; + } + })(typeof global !== "undefined" ? global : + typeof self !== "undefined" ? self : + Function("return this;")()); +})(Reflect || (Reflect = {})); +//# sourceMappingURL=Reflect.js.map /***/ }), -/* 198 */ +/* 60 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -var Observable_1 = __webpack_require__(0); -var partition_1 = __webpack_require__(316); -Observable_1.Observable.prototype.partition = partition_1.partition; -//# sourceMappingURL=partition.js.map +var Observable_1 = __webpack_require__(2); +var first_1 = __webpack_require__(55); +Observable_1.Observable.prototype.first = first_1.first; +//# sourceMappingURL=first.js.map /***/ }), -/* 199 */ +/* 61 */ /***/ (function(module, exports, __webpack_require__) { -"use strict"; - -var Observable_1 = __webpack_require__(0); -var pluck_1 = __webpack_require__(317); -Observable_1.Observable.prototype.pluck = pluck_1.pluck; -//# sourceMappingURL=pluck.js.map +module.exports = (__webpack_require__(0))(48); /***/ }), -/* 200 */ +/* 62 */ /***/ (function(module, exports, __webpack_require__) { -"use strict"; - -var Observable_1 = __webpack_require__(0); -var publish_1 = __webpack_require__(318); -Observable_1.Observable.prototype.publish = publish_1.publish; -//# sourceMappingURL=publish.js.map +module.exports = (__webpack_require__(0))(54); /***/ }), -/* 201 */ +/* 63 */ /***/ (function(module, exports, __webpack_require__) { -"use strict"; - -var Observable_1 = __webpack_require__(0); -var publishBehavior_1 = __webpack_require__(319); -Observable_1.Observable.prototype.publishBehavior = publishBehavior_1.publishBehavior; -//# sourceMappingURL=publishBehavior.js.map +/** + * @license Angular v5.0.1 + * (c) 2010-2017 Google, Inc. https://angular.io/ + * License: MIT + */ +(function (global, factory) { + true ? factory(exports, __webpack_require__(4), __webpack_require__(53), __webpack_require__(51), __webpack_require__(26)) : + typeof define === 'function' && define.amd ? define('@angular/platform-browser/animations', ['exports', '@angular/core', '@angular/platform-browser', '@angular/animations', '@angular/animations/browser'], factory) : + (factory((global.ng = global.ng || {}, global.ng.platformBrowser = global.ng.platformBrowser || {}, global.ng.platformBrowser.animations = {}),global.ng.core,global.ng.platformBrowser,global.ng.animations,global.ng.animations.browser)); +}(this, (function (exports,_angular_core,_angular_platformBrowser,_angular_animations,_angular_animations_browser) { 'use strict'; -/***/ }), -/* 202 */ -/***/ (function(module, exports, __webpack_require__) { +/*! ***************************************************************************** +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 __()); +} -"use strict"; +/** + * @license Angular v5.0.1 + * (c) 2010-2017 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 + */ +var BrowserAnimationBuilder = (function (_super) { + __extends(BrowserAnimationBuilder, _super); + function BrowserAnimationBuilder(rootRenderer, doc) { + var _this = _super.call(this) || this; + _this._nextAnimationId = 0; + var /** @type {?} */ typeData = /** @type {?} */ ({ + id: '0', + encapsulation: _angular_core.ViewEncapsulation.None, + styles: [], + data: { animation: [] } + }); + _this._renderer = /** @type {?} */ (rootRenderer.createRenderer(doc.body, typeData)); + return _this; + } + /** + * @param {?} animation + * @return {?} + */ + BrowserAnimationBuilder.prototype.build = /** + * @param {?} animation + * @return {?} + */ + function (animation) { + var /** @type {?} */ id = this._nextAnimationId.toString(); + this._nextAnimationId++; + var /** @type {?} */ entry = Array.isArray(animation) ? _angular_animations.sequence(animation) : animation; + issueAnimationCommand(this._renderer, null, id, 'register', [entry]); + return new BrowserAnimationFactory(id, this._renderer); + }; + BrowserAnimationBuilder.decorators = [ + { type: _angular_core.Injectable }, + ]; + /** @nocollapse */ + BrowserAnimationBuilder.ctorParameters = function () { return [ + { type: _angular_core.RendererFactory2, }, + { type: undefined, decorators: [{ type: _angular_core.Inject, args: [_angular_platformBrowser.DOCUMENT,] },] }, + ]; }; + return BrowserAnimationBuilder; +}(_angular_animations.AnimationBuilder)); +var BrowserAnimationFactory = (function (_super) { + __extends(BrowserAnimationFactory, _super); + function BrowserAnimationFactory(_id, _renderer) { + var _this = _super.call(this) || this; + _this._id = _id; + _this._renderer = _renderer; + return _this; + } + /** + * @param {?} element + * @param {?=} options + * @return {?} + */ + BrowserAnimationFactory.prototype.create = /** + * @param {?} element + * @param {?=} options + * @return {?} + */ + function (element, options) { + return new RendererAnimationPlayer(this._id, element, options || {}, this._renderer); + }; + return BrowserAnimationFactory; +}(_angular_animations.AnimationFactory)); +var RendererAnimationPlayer = (function () { + function RendererAnimationPlayer(id, element, options, _renderer) { + this.id = id; + this.element = element; + this._renderer = _renderer; + this.parentPlayer = null; + this._started = false; + this.totalTime = 0; + this._command('create', options); + } + /** + * @param {?} eventName + * @param {?} callback + * @return {?} + */ + RendererAnimationPlayer.prototype._listen = /** + * @param {?} eventName + * @param {?} callback + * @return {?} + */ + function (eventName, callback) { + return this._renderer.listen(this.element, "@@" + this.id + ":" + eventName, callback); + }; + /** + * @param {?} command + * @param {...?} args + * @return {?} + */ + RendererAnimationPlayer.prototype._command = /** + * @param {?} command + * @param {...?} args + * @return {?} + */ + function (command) { + var args = []; + for (var _i = 1; _i < arguments.length; _i++) { + args[_i - 1] = arguments[_i]; + } + return issueAnimationCommand(this._renderer, this.element, this.id, command, args); + }; + /** + * @param {?} fn + * @return {?} + */ + RendererAnimationPlayer.prototype.onDone = /** + * @param {?} fn + * @return {?} + */ + function (fn) { this._listen('done', fn); }; + /** + * @param {?} fn + * @return {?} + */ + RendererAnimationPlayer.prototype.onStart = /** + * @param {?} fn + * @return {?} + */ + function (fn) { this._listen('start', fn); }; + /** + * @param {?} fn + * @return {?} + */ + RendererAnimationPlayer.prototype.onDestroy = /** + * @param {?} fn + * @return {?} + */ + function (fn) { this._listen('destroy', fn); }; + /** + * @return {?} + */ + RendererAnimationPlayer.prototype.init = /** + * @return {?} + */ + function () { this._command('init'); }; + /** + * @return {?} + */ + RendererAnimationPlayer.prototype.hasStarted = /** + * @return {?} + */ + function () { return this._started; }; + /** + * @return {?} + */ + RendererAnimationPlayer.prototype.play = /** + * @return {?} + */ + function () { + this._command('play'); + this._started = true; + }; + /** + * @return {?} + */ + RendererAnimationPlayer.prototype.pause = /** + * @return {?} + */ + function () { this._command('pause'); }; + /** + * @return {?} + */ + RendererAnimationPlayer.prototype.restart = /** + * @return {?} + */ + function () { this._command('restart'); }; + /** + * @return {?} + */ + RendererAnimationPlayer.prototype.finish = /** + * @return {?} + */ + function () { this._command('finish'); }; + /** + * @return {?} + */ + RendererAnimationPlayer.prototype.destroy = /** + * @return {?} + */ + function () { this._command('destroy'); }; + /** + * @return {?} + */ + RendererAnimationPlayer.prototype.reset = /** + * @return {?} + */ + function () { this._command('reset'); }; + /** + * @param {?} p + * @return {?} + */ + RendererAnimationPlayer.prototype.setPosition = /** + * @param {?} p + * @return {?} + */ + function (p) { this._command('setPosition', p); }; + /** + * @return {?} + */ + RendererAnimationPlayer.prototype.getPosition = /** + * @return {?} + */ + function () { return 0; }; + return RendererAnimationPlayer; +}()); +/** + * @param {?} renderer + * @param {?} element + * @param {?} id + * @param {?} command + * @param {?} args + * @return {?} + */ +function issueAnimationCommand(renderer, element, id, command, args) { + return renderer.setProperty(element, "@@" + id + ":" + command, args); +} -var Observable_1 = __webpack_require__(0); -var publishLast_1 = __webpack_require__(320); -Observable_1.Observable.prototype.publishLast = publishLast_1.publishLast; -//# sourceMappingURL=publishLast.js.map +/** + * @fileoverview added by tsickle + * @suppress {checkTypes} checked by tsc + */ +var ANIMATION_PREFIX = '@'; +var DISABLE_ANIMATIONS_FLAG = '@.disabled'; +var AnimationRendererFactory = (function () { + function AnimationRendererFactory(delegate, engine, _zone) { + this.delegate = delegate; + this.engine = engine; + this._zone = _zone; + this._currentId = 0; + this._microtaskId = 1; + this._animationCallbacksBuffer = []; + this._rendererCache = new Map(); + this._cdRecurDepth = 0; + engine.onRemovalComplete = function (element, delegate) { + // Note: if an component element has a leave animation, and the component + // a host leave animation, the view engine will call `removeChild` for the parent + // component renderer as well as for the child component renderer. + // Therefore, we need to check if we already removed the element. + if (delegate && delegate.parentNode(element)) { + delegate.removeChild(element.parentNode, element); + } + }; + } + /** + * @param {?} hostElement + * @param {?} type + * @return {?} + */ + AnimationRendererFactory.prototype.createRenderer = /** + * @param {?} hostElement + * @param {?} type + * @return {?} + */ + function (hostElement, type) { + var _this = this; + var /** @type {?} */ EMPTY_NAMESPACE_ID = ''; + // cache the delegates to find out which cached delegate can + // be used by which cached renderer + var /** @type {?} */ delegate = this.delegate.createRenderer(hostElement, type); + if (!hostElement || !type || !type.data || !type.data['animation']) { + var /** @type {?} */ renderer = this._rendererCache.get(delegate); + if (!renderer) { + renderer = new BaseAnimationRenderer(EMPTY_NAMESPACE_ID, delegate, this.engine); + // only cache this result when the base renderer is used + this._rendererCache.set(delegate, renderer); + } + return renderer; + } + var /** @type {?} */ componentId = type.id; + var /** @type {?} */ namespaceId = type.id + '-' + this._currentId; + this._currentId++; + this.engine.register(namespaceId, hostElement); + var /** @type {?} */ animationTriggers = /** @type {?} */ (type.data['animation']); + animationTriggers.forEach(function (trigger) { + return _this.engine.registerTrigger(componentId, namespaceId, hostElement, trigger.name, trigger); + }); + return new AnimationRenderer(this, namespaceId, delegate, this.engine); + }; + /** + * @return {?} + */ + AnimationRendererFactory.prototype.begin = /** + * @return {?} + */ + function () { + this._cdRecurDepth++; + if (this.delegate.begin) { + this.delegate.begin(); + } + }; + /** + * @return {?} + */ + AnimationRendererFactory.prototype._scheduleCountTask = /** + * @return {?} + */ + function () { + var _this = this; + Zone.current.scheduleMicroTask('incremenet the animation microtask', function () { return _this._microtaskId++; }); + }; + /* @internal */ + /** + * @param {?} count + * @param {?} fn + * @param {?} data + * @return {?} + */ + AnimationRendererFactory.prototype.scheduleListenerCallback = /** + * @param {?} count + * @param {?} fn + * @param {?} data + * @return {?} + */ + function (count, fn, data) { + var _this = this; + if (count >= 0 && count < this._microtaskId) { + this._zone.run(function () { return fn(data); }); + return; + } + if (this._animationCallbacksBuffer.length == 0) { + Promise.resolve(null).then(function () { + _this._zone.run(function () { + _this._animationCallbacksBuffer.forEach(function (tuple) { + var fn = tuple[0], data = tuple[1]; + fn(data); + }); + _this._animationCallbacksBuffer = []; + }); + }); + } + this._animationCallbacksBuffer.push([fn, data]); + }; + /** + * @return {?} + */ + AnimationRendererFactory.prototype.end = /** + * @return {?} + */ + function () { + var _this = this; + this._cdRecurDepth--; + // this is to prevent animations from running twice when an inner + // component does CD when a parent component insted has inserted it + if (this._cdRecurDepth == 0) { + this._zone.runOutsideAngular(function () { + _this._scheduleCountTask(); + _this.engine.flush(_this._microtaskId); + }); + } + if (this.delegate.end) { + this.delegate.end(); + } + }; + /** + * @return {?} + */ + AnimationRendererFactory.prototype.whenRenderingDone = /** + * @return {?} + */ + function () { return this.engine.whenRenderingDone(); }; + AnimationRendererFactory.decorators = [ + { type: _angular_core.Injectable }, + ]; + /** @nocollapse */ + AnimationRendererFactory.ctorParameters = function () { return [ + { type: _angular_core.RendererFactory2, }, + { type: _angular_animations_browser.ɵAnimationEngine, }, + { type: _angular_core.NgZone, }, + ]; }; + return AnimationRendererFactory; +}()); +var BaseAnimationRenderer = (function () { + function BaseAnimationRenderer(namespaceId, delegate, engine) { + this.namespaceId = namespaceId; + this.delegate = delegate; + this.engine = engine; + this.destroyNode = this.delegate.destroyNode ? function (n) { return /** @type {?} */ ((delegate.destroyNode))(n); } : null; + } + Object.defineProperty(BaseAnimationRenderer.prototype, "data", { + get: /** + * @return {?} + */ + function () { return this.delegate.data; }, + enumerable: true, + configurable: true + }); + /** + * @return {?} + */ + BaseAnimationRenderer.prototype.destroy = /** + * @return {?} + */ + function () { + this.engine.destroy(this.namespaceId, this.delegate); + this.delegate.destroy(); + }; + /** + * @param {?} name + * @param {?=} namespace + * @return {?} + */ + BaseAnimationRenderer.prototype.createElement = /** + * @param {?} name + * @param {?=} namespace + * @return {?} + */ + function (name, namespace) { + return this.delegate.createElement(name, namespace); + }; + /** + * @param {?} value + * @return {?} + */ + BaseAnimationRenderer.prototype.createComment = /** + * @param {?} value + * @return {?} + */ + function (value) { return this.delegate.createComment(value); }; + /** + * @param {?} value + * @return {?} + */ + BaseAnimationRenderer.prototype.createText = /** + * @param {?} value + * @return {?} + */ + function (value) { return this.delegate.createText(value); }; + /** + * @param {?} parent + * @param {?} newChild + * @return {?} + */ + BaseAnimationRenderer.prototype.appendChild = /** + * @param {?} parent + * @param {?} newChild + * @return {?} + */ + function (parent, newChild) { + this.delegate.appendChild(parent, newChild); + this.engine.onInsert(this.namespaceId, newChild, parent, false); + }; + /** + * @param {?} parent + * @param {?} newChild + * @param {?} refChild + * @return {?} + */ + BaseAnimationRenderer.prototype.insertBefore = /** + * @param {?} parent + * @param {?} newChild + * @param {?} refChild + * @return {?} + */ + function (parent, newChild, refChild) { + this.delegate.insertBefore(parent, newChild, refChild); + this.engine.onInsert(this.namespaceId, newChild, parent, true); + }; + /** + * @param {?} parent + * @param {?} oldChild + * @return {?} + */ + BaseAnimationRenderer.prototype.removeChild = /** + * @param {?} parent + * @param {?} oldChild + * @return {?} + */ + function (parent, oldChild) { + this.engine.onRemove(this.namespaceId, oldChild, this.delegate); + }; + /** + * @param {?} selectorOrNode + * @return {?} + */ + BaseAnimationRenderer.prototype.selectRootElement = /** + * @param {?} selectorOrNode + * @return {?} + */ + function (selectorOrNode) { return this.delegate.selectRootElement(selectorOrNode); }; + /** + * @param {?} node + * @return {?} + */ + BaseAnimationRenderer.prototype.parentNode = /** + * @param {?} node + * @return {?} + */ + function (node) { return this.delegate.parentNode(node); }; + /** + * @param {?} node + * @return {?} + */ + BaseAnimationRenderer.prototype.nextSibling = /** + * @param {?} node + * @return {?} + */ + function (node) { return this.delegate.nextSibling(node); }; + /** + * @param {?} el + * @param {?} name + * @param {?} value + * @param {?=} namespace + * @return {?} + */ + BaseAnimationRenderer.prototype.setAttribute = /** + * @param {?} el + * @param {?} name + * @param {?} value + * @param {?=} namespace + * @return {?} + */ + function (el, name, value, namespace) { + this.delegate.setAttribute(el, name, value, namespace); + }; + /** + * @param {?} el + * @param {?} name + * @param {?=} namespace + * @return {?} + */ + BaseAnimationRenderer.prototype.removeAttribute = /** + * @param {?} el + * @param {?} name + * @param {?=} namespace + * @return {?} + */ + function (el, name, namespace) { + this.delegate.removeAttribute(el, name, namespace); + }; + /** + * @param {?} el + * @param {?} name + * @return {?} + */ + BaseAnimationRenderer.prototype.addClass = /** + * @param {?} el + * @param {?} name + * @return {?} + */ + function (el, name) { this.delegate.addClass(el, name); }; + /** + * @param {?} el + * @param {?} name + * @return {?} + */ + BaseAnimationRenderer.prototype.removeClass = /** + * @param {?} el + * @param {?} name + * @return {?} + */ + function (el, name) { this.delegate.removeClass(el, name); }; + /** + * @param {?} el + * @param {?} style + * @param {?} value + * @param {?=} flags + * @return {?} + */ + BaseAnimationRenderer.prototype.setStyle = /** + * @param {?} el + * @param {?} style + * @param {?} value + * @param {?=} flags + * @return {?} + */ + function (el, style, value, flags) { + this.delegate.setStyle(el, style, value, flags); + }; + /** + * @param {?} el + * @param {?} style + * @param {?=} flags + * @return {?} + */ + BaseAnimationRenderer.prototype.removeStyle = /** + * @param {?} el + * @param {?} style + * @param {?=} flags + * @return {?} + */ + function (el, style, flags) { + this.delegate.removeStyle(el, style, flags); + }; + /** + * @param {?} el + * @param {?} name + * @param {?} value + * @return {?} + */ + BaseAnimationRenderer.prototype.setProperty = /** + * @param {?} el + * @param {?} name + * @param {?} value + * @return {?} + */ + function (el, name, value) { + if (name.charAt(0) == ANIMATION_PREFIX && name == DISABLE_ANIMATIONS_FLAG) { + this.disableAnimations(el, !!value); + } + else { + this.delegate.setProperty(el, name, value); + } + }; + /** + * @param {?} node + * @param {?} value + * @return {?} + */ + BaseAnimationRenderer.prototype.setValue = /** + * @param {?} node + * @param {?} value + * @return {?} + */ + function (node, value) { this.delegate.setValue(node, value); }; + /** + * @param {?} target + * @param {?} eventName + * @param {?} callback + * @return {?} + */ + BaseAnimationRenderer.prototype.listen = /** + * @param {?} target + * @param {?} eventName + * @param {?} callback + * @return {?} + */ + function (target, eventName, callback) { + return this.delegate.listen(target, eventName, callback); + }; + /** + * @param {?} element + * @param {?} value + * @return {?} + */ + BaseAnimationRenderer.prototype.disableAnimations = /** + * @param {?} element + * @param {?} value + * @return {?} + */ + function (element, value) { + this.engine.disableAnimations(element, value); + }; + return BaseAnimationRenderer; +}()); +var AnimationRenderer = (function (_super) { + __extends(AnimationRenderer, _super); + function AnimationRenderer(factory, namespaceId, delegate, engine) { + var _this = _super.call(this, namespaceId, delegate, engine) || this; + _this.factory = factory; + _this.namespaceId = namespaceId; + return _this; + } + /** + * @param {?} el + * @param {?} name + * @param {?} value + * @return {?} + */ + AnimationRenderer.prototype.setProperty = /** + * @param {?} el + * @param {?} name + * @param {?} value + * @return {?} + */ + function (el, name, value) { + if (name.charAt(0) == ANIMATION_PREFIX) { + if (name.charAt(1) == '.' && name == DISABLE_ANIMATIONS_FLAG) { + value = value === undefined ? true : !!value; + this.disableAnimations(el, /** @type {?} */ (value)); + } + else { + this.engine.process(this.namespaceId, el, name.substr(1), value); + } + } + else { + this.delegate.setProperty(el, name, value); + } + }; + /** + * @param {?} target + * @param {?} eventName + * @param {?} callback + * @return {?} + */ + AnimationRenderer.prototype.listen = /** + * @param {?} target + * @param {?} eventName + * @param {?} callback + * @return {?} + */ + function (target, eventName, callback) { + var _this = this; + if (eventName.charAt(0) == ANIMATION_PREFIX) { + var /** @type {?} */ element = resolveElementFromTarget(target); + var /** @type {?} */ name_1 = eventName.substr(1); + var /** @type {?} */ phase = ''; + // @listener.phase is for trigger animation callbacks + // @@listener is for animation builder callbacks + if (name_1.charAt(0) != ANIMATION_PREFIX) { + _a = parseTriggerCallbackName(name_1), name_1 = _a[0], phase = _a[1]; + } + return this.engine.listen(this.namespaceId, element, name_1, phase, function (event) { + var /** @type {?} */ countId = (/** @type {?} */ (event))['_data'] || -1; + _this.factory.scheduleListenerCallback(countId, callback, event); + }); + } + return this.delegate.listen(target, eventName, callback); + var _a; + }; + return AnimationRenderer; +}(BaseAnimationRenderer)); +/** + * @param {?} target + * @return {?} + */ +function resolveElementFromTarget(target) { + switch (target) { + case 'body': + return document.body; + case 'document': + return document; + case 'window': + return window; + default: + return target; + } +} +/** + * @param {?} triggerName + * @return {?} + */ +function parseTriggerCallbackName(triggerName) { + var /** @type {?} */ dotIndex = triggerName.indexOf('.'); + var /** @type {?} */ trigger = triggerName.substring(0, dotIndex); + var /** @type {?} */ phase = triggerName.substr(dotIndex + 1); + return [trigger, phase]; +} -/***/ }), -/* 203 */ -/***/ (function(module, exports, __webpack_require__) { +/** + * @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 InjectableAnimationEngine = (function (_super) { + __extends(InjectableAnimationEngine, _super); + function InjectableAnimationEngine(driver, normalizer) { + return _super.call(this, driver, normalizer) || this; + } + InjectableAnimationEngine.decorators = [ + { type: _angular_core.Injectable }, + ]; + /** @nocollapse */ + InjectableAnimationEngine.ctorParameters = function () { return [ + { type: _angular_animations_browser.AnimationDriver, }, + { type: _angular_animations_browser.ɵAnimationStyleNormalizer, }, + ]; }; + return InjectableAnimationEngine; +}(_angular_animations_browser.ɵAnimationEngine)); +/** + * @return {?} + */ +function instantiateSupportedAnimationDriver() { + if (_angular_animations_browser.ɵsupportsWebAnimations()) { + return new _angular_animations_browser.ɵWebAnimationsDriver(); + } + return new _angular_animations_browser.ɵNoopAnimationDriver(); +} +/** + * @return {?} + */ +function instantiateDefaultStyleNormalizer() { + return new _angular_animations_browser.ɵWebAnimationsStyleNormalizer(); +} +/** + * @param {?} renderer + * @param {?} engine + * @param {?} zone + * @return {?} + */ +function instantiateRendererFactory(renderer, engine, zone) { + return new AnimationRendererFactory(renderer, engine, zone); +} +var SHARED_ANIMATION_PROVIDERS = [ + { provide: _angular_animations.AnimationBuilder, useClass: BrowserAnimationBuilder }, + { provide: _angular_animations_browser.ɵAnimationStyleNormalizer, useFactory: instantiateDefaultStyleNormalizer }, + { provide: _angular_animations_browser.ɵAnimationEngine, useClass: InjectableAnimationEngine }, { + provide: _angular_core.RendererFactory2, + useFactory: instantiateRendererFactory, + deps: [_angular_platformBrowser.ɵDomRendererFactory2, _angular_animations_browser.ɵAnimationEngine, _angular_core.NgZone] + } +]; +/** + * Separate providers from the actual module so that we can do a local modification in Google3 to + * include them in the BrowserModule. + */ +var BROWSER_ANIMATIONS_PROVIDERS = [ + { provide: _angular_animations_browser.AnimationDriver, useFactory: instantiateSupportedAnimationDriver } +].concat(SHARED_ANIMATION_PROVIDERS); +/** + * Separate providers from the actual module so that we can do a local modification in Google3 to + * include them in the BrowserTestingModule. + */ +var BROWSER_NOOP_ANIMATIONS_PROVIDERS = [{ provide: _angular_animations_browser.AnimationDriver, useClass: _angular_animations_browser.ɵNoopAnimationDriver }].concat(SHARED_ANIMATION_PROVIDERS); -"use strict"; +/** + * @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 + */ +/** + * \@experimental Animation support is experimental. + */ +var BrowserAnimationsModule = (function () { + function BrowserAnimationsModule() { + } + BrowserAnimationsModule.decorators = [ + { type: _angular_core.NgModule, args: [{ + exports: [_angular_platformBrowser.BrowserModule], + providers: BROWSER_ANIMATIONS_PROVIDERS, + },] }, + ]; + /** @nocollapse */ + BrowserAnimationsModule.ctorParameters = function () { return []; }; + return BrowserAnimationsModule; +}()); +/** + * \@experimental Animation support is experimental. + */ +var NoopAnimationsModule = (function () { + function NoopAnimationsModule() { + } + NoopAnimationsModule.decorators = [ + { type: _angular_core.NgModule, args: [{ + exports: [_angular_platformBrowser.BrowserModule], + providers: BROWSER_NOOP_ANIMATIONS_PROVIDERS, + },] }, + ]; + /** @nocollapse */ + NoopAnimationsModule.ctorParameters = function () { return []; }; + return NoopAnimationsModule; +}()); -var Observable_1 = __webpack_require__(0); -var publishReplay_1 = __webpack_require__(321); -Observable_1.Observable.prototype.publishReplay = publishReplay_1.publishReplay; -//# sourceMappingURL=publishReplay.js.map +exports.BrowserAnimationsModule = BrowserAnimationsModule; +exports.NoopAnimationsModule = NoopAnimationsModule; +exports.ɵBrowserAnimationBuilder = BrowserAnimationBuilder; +exports.ɵBrowserAnimationFactory = BrowserAnimationFactory; +exports.ɵAnimationRenderer = AnimationRenderer; +exports.ɵAnimationRendererFactory = AnimationRendererFactory; +exports.ɵa = BaseAnimationRenderer; +exports.ɵf = BROWSER_ANIMATIONS_PROVIDERS; +exports.ɵg = BROWSER_NOOP_ANIMATIONS_PROVIDERS; +exports.ɵb = InjectableAnimationEngine; +exports.ɵd = instantiateDefaultStyleNormalizer; +exports.ɵe = instantiateRendererFactory; +exports.ɵc = instantiateSupportedAnimationDriver; -/***/ }), -/* 204 */ -/***/ (function(module, exports, __webpack_require__) { +Object.defineProperty(exports, '__esModule', { value: true }); -"use strict"; +}))); +//# sourceMappingURL=platform-browser-animations.umd.js.map -var Observable_1 = __webpack_require__(0); -var race_1 = __webpack_require__(64); -Observable_1.Observable.prototype.race = race_1.race; -//# sourceMappingURL=race.js.map /***/ }), -/* 205 */ -/***/ (function(module, exports, __webpack_require__) { +/* 64 */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return AppModuleShared; }); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__(4); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0__angular_core__); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__angular_common__ = __webpack_require__(5); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__angular_common___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1__angular_common__); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__angular_forms__ = __webpack_require__(129); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__angular_forms___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2__angular_forms__); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__angular_common_http__ = __webpack_require__(13); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__angular_common_http___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_3__angular_common_http__); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__angular_router__ = __webpack_require__(52); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__angular_router___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_4__angular_router__); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__components_app_app_component__ = __webpack_require__(28); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__components_navmenu_navmenu_component__ = __webpack_require__(68); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__components_home_home_component__ = __webpack_require__(67); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__components_fetchdata_fetchdata_component__ = __webpack_require__(66); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_9__components_counter_counter_component__ = __webpack_require__(65); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_10__components_unauthorized_unauthorized_component__ = __webpack_require__(69); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_11_angular_auth_oidc_client__ = __webpack_require__(27); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_11_angular_auth_oidc_client___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_11_angular_auth_oidc_client__); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_12__components_services_auth_service__ = __webpack_require__(14); +var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { + var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); + else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; + return c > 3 && r && Object.defineProperty(target, key, r), r; +}; + + + + + + + + + + + + + +var AppModuleShared = (function () { + function AppModuleShared() { + } + AppModuleShared = __decorate([ + __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_0__angular_core__["NgModule"])({ + declarations: [ + __WEBPACK_IMPORTED_MODULE_5__components_app_app_component__["a" /* AppComponent */], + __WEBPACK_IMPORTED_MODULE_6__components_navmenu_navmenu_component__["a" /* NavMenuComponent */], + __WEBPACK_IMPORTED_MODULE_9__components_counter_counter_component__["a" /* CounterComponent */], + __WEBPACK_IMPORTED_MODULE_8__components_fetchdata_fetchdata_component__["a" /* FetchDataComponent */], + __WEBPACK_IMPORTED_MODULE_7__components_home_home_component__["a" /* HomeComponent */], + __WEBPACK_IMPORTED_MODULE_10__components_unauthorized_unauthorized_component__["a" /* UnauthorizedComponent */] + ], + imports: [ + __WEBPACK_IMPORTED_MODULE_11_angular_auth_oidc_client__["AuthModule"].forRoot(), + __WEBPACK_IMPORTED_MODULE_1__angular_common__["CommonModule"], + __WEBPACK_IMPORTED_MODULE_3__angular_common_http__["HttpClientModule"], + __WEBPACK_IMPORTED_MODULE_2__angular_forms__["FormsModule"], + __WEBPACK_IMPORTED_MODULE_4__angular_router__["RouterModule"].forRoot([ + { path: '', redirectTo: 'home', pathMatch: 'full' }, + { path: 'home', component: __WEBPACK_IMPORTED_MODULE_7__components_home_home_component__["a" /* HomeComponent */] }, + { path: 'unauthorized', component: __WEBPACK_IMPORTED_MODULE_10__components_unauthorized_unauthorized_component__["a" /* UnauthorizedComponent */] }, + { path: 'counter', component: __WEBPACK_IMPORTED_MODULE_9__components_counter_counter_component__["a" /* CounterComponent */] }, + { path: 'fetch-data', component: __WEBPACK_IMPORTED_MODULE_8__components_fetchdata_fetchdata_component__["a" /* FetchDataComponent */] }, + { path: '**', redirectTo: 'home' } + ]) + ], + providers: [ + __WEBPACK_IMPORTED_MODULE_12__components_services_auth_service__["a" /* AuthService */], + __WEBPACK_IMPORTED_MODULE_11_angular_auth_oidc_client__["OidcSecurityService"] + ] + }) + ], AppModuleShared); + return AppModuleShared; +}()); + -var Observable_1 = __webpack_require__(0); -var reduce_1 = __webpack_require__(43); -Observable_1.Observable.prototype.reduce = reduce_1.reduce; -//# sourceMappingURL=reduce.js.map /***/ }), -/* 206 */ -/***/ (function(module, exports, __webpack_require__) { +/* 65 */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return CounterComponent; }); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__(4); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0__angular_core__); +var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { + var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); + else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; + return c > 3 && r && Object.defineProperty(target, key, r), r; +}; + +var CounterComponent = (function () { + function CounterComponent() { + this.currentCount = 0; + } + CounterComponent.prototype.incrementCounter = function () { + this.currentCount++; + }; + CounterComponent = __decorate([ + __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Component"])({ + selector: 'counter', + template: __webpack_require__(84) + }) + ], CounterComponent); + return CounterComponent; +}()); + -var Observable_1 = __webpack_require__(0); -var repeat_1 = __webpack_require__(322); -Observable_1.Observable.prototype.repeat = repeat_1.repeat; -//# sourceMappingURL=repeat.js.map /***/ }), -/* 207 */ -/***/ (function(module, exports, __webpack_require__) { +/* 66 */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return FetchDataComponent; }); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__(4); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0__angular_core__); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__services_auth_service__ = __webpack_require__(14); +var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { + var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); + else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; + return c > 3 && r && Object.defineProperty(target, key, r), r; +}; +var __metadata = (this && this.__metadata) || function (k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); +}; +var __param = (this && this.__param) || function (paramIndex, decorator) { + return function (target, key) { decorator(target, key, paramIndex); } +}; + + +var FetchDataComponent = (function () { + function FetchDataComponent(authService, apiUrl) { + var _this = this; + authService.get(apiUrl + 'SampleData/WeatherForecasts').subscribe(function (result) { + _this.forecasts = result; + }, function (error) { return console.error(error); }); + } + FetchDataComponent = __decorate([ + __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Component"])({ + selector: 'fetchdata', + template: __webpack_require__(85) + }), + __param(1, __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Inject"])('API_URL')), + __metadata("design:paramtypes", [__WEBPACK_IMPORTED_MODULE_1__services_auth_service__["a" /* AuthService */], String]) + ], FetchDataComponent); + return FetchDataComponent; +}()); + -var Observable_1 = __webpack_require__(0); -var repeatWhen_1 = __webpack_require__(323); -Observable_1.Observable.prototype.repeatWhen = repeatWhen_1.repeatWhen; -//# sourceMappingURL=repeatWhen.js.map /***/ }), -/* 208 */ -/***/ (function(module, exports, __webpack_require__) { +/* 67 */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return HomeComponent; }); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__(4); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0__angular_core__); +var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { + var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); + else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; + return c > 3 && r && Object.defineProperty(target, key, r), r; +}; + +var HomeComponent = (function () { + function HomeComponent() { + } + HomeComponent = __decorate([ + __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Component"])({ + selector: 'home', + template: __webpack_require__(86) + }) + ], HomeComponent); + return HomeComponent; +}()); + -var Observable_1 = __webpack_require__(0); -var retry_1 = __webpack_require__(324); -Observable_1.Observable.prototype.retry = retry_1.retry; -//# sourceMappingURL=retry.js.map /***/ }), -/* 209 */ -/***/ (function(module, exports, __webpack_require__) { +/* 68 */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return NavMenuComponent; }); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__(4); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0__angular_core__); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__services_auth_service__ = __webpack_require__(14); +var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { + var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); + else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; + return c > 3 && r && Object.defineProperty(target, key, r), r; +}; +var __metadata = (this && this.__metadata) || function (k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); +}; + + +var NavMenuComponent = (function () { + function NavMenuComponent(authService) { + this.authService = authService; + } + NavMenuComponent.prototype.ngOnInit = function () { + var _this = this; + this.isAuthorizedSubscription = this.authService.getIsAuthorized().subscribe(function (isAuthorized) { + _this.isAuthorized = isAuthorized; + }); + }; + NavMenuComponent.prototype.ngOnDestroy = function () { + this.isAuthorizedSubscription.unsubscribe(); + }; + NavMenuComponent.prototype.login = function () { + this.authService.login(); + }; + NavMenuComponent.prototype.refreshSession = function () { + this.authService.refreshSession(); + }; + NavMenuComponent.prototype.logout = function () { + this.authService.logout(); + }; + NavMenuComponent = __decorate([ + __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Component"])({ + selector: 'nav-menu', + template: __webpack_require__(87), + styles: [__webpack_require__(119)] + }), + __metadata("design:paramtypes", [__WEBPACK_IMPORTED_MODULE_1__services_auth_service__["a" /* AuthService */]]) + ], NavMenuComponent); + return NavMenuComponent; +}()); + -var Observable_1 = __webpack_require__(0); -var retryWhen_1 = __webpack_require__(325); -Observable_1.Observable.prototype.retryWhen = retryWhen_1.retryWhen; -//# sourceMappingURL=retryWhen.js.map /***/ }), -/* 210 */ -/***/ (function(module, exports, __webpack_require__) { +/* 69 */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return UnauthorizedComponent; }); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__(4); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0__angular_core__); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__angular_common__ = __webpack_require__(5); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__angular_common___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1__angular_common__); +var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { + var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); + else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; + return c > 3 && r && Object.defineProperty(target, key, r), r; +}; +var __metadata = (this && this.__metadata) || function (k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); +}; + + +var UnauthorizedComponent = (function () { + function UnauthorizedComponent(location) { + this.location = location; + } + UnauthorizedComponent.prototype.ngOnInit = function () { + }; + UnauthorizedComponent.prototype.login = function () { + //this.service.startSigninMainWindow(); + }; + UnauthorizedComponent.prototype.goback = function () { + this.location.back(); + }; + UnauthorizedComponent = __decorate([ + __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Component"])({ + selector: 'app-unauthorized', + template: __webpack_require__(88) + }), + __metadata("design:paramtypes", [__WEBPACK_IMPORTED_MODULE_1__angular_common__["Location"]]) + ], UnauthorizedComponent); + return UnauthorizedComponent; +}()); + -var Observable_1 = __webpack_require__(0); -var sample_1 = __webpack_require__(326); -Observable_1.Observable.prototype.sample = sample_1.sample; -//# sourceMappingURL=sample.js.map /***/ }), -/* 211 */ -/***/ (function(module, exports, __webpack_require__) { +/* 70 */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; +Object.defineProperty(__webpack_exports__, "__esModule", { value: true }); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_reflect_metadata__ = __webpack_require__(59); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_reflect_metadata___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_reflect_metadata__); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_zone_js__ = __webpack_require__(62); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_zone_js___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_zone_js__); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_rxjs_add_operator_first__ = __webpack_require__(60); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_rxjs_add_operator_first___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2_rxjs_add_operator_first__); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__angular_common__ = __webpack_require__(5); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__angular_common___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_3__angular_common__); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__angular_core__ = __webpack_require__(4); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__angular_core___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_4__angular_core__); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__angular_platform_server__ = __webpack_require__(25); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__angular_platform_server___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_5__angular_platform_server__); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6_aspnet_prerendering__ = __webpack_require__(61); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6_aspnet_prerendering___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_6_aspnet_prerendering__); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__app_app_module_server__ = __webpack_require__(58); + + + + + + + + +__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_4__angular_core__["enableProdMode"])(); +/* harmony default export */ __webpack_exports__["default"] = (__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_6_aspnet_prerendering__["createServerRenderer"])(function (params) { + var providers = [ + { provide: __WEBPACK_IMPORTED_MODULE_5__angular_platform_server__["INITIAL_CONFIG"], useValue: { document: '', url: params.url } }, + { provide: __WEBPACK_IMPORTED_MODULE_3__angular_common__["APP_BASE_HREF"], useValue: params.baseUrl }, + { provide: 'BASE_URL', useValue: params.origin + params.baseUrl }, + { provide: 'ORIGIN_URL', useValue: params.origin + params.baseUrl }, + { provide: 'API_URL', useValue: params.data.apiUrl }, + { provide: 'IDENTITY_URL', useValue: params.data.identityUrl }, + { provide: 'URL_CONFIG', useValue: params.data } + ]; + return __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_5__angular_platform_server__["platformDynamicServer"])(providers).bootstrapModule(__WEBPACK_IMPORTED_MODULE_7__app_app_module_server__["a" /* AppModule */]).then(function (moduleRef) { + var appRef = moduleRef.injector.get(__WEBPACK_IMPORTED_MODULE_4__angular_core__["ApplicationRef"]); + var state = moduleRef.injector.get(__WEBPACK_IMPORTED_MODULE_5__angular_platform_server__["PlatformState"]); + var zone = moduleRef.injector.get(__WEBPACK_IMPORTED_MODULE_4__angular_core__["NgZone"]); + return new Promise(function (resolve, reject) { + zone.onError.subscribe(function (errorInfo) { return reject(errorInfo); }); + appRef.isStable.first(function (isStable) { return isStable; }).subscribe(function () { + // Because 'onStable' fires before 'onError', we have to delay slightly before + // completing the request in case there's an error to report + setImmediate(function () { + resolve({ + html: state.renderToString(), + globals: { url_Config: params.data } + }); + moduleRef.destroy(); + }); + }); + }); + }); +})); -var Observable_1 = __webpack_require__(0); -var sampleTime_1 = __webpack_require__(327); -Observable_1.Observable.prototype.sampleTime = sampleTime_1.sampleTime; -//# sourceMappingURL=sampleTime.js.map /***/ }), -/* 212 */ +/* 71 */ /***/ (function(module, exports, __webpack_require__) { -"use strict"; +exports = module.exports = __webpack_require__(54)(undefined); +// imports -var Observable_1 = __webpack_require__(0); -var scan_1 = __webpack_require__(328); -Observable_1.Observable.prototype.scan = scan_1.scan; -//# sourceMappingURL=scan.js.map -/***/ }), -/* 213 */ -/***/ (function(module, exports, __webpack_require__) { +// module +exports.push([module.i, "@media (max-width: 767px) {\r\n /* On small screens, the nav menu spans the full width of the screen. Leave a space for it. */\r\n .body-content {\r\n padding-top: 50px;\r\n }\r\n}\r\n", ""]); -"use strict"; +// exports -var Observable_1 = __webpack_require__(0); -var sequenceEqual_1 = __webpack_require__(329); -Observable_1.Observable.prototype.sequenceEqual = sequenceEqual_1.sequenceEqual; -//# sourceMappingURL=sequenceEqual.js.map /***/ }), -/* 214 */ +/* 72 */ /***/ (function(module, exports, __webpack_require__) { -"use strict"; +exports = module.exports = __webpack_require__(54)(undefined); +// imports -var Observable_1 = __webpack_require__(0); -var share_1 = __webpack_require__(398); -Observable_1.Observable.prototype.share = share_1.share; -//# sourceMappingURL=share.js.map -/***/ }), -/* 215 */ -/***/ (function(module, exports, __webpack_require__) { +// module +exports.push([module.i, "li .glyphicon {\r\n margin-right: 10px;\r\n}\r\n\r\n/* Highlighting rules for nav menu items */\r\nli.link-active a,\r\nli.link-active a:hover,\r\nli.link-active a:focus {\r\n background-color: #4189C7;\r\n color: white;\r\n}\r\n\r\n/* Keep the nav menu independent of scrolling and on top of other items */\r\n.main-nav {\r\n position: fixed;\r\n top: 0;\r\n left: 0;\r\n right: 0;\r\n z-index: 1;\r\n}\r\n\r\n@media (min-width: 768px) {\r\n /* On small screens, convert the nav menu to a vertical sidebar */\r\n .main-nav {\r\n height: 100%;\r\n width: calc(25% - 20px);\r\n }\r\n .navbar {\r\n border-radius: 0px;\r\n border-width: 0px;\r\n height: 100%;\r\n }\r\n .navbar-header {\r\n float: none;\r\n }\r\n .navbar-collapse {\r\n border-top: 1px solid #444;\r\n padding: 0px;\r\n }\r\n .navbar ul {\r\n float: none;\r\n }\r\n .navbar li {\r\n float: none;\r\n font-size: 15px;\r\n margin: 6px;\r\n }\r\n .navbar li a {\r\n padding: 10px 16px;\r\n border-radius: 4px;\r\n }\r\n .navbar a {\r\n /* If a menu item's text is too long, truncate it */\r\n width: 100%;\r\n white-space: nowrap;\r\n overflow: hidden;\r\n text-overflow: ellipsis;\r\n }\r\n}\r\n", ""]); -"use strict"; +// exports -var Observable_1 = __webpack_require__(0); -var shareReplay_1 = __webpack_require__(330); -Observable_1.Observable.prototype.shareReplay = shareReplay_1.shareReplay; -//# sourceMappingURL=shareReplay.js.map /***/ }), -/* 216 */ +/* 73 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -var Observable_1 = __webpack_require__(0); -var single_1 = __webpack_require__(331); -Observable_1.Observable.prototype.single = single_1.single; -//# sourceMappingURL=single.js.map +module.exports = CustomEvent; -/***/ }), -/* 217 */ -/***/ (function(module, exports, __webpack_require__) { +var Event = __webpack_require__(7); -"use strict"; +function CustomEvent(type, dictionary) { + // Just use the superclass constructor to initialize + Event.call(this, type, dictionary); +} +CustomEvent.prototype = Object.create(Event.prototype, { + constructor: { value: CustomEvent } +}); -var Observable_1 = __webpack_require__(0); -var skip_1 = __webpack_require__(332); -Observable_1.Observable.prototype.skip = skip_1.skip; -//# sourceMappingURL=skip.js.map /***/ }), -/* 218 */ +/* 74 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -var Observable_1 = __webpack_require__(0); -var skipLast_1 = __webpack_require__(333); -Observable_1.Observable.prototype.skipLast = skipLast_1.skipLast; -//# sourceMappingURL=skipLast.js.map +module.exports = FilteredElementList; -/***/ }), -/* 219 */ -/***/ (function(module, exports, __webpack_require__) { +var Node = __webpack_require__(3); -"use strict"; +// +// This file defines node list implementation that lazily traverses +// the document tree (or a subtree rooted at any element) and includes +// only those elements for which a specified filter function returns true. +// It is used to implement the +// {Document,Element}.getElementsBy{TagName,ClassName}{,NS} methods. +// -var Observable_1 = __webpack_require__(0); -var skipUntil_1 = __webpack_require__(334); -Observable_1.Observable.prototype.skipUntil = skipUntil_1.skipUntil; -//# sourceMappingURL=skipUntil.js.map +function FilteredElementList(root, filter) { + this.root = root; + this.filter = filter; + this.lastModTime = root.lastModTime; + this.done = false; + this.cache = []; + this.traverse(); +} -/***/ }), -/* 220 */ -/***/ (function(module, exports, __webpack_require__) { +FilteredElementList.prototype = { + get length() { + this.checkcache(); + if (!this.done) this.traverse(); + return this.cache.length; + }, -"use strict"; + item: function(n) { + this.checkcache(); + if (!this.done && n >= this.cache.length) this.traverse(n); + return this.cache[n]; + }, -var Observable_1 = __webpack_require__(0); -var skipWhile_1 = __webpack_require__(335); -Observable_1.Observable.prototype.skipWhile = skipWhile_1.skipWhile; -//# sourceMappingURL=skipWhile.js.map + checkcache: function() { + if (this.lastModTime !== this.root.lastModTime) { + // subtree has changed, so invalidate cache + for (var i = this.cache.length-1; i>=0; i--) { + this[i] = undefined; + } + this.cache.length = 0; + this.done = false; + this.lastModTime = this.root.lastModTime; + } + }, + + // If n is specified, then traverse the tree until we've found the nth + // item (or until we've found all items). If n is not specified, + // traverse until we've found all items. + traverse: function(n) { + // increment n so we can compare to length, and so it is never falsy + if (n !== undefined) n++; + + var elt; + while ((elt = this.next()) !== null) { + this[this.cache.length] = elt; //XXX Use proxy instead + this.cache.push(elt); + if (n && this.cache.length === n) return; + } + + // no next element, so we've found everything + this.done = true; + }, + + // Return the next element under root that matches filter + next: function() { + var start = (this.cache.length === 0) ? this.root // Start at the root or at + : this.cache[this.cache.length-1]; // the last element we found + + var elt; + if (start.nodeType === Node.DOCUMENT_NODE) + elt = start.documentElement; + else + elt = start.nextElement(this.root); -/***/ }), -/* 221 */ -/***/ (function(module, exports, __webpack_require__) { + while(elt) { + if (this.filter(elt)) { + return elt; + } -"use strict"; + elt = elt.nextElement(this.root); + } + return null; + } +}; -var Observable_1 = __webpack_require__(0); -var startWith_1 = __webpack_require__(336); -Observable_1.Observable.prototype.startWith = startWith_1.startWith; -//# sourceMappingURL=startWith.js.map /***/ }), -/* 222 */ +/* 75 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -var Observable_1 = __webpack_require__(0); -var subscribeOn_1 = __webpack_require__(337); -Observable_1.Observable.prototype.subscribeOn = subscribeOn_1.subscribeOn; -//# sourceMappingURL=subscribeOn.js.map +var URL = __webpack_require__(20); +var URLUtils = __webpack_require__(41); -/***/ }), -/* 223 */ -/***/ (function(module, exports, __webpack_require__) { +module.exports = Location; -"use strict"; +function Location(window, href) { + this._window = window; + this._href = href; +} -var Observable_1 = __webpack_require__(0); -var switch_1 = __webpack_require__(338); -Observable_1.Observable.prototype.switch = switch_1._switch; -Observable_1.Observable.prototype._switch = switch_1._switch; -//# sourceMappingURL=switch.js.map +Location.prototype = Object.create(URLUtils.prototype, { + constructor: { value: Location }, -/***/ }), -/* 224 */ -/***/ (function(module, exports, __webpack_require__) { + // Special behavior when href is set + href: { + get: function() { return this._href; }, + set: function(v) { this.assign(v); } + }, -"use strict"; + assign: { value: function(url) { + // Resolve the new url against the current one + // XXX: + // This is not actually correct. It should be resolved against + // the URL of the document of the script. For now, though, I only + // support a single window and there is only one base url. + // So this is good enough for now. + var current = new URL(this._href); + var newurl = current.resolve(url); -var Observable_1 = __webpack_require__(0); -var switchMap_1 = __webpack_require__(339); -Observable_1.Observable.prototype.switchMap = switchMap_1.switchMap; -//# sourceMappingURL=switchMap.js.map + // Save the new url + this._href = newurl; -/***/ }), -/* 225 */ -/***/ (function(module, exports, __webpack_require__) { + // Start loading the new document! + // XXX + // This is just something hacked together. + // The real algorithm is: http://www.whatwg.org/specs/web-apps/current-work/multipage/history.html#navigate + }}, -"use strict"; + replace: { value: function(url) { + // XXX + // Since we aren't tracking history yet, replace is the same as assign + this.assign(url); + }}, -var Observable_1 = __webpack_require__(0); -var switchMapTo_1 = __webpack_require__(340); -Observable_1.Observable.prototype.switchMapTo = switchMapTo_1.switchMapTo; -//# sourceMappingURL=switchMapTo.js.map + reload: { value: function() { + // XXX: + // Actually, the spec is a lot more complicated than this + this.assign(this.href); + }}, -/***/ }), -/* 226 */ -/***/ (function(module, exports, __webpack_require__) { + toString: { value: function() { + return this.href; + }} -"use strict"; +}); -var Observable_1 = __webpack_require__(0); -var take_1 = __webpack_require__(341); -Observable_1.Observable.prototype.take = take_1.take; -//# sourceMappingURL=take.js.map /***/ }), -/* 227 */ +/* 76 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -var Observable_1 = __webpack_require__(0); -var takeLast_1 = __webpack_require__(342); -Observable_1.Observable.prototype.takeLast = takeLast_1.takeLast; -//# sourceMappingURL=takeLast.js.map +module.exports = { + VALUE: 1, // The value of a Text, Comment or PI node changed + ATTR: 2, // A new attribute was added or an attribute value and/or prefix changed + REMOVE_ATTR: 3, // An attribute was removed + REMOVE: 4, // A node was removed + MOVE: 5, // A node was moved + INSERT: 6 // A node (or a subtree of nodes) was inserted +}; /***/ }), -/* 228 */ +/* 77 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -var Observable_1 = __webpack_require__(0); -var takeUntil_1 = __webpack_require__(343); -Observable_1.Observable.prototype.takeUntil = takeUntil_1.takeUntil; -//# sourceMappingURL=takeUntil.js.map -/***/ }), -/* 229 */ -/***/ (function(module, exports, __webpack_require__) { +// https://html.spec.whatwg.org/multipage/webappapis.html#navigatorid +var NavigatorID = Object.create(null, { + appCodeName: { value: "Mozilla" }, + appName: { value: "Netscape" }, + appVersion: { value: "4.0" }, + platform: { value: "" }, + product: { value: "Gecko" }, + productSub: { value: "20100101" }, + userAgent: { value: "" }, + vendor: { value: "" }, + vendorSub: { value: "" }, + taintEnabled: { value: function() { return false; } } +}); -"use strict"; +module.exports = NavigatorID; -var Observable_1 = __webpack_require__(0); -var takeWhile_1 = __webpack_require__(344); -Observable_1.Observable.prototype.takeWhile = takeWhile_1.takeWhile; -//# sourceMappingURL=takeWhile.js.map /***/ }), -/* 230 */ +/* 78 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -var Observable_1 = __webpack_require__(0); -var throttle_1 = __webpack_require__(65); -Observable_1.Observable.prototype.throttle = throttle_1.throttle; -//# sourceMappingURL=throttle.js.map +module.exports = NodeIterator; -/***/ }), -/* 231 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; +var NodeFilter = __webpack_require__(10); +var NodeTraversal = __webpack_require__(36); -var Observable_1 = __webpack_require__(0); -var throttleTime_1 = __webpack_require__(345); -Observable_1.Observable.prototype.throttleTime = throttleTime_1.throttleTime; -//# sourceMappingURL=throttleTime.js.map +/* Private methods and helpers */ -/***/ }), -/* 232 */ -/***/ (function(module, exports, __webpack_require__) { +/** + * @based on WebKit's NodeIterator::moveToNext and NodeIterator::moveToPrevious + * https://trac.webkit.org/browser/trunk/Source/WebCore/dom/NodeIterator.cpp?rev=186279#L51 + */ +function move(node, stayWithin, directionIsNext) { + if (directionIsNext) { + return NodeTraversal.next(node, stayWithin); + } else { + if (node === stayWithin) { + return null; + } + return NodeTraversal.previous(node, null); + } +} -"use strict"; +/** + * @spec http://www.w3.org/TR/dom/#concept-nodeiterator-traverse + * @method + * @access private + * @param {NodeIterator} ni + * @param {string} direction One of 'next' or 'previous'. + * @return {Node|null} + */ +function traverse(ni, directionIsNext) { + var node, beforeNode; + node = ni.referenceNode; + beforeNode = ni.pointerBeforeReferenceNode; + while (true) { + if (beforeNode === directionIsNext) { + beforeNode = !beforeNode; + } else { + node = move(node, ni.root, directionIsNext); + if (node === null) { + return null; + } + } + var result = ni.filter.acceptNode(node); + if (result === NodeFilter.FILTER_ACCEPT) { + break; + } + } + ni.referenceNode = node; + ni.pointerBeforeReferenceNode = beforeNode; + return node; +} -var Observable_1 = __webpack_require__(0); -var timeInterval_1 = __webpack_require__(66); -Observable_1.Observable.prototype.timeInterval = timeInterval_1.timeInterval; -//# sourceMappingURL=timeInterval.js.map +/* Public API */ -/***/ }), -/* 233 */ -/***/ (function(module, exports, __webpack_require__) { +/** + * Implemented version: http://www.w3.org/TR/2015/WD-dom-20150618/#nodeiterator + * Latest version: http://www.w3.org/TR/dom/#nodeiterator + * + * @constructor + * @param {Node} root + * @param {number} whatToShow [optional] + * @param {Function|NodeFilter} filter [optional] + * @throws Error + */ +function NodeIterator(root, whatToShow, filter) { + var ni = this, active = false; -"use strict"; + if (!root || !root.nodeType) { + throw new Error('DOMException: NOT_SUPPORTED_ERR'); + } -var Observable_1 = __webpack_require__(0); -var timeout_1 = __webpack_require__(346); -Observable_1.Observable.prototype.timeout = timeout_1.timeout; -//# sourceMappingURL=timeout.js.map + ni.root = ni.referenceNode = root; + ni.pointerBeforeReferenceNode = true; + ni.whatToShow = Number(whatToShow) || 0; -/***/ }), -/* 234 */ -/***/ (function(module, exports, __webpack_require__) { + if (typeof filter !== 'function') { + filter = null; + } -"use strict"; + ni.filter = Object.create(NodeFilter.prototype); -var Observable_1 = __webpack_require__(0); -var timeoutWith_1 = __webpack_require__(347); -Observable_1.Observable.prototype.timeoutWith = timeoutWith_1.timeoutWith; -//# sourceMappingURL=timeoutWith.js.map + /** + * @method + * @param {Node} node + * @return {Number} Constant NodeFilter.FILTER_ACCEPT, + * NodeFilter.FILTER_REJECT or NodeFilter.FILTER_SKIP. + */ + ni.filter.acceptNode = function (node) { + /* jshint bitwise: false */ + var result; + if (active) { + throw new Error('DOMException: INVALID_STATE_ERR'); + } -/***/ }), -/* 235 */ -/***/ (function(module, exports, __webpack_require__) { + // Maps nodeType to whatToShow + if (!(((1 << (node.nodeType - 1)) & ni.whatToShow))) { + return NodeFilter.FILTER_SKIP; + } -"use strict"; + if (filter === null) { + return NodeFilter.FILTER_ACCEPT; + } -var Observable_1 = __webpack_require__(0); -var timestamp_1 = __webpack_require__(67); -Observable_1.Observable.prototype.timestamp = timestamp_1.timestamp; -//# sourceMappingURL=timestamp.js.map + active = true; + result = filter(node); + active = false; -/***/ }), -/* 236 */ -/***/ (function(module, exports, __webpack_require__) { + return result; + }; +} -"use strict"; +NodeIterator.prototype = { + constructor: NodeIterator, -var Observable_1 = __webpack_require__(0); -var toArray_1 = __webpack_require__(348); -Observable_1.Observable.prototype.toArray = toArray_1.toArray; -//# sourceMappingURL=toArray.js.map + /** + * @spec http://www.w3.org/TR/dom/#dom-nodeiterator-nextnode + * @method + * @return {Node|null} + */ + nextNode: function () { + return traverse(this, true); + }, -/***/ }), -/* 237 */ -/***/ (function(module, exports, __webpack_require__) { + /** + * @spec http://www.w3.org/TR/dom/#dom-nodeiterator-previousnode + * @method + * @return {Node|null} + */ + previousNode: function () { + return traverse(this, false); + }, -"use strict"; + /** + * @spec http://www.w3.org/TR/dom/#dom-nodeiterator-detach + * @method + * @return void + */ + detach: function() { + /* "The detach() method must do nothing. + * Its functionality (disabling a NodeIterator object) was removed, + * but the method itself is preserved for compatibility. + */ + } +}; -var Observable_1 = __webpack_require__(0); -var toPromise_1 = __webpack_require__(68); -Observable_1.Observable.prototype.toPromise = toPromise_1.toPromise; -//# sourceMappingURL=toPromise.js.map /***/ }), -/* 238 */ +/* 79 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -var Observable_1 = __webpack_require__(0); -var window_1 = __webpack_require__(349); -Observable_1.Observable.prototype.window = window_1.window; -//# sourceMappingURL=window.js.map - -/***/ }), -/* 239 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; +module.exports = TreeWalker; -var Observable_1 = __webpack_require__(0); -var windowCount_1 = __webpack_require__(350); -Observable_1.Observable.prototype.windowCount = windowCount_1.windowCount; -//# sourceMappingURL=windowCount.js.map +var NodeFilter = __webpack_require__(10); +var NodeTraversal = __webpack_require__(36); -/***/ }), -/* 240 */ -/***/ (function(module, exports, __webpack_require__) { +var mapChild = { + first: 'firstChild', + last: 'lastChild', + next: 'firstChild', + previous: 'lastChild' +}; -"use strict"; +var mapSibling = { + first: 'nextSibling', + last: 'previousSibling', + next: 'nextSibling', + previous: 'previousSibling' +}; -var Observable_1 = __webpack_require__(0); -var windowTime_1 = __webpack_require__(351); -Observable_1.Observable.prototype.windowTime = windowTime_1.windowTime; -//# sourceMappingURL=windowTime.js.map +/* Private methods and helpers */ -/***/ }), -/* 241 */ -/***/ (function(module, exports, __webpack_require__) { +/** + * @spec http://www.w3.org/TR/dom/#concept-traverse-children + * @method + * @access private + * @param {TreeWalker} tw + * @param {string} type One of 'first' or 'last'. + * @return {Node|null} + */ +function traverseChildren(tw, type) { + var child, node, parent, result, sibling; + node = tw.currentNode[mapChild[type]]; + while (node !== null) { + result = tw.filter.acceptNode(node); + if (result === NodeFilter.FILTER_ACCEPT) { + tw.currentNode = node; + return node; + } + if (result === NodeFilter.FILTER_SKIP) { + child = node[mapChild[type]]; + if (child !== null) { + node = child; + continue; + } + } + while (node !== null) { + sibling = node[mapSibling[type]]; + if (sibling !== null) { + node = sibling; + break; + } + parent = node.parentNode; + if (parent === null || parent === tw.root || parent === tw.currentNode) { + return null; + } + else { + node = parent; + } + } + } + return null; +} -"use strict"; +/** + * @spec http://www.w3.org/TR/dom/#concept-traverse-siblings + * @method + * @access private + * @param {TreeWalker} tw + * @param {TreeWalker} type One of 'next' or 'previous'. + * @return {Node|nul} + */ +function traverseSiblings(tw, type) { + var node, result, sibling; + node = tw.currentNode; + if (node === tw.root) { + return null; + } + while (true) { + sibling = node[mapSibling[type]]; + while (sibling !== null) { + node = sibling; + result = tw.filter.acceptNode(node); + if (result === NodeFilter.FILTER_ACCEPT) { + tw.currentNode = node; + return node; + } + sibling = node[mapChild[type]]; + if (result === NodeFilter.FILTER_REJECT || sibling === null) { + sibling = node[mapSibling[type]]; + } + } + node = node.parentNode; + if (node === null || node === tw.root) { + return null; + } + if (tw.filter.acceptNode(node) === NodeFilter.FILTER_ACCEPT) { + return null; + } + } +} -var Observable_1 = __webpack_require__(0); -var windowToggle_1 = __webpack_require__(352); -Observable_1.Observable.prototype.windowToggle = windowToggle_1.windowToggle; -//# sourceMappingURL=windowToggle.js.map -/***/ }), -/* 242 */ -/***/ (function(module, exports, __webpack_require__) { +/* Public API */ -"use strict"; +/** + * Implemented version: http://www.w3.org/TR/2015/WD-dom-20150618/#interface-treewalker + * Latest version: http://www.w3.org/TR/dom/#interface-treewalker + * + * @constructor + * @param {Node} root + * @param {number} whatToShow [optional] + * @param {Function|NodeFilter} filter [optional] + * @throws Error + */ +function TreeWalker(root, whatToShow, filter) { + var tw = this, active = false; -var Observable_1 = __webpack_require__(0); -var windowWhen_1 = __webpack_require__(353); -Observable_1.Observable.prototype.windowWhen = windowWhen_1.windowWhen; -//# sourceMappingURL=windowWhen.js.map + if (!root || !root.nodeType) { + throw new Error('DOMException: NOT_SUPPORTED_ERR'); + } -/***/ }), -/* 243 */ -/***/ (function(module, exports, __webpack_require__) { + tw.root = root; + tw.whatToShow = Number(whatToShow) || 0; -"use strict"; + tw.currentNode = root; -var Observable_1 = __webpack_require__(0); -var withLatestFrom_1 = __webpack_require__(354); -Observable_1.Observable.prototype.withLatestFrom = withLatestFrom_1.withLatestFrom; -//# sourceMappingURL=withLatestFrom.js.map + if (typeof filter !== 'function') { + filter = null; + } -/***/ }), -/* 244 */ -/***/ (function(module, exports, __webpack_require__) { + tw.filter = Object.create(NodeFilter.prototype); -"use strict"; + /** + * @method + * @param {Node} node + * @return {Number} Constant NodeFilter.FILTER_ACCEPT, + * NodeFilter.FILTER_REJECT or NodeFilter.FILTER_SKIP. + */ + tw.filter.acceptNode = function (node) { + /* jshint bitwise: false */ + var result; + if (active) { + throw new Error('DOMException: INVALID_STATE_ERR'); + } -var Observable_1 = __webpack_require__(0); -var zip_1 = __webpack_require__(39); -Observable_1.Observable.prototype.zip = zip_1.zipProto; -//# sourceMappingURL=zip.js.map + // Maps nodeType to whatToShow + if (!(((1 << (node.nodeType - 1)) & tw.whatToShow))) { + return NodeFilter.FILTER_SKIP; + } -/***/ }), -/* 245 */ -/***/ (function(module, exports, __webpack_require__) { + if (filter === null) { + return NodeFilter.FILTER_ACCEPT; + } -"use strict"; + active = true; + result = filter(node); + active = false; -var Observable_1 = __webpack_require__(0); -var zipAll_1 = __webpack_require__(355); -Observable_1.Observable.prototype.zipAll = zipAll_1.zipAll; -//# sourceMappingURL=zipAll.js.map + return result; + }; +} -/***/ }), -/* 246 */ -/***/ (function(module, exports, __webpack_require__) { +TreeWalker.prototype = { -"use strict"; + constructor: TreeWalker, -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; -var Observable_1 = __webpack_require__(0); -var tryCatch_1 = __webpack_require__(7); -var errorObject_1 = __webpack_require__(5); -var AsyncSubject_1 = __webpack_require__(25); -/** - * We need this JSDoc comment for affecting ESDoc. - * @extends {Ignored} - * @hide true - */ -var BoundCallbackObservable = (function (_super) { - __extends(BoundCallbackObservable, _super); - function BoundCallbackObservable(callbackFunc, selector, args, context, scheduler) { - _super.call(this); - this.callbackFunc = callbackFunc; - this.selector = selector; - this.args = args; - this.context = context; - this.scheduler = scheduler; + /** + * @spec http://www.w3.org/TR/dom/#dom-treewalker-parentnode + * @method + * @return {Node|null} + */ + parentNode: function () { + var node = this.currentNode; + while (node !== null && node !== this.root) { + node = node.parentNode; + if (node !== null && this.filter.acceptNode(node) === NodeFilter.FILTER_ACCEPT) { + this.currentNode = node; + return node; + } } - /* tslint:enable:max-line-length */ - /** - * Converts a callback API to a function that returns an Observable. - * - * Give it a function `f` of type `f(x, callback)` and - * it will return a function `g` that when called as `g(x)` will output an - * Observable. - * - * `bindCallback` is not an operator because its input and output are not - * Observables. The input is a function `func` with some parameters, but the - * last parameter must be a callback function that `func` calls when it is - * done. - * - * The output of `bindCallback` is a function that takes the same parameters - * as `func`, except the last one (the callback). When the output function - * is called with arguments, it will return an Observable. If `func` function - * calls its callback with one argument, the Observable will emit that value. - * If on the other hand callback is called with multiple values, resulting - * Observable will emit an array with these arguments. - * - * It is very important to remember, that input function `func` is not called - * when output function is, but rather when Observable returned by output - * function is subscribed. This means if `func` makes AJAX request, that request - * will be made every time someone subscribes to resulting Observable, but not before. - * - * Optionally, selector function can be passed to `bindObservable`. That function - * takes the same arguments as callback, and returns value - * that will be emitted by Observable instead of callback parameters themselves. - * Even though by default multiple arguments passed to callback appear in the stream as array, - * selector function will be called with arguments directly, just as callback would. - * This means you can imagine default selector (when one is not provided explicitly) - * as function that aggregates all its arguments into array, or simply returns first argument, - * if there is only one. - * - * Last optional parameter - {@link Scheduler} - can be used to control when call - * to `func` happens after someone subscribes to Observable, as well as when results - * passed to callback will be emitted. By default subscription to Observable calls `func` - * synchronously, but using `Scheduler.async` as last parameter will defer call to input function, - * just like wrapping that call in `setTimeout` with time `0` would. So if you use async Scheduler - * and call `subscribe` on output Observable, all function calls that are currently executing, - * will end before `func` is invoked. - * - * When it comes to emitting results passed to callback, by default they are emitted - * immediately after `func` invokes callback. In particular, if callback is called synchronously, - * then subscription to resulting Observable will call `next` function synchronously as well. - * If you want to defer that call, using `Scheduler.async` will, again, do the job. - * This means that by using `Scheduler.async` you can, in a sense, ensure that `func` - * always calls its callback asynchronously, thus avoiding terrifying Zalgo. - * - * Note that Observable created by output function will always emit only one value - * and then complete right after. Even if `func` calls callback multiple times, values from - * second and following calls will never appear in the stream. If you need to - * listen for multiple calls, you probably want to use {@link fromEvent} or - * {@link fromEventPattern} instead. - * - * If `func` depends on some context (`this` property), that context will be set - * to the same context that output function has at call time. In particular, if `func` - * is called as method of some object, in order to preserve proper behaviour, - * it is recommended to set context of output function to that object as well, - * provided `func` is not already bound. - * - * If input function calls its callback in "node style" (i.e. first argument to callback is - * optional error parameter signaling whether call failed or not), {@link bindNodeCallback} - * provides convenient error handling and probably is a better choice. - * `bindCallback` will treat such functions without any difference and error parameter - * (whether passed or not) will always be interpreted as regular callback argument. - * - * - * @example Convert jQuery's getJSON to an Observable API - * // Suppose we have jQuery.getJSON('/my/url', callback) - * var getJSONAsObservable = Rx.Observable.bindCallback(jQuery.getJSON); - * var result = getJSONAsObservable('/my/url'); - * result.subscribe(x => console.log(x), e => console.error(e)); - * - * - * @example Receive array of arguments passed to callback - * someFunction((a, b, c) => { - * console.log(a); // 5 - * console.log(b); // 'some string' - * console.log(c); // {someProperty: 'someValue'} - * }); - * - * const boundSomeFunction = Rx.Observable.bindCallback(someFunction); - * boundSomeFunction().subscribe(values => { - * console.log(values) // [5, 'some string', {someProperty: 'someValue'}] - * }); - * - * - * @example Use bindCallback with selector function - * someFunction((a, b, c) => { - * console.log(a); // 'a' - * console.log(b); // 'b' - * console.log(c); // 'c' - * }); - * - * const boundSomeFunction = Rx.Observable.bindCallback(someFunction, (a, b, c) => a + b + c); - * boundSomeFunction().subscribe(value => { - * console.log(value) // 'abc' - * }); - * - * - * @example Compare behaviour with and without async Scheduler - * function iCallMyCallbackSynchronously(cb) { - * cb(); - * } - * - * const boundSyncFn = Rx.Observable.bindCallback(iCallMyCallbackSynchronously); - * const boundAsyncFn = Rx.Observable.bindCallback(iCallMyCallbackSynchronously, null, Rx.Scheduler.async); - * - * boundSyncFn().subscribe(() => console.log('I was sync!')); - * boundAsyncFn().subscribe(() => console.log('I was async!')); - * console.log('This happened...'); - * - * // Logs: - * // I was sync! - * // This happened... - * // I was async! - * - * - * @example Use bindCallback on object method - * const boundMethod = Rx.Observable.bindCallback(someObject.methodWithCallback); - * boundMethod.call(someObject) // make sure methodWithCallback has access to someObject - * .subscribe(subscriber); - * - * - * @see {@link bindNodeCallback} - * @see {@link from} - * @see {@link fromPromise} - * - * @param {function} func Function with a callback as the last parameter. - * @param {function} [selector] A function which takes the arguments from the - * callback and maps those to a value to emit on the output Observable. - * @param {Scheduler} [scheduler] The scheduler on which to schedule the - * callbacks. - * @return {function(...params: *): Observable} A function which returns the - * Observable that delivers the same values the callback would deliver. - * @static true - * @name bindCallback - * @owner Observable - */ - BoundCallbackObservable.create = function (func, selector, scheduler) { - if (selector === void 0) { selector = undefined; } - return function () { - var args = []; - for (var _i = 0; _i < arguments.length; _i++) { - args[_i - 0] = arguments[_i]; - } - return new BoundCallbackObservable(func, selector, args, this, scheduler); - }; - }; - BoundCallbackObservable.prototype._subscribe = function (subscriber) { - var callbackFunc = this.callbackFunc; - var args = this.args; - var scheduler = this.scheduler; - var subject = this.subject; - if (!scheduler) { - if (!subject) { - subject = this.subject = new AsyncSubject_1.AsyncSubject(); - var handler = function handlerFn() { - var innerArgs = []; - for (var _i = 0; _i < arguments.length; _i++) { - innerArgs[_i - 0] = arguments[_i]; - } - var source = handlerFn.source; - var selector = source.selector, subject = source.subject; - if (selector) { - var result_1 = tryCatch_1.tryCatch(selector).apply(this, innerArgs); - if (result_1 === errorObject_1.errorObject) { - subject.error(errorObject_1.errorObject.e); - } - else { - subject.next(result_1); - subject.complete(); - } - } - else { - subject.next(innerArgs.length <= 1 ? innerArgs[0] : innerArgs); - subject.complete(); - } - }; - // use named function instance to avoid closure. - handler.source = this; - var result = tryCatch_1.tryCatch(callbackFunc).apply(this.context, args.concat(handler)); - if (result === errorObject_1.errorObject) { - subject.error(errorObject_1.errorObject.e); - } - } - return subject.subscribe(subscriber); - } - else { - return scheduler.schedule(BoundCallbackObservable.dispatch, 0, { source: this, subscriber: subscriber, context: this.context }); - } - }; - BoundCallbackObservable.dispatch = function (state) { - var self = this; - var source = state.source, subscriber = state.subscriber, context = state.context; - var callbackFunc = source.callbackFunc, args = source.args, scheduler = source.scheduler; - var subject = source.subject; - if (!subject) { - subject = source.subject = new AsyncSubject_1.AsyncSubject(); - var handler = function handlerFn() { - var innerArgs = []; - for (var _i = 0; _i < arguments.length; _i++) { - innerArgs[_i - 0] = arguments[_i]; - } - var source = handlerFn.source; - var selector = source.selector, subject = source.subject; - if (selector) { - var result_2 = tryCatch_1.tryCatch(selector).apply(this, innerArgs); - if (result_2 === errorObject_1.errorObject) { - self.add(scheduler.schedule(dispatchError, 0, { err: errorObject_1.errorObject.e, subject: subject })); - } - else { - self.add(scheduler.schedule(dispatchNext, 0, { value: result_2, subject: subject })); - } - } - else { - var value = innerArgs.length <= 1 ? innerArgs[0] : innerArgs; - self.add(scheduler.schedule(dispatchNext, 0, { value: value, subject: subject })); - } - }; - // use named function to pass values in without closure - handler.source = source; - var result = tryCatch_1.tryCatch(callbackFunc).apply(context, args.concat(handler)); - if (result === errorObject_1.errorObject) { - subject.error(errorObject_1.errorObject.e); - } - } - self.add(subject.subscribe(subscriber)); - }; - return BoundCallbackObservable; -}(Observable_1.Observable)); -exports.BoundCallbackObservable = BoundCallbackObservable; -function dispatchNext(arg) { - var value = arg.value, subject = arg.subject; - subject.next(value); - subject.complete(); -} -function dispatchError(arg) { - var err = arg.err, subject = arg.subject; - subject.error(err); -} -//# sourceMappingURL=BoundCallbackObservable.js.map + return null; + }, + + /** + * @spec http://www.w3.org/TR/dom/#dom-treewalker-firstchild + * @method + * @return {Node|null} + */ + firstChild: function () { + return traverseChildren(this, 'first'); + }, + + /** + * @spec http://www.w3.org/TR/dom/#dom-treewalker-lastchild + * @method + * @return {Node|null} + */ + lastChild: function () { + return traverseChildren(this, 'last'); + }, + + /** + * @spec http://www.w3.org/TR/dom/#dom-treewalker-previoussibling + * @method + * @return {Node|null} + */ + previousSibling: function () { + return traverseSiblings(this, 'previous'); + }, + + /** + * @spec http://www.w3.org/TR/dom/#dom-treewalker-nextsibling + * @method + * @return {Node|null} + */ + nextSibling: function () { + return traverseSiblings(this, 'next'); + }, + + /** + * @spec http://www.w3.org/TR/dom/#dom-treewalker-previousnode + * @method + * @return {Node|null} + */ + previousNode: function () { + var node, result, sibling; + node = this.currentNode; + while (node !== this.root) { + sibling = node.previousSibling; + while (sibling !== null) { + node = sibling; + result = this.filter.acceptNode(node); + while (result !== NodeFilter.FILTER_REJECT && node.lastChild !== null) { + node = node.lastChild; + result = this.filter.acceptNode(node); + } + if (result === NodeFilter.FILTER_ACCEPT) { + this.currentNode = node; + return node; + } + sibling = node.previousSibling; + } + if (node === this.root || node.parentNode === null) { + return null; + } + node = node.parentNode; + if (this.filter.acceptNode(node) === NodeFilter.FILTER_ACCEPT) { + this.currentNode = node; + return node; + } + } + return null; + }, + + /** + * @spec http://www.w3.org/TR/dom/#dom-treewalker-nextnode + * @based on WebKit's TreeWalker::nextNode + * https://trac.webkit.org/browser/trunk/Source/WebCore/dom/TreeWalker.cpp?rev=179143#L252 + * @method + * @return {Node|null} + */ + nextNode: function () { + var node, result, following; + node = this.currentNode; + result = NodeFilter.FILTER_ACCEPT; + + while (true) { + while (result !== NodeFilter.FILTER_REJECT && node.firstChild !== null) { + node = node.firstChild; + result = this.filter.acceptNode(node); + if (result === NodeFilter.FILTER_ACCEPT) { + this.currentNode = node; + return node; + } + } + following = NodeTraversal.nextSkippingChildren(node, this.root); + if (following !== null) { + node = following; + } + else { + return null; + } + result = this.filter.acceptNode(node); + if (result === NodeFilter.FILTER_ACCEPT) { + this.currentNode = node; + return node; + } + } + } +}; + /***/ }), -/* 247 */ +/* 80 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + +// https://html.spec.whatwg.org/multipage/webappapis.html#windowtimers +var WindowTimers = { + setTimeout: setTimeout, + clearTimeout: clearTimeout, + setInterval: setInterval, + clearInterval: clearInterval }; -var Observable_1 = __webpack_require__(0); -var tryCatch_1 = __webpack_require__(7); -var errorObject_1 = __webpack_require__(5); -var AsyncSubject_1 = __webpack_require__(25); -/** - * We need this JSDoc comment for affecting ESDoc. - * @extends {Ignored} - * @hide true - */ -var BoundNodeCallbackObservable = (function (_super) { - __extends(BoundNodeCallbackObservable, _super); - function BoundNodeCallbackObservable(callbackFunc, selector, args, context, scheduler) { - _super.call(this); - this.callbackFunc = callbackFunc; - this.selector = selector; - this.args = args; - this.context = context; - this.scheduler = scheduler; - } - /* tslint:enable:max-line-length */ - /** - * Converts a Node.js-style callback API to a function that returns an - * Observable. - * - * It's just like {@link bindCallback}, but the - * callback is expected to be of type `callback(error, result)`. - * - * `bindNodeCallback` is not an operator because its input and output are not - * Observables. The input is a function `func` with some parameters, but the - * last parameter must be a callback function that `func` calls when it is - * done. The callback function is expected to follow Node.js conventions, - * where the first argument to the callback is an error object, signaling - * whether call was successful. If that object is passed to callback, it means - * something went wrong. - * - * The output of `bindNodeCallback` is a function that takes the same - * parameters as `func`, except the last one (the callback). When the output - * function is called with arguments, it will return an Observable. - * If `func` calls its callback with error parameter present, Observable will - * error with that value as well. If error parameter is not passed, Observable will emit - * second parameter. If there are more parameters (third and so on), - * Observable will emit an array with all arguments, except first error argument. - * - * Optionally `bindNodeCallback` accepts selector function, which allows you to - * make resulting Observable emit value computed by selector, instead of regular - * callback arguments. It works similarly to {@link bindCallback} selector, but - * Node.js-style error argument will never be passed to that function. - * - * Note that `func` will not be called at the same time output function is, - * but rather whenever resulting Observable is subscribed. By default call to - * `func` will happen synchronously after subscription, but that can be changed - * with proper {@link Scheduler} provided as optional third parameter. Scheduler - * can also control when values from callback will be emitted by Observable. - * To find out more, check out documentation for {@link bindCallback}, where - * Scheduler works exactly the same. - * - * As in {@link bindCallback}, context (`this` property) of input function will be set to context - * of returned function, when it is called. - * - * After Observable emits value, it will complete immediately. This means - * even if `func` calls callback again, values from second and consecutive - * calls will never appear on the stream. If you need to handle functions - * that call callbacks multiple times, check out {@link fromEvent} or - * {@link fromEventPattern} instead. - * - * Note that `bindNodeCallback` can be used in non-Node.js environments as well. - * "Node.js-style" callbacks are just a convention, so if you write for - * browsers or any other environment and API you use implements that callback style, - * `bindNodeCallback` can be safely used on that API functions as well. - * - * Remember that Error object passed to callback does not have to be an instance - * of JavaScript built-in `Error` object. In fact, it does not even have to an object. - * Error parameter of callback function is interpreted as "present", when value - * of that parameter is truthy. It could be, for example, non-zero number, non-empty - * string or boolean `true`. In all of these cases resulting Observable would error - * with that value. This means usually regular style callbacks will fail very often when - * `bindNodeCallback` is used. If your Observable errors much more often then you - * would expect, check if callback really is called in Node.js-style and, if not, - * switch to {@link bindCallback} instead. - * - * Note that even if error parameter is technically present in callback, but its value - * is falsy, it still won't appear in array emitted by Observable or in selector function. - * - * - * @example Read a file from the filesystem and get the data as an Observable - * import * as fs from 'fs'; - * var readFileAsObservable = Rx.Observable.bindNodeCallback(fs.readFile); - * var result = readFileAsObservable('./roadNames.txt', 'utf8'); - * result.subscribe(x => console.log(x), e => console.error(e)); - * - * - * @example Use on function calling callback with multiple arguments - * someFunction((err, a, b) => { - * console.log(err); // null - * console.log(a); // 5 - * console.log(b); // "some string" - * }); - * var boundSomeFunction = Rx.Observable.bindNodeCallback(someFunction); - * boundSomeFunction() - * .subscribe(value => { - * console.log(value); // [5, "some string"] - * }); - * - * - * @example Use with selector function - * someFunction((err, a, b) => { - * console.log(err); // undefined - * console.log(a); // "abc" - * console.log(b); // "DEF" - * }); - * var boundSomeFunction = Rx.Observable.bindNodeCallback(someFunction, (a, b) => a + b); - * boundSomeFunction() - * .subscribe(value => { - * console.log(value); // "abcDEF" - * }); - * - * - * @example Use on function calling callback in regular style - * someFunction(a => { - * console.log(a); // 5 - * }); - * var boundSomeFunction = Rx.Observable.bindNodeCallback(someFunction); - * boundSomeFunction() - * .subscribe( - * value => {} // never gets called - * err => console.log(err) // 5 - *); - * - * - * @see {@link bindCallback} - * @see {@link from} - * @see {@link fromPromise} - * - * @param {function} func Function with a Node.js-style callback as the last parameter. - * @param {function} [selector] A function which takes the arguments from the - * callback and maps those to a value to emit on the output Observable. - * @param {Scheduler} [scheduler] The scheduler on which to schedule the - * callbacks. - * @return {function(...params: *): Observable} A function which returns the - * Observable that delivers the same values the Node.js callback would - * deliver. - * @static true - * @name bindNodeCallback - * @owner Observable - */ - BoundNodeCallbackObservable.create = function (func, selector, scheduler) { - if (selector === void 0) { selector = undefined; } - return function () { - var args = []; - for (var _i = 0; _i < arguments.length; _i++) { - args[_i - 0] = arguments[_i]; - } - return new BoundNodeCallbackObservable(func, selector, args, this, scheduler); - }; - }; - BoundNodeCallbackObservable.prototype._subscribe = function (subscriber) { - var callbackFunc = this.callbackFunc; - var args = this.args; - var scheduler = this.scheduler; - var subject = this.subject; - if (!scheduler) { - if (!subject) { - subject = this.subject = new AsyncSubject_1.AsyncSubject(); - var handler = function handlerFn() { - var innerArgs = []; - for (var _i = 0; _i < arguments.length; _i++) { - innerArgs[_i - 0] = arguments[_i]; - } - var source = handlerFn.source; - var selector = source.selector, subject = source.subject; - var err = innerArgs.shift(); - if (err) { - subject.error(err); - } - else if (selector) { - var result_1 = tryCatch_1.tryCatch(selector).apply(this, innerArgs); - if (result_1 === errorObject_1.errorObject) { - subject.error(errorObject_1.errorObject.e); - } - else { - subject.next(result_1); - subject.complete(); - } - } - else { - subject.next(innerArgs.length <= 1 ? innerArgs[0] : innerArgs); - subject.complete(); - } - }; - // use named function instance to avoid closure. - handler.source = this; - var result = tryCatch_1.tryCatch(callbackFunc).apply(this.context, args.concat(handler)); - if (result === errorObject_1.errorObject) { - subject.error(errorObject_1.errorObject.e); - } - } - return subject.subscribe(subscriber); - } - else { - return scheduler.schedule(dispatch, 0, { source: this, subscriber: subscriber, context: this.context }); - } - }; - return BoundNodeCallbackObservable; -}(Observable_1.Observable)); -exports.BoundNodeCallbackObservable = BoundNodeCallbackObservable; -function dispatch(state) { - var self = this; - var source = state.source, subscriber = state.subscriber, context = state.context; - // XXX: cast to `any` to access to the private field in `source`. - var _a = source, callbackFunc = _a.callbackFunc, args = _a.args, scheduler = _a.scheduler; - var subject = source.subject; - if (!subject) { - subject = source.subject = new AsyncSubject_1.AsyncSubject(); - var handler = function handlerFn() { - var innerArgs = []; - for (var _i = 0; _i < arguments.length; _i++) { - innerArgs[_i - 0] = arguments[_i]; - } - var source = handlerFn.source; - var selector = source.selector, subject = source.subject; - var err = innerArgs.shift(); - if (err) { - self.add(scheduler.schedule(dispatchError, 0, { err: err, subject: subject })); - } - else if (selector) { - var result_2 = tryCatch_1.tryCatch(selector).apply(this, innerArgs); - if (result_2 === errorObject_1.errorObject) { - self.add(scheduler.schedule(dispatchError, 0, { err: errorObject_1.errorObject.e, subject: subject })); - } - else { - self.add(scheduler.schedule(dispatchNext, 0, { value: result_2, subject: subject })); - } - } - else { - var value = innerArgs.length <= 1 ? innerArgs[0] : innerArgs; - self.add(scheduler.schedule(dispatchNext, 0, { value: value, subject: subject })); - } - }; - // use named function to pass values in without closure - handler.source = source; - var result = tryCatch_1.tryCatch(callbackFunc).apply(context, args.concat(handler)); - if (result === errorObject_1.errorObject) { - self.add(scheduler.schedule(dispatchError, 0, { err: errorObject_1.errorObject.e, subject: subject })); - } - } - self.add(subject.subscribe(subscriber)); -} -function dispatchNext(arg) { - var value = arg.value, subject = arg.subject; - subject.next(value); - subject.complete(); -} -function dispatchError(arg) { - var err = arg.err, subject = arg.subject; - subject.error(err); -} -//# sourceMappingURL=BoundNodeCallbackObservable.js.map + +module.exports = WindowTimers; + /***/ }), -/* 248 */ +/* 81 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; +/* jshint node:true, latedef:false */ + // jshint ignore:line +/*! +Parser-Lib +Copyright (c) 2009-2011 Nicholas C. Zakas. All rights reserved. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. + +*/ +/* Version v0.2.5+domino1, Build time: 30-January-2016 05:13:03 */ +var parserlib = Object.create(null); +(function(){ -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; -var Observable_1 = __webpack_require__(0); -var subscribeToResult_1 = __webpack_require__(3); -var OuterSubscriber_1 = __webpack_require__(4); /** - * We need this JSDoc comment for affecting ESDoc. - * @extends {Ignored} - * @hide true + * A generic base to inherit from for any object + * that needs event handling. + * @class EventTarget + * @constructor */ -var DeferObservable = (function (_super) { - __extends(DeferObservable, _super); - function DeferObservable(observableFactory) { - _super.call(this); - this.observableFactory = observableFactory; - } +function EventTarget(){ + /** - * Creates an Observable that, on subscribe, calls an Observable factory to - * make an Observable for each new Observer. - * - * Creates the Observable lazily, that is, only when it - * is subscribed. - * - * - * - * - * `defer` allows you to create the Observable only when the Observer - * subscribes, and create a fresh Observable for each Observer. It waits until - * an Observer subscribes to it, and then it generates an Observable, - * typically with an Observable factory function. It does this afresh for each - * subscriber, so although each subscriber may think it is subscribing to the - * same Observable, in fact each subscriber gets its own individual - * Observable. - * - * @example Subscribe to either an Observable of clicks or an Observable of interval, at random - * var clicksOrInterval = Rx.Observable.defer(function () { - * if (Math.random() > 0.5) { - * return Rx.Observable.fromEvent(document, 'click'); - * } else { - * return Rx.Observable.interval(1000); - * } - * }); - * clicksOrInterval.subscribe(x => console.log(x)); - * - * // Results in the following behavior: - * // If the result of Math.random() is greater than 0.5 it will listen - * // for clicks anywhere on the "document"; when document is clicked it - * // will log a MouseEvent object to the console. If the result is less - * // than 0.5 it will emit ascending numbers, one every second(1000ms). - * - * @see {@link create} - * - * @param {function(): SubscribableOrPromise} observableFactory The Observable - * factory function to invoke for each Observer that subscribes to the output - * Observable. May also return a Promise, which will be converted on the fly - * to an Observable. - * @return {Observable} An Observable whose Observers' subscriptions trigger - * an invocation of the given Observable factory function. - * @static true - * @name defer - * @owner Observable + * The array of listeners for various events. + * @type Object + * @property _listeners + * @private */ - DeferObservable.create = function (observableFactory) { - return new DeferObservable(observableFactory); - }; - DeferObservable.prototype._subscribe = function (subscriber) { - return new DeferSubscriber(subscriber, this.observableFactory); - }; - return DeferObservable; -}(Observable_1.Observable)); -exports.DeferObservable = DeferObservable; -var DeferSubscriber = (function (_super) { - __extends(DeferSubscriber, _super); - function DeferSubscriber(destination, factory) { - _super.call(this, destination); - this.factory = factory; - this.tryDefer(); - } - DeferSubscriber.prototype.tryDefer = function () { - try { - this._callFactory(); + this._listeners = Object.create(null); +} + +EventTarget.prototype = { + + //restore constructor + constructor: EventTarget, + + /** + * Adds a listener for a given event type. + * @param {String} type The type of event to add a listener for. + * @param {Function} listener The function to call when the event occurs. + * @return {void} + * @method addListener + */ + addListener: function(type, listener){ + if (!this._listeners[type]){ + this._listeners[type] = []; + } + + this._listeners[type].push(listener); + }, + + /** + * Fires an event based on the passed-in object. + * @param {Object|String} event An object with at least a 'type' attribute + * or a string indicating the event name. + * @return {void} + * @method fire + */ + fire: function(event){ + if (typeof event === "string"){ + event = { type: event }; } - catch (err) { - this._error(err); + if (typeof event.target !== "undefined"){ + event.target = this; } - }; - DeferSubscriber.prototype._callFactory = function () { - var result = this.factory(); - if (result) { - this.add(subscribeToResult_1.subscribeToResult(this, result)); + + if (typeof event.type === "undefined"){ + throw new Error("Event object missing 'type' property."); } - }; - return DeferSubscriber; -}(OuterSubscriber_1.OuterSubscriber)); -//# sourceMappingURL=DeferObservable.js.map -/***/ }), -/* 249 */ -/***/ (function(module, exports, __webpack_require__) { + if (this._listeners[event.type]){ -"use strict"; + //create a copy of the array and use that so listeners can't chane + var listeners = this._listeners[event.type].concat(); + for (var i=0, len=listeners.length; i < len; i++){ + listeners[i].call(this, event); + } + } + }, -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + /** + * Removes a listener for a given event type. + * @param {String} type The type of event to remove a listener from. + * @param {Function} listener The function to remove from the event. + * @return {void} + * @method removeListener + */ + removeListener: function(type, listener){ + if (this._listeners[type]){ + var listeners = this._listeners[type]; + for (var i=0, len=listeners.length; i < len; i++){ + if (listeners[i] === listener){ + listeners.splice(i, 1); + break; + } + } + + + } + } }; -var Observable_1 = __webpack_require__(0); /** - * We need this JSDoc comment for affecting ESDoc. - * @extends {Ignored} - * @hide true + * Convenient way to read through strings. + * @namespace parserlib.util + * @class StringReader + * @constructor + * @param {String} text The text to read. */ -var ErrorObservable = (function (_super) { - __extends(ErrorObservable, _super); - function ErrorObservable(error, scheduler) { - _super.call(this); - this.error = error; - this.scheduler = scheduler; - } +function StringReader(text){ + /** - * Creates an Observable that emits no items to the Observer and immediately - * emits an error notification. - * - * Just emits 'error', and nothing else. - * - * - * - * - * This static operator is useful for creating a simple Observable that only - * emits the error notification. It can be used for composing with other - * Observables, such as in a {@link mergeMap}. - * - * @example Emit the number 7, then emit an error. - * var result = Rx.Observable.throw(new Error('oops!')).startWith(7); - * result.subscribe(x => console.log(x), e => console.error(e)); - * - * @example Map and flatten numbers to the sequence 'a', 'b', 'c', but throw an error for 13 - * var interval = Rx.Observable.interval(1000); - * var result = interval.mergeMap(x => - * x === 13 ? - * Rx.Observable.throw('Thirteens are bad') : - * Rx.Observable.of('a', 'b', 'c') - * ); - * result.subscribe(x => console.log(x), e => console.error(e)); - * - * @see {@link create} - * @see {@link empty} - * @see {@link never} - * @see {@link of} - * - * @param {any} error The particular Error to pass to the error notification. - * @param {Scheduler} [scheduler] A {@link IScheduler} to use for scheduling - * the emission of the error notification. - * @return {Observable} An error Observable: emits only the error notification - * using the given error argument. - * @static true - * @name throw - * @owner Observable + * The input text with line endings normalized. + * @property _input + * @type String + * @private */ - ErrorObservable.create = function (error, scheduler) { - return new ErrorObservable(error, scheduler); - }; - ErrorObservable.dispatch = function (arg) { - var error = arg.error, subscriber = arg.subscriber; - subscriber.error(error); - }; - ErrorObservable.prototype._subscribe = function (subscriber) { - var error = this.error; - var scheduler = this.scheduler; - subscriber.syncErrorThrowable = true; - if (scheduler) { - return scheduler.schedule(ErrorObservable.dispatch, 0, { - error: error, subscriber: subscriber - }); - } - else { - subscriber.error(error); - } - }; - return ErrorObservable; -}(Observable_1.Observable)); -exports.ErrorObservable = ErrorObservable; -//# sourceMappingURL=ErrorObservable.js.map + this._input = text.replace(/(\r|\n){1,2}/g, "\n"); -/***/ }), -/* 250 */ -/***/ (function(module, exports, __webpack_require__) { -"use strict"; + /** + * The row for the character to be read next. + * @property _line + * @type int + * @private + */ + this._line = 1; + + + /** + * The column for the character to be read next. + * @property _col + * @type int + * @private + */ + this._col = 1; + + /** + * The index of the character in the input to be read next. + * @property _cursor + * @type int + * @private + */ + this._cursor = 0; +} + +StringReader.prototype = { + + //restore constructor + constructor: StringReader, + + //------------------------------------------------------------------------- + // Position info + //------------------------------------------------------------------------- + + /** + * Returns the column of the character to be read next. + * @return {int} The column of the character to be read next. + * @method getCol + */ + getCol: function(){ + return this._col; + }, + + /** + * Returns the row of the character to be read next. + * @return {int} The row of the character to be read next. + * @method getLine + */ + getLine: function(){ + return this._line ; + }, + + /** + * Determines if you're at the end of the input. + * @return {Boolean} True if there's no more input, false otherwise. + * @method eof + */ + eof: function(){ + return (this._cursor === this._input.length); + }, + + //------------------------------------------------------------------------- + // Basic reading + //------------------------------------------------------------------------- -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; -var Observable_1 = __webpack_require__(0); -var tryCatch_1 = __webpack_require__(7); -var isFunction_1 = __webpack_require__(81); -var errorObject_1 = __webpack_require__(5); -var Subscription_1 = __webpack_require__(9); -var toString = Object.prototype.toString; -function isNodeStyleEventEmitter(sourceObj) { - return !!sourceObj && typeof sourceObj.addListener === 'function' && typeof sourceObj.removeListener === 'function'; -} -function isJQueryStyleEventEmitter(sourceObj) { - return !!sourceObj && typeof sourceObj.on === 'function' && typeof sourceObj.off === 'function'; -} -function isNodeList(sourceObj) { - return !!sourceObj && toString.call(sourceObj) === '[object NodeList]'; -} -function isHTMLCollection(sourceObj) { - return !!sourceObj && toString.call(sourceObj) === '[object HTMLCollection]'; -} -function isEventTarget(sourceObj) { - return !!sourceObj && typeof sourceObj.addEventListener === 'function' && typeof sourceObj.removeEventListener === 'function'; -} -/** - * We need this JSDoc comment for affecting ESDoc. - * @extends {Ignored} - * @hide true - */ -var FromEventObservable = (function (_super) { - __extends(FromEventObservable, _super); - function FromEventObservable(sourceObj, eventName, selector, options) { - _super.call(this); - this.sourceObj = sourceObj; - this.eventName = eventName; - this.selector = selector; - this.options = options; - } - /* tslint:enable:max-line-length */ /** - * Creates an Observable that emits events of a specific type coming from the - * given event target. - * - * Creates an Observable from DOM events, or Node - * EventEmitter events or others. - * - * - * - * Creates an Observable by attaching an event listener to an "event target", - * which may be an object with `addEventListener` and `removeEventListener`, - * a Node.js EventEmitter, a jQuery style EventEmitter, a NodeList from the - * DOM, or an HTMLCollection from the DOM. The event handler is attached when - * the output Observable is subscribed, and removed when the Subscription is - * unsubscribed. - * - * @example Emits clicks happening on the DOM document - * var clicks = Rx.Observable.fromEvent(document, 'click'); - * clicks.subscribe(x => console.log(x)); - * - * // Results in: - * // MouseEvent object logged to console everytime a click - * // occurs on the document. - * - * @see {@link from} - * @see {@link fromEventPattern} - * - * @param {EventTargetLike} target The DOMElement, event target, Node.js - * EventEmitter, NodeList or HTMLCollection to attach the event handler to. - * @param {string} eventName The event name of interest, being emitted by the - * `target`. - * @param {EventListenerOptions} [options] Options to pass through to addEventListener - * @param {SelectorMethodSignature} [selector] An optional function to - * post-process results. It takes the arguments from the event handler and - * should return a single value. - * @return {Observable} - * @static true - * @name fromEvent - * @owner Observable + * Reads the next character without advancing the cursor. + * @param {int} count How many characters to look ahead (default is 1). + * @return {String} The next character or null if there is no next character. + * @method peek */ - FromEventObservable.create = function (target, eventName, options, selector) { - if (isFunction_1.isFunction(options)) { - selector = options; - options = undefined; + peek: function(count){ + var c = null; + count = (typeof count === "undefined" ? 1 : count); + + //if we're not at the end of the input... + if (this._cursor < this._input.length){ + + //get character and increment cursor and column + c = this._input.charAt(this._cursor + count - 1); } - return new FromEventObservable(target, eventName, selector, options); - }; - FromEventObservable.setupSubscription = function (sourceObj, eventName, handler, subscriber, options) { - var unsubscribe; - if (isNodeList(sourceObj) || isHTMLCollection(sourceObj)) { - for (var i = 0, len = sourceObj.length; i < len; i++) { - FromEventObservable.setupSubscription(sourceObj[i], eventName, handler, subscriber, options); + + return c; + }, + + /** + * Reads the next character from the input and adjusts the row and column + * accordingly. + * @return {String} The next character or null if there is no next character. + * @method read + */ + read: function(){ + var c = null; + + //if we're not at the end of the input... + if (this._cursor < this._input.length){ + + //if the last character was a newline, increment row count + //and reset column count + if (this._input.charAt(this._cursor) === "\n"){ + this._line++; + this._col=1; + } else { + this._col++; } + + //get character and increment cursor and column + c = this._input.charAt(this._cursor++); } - else if (isEventTarget(sourceObj)) { - var source_1 = sourceObj; - sourceObj.addEventListener(eventName, handler, options); - unsubscribe = function () { return source_1.removeEventListener(eventName, handler); }; + + return c; + }, + + //------------------------------------------------------------------------- + // Misc + //------------------------------------------------------------------------- + + /** + * Saves the current location so it can be returned to later. + * @method mark + * @return {void} + */ + mark: function(){ + this._bookmark = { + cursor: this._cursor, + line: this._line, + col: this._col + }; + }, + + reset: function(){ + if (this._bookmark){ + this._cursor = this._bookmark.cursor; + this._line = this._bookmark.line; + this._col = this._bookmark.col; + delete this._bookmark; } - else if (isJQueryStyleEventEmitter(sourceObj)) { - var source_2 = sourceObj; - sourceObj.on(eventName, handler); - unsubscribe = function () { return source_2.off(eventName, handler); }; + }, + + //------------------------------------------------------------------------- + // Advanced reading + //------------------------------------------------------------------------- + + /** + * Reads up to and including the given string. Throws an error if that + * string is not found. + * @param {String} pattern The string to read. + * @return {String} The string when it is found. + * @throws Error when the string pattern is not found. + * @method readTo + */ + readTo: function(pattern){ + + var buffer = "", + c; + + /* + * First, buffer must be the same length as the pattern. + * Then, buffer must end with the pattern or else reach the + * end of the input. + */ + while (buffer.length < pattern.length || buffer.lastIndexOf(pattern) !== buffer.length - pattern.length){ + c = this.read(); + if (c){ + buffer += c; + } else { + throw new Error("Expected \"" + pattern + "\" at line " + this._line + ", col " + this._col + "."); + } } - else if (isNodeStyleEventEmitter(sourceObj)) { - var source_3 = sourceObj; - sourceObj.addListener(eventName, handler); - unsubscribe = function () { return source_3.removeListener(eventName, handler); }; + + return buffer; + + }, + + /** + * Reads characters while each character causes the given + * filter function to return true. The function is passed + * in each character and either returns true to continue + * reading or false to stop. + * @param {Function} filter The function to read on each character. + * @return {String} The string made up of all characters that passed the + * filter check. + * @method readWhile + */ + readWhile: function(filter){ + + var buffer = "", + c = this.read(); + + while(c !== null && filter(c)){ + buffer += c; + c = this.read(); } - else { - throw new TypeError('Invalid event target'); - } - subscriber.add(new Subscription_1.Subscription(unsubscribe)); - }; - FromEventObservable.prototype._subscribe = function (subscriber) { - var sourceObj = this.sourceObj; - var eventName = this.eventName; - var options = this.options; - var selector = this.selector; - var handler = selector ? function () { - var args = []; - for (var _i = 0; _i < arguments.length; _i++) { - args[_i - 0] = arguments[_i]; - } - var result = tryCatch_1.tryCatch(selector).apply(void 0, args); - if (result === errorObject_1.errorObject) { - subscriber.error(errorObject_1.errorObject.e); + + return buffer; + + }, + + /** + * Reads characters that match either text or a regular expression and + * returns those characters. If a match is found, the row and column + * are adjusted; if no match is found, the reader's state is unchanged. + * reading or false to stop. + * @param {String|RegExp} matchter If a string, then the literal string + * value is searched for. If a regular expression, then any string + * matching the pattern is search for. + * @return {String} The string made up of all characters that matched or + * null if there was no match. + * @method readMatch + */ + readMatch: function(matcher){ + + var source = this._input.substring(this._cursor), + value = null; + + //if it's a string, just do a straight match + if (typeof matcher === "string"){ + if (source.indexOf(matcher) === 0){ + value = this.readCount(matcher.length); } - else { - subscriber.next(result); + } else if (matcher instanceof RegExp){ + if (matcher.test(source)){ + value = this.readCount(RegExp.lastMatch.length); } - } : function (e) { return subscriber.next(e); }; - FromEventObservable.setupSubscription(sourceObj, eventName, handler, subscriber, options); - }; - return FromEventObservable; -}(Observable_1.Observable)); -exports.FromEventObservable = FromEventObservable; -//# sourceMappingURL=FromEventObservable.js.map + } -/***/ }), -/* 251 */ -/***/ (function(module, exports, __webpack_require__) { + return value; + }, -"use strict"; -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + /** + * Reads a given number of characters. If the end of the input is reached, + * it reads only the remaining characters and does not throw an error. + * @param {int} count The number of characters to read. + * @return {String} The string made up the read characters. + * @method readCount + */ + readCount: function(count){ + var buffer = ""; + + while(count--){ + buffer += this.read(); + } + + return buffer; + } + }; -var isFunction_1 = __webpack_require__(81); -var Observable_1 = __webpack_require__(0); -var Subscription_1 = __webpack_require__(9); /** - * We need this JSDoc comment for affecting ESDoc. - * @extends {Ignored} - * @hide true + * Type to use when a syntax error occurs. + * @class SyntaxError + * @namespace parserlib.util + * @constructor + * @param {String} message The error message. + * @param {int} line The line at which the error occurred. + * @param {int} col The column at which the error occurred. */ -var FromEventPatternObservable = (function (_super) { - __extends(FromEventPatternObservable, _super); - function FromEventPatternObservable(addHandler, removeHandler, selector) { - _super.call(this); - this.addHandler = addHandler; - this.removeHandler = removeHandler; - this.selector = selector; - } +function SyntaxError(message, line, col){ + Error.call(this); + this.name = this.constructor.name; + /** - * Creates an Observable from an API based on addHandler/removeHandler - * functions. - * - * Converts any addHandler/removeHandler API to an - * Observable. - * - * - * - * Creates an Observable by using the `addHandler` and `removeHandler` - * functions to add and remove the handlers, with an optional selector - * function to project the event arguments to a result. The `addHandler` is - * called when the output Observable is subscribed, and `removeHandler` is - * called when the Subscription is unsubscribed. - * - * @example Emits clicks happening on the DOM document - * function addClickHandler(handler) { - * document.addEventListener('click', handler); - * } - * - * function removeClickHandler(handler) { - * document.removeEventListener('click', handler); - * } - * - * var clicks = Rx.Observable.fromEventPattern( - * addClickHandler, - * removeClickHandler - * ); - * clicks.subscribe(x => console.log(x)); - * - * @see {@link from} - * @see {@link fromEvent} - * - * @param {function(handler: Function): any} addHandler A function that takes - * a `handler` function as argument and attaches it somehow to the actual - * source of events. - * @param {function(handler: Function, signal?: any): void} [removeHandler] An optional function that - * takes a `handler` function as argument and removes it in case it was - * previously attached using `addHandler`. if addHandler returns signal to teardown when remove, - * removeHandler function will forward it. - * @param {function(...args: any): T} [selector] An optional function to - * post-process results. It takes the arguments from the event handler and - * should return a single value. - * @return {Observable} - * @static true - * @name fromEventPattern - * @owner Observable + * The column at which the error occurred. + * @type int + * @property col */ - FromEventPatternObservable.create = function (addHandler, removeHandler, selector) { - return new FromEventPatternObservable(addHandler, removeHandler, selector); - }; - FromEventPatternObservable.prototype._subscribe = function (subscriber) { - var _this = this; - var removeHandler = this.removeHandler; - var handler = !!this.selector ? function () { - var args = []; - for (var _i = 0; _i < arguments.length; _i++) { - args[_i - 0] = arguments[_i]; - } - _this._callSelector(subscriber, args); - } : function (e) { subscriber.next(e); }; - var retValue = this._callAddHandler(handler, subscriber); - if (!isFunction_1.isFunction(removeHandler)) { - return; - } - subscriber.add(new Subscription_1.Subscription(function () { - //TODO: determine whether or not to forward to error handler - removeHandler(handler, retValue); - })); - }; - FromEventPatternObservable.prototype._callSelector = function (subscriber, args) { - try { - var result = this.selector.apply(this, args); - subscriber.next(result); - } - catch (e) { - subscriber.error(e); - } - }; - FromEventPatternObservable.prototype._callAddHandler = function (handler, errorSubscriber) { - try { - return this.addHandler(handler) || null; - } - catch (e) { - errorSubscriber.error(e); - } - }; - return FromEventPatternObservable; -}(Observable_1.Observable)); -exports.FromEventPatternObservable = FromEventPatternObservable; -//# sourceMappingURL=FromEventPatternObservable.js.map + this.col = col; -/***/ }), -/* 252 */ -/***/ (function(module, exports, __webpack_require__) { + /** + * The line at which the error occurred. + * @type int + * @property line + */ + this.line = line; -"use strict"; + /** + * The text representation of the unit. + * @type String + * @property text + */ + this.message = message; -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; -var Observable_1 = __webpack_require__(0); -var isScheduler_1 = __webpack_require__(13); -var selfSelector = function (value) { return value; }; +} + +//inherit from Error +SyntaxError.prototype = Object.create(Error.prototype); // jshint ignore:line +SyntaxError.prototype.constructor = SyntaxError; // jshint ignore:line /** - * We need this JSDoc comment for affecting ESDoc. - * @extends {Ignored} - * @hide true + * Base type to represent a single syntactic unit. + * @class SyntaxUnit + * @namespace parserlib.util + * @constructor + * @param {String} text The text of the unit. + * @param {int} line The line of text on which the unit resides. + * @param {int} col The column of text on which the unit resides. */ -var GenerateObservable = (function (_super) { - __extends(GenerateObservable, _super); - function GenerateObservable(initialState, condition, iterate, resultSelector, scheduler) { - _super.call(this); - this.initialState = initialState; - this.condition = condition; - this.iterate = iterate; - this.resultSelector = resultSelector; - this.scheduler = scheduler; - } - GenerateObservable.create = function (initialStateOrOptions, condition, iterate, resultSelectorOrObservable, scheduler) { - if (arguments.length == 1) { - return new GenerateObservable(initialStateOrOptions.initialState, initialStateOrOptions.condition, initialStateOrOptions.iterate, initialStateOrOptions.resultSelector || selfSelector, initialStateOrOptions.scheduler); - } - if (resultSelectorOrObservable === undefined || isScheduler_1.isScheduler(resultSelectorOrObservable)) { - return new GenerateObservable(initialStateOrOptions, condition, iterate, selfSelector, resultSelectorOrObservable); - } - return new GenerateObservable(initialStateOrOptions, condition, iterate, resultSelectorOrObservable, scheduler); - }; - GenerateObservable.prototype._subscribe = function (subscriber) { - var state = this.initialState; - if (this.scheduler) { - return this.scheduler.schedule(GenerateObservable.dispatch, 0, { - subscriber: subscriber, - iterate: this.iterate, - condition: this.condition, - resultSelector: this.resultSelector, - state: state }); - } - var _a = this, condition = _a.condition, resultSelector = _a.resultSelector, iterate = _a.iterate; - do { - if (condition) { - var conditionResult = void 0; - try { - conditionResult = condition(state); - } - catch (err) { - subscriber.error(err); - return; - } - if (!conditionResult) { - subscriber.complete(); - break; - } - } - var value = void 0; - try { - value = resultSelector(state); - } - catch (err) { - subscriber.error(err); - return; - } - subscriber.next(value); - if (subscriber.closed) { - break; - } - try { - state = iterate(state); - } - catch (err) { - subscriber.error(err); - return; - } - } while (true); - }; - GenerateObservable.dispatch = function (state) { - var subscriber = state.subscriber, condition = state.condition; - if (subscriber.closed) { - return; - } - if (state.needIterate) { - try { - state.state = state.iterate(state.state); - } - catch (err) { - subscriber.error(err); - return; - } - } - else { - state.needIterate = true; - } - if (condition) { - var conditionResult = void 0; - try { - conditionResult = condition(state.state); - } - catch (err) { - subscriber.error(err); - return; - } - if (!conditionResult) { - subscriber.complete(); - return; - } - if (subscriber.closed) { - return; - } - } - var value; - try { - value = state.resultSelector(state.state); - } - catch (err) { - subscriber.error(err); - return; - } - if (subscriber.closed) { - return; - } - subscriber.next(value); - if (subscriber.closed) { - return; - } - return this.schedule(state); - }; - return GenerateObservable; -}(Observable_1.Observable)); -exports.GenerateObservable = GenerateObservable; -//# sourceMappingURL=GenerateObservable.js.map +function SyntaxUnit(text, line, col, type){ -/***/ }), -/* 253 */ -/***/ (function(module, exports, __webpack_require__) { -"use strict"; + /** + * The column of text on which the unit resides. + * @type int + * @property col + */ + this.col = col; + + /** + * The line of text on which the unit resides. + * @type int + * @property line + */ + this.line = line; + + /** + * The text representation of the unit. + * @type String + * @property text + */ + this.text = text; + + /** + * The type of syntax unit. + * @type int + * @property type + */ + this.type = type; +} + +/** + * Create a new syntax unit based solely on the given token. + * Convenience method for creating a new syntax unit when + * it represents a single token instead of multiple. + * @param {Object} token The token object to represent. + * @return {parserlib.util.SyntaxUnit} The object representing the token. + * @static + * @method fromToken + */ +SyntaxUnit.fromToken = function(token){ + return new SyntaxUnit(token.value, token.startLine, token.startCol); +}; + +SyntaxUnit.prototype = { + + //restore constructor + constructor: SyntaxUnit, + + /** + * Returns the text representation of the unit. + * @return {String} The text representation of the unit. + * @method valueOf + */ + valueOf: function(){ + return this.toString(); + }, + + /** + * Returns the text representation of the unit. + * @return {String} The text representation of the unit. + * @method toString + */ + toString: function(){ + return this.text; + } -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; -var Observable_1 = __webpack_require__(0); -var subscribeToResult_1 = __webpack_require__(3); -var OuterSubscriber_1 = __webpack_require__(4); + +/** + * Generic TokenStream providing base functionality. + * @class TokenStreamBase + * @namespace parserlib.util + * @constructor + * @param {String|StringReader} input The text to tokenize or a reader from + * which to read the input. + */ +function TokenStreamBase(input, tokenData){ + + /** + * The string reader for easy access to the text. + * @type StringReader + * @property _reader + * @private + */ + this._reader = input ? new StringReader(input.toString()) : null; + + /** + * Token object for the last consumed token. + * @type Token + * @property _token + * @private + */ + this._token = null; + + /** + * The array of token information. + * @type Array + * @property _tokenData + * @private + */ + this._tokenData = tokenData; + + /** + * Lookahead token buffer. + * @type Array + * @property _lt + * @private + */ + this._lt = []; + + /** + * Lookahead token buffer index. + * @type int + * @property _ltIndex + * @private + */ + this._ltIndex = 0; + + this._ltIndexCache = []; +} + /** - * We need this JSDoc comment for affecting ESDoc. - * @extends {Ignored} - * @hide true + * Accepts an array of token information and outputs + * an array of token data containing key-value mappings + * and matching functions that the TokenStream needs. + * @param {Array} tokens An array of token descriptors. + * @return {Array} An array of processed token data. + * @method createTokenData + * @static */ -var IfObservable = (function (_super) { - __extends(IfObservable, _super); - function IfObservable(condition, thenSource, elseSource) { - _super.call(this); - this.condition = condition; - this.thenSource = thenSource; - this.elseSource = elseSource; +TokenStreamBase.createTokenData = function(tokens){ + + var nameMap = [], + typeMap = Object.create(null), + tokenData = tokens.concat([]), + i = 0, + len = tokenData.length+1; + + tokenData.UNKNOWN = -1; + tokenData.unshift({name:"EOF"}); + + for (; i < len; i++){ + nameMap.push(tokenData[i].name); + tokenData[tokenData[i].name] = i; + if (tokenData[i].text){ + typeMap[tokenData[i].text] = i; + } } - IfObservable.create = function (condition, thenSource, elseSource) { - return new IfObservable(condition, thenSource, elseSource); - }; - IfObservable.prototype._subscribe = function (subscriber) { - var _a = this, condition = _a.condition, thenSource = _a.thenSource, elseSource = _a.elseSource; - return new IfSubscriber(subscriber, condition, thenSource, elseSource); + + tokenData.name = function(tt){ + return nameMap[tt]; }; - return IfObservable; -}(Observable_1.Observable)); -exports.IfObservable = IfObservable; -var IfSubscriber = (function (_super) { - __extends(IfSubscriber, _super); - function IfSubscriber(destination, condition, thenSource, elseSource) { - _super.call(this, destination); - this.condition = condition; - this.thenSource = thenSource; - this.elseSource = elseSource; - this.tryIf(); - } - IfSubscriber.prototype.tryIf = function () { - var _a = this, condition = _a.condition, thenSource = _a.thenSource, elseSource = _a.elseSource; - var result; - try { - result = condition(); - var source = result ? thenSource : elseSource; - if (source) { - this.add(subscribeToResult_1.subscribeToResult(this, source)); - } - else { - this._complete(); - } - } - catch (err) { - this._error(err); - } + + tokenData.type = function(c){ + return typeMap[c]; }; - return IfSubscriber; -}(OuterSubscriber_1.OuterSubscriber)); -//# sourceMappingURL=IfObservable.js.map -/***/ }), -/* 254 */ -/***/ (function(module, exports, __webpack_require__) { + return tokenData; +}; -"use strict"; +TokenStreamBase.prototype = { -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; -var isNumeric_1 = __webpack_require__(28); -var Observable_1 = __webpack_require__(0); -var async_1 = __webpack_require__(8); -/** - * We need this JSDoc comment for affecting ESDoc. - * @extends {Ignored} - * @hide true - */ -var IntervalObservable = (function (_super) { - __extends(IntervalObservable, _super); - function IntervalObservable(period, scheduler) { - if (period === void 0) { period = 0; } - if (scheduler === void 0) { scheduler = async_1.async; } - _super.call(this); - this.period = period; - this.scheduler = scheduler; - if (!isNumeric_1.isNumeric(period) || period < 0) { - this.period = 0; + //restore constructor + constructor: TokenStreamBase, + + //------------------------------------------------------------------------- + // Matching methods + //------------------------------------------------------------------------- + + /** + * Determines if the next token matches the given token type. + * If so, that token is consumed; if not, the token is placed + * back onto the token stream. You can pass in any number of + * token types and this will return true if any of the token + * types is found. + * @param {int|int[]} tokenTypes Either a single token type or an array of + * token types that the next token might be. If an array is passed, + * it's assumed that the token can be any of these. + * @param {variant} channel (Optional) The channel to read from. If not + * provided, reads from the default (unnamed) channel. + * @return {Boolean} True if the token type matches, false if not. + * @method match + */ + match: function(tokenTypes, channel){ + + //always convert to an array, makes things easier + if (!(tokenTypes instanceof Array)){ + tokenTypes = [tokenTypes]; } - if (!scheduler || typeof scheduler.schedule !== 'function') { - this.scheduler = async_1.async; + + var tt = this.get(channel), + i = 0, + len = tokenTypes.length; + + while(i < len){ + if (tt === tokenTypes[i++]){ + return true; + } } - } + + //no match found, put the token back + this.unget(); + return false; + }, + /** - * Creates an Observable that emits sequential numbers every specified - * interval of time, on a specified IScheduler. - * - * Emits incremental numbers periodically in time. - * - * - * - * - * `interval` returns an Observable that emits an infinite sequence of - * ascending integers, with a constant interval of time of your choosing - * between those emissions. The first emission is not sent immediately, but - * only after the first period has passed. By default, this operator uses the - * `async` IScheduler to provide a notion of time, but you may pass any - * IScheduler to it. - * - * @example Emits ascending numbers, one every second (1000ms) - * var numbers = Rx.Observable.interval(1000); - * numbers.subscribe(x => console.log(x)); - * - * @see {@link timer} - * @see {@link delay} - * - * @param {number} [period=0] The interval size in milliseconds (by default) - * or the time unit determined by the scheduler's clock. - * @param {Scheduler} [scheduler=async] The IScheduler to use for scheduling - * the emission of values, and providing a notion of "time". - * @return {Observable} An Observable that emits a sequential number each time - * interval. - * @static true - * @name interval - * @owner Observable + * Determines if the next token matches the given token type. + * If so, that token is consumed; if not, an error is thrown. + * @param {int|int[]} tokenTypes Either a single token type or an array of + * token types that the next token should be. If an array is passed, + * it's assumed that the token must be one of these. + * @param {variant} channel (Optional) The channel to read from. If not + * provided, reads from the default (unnamed) channel. + * @return {void} + * @method mustMatch */ - IntervalObservable.create = function (period, scheduler) { - if (period === void 0) { period = 0; } - if (scheduler === void 0) { scheduler = async_1.async; } - return new IntervalObservable(period, scheduler); - }; - IntervalObservable.dispatch = function (state) { - var index = state.index, subscriber = state.subscriber, period = state.period; - subscriber.next(index); - if (subscriber.closed) { - return; + mustMatch: function(tokenTypes, channel){ + + var token; + + //always convert to an array, makes things easier + if (!(tokenTypes instanceof Array)){ + tokenTypes = [tokenTypes]; } - state.index += 1; - this.schedule(state, period); - }; - IntervalObservable.prototype._subscribe = function (subscriber) { - var index = 0; - var period = this.period; - var scheduler = this.scheduler; - subscriber.add(scheduler.schedule(IntervalObservable.dispatch, period, { - index: index, subscriber: subscriber, period: period - })); - }; - return IntervalObservable; -}(Observable_1.Observable)); -exports.IntervalObservable = IntervalObservable; -//# sourceMappingURL=IntervalObservable.js.map -/***/ }), -/* 255 */ -/***/ (function(module, exports, __webpack_require__) { + if (!this.match.apply(this, arguments)){ + token = this.LT(1); + throw new SyntaxError("Expected " + this._tokenData[tokenTypes[0]].name + + " at line " + token.startLine + ", col " + token.startCol + ".", token.startLine, token.startCol); + } + }, -"use strict"; + //------------------------------------------------------------------------- + // Consuming methods + //------------------------------------------------------------------------- -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; -var Observable_1 = __webpack_require__(0); -var noop_1 = __webpack_require__(76); -/** - * We need this JSDoc comment for affecting ESDoc. - * @extends {Ignored} - * @hide true - */ -var NeverObservable = (function (_super) { - __extends(NeverObservable, _super); - function NeverObservable() { - _super.call(this); - } /** - * Creates an Observable that emits no items to the Observer. - * - * An Observable that never emits anything. - * - * - * - * This static operator is useful for creating a simple Observable that emits - * neither values nor errors nor the completion notification. It can be used - * for testing purposes or for composing with other Observables. Please note - * that by never emitting a complete notification, this Observable keeps the - * subscription from being disposed automatically. Subscriptions need to be - * manually disposed. - * - * @example Emit the number 7, then never emit anything else (not even complete). - * function info() { - * console.log('Will not be called'); - * } - * var result = Rx.Observable.never().startWith(7); - * result.subscribe(x => console.log(x), info, info); - * - * @see {@link create} - * @see {@link empty} - * @see {@link of} - * @see {@link throw} - * - * @return {Observable} A "never" Observable: never emits anything. - * @static true - * @name never - * @owner Observable + * Keeps reading from the token stream until either one of the specified + * token types is found or until the end of the input is reached. + * @param {int|int[]} tokenTypes Either a single token type or an array of + * token types that the next token should be. If an array is passed, + * it's assumed that the token must be one of these. + * @param {variant} channel (Optional) The channel to read from. If not + * provided, reads from the default (unnamed) channel. + * @return {void} + * @method advance */ - NeverObservable.create = function () { - return new NeverObservable(); - }; - NeverObservable.prototype._subscribe = function (subscriber) { - noop_1.noop(); - }; - return NeverObservable; -}(Observable_1.Observable)); -exports.NeverObservable = NeverObservable; -//# sourceMappingURL=NeverObservable.js.map + advance: function(tokenTypes, channel){ -/***/ }), -/* 256 */ -/***/ (function(module, exports, __webpack_require__) { + while(this.LA(0) !== 0 && !this.match(tokenTypes, channel)){ + this.get(); + } -"use strict"; + return this.LA(0); + }, -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; -var Observable_1 = __webpack_require__(0); -function dispatch(state) { - var obj = state.obj, keys = state.keys, length = state.length, index = state.index, subscriber = state.subscriber; - if (index === length) { - subscriber.complete(); - return; - } - var key = keys[index]; - subscriber.next([key, obj[key]]); - state.index = index + 1; - this.schedule(state); -} -/** - * We need this JSDoc comment for affecting ESDoc. - * @extends {Ignored} - * @hide true - */ -var PairsObservable = (function (_super) { - __extends(PairsObservable, _super); - function PairsObservable(obj, scheduler) { - _super.call(this); - this.obj = obj; - this.scheduler = scheduler; - this.keys = Object.keys(obj); - } /** - * Convert an object into an observable sequence of [key, value] pairs - * using an optional IScheduler to enumerate the object. - * - * @example Converts a javascript object to an Observable - * var obj = { - * foo: 42, - * bar: 56, - * baz: 78 - * }; - * - * var source = Rx.Observable.pairs(obj); - * - * var subscription = source.subscribe( - * function (x) { - * console.log('Next: %s', x); - * }, - * function (err) { - * console.log('Error: %s', err); - * }, - * function () { - * console.log('Completed'); - * }); - * - * @param {Object} obj The object to inspect and turn into an - * Observable sequence. - * @param {Scheduler} [scheduler] An optional IScheduler to run the - * enumeration of the input sequence on. - * @returns {(Observable>)} An observable sequence of - * [key, value] pairs from the object. - */ - PairsObservable.create = function (obj, scheduler) { - return new PairsObservable(obj, scheduler); - }; - PairsObservable.prototype._subscribe = function (subscriber) { - var _a = this, keys = _a.keys, scheduler = _a.scheduler; - var length = keys.length; - if (scheduler) { - return scheduler.schedule(dispatch, 0, { - obj: this.obj, keys: keys, length: length, index: 0, subscriber: subscriber - }); + * Consumes the next token from the token stream. + * @return {int} The token type of the token that was just consumed. + * @method get + */ + get: function(channel){ + + var tokenInfo = this._tokenData, + i =0, + token, + info; + + //check the lookahead buffer first + if (this._lt.length && this._ltIndex >= 0 && this._ltIndex < this._lt.length){ + + i++; + this._token = this._lt[this._ltIndex++]; + info = tokenInfo[this._token.type]; + + //obey channels logic + while((info.channel !== undefined && channel !== info.channel) && + this._ltIndex < this._lt.length){ + this._token = this._lt[this._ltIndex++]; + info = tokenInfo[this._token.type]; + i++; + } + + //here be dragons + if ((info.channel === undefined || channel === info.channel) && + this._ltIndex <= this._lt.length){ + this._ltIndexCache.push(i); + return this._token.type; + } } - else { - for (var idx = 0; idx < length; idx++) { - var key = keys[idx]; - subscriber.next([key, this.obj[key]]); + + //call token retriever method + token = this._getToken(); + + //if it should be hidden, don't save a token + if (token.type > -1 && !tokenInfo[token.type].hide){ + + //apply token channel + token.channel = tokenInfo[token.type].channel; + + //save for later + this._token = token; + this._lt.push(token); + + //save space that will be moved (must be done before array is truncated) + this._ltIndexCache.push(this._lt.length - this._ltIndex + i); + + //keep the buffer under 5 items + if (this._lt.length > 5){ + this._lt.shift(); } - subscriber.complete(); + + //also keep the shift buffer under 5 items + if (this._ltIndexCache.length > 5){ + this._ltIndexCache.shift(); + } + + //update lookahead index + this._ltIndex = this._lt.length; } - }; - return PairsObservable; -}(Observable_1.Observable)); -exports.PairsObservable = PairsObservable; -//# sourceMappingURL=PairsObservable.js.map -/***/ }), -/* 257 */ -/***/ (function(module, exports, __webpack_require__) { + /* + * Skip to the next token if: + * 1. The token type is marked as hidden. + * 2. The token type has a channel specified and it isn't the current channel. + */ + info = tokenInfo[token.type]; + if (info && + (info.hide || + (info.channel !== undefined && channel !== info.channel))){ + return this.get(channel); + } else { + //return just the type + return token.type; + } + }, -"use strict"; + /** + * Looks ahead a certain number of tokens and returns the token type at + * that position. This will throw an error if you lookahead past the + * end of input, past the size of the lookahead buffer, or back past + * the first token in the lookahead buffer. + * @param {int} The index of the token type to retrieve. 0 for the + * current token, 1 for the next, -1 for the previous, etc. + * @return {int} The token type of the token in the given position. + * @method LA + */ + LA: function(index){ + var total = index, + tt; + if (index > 0){ + //TODO: Store 5 somewhere + if (index > 5){ + throw new Error("Too much lookahead."); + } + + //get all those tokens + while(total){ + tt = this.get(); + total--; + } + + //unget all those tokens + while(total < index){ + this.unget(); + total++; + } + } else if (index < 0){ + + if(this._lt[this._ltIndex+index]){ + tt = this._lt[this._ltIndex+index].type; + } else { + throw new Error("Too much lookbehind."); + } + + } else { + tt = this._token.type; + } + + return tt; + + }, -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; -var Observable_1 = __webpack_require__(0); -/** - * We need this JSDoc comment for affecting ESDoc. - * @extends {Ignored} - * @hide true - */ -var RangeObservable = (function (_super) { - __extends(RangeObservable, _super); - function RangeObservable(start, count, scheduler) { - _super.call(this); - this.start = start; - this._count = count; - this.scheduler = scheduler; - } /** - * Creates an Observable that emits a sequence of numbers within a specified - * range. - * - * Emits a sequence of numbers in a range. - * - * - * - * `range` operator emits a range of sequential integers, in order, where you - * select the `start` of the range and its `length`. By default, uses no - * IScheduler and just delivers the notifications synchronously, but may use - * an optional IScheduler to regulate those deliveries. - * - * @example Emits the numbers 1 to 10 - * var numbers = Rx.Observable.range(1, 10); - * numbers.subscribe(x => console.log(x)); - * - * @see {@link timer} - * @see {@link interval} - * - * @param {number} [start=0] The value of the first integer in the sequence. - * @param {number} [count=0] The number of sequential integers to generate. - * @param {Scheduler} [scheduler] A {@link IScheduler} to use for scheduling - * the emissions of the notifications. - * @return {Observable} An Observable of numbers that emits a finite range of - * sequential integers. - * @static true - * @name range - * @owner Observable + * Looks ahead a certain number of tokens and returns the token at + * that position. This will throw an error if you lookahead past the + * end of input, past the size of the lookahead buffer, or back past + * the first token in the lookahead buffer. + * @param {int} The index of the token type to retrieve. 0 for the + * current token, 1 for the next, -1 for the previous, etc. + * @return {Object} The token of the token in the given position. + * @method LA + */ + LT: function(index){ + + //lookahead first to prime the token buffer + this.LA(index); + + //now find the token, subtract one because _ltIndex is already at the next index + return this._lt[this._ltIndex+index-1]; + }, + + /** + * Returns the token type for the next token in the stream without + * consuming it. + * @return {int} The token type of the next token in the stream. + * @method peek + */ + peek: function(){ + return this.LA(1); + }, + + /** + * Returns the actual token object for the last consumed token. + * @return {Token} The token object for the last consumed token. + * @method token */ - RangeObservable.create = function (start, count, scheduler) { - if (start === void 0) { start = 0; } - if (count === void 0) { count = 0; } - return new RangeObservable(start, count, scheduler); - }; - RangeObservable.dispatch = function (state) { - var start = state.start, index = state.index, count = state.count, subscriber = state.subscriber; - if (index >= count) { - subscriber.complete(); - return; - } - subscriber.next(start); - if (subscriber.closed) { - return; - } - state.index = index + 1; - state.start = start + 1; - this.schedule(state); - }; - RangeObservable.prototype._subscribe = function (subscriber) { - var index = 0; - var start = this.start; - var count = this._count; - var scheduler = this.scheduler; - if (scheduler) { - return scheduler.schedule(RangeObservable.dispatch, 0, { - index: index, count: count, start: start, subscriber: subscriber - }); + token: function(){ + return this._token; + }, + + /** + * Returns the name of the token for the given token type. + * @param {int} tokenType The type of token to get the name of. + * @return {String} The name of the token or "UNKNOWN_TOKEN" for any + * invalid token type. + * @method tokenName + */ + tokenName: function(tokenType){ + if (tokenType < 0 || tokenType > this._tokenData.length){ + return "UNKNOWN_TOKEN"; + } else { + return this._tokenData[tokenType].name; } - else { - do { - if (index++ >= count) { - subscriber.complete(); - break; - } - subscriber.next(start++); - if (subscriber.closed) { - break; - } - } while (true); + }, + + /** + * Returns the token type value for the given token name. + * @param {String} tokenName The name of the token whose value should be returned. + * @return {int} The token type value for the given token name or -1 + * for an unknown token. + * @method tokenName + */ + tokenType: function(tokenName){ + return this._tokenData[tokenName] || -1; + }, + + /** + * Returns the last consumed token to the token stream. + * @method unget + */ + unget: function(){ + //if (this._ltIndex > -1){ + if (this._ltIndexCache.length){ + this._ltIndex -= this._ltIndexCache.pop();//--; + this._token = this._lt[this._ltIndex - 1]; + } else { + throw new Error("Too much lookahead."); } - }; - return RangeObservable; -}(Observable_1.Observable)); -exports.RangeObservable = RangeObservable; -//# sourceMappingURL=RangeObservable.js.map + } -/***/ }), -/* 258 */ -/***/ (function(module, exports, __webpack_require__) { +}; -"use strict"; -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); +parserlib.util = { +__proto__ : null, +StringReader: StringReader, +SyntaxError : SyntaxError, +SyntaxUnit : SyntaxUnit, +EventTarget : EventTarget, +TokenStreamBase : TokenStreamBase }; -var Observable_1 = __webpack_require__(0); -var asap_1 = __webpack_require__(70); -var isNumeric_1 = __webpack_require__(28); +})(); +/* +Parser-Lib +Copyright (c) 2009-2011 Nicholas C. Zakas. All rights reserved. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. + +*/ +/* Version v0.2.5+domino1, Build time: 30-January-2016 05:13:03 */ +(function(){ +var EventTarget = parserlib.util.EventTarget, +TokenStreamBase = parserlib.util.TokenStreamBase, +StringReader = parserlib.util.StringReader, // jshint ignore:line +SyntaxError = parserlib.util.SyntaxError, +SyntaxUnit = parserlib.util.SyntaxUnit; + +var Colors = { + __proto__ :null, + aliceblue :"#f0f8ff", + antiquewhite :"#faebd7", + aqua :"#00ffff", + aquamarine :"#7fffd4", + azure :"#f0ffff", + beige :"#f5f5dc", + bisque :"#ffe4c4", + black :"#000000", + blanchedalmond :"#ffebcd", + blue :"#0000ff", + blueviolet :"#8a2be2", + brown :"#a52a2a", + burlywood :"#deb887", + cadetblue :"#5f9ea0", + chartreuse :"#7fff00", + chocolate :"#d2691e", + coral :"#ff7f50", + cornflowerblue :"#6495ed", + cornsilk :"#fff8dc", + crimson :"#dc143c", + cyan :"#00ffff", + darkblue :"#00008b", + darkcyan :"#008b8b", + darkgoldenrod :"#b8860b", + darkgray :"#a9a9a9", + darkgrey :"#a9a9a9", + darkgreen :"#006400", + darkkhaki :"#bdb76b", + darkmagenta :"#8b008b", + darkolivegreen :"#556b2f", + darkorange :"#ff8c00", + darkorchid :"#9932cc", + darkred :"#8b0000", + darksalmon :"#e9967a", + darkseagreen :"#8fbc8f", + darkslateblue :"#483d8b", + darkslategray :"#2f4f4f", + darkslategrey :"#2f4f4f", + darkturquoise :"#00ced1", + darkviolet :"#9400d3", + deeppink :"#ff1493", + deepskyblue :"#00bfff", + dimgray :"#696969", + dimgrey :"#696969", + dodgerblue :"#1e90ff", + firebrick :"#b22222", + floralwhite :"#fffaf0", + forestgreen :"#228b22", + fuchsia :"#ff00ff", + gainsboro :"#dcdcdc", + ghostwhite :"#f8f8ff", + gold :"#ffd700", + goldenrod :"#daa520", + gray :"#808080", + grey :"#808080", + green :"#008000", + greenyellow :"#adff2f", + honeydew :"#f0fff0", + hotpink :"#ff69b4", + indianred :"#cd5c5c", + indigo :"#4b0082", + ivory :"#fffff0", + khaki :"#f0e68c", + lavender :"#e6e6fa", + lavenderblush :"#fff0f5", + lawngreen :"#7cfc00", + lemonchiffon :"#fffacd", + lightblue :"#add8e6", + lightcoral :"#f08080", + lightcyan :"#e0ffff", + lightgoldenrodyellow :"#fafad2", + lightgray :"#d3d3d3", + lightgrey :"#d3d3d3", + lightgreen :"#90ee90", + lightpink :"#ffb6c1", + lightsalmon :"#ffa07a", + lightseagreen :"#20b2aa", + lightskyblue :"#87cefa", + lightslategray :"#778899", + lightslategrey :"#778899", + lightsteelblue :"#b0c4de", + lightyellow :"#ffffe0", + lime :"#00ff00", + limegreen :"#32cd32", + linen :"#faf0e6", + magenta :"#ff00ff", + maroon :"#800000", + mediumaquamarine:"#66cdaa", + mediumblue :"#0000cd", + mediumorchid :"#ba55d3", + mediumpurple :"#9370d8", + mediumseagreen :"#3cb371", + mediumslateblue :"#7b68ee", + mediumspringgreen :"#00fa9a", + mediumturquoise :"#48d1cc", + mediumvioletred :"#c71585", + midnightblue :"#191970", + mintcream :"#f5fffa", + mistyrose :"#ffe4e1", + moccasin :"#ffe4b5", + navajowhite :"#ffdead", + navy :"#000080", + oldlace :"#fdf5e6", + olive :"#808000", + olivedrab :"#6b8e23", + orange :"#ffa500", + orangered :"#ff4500", + orchid :"#da70d6", + palegoldenrod :"#eee8aa", + palegreen :"#98fb98", + paleturquoise :"#afeeee", + palevioletred :"#d87093", + papayawhip :"#ffefd5", + peachpuff :"#ffdab9", + peru :"#cd853f", + pink :"#ffc0cb", + plum :"#dda0dd", + powderblue :"#b0e0e6", + purple :"#800080", + red :"#ff0000", + rosybrown :"#bc8f8f", + royalblue :"#4169e1", + saddlebrown :"#8b4513", + salmon :"#fa8072", + sandybrown :"#f4a460", + seagreen :"#2e8b57", + seashell :"#fff5ee", + sienna :"#a0522d", + silver :"#c0c0c0", + skyblue :"#87ceeb", + slateblue :"#6a5acd", + slategray :"#708090", + slategrey :"#708090", + snow :"#fffafa", + springgreen :"#00ff7f", + steelblue :"#4682b4", + tan :"#d2b48c", + teal :"#008080", + thistle :"#d8bfd8", + tomato :"#ff6347", + turquoise :"#40e0d0", + violet :"#ee82ee", + wheat :"#f5deb3", + white :"#ffffff", + whitesmoke :"#f5f5f5", + yellow :"#ffff00", + yellowgreen :"#9acd32", + //'currentColor' color keyword http://www.w3.org/TR/css3-color/#currentcolor + currentColor :"The value of the 'color' property.", + //CSS2 system colors http://www.w3.org/TR/css3-color/#css2-system + activeBorder :"Active window border.", + activecaption :"Active window caption.", + appworkspace :"Background color of multiple document interface.", + background :"Desktop background.", + buttonface :"The face background color for 3-D elements that appear 3-D due to one layer of surrounding border.", + buttonhighlight :"The color of the border facing the light source for 3-D elements that appear 3-D due to one layer of surrounding border.", + buttonshadow :"The color of the border away from the light source for 3-D elements that appear 3-D due to one layer of surrounding border.", + buttontext :"Text on push buttons.", + captiontext :"Text in caption, size box, and scrollbar arrow box.", + graytext :"Grayed (disabled) text. This color is set to #000 if the current display driver does not support a solid gray color.", + greytext :"Greyed (disabled) text. This color is set to #000 if the current display driver does not support a solid grey color.", + highlight :"Item(s) selected in a control.", + highlighttext :"Text of item(s) selected in a control.", + inactiveborder :"Inactive window border.", + inactivecaption :"Inactive window caption.", + inactivecaptiontext :"Color of text in an inactive caption.", + infobackground :"Background color for tooltip controls.", + infotext :"Text color for tooltip controls.", + menu :"Menu background.", + menutext :"Text in menus.", + scrollbar :"Scroll bar gray area.", + threeddarkshadow :"The color of the darker (generally outer) of the two borders away from the light source for 3-D elements that appear 3-D due to two concentric layers of surrounding border.", + threedface :"The face background color for 3-D elements that appear 3-D due to two concentric layers of surrounding border.", + threedhighlight :"The color of the lighter (generally outer) of the two borders facing the light source for 3-D elements that appear 3-D due to two concentric layers of surrounding border.", + threedlightshadow :"The color of the darker (generally inner) of the two borders facing the light source for 3-D elements that appear 3-D due to two concentric layers of surrounding border.", + threedshadow :"The color of the lighter (generally inner) of the two borders away from the light source for 3-D elements that appear 3-D due to two concentric layers of surrounding border.", + window :"Window background.", + windowframe :"Window frame.", + windowtext :"Text in windows." +}; +/** + * Represents a selector combinator (whitespace, +, >). + * @namespace parserlib.css + * @class Combinator + * @extends parserlib.util.SyntaxUnit + * @constructor + * @param {String} text The text representation of the unit. + * @param {int} line The line of text on which the unit resides. + * @param {int} col The column of text on which the unit resides. + */ +function Combinator(text, line, col){ + + SyntaxUnit.call(this, text, line, col, Parser.COMBINATOR_TYPE); + + /** + * The type of modifier. + * @type String + * @property type + */ + this.type = "unknown"; + + //pretty simple + if (/^\s+$/.test(text)){ + this.type = "descendant"; + } else if (text === ">"){ + this.type = "child"; + } else if (text === "+"){ + this.type = "adjacent-sibling"; + } else if (text === "~"){ + this.type = "sibling"; + } + +} + +Combinator.prototype = new SyntaxUnit(); +Combinator.prototype.constructor = Combinator; + /** - * We need this JSDoc comment for affecting ESDoc. - * @extends {Ignored} - * @hide true + * Represents a media feature, such as max-width:500. + * @namespace parserlib.css + * @class MediaFeature + * @extends parserlib.util.SyntaxUnit + * @constructor + * @param {SyntaxUnit} name The name of the feature. + * @param {SyntaxUnit} value The value of the feature or null if none. */ -var SubscribeOnObservable = (function (_super) { - __extends(SubscribeOnObservable, _super); - function SubscribeOnObservable(source, delayTime, scheduler) { - if (delayTime === void 0) { delayTime = 0; } - if (scheduler === void 0) { scheduler = asap_1.asap; } - _super.call(this); - this.source = source; - this.delayTime = delayTime; - this.scheduler = scheduler; - if (!isNumeric_1.isNumeric(delayTime) || delayTime < 0) { - this.delayTime = 0; - } - if (!scheduler || typeof scheduler.schedule !== 'function') { - this.scheduler = asap_1.asap; - } - } - SubscribeOnObservable.create = function (source, delay, scheduler) { - if (delay === void 0) { delay = 0; } - if (scheduler === void 0) { scheduler = asap_1.asap; } - return new SubscribeOnObservable(source, delay, scheduler); - }; - SubscribeOnObservable.dispatch = function (arg) { - var source = arg.source, subscriber = arg.subscriber; - return this.add(source.subscribe(subscriber)); - }; - SubscribeOnObservable.prototype._subscribe = function (subscriber) { - var delay = this.delayTime; - var source = this.source; - var scheduler = this.scheduler; - return scheduler.schedule(SubscribeOnObservable.dispatch, delay, { - source: source, subscriber: subscriber - }); - }; - return SubscribeOnObservable; -}(Observable_1.Observable)); -exports.SubscribeOnObservable = SubscribeOnObservable; -//# sourceMappingURL=SubscribeOnObservable.js.map +function MediaFeature(name, value){ -/***/ }), -/* 259 */ -/***/ (function(module, exports, __webpack_require__) { + SyntaxUnit.call(this, "(" + name + (value !== null ? ":" + value : "") + ")", name.startLine, name.startCol, Parser.MEDIA_FEATURE_TYPE); -"use strict"; + /** + * The name of the media feature + * @type String + * @property name + */ + this.name = name; + + /** + * The value for the feature or null if there is none. + * @type SyntaxUnit + * @property value + */ + this.value = value; +} + +MediaFeature.prototype = new SyntaxUnit(); +MediaFeature.prototype.constructor = MediaFeature; -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; -var isNumeric_1 = __webpack_require__(28); -var Observable_1 = __webpack_require__(0); -var async_1 = __webpack_require__(8); -var isScheduler_1 = __webpack_require__(13); -var isDate_1 = __webpack_require__(27); /** - * We need this JSDoc comment for affecting ESDoc. - * @extends {Ignored} - * @hide true + * Represents an individual media query. + * @namespace parserlib.css + * @class MediaQuery + * @extends parserlib.util.SyntaxUnit + * @constructor + * @param {String} modifier The modifier "not" or "only" (or null). + * @param {String} mediaType The type of media (i.e., "print"). + * @param {Array} parts Array of selectors parts making up this selector. + * @param {int} line The line of text on which the unit resides. + * @param {int} col The column of text on which the unit resides. */ -var TimerObservable = (function (_super) { - __extends(TimerObservable, _super); - function TimerObservable(dueTime, period, scheduler) { - if (dueTime === void 0) { dueTime = 0; } - _super.call(this); - this.period = -1; - this.dueTime = 0; - if (isNumeric_1.isNumeric(period)) { - this.period = Number(period) < 1 && 1 || Number(period); - } - else if (isScheduler_1.isScheduler(period)) { - scheduler = period; - } - if (!isScheduler_1.isScheduler(scheduler)) { - scheduler = async_1.async; - } - this.scheduler = scheduler; - this.dueTime = isDate_1.isDate(dueTime) ? - (+dueTime - this.scheduler.now()) : - dueTime; - } +function MediaQuery(modifier, mediaType, features, line, col){ + + SyntaxUnit.call(this, (modifier ? modifier + " ": "") + (mediaType ? mediaType : "") + (mediaType && features.length > 0 ? " and " : "") + features.join(" and "), line, col, Parser.MEDIA_QUERY_TYPE); + /** - * Creates an Observable that starts emitting after an `initialDelay` and - * emits ever increasing numbers after each `period` of time thereafter. - * - * Its like {@link interval}, but you can specify when - * should the emissions start. - * - * - * - * `timer` returns an Observable that emits an infinite sequence of ascending - * integers, with a constant interval of time, `period` of your choosing - * between those emissions. The first emission happens after the specified - * `initialDelay`. The initial delay may be a {@link Date}. By default, this - * operator uses the `async` IScheduler to provide a notion of time, but you - * may pass any IScheduler to it. If `period` is not specified, the output - * Observable emits only one value, `0`. Otherwise, it emits an infinite - * sequence. - * - * @example Emits ascending numbers, one every second (1000ms), starting after 3 seconds - * var numbers = Rx.Observable.timer(3000, 1000); - * numbers.subscribe(x => console.log(x)); - * - * @example Emits one number after five seconds - * var numbers = Rx.Observable.timer(5000); - * numbers.subscribe(x => console.log(x)); - * - * @see {@link interval} - * @see {@link delay} - * - * @param {number|Date} initialDelay The initial delay time to wait before - * emitting the first value of `0`. - * @param {number} [period] The period of time between emissions of the - * subsequent numbers. - * @param {Scheduler} [scheduler=async] The IScheduler to use for scheduling - * the emission of values, and providing a notion of "time". - * @return {Observable} An Observable that emits a `0` after the - * `initialDelay` and ever increasing numbers after each `period` of time - * thereafter. - * @static true - * @name timer - * @owner Observable + * The media modifier ("not" or "only") + * @type String + * @property modifier */ - TimerObservable.create = function (initialDelay, period, scheduler) { - if (initialDelay === void 0) { initialDelay = 0; } - return new TimerObservable(initialDelay, period, scheduler); - }; - TimerObservable.dispatch = function (state) { - var index = state.index, period = state.period, subscriber = state.subscriber; - var action = this; - subscriber.next(index); - if (subscriber.closed) { - return; - } - else if (period === -1) { - return subscriber.complete(); - } - state.index = index + 1; - action.schedule(state, period); - }; - TimerObservable.prototype._subscribe = function (subscriber) { - var index = 0; - var _a = this, period = _a.period, dueTime = _a.dueTime, scheduler = _a.scheduler; - return scheduler.schedule(TimerObservable.dispatch, dueTime, { - index: index, period: period, subscriber: subscriber - }); - }; - return TimerObservable; -}(Observable_1.Observable)); -exports.TimerObservable = TimerObservable; -//# sourceMappingURL=TimerObservable.js.map + this.modifier = modifier; + + /** + * The mediaType (i.e., "print") + * @type String + * @property mediaType + */ + this.mediaType = mediaType; + + /** + * The parts that make up the selector. + * @type Array + * @property features + */ + this.features = features; + +} + +MediaQuery.prototype = new SyntaxUnit(); +MediaQuery.prototype.constructor = MediaQuery; + + +/** + * A CSS3 parser. + * @namespace parserlib.css + * @class Parser + * @constructor + * @param {Object} options (Optional) Various options for the parser: + * starHack (true|false) to allow IE6 star hack as valid, + * underscoreHack (true|false) to interpret leading underscores + * as IE6-7 targeting for known properties, ieFilters (true|false) + * to indicate that IE < 8 filters should be accepted and not throw + * syntax errors. + */ +function Parser(options){ + + //inherit event functionality + EventTarget.call(this); + + + this.options = options || {}; + + this._tokenStream = null; +} + +//Static constants +Parser.DEFAULT_TYPE = 0; +Parser.COMBINATOR_TYPE = 1; +Parser.MEDIA_FEATURE_TYPE = 2; +Parser.MEDIA_QUERY_TYPE = 3; +Parser.PROPERTY_NAME_TYPE = 4; +Parser.PROPERTY_VALUE_TYPE = 5; +Parser.PROPERTY_VALUE_PART_TYPE = 6; +Parser.SELECTOR_TYPE = 7; +Parser.SELECTOR_PART_TYPE = 8; +Parser.SELECTOR_SUB_PART_TYPE = 9; + +Parser.prototype = function(){ + + var proto = new EventTarget(), //new prototype + prop, + additions = { + __proto__: null, + + //restore constructor + constructor: Parser, + + //instance constants - yuck + DEFAULT_TYPE : 0, + COMBINATOR_TYPE : 1, + MEDIA_FEATURE_TYPE : 2, + MEDIA_QUERY_TYPE : 3, + PROPERTY_NAME_TYPE : 4, + PROPERTY_VALUE_TYPE : 5, + PROPERTY_VALUE_PART_TYPE : 6, + SELECTOR_TYPE : 7, + SELECTOR_PART_TYPE : 8, + SELECTOR_SUB_PART_TYPE : 9, + + //----------------------------------------------------------------- + // Grammar + //----------------------------------------------------------------- + + _stylesheet: function(){ + + /* + * stylesheet + * : [ CHARSET_SYM S* STRING S* ';' ]? + * [S|CDO|CDC]* [ import [S|CDO|CDC]* ]* + * [ namespace [S|CDO|CDC]* ]* + * [ [ ruleset | media | page | font_face | keyframes ] [S|CDO|CDC]* ]* + * ; + */ + + var tokenStream = this._tokenStream, + count, + token, + tt; + + this.fire("startstylesheet"); + + //try to read character set + this._charset(); + + this._skipCruft(); + + //try to read imports - may be more than one + while (tokenStream.peek() === Tokens.IMPORT_SYM){ + this._import(); + this._skipCruft(); + } + + //try to read namespaces - may be more than one + while (tokenStream.peek() === Tokens.NAMESPACE_SYM){ + this._namespace(); + this._skipCruft(); + } + + //get the next token + tt = tokenStream.peek(); + + //try to read the rest + while(tt > Tokens.EOF){ + + try { + + switch(tt){ + case Tokens.MEDIA_SYM: + this._media(); + this._skipCruft(); + break; + case Tokens.PAGE_SYM: + this._page(); + this._skipCruft(); + break; + case Tokens.FONT_FACE_SYM: + this._font_face(); + this._skipCruft(); + break; + case Tokens.KEYFRAMES_SYM: + this._keyframes(); + this._skipCruft(); + break; + case Tokens.VIEWPORT_SYM: + this._viewport(); + this._skipCruft(); + break; + case Tokens.DOCUMENT_SYM: + this._document(); + this._skipCruft(); + break; + case Tokens.UNKNOWN_SYM: //unknown @ rule + tokenStream.get(); + if (!this.options.strict){ + + //fire error event + this.fire({ + type: "error", + error: null, + message: "Unknown @ rule: " + tokenStream.LT(0).value + ".", + line: tokenStream.LT(0).startLine, + col: tokenStream.LT(0).startCol + }); + + //skip braces + count=0; + while (tokenStream.advance([Tokens.LBRACE, Tokens.RBRACE]) === Tokens.LBRACE){ + count++; //keep track of nesting depth + } + + while(count){ + tokenStream.advance([Tokens.RBRACE]); + count--; + } + + } else { + //not a syntax error, rethrow it + throw new SyntaxError("Unknown @ rule.", tokenStream.LT(0).startLine, tokenStream.LT(0).startCol); + } + break; + case Tokens.S: + this._readWhitespace(); + break; + default: + if(!this._ruleset()){ + + //error handling for known issues + switch(tt){ + case Tokens.CHARSET_SYM: + token = tokenStream.LT(1); + this._charset(false); + throw new SyntaxError("@charset not allowed here.", token.startLine, token.startCol); + case Tokens.IMPORT_SYM: + token = tokenStream.LT(1); + this._import(false); + throw new SyntaxError("@import not allowed here.", token.startLine, token.startCol); + case Tokens.NAMESPACE_SYM: + token = tokenStream.LT(1); + this._namespace(false); + throw new SyntaxError("@namespace not allowed here.", token.startLine, token.startCol); + default: + tokenStream.get(); //get the last token + this._unexpectedToken(tokenStream.token()); + } + + } + } + } catch(ex) { + if (ex instanceof SyntaxError && !this.options.strict){ + this.fire({ + type: "error", + error: ex, + message: ex.message, + line: ex.line, + col: ex.col + }); + } else { + throw ex; + } + } + + tt = tokenStream.peek(); + } + + if (tt !== Tokens.EOF){ + this._unexpectedToken(tokenStream.token()); + } + + this.fire("endstylesheet"); + }, + + _charset: function(emit){ + var tokenStream = this._tokenStream, + charset, + token, + line, + col; + + if (tokenStream.match(Tokens.CHARSET_SYM)){ + line = tokenStream.token().startLine; + col = tokenStream.token().startCol; + + this._readWhitespace(); + tokenStream.mustMatch(Tokens.STRING); + + token = tokenStream.token(); + charset = token.value; + + this._readWhitespace(); + tokenStream.mustMatch(Tokens.SEMICOLON); + + if (emit !== false){ + this.fire({ + type: "charset", + charset:charset, + line: line, + col: col + }); + } + } + }, + + _import: function(emit){ + /* + * import + * : IMPORT_SYM S* + * [STRING|URI] S* media_query_list? ';' S* + */ + + var tokenStream = this._tokenStream, + uri, + importToken, + mediaList = []; + + //read import symbol + tokenStream.mustMatch(Tokens.IMPORT_SYM); + importToken = tokenStream.token(); + this._readWhitespace(); + + tokenStream.mustMatch([Tokens.STRING, Tokens.URI]); + + //grab the URI value + uri = tokenStream.token().value.replace(/^(?:url\()?["']?([^"']+?)["']?\)?$/, "$1"); + + this._readWhitespace(); + + mediaList = this._media_query_list(); + + //must end with a semicolon + tokenStream.mustMatch(Tokens.SEMICOLON); + this._readWhitespace(); + + if (emit !== false){ + this.fire({ + type: "import", + uri: uri, + media: mediaList, + line: importToken.startLine, + col: importToken.startCol + }); + } + + }, + + _namespace: function(emit){ + /* + * namespace + * : NAMESPACE_SYM S* [namespace_prefix S*]? [STRING|URI] S* ';' S* + */ + + var tokenStream = this._tokenStream, + line, + col, + prefix, + uri; + + //read import symbol + tokenStream.mustMatch(Tokens.NAMESPACE_SYM); + line = tokenStream.token().startLine; + col = tokenStream.token().startCol; + this._readWhitespace(); + + //it's a namespace prefix - no _namespace_prefix() method because it's just an IDENT + if (tokenStream.match(Tokens.IDENT)){ + prefix = tokenStream.token().value; + this._readWhitespace(); + } + + tokenStream.mustMatch([Tokens.STRING, Tokens.URI]); + /*if (!tokenStream.match(Tokens.STRING)){ + tokenStream.mustMatch(Tokens.URI); + }*/ + + //grab the URI value + uri = tokenStream.token().value.replace(/(?:url\()?["']([^"']+)["']\)?/, "$1"); + + this._readWhitespace(); + + //must end with a semicolon + tokenStream.mustMatch(Tokens.SEMICOLON); + this._readWhitespace(); + + if (emit !== false){ + this.fire({ + type: "namespace", + prefix: prefix, + uri: uri, + line: line, + col: col + }); + } + + }, + + _media: function(){ + /* + * media + * : MEDIA_SYM S* media_query_list S* '{' S* ruleset* '}' S* + * ; + */ + var tokenStream = this._tokenStream, + line, + col, + mediaList;// = []; + + //look for @media + tokenStream.mustMatch(Tokens.MEDIA_SYM); + line = tokenStream.token().startLine; + col = tokenStream.token().startCol; + + this._readWhitespace(); + + mediaList = this._media_query_list(); + + tokenStream.mustMatch(Tokens.LBRACE); + this._readWhitespace(); + + this.fire({ + type: "startmedia", + media: mediaList, + line: line, + col: col + }); + + while(true) { + if (tokenStream.peek() === Tokens.PAGE_SYM){ + this._page(); + } else if (tokenStream.peek() === Tokens.FONT_FACE_SYM){ + this._font_face(); + } else if (tokenStream.peek() === Tokens.VIEWPORT_SYM){ + this._viewport(); + } else if (tokenStream.peek() === Tokens.DOCUMENT_SYM){ + this._document(); + } else if (!this._ruleset()){ + break; + } + } + + tokenStream.mustMatch(Tokens.RBRACE); + this._readWhitespace(); + + this.fire({ + type: "endmedia", + media: mediaList, + line: line, + col: col + }); + }, -/***/ }), -/* 260 */ -/***/ (function(module, exports, __webpack_require__) { -"use strict"; + //CSS3 Media Queries + _media_query_list: function(){ + /* + * media_query_list + * : S* [media_query [ ',' S* media_query ]* ]? + * ; + */ + var tokenStream = this._tokenStream, + mediaList = []; -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; -var Observable_1 = __webpack_require__(0); -var subscribeToResult_1 = __webpack_require__(3); -var OuterSubscriber_1 = __webpack_require__(4); -/** - * We need this JSDoc comment for affecting ESDoc. - * @extends {Ignored} - * @hide true - */ -var UsingObservable = (function (_super) { - __extends(UsingObservable, _super); - function UsingObservable(resourceFactory, observableFactory) { - _super.call(this); - this.resourceFactory = resourceFactory; - this.observableFactory = observableFactory; - } - UsingObservable.create = function (resourceFactory, observableFactory) { - return new UsingObservable(resourceFactory, observableFactory); - }; - UsingObservable.prototype._subscribe = function (subscriber) { - var _a = this, resourceFactory = _a.resourceFactory, observableFactory = _a.observableFactory; - var resource; - try { - resource = resourceFactory(); - return new UsingSubscriber(subscriber, resource, observableFactory); - } - catch (err) { - subscriber.error(err); - } - }; - return UsingObservable; -}(Observable_1.Observable)); -exports.UsingObservable = UsingObservable; -var UsingSubscriber = (function (_super) { - __extends(UsingSubscriber, _super); - function UsingSubscriber(destination, resource, observableFactory) { - _super.call(this, destination); - this.resource = resource; - this.observableFactory = observableFactory; - destination.add(resource); - this.tryUse(); - } - UsingSubscriber.prototype.tryUse = function () { - try { - var source = this.observableFactory.call(this, this.resource); - if (source) { - this.add(subscribeToResult_1.subscribeToResult(this, source)); - } - } - catch (err) { - this._error(err); - } - }; - return UsingSubscriber; -}(OuterSubscriber_1.OuterSubscriber)); -//# sourceMappingURL=UsingObservable.js.map -/***/ }), -/* 261 */ -/***/ (function(module, exports, __webpack_require__) { + this._readWhitespace(); -"use strict"; + if (tokenStream.peek() === Tokens.IDENT || tokenStream.peek() === Tokens.LPAREN){ + mediaList.push(this._media_query()); + } -var BoundCallbackObservable_1 = __webpack_require__(246); -exports.bindCallback = BoundCallbackObservable_1.BoundCallbackObservable.create; -//# sourceMappingURL=bindCallback.js.map + while(tokenStream.match(Tokens.COMMA)){ + this._readWhitespace(); + mediaList.push(this._media_query()); + } -/***/ }), -/* 262 */ -/***/ (function(module, exports, __webpack_require__) { + return mediaList; + }, -"use strict"; + /* + * Note: "expression" in the grammar maps to the _media_expression + * method. -var BoundNodeCallbackObservable_1 = __webpack_require__(247); -exports.bindNodeCallback = BoundNodeCallbackObservable_1.BoundNodeCallbackObservable.create; -//# sourceMappingURL=bindNodeCallback.js.map + */ + _media_query: function(){ + /* + * media_query + * : [ONLY | NOT]? S* media_type S* [ AND S* expression ]* + * | expression [ AND S* expression ]* + * ; + */ + var tokenStream = this._tokenStream, + type = null, + ident = null, + token = null, + expressions = []; + + if (tokenStream.match(Tokens.IDENT)){ + ident = tokenStream.token().value.toLowerCase(); + + //since there's no custom tokens for these, need to manually check + if (ident !== "only" && ident !== "not"){ + tokenStream.unget(); + ident = null; + } else { + token = tokenStream.token(); + } + } -/***/ }), -/* 263 */ -/***/ (function(module, exports, __webpack_require__) { + this._readWhitespace(); -"use strict"; + if (tokenStream.peek() === Tokens.IDENT){ + type = this._media_type(); + if (token === null){ + token = tokenStream.token(); + } + } else if (tokenStream.peek() === Tokens.LPAREN){ + if (token === null){ + token = tokenStream.LT(1); + } + expressions.push(this._media_expression()); + } -var isScheduler_1 = __webpack_require__(13); -var isArray_1 = __webpack_require__(15); -var ArrayObservable_1 = __webpack_require__(14); -var combineLatest_1 = __webpack_require__(37); -/* tslint:enable:max-line-length */ -/** - * Combines multiple Observables to create an Observable whose values are - * calculated from the latest values of each of its input Observables. - * - * Whenever any input Observable emits a value, it - * computes a formula using the latest values from all the inputs, then emits - * the output of that formula. - * - * - * - * `combineLatest` combines the values from all the Observables passed as - * arguments. This is done by subscribing to each Observable in order and, - * whenever any Observable emits, collecting an array of the most recent - * values from each Observable. So if you pass `n` Observables to operator, - * returned Observable will always emit an array of `n` values, in order - * corresponding to order of passed Observables (value from the first Observable - * on the first place and so on). - * - * Static version of `combineLatest` accepts either an array of Observables - * or each Observable can be put directly as an argument. Note that array of - * Observables is good choice, if you don't know beforehand how many Observables - * you will combine. Passing empty array will result in Observable that - * completes immediately. - * - * To ensure output array has always the same length, `combineLatest` will - * actually wait for all input Observables to emit at least once, - * before it starts emitting results. This means if some Observable emits - * values before other Observables started emitting, all that values but last - * will be lost. On the other hand, is some Observable does not emit value but - * completes, resulting Observable will complete at the same moment without - * emitting anything, since it will be now impossible to include value from - * completed Observable in resulting array. Also, if some input Observable does - * not emit any value and never completes, `combineLatest` will also never emit - * and never complete, since, again, it will wait for all streams to emit some - * value. - * - * If at least one Observable was passed to `combineLatest` and all passed Observables - * emitted something, resulting Observable will complete when all combined - * streams complete. So even if some Observable completes, result of - * `combineLatest` will still emit values when other Observables do. In case - * of completed Observable, its value from now on will always be the last - * emitted value. On the other hand, if any Observable errors, `combineLatest` - * will error immediately as well, and all other Observables will be unsubscribed. - * - * `combineLatest` accepts as optional parameter `project` function, which takes - * as arguments all values that would normally be emitted by resulting Observable. - * `project` can return any kind of value, which will be then emitted by Observable - * instead of default array. Note that `project` does not take as argument that array - * of values, but values themselves. That means default `project` can be imagined - * as function that takes all its arguments and puts them into an array. - * - * - * @example Combine two timer Observables - * const firstTimer = Rx.Observable.timer(0, 1000); // emit 0, 1, 2... after every second, starting from now - * const secondTimer = Rx.Observable.timer(500, 1000); // emit 0, 1, 2... after every second, starting 0,5s from now - * const combinedTimers = Rx.Observable.combineLatest(firstTimer, secondTimer); - * combinedTimers.subscribe(value => console.log(value)); - * // Logs - * // [0, 0] after 0.5s - * // [1, 0] after 1s - * // [1, 1] after 1.5s - * // [2, 1] after 2s - * - * - * @example Combine an array of Observables - * const observables = [1, 5, 10].map( - * n => Rx.Observable.of(n).delay(n * 1000).startWith(0) // emit 0 and then emit n after n seconds - * ); - * const combined = Rx.Observable.combineLatest(observables); - * combined.subscribe(value => console.log(value)); - * // Logs - * // [0, 0, 0] immediately - * // [1, 0, 0] after 1s - * // [1, 5, 0] after 5s - * // [1, 5, 10] after 10s - * - * - * @example Use project function to dynamically calculate the Body-Mass Index - * var weight = Rx.Observable.of(70, 72, 76, 79, 75); - * var height = Rx.Observable.of(1.76, 1.77, 1.78); - * var bmi = Rx.Observable.combineLatest(weight, height, (w, h) => w / (h * h)); - * bmi.subscribe(x => console.log('BMI is ' + x)); - * - * // With output to console: - * // BMI is 24.212293388429753 - * // BMI is 23.93948099205209 - * // BMI is 23.671253629592222 - * - * - * @see {@link combineAll} - * @see {@link merge} - * @see {@link withLatestFrom} - * - * @param {ObservableInput} observable1 An input Observable to combine with other Observables. - * @param {ObservableInput} observable2 An input Observable to combine with other Observables. - * More than one input Observables may be given as arguments - * or an array of Observables may be given as the first argument. - * @param {function} [project] An optional function to project the values from - * the combined latest values into a new value on the output Observable. - * @param {Scheduler} [scheduler=null] The IScheduler to use for subscribing to - * each input Observable. - * @return {Observable} An Observable of projected values from the most recent - * values from each input Observable, or an array of the most recent values from - * each input Observable. - * @static true - * @name combineLatest - * @owner Observable - */ -function combineLatest() { - var observables = []; - for (var _i = 0; _i < arguments.length; _i++) { - observables[_i - 0] = arguments[_i]; - } - var project = null; - var scheduler = null; - if (isScheduler_1.isScheduler(observables[observables.length - 1])) { - scheduler = observables.pop(); - } - if (typeof observables[observables.length - 1] === 'function') { - project = observables.pop(); - } - // if the first and only other argument besides the resultSelector is an array - // assume it's been called with `combineLatest([obs1, obs2, obs3], project)` - if (observables.length === 1 && isArray_1.isArray(observables[0])) { - observables = observables[0]; - } - return new ArrayObservable_1.ArrayObservable(observables, scheduler).lift(new combineLatest_1.CombineLatestOperator(project)); -} -exports.combineLatest = combineLatest; -//# sourceMappingURL=combineLatest.js.map + if (type === null && expressions.length === 0){ + return null; + } else { + this._readWhitespace(); + while (tokenStream.match(Tokens.IDENT)){ + if (tokenStream.token().value.toLowerCase() !== "and"){ + this._unexpectedToken(tokenStream.token()); + } -/***/ }), -/* 264 */ -/***/ (function(module, exports, __webpack_require__) { + this._readWhitespace(); + expressions.push(this._media_expression()); + } + } -"use strict"; + return new MediaQuery(ident, type, expressions, token.startLine, token.startCol); + }, -var concat_1 = __webpack_require__(38); -exports.concat = concat_1.concatStatic; -//# sourceMappingURL=concat.js.map + //CSS3 Media Queries + _media_type: function(){ + /* + * media_type + * : IDENT + * ; + */ + return this._media_feature(); + }, -/***/ }), -/* 265 */ -/***/ (function(module, exports, __webpack_require__) { + /** + * Note: in CSS3 Media Queries, this is called "expression". + * Renamed here to avoid conflict with CSS3 Selectors + * definition of "expression". Also note that "expr" in the + * grammar now maps to "expression" from CSS3 selectors. + * @method _media_expression + * @private + */ + _media_expression: function(){ + /* + * expression + * : '(' S* media_feature S* [ ':' S* expr ]? ')' S* + * ; + */ + var tokenStream = this._tokenStream, + feature = null, + token, + expression = null; + + tokenStream.mustMatch(Tokens.LPAREN); + + feature = this._media_feature(); + this._readWhitespace(); + + if (tokenStream.match(Tokens.COLON)){ + this._readWhitespace(); + token = tokenStream.LT(1); + expression = this._expression(); + } -"use strict"; + tokenStream.mustMatch(Tokens.RPAREN); + this._readWhitespace(); -var DeferObservable_1 = __webpack_require__(248); -exports.defer = DeferObservable_1.DeferObservable.create; -//# sourceMappingURL=defer.js.map + return new MediaFeature(feature, (expression ? new SyntaxUnit(expression, token.startLine, token.startCol) : null)); + }, -/***/ }), -/* 266 */ -/***/ (function(module, exports, __webpack_require__) { + //CSS3 Media Queries + _media_feature: function(){ + /* + * media_feature + * : IDENT + * ; + */ + var tokenStream = this._tokenStream; -"use strict"; + this._readWhitespace(); -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; -var Subject_1 = __webpack_require__(6); -var Subscriber_1 = __webpack_require__(2); -var Observable_1 = __webpack_require__(0); -var Subscription_1 = __webpack_require__(9); -var root_1 = __webpack_require__(12); -var ReplaySubject_1 = __webpack_require__(26); -var tryCatch_1 = __webpack_require__(7); -var errorObject_1 = __webpack_require__(5); -var assign_1 = __webpack_require__(373); -/** - * We need this JSDoc comment for affecting ESDoc. - * @extends {Ignored} - * @hide true - */ -var WebSocketSubject = (function (_super) { - __extends(WebSocketSubject, _super); - function WebSocketSubject(urlConfigOrSource, destination) { - if (urlConfigOrSource instanceof Observable_1.Observable) { - _super.call(this, destination, urlConfigOrSource); - } - else { - _super.call(this); - this.WebSocketCtor = root_1.root.WebSocket; - this._output = new Subject_1.Subject(); - if (typeof urlConfigOrSource === 'string') { - this.url = urlConfigOrSource; - } - else { - // WARNING: config object could override important members here. - assign_1.assign(this, urlConfigOrSource); - } - if (!this.WebSocketCtor) { - throw new Error('no WebSocket constructor can be found'); - } - this.destination = new ReplaySubject_1.ReplaySubject(); - } - } - WebSocketSubject.prototype.resultSelector = function (e) { - return JSON.parse(e.data); - }; - /** - * Wrapper around the w3c-compatible WebSocket object provided by the browser. - * - * @example Wraps browser WebSocket - * - * let socket$ = Observable.webSocket('ws://localhost:8081'); - * - * socket$.subscribe( - * (msg) => console.log('message received: ' + msg), - * (err) => console.log(err), - * () => console.log('complete') - * ); - * - * socket$.next(JSON.stringify({ op: 'hello' })); - * - * @example Wraps WebSocket from nodejs-websocket (using node.js) - * - * import { w3cwebsocket } from 'websocket'; - * - * let socket$ = Observable.webSocket({ - * url: 'ws://localhost:8081', - * WebSocketCtor: w3cwebsocket - * }); - * - * socket$.subscribe( - * (msg) => console.log('message received: ' + msg), - * (err) => console.log(err), - * () => console.log('complete') - * ); - * - * socket$.next(JSON.stringify({ op: 'hello' })); - * - * @param {string | WebSocketSubjectConfig} urlConfigOrSource the source of the websocket as an url or a structure defining the websocket object - * @return {WebSocketSubject} - * @static true - * @name webSocket - * @owner Observable - */ - WebSocketSubject.create = function (urlConfigOrSource) { - return new WebSocketSubject(urlConfigOrSource); - }; - WebSocketSubject.prototype.lift = function (operator) { - var sock = new WebSocketSubject(this, this.destination); - sock.operator = operator; - return sock; - }; - WebSocketSubject.prototype._resetState = function () { - this.socket = null; - if (!this.source) { - this.destination = new ReplaySubject_1.ReplaySubject(); - } - this._output = new Subject_1.Subject(); - }; - // TODO: factor this out to be a proper Operator/Subscriber implementation and eliminate closures - WebSocketSubject.prototype.multiplex = function (subMsg, unsubMsg, messageFilter) { - var self = this; - return new Observable_1.Observable(function (observer) { - var result = tryCatch_1.tryCatch(subMsg)(); - if (result === errorObject_1.errorObject) { - observer.error(errorObject_1.errorObject.e); - } - else { - self.next(result); - } - var subscription = self.subscribe(function (x) { - var result = tryCatch_1.tryCatch(messageFilter)(x); - if (result === errorObject_1.errorObject) { - observer.error(errorObject_1.errorObject.e); + tokenStream.mustMatch(Tokens.IDENT); + + return SyntaxUnit.fromToken(tokenStream.token()); + }, + + //CSS3 Paged Media + _page: function(){ + /* + * page: + * PAGE_SYM S* IDENT? pseudo_page? S* + * '{' S* [ declaration | margin ]? [ ';' S* [ declaration | margin ]? ]* '}' S* + * ; + */ + var tokenStream = this._tokenStream, + line, + col, + identifier = null, + pseudoPage = null; + + //look for @page + tokenStream.mustMatch(Tokens.PAGE_SYM); + line = tokenStream.token().startLine; + col = tokenStream.token().startCol; + + this._readWhitespace(); + + if (tokenStream.match(Tokens.IDENT)){ + identifier = tokenStream.token().value; + + //The value 'auto' may not be used as a page name and MUST be treated as a syntax error. + if (identifier.toLowerCase() === "auto"){ + this._unexpectedToken(tokenStream.token()); + } } - else if (result) { - observer.next(x); + + //see if there's a colon upcoming + if (tokenStream.peek() === Tokens.COLON){ + pseudoPage = this._pseudo_page(); } - }, function (err) { return observer.error(err); }, function () { return observer.complete(); }); - return function () { - var result = tryCatch_1.tryCatch(unsubMsg)(); - if (result === errorObject_1.errorObject) { - observer.error(errorObject_1.errorObject.e); + + this._readWhitespace(); + + this.fire({ + type: "startpage", + id: identifier, + pseudo: pseudoPage, + line: line, + col: col + }); + + this._readDeclarations(true, true); + + this.fire({ + type: "endpage", + id: identifier, + pseudo: pseudoPage, + line: line, + col: col + }); + + }, + + //CSS3 Paged Media + _margin: function(){ + /* + * margin : + * margin_sym S* '{' declaration [ ';' S* declaration? ]* '}' S* + * ; + */ + var tokenStream = this._tokenStream, + line, + col, + marginSym = this._margin_sym(); + + if (marginSym){ + line = tokenStream.token().startLine; + col = tokenStream.token().startCol; + + this.fire({ + type: "startpagemargin", + margin: marginSym, + line: line, + col: col + }); + + this._readDeclarations(true); + + this.fire({ + type: "endpagemargin", + margin: marginSym, + line: line, + col: col + }); + return true; + } else { + return false; } - else { - self.next(result); + }, + + //CSS3 Paged Media + _margin_sym: function(){ + + /* + * margin_sym : + * TOPLEFTCORNER_SYM | + * TOPLEFT_SYM | + * TOPCENTER_SYM | + * TOPRIGHT_SYM | + * TOPRIGHTCORNER_SYM | + * BOTTOMLEFTCORNER_SYM | + * BOTTOMLEFT_SYM | + * BOTTOMCENTER_SYM | + * BOTTOMRIGHT_SYM | + * BOTTOMRIGHTCORNER_SYM | + * LEFTTOP_SYM | + * LEFTMIDDLE_SYM | + * LEFTBOTTOM_SYM | + * RIGHTTOP_SYM | + * RIGHTMIDDLE_SYM | + * RIGHTBOTTOM_SYM + * ; + */ + + var tokenStream = this._tokenStream; + + if(tokenStream.match([Tokens.TOPLEFTCORNER_SYM, Tokens.TOPLEFT_SYM, + Tokens.TOPCENTER_SYM, Tokens.TOPRIGHT_SYM, Tokens.TOPRIGHTCORNER_SYM, + Tokens.BOTTOMLEFTCORNER_SYM, Tokens.BOTTOMLEFT_SYM, + Tokens.BOTTOMCENTER_SYM, Tokens.BOTTOMRIGHT_SYM, + Tokens.BOTTOMRIGHTCORNER_SYM, Tokens.LEFTTOP_SYM, + Tokens.LEFTMIDDLE_SYM, Tokens.LEFTBOTTOM_SYM, Tokens.RIGHTTOP_SYM, + Tokens.RIGHTMIDDLE_SYM, Tokens.RIGHTBOTTOM_SYM])) + { + return SyntaxUnit.fromToken(tokenStream.token()); + } else { + return null; } - subscription.unsubscribe(); - }; - }); - }; - WebSocketSubject.prototype._connectSocket = function () { - var _this = this; - var WebSocketCtor = this.WebSocketCtor; - var observer = this._output; - var socket = null; - try { - socket = this.protocol ? - new WebSocketCtor(this.url, this.protocol) : - new WebSocketCtor(this.url); - this.socket = socket; - if (this.binaryType) { - this.socket.binaryType = this.binaryType; - } - } - catch (e) { - observer.error(e); - return; - } - var subscription = new Subscription_1.Subscription(function () { - _this.socket = null; - if (socket && socket.readyState === 1) { - socket.close(); - } - }); - socket.onopen = function (e) { - var openObserver = _this.openObserver; - if (openObserver) { - openObserver.next(e); - } - var queue = _this.destination; - _this.destination = Subscriber_1.Subscriber.create(function (x) { return socket.readyState === 1 && socket.send(x); }, function (e) { - var closingObserver = _this.closingObserver; - if (closingObserver) { - closingObserver.next(undefined); + + }, + + _pseudo_page: function(){ + /* + * pseudo_page + * : ':' IDENT + * ; + */ + + var tokenStream = this._tokenStream; + + tokenStream.mustMatch(Tokens.COLON); + tokenStream.mustMatch(Tokens.IDENT); + + //TODO: CSS3 Paged Media says only "left", "center", and "right" are allowed + + return tokenStream.token().value; + }, + + _font_face: function(){ + /* + * font_face + * : FONT_FACE_SYM S* + * '{' S* declaration [ ';' S* declaration ]* '}' S* + * ; + */ + var tokenStream = this._tokenStream, + line, + col; + + //look for @page + tokenStream.mustMatch(Tokens.FONT_FACE_SYM); + line = tokenStream.token().startLine; + col = tokenStream.token().startCol; + + this._readWhitespace(); + + this.fire({ + type: "startfontface", + line: line, + col: col + }); + + this._readDeclarations(true); + + this.fire({ + type: "endfontface", + line: line, + col: col + }); + }, + + _viewport: function(){ + /* + * viewport + * : VIEWPORT_SYM S* + * '{' S* declaration? [ ';' S* declaration? ]* '}' S* + * ; + */ + var tokenStream = this._tokenStream, + line, + col; + + tokenStream.mustMatch(Tokens.VIEWPORT_SYM); + line = tokenStream.token().startLine; + col = tokenStream.token().startCol; + + this._readWhitespace(); + + this.fire({ + type: "startviewport", + line: line, + col: col + }); + + this._readDeclarations(true); + + this.fire({ + type: "endviewport", + line: line, + col: col + }); + + }, + + _document: function(){ + /* + * document + * : DOCUMENT_SYM S* + * _document_function [ ',' S* _document_function ]* S* + * '{' S* ruleset* '}' + * ; + */ + + var tokenStream = this._tokenStream, + token, + functions = [], + prefix = ""; + + tokenStream.mustMatch(Tokens.DOCUMENT_SYM); + token = tokenStream.token(); + if (/^@\-([^\-]+)\-/.test(token.value)) { + prefix = RegExp.$1; } - if (e && e.code) { - socket.close(e.code, e.reason); + + this._readWhitespace(); + functions.push(this._document_function()); + + while(tokenStream.match(Tokens.COMMA)) { + this._readWhitespace(); + functions.push(this._document_function()); } - else { - observer.error(new TypeError('WebSocketSubject.error must be called with an object with an error code, ' + - 'and an optional reason: { code: number, reason: string }')); + + tokenStream.mustMatch(Tokens.LBRACE); + this._readWhitespace(); + + this.fire({ + type: "startdocument", + functions: functions, + prefix: prefix, + line: token.startLine, + col: token.startCol + }); + + while(true) { + if (tokenStream.peek() === Tokens.PAGE_SYM){ + this._page(); + } else if (tokenStream.peek() === Tokens.FONT_FACE_SYM){ + this._font_face(); + } else if (tokenStream.peek() === Tokens.VIEWPORT_SYM){ + this._viewport(); + } else if (tokenStream.peek() === Tokens.MEDIA_SYM){ + this._media(); + } else if (!this._ruleset()){ + break; + } } - _this._resetState(); - }, function () { - var closingObserver = _this.closingObserver; - if (closingObserver) { - closingObserver.next(undefined); + + tokenStream.mustMatch(Tokens.RBRACE); + this._readWhitespace(); + + this.fire({ + type: "enddocument", + functions: functions, + prefix: prefix, + line: token.startLine, + col: token.startCol + }); + }, + + _document_function: function(){ + /* + * document_function + * : function | URI S* + * ; + */ + + var tokenStream = this._tokenStream, + value; + + if (tokenStream.match(Tokens.URI)) { + value = tokenStream.token().value; + this._readWhitespace(); + } else { + value = this._function(); } - socket.close(); - _this._resetState(); - }); - if (queue && queue instanceof ReplaySubject_1.ReplaySubject) { - subscription.add(queue.subscribe(_this.destination)); - } - }; - socket.onerror = function (e) { - _this._resetState(); - observer.error(e); - }; - socket.onclose = function (e) { - _this._resetState(); - var closeObserver = _this.closeObserver; - if (closeObserver) { - closeObserver.next(e); - } - if (e.wasClean) { - observer.complete(); - } - else { - observer.error(e); - } - }; - socket.onmessage = function (e) { - var result = tryCatch_1.tryCatch(_this.resultSelector)(e); - if (result === errorObject_1.errorObject) { - observer.error(errorObject_1.errorObject.e); - } - else { - observer.next(result); - } - }; - }; - WebSocketSubject.prototype._subscribe = function (subscriber) { - var _this = this; - var source = this.source; - if (source) { - return source.subscribe(subscriber); - } - if (!this.socket) { - this._connectSocket(); - } - var subscription = new Subscription_1.Subscription(); - subscription.add(this._output.subscribe(subscriber)); - subscription.add(function () { - var socket = _this.socket; - if (_this._output.observers.length === 0) { - if (socket && socket.readyState === 1) { - socket.close(); + + return value; + }, + + _operator: function(inFunction){ + + /* + * operator (outside function) + * : '/' S* | ',' S* | /( empty )/ + * operator (inside function) + * : '/' S* | '+' S* | '*' S* | '-' S* /( empty )/ + * ; + */ + + var tokenStream = this._tokenStream, + token = null; + + if (tokenStream.match([Tokens.SLASH, Tokens.COMMA]) || + (inFunction && tokenStream.match([Tokens.PLUS, Tokens.STAR, Tokens.MINUS]))){ + token = tokenStream.token(); + this._readWhitespace(); } - _this._resetState(); - } - }); - return subscription; - }; - WebSocketSubject.prototype.unsubscribe = function () { - var _a = this, source = _a.source, socket = _a.socket; - if (socket && socket.readyState === 1) { - socket.close(); - this._resetState(); - } - _super.prototype.unsubscribe.call(this); - if (!source) { - this.destination = new ReplaySubject_1.ReplaySubject(); - } - }; - return WebSocketSubject; -}(Subject_1.AnonymousSubject)); -exports.WebSocketSubject = WebSocketSubject; -//# sourceMappingURL=WebSocketSubject.js.map + return token ? PropertyValuePart.fromToken(token) : null; -/***/ }), -/* 267 */ -/***/ (function(module, exports, __webpack_require__) { + }, -"use strict"; + _combinator: function(){ -var AjaxObservable_1 = __webpack_require__(59); -exports.ajax = AjaxObservable_1.AjaxObservable.create; -//# sourceMappingURL=ajax.js.map + /* + * combinator + * : PLUS S* | GREATER S* | TILDE S* | S+ + * ; + */ -/***/ }), -/* 268 */ -/***/ (function(module, exports, __webpack_require__) { + var tokenStream = this._tokenStream, + value = null, + token; -"use strict"; + if(tokenStream.match([Tokens.PLUS, Tokens.GREATER, Tokens.TILDE])){ + token = tokenStream.token(); + value = new Combinator(token.value, token.startLine, token.startCol); + this._readWhitespace(); + } -var WebSocketSubject_1 = __webpack_require__(266); -exports.webSocket = WebSocketSubject_1.WebSocketSubject.create; -//# sourceMappingURL=webSocket.js.map + return value; + }, -/***/ }), -/* 269 */ -/***/ (function(module, exports, __webpack_require__) { + _unary_operator: function(){ -"use strict"; + /* + * unary_operator + * : '-' | '+' + * ; + */ -var EmptyObservable_1 = __webpack_require__(23); -exports.empty = EmptyObservable_1.EmptyObservable.create; -//# sourceMappingURL=empty.js.map + var tokenStream = this._tokenStream; + + if (tokenStream.match([Tokens.MINUS, Tokens.PLUS])){ + return tokenStream.token().value; + } else { + return null; + } + }, + + _property: function(){ + + /* + * property + * : IDENT S* + * ; + */ + + var tokenStream = this._tokenStream, + value = null, + hack = null, + tokenValue, + token, + line, + col; + + //check for star hack - throws error if not allowed + if (tokenStream.peek() === Tokens.STAR && this.options.starHack){ + tokenStream.get(); + token = tokenStream.token(); + hack = token.value; + line = token.startLine; + col = token.startCol; + } + + if(tokenStream.match(Tokens.IDENT)){ + token = tokenStream.token(); + tokenValue = token.value; + + //check for underscore hack - no error if not allowed because it's valid CSS syntax + if (tokenValue.charAt(0) === "_" && this.options.underscoreHack){ + hack = "_"; + tokenValue = tokenValue.substring(1); + } -/***/ }), -/* 270 */ -/***/ (function(module, exports, __webpack_require__) { + value = new PropertyName(tokenValue, hack, (line||token.startLine), (col||token.startCol)); + this._readWhitespace(); + } -"use strict"; + return value; + }, -var FromEventObservable_1 = __webpack_require__(250); -exports.fromEvent = FromEventObservable_1.FromEventObservable.create; -//# sourceMappingURL=fromEvent.js.map + //Augmented with CSS3 Selectors + _ruleset: function(){ + /* + * ruleset + * : selectors_group + * '{' S* declaration? [ ';' S* declaration? ]* '}' S* + * ; + */ -/***/ }), -/* 271 */ -/***/ (function(module, exports, __webpack_require__) { + var tokenStream = this._tokenStream, + tt, + selectors; -"use strict"; -var FromEventPatternObservable_1 = __webpack_require__(251); -exports.fromEventPattern = FromEventPatternObservable_1.FromEventPatternObservable.create; -//# sourceMappingURL=fromEventPattern.js.map + /* + * Error Recovery: If even a single selector fails to parse, + * then the entire ruleset should be thrown away. + */ + try { + selectors = this._selectors_group(); + } catch (ex){ + if (ex instanceof SyntaxError && !this.options.strict){ + + //fire error event + this.fire({ + type: "error", + error: ex, + message: ex.message, + line: ex.line, + col: ex.col + }); + + //skip over everything until closing brace + tt = tokenStream.advance([Tokens.RBRACE]); + if (tt === Tokens.RBRACE){ + //if there's a right brace, the rule is finished so don't do anything + } else { + //otherwise, rethrow the error because it wasn't handled properly + throw ex; + } -/***/ }), -/* 272 */ -/***/ (function(module, exports, __webpack_require__) { + } else { + //not a syntax error, rethrow it + throw ex; + } -"use strict"; + //trigger parser to continue + return true; + } -var IfObservable_1 = __webpack_require__(253); -exports._if = IfObservable_1.IfObservable.create; -//# sourceMappingURL=if.js.map + //if it got here, all selectors parsed + if (selectors){ -/***/ }), -/* 273 */ -/***/ (function(module, exports, __webpack_require__) { + this.fire({ + type: "startrule", + selectors: selectors, + line: selectors[0].line, + col: selectors[0].col + }); -"use strict"; + this._readDeclarations(true); -var IntervalObservable_1 = __webpack_require__(254); -exports.interval = IntervalObservable_1.IntervalObservable.create; -//# sourceMappingURL=interval.js.map + this.fire({ + type: "endrule", + selectors: selectors, + line: selectors[0].line, + col: selectors[0].col + }); -/***/ }), -/* 274 */ -/***/ (function(module, exports, __webpack_require__) { + } -"use strict"; + return selectors; -var NeverObservable_1 = __webpack_require__(255); -exports.never = NeverObservable_1.NeverObservable.create; -//# sourceMappingURL=never.js.map + }, -/***/ }), -/* 275 */ -/***/ (function(module, exports, __webpack_require__) { + //CSS3 Selectors + _selectors_group: function(){ + + /* + * selectors_group + * : selector [ COMMA S* selector ]* + * ; + */ + var tokenStream = this._tokenStream, + selectors = [], + selector; + + selector = this._selector(); + if (selector !== null){ + + selectors.push(selector); + while(tokenStream.match(Tokens.COMMA)){ + this._readWhitespace(); + selector = this._selector(); + if (selector !== null){ + selectors.push(selector); + } else { + this._unexpectedToken(tokenStream.LT(1)); + } + } + } -"use strict"; + return selectors.length ? selectors : null; + }, -var PairsObservable_1 = __webpack_require__(256); -exports.pairs = PairsObservable_1.PairsObservable.create; -//# sourceMappingURL=pairs.js.map + //CSS3 Selectors + _selector: function(){ + /* + * selector + * : simple_selector_sequence [ combinator simple_selector_sequence ]* + * ; + */ + + var tokenStream = this._tokenStream, + selector = [], + nextSelector = null, + combinator = null, + ws = null; + + //if there's no simple selector, then there's no selector + nextSelector = this._simple_selector_sequence(); + if (nextSelector === null){ + return null; + } -/***/ }), -/* 276 */ -/***/ (function(module, exports, __webpack_require__) { + selector.push(nextSelector); -"use strict"; + do { -var RangeObservable_1 = __webpack_require__(257); -exports.range = RangeObservable_1.RangeObservable.create; -//# sourceMappingURL=range.js.map + //look for a combinator + combinator = this._combinator(); -/***/ }), -/* 277 */ -/***/ (function(module, exports, __webpack_require__) { + if (combinator !== null){ + selector.push(combinator); + nextSelector = this._simple_selector_sequence(); -"use strict"; + //there must be a next selector + if (nextSelector === null){ + this._unexpectedToken(tokenStream.LT(1)); + } else { -var ErrorObservable_1 = __webpack_require__(249); -exports._throw = ErrorObservable_1.ErrorObservable.create; -//# sourceMappingURL=throw.js.map + //nextSelector is an instance of SelectorPart + selector.push(nextSelector); + } + } else { + + //if there's not whitespace, we're done + if (this._readWhitespace()){ + + //add whitespace separator + ws = new Combinator(tokenStream.token().value, tokenStream.token().startLine, tokenStream.token().startCol); + + //combinator is not required + combinator = this._combinator(); + + //selector is required if there's a combinator + nextSelector = this._simple_selector_sequence(); + if (nextSelector === null){ + if (combinator !== null){ + this._unexpectedToken(tokenStream.LT(1)); + } + } else { + + if (combinator !== null){ + selector.push(combinator); + } else { + selector.push(ws); + } + + selector.push(nextSelector); + } + } else { + break; + } -/***/ }), -/* 278 */ -/***/ (function(module, exports, __webpack_require__) { + } + } while(true); -"use strict"; + return new Selector(selector, selector[0].line, selector[0].col); + }, -var TimerObservable_1 = __webpack_require__(259); -exports.timer = TimerObservable_1.TimerObservable.create; -//# sourceMappingURL=timer.js.map + //CSS3 Selectors + _simple_selector_sequence: function(){ + /* + * simple_selector_sequence + * : [ type_selector | universal ] + * [ HASH | class | attrib | pseudo | negation ]* + * | [ HASH | class | attrib | pseudo | negation ]+ + * ; + */ + + var tokenStream = this._tokenStream, + + //parts of a simple selector + elementName = null, + modifiers = [], + + //complete selector text + selectorText= "", + + //the different parts after the element name to search for + components = [ + //HASH + function(){ + return tokenStream.match(Tokens.HASH) ? + new SelectorSubPart(tokenStream.token().value, "id", tokenStream.token().startLine, tokenStream.token().startCol) : + null; + }, + this._class, + this._attrib, + this._pseudo, + this._negation + ], + i = 0, + len = components.length, + component = null, + line, + col; + + + //get starting line and column for the selector + line = tokenStream.LT(1).startLine; + col = tokenStream.LT(1).startCol; + + elementName = this._type_selector(); + if (!elementName){ + elementName = this._universal(); + } -/***/ }), -/* 279 */ -/***/ (function(module, exports, __webpack_require__) { + if (elementName !== null){ + selectorText += elementName; + } -"use strict"; + while(true){ -var UsingObservable_1 = __webpack_require__(260); -exports.using = UsingObservable_1.UsingObservable.create; -//# sourceMappingURL=using.js.map + //whitespace means we're done + if (tokenStream.peek() === Tokens.S){ + break; + } -/***/ }), -/* 280 */ -/***/ (function(module, exports, __webpack_require__) { + //check for each component + while(i < len && component === null){ + component = components[i++].call(this); + } -"use strict"; + if (component === null){ -var zip_1 = __webpack_require__(39); -exports.zip = zip_1.zipStatic; -//# sourceMappingURL=zip.js.map + //we don't have a selector + if (selectorText === ""){ + return null; + } else { + break; + } + } else { + i = 0; + modifiers.push(component); + selectorText += component.toString(); + component = null; + } + } -/***/ }), -/* 281 */ -/***/ (function(module, exports, __webpack_require__) { -"use strict"; + return selectorText !== "" ? + new SelectorPart(elementName, modifiers, selectorText, line, col) : + null; + }, -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; -var tryCatch_1 = __webpack_require__(7); -var errorObject_1 = __webpack_require__(5); -var OuterSubscriber_1 = __webpack_require__(4); -var subscribeToResult_1 = __webpack_require__(3); -/** - * Ignores source values for a duration determined by another Observable, then - * emits the most recent value from the source Observable, then repeats this - * process. - * - * It's like {@link auditTime}, but the silencing - * duration is determined by a second Observable. - * - * - * - * `audit` is similar to `throttle`, but emits the last value from the silenced - * time window, instead of the first value. `audit` emits the most recent value - * from the source Observable on the output Observable as soon as its internal - * timer becomes disabled, and ignores source values while the timer is enabled. - * Initially, the timer is disabled. As soon as the first source value arrives, - * the timer is enabled by calling the `durationSelector` function with the - * source value, which returns the "duration" Observable. When the duration - * Observable emits a value or completes, the timer is disabled, then the most - * recent source value is emitted on the output Observable, and this process - * repeats for the next source value. - * - * @example Emit clicks at a rate of at most one click per second - * var clicks = Rx.Observable.fromEvent(document, 'click'); - * var result = clicks.audit(ev => Rx.Observable.interval(1000)); - * result.subscribe(x => console.log(x)); - * - * @see {@link auditTime} - * @see {@link debounce} - * @see {@link delayWhen} - * @see {@link sample} - * @see {@link throttle} - * - * @param {function(value: T): SubscribableOrPromise} durationSelector A function - * that receives a value from the source Observable, for computing the silencing - * duration, returned as an Observable or a Promise. - * @return {Observable} An Observable that performs rate-limiting of - * emissions from the source Observable. - * @method audit - * @owner Observable - */ -function audit(durationSelector) { - return this.lift(new AuditOperator(durationSelector)); -} -exports.audit = audit; -var AuditOperator = (function () { - function AuditOperator(durationSelector) { - this.durationSelector = durationSelector; - } - AuditOperator.prototype.call = function (subscriber, source) { - return source.subscribe(new AuditSubscriber(subscriber, this.durationSelector)); - }; - return AuditOperator; -}()); -/** - * We need this JSDoc comment for affecting ESDoc. - * @ignore - * @extends {Ignored} - */ -var AuditSubscriber = (function (_super) { - __extends(AuditSubscriber, _super); - function AuditSubscriber(destination, durationSelector) { - _super.call(this, destination); - this.durationSelector = durationSelector; - this.hasValue = false; - } - AuditSubscriber.prototype._next = function (value) { - this.value = value; - this.hasValue = true; - if (!this.throttled) { - var duration = tryCatch_1.tryCatch(this.durationSelector)(value); - if (duration === errorObject_1.errorObject) { - this.destination.error(errorObject_1.errorObject.e); - } - else { - var innerSubscription = subscribeToResult_1.subscribeToResult(this, duration); - if (innerSubscription.closed) { - this.clearThrottle(); + //CSS3 Selectors + _type_selector: function(){ + /* + * type_selector + * : [ namespace_prefix ]? element_name + * ; + */ + + var tokenStream = this._tokenStream, + ns = this._namespace_prefix(), + elementName = this._element_name(); + + if (!elementName){ + /* + * Need to back out the namespace that was read due to both + * type_selector and universal reading namespace_prefix + * first. Kind of hacky, but only way I can figure out + * right now how to not change the grammar. + */ + if (ns){ + tokenStream.unget(); + if (ns.length > 1){ + tokenStream.unget(); + } + } + + return null; + } else { + if (ns){ + elementName.text = ns + elementName.text; + elementName.col -= ns.length; + } + return elementName; } - else { - this.add(this.throttled = innerSubscription); + }, + + //CSS3 Selectors + _class: function(){ + /* + * class + * : '.' IDENT + * ; + */ + + var tokenStream = this._tokenStream, + token; + + if (tokenStream.match(Tokens.DOT)){ + tokenStream.mustMatch(Tokens.IDENT); + token = tokenStream.token(); + return new SelectorSubPart("." + token.value, "class", token.startLine, token.startCol - 1); + } else { + return null; } - } - } - }; - AuditSubscriber.prototype.clearThrottle = function () { - var _a = this, value = _a.value, hasValue = _a.hasValue, throttled = _a.throttled; - if (throttled) { - this.remove(throttled); - this.throttled = null; - throttled.unsubscribe(); - } - if (hasValue) { - this.value = null; - this.hasValue = false; - this.destination.next(value); - } - }; - AuditSubscriber.prototype.notifyNext = function (outerValue, innerValue, outerIndex, innerIndex) { - this.clearThrottle(); - }; - AuditSubscriber.prototype.notifyComplete = function () { - this.clearThrottle(); - }; - return AuditSubscriber; -}(OuterSubscriber_1.OuterSubscriber)); -//# sourceMappingURL=audit.js.map -/***/ }), -/* 282 */ -/***/ (function(module, exports, __webpack_require__) { + }, -"use strict"; + //CSS3 Selectors + _element_name: function(){ + /* + * element_name + * : IDENT + * ; + */ -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; -var async_1 = __webpack_require__(8); -var Subscriber_1 = __webpack_require__(2); -/** - * Ignores source values for `duration` milliseconds, then emits the most recent - * value from the source Observable, then repeats this process. - * - * When it sees a source values, it ignores that plus - * the next ones for `duration` milliseconds, and then it emits the most recent - * value from the source. - * - * - * - * `auditTime` is similar to `throttleTime`, but emits the last value from the - * silenced time window, instead of the first value. `auditTime` emits the most - * recent value from the source Observable on the output Observable as soon as - * its internal timer becomes disabled, and ignores source values while the - * timer is enabled. Initially, the timer is disabled. As soon as the first - * source value arrives, the timer is enabled. After `duration` milliseconds (or - * the time unit determined internally by the optional `scheduler`) has passed, - * the timer is disabled, then the most recent source value is emitted on the - * output Observable, and this process repeats for the next source value. - * Optionally takes a {@link IScheduler} for managing timers. - * - * @example Emit clicks at a rate of at most one click per second - * var clicks = Rx.Observable.fromEvent(document, 'click'); - * var result = clicks.auditTime(1000); - * result.subscribe(x => console.log(x)); - * - * @see {@link audit} - * @see {@link debounceTime} - * @see {@link delay} - * @see {@link sampleTime} - * @see {@link throttleTime} - * - * @param {number} duration Time to wait before emitting the most recent source - * value, measured in milliseconds or the time unit determined internally - * by the optional `scheduler`. - * @param {Scheduler} [scheduler=async] The {@link IScheduler} to use for - * managing the timers that handle the rate-limiting behavior. - * @return {Observable} An Observable that performs rate-limiting of - * emissions from the source Observable. - * @method auditTime - * @owner Observable - */ -function auditTime(duration, scheduler) { - if (scheduler === void 0) { scheduler = async_1.async; } - return this.lift(new AuditTimeOperator(duration, scheduler)); -} -exports.auditTime = auditTime; -var AuditTimeOperator = (function () { - function AuditTimeOperator(duration, scheduler) { - this.duration = duration; - this.scheduler = scheduler; - } - AuditTimeOperator.prototype.call = function (subscriber, source) { - return source.subscribe(new AuditTimeSubscriber(subscriber, this.duration, this.scheduler)); - }; - return AuditTimeOperator; -}()); -/** - * We need this JSDoc comment for affecting ESDoc. - * @ignore - * @extends {Ignored} - */ -var AuditTimeSubscriber = (function (_super) { - __extends(AuditTimeSubscriber, _super); - function AuditTimeSubscriber(destination, duration, scheduler) { - _super.call(this, destination); - this.duration = duration; - this.scheduler = scheduler; - this.hasValue = false; - } - AuditTimeSubscriber.prototype._next = function (value) { - this.value = value; - this.hasValue = true; - if (!this.throttled) { - this.add(this.throttled = this.scheduler.schedule(dispatchNext, this.duration, this)); - } - }; - AuditTimeSubscriber.prototype.clearThrottle = function () { - var _a = this, value = _a.value, hasValue = _a.hasValue, throttled = _a.throttled; - if (throttled) { - this.remove(throttled); - this.throttled = null; - throttled.unsubscribe(); - } - if (hasValue) { - this.value = null; - this.hasValue = false; - this.destination.next(value); - } - }; - return AuditTimeSubscriber; -}(Subscriber_1.Subscriber)); -function dispatchNext(subscriber) { - subscriber.clearThrottle(); -} -//# sourceMappingURL=auditTime.js.map + var tokenStream = this._tokenStream, + token; -/***/ }), -/* 283 */ -/***/ (function(module, exports, __webpack_require__) { + if (tokenStream.match(Tokens.IDENT)){ + token = tokenStream.token(); + return new SelectorSubPart(token.value, "elementName", token.startLine, token.startCol); -"use strict"; + } else { + return null; + } + }, -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; -var OuterSubscriber_1 = __webpack_require__(4); -var subscribeToResult_1 = __webpack_require__(3); -/** - * Buffers the source Observable values until `closingNotifier` emits. - * - * Collects values from the past as an array, and emits - * that array only when another Observable emits. - * - * - * - * Buffers the incoming Observable values until the given `closingNotifier` - * Observable emits a value, at which point it emits the buffer on the output - * Observable and starts a new buffer internally, awaiting the next time - * `closingNotifier` emits. - * - * @example On every click, emit array of most recent interval events - * var clicks = Rx.Observable.fromEvent(document, 'click'); - * var interval = Rx.Observable.interval(1000); - * var buffered = interval.buffer(clicks); - * buffered.subscribe(x => console.log(x)); - * - * @see {@link bufferCount} - * @see {@link bufferTime} - * @see {@link bufferToggle} - * @see {@link bufferWhen} - * @see {@link window} - * - * @param {Observable} closingNotifier An Observable that signals the - * buffer to be emitted on the output Observable. - * @return {Observable} An Observable of buffers, which are arrays of - * values. - * @method buffer - * @owner Observable - */ -function buffer(closingNotifier) { - return this.lift(new BufferOperator(closingNotifier)); -} -exports.buffer = buffer; -var BufferOperator = (function () { - function BufferOperator(closingNotifier) { - this.closingNotifier = closingNotifier; - } - BufferOperator.prototype.call = function (subscriber, source) { - return source.subscribe(new BufferSubscriber(subscriber, this.closingNotifier)); - }; - return BufferOperator; -}()); -/** - * We need this JSDoc comment for affecting ESDoc. - * @ignore - * @extends {Ignored} - */ -var BufferSubscriber = (function (_super) { - __extends(BufferSubscriber, _super); - function BufferSubscriber(destination, closingNotifier) { - _super.call(this, destination); - this.buffer = []; - this.add(subscribeToResult_1.subscribeToResult(this, closingNotifier)); - } - BufferSubscriber.prototype._next = function (value) { - this.buffer.push(value); - }; - BufferSubscriber.prototype.notifyNext = function (outerValue, innerValue, outerIndex, innerIndex, innerSub) { - var buffer = this.buffer; - this.buffer = []; - this.destination.next(buffer); - }; - return BufferSubscriber; -}(OuterSubscriber_1.OuterSubscriber)); -//# sourceMappingURL=buffer.js.map + //CSS3 Selectors + _namespace_prefix: function(){ + /* + * namespace_prefix + * : [ IDENT | '*' ]? '|' + * ; + */ + var tokenStream = this._tokenStream, + value = ""; + + //verify that this is a namespace prefix + if (tokenStream.LA(1) === Tokens.PIPE || tokenStream.LA(2) === Tokens.PIPE){ + + if(tokenStream.match([Tokens.IDENT, Tokens.STAR])){ + value += tokenStream.token().value; + } -/***/ }), -/* 284 */ -/***/ (function(module, exports, __webpack_require__) { + tokenStream.mustMatch(Tokens.PIPE); + value += "|"; -"use strict"; + } -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; -var Subscriber_1 = __webpack_require__(2); -/** - * Buffers the source Observable values until the size hits the maximum - * `bufferSize` given. - * - * Collects values from the past as an array, and emits - * that array only when its size reaches `bufferSize`. - * - * - * - * Buffers a number of values from the source Observable by `bufferSize` then - * emits the buffer and clears it, and starts a new buffer each - * `startBufferEvery` values. If `startBufferEvery` is not provided or is - * `null`, then new buffers are started immediately at the start of the source - * and when each buffer closes and is emitted. - * - * @example Emit the last two click events as an array - * var clicks = Rx.Observable.fromEvent(document, 'click'); - * var buffered = clicks.bufferCount(2); - * buffered.subscribe(x => console.log(x)); - * - * @example On every click, emit the last two click events as an array - * var clicks = Rx.Observable.fromEvent(document, 'click'); - * var buffered = clicks.bufferCount(2, 1); - * buffered.subscribe(x => console.log(x)); - * - * @see {@link buffer} - * @see {@link bufferTime} - * @see {@link bufferToggle} - * @see {@link bufferWhen} - * @see {@link pairwise} - * @see {@link windowCount} - * - * @param {number} bufferSize The maximum size of the buffer emitted. - * @param {number} [startBufferEvery] Interval at which to start a new buffer. - * For example if `startBufferEvery` is `2`, then a new buffer will be started - * on every other value from the source. A new buffer is started at the - * beginning of the source by default. - * @return {Observable} An Observable of arrays of buffered values. - * @method bufferCount - * @owner Observable - */ -function bufferCount(bufferSize, startBufferEvery) { - if (startBufferEvery === void 0) { startBufferEvery = null; } - return this.lift(new BufferCountOperator(bufferSize, startBufferEvery)); -} -exports.bufferCount = bufferCount; -var BufferCountOperator = (function () { - function BufferCountOperator(bufferSize, startBufferEvery) { - this.bufferSize = bufferSize; - this.startBufferEvery = startBufferEvery; - if (!startBufferEvery || bufferSize === startBufferEvery) { - this.subscriberClass = BufferCountSubscriber; - } - else { - this.subscriberClass = BufferSkipCountSubscriber; - } - } - BufferCountOperator.prototype.call = function (subscriber, source) { - return source.subscribe(new this.subscriberClass(subscriber, this.bufferSize, this.startBufferEvery)); - }; - return BufferCountOperator; -}()); -/** - * We need this JSDoc comment for affecting ESDoc. - * @ignore - * @extends {Ignored} - */ -var BufferCountSubscriber = (function (_super) { - __extends(BufferCountSubscriber, _super); - function BufferCountSubscriber(destination, bufferSize) { - _super.call(this, destination); - this.bufferSize = bufferSize; - this.buffer = []; - } - BufferCountSubscriber.prototype._next = function (value) { - var buffer = this.buffer; - buffer.push(value); - if (buffer.length == this.bufferSize) { - this.destination.next(buffer); - this.buffer = []; - } - }; - BufferCountSubscriber.prototype._complete = function () { - var buffer = this.buffer; - if (buffer.length > 0) { - this.destination.next(buffer); - } - _super.prototype._complete.call(this); - }; - return BufferCountSubscriber; -}(Subscriber_1.Subscriber)); -/** - * We need this JSDoc comment for affecting ESDoc. - * @ignore - * @extends {Ignored} - */ -var BufferSkipCountSubscriber = (function (_super) { - __extends(BufferSkipCountSubscriber, _super); - function BufferSkipCountSubscriber(destination, bufferSize, startBufferEvery) { - _super.call(this, destination); - this.bufferSize = bufferSize; - this.startBufferEvery = startBufferEvery; - this.buffers = []; - this.count = 0; - } - BufferSkipCountSubscriber.prototype._next = function (value) { - var _a = this, bufferSize = _a.bufferSize, startBufferEvery = _a.startBufferEvery, buffers = _a.buffers, count = _a.count; - this.count++; - if (count % startBufferEvery === 0) { - buffers.push([]); - } - for (var i = buffers.length; i--;) { - var buffer = buffers[i]; - buffer.push(value); - if (buffer.length === bufferSize) { - buffers.splice(i, 1); - this.destination.next(buffer); - } - } - }; - BufferSkipCountSubscriber.prototype._complete = function () { - var _a = this, buffers = _a.buffers, destination = _a.destination; - while (buffers.length > 0) { - var buffer = buffers.shift(); - if (buffer.length > 0) { - destination.next(buffer); - } - } - _super.prototype._complete.call(this); - }; - return BufferSkipCountSubscriber; -}(Subscriber_1.Subscriber)); -//# sourceMappingURL=bufferCount.js.map + return value.length ? value : null; + }, + + //CSS3 Selectors + _universal: function(){ + /* + * universal + * : [ namespace_prefix ]? '*' + * ; + */ + var tokenStream = this._tokenStream, + value = "", + ns; + + ns = this._namespace_prefix(); + if(ns){ + value += ns; + } + + if(tokenStream.match(Tokens.STAR)){ + value += "*"; + } -/***/ }), -/* 285 */ -/***/ (function(module, exports, __webpack_require__) { + return value.length ? value : null; + + }, + + //CSS3 Selectors + _attrib: function(){ + /* + * attrib + * : '[' S* [ namespace_prefix ]? IDENT S* + * [ [ PREFIXMATCH | + * SUFFIXMATCH | + * SUBSTRINGMATCH | + * '=' | + * INCLUDES | + * DASHMATCH ] S* [ IDENT | STRING ] S* + * ]? ']' + * ; + */ + + var tokenStream = this._tokenStream, + value = null, + ns, + token; + + if (tokenStream.match(Tokens.LBRACKET)){ + token = tokenStream.token(); + value = token.value; + value += this._readWhitespace(); + + ns = this._namespace_prefix(); + + if (ns){ + value += ns; + } -"use strict"; + tokenStream.mustMatch(Tokens.IDENT); + value += tokenStream.token().value; + value += this._readWhitespace(); -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; -var async_1 = __webpack_require__(8); -var Subscriber_1 = __webpack_require__(2); -var isScheduler_1 = __webpack_require__(13); -/* tslint:enable:max-line-length */ -/** - * Buffers the source Observable values for a specific time period. - * - * Collects values from the past as an array, and emits - * those arrays periodically in time. - * - * - * - * Buffers values from the source for a specific time duration `bufferTimeSpan`. - * Unless the optional argument `bufferCreationInterval` is given, it emits and - * resets the buffer every `bufferTimeSpan` milliseconds. If - * `bufferCreationInterval` is given, this operator opens the buffer every - * `bufferCreationInterval` milliseconds and closes (emits and resets) the - * buffer every `bufferTimeSpan` milliseconds. When the optional argument - * `maxBufferSize` is specified, the buffer will be closed either after - * `bufferTimeSpan` milliseconds or when it contains `maxBufferSize` elements. - * - * @example Every second, emit an array of the recent click events - * var clicks = Rx.Observable.fromEvent(document, 'click'); - * var buffered = clicks.bufferTime(1000); - * buffered.subscribe(x => console.log(x)); - * - * @example Every 5 seconds, emit the click events from the next 2 seconds - * var clicks = Rx.Observable.fromEvent(document, 'click'); - * var buffered = clicks.bufferTime(2000, 5000); - * buffered.subscribe(x => console.log(x)); - * - * @see {@link buffer} - * @see {@link bufferCount} - * @see {@link bufferToggle} - * @see {@link bufferWhen} - * @see {@link windowTime} - * - * @param {number} bufferTimeSpan The amount of time to fill each buffer array. - * @param {number} [bufferCreationInterval] The interval at which to start new - * buffers. - * @param {number} [maxBufferSize] The maximum buffer size. - * @param {Scheduler} [scheduler=async] The scheduler on which to schedule the - * intervals that determine buffer boundaries. - * @return {Observable} An observable of arrays of buffered values. - * @method bufferTime - * @owner Observable - */ -function bufferTime(bufferTimeSpan) { - var length = arguments.length; - var scheduler = async_1.async; - if (isScheduler_1.isScheduler(arguments[arguments.length - 1])) { - scheduler = arguments[arguments.length - 1]; - length--; - } - var bufferCreationInterval = null; - if (length >= 2) { - bufferCreationInterval = arguments[1]; - } - var maxBufferSize = Number.POSITIVE_INFINITY; - if (length >= 3) { - maxBufferSize = arguments[2]; - } - return this.lift(new BufferTimeOperator(bufferTimeSpan, bufferCreationInterval, maxBufferSize, scheduler)); -} -exports.bufferTime = bufferTime; -var BufferTimeOperator = (function () { - function BufferTimeOperator(bufferTimeSpan, bufferCreationInterval, maxBufferSize, scheduler) { - this.bufferTimeSpan = bufferTimeSpan; - this.bufferCreationInterval = bufferCreationInterval; - this.maxBufferSize = maxBufferSize; - this.scheduler = scheduler; - } - BufferTimeOperator.prototype.call = function (subscriber, source) { - return source.subscribe(new BufferTimeSubscriber(subscriber, this.bufferTimeSpan, this.bufferCreationInterval, this.maxBufferSize, this.scheduler)); - }; - return BufferTimeOperator; -}()); -var Context = (function () { - function Context() { - this.buffer = []; - } - return Context; -}()); -/** - * We need this JSDoc comment for affecting ESDoc. - * @ignore - * @extends {Ignored} - */ -var BufferTimeSubscriber = (function (_super) { - __extends(BufferTimeSubscriber, _super); - function BufferTimeSubscriber(destination, bufferTimeSpan, bufferCreationInterval, maxBufferSize, scheduler) { - _super.call(this, destination); - this.bufferTimeSpan = bufferTimeSpan; - this.bufferCreationInterval = bufferCreationInterval; - this.maxBufferSize = maxBufferSize; - this.scheduler = scheduler; - this.contexts = []; - var context = this.openContext(); - this.timespanOnly = bufferCreationInterval == null || bufferCreationInterval < 0; - if (this.timespanOnly) { - var timeSpanOnlyState = { subscriber: this, context: context, bufferTimeSpan: bufferTimeSpan }; - this.add(context.closeAction = scheduler.schedule(dispatchBufferTimeSpanOnly, bufferTimeSpan, timeSpanOnlyState)); - } - else { - var closeState = { subscriber: this, context: context }; - var creationState = { bufferTimeSpan: bufferTimeSpan, bufferCreationInterval: bufferCreationInterval, subscriber: this, scheduler: scheduler }; - this.add(context.closeAction = scheduler.schedule(dispatchBufferClose, bufferTimeSpan, closeState)); - this.add(scheduler.schedule(dispatchBufferCreation, bufferCreationInterval, creationState)); - } - } - BufferTimeSubscriber.prototype._next = function (value) { - var contexts = this.contexts; - var len = contexts.length; - var filledBufferContext; - for (var i = 0; i < len; i++) { - var context = contexts[i]; - var buffer = context.buffer; - buffer.push(value); - if (buffer.length == this.maxBufferSize) { - filledBufferContext = context; - } - } - if (filledBufferContext) { - this.onBufferFull(filledBufferContext); - } - }; - BufferTimeSubscriber.prototype._error = function (err) { - this.contexts.length = 0; - _super.prototype._error.call(this, err); - }; - BufferTimeSubscriber.prototype._complete = function () { - var _a = this, contexts = _a.contexts, destination = _a.destination; - while (contexts.length > 0) { - var context = contexts.shift(); - destination.next(context.buffer); - } - _super.prototype._complete.call(this); - }; - BufferTimeSubscriber.prototype._unsubscribe = function () { - this.contexts = null; - }; - BufferTimeSubscriber.prototype.onBufferFull = function (context) { - this.closeContext(context); - var closeAction = context.closeAction; - closeAction.unsubscribe(); - this.remove(closeAction); - if (!this.closed && this.timespanOnly) { - context = this.openContext(); - var bufferTimeSpan = this.bufferTimeSpan; - var timeSpanOnlyState = { subscriber: this, context: context, bufferTimeSpan: bufferTimeSpan }; - this.add(context.closeAction = this.scheduler.schedule(dispatchBufferTimeSpanOnly, bufferTimeSpan, timeSpanOnlyState)); - } - }; - BufferTimeSubscriber.prototype.openContext = function () { - var context = new Context(); - this.contexts.push(context); - return context; - }; - BufferTimeSubscriber.prototype.closeContext = function (context) { - this.destination.next(context.buffer); - var contexts = this.contexts; - var spliceIndex = contexts ? contexts.indexOf(context) : -1; - if (spliceIndex >= 0) { - contexts.splice(contexts.indexOf(context), 1); - } - }; - return BufferTimeSubscriber; -}(Subscriber_1.Subscriber)); -function dispatchBufferTimeSpanOnly(state) { - var subscriber = state.subscriber; - var prevContext = state.context; - if (prevContext) { - subscriber.closeContext(prevContext); - } - if (!subscriber.closed) { - state.context = subscriber.openContext(); - state.context.closeAction = this.schedule(state, state.bufferTimeSpan); - } -} -function dispatchBufferCreation(state) { - var bufferCreationInterval = state.bufferCreationInterval, bufferTimeSpan = state.bufferTimeSpan, subscriber = state.subscriber, scheduler = state.scheduler; - var context = subscriber.openContext(); - var action = this; - if (!subscriber.closed) { - subscriber.add(context.closeAction = scheduler.schedule(dispatchBufferClose, bufferTimeSpan, { subscriber: subscriber, context: context })); - action.schedule(state, bufferCreationInterval); - } -} -function dispatchBufferClose(arg) { - var subscriber = arg.subscriber, context = arg.context; - subscriber.closeContext(context); -} -//# sourceMappingURL=bufferTime.js.map + if(tokenStream.match([Tokens.PREFIXMATCH, Tokens.SUFFIXMATCH, Tokens.SUBSTRINGMATCH, + Tokens.EQUALS, Tokens.INCLUDES, Tokens.DASHMATCH])){ -/***/ }), -/* 286 */ -/***/ (function(module, exports, __webpack_require__) { + value += tokenStream.token().value; + value += this._readWhitespace(); -"use strict"; + tokenStream.mustMatch([Tokens.IDENT, Tokens.STRING]); + value += tokenStream.token().value; + value += this._readWhitespace(); + } -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; -var Subscription_1 = __webpack_require__(9); -var subscribeToResult_1 = __webpack_require__(3); -var OuterSubscriber_1 = __webpack_require__(4); -/** - * Buffers the source Observable values starting from an emission from - * `openings` and ending when the output of `closingSelector` emits. - * - * Collects values from the past as an array. Starts - * collecting only when `opening` emits, and calls the `closingSelector` - * function to get an Observable that tells when to close the buffer. - * - * - * - * Buffers values from the source by opening the buffer via signals from an - * Observable provided to `openings`, and closing and sending the buffers when - * a Subscribable or Promise returned by the `closingSelector` function emits. - * - * @example Every other second, emit the click events from the next 500ms - * var clicks = Rx.Observable.fromEvent(document, 'click'); - * var openings = Rx.Observable.interval(1000); - * var buffered = clicks.bufferToggle(openings, i => - * i % 2 ? Rx.Observable.interval(500) : Rx.Observable.empty() - * ); - * buffered.subscribe(x => console.log(x)); - * - * @see {@link buffer} - * @see {@link bufferCount} - * @see {@link bufferTime} - * @see {@link bufferWhen} - * @see {@link windowToggle} - * - * @param {SubscribableOrPromise} openings A Subscribable or Promise of notifications to start new - * buffers. - * @param {function(value: O): SubscribableOrPromise} closingSelector A function that takes - * the value emitted by the `openings` observable and returns a Subscribable or Promise, - * which, when it emits, signals that the associated buffer should be emitted - * and cleared. - * @return {Observable} An observable of arrays of buffered values. - * @method bufferToggle - * @owner Observable - */ -function bufferToggle(openings, closingSelector) { - return this.lift(new BufferToggleOperator(openings, closingSelector)); -} -exports.bufferToggle = bufferToggle; -var BufferToggleOperator = (function () { - function BufferToggleOperator(openings, closingSelector) { - this.openings = openings; - this.closingSelector = closingSelector; - } - BufferToggleOperator.prototype.call = function (subscriber, source) { - return source.subscribe(new BufferToggleSubscriber(subscriber, this.openings, this.closingSelector)); - }; - return BufferToggleOperator; -}()); -/** - * We need this JSDoc comment for affecting ESDoc. - * @ignore - * @extends {Ignored} - */ -var BufferToggleSubscriber = (function (_super) { - __extends(BufferToggleSubscriber, _super); - function BufferToggleSubscriber(destination, openings, closingSelector) { - _super.call(this, destination); - this.openings = openings; - this.closingSelector = closingSelector; - this.contexts = []; - this.add(subscribeToResult_1.subscribeToResult(this, openings)); - } - BufferToggleSubscriber.prototype._next = function (value) { - var contexts = this.contexts; - var len = contexts.length; - for (var i = 0; i < len; i++) { - contexts[i].buffer.push(value); - } - }; - BufferToggleSubscriber.prototype._error = function (err) { - var contexts = this.contexts; - while (contexts.length > 0) { - var context = contexts.shift(); - context.subscription.unsubscribe(); - context.buffer = null; - context.subscription = null; - } - this.contexts = null; - _super.prototype._error.call(this, err); - }; - BufferToggleSubscriber.prototype._complete = function () { - var contexts = this.contexts; - while (contexts.length > 0) { - var context = contexts.shift(); - this.destination.next(context.buffer); - context.subscription.unsubscribe(); - context.buffer = null; - context.subscription = null; - } - this.contexts = null; - _super.prototype._complete.call(this); - }; - BufferToggleSubscriber.prototype.notifyNext = function (outerValue, innerValue, outerIndex, innerIndex, innerSub) { - outerValue ? this.closeBuffer(outerValue) : this.openBuffer(innerValue); - }; - BufferToggleSubscriber.prototype.notifyComplete = function (innerSub) { - this.closeBuffer(innerSub.context); - }; - BufferToggleSubscriber.prototype.openBuffer = function (value) { - try { - var closingSelector = this.closingSelector; - var closingNotifier = closingSelector.call(this, value); - if (closingNotifier) { - this.trySubscribe(closingNotifier); - } - } - catch (err) { - this._error(err); - } - }; - BufferToggleSubscriber.prototype.closeBuffer = function (context) { - var contexts = this.contexts; - if (contexts && context) { - var buffer = context.buffer, subscription = context.subscription; - this.destination.next(buffer); - contexts.splice(contexts.indexOf(context), 1); - this.remove(subscription); - subscription.unsubscribe(); - } - }; - BufferToggleSubscriber.prototype.trySubscribe = function (closingNotifier) { - var contexts = this.contexts; - var buffer = []; - var subscription = new Subscription_1.Subscription(); - var context = { buffer: buffer, subscription: subscription }; - contexts.push(context); - var innerSubscription = subscribeToResult_1.subscribeToResult(this, closingNotifier, context); - if (!innerSubscription || innerSubscription.closed) { - this.closeBuffer(context); - } - else { - innerSubscription.context = context; - this.add(innerSubscription); - subscription.add(innerSubscription); - } - }; - return BufferToggleSubscriber; -}(OuterSubscriber_1.OuterSubscriber)); -//# sourceMappingURL=bufferToggle.js.map + tokenStream.mustMatch(Tokens.RBRACKET); -/***/ }), -/* 287 */ -/***/ (function(module, exports, __webpack_require__) { + return new SelectorSubPart(value + "]", "attribute", token.startLine, token.startCol); + } else { + return null; + } + }, -"use strict"; + //CSS3 Selectors + _pseudo: function(){ -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; -var Subscription_1 = __webpack_require__(9); -var tryCatch_1 = __webpack_require__(7); -var errorObject_1 = __webpack_require__(5); -var OuterSubscriber_1 = __webpack_require__(4); -var subscribeToResult_1 = __webpack_require__(3); -/** - * Buffers the source Observable values, using a factory function of closing - * Observables to determine when to close, emit, and reset the buffer. - * - * Collects values from the past as an array. When it - * starts collecting values, it calls a function that returns an Observable that - * tells when to close the buffer and restart collecting. - * - * - * - * Opens a buffer immediately, then closes the buffer when the observable - * returned by calling `closingSelector` function emits a value. When it closes - * the buffer, it immediately opens a new buffer and repeats the process. - * - * @example Emit an array of the last clicks every [1-5] random seconds - * var clicks = Rx.Observable.fromEvent(document, 'click'); - * var buffered = clicks.bufferWhen(() => - * Rx.Observable.interval(1000 + Math.random() * 4000) - * ); - * buffered.subscribe(x => console.log(x)); - * - * @see {@link buffer} - * @see {@link bufferCount} - * @see {@link bufferTime} - * @see {@link bufferToggle} - * @see {@link windowWhen} - * - * @param {function(): Observable} closingSelector A function that takes no - * arguments and returns an Observable that signals buffer closure. - * @return {Observable} An observable of arrays of buffered values. - * @method bufferWhen - * @owner Observable - */ -function bufferWhen(closingSelector) { - return this.lift(new BufferWhenOperator(closingSelector)); -} -exports.bufferWhen = bufferWhen; -var BufferWhenOperator = (function () { - function BufferWhenOperator(closingSelector) { - this.closingSelector = closingSelector; - } - BufferWhenOperator.prototype.call = function (subscriber, source) { - return source.subscribe(new BufferWhenSubscriber(subscriber, this.closingSelector)); - }; - return BufferWhenOperator; -}()); -/** - * We need this JSDoc comment for affecting ESDoc. - * @ignore - * @extends {Ignored} - */ -var BufferWhenSubscriber = (function (_super) { - __extends(BufferWhenSubscriber, _super); - function BufferWhenSubscriber(destination, closingSelector) { - _super.call(this, destination); - this.closingSelector = closingSelector; - this.subscribing = false; - this.openBuffer(); - } - BufferWhenSubscriber.prototype._next = function (value) { - this.buffer.push(value); - }; - BufferWhenSubscriber.prototype._complete = function () { - var buffer = this.buffer; - if (buffer) { - this.destination.next(buffer); - } - _super.prototype._complete.call(this); - }; - BufferWhenSubscriber.prototype._unsubscribe = function () { - this.buffer = null; - this.subscribing = false; - }; - BufferWhenSubscriber.prototype.notifyNext = function (outerValue, innerValue, outerIndex, innerIndex, innerSub) { - this.openBuffer(); - }; - BufferWhenSubscriber.prototype.notifyComplete = function () { - if (this.subscribing) { - this.complete(); - } - else { - this.openBuffer(); - } - }; - BufferWhenSubscriber.prototype.openBuffer = function () { - var closingSubscription = this.closingSubscription; - if (closingSubscription) { - this.remove(closingSubscription); - closingSubscription.unsubscribe(); - } - var buffer = this.buffer; - if (this.buffer) { - this.destination.next(buffer); - } - this.buffer = []; - var closingNotifier = tryCatch_1.tryCatch(this.closingSelector)(); - if (closingNotifier === errorObject_1.errorObject) { - this.error(errorObject_1.errorObject.e); - } - else { - closingSubscription = new Subscription_1.Subscription(); - this.closingSubscription = closingSubscription; - this.add(closingSubscription); - this.subscribing = true; - closingSubscription.add(subscribeToResult_1.subscribeToResult(this, closingNotifier)); - this.subscribing = false; - } - }; - return BufferWhenSubscriber; -}(OuterSubscriber_1.OuterSubscriber)); -//# sourceMappingURL=bufferWhen.js.map + /* + * pseudo + * : ':' ':'? [ IDENT | functional_pseudo ] + * ; + */ -/***/ }), -/* 288 */ -/***/ (function(module, exports, __webpack_require__) { + var tokenStream = this._tokenStream, + pseudo = null, + colons = ":", + line, + col; -"use strict"; + if (tokenStream.match(Tokens.COLON)){ -var combineLatest_1 = __webpack_require__(37); -/** - * Converts a higher-order Observable into a first-order Observable by waiting - * for the outer Observable to complete, then applying {@link combineLatest}. - * - * Flattens an Observable-of-Observables by applying - * {@link combineLatest} when the Observable-of-Observables completes. - * - * - * - * Takes an Observable of Observables, and collects all Observables from it. - * Once the outer Observable completes, it subscribes to all collected - * Observables and combines their values using the {@link combineLatest} - * strategy, such that: - * - Every time an inner Observable emits, the output Observable emits. - * - When the returned observable emits, it emits all of the latest values by: - * - If a `project` function is provided, it is called with each recent value - * from each inner Observable in whatever order they arrived, and the result - * of the `project` function is what is emitted by the output Observable. - * - If there is no `project` function, an array of all of the most recent - * values is emitted by the output Observable. - * - * @example Map two click events to a finite interval Observable, then apply combineAll - * var clicks = Rx.Observable.fromEvent(document, 'click'); - * var higherOrder = clicks.map(ev => - * Rx.Observable.interval(Math.random()*2000).take(3) - * ).take(2); - * var result = higherOrder.combineAll(); - * result.subscribe(x => console.log(x)); - * - * @see {@link combineLatest} - * @see {@link mergeAll} - * - * @param {function} [project] An optional function to map the most recent - * values from each inner Observable into a new result. Takes each of the most - * recent values from each collected inner Observable as arguments, in order. - * @return {Observable} An Observable of projected results or arrays of recent - * values. - * @method combineAll - * @owner Observable - */ -function combineAll(project) { - return this.lift(new combineLatest_1.CombineLatestOperator(project)); -} -exports.combineAll = combineAll; -//# sourceMappingURL=combineAll.js.map + if (tokenStream.match(Tokens.COLON)){ + colons += ":"; + } -/***/ }), -/* 289 */ -/***/ (function(module, exports, __webpack_require__) { + if (tokenStream.match(Tokens.IDENT)){ + pseudo = tokenStream.token().value; + line = tokenStream.token().startLine; + col = tokenStream.token().startCol - colons.length; + } else if (tokenStream.peek() === Tokens.FUNCTION){ + line = tokenStream.LT(1).startLine; + col = tokenStream.LT(1).startCol - colons.length; + pseudo = this._functional_pseudo(); + } -"use strict"; + if (pseudo){ + pseudo = new SelectorSubPart(colons + pseudo, "pseudo", line, col); + } + } -var mergeMapTo_1 = __webpack_require__(62); -/* tslint:enable:max-line-length */ -/** - * Projects each source value to the same Observable which is merged multiple - * times in a serialized fashion on the output Observable. - * - * It's like {@link concatMap}, but maps each value - * always to the same inner Observable. - * - * - * - * Maps each source value to the given Observable `innerObservable` regardless - * of the source value, and then flattens those resulting Observables into one - * single Observable, which is the output Observable. Each new `innerObservable` - * instance emitted on the output Observable is concatenated with the previous - * `innerObservable` instance. - * - * __Warning:__ if source values arrive endlessly and faster than their - * corresponding inner Observables can complete, it will result in memory issues - * as inner Observables amass in an unbounded buffer waiting for their turn to - * be subscribed to. - * - * Note: `concatMapTo` is equivalent to `mergeMapTo` with concurrency parameter - * set to `1`. - * - * @example For each click event, tick every second from 0 to 3, with no concurrency - * var clicks = Rx.Observable.fromEvent(document, 'click'); - * var result = clicks.concatMapTo(Rx.Observable.interval(1000).take(4)); - * result.subscribe(x => console.log(x)); - * - * // Results in the following: - * // (results are not concurrent) - * // For every click on the "document" it will emit values 0 to 3 spaced - * // on a 1000ms interval - * // one click = 1000ms-> 0 -1000ms-> 1 -1000ms-> 2 -1000ms-> 3 - * - * @see {@link concat} - * @see {@link concatAll} - * @see {@link concatMap} - * @see {@link mergeMapTo} - * @see {@link switchMapTo} - * - * @param {ObservableInput} innerObservable An Observable to replace each value from - * the source Observable. - * @param {function(outerValue: T, innerValue: I, outerIndex: number, innerIndex: number): any} [resultSelector] - * A function to produce the value on the output Observable based on the values - * and the indices of the source (outer) emission and the inner Observable - * emission. The arguments passed to this function are: - * - `outerValue`: the value that came from the source - * - `innerValue`: the value that came from the projected Observable - * - `outerIndex`: the "index" of the value that came from the source - * - `innerIndex`: the "index" of the value from the projected Observable - * @return {Observable} An observable of values merged together by joining the - * passed observable with itself, one after the other, for each value emitted - * from the source. - * @method concatMapTo - * @owner Observable - */ -function concatMapTo(innerObservable, resultSelector) { - return this.lift(new mergeMapTo_1.MergeMapToOperator(innerObservable, resultSelector, 1)); -} -exports.concatMapTo = concatMapTo; -//# sourceMappingURL=concatMapTo.js.map + return pseudo; + }, -/***/ }), -/* 290 */ -/***/ (function(module, exports, __webpack_require__) { + //CSS3 Selectors + _functional_pseudo: function(){ + /* + * functional_pseudo + * : FUNCTION S* expression ')' + * ; + */ + + var tokenStream = this._tokenStream, + value = null; + + if(tokenStream.match(Tokens.FUNCTION)){ + value = tokenStream.token().value; + value += this._readWhitespace(); + value += this._expression(); + tokenStream.mustMatch(Tokens.RPAREN); + value += ")"; + } -"use strict"; + return value; + }, -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; -var Subscriber_1 = __webpack_require__(2); -/** - * Counts the number of emissions on the source and emits that number when the - * source completes. - * - * Tells how many values were emitted, when the source - * completes. - * - * - * - * `count` transforms an Observable that emits values into an Observable that - * emits a single value that represents the number of values emitted by the - * source Observable. If the source Observable terminates with an error, `count` - * will pass this error notification along without emitting a value first. If - * the source Observable does not terminate at all, `count` will neither emit - * a value nor terminate. This operator takes an optional `predicate` function - * as argument, in which case the output emission will represent the number of - * source values that matched `true` with the `predicate`. - * - * @example Counts how many seconds have passed before the first click happened - * var seconds = Rx.Observable.interval(1000); - * var clicks = Rx.Observable.fromEvent(document, 'click'); - * var secondsBeforeClick = seconds.takeUntil(clicks); - * var result = secondsBeforeClick.count(); - * result.subscribe(x => console.log(x)); - * - * @example Counts how many odd numbers are there between 1 and 7 - * var numbers = Rx.Observable.range(1, 7); - * var result = numbers.count(i => i % 2 === 1); - * result.subscribe(x => console.log(x)); - * - * // Results in: - * // 4 - * - * @see {@link max} - * @see {@link min} - * @see {@link reduce} - * - * @param {function(value: T, i: number, source: Observable): boolean} [predicate] A - * boolean function to select what values are to be counted. It is provided with - * arguments of: - * - `value`: the value from the source Observable. - * - `index`: the (zero-based) "index" of the value from the source Observable. - * - `source`: the source Observable instance itself. - * @return {Observable} An Observable of one number that represents the count as - * described above. - * @method count - * @owner Observable - */ -function count(predicate) { - return this.lift(new CountOperator(predicate, this)); -} -exports.count = count; -var CountOperator = (function () { - function CountOperator(predicate, source) { - this.predicate = predicate; - this.source = source; - } - CountOperator.prototype.call = function (subscriber, source) { - return source.subscribe(new CountSubscriber(subscriber, this.predicate, this.source)); - }; - return CountOperator; -}()); -/** - * We need this JSDoc comment for affecting ESDoc. - * @ignore - * @extends {Ignored} - */ -var CountSubscriber = (function (_super) { - __extends(CountSubscriber, _super); - function CountSubscriber(destination, predicate, source) { - _super.call(this, destination); - this.predicate = predicate; - this.source = source; - this.count = 0; - this.index = 0; - } - CountSubscriber.prototype._next = function (value) { - if (this.predicate) { - this._tryPredicate(value); - } - else { - this.count++; - } - }; - CountSubscriber.prototype._tryPredicate = function (value) { - var result; - try { - result = this.predicate(value, this.index++, this.source); - } - catch (err) { - this.destination.error(err); - return; - } - if (result) { - this.count++; - } - }; - CountSubscriber.prototype._complete = function () { - this.destination.next(this.count); - this.destination.complete(); - }; - return CountSubscriber; -}(Subscriber_1.Subscriber)); -//# sourceMappingURL=count.js.map + //CSS3 Selectors + _expression: function(){ + /* + * expression + * : [ [ PLUS | '-' | DIMENSION | NUMBER | STRING | IDENT ] S* ]+ + * ; + */ + + var tokenStream = this._tokenStream, + value = ""; + + while(tokenStream.match([Tokens.PLUS, Tokens.MINUS, Tokens.DIMENSION, + Tokens.NUMBER, Tokens.STRING, Tokens.IDENT, Tokens.LENGTH, + Tokens.FREQ, Tokens.ANGLE, Tokens.TIME, + Tokens.RESOLUTION, Tokens.SLASH])){ + + value += tokenStream.token().value; + value += this._readWhitespace(); + } + + return value.length ? value : null; + + }, + + //CSS3 Selectors + _negation: function(){ + /* + * negation + * : NOT S* negation_arg S* ')' + * ; + */ + + var tokenStream = this._tokenStream, + line, + col, + value = "", + arg, + subpart = null; + + if (tokenStream.match(Tokens.NOT)){ + value = tokenStream.token().value; + line = tokenStream.token().startLine; + col = tokenStream.token().startCol; + value += this._readWhitespace(); + arg = this._negation_arg(); + value += arg; + value += this._readWhitespace(); + tokenStream.match(Tokens.RPAREN); + value += tokenStream.token().value; + + subpart = new SelectorSubPart(value, "not", line, col); + subpart.args.push(arg); + } + + return subpart; + }, + + //CSS3 Selectors + _negation_arg: function(){ + /* + * negation_arg + * : type_selector | universal | HASH | class | attrib | pseudo + * ; + */ + + var tokenStream = this._tokenStream, + args = [ + this._type_selector, + this._universal, + function(){ + return tokenStream.match(Tokens.HASH) ? + new SelectorSubPart(tokenStream.token().value, "id", tokenStream.token().startLine, tokenStream.token().startCol) : + null; + }, + this._class, + this._attrib, + this._pseudo + ], + arg = null, + i = 0, + len = args.length, + line, + col, + part; + + line = tokenStream.LT(1).startLine; + col = tokenStream.LT(1).startCol; + + while(i < len && arg === null){ + + arg = args[i].call(this); + i++; + } + + //must be a negation arg + if (arg === null){ + this._unexpectedToken(tokenStream.LT(1)); + } + + //it's an element name + if (arg.type === "elementName"){ + part = new SelectorPart(arg, [], arg.toString(), line, col); + } else { + part = new SelectorPart(null, [arg], arg.toString(), line, col); + } + + return part; + }, + + _declaration: function(){ + + /* + * declaration + * : property ':' S* expr prio? + * | /( empty )/ + * ; + */ + + var tokenStream = this._tokenStream, + property = null, + expr = null, + prio = null, + invalid = null, + propertyName= ""; + + property = this._property(); + if (property !== null){ -/***/ }), -/* 291 */ -/***/ (function(module, exports, __webpack_require__) { + tokenStream.mustMatch(Tokens.COLON); + this._readWhitespace(); -"use strict"; + expr = this._expr(); -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; -var OuterSubscriber_1 = __webpack_require__(4); -var subscribeToResult_1 = __webpack_require__(3); -/** - * Emits a value from the source Observable only after a particular time span - * determined by another Observable has passed without another source emission. - * - * It's like {@link debounceTime}, but the time span of - * emission silence is determined by a second Observable. - * - * - * - * `debounce` delays values emitted by the source Observable, but drops previous - * pending delayed emissions if a new value arrives on the source Observable. - * This operator keeps track of the most recent value from the source - * Observable, and spawns a duration Observable by calling the - * `durationSelector` function. The value is emitted only when the duration - * Observable emits a value or completes, and if no other value was emitted on - * the source Observable since the duration Observable was spawned. If a new - * value appears before the duration Observable emits, the previous value will - * be dropped and will not be emitted on the output Observable. - * - * Like {@link debounceTime}, this is a rate-limiting operator, and also a - * delay-like operator since output emissions do not necessarily occur at the - * same time as they did on the source Observable. - * - * @example Emit the most recent click after a burst of clicks - * var clicks = Rx.Observable.fromEvent(document, 'click'); - * var result = clicks.debounce(() => Rx.Observable.interval(1000)); - * result.subscribe(x => console.log(x)); - * - * @see {@link audit} - * @see {@link debounceTime} - * @see {@link delayWhen} - * @see {@link throttle} - * - * @param {function(value: T): SubscribableOrPromise} durationSelector A function - * that receives a value from the source Observable, for computing the timeout - * duration for each source value, returned as an Observable or a Promise. - * @return {Observable} An Observable that delays the emissions of the source - * Observable by the specified duration Observable returned by - * `durationSelector`, and may drop some values if they occur too frequently. - * @method debounce - * @owner Observable - */ -function debounce(durationSelector) { - return this.lift(new DebounceOperator(durationSelector)); -} -exports.debounce = debounce; -var DebounceOperator = (function () { - function DebounceOperator(durationSelector) { - this.durationSelector = durationSelector; - } - DebounceOperator.prototype.call = function (subscriber, source) { - return source.subscribe(new DebounceSubscriber(subscriber, this.durationSelector)); - }; - return DebounceOperator; -}()); -/** - * We need this JSDoc comment for affecting ESDoc. - * @ignore - * @extends {Ignored} - */ -var DebounceSubscriber = (function (_super) { - __extends(DebounceSubscriber, _super); - function DebounceSubscriber(destination, durationSelector) { - _super.call(this, destination); - this.durationSelector = durationSelector; - this.hasValue = false; - this.durationSubscription = null; - } - DebounceSubscriber.prototype._next = function (value) { - try { - var result = this.durationSelector.call(this, value); - if (result) { - this._tryNext(value, result); - } - } - catch (err) { - this.destination.error(err); - } - }; - DebounceSubscriber.prototype._complete = function () { - this.emitValue(); - this.destination.complete(); - }; - DebounceSubscriber.prototype._tryNext = function (value, duration) { - var subscription = this.durationSubscription; - this.value = value; - this.hasValue = true; - if (subscription) { - subscription.unsubscribe(); - this.remove(subscription); - } - subscription = subscribeToResult_1.subscribeToResult(this, duration); - if (!subscription.closed) { - this.add(this.durationSubscription = subscription); - } - }; - DebounceSubscriber.prototype.notifyNext = function (outerValue, innerValue, outerIndex, innerIndex, innerSub) { - this.emitValue(); - }; - DebounceSubscriber.prototype.notifyComplete = function () { - this.emitValue(); - }; - DebounceSubscriber.prototype.emitValue = function () { - if (this.hasValue) { - var value = this.value; - var subscription = this.durationSubscription; - if (subscription) { - this.durationSubscription = null; - subscription.unsubscribe(); - this.remove(subscription); - } - this.value = null; - this.hasValue = false; - _super.prototype._next.call(this, value); - } - }; - return DebounceSubscriber; -}(OuterSubscriber_1.OuterSubscriber)); -//# sourceMappingURL=debounce.js.map + //if there's no parts for the value, it's an error + if (!expr || expr.length === 0){ + this._unexpectedToken(tokenStream.LT(1)); + } -/***/ }), -/* 292 */ -/***/ (function(module, exports, __webpack_require__) { + prio = this._prio(); -"use strict"; + /* + * If hacks should be allowed, then only check the root + * property. If hacks should not be allowed, treat + * _property or *property as invalid properties. + */ + propertyName = property.toString(); + if (this.options.starHack && property.hack === "*" || + this.options.underscoreHack && property.hack === "_") { -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; -var Subscriber_1 = __webpack_require__(2); -var async_1 = __webpack_require__(8); -/** - * Emits a value from the source Observable only after a particular time span - * has passed without another source emission. - * - * It's like {@link delay}, but passes only the most - * recent value from each burst of emissions. - * - * - * - * `debounceTime` delays values emitted by the source Observable, but drops - * previous pending delayed emissions if a new value arrives on the source - * Observable. This operator keeps track of the most recent value from the - * source Observable, and emits that only when `dueTime` enough time has passed - * without any other value appearing on the source Observable. If a new value - * appears before `dueTime` silence occurs, the previous value will be dropped - * and will not be emitted on the output Observable. - * - * This is a rate-limiting operator, because it is impossible for more than one - * value to be emitted in any time window of duration `dueTime`, but it is also - * a delay-like operator since output emissions do not occur at the same time as - * they did on the source Observable. Optionally takes a {@link IScheduler} for - * managing timers. - * - * @example Emit the most recent click after a burst of clicks - * var clicks = Rx.Observable.fromEvent(document, 'click'); - * var result = clicks.debounceTime(1000); - * result.subscribe(x => console.log(x)); - * - * @see {@link auditTime} - * @see {@link debounce} - * @see {@link delay} - * @see {@link sampleTime} - * @see {@link throttleTime} - * - * @param {number} dueTime The timeout duration in milliseconds (or the time - * unit determined internally by the optional `scheduler`) for the window of - * time required to wait for emission silence before emitting the most recent - * source value. - * @param {Scheduler} [scheduler=async] The {@link IScheduler} to use for - * managing the timers that handle the timeout for each value. - * @return {Observable} An Observable that delays the emissions of the source - * Observable by the specified `dueTime`, and may drop some values if they occur - * too frequently. - * @method debounceTime - * @owner Observable - */ -function debounceTime(dueTime, scheduler) { - if (scheduler === void 0) { scheduler = async_1.async; } - return this.lift(new DebounceTimeOperator(dueTime, scheduler)); -} -exports.debounceTime = debounceTime; -var DebounceTimeOperator = (function () { - function DebounceTimeOperator(dueTime, scheduler) { - this.dueTime = dueTime; - this.scheduler = scheduler; - } - DebounceTimeOperator.prototype.call = function (subscriber, source) { - return source.subscribe(new DebounceTimeSubscriber(subscriber, this.dueTime, this.scheduler)); - }; - return DebounceTimeOperator; -}()); -/** - * We need this JSDoc comment for affecting ESDoc. - * @ignore - * @extends {Ignored} - */ -var DebounceTimeSubscriber = (function (_super) { - __extends(DebounceTimeSubscriber, _super); - function DebounceTimeSubscriber(destination, dueTime, scheduler) { - _super.call(this, destination); - this.dueTime = dueTime; - this.scheduler = scheduler; - this.debouncedSubscription = null; - this.lastValue = null; - this.hasValue = false; - } - DebounceTimeSubscriber.prototype._next = function (value) { - this.clearDebounce(); - this.lastValue = value; - this.hasValue = true; - this.add(this.debouncedSubscription = this.scheduler.schedule(dispatchNext, this.dueTime, this)); - }; - DebounceTimeSubscriber.prototype._complete = function () { - this.debouncedNext(); - this.destination.complete(); - }; - DebounceTimeSubscriber.prototype.debouncedNext = function () { - this.clearDebounce(); - if (this.hasValue) { - this.destination.next(this.lastValue); - this.lastValue = null; - this.hasValue = false; - } - }; - DebounceTimeSubscriber.prototype.clearDebounce = function () { - var debouncedSubscription = this.debouncedSubscription; - if (debouncedSubscription !== null) { - this.remove(debouncedSubscription); - debouncedSubscription.unsubscribe(); - this.debouncedSubscription = null; - } - }; - return DebounceTimeSubscriber; -}(Subscriber_1.Subscriber)); -function dispatchNext(subscriber) { - subscriber.debouncedNext(); -} -//# sourceMappingURL=debounceTime.js.map + propertyName = property.text; + } -/***/ }), -/* 293 */ -/***/ (function(module, exports, __webpack_require__) { + try { + this._validateProperty(propertyName, expr); + } catch (ex) { + invalid = ex; + } -"use strict"; + this.fire({ + type: "property", + property: property, + value: expr, + important: prio, + line: property.line, + col: property.col, + invalid: invalid + }); -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; -var Subscriber_1 = __webpack_require__(2); -/* tslint:enable:max-line-length */ -/** - * Emits a given value if the source Observable completes without emitting any - * `next` value, otherwise mirrors the source Observable. - * - * If the source Observable turns out to be empty, then - * this operator will emit a default value. - * - * - * - * `defaultIfEmpty` emits the values emitted by the source Observable or a - * specified default value if the source Observable is empty (completes without - * having emitted any `next` value). - * - * @example If no clicks happen in 5 seconds, then emit "no clicks" - * var clicks = Rx.Observable.fromEvent(document, 'click'); - * var clicksBeforeFive = clicks.takeUntil(Rx.Observable.interval(5000)); - * var result = clicksBeforeFive.defaultIfEmpty('no clicks'); - * result.subscribe(x => console.log(x)); - * - * @see {@link empty} - * @see {@link last} - * - * @param {any} [defaultValue=null] The default value used if the source - * Observable is empty. - * @return {Observable} An Observable that emits either the specified - * `defaultValue` if the source Observable emits no items, or the values emitted - * by the source Observable. - * @method defaultIfEmpty - * @owner Observable - */ -function defaultIfEmpty(defaultValue) { - if (defaultValue === void 0) { defaultValue = null; } - return this.lift(new DefaultIfEmptyOperator(defaultValue)); -} -exports.defaultIfEmpty = defaultIfEmpty; -var DefaultIfEmptyOperator = (function () { - function DefaultIfEmptyOperator(defaultValue) { - this.defaultValue = defaultValue; - } - DefaultIfEmptyOperator.prototype.call = function (subscriber, source) { - return source.subscribe(new DefaultIfEmptySubscriber(subscriber, this.defaultValue)); - }; - return DefaultIfEmptyOperator; -}()); -/** - * We need this JSDoc comment for affecting ESDoc. - * @ignore - * @extends {Ignored} - */ -var DefaultIfEmptySubscriber = (function (_super) { - __extends(DefaultIfEmptySubscriber, _super); - function DefaultIfEmptySubscriber(destination, defaultValue) { - _super.call(this, destination); - this.defaultValue = defaultValue; - this.isEmpty = true; - } - DefaultIfEmptySubscriber.prototype._next = function (value) { - this.isEmpty = false; - this.destination.next(value); - }; - DefaultIfEmptySubscriber.prototype._complete = function () { - if (this.isEmpty) { - this.destination.next(this.defaultValue); - } - this.destination.complete(); - }; - return DefaultIfEmptySubscriber; -}(Subscriber_1.Subscriber)); -//# sourceMappingURL=defaultIfEmpty.js.map + return true; + } else { + return false; + } + }, -/***/ }), -/* 294 */ -/***/ (function(module, exports, __webpack_require__) { + _prio: function(){ + /* + * prio + * : IMPORTANT_SYM S* + * ; + */ -"use strict"; + var tokenStream = this._tokenStream, + result = tokenStream.match(Tokens.IMPORTANT_SYM); -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; -var async_1 = __webpack_require__(8); -var isDate_1 = __webpack_require__(27); -var Subscriber_1 = __webpack_require__(2); -var Notification_1 = __webpack_require__(30); -/** - * Delays the emission of items from the source Observable by a given timeout or - * until a given Date. - * - * Time shifts each item by some specified amount of - * milliseconds. - * - * - * - * If the delay argument is a Number, this operator time shifts the source - * Observable by that amount of time expressed in milliseconds. The relative - * time intervals between the values are preserved. - * - * If the delay argument is a Date, this operator time shifts the start of the - * Observable execution until the given date occurs. - * - * @example Delay each click by one second - * var clicks = Rx.Observable.fromEvent(document, 'click'); - * var delayedClicks = clicks.delay(1000); // each click emitted after 1 second - * delayedClicks.subscribe(x => console.log(x)); - * - * @example Delay all clicks until a future date happens - * var clicks = Rx.Observable.fromEvent(document, 'click'); - * var date = new Date('March 15, 2050 12:00:00'); // in the future - * var delayedClicks = clicks.delay(date); // click emitted only after that date - * delayedClicks.subscribe(x => console.log(x)); - * - * @see {@link debounceTime} - * @see {@link delayWhen} - * - * @param {number|Date} delay The delay duration in milliseconds (a `number`) or - * a `Date` until which the emission of the source items is delayed. - * @param {Scheduler} [scheduler=async] The IScheduler to use for - * managing the timers that handle the time-shift for each item. - * @return {Observable} An Observable that delays the emissions of the source - * Observable by the specified timeout or Date. - * @method delay - * @owner Observable - */ -function delay(delay, scheduler) { - if (scheduler === void 0) { scheduler = async_1.async; } - var absoluteDelay = isDate_1.isDate(delay); - var delayFor = absoluteDelay ? (+delay - scheduler.now()) : Math.abs(delay); - return this.lift(new DelayOperator(delayFor, scheduler)); -} -exports.delay = delay; -var DelayOperator = (function () { - function DelayOperator(delay, scheduler) { - this.delay = delay; - this.scheduler = scheduler; - } - DelayOperator.prototype.call = function (subscriber, source) { - return source.subscribe(new DelaySubscriber(subscriber, this.delay, this.scheduler)); - }; - return DelayOperator; -}()); -/** - * We need this JSDoc comment for affecting ESDoc. - * @ignore - * @extends {Ignored} - */ -var DelaySubscriber = (function (_super) { - __extends(DelaySubscriber, _super); - function DelaySubscriber(destination, delay, scheduler) { - _super.call(this, destination); - this.delay = delay; - this.scheduler = scheduler; - this.queue = []; - this.active = false; - this.errored = false; - } - DelaySubscriber.dispatch = function (state) { - var source = state.source; - var queue = source.queue; - var scheduler = state.scheduler; - var destination = state.destination; - while (queue.length > 0 && (queue[0].time - scheduler.now()) <= 0) { - queue.shift().notification.observe(destination); - } - if (queue.length > 0) { - var delay_1 = Math.max(0, queue[0].time - scheduler.now()); - this.schedule(state, delay_1); - } - else { - source.active = false; - } - }; - DelaySubscriber.prototype._schedule = function (scheduler) { - this.active = true; - this.add(scheduler.schedule(DelaySubscriber.dispatch, this.delay, { - source: this, destination: this.destination, scheduler: scheduler - })); - }; - DelaySubscriber.prototype.scheduleNotification = function (notification) { - if (this.errored === true) { - return; - } - var scheduler = this.scheduler; - var message = new DelayMessage(scheduler.now() + this.delay, notification); - this.queue.push(message); - if (this.active === false) { - this._schedule(scheduler); - } - }; - DelaySubscriber.prototype._next = function (value) { - this.scheduleNotification(Notification_1.Notification.createNext(value)); - }; - DelaySubscriber.prototype._error = function (err) { - this.errored = true; - this.queue = []; - this.destination.error(err); - }; - DelaySubscriber.prototype._complete = function () { - this.scheduleNotification(Notification_1.Notification.createComplete()); - }; - return DelaySubscriber; -}(Subscriber_1.Subscriber)); -var DelayMessage = (function () { - function DelayMessage(time, notification) { - this.time = time; - this.notification = notification; - } - return DelayMessage; -}()); -//# sourceMappingURL=delay.js.map + this._readWhitespace(); + return result; + }, -/***/ }), -/* 295 */ -/***/ (function(module, exports, __webpack_require__) { + _expr: function(inFunction){ + /* + * expr + * : term [ operator term ]* + * ; + */ + + var values = [], + //valueParts = [], + value = null, + operator = null; + + value = this._term(inFunction); + if (value !== null){ + + values.push(value); + + do { + operator = this._operator(inFunction); + + //if there's an operator, keep building up the value parts + if (operator){ + values.push(operator); + } /*else { + //if there's not an operator, you have a full value + values.push(new PropertyValue(valueParts, valueParts[0].line, valueParts[0].col)); + valueParts = []; + }*/ + + value = this._term(inFunction); + + if (value === null){ + break; + } else { + values.push(value); + } + } while(true); + } -"use strict"; + //cleanup + /*if (valueParts.length){ + values.push(new PropertyValue(valueParts, valueParts[0].line, valueParts[0].col)); + }*/ -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; -var Subscriber_1 = __webpack_require__(2); -var Observable_1 = __webpack_require__(0); -var OuterSubscriber_1 = __webpack_require__(4); -var subscribeToResult_1 = __webpack_require__(3); -/** - * Delays the emission of items from the source Observable by a given time span - * determined by the emissions of another Observable. - * - * It's like {@link delay}, but the time span of the - * delay duration is determined by a second Observable. - * - * - * - * `delayWhen` time shifts each emitted value from the source Observable by a - * time span determined by another Observable. When the source emits a value, - * the `delayDurationSelector` function is called with the source value as - * argument, and should return an Observable, called the "duration" Observable. - * The source value is emitted on the output Observable only when the duration - * Observable emits a value or completes. - * - * Optionally, `delayWhen` takes a second argument, `subscriptionDelay`, which - * is an Observable. When `subscriptionDelay` emits its first value or - * completes, the source Observable is subscribed to and starts behaving like - * described in the previous paragraph. If `subscriptionDelay` is not provided, - * `delayWhen` will subscribe to the source Observable as soon as the output - * Observable is subscribed. - * - * @example Delay each click by a random amount of time, between 0 and 5 seconds - * var clicks = Rx.Observable.fromEvent(document, 'click'); - * var delayedClicks = clicks.delayWhen(event => - * Rx.Observable.interval(Math.random() * 5000) - * ); - * delayedClicks.subscribe(x => console.log(x)); - * - * @see {@link debounce} - * @see {@link delay} - * - * @param {function(value: T): Observable} delayDurationSelector A function that - * returns an Observable for each value emitted by the source Observable, which - * is then used to delay the emission of that item on the output Observable - * until the Observable returned from this function emits a value. - * @param {Observable} subscriptionDelay An Observable that triggers the - * subscription to the source Observable once it emits any value. - * @return {Observable} An Observable that delays the emissions of the source - * Observable by an amount of time specified by the Observable returned by - * `delayDurationSelector`. - * @method delayWhen - * @owner Observable - */ -function delayWhen(delayDurationSelector, subscriptionDelay) { - if (subscriptionDelay) { - return new SubscriptionDelayObservable(this, subscriptionDelay) - .lift(new DelayWhenOperator(delayDurationSelector)); - } - return this.lift(new DelayWhenOperator(delayDurationSelector)); -} -exports.delayWhen = delayWhen; -var DelayWhenOperator = (function () { - function DelayWhenOperator(delayDurationSelector) { - this.delayDurationSelector = delayDurationSelector; - } - DelayWhenOperator.prototype.call = function (subscriber, source) { - return source.subscribe(new DelayWhenSubscriber(subscriber, this.delayDurationSelector)); - }; - return DelayWhenOperator; -}()); -/** - * We need this JSDoc comment for affecting ESDoc. - * @ignore - * @extends {Ignored} - */ -var DelayWhenSubscriber = (function (_super) { - __extends(DelayWhenSubscriber, _super); - function DelayWhenSubscriber(destination, delayDurationSelector) { - _super.call(this, destination); - this.delayDurationSelector = delayDurationSelector; - this.completed = false; - this.delayNotifierSubscriptions = []; - this.values = []; - } - DelayWhenSubscriber.prototype.notifyNext = function (outerValue, innerValue, outerIndex, innerIndex, innerSub) { - this.destination.next(outerValue); - this.removeSubscription(innerSub); - this.tryComplete(); - }; - DelayWhenSubscriber.prototype.notifyError = function (error, innerSub) { - this._error(error); - }; - DelayWhenSubscriber.prototype.notifyComplete = function (innerSub) { - var value = this.removeSubscription(innerSub); - if (value) { - this.destination.next(value); - } - this.tryComplete(); - }; - DelayWhenSubscriber.prototype._next = function (value) { - try { - var delayNotifier = this.delayDurationSelector(value); - if (delayNotifier) { - this.tryDelay(delayNotifier, value); - } - } - catch (err) { - this.destination.error(err); - } - }; - DelayWhenSubscriber.prototype._complete = function () { - this.completed = true; - this.tryComplete(); - }; - DelayWhenSubscriber.prototype.removeSubscription = function (subscription) { - subscription.unsubscribe(); - var subscriptionIdx = this.delayNotifierSubscriptions.indexOf(subscription); - var value = null; - if (subscriptionIdx !== -1) { - value = this.values[subscriptionIdx]; - this.delayNotifierSubscriptions.splice(subscriptionIdx, 1); - this.values.splice(subscriptionIdx, 1); - } - return value; - }; - DelayWhenSubscriber.prototype.tryDelay = function (delayNotifier, value) { - var notifierSubscription = subscribeToResult_1.subscribeToResult(this, delayNotifier, value); - if (notifierSubscription && !notifierSubscription.closed) { - this.add(notifierSubscription); - this.delayNotifierSubscriptions.push(notifierSubscription); - } - this.values.push(value); - }; - DelayWhenSubscriber.prototype.tryComplete = function () { - if (this.completed && this.delayNotifierSubscriptions.length === 0) { - this.destination.complete(); - } - }; - return DelayWhenSubscriber; -}(OuterSubscriber_1.OuterSubscriber)); -/** - * We need this JSDoc comment for affecting ESDoc. - * @ignore - * @extends {Ignored} - */ -var SubscriptionDelayObservable = (function (_super) { - __extends(SubscriptionDelayObservable, _super); - function SubscriptionDelayObservable(source, subscriptionDelay) { - _super.call(this); - this.source = source; - this.subscriptionDelay = subscriptionDelay; - } - SubscriptionDelayObservable.prototype._subscribe = function (subscriber) { - this.subscriptionDelay.subscribe(new SubscriptionDelaySubscriber(subscriber, this.source)); - }; - return SubscriptionDelayObservable; -}(Observable_1.Observable)); -/** - * We need this JSDoc comment for affecting ESDoc. - * @ignore - * @extends {Ignored} - */ -var SubscriptionDelaySubscriber = (function (_super) { - __extends(SubscriptionDelaySubscriber, _super); - function SubscriptionDelaySubscriber(parent, source) { - _super.call(this); - this.parent = parent; - this.source = source; - this.sourceSubscribed = false; - } - SubscriptionDelaySubscriber.prototype._next = function (unused) { - this.subscribeToSource(); - }; - SubscriptionDelaySubscriber.prototype._error = function (err) { - this.unsubscribe(); - this.parent.error(err); - }; - SubscriptionDelaySubscriber.prototype._complete = function () { - this.subscribeToSource(); - }; - SubscriptionDelaySubscriber.prototype.subscribeToSource = function () { - if (!this.sourceSubscribed) { - this.sourceSubscribed = true; - this.unsubscribe(); - this.source.subscribe(this.parent); - } - }; - return SubscriptionDelaySubscriber; -}(Subscriber_1.Subscriber)); -//# sourceMappingURL=delayWhen.js.map + return values.length > 0 ? new PropertyValue(values, values[0].line, values[0].col) : null; + }, -/***/ }), -/* 296 */ -/***/ (function(module, exports, __webpack_require__) { + _term: function(inFunction){ + + /* + * term + * : unary_operator? + * [ NUMBER S* | PERCENTAGE S* | LENGTH S* | ANGLE S* | + * TIME S* | FREQ S* | function | ie_function ] + * | STRING S* | IDENT S* | URI S* | UNICODERANGE S* | hexcolor + * ; + */ + + var tokenStream = this._tokenStream, + unary = null, + value = null, + endChar = null, + token, + line, + col; + + //returns the operator or null + unary = this._unary_operator(); + if (unary !== null){ + line = tokenStream.token().startLine; + col = tokenStream.token().startCol; + } -"use strict"; + //exception for IE filters + if (tokenStream.peek() === Tokens.IE_FUNCTION && this.options.ieFilters){ -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; -var Subscriber_1 = __webpack_require__(2); -/** - * Converts an Observable of {@link Notification} objects into the emissions - * that they represent. - * - * Unwraps {@link Notification} objects as actual `next`, - * `error` and `complete` emissions. The opposite of {@link materialize}. - * - * - * - * `dematerialize` is assumed to operate an Observable that only emits - * {@link Notification} objects as `next` emissions, and does not emit any - * `error`. Such Observable is the output of a `materialize` operation. Those - * notifications are then unwrapped using the metadata they contain, and emitted - * as `next`, `error`, and `complete` on the output Observable. - * - * Use this operator in conjunction with {@link materialize}. - * - * @example Convert an Observable of Notifications to an actual Observable - * var notifA = new Rx.Notification('N', 'A'); - * var notifB = new Rx.Notification('N', 'B'); - * var notifE = new Rx.Notification('E', void 0, - * new TypeError('x.toUpperCase is not a function') - * ); - * var materialized = Rx.Observable.of(notifA, notifB, notifE); - * var upperCase = materialized.dematerialize(); - * upperCase.subscribe(x => console.log(x), e => console.error(e)); - * - * // Results in: - * // A - * // B - * // TypeError: x.toUpperCase is not a function - * - * @see {@link Notification} - * @see {@link materialize} - * - * @return {Observable} An Observable that emits items and notifications - * embedded in Notification objects emitted by the source Observable. - * @method dematerialize - * @owner Observable - */ -function dematerialize() { - return this.lift(new DeMaterializeOperator()); -} -exports.dematerialize = dematerialize; -var DeMaterializeOperator = (function () { - function DeMaterializeOperator() { - } - DeMaterializeOperator.prototype.call = function (subscriber, source) { - return source.subscribe(new DeMaterializeSubscriber(subscriber)); - }; - return DeMaterializeOperator; -}()); -/** - * We need this JSDoc comment for affecting ESDoc. - * @ignore - * @extends {Ignored} - */ -var DeMaterializeSubscriber = (function (_super) { - __extends(DeMaterializeSubscriber, _super); - function DeMaterializeSubscriber(destination) { - _super.call(this, destination); - } - DeMaterializeSubscriber.prototype._next = function (value) { - value.observe(this.destination); - }; - return DeMaterializeSubscriber; -}(Subscriber_1.Subscriber)); -//# sourceMappingURL=dematerialize.js.map + value = this._ie_function(); + if (unary === null){ + line = tokenStream.token().startLine; + col = tokenStream.token().startCol; + } -/***/ }), -/* 297 */ -/***/ (function(module, exports, __webpack_require__) { + //see if it's a simple block + } else if (inFunction && tokenStream.match([Tokens.LPAREN, Tokens.LBRACE, Tokens.LBRACKET])){ -"use strict"; + token = tokenStream.token(); + endChar = token.endChar; + value = token.value + this._expr(inFunction).text; + if (unary === null){ + line = tokenStream.token().startLine; + col = tokenStream.token().startCol; + } + tokenStream.mustMatch(Tokens.type(endChar)); + value += endChar; + this._readWhitespace(); + + //see if there's a simple match + } else if (tokenStream.match([Tokens.NUMBER, Tokens.PERCENTAGE, Tokens.LENGTH, + Tokens.ANGLE, Tokens.TIME, + Tokens.FREQ, Tokens.STRING, Tokens.IDENT, Tokens.URI, Tokens.UNICODE_RANGE])){ + + value = tokenStream.token().value; + if (unary === null){ + line = tokenStream.token().startLine; + col = tokenStream.token().startCol; + } + this._readWhitespace(); + } else { -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; -var OuterSubscriber_1 = __webpack_require__(4); -var subscribeToResult_1 = __webpack_require__(3); -var Set_1 = __webpack_require__(372); -/** - * Returns an Observable that emits all items emitted by the source Observable that are distinct by comparison from previous items. - * - * If a keySelector function is provided, then it will project each value from the source observable into a new value that it will - * check for equality with previously projected values. If a keySelector function is not provided, it will use each value from the - * source observable directly with an equality check against previous values. - * - * In JavaScript runtimes that support `Set`, this operator will use a `Set` to improve performance of the distinct value checking. - * - * In other runtimes, this operator will use a minimal implementation of `Set` that relies on an `Array` and `indexOf` under the - * hood, so performance will degrade as more values are checked for distinction. Even in newer browsers, a long-running `distinct` - * use might result in memory leaks. To help alleviate this in some scenarios, an optional `flushes` parameter is also provided so - * that the internal `Set` can be "flushed", basically clearing it of values. - * - * @example A simple example with numbers - * Observable.of(1, 1, 2, 2, 2, 1, 2, 3, 4, 3, 2, 1) - * .distinct() - * .subscribe(x => console.log(x)); // 1, 2, 3, 4 - * - * @example An example using a keySelector function - * interface Person { - * age: number, - * name: string - * } - * - * Observable.of( - * { age: 4, name: 'Foo'}, - * { age: 7, name: 'Bar'}, - * { age: 5, name: 'Foo'}) - * .distinct((p: Person) => p.name) - * .subscribe(x => console.log(x)); - * - * // displays: - * // { age: 4, name: 'Foo' } - * // { age: 7, name: 'Bar' } - * - * @see {@link distinctUntilChanged} - * @see {@link distinctUntilKeyChanged} - * - * @param {function} [keySelector] Optional function to select which value you want to check as distinct. - * @param {Observable} [flushes] Optional Observable for flushing the internal HashSet of the operator. - * @return {Observable} An Observable that emits items from the source Observable with distinct values. - * @method distinct - * @owner Observable - */ -function distinct(keySelector, flushes) { - return this.lift(new DistinctOperator(keySelector, flushes)); -} -exports.distinct = distinct; -var DistinctOperator = (function () { - function DistinctOperator(keySelector, flushes) { - this.keySelector = keySelector; - this.flushes = flushes; - } - DistinctOperator.prototype.call = function (subscriber, source) { - return source.subscribe(new DistinctSubscriber(subscriber, this.keySelector, this.flushes)); - }; - return DistinctOperator; -}()); -/** - * We need this JSDoc comment for affecting ESDoc. - * @ignore - * @extends {Ignored} - */ -var DistinctSubscriber = (function (_super) { - __extends(DistinctSubscriber, _super); - function DistinctSubscriber(destination, keySelector, flushes) { - _super.call(this, destination); - this.keySelector = keySelector; - this.values = new Set_1.Set(); - if (flushes) { - this.add(subscribeToResult_1.subscribeToResult(this, flushes)); - } - } - DistinctSubscriber.prototype.notifyNext = function (outerValue, innerValue, outerIndex, innerIndex, innerSub) { - this.values.clear(); - }; - DistinctSubscriber.prototype.notifyError = function (error, innerSub) { - this._error(error); - }; - DistinctSubscriber.prototype._next = function (value) { - if (this.keySelector) { - this._useKeySelector(value); - } - else { - this._finalizeNext(value, value); - } - }; - DistinctSubscriber.prototype._useKeySelector = function (value) { - var key; - var destination = this.destination; - try { - key = this.keySelector(value); - } - catch (err) { - destination.error(err); - return; - } - this._finalizeNext(key, value); - }; - DistinctSubscriber.prototype._finalizeNext = function (key, value) { - var values = this.values; - if (!values.has(key)) { - values.add(key); - this.destination.next(value); - } - }; - return DistinctSubscriber; -}(OuterSubscriber_1.OuterSubscriber)); -exports.DistinctSubscriber = DistinctSubscriber; -//# sourceMappingURL=distinct.js.map + //see if it's a color + token = this._hexcolor(); + if (token === null){ -/***/ }), -/* 298 */ -/***/ (function(module, exports, __webpack_require__) { + //if there's no unary, get the start of the next token for line/col info + if (unary === null){ + line = tokenStream.LT(1).startLine; + col = tokenStream.LT(1).startCol; + } -"use strict"; + //has to be a function + if (value === null){ + + /* + * This checks for alpha(opacity=0) style of IE + * functions. IE_FUNCTION only presents progid: style. + */ + if (tokenStream.LA(3) === Tokens.EQUALS && this.options.ieFilters){ + value = this._ie_function(); + } else { + value = this._function(); + } + } -var distinctUntilChanged_1 = __webpack_require__(60); -/* tslint:enable:max-line-length */ -/** - * Returns an Observable that emits all items emitted by the source Observable that are distinct by comparison from the previous item, - * using a property accessed by using the key provided to check if the two items are distinct. - * - * If a comparator function is provided, then it will be called for each item to test for whether or not that value should be emitted. - * - * If a comparator function is not provided, an equality check is used by default. - * - * @example An example comparing the name of persons - * - * interface Person { - * age: number, - * name: string - * } - * - * Observable.of( - * { age: 4, name: 'Foo'}, - * { age: 7, name: 'Bar'}, - * { age: 5, name: 'Foo'}, - * { age: 6, name: 'Foo'}) - * .distinctUntilKeyChanged('name') - * .subscribe(x => console.log(x)); - * - * // displays: - * // { age: 4, name: 'Foo' } - * // { age: 7, name: 'Bar' } - * // { age: 5, name: 'Foo' } - * - * @example An example comparing the first letters of the name - * - * interface Person { - * age: number, - * name: string - * } - * - * Observable.of( - * { age: 4, name: 'Foo1'}, - * { age: 7, name: 'Bar'}, - * { age: 5, name: 'Foo2'}, - * { age: 6, name: 'Foo3'}) - * .distinctUntilKeyChanged('name', (x: string, y: string) => x.substring(0, 3) === y.substring(0, 3)) - * .subscribe(x => console.log(x)); - * - * // displays: - * // { age: 4, name: 'Foo1' } - * // { age: 7, name: 'Bar' } - * // { age: 5, name: 'Foo2' } - * - * @see {@link distinct} - * @see {@link distinctUntilChanged} - * - * @param {string} key String key for object property lookup on each item. - * @param {function} [compare] Optional comparison function called to test if an item is distinct from the previous item in the source. - * @return {Observable} An Observable that emits items from the source Observable with distinct values based on the key specified. - * @method distinctUntilKeyChanged - * @owner Observable - */ -function distinctUntilKeyChanged(key, compare) { - return distinctUntilChanged_1.distinctUntilChanged.call(this, function (x, y) { - if (compare) { - return compare(x[key], y[key]); - } - return x[key] === y[key]; - }); -} -exports.distinctUntilKeyChanged = distinctUntilKeyChanged; -//# sourceMappingURL=distinctUntilKeyChanged.js.map + /*if (value === null){ + return null; + //throw new Error("Expected identifier at line " + tokenStream.token().startLine + ", character " + tokenStream.token().startCol + "."); + }*/ -/***/ }), -/* 299 */ -/***/ (function(module, exports, __webpack_require__) { + } else { + value = token.value; + if (unary === null){ + line = token.startLine; + col = token.startCol; + } + } -"use strict"; + } -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; -var Subscriber_1 = __webpack_require__(2); -/* tslint:enable:max-line-length */ -/** - * Perform a side effect for every emission on the source Observable, but return - * an Observable that is identical to the source. - * - * Intercepts each emission on the source and runs a - * function, but returns an output which is identical to the source as long as errors don't occur. - * - * - * - * Returns a mirrored Observable of the source Observable, but modified so that - * the provided Observer is called to perform a side effect for every value, - * error, and completion emitted by the source. Any errors that are thrown in - * the aforementioned Observer or handlers are safely sent down the error path - * of the output Observable. - * - * This operator is useful for debugging your Observables for the correct values - * or performing other side effects. - * - * Note: this is different to a `subscribe` on the Observable. If the Observable - * returned by `do` is not subscribed, the side effects specified by the - * Observer will never happen. `do` therefore simply spies on existing - * execution, it does not trigger an execution to happen like `subscribe` does. - * - * @example Map every click to the clientX position of that click, while also logging the click event - * var clicks = Rx.Observable.fromEvent(document, 'click'); - * var positions = clicks - * .do(ev => console.log(ev)) - * .map(ev => ev.clientX); - * positions.subscribe(x => console.log(x)); - * - * @see {@link map} - * @see {@link subscribe} - * - * @param {Observer|function} [nextOrObserver] A normal Observer object or a - * callback for `next`. - * @param {function} [error] Callback for errors in the source. - * @param {function} [complete] Callback for the completion of the source. - * @return {Observable} An Observable identical to the source, but runs the - * specified Observer or callback(s) for each item. - * @method do - * @name do - * @owner Observable - */ -function _do(nextOrObserver, error, complete) { - return this.lift(new DoOperator(nextOrObserver, error, complete)); -} -exports._do = _do; -var DoOperator = (function () { - function DoOperator(nextOrObserver, error, complete) { - this.nextOrObserver = nextOrObserver; - this.error = error; - this.complete = complete; - } - DoOperator.prototype.call = function (subscriber, source) { - return source.subscribe(new DoSubscriber(subscriber, this.nextOrObserver, this.error, this.complete)); - }; - return DoOperator; -}()); -/** - * We need this JSDoc comment for affecting ESDoc. - * @ignore - * @extends {Ignored} - */ -var DoSubscriber = (function (_super) { - __extends(DoSubscriber, _super); - function DoSubscriber(destination, nextOrObserver, error, complete) { - _super.call(this, destination); - var safeSubscriber = new Subscriber_1.Subscriber(nextOrObserver, error, complete); - safeSubscriber.syncErrorThrowable = true; - this.add(safeSubscriber); - this.safeSubscriber = safeSubscriber; - } - DoSubscriber.prototype._next = function (value) { - var safeSubscriber = this.safeSubscriber; - safeSubscriber.next(value); - if (safeSubscriber.syncErrorThrown) { - this.destination.error(safeSubscriber.syncErrorValue); - } - else { - this.destination.next(value); - } - }; - DoSubscriber.prototype._error = function (err) { - var safeSubscriber = this.safeSubscriber; - safeSubscriber.error(err); - if (safeSubscriber.syncErrorThrown) { - this.destination.error(safeSubscriber.syncErrorValue); - } - else { - this.destination.error(err); - } - }; - DoSubscriber.prototype._complete = function () { - var safeSubscriber = this.safeSubscriber; - safeSubscriber.complete(); - if (safeSubscriber.syncErrorThrown) { - this.destination.error(safeSubscriber.syncErrorValue); - } - else { - this.destination.complete(); - } - }; - return DoSubscriber; -}(Subscriber_1.Subscriber)); -//# sourceMappingURL=do.js.map + return value !== null ? + new PropertyValuePart(unary !== null ? unary + value : value, line, col) : + null; -/***/ }), -/* 300 */ -/***/ (function(module, exports, __webpack_require__) { + }, -"use strict"; + _function: function(){ + + /* + * function + * : FUNCTION S* expr ')' S* + * ; + */ + + var tokenStream = this._tokenStream, + functionText = null, + expr = null, + lt; + + if (tokenStream.match(Tokens.FUNCTION)){ + functionText = tokenStream.token().value; + this._readWhitespace(); + expr = this._expr(true); + functionText += expr; + + //START: Horrible hack in case it's an IE filter + if (this.options.ieFilters && tokenStream.peek() === Tokens.EQUALS){ + do { + + if (this._readWhitespace()){ + functionText += tokenStream.token().value; + } + + //might be second time in the loop + if (tokenStream.LA(0) === Tokens.COMMA){ + functionText += tokenStream.token().value; + } + + tokenStream.match(Tokens.IDENT); + functionText += tokenStream.token().value; + + tokenStream.match(Tokens.EQUALS); + functionText += tokenStream.token().value; + + //functionText += this._term(); + lt = tokenStream.peek(); + while(lt !== Tokens.COMMA && lt !== Tokens.S && lt !== Tokens.RPAREN){ + tokenStream.get(); + functionText += tokenStream.token().value; + lt = tokenStream.peek(); + } + } while(tokenStream.match([Tokens.COMMA, Tokens.S])); + } -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; -var Subscriber_1 = __webpack_require__(2); -var ArgumentOutOfRangeError_1 = __webpack_require__(22); -/** - * Emits the single value at the specified `index` in a sequence of emissions - * from the source Observable. - * - * Emits only the i-th value, then completes. - * - * - * - * `elementAt` returns an Observable that emits the item at the specified - * `index` in the source Observable, or a default value if that `index` is out - * of range and the `default` argument is provided. If the `default` argument is - * not given and the `index` is out of range, the output Observable will emit an - * `ArgumentOutOfRangeError` error. - * - * @example Emit only the third click event - * var clicks = Rx.Observable.fromEvent(document, 'click'); - * var result = clicks.elementAt(2); - * result.subscribe(x => console.log(x)); - * - * // Results in: - * // click 1 = nothing - * // click 2 = nothing - * // click 3 = MouseEvent object logged to console - * - * @see {@link first} - * @see {@link last} - * @see {@link skip} - * @see {@link single} - * @see {@link take} - * - * @throws {ArgumentOutOfRangeError} When using `elementAt(i)`, it delivers an - * ArgumentOutOrRangeError to the Observer's `error` callback if `i < 0` or the - * Observable has completed before emitting the i-th `next` notification. - * - * @param {number} index Is the number `i` for the i-th source emission that has - * happened since the subscription, starting from the number `0`. - * @param {T} [defaultValue] The default value returned for missing indices. - * @return {Observable} An Observable that emits a single item, if it is found. - * Otherwise, will emit the default value if given. If not, then emits an error. - * @method elementAt - * @owner Observable - */ -function elementAt(index, defaultValue) { - return this.lift(new ElementAtOperator(index, defaultValue)); -} -exports.elementAt = elementAt; -var ElementAtOperator = (function () { - function ElementAtOperator(index, defaultValue) { - this.index = index; - this.defaultValue = defaultValue; - if (index < 0) { - throw new ArgumentOutOfRangeError_1.ArgumentOutOfRangeError; - } - } - ElementAtOperator.prototype.call = function (subscriber, source) { - return source.subscribe(new ElementAtSubscriber(subscriber, this.index, this.defaultValue)); - }; - return ElementAtOperator; -}()); -/** - * We need this JSDoc comment for affecting ESDoc. - * @ignore - * @extends {Ignored} - */ -var ElementAtSubscriber = (function (_super) { - __extends(ElementAtSubscriber, _super); - function ElementAtSubscriber(destination, index, defaultValue) { - _super.call(this, destination); - this.index = index; - this.defaultValue = defaultValue; - } - ElementAtSubscriber.prototype._next = function (x) { - if (this.index-- === 0) { - this.destination.next(x); - this.destination.complete(); - } - }; - ElementAtSubscriber.prototype._complete = function () { - var destination = this.destination; - if (this.index >= 0) { - if (typeof this.defaultValue !== 'undefined') { - destination.next(this.defaultValue); - } - else { - destination.error(new ArgumentOutOfRangeError_1.ArgumentOutOfRangeError); - } - } - destination.complete(); - }; - return ElementAtSubscriber; -}(Subscriber_1.Subscriber)); -//# sourceMappingURL=elementAt.js.map + //END: Horrible Hack + + tokenStream.match(Tokens.RPAREN); + functionText += ")"; + this._readWhitespace(); + } + + return functionText; + }, + + _ie_function: function(){ + + /* (My own extension) + * ie_function + * : IE_FUNCTION S* IDENT '=' term [S* ','? IDENT '=' term]+ ')' S* + * ; + */ + + var tokenStream = this._tokenStream, + functionText = null, + lt; + + //IE function can begin like a regular function, too + if (tokenStream.match([Tokens.IE_FUNCTION, Tokens.FUNCTION])){ + functionText = tokenStream.token().value; + + do { + + if (this._readWhitespace()){ + functionText += tokenStream.token().value; + } + + //might be second time in the loop + if (tokenStream.LA(0) === Tokens.COMMA){ + functionText += tokenStream.token().value; + } + + tokenStream.match(Tokens.IDENT); + functionText += tokenStream.token().value; + + tokenStream.match(Tokens.EQUALS); + functionText += tokenStream.token().value; + + //functionText += this._term(); + lt = tokenStream.peek(); + while(lt !== Tokens.COMMA && lt !== Tokens.S && lt !== Tokens.RPAREN){ + tokenStream.get(); + functionText += tokenStream.token().value; + lt = tokenStream.peek(); + } + } while(tokenStream.match([Tokens.COMMA, Tokens.S])); + + tokenStream.match(Tokens.RPAREN); + functionText += ")"; + this._readWhitespace(); + } + + return functionText; + }, + + _hexcolor: function(){ + /* + * There is a constraint on the color that it must + * have either 3 or 6 hex-digits (i.e., [0-9a-fA-F]) + * after the "#"; e.g., "#000" is OK, but "#abcd" is not. + * + * hexcolor + * : HASH S* + * ; + */ + + var tokenStream = this._tokenStream, + token = null, + color; + + if(tokenStream.match(Tokens.HASH)){ + + //need to do some validation here + + token = tokenStream.token(); + color = token.value; + if (!/#[a-f0-9]{3,6}/i.test(color)){ + throw new SyntaxError("Expected a hex color but found '" + color + "' at line " + token.startLine + ", col " + token.startCol + ".", token.startLine, token.startCol); + } + this._readWhitespace(); + } + + return token; + }, + + //----------------------------------------------------------------- + // Animations methods + //----------------------------------------------------------------- + + _keyframes: function(){ + + /* + * keyframes: + * : KEYFRAMES_SYM S* keyframe_name S* '{' S* keyframe_rule* '}' { + * ; + */ + var tokenStream = this._tokenStream, + token, + tt, + name, + prefix = ""; + + tokenStream.mustMatch(Tokens.KEYFRAMES_SYM); + token = tokenStream.token(); + if (/^@\-([^\-]+)\-/.test(token.value)) { + prefix = RegExp.$1; + } + + this._readWhitespace(); + name = this._keyframe_name(); + + this._readWhitespace(); + tokenStream.mustMatch(Tokens.LBRACE); + + this.fire({ + type: "startkeyframes", + name: name, + prefix: prefix, + line: token.startLine, + col: token.startCol + }); + + this._readWhitespace(); + tt = tokenStream.peek(); + + //check for key + while(tt === Tokens.IDENT || tt === Tokens.PERCENTAGE) { + this._keyframe_rule(); + this._readWhitespace(); + tt = tokenStream.peek(); + } + + this.fire({ + type: "endkeyframes", + name: name, + prefix: prefix, + line: token.startLine, + col: token.startCol + }); + + this._readWhitespace(); + tokenStream.mustMatch(Tokens.RBRACE); + + }, + + _keyframe_name: function(){ + + /* + * keyframe_name: + * : IDENT + * | STRING + * ; + */ + var tokenStream = this._tokenStream; + + tokenStream.mustMatch([Tokens.IDENT, Tokens.STRING]); + return SyntaxUnit.fromToken(tokenStream.token()); + }, + + _keyframe_rule: function(){ + + /* + * keyframe_rule: + * : key_list S* + * '{' S* declaration [ ';' S* declaration ]* '}' S* + * ; + */ + var keyList = this._key_list(); + + this.fire({ + type: "startkeyframerule", + keys: keyList, + line: keyList[0].line, + col: keyList[0].col + }); + + this._readDeclarations(true); + + this.fire({ + type: "endkeyframerule", + keys: keyList, + line: keyList[0].line, + col: keyList[0].col + }); + + }, + + _key_list: function(){ + + /* + * key_list: + * : key [ S* ',' S* key]* + * ; + */ + var tokenStream = this._tokenStream, + keyList = []; + + //must be least one key + keyList.push(this._key()); + + this._readWhitespace(); + + while(tokenStream.match(Tokens.COMMA)){ + this._readWhitespace(); + keyList.push(this._key()); + this._readWhitespace(); + } -/***/ }), -/* 301 */ -/***/ (function(module, exports, __webpack_require__) { + return keyList; + }, -"use strict"; + _key: function(){ + /* + * There is a restriction that IDENT can be only "from" or "to". + * + * key + * : PERCENTAGE + * | IDENT + * ; + */ + + var tokenStream = this._tokenStream, + token; + + if (tokenStream.match(Tokens.PERCENTAGE)){ + return SyntaxUnit.fromToken(tokenStream.token()); + } else if (tokenStream.match(Tokens.IDENT)){ + token = tokenStream.token(); + + if (/from|to/i.test(token.value)){ + return SyntaxUnit.fromToken(token); + } -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; -var OuterSubscriber_1 = __webpack_require__(4); -var subscribeToResult_1 = __webpack_require__(3); -/** - * Converts a higher-order Observable into a first-order Observable by dropping - * inner Observables while the previous inner Observable has not yet completed. - * - * Flattens an Observable-of-Observables by dropping the - * next inner Observables while the current inner is still executing. - * - * - * - * `exhaust` subscribes to an Observable that emits Observables, also known as a - * higher-order Observable. Each time it observes one of these emitted inner - * Observables, the output Observable begins emitting the items emitted by that - * inner Observable. So far, it behaves like {@link mergeAll}. However, - * `exhaust` ignores every new inner Observable if the previous Observable has - * not yet completed. Once that one completes, it will accept and flatten the - * next inner Observable and repeat this process. - * - * @example Run a finite timer for each click, only if there is no currently active timer - * var clicks = Rx.Observable.fromEvent(document, 'click'); - * var higherOrder = clicks.map((ev) => Rx.Observable.interval(1000).take(5)); - * var result = higherOrder.exhaust(); - * result.subscribe(x => console.log(x)); - * - * @see {@link combineAll} - * @see {@link concatAll} - * @see {@link switch} - * @see {@link mergeAll} - * @see {@link exhaustMap} - * @see {@link zipAll} - * - * @return {Observable} An Observable that takes a source of Observables and propagates the first observable - * exclusively until it completes before subscribing to the next. - * @method exhaust - * @owner Observable - */ -function exhaust() { - return this.lift(new SwitchFirstOperator()); -} -exports.exhaust = exhaust; -var SwitchFirstOperator = (function () { - function SwitchFirstOperator() { - } - SwitchFirstOperator.prototype.call = function (subscriber, source) { - return source.subscribe(new SwitchFirstSubscriber(subscriber)); - }; - return SwitchFirstOperator; -}()); -/** - * We need this JSDoc comment for affecting ESDoc. - * @ignore - * @extends {Ignored} - */ -var SwitchFirstSubscriber = (function (_super) { - __extends(SwitchFirstSubscriber, _super); - function SwitchFirstSubscriber(destination) { - _super.call(this, destination); - this.hasCompleted = false; - this.hasSubscription = false; - } - SwitchFirstSubscriber.prototype._next = function (value) { - if (!this.hasSubscription) { - this.hasSubscription = true; - this.add(subscribeToResult_1.subscribeToResult(this, value)); - } - }; - SwitchFirstSubscriber.prototype._complete = function () { - this.hasCompleted = true; - if (!this.hasSubscription) { - this.destination.complete(); - } - }; - SwitchFirstSubscriber.prototype.notifyComplete = function (innerSub) { - this.remove(innerSub); - this.hasSubscription = false; - if (this.hasCompleted) { - this.destination.complete(); - } - }; - return SwitchFirstSubscriber; -}(OuterSubscriber_1.OuterSubscriber)); -//# sourceMappingURL=exhaust.js.map + tokenStream.unget(); + } -/***/ }), -/* 302 */ -/***/ (function(module, exports, __webpack_require__) { + //if it gets here, there wasn't a valid token, so time to explode + this._unexpectedToken(tokenStream.LT(1)); + }, -"use strict"; + //----------------------------------------------------------------- + // Helper methods + //----------------------------------------------------------------- -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; -var OuterSubscriber_1 = __webpack_require__(4); -var subscribeToResult_1 = __webpack_require__(3); -/* tslint:enable:max-line-length */ -/** - * Projects each source value to an Observable which is merged in the output - * Observable only if the previous projected Observable has completed. - * - * Maps each value to an Observable, then flattens all of - * these inner Observables using {@link exhaust}. - * - * - * - * Returns an Observable that emits items based on applying a function that you - * supply to each item emitted by the source Observable, where that function - * returns an (so-called "inner") Observable. When it projects a source value to - * an Observable, the output Observable begins emitting the items emitted by - * that projected Observable. However, `exhaustMap` ignores every new projected - * Observable if the previous projected Observable has not yet completed. Once - * that one completes, it will accept and flatten the next projected Observable - * and repeat this process. - * - * @example Run a finite timer for each click, only if there is no currently active timer - * var clicks = Rx.Observable.fromEvent(document, 'click'); - * var result = clicks.exhaustMap((ev) => Rx.Observable.interval(1000).take(5)); - * result.subscribe(x => console.log(x)); - * - * @see {@link concatMap} - * @see {@link exhaust} - * @see {@link mergeMap} - * @see {@link switchMap} - * - * @param {function(value: T, ?index: number): ObservableInput} project A function - * that, when applied to an item emitted by the source Observable, returns an - * Observable. - * @param {function(outerValue: T, innerValue: I, outerIndex: number, innerIndex: number): any} [resultSelector] - * A function to produce the value on the output Observable based on the values - * and the indices of the source (outer) emission and the inner Observable - * emission. The arguments passed to this function are: - * - `outerValue`: the value that came from the source - * - `innerValue`: the value that came from the projected Observable - * - `outerIndex`: the "index" of the value that came from the source - * - `innerIndex`: the "index" of the value from the projected Observable - * @return {Observable} An Observable containing projected Observables - * of each item of the source, ignoring projected Observables that start before - * their preceding Observable has completed. - * @method exhaustMap - * @owner Observable - */ -function exhaustMap(project, resultSelector) { - return this.lift(new SwitchFirstMapOperator(project, resultSelector)); -} -exports.exhaustMap = exhaustMap; -var SwitchFirstMapOperator = (function () { - function SwitchFirstMapOperator(project, resultSelector) { - this.project = project; - this.resultSelector = resultSelector; - } - SwitchFirstMapOperator.prototype.call = function (subscriber, source) { - return source.subscribe(new SwitchFirstMapSubscriber(subscriber, this.project, this.resultSelector)); - }; - return SwitchFirstMapOperator; -}()); -/** - * We need this JSDoc comment for affecting ESDoc. - * @ignore - * @extends {Ignored} - */ -var SwitchFirstMapSubscriber = (function (_super) { - __extends(SwitchFirstMapSubscriber, _super); - function SwitchFirstMapSubscriber(destination, project, resultSelector) { - _super.call(this, destination); - this.project = project; - this.resultSelector = resultSelector; - this.hasSubscription = false; - this.hasCompleted = false; - this.index = 0; - } - SwitchFirstMapSubscriber.prototype._next = function (value) { - if (!this.hasSubscription) { - this.tryNext(value); - } - }; - SwitchFirstMapSubscriber.prototype.tryNext = function (value) { - var index = this.index++; - var destination = this.destination; - try { - var result = this.project(value, index); - this.hasSubscription = true; - this.add(subscribeToResult_1.subscribeToResult(this, result, value, index)); - } - catch (err) { - destination.error(err); - } - }; - SwitchFirstMapSubscriber.prototype._complete = function () { - this.hasCompleted = true; - if (!this.hasSubscription) { - this.destination.complete(); - } - }; - SwitchFirstMapSubscriber.prototype.notifyNext = function (outerValue, innerValue, outerIndex, innerIndex, innerSub) { - var _a = this, resultSelector = _a.resultSelector, destination = _a.destination; - if (resultSelector) { - this.trySelectResult(outerValue, innerValue, outerIndex, innerIndex); - } - else { - destination.next(innerValue); - } - }; - SwitchFirstMapSubscriber.prototype.trySelectResult = function (outerValue, innerValue, outerIndex, innerIndex) { - var _a = this, resultSelector = _a.resultSelector, destination = _a.destination; - try { - var result = resultSelector(outerValue, innerValue, outerIndex, innerIndex); - destination.next(result); - } - catch (err) { - destination.error(err); - } - }; - SwitchFirstMapSubscriber.prototype.notifyError = function (err) { - this.destination.error(err); - }; - SwitchFirstMapSubscriber.prototype.notifyComplete = function (innerSub) { - this.remove(innerSub); - this.hasSubscription = false; - if (this.hasCompleted) { - this.destination.complete(); - } - }; - return SwitchFirstMapSubscriber; -}(OuterSubscriber_1.OuterSubscriber)); -//# sourceMappingURL=exhaustMap.js.map + /** + * Not part of CSS grammar, but useful for skipping over + * combination of white space and HTML-style comments. + * @return {void} + * @method _skipCruft + * @private + */ + _skipCruft: function(){ + while(this._tokenStream.match([Tokens.S, Tokens.CDO, Tokens.CDC])){ + //noop + } + }, -/***/ }), -/* 303 */ -/***/ (function(module, exports, __webpack_require__) { + /** + * Not part of CSS grammar, but this pattern occurs frequently + * in the official CSS grammar. Split out here to eliminate + * duplicate code. + * @param {Boolean} checkStart Indicates if the rule should check + * for the left brace at the beginning. + * @param {Boolean} readMargins Indicates if the rule should check + * for margin patterns. + * @return {void} + * @method _readDeclarations + * @private + */ + _readDeclarations: function(checkStart, readMargins){ + /* + * Reads the pattern + * S* '{' S* declaration [ ';' S* declaration ]* '}' S* + * or + * S* '{' S* [ declaration | margin ]? [ ';' S* [ declaration | margin ]? ]* '}' S* + * Note that this is how it is described in CSS3 Paged Media, but is actually incorrect. + * A semicolon is only necessary following a declaration if there's another declaration + * or margin afterwards. + */ + var tokenStream = this._tokenStream, + tt; + + + this._readWhitespace(); + + if (checkStart){ + tokenStream.mustMatch(Tokens.LBRACE); + } -"use strict"; + this._readWhitespace(); -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; -var tryCatch_1 = __webpack_require__(7); -var errorObject_1 = __webpack_require__(5); -var OuterSubscriber_1 = __webpack_require__(4); -var subscribeToResult_1 = __webpack_require__(3); -/* tslint:enable:max-line-length */ -/** - * Recursively projects each source value to an Observable which is merged in - * the output Observable. - * - * It's similar to {@link mergeMap}, but applies the - * projection function to every source value as well as every output value. - * It's recursive. - * - * - * - * Returns an Observable that emits items based on applying a function that you - * supply to each item emitted by the source Observable, where that function - * returns an Observable, and then merging those resulting Observables and - * emitting the results of this merger. *Expand* will re-emit on the output - * Observable every source value. Then, each output value is given to the - * `project` function which returns an inner Observable to be merged on the - * output Observable. Those output values resulting from the projection are also - * given to the `project` function to produce new output values. This is how - * *expand* behaves recursively. - * - * @example Start emitting the powers of two on every click, at most 10 of them - * var clicks = Rx.Observable.fromEvent(document, 'click'); - * var powersOfTwo = clicks - * .mapTo(1) - * .expand(x => Rx.Observable.of(2 * x).delay(1000)) - * .take(10); - * powersOfTwo.subscribe(x => console.log(x)); - * - * @see {@link mergeMap} - * @see {@link mergeScan} - * - * @param {function(value: T, index: number) => Observable} project A function - * that, when applied to an item emitted by the source or the output Observable, - * returns an Observable. - * @param {number} [concurrent=Number.POSITIVE_INFINITY] Maximum number of input - * Observables being subscribed to concurrently. - * @param {Scheduler} [scheduler=null] The IScheduler to use for subscribing to - * each projected inner Observable. - * @return {Observable} An Observable that emits the source values and also - * result of applying the projection function to each value emitted on the - * output Observable and and merging the results of the Observables obtained - * from this transformation. - * @method expand - * @owner Observable - */ -function expand(project, concurrent, scheduler) { - if (concurrent === void 0) { concurrent = Number.POSITIVE_INFINITY; } - if (scheduler === void 0) { scheduler = undefined; } - concurrent = (concurrent || 0) < 1 ? Number.POSITIVE_INFINITY : concurrent; - return this.lift(new ExpandOperator(project, concurrent, scheduler)); -} -exports.expand = expand; -var ExpandOperator = (function () { - function ExpandOperator(project, concurrent, scheduler) { - this.project = project; - this.concurrent = concurrent; - this.scheduler = scheduler; - } - ExpandOperator.prototype.call = function (subscriber, source) { - return source.subscribe(new ExpandSubscriber(subscriber, this.project, this.concurrent, this.scheduler)); - }; - return ExpandOperator; -}()); -exports.ExpandOperator = ExpandOperator; -/** - * We need this JSDoc comment for affecting ESDoc. - * @ignore - * @extends {Ignored} - */ -var ExpandSubscriber = (function (_super) { - __extends(ExpandSubscriber, _super); - function ExpandSubscriber(destination, project, concurrent, scheduler) { - _super.call(this, destination); - this.project = project; - this.concurrent = concurrent; - this.scheduler = scheduler; - this.index = 0; - this.active = 0; - this.hasCompleted = false; - if (concurrent < Number.POSITIVE_INFINITY) { - this.buffer = []; - } - } - ExpandSubscriber.dispatch = function (arg) { - var subscriber = arg.subscriber, result = arg.result, value = arg.value, index = arg.index; - subscriber.subscribeToProjection(result, value, index); - }; - ExpandSubscriber.prototype._next = function (value) { - var destination = this.destination; - if (destination.closed) { - this._complete(); - return; - } - var index = this.index++; - if (this.active < this.concurrent) { - destination.next(value); - var result = tryCatch_1.tryCatch(this.project)(value, index); - if (result === errorObject_1.errorObject) { - destination.error(errorObject_1.errorObject.e); - } - else if (!this.scheduler) { - this.subscribeToProjection(result, value, index); - } - else { - var state = { subscriber: this, result: result, value: value, index: index }; - this.add(this.scheduler.schedule(ExpandSubscriber.dispatch, 0, state)); - } - } - else { - this.buffer.push(value); - } - }; - ExpandSubscriber.prototype.subscribeToProjection = function (result, value, index) { - this.active++; - this.add(subscribeToResult_1.subscribeToResult(this, result, value, index)); - }; - ExpandSubscriber.prototype._complete = function () { - this.hasCompleted = true; - if (this.hasCompleted && this.active === 0) { - this.destination.complete(); - } - }; - ExpandSubscriber.prototype.notifyNext = function (outerValue, innerValue, outerIndex, innerIndex, innerSub) { - this._next(innerValue); - }; - ExpandSubscriber.prototype.notifyComplete = function (innerSub) { - var buffer = this.buffer; - this.remove(innerSub); - this.active--; - if (buffer && buffer.length > 0) { - this._next(buffer.shift()); - } - if (this.hasCompleted && this.active === 0) { - this.destination.complete(); - } - }; - return ExpandSubscriber; -}(OuterSubscriber_1.OuterSubscriber)); -exports.ExpandSubscriber = ExpandSubscriber; -//# sourceMappingURL=expand.js.map + try { -/***/ }), -/* 304 */ -/***/ (function(module, exports, __webpack_require__) { + while(true){ -"use strict"; + if (tokenStream.match(Tokens.SEMICOLON) || (readMargins && this._margin())){ + //noop + } else if (this._declaration()){ + if (!tokenStream.match(Tokens.SEMICOLON)){ + break; + } + } else { + break; + } -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; -var Subscriber_1 = __webpack_require__(2); -var Subscription_1 = __webpack_require__(9); -/** - * Returns an Observable that mirrors the source Observable, but will call a specified function when - * the source terminates on complete or error. - * @param {function} callback Function to be called when source terminates. - * @return {Observable} An Observable that mirrors the source, but will call the specified function on termination. - * @method finally - * @owner Observable - */ -function _finally(callback) { - return this.lift(new FinallyOperator(callback)); -} -exports._finally = _finally; -var FinallyOperator = (function () { - function FinallyOperator(callback) { - this.callback = callback; - } - FinallyOperator.prototype.call = function (subscriber, source) { - return source.subscribe(new FinallySubscriber(subscriber, this.callback)); - }; - return FinallyOperator; -}()); -/** - * We need this JSDoc comment for affecting ESDoc. - * @ignore - * @extends {Ignored} - */ -var FinallySubscriber = (function (_super) { - __extends(FinallySubscriber, _super); - function FinallySubscriber(destination, callback) { - _super.call(this, destination); - this.add(new Subscription_1.Subscription(callback)); - } - return FinallySubscriber; -}(Subscriber_1.Subscriber)); -//# sourceMappingURL=finally.js.map + //if ((!this._margin() && !this._declaration()) || !tokenStream.match(Tokens.SEMICOLON)){ + // break; + //} + this._readWhitespace(); + } -/***/ }), -/* 305 */ -/***/ (function(module, exports, __webpack_require__) { + tokenStream.mustMatch(Tokens.RBRACE); + this._readWhitespace(); + + } catch (ex) { + if (ex instanceof SyntaxError && !this.options.strict){ + + //fire error event + this.fire({ + type: "error", + error: ex, + message: ex.message, + line: ex.line, + col: ex.col + }); + + //see if there's another declaration + tt = tokenStream.advance([Tokens.SEMICOLON, Tokens.RBRACE]); + if (tt === Tokens.SEMICOLON){ + //if there's a semicolon, then there might be another declaration + this._readDeclarations(false, readMargins); + } else if (tt !== Tokens.RBRACE){ + //if there's a right brace, the rule is finished so don't do anything + //otherwise, rethrow the error because it wasn't handled properly + throw ex; + } -"use strict"; + } else { + //not a syntax error, rethrow it + throw ex; + } + } -var find_1 = __webpack_require__(61); -/** - * Emits only the index of the first value emitted by the source Observable that - * meets some condition. - * - * It's like {@link find}, but emits the index of the - * found value, not the value itself. - * - * - * - * `findIndex` searches for the first item in the source Observable that matches - * the specified condition embodied by the `predicate`, and returns the - * (zero-based) index of the first occurrence in the source. Unlike - * {@link first}, the `predicate` is required in `findIndex`, and does not emit - * an error if a valid value is not found. - * - * @example Emit the index of first click that happens on a DIV element - * var clicks = Rx.Observable.fromEvent(document, 'click'); - * var result = clicks.findIndex(ev => ev.target.tagName === 'DIV'); - * result.subscribe(x => console.log(x)); - * - * @see {@link filter} - * @see {@link find} - * @see {@link first} - * @see {@link take} - * - * @param {function(value: T, index: number, source: Observable): boolean} predicate - * A function called with each item to test for condition matching. - * @param {any} [thisArg] An optional argument to determine the value of `this` - * in the `predicate` function. - * @return {Observable} An Observable of the index of the first item that - * matches the condition. - * @method find - * @owner Observable - */ -function findIndex(predicate, thisArg) { - return this.lift(new find_1.FindValueOperator(predicate, this, true, thisArg)); -} -exports.findIndex = findIndex; -//# sourceMappingURL=findIndex.js.map + }, -/***/ }), -/* 306 */ -/***/ (function(module, exports, __webpack_require__) { + /** + * In some cases, you can end up with two white space tokens in a + * row. Instead of making a change in every function that looks for + * white space, this function is used to match as much white space + * as necessary. + * @method _readWhitespace + * @return {String} The white space if found, empty string if not. + * @private + */ + _readWhitespace: function(){ -"use strict"; + var tokenStream = this._tokenStream, + ws = ""; -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; -var Subscriber_1 = __webpack_require__(2); -var Subscription_1 = __webpack_require__(9); -var Observable_1 = __webpack_require__(0); -var Subject_1 = __webpack_require__(6); -var Map_1 = __webpack_require__(370); -var FastMap_1 = __webpack_require__(368); -/* tslint:enable:max-line-length */ -/** - * Groups the items emitted by an Observable according to a specified criterion, - * and emits these grouped items as `GroupedObservables`, one - * {@link GroupedObservable} per group. - * - * - * - * @example Group objects by id and return as array - * Observable.of({id: 1, name: 'aze1'}, - * {id: 2, name: 'sf2'}, - * {id: 2, name: 'dg2'}, - * {id: 1, name: 'erg1'}, - * {id: 1, name: 'df1'}, - * {id: 2, name: 'sfqfb2'}, - * {id: 3, name: 'qfs3'}, - * {id: 2, name: 'qsgqsfg2'} - * ) - * .groupBy(p => p.id) - * .flatMap( (group$) => group$.reduce((acc, cur) => [...acc, cur], [])) - * .subscribe(p => console.log(p)); - * - * // displays: - * // [ { id: 1, name: 'aze1' }, - * // { id: 1, name: 'erg1' }, - * // { id: 1, name: 'df1' } ] - * // - * // [ { id: 2, name: 'sf2' }, - * // { id: 2, name: 'dg2' }, - * // { id: 2, name: 'sfqfb2' }, - * // { id: 2, name: 'qsgqsfg2' } ] - * // - * // [ { id: 3, name: 'qfs3' } ] - * - * @example Pivot data on the id field - * Observable.of({id: 1, name: 'aze1'}, - * {id: 2, name: 'sf2'}, - * {id: 2, name: 'dg2'}, - * {id: 1, name: 'erg1'}, - * {id: 1, name: 'df1'}, - * {id: 2, name: 'sfqfb2'}, - * {id: 3, name: 'qfs1'}, - * {id: 2, name: 'qsgqsfg2'} - * ) - * .groupBy(p => p.id, p => p.name) - * .flatMap( (group$) => group$.reduce((acc, cur) => [...acc, cur], ["" + group$.key])) - * .map(arr => ({'id': parseInt(arr[0]), 'values': arr.slice(1)})) - * .subscribe(p => console.log(p)); - * - * // displays: - * // { id: 1, values: [ 'aze1', 'erg1', 'df1' ] } - * // { id: 2, values: [ 'sf2', 'dg2', 'sfqfb2', 'qsgqsfg2' ] } - * // { id: 3, values: [ 'qfs1' ] } - * - * @param {function(value: T): K} keySelector A function that extracts the key - * for each item. - * @param {function(value: T): R} [elementSelector] A function that extracts the - * return element for each item. - * @param {function(grouped: GroupedObservable): Observable} [durationSelector] - * A function that returns an Observable to determine how long each group should - * exist. - * @return {Observable>} An Observable that emits - * GroupedObservables, each of which corresponds to a unique key value and each - * of which emits those items from the source Observable that share that key - * value. - * @method groupBy - * @owner Observable - */ -function groupBy(keySelector, elementSelector, durationSelector, subjectSelector) { - return this.lift(new GroupByOperator(keySelector, elementSelector, durationSelector, subjectSelector)); -} -exports.groupBy = groupBy; -var GroupByOperator = (function () { - function GroupByOperator(keySelector, elementSelector, durationSelector, subjectSelector) { - this.keySelector = keySelector; - this.elementSelector = elementSelector; - this.durationSelector = durationSelector; - this.subjectSelector = subjectSelector; - } - GroupByOperator.prototype.call = function (subscriber, source) { - return source.subscribe(new GroupBySubscriber(subscriber, this.keySelector, this.elementSelector, this.durationSelector, this.subjectSelector)); - }; - return GroupByOperator; -}()); -/** - * We need this JSDoc comment for affecting ESDoc. - * @ignore - * @extends {Ignored} - */ -var GroupBySubscriber = (function (_super) { - __extends(GroupBySubscriber, _super); - function GroupBySubscriber(destination, keySelector, elementSelector, durationSelector, subjectSelector) { - _super.call(this, destination); - this.keySelector = keySelector; - this.elementSelector = elementSelector; - this.durationSelector = durationSelector; - this.subjectSelector = subjectSelector; - this.groups = null; - this.attemptedToUnsubscribe = false; - this.count = 0; - } - GroupBySubscriber.prototype._next = function (value) { - var key; - try { - key = this.keySelector(value); - } - catch (err) { - this.error(err); - return; - } - this._group(value, key); - }; - GroupBySubscriber.prototype._group = function (value, key) { - var groups = this.groups; - if (!groups) { - groups = this.groups = typeof key === 'string' ? new FastMap_1.FastMap() : new Map_1.Map(); - } - var group = groups.get(key); - var element; - if (this.elementSelector) { - try { - element = this.elementSelector(value); - } - catch (err) { - this.error(err); + while(tokenStream.match(Tokens.S)){ + ws += tokenStream.token().value; + } + + return ws; + }, + + + /** + * Throws an error when an unexpected token is found. + * @param {Object} token The token that was found. + * @method _unexpectedToken + * @return {void} + * @private + */ + _unexpectedToken: function(token){ + throw new SyntaxError("Unexpected token '" + token.value + "' at line " + token.startLine + ", col " + token.startCol + ".", token.startLine, token.startCol); + }, + + /** + * Helper method used for parsing subparts of a style sheet. + * @return {void} + * @method _verifyEnd + * @private + */ + _verifyEnd: function(){ + if (this._tokenStream.LA(1) !== Tokens.EOF){ + this._unexpectedToken(this._tokenStream.LT(1)); + } + }, + + //----------------------------------------------------------------- + // Validation methods + //----------------------------------------------------------------- + _validateProperty: function(property, value){ + Validation.validate(property, value); + }, + + //----------------------------------------------------------------- + // Parsing methods + //----------------------------------------------------------------- + + parse: function(input){ + this._tokenStream = new TokenStream(input, Tokens); + this._stylesheet(); + }, + + parseStyleSheet: function(input){ + //just passthrough + return this.parse(input); + }, + + parseMediaQuery: function(input){ + this._tokenStream = new TokenStream(input, Tokens); + var result = this._media_query(); + + //if there's anything more, then it's an invalid selector + this._verifyEnd(); + + //otherwise return result + return result; + }, + + /** + * Parses a property value (everything after the semicolon). + * @return {parserlib.css.PropertyValue} The property value. + * @throws parserlib.util.SyntaxError If an unexpected token is found. + * @method parserPropertyValue + */ + parsePropertyValue: function(input){ + + this._tokenStream = new TokenStream(input, Tokens); + this._readWhitespace(); + + var result = this._expr(); + + //okay to have a trailing white space + this._readWhitespace(); + + //if there's anything more, then it's an invalid selector + this._verifyEnd(); + + //otherwise return result + return result; + }, + + /** + * Parses a complete CSS rule, including selectors and + * properties. + * @param {String} input The text to parser. + * @return {Boolean} True if the parse completed successfully, false if not. + * @method parseRule + */ + parseRule: function(input){ + this._tokenStream = new TokenStream(input, Tokens); + + //skip any leading white space + this._readWhitespace(); + + var result = this._ruleset(); + + //skip any trailing white space + this._readWhitespace(); + + //if there's anything more, then it's an invalid selector + this._verifyEnd(); + + //otherwise return result + return result; + }, + + /** + * Parses a single CSS selector (no comma) + * @param {String} input The text to parse as a CSS selector. + * @return {Selector} An object representing the selector. + * @throws parserlib.util.SyntaxError If an unexpected token is found. + * @method parseSelector + */ + parseSelector: function(input){ + + this._tokenStream = new TokenStream(input, Tokens); + + //skip any leading white space + this._readWhitespace(); + + var result = this._selector(); + + //skip any trailing white space + this._readWhitespace(); + + //if there's anything more, then it's an invalid selector + this._verifyEnd(); + + //otherwise return result + return result; + }, + + /** + * Parses an HTML style attribute: a set of CSS declarations + * separated by semicolons. + * @param {String} input The text to parse as a style attribute + * @return {void} + * @method parseStyleAttribute + */ + parseStyleAttribute: function(input){ + input += "}"; // for error recovery in _readDeclarations() + this._tokenStream = new TokenStream(input, Tokens); + this._readDeclarations(); } + }; + + //copy over onto prototype + for (prop in additions){ + if (Object.prototype.hasOwnProperty.call(additions, prop)){ + proto[prop] = additions[prop]; } - else { - element = value; - } - if (!group) { - group = this.subjectSelector ? this.subjectSelector() : new Subject_1.Subject(); - groups.set(key, group); - var groupedObservable = new GroupedObservable(key, group, this); - this.destination.next(groupedObservable); - if (this.durationSelector) { - var duration = void 0; - try { - duration = this.durationSelector(new GroupedObservable(key, group)); - } - catch (err) { - this.error(err); - return; + } + + return proto; +}(); + + +/* +nth + : S* [ ['-'|'+']? INTEGER? {N} [ S* ['-'|'+'] S* INTEGER ]? | + ['-'|'+']? INTEGER | {O}{D}{D} | {E}{V}{E}{N} ] S* + ; +*/ +var Properties = { + __proto__: null, + + //A + "align-items" : "flex-start | flex-end | center | baseline | stretch", + "align-content" : "flex-start | flex-end | center | space-between | space-around | stretch", + "align-self" : "auto | flex-start | flex-end | center | baseline | stretch", + "-webkit-align-items" : "flex-start | flex-end | center | baseline | stretch", + "-webkit-align-content" : "flex-start | flex-end | center | space-between | space-around | stretch", + "-webkit-align-self" : "auto | flex-start | flex-end | center | baseline | stretch", + "alignment-adjust" : "auto | baseline | before-edge | text-before-edge | middle | central | after-edge | text-after-edge | ideographic | alphabetic | hanging | mathematical | | ", + "alignment-baseline" : "baseline | use-script | before-edge | text-before-edge | after-edge | text-after-edge | central | middle | ideographic | alphabetic | hanging | mathematical", + "animation" : 1, + "animation-delay" : { multi: "", comma: true }, + "animation-direction" : { multi: "normal | alternate", comma: true }, + "animation-duration" : { multi: "", comma: true }, + "animation-fill-mode" : { multi: "none | forwards | backwards | both", comma: true }, + "animation-iteration-count" : { multi: " | infinite", comma: true }, + "animation-name" : { multi: "none | ", comma: true }, + "animation-play-state" : { multi: "running | paused", comma: true }, + "animation-timing-function" : 1, + + //vendor prefixed + "-moz-animation-delay" : { multi: "", comma: true }, + "-moz-animation-direction" : { multi: "normal | alternate", comma: true }, + "-moz-animation-duration" : { multi: "", comma: true }, + "-moz-animation-iteration-count" : { multi: " | infinite", comma: true }, + "-moz-animation-name" : { multi: "none | ", comma: true }, + "-moz-animation-play-state" : { multi: "running | paused", comma: true }, + + "-ms-animation-delay" : { multi: "", comma: true }, + "-ms-animation-direction" : { multi: "normal | alternate", comma: true }, + "-ms-animation-duration" : { multi: "", comma: true }, + "-ms-animation-iteration-count" : { multi: " | infinite", comma: true }, + "-ms-animation-name" : { multi: "none | ", comma: true }, + "-ms-animation-play-state" : { multi: "running | paused", comma: true }, + + "-webkit-animation-delay" : { multi: "", comma: true }, + "-webkit-animation-direction" : { multi: "normal | alternate", comma: true }, + "-webkit-animation-duration" : { multi: "", comma: true }, + "-webkit-animation-fill-mode" : { multi: "none | forwards | backwards | both", comma: true }, + "-webkit-animation-iteration-count" : { multi: " | infinite", comma: true }, + "-webkit-animation-name" : { multi: "none | ", comma: true }, + "-webkit-animation-play-state" : { multi: "running | paused", comma: true }, + + "-o-animation-delay" : { multi: "", comma: true }, + "-o-animation-direction" : { multi: "normal | alternate", comma: true }, + "-o-animation-duration" : { multi: "", comma: true }, + "-o-animation-iteration-count" : { multi: " | infinite", comma: true }, + "-o-animation-name" : { multi: "none | ", comma: true }, + "-o-animation-play-state" : { multi: "running | paused", comma: true }, + + "appearance" : "icon | window | desktop | workspace | document | tooltip | dialog | button | push-button | hyperlink | radio | radio-button | checkbox | menu-item | tab | menu | menubar | pull-down-menu | pop-up-menu | list-menu | radio-group | checkbox-group | outline-tree | range | field | combo-box | signature | password | normal | none | inherit", + "azimuth" : function (expression) { + var simple = " | leftwards | rightwards | inherit", + direction = "left-side | far-left | left | center-left | center | center-right | right | far-right | right-side", + behind = false, + valid = false, + part; + + if (!ValidationTypes.isAny(expression, simple)) { + if (ValidationTypes.isAny(expression, "behind")) { + behind = true; + valid = true; + } + + if (ValidationTypes.isAny(expression, direction)) { + valid = true; + if (!behind) { + ValidationTypes.isAny(expression, "behind"); } - this.add(duration.subscribe(new GroupDurationSubscriber(key, group, this))); } } - if (!group.closed) { - group.next(element); + + if (expression.hasNext()) { + part = expression.next(); + if (valid) { + throw new ValidationError("Expected end of value but found '" + part + "'.", part.line, part.col); + } else { + throw new ValidationError("Expected (<'azimuth'>) but found '" + part + "'.", part.line, part.col); + } } - }; - GroupBySubscriber.prototype._error = function (err) { - var groups = this.groups; - if (groups) { - groups.forEach(function (group, key) { - group.error(err); - }); - groups.clear(); + }, + + //B + "backface-visibility" : "visible | hidden", + "background" : 1, + "background-attachment" : { multi: "", comma: true }, + "background-clip" : { multi: "", comma: true }, + "background-color" : " | inherit", + "background-image" : { multi: "", comma: true }, + "background-origin" : { multi: "", comma: true }, + "background-position" : { multi: "", comma: true }, + "background-repeat" : { multi: "" }, + "background-size" : { multi: "", comma: true }, + "baseline-shift" : "baseline | sub | super | | ", + "behavior" : 1, + "binding" : 1, + "bleed" : "", + "bookmark-label" : " | | ", + "bookmark-level" : "none | ", + "bookmark-state" : "open | closed", + "bookmark-target" : "none | | ", + "border" : " || || ", + "border-bottom" : " || || ", + "border-bottom-color" : " | inherit", + "border-bottom-left-radius" : "", + "border-bottom-right-radius" : "", + "border-bottom-style" : "", + "border-bottom-width" : "", + "border-collapse" : "collapse | separate | inherit", + "border-color" : { multi: " | inherit", max: 4 }, + "border-image" : 1, + "border-image-outset" : { multi: " | ", max: 4 }, + "border-image-repeat" : { multi: "stretch | repeat | round", max: 2 }, + "border-image-slice" : function(expression) { + + var valid = false, + numeric = " | ", + fill = false, + count = 0, + max = 4, + part; + + if (ValidationTypes.isAny(expression, "fill")) { + fill = true; + valid = true; + } + + while (expression.hasNext() && count < max) { + valid = ValidationTypes.isAny(expression, numeric); + if (!valid) { + break; + } + count++; } - this.destination.error(err); - }; - GroupBySubscriber.prototype._complete = function () { - var groups = this.groups; - if (groups) { - groups.forEach(function (group, key) { - group.complete(); - }); - groups.clear(); + + + if (!fill) { + ValidationTypes.isAny(expression, "fill"); + } else { + valid = true; } - this.destination.complete(); - }; - GroupBySubscriber.prototype.removeGroup = function (key) { - this.groups.delete(key); - }; - GroupBySubscriber.prototype.unsubscribe = function () { - if (!this.closed) { - this.attemptedToUnsubscribe = true; - if (this.count === 0) { - _super.prototype.unsubscribe.call(this); + + if (expression.hasNext()) { + part = expression.next(); + if (valid) { + throw new ValidationError("Expected end of value but found '" + part + "'.", part.line, part.col); + } else { + throw new ValidationError("Expected ([ | ]{1,4} && fill?) but found '" + part + "'.", part.line, part.col); } } - }; - return GroupBySubscriber; -}(Subscriber_1.Subscriber)); -/** - * We need this JSDoc comment for affecting ESDoc. - * @ignore - * @extends {Ignored} - */ -var GroupDurationSubscriber = (function (_super) { - __extends(GroupDurationSubscriber, _super); - function GroupDurationSubscriber(key, group, parent) { - _super.call(this, group); - this.key = key; - this.group = group; - this.parent = parent; - } - GroupDurationSubscriber.prototype._next = function (value) { - this.complete(); - }; - GroupDurationSubscriber.prototype._unsubscribe = function () { - var _a = this, parent = _a.parent, key = _a.key; - this.key = this.parent = null; - if (parent) { - parent.removeGroup(key); + }, + "border-image-source" : " | none", + "border-image-width" : { multi: " | | | auto", max: 4 }, + "border-left" : " || || ", + "border-left-color" : " | inherit", + "border-left-style" : "", + "border-left-width" : "", + "border-radius" : function(expression) { + + var valid = false, + simple = " | | inherit", + slash = false, + count = 0, + max = 8, + part; + + while (expression.hasNext() && count < max) { + valid = ValidationTypes.isAny(expression, simple); + if (!valid) { + + if (String(expression.peek()) === "/" && count > 0 && !slash) { + slash = true; + max = count + 5; + expression.next(); + } else { + break; + } + } + count++; } - }; - return GroupDurationSubscriber; -}(Subscriber_1.Subscriber)); -/** - * An Observable representing values belonging to the same group represented by - * a common key. The values emitted by a GroupedObservable come from the source - * Observable. The common key is available as the field `key` on a - * GroupedObservable instance. - * - * @class GroupedObservable - */ -var GroupedObservable = (function (_super) { - __extends(GroupedObservable, _super); - function GroupedObservable(key, groupSubject, refCountSubscription) { - _super.call(this); - this.key = key; - this.groupSubject = groupSubject; - this.refCountSubscription = refCountSubscription; - } - GroupedObservable.prototype._subscribe = function (subscriber) { - var subscription = new Subscription_1.Subscription(); - var _a = this, refCountSubscription = _a.refCountSubscription, groupSubject = _a.groupSubject; - if (refCountSubscription && !refCountSubscription.closed) { - subscription.add(new InnerRefCountSubscription(refCountSubscription)); + + if (expression.hasNext()) { + part = expression.next(); + if (valid) { + throw new ValidationError("Expected end of value but found '" + part + "'.", part.line, part.col); + } else { + throw new ValidationError("Expected (<'border-radius'>) but found '" + part + "'.", part.line, part.col); + } } - subscription.add(groupSubject.subscribe(subscriber)); - return subscription; - }; - return GroupedObservable; -}(Observable_1.Observable)); -exports.GroupedObservable = GroupedObservable; -/** - * We need this JSDoc comment for affecting ESDoc. - * @ignore - * @extends {Ignored} - */ -var InnerRefCountSubscription = (function (_super) { - __extends(InnerRefCountSubscription, _super); - function InnerRefCountSubscription(parent) { - _super.call(this); - this.parent = parent; - parent.count++; - } - InnerRefCountSubscription.prototype.unsubscribe = function () { - var parent = this.parent; - if (!parent.closed && !this.closed) { - _super.prototype.unsubscribe.call(this); - parent.count -= 1; - if (parent.count === 0 && parent.attemptedToUnsubscribe) { - parent.unsubscribe(); + }, + "border-right" : "
>>32-p[b],a=a+r|0,t=r,r=j,j=h<<10|h>>>22,h=g,g=a,a=u+e[v+q[b]]|0,a=16>b?a+((k^(l|~m))+d[0]):32>b?a+((k&m|l&~m)+d[1]):48>b?a+(((k|~l)^m)+d[2]):64>b?a+((k&l|~k&m)+d[3]):a+((k^l^m)+d[4]),a|=0,a=a<>>32-w[b],a=a+s|0,u=s,s=m,m=l<<10|l>>>22,l=k,k=a;a=c[1]+h+m|0;c[1]=c[2]+j+s|0;c[2]=c[3]+r+u|0;c[3]=c[4]+t+k|0;c[4]=c[0]+g+l|0;c[0]=a},_doFinalize:function(){var e=this._data,d=e.words,b=8*this._nDataBytes,c=8*e.sigBytes; -d[c>>>5]|=128<<24-c%32;d[(c+64>>>9<<4)+14]=(b<<8|b>>>24)&16711935|(b<<24|b>>>8)&4278255360;e.sigBytes=4*(d.length+1);this._process();e=this._hash;d=e.words;for(b=0;5>b;b++)c=d[b],d[b]=(c<<8|c>>>24)&16711935|(c<<24|c>>>8)&4278255360;return e},clone:function(){var d=p.clone.call(this);d._hash=this._hash.clone();return d}});q.RIPEMD160=p._createHelper(d);q.HmacRIPEMD160=p._createHmacHelper(d)})(Math); - -/* -CryptoJS v3.1.2 hmac.js -code.google.com/p/crypto-js -(c) 2009-2013 by Jeff Mott. All rights reserved. -code.google.com/p/crypto-js/wiki/License -*/ -(function(){var c=CryptoJS,k=c.enc.Utf8;c.algo.HMAC=c.lib.Base.extend({init:function(a,b){a=this._hasher=new a.init;"string"==typeof b&&(b=k.parse(b));var c=a.blockSize,e=4*c;b.sigBytes>e&&(b=a.finalize(b));b.clamp();for(var f=this._oKey=b.clone(),g=this._iKey=b.clone(),h=f.words,j=g.words,d=0;d>6)+b64map.charAt(e&63)}if(b+1==d.length){e=parseInt(d.substring(b,b+1),16);a+=b64map.charAt(e<<2)}else{if(b+2==d.length){e=parseInt(d.substring(b,b+2),16);a+=b64map.charAt(e>>2)+b64map.charAt((e&3)<<4)}}if(b64pad){while((a.length&3)>0){a+=b64pad}}return a}function b64tohex(f){var d="";var e;var b=0;var c;var a;for(e=0;e>2);c=a&3;b=1}else{if(b==1){d+=int2char((c<<2)|(a>>4));c=a&15;b=2}else{if(b==2){d+=int2char(c);d+=int2char(a>>2);c=a&3;b=3}else{d+=int2char((c<<2)|(a>>4));d+=int2char(a&15);b=0}}}}if(b==1){d+=int2char(c<<2)}return d}function b64toBA(e){var d=b64tohex(e);var c;var b=new Array();for(c=0;2*c=0){var d=a*this[f++]+b[e]+h;h=Math.floor(d/67108864);b[e++]=d&67108863}return h}function am2(f,q,r,e,o,a){var k=q&32767,p=q>>15;while(--a>=0){var d=this[f]&32767;var g=this[f++]>>15;var b=p*d+g*k;d=k*d+((b&32767)<<15)+r[e]+(o&1073741823);o=(d>>>30)+(b>>>15)+p*g+(o>>>30);r[e++]=d&1073741823}return o}function am3(f,q,r,e,o,a){var k=q&16383,p=q>>14;while(--a>=0){var d=this[f]&16383;var g=this[f++]>>14;var b=p*d+g*k;d=k*d+((b&16383)<<14)+r[e]+o;o=(d>>28)+(b>>14)+p*g;r[e++]=d&268435455}return o}if(j_lm&&(navigator.appName=="Microsoft Internet Explorer")){BigInteger.prototype.am=am2;dbits=30}else{if(j_lm&&(navigator.appName!="Netscape")){BigInteger.prototype.am=am1;dbits=26}else{BigInteger.prototype.am=am3;dbits=28}}BigInteger.prototype.DB=dbits;BigInteger.prototype.DM=((1<=0;--a){b[a]=this[a]}b.t=this.t;b.s=this.s}function bnpFromInt(a){this.t=1;this.s=(a<0)?-1:0;if(a>0){this[0]=a}else{if(a<-1){this[0]=a+this.DV}else{this.t=0}}}function nbv(a){var b=nbi();b.fromInt(a);return b}function bnpFromString(h,c){var e;if(c==16){e=4}else{if(c==8){e=3}else{if(c==256){e=8}else{if(c==2){e=1}else{if(c==32){e=5}else{if(c==4){e=2}else{this.fromRadix(h,c);return}}}}}}this.t=0;this.s=0;var g=h.length,d=false,f=0;while(--g>=0){var a=(e==8)?h[g]&255:intAt(h,g);if(a<0){if(h.charAt(g)=="-"){d=true}continue}d=false;if(f==0){this[this.t++]=a}else{if(f+e>this.DB){this[this.t-1]|=(a&((1<<(this.DB-f))-1))<>(this.DB-f))}else{this[this.t-1]|=a<=this.DB){f-=this.DB}}if(e==8&&(h[0]&128)!=0){this.s=-1;if(f>0){this[this.t-1]|=((1<<(this.DB-f))-1)<0&&this[this.t-1]==a){--this.t}}function bnToString(c){if(this.s<0){return"-"+this.negate().toString(c)}var e;if(c==16){e=4}else{if(c==8){e=3}else{if(c==2){e=1}else{if(c==32){e=5}else{if(c==4){e=2}else{return this.toRadix(c)}}}}}var g=(1<0){if(j>j)>0){a=true;h=int2char(l)}while(f>=0){if(j>(j+=this.DB-e)}else{l=(this[f]>>(j-=e))&g;if(j<=0){j+=this.DB;--f}}if(l>0){a=true}if(a){h+=int2char(l)}}}return a?h:"0"}function bnNegate(){var a=nbi();BigInteger.ZERO.subTo(this,a);return a}function bnAbs(){return(this.s<0)?this.negate():this}function bnCompareTo(b){var d=this.s-b.s;if(d!=0){return d}var c=this.t;d=c-b.t;if(d!=0){return(this.s<0)?-d:d}while(--c>=0){if((d=this[c]-b[c])!=0){return d}}return 0}function nbits(a){var c=1,b;if((b=a>>>16)!=0){a=b;c+=16}if((b=a>>8)!=0){a=b;c+=8}if((b=a>>4)!=0){a=b;c+=4}if((b=a>>2)!=0){a=b;c+=2}if((b=a>>1)!=0){a=b;c+=1}return c}function bnBitLength(){if(this.t<=0){return 0}return this.DB*(this.t-1)+nbits(this[this.t-1]^(this.s&this.DM))}function bnpDLShiftTo(c,b){var a;for(a=this.t-1;a>=0;--a){b[a+c]=this[a]}for(a=c-1;a>=0;--a){b[a]=0}b.t=this.t+c;b.s=this.s}function bnpDRShiftTo(c,b){for(var a=c;a=0;--d){e[d+f+1]=(this[d]>>a)|h;h=(this[d]&g)<=0;--d){e[d]=0}e[f]=h;e.t=this.t+f+1;e.s=this.s;e.clamp()}function bnpRShiftTo(g,d){d.s=this.s;var e=Math.floor(g/this.DB);if(e>=this.t){d.t=0;return}var b=g%this.DB;var a=this.DB-b;var f=(1<>b;for(var c=e+1;c>b}if(b>0){d[this.t-e-1]|=(this.s&f)<>=this.DB}if(d.t>=this.DB}g+=this.s}else{g+=this.s;while(e>=this.DB}g-=d.s}f.s=(g<0)?-1:0;if(g<-1){f[e++]=this.DV+g}else{if(g>0){f[e++]=g}}f.t=e;f.clamp()}function bnpMultiplyTo(c,e){var b=this.abs(),f=c.abs();var d=b.t;e.t=d+f.t;while(--d>=0){e[d]=0}for(d=0;d=0){d[b]=0}for(b=0;b=a.DV){d[b+a.t]-=a.DV;d[b+a.t+1]=1}}if(d.t>0){d[d.t-1]+=a.am(b,a[b],d,2*b,0,1)}d.s=0;d.clamp()}function bnpDivRemTo(n,h,g){var w=n.abs();if(w.t<=0){return}var k=this.abs();if(k.t0){w.lShiftTo(v,d);k.lShiftTo(v,g)}else{w.copyTo(d);k.copyTo(g)}var p=d.t;var b=d[p-1];if(b==0){return}var o=b*(1<1)?d[p-2]>>this.F2:0);var A=this.FV/o,z=(1<=0){g[g.t++]=1;g.subTo(f,g)}BigInteger.ONE.dlShiftTo(p,f);f.subTo(d,d);while(d.t=0){var c=(g[--u]==b)?this.DM:Math.floor(g[u]*A+(g[u-1]+x)*z);if((g[u]+=d.am(0,c,g,s,0,p))0){g.rShiftTo(v,g)}if(a<0){BigInteger.ZERO.subTo(g,g)}}function bnMod(b){var c=nbi();this.abs().divRemTo(b,null,c);if(this.s<0&&c.compareTo(BigInteger.ZERO)>0){b.subTo(c,c)}return c}function Classic(a){this.m=a}function cConvert(a){if(a.s<0||a.compareTo(this.m)>=0){return a.mod(this.m)}else{return a}}function cRevert(a){return a}function cReduce(a){a.divRemTo(this.m,null,a)}function cMulTo(a,c,b){a.multiplyTo(c,b);this.reduce(b)}function cSqrTo(a,b){a.squareTo(b);this.reduce(b)}Classic.prototype.convert=cConvert;Classic.prototype.revert=cRevert;Classic.prototype.reduce=cReduce;Classic.prototype.mulTo=cMulTo;Classic.prototype.sqrTo=cSqrTo;function bnpInvDigit(){if(this.t<1){return 0}var a=this[0];if((a&1)==0){return 0}var b=a&3;b=(b*(2-(a&15)*b))&15;b=(b*(2-(a&255)*b))&255;b=(b*(2-(((a&65535)*b)&65535)))&65535;b=(b*(2-a*b%this.DV))%this.DV;return(b>0)?this.DV-b:-b}function Montgomery(a){this.m=a;this.mp=a.invDigit();this.mpl=this.mp&32767;this.mph=this.mp>>15;this.um=(1<<(a.DB-15))-1;this.mt2=2*a.t}function montConvert(a){var b=nbi();a.abs().dlShiftTo(this.m.t,b);b.divRemTo(this.m,null,b);if(a.s<0&&b.compareTo(BigInteger.ZERO)>0){this.m.subTo(b,b)}return b}function montRevert(a){var b=nbi();a.copyTo(b);this.reduce(b);return b}function montReduce(a){while(a.t<=this.mt2){a[a.t++]=0}for(var c=0;c>15)*this.mpl)&this.um)<<15))&a.DM;b=c+this.m.t;a[b]+=this.m.am(0,d,a,c,0,this.m.t);while(a[b]>=a.DV){a[b]-=a.DV;a[++b]++}}a.clamp();a.drShiftTo(this.m.t,a);if(a.compareTo(this.m)>=0){a.subTo(this.m,a)}}function montSqrTo(a,b){a.squareTo(b);this.reduce(b)}function montMulTo(a,c,b){a.multiplyTo(c,b);this.reduce(b)}Montgomery.prototype.convert=montConvert;Montgomery.prototype.revert=montRevert;Montgomery.prototype.reduce=montReduce;Montgomery.prototype.mulTo=montMulTo;Montgomery.prototype.sqrTo=montSqrTo;function bnpIsEven(){return((this.t>0)?(this[0]&1):this.s)==0}function bnpExp(h,j){if(h>4294967295||h<1){return BigInteger.ONE}var f=nbi(),a=nbi(),d=j.convert(this),c=nbits(h)-1;d.copyTo(f);while(--c>=0){j.sqrTo(f,a);if((h&(1<0){j.mulTo(a,d,f)}else{var b=f;f=a;a=b}}return j.revert(f)}function bnModPowInt(b,a){var c;if(b<256||a.isEven()){c=new Classic(a)}else{c=new Montgomery(a)}return this.exp(b,c)}BigInteger.prototype.copyTo=bnpCopyTo;BigInteger.prototype.fromInt=bnpFromInt;BigInteger.prototype.fromString=bnpFromString;BigInteger.prototype.clamp=bnpClamp;BigInteger.prototype.dlShiftTo=bnpDLShiftTo;BigInteger.prototype.drShiftTo=bnpDRShiftTo;BigInteger.prototype.lShiftTo=bnpLShiftTo;BigInteger.prototype.rShiftTo=bnpRShiftTo;BigInteger.prototype.subTo=bnpSubTo;BigInteger.prototype.multiplyTo=bnpMultiplyTo;BigInteger.prototype.squareTo=bnpSquareTo;BigInteger.prototype.divRemTo=bnpDivRemTo;BigInteger.prototype.invDigit=bnpInvDigit;BigInteger.prototype.isEven=bnpIsEven;BigInteger.prototype.exp=bnpExp;BigInteger.prototype.toString=bnToString;BigInteger.prototype.negate=bnNegate;BigInteger.prototype.abs=bnAbs;BigInteger.prototype.compareTo=bnCompareTo;BigInteger.prototype.bitLength=bnBitLength;BigInteger.prototype.mod=bnMod;BigInteger.prototype.modPowInt=bnModPowInt;BigInteger.ZERO=nbv(0);BigInteger.ONE=nbv(1); -/*! (c) Tom Wu | http://www-cs-students.stanford.edu/~tjw/jsbn/ - */ -function bnClone(){var a=nbi();this.copyTo(a);return a}function bnIntValue(){if(this.s<0){if(this.t==1){return this[0]-this.DV}else{if(this.t==0){return -1}}}else{if(this.t==1){return this[0]}else{if(this.t==0){return 0}}}return((this[1]&((1<<(32-this.DB))-1))<>24}function bnShortValue(){return(this.t==0)?this.s:(this[0]<<16)>>16}function bnpChunkSize(a){return Math.floor(Math.LN2*this.DB/Math.log(a))}function bnSigNum(){if(this.s<0){return -1}else{if(this.t<=0||(this.t==1&&this[0]<=0)){return 0}else{return 1}}}function bnpToRadix(c){if(c==null){c=10}if(this.signum()==0||c<2||c>36){return"0"}var f=this.chunkSize(c);var e=Math.pow(c,f);var i=nbv(e),j=nbi(),h=nbi(),g="";this.divRemTo(i,j,h);while(j.signum()>0){g=(e+h.intValue()).toString(c).substr(1)+g;j.divRemTo(i,j,h)}return h.intValue().toString(c)+g}function bnpFromRadix(m,h){this.fromInt(0);if(h==null){h=10}var f=this.chunkSize(h);var g=Math.pow(h,f),e=false,a=0,l=0;for(var c=0;c=f){this.dMultiply(g);this.dAddOffset(l,0);a=0;l=0}}if(a>0){this.dMultiply(Math.pow(h,a));this.dAddOffset(l,0)}if(e){BigInteger.ZERO.subTo(this,this)}}function bnpFromNumber(f,e,h){if("number"==typeof e){if(f<2){this.fromInt(1)}else{this.fromNumber(f,h);if(!this.testBit(f-1)){this.bitwiseTo(BigInteger.ONE.shiftLeft(f-1),op_or,this)}if(this.isEven()){this.dAddOffset(1,0)}while(!this.isProbablePrime(e)){this.dAddOffset(2,0);if(this.bitLength()>f){this.subTo(BigInteger.ONE.shiftLeft(f-1),this)}}}}else{var d=new Array(),g=f&7;d.length=(f>>3)+1;e.nextBytes(d);if(g>0){d[0]&=((1<0){if(e>e)!=(this.s&this.DM)>>e){c[a++]=f|(this.s<<(this.DB-e))}while(b>=0){if(e<8){f=(this[b]&((1<>(e+=this.DB-8)}else{f=(this[b]>>(e-=8))&255;if(e<=0){e+=this.DB;--b}}if((f&128)!=0){f|=-256}if(a==0&&(this.s&128)!=(f&128)){++a}if(a>0||f!=this.s){c[a++]=f}}}return c}function bnEquals(b){return(this.compareTo(b)==0)}function bnMin(b){return(this.compareTo(b)<0)?this:b}function bnMax(b){return(this.compareTo(b)>0)?this:b}function bnpBitwiseTo(c,h,e){var d,g,b=Math.min(c.t,this.t);for(d=0;d>=16;b+=16}if((a&255)==0){a>>=8;b+=8}if((a&15)==0){a>>=4;b+=4}if((a&3)==0){a>>=2;b+=2}if((a&1)==0){++b}return b}function bnGetLowestSetBit(){for(var a=0;a=this.t){return(this.s!=0)}return((this[a]&(1<<(b%this.DB)))!=0)}function bnpChangeBit(c,b){var a=BigInteger.ONE.shiftLeft(c);this.bitwiseTo(a,b,a);return a}function bnSetBit(a){return this.changeBit(a,op_or)}function bnClearBit(a){return this.changeBit(a,op_andnot)}function bnFlipBit(a){return this.changeBit(a,op_xor)}function bnpAddTo(d,f){var e=0,g=0,b=Math.min(d.t,this.t);while(e>=this.DB}if(d.t>=this.DB}g+=this.s}else{g+=this.s;while(e>=this.DB}g+=d.s}f.s=(g<0)?-1:0;if(g>0){f[e++]=g}else{if(g<-1){f[e++]=this.DV+g}}f.t=e;f.clamp()}function bnAdd(b){var c=nbi();this.addTo(b,c);return c}function bnSubtract(b){var c=nbi();this.subTo(b,c);return c}function bnMultiply(b){var c=nbi();this.multiplyTo(b,c);return c}function bnSquare(){var a=nbi();this.squareTo(a);return a}function bnDivide(b){var c=nbi();this.divRemTo(b,c,null);return c}function bnRemainder(b){var c=nbi();this.divRemTo(b,null,c);return c}function bnDivideAndRemainder(b){var d=nbi(),c=nbi();this.divRemTo(b,d,c);return new Array(d,c)}function bnpDMultiply(a){this[this.t]=this.am(0,a-1,this,0,0,this.t);++this.t;this.clamp()}function bnpDAddOffset(b,a){if(b==0){return}while(this.t<=a){this[this.t++]=0}this[a]+=b;while(this[a]>=this.DV){this[a]-=this.DV;if(++a>=this.t){this[this.t++]=0}++this[a]}}function NullExp(){}function nNop(a){return a}function nMulTo(a,c,b){a.multiplyTo(c,b)}function nSqrTo(a,b){a.squareTo(b)}NullExp.prototype.convert=nNop;NullExp.prototype.revert=nNop;NullExp.prototype.mulTo=nMulTo;NullExp.prototype.sqrTo=nSqrTo;function bnPow(a){return this.exp(a,new NullExp())}function bnpMultiplyLowerTo(b,f,e){var d=Math.min(this.t+b.t,f);e.s=0;e.t=d;while(d>0){e[--d]=0}var c;for(c=e.t-this.t;d=0){d[c]=0}for(c=Math.max(e-this.t,0);c2*this.m.t){return a.mod(this.m)}else{if(a.compareTo(this.m)<0){return a}else{var b=nbi();a.copyTo(b);this.reduce(b);return b}}}function barrettRevert(a){return a}function barrettReduce(a){a.drShiftTo(this.m.t-1,this.r2);if(a.t>this.m.t+1){a.t=this.m.t+1;a.clamp()}this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3);this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);while(a.compareTo(this.r2)<0){a.dAddOffset(1,this.m.t+1)}a.subTo(this.r2,a);while(a.compareTo(this.m)>=0){a.subTo(this.m,a)}}function barrettSqrTo(a,b){a.squareTo(b);this.reduce(b)}function barrettMulTo(a,c,b){a.multiplyTo(c,b);this.reduce(b)}Barrett.prototype.convert=barrettConvert;Barrett.prototype.revert=barrettRevert;Barrett.prototype.reduce=barrettReduce;Barrett.prototype.mulTo=barrettMulTo;Barrett.prototype.sqrTo=barrettSqrTo;function bnModPow(q,f){var o=q.bitLength(),h,b=nbv(1),v;if(o<=0){return b}else{if(o<18){h=1}else{if(o<48){h=3}else{if(o<144){h=4}else{if(o<768){h=5}else{h=6}}}}}if(o<8){v=new Classic(f)}else{if(f.isEven()){v=new Barrett(f)}else{v=new Montgomery(f)}}var p=new Array(),d=3,s=h-1,a=(1<1){var A=nbi();v.sqrTo(p[1],A);while(d<=a){p[d]=nbi();v.mulTo(A,p[d-2],p[d]);d+=2}}var l=q.t-1,x,u=true,c=nbi(),y;o=nbits(q[l])-1;while(l>=0){if(o>=s){x=(q[l]>>(o-s))&a}else{x=(q[l]&((1<<(o+1))-1))<<(s-o);if(l>0){x|=q[l-1]>>(this.DB+o-s)}}d=h;while((x&1)==0){x>>=1;--d}if((o-=d)<0){o+=this.DB;--l}if(u){p[x].copyTo(b);u=false}else{while(d>1){v.sqrTo(b,c);v.sqrTo(c,b);d-=2}if(d>0){v.sqrTo(b,c)}else{y=b;b=c;c=y}v.mulTo(c,p[x],b)}while(l>=0&&(q[l]&(1<0){b.rShiftTo(f,b);h.rShiftTo(f,h)}while(b.signum()>0){if((d=b.getLowestSetBit())>0){b.rShiftTo(d,b)}if((d=h.getLowestSetBit())>0){h.rShiftTo(d,h)}if(b.compareTo(h)>=0){b.subTo(h,b);b.rShiftTo(1,b)}else{h.subTo(b,h);h.rShiftTo(1,h)}}if(f>0){h.lShiftTo(f,h)}return h}function bnpModInt(e){if(e<=0){return 0}var c=this.DV%e,b=(this.s<0)?e-1:0;if(this.t>0){if(c==0){b=this[0]%e}else{for(var a=this.t-1;a>=0;--a){b=(c*b+this[a])%e}}}return b}function bnModInverse(f){var j=f.isEven();if((this.isEven()&&j)||f.signum()==0){return BigInteger.ZERO}var i=f.clone(),h=this.clone();var g=nbv(1),e=nbv(0),l=nbv(0),k=nbv(1);while(i.signum()!=0){while(i.isEven()){i.rShiftTo(1,i);if(j){if(!g.isEven()||!e.isEven()){g.addTo(this,g);e.subTo(f,e)}g.rShiftTo(1,g)}else{if(!e.isEven()){e.subTo(f,e)}}e.rShiftTo(1,e)}while(h.isEven()){h.rShiftTo(1,h);if(j){if(!l.isEven()||!k.isEven()){l.addTo(this,l);k.subTo(f,k)}l.rShiftTo(1,l)}else{if(!k.isEven()){k.subTo(f,k)}}k.rShiftTo(1,k)}if(i.compareTo(h)>=0){i.subTo(h,i);if(j){g.subTo(l,g)}e.subTo(k,e)}else{h.subTo(i,h);if(j){l.subTo(g,l)}k.subTo(e,k)}}if(h.compareTo(BigInteger.ONE)!=0){return BigInteger.ZERO}if(k.compareTo(f)>=0){return k.subtract(f)}if(k.signum()<0){k.addTo(f,k)}else{return k}if(k.signum()<0){return k.add(f)}else{return k}}var lowprimes=[2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509,521,523,541,547,557,563,569,571,577,587,593,599,601,607,613,617,619,631,641,643,647,653,659,661,673,677,683,691,701,709,719,727,733,739,743,751,757,761,769,773,787,797,809,811,821,823,827,829,839,853,857,859,863,877,881,883,887,907,911,919,929,937,941,947,953,967,971,977,983,991,997];var lplim=(1<<26)/lowprimes[lowprimes.length-1];function bnIsProbablePrime(e){var d,b=this.abs();if(b.t==1&&b[0]<=lowprimes[lowprimes.length-1]){for(d=0;d>1;if(f>lowprimes.length){f=lowprimes.length}var b=nbi();for(var e=0;e>8)&255;rng_pool[rng_pptr++]^=(a>>16)&255;rng_pool[rng_pptr++]^=(a>>24)&255;if(rng_pptr>=rng_psize){rng_pptr-=rng_psize}}function rng_seed_time(){rng_seed_int(new Date().getTime())}if(rng_pool==null){rng_pool=new Array();rng_pptr=0;var t;if(window!==undefined&&(window.crypto!==undefined||window.msCrypto!==undefined)){var crypto=window.crypto||window.msCrypto;if(crypto.getRandomValues){var ua=new Uint8Array(32);crypto.getRandomValues(ua);for(t=0;t<32;++t){rng_pool[rng_pptr++]=ua[t]}}else{if(navigator.appName=="Netscape"&&navigator.appVersion<"5"){var z=window.crypto.random(32);for(t=0;t>>8;rng_pool[rng_pptr++]=t&255}rng_pptr=0;rng_seed_time()}function rng_get_byte(){if(rng_state==null){rng_seed_time();rng_state=prng_newstate();rng_state.init(rng_pool);for(rng_pptr=0;rng_pptr=0&&h>0){var f=e.charCodeAt(d--);if(f<128){g[--h]=f}else{if((f>127)&&(f<2048)){g[--h]=(f&63)|128;g[--h]=(f>>6)|192}else{g[--h]=(f&63)|128;g[--h]=((f>>6)&63)|128;g[--h]=(f>>12)|224}}}g[--h]=0;var b=new SecureRandom();var a=new Array();while(h>2){a[0]=0;while(a[0]==0){b.nextBytes(a)}g[--h]=a[0]}g[--h]=2;g[--h]=0;return new BigInteger(g)}function oaep_mgf1_arr(c,a,e){var b="",d=0;while(b.length>24,(d&16711680)>>16,(d&65280)>>8,d&255])));d+=1}return b}function oaep_pad(q,a,f,l){var c=KJUR.crypto.MessageDigest;var o=KJUR.crypto.Util;var b=null;if(!f){f="sha1"}if(typeof f==="string"){b=c.getCanonicalAlgName(f);l=c.getHashLength(b);f=function(i){return hextorstr(o.hashString(i,b))}}if(q.length+2*l+2>a){throw"Message too long for RSA"}var k="",e;for(e=0;e0&&a.length>0){this.n=parseBigInt(b,16);this.e=parseInt(a,16)}else{throw"Invalid RSA public key"}}}function RSADoPublic(a){return a.modPowInt(this.e,this.n)}function RSAEncrypt(d){var a=pkcs1pad2(d,(this.n.bitLength()+7)>>3);if(a==null){return null}var e=this.doPublic(a);if(e==null){return null}var b=e.toString(16);if((b.length&1)==0){return b}else{return"0"+b}}function RSAEncryptOAEP(f,e,b){var a=oaep_pad(f,(this.n.bitLength()+7)>>3,e,b);if(a==null){return null}var g=this.doPublic(a);if(g==null){return null}var d=g.toString(16);if((d.length&1)==0){return d}else{return"0"+d}}RSAKey.prototype.doPublic=RSADoPublic;RSAKey.prototype.setPublic=RSASetPublic;RSAKey.prototype.encrypt=RSAEncrypt;RSAKey.prototype.encryptOAEP=RSAEncryptOAEP;RSAKey.prototype.type="RSA"; -/*! (c) Tom Wu | http://www-cs-students.stanford.edu/~tjw/jsbn/ - */ -function pkcs1unpad2(g,j){var a=g.toByteArray();var f=0;while(f=a.length){return null}}var e="";while(++f191)&&(h<224)){e+=String.fromCharCode(((h&31)<<6)|(a[f+1]&63));++f}else{e+=String.fromCharCode(((h&15)<<12)|((a[f+1]&63)<<6)|(a[f+2]&63));f+=2}}}return e}function oaep_mgf1_str(c,a,e){var b="",d=0;while(b.length>24,(d&16711680)>>16,(d&65280)>>8,d&255]));d+=1}return b}function oaep_unpad(o,b,g,p){var e=KJUR.crypto.MessageDigest;var r=KJUR.crypto.Util;var c=null;if(!g){g="sha1"}if(typeof g==="string"){c=e.getCanonicalAlgName(g);p=e.getHashLength(c);g=function(d){return hextorstr(r.hashString(d,c))}}o=o.toByteArray();var h;for(h=0;h0&&a.length>0){this.n=parseBigInt(c,16);this.e=parseInt(a,16);this.d=parseBigInt(b,16)}else{alert("Invalid RSA private key")}}}function RSASetPrivateEx(g,d,e,c,b,a,h,f){this.isPrivate=true;this.isPublic=false;if(g==null){throw"RSASetPrivateEx N == null"}if(d==null){throw"RSASetPrivateEx E == null"}if(g.length==0){throw"RSASetPrivateEx N.length == 0"}if(d.length==0){throw"RSASetPrivateEx E.length == 0"}if(g!=null&&d!=null&&g.length>0&&d.length>0){this.n=parseBigInt(g,16);this.e=parseInt(d,16);this.d=parseBigInt(e,16);this.p=parseBigInt(c,16);this.q=parseBigInt(b,16);this.dmp1=parseBigInt(a,16);this.dmq1=parseBigInt(h,16);this.coeff=parseBigInt(f,16)}else{alert("Invalid RSA private key in RSASetPrivateEx")}}function RSAGenerate(b,i){var a=new SecureRandom();var f=b>>1;this.e=parseInt(i,16);var c=new BigInteger(i,16);for(;;){for(;;){this.p=new BigInteger(b-f,1,a);if(this.p.subtract(BigInteger.ONE).gcd(c).compareTo(BigInteger.ONE)==0&&this.p.isProbablePrime(10)){break}}for(;;){this.q=new BigInteger(f,1,a);if(this.q.subtract(BigInteger.ONE).gcd(c).compareTo(BigInteger.ONE)==0&&this.q.isProbablePrime(10)){break}}if(this.p.compareTo(this.q)<=0){var h=this.p;this.p=this.q;this.q=h}var g=this.p.subtract(BigInteger.ONE);var d=this.q.subtract(BigInteger.ONE);var e=g.multiply(d);if(e.gcd(c).compareTo(BigInteger.ONE)==0){this.n=this.p.multiply(this.q);this.d=c.modInverse(e);this.dmp1=this.d.mod(g);this.dmq1=this.d.mod(d);this.coeff=this.q.modInverse(this.p);break}}this.isPrivate=true}function RSADoPrivate(a){if(this.p==null||this.q==null){return a.modPow(this.d,this.n)}var c=a.mod(this.p).modPow(this.dmp1,this.p);var b=a.mod(this.q).modPow(this.dmq1,this.q);while(c.compareTo(b)<0){c=c.add(this.p)}return c.subtract(b).multiply(this.coeff).mod(this.p).multiply(this.q).add(b)}function RSADecrypt(b){var d=parseBigInt(b,16);var a=this.doPrivate(d);if(a==null){return null}return pkcs1unpad2(a,(this.n.bitLength()+7)>>3)}function RSADecryptOAEP(e,d,b){var f=parseBigInt(e,16);var a=this.doPrivate(f);if(a==null){return null}return oaep_unpad(a,(this.n.bitLength()+7)>>3,d,b)}RSAKey.prototype.doPrivate=RSADoPrivate;RSAKey.prototype.setPrivate=RSASetPrivate;RSAKey.prototype.setPrivateEx=RSASetPrivateEx;RSAKey.prototype.generate=RSAGenerate;RSAKey.prototype.decrypt=RSADecrypt;RSAKey.prototype.decryptOAEP=RSADecryptOAEP; -/*! (c) Tom Wu | http://www-cs-students.stanford.edu/~tjw/jsbn/ - */ -function ECFieldElementFp(b,a){this.x=a;this.q=b}function feFpEquals(a){if(a==this){return true}return(this.q.equals(a.q)&&this.x.equals(a.x))}function feFpToBigInteger(){return this.x}function feFpNegate(){return new ECFieldElementFp(this.q,this.x.negate().mod(this.q))}function feFpAdd(a){return new ECFieldElementFp(this.q,this.x.add(a.toBigInteger()).mod(this.q))}function feFpSubtract(a){return new ECFieldElementFp(this.q,this.x.subtract(a.toBigInteger()).mod(this.q))}function feFpMultiply(a){return new ECFieldElementFp(this.q,this.x.multiply(a.toBigInteger()).mod(this.q))}function feFpSquare(){return new ECFieldElementFp(this.q,this.x.square().mod(this.q))}function feFpDivide(a){return new ECFieldElementFp(this.q,this.x.multiply(a.toBigInteger().modInverse(this.q)).mod(this.q))}ECFieldElementFp.prototype.equals=feFpEquals;ECFieldElementFp.prototype.toBigInteger=feFpToBigInteger;ECFieldElementFp.prototype.negate=feFpNegate;ECFieldElementFp.prototype.add=feFpAdd;ECFieldElementFp.prototype.subtract=feFpSubtract;ECFieldElementFp.prototype.multiply=feFpMultiply;ECFieldElementFp.prototype.square=feFpSquare;ECFieldElementFp.prototype.divide=feFpDivide;function ECPointFp(c,a,d,b){this.curve=c;this.x=a;this.y=d;if(b==null){this.z=BigInteger.ONE}else{this.z=b}this.zinv=null}function pointFpGetX(){if(this.zinv==null){this.zinv=this.z.modInverse(this.curve.q)}return this.curve.fromBigInteger(this.x.toBigInteger().multiply(this.zinv).mod(this.curve.q))}function pointFpGetY(){if(this.zinv==null){this.zinv=this.z.modInverse(this.curve.q)}return this.curve.fromBigInteger(this.y.toBigInteger().multiply(this.zinv).mod(this.curve.q))}function pointFpEquals(a){if(a==this){return true}if(this.isInfinity()){return a.isInfinity()}if(a.isInfinity()){return this.isInfinity()}var c,b;c=a.y.toBigInteger().multiply(this.z).subtract(this.y.toBigInteger().multiply(a.z)).mod(this.curve.q);if(!c.equals(BigInteger.ZERO)){return false}b=a.x.toBigInteger().multiply(this.z).subtract(this.x.toBigInteger().multiply(a.z)).mod(this.curve.q);return b.equals(BigInteger.ZERO)}function pointFpIsInfinity(){if((this.x==null)&&(this.y==null)){return true}return this.z.equals(BigInteger.ZERO)&&!this.y.toBigInteger().equals(BigInteger.ZERO)}function pointFpNegate(){return new ECPointFp(this.curve,this.x,this.y.negate(),this.z)}function pointFpAdd(l){if(this.isInfinity()){return l}if(l.isInfinity()){return this}var p=l.y.toBigInteger().multiply(this.z).subtract(this.y.toBigInteger().multiply(l.z)).mod(this.curve.q);var o=l.x.toBigInteger().multiply(this.z).subtract(this.x.toBigInteger().multiply(l.z)).mod(this.curve.q);if(BigInteger.ZERO.equals(o)){if(BigInteger.ZERO.equals(p)){return this.twice()}return this.curve.getInfinity()}var j=new BigInteger("3");var e=this.x.toBigInteger();var n=this.y.toBigInteger();var c=l.x.toBigInteger();var k=l.y.toBigInteger();var m=o.square();var i=m.multiply(o);var d=e.multiply(m);var g=p.square().multiply(this.z);var a=g.subtract(d.shiftLeft(1)).multiply(l.z).subtract(i).multiply(o).mod(this.curve.q);var h=d.multiply(j).multiply(p).subtract(n.multiply(i)).subtract(g.multiply(p)).multiply(l.z).add(p.multiply(i)).mod(this.curve.q);var f=i.multiply(this.z).multiply(l.z).mod(this.curve.q);return new ECPointFp(this.curve,this.curve.fromBigInteger(a),this.curve.fromBigInteger(h),f)}function pointFpTwice(){if(this.isInfinity()){return this}if(this.y.toBigInteger().signum()==0){return this.curve.getInfinity()}var g=new BigInteger("3");var c=this.x.toBigInteger();var h=this.y.toBigInteger();var e=h.multiply(this.z);var j=e.multiply(h).mod(this.curve.q);var i=this.curve.a.toBigInteger();var k=c.square().multiply(g);if(!BigInteger.ZERO.equals(i)){k=k.add(this.z.square().multiply(i))}k=k.mod(this.curve.q);var b=k.square().subtract(c.shiftLeft(3).multiply(j)).shiftLeft(1).multiply(e).mod(this.curve.q);var f=k.multiply(g).multiply(c).subtract(j.shiftLeft(1)).shiftLeft(2).multiply(j).subtract(k.square().multiply(k)).mod(this.curve.q);var d=e.square().multiply(e).shiftLeft(3).mod(this.curve.q);return new ECPointFp(this.curve,this.curve.fromBigInteger(b),this.curve.fromBigInteger(f),d)}function pointFpMultiply(b){if(this.isInfinity()){return this}if(b.signum()==0){return this.curve.getInfinity()}var g=b;var f=g.multiply(new BigInteger("3"));var l=this.negate();var d=this;var c;for(c=f.bitLength()-2;c>0;--c){d=d.twice();var a=f.testBit(c);var j=g.testBit(c);if(a!=j){d=d.add(a?this:l)}}return d}function pointFpMultiplyTwo(c,a,b){var d;if(c.bitLength()>b.bitLength()){d=c.bitLength()-1}else{d=b.bitLength()-1}var f=this.curve.getInfinity();var e=this.add(a);while(d>=0){f=f.twice();if(c.testBit(d)){if(b.testBit(d)){f=f.add(e)}else{f=f.add(this)}}else{if(b.testBit(d)){f=f.add(a)}}--d}return f}ECPointFp.prototype.getX=pointFpGetX;ECPointFp.prototype.getY=pointFpGetY;ECPointFp.prototype.equals=pointFpEquals;ECPointFp.prototype.isInfinity=pointFpIsInfinity;ECPointFp.prototype.negate=pointFpNegate;ECPointFp.prototype.add=pointFpAdd;ECPointFp.prototype.twice=pointFpTwice;ECPointFp.prototype.multiply=pointFpMultiply;ECPointFp.prototype.multiplyTwo=pointFpMultiplyTwo;function ECCurveFp(e,d,c){this.q=e;this.a=this.fromBigInteger(d);this.b=this.fromBigInteger(c);this.infinity=new ECPointFp(this,null,null)}function curveFpGetQ(){return this.q}function curveFpGetA(){return this.a}function curveFpGetB(){return this.b}function curveFpEquals(a){if(a==this){return true}return(this.q.equals(a.q)&&this.a.equals(a.a)&&this.b.equals(a.b))}function curveFpGetInfinity(){return this.infinity}function curveFpFromBigInteger(a){return new ECFieldElementFp(this.q,a)}function curveFpDecodePointHex(d){switch(parseInt(d.substr(0,2),16)){case 0:return this.infinity;case 2:case 3:return null;case 4:case 6:case 7:var a=(d.length-2)/2;var c=d.substr(2,a);var b=d.substr(a+2,a);return new ECPointFp(this,this.fromBigInteger(new BigInteger(c,16)),this.fromBigInteger(new BigInteger(b,16)));default:return null}}ECCurveFp.prototype.getQ=curveFpGetQ;ECCurveFp.prototype.getA=curveFpGetA;ECCurveFp.prototype.getB=curveFpGetB;ECCurveFp.prototype.equals=curveFpEquals;ECCurveFp.prototype.getInfinity=curveFpGetInfinity;ECCurveFp.prototype.fromBigInteger=curveFpFromBigInteger;ECCurveFp.prototype.decodePointHex=curveFpDecodePointHex; -/*! (c) Stefan Thomas | https://github.com/bitcoinjs/bitcoinjs-lib - */ -ECFieldElementFp.prototype.getByteLength=function(){return Math.floor((this.toBigInteger().bitLength()+7)/8)};ECPointFp.prototype.getEncoded=function(c){var d=function(h,f){var g=h.toByteArrayUnsigned();if(fg.length){g.unshift(0)}}return g};var a=this.getX().toBigInteger();var e=this.getY().toBigInteger();var b=d(a,32);if(c){if(e.isEven()){b.unshift(2)}else{b.unshift(3)}}else{b.unshift(4);b=b.concat(d(e,32))}return b};ECPointFp.decodeFrom=function(g,c){var f=c[0];var e=c.length-1;var d=c.slice(1,1+e/2);var b=c.slice(1+e/2,1+e);d.unshift(0);b.unshift(0);var a=new BigInteger(d);var h=new BigInteger(b);return new ECPointFp(g,g.fromBigInteger(a),g.fromBigInteger(h))};ECPointFp.decodeFromHex=function(g,c){var f=c.substr(0,2);var e=c.length-2;var d=c.substr(2,e/2);var b=c.substr(2+e/2,e/2);var a=new BigInteger(d,16);var h=new BigInteger(b,16);return new ECPointFp(g,g.fromBigInteger(a),g.fromBigInteger(h))};ECPointFp.prototype.add2D=function(c){if(this.isInfinity()){return c}if(c.isInfinity()){return this}if(this.x.equals(c.x)){if(this.y.equals(c.y)){return this.twice()}return this.curve.getInfinity()}var g=c.x.subtract(this.x);var e=c.y.subtract(this.y);var a=e.divide(g);var d=a.square().subtract(this.x).subtract(c.x);var f=a.multiply(this.x.subtract(d)).subtract(this.y);return new ECPointFp(this.curve,d,f)};ECPointFp.prototype.twice2D=function(){if(this.isInfinity()){return this}if(this.y.toBigInteger().signum()==0){return this.curve.getInfinity()}var b=this.curve.fromBigInteger(BigInteger.valueOf(2));var e=this.curve.fromBigInteger(BigInteger.valueOf(3));var a=this.x.square().multiply(e).add(this.curve.a).divide(this.y.multiply(b));var c=a.square().subtract(this.x.multiply(b));var d=a.multiply(this.x.subtract(c)).subtract(this.y);return new ECPointFp(this.curve,c,d)};ECPointFp.prototype.multiply2D=function(b){if(this.isInfinity()){return this}if(b.signum()==0){return this.curve.getInfinity()}var g=b;var f=g.multiply(new BigInteger("3"));var l=this.negate();var d=this;var c;for(c=f.bitLength()-2;c>0;--c){d=d.twice();var a=f.testBit(c);var j=g.testBit(c);if(a!=j){d=d.add2D(a?this:l)}}return d};ECPointFp.prototype.isOnCurve=function(){var d=this.getX().toBigInteger();var i=this.getY().toBigInteger();var f=this.curve.getA().toBigInteger();var c=this.curve.getB().toBigInteger();var h=this.curve.getQ();var e=i.multiply(i).mod(h);var g=d.multiply(d).multiply(d).add(f.multiply(d)).add(c).mod(h);return e.equals(g)};ECPointFp.prototype.toString=function(){return"("+this.getX().toBigInteger().toString()+","+this.getY().toBigInteger().toString()+")"};ECPointFp.prototype.validate=function(){var c=this.curve.getQ();if(this.isInfinity()){throw new Error("Point is at infinity.")}var a=this.getX().toBigInteger();var b=this.getY().toBigInteger();if(a.compareTo(BigInteger.ONE)<0||a.compareTo(c.subtract(BigInteger.ONE))>0){throw new Error("x coordinate out of bounds")}if(b.compareTo(BigInteger.ONE)<0||b.compareTo(c.subtract(BigInteger.ONE))>0){throw new Error("y coordinate out of bounds")}if(!this.isOnCurve()){throw new Error("Point is not on the curve.")}if(this.multiply(c).isInfinity()){throw new Error("Point is not a scalar multiple of G.")}return true}; -/*! Mike Samuel (c) 2009 | code.google.com/p/json-sans-eval - */ -var jsonParse=(function(){var e="(?:-?\\b(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?(?:[eE][+-]?[0-9]+)?\\b)";var j='(?:[^\\0-\\x08\\x0a-\\x1f"\\\\]|\\\\(?:["/\\\\bfnrt]|u[0-9A-Fa-f]{4}))';var i='(?:"'+j+'*")';var d=new RegExp("(?:false|true|null|[\\{\\}\\[\\]]|"+e+"|"+i+")","g");var k=new RegExp("\\\\(?:([^u])|u(.{4}))","g");var g={'"':'"',"/":"/","\\":"\\",b:"\b",f:"\f",n:"\n",r:"\r",t:"\t"};function h(l,m,n){return m?g[m]:String.fromCharCode(parseInt(n,16))}var c=new String("");var a="\\";var f={"{":Object,"[":Array};var b=Object.hasOwnProperty;return function(u,q){var p=u.match(d);var x;var v=p[0];var l=false;if("{"===v){x={}}else{if("["===v){x=[]}else{x=[];l=true}}var t;var r=[x];for(var o=1-l,m=p.length;o=0;){delete D[n[A]]}}}return q.call(C,B,D)};x=s({"":x},"")}return x}})(); -if(typeof KJUR=="undefined"||!KJUR){KJUR={}}if(typeof KJUR.asn1=="undefined"||!KJUR.asn1){KJUR.asn1={}}KJUR.asn1.ASN1Util=new function(){this.integerToByteHex=function(a){var b=a.toString(16);if((b.length%2)==1){b="0"+b}return b};this.bigIntToMinTwosComplementsHex=function(j){var f=j.toString(16);if(f.substr(0,1)!="-"){if(f.length%2==1){f="0"+f}else{if(!f.match(/^[0-7]/)){f="00"+f}}}else{var a=f.substr(1);var e=a.length;if(e%2==1){e+=1}else{if(!f.match(/^[0-7]/)){e+=2}}var g="";for(var d=0;d15){throw"ASN.1 length too long to represent by 8x: n = "+i.toString(16)}var f=128+g;return f.toString(16)+h}};this.getEncodedHex=function(){if(this.hTLV==null||this.isModified){this.hV=this.getFreshValueHex();this.hL=this.getLengthHexFromValue();this.hTLV=this.hT+this.hL+this.hV;this.isModified=false}return this.hTLV};this.getValueHex=function(){this.getEncodedHex();return this.hV};this.getFreshValueHex=function(){return""}};KJUR.asn1.DERAbstractString=function(c){KJUR.asn1.DERAbstractString.superclass.constructor.call(this);var b=null;var a=null;this.getString=function(){return this.s};this.setString=function(d){this.hTLV=null;this.isModified=true;this.s=d;this.hV=stohex(this.s)};this.setStringHex=function(d){this.hTLV=null;this.isModified=true;this.s=null;this.hV=d};this.getFreshValueHex=function(){return this.hV};if(typeof c!="undefined"){if(typeof c=="string"){this.setString(c)}else{if(typeof c.str!="undefined"){this.setString(c.str)}else{if(typeof c.hex!="undefined"){this.setStringHex(c.hex)}}}}};YAHOO.lang.extend(KJUR.asn1.DERAbstractString,KJUR.asn1.ASN1Object);KJUR.asn1.DERAbstractTime=function(c){KJUR.asn1.DERAbstractTime.superclass.constructor.call(this);var b=null;var a=null;this.localDateToUTC=function(f){utc=f.getTime()+(f.getTimezoneOffset()*60000);var e=new Date(utc);return e};this.formatDate=function(m,o,e){var g=this.zeroPadding;var n=this.localDateToUTC(m);var p=String(n.getFullYear());if(o=="utc"){p=p.substr(2,2)}var l=g(String(n.getMonth()+1),2);var q=g(String(n.getDate()),2);var h=g(String(n.getHours()),2);var i=g(String(n.getMinutes()),2);var j=g(String(n.getSeconds()),2);var r=p+l+q+h+i+j;if(e===true){var f=n.getMilliseconds();if(f!=0){var k=g(String(f),3);k=k.replace(/[0]+$/,"");r=r+"."+k}}return r+"Z"};this.zeroPadding=function(e,d){if(e.length>=d){return e}return new Array(d-e.length+1).join("0")+e};this.getString=function(){return this.s};this.setString=function(d){this.hTLV=null;this.isModified=true;this.s=d;this.hV=stohex(d)};this.setByDateValue=function(h,j,e,d,f,g){var i=new Date(Date.UTC(h,j-1,e,d,f,g,0));this.setByDate(i)};this.getFreshValueHex=function(){return this.hV}};YAHOO.lang.extend(KJUR.asn1.DERAbstractTime,KJUR.asn1.ASN1Object);KJUR.asn1.DERAbstractStructured=function(b){KJUR.asn1.DERAbstractString.superclass.constructor.call(this);var a=null;this.setByASN1ObjectArray=function(c){this.hTLV=null;this.isModified=true;this.asn1Array=c};this.appendASN1Object=function(c){this.hTLV=null;this.isModified=true;this.asn1Array.push(c)};this.asn1Array=new Array();if(typeof b!="undefined"){if(typeof b.array!="undefined"){this.asn1Array=b.array}}};YAHOO.lang.extend(KJUR.asn1.DERAbstractStructured,KJUR.asn1.ASN1Object);KJUR.asn1.DERBoolean=function(){KJUR.asn1.DERBoolean.superclass.constructor.call(this);this.hT="01";this.hTLV="0101ff"};YAHOO.lang.extend(KJUR.asn1.DERBoolean,KJUR.asn1.ASN1Object);KJUR.asn1.DERInteger=function(a){KJUR.asn1.DERInteger.superclass.constructor.call(this);this.hT="02";this.setByBigInteger=function(b){this.hTLV=null;this.isModified=true;this.hV=KJUR.asn1.ASN1Util.bigIntToMinTwosComplementsHex(b)};this.setByInteger=function(c){var b=new BigInteger(String(c),10);this.setByBigInteger(b)};this.setValueHex=function(b){this.hV=b};this.getFreshValueHex=function(){return this.hV};if(typeof a!="undefined"){if(typeof a.bigint!="undefined"){this.setByBigInteger(a.bigint)}else{if(typeof a["int"]!="undefined"){this.setByInteger(a["int"])}else{if(typeof a=="number"){this.setByInteger(a)}else{if(typeof a.hex!="undefined"){this.setValueHex(a.hex)}}}}}};YAHOO.lang.extend(KJUR.asn1.DERInteger,KJUR.asn1.ASN1Object);KJUR.asn1.DERBitString=function(b){if(b!==undefined&&typeof b.obj!=="undefined"){var a=KJUR.asn1.ASN1Util.newObject(b.obj);b.hex="00"+a.getEncodedHex()}KJUR.asn1.DERBitString.superclass.constructor.call(this);this.hT="03";this.setHexValueIncludingUnusedBits=function(c){this.hTLV=null;this.isModified=true;this.hV=c};this.setUnusedBitsAndHexValue=function(c,e){if(c<0||7=(l*2))){break}if(d>=200){break}g.push(b);c=b;d++}return g};ASN1HEX.getNthChildIdx=function(d,b,e){var c=ASN1HEX.getChildIdx(d,b);return c[e]};ASN1HEX.getIdxbyList=function(e,d,c,i){var g=ASN1HEX;var f,b;if(c.length==0){if(i!==undefined){if(e.substr(d,2)!==i){throw"checking tag doesn't match: "+e.substr(d,2)+"!="+i}}return d}f=c.shift();b=g.getChildIdx(e,d);return g.getIdxbyList(e,b[f],c,i)};ASN1HEX.getTLVbyList=function(d,c,b,f){var e=ASN1HEX;var a=e.getIdxbyList(d,c,b);if(a===undefined){throw"can't find nthList object"}if(f!==undefined){if(d.substr(a,2)!=f){throw"checking tag doesn't match: "+d.substr(a,2)+"!="+f}}return e.getTLV(d,a)};ASN1HEX.getVbyList=function(e,c,b,g,i){var f=ASN1HEX;var a,d;a=f.getIdxbyList(e,c,b,g);if(a===undefined){throw"can't find nthList object"}d=f.getV(e,a);if(i===true){d=d.substr(2)}return d};ASN1HEX.hextooidstr=function(e){var h=function(b,a){if(b.length>=a){return b}return new Array(a-b.length+1).join("0")+b};var l=[];var o=e.substr(0,2);var f=parseInt(o,16);l[0]=new String(Math.floor(f/40));l[1]=new String(f%40);var m=e.substr(2);var k=[];for(var g=0;g0){n=n+"."+j.join(".")}return n};ASN1HEX.dump=function(t,c,l,g){var p=ASN1HEX;var j=p.getV;var y=p.dump;var w=p.getChildIdx;var e=t;if(t instanceof KJUR.asn1.ASN1Object){e=t.getEncodedHex()}var q=function(A,i){if(A.length<=i*2){return A}else{var v=A.substr(0,i)+"..(total "+A.length/2+"bytes).."+A.substr(A.length-i,i);return v}};if(c===undefined){c={ommit_long_octet:32}}if(l===undefined){l=0}if(g===undefined){g=""}var x=c.ommit_long_octet;if(e.substr(l,2)=="01"){var h=j(e,l);if(h=="00"){return g+"BOOLEAN FALSE\n"}else{return g+"BOOLEAN TRUE\n"}}if(e.substr(l,2)=="02"){var h=j(e,l);return g+"INTEGER "+q(h,x)+"\n"}if(e.substr(l,2)=="03"){var h=j(e,l);return g+"BITSTRING "+q(h,x)+"\n"}if(e.substr(l,2)=="04"){var h=j(e,l);if(p.isASN1HEX(h)){var k=g+"OCTETSTRING, encapsulates\n";k=k+y(h,c,0,g+" ");return k}else{return g+"OCTETSTRING "+q(h,x)+"\n"}}if(e.substr(l,2)=="05"){return g+"NULL\n"}if(e.substr(l,2)=="06"){var m=j(e,l);var a=KJUR.asn1.ASN1Util.oidHexToInt(m);var o=KJUR.asn1.x509.OID.oid2name(a);var b=a.replace(/\./g," ");if(o!=""){return g+"ObjectIdentifier "+o+" ("+b+")\n"}else{return g+"ObjectIdentifier ("+b+")\n"}}if(e.substr(l,2)=="0c"){return g+"UTF8String '"+hextoutf8(j(e,l))+"'\n"}if(e.substr(l,2)=="13"){return g+"PrintableString '"+hextoutf8(j(e,l))+"'\n"}if(e.substr(l,2)=="14"){return g+"TeletexString '"+hextoutf8(j(e,l))+"'\n"}if(e.substr(l,2)=="16"){return g+"IA5String '"+hextoutf8(j(e,l))+"'\n"}if(e.substr(l,2)=="17"){return g+"UTCTime "+hextoutf8(j(e,l))+"\n"}if(e.substr(l,2)=="18"){return g+"GeneralizedTime "+hextoutf8(j(e,l))+"\n"}if(e.substr(l,2)=="30"){if(e.substr(l,4)=="3000"){return g+"SEQUENCE {}\n"}var k=g+"SEQUENCE\n";var d=w(e,l);var f=c;if((d.length==2||d.length==3)&&e.substr(d[0],2)=="06"&&e.substr(d[d.length-1],2)=="04"){var o=p.oidname(j(e,d[0]));var r=JSON.parse(JSON.stringify(c));r.x509ExtName=o;f=r}for(var u=0;u0){var m=new f({array:this.extensionsArray});var k=new c({explicit:true,tag:"a3",obj:m});this.asn1Array.push(k)}var n=new f({array:this.asn1Array});this.hTLV=n.getEncodedHex();this.isModified=false;return this.hTLV};this._initialize()};YAHOO.lang.extend(KJUR.asn1.x509.TBSCertificate,KJUR.asn1.ASN1Object);KJUR.asn1.x509.Extension=function(d){KJUR.asn1.x509.Extension.superclass.constructor.call(this);var f=null,a=KJUR,e=a.asn1,h=e.DERObjectIdentifier,i=e.DEROctetString,b=e.DERBitString,g=e.DERBoolean,c=e.DERSequence;this.getEncodedHex=function(){var m=new h({oid:this.oid});var l=new i({hex:this.getExtnValueHex()});var k=new Array();k.push(m);if(this.critical){k.push(new g())}k.push(l);var j=new c({array:k});return j.getEncodedHex()};this.critical=false;if(typeof d!="undefined"){if(typeof d.critical!="undefined"){this.critical=d.critical}}};YAHOO.lang.extend(KJUR.asn1.x509.Extension,KJUR.asn1.ASN1Object);KJUR.asn1.x509.Extension.appendByNameToArray=function(e,c,b){var g=e.toLowerCase(),f=KJUR.asn1.x509;if(g=="basicconstraints"){var d=new f.BasicConstraints(c);b.push(d)}else{if(g=="keyusage"){var d=new f.KeyUsage(c);b.push(d)}else{if(g=="crldistributionpoints"){var d=new f.CRLDistributionPoints(c);b.push(d)}else{if(g=="extkeyusage"){var d=new f.ExtKeyUsage(c);b.push(d)}else{if(g=="authoritykeyidentifier"){var d=new f.AuthorityKeyIdentifier(c);b.push(d)}else{if(g=="authorityinfoaccess"){var d=new f.AuthorityInfoAccess(c);b.push(d)}else{if(g=="subjectaltname"){var d=new f.SubjectAltName(c);b.push(d)}else{if(g=="issueraltname"){var d=new f.IssuerAltName(c);b.push(d)}else{throw"unsupported extension name: "+e}}}}}}}}};KJUR.asn1.x509.KeyUsage=function(a){KJUR.asn1.x509.KeyUsage.superclass.constructor.call(this,a);this.getExtnValueHex=function(){return this.asn1ExtnValue.getEncodedHex()};this.oid="2.5.29.15";if(typeof a!="undefined"){if(typeof a.bin!="undefined"){this.asn1ExtnValue=new KJUR.asn1.DERBitString(a)}}};YAHOO.lang.extend(KJUR.asn1.x509.KeyUsage,KJUR.asn1.x509.Extension);KJUR.asn1.x509.BasicConstraints=function(c){KJUR.asn1.x509.BasicConstraints.superclass.constructor.call(this,c);var a=false;var b=-1;this.getExtnValueHex=function(){var e=new Array();if(this.cA){e.push(new KJUR.asn1.DERBoolean())}if(this.pathLen>-1){e.push(new KJUR.asn1.DERInteger({"int":this.pathLen}))}var d=new KJUR.asn1.DERSequence({array:e});this.asn1ExtnValue=d;return this.asn1ExtnValue.getEncodedHex()};this.oid="2.5.29.19";this.cA=false;this.pathLen=-1;if(typeof c!="undefined"){if(typeof c.cA!="undefined"){this.cA=c.cA}if(typeof c.pathLen!="undefined"){this.pathLen=c.pathLen}}};YAHOO.lang.extend(KJUR.asn1.x509.BasicConstraints,KJUR.asn1.x509.Extension);KJUR.asn1.x509.CRLDistributionPoints=function(d){KJUR.asn1.x509.CRLDistributionPoints.superclass.constructor.call(this,d);var b=KJUR,a=b.asn1,c=a.x509;this.getExtnValueHex=function(){return this.asn1ExtnValue.getEncodedHex()};this.setByDPArray=function(e){this.asn1ExtnValue=new a.DERSequence({array:e})};this.setByOneURI=function(h){var e=new c.GeneralNames([{uri:h}]);var g=new c.DistributionPointName(e);var f=new c.DistributionPoint({dpobj:g});this.setByDPArray([f])};this.oid="2.5.29.31";if(typeof d!="undefined"){if(typeof d.array!="undefined"){this.setByDPArray(d.array)}else{if(typeof d.uri!="undefined"){this.setByOneURI(d.uri)}}}};YAHOO.lang.extend(KJUR.asn1.x509.CRLDistributionPoints,KJUR.asn1.x509.Extension);KJUR.asn1.x509.ExtKeyUsage=function(c){KJUR.asn1.x509.ExtKeyUsage.superclass.constructor.call(this,c);var b=KJUR,a=b.asn1;this.setPurposeArray=function(d){this.asn1ExtnValue=new a.DERSequence();for(var e=0;e0){var h=new b({array:this.aRevokedCert});this.asn1Array.push(h)}var i=new b({array:this.asn1Array});this.hTLV=i.getEncodedHex();this.isModified=false;return this.hTLV};this._initialize=function(){this.asn1Version=null;this.asn1SignatureAlg=null;this.asn1Issuer=null;this.asn1ThisUpdate=null;this.asn1NextUpdate=null;this.aRevokedCert=new Array()};this._initialize()};YAHOO.lang.extend(KJUR.asn1.x509.TBSCertList,KJUR.asn1.ASN1Object);KJUR.asn1.x509.CRLEntry=function(e){KJUR.asn1.x509.CRLEntry.superclass.constructor.call(this);var d=null,c=null,b=KJUR,a=b.asn1;this.setCertSerial=function(f){this.sn=new a.DERInteger(f)};this.setRevocationDate=function(f){this.time=new a.x509.Time(f)};this.getEncodedHex=function(){var f=new a.DERSequence({array:[this.sn,this.time]});this.TLV=f.getEncodedHex();return this.TLV};if(e!==undefined){if(e.time!==undefined){this.setRevocationDate(e.time)}if(e.sn!==undefined){this.setCertSerial(e.sn)}}};YAHOO.lang.extend(KJUR.asn1.x509.CRLEntry,KJUR.asn1.ASN1Object);KJUR.asn1.x509.X500Name=function(f){KJUR.asn1.x509.X500Name.superclass.constructor.call(this);this.asn1Array=new Array();var d=KJUR,c=d.asn1,e=c.x509,b=pemtohex;this.setByString=function(g){var h=g.split("/");h.shift();for(var j=0;j0;f++){var h=c.shift();if(e===true){var d=b.pop();var j=(d+","+h).replace(/\\,/g,",");b.push(j);e=false}else{b.push(h)}if(h.substr(-1,1)==="\\"){e=true}}b=b.map(function(a){return a.replace("/","\\/")});b.reverse();return"/"+b.join("/")};KJUR.asn1.x509.RDN=function(a){KJUR.asn1.x509.RDN.superclass.constructor.call(this);this.asn1Array=new Array();this.addByString=function(b){this.asn1Array.push(new KJUR.asn1.x509.AttributeTypeAndValue({str:b}))};this.addByMultiValuedString=function(d){var b=KJUR.asn1.x509.RDN.parseString(d);for(var c=0;c0;g++){var k=j.shift();if(h===true){var f=c.pop();var d=(f+"+"+k).replace(/\\\+/g,"+");c.push(d);h=false}else{c.push(k)}if(k.substr(-1,1)==="\\"){h=true}}var l=false;var b=[];for(var g=0;c.length>0;g++){var k=c.shift();if(l===true){var e=b.pop();if(k.match(/"$/)){var d=(e+"+"+k).replace(/^([^=]+)="(.*)"$/,"$1=$2");b.push(d);l=false}else{b.push(e+"+"+k)}}else{b.push(k)}if(k.match(/^[^=]+="/)){l=true}}return b};KJUR.asn1.x509.AttributeTypeAndValue=function(d){KJUR.asn1.x509.AttributeTypeAndValue.superclass.constructor.call(this);var f=null,e=null,a="utf8",c=KJUR,b=c.asn1;this.setByString=function(h){var g=h.match(/^([^=]+)=(.+)$/);if(g){this.setByAttrTypeAndValueStr(g[1],g[2])}else{throw"malformed attrTypeAndValueStr: "+h}};this.setByAttrTypeAndValueStr=function(i,h){this.typeObj=KJUR.asn1.x509.OID.atype2obj(i);var g=a;if(i=="C"){g="prn"}this.valueObj=this.getValueObj(g,h)};this.getValueObj=function(h,g){if(h=="utf8"){return new b.DERUTF8String({str:g})}if(h=="prn"){return new b.DERPrintableString({str:g})}if(h=="tel"){return new b.DERTeletexString({str:g})}if(h=="ia5"){return new b.DERIA5String({str:g})}throw"unsupported directory string type: type="+h+" value="+g};this.getEncodedHex=function(){var g=new b.DERSequence({array:[this.typeObj,this.valueObj]});this.TLV=g.getEncodedHex();return this.TLV};if(typeof d!="undefined"){if(typeof d.str!="undefined"){this.setByString(d.str)}}};YAHOO.lang.extend(KJUR.asn1.x509.AttributeTypeAndValue,KJUR.asn1.ASN1Object);KJUR.asn1.x509.SubjectPublicKeyInfo=function(f){KJUR.asn1.x509.SubjectPublicKeyInfo.superclass.constructor.call(this);var l=null,k=null,a=KJUR,j=a.asn1,i=j.DERInteger,b=j.DERBitString,m=j.DERObjectIdentifier,e=j.DERSequence,h=j.ASN1Util.newObject,d=j.x509,o=d.AlgorithmIdentifier,g=a.crypto,n=g.ECDSA,c=g.DSA;this.getASN1Object=function(){if(this.asn1AlgId==null||this.asn1SubjPKey==null){throw"algId and/or subjPubKey not set"}var p=new e({array:[this.asn1AlgId,this.asn1SubjPKey]});return p};this.getEncodedHex=function(){var p=this.getASN1Object();this.hTLV=p.getEncodedHex();return this.hTLV};this.setPubKey=function(q){try{if(q instanceof RSAKey){var u=h({seq:[{"int":{bigint:q.n}},{"int":{"int":q.e}}]});var s=u.getEncodedHex();this.asn1AlgId=new o({name:"rsaEncryption"});this.asn1SubjPKey=new b({hex:"00"+s})}}catch(p){}try{if(q instanceof KJUR.crypto.ECDSA){var r=new m({name:q.curveName});this.asn1AlgId=new o({name:"ecPublicKey",asn1params:r});this.asn1SubjPKey=new b({hex:"00"+q.pubKeyHex})}}catch(p){}try{if(q instanceof KJUR.crypto.DSA){var r=new h({seq:[{"int":{bigint:q.p}},{"int":{bigint:q.q}},{"int":{bigint:q.g}}]});this.asn1AlgId=new o({name:"dsa",asn1params:r});var t=new i({bigint:q.y});this.asn1SubjPKey=new b({hex:"00"+t.getEncodedHex()})}}catch(p){}};if(f!==undefined){this.setPubKey(f)}};YAHOO.lang.extend(KJUR.asn1.x509.SubjectPublicKeyInfo,KJUR.asn1.ASN1Object);KJUR.asn1.x509.Time=function(f){KJUR.asn1.x509.Time.superclass.constructor.call(this);var e=null,a=null,d=KJUR,c=d.asn1,b=c.DERUTCTime,g=c.DERGeneralizedTime;this.setTimeParams=function(h){this.timeParams=h};this.getEncodedHex=function(){var h=null;if(this.timeParams!=null){if(this.type=="utc"){h=new b(this.timeParams)}else{h=new g(this.timeParams)}}else{if(this.type=="utc"){h=new b()}else{h=new g()}}this.TLV=h.getEncodedHex();return this.TLV};this.type="utc";if(f!==undefined){if(f.type!==undefined){this.type=f.type}else{if(f.str!==undefined){if(f.str.match(/^[0-9]{12}Z$/)){this.type="utc"}if(f.str.match(/^[0-9]{14}Z$/)){this.type="gen"}}}this.timeParams=f}};YAHOO.lang.extend(KJUR.asn1.x509.Time,KJUR.asn1.ASN1Object);KJUR.asn1.x509.AlgorithmIdentifier=function(d){KJUR.asn1.x509.AlgorithmIdentifier.superclass.constructor.call(this);this.nameAlg=null;this.asn1Alg=null;this.asn1Params=null;this.paramEmpty=false;var b=KJUR,a=b.asn1;this.getEncodedHex=function(){if(this.nameAlg===null&&this.asn1Alg===null){throw"algorithm not specified"}if(this.nameAlg!==null&&this.asn1Alg===null){this.asn1Alg=a.x509.OID.name2obj(this.nameAlg)}var e=[this.asn1Alg];if(this.asn1Params!==null){e.push(this.asn1Params)}var f=new a.DERSequence({array:e});this.hTLV=f.getEncodedHex();return this.hTLV};if(d!==undefined){if(d.name!==undefined){this.nameAlg=d.name}if(d.asn1params!==undefined){this.asn1Params=d.asn1params}if(d.paramempty!==undefined){this.paramEmpty=d.paramempty}}if(this.asn1Params===null&&this.paramEmpty===false&&this.nameAlg!==null){var c=this.nameAlg.toLowerCase();if(c.substr(-7,7)!=="withdsa"&&c.substr(-9,9)!=="withecdsa"){this.asn1Params=new a.DERNull()}}};YAHOO.lang.extend(KJUR.asn1.x509.AlgorithmIdentifier,KJUR.asn1.ASN1Object);KJUR.asn1.x509.GeneralName=function(e){KJUR.asn1.x509.GeneralName.superclass.constructor.call(this);var k=null,h=null,i={rfc822:"81",dns:"82",dn:"a4",uri:"86"},b=KJUR,f=b.asn1,d=f.DERIA5String,c=f.DERTaggedObject,j=f.ASN1Object,a=f.x509.X500Name,g=pemtohex;this.explicit=false;this.setByParam=function(r){var q=null;var n=null;if(r===undefined){return}if(r.rfc822!==undefined){this.type="rfc822";n=new d({str:r[this.type]})}if(r.dns!==undefined){this.type="dns";n=new d({str:r[this.type]})}if(r.uri!==undefined){this.type="uri";n=new d({str:r[this.type]})}if(r.dn!==undefined){this.type="dn";n=new a({str:r.dn})}if(r.ldapdn!==undefined){this.type="dn";n=new a({ldapstr:r.ldapdn})}if(r.certissuer!==undefined){this.type="dn";this.explicit=true;var o=r.certissuer;var m=null;if(o.match(/^[0-9A-Fa-f]+$/)){m==o}if(o.indexOf("-----BEGIN ")!=-1){m=g(o)}if(m==null){throw"certissuer param not cert"}var l=new X509();l.hex=m;var p=l.getIssuerHex();n=new j();n.hTLV=p}if(r.certsubj!==undefined){this.type="dn";this.explicit=true;var o=r.certsubj;var m=null;if(o.match(/^[0-9A-Fa-f]+$/)){m==o}if(o.indexOf("-----BEGIN ")!=-1){m=g(o)}if(m==null){throw"certsubj param not cert"}var l=new X509();l.hex=m;var p=l.getSubjectHex();n=new j();n.hTLV=p}if(this.type==null){throw"unsupported type in params="+r}this.asn1Obj=new c({explicit:this.explicit,tag:i[this.type],obj:n})};this.getEncodedHex=function(){return this.asn1Obj.getEncodedHex()};if(e!==undefined){this.setByParam(e)}};YAHOO.lang.extend(KJUR.asn1.x509.GeneralName,KJUR.asn1.ASN1Object);KJUR.asn1.x509.GeneralNames=function(d){KJUR.asn1.x509.GeneralNames.superclass.constructor.call(this);var a=null,c=KJUR,b=c.asn1;this.setByParamArray=function(g){for(var e=0;e0){r=new b({obj:this.dUnsignedAttrs,tag:"a1",explicit:false})}var q=[this.dCMSVersion,this.dSignerIdentifier,this.dDigestAlgorithm,o,this.dSigAlg,this.dSig,];if(r!=null){q.push(r)}var p=new h.DERSequence({array:q});this.hTLV=p.getEncodedHex();return this.hTLV}};YAHOO.lang.extend(KJUR.asn1.cms.SignerInfo,KJUR.asn1.ASN1Object);KJUR.asn1.cms.EncapsulatedContentInfo=function(g){var c=KJUR,b=c.asn1,e=b.DERTaggedObject,a=b.DERSequence,h=b.DERObjectIdentifier,d=b.DEROctetString,f=b.cms;f.EncapsulatedContentInfo.superclass.constructor.call(this);this.dEContentType=new h({name:"data"});this.dEContent=null;this.isDetached=false;this.eContentValueHex=null;this.setContentType=function(i){if(i.match(/^[0-2][.][0-9.]+$/)){this.dEContentType=new h({oid:i})}else{this.dEContentType=new h({name:i})}};this.setContentValue=function(i){if(i!==undefined){if(typeof i.hex=="string"){this.eContentValueHex=i.hex}else{if(typeof i.str=="string"){this.eContentValueHex=utf8tohex(i.str)}}}};this.setContentValueHex=function(i){this.eContentValueHex=i};this.setContentValueStr=function(i){this.eContentValueHex=utf8tohex(i)};this.getEncodedHex=function(){if(typeof this.eContentValueHex!="string"){throw"eContentValue not yet set"}var k=new d({hex:this.eContentValueHex});this.dEContent=new e({obj:k,tag:"a0",explicit:true});var i=[this.dEContentType];if(!this.isDetached){i.push(this.dEContent)}var j=new a({array:i});this.hTLV=j.getEncodedHex();return this.hTLV}};YAHOO.lang.extend(KJUR.asn1.cms.EncapsulatedContentInfo,KJUR.asn1.ASN1Object);KJUR.asn1.cms.ContentInfo=function(f){var c=KJUR,b=c.asn1,d=b.DERTaggedObject,a=b.DERSequence,e=b.x509;KJUR.asn1.cms.ContentInfo.superclass.constructor.call(this);this.dContentType=null;this.dContent=null;this.setContentType=function(g){if(typeof g=="string"){this.dContentType=e.OID.name2obj(g)}};this.getEncodedHex=function(){var h=new d({obj:this.dContent,tag:"a0",explicit:true});var g=new a({array:[this.dContentType,h]});this.hTLV=g.getEncodedHex();return this.hTLV};if(f!==undefined){if(f.type){this.setContentType(f.type)}if(f.obj&&f.obj instanceof b.ASN1Object){this.dContent=f.obj}}};YAHOO.lang.extend(KJUR.asn1.cms.ContentInfo,KJUR.asn1.ASN1Object);KJUR.asn1.cms.SignedData=function(e){var a=KJUR,h=a.asn1,j=h.ASN1Object,g=h.DERInteger,m=h.DERSet,f=h.DERSequence,b=h.DERTaggedObject,l=h.cms,i=l.EncapsulatedContentInfo,d=l.SignerInfo,n=l.ContentInfo,c=h.x509,k=c.AlgorithmIdentifier;KJUR.asn1.cms.SignedData.superclass.constructor.call(this);this.dCMSVersion=new g({"int":1});this.dDigestAlgs=null;this.digestAlgNameList=[];this.dEncapContentInfo=new i();this.dCerts=null;this.certificateList=[];this.crlList=[];this.signerInfoList=[new d()];this.addCertificatesByPEM=function(p){var q=pemtohex(p);var r=new j();r.hTLV=q;this.certificateList.push(r)};this.getEncodedHex=function(){if(typeof this.hTLV=="string"){return this.hTLV}if(this.dDigestAlgs==null){var u=[];for(var t=0;t0){var v=new m({array:this.certificateList});this.dCerts=new b({obj:v,tag:"a0",explicit:false})}}if(this.dCerts!=null){p.push(this.dCerts)}var r=new m({array:this.signerInfoList});p.push(r);var q=new f({array:p});this.hTLV=q.getEncodedHex();return this.hTLV};this.getContentInfo=function(){this.getEncodedHex();var o=new n({type:"signed-data",obj:this});return o};this.getContentInfoEncodedHex=function(){var o=this.getContentInfo();var p=o.getEncodedHex();return p};this.getPEM=function(){return hextopem(this.getContentInfoEncodedHex(),"CMS")}};YAHOO.lang.extend(KJUR.asn1.cms.SignedData,KJUR.asn1.ASN1Object);KJUR.asn1.cms.CMSUtil=new function(){};KJUR.asn1.cms.CMSUtil.newSignedData=function(d){var b=KJUR,j=b.asn1,q=j.cms,f=q.SignerInfo,n=q.SignedData,o=q.SigningTime,a=q.SigningCertificate,p=q.SigningCertificateV2,c=j.cades,e=c.SignaturePolicyIdentifier;var m=new n();m.dEncapContentInfo.setContentValue(d.content);if(typeof d.certs=="object"){for(var h=0;h0){var s=new f({array:this.extensionsArray});var r=new m({array:[s]});var q=new f({array:[new k({oid:"1.2.840.113549.1.9.14"}),r]});var p=new c({explicit:true,tag:"a0",obj:q});this.asn1Array.push(p)}else{var p=new c({explicit:false,tag:"a0",obj:new j()});this.asn1Array.push(p)}var t=new f({array:this.asn1Array});this.hTLV=t.getEncodedHex();this.isModified=false;return this.hTLV};this._initialize()};YAHOO.lang.extend(KJUR.asn1.csr.CertificationRequestInfo,KJUR.asn1.ASN1Object);KJUR.asn1.csr.CSRUtil=new function(){};KJUR.asn1.csr.CSRUtil.newCSRPEM=function(h){var c=KEYUTIL,b=KJUR.asn1.csr;if(h.subject===undefined){throw"parameter subject undefined"}if(h.sbjpubkey===undefined){throw"parameter sbjpubkey undefined"}if(h.sigalg===undefined){throw"parameter sigalg undefined"}if(h.sbjprvkey===undefined){throw"parameter sbjpubkey undefined"}var d=new b.CertificationRequestInfo();d.setSubjectByParam(h.subject);d.setSubjectPublicKeyByGetKey(h.sbjpubkey);if(h.ext!==undefined&&h.ext.length!==undefined){for(var e=0;e"7"){return"00"+a}return a}function intarystrtohex(b){b=b.replace(/^\s*\[\s*/,"");b=b.replace(/\s*\]\s*$/,"");b=b.replace(/\s*/g,"");try{var c=b.split(/,/).map(function(g,e,h){var f=parseInt(g);if(f<0||255a.length){d=a.length}for(var b=0;bd){throw"key is too short for SigAlg: keylen="+j+","+a}var b="0001";var k="00"+c;var g="";var l=d-b.length-k.length;for(var f=0;f=0;--p){q=q.twice2D();q.z=BigInteger.ONE;if(o.testBit(p)){if(n.testBit(p)){q=q.add2D(t)}else{q=q.add2D(s)}}else{if(n.testBit(p)){q=q.add2D(r)}}}return q}this.getBigRandom=function(i){return new BigInteger(i.bitLength(),a).mod(i.subtract(BigInteger.ONE)).add(BigInteger.ONE)};this.setNamedCurve=function(i){this.ecparams=KJUR.crypto.ECParameterDB.getByName(i);this.prvKeyHex=null;this.pubKeyHex=null;this.curveName=i};this.setPrivateKeyHex=function(i){this.isPrivate=true;this.prvKeyHex=i};this.setPublicKeyHex=function(i){this.isPublic=true;this.pubKeyHex=i};this.getPublicKeyXYHex=function(){var k=this.pubKeyHex;if(k.substr(0,2)!=="04"){throw"this method supports uncompressed format(04) only"}var j=this.ecparams.keylen/4;if(k.length!==2+j*2){throw"malformed public key hex length"}var i={};i.x=k.substr(2,j);i.y=k.substr(2+j);return i};this.getShortNISTPCurveName=function(){var i=this.curveName;if(i==="secp256r1"||i==="NIST P-256"||i==="P-256"||i==="prime256v1"){return"P-256"}if(i==="secp384r1"||i==="NIST P-384"||i==="P-384"){return"P-384"}return null};this.generateKeyPairHex=function(){var k=this.ecparams.n;var n=this.getBigRandom(k);var l=this.ecparams.G.multiply(n);var q=l.getX().toBigInteger();var o=l.getY().toBigInteger();var i=this.ecparams.keylen/4;var m=("0000000000"+n.toString(16)).slice(-i);var r=("0000000000"+q.toString(16)).slice(-i);var p=("0000000000"+o.toString(16)).slice(-i);var j="04"+r+p;this.setPrivateKeyHex(m);this.setPublicKeyHex(j);return{ecprvhex:m,ecpubhex:j}};this.signWithMessageHash=function(i){return this.signHex(i,this.prvKeyHex)};this.signHex=function(o,j){var t=new BigInteger(j,16);var l=this.ecparams.n;var q=new BigInteger(o,16);do{var m=this.getBigRandom(l);var u=this.ecparams.G;var p=u.multiply(m);var i=p.getX().toBigInteger().mod(l)}while(i.compareTo(BigInteger.ZERO)<=0);var v=m.modInverse(l).multiply(q.add(t.multiply(i))).mod(l);return KJUR.crypto.ECDSA.biRSSigToASN1Sig(i,v)};this.sign=function(m,u){var q=u;var j=this.ecparams.n;var p=BigInteger.fromByteArrayUnsigned(m);do{var l=this.getBigRandom(j);var t=this.ecparams.G;var o=t.multiply(l);var i=o.getX().toBigInteger().mod(j)}while(i.compareTo(BigInteger.ZERO)<=0);var v=l.modInverse(j).multiply(p.add(q.multiply(i))).mod(j);return this.serializeSig(i,v)};this.verifyWithMessageHash=function(j,i){return this.verifyHex(j,i,this.pubKeyHex)};this.verifyHex=function(m,i,p){var l,j;var o=KJUR.crypto.ECDSA.parseSigHex(i);l=o.r;j=o.s;var k;k=ECPointFp.decodeFromHex(this.ecparams.curve,p);var n=new BigInteger(m,16);return this.verifyRaw(n,l,j,k)};this.verify=function(o,p,j){var l,i;if(Bitcoin.Util.isArray(p)){var n=this.parseSig(p);l=n.r;i=n.s}else{if("object"===typeof p&&p.r&&p.s){l=p.r;i=p.s}else{throw"Invalid value for signature"}}var k;if(j instanceof ECPointFp){k=j}else{if(Bitcoin.Util.isArray(j)){k=ECPointFp.decodeFrom(this.ecparams.curve,j)}else{throw"Invalid format for pubkey value, must be byte array or ECPointFp"}}var m=BigInteger.fromByteArrayUnsigned(o);return this.verifyRaw(m,l,i,k)};this.verifyRaw=function(o,i,w,m){var l=this.ecparams.n;var u=this.ecparams.G;if(i.compareTo(BigInteger.ONE)<0||i.compareTo(l)>=0){return false}if(w.compareTo(BigInteger.ONE)<0||w.compareTo(l)>=0){return false}var p=w.modInverse(l);var k=o.multiply(p).mod(l);var j=i.multiply(p).mod(l);var q=u.multiply(k).add(m.multiply(j));var t=q.getX().toBigInteger().mod(l);return t.equals(i)};this.serializeSig=function(k,j){var l=k.toByteArraySigned();var i=j.toByteArraySigned();var m=[];m.push(2);m.push(l.length);m=m.concat(l);m.push(2);m.push(i.length);m=m.concat(i);m.unshift(m.length);m.unshift(48);return m};this.parseSig=function(n){var m;if(n[0]!=48){throw new Error("Signature not a valid DERSequence")}m=2;if(n[m]!=2){throw new Error("First element in signature must be a DERInteger")}var l=n.slice(m+2,m+2+n[m+1]);m+=2+n[m+1];if(n[m]!=2){throw new Error("Second element in signature must be a DERInteger")}var i=n.slice(m+2,m+2+n[m+1]);m+=2+n[m+1];var k=BigInteger.fromByteArrayUnsigned(l);var j=BigInteger.fromByteArrayUnsigned(i);return{r:k,s:j}};this.parseSigCompact=function(m){if(m.length!==65){throw"Signature has the wrong length"}var j=m[0]-27;if(j<0||j>7){throw"Invalid signature type"}var o=this.ecparams.n;var l=BigInteger.fromByteArrayUnsigned(m.slice(1,33)).mod(o);var k=BigInteger.fromByteArrayUnsigned(m.slice(33,65)).mod(o);return{r:l,s:k,i:j}};this.readPKCS5PrvKeyHex=function(l){var n=ASN1HEX;var m=KJUR.crypto.ECDSA.getName;var p=n.getVbyList;if(n.isASN1HEX(l)===false){throw"not ASN.1 hex string"}var i,k,o;try{i=p(l,0,[2,0],"06");k=p(l,0,[1],"04");try{o=p(l,0,[3,0],"03").substr(2)}catch(j){}}catch(j){throw"malformed PKCS#1/5 plain ECC private key"}this.curveName=m(i);if(this.curveName===undefined){throw"unsupported curve name"}this.setNamedCurve(this.curveName);this.setPublicKeyHex(o);this.setPrivateKeyHex(k);this.isPublic=false};this.readPKCS8PrvKeyHex=function(l){var q=ASN1HEX;var i=KJUR.crypto.ECDSA.getName;var n=q.getVbyList;if(q.isASN1HEX(l)===false){throw"not ASN.1 hex string"}var j,p,m,k;try{j=n(l,0,[1,0],"06");p=n(l,0,[1,1],"06");m=n(l,0,[2,0,1],"04");try{k=n(l,0,[2,0,2,0],"03").substr(2)}catch(o){}}catch(o){throw"malformed PKCS#8 plain ECC private key"}this.curveName=i(p);if(this.curveName===undefined){throw"unsupported curve name"}this.setNamedCurve(this.curveName);this.setPublicKeyHex(k);this.setPrivateKeyHex(m);this.isPublic=false};this.readPKCS8PubKeyHex=function(l){var n=ASN1HEX;var m=KJUR.crypto.ECDSA.getName;var p=n.getVbyList;if(n.isASN1HEX(l)===false){throw"not ASN.1 hex string"}var k,i,o;try{k=p(l,0,[0,0],"06");i=p(l,0,[0,1],"06");o=p(l,0,[1],"03").substr(2)}catch(j){throw"malformed PKCS#8 ECC public key"}this.curveName=m(i);if(this.curveName===null){throw"unsupported curve name"}this.setNamedCurve(this.curveName);this.setPublicKeyHex(o)};this.readCertPubKeyHex=function(k,p){if(p!==5){p=6}var m=ASN1HEX;var l=KJUR.crypto.ECDSA.getName;var o=m.getVbyList;if(m.isASN1HEX(k)===false){throw"not ASN.1 hex string"}var i,n;try{i=o(k,0,[0,p,0,1],"06");n=o(k,0,[0,p,1],"03").substr(2)}catch(j){throw"malformed X.509 certificate ECC public key"}this.curveName=l(i);if(this.curveName===null){throw"unsupported curve name"}this.setNamedCurve(this.curveName);this.setPublicKeyHex(n)};if(h!==undefined){if(h.curve!==undefined){this.curveName=h.curve}}if(this.curveName===undefined){this.curveName=e}this.setNamedCurve(this.curveName);if(h!==undefined){if(h.prv!==undefined){this.setPrivateKeyHex(h.prv)}if(h.pub!==undefined){this.setPublicKeyHex(h.pub)}}};KJUR.crypto.ECDSA.parseSigHex=function(a){var b=KJUR.crypto.ECDSA.parseSigHexInHexRS(a);var d=new BigInteger(b.r,16);var c=new BigInteger(b.s,16);return{r:d,s:c}};KJUR.crypto.ECDSA.parseSigHexInHexRS=function(f){var j=ASN1HEX;var i=j.getChildIdx;var g=j.getV;if(f.substr(0,2)!="30"){throw"signature is not a ASN.1 sequence"}var h=i(f,0);if(h.length!=2){throw"number of signature ASN.1 sequence elements seem wrong"}var e=h[0];var d=h[1];if(f.substr(e,2)!="02"){throw"1st item of sequene of signature is not ASN.1 integer"}if(f.substr(d,2)!="02"){throw"2nd item of sequene of signature is not ASN.1 integer"}var c=g(f,e);var b=g(f,d);return{r:c,s:b}};KJUR.crypto.ECDSA.asn1SigToConcatSig=function(c){var d=KJUR.crypto.ECDSA.parseSigHexInHexRS(c);var b=d.r;var a=d.s;if(b.substr(0,2)=="00"&&(((b.length/2)*8)%(16*8))==8){b=b.substr(2)}if(a.substr(0,2)=="00"&&(((a.length/2)*8)%(16*8))==8){a=a.substr(2)}if((((b.length/2)*8)%(16*8))!=0){throw"unknown ECDSA sig r length error"}if((((a.length/2)*8)%(16*8))!=0){throw"unknown ECDSA sig s length error"}return b+a};KJUR.crypto.ECDSA.concatSigToASN1Sig=function(a){if((((a.length/2)*8)%(16*8))!=0){throw"unknown ECDSA concatinated r-s sig length error"}var c=a.substr(0,a.length/2);var b=a.substr(a.length/2);return KJUR.crypto.ECDSA.hexRSSigToASN1Sig(c,b)};KJUR.crypto.ECDSA.hexRSSigToASN1Sig=function(b,a){var d=new BigInteger(b,16);var c=new BigInteger(a,16);return KJUR.crypto.ECDSA.biRSSigToASN1Sig(d,c)};KJUR.crypto.ECDSA.biRSSigToASN1Sig=function(f,d){var c=KJUR.asn1;var b=new c.DERInteger({bigint:f});var a=new c.DERInteger({bigint:d});var e=new c.DERSequence({array:[b,a]});return e.getEncodedHex()};KJUR.crypto.ECDSA.getName=function(a){if(a==="2a8648ce3d030107"){return"secp256r1"}if(a==="2b8104000a"){return"secp256k1"}if(a==="2b81040022"){return"secp384r1"}if("|secp256r1|NIST P-256|P-256|prime256v1|".indexOf(a)!==-1){return"secp256r1"}if("|secp256k1|".indexOf(a)!==-1){return"secp256k1"}if("|secp384r1|NIST P-384|P-384|".indexOf(a)!==-1){return"secp384r1"}return null}; -if(typeof KJUR=="undefined"||!KJUR){KJUR={}}if(typeof KJUR.crypto=="undefined"||!KJUR.crypto){KJUR.crypto={}}KJUR.crypto.ECParameterDB=new function(){var b={};var c={};function a(d){return new BigInteger(d,16)}this.getByName=function(e){var d=e;if(typeof c[d]!="undefined"){d=c[e]}if(typeof b[d]!="undefined"){return b[d]}throw"unregistered EC curve name: "+d};this.regist=function(A,l,o,g,m,e,j,f,k,u,d,x){b[A]={};var s=a(o);var z=a(g);var y=a(m);var t=a(e);var w=a(j);var r=new ECCurveFp(s,z,y);var q=r.decodePointHex("04"+f+k);b[A]["name"]=A;b[A]["keylen"]=l;b[A]["curve"]=r;b[A]["G"]=q;b[A]["n"]=t;b[A]["h"]=w;b[A]["oid"]=d;b[A]["info"]=x;for(var v=0;v1){g=new BigInteger(i,16)}else{g=null}h=new BigInteger(j,16);this.setPrivate(c,a,e,g,h)};this.setPublic=function(c,b,a,d){this.isPublic=true;this.p=c;this.q=b;this.g=a;this.y=d;this.x=null};this.setPublicHex=function(f,e,d,g){var b,a,h,c;b=new BigInteger(f,16);a=new BigInteger(e,16);h=new BigInteger(d,16);c=new BigInteger(g,16);this.setPublic(b,a,h,c)};this.signWithMessageHash=function(d){var c=this.p;var b=this.q;var f=this.g;var i=this.y;var j=this.x;var e=KJUR.crypto.Util.getRandomBigIntegerMinToMax(BigInteger.ONE.add(BigInteger.ONE),b.subtract(BigInteger.ONE));var l=d.substr(0,b.bitLength()/4);var h=new BigInteger(l,16);var a=(f.modPow(e,c)).mod(b);var n=(e.modInverse(b).multiply(h.add(j.multiply(a)))).mod(b);var m=KJUR.asn1.ASN1Util.jsonToASN1HEX({seq:[{"int":{bigint:a}},{"int":{bigint:n}}]});return m};this.verifyWithMessageHash=function(h,f){var d=this.p;var b=this.q;var j=this.g;var l=this.y;var i=this.parseASN1Signature(f);var a=i[0];var t=i[1];var o=h.substr(0,b.bitLength()/4);var k=new BigInteger(o,16);if(BigInteger.ZERO.compareTo(a)>0||a.compareTo(b)>0){throw"invalid DSA signature"}if(BigInteger.ZERO.compareTo(t)>=0||t.compareTo(b)>0){throw"invalid DSA signature"}var m=t.modInverse(b);var e=k.multiply(m).mod(b);var c=a.multiply(m).mod(b);var n=j.modPow(e,d).multiply(l.modPow(c,d)).mod(d).mod(b);return n.compareTo(a)==0};this.parseASN1Signature=function(a){try{var d=new BigInteger(ASN1HEX.getVbyList(a,0,[0],"02"),16);var c=new BigInteger(ASN1HEX.getVbyList(a,0,[1],"02"),16);return[d,c]}catch(b){throw"malformed ASN.1 DSA signature"}};this.readPKCS5PrvKeyHex=function(c){var b,a,f,g,i;var j=ASN1HEX;var d=j.getVbyList;if(j.isASN1HEX(c)===false){throw"not ASN.1 hex string"}try{b=d(c,0,[1],"02");a=d(c,0,[2],"02");f=d(c,0,[3],"02");g=d(c,0,[4],"02");i=d(c,0,[5],"02")}catch(e){console.log("EXCEPTION:"+e);throw"malformed PKCS#1/5 plain DSA private key"}this.setPrivateHex(b,a,f,g,i)};this.readPKCS8PrvKeyHex=function(d){var f,c,b,g;var e=ASN1HEX;var i=e.getVbyList;if(e.isASN1HEX(d)===false){throw"not ASN.1 hex string"}try{f=i(d,0,[1,1,0],"02");c=i(d,0,[1,1,1],"02");b=i(d,0,[1,1,2],"02");g=i(d,0,[2,0],"02")}catch(a){console.log("EXCEPTION:"+a);throw"malformed PKCS#8 plain DSA private key"}this.setPrivateHex(f,c,b,null,g)};this.readPKCS8PubKeyHex=function(d){var f,c,b,g;var e=ASN1HEX;var i=e.getVbyList;if(e.isASN1HEX(d)===false){throw"not ASN.1 hex string"}try{f=i(d,0,[0,1,0],"02");c=i(d,0,[0,1,1],"02");b=i(d,0,[0,1,2],"02");g=i(d,0,[1,0],"02")}catch(a){console.log("EXCEPTION:"+a);throw"malformed PKCS#8 DSA public key"}this.setPublicHex(f,c,b,g)};this.readCertPubKeyHex=function(c,f){if(f!==5){f=6}var b,a,g,i;var j=ASN1HEX;var d=j.getVbyList;if(j.isASN1HEX(c)===false){throw"not ASN.1 hex string"}try{b=d(c,0,[0,f,0,1,0],"02");a=d(c,0,[0,f,0,1,1],"02");g=d(c,0,[0,f,0,1,2],"02");i=d(c,0,[0,f,1,0],"02")}catch(e){console.log("EXCEPTION:"+e);throw"malformed X.509 certificate DSA public key"}this.setPublicHex(b,a,g,i)}}; -var KEYUTIL=function(){var d=function(p,r,q){return k(CryptoJS.AES,p,r,q)};var e=function(p,r,q){return k(CryptoJS.TripleDES,p,r,q)};var a=function(p,r,q){return k(CryptoJS.DES,p,r,q)};var k=function(s,x,u,q){var r=CryptoJS.enc.Hex.parse(x);var w=CryptoJS.enc.Hex.parse(u);var p=CryptoJS.enc.Hex.parse(q);var t={};t.key=w;t.iv=p;t.ciphertext=r;var v=s.decrypt(t,w,{iv:p});return CryptoJS.enc.Hex.stringify(v)};var l=function(p,r,q){return g(CryptoJS.AES,p,r,q)};var o=function(p,r,q){return g(CryptoJS.TripleDES,p,r,q)};var f=function(p,r,q){return g(CryptoJS.DES,p,r,q)};var g=function(t,y,v,q){var s=CryptoJS.enc.Hex.parse(y);var x=CryptoJS.enc.Hex.parse(v);var p=CryptoJS.enc.Hex.parse(q);var w=t.encrypt(s,x,{iv:p});var r=CryptoJS.enc.Hex.parse(w.toString());var u=CryptoJS.enc.Base64.stringify(r);return u};var i={"AES-256-CBC":{proc:d,eproc:l,keylen:32,ivlen:16},"AES-192-CBC":{proc:d,eproc:l,keylen:24,ivlen:16},"AES-128-CBC":{proc:d,eproc:l,keylen:16,ivlen:16},"DES-EDE3-CBC":{proc:e,eproc:o,keylen:24,ivlen:8},"DES-CBC":{proc:a,eproc:f,keylen:8,ivlen:8}};var c=function(p){return i[p]["proc"]};var m=function(p){var r=CryptoJS.lib.WordArray.random(p);var q=CryptoJS.enc.Hex.stringify(r);return q};var n=function(v){var w={};var q=v.match(new RegExp("DEK-Info: ([^,]+),([0-9A-Fa-f]+)","m"));if(q){w.cipher=q[1];w.ivsalt=q[2]}var p=v.match(new RegExp("-----BEGIN ([A-Z]+) PRIVATE KEY-----"));if(p){w.type=p[1]}var u=-1;var x=0;if(v.indexOf("\r\n\r\n")!=-1){u=v.indexOf("\r\n\r\n");x=2}if(v.indexOf("\n\n")!=-1){u=v.indexOf("\n\n");x=1}var t=v.indexOf("-----END");if(u!=-1&&t!=-1){var r=v.substring(u+x*2,t-x);r=r.replace(/\s+/g,"");w.data=r}return w};var j=function(q,y,p){var v=p.substring(0,16);var t=CryptoJS.enc.Hex.parse(v);var r=CryptoJS.enc.Utf8.parse(y);var u=i[q]["keylen"]+i[q]["ivlen"];var x="";var w=null;for(;;){var s=CryptoJS.algo.MD5.create();if(w!=null){s.update(w)}s.update(r);s.update(t);w=s.finalize();x=x+CryptoJS.enc.Hex.stringify(w);if(x.length>=u*2){break}}var z={};z.keyhex=x.substr(0,i[q]["keylen"]*2);z.ivhex=x.substr(i[q]["keylen"]*2,i[q]["ivlen"]*2);return z};var b=function(p,v,r,w){var s=CryptoJS.enc.Base64.parse(p);var q=CryptoJS.enc.Hex.stringify(s);var u=i[v]["proc"];var t=u(q,r,w);return t};var h=function(p,s,q,u){var r=i[s]["eproc"];var t=r(p,q,u);return t};return{version:"1.0.0",parsePKCS5PEM:function(p){return n(p)},getKeyAndUnusedIvByPasscodeAndIvsalt:function(q,p,r){return j(q,p,r)},decryptKeyB64:function(p,r,q,s){return b(p,r,q,s)},getDecryptedKeyHex:function(y,x){var q=n(y);var t=q.type;var r=q.cipher;var p=q.ivsalt;var s=q.data;var w=j(r,x,p);var v=w.keyhex;var u=b(s,r,v,p);return u},getEncryptedPKCS5PEMFromPrvKeyHex:function(x,s,A,t,r){var p="";if(typeof t=="undefined"||t==null){t="AES-256-CBC"}if(typeof i[t]=="undefined"){throw"KEYUTIL unsupported algorithm: "+t}if(typeof r=="undefined"||r==null){var v=i[t]["ivlen"];var u=m(v);r=u.toUpperCase()}var z=j(t,A,r);var y=z.keyhex;var w=h(s,t,y,r);var q=w.replace(/(.{64})/g,"$1\r\n");var p="-----BEGIN "+x+" PRIVATE KEY-----\r\n";p+="Proc-Type: 4,ENCRYPTED\r\n";p+="DEK-Info: "+t+","+r+"\r\n";p+="\r\n";p+=q;p+="\r\n-----END "+x+" PRIVATE KEY-----\r\n";return p},parseHexOfEncryptedPKCS8:function(y){var B=ASN1HEX;var z=B.getChildIdx;var w=B.getV;var t={};var r=z(y,0);if(r.length!=2){throw"malformed format: SEQUENCE(0).items != 2: "+r.length}t.ciphertext=w(y,r[1]);var A=z(y,r[0]);if(A.length!=2){throw"malformed format: SEQUENCE(0.0).items != 2: "+A.length}if(w(y,A[0])!="2a864886f70d01050d"){throw"this only supports pkcs5PBES2"}var p=z(y,A[1]);if(A.length!=2){throw"malformed format: SEQUENCE(0.0.1).items != 2: "+p.length}var q=z(y,p[1]);if(q.length!=2){throw"malformed format: SEQUENCE(0.0.1.1).items != 2: "+q.length}if(w(y,q[0])!="2a864886f70d0307"){throw"this only supports TripleDES"}t.encryptionSchemeAlg="TripleDES";t.encryptionSchemeIV=w(y,q[1]);var s=z(y,p[0]);if(s.length!=2){throw"malformed format: SEQUENCE(0.0.1.0).items != 2: "+s.length}if(w(y,s[0])!="2a864886f70d01050c"){throw"this only supports pkcs5PBKDF2"}var x=z(y,s[1]);if(x.length<2){throw"malformed format: SEQUENCE(0.0.1.0.1).items < 2: "+x.length}t.pbkdf2Salt=w(y,x[0]);var u=w(y,x[1]);try{t.pbkdf2Iter=parseInt(u,16)}catch(v){throw"malformed format pbkdf2Iter: "+u}return t},getPBKDF2KeyHexFromParam:function(u,p){var t=CryptoJS.enc.Hex.parse(u.pbkdf2Salt);var q=u.pbkdf2Iter;var s=CryptoJS.PBKDF2(p,t,{keySize:192/32,iterations:q});var r=CryptoJS.enc.Hex.stringify(s);return r},_getPlainPKCS8HexFromEncryptedPKCS8PEM:function(x,y){var r=pemtohex(x,"ENCRYPTED PRIVATE KEY");var p=this.parseHexOfEncryptedPKCS8(r);var u=KEYUTIL.getPBKDF2KeyHexFromParam(p,y);var v={};v.ciphertext=CryptoJS.enc.Hex.parse(p.ciphertext);var t=CryptoJS.enc.Hex.parse(u);var s=CryptoJS.enc.Hex.parse(p.encryptionSchemeIV);var w=CryptoJS.TripleDES.decrypt(v,t,{iv:s});var q=CryptoJS.enc.Hex.stringify(w);return q},getKeyFromEncryptedPKCS8PEM:function(s,q){var p=this._getPlainPKCS8HexFromEncryptedPKCS8PEM(s,q);var r=this.getKeyFromPlainPrivatePKCS8Hex(p);return r},parsePlainPrivatePKCS8Hex:function(s){var v=ASN1HEX;var u=v.getChildIdx;var t=v.getV;var q={};q.algparam=null;if(s.substr(0,2)!="30"){throw"malformed plain PKCS8 private key(code:001)"}var r=u(s,0);if(r.length!=3){throw"malformed plain PKCS8 private key(code:002)"}if(s.substr(r[1],2)!="30"){throw"malformed PKCS8 private key(code:003)"}var p=u(s,r[1]);if(p.length!=2){throw"malformed PKCS8 private key(code:004)"}if(s.substr(p[0],2)!="06"){throw"malformed PKCS8 private key(code:005)"}q.algoid=t(s,p[0]);if(s.substr(p[1],2)=="06"){q.algparam=t(s,p[1])}if(s.substr(r[2],2)!="04"){throw"malformed PKCS8 private key(code:006)"}q.keyidx=v.getVidx(s,r[2]);return q},getKeyFromPlainPrivatePKCS8PEM:function(q){var p=pemtohex(q,"PRIVATE KEY");var r=this.getKeyFromPlainPrivatePKCS8Hex(p);return r},getKeyFromPlainPrivatePKCS8Hex:function(p){var q=this.parsePlainPrivatePKCS8Hex(p);var r;if(q.algoid=="2a864886f70d010101"){r=new RSAKey()}else{if(q.algoid=="2a8648ce380401"){r=new KJUR.crypto.DSA()}else{if(q.algoid=="2a8648ce3d0201"){r=new KJUR.crypto.ECDSA()}else{throw"unsupported private key algorithm"}}}r.readPKCS8PrvKeyHex(p);return r},_getKeyFromPublicPKCS8Hex:function(q){var p;var r=ASN1HEX.getVbyList(q,0,[0,0],"06");if(r==="2a864886f70d010101"){p=new RSAKey()}else{if(r==="2a8648ce380401"){p=new KJUR.crypto.DSA()}else{if(r==="2a8648ce3d0201"){p=new KJUR.crypto.ECDSA()}else{throw"unsupported PKCS#8 public key hex"}}}p.readPKCS8PubKeyHex(q);return p},parsePublicRawRSAKeyHex:function(r){var u=ASN1HEX;var t=u.getChildIdx;var s=u.getV;var p={};if(r.substr(0,2)!="30"){throw"malformed RSA key(code:001)"}var q=t(r,0);if(q.length!=2){throw"malformed RSA key(code:002)"}if(r.substr(q[0],2)!="02"){throw"malformed RSA key(code:003)"}p.n=s(r,q[0]);if(r.substr(q[1],2)!="02"){throw"malformed RSA key(code:004)"}p.e=s(r,q[1]);return p},parsePublicPKCS8Hex:function(t){var v=ASN1HEX;var u=v.getChildIdx;var s=v.getV;var q={};q.algparam=null;var r=u(t,0);if(r.length!=2){throw"outer DERSequence shall have 2 elements: "+r.length}var w=r[0];if(t.substr(w,2)!="30"){throw"malformed PKCS8 public key(code:001)"}var p=u(t,w);if(p.length!=2){throw"malformed PKCS8 public key(code:002)"}if(t.substr(p[0],2)!="06"){throw"malformed PKCS8 public key(code:003)"}q.algoid=s(t,p[0]);if(t.substr(p[1],2)=="06"){q.algparam=s(t,p[1])}else{if(t.substr(p[1],2)=="30"){q.algparam={};q.algparam.p=v.getVbyList(t,p[1],[0],"02");q.algparam.q=v.getVbyList(t,p[1],[1],"02");q.algparam.g=v.getVbyList(t,p[1],[2],"02")}}if(t.substr(r[1],2)!="03"){throw"malformed PKCS8 public key(code:004)"}q.key=s(t,r[1]).substr(2);return q},}}();KEYUTIL.getKey=function(l,k,n){var G=ASN1HEX,L=G.getChildIdx,v=G.getV,d=G.getVbyList,c=KJUR.crypto,i=c.ECDSA,C=c.DSA,w=RSAKey,M=pemtohex,F=KEYUTIL;if(typeof w!="undefined"&&l instanceof w){return l}if(typeof i!="undefined"&&l instanceof i){return l}if(typeof C!="undefined"&&l instanceof C){return l}if(l.curve!==undefined&&l.xy!==undefined&&l.d===undefined){return new i({pub:l.xy,curve:l.curve})}if(l.curve!==undefined&&l.d!==undefined){return new i({prv:l.d,curve:l.curve})}if(l.kty===undefined&&l.n!==undefined&&l.e!==undefined&&l.d===undefined){var P=new w();P.setPublic(l.n,l.e);return P}if(l.kty===undefined&&l.n!==undefined&&l.e!==undefined&&l.d!==undefined&&l.p!==undefined&&l.q!==undefined&&l.dp!==undefined&&l.dq!==undefined&&l.co!==undefined&&l.qi===undefined){var P=new w();P.setPrivateEx(l.n,l.e,l.d,l.p,l.q,l.dp,l.dq,l.co);return P}if(l.kty===undefined&&l.n!==undefined&&l.e!==undefined&&l.d!==undefined&&l.p===undefined){var P=new w();P.setPrivate(l.n,l.e,l.d);return P}if(l.p!==undefined&&l.q!==undefined&&l.g!==undefined&&l.y!==undefined&&l.x===undefined){var P=new C();P.setPublic(l.p,l.q,l.g,l.y);return P}if(l.p!==undefined&&l.q!==undefined&&l.g!==undefined&&l.y!==undefined&&l.x!==undefined){var P=new C();P.setPrivate(l.p,l.q,l.g,l.y,l.x);return P}if(l.kty==="RSA"&&l.n!==undefined&&l.e!==undefined&&l.d===undefined){var P=new w();P.setPublic(b64utohex(l.n),b64utohex(l.e));return P}if(l.kty==="RSA"&&l.n!==undefined&&l.e!==undefined&&l.d!==undefined&&l.p!==undefined&&l.q!==undefined&&l.dp!==undefined&&l.dq!==undefined&&l.qi!==undefined){var P=new w();P.setPrivateEx(b64utohex(l.n),b64utohex(l.e),b64utohex(l.d),b64utohex(l.p),b64utohex(l.q),b64utohex(l.dp),b64utohex(l.dq),b64utohex(l.qi));return P}if(l.kty==="RSA"&&l.n!==undefined&&l.e!==undefined&&l.d!==undefined){var P=new w();P.setPrivate(b64utohex(l.n),b64utohex(l.e),b64utohex(l.d));return P}if(l.kty==="EC"&&l.crv!==undefined&&l.x!==undefined&&l.y!==undefined&&l.d===undefined){var j=new i({curve:l.crv});var t=j.ecparams.keylen/4;var B=("0000000000"+b64utohex(l.x)).slice(-t);var z=("0000000000"+b64utohex(l.y)).slice(-t);var u="04"+B+z;j.setPublicKeyHex(u);return j}if(l.kty==="EC"&&l.crv!==undefined&&l.x!==undefined&&l.y!==undefined&&l.d!==undefined){var j=new i({curve:l.crv});var t=j.ecparams.keylen/4;var B=("0000000000"+b64utohex(l.x)).slice(-t);var z=("0000000000"+b64utohex(l.y)).slice(-t);var u="04"+B+z;var b=("0000000000"+b64utohex(l.d)).slice(-t);j.setPublicKeyHex(u);j.setPrivateKeyHex(b);return j}if(n==="pkcs5prv"){var J=l,G=ASN1HEX,N,P;N=L(J,0);if(N.length===9){P=new w();P.readPKCS5PrvKeyHex(J)}else{if(N.length===6){P=new C();P.readPKCS5PrvKeyHex(J)}else{if(N.length>2&&J.substr(N[1],2)==="04"){P=new i();P.readPKCS5PrvKeyHex(J)}else{throw"unsupported PKCS#1/5 hexadecimal key"}}}return P}if(n==="pkcs8prv"){var P=F.getKeyFromPlainPrivatePKCS8Hex(l);return P}if(n==="pkcs8pub"){return F._getKeyFromPublicPKCS8Hex(l)}if(n==="x509pub"){return X509.getPublicKeyFromCertHex(l)}if(l.indexOf("-END CERTIFICATE-",0)!=-1||l.indexOf("-END X509 CERTIFICATE-",0)!=-1||l.indexOf("-END TRUSTED CERTIFICATE-",0)!=-1){return X509.getPublicKeyFromCertPEM(l)}if(l.indexOf("-END PUBLIC KEY-")!=-1){var O=pemtohex(l,"PUBLIC KEY");return F._getKeyFromPublicPKCS8Hex(O)}if(l.indexOf("-END RSA PRIVATE KEY-")!=-1&&l.indexOf("4,ENCRYPTED")==-1){var m=M(l,"RSA PRIVATE KEY");return F.getKey(m,null,"pkcs5prv")}if(l.indexOf("-END DSA PRIVATE KEY-")!=-1&&l.indexOf("4,ENCRYPTED")==-1){var I=M(l,"DSA PRIVATE KEY");var E=d(I,0,[1],"02");var D=d(I,0,[2],"02");var K=d(I,0,[3],"02");var r=d(I,0,[4],"02");var s=d(I,0,[5],"02");var P=new C();P.setPrivate(new BigInteger(E,16),new BigInteger(D,16),new BigInteger(K,16),new BigInteger(r,16),new BigInteger(s,16));return P}if(l.indexOf("-END PRIVATE KEY-")!=-1){return F.getKeyFromPlainPrivatePKCS8PEM(l)}if(l.indexOf("-END RSA PRIVATE KEY-")!=-1&&l.indexOf("4,ENCRYPTED")!=-1){var o=F.getDecryptedKeyHex(l,k);var H=new RSAKey();H.readPKCS5PrvKeyHex(o);return H}if(l.indexOf("-END EC PRIVATE KEY-")!=-1&&l.indexOf("4,ENCRYPTED")!=-1){var I=F.getDecryptedKeyHex(l,k);var P=d(I,0,[1],"04");var f=d(I,0,[2,0],"06");var A=d(I,0,[3,0],"03").substr(2);var e="";if(KJUR.crypto.OID.oidhex2name[f]!==undefined){e=KJUR.crypto.OID.oidhex2name[f]}else{throw"undefined OID(hex) in KJUR.crypto.OID: "+f}var j=new i({curve:e});j.setPublicKeyHex(A);j.setPrivateKeyHex(P);j.isPublic=false;return j}if(l.indexOf("-END DSA PRIVATE KEY-")!=-1&&l.indexOf("4,ENCRYPTED")!=-1){var I=F.getDecryptedKeyHex(l,k);var E=d(I,0,[1],"02");var D=d(I,0,[2],"02");var K=d(I,0,[3],"02");var r=d(I,0,[4],"02");var s=d(I,0,[5],"02");var P=new C();P.setPrivate(new BigInteger(E,16),new BigInteger(D,16),new BigInteger(K,16),new BigInteger(r,16),new BigInteger(s,16));return P}if(l.indexOf("-END ENCRYPTED PRIVATE KEY-")!=-1){return F.getKeyFromEncryptedPKCS8PEM(l,k)}throw"not supported argument"};KEYUTIL.generateKeypair=function(a,c){if(a=="RSA"){var b=c;var h=new RSAKey();h.generate(b,"10001");h.isPrivate=true;h.isPublic=true;var f=new RSAKey();var e=h.n.toString(16);var i=h.e.toString(16);f.setPublic(e,i);f.isPrivate=false;f.isPublic=true;var k={};k.prvKeyObj=h;k.pubKeyObj=f;return k}else{if(a=="EC"){var d=c;var g=new KJUR.crypto.ECDSA({curve:d});var j=g.generateKeyPairHex();var h=new KJUR.crypto.ECDSA({curve:d});h.setPublicKeyHex(j.ecpubhex);h.setPrivateKeyHex(j.ecprvhex);h.isPrivate=true;h.isPublic=false;var f=new KJUR.crypto.ECDSA({curve:d});f.setPublicKeyHex(j.ecpubhex);f.isPrivate=false;f.isPublic=true;var k={};k.prvKeyObj=h;k.pubKeyObj=f;return k}else{throw"unknown algorithm: "+a}}};KEYUTIL.getPEM=function(b,D,y,m,q,j){var F=KJUR,k=F.asn1,z=k.DERObjectIdentifier,f=k.DERInteger,l=k.ASN1Util.newObject,a=k.x509,C=a.SubjectPublicKeyInfo,e=F.crypto,u=e.DSA,r=e.ECDSA,n=RSAKey;function A(s){var G=l({seq:[{"int":0},{"int":{bigint:s.n}},{"int":s.e},{"int":{bigint:s.d}},{"int":{bigint:s.p}},{"int":{bigint:s.q}},{"int":{bigint:s.dmp1}},{"int":{bigint:s.dmq1}},{"int":{bigint:s.coeff}}]});return G}function B(G){var s=l({seq:[{"int":1},{octstr:{hex:G.prvKeyHex}},{tag:["a0",true,{oid:{name:G.curveName}}]},{tag:["a1",true,{bitstr:{hex:"00"+G.pubKeyHex}}]}]});return s}function x(s){var G=l({seq:[{"int":0},{"int":{bigint:s.p}},{"int":{bigint:s.q}},{"int":{bigint:s.g}},{"int":{bigint:s.y}},{"int":{bigint:s.x}}]});return G}if(((n!==undefined&&b instanceof n)||(u!==undefined&&b instanceof u)||(r!==undefined&&b instanceof r))&&b.isPublic==true&&(D===undefined||D=="PKCS8PUB")){var E=new C(b);var w=E.getEncodedHex();return hextopem(w,"PUBLIC KEY")}if(D=="PKCS1PRV"&&n!==undefined&&b instanceof n&&(y===undefined||y==null)&&b.isPrivate==true){var E=A(b);var w=E.getEncodedHex();return hextopem(w,"RSA PRIVATE KEY")}if(D=="PKCS1PRV"&&r!==undefined&&b instanceof r&&(y===undefined||y==null)&&b.isPrivate==true){var i=new z({name:b.curveName});var v=i.getEncodedHex();var h=B(b);var t=h.getEncodedHex();var p="";p+=hextopem(v,"EC PARAMETERS");p+=hextopem(t,"EC PRIVATE KEY");return p}if(D=="PKCS1PRV"&&u!==undefined&&b instanceof u&&(y===undefined||y==null)&&b.isPrivate==true){var E=x(b);var w=E.getEncodedHex();return hextopem(w,"DSA PRIVATE KEY")}if(D=="PKCS5PRV"&&n!==undefined&&b instanceof n&&(y!==undefined&&y!=null)&&b.isPrivate==true){var E=A(b);var w=E.getEncodedHex();if(m===undefined){m="DES-EDE3-CBC"}return this.getEncryptedPKCS5PEMFromPrvKeyHex("RSA",w,y,m,j)}if(D=="PKCS5PRV"&&r!==undefined&&b instanceof r&&(y!==undefined&&y!=null)&&b.isPrivate==true){var E=B(b);var w=E.getEncodedHex();if(m===undefined){m="DES-EDE3-CBC"}return this.getEncryptedPKCS5PEMFromPrvKeyHex("EC",w,y,m,j)}if(D=="PKCS5PRV"&&u!==undefined&&b instanceof u&&(y!==undefined&&y!=null)&&b.isPrivate==true){var E=x(b);var w=E.getEncodedHex();if(m===undefined){m="DES-EDE3-CBC"}return this.getEncryptedPKCS5PEMFromPrvKeyHex("DSA",w,y,m,j)}var o=function(G,s){var I=c(G,s);var H=new l({seq:[{seq:[{oid:{name:"pkcs5PBES2"}},{seq:[{seq:[{oid:{name:"pkcs5PBKDF2"}},{seq:[{octstr:{hex:I.pbkdf2Salt}},{"int":I.pbkdf2Iter}]}]},{seq:[{oid:{name:"des-EDE3-CBC"}},{octstr:{hex:I.encryptionSchemeIV}}]}]}]},{octstr:{hex:I.ciphertext}}]});return H.getEncodedHex()};var c=function(N,O){var H=100;var M=CryptoJS.lib.WordArray.random(8);var L="DES-EDE3-CBC";var s=CryptoJS.lib.WordArray.random(8);var I=CryptoJS.PBKDF2(O,M,{keySize:192/32,iterations:H});var J=CryptoJS.enc.Hex.parse(N);var K=CryptoJS.TripleDES.encrypt(J,I,{iv:s})+"";var G={};G.ciphertext=K;G.pbkdf2Salt=CryptoJS.enc.Hex.stringify(M);G.pbkdf2Iter=H;G.encryptionSchemeAlg=L;G.encryptionSchemeIV=CryptoJS.enc.Hex.stringify(s);return G};if(D=="PKCS8PRV"&&n!=undefined&&b instanceof n&&b.isPrivate==true){var g=A(b);var d=g.getEncodedHex();var E=l({seq:[{"int":0},{seq:[{oid:{name:"rsaEncryption"}},{"null":true}]},{octstr:{hex:d}}]});var w=E.getEncodedHex();if(y===undefined||y==null){return hextopem(w,"PRIVATE KEY")}else{var t=o(w,y);return hextopem(t,"ENCRYPTED PRIVATE KEY")}}if(D=="PKCS8PRV"&&r!==undefined&&b instanceof r&&b.isPrivate==true){var g=new l({seq:[{"int":1},{octstr:{hex:b.prvKeyHex}},{tag:["a1",true,{bitstr:{hex:"00"+b.pubKeyHex}}]}]});var d=g.getEncodedHex();var E=l({seq:[{"int":0},{seq:[{oid:{name:"ecPublicKey"}},{oid:{name:b.curveName}}]},{octstr:{hex:d}}]});var w=E.getEncodedHex();if(y===undefined||y==null){return hextopem(w,"PRIVATE KEY")}else{var t=o(w,y);return hextopem(t,"ENCRYPTED PRIVATE KEY")}}if(D=="PKCS8PRV"&&u!==undefined&&b instanceof u&&b.isPrivate==true){var g=new f({bigint:b.x});var d=g.getEncodedHex();var E=l({seq:[{"int":0},{seq:[{oid:{name:"dsa"}},{seq:[{"int":{bigint:b.p}},{"int":{bigint:b.q}},{"int":{bigint:b.g}}]}]},{octstr:{hex:d}}]});var w=E.getEncodedHex();if(y===undefined||y==null){return hextopem(w,"PRIVATE KEY")}else{var t=o(w,y);return hextopem(t,"ENCRYPTED PRIVATE KEY")}}throw"unsupported object nor format"};KEYUTIL.getKeyFromCSRPEM=function(b){var a=pemtohex(b,"CERTIFICATE REQUEST");var c=KEYUTIL.getKeyFromCSRHex(a);return c};KEYUTIL.getKeyFromCSRHex=function(a){var c=KEYUTIL.parseCSRHex(a);var b=KEYUTIL.getKey(c.p8pubkeyhex,null,"pkcs8pub");return b};KEYUTIL.parseCSRHex=function(d){var i=ASN1HEX;var f=i.getChildIdx;var c=i.getTLV;var b={};var g=d;if(g.substr(0,2)!="30"){throw"malformed CSR(code:001)"}var e=f(g,0);if(e.length<1){throw"malformed CSR(code:002)"}if(g.substr(e[0],2)!="30"){throw"malformed CSR(code:003)"}var a=f(g,e[0]);if(a.length<3){throw"malformed CSR(code:004)"}b.p8pubkeyhex=c(g,a[2]);return b};KEYUTIL.getJWKFromKey=function(d){var b={};if(d instanceof RSAKey&&d.isPrivate){b.kty="RSA";b.n=hextob64u(d.n.toString(16));b.e=hextob64u(d.e.toString(16));b.d=hextob64u(d.d.toString(16));b.p=hextob64u(d.p.toString(16));b.q=hextob64u(d.q.toString(16));b.dp=hextob64u(d.dmp1.toString(16));b.dq=hextob64u(d.dmq1.toString(16));b.qi=hextob64u(d.coeff.toString(16));return b}else{if(d instanceof RSAKey&&d.isPublic){b.kty="RSA";b.n=hextob64u(d.n.toString(16));b.e=hextob64u(d.e.toString(16));return b}else{if(d instanceof KJUR.crypto.ECDSA&&d.isPrivate){var a=d.getShortNISTPCurveName();if(a!=="P-256"&&a!=="P-384"){throw"unsupported curve name for JWT: "+a}var c=d.getPublicKeyXYHex();b.kty="EC";b.crv=a;b.x=hextob64u(c.x);b.y=hextob64u(c.y);b.d=hextob64u(d.prvKeyHex);return b}else{if(d instanceof KJUR.crypto.ECDSA&&d.isPublic){var a=d.getShortNISTPCurveName();if(a!=="P-256"&&a!=="P-384"){throw"unsupported curve name for JWT: "+a}var c=d.getPublicKeyXYHex();b.kty="EC";b.crv=a;b.x=hextob64u(c.x);b.y=hextob64u(c.y);return b}}}}throw"not supported key object"}; -RSAKey.getPosArrayOfChildrenFromHex=function(a){return ASN1HEX.getChildIdx(a,0)};RSAKey.getHexValueArrayOfChildrenFromHex=function(f){var n=ASN1HEX;var i=n.getV;var k=RSAKey.getPosArrayOfChildrenFromHex(f);var e=i(f,k[0]);var j=i(f,k[1]);var b=i(f,k[2]);var c=i(f,k[3]);var h=i(f,k[4]);var g=i(f,k[5]);var m=i(f,k[6]);var l=i(f,k[7]);var d=i(f,k[8]);var k=new Array();k.push(e,j,b,c,h,g,m,l,d);return k};RSAKey.prototype.readPrivateKeyFromPEMString=function(d){var c=pemtohex(d);var b=RSAKey.getHexValueArrayOfChildrenFromHex(c);this.setPrivateEx(b[1],b[2],b[3],b[4],b[5],b[6],b[7],b[8])};RSAKey.prototype.readPKCS5PrvKeyHex=function(c){var b=RSAKey.getHexValueArrayOfChildrenFromHex(c);this.setPrivateEx(b[1],b[2],b[3],b[4],b[5],b[6],b[7],b[8])};RSAKey.prototype.readPKCS8PrvKeyHex=function(e){var c,j,l,b,a,f,d,k;var m=ASN1HEX;var g=m.getVbyList;if(m.isASN1HEX(e)===false){throw"not ASN.1 hex string"}try{c=g(e,0,[2,0,1],"02");j=g(e,0,[2,0,2],"02");l=g(e,0,[2,0,3],"02");b=g(e,0,[2,0,4],"02");a=g(e,0,[2,0,5],"02");f=g(e,0,[2,0,6],"02");d=g(e,0,[2,0,7],"02");k=g(e,0,[2,0,8],"02")}catch(i){throw"malformed PKCS#8 plain RSA private key"}this.setPrivateEx(c,j,l,b,a,f,d,k)};RSAKey.prototype.readPKCS5PubKeyHex=function(c){var e=ASN1HEX;var b=e.getV;if(e.isASN1HEX(c)===false){throw"keyHex is not ASN.1 hex string"}var a=e.getChildIdx(c,0);if(a.length!==2||c.substr(a[0],2)!=="02"||c.substr(a[1],2)!=="02"){throw"wrong hex for PKCS#5 public key"}var f=b(c,a[0]);var d=b(c,a[1]);this.setPublic(f,d)};RSAKey.prototype.readPKCS8PubKeyHex=function(b){var c=ASN1HEX;if(c.isASN1HEX(b)===false){throw"not ASN.1 hex string"}if(c.getTLVbyList(b,0,[0,0])!=="06092a864886f70d010101"){throw"not PKCS8 RSA public key"}var a=c.getTLVbyList(b,0,[1,0]);this.readPKCS5PubKeyHex(a)};RSAKey.prototype.readCertPubKeyHex=function(b,d){var a,c;a=new X509();a.readCertHex(b);c=a.getPublicKeyHex();this.readPKCS8PubKeyHex(c)}; -var _RE_HEXDECONLY=new RegExp("");_RE_HEXDECONLY.compile("[^0-9a-f]","gi");function _rsasign_getHexPaddedDigestInfoForString(d,e,a){var b=function(f){return KJUR.crypto.Util.hashString(f,a)};var c=b(d);return KJUR.crypto.Util.getPaddedDigestInfoHex(c,a,e)}function _zeroPaddingOfSignature(e,d){var c="";var a=d/4-e.length;for(var b=0;b>24,(d&16711680)>>16,(d&65280)>>8,d&255]))));d+=1}return b}RSAKey.prototype.signPSS=function(e,a,d){var c=function(f){return KJUR.crypto.Util.hashHex(f,a)};var b=c(rstrtohex(e));if(d===undefined){d=-1}return this.signWithMessageHashPSS(b,a,d)};RSAKey.prototype.signWithMessageHashPSS=function(l,a,k){var b=hextorstr(l);var g=b.length;var m=this.n.bitLength()-1;var c=Math.ceil(m/8);var d;var o=function(i){return KJUR.crypto.Util.hashHex(i,a)};if(k===-1||k===undefined){k=g}else{if(k===-2){k=c-g-2}else{if(k<-2){throw"invalid salt length"}}}if(c<(g+k+2)){throw"data too long"}var f="";if(k>0){f=new Array(k);new SecureRandom().nextBytes(f);f=String.fromCharCode.apply(String,f)}var n=hextorstr(o(rstrtohex("\x00\x00\x00\x00\x00\x00\x00\x00"+b+f)));var j=[];for(d=0;d>(8*c-m))&255;q[0]&=~p;for(d=0;dthis.n.bitLength()){return 0}var i=this.doPublic(b);var e=i.toString(16).replace(/^1f+00/,"");var g=_rsasign_getAlgNameAndHashFromHexDisgestInfo(e);if(g.length==0){return false}var d=g[0];var h=g[1];var a=function(k){return KJUR.crypto.Util.hashString(k,d)};var c=a(f);return(h==c)};RSAKey.prototype.verifyWithMessageHash=function(e,a){a=a.replace(_RE_HEXDECONLY,"");a=a.replace(/[ \n]+/g,"");var b=parseBigInt(a,16);if(b.bitLength()>this.n.bitLength()){return 0}var h=this.doPublic(b);var g=h.toString(16).replace(/^1f+00/,"");var c=_rsasign_getAlgNameAndHashFromHexDisgestInfo(g);if(c.length==0){return false}var d=c[0];var f=c[1];return(f==e)};RSAKey.prototype.verifyPSS=function(c,b,a,f){var e=function(g){return KJUR.crypto.Util.hashHex(g,a)};var d=e(rstrtohex(c));if(f===undefined){f=-1}return this.verifyWithMessageHashPSS(d,b,a,f)};RSAKey.prototype.verifyWithMessageHashPSS=function(f,s,l,c){var k=new BigInteger(s,16);if(k.bitLength()>this.n.bitLength()){return false}var r=function(i){return KJUR.crypto.Util.hashHex(i,l)};var j=hextorstr(f);var h=j.length;var g=this.n.bitLength()-1;var m=Math.ceil(g/8);var q;if(c===-1||c===undefined){c=h}else{if(c===-2){c=m-h-2}else{if(c<-2){throw"invalid salt length"}}}if(m<(h+c+2)){throw"data too long"}var a=this.doPublic(k).toByteArray();for(q=0;q>(8*m-g))&255;if((d.charCodeAt(0)&p)!==0){throw"bits beyond keysize not zero"}var n=pss_mgf1_str(e,d.length,r);var o=[];for(q=0;q0){var b=":"+n.join(":")+":";if(b.indexOf(":"+k+":")==-1){throw"algorithm '"+k+"' not accepted in the list"}}if(k!="none"&&B===null){throw"key shall be specified to verify."}if(typeof B=="string"&&B.indexOf("-----BEGIN ")!=-1){B=KEYUTIL.getKey(B)}if(z=="RS"||z=="PS"){if(!(B instanceof m)){throw"key shall be a RSAKey obj for RS* and PS* algs"}}if(z=="ES"){if(!(B instanceof p)){throw"key shall be a ECDSA obj for ES* algs"}}if(k=="none"){}var u=null;if(t.jwsalg2sigalg[l.alg]===undefined){throw"unsupported alg name: "+k}else{u=t.jwsalg2sigalg[k]}if(u=="none"){throw"not supported"}else{if(u.substr(0,4)=="Hmac"){var o=null;if(B===undefined){throw"hexadecimal key shall be specified for HMAC"}var j=new s({alg:u,pass:B});j.updateString(c);o=j.doFinal();return A==o}else{if(u.indexOf("withECDSA")!=-1){var h=null;try{h=p.concatSigToASN1Sig(A)}catch(v){return false}var g=new d({alg:u});g.init(B);g.updateString(c);return g.verify(h)}else{var g=new d({alg:u});g.init(B);g.updateString(c);return g.verify(A)}}}};KJUR.jws.JWS.parse=function(g){var c=g.split(".");var b={};var f,e,d;if(c.length!=2&&c.length!=3){throw"malformed sJWS: wrong number of '.' splitted elements"}f=c[0];e=c[1];if(c.length==3){d=c[2]}b.headerObj=KJUR.jws.JWS.readSafeJSONString(b64utoutf8(f));b.payloadObj=KJUR.jws.JWS.readSafeJSONString(b64utoutf8(e));b.headerPP=JSON.stringify(b.headerObj,null," ");if(b.payloadObj==null){b.payloadPP=b64utoutf8(e)}else{b.payloadPP=JSON.stringify(b.payloadObj,null," ")}if(d!==undefined){b.sigHex=b64utohex(d)}return b};KJUR.jws.JWS.verifyJWT=function(e,l,r){var d=KJUR,j=d.jws,o=j.JWS,n=o.readSafeJSONString,p=o.inArray,f=o.includedArray;var k=e.split(".");var c=k[0];var i=k[1];var q=c+"."+i;var m=b64utohex(k[2]);var h=n(b64utoutf8(c));var g=n(b64utoutf8(i));if(h.alg===undefined){return false}if(r.alg===undefined){throw"acceptField.alg shall be specified"}if(!p(h.alg,r.alg)){return false}if(g.iss!==undefined&&typeof r.iss==="object"){if(!p(g.iss,r.iss)){return false}}if(g.sub!==undefined&&typeof r.sub==="object"){if(!p(g.sub,r.sub)){return false}}if(g.aud!==undefined&&typeof r.aud==="object"){if(typeof g.aud=="string"){if(!p(g.aud,r.aud)){return false}}else{if(typeof g.aud=="object"){if(!f(g.aud,r.aud)){return false}}}}var b=j.IntDate.getNow();if(r.verifyAt!==undefined&&typeof r.verifyAt==="number"){b=r.verifyAt}if(r.gracePeriod===undefined||typeof r.gracePeriod!=="number"){r.gracePeriod=0}if(g.exp!==undefined&&typeof g.exp=="number"){if(g.exp+r.gracePeriodl){this.aHeader.pop()}if(this.aSignature.length>l){this.aSignature.pop()}throw"addSignature failed: "+i}};this.verifyAll=function(h){if(this.aHeader.length!==h.length||this.aSignature.length!==h.length){return false}for(var g=0;g0){this.aHeader=g.headers}else{throw"malformed header"}if(typeof g.payload==="string"){this.sPayload=g.payload}else{throw"malformed signatures"}if(g.signatures.length>0){this.signatures=g.signatures}else{throw"malformed signatures"}}catch(e){throw"malformed JWS-JS JSON object: "+e}}};this.getJSON=function(){return{headers:this.aHeader,payload:this.sPayload,signatures:this.aSignature}};this.isEmpty=function(){if(this.aHeader.length==0){return 1}return 0}}; -exports.SecureRandom = SecureRandom; -exports.rng_seed_time = rng_seed_time; - -exports.BigInteger = BigInteger; -exports.RSAKey = RSAKey; -exports.ECDSA = KJUR.crypto.ECDSA; -exports.DSA = KJUR.crypto.DSA; -exports.Signature = KJUR.crypto.Signature; -exports.MessageDigest = KJUR.crypto.MessageDigest; -exports.Mac = KJUR.crypto.Mac; -exports.Cipher = KJUR.crypto.Cipher; -exports.KEYUTIL = KEYUTIL; -exports.ASN1HEX = ASN1HEX; -exports.X509 = X509; -exports.CryptoJS = CryptoJS; - -// ext/base64.js -exports.b64tohex = b64tohex; -exports.b64toBA = b64toBA; - -// base64x.js -exports.stoBA = stoBA; -exports.BAtos = BAtos; -exports.BAtohex = BAtohex; -exports.stohex = stohex; -exports.stob64 = stob64; -exports.stob64u = stob64u; -exports.b64utos = b64utos; -exports.b64tob64u = b64tob64u; -exports.b64utob64 = b64utob64; -exports.hex2b64 = hex2b64; -exports.hextob64u = hextob64u; -exports.b64utohex = b64utohex; -exports.utf8tob64u = utf8tob64u; -exports.b64utoutf8 = b64utoutf8; -exports.utf8tob64 = utf8tob64; -exports.b64toutf8 = b64toutf8; -exports.utf8tohex = utf8tohex; -exports.hextoutf8 = hextoutf8; -exports.hextorstr = hextorstr; -exports.rstrtohex = rstrtohex; -exports.hextob64 = hextob64; -exports.hextob64nl = hextob64nl; -exports.b64nltohex = b64nltohex; -exports.hextopem = hextopem; -exports.pemtohex = pemtohex; -exports.hextoArrayBuffer = hextoArrayBuffer; -exports.ArrayBuffertohex = ArrayBuffertohex; -exports.zulutomsec = zulutomsec; -exports.zulutosec = zulutosec; -exports.zulutodate = zulutodate; -exports.datetozulu = datetozulu; -exports.uricmptohex = uricmptohex; -exports.hextouricmp = hextouricmp; -exports.encodeURIComponentAll = encodeURIComponentAll; -exports.newline_toUnix = newline_toUnix; -exports.newline_toDos = newline_toDos; -exports.hextoposhex = hextoposhex; -exports.intarystrtohex = intarystrtohex; -exports.strdiffidx = strdiffidx; - -// name spaces -exports.KJUR = KJUR; -exports.crypto = KJUR.crypto; -exports.asn1 = KJUR.asn1; -exports.jws = KJUR.jws; -exports.lang = KJUR.lang; - - - - -/***/ }), -/* 110 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -var OpenElementStack = __webpack_require__(51), - Tokenizer = __webpack_require__(19), - HTML = __webpack_require__(11); - - -//Aliases -var $ = HTML.TAG_NAMES; - -exports.assign = function (parser) { - //NOTE: obtain Parser proto this way to avoid module circular references - var parserProto = Object.getPrototypeOf(parser), - treeAdapter = parser.treeAdapter, - attachableElementLocation = null, - lastFosterParentingLocation = null, - currentToken = null; - - function setEndLocation(element, closingToken) { - var loc = element.__location; - - if (!loc) - return; - - if (!loc.startTag) { - loc.startTag = { - line: loc.line, - col: loc.col, - startOffset: loc.startOffset, - endOffset: loc.endOffset - }; - - if (loc.attrs) - loc.startTag.attrs = loc.attrs; - } - - if (closingToken.location) { - var ctLocation = closingToken.location, - tn = treeAdapter.getTagName(element), - // NOTE: For cases like - First 'p' closes without a closing tag and - // for cases like - 'p' closes without a closing tag - isClosingEndTag = closingToken.type === Tokenizer.END_TAG_TOKEN && - tn === closingToken.tagName; - - if (isClosingEndTag) { - loc.endTag = { - line: ctLocation.line, - col: ctLocation.col, - startOffset: ctLocation.startOffset, - endOffset: ctLocation.endOffset - }; - } - - if (isClosingEndTag) - loc.endOffset = ctLocation.endOffset; - else - loc.endOffset = ctLocation.startOffset; - } - - else if (closingToken.type === Tokenizer.EOF_TOKEN) - loc.endOffset = parser.tokenizer.preprocessor.sourcePos; - } - - //NOTE: patch _bootstrap method - parser._bootstrap = function (document, fragmentContext) { - parserProto._bootstrap.call(this, document, fragmentContext); - - attachableElementLocation = null; - lastFosterParentingLocation = null; - currentToken = null; - - //OpenElementStack - parser.openElements.pop = function () { - setEndLocation(this.current, currentToken); - OpenElementStack.prototype.pop.call(this); - }; - - parser.openElements.popAllUpToHtmlElement = function () { - for (var i = this.stackTop; i > 0; i--) - setEndLocation(this.items[i], currentToken); - - OpenElementStack.prototype.popAllUpToHtmlElement.call(this); - }; - - parser.openElements.remove = function (element) { - setEndLocation(element, currentToken); - OpenElementStack.prototype.remove.call(this, element); - }; - }; - - parser._runParsingLoop = function (scriptHandler) { - parserProto._runParsingLoop.call(this, scriptHandler); - - // NOTE: generate location info for elements - // that remains on open element stack - for (var i = parser.openElements.stackTop; i >= 0; i--) - setEndLocation(parser.openElements.items[i], currentToken); - }; - - - //Token processing - parser._processTokenInForeignContent = function (token) { - currentToken = token; - parserProto._processTokenInForeignContent.call(this, token); - }; - - parser._processToken = function (token) { - currentToken = token; - parserProto._processToken.call(this, token); - - //NOTE: and are never popped from the stack, so we need to updated - //their end location explicitly. - if (token.type === Tokenizer.END_TAG_TOKEN && - (token.tagName === $.HTML || - token.tagName === $.BODY && this.openElements.hasInScope($.BODY))) { - for (var i = this.openElements.stackTop; i >= 0; i--) { - var element = this.openElements.items[i]; - - if (this.treeAdapter.getTagName(element) === token.tagName) { - setEndLocation(element, token); - break; - } - } - } - }; - - - //Doctype - parser._setDocumentType = function (token) { - parserProto._setDocumentType.call(this, token); - - var documentChildren = this.treeAdapter.getChildNodes(this.document), - cnLength = documentChildren.length; - - for (var i = 0; i < cnLength; i++) { - var node = documentChildren[i]; - - if (this.treeAdapter.isDocumentTypeNode(node)) { - node.__location = token.location; - break; - } - } - }; - - - //Elements - parser._attachElementToTree = function (element) { - //NOTE: _attachElementToTree is called from _appendElement, _insertElement and _insertTemplate methods. - //So we will use token location stored in this methods for the element. - element.__location = attachableElementLocation || null; - attachableElementLocation = null; - parserProto._attachElementToTree.call(this, element); - }; - - parser._appendElement = function (token, namespaceURI) { - attachableElementLocation = token.location; - parserProto._appendElement.call(this, token, namespaceURI); - }; - - parser._insertElement = function (token, namespaceURI) { - attachableElementLocation = token.location; - parserProto._insertElement.call(this, token, namespaceURI); - }; - - parser._insertTemplate = function (token) { - attachableElementLocation = token.location; - parserProto._insertTemplate.call(this, token); - - var tmplContent = this.treeAdapter.getTemplateContent(this.openElements.current); - - tmplContent.__location = null; - }; - - parser._insertFakeRootElement = function () { - parserProto._insertFakeRootElement.call(this); - this.openElements.current.__location = null; - }; - - - //Comments - parser._appendCommentNode = function (token, parent) { - parserProto._appendCommentNode.call(this, token, parent); - - var children = this.treeAdapter.getChildNodes(parent), - commentNode = children[children.length - 1]; - - commentNode.__location = token.location; - }; - - - //Text - parser._findFosterParentingLocation = function () { - //NOTE: store last foster parenting location, so we will be able to find inserted text - //in case of foster parenting - lastFosterParentingLocation = parserProto._findFosterParentingLocation.call(this); - return lastFosterParentingLocation; - }; - - parser._insertCharacters = function (token) { - parserProto._insertCharacters.call(this, token); - - var hasFosterParent = this._shouldFosterParentOnInsertion(), - parent = hasFosterParent && lastFosterParentingLocation.parent || - this.openElements.currentTmplContent || - this.openElements.current, - siblings = this.treeAdapter.getChildNodes(parent), - textNodeIdx = hasFosterParent && lastFosterParentingLocation.beforeElement ? - siblings.indexOf(lastFosterParentingLocation.beforeElement) - 1 : - siblings.length - 1, - textNode = siblings[textNodeIdx]; - - //NOTE: if we have location assigned by another token, then just update end position - if (textNode.__location) - textNode.__location.endOffset = token.location.endOffset; - - else - textNode.__location = token.location; - }; -}; - - - -/***/ }), -/* 111 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -var UNICODE = __webpack_require__(18); - -//Aliases -var $ = UNICODE.CODE_POINTS; - - -exports.assign = function (tokenizer) { - //NOTE: obtain Tokenizer proto this way to avoid module circular references - var tokenizerProto = Object.getPrototypeOf(tokenizer), - tokenStartOffset = -1, - tokenCol = -1, - tokenLine = 1, - isEol = false, - lineStartPos = 0, - col = -1, - line = 1; - - function attachLocationInfo(token) { - token.location = { - line: tokenLine, - col: tokenCol, - startOffset: tokenStartOffset, - endOffset: -1 - }; - } - - //NOTE: patch consumption method to track line/col information - tokenizer._consume = function () { - var cp = tokenizerProto._consume.call(this); - - //NOTE: LF should be in the last column of the line - if (isEol) { - isEol = false; - line++; - lineStartPos = this.preprocessor.sourcePos; - } - - if (cp === $.LINE_FEED) - isEol = true; - - col = this.preprocessor.sourcePos - lineStartPos + 1; - - return cp; - }; - - tokenizer._unconsume = function () { - tokenizerProto._unconsume.call(this); - isEol = false; - - col = this.preprocessor.sourcePos - lineStartPos + 1; - }; - - //NOTE: patch token creation methods and attach location objects - tokenizer._createStartTagToken = function () { - tokenizerProto._createStartTagToken.call(this); - attachLocationInfo(this.currentToken); - }; - - tokenizer._createEndTagToken = function () { - tokenizerProto._createEndTagToken.call(this); - attachLocationInfo(this.currentToken); - }; - - tokenizer._createCommentToken = function () { - tokenizerProto._createCommentToken.call(this); - attachLocationInfo(this.currentToken); - }; - - tokenizer._createDoctypeToken = function (initialName) { - tokenizerProto._createDoctypeToken.call(this, initialName); - attachLocationInfo(this.currentToken); - }; - - tokenizer._createCharacterToken = function (type, ch) { - tokenizerProto._createCharacterToken.call(this, type, ch); - attachLocationInfo(this.currentCharacterToken); - }; - - tokenizer._createAttr = function (attrNameFirstCh) { - tokenizerProto._createAttr.call(this, attrNameFirstCh); - this.currentAttrLocation = { - line: line, - col: col, - startOffset: this.preprocessor.sourcePos, - endOffset: -1 - }; - }; - - tokenizer._leaveAttrName = function (toState) { - tokenizerProto._leaveAttrName.call(this, toState); - this._attachCurrentAttrLocationInfo(); - }; - - tokenizer._leaveAttrValue = function (toState) { - tokenizerProto._leaveAttrValue.call(this, toState); - this._attachCurrentAttrLocationInfo(); - }; - - tokenizer._attachCurrentAttrLocationInfo = function () { - this.currentAttrLocation.endOffset = this.preprocessor.sourcePos; - - if (!this.currentToken.location.attrs) - this.currentToken.location.attrs = Object.create(null); - - this.currentToken.location.attrs[this.currentAttr.name] = this.currentAttrLocation; - }; - - //NOTE: patch token emission methods to determine end location - tokenizer._emitCurrentToken = function () { - //NOTE: if we have pending character token make it's end location equal to the - //current token's start location. - if (this.currentCharacterToken) - this.currentCharacterToken.location.endOffset = this.currentToken.location.startOffset; - - this.currentToken.location.endOffset = this.preprocessor.sourcePos + 1; - tokenizerProto._emitCurrentToken.call(this); - }; - - tokenizer._emitCurrentCharacterToken = function () { - //NOTE: if we have character token and it's location wasn't set in the _emitCurrentToken(), - //then set it's location at the current preprocessor position. - //We don't need to increment preprocessor position, since character token - //emission is always forced by the start of the next character token here. - //So, we already have advanced position. - if (this.currentCharacterToken && this.currentCharacterToken.location.endOffset === -1) - this.currentCharacterToken.location.endOffset = this.preprocessor.sourcePos; - - tokenizerProto._emitCurrentCharacterToken.call(this); - }; - - //NOTE: patch initial states for each mode to obtain token start position - Object.keys(tokenizerProto.MODE) - - .map(function (modeName) { - return tokenizerProto.MODE[modeName]; - }) - - .forEach(function (state) { - tokenizer[state] = function (cp) { - tokenStartOffset = this.preprocessor.sourcePos; - tokenLine = line; - tokenCol = col; - tokenizerProto[state].call(this, cp); - }; - }); -}; - - -/***/ }), -/* 112 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -//Const -var NOAH_ARK_CAPACITY = 3; - -//List of formatting elements -var FormattingElementList = module.exports = function (treeAdapter) { - this.length = 0; - this.entries = []; - this.treeAdapter = treeAdapter; - this.bookmark = null; -}; - -//Entry types -FormattingElementList.MARKER_ENTRY = 'MARKER_ENTRY'; -FormattingElementList.ELEMENT_ENTRY = 'ELEMENT_ENTRY'; - -//Noah Ark's condition -//OPTIMIZATION: at first we try to find possible candidates for exclusion using -//lightweight heuristics without thorough attributes check. -FormattingElementList.prototype._getNoahArkConditionCandidates = function (newElement) { - var candidates = []; - - if (this.length >= NOAH_ARK_CAPACITY) { - var neAttrsLength = this.treeAdapter.getAttrList(newElement).length, - neTagName = this.treeAdapter.getTagName(newElement), - neNamespaceURI = this.treeAdapter.getNamespaceURI(newElement); - - for (var i = this.length - 1; i >= 0; i--) { - var entry = this.entries[i]; - - if (entry.type === FormattingElementList.MARKER_ENTRY) - break; - - var element = entry.element, - elementAttrs = this.treeAdapter.getAttrList(element), - isCandidate = this.treeAdapter.getTagName(element) === neTagName && - this.treeAdapter.getNamespaceURI(element) === neNamespaceURI && - elementAttrs.length === neAttrsLength; - - if (isCandidate) - candidates.push({idx: i, attrs: elementAttrs}); - } - } - - return candidates.length < NOAH_ARK_CAPACITY ? [] : candidates; -}; - -FormattingElementList.prototype._ensureNoahArkCondition = function (newElement) { - var candidates = this._getNoahArkConditionCandidates(newElement), - cLength = candidates.length; - - if (cLength) { - var neAttrs = this.treeAdapter.getAttrList(newElement), - neAttrsLength = neAttrs.length, - neAttrsMap = Object.create(null); - - //NOTE: build attrs map for the new element so we can perform fast lookups - for (var i = 0; i < neAttrsLength; i++) { - var neAttr = neAttrs[i]; - - neAttrsMap[neAttr.name] = neAttr.value; - } - - for (i = 0; i < neAttrsLength; i++) { - for (var j = 0; j < cLength; j++) { - var cAttr = candidates[j].attrs[i]; - - if (neAttrsMap[cAttr.name] !== cAttr.value) { - candidates.splice(j, 1); - cLength--; - } - - if (candidates.length < NOAH_ARK_CAPACITY) - return; - } - } - - //NOTE: remove bottommost candidates until Noah's Ark condition will not be met - for (i = cLength - 1; i >= NOAH_ARK_CAPACITY - 1; i--) { - this.entries.splice(candidates[i].idx, 1); - this.length--; - } - } -}; - -//Mutations -FormattingElementList.prototype.insertMarker = function () { - this.entries.push({type: FormattingElementList.MARKER_ENTRY}); - this.length++; -}; - -FormattingElementList.prototype.pushElement = function (element, token) { - this._ensureNoahArkCondition(element); - - this.entries.push({ - type: FormattingElementList.ELEMENT_ENTRY, - element: element, - token: token - }); - - this.length++; -}; - -FormattingElementList.prototype.insertElementAfterBookmark = function (element, token) { - var bookmarkIdx = this.length - 1; - - for (; bookmarkIdx >= 0; bookmarkIdx--) { - if (this.entries[bookmarkIdx] === this.bookmark) - break; - } - - this.entries.splice(bookmarkIdx + 1, 0, { - type: FormattingElementList.ELEMENT_ENTRY, - element: element, - token: token - }); - - this.length++; -}; - -FormattingElementList.prototype.removeEntry = function (entry) { - for (var i = this.length - 1; i >= 0; i--) { - if (this.entries[i] === entry) { - this.entries.splice(i, 1); - this.length--; - break; - } - } -}; - -FormattingElementList.prototype.clearToLastMarker = function () { - while (this.length) { - var entry = this.entries.pop(); - - this.length--; - - if (entry.type === FormattingElementList.MARKER_ENTRY) - break; - } -}; - -//Search -FormattingElementList.prototype.getElementEntryInScopeWithTagName = function (tagName) { - for (var i = this.length - 1; i >= 0; i--) { - var entry = this.entries[i]; - - if (entry.type === FormattingElementList.MARKER_ENTRY) - return null; - - if (this.treeAdapter.getTagName(entry.element) === tagName) - return entry; - } - - return null; -}; - -FormattingElementList.prototype.getElementEntry = function (element) { - for (var i = this.length - 1; i >= 0; i--) { - var entry = this.entries[i]; - - if (entry.type === FormattingElementList.ELEMENT_ENTRY && entry.element === element) - return entry; - } - - return null; -}; - - -/***/ }), -/* 113 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -var ParserStream = __webpack_require__(52), - inherits = __webpack_require__(24).inherits, - $ = __webpack_require__(11).TAG_NAMES; - -var PlainTextConversionStream = module.exports = function (options) { - ParserStream.call(this, options); - - // NOTE: see https://html.spec.whatwg.org/#read-text - this.parser._insertFakeElement($.HTML); - this.parser._insertFakeElement($.HEAD); - this.parser.openElements.pop(); - this.parser._insertFakeElement($.BODY); - this.parser._insertFakeElement($.PRE); - this.parser.treeAdapter.insertText(this.parser.openElements.current, '\n'); - this.parser.switchToPlaintextParsing(); -}; - -inherits(PlainTextConversionStream, ParserStream); - - -/***/ }), -/* 114 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -var WritableStream = __webpack_require__(31).Writable, - util = __webpack_require__(24); - -var DevNullStream = module.exports = function () { - WritableStream.call(this); -}; - -util.inherits(DevNullStream, WritableStream); - -DevNullStream.prototype._write = function (chunk, encoding, cb) { - cb(); -}; - - -/***/ }), -/* 115 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -var TransformStream = __webpack_require__(31).Transform, - DevNullStream = __webpack_require__(114), - inherits = __webpack_require__(24).inherits, - Tokenizer = __webpack_require__(19), - ParserFeedbackSimulator = __webpack_require__(116), - mergeOptions = __webpack_require__(34); - -var DEFAULT_OPTIONS = { - locationInfo: false -}; - -var SAXParser = module.exports = function (options) { - TransformStream.call(this); - - this.options = mergeOptions(DEFAULT_OPTIONS, options); - - this.tokenizer = new Tokenizer(options); - this.parserFeedbackSimulator = new ParserFeedbackSimulator(this.tokenizer); - - this.pendingText = null; - this.currentTokenLocation = void 0; - - this.lastChunkWritten = false; - this.stopped = false; - - // NOTE: always pipe stream to the /dev/null stream to avoid - // `highWaterMark` hit even if we don't have consumers. - // (see: https://github.com/inikulin/parse5/issues/97#issuecomment-171940774) - this.pipe(new DevNullStream()); -}; - -inherits(SAXParser, TransformStream); - -//TransformStream implementation -SAXParser.prototype._transform = function (chunk, encoding, callback) { - if (!this.stopped) { - this.tokenizer.write(chunk.toString('utf8'), this.lastChunkWritten); - this._runParsingLoop(); - } - - this.push(chunk); - - callback(); -}; - -SAXParser.prototype._flush = function (callback) { - callback(); -}; - -SAXParser.prototype.end = function (chunk, encoding, callback) { - this.lastChunkWritten = true; - TransformStream.prototype.end.call(this, chunk, encoding, callback); -}; - -SAXParser.prototype.stop = function () { - this.stopped = true; -}; - -//Internals -SAXParser.prototype._runParsingLoop = function () { - do { - var token = this.parserFeedbackSimulator.getNextToken(); - - if (token.type === Tokenizer.HIBERNATION_TOKEN) - break; - - if (token.type === Tokenizer.CHARACTER_TOKEN || - token.type === Tokenizer.WHITESPACE_CHARACTER_TOKEN || - token.type === Tokenizer.NULL_CHARACTER_TOKEN) { - - if (this.options.locationInfo) { - if (this.pendingText === null) - this.currentTokenLocation = token.location; - - else - this.currentTokenLocation.endOffset = token.location.endOffset; - } - - this.pendingText = (this.pendingText || '') + token.chars; - } - - else { - this._emitPendingText(); - this._handleToken(token); - } - } while (!this.stopped && token.type !== Tokenizer.EOF_TOKEN); -}; - -SAXParser.prototype._handleToken = function (token) { - if (this.options.locationInfo) - this.currentTokenLocation = token.location; - - if (token.type === Tokenizer.START_TAG_TOKEN) - this.emit('startTag', token.tagName, token.attrs, token.selfClosing, this.currentTokenLocation); - - else if (token.type === Tokenizer.END_TAG_TOKEN) - this.emit('endTag', token.tagName, this.currentTokenLocation); - - else if (token.type === Tokenizer.COMMENT_TOKEN) - this.emit('comment', token.data, this.currentTokenLocation); - - else if (token.type === Tokenizer.DOCTYPE_TOKEN) - this.emit('doctype', token.name, token.publicId, token.systemId, this.currentTokenLocation); -}; - -SAXParser.prototype._emitPendingText = function () { - if (this.pendingText !== null) { - this.emit('text', this.pendingText, this.currentTokenLocation); - this.pendingText = null; - } -}; - - -/***/ }), -/* 116 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -var Tokenizer = __webpack_require__(19), - foreignContent = __webpack_require__(49), - UNICODE = __webpack_require__(18), - HTML = __webpack_require__(11); - - -//Aliases -var $ = HTML.TAG_NAMES, - NS = HTML.NAMESPACES; - - -//ParserFeedbackSimulator -//Simulates adjustment of the Tokenizer which performed by standard parser during tree construction. -var ParserFeedbackSimulator = module.exports = function (tokenizer) { - this.tokenizer = tokenizer; - - this.namespaceStack = []; - this.namespaceStackTop = -1; - this._enterNamespace(NS.HTML); -}; - -ParserFeedbackSimulator.prototype.getNextToken = function () { - var token = this.tokenizer.getNextToken(); - - if (token.type === Tokenizer.START_TAG_TOKEN) - this._handleStartTagToken(token); - - else if (token.type === Tokenizer.END_TAG_TOKEN) - this._handleEndTagToken(token); - - else if (token.type === Tokenizer.NULL_CHARACTER_TOKEN && this.inForeignContent) { - token.type = Tokenizer.CHARACTER_TOKEN; - token.chars = UNICODE.REPLACEMENT_CHARACTER; - } - - else if (this.skipNextNewLine) { - if (token.type !== Tokenizer.HIBERNATION_TOKEN) - this.skipNextNewLine = false; - - if (token.type === Tokenizer.WHITESPACE_CHARACTER_TOKEN && token.chars[0] === '\n') { - if (token.chars.length === 1) - return this.getNextToken(); - - token.chars = token.chars.substr(1); - } - } - - return token; -}; - -//Namespace stack mutations -ParserFeedbackSimulator.prototype._enterNamespace = function (namespace) { - this.namespaceStackTop++; - this.namespaceStack.push(namespace); - - this.inForeignContent = namespace !== NS.HTML; - this.currentNamespace = namespace; - this.tokenizer.allowCDATA = this.inForeignContent; -}; - -ParserFeedbackSimulator.prototype._leaveCurrentNamespace = function () { - this.namespaceStackTop--; - this.namespaceStack.pop(); - - this.currentNamespace = this.namespaceStack[this.namespaceStackTop]; - this.inForeignContent = this.currentNamespace !== NS.HTML; - this.tokenizer.allowCDATA = this.inForeignContent; -}; - -//Token handlers -ParserFeedbackSimulator.prototype._ensureTokenizerMode = function (tn) { - if (tn === $.TEXTAREA || tn === $.TITLE) - this.tokenizer.state = Tokenizer.MODE.RCDATA; - - else if (tn === $.PLAINTEXT) - this.tokenizer.state = Tokenizer.MODE.PLAINTEXT; - - else if (tn === $.SCRIPT) - this.tokenizer.state = Tokenizer.MODE.SCRIPT_DATA; - - else if (tn === $.STYLE || tn === $.IFRAME || tn === $.XMP || - tn === $.NOEMBED || tn === $.NOFRAMES || tn === $.NOSCRIPT) - this.tokenizer.state = Tokenizer.MODE.RAWTEXT; -}; - -ParserFeedbackSimulator.prototype._handleStartTagToken = function (token) { - var tn = token.tagName; - - if (tn === $.SVG) - this._enterNamespace(NS.SVG); - - else if (tn === $.MATH) - this._enterNamespace(NS.MATHML); - - if (this.inForeignContent) { - if (foreignContent.causesExit(token)) { - this._leaveCurrentNamespace(); - return; - } - - var currentNs = this.currentNamespace; - - if (currentNs === NS.MATHML) - foreignContent.adjustTokenMathMLAttrs(token); - - else if (currentNs === NS.SVG) { - foreignContent.adjustTokenSVGTagName(token); - foreignContent.adjustTokenSVGAttrs(token); - } - - foreignContent.adjustTokenXMLAttrs(token); - - tn = token.tagName; - - if (!token.selfClosing && foreignContent.isIntegrationPoint(tn, currentNs, token.attrs)) - this._enterNamespace(NS.HTML); - } - - else { - if (tn === $.PRE || tn === $.TEXTAREA || tn === $.LISTING) - this.skipNextNewLine = true; - - else if (tn === $.IMAGE) - token.tagName = $.IMG; - - this._ensureTokenizerMode(tn); - } -}; - -ParserFeedbackSimulator.prototype._handleEndTagToken = function (token) { - var tn = token.tagName; - - if (!this.inForeignContent) { - var previousNs = this.namespaceStack[this.namespaceStackTop - 1]; - - if (previousNs === NS.SVG && foreignContent.SVG_TAG_NAMES_ADJUSTMENT_MAP[tn]) - tn = foreignContent.SVG_TAG_NAMES_ADJUSTMENT_MAP[tn]; - - //NOTE: check for exit from integration point - if (foreignContent.isIntegrationPoint(tn, previousNs, token.attrs)) - this._leaveCurrentNamespace(); - } - - else if (tn === $.SVG && this.currentNamespace === NS.SVG || - tn === $.MATH && this.currentNamespace === NS.MATHML) - this._leaveCurrentNamespace(); - - // NOTE: adjust end tag name as well for consistency - if (this.currentNamespace === NS.SVG) - foreignContent.adjustTokenSVGTagName(token); -}; - - -/***/ }), -/* 117 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -var ReadableStream = __webpack_require__(31).Readable, - inherits = __webpack_require__(24).inherits, - Serializer = __webpack_require__(53); - -var SerializerStream = module.exports = function (node, options) { - ReadableStream.call(this); - - this.serializer = new Serializer(node, options); - - Object.defineProperty(this.serializer, 'html', { - //NOTE: To make `+=` concat operator work properly we define - //getter which always returns empty string - get: function () { - return ''; - }, - set: this.push.bind(this) - }); -}; - -inherits(SerializerStream, ReadableStream); - -//Readable stream implementation -SerializerStream.prototype._read = function () { - this.serializer.serialize(); - this.push(null); -}; - - -/***/ }), -/* 118 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -//NOTE: this file contains auto-generated array mapped radix tree that is used for the named entity references consumption -//(details: https://github.com/inikulin/parse5/tree/master/scripts/generate_named_entity_data/README.md) -module.exports = new Uint16Array([4,52,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,106,303,412,810,1432,1701,1796,1987,2114,2360,2420,2484,3170,3251,4140,4393,4575,4610,5106,5512,5728,6117,6274,6315,6345,6427,6516,7002,7910,8733,9323,9870,10170,10631,10893,11318,11386,11467,12773,13092,14474,14922,15448,15542,16419,17666,18166,18611,19004,19095,19298,19397,4,16,69,77,97,98,99,102,103,108,109,110,111,112,114,115,116,117,140,150,158,169,176,194,199,210,216,222,226,242,256,266,283,294,108,105,103,5,198,1,59,148,1,198,80,5,38,1,59,156,1,38,99,117,116,101,5,193,1,59,167,1,193,114,101,118,101,59,1,258,4,2,105,121,182,191,114,99,5,194,1,59,189,1,194,59,1,1040,114,59,3,55349,56580,114,97,118,101,5,192,1,59,208,1,192,112,104,97,59,1,913,97,99,114,59,1,256,100,59,1,10835,4,2,103,112,232,237,111,110,59,1,260,102,59,3,55349,56632,112,108,121,70,117,110,99,116,105,111,110,59,1,8289,105,110,103,5,197,1,59,264,1,197,4,2,99,115,272,277,114,59,3,55349,56476,105,103,110,59,1,8788,105,108,100,101,5,195,1,59,292,1,195,109,108,5,196,1,59,301,1,196,4,8,97,99,101,102,111,114,115,117,321,350,354,383,388,394,400,405,4,2,99,114,327,336,107,115,108,97,115,104,59,1,8726,4,2,118,119,342,345,59,1,10983,101,100,59,1,8966,121,59,1,1041,4,3,99,114,116,362,369,379,97,117,115,101,59,1,8757,110,111,117,108,108,105,115,59,1,8492,97,59,1,914,114,59,3,55349,56581,112,102,59,3,55349,56633,101,118,101,59,1,728,99,114,59,1,8492,109,112,101,113,59,1,8782,4,14,72,79,97,99,100,101,102,104,105,108,111,114,115,117,442,447,456,504,542,547,569,573,577,616,678,784,790,796,99,121,59,1,1063,80,89,5,169,1,59,454,1,169,4,3,99,112,121,464,470,497,117,116,101,59,1,262,4,2,59,105,476,478,1,8914,116,97,108,68,105,102,102,101,114,101,110,116,105,97,108,68,59,1,8517,108,101,121,115,59,1,8493,4,4,97,101,105,111,514,520,530,535,114,111,110,59,1,268,100,105,108,5,199,1,59,528,1,199,114,99,59,1,264,110,105,110,116,59,1,8752,111,116,59,1,266,4,2,100,110,553,560,105,108,108,97,59,1,184,116,101,114,68,111,116,59,1,183,114,59,1,8493,105,59,1,935,114,99,108,101,4,4,68,77,80,84,591,596,603,609,111,116,59,1,8857,105,110,117,115,59,1,8854,108,117,115,59,1,8853,105,109,101,115,59,1,8855,111,4,2,99,115,623,646,107,119,105,115,101,67,111,110,116,111,117,114,73,110,116,101,103,114,97,108,59,1,8754,101,67,117,114,108,121,4,2,68,81,658,671,111,117,98,108,101,81,117,111,116,101,59,1,8221,117,111,116,101,59,1,8217,4,4,108,110,112,117,688,701,736,753,111,110,4,2,59,101,696,698,1,8759,59,1,10868,4,3,103,105,116,709,717,722,114,117,101,110,116,59,1,8801,110,116,59,1,8751,111,117,114,73,110,116,101,103,114,97,108,59,1,8750,4,2,102,114,742,745,59,1,8450,111,100,117,99,116,59,1,8720,110,116,101,114,67,108,111,99,107,119,105,115,101,67,111,110,116,111,117,114,73,110,116,101,103,114,97,108,59,1,8755,111,115,115,59,1,10799,99,114,59,3,55349,56478,112,4,2,59,67,803,805,1,8915,97,112,59,1,8781,4,11,68,74,83,90,97,99,101,102,105,111,115,834,850,855,860,865,888,903,916,921,1011,1415,4,2,59,111,840,842,1,8517,116,114,97,104,100,59,1,10513,99,121,59,1,1026,99,121,59,1,1029,99,121,59,1,1039,4,3,103,114,115,873,879,883,103,101,114,59,1,8225,114,59,1,8609,104,118,59,1,10980,4,2,97,121,894,900,114,111,110,59,1,270,59,1,1044,108,4,2,59,116,910,912,1,8711,97,59,1,916,114,59,3,55349,56583,4,2,97,102,927,998,4,2,99,109,933,992,114,105,116,105,99,97,108,4,4,65,68,71,84,950,957,978,985,99,117,116,101,59,1,180,111,4,2,116,117,964,967,59,1,729,98,108,101,65,99,117,116,101,59,1,733,114,97,118,101,59,1,96,105,108,100,101,59,1,732,111,110,100,59,1,8900,102,101,114,101,110,116,105,97,108,68,59,1,8518,4,4,112,116,117,119,1021,1026,1048,1249,102,59,3,55349,56635,4,3,59,68,69,1034,1036,1041,1,168,111,116,59,1,8412,113,117,97,108,59,1,8784,98,108,101,4,6,67,68,76,82,85,86,1065,1082,1101,1189,1211,1236,111,110,116,111,117,114,73,110,116,101,103,114,97,108,59,1,8751,111,4,2,116,119,1089,1092,59,1,168,110,65,114,114,111,119,59,1,8659,4,2,101,111,1107,1141,102,116,4,3,65,82,84,1117,1124,1136,114,114,111,119,59,1,8656,105,103,104,116,65,114,114,111,119,59,1,8660,101,101,59,1,10980,110,103,4,2,76,82,1149,1177,101,102,116,4,2,65,82,1158,1165,114,114,111,119,59,1,10232,105,103,104,116,65,114,114,111,119,59,1,10234,105,103,104,116,65,114,114,111,119,59,1,10233,105,103,104,116,4,2,65,84,1199,1206,114,114,111,119,59,1,8658,101,101,59,1,8872,112,4,2,65,68,1218,1225,114,114,111,119,59,1,8657,111,119,110,65,114,114,111,119,59,1,8661,101,114,116,105,99,97,108,66,97,114,59,1,8741,110,4,6,65,66,76,82,84,97,1264,1292,1299,1352,1391,1408,114,114,111,119,4,3,59,66,85,1276,1278,1283,1,8595,97,114,59,1,10515,112,65,114,114,111,119,59,1,8693,114,101,118,101,59,1,785,101,102,116,4,3,82,84,86,1310,1323,1334,105,103,104,116,86,101,99,116,111,114,59,1,10576,101,101,86,101,99,116,111,114,59,1,10590,101,99,116,111,114,4,2,59,66,1345,1347,1,8637,97,114,59,1,10582,105,103,104,116,4,2,84,86,1362,1373,101,101,86,101,99,116,111,114,59,1,10591,101,99,116,111,114,4,2,59,66,1384,1386,1,8641,97,114,59,1,10583,101,101,4,2,59,65,1399,1401,1,8868,114,114,111,119,59,1,8615,114,114,111,119,59,1,8659,4,2,99,116,1421,1426,114,59,3,55349,56479,114,111,107,59,1,272,4,16,78,84,97,99,100,102,103,108,109,111,112,113,115,116,117,120,1466,1470,1478,1489,1515,1520,1525,1536,1544,1593,1609,1617,1650,1664,1668,1677,71,59,1,330,72,5,208,1,59,1476,1,208,99,117,116,101,5,201,1,59,1487,1,201,4,3,97,105,121,1497,1503,1512,114,111,110,59,1,282,114,99,5,202,1,59,1510,1,202,59,1,1069,111,116,59,1,278,114,59,3,55349,56584,114,97,118,101,5,200,1,59,1534,1,200,101,109,101,110,116,59,1,8712,4,2,97,112,1550,1555,99,114,59,1,274,116,121,4,2,83,86,1563,1576,109,97,108,108,83,113,117,97,114,101,59,1,9723,101,114,121,83,109,97,108,108,83,113,117,97,114,101,59,1,9643,4,2,103,112,1599,1604,111,110,59,1,280,102,59,3,55349,56636,115,105,108,111,110,59,1,917,117,4,2,97,105,1624,1640,108,4,2,59,84,1631,1633,1,10869,105,108,100,101,59,1,8770,108,105,98,114,105,117,109,59,1,8652,4,2,99,105,1656,1660,114,59,1,8496,109,59,1,10867,97,59,1,919,109,108,5,203,1,59,1675,1,203,4,2,105,112,1683,1689,115,116,115,59,1,8707,111,110,101,110,116,105,97,108,69,59,1,8519,4,5,99,102,105,111,115,1713,1717,1722,1762,1791,121,59,1,1060,114,59,3,55349,56585,108,108,101,100,4,2,83,86,1732,1745,109,97,108,108,83,113,117,97,114,101,59,1,9724,101,114,121,83,109,97,108,108,83,113,117,97,114,101,59,1,9642,4,3,112,114,117,1770,1775,1781,102,59,3,55349,56637,65,108,108,59,1,8704,114,105,101,114,116,114,102,59,1,8497,99,114,59,1,8497,4,12,74,84,97,98,99,100,102,103,111,114,115,116,1822,1827,1834,1848,1855,1877,1882,1887,1890,1896,1978,1984,99,121,59,1,1027,5,62,1,59,1832,1,62,109,109,97,4,2,59,100,1843,1845,1,915,59,1,988,114,101,118,101,59,1,286,4,3,101,105,121,1863,1869,1874,100,105,108,59,1,290,114,99,59,1,284,59,1,1043,111,116,59,1,288,114,59,3,55349,56586,59,1,8921,112,102,59,3,55349,56638,101,97,116,101,114,4,6,69,70,71,76,83,84,1915,1933,1944,1953,1959,1971,113,117,97,108,4,2,59,76,1925,1927,1,8805,101,115,115,59,1,8923,117,108,108,69,113,117,97,108,59,1,8807,114,101,97,116,101,114,59,1,10914,101,115,115,59,1,8823,108,97,110,116,69,113,117,97,108,59,1,10878,105,108,100,101,59,1,8819,99,114,59,3,55349,56482,59,1,8811,4,8,65,97,99,102,105,111,115,117,2005,2012,2026,2032,2036,2049,2073,2089,82,68,99,121,59,1,1066,4,2,99,116,2018,2023,101,107,59,1,711,59,1,94,105,114,99,59,1,292,114,59,1,8460,108,98,101,114,116,83,112,97,99,101,59,1,8459,4,2,112,114,2055,2059,102,59,1,8461,105,122,111,110,116,97,108,76,105,110,101,59,1,9472,4,2,99,116,2079,2083,114,59,1,8459,114,111,107,59,1,294,109,112,4,2,68,69,2097,2107,111,119,110,72,117,109,112,59,1,8782,113,117,97,108,59,1,8783,4,14,69,74,79,97,99,100,102,103,109,110,111,115,116,117,2144,2149,2155,2160,2171,2189,2194,2198,2209,2245,2307,2329,2334,2341,99,121,59,1,1045,108,105,103,59,1,306,99,121,59,1,1025,99,117,116,101,5,205,1,59,2169,1,205,4,2,105,121,2177,2186,114,99,5,206,1,59,2184,1,206,59,1,1048,111,116,59,1,304,114,59,1,8465,114,97,118,101,5,204,1,59,2207,1,204,4,3,59,97,112,2217,2219,2238,1,8465,4,2,99,103,2225,2229,114,59,1,298,105,110,97,114,121,73,59,1,8520,108,105,101,115,59,1,8658,4,2,116,118,2251,2281,4,2,59,101,2257,2259,1,8748,4,2,103,114,2265,2271,114,97,108,59,1,8747,115,101,99,116,105,111,110,59,1,8898,105,115,105,98,108,101,4,2,67,84,2293,2300,111,109,109,97,59,1,8291,105,109,101,115,59,1,8290,4,3,103,112,116,2315,2320,2325,111,110,59,1,302,102,59,3,55349,56640,97,59,1,921,99,114,59,1,8464,105,108,100,101,59,1,296,4,2,107,109,2347,2352,99,121,59,1,1030,108,5,207,1,59,2358,1,207,4,5,99,102,111,115,117,2372,2386,2391,2397,2414,4,2,105,121,2378,2383,114,99,59,1,308,59,1,1049,114,59,3,55349,56589,112,102,59,3,55349,56641,4,2,99,101,2403,2408,114,59,3,55349,56485,114,99,121,59,1,1032,107,99,121,59,1,1028,4,7,72,74,97,99,102,111,115,2436,2441,2446,2452,2467,2472,2478,99,121,59,1,1061,99,121,59,1,1036,112,112,97,59,1,922,4,2,101,121,2458,2464,100,105,108,59,1,310,59,1,1050,114,59,3,55349,56590,112,102,59,3,55349,56642,99,114,59,3,55349,56486,4,11,74,84,97,99,101,102,108,109,111,115,116,2508,2513,2520,2562,2585,2981,2986,3004,3011,3146,3167,99,121,59,1,1033,5,60,1,59,2518,1,60,4,5,99,109,110,112,114,2532,2538,2544,2548,2558,117,116,101,59,1,313,98,100,97,59,1,923,103,59,1,10218,108,97,99,101,116,114,102,59,1,8466,114,59,1,8606,4,3,97,101,121,2570,2576,2582,114,111,110,59,1,317,100,105,108,59,1,315,59,1,1051,4,2,102,115,2591,2907,116,4,10,65,67,68,70,82,84,85,86,97,114,2614,2663,2672,2728,2735,2760,2820,2870,2888,2895,4,2,110,114,2620,2633,103,108,101,66,114,97,99,107,101,116,59,1,10216,114,111,119,4,3,59,66,82,2644,2646,2651,1,8592,97,114,59,1,8676,105,103,104,116,65,114,114,111,119,59,1,8646,101,105,108,105,110,103,59,1,8968,111,4,2,117,119,2679,2692,98,108,101,66,114,97,99,107,101,116,59,1,10214,110,4,2,84,86,2699,2710,101,101,86,101,99,116,111,114,59,1,10593,101,99,116,111,114,4,2,59,66,2721,2723,1,8643,97,114,59,1,10585,108,111,111,114,59,1,8970,105,103,104,116,4,2,65,86,2745,2752,114,114,111,119,59,1,8596,101,99,116,111,114,59,1,10574,4,2,101,114,2766,2792,101,4,3,59,65,86,2775,2777,2784,1,8867,114,114,111,119,59,1,8612,101,99,116,111,114,59,1,10586,105,97,110,103,108,101,4,3,59,66,69,2806,2808,2813,1,8882,97,114,59,1,10703,113,117,97,108,59,1,8884,112,4,3,68,84,86,2829,2841,2852,111,119,110,86,101,99,116,111,114,59,1,10577,101,101,86,101,99,116,111,114,59,1,10592,101,99,116,111,114,4,2,59,66,2863,2865,1,8639,97,114,59,1,10584,101,99,116,111,114,4,2,59,66,2881,2883,1,8636,97,114,59,1,10578,114,114,111,119,59,1,8656,105,103,104,116,97,114,114,111,119,59,1,8660,115,4,6,69,70,71,76,83,84,2922,2936,2947,2956,2962,2974,113,117,97,108,71,114,101,97,116,101,114,59,1,8922,117,108,108,69,113,117,97,108,59,1,8806,114,101,97,116,101,114,59,1,8822,101,115,115,59,1,10913,108,97,110,116,69,113,117,97,108,59,1,10877,105,108,100,101,59,1,8818,114,59,3,55349,56591,4,2,59,101,2992,2994,1,8920,102,116,97,114,114,111,119,59,1,8666,105,100,111,116,59,1,319,4,3,110,112,119,3019,3110,3115,103,4,4,76,82,108,114,3030,3058,3070,3098,101,102,116,4,2,65,82,3039,3046,114,114,111,119,59,1,10229,105,103,104,116,65,114,114,111,119,59,1,10231,105,103,104,116,65,114,114,111,119,59,1,10230,101,102,116,4,2,97,114,3079,3086,114,114,111,119,59,1,10232,105,103,104,116,97,114,114,111,119,59,1,10234,105,103,104,116,97,114,114,111,119,59,1,10233,102,59,3,55349,56643,101,114,4,2,76,82,3123,3134,101,102,116,65,114,114,111,119,59,1,8601,105,103,104,116,65,114,114,111,119,59,1,8600,4,3,99,104,116,3154,3158,3161,114,59,1,8466,59,1,8624,114,111,107,59,1,321,59,1,8810,4,8,97,99,101,102,105,111,115,117,3188,3192,3196,3222,3227,3237,3243,3248,112,59,1,10501,121,59,1,1052,4,2,100,108,3202,3213,105,117,109,83,112,97,99,101,59,1,8287,108,105,110,116,114,102,59,1,8499,114,59,3,55349,56592,110,117,115,80,108,117,115,59,1,8723,112,102,59,3,55349,56644,99,114,59,1,8499,59,1,924,4,9,74,97,99,101,102,111,115,116,117,3271,3276,3283,3306,3422,3427,4120,4126,4137,99,121,59,1,1034,99,117,116,101,59,1,323,4,3,97,101,121,3291,3297,3303,114,111,110,59,1,327,100,105,108,59,1,325,59,1,1053,4,3,103,115,119,3314,3380,3415,97,116,105,118,101,4,3,77,84,86,3327,3340,3365,101,100,105,117,109,83,112,97,99,101,59,1,8203,104,105,4,2,99,110,3348,3357,107,83,112,97,99,101,59,1,8203,83,112,97,99,101,59,1,8203,101,114,121,84,104,105,110,83,112,97,99,101,59,1,8203,116,101,100,4,2,71,76,3389,3405,114,101,97,116,101,114,71,114,101,97,116,101,114,59,1,8811,101,115,115,76,101,115,115,59,1,8810,76,105,110,101,59,1,10,114,59,3,55349,56593,4,4,66,110,112,116,3437,3444,3460,3464,114,101,97,107,59,1,8288,66,114,101,97,107,105,110,103,83,112,97,99,101,59,1,160,102,59,1,8469,4,13,59,67,68,69,71,72,76,78,80,82,83,84,86,3492,3494,3517,3536,3578,3657,3685,3784,3823,3860,3915,4066,4107,1,10988,4,2,111,117,3500,3510,110,103,114,117,101,110,116,59,1,8802,112,67,97,112,59,1,8813,111,117,98,108,101,86,101,114,116,105,99,97,108,66,97,114,59,1,8742,4,3,108,113,120,3544,3552,3571,101,109,101,110,116,59,1,8713,117,97,108,4,2,59,84,3561,3563,1,8800,105,108,100,101,59,3,8770,824,105,115,116,115,59,1,8708,114,101,97,116,101,114,4,7,59,69,70,71,76,83,84,3600,3602,3609,3621,3631,3637,3650,1,8815,113,117,97,108,59,1,8817,117,108,108,69,113,117,97,108,59,3,8807,824,114,101,97,116,101,114,59,3,8811,824,101,115,115,59,1,8825,108,97,110,116,69,113,117,97,108,59,3,10878,824,105,108,100,101,59,1,8821,117,109,112,4,2,68,69,3666,3677,111,119,110,72,117,109,112,59,3,8782,824,113,117,97,108,59,3,8783,824,101,4,2,102,115,3692,3724,116,84,114,105,97,110,103,108,101,4,3,59,66,69,3709,3711,3717,1,8938,97,114,59,3,10703,824,113,117,97,108,59,1,8940,115,4,6,59,69,71,76,83,84,3739,3741,3748,3757,3764,3777,1,8814,113,117,97,108,59,1,8816,114,101,97,116,101,114,59,1,8824,101,115,115,59,3,8810,824,108,97,110,116,69,113,117,97,108,59,3,10877,824,105,108,100,101,59,1,8820,101,115,116,101,100,4,2,71,76,3795,3812,114,101,97,116,101,114,71,114,101,97,116,101,114,59,3,10914,824,101,115,115,76,101,115,115,59,3,10913,824,114,101,99,101,100,101,115,4,3,59,69,83,3838,3840,3848,1,8832,113,117,97,108,59,3,10927,824,108,97,110,116,69,113,117,97,108,59,1,8928,4,2,101,105,3866,3881,118,101,114,115,101,69,108,101,109,101,110,116,59,1,8716,103,104,116,84,114,105,97,110,103,108,101,4,3,59,66,69,3900,3902,3908,1,8939,97,114,59,3,10704,824,113,117,97,108,59,1,8941,4,2,113,117,3921,3973,117,97,114,101,83,117,4,2,98,112,3933,3952,115,101,116,4,2,59,69,3942,3945,3,8847,824,113,117,97,108,59,1,8930,101,114,115,101,116,4,2,59,69,3963,3966,3,8848,824,113,117,97,108,59,1,8931,4,3,98,99,112,3981,4000,4045,115,101,116,4,2,59,69,3990,3993,3,8834,8402,113,117,97,108,59,1,8840,99,101,101,100,115,4,4,59,69,83,84,4015,4017,4025,4037,1,8833,113,117,97,108,59,3,10928,824,108,97,110,116,69,113,117,97,108,59,1,8929,105,108,100,101,59,3,8831,824,101,114,115,101,116,4,2,59,69,4056,4059,3,8835,8402,113,117,97,108,59,1,8841,105,108,100,101,4,4,59,69,70,84,4080,4082,4089,4100,1,8769,113,117,97,108,59,1,8772,117,108,108,69,113,117,97,108,59,1,8775,105,108,100,101,59,1,8777,101,114,116,105,99,97,108,66,97,114,59,1,8740,99,114,59,3,55349,56489,105,108,100,101,5,209,1,59,4135,1,209,59,1,925,4,14,69,97,99,100,102,103,109,111,112,114,115,116,117,118,4170,4176,4187,4205,4212,4217,4228,4253,4259,4292,4295,4316,4337,4346,108,105,103,59,1,338,99,117,116,101,5,211,1,59,4185,1,211,4,2,105,121,4193,4202,114,99,5,212,1,59,4200,1,212,59,1,1054,98,108,97,99,59,1,336,114,59,3,55349,56594,114,97,118,101,5,210,1,59,4226,1,210,4,3,97,101,105,4236,4241,4246,99,114,59,1,332,103,97,59,1,937,99,114,111,110,59,1,927,112,102,59,3,55349,56646,101,110,67,117,114,108,121,4,2,68,81,4272,4285,111,117,98,108,101,81,117,111,116,101,59,1,8220,117,111,116,101,59,1,8216,59,1,10836,4,2,99,108,4301,4306,114,59,3,55349,56490,97,115,104,5,216,1,59,4314,1,216,105,4,2,108,109,4323,4332,100,101,5,213,1,59,4330,1,213,101,115,59,1,10807,109,108,5,214,1,59,4344,1,214,101,114,4,2,66,80,4354,4380,4,2,97,114,4360,4364,114,59,1,8254,97,99,4,2,101,107,4372,4375,59,1,9182,101,116,59,1,9140,97,114,101,110,116,104,101,115,105,115,59,1,9180,4,9,97,99,102,104,105,108,111,114,115,4413,4422,4426,4431,4435,4438,4448,4471,4561,114,116,105,97,108,68,59,1,8706,121,59,1,1055,114,59,3,55349,56595,105,59,1,934,59,1,928,117,115,77,105,110,117,115,59,1,177,4,2,105,112,4454,4467,110,99,97,114,101,112,108,97,110,101,59,1,8460,102,59,1,8473,4,4,59,101,105,111,4481,4483,4526,4531,1,10939,99,101,100,101,115,4,4,59,69,83,84,4498,4500,4507,4519,1,8826,113,117,97,108,59,1,10927,108,97,110,116,69,113,117,97,108,59,1,8828,105,108,100,101,59,1,8830,109,101,59,1,8243,4,2,100,112,4537,4543,117,99,116,59,1,8719,111,114,116,105,111,110,4,2,59,97,4555,4557,1,8759,108,59,1,8733,4,2,99,105,4567,4572,114,59,3,55349,56491,59,1,936,4,4,85,102,111,115,4585,4594,4599,4604,79,84,5,34,1,59,4592,1,34,114,59,3,55349,56596,112,102,59,1,8474,99,114,59,3,55349,56492,4,12,66,69,97,99,101,102,104,105,111,114,115,117,4636,4642,4650,4681,4704,4763,4767,4771,5047,5069,5081,5094,97,114,114,59,1,10512,71,5,174,1,59,4648,1,174,4,3,99,110,114,4658,4664,4668,117,116,101,59,1,340,103,59,1,10219,114,4,2,59,116,4675,4677,1,8608,108,59,1,10518,4,3,97,101,121,4689,4695,4701,114,111,110,59,1,344,100,105,108,59,1,342,59,1,1056,4,2,59,118,4710,4712,1,8476,101,114,115,101,4,2,69,85,4722,4748,4,2,108,113,4728,4736,101,109,101,110,116,59,1,8715,117,105,108,105,98,114,105,117,109,59,1,8651,112,69,113,117,105,108,105,98,114,105,117,109,59,1,10607,114,59,1,8476,111,59,1,929,103,104,116,4,8,65,67,68,70,84,85,86,97,4792,4840,4849,4905,4912,4972,5022,5040,4,2,110,114,4798,4811,103,108,101,66,114,97,99,107,101,116,59,1,10217,114,111,119,4,3,59,66,76,4822,4824,4829,1,8594,97,114,59,1,8677,101,102,116,65,114,114,111,119,59,1,8644,101,105,108,105,110,103,59,1,8969,111,4,2,117,119,4856,4869,98,108,101,66,114,97,99,107,101,116,59,1,10215,110,4,2,84,86,4876,4887,101,101,86,101,99,116,111,114,59,1,10589,101,99,116,111,114,4,2,59,66,4898,4900,1,8642,97,114,59,1,10581,108,111,111,114,59,1,8971,4,2,101,114,4918,4944,101,4,3,59,65,86,4927,4929,4936,1,8866,114,114,111,119,59,1,8614,101,99,116,111,114,59,1,10587,105,97,110,103,108,101,4,3,59,66,69,4958,4960,4965,1,8883,97,114,59,1,10704,113,117,97,108,59,1,8885,112,4,3,68,84,86,4981,4993,5004,111,119,110,86,101,99,116,111,114,59,1,10575,101,101,86,101,99,116,111,114,59,1,10588,101,99,116,111,114,4,2,59,66,5015,5017,1,8638,97,114,59,1,10580,101,99,116,111,114,4,2,59,66,5033,5035,1,8640,97,114,59,1,10579,114,114,111,119,59,1,8658,4,2,112,117,5053,5057,102,59,1,8477,110,100,73,109,112,108,105,101,115,59,1,10608,105,103,104,116,97,114,114,111,119,59,1,8667,4,2,99,104,5087,5091,114,59,1,8475,59,1,8625,108,101,68,101,108,97,121,101,100,59,1,10740,4,13,72,79,97,99,102,104,105,109,111,113,115,116,117,5134,5150,5157,5164,5198,5203,5259,5265,5277,5283,5374,5380,5385,4,2,67,99,5140,5146,72,99,121,59,1,1065,121,59,1,1064,70,84,99,121,59,1,1068,99,117,116,101,59,1,346,4,5,59,97,101,105,121,5176,5178,5184,5190,5195,1,10940,114,111,110,59,1,352,100,105,108,59,1,350,114,99,59,1,348,59,1,1057,114,59,3,55349,56598,111,114,116,4,4,68,76,82,85,5216,5227,5238,5250,111,119,110,65,114,114,111,119,59,1,8595,101,102,116,65,114,114,111,119,59,1,8592,105,103,104,116,65,114,114,111,119,59,1,8594,112,65,114,114,111,119,59,1,8593,103,109,97,59,1,931,97,108,108,67,105,114,99,108,101,59,1,8728,112,102,59,3,55349,56650,4,2,114,117,5289,5293,116,59,1,8730,97,114,101,4,4,59,73,83,85,5306,5308,5322,5367,1,9633,110,116,101,114,115,101,99,116,105,111,110,59,1,8851,117,4,2,98,112,5329,5347,115,101,116,4,2,59,69,5338,5340,1,8847,113,117,97,108,59,1,8849,101,114,115,101,116,4,2,59,69,5358,5360,1,8848,113,117,97,108,59,1,8850,110,105,111,110,59,1,8852,99,114,59,3,55349,56494,97,114,59,1,8902,4,4,98,99,109,112,5395,5420,5475,5478,4,2,59,115,5401,5403,1,8912,101,116,4,2,59,69,5411,5413,1,8912,113,117,97,108,59,1,8838,4,2,99,104,5426,5468,101,101,100,115,4,4,59,69,83,84,5440,5442,5449,5461,1,8827,113,117,97,108,59,1,10928,108,97,110,116,69,113,117,97,108,59,1,8829,105,108,100,101,59,1,8831,84,104,97,116,59,1,8715,59,1,8721,4,3,59,101,115,5486,5488,5507,1,8913,114,115,101,116,4,2,59,69,5498,5500,1,8835,113,117,97,108,59,1,8839,101,116,59,1,8913,4,11,72,82,83,97,99,102,104,105,111,114,115,5536,5546,5552,5567,5579,5602,5607,5655,5695,5701,5711,79,82,78,5,222,1,59,5544,1,222,65,68,69,59,1,8482,4,2,72,99,5558,5563,99,121,59,1,1035,121,59,1,1062,4,2,98,117,5573,5576,59,1,9,59,1,932,4,3,97,101,121,5587,5593,5599,114,111,110,59,1,356,100,105,108,59,1,354,59,1,1058,114,59,3,55349,56599,4,2,101,105,5613,5631,4,2,114,116,5619,5627,101,102,111,114,101,59,1,8756,97,59,1,920,4,2,99,110,5637,5647,107,83,112,97,99,101,59,3,8287,8202,83,112,97,99,101,59,1,8201,108,100,101,4,4,59,69,70,84,5668,5670,5677,5688,1,8764,113,117,97,108,59,1,8771,117,108,108,69,113,117,97,108,59,1,8773,105,108,100,101,59,1,8776,112,102,59,3,55349,56651,105,112,108,101,68,111,116,59,1,8411,4,2,99,116,5717,5722,114,59,3,55349,56495,114,111,107,59,1,358,4,14,97,98,99,100,102,103,109,110,111,112,114,115,116,117,5758,5789,5805,5823,5830,5835,5846,5852,5921,5937,6089,6095,6101,6108,4,2,99,114,5764,5774,117,116,101,5,218,1,59,5772,1,218,114,4,2,59,111,5781,5783,1,8607,99,105,114,59,1,10569,114,4,2,99,101,5796,5800,121,59,1,1038,118,101,59,1,364,4,2,105,121,5811,5820,114,99,5,219,1,59,5818,1,219,59,1,1059,98,108,97,99,59,1,368,114,59,3,55349,56600,114,97,118,101,5,217,1,59,5844,1,217,97,99,114,59,1,362,4,2,100,105,5858,5905,101,114,4,2,66,80,5866,5892,4,2,97,114,5872,5876,114,59,1,95,97,99,4,2,101,107,5884,5887,59,1,9183,101,116,59,1,9141,97,114,101,110,116,104,101,115,105,115,59,1,9181,111,110,4,2,59,80,5913,5915,1,8899,108,117,115,59,1,8846,4,2,103,112,5927,5932,111,110,59,1,370,102,59,3,55349,56652,4,8,65,68,69,84,97,100,112,115,5955,5985,5996,6009,6026,6033,6044,6075,114,114,111,119,4,3,59,66,68,5967,5969,5974,1,8593,97,114,59,1,10514,111,119,110,65,114,114,111,119,59,1,8645,111,119,110,65,114,114,111,119,59,1,8597,113,117,105,108,105,98,114,105,117,109,59,1,10606,101,101,4,2,59,65,6017,6019,1,8869,114,114,111,119,59,1,8613,114,114,111,119,59,1,8657,111,119,110,97,114,114,111,119,59,1,8661,101,114,4,2,76,82,6052,6063,101,102,116,65,114,114,111,119,59,1,8598,105,103,104,116,65,114,114,111,119,59,1,8599,105,4,2,59,108,6082,6084,1,978,111,110,59,1,933,105,110,103,59,1,366,99,114,59,3,55349,56496,105,108,100,101,59,1,360,109,108,5,220,1,59,6115,1,220,4,9,68,98,99,100,101,102,111,115,118,6137,6143,6148,6152,6166,6250,6255,6261,6267,97,115,104,59,1,8875,97,114,59,1,10987,121,59,1,1042,97,115,104,4,2,59,108,6161,6163,1,8873,59,1,10982,4,2,101,114,6172,6175,59,1,8897,4,3,98,116,121,6183,6188,6238,97,114,59,1,8214,4,2,59,105,6194,6196,1,8214,99,97,108,4,4,66,76,83,84,6209,6214,6220,6231,97,114,59,1,8739,105,110,101,59,1,124,101,112,97,114,97,116,111,114,59,1,10072,105,108,100,101,59,1,8768,84,104,105,110,83,112,97,99,101,59,1,8202,114,59,3,55349,56601,112,102,59,3,55349,56653,99,114,59,3,55349,56497,100,97,115,104,59,1,8874,4,5,99,101,102,111,115,6286,6292,6298,6303,6309,105,114,99,59,1,372,100,103,101,59,1,8896,114,59,3,55349,56602,112,102,59,3,55349,56654,99,114,59,3,55349,56498,4,4,102,105,111,115,6325,6330,6333,6339,114,59,3,55349,56603,59,1,926,112,102,59,3,55349,56655,99,114,59,3,55349,56499,4,9,65,73,85,97,99,102,111,115,117,6365,6370,6375,6380,6391,6405,6410,6416,6422,99,121,59,1,1071,99,121,59,1,1031,99,121,59,1,1070,99,117,116,101,5,221,1,59,6389,1,221,4,2,105,121,6397,6402,114,99,59,1,374,59,1,1067,114,59,3,55349,56604,112,102,59,3,55349,56656,99,114,59,3,55349,56500,109,108,59,1,376,4,8,72,97,99,100,101,102,111,115,6445,6450,6457,6472,6477,6501,6505,6510,99,121,59,1,1046,99,117,116,101,59,1,377,4,2,97,121,6463,6469,114,111,110,59,1,381,59,1,1047,111,116,59,1,379,4,2,114,116,6483,6497,111,87,105,100,116,104,83,112,97,99,101,59,1,8203,97,59,1,918,114,59,1,8488,112,102,59,1,8484,99,114,59,3,55349,56501,4,16,97,98,99,101,102,103,108,109,110,111,112,114,115,116,117,119,6550,6561,6568,6612,6622,6634,6645,6672,6699,6854,6870,6923,6933,6963,6974,6983,99,117,116,101,5,225,1,59,6559,1,225,114,101,118,101,59,1,259,4,6,59,69,100,105,117,121,6582,6584,6588,6591,6600,6609,1,8766,59,3,8766,819,59,1,8767,114,99,5,226,1,59,6598,1,226,116,101,5,180,1,59,6607,1,180,59,1,1072,108,105,103,5,230,1,59,6620,1,230,4,2,59,114,6628,6630,1,8289,59,3,55349,56606,114,97,118,101,5,224,1,59,6643,1,224,4,2,101,112,6651,6667,4,2,102,112,6657,6663,115,121,109,59,1,8501,104,59,1,8501,104,97,59,1,945,4,2,97,112,6678,6692,4,2,99,108,6684,6688,114,59,1,257,103,59,1,10815,5,38,1,59,6697,1,38,4,2,100,103,6705,6737,4,5,59,97,100,115,118,6717,6719,6724,6727,6734,1,8743,110,100,59,1,10837,59,1,10844,108,111,112,101,59,1,10840,59,1,10842,4,7,59,101,108,109,114,115,122,6753,6755,6758,6762,6814,6835,6848,1,8736,59,1,10660,101,59,1,8736,115,100,4,2,59,97,6770,6772,1,8737,4,8,97,98,99,100,101,102,103,104,6790,6793,6796,6799,6802,6805,6808,6811,59,1,10664,59,1,10665,59,1,10666,59,1,10667,59,1,10668,59,1,10669,59,1,10670,59,1,10671,116,4,2,59,118,6821,6823,1,8735,98,4,2,59,100,6830,6832,1,8894,59,1,10653,4,2,112,116,6841,6845,104,59,1,8738,59,1,197,97,114,114,59,1,9084,4,2,103,112,6860,6865,111,110,59,1,261,102,59,3,55349,56658,4,7,59,69,97,101,105,111,112,6886,6888,6891,6897,6900,6904,6908,1,8776,59,1,10864,99,105,114,59,1,10863,59,1,8778,100,59,1,8779,115,59,1,39,114,111,120,4,2,59,101,6917,6919,1,8776,113,59,1,8778,105,110,103,5,229,1,59,6931,1,229,4,3,99,116,121,6941,6946,6949,114,59,3,55349,56502,59,1,42,109,112,4,2,59,101,6957,6959,1,8776,113,59,1,8781,105,108,100,101,5,227,1,59,6972,1,227,109,108,5,228,1,59,6981,1,228,4,2,99,105,6989,6997,111,110,105,110,116,59,1,8755,110,116,59,1,10769,4,16,78,97,98,99,100,101,102,105,107,108,110,111,112,114,115,117,7036,7041,7119,7135,7149,7155,7219,7224,7347,7354,7463,7489,7786,7793,7814,7866,111,116,59,1,10989,4,2,99,114,7047,7094,107,4,4,99,101,112,115,7058,7064,7073,7080,111,110,103,59,1,8780,112,115,105,108,111,110,59,1,1014,114,105,109,101,59,1,8245,105,109,4,2,59,101,7088,7090,1,8765,113,59,1,8909,4,2,118,119,7100,7105,101,101,59,1,8893,101,100,4,2,59,103,7113,7115,1,8965,101,59,1,8965,114,107,4,2,59,116,7127,7129,1,9141,98,114,107,59,1,9142,4,2,111,121,7141,7146,110,103,59,1,8780,59,1,1073,113,117,111,59,1,8222,4,5,99,109,112,114,116,7167,7181,7188,7193,7199,97,117,115,4,2,59,101,7176,7178,1,8757,59,1,8757,112,116,121,118,59,1,10672,115,105,59,1,1014,110,111,117,59,1,8492,4,3,97,104,119,7207,7210,7213,59,1,946,59,1,8502,101,101,110,59,1,8812,114,59,3,55349,56607,103,4,7,99,111,115,116,117,118,119,7241,7262,7288,7305,7328,7335,7340,4,3,97,105,117,7249,7253,7258,112,59,1,8898,114,99,59,1,9711,112,59,1,8899,4,3,100,112,116,7270,7275,7281,111,116,59,1,10752,108,117,115,59,1,10753,105,109,101,115,59,1,10754,4,2,113,116,7294,7300,99,117,112,59,1,10758,97,114,59,1,9733,114,105,97,110,103,108,101,4,2,100,117,7318,7324,111,119,110,59,1,9661,112,59,1,9651,112,108,117,115,59,1,10756,101,101,59,1,8897,101,100,103,101,59,1,8896,97,114,111,119,59,1,10509,4,3,97,107,111,7362,7436,7458,4,2,99,110,7368,7432,107,4,3,108,115,116,7377,7386,7394,111,122,101,110,103,101,59,1,10731,113,117,97,114,101,59,1,9642,114,105,97,110,103,108,101,4,4,59,100,108,114,7411,7413,7419,7425,1,9652,111,119,110,59,1,9662,101,102,116,59,1,9666,105,103,104,116,59,1,9656,107,59,1,9251,4,2,49,51,7442,7454,4,2,50,52,7448,7451,59,1,9618,59,1,9617,52,59,1,9619,99,107,59,1,9608,4,2,101,111,7469,7485,4,2,59,113,7475,7478,3,61,8421,117,105,118,59,3,8801,8421,116,59,1,8976,4,4,112,116,119,120,7499,7504,7517,7523,102,59,3,55349,56659,4,2,59,116,7510,7512,1,8869,111,109,59,1,8869,116,105,101,59,1,8904,4,12,68,72,85,86,98,100,104,109,112,116,117,118,7549,7571,7597,7619,7655,7660,7682,7708,7715,7721,7728,7750,4,4,76,82,108,114,7559,7562,7565,7568,59,1,9559,59,1,9556,59,1,9558,59,1,9555,4,5,59,68,85,100,117,7583,7585,7588,7591,7594,1,9552,59,1,9574,59,1,9577,59,1,9572,59,1,9575,4,4,76,82,108,114,7607,7610,7613,7616,59,1,9565,59,1,9562,59,1,9564,59,1,9561,4,7,59,72,76,82,104,108,114,7635,7637,7640,7643,7646,7649,7652,1,9553,59,1,9580,59,1,9571,59,1,9568,59,1,9579,59,1,9570,59,1,9567,111,120,59,1,10697,4,4,76,82,108,114,7670,7673,7676,7679,59,1,9557,59,1,9554,59,1,9488,59,1,9484,4,5,59,68,85,100,117,7694,7696,7699,7702,7705,1,9472,59,1,9573,59,1,9576,59,1,9516,59,1,9524,105,110,117,115,59,1,8863,108,117,115,59,1,8862,105,109,101,115,59,1,8864,4,4,76,82,108,114,7738,7741,7744,7747,59,1,9563,59,1,9560,59,1,9496,59,1,9492,4,7,59,72,76,82,104,108,114,7766,7768,7771,7774,7777,7780,7783,1,9474,59,1,9578,59,1,9569,59,1,9566,59,1,9532,59,1,9508,59,1,9500,114,105,109,101,59,1,8245,4,2,101,118,7799,7804,118,101,59,1,728,98,97,114,5,166,1,59,7812,1,166,4,4,99,101,105,111,7824,7829,7834,7846,114,59,3,55349,56503,109,105,59,1,8271,109,4,2,59,101,7841,7843,1,8765,59,1,8909,108,4,3,59,98,104,7855,7857,7860,1,92,59,1,10693,115,117,98,59,1,10184,4,2,108,109,7872,7885,108,4,2,59,101,7879,7881,1,8226,116,59,1,8226,112,4,3,59,69,101,7894,7896,7899,1,8782,59,1,10926,4,2,59,113,7905,7907,1,8783,59,1,8783,4,15,97,99,100,101,102,104,105,108,111,114,115,116,117,119,121,7942,8021,8075,8080,8121,8126,8157,8279,8295,8430,8446,8485,8491,8707,8726,4,3,99,112,114,7950,7956,8007,117,116,101,59,1,263,4,6,59,97,98,99,100,115,7970,7972,7977,7984,7998,8003,1,8745,110,100,59,1,10820,114,99,117,112,59,1,10825,4,2,97,117,7990,7994,112,59,1,10827,112,59,1,10823,111,116,59,1,10816,59,3,8745,65024,4,2,101,111,8013,8017,116,59,1,8257,110,59,1,711,4,4,97,101,105,117,8031,8046,8056,8061,4,2,112,114,8037,8041,115,59,1,10829,111,110,59,1,269,100,105,108,5,231,1,59,8054,1,231,114,99,59,1,265,112,115,4,2,59,115,8069,8071,1,10828,109,59,1,10832,111,116,59,1,267,4,3,100,109,110,8088,8097,8104,105,108,5,184,1,59,8095,1,184,112,116,121,118,59,1,10674,116,5,162,2,59,101,8112,8114,1,162,114,100,111,116,59,1,183,114,59,3,55349,56608,4,3,99,101,105,8134,8138,8154,121,59,1,1095,99,107,4,2,59,109,8146,8148,1,10003,97,114,107,59,1,10003,59,1,967,114,4,7,59,69,99,101,102,109,115,8174,8176,8179,8258,8261,8268,8273,1,9675,59,1,10691,4,3,59,101,108,8187,8189,8193,1,710,113,59,1,8791,101,4,2,97,100,8200,8223,114,114,111,119,4,2,108,114,8210,8216,101,102,116,59,1,8634,105,103,104,116,59,1,8635,4,5,82,83,97,99,100,8235,8238,8241,8246,8252,59,1,174,59,1,9416,115,116,59,1,8859,105,114,99,59,1,8858,97,115,104,59,1,8861,59,1,8791,110,105,110,116,59,1,10768,105,100,59,1,10991,99,105,114,59,1,10690,117,98,115,4,2,59,117,8288,8290,1,9827,105,116,59,1,9827,4,4,108,109,110,112,8305,8326,8376,8400,111,110,4,2,59,101,8313,8315,1,58,4,2,59,113,8321,8323,1,8788,59,1,8788,4,2,109,112,8332,8344,97,4,2,59,116,8339,8341,1,44,59,1,64,4,3,59,102,108,8352,8354,8358,1,8705,110,59,1,8728,101,4,2,109,120,8365,8371,101,110,116,59,1,8705,101,115,59,1,8450,4,2,103,105,8382,8395,4,2,59,100,8388,8390,1,8773,111,116,59,1,10861,110,116,59,1,8750,4,3,102,114,121,8408,8412,8417,59,3,55349,56660,111,100,59,1,8720,5,169,2,59,115,8424,8426,1,169,114,59,1,8471,4,2,97,111,8436,8441,114,114,59,1,8629,115,115,59,1,10007,4,2,99,117,8452,8457,114,59,3,55349,56504,4,2,98,112,8463,8474,4,2,59,101,8469,8471,1,10959,59,1,10961,4,2,59,101,8480,8482,1,10960,59,1,10962,100,111,116,59,1,8943,4,7,100,101,108,112,114,118,119,8507,8522,8536,8550,8600,8697,8702,97,114,114,4,2,108,114,8516,8519,59,1,10552,59,1,10549,4,2,112,115,8528,8532,114,59,1,8926,99,59,1,8927,97,114,114,4,2,59,112,8545,8547,1,8630,59,1,10557,4,6,59,98,99,100,111,115,8564,8566,8573,8587,8592,8596,1,8746,114,99,97,112,59,1,10824,4,2,97,117,8579,8583,112,59,1,10822,112,59,1,10826,111,116,59,1,8845,114,59,1,10821,59,3,8746,65024,4,4,97,108,114,118,8610,8623,8663,8672,114,114,4,2,59,109,8618,8620,1,8631,59,1,10556,121,4,3,101,118,119,8632,8651,8656,113,4,2,112,115,8639,8645,114,101,99,59,1,8926,117,99,99,59,1,8927,101,101,59,1,8910,101,100,103,101,59,1,8911,101,110,5,164,1,59,8670,1,164,101,97,114,114,111,119,4,2,108,114,8684,8690,101,102,116,59,1,8630,105,103,104,116,59,1,8631,101,101,59,1,8910,101,100,59,1,8911,4,2,99,105,8713,8721,111,110,105,110,116,59,1,8754,110,116,59,1,8753,108,99,116,121,59,1,9005,4,19,65,72,97,98,99,100,101,102,104,105,106,108,111,114,115,116,117,119,122,8773,8778,8783,8821,8839,8854,8887,8914,8930,8944,9036,9041,9058,9197,9227,9258,9281,9297,9305,114,114,59,1,8659,97,114,59,1,10597,4,4,103,108,114,115,8793,8799,8805,8809,103,101,114,59,1,8224,101,116,104,59,1,8504,114,59,1,8595,104,4,2,59,118,8816,8818,1,8208,59,1,8867,4,2,107,108,8827,8834,97,114,111,119,59,1,10511,97,99,59,1,733,4,2,97,121,8845,8851,114,111,110,59,1,271,59,1,1076,4,3,59,97,111,8862,8864,8880,1,8518,4,2,103,114,8870,8876,103,101,114,59,1,8225,114,59,1,8650,116,115,101,113,59,1,10871,4,3,103,108,109,8895,8902,8907,5,176,1,59,8900,1,176,116,97,59,1,948,112,116,121,118,59,1,10673,4,2,105,114,8920,8926,115,104,116,59,1,10623,59,3,55349,56609,97,114,4,2,108,114,8938,8941,59,1,8643,59,1,8642,4,5,97,101,103,115,118,8956,8986,8989,8996,9001,109,4,3,59,111,115,8965,8967,8983,1,8900,110,100,4,2,59,115,8975,8977,1,8900,117,105,116,59,1,9830,59,1,9830,59,1,168,97,109,109,97,59,1,989,105,110,59,1,8946,4,3,59,105,111,9009,9011,9031,1,247,100,101,5,247,2,59,111,9020,9022,1,247,110,116,105,109,101,115,59,1,8903,110,120,59,1,8903,99,121,59,1,1106,99,4,2,111,114,9048,9053,114,110,59,1,8990,111,112,59,1,8973,4,5,108,112,116,117,119,9070,9076,9081,9130,9144,108,97,114,59,1,36,102,59,3,55349,56661,4,5,59,101,109,112,115,9093,9095,9109,9116,9122,1,729,113,4,2,59,100,9102,9104,1,8784,111,116,59,1,8785,105,110,117,115,59,1,8760,108,117,115,59,1,8724,113,117,97,114,101,59,1,8865,98,108,101,98,97,114,119,101,100,103,101,59,1,8966,110,4,3,97,100,104,9153,9160,9172,114,114,111,119,59,1,8595,111,119,110,97,114,114,111,119,115,59,1,8650,97,114,112,111,111,110,4,2,108,114,9184,9190,101,102,116,59,1,8643,105,103,104,116,59,1,8642,4,2,98,99,9203,9211,107,97,114,111,119,59,1,10512,4,2,111,114,9217,9222,114,110,59,1,8991,111,112,59,1,8972,4,3,99,111,116,9235,9248,9252,4,2,114,121,9241,9245,59,3,55349,56505,59,1,1109,108,59,1,10742,114,111,107,59,1,273,4,2,100,114,9264,9269,111,116,59,1,8945,105,4,2,59,102,9276,9278,1,9663,59,1,9662,4,2,97,104,9287,9292,114,114,59,1,8693,97,114,59,1,10607,97,110,103,108,101,59,1,10662,4,2,99,105,9311,9315,121,59,1,1119,103,114,97,114,114,59,1,10239,4,18,68,97,99,100,101,102,103,108,109,110,111,112,113,114,115,116,117,120,9361,9376,9398,9439,9444,9447,9462,9495,9531,9585,9598,9614,9659,9755,9771,9792,9808,9826,4,2,68,111,9367,9372,111,116,59,1,10871,116,59,1,8785,4,2,99,115,9382,9392,117,116,101,5,233,1,59,9390,1,233,116,101,114,59,1,10862,4,4,97,105,111,121,9408,9414,9430,9436,114,111,110,59,1,283,114,4,2,59,99,9421,9423,1,8790,5,234,1,59,9428,1,234,108,111,110,59,1,8789,59,1,1101,111,116,59,1,279,59,1,8519,4,2,68,114,9453,9458,111,116,59,1,8786,59,3,55349,56610,4,3,59,114,115,9470,9472,9482,1,10906,97,118,101,5,232,1,59,9480,1,232,4,2,59,100,9488,9490,1,10902,111,116,59,1,10904,4,4,59,105,108,115,9505,9507,9515,9518,1,10905,110,116,101,114,115,59,1,9191,59,1,8467,4,2,59,100,9524,9526,1,10901,111,116,59,1,10903,4,3,97,112,115,9539,9544,9564,99,114,59,1,275,116,121,4,3,59,115,118,9554,9556,9561,1,8709,101,116,59,1,8709,59,1,8709,112,4,2,49,59,9571,9583,4,2,51,52,9577,9580,59,1,8196,59,1,8197,1,8195,4,2,103,115,9591,9594,59,1,331,112,59,1,8194,4,2,103,112,9604,9609,111,110,59,1,281,102,59,3,55349,56662,4,3,97,108,115,9622,9635,9640,114,4,2,59,115,9629,9631,1,8917,108,59,1,10723,117,115,59,1,10865,105,4,3,59,108,118,9649,9651,9656,1,949,111,110,59,1,949,59,1,1013,4,4,99,115,117,118,9669,9686,9716,9747,4,2,105,111,9675,9680,114,99,59,1,8790,108,111,110,59,1,8789,4,2,105,108,9692,9696,109,59,1,8770,97,110,116,4,2,103,108,9705,9710,116,114,59,1,10902,101,115,115,59,1,10901,4,3,97,101,105,9724,9729,9734,108,115,59,1,61,115,116,59,1,8799,118,4,2,59,68,9741,9743,1,8801,68,59,1,10872,112,97,114,115,108,59,1,10725,4,2,68,97,9761,9766,111,116,59,1,8787,114,114,59,1,10609,4,3,99,100,105,9779,9783,9788,114,59,1,8495,111,116,59,1,8784,109,59,1,8770,4,2,97,104,9798,9801,59,1,951,5,240,1,59,9806,1,240,4,2,109,114,9814,9822,108,5,235,1,59,9820,1,235,111,59,1,8364,4,3,99,105,112,9834,9838,9843,108,59,1,33,115,116,59,1,8707,4,2,101,111,9849,9859,99,116,97,116,105,111,110,59,1,8496,110,101,110,116,105,97,108,101,59,1,8519,4,12,97,99,101,102,105,106,108,110,111,112,114,115,9896,9910,9914,9921,9954,9960,9967,9989,9994,10027,10036,10164,108,108,105,110,103,100,111,116,115,101,113,59,1,8786,121,59,1,1092,109,97,108,101,59,1,9792,4,3,105,108,114,9929,9935,9950,108,105,103,59,1,64259,4,2,105,108,9941,9945,103,59,1,64256,105,103,59,1,64260,59,3,55349,56611,108,105,103,59,1,64257,108,105,103,59,3,102,106,4,3,97,108,116,9975,9979,9984,116,59,1,9837,105,103,59,1,64258,110,115,59,1,9649,111,102,59,1,402,4,2,112,114,10000,10005,102,59,3,55349,56663,4,2,97,107,10011,10016,108,108,59,1,8704,4,2,59,118,10022,10024,1,8916,59,1,10969,97,114,116,105,110,116,59,1,10765,4,2,97,111,10042,10159,4,2,99,115,10048,10155,4,6,49,50,51,52,53,55,10062,10102,10114,10135,10139,10151,4,6,50,51,52,53,54,56,10076,10083,10086,10093,10096,10099,5,189,1,59,10081,1,189,59,1,8531,5,188,1,59,10091,1,188,59,1,8533,59,1,8537,59,1,8539,4,2,51,53,10108,10111,59,1,8532,59,1,8534,4,3,52,53,56,10122,10129,10132,5,190,1,59,10127,1,190,59,1,8535,59,1,8540,53,59,1,8536,4,2,54,56,10145,10148,59,1,8538,59,1,8541,56,59,1,8542,108,59,1,8260,119,110,59,1,8994,99,114,59,3,55349,56507,4,17,69,97,98,99,100,101,102,103,105,106,108,110,111,114,115,116,118,10206,10217,10247,10254,10268,10273,10358,10363,10374,10380,10385,10406,10458,10464,10470,10497,10610,4,2,59,108,10212,10214,1,8807,59,1,10892,4,3,99,109,112,10225,10231,10244,117,116,101,59,1,501,109,97,4,2,59,100,10239,10241,1,947,59,1,989,59,1,10886,114,101,118,101,59,1,287,4,2,105,121,10260,10265,114,99,59,1,285,59,1,1075,111,116,59,1,289,4,4,59,108,113,115,10283,10285,10288,10308,1,8805,59,1,8923,4,3,59,113,115,10296,10298,10301,1,8805,59,1,8807,108,97,110,116,59,1,10878,4,4,59,99,100,108,10318,10320,10324,10345,1,10878,99,59,1,10921,111,116,4,2,59,111,10332,10334,1,10880,4,2,59,108,10340,10342,1,10882,59,1,10884,4,2,59,101,10351,10354,3,8923,65024,115,59,1,10900,114,59,3,55349,56612,4,2,59,103,10369,10371,1,8811,59,1,8921,109,101,108,59,1,8503,99,121,59,1,1107,4,4,59,69,97,106,10395,10397,10400,10403,1,8823,59,1,10898,59,1,10917,59,1,10916,4,4,69,97,101,115,10416,10419,10434,10453,59,1,8809,112,4,2,59,112,10426,10428,1,10890,114,111,120,59,1,10890,4,2,59,113,10440,10442,1,10888,4,2,59,113,10448,10450,1,10888,59,1,8809,105,109,59,1,8935,112,102,59,3,55349,56664,97,118,101,59,1,96,4,2,99,105,10476,10480,114,59,1,8458,109,4,3,59,101,108,10489,10491,10494,1,8819,59,1,10894,59,1,10896,5,62,6,59,99,100,108,113,114,10512,10514,10527,10532,10538,10545,1,62,4,2,99,105,10520,10523,59,1,10919,114,59,1,10874,111,116,59,1,8919,80,97,114,59,1,10645,117,101,115,116,59,1,10876,4,5,97,100,101,108,115,10557,10574,10579,10599,10605,4,2,112,114,10563,10570,112,114,111,120,59,1,10886,114,59,1,10616,111,116,59,1,8919,113,4,2,108,113,10586,10592,101,115,115,59,1,8923,108,101,115,115,59,1,10892,101,115,115,59,1,8823,105,109,59,1,8819,4,2,101,110,10616,10626,114,116,110,101,113,113,59,3,8809,65024,69,59,3,8809,65024,4,10,65,97,98,99,101,102,107,111,115,121,10653,10658,10713,10718,10724,10760,10765,10786,10850,10875,114,114,59,1,8660,4,4,105,108,109,114,10668,10674,10678,10684,114,115,112,59,1,8202,102,59,1,189,105,108,116,59,1,8459,4,2,100,114,10690,10695,99,121,59,1,1098,4,3,59,99,119,10703,10705,10710,1,8596,105,114,59,1,10568,59,1,8621,97,114,59,1,8463,105,114,99,59,1,293,4,3,97,108,114,10732,10748,10754,114,116,115,4,2,59,117,10741,10743,1,9829,105,116,59,1,9829,108,105,112,59,1,8230,99,111,110,59,1,8889,114,59,3,55349,56613,115,4,2,101,119,10772,10779,97,114,111,119,59,1,10533,97,114,111,119,59,1,10534,4,5,97,109,111,112,114,10798,10803,10809,10839,10844,114,114,59,1,8703,116,104,116,59,1,8763,107,4,2,108,114,10816,10827,101,102,116,97,114,114,111,119,59,1,8617,105,103,104,116,97,114,114,111,119,59,1,8618,102,59,3,55349,56665,98,97,114,59,1,8213,4,3,99,108,116,10858,10863,10869,114,59,3,55349,56509,97,115,104,59,1,8463,114,111,107,59,1,295,4,2,98,112,10881,10887,117,108,108,59,1,8259,104,101,110,59,1,8208,4,15,97,99,101,102,103,105,106,109,110,111,112,113,115,116,117,10925,10936,10958,10977,10990,11001,11039,11045,11101,11192,11220,11226,11237,11285,11299,99,117,116,101,5,237,1,59,10934,1,237,4,3,59,105,121,10944,10946,10955,1,8291,114,99,5,238,1,59,10953,1,238,59,1,1080,4,2,99,120,10964,10968,121,59,1,1077,99,108,5,161,1,59,10975,1,161,4,2,102,114,10983,10986,59,1,8660,59,3,55349,56614,114,97,118,101,5,236,1,59,10999,1,236,4,4,59,105,110,111,11011,11013,11028,11034,1,8520,4,2,105,110,11019,11024,110,116,59,1,10764,116,59,1,8749,102,105,110,59,1,10716,116,97,59,1,8489,108,105,103,59,1,307,4,3,97,111,112,11053,11092,11096,4,3,99,103,116,11061,11065,11088,114,59,1,299,4,3,101,108,112,11073,11076,11082,59,1,8465,105,110,101,59,1,8464,97,114,116,59,1,8465,104,59,1,305,102,59,1,8887,101,100,59,1,437,4,5,59,99,102,111,116,11113,11115,11121,11136,11142,1,8712,97,114,101,59,1,8453,105,110,4,2,59,116,11129,11131,1,8734,105,101,59,1,10717,100,111,116,59,1,305,4,5,59,99,101,108,112,11154,11156,11161,11179,11186,1,8747,97,108,59,1,8890,4,2,103,114,11167,11173,101,114,115,59,1,8484,99,97,108,59,1,8890,97,114,104,107,59,1,10775,114,111,100,59,1,10812,4,4,99,103,112,116,11202,11206,11211,11216,121,59,1,1105,111,110,59,1,303,102,59,3,55349,56666,97,59,1,953,114,111,100,59,1,10812,117,101,115,116,5,191,1,59,11235,1,191,4,2,99,105,11243,11248,114,59,3,55349,56510,110,4,5,59,69,100,115,118,11261,11263,11266,11271,11282,1,8712,59,1,8953,111,116,59,1,8949,4,2,59,118,11277,11279,1,8948,59,1,8947,59,1,8712,4,2,59,105,11291,11293,1,8290,108,100,101,59,1,297,4,2,107,109,11305,11310,99,121,59,1,1110,108,5,239,1,59,11316,1,239,4,6,99,102,109,111,115,117,11332,11346,11351,11357,11363,11380,4,2,105,121,11338,11343,114,99,59,1,309,59,1,1081,114,59,3,55349,56615,97,116,104,59,1,567,112,102,59,3,55349,56667,4,2,99,101,11369,11374,114,59,3,55349,56511,114,99,121,59,1,1112,107,99,121,59,1,1108,4,8,97,99,102,103,104,106,111,115,11404,11418,11433,11438,11445,11450,11455,11461,112,112,97,4,2,59,118,11413,11415,1,954,59,1,1008,4,2,101,121,11424,11430,100,105,108,59,1,311,59,1,1082,114,59,3,55349,56616,114,101,101,110,59,1,312,99,121,59,1,1093,99,121,59,1,1116,112,102,59,3,55349,56668,99,114,59,3,55349,56512,4,23,65,66,69,72,97,98,99,100,101,102,103,104,106,108,109,110,111,112,114,115,116,117,118,11515,11538,11544,11555,11560,11721,11780,11818,11868,12136,12160,12171,12203,12208,12246,12275,12327,12509,12523,12569,12641,12732,12752,4,3,97,114,116,11523,11528,11532,114,114,59,1,8666,114,59,1,8656,97,105,108,59,1,10523,97,114,114,59,1,10510,4,2,59,103,11550,11552,1,8806,59,1,10891,97,114,59,1,10594,4,9,99,101,103,109,110,112,113,114,116,11580,11586,11594,11600,11606,11624,11627,11636,11694,117,116,101,59,1,314,109,112,116,121,118,59,1,10676,114,97,110,59,1,8466,98,100,97,59,1,955,103,4,3,59,100,108,11615,11617,11620,1,10216,59,1,10641,101,59,1,10216,59,1,10885,117,111,5,171,1,59,11634,1,171,114,4,8,59,98,102,104,108,112,115,116,11655,11657,11669,11673,11677,11681,11685,11690,1,8592,4,2,59,102,11663,11665,1,8676,115,59,1,10527,115,59,1,10525,107,59,1,8617,112,59,1,8619,108,59,1,10553,105,109,59,1,10611,108,59,1,8610,4,3,59,97,101,11702,11704,11709,1,10923,105,108,59,1,10521,4,2,59,115,11715,11717,1,10925,59,3,10925,65024,4,3,97,98,114,11729,11734,11739,114,114,59,1,10508,114,107,59,1,10098,4,2,97,107,11745,11758,99,4,2,101,107,11752,11755,59,1,123,59,1,91,4,2,101,115,11764,11767,59,1,10635,108,4,2,100,117,11774,11777,59,1,10639,59,1,10637,4,4,97,101,117,121,11790,11796,11811,11815,114,111,110,59,1,318,4,2,100,105,11802,11807,105,108,59,1,316,108,59,1,8968,98,59,1,123,59,1,1083,4,4,99,113,114,115,11828,11832,11845,11864,97,59,1,10550,117,111,4,2,59,114,11840,11842,1,8220,59,1,8222,4,2,100,117,11851,11857,104,97,114,59,1,10599,115,104,97,114,59,1,10571,104,59,1,8626,4,5,59,102,103,113,115,11880,11882,12008,12011,12031,1,8804,116,4,5,97,104,108,114,116,11895,11913,11935,11947,11996,114,114,111,119,4,2,59,116,11905,11907,1,8592,97,105,108,59,1,8610,97,114,112,111,111,110,4,2,100,117,11925,11931,111,119,110,59,1,8637,112,59,1,8636,101,102,116,97,114,114,111,119,115,59,1,8647,105,103,104,116,4,3,97,104,115,11959,11974,11984,114,114,111,119,4,2,59,115,11969,11971,1,8596,59,1,8646,97,114,112,111,111,110,115,59,1,8651,113,117,105,103,97,114,114,111,119,59,1,8621,104,114,101,101,116,105,109,101,115,59,1,8907,59,1,8922,4,3,59,113,115,12019,12021,12024,1,8804,59,1,8806,108,97,110,116,59,1,10877,4,5,59,99,100,103,115,12043,12045,12049,12070,12083,1,10877,99,59,1,10920,111,116,4,2,59,111,12057,12059,1,10879,4,2,59,114,12065,12067,1,10881,59,1,10883,4,2,59,101,12076,12079,3,8922,65024,115,59,1,10899,4,5,97,100,101,103,115,12095,12103,12108,12126,12131,112,112,114,111,120,59,1,10885,111,116,59,1,8918,113,4,2,103,113,12115,12120,116,114,59,1,8922,103,116,114,59,1,10891,116,114,59,1,8822,105,109,59,1,8818,4,3,105,108,114,12144,12150,12156,115,104,116,59,1,10620,111,111,114,59,1,8970,59,3,55349,56617,4,2,59,69,12166,12168,1,8822,59,1,10897,4,2,97,98,12177,12198,114,4,2,100,117,12184,12187,59,1,8637,4,2,59,108,12193,12195,1,8636,59,1,10602,108,107,59,1,9604,99,121,59,1,1113,4,5,59,97,99,104,116,12220,12222,12227,12235,12241,1,8810,114,114,59,1,8647,111,114,110,101,114,59,1,8990,97,114,100,59,1,10603,114,105,59,1,9722,4,2,105,111,12252,12258,100,111,116,59,1,320,117,115,116,4,2,59,97,12267,12269,1,9136,99,104,101,59,1,9136,4,4,69,97,101,115,12285,12288,12303,12322,59,1,8808,112,4,2,59,112,12295,12297,1,10889,114,111,120,59,1,10889,4,2,59,113,12309,12311,1,10887,4,2,59,113,12317,12319,1,10887,59,1,8808,105,109,59,1,8934,4,8,97,98,110,111,112,116,119,122,12345,12359,12364,12421,12446,12467,12474,12490,4,2,110,114,12351,12355,103,59,1,10220,114,59,1,8701,114,107,59,1,10214,103,4,3,108,109,114,12373,12401,12409,101,102,116,4,2,97,114,12382,12389,114,114,111,119,59,1,10229,105,103,104,116,97,114,114,111,119,59,1,10231,97,112,115,116,111,59,1,10236,105,103,104,116,97,114,114,111,119,59,1,10230,112,97,114,114,111,119,4,2,108,114,12433,12439,101,102,116,59,1,8619,105,103,104,116,59,1,8620,4,3,97,102,108,12454,12458,12462,114,59,1,10629,59,3,55349,56669,117,115,59,1,10797,105,109,101,115,59,1,10804,4,2,97,98,12480,12485,115,116,59,1,8727,97,114,59,1,95,4,3,59,101,102,12498,12500,12506,1,9674,110,103,101,59,1,9674,59,1,10731,97,114,4,2,59,108,12517,12519,1,40,116,59,1,10643,4,5,97,99,104,109,116,12535,12540,12548,12561,12564,114,114,59,1,8646,111,114,110,101,114,59,1,8991,97,114,4,2,59,100,12556,12558,1,8651,59,1,10605,59,1,8206,114,105,59,1,8895,4,6,97,99,104,105,113,116,12583,12589,12594,12597,12614,12635,113,117,111,59,1,8249,114,59,3,55349,56513,59,1,8624,109,4,3,59,101,103,12606,12608,12611,1,8818,59,1,10893,59,1,10895,4,2,98,117,12620,12623,59,1,91,111,4,2,59,114,12630,12632,1,8216,59,1,8218,114,111,107,59,1,322,5,60,8,59,99,100,104,105,108,113,114,12660,12662,12675,12680,12686,12692,12698,12705,1,60,4,2,99,105,12668,12671,59,1,10918,114,59,1,10873,111,116,59,1,8918,114,101,101,59,1,8907,109,101,115,59,1,8905,97,114,114,59,1,10614,117,101,115,116,59,1,10875,4,2,80,105,12711,12716,97,114,59,1,10646,4,3,59,101,102,12724,12726,12729,1,9667,59,1,8884,59,1,9666,114,4,2,100,117,12739,12746,115,104,97,114,59,1,10570,104,97,114,59,1,10598,4,2,101,110,12758,12768,114,116,110,101,113,113,59,3,8808,65024,69,59,3,8808,65024,4,14,68,97,99,100,101,102,104,105,108,110,111,112,115,117,12803,12809,12893,12908,12914,12928,12933,12937,13011,13025,13032,13049,13052,13069,68,111,116,59,1,8762,4,4,99,108,112,114,12819,12827,12849,12887,114,5,175,1,59,12825,1,175,4,2,101,116,12833,12836,59,1,9794,4,2,59,101,12842,12844,1,10016,115,101,59,1,10016,4,2,59,115,12855,12857,1,8614,116,111,4,4,59,100,108,117,12869,12871,12877,12883,1,8614,111,119,110,59,1,8615,101,102,116,59,1,8612,112,59,1,8613,107,101,114,59,1,9646,4,2,111,121,12899,12905,109,109,97,59,1,10793,59,1,1084,97,115,104,59,1,8212,97,115,117,114,101,100,97,110,103,108,101,59,1,8737,114,59,3,55349,56618,111,59,1,8487,4,3,99,100,110,12945,12954,12985,114,111,5,181,1,59,12952,1,181,4,4,59,97,99,100,12964,12966,12971,12976,1,8739,115,116,59,1,42,105,114,59,1,10992,111,116,5,183,1,59,12983,1,183,117,115,4,3,59,98,100,12995,12997,13000,1,8722,59,1,8863,4,2,59,117,13006,13008,1,8760,59,1,10794,4,2,99,100,13017,13021,112,59,1,10971,114,59,1,8230,112,108,117,115,59,1,8723,4,2,100,112,13038,13044,101,108,115,59,1,8871,102,59,3,55349,56670,59,1,8723,4,2,99,116,13058,13063,114,59,3,55349,56514,112,111,115,59,1,8766,4,3,59,108,109,13077,13079,13087,1,956,116,105,109,97,112,59,1,8888,97,112,59,1,8888,4,24,71,76,82,86,97,98,99,100,101,102,103,104,105,106,108,109,111,112,114,115,116,117,118,119,13142,13165,13217,13229,13247,13330,13359,13414,13420,13508,13513,13579,13602,13626,13631,13762,13767,13855,13936,13995,14214,14285,14312,14432,4,2,103,116,13148,13152,59,3,8921,824,4,2,59,118,13158,13161,3,8811,8402,59,3,8811,824,4,3,101,108,116,13173,13200,13204,102,116,4,2,97,114,13181,13188,114,114,111,119,59,1,8653,105,103,104,116,97,114,114,111,119,59,1,8654,59,3,8920,824,4,2,59,118,13210,13213,3,8810,8402,59,3,8810,824,105,103,104,116,97,114,114,111,119,59,1,8655,4,2,68,100,13235,13241,97,115,104,59,1,8879,97,115,104,59,1,8878,4,5,98,99,110,112,116,13259,13264,13270,13275,13308,108,97,59,1,8711,117,116,101,59,1,324,103,59,3,8736,8402,4,5,59,69,105,111,112,13287,13289,13293,13298,13302,1,8777,59,3,10864,824,100,59,3,8779,824,115,59,1,329,114,111,120,59,1,8777,117,114,4,2,59,97,13316,13318,1,9838,108,4,2,59,115,13325,13327,1,9838,59,1,8469,4,2,115,117,13336,13344,112,5,160,1,59,13342,1,160,109,112,4,2,59,101,13352,13355,3,8782,824,59,3,8783,824,4,5,97,101,111,117,121,13371,13385,13391,13407,13411,4,2,112,114,13377,13380,59,1,10819,111,110,59,1,328,100,105,108,59,1,326,110,103,4,2,59,100,13399,13401,1,8775,111,116,59,3,10861,824,112,59,1,10818,59,1,1085,97,115,104,59,1,8211,4,7,59,65,97,100,113,115,120,13436,13438,13443,13466,13472,13478,13494,1,8800,114,114,59,1,8663,114,4,2,104,114,13450,13454,107,59,1,10532,4,2,59,111,13460,13462,1,8599,119,59,1,8599,111,116,59,3,8784,824,117,105,118,59,1,8802,4,2,101,105,13484,13489,97,114,59,1,10536,109,59,3,8770,824,105,115,116,4,2,59,115,13503,13505,1,8708,59,1,8708,114,59,3,55349,56619,4,4,69,101,115,116,13523,13527,13563,13568,59,3,8807,824,4,3,59,113,115,13535,13537,13559,1,8817,4,3,59,113,115,13545,13547,13551,1,8817,59,3,8807,824,108,97,110,116,59,3,10878,824,59,3,10878,824,105,109,59,1,8821,4,2,59,114,13574,13576,1,8815,59,1,8815,4,3,65,97,112,13587,13592,13597,114,114,59,1,8654,114,114,59,1,8622,97,114,59,1,10994,4,3,59,115,118,13610,13612,13623,1,8715,4,2,59,100,13618,13620,1,8956,59,1,8954,59,1,8715,99,121,59,1,1114,4,7,65,69,97,100,101,115,116,13647,13652,13656,13661,13665,13737,13742,114,114,59,1,8653,59,3,8806,824,114,114,59,1,8602,114,59,1,8229,4,4,59,102,113,115,13675,13677,13703,13725,1,8816,116,4,2,97,114,13684,13691,114,114,111,119,59,1,8602,105,103,104,116,97,114,114,111,119,59,1,8622,4,3,59,113,115,13711,13713,13717,1,8816,59,3,8806,824,108,97,110,116,59,3,10877,824,4,2,59,115,13731,13734,3,10877,824,59,1,8814,105,109,59,1,8820,4,2,59,114,13748,13750,1,8814,105,4,2,59,101,13757,13759,1,8938,59,1,8940,105,100,59,1,8740,4,2,112,116,13773,13778,102,59,3,55349,56671,5,172,3,59,105,110,13787,13789,13829,1,172,110,4,4,59,69,100,118,13800,13802,13806,13812,1,8713,59,3,8953,824,111,116,59,3,8949,824,4,3,97,98,99,13820,13823,13826,59,1,8713,59,1,8951,59,1,8950,105,4,2,59,118,13836,13838,1,8716,4,3,97,98,99,13846,13849,13852,59,1,8716,59,1,8958,59,1,8957,4,3,97,111,114,13863,13892,13899,114,4,4,59,97,115,116,13874,13876,13883,13888,1,8742,108,108,101,108,59,1,8742,108,59,3,11005,8421,59,3,8706,824,108,105,110,116,59,1,10772,4,3,59,99,101,13907,13909,13914,1,8832,117,101,59,1,8928,4,2,59,99,13920,13923,3,10927,824,4,2,59,101,13929,13931,1,8832,113,59,3,10927,824,4,4,65,97,105,116,13946,13951,13971,13982,114,114,59,1,8655,114,114,4,3,59,99,119,13961,13963,13967,1,8603,59,3,10547,824,59,3,8605,824,103,104,116,97,114,114,111,119,59,1,8603,114,105,4,2,59,101,13990,13992,1,8939,59,1,8941,4,7,99,104,105,109,112,113,117,14011,14036,14060,14080,14085,14090,14106,4,4,59,99,101,114,14021,14023,14028,14032,1,8833,117,101,59,1,8929,59,3,10928,824,59,3,55349,56515,111,114,116,4,2,109,112,14045,14050,105,100,59,1,8740,97,114,97,108,108,101,108,59,1,8742,109,4,2,59,101,14067,14069,1,8769,4,2,59,113,14075,14077,1,8772,59,1,8772,105,100,59,1,8740,97,114,59,1,8742,115,117,4,2,98,112,14098,14102,101,59,1,8930,101,59,1,8931,4,3,98,99,112,14114,14157,14171,4,4,59,69,101,115,14124,14126,14130,14133,1,8836,59,3,10949,824,59,1,8840,101,116,4,2,59,101,14141,14144,3,8834,8402,113,4,2,59,113,14151,14153,1,8840,59,3,10949,824,99,4,2,59,101,14164,14166,1,8833,113,59,3,10928,824,4,4,59,69,101,115,14181,14183,14187,14190,1,8837,59,3,10950,824,59,1,8841,101,116,4,2,59,101,14198,14201,3,8835,8402,113,4,2,59,113,14208,14210,1,8841,59,3,10950,824,4,4,103,105,108,114,14224,14228,14238,14242,108,59,1,8825,108,100,101,5,241,1,59,14236,1,241,103,59,1,8824,105,97,110,103,108,101,4,2,108,114,14254,14269,101,102,116,4,2,59,101,14263,14265,1,8938,113,59,1,8940,105,103,104,116,4,2,59,101,14279,14281,1,8939,113,59,1,8941,4,2,59,109,14291,14293,1,957,4,3,59,101,115,14301,14303,14308,1,35,114,111,59,1,8470,112,59,1,8199,4,9,68,72,97,100,103,105,108,114,115,14332,14338,14344,14349,14355,14369,14376,14408,14426,97,115,104,59,1,8877,97,114,114,59,1,10500,112,59,3,8781,8402,97,115,104,59,1,8876,4,2,101,116,14361,14365,59,3,8805,8402,59,3,62,8402,110,102,105,110,59,1,10718,4,3,65,101,116,14384,14389,14393,114,114,59,1,10498,59,3,8804,8402,4,2,59,114,14399,14402,3,60,8402,105,101,59,3,8884,8402,4,2,65,116,14414,14419,114,114,59,1,10499,114,105,101,59,3,8885,8402,105,109,59,3,8764,8402,4,3,65,97,110,14440,14445,14468,114,114,59,1,8662,114,4,2,104,114,14452,14456,107,59,1,10531,4,2,59,111,14462,14464,1,8598,119,59,1,8598,101,97,114,59,1,10535,4,18,83,97,99,100,101,102,103,104,105,108,109,111,112,114,115,116,117,118,14512,14515,14535,14560,14597,14603,14618,14643,14657,14662,14701,14741,14747,14769,14851,14877,14907,14916,59,1,9416,4,2,99,115,14521,14531,117,116,101,5,243,1,59,14529,1,243,116,59,1,8859,4,2,105,121,14541,14557,114,4,2,59,99,14548,14550,1,8858,5,244,1,59,14555,1,244,59,1,1086,4,5,97,98,105,111,115,14572,14577,14583,14587,14591,115,104,59,1,8861,108,97,99,59,1,337,118,59,1,10808,116,59,1,8857,111,108,100,59,1,10684,108,105,103,59,1,339,4,2,99,114,14609,14614,105,114,59,1,10687,59,3,55349,56620,4,3,111,114,116,14626,14630,14640,110,59,1,731,97,118,101,5,242,1,59,14638,1,242,59,1,10689,4,2,98,109,14649,14654,97,114,59,1,10677,59,1,937,110,116,59,1,8750,4,4,97,99,105,116,14672,14677,14693,14698,114,114,59,1,8634,4,2,105,114,14683,14687,114,59,1,10686,111,115,115,59,1,10683,110,101,59,1,8254,59,1,10688,4,3,97,101,105,14709,14714,14719,99,114,59,1,333,103,97,59,1,969,4,3,99,100,110,14727,14733,14736,114,111,110,59,1,959,59,1,10678,117,115,59,1,8854,112,102,59,3,55349,56672,4,3,97,101,108,14755,14759,14764,114,59,1,10679,114,112,59,1,10681,117,115,59,1,8853,4,7,59,97,100,105,111,115,118,14785,14787,14792,14831,14837,14841,14848,1,8744,114,114,59,1,8635,4,4,59,101,102,109,14802,14804,14817,14824,1,10845,114,4,2,59,111,14811,14813,1,8500,102,59,1,8500,5,170,1,59,14822,1,170,5,186,1,59,14829,1,186,103,111,102,59,1,8886,114,59,1,10838,108,111,112,101,59,1,10839,59,1,10843,4,3,99,108,111,14859,14863,14873,114,59,1,8500,97,115,104,5,248,1,59,14871,1,248,108,59,1,8856,105,4,2,108,109,14884,14893,100,101,5,245,1,59,14891,1,245,101,115,4,2,59,97,14901,14903,1,8855,115,59,1,10806,109,108,5,246,1,59,14914,1,246,98,97,114,59,1,9021,4,12,97,99,101,102,104,105,108,109,111,114,115,117,14948,14992,14996,15033,15038,15068,15090,15189,15192,15222,15427,15441,114,4,4,59,97,115,116,14959,14961,14976,14989,1,8741,5,182,2,59,108,14968,14970,1,182,108,101,108,59,1,8741,4,2,105,108,14982,14986,109,59,1,10995,59,1,11005,59,1,8706,121,59,1,1087,114,4,5,99,105,109,112,116,15009,15014,15019,15024,15027,110,116,59,1,37,111,100,59,1,46,105,108,59,1,8240,59,1,8869,101,110,107,59,1,8241,114,59,3,55349,56621,4,3,105,109,111,15046,15057,15063,4,2,59,118,15052,15054,1,966,59,1,981,109,97,116,59,1,8499,110,101,59,1,9742,4,3,59,116,118,15076,15078,15087,1,960,99,104,102,111,114,107,59,1,8916,59,1,982,4,2,97,117,15096,15119,110,4,2,99,107,15103,15115,107,4,2,59,104,15110,15112,1,8463,59,1,8462,118,59,1,8463,115,4,9,59,97,98,99,100,101,109,115,116,15140,15142,15148,15151,15156,15168,15171,15179,15184,1,43,99,105,114,59,1,10787,59,1,8862,105,114,59,1,10786,4,2,111,117,15162,15165,59,1,8724,59,1,10789,59,1,10866,110,5,177,1,59,15177,1,177,105,109,59,1,10790,119,111,59,1,10791,59,1,177,4,3,105,112,117,15200,15208,15213,110,116,105,110,116,59,1,10773,102,59,3,55349,56673,110,100,5,163,1,59,15220,1,163,4,10,59,69,97,99,101,105,110,111,115,117,15244,15246,15249,15253,15258,15334,15347,15367,15416,15421,1,8826,59,1,10931,112,59,1,10935,117,101,59,1,8828,4,2,59,99,15264,15266,1,10927,4,6,59,97,99,101,110,115,15280,15282,15290,15299,15303,15329,1,8826,112,112,114,111,120,59,1,10935,117,114,108,121,101,113,59,1,8828,113,59,1,10927,4,3,97,101,115,15311,15319,15324,112,112,114,111,120,59,1,10937,113,113,59,1,10933,105,109,59,1,8936,105,109,59,1,8830,109,101,4,2,59,115,15342,15344,1,8242,59,1,8473,4,3,69,97,115,15355,15358,15362,59,1,10933,112,59,1,10937,105,109,59,1,8936,4,3,100,102,112,15375,15378,15404,59,1,8719,4,3,97,108,115,15386,15392,15398,108,97,114,59,1,9006,105,110,101,59,1,8978,117,114,102,59,1,8979,4,2,59,116,15410,15412,1,8733,111,59,1,8733,105,109,59,1,8830,114,101,108,59,1,8880,4,2,99,105,15433,15438,114,59,3,55349,56517,59,1,968,110,99,115,112,59,1,8200,4,6,102,105,111,112,115,117,15462,15467,15472,15478,15485,15491,114,59,3,55349,56622,110,116,59,1,10764,112,102,59,3,55349,56674,114,105,109,101,59,1,8279,99,114,59,3,55349,56518,4,3,97,101,111,15499,15520,15534,116,4,2,101,105,15506,15515,114,110,105,111,110,115,59,1,8461,110,116,59,1,10774,115,116,4,2,59,101,15528,15530,1,63,113,59,1,8799,116,5,34,1,59,15540,1,34,4,21,65,66,72,97,98,99,100,101,102,104,105,108,109,110,111,112,114,115,116,117,120,15586,15609,15615,15620,15796,15855,15893,15931,15977,16001,16039,16183,16204,16222,16228,16285,16312,16318,16363,16408,16416,4,3,97,114,116,15594,15599,15603,114,114,59,1,8667,114,59,1,8658,97,105,108,59,1,10524,97,114,114,59,1,10511,97,114,59,1,10596,4,7,99,100,101,110,113,114,116,15636,15651,15656,15664,15687,15696,15770,4,2,101,117,15642,15646,59,3,8765,817,116,101,59,1,341,105,99,59,1,8730,109,112,116,121,118,59,1,10675,103,4,4,59,100,101,108,15675,15677,15680,15683,1,10217,59,1,10642,59,1,10661,101,59,1,10217,117,111,5,187,1,59,15694,1,187,114,4,11,59,97,98,99,102,104,108,112,115,116,119,15721,15723,15727,15739,15742,15746,15750,15754,15758,15763,15767,1,8594,112,59,1,10613,4,2,59,102,15733,15735,1,8677,115,59,1,10528,59,1,10547,115,59,1,10526,107,59,1,8618,112,59,1,8620,108,59,1,10565,105,109,59,1,10612,108,59,1,8611,59,1,8605,4,2,97,105,15776,15781,105,108,59,1,10522,111,4,2,59,110,15788,15790,1,8758,97,108,115,59,1,8474,4,3,97,98,114,15804,15809,15814,114,114,59,1,10509,114,107,59,1,10099,4,2,97,107,15820,15833,99,4,2,101,107,15827,15830,59,1,125,59,1,93,4,2,101,115,15839,15842,59,1,10636,108,4,2,100,117,15849,15852,59,1,10638,59,1,10640,4,4,97,101,117,121,15865,15871,15886,15890,114,111,110,59,1,345,4,2,100,105,15877,15882,105,108,59,1,343,108,59,1,8969,98,59,1,125,59,1,1088,4,4,99,108,113,115,15903,15907,15914,15927,97,59,1,10551,100,104,97,114,59,1,10601,117,111,4,2,59,114,15922,15924,1,8221,59,1,8221,104,59,1,8627,4,3,97,99,103,15939,15966,15970,108,4,4,59,105,112,115,15950,15952,15957,15963,1,8476,110,101,59,1,8475,97,114,116,59,1,8476,59,1,8477,116,59,1,9645,5,174,1,59,15975,1,174,4,3,105,108,114,15985,15991,15997,115,104,116,59,1,10621,111,111,114,59,1,8971,59,3,55349,56623,4,2,97,111,16007,16028,114,4,2,100,117,16014,16017,59,1,8641,4,2,59,108,16023,16025,1,8640,59,1,10604,4,2,59,118,16034,16036,1,961,59,1,1009,4,3,103,110,115,16047,16167,16171,104,116,4,6,97,104,108,114,115,116,16063,16081,16103,16130,16143,16155,114,114,111,119,4,2,59,116,16073,16075,1,8594,97,105,108,59,1,8611,97,114,112,111,111,110,4,2,100,117,16093,16099,111,119,110,59,1,8641,112,59,1,8640,101,102,116,4,2,97,104,16112,16120,114,114,111,119,115,59,1,8644,97,114,112,111,111,110,115,59,1,8652,105,103,104,116,97,114,114,111,119,115,59,1,8649,113,117,105,103,97,114,114,111,119,59,1,8605,104,114,101,101,116,105,109,101,115,59,1,8908,103,59,1,730,105,110,103,100,111,116,115,101,113,59,1,8787,4,3,97,104,109,16191,16196,16201,114,114,59,1,8644,97,114,59,1,8652,59,1,8207,111,117,115,116,4,2,59,97,16214,16216,1,9137,99,104,101,59,1,9137,109,105,100,59,1,10990,4,4,97,98,112,116,16238,16252,16257,16278,4,2,110,114,16244,16248,103,59,1,10221,114,59,1,8702,114,107,59,1,10215,4,3,97,102,108,16265,16269,16273,114,59,1,10630,59,3,55349,56675,117,115,59,1,10798,105,109,101,115,59,1,10805,4,2,97,112,16291,16304,114,4,2,59,103,16298,16300,1,41,116,59,1,10644,111,108,105,110,116,59,1,10770,97,114,114,59,1,8649,4,4,97,99,104,113,16328,16334,16339,16342,113,117,111,59,1,8250,114,59,3,55349,56519,59,1,8625,4,2,98,117,16348,16351,59,1,93,111,4,2,59,114,16358,16360,1,8217,59,1,8217,4,3,104,105,114,16371,16377,16383,114,101,101,59,1,8908,109,101,115,59,1,8906,105,4,4,59,101,102,108,16394,16396,16399,16402,1,9657,59,1,8885,59,1,9656,116,114,105,59,1,10702,108,117,104,97,114,59,1,10600,59,1,8478,4,19,97,98,99,100,101,102,104,105,108,109,111,112,113,114,115,116,117,119,122,16459,16466,16472,16572,16590,16672,16687,16746,16844,16850,16924,16963,16988,17115,17121,17154,17206,17614,17656,99,117,116,101,59,1,347,113,117,111,59,1,8218,4,10,59,69,97,99,101,105,110,112,115,121,16494,16496,16499,16513,16518,16531,16536,16556,16564,16569,1,8827,59,1,10932,4,2,112,114,16505,16508,59,1,10936,111,110,59,1,353,117,101,59,1,8829,4,2,59,100,16524,16526,1,10928,105,108,59,1,351,114,99,59,1,349,4,3,69,97,115,16544,16547,16551,59,1,10934,112,59,1,10938,105,109,59,1,8937,111,108,105,110,116,59,1,10771,105,109,59,1,8831,59,1,1089,111,116,4,3,59,98,101,16582,16584,16587,1,8901,59,1,8865,59,1,10854,4,7,65,97,99,109,115,116,120,16606,16611,16634,16642,16646,16652,16668,114,114,59,1,8664,114,4,2,104,114,16618,16622,107,59,1,10533,4,2,59,111,16628,16630,1,8600,119,59,1,8600,116,5,167,1,59,16640,1,167,105,59,1,59,119,97,114,59,1,10537,109,4,2,105,110,16659,16665,110,117,115,59,1,8726,59,1,8726,116,59,1,10038,114,4,2,59,111,16679,16682,3,55349,56624,119,110,59,1,8994,4,4,97,99,111,121,16697,16702,16716,16739,114,112,59,1,9839,4,2,104,121,16708,16713,99,121,59,1,1097,59,1,1096,114,116,4,2,109,112,16724,16729,105,100,59,1,8739,97,114,97,108,108,101,108,59,1,8741,5,173,1,59,16744,1,173,4,2,103,109,16752,16770,109,97,4,3,59,102,118,16762,16764,16767,1,963,59,1,962,59,1,962,4,8,59,100,101,103,108,110,112,114,16788,16790,16795,16806,16817,16828,16832,16838,1,8764,111,116,59,1,10858,4,2,59,113,16801,16803,1,8771,59,1,8771,4,2,59,69,16812,16814,1,10910,59,1,10912,4,2,59,69,16823,16825,1,10909,59,1,10911,101,59,1,8774,108,117,115,59,1,10788,97,114,114,59,1,10610,97,114,114,59,1,8592,4,4,97,101,105,116,16860,16883,16891,16904,4,2,108,115,16866,16878,108,115,101,116,109,105,110,117,115,59,1,8726,104,112,59,1,10803,112,97,114,115,108,59,1,10724,4,2,100,108,16897,16900,59,1,8739,101,59,1,8995,4,2,59,101,16910,16912,1,10922,4,2,59,115,16918,16920,1,10924,59,3,10924,65024,4,3,102,108,112,16932,16938,16958,116,99,121,59,1,1100,4,2,59,98,16944,16946,1,47,4,2,59,97,16952,16954,1,10692,114,59,1,9023,102,59,3,55349,56676,97,4,2,100,114,16970,16985,101,115,4,2,59,117,16978,16980,1,9824,105,116,59,1,9824,59,1,8741,4,3,99,115,117,16996,17028,17089,4,2,97,117,17002,17015,112,4,2,59,115,17009,17011,1,8851,59,3,8851,65024,112,4,2,59,115,17022,17024,1,8852,59,3,8852,65024,117,4,2,98,112,17035,17062,4,3,59,101,115,17043,17045,17048,1,8847,59,1,8849,101,116,4,2,59,101,17056,17058,1,8847,113,59,1,8849,4,3,59,101,115,17070,17072,17075,1,8848,59,1,8850,101,116,4,2,59,101,17083,17085,1,8848,113,59,1,8850,4,3,59,97,102,17097,17099,17112,1,9633,114,4,2,101,102,17106,17109,59,1,9633,59,1,9642,59,1,9642,97,114,114,59,1,8594,4,4,99,101,109,116,17131,17136,17142,17148,114,59,3,55349,56520,116,109,110,59,1,8726,105,108,101,59,1,8995,97,114,102,59,1,8902,4,2,97,114,17160,17172,114,4,2,59,102,17167,17169,1,9734,59,1,9733,4,2,97,110,17178,17202,105,103,104,116,4,2,101,112,17188,17197,112,115,105,108,111,110,59,1,1013,104,105,59,1,981,115,59,1,175,4,5,98,99,109,110,112,17218,17351,17420,17423,17427,4,9,59,69,100,101,109,110,112,114,115,17238,17240,17243,17248,17261,17267,17279,17285,17291,1,8834,59,1,10949,111,116,59,1,10941,4,2,59,100,17254,17256,1,8838,111,116,59,1,10947,117,108,116,59,1,10945,4,2,69,101,17273,17276,59,1,10955,59,1,8842,108,117,115,59,1,10943,97,114,114,59,1,10617,4,3,101,105,117,17299,17335,17339,116,4,3,59,101,110,17308,17310,17322,1,8834,113,4,2,59,113,17317,17319,1,8838,59,1,10949,101,113,4,2,59,113,17330,17332,1,8842,59,1,10955,109,59,1,10951,4,2,98,112,17345,17348,59,1,10965,59,1,10963,99,4,6,59,97,99,101,110,115,17366,17368,17376,17385,17389,17415,1,8827,112,112,114,111,120,59,1,10936,117,114,108,121,101,113,59,1,8829,113,59,1,10928,4,3,97,101,115,17397,17405,17410,112,112,114,111,120,59,1,10938,113,113,59,1,10934,105,109,59,1,8937,105,109,59,1,8831,59,1,8721,103,59,1,9834,4,13,49,50,51,59,69,100,101,104,108,109,110,112,115,17455,17462,17469,17476,17478,17481,17496,17509,17524,17530,17536,17548,17554,5,185,1,59,17460,1,185,5,178,1,59,17467,1,178,5,179,1,59,17474,1,179,1,8835,59,1,10950,4,2,111,115,17487,17491,116,59,1,10942,117,98,59,1,10968,4,2,59,100,17502,17504,1,8839,111,116,59,1,10948,115,4,2,111,117,17516,17520,108,59,1,10185,98,59,1,10967,97,114,114,59,1,10619,117,108,116,59,1,10946,4,2,69,101,17542,17545,59,1,10956,59,1,8843,108,117,115,59,1,10944,4,3,101,105,117,17562,17598,17602,116,4,3,59,101,110,17571,17573,17585,1,8835,113,4,2,59,113,17580,17582,1,8839,59,1,10950,101,113,4,2,59,113,17593,17595,1,8843,59,1,10956,109,59,1,10952,4,2,98,112,17608,17611,59,1,10964,59,1,10966,4,3,65,97,110,17622,17627,17650,114,114,59,1,8665,114,4,2,104,114,17634,17638,107,59,1,10534,4,2,59,111,17644,17646,1,8601,119,59,1,8601,119,97,114,59,1,10538,108,105,103,5,223,1,59,17664,1,223,4,13,97,98,99,100,101,102,104,105,111,112,114,115,119,17694,17709,17714,17737,17742,17749,17754,17860,17905,17957,17964,18090,18122,4,2,114,117,17700,17706,103,101,116,59,1,8982,59,1,964,114,107,59,1,9140,4,3,97,101,121,17722,17728,17734,114,111,110,59,1,357,100,105,108,59,1,355,59,1,1090,111,116,59,1,8411,108,114,101,99,59,1,8981,114,59,3,55349,56625,4,4,101,105,107,111,17764,17805,17836,17851,4,2,114,116,17770,17786,101,4,2,52,102,17777,17780,59,1,8756,111,114,101,59,1,8756,97,4,3,59,115,118,17795,17797,17802,1,952,121,109,59,1,977,59,1,977,4,2,99,110,17811,17831,107,4,2,97,115,17818,17826,112,112,114,111,120,59,1,8776,105,109,59,1,8764,115,112,59,1,8201,4,2,97,115,17842,17846,112,59,1,8776,105,109,59,1,8764,114,110,5,254,1,59,17858,1,254,4,3,108,109,110,17868,17873,17901,100,101,59,1,732,101,115,5,215,3,59,98,100,17884,17886,17898,1,215,4,2,59,97,17892,17894,1,8864,114,59,1,10801,59,1,10800,116,59,1,8749,4,3,101,112,115,17913,17917,17953,97,59,1,10536,4,4,59,98,99,102,17927,17929,17934,17939,1,8868,111,116,59,1,9014,105,114,59,1,10993,4,2,59,111,17945,17948,3,55349,56677,114,107,59,1,10970,97,59,1,10537,114,105,109,101,59,1,8244,4,3,97,105,112,17972,17977,18082,100,101,59,1,8482,4,7,97,100,101,109,112,115,116,17993,18051,18056,18059,18066,18072,18076,110,103,108,101,4,5,59,100,108,113,114,18009,18011,18017,18032,18035,1,9653,111,119,110,59,1,9663,101,102,116,4,2,59,101,18026,18028,1,9667,113,59,1,8884,59,1,8796,105,103,104,116,4,2,59,101,18045,18047,1,9657,113,59,1,8885,111,116,59,1,9708,59,1,8796,105,110,117,115,59,1,10810,108,117,115,59,1,10809,98,59,1,10701,105,109,101,59,1,10811,101,122,105,117,109,59,1,9186,4,3,99,104,116,18098,18111,18116,4,2,114,121,18104,18108,59,3,55349,56521,59,1,1094,99,121,59,1,1115,114,111,107,59,1,359,4,2,105,111,18128,18133,120,116,59,1,8812,104,101,97,100,4,2,108,114,18143,18154,101,102,116,97,114,114,111,119,59,1,8606,105,103,104,116,97,114,114,111,119,59,1,8608,4,18,65,72,97,98,99,100,102,103,104,108,109,111,112,114,115,116,117,119,18204,18209,18214,18234,18250,18268,18292,18308,18319,18343,18379,18397,18413,18504,18547,18553,18584,18603,114,114,59,1,8657,97,114,59,1,10595,4,2,99,114,18220,18230,117,116,101,5,250,1,59,18228,1,250,114,59,1,8593,114,4,2,99,101,18241,18245,121,59,1,1118,118,101,59,1,365,4,2,105,121,18256,18265,114,99,5,251,1,59,18263,1,251,59,1,1091,4,3,97,98,104,18276,18281,18287,114,114,59,1,8645,108,97,99,59,1,369,97,114,59,1,10606,4,2,105,114,18298,18304,115,104,116,59,1,10622,59,3,55349,56626,114,97,118,101,5,249,1,59,18317,1,249,4,2,97,98,18325,18338,114,4,2,108,114,18332,18335,59,1,8639,59,1,8638,108,107,59,1,9600,4,2,99,116,18349,18374,4,2,111,114,18355,18369,114,110,4,2,59,101,18363,18365,1,8988,114,59,1,8988,111,112,59,1,8975,114,105,59,1,9720,4,2,97,108,18385,18390,99,114,59,1,363,5,168,1,59,18395,1,168,4,2,103,112,18403,18408,111,110,59,1,371,102,59,3,55349,56678,4,6,97,100,104,108,115,117,18427,18434,18445,18470,18475,18494,114,114,111,119,59,1,8593,111,119,110,97,114,114,111,119,59,1,8597,97,114,112,111,111,110,4,2,108,114,18457,18463,101,102,116,59,1,8639,105,103,104,116,59,1,8638,117,115,59,1,8846,105,4,3,59,104,108,18484,18486,18489,1,965,59,1,978,111,110,59,1,965,112,97,114,114,111,119,115,59,1,8648,4,3,99,105,116,18512,18537,18542,4,2,111,114,18518,18532,114,110,4,2,59,101,18526,18528,1,8989,114,59,1,8989,111,112,59,1,8974,110,103,59,1,367,114,105,59,1,9721,99,114,59,3,55349,56522,4,3,100,105,114,18561,18566,18572,111,116,59,1,8944,108,100,101,59,1,361,105,4,2,59,102,18579,18581,1,9653,59,1,9652,4,2,97,109,18590,18595,114,114,59,1,8648,108,5,252,1,59,18601,1,252,97,110,103,108,101,59,1,10663,4,15,65,66,68,97,99,100,101,102,108,110,111,112,114,115,122,18643,18648,18661,18667,18847,18851,18857,18904,18909,18915,18931,18937,18943,18949,18996,114,114,59,1,8661,97,114,4,2,59,118,18656,18658,1,10984,59,1,10985,97,115,104,59,1,8872,4,2,110,114,18673,18679,103,114,116,59,1,10652,4,7,101,107,110,112,114,115,116,18695,18704,18711,18720,18742,18754,18810,112,115,105,108,111,110,59,1,1013,97,112,112,97,59,1,1008,111,116,104,105,110,103,59,1,8709,4,3,104,105,114,18728,18732,18735,105,59,1,981,59,1,982,111,112,116,111,59,1,8733,4,2,59,104,18748,18750,1,8597,111,59,1,1009,4,2,105,117,18760,18766,103,109,97,59,1,962,4,2,98,112,18772,18791,115,101,116,110,101,113,4,2,59,113,18784,18787,3,8842,65024,59,3,10955,65024,115,101,116,110,101,113,4,2,59,113,18803,18806,3,8843,65024,59,3,10956,65024,4,2,104,114,18816,18822,101,116,97,59,1,977,105,97,110,103,108,101,4,2,108,114,18834,18840,101,102,116,59,1,8882,105,103,104,116,59,1,8883,121,59,1,1074,97,115,104,59,1,8866,4,3,101,108,114,18865,18884,18890,4,3,59,98,101,18873,18875,18880,1,8744,97,114,59,1,8891,113,59,1,8794,108,105,112,59,1,8942,4,2,98,116,18896,18901,97,114,59,1,124,59,1,124,114,59,3,55349,56627,116,114,105,59,1,8882,115,117,4,2,98,112,18923,18927,59,3,8834,8402,59,3,8835,8402,112,102,59,3,55349,56679,114,111,112,59,1,8733,116,114,105,59,1,8883,4,2,99,117,18955,18960,114,59,3,55349,56523,4,2,98,112,18966,18981,110,4,2,69,101,18973,18977,59,3,10955,65024,59,3,8842,65024,110,4,2,69,101,18988,18992,59,3,10956,65024,59,3,8843,65024,105,103,122,97,103,59,1,10650,4,7,99,101,102,111,112,114,115,19020,19026,19061,19066,19072,19075,19089,105,114,99,59,1,373,4,2,100,105,19032,19055,4,2,98,103,19038,19043,97,114,59,1,10847,101,4,2,59,113,19050,19052,1,8743,59,1,8793,101,114,112,59,1,8472,114,59,3,55349,56628,112,102,59,3,55349,56680,59,1,8472,4,2,59,101,19081,19083,1,8768,97,116,104,59,1,8768,99,114,59,3,55349,56524,4,14,99,100,102,104,105,108,109,110,111,114,115,117,118,119,19125,19146,19152,19157,19173,19176,19192,19197,19202,19236,19252,19269,19286,19291,4,3,97,105,117,19133,19137,19142,112,59,1,8898,114,99,59,1,9711,112,59,1,8899,116,114,105,59,1,9661,114,59,3,55349,56629,4,2,65,97,19163,19168,114,114,59,1,10234,114,114,59,1,10231,59,1,958,4,2,65,97,19182,19187,114,114,59,1,10232,114,114,59,1,10229,97,112,59,1,10236,105,115,59,1,8955,4,3,100,112,116,19210,19215,19230,111,116,59,1,10752,4,2,102,108,19221,19225,59,3,55349,56681,117,115,59,1,10753,105,109,101,59,1,10754,4,2,65,97,19242,19247,114,114,59,1,10233,114,114,59,1,10230,4,2,99,113,19258,19263,114,59,3,55349,56525,99,117,112,59,1,10758,4,2,112,116,19275,19281,108,117,115,59,1,10756,114,105,59,1,9651,101,101,59,1,8897,101,100,103,101,59,1,8896,4,8,97,99,101,102,105,111,115,117,19316,19335,19349,19357,19362,19367,19373,19379,99,4,2,117,121,19323,19332,116,101,5,253,1,59,19330,1,253,59,1,1103,4,2,105,121,19341,19346,114,99,59,1,375,59,1,1099,110,5,165,1,59,19355,1,165,114,59,3,55349,56630,99,121,59,1,1111,112,102,59,3,55349,56682,99,114,59,3,55349,56526,4,2,99,109,19385,19389,121,59,1,1102,108,5,255,1,59,19395,1,255,4,10,97,99,100,101,102,104,105,111,115,119,19419,19426,19441,19446,19462,19467,19472,19480,19486,19492,99,117,116,101,59,1,378,4,2,97,121,19432,19438,114,111,110,59,1,382,59,1,1079,111,116,59,1,380,4,2,101,116,19452,19458,116,114,102,59,1,8488,97,59,1,950,114,59,3,55349,56631,99,121,59,1,1078,103,114,97,114,114,59,1,8669,112,102,59,3,55349,56683,99,114,59,3,55349,56527,4,2,106,110,19498,19501,59,1,8205,106,59,1,8204]); - -/***/ }), -/* 119 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -var UNICODE = __webpack_require__(18); - -//Aliases -var $ = UNICODE.CODE_POINTS; - -//Utils - -//OPTIMIZATION: these utility functions should not be moved out of this module. V8 Crankshaft will not inline -//this functions if they will be situated in another module due to context switch. -//Always perform inlining check before modifying this functions ('node --trace-inlining'). -function isSurrogatePair(cp1, cp2) { - return cp1 >= 0xD800 && cp1 <= 0xDBFF && cp2 >= 0xDC00 && cp2 <= 0xDFFF; -} - -function getSurrogatePairCodePoint(cp1, cp2) { - return (cp1 - 0xD800) * 0x400 + 0x2400 + cp2; -} - - -//Const -var DEFAULT_BUFFER_WATERLINE = 1 << 16; - - -//Preprocessor -//NOTE: HTML input preprocessing -//(see: http://www.whatwg.org/specs/web-apps/current-work/multipage/parsing.html#preprocessing-the-input-stream) -var Preprocessor = module.exports = function () { - this.html = null; - - this.pos = -1; - this.lastGapPos = -1; - this.lastCharPos = -1; - this.droppedBufferSize = 0; - - this.gapStack = []; - - this.skipNextNewLine = false; - - this.lastChunkWritten = false; - this.endOfChunkHit = false; - this.bufferWaterline = DEFAULT_BUFFER_WATERLINE; -}; - -Object.defineProperty(Preprocessor.prototype, 'sourcePos', { - get: function () { - return this.droppedBufferSize + this.pos; - } -}); - -Preprocessor.prototype.dropParsedChunk = function () { - if (this.pos > this.bufferWaterline) { - this.lastCharPos -= this.pos; - this.droppedBufferSize += this.pos; - this.html = this.html.substring(this.pos); - this.pos = 0; - this.lastGapPos = -1; - this.gapStack = []; - } -}; - -Preprocessor.prototype._addGap = function () { - this.gapStack.push(this.lastGapPos); - this.lastGapPos = this.pos; -}; - -Preprocessor.prototype._processHighRangeCodePoint = function (cp) { - //NOTE: try to peek a surrogate pair - if (this.pos !== this.lastCharPos) { - var nextCp = this.html.charCodeAt(this.pos + 1); - - if (isSurrogatePair(cp, nextCp)) { - //NOTE: we have a surrogate pair. Peek pair character and recalculate code point. - this.pos++; - cp = getSurrogatePairCodePoint(cp, nextCp); - - //NOTE: add gap that should be avoided during retreat - this._addGap(); - } - } - - // NOTE: we've hit the end of chunk, stop processing at this point - else if (!this.lastChunkWritten) { - this.endOfChunkHit = true; - return $.EOF; - } - - return cp; -}; - -Preprocessor.prototype.write = function (chunk, isLastChunk) { - if (this.html) - this.html += chunk; - - else - this.html = chunk; - - this.lastCharPos = this.html.length - 1; - this.endOfChunkHit = false; - this.lastChunkWritten = isLastChunk; -}; - -Preprocessor.prototype.insertHtmlAtCurrentPos = function (chunk) { - this.html = this.html.substring(0, this.pos + 1) + - chunk + - this.html.substring(this.pos + 1, this.html.length); - - this.lastCharPos = this.html.length - 1; - this.endOfChunkHit = false; -}; - - -Preprocessor.prototype.advance = function () { - this.pos++; - - if (this.pos > this.lastCharPos) { - if (!this.lastChunkWritten) - this.endOfChunkHit = true; - - return $.EOF; - } - - var cp = this.html.charCodeAt(this.pos); - - //NOTE: any U+000A LINE FEED (LF) characters that immediately follow a U+000D CARRIAGE RETURN (CR) character - //must be ignored. - if (this.skipNextNewLine && cp === $.LINE_FEED) { - this.skipNextNewLine = false; - this._addGap(); - return this.advance(); - } - - //NOTE: all U+000D CARRIAGE RETURN (CR) characters must be converted to U+000A LINE FEED (LF) characters - if (cp === $.CARRIAGE_RETURN) { - this.skipNextNewLine = true; - return $.LINE_FEED; - } - - this.skipNextNewLine = false; - - //OPTIMIZATION: first perform check if the code point in the allowed range that covers most common - //HTML input (e.g. ASCII codes) to avoid performance-cost operations for high-range code points. - return cp >= 0xD800 ? this._processHighRangeCodePoint(cp) : cp; -}; - -Preprocessor.prototype.retreat = function () { - if (this.pos === this.lastGapPos) { - this.lastGapPos = this.gapStack.pop(); - this.pos--; - } - - this.pos--; -}; - - - -/***/ }), -/* 120 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -var doctype = __webpack_require__(33), - DOCUMENT_MODE = __webpack_require__(11).DOCUMENT_MODE; - - -//Conversion tables for DOM Level1 structure emulation -var nodeTypes = { - element: 1, - text: 3, - cdata: 4, - comment: 8 -}; - -var nodePropertyShorthands = { - tagName: 'name', - childNodes: 'children', - parentNode: 'parent', - previousSibling: 'prev', - nextSibling: 'next', - nodeValue: 'data' -}; - -//Node -var Node = function (props) { - for (var key in props) { - if (props.hasOwnProperty(key)) - this[key] = props[key]; - } -}; - -Node.prototype = { - get firstChild() { - var children = this.children; - - return children && children[0] || null; - }, - - get lastChild() { - var children = this.children; - - return children && children[children.length - 1] || null; - }, - - get nodeType() { - return nodeTypes[this.type] || nodeTypes.element; - } -}; - -Object.keys(nodePropertyShorthands).forEach(function (key) { - var shorthand = nodePropertyShorthands[key]; - - Object.defineProperty(Node.prototype, key, { - get: function () { - return this[shorthand] || null; - }, - set: function (val) { - this[shorthand] = val; - return val; - } - }); -}); - - -//Node construction -exports.createDocument = function () { - return new Node({ - type: 'root', - name: 'root', - parent: null, - prev: null, - next: null, - children: [], - 'x-mode': DOCUMENT_MODE.NO_QUIRKS - }); -}; - -exports.createDocumentFragment = function () { - return new Node({ - type: 'root', - name: 'root', - parent: null, - prev: null, - next: null, - children: [] - }); -}; - -exports.createElement = function (tagName, namespaceURI, attrs) { - var attribs = Object.create(null), - attribsNamespace = Object.create(null), - attribsPrefix = Object.create(null); - - for (var i = 0; i < attrs.length; i++) { - var attrName = attrs[i].name; - - attribs[attrName] = attrs[i].value; - attribsNamespace[attrName] = attrs[i].namespace; - attribsPrefix[attrName] = attrs[i].prefix; - } - - return new Node({ - type: tagName === 'script' || tagName === 'style' ? tagName : 'tag', - name: tagName, - namespace: namespaceURI, - attribs: attribs, - 'x-attribsNamespace': attribsNamespace, - 'x-attribsPrefix': attribsPrefix, - children: [], - parent: null, - prev: null, - next: null - }); -}; - -exports.createCommentNode = function (data) { - return new Node({ - type: 'comment', - data: data, - parent: null, - prev: null, - next: null - }); -}; - -var createTextNode = function (value) { - return new Node({ - type: 'text', - data: value, - parent: null, - prev: null, - next: null - }); -}; - - -//Tree mutation -var appendChild = exports.appendChild = function (parentNode, newNode) { - var prev = parentNode.children[parentNode.children.length - 1]; - - if (prev) { - prev.next = newNode; - newNode.prev = prev; - } - - parentNode.children.push(newNode); - newNode.parent = parentNode; -}; - -var insertBefore = exports.insertBefore = function (parentNode, newNode, referenceNode) { - var insertionIdx = parentNode.children.indexOf(referenceNode), - prev = referenceNode.prev; - - if (prev) { - prev.next = newNode; - newNode.prev = prev; - } - - referenceNode.prev = newNode; - newNode.next = referenceNode; - - parentNode.children.splice(insertionIdx, 0, newNode); - newNode.parent = parentNode; -}; - -exports.setTemplateContent = function (templateElement, contentElement) { - appendChild(templateElement, contentElement); -}; - -exports.getTemplateContent = function (templateElement) { - return templateElement.children[0]; -}; - -exports.setDocumentType = function (document, name, publicId, systemId) { - var data = doctype.serializeContent(name, publicId, systemId), - doctypeNode = null; - - for (var i = 0; i < document.children.length; i++) { - if (document.children[i].type === 'directive' && document.children[i].name === '!doctype') { - doctypeNode = document.children[i]; - break; - } - } - - if (doctypeNode) { - doctypeNode.data = data; - doctypeNode['x-name'] = name; - doctypeNode['x-publicId'] = publicId; - doctypeNode['x-systemId'] = systemId; - } - - else { - appendChild(document, new Node({ - type: 'directive', - name: '!doctype', - data: data, - 'x-name': name, - 'x-publicId': publicId, - 'x-systemId': systemId - })); - } - -}; - -exports.setDocumentMode = function (document, mode) { - document['x-mode'] = mode; -}; - -exports.getDocumentMode = function (document) { - return document['x-mode']; -}; - -exports.detachNode = function (node) { - if (node.parent) { - var idx = node.parent.children.indexOf(node), - prev = node.prev, - next = node.next; - - node.prev = null; - node.next = null; - - if (prev) - prev.next = next; - - if (next) - next.prev = prev; - - node.parent.children.splice(idx, 1); - node.parent = null; - } -}; - -exports.insertText = function (parentNode, text) { - var lastChild = parentNode.children[parentNode.children.length - 1]; - - if (lastChild && lastChild.type === 'text') - lastChild.data += text; - else - appendChild(parentNode, createTextNode(text)); -}; - -exports.insertTextBefore = function (parentNode, text, referenceNode) { - var prevNode = parentNode.children[parentNode.children.indexOf(referenceNode) - 1]; - - if (prevNode && prevNode.type === 'text') - prevNode.data += text; - else - insertBefore(parentNode, createTextNode(text), referenceNode); -}; - -exports.adoptAttributes = function (recipient, attrs) { - for (var i = 0; i < attrs.length; i++) { - var attrName = attrs[i].name; - - if (typeof recipient.attribs[attrName] === 'undefined') { - recipient.attribs[attrName] = attrs[i].value; - recipient['x-attribsNamespace'][attrName] = attrs[i].namespace; - recipient['x-attribsPrefix'][attrName] = attrs[i].prefix; - } - } -}; - - -//Tree traversing -exports.getFirstChild = function (node) { - return node.children[0]; -}; - -exports.getChildNodes = function (node) { - return node.children; -}; - -exports.getParentNode = function (node) { - return node.parent; -}; - -exports.getAttrList = function (element) { - var attrList = []; - - for (var name in element.attribs) { - attrList.push({ - name: name, - value: element.attribs[name], - namespace: element['x-attribsNamespace'][name], - prefix: element['x-attribsPrefix'][name] - }); - } - - return attrList; -}; - - -//Node data -exports.getTagName = function (element) { - return element.name; -}; - -exports.getNamespaceURI = function (element) { - return element.namespace; -}; - -exports.getTextNodeContent = function (textNode) { - return textNode.data; -}; - -exports.getCommentNodeContent = function (commentNode) { - return commentNode.data; -}; - -exports.getDocumentTypeNodeName = function (doctypeNode) { - return doctypeNode['x-name']; -}; - -exports.getDocumentTypeNodePublicId = function (doctypeNode) { - return doctypeNode['x-publicId']; -}; - -exports.getDocumentTypeNodeSystemId = function (doctypeNode) { - return doctypeNode['x-systemId']; -}; - - -//Node types -exports.isTextNode = function (node) { - return node.type === 'text'; -}; - -exports.isCommentNode = function (node) { - return node.type === 'comment'; -}; - -exports.isDocumentTypeNode = function (node) { - return node.type === 'directive' && node.name === '!doctype'; -}; - -exports.isElementNode = function (node) { - return !!node.attribs; -}; - - -/***/ }), -/* 121 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -/* tslint:disable:no-unused-variable */ -// Subject imported before Observable to bypass circular dependency issue since -// Subject extends Observable and Observable references Subject in it's -// definition -var Subject_1 = __webpack_require__(6); -exports.Subject = Subject_1.Subject; -exports.AnonymousSubject = Subject_1.AnonymousSubject; -/* tslint:enable:no-unused-variable */ -var Observable_1 = __webpack_require__(0); -exports.Observable = Observable_1.Observable; -// statics -/* tslint:disable:no-use-before-declare */ -__webpack_require__(123); -__webpack_require__(124); -__webpack_require__(125); -__webpack_require__(126); -__webpack_require__(127); -__webpack_require__(130); -__webpack_require__(131); -__webpack_require__(132); -__webpack_require__(133); -__webpack_require__(134); -__webpack_require__(135); -__webpack_require__(136); -__webpack_require__(137); -__webpack_require__(54); -__webpack_require__(138); -__webpack_require__(143); -__webpack_require__(139); -__webpack_require__(140); -__webpack_require__(141); -__webpack_require__(142); -__webpack_require__(144); -__webpack_require__(145); -__webpack_require__(55); -__webpack_require__(56); -__webpack_require__(146); -//dom -__webpack_require__(128); -__webpack_require__(129); -//operators -__webpack_require__(149); -__webpack_require__(150); -__webpack_require__(151); -__webpack_require__(152); -__webpack_require__(153); -__webpack_require__(57); -__webpack_require__(154); -__webpack_require__(155); -__webpack_require__(156); -__webpack_require__(157); -__webpack_require__(158); -__webpack_require__(159); -__webpack_require__(160); -__webpack_require__(166); -__webpack_require__(161); -__webpack_require__(162); -__webpack_require__(163); -__webpack_require__(164); -__webpack_require__(165); -__webpack_require__(167); -__webpack_require__(168); -__webpack_require__(169); -__webpack_require__(170); -__webpack_require__(173); -__webpack_require__(174); -__webpack_require__(175); -__webpack_require__(171); -__webpack_require__(176); -__webpack_require__(177); -__webpack_require__(178); -__webpack_require__(179); -__webpack_require__(45); -__webpack_require__(180); -__webpack_require__(181); -__webpack_require__(182); -__webpack_require__(147); -__webpack_require__(148); -__webpack_require__(183); -__webpack_require__(184); -__webpack_require__(172); -__webpack_require__(58); -__webpack_require__(185); -__webpack_require__(186); -__webpack_require__(187); -__webpack_require__(188); -__webpack_require__(189); -__webpack_require__(190); -__webpack_require__(191); -__webpack_require__(192); -__webpack_require__(193); -__webpack_require__(194); -__webpack_require__(195); -__webpack_require__(196); -__webpack_require__(197); -__webpack_require__(198); -__webpack_require__(199); -__webpack_require__(200); -__webpack_require__(201); -__webpack_require__(203); -__webpack_require__(202); -__webpack_require__(204); -__webpack_require__(205); -__webpack_require__(206); -__webpack_require__(207); -__webpack_require__(208); -__webpack_require__(209); -__webpack_require__(210); -__webpack_require__(211); -__webpack_require__(212); -__webpack_require__(213); -__webpack_require__(214); -__webpack_require__(215); -__webpack_require__(216); -__webpack_require__(217); -__webpack_require__(218); -__webpack_require__(219); -__webpack_require__(220); -__webpack_require__(221); -__webpack_require__(222); -__webpack_require__(223); -__webpack_require__(224); -__webpack_require__(225); -__webpack_require__(226); -__webpack_require__(227); -__webpack_require__(228); -__webpack_require__(229); -__webpack_require__(230); -__webpack_require__(231); -__webpack_require__(232); -__webpack_require__(233); -__webpack_require__(234); -__webpack_require__(235); -__webpack_require__(236); -__webpack_require__(237); -__webpack_require__(238); -__webpack_require__(239); -__webpack_require__(240); -__webpack_require__(241); -__webpack_require__(242); -__webpack_require__(243); -__webpack_require__(244); -__webpack_require__(245); -/* tslint:disable:no-unused-variable */ -var Subscription_1 = __webpack_require__(9); -exports.Subscription = Subscription_1.Subscription; -var Subscriber_1 = __webpack_require__(2); -exports.Subscriber = Subscriber_1.Subscriber; -var AsyncSubject_1 = __webpack_require__(25); -exports.AsyncSubject = AsyncSubject_1.AsyncSubject; -var ReplaySubject_1 = __webpack_require__(26); -exports.ReplaySubject = ReplaySubject_1.ReplaySubject; -var BehaviorSubject_1 = __webpack_require__(41); -exports.BehaviorSubject = BehaviorSubject_1.BehaviorSubject; -var ConnectableObservable_1 = __webpack_require__(386); -exports.ConnectableObservable = ConnectableObservable_1.ConnectableObservable; -var Notification_1 = __webpack_require__(30); -exports.Notification = Notification_1.Notification; -var EmptyError_1 = __webpack_require__(79); -exports.EmptyError = EmptyError_1.EmptyError; -var ArgumentOutOfRangeError_1 = __webpack_require__(22); -exports.ArgumentOutOfRangeError = ArgumentOutOfRangeError_1.ArgumentOutOfRangeError; -var ObjectUnsubscribedError_1 = __webpack_require__(80); -exports.ObjectUnsubscribedError = ObjectUnsubscribedError_1.ObjectUnsubscribedError; -var TimeoutError_1 = __webpack_require__(74); -exports.TimeoutError = TimeoutError_1.TimeoutError; -var UnsubscriptionError_1 = __webpack_require__(399); -exports.UnsubscriptionError = UnsubscriptionError_1.UnsubscriptionError; -var timeInterval_1 = __webpack_require__(66); -exports.TimeInterval = timeInterval_1.TimeInterval; -var timestamp_1 = __webpack_require__(67); -exports.Timestamp = timestamp_1.Timestamp; -var TestScheduler_1 = __webpack_require__(366); -exports.TestScheduler = TestScheduler_1.TestScheduler; -var VirtualTimeScheduler_1 = __webpack_require__(69); -exports.VirtualTimeScheduler = VirtualTimeScheduler_1.VirtualTimeScheduler; -var AjaxObservable_1 = __webpack_require__(59); -exports.AjaxResponse = AjaxObservable_1.AjaxResponse; -exports.AjaxError = AjaxObservable_1.AjaxError; -exports.AjaxTimeoutError = AjaxObservable_1.AjaxTimeoutError; -var asap_1 = __webpack_require__(70); -var async_1 = __webpack_require__(8); -var queue_1 = __webpack_require__(71); -var animationFrame_1 = __webpack_require__(363); -var rxSubscriber_1 = __webpack_require__(379); -var iterator_1 = __webpack_require__(78); -var observable_1 = __webpack_require__(378); -/* tslint:enable:no-unused-variable */ -/** - * @typedef {Object} Rx.Scheduler - * @property {Scheduler} queue Schedules on a queue in the current event frame - * (trampoline scheduler). Use this for iteration operations. - * @property {Scheduler} asap Schedules on the micro task queue, which uses the - * fastest transport mechanism available, either Node.js' `process.nextTick()` - * or Web Worker MessageChannel or setTimeout or others. Use this for - * asynchronous conversions. - * @property {Scheduler} async Schedules work with `setInterval`. Use this for - * time-based operations. - * @property {Scheduler} animationFrame Schedules work with `requestAnimationFrame`. - * Use this for synchronizing with the platform's painting - */ -var Scheduler = { - asap: asap_1.asap, - queue: queue_1.queue, - animationFrame: animationFrame_1.animationFrame, - async: async_1.async -}; -exports.Scheduler = Scheduler; -/** - * @typedef {Object} Rx.Symbol - * @property {Symbol|string} rxSubscriber A symbol to use as a property name to - * retrieve an "Rx safe" Observer from an object. "Rx safety" can be defined as - * an object that has all of the traits of an Rx Subscriber, including the - * ability to add and remove subscriptions to the subscription chain and - * guarantees involving event triggering (can't "next" after unsubscription, - * etc). - * @property {Symbol|string} observable A symbol to use as a property name to - * retrieve an Observable as defined by the [ECMAScript "Observable" spec](https://github.com/zenparsing/es-observable). - * @property {Symbol|string} iterator The ES6 symbol to use as a property name - * to retrieve an iterator from an object. - */ -var Symbol = { - rxSubscriber: rxSubscriber_1.rxSubscriber, - observable: observable_1.observable, - iterator: iterator_1.iterator -}; -exports.Symbol = Symbol; -//# sourceMappingURL=Rx.js.map - -/***/ }), -/* 122 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -/** - * An execution context and a data structure to order tasks and schedule their - * execution. Provides a notion of (potentially virtual) time, through the - * `now()` getter method. - * - * Each unit of work in a Scheduler is called an {@link Action}. - * - * ```ts - * class Scheduler { - * now(): number; - * schedule(work, delay?, state?): Subscription; - * } - * ``` - * - * @class Scheduler - */ -var Scheduler = (function () { - function Scheduler(SchedulerAction, now) { - if (now === void 0) { now = Scheduler.now; } - this.SchedulerAction = SchedulerAction; - this.now = now; - } - /** - * Schedules a function, `work`, for execution. May happen at some point in - * the future, according to the `delay` parameter, if specified. May be passed - * some context object, `state`, which will be passed to the `work` function. - * - * The given arguments will be processed an stored as an Action object in a - * queue of actions. - * - * @param {function(state: ?T): ?Subscription} work A function representing a - * task, or some unit of work to be executed by the Scheduler. - * @param {number} [delay] Time to wait before executing the work, where the - * time unit is implicit and defined by the Scheduler itself. - * @param {T} [state] Some contextual data that the `work` function uses when - * called by the Scheduler. - * @return {Subscription} A subscription in order to be able to unsubscribe - * the scheduled work. - */ - Scheduler.prototype.schedule = function (work, delay, state) { - if (delay === void 0) { delay = 0; } - return new this.SchedulerAction(this, work).schedule(state, delay); - }; - Scheduler.now = Date.now ? Date.now : function () { return +new Date(); }; - return Scheduler; -}()); -exports.Scheduler = Scheduler; -//# sourceMappingURL=Scheduler.js.map - -/***/ }), -/* 123 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var bindCallback_1 = __webpack_require__(261); -Observable_1.Observable.bindCallback = bindCallback_1.bindCallback; -//# sourceMappingURL=bindCallback.js.map - -/***/ }), -/* 124 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var bindNodeCallback_1 = __webpack_require__(262); -Observable_1.Observable.bindNodeCallback = bindNodeCallback_1.bindNodeCallback; -//# sourceMappingURL=bindNodeCallback.js.map - -/***/ }), -/* 125 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var combineLatest_1 = __webpack_require__(263); -Observable_1.Observable.combineLatest = combineLatest_1.combineLatest; -//# sourceMappingURL=combineLatest.js.map - -/***/ }), -/* 126 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var concat_1 = __webpack_require__(264); -Observable_1.Observable.concat = concat_1.concat; -//# sourceMappingURL=concat.js.map - -/***/ }), -/* 127 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var defer_1 = __webpack_require__(265); -Observable_1.Observable.defer = defer_1.defer; -//# sourceMappingURL=defer.js.map - -/***/ }), -/* 128 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var ajax_1 = __webpack_require__(267); -Observable_1.Observable.ajax = ajax_1.ajax; -//# sourceMappingURL=ajax.js.map - -/***/ }), -/* 129 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var webSocket_1 = __webpack_require__(268); -Observable_1.Observable.webSocket = webSocket_1.webSocket; -//# sourceMappingURL=webSocket.js.map - -/***/ }), -/* 130 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var empty_1 = __webpack_require__(269); -Observable_1.Observable.empty = empty_1.empty; -//# sourceMappingURL=empty.js.map - -/***/ }), -/* 131 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var forkJoin_1 = __webpack_require__(388); -Observable_1.Observable.forkJoin = forkJoin_1.forkJoin; -//# sourceMappingURL=forkJoin.js.map - -/***/ }), -/* 132 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var from_1 = __webpack_require__(389); -Observable_1.Observable.from = from_1.from; -//# sourceMappingURL=from.js.map - -/***/ }), -/* 133 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var fromEvent_1 = __webpack_require__(270); -Observable_1.Observable.fromEvent = fromEvent_1.fromEvent; -//# sourceMappingURL=fromEvent.js.map - -/***/ }), -/* 134 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var fromEventPattern_1 = __webpack_require__(271); -Observable_1.Observable.fromEventPattern = fromEventPattern_1.fromEventPattern; -//# sourceMappingURL=fromEventPattern.js.map - -/***/ }), -/* 135 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var fromPromise_1 = __webpack_require__(382); -Observable_1.Observable.fromPromise = fromPromise_1.fromPromise; -//# sourceMappingURL=fromPromise.js.map - -/***/ }), -/* 136 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var GenerateObservable_1 = __webpack_require__(252); -Observable_1.Observable.generate = GenerateObservable_1.GenerateObservable.create; -//# sourceMappingURL=generate.js.map - -/***/ }), -/* 137 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var if_1 = __webpack_require__(272); -Observable_1.Observable.if = if_1._if; -//# sourceMappingURL=if.js.map - -/***/ }), -/* 138 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var merge_1 = __webpack_require__(390); -Observable_1.Observable.merge = merge_1.merge; -//# sourceMappingURL=merge.js.map - -/***/ }), -/* 139 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var never_1 = __webpack_require__(274); -Observable_1.Observable.never = never_1.never; -//# sourceMappingURL=never.js.map - -/***/ }), -/* 140 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var of_1 = __webpack_require__(391); -Observable_1.Observable.of = of_1.of; -//# sourceMappingURL=of.js.map - -/***/ }), -/* 141 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var onErrorResumeNext_1 = __webpack_require__(63); -Observable_1.Observable.onErrorResumeNext = onErrorResumeNext_1.onErrorResumeNextStatic; -//# sourceMappingURL=onErrorResumeNext.js.map - -/***/ }), -/* 142 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var pairs_1 = __webpack_require__(275); -Observable_1.Observable.pairs = pairs_1.pairs; -//# sourceMappingURL=pairs.js.map - -/***/ }), -/* 143 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var race_1 = __webpack_require__(64); -Observable_1.Observable.race = race_1.raceStatic; -//# sourceMappingURL=race.js.map - -/***/ }), -/* 144 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var range_1 = __webpack_require__(276); -Observable_1.Observable.range = range_1.range; -//# sourceMappingURL=range.js.map - -/***/ }), -/* 145 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var using_1 = __webpack_require__(279); -Observable_1.Observable.using = using_1.using; -//# sourceMappingURL=using.js.map - -/***/ }), -/* 146 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var zip_1 = __webpack_require__(280); -Observable_1.Observable.zip = zip_1.zip; -//# sourceMappingURL=zip.js.map - -/***/ }), -/* 147 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var audit_1 = __webpack_require__(281); -Observable_1.Observable.prototype.audit = audit_1.audit; -//# sourceMappingURL=audit.js.map - -/***/ }), -/* 148 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var auditTime_1 = __webpack_require__(282); -Observable_1.Observable.prototype.auditTime = auditTime_1.auditTime; -//# sourceMappingURL=auditTime.js.map - -/***/ }), -/* 149 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var buffer_1 = __webpack_require__(283); -Observable_1.Observable.prototype.buffer = buffer_1.buffer; -//# sourceMappingURL=buffer.js.map - -/***/ }), -/* 150 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var bufferCount_1 = __webpack_require__(284); -Observable_1.Observable.prototype.bufferCount = bufferCount_1.bufferCount; -//# sourceMappingURL=bufferCount.js.map - -/***/ }), -/* 151 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var bufferTime_1 = __webpack_require__(285); -Observable_1.Observable.prototype.bufferTime = bufferTime_1.bufferTime; -//# sourceMappingURL=bufferTime.js.map - -/***/ }), -/* 152 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var bufferToggle_1 = __webpack_require__(286); -Observable_1.Observable.prototype.bufferToggle = bufferToggle_1.bufferToggle; -//# sourceMappingURL=bufferToggle.js.map - -/***/ }), -/* 153 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var bufferWhen_1 = __webpack_require__(287); -Observable_1.Observable.prototype.bufferWhen = bufferWhen_1.bufferWhen; -//# sourceMappingURL=bufferWhen.js.map - -/***/ }), -/* 154 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var combineAll_1 = __webpack_require__(288); -Observable_1.Observable.prototype.combineAll = combineAll_1.combineAll; -//# sourceMappingURL=combineAll.js.map - -/***/ }), -/* 155 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var combineLatest_1 = __webpack_require__(37); -Observable_1.Observable.prototype.combineLatest = combineLatest_1.combineLatest; -//# sourceMappingURL=combineLatest.js.map - -/***/ }), -/* 156 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var concat_1 = __webpack_require__(38); -Observable_1.Observable.prototype.concat = concat_1.concat; -//# sourceMappingURL=concat.js.map - -/***/ }), -/* 157 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var concatAll_1 = __webpack_require__(393); -Observable_1.Observable.prototype.concatAll = concatAll_1.concatAll; -//# sourceMappingURL=concatAll.js.map - -/***/ }), -/* 158 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var concatMap_1 = __webpack_require__(394); -Observable_1.Observable.prototype.concatMap = concatMap_1.concatMap; -//# sourceMappingURL=concatMap.js.map - -/***/ }), -/* 159 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var concatMapTo_1 = __webpack_require__(289); -Observable_1.Observable.prototype.concatMapTo = concatMapTo_1.concatMapTo; -//# sourceMappingURL=concatMapTo.js.map - -/***/ }), -/* 160 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var count_1 = __webpack_require__(290); -Observable_1.Observable.prototype.count = count_1.count; -//# sourceMappingURL=count.js.map - -/***/ }), -/* 161 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var debounce_1 = __webpack_require__(291); -Observable_1.Observable.prototype.debounce = debounce_1.debounce; -//# sourceMappingURL=debounce.js.map - -/***/ }), -/* 162 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var debounceTime_1 = __webpack_require__(292); -Observable_1.Observable.prototype.debounceTime = debounceTime_1.debounceTime; -//# sourceMappingURL=debounceTime.js.map - -/***/ }), -/* 163 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var defaultIfEmpty_1 = __webpack_require__(293); -Observable_1.Observable.prototype.defaultIfEmpty = defaultIfEmpty_1.defaultIfEmpty; -//# sourceMappingURL=defaultIfEmpty.js.map - -/***/ }), -/* 164 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var delay_1 = __webpack_require__(294); -Observable_1.Observable.prototype.delay = delay_1.delay; -//# sourceMappingURL=delay.js.map - -/***/ }), -/* 165 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var delayWhen_1 = __webpack_require__(295); -Observable_1.Observable.prototype.delayWhen = delayWhen_1.delayWhen; -//# sourceMappingURL=delayWhen.js.map - -/***/ }), -/* 166 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var dematerialize_1 = __webpack_require__(296); -Observable_1.Observable.prototype.dematerialize = dematerialize_1.dematerialize; -//# sourceMappingURL=dematerialize.js.map - -/***/ }), -/* 167 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var distinct_1 = __webpack_require__(297); -Observable_1.Observable.prototype.distinct = distinct_1.distinct; -//# sourceMappingURL=distinct.js.map - -/***/ }), -/* 168 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var distinctUntilChanged_1 = __webpack_require__(60); -Observable_1.Observable.prototype.distinctUntilChanged = distinctUntilChanged_1.distinctUntilChanged; -//# sourceMappingURL=distinctUntilChanged.js.map - -/***/ }), -/* 169 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var distinctUntilKeyChanged_1 = __webpack_require__(298); -Observable_1.Observable.prototype.distinctUntilKeyChanged = distinctUntilKeyChanged_1.distinctUntilKeyChanged; -//# sourceMappingURL=distinctUntilKeyChanged.js.map - -/***/ }), -/* 170 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var do_1 = __webpack_require__(299); -Observable_1.Observable.prototype.do = do_1._do; -Observable_1.Observable.prototype._do = do_1._do; -//# sourceMappingURL=do.js.map - -/***/ }), -/* 171 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var elementAt_1 = __webpack_require__(300); -Observable_1.Observable.prototype.elementAt = elementAt_1.elementAt; -//# sourceMappingURL=elementAt.js.map - -/***/ }), -/* 172 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var every_1 = __webpack_require__(395); -Observable_1.Observable.prototype.every = every_1.every; -//# sourceMappingURL=every.js.map - -/***/ }), -/* 173 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var exhaust_1 = __webpack_require__(301); -Observable_1.Observable.prototype.exhaust = exhaust_1.exhaust; -//# sourceMappingURL=exhaust.js.map - -/***/ }), -/* 174 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var exhaustMap_1 = __webpack_require__(302); -Observable_1.Observable.prototype.exhaustMap = exhaustMap_1.exhaustMap; -//# sourceMappingURL=exhaustMap.js.map - -/***/ }), -/* 175 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var expand_1 = __webpack_require__(303); -Observable_1.Observable.prototype.expand = expand_1.expand; -//# sourceMappingURL=expand.js.map - -/***/ }), -/* 176 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var filter_1 = __webpack_require__(42); -Observable_1.Observable.prototype.filter = filter_1.filter; -//# sourceMappingURL=filter.js.map - -/***/ }), -/* 177 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var finally_1 = __webpack_require__(304); -Observable_1.Observable.prototype.finally = finally_1._finally; -Observable_1.Observable.prototype._finally = finally_1._finally; -//# sourceMappingURL=finally.js.map - -/***/ }), -/* 178 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var find_1 = __webpack_require__(61); -Observable_1.Observable.prototype.find = find_1.find; -//# sourceMappingURL=find.js.map - -/***/ }), -/* 179 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var findIndex_1 = __webpack_require__(305); -Observable_1.Observable.prototype.findIndex = findIndex_1.findIndex; -//# sourceMappingURL=findIndex.js.map - -/***/ }), -/* 180 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var groupBy_1 = __webpack_require__(306); -Observable_1.Observable.prototype.groupBy = groupBy_1.groupBy; -//# sourceMappingURL=groupBy.js.map - -/***/ }), -/* 181 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var ignoreElements_1 = __webpack_require__(307); -Observable_1.Observable.prototype.ignoreElements = ignoreElements_1.ignoreElements; -//# sourceMappingURL=ignoreElements.js.map - -/***/ }), -/* 182 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var isEmpty_1 = __webpack_require__(308); -Observable_1.Observable.prototype.isEmpty = isEmpty_1.isEmpty; -//# sourceMappingURL=isEmpty.js.map - -/***/ }), -/* 183 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var last_1 = __webpack_require__(396); -Observable_1.Observable.prototype.last = last_1.last; -//# sourceMappingURL=last.js.map - -/***/ }), -/* 184 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var let_1 = __webpack_require__(309); -Observable_1.Observable.prototype.let = let_1.letProto; -Observable_1.Observable.prototype.letBind = let_1.letProto; -//# sourceMappingURL=let.js.map - -/***/ }), -/* 185 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var mapTo_1 = __webpack_require__(310); -Observable_1.Observable.prototype.mapTo = mapTo_1.mapTo; -//# sourceMappingURL=mapTo.js.map - -/***/ }), -/* 186 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var materialize_1 = __webpack_require__(311); -Observable_1.Observable.prototype.materialize = materialize_1.materialize; -//# sourceMappingURL=materialize.js.map - -/***/ }), -/* 187 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var max_1 = __webpack_require__(312); -Observable_1.Observable.prototype.max = max_1.max; -//# sourceMappingURL=max.js.map - -/***/ }), -/* 188 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var merge_1 = __webpack_require__(397); -Observable_1.Observable.prototype.merge = merge_1.merge; -//# sourceMappingURL=merge.js.map - -/***/ }), -/* 189 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var mergeAll_1 = __webpack_require__(77); -Observable_1.Observable.prototype.mergeAll = mergeAll_1.mergeAll; -//# sourceMappingURL=mergeAll.js.map - -/***/ }), -/* 190 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var mergeMap_1 = __webpack_require__(383); -Observable_1.Observable.prototype.mergeMap = mergeMap_1.mergeMap; -Observable_1.Observable.prototype.flatMap = mergeMap_1.mergeMap; -//# sourceMappingURL=mergeMap.js.map - -/***/ }), -/* 191 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var mergeMapTo_1 = __webpack_require__(62); -Observable_1.Observable.prototype.flatMapTo = mergeMapTo_1.mergeMapTo; -Observable_1.Observable.prototype.mergeMapTo = mergeMapTo_1.mergeMapTo; -//# sourceMappingURL=mergeMapTo.js.map - -/***/ }), -/* 192 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var mergeScan_1 = __webpack_require__(313); -Observable_1.Observable.prototype.mergeScan = mergeScan_1.mergeScan; -//# sourceMappingURL=mergeScan.js.map - -/***/ }), -/* 193 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var min_1 = __webpack_require__(314); -Observable_1.Observable.prototype.min = min_1.min; -//# sourceMappingURL=min.js.map - -/***/ }), -/* 194 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var multicast_1 = __webpack_require__(16); -Observable_1.Observable.prototype.multicast = multicast_1.multicast; -//# sourceMappingURL=multicast.js.map - -/***/ }), -/* 195 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var observeOn_1 = __webpack_require__(87); -Observable_1.Observable.prototype.observeOn = observeOn_1.observeOn; -//# sourceMappingURL=observeOn.js.map - -/***/ }), -/* 196 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var onErrorResumeNext_1 = __webpack_require__(63); -Observable_1.Observable.prototype.onErrorResumeNext = onErrorResumeNext_1.onErrorResumeNext; -//# sourceMappingURL=onErrorResumeNext.js.map - -/***/ }), -/* 197 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var pairwise_1 = __webpack_require__(315); -Observable_1.Observable.prototype.pairwise = pairwise_1.pairwise; -//# sourceMappingURL=pairwise.js.map +/*! ***************************************************************************** +Copyright (C) Microsoft. 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. +***************************************************************************** */ +var Reflect; +(function (Reflect) { + "use strict"; + var hasOwn = Object.prototype.hasOwnProperty; + // feature test for Symbol support + var supportsSymbol = typeof Symbol === "function"; + var toPrimitiveSymbol = supportsSymbol && typeof Symbol.toPrimitive !== "undefined" ? Symbol.toPrimitive : "@@toPrimitive"; + var iteratorSymbol = supportsSymbol && typeof Symbol.iterator !== "undefined" ? Symbol.iterator : "@@iterator"; + var HashMap; + (function (HashMap) { + var supportsCreate = typeof Object.create === "function"; // feature test for Object.create support + var supportsProto = { __proto__: [] } instanceof Array; // feature test for __proto__ support + var downLevel = !supportsCreate && !supportsProto; + // create an object in dictionary mode (a.k.a. "slow" mode in v8) + HashMap.create = supportsCreate + ? function () { return MakeDictionary(Object.create(null)); } + : supportsProto + ? function () { return MakeDictionary({ __proto__: null }); } + : function () { return MakeDictionary({}); }; + HashMap.has = downLevel + ? function (map, key) { return hasOwn.call(map, key); } + : function (map, key) { return key in map; }; + HashMap.get = downLevel + ? function (map, key) { return hasOwn.call(map, key) ? map[key] : undefined; } + : function (map, key) { return map[key]; }; + })(HashMap || (HashMap = {})); + // Load global or shim versions of Map, Set, and WeakMap + var functionPrototype = Object.getPrototypeOf(Function); + var usePolyfill = typeof process === "object" && process.env && process.env["REFLECT_METADATA_USE_MAP_POLYFILL"] === "true"; + var _Map = !usePolyfill && typeof Map === "function" && typeof Map.prototype.entries === "function" ? Map : CreateMapPolyfill(); + var _Set = !usePolyfill && typeof Set === "function" && typeof Set.prototype.entries === "function" ? Set : CreateSetPolyfill(); + var _WeakMap = !usePolyfill && typeof WeakMap === "function" ? WeakMap : CreateWeakMapPolyfill(); + // [[Metadata]] internal slot + // https://rbuckton.github.io/reflect-metadata/#ordinary-object-internal-methods-and-internal-slots + var Metadata = new _WeakMap(); + /** + * Applies a set of decorators to a property of a target object. + * @param decorators An array of decorators. + * @param target The target object. + * @param propertyKey (Optional) The property key to decorate. + * @param attributes (Optional) The property descriptor for the target key. + * @remarks Decorators are applied in reverse order. + * @example + * + * class Example { + * // property declarations are not part of ES6, though they are valid in TypeScript: + * // static staticProperty; + * // property; + * + * constructor(p) { } + * static staticMethod(p) { } + * method(p) { } + * } + * + * // constructor + * Example = Reflect.decorate(decoratorsArray, Example); + * + * // property (on constructor) + * Reflect.decorate(decoratorsArray, Example, "staticProperty"); + * + * // property (on prototype) + * Reflect.decorate(decoratorsArray, Example.prototype, "property"); + * + * // method (on constructor) + * Object.defineProperty(Example, "staticMethod", + * Reflect.decorate(decoratorsArray, Example, "staticMethod", + * Object.getOwnPropertyDescriptor(Example, "staticMethod"))); + * + * // method (on prototype) + * Object.defineProperty(Example.prototype, "method", + * Reflect.decorate(decoratorsArray, Example.prototype, "method", + * Object.getOwnPropertyDescriptor(Example.prototype, "method"))); + * + */ + function decorate(decorators, target, propertyKey, attributes) { + if (!IsUndefined(propertyKey)) { + if (!IsArray(decorators)) + throw new TypeError(); + if (!IsObject(target)) + throw new TypeError(); + if (!IsObject(attributes) && !IsUndefined(attributes) && !IsNull(attributes)) + throw new TypeError(); + if (IsNull(attributes)) + attributes = undefined; + propertyKey = ToPropertyKey(propertyKey); + return DecorateProperty(decorators, target, propertyKey, attributes); + } + else { + if (!IsArray(decorators)) + throw new TypeError(); + if (!IsConstructor(target)) + throw new TypeError(); + return DecorateConstructor(decorators, target); + } + } + Reflect.decorate = decorate; + // 4.1.2 Reflect.metadata(metadataKey, metadataValue) + // https://rbuckton.github.io/reflect-metadata/#reflect.metadata + /** + * A default metadata decorator factory that can be used on a class, class member, or parameter. + * @param metadataKey The key for the metadata entry. + * @param metadataValue The value for the metadata entry. + * @returns A decorator function. + * @remarks + * If `metadataKey` is already defined for the target and target key, the + * metadataValue for that key will be overwritten. + * @example + * + * // constructor + * @Reflect.metadata(key, value) + * class Example { + * } + * + * // property (on constructor, TypeScript only) + * class Example { + * @Reflect.metadata(key, value) + * static staticProperty; + * } + * + * // property (on prototype, TypeScript only) + * class Example { + * @Reflect.metadata(key, value) + * property; + * } + * + * // method (on constructor) + * class Example { + * @Reflect.metadata(key, value) + * static staticMethod() { } + * } + * + * // method (on prototype) + * class Example { + * @Reflect.metadata(key, value) + * method() { } + * } + * + */ + function metadata(metadataKey, metadataValue) { + function decorator(target, propertyKey) { + if (!IsObject(target)) + throw new TypeError(); + if (!IsUndefined(propertyKey) && !IsPropertyKey(propertyKey)) + throw new TypeError(); + OrdinaryDefineOwnMetadata(metadataKey, metadataValue, target, propertyKey); + } + return decorator; + } + Reflect.metadata = metadata; + /** + * Define a unique metadata entry on the target. + * @param metadataKey A key used to store and retrieve metadata. + * @param metadataValue A value that contains attached metadata. + * @param target The target object on which to define metadata. + * @param propertyKey (Optional) The property key for the target. + * @example + * + * class Example { + * // property declarations are not part of ES6, though they are valid in TypeScript: + * // static staticProperty; + * // property; + * + * constructor(p) { } + * static staticMethod(p) { } + * method(p) { } + * } + * + * // constructor + * Reflect.defineMetadata("custom:annotation", options, Example); + * + * // property (on constructor) + * Reflect.defineMetadata("custom:annotation", options, Example, "staticProperty"); + * + * // property (on prototype) + * Reflect.defineMetadata("custom:annotation", options, Example.prototype, "property"); + * + * // method (on constructor) + * Reflect.defineMetadata("custom:annotation", options, Example, "staticMethod"); + * + * // method (on prototype) + * Reflect.defineMetadata("custom:annotation", options, Example.prototype, "method"); + * + * // decorator factory as metadata-producing annotation. + * function MyAnnotation(options): Decorator { + * return (target, key?) => Reflect.defineMetadata("custom:annotation", options, target, key); + * } + * + */ + function defineMetadata(metadataKey, metadataValue, target, propertyKey) { + if (!IsObject(target)) + throw new TypeError(); + if (!IsUndefined(propertyKey)) + propertyKey = ToPropertyKey(propertyKey); + return OrdinaryDefineOwnMetadata(metadataKey, metadataValue, target, propertyKey); + } + Reflect.defineMetadata = defineMetadata; + /** + * Gets a value indicating whether the target object or its prototype chain has the provided metadata key defined. + * @param metadataKey A key used to store and retrieve metadata. + * @param target The target object on which the metadata is defined. + * @param propertyKey (Optional) The property key for the target. + * @returns `true` if the metadata key was defined on the target object or its prototype chain; otherwise, `false`. + * @example + * + * class Example { + * // property declarations are not part of ES6, though they are valid in TypeScript: + * // static staticProperty; + * // property; + * + * constructor(p) { } + * static staticMethod(p) { } + * method(p) { } + * } + * + * // constructor + * result = Reflect.hasMetadata("custom:annotation", Example); + * + * // property (on constructor) + * result = Reflect.hasMetadata("custom:annotation", Example, "staticProperty"); + * + * // property (on prototype) + * result = Reflect.hasMetadata("custom:annotation", Example.prototype, "property"); + * + * // method (on constructor) + * result = Reflect.hasMetadata("custom:annotation", Example, "staticMethod"); + * + * // method (on prototype) + * result = Reflect.hasMetadata("custom:annotation", Example.prototype, "method"); + * + */ + function hasMetadata(metadataKey, target, propertyKey) { + if (!IsObject(target)) + throw new TypeError(); + if (!IsUndefined(propertyKey)) + propertyKey = ToPropertyKey(propertyKey); + return OrdinaryHasMetadata(metadataKey, target, propertyKey); + } + Reflect.hasMetadata = hasMetadata; + /** + * Gets a value indicating whether the target object has the provided metadata key defined. + * @param metadataKey A key used to store and retrieve metadata. + * @param target The target object on which the metadata is defined. + * @param propertyKey (Optional) The property key for the target. + * @returns `true` if the metadata key was defined on the target object; otherwise, `false`. + * @example + * + * class Example { + * // property declarations are not part of ES6, though they are valid in TypeScript: + * // static staticProperty; + * // property; + * + * constructor(p) { } + * static staticMethod(p) { } + * method(p) { } + * } + * + * // constructor + * result = Reflect.hasOwnMetadata("custom:annotation", Example); + * + * // property (on constructor) + * result = Reflect.hasOwnMetadata("custom:annotation", Example, "staticProperty"); + * + * // property (on prototype) + * result = Reflect.hasOwnMetadata("custom:annotation", Example.prototype, "property"); + * + * // method (on constructor) + * result = Reflect.hasOwnMetadata("custom:annotation", Example, "staticMethod"); + * + * // method (on prototype) + * result = Reflect.hasOwnMetadata("custom:annotation", Example.prototype, "method"); + * + */ + function hasOwnMetadata(metadataKey, target, propertyKey) { + if (!IsObject(target)) + throw new TypeError(); + if (!IsUndefined(propertyKey)) + propertyKey = ToPropertyKey(propertyKey); + return OrdinaryHasOwnMetadata(metadataKey, target, propertyKey); + } + Reflect.hasOwnMetadata = hasOwnMetadata; + /** + * Gets the metadata value for the provided metadata key on the target object or its prototype chain. + * @param metadataKey A key used to store and retrieve metadata. + * @param target The target object on which the metadata is defined. + * @param propertyKey (Optional) The property key for the target. + * @returns The metadata value for the metadata key if found; otherwise, `undefined`. + * @example + * + * class Example { + * // property declarations are not part of ES6, though they are valid in TypeScript: + * // static staticProperty; + * // property; + * + * constructor(p) { } + * static staticMethod(p) { } + * method(p) { } + * } + * + * // constructor + * result = Reflect.getMetadata("custom:annotation", Example); + * + * // property (on constructor) + * result = Reflect.getMetadata("custom:annotation", Example, "staticProperty"); + * + * // property (on prototype) + * result = Reflect.getMetadata("custom:annotation", Example.prototype, "property"); + * + * // method (on constructor) + * result = Reflect.getMetadata("custom:annotation", Example, "staticMethod"); + * + * // method (on prototype) + * result = Reflect.getMetadata("custom:annotation", Example.prototype, "method"); + * + */ + function getMetadata(metadataKey, target, propertyKey) { + if (!IsObject(target)) + throw new TypeError(); + if (!IsUndefined(propertyKey)) + propertyKey = ToPropertyKey(propertyKey); + return OrdinaryGetMetadata(metadataKey, target, propertyKey); + } + Reflect.getMetadata = getMetadata; + /** + * Gets the metadata value for the provided metadata key on the target object. + * @param metadataKey A key used to store and retrieve metadata. + * @param target The target object on which the metadata is defined. + * @param propertyKey (Optional) The property key for the target. + * @returns The metadata value for the metadata key if found; otherwise, `undefined`. + * @example + * + * class Example { + * // property declarations are not part of ES6, though they are valid in TypeScript: + * // static staticProperty; + * // property; + * + * constructor(p) { } + * static staticMethod(p) { } + * method(p) { } + * } + * + * // constructor + * result = Reflect.getOwnMetadata("custom:annotation", Example); + * + * // property (on constructor) + * result = Reflect.getOwnMetadata("custom:annotation", Example, "staticProperty"); + * + * // property (on prototype) + * result = Reflect.getOwnMetadata("custom:annotation", Example.prototype, "property"); + * + * // method (on constructor) + * result = Reflect.getOwnMetadata("custom:annotation", Example, "staticMethod"); + * + * // method (on prototype) + * result = Reflect.getOwnMetadata("custom:annotation", Example.prototype, "method"); + * + */ + function getOwnMetadata(metadataKey, target, propertyKey) { + if (!IsObject(target)) + throw new TypeError(); + if (!IsUndefined(propertyKey)) + propertyKey = ToPropertyKey(propertyKey); + return OrdinaryGetOwnMetadata(metadataKey, target, propertyKey); + } + Reflect.getOwnMetadata = getOwnMetadata; + /** + * Gets the metadata keys defined on the target object or its prototype chain. + * @param target The target object on which the metadata is defined. + * @param propertyKey (Optional) The property key for the target. + * @returns An array of unique metadata keys. + * @example + * + * class Example { + * // property declarations are not part of ES6, though they are valid in TypeScript: + * // static staticProperty; + * // property; + * + * constructor(p) { } + * static staticMethod(p) { } + * method(p) { } + * } + * + * // constructor + * result = Reflect.getMetadataKeys(Example); + * + * // property (on constructor) + * result = Reflect.getMetadataKeys(Example, "staticProperty"); + * + * // property (on prototype) + * result = Reflect.getMetadataKeys(Example.prototype, "property"); + * + * // method (on constructor) + * result = Reflect.getMetadataKeys(Example, "staticMethod"); + * + * // method (on prototype) + * result = Reflect.getMetadataKeys(Example.prototype, "method"); + * + */ + function getMetadataKeys(target, propertyKey) { + if (!IsObject(target)) + throw new TypeError(); + if (!IsUndefined(propertyKey)) + propertyKey = ToPropertyKey(propertyKey); + return OrdinaryMetadataKeys(target, propertyKey); + } + Reflect.getMetadataKeys = getMetadataKeys; + /** + * Gets the unique metadata keys defined on the target object. + * @param target The target object on which the metadata is defined. + * @param propertyKey (Optional) The property key for the target. + * @returns An array of unique metadata keys. + * @example + * + * class Example { + * // property declarations are not part of ES6, though they are valid in TypeScript: + * // static staticProperty; + * // property; + * + * constructor(p) { } + * static staticMethod(p) { } + * method(p) { } + * } + * + * // constructor + * result = Reflect.getOwnMetadataKeys(Example); + * + * // property (on constructor) + * result = Reflect.getOwnMetadataKeys(Example, "staticProperty"); + * + * // property (on prototype) + * result = Reflect.getOwnMetadataKeys(Example.prototype, "property"); + * + * // method (on constructor) + * result = Reflect.getOwnMetadataKeys(Example, "staticMethod"); + * + * // method (on prototype) + * result = Reflect.getOwnMetadataKeys(Example.prototype, "method"); + * + */ + function getOwnMetadataKeys(target, propertyKey) { + if (!IsObject(target)) + throw new TypeError(); + if (!IsUndefined(propertyKey)) + propertyKey = ToPropertyKey(propertyKey); + return OrdinaryOwnMetadataKeys(target, propertyKey); + } + Reflect.getOwnMetadataKeys = getOwnMetadataKeys; + /** + * Deletes the metadata entry from the target object with the provided key. + * @param metadataKey A key used to store and retrieve metadata. + * @param target The target object on which the metadata is defined. + * @param propertyKey (Optional) The property key for the target. + * @returns `true` if the metadata entry was found and deleted; otherwise, false. + * @example + * + * class Example { + * // property declarations are not part of ES6, though they are valid in TypeScript: + * // static staticProperty; + * // property; + * + * constructor(p) { } + * static staticMethod(p) { } + * method(p) { } + * } + * + * // constructor + * result = Reflect.deleteMetadata("custom:annotation", Example); + * + * // property (on constructor) + * result = Reflect.deleteMetadata("custom:annotation", Example, "staticProperty"); + * + * // property (on prototype) + * result = Reflect.deleteMetadata("custom:annotation", Example.prototype, "property"); + * + * // method (on constructor) + * result = Reflect.deleteMetadata("custom:annotation", Example, "staticMethod"); + * + * // method (on prototype) + * result = Reflect.deleteMetadata("custom:annotation", Example.prototype, "method"); + * + */ + function deleteMetadata(metadataKey, target, propertyKey) { + if (!IsObject(target)) + throw new TypeError(); + if (!IsUndefined(propertyKey)) + propertyKey = ToPropertyKey(propertyKey); + var metadataMap = GetOrCreateMetadataMap(target, propertyKey, /*Create*/ false); + if (IsUndefined(metadataMap)) + return false; + if (!metadataMap.delete(metadataKey)) + return false; + if (metadataMap.size > 0) + return true; + var targetMetadata = Metadata.get(target); + targetMetadata.delete(propertyKey); + if (targetMetadata.size > 0) + return true; + Metadata.delete(target); + return true; + } + Reflect.deleteMetadata = deleteMetadata; + function DecorateConstructor(decorators, target) { + for (var i = decorators.length - 1; i >= 0; --i) { + var decorator = decorators[i]; + var decorated = decorator(target); + if (!IsUndefined(decorated) && !IsNull(decorated)) { + if (!IsConstructor(decorated)) + throw new TypeError(); + target = decorated; + } + } + return target; + } + function DecorateProperty(decorators, target, propertyKey, descriptor) { + for (var i = decorators.length - 1; i >= 0; --i) { + var decorator = decorators[i]; + var decorated = decorator(target, propertyKey, descriptor); + if (!IsUndefined(decorated) && !IsNull(decorated)) { + if (!IsObject(decorated)) + throw new TypeError(); + descriptor = decorated; + } + } + return descriptor; + } + function GetOrCreateMetadataMap(O, P, Create) { + var targetMetadata = Metadata.get(O); + if (IsUndefined(targetMetadata)) { + if (!Create) + return undefined; + targetMetadata = new _Map(); + Metadata.set(O, targetMetadata); + } + var metadataMap = targetMetadata.get(P); + if (IsUndefined(metadataMap)) { + if (!Create) + return undefined; + metadataMap = new _Map(); + targetMetadata.set(P, metadataMap); + } + return metadataMap; + } + // 3.1.1.1 OrdinaryHasMetadata(MetadataKey, O, P) + // https://rbuckton.github.io/reflect-metadata/#ordinaryhasmetadata + function OrdinaryHasMetadata(MetadataKey, O, P) { + var hasOwn = OrdinaryHasOwnMetadata(MetadataKey, O, P); + if (hasOwn) + return true; + var parent = OrdinaryGetPrototypeOf(O); + if (!IsNull(parent)) + return OrdinaryHasMetadata(MetadataKey, parent, P); + return false; + } + // 3.1.2.1 OrdinaryHasOwnMetadata(MetadataKey, O, P) + // https://rbuckton.github.io/reflect-metadata/#ordinaryhasownmetadata + function OrdinaryHasOwnMetadata(MetadataKey, O, P) { + var metadataMap = GetOrCreateMetadataMap(O, P, /*Create*/ false); + if (IsUndefined(metadataMap)) + return false; + return ToBoolean(metadataMap.has(MetadataKey)); + } + // 3.1.3.1 OrdinaryGetMetadata(MetadataKey, O, P) + // https://rbuckton.github.io/reflect-metadata/#ordinarygetmetadata + function OrdinaryGetMetadata(MetadataKey, O, P) { + var hasOwn = OrdinaryHasOwnMetadata(MetadataKey, O, P); + if (hasOwn) + return OrdinaryGetOwnMetadata(MetadataKey, O, P); + var parent = OrdinaryGetPrototypeOf(O); + if (!IsNull(parent)) + return OrdinaryGetMetadata(MetadataKey, parent, P); + return undefined; + } + // 3.1.4.1 OrdinaryGetOwnMetadata(MetadataKey, O, P) + // https://rbuckton.github.io/reflect-metadata/#ordinarygetownmetadata + function OrdinaryGetOwnMetadata(MetadataKey, O, P) { + var metadataMap = GetOrCreateMetadataMap(O, P, /*Create*/ false); + if (IsUndefined(metadataMap)) + return undefined; + return metadataMap.get(MetadataKey); + } + // 3.1.5.1 OrdinaryDefineOwnMetadata(MetadataKey, MetadataValue, O, P) + // https://rbuckton.github.io/reflect-metadata/#ordinarydefineownmetadata + function OrdinaryDefineOwnMetadata(MetadataKey, MetadataValue, O, P) { + var metadataMap = GetOrCreateMetadataMap(O, P, /*Create*/ true); + metadataMap.set(MetadataKey, MetadataValue); + } + // 3.1.6.1 OrdinaryMetadataKeys(O, P) + // https://rbuckton.github.io/reflect-metadata/#ordinarymetadatakeys + function OrdinaryMetadataKeys(O, P) { + var ownKeys = OrdinaryOwnMetadataKeys(O, P); + var parent = OrdinaryGetPrototypeOf(O); + if (parent === null) + return ownKeys; + var parentKeys = OrdinaryMetadataKeys(parent, P); + if (parentKeys.length <= 0) + return ownKeys; + if (ownKeys.length <= 0) + return parentKeys; + var set = new _Set(); + var keys = []; + for (var _i = 0, ownKeys_1 = ownKeys; _i < ownKeys_1.length; _i++) { + var key = ownKeys_1[_i]; + var hasKey = set.has(key); + if (!hasKey) { + set.add(key); + keys.push(key); + } + } + for (var _a = 0, parentKeys_1 = parentKeys; _a < parentKeys_1.length; _a++) { + var key = parentKeys_1[_a]; + var hasKey = set.has(key); + if (!hasKey) { + set.add(key); + keys.push(key); + } + } + return keys; + } + // 3.1.7.1 OrdinaryOwnMetadataKeys(O, P) + // https://rbuckton.github.io/reflect-metadata/#ordinaryownmetadatakeys + function OrdinaryOwnMetadataKeys(O, P) { + var keys = []; + var metadataMap = GetOrCreateMetadataMap(O, P, /*Create*/ false); + if (IsUndefined(metadataMap)) + return keys; + var keysObj = metadataMap.keys(); + var iterator = GetIterator(keysObj); + var k = 0; + while (true) { + var next = IteratorStep(iterator); + if (!next) { + keys.length = k; + return keys; + } + var nextValue = IteratorValue(next); + try { + keys[k] = nextValue; + } + catch (e) { + try { + IteratorClose(iterator); + } + finally { + throw e; + } + } + k++; + } + } + // 6 ECMAScript Data Typ0es and Values + // https://tc39.github.io/ecma262/#sec-ecmascript-data-types-and-values + function Type(x) { + if (x === null) + return 1 /* Null */; + switch (typeof x) { + case "undefined": return 0 /* Undefined */; + case "boolean": return 2 /* Boolean */; + case "string": return 3 /* String */; + case "symbol": return 4 /* Symbol */; + case "number": return 5 /* Number */; + case "object": return x === null ? 1 /* Null */ : 6 /* Object */; + default: return 6 /* Object */; + } + } + // 6.1.1 The Undefined Type + // https://tc39.github.io/ecma262/#sec-ecmascript-language-types-undefined-type + function IsUndefined(x) { + return x === undefined; + } + // 6.1.2 The Null Type + // https://tc39.github.io/ecma262/#sec-ecmascript-language-types-null-type + function IsNull(x) { + return x === null; + } + // 6.1.5 The Symbol Type + // https://tc39.github.io/ecma262/#sec-ecmascript-language-types-symbol-type + function IsSymbol(x) { + return typeof x === "symbol"; + } + // 6.1.7 The Object Type + // https://tc39.github.io/ecma262/#sec-object-type + function IsObject(x) { + return typeof x === "object" ? x !== null : typeof x === "function"; + } + // 7.1 Type Conversion + // https://tc39.github.io/ecma262/#sec-type-conversion + // 7.1.1 ToPrimitive(input [, PreferredType]) + // https://tc39.github.io/ecma262/#sec-toprimitive + function ToPrimitive(input, PreferredType) { + switch (Type(input)) { + case 0 /* Undefined */: return input; + case 1 /* Null */: return input; + case 2 /* Boolean */: return input; + case 3 /* String */: return input; + case 4 /* Symbol */: return input; + case 5 /* Number */: return input; + } + var hint = PreferredType === 3 /* String */ ? "string" : PreferredType === 5 /* Number */ ? "number" : "default"; + var exoticToPrim = GetMethod(input, toPrimitiveSymbol); + if (exoticToPrim !== undefined) { + var result = exoticToPrim.call(input, hint); + if (IsObject(result)) + throw new TypeError(); + return result; + } + return OrdinaryToPrimitive(input, hint === "default" ? "number" : hint); + } + // 7.1.1.1 OrdinaryToPrimitive(O, hint) + // https://tc39.github.io/ecma262/#sec-ordinarytoprimitive + function OrdinaryToPrimitive(O, hint) { + if (hint === "string") { + var toString_1 = O.toString; + if (IsCallable(toString_1)) { + var result = toString_1.call(O); + if (!IsObject(result)) + return result; + } + var valueOf = O.valueOf; + if (IsCallable(valueOf)) { + var result = valueOf.call(O); + if (!IsObject(result)) + return result; + } + } + else { + var valueOf = O.valueOf; + if (IsCallable(valueOf)) { + var result = valueOf.call(O); + if (!IsObject(result)) + return result; + } + var toString_2 = O.toString; + if (IsCallable(toString_2)) { + var result = toString_2.call(O); + if (!IsObject(result)) + return result; + } + } + throw new TypeError(); + } + // 7.1.2 ToBoolean(argument) + // https://tc39.github.io/ecma262/2016/#sec-toboolean + function ToBoolean(argument) { + return !!argument; + } + // 7.1.12 ToString(argument) + // https://tc39.github.io/ecma262/#sec-tostring + function ToString(argument) { + return "" + argument; + } + // 7.1.14 ToPropertyKey(argument) + // https://tc39.github.io/ecma262/#sec-topropertykey + function ToPropertyKey(argument) { + var key = ToPrimitive(argument, 3 /* String */); + if (IsSymbol(key)) + return key; + return ToString(key); + } + // 7.2 Testing and Comparison Operations + // https://tc39.github.io/ecma262/#sec-testing-and-comparison-operations + // 7.2.2 IsArray(argument) + // https://tc39.github.io/ecma262/#sec-isarray + function IsArray(argument) { + return Array.isArray + ? Array.isArray(argument) + : argument instanceof Object + ? argument instanceof Array + : Object.prototype.toString.call(argument) === "[object Array]"; + } + // 7.2.3 IsCallable(argument) + // https://tc39.github.io/ecma262/#sec-iscallable + function IsCallable(argument) { + // NOTE: This is an approximation as we cannot check for [[Call]] internal method. + return typeof argument === "function"; + } + // 7.2.4 IsConstructor(argument) + // https://tc39.github.io/ecma262/#sec-isconstructor + function IsConstructor(argument) { + // NOTE: This is an approximation as we cannot check for [[Construct]] internal method. + return typeof argument === "function"; + } + // 7.2.7 IsPropertyKey(argument) + // https://tc39.github.io/ecma262/#sec-ispropertykey + function IsPropertyKey(argument) { + switch (Type(argument)) { + case 3 /* String */: return true; + case 4 /* Symbol */: return true; + default: return false; + } + } + // 7.3 Operations on Objects + // https://tc39.github.io/ecma262/#sec-operations-on-objects + // 7.3.9 GetMethod(V, P) + // https://tc39.github.io/ecma262/#sec-getmethod + function GetMethod(V, P) { + var func = V[P]; + if (func === undefined || func === null) + return undefined; + if (!IsCallable(func)) + throw new TypeError(); + return func; + } + // 7.4 Operations on Iterator Objects + // https://tc39.github.io/ecma262/#sec-operations-on-iterator-objects + function GetIterator(obj) { + var method = GetMethod(obj, iteratorSymbol); + if (!IsCallable(method)) + throw new TypeError(); // from Call + var iterator = method.call(obj); + if (!IsObject(iterator)) + throw new TypeError(); + return iterator; + } + // 7.4.4 IteratorValue(iterResult) + // https://tc39.github.io/ecma262/2016/#sec-iteratorvalue + function IteratorValue(iterResult) { + return iterResult.value; + } + // 7.4.5 IteratorStep(iterator) + // https://tc39.github.io/ecma262/#sec-iteratorstep + function IteratorStep(iterator) { + var result = iterator.next(); + return result.done ? false : result; + } + // 7.4.6 IteratorClose(iterator, completion) + // https://tc39.github.io/ecma262/#sec-iteratorclose + function IteratorClose(iterator) { + var f = iterator["return"]; + if (f) + f.call(iterator); + } + // 9.1 Ordinary Object Internal Methods and Internal Slots + // https://tc39.github.io/ecma262/#sec-ordinary-object-internal-methods-and-internal-slots + // 9.1.1.1 OrdinaryGetPrototypeOf(O) + // https://tc39.github.io/ecma262/#sec-ordinarygetprototypeof + function OrdinaryGetPrototypeOf(O) { + var proto = Object.getPrototypeOf(O); + if (typeof O !== "function" || O === functionPrototype) + return proto; + // TypeScript doesn't set __proto__ in ES5, as it's non-standard. + // Try to determine the superclass constructor. Compatible implementations + // must either set __proto__ on a subclass constructor to the superclass constructor, + // or ensure each class has a valid `constructor` property on its prototype that + // points back to the constructor. + // If this is not the same as Function.[[Prototype]], then this is definately inherited. + // This is the case when in ES6 or when using __proto__ in a compatible browser. + if (proto !== functionPrototype) + return proto; + // If the super prototype is Object.prototype, null, or undefined, then we cannot determine the heritage. + var prototype = O.prototype; + var prototypeProto = prototype && Object.getPrototypeOf(prototype); + if (prototypeProto == null || prototypeProto === Object.prototype) + return proto; + // If the constructor was not a function, then we cannot determine the heritage. + var constructor = prototypeProto.constructor; + if (typeof constructor !== "function") + return proto; + // If we have some kind of self-reference, then we cannot determine the heritage. + if (constructor === O) + return proto; + // we have a pretty good guess at the heritage. + return constructor; + } + // naive Map shim + function CreateMapPolyfill() { + var cacheSentinel = {}; + var arraySentinel = []; + var MapIterator = (function () { + function MapIterator(keys, values, selector) { + this._index = 0; + this._keys = keys; + this._values = values; + this._selector = selector; + } + MapIterator.prototype["@@iterator"] = function () { return this; }; + MapIterator.prototype[iteratorSymbol] = function () { return this; }; + MapIterator.prototype.next = function () { + var index = this._index; + if (index >= 0 && index < this._keys.length) { + var result = this._selector(this._keys[index], this._values[index]); + if (index + 1 >= this._keys.length) { + this._index = -1; + this._keys = arraySentinel; + this._values = arraySentinel; + } + else { + this._index++; + } + return { value: result, done: false }; + } + return { value: undefined, done: true }; + }; + MapIterator.prototype.throw = function (error) { + if (this._index >= 0) { + this._index = -1; + this._keys = arraySentinel; + this._values = arraySentinel; + } + throw error; + }; + MapIterator.prototype.return = function (value) { + if (this._index >= 0) { + this._index = -1; + this._keys = arraySentinel; + this._values = arraySentinel; + } + return { value: value, done: true }; + }; + return MapIterator; + }()); + return (function () { + function Map() { + this._keys = []; + this._values = []; + this._cacheKey = cacheSentinel; + this._cacheIndex = -2; + } + Object.defineProperty(Map.prototype, "size", { + get: function () { return this._keys.length; }, + enumerable: true, + configurable: true + }); + Map.prototype.has = function (key) { return this._find(key, /*insert*/ false) >= 0; }; + Map.prototype.get = function (key) { + var index = this._find(key, /*insert*/ false); + return index >= 0 ? this._values[index] : undefined; + }; + Map.prototype.set = function (key, value) { + var index = this._find(key, /*insert*/ true); + this._values[index] = value; + return this; + }; + Map.prototype.delete = function (key) { + var index = this._find(key, /*insert*/ false); + if (index >= 0) { + var size = this._keys.length; + for (var i = index + 1; i < size; i++) { + this._keys[i - 1] = this._keys[i]; + this._values[i - 1] = this._values[i]; + } + this._keys.length--; + this._values.length--; + if (key === this._cacheKey) { + this._cacheKey = cacheSentinel; + this._cacheIndex = -2; + } + return true; + } + return false; + }; + Map.prototype.clear = function () { + this._keys.length = 0; + this._values.length = 0; + this._cacheKey = cacheSentinel; + this._cacheIndex = -2; + }; + Map.prototype.keys = function () { return new MapIterator(this._keys, this._values, getKey); }; + Map.prototype.values = function () { return new MapIterator(this._keys, this._values, getValue); }; + Map.prototype.entries = function () { return new MapIterator(this._keys, this._values, getEntry); }; + Map.prototype["@@iterator"] = function () { return this.entries(); }; + Map.prototype[iteratorSymbol] = function () { return this.entries(); }; + Map.prototype._find = function (key, insert) { + if (this._cacheKey !== key) { + this._cacheIndex = this._keys.indexOf(this._cacheKey = key); + } + if (this._cacheIndex < 0 && insert) { + this._cacheIndex = this._keys.length; + this._keys.push(key); + this._values.push(undefined); + } + return this._cacheIndex; + }; + return Map; + }()); + function getKey(key, _) { + return key; + } + function getValue(_, value) { + return value; + } + function getEntry(key, value) { + return [key, value]; + } + } + // naive Set shim + function CreateSetPolyfill() { + return (function () { + function Set() { + this._map = new _Map(); + } + Object.defineProperty(Set.prototype, "size", { + get: function () { return this._map.size; }, + enumerable: true, + configurable: true + }); + Set.prototype.has = function (value) { return this._map.has(value); }; + Set.prototype.add = function (value) { return this._map.set(value, value), this; }; + Set.prototype.delete = function (value) { return this._map.delete(value); }; + Set.prototype.clear = function () { this._map.clear(); }; + Set.prototype.keys = function () { return this._map.keys(); }; + Set.prototype.values = function () { return this._map.values(); }; + Set.prototype.entries = function () { return this._map.entries(); }; + Set.prototype["@@iterator"] = function () { return this.keys(); }; + Set.prototype[iteratorSymbol] = function () { return this.keys(); }; + return Set; + }()); + } + // naive WeakMap shim + function CreateWeakMapPolyfill() { + var UUID_SIZE = 16; + var keys = HashMap.create(); + var rootKey = CreateUniqueKey(); + return (function () { + function WeakMap() { + this._key = CreateUniqueKey(); + } + WeakMap.prototype.has = function (target) { + var table = GetOrCreateWeakMapTable(target, /*create*/ false); + return table !== undefined ? HashMap.has(table, this._key) : false; + }; + WeakMap.prototype.get = function (target) { + var table = GetOrCreateWeakMapTable(target, /*create*/ false); + return table !== undefined ? HashMap.get(table, this._key) : undefined; + }; + WeakMap.prototype.set = function (target, value) { + var table = GetOrCreateWeakMapTable(target, /*create*/ true); + table[this._key] = value; + return this; + }; + WeakMap.prototype.delete = function (target) { + var table = GetOrCreateWeakMapTable(target, /*create*/ false); + return table !== undefined ? delete table[this._key] : false; + }; + WeakMap.prototype.clear = function () { + // NOTE: not a real clear, just makes the previous data unreachable + this._key = CreateUniqueKey(); + }; + return WeakMap; + }()); + function CreateUniqueKey() { + var key; + do + key = "@@WeakMap@@" + CreateUUID(); + while (HashMap.has(keys, key)); + keys[key] = true; + return key; + } + function GetOrCreateWeakMapTable(target, create) { + if (!hasOwn.call(target, rootKey)) { + if (!create) + return undefined; + Object.defineProperty(target, rootKey, { value: HashMap.create() }); + } + return target[rootKey]; + } + function FillRandomBytes(buffer, size) { + for (var i = 0; i < size; ++i) + buffer[i] = Math.random() * 0xff | 0; + return buffer; + } + function GenRandomBytes(size) { + if (typeof Uint8Array === "function") { + if (typeof crypto !== "undefined") + return crypto.getRandomValues(new Uint8Array(size)); + if (typeof msCrypto !== "undefined") + return msCrypto.getRandomValues(new Uint8Array(size)); + return FillRandomBytes(new Uint8Array(size), size); + } + return FillRandomBytes(new Array(size), size); + } + function CreateUUID() { + var data = GenRandomBytes(UUID_SIZE); + // mark as random - RFC 4122 § 4.4 + data[6] = data[6] & 0x4f | 0x40; + data[8] = data[8] & 0xbf | 0x80; + var result = ""; + for (var offset = 0; offset < UUID_SIZE; ++offset) { + var byte = data[offset]; + if (offset === 4 || offset === 6 || offset === 8) + result += "-"; + if (byte < 16) + result += "0"; + result += byte.toString(16).toLowerCase(); + } + return result; + } + } + // uses a heuristic used by v8 and chakra to force an object into dictionary mode. + function MakeDictionary(obj) { + obj.__ = undefined; + delete obj.__; + return obj; + } + // patch global Reflect + (function (__global) { + if (typeof __global.Reflect !== "undefined") { + if (__global.Reflect !== Reflect) { + for (var p in Reflect) { + if (hasOwn.call(Reflect, p)) { + __global.Reflect[p] = Reflect[p]; + } + } + } + } + else { + __global.Reflect = Reflect; + } + })(typeof global !== "undefined" ? global : + typeof self !== "undefined" ? self : + Function("return this;")()); +})(Reflect || (Reflect = {})); +//# sourceMappingURL=Reflect.js.map /***/ }), -/* 198 */ +/* 60 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -var Observable_1 = __webpack_require__(0); -var partition_1 = __webpack_require__(316); -Observable_1.Observable.prototype.partition = partition_1.partition; -//# sourceMappingURL=partition.js.map +var Observable_1 = __webpack_require__(2); +var first_1 = __webpack_require__(55); +Observable_1.Observable.prototype.first = first_1.first; +//# sourceMappingURL=first.js.map /***/ }), -/* 199 */ +/* 61 */ /***/ (function(module, exports, __webpack_require__) { -"use strict"; - -var Observable_1 = __webpack_require__(0); -var pluck_1 = __webpack_require__(317); -Observable_1.Observable.prototype.pluck = pluck_1.pluck; -//# sourceMappingURL=pluck.js.map +module.exports = (__webpack_require__(0))(48); /***/ }), -/* 200 */ +/* 62 */ /***/ (function(module, exports, __webpack_require__) { -"use strict"; - -var Observable_1 = __webpack_require__(0); -var publish_1 = __webpack_require__(318); -Observable_1.Observable.prototype.publish = publish_1.publish; -//# sourceMappingURL=publish.js.map +module.exports = (__webpack_require__(0))(54); /***/ }), -/* 201 */ +/* 63 */ /***/ (function(module, exports, __webpack_require__) { -"use strict"; - -var Observable_1 = __webpack_require__(0); -var publishBehavior_1 = __webpack_require__(319); -Observable_1.Observable.prototype.publishBehavior = publishBehavior_1.publishBehavior; -//# sourceMappingURL=publishBehavior.js.map +/** + * @license Angular v5.0.1 + * (c) 2010-2017 Google, Inc. https://angular.io/ + * License: MIT + */ +(function (global, factory) { + true ? factory(exports, __webpack_require__(4), __webpack_require__(53), __webpack_require__(51), __webpack_require__(26)) : + typeof define === 'function' && define.amd ? define('@angular/platform-browser/animations', ['exports', '@angular/core', '@angular/platform-browser', '@angular/animations', '@angular/animations/browser'], factory) : + (factory((global.ng = global.ng || {}, global.ng.platformBrowser = global.ng.platformBrowser || {}, global.ng.platformBrowser.animations = {}),global.ng.core,global.ng.platformBrowser,global.ng.animations,global.ng.animations.browser)); +}(this, (function (exports,_angular_core,_angular_platformBrowser,_angular_animations,_angular_animations_browser) { 'use strict'; -/***/ }), -/* 202 */ -/***/ (function(module, exports, __webpack_require__) { +/*! ***************************************************************************** +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 __()); +} -"use strict"; +/** + * @license Angular v5.0.1 + * (c) 2010-2017 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 + */ +var BrowserAnimationBuilder = (function (_super) { + __extends(BrowserAnimationBuilder, _super); + function BrowserAnimationBuilder(rootRenderer, doc) { + var _this = _super.call(this) || this; + _this._nextAnimationId = 0; + var /** @type {?} */ typeData = /** @type {?} */ ({ + id: '0', + encapsulation: _angular_core.ViewEncapsulation.None, + styles: [], + data: { animation: [] } + }); + _this._renderer = /** @type {?} */ (rootRenderer.createRenderer(doc.body, typeData)); + return _this; + } + /** + * @param {?} animation + * @return {?} + */ + BrowserAnimationBuilder.prototype.build = /** + * @param {?} animation + * @return {?} + */ + function (animation) { + var /** @type {?} */ id = this._nextAnimationId.toString(); + this._nextAnimationId++; + var /** @type {?} */ entry = Array.isArray(animation) ? _angular_animations.sequence(animation) : animation; + issueAnimationCommand(this._renderer, null, id, 'register', [entry]); + return new BrowserAnimationFactory(id, this._renderer); + }; + BrowserAnimationBuilder.decorators = [ + { type: _angular_core.Injectable }, + ]; + /** @nocollapse */ + BrowserAnimationBuilder.ctorParameters = function () { return [ + { type: _angular_core.RendererFactory2, }, + { type: undefined, decorators: [{ type: _angular_core.Inject, args: [_angular_platformBrowser.DOCUMENT,] },] }, + ]; }; + return BrowserAnimationBuilder; +}(_angular_animations.AnimationBuilder)); +var BrowserAnimationFactory = (function (_super) { + __extends(BrowserAnimationFactory, _super); + function BrowserAnimationFactory(_id, _renderer) { + var _this = _super.call(this) || this; + _this._id = _id; + _this._renderer = _renderer; + return _this; + } + /** + * @param {?} element + * @param {?=} options + * @return {?} + */ + BrowserAnimationFactory.prototype.create = /** + * @param {?} element + * @param {?=} options + * @return {?} + */ + function (element, options) { + return new RendererAnimationPlayer(this._id, element, options || {}, this._renderer); + }; + return BrowserAnimationFactory; +}(_angular_animations.AnimationFactory)); +var RendererAnimationPlayer = (function () { + function RendererAnimationPlayer(id, element, options, _renderer) { + this.id = id; + this.element = element; + this._renderer = _renderer; + this.parentPlayer = null; + this._started = false; + this.totalTime = 0; + this._command('create', options); + } + /** + * @param {?} eventName + * @param {?} callback + * @return {?} + */ + RendererAnimationPlayer.prototype._listen = /** + * @param {?} eventName + * @param {?} callback + * @return {?} + */ + function (eventName, callback) { + return this._renderer.listen(this.element, "@@" + this.id + ":" + eventName, callback); + }; + /** + * @param {?} command + * @param {...?} args + * @return {?} + */ + RendererAnimationPlayer.prototype._command = /** + * @param {?} command + * @param {...?} args + * @return {?} + */ + function (command) { + var args = []; + for (var _i = 1; _i < arguments.length; _i++) { + args[_i - 1] = arguments[_i]; + } + return issueAnimationCommand(this._renderer, this.element, this.id, command, args); + }; + /** + * @param {?} fn + * @return {?} + */ + RendererAnimationPlayer.prototype.onDone = /** + * @param {?} fn + * @return {?} + */ + function (fn) { this._listen('done', fn); }; + /** + * @param {?} fn + * @return {?} + */ + RendererAnimationPlayer.prototype.onStart = /** + * @param {?} fn + * @return {?} + */ + function (fn) { this._listen('start', fn); }; + /** + * @param {?} fn + * @return {?} + */ + RendererAnimationPlayer.prototype.onDestroy = /** + * @param {?} fn + * @return {?} + */ + function (fn) { this._listen('destroy', fn); }; + /** + * @return {?} + */ + RendererAnimationPlayer.prototype.init = /** + * @return {?} + */ + function () { this._command('init'); }; + /** + * @return {?} + */ + RendererAnimationPlayer.prototype.hasStarted = /** + * @return {?} + */ + function () { return this._started; }; + /** + * @return {?} + */ + RendererAnimationPlayer.prototype.play = /** + * @return {?} + */ + function () { + this._command('play'); + this._started = true; + }; + /** + * @return {?} + */ + RendererAnimationPlayer.prototype.pause = /** + * @return {?} + */ + function () { this._command('pause'); }; + /** + * @return {?} + */ + RendererAnimationPlayer.prototype.restart = /** + * @return {?} + */ + function () { this._command('restart'); }; + /** + * @return {?} + */ + RendererAnimationPlayer.prototype.finish = /** + * @return {?} + */ + function () { this._command('finish'); }; + /** + * @return {?} + */ + RendererAnimationPlayer.prototype.destroy = /** + * @return {?} + */ + function () { this._command('destroy'); }; + /** + * @return {?} + */ + RendererAnimationPlayer.prototype.reset = /** + * @return {?} + */ + function () { this._command('reset'); }; + /** + * @param {?} p + * @return {?} + */ + RendererAnimationPlayer.prototype.setPosition = /** + * @param {?} p + * @return {?} + */ + function (p) { this._command('setPosition', p); }; + /** + * @return {?} + */ + RendererAnimationPlayer.prototype.getPosition = /** + * @return {?} + */ + function () { return 0; }; + return RendererAnimationPlayer; +}()); +/** + * @param {?} renderer + * @param {?} element + * @param {?} id + * @param {?} command + * @param {?} args + * @return {?} + */ +function issueAnimationCommand(renderer, element, id, command, args) { + return renderer.setProperty(element, "@@" + id + ":" + command, args); +} -var Observable_1 = __webpack_require__(0); -var publishLast_1 = __webpack_require__(320); -Observable_1.Observable.prototype.publishLast = publishLast_1.publishLast; -//# sourceMappingURL=publishLast.js.map +/** + * @fileoverview added by tsickle + * @suppress {checkTypes} checked by tsc + */ +var ANIMATION_PREFIX = '@'; +var DISABLE_ANIMATIONS_FLAG = '@.disabled'; +var AnimationRendererFactory = (function () { + function AnimationRendererFactory(delegate, engine, _zone) { + this.delegate = delegate; + this.engine = engine; + this._zone = _zone; + this._currentId = 0; + this._microtaskId = 1; + this._animationCallbacksBuffer = []; + this._rendererCache = new Map(); + this._cdRecurDepth = 0; + engine.onRemovalComplete = function (element, delegate) { + // Note: if an component element has a leave animation, and the component + // a host leave animation, the view engine will call `removeChild` for the parent + // component renderer as well as for the child component renderer. + // Therefore, we need to check if we already removed the element. + if (delegate && delegate.parentNode(element)) { + delegate.removeChild(element.parentNode, element); + } + }; + } + /** + * @param {?} hostElement + * @param {?} type + * @return {?} + */ + AnimationRendererFactory.prototype.createRenderer = /** + * @param {?} hostElement + * @param {?} type + * @return {?} + */ + function (hostElement, type) { + var _this = this; + var /** @type {?} */ EMPTY_NAMESPACE_ID = ''; + // cache the delegates to find out which cached delegate can + // be used by which cached renderer + var /** @type {?} */ delegate = this.delegate.createRenderer(hostElement, type); + if (!hostElement || !type || !type.data || !type.data['animation']) { + var /** @type {?} */ renderer = this._rendererCache.get(delegate); + if (!renderer) { + renderer = new BaseAnimationRenderer(EMPTY_NAMESPACE_ID, delegate, this.engine); + // only cache this result when the base renderer is used + this._rendererCache.set(delegate, renderer); + } + return renderer; + } + var /** @type {?} */ componentId = type.id; + var /** @type {?} */ namespaceId = type.id + '-' + this._currentId; + this._currentId++; + this.engine.register(namespaceId, hostElement); + var /** @type {?} */ animationTriggers = /** @type {?} */ (type.data['animation']); + animationTriggers.forEach(function (trigger) { + return _this.engine.registerTrigger(componentId, namespaceId, hostElement, trigger.name, trigger); + }); + return new AnimationRenderer(this, namespaceId, delegate, this.engine); + }; + /** + * @return {?} + */ + AnimationRendererFactory.prototype.begin = /** + * @return {?} + */ + function () { + this._cdRecurDepth++; + if (this.delegate.begin) { + this.delegate.begin(); + } + }; + /** + * @return {?} + */ + AnimationRendererFactory.prototype._scheduleCountTask = /** + * @return {?} + */ + function () { + var _this = this; + Zone.current.scheduleMicroTask('incremenet the animation microtask', function () { return _this._microtaskId++; }); + }; + /* @internal */ + /** + * @param {?} count + * @param {?} fn + * @param {?} data + * @return {?} + */ + AnimationRendererFactory.prototype.scheduleListenerCallback = /** + * @param {?} count + * @param {?} fn + * @param {?} data + * @return {?} + */ + function (count, fn, data) { + var _this = this; + if (count >= 0 && count < this._microtaskId) { + this._zone.run(function () { return fn(data); }); + return; + } + if (this._animationCallbacksBuffer.length == 0) { + Promise.resolve(null).then(function () { + _this._zone.run(function () { + _this._animationCallbacksBuffer.forEach(function (tuple) { + var fn = tuple[0], data = tuple[1]; + fn(data); + }); + _this._animationCallbacksBuffer = []; + }); + }); + } + this._animationCallbacksBuffer.push([fn, data]); + }; + /** + * @return {?} + */ + AnimationRendererFactory.prototype.end = /** + * @return {?} + */ + function () { + var _this = this; + this._cdRecurDepth--; + // this is to prevent animations from running twice when an inner + // component does CD when a parent component insted has inserted it + if (this._cdRecurDepth == 0) { + this._zone.runOutsideAngular(function () { + _this._scheduleCountTask(); + _this.engine.flush(_this._microtaskId); + }); + } + if (this.delegate.end) { + this.delegate.end(); + } + }; + /** + * @return {?} + */ + AnimationRendererFactory.prototype.whenRenderingDone = /** + * @return {?} + */ + function () { return this.engine.whenRenderingDone(); }; + AnimationRendererFactory.decorators = [ + { type: _angular_core.Injectable }, + ]; + /** @nocollapse */ + AnimationRendererFactory.ctorParameters = function () { return [ + { type: _angular_core.RendererFactory2, }, + { type: _angular_animations_browser.ɵAnimationEngine, }, + { type: _angular_core.NgZone, }, + ]; }; + return AnimationRendererFactory; +}()); +var BaseAnimationRenderer = (function () { + function BaseAnimationRenderer(namespaceId, delegate, engine) { + this.namespaceId = namespaceId; + this.delegate = delegate; + this.engine = engine; + this.destroyNode = this.delegate.destroyNode ? function (n) { return /** @type {?} */ ((delegate.destroyNode))(n); } : null; + } + Object.defineProperty(BaseAnimationRenderer.prototype, "data", { + get: /** + * @return {?} + */ + function () { return this.delegate.data; }, + enumerable: true, + configurable: true + }); + /** + * @return {?} + */ + BaseAnimationRenderer.prototype.destroy = /** + * @return {?} + */ + function () { + this.engine.destroy(this.namespaceId, this.delegate); + this.delegate.destroy(); + }; + /** + * @param {?} name + * @param {?=} namespace + * @return {?} + */ + BaseAnimationRenderer.prototype.createElement = /** + * @param {?} name + * @param {?=} namespace + * @return {?} + */ + function (name, namespace) { + return this.delegate.createElement(name, namespace); + }; + /** + * @param {?} value + * @return {?} + */ + BaseAnimationRenderer.prototype.createComment = /** + * @param {?} value + * @return {?} + */ + function (value) { return this.delegate.createComment(value); }; + /** + * @param {?} value + * @return {?} + */ + BaseAnimationRenderer.prototype.createText = /** + * @param {?} value + * @return {?} + */ + function (value) { return this.delegate.createText(value); }; + /** + * @param {?} parent + * @param {?} newChild + * @return {?} + */ + BaseAnimationRenderer.prototype.appendChild = /** + * @param {?} parent + * @param {?} newChild + * @return {?} + */ + function (parent, newChild) { + this.delegate.appendChild(parent, newChild); + this.engine.onInsert(this.namespaceId, newChild, parent, false); + }; + /** + * @param {?} parent + * @param {?} newChild + * @param {?} refChild + * @return {?} + */ + BaseAnimationRenderer.prototype.insertBefore = /** + * @param {?} parent + * @param {?} newChild + * @param {?} refChild + * @return {?} + */ + function (parent, newChild, refChild) { + this.delegate.insertBefore(parent, newChild, refChild); + this.engine.onInsert(this.namespaceId, newChild, parent, true); + }; + /** + * @param {?} parent + * @param {?} oldChild + * @return {?} + */ + BaseAnimationRenderer.prototype.removeChild = /** + * @param {?} parent + * @param {?} oldChild + * @return {?} + */ + function (parent, oldChild) { + this.engine.onRemove(this.namespaceId, oldChild, this.delegate); + }; + /** + * @param {?} selectorOrNode + * @return {?} + */ + BaseAnimationRenderer.prototype.selectRootElement = /** + * @param {?} selectorOrNode + * @return {?} + */ + function (selectorOrNode) { return this.delegate.selectRootElement(selectorOrNode); }; + /** + * @param {?} node + * @return {?} + */ + BaseAnimationRenderer.prototype.parentNode = /** + * @param {?} node + * @return {?} + */ + function (node) { return this.delegate.parentNode(node); }; + /** + * @param {?} node + * @return {?} + */ + BaseAnimationRenderer.prototype.nextSibling = /** + * @param {?} node + * @return {?} + */ + function (node) { return this.delegate.nextSibling(node); }; + /** + * @param {?} el + * @param {?} name + * @param {?} value + * @param {?=} namespace + * @return {?} + */ + BaseAnimationRenderer.prototype.setAttribute = /** + * @param {?} el + * @param {?} name + * @param {?} value + * @param {?=} namespace + * @return {?} + */ + function (el, name, value, namespace) { + this.delegate.setAttribute(el, name, value, namespace); + }; + /** + * @param {?} el + * @param {?} name + * @param {?=} namespace + * @return {?} + */ + BaseAnimationRenderer.prototype.removeAttribute = /** + * @param {?} el + * @param {?} name + * @param {?=} namespace + * @return {?} + */ + function (el, name, namespace) { + this.delegate.removeAttribute(el, name, namespace); + }; + /** + * @param {?} el + * @param {?} name + * @return {?} + */ + BaseAnimationRenderer.prototype.addClass = /** + * @param {?} el + * @param {?} name + * @return {?} + */ + function (el, name) { this.delegate.addClass(el, name); }; + /** + * @param {?} el + * @param {?} name + * @return {?} + */ + BaseAnimationRenderer.prototype.removeClass = /** + * @param {?} el + * @param {?} name + * @return {?} + */ + function (el, name) { this.delegate.removeClass(el, name); }; + /** + * @param {?} el + * @param {?} style + * @param {?} value + * @param {?=} flags + * @return {?} + */ + BaseAnimationRenderer.prototype.setStyle = /** + * @param {?} el + * @param {?} style + * @param {?} value + * @param {?=} flags + * @return {?} + */ + function (el, style, value, flags) { + this.delegate.setStyle(el, style, value, flags); + }; + /** + * @param {?} el + * @param {?} style + * @param {?=} flags + * @return {?} + */ + BaseAnimationRenderer.prototype.removeStyle = /** + * @param {?} el + * @param {?} style + * @param {?=} flags + * @return {?} + */ + function (el, style, flags) { + this.delegate.removeStyle(el, style, flags); + }; + /** + * @param {?} el + * @param {?} name + * @param {?} value + * @return {?} + */ + BaseAnimationRenderer.prototype.setProperty = /** + * @param {?} el + * @param {?} name + * @param {?} value + * @return {?} + */ + function (el, name, value) { + if (name.charAt(0) == ANIMATION_PREFIX && name == DISABLE_ANIMATIONS_FLAG) { + this.disableAnimations(el, !!value); + } + else { + this.delegate.setProperty(el, name, value); + } + }; + /** + * @param {?} node + * @param {?} value + * @return {?} + */ + BaseAnimationRenderer.prototype.setValue = /** + * @param {?} node + * @param {?} value + * @return {?} + */ + function (node, value) { this.delegate.setValue(node, value); }; + /** + * @param {?} target + * @param {?} eventName + * @param {?} callback + * @return {?} + */ + BaseAnimationRenderer.prototype.listen = /** + * @param {?} target + * @param {?} eventName + * @param {?} callback + * @return {?} + */ + function (target, eventName, callback) { + return this.delegate.listen(target, eventName, callback); + }; + /** + * @param {?} element + * @param {?} value + * @return {?} + */ + BaseAnimationRenderer.prototype.disableAnimations = /** + * @param {?} element + * @param {?} value + * @return {?} + */ + function (element, value) { + this.engine.disableAnimations(element, value); + }; + return BaseAnimationRenderer; +}()); +var AnimationRenderer = (function (_super) { + __extends(AnimationRenderer, _super); + function AnimationRenderer(factory, namespaceId, delegate, engine) { + var _this = _super.call(this, namespaceId, delegate, engine) || this; + _this.factory = factory; + _this.namespaceId = namespaceId; + return _this; + } + /** + * @param {?} el + * @param {?} name + * @param {?} value + * @return {?} + */ + AnimationRenderer.prototype.setProperty = /** + * @param {?} el + * @param {?} name + * @param {?} value + * @return {?} + */ + function (el, name, value) { + if (name.charAt(0) == ANIMATION_PREFIX) { + if (name.charAt(1) == '.' && name == DISABLE_ANIMATIONS_FLAG) { + value = value === undefined ? true : !!value; + this.disableAnimations(el, /** @type {?} */ (value)); + } + else { + this.engine.process(this.namespaceId, el, name.substr(1), value); + } + } + else { + this.delegate.setProperty(el, name, value); + } + }; + /** + * @param {?} target + * @param {?} eventName + * @param {?} callback + * @return {?} + */ + AnimationRenderer.prototype.listen = /** + * @param {?} target + * @param {?} eventName + * @param {?} callback + * @return {?} + */ + function (target, eventName, callback) { + var _this = this; + if (eventName.charAt(0) == ANIMATION_PREFIX) { + var /** @type {?} */ element = resolveElementFromTarget(target); + var /** @type {?} */ name_1 = eventName.substr(1); + var /** @type {?} */ phase = ''; + // @listener.phase is for trigger animation callbacks + // @@listener is for animation builder callbacks + if (name_1.charAt(0) != ANIMATION_PREFIX) { + _a = parseTriggerCallbackName(name_1), name_1 = _a[0], phase = _a[1]; + } + return this.engine.listen(this.namespaceId, element, name_1, phase, function (event) { + var /** @type {?} */ countId = (/** @type {?} */ (event))['_data'] || -1; + _this.factory.scheduleListenerCallback(countId, callback, event); + }); + } + return this.delegate.listen(target, eventName, callback); + var _a; + }; + return AnimationRenderer; +}(BaseAnimationRenderer)); +/** + * @param {?} target + * @return {?} + */ +function resolveElementFromTarget(target) { + switch (target) { + case 'body': + return document.body; + case 'document': + return document; + case 'window': + return window; + default: + return target; + } +} +/** + * @param {?} triggerName + * @return {?} + */ +function parseTriggerCallbackName(triggerName) { + var /** @type {?} */ dotIndex = triggerName.indexOf('.'); + var /** @type {?} */ trigger = triggerName.substring(0, dotIndex); + var /** @type {?} */ phase = triggerName.substr(dotIndex + 1); + return [trigger, phase]; +} -/***/ }), -/* 203 */ -/***/ (function(module, exports, __webpack_require__) { +/** + * @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 InjectableAnimationEngine = (function (_super) { + __extends(InjectableAnimationEngine, _super); + function InjectableAnimationEngine(driver, normalizer) { + return _super.call(this, driver, normalizer) || this; + } + InjectableAnimationEngine.decorators = [ + { type: _angular_core.Injectable }, + ]; + /** @nocollapse */ + InjectableAnimationEngine.ctorParameters = function () { return [ + { type: _angular_animations_browser.AnimationDriver, }, + { type: _angular_animations_browser.ɵAnimationStyleNormalizer, }, + ]; }; + return InjectableAnimationEngine; +}(_angular_animations_browser.ɵAnimationEngine)); +/** + * @return {?} + */ +function instantiateSupportedAnimationDriver() { + if (_angular_animations_browser.ɵsupportsWebAnimations()) { + return new _angular_animations_browser.ɵWebAnimationsDriver(); + } + return new _angular_animations_browser.ɵNoopAnimationDriver(); +} +/** + * @return {?} + */ +function instantiateDefaultStyleNormalizer() { + return new _angular_animations_browser.ɵWebAnimationsStyleNormalizer(); +} +/** + * @param {?} renderer + * @param {?} engine + * @param {?} zone + * @return {?} + */ +function instantiateRendererFactory(renderer, engine, zone) { + return new AnimationRendererFactory(renderer, engine, zone); +} +var SHARED_ANIMATION_PROVIDERS = [ + { provide: _angular_animations.AnimationBuilder, useClass: BrowserAnimationBuilder }, + { provide: _angular_animations_browser.ɵAnimationStyleNormalizer, useFactory: instantiateDefaultStyleNormalizer }, + { provide: _angular_animations_browser.ɵAnimationEngine, useClass: InjectableAnimationEngine }, { + provide: _angular_core.RendererFactory2, + useFactory: instantiateRendererFactory, + deps: [_angular_platformBrowser.ɵDomRendererFactory2, _angular_animations_browser.ɵAnimationEngine, _angular_core.NgZone] + } +]; +/** + * Separate providers from the actual module so that we can do a local modification in Google3 to + * include them in the BrowserModule. + */ +var BROWSER_ANIMATIONS_PROVIDERS = [ + { provide: _angular_animations_browser.AnimationDriver, useFactory: instantiateSupportedAnimationDriver } +].concat(SHARED_ANIMATION_PROVIDERS); +/** + * Separate providers from the actual module so that we can do a local modification in Google3 to + * include them in the BrowserTestingModule. + */ +var BROWSER_NOOP_ANIMATIONS_PROVIDERS = [{ provide: _angular_animations_browser.AnimationDriver, useClass: _angular_animations_browser.ɵNoopAnimationDriver }].concat(SHARED_ANIMATION_PROVIDERS); -"use strict"; +/** + * @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 + */ +/** + * \@experimental Animation support is experimental. + */ +var BrowserAnimationsModule = (function () { + function BrowserAnimationsModule() { + } + BrowserAnimationsModule.decorators = [ + { type: _angular_core.NgModule, args: [{ + exports: [_angular_platformBrowser.BrowserModule], + providers: BROWSER_ANIMATIONS_PROVIDERS, + },] }, + ]; + /** @nocollapse */ + BrowserAnimationsModule.ctorParameters = function () { return []; }; + return BrowserAnimationsModule; +}()); +/** + * \@experimental Animation support is experimental. + */ +var NoopAnimationsModule = (function () { + function NoopAnimationsModule() { + } + NoopAnimationsModule.decorators = [ + { type: _angular_core.NgModule, args: [{ + exports: [_angular_platformBrowser.BrowserModule], + providers: BROWSER_NOOP_ANIMATIONS_PROVIDERS, + },] }, + ]; + /** @nocollapse */ + NoopAnimationsModule.ctorParameters = function () { return []; }; + return NoopAnimationsModule; +}()); -var Observable_1 = __webpack_require__(0); -var publishReplay_1 = __webpack_require__(321); -Observable_1.Observable.prototype.publishReplay = publishReplay_1.publishReplay; -//# sourceMappingURL=publishReplay.js.map +exports.BrowserAnimationsModule = BrowserAnimationsModule; +exports.NoopAnimationsModule = NoopAnimationsModule; +exports.ɵBrowserAnimationBuilder = BrowserAnimationBuilder; +exports.ɵBrowserAnimationFactory = BrowserAnimationFactory; +exports.ɵAnimationRenderer = AnimationRenderer; +exports.ɵAnimationRendererFactory = AnimationRendererFactory; +exports.ɵa = BaseAnimationRenderer; +exports.ɵf = BROWSER_ANIMATIONS_PROVIDERS; +exports.ɵg = BROWSER_NOOP_ANIMATIONS_PROVIDERS; +exports.ɵb = InjectableAnimationEngine; +exports.ɵd = instantiateDefaultStyleNormalizer; +exports.ɵe = instantiateRendererFactory; +exports.ɵc = instantiateSupportedAnimationDriver; -/***/ }), -/* 204 */ -/***/ (function(module, exports, __webpack_require__) { +Object.defineProperty(exports, '__esModule', { value: true }); -"use strict"; +}))); +//# sourceMappingURL=platform-browser-animations.umd.js.map -var Observable_1 = __webpack_require__(0); -var race_1 = __webpack_require__(64); -Observable_1.Observable.prototype.race = race_1.race; -//# sourceMappingURL=race.js.map /***/ }), -/* 205 */ -/***/ (function(module, exports, __webpack_require__) { +/* 64 */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return AppModuleShared; }); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__(4); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0__angular_core__); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__angular_common__ = __webpack_require__(5); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__angular_common___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1__angular_common__); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__angular_forms__ = __webpack_require__(129); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__angular_forms___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2__angular_forms__); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__angular_common_http__ = __webpack_require__(13); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__angular_common_http___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_3__angular_common_http__); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__angular_router__ = __webpack_require__(52); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__angular_router___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_4__angular_router__); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__components_app_app_component__ = __webpack_require__(28); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__components_navmenu_navmenu_component__ = __webpack_require__(68); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__components_home_home_component__ = __webpack_require__(67); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__components_fetchdata_fetchdata_component__ = __webpack_require__(66); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_9__components_counter_counter_component__ = __webpack_require__(65); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_10__components_unauthorized_unauthorized_component__ = __webpack_require__(69); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_11_angular_auth_oidc_client__ = __webpack_require__(27); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_11_angular_auth_oidc_client___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_11_angular_auth_oidc_client__); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_12__components_services_auth_service__ = __webpack_require__(14); +var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { + var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); + else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; + return c > 3 && r && Object.defineProperty(target, key, r), r; +}; + + + + + + + + + + + + + +var AppModuleShared = (function () { + function AppModuleShared() { + } + AppModuleShared = __decorate([ + __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_0__angular_core__["NgModule"])({ + declarations: [ + __WEBPACK_IMPORTED_MODULE_5__components_app_app_component__["a" /* AppComponent */], + __WEBPACK_IMPORTED_MODULE_6__components_navmenu_navmenu_component__["a" /* NavMenuComponent */], + __WEBPACK_IMPORTED_MODULE_9__components_counter_counter_component__["a" /* CounterComponent */], + __WEBPACK_IMPORTED_MODULE_8__components_fetchdata_fetchdata_component__["a" /* FetchDataComponent */], + __WEBPACK_IMPORTED_MODULE_7__components_home_home_component__["a" /* HomeComponent */], + __WEBPACK_IMPORTED_MODULE_10__components_unauthorized_unauthorized_component__["a" /* UnauthorizedComponent */] + ], + imports: [ + __WEBPACK_IMPORTED_MODULE_11_angular_auth_oidc_client__["AuthModule"].forRoot(), + __WEBPACK_IMPORTED_MODULE_1__angular_common__["CommonModule"], + __WEBPACK_IMPORTED_MODULE_3__angular_common_http__["HttpClientModule"], + __WEBPACK_IMPORTED_MODULE_2__angular_forms__["FormsModule"], + __WEBPACK_IMPORTED_MODULE_4__angular_router__["RouterModule"].forRoot([ + { path: '', redirectTo: 'home', pathMatch: 'full' }, + { path: 'home', component: __WEBPACK_IMPORTED_MODULE_7__components_home_home_component__["a" /* HomeComponent */] }, + { path: 'unauthorized', component: __WEBPACK_IMPORTED_MODULE_10__components_unauthorized_unauthorized_component__["a" /* UnauthorizedComponent */] }, + { path: 'counter', component: __WEBPACK_IMPORTED_MODULE_9__components_counter_counter_component__["a" /* CounterComponent */] }, + { path: 'fetch-data', component: __WEBPACK_IMPORTED_MODULE_8__components_fetchdata_fetchdata_component__["a" /* FetchDataComponent */] }, + { path: '**', redirectTo: 'home' } + ]) + ], + providers: [ + __WEBPACK_IMPORTED_MODULE_12__components_services_auth_service__["a" /* AuthService */], + __WEBPACK_IMPORTED_MODULE_11_angular_auth_oidc_client__["OidcSecurityService"] + ] + }) + ], AppModuleShared); + return AppModuleShared; +}()); + -var Observable_1 = __webpack_require__(0); -var reduce_1 = __webpack_require__(43); -Observable_1.Observable.prototype.reduce = reduce_1.reduce; -//# sourceMappingURL=reduce.js.map /***/ }), -/* 206 */ -/***/ (function(module, exports, __webpack_require__) { +/* 65 */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return CounterComponent; }); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__(4); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0__angular_core__); +var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { + var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); + else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; + return c > 3 && r && Object.defineProperty(target, key, r), r; +}; + +var CounterComponent = (function () { + function CounterComponent() { + this.currentCount = 0; + } + CounterComponent.prototype.incrementCounter = function () { + this.currentCount++; + }; + CounterComponent = __decorate([ + __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Component"])({ + selector: 'counter', + template: __webpack_require__(84) + }) + ], CounterComponent); + return CounterComponent; +}()); + -var Observable_1 = __webpack_require__(0); -var repeat_1 = __webpack_require__(322); -Observable_1.Observable.prototype.repeat = repeat_1.repeat; -//# sourceMappingURL=repeat.js.map /***/ }), -/* 207 */ -/***/ (function(module, exports, __webpack_require__) { +/* 66 */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return FetchDataComponent; }); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__(4); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0__angular_core__); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__services_auth_service__ = __webpack_require__(14); +var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { + var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); + else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; + return c > 3 && r && Object.defineProperty(target, key, r), r; +}; +var __metadata = (this && this.__metadata) || function (k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); +}; +var __param = (this && this.__param) || function (paramIndex, decorator) { + return function (target, key) { decorator(target, key, paramIndex); } +}; + + +var FetchDataComponent = (function () { + function FetchDataComponent(authService, apiUrl) { + var _this = this; + authService.get(apiUrl + 'SampleData/WeatherForecasts').subscribe(function (result) { + _this.forecasts = result; + }, function (error) { return console.error(error); }); + } + FetchDataComponent = __decorate([ + __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Component"])({ + selector: 'fetchdata', + template: __webpack_require__(85) + }), + __param(1, __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Inject"])('API_URL')), + __metadata("design:paramtypes", [__WEBPACK_IMPORTED_MODULE_1__services_auth_service__["a" /* AuthService */], String]) + ], FetchDataComponent); + return FetchDataComponent; +}()); + -var Observable_1 = __webpack_require__(0); -var repeatWhen_1 = __webpack_require__(323); -Observable_1.Observable.prototype.repeatWhen = repeatWhen_1.repeatWhen; -//# sourceMappingURL=repeatWhen.js.map /***/ }), -/* 208 */ -/***/ (function(module, exports, __webpack_require__) { +/* 67 */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return HomeComponent; }); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__(4); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0__angular_core__); +var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { + var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); + else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; + return c > 3 && r && Object.defineProperty(target, key, r), r; +}; + +var HomeComponent = (function () { + function HomeComponent() { + } + HomeComponent = __decorate([ + __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Component"])({ + selector: 'home', + template: __webpack_require__(86) + }) + ], HomeComponent); + return HomeComponent; +}()); + -var Observable_1 = __webpack_require__(0); -var retry_1 = __webpack_require__(324); -Observable_1.Observable.prototype.retry = retry_1.retry; -//# sourceMappingURL=retry.js.map /***/ }), -/* 209 */ -/***/ (function(module, exports, __webpack_require__) { +/* 68 */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return NavMenuComponent; }); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__(4); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0__angular_core__); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__services_auth_service__ = __webpack_require__(14); +var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { + var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); + else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; + return c > 3 && r && Object.defineProperty(target, key, r), r; +}; +var __metadata = (this && this.__metadata) || function (k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); +}; + + +var NavMenuComponent = (function () { + function NavMenuComponent(authService) { + this.authService = authService; + } + NavMenuComponent.prototype.ngOnInit = function () { + var _this = this; + this.isAuthorizedSubscription = this.authService.getIsAuthorized().subscribe(function (isAuthorized) { + _this.isAuthorized = isAuthorized; + }); + }; + NavMenuComponent.prototype.ngOnDestroy = function () { + this.isAuthorizedSubscription.unsubscribe(); + }; + NavMenuComponent.prototype.login = function () { + this.authService.login(); + }; + NavMenuComponent.prototype.refreshSession = function () { + this.authService.refreshSession(); + }; + NavMenuComponent.prototype.logout = function () { + this.authService.logout(); + }; + NavMenuComponent = __decorate([ + __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Component"])({ + selector: 'nav-menu', + template: __webpack_require__(87), + styles: [__webpack_require__(119)] + }), + __metadata("design:paramtypes", [__WEBPACK_IMPORTED_MODULE_1__services_auth_service__["a" /* AuthService */]]) + ], NavMenuComponent); + return NavMenuComponent; +}()); + -var Observable_1 = __webpack_require__(0); -var retryWhen_1 = __webpack_require__(325); -Observable_1.Observable.prototype.retryWhen = retryWhen_1.retryWhen; -//# sourceMappingURL=retryWhen.js.map /***/ }), -/* 210 */ -/***/ (function(module, exports, __webpack_require__) { +/* 69 */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return UnauthorizedComponent; }); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__(4); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0__angular_core__); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__angular_common__ = __webpack_require__(5); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__angular_common___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1__angular_common__); +var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { + var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); + else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; + return c > 3 && r && Object.defineProperty(target, key, r), r; +}; +var __metadata = (this && this.__metadata) || function (k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); +}; + + +var UnauthorizedComponent = (function () { + function UnauthorizedComponent(location) { + this.location = location; + } + UnauthorizedComponent.prototype.ngOnInit = function () { + }; + UnauthorizedComponent.prototype.login = function () { + //this.service.startSigninMainWindow(); + }; + UnauthorizedComponent.prototype.goback = function () { + this.location.back(); + }; + UnauthorizedComponent = __decorate([ + __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Component"])({ + selector: 'app-unauthorized', + template: __webpack_require__(88) + }), + __metadata("design:paramtypes", [__WEBPACK_IMPORTED_MODULE_1__angular_common__["Location"]]) + ], UnauthorizedComponent); + return UnauthorizedComponent; +}()); + -var Observable_1 = __webpack_require__(0); -var sample_1 = __webpack_require__(326); -Observable_1.Observable.prototype.sample = sample_1.sample; -//# sourceMappingURL=sample.js.map /***/ }), -/* 211 */ -/***/ (function(module, exports, __webpack_require__) { +/* 70 */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; +Object.defineProperty(__webpack_exports__, "__esModule", { value: true }); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_reflect_metadata__ = __webpack_require__(59); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_reflect_metadata___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_reflect_metadata__); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_zone_js__ = __webpack_require__(62); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_zone_js___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_zone_js__); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_rxjs_add_operator_first__ = __webpack_require__(60); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_rxjs_add_operator_first___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2_rxjs_add_operator_first__); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__angular_common__ = __webpack_require__(5); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__angular_common___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_3__angular_common__); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__angular_core__ = __webpack_require__(4); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__angular_core___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_4__angular_core__); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__angular_platform_server__ = __webpack_require__(25); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__angular_platform_server___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_5__angular_platform_server__); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6_aspnet_prerendering__ = __webpack_require__(61); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6_aspnet_prerendering___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_6_aspnet_prerendering__); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__app_app_module_server__ = __webpack_require__(58); + + + + + + + + +__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_4__angular_core__["enableProdMode"])(); +/* harmony default export */ __webpack_exports__["default"] = (__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_6_aspnet_prerendering__["createServerRenderer"])(function (params) { + var providers = [ + { provide: __WEBPACK_IMPORTED_MODULE_5__angular_platform_server__["INITIAL_CONFIG"], useValue: { document: '', url: params.url } }, + { provide: __WEBPACK_IMPORTED_MODULE_3__angular_common__["APP_BASE_HREF"], useValue: params.baseUrl }, + { provide: 'BASE_URL', useValue: params.origin + params.baseUrl }, + { provide: 'ORIGIN_URL', useValue: params.origin + params.baseUrl }, + { provide: 'API_URL', useValue: params.data.apiUrl }, + { provide: 'IDENTITY_URL', useValue: params.data.identityUrl }, + { provide: 'URL_CONFIG', useValue: params.data } + ]; + return __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_5__angular_platform_server__["platformDynamicServer"])(providers).bootstrapModule(__WEBPACK_IMPORTED_MODULE_7__app_app_module_server__["a" /* AppModule */]).then(function (moduleRef) { + var appRef = moduleRef.injector.get(__WEBPACK_IMPORTED_MODULE_4__angular_core__["ApplicationRef"]); + var state = moduleRef.injector.get(__WEBPACK_IMPORTED_MODULE_5__angular_platform_server__["PlatformState"]); + var zone = moduleRef.injector.get(__WEBPACK_IMPORTED_MODULE_4__angular_core__["NgZone"]); + return new Promise(function (resolve, reject) { + zone.onError.subscribe(function (errorInfo) { return reject(errorInfo); }); + appRef.isStable.first(function (isStable) { return isStable; }).subscribe(function () { + // Because 'onStable' fires before 'onError', we have to delay slightly before + // completing the request in case there's an error to report + setImmediate(function () { + resolve({ + html: state.renderToString(), + globals: { url_Config: params.data } + }); + moduleRef.destroy(); + }); + }); + }); + }); +})); -var Observable_1 = __webpack_require__(0); -var sampleTime_1 = __webpack_require__(327); -Observable_1.Observable.prototype.sampleTime = sampleTime_1.sampleTime; -//# sourceMappingURL=sampleTime.js.map /***/ }), -/* 212 */ +/* 71 */ /***/ (function(module, exports, __webpack_require__) { -"use strict"; +exports = module.exports = __webpack_require__(54)(undefined); +// imports -var Observable_1 = __webpack_require__(0); -var scan_1 = __webpack_require__(328); -Observable_1.Observable.prototype.scan = scan_1.scan; -//# sourceMappingURL=scan.js.map -/***/ }), -/* 213 */ -/***/ (function(module, exports, __webpack_require__) { +// module +exports.push([module.i, "@media (max-width: 767px) {\r\n /* On small screens, the nav menu spans the full width of the screen. Leave a space for it. */\r\n .body-content {\r\n padding-top: 50px;\r\n }\r\n}\r\n", ""]); -"use strict"; +// exports -var Observable_1 = __webpack_require__(0); -var sequenceEqual_1 = __webpack_require__(329); -Observable_1.Observable.prototype.sequenceEqual = sequenceEqual_1.sequenceEqual; -//# sourceMappingURL=sequenceEqual.js.map /***/ }), -/* 214 */ +/* 72 */ /***/ (function(module, exports, __webpack_require__) { -"use strict"; +exports = module.exports = __webpack_require__(54)(undefined); +// imports -var Observable_1 = __webpack_require__(0); -var share_1 = __webpack_require__(398); -Observable_1.Observable.prototype.share = share_1.share; -//# sourceMappingURL=share.js.map -/***/ }), -/* 215 */ -/***/ (function(module, exports, __webpack_require__) { +// module +exports.push([module.i, "li .glyphicon {\r\n margin-right: 10px;\r\n}\r\n\r\n/* Highlighting rules for nav menu items */\r\nli.link-active a,\r\nli.link-active a:hover,\r\nli.link-active a:focus {\r\n background-color: #4189C7;\r\n color: white;\r\n}\r\n\r\n/* Keep the nav menu independent of scrolling and on top of other items */\r\n.main-nav {\r\n position: fixed;\r\n top: 0;\r\n left: 0;\r\n right: 0;\r\n z-index: 1;\r\n}\r\n\r\n@media (min-width: 768px) {\r\n /* On small screens, convert the nav menu to a vertical sidebar */\r\n .main-nav {\r\n height: 100%;\r\n width: calc(25% - 20px);\r\n }\r\n .navbar {\r\n border-radius: 0px;\r\n border-width: 0px;\r\n height: 100%;\r\n }\r\n .navbar-header {\r\n float: none;\r\n }\r\n .navbar-collapse {\r\n border-top: 1px solid #444;\r\n padding: 0px;\r\n }\r\n .navbar ul {\r\n float: none;\r\n }\r\n .navbar li {\r\n float: none;\r\n font-size: 15px;\r\n margin: 6px;\r\n }\r\n .navbar li a {\r\n padding: 10px 16px;\r\n border-radius: 4px;\r\n }\r\n .navbar a {\r\n /* If a menu item's text is too long, truncate it */\r\n width: 100%;\r\n white-space: nowrap;\r\n overflow: hidden;\r\n text-overflow: ellipsis;\r\n }\r\n}\r\n", ""]); -"use strict"; +// exports -var Observable_1 = __webpack_require__(0); -var shareReplay_1 = __webpack_require__(330); -Observable_1.Observable.prototype.shareReplay = shareReplay_1.shareReplay; -//# sourceMappingURL=shareReplay.js.map /***/ }), -/* 216 */ +/* 73 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -var Observable_1 = __webpack_require__(0); -var single_1 = __webpack_require__(331); -Observable_1.Observable.prototype.single = single_1.single; -//# sourceMappingURL=single.js.map +module.exports = CustomEvent; -/***/ }), -/* 217 */ -/***/ (function(module, exports, __webpack_require__) { +var Event = __webpack_require__(7); -"use strict"; +function CustomEvent(type, dictionary) { + // Just use the superclass constructor to initialize + Event.call(this, type, dictionary); +} +CustomEvent.prototype = Object.create(Event.prototype, { + constructor: { value: CustomEvent } +}); -var Observable_1 = __webpack_require__(0); -var skip_1 = __webpack_require__(332); -Observable_1.Observable.prototype.skip = skip_1.skip; -//# sourceMappingURL=skip.js.map /***/ }), -/* 218 */ +/* 74 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -var Observable_1 = __webpack_require__(0); -var skipLast_1 = __webpack_require__(333); -Observable_1.Observable.prototype.skipLast = skipLast_1.skipLast; -//# sourceMappingURL=skipLast.js.map +module.exports = FilteredElementList; -/***/ }), -/* 219 */ -/***/ (function(module, exports, __webpack_require__) { +var Node = __webpack_require__(3); -"use strict"; +// +// This file defines node list implementation that lazily traverses +// the document tree (or a subtree rooted at any element) and includes +// only those elements for which a specified filter function returns true. +// It is used to implement the +// {Document,Element}.getElementsBy{TagName,ClassName}{,NS} methods. +// -var Observable_1 = __webpack_require__(0); -var skipUntil_1 = __webpack_require__(334); -Observable_1.Observable.prototype.skipUntil = skipUntil_1.skipUntil; -//# sourceMappingURL=skipUntil.js.map +function FilteredElementList(root, filter) { + this.root = root; + this.filter = filter; + this.lastModTime = root.lastModTime; + this.done = false; + this.cache = []; + this.traverse(); +} -/***/ }), -/* 220 */ -/***/ (function(module, exports, __webpack_require__) { +FilteredElementList.prototype = { + get length() { + this.checkcache(); + if (!this.done) this.traverse(); + return this.cache.length; + }, -"use strict"; + item: function(n) { + this.checkcache(); + if (!this.done && n >= this.cache.length) this.traverse(n); + return this.cache[n]; + }, -var Observable_1 = __webpack_require__(0); -var skipWhile_1 = __webpack_require__(335); -Observable_1.Observable.prototype.skipWhile = skipWhile_1.skipWhile; -//# sourceMappingURL=skipWhile.js.map + checkcache: function() { + if (this.lastModTime !== this.root.lastModTime) { + // subtree has changed, so invalidate cache + for (var i = this.cache.length-1; i>=0; i--) { + this[i] = undefined; + } + this.cache.length = 0; + this.done = false; + this.lastModTime = this.root.lastModTime; + } + }, + + // If n is specified, then traverse the tree until we've found the nth + // item (or until we've found all items). If n is not specified, + // traverse until we've found all items. + traverse: function(n) { + // increment n so we can compare to length, and so it is never falsy + if (n !== undefined) n++; + + var elt; + while ((elt = this.next()) !== null) { + this[this.cache.length] = elt; //XXX Use proxy instead + this.cache.push(elt); + if (n && this.cache.length === n) return; + } + + // no next element, so we've found everything + this.done = true; + }, + + // Return the next element under root that matches filter + next: function() { + var start = (this.cache.length === 0) ? this.root // Start at the root or at + : this.cache[this.cache.length-1]; // the last element we found + + var elt; + if (start.nodeType === Node.DOCUMENT_NODE) + elt = start.documentElement; + else + elt = start.nextElement(this.root); -/***/ }), -/* 221 */ -/***/ (function(module, exports, __webpack_require__) { + while(elt) { + if (this.filter(elt)) { + return elt; + } -"use strict"; + elt = elt.nextElement(this.root); + } + return null; + } +}; -var Observable_1 = __webpack_require__(0); -var startWith_1 = __webpack_require__(336); -Observable_1.Observable.prototype.startWith = startWith_1.startWith; -//# sourceMappingURL=startWith.js.map /***/ }), -/* 222 */ +/* 75 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -var Observable_1 = __webpack_require__(0); -var subscribeOn_1 = __webpack_require__(337); -Observable_1.Observable.prototype.subscribeOn = subscribeOn_1.subscribeOn; -//# sourceMappingURL=subscribeOn.js.map +var URL = __webpack_require__(20); +var URLUtils = __webpack_require__(41); -/***/ }), -/* 223 */ -/***/ (function(module, exports, __webpack_require__) { +module.exports = Location; -"use strict"; +function Location(window, href) { + this._window = window; + this._href = href; +} -var Observable_1 = __webpack_require__(0); -var switch_1 = __webpack_require__(338); -Observable_1.Observable.prototype.switch = switch_1._switch; -Observable_1.Observable.prototype._switch = switch_1._switch; -//# sourceMappingURL=switch.js.map +Location.prototype = Object.create(URLUtils.prototype, { + constructor: { value: Location }, -/***/ }), -/* 224 */ -/***/ (function(module, exports, __webpack_require__) { + // Special behavior when href is set + href: { + get: function() { return this._href; }, + set: function(v) { this.assign(v); } + }, -"use strict"; + assign: { value: function(url) { + // Resolve the new url against the current one + // XXX: + // This is not actually correct. It should be resolved against + // the URL of the document of the script. For now, though, I only + // support a single window and there is only one base url. + // So this is good enough for now. + var current = new URL(this._href); + var newurl = current.resolve(url); -var Observable_1 = __webpack_require__(0); -var switchMap_1 = __webpack_require__(339); -Observable_1.Observable.prototype.switchMap = switchMap_1.switchMap; -//# sourceMappingURL=switchMap.js.map + // Save the new url + this._href = newurl; -/***/ }), -/* 225 */ -/***/ (function(module, exports, __webpack_require__) { + // Start loading the new document! + // XXX + // This is just something hacked together. + // The real algorithm is: http://www.whatwg.org/specs/web-apps/current-work/multipage/history.html#navigate + }}, -"use strict"; + replace: { value: function(url) { + // XXX + // Since we aren't tracking history yet, replace is the same as assign + this.assign(url); + }}, -var Observable_1 = __webpack_require__(0); -var switchMapTo_1 = __webpack_require__(340); -Observable_1.Observable.prototype.switchMapTo = switchMapTo_1.switchMapTo; -//# sourceMappingURL=switchMapTo.js.map + reload: { value: function() { + // XXX: + // Actually, the spec is a lot more complicated than this + this.assign(this.href); + }}, -/***/ }), -/* 226 */ -/***/ (function(module, exports, __webpack_require__) { + toString: { value: function() { + return this.href; + }} -"use strict"; +}); -var Observable_1 = __webpack_require__(0); -var take_1 = __webpack_require__(341); -Observable_1.Observable.prototype.take = take_1.take; -//# sourceMappingURL=take.js.map /***/ }), -/* 227 */ +/* 76 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -var Observable_1 = __webpack_require__(0); -var takeLast_1 = __webpack_require__(342); -Observable_1.Observable.prototype.takeLast = takeLast_1.takeLast; -//# sourceMappingURL=takeLast.js.map +module.exports = { + VALUE: 1, // The value of a Text, Comment or PI node changed + ATTR: 2, // A new attribute was added or an attribute value and/or prefix changed + REMOVE_ATTR: 3, // An attribute was removed + REMOVE: 4, // A node was removed + MOVE: 5, // A node was moved + INSERT: 6 // A node (or a subtree of nodes) was inserted +}; /***/ }), -/* 228 */ +/* 77 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -var Observable_1 = __webpack_require__(0); -var takeUntil_1 = __webpack_require__(343); -Observable_1.Observable.prototype.takeUntil = takeUntil_1.takeUntil; -//# sourceMappingURL=takeUntil.js.map -/***/ }), -/* 229 */ -/***/ (function(module, exports, __webpack_require__) { +// https://html.spec.whatwg.org/multipage/webappapis.html#navigatorid +var NavigatorID = Object.create(null, { + appCodeName: { value: "Mozilla" }, + appName: { value: "Netscape" }, + appVersion: { value: "4.0" }, + platform: { value: "" }, + product: { value: "Gecko" }, + productSub: { value: "20100101" }, + userAgent: { value: "" }, + vendor: { value: "" }, + vendorSub: { value: "" }, + taintEnabled: { value: function() { return false; } } +}); -"use strict"; +module.exports = NavigatorID; -var Observable_1 = __webpack_require__(0); -var takeWhile_1 = __webpack_require__(344); -Observable_1.Observable.prototype.takeWhile = takeWhile_1.takeWhile; -//# sourceMappingURL=takeWhile.js.map /***/ }), -/* 230 */ +/* 78 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -var Observable_1 = __webpack_require__(0); -var throttle_1 = __webpack_require__(65); -Observable_1.Observable.prototype.throttle = throttle_1.throttle; -//# sourceMappingURL=throttle.js.map +module.exports = NodeIterator; -/***/ }), -/* 231 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; +var NodeFilter = __webpack_require__(10); +var NodeTraversal = __webpack_require__(36); -var Observable_1 = __webpack_require__(0); -var throttleTime_1 = __webpack_require__(345); -Observable_1.Observable.prototype.throttleTime = throttleTime_1.throttleTime; -//# sourceMappingURL=throttleTime.js.map +/* Private methods and helpers */ -/***/ }), -/* 232 */ -/***/ (function(module, exports, __webpack_require__) { +/** + * @based on WebKit's NodeIterator::moveToNext and NodeIterator::moveToPrevious + * https://trac.webkit.org/browser/trunk/Source/WebCore/dom/NodeIterator.cpp?rev=186279#L51 + */ +function move(node, stayWithin, directionIsNext) { + if (directionIsNext) { + return NodeTraversal.next(node, stayWithin); + } else { + if (node === stayWithin) { + return null; + } + return NodeTraversal.previous(node, null); + } +} -"use strict"; +/** + * @spec http://www.w3.org/TR/dom/#concept-nodeiterator-traverse + * @method + * @access private + * @param {NodeIterator} ni + * @param {string} direction One of 'next' or 'previous'. + * @return {Node|null} + */ +function traverse(ni, directionIsNext) { + var node, beforeNode; + node = ni.referenceNode; + beforeNode = ni.pointerBeforeReferenceNode; + while (true) { + if (beforeNode === directionIsNext) { + beforeNode = !beforeNode; + } else { + node = move(node, ni.root, directionIsNext); + if (node === null) { + return null; + } + } + var result = ni.filter.acceptNode(node); + if (result === NodeFilter.FILTER_ACCEPT) { + break; + } + } + ni.referenceNode = node; + ni.pointerBeforeReferenceNode = beforeNode; + return node; +} -var Observable_1 = __webpack_require__(0); -var timeInterval_1 = __webpack_require__(66); -Observable_1.Observable.prototype.timeInterval = timeInterval_1.timeInterval; -//# sourceMappingURL=timeInterval.js.map +/* Public API */ -/***/ }), -/* 233 */ -/***/ (function(module, exports, __webpack_require__) { +/** + * Implemented version: http://www.w3.org/TR/2015/WD-dom-20150618/#nodeiterator + * Latest version: http://www.w3.org/TR/dom/#nodeiterator + * + * @constructor + * @param {Node} root + * @param {number} whatToShow [optional] + * @param {Function|NodeFilter} filter [optional] + * @throws Error + */ +function NodeIterator(root, whatToShow, filter) { + var ni = this, active = false; -"use strict"; + if (!root || !root.nodeType) { + throw new Error('DOMException: NOT_SUPPORTED_ERR'); + } -var Observable_1 = __webpack_require__(0); -var timeout_1 = __webpack_require__(346); -Observable_1.Observable.prototype.timeout = timeout_1.timeout; -//# sourceMappingURL=timeout.js.map + ni.root = ni.referenceNode = root; + ni.pointerBeforeReferenceNode = true; + ni.whatToShow = Number(whatToShow) || 0; -/***/ }), -/* 234 */ -/***/ (function(module, exports, __webpack_require__) { + if (typeof filter !== 'function') { + filter = null; + } -"use strict"; + ni.filter = Object.create(NodeFilter.prototype); -var Observable_1 = __webpack_require__(0); -var timeoutWith_1 = __webpack_require__(347); -Observable_1.Observable.prototype.timeoutWith = timeoutWith_1.timeoutWith; -//# sourceMappingURL=timeoutWith.js.map + /** + * @method + * @param {Node} node + * @return {Number} Constant NodeFilter.FILTER_ACCEPT, + * NodeFilter.FILTER_REJECT or NodeFilter.FILTER_SKIP. + */ + ni.filter.acceptNode = function (node) { + /* jshint bitwise: false */ + var result; + if (active) { + throw new Error('DOMException: INVALID_STATE_ERR'); + } -/***/ }), -/* 235 */ -/***/ (function(module, exports, __webpack_require__) { + // Maps nodeType to whatToShow + if (!(((1 << (node.nodeType - 1)) & ni.whatToShow))) { + return NodeFilter.FILTER_SKIP; + } -"use strict"; + if (filter === null) { + return NodeFilter.FILTER_ACCEPT; + } -var Observable_1 = __webpack_require__(0); -var timestamp_1 = __webpack_require__(67); -Observable_1.Observable.prototype.timestamp = timestamp_1.timestamp; -//# sourceMappingURL=timestamp.js.map + active = true; + result = filter(node); + active = false; -/***/ }), -/* 236 */ -/***/ (function(module, exports, __webpack_require__) { + return result; + }; +} -"use strict"; +NodeIterator.prototype = { + constructor: NodeIterator, -var Observable_1 = __webpack_require__(0); -var toArray_1 = __webpack_require__(348); -Observable_1.Observable.prototype.toArray = toArray_1.toArray; -//# sourceMappingURL=toArray.js.map + /** + * @spec http://www.w3.org/TR/dom/#dom-nodeiterator-nextnode + * @method + * @return {Node|null} + */ + nextNode: function () { + return traverse(this, true); + }, -/***/ }), -/* 237 */ -/***/ (function(module, exports, __webpack_require__) { + /** + * @spec http://www.w3.org/TR/dom/#dom-nodeiterator-previousnode + * @method + * @return {Node|null} + */ + previousNode: function () { + return traverse(this, false); + }, -"use strict"; + /** + * @spec http://www.w3.org/TR/dom/#dom-nodeiterator-detach + * @method + * @return void + */ + detach: function() { + /* "The detach() method must do nothing. + * Its functionality (disabling a NodeIterator object) was removed, + * but the method itself is preserved for compatibility. + */ + } +}; -var Observable_1 = __webpack_require__(0); -var toPromise_1 = __webpack_require__(68); -Observable_1.Observable.prototype.toPromise = toPromise_1.toPromise; -//# sourceMappingURL=toPromise.js.map /***/ }), -/* 238 */ +/* 79 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -var Observable_1 = __webpack_require__(0); -var window_1 = __webpack_require__(349); -Observable_1.Observable.prototype.window = window_1.window; -//# sourceMappingURL=window.js.map - -/***/ }), -/* 239 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; +module.exports = TreeWalker; -var Observable_1 = __webpack_require__(0); -var windowCount_1 = __webpack_require__(350); -Observable_1.Observable.prototype.windowCount = windowCount_1.windowCount; -//# sourceMappingURL=windowCount.js.map +var NodeFilter = __webpack_require__(10); +var NodeTraversal = __webpack_require__(36); -/***/ }), -/* 240 */ -/***/ (function(module, exports, __webpack_require__) { +var mapChild = { + first: 'firstChild', + last: 'lastChild', + next: 'firstChild', + previous: 'lastChild' +}; -"use strict"; +var mapSibling = { + first: 'nextSibling', + last: 'previousSibling', + next: 'nextSibling', + previous: 'previousSibling' +}; -var Observable_1 = __webpack_require__(0); -var windowTime_1 = __webpack_require__(351); -Observable_1.Observable.prototype.windowTime = windowTime_1.windowTime; -//# sourceMappingURL=windowTime.js.map +/* Private methods and helpers */ -/***/ }), -/* 241 */ -/***/ (function(module, exports, __webpack_require__) { +/** + * @spec http://www.w3.org/TR/dom/#concept-traverse-children + * @method + * @access private + * @param {TreeWalker} tw + * @param {string} type One of 'first' or 'last'. + * @return {Node|null} + */ +function traverseChildren(tw, type) { + var child, node, parent, result, sibling; + node = tw.currentNode[mapChild[type]]; + while (node !== null) { + result = tw.filter.acceptNode(node); + if (result === NodeFilter.FILTER_ACCEPT) { + tw.currentNode = node; + return node; + } + if (result === NodeFilter.FILTER_SKIP) { + child = node[mapChild[type]]; + if (child !== null) { + node = child; + continue; + } + } + while (node !== null) { + sibling = node[mapSibling[type]]; + if (sibling !== null) { + node = sibling; + break; + } + parent = node.parentNode; + if (parent === null || parent === tw.root || parent === tw.currentNode) { + return null; + } + else { + node = parent; + } + } + } + return null; +} -"use strict"; +/** + * @spec http://www.w3.org/TR/dom/#concept-traverse-siblings + * @method + * @access private + * @param {TreeWalker} tw + * @param {TreeWalker} type One of 'next' or 'previous'. + * @return {Node|nul} + */ +function traverseSiblings(tw, type) { + var node, result, sibling; + node = tw.currentNode; + if (node === tw.root) { + return null; + } + while (true) { + sibling = node[mapSibling[type]]; + while (sibling !== null) { + node = sibling; + result = tw.filter.acceptNode(node); + if (result === NodeFilter.FILTER_ACCEPT) { + tw.currentNode = node; + return node; + } + sibling = node[mapChild[type]]; + if (result === NodeFilter.FILTER_REJECT || sibling === null) { + sibling = node[mapSibling[type]]; + } + } + node = node.parentNode; + if (node === null || node === tw.root) { + return null; + } + if (tw.filter.acceptNode(node) === NodeFilter.FILTER_ACCEPT) { + return null; + } + } +} -var Observable_1 = __webpack_require__(0); -var windowToggle_1 = __webpack_require__(352); -Observable_1.Observable.prototype.windowToggle = windowToggle_1.windowToggle; -//# sourceMappingURL=windowToggle.js.map -/***/ }), -/* 242 */ -/***/ (function(module, exports, __webpack_require__) { +/* Public API */ -"use strict"; +/** + * Implemented version: http://www.w3.org/TR/2015/WD-dom-20150618/#interface-treewalker + * Latest version: http://www.w3.org/TR/dom/#interface-treewalker + * + * @constructor + * @param {Node} root + * @param {number} whatToShow [optional] + * @param {Function|NodeFilter} filter [optional] + * @throws Error + */ +function TreeWalker(root, whatToShow, filter) { + var tw = this, active = false; -var Observable_1 = __webpack_require__(0); -var windowWhen_1 = __webpack_require__(353); -Observable_1.Observable.prototype.windowWhen = windowWhen_1.windowWhen; -//# sourceMappingURL=windowWhen.js.map + if (!root || !root.nodeType) { + throw new Error('DOMException: NOT_SUPPORTED_ERR'); + } -/***/ }), -/* 243 */ -/***/ (function(module, exports, __webpack_require__) { + tw.root = root; + tw.whatToShow = Number(whatToShow) || 0; -"use strict"; + tw.currentNode = root; -var Observable_1 = __webpack_require__(0); -var withLatestFrom_1 = __webpack_require__(354); -Observable_1.Observable.prototype.withLatestFrom = withLatestFrom_1.withLatestFrom; -//# sourceMappingURL=withLatestFrom.js.map + if (typeof filter !== 'function') { + filter = null; + } -/***/ }), -/* 244 */ -/***/ (function(module, exports, __webpack_require__) { + tw.filter = Object.create(NodeFilter.prototype); -"use strict"; + /** + * @method + * @param {Node} node + * @return {Number} Constant NodeFilter.FILTER_ACCEPT, + * NodeFilter.FILTER_REJECT or NodeFilter.FILTER_SKIP. + */ + tw.filter.acceptNode = function (node) { + /* jshint bitwise: false */ + var result; + if (active) { + throw new Error('DOMException: INVALID_STATE_ERR'); + } -var Observable_1 = __webpack_require__(0); -var zip_1 = __webpack_require__(39); -Observable_1.Observable.prototype.zip = zip_1.zipProto; -//# sourceMappingURL=zip.js.map + // Maps nodeType to whatToShow + if (!(((1 << (node.nodeType - 1)) & tw.whatToShow))) { + return NodeFilter.FILTER_SKIP; + } -/***/ }), -/* 245 */ -/***/ (function(module, exports, __webpack_require__) { + if (filter === null) { + return NodeFilter.FILTER_ACCEPT; + } -"use strict"; + active = true; + result = filter(node); + active = false; -var Observable_1 = __webpack_require__(0); -var zipAll_1 = __webpack_require__(355); -Observable_1.Observable.prototype.zipAll = zipAll_1.zipAll; -//# sourceMappingURL=zipAll.js.map + return result; + }; +} -/***/ }), -/* 246 */ -/***/ (function(module, exports, __webpack_require__) { +TreeWalker.prototype = { -"use strict"; + constructor: TreeWalker, -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; -var Observable_1 = __webpack_require__(0); -var tryCatch_1 = __webpack_require__(7); -var errorObject_1 = __webpack_require__(5); -var AsyncSubject_1 = __webpack_require__(25); -/** - * We need this JSDoc comment for affecting ESDoc. - * @extends {Ignored} - * @hide true - */ -var BoundCallbackObservable = (function (_super) { - __extends(BoundCallbackObservable, _super); - function BoundCallbackObservable(callbackFunc, selector, args, context, scheduler) { - _super.call(this); - this.callbackFunc = callbackFunc; - this.selector = selector; - this.args = args; - this.context = context; - this.scheduler = scheduler; + /** + * @spec http://www.w3.org/TR/dom/#dom-treewalker-parentnode + * @method + * @return {Node|null} + */ + parentNode: function () { + var node = this.currentNode; + while (node !== null && node !== this.root) { + node = node.parentNode; + if (node !== null && this.filter.acceptNode(node) === NodeFilter.FILTER_ACCEPT) { + this.currentNode = node; + return node; + } } - /* tslint:enable:max-line-length */ - /** - * Converts a callback API to a function that returns an Observable. - * - * Give it a function `f` of type `f(x, callback)` and - * it will return a function `g` that when called as `g(x)` will output an - * Observable. - * - * `bindCallback` is not an operator because its input and output are not - * Observables. The input is a function `func` with some parameters, but the - * last parameter must be a callback function that `func` calls when it is - * done. - * - * The output of `bindCallback` is a function that takes the same parameters - * as `func`, except the last one (the callback). When the output function - * is called with arguments, it will return an Observable. If `func` function - * calls its callback with one argument, the Observable will emit that value. - * If on the other hand callback is called with multiple values, resulting - * Observable will emit an array with these arguments. - * - * It is very important to remember, that input function `func` is not called - * when output function is, but rather when Observable returned by output - * function is subscribed. This means if `func` makes AJAX request, that request - * will be made every time someone subscribes to resulting Observable, but not before. - * - * Optionally, selector function can be passed to `bindObservable`. That function - * takes the same arguments as callback, and returns value - * that will be emitted by Observable instead of callback parameters themselves. - * Even though by default multiple arguments passed to callback appear in the stream as array, - * selector function will be called with arguments directly, just as callback would. - * This means you can imagine default selector (when one is not provided explicitly) - * as function that aggregates all its arguments into array, or simply returns first argument, - * if there is only one. - * - * Last optional parameter - {@link Scheduler} - can be used to control when call - * to `func` happens after someone subscribes to Observable, as well as when results - * passed to callback will be emitted. By default subscription to Observable calls `func` - * synchronously, but using `Scheduler.async` as last parameter will defer call to input function, - * just like wrapping that call in `setTimeout` with time `0` would. So if you use async Scheduler - * and call `subscribe` on output Observable, all function calls that are currently executing, - * will end before `func` is invoked. - * - * When it comes to emitting results passed to callback, by default they are emitted - * immediately after `func` invokes callback. In particular, if callback is called synchronously, - * then subscription to resulting Observable will call `next` function synchronously as well. - * If you want to defer that call, using `Scheduler.async` will, again, do the job. - * This means that by using `Scheduler.async` you can, in a sense, ensure that `func` - * always calls its callback asynchronously, thus avoiding terrifying Zalgo. - * - * Note that Observable created by output function will always emit only one value - * and then complete right after. Even if `func` calls callback multiple times, values from - * second and following calls will never appear in the stream. If you need to - * listen for multiple calls, you probably want to use {@link fromEvent} or - * {@link fromEventPattern} instead. - * - * If `func` depends on some context (`this` property), that context will be set - * to the same context that output function has at call time. In particular, if `func` - * is called as method of some object, in order to preserve proper behaviour, - * it is recommended to set context of output function to that object as well, - * provided `func` is not already bound. - * - * If input function calls its callback in "node style" (i.e. first argument to callback is - * optional error parameter signaling whether call failed or not), {@link bindNodeCallback} - * provides convenient error handling and probably is a better choice. - * `bindCallback` will treat such functions without any difference and error parameter - * (whether passed or not) will always be interpreted as regular callback argument. - * - * - * @example Convert jQuery's getJSON to an Observable API - * // Suppose we have jQuery.getJSON('/my/url', callback) - * var getJSONAsObservable = Rx.Observable.bindCallback(jQuery.getJSON); - * var result = getJSONAsObservable('/my/url'); - * result.subscribe(x => console.log(x), e => console.error(e)); - * - * - * @example Receive array of arguments passed to callback - * someFunction((a, b, c) => { - * console.log(a); // 5 - * console.log(b); // 'some string' - * console.log(c); // {someProperty: 'someValue'} - * }); - * - * const boundSomeFunction = Rx.Observable.bindCallback(someFunction); - * boundSomeFunction().subscribe(values => { - * console.log(values) // [5, 'some string', {someProperty: 'someValue'}] - * }); - * - * - * @example Use bindCallback with selector function - * someFunction((a, b, c) => { - * console.log(a); // 'a' - * console.log(b); // 'b' - * console.log(c); // 'c' - * }); - * - * const boundSomeFunction = Rx.Observable.bindCallback(someFunction, (a, b, c) => a + b + c); - * boundSomeFunction().subscribe(value => { - * console.log(value) // 'abc' - * }); - * - * - * @example Compare behaviour with and without async Scheduler - * function iCallMyCallbackSynchronously(cb) { - * cb(); - * } - * - * const boundSyncFn = Rx.Observable.bindCallback(iCallMyCallbackSynchronously); - * const boundAsyncFn = Rx.Observable.bindCallback(iCallMyCallbackSynchronously, null, Rx.Scheduler.async); - * - * boundSyncFn().subscribe(() => console.log('I was sync!')); - * boundAsyncFn().subscribe(() => console.log('I was async!')); - * console.log('This happened...'); - * - * // Logs: - * // I was sync! - * // This happened... - * // I was async! - * - * - * @example Use bindCallback on object method - * const boundMethod = Rx.Observable.bindCallback(someObject.methodWithCallback); - * boundMethod.call(someObject) // make sure methodWithCallback has access to someObject - * .subscribe(subscriber); - * - * - * @see {@link bindNodeCallback} - * @see {@link from} - * @see {@link fromPromise} - * - * @param {function} func Function with a callback as the last parameter. - * @param {function} [selector] A function which takes the arguments from the - * callback and maps those to a value to emit on the output Observable. - * @param {Scheduler} [scheduler] The scheduler on which to schedule the - * callbacks. - * @return {function(...params: *): Observable} A function which returns the - * Observable that delivers the same values the callback would deliver. - * @static true - * @name bindCallback - * @owner Observable - */ - BoundCallbackObservable.create = function (func, selector, scheduler) { - if (selector === void 0) { selector = undefined; } - return function () { - var args = []; - for (var _i = 0; _i < arguments.length; _i++) { - args[_i - 0] = arguments[_i]; - } - return new BoundCallbackObservable(func, selector, args, this, scheduler); - }; - }; - BoundCallbackObservable.prototype._subscribe = function (subscriber) { - var callbackFunc = this.callbackFunc; - var args = this.args; - var scheduler = this.scheduler; - var subject = this.subject; - if (!scheduler) { - if (!subject) { - subject = this.subject = new AsyncSubject_1.AsyncSubject(); - var handler = function handlerFn() { - var innerArgs = []; - for (var _i = 0; _i < arguments.length; _i++) { - innerArgs[_i - 0] = arguments[_i]; - } - var source = handlerFn.source; - var selector = source.selector, subject = source.subject; - if (selector) { - var result_1 = tryCatch_1.tryCatch(selector).apply(this, innerArgs); - if (result_1 === errorObject_1.errorObject) { - subject.error(errorObject_1.errorObject.e); - } - else { - subject.next(result_1); - subject.complete(); - } - } - else { - subject.next(innerArgs.length <= 1 ? innerArgs[0] : innerArgs); - subject.complete(); - } - }; - // use named function instance to avoid closure. - handler.source = this; - var result = tryCatch_1.tryCatch(callbackFunc).apply(this.context, args.concat(handler)); - if (result === errorObject_1.errorObject) { - subject.error(errorObject_1.errorObject.e); - } - } - return subject.subscribe(subscriber); - } - else { - return scheduler.schedule(BoundCallbackObservable.dispatch, 0, { source: this, subscriber: subscriber, context: this.context }); - } - }; - BoundCallbackObservable.dispatch = function (state) { - var self = this; - var source = state.source, subscriber = state.subscriber, context = state.context; - var callbackFunc = source.callbackFunc, args = source.args, scheduler = source.scheduler; - var subject = source.subject; - if (!subject) { - subject = source.subject = new AsyncSubject_1.AsyncSubject(); - var handler = function handlerFn() { - var innerArgs = []; - for (var _i = 0; _i < arguments.length; _i++) { - innerArgs[_i - 0] = arguments[_i]; - } - var source = handlerFn.source; - var selector = source.selector, subject = source.subject; - if (selector) { - var result_2 = tryCatch_1.tryCatch(selector).apply(this, innerArgs); - if (result_2 === errorObject_1.errorObject) { - self.add(scheduler.schedule(dispatchError, 0, { err: errorObject_1.errorObject.e, subject: subject })); - } - else { - self.add(scheduler.schedule(dispatchNext, 0, { value: result_2, subject: subject })); - } - } - else { - var value = innerArgs.length <= 1 ? innerArgs[0] : innerArgs; - self.add(scheduler.schedule(dispatchNext, 0, { value: value, subject: subject })); - } - }; - // use named function to pass values in without closure - handler.source = source; - var result = tryCatch_1.tryCatch(callbackFunc).apply(context, args.concat(handler)); - if (result === errorObject_1.errorObject) { - subject.error(errorObject_1.errorObject.e); - } - } - self.add(subject.subscribe(subscriber)); - }; - return BoundCallbackObservable; -}(Observable_1.Observable)); -exports.BoundCallbackObservable = BoundCallbackObservable; -function dispatchNext(arg) { - var value = arg.value, subject = arg.subject; - subject.next(value); - subject.complete(); -} -function dispatchError(arg) { - var err = arg.err, subject = arg.subject; - subject.error(err); -} -//# sourceMappingURL=BoundCallbackObservable.js.map + return null; + }, + + /** + * @spec http://www.w3.org/TR/dom/#dom-treewalker-firstchild + * @method + * @return {Node|null} + */ + firstChild: function () { + return traverseChildren(this, 'first'); + }, + + /** + * @spec http://www.w3.org/TR/dom/#dom-treewalker-lastchild + * @method + * @return {Node|null} + */ + lastChild: function () { + return traverseChildren(this, 'last'); + }, + + /** + * @spec http://www.w3.org/TR/dom/#dom-treewalker-previoussibling + * @method + * @return {Node|null} + */ + previousSibling: function () { + return traverseSiblings(this, 'previous'); + }, + + /** + * @spec http://www.w3.org/TR/dom/#dom-treewalker-nextsibling + * @method + * @return {Node|null} + */ + nextSibling: function () { + return traverseSiblings(this, 'next'); + }, + + /** + * @spec http://www.w3.org/TR/dom/#dom-treewalker-previousnode + * @method + * @return {Node|null} + */ + previousNode: function () { + var node, result, sibling; + node = this.currentNode; + while (node !== this.root) { + sibling = node.previousSibling; + while (sibling !== null) { + node = sibling; + result = this.filter.acceptNode(node); + while (result !== NodeFilter.FILTER_REJECT && node.lastChild !== null) { + node = node.lastChild; + result = this.filter.acceptNode(node); + } + if (result === NodeFilter.FILTER_ACCEPT) { + this.currentNode = node; + return node; + } + sibling = node.previousSibling; + } + if (node === this.root || node.parentNode === null) { + return null; + } + node = node.parentNode; + if (this.filter.acceptNode(node) === NodeFilter.FILTER_ACCEPT) { + this.currentNode = node; + return node; + } + } + return null; + }, + + /** + * @spec http://www.w3.org/TR/dom/#dom-treewalker-nextnode + * @based on WebKit's TreeWalker::nextNode + * https://trac.webkit.org/browser/trunk/Source/WebCore/dom/TreeWalker.cpp?rev=179143#L252 + * @method + * @return {Node|null} + */ + nextNode: function () { + var node, result, following; + node = this.currentNode; + result = NodeFilter.FILTER_ACCEPT; + + while (true) { + while (result !== NodeFilter.FILTER_REJECT && node.firstChild !== null) { + node = node.firstChild; + result = this.filter.acceptNode(node); + if (result === NodeFilter.FILTER_ACCEPT) { + this.currentNode = node; + return node; + } + } + following = NodeTraversal.nextSkippingChildren(node, this.root); + if (following !== null) { + node = following; + } + else { + return null; + } + result = this.filter.acceptNode(node); + if (result === NodeFilter.FILTER_ACCEPT) { + this.currentNode = node; + return node; + } + } + } +}; + /***/ }), -/* 247 */ +/* 80 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + +// https://html.spec.whatwg.org/multipage/webappapis.html#windowtimers +var WindowTimers = { + setTimeout: setTimeout, + clearTimeout: clearTimeout, + setInterval: setInterval, + clearInterval: clearInterval }; -var Observable_1 = __webpack_require__(0); -var tryCatch_1 = __webpack_require__(7); -var errorObject_1 = __webpack_require__(5); -var AsyncSubject_1 = __webpack_require__(25); -/** - * We need this JSDoc comment for affecting ESDoc. - * @extends {Ignored} - * @hide true - */ -var BoundNodeCallbackObservable = (function (_super) { - __extends(BoundNodeCallbackObservable, _super); - function BoundNodeCallbackObservable(callbackFunc, selector, args, context, scheduler) { - _super.call(this); - this.callbackFunc = callbackFunc; - this.selector = selector; - this.args = args; - this.context = context; - this.scheduler = scheduler; - } - /* tslint:enable:max-line-length */ - /** - * Converts a Node.js-style callback API to a function that returns an - * Observable. - * - * It's just like {@link bindCallback}, but the - * callback is expected to be of type `callback(error, result)`. - * - * `bindNodeCallback` is not an operator because its input and output are not - * Observables. The input is a function `func` with some parameters, but the - * last parameter must be a callback function that `func` calls when it is - * done. The callback function is expected to follow Node.js conventions, - * where the first argument to the callback is an error object, signaling - * whether call was successful. If that object is passed to callback, it means - * something went wrong. - * - * The output of `bindNodeCallback` is a function that takes the same - * parameters as `func`, except the last one (the callback). When the output - * function is called with arguments, it will return an Observable. - * If `func` calls its callback with error parameter present, Observable will - * error with that value as well. If error parameter is not passed, Observable will emit - * second parameter. If there are more parameters (third and so on), - * Observable will emit an array with all arguments, except first error argument. - * - * Optionally `bindNodeCallback` accepts selector function, which allows you to - * make resulting Observable emit value computed by selector, instead of regular - * callback arguments. It works similarly to {@link bindCallback} selector, but - * Node.js-style error argument will never be passed to that function. - * - * Note that `func` will not be called at the same time output function is, - * but rather whenever resulting Observable is subscribed. By default call to - * `func` will happen synchronously after subscription, but that can be changed - * with proper {@link Scheduler} provided as optional third parameter. Scheduler - * can also control when values from callback will be emitted by Observable. - * To find out more, check out documentation for {@link bindCallback}, where - * Scheduler works exactly the same. - * - * As in {@link bindCallback}, context (`this` property) of input function will be set to context - * of returned function, when it is called. - * - * After Observable emits value, it will complete immediately. This means - * even if `func` calls callback again, values from second and consecutive - * calls will never appear on the stream. If you need to handle functions - * that call callbacks multiple times, check out {@link fromEvent} or - * {@link fromEventPattern} instead. - * - * Note that `bindNodeCallback` can be used in non-Node.js environments as well. - * "Node.js-style" callbacks are just a convention, so if you write for - * browsers or any other environment and API you use implements that callback style, - * `bindNodeCallback` can be safely used on that API functions as well. - * - * Remember that Error object passed to callback does not have to be an instance - * of JavaScript built-in `Error` object. In fact, it does not even have to an object. - * Error parameter of callback function is interpreted as "present", when value - * of that parameter is truthy. It could be, for example, non-zero number, non-empty - * string or boolean `true`. In all of these cases resulting Observable would error - * with that value. This means usually regular style callbacks will fail very often when - * `bindNodeCallback` is used. If your Observable errors much more often then you - * would expect, check if callback really is called in Node.js-style and, if not, - * switch to {@link bindCallback} instead. - * - * Note that even if error parameter is technically present in callback, but its value - * is falsy, it still won't appear in array emitted by Observable or in selector function. - * - * - * @example Read a file from the filesystem and get the data as an Observable - * import * as fs from 'fs'; - * var readFileAsObservable = Rx.Observable.bindNodeCallback(fs.readFile); - * var result = readFileAsObservable('./roadNames.txt', 'utf8'); - * result.subscribe(x => console.log(x), e => console.error(e)); - * - * - * @example Use on function calling callback with multiple arguments - * someFunction((err, a, b) => { - * console.log(err); // null - * console.log(a); // 5 - * console.log(b); // "some string" - * }); - * var boundSomeFunction = Rx.Observable.bindNodeCallback(someFunction); - * boundSomeFunction() - * .subscribe(value => { - * console.log(value); // [5, "some string"] - * }); - * - * - * @example Use with selector function - * someFunction((err, a, b) => { - * console.log(err); // undefined - * console.log(a); // "abc" - * console.log(b); // "DEF" - * }); - * var boundSomeFunction = Rx.Observable.bindNodeCallback(someFunction, (a, b) => a + b); - * boundSomeFunction() - * .subscribe(value => { - * console.log(value); // "abcDEF" - * }); - * - * - * @example Use on function calling callback in regular style - * someFunction(a => { - * console.log(a); // 5 - * }); - * var boundSomeFunction = Rx.Observable.bindNodeCallback(someFunction); - * boundSomeFunction() - * .subscribe( - * value => {} // never gets called - * err => console.log(err) // 5 - *); - * - * - * @see {@link bindCallback} - * @see {@link from} - * @see {@link fromPromise} - * - * @param {function} func Function with a Node.js-style callback as the last parameter. - * @param {function} [selector] A function which takes the arguments from the - * callback and maps those to a value to emit on the output Observable. - * @param {Scheduler} [scheduler] The scheduler on which to schedule the - * callbacks. - * @return {function(...params: *): Observable} A function which returns the - * Observable that delivers the same values the Node.js callback would - * deliver. - * @static true - * @name bindNodeCallback - * @owner Observable - */ - BoundNodeCallbackObservable.create = function (func, selector, scheduler) { - if (selector === void 0) { selector = undefined; } - return function () { - var args = []; - for (var _i = 0; _i < arguments.length; _i++) { - args[_i - 0] = arguments[_i]; - } - return new BoundNodeCallbackObservable(func, selector, args, this, scheduler); - }; - }; - BoundNodeCallbackObservable.prototype._subscribe = function (subscriber) { - var callbackFunc = this.callbackFunc; - var args = this.args; - var scheduler = this.scheduler; - var subject = this.subject; - if (!scheduler) { - if (!subject) { - subject = this.subject = new AsyncSubject_1.AsyncSubject(); - var handler = function handlerFn() { - var innerArgs = []; - for (var _i = 0; _i < arguments.length; _i++) { - innerArgs[_i - 0] = arguments[_i]; - } - var source = handlerFn.source; - var selector = source.selector, subject = source.subject; - var err = innerArgs.shift(); - if (err) { - subject.error(err); - } - else if (selector) { - var result_1 = tryCatch_1.tryCatch(selector).apply(this, innerArgs); - if (result_1 === errorObject_1.errorObject) { - subject.error(errorObject_1.errorObject.e); - } - else { - subject.next(result_1); - subject.complete(); - } - } - else { - subject.next(innerArgs.length <= 1 ? innerArgs[0] : innerArgs); - subject.complete(); - } - }; - // use named function instance to avoid closure. - handler.source = this; - var result = tryCatch_1.tryCatch(callbackFunc).apply(this.context, args.concat(handler)); - if (result === errorObject_1.errorObject) { - subject.error(errorObject_1.errorObject.e); - } - } - return subject.subscribe(subscriber); - } - else { - return scheduler.schedule(dispatch, 0, { source: this, subscriber: subscriber, context: this.context }); - } - }; - return BoundNodeCallbackObservable; -}(Observable_1.Observable)); -exports.BoundNodeCallbackObservable = BoundNodeCallbackObservable; -function dispatch(state) { - var self = this; - var source = state.source, subscriber = state.subscriber, context = state.context; - // XXX: cast to `any` to access to the private field in `source`. - var _a = source, callbackFunc = _a.callbackFunc, args = _a.args, scheduler = _a.scheduler; - var subject = source.subject; - if (!subject) { - subject = source.subject = new AsyncSubject_1.AsyncSubject(); - var handler = function handlerFn() { - var innerArgs = []; - for (var _i = 0; _i < arguments.length; _i++) { - innerArgs[_i - 0] = arguments[_i]; - } - var source = handlerFn.source; - var selector = source.selector, subject = source.subject; - var err = innerArgs.shift(); - if (err) { - self.add(scheduler.schedule(dispatchError, 0, { err: err, subject: subject })); - } - else if (selector) { - var result_2 = tryCatch_1.tryCatch(selector).apply(this, innerArgs); - if (result_2 === errorObject_1.errorObject) { - self.add(scheduler.schedule(dispatchError, 0, { err: errorObject_1.errorObject.e, subject: subject })); - } - else { - self.add(scheduler.schedule(dispatchNext, 0, { value: result_2, subject: subject })); - } - } - else { - var value = innerArgs.length <= 1 ? innerArgs[0] : innerArgs; - self.add(scheduler.schedule(dispatchNext, 0, { value: value, subject: subject })); - } - }; - // use named function to pass values in without closure - handler.source = source; - var result = tryCatch_1.tryCatch(callbackFunc).apply(context, args.concat(handler)); - if (result === errorObject_1.errorObject) { - self.add(scheduler.schedule(dispatchError, 0, { err: errorObject_1.errorObject.e, subject: subject })); - } - } - self.add(subject.subscribe(subscriber)); -} -function dispatchNext(arg) { - var value = arg.value, subject = arg.subject; - subject.next(value); - subject.complete(); -} -function dispatchError(arg) { - var err = arg.err, subject = arg.subject; - subject.error(err); -} -//# sourceMappingURL=BoundNodeCallbackObservable.js.map + +module.exports = WindowTimers; + /***/ }), -/* 248 */ +/* 81 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; +/* jshint node:true, latedef:false */ + // jshint ignore:line +/*! +Parser-Lib +Copyright (c) 2009-2011 Nicholas C. Zakas. All rights reserved. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. + +*/ +/* Version v0.2.5+domino1, Build time: 30-January-2016 05:13:03 */ +var parserlib = Object.create(null); +(function(){ -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; -var Observable_1 = __webpack_require__(0); -var subscribeToResult_1 = __webpack_require__(3); -var OuterSubscriber_1 = __webpack_require__(4); /** - * We need this JSDoc comment for affecting ESDoc. - * @extends {Ignored} - * @hide true + * A generic base to inherit from for any object + * that needs event handling. + * @class EventTarget + * @constructor */ -var DeferObservable = (function (_super) { - __extends(DeferObservable, _super); - function DeferObservable(observableFactory) { - _super.call(this); - this.observableFactory = observableFactory; - } +function EventTarget(){ + /** - * Creates an Observable that, on subscribe, calls an Observable factory to - * make an Observable for each new Observer. - * - * Creates the Observable lazily, that is, only when it - * is subscribed. - * - * - * - * - * `defer` allows you to create the Observable only when the Observer - * subscribes, and create a fresh Observable for each Observer. It waits until - * an Observer subscribes to it, and then it generates an Observable, - * typically with an Observable factory function. It does this afresh for each - * subscriber, so although each subscriber may think it is subscribing to the - * same Observable, in fact each subscriber gets its own individual - * Observable. - * - * @example Subscribe to either an Observable of clicks or an Observable of interval, at random - * var clicksOrInterval = Rx.Observable.defer(function () { - * if (Math.random() > 0.5) { - * return Rx.Observable.fromEvent(document, 'click'); - * } else { - * return Rx.Observable.interval(1000); - * } - * }); - * clicksOrInterval.subscribe(x => console.log(x)); - * - * // Results in the following behavior: - * // If the result of Math.random() is greater than 0.5 it will listen - * // for clicks anywhere on the "document"; when document is clicked it - * // will log a MouseEvent object to the console. If the result is less - * // than 0.5 it will emit ascending numbers, one every second(1000ms). - * - * @see {@link create} - * - * @param {function(): SubscribableOrPromise} observableFactory The Observable - * factory function to invoke for each Observer that subscribes to the output - * Observable. May also return a Promise, which will be converted on the fly - * to an Observable. - * @return {Observable} An Observable whose Observers' subscriptions trigger - * an invocation of the given Observable factory function. - * @static true - * @name defer - * @owner Observable + * The array of listeners for various events. + * @type Object + * @property _listeners + * @private */ - DeferObservable.create = function (observableFactory) { - return new DeferObservable(observableFactory); - }; - DeferObservable.prototype._subscribe = function (subscriber) { - return new DeferSubscriber(subscriber, this.observableFactory); - }; - return DeferObservable; -}(Observable_1.Observable)); -exports.DeferObservable = DeferObservable; -var DeferSubscriber = (function (_super) { - __extends(DeferSubscriber, _super); - function DeferSubscriber(destination, factory) { - _super.call(this, destination); - this.factory = factory; - this.tryDefer(); - } - DeferSubscriber.prototype.tryDefer = function () { - try { - this._callFactory(); + this._listeners = Object.create(null); +} + +EventTarget.prototype = { + + //restore constructor + constructor: EventTarget, + + /** + * Adds a listener for a given event type. + * @param {String} type The type of event to add a listener for. + * @param {Function} listener The function to call when the event occurs. + * @return {void} + * @method addListener + */ + addListener: function(type, listener){ + if (!this._listeners[type]){ + this._listeners[type] = []; + } + + this._listeners[type].push(listener); + }, + + /** + * Fires an event based on the passed-in object. + * @param {Object|String} event An object with at least a 'type' attribute + * or a string indicating the event name. + * @return {void} + * @method fire + */ + fire: function(event){ + if (typeof event === "string"){ + event = { type: event }; } - catch (err) { - this._error(err); + if (typeof event.target !== "undefined"){ + event.target = this; } - }; - DeferSubscriber.prototype._callFactory = function () { - var result = this.factory(); - if (result) { - this.add(subscribeToResult_1.subscribeToResult(this, result)); + + if (typeof event.type === "undefined"){ + throw new Error("Event object missing 'type' property."); } - }; - return DeferSubscriber; -}(OuterSubscriber_1.OuterSubscriber)); -//# sourceMappingURL=DeferObservable.js.map -/***/ }), -/* 249 */ -/***/ (function(module, exports, __webpack_require__) { + if (this._listeners[event.type]){ -"use strict"; + //create a copy of the array and use that so listeners can't chane + var listeners = this._listeners[event.type].concat(); + for (var i=0, len=listeners.length; i < len; i++){ + listeners[i].call(this, event); + } + } + }, -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + /** + * Removes a listener for a given event type. + * @param {String} type The type of event to remove a listener from. + * @param {Function} listener The function to remove from the event. + * @return {void} + * @method removeListener + */ + removeListener: function(type, listener){ + if (this._listeners[type]){ + var listeners = this._listeners[type]; + for (var i=0, len=listeners.length; i < len; i++){ + if (listeners[i] === listener){ + listeners.splice(i, 1); + break; + } + } + + + } + } }; -var Observable_1 = __webpack_require__(0); /** - * We need this JSDoc comment for affecting ESDoc. - * @extends {Ignored} - * @hide true + * Convenient way to read through strings. + * @namespace parserlib.util + * @class StringReader + * @constructor + * @param {String} text The text to read. */ -var ErrorObservable = (function (_super) { - __extends(ErrorObservable, _super); - function ErrorObservable(error, scheduler) { - _super.call(this); - this.error = error; - this.scheduler = scheduler; - } +function StringReader(text){ + /** - * Creates an Observable that emits no items to the Observer and immediately - * emits an error notification. - * - * Just emits 'error', and nothing else. - * - * - * - * - * This static operator is useful for creating a simple Observable that only - * emits the error notification. It can be used for composing with other - * Observables, such as in a {@link mergeMap}. - * - * @example Emit the number 7, then emit an error. - * var result = Rx.Observable.throw(new Error('oops!')).startWith(7); - * result.subscribe(x => console.log(x), e => console.error(e)); - * - * @example Map and flatten numbers to the sequence 'a', 'b', 'c', but throw an error for 13 - * var interval = Rx.Observable.interval(1000); - * var result = interval.mergeMap(x => - * x === 13 ? - * Rx.Observable.throw('Thirteens are bad') : - * Rx.Observable.of('a', 'b', 'c') - * ); - * result.subscribe(x => console.log(x), e => console.error(e)); - * - * @see {@link create} - * @see {@link empty} - * @see {@link never} - * @see {@link of} - * - * @param {any} error The particular Error to pass to the error notification. - * @param {Scheduler} [scheduler] A {@link IScheduler} to use for scheduling - * the emission of the error notification. - * @return {Observable} An error Observable: emits only the error notification - * using the given error argument. - * @static true - * @name throw - * @owner Observable + * The input text with line endings normalized. + * @property _input + * @type String + * @private */ - ErrorObservable.create = function (error, scheduler) { - return new ErrorObservable(error, scheduler); - }; - ErrorObservable.dispatch = function (arg) { - var error = arg.error, subscriber = arg.subscriber; - subscriber.error(error); - }; - ErrorObservable.prototype._subscribe = function (subscriber) { - var error = this.error; - var scheduler = this.scheduler; - subscriber.syncErrorThrowable = true; - if (scheduler) { - return scheduler.schedule(ErrorObservable.dispatch, 0, { - error: error, subscriber: subscriber - }); - } - else { - subscriber.error(error); - } - }; - return ErrorObservable; -}(Observable_1.Observable)); -exports.ErrorObservable = ErrorObservable; -//# sourceMappingURL=ErrorObservable.js.map + this._input = text.replace(/(\r|\n){1,2}/g, "\n"); -/***/ }), -/* 250 */ -/***/ (function(module, exports, __webpack_require__) { -"use strict"; + /** + * The row for the character to be read next. + * @property _line + * @type int + * @private + */ + this._line = 1; + + + /** + * The column for the character to be read next. + * @property _col + * @type int + * @private + */ + this._col = 1; + + /** + * The index of the character in the input to be read next. + * @property _cursor + * @type int + * @private + */ + this._cursor = 0; +} + +StringReader.prototype = { + + //restore constructor + constructor: StringReader, + + //------------------------------------------------------------------------- + // Position info + //------------------------------------------------------------------------- + + /** + * Returns the column of the character to be read next. + * @return {int} The column of the character to be read next. + * @method getCol + */ + getCol: function(){ + return this._col; + }, + + /** + * Returns the row of the character to be read next. + * @return {int} The row of the character to be read next. + * @method getLine + */ + getLine: function(){ + return this._line ; + }, + + /** + * Determines if you're at the end of the input. + * @return {Boolean} True if there's no more input, false otherwise. + * @method eof + */ + eof: function(){ + return (this._cursor === this._input.length); + }, + + //------------------------------------------------------------------------- + // Basic reading + //------------------------------------------------------------------------- -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; -var Observable_1 = __webpack_require__(0); -var tryCatch_1 = __webpack_require__(7); -var isFunction_1 = __webpack_require__(81); -var errorObject_1 = __webpack_require__(5); -var Subscription_1 = __webpack_require__(9); -var toString = Object.prototype.toString; -function isNodeStyleEventEmitter(sourceObj) { - return !!sourceObj && typeof sourceObj.addListener === 'function' && typeof sourceObj.removeListener === 'function'; -} -function isJQueryStyleEventEmitter(sourceObj) { - return !!sourceObj && typeof sourceObj.on === 'function' && typeof sourceObj.off === 'function'; -} -function isNodeList(sourceObj) { - return !!sourceObj && toString.call(sourceObj) === '[object NodeList]'; -} -function isHTMLCollection(sourceObj) { - return !!sourceObj && toString.call(sourceObj) === '[object HTMLCollection]'; -} -function isEventTarget(sourceObj) { - return !!sourceObj && typeof sourceObj.addEventListener === 'function' && typeof sourceObj.removeEventListener === 'function'; -} -/** - * We need this JSDoc comment for affecting ESDoc. - * @extends {Ignored} - * @hide true - */ -var FromEventObservable = (function (_super) { - __extends(FromEventObservable, _super); - function FromEventObservable(sourceObj, eventName, selector, options) { - _super.call(this); - this.sourceObj = sourceObj; - this.eventName = eventName; - this.selector = selector; - this.options = options; - } - /* tslint:enable:max-line-length */ /** - * Creates an Observable that emits events of a specific type coming from the - * given event target. - * - * Creates an Observable from DOM events, or Node - * EventEmitter events or others. - * - * - * - * Creates an Observable by attaching an event listener to an "event target", - * which may be an object with `addEventListener` and `removeEventListener`, - * a Node.js EventEmitter, a jQuery style EventEmitter, a NodeList from the - * DOM, or an HTMLCollection from the DOM. The event handler is attached when - * the output Observable is subscribed, and removed when the Subscription is - * unsubscribed. - * - * @example Emits clicks happening on the DOM document - * var clicks = Rx.Observable.fromEvent(document, 'click'); - * clicks.subscribe(x => console.log(x)); - * - * // Results in: - * // MouseEvent object logged to console everytime a click - * // occurs on the document. - * - * @see {@link from} - * @see {@link fromEventPattern} - * - * @param {EventTargetLike} target The DOMElement, event target, Node.js - * EventEmitter, NodeList or HTMLCollection to attach the event handler to. - * @param {string} eventName The event name of interest, being emitted by the - * `target`. - * @param {EventListenerOptions} [options] Options to pass through to addEventListener - * @param {SelectorMethodSignature} [selector] An optional function to - * post-process results. It takes the arguments from the event handler and - * should return a single value. - * @return {Observable} - * @static true - * @name fromEvent - * @owner Observable + * Reads the next character without advancing the cursor. + * @param {int} count How many characters to look ahead (default is 1). + * @return {String} The next character or null if there is no next character. + * @method peek */ - FromEventObservable.create = function (target, eventName, options, selector) { - if (isFunction_1.isFunction(options)) { - selector = options; - options = undefined; + peek: function(count){ + var c = null; + count = (typeof count === "undefined" ? 1 : count); + + //if we're not at the end of the input... + if (this._cursor < this._input.length){ + + //get character and increment cursor and column + c = this._input.charAt(this._cursor + count - 1); } - return new FromEventObservable(target, eventName, selector, options); - }; - FromEventObservable.setupSubscription = function (sourceObj, eventName, handler, subscriber, options) { - var unsubscribe; - if (isNodeList(sourceObj) || isHTMLCollection(sourceObj)) { - for (var i = 0, len = sourceObj.length; i < len; i++) { - FromEventObservable.setupSubscription(sourceObj[i], eventName, handler, subscriber, options); + + return c; + }, + + /** + * Reads the next character from the input and adjusts the row and column + * accordingly. + * @return {String} The next character or null if there is no next character. + * @method read + */ + read: function(){ + var c = null; + + //if we're not at the end of the input... + if (this._cursor < this._input.length){ + + //if the last character was a newline, increment row count + //and reset column count + if (this._input.charAt(this._cursor) === "\n"){ + this._line++; + this._col=1; + } else { + this._col++; } + + //get character and increment cursor and column + c = this._input.charAt(this._cursor++); } - else if (isEventTarget(sourceObj)) { - var source_1 = sourceObj; - sourceObj.addEventListener(eventName, handler, options); - unsubscribe = function () { return source_1.removeEventListener(eventName, handler); }; + + return c; + }, + + //------------------------------------------------------------------------- + // Misc + //------------------------------------------------------------------------- + + /** + * Saves the current location so it can be returned to later. + * @method mark + * @return {void} + */ + mark: function(){ + this._bookmark = { + cursor: this._cursor, + line: this._line, + col: this._col + }; + }, + + reset: function(){ + if (this._bookmark){ + this._cursor = this._bookmark.cursor; + this._line = this._bookmark.line; + this._col = this._bookmark.col; + delete this._bookmark; } - else if (isJQueryStyleEventEmitter(sourceObj)) { - var source_2 = sourceObj; - sourceObj.on(eventName, handler); - unsubscribe = function () { return source_2.off(eventName, handler); }; + }, + + //------------------------------------------------------------------------- + // Advanced reading + //------------------------------------------------------------------------- + + /** + * Reads up to and including the given string. Throws an error if that + * string is not found. + * @param {String} pattern The string to read. + * @return {String} The string when it is found. + * @throws Error when the string pattern is not found. + * @method readTo + */ + readTo: function(pattern){ + + var buffer = "", + c; + + /* + * First, buffer must be the same length as the pattern. + * Then, buffer must end with the pattern or else reach the + * end of the input. + */ + while (buffer.length < pattern.length || buffer.lastIndexOf(pattern) !== buffer.length - pattern.length){ + c = this.read(); + if (c){ + buffer += c; + } else { + throw new Error("Expected \"" + pattern + "\" at line " + this._line + ", col " + this._col + "."); + } } - else if (isNodeStyleEventEmitter(sourceObj)) { - var source_3 = sourceObj; - sourceObj.addListener(eventName, handler); - unsubscribe = function () { return source_3.removeListener(eventName, handler); }; + + return buffer; + + }, + + /** + * Reads characters while each character causes the given + * filter function to return true. The function is passed + * in each character and either returns true to continue + * reading or false to stop. + * @param {Function} filter The function to read on each character. + * @return {String} The string made up of all characters that passed the + * filter check. + * @method readWhile + */ + readWhile: function(filter){ + + var buffer = "", + c = this.read(); + + while(c !== null && filter(c)){ + buffer += c; + c = this.read(); } - else { - throw new TypeError('Invalid event target'); - } - subscriber.add(new Subscription_1.Subscription(unsubscribe)); - }; - FromEventObservable.prototype._subscribe = function (subscriber) { - var sourceObj = this.sourceObj; - var eventName = this.eventName; - var options = this.options; - var selector = this.selector; - var handler = selector ? function () { - var args = []; - for (var _i = 0; _i < arguments.length; _i++) { - args[_i - 0] = arguments[_i]; - } - var result = tryCatch_1.tryCatch(selector).apply(void 0, args); - if (result === errorObject_1.errorObject) { - subscriber.error(errorObject_1.errorObject.e); + + return buffer; + + }, + + /** + * Reads characters that match either text or a regular expression and + * returns those characters. If a match is found, the row and column + * are adjusted; if no match is found, the reader's state is unchanged. + * reading or false to stop. + * @param {String|RegExp} matchter If a string, then the literal string + * value is searched for. If a regular expression, then any string + * matching the pattern is search for. + * @return {String} The string made up of all characters that matched or + * null if there was no match. + * @method readMatch + */ + readMatch: function(matcher){ + + var source = this._input.substring(this._cursor), + value = null; + + //if it's a string, just do a straight match + if (typeof matcher === "string"){ + if (source.indexOf(matcher) === 0){ + value = this.readCount(matcher.length); } - else { - subscriber.next(result); + } else if (matcher instanceof RegExp){ + if (matcher.test(source)){ + value = this.readCount(RegExp.lastMatch.length); } - } : function (e) { return subscriber.next(e); }; - FromEventObservable.setupSubscription(sourceObj, eventName, handler, subscriber, options); - }; - return FromEventObservable; -}(Observable_1.Observable)); -exports.FromEventObservable = FromEventObservable; -//# sourceMappingURL=FromEventObservable.js.map + } -/***/ }), -/* 251 */ -/***/ (function(module, exports, __webpack_require__) { + return value; + }, -"use strict"; -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + /** + * Reads a given number of characters. If the end of the input is reached, + * it reads only the remaining characters and does not throw an error. + * @param {int} count The number of characters to read. + * @return {String} The string made up the read characters. + * @method readCount + */ + readCount: function(count){ + var buffer = ""; + + while(count--){ + buffer += this.read(); + } + + return buffer; + } + }; -var isFunction_1 = __webpack_require__(81); -var Observable_1 = __webpack_require__(0); -var Subscription_1 = __webpack_require__(9); /** - * We need this JSDoc comment for affecting ESDoc. - * @extends {Ignored} - * @hide true + * Type to use when a syntax error occurs. + * @class SyntaxError + * @namespace parserlib.util + * @constructor + * @param {String} message The error message. + * @param {int} line The line at which the error occurred. + * @param {int} col The column at which the error occurred. */ -var FromEventPatternObservable = (function (_super) { - __extends(FromEventPatternObservable, _super); - function FromEventPatternObservable(addHandler, removeHandler, selector) { - _super.call(this); - this.addHandler = addHandler; - this.removeHandler = removeHandler; - this.selector = selector; - } +function SyntaxError(message, line, col){ + Error.call(this); + this.name = this.constructor.name; + /** - * Creates an Observable from an API based on addHandler/removeHandler - * functions. - * - * Converts any addHandler/removeHandler API to an - * Observable. - * - * - * - * Creates an Observable by using the `addHandler` and `removeHandler` - * functions to add and remove the handlers, with an optional selector - * function to project the event arguments to a result. The `addHandler` is - * called when the output Observable is subscribed, and `removeHandler` is - * called when the Subscription is unsubscribed. - * - * @example Emits clicks happening on the DOM document - * function addClickHandler(handler) { - * document.addEventListener('click', handler); - * } - * - * function removeClickHandler(handler) { - * document.removeEventListener('click', handler); - * } - * - * var clicks = Rx.Observable.fromEventPattern( - * addClickHandler, - * removeClickHandler - * ); - * clicks.subscribe(x => console.log(x)); - * - * @see {@link from} - * @see {@link fromEvent} - * - * @param {function(handler: Function): any} addHandler A function that takes - * a `handler` function as argument and attaches it somehow to the actual - * source of events. - * @param {function(handler: Function, signal?: any): void} [removeHandler] An optional function that - * takes a `handler` function as argument and removes it in case it was - * previously attached using `addHandler`. if addHandler returns signal to teardown when remove, - * removeHandler function will forward it. - * @param {function(...args: any): T} [selector] An optional function to - * post-process results. It takes the arguments from the event handler and - * should return a single value. - * @return {Observable} - * @static true - * @name fromEventPattern - * @owner Observable + * The column at which the error occurred. + * @type int + * @property col */ - FromEventPatternObservable.create = function (addHandler, removeHandler, selector) { - return new FromEventPatternObservable(addHandler, removeHandler, selector); - }; - FromEventPatternObservable.prototype._subscribe = function (subscriber) { - var _this = this; - var removeHandler = this.removeHandler; - var handler = !!this.selector ? function () { - var args = []; - for (var _i = 0; _i < arguments.length; _i++) { - args[_i - 0] = arguments[_i]; - } - _this._callSelector(subscriber, args); - } : function (e) { subscriber.next(e); }; - var retValue = this._callAddHandler(handler, subscriber); - if (!isFunction_1.isFunction(removeHandler)) { - return; - } - subscriber.add(new Subscription_1.Subscription(function () { - //TODO: determine whether or not to forward to error handler - removeHandler(handler, retValue); - })); - }; - FromEventPatternObservable.prototype._callSelector = function (subscriber, args) { - try { - var result = this.selector.apply(this, args); - subscriber.next(result); - } - catch (e) { - subscriber.error(e); - } - }; - FromEventPatternObservable.prototype._callAddHandler = function (handler, errorSubscriber) { - try { - return this.addHandler(handler) || null; - } - catch (e) { - errorSubscriber.error(e); - } - }; - return FromEventPatternObservable; -}(Observable_1.Observable)); -exports.FromEventPatternObservable = FromEventPatternObservable; -//# sourceMappingURL=FromEventPatternObservable.js.map + this.col = col; -/***/ }), -/* 252 */ -/***/ (function(module, exports, __webpack_require__) { + /** + * The line at which the error occurred. + * @type int + * @property line + */ + this.line = line; -"use strict"; + /** + * The text representation of the unit. + * @type String + * @property text + */ + this.message = message; -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; -var Observable_1 = __webpack_require__(0); -var isScheduler_1 = __webpack_require__(13); -var selfSelector = function (value) { return value; }; +} + +//inherit from Error +SyntaxError.prototype = Object.create(Error.prototype); // jshint ignore:line +SyntaxError.prototype.constructor = SyntaxError; // jshint ignore:line /** - * We need this JSDoc comment for affecting ESDoc. - * @extends {Ignored} - * @hide true + * Base type to represent a single syntactic unit. + * @class SyntaxUnit + * @namespace parserlib.util + * @constructor + * @param {String} text The text of the unit. + * @param {int} line The line of text on which the unit resides. + * @param {int} col The column of text on which the unit resides. */ -var GenerateObservable = (function (_super) { - __extends(GenerateObservable, _super); - function GenerateObservable(initialState, condition, iterate, resultSelector, scheduler) { - _super.call(this); - this.initialState = initialState; - this.condition = condition; - this.iterate = iterate; - this.resultSelector = resultSelector; - this.scheduler = scheduler; - } - GenerateObservable.create = function (initialStateOrOptions, condition, iterate, resultSelectorOrObservable, scheduler) { - if (arguments.length == 1) { - return new GenerateObservable(initialStateOrOptions.initialState, initialStateOrOptions.condition, initialStateOrOptions.iterate, initialStateOrOptions.resultSelector || selfSelector, initialStateOrOptions.scheduler); - } - if (resultSelectorOrObservable === undefined || isScheduler_1.isScheduler(resultSelectorOrObservable)) { - return new GenerateObservable(initialStateOrOptions, condition, iterate, selfSelector, resultSelectorOrObservable); - } - return new GenerateObservable(initialStateOrOptions, condition, iterate, resultSelectorOrObservable, scheduler); - }; - GenerateObservable.prototype._subscribe = function (subscriber) { - var state = this.initialState; - if (this.scheduler) { - return this.scheduler.schedule(GenerateObservable.dispatch, 0, { - subscriber: subscriber, - iterate: this.iterate, - condition: this.condition, - resultSelector: this.resultSelector, - state: state }); - } - var _a = this, condition = _a.condition, resultSelector = _a.resultSelector, iterate = _a.iterate; - do { - if (condition) { - var conditionResult = void 0; - try { - conditionResult = condition(state); - } - catch (err) { - subscriber.error(err); - return; - } - if (!conditionResult) { - subscriber.complete(); - break; - } - } - var value = void 0; - try { - value = resultSelector(state); - } - catch (err) { - subscriber.error(err); - return; - } - subscriber.next(value); - if (subscriber.closed) { - break; - } - try { - state = iterate(state); - } - catch (err) { - subscriber.error(err); - return; - } - } while (true); - }; - GenerateObservable.dispatch = function (state) { - var subscriber = state.subscriber, condition = state.condition; - if (subscriber.closed) { - return; - } - if (state.needIterate) { - try { - state.state = state.iterate(state.state); - } - catch (err) { - subscriber.error(err); - return; - } - } - else { - state.needIterate = true; - } - if (condition) { - var conditionResult = void 0; - try { - conditionResult = condition(state.state); - } - catch (err) { - subscriber.error(err); - return; - } - if (!conditionResult) { - subscriber.complete(); - return; - } - if (subscriber.closed) { - return; - } - } - var value; - try { - value = state.resultSelector(state.state); - } - catch (err) { - subscriber.error(err); - return; - } - if (subscriber.closed) { - return; - } - subscriber.next(value); - if (subscriber.closed) { - return; - } - return this.schedule(state); - }; - return GenerateObservable; -}(Observable_1.Observable)); -exports.GenerateObservable = GenerateObservable; -//# sourceMappingURL=GenerateObservable.js.map +function SyntaxUnit(text, line, col, type){ -/***/ }), -/* 253 */ -/***/ (function(module, exports, __webpack_require__) { -"use strict"; + /** + * The column of text on which the unit resides. + * @type int + * @property col + */ + this.col = col; + + /** + * The line of text on which the unit resides. + * @type int + * @property line + */ + this.line = line; + + /** + * The text representation of the unit. + * @type String + * @property text + */ + this.text = text; + + /** + * The type of syntax unit. + * @type int + * @property type + */ + this.type = type; +} + +/** + * Create a new syntax unit based solely on the given token. + * Convenience method for creating a new syntax unit when + * it represents a single token instead of multiple. + * @param {Object} token The token object to represent. + * @return {parserlib.util.SyntaxUnit} The object representing the token. + * @static + * @method fromToken + */ +SyntaxUnit.fromToken = function(token){ + return new SyntaxUnit(token.value, token.startLine, token.startCol); +}; + +SyntaxUnit.prototype = { + + //restore constructor + constructor: SyntaxUnit, + + /** + * Returns the text representation of the unit. + * @return {String} The text representation of the unit. + * @method valueOf + */ + valueOf: function(){ + return this.toString(); + }, + + /** + * Returns the text representation of the unit. + * @return {String} The text representation of the unit. + * @method toString + */ + toString: function(){ + return this.text; + } -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; -var Observable_1 = __webpack_require__(0); -var subscribeToResult_1 = __webpack_require__(3); -var OuterSubscriber_1 = __webpack_require__(4); + +/** + * Generic TokenStream providing base functionality. + * @class TokenStreamBase + * @namespace parserlib.util + * @constructor + * @param {String|StringReader} input The text to tokenize or a reader from + * which to read the input. + */ +function TokenStreamBase(input, tokenData){ + + /** + * The string reader for easy access to the text. + * @type StringReader + * @property _reader + * @private + */ + this._reader = input ? new StringReader(input.toString()) : null; + + /** + * Token object for the last consumed token. + * @type Token + * @property _token + * @private + */ + this._token = null; + + /** + * The array of token information. + * @type Array + * @property _tokenData + * @private + */ + this._tokenData = tokenData; + + /** + * Lookahead token buffer. + * @type Array + * @property _lt + * @private + */ + this._lt = []; + + /** + * Lookahead token buffer index. + * @type int + * @property _ltIndex + * @private + */ + this._ltIndex = 0; + + this._ltIndexCache = []; +} + /** - * We need this JSDoc comment for affecting ESDoc. - * @extends {Ignored} - * @hide true + * Accepts an array of token information and outputs + * an array of token data containing key-value mappings + * and matching functions that the TokenStream needs. + * @param {Array} tokens An array of token descriptors. + * @return {Array} An array of processed token data. + * @method createTokenData + * @static */ -var IfObservable = (function (_super) { - __extends(IfObservable, _super); - function IfObservable(condition, thenSource, elseSource) { - _super.call(this); - this.condition = condition; - this.thenSource = thenSource; - this.elseSource = elseSource; +TokenStreamBase.createTokenData = function(tokens){ + + var nameMap = [], + typeMap = Object.create(null), + tokenData = tokens.concat([]), + i = 0, + len = tokenData.length+1; + + tokenData.UNKNOWN = -1; + tokenData.unshift({name:"EOF"}); + + for (; i < len; i++){ + nameMap.push(tokenData[i].name); + tokenData[tokenData[i].name] = i; + if (tokenData[i].text){ + typeMap[tokenData[i].text] = i; + } } - IfObservable.create = function (condition, thenSource, elseSource) { - return new IfObservable(condition, thenSource, elseSource); - }; - IfObservable.prototype._subscribe = function (subscriber) { - var _a = this, condition = _a.condition, thenSource = _a.thenSource, elseSource = _a.elseSource; - return new IfSubscriber(subscriber, condition, thenSource, elseSource); + + tokenData.name = function(tt){ + return nameMap[tt]; }; - return IfObservable; -}(Observable_1.Observable)); -exports.IfObservable = IfObservable; -var IfSubscriber = (function (_super) { - __extends(IfSubscriber, _super); - function IfSubscriber(destination, condition, thenSource, elseSource) { - _super.call(this, destination); - this.condition = condition; - this.thenSource = thenSource; - this.elseSource = elseSource; - this.tryIf(); - } - IfSubscriber.prototype.tryIf = function () { - var _a = this, condition = _a.condition, thenSource = _a.thenSource, elseSource = _a.elseSource; - var result; - try { - result = condition(); - var source = result ? thenSource : elseSource; - if (source) { - this.add(subscribeToResult_1.subscribeToResult(this, source)); - } - else { - this._complete(); - } - } - catch (err) { - this._error(err); - } + + tokenData.type = function(c){ + return typeMap[c]; }; - return IfSubscriber; -}(OuterSubscriber_1.OuterSubscriber)); -//# sourceMappingURL=IfObservable.js.map -/***/ }), -/* 254 */ -/***/ (function(module, exports, __webpack_require__) { + return tokenData; +}; -"use strict"; +TokenStreamBase.prototype = { -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; -var isNumeric_1 = __webpack_require__(28); -var Observable_1 = __webpack_require__(0); -var async_1 = __webpack_require__(8); -/** - * We need this JSDoc comment for affecting ESDoc. - * @extends {Ignored} - * @hide true - */ -var IntervalObservable = (function (_super) { - __extends(IntervalObservable, _super); - function IntervalObservable(period, scheduler) { - if (period === void 0) { period = 0; } - if (scheduler === void 0) { scheduler = async_1.async; } - _super.call(this); - this.period = period; - this.scheduler = scheduler; - if (!isNumeric_1.isNumeric(period) || period < 0) { - this.period = 0; + //restore constructor + constructor: TokenStreamBase, + + //------------------------------------------------------------------------- + // Matching methods + //------------------------------------------------------------------------- + + /** + * Determines if the next token matches the given token type. + * If so, that token is consumed; if not, the token is placed + * back onto the token stream. You can pass in any number of + * token types and this will return true if any of the token + * types is found. + * @param {int|int[]} tokenTypes Either a single token type or an array of + * token types that the next token might be. If an array is passed, + * it's assumed that the token can be any of these. + * @param {variant} channel (Optional) The channel to read from. If not + * provided, reads from the default (unnamed) channel. + * @return {Boolean} True if the token type matches, false if not. + * @method match + */ + match: function(tokenTypes, channel){ + + //always convert to an array, makes things easier + if (!(tokenTypes instanceof Array)){ + tokenTypes = [tokenTypes]; } - if (!scheduler || typeof scheduler.schedule !== 'function') { - this.scheduler = async_1.async; + + var tt = this.get(channel), + i = 0, + len = tokenTypes.length; + + while(i < len){ + if (tt === tokenTypes[i++]){ + return true; + } } - } + + //no match found, put the token back + this.unget(); + return false; + }, + /** - * Creates an Observable that emits sequential numbers every specified - * interval of time, on a specified IScheduler. - * - * Emits incremental numbers periodically in time. - * - * - * - * - * `interval` returns an Observable that emits an infinite sequence of - * ascending integers, with a constant interval of time of your choosing - * between those emissions. The first emission is not sent immediately, but - * only after the first period has passed. By default, this operator uses the - * `async` IScheduler to provide a notion of time, but you may pass any - * IScheduler to it. - * - * @example Emits ascending numbers, one every second (1000ms) - * var numbers = Rx.Observable.interval(1000); - * numbers.subscribe(x => console.log(x)); - * - * @see {@link timer} - * @see {@link delay} - * - * @param {number} [period=0] The interval size in milliseconds (by default) - * or the time unit determined by the scheduler's clock. - * @param {Scheduler} [scheduler=async] The IScheduler to use for scheduling - * the emission of values, and providing a notion of "time". - * @return {Observable} An Observable that emits a sequential number each time - * interval. - * @static true - * @name interval - * @owner Observable + * Determines if the next token matches the given token type. + * If so, that token is consumed; if not, an error is thrown. + * @param {int|int[]} tokenTypes Either a single token type or an array of + * token types that the next token should be. If an array is passed, + * it's assumed that the token must be one of these. + * @param {variant} channel (Optional) The channel to read from. If not + * provided, reads from the default (unnamed) channel. + * @return {void} + * @method mustMatch */ - IntervalObservable.create = function (period, scheduler) { - if (period === void 0) { period = 0; } - if (scheduler === void 0) { scheduler = async_1.async; } - return new IntervalObservable(period, scheduler); - }; - IntervalObservable.dispatch = function (state) { - var index = state.index, subscriber = state.subscriber, period = state.period; - subscriber.next(index); - if (subscriber.closed) { - return; + mustMatch: function(tokenTypes, channel){ + + var token; + + //always convert to an array, makes things easier + if (!(tokenTypes instanceof Array)){ + tokenTypes = [tokenTypes]; } - state.index += 1; - this.schedule(state, period); - }; - IntervalObservable.prototype._subscribe = function (subscriber) { - var index = 0; - var period = this.period; - var scheduler = this.scheduler; - subscriber.add(scheduler.schedule(IntervalObservable.dispatch, period, { - index: index, subscriber: subscriber, period: period - })); - }; - return IntervalObservable; -}(Observable_1.Observable)); -exports.IntervalObservable = IntervalObservable; -//# sourceMappingURL=IntervalObservable.js.map -/***/ }), -/* 255 */ -/***/ (function(module, exports, __webpack_require__) { + if (!this.match.apply(this, arguments)){ + token = this.LT(1); + throw new SyntaxError("Expected " + this._tokenData[tokenTypes[0]].name + + " at line " + token.startLine + ", col " + token.startCol + ".", token.startLine, token.startCol); + } + }, -"use strict"; + //------------------------------------------------------------------------- + // Consuming methods + //------------------------------------------------------------------------- -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; -var Observable_1 = __webpack_require__(0); -var noop_1 = __webpack_require__(76); -/** - * We need this JSDoc comment for affecting ESDoc. - * @extends {Ignored} - * @hide true - */ -var NeverObservable = (function (_super) { - __extends(NeverObservable, _super); - function NeverObservable() { - _super.call(this); - } /** - * Creates an Observable that emits no items to the Observer. - * - * An Observable that never emits anything. - * - * - * - * This static operator is useful for creating a simple Observable that emits - * neither values nor errors nor the completion notification. It can be used - * for testing purposes or for composing with other Observables. Please note - * that by never emitting a complete notification, this Observable keeps the - * subscription from being disposed automatically. Subscriptions need to be - * manually disposed. - * - * @example Emit the number 7, then never emit anything else (not even complete). - * function info() { - * console.log('Will not be called'); - * } - * var result = Rx.Observable.never().startWith(7); - * result.subscribe(x => console.log(x), info, info); - * - * @see {@link create} - * @see {@link empty} - * @see {@link of} - * @see {@link throw} - * - * @return {Observable} A "never" Observable: never emits anything. - * @static true - * @name never - * @owner Observable + * Keeps reading from the token stream until either one of the specified + * token types is found or until the end of the input is reached. + * @param {int|int[]} tokenTypes Either a single token type or an array of + * token types that the next token should be. If an array is passed, + * it's assumed that the token must be one of these. + * @param {variant} channel (Optional) The channel to read from. If not + * provided, reads from the default (unnamed) channel. + * @return {void} + * @method advance */ - NeverObservable.create = function () { - return new NeverObservable(); - }; - NeverObservable.prototype._subscribe = function (subscriber) { - noop_1.noop(); - }; - return NeverObservable; -}(Observable_1.Observable)); -exports.NeverObservable = NeverObservable; -//# sourceMappingURL=NeverObservable.js.map + advance: function(tokenTypes, channel){ -/***/ }), -/* 256 */ -/***/ (function(module, exports, __webpack_require__) { + while(this.LA(0) !== 0 && !this.match(tokenTypes, channel)){ + this.get(); + } -"use strict"; + return this.LA(0); + }, -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; -var Observable_1 = __webpack_require__(0); -function dispatch(state) { - var obj = state.obj, keys = state.keys, length = state.length, index = state.index, subscriber = state.subscriber; - if (index === length) { - subscriber.complete(); - return; - } - var key = keys[index]; - subscriber.next([key, obj[key]]); - state.index = index + 1; - this.schedule(state); -} -/** - * We need this JSDoc comment for affecting ESDoc. - * @extends {Ignored} - * @hide true - */ -var PairsObservable = (function (_super) { - __extends(PairsObservable, _super); - function PairsObservable(obj, scheduler) { - _super.call(this); - this.obj = obj; - this.scheduler = scheduler; - this.keys = Object.keys(obj); - } /** - * Convert an object into an observable sequence of [key, value] pairs - * using an optional IScheduler to enumerate the object. - * - * @example Converts a javascript object to an Observable - * var obj = { - * foo: 42, - * bar: 56, - * baz: 78 - * }; - * - * var source = Rx.Observable.pairs(obj); - * - * var subscription = source.subscribe( - * function (x) { - * console.log('Next: %s', x); - * }, - * function (err) { - * console.log('Error: %s', err); - * }, - * function () { - * console.log('Completed'); - * }); - * - * @param {Object} obj The object to inspect and turn into an - * Observable sequence. - * @param {Scheduler} [scheduler] An optional IScheduler to run the - * enumeration of the input sequence on. - * @returns {(Observable>)} An observable sequence of - * [key, value] pairs from the object. - */ - PairsObservable.create = function (obj, scheduler) { - return new PairsObservable(obj, scheduler); - }; - PairsObservable.prototype._subscribe = function (subscriber) { - var _a = this, keys = _a.keys, scheduler = _a.scheduler; - var length = keys.length; - if (scheduler) { - return scheduler.schedule(dispatch, 0, { - obj: this.obj, keys: keys, length: length, index: 0, subscriber: subscriber - }); + * Consumes the next token from the token stream. + * @return {int} The token type of the token that was just consumed. + * @method get + */ + get: function(channel){ + + var tokenInfo = this._tokenData, + i =0, + token, + info; + + //check the lookahead buffer first + if (this._lt.length && this._ltIndex >= 0 && this._ltIndex < this._lt.length){ + + i++; + this._token = this._lt[this._ltIndex++]; + info = tokenInfo[this._token.type]; + + //obey channels logic + while((info.channel !== undefined && channel !== info.channel) && + this._ltIndex < this._lt.length){ + this._token = this._lt[this._ltIndex++]; + info = tokenInfo[this._token.type]; + i++; + } + + //here be dragons + if ((info.channel === undefined || channel === info.channel) && + this._ltIndex <= this._lt.length){ + this._ltIndexCache.push(i); + return this._token.type; + } } - else { - for (var idx = 0; idx < length; idx++) { - var key = keys[idx]; - subscriber.next([key, this.obj[key]]); + + //call token retriever method + token = this._getToken(); + + //if it should be hidden, don't save a token + if (token.type > -1 && !tokenInfo[token.type].hide){ + + //apply token channel + token.channel = tokenInfo[token.type].channel; + + //save for later + this._token = token; + this._lt.push(token); + + //save space that will be moved (must be done before array is truncated) + this._ltIndexCache.push(this._lt.length - this._ltIndex + i); + + //keep the buffer under 5 items + if (this._lt.length > 5){ + this._lt.shift(); } - subscriber.complete(); + + //also keep the shift buffer under 5 items + if (this._ltIndexCache.length > 5){ + this._ltIndexCache.shift(); + } + + //update lookahead index + this._ltIndex = this._lt.length; } - }; - return PairsObservable; -}(Observable_1.Observable)); -exports.PairsObservable = PairsObservable; -//# sourceMappingURL=PairsObservable.js.map -/***/ }), -/* 257 */ -/***/ (function(module, exports, __webpack_require__) { + /* + * Skip to the next token if: + * 1. The token type is marked as hidden. + * 2. The token type has a channel specified and it isn't the current channel. + */ + info = tokenInfo[token.type]; + if (info && + (info.hide || + (info.channel !== undefined && channel !== info.channel))){ + return this.get(channel); + } else { + //return just the type + return token.type; + } + }, -"use strict"; + /** + * Looks ahead a certain number of tokens and returns the token type at + * that position. This will throw an error if you lookahead past the + * end of input, past the size of the lookahead buffer, or back past + * the first token in the lookahead buffer. + * @param {int} The index of the token type to retrieve. 0 for the + * current token, 1 for the next, -1 for the previous, etc. + * @return {int} The token type of the token in the given position. + * @method LA + */ + LA: function(index){ + var total = index, + tt; + if (index > 0){ + //TODO: Store 5 somewhere + if (index > 5){ + throw new Error("Too much lookahead."); + } + + //get all those tokens + while(total){ + tt = this.get(); + total--; + } + + //unget all those tokens + while(total < index){ + this.unget(); + total++; + } + } else if (index < 0){ + + if(this._lt[this._ltIndex+index]){ + tt = this._lt[this._ltIndex+index].type; + } else { + throw new Error("Too much lookbehind."); + } + + } else { + tt = this._token.type; + } + + return tt; + + }, -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; -var Observable_1 = __webpack_require__(0); -/** - * We need this JSDoc comment for affecting ESDoc. - * @extends {Ignored} - * @hide true - */ -var RangeObservable = (function (_super) { - __extends(RangeObservable, _super); - function RangeObservable(start, count, scheduler) { - _super.call(this); - this.start = start; - this._count = count; - this.scheduler = scheduler; - } /** - * Creates an Observable that emits a sequence of numbers within a specified - * range. - * - * Emits a sequence of numbers in a range. - * - * - * - * `range` operator emits a range of sequential integers, in order, where you - * select the `start` of the range and its `length`. By default, uses no - * IScheduler and just delivers the notifications synchronously, but may use - * an optional IScheduler to regulate those deliveries. - * - * @example Emits the numbers 1 to 10 - * var numbers = Rx.Observable.range(1, 10); - * numbers.subscribe(x => console.log(x)); - * - * @see {@link timer} - * @see {@link interval} - * - * @param {number} [start=0] The value of the first integer in the sequence. - * @param {number} [count=0] The number of sequential integers to generate. - * @param {Scheduler} [scheduler] A {@link IScheduler} to use for scheduling - * the emissions of the notifications. - * @return {Observable} An Observable of numbers that emits a finite range of - * sequential integers. - * @static true - * @name range - * @owner Observable + * Looks ahead a certain number of tokens and returns the token at + * that position. This will throw an error if you lookahead past the + * end of input, past the size of the lookahead buffer, or back past + * the first token in the lookahead buffer. + * @param {int} The index of the token type to retrieve. 0 for the + * current token, 1 for the next, -1 for the previous, etc. + * @return {Object} The token of the token in the given position. + * @method LA + */ + LT: function(index){ + + //lookahead first to prime the token buffer + this.LA(index); + + //now find the token, subtract one because _ltIndex is already at the next index + return this._lt[this._ltIndex+index-1]; + }, + + /** + * Returns the token type for the next token in the stream without + * consuming it. + * @return {int} The token type of the next token in the stream. + * @method peek + */ + peek: function(){ + return this.LA(1); + }, + + /** + * Returns the actual token object for the last consumed token. + * @return {Token} The token object for the last consumed token. + * @method token */ - RangeObservable.create = function (start, count, scheduler) { - if (start === void 0) { start = 0; } - if (count === void 0) { count = 0; } - return new RangeObservable(start, count, scheduler); - }; - RangeObservable.dispatch = function (state) { - var start = state.start, index = state.index, count = state.count, subscriber = state.subscriber; - if (index >= count) { - subscriber.complete(); - return; - } - subscriber.next(start); - if (subscriber.closed) { - return; - } - state.index = index + 1; - state.start = start + 1; - this.schedule(state); - }; - RangeObservable.prototype._subscribe = function (subscriber) { - var index = 0; - var start = this.start; - var count = this._count; - var scheduler = this.scheduler; - if (scheduler) { - return scheduler.schedule(RangeObservable.dispatch, 0, { - index: index, count: count, start: start, subscriber: subscriber - }); + token: function(){ + return this._token; + }, + + /** + * Returns the name of the token for the given token type. + * @param {int} tokenType The type of token to get the name of. + * @return {String} The name of the token or "UNKNOWN_TOKEN" for any + * invalid token type. + * @method tokenName + */ + tokenName: function(tokenType){ + if (tokenType < 0 || tokenType > this._tokenData.length){ + return "UNKNOWN_TOKEN"; + } else { + return this._tokenData[tokenType].name; } - else { - do { - if (index++ >= count) { - subscriber.complete(); - break; - } - subscriber.next(start++); - if (subscriber.closed) { - break; - } - } while (true); + }, + + /** + * Returns the token type value for the given token name. + * @param {String} tokenName The name of the token whose value should be returned. + * @return {int} The token type value for the given token name or -1 + * for an unknown token. + * @method tokenName + */ + tokenType: function(tokenName){ + return this._tokenData[tokenName] || -1; + }, + + /** + * Returns the last consumed token to the token stream. + * @method unget + */ + unget: function(){ + //if (this._ltIndex > -1){ + if (this._ltIndexCache.length){ + this._ltIndex -= this._ltIndexCache.pop();//--; + this._token = this._lt[this._ltIndex - 1]; + } else { + throw new Error("Too much lookahead."); } - }; - return RangeObservable; -}(Observable_1.Observable)); -exports.RangeObservable = RangeObservable; -//# sourceMappingURL=RangeObservable.js.map + } -/***/ }), -/* 258 */ -/***/ (function(module, exports, __webpack_require__) { +}; -"use strict"; -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); +parserlib.util = { +__proto__ : null, +StringReader: StringReader, +SyntaxError : SyntaxError, +SyntaxUnit : SyntaxUnit, +EventTarget : EventTarget, +TokenStreamBase : TokenStreamBase }; -var Observable_1 = __webpack_require__(0); -var asap_1 = __webpack_require__(70); -var isNumeric_1 = __webpack_require__(28); +})(); +/* +Parser-Lib +Copyright (c) 2009-2011 Nicholas C. Zakas. All rights reserved. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. + +*/ +/* Version v0.2.5+domino1, Build time: 30-January-2016 05:13:03 */ +(function(){ +var EventTarget = parserlib.util.EventTarget, +TokenStreamBase = parserlib.util.TokenStreamBase, +StringReader = parserlib.util.StringReader, // jshint ignore:line +SyntaxError = parserlib.util.SyntaxError, +SyntaxUnit = parserlib.util.SyntaxUnit; + +var Colors = { + __proto__ :null, + aliceblue :"#f0f8ff", + antiquewhite :"#faebd7", + aqua :"#00ffff", + aquamarine :"#7fffd4", + azure :"#f0ffff", + beige :"#f5f5dc", + bisque :"#ffe4c4", + black :"#000000", + blanchedalmond :"#ffebcd", + blue :"#0000ff", + blueviolet :"#8a2be2", + brown :"#a52a2a", + burlywood :"#deb887", + cadetblue :"#5f9ea0", + chartreuse :"#7fff00", + chocolate :"#d2691e", + coral :"#ff7f50", + cornflowerblue :"#6495ed", + cornsilk :"#fff8dc", + crimson :"#dc143c", + cyan :"#00ffff", + darkblue :"#00008b", + darkcyan :"#008b8b", + darkgoldenrod :"#b8860b", + darkgray :"#a9a9a9", + darkgrey :"#a9a9a9", + darkgreen :"#006400", + darkkhaki :"#bdb76b", + darkmagenta :"#8b008b", + darkolivegreen :"#556b2f", + darkorange :"#ff8c00", + darkorchid :"#9932cc", + darkred :"#8b0000", + darksalmon :"#e9967a", + darkseagreen :"#8fbc8f", + darkslateblue :"#483d8b", + darkslategray :"#2f4f4f", + darkslategrey :"#2f4f4f", + darkturquoise :"#00ced1", + darkviolet :"#9400d3", + deeppink :"#ff1493", + deepskyblue :"#00bfff", + dimgray :"#696969", + dimgrey :"#696969", + dodgerblue :"#1e90ff", + firebrick :"#b22222", + floralwhite :"#fffaf0", + forestgreen :"#228b22", + fuchsia :"#ff00ff", + gainsboro :"#dcdcdc", + ghostwhite :"#f8f8ff", + gold :"#ffd700", + goldenrod :"#daa520", + gray :"#808080", + grey :"#808080", + green :"#008000", + greenyellow :"#adff2f", + honeydew :"#f0fff0", + hotpink :"#ff69b4", + indianred :"#cd5c5c", + indigo :"#4b0082", + ivory :"#fffff0", + khaki :"#f0e68c", + lavender :"#e6e6fa", + lavenderblush :"#fff0f5", + lawngreen :"#7cfc00", + lemonchiffon :"#fffacd", + lightblue :"#add8e6", + lightcoral :"#f08080", + lightcyan :"#e0ffff", + lightgoldenrodyellow :"#fafad2", + lightgray :"#d3d3d3", + lightgrey :"#d3d3d3", + lightgreen :"#90ee90", + lightpink :"#ffb6c1", + lightsalmon :"#ffa07a", + lightseagreen :"#20b2aa", + lightskyblue :"#87cefa", + lightslategray :"#778899", + lightslategrey :"#778899", + lightsteelblue :"#b0c4de", + lightyellow :"#ffffe0", + lime :"#00ff00", + limegreen :"#32cd32", + linen :"#faf0e6", + magenta :"#ff00ff", + maroon :"#800000", + mediumaquamarine:"#66cdaa", + mediumblue :"#0000cd", + mediumorchid :"#ba55d3", + mediumpurple :"#9370d8", + mediumseagreen :"#3cb371", + mediumslateblue :"#7b68ee", + mediumspringgreen :"#00fa9a", + mediumturquoise :"#48d1cc", + mediumvioletred :"#c71585", + midnightblue :"#191970", + mintcream :"#f5fffa", + mistyrose :"#ffe4e1", + moccasin :"#ffe4b5", + navajowhite :"#ffdead", + navy :"#000080", + oldlace :"#fdf5e6", + olive :"#808000", + olivedrab :"#6b8e23", + orange :"#ffa500", + orangered :"#ff4500", + orchid :"#da70d6", + palegoldenrod :"#eee8aa", + palegreen :"#98fb98", + paleturquoise :"#afeeee", + palevioletred :"#d87093", + papayawhip :"#ffefd5", + peachpuff :"#ffdab9", + peru :"#cd853f", + pink :"#ffc0cb", + plum :"#dda0dd", + powderblue :"#b0e0e6", + purple :"#800080", + red :"#ff0000", + rosybrown :"#bc8f8f", + royalblue :"#4169e1", + saddlebrown :"#8b4513", + salmon :"#fa8072", + sandybrown :"#f4a460", + seagreen :"#2e8b57", + seashell :"#fff5ee", + sienna :"#a0522d", + silver :"#c0c0c0", + skyblue :"#87ceeb", + slateblue :"#6a5acd", + slategray :"#708090", + slategrey :"#708090", + snow :"#fffafa", + springgreen :"#00ff7f", + steelblue :"#4682b4", + tan :"#d2b48c", + teal :"#008080", + thistle :"#d8bfd8", + tomato :"#ff6347", + turquoise :"#40e0d0", + violet :"#ee82ee", + wheat :"#f5deb3", + white :"#ffffff", + whitesmoke :"#f5f5f5", + yellow :"#ffff00", + yellowgreen :"#9acd32", + //'currentColor' color keyword http://www.w3.org/TR/css3-color/#currentcolor + currentColor :"The value of the 'color' property.", + //CSS2 system colors http://www.w3.org/TR/css3-color/#css2-system + activeBorder :"Active window border.", + activecaption :"Active window caption.", + appworkspace :"Background color of multiple document interface.", + background :"Desktop background.", + buttonface :"The face background color for 3-D elements that appear 3-D due to one layer of surrounding border.", + buttonhighlight :"The color of the border facing the light source for 3-D elements that appear 3-D due to one layer of surrounding border.", + buttonshadow :"The color of the border away from the light source for 3-D elements that appear 3-D due to one layer of surrounding border.", + buttontext :"Text on push buttons.", + captiontext :"Text in caption, size box, and scrollbar arrow box.", + graytext :"Grayed (disabled) text. This color is set to #000 if the current display driver does not support a solid gray color.", + greytext :"Greyed (disabled) text. This color is set to #000 if the current display driver does not support a solid grey color.", + highlight :"Item(s) selected in a control.", + highlighttext :"Text of item(s) selected in a control.", + inactiveborder :"Inactive window border.", + inactivecaption :"Inactive window caption.", + inactivecaptiontext :"Color of text in an inactive caption.", + infobackground :"Background color for tooltip controls.", + infotext :"Text color for tooltip controls.", + menu :"Menu background.", + menutext :"Text in menus.", + scrollbar :"Scroll bar gray area.", + threeddarkshadow :"The color of the darker (generally outer) of the two borders away from the light source for 3-D elements that appear 3-D due to two concentric layers of surrounding border.", + threedface :"The face background color for 3-D elements that appear 3-D due to two concentric layers of surrounding border.", + threedhighlight :"The color of the lighter (generally outer) of the two borders facing the light source for 3-D elements that appear 3-D due to two concentric layers of surrounding border.", + threedlightshadow :"The color of the darker (generally inner) of the two borders facing the light source for 3-D elements that appear 3-D due to two concentric layers of surrounding border.", + threedshadow :"The color of the lighter (generally inner) of the two borders away from the light source for 3-D elements that appear 3-D due to two concentric layers of surrounding border.", + window :"Window background.", + windowframe :"Window frame.", + windowtext :"Text in windows." +}; +/** + * Represents a selector combinator (whitespace, +, >). + * @namespace parserlib.css + * @class Combinator + * @extends parserlib.util.SyntaxUnit + * @constructor + * @param {String} text The text representation of the unit. + * @param {int} line The line of text on which the unit resides. + * @param {int} col The column of text on which the unit resides. + */ +function Combinator(text, line, col){ + + SyntaxUnit.call(this, text, line, col, Parser.COMBINATOR_TYPE); + + /** + * The type of modifier. + * @type String + * @property type + */ + this.type = "unknown"; + + //pretty simple + if (/^\s+$/.test(text)){ + this.type = "descendant"; + } else if (text === ">"){ + this.type = "child"; + } else if (text === "+"){ + this.type = "adjacent-sibling"; + } else if (text === "~"){ + this.type = "sibling"; + } + +} + +Combinator.prototype = new SyntaxUnit(); +Combinator.prototype.constructor = Combinator; + /** - * We need this JSDoc comment for affecting ESDoc. - * @extends {Ignored} - * @hide true + * Represents a media feature, such as max-width:500. + * @namespace parserlib.css + * @class MediaFeature + * @extends parserlib.util.SyntaxUnit + * @constructor + * @param {SyntaxUnit} name The name of the feature. + * @param {SyntaxUnit} value The value of the feature or null if none. */ -var SubscribeOnObservable = (function (_super) { - __extends(SubscribeOnObservable, _super); - function SubscribeOnObservable(source, delayTime, scheduler) { - if (delayTime === void 0) { delayTime = 0; } - if (scheduler === void 0) { scheduler = asap_1.asap; } - _super.call(this); - this.source = source; - this.delayTime = delayTime; - this.scheduler = scheduler; - if (!isNumeric_1.isNumeric(delayTime) || delayTime < 0) { - this.delayTime = 0; - } - if (!scheduler || typeof scheduler.schedule !== 'function') { - this.scheduler = asap_1.asap; - } - } - SubscribeOnObservable.create = function (source, delay, scheduler) { - if (delay === void 0) { delay = 0; } - if (scheduler === void 0) { scheduler = asap_1.asap; } - return new SubscribeOnObservable(source, delay, scheduler); - }; - SubscribeOnObservable.dispatch = function (arg) { - var source = arg.source, subscriber = arg.subscriber; - return this.add(source.subscribe(subscriber)); - }; - SubscribeOnObservable.prototype._subscribe = function (subscriber) { - var delay = this.delayTime; - var source = this.source; - var scheduler = this.scheduler; - return scheduler.schedule(SubscribeOnObservable.dispatch, delay, { - source: source, subscriber: subscriber - }); - }; - return SubscribeOnObservable; -}(Observable_1.Observable)); -exports.SubscribeOnObservable = SubscribeOnObservable; -//# sourceMappingURL=SubscribeOnObservable.js.map +function MediaFeature(name, value){ -/***/ }), -/* 259 */ -/***/ (function(module, exports, __webpack_require__) { + SyntaxUnit.call(this, "(" + name + (value !== null ? ":" + value : "") + ")", name.startLine, name.startCol, Parser.MEDIA_FEATURE_TYPE); -"use strict"; + /** + * The name of the media feature + * @type String + * @property name + */ + this.name = name; + + /** + * The value for the feature or null if there is none. + * @type SyntaxUnit + * @property value + */ + this.value = value; +} + +MediaFeature.prototype = new SyntaxUnit(); +MediaFeature.prototype.constructor = MediaFeature; -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; -var isNumeric_1 = __webpack_require__(28); -var Observable_1 = __webpack_require__(0); -var async_1 = __webpack_require__(8); -var isScheduler_1 = __webpack_require__(13); -var isDate_1 = __webpack_require__(27); /** - * We need this JSDoc comment for affecting ESDoc. - * @extends {Ignored} - * @hide true + * Represents an individual media query. + * @namespace parserlib.css + * @class MediaQuery + * @extends parserlib.util.SyntaxUnit + * @constructor + * @param {String} modifier The modifier "not" or "only" (or null). + * @param {String} mediaType The type of media (i.e., "print"). + * @param {Array} parts Array of selectors parts making up this selector. + * @param {int} line The line of text on which the unit resides. + * @param {int} col The column of text on which the unit resides. */ -var TimerObservable = (function (_super) { - __extends(TimerObservable, _super); - function TimerObservable(dueTime, period, scheduler) { - if (dueTime === void 0) { dueTime = 0; } - _super.call(this); - this.period = -1; - this.dueTime = 0; - if (isNumeric_1.isNumeric(period)) { - this.period = Number(period) < 1 && 1 || Number(period); - } - else if (isScheduler_1.isScheduler(period)) { - scheduler = period; - } - if (!isScheduler_1.isScheduler(scheduler)) { - scheduler = async_1.async; - } - this.scheduler = scheduler; - this.dueTime = isDate_1.isDate(dueTime) ? - (+dueTime - this.scheduler.now()) : - dueTime; - } +function MediaQuery(modifier, mediaType, features, line, col){ + + SyntaxUnit.call(this, (modifier ? modifier + " ": "") + (mediaType ? mediaType : "") + (mediaType && features.length > 0 ? " and " : "") + features.join(" and "), line, col, Parser.MEDIA_QUERY_TYPE); + /** - * Creates an Observable that starts emitting after an `initialDelay` and - * emits ever increasing numbers after each `period` of time thereafter. - * - * Its like {@link interval}, but you can specify when - * should the emissions start. - * - * - * - * `timer` returns an Observable that emits an infinite sequence of ascending - * integers, with a constant interval of time, `period` of your choosing - * between those emissions. The first emission happens after the specified - * `initialDelay`. The initial delay may be a {@link Date}. By default, this - * operator uses the `async` IScheduler to provide a notion of time, but you - * may pass any IScheduler to it. If `period` is not specified, the output - * Observable emits only one value, `0`. Otherwise, it emits an infinite - * sequence. - * - * @example Emits ascending numbers, one every second (1000ms), starting after 3 seconds - * var numbers = Rx.Observable.timer(3000, 1000); - * numbers.subscribe(x => console.log(x)); - * - * @example Emits one number after five seconds - * var numbers = Rx.Observable.timer(5000); - * numbers.subscribe(x => console.log(x)); - * - * @see {@link interval} - * @see {@link delay} - * - * @param {number|Date} initialDelay The initial delay time to wait before - * emitting the first value of `0`. - * @param {number} [period] The period of time between emissions of the - * subsequent numbers. - * @param {Scheduler} [scheduler=async] The IScheduler to use for scheduling - * the emission of values, and providing a notion of "time". - * @return {Observable} An Observable that emits a `0` after the - * `initialDelay` and ever increasing numbers after each `period` of time - * thereafter. - * @static true - * @name timer - * @owner Observable + * The media modifier ("not" or "only") + * @type String + * @property modifier */ - TimerObservable.create = function (initialDelay, period, scheduler) { - if (initialDelay === void 0) { initialDelay = 0; } - return new TimerObservable(initialDelay, period, scheduler); - }; - TimerObservable.dispatch = function (state) { - var index = state.index, period = state.period, subscriber = state.subscriber; - var action = this; - subscriber.next(index); - if (subscriber.closed) { - return; - } - else if (period === -1) { - return subscriber.complete(); - } - state.index = index + 1; - action.schedule(state, period); - }; - TimerObservable.prototype._subscribe = function (subscriber) { - var index = 0; - var _a = this, period = _a.period, dueTime = _a.dueTime, scheduler = _a.scheduler; - return scheduler.schedule(TimerObservable.dispatch, dueTime, { - index: index, period: period, subscriber: subscriber - }); - }; - return TimerObservable; -}(Observable_1.Observable)); -exports.TimerObservable = TimerObservable; -//# sourceMappingURL=TimerObservable.js.map + this.modifier = modifier; + + /** + * The mediaType (i.e., "print") + * @type String + * @property mediaType + */ + this.mediaType = mediaType; + + /** + * The parts that make up the selector. + * @type Array + * @property features + */ + this.features = features; + +} + +MediaQuery.prototype = new SyntaxUnit(); +MediaQuery.prototype.constructor = MediaQuery; + + +/** + * A CSS3 parser. + * @namespace parserlib.css + * @class Parser + * @constructor + * @param {Object} options (Optional) Various options for the parser: + * starHack (true|false) to allow IE6 star hack as valid, + * underscoreHack (true|false) to interpret leading underscores + * as IE6-7 targeting for known properties, ieFilters (true|false) + * to indicate that IE < 8 filters should be accepted and not throw + * syntax errors. + */ +function Parser(options){ + + //inherit event functionality + EventTarget.call(this); + + + this.options = options || {}; + + this._tokenStream = null; +} + +//Static constants +Parser.DEFAULT_TYPE = 0; +Parser.COMBINATOR_TYPE = 1; +Parser.MEDIA_FEATURE_TYPE = 2; +Parser.MEDIA_QUERY_TYPE = 3; +Parser.PROPERTY_NAME_TYPE = 4; +Parser.PROPERTY_VALUE_TYPE = 5; +Parser.PROPERTY_VALUE_PART_TYPE = 6; +Parser.SELECTOR_TYPE = 7; +Parser.SELECTOR_PART_TYPE = 8; +Parser.SELECTOR_SUB_PART_TYPE = 9; + +Parser.prototype = function(){ + + var proto = new EventTarget(), //new prototype + prop, + additions = { + __proto__: null, + + //restore constructor + constructor: Parser, + + //instance constants - yuck + DEFAULT_TYPE : 0, + COMBINATOR_TYPE : 1, + MEDIA_FEATURE_TYPE : 2, + MEDIA_QUERY_TYPE : 3, + PROPERTY_NAME_TYPE : 4, + PROPERTY_VALUE_TYPE : 5, + PROPERTY_VALUE_PART_TYPE : 6, + SELECTOR_TYPE : 7, + SELECTOR_PART_TYPE : 8, + SELECTOR_SUB_PART_TYPE : 9, + + //----------------------------------------------------------------- + // Grammar + //----------------------------------------------------------------- + + _stylesheet: function(){ + + /* + * stylesheet + * : [ CHARSET_SYM S* STRING S* ';' ]? + * [S|CDO|CDC]* [ import [S|CDO|CDC]* ]* + * [ namespace [S|CDO|CDC]* ]* + * [ [ ruleset | media | page | font_face | keyframes ] [S|CDO|CDC]* ]* + * ; + */ + + var tokenStream = this._tokenStream, + count, + token, + tt; + + this.fire("startstylesheet"); + + //try to read character set + this._charset(); + + this._skipCruft(); + + //try to read imports - may be more than one + while (tokenStream.peek() === Tokens.IMPORT_SYM){ + this._import(); + this._skipCruft(); + } + + //try to read namespaces - may be more than one + while (tokenStream.peek() === Tokens.NAMESPACE_SYM){ + this._namespace(); + this._skipCruft(); + } + + //get the next token + tt = tokenStream.peek(); + + //try to read the rest + while(tt > Tokens.EOF){ + + try { + + switch(tt){ + case Tokens.MEDIA_SYM: + this._media(); + this._skipCruft(); + break; + case Tokens.PAGE_SYM: + this._page(); + this._skipCruft(); + break; + case Tokens.FONT_FACE_SYM: + this._font_face(); + this._skipCruft(); + break; + case Tokens.KEYFRAMES_SYM: + this._keyframes(); + this._skipCruft(); + break; + case Tokens.VIEWPORT_SYM: + this._viewport(); + this._skipCruft(); + break; + case Tokens.DOCUMENT_SYM: + this._document(); + this._skipCruft(); + break; + case Tokens.UNKNOWN_SYM: //unknown @ rule + tokenStream.get(); + if (!this.options.strict){ + + //fire error event + this.fire({ + type: "error", + error: null, + message: "Unknown @ rule: " + tokenStream.LT(0).value + ".", + line: tokenStream.LT(0).startLine, + col: tokenStream.LT(0).startCol + }); + + //skip braces + count=0; + while (tokenStream.advance([Tokens.LBRACE, Tokens.RBRACE]) === Tokens.LBRACE){ + count++; //keep track of nesting depth + } + + while(count){ + tokenStream.advance([Tokens.RBRACE]); + count--; + } + + } else { + //not a syntax error, rethrow it + throw new SyntaxError("Unknown @ rule.", tokenStream.LT(0).startLine, tokenStream.LT(0).startCol); + } + break; + case Tokens.S: + this._readWhitespace(); + break; + default: + if(!this._ruleset()){ + + //error handling for known issues + switch(tt){ + case Tokens.CHARSET_SYM: + token = tokenStream.LT(1); + this._charset(false); + throw new SyntaxError("@charset not allowed here.", token.startLine, token.startCol); + case Tokens.IMPORT_SYM: + token = tokenStream.LT(1); + this._import(false); + throw new SyntaxError("@import not allowed here.", token.startLine, token.startCol); + case Tokens.NAMESPACE_SYM: + token = tokenStream.LT(1); + this._namespace(false); + throw new SyntaxError("@namespace not allowed here.", token.startLine, token.startCol); + default: + tokenStream.get(); //get the last token + this._unexpectedToken(tokenStream.token()); + } + + } + } + } catch(ex) { + if (ex instanceof SyntaxError && !this.options.strict){ + this.fire({ + type: "error", + error: ex, + message: ex.message, + line: ex.line, + col: ex.col + }); + } else { + throw ex; + } + } + + tt = tokenStream.peek(); + } + + if (tt !== Tokens.EOF){ + this._unexpectedToken(tokenStream.token()); + } + + this.fire("endstylesheet"); + }, + + _charset: function(emit){ + var tokenStream = this._tokenStream, + charset, + token, + line, + col; + + if (tokenStream.match(Tokens.CHARSET_SYM)){ + line = tokenStream.token().startLine; + col = tokenStream.token().startCol; + + this._readWhitespace(); + tokenStream.mustMatch(Tokens.STRING); + + token = tokenStream.token(); + charset = token.value; + + this._readWhitespace(); + tokenStream.mustMatch(Tokens.SEMICOLON); + + if (emit !== false){ + this.fire({ + type: "charset", + charset:charset, + line: line, + col: col + }); + } + } + }, + + _import: function(emit){ + /* + * import + * : IMPORT_SYM S* + * [STRING|URI] S* media_query_list? ';' S* + */ + + var tokenStream = this._tokenStream, + uri, + importToken, + mediaList = []; + + //read import symbol + tokenStream.mustMatch(Tokens.IMPORT_SYM); + importToken = tokenStream.token(); + this._readWhitespace(); + + tokenStream.mustMatch([Tokens.STRING, Tokens.URI]); + + //grab the URI value + uri = tokenStream.token().value.replace(/^(?:url\()?["']?([^"']+?)["']?\)?$/, "$1"); + + this._readWhitespace(); + + mediaList = this._media_query_list(); + + //must end with a semicolon + tokenStream.mustMatch(Tokens.SEMICOLON); + this._readWhitespace(); + + if (emit !== false){ + this.fire({ + type: "import", + uri: uri, + media: mediaList, + line: importToken.startLine, + col: importToken.startCol + }); + } + + }, + + _namespace: function(emit){ + /* + * namespace + * : NAMESPACE_SYM S* [namespace_prefix S*]? [STRING|URI] S* ';' S* + */ + + var tokenStream = this._tokenStream, + line, + col, + prefix, + uri; + + //read import symbol + tokenStream.mustMatch(Tokens.NAMESPACE_SYM); + line = tokenStream.token().startLine; + col = tokenStream.token().startCol; + this._readWhitespace(); + + //it's a namespace prefix - no _namespace_prefix() method because it's just an IDENT + if (tokenStream.match(Tokens.IDENT)){ + prefix = tokenStream.token().value; + this._readWhitespace(); + } + + tokenStream.mustMatch([Tokens.STRING, Tokens.URI]); + /*if (!tokenStream.match(Tokens.STRING)){ + tokenStream.mustMatch(Tokens.URI); + }*/ + + //grab the URI value + uri = tokenStream.token().value.replace(/(?:url\()?["']([^"']+)["']\)?/, "$1"); + + this._readWhitespace(); + + //must end with a semicolon + tokenStream.mustMatch(Tokens.SEMICOLON); + this._readWhitespace(); + + if (emit !== false){ + this.fire({ + type: "namespace", + prefix: prefix, + uri: uri, + line: line, + col: col + }); + } + + }, + + _media: function(){ + /* + * media + * : MEDIA_SYM S* media_query_list S* '{' S* ruleset* '}' S* + * ; + */ + var tokenStream = this._tokenStream, + line, + col, + mediaList;// = []; + + //look for @media + tokenStream.mustMatch(Tokens.MEDIA_SYM); + line = tokenStream.token().startLine; + col = tokenStream.token().startCol; + + this._readWhitespace(); + + mediaList = this._media_query_list(); + + tokenStream.mustMatch(Tokens.LBRACE); + this._readWhitespace(); + + this.fire({ + type: "startmedia", + media: mediaList, + line: line, + col: col + }); + + while(true) { + if (tokenStream.peek() === Tokens.PAGE_SYM){ + this._page(); + } else if (tokenStream.peek() === Tokens.FONT_FACE_SYM){ + this._font_face(); + } else if (tokenStream.peek() === Tokens.VIEWPORT_SYM){ + this._viewport(); + } else if (tokenStream.peek() === Tokens.DOCUMENT_SYM){ + this._document(); + } else if (!this._ruleset()){ + break; + } + } + + tokenStream.mustMatch(Tokens.RBRACE); + this._readWhitespace(); + + this.fire({ + type: "endmedia", + media: mediaList, + line: line, + col: col + }); + }, -/***/ }), -/* 260 */ -/***/ (function(module, exports, __webpack_require__) { -"use strict"; + //CSS3 Media Queries + _media_query_list: function(){ + /* + * media_query_list + * : S* [media_query [ ',' S* media_query ]* ]? + * ; + */ + var tokenStream = this._tokenStream, + mediaList = []; -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; -var Observable_1 = __webpack_require__(0); -var subscribeToResult_1 = __webpack_require__(3); -var OuterSubscriber_1 = __webpack_require__(4); -/** - * We need this JSDoc comment for affecting ESDoc. - * @extends {Ignored} - * @hide true - */ -var UsingObservable = (function (_super) { - __extends(UsingObservable, _super); - function UsingObservable(resourceFactory, observableFactory) { - _super.call(this); - this.resourceFactory = resourceFactory; - this.observableFactory = observableFactory; - } - UsingObservable.create = function (resourceFactory, observableFactory) { - return new UsingObservable(resourceFactory, observableFactory); - }; - UsingObservable.prototype._subscribe = function (subscriber) { - var _a = this, resourceFactory = _a.resourceFactory, observableFactory = _a.observableFactory; - var resource; - try { - resource = resourceFactory(); - return new UsingSubscriber(subscriber, resource, observableFactory); - } - catch (err) { - subscriber.error(err); - } - }; - return UsingObservable; -}(Observable_1.Observable)); -exports.UsingObservable = UsingObservable; -var UsingSubscriber = (function (_super) { - __extends(UsingSubscriber, _super); - function UsingSubscriber(destination, resource, observableFactory) { - _super.call(this, destination); - this.resource = resource; - this.observableFactory = observableFactory; - destination.add(resource); - this.tryUse(); - } - UsingSubscriber.prototype.tryUse = function () { - try { - var source = this.observableFactory.call(this, this.resource); - if (source) { - this.add(subscribeToResult_1.subscribeToResult(this, source)); - } - } - catch (err) { - this._error(err); - } - }; - return UsingSubscriber; -}(OuterSubscriber_1.OuterSubscriber)); -//# sourceMappingURL=UsingObservable.js.map -/***/ }), -/* 261 */ -/***/ (function(module, exports, __webpack_require__) { + this._readWhitespace(); -"use strict"; + if (tokenStream.peek() === Tokens.IDENT || tokenStream.peek() === Tokens.LPAREN){ + mediaList.push(this._media_query()); + } -var BoundCallbackObservable_1 = __webpack_require__(246); -exports.bindCallback = BoundCallbackObservable_1.BoundCallbackObservable.create; -//# sourceMappingURL=bindCallback.js.map + while(tokenStream.match(Tokens.COMMA)){ + this._readWhitespace(); + mediaList.push(this._media_query()); + } -/***/ }), -/* 262 */ -/***/ (function(module, exports, __webpack_require__) { + return mediaList; + }, -"use strict"; + /* + * Note: "expression" in the grammar maps to the _media_expression + * method. -var BoundNodeCallbackObservable_1 = __webpack_require__(247); -exports.bindNodeCallback = BoundNodeCallbackObservable_1.BoundNodeCallbackObservable.create; -//# sourceMappingURL=bindNodeCallback.js.map + */ + _media_query: function(){ + /* + * media_query + * : [ONLY | NOT]? S* media_type S* [ AND S* expression ]* + * | expression [ AND S* expression ]* + * ; + */ + var tokenStream = this._tokenStream, + type = null, + ident = null, + token = null, + expressions = []; + + if (tokenStream.match(Tokens.IDENT)){ + ident = tokenStream.token().value.toLowerCase(); + + //since there's no custom tokens for these, need to manually check + if (ident !== "only" && ident !== "not"){ + tokenStream.unget(); + ident = null; + } else { + token = tokenStream.token(); + } + } -/***/ }), -/* 263 */ -/***/ (function(module, exports, __webpack_require__) { + this._readWhitespace(); -"use strict"; + if (tokenStream.peek() === Tokens.IDENT){ + type = this._media_type(); + if (token === null){ + token = tokenStream.token(); + } + } else if (tokenStream.peek() === Tokens.LPAREN){ + if (token === null){ + token = tokenStream.LT(1); + } + expressions.push(this._media_expression()); + } -var isScheduler_1 = __webpack_require__(13); -var isArray_1 = __webpack_require__(15); -var ArrayObservable_1 = __webpack_require__(14); -var combineLatest_1 = __webpack_require__(37); -/* tslint:enable:max-line-length */ -/** - * Combines multiple Observables to create an Observable whose values are - * calculated from the latest values of each of its input Observables. - * - * Whenever any input Observable emits a value, it - * computes a formula using the latest values from all the inputs, then emits - * the output of that formula. - * - * - * - * `combineLatest` combines the values from all the Observables passed as - * arguments. This is done by subscribing to each Observable in order and, - * whenever any Observable emits, collecting an array of the most recent - * values from each Observable. So if you pass `n` Observables to operator, - * returned Observable will always emit an array of `n` values, in order - * corresponding to order of passed Observables (value from the first Observable - * on the first place and so on). - * - * Static version of `combineLatest` accepts either an array of Observables - * or each Observable can be put directly as an argument. Note that array of - * Observables is good choice, if you don't know beforehand how many Observables - * you will combine. Passing empty array will result in Observable that - * completes immediately. - * - * To ensure output array has always the same length, `combineLatest` will - * actually wait for all input Observables to emit at least once, - * before it starts emitting results. This means if some Observable emits - * values before other Observables started emitting, all that values but last - * will be lost. On the other hand, is some Observable does not emit value but - * completes, resulting Observable will complete at the same moment without - * emitting anything, since it will be now impossible to include value from - * completed Observable in resulting array. Also, if some input Observable does - * not emit any value and never completes, `combineLatest` will also never emit - * and never complete, since, again, it will wait for all streams to emit some - * value. - * - * If at least one Observable was passed to `combineLatest` and all passed Observables - * emitted something, resulting Observable will complete when all combined - * streams complete. So even if some Observable completes, result of - * `combineLatest` will still emit values when other Observables do. In case - * of completed Observable, its value from now on will always be the last - * emitted value. On the other hand, if any Observable errors, `combineLatest` - * will error immediately as well, and all other Observables will be unsubscribed. - * - * `combineLatest` accepts as optional parameter `project` function, which takes - * as arguments all values that would normally be emitted by resulting Observable. - * `project` can return any kind of value, which will be then emitted by Observable - * instead of default array. Note that `project` does not take as argument that array - * of values, but values themselves. That means default `project` can be imagined - * as function that takes all its arguments and puts them into an array. - * - * - * @example Combine two timer Observables - * const firstTimer = Rx.Observable.timer(0, 1000); // emit 0, 1, 2... after every second, starting from now - * const secondTimer = Rx.Observable.timer(500, 1000); // emit 0, 1, 2... after every second, starting 0,5s from now - * const combinedTimers = Rx.Observable.combineLatest(firstTimer, secondTimer); - * combinedTimers.subscribe(value => console.log(value)); - * // Logs - * // [0, 0] after 0.5s - * // [1, 0] after 1s - * // [1, 1] after 1.5s - * // [2, 1] after 2s - * - * - * @example Combine an array of Observables - * const observables = [1, 5, 10].map( - * n => Rx.Observable.of(n).delay(n * 1000).startWith(0) // emit 0 and then emit n after n seconds - * ); - * const combined = Rx.Observable.combineLatest(observables); - * combined.subscribe(value => console.log(value)); - * // Logs - * // [0, 0, 0] immediately - * // [1, 0, 0] after 1s - * // [1, 5, 0] after 5s - * // [1, 5, 10] after 10s - * - * - * @example Use project function to dynamically calculate the Body-Mass Index - * var weight = Rx.Observable.of(70, 72, 76, 79, 75); - * var height = Rx.Observable.of(1.76, 1.77, 1.78); - * var bmi = Rx.Observable.combineLatest(weight, height, (w, h) => w / (h * h)); - * bmi.subscribe(x => console.log('BMI is ' + x)); - * - * // With output to console: - * // BMI is 24.212293388429753 - * // BMI is 23.93948099205209 - * // BMI is 23.671253629592222 - * - * - * @see {@link combineAll} - * @see {@link merge} - * @see {@link withLatestFrom} - * - * @param {ObservableInput} observable1 An input Observable to combine with other Observables. - * @param {ObservableInput} observable2 An input Observable to combine with other Observables. - * More than one input Observables may be given as arguments - * or an array of Observables may be given as the first argument. - * @param {function} [project] An optional function to project the values from - * the combined latest values into a new value on the output Observable. - * @param {Scheduler} [scheduler=null] The IScheduler to use for subscribing to - * each input Observable. - * @return {Observable} An Observable of projected values from the most recent - * values from each input Observable, or an array of the most recent values from - * each input Observable. - * @static true - * @name combineLatest - * @owner Observable - */ -function combineLatest() { - var observables = []; - for (var _i = 0; _i < arguments.length; _i++) { - observables[_i - 0] = arguments[_i]; - } - var project = null; - var scheduler = null; - if (isScheduler_1.isScheduler(observables[observables.length - 1])) { - scheduler = observables.pop(); - } - if (typeof observables[observables.length - 1] === 'function') { - project = observables.pop(); - } - // if the first and only other argument besides the resultSelector is an array - // assume it's been called with `combineLatest([obs1, obs2, obs3], project)` - if (observables.length === 1 && isArray_1.isArray(observables[0])) { - observables = observables[0]; - } - return new ArrayObservable_1.ArrayObservable(observables, scheduler).lift(new combineLatest_1.CombineLatestOperator(project)); -} -exports.combineLatest = combineLatest; -//# sourceMappingURL=combineLatest.js.map + if (type === null && expressions.length === 0){ + return null; + } else { + this._readWhitespace(); + while (tokenStream.match(Tokens.IDENT)){ + if (tokenStream.token().value.toLowerCase() !== "and"){ + this._unexpectedToken(tokenStream.token()); + } -/***/ }), -/* 264 */ -/***/ (function(module, exports, __webpack_require__) { + this._readWhitespace(); + expressions.push(this._media_expression()); + } + } -"use strict"; + return new MediaQuery(ident, type, expressions, token.startLine, token.startCol); + }, -var concat_1 = __webpack_require__(38); -exports.concat = concat_1.concatStatic; -//# sourceMappingURL=concat.js.map + //CSS3 Media Queries + _media_type: function(){ + /* + * media_type + * : IDENT + * ; + */ + return this._media_feature(); + }, -/***/ }), -/* 265 */ -/***/ (function(module, exports, __webpack_require__) { + /** + * Note: in CSS3 Media Queries, this is called "expression". + * Renamed here to avoid conflict with CSS3 Selectors + * definition of "expression". Also note that "expr" in the + * grammar now maps to "expression" from CSS3 selectors. + * @method _media_expression + * @private + */ + _media_expression: function(){ + /* + * expression + * : '(' S* media_feature S* [ ':' S* expr ]? ')' S* + * ; + */ + var tokenStream = this._tokenStream, + feature = null, + token, + expression = null; + + tokenStream.mustMatch(Tokens.LPAREN); + + feature = this._media_feature(); + this._readWhitespace(); + + if (tokenStream.match(Tokens.COLON)){ + this._readWhitespace(); + token = tokenStream.LT(1); + expression = this._expression(); + } -"use strict"; + tokenStream.mustMatch(Tokens.RPAREN); + this._readWhitespace(); -var DeferObservable_1 = __webpack_require__(248); -exports.defer = DeferObservable_1.DeferObservable.create; -//# sourceMappingURL=defer.js.map + return new MediaFeature(feature, (expression ? new SyntaxUnit(expression, token.startLine, token.startCol) : null)); + }, -/***/ }), -/* 266 */ -/***/ (function(module, exports, __webpack_require__) { + //CSS3 Media Queries + _media_feature: function(){ + /* + * media_feature + * : IDENT + * ; + */ + var tokenStream = this._tokenStream; -"use strict"; + this._readWhitespace(); -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; -var Subject_1 = __webpack_require__(6); -var Subscriber_1 = __webpack_require__(2); -var Observable_1 = __webpack_require__(0); -var Subscription_1 = __webpack_require__(9); -var root_1 = __webpack_require__(12); -var ReplaySubject_1 = __webpack_require__(26); -var tryCatch_1 = __webpack_require__(7); -var errorObject_1 = __webpack_require__(5); -var assign_1 = __webpack_require__(373); -/** - * We need this JSDoc comment for affecting ESDoc. - * @extends {Ignored} - * @hide true - */ -var WebSocketSubject = (function (_super) { - __extends(WebSocketSubject, _super); - function WebSocketSubject(urlConfigOrSource, destination) { - if (urlConfigOrSource instanceof Observable_1.Observable) { - _super.call(this, destination, urlConfigOrSource); - } - else { - _super.call(this); - this.WebSocketCtor = root_1.root.WebSocket; - this._output = new Subject_1.Subject(); - if (typeof urlConfigOrSource === 'string') { - this.url = urlConfigOrSource; - } - else { - // WARNING: config object could override important members here. - assign_1.assign(this, urlConfigOrSource); - } - if (!this.WebSocketCtor) { - throw new Error('no WebSocket constructor can be found'); - } - this.destination = new ReplaySubject_1.ReplaySubject(); - } - } - WebSocketSubject.prototype.resultSelector = function (e) { - return JSON.parse(e.data); - }; - /** - * Wrapper around the w3c-compatible WebSocket object provided by the browser. - * - * @example Wraps browser WebSocket - * - * let socket$ = Observable.webSocket('ws://localhost:8081'); - * - * socket$.subscribe( - * (msg) => console.log('message received: ' + msg), - * (err) => console.log(err), - * () => console.log('complete') - * ); - * - * socket$.next(JSON.stringify({ op: 'hello' })); - * - * @example Wraps WebSocket from nodejs-websocket (using node.js) - * - * import { w3cwebsocket } from 'websocket'; - * - * let socket$ = Observable.webSocket({ - * url: 'ws://localhost:8081', - * WebSocketCtor: w3cwebsocket - * }); - * - * socket$.subscribe( - * (msg) => console.log('message received: ' + msg), - * (err) => console.log(err), - * () => console.log('complete') - * ); - * - * socket$.next(JSON.stringify({ op: 'hello' })); - * - * @param {string | WebSocketSubjectConfig} urlConfigOrSource the source of the websocket as an url or a structure defining the websocket object - * @return {WebSocketSubject} - * @static true - * @name webSocket - * @owner Observable - */ - WebSocketSubject.create = function (urlConfigOrSource) { - return new WebSocketSubject(urlConfigOrSource); - }; - WebSocketSubject.prototype.lift = function (operator) { - var sock = new WebSocketSubject(this, this.destination); - sock.operator = operator; - return sock; - }; - WebSocketSubject.prototype._resetState = function () { - this.socket = null; - if (!this.source) { - this.destination = new ReplaySubject_1.ReplaySubject(); - } - this._output = new Subject_1.Subject(); - }; - // TODO: factor this out to be a proper Operator/Subscriber implementation and eliminate closures - WebSocketSubject.prototype.multiplex = function (subMsg, unsubMsg, messageFilter) { - var self = this; - return new Observable_1.Observable(function (observer) { - var result = tryCatch_1.tryCatch(subMsg)(); - if (result === errorObject_1.errorObject) { - observer.error(errorObject_1.errorObject.e); - } - else { - self.next(result); - } - var subscription = self.subscribe(function (x) { - var result = tryCatch_1.tryCatch(messageFilter)(x); - if (result === errorObject_1.errorObject) { - observer.error(errorObject_1.errorObject.e); + tokenStream.mustMatch(Tokens.IDENT); + + return SyntaxUnit.fromToken(tokenStream.token()); + }, + + //CSS3 Paged Media + _page: function(){ + /* + * page: + * PAGE_SYM S* IDENT? pseudo_page? S* + * '{' S* [ declaration | margin ]? [ ';' S* [ declaration | margin ]? ]* '}' S* + * ; + */ + var tokenStream = this._tokenStream, + line, + col, + identifier = null, + pseudoPage = null; + + //look for @page + tokenStream.mustMatch(Tokens.PAGE_SYM); + line = tokenStream.token().startLine; + col = tokenStream.token().startCol; + + this._readWhitespace(); + + if (tokenStream.match(Tokens.IDENT)){ + identifier = tokenStream.token().value; + + //The value 'auto' may not be used as a page name and MUST be treated as a syntax error. + if (identifier.toLowerCase() === "auto"){ + this._unexpectedToken(tokenStream.token()); + } } - else if (result) { - observer.next(x); + + //see if there's a colon upcoming + if (tokenStream.peek() === Tokens.COLON){ + pseudoPage = this._pseudo_page(); } - }, function (err) { return observer.error(err); }, function () { return observer.complete(); }); - return function () { - var result = tryCatch_1.tryCatch(unsubMsg)(); - if (result === errorObject_1.errorObject) { - observer.error(errorObject_1.errorObject.e); + + this._readWhitespace(); + + this.fire({ + type: "startpage", + id: identifier, + pseudo: pseudoPage, + line: line, + col: col + }); + + this._readDeclarations(true, true); + + this.fire({ + type: "endpage", + id: identifier, + pseudo: pseudoPage, + line: line, + col: col + }); + + }, + + //CSS3 Paged Media + _margin: function(){ + /* + * margin : + * margin_sym S* '{' declaration [ ';' S* declaration? ]* '}' S* + * ; + */ + var tokenStream = this._tokenStream, + line, + col, + marginSym = this._margin_sym(); + + if (marginSym){ + line = tokenStream.token().startLine; + col = tokenStream.token().startCol; + + this.fire({ + type: "startpagemargin", + margin: marginSym, + line: line, + col: col + }); + + this._readDeclarations(true); + + this.fire({ + type: "endpagemargin", + margin: marginSym, + line: line, + col: col + }); + return true; + } else { + return false; } - else { - self.next(result); + }, + + //CSS3 Paged Media + _margin_sym: function(){ + + /* + * margin_sym : + * TOPLEFTCORNER_SYM | + * TOPLEFT_SYM | + * TOPCENTER_SYM | + * TOPRIGHT_SYM | + * TOPRIGHTCORNER_SYM | + * BOTTOMLEFTCORNER_SYM | + * BOTTOMLEFT_SYM | + * BOTTOMCENTER_SYM | + * BOTTOMRIGHT_SYM | + * BOTTOMRIGHTCORNER_SYM | + * LEFTTOP_SYM | + * LEFTMIDDLE_SYM | + * LEFTBOTTOM_SYM | + * RIGHTTOP_SYM | + * RIGHTMIDDLE_SYM | + * RIGHTBOTTOM_SYM + * ; + */ + + var tokenStream = this._tokenStream; + + if(tokenStream.match([Tokens.TOPLEFTCORNER_SYM, Tokens.TOPLEFT_SYM, + Tokens.TOPCENTER_SYM, Tokens.TOPRIGHT_SYM, Tokens.TOPRIGHTCORNER_SYM, + Tokens.BOTTOMLEFTCORNER_SYM, Tokens.BOTTOMLEFT_SYM, + Tokens.BOTTOMCENTER_SYM, Tokens.BOTTOMRIGHT_SYM, + Tokens.BOTTOMRIGHTCORNER_SYM, Tokens.LEFTTOP_SYM, + Tokens.LEFTMIDDLE_SYM, Tokens.LEFTBOTTOM_SYM, Tokens.RIGHTTOP_SYM, + Tokens.RIGHTMIDDLE_SYM, Tokens.RIGHTBOTTOM_SYM])) + { + return SyntaxUnit.fromToken(tokenStream.token()); + } else { + return null; } - subscription.unsubscribe(); - }; - }); - }; - WebSocketSubject.prototype._connectSocket = function () { - var _this = this; - var WebSocketCtor = this.WebSocketCtor; - var observer = this._output; - var socket = null; - try { - socket = this.protocol ? - new WebSocketCtor(this.url, this.protocol) : - new WebSocketCtor(this.url); - this.socket = socket; - if (this.binaryType) { - this.socket.binaryType = this.binaryType; - } - } - catch (e) { - observer.error(e); - return; - } - var subscription = new Subscription_1.Subscription(function () { - _this.socket = null; - if (socket && socket.readyState === 1) { - socket.close(); - } - }); - socket.onopen = function (e) { - var openObserver = _this.openObserver; - if (openObserver) { - openObserver.next(e); - } - var queue = _this.destination; - _this.destination = Subscriber_1.Subscriber.create(function (x) { return socket.readyState === 1 && socket.send(x); }, function (e) { - var closingObserver = _this.closingObserver; - if (closingObserver) { - closingObserver.next(undefined); + + }, + + _pseudo_page: function(){ + /* + * pseudo_page + * : ':' IDENT + * ; + */ + + var tokenStream = this._tokenStream; + + tokenStream.mustMatch(Tokens.COLON); + tokenStream.mustMatch(Tokens.IDENT); + + //TODO: CSS3 Paged Media says only "left", "center", and "right" are allowed + + return tokenStream.token().value; + }, + + _font_face: function(){ + /* + * font_face + * : FONT_FACE_SYM S* + * '{' S* declaration [ ';' S* declaration ]* '}' S* + * ; + */ + var tokenStream = this._tokenStream, + line, + col; + + //look for @page + tokenStream.mustMatch(Tokens.FONT_FACE_SYM); + line = tokenStream.token().startLine; + col = tokenStream.token().startCol; + + this._readWhitespace(); + + this.fire({ + type: "startfontface", + line: line, + col: col + }); + + this._readDeclarations(true); + + this.fire({ + type: "endfontface", + line: line, + col: col + }); + }, + + _viewport: function(){ + /* + * viewport + * : VIEWPORT_SYM S* + * '{' S* declaration? [ ';' S* declaration? ]* '}' S* + * ; + */ + var tokenStream = this._tokenStream, + line, + col; + + tokenStream.mustMatch(Tokens.VIEWPORT_SYM); + line = tokenStream.token().startLine; + col = tokenStream.token().startCol; + + this._readWhitespace(); + + this.fire({ + type: "startviewport", + line: line, + col: col + }); + + this._readDeclarations(true); + + this.fire({ + type: "endviewport", + line: line, + col: col + }); + + }, + + _document: function(){ + /* + * document + * : DOCUMENT_SYM S* + * _document_function [ ',' S* _document_function ]* S* + * '{' S* ruleset* '}' + * ; + */ + + var tokenStream = this._tokenStream, + token, + functions = [], + prefix = ""; + + tokenStream.mustMatch(Tokens.DOCUMENT_SYM); + token = tokenStream.token(); + if (/^@\-([^\-]+)\-/.test(token.value)) { + prefix = RegExp.$1; } - if (e && e.code) { - socket.close(e.code, e.reason); + + this._readWhitespace(); + functions.push(this._document_function()); + + while(tokenStream.match(Tokens.COMMA)) { + this._readWhitespace(); + functions.push(this._document_function()); } - else { - observer.error(new TypeError('WebSocketSubject.error must be called with an object with an error code, ' + - 'and an optional reason: { code: number, reason: string }')); + + tokenStream.mustMatch(Tokens.LBRACE); + this._readWhitespace(); + + this.fire({ + type: "startdocument", + functions: functions, + prefix: prefix, + line: token.startLine, + col: token.startCol + }); + + while(true) { + if (tokenStream.peek() === Tokens.PAGE_SYM){ + this._page(); + } else if (tokenStream.peek() === Tokens.FONT_FACE_SYM){ + this._font_face(); + } else if (tokenStream.peek() === Tokens.VIEWPORT_SYM){ + this._viewport(); + } else if (tokenStream.peek() === Tokens.MEDIA_SYM){ + this._media(); + } else if (!this._ruleset()){ + break; + } } - _this._resetState(); - }, function () { - var closingObserver = _this.closingObserver; - if (closingObserver) { - closingObserver.next(undefined); + + tokenStream.mustMatch(Tokens.RBRACE); + this._readWhitespace(); + + this.fire({ + type: "enddocument", + functions: functions, + prefix: prefix, + line: token.startLine, + col: token.startCol + }); + }, + + _document_function: function(){ + /* + * document_function + * : function | URI S* + * ; + */ + + var tokenStream = this._tokenStream, + value; + + if (tokenStream.match(Tokens.URI)) { + value = tokenStream.token().value; + this._readWhitespace(); + } else { + value = this._function(); } - socket.close(); - _this._resetState(); - }); - if (queue && queue instanceof ReplaySubject_1.ReplaySubject) { - subscription.add(queue.subscribe(_this.destination)); - } - }; - socket.onerror = function (e) { - _this._resetState(); - observer.error(e); - }; - socket.onclose = function (e) { - _this._resetState(); - var closeObserver = _this.closeObserver; - if (closeObserver) { - closeObserver.next(e); - } - if (e.wasClean) { - observer.complete(); - } - else { - observer.error(e); - } - }; - socket.onmessage = function (e) { - var result = tryCatch_1.tryCatch(_this.resultSelector)(e); - if (result === errorObject_1.errorObject) { - observer.error(errorObject_1.errorObject.e); - } - else { - observer.next(result); - } - }; - }; - WebSocketSubject.prototype._subscribe = function (subscriber) { - var _this = this; - var source = this.source; - if (source) { - return source.subscribe(subscriber); - } - if (!this.socket) { - this._connectSocket(); - } - var subscription = new Subscription_1.Subscription(); - subscription.add(this._output.subscribe(subscriber)); - subscription.add(function () { - var socket = _this.socket; - if (_this._output.observers.length === 0) { - if (socket && socket.readyState === 1) { - socket.close(); + + return value; + }, + + _operator: function(inFunction){ + + /* + * operator (outside function) + * : '/' S* | ',' S* | /( empty )/ + * operator (inside function) + * : '/' S* | '+' S* | '*' S* | '-' S* /( empty )/ + * ; + */ + + var tokenStream = this._tokenStream, + token = null; + + if (tokenStream.match([Tokens.SLASH, Tokens.COMMA]) || + (inFunction && tokenStream.match([Tokens.PLUS, Tokens.STAR, Tokens.MINUS]))){ + token = tokenStream.token(); + this._readWhitespace(); } - _this._resetState(); - } - }); - return subscription; - }; - WebSocketSubject.prototype.unsubscribe = function () { - var _a = this, source = _a.source, socket = _a.socket; - if (socket && socket.readyState === 1) { - socket.close(); - this._resetState(); - } - _super.prototype.unsubscribe.call(this); - if (!source) { - this.destination = new ReplaySubject_1.ReplaySubject(); - } - }; - return WebSocketSubject; -}(Subject_1.AnonymousSubject)); -exports.WebSocketSubject = WebSocketSubject; -//# sourceMappingURL=WebSocketSubject.js.map + return token ? PropertyValuePart.fromToken(token) : null; -/***/ }), -/* 267 */ -/***/ (function(module, exports, __webpack_require__) { + }, -"use strict"; + _combinator: function(){ -var AjaxObservable_1 = __webpack_require__(59); -exports.ajax = AjaxObservable_1.AjaxObservable.create; -//# sourceMappingURL=ajax.js.map + /* + * combinator + * : PLUS S* | GREATER S* | TILDE S* | S+ + * ; + */ -/***/ }), -/* 268 */ -/***/ (function(module, exports, __webpack_require__) { + var tokenStream = this._tokenStream, + value = null, + token; -"use strict"; + if(tokenStream.match([Tokens.PLUS, Tokens.GREATER, Tokens.TILDE])){ + token = tokenStream.token(); + value = new Combinator(token.value, token.startLine, token.startCol); + this._readWhitespace(); + } -var WebSocketSubject_1 = __webpack_require__(266); -exports.webSocket = WebSocketSubject_1.WebSocketSubject.create; -//# sourceMappingURL=webSocket.js.map + return value; + }, -/***/ }), -/* 269 */ -/***/ (function(module, exports, __webpack_require__) { + _unary_operator: function(){ -"use strict"; + /* + * unary_operator + * : '-' | '+' + * ; + */ -var EmptyObservable_1 = __webpack_require__(23); -exports.empty = EmptyObservable_1.EmptyObservable.create; -//# sourceMappingURL=empty.js.map + var tokenStream = this._tokenStream; + + if (tokenStream.match([Tokens.MINUS, Tokens.PLUS])){ + return tokenStream.token().value; + } else { + return null; + } + }, + + _property: function(){ + + /* + * property + * : IDENT S* + * ; + */ + + var tokenStream = this._tokenStream, + value = null, + hack = null, + tokenValue, + token, + line, + col; + + //check for star hack - throws error if not allowed + if (tokenStream.peek() === Tokens.STAR && this.options.starHack){ + tokenStream.get(); + token = tokenStream.token(); + hack = token.value; + line = token.startLine; + col = token.startCol; + } + + if(tokenStream.match(Tokens.IDENT)){ + token = tokenStream.token(); + tokenValue = token.value; + + //check for underscore hack - no error if not allowed because it's valid CSS syntax + if (tokenValue.charAt(0) === "_" && this.options.underscoreHack){ + hack = "_"; + tokenValue = tokenValue.substring(1); + } -/***/ }), -/* 270 */ -/***/ (function(module, exports, __webpack_require__) { + value = new PropertyName(tokenValue, hack, (line||token.startLine), (col||token.startCol)); + this._readWhitespace(); + } -"use strict"; + return value; + }, -var FromEventObservable_1 = __webpack_require__(250); -exports.fromEvent = FromEventObservable_1.FromEventObservable.create; -//# sourceMappingURL=fromEvent.js.map + //Augmented with CSS3 Selectors + _ruleset: function(){ + /* + * ruleset + * : selectors_group + * '{' S* declaration? [ ';' S* declaration? ]* '}' S* + * ; + */ -/***/ }), -/* 271 */ -/***/ (function(module, exports, __webpack_require__) { + var tokenStream = this._tokenStream, + tt, + selectors; -"use strict"; -var FromEventPatternObservable_1 = __webpack_require__(251); -exports.fromEventPattern = FromEventPatternObservable_1.FromEventPatternObservable.create; -//# sourceMappingURL=fromEventPattern.js.map + /* + * Error Recovery: If even a single selector fails to parse, + * then the entire ruleset should be thrown away. + */ + try { + selectors = this._selectors_group(); + } catch (ex){ + if (ex instanceof SyntaxError && !this.options.strict){ + + //fire error event + this.fire({ + type: "error", + error: ex, + message: ex.message, + line: ex.line, + col: ex.col + }); + + //skip over everything until closing brace + tt = tokenStream.advance([Tokens.RBRACE]); + if (tt === Tokens.RBRACE){ + //if there's a right brace, the rule is finished so don't do anything + } else { + //otherwise, rethrow the error because it wasn't handled properly + throw ex; + } -/***/ }), -/* 272 */ -/***/ (function(module, exports, __webpack_require__) { + } else { + //not a syntax error, rethrow it + throw ex; + } -"use strict"; + //trigger parser to continue + return true; + } -var IfObservable_1 = __webpack_require__(253); -exports._if = IfObservable_1.IfObservable.create; -//# sourceMappingURL=if.js.map + //if it got here, all selectors parsed + if (selectors){ -/***/ }), -/* 273 */ -/***/ (function(module, exports, __webpack_require__) { + this.fire({ + type: "startrule", + selectors: selectors, + line: selectors[0].line, + col: selectors[0].col + }); -"use strict"; + this._readDeclarations(true); -var IntervalObservable_1 = __webpack_require__(254); -exports.interval = IntervalObservable_1.IntervalObservable.create; -//# sourceMappingURL=interval.js.map + this.fire({ + type: "endrule", + selectors: selectors, + line: selectors[0].line, + col: selectors[0].col + }); -/***/ }), -/* 274 */ -/***/ (function(module, exports, __webpack_require__) { + } -"use strict"; + return selectors; -var NeverObservable_1 = __webpack_require__(255); -exports.never = NeverObservable_1.NeverObservable.create; -//# sourceMappingURL=never.js.map + }, -/***/ }), -/* 275 */ -/***/ (function(module, exports, __webpack_require__) { + //CSS3 Selectors + _selectors_group: function(){ + + /* + * selectors_group + * : selector [ COMMA S* selector ]* + * ; + */ + var tokenStream = this._tokenStream, + selectors = [], + selector; + + selector = this._selector(); + if (selector !== null){ + + selectors.push(selector); + while(tokenStream.match(Tokens.COMMA)){ + this._readWhitespace(); + selector = this._selector(); + if (selector !== null){ + selectors.push(selector); + } else { + this._unexpectedToken(tokenStream.LT(1)); + } + } + } -"use strict"; + return selectors.length ? selectors : null; + }, -var PairsObservable_1 = __webpack_require__(256); -exports.pairs = PairsObservable_1.PairsObservable.create; -//# sourceMappingURL=pairs.js.map + //CSS3 Selectors + _selector: function(){ + /* + * selector + * : simple_selector_sequence [ combinator simple_selector_sequence ]* + * ; + */ + + var tokenStream = this._tokenStream, + selector = [], + nextSelector = null, + combinator = null, + ws = null; + + //if there's no simple selector, then there's no selector + nextSelector = this._simple_selector_sequence(); + if (nextSelector === null){ + return null; + } -/***/ }), -/* 276 */ -/***/ (function(module, exports, __webpack_require__) { + selector.push(nextSelector); -"use strict"; + do { -var RangeObservable_1 = __webpack_require__(257); -exports.range = RangeObservable_1.RangeObservable.create; -//# sourceMappingURL=range.js.map + //look for a combinator + combinator = this._combinator(); -/***/ }), -/* 277 */ -/***/ (function(module, exports, __webpack_require__) { + if (combinator !== null){ + selector.push(combinator); + nextSelector = this._simple_selector_sequence(); -"use strict"; + //there must be a next selector + if (nextSelector === null){ + this._unexpectedToken(tokenStream.LT(1)); + } else { -var ErrorObservable_1 = __webpack_require__(249); -exports._throw = ErrorObservable_1.ErrorObservable.create; -//# sourceMappingURL=throw.js.map + //nextSelector is an instance of SelectorPart + selector.push(nextSelector); + } + } else { + + //if there's not whitespace, we're done + if (this._readWhitespace()){ + + //add whitespace separator + ws = new Combinator(tokenStream.token().value, tokenStream.token().startLine, tokenStream.token().startCol); + + //combinator is not required + combinator = this._combinator(); + + //selector is required if there's a combinator + nextSelector = this._simple_selector_sequence(); + if (nextSelector === null){ + if (combinator !== null){ + this._unexpectedToken(tokenStream.LT(1)); + } + } else { + + if (combinator !== null){ + selector.push(combinator); + } else { + selector.push(ws); + } + + selector.push(nextSelector); + } + } else { + break; + } -/***/ }), -/* 278 */ -/***/ (function(module, exports, __webpack_require__) { + } + } while(true); -"use strict"; + return new Selector(selector, selector[0].line, selector[0].col); + }, -var TimerObservable_1 = __webpack_require__(259); -exports.timer = TimerObservable_1.TimerObservable.create; -//# sourceMappingURL=timer.js.map + //CSS3 Selectors + _simple_selector_sequence: function(){ + /* + * simple_selector_sequence + * : [ type_selector | universal ] + * [ HASH | class | attrib | pseudo | negation ]* + * | [ HASH | class | attrib | pseudo | negation ]+ + * ; + */ + + var tokenStream = this._tokenStream, + + //parts of a simple selector + elementName = null, + modifiers = [], + + //complete selector text + selectorText= "", + + //the different parts after the element name to search for + components = [ + //HASH + function(){ + return tokenStream.match(Tokens.HASH) ? + new SelectorSubPart(tokenStream.token().value, "id", tokenStream.token().startLine, tokenStream.token().startCol) : + null; + }, + this._class, + this._attrib, + this._pseudo, + this._negation + ], + i = 0, + len = components.length, + component = null, + line, + col; + + + //get starting line and column for the selector + line = tokenStream.LT(1).startLine; + col = tokenStream.LT(1).startCol; + + elementName = this._type_selector(); + if (!elementName){ + elementName = this._universal(); + } -/***/ }), -/* 279 */ -/***/ (function(module, exports, __webpack_require__) { + if (elementName !== null){ + selectorText += elementName; + } -"use strict"; + while(true){ -var UsingObservable_1 = __webpack_require__(260); -exports.using = UsingObservable_1.UsingObservable.create; -//# sourceMappingURL=using.js.map + //whitespace means we're done + if (tokenStream.peek() === Tokens.S){ + break; + } -/***/ }), -/* 280 */ -/***/ (function(module, exports, __webpack_require__) { + //check for each component + while(i < len && component === null){ + component = components[i++].call(this); + } -"use strict"; + if (component === null){ -var zip_1 = __webpack_require__(39); -exports.zip = zip_1.zipStatic; -//# sourceMappingURL=zip.js.map + //we don't have a selector + if (selectorText === ""){ + return null; + } else { + break; + } + } else { + i = 0; + modifiers.push(component); + selectorText += component.toString(); + component = null; + } + } -/***/ }), -/* 281 */ -/***/ (function(module, exports, __webpack_require__) { -"use strict"; + return selectorText !== "" ? + new SelectorPart(elementName, modifiers, selectorText, line, col) : + null; + }, -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; -var tryCatch_1 = __webpack_require__(7); -var errorObject_1 = __webpack_require__(5); -var OuterSubscriber_1 = __webpack_require__(4); -var subscribeToResult_1 = __webpack_require__(3); -/** - * Ignores source values for a duration determined by another Observable, then - * emits the most recent value from the source Observable, then repeats this - * process. - * - * It's like {@link auditTime}, but the silencing - * duration is determined by a second Observable. - * - * - * - * `audit` is similar to `throttle`, but emits the last value from the silenced - * time window, instead of the first value. `audit` emits the most recent value - * from the source Observable on the output Observable as soon as its internal - * timer becomes disabled, and ignores source values while the timer is enabled. - * Initially, the timer is disabled. As soon as the first source value arrives, - * the timer is enabled by calling the `durationSelector` function with the - * source value, which returns the "duration" Observable. When the duration - * Observable emits a value or completes, the timer is disabled, then the most - * recent source value is emitted on the output Observable, and this process - * repeats for the next source value. - * - * @example Emit clicks at a rate of at most one click per second - * var clicks = Rx.Observable.fromEvent(document, 'click'); - * var result = clicks.audit(ev => Rx.Observable.interval(1000)); - * result.subscribe(x => console.log(x)); - * - * @see {@link auditTime} - * @see {@link debounce} - * @see {@link delayWhen} - * @see {@link sample} - * @see {@link throttle} - * - * @param {function(value: T): SubscribableOrPromise} durationSelector A function - * that receives a value from the source Observable, for computing the silencing - * duration, returned as an Observable or a Promise. - * @return {Observable} An Observable that performs rate-limiting of - * emissions from the source Observable. - * @method audit - * @owner Observable - */ -function audit(durationSelector) { - return this.lift(new AuditOperator(durationSelector)); -} -exports.audit = audit; -var AuditOperator = (function () { - function AuditOperator(durationSelector) { - this.durationSelector = durationSelector; - } - AuditOperator.prototype.call = function (subscriber, source) { - return source.subscribe(new AuditSubscriber(subscriber, this.durationSelector)); - }; - return AuditOperator; -}()); -/** - * We need this JSDoc comment for affecting ESDoc. - * @ignore - * @extends {Ignored} - */ -var AuditSubscriber = (function (_super) { - __extends(AuditSubscriber, _super); - function AuditSubscriber(destination, durationSelector) { - _super.call(this, destination); - this.durationSelector = durationSelector; - this.hasValue = false; - } - AuditSubscriber.prototype._next = function (value) { - this.value = value; - this.hasValue = true; - if (!this.throttled) { - var duration = tryCatch_1.tryCatch(this.durationSelector)(value); - if (duration === errorObject_1.errorObject) { - this.destination.error(errorObject_1.errorObject.e); - } - else { - var innerSubscription = subscribeToResult_1.subscribeToResult(this, duration); - if (innerSubscription.closed) { - this.clearThrottle(); + //CSS3 Selectors + _type_selector: function(){ + /* + * type_selector + * : [ namespace_prefix ]? element_name + * ; + */ + + var tokenStream = this._tokenStream, + ns = this._namespace_prefix(), + elementName = this._element_name(); + + if (!elementName){ + /* + * Need to back out the namespace that was read due to both + * type_selector and universal reading namespace_prefix + * first. Kind of hacky, but only way I can figure out + * right now how to not change the grammar. + */ + if (ns){ + tokenStream.unget(); + if (ns.length > 1){ + tokenStream.unget(); + } + } + + return null; + } else { + if (ns){ + elementName.text = ns + elementName.text; + elementName.col -= ns.length; + } + return elementName; } - else { - this.add(this.throttled = innerSubscription); + }, + + //CSS3 Selectors + _class: function(){ + /* + * class + * : '.' IDENT + * ; + */ + + var tokenStream = this._tokenStream, + token; + + if (tokenStream.match(Tokens.DOT)){ + tokenStream.mustMatch(Tokens.IDENT); + token = tokenStream.token(); + return new SelectorSubPart("." + token.value, "class", token.startLine, token.startCol - 1); + } else { + return null; } - } - } - }; - AuditSubscriber.prototype.clearThrottle = function () { - var _a = this, value = _a.value, hasValue = _a.hasValue, throttled = _a.throttled; - if (throttled) { - this.remove(throttled); - this.throttled = null; - throttled.unsubscribe(); - } - if (hasValue) { - this.value = null; - this.hasValue = false; - this.destination.next(value); - } - }; - AuditSubscriber.prototype.notifyNext = function (outerValue, innerValue, outerIndex, innerIndex) { - this.clearThrottle(); - }; - AuditSubscriber.prototype.notifyComplete = function () { - this.clearThrottle(); - }; - return AuditSubscriber; -}(OuterSubscriber_1.OuterSubscriber)); -//# sourceMappingURL=audit.js.map -/***/ }), -/* 282 */ -/***/ (function(module, exports, __webpack_require__) { + }, -"use strict"; + //CSS3 Selectors + _element_name: function(){ + /* + * element_name + * : IDENT + * ; + */ -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; -var async_1 = __webpack_require__(8); -var Subscriber_1 = __webpack_require__(2); -/** - * Ignores source values for `duration` milliseconds, then emits the most recent - * value from the source Observable, then repeats this process. - * - * When it sees a source values, it ignores that plus - * the next ones for `duration` milliseconds, and then it emits the most recent - * value from the source. - * - * - * - * `auditTime` is similar to `throttleTime`, but emits the last value from the - * silenced time window, instead of the first value. `auditTime` emits the most - * recent value from the source Observable on the output Observable as soon as - * its internal timer becomes disabled, and ignores source values while the - * timer is enabled. Initially, the timer is disabled. As soon as the first - * source value arrives, the timer is enabled. After `duration` milliseconds (or - * the time unit determined internally by the optional `scheduler`) has passed, - * the timer is disabled, then the most recent source value is emitted on the - * output Observable, and this process repeats for the next source value. - * Optionally takes a {@link IScheduler} for managing timers. - * - * @example Emit clicks at a rate of at most one click per second - * var clicks = Rx.Observable.fromEvent(document, 'click'); - * var result = clicks.auditTime(1000); - * result.subscribe(x => console.log(x)); - * - * @see {@link audit} - * @see {@link debounceTime} - * @see {@link delay} - * @see {@link sampleTime} - * @see {@link throttleTime} - * - * @param {number} duration Time to wait before emitting the most recent source - * value, measured in milliseconds or the time unit determined internally - * by the optional `scheduler`. - * @param {Scheduler} [scheduler=async] The {@link IScheduler} to use for - * managing the timers that handle the rate-limiting behavior. - * @return {Observable} An Observable that performs rate-limiting of - * emissions from the source Observable. - * @method auditTime - * @owner Observable - */ -function auditTime(duration, scheduler) { - if (scheduler === void 0) { scheduler = async_1.async; } - return this.lift(new AuditTimeOperator(duration, scheduler)); -} -exports.auditTime = auditTime; -var AuditTimeOperator = (function () { - function AuditTimeOperator(duration, scheduler) { - this.duration = duration; - this.scheduler = scheduler; - } - AuditTimeOperator.prototype.call = function (subscriber, source) { - return source.subscribe(new AuditTimeSubscriber(subscriber, this.duration, this.scheduler)); - }; - return AuditTimeOperator; -}()); -/** - * We need this JSDoc comment for affecting ESDoc. - * @ignore - * @extends {Ignored} - */ -var AuditTimeSubscriber = (function (_super) { - __extends(AuditTimeSubscriber, _super); - function AuditTimeSubscriber(destination, duration, scheduler) { - _super.call(this, destination); - this.duration = duration; - this.scheduler = scheduler; - this.hasValue = false; - } - AuditTimeSubscriber.prototype._next = function (value) { - this.value = value; - this.hasValue = true; - if (!this.throttled) { - this.add(this.throttled = this.scheduler.schedule(dispatchNext, this.duration, this)); - } - }; - AuditTimeSubscriber.prototype.clearThrottle = function () { - var _a = this, value = _a.value, hasValue = _a.hasValue, throttled = _a.throttled; - if (throttled) { - this.remove(throttled); - this.throttled = null; - throttled.unsubscribe(); - } - if (hasValue) { - this.value = null; - this.hasValue = false; - this.destination.next(value); - } - }; - return AuditTimeSubscriber; -}(Subscriber_1.Subscriber)); -function dispatchNext(subscriber) { - subscriber.clearThrottle(); -} -//# sourceMappingURL=auditTime.js.map + var tokenStream = this._tokenStream, + token; -/***/ }), -/* 283 */ -/***/ (function(module, exports, __webpack_require__) { + if (tokenStream.match(Tokens.IDENT)){ + token = tokenStream.token(); + return new SelectorSubPart(token.value, "elementName", token.startLine, token.startCol); -"use strict"; + } else { + return null; + } + }, -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; -var OuterSubscriber_1 = __webpack_require__(4); -var subscribeToResult_1 = __webpack_require__(3); -/** - * Buffers the source Observable values until `closingNotifier` emits. - * - * Collects values from the past as an array, and emits - * that array only when another Observable emits. - * - * - * - * Buffers the incoming Observable values until the given `closingNotifier` - * Observable emits a value, at which point it emits the buffer on the output - * Observable and starts a new buffer internally, awaiting the next time - * `closingNotifier` emits. - * - * @example On every click, emit array of most recent interval events - * var clicks = Rx.Observable.fromEvent(document, 'click'); - * var interval = Rx.Observable.interval(1000); - * var buffered = interval.buffer(clicks); - * buffered.subscribe(x => console.log(x)); - * - * @see {@link bufferCount} - * @see {@link bufferTime} - * @see {@link bufferToggle} - * @see {@link bufferWhen} - * @see {@link window} - * - * @param {Observable} closingNotifier An Observable that signals the - * buffer to be emitted on the output Observable. - * @return {Observable} An Observable of buffers, which are arrays of - * values. - * @method buffer - * @owner Observable - */ -function buffer(closingNotifier) { - return this.lift(new BufferOperator(closingNotifier)); -} -exports.buffer = buffer; -var BufferOperator = (function () { - function BufferOperator(closingNotifier) { - this.closingNotifier = closingNotifier; - } - BufferOperator.prototype.call = function (subscriber, source) { - return source.subscribe(new BufferSubscriber(subscriber, this.closingNotifier)); - }; - return BufferOperator; -}()); -/** - * We need this JSDoc comment for affecting ESDoc. - * @ignore - * @extends {Ignored} - */ -var BufferSubscriber = (function (_super) { - __extends(BufferSubscriber, _super); - function BufferSubscriber(destination, closingNotifier) { - _super.call(this, destination); - this.buffer = []; - this.add(subscribeToResult_1.subscribeToResult(this, closingNotifier)); - } - BufferSubscriber.prototype._next = function (value) { - this.buffer.push(value); - }; - BufferSubscriber.prototype.notifyNext = function (outerValue, innerValue, outerIndex, innerIndex, innerSub) { - var buffer = this.buffer; - this.buffer = []; - this.destination.next(buffer); - }; - return BufferSubscriber; -}(OuterSubscriber_1.OuterSubscriber)); -//# sourceMappingURL=buffer.js.map + //CSS3 Selectors + _namespace_prefix: function(){ + /* + * namespace_prefix + * : [ IDENT | '*' ]? '|' + * ; + */ + var tokenStream = this._tokenStream, + value = ""; + + //verify that this is a namespace prefix + if (tokenStream.LA(1) === Tokens.PIPE || tokenStream.LA(2) === Tokens.PIPE){ + + if(tokenStream.match([Tokens.IDENT, Tokens.STAR])){ + value += tokenStream.token().value; + } -/***/ }), -/* 284 */ -/***/ (function(module, exports, __webpack_require__) { + tokenStream.mustMatch(Tokens.PIPE); + value += "|"; -"use strict"; + } -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; -var Subscriber_1 = __webpack_require__(2); -/** - * Buffers the source Observable values until the size hits the maximum - * `bufferSize` given. - * - * Collects values from the past as an array, and emits - * that array only when its size reaches `bufferSize`. - * - * - * - * Buffers a number of values from the source Observable by `bufferSize` then - * emits the buffer and clears it, and starts a new buffer each - * `startBufferEvery` values. If `startBufferEvery` is not provided or is - * `null`, then new buffers are started immediately at the start of the source - * and when each buffer closes and is emitted. - * - * @example Emit the last two click events as an array - * var clicks = Rx.Observable.fromEvent(document, 'click'); - * var buffered = clicks.bufferCount(2); - * buffered.subscribe(x => console.log(x)); - * - * @example On every click, emit the last two click events as an array - * var clicks = Rx.Observable.fromEvent(document, 'click'); - * var buffered = clicks.bufferCount(2, 1); - * buffered.subscribe(x => console.log(x)); - * - * @see {@link buffer} - * @see {@link bufferTime} - * @see {@link bufferToggle} - * @see {@link bufferWhen} - * @see {@link pairwise} - * @see {@link windowCount} - * - * @param {number} bufferSize The maximum size of the buffer emitted. - * @param {number} [startBufferEvery] Interval at which to start a new buffer. - * For example if `startBufferEvery` is `2`, then a new buffer will be started - * on every other value from the source. A new buffer is started at the - * beginning of the source by default. - * @return {Observable} An Observable of arrays of buffered values. - * @method bufferCount - * @owner Observable - */ -function bufferCount(bufferSize, startBufferEvery) { - if (startBufferEvery === void 0) { startBufferEvery = null; } - return this.lift(new BufferCountOperator(bufferSize, startBufferEvery)); -} -exports.bufferCount = bufferCount; -var BufferCountOperator = (function () { - function BufferCountOperator(bufferSize, startBufferEvery) { - this.bufferSize = bufferSize; - this.startBufferEvery = startBufferEvery; - if (!startBufferEvery || bufferSize === startBufferEvery) { - this.subscriberClass = BufferCountSubscriber; - } - else { - this.subscriberClass = BufferSkipCountSubscriber; - } - } - BufferCountOperator.prototype.call = function (subscriber, source) { - return source.subscribe(new this.subscriberClass(subscriber, this.bufferSize, this.startBufferEvery)); - }; - return BufferCountOperator; -}()); -/** - * We need this JSDoc comment for affecting ESDoc. - * @ignore - * @extends {Ignored} - */ -var BufferCountSubscriber = (function (_super) { - __extends(BufferCountSubscriber, _super); - function BufferCountSubscriber(destination, bufferSize) { - _super.call(this, destination); - this.bufferSize = bufferSize; - this.buffer = []; - } - BufferCountSubscriber.prototype._next = function (value) { - var buffer = this.buffer; - buffer.push(value); - if (buffer.length == this.bufferSize) { - this.destination.next(buffer); - this.buffer = []; - } - }; - BufferCountSubscriber.prototype._complete = function () { - var buffer = this.buffer; - if (buffer.length > 0) { - this.destination.next(buffer); - } - _super.prototype._complete.call(this); - }; - return BufferCountSubscriber; -}(Subscriber_1.Subscriber)); -/** - * We need this JSDoc comment for affecting ESDoc. - * @ignore - * @extends {Ignored} - */ -var BufferSkipCountSubscriber = (function (_super) { - __extends(BufferSkipCountSubscriber, _super); - function BufferSkipCountSubscriber(destination, bufferSize, startBufferEvery) { - _super.call(this, destination); - this.bufferSize = bufferSize; - this.startBufferEvery = startBufferEvery; - this.buffers = []; - this.count = 0; - } - BufferSkipCountSubscriber.prototype._next = function (value) { - var _a = this, bufferSize = _a.bufferSize, startBufferEvery = _a.startBufferEvery, buffers = _a.buffers, count = _a.count; - this.count++; - if (count % startBufferEvery === 0) { - buffers.push([]); - } - for (var i = buffers.length; i--;) { - var buffer = buffers[i]; - buffer.push(value); - if (buffer.length === bufferSize) { - buffers.splice(i, 1); - this.destination.next(buffer); - } - } - }; - BufferSkipCountSubscriber.prototype._complete = function () { - var _a = this, buffers = _a.buffers, destination = _a.destination; - while (buffers.length > 0) { - var buffer = buffers.shift(); - if (buffer.length > 0) { - destination.next(buffer); - } - } - _super.prototype._complete.call(this); - }; - return BufferSkipCountSubscriber; -}(Subscriber_1.Subscriber)); -//# sourceMappingURL=bufferCount.js.map + return value.length ? value : null; + }, + + //CSS3 Selectors + _universal: function(){ + /* + * universal + * : [ namespace_prefix ]? '*' + * ; + */ + var tokenStream = this._tokenStream, + value = "", + ns; + + ns = this._namespace_prefix(); + if(ns){ + value += ns; + } + + if(tokenStream.match(Tokens.STAR)){ + value += "*"; + } -/***/ }), -/* 285 */ -/***/ (function(module, exports, __webpack_require__) { + return value.length ? value : null; + + }, + + //CSS3 Selectors + _attrib: function(){ + /* + * attrib + * : '[' S* [ namespace_prefix ]? IDENT S* + * [ [ PREFIXMATCH | + * SUFFIXMATCH | + * SUBSTRINGMATCH | + * '=' | + * INCLUDES | + * DASHMATCH ] S* [ IDENT | STRING ] S* + * ]? ']' + * ; + */ + + var tokenStream = this._tokenStream, + value = null, + ns, + token; + + if (tokenStream.match(Tokens.LBRACKET)){ + token = tokenStream.token(); + value = token.value; + value += this._readWhitespace(); + + ns = this._namespace_prefix(); + + if (ns){ + value += ns; + } -"use strict"; + tokenStream.mustMatch(Tokens.IDENT); + value += tokenStream.token().value; + value += this._readWhitespace(); -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; -var async_1 = __webpack_require__(8); -var Subscriber_1 = __webpack_require__(2); -var isScheduler_1 = __webpack_require__(13); -/* tslint:enable:max-line-length */ -/** - * Buffers the source Observable values for a specific time period. - * - * Collects values from the past as an array, and emits - * those arrays periodically in time. - * - * - * - * Buffers values from the source for a specific time duration `bufferTimeSpan`. - * Unless the optional argument `bufferCreationInterval` is given, it emits and - * resets the buffer every `bufferTimeSpan` milliseconds. If - * `bufferCreationInterval` is given, this operator opens the buffer every - * `bufferCreationInterval` milliseconds and closes (emits and resets) the - * buffer every `bufferTimeSpan` milliseconds. When the optional argument - * `maxBufferSize` is specified, the buffer will be closed either after - * `bufferTimeSpan` milliseconds or when it contains `maxBufferSize` elements. - * - * @example Every second, emit an array of the recent click events - * var clicks = Rx.Observable.fromEvent(document, 'click'); - * var buffered = clicks.bufferTime(1000); - * buffered.subscribe(x => console.log(x)); - * - * @example Every 5 seconds, emit the click events from the next 2 seconds - * var clicks = Rx.Observable.fromEvent(document, 'click'); - * var buffered = clicks.bufferTime(2000, 5000); - * buffered.subscribe(x => console.log(x)); - * - * @see {@link buffer} - * @see {@link bufferCount} - * @see {@link bufferToggle} - * @see {@link bufferWhen} - * @see {@link windowTime} - * - * @param {number} bufferTimeSpan The amount of time to fill each buffer array. - * @param {number} [bufferCreationInterval] The interval at which to start new - * buffers. - * @param {number} [maxBufferSize] The maximum buffer size. - * @param {Scheduler} [scheduler=async] The scheduler on which to schedule the - * intervals that determine buffer boundaries. - * @return {Observable} An observable of arrays of buffered values. - * @method bufferTime - * @owner Observable - */ -function bufferTime(bufferTimeSpan) { - var length = arguments.length; - var scheduler = async_1.async; - if (isScheduler_1.isScheduler(arguments[arguments.length - 1])) { - scheduler = arguments[arguments.length - 1]; - length--; - } - var bufferCreationInterval = null; - if (length >= 2) { - bufferCreationInterval = arguments[1]; - } - var maxBufferSize = Number.POSITIVE_INFINITY; - if (length >= 3) { - maxBufferSize = arguments[2]; - } - return this.lift(new BufferTimeOperator(bufferTimeSpan, bufferCreationInterval, maxBufferSize, scheduler)); -} -exports.bufferTime = bufferTime; -var BufferTimeOperator = (function () { - function BufferTimeOperator(bufferTimeSpan, bufferCreationInterval, maxBufferSize, scheduler) { - this.bufferTimeSpan = bufferTimeSpan; - this.bufferCreationInterval = bufferCreationInterval; - this.maxBufferSize = maxBufferSize; - this.scheduler = scheduler; - } - BufferTimeOperator.prototype.call = function (subscriber, source) { - return source.subscribe(new BufferTimeSubscriber(subscriber, this.bufferTimeSpan, this.bufferCreationInterval, this.maxBufferSize, this.scheduler)); - }; - return BufferTimeOperator; -}()); -var Context = (function () { - function Context() { - this.buffer = []; - } - return Context; -}()); -/** - * We need this JSDoc comment for affecting ESDoc. - * @ignore - * @extends {Ignored} - */ -var BufferTimeSubscriber = (function (_super) { - __extends(BufferTimeSubscriber, _super); - function BufferTimeSubscriber(destination, bufferTimeSpan, bufferCreationInterval, maxBufferSize, scheduler) { - _super.call(this, destination); - this.bufferTimeSpan = bufferTimeSpan; - this.bufferCreationInterval = bufferCreationInterval; - this.maxBufferSize = maxBufferSize; - this.scheduler = scheduler; - this.contexts = []; - var context = this.openContext(); - this.timespanOnly = bufferCreationInterval == null || bufferCreationInterval < 0; - if (this.timespanOnly) { - var timeSpanOnlyState = { subscriber: this, context: context, bufferTimeSpan: bufferTimeSpan }; - this.add(context.closeAction = scheduler.schedule(dispatchBufferTimeSpanOnly, bufferTimeSpan, timeSpanOnlyState)); - } - else { - var closeState = { subscriber: this, context: context }; - var creationState = { bufferTimeSpan: bufferTimeSpan, bufferCreationInterval: bufferCreationInterval, subscriber: this, scheduler: scheduler }; - this.add(context.closeAction = scheduler.schedule(dispatchBufferClose, bufferTimeSpan, closeState)); - this.add(scheduler.schedule(dispatchBufferCreation, bufferCreationInterval, creationState)); - } - } - BufferTimeSubscriber.prototype._next = function (value) { - var contexts = this.contexts; - var len = contexts.length; - var filledBufferContext; - for (var i = 0; i < len; i++) { - var context = contexts[i]; - var buffer = context.buffer; - buffer.push(value); - if (buffer.length == this.maxBufferSize) { - filledBufferContext = context; - } - } - if (filledBufferContext) { - this.onBufferFull(filledBufferContext); - } - }; - BufferTimeSubscriber.prototype._error = function (err) { - this.contexts.length = 0; - _super.prototype._error.call(this, err); - }; - BufferTimeSubscriber.prototype._complete = function () { - var _a = this, contexts = _a.contexts, destination = _a.destination; - while (contexts.length > 0) { - var context = contexts.shift(); - destination.next(context.buffer); - } - _super.prototype._complete.call(this); - }; - BufferTimeSubscriber.prototype._unsubscribe = function () { - this.contexts = null; - }; - BufferTimeSubscriber.prototype.onBufferFull = function (context) { - this.closeContext(context); - var closeAction = context.closeAction; - closeAction.unsubscribe(); - this.remove(closeAction); - if (!this.closed && this.timespanOnly) { - context = this.openContext(); - var bufferTimeSpan = this.bufferTimeSpan; - var timeSpanOnlyState = { subscriber: this, context: context, bufferTimeSpan: bufferTimeSpan }; - this.add(context.closeAction = this.scheduler.schedule(dispatchBufferTimeSpanOnly, bufferTimeSpan, timeSpanOnlyState)); - } - }; - BufferTimeSubscriber.prototype.openContext = function () { - var context = new Context(); - this.contexts.push(context); - return context; - }; - BufferTimeSubscriber.prototype.closeContext = function (context) { - this.destination.next(context.buffer); - var contexts = this.contexts; - var spliceIndex = contexts ? contexts.indexOf(context) : -1; - if (spliceIndex >= 0) { - contexts.splice(contexts.indexOf(context), 1); - } - }; - return BufferTimeSubscriber; -}(Subscriber_1.Subscriber)); -function dispatchBufferTimeSpanOnly(state) { - var subscriber = state.subscriber; - var prevContext = state.context; - if (prevContext) { - subscriber.closeContext(prevContext); - } - if (!subscriber.closed) { - state.context = subscriber.openContext(); - state.context.closeAction = this.schedule(state, state.bufferTimeSpan); - } -} -function dispatchBufferCreation(state) { - var bufferCreationInterval = state.bufferCreationInterval, bufferTimeSpan = state.bufferTimeSpan, subscriber = state.subscriber, scheduler = state.scheduler; - var context = subscriber.openContext(); - var action = this; - if (!subscriber.closed) { - subscriber.add(context.closeAction = scheduler.schedule(dispatchBufferClose, bufferTimeSpan, { subscriber: subscriber, context: context })); - action.schedule(state, bufferCreationInterval); - } -} -function dispatchBufferClose(arg) { - var subscriber = arg.subscriber, context = arg.context; - subscriber.closeContext(context); -} -//# sourceMappingURL=bufferTime.js.map + if(tokenStream.match([Tokens.PREFIXMATCH, Tokens.SUFFIXMATCH, Tokens.SUBSTRINGMATCH, + Tokens.EQUALS, Tokens.INCLUDES, Tokens.DASHMATCH])){ -/***/ }), -/* 286 */ -/***/ (function(module, exports, __webpack_require__) { + value += tokenStream.token().value; + value += this._readWhitespace(); -"use strict"; + tokenStream.mustMatch([Tokens.IDENT, Tokens.STRING]); + value += tokenStream.token().value; + value += this._readWhitespace(); + } -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; -var Subscription_1 = __webpack_require__(9); -var subscribeToResult_1 = __webpack_require__(3); -var OuterSubscriber_1 = __webpack_require__(4); -/** - * Buffers the source Observable values starting from an emission from - * `openings` and ending when the output of `closingSelector` emits. - * - * Collects values from the past as an array. Starts - * collecting only when `opening` emits, and calls the `closingSelector` - * function to get an Observable that tells when to close the buffer. - * - * - * - * Buffers values from the source by opening the buffer via signals from an - * Observable provided to `openings`, and closing and sending the buffers when - * a Subscribable or Promise returned by the `closingSelector` function emits. - * - * @example Every other second, emit the click events from the next 500ms - * var clicks = Rx.Observable.fromEvent(document, 'click'); - * var openings = Rx.Observable.interval(1000); - * var buffered = clicks.bufferToggle(openings, i => - * i % 2 ? Rx.Observable.interval(500) : Rx.Observable.empty() - * ); - * buffered.subscribe(x => console.log(x)); - * - * @see {@link buffer} - * @see {@link bufferCount} - * @see {@link bufferTime} - * @see {@link bufferWhen} - * @see {@link windowToggle} - * - * @param {SubscribableOrPromise} openings A Subscribable or Promise of notifications to start new - * buffers. - * @param {function(value: O): SubscribableOrPromise} closingSelector A function that takes - * the value emitted by the `openings` observable and returns a Subscribable or Promise, - * which, when it emits, signals that the associated buffer should be emitted - * and cleared. - * @return {Observable} An observable of arrays of buffered values. - * @method bufferToggle - * @owner Observable - */ -function bufferToggle(openings, closingSelector) { - return this.lift(new BufferToggleOperator(openings, closingSelector)); -} -exports.bufferToggle = bufferToggle; -var BufferToggleOperator = (function () { - function BufferToggleOperator(openings, closingSelector) { - this.openings = openings; - this.closingSelector = closingSelector; - } - BufferToggleOperator.prototype.call = function (subscriber, source) { - return source.subscribe(new BufferToggleSubscriber(subscriber, this.openings, this.closingSelector)); - }; - return BufferToggleOperator; -}()); -/** - * We need this JSDoc comment for affecting ESDoc. - * @ignore - * @extends {Ignored} - */ -var BufferToggleSubscriber = (function (_super) { - __extends(BufferToggleSubscriber, _super); - function BufferToggleSubscriber(destination, openings, closingSelector) { - _super.call(this, destination); - this.openings = openings; - this.closingSelector = closingSelector; - this.contexts = []; - this.add(subscribeToResult_1.subscribeToResult(this, openings)); - } - BufferToggleSubscriber.prototype._next = function (value) { - var contexts = this.contexts; - var len = contexts.length; - for (var i = 0; i < len; i++) { - contexts[i].buffer.push(value); - } - }; - BufferToggleSubscriber.prototype._error = function (err) { - var contexts = this.contexts; - while (contexts.length > 0) { - var context = contexts.shift(); - context.subscription.unsubscribe(); - context.buffer = null; - context.subscription = null; - } - this.contexts = null; - _super.prototype._error.call(this, err); - }; - BufferToggleSubscriber.prototype._complete = function () { - var contexts = this.contexts; - while (contexts.length > 0) { - var context = contexts.shift(); - this.destination.next(context.buffer); - context.subscription.unsubscribe(); - context.buffer = null; - context.subscription = null; - } - this.contexts = null; - _super.prototype._complete.call(this); - }; - BufferToggleSubscriber.prototype.notifyNext = function (outerValue, innerValue, outerIndex, innerIndex, innerSub) { - outerValue ? this.closeBuffer(outerValue) : this.openBuffer(innerValue); - }; - BufferToggleSubscriber.prototype.notifyComplete = function (innerSub) { - this.closeBuffer(innerSub.context); - }; - BufferToggleSubscriber.prototype.openBuffer = function (value) { - try { - var closingSelector = this.closingSelector; - var closingNotifier = closingSelector.call(this, value); - if (closingNotifier) { - this.trySubscribe(closingNotifier); - } - } - catch (err) { - this._error(err); - } - }; - BufferToggleSubscriber.prototype.closeBuffer = function (context) { - var contexts = this.contexts; - if (contexts && context) { - var buffer = context.buffer, subscription = context.subscription; - this.destination.next(buffer); - contexts.splice(contexts.indexOf(context), 1); - this.remove(subscription); - subscription.unsubscribe(); - } - }; - BufferToggleSubscriber.prototype.trySubscribe = function (closingNotifier) { - var contexts = this.contexts; - var buffer = []; - var subscription = new Subscription_1.Subscription(); - var context = { buffer: buffer, subscription: subscription }; - contexts.push(context); - var innerSubscription = subscribeToResult_1.subscribeToResult(this, closingNotifier, context); - if (!innerSubscription || innerSubscription.closed) { - this.closeBuffer(context); - } - else { - innerSubscription.context = context; - this.add(innerSubscription); - subscription.add(innerSubscription); - } - }; - return BufferToggleSubscriber; -}(OuterSubscriber_1.OuterSubscriber)); -//# sourceMappingURL=bufferToggle.js.map + tokenStream.mustMatch(Tokens.RBRACKET); -/***/ }), -/* 287 */ -/***/ (function(module, exports, __webpack_require__) { + return new SelectorSubPart(value + "]", "attribute", token.startLine, token.startCol); + } else { + return null; + } + }, -"use strict"; + //CSS3 Selectors + _pseudo: function(){ -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; -var Subscription_1 = __webpack_require__(9); -var tryCatch_1 = __webpack_require__(7); -var errorObject_1 = __webpack_require__(5); -var OuterSubscriber_1 = __webpack_require__(4); -var subscribeToResult_1 = __webpack_require__(3); -/** - * Buffers the source Observable values, using a factory function of closing - * Observables to determine when to close, emit, and reset the buffer. - * - * Collects values from the past as an array. When it - * starts collecting values, it calls a function that returns an Observable that - * tells when to close the buffer and restart collecting. - * - * - * - * Opens a buffer immediately, then closes the buffer when the observable - * returned by calling `closingSelector` function emits a value. When it closes - * the buffer, it immediately opens a new buffer and repeats the process. - * - * @example Emit an array of the last clicks every [1-5] random seconds - * var clicks = Rx.Observable.fromEvent(document, 'click'); - * var buffered = clicks.bufferWhen(() => - * Rx.Observable.interval(1000 + Math.random() * 4000) - * ); - * buffered.subscribe(x => console.log(x)); - * - * @see {@link buffer} - * @see {@link bufferCount} - * @see {@link bufferTime} - * @see {@link bufferToggle} - * @see {@link windowWhen} - * - * @param {function(): Observable} closingSelector A function that takes no - * arguments and returns an Observable that signals buffer closure. - * @return {Observable} An observable of arrays of buffered values. - * @method bufferWhen - * @owner Observable - */ -function bufferWhen(closingSelector) { - return this.lift(new BufferWhenOperator(closingSelector)); -} -exports.bufferWhen = bufferWhen; -var BufferWhenOperator = (function () { - function BufferWhenOperator(closingSelector) { - this.closingSelector = closingSelector; - } - BufferWhenOperator.prototype.call = function (subscriber, source) { - return source.subscribe(new BufferWhenSubscriber(subscriber, this.closingSelector)); - }; - return BufferWhenOperator; -}()); -/** - * We need this JSDoc comment for affecting ESDoc. - * @ignore - * @extends {Ignored} - */ -var BufferWhenSubscriber = (function (_super) { - __extends(BufferWhenSubscriber, _super); - function BufferWhenSubscriber(destination, closingSelector) { - _super.call(this, destination); - this.closingSelector = closingSelector; - this.subscribing = false; - this.openBuffer(); - } - BufferWhenSubscriber.prototype._next = function (value) { - this.buffer.push(value); - }; - BufferWhenSubscriber.prototype._complete = function () { - var buffer = this.buffer; - if (buffer) { - this.destination.next(buffer); - } - _super.prototype._complete.call(this); - }; - BufferWhenSubscriber.prototype._unsubscribe = function () { - this.buffer = null; - this.subscribing = false; - }; - BufferWhenSubscriber.prototype.notifyNext = function (outerValue, innerValue, outerIndex, innerIndex, innerSub) { - this.openBuffer(); - }; - BufferWhenSubscriber.prototype.notifyComplete = function () { - if (this.subscribing) { - this.complete(); - } - else { - this.openBuffer(); - } - }; - BufferWhenSubscriber.prototype.openBuffer = function () { - var closingSubscription = this.closingSubscription; - if (closingSubscription) { - this.remove(closingSubscription); - closingSubscription.unsubscribe(); - } - var buffer = this.buffer; - if (this.buffer) { - this.destination.next(buffer); - } - this.buffer = []; - var closingNotifier = tryCatch_1.tryCatch(this.closingSelector)(); - if (closingNotifier === errorObject_1.errorObject) { - this.error(errorObject_1.errorObject.e); - } - else { - closingSubscription = new Subscription_1.Subscription(); - this.closingSubscription = closingSubscription; - this.add(closingSubscription); - this.subscribing = true; - closingSubscription.add(subscribeToResult_1.subscribeToResult(this, closingNotifier)); - this.subscribing = false; - } - }; - return BufferWhenSubscriber; -}(OuterSubscriber_1.OuterSubscriber)); -//# sourceMappingURL=bufferWhen.js.map + /* + * pseudo + * : ':' ':'? [ IDENT | functional_pseudo ] + * ; + */ -/***/ }), -/* 288 */ -/***/ (function(module, exports, __webpack_require__) { + var tokenStream = this._tokenStream, + pseudo = null, + colons = ":", + line, + col; -"use strict"; + if (tokenStream.match(Tokens.COLON)){ -var combineLatest_1 = __webpack_require__(37); -/** - * Converts a higher-order Observable into a first-order Observable by waiting - * for the outer Observable to complete, then applying {@link combineLatest}. - * - * Flattens an Observable-of-Observables by applying - * {@link combineLatest} when the Observable-of-Observables completes. - * - * - * - * Takes an Observable of Observables, and collects all Observables from it. - * Once the outer Observable completes, it subscribes to all collected - * Observables and combines their values using the {@link combineLatest} - * strategy, such that: - * - Every time an inner Observable emits, the output Observable emits. - * - When the returned observable emits, it emits all of the latest values by: - * - If a `project` function is provided, it is called with each recent value - * from each inner Observable in whatever order they arrived, and the result - * of the `project` function is what is emitted by the output Observable. - * - If there is no `project` function, an array of all of the most recent - * values is emitted by the output Observable. - * - * @example Map two click events to a finite interval Observable, then apply combineAll - * var clicks = Rx.Observable.fromEvent(document, 'click'); - * var higherOrder = clicks.map(ev => - * Rx.Observable.interval(Math.random()*2000).take(3) - * ).take(2); - * var result = higherOrder.combineAll(); - * result.subscribe(x => console.log(x)); - * - * @see {@link combineLatest} - * @see {@link mergeAll} - * - * @param {function} [project] An optional function to map the most recent - * values from each inner Observable into a new result. Takes each of the most - * recent values from each collected inner Observable as arguments, in order. - * @return {Observable} An Observable of projected results or arrays of recent - * values. - * @method combineAll - * @owner Observable - */ -function combineAll(project) { - return this.lift(new combineLatest_1.CombineLatestOperator(project)); -} -exports.combineAll = combineAll; -//# sourceMappingURL=combineAll.js.map + if (tokenStream.match(Tokens.COLON)){ + colons += ":"; + } -/***/ }), -/* 289 */ -/***/ (function(module, exports, __webpack_require__) { + if (tokenStream.match(Tokens.IDENT)){ + pseudo = tokenStream.token().value; + line = tokenStream.token().startLine; + col = tokenStream.token().startCol - colons.length; + } else if (tokenStream.peek() === Tokens.FUNCTION){ + line = tokenStream.LT(1).startLine; + col = tokenStream.LT(1).startCol - colons.length; + pseudo = this._functional_pseudo(); + } -"use strict"; + if (pseudo){ + pseudo = new SelectorSubPart(colons + pseudo, "pseudo", line, col); + } + } -var mergeMapTo_1 = __webpack_require__(62); -/* tslint:enable:max-line-length */ -/** - * Projects each source value to the same Observable which is merged multiple - * times in a serialized fashion on the output Observable. - * - * It's like {@link concatMap}, but maps each value - * always to the same inner Observable. - * - * - * - * Maps each source value to the given Observable `innerObservable` regardless - * of the source value, and then flattens those resulting Observables into one - * single Observable, which is the output Observable. Each new `innerObservable` - * instance emitted on the output Observable is concatenated with the previous - * `innerObservable` instance. - * - * __Warning:__ if source values arrive endlessly and faster than their - * corresponding inner Observables can complete, it will result in memory issues - * as inner Observables amass in an unbounded buffer waiting for their turn to - * be subscribed to. - * - * Note: `concatMapTo` is equivalent to `mergeMapTo` with concurrency parameter - * set to `1`. - * - * @example For each click event, tick every second from 0 to 3, with no concurrency - * var clicks = Rx.Observable.fromEvent(document, 'click'); - * var result = clicks.concatMapTo(Rx.Observable.interval(1000).take(4)); - * result.subscribe(x => console.log(x)); - * - * // Results in the following: - * // (results are not concurrent) - * // For every click on the "document" it will emit values 0 to 3 spaced - * // on a 1000ms interval - * // one click = 1000ms-> 0 -1000ms-> 1 -1000ms-> 2 -1000ms-> 3 - * - * @see {@link concat} - * @see {@link concatAll} - * @see {@link concatMap} - * @see {@link mergeMapTo} - * @see {@link switchMapTo} - * - * @param {ObservableInput} innerObservable An Observable to replace each value from - * the source Observable. - * @param {function(outerValue: T, innerValue: I, outerIndex: number, innerIndex: number): any} [resultSelector] - * A function to produce the value on the output Observable based on the values - * and the indices of the source (outer) emission and the inner Observable - * emission. The arguments passed to this function are: - * - `outerValue`: the value that came from the source - * - `innerValue`: the value that came from the projected Observable - * - `outerIndex`: the "index" of the value that came from the source - * - `innerIndex`: the "index" of the value from the projected Observable - * @return {Observable} An observable of values merged together by joining the - * passed observable with itself, one after the other, for each value emitted - * from the source. - * @method concatMapTo - * @owner Observable - */ -function concatMapTo(innerObservable, resultSelector) { - return this.lift(new mergeMapTo_1.MergeMapToOperator(innerObservable, resultSelector, 1)); -} -exports.concatMapTo = concatMapTo; -//# sourceMappingURL=concatMapTo.js.map + return pseudo; + }, -/***/ }), -/* 290 */ -/***/ (function(module, exports, __webpack_require__) { + //CSS3 Selectors + _functional_pseudo: function(){ + /* + * functional_pseudo + * : FUNCTION S* expression ')' + * ; + */ + + var tokenStream = this._tokenStream, + value = null; + + if(tokenStream.match(Tokens.FUNCTION)){ + value = tokenStream.token().value; + value += this._readWhitespace(); + value += this._expression(); + tokenStream.mustMatch(Tokens.RPAREN); + value += ")"; + } -"use strict"; + return value; + }, -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; -var Subscriber_1 = __webpack_require__(2); -/** - * Counts the number of emissions on the source and emits that number when the - * source completes. - * - * Tells how many values were emitted, when the source - * completes. - * - * - * - * `count` transforms an Observable that emits values into an Observable that - * emits a single value that represents the number of values emitted by the - * source Observable. If the source Observable terminates with an error, `count` - * will pass this error notification along without emitting a value first. If - * the source Observable does not terminate at all, `count` will neither emit - * a value nor terminate. This operator takes an optional `predicate` function - * as argument, in which case the output emission will represent the number of - * source values that matched `true` with the `predicate`. - * - * @example Counts how many seconds have passed before the first click happened - * var seconds = Rx.Observable.interval(1000); - * var clicks = Rx.Observable.fromEvent(document, 'click'); - * var secondsBeforeClick = seconds.takeUntil(clicks); - * var result = secondsBeforeClick.count(); - * result.subscribe(x => console.log(x)); - * - * @example Counts how many odd numbers are there between 1 and 7 - * var numbers = Rx.Observable.range(1, 7); - * var result = numbers.count(i => i % 2 === 1); - * result.subscribe(x => console.log(x)); - * - * // Results in: - * // 4 - * - * @see {@link max} - * @see {@link min} - * @see {@link reduce} - * - * @param {function(value: T, i: number, source: Observable): boolean} [predicate] A - * boolean function to select what values are to be counted. It is provided with - * arguments of: - * - `value`: the value from the source Observable. - * - `index`: the (zero-based) "index" of the value from the source Observable. - * - `source`: the source Observable instance itself. - * @return {Observable} An Observable of one number that represents the count as - * described above. - * @method count - * @owner Observable - */ -function count(predicate) { - return this.lift(new CountOperator(predicate, this)); -} -exports.count = count; -var CountOperator = (function () { - function CountOperator(predicate, source) { - this.predicate = predicate; - this.source = source; - } - CountOperator.prototype.call = function (subscriber, source) { - return source.subscribe(new CountSubscriber(subscriber, this.predicate, this.source)); - }; - return CountOperator; -}()); -/** - * We need this JSDoc comment for affecting ESDoc. - * @ignore - * @extends {Ignored} - */ -var CountSubscriber = (function (_super) { - __extends(CountSubscriber, _super); - function CountSubscriber(destination, predicate, source) { - _super.call(this, destination); - this.predicate = predicate; - this.source = source; - this.count = 0; - this.index = 0; - } - CountSubscriber.prototype._next = function (value) { - if (this.predicate) { - this._tryPredicate(value); - } - else { - this.count++; - } - }; - CountSubscriber.prototype._tryPredicate = function (value) { - var result; - try { - result = this.predicate(value, this.index++, this.source); - } - catch (err) { - this.destination.error(err); - return; - } - if (result) { - this.count++; - } - }; - CountSubscriber.prototype._complete = function () { - this.destination.next(this.count); - this.destination.complete(); - }; - return CountSubscriber; -}(Subscriber_1.Subscriber)); -//# sourceMappingURL=count.js.map + //CSS3 Selectors + _expression: function(){ + /* + * expression + * : [ [ PLUS | '-' | DIMENSION | NUMBER | STRING | IDENT ] S* ]+ + * ; + */ + + var tokenStream = this._tokenStream, + value = ""; + + while(tokenStream.match([Tokens.PLUS, Tokens.MINUS, Tokens.DIMENSION, + Tokens.NUMBER, Tokens.STRING, Tokens.IDENT, Tokens.LENGTH, + Tokens.FREQ, Tokens.ANGLE, Tokens.TIME, + Tokens.RESOLUTION, Tokens.SLASH])){ + + value += tokenStream.token().value; + value += this._readWhitespace(); + } + + return value.length ? value : null; + + }, + + //CSS3 Selectors + _negation: function(){ + /* + * negation + * : NOT S* negation_arg S* ')' + * ; + */ + + var tokenStream = this._tokenStream, + line, + col, + value = "", + arg, + subpart = null; + + if (tokenStream.match(Tokens.NOT)){ + value = tokenStream.token().value; + line = tokenStream.token().startLine; + col = tokenStream.token().startCol; + value += this._readWhitespace(); + arg = this._negation_arg(); + value += arg; + value += this._readWhitespace(); + tokenStream.match(Tokens.RPAREN); + value += tokenStream.token().value; + + subpart = new SelectorSubPart(value, "not", line, col); + subpart.args.push(arg); + } + + return subpart; + }, + + //CSS3 Selectors + _negation_arg: function(){ + /* + * negation_arg + * : type_selector | universal | HASH | class | attrib | pseudo + * ; + */ + + var tokenStream = this._tokenStream, + args = [ + this._type_selector, + this._universal, + function(){ + return tokenStream.match(Tokens.HASH) ? + new SelectorSubPart(tokenStream.token().value, "id", tokenStream.token().startLine, tokenStream.token().startCol) : + null; + }, + this._class, + this._attrib, + this._pseudo + ], + arg = null, + i = 0, + len = args.length, + line, + col, + part; + + line = tokenStream.LT(1).startLine; + col = tokenStream.LT(1).startCol; + + while(i < len && arg === null){ + + arg = args[i].call(this); + i++; + } + + //must be a negation arg + if (arg === null){ + this._unexpectedToken(tokenStream.LT(1)); + } + + //it's an element name + if (arg.type === "elementName"){ + part = new SelectorPart(arg, [], arg.toString(), line, col); + } else { + part = new SelectorPart(null, [arg], arg.toString(), line, col); + } + + return part; + }, + + _declaration: function(){ + + /* + * declaration + * : property ':' S* expr prio? + * | /( empty )/ + * ; + */ + + var tokenStream = this._tokenStream, + property = null, + expr = null, + prio = null, + invalid = null, + propertyName= ""; + + property = this._property(); + if (property !== null){ -/***/ }), -/* 291 */ -/***/ (function(module, exports, __webpack_require__) { + tokenStream.mustMatch(Tokens.COLON); + this._readWhitespace(); -"use strict"; + expr = this._expr(); -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; -var OuterSubscriber_1 = __webpack_require__(4); -var subscribeToResult_1 = __webpack_require__(3); -/** - * Emits a value from the source Observable only after a particular time span - * determined by another Observable has passed without another source emission. - * - * It's like {@link debounceTime}, but the time span of - * emission silence is determined by a second Observable. - * - * - * - * `debounce` delays values emitted by the source Observable, but drops previous - * pending delayed emissions if a new value arrives on the source Observable. - * This operator keeps track of the most recent value from the source - * Observable, and spawns a duration Observable by calling the - * `durationSelector` function. The value is emitted only when the duration - * Observable emits a value or completes, and if no other value was emitted on - * the source Observable since the duration Observable was spawned. If a new - * value appears before the duration Observable emits, the previous value will - * be dropped and will not be emitted on the output Observable. - * - * Like {@link debounceTime}, this is a rate-limiting operator, and also a - * delay-like operator since output emissions do not necessarily occur at the - * same time as they did on the source Observable. - * - * @example Emit the most recent click after a burst of clicks - * var clicks = Rx.Observable.fromEvent(document, 'click'); - * var result = clicks.debounce(() => Rx.Observable.interval(1000)); - * result.subscribe(x => console.log(x)); - * - * @see {@link audit} - * @see {@link debounceTime} - * @see {@link delayWhen} - * @see {@link throttle} - * - * @param {function(value: T): SubscribableOrPromise} durationSelector A function - * that receives a value from the source Observable, for computing the timeout - * duration for each source value, returned as an Observable or a Promise. - * @return {Observable} An Observable that delays the emissions of the source - * Observable by the specified duration Observable returned by - * `durationSelector`, and may drop some values if they occur too frequently. - * @method debounce - * @owner Observable - */ -function debounce(durationSelector) { - return this.lift(new DebounceOperator(durationSelector)); -} -exports.debounce = debounce; -var DebounceOperator = (function () { - function DebounceOperator(durationSelector) { - this.durationSelector = durationSelector; - } - DebounceOperator.prototype.call = function (subscriber, source) { - return source.subscribe(new DebounceSubscriber(subscriber, this.durationSelector)); - }; - return DebounceOperator; -}()); -/** - * We need this JSDoc comment for affecting ESDoc. - * @ignore - * @extends {Ignored} - */ -var DebounceSubscriber = (function (_super) { - __extends(DebounceSubscriber, _super); - function DebounceSubscriber(destination, durationSelector) { - _super.call(this, destination); - this.durationSelector = durationSelector; - this.hasValue = false; - this.durationSubscription = null; - } - DebounceSubscriber.prototype._next = function (value) { - try { - var result = this.durationSelector.call(this, value); - if (result) { - this._tryNext(value, result); - } - } - catch (err) { - this.destination.error(err); - } - }; - DebounceSubscriber.prototype._complete = function () { - this.emitValue(); - this.destination.complete(); - }; - DebounceSubscriber.prototype._tryNext = function (value, duration) { - var subscription = this.durationSubscription; - this.value = value; - this.hasValue = true; - if (subscription) { - subscription.unsubscribe(); - this.remove(subscription); - } - subscription = subscribeToResult_1.subscribeToResult(this, duration); - if (!subscription.closed) { - this.add(this.durationSubscription = subscription); - } - }; - DebounceSubscriber.prototype.notifyNext = function (outerValue, innerValue, outerIndex, innerIndex, innerSub) { - this.emitValue(); - }; - DebounceSubscriber.prototype.notifyComplete = function () { - this.emitValue(); - }; - DebounceSubscriber.prototype.emitValue = function () { - if (this.hasValue) { - var value = this.value; - var subscription = this.durationSubscription; - if (subscription) { - this.durationSubscription = null; - subscription.unsubscribe(); - this.remove(subscription); - } - this.value = null; - this.hasValue = false; - _super.prototype._next.call(this, value); - } - }; - return DebounceSubscriber; -}(OuterSubscriber_1.OuterSubscriber)); -//# sourceMappingURL=debounce.js.map + //if there's no parts for the value, it's an error + if (!expr || expr.length === 0){ + this._unexpectedToken(tokenStream.LT(1)); + } -/***/ }), -/* 292 */ -/***/ (function(module, exports, __webpack_require__) { + prio = this._prio(); -"use strict"; + /* + * If hacks should be allowed, then only check the root + * property. If hacks should not be allowed, treat + * _property or *property as invalid properties. + */ + propertyName = property.toString(); + if (this.options.starHack && property.hack === "*" || + this.options.underscoreHack && property.hack === "_") { -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; -var Subscriber_1 = __webpack_require__(2); -var async_1 = __webpack_require__(8); -/** - * Emits a value from the source Observable only after a particular time span - * has passed without another source emission. - * - * It's like {@link delay}, but passes only the most - * recent value from each burst of emissions. - * - * - * - * `debounceTime` delays values emitted by the source Observable, but drops - * previous pending delayed emissions if a new value arrives on the source - * Observable. This operator keeps track of the most recent value from the - * source Observable, and emits that only when `dueTime` enough time has passed - * without any other value appearing on the source Observable. If a new value - * appears before `dueTime` silence occurs, the previous value will be dropped - * and will not be emitted on the output Observable. - * - * This is a rate-limiting operator, because it is impossible for more than one - * value to be emitted in any time window of duration `dueTime`, but it is also - * a delay-like operator since output emissions do not occur at the same time as - * they did on the source Observable. Optionally takes a {@link IScheduler} for - * managing timers. - * - * @example Emit the most recent click after a burst of clicks - * var clicks = Rx.Observable.fromEvent(document, 'click'); - * var result = clicks.debounceTime(1000); - * result.subscribe(x => console.log(x)); - * - * @see {@link auditTime} - * @see {@link debounce} - * @see {@link delay} - * @see {@link sampleTime} - * @see {@link throttleTime} - * - * @param {number} dueTime The timeout duration in milliseconds (or the time - * unit determined internally by the optional `scheduler`) for the window of - * time required to wait for emission silence before emitting the most recent - * source value. - * @param {Scheduler} [scheduler=async] The {@link IScheduler} to use for - * managing the timers that handle the timeout for each value. - * @return {Observable} An Observable that delays the emissions of the source - * Observable by the specified `dueTime`, and may drop some values if they occur - * too frequently. - * @method debounceTime - * @owner Observable - */ -function debounceTime(dueTime, scheduler) { - if (scheduler === void 0) { scheduler = async_1.async; } - return this.lift(new DebounceTimeOperator(dueTime, scheduler)); -} -exports.debounceTime = debounceTime; -var DebounceTimeOperator = (function () { - function DebounceTimeOperator(dueTime, scheduler) { - this.dueTime = dueTime; - this.scheduler = scheduler; - } - DebounceTimeOperator.prototype.call = function (subscriber, source) { - return source.subscribe(new DebounceTimeSubscriber(subscriber, this.dueTime, this.scheduler)); - }; - return DebounceTimeOperator; -}()); -/** - * We need this JSDoc comment for affecting ESDoc. - * @ignore - * @extends {Ignored} - */ -var DebounceTimeSubscriber = (function (_super) { - __extends(DebounceTimeSubscriber, _super); - function DebounceTimeSubscriber(destination, dueTime, scheduler) { - _super.call(this, destination); - this.dueTime = dueTime; - this.scheduler = scheduler; - this.debouncedSubscription = null; - this.lastValue = null; - this.hasValue = false; - } - DebounceTimeSubscriber.prototype._next = function (value) { - this.clearDebounce(); - this.lastValue = value; - this.hasValue = true; - this.add(this.debouncedSubscription = this.scheduler.schedule(dispatchNext, this.dueTime, this)); - }; - DebounceTimeSubscriber.prototype._complete = function () { - this.debouncedNext(); - this.destination.complete(); - }; - DebounceTimeSubscriber.prototype.debouncedNext = function () { - this.clearDebounce(); - if (this.hasValue) { - this.destination.next(this.lastValue); - this.lastValue = null; - this.hasValue = false; - } - }; - DebounceTimeSubscriber.prototype.clearDebounce = function () { - var debouncedSubscription = this.debouncedSubscription; - if (debouncedSubscription !== null) { - this.remove(debouncedSubscription); - debouncedSubscription.unsubscribe(); - this.debouncedSubscription = null; - } - }; - return DebounceTimeSubscriber; -}(Subscriber_1.Subscriber)); -function dispatchNext(subscriber) { - subscriber.debouncedNext(); -} -//# sourceMappingURL=debounceTime.js.map + propertyName = property.text; + } -/***/ }), -/* 293 */ -/***/ (function(module, exports, __webpack_require__) { + try { + this._validateProperty(propertyName, expr); + } catch (ex) { + invalid = ex; + } -"use strict"; + this.fire({ + type: "property", + property: property, + value: expr, + important: prio, + line: property.line, + col: property.col, + invalid: invalid + }); -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; -var Subscriber_1 = __webpack_require__(2); -/* tslint:enable:max-line-length */ -/** - * Emits a given value if the source Observable completes without emitting any - * `next` value, otherwise mirrors the source Observable. - * - * If the source Observable turns out to be empty, then - * this operator will emit a default value. - * - * - * - * `defaultIfEmpty` emits the values emitted by the source Observable or a - * specified default value if the source Observable is empty (completes without - * having emitted any `next` value). - * - * @example If no clicks happen in 5 seconds, then emit "no clicks" - * var clicks = Rx.Observable.fromEvent(document, 'click'); - * var clicksBeforeFive = clicks.takeUntil(Rx.Observable.interval(5000)); - * var result = clicksBeforeFive.defaultIfEmpty('no clicks'); - * result.subscribe(x => console.log(x)); - * - * @see {@link empty} - * @see {@link last} - * - * @param {any} [defaultValue=null] The default value used if the source - * Observable is empty. - * @return {Observable} An Observable that emits either the specified - * `defaultValue` if the source Observable emits no items, or the values emitted - * by the source Observable. - * @method defaultIfEmpty - * @owner Observable - */ -function defaultIfEmpty(defaultValue) { - if (defaultValue === void 0) { defaultValue = null; } - return this.lift(new DefaultIfEmptyOperator(defaultValue)); -} -exports.defaultIfEmpty = defaultIfEmpty; -var DefaultIfEmptyOperator = (function () { - function DefaultIfEmptyOperator(defaultValue) { - this.defaultValue = defaultValue; - } - DefaultIfEmptyOperator.prototype.call = function (subscriber, source) { - return source.subscribe(new DefaultIfEmptySubscriber(subscriber, this.defaultValue)); - }; - return DefaultIfEmptyOperator; -}()); -/** - * We need this JSDoc comment for affecting ESDoc. - * @ignore - * @extends {Ignored} - */ -var DefaultIfEmptySubscriber = (function (_super) { - __extends(DefaultIfEmptySubscriber, _super); - function DefaultIfEmptySubscriber(destination, defaultValue) { - _super.call(this, destination); - this.defaultValue = defaultValue; - this.isEmpty = true; - } - DefaultIfEmptySubscriber.prototype._next = function (value) { - this.isEmpty = false; - this.destination.next(value); - }; - DefaultIfEmptySubscriber.prototype._complete = function () { - if (this.isEmpty) { - this.destination.next(this.defaultValue); - } - this.destination.complete(); - }; - return DefaultIfEmptySubscriber; -}(Subscriber_1.Subscriber)); -//# sourceMappingURL=defaultIfEmpty.js.map + return true; + } else { + return false; + } + }, -/***/ }), -/* 294 */ -/***/ (function(module, exports, __webpack_require__) { + _prio: function(){ + /* + * prio + * : IMPORTANT_SYM S* + * ; + */ -"use strict"; + var tokenStream = this._tokenStream, + result = tokenStream.match(Tokens.IMPORTANT_SYM); -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; -var async_1 = __webpack_require__(8); -var isDate_1 = __webpack_require__(27); -var Subscriber_1 = __webpack_require__(2); -var Notification_1 = __webpack_require__(30); -/** - * Delays the emission of items from the source Observable by a given timeout or - * until a given Date. - * - * Time shifts each item by some specified amount of - * milliseconds. - * - * - * - * If the delay argument is a Number, this operator time shifts the source - * Observable by that amount of time expressed in milliseconds. The relative - * time intervals between the values are preserved. - * - * If the delay argument is a Date, this operator time shifts the start of the - * Observable execution until the given date occurs. - * - * @example Delay each click by one second - * var clicks = Rx.Observable.fromEvent(document, 'click'); - * var delayedClicks = clicks.delay(1000); // each click emitted after 1 second - * delayedClicks.subscribe(x => console.log(x)); - * - * @example Delay all clicks until a future date happens - * var clicks = Rx.Observable.fromEvent(document, 'click'); - * var date = new Date('March 15, 2050 12:00:00'); // in the future - * var delayedClicks = clicks.delay(date); // click emitted only after that date - * delayedClicks.subscribe(x => console.log(x)); - * - * @see {@link debounceTime} - * @see {@link delayWhen} - * - * @param {number|Date} delay The delay duration in milliseconds (a `number`) or - * a `Date` until which the emission of the source items is delayed. - * @param {Scheduler} [scheduler=async] The IScheduler to use for - * managing the timers that handle the time-shift for each item. - * @return {Observable} An Observable that delays the emissions of the source - * Observable by the specified timeout or Date. - * @method delay - * @owner Observable - */ -function delay(delay, scheduler) { - if (scheduler === void 0) { scheduler = async_1.async; } - var absoluteDelay = isDate_1.isDate(delay); - var delayFor = absoluteDelay ? (+delay - scheduler.now()) : Math.abs(delay); - return this.lift(new DelayOperator(delayFor, scheduler)); -} -exports.delay = delay; -var DelayOperator = (function () { - function DelayOperator(delay, scheduler) { - this.delay = delay; - this.scheduler = scheduler; - } - DelayOperator.prototype.call = function (subscriber, source) { - return source.subscribe(new DelaySubscriber(subscriber, this.delay, this.scheduler)); - }; - return DelayOperator; -}()); -/** - * We need this JSDoc comment for affecting ESDoc. - * @ignore - * @extends {Ignored} - */ -var DelaySubscriber = (function (_super) { - __extends(DelaySubscriber, _super); - function DelaySubscriber(destination, delay, scheduler) { - _super.call(this, destination); - this.delay = delay; - this.scheduler = scheduler; - this.queue = []; - this.active = false; - this.errored = false; - } - DelaySubscriber.dispatch = function (state) { - var source = state.source; - var queue = source.queue; - var scheduler = state.scheduler; - var destination = state.destination; - while (queue.length > 0 && (queue[0].time - scheduler.now()) <= 0) { - queue.shift().notification.observe(destination); - } - if (queue.length > 0) { - var delay_1 = Math.max(0, queue[0].time - scheduler.now()); - this.schedule(state, delay_1); - } - else { - source.active = false; - } - }; - DelaySubscriber.prototype._schedule = function (scheduler) { - this.active = true; - this.add(scheduler.schedule(DelaySubscriber.dispatch, this.delay, { - source: this, destination: this.destination, scheduler: scheduler - })); - }; - DelaySubscriber.prototype.scheduleNotification = function (notification) { - if (this.errored === true) { - return; - } - var scheduler = this.scheduler; - var message = new DelayMessage(scheduler.now() + this.delay, notification); - this.queue.push(message); - if (this.active === false) { - this._schedule(scheduler); - } - }; - DelaySubscriber.prototype._next = function (value) { - this.scheduleNotification(Notification_1.Notification.createNext(value)); - }; - DelaySubscriber.prototype._error = function (err) { - this.errored = true; - this.queue = []; - this.destination.error(err); - }; - DelaySubscriber.prototype._complete = function () { - this.scheduleNotification(Notification_1.Notification.createComplete()); - }; - return DelaySubscriber; -}(Subscriber_1.Subscriber)); -var DelayMessage = (function () { - function DelayMessage(time, notification) { - this.time = time; - this.notification = notification; - } - return DelayMessage; -}()); -//# sourceMappingURL=delay.js.map + this._readWhitespace(); + return result; + }, -/***/ }), -/* 295 */ -/***/ (function(module, exports, __webpack_require__) { + _expr: function(inFunction){ + /* + * expr + * : term [ operator term ]* + * ; + */ + + var values = [], + //valueParts = [], + value = null, + operator = null; + + value = this._term(inFunction); + if (value !== null){ + + values.push(value); + + do { + operator = this._operator(inFunction); + + //if there's an operator, keep building up the value parts + if (operator){ + values.push(operator); + } /*else { + //if there's not an operator, you have a full value + values.push(new PropertyValue(valueParts, valueParts[0].line, valueParts[0].col)); + valueParts = []; + }*/ + + value = this._term(inFunction); + + if (value === null){ + break; + } else { + values.push(value); + } + } while(true); + } -"use strict"; + //cleanup + /*if (valueParts.length){ + values.push(new PropertyValue(valueParts, valueParts[0].line, valueParts[0].col)); + }*/ -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; -var Subscriber_1 = __webpack_require__(2); -var Observable_1 = __webpack_require__(0); -var OuterSubscriber_1 = __webpack_require__(4); -var subscribeToResult_1 = __webpack_require__(3); -/** - * Delays the emission of items from the source Observable by a given time span - * determined by the emissions of another Observable. - * - * It's like {@link delay}, but the time span of the - * delay duration is determined by a second Observable. - * - * - * - * `delayWhen` time shifts each emitted value from the source Observable by a - * time span determined by another Observable. When the source emits a value, - * the `delayDurationSelector` function is called with the source value as - * argument, and should return an Observable, called the "duration" Observable. - * The source value is emitted on the output Observable only when the duration - * Observable emits a value or completes. - * - * Optionally, `delayWhen` takes a second argument, `subscriptionDelay`, which - * is an Observable. When `subscriptionDelay` emits its first value or - * completes, the source Observable is subscribed to and starts behaving like - * described in the previous paragraph. If `subscriptionDelay` is not provided, - * `delayWhen` will subscribe to the source Observable as soon as the output - * Observable is subscribed. - * - * @example Delay each click by a random amount of time, between 0 and 5 seconds - * var clicks = Rx.Observable.fromEvent(document, 'click'); - * var delayedClicks = clicks.delayWhen(event => - * Rx.Observable.interval(Math.random() * 5000) - * ); - * delayedClicks.subscribe(x => console.log(x)); - * - * @see {@link debounce} - * @see {@link delay} - * - * @param {function(value: T): Observable} delayDurationSelector A function that - * returns an Observable for each value emitted by the source Observable, which - * is then used to delay the emission of that item on the output Observable - * until the Observable returned from this function emits a value. - * @param {Observable} subscriptionDelay An Observable that triggers the - * subscription to the source Observable once it emits any value. - * @return {Observable} An Observable that delays the emissions of the source - * Observable by an amount of time specified by the Observable returned by - * `delayDurationSelector`. - * @method delayWhen - * @owner Observable - */ -function delayWhen(delayDurationSelector, subscriptionDelay) { - if (subscriptionDelay) { - return new SubscriptionDelayObservable(this, subscriptionDelay) - .lift(new DelayWhenOperator(delayDurationSelector)); - } - return this.lift(new DelayWhenOperator(delayDurationSelector)); -} -exports.delayWhen = delayWhen; -var DelayWhenOperator = (function () { - function DelayWhenOperator(delayDurationSelector) { - this.delayDurationSelector = delayDurationSelector; - } - DelayWhenOperator.prototype.call = function (subscriber, source) { - return source.subscribe(new DelayWhenSubscriber(subscriber, this.delayDurationSelector)); - }; - return DelayWhenOperator; -}()); -/** - * We need this JSDoc comment for affecting ESDoc. - * @ignore - * @extends {Ignored} - */ -var DelayWhenSubscriber = (function (_super) { - __extends(DelayWhenSubscriber, _super); - function DelayWhenSubscriber(destination, delayDurationSelector) { - _super.call(this, destination); - this.delayDurationSelector = delayDurationSelector; - this.completed = false; - this.delayNotifierSubscriptions = []; - this.values = []; - } - DelayWhenSubscriber.prototype.notifyNext = function (outerValue, innerValue, outerIndex, innerIndex, innerSub) { - this.destination.next(outerValue); - this.removeSubscription(innerSub); - this.tryComplete(); - }; - DelayWhenSubscriber.prototype.notifyError = function (error, innerSub) { - this._error(error); - }; - DelayWhenSubscriber.prototype.notifyComplete = function (innerSub) { - var value = this.removeSubscription(innerSub); - if (value) { - this.destination.next(value); - } - this.tryComplete(); - }; - DelayWhenSubscriber.prototype._next = function (value) { - try { - var delayNotifier = this.delayDurationSelector(value); - if (delayNotifier) { - this.tryDelay(delayNotifier, value); - } - } - catch (err) { - this.destination.error(err); - } - }; - DelayWhenSubscriber.prototype._complete = function () { - this.completed = true; - this.tryComplete(); - }; - DelayWhenSubscriber.prototype.removeSubscription = function (subscription) { - subscription.unsubscribe(); - var subscriptionIdx = this.delayNotifierSubscriptions.indexOf(subscription); - var value = null; - if (subscriptionIdx !== -1) { - value = this.values[subscriptionIdx]; - this.delayNotifierSubscriptions.splice(subscriptionIdx, 1); - this.values.splice(subscriptionIdx, 1); - } - return value; - }; - DelayWhenSubscriber.prototype.tryDelay = function (delayNotifier, value) { - var notifierSubscription = subscribeToResult_1.subscribeToResult(this, delayNotifier, value); - if (notifierSubscription && !notifierSubscription.closed) { - this.add(notifierSubscription); - this.delayNotifierSubscriptions.push(notifierSubscription); - } - this.values.push(value); - }; - DelayWhenSubscriber.prototype.tryComplete = function () { - if (this.completed && this.delayNotifierSubscriptions.length === 0) { - this.destination.complete(); - } - }; - return DelayWhenSubscriber; -}(OuterSubscriber_1.OuterSubscriber)); -/** - * We need this JSDoc comment for affecting ESDoc. - * @ignore - * @extends {Ignored} - */ -var SubscriptionDelayObservable = (function (_super) { - __extends(SubscriptionDelayObservable, _super); - function SubscriptionDelayObservable(source, subscriptionDelay) { - _super.call(this); - this.source = source; - this.subscriptionDelay = subscriptionDelay; - } - SubscriptionDelayObservable.prototype._subscribe = function (subscriber) { - this.subscriptionDelay.subscribe(new SubscriptionDelaySubscriber(subscriber, this.source)); - }; - return SubscriptionDelayObservable; -}(Observable_1.Observable)); -/** - * We need this JSDoc comment for affecting ESDoc. - * @ignore - * @extends {Ignored} - */ -var SubscriptionDelaySubscriber = (function (_super) { - __extends(SubscriptionDelaySubscriber, _super); - function SubscriptionDelaySubscriber(parent, source) { - _super.call(this); - this.parent = parent; - this.source = source; - this.sourceSubscribed = false; - } - SubscriptionDelaySubscriber.prototype._next = function (unused) { - this.subscribeToSource(); - }; - SubscriptionDelaySubscriber.prototype._error = function (err) { - this.unsubscribe(); - this.parent.error(err); - }; - SubscriptionDelaySubscriber.prototype._complete = function () { - this.subscribeToSource(); - }; - SubscriptionDelaySubscriber.prototype.subscribeToSource = function () { - if (!this.sourceSubscribed) { - this.sourceSubscribed = true; - this.unsubscribe(); - this.source.subscribe(this.parent); - } - }; - return SubscriptionDelaySubscriber; -}(Subscriber_1.Subscriber)); -//# sourceMappingURL=delayWhen.js.map + return values.length > 0 ? new PropertyValue(values, values[0].line, values[0].col) : null; + }, -/***/ }), -/* 296 */ -/***/ (function(module, exports, __webpack_require__) { + _term: function(inFunction){ + + /* + * term + * : unary_operator? + * [ NUMBER S* | PERCENTAGE S* | LENGTH S* | ANGLE S* | + * TIME S* | FREQ S* | function | ie_function ] + * | STRING S* | IDENT S* | URI S* | UNICODERANGE S* | hexcolor + * ; + */ + + var tokenStream = this._tokenStream, + unary = null, + value = null, + endChar = null, + token, + line, + col; + + //returns the operator or null + unary = this._unary_operator(); + if (unary !== null){ + line = tokenStream.token().startLine; + col = tokenStream.token().startCol; + } -"use strict"; + //exception for IE filters + if (tokenStream.peek() === Tokens.IE_FUNCTION && this.options.ieFilters){ -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; -var Subscriber_1 = __webpack_require__(2); -/** - * Converts an Observable of {@link Notification} objects into the emissions - * that they represent. - * - * Unwraps {@link Notification} objects as actual `next`, - * `error` and `complete` emissions. The opposite of {@link materialize}. - * - * - * - * `dematerialize` is assumed to operate an Observable that only emits - * {@link Notification} objects as `next` emissions, and does not emit any - * `error`. Such Observable is the output of a `materialize` operation. Those - * notifications are then unwrapped using the metadata they contain, and emitted - * as `next`, `error`, and `complete` on the output Observable. - * - * Use this operator in conjunction with {@link materialize}. - * - * @example Convert an Observable of Notifications to an actual Observable - * var notifA = new Rx.Notification('N', 'A'); - * var notifB = new Rx.Notification('N', 'B'); - * var notifE = new Rx.Notification('E', void 0, - * new TypeError('x.toUpperCase is not a function') - * ); - * var materialized = Rx.Observable.of(notifA, notifB, notifE); - * var upperCase = materialized.dematerialize(); - * upperCase.subscribe(x => console.log(x), e => console.error(e)); - * - * // Results in: - * // A - * // B - * // TypeError: x.toUpperCase is not a function - * - * @see {@link Notification} - * @see {@link materialize} - * - * @return {Observable} An Observable that emits items and notifications - * embedded in Notification objects emitted by the source Observable. - * @method dematerialize - * @owner Observable - */ -function dematerialize() { - return this.lift(new DeMaterializeOperator()); -} -exports.dematerialize = dematerialize; -var DeMaterializeOperator = (function () { - function DeMaterializeOperator() { - } - DeMaterializeOperator.prototype.call = function (subscriber, source) { - return source.subscribe(new DeMaterializeSubscriber(subscriber)); - }; - return DeMaterializeOperator; -}()); -/** - * We need this JSDoc comment for affecting ESDoc. - * @ignore - * @extends {Ignored} - */ -var DeMaterializeSubscriber = (function (_super) { - __extends(DeMaterializeSubscriber, _super); - function DeMaterializeSubscriber(destination) { - _super.call(this, destination); - } - DeMaterializeSubscriber.prototype._next = function (value) { - value.observe(this.destination); - }; - return DeMaterializeSubscriber; -}(Subscriber_1.Subscriber)); -//# sourceMappingURL=dematerialize.js.map + value = this._ie_function(); + if (unary === null){ + line = tokenStream.token().startLine; + col = tokenStream.token().startCol; + } -/***/ }), -/* 297 */ -/***/ (function(module, exports, __webpack_require__) { + //see if it's a simple block + } else if (inFunction && tokenStream.match([Tokens.LPAREN, Tokens.LBRACE, Tokens.LBRACKET])){ -"use strict"; + token = tokenStream.token(); + endChar = token.endChar; + value = token.value + this._expr(inFunction).text; + if (unary === null){ + line = tokenStream.token().startLine; + col = tokenStream.token().startCol; + } + tokenStream.mustMatch(Tokens.type(endChar)); + value += endChar; + this._readWhitespace(); + + //see if there's a simple match + } else if (tokenStream.match([Tokens.NUMBER, Tokens.PERCENTAGE, Tokens.LENGTH, + Tokens.ANGLE, Tokens.TIME, + Tokens.FREQ, Tokens.STRING, Tokens.IDENT, Tokens.URI, Tokens.UNICODE_RANGE])){ + + value = tokenStream.token().value; + if (unary === null){ + line = tokenStream.token().startLine; + col = tokenStream.token().startCol; + } + this._readWhitespace(); + } else { -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; -var OuterSubscriber_1 = __webpack_require__(4); -var subscribeToResult_1 = __webpack_require__(3); -var Set_1 = __webpack_require__(372); -/** - * Returns an Observable that emits all items emitted by the source Observable that are distinct by comparison from previous items. - * - * If a keySelector function is provided, then it will project each value from the source observable into a new value that it will - * check for equality with previously projected values. If a keySelector function is not provided, it will use each value from the - * source observable directly with an equality check against previous values. - * - * In JavaScript runtimes that support `Set`, this operator will use a `Set` to improve performance of the distinct value checking. - * - * In other runtimes, this operator will use a minimal implementation of `Set` that relies on an `Array` and `indexOf` under the - * hood, so performance will degrade as more values are checked for distinction. Even in newer browsers, a long-running `distinct` - * use might result in memory leaks. To help alleviate this in some scenarios, an optional `flushes` parameter is also provided so - * that the internal `Set` can be "flushed", basically clearing it of values. - * - * @example A simple example with numbers - * Observable.of(1, 1, 2, 2, 2, 1, 2, 3, 4, 3, 2, 1) - * .distinct() - * .subscribe(x => console.log(x)); // 1, 2, 3, 4 - * - * @example An example using a keySelector function - * interface Person { - * age: number, - * name: string - * } - * - * Observable.of( - * { age: 4, name: 'Foo'}, - * { age: 7, name: 'Bar'}, - * { age: 5, name: 'Foo'}) - * .distinct((p: Person) => p.name) - * .subscribe(x => console.log(x)); - * - * // displays: - * // { age: 4, name: 'Foo' } - * // { age: 7, name: 'Bar' } - * - * @see {@link distinctUntilChanged} - * @see {@link distinctUntilKeyChanged} - * - * @param {function} [keySelector] Optional function to select which value you want to check as distinct. - * @param {Observable} [flushes] Optional Observable for flushing the internal HashSet of the operator. - * @return {Observable} An Observable that emits items from the source Observable with distinct values. - * @method distinct - * @owner Observable - */ -function distinct(keySelector, flushes) { - return this.lift(new DistinctOperator(keySelector, flushes)); -} -exports.distinct = distinct; -var DistinctOperator = (function () { - function DistinctOperator(keySelector, flushes) { - this.keySelector = keySelector; - this.flushes = flushes; - } - DistinctOperator.prototype.call = function (subscriber, source) { - return source.subscribe(new DistinctSubscriber(subscriber, this.keySelector, this.flushes)); - }; - return DistinctOperator; -}()); -/** - * We need this JSDoc comment for affecting ESDoc. - * @ignore - * @extends {Ignored} - */ -var DistinctSubscriber = (function (_super) { - __extends(DistinctSubscriber, _super); - function DistinctSubscriber(destination, keySelector, flushes) { - _super.call(this, destination); - this.keySelector = keySelector; - this.values = new Set_1.Set(); - if (flushes) { - this.add(subscribeToResult_1.subscribeToResult(this, flushes)); - } - } - DistinctSubscriber.prototype.notifyNext = function (outerValue, innerValue, outerIndex, innerIndex, innerSub) { - this.values.clear(); - }; - DistinctSubscriber.prototype.notifyError = function (error, innerSub) { - this._error(error); - }; - DistinctSubscriber.prototype._next = function (value) { - if (this.keySelector) { - this._useKeySelector(value); - } - else { - this._finalizeNext(value, value); - } - }; - DistinctSubscriber.prototype._useKeySelector = function (value) { - var key; - var destination = this.destination; - try { - key = this.keySelector(value); - } - catch (err) { - destination.error(err); - return; - } - this._finalizeNext(key, value); - }; - DistinctSubscriber.prototype._finalizeNext = function (key, value) { - var values = this.values; - if (!values.has(key)) { - values.add(key); - this.destination.next(value); - } - }; - return DistinctSubscriber; -}(OuterSubscriber_1.OuterSubscriber)); -exports.DistinctSubscriber = DistinctSubscriber; -//# sourceMappingURL=distinct.js.map + //see if it's a color + token = this._hexcolor(); + if (token === null){ -/***/ }), -/* 298 */ -/***/ (function(module, exports, __webpack_require__) { + //if there's no unary, get the start of the next token for line/col info + if (unary === null){ + line = tokenStream.LT(1).startLine; + col = tokenStream.LT(1).startCol; + } -"use strict"; + //has to be a function + if (value === null){ + + /* + * This checks for alpha(opacity=0) style of IE + * functions. IE_FUNCTION only presents progid: style. + */ + if (tokenStream.LA(3) === Tokens.EQUALS && this.options.ieFilters){ + value = this._ie_function(); + } else { + value = this._function(); + } + } -var distinctUntilChanged_1 = __webpack_require__(60); -/* tslint:enable:max-line-length */ -/** - * Returns an Observable that emits all items emitted by the source Observable that are distinct by comparison from the previous item, - * using a property accessed by using the key provided to check if the two items are distinct. - * - * If a comparator function is provided, then it will be called for each item to test for whether or not that value should be emitted. - * - * If a comparator function is not provided, an equality check is used by default. - * - * @example An example comparing the name of persons - * - * interface Person { - * age: number, - * name: string - * } - * - * Observable.of( - * { age: 4, name: 'Foo'}, - * { age: 7, name: 'Bar'}, - * { age: 5, name: 'Foo'}, - * { age: 6, name: 'Foo'}) - * .distinctUntilKeyChanged('name') - * .subscribe(x => console.log(x)); - * - * // displays: - * // { age: 4, name: 'Foo' } - * // { age: 7, name: 'Bar' } - * // { age: 5, name: 'Foo' } - * - * @example An example comparing the first letters of the name - * - * interface Person { - * age: number, - * name: string - * } - * - * Observable.of( - * { age: 4, name: 'Foo1'}, - * { age: 7, name: 'Bar'}, - * { age: 5, name: 'Foo2'}, - * { age: 6, name: 'Foo3'}) - * .distinctUntilKeyChanged('name', (x: string, y: string) => x.substring(0, 3) === y.substring(0, 3)) - * .subscribe(x => console.log(x)); - * - * // displays: - * // { age: 4, name: 'Foo1' } - * // { age: 7, name: 'Bar' } - * // { age: 5, name: 'Foo2' } - * - * @see {@link distinct} - * @see {@link distinctUntilChanged} - * - * @param {string} key String key for object property lookup on each item. - * @param {function} [compare] Optional comparison function called to test if an item is distinct from the previous item in the source. - * @return {Observable} An Observable that emits items from the source Observable with distinct values based on the key specified. - * @method distinctUntilKeyChanged - * @owner Observable - */ -function distinctUntilKeyChanged(key, compare) { - return distinctUntilChanged_1.distinctUntilChanged.call(this, function (x, y) { - if (compare) { - return compare(x[key], y[key]); - } - return x[key] === y[key]; - }); -} -exports.distinctUntilKeyChanged = distinctUntilKeyChanged; -//# sourceMappingURL=distinctUntilKeyChanged.js.map + /*if (value === null){ + return null; + //throw new Error("Expected identifier at line " + tokenStream.token().startLine + ", character " + tokenStream.token().startCol + "."); + }*/ -/***/ }), -/* 299 */ -/***/ (function(module, exports, __webpack_require__) { + } else { + value = token.value; + if (unary === null){ + line = token.startLine; + col = token.startCol; + } + } -"use strict"; + } -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; -var Subscriber_1 = __webpack_require__(2); -/* tslint:enable:max-line-length */ -/** - * Perform a side effect for every emission on the source Observable, but return - * an Observable that is identical to the source. - * - * Intercepts each emission on the source and runs a - * function, but returns an output which is identical to the source as long as errors don't occur. - * - * - * - * Returns a mirrored Observable of the source Observable, but modified so that - * the provided Observer is called to perform a side effect for every value, - * error, and completion emitted by the source. Any errors that are thrown in - * the aforementioned Observer or handlers are safely sent down the error path - * of the output Observable. - * - * This operator is useful for debugging your Observables for the correct values - * or performing other side effects. - * - * Note: this is different to a `subscribe` on the Observable. If the Observable - * returned by `do` is not subscribed, the side effects specified by the - * Observer will never happen. `do` therefore simply spies on existing - * execution, it does not trigger an execution to happen like `subscribe` does. - * - * @example Map every click to the clientX position of that click, while also logging the click event - * var clicks = Rx.Observable.fromEvent(document, 'click'); - * var positions = clicks - * .do(ev => console.log(ev)) - * .map(ev => ev.clientX); - * positions.subscribe(x => console.log(x)); - * - * @see {@link map} - * @see {@link subscribe} - * - * @param {Observer|function} [nextOrObserver] A normal Observer object or a - * callback for `next`. - * @param {function} [error] Callback for errors in the source. - * @param {function} [complete] Callback for the completion of the source. - * @return {Observable} An Observable identical to the source, but runs the - * specified Observer or callback(s) for each item. - * @method do - * @name do - * @owner Observable - */ -function _do(nextOrObserver, error, complete) { - return this.lift(new DoOperator(nextOrObserver, error, complete)); -} -exports._do = _do; -var DoOperator = (function () { - function DoOperator(nextOrObserver, error, complete) { - this.nextOrObserver = nextOrObserver; - this.error = error; - this.complete = complete; - } - DoOperator.prototype.call = function (subscriber, source) { - return source.subscribe(new DoSubscriber(subscriber, this.nextOrObserver, this.error, this.complete)); - }; - return DoOperator; -}()); -/** - * We need this JSDoc comment for affecting ESDoc. - * @ignore - * @extends {Ignored} - */ -var DoSubscriber = (function (_super) { - __extends(DoSubscriber, _super); - function DoSubscriber(destination, nextOrObserver, error, complete) { - _super.call(this, destination); - var safeSubscriber = new Subscriber_1.Subscriber(nextOrObserver, error, complete); - safeSubscriber.syncErrorThrowable = true; - this.add(safeSubscriber); - this.safeSubscriber = safeSubscriber; - } - DoSubscriber.prototype._next = function (value) { - var safeSubscriber = this.safeSubscriber; - safeSubscriber.next(value); - if (safeSubscriber.syncErrorThrown) { - this.destination.error(safeSubscriber.syncErrorValue); - } - else { - this.destination.next(value); - } - }; - DoSubscriber.prototype._error = function (err) { - var safeSubscriber = this.safeSubscriber; - safeSubscriber.error(err); - if (safeSubscriber.syncErrorThrown) { - this.destination.error(safeSubscriber.syncErrorValue); - } - else { - this.destination.error(err); - } - }; - DoSubscriber.prototype._complete = function () { - var safeSubscriber = this.safeSubscriber; - safeSubscriber.complete(); - if (safeSubscriber.syncErrorThrown) { - this.destination.error(safeSubscriber.syncErrorValue); - } - else { - this.destination.complete(); - } - }; - return DoSubscriber; -}(Subscriber_1.Subscriber)); -//# sourceMappingURL=do.js.map + return value !== null ? + new PropertyValuePart(unary !== null ? unary + value : value, line, col) : + null; -/***/ }), -/* 300 */ -/***/ (function(module, exports, __webpack_require__) { + }, -"use strict"; + _function: function(){ + + /* + * function + * : FUNCTION S* expr ')' S* + * ; + */ + + var tokenStream = this._tokenStream, + functionText = null, + expr = null, + lt; + + if (tokenStream.match(Tokens.FUNCTION)){ + functionText = tokenStream.token().value; + this._readWhitespace(); + expr = this._expr(true); + functionText += expr; + + //START: Horrible hack in case it's an IE filter + if (this.options.ieFilters && tokenStream.peek() === Tokens.EQUALS){ + do { + + if (this._readWhitespace()){ + functionText += tokenStream.token().value; + } + + //might be second time in the loop + if (tokenStream.LA(0) === Tokens.COMMA){ + functionText += tokenStream.token().value; + } + + tokenStream.match(Tokens.IDENT); + functionText += tokenStream.token().value; + + tokenStream.match(Tokens.EQUALS); + functionText += tokenStream.token().value; + + //functionText += this._term(); + lt = tokenStream.peek(); + while(lt !== Tokens.COMMA && lt !== Tokens.S && lt !== Tokens.RPAREN){ + tokenStream.get(); + functionText += tokenStream.token().value; + lt = tokenStream.peek(); + } + } while(tokenStream.match([Tokens.COMMA, Tokens.S])); + } -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; -var Subscriber_1 = __webpack_require__(2); -var ArgumentOutOfRangeError_1 = __webpack_require__(22); -/** - * Emits the single value at the specified `index` in a sequence of emissions - * from the source Observable. - * - * Emits only the i-th value, then completes. - * - * - * - * `elementAt` returns an Observable that emits the item at the specified - * `index` in the source Observable, or a default value if that `index` is out - * of range and the `default` argument is provided. If the `default` argument is - * not given and the `index` is out of range, the output Observable will emit an - * `ArgumentOutOfRangeError` error. - * - * @example Emit only the third click event - * var clicks = Rx.Observable.fromEvent(document, 'click'); - * var result = clicks.elementAt(2); - * result.subscribe(x => console.log(x)); - * - * // Results in: - * // click 1 = nothing - * // click 2 = nothing - * // click 3 = MouseEvent object logged to console - * - * @see {@link first} - * @see {@link last} - * @see {@link skip} - * @see {@link single} - * @see {@link take} - * - * @throws {ArgumentOutOfRangeError} When using `elementAt(i)`, it delivers an - * ArgumentOutOrRangeError to the Observer's `error` callback if `i < 0` or the - * Observable has completed before emitting the i-th `next` notification. - * - * @param {number} index Is the number `i` for the i-th source emission that has - * happened since the subscription, starting from the number `0`. - * @param {T} [defaultValue] The default value returned for missing indices. - * @return {Observable} An Observable that emits a single item, if it is found. - * Otherwise, will emit the default value if given. If not, then emits an error. - * @method elementAt - * @owner Observable - */ -function elementAt(index, defaultValue) { - return this.lift(new ElementAtOperator(index, defaultValue)); -} -exports.elementAt = elementAt; -var ElementAtOperator = (function () { - function ElementAtOperator(index, defaultValue) { - this.index = index; - this.defaultValue = defaultValue; - if (index < 0) { - throw new ArgumentOutOfRangeError_1.ArgumentOutOfRangeError; - } - } - ElementAtOperator.prototype.call = function (subscriber, source) { - return source.subscribe(new ElementAtSubscriber(subscriber, this.index, this.defaultValue)); - }; - return ElementAtOperator; -}()); -/** - * We need this JSDoc comment for affecting ESDoc. - * @ignore - * @extends {Ignored} - */ -var ElementAtSubscriber = (function (_super) { - __extends(ElementAtSubscriber, _super); - function ElementAtSubscriber(destination, index, defaultValue) { - _super.call(this, destination); - this.index = index; - this.defaultValue = defaultValue; - } - ElementAtSubscriber.prototype._next = function (x) { - if (this.index-- === 0) { - this.destination.next(x); - this.destination.complete(); - } - }; - ElementAtSubscriber.prototype._complete = function () { - var destination = this.destination; - if (this.index >= 0) { - if (typeof this.defaultValue !== 'undefined') { - destination.next(this.defaultValue); - } - else { - destination.error(new ArgumentOutOfRangeError_1.ArgumentOutOfRangeError); - } - } - destination.complete(); - }; - return ElementAtSubscriber; -}(Subscriber_1.Subscriber)); -//# sourceMappingURL=elementAt.js.map + //END: Horrible Hack + + tokenStream.match(Tokens.RPAREN); + functionText += ")"; + this._readWhitespace(); + } + + return functionText; + }, + + _ie_function: function(){ + + /* (My own extension) + * ie_function + * : IE_FUNCTION S* IDENT '=' term [S* ','? IDENT '=' term]+ ')' S* + * ; + */ + + var tokenStream = this._tokenStream, + functionText = null, + lt; + + //IE function can begin like a regular function, too + if (tokenStream.match([Tokens.IE_FUNCTION, Tokens.FUNCTION])){ + functionText = tokenStream.token().value; + + do { + + if (this._readWhitespace()){ + functionText += tokenStream.token().value; + } + + //might be second time in the loop + if (tokenStream.LA(0) === Tokens.COMMA){ + functionText += tokenStream.token().value; + } + + tokenStream.match(Tokens.IDENT); + functionText += tokenStream.token().value; + + tokenStream.match(Tokens.EQUALS); + functionText += tokenStream.token().value; + + //functionText += this._term(); + lt = tokenStream.peek(); + while(lt !== Tokens.COMMA && lt !== Tokens.S && lt !== Tokens.RPAREN){ + tokenStream.get(); + functionText += tokenStream.token().value; + lt = tokenStream.peek(); + } + } while(tokenStream.match([Tokens.COMMA, Tokens.S])); + + tokenStream.match(Tokens.RPAREN); + functionText += ")"; + this._readWhitespace(); + } + + return functionText; + }, + + _hexcolor: function(){ + /* + * There is a constraint on the color that it must + * have either 3 or 6 hex-digits (i.e., [0-9a-fA-F]) + * after the "#"; e.g., "#000" is OK, but "#abcd" is not. + * + * hexcolor + * : HASH S* + * ; + */ + + var tokenStream = this._tokenStream, + token = null, + color; + + if(tokenStream.match(Tokens.HASH)){ + + //need to do some validation here + + token = tokenStream.token(); + color = token.value; + if (!/#[a-f0-9]{3,6}/i.test(color)){ + throw new SyntaxError("Expected a hex color but found '" + color + "' at line " + token.startLine + ", col " + token.startCol + ".", token.startLine, token.startCol); + } + this._readWhitespace(); + } + + return token; + }, + + //----------------------------------------------------------------- + // Animations methods + //----------------------------------------------------------------- + + _keyframes: function(){ + + /* + * keyframes: + * : KEYFRAMES_SYM S* keyframe_name S* '{' S* keyframe_rule* '}' { + * ; + */ + var tokenStream = this._tokenStream, + token, + tt, + name, + prefix = ""; + + tokenStream.mustMatch(Tokens.KEYFRAMES_SYM); + token = tokenStream.token(); + if (/^@\-([^\-]+)\-/.test(token.value)) { + prefix = RegExp.$1; + } + + this._readWhitespace(); + name = this._keyframe_name(); + + this._readWhitespace(); + tokenStream.mustMatch(Tokens.LBRACE); + + this.fire({ + type: "startkeyframes", + name: name, + prefix: prefix, + line: token.startLine, + col: token.startCol + }); + + this._readWhitespace(); + tt = tokenStream.peek(); + + //check for key + while(tt === Tokens.IDENT || tt === Tokens.PERCENTAGE) { + this._keyframe_rule(); + this._readWhitespace(); + tt = tokenStream.peek(); + } + + this.fire({ + type: "endkeyframes", + name: name, + prefix: prefix, + line: token.startLine, + col: token.startCol + }); + + this._readWhitespace(); + tokenStream.mustMatch(Tokens.RBRACE); + + }, + + _keyframe_name: function(){ + + /* + * keyframe_name: + * : IDENT + * | STRING + * ; + */ + var tokenStream = this._tokenStream; + + tokenStream.mustMatch([Tokens.IDENT, Tokens.STRING]); + return SyntaxUnit.fromToken(tokenStream.token()); + }, + + _keyframe_rule: function(){ + + /* + * keyframe_rule: + * : key_list S* + * '{' S* declaration [ ';' S* declaration ]* '}' S* + * ; + */ + var keyList = this._key_list(); + + this.fire({ + type: "startkeyframerule", + keys: keyList, + line: keyList[0].line, + col: keyList[0].col + }); + + this._readDeclarations(true); + + this.fire({ + type: "endkeyframerule", + keys: keyList, + line: keyList[0].line, + col: keyList[0].col + }); + + }, + + _key_list: function(){ + + /* + * key_list: + * : key [ S* ',' S* key]* + * ; + */ + var tokenStream = this._tokenStream, + keyList = []; + + //must be least one key + keyList.push(this._key()); + + this._readWhitespace(); + + while(tokenStream.match(Tokens.COMMA)){ + this._readWhitespace(); + keyList.push(this._key()); + this._readWhitespace(); + } -/***/ }), -/* 301 */ -/***/ (function(module, exports, __webpack_require__) { + return keyList; + }, -"use strict"; + _key: function(){ + /* + * There is a restriction that IDENT can be only "from" or "to". + * + * key + * : PERCENTAGE + * | IDENT + * ; + */ + + var tokenStream = this._tokenStream, + token; + + if (tokenStream.match(Tokens.PERCENTAGE)){ + return SyntaxUnit.fromToken(tokenStream.token()); + } else if (tokenStream.match(Tokens.IDENT)){ + token = tokenStream.token(); + + if (/from|to/i.test(token.value)){ + return SyntaxUnit.fromToken(token); + } -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; -var OuterSubscriber_1 = __webpack_require__(4); -var subscribeToResult_1 = __webpack_require__(3); -/** - * Converts a higher-order Observable into a first-order Observable by dropping - * inner Observables while the previous inner Observable has not yet completed. - * - * Flattens an Observable-of-Observables by dropping the - * next inner Observables while the current inner is still executing. - * - * - * - * `exhaust` subscribes to an Observable that emits Observables, also known as a - * higher-order Observable. Each time it observes one of these emitted inner - * Observables, the output Observable begins emitting the items emitted by that - * inner Observable. So far, it behaves like {@link mergeAll}. However, - * `exhaust` ignores every new inner Observable if the previous Observable has - * not yet completed. Once that one completes, it will accept and flatten the - * next inner Observable and repeat this process. - * - * @example Run a finite timer for each click, only if there is no currently active timer - * var clicks = Rx.Observable.fromEvent(document, 'click'); - * var higherOrder = clicks.map((ev) => Rx.Observable.interval(1000).take(5)); - * var result = higherOrder.exhaust(); - * result.subscribe(x => console.log(x)); - * - * @see {@link combineAll} - * @see {@link concatAll} - * @see {@link switch} - * @see {@link mergeAll} - * @see {@link exhaustMap} - * @see {@link zipAll} - * - * @return {Observable} An Observable that takes a source of Observables and propagates the first observable - * exclusively until it completes before subscribing to the next. - * @method exhaust - * @owner Observable - */ -function exhaust() { - return this.lift(new SwitchFirstOperator()); -} -exports.exhaust = exhaust; -var SwitchFirstOperator = (function () { - function SwitchFirstOperator() { - } - SwitchFirstOperator.prototype.call = function (subscriber, source) { - return source.subscribe(new SwitchFirstSubscriber(subscriber)); - }; - return SwitchFirstOperator; -}()); -/** - * We need this JSDoc comment for affecting ESDoc. - * @ignore - * @extends {Ignored} - */ -var SwitchFirstSubscriber = (function (_super) { - __extends(SwitchFirstSubscriber, _super); - function SwitchFirstSubscriber(destination) { - _super.call(this, destination); - this.hasCompleted = false; - this.hasSubscription = false; - } - SwitchFirstSubscriber.prototype._next = function (value) { - if (!this.hasSubscription) { - this.hasSubscription = true; - this.add(subscribeToResult_1.subscribeToResult(this, value)); - } - }; - SwitchFirstSubscriber.prototype._complete = function () { - this.hasCompleted = true; - if (!this.hasSubscription) { - this.destination.complete(); - } - }; - SwitchFirstSubscriber.prototype.notifyComplete = function (innerSub) { - this.remove(innerSub); - this.hasSubscription = false; - if (this.hasCompleted) { - this.destination.complete(); - } - }; - return SwitchFirstSubscriber; -}(OuterSubscriber_1.OuterSubscriber)); -//# sourceMappingURL=exhaust.js.map + tokenStream.unget(); + } -/***/ }), -/* 302 */ -/***/ (function(module, exports, __webpack_require__) { + //if it gets here, there wasn't a valid token, so time to explode + this._unexpectedToken(tokenStream.LT(1)); + }, -"use strict"; + //----------------------------------------------------------------- + // Helper methods + //----------------------------------------------------------------- -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; -var OuterSubscriber_1 = __webpack_require__(4); -var subscribeToResult_1 = __webpack_require__(3); -/* tslint:enable:max-line-length */ -/** - * Projects each source value to an Observable which is merged in the output - * Observable only if the previous projected Observable has completed. - * - * Maps each value to an Observable, then flattens all of - * these inner Observables using {@link exhaust}. - * - * - * - * Returns an Observable that emits items based on applying a function that you - * supply to each item emitted by the source Observable, where that function - * returns an (so-called "inner") Observable. When it projects a source value to - * an Observable, the output Observable begins emitting the items emitted by - * that projected Observable. However, `exhaustMap` ignores every new projected - * Observable if the previous projected Observable has not yet completed. Once - * that one completes, it will accept and flatten the next projected Observable - * and repeat this process. - * - * @example Run a finite timer for each click, only if there is no currently active timer - * var clicks = Rx.Observable.fromEvent(document, 'click'); - * var result = clicks.exhaustMap((ev) => Rx.Observable.interval(1000).take(5)); - * result.subscribe(x => console.log(x)); - * - * @see {@link concatMap} - * @see {@link exhaust} - * @see {@link mergeMap} - * @see {@link switchMap} - * - * @param {function(value: T, ?index: number): ObservableInput} project A function - * that, when applied to an item emitted by the source Observable, returns an - * Observable. - * @param {function(outerValue: T, innerValue: I, outerIndex: number, innerIndex: number): any} [resultSelector] - * A function to produce the value on the output Observable based on the values - * and the indices of the source (outer) emission and the inner Observable - * emission. The arguments passed to this function are: - * - `outerValue`: the value that came from the source - * - `innerValue`: the value that came from the projected Observable - * - `outerIndex`: the "index" of the value that came from the source - * - `innerIndex`: the "index" of the value from the projected Observable - * @return {Observable} An Observable containing projected Observables - * of each item of the source, ignoring projected Observables that start before - * their preceding Observable has completed. - * @method exhaustMap - * @owner Observable - */ -function exhaustMap(project, resultSelector) { - return this.lift(new SwitchFirstMapOperator(project, resultSelector)); -} -exports.exhaustMap = exhaustMap; -var SwitchFirstMapOperator = (function () { - function SwitchFirstMapOperator(project, resultSelector) { - this.project = project; - this.resultSelector = resultSelector; - } - SwitchFirstMapOperator.prototype.call = function (subscriber, source) { - return source.subscribe(new SwitchFirstMapSubscriber(subscriber, this.project, this.resultSelector)); - }; - return SwitchFirstMapOperator; -}()); -/** - * We need this JSDoc comment for affecting ESDoc. - * @ignore - * @extends {Ignored} - */ -var SwitchFirstMapSubscriber = (function (_super) { - __extends(SwitchFirstMapSubscriber, _super); - function SwitchFirstMapSubscriber(destination, project, resultSelector) { - _super.call(this, destination); - this.project = project; - this.resultSelector = resultSelector; - this.hasSubscription = false; - this.hasCompleted = false; - this.index = 0; - } - SwitchFirstMapSubscriber.prototype._next = function (value) { - if (!this.hasSubscription) { - this.tryNext(value); - } - }; - SwitchFirstMapSubscriber.prototype.tryNext = function (value) { - var index = this.index++; - var destination = this.destination; - try { - var result = this.project(value, index); - this.hasSubscription = true; - this.add(subscribeToResult_1.subscribeToResult(this, result, value, index)); - } - catch (err) { - destination.error(err); - } - }; - SwitchFirstMapSubscriber.prototype._complete = function () { - this.hasCompleted = true; - if (!this.hasSubscription) { - this.destination.complete(); - } - }; - SwitchFirstMapSubscriber.prototype.notifyNext = function (outerValue, innerValue, outerIndex, innerIndex, innerSub) { - var _a = this, resultSelector = _a.resultSelector, destination = _a.destination; - if (resultSelector) { - this.trySelectResult(outerValue, innerValue, outerIndex, innerIndex); - } - else { - destination.next(innerValue); - } - }; - SwitchFirstMapSubscriber.prototype.trySelectResult = function (outerValue, innerValue, outerIndex, innerIndex) { - var _a = this, resultSelector = _a.resultSelector, destination = _a.destination; - try { - var result = resultSelector(outerValue, innerValue, outerIndex, innerIndex); - destination.next(result); - } - catch (err) { - destination.error(err); - } - }; - SwitchFirstMapSubscriber.prototype.notifyError = function (err) { - this.destination.error(err); - }; - SwitchFirstMapSubscriber.prototype.notifyComplete = function (innerSub) { - this.remove(innerSub); - this.hasSubscription = false; - if (this.hasCompleted) { - this.destination.complete(); - } - }; - return SwitchFirstMapSubscriber; -}(OuterSubscriber_1.OuterSubscriber)); -//# sourceMappingURL=exhaustMap.js.map + /** + * Not part of CSS grammar, but useful for skipping over + * combination of white space and HTML-style comments. + * @return {void} + * @method _skipCruft + * @private + */ + _skipCruft: function(){ + while(this._tokenStream.match([Tokens.S, Tokens.CDO, Tokens.CDC])){ + //noop + } + }, -/***/ }), -/* 303 */ -/***/ (function(module, exports, __webpack_require__) { + /** + * Not part of CSS grammar, but this pattern occurs frequently + * in the official CSS grammar. Split out here to eliminate + * duplicate code. + * @param {Boolean} checkStart Indicates if the rule should check + * for the left brace at the beginning. + * @param {Boolean} readMargins Indicates if the rule should check + * for margin patterns. + * @return {void} + * @method _readDeclarations + * @private + */ + _readDeclarations: function(checkStart, readMargins){ + /* + * Reads the pattern + * S* '{' S* declaration [ ';' S* declaration ]* '}' S* + * or + * S* '{' S* [ declaration | margin ]? [ ';' S* [ declaration | margin ]? ]* '}' S* + * Note that this is how it is described in CSS3 Paged Media, but is actually incorrect. + * A semicolon is only necessary following a declaration if there's another declaration + * or margin afterwards. + */ + var tokenStream = this._tokenStream, + tt; + + + this._readWhitespace(); + + if (checkStart){ + tokenStream.mustMatch(Tokens.LBRACE); + } -"use strict"; + this._readWhitespace(); -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; -var tryCatch_1 = __webpack_require__(7); -var errorObject_1 = __webpack_require__(5); -var OuterSubscriber_1 = __webpack_require__(4); -var subscribeToResult_1 = __webpack_require__(3); -/* tslint:enable:max-line-length */ -/** - * Recursively projects each source value to an Observable which is merged in - * the output Observable. - * - * It's similar to {@link mergeMap}, but applies the - * projection function to every source value as well as every output value. - * It's recursive. - * - * - * - * Returns an Observable that emits items based on applying a function that you - * supply to each item emitted by the source Observable, where that function - * returns an Observable, and then merging those resulting Observables and - * emitting the results of this merger. *Expand* will re-emit on the output - * Observable every source value. Then, each output value is given to the - * `project` function which returns an inner Observable to be merged on the - * output Observable. Those output values resulting from the projection are also - * given to the `project` function to produce new output values. This is how - * *expand* behaves recursively. - * - * @example Start emitting the powers of two on every click, at most 10 of them - * var clicks = Rx.Observable.fromEvent(document, 'click'); - * var powersOfTwo = clicks - * .mapTo(1) - * .expand(x => Rx.Observable.of(2 * x).delay(1000)) - * .take(10); - * powersOfTwo.subscribe(x => console.log(x)); - * - * @see {@link mergeMap} - * @see {@link mergeScan} - * - * @param {function(value: T, index: number) => Observable} project A function - * that, when applied to an item emitted by the source or the output Observable, - * returns an Observable. - * @param {number} [concurrent=Number.POSITIVE_INFINITY] Maximum number of input - * Observables being subscribed to concurrently. - * @param {Scheduler} [scheduler=null] The IScheduler to use for subscribing to - * each projected inner Observable. - * @return {Observable} An Observable that emits the source values and also - * result of applying the projection function to each value emitted on the - * output Observable and and merging the results of the Observables obtained - * from this transformation. - * @method expand - * @owner Observable - */ -function expand(project, concurrent, scheduler) { - if (concurrent === void 0) { concurrent = Number.POSITIVE_INFINITY; } - if (scheduler === void 0) { scheduler = undefined; } - concurrent = (concurrent || 0) < 1 ? Number.POSITIVE_INFINITY : concurrent; - return this.lift(new ExpandOperator(project, concurrent, scheduler)); -} -exports.expand = expand; -var ExpandOperator = (function () { - function ExpandOperator(project, concurrent, scheduler) { - this.project = project; - this.concurrent = concurrent; - this.scheduler = scheduler; - } - ExpandOperator.prototype.call = function (subscriber, source) { - return source.subscribe(new ExpandSubscriber(subscriber, this.project, this.concurrent, this.scheduler)); - }; - return ExpandOperator; -}()); -exports.ExpandOperator = ExpandOperator; -/** - * We need this JSDoc comment for affecting ESDoc. - * @ignore - * @extends {Ignored} - */ -var ExpandSubscriber = (function (_super) { - __extends(ExpandSubscriber, _super); - function ExpandSubscriber(destination, project, concurrent, scheduler) { - _super.call(this, destination); - this.project = project; - this.concurrent = concurrent; - this.scheduler = scheduler; - this.index = 0; - this.active = 0; - this.hasCompleted = false; - if (concurrent < Number.POSITIVE_INFINITY) { - this.buffer = []; - } - } - ExpandSubscriber.dispatch = function (arg) { - var subscriber = arg.subscriber, result = arg.result, value = arg.value, index = arg.index; - subscriber.subscribeToProjection(result, value, index); - }; - ExpandSubscriber.prototype._next = function (value) { - var destination = this.destination; - if (destination.closed) { - this._complete(); - return; - } - var index = this.index++; - if (this.active < this.concurrent) { - destination.next(value); - var result = tryCatch_1.tryCatch(this.project)(value, index); - if (result === errorObject_1.errorObject) { - destination.error(errorObject_1.errorObject.e); - } - else if (!this.scheduler) { - this.subscribeToProjection(result, value, index); - } - else { - var state = { subscriber: this, result: result, value: value, index: index }; - this.add(this.scheduler.schedule(ExpandSubscriber.dispatch, 0, state)); - } - } - else { - this.buffer.push(value); - } - }; - ExpandSubscriber.prototype.subscribeToProjection = function (result, value, index) { - this.active++; - this.add(subscribeToResult_1.subscribeToResult(this, result, value, index)); - }; - ExpandSubscriber.prototype._complete = function () { - this.hasCompleted = true; - if (this.hasCompleted && this.active === 0) { - this.destination.complete(); - } - }; - ExpandSubscriber.prototype.notifyNext = function (outerValue, innerValue, outerIndex, innerIndex, innerSub) { - this._next(innerValue); - }; - ExpandSubscriber.prototype.notifyComplete = function (innerSub) { - var buffer = this.buffer; - this.remove(innerSub); - this.active--; - if (buffer && buffer.length > 0) { - this._next(buffer.shift()); - } - if (this.hasCompleted && this.active === 0) { - this.destination.complete(); - } - }; - return ExpandSubscriber; -}(OuterSubscriber_1.OuterSubscriber)); -exports.ExpandSubscriber = ExpandSubscriber; -//# sourceMappingURL=expand.js.map + try { -/***/ }), -/* 304 */ -/***/ (function(module, exports, __webpack_require__) { + while(true){ -"use strict"; + if (tokenStream.match(Tokens.SEMICOLON) || (readMargins && this._margin())){ + //noop + } else if (this._declaration()){ + if (!tokenStream.match(Tokens.SEMICOLON)){ + break; + } + } else { + break; + } -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; -var Subscriber_1 = __webpack_require__(2); -var Subscription_1 = __webpack_require__(9); -/** - * Returns an Observable that mirrors the source Observable, but will call a specified function when - * the source terminates on complete or error. - * @param {function} callback Function to be called when source terminates. - * @return {Observable} An Observable that mirrors the source, but will call the specified function on termination. - * @method finally - * @owner Observable - */ -function _finally(callback) { - return this.lift(new FinallyOperator(callback)); -} -exports._finally = _finally; -var FinallyOperator = (function () { - function FinallyOperator(callback) { - this.callback = callback; - } - FinallyOperator.prototype.call = function (subscriber, source) { - return source.subscribe(new FinallySubscriber(subscriber, this.callback)); - }; - return FinallyOperator; -}()); -/** - * We need this JSDoc comment for affecting ESDoc. - * @ignore - * @extends {Ignored} - */ -var FinallySubscriber = (function (_super) { - __extends(FinallySubscriber, _super); - function FinallySubscriber(destination, callback) { - _super.call(this, destination); - this.add(new Subscription_1.Subscription(callback)); - } - return FinallySubscriber; -}(Subscriber_1.Subscriber)); -//# sourceMappingURL=finally.js.map + //if ((!this._margin() && !this._declaration()) || !tokenStream.match(Tokens.SEMICOLON)){ + // break; + //} + this._readWhitespace(); + } -/***/ }), -/* 305 */ -/***/ (function(module, exports, __webpack_require__) { + tokenStream.mustMatch(Tokens.RBRACE); + this._readWhitespace(); + + } catch (ex) { + if (ex instanceof SyntaxError && !this.options.strict){ + + //fire error event + this.fire({ + type: "error", + error: ex, + message: ex.message, + line: ex.line, + col: ex.col + }); + + //see if there's another declaration + tt = tokenStream.advance([Tokens.SEMICOLON, Tokens.RBRACE]); + if (tt === Tokens.SEMICOLON){ + //if there's a semicolon, then there might be another declaration + this._readDeclarations(false, readMargins); + } else if (tt !== Tokens.RBRACE){ + //if there's a right brace, the rule is finished so don't do anything + //otherwise, rethrow the error because it wasn't handled properly + throw ex; + } -"use strict"; + } else { + //not a syntax error, rethrow it + throw ex; + } + } -var find_1 = __webpack_require__(61); -/** - * Emits only the index of the first value emitted by the source Observable that - * meets some condition. - * - * It's like {@link find}, but emits the index of the - * found value, not the value itself. - * - * - * - * `findIndex` searches for the first item in the source Observable that matches - * the specified condition embodied by the `predicate`, and returns the - * (zero-based) index of the first occurrence in the source. Unlike - * {@link first}, the `predicate` is required in `findIndex`, and does not emit - * an error if a valid value is not found. - * - * @example Emit the index of first click that happens on a DIV element - * var clicks = Rx.Observable.fromEvent(document, 'click'); - * var result = clicks.findIndex(ev => ev.target.tagName === 'DIV'); - * result.subscribe(x => console.log(x)); - * - * @see {@link filter} - * @see {@link find} - * @see {@link first} - * @see {@link take} - * - * @param {function(value: T, index: number, source: Observable): boolean} predicate - * A function called with each item to test for condition matching. - * @param {any} [thisArg] An optional argument to determine the value of `this` - * in the `predicate` function. - * @return {Observable} An Observable of the index of the first item that - * matches the condition. - * @method find - * @owner Observable - */ -function findIndex(predicate, thisArg) { - return this.lift(new find_1.FindValueOperator(predicate, this, true, thisArg)); -} -exports.findIndex = findIndex; -//# sourceMappingURL=findIndex.js.map + }, -/***/ }), -/* 306 */ -/***/ (function(module, exports, __webpack_require__) { + /** + * In some cases, you can end up with two white space tokens in a + * row. Instead of making a change in every function that looks for + * white space, this function is used to match as much white space + * as necessary. + * @method _readWhitespace + * @return {String} The white space if found, empty string if not. + * @private + */ + _readWhitespace: function(){ -"use strict"; + var tokenStream = this._tokenStream, + ws = ""; -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; -var Subscriber_1 = __webpack_require__(2); -var Subscription_1 = __webpack_require__(9); -var Observable_1 = __webpack_require__(0); -var Subject_1 = __webpack_require__(6); -var Map_1 = __webpack_require__(370); -var FastMap_1 = __webpack_require__(368); -/* tslint:enable:max-line-length */ -/** - * Groups the items emitted by an Observable according to a specified criterion, - * and emits these grouped items as `GroupedObservables`, one - * {@link GroupedObservable} per group. - * - * - * - * @example Group objects by id and return as array - * Observable.of({id: 1, name: 'aze1'}, - * {id: 2, name: 'sf2'}, - * {id: 2, name: 'dg2'}, - * {id: 1, name: 'erg1'}, - * {id: 1, name: 'df1'}, - * {id: 2, name: 'sfqfb2'}, - * {id: 3, name: 'qfs3'}, - * {id: 2, name: 'qsgqsfg2'} - * ) - * .groupBy(p => p.id) - * .flatMap( (group$) => group$.reduce((acc, cur) => [...acc, cur], [])) - * .subscribe(p => console.log(p)); - * - * // displays: - * // [ { id: 1, name: 'aze1' }, - * // { id: 1, name: 'erg1' }, - * // { id: 1, name: 'df1' } ] - * // - * // [ { id: 2, name: 'sf2' }, - * // { id: 2, name: 'dg2' }, - * // { id: 2, name: 'sfqfb2' }, - * // { id: 2, name: 'qsgqsfg2' } ] - * // - * // [ { id: 3, name: 'qfs3' } ] - * - * @example Pivot data on the id field - * Observable.of({id: 1, name: 'aze1'}, - * {id: 2, name: 'sf2'}, - * {id: 2, name: 'dg2'}, - * {id: 1, name: 'erg1'}, - * {id: 1, name: 'df1'}, - * {id: 2, name: 'sfqfb2'}, - * {id: 3, name: 'qfs1'}, - * {id: 2, name: 'qsgqsfg2'} - * ) - * .groupBy(p => p.id, p => p.name) - * .flatMap( (group$) => group$.reduce((acc, cur) => [...acc, cur], ["" + group$.key])) - * .map(arr => ({'id': parseInt(arr[0]), 'values': arr.slice(1)})) - * .subscribe(p => console.log(p)); - * - * // displays: - * // { id: 1, values: [ 'aze1', 'erg1', 'df1' ] } - * // { id: 2, values: [ 'sf2', 'dg2', 'sfqfb2', 'qsgqsfg2' ] } - * // { id: 3, values: [ 'qfs1' ] } - * - * @param {function(value: T): K} keySelector A function that extracts the key - * for each item. - * @param {function(value: T): R} [elementSelector] A function that extracts the - * return element for each item. - * @param {function(grouped: GroupedObservable): Observable} [durationSelector] - * A function that returns an Observable to determine how long each group should - * exist. - * @return {Observable>} An Observable that emits - * GroupedObservables, each of which corresponds to a unique key value and each - * of which emits those items from the source Observable that share that key - * value. - * @method groupBy - * @owner Observable - */ -function groupBy(keySelector, elementSelector, durationSelector, subjectSelector) { - return this.lift(new GroupByOperator(keySelector, elementSelector, durationSelector, subjectSelector)); -} -exports.groupBy = groupBy; -var GroupByOperator = (function () { - function GroupByOperator(keySelector, elementSelector, durationSelector, subjectSelector) { - this.keySelector = keySelector; - this.elementSelector = elementSelector; - this.durationSelector = durationSelector; - this.subjectSelector = subjectSelector; - } - GroupByOperator.prototype.call = function (subscriber, source) { - return source.subscribe(new GroupBySubscriber(subscriber, this.keySelector, this.elementSelector, this.durationSelector, this.subjectSelector)); - }; - return GroupByOperator; -}()); -/** - * We need this JSDoc comment for affecting ESDoc. - * @ignore - * @extends {Ignored} - */ -var GroupBySubscriber = (function (_super) { - __extends(GroupBySubscriber, _super); - function GroupBySubscriber(destination, keySelector, elementSelector, durationSelector, subjectSelector) { - _super.call(this, destination); - this.keySelector = keySelector; - this.elementSelector = elementSelector; - this.durationSelector = durationSelector; - this.subjectSelector = subjectSelector; - this.groups = null; - this.attemptedToUnsubscribe = false; - this.count = 0; - } - GroupBySubscriber.prototype._next = function (value) { - var key; - try { - key = this.keySelector(value); - } - catch (err) { - this.error(err); - return; - } - this._group(value, key); - }; - GroupBySubscriber.prototype._group = function (value, key) { - var groups = this.groups; - if (!groups) { - groups = this.groups = typeof key === 'string' ? new FastMap_1.FastMap() : new Map_1.Map(); - } - var group = groups.get(key); - var element; - if (this.elementSelector) { - try { - element = this.elementSelector(value); - } - catch (err) { - this.error(err); + while(tokenStream.match(Tokens.S)){ + ws += tokenStream.token().value; + } + + return ws; + }, + + + /** + * Throws an error when an unexpected token is found. + * @param {Object} token The token that was found. + * @method _unexpectedToken + * @return {void} + * @private + */ + _unexpectedToken: function(token){ + throw new SyntaxError("Unexpected token '" + token.value + "' at line " + token.startLine + ", col " + token.startCol + ".", token.startLine, token.startCol); + }, + + /** + * Helper method used for parsing subparts of a style sheet. + * @return {void} + * @method _verifyEnd + * @private + */ + _verifyEnd: function(){ + if (this._tokenStream.LA(1) !== Tokens.EOF){ + this._unexpectedToken(this._tokenStream.LT(1)); + } + }, + + //----------------------------------------------------------------- + // Validation methods + //----------------------------------------------------------------- + _validateProperty: function(property, value){ + Validation.validate(property, value); + }, + + //----------------------------------------------------------------- + // Parsing methods + //----------------------------------------------------------------- + + parse: function(input){ + this._tokenStream = new TokenStream(input, Tokens); + this._stylesheet(); + }, + + parseStyleSheet: function(input){ + //just passthrough + return this.parse(input); + }, + + parseMediaQuery: function(input){ + this._tokenStream = new TokenStream(input, Tokens); + var result = this._media_query(); + + //if there's anything more, then it's an invalid selector + this._verifyEnd(); + + //otherwise return result + return result; + }, + + /** + * Parses a property value (everything after the semicolon). + * @return {parserlib.css.PropertyValue} The property value. + * @throws parserlib.util.SyntaxError If an unexpected token is found. + * @method parserPropertyValue + */ + parsePropertyValue: function(input){ + + this._tokenStream = new TokenStream(input, Tokens); + this._readWhitespace(); + + var result = this._expr(); + + //okay to have a trailing white space + this._readWhitespace(); + + //if there's anything more, then it's an invalid selector + this._verifyEnd(); + + //otherwise return result + return result; + }, + + /** + * Parses a complete CSS rule, including selectors and + * properties. + * @param {String} input The text to parser. + * @return {Boolean} True if the parse completed successfully, false if not. + * @method parseRule + */ + parseRule: function(input){ + this._tokenStream = new TokenStream(input, Tokens); + + //skip any leading white space + this._readWhitespace(); + + var result = this._ruleset(); + + //skip any trailing white space + this._readWhitespace(); + + //if there's anything more, then it's an invalid selector + this._verifyEnd(); + + //otherwise return result + return result; + }, + + /** + * Parses a single CSS selector (no comma) + * @param {String} input The text to parse as a CSS selector. + * @return {Selector} An object representing the selector. + * @throws parserlib.util.SyntaxError If an unexpected token is found. + * @method parseSelector + */ + parseSelector: function(input){ + + this._tokenStream = new TokenStream(input, Tokens); + + //skip any leading white space + this._readWhitespace(); + + var result = this._selector(); + + //skip any trailing white space + this._readWhitespace(); + + //if there's anything more, then it's an invalid selector + this._verifyEnd(); + + //otherwise return result + return result; + }, + + /** + * Parses an HTML style attribute: a set of CSS declarations + * separated by semicolons. + * @param {String} input The text to parse as a style attribute + * @return {void} + * @method parseStyleAttribute + */ + parseStyleAttribute: function(input){ + input += "}"; // for error recovery in _readDeclarations() + this._tokenStream = new TokenStream(input, Tokens); + this._readDeclarations(); } + }; + + //copy over onto prototype + for (prop in additions){ + if (Object.prototype.hasOwnProperty.call(additions, prop)){ + proto[prop] = additions[prop]; } - else { - element = value; - } - if (!group) { - group = this.subjectSelector ? this.subjectSelector() : new Subject_1.Subject(); - groups.set(key, group); - var groupedObservable = new GroupedObservable(key, group, this); - this.destination.next(groupedObservable); - if (this.durationSelector) { - var duration = void 0; - try { - duration = this.durationSelector(new GroupedObservable(key, group)); - } - catch (err) { - this.error(err); - return; + } + + return proto; +}(); + + +/* +nth + : S* [ ['-'|'+']? INTEGER? {N} [ S* ['-'|'+'] S* INTEGER ]? | + ['-'|'+']? INTEGER | {O}{D}{D} | {E}{V}{E}{N} ] S* + ; +*/ +var Properties = { + __proto__: null, + + //A + "align-items" : "flex-start | flex-end | center | baseline | stretch", + "align-content" : "flex-start | flex-end | center | space-between | space-around | stretch", + "align-self" : "auto | flex-start | flex-end | center | baseline | stretch", + "-webkit-align-items" : "flex-start | flex-end | center | baseline | stretch", + "-webkit-align-content" : "flex-start | flex-end | center | space-between | space-around | stretch", + "-webkit-align-self" : "auto | flex-start | flex-end | center | baseline | stretch", + "alignment-adjust" : "auto | baseline | before-edge | text-before-edge | middle | central | after-edge | text-after-edge | ideographic | alphabetic | hanging | mathematical | | ", + "alignment-baseline" : "baseline | use-script | before-edge | text-before-edge | after-edge | text-after-edge | central | middle | ideographic | alphabetic | hanging | mathematical", + "animation" : 1, + "animation-delay" : { multi: "", comma: true }, + "animation-direction" : { multi: "normal | alternate", comma: true }, + "animation-duration" : { multi: "", comma: true }, + "animation-fill-mode" : { multi: "none | forwards | backwards | both", comma: true }, + "animation-iteration-count" : { multi: " | infinite", comma: true }, + "animation-name" : { multi: "none | ", comma: true }, + "animation-play-state" : { multi: "running | paused", comma: true }, + "animation-timing-function" : 1, + + //vendor prefixed + "-moz-animation-delay" : { multi: "", comma: true }, + "-moz-animation-direction" : { multi: "normal | alternate", comma: true }, + "-moz-animation-duration" : { multi: "", comma: true }, + "-moz-animation-iteration-count" : { multi: " | infinite", comma: true }, + "-moz-animation-name" : { multi: "none | ", comma: true }, + "-moz-animation-play-state" : { multi: "running | paused", comma: true }, + + "-ms-animation-delay" : { multi: "", comma: true }, + "-ms-animation-direction" : { multi: "normal | alternate", comma: true }, + "-ms-animation-duration" : { multi: "", comma: true }, + "-ms-animation-iteration-count" : { multi: " | infinite", comma: true }, + "-ms-animation-name" : { multi: "none | ", comma: true }, + "-ms-animation-play-state" : { multi: "running | paused", comma: true }, + + "-webkit-animation-delay" : { multi: "", comma: true }, + "-webkit-animation-direction" : { multi: "normal | alternate", comma: true }, + "-webkit-animation-duration" : { multi: "", comma: true }, + "-webkit-animation-fill-mode" : { multi: "none | forwards | backwards | both", comma: true }, + "-webkit-animation-iteration-count" : { multi: " | infinite", comma: true }, + "-webkit-animation-name" : { multi: "none | ", comma: true }, + "-webkit-animation-play-state" : { multi: "running | paused", comma: true }, + + "-o-animation-delay" : { multi: "", comma: true }, + "-o-animation-direction" : { multi: "normal | alternate", comma: true }, + "-o-animation-duration" : { multi: "", comma: true }, + "-o-animation-iteration-count" : { multi: " | infinite", comma: true }, + "-o-animation-name" : { multi: "none | ", comma: true }, + "-o-animation-play-state" : { multi: "running | paused", comma: true }, + + "appearance" : "icon | window | desktop | workspace | document | tooltip | dialog | button | push-button | hyperlink | radio | radio-button | checkbox | menu-item | tab | menu | menubar | pull-down-menu | pop-up-menu | list-menu | radio-group | checkbox-group | outline-tree | range | field | combo-box | signature | password | normal | none | inherit", + "azimuth" : function (expression) { + var simple = " | leftwards | rightwards | inherit", + direction = "left-side | far-left | left | center-left | center | center-right | right | far-right | right-side", + behind = false, + valid = false, + part; + + if (!ValidationTypes.isAny(expression, simple)) { + if (ValidationTypes.isAny(expression, "behind")) { + behind = true; + valid = true; + } + + if (ValidationTypes.isAny(expression, direction)) { + valid = true; + if (!behind) { + ValidationTypes.isAny(expression, "behind"); } - this.add(duration.subscribe(new GroupDurationSubscriber(key, group, this))); } } - if (!group.closed) { - group.next(element); + + if (expression.hasNext()) { + part = expression.next(); + if (valid) { + throw new ValidationError("Expected end of value but found '" + part + "'.", part.line, part.col); + } else { + throw new ValidationError("Expected (<'azimuth'>) but found '" + part + "'.", part.line, part.col); + } } - }; - GroupBySubscriber.prototype._error = function (err) { - var groups = this.groups; - if (groups) { - groups.forEach(function (group, key) { - group.error(err); - }); - groups.clear(); + }, + + //B + "backface-visibility" : "visible | hidden", + "background" : 1, + "background-attachment" : { multi: "", comma: true }, + "background-clip" : { multi: "", comma: true }, + "background-color" : " | inherit", + "background-image" : { multi: "", comma: true }, + "background-origin" : { multi: "", comma: true }, + "background-position" : { multi: "", comma: true }, + "background-repeat" : { multi: "" }, + "background-size" : { multi: "", comma: true }, + "baseline-shift" : "baseline | sub | super | | ", + "behavior" : 1, + "binding" : 1, + "bleed" : "", + "bookmark-label" : " | | ", + "bookmark-level" : "none | ", + "bookmark-state" : "open | closed", + "bookmark-target" : "none | | ", + "border" : " || || ", + "border-bottom" : " || || ", + "border-bottom-color" : " | inherit", + "border-bottom-left-radius" : "", + "border-bottom-right-radius" : "", + "border-bottom-style" : "", + "border-bottom-width" : "", + "border-collapse" : "collapse | separate | inherit", + "border-color" : { multi: " | inherit", max: 4 }, + "border-image" : 1, + "border-image-outset" : { multi: " | ", max: 4 }, + "border-image-repeat" : { multi: "stretch | repeat | round", max: 2 }, + "border-image-slice" : function(expression) { + + var valid = false, + numeric = " | ", + fill = false, + count = 0, + max = 4, + part; + + if (ValidationTypes.isAny(expression, "fill")) { + fill = true; + valid = true; + } + + while (expression.hasNext() && count < max) { + valid = ValidationTypes.isAny(expression, numeric); + if (!valid) { + break; + } + count++; } - this.destination.error(err); - }; - GroupBySubscriber.prototype._complete = function () { - var groups = this.groups; - if (groups) { - groups.forEach(function (group, key) { - group.complete(); - }); - groups.clear(); + + + if (!fill) { + ValidationTypes.isAny(expression, "fill"); + } else { + valid = true; } - this.destination.complete(); - }; - GroupBySubscriber.prototype.removeGroup = function (key) { - this.groups.delete(key); - }; - GroupBySubscriber.prototype.unsubscribe = function () { - if (!this.closed) { - this.attemptedToUnsubscribe = true; - if (this.count === 0) { - _super.prototype.unsubscribe.call(this); + + if (expression.hasNext()) { + part = expression.next(); + if (valid) { + throw new ValidationError("Expected end of value but found '" + part + "'.", part.line, part.col); + } else { + throw new ValidationError("Expected ([ | ]{1,4} && fill?) but found '" + part + "'.", part.line, part.col); } } - }; - return GroupBySubscriber; -}(Subscriber_1.Subscriber)); -/** - * We need this JSDoc comment for affecting ESDoc. - * @ignore - * @extends {Ignored} - */ -var GroupDurationSubscriber = (function (_super) { - __extends(GroupDurationSubscriber, _super); - function GroupDurationSubscriber(key, group, parent) { - _super.call(this, group); - this.key = key; - this.group = group; - this.parent = parent; - } - GroupDurationSubscriber.prototype._next = function (value) { - this.complete(); - }; - GroupDurationSubscriber.prototype._unsubscribe = function () { - var _a = this, parent = _a.parent, key = _a.key; - this.key = this.parent = null; - if (parent) { - parent.removeGroup(key); + }, + "border-image-source" : " | none", + "border-image-width" : { multi: " | | | auto", max: 4 }, + "border-left" : " || || ", + "border-left-color" : " | inherit", + "border-left-style" : "", + "border-left-width" : "", + "border-radius" : function(expression) { + + var valid = false, + simple = " | | inherit", + slash = false, + count = 0, + max = 8, + part; + + while (expression.hasNext() && count < max) { + valid = ValidationTypes.isAny(expression, simple); + if (!valid) { + + if (String(expression.peek()) === "/" && count > 0 && !slash) { + slash = true; + max = count + 5; + expression.next(); + } else { + break; + } + } + count++; } - }; - return GroupDurationSubscriber; -}(Subscriber_1.Subscriber)); -/** - * An Observable representing values belonging to the same group represented by - * a common key. The values emitted by a GroupedObservable come from the source - * Observable. The common key is available as the field `key` on a - * GroupedObservable instance. - * - * @class GroupedObservable - */ -var GroupedObservable = (function (_super) { - __extends(GroupedObservable, _super); - function GroupedObservable(key, groupSubject, refCountSubscription) { - _super.call(this); - this.key = key; - this.groupSubject = groupSubject; - this.refCountSubscription = refCountSubscription; - } - GroupedObservable.prototype._subscribe = function (subscriber) { - var subscription = new Subscription_1.Subscription(); - var _a = this, refCountSubscription = _a.refCountSubscription, groupSubject = _a.groupSubject; - if (refCountSubscription && !refCountSubscription.closed) { - subscription.add(new InnerRefCountSubscription(refCountSubscription)); + + if (expression.hasNext()) { + part = expression.next(); + if (valid) { + throw new ValidationError("Expected end of value but found '" + part + "'.", part.line, part.col); + } else { + throw new ValidationError("Expected (<'border-radius'>) but found '" + part + "'.", part.line, part.col); + } } - subscription.add(groupSubject.subscribe(subscriber)); - return subscription; - }; - return GroupedObservable; -}(Observable_1.Observable)); -exports.GroupedObservable = GroupedObservable; -/** - * We need this JSDoc comment for affecting ESDoc. - * @ignore - * @extends {Ignored} - */ -var InnerRefCountSubscription = (function (_super) { - __extends(InnerRefCountSubscription, _super); - function InnerRefCountSubscription(parent) { - _super.call(this); - this.parent = parent; - parent.count++; - } - InnerRefCountSubscription.prototype.unsubscribe = function () { - var parent = this.parent; - if (!parent.closed && !this.closed) { - _super.prototype.unsubscribe.call(this); - parent.count -= 1; - if (parent.count === 0 && parent.attemptedToUnsubscribe) { - parent.unsubscribe(); + }, + "border-right" : "
=0){var c=(g[--u]==b)?this.DM:Math.floor(g[u]*A+(g[u-1]+x)*z);if((g[u]+=d.am(0,c,g,s,0,p))0){g.rShiftTo(v,g)}if(a<0){BigInteger.ZERO.subTo(g,g)}}function bnMod(b){var c=nbi();this.abs().divRemTo(b,null,c);if(this.s<0&&c.compareTo(BigInteger.ZERO)>0){b.subTo(c,c)}return c}function Classic(a){this.m=a}function cConvert(a){if(a.s<0||a.compareTo(this.m)>=0){return a.mod(this.m)}else{return a}}function cRevert(a){return a}function cReduce(a){a.divRemTo(this.m,null,a)}function cMulTo(a,c,b){a.multiplyTo(c,b);this.reduce(b)}function cSqrTo(a,b){a.squareTo(b);this.reduce(b)}Classic.prototype.convert=cConvert;Classic.prototype.revert=cRevert;Classic.prototype.reduce=cReduce;Classic.prototype.mulTo=cMulTo;Classic.prototype.sqrTo=cSqrTo;function bnpInvDigit(){if(this.t<1){return 0}var a=this[0];if((a&1)==0){return 0}var b=a&3;b=(b*(2-(a&15)*b))&15;b=(b*(2-(a&255)*b))&255;b=(b*(2-(((a&65535)*b)&65535)))&65535;b=(b*(2-a*b%this.DV))%this.DV;return(b>0)?this.DV-b:-b}function Montgomery(a){this.m=a;this.mp=a.invDigit();this.mpl=this.mp&32767;this.mph=this.mp>>15;this.um=(1<<(a.DB-15))-1;this.mt2=2*a.t}function montConvert(a){var b=nbi();a.abs().dlShiftTo(this.m.t,b);b.divRemTo(this.m,null,b);if(a.s<0&&b.compareTo(BigInteger.ZERO)>0){this.m.subTo(b,b)}return b}function montRevert(a){var b=nbi();a.copyTo(b);this.reduce(b);return b}function montReduce(a){while(a.t<=this.mt2){a[a.t++]=0}for(var c=0;c>15)*this.mpl)&this.um)<<15))&a.DM;b=c+this.m.t;a[b]+=this.m.am(0,d,a,c,0,this.m.t);while(a[b]>=a.DV){a[b]-=a.DV;a[++b]++}}a.clamp();a.drShiftTo(this.m.t,a);if(a.compareTo(this.m)>=0){a.subTo(this.m,a)}}function montSqrTo(a,b){a.squareTo(b);this.reduce(b)}function montMulTo(a,c,b){a.multiplyTo(c,b);this.reduce(b)}Montgomery.prototype.convert=montConvert;Montgomery.prototype.revert=montRevert;Montgomery.prototype.reduce=montReduce;Montgomery.prototype.mulTo=montMulTo;Montgomery.prototype.sqrTo=montSqrTo;function bnpIsEven(){return((this.t>0)?(this[0]&1):this.s)==0}function bnpExp(h,j){if(h>4294967295||h<1){return BigInteger.ONE}var f=nbi(),a=nbi(),d=j.convert(this),c=nbits(h)-1;d.copyTo(f);while(--c>=0){j.sqrTo(f,a);if((h&(1<0){j.mulTo(a,d,f)}else{var b=f;f=a;a=b}}return j.revert(f)}function bnModPowInt(b,a){var c;if(b<256||a.isEven()){c=new Classic(a)}else{c=new Montgomery(a)}return this.exp(b,c)}BigInteger.prototype.copyTo=bnpCopyTo;BigInteger.prototype.fromInt=bnpFromInt;BigInteger.prototype.fromString=bnpFromString;BigInteger.prototype.clamp=bnpClamp;BigInteger.prototype.dlShiftTo=bnpDLShiftTo;BigInteger.prototype.drShiftTo=bnpDRShiftTo;BigInteger.prototype.lShiftTo=bnpLShiftTo;BigInteger.prototype.rShiftTo=bnpRShiftTo;BigInteger.prototype.subTo=bnpSubTo;BigInteger.prototype.multiplyTo=bnpMultiplyTo;BigInteger.prototype.squareTo=bnpSquareTo;BigInteger.prototype.divRemTo=bnpDivRemTo;BigInteger.prototype.invDigit=bnpInvDigit;BigInteger.prototype.isEven=bnpIsEven;BigInteger.prototype.exp=bnpExp;BigInteger.prototype.toString=bnToString;BigInteger.prototype.negate=bnNegate;BigInteger.prototype.abs=bnAbs;BigInteger.prototype.compareTo=bnCompareTo;BigInteger.prototype.bitLength=bnBitLength;BigInteger.prototype.mod=bnMod;BigInteger.prototype.modPowInt=bnModPowInt;BigInteger.ZERO=nbv(0);BigInteger.ONE=nbv(1); -/*! (c) Tom Wu | http://www-cs-students.stanford.edu/~tjw/jsbn/ - */ -function bnClone(){var a=nbi();this.copyTo(a);return a}function bnIntValue(){if(this.s<0){if(this.t==1){return this[0]-this.DV}else{if(this.t==0){return -1}}}else{if(this.t==1){return this[0]}else{if(this.t==0){return 0}}}return((this[1]&((1<<(32-this.DB))-1))<>24}function bnShortValue(){return(this.t==0)?this.s:(this[0]<<16)>>16}function bnpChunkSize(a){return Math.floor(Math.LN2*this.DB/Math.log(a))}function bnSigNum(){if(this.s<0){return -1}else{if(this.t<=0||(this.t==1&&this[0]<=0)){return 0}else{return 1}}}function bnpToRadix(c){if(c==null){c=10}if(this.signum()==0||c<2||c>36){return"0"}var f=this.chunkSize(c);var e=Math.pow(c,f);var i=nbv(e),j=nbi(),h=nbi(),g="";this.divRemTo(i,j,h);while(j.signum()>0){g=(e+h.intValue()).toString(c).substr(1)+g;j.divRemTo(i,j,h)}return h.intValue().toString(c)+g}function bnpFromRadix(m,h){this.fromInt(0);if(h==null){h=10}var f=this.chunkSize(h);var g=Math.pow(h,f),e=false,a=0,l=0;for(var c=0;c=f){this.dMultiply(g);this.dAddOffset(l,0);a=0;l=0}}if(a>0){this.dMultiply(Math.pow(h,a));this.dAddOffset(l,0)}if(e){BigInteger.ZERO.subTo(this,this)}}function bnpFromNumber(f,e,h){if("number"==typeof e){if(f<2){this.fromInt(1)}else{this.fromNumber(f,h);if(!this.testBit(f-1)){this.bitwiseTo(BigInteger.ONE.shiftLeft(f-1),op_or,this)}if(this.isEven()){this.dAddOffset(1,0)}while(!this.isProbablePrime(e)){this.dAddOffset(2,0);if(this.bitLength()>f){this.subTo(BigInteger.ONE.shiftLeft(f-1),this)}}}}else{var d=new Array(),g=f&7;d.length=(f>>3)+1;e.nextBytes(d);if(g>0){d[0]&=((1<0){if(e>e)!=(this.s&this.DM)>>e){c[a++]=f|(this.s<<(this.DB-e))}while(b>=0){if(e<8){f=(this[b]&((1<>(e+=this.DB-8)}else{f=(this[b]>>(e-=8))&255;if(e<=0){e+=this.DB;--b}}if((f&128)!=0){f|=-256}if(a==0&&(this.s&128)!=(f&128)){++a}if(a>0||f!=this.s){c[a++]=f}}}return c}function bnEquals(b){return(this.compareTo(b)==0)}function bnMin(b){return(this.compareTo(b)<0)?this:b}function bnMax(b){return(this.compareTo(b)>0)?this:b}function bnpBitwiseTo(c,h,e){var d,g,b=Math.min(c.t,this.t);for(d=0;d>=16;b+=16}if((a&255)==0){a>>=8;b+=8}if((a&15)==0){a>>=4;b+=4}if((a&3)==0){a>>=2;b+=2}if((a&1)==0){++b}return b}function bnGetLowestSetBit(){for(var a=0;a=this.t){return(this.s!=0)}return((this[a]&(1<<(b%this.DB)))!=0)}function bnpChangeBit(c,b){var a=BigInteger.ONE.shiftLeft(c);this.bitwiseTo(a,b,a);return a}function bnSetBit(a){return this.changeBit(a,op_or)}function bnClearBit(a){return this.changeBit(a,op_andnot)}function bnFlipBit(a){return this.changeBit(a,op_xor)}function bnpAddTo(d,f){var e=0,g=0,b=Math.min(d.t,this.t);while(e>=this.DB}if(d.t>=this.DB}g+=this.s}else{g+=this.s;while(e>=this.DB}g+=d.s}f.s=(g<0)?-1:0;if(g>0){f[e++]=g}else{if(g<-1){f[e++]=this.DV+g}}f.t=e;f.clamp()}function bnAdd(b){var c=nbi();this.addTo(b,c);return c}function bnSubtract(b){var c=nbi();this.subTo(b,c);return c}function bnMultiply(b){var c=nbi();this.multiplyTo(b,c);return c}function bnSquare(){var a=nbi();this.squareTo(a);return a}function bnDivide(b){var c=nbi();this.divRemTo(b,c,null);return c}function bnRemainder(b){var c=nbi();this.divRemTo(b,null,c);return c}function bnDivideAndRemainder(b){var d=nbi(),c=nbi();this.divRemTo(b,d,c);return new Array(d,c)}function bnpDMultiply(a){this[this.t]=this.am(0,a-1,this,0,0,this.t);++this.t;this.clamp()}function bnpDAddOffset(b,a){if(b==0){return}while(this.t<=a){this[this.t++]=0}this[a]+=b;while(this[a]>=this.DV){this[a]-=this.DV;if(++a>=this.t){this[this.t++]=0}++this[a]}}function NullExp(){}function nNop(a){return a}function nMulTo(a,c,b){a.multiplyTo(c,b)}function nSqrTo(a,b){a.squareTo(b)}NullExp.prototype.convert=nNop;NullExp.prototype.revert=nNop;NullExp.prototype.mulTo=nMulTo;NullExp.prototype.sqrTo=nSqrTo;function bnPow(a){return this.exp(a,new NullExp())}function bnpMultiplyLowerTo(b,f,e){var d=Math.min(this.t+b.t,f);e.s=0;e.t=d;while(d>0){e[--d]=0}var c;for(c=e.t-this.t;d=0){d[c]=0}for(c=Math.max(e-this.t,0);c2*this.m.t){return a.mod(this.m)}else{if(a.compareTo(this.m)<0){return a}else{var b=nbi();a.copyTo(b);this.reduce(b);return b}}}function barrettRevert(a){return a}function barrettReduce(a){a.drShiftTo(this.m.t-1,this.r2);if(a.t>this.m.t+1){a.t=this.m.t+1;a.clamp()}this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3);this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);while(a.compareTo(this.r2)<0){a.dAddOffset(1,this.m.t+1)}a.subTo(this.r2,a);while(a.compareTo(this.m)>=0){a.subTo(this.m,a)}}function barrettSqrTo(a,b){a.squareTo(b);this.reduce(b)}function barrettMulTo(a,c,b){a.multiplyTo(c,b);this.reduce(b)}Barrett.prototype.convert=barrettConvert;Barrett.prototype.revert=barrettRevert;Barrett.prototype.reduce=barrettReduce;Barrett.prototype.mulTo=barrettMulTo;Barrett.prototype.sqrTo=barrettSqrTo;function bnModPow(q,f){var o=q.bitLength(),h,b=nbv(1),v;if(o<=0){return b}else{if(o<18){h=1}else{if(o<48){h=3}else{if(o<144){h=4}else{if(o<768){h=5}else{h=6}}}}}if(o<8){v=new Classic(f)}else{if(f.isEven()){v=new Barrett(f)}else{v=new Montgomery(f)}}var p=new Array(),d=3,s=h-1,a=(1<1){var A=nbi();v.sqrTo(p[1],A);while(d<=a){p[d]=nbi();v.mulTo(A,p[d-2],p[d]);d+=2}}var l=q.t-1,x,u=true,c=nbi(),y;o=nbits(q[l])-1;while(l>=0){if(o>=s){x=(q[l]>>(o-s))&a}else{x=(q[l]&((1<<(o+1))-1))<<(s-o);if(l>0){x|=q[l-1]>>(this.DB+o-s)}}d=h;while((x&1)==0){x>>=1;--d}if((o-=d)<0){o+=this.DB;--l}if(u){p[x].copyTo(b);u=false}else{while(d>1){v.sqrTo(b,c);v.sqrTo(c,b);d-=2}if(d>0){v.sqrTo(b,c)}else{y=b;b=c;c=y}v.mulTo(c,p[x],b)}while(l>=0&&(q[l]&(1<0){b.rShiftTo(f,b);h.rShiftTo(f,h)}while(b.signum()>0){if((d=b.getLowestSetBit())>0){b.rShiftTo(d,b)}if((d=h.getLowestSetBit())>0){h.rShiftTo(d,h)}if(b.compareTo(h)>=0){b.subTo(h,b);b.rShiftTo(1,b)}else{h.subTo(b,h);h.rShiftTo(1,h)}}if(f>0){h.lShiftTo(f,h)}return h}function bnpModInt(e){if(e<=0){return 0}var c=this.DV%e,b=(this.s<0)?e-1:0;if(this.t>0){if(c==0){b=this[0]%e}else{for(var a=this.t-1;a>=0;--a){b=(c*b+this[a])%e}}}return b}function bnModInverse(f){var j=f.isEven();if((this.isEven()&&j)||f.signum()==0){return BigInteger.ZERO}var i=f.clone(),h=this.clone();var g=nbv(1),e=nbv(0),l=nbv(0),k=nbv(1);while(i.signum()!=0){while(i.isEven()){i.rShiftTo(1,i);if(j){if(!g.isEven()||!e.isEven()){g.addTo(this,g);e.subTo(f,e)}g.rShiftTo(1,g)}else{if(!e.isEven()){e.subTo(f,e)}}e.rShiftTo(1,e)}while(h.isEven()){h.rShiftTo(1,h);if(j){if(!l.isEven()||!k.isEven()){l.addTo(this,l);k.subTo(f,k)}l.rShiftTo(1,l)}else{if(!k.isEven()){k.subTo(f,k)}}k.rShiftTo(1,k)}if(i.compareTo(h)>=0){i.subTo(h,i);if(j){g.subTo(l,g)}e.subTo(k,e)}else{h.subTo(i,h);if(j){l.subTo(g,l)}k.subTo(e,k)}}if(h.compareTo(BigInteger.ONE)!=0){return BigInteger.ZERO}if(k.compareTo(f)>=0){return k.subtract(f)}if(k.signum()<0){k.addTo(f,k)}else{return k}if(k.signum()<0){return k.add(f)}else{return k}}var lowprimes=[2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509,521,523,541,547,557,563,569,571,577,587,593,599,601,607,613,617,619,631,641,643,647,653,659,661,673,677,683,691,701,709,719,727,733,739,743,751,757,761,769,773,787,797,809,811,821,823,827,829,839,853,857,859,863,877,881,883,887,907,911,919,929,937,941,947,953,967,971,977,983,991,997];var lplim=(1<<26)/lowprimes[lowprimes.length-1];function bnIsProbablePrime(e){var d,b=this.abs();if(b.t==1&&b[0]<=lowprimes[lowprimes.length-1]){for(d=0;d>1;if(f>lowprimes.length){f=lowprimes.length}var b=nbi();for(var e=0;e>8)&255;rng_pool[rng_pptr++]^=(a>>16)&255;rng_pool[rng_pptr++]^=(a>>24)&255;if(rng_pptr>=rng_psize){rng_pptr-=rng_psize}}function rng_seed_time(){rng_seed_int(new Date().getTime())}if(rng_pool==null){rng_pool=new Array();rng_pptr=0;var t;if(window!==undefined&&(window.crypto!==undefined||window.msCrypto!==undefined)){var crypto=window.crypto||window.msCrypto;if(crypto.getRandomValues){var ua=new Uint8Array(32);crypto.getRandomValues(ua);for(t=0;t<32;++t){rng_pool[rng_pptr++]=ua[t]}}else{if(navigator.appName=="Netscape"&&navigator.appVersion<"5"){var z=window.crypto.random(32);for(t=0;t>>8;rng_pool[rng_pptr++]=t&255}rng_pptr=0;rng_seed_time()}function rng_get_byte(){if(rng_state==null){rng_seed_time();rng_state=prng_newstate();rng_state.init(rng_pool);for(rng_pptr=0;rng_pptr=0&&h>0){var f=e.charCodeAt(d--);if(f<128){g[--h]=f}else{if((f>127)&&(f<2048)){g[--h]=(f&63)|128;g[--h]=(f>>6)|192}else{g[--h]=(f&63)|128;g[--h]=((f>>6)&63)|128;g[--h]=(f>>12)|224}}}g[--h]=0;var b=new SecureRandom();var a=new Array();while(h>2){a[0]=0;while(a[0]==0){b.nextBytes(a)}g[--h]=a[0]}g[--h]=2;g[--h]=0;return new BigInteger(g)}function oaep_mgf1_arr(c,a,e){var b="",d=0;while(b.length>24,(d&16711680)>>16,(d&65280)>>8,d&255])));d+=1}return b}function oaep_pad(q,a,f,l){var c=KJUR.crypto.MessageDigest;var o=KJUR.crypto.Util;var b=null;if(!f){f="sha1"}if(typeof f==="string"){b=c.getCanonicalAlgName(f);l=c.getHashLength(b);f=function(i){return hextorstr(o.hashString(i,b))}}if(q.length+2*l+2>a){throw"Message too long for RSA"}var k="",e;for(e=0;e0&&a.length>0){this.n=parseBigInt(b,16);this.e=parseInt(a,16)}else{throw"Invalid RSA public key"}}}function RSADoPublic(a){return a.modPowInt(this.e,this.n)}function RSAEncrypt(d){var a=pkcs1pad2(d,(this.n.bitLength()+7)>>3);if(a==null){return null}var e=this.doPublic(a);if(e==null){return null}var b=e.toString(16);if((b.length&1)==0){return b}else{return"0"+b}}function RSAEncryptOAEP(f,e,b){var a=oaep_pad(f,(this.n.bitLength()+7)>>3,e,b);if(a==null){return null}var g=this.doPublic(a);if(g==null){return null}var d=g.toString(16);if((d.length&1)==0){return d}else{return"0"+d}}RSAKey.prototype.doPublic=RSADoPublic;RSAKey.prototype.setPublic=RSASetPublic;RSAKey.prototype.encrypt=RSAEncrypt;RSAKey.prototype.encryptOAEP=RSAEncryptOAEP;RSAKey.prototype.type="RSA"; -/*! (c) Tom Wu | http://www-cs-students.stanford.edu/~tjw/jsbn/ - */ -function pkcs1unpad2(g,j){var a=g.toByteArray();var f=0;while(f=a.length){return null}}var e="";while(++f191)&&(h<224)){e+=String.fromCharCode(((h&31)<<6)|(a[f+1]&63));++f}else{e+=String.fromCharCode(((h&15)<<12)|((a[f+1]&63)<<6)|(a[f+2]&63));f+=2}}}return e}function oaep_mgf1_str(c,a,e){var b="",d=0;while(b.length>24,(d&16711680)>>16,(d&65280)>>8,d&255]));d+=1}return b}function oaep_unpad(o,b,g,p){var e=KJUR.crypto.MessageDigest;var r=KJUR.crypto.Util;var c=null;if(!g){g="sha1"}if(typeof g==="string"){c=e.getCanonicalAlgName(g);p=e.getHashLength(c);g=function(d){return hextorstr(r.hashString(d,c))}}o=o.toByteArray();var h;for(h=0;h0&&a.length>0){this.n=parseBigInt(c,16);this.e=parseInt(a,16);this.d=parseBigInt(b,16)}else{alert("Invalid RSA private key")}}}function RSASetPrivateEx(g,d,e,c,b,a,h,f){this.isPrivate=true;this.isPublic=false;if(g==null){throw"RSASetPrivateEx N == null"}if(d==null){throw"RSASetPrivateEx E == null"}if(g.length==0){throw"RSASetPrivateEx N.length == 0"}if(d.length==0){throw"RSASetPrivateEx E.length == 0"}if(g!=null&&d!=null&&g.length>0&&d.length>0){this.n=parseBigInt(g,16);this.e=parseInt(d,16);this.d=parseBigInt(e,16);this.p=parseBigInt(c,16);this.q=parseBigInt(b,16);this.dmp1=parseBigInt(a,16);this.dmq1=parseBigInt(h,16);this.coeff=parseBigInt(f,16)}else{alert("Invalid RSA private key in RSASetPrivateEx")}}function RSAGenerate(b,i){var a=new SecureRandom();var f=b>>1;this.e=parseInt(i,16);var c=new BigInteger(i,16);for(;;){for(;;){this.p=new BigInteger(b-f,1,a);if(this.p.subtract(BigInteger.ONE).gcd(c).compareTo(BigInteger.ONE)==0&&this.p.isProbablePrime(10)){break}}for(;;){this.q=new BigInteger(f,1,a);if(this.q.subtract(BigInteger.ONE).gcd(c).compareTo(BigInteger.ONE)==0&&this.q.isProbablePrime(10)){break}}if(this.p.compareTo(this.q)<=0){var h=this.p;this.p=this.q;this.q=h}var g=this.p.subtract(BigInteger.ONE);var d=this.q.subtract(BigInteger.ONE);var e=g.multiply(d);if(e.gcd(c).compareTo(BigInteger.ONE)==0){this.n=this.p.multiply(this.q);this.d=c.modInverse(e);this.dmp1=this.d.mod(g);this.dmq1=this.d.mod(d);this.coeff=this.q.modInverse(this.p);break}}this.isPrivate=true}function RSADoPrivate(a){if(this.p==null||this.q==null){return a.modPow(this.d,this.n)}var c=a.mod(this.p).modPow(this.dmp1,this.p);var b=a.mod(this.q).modPow(this.dmq1,this.q);while(c.compareTo(b)<0){c=c.add(this.p)}return c.subtract(b).multiply(this.coeff).mod(this.p).multiply(this.q).add(b)}function RSADecrypt(b){var d=parseBigInt(b,16);var a=this.doPrivate(d);if(a==null){return null}return pkcs1unpad2(a,(this.n.bitLength()+7)>>3)}function RSADecryptOAEP(e,d,b){var f=parseBigInt(e,16);var a=this.doPrivate(f);if(a==null){return null}return oaep_unpad(a,(this.n.bitLength()+7)>>3,d,b)}RSAKey.prototype.doPrivate=RSADoPrivate;RSAKey.prototype.setPrivate=RSASetPrivate;RSAKey.prototype.setPrivateEx=RSASetPrivateEx;RSAKey.prototype.generate=RSAGenerate;RSAKey.prototype.decrypt=RSADecrypt;RSAKey.prototype.decryptOAEP=RSADecryptOAEP; -/*! (c) Tom Wu | http://www-cs-students.stanford.edu/~tjw/jsbn/ - */ -function ECFieldElementFp(b,a){this.x=a;this.q=b}function feFpEquals(a){if(a==this){return true}return(this.q.equals(a.q)&&this.x.equals(a.x))}function feFpToBigInteger(){return this.x}function feFpNegate(){return new ECFieldElementFp(this.q,this.x.negate().mod(this.q))}function feFpAdd(a){return new ECFieldElementFp(this.q,this.x.add(a.toBigInteger()).mod(this.q))}function feFpSubtract(a){return new ECFieldElementFp(this.q,this.x.subtract(a.toBigInteger()).mod(this.q))}function feFpMultiply(a){return new ECFieldElementFp(this.q,this.x.multiply(a.toBigInteger()).mod(this.q))}function feFpSquare(){return new ECFieldElementFp(this.q,this.x.square().mod(this.q))}function feFpDivide(a){return new ECFieldElementFp(this.q,this.x.multiply(a.toBigInteger().modInverse(this.q)).mod(this.q))}ECFieldElementFp.prototype.equals=feFpEquals;ECFieldElementFp.prototype.toBigInteger=feFpToBigInteger;ECFieldElementFp.prototype.negate=feFpNegate;ECFieldElementFp.prototype.add=feFpAdd;ECFieldElementFp.prototype.subtract=feFpSubtract;ECFieldElementFp.prototype.multiply=feFpMultiply;ECFieldElementFp.prototype.square=feFpSquare;ECFieldElementFp.prototype.divide=feFpDivide;function ECPointFp(c,a,d,b){this.curve=c;this.x=a;this.y=d;if(b==null){this.z=BigInteger.ONE}else{this.z=b}this.zinv=null}function pointFpGetX(){if(this.zinv==null){this.zinv=this.z.modInverse(this.curve.q)}return this.curve.fromBigInteger(this.x.toBigInteger().multiply(this.zinv).mod(this.curve.q))}function pointFpGetY(){if(this.zinv==null){this.zinv=this.z.modInverse(this.curve.q)}return this.curve.fromBigInteger(this.y.toBigInteger().multiply(this.zinv).mod(this.curve.q))}function pointFpEquals(a){if(a==this){return true}if(this.isInfinity()){return a.isInfinity()}if(a.isInfinity()){return this.isInfinity()}var c,b;c=a.y.toBigInteger().multiply(this.z).subtract(this.y.toBigInteger().multiply(a.z)).mod(this.curve.q);if(!c.equals(BigInteger.ZERO)){return false}b=a.x.toBigInteger().multiply(this.z).subtract(this.x.toBigInteger().multiply(a.z)).mod(this.curve.q);return b.equals(BigInteger.ZERO)}function pointFpIsInfinity(){if((this.x==null)&&(this.y==null)){return true}return this.z.equals(BigInteger.ZERO)&&!this.y.toBigInteger().equals(BigInteger.ZERO)}function pointFpNegate(){return new ECPointFp(this.curve,this.x,this.y.negate(),this.z)}function pointFpAdd(l){if(this.isInfinity()){return l}if(l.isInfinity()){return this}var p=l.y.toBigInteger().multiply(this.z).subtract(this.y.toBigInteger().multiply(l.z)).mod(this.curve.q);var o=l.x.toBigInteger().multiply(this.z).subtract(this.x.toBigInteger().multiply(l.z)).mod(this.curve.q);if(BigInteger.ZERO.equals(o)){if(BigInteger.ZERO.equals(p)){return this.twice()}return this.curve.getInfinity()}var j=new BigInteger("3");var e=this.x.toBigInteger();var n=this.y.toBigInteger();var c=l.x.toBigInteger();var k=l.y.toBigInteger();var m=o.square();var i=m.multiply(o);var d=e.multiply(m);var g=p.square().multiply(this.z);var a=g.subtract(d.shiftLeft(1)).multiply(l.z).subtract(i).multiply(o).mod(this.curve.q);var h=d.multiply(j).multiply(p).subtract(n.multiply(i)).subtract(g.multiply(p)).multiply(l.z).add(p.multiply(i)).mod(this.curve.q);var f=i.multiply(this.z).multiply(l.z).mod(this.curve.q);return new ECPointFp(this.curve,this.curve.fromBigInteger(a),this.curve.fromBigInteger(h),f)}function pointFpTwice(){if(this.isInfinity()){return this}if(this.y.toBigInteger().signum()==0){return this.curve.getInfinity()}var g=new BigInteger("3");var c=this.x.toBigInteger();var h=this.y.toBigInteger();var e=h.multiply(this.z);var j=e.multiply(h).mod(this.curve.q);var i=this.curve.a.toBigInteger();var k=c.square().multiply(g);if(!BigInteger.ZERO.equals(i)){k=k.add(this.z.square().multiply(i))}k=k.mod(this.curve.q);var b=k.square().subtract(c.shiftLeft(3).multiply(j)).shiftLeft(1).multiply(e).mod(this.curve.q);var f=k.multiply(g).multiply(c).subtract(j.shiftLeft(1)).shiftLeft(2).multiply(j).subtract(k.square().multiply(k)).mod(this.curve.q);var d=e.square().multiply(e).shiftLeft(3).mod(this.curve.q);return new ECPointFp(this.curve,this.curve.fromBigInteger(b),this.curve.fromBigInteger(f),d)}function pointFpMultiply(b){if(this.isInfinity()){return this}if(b.signum()==0){return this.curve.getInfinity()}var g=b;var f=g.multiply(new BigInteger("3"));var l=this.negate();var d=this;var c;for(c=f.bitLength()-2;c>0;--c){d=d.twice();var a=f.testBit(c);var j=g.testBit(c);if(a!=j){d=d.add(a?this:l)}}return d}function pointFpMultiplyTwo(c,a,b){var d;if(c.bitLength()>b.bitLength()){d=c.bitLength()-1}else{d=b.bitLength()-1}var f=this.curve.getInfinity();var e=this.add(a);while(d>=0){f=f.twice();if(c.testBit(d)){if(b.testBit(d)){f=f.add(e)}else{f=f.add(this)}}else{if(b.testBit(d)){f=f.add(a)}}--d}return f}ECPointFp.prototype.getX=pointFpGetX;ECPointFp.prototype.getY=pointFpGetY;ECPointFp.prototype.equals=pointFpEquals;ECPointFp.prototype.isInfinity=pointFpIsInfinity;ECPointFp.prototype.negate=pointFpNegate;ECPointFp.prototype.add=pointFpAdd;ECPointFp.prototype.twice=pointFpTwice;ECPointFp.prototype.multiply=pointFpMultiply;ECPointFp.prototype.multiplyTwo=pointFpMultiplyTwo;function ECCurveFp(e,d,c){this.q=e;this.a=this.fromBigInteger(d);this.b=this.fromBigInteger(c);this.infinity=new ECPointFp(this,null,null)}function curveFpGetQ(){return this.q}function curveFpGetA(){return this.a}function curveFpGetB(){return this.b}function curveFpEquals(a){if(a==this){return true}return(this.q.equals(a.q)&&this.a.equals(a.a)&&this.b.equals(a.b))}function curveFpGetInfinity(){return this.infinity}function curveFpFromBigInteger(a){return new ECFieldElementFp(this.q,a)}function curveFpDecodePointHex(d){switch(parseInt(d.substr(0,2),16)){case 0:return this.infinity;case 2:case 3:return null;case 4:case 6:case 7:var a=(d.length-2)/2;var c=d.substr(2,a);var b=d.substr(a+2,a);return new ECPointFp(this,this.fromBigInteger(new BigInteger(c,16)),this.fromBigInteger(new BigInteger(b,16)));default:return null}}ECCurveFp.prototype.getQ=curveFpGetQ;ECCurveFp.prototype.getA=curveFpGetA;ECCurveFp.prototype.getB=curveFpGetB;ECCurveFp.prototype.equals=curveFpEquals;ECCurveFp.prototype.getInfinity=curveFpGetInfinity;ECCurveFp.prototype.fromBigInteger=curveFpFromBigInteger;ECCurveFp.prototype.decodePointHex=curveFpDecodePointHex; -/*! (c) Stefan Thomas | https://github.com/bitcoinjs/bitcoinjs-lib - */ -ECFieldElementFp.prototype.getByteLength=function(){return Math.floor((this.toBigInteger().bitLength()+7)/8)};ECPointFp.prototype.getEncoded=function(c){var d=function(h,f){var g=h.toByteArrayUnsigned();if(fg.length){g.unshift(0)}}return g};var a=this.getX().toBigInteger();var e=this.getY().toBigInteger();var b=d(a,32);if(c){if(e.isEven()){b.unshift(2)}else{b.unshift(3)}}else{b.unshift(4);b=b.concat(d(e,32))}return b};ECPointFp.decodeFrom=function(g,c){var f=c[0];var e=c.length-1;var d=c.slice(1,1+e/2);var b=c.slice(1+e/2,1+e);d.unshift(0);b.unshift(0);var a=new BigInteger(d);var h=new BigInteger(b);return new ECPointFp(g,g.fromBigInteger(a),g.fromBigInteger(h))};ECPointFp.decodeFromHex=function(g,c){var f=c.substr(0,2);var e=c.length-2;var d=c.substr(2,e/2);var b=c.substr(2+e/2,e/2);var a=new BigInteger(d,16);var h=new BigInteger(b,16);return new ECPointFp(g,g.fromBigInteger(a),g.fromBigInteger(h))};ECPointFp.prototype.add2D=function(c){if(this.isInfinity()){return c}if(c.isInfinity()){return this}if(this.x.equals(c.x)){if(this.y.equals(c.y)){return this.twice()}return this.curve.getInfinity()}var g=c.x.subtract(this.x);var e=c.y.subtract(this.y);var a=e.divide(g);var d=a.square().subtract(this.x).subtract(c.x);var f=a.multiply(this.x.subtract(d)).subtract(this.y);return new ECPointFp(this.curve,d,f)};ECPointFp.prototype.twice2D=function(){if(this.isInfinity()){return this}if(this.y.toBigInteger().signum()==0){return this.curve.getInfinity()}var b=this.curve.fromBigInteger(BigInteger.valueOf(2));var e=this.curve.fromBigInteger(BigInteger.valueOf(3));var a=this.x.square().multiply(e).add(this.curve.a).divide(this.y.multiply(b));var c=a.square().subtract(this.x.multiply(b));var d=a.multiply(this.x.subtract(c)).subtract(this.y);return new ECPointFp(this.curve,c,d)};ECPointFp.prototype.multiply2D=function(b){if(this.isInfinity()){return this}if(b.signum()==0){return this.curve.getInfinity()}var g=b;var f=g.multiply(new BigInteger("3"));var l=this.negate();var d=this;var c;for(c=f.bitLength()-2;c>0;--c){d=d.twice();var a=f.testBit(c);var j=g.testBit(c);if(a!=j){d=d.add2D(a?this:l)}}return d};ECPointFp.prototype.isOnCurve=function(){var d=this.getX().toBigInteger();var i=this.getY().toBigInteger();var f=this.curve.getA().toBigInteger();var c=this.curve.getB().toBigInteger();var h=this.curve.getQ();var e=i.multiply(i).mod(h);var g=d.multiply(d).multiply(d).add(f.multiply(d)).add(c).mod(h);return e.equals(g)};ECPointFp.prototype.toString=function(){return"("+this.getX().toBigInteger().toString()+","+this.getY().toBigInteger().toString()+")"};ECPointFp.prototype.validate=function(){var c=this.curve.getQ();if(this.isInfinity()){throw new Error("Point is at infinity.")}var a=this.getX().toBigInteger();var b=this.getY().toBigInteger();if(a.compareTo(BigInteger.ONE)<0||a.compareTo(c.subtract(BigInteger.ONE))>0){throw new Error("x coordinate out of bounds")}if(b.compareTo(BigInteger.ONE)<0||b.compareTo(c.subtract(BigInteger.ONE))>0){throw new Error("y coordinate out of bounds")}if(!this.isOnCurve()){throw new Error("Point is not on the curve.")}if(this.multiply(c).isInfinity()){throw new Error("Point is not a scalar multiple of G.")}return true}; -/*! Mike Samuel (c) 2009 | code.google.com/p/json-sans-eval - */ -var jsonParse=(function(){var e="(?:-?\\b(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?(?:[eE][+-]?[0-9]+)?\\b)";var j='(?:[^\\0-\\x08\\x0a-\\x1f"\\\\]|\\\\(?:["/\\\\bfnrt]|u[0-9A-Fa-f]{4}))';var i='(?:"'+j+'*")';var d=new RegExp("(?:false|true|null|[\\{\\}\\[\\]]|"+e+"|"+i+")","g");var k=new RegExp("\\\\(?:([^u])|u(.{4}))","g");var g={'"':'"',"/":"/","\\":"\\",b:"\b",f:"\f",n:"\n",r:"\r",t:"\t"};function h(l,m,n){return m?g[m]:String.fromCharCode(parseInt(n,16))}var c=new String("");var a="\\";var f={"{":Object,"[":Array};var b=Object.hasOwnProperty;return function(u,q){var p=u.match(d);var x;var v=p[0];var l=false;if("{"===v){x={}}else{if("["===v){x=[]}else{x=[];l=true}}var t;var r=[x];for(var o=1-l,m=p.length;o=0;){delete D[n[A]]}}}return q.call(C,B,D)};x=s({"":x},"")}return x}})(); -if(typeof KJUR=="undefined"||!KJUR){KJUR={}}if(typeof KJUR.asn1=="undefined"||!KJUR.asn1){KJUR.asn1={}}KJUR.asn1.ASN1Util=new function(){this.integerToByteHex=function(a){var b=a.toString(16);if((b.length%2)==1){b="0"+b}return b};this.bigIntToMinTwosComplementsHex=function(j){var f=j.toString(16);if(f.substr(0,1)!="-"){if(f.length%2==1){f="0"+f}else{if(!f.match(/^[0-7]/)){f="00"+f}}}else{var a=f.substr(1);var e=a.length;if(e%2==1){e+=1}else{if(!f.match(/^[0-7]/)){e+=2}}var g="";for(var d=0;d15){throw"ASN.1 length too long to represent by 8x: n = "+i.toString(16)}var f=128+g;return f.toString(16)+h}};this.getEncodedHex=function(){if(this.hTLV==null||this.isModified){this.hV=this.getFreshValueHex();this.hL=this.getLengthHexFromValue();this.hTLV=this.hT+this.hL+this.hV;this.isModified=false}return this.hTLV};this.getValueHex=function(){this.getEncodedHex();return this.hV};this.getFreshValueHex=function(){return""}};KJUR.asn1.DERAbstractString=function(c){KJUR.asn1.DERAbstractString.superclass.constructor.call(this);var b=null;var a=null;this.getString=function(){return this.s};this.setString=function(d){this.hTLV=null;this.isModified=true;this.s=d;this.hV=stohex(this.s)};this.setStringHex=function(d){this.hTLV=null;this.isModified=true;this.s=null;this.hV=d};this.getFreshValueHex=function(){return this.hV};if(typeof c!="undefined"){if(typeof c=="string"){this.setString(c)}else{if(typeof c.str!="undefined"){this.setString(c.str)}else{if(typeof c.hex!="undefined"){this.setStringHex(c.hex)}}}}};YAHOO.lang.extend(KJUR.asn1.DERAbstractString,KJUR.asn1.ASN1Object);KJUR.asn1.DERAbstractTime=function(c){KJUR.asn1.DERAbstractTime.superclass.constructor.call(this);var b=null;var a=null;this.localDateToUTC=function(f){utc=f.getTime()+(f.getTimezoneOffset()*60000);var e=new Date(utc);return e};this.formatDate=function(m,o,e){var g=this.zeroPadding;var n=this.localDateToUTC(m);var p=String(n.getFullYear());if(o=="utc"){p=p.substr(2,2)}var l=g(String(n.getMonth()+1),2);var q=g(String(n.getDate()),2);var h=g(String(n.getHours()),2);var i=g(String(n.getMinutes()),2);var j=g(String(n.getSeconds()),2);var r=p+l+q+h+i+j;if(e===true){var f=n.getMilliseconds();if(f!=0){var k=g(String(f),3);k=k.replace(/[0]+$/,"");r=r+"."+k}}return r+"Z"};this.zeroPadding=function(e,d){if(e.length>=d){return e}return new Array(d-e.length+1).join("0")+e};this.getString=function(){return this.s};this.setString=function(d){this.hTLV=null;this.isModified=true;this.s=d;this.hV=stohex(d)};this.setByDateValue=function(h,j,e,d,f,g){var i=new Date(Date.UTC(h,j-1,e,d,f,g,0));this.setByDate(i)};this.getFreshValueHex=function(){return this.hV}};YAHOO.lang.extend(KJUR.asn1.DERAbstractTime,KJUR.asn1.ASN1Object);KJUR.asn1.DERAbstractStructured=function(b){KJUR.asn1.DERAbstractString.superclass.constructor.call(this);var a=null;this.setByASN1ObjectArray=function(c){this.hTLV=null;this.isModified=true;this.asn1Array=c};this.appendASN1Object=function(c){this.hTLV=null;this.isModified=true;this.asn1Array.push(c)};this.asn1Array=new Array();if(typeof b!="undefined"){if(typeof b.array!="undefined"){this.asn1Array=b.array}}};YAHOO.lang.extend(KJUR.asn1.DERAbstractStructured,KJUR.asn1.ASN1Object);KJUR.asn1.DERBoolean=function(){KJUR.asn1.DERBoolean.superclass.constructor.call(this);this.hT="01";this.hTLV="0101ff"};YAHOO.lang.extend(KJUR.asn1.DERBoolean,KJUR.asn1.ASN1Object);KJUR.asn1.DERInteger=function(a){KJUR.asn1.DERInteger.superclass.constructor.call(this);this.hT="02";this.setByBigInteger=function(b){this.hTLV=null;this.isModified=true;this.hV=KJUR.asn1.ASN1Util.bigIntToMinTwosComplementsHex(b)};this.setByInteger=function(c){var b=new BigInteger(String(c),10);this.setByBigInteger(b)};this.setValueHex=function(b){this.hV=b};this.getFreshValueHex=function(){return this.hV};if(typeof a!="undefined"){if(typeof a.bigint!="undefined"){this.setByBigInteger(a.bigint)}else{if(typeof a["int"]!="undefined"){this.setByInteger(a["int"])}else{if(typeof a=="number"){this.setByInteger(a)}else{if(typeof a.hex!="undefined"){this.setValueHex(a.hex)}}}}}};YAHOO.lang.extend(KJUR.asn1.DERInteger,KJUR.asn1.ASN1Object);KJUR.asn1.DERBitString=function(b){if(b!==undefined&&typeof b.obj!=="undefined"){var a=KJUR.asn1.ASN1Util.newObject(b.obj);b.hex="00"+a.getEncodedHex()}KJUR.asn1.DERBitString.superclass.constructor.call(this);this.hT="03";this.setHexValueIncludingUnusedBits=function(c){this.hTLV=null;this.isModified=true;this.hV=c};this.setUnusedBitsAndHexValue=function(c,e){if(c<0||7=(l*2))){break}if(d>=200){break}g.push(b);c=b;d++}return g};ASN1HEX.getNthChildIdx=function(d,b,e){var c=ASN1HEX.getChildIdx(d,b);return c[e]};ASN1HEX.getIdxbyList=function(e,d,c,i){var g=ASN1HEX;var f,b;if(c.length==0){if(i!==undefined){if(e.substr(d,2)!==i){throw"checking tag doesn't match: "+e.substr(d,2)+"!="+i}}return d}f=c.shift();b=g.getChildIdx(e,d);return g.getIdxbyList(e,b[f],c,i)};ASN1HEX.getTLVbyList=function(d,c,b,f){var e=ASN1HEX;var a=e.getIdxbyList(d,c,b);if(a===undefined){throw"can't find nthList object"}if(f!==undefined){if(d.substr(a,2)!=f){throw"checking tag doesn't match: "+d.substr(a,2)+"!="+f}}return e.getTLV(d,a)};ASN1HEX.getVbyList=function(e,c,b,g,i){var f=ASN1HEX;var a,d;a=f.getIdxbyList(e,c,b,g);if(a===undefined){throw"can't find nthList object"}d=f.getV(e,a);if(i===true){d=d.substr(2)}return d};ASN1HEX.hextooidstr=function(e){var h=function(b,a){if(b.length>=a){return b}return new Array(a-b.length+1).join("0")+b};var l=[];var o=e.substr(0,2);var f=parseInt(o,16);l[0]=new String(Math.floor(f/40));l[1]=new String(f%40);var m=e.substr(2);var k=[];for(var g=0;g0){n=n+"."+j.join(".")}return n};ASN1HEX.dump=function(t,c,l,g){var p=ASN1HEX;var j=p.getV;var y=p.dump;var w=p.getChildIdx;var e=t;if(t instanceof KJUR.asn1.ASN1Object){e=t.getEncodedHex()}var q=function(A,i){if(A.length<=i*2){return A}else{var v=A.substr(0,i)+"..(total "+A.length/2+"bytes).."+A.substr(A.length-i,i);return v}};if(c===undefined){c={ommit_long_octet:32}}if(l===undefined){l=0}if(g===undefined){g=""}var x=c.ommit_long_octet;if(e.substr(l,2)=="01"){var h=j(e,l);if(h=="00"){return g+"BOOLEAN FALSE\n"}else{return g+"BOOLEAN TRUE\n"}}if(e.substr(l,2)=="02"){var h=j(e,l);return g+"INTEGER "+q(h,x)+"\n"}if(e.substr(l,2)=="03"){var h=j(e,l);return g+"BITSTRING "+q(h,x)+"\n"}if(e.substr(l,2)=="04"){var h=j(e,l);if(p.isASN1HEX(h)){var k=g+"OCTETSTRING, encapsulates\n";k=k+y(h,c,0,g+" ");return k}else{return g+"OCTETSTRING "+q(h,x)+"\n"}}if(e.substr(l,2)=="05"){return g+"NULL\n"}if(e.substr(l,2)=="06"){var m=j(e,l);var a=KJUR.asn1.ASN1Util.oidHexToInt(m);var o=KJUR.asn1.x509.OID.oid2name(a);var b=a.replace(/\./g," ");if(o!=""){return g+"ObjectIdentifier "+o+" ("+b+")\n"}else{return g+"ObjectIdentifier ("+b+")\n"}}if(e.substr(l,2)=="0c"){return g+"UTF8String '"+hextoutf8(j(e,l))+"'\n"}if(e.substr(l,2)=="13"){return g+"PrintableString '"+hextoutf8(j(e,l))+"'\n"}if(e.substr(l,2)=="14"){return g+"TeletexString '"+hextoutf8(j(e,l))+"'\n"}if(e.substr(l,2)=="16"){return g+"IA5String '"+hextoutf8(j(e,l))+"'\n"}if(e.substr(l,2)=="17"){return g+"UTCTime "+hextoutf8(j(e,l))+"\n"}if(e.substr(l,2)=="18"){return g+"GeneralizedTime "+hextoutf8(j(e,l))+"\n"}if(e.substr(l,2)=="30"){if(e.substr(l,4)=="3000"){return g+"SEQUENCE {}\n"}var k=g+"SEQUENCE\n";var d=w(e,l);var f=c;if((d.length==2||d.length==3)&&e.substr(d[0],2)=="06"&&e.substr(d[d.length-1],2)=="04"){var o=p.oidname(j(e,d[0]));var r=JSON.parse(JSON.stringify(c));r.x509ExtName=o;f=r}for(var u=0;u0){var m=new f({array:this.extensionsArray});var k=new c({explicit:true,tag:"a3",obj:m});this.asn1Array.push(k)}var n=new f({array:this.asn1Array});this.hTLV=n.getEncodedHex();this.isModified=false;return this.hTLV};this._initialize()};YAHOO.lang.extend(KJUR.asn1.x509.TBSCertificate,KJUR.asn1.ASN1Object);KJUR.asn1.x509.Extension=function(d){KJUR.asn1.x509.Extension.superclass.constructor.call(this);var f=null,a=KJUR,e=a.asn1,h=e.DERObjectIdentifier,i=e.DEROctetString,b=e.DERBitString,g=e.DERBoolean,c=e.DERSequence;this.getEncodedHex=function(){var m=new h({oid:this.oid});var l=new i({hex:this.getExtnValueHex()});var k=new Array();k.push(m);if(this.critical){k.push(new g())}k.push(l);var j=new c({array:k});return j.getEncodedHex()};this.critical=false;if(typeof d!="undefined"){if(typeof d.critical!="undefined"){this.critical=d.critical}}};YAHOO.lang.extend(KJUR.asn1.x509.Extension,KJUR.asn1.ASN1Object);KJUR.asn1.x509.Extension.appendByNameToArray=function(e,c,b){var g=e.toLowerCase(),f=KJUR.asn1.x509;if(g=="basicconstraints"){var d=new f.BasicConstraints(c);b.push(d)}else{if(g=="keyusage"){var d=new f.KeyUsage(c);b.push(d)}else{if(g=="crldistributionpoints"){var d=new f.CRLDistributionPoints(c);b.push(d)}else{if(g=="extkeyusage"){var d=new f.ExtKeyUsage(c);b.push(d)}else{if(g=="authoritykeyidentifier"){var d=new f.AuthorityKeyIdentifier(c);b.push(d)}else{if(g=="authorityinfoaccess"){var d=new f.AuthorityInfoAccess(c);b.push(d)}else{if(g=="subjectaltname"){var d=new f.SubjectAltName(c);b.push(d)}else{if(g=="issueraltname"){var d=new f.IssuerAltName(c);b.push(d)}else{throw"unsupported extension name: "+e}}}}}}}}};KJUR.asn1.x509.KeyUsage=function(a){KJUR.asn1.x509.KeyUsage.superclass.constructor.call(this,a);this.getExtnValueHex=function(){return this.asn1ExtnValue.getEncodedHex()};this.oid="2.5.29.15";if(typeof a!="undefined"){if(typeof a.bin!="undefined"){this.asn1ExtnValue=new KJUR.asn1.DERBitString(a)}}};YAHOO.lang.extend(KJUR.asn1.x509.KeyUsage,KJUR.asn1.x509.Extension);KJUR.asn1.x509.BasicConstraints=function(c){KJUR.asn1.x509.BasicConstraints.superclass.constructor.call(this,c);var a=false;var b=-1;this.getExtnValueHex=function(){var e=new Array();if(this.cA){e.push(new KJUR.asn1.DERBoolean())}if(this.pathLen>-1){e.push(new KJUR.asn1.DERInteger({"int":this.pathLen}))}var d=new KJUR.asn1.DERSequence({array:e});this.asn1ExtnValue=d;return this.asn1ExtnValue.getEncodedHex()};this.oid="2.5.29.19";this.cA=false;this.pathLen=-1;if(typeof c!="undefined"){if(typeof c.cA!="undefined"){this.cA=c.cA}if(typeof c.pathLen!="undefined"){this.pathLen=c.pathLen}}};YAHOO.lang.extend(KJUR.asn1.x509.BasicConstraints,KJUR.asn1.x509.Extension);KJUR.asn1.x509.CRLDistributionPoints=function(d){KJUR.asn1.x509.CRLDistributionPoints.superclass.constructor.call(this,d);var b=KJUR,a=b.asn1,c=a.x509;this.getExtnValueHex=function(){return this.asn1ExtnValue.getEncodedHex()};this.setByDPArray=function(e){this.asn1ExtnValue=new a.DERSequence({array:e})};this.setByOneURI=function(h){var e=new c.GeneralNames([{uri:h}]);var g=new c.DistributionPointName(e);var f=new c.DistributionPoint({dpobj:g});this.setByDPArray([f])};this.oid="2.5.29.31";if(typeof d!="undefined"){if(typeof d.array!="undefined"){this.setByDPArray(d.array)}else{if(typeof d.uri!="undefined"){this.setByOneURI(d.uri)}}}};YAHOO.lang.extend(KJUR.asn1.x509.CRLDistributionPoints,KJUR.asn1.x509.Extension);KJUR.asn1.x509.ExtKeyUsage=function(c){KJUR.asn1.x509.ExtKeyUsage.superclass.constructor.call(this,c);var b=KJUR,a=b.asn1;this.setPurposeArray=function(d){this.asn1ExtnValue=new a.DERSequence();for(var e=0;e0){var h=new b({array:this.aRevokedCert});this.asn1Array.push(h)}var i=new b({array:this.asn1Array});this.hTLV=i.getEncodedHex();this.isModified=false;return this.hTLV};this._initialize=function(){this.asn1Version=null;this.asn1SignatureAlg=null;this.asn1Issuer=null;this.asn1ThisUpdate=null;this.asn1NextUpdate=null;this.aRevokedCert=new Array()};this._initialize()};YAHOO.lang.extend(KJUR.asn1.x509.TBSCertList,KJUR.asn1.ASN1Object);KJUR.asn1.x509.CRLEntry=function(e){KJUR.asn1.x509.CRLEntry.superclass.constructor.call(this);var d=null,c=null,b=KJUR,a=b.asn1;this.setCertSerial=function(f){this.sn=new a.DERInteger(f)};this.setRevocationDate=function(f){this.time=new a.x509.Time(f)};this.getEncodedHex=function(){var f=new a.DERSequence({array:[this.sn,this.time]});this.TLV=f.getEncodedHex();return this.TLV};if(e!==undefined){if(e.time!==undefined){this.setRevocationDate(e.time)}if(e.sn!==undefined){this.setCertSerial(e.sn)}}};YAHOO.lang.extend(KJUR.asn1.x509.CRLEntry,KJUR.asn1.ASN1Object);KJUR.asn1.x509.X500Name=function(f){KJUR.asn1.x509.X500Name.superclass.constructor.call(this);this.asn1Array=new Array();var d=KJUR,c=d.asn1,e=c.x509,b=pemtohex;this.setByString=function(g){var h=g.split("/");h.shift();for(var j=0;j0;f++){var h=c.shift();if(e===true){var d=b.pop();var j=(d+","+h).replace(/\\,/g,",");b.push(j);e=false}else{b.push(h)}if(h.substr(-1,1)==="\\"){e=true}}b=b.map(function(a){return a.replace("/","\\/")});b.reverse();return"/"+b.join("/")};KJUR.asn1.x509.RDN=function(a){KJUR.asn1.x509.RDN.superclass.constructor.call(this);this.asn1Array=new Array();this.addByString=function(b){this.asn1Array.push(new KJUR.asn1.x509.AttributeTypeAndValue({str:b}))};this.addByMultiValuedString=function(d){var b=KJUR.asn1.x509.RDN.parseString(d);for(var c=0;c0;g++){var k=j.shift();if(h===true){var f=c.pop();var d=(f+"+"+k).replace(/\\\+/g,"+");c.push(d);h=false}else{c.push(k)}if(k.substr(-1,1)==="\\"){h=true}}var l=false;var b=[];for(var g=0;c.length>0;g++){var k=c.shift();if(l===true){var e=b.pop();if(k.match(/"$/)){var d=(e+"+"+k).replace(/^([^=]+)="(.*)"$/,"$1=$2");b.push(d);l=false}else{b.push(e+"+"+k)}}else{b.push(k)}if(k.match(/^[^=]+="/)){l=true}}return b};KJUR.asn1.x509.AttributeTypeAndValue=function(d){KJUR.asn1.x509.AttributeTypeAndValue.superclass.constructor.call(this);var f=null,e=null,a="utf8",c=KJUR,b=c.asn1;this.setByString=function(h){var g=h.match(/^([^=]+)=(.+)$/);if(g){this.setByAttrTypeAndValueStr(g[1],g[2])}else{throw"malformed attrTypeAndValueStr: "+h}};this.setByAttrTypeAndValueStr=function(i,h){this.typeObj=KJUR.asn1.x509.OID.atype2obj(i);var g=a;if(i=="C"){g="prn"}this.valueObj=this.getValueObj(g,h)};this.getValueObj=function(h,g){if(h=="utf8"){return new b.DERUTF8String({str:g})}if(h=="prn"){return new b.DERPrintableString({str:g})}if(h=="tel"){return new b.DERTeletexString({str:g})}if(h=="ia5"){return new b.DERIA5String({str:g})}throw"unsupported directory string type: type="+h+" value="+g};this.getEncodedHex=function(){var g=new b.DERSequence({array:[this.typeObj,this.valueObj]});this.TLV=g.getEncodedHex();return this.TLV};if(typeof d!="undefined"){if(typeof d.str!="undefined"){this.setByString(d.str)}}};YAHOO.lang.extend(KJUR.asn1.x509.AttributeTypeAndValue,KJUR.asn1.ASN1Object);KJUR.asn1.x509.SubjectPublicKeyInfo=function(f){KJUR.asn1.x509.SubjectPublicKeyInfo.superclass.constructor.call(this);var l=null,k=null,a=KJUR,j=a.asn1,i=j.DERInteger,b=j.DERBitString,m=j.DERObjectIdentifier,e=j.DERSequence,h=j.ASN1Util.newObject,d=j.x509,o=d.AlgorithmIdentifier,g=a.crypto,n=g.ECDSA,c=g.DSA;this.getASN1Object=function(){if(this.asn1AlgId==null||this.asn1SubjPKey==null){throw"algId and/or subjPubKey not set"}var p=new e({array:[this.asn1AlgId,this.asn1SubjPKey]});return p};this.getEncodedHex=function(){var p=this.getASN1Object();this.hTLV=p.getEncodedHex();return this.hTLV};this.setPubKey=function(q){try{if(q instanceof RSAKey){var u=h({seq:[{"int":{bigint:q.n}},{"int":{"int":q.e}}]});var s=u.getEncodedHex();this.asn1AlgId=new o({name:"rsaEncryption"});this.asn1SubjPKey=new b({hex:"00"+s})}}catch(p){}try{if(q instanceof KJUR.crypto.ECDSA){var r=new m({name:q.curveName});this.asn1AlgId=new o({name:"ecPublicKey",asn1params:r});this.asn1SubjPKey=new b({hex:"00"+q.pubKeyHex})}}catch(p){}try{if(q instanceof KJUR.crypto.DSA){var r=new h({seq:[{"int":{bigint:q.p}},{"int":{bigint:q.q}},{"int":{bigint:q.g}}]});this.asn1AlgId=new o({name:"dsa",asn1params:r});var t=new i({bigint:q.y});this.asn1SubjPKey=new b({hex:"00"+t.getEncodedHex()})}}catch(p){}};if(f!==undefined){this.setPubKey(f)}};YAHOO.lang.extend(KJUR.asn1.x509.SubjectPublicKeyInfo,KJUR.asn1.ASN1Object);KJUR.asn1.x509.Time=function(f){KJUR.asn1.x509.Time.superclass.constructor.call(this);var e=null,a=null,d=KJUR,c=d.asn1,b=c.DERUTCTime,g=c.DERGeneralizedTime;this.setTimeParams=function(h){this.timeParams=h};this.getEncodedHex=function(){var h=null;if(this.timeParams!=null){if(this.type=="utc"){h=new b(this.timeParams)}else{h=new g(this.timeParams)}}else{if(this.type=="utc"){h=new b()}else{h=new g()}}this.TLV=h.getEncodedHex();return this.TLV};this.type="utc";if(f!==undefined){if(f.type!==undefined){this.type=f.type}else{if(f.str!==undefined){if(f.str.match(/^[0-9]{12}Z$/)){this.type="utc"}if(f.str.match(/^[0-9]{14}Z$/)){this.type="gen"}}}this.timeParams=f}};YAHOO.lang.extend(KJUR.asn1.x509.Time,KJUR.asn1.ASN1Object);KJUR.asn1.x509.AlgorithmIdentifier=function(d){KJUR.asn1.x509.AlgorithmIdentifier.superclass.constructor.call(this);this.nameAlg=null;this.asn1Alg=null;this.asn1Params=null;this.paramEmpty=false;var b=KJUR,a=b.asn1;this.getEncodedHex=function(){if(this.nameAlg===null&&this.asn1Alg===null){throw"algorithm not specified"}if(this.nameAlg!==null&&this.asn1Alg===null){this.asn1Alg=a.x509.OID.name2obj(this.nameAlg)}var e=[this.asn1Alg];if(this.asn1Params!==null){e.push(this.asn1Params)}var f=new a.DERSequence({array:e});this.hTLV=f.getEncodedHex();return this.hTLV};if(d!==undefined){if(d.name!==undefined){this.nameAlg=d.name}if(d.asn1params!==undefined){this.asn1Params=d.asn1params}if(d.paramempty!==undefined){this.paramEmpty=d.paramempty}}if(this.asn1Params===null&&this.paramEmpty===false&&this.nameAlg!==null){var c=this.nameAlg.toLowerCase();if(c.substr(-7,7)!=="withdsa"&&c.substr(-9,9)!=="withecdsa"){this.asn1Params=new a.DERNull()}}};YAHOO.lang.extend(KJUR.asn1.x509.AlgorithmIdentifier,KJUR.asn1.ASN1Object);KJUR.asn1.x509.GeneralName=function(e){KJUR.asn1.x509.GeneralName.superclass.constructor.call(this);var k=null,h=null,i={rfc822:"81",dns:"82",dn:"a4",uri:"86"},b=KJUR,f=b.asn1,d=f.DERIA5String,c=f.DERTaggedObject,j=f.ASN1Object,a=f.x509.X500Name,g=pemtohex;this.explicit=false;this.setByParam=function(r){var q=null;var n=null;if(r===undefined){return}if(r.rfc822!==undefined){this.type="rfc822";n=new d({str:r[this.type]})}if(r.dns!==undefined){this.type="dns";n=new d({str:r[this.type]})}if(r.uri!==undefined){this.type="uri";n=new d({str:r[this.type]})}if(r.dn!==undefined){this.type="dn";n=new a({str:r.dn})}if(r.ldapdn!==undefined){this.type="dn";n=new a({ldapstr:r.ldapdn})}if(r.certissuer!==undefined){this.type="dn";this.explicit=true;var o=r.certissuer;var m=null;if(o.match(/^[0-9A-Fa-f]+$/)){m==o}if(o.indexOf("-----BEGIN ")!=-1){m=g(o)}if(m==null){throw"certissuer param not cert"}var l=new X509();l.hex=m;var p=l.getIssuerHex();n=new j();n.hTLV=p}if(r.certsubj!==undefined){this.type="dn";this.explicit=true;var o=r.certsubj;var m=null;if(o.match(/^[0-9A-Fa-f]+$/)){m==o}if(o.indexOf("-----BEGIN ")!=-1){m=g(o)}if(m==null){throw"certsubj param not cert"}var l=new X509();l.hex=m;var p=l.getSubjectHex();n=new j();n.hTLV=p}if(this.type==null){throw"unsupported type in params="+r}this.asn1Obj=new c({explicit:this.explicit,tag:i[this.type],obj:n})};this.getEncodedHex=function(){return this.asn1Obj.getEncodedHex()};if(e!==undefined){this.setByParam(e)}};YAHOO.lang.extend(KJUR.asn1.x509.GeneralName,KJUR.asn1.ASN1Object);KJUR.asn1.x509.GeneralNames=function(d){KJUR.asn1.x509.GeneralNames.superclass.constructor.call(this);var a=null,c=KJUR,b=c.asn1;this.setByParamArray=function(g){for(var e=0;e0){r=new b({obj:this.dUnsignedAttrs,tag:"a1",explicit:false})}var q=[this.dCMSVersion,this.dSignerIdentifier,this.dDigestAlgorithm,o,this.dSigAlg,this.dSig,];if(r!=null){q.push(r)}var p=new h.DERSequence({array:q});this.hTLV=p.getEncodedHex();return this.hTLV}};YAHOO.lang.extend(KJUR.asn1.cms.SignerInfo,KJUR.asn1.ASN1Object);KJUR.asn1.cms.EncapsulatedContentInfo=function(g){var c=KJUR,b=c.asn1,e=b.DERTaggedObject,a=b.DERSequence,h=b.DERObjectIdentifier,d=b.DEROctetString,f=b.cms;f.EncapsulatedContentInfo.superclass.constructor.call(this);this.dEContentType=new h({name:"data"});this.dEContent=null;this.isDetached=false;this.eContentValueHex=null;this.setContentType=function(i){if(i.match(/^[0-2][.][0-9.]+$/)){this.dEContentType=new h({oid:i})}else{this.dEContentType=new h({name:i})}};this.setContentValue=function(i){if(i!==undefined){if(typeof i.hex=="string"){this.eContentValueHex=i.hex}else{if(typeof i.str=="string"){this.eContentValueHex=utf8tohex(i.str)}}}};this.setContentValueHex=function(i){this.eContentValueHex=i};this.setContentValueStr=function(i){this.eContentValueHex=utf8tohex(i)};this.getEncodedHex=function(){if(typeof this.eContentValueHex!="string"){throw"eContentValue not yet set"}var k=new d({hex:this.eContentValueHex});this.dEContent=new e({obj:k,tag:"a0",explicit:true});var i=[this.dEContentType];if(!this.isDetached){i.push(this.dEContent)}var j=new a({array:i});this.hTLV=j.getEncodedHex();return this.hTLV}};YAHOO.lang.extend(KJUR.asn1.cms.EncapsulatedContentInfo,KJUR.asn1.ASN1Object);KJUR.asn1.cms.ContentInfo=function(f){var c=KJUR,b=c.asn1,d=b.DERTaggedObject,a=b.DERSequence,e=b.x509;KJUR.asn1.cms.ContentInfo.superclass.constructor.call(this);this.dContentType=null;this.dContent=null;this.setContentType=function(g){if(typeof g=="string"){this.dContentType=e.OID.name2obj(g)}};this.getEncodedHex=function(){var h=new d({obj:this.dContent,tag:"a0",explicit:true});var g=new a({array:[this.dContentType,h]});this.hTLV=g.getEncodedHex();return this.hTLV};if(f!==undefined){if(f.type){this.setContentType(f.type)}if(f.obj&&f.obj instanceof b.ASN1Object){this.dContent=f.obj}}};YAHOO.lang.extend(KJUR.asn1.cms.ContentInfo,KJUR.asn1.ASN1Object);KJUR.asn1.cms.SignedData=function(e){var a=KJUR,h=a.asn1,j=h.ASN1Object,g=h.DERInteger,m=h.DERSet,f=h.DERSequence,b=h.DERTaggedObject,l=h.cms,i=l.EncapsulatedContentInfo,d=l.SignerInfo,n=l.ContentInfo,c=h.x509,k=c.AlgorithmIdentifier;KJUR.asn1.cms.SignedData.superclass.constructor.call(this);this.dCMSVersion=new g({"int":1});this.dDigestAlgs=null;this.digestAlgNameList=[];this.dEncapContentInfo=new i();this.dCerts=null;this.certificateList=[];this.crlList=[];this.signerInfoList=[new d()];this.addCertificatesByPEM=function(p){var q=pemtohex(p);var r=new j();r.hTLV=q;this.certificateList.push(r)};this.getEncodedHex=function(){if(typeof this.hTLV=="string"){return this.hTLV}if(this.dDigestAlgs==null){var u=[];for(var t=0;t0){var v=new m({array:this.certificateList});this.dCerts=new b({obj:v,tag:"a0",explicit:false})}}if(this.dCerts!=null){p.push(this.dCerts)}var r=new m({array:this.signerInfoList});p.push(r);var q=new f({array:p});this.hTLV=q.getEncodedHex();return this.hTLV};this.getContentInfo=function(){this.getEncodedHex();var o=new n({type:"signed-data",obj:this});return o};this.getContentInfoEncodedHex=function(){var o=this.getContentInfo();var p=o.getEncodedHex();return p};this.getPEM=function(){return hextopem(this.getContentInfoEncodedHex(),"CMS")}};YAHOO.lang.extend(KJUR.asn1.cms.SignedData,KJUR.asn1.ASN1Object);KJUR.asn1.cms.CMSUtil=new function(){};KJUR.asn1.cms.CMSUtil.newSignedData=function(d){var b=KJUR,j=b.asn1,q=j.cms,f=q.SignerInfo,n=q.SignedData,o=q.SigningTime,a=q.SigningCertificate,p=q.SigningCertificateV2,c=j.cades,e=c.SignaturePolicyIdentifier;var m=new n();m.dEncapContentInfo.setContentValue(d.content);if(typeof d.certs=="object"){for(var h=0;h0){var s=new f({array:this.extensionsArray});var r=new m({array:[s]});var q=new f({array:[new k({oid:"1.2.840.113549.1.9.14"}),r]});var p=new c({explicit:true,tag:"a0",obj:q});this.asn1Array.push(p)}else{var p=new c({explicit:false,tag:"a0",obj:new j()});this.asn1Array.push(p)}var t=new f({array:this.asn1Array});this.hTLV=t.getEncodedHex();this.isModified=false;return this.hTLV};this._initialize()};YAHOO.lang.extend(KJUR.asn1.csr.CertificationRequestInfo,KJUR.asn1.ASN1Object);KJUR.asn1.csr.CSRUtil=new function(){};KJUR.asn1.csr.CSRUtil.newCSRPEM=function(h){var c=KEYUTIL,b=KJUR.asn1.csr;if(h.subject===undefined){throw"parameter subject undefined"}if(h.sbjpubkey===undefined){throw"parameter sbjpubkey undefined"}if(h.sigalg===undefined){throw"parameter sigalg undefined"}if(h.sbjprvkey===undefined){throw"parameter sbjpubkey undefined"}var d=new b.CertificationRequestInfo();d.setSubjectByParam(h.subject);d.setSubjectPublicKeyByGetKey(h.sbjpubkey);if(h.ext!==undefined&&h.ext.length!==undefined){for(var e=0;e"7"){return"00"+a}return a}function intarystrtohex(b){b=b.replace(/^\s*\[\s*/,"");b=b.replace(/\s*\]\s*$/,"");b=b.replace(/\s*/g,"");try{var c=b.split(/,/).map(function(g,e,h){var f=parseInt(g);if(f<0||255a.length){d=a.length}for(var b=0;bd){throw"key is too short for SigAlg: keylen="+j+","+a}var b="0001";var k="00"+c;var g="";var l=d-b.length-k.length;for(var f=0;f=0;--p){q=q.twice2D();q.z=BigInteger.ONE;if(o.testBit(p)){if(n.testBit(p)){q=q.add2D(t)}else{q=q.add2D(s)}}else{if(n.testBit(p)){q=q.add2D(r)}}}return q}this.getBigRandom=function(i){return new BigInteger(i.bitLength(),a).mod(i.subtract(BigInteger.ONE)).add(BigInteger.ONE)};this.setNamedCurve=function(i){this.ecparams=KJUR.crypto.ECParameterDB.getByName(i);this.prvKeyHex=null;this.pubKeyHex=null;this.curveName=i};this.setPrivateKeyHex=function(i){this.isPrivate=true;this.prvKeyHex=i};this.setPublicKeyHex=function(i){this.isPublic=true;this.pubKeyHex=i};this.getPublicKeyXYHex=function(){var k=this.pubKeyHex;if(k.substr(0,2)!=="04"){throw"this method supports uncompressed format(04) only"}var j=this.ecparams.keylen/4;if(k.length!==2+j*2){throw"malformed public key hex length"}var i={};i.x=k.substr(2,j);i.y=k.substr(2+j);return i};this.getShortNISTPCurveName=function(){var i=this.curveName;if(i==="secp256r1"||i==="NIST P-256"||i==="P-256"||i==="prime256v1"){return"P-256"}if(i==="secp384r1"||i==="NIST P-384"||i==="P-384"){return"P-384"}return null};this.generateKeyPairHex=function(){var k=this.ecparams.n;var n=this.getBigRandom(k);var l=this.ecparams.G.multiply(n);var q=l.getX().toBigInteger();var o=l.getY().toBigInteger();var i=this.ecparams.keylen/4;var m=("0000000000"+n.toString(16)).slice(-i);var r=("0000000000"+q.toString(16)).slice(-i);var p=("0000000000"+o.toString(16)).slice(-i);var j="04"+r+p;this.setPrivateKeyHex(m);this.setPublicKeyHex(j);return{ecprvhex:m,ecpubhex:j}};this.signWithMessageHash=function(i){return this.signHex(i,this.prvKeyHex)};this.signHex=function(o,j){var t=new BigInteger(j,16);var l=this.ecparams.n;var q=new BigInteger(o,16);do{var m=this.getBigRandom(l);var u=this.ecparams.G;var p=u.multiply(m);var i=p.getX().toBigInteger().mod(l)}while(i.compareTo(BigInteger.ZERO)<=0);var v=m.modInverse(l).multiply(q.add(t.multiply(i))).mod(l);return KJUR.crypto.ECDSA.biRSSigToASN1Sig(i,v)};this.sign=function(m,u){var q=u;var j=this.ecparams.n;var p=BigInteger.fromByteArrayUnsigned(m);do{var l=this.getBigRandom(j);var t=this.ecparams.G;var o=t.multiply(l);var i=o.getX().toBigInteger().mod(j)}while(i.compareTo(BigInteger.ZERO)<=0);var v=l.modInverse(j).multiply(p.add(q.multiply(i))).mod(j);return this.serializeSig(i,v)};this.verifyWithMessageHash=function(j,i){return this.verifyHex(j,i,this.pubKeyHex)};this.verifyHex=function(m,i,p){var l,j;var o=KJUR.crypto.ECDSA.parseSigHex(i);l=o.r;j=o.s;var k;k=ECPointFp.decodeFromHex(this.ecparams.curve,p);var n=new BigInteger(m,16);return this.verifyRaw(n,l,j,k)};this.verify=function(o,p,j){var l,i;if(Bitcoin.Util.isArray(p)){var n=this.parseSig(p);l=n.r;i=n.s}else{if("object"===typeof p&&p.r&&p.s){l=p.r;i=p.s}else{throw"Invalid value for signature"}}var k;if(j instanceof ECPointFp){k=j}else{if(Bitcoin.Util.isArray(j)){k=ECPointFp.decodeFrom(this.ecparams.curve,j)}else{throw"Invalid format for pubkey value, must be byte array or ECPointFp"}}var m=BigInteger.fromByteArrayUnsigned(o);return this.verifyRaw(m,l,i,k)};this.verifyRaw=function(o,i,w,m){var l=this.ecparams.n;var u=this.ecparams.G;if(i.compareTo(BigInteger.ONE)<0||i.compareTo(l)>=0){return false}if(w.compareTo(BigInteger.ONE)<0||w.compareTo(l)>=0){return false}var p=w.modInverse(l);var k=o.multiply(p).mod(l);var j=i.multiply(p).mod(l);var q=u.multiply(k).add(m.multiply(j));var t=q.getX().toBigInteger().mod(l);return t.equals(i)};this.serializeSig=function(k,j){var l=k.toByteArraySigned();var i=j.toByteArraySigned();var m=[];m.push(2);m.push(l.length);m=m.concat(l);m.push(2);m.push(i.length);m=m.concat(i);m.unshift(m.length);m.unshift(48);return m};this.parseSig=function(n){var m;if(n[0]!=48){throw new Error("Signature not a valid DERSequence")}m=2;if(n[m]!=2){throw new Error("First element in signature must be a DERInteger")}var l=n.slice(m+2,m+2+n[m+1]);m+=2+n[m+1];if(n[m]!=2){throw new Error("Second element in signature must be a DERInteger")}var i=n.slice(m+2,m+2+n[m+1]);m+=2+n[m+1];var k=BigInteger.fromByteArrayUnsigned(l);var j=BigInteger.fromByteArrayUnsigned(i);return{r:k,s:j}};this.parseSigCompact=function(m){if(m.length!==65){throw"Signature has the wrong length"}var j=m[0]-27;if(j<0||j>7){throw"Invalid signature type"}var o=this.ecparams.n;var l=BigInteger.fromByteArrayUnsigned(m.slice(1,33)).mod(o);var k=BigInteger.fromByteArrayUnsigned(m.slice(33,65)).mod(o);return{r:l,s:k,i:j}};this.readPKCS5PrvKeyHex=function(l){var n=ASN1HEX;var m=KJUR.crypto.ECDSA.getName;var p=n.getVbyList;if(n.isASN1HEX(l)===false){throw"not ASN.1 hex string"}var i,k,o;try{i=p(l,0,[2,0],"06");k=p(l,0,[1],"04");try{o=p(l,0,[3,0],"03").substr(2)}catch(j){}}catch(j){throw"malformed PKCS#1/5 plain ECC private key"}this.curveName=m(i);if(this.curveName===undefined){throw"unsupported curve name"}this.setNamedCurve(this.curveName);this.setPublicKeyHex(o);this.setPrivateKeyHex(k);this.isPublic=false};this.readPKCS8PrvKeyHex=function(l){var q=ASN1HEX;var i=KJUR.crypto.ECDSA.getName;var n=q.getVbyList;if(q.isASN1HEX(l)===false){throw"not ASN.1 hex string"}var j,p,m,k;try{j=n(l,0,[1,0],"06");p=n(l,0,[1,1],"06");m=n(l,0,[2,0,1],"04");try{k=n(l,0,[2,0,2,0],"03").substr(2)}catch(o){}}catch(o){throw"malformed PKCS#8 plain ECC private key"}this.curveName=i(p);if(this.curveName===undefined){throw"unsupported curve name"}this.setNamedCurve(this.curveName);this.setPublicKeyHex(k);this.setPrivateKeyHex(m);this.isPublic=false};this.readPKCS8PubKeyHex=function(l){var n=ASN1HEX;var m=KJUR.crypto.ECDSA.getName;var p=n.getVbyList;if(n.isASN1HEX(l)===false){throw"not ASN.1 hex string"}var k,i,o;try{k=p(l,0,[0,0],"06");i=p(l,0,[0,1],"06");o=p(l,0,[1],"03").substr(2)}catch(j){throw"malformed PKCS#8 ECC public key"}this.curveName=m(i);if(this.curveName===null){throw"unsupported curve name"}this.setNamedCurve(this.curveName);this.setPublicKeyHex(o)};this.readCertPubKeyHex=function(k,p){if(p!==5){p=6}var m=ASN1HEX;var l=KJUR.crypto.ECDSA.getName;var o=m.getVbyList;if(m.isASN1HEX(k)===false){throw"not ASN.1 hex string"}var i,n;try{i=o(k,0,[0,p,0,1],"06");n=o(k,0,[0,p,1],"03").substr(2)}catch(j){throw"malformed X.509 certificate ECC public key"}this.curveName=l(i);if(this.curveName===null){throw"unsupported curve name"}this.setNamedCurve(this.curveName);this.setPublicKeyHex(n)};if(h!==undefined){if(h.curve!==undefined){this.curveName=h.curve}}if(this.curveName===undefined){this.curveName=e}this.setNamedCurve(this.curveName);if(h!==undefined){if(h.prv!==undefined){this.setPrivateKeyHex(h.prv)}if(h.pub!==undefined){this.setPublicKeyHex(h.pub)}}};KJUR.crypto.ECDSA.parseSigHex=function(a){var b=KJUR.crypto.ECDSA.parseSigHexInHexRS(a);var d=new BigInteger(b.r,16);var c=new BigInteger(b.s,16);return{r:d,s:c}};KJUR.crypto.ECDSA.parseSigHexInHexRS=function(f){var j=ASN1HEX;var i=j.getChildIdx;var g=j.getV;if(f.substr(0,2)!="30"){throw"signature is not a ASN.1 sequence"}var h=i(f,0);if(h.length!=2){throw"number of signature ASN.1 sequence elements seem wrong"}var e=h[0];var d=h[1];if(f.substr(e,2)!="02"){throw"1st item of sequene of signature is not ASN.1 integer"}if(f.substr(d,2)!="02"){throw"2nd item of sequene of signature is not ASN.1 integer"}var c=g(f,e);var b=g(f,d);return{r:c,s:b}};KJUR.crypto.ECDSA.asn1SigToConcatSig=function(c){var d=KJUR.crypto.ECDSA.parseSigHexInHexRS(c);var b=d.r;var a=d.s;if(b.substr(0,2)=="00"&&(((b.length/2)*8)%(16*8))==8){b=b.substr(2)}if(a.substr(0,2)=="00"&&(((a.length/2)*8)%(16*8))==8){a=a.substr(2)}if((((b.length/2)*8)%(16*8))!=0){throw"unknown ECDSA sig r length error"}if((((a.length/2)*8)%(16*8))!=0){throw"unknown ECDSA sig s length error"}return b+a};KJUR.crypto.ECDSA.concatSigToASN1Sig=function(a){if((((a.length/2)*8)%(16*8))!=0){throw"unknown ECDSA concatinated r-s sig length error"}var c=a.substr(0,a.length/2);var b=a.substr(a.length/2);return KJUR.crypto.ECDSA.hexRSSigToASN1Sig(c,b)};KJUR.crypto.ECDSA.hexRSSigToASN1Sig=function(b,a){var d=new BigInteger(b,16);var c=new BigInteger(a,16);return KJUR.crypto.ECDSA.biRSSigToASN1Sig(d,c)};KJUR.crypto.ECDSA.biRSSigToASN1Sig=function(f,d){var c=KJUR.asn1;var b=new c.DERInteger({bigint:f});var a=new c.DERInteger({bigint:d});var e=new c.DERSequence({array:[b,a]});return e.getEncodedHex()};KJUR.crypto.ECDSA.getName=function(a){if(a==="2a8648ce3d030107"){return"secp256r1"}if(a==="2b8104000a"){return"secp256k1"}if(a==="2b81040022"){return"secp384r1"}if("|secp256r1|NIST P-256|P-256|prime256v1|".indexOf(a)!==-1){return"secp256r1"}if("|secp256k1|".indexOf(a)!==-1){return"secp256k1"}if("|secp384r1|NIST P-384|P-384|".indexOf(a)!==-1){return"secp384r1"}return null}; -if(typeof KJUR=="undefined"||!KJUR){KJUR={}}if(typeof KJUR.crypto=="undefined"||!KJUR.crypto){KJUR.crypto={}}KJUR.crypto.ECParameterDB=new function(){var b={};var c={};function a(d){return new BigInteger(d,16)}this.getByName=function(e){var d=e;if(typeof c[d]!="undefined"){d=c[e]}if(typeof b[d]!="undefined"){return b[d]}throw"unregistered EC curve name: "+d};this.regist=function(A,l,o,g,m,e,j,f,k,u,d,x){b[A]={};var s=a(o);var z=a(g);var y=a(m);var t=a(e);var w=a(j);var r=new ECCurveFp(s,z,y);var q=r.decodePointHex("04"+f+k);b[A]["name"]=A;b[A]["keylen"]=l;b[A]["curve"]=r;b[A]["G"]=q;b[A]["n"]=t;b[A]["h"]=w;b[A]["oid"]=d;b[A]["info"]=x;for(var v=0;v1){g=new BigInteger(i,16)}else{g=null}h=new BigInteger(j,16);this.setPrivate(c,a,e,g,h)};this.setPublic=function(c,b,a,d){this.isPublic=true;this.p=c;this.q=b;this.g=a;this.y=d;this.x=null};this.setPublicHex=function(f,e,d,g){var b,a,h,c;b=new BigInteger(f,16);a=new BigInteger(e,16);h=new BigInteger(d,16);c=new BigInteger(g,16);this.setPublic(b,a,h,c)};this.signWithMessageHash=function(d){var c=this.p;var b=this.q;var f=this.g;var i=this.y;var j=this.x;var e=KJUR.crypto.Util.getRandomBigIntegerMinToMax(BigInteger.ONE.add(BigInteger.ONE),b.subtract(BigInteger.ONE));var l=d.substr(0,b.bitLength()/4);var h=new BigInteger(l,16);var a=(f.modPow(e,c)).mod(b);var n=(e.modInverse(b).multiply(h.add(j.multiply(a)))).mod(b);var m=KJUR.asn1.ASN1Util.jsonToASN1HEX({seq:[{"int":{bigint:a}},{"int":{bigint:n}}]});return m};this.verifyWithMessageHash=function(h,f){var d=this.p;var b=this.q;var j=this.g;var l=this.y;var i=this.parseASN1Signature(f);var a=i[0];var t=i[1];var o=h.substr(0,b.bitLength()/4);var k=new BigInteger(o,16);if(BigInteger.ZERO.compareTo(a)>0||a.compareTo(b)>0){throw"invalid DSA signature"}if(BigInteger.ZERO.compareTo(t)>=0||t.compareTo(b)>0){throw"invalid DSA signature"}var m=t.modInverse(b);var e=k.multiply(m).mod(b);var c=a.multiply(m).mod(b);var n=j.modPow(e,d).multiply(l.modPow(c,d)).mod(d).mod(b);return n.compareTo(a)==0};this.parseASN1Signature=function(a){try{var d=new BigInteger(ASN1HEX.getVbyList(a,0,[0],"02"),16);var c=new BigInteger(ASN1HEX.getVbyList(a,0,[1],"02"),16);return[d,c]}catch(b){throw"malformed ASN.1 DSA signature"}};this.readPKCS5PrvKeyHex=function(c){var b,a,f,g,i;var j=ASN1HEX;var d=j.getVbyList;if(j.isASN1HEX(c)===false){throw"not ASN.1 hex string"}try{b=d(c,0,[1],"02");a=d(c,0,[2],"02");f=d(c,0,[3],"02");g=d(c,0,[4],"02");i=d(c,0,[5],"02")}catch(e){console.log("EXCEPTION:"+e);throw"malformed PKCS#1/5 plain DSA private key"}this.setPrivateHex(b,a,f,g,i)};this.readPKCS8PrvKeyHex=function(d){var f,c,b,g;var e=ASN1HEX;var i=e.getVbyList;if(e.isASN1HEX(d)===false){throw"not ASN.1 hex string"}try{f=i(d,0,[1,1,0],"02");c=i(d,0,[1,1,1],"02");b=i(d,0,[1,1,2],"02");g=i(d,0,[2,0],"02")}catch(a){console.log("EXCEPTION:"+a);throw"malformed PKCS#8 plain DSA private key"}this.setPrivateHex(f,c,b,null,g)};this.readPKCS8PubKeyHex=function(d){var f,c,b,g;var e=ASN1HEX;var i=e.getVbyList;if(e.isASN1HEX(d)===false){throw"not ASN.1 hex string"}try{f=i(d,0,[0,1,0],"02");c=i(d,0,[0,1,1],"02");b=i(d,0,[0,1,2],"02");g=i(d,0,[1,0],"02")}catch(a){console.log("EXCEPTION:"+a);throw"malformed PKCS#8 DSA public key"}this.setPublicHex(f,c,b,g)};this.readCertPubKeyHex=function(c,f){if(f!==5){f=6}var b,a,g,i;var j=ASN1HEX;var d=j.getVbyList;if(j.isASN1HEX(c)===false){throw"not ASN.1 hex string"}try{b=d(c,0,[0,f,0,1,0],"02");a=d(c,0,[0,f,0,1,1],"02");g=d(c,0,[0,f,0,1,2],"02");i=d(c,0,[0,f,1,0],"02")}catch(e){console.log("EXCEPTION:"+e);throw"malformed X.509 certificate DSA public key"}this.setPublicHex(b,a,g,i)}}; -var KEYUTIL=function(){var d=function(p,r,q){return k(CryptoJS.AES,p,r,q)};var e=function(p,r,q){return k(CryptoJS.TripleDES,p,r,q)};var a=function(p,r,q){return k(CryptoJS.DES,p,r,q)};var k=function(s,x,u,q){var r=CryptoJS.enc.Hex.parse(x);var w=CryptoJS.enc.Hex.parse(u);var p=CryptoJS.enc.Hex.parse(q);var t={};t.key=w;t.iv=p;t.ciphertext=r;var v=s.decrypt(t,w,{iv:p});return CryptoJS.enc.Hex.stringify(v)};var l=function(p,r,q){return g(CryptoJS.AES,p,r,q)};var o=function(p,r,q){return g(CryptoJS.TripleDES,p,r,q)};var f=function(p,r,q){return g(CryptoJS.DES,p,r,q)};var g=function(t,y,v,q){var s=CryptoJS.enc.Hex.parse(y);var x=CryptoJS.enc.Hex.parse(v);var p=CryptoJS.enc.Hex.parse(q);var w=t.encrypt(s,x,{iv:p});var r=CryptoJS.enc.Hex.parse(w.toString());var u=CryptoJS.enc.Base64.stringify(r);return u};var i={"AES-256-CBC":{proc:d,eproc:l,keylen:32,ivlen:16},"AES-192-CBC":{proc:d,eproc:l,keylen:24,ivlen:16},"AES-128-CBC":{proc:d,eproc:l,keylen:16,ivlen:16},"DES-EDE3-CBC":{proc:e,eproc:o,keylen:24,ivlen:8},"DES-CBC":{proc:a,eproc:f,keylen:8,ivlen:8}};var c=function(p){return i[p]["proc"]};var m=function(p){var r=CryptoJS.lib.WordArray.random(p);var q=CryptoJS.enc.Hex.stringify(r);return q};var n=function(v){var w={};var q=v.match(new RegExp("DEK-Info: ([^,]+),([0-9A-Fa-f]+)","m"));if(q){w.cipher=q[1];w.ivsalt=q[2]}var p=v.match(new RegExp("-----BEGIN ([A-Z]+) PRIVATE KEY-----"));if(p){w.type=p[1]}var u=-1;var x=0;if(v.indexOf("\r\n\r\n")!=-1){u=v.indexOf("\r\n\r\n");x=2}if(v.indexOf("\n\n")!=-1){u=v.indexOf("\n\n");x=1}var t=v.indexOf("-----END");if(u!=-1&&t!=-1){var r=v.substring(u+x*2,t-x);r=r.replace(/\s+/g,"");w.data=r}return w};var j=function(q,y,p){var v=p.substring(0,16);var t=CryptoJS.enc.Hex.parse(v);var r=CryptoJS.enc.Utf8.parse(y);var u=i[q]["keylen"]+i[q]["ivlen"];var x="";var w=null;for(;;){var s=CryptoJS.algo.MD5.create();if(w!=null){s.update(w)}s.update(r);s.update(t);w=s.finalize();x=x+CryptoJS.enc.Hex.stringify(w);if(x.length>=u*2){break}}var z={};z.keyhex=x.substr(0,i[q]["keylen"]*2);z.ivhex=x.substr(i[q]["keylen"]*2,i[q]["ivlen"]*2);return z};var b=function(p,v,r,w){var s=CryptoJS.enc.Base64.parse(p);var q=CryptoJS.enc.Hex.stringify(s);var u=i[v]["proc"];var t=u(q,r,w);return t};var h=function(p,s,q,u){var r=i[s]["eproc"];var t=r(p,q,u);return t};return{version:"1.0.0",parsePKCS5PEM:function(p){return n(p)},getKeyAndUnusedIvByPasscodeAndIvsalt:function(q,p,r){return j(q,p,r)},decryptKeyB64:function(p,r,q,s){return b(p,r,q,s)},getDecryptedKeyHex:function(y,x){var q=n(y);var t=q.type;var r=q.cipher;var p=q.ivsalt;var s=q.data;var w=j(r,x,p);var v=w.keyhex;var u=b(s,r,v,p);return u},getEncryptedPKCS5PEMFromPrvKeyHex:function(x,s,A,t,r){var p="";if(typeof t=="undefined"||t==null){t="AES-256-CBC"}if(typeof i[t]=="undefined"){throw"KEYUTIL unsupported algorithm: "+t}if(typeof r=="undefined"||r==null){var v=i[t]["ivlen"];var u=m(v);r=u.toUpperCase()}var z=j(t,A,r);var y=z.keyhex;var w=h(s,t,y,r);var q=w.replace(/(.{64})/g,"$1\r\n");var p="-----BEGIN "+x+" PRIVATE KEY-----\r\n";p+="Proc-Type: 4,ENCRYPTED\r\n";p+="DEK-Info: "+t+","+r+"\r\n";p+="\r\n";p+=q;p+="\r\n-----END "+x+" PRIVATE KEY-----\r\n";return p},parseHexOfEncryptedPKCS8:function(y){var B=ASN1HEX;var z=B.getChildIdx;var w=B.getV;var t={};var r=z(y,0);if(r.length!=2){throw"malformed format: SEQUENCE(0).items != 2: "+r.length}t.ciphertext=w(y,r[1]);var A=z(y,r[0]);if(A.length!=2){throw"malformed format: SEQUENCE(0.0).items != 2: "+A.length}if(w(y,A[0])!="2a864886f70d01050d"){throw"this only supports pkcs5PBES2"}var p=z(y,A[1]);if(A.length!=2){throw"malformed format: SEQUENCE(0.0.1).items != 2: "+p.length}var q=z(y,p[1]);if(q.length!=2){throw"malformed format: SEQUENCE(0.0.1.1).items != 2: "+q.length}if(w(y,q[0])!="2a864886f70d0307"){throw"this only supports TripleDES"}t.encryptionSchemeAlg="TripleDES";t.encryptionSchemeIV=w(y,q[1]);var s=z(y,p[0]);if(s.length!=2){throw"malformed format: SEQUENCE(0.0.1.0).items != 2: "+s.length}if(w(y,s[0])!="2a864886f70d01050c"){throw"this only supports pkcs5PBKDF2"}var x=z(y,s[1]);if(x.length<2){throw"malformed format: SEQUENCE(0.0.1.0.1).items < 2: "+x.length}t.pbkdf2Salt=w(y,x[0]);var u=w(y,x[1]);try{t.pbkdf2Iter=parseInt(u,16)}catch(v){throw"malformed format pbkdf2Iter: "+u}return t},getPBKDF2KeyHexFromParam:function(u,p){var t=CryptoJS.enc.Hex.parse(u.pbkdf2Salt);var q=u.pbkdf2Iter;var s=CryptoJS.PBKDF2(p,t,{keySize:192/32,iterations:q});var r=CryptoJS.enc.Hex.stringify(s);return r},_getPlainPKCS8HexFromEncryptedPKCS8PEM:function(x,y){var r=pemtohex(x,"ENCRYPTED PRIVATE KEY");var p=this.parseHexOfEncryptedPKCS8(r);var u=KEYUTIL.getPBKDF2KeyHexFromParam(p,y);var v={};v.ciphertext=CryptoJS.enc.Hex.parse(p.ciphertext);var t=CryptoJS.enc.Hex.parse(u);var s=CryptoJS.enc.Hex.parse(p.encryptionSchemeIV);var w=CryptoJS.TripleDES.decrypt(v,t,{iv:s});var q=CryptoJS.enc.Hex.stringify(w);return q},getKeyFromEncryptedPKCS8PEM:function(s,q){var p=this._getPlainPKCS8HexFromEncryptedPKCS8PEM(s,q);var r=this.getKeyFromPlainPrivatePKCS8Hex(p);return r},parsePlainPrivatePKCS8Hex:function(s){var v=ASN1HEX;var u=v.getChildIdx;var t=v.getV;var q={};q.algparam=null;if(s.substr(0,2)!="30"){throw"malformed plain PKCS8 private key(code:001)"}var r=u(s,0);if(r.length!=3){throw"malformed plain PKCS8 private key(code:002)"}if(s.substr(r[1],2)!="30"){throw"malformed PKCS8 private key(code:003)"}var p=u(s,r[1]);if(p.length!=2){throw"malformed PKCS8 private key(code:004)"}if(s.substr(p[0],2)!="06"){throw"malformed PKCS8 private key(code:005)"}q.algoid=t(s,p[0]);if(s.substr(p[1],2)=="06"){q.algparam=t(s,p[1])}if(s.substr(r[2],2)!="04"){throw"malformed PKCS8 private key(code:006)"}q.keyidx=v.getVidx(s,r[2]);return q},getKeyFromPlainPrivatePKCS8PEM:function(q){var p=pemtohex(q,"PRIVATE KEY");var r=this.getKeyFromPlainPrivatePKCS8Hex(p);return r},getKeyFromPlainPrivatePKCS8Hex:function(p){var q=this.parsePlainPrivatePKCS8Hex(p);var r;if(q.algoid=="2a864886f70d010101"){r=new RSAKey()}else{if(q.algoid=="2a8648ce380401"){r=new KJUR.crypto.DSA()}else{if(q.algoid=="2a8648ce3d0201"){r=new KJUR.crypto.ECDSA()}else{throw"unsupported private key algorithm"}}}r.readPKCS8PrvKeyHex(p);return r},_getKeyFromPublicPKCS8Hex:function(q){var p;var r=ASN1HEX.getVbyList(q,0,[0,0],"06");if(r==="2a864886f70d010101"){p=new RSAKey()}else{if(r==="2a8648ce380401"){p=new KJUR.crypto.DSA()}else{if(r==="2a8648ce3d0201"){p=new KJUR.crypto.ECDSA()}else{throw"unsupported PKCS#8 public key hex"}}}p.readPKCS8PubKeyHex(q);return p},parsePublicRawRSAKeyHex:function(r){var u=ASN1HEX;var t=u.getChildIdx;var s=u.getV;var p={};if(r.substr(0,2)!="30"){throw"malformed RSA key(code:001)"}var q=t(r,0);if(q.length!=2){throw"malformed RSA key(code:002)"}if(r.substr(q[0],2)!="02"){throw"malformed RSA key(code:003)"}p.n=s(r,q[0]);if(r.substr(q[1],2)!="02"){throw"malformed RSA key(code:004)"}p.e=s(r,q[1]);return p},parsePublicPKCS8Hex:function(t){var v=ASN1HEX;var u=v.getChildIdx;var s=v.getV;var q={};q.algparam=null;var r=u(t,0);if(r.length!=2){throw"outer DERSequence shall have 2 elements: "+r.length}var w=r[0];if(t.substr(w,2)!="30"){throw"malformed PKCS8 public key(code:001)"}var p=u(t,w);if(p.length!=2){throw"malformed PKCS8 public key(code:002)"}if(t.substr(p[0],2)!="06"){throw"malformed PKCS8 public key(code:003)"}q.algoid=s(t,p[0]);if(t.substr(p[1],2)=="06"){q.algparam=s(t,p[1])}else{if(t.substr(p[1],2)=="30"){q.algparam={};q.algparam.p=v.getVbyList(t,p[1],[0],"02");q.algparam.q=v.getVbyList(t,p[1],[1],"02");q.algparam.g=v.getVbyList(t,p[1],[2],"02")}}if(t.substr(r[1],2)!="03"){throw"malformed PKCS8 public key(code:004)"}q.key=s(t,r[1]).substr(2);return q},}}();KEYUTIL.getKey=function(l,k,n){var G=ASN1HEX,L=G.getChildIdx,v=G.getV,d=G.getVbyList,c=KJUR.crypto,i=c.ECDSA,C=c.DSA,w=RSAKey,M=pemtohex,F=KEYUTIL;if(typeof w!="undefined"&&l instanceof w){return l}if(typeof i!="undefined"&&l instanceof i){return l}if(typeof C!="undefined"&&l instanceof C){return l}if(l.curve!==undefined&&l.xy!==undefined&&l.d===undefined){return new i({pub:l.xy,curve:l.curve})}if(l.curve!==undefined&&l.d!==undefined){return new i({prv:l.d,curve:l.curve})}if(l.kty===undefined&&l.n!==undefined&&l.e!==undefined&&l.d===undefined){var P=new w();P.setPublic(l.n,l.e);return P}if(l.kty===undefined&&l.n!==undefined&&l.e!==undefined&&l.d!==undefined&&l.p!==undefined&&l.q!==undefined&&l.dp!==undefined&&l.dq!==undefined&&l.co!==undefined&&l.qi===undefined){var P=new w();P.setPrivateEx(l.n,l.e,l.d,l.p,l.q,l.dp,l.dq,l.co);return P}if(l.kty===undefined&&l.n!==undefined&&l.e!==undefined&&l.d!==undefined&&l.p===undefined){var P=new w();P.setPrivate(l.n,l.e,l.d);return P}if(l.p!==undefined&&l.q!==undefined&&l.g!==undefined&&l.y!==undefined&&l.x===undefined){var P=new C();P.setPublic(l.p,l.q,l.g,l.y);return P}if(l.p!==undefined&&l.q!==undefined&&l.g!==undefined&&l.y!==undefined&&l.x!==undefined){var P=new C();P.setPrivate(l.p,l.q,l.g,l.y,l.x);return P}if(l.kty==="RSA"&&l.n!==undefined&&l.e!==undefined&&l.d===undefined){var P=new w();P.setPublic(b64utohex(l.n),b64utohex(l.e));return P}if(l.kty==="RSA"&&l.n!==undefined&&l.e!==undefined&&l.d!==undefined&&l.p!==undefined&&l.q!==undefined&&l.dp!==undefined&&l.dq!==undefined&&l.qi!==undefined){var P=new w();P.setPrivateEx(b64utohex(l.n),b64utohex(l.e),b64utohex(l.d),b64utohex(l.p),b64utohex(l.q),b64utohex(l.dp),b64utohex(l.dq),b64utohex(l.qi));return P}if(l.kty==="RSA"&&l.n!==undefined&&l.e!==undefined&&l.d!==undefined){var P=new w();P.setPrivate(b64utohex(l.n),b64utohex(l.e),b64utohex(l.d));return P}if(l.kty==="EC"&&l.crv!==undefined&&l.x!==undefined&&l.y!==undefined&&l.d===undefined){var j=new i({curve:l.crv});var t=j.ecparams.keylen/4;var B=("0000000000"+b64utohex(l.x)).slice(-t);var z=("0000000000"+b64utohex(l.y)).slice(-t);var u="04"+B+z;j.setPublicKeyHex(u);return j}if(l.kty==="EC"&&l.crv!==undefined&&l.x!==undefined&&l.y!==undefined&&l.d!==undefined){var j=new i({curve:l.crv});var t=j.ecparams.keylen/4;var B=("0000000000"+b64utohex(l.x)).slice(-t);var z=("0000000000"+b64utohex(l.y)).slice(-t);var u="04"+B+z;var b=("0000000000"+b64utohex(l.d)).slice(-t);j.setPublicKeyHex(u);j.setPrivateKeyHex(b);return j}if(n==="pkcs5prv"){var J=l,G=ASN1HEX,N,P;N=L(J,0);if(N.length===9){P=new w();P.readPKCS5PrvKeyHex(J)}else{if(N.length===6){P=new C();P.readPKCS5PrvKeyHex(J)}else{if(N.length>2&&J.substr(N[1],2)==="04"){P=new i();P.readPKCS5PrvKeyHex(J)}else{throw"unsupported PKCS#1/5 hexadecimal key"}}}return P}if(n==="pkcs8prv"){var P=F.getKeyFromPlainPrivatePKCS8Hex(l);return P}if(n==="pkcs8pub"){return F._getKeyFromPublicPKCS8Hex(l)}if(n==="x509pub"){return X509.getPublicKeyFromCertHex(l)}if(l.indexOf("-END CERTIFICATE-",0)!=-1||l.indexOf("-END X509 CERTIFICATE-",0)!=-1||l.indexOf("-END TRUSTED CERTIFICATE-",0)!=-1){return X509.getPublicKeyFromCertPEM(l)}if(l.indexOf("-END PUBLIC KEY-")!=-1){var O=pemtohex(l,"PUBLIC KEY");return F._getKeyFromPublicPKCS8Hex(O)}if(l.indexOf("-END RSA PRIVATE KEY-")!=-1&&l.indexOf("4,ENCRYPTED")==-1){var m=M(l,"RSA PRIVATE KEY");return F.getKey(m,null,"pkcs5prv")}if(l.indexOf("-END DSA PRIVATE KEY-")!=-1&&l.indexOf("4,ENCRYPTED")==-1){var I=M(l,"DSA PRIVATE KEY");var E=d(I,0,[1],"02");var D=d(I,0,[2],"02");var K=d(I,0,[3],"02");var r=d(I,0,[4],"02");var s=d(I,0,[5],"02");var P=new C();P.setPrivate(new BigInteger(E,16),new BigInteger(D,16),new BigInteger(K,16),new BigInteger(r,16),new BigInteger(s,16));return P}if(l.indexOf("-END PRIVATE KEY-")!=-1){return F.getKeyFromPlainPrivatePKCS8PEM(l)}if(l.indexOf("-END RSA PRIVATE KEY-")!=-1&&l.indexOf("4,ENCRYPTED")!=-1){var o=F.getDecryptedKeyHex(l,k);var H=new RSAKey();H.readPKCS5PrvKeyHex(o);return H}if(l.indexOf("-END EC PRIVATE KEY-")!=-1&&l.indexOf("4,ENCRYPTED")!=-1){var I=F.getDecryptedKeyHex(l,k);var P=d(I,0,[1],"04");var f=d(I,0,[2,0],"06");var A=d(I,0,[3,0],"03").substr(2);var e="";if(KJUR.crypto.OID.oidhex2name[f]!==undefined){e=KJUR.crypto.OID.oidhex2name[f]}else{throw"undefined OID(hex) in KJUR.crypto.OID: "+f}var j=new i({curve:e});j.setPublicKeyHex(A);j.setPrivateKeyHex(P);j.isPublic=false;return j}if(l.indexOf("-END DSA PRIVATE KEY-")!=-1&&l.indexOf("4,ENCRYPTED")!=-1){var I=F.getDecryptedKeyHex(l,k);var E=d(I,0,[1],"02");var D=d(I,0,[2],"02");var K=d(I,0,[3],"02");var r=d(I,0,[4],"02");var s=d(I,0,[5],"02");var P=new C();P.setPrivate(new BigInteger(E,16),new BigInteger(D,16),new BigInteger(K,16),new BigInteger(r,16),new BigInteger(s,16));return P}if(l.indexOf("-END ENCRYPTED PRIVATE KEY-")!=-1){return F.getKeyFromEncryptedPKCS8PEM(l,k)}throw"not supported argument"};KEYUTIL.generateKeypair=function(a,c){if(a=="RSA"){var b=c;var h=new RSAKey();h.generate(b,"10001");h.isPrivate=true;h.isPublic=true;var f=new RSAKey();var e=h.n.toString(16);var i=h.e.toString(16);f.setPublic(e,i);f.isPrivate=false;f.isPublic=true;var k={};k.prvKeyObj=h;k.pubKeyObj=f;return k}else{if(a=="EC"){var d=c;var g=new KJUR.crypto.ECDSA({curve:d});var j=g.generateKeyPairHex();var h=new KJUR.crypto.ECDSA({curve:d});h.setPublicKeyHex(j.ecpubhex);h.setPrivateKeyHex(j.ecprvhex);h.isPrivate=true;h.isPublic=false;var f=new KJUR.crypto.ECDSA({curve:d});f.setPublicKeyHex(j.ecpubhex);f.isPrivate=false;f.isPublic=true;var k={};k.prvKeyObj=h;k.pubKeyObj=f;return k}else{throw"unknown algorithm: "+a}}};KEYUTIL.getPEM=function(b,D,y,m,q,j){var F=KJUR,k=F.asn1,z=k.DERObjectIdentifier,f=k.DERInteger,l=k.ASN1Util.newObject,a=k.x509,C=a.SubjectPublicKeyInfo,e=F.crypto,u=e.DSA,r=e.ECDSA,n=RSAKey;function A(s){var G=l({seq:[{"int":0},{"int":{bigint:s.n}},{"int":s.e},{"int":{bigint:s.d}},{"int":{bigint:s.p}},{"int":{bigint:s.q}},{"int":{bigint:s.dmp1}},{"int":{bigint:s.dmq1}},{"int":{bigint:s.coeff}}]});return G}function B(G){var s=l({seq:[{"int":1},{octstr:{hex:G.prvKeyHex}},{tag:["a0",true,{oid:{name:G.curveName}}]},{tag:["a1",true,{bitstr:{hex:"00"+G.pubKeyHex}}]}]});return s}function x(s){var G=l({seq:[{"int":0},{"int":{bigint:s.p}},{"int":{bigint:s.q}},{"int":{bigint:s.g}},{"int":{bigint:s.y}},{"int":{bigint:s.x}}]});return G}if(((n!==undefined&&b instanceof n)||(u!==undefined&&b instanceof u)||(r!==undefined&&b instanceof r))&&b.isPublic==true&&(D===undefined||D=="PKCS8PUB")){var E=new C(b);var w=E.getEncodedHex();return hextopem(w,"PUBLIC KEY")}if(D=="PKCS1PRV"&&n!==undefined&&b instanceof n&&(y===undefined||y==null)&&b.isPrivate==true){var E=A(b);var w=E.getEncodedHex();return hextopem(w,"RSA PRIVATE KEY")}if(D=="PKCS1PRV"&&r!==undefined&&b instanceof r&&(y===undefined||y==null)&&b.isPrivate==true){var i=new z({name:b.curveName});var v=i.getEncodedHex();var h=B(b);var t=h.getEncodedHex();var p="";p+=hextopem(v,"EC PARAMETERS");p+=hextopem(t,"EC PRIVATE KEY");return p}if(D=="PKCS1PRV"&&u!==undefined&&b instanceof u&&(y===undefined||y==null)&&b.isPrivate==true){var E=x(b);var w=E.getEncodedHex();return hextopem(w,"DSA PRIVATE KEY")}if(D=="PKCS5PRV"&&n!==undefined&&b instanceof n&&(y!==undefined&&y!=null)&&b.isPrivate==true){var E=A(b);var w=E.getEncodedHex();if(m===undefined){m="DES-EDE3-CBC"}return this.getEncryptedPKCS5PEMFromPrvKeyHex("RSA",w,y,m,j)}if(D=="PKCS5PRV"&&r!==undefined&&b instanceof r&&(y!==undefined&&y!=null)&&b.isPrivate==true){var E=B(b);var w=E.getEncodedHex();if(m===undefined){m="DES-EDE3-CBC"}return this.getEncryptedPKCS5PEMFromPrvKeyHex("EC",w,y,m,j)}if(D=="PKCS5PRV"&&u!==undefined&&b instanceof u&&(y!==undefined&&y!=null)&&b.isPrivate==true){var E=x(b);var w=E.getEncodedHex();if(m===undefined){m="DES-EDE3-CBC"}return this.getEncryptedPKCS5PEMFromPrvKeyHex("DSA",w,y,m,j)}var o=function(G,s){var I=c(G,s);var H=new l({seq:[{seq:[{oid:{name:"pkcs5PBES2"}},{seq:[{seq:[{oid:{name:"pkcs5PBKDF2"}},{seq:[{octstr:{hex:I.pbkdf2Salt}},{"int":I.pbkdf2Iter}]}]},{seq:[{oid:{name:"des-EDE3-CBC"}},{octstr:{hex:I.encryptionSchemeIV}}]}]}]},{octstr:{hex:I.ciphertext}}]});return H.getEncodedHex()};var c=function(N,O){var H=100;var M=CryptoJS.lib.WordArray.random(8);var L="DES-EDE3-CBC";var s=CryptoJS.lib.WordArray.random(8);var I=CryptoJS.PBKDF2(O,M,{keySize:192/32,iterations:H});var J=CryptoJS.enc.Hex.parse(N);var K=CryptoJS.TripleDES.encrypt(J,I,{iv:s})+"";var G={};G.ciphertext=K;G.pbkdf2Salt=CryptoJS.enc.Hex.stringify(M);G.pbkdf2Iter=H;G.encryptionSchemeAlg=L;G.encryptionSchemeIV=CryptoJS.enc.Hex.stringify(s);return G};if(D=="PKCS8PRV"&&n!=undefined&&b instanceof n&&b.isPrivate==true){var g=A(b);var d=g.getEncodedHex();var E=l({seq:[{"int":0},{seq:[{oid:{name:"rsaEncryption"}},{"null":true}]},{octstr:{hex:d}}]});var w=E.getEncodedHex();if(y===undefined||y==null){return hextopem(w,"PRIVATE KEY")}else{var t=o(w,y);return hextopem(t,"ENCRYPTED PRIVATE KEY")}}if(D=="PKCS8PRV"&&r!==undefined&&b instanceof r&&b.isPrivate==true){var g=new l({seq:[{"int":1},{octstr:{hex:b.prvKeyHex}},{tag:["a1",true,{bitstr:{hex:"00"+b.pubKeyHex}}]}]});var d=g.getEncodedHex();var E=l({seq:[{"int":0},{seq:[{oid:{name:"ecPublicKey"}},{oid:{name:b.curveName}}]},{octstr:{hex:d}}]});var w=E.getEncodedHex();if(y===undefined||y==null){return hextopem(w,"PRIVATE KEY")}else{var t=o(w,y);return hextopem(t,"ENCRYPTED PRIVATE KEY")}}if(D=="PKCS8PRV"&&u!==undefined&&b instanceof u&&b.isPrivate==true){var g=new f({bigint:b.x});var d=g.getEncodedHex();var E=l({seq:[{"int":0},{seq:[{oid:{name:"dsa"}},{seq:[{"int":{bigint:b.p}},{"int":{bigint:b.q}},{"int":{bigint:b.g}}]}]},{octstr:{hex:d}}]});var w=E.getEncodedHex();if(y===undefined||y==null){return hextopem(w,"PRIVATE KEY")}else{var t=o(w,y);return hextopem(t,"ENCRYPTED PRIVATE KEY")}}throw"unsupported object nor format"};KEYUTIL.getKeyFromCSRPEM=function(b){var a=pemtohex(b,"CERTIFICATE REQUEST");var c=KEYUTIL.getKeyFromCSRHex(a);return c};KEYUTIL.getKeyFromCSRHex=function(a){var c=KEYUTIL.parseCSRHex(a);var b=KEYUTIL.getKey(c.p8pubkeyhex,null,"pkcs8pub");return b};KEYUTIL.parseCSRHex=function(d){var i=ASN1HEX;var f=i.getChildIdx;var c=i.getTLV;var b={};var g=d;if(g.substr(0,2)!="30"){throw"malformed CSR(code:001)"}var e=f(g,0);if(e.length<1){throw"malformed CSR(code:002)"}if(g.substr(e[0],2)!="30"){throw"malformed CSR(code:003)"}var a=f(g,e[0]);if(a.length<3){throw"malformed CSR(code:004)"}b.p8pubkeyhex=c(g,a[2]);return b};KEYUTIL.getJWKFromKey=function(d){var b={};if(d instanceof RSAKey&&d.isPrivate){b.kty="RSA";b.n=hextob64u(d.n.toString(16));b.e=hextob64u(d.e.toString(16));b.d=hextob64u(d.d.toString(16));b.p=hextob64u(d.p.toString(16));b.q=hextob64u(d.q.toString(16));b.dp=hextob64u(d.dmp1.toString(16));b.dq=hextob64u(d.dmq1.toString(16));b.qi=hextob64u(d.coeff.toString(16));return b}else{if(d instanceof RSAKey&&d.isPublic){b.kty="RSA";b.n=hextob64u(d.n.toString(16));b.e=hextob64u(d.e.toString(16));return b}else{if(d instanceof KJUR.crypto.ECDSA&&d.isPrivate){var a=d.getShortNISTPCurveName();if(a!=="P-256"&&a!=="P-384"){throw"unsupported curve name for JWT: "+a}var c=d.getPublicKeyXYHex();b.kty="EC";b.crv=a;b.x=hextob64u(c.x);b.y=hextob64u(c.y);b.d=hextob64u(d.prvKeyHex);return b}else{if(d instanceof KJUR.crypto.ECDSA&&d.isPublic){var a=d.getShortNISTPCurveName();if(a!=="P-256"&&a!=="P-384"){throw"unsupported curve name for JWT: "+a}var c=d.getPublicKeyXYHex();b.kty="EC";b.crv=a;b.x=hextob64u(c.x);b.y=hextob64u(c.y);return b}}}}throw"not supported key object"}; -RSAKey.getPosArrayOfChildrenFromHex=function(a){return ASN1HEX.getChildIdx(a,0)};RSAKey.getHexValueArrayOfChildrenFromHex=function(f){var n=ASN1HEX;var i=n.getV;var k=RSAKey.getPosArrayOfChildrenFromHex(f);var e=i(f,k[0]);var j=i(f,k[1]);var b=i(f,k[2]);var c=i(f,k[3]);var h=i(f,k[4]);var g=i(f,k[5]);var m=i(f,k[6]);var l=i(f,k[7]);var d=i(f,k[8]);var k=new Array();k.push(e,j,b,c,h,g,m,l,d);return k};RSAKey.prototype.readPrivateKeyFromPEMString=function(d){var c=pemtohex(d);var b=RSAKey.getHexValueArrayOfChildrenFromHex(c);this.setPrivateEx(b[1],b[2],b[3],b[4],b[5],b[6],b[7],b[8])};RSAKey.prototype.readPKCS5PrvKeyHex=function(c){var b=RSAKey.getHexValueArrayOfChildrenFromHex(c);this.setPrivateEx(b[1],b[2],b[3],b[4],b[5],b[6],b[7],b[8])};RSAKey.prototype.readPKCS8PrvKeyHex=function(e){var c,j,l,b,a,f,d,k;var m=ASN1HEX;var g=m.getVbyList;if(m.isASN1HEX(e)===false){throw"not ASN.1 hex string"}try{c=g(e,0,[2,0,1],"02");j=g(e,0,[2,0,2],"02");l=g(e,0,[2,0,3],"02");b=g(e,0,[2,0,4],"02");a=g(e,0,[2,0,5],"02");f=g(e,0,[2,0,6],"02");d=g(e,0,[2,0,7],"02");k=g(e,0,[2,0,8],"02")}catch(i){throw"malformed PKCS#8 plain RSA private key"}this.setPrivateEx(c,j,l,b,a,f,d,k)};RSAKey.prototype.readPKCS5PubKeyHex=function(c){var e=ASN1HEX;var b=e.getV;if(e.isASN1HEX(c)===false){throw"keyHex is not ASN.1 hex string"}var a=e.getChildIdx(c,0);if(a.length!==2||c.substr(a[0],2)!=="02"||c.substr(a[1],2)!=="02"){throw"wrong hex for PKCS#5 public key"}var f=b(c,a[0]);var d=b(c,a[1]);this.setPublic(f,d)};RSAKey.prototype.readPKCS8PubKeyHex=function(b){var c=ASN1HEX;if(c.isASN1HEX(b)===false){throw"not ASN.1 hex string"}if(c.getTLVbyList(b,0,[0,0])!=="06092a864886f70d010101"){throw"not PKCS8 RSA public key"}var a=c.getTLVbyList(b,0,[1,0]);this.readPKCS5PubKeyHex(a)};RSAKey.prototype.readCertPubKeyHex=function(b,d){var a,c;a=new X509();a.readCertHex(b);c=a.getPublicKeyHex();this.readPKCS8PubKeyHex(c)}; -var _RE_HEXDECONLY=new RegExp("");_RE_HEXDECONLY.compile("[^0-9a-f]","gi");function _rsasign_getHexPaddedDigestInfoForString(d,e,a){var b=function(f){return KJUR.crypto.Util.hashString(f,a)};var c=b(d);return KJUR.crypto.Util.getPaddedDigestInfoHex(c,a,e)}function _zeroPaddingOfSignature(e,d){var c="";var a=d/4-e.length;for(var b=0;b>24,(d&16711680)>>16,(d&65280)>>8,d&255]))));d+=1}return b}RSAKey.prototype.signPSS=function(e,a,d){var c=function(f){return KJUR.crypto.Util.hashHex(f,a)};var b=c(rstrtohex(e));if(d===undefined){d=-1}return this.signWithMessageHashPSS(b,a,d)};RSAKey.prototype.signWithMessageHashPSS=function(l,a,k){var b=hextorstr(l);var g=b.length;var m=this.n.bitLength()-1;var c=Math.ceil(m/8);var d;var o=function(i){return KJUR.crypto.Util.hashHex(i,a)};if(k===-1||k===undefined){k=g}else{if(k===-2){k=c-g-2}else{if(k<-2){throw"invalid salt length"}}}if(c<(g+k+2)){throw"data too long"}var f="";if(k>0){f=new Array(k);new SecureRandom().nextBytes(f);f=String.fromCharCode.apply(String,f)}var n=hextorstr(o(rstrtohex("\x00\x00\x00\x00\x00\x00\x00\x00"+b+f)));var j=[];for(d=0;d>(8*c-m))&255;q[0]&=~p;for(d=0;dthis.n.bitLength()){return 0}var i=this.doPublic(b);var e=i.toString(16).replace(/^1f+00/,"");var g=_rsasign_getAlgNameAndHashFromHexDisgestInfo(e);if(g.length==0){return false}var d=g[0];var h=g[1];var a=function(k){return KJUR.crypto.Util.hashString(k,d)};var c=a(f);return(h==c)};RSAKey.prototype.verifyWithMessageHash=function(e,a){a=a.replace(_RE_HEXDECONLY,"");a=a.replace(/[ \n]+/g,"");var b=parseBigInt(a,16);if(b.bitLength()>this.n.bitLength()){return 0}var h=this.doPublic(b);var g=h.toString(16).replace(/^1f+00/,"");var c=_rsasign_getAlgNameAndHashFromHexDisgestInfo(g);if(c.length==0){return false}var d=c[0];var f=c[1];return(f==e)};RSAKey.prototype.verifyPSS=function(c,b,a,f){var e=function(g){return KJUR.crypto.Util.hashHex(g,a)};var d=e(rstrtohex(c));if(f===undefined){f=-1}return this.verifyWithMessageHashPSS(d,b,a,f)};RSAKey.prototype.verifyWithMessageHashPSS=function(f,s,l,c){var k=new BigInteger(s,16);if(k.bitLength()>this.n.bitLength()){return false}var r=function(i){return KJUR.crypto.Util.hashHex(i,l)};var j=hextorstr(f);var h=j.length;var g=this.n.bitLength()-1;var m=Math.ceil(g/8);var q;if(c===-1||c===undefined){c=h}else{if(c===-2){c=m-h-2}else{if(c<-2){throw"invalid salt length"}}}if(m<(h+c+2)){throw"data too long"}var a=this.doPublic(k).toByteArray();for(q=0;q>(8*m-g))&255;if((d.charCodeAt(0)&p)!==0){throw"bits beyond keysize not zero"}var n=pss_mgf1_str(e,d.length,r);var o=[];for(q=0;q0){var b=":"+n.join(":")+":";if(b.indexOf(":"+k+":")==-1){throw"algorithm '"+k+"' not accepted in the list"}}if(k!="none"&&B===null){throw"key shall be specified to verify."}if(typeof B=="string"&&B.indexOf("-----BEGIN ")!=-1){B=KEYUTIL.getKey(B)}if(z=="RS"||z=="PS"){if(!(B instanceof m)){throw"key shall be a RSAKey obj for RS* and PS* algs"}}if(z=="ES"){if(!(B instanceof p)){throw"key shall be a ECDSA obj for ES* algs"}}if(k=="none"){}var u=null;if(t.jwsalg2sigalg[l.alg]===undefined){throw"unsupported alg name: "+k}else{u=t.jwsalg2sigalg[k]}if(u=="none"){throw"not supported"}else{if(u.substr(0,4)=="Hmac"){var o=null;if(B===undefined){throw"hexadecimal key shall be specified for HMAC"}var j=new s({alg:u,pass:B});j.updateString(c);o=j.doFinal();return A==o}else{if(u.indexOf("withECDSA")!=-1){var h=null;try{h=p.concatSigToASN1Sig(A)}catch(v){return false}var g=new d({alg:u});g.init(B);g.updateString(c);return g.verify(h)}else{var g=new d({alg:u});g.init(B);g.updateString(c);return g.verify(A)}}}};KJUR.jws.JWS.parse=function(g){var c=g.split(".");var b={};var f,e,d;if(c.length!=2&&c.length!=3){throw"malformed sJWS: wrong number of '.' splitted elements"}f=c[0];e=c[1];if(c.length==3){d=c[2]}b.headerObj=KJUR.jws.JWS.readSafeJSONString(b64utoutf8(f));b.payloadObj=KJUR.jws.JWS.readSafeJSONString(b64utoutf8(e));b.headerPP=JSON.stringify(b.headerObj,null," ");if(b.payloadObj==null){b.payloadPP=b64utoutf8(e)}else{b.payloadPP=JSON.stringify(b.payloadObj,null," ")}if(d!==undefined){b.sigHex=b64utohex(d)}return b};KJUR.jws.JWS.verifyJWT=function(e,l,r){var d=KJUR,j=d.jws,o=j.JWS,n=o.readSafeJSONString,p=o.inArray,f=o.includedArray;var k=e.split(".");var c=k[0];var i=k[1];var q=c+"."+i;var m=b64utohex(k[2]);var h=n(b64utoutf8(c));var g=n(b64utoutf8(i));if(h.alg===undefined){return false}if(r.alg===undefined){throw"acceptField.alg shall be specified"}if(!p(h.alg,r.alg)){return false}if(g.iss!==undefined&&typeof r.iss==="object"){if(!p(g.iss,r.iss)){return false}}if(g.sub!==undefined&&typeof r.sub==="object"){if(!p(g.sub,r.sub)){return false}}if(g.aud!==undefined&&typeof r.aud==="object"){if(typeof g.aud=="string"){if(!p(g.aud,r.aud)){return false}}else{if(typeof g.aud=="object"){if(!f(g.aud,r.aud)){return false}}}}var b=j.IntDate.getNow();if(r.verifyAt!==undefined&&typeof r.verifyAt==="number"){b=r.verifyAt}if(r.gracePeriod===undefined||typeof r.gracePeriod!=="number"){r.gracePeriod=0}if(g.exp!==undefined&&typeof g.exp=="number"){if(g.exp+r.gracePeriodl){this.aHeader.pop()}if(this.aSignature.length>l){this.aSignature.pop()}throw"addSignature failed: "+i}};this.verifyAll=function(h){if(this.aHeader.length!==h.length||this.aSignature.length!==h.length){return false}for(var g=0;g0){this.aHeader=g.headers}else{throw"malformed header"}if(typeof g.payload==="string"){this.sPayload=g.payload}else{throw"malformed signatures"}if(g.signatures.length>0){this.signatures=g.signatures}else{throw"malformed signatures"}}catch(e){throw"malformed JWS-JS JSON object: "+e}}};this.getJSON=function(){return{headers:this.aHeader,payload:this.sPayload,signatures:this.aSignature}};this.isEmpty=function(){if(this.aHeader.length==0){return 1}return 0}}; -exports.SecureRandom = SecureRandom; -exports.rng_seed_time = rng_seed_time; - -exports.BigInteger = BigInteger; -exports.RSAKey = RSAKey; -exports.ECDSA = KJUR.crypto.ECDSA; -exports.DSA = KJUR.crypto.DSA; -exports.Signature = KJUR.crypto.Signature; -exports.MessageDigest = KJUR.crypto.MessageDigest; -exports.Mac = KJUR.crypto.Mac; -exports.Cipher = KJUR.crypto.Cipher; -exports.KEYUTIL = KEYUTIL; -exports.ASN1HEX = ASN1HEX; -exports.X509 = X509; -exports.CryptoJS = CryptoJS; - -// ext/base64.js -exports.b64tohex = b64tohex; -exports.b64toBA = b64toBA; - -// base64x.js -exports.stoBA = stoBA; -exports.BAtos = BAtos; -exports.BAtohex = BAtohex; -exports.stohex = stohex; -exports.stob64 = stob64; -exports.stob64u = stob64u; -exports.b64utos = b64utos; -exports.b64tob64u = b64tob64u; -exports.b64utob64 = b64utob64; -exports.hex2b64 = hex2b64; -exports.hextob64u = hextob64u; -exports.b64utohex = b64utohex; -exports.utf8tob64u = utf8tob64u; -exports.b64utoutf8 = b64utoutf8; -exports.utf8tob64 = utf8tob64; -exports.b64toutf8 = b64toutf8; -exports.utf8tohex = utf8tohex; -exports.hextoutf8 = hextoutf8; -exports.hextorstr = hextorstr; -exports.rstrtohex = rstrtohex; -exports.hextob64 = hextob64; -exports.hextob64nl = hextob64nl; -exports.b64nltohex = b64nltohex; -exports.hextopem = hextopem; -exports.pemtohex = pemtohex; -exports.hextoArrayBuffer = hextoArrayBuffer; -exports.ArrayBuffertohex = ArrayBuffertohex; -exports.zulutomsec = zulutomsec; -exports.zulutosec = zulutosec; -exports.zulutodate = zulutodate; -exports.datetozulu = datetozulu; -exports.uricmptohex = uricmptohex; -exports.hextouricmp = hextouricmp; -exports.encodeURIComponentAll = encodeURIComponentAll; -exports.newline_toUnix = newline_toUnix; -exports.newline_toDos = newline_toDos; -exports.hextoposhex = hextoposhex; -exports.intarystrtohex = intarystrtohex; -exports.strdiffidx = strdiffidx; - -// name spaces -exports.KJUR = KJUR; -exports.crypto = KJUR.crypto; -exports.asn1 = KJUR.asn1; -exports.jws = KJUR.jws; -exports.lang = KJUR.lang; - - - - -/***/ }), -/* 110 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -var OpenElementStack = __webpack_require__(51), - Tokenizer = __webpack_require__(19), - HTML = __webpack_require__(11); - - -//Aliases -var $ = HTML.TAG_NAMES; - -exports.assign = function (parser) { - //NOTE: obtain Parser proto this way to avoid module circular references - var parserProto = Object.getPrototypeOf(parser), - treeAdapter = parser.treeAdapter, - attachableElementLocation = null, - lastFosterParentingLocation = null, - currentToken = null; - - function setEndLocation(element, closingToken) { - var loc = element.__location; - - if (!loc) - return; - - if (!loc.startTag) { - loc.startTag = { - line: loc.line, - col: loc.col, - startOffset: loc.startOffset, - endOffset: loc.endOffset - }; - - if (loc.attrs) - loc.startTag.attrs = loc.attrs; - } - - if (closingToken.location) { - var ctLocation = closingToken.location, - tn = treeAdapter.getTagName(element), - // NOTE: For cases like - First 'p' closes without a closing tag and - // for cases like - 'p' closes without a closing tag - isClosingEndTag = closingToken.type === Tokenizer.END_TAG_TOKEN && - tn === closingToken.tagName; - - if (isClosingEndTag) { - loc.endTag = { - line: ctLocation.line, - col: ctLocation.col, - startOffset: ctLocation.startOffset, - endOffset: ctLocation.endOffset - }; - } - - if (isClosingEndTag) - loc.endOffset = ctLocation.endOffset; - else - loc.endOffset = ctLocation.startOffset; - } - - else if (closingToken.type === Tokenizer.EOF_TOKEN) - loc.endOffset = parser.tokenizer.preprocessor.sourcePos; - } - - //NOTE: patch _bootstrap method - parser._bootstrap = function (document, fragmentContext) { - parserProto._bootstrap.call(this, document, fragmentContext); - - attachableElementLocation = null; - lastFosterParentingLocation = null; - currentToken = null; - - //OpenElementStack - parser.openElements.pop = function () { - setEndLocation(this.current, currentToken); - OpenElementStack.prototype.pop.call(this); - }; - - parser.openElements.popAllUpToHtmlElement = function () { - for (var i = this.stackTop; i > 0; i--) - setEndLocation(this.items[i], currentToken); - - OpenElementStack.prototype.popAllUpToHtmlElement.call(this); - }; - - parser.openElements.remove = function (element) { - setEndLocation(element, currentToken); - OpenElementStack.prototype.remove.call(this, element); - }; - }; - - parser._runParsingLoop = function (scriptHandler) { - parserProto._runParsingLoop.call(this, scriptHandler); - - // NOTE: generate location info for elements - // that remains on open element stack - for (var i = parser.openElements.stackTop; i >= 0; i--) - setEndLocation(parser.openElements.items[i], currentToken); - }; - - - //Token processing - parser._processTokenInForeignContent = function (token) { - currentToken = token; - parserProto._processTokenInForeignContent.call(this, token); - }; - - parser._processToken = function (token) { - currentToken = token; - parserProto._processToken.call(this, token); - - //NOTE: and are never popped from the stack, so we need to updated - //their end location explicitly. - if (token.type === Tokenizer.END_TAG_TOKEN && - (token.tagName === $.HTML || - token.tagName === $.BODY && this.openElements.hasInScope($.BODY))) { - for (var i = this.openElements.stackTop; i >= 0; i--) { - var element = this.openElements.items[i]; - - if (this.treeAdapter.getTagName(element) === token.tagName) { - setEndLocation(element, token); - break; - } - } - } - }; - - - //Doctype - parser._setDocumentType = function (token) { - parserProto._setDocumentType.call(this, token); - - var documentChildren = this.treeAdapter.getChildNodes(this.document), - cnLength = documentChildren.length; - - for (var i = 0; i < cnLength; i++) { - var node = documentChildren[i]; - - if (this.treeAdapter.isDocumentTypeNode(node)) { - node.__location = token.location; - break; - } - } - }; - - - //Elements - parser._attachElementToTree = function (element) { - //NOTE: _attachElementToTree is called from _appendElement, _insertElement and _insertTemplate methods. - //So we will use token location stored in this methods for the element. - element.__location = attachableElementLocation || null; - attachableElementLocation = null; - parserProto._attachElementToTree.call(this, element); - }; - - parser._appendElement = function (token, namespaceURI) { - attachableElementLocation = token.location; - parserProto._appendElement.call(this, token, namespaceURI); - }; - - parser._insertElement = function (token, namespaceURI) { - attachableElementLocation = token.location; - parserProto._insertElement.call(this, token, namespaceURI); - }; - - parser._insertTemplate = function (token) { - attachableElementLocation = token.location; - parserProto._insertTemplate.call(this, token); - - var tmplContent = this.treeAdapter.getTemplateContent(this.openElements.current); - - tmplContent.__location = null; - }; - - parser._insertFakeRootElement = function () { - parserProto._insertFakeRootElement.call(this); - this.openElements.current.__location = null; - }; - - - //Comments - parser._appendCommentNode = function (token, parent) { - parserProto._appendCommentNode.call(this, token, parent); - - var children = this.treeAdapter.getChildNodes(parent), - commentNode = children[children.length - 1]; - - commentNode.__location = token.location; - }; - - - //Text - parser._findFosterParentingLocation = function () { - //NOTE: store last foster parenting location, so we will be able to find inserted text - //in case of foster parenting - lastFosterParentingLocation = parserProto._findFosterParentingLocation.call(this); - return lastFosterParentingLocation; - }; - - parser._insertCharacters = function (token) { - parserProto._insertCharacters.call(this, token); - - var hasFosterParent = this._shouldFosterParentOnInsertion(), - parent = hasFosterParent && lastFosterParentingLocation.parent || - this.openElements.currentTmplContent || - this.openElements.current, - siblings = this.treeAdapter.getChildNodes(parent), - textNodeIdx = hasFosterParent && lastFosterParentingLocation.beforeElement ? - siblings.indexOf(lastFosterParentingLocation.beforeElement) - 1 : - siblings.length - 1, - textNode = siblings[textNodeIdx]; - - //NOTE: if we have location assigned by another token, then just update end position - if (textNode.__location) - textNode.__location.endOffset = token.location.endOffset; - - else - textNode.__location = token.location; - }; -}; - - - -/***/ }), -/* 111 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -var UNICODE = __webpack_require__(18); - -//Aliases -var $ = UNICODE.CODE_POINTS; - - -exports.assign = function (tokenizer) { - //NOTE: obtain Tokenizer proto this way to avoid module circular references - var tokenizerProto = Object.getPrototypeOf(tokenizer), - tokenStartOffset = -1, - tokenCol = -1, - tokenLine = 1, - isEol = false, - lineStartPos = 0, - col = -1, - line = 1; - - function attachLocationInfo(token) { - token.location = { - line: tokenLine, - col: tokenCol, - startOffset: tokenStartOffset, - endOffset: -1 - }; - } - - //NOTE: patch consumption method to track line/col information - tokenizer._consume = function () { - var cp = tokenizerProto._consume.call(this); - - //NOTE: LF should be in the last column of the line - if (isEol) { - isEol = false; - line++; - lineStartPos = this.preprocessor.sourcePos; - } - - if (cp === $.LINE_FEED) - isEol = true; - - col = this.preprocessor.sourcePos - lineStartPos + 1; - - return cp; - }; - - tokenizer._unconsume = function () { - tokenizerProto._unconsume.call(this); - isEol = false; - - col = this.preprocessor.sourcePos - lineStartPos + 1; - }; - - //NOTE: patch token creation methods and attach location objects - tokenizer._createStartTagToken = function () { - tokenizerProto._createStartTagToken.call(this); - attachLocationInfo(this.currentToken); - }; - - tokenizer._createEndTagToken = function () { - tokenizerProto._createEndTagToken.call(this); - attachLocationInfo(this.currentToken); - }; - - tokenizer._createCommentToken = function () { - tokenizerProto._createCommentToken.call(this); - attachLocationInfo(this.currentToken); - }; - - tokenizer._createDoctypeToken = function (initialName) { - tokenizerProto._createDoctypeToken.call(this, initialName); - attachLocationInfo(this.currentToken); - }; - - tokenizer._createCharacterToken = function (type, ch) { - tokenizerProto._createCharacterToken.call(this, type, ch); - attachLocationInfo(this.currentCharacterToken); - }; - - tokenizer._createAttr = function (attrNameFirstCh) { - tokenizerProto._createAttr.call(this, attrNameFirstCh); - this.currentAttrLocation = { - line: line, - col: col, - startOffset: this.preprocessor.sourcePos, - endOffset: -1 - }; - }; - - tokenizer._leaveAttrName = function (toState) { - tokenizerProto._leaveAttrName.call(this, toState); - this._attachCurrentAttrLocationInfo(); - }; - - tokenizer._leaveAttrValue = function (toState) { - tokenizerProto._leaveAttrValue.call(this, toState); - this._attachCurrentAttrLocationInfo(); - }; - - tokenizer._attachCurrentAttrLocationInfo = function () { - this.currentAttrLocation.endOffset = this.preprocessor.sourcePos; - - if (!this.currentToken.location.attrs) - this.currentToken.location.attrs = Object.create(null); - - this.currentToken.location.attrs[this.currentAttr.name] = this.currentAttrLocation; - }; - - //NOTE: patch token emission methods to determine end location - tokenizer._emitCurrentToken = function () { - //NOTE: if we have pending character token make it's end location equal to the - //current token's start location. - if (this.currentCharacterToken) - this.currentCharacterToken.location.endOffset = this.currentToken.location.startOffset; - - this.currentToken.location.endOffset = this.preprocessor.sourcePos + 1; - tokenizerProto._emitCurrentToken.call(this); - }; - - tokenizer._emitCurrentCharacterToken = function () { - //NOTE: if we have character token and it's location wasn't set in the _emitCurrentToken(), - //then set it's location at the current preprocessor position. - //We don't need to increment preprocessor position, since character token - //emission is always forced by the start of the next character token here. - //So, we already have advanced position. - if (this.currentCharacterToken && this.currentCharacterToken.location.endOffset === -1) - this.currentCharacterToken.location.endOffset = this.preprocessor.sourcePos; - - tokenizerProto._emitCurrentCharacterToken.call(this); - }; - - //NOTE: patch initial states for each mode to obtain token start position - Object.keys(tokenizerProto.MODE) - - .map(function (modeName) { - return tokenizerProto.MODE[modeName]; - }) - - .forEach(function (state) { - tokenizer[state] = function (cp) { - tokenStartOffset = this.preprocessor.sourcePos; - tokenLine = line; - tokenCol = col; - tokenizerProto[state].call(this, cp); - }; - }); -}; - - -/***/ }), -/* 112 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -//Const -var NOAH_ARK_CAPACITY = 3; - -//List of formatting elements -var FormattingElementList = module.exports = function (treeAdapter) { - this.length = 0; - this.entries = []; - this.treeAdapter = treeAdapter; - this.bookmark = null; -}; - -//Entry types -FormattingElementList.MARKER_ENTRY = 'MARKER_ENTRY'; -FormattingElementList.ELEMENT_ENTRY = 'ELEMENT_ENTRY'; - -//Noah Ark's condition -//OPTIMIZATION: at first we try to find possible candidates for exclusion using -//lightweight heuristics without thorough attributes check. -FormattingElementList.prototype._getNoahArkConditionCandidates = function (newElement) { - var candidates = []; - - if (this.length >= NOAH_ARK_CAPACITY) { - var neAttrsLength = this.treeAdapter.getAttrList(newElement).length, - neTagName = this.treeAdapter.getTagName(newElement), - neNamespaceURI = this.treeAdapter.getNamespaceURI(newElement); - - for (var i = this.length - 1; i >= 0; i--) { - var entry = this.entries[i]; - - if (entry.type === FormattingElementList.MARKER_ENTRY) - break; - - var element = entry.element, - elementAttrs = this.treeAdapter.getAttrList(element), - isCandidate = this.treeAdapter.getTagName(element) === neTagName && - this.treeAdapter.getNamespaceURI(element) === neNamespaceURI && - elementAttrs.length === neAttrsLength; - - if (isCandidate) - candidates.push({idx: i, attrs: elementAttrs}); - } - } - - return candidates.length < NOAH_ARK_CAPACITY ? [] : candidates; -}; - -FormattingElementList.prototype._ensureNoahArkCondition = function (newElement) { - var candidates = this._getNoahArkConditionCandidates(newElement), - cLength = candidates.length; - - if (cLength) { - var neAttrs = this.treeAdapter.getAttrList(newElement), - neAttrsLength = neAttrs.length, - neAttrsMap = Object.create(null); - - //NOTE: build attrs map for the new element so we can perform fast lookups - for (var i = 0; i < neAttrsLength; i++) { - var neAttr = neAttrs[i]; - - neAttrsMap[neAttr.name] = neAttr.value; - } - - for (i = 0; i < neAttrsLength; i++) { - for (var j = 0; j < cLength; j++) { - var cAttr = candidates[j].attrs[i]; - - if (neAttrsMap[cAttr.name] !== cAttr.value) { - candidates.splice(j, 1); - cLength--; - } - - if (candidates.length < NOAH_ARK_CAPACITY) - return; - } - } - - //NOTE: remove bottommost candidates until Noah's Ark condition will not be met - for (i = cLength - 1; i >= NOAH_ARK_CAPACITY - 1; i--) { - this.entries.splice(candidates[i].idx, 1); - this.length--; - } - } -}; - -//Mutations -FormattingElementList.prototype.insertMarker = function () { - this.entries.push({type: FormattingElementList.MARKER_ENTRY}); - this.length++; -}; - -FormattingElementList.prototype.pushElement = function (element, token) { - this._ensureNoahArkCondition(element); - - this.entries.push({ - type: FormattingElementList.ELEMENT_ENTRY, - element: element, - token: token - }); - - this.length++; -}; - -FormattingElementList.prototype.insertElementAfterBookmark = function (element, token) { - var bookmarkIdx = this.length - 1; - - for (; bookmarkIdx >= 0; bookmarkIdx--) { - if (this.entries[bookmarkIdx] === this.bookmark) - break; - } - - this.entries.splice(bookmarkIdx + 1, 0, { - type: FormattingElementList.ELEMENT_ENTRY, - element: element, - token: token - }); - - this.length++; -}; - -FormattingElementList.prototype.removeEntry = function (entry) { - for (var i = this.length - 1; i >= 0; i--) { - if (this.entries[i] === entry) { - this.entries.splice(i, 1); - this.length--; - break; - } - } -}; - -FormattingElementList.prototype.clearToLastMarker = function () { - while (this.length) { - var entry = this.entries.pop(); - - this.length--; - - if (entry.type === FormattingElementList.MARKER_ENTRY) - break; - } -}; - -//Search -FormattingElementList.prototype.getElementEntryInScopeWithTagName = function (tagName) { - for (var i = this.length - 1; i >= 0; i--) { - var entry = this.entries[i]; - - if (entry.type === FormattingElementList.MARKER_ENTRY) - return null; - - if (this.treeAdapter.getTagName(entry.element) === tagName) - return entry; - } - - return null; -}; - -FormattingElementList.prototype.getElementEntry = function (element) { - for (var i = this.length - 1; i >= 0; i--) { - var entry = this.entries[i]; - - if (entry.type === FormattingElementList.ELEMENT_ENTRY && entry.element === element) - return entry; - } - - return null; -}; - - -/***/ }), -/* 113 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -var ParserStream = __webpack_require__(52), - inherits = __webpack_require__(24).inherits, - $ = __webpack_require__(11).TAG_NAMES; - -var PlainTextConversionStream = module.exports = function (options) { - ParserStream.call(this, options); - - // NOTE: see https://html.spec.whatwg.org/#read-text - this.parser._insertFakeElement($.HTML); - this.parser._insertFakeElement($.HEAD); - this.parser.openElements.pop(); - this.parser._insertFakeElement($.BODY); - this.parser._insertFakeElement($.PRE); - this.parser.treeAdapter.insertText(this.parser.openElements.current, '\n'); - this.parser.switchToPlaintextParsing(); -}; - -inherits(PlainTextConversionStream, ParserStream); - - -/***/ }), -/* 114 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -var WritableStream = __webpack_require__(31).Writable, - util = __webpack_require__(24); - -var DevNullStream = module.exports = function () { - WritableStream.call(this); -}; - -util.inherits(DevNullStream, WritableStream); - -DevNullStream.prototype._write = function (chunk, encoding, cb) { - cb(); -}; - - -/***/ }), -/* 115 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -var TransformStream = __webpack_require__(31).Transform, - DevNullStream = __webpack_require__(114), - inherits = __webpack_require__(24).inherits, - Tokenizer = __webpack_require__(19), - ParserFeedbackSimulator = __webpack_require__(116), - mergeOptions = __webpack_require__(34); - -var DEFAULT_OPTIONS = { - locationInfo: false -}; - -var SAXParser = module.exports = function (options) { - TransformStream.call(this); - - this.options = mergeOptions(DEFAULT_OPTIONS, options); - - this.tokenizer = new Tokenizer(options); - this.parserFeedbackSimulator = new ParserFeedbackSimulator(this.tokenizer); - - this.pendingText = null; - this.currentTokenLocation = void 0; - - this.lastChunkWritten = false; - this.stopped = false; - - // NOTE: always pipe stream to the /dev/null stream to avoid - // `highWaterMark` hit even if we don't have consumers. - // (see: https://github.com/inikulin/parse5/issues/97#issuecomment-171940774) - this.pipe(new DevNullStream()); -}; - -inherits(SAXParser, TransformStream); - -//TransformStream implementation -SAXParser.prototype._transform = function (chunk, encoding, callback) { - if (!this.stopped) { - this.tokenizer.write(chunk.toString('utf8'), this.lastChunkWritten); - this._runParsingLoop(); - } - - this.push(chunk); - - callback(); -}; - -SAXParser.prototype._flush = function (callback) { - callback(); -}; - -SAXParser.prototype.end = function (chunk, encoding, callback) { - this.lastChunkWritten = true; - TransformStream.prototype.end.call(this, chunk, encoding, callback); -}; - -SAXParser.prototype.stop = function () { - this.stopped = true; -}; - -//Internals -SAXParser.prototype._runParsingLoop = function () { - do { - var token = this.parserFeedbackSimulator.getNextToken(); - - if (token.type === Tokenizer.HIBERNATION_TOKEN) - break; - - if (token.type === Tokenizer.CHARACTER_TOKEN || - token.type === Tokenizer.WHITESPACE_CHARACTER_TOKEN || - token.type === Tokenizer.NULL_CHARACTER_TOKEN) { - - if (this.options.locationInfo) { - if (this.pendingText === null) - this.currentTokenLocation = token.location; - - else - this.currentTokenLocation.endOffset = token.location.endOffset; - } - - this.pendingText = (this.pendingText || '') + token.chars; - } - - else { - this._emitPendingText(); - this._handleToken(token); - } - } while (!this.stopped && token.type !== Tokenizer.EOF_TOKEN); -}; - -SAXParser.prototype._handleToken = function (token) { - if (this.options.locationInfo) - this.currentTokenLocation = token.location; - - if (token.type === Tokenizer.START_TAG_TOKEN) - this.emit('startTag', token.tagName, token.attrs, token.selfClosing, this.currentTokenLocation); - - else if (token.type === Tokenizer.END_TAG_TOKEN) - this.emit('endTag', token.tagName, this.currentTokenLocation); - - else if (token.type === Tokenizer.COMMENT_TOKEN) - this.emit('comment', token.data, this.currentTokenLocation); - - else if (token.type === Tokenizer.DOCTYPE_TOKEN) - this.emit('doctype', token.name, token.publicId, token.systemId, this.currentTokenLocation); -}; - -SAXParser.prototype._emitPendingText = function () { - if (this.pendingText !== null) { - this.emit('text', this.pendingText, this.currentTokenLocation); - this.pendingText = null; - } -}; - - -/***/ }), -/* 116 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -var Tokenizer = __webpack_require__(19), - foreignContent = __webpack_require__(49), - UNICODE = __webpack_require__(18), - HTML = __webpack_require__(11); - - -//Aliases -var $ = HTML.TAG_NAMES, - NS = HTML.NAMESPACES; - - -//ParserFeedbackSimulator -//Simulates adjustment of the Tokenizer which performed by standard parser during tree construction. -var ParserFeedbackSimulator = module.exports = function (tokenizer) { - this.tokenizer = tokenizer; - - this.namespaceStack = []; - this.namespaceStackTop = -1; - this._enterNamespace(NS.HTML); -}; - -ParserFeedbackSimulator.prototype.getNextToken = function () { - var token = this.tokenizer.getNextToken(); - - if (token.type === Tokenizer.START_TAG_TOKEN) - this._handleStartTagToken(token); - - else if (token.type === Tokenizer.END_TAG_TOKEN) - this._handleEndTagToken(token); - - else if (token.type === Tokenizer.NULL_CHARACTER_TOKEN && this.inForeignContent) { - token.type = Tokenizer.CHARACTER_TOKEN; - token.chars = UNICODE.REPLACEMENT_CHARACTER; - } - - else if (this.skipNextNewLine) { - if (token.type !== Tokenizer.HIBERNATION_TOKEN) - this.skipNextNewLine = false; - - if (token.type === Tokenizer.WHITESPACE_CHARACTER_TOKEN && token.chars[0] === '\n') { - if (token.chars.length === 1) - return this.getNextToken(); - - token.chars = token.chars.substr(1); - } - } - - return token; -}; - -//Namespace stack mutations -ParserFeedbackSimulator.prototype._enterNamespace = function (namespace) { - this.namespaceStackTop++; - this.namespaceStack.push(namespace); - - this.inForeignContent = namespace !== NS.HTML; - this.currentNamespace = namespace; - this.tokenizer.allowCDATA = this.inForeignContent; -}; - -ParserFeedbackSimulator.prototype._leaveCurrentNamespace = function () { - this.namespaceStackTop--; - this.namespaceStack.pop(); - - this.currentNamespace = this.namespaceStack[this.namespaceStackTop]; - this.inForeignContent = this.currentNamespace !== NS.HTML; - this.tokenizer.allowCDATA = this.inForeignContent; -}; - -//Token handlers -ParserFeedbackSimulator.prototype._ensureTokenizerMode = function (tn) { - if (tn === $.TEXTAREA || tn === $.TITLE) - this.tokenizer.state = Tokenizer.MODE.RCDATA; - - else if (tn === $.PLAINTEXT) - this.tokenizer.state = Tokenizer.MODE.PLAINTEXT; - - else if (tn === $.SCRIPT) - this.tokenizer.state = Tokenizer.MODE.SCRIPT_DATA; - - else if (tn === $.STYLE || tn === $.IFRAME || tn === $.XMP || - tn === $.NOEMBED || tn === $.NOFRAMES || tn === $.NOSCRIPT) - this.tokenizer.state = Tokenizer.MODE.RAWTEXT; -}; - -ParserFeedbackSimulator.prototype._handleStartTagToken = function (token) { - var tn = token.tagName; - - if (tn === $.SVG) - this._enterNamespace(NS.SVG); - - else if (tn === $.MATH) - this._enterNamespace(NS.MATHML); - - if (this.inForeignContent) { - if (foreignContent.causesExit(token)) { - this._leaveCurrentNamespace(); - return; - } - - var currentNs = this.currentNamespace; - - if (currentNs === NS.MATHML) - foreignContent.adjustTokenMathMLAttrs(token); - - else if (currentNs === NS.SVG) { - foreignContent.adjustTokenSVGTagName(token); - foreignContent.adjustTokenSVGAttrs(token); - } - - foreignContent.adjustTokenXMLAttrs(token); - - tn = token.tagName; - - if (!token.selfClosing && foreignContent.isIntegrationPoint(tn, currentNs, token.attrs)) - this._enterNamespace(NS.HTML); - } - - else { - if (tn === $.PRE || tn === $.TEXTAREA || tn === $.LISTING) - this.skipNextNewLine = true; - - else if (tn === $.IMAGE) - token.tagName = $.IMG; - - this._ensureTokenizerMode(tn); - } -}; - -ParserFeedbackSimulator.prototype._handleEndTagToken = function (token) { - var tn = token.tagName; - - if (!this.inForeignContent) { - var previousNs = this.namespaceStack[this.namespaceStackTop - 1]; - - if (previousNs === NS.SVG && foreignContent.SVG_TAG_NAMES_ADJUSTMENT_MAP[tn]) - tn = foreignContent.SVG_TAG_NAMES_ADJUSTMENT_MAP[tn]; - - //NOTE: check for exit from integration point - if (foreignContent.isIntegrationPoint(tn, previousNs, token.attrs)) - this._leaveCurrentNamespace(); - } - - else if (tn === $.SVG && this.currentNamespace === NS.SVG || - tn === $.MATH && this.currentNamespace === NS.MATHML) - this._leaveCurrentNamespace(); - - // NOTE: adjust end tag name as well for consistency - if (this.currentNamespace === NS.SVG) - foreignContent.adjustTokenSVGTagName(token); -}; - - -/***/ }), -/* 117 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -var ReadableStream = __webpack_require__(31).Readable, - inherits = __webpack_require__(24).inherits, - Serializer = __webpack_require__(53); - -var SerializerStream = module.exports = function (node, options) { - ReadableStream.call(this); - - this.serializer = new Serializer(node, options); - - Object.defineProperty(this.serializer, 'html', { - //NOTE: To make `+=` concat operator work properly we define - //getter which always returns empty string - get: function () { - return ''; - }, - set: this.push.bind(this) - }); -}; - -inherits(SerializerStream, ReadableStream); - -//Readable stream implementation -SerializerStream.prototype._read = function () { - this.serializer.serialize(); - this.push(null); -}; - - -/***/ }), -/* 118 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -//NOTE: this file contains auto-generated array mapped radix tree that is used for the named entity references consumption -//(details: https://github.com/inikulin/parse5/tree/master/scripts/generate_named_entity_data/README.md) -module.exports = new Uint16Array([4,52,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,106,303,412,810,1432,1701,1796,1987,2114,2360,2420,2484,3170,3251,4140,4393,4575,4610,5106,5512,5728,6117,6274,6315,6345,6427,6516,7002,7910,8733,9323,9870,10170,10631,10893,11318,11386,11467,12773,13092,14474,14922,15448,15542,16419,17666,18166,18611,19004,19095,19298,19397,4,16,69,77,97,98,99,102,103,108,109,110,111,112,114,115,116,117,140,150,158,169,176,194,199,210,216,222,226,242,256,266,283,294,108,105,103,5,198,1,59,148,1,198,80,5,38,1,59,156,1,38,99,117,116,101,5,193,1,59,167,1,193,114,101,118,101,59,1,258,4,2,105,121,182,191,114,99,5,194,1,59,189,1,194,59,1,1040,114,59,3,55349,56580,114,97,118,101,5,192,1,59,208,1,192,112,104,97,59,1,913,97,99,114,59,1,256,100,59,1,10835,4,2,103,112,232,237,111,110,59,1,260,102,59,3,55349,56632,112,108,121,70,117,110,99,116,105,111,110,59,1,8289,105,110,103,5,197,1,59,264,1,197,4,2,99,115,272,277,114,59,3,55349,56476,105,103,110,59,1,8788,105,108,100,101,5,195,1,59,292,1,195,109,108,5,196,1,59,301,1,196,4,8,97,99,101,102,111,114,115,117,321,350,354,383,388,394,400,405,4,2,99,114,327,336,107,115,108,97,115,104,59,1,8726,4,2,118,119,342,345,59,1,10983,101,100,59,1,8966,121,59,1,1041,4,3,99,114,116,362,369,379,97,117,115,101,59,1,8757,110,111,117,108,108,105,115,59,1,8492,97,59,1,914,114,59,3,55349,56581,112,102,59,3,55349,56633,101,118,101,59,1,728,99,114,59,1,8492,109,112,101,113,59,1,8782,4,14,72,79,97,99,100,101,102,104,105,108,111,114,115,117,442,447,456,504,542,547,569,573,577,616,678,784,790,796,99,121,59,1,1063,80,89,5,169,1,59,454,1,169,4,3,99,112,121,464,470,497,117,116,101,59,1,262,4,2,59,105,476,478,1,8914,116,97,108,68,105,102,102,101,114,101,110,116,105,97,108,68,59,1,8517,108,101,121,115,59,1,8493,4,4,97,101,105,111,514,520,530,535,114,111,110,59,1,268,100,105,108,5,199,1,59,528,1,199,114,99,59,1,264,110,105,110,116,59,1,8752,111,116,59,1,266,4,2,100,110,553,560,105,108,108,97,59,1,184,116,101,114,68,111,116,59,1,183,114,59,1,8493,105,59,1,935,114,99,108,101,4,4,68,77,80,84,591,596,603,609,111,116,59,1,8857,105,110,117,115,59,1,8854,108,117,115,59,1,8853,105,109,101,115,59,1,8855,111,4,2,99,115,623,646,107,119,105,115,101,67,111,110,116,111,117,114,73,110,116,101,103,114,97,108,59,1,8754,101,67,117,114,108,121,4,2,68,81,658,671,111,117,98,108,101,81,117,111,116,101,59,1,8221,117,111,116,101,59,1,8217,4,4,108,110,112,117,688,701,736,753,111,110,4,2,59,101,696,698,1,8759,59,1,10868,4,3,103,105,116,709,717,722,114,117,101,110,116,59,1,8801,110,116,59,1,8751,111,117,114,73,110,116,101,103,114,97,108,59,1,8750,4,2,102,114,742,745,59,1,8450,111,100,117,99,116,59,1,8720,110,116,101,114,67,108,111,99,107,119,105,115,101,67,111,110,116,111,117,114,73,110,116,101,103,114,97,108,59,1,8755,111,115,115,59,1,10799,99,114,59,3,55349,56478,112,4,2,59,67,803,805,1,8915,97,112,59,1,8781,4,11,68,74,83,90,97,99,101,102,105,111,115,834,850,855,860,865,888,903,916,921,1011,1415,4,2,59,111,840,842,1,8517,116,114,97,104,100,59,1,10513,99,121,59,1,1026,99,121,59,1,1029,99,121,59,1,1039,4,3,103,114,115,873,879,883,103,101,114,59,1,8225,114,59,1,8609,104,118,59,1,10980,4,2,97,121,894,900,114,111,110,59,1,270,59,1,1044,108,4,2,59,116,910,912,1,8711,97,59,1,916,114,59,3,55349,56583,4,2,97,102,927,998,4,2,99,109,933,992,114,105,116,105,99,97,108,4,4,65,68,71,84,950,957,978,985,99,117,116,101,59,1,180,111,4,2,116,117,964,967,59,1,729,98,108,101,65,99,117,116,101,59,1,733,114,97,118,101,59,1,96,105,108,100,101,59,1,732,111,110,100,59,1,8900,102,101,114,101,110,116,105,97,108,68,59,1,8518,4,4,112,116,117,119,1021,1026,1048,1249,102,59,3,55349,56635,4,3,59,68,69,1034,1036,1041,1,168,111,116,59,1,8412,113,117,97,108,59,1,8784,98,108,101,4,6,67,68,76,82,85,86,1065,1082,1101,1189,1211,1236,111,110,116,111,117,114,73,110,116,101,103,114,97,108,59,1,8751,111,4,2,116,119,1089,1092,59,1,168,110,65,114,114,111,119,59,1,8659,4,2,101,111,1107,1141,102,116,4,3,65,82,84,1117,1124,1136,114,114,111,119,59,1,8656,105,103,104,116,65,114,114,111,119,59,1,8660,101,101,59,1,10980,110,103,4,2,76,82,1149,1177,101,102,116,4,2,65,82,1158,1165,114,114,111,119,59,1,10232,105,103,104,116,65,114,114,111,119,59,1,10234,105,103,104,116,65,114,114,111,119,59,1,10233,105,103,104,116,4,2,65,84,1199,1206,114,114,111,119,59,1,8658,101,101,59,1,8872,112,4,2,65,68,1218,1225,114,114,111,119,59,1,8657,111,119,110,65,114,114,111,119,59,1,8661,101,114,116,105,99,97,108,66,97,114,59,1,8741,110,4,6,65,66,76,82,84,97,1264,1292,1299,1352,1391,1408,114,114,111,119,4,3,59,66,85,1276,1278,1283,1,8595,97,114,59,1,10515,112,65,114,114,111,119,59,1,8693,114,101,118,101,59,1,785,101,102,116,4,3,82,84,86,1310,1323,1334,105,103,104,116,86,101,99,116,111,114,59,1,10576,101,101,86,101,99,116,111,114,59,1,10590,101,99,116,111,114,4,2,59,66,1345,1347,1,8637,97,114,59,1,10582,105,103,104,116,4,2,84,86,1362,1373,101,101,86,101,99,116,111,114,59,1,10591,101,99,116,111,114,4,2,59,66,1384,1386,1,8641,97,114,59,1,10583,101,101,4,2,59,65,1399,1401,1,8868,114,114,111,119,59,1,8615,114,114,111,119,59,1,8659,4,2,99,116,1421,1426,114,59,3,55349,56479,114,111,107,59,1,272,4,16,78,84,97,99,100,102,103,108,109,111,112,113,115,116,117,120,1466,1470,1478,1489,1515,1520,1525,1536,1544,1593,1609,1617,1650,1664,1668,1677,71,59,1,330,72,5,208,1,59,1476,1,208,99,117,116,101,5,201,1,59,1487,1,201,4,3,97,105,121,1497,1503,1512,114,111,110,59,1,282,114,99,5,202,1,59,1510,1,202,59,1,1069,111,116,59,1,278,114,59,3,55349,56584,114,97,118,101,5,200,1,59,1534,1,200,101,109,101,110,116,59,1,8712,4,2,97,112,1550,1555,99,114,59,1,274,116,121,4,2,83,86,1563,1576,109,97,108,108,83,113,117,97,114,101,59,1,9723,101,114,121,83,109,97,108,108,83,113,117,97,114,101,59,1,9643,4,2,103,112,1599,1604,111,110,59,1,280,102,59,3,55349,56636,115,105,108,111,110,59,1,917,117,4,2,97,105,1624,1640,108,4,2,59,84,1631,1633,1,10869,105,108,100,101,59,1,8770,108,105,98,114,105,117,109,59,1,8652,4,2,99,105,1656,1660,114,59,1,8496,109,59,1,10867,97,59,1,919,109,108,5,203,1,59,1675,1,203,4,2,105,112,1683,1689,115,116,115,59,1,8707,111,110,101,110,116,105,97,108,69,59,1,8519,4,5,99,102,105,111,115,1713,1717,1722,1762,1791,121,59,1,1060,114,59,3,55349,56585,108,108,101,100,4,2,83,86,1732,1745,109,97,108,108,83,113,117,97,114,101,59,1,9724,101,114,121,83,109,97,108,108,83,113,117,97,114,101,59,1,9642,4,3,112,114,117,1770,1775,1781,102,59,3,55349,56637,65,108,108,59,1,8704,114,105,101,114,116,114,102,59,1,8497,99,114,59,1,8497,4,12,74,84,97,98,99,100,102,103,111,114,115,116,1822,1827,1834,1848,1855,1877,1882,1887,1890,1896,1978,1984,99,121,59,1,1027,5,62,1,59,1832,1,62,109,109,97,4,2,59,100,1843,1845,1,915,59,1,988,114,101,118,101,59,1,286,4,3,101,105,121,1863,1869,1874,100,105,108,59,1,290,114,99,59,1,284,59,1,1043,111,116,59,1,288,114,59,3,55349,56586,59,1,8921,112,102,59,3,55349,56638,101,97,116,101,114,4,6,69,70,71,76,83,84,1915,1933,1944,1953,1959,1971,113,117,97,108,4,2,59,76,1925,1927,1,8805,101,115,115,59,1,8923,117,108,108,69,113,117,97,108,59,1,8807,114,101,97,116,101,114,59,1,10914,101,115,115,59,1,8823,108,97,110,116,69,113,117,97,108,59,1,10878,105,108,100,101,59,1,8819,99,114,59,3,55349,56482,59,1,8811,4,8,65,97,99,102,105,111,115,117,2005,2012,2026,2032,2036,2049,2073,2089,82,68,99,121,59,1,1066,4,2,99,116,2018,2023,101,107,59,1,711,59,1,94,105,114,99,59,1,292,114,59,1,8460,108,98,101,114,116,83,112,97,99,101,59,1,8459,4,2,112,114,2055,2059,102,59,1,8461,105,122,111,110,116,97,108,76,105,110,101,59,1,9472,4,2,99,116,2079,2083,114,59,1,8459,114,111,107,59,1,294,109,112,4,2,68,69,2097,2107,111,119,110,72,117,109,112,59,1,8782,113,117,97,108,59,1,8783,4,14,69,74,79,97,99,100,102,103,109,110,111,115,116,117,2144,2149,2155,2160,2171,2189,2194,2198,2209,2245,2307,2329,2334,2341,99,121,59,1,1045,108,105,103,59,1,306,99,121,59,1,1025,99,117,116,101,5,205,1,59,2169,1,205,4,2,105,121,2177,2186,114,99,5,206,1,59,2184,1,206,59,1,1048,111,116,59,1,304,114,59,1,8465,114,97,118,101,5,204,1,59,2207,1,204,4,3,59,97,112,2217,2219,2238,1,8465,4,2,99,103,2225,2229,114,59,1,298,105,110,97,114,121,73,59,1,8520,108,105,101,115,59,1,8658,4,2,116,118,2251,2281,4,2,59,101,2257,2259,1,8748,4,2,103,114,2265,2271,114,97,108,59,1,8747,115,101,99,116,105,111,110,59,1,8898,105,115,105,98,108,101,4,2,67,84,2293,2300,111,109,109,97,59,1,8291,105,109,101,115,59,1,8290,4,3,103,112,116,2315,2320,2325,111,110,59,1,302,102,59,3,55349,56640,97,59,1,921,99,114,59,1,8464,105,108,100,101,59,1,296,4,2,107,109,2347,2352,99,121,59,1,1030,108,5,207,1,59,2358,1,207,4,5,99,102,111,115,117,2372,2386,2391,2397,2414,4,2,105,121,2378,2383,114,99,59,1,308,59,1,1049,114,59,3,55349,56589,112,102,59,3,55349,56641,4,2,99,101,2403,2408,114,59,3,55349,56485,114,99,121,59,1,1032,107,99,121,59,1,1028,4,7,72,74,97,99,102,111,115,2436,2441,2446,2452,2467,2472,2478,99,121,59,1,1061,99,121,59,1,1036,112,112,97,59,1,922,4,2,101,121,2458,2464,100,105,108,59,1,310,59,1,1050,114,59,3,55349,56590,112,102,59,3,55349,56642,99,114,59,3,55349,56486,4,11,74,84,97,99,101,102,108,109,111,115,116,2508,2513,2520,2562,2585,2981,2986,3004,3011,3146,3167,99,121,59,1,1033,5,60,1,59,2518,1,60,4,5,99,109,110,112,114,2532,2538,2544,2548,2558,117,116,101,59,1,313,98,100,97,59,1,923,103,59,1,10218,108,97,99,101,116,114,102,59,1,8466,114,59,1,8606,4,3,97,101,121,2570,2576,2582,114,111,110,59,1,317,100,105,108,59,1,315,59,1,1051,4,2,102,115,2591,2907,116,4,10,65,67,68,70,82,84,85,86,97,114,2614,2663,2672,2728,2735,2760,2820,2870,2888,2895,4,2,110,114,2620,2633,103,108,101,66,114,97,99,107,101,116,59,1,10216,114,111,119,4,3,59,66,82,2644,2646,2651,1,8592,97,114,59,1,8676,105,103,104,116,65,114,114,111,119,59,1,8646,101,105,108,105,110,103,59,1,8968,111,4,2,117,119,2679,2692,98,108,101,66,114,97,99,107,101,116,59,1,10214,110,4,2,84,86,2699,2710,101,101,86,101,99,116,111,114,59,1,10593,101,99,116,111,114,4,2,59,66,2721,2723,1,8643,97,114,59,1,10585,108,111,111,114,59,1,8970,105,103,104,116,4,2,65,86,2745,2752,114,114,111,119,59,1,8596,101,99,116,111,114,59,1,10574,4,2,101,114,2766,2792,101,4,3,59,65,86,2775,2777,2784,1,8867,114,114,111,119,59,1,8612,101,99,116,111,114,59,1,10586,105,97,110,103,108,101,4,3,59,66,69,2806,2808,2813,1,8882,97,114,59,1,10703,113,117,97,108,59,1,8884,112,4,3,68,84,86,2829,2841,2852,111,119,110,86,101,99,116,111,114,59,1,10577,101,101,86,101,99,116,111,114,59,1,10592,101,99,116,111,114,4,2,59,66,2863,2865,1,8639,97,114,59,1,10584,101,99,116,111,114,4,2,59,66,2881,2883,1,8636,97,114,59,1,10578,114,114,111,119,59,1,8656,105,103,104,116,97,114,114,111,119,59,1,8660,115,4,6,69,70,71,76,83,84,2922,2936,2947,2956,2962,2974,113,117,97,108,71,114,101,97,116,101,114,59,1,8922,117,108,108,69,113,117,97,108,59,1,8806,114,101,97,116,101,114,59,1,8822,101,115,115,59,1,10913,108,97,110,116,69,113,117,97,108,59,1,10877,105,108,100,101,59,1,8818,114,59,3,55349,56591,4,2,59,101,2992,2994,1,8920,102,116,97,114,114,111,119,59,1,8666,105,100,111,116,59,1,319,4,3,110,112,119,3019,3110,3115,103,4,4,76,82,108,114,3030,3058,3070,3098,101,102,116,4,2,65,82,3039,3046,114,114,111,119,59,1,10229,105,103,104,116,65,114,114,111,119,59,1,10231,105,103,104,116,65,114,114,111,119,59,1,10230,101,102,116,4,2,97,114,3079,3086,114,114,111,119,59,1,10232,105,103,104,116,97,114,114,111,119,59,1,10234,105,103,104,116,97,114,114,111,119,59,1,10233,102,59,3,55349,56643,101,114,4,2,76,82,3123,3134,101,102,116,65,114,114,111,119,59,1,8601,105,103,104,116,65,114,114,111,119,59,1,8600,4,3,99,104,116,3154,3158,3161,114,59,1,8466,59,1,8624,114,111,107,59,1,321,59,1,8810,4,8,97,99,101,102,105,111,115,117,3188,3192,3196,3222,3227,3237,3243,3248,112,59,1,10501,121,59,1,1052,4,2,100,108,3202,3213,105,117,109,83,112,97,99,101,59,1,8287,108,105,110,116,114,102,59,1,8499,114,59,3,55349,56592,110,117,115,80,108,117,115,59,1,8723,112,102,59,3,55349,56644,99,114,59,1,8499,59,1,924,4,9,74,97,99,101,102,111,115,116,117,3271,3276,3283,3306,3422,3427,4120,4126,4137,99,121,59,1,1034,99,117,116,101,59,1,323,4,3,97,101,121,3291,3297,3303,114,111,110,59,1,327,100,105,108,59,1,325,59,1,1053,4,3,103,115,119,3314,3380,3415,97,116,105,118,101,4,3,77,84,86,3327,3340,3365,101,100,105,117,109,83,112,97,99,101,59,1,8203,104,105,4,2,99,110,3348,3357,107,83,112,97,99,101,59,1,8203,83,112,97,99,101,59,1,8203,101,114,121,84,104,105,110,83,112,97,99,101,59,1,8203,116,101,100,4,2,71,76,3389,3405,114,101,97,116,101,114,71,114,101,97,116,101,114,59,1,8811,101,115,115,76,101,115,115,59,1,8810,76,105,110,101,59,1,10,114,59,3,55349,56593,4,4,66,110,112,116,3437,3444,3460,3464,114,101,97,107,59,1,8288,66,114,101,97,107,105,110,103,83,112,97,99,101,59,1,160,102,59,1,8469,4,13,59,67,68,69,71,72,76,78,80,82,83,84,86,3492,3494,3517,3536,3578,3657,3685,3784,3823,3860,3915,4066,4107,1,10988,4,2,111,117,3500,3510,110,103,114,117,101,110,116,59,1,8802,112,67,97,112,59,1,8813,111,117,98,108,101,86,101,114,116,105,99,97,108,66,97,114,59,1,8742,4,3,108,113,120,3544,3552,3571,101,109,101,110,116,59,1,8713,117,97,108,4,2,59,84,3561,3563,1,8800,105,108,100,101,59,3,8770,824,105,115,116,115,59,1,8708,114,101,97,116,101,114,4,7,59,69,70,71,76,83,84,3600,3602,3609,3621,3631,3637,3650,1,8815,113,117,97,108,59,1,8817,117,108,108,69,113,117,97,108,59,3,8807,824,114,101,97,116,101,114,59,3,8811,824,101,115,115,59,1,8825,108,97,110,116,69,113,117,97,108,59,3,10878,824,105,108,100,101,59,1,8821,117,109,112,4,2,68,69,3666,3677,111,119,110,72,117,109,112,59,3,8782,824,113,117,97,108,59,3,8783,824,101,4,2,102,115,3692,3724,116,84,114,105,97,110,103,108,101,4,3,59,66,69,3709,3711,3717,1,8938,97,114,59,3,10703,824,113,117,97,108,59,1,8940,115,4,6,59,69,71,76,83,84,3739,3741,3748,3757,3764,3777,1,8814,113,117,97,108,59,1,8816,114,101,97,116,101,114,59,1,8824,101,115,115,59,3,8810,824,108,97,110,116,69,113,117,97,108,59,3,10877,824,105,108,100,101,59,1,8820,101,115,116,101,100,4,2,71,76,3795,3812,114,101,97,116,101,114,71,114,101,97,116,101,114,59,3,10914,824,101,115,115,76,101,115,115,59,3,10913,824,114,101,99,101,100,101,115,4,3,59,69,83,3838,3840,3848,1,8832,113,117,97,108,59,3,10927,824,108,97,110,116,69,113,117,97,108,59,1,8928,4,2,101,105,3866,3881,118,101,114,115,101,69,108,101,109,101,110,116,59,1,8716,103,104,116,84,114,105,97,110,103,108,101,4,3,59,66,69,3900,3902,3908,1,8939,97,114,59,3,10704,824,113,117,97,108,59,1,8941,4,2,113,117,3921,3973,117,97,114,101,83,117,4,2,98,112,3933,3952,115,101,116,4,2,59,69,3942,3945,3,8847,824,113,117,97,108,59,1,8930,101,114,115,101,116,4,2,59,69,3963,3966,3,8848,824,113,117,97,108,59,1,8931,4,3,98,99,112,3981,4000,4045,115,101,116,4,2,59,69,3990,3993,3,8834,8402,113,117,97,108,59,1,8840,99,101,101,100,115,4,4,59,69,83,84,4015,4017,4025,4037,1,8833,113,117,97,108,59,3,10928,824,108,97,110,116,69,113,117,97,108,59,1,8929,105,108,100,101,59,3,8831,824,101,114,115,101,116,4,2,59,69,4056,4059,3,8835,8402,113,117,97,108,59,1,8841,105,108,100,101,4,4,59,69,70,84,4080,4082,4089,4100,1,8769,113,117,97,108,59,1,8772,117,108,108,69,113,117,97,108,59,1,8775,105,108,100,101,59,1,8777,101,114,116,105,99,97,108,66,97,114,59,1,8740,99,114,59,3,55349,56489,105,108,100,101,5,209,1,59,4135,1,209,59,1,925,4,14,69,97,99,100,102,103,109,111,112,114,115,116,117,118,4170,4176,4187,4205,4212,4217,4228,4253,4259,4292,4295,4316,4337,4346,108,105,103,59,1,338,99,117,116,101,5,211,1,59,4185,1,211,4,2,105,121,4193,4202,114,99,5,212,1,59,4200,1,212,59,1,1054,98,108,97,99,59,1,336,114,59,3,55349,56594,114,97,118,101,5,210,1,59,4226,1,210,4,3,97,101,105,4236,4241,4246,99,114,59,1,332,103,97,59,1,937,99,114,111,110,59,1,927,112,102,59,3,55349,56646,101,110,67,117,114,108,121,4,2,68,81,4272,4285,111,117,98,108,101,81,117,111,116,101,59,1,8220,117,111,116,101,59,1,8216,59,1,10836,4,2,99,108,4301,4306,114,59,3,55349,56490,97,115,104,5,216,1,59,4314,1,216,105,4,2,108,109,4323,4332,100,101,5,213,1,59,4330,1,213,101,115,59,1,10807,109,108,5,214,1,59,4344,1,214,101,114,4,2,66,80,4354,4380,4,2,97,114,4360,4364,114,59,1,8254,97,99,4,2,101,107,4372,4375,59,1,9182,101,116,59,1,9140,97,114,101,110,116,104,101,115,105,115,59,1,9180,4,9,97,99,102,104,105,108,111,114,115,4413,4422,4426,4431,4435,4438,4448,4471,4561,114,116,105,97,108,68,59,1,8706,121,59,1,1055,114,59,3,55349,56595,105,59,1,934,59,1,928,117,115,77,105,110,117,115,59,1,177,4,2,105,112,4454,4467,110,99,97,114,101,112,108,97,110,101,59,1,8460,102,59,1,8473,4,4,59,101,105,111,4481,4483,4526,4531,1,10939,99,101,100,101,115,4,4,59,69,83,84,4498,4500,4507,4519,1,8826,113,117,97,108,59,1,10927,108,97,110,116,69,113,117,97,108,59,1,8828,105,108,100,101,59,1,8830,109,101,59,1,8243,4,2,100,112,4537,4543,117,99,116,59,1,8719,111,114,116,105,111,110,4,2,59,97,4555,4557,1,8759,108,59,1,8733,4,2,99,105,4567,4572,114,59,3,55349,56491,59,1,936,4,4,85,102,111,115,4585,4594,4599,4604,79,84,5,34,1,59,4592,1,34,114,59,3,55349,56596,112,102,59,1,8474,99,114,59,3,55349,56492,4,12,66,69,97,99,101,102,104,105,111,114,115,117,4636,4642,4650,4681,4704,4763,4767,4771,5047,5069,5081,5094,97,114,114,59,1,10512,71,5,174,1,59,4648,1,174,4,3,99,110,114,4658,4664,4668,117,116,101,59,1,340,103,59,1,10219,114,4,2,59,116,4675,4677,1,8608,108,59,1,10518,4,3,97,101,121,4689,4695,4701,114,111,110,59,1,344,100,105,108,59,1,342,59,1,1056,4,2,59,118,4710,4712,1,8476,101,114,115,101,4,2,69,85,4722,4748,4,2,108,113,4728,4736,101,109,101,110,116,59,1,8715,117,105,108,105,98,114,105,117,109,59,1,8651,112,69,113,117,105,108,105,98,114,105,117,109,59,1,10607,114,59,1,8476,111,59,1,929,103,104,116,4,8,65,67,68,70,84,85,86,97,4792,4840,4849,4905,4912,4972,5022,5040,4,2,110,114,4798,4811,103,108,101,66,114,97,99,107,101,116,59,1,10217,114,111,119,4,3,59,66,76,4822,4824,4829,1,8594,97,114,59,1,8677,101,102,116,65,114,114,111,119,59,1,8644,101,105,108,105,110,103,59,1,8969,111,4,2,117,119,4856,4869,98,108,101,66,114,97,99,107,101,116,59,1,10215,110,4,2,84,86,4876,4887,101,101,86,101,99,116,111,114,59,1,10589,101,99,116,111,114,4,2,59,66,4898,4900,1,8642,97,114,59,1,10581,108,111,111,114,59,1,8971,4,2,101,114,4918,4944,101,4,3,59,65,86,4927,4929,4936,1,8866,114,114,111,119,59,1,8614,101,99,116,111,114,59,1,10587,105,97,110,103,108,101,4,3,59,66,69,4958,4960,4965,1,8883,97,114,59,1,10704,113,117,97,108,59,1,8885,112,4,3,68,84,86,4981,4993,5004,111,119,110,86,101,99,116,111,114,59,1,10575,101,101,86,101,99,116,111,114,59,1,10588,101,99,116,111,114,4,2,59,66,5015,5017,1,8638,97,114,59,1,10580,101,99,116,111,114,4,2,59,66,5033,5035,1,8640,97,114,59,1,10579,114,114,111,119,59,1,8658,4,2,112,117,5053,5057,102,59,1,8477,110,100,73,109,112,108,105,101,115,59,1,10608,105,103,104,116,97,114,114,111,119,59,1,8667,4,2,99,104,5087,5091,114,59,1,8475,59,1,8625,108,101,68,101,108,97,121,101,100,59,1,10740,4,13,72,79,97,99,102,104,105,109,111,113,115,116,117,5134,5150,5157,5164,5198,5203,5259,5265,5277,5283,5374,5380,5385,4,2,67,99,5140,5146,72,99,121,59,1,1065,121,59,1,1064,70,84,99,121,59,1,1068,99,117,116,101,59,1,346,4,5,59,97,101,105,121,5176,5178,5184,5190,5195,1,10940,114,111,110,59,1,352,100,105,108,59,1,350,114,99,59,1,348,59,1,1057,114,59,3,55349,56598,111,114,116,4,4,68,76,82,85,5216,5227,5238,5250,111,119,110,65,114,114,111,119,59,1,8595,101,102,116,65,114,114,111,119,59,1,8592,105,103,104,116,65,114,114,111,119,59,1,8594,112,65,114,114,111,119,59,1,8593,103,109,97,59,1,931,97,108,108,67,105,114,99,108,101,59,1,8728,112,102,59,3,55349,56650,4,2,114,117,5289,5293,116,59,1,8730,97,114,101,4,4,59,73,83,85,5306,5308,5322,5367,1,9633,110,116,101,114,115,101,99,116,105,111,110,59,1,8851,117,4,2,98,112,5329,5347,115,101,116,4,2,59,69,5338,5340,1,8847,113,117,97,108,59,1,8849,101,114,115,101,116,4,2,59,69,5358,5360,1,8848,113,117,97,108,59,1,8850,110,105,111,110,59,1,8852,99,114,59,3,55349,56494,97,114,59,1,8902,4,4,98,99,109,112,5395,5420,5475,5478,4,2,59,115,5401,5403,1,8912,101,116,4,2,59,69,5411,5413,1,8912,113,117,97,108,59,1,8838,4,2,99,104,5426,5468,101,101,100,115,4,4,59,69,83,84,5440,5442,5449,5461,1,8827,113,117,97,108,59,1,10928,108,97,110,116,69,113,117,97,108,59,1,8829,105,108,100,101,59,1,8831,84,104,97,116,59,1,8715,59,1,8721,4,3,59,101,115,5486,5488,5507,1,8913,114,115,101,116,4,2,59,69,5498,5500,1,8835,113,117,97,108,59,1,8839,101,116,59,1,8913,4,11,72,82,83,97,99,102,104,105,111,114,115,5536,5546,5552,5567,5579,5602,5607,5655,5695,5701,5711,79,82,78,5,222,1,59,5544,1,222,65,68,69,59,1,8482,4,2,72,99,5558,5563,99,121,59,1,1035,121,59,1,1062,4,2,98,117,5573,5576,59,1,9,59,1,932,4,3,97,101,121,5587,5593,5599,114,111,110,59,1,356,100,105,108,59,1,354,59,1,1058,114,59,3,55349,56599,4,2,101,105,5613,5631,4,2,114,116,5619,5627,101,102,111,114,101,59,1,8756,97,59,1,920,4,2,99,110,5637,5647,107,83,112,97,99,101,59,3,8287,8202,83,112,97,99,101,59,1,8201,108,100,101,4,4,59,69,70,84,5668,5670,5677,5688,1,8764,113,117,97,108,59,1,8771,117,108,108,69,113,117,97,108,59,1,8773,105,108,100,101,59,1,8776,112,102,59,3,55349,56651,105,112,108,101,68,111,116,59,1,8411,4,2,99,116,5717,5722,114,59,3,55349,56495,114,111,107,59,1,358,4,14,97,98,99,100,102,103,109,110,111,112,114,115,116,117,5758,5789,5805,5823,5830,5835,5846,5852,5921,5937,6089,6095,6101,6108,4,2,99,114,5764,5774,117,116,101,5,218,1,59,5772,1,218,114,4,2,59,111,5781,5783,1,8607,99,105,114,59,1,10569,114,4,2,99,101,5796,5800,121,59,1,1038,118,101,59,1,364,4,2,105,121,5811,5820,114,99,5,219,1,59,5818,1,219,59,1,1059,98,108,97,99,59,1,368,114,59,3,55349,56600,114,97,118,101,5,217,1,59,5844,1,217,97,99,114,59,1,362,4,2,100,105,5858,5905,101,114,4,2,66,80,5866,5892,4,2,97,114,5872,5876,114,59,1,95,97,99,4,2,101,107,5884,5887,59,1,9183,101,116,59,1,9141,97,114,101,110,116,104,101,115,105,115,59,1,9181,111,110,4,2,59,80,5913,5915,1,8899,108,117,115,59,1,8846,4,2,103,112,5927,5932,111,110,59,1,370,102,59,3,55349,56652,4,8,65,68,69,84,97,100,112,115,5955,5985,5996,6009,6026,6033,6044,6075,114,114,111,119,4,3,59,66,68,5967,5969,5974,1,8593,97,114,59,1,10514,111,119,110,65,114,114,111,119,59,1,8645,111,119,110,65,114,114,111,119,59,1,8597,113,117,105,108,105,98,114,105,117,109,59,1,10606,101,101,4,2,59,65,6017,6019,1,8869,114,114,111,119,59,1,8613,114,114,111,119,59,1,8657,111,119,110,97,114,114,111,119,59,1,8661,101,114,4,2,76,82,6052,6063,101,102,116,65,114,114,111,119,59,1,8598,105,103,104,116,65,114,114,111,119,59,1,8599,105,4,2,59,108,6082,6084,1,978,111,110,59,1,933,105,110,103,59,1,366,99,114,59,3,55349,56496,105,108,100,101,59,1,360,109,108,5,220,1,59,6115,1,220,4,9,68,98,99,100,101,102,111,115,118,6137,6143,6148,6152,6166,6250,6255,6261,6267,97,115,104,59,1,8875,97,114,59,1,10987,121,59,1,1042,97,115,104,4,2,59,108,6161,6163,1,8873,59,1,10982,4,2,101,114,6172,6175,59,1,8897,4,3,98,116,121,6183,6188,6238,97,114,59,1,8214,4,2,59,105,6194,6196,1,8214,99,97,108,4,4,66,76,83,84,6209,6214,6220,6231,97,114,59,1,8739,105,110,101,59,1,124,101,112,97,114,97,116,111,114,59,1,10072,105,108,100,101,59,1,8768,84,104,105,110,83,112,97,99,101,59,1,8202,114,59,3,55349,56601,112,102,59,3,55349,56653,99,114,59,3,55349,56497,100,97,115,104,59,1,8874,4,5,99,101,102,111,115,6286,6292,6298,6303,6309,105,114,99,59,1,372,100,103,101,59,1,8896,114,59,3,55349,56602,112,102,59,3,55349,56654,99,114,59,3,55349,56498,4,4,102,105,111,115,6325,6330,6333,6339,114,59,3,55349,56603,59,1,926,112,102,59,3,55349,56655,99,114,59,3,55349,56499,4,9,65,73,85,97,99,102,111,115,117,6365,6370,6375,6380,6391,6405,6410,6416,6422,99,121,59,1,1071,99,121,59,1,1031,99,121,59,1,1070,99,117,116,101,5,221,1,59,6389,1,221,4,2,105,121,6397,6402,114,99,59,1,374,59,1,1067,114,59,3,55349,56604,112,102,59,3,55349,56656,99,114,59,3,55349,56500,109,108,59,1,376,4,8,72,97,99,100,101,102,111,115,6445,6450,6457,6472,6477,6501,6505,6510,99,121,59,1,1046,99,117,116,101,59,1,377,4,2,97,121,6463,6469,114,111,110,59,1,381,59,1,1047,111,116,59,1,379,4,2,114,116,6483,6497,111,87,105,100,116,104,83,112,97,99,101,59,1,8203,97,59,1,918,114,59,1,8488,112,102,59,1,8484,99,114,59,3,55349,56501,4,16,97,98,99,101,102,103,108,109,110,111,112,114,115,116,117,119,6550,6561,6568,6612,6622,6634,6645,6672,6699,6854,6870,6923,6933,6963,6974,6983,99,117,116,101,5,225,1,59,6559,1,225,114,101,118,101,59,1,259,4,6,59,69,100,105,117,121,6582,6584,6588,6591,6600,6609,1,8766,59,3,8766,819,59,1,8767,114,99,5,226,1,59,6598,1,226,116,101,5,180,1,59,6607,1,180,59,1,1072,108,105,103,5,230,1,59,6620,1,230,4,2,59,114,6628,6630,1,8289,59,3,55349,56606,114,97,118,101,5,224,1,59,6643,1,224,4,2,101,112,6651,6667,4,2,102,112,6657,6663,115,121,109,59,1,8501,104,59,1,8501,104,97,59,1,945,4,2,97,112,6678,6692,4,2,99,108,6684,6688,114,59,1,257,103,59,1,10815,5,38,1,59,6697,1,38,4,2,100,103,6705,6737,4,5,59,97,100,115,118,6717,6719,6724,6727,6734,1,8743,110,100,59,1,10837,59,1,10844,108,111,112,101,59,1,10840,59,1,10842,4,7,59,101,108,109,114,115,122,6753,6755,6758,6762,6814,6835,6848,1,8736,59,1,10660,101,59,1,8736,115,100,4,2,59,97,6770,6772,1,8737,4,8,97,98,99,100,101,102,103,104,6790,6793,6796,6799,6802,6805,6808,6811,59,1,10664,59,1,10665,59,1,10666,59,1,10667,59,1,10668,59,1,10669,59,1,10670,59,1,10671,116,4,2,59,118,6821,6823,1,8735,98,4,2,59,100,6830,6832,1,8894,59,1,10653,4,2,112,116,6841,6845,104,59,1,8738,59,1,197,97,114,114,59,1,9084,4,2,103,112,6860,6865,111,110,59,1,261,102,59,3,55349,56658,4,7,59,69,97,101,105,111,112,6886,6888,6891,6897,6900,6904,6908,1,8776,59,1,10864,99,105,114,59,1,10863,59,1,8778,100,59,1,8779,115,59,1,39,114,111,120,4,2,59,101,6917,6919,1,8776,113,59,1,8778,105,110,103,5,229,1,59,6931,1,229,4,3,99,116,121,6941,6946,6949,114,59,3,55349,56502,59,1,42,109,112,4,2,59,101,6957,6959,1,8776,113,59,1,8781,105,108,100,101,5,227,1,59,6972,1,227,109,108,5,228,1,59,6981,1,228,4,2,99,105,6989,6997,111,110,105,110,116,59,1,8755,110,116,59,1,10769,4,16,78,97,98,99,100,101,102,105,107,108,110,111,112,114,115,117,7036,7041,7119,7135,7149,7155,7219,7224,7347,7354,7463,7489,7786,7793,7814,7866,111,116,59,1,10989,4,2,99,114,7047,7094,107,4,4,99,101,112,115,7058,7064,7073,7080,111,110,103,59,1,8780,112,115,105,108,111,110,59,1,1014,114,105,109,101,59,1,8245,105,109,4,2,59,101,7088,7090,1,8765,113,59,1,8909,4,2,118,119,7100,7105,101,101,59,1,8893,101,100,4,2,59,103,7113,7115,1,8965,101,59,1,8965,114,107,4,2,59,116,7127,7129,1,9141,98,114,107,59,1,9142,4,2,111,121,7141,7146,110,103,59,1,8780,59,1,1073,113,117,111,59,1,8222,4,5,99,109,112,114,116,7167,7181,7188,7193,7199,97,117,115,4,2,59,101,7176,7178,1,8757,59,1,8757,112,116,121,118,59,1,10672,115,105,59,1,1014,110,111,117,59,1,8492,4,3,97,104,119,7207,7210,7213,59,1,946,59,1,8502,101,101,110,59,1,8812,114,59,3,55349,56607,103,4,7,99,111,115,116,117,118,119,7241,7262,7288,7305,7328,7335,7340,4,3,97,105,117,7249,7253,7258,112,59,1,8898,114,99,59,1,9711,112,59,1,8899,4,3,100,112,116,7270,7275,7281,111,116,59,1,10752,108,117,115,59,1,10753,105,109,101,115,59,1,10754,4,2,113,116,7294,7300,99,117,112,59,1,10758,97,114,59,1,9733,114,105,97,110,103,108,101,4,2,100,117,7318,7324,111,119,110,59,1,9661,112,59,1,9651,112,108,117,115,59,1,10756,101,101,59,1,8897,101,100,103,101,59,1,8896,97,114,111,119,59,1,10509,4,3,97,107,111,7362,7436,7458,4,2,99,110,7368,7432,107,4,3,108,115,116,7377,7386,7394,111,122,101,110,103,101,59,1,10731,113,117,97,114,101,59,1,9642,114,105,97,110,103,108,101,4,4,59,100,108,114,7411,7413,7419,7425,1,9652,111,119,110,59,1,9662,101,102,116,59,1,9666,105,103,104,116,59,1,9656,107,59,1,9251,4,2,49,51,7442,7454,4,2,50,52,7448,7451,59,1,9618,59,1,9617,52,59,1,9619,99,107,59,1,9608,4,2,101,111,7469,7485,4,2,59,113,7475,7478,3,61,8421,117,105,118,59,3,8801,8421,116,59,1,8976,4,4,112,116,119,120,7499,7504,7517,7523,102,59,3,55349,56659,4,2,59,116,7510,7512,1,8869,111,109,59,1,8869,116,105,101,59,1,8904,4,12,68,72,85,86,98,100,104,109,112,116,117,118,7549,7571,7597,7619,7655,7660,7682,7708,7715,7721,7728,7750,4,4,76,82,108,114,7559,7562,7565,7568,59,1,9559,59,1,9556,59,1,9558,59,1,9555,4,5,59,68,85,100,117,7583,7585,7588,7591,7594,1,9552,59,1,9574,59,1,9577,59,1,9572,59,1,9575,4,4,76,82,108,114,7607,7610,7613,7616,59,1,9565,59,1,9562,59,1,9564,59,1,9561,4,7,59,72,76,82,104,108,114,7635,7637,7640,7643,7646,7649,7652,1,9553,59,1,9580,59,1,9571,59,1,9568,59,1,9579,59,1,9570,59,1,9567,111,120,59,1,10697,4,4,76,82,108,114,7670,7673,7676,7679,59,1,9557,59,1,9554,59,1,9488,59,1,9484,4,5,59,68,85,100,117,7694,7696,7699,7702,7705,1,9472,59,1,9573,59,1,9576,59,1,9516,59,1,9524,105,110,117,115,59,1,8863,108,117,115,59,1,8862,105,109,101,115,59,1,8864,4,4,76,82,108,114,7738,7741,7744,7747,59,1,9563,59,1,9560,59,1,9496,59,1,9492,4,7,59,72,76,82,104,108,114,7766,7768,7771,7774,7777,7780,7783,1,9474,59,1,9578,59,1,9569,59,1,9566,59,1,9532,59,1,9508,59,1,9500,114,105,109,101,59,1,8245,4,2,101,118,7799,7804,118,101,59,1,728,98,97,114,5,166,1,59,7812,1,166,4,4,99,101,105,111,7824,7829,7834,7846,114,59,3,55349,56503,109,105,59,1,8271,109,4,2,59,101,7841,7843,1,8765,59,1,8909,108,4,3,59,98,104,7855,7857,7860,1,92,59,1,10693,115,117,98,59,1,10184,4,2,108,109,7872,7885,108,4,2,59,101,7879,7881,1,8226,116,59,1,8226,112,4,3,59,69,101,7894,7896,7899,1,8782,59,1,10926,4,2,59,113,7905,7907,1,8783,59,1,8783,4,15,97,99,100,101,102,104,105,108,111,114,115,116,117,119,121,7942,8021,8075,8080,8121,8126,8157,8279,8295,8430,8446,8485,8491,8707,8726,4,3,99,112,114,7950,7956,8007,117,116,101,59,1,263,4,6,59,97,98,99,100,115,7970,7972,7977,7984,7998,8003,1,8745,110,100,59,1,10820,114,99,117,112,59,1,10825,4,2,97,117,7990,7994,112,59,1,10827,112,59,1,10823,111,116,59,1,10816,59,3,8745,65024,4,2,101,111,8013,8017,116,59,1,8257,110,59,1,711,4,4,97,101,105,117,8031,8046,8056,8061,4,2,112,114,8037,8041,115,59,1,10829,111,110,59,1,269,100,105,108,5,231,1,59,8054,1,231,114,99,59,1,265,112,115,4,2,59,115,8069,8071,1,10828,109,59,1,10832,111,116,59,1,267,4,3,100,109,110,8088,8097,8104,105,108,5,184,1,59,8095,1,184,112,116,121,118,59,1,10674,116,5,162,2,59,101,8112,8114,1,162,114,100,111,116,59,1,183,114,59,3,55349,56608,4,3,99,101,105,8134,8138,8154,121,59,1,1095,99,107,4,2,59,109,8146,8148,1,10003,97,114,107,59,1,10003,59,1,967,114,4,7,59,69,99,101,102,109,115,8174,8176,8179,8258,8261,8268,8273,1,9675,59,1,10691,4,3,59,101,108,8187,8189,8193,1,710,113,59,1,8791,101,4,2,97,100,8200,8223,114,114,111,119,4,2,108,114,8210,8216,101,102,116,59,1,8634,105,103,104,116,59,1,8635,4,5,82,83,97,99,100,8235,8238,8241,8246,8252,59,1,174,59,1,9416,115,116,59,1,8859,105,114,99,59,1,8858,97,115,104,59,1,8861,59,1,8791,110,105,110,116,59,1,10768,105,100,59,1,10991,99,105,114,59,1,10690,117,98,115,4,2,59,117,8288,8290,1,9827,105,116,59,1,9827,4,4,108,109,110,112,8305,8326,8376,8400,111,110,4,2,59,101,8313,8315,1,58,4,2,59,113,8321,8323,1,8788,59,1,8788,4,2,109,112,8332,8344,97,4,2,59,116,8339,8341,1,44,59,1,64,4,3,59,102,108,8352,8354,8358,1,8705,110,59,1,8728,101,4,2,109,120,8365,8371,101,110,116,59,1,8705,101,115,59,1,8450,4,2,103,105,8382,8395,4,2,59,100,8388,8390,1,8773,111,116,59,1,10861,110,116,59,1,8750,4,3,102,114,121,8408,8412,8417,59,3,55349,56660,111,100,59,1,8720,5,169,2,59,115,8424,8426,1,169,114,59,1,8471,4,2,97,111,8436,8441,114,114,59,1,8629,115,115,59,1,10007,4,2,99,117,8452,8457,114,59,3,55349,56504,4,2,98,112,8463,8474,4,2,59,101,8469,8471,1,10959,59,1,10961,4,2,59,101,8480,8482,1,10960,59,1,10962,100,111,116,59,1,8943,4,7,100,101,108,112,114,118,119,8507,8522,8536,8550,8600,8697,8702,97,114,114,4,2,108,114,8516,8519,59,1,10552,59,1,10549,4,2,112,115,8528,8532,114,59,1,8926,99,59,1,8927,97,114,114,4,2,59,112,8545,8547,1,8630,59,1,10557,4,6,59,98,99,100,111,115,8564,8566,8573,8587,8592,8596,1,8746,114,99,97,112,59,1,10824,4,2,97,117,8579,8583,112,59,1,10822,112,59,1,10826,111,116,59,1,8845,114,59,1,10821,59,3,8746,65024,4,4,97,108,114,118,8610,8623,8663,8672,114,114,4,2,59,109,8618,8620,1,8631,59,1,10556,121,4,3,101,118,119,8632,8651,8656,113,4,2,112,115,8639,8645,114,101,99,59,1,8926,117,99,99,59,1,8927,101,101,59,1,8910,101,100,103,101,59,1,8911,101,110,5,164,1,59,8670,1,164,101,97,114,114,111,119,4,2,108,114,8684,8690,101,102,116,59,1,8630,105,103,104,116,59,1,8631,101,101,59,1,8910,101,100,59,1,8911,4,2,99,105,8713,8721,111,110,105,110,116,59,1,8754,110,116,59,1,8753,108,99,116,121,59,1,9005,4,19,65,72,97,98,99,100,101,102,104,105,106,108,111,114,115,116,117,119,122,8773,8778,8783,8821,8839,8854,8887,8914,8930,8944,9036,9041,9058,9197,9227,9258,9281,9297,9305,114,114,59,1,8659,97,114,59,1,10597,4,4,103,108,114,115,8793,8799,8805,8809,103,101,114,59,1,8224,101,116,104,59,1,8504,114,59,1,8595,104,4,2,59,118,8816,8818,1,8208,59,1,8867,4,2,107,108,8827,8834,97,114,111,119,59,1,10511,97,99,59,1,733,4,2,97,121,8845,8851,114,111,110,59,1,271,59,1,1076,4,3,59,97,111,8862,8864,8880,1,8518,4,2,103,114,8870,8876,103,101,114,59,1,8225,114,59,1,8650,116,115,101,113,59,1,10871,4,3,103,108,109,8895,8902,8907,5,176,1,59,8900,1,176,116,97,59,1,948,112,116,121,118,59,1,10673,4,2,105,114,8920,8926,115,104,116,59,1,10623,59,3,55349,56609,97,114,4,2,108,114,8938,8941,59,1,8643,59,1,8642,4,5,97,101,103,115,118,8956,8986,8989,8996,9001,109,4,3,59,111,115,8965,8967,8983,1,8900,110,100,4,2,59,115,8975,8977,1,8900,117,105,116,59,1,9830,59,1,9830,59,1,168,97,109,109,97,59,1,989,105,110,59,1,8946,4,3,59,105,111,9009,9011,9031,1,247,100,101,5,247,2,59,111,9020,9022,1,247,110,116,105,109,101,115,59,1,8903,110,120,59,1,8903,99,121,59,1,1106,99,4,2,111,114,9048,9053,114,110,59,1,8990,111,112,59,1,8973,4,5,108,112,116,117,119,9070,9076,9081,9130,9144,108,97,114,59,1,36,102,59,3,55349,56661,4,5,59,101,109,112,115,9093,9095,9109,9116,9122,1,729,113,4,2,59,100,9102,9104,1,8784,111,116,59,1,8785,105,110,117,115,59,1,8760,108,117,115,59,1,8724,113,117,97,114,101,59,1,8865,98,108,101,98,97,114,119,101,100,103,101,59,1,8966,110,4,3,97,100,104,9153,9160,9172,114,114,111,119,59,1,8595,111,119,110,97,114,114,111,119,115,59,1,8650,97,114,112,111,111,110,4,2,108,114,9184,9190,101,102,116,59,1,8643,105,103,104,116,59,1,8642,4,2,98,99,9203,9211,107,97,114,111,119,59,1,10512,4,2,111,114,9217,9222,114,110,59,1,8991,111,112,59,1,8972,4,3,99,111,116,9235,9248,9252,4,2,114,121,9241,9245,59,3,55349,56505,59,1,1109,108,59,1,10742,114,111,107,59,1,273,4,2,100,114,9264,9269,111,116,59,1,8945,105,4,2,59,102,9276,9278,1,9663,59,1,9662,4,2,97,104,9287,9292,114,114,59,1,8693,97,114,59,1,10607,97,110,103,108,101,59,1,10662,4,2,99,105,9311,9315,121,59,1,1119,103,114,97,114,114,59,1,10239,4,18,68,97,99,100,101,102,103,108,109,110,111,112,113,114,115,116,117,120,9361,9376,9398,9439,9444,9447,9462,9495,9531,9585,9598,9614,9659,9755,9771,9792,9808,9826,4,2,68,111,9367,9372,111,116,59,1,10871,116,59,1,8785,4,2,99,115,9382,9392,117,116,101,5,233,1,59,9390,1,233,116,101,114,59,1,10862,4,4,97,105,111,121,9408,9414,9430,9436,114,111,110,59,1,283,114,4,2,59,99,9421,9423,1,8790,5,234,1,59,9428,1,234,108,111,110,59,1,8789,59,1,1101,111,116,59,1,279,59,1,8519,4,2,68,114,9453,9458,111,116,59,1,8786,59,3,55349,56610,4,3,59,114,115,9470,9472,9482,1,10906,97,118,101,5,232,1,59,9480,1,232,4,2,59,100,9488,9490,1,10902,111,116,59,1,10904,4,4,59,105,108,115,9505,9507,9515,9518,1,10905,110,116,101,114,115,59,1,9191,59,1,8467,4,2,59,100,9524,9526,1,10901,111,116,59,1,10903,4,3,97,112,115,9539,9544,9564,99,114,59,1,275,116,121,4,3,59,115,118,9554,9556,9561,1,8709,101,116,59,1,8709,59,1,8709,112,4,2,49,59,9571,9583,4,2,51,52,9577,9580,59,1,8196,59,1,8197,1,8195,4,2,103,115,9591,9594,59,1,331,112,59,1,8194,4,2,103,112,9604,9609,111,110,59,1,281,102,59,3,55349,56662,4,3,97,108,115,9622,9635,9640,114,4,2,59,115,9629,9631,1,8917,108,59,1,10723,117,115,59,1,10865,105,4,3,59,108,118,9649,9651,9656,1,949,111,110,59,1,949,59,1,1013,4,4,99,115,117,118,9669,9686,9716,9747,4,2,105,111,9675,9680,114,99,59,1,8790,108,111,110,59,1,8789,4,2,105,108,9692,9696,109,59,1,8770,97,110,116,4,2,103,108,9705,9710,116,114,59,1,10902,101,115,115,59,1,10901,4,3,97,101,105,9724,9729,9734,108,115,59,1,61,115,116,59,1,8799,118,4,2,59,68,9741,9743,1,8801,68,59,1,10872,112,97,114,115,108,59,1,10725,4,2,68,97,9761,9766,111,116,59,1,8787,114,114,59,1,10609,4,3,99,100,105,9779,9783,9788,114,59,1,8495,111,116,59,1,8784,109,59,1,8770,4,2,97,104,9798,9801,59,1,951,5,240,1,59,9806,1,240,4,2,109,114,9814,9822,108,5,235,1,59,9820,1,235,111,59,1,8364,4,3,99,105,112,9834,9838,9843,108,59,1,33,115,116,59,1,8707,4,2,101,111,9849,9859,99,116,97,116,105,111,110,59,1,8496,110,101,110,116,105,97,108,101,59,1,8519,4,12,97,99,101,102,105,106,108,110,111,112,114,115,9896,9910,9914,9921,9954,9960,9967,9989,9994,10027,10036,10164,108,108,105,110,103,100,111,116,115,101,113,59,1,8786,121,59,1,1092,109,97,108,101,59,1,9792,4,3,105,108,114,9929,9935,9950,108,105,103,59,1,64259,4,2,105,108,9941,9945,103,59,1,64256,105,103,59,1,64260,59,3,55349,56611,108,105,103,59,1,64257,108,105,103,59,3,102,106,4,3,97,108,116,9975,9979,9984,116,59,1,9837,105,103,59,1,64258,110,115,59,1,9649,111,102,59,1,402,4,2,112,114,10000,10005,102,59,3,55349,56663,4,2,97,107,10011,10016,108,108,59,1,8704,4,2,59,118,10022,10024,1,8916,59,1,10969,97,114,116,105,110,116,59,1,10765,4,2,97,111,10042,10159,4,2,99,115,10048,10155,4,6,49,50,51,52,53,55,10062,10102,10114,10135,10139,10151,4,6,50,51,52,53,54,56,10076,10083,10086,10093,10096,10099,5,189,1,59,10081,1,189,59,1,8531,5,188,1,59,10091,1,188,59,1,8533,59,1,8537,59,1,8539,4,2,51,53,10108,10111,59,1,8532,59,1,8534,4,3,52,53,56,10122,10129,10132,5,190,1,59,10127,1,190,59,1,8535,59,1,8540,53,59,1,8536,4,2,54,56,10145,10148,59,1,8538,59,1,8541,56,59,1,8542,108,59,1,8260,119,110,59,1,8994,99,114,59,3,55349,56507,4,17,69,97,98,99,100,101,102,103,105,106,108,110,111,114,115,116,118,10206,10217,10247,10254,10268,10273,10358,10363,10374,10380,10385,10406,10458,10464,10470,10497,10610,4,2,59,108,10212,10214,1,8807,59,1,10892,4,3,99,109,112,10225,10231,10244,117,116,101,59,1,501,109,97,4,2,59,100,10239,10241,1,947,59,1,989,59,1,10886,114,101,118,101,59,1,287,4,2,105,121,10260,10265,114,99,59,1,285,59,1,1075,111,116,59,1,289,4,4,59,108,113,115,10283,10285,10288,10308,1,8805,59,1,8923,4,3,59,113,115,10296,10298,10301,1,8805,59,1,8807,108,97,110,116,59,1,10878,4,4,59,99,100,108,10318,10320,10324,10345,1,10878,99,59,1,10921,111,116,4,2,59,111,10332,10334,1,10880,4,2,59,108,10340,10342,1,10882,59,1,10884,4,2,59,101,10351,10354,3,8923,65024,115,59,1,10900,114,59,3,55349,56612,4,2,59,103,10369,10371,1,8811,59,1,8921,109,101,108,59,1,8503,99,121,59,1,1107,4,4,59,69,97,106,10395,10397,10400,10403,1,8823,59,1,10898,59,1,10917,59,1,10916,4,4,69,97,101,115,10416,10419,10434,10453,59,1,8809,112,4,2,59,112,10426,10428,1,10890,114,111,120,59,1,10890,4,2,59,113,10440,10442,1,10888,4,2,59,113,10448,10450,1,10888,59,1,8809,105,109,59,1,8935,112,102,59,3,55349,56664,97,118,101,59,1,96,4,2,99,105,10476,10480,114,59,1,8458,109,4,3,59,101,108,10489,10491,10494,1,8819,59,1,10894,59,1,10896,5,62,6,59,99,100,108,113,114,10512,10514,10527,10532,10538,10545,1,62,4,2,99,105,10520,10523,59,1,10919,114,59,1,10874,111,116,59,1,8919,80,97,114,59,1,10645,117,101,115,116,59,1,10876,4,5,97,100,101,108,115,10557,10574,10579,10599,10605,4,2,112,114,10563,10570,112,114,111,120,59,1,10886,114,59,1,10616,111,116,59,1,8919,113,4,2,108,113,10586,10592,101,115,115,59,1,8923,108,101,115,115,59,1,10892,101,115,115,59,1,8823,105,109,59,1,8819,4,2,101,110,10616,10626,114,116,110,101,113,113,59,3,8809,65024,69,59,3,8809,65024,4,10,65,97,98,99,101,102,107,111,115,121,10653,10658,10713,10718,10724,10760,10765,10786,10850,10875,114,114,59,1,8660,4,4,105,108,109,114,10668,10674,10678,10684,114,115,112,59,1,8202,102,59,1,189,105,108,116,59,1,8459,4,2,100,114,10690,10695,99,121,59,1,1098,4,3,59,99,119,10703,10705,10710,1,8596,105,114,59,1,10568,59,1,8621,97,114,59,1,8463,105,114,99,59,1,293,4,3,97,108,114,10732,10748,10754,114,116,115,4,2,59,117,10741,10743,1,9829,105,116,59,1,9829,108,105,112,59,1,8230,99,111,110,59,1,8889,114,59,3,55349,56613,115,4,2,101,119,10772,10779,97,114,111,119,59,1,10533,97,114,111,119,59,1,10534,4,5,97,109,111,112,114,10798,10803,10809,10839,10844,114,114,59,1,8703,116,104,116,59,1,8763,107,4,2,108,114,10816,10827,101,102,116,97,114,114,111,119,59,1,8617,105,103,104,116,97,114,114,111,119,59,1,8618,102,59,3,55349,56665,98,97,114,59,1,8213,4,3,99,108,116,10858,10863,10869,114,59,3,55349,56509,97,115,104,59,1,8463,114,111,107,59,1,295,4,2,98,112,10881,10887,117,108,108,59,1,8259,104,101,110,59,1,8208,4,15,97,99,101,102,103,105,106,109,110,111,112,113,115,116,117,10925,10936,10958,10977,10990,11001,11039,11045,11101,11192,11220,11226,11237,11285,11299,99,117,116,101,5,237,1,59,10934,1,237,4,3,59,105,121,10944,10946,10955,1,8291,114,99,5,238,1,59,10953,1,238,59,1,1080,4,2,99,120,10964,10968,121,59,1,1077,99,108,5,161,1,59,10975,1,161,4,2,102,114,10983,10986,59,1,8660,59,3,55349,56614,114,97,118,101,5,236,1,59,10999,1,236,4,4,59,105,110,111,11011,11013,11028,11034,1,8520,4,2,105,110,11019,11024,110,116,59,1,10764,116,59,1,8749,102,105,110,59,1,10716,116,97,59,1,8489,108,105,103,59,1,307,4,3,97,111,112,11053,11092,11096,4,3,99,103,116,11061,11065,11088,114,59,1,299,4,3,101,108,112,11073,11076,11082,59,1,8465,105,110,101,59,1,8464,97,114,116,59,1,8465,104,59,1,305,102,59,1,8887,101,100,59,1,437,4,5,59,99,102,111,116,11113,11115,11121,11136,11142,1,8712,97,114,101,59,1,8453,105,110,4,2,59,116,11129,11131,1,8734,105,101,59,1,10717,100,111,116,59,1,305,4,5,59,99,101,108,112,11154,11156,11161,11179,11186,1,8747,97,108,59,1,8890,4,2,103,114,11167,11173,101,114,115,59,1,8484,99,97,108,59,1,8890,97,114,104,107,59,1,10775,114,111,100,59,1,10812,4,4,99,103,112,116,11202,11206,11211,11216,121,59,1,1105,111,110,59,1,303,102,59,3,55349,56666,97,59,1,953,114,111,100,59,1,10812,117,101,115,116,5,191,1,59,11235,1,191,4,2,99,105,11243,11248,114,59,3,55349,56510,110,4,5,59,69,100,115,118,11261,11263,11266,11271,11282,1,8712,59,1,8953,111,116,59,1,8949,4,2,59,118,11277,11279,1,8948,59,1,8947,59,1,8712,4,2,59,105,11291,11293,1,8290,108,100,101,59,1,297,4,2,107,109,11305,11310,99,121,59,1,1110,108,5,239,1,59,11316,1,239,4,6,99,102,109,111,115,117,11332,11346,11351,11357,11363,11380,4,2,105,121,11338,11343,114,99,59,1,309,59,1,1081,114,59,3,55349,56615,97,116,104,59,1,567,112,102,59,3,55349,56667,4,2,99,101,11369,11374,114,59,3,55349,56511,114,99,121,59,1,1112,107,99,121,59,1,1108,4,8,97,99,102,103,104,106,111,115,11404,11418,11433,11438,11445,11450,11455,11461,112,112,97,4,2,59,118,11413,11415,1,954,59,1,1008,4,2,101,121,11424,11430,100,105,108,59,1,311,59,1,1082,114,59,3,55349,56616,114,101,101,110,59,1,312,99,121,59,1,1093,99,121,59,1,1116,112,102,59,3,55349,56668,99,114,59,3,55349,56512,4,23,65,66,69,72,97,98,99,100,101,102,103,104,106,108,109,110,111,112,114,115,116,117,118,11515,11538,11544,11555,11560,11721,11780,11818,11868,12136,12160,12171,12203,12208,12246,12275,12327,12509,12523,12569,12641,12732,12752,4,3,97,114,116,11523,11528,11532,114,114,59,1,8666,114,59,1,8656,97,105,108,59,1,10523,97,114,114,59,1,10510,4,2,59,103,11550,11552,1,8806,59,1,10891,97,114,59,1,10594,4,9,99,101,103,109,110,112,113,114,116,11580,11586,11594,11600,11606,11624,11627,11636,11694,117,116,101,59,1,314,109,112,116,121,118,59,1,10676,114,97,110,59,1,8466,98,100,97,59,1,955,103,4,3,59,100,108,11615,11617,11620,1,10216,59,1,10641,101,59,1,10216,59,1,10885,117,111,5,171,1,59,11634,1,171,114,4,8,59,98,102,104,108,112,115,116,11655,11657,11669,11673,11677,11681,11685,11690,1,8592,4,2,59,102,11663,11665,1,8676,115,59,1,10527,115,59,1,10525,107,59,1,8617,112,59,1,8619,108,59,1,10553,105,109,59,1,10611,108,59,1,8610,4,3,59,97,101,11702,11704,11709,1,10923,105,108,59,1,10521,4,2,59,115,11715,11717,1,10925,59,3,10925,65024,4,3,97,98,114,11729,11734,11739,114,114,59,1,10508,114,107,59,1,10098,4,2,97,107,11745,11758,99,4,2,101,107,11752,11755,59,1,123,59,1,91,4,2,101,115,11764,11767,59,1,10635,108,4,2,100,117,11774,11777,59,1,10639,59,1,10637,4,4,97,101,117,121,11790,11796,11811,11815,114,111,110,59,1,318,4,2,100,105,11802,11807,105,108,59,1,316,108,59,1,8968,98,59,1,123,59,1,1083,4,4,99,113,114,115,11828,11832,11845,11864,97,59,1,10550,117,111,4,2,59,114,11840,11842,1,8220,59,1,8222,4,2,100,117,11851,11857,104,97,114,59,1,10599,115,104,97,114,59,1,10571,104,59,1,8626,4,5,59,102,103,113,115,11880,11882,12008,12011,12031,1,8804,116,4,5,97,104,108,114,116,11895,11913,11935,11947,11996,114,114,111,119,4,2,59,116,11905,11907,1,8592,97,105,108,59,1,8610,97,114,112,111,111,110,4,2,100,117,11925,11931,111,119,110,59,1,8637,112,59,1,8636,101,102,116,97,114,114,111,119,115,59,1,8647,105,103,104,116,4,3,97,104,115,11959,11974,11984,114,114,111,119,4,2,59,115,11969,11971,1,8596,59,1,8646,97,114,112,111,111,110,115,59,1,8651,113,117,105,103,97,114,114,111,119,59,1,8621,104,114,101,101,116,105,109,101,115,59,1,8907,59,1,8922,4,3,59,113,115,12019,12021,12024,1,8804,59,1,8806,108,97,110,116,59,1,10877,4,5,59,99,100,103,115,12043,12045,12049,12070,12083,1,10877,99,59,1,10920,111,116,4,2,59,111,12057,12059,1,10879,4,2,59,114,12065,12067,1,10881,59,1,10883,4,2,59,101,12076,12079,3,8922,65024,115,59,1,10899,4,5,97,100,101,103,115,12095,12103,12108,12126,12131,112,112,114,111,120,59,1,10885,111,116,59,1,8918,113,4,2,103,113,12115,12120,116,114,59,1,8922,103,116,114,59,1,10891,116,114,59,1,8822,105,109,59,1,8818,4,3,105,108,114,12144,12150,12156,115,104,116,59,1,10620,111,111,114,59,1,8970,59,3,55349,56617,4,2,59,69,12166,12168,1,8822,59,1,10897,4,2,97,98,12177,12198,114,4,2,100,117,12184,12187,59,1,8637,4,2,59,108,12193,12195,1,8636,59,1,10602,108,107,59,1,9604,99,121,59,1,1113,4,5,59,97,99,104,116,12220,12222,12227,12235,12241,1,8810,114,114,59,1,8647,111,114,110,101,114,59,1,8990,97,114,100,59,1,10603,114,105,59,1,9722,4,2,105,111,12252,12258,100,111,116,59,1,320,117,115,116,4,2,59,97,12267,12269,1,9136,99,104,101,59,1,9136,4,4,69,97,101,115,12285,12288,12303,12322,59,1,8808,112,4,2,59,112,12295,12297,1,10889,114,111,120,59,1,10889,4,2,59,113,12309,12311,1,10887,4,2,59,113,12317,12319,1,10887,59,1,8808,105,109,59,1,8934,4,8,97,98,110,111,112,116,119,122,12345,12359,12364,12421,12446,12467,12474,12490,4,2,110,114,12351,12355,103,59,1,10220,114,59,1,8701,114,107,59,1,10214,103,4,3,108,109,114,12373,12401,12409,101,102,116,4,2,97,114,12382,12389,114,114,111,119,59,1,10229,105,103,104,116,97,114,114,111,119,59,1,10231,97,112,115,116,111,59,1,10236,105,103,104,116,97,114,114,111,119,59,1,10230,112,97,114,114,111,119,4,2,108,114,12433,12439,101,102,116,59,1,8619,105,103,104,116,59,1,8620,4,3,97,102,108,12454,12458,12462,114,59,1,10629,59,3,55349,56669,117,115,59,1,10797,105,109,101,115,59,1,10804,4,2,97,98,12480,12485,115,116,59,1,8727,97,114,59,1,95,4,3,59,101,102,12498,12500,12506,1,9674,110,103,101,59,1,9674,59,1,10731,97,114,4,2,59,108,12517,12519,1,40,116,59,1,10643,4,5,97,99,104,109,116,12535,12540,12548,12561,12564,114,114,59,1,8646,111,114,110,101,114,59,1,8991,97,114,4,2,59,100,12556,12558,1,8651,59,1,10605,59,1,8206,114,105,59,1,8895,4,6,97,99,104,105,113,116,12583,12589,12594,12597,12614,12635,113,117,111,59,1,8249,114,59,3,55349,56513,59,1,8624,109,4,3,59,101,103,12606,12608,12611,1,8818,59,1,10893,59,1,10895,4,2,98,117,12620,12623,59,1,91,111,4,2,59,114,12630,12632,1,8216,59,1,8218,114,111,107,59,1,322,5,60,8,59,99,100,104,105,108,113,114,12660,12662,12675,12680,12686,12692,12698,12705,1,60,4,2,99,105,12668,12671,59,1,10918,114,59,1,10873,111,116,59,1,8918,114,101,101,59,1,8907,109,101,115,59,1,8905,97,114,114,59,1,10614,117,101,115,116,59,1,10875,4,2,80,105,12711,12716,97,114,59,1,10646,4,3,59,101,102,12724,12726,12729,1,9667,59,1,8884,59,1,9666,114,4,2,100,117,12739,12746,115,104,97,114,59,1,10570,104,97,114,59,1,10598,4,2,101,110,12758,12768,114,116,110,101,113,113,59,3,8808,65024,69,59,3,8808,65024,4,14,68,97,99,100,101,102,104,105,108,110,111,112,115,117,12803,12809,12893,12908,12914,12928,12933,12937,13011,13025,13032,13049,13052,13069,68,111,116,59,1,8762,4,4,99,108,112,114,12819,12827,12849,12887,114,5,175,1,59,12825,1,175,4,2,101,116,12833,12836,59,1,9794,4,2,59,101,12842,12844,1,10016,115,101,59,1,10016,4,2,59,115,12855,12857,1,8614,116,111,4,4,59,100,108,117,12869,12871,12877,12883,1,8614,111,119,110,59,1,8615,101,102,116,59,1,8612,112,59,1,8613,107,101,114,59,1,9646,4,2,111,121,12899,12905,109,109,97,59,1,10793,59,1,1084,97,115,104,59,1,8212,97,115,117,114,101,100,97,110,103,108,101,59,1,8737,114,59,3,55349,56618,111,59,1,8487,4,3,99,100,110,12945,12954,12985,114,111,5,181,1,59,12952,1,181,4,4,59,97,99,100,12964,12966,12971,12976,1,8739,115,116,59,1,42,105,114,59,1,10992,111,116,5,183,1,59,12983,1,183,117,115,4,3,59,98,100,12995,12997,13000,1,8722,59,1,8863,4,2,59,117,13006,13008,1,8760,59,1,10794,4,2,99,100,13017,13021,112,59,1,10971,114,59,1,8230,112,108,117,115,59,1,8723,4,2,100,112,13038,13044,101,108,115,59,1,8871,102,59,3,55349,56670,59,1,8723,4,2,99,116,13058,13063,114,59,3,55349,56514,112,111,115,59,1,8766,4,3,59,108,109,13077,13079,13087,1,956,116,105,109,97,112,59,1,8888,97,112,59,1,8888,4,24,71,76,82,86,97,98,99,100,101,102,103,104,105,106,108,109,111,112,114,115,116,117,118,119,13142,13165,13217,13229,13247,13330,13359,13414,13420,13508,13513,13579,13602,13626,13631,13762,13767,13855,13936,13995,14214,14285,14312,14432,4,2,103,116,13148,13152,59,3,8921,824,4,2,59,118,13158,13161,3,8811,8402,59,3,8811,824,4,3,101,108,116,13173,13200,13204,102,116,4,2,97,114,13181,13188,114,114,111,119,59,1,8653,105,103,104,116,97,114,114,111,119,59,1,8654,59,3,8920,824,4,2,59,118,13210,13213,3,8810,8402,59,3,8810,824,105,103,104,116,97,114,114,111,119,59,1,8655,4,2,68,100,13235,13241,97,115,104,59,1,8879,97,115,104,59,1,8878,4,5,98,99,110,112,116,13259,13264,13270,13275,13308,108,97,59,1,8711,117,116,101,59,1,324,103,59,3,8736,8402,4,5,59,69,105,111,112,13287,13289,13293,13298,13302,1,8777,59,3,10864,824,100,59,3,8779,824,115,59,1,329,114,111,120,59,1,8777,117,114,4,2,59,97,13316,13318,1,9838,108,4,2,59,115,13325,13327,1,9838,59,1,8469,4,2,115,117,13336,13344,112,5,160,1,59,13342,1,160,109,112,4,2,59,101,13352,13355,3,8782,824,59,3,8783,824,4,5,97,101,111,117,121,13371,13385,13391,13407,13411,4,2,112,114,13377,13380,59,1,10819,111,110,59,1,328,100,105,108,59,1,326,110,103,4,2,59,100,13399,13401,1,8775,111,116,59,3,10861,824,112,59,1,10818,59,1,1085,97,115,104,59,1,8211,4,7,59,65,97,100,113,115,120,13436,13438,13443,13466,13472,13478,13494,1,8800,114,114,59,1,8663,114,4,2,104,114,13450,13454,107,59,1,10532,4,2,59,111,13460,13462,1,8599,119,59,1,8599,111,116,59,3,8784,824,117,105,118,59,1,8802,4,2,101,105,13484,13489,97,114,59,1,10536,109,59,3,8770,824,105,115,116,4,2,59,115,13503,13505,1,8708,59,1,8708,114,59,3,55349,56619,4,4,69,101,115,116,13523,13527,13563,13568,59,3,8807,824,4,3,59,113,115,13535,13537,13559,1,8817,4,3,59,113,115,13545,13547,13551,1,8817,59,3,8807,824,108,97,110,116,59,3,10878,824,59,3,10878,824,105,109,59,1,8821,4,2,59,114,13574,13576,1,8815,59,1,8815,4,3,65,97,112,13587,13592,13597,114,114,59,1,8654,114,114,59,1,8622,97,114,59,1,10994,4,3,59,115,118,13610,13612,13623,1,8715,4,2,59,100,13618,13620,1,8956,59,1,8954,59,1,8715,99,121,59,1,1114,4,7,65,69,97,100,101,115,116,13647,13652,13656,13661,13665,13737,13742,114,114,59,1,8653,59,3,8806,824,114,114,59,1,8602,114,59,1,8229,4,4,59,102,113,115,13675,13677,13703,13725,1,8816,116,4,2,97,114,13684,13691,114,114,111,119,59,1,8602,105,103,104,116,97,114,114,111,119,59,1,8622,4,3,59,113,115,13711,13713,13717,1,8816,59,3,8806,824,108,97,110,116,59,3,10877,824,4,2,59,115,13731,13734,3,10877,824,59,1,8814,105,109,59,1,8820,4,2,59,114,13748,13750,1,8814,105,4,2,59,101,13757,13759,1,8938,59,1,8940,105,100,59,1,8740,4,2,112,116,13773,13778,102,59,3,55349,56671,5,172,3,59,105,110,13787,13789,13829,1,172,110,4,4,59,69,100,118,13800,13802,13806,13812,1,8713,59,3,8953,824,111,116,59,3,8949,824,4,3,97,98,99,13820,13823,13826,59,1,8713,59,1,8951,59,1,8950,105,4,2,59,118,13836,13838,1,8716,4,3,97,98,99,13846,13849,13852,59,1,8716,59,1,8958,59,1,8957,4,3,97,111,114,13863,13892,13899,114,4,4,59,97,115,116,13874,13876,13883,13888,1,8742,108,108,101,108,59,1,8742,108,59,3,11005,8421,59,3,8706,824,108,105,110,116,59,1,10772,4,3,59,99,101,13907,13909,13914,1,8832,117,101,59,1,8928,4,2,59,99,13920,13923,3,10927,824,4,2,59,101,13929,13931,1,8832,113,59,3,10927,824,4,4,65,97,105,116,13946,13951,13971,13982,114,114,59,1,8655,114,114,4,3,59,99,119,13961,13963,13967,1,8603,59,3,10547,824,59,3,8605,824,103,104,116,97,114,114,111,119,59,1,8603,114,105,4,2,59,101,13990,13992,1,8939,59,1,8941,4,7,99,104,105,109,112,113,117,14011,14036,14060,14080,14085,14090,14106,4,4,59,99,101,114,14021,14023,14028,14032,1,8833,117,101,59,1,8929,59,3,10928,824,59,3,55349,56515,111,114,116,4,2,109,112,14045,14050,105,100,59,1,8740,97,114,97,108,108,101,108,59,1,8742,109,4,2,59,101,14067,14069,1,8769,4,2,59,113,14075,14077,1,8772,59,1,8772,105,100,59,1,8740,97,114,59,1,8742,115,117,4,2,98,112,14098,14102,101,59,1,8930,101,59,1,8931,4,3,98,99,112,14114,14157,14171,4,4,59,69,101,115,14124,14126,14130,14133,1,8836,59,3,10949,824,59,1,8840,101,116,4,2,59,101,14141,14144,3,8834,8402,113,4,2,59,113,14151,14153,1,8840,59,3,10949,824,99,4,2,59,101,14164,14166,1,8833,113,59,3,10928,824,4,4,59,69,101,115,14181,14183,14187,14190,1,8837,59,3,10950,824,59,1,8841,101,116,4,2,59,101,14198,14201,3,8835,8402,113,4,2,59,113,14208,14210,1,8841,59,3,10950,824,4,4,103,105,108,114,14224,14228,14238,14242,108,59,1,8825,108,100,101,5,241,1,59,14236,1,241,103,59,1,8824,105,97,110,103,108,101,4,2,108,114,14254,14269,101,102,116,4,2,59,101,14263,14265,1,8938,113,59,1,8940,105,103,104,116,4,2,59,101,14279,14281,1,8939,113,59,1,8941,4,2,59,109,14291,14293,1,957,4,3,59,101,115,14301,14303,14308,1,35,114,111,59,1,8470,112,59,1,8199,4,9,68,72,97,100,103,105,108,114,115,14332,14338,14344,14349,14355,14369,14376,14408,14426,97,115,104,59,1,8877,97,114,114,59,1,10500,112,59,3,8781,8402,97,115,104,59,1,8876,4,2,101,116,14361,14365,59,3,8805,8402,59,3,62,8402,110,102,105,110,59,1,10718,4,3,65,101,116,14384,14389,14393,114,114,59,1,10498,59,3,8804,8402,4,2,59,114,14399,14402,3,60,8402,105,101,59,3,8884,8402,4,2,65,116,14414,14419,114,114,59,1,10499,114,105,101,59,3,8885,8402,105,109,59,3,8764,8402,4,3,65,97,110,14440,14445,14468,114,114,59,1,8662,114,4,2,104,114,14452,14456,107,59,1,10531,4,2,59,111,14462,14464,1,8598,119,59,1,8598,101,97,114,59,1,10535,4,18,83,97,99,100,101,102,103,104,105,108,109,111,112,114,115,116,117,118,14512,14515,14535,14560,14597,14603,14618,14643,14657,14662,14701,14741,14747,14769,14851,14877,14907,14916,59,1,9416,4,2,99,115,14521,14531,117,116,101,5,243,1,59,14529,1,243,116,59,1,8859,4,2,105,121,14541,14557,114,4,2,59,99,14548,14550,1,8858,5,244,1,59,14555,1,244,59,1,1086,4,5,97,98,105,111,115,14572,14577,14583,14587,14591,115,104,59,1,8861,108,97,99,59,1,337,118,59,1,10808,116,59,1,8857,111,108,100,59,1,10684,108,105,103,59,1,339,4,2,99,114,14609,14614,105,114,59,1,10687,59,3,55349,56620,4,3,111,114,116,14626,14630,14640,110,59,1,731,97,118,101,5,242,1,59,14638,1,242,59,1,10689,4,2,98,109,14649,14654,97,114,59,1,10677,59,1,937,110,116,59,1,8750,4,4,97,99,105,116,14672,14677,14693,14698,114,114,59,1,8634,4,2,105,114,14683,14687,114,59,1,10686,111,115,115,59,1,10683,110,101,59,1,8254,59,1,10688,4,3,97,101,105,14709,14714,14719,99,114,59,1,333,103,97,59,1,969,4,3,99,100,110,14727,14733,14736,114,111,110,59,1,959,59,1,10678,117,115,59,1,8854,112,102,59,3,55349,56672,4,3,97,101,108,14755,14759,14764,114,59,1,10679,114,112,59,1,10681,117,115,59,1,8853,4,7,59,97,100,105,111,115,118,14785,14787,14792,14831,14837,14841,14848,1,8744,114,114,59,1,8635,4,4,59,101,102,109,14802,14804,14817,14824,1,10845,114,4,2,59,111,14811,14813,1,8500,102,59,1,8500,5,170,1,59,14822,1,170,5,186,1,59,14829,1,186,103,111,102,59,1,8886,114,59,1,10838,108,111,112,101,59,1,10839,59,1,10843,4,3,99,108,111,14859,14863,14873,114,59,1,8500,97,115,104,5,248,1,59,14871,1,248,108,59,1,8856,105,4,2,108,109,14884,14893,100,101,5,245,1,59,14891,1,245,101,115,4,2,59,97,14901,14903,1,8855,115,59,1,10806,109,108,5,246,1,59,14914,1,246,98,97,114,59,1,9021,4,12,97,99,101,102,104,105,108,109,111,114,115,117,14948,14992,14996,15033,15038,15068,15090,15189,15192,15222,15427,15441,114,4,4,59,97,115,116,14959,14961,14976,14989,1,8741,5,182,2,59,108,14968,14970,1,182,108,101,108,59,1,8741,4,2,105,108,14982,14986,109,59,1,10995,59,1,11005,59,1,8706,121,59,1,1087,114,4,5,99,105,109,112,116,15009,15014,15019,15024,15027,110,116,59,1,37,111,100,59,1,46,105,108,59,1,8240,59,1,8869,101,110,107,59,1,8241,114,59,3,55349,56621,4,3,105,109,111,15046,15057,15063,4,2,59,118,15052,15054,1,966,59,1,981,109,97,116,59,1,8499,110,101,59,1,9742,4,3,59,116,118,15076,15078,15087,1,960,99,104,102,111,114,107,59,1,8916,59,1,982,4,2,97,117,15096,15119,110,4,2,99,107,15103,15115,107,4,2,59,104,15110,15112,1,8463,59,1,8462,118,59,1,8463,115,4,9,59,97,98,99,100,101,109,115,116,15140,15142,15148,15151,15156,15168,15171,15179,15184,1,43,99,105,114,59,1,10787,59,1,8862,105,114,59,1,10786,4,2,111,117,15162,15165,59,1,8724,59,1,10789,59,1,10866,110,5,177,1,59,15177,1,177,105,109,59,1,10790,119,111,59,1,10791,59,1,177,4,3,105,112,117,15200,15208,15213,110,116,105,110,116,59,1,10773,102,59,3,55349,56673,110,100,5,163,1,59,15220,1,163,4,10,59,69,97,99,101,105,110,111,115,117,15244,15246,15249,15253,15258,15334,15347,15367,15416,15421,1,8826,59,1,10931,112,59,1,10935,117,101,59,1,8828,4,2,59,99,15264,15266,1,10927,4,6,59,97,99,101,110,115,15280,15282,15290,15299,15303,15329,1,8826,112,112,114,111,120,59,1,10935,117,114,108,121,101,113,59,1,8828,113,59,1,10927,4,3,97,101,115,15311,15319,15324,112,112,114,111,120,59,1,10937,113,113,59,1,10933,105,109,59,1,8936,105,109,59,1,8830,109,101,4,2,59,115,15342,15344,1,8242,59,1,8473,4,3,69,97,115,15355,15358,15362,59,1,10933,112,59,1,10937,105,109,59,1,8936,4,3,100,102,112,15375,15378,15404,59,1,8719,4,3,97,108,115,15386,15392,15398,108,97,114,59,1,9006,105,110,101,59,1,8978,117,114,102,59,1,8979,4,2,59,116,15410,15412,1,8733,111,59,1,8733,105,109,59,1,8830,114,101,108,59,1,8880,4,2,99,105,15433,15438,114,59,3,55349,56517,59,1,968,110,99,115,112,59,1,8200,4,6,102,105,111,112,115,117,15462,15467,15472,15478,15485,15491,114,59,3,55349,56622,110,116,59,1,10764,112,102,59,3,55349,56674,114,105,109,101,59,1,8279,99,114,59,3,55349,56518,4,3,97,101,111,15499,15520,15534,116,4,2,101,105,15506,15515,114,110,105,111,110,115,59,1,8461,110,116,59,1,10774,115,116,4,2,59,101,15528,15530,1,63,113,59,1,8799,116,5,34,1,59,15540,1,34,4,21,65,66,72,97,98,99,100,101,102,104,105,108,109,110,111,112,114,115,116,117,120,15586,15609,15615,15620,15796,15855,15893,15931,15977,16001,16039,16183,16204,16222,16228,16285,16312,16318,16363,16408,16416,4,3,97,114,116,15594,15599,15603,114,114,59,1,8667,114,59,1,8658,97,105,108,59,1,10524,97,114,114,59,1,10511,97,114,59,1,10596,4,7,99,100,101,110,113,114,116,15636,15651,15656,15664,15687,15696,15770,4,2,101,117,15642,15646,59,3,8765,817,116,101,59,1,341,105,99,59,1,8730,109,112,116,121,118,59,1,10675,103,4,4,59,100,101,108,15675,15677,15680,15683,1,10217,59,1,10642,59,1,10661,101,59,1,10217,117,111,5,187,1,59,15694,1,187,114,4,11,59,97,98,99,102,104,108,112,115,116,119,15721,15723,15727,15739,15742,15746,15750,15754,15758,15763,15767,1,8594,112,59,1,10613,4,2,59,102,15733,15735,1,8677,115,59,1,10528,59,1,10547,115,59,1,10526,107,59,1,8618,112,59,1,8620,108,59,1,10565,105,109,59,1,10612,108,59,1,8611,59,1,8605,4,2,97,105,15776,15781,105,108,59,1,10522,111,4,2,59,110,15788,15790,1,8758,97,108,115,59,1,8474,4,3,97,98,114,15804,15809,15814,114,114,59,1,10509,114,107,59,1,10099,4,2,97,107,15820,15833,99,4,2,101,107,15827,15830,59,1,125,59,1,93,4,2,101,115,15839,15842,59,1,10636,108,4,2,100,117,15849,15852,59,1,10638,59,1,10640,4,4,97,101,117,121,15865,15871,15886,15890,114,111,110,59,1,345,4,2,100,105,15877,15882,105,108,59,1,343,108,59,1,8969,98,59,1,125,59,1,1088,4,4,99,108,113,115,15903,15907,15914,15927,97,59,1,10551,100,104,97,114,59,1,10601,117,111,4,2,59,114,15922,15924,1,8221,59,1,8221,104,59,1,8627,4,3,97,99,103,15939,15966,15970,108,4,4,59,105,112,115,15950,15952,15957,15963,1,8476,110,101,59,1,8475,97,114,116,59,1,8476,59,1,8477,116,59,1,9645,5,174,1,59,15975,1,174,4,3,105,108,114,15985,15991,15997,115,104,116,59,1,10621,111,111,114,59,1,8971,59,3,55349,56623,4,2,97,111,16007,16028,114,4,2,100,117,16014,16017,59,1,8641,4,2,59,108,16023,16025,1,8640,59,1,10604,4,2,59,118,16034,16036,1,961,59,1,1009,4,3,103,110,115,16047,16167,16171,104,116,4,6,97,104,108,114,115,116,16063,16081,16103,16130,16143,16155,114,114,111,119,4,2,59,116,16073,16075,1,8594,97,105,108,59,1,8611,97,114,112,111,111,110,4,2,100,117,16093,16099,111,119,110,59,1,8641,112,59,1,8640,101,102,116,4,2,97,104,16112,16120,114,114,111,119,115,59,1,8644,97,114,112,111,111,110,115,59,1,8652,105,103,104,116,97,114,114,111,119,115,59,1,8649,113,117,105,103,97,114,114,111,119,59,1,8605,104,114,101,101,116,105,109,101,115,59,1,8908,103,59,1,730,105,110,103,100,111,116,115,101,113,59,1,8787,4,3,97,104,109,16191,16196,16201,114,114,59,1,8644,97,114,59,1,8652,59,1,8207,111,117,115,116,4,2,59,97,16214,16216,1,9137,99,104,101,59,1,9137,109,105,100,59,1,10990,4,4,97,98,112,116,16238,16252,16257,16278,4,2,110,114,16244,16248,103,59,1,10221,114,59,1,8702,114,107,59,1,10215,4,3,97,102,108,16265,16269,16273,114,59,1,10630,59,3,55349,56675,117,115,59,1,10798,105,109,101,115,59,1,10805,4,2,97,112,16291,16304,114,4,2,59,103,16298,16300,1,41,116,59,1,10644,111,108,105,110,116,59,1,10770,97,114,114,59,1,8649,4,4,97,99,104,113,16328,16334,16339,16342,113,117,111,59,1,8250,114,59,3,55349,56519,59,1,8625,4,2,98,117,16348,16351,59,1,93,111,4,2,59,114,16358,16360,1,8217,59,1,8217,4,3,104,105,114,16371,16377,16383,114,101,101,59,1,8908,109,101,115,59,1,8906,105,4,4,59,101,102,108,16394,16396,16399,16402,1,9657,59,1,8885,59,1,9656,116,114,105,59,1,10702,108,117,104,97,114,59,1,10600,59,1,8478,4,19,97,98,99,100,101,102,104,105,108,109,111,112,113,114,115,116,117,119,122,16459,16466,16472,16572,16590,16672,16687,16746,16844,16850,16924,16963,16988,17115,17121,17154,17206,17614,17656,99,117,116,101,59,1,347,113,117,111,59,1,8218,4,10,59,69,97,99,101,105,110,112,115,121,16494,16496,16499,16513,16518,16531,16536,16556,16564,16569,1,8827,59,1,10932,4,2,112,114,16505,16508,59,1,10936,111,110,59,1,353,117,101,59,1,8829,4,2,59,100,16524,16526,1,10928,105,108,59,1,351,114,99,59,1,349,4,3,69,97,115,16544,16547,16551,59,1,10934,112,59,1,10938,105,109,59,1,8937,111,108,105,110,116,59,1,10771,105,109,59,1,8831,59,1,1089,111,116,4,3,59,98,101,16582,16584,16587,1,8901,59,1,8865,59,1,10854,4,7,65,97,99,109,115,116,120,16606,16611,16634,16642,16646,16652,16668,114,114,59,1,8664,114,4,2,104,114,16618,16622,107,59,1,10533,4,2,59,111,16628,16630,1,8600,119,59,1,8600,116,5,167,1,59,16640,1,167,105,59,1,59,119,97,114,59,1,10537,109,4,2,105,110,16659,16665,110,117,115,59,1,8726,59,1,8726,116,59,1,10038,114,4,2,59,111,16679,16682,3,55349,56624,119,110,59,1,8994,4,4,97,99,111,121,16697,16702,16716,16739,114,112,59,1,9839,4,2,104,121,16708,16713,99,121,59,1,1097,59,1,1096,114,116,4,2,109,112,16724,16729,105,100,59,1,8739,97,114,97,108,108,101,108,59,1,8741,5,173,1,59,16744,1,173,4,2,103,109,16752,16770,109,97,4,3,59,102,118,16762,16764,16767,1,963,59,1,962,59,1,962,4,8,59,100,101,103,108,110,112,114,16788,16790,16795,16806,16817,16828,16832,16838,1,8764,111,116,59,1,10858,4,2,59,113,16801,16803,1,8771,59,1,8771,4,2,59,69,16812,16814,1,10910,59,1,10912,4,2,59,69,16823,16825,1,10909,59,1,10911,101,59,1,8774,108,117,115,59,1,10788,97,114,114,59,1,10610,97,114,114,59,1,8592,4,4,97,101,105,116,16860,16883,16891,16904,4,2,108,115,16866,16878,108,115,101,116,109,105,110,117,115,59,1,8726,104,112,59,1,10803,112,97,114,115,108,59,1,10724,4,2,100,108,16897,16900,59,1,8739,101,59,1,8995,4,2,59,101,16910,16912,1,10922,4,2,59,115,16918,16920,1,10924,59,3,10924,65024,4,3,102,108,112,16932,16938,16958,116,99,121,59,1,1100,4,2,59,98,16944,16946,1,47,4,2,59,97,16952,16954,1,10692,114,59,1,9023,102,59,3,55349,56676,97,4,2,100,114,16970,16985,101,115,4,2,59,117,16978,16980,1,9824,105,116,59,1,9824,59,1,8741,4,3,99,115,117,16996,17028,17089,4,2,97,117,17002,17015,112,4,2,59,115,17009,17011,1,8851,59,3,8851,65024,112,4,2,59,115,17022,17024,1,8852,59,3,8852,65024,117,4,2,98,112,17035,17062,4,3,59,101,115,17043,17045,17048,1,8847,59,1,8849,101,116,4,2,59,101,17056,17058,1,8847,113,59,1,8849,4,3,59,101,115,17070,17072,17075,1,8848,59,1,8850,101,116,4,2,59,101,17083,17085,1,8848,113,59,1,8850,4,3,59,97,102,17097,17099,17112,1,9633,114,4,2,101,102,17106,17109,59,1,9633,59,1,9642,59,1,9642,97,114,114,59,1,8594,4,4,99,101,109,116,17131,17136,17142,17148,114,59,3,55349,56520,116,109,110,59,1,8726,105,108,101,59,1,8995,97,114,102,59,1,8902,4,2,97,114,17160,17172,114,4,2,59,102,17167,17169,1,9734,59,1,9733,4,2,97,110,17178,17202,105,103,104,116,4,2,101,112,17188,17197,112,115,105,108,111,110,59,1,1013,104,105,59,1,981,115,59,1,175,4,5,98,99,109,110,112,17218,17351,17420,17423,17427,4,9,59,69,100,101,109,110,112,114,115,17238,17240,17243,17248,17261,17267,17279,17285,17291,1,8834,59,1,10949,111,116,59,1,10941,4,2,59,100,17254,17256,1,8838,111,116,59,1,10947,117,108,116,59,1,10945,4,2,69,101,17273,17276,59,1,10955,59,1,8842,108,117,115,59,1,10943,97,114,114,59,1,10617,4,3,101,105,117,17299,17335,17339,116,4,3,59,101,110,17308,17310,17322,1,8834,113,4,2,59,113,17317,17319,1,8838,59,1,10949,101,113,4,2,59,113,17330,17332,1,8842,59,1,10955,109,59,1,10951,4,2,98,112,17345,17348,59,1,10965,59,1,10963,99,4,6,59,97,99,101,110,115,17366,17368,17376,17385,17389,17415,1,8827,112,112,114,111,120,59,1,10936,117,114,108,121,101,113,59,1,8829,113,59,1,10928,4,3,97,101,115,17397,17405,17410,112,112,114,111,120,59,1,10938,113,113,59,1,10934,105,109,59,1,8937,105,109,59,1,8831,59,1,8721,103,59,1,9834,4,13,49,50,51,59,69,100,101,104,108,109,110,112,115,17455,17462,17469,17476,17478,17481,17496,17509,17524,17530,17536,17548,17554,5,185,1,59,17460,1,185,5,178,1,59,17467,1,178,5,179,1,59,17474,1,179,1,8835,59,1,10950,4,2,111,115,17487,17491,116,59,1,10942,117,98,59,1,10968,4,2,59,100,17502,17504,1,8839,111,116,59,1,10948,115,4,2,111,117,17516,17520,108,59,1,10185,98,59,1,10967,97,114,114,59,1,10619,117,108,116,59,1,10946,4,2,69,101,17542,17545,59,1,10956,59,1,8843,108,117,115,59,1,10944,4,3,101,105,117,17562,17598,17602,116,4,3,59,101,110,17571,17573,17585,1,8835,113,4,2,59,113,17580,17582,1,8839,59,1,10950,101,113,4,2,59,113,17593,17595,1,8843,59,1,10956,109,59,1,10952,4,2,98,112,17608,17611,59,1,10964,59,1,10966,4,3,65,97,110,17622,17627,17650,114,114,59,1,8665,114,4,2,104,114,17634,17638,107,59,1,10534,4,2,59,111,17644,17646,1,8601,119,59,1,8601,119,97,114,59,1,10538,108,105,103,5,223,1,59,17664,1,223,4,13,97,98,99,100,101,102,104,105,111,112,114,115,119,17694,17709,17714,17737,17742,17749,17754,17860,17905,17957,17964,18090,18122,4,2,114,117,17700,17706,103,101,116,59,1,8982,59,1,964,114,107,59,1,9140,4,3,97,101,121,17722,17728,17734,114,111,110,59,1,357,100,105,108,59,1,355,59,1,1090,111,116,59,1,8411,108,114,101,99,59,1,8981,114,59,3,55349,56625,4,4,101,105,107,111,17764,17805,17836,17851,4,2,114,116,17770,17786,101,4,2,52,102,17777,17780,59,1,8756,111,114,101,59,1,8756,97,4,3,59,115,118,17795,17797,17802,1,952,121,109,59,1,977,59,1,977,4,2,99,110,17811,17831,107,4,2,97,115,17818,17826,112,112,114,111,120,59,1,8776,105,109,59,1,8764,115,112,59,1,8201,4,2,97,115,17842,17846,112,59,1,8776,105,109,59,1,8764,114,110,5,254,1,59,17858,1,254,4,3,108,109,110,17868,17873,17901,100,101,59,1,732,101,115,5,215,3,59,98,100,17884,17886,17898,1,215,4,2,59,97,17892,17894,1,8864,114,59,1,10801,59,1,10800,116,59,1,8749,4,3,101,112,115,17913,17917,17953,97,59,1,10536,4,4,59,98,99,102,17927,17929,17934,17939,1,8868,111,116,59,1,9014,105,114,59,1,10993,4,2,59,111,17945,17948,3,55349,56677,114,107,59,1,10970,97,59,1,10537,114,105,109,101,59,1,8244,4,3,97,105,112,17972,17977,18082,100,101,59,1,8482,4,7,97,100,101,109,112,115,116,17993,18051,18056,18059,18066,18072,18076,110,103,108,101,4,5,59,100,108,113,114,18009,18011,18017,18032,18035,1,9653,111,119,110,59,1,9663,101,102,116,4,2,59,101,18026,18028,1,9667,113,59,1,8884,59,1,8796,105,103,104,116,4,2,59,101,18045,18047,1,9657,113,59,1,8885,111,116,59,1,9708,59,1,8796,105,110,117,115,59,1,10810,108,117,115,59,1,10809,98,59,1,10701,105,109,101,59,1,10811,101,122,105,117,109,59,1,9186,4,3,99,104,116,18098,18111,18116,4,2,114,121,18104,18108,59,3,55349,56521,59,1,1094,99,121,59,1,1115,114,111,107,59,1,359,4,2,105,111,18128,18133,120,116,59,1,8812,104,101,97,100,4,2,108,114,18143,18154,101,102,116,97,114,114,111,119,59,1,8606,105,103,104,116,97,114,114,111,119,59,1,8608,4,18,65,72,97,98,99,100,102,103,104,108,109,111,112,114,115,116,117,119,18204,18209,18214,18234,18250,18268,18292,18308,18319,18343,18379,18397,18413,18504,18547,18553,18584,18603,114,114,59,1,8657,97,114,59,1,10595,4,2,99,114,18220,18230,117,116,101,5,250,1,59,18228,1,250,114,59,1,8593,114,4,2,99,101,18241,18245,121,59,1,1118,118,101,59,1,365,4,2,105,121,18256,18265,114,99,5,251,1,59,18263,1,251,59,1,1091,4,3,97,98,104,18276,18281,18287,114,114,59,1,8645,108,97,99,59,1,369,97,114,59,1,10606,4,2,105,114,18298,18304,115,104,116,59,1,10622,59,3,55349,56626,114,97,118,101,5,249,1,59,18317,1,249,4,2,97,98,18325,18338,114,4,2,108,114,18332,18335,59,1,8639,59,1,8638,108,107,59,1,9600,4,2,99,116,18349,18374,4,2,111,114,18355,18369,114,110,4,2,59,101,18363,18365,1,8988,114,59,1,8988,111,112,59,1,8975,114,105,59,1,9720,4,2,97,108,18385,18390,99,114,59,1,363,5,168,1,59,18395,1,168,4,2,103,112,18403,18408,111,110,59,1,371,102,59,3,55349,56678,4,6,97,100,104,108,115,117,18427,18434,18445,18470,18475,18494,114,114,111,119,59,1,8593,111,119,110,97,114,114,111,119,59,1,8597,97,114,112,111,111,110,4,2,108,114,18457,18463,101,102,116,59,1,8639,105,103,104,116,59,1,8638,117,115,59,1,8846,105,4,3,59,104,108,18484,18486,18489,1,965,59,1,978,111,110,59,1,965,112,97,114,114,111,119,115,59,1,8648,4,3,99,105,116,18512,18537,18542,4,2,111,114,18518,18532,114,110,4,2,59,101,18526,18528,1,8989,114,59,1,8989,111,112,59,1,8974,110,103,59,1,367,114,105,59,1,9721,99,114,59,3,55349,56522,4,3,100,105,114,18561,18566,18572,111,116,59,1,8944,108,100,101,59,1,361,105,4,2,59,102,18579,18581,1,9653,59,1,9652,4,2,97,109,18590,18595,114,114,59,1,8648,108,5,252,1,59,18601,1,252,97,110,103,108,101,59,1,10663,4,15,65,66,68,97,99,100,101,102,108,110,111,112,114,115,122,18643,18648,18661,18667,18847,18851,18857,18904,18909,18915,18931,18937,18943,18949,18996,114,114,59,1,8661,97,114,4,2,59,118,18656,18658,1,10984,59,1,10985,97,115,104,59,1,8872,4,2,110,114,18673,18679,103,114,116,59,1,10652,4,7,101,107,110,112,114,115,116,18695,18704,18711,18720,18742,18754,18810,112,115,105,108,111,110,59,1,1013,97,112,112,97,59,1,1008,111,116,104,105,110,103,59,1,8709,4,3,104,105,114,18728,18732,18735,105,59,1,981,59,1,982,111,112,116,111,59,1,8733,4,2,59,104,18748,18750,1,8597,111,59,1,1009,4,2,105,117,18760,18766,103,109,97,59,1,962,4,2,98,112,18772,18791,115,101,116,110,101,113,4,2,59,113,18784,18787,3,8842,65024,59,3,10955,65024,115,101,116,110,101,113,4,2,59,113,18803,18806,3,8843,65024,59,3,10956,65024,4,2,104,114,18816,18822,101,116,97,59,1,977,105,97,110,103,108,101,4,2,108,114,18834,18840,101,102,116,59,1,8882,105,103,104,116,59,1,8883,121,59,1,1074,97,115,104,59,1,8866,4,3,101,108,114,18865,18884,18890,4,3,59,98,101,18873,18875,18880,1,8744,97,114,59,1,8891,113,59,1,8794,108,105,112,59,1,8942,4,2,98,116,18896,18901,97,114,59,1,124,59,1,124,114,59,3,55349,56627,116,114,105,59,1,8882,115,117,4,2,98,112,18923,18927,59,3,8834,8402,59,3,8835,8402,112,102,59,3,55349,56679,114,111,112,59,1,8733,116,114,105,59,1,8883,4,2,99,117,18955,18960,114,59,3,55349,56523,4,2,98,112,18966,18981,110,4,2,69,101,18973,18977,59,3,10955,65024,59,3,8842,65024,110,4,2,69,101,18988,18992,59,3,10956,65024,59,3,8843,65024,105,103,122,97,103,59,1,10650,4,7,99,101,102,111,112,114,115,19020,19026,19061,19066,19072,19075,19089,105,114,99,59,1,373,4,2,100,105,19032,19055,4,2,98,103,19038,19043,97,114,59,1,10847,101,4,2,59,113,19050,19052,1,8743,59,1,8793,101,114,112,59,1,8472,114,59,3,55349,56628,112,102,59,3,55349,56680,59,1,8472,4,2,59,101,19081,19083,1,8768,97,116,104,59,1,8768,99,114,59,3,55349,56524,4,14,99,100,102,104,105,108,109,110,111,114,115,117,118,119,19125,19146,19152,19157,19173,19176,19192,19197,19202,19236,19252,19269,19286,19291,4,3,97,105,117,19133,19137,19142,112,59,1,8898,114,99,59,1,9711,112,59,1,8899,116,114,105,59,1,9661,114,59,3,55349,56629,4,2,65,97,19163,19168,114,114,59,1,10234,114,114,59,1,10231,59,1,958,4,2,65,97,19182,19187,114,114,59,1,10232,114,114,59,1,10229,97,112,59,1,10236,105,115,59,1,8955,4,3,100,112,116,19210,19215,19230,111,116,59,1,10752,4,2,102,108,19221,19225,59,3,55349,56681,117,115,59,1,10753,105,109,101,59,1,10754,4,2,65,97,19242,19247,114,114,59,1,10233,114,114,59,1,10230,4,2,99,113,19258,19263,114,59,3,55349,56525,99,117,112,59,1,10758,4,2,112,116,19275,19281,108,117,115,59,1,10756,114,105,59,1,9651,101,101,59,1,8897,101,100,103,101,59,1,8896,4,8,97,99,101,102,105,111,115,117,19316,19335,19349,19357,19362,19367,19373,19379,99,4,2,117,121,19323,19332,116,101,5,253,1,59,19330,1,253,59,1,1103,4,2,105,121,19341,19346,114,99,59,1,375,59,1,1099,110,5,165,1,59,19355,1,165,114,59,3,55349,56630,99,121,59,1,1111,112,102,59,3,55349,56682,99,114,59,3,55349,56526,4,2,99,109,19385,19389,121,59,1,1102,108,5,255,1,59,19395,1,255,4,10,97,99,100,101,102,104,105,111,115,119,19419,19426,19441,19446,19462,19467,19472,19480,19486,19492,99,117,116,101,59,1,378,4,2,97,121,19432,19438,114,111,110,59,1,382,59,1,1079,111,116,59,1,380,4,2,101,116,19452,19458,116,114,102,59,1,8488,97,59,1,950,114,59,3,55349,56631,99,121,59,1,1078,103,114,97,114,114,59,1,8669,112,102,59,3,55349,56683,99,114,59,3,55349,56527,4,2,106,110,19498,19501,59,1,8205,106,59,1,8204]); - -/***/ }), -/* 119 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -var UNICODE = __webpack_require__(18); - -//Aliases -var $ = UNICODE.CODE_POINTS; - -//Utils - -//OPTIMIZATION: these utility functions should not be moved out of this module. V8 Crankshaft will not inline -//this functions if they will be situated in another module due to context switch. -//Always perform inlining check before modifying this functions ('node --trace-inlining'). -function isSurrogatePair(cp1, cp2) { - return cp1 >= 0xD800 && cp1 <= 0xDBFF && cp2 >= 0xDC00 && cp2 <= 0xDFFF; -} - -function getSurrogatePairCodePoint(cp1, cp2) { - return (cp1 - 0xD800) * 0x400 + 0x2400 + cp2; -} - - -//Const -var DEFAULT_BUFFER_WATERLINE = 1 << 16; - - -//Preprocessor -//NOTE: HTML input preprocessing -//(see: http://www.whatwg.org/specs/web-apps/current-work/multipage/parsing.html#preprocessing-the-input-stream) -var Preprocessor = module.exports = function () { - this.html = null; - - this.pos = -1; - this.lastGapPos = -1; - this.lastCharPos = -1; - this.droppedBufferSize = 0; - - this.gapStack = []; - - this.skipNextNewLine = false; - - this.lastChunkWritten = false; - this.endOfChunkHit = false; - this.bufferWaterline = DEFAULT_BUFFER_WATERLINE; -}; - -Object.defineProperty(Preprocessor.prototype, 'sourcePos', { - get: function () { - return this.droppedBufferSize + this.pos; - } -}); - -Preprocessor.prototype.dropParsedChunk = function () { - if (this.pos > this.bufferWaterline) { - this.lastCharPos -= this.pos; - this.droppedBufferSize += this.pos; - this.html = this.html.substring(this.pos); - this.pos = 0; - this.lastGapPos = -1; - this.gapStack = []; - } -}; - -Preprocessor.prototype._addGap = function () { - this.gapStack.push(this.lastGapPos); - this.lastGapPos = this.pos; -}; - -Preprocessor.prototype._processHighRangeCodePoint = function (cp) { - //NOTE: try to peek a surrogate pair - if (this.pos !== this.lastCharPos) { - var nextCp = this.html.charCodeAt(this.pos + 1); - - if (isSurrogatePair(cp, nextCp)) { - //NOTE: we have a surrogate pair. Peek pair character and recalculate code point. - this.pos++; - cp = getSurrogatePairCodePoint(cp, nextCp); - - //NOTE: add gap that should be avoided during retreat - this._addGap(); - } - } - - // NOTE: we've hit the end of chunk, stop processing at this point - else if (!this.lastChunkWritten) { - this.endOfChunkHit = true; - return $.EOF; - } - - return cp; -}; - -Preprocessor.prototype.write = function (chunk, isLastChunk) { - if (this.html) - this.html += chunk; - - else - this.html = chunk; - - this.lastCharPos = this.html.length - 1; - this.endOfChunkHit = false; - this.lastChunkWritten = isLastChunk; -}; - -Preprocessor.prototype.insertHtmlAtCurrentPos = function (chunk) { - this.html = this.html.substring(0, this.pos + 1) + - chunk + - this.html.substring(this.pos + 1, this.html.length); - - this.lastCharPos = this.html.length - 1; - this.endOfChunkHit = false; -}; - - -Preprocessor.prototype.advance = function () { - this.pos++; - - if (this.pos > this.lastCharPos) { - if (!this.lastChunkWritten) - this.endOfChunkHit = true; - - return $.EOF; - } - - var cp = this.html.charCodeAt(this.pos); - - //NOTE: any U+000A LINE FEED (LF) characters that immediately follow a U+000D CARRIAGE RETURN (CR) character - //must be ignored. - if (this.skipNextNewLine && cp === $.LINE_FEED) { - this.skipNextNewLine = false; - this._addGap(); - return this.advance(); - } - - //NOTE: all U+000D CARRIAGE RETURN (CR) characters must be converted to U+000A LINE FEED (LF) characters - if (cp === $.CARRIAGE_RETURN) { - this.skipNextNewLine = true; - return $.LINE_FEED; - } - - this.skipNextNewLine = false; - - //OPTIMIZATION: first perform check if the code point in the allowed range that covers most common - //HTML input (e.g. ASCII codes) to avoid performance-cost operations for high-range code points. - return cp >= 0xD800 ? this._processHighRangeCodePoint(cp) : cp; -}; - -Preprocessor.prototype.retreat = function () { - if (this.pos === this.lastGapPos) { - this.lastGapPos = this.gapStack.pop(); - this.pos--; - } - - this.pos--; -}; - - - -/***/ }), -/* 120 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -var doctype = __webpack_require__(33), - DOCUMENT_MODE = __webpack_require__(11).DOCUMENT_MODE; - - -//Conversion tables for DOM Level1 structure emulation -var nodeTypes = { - element: 1, - text: 3, - cdata: 4, - comment: 8 -}; - -var nodePropertyShorthands = { - tagName: 'name', - childNodes: 'children', - parentNode: 'parent', - previousSibling: 'prev', - nextSibling: 'next', - nodeValue: 'data' -}; - -//Node -var Node = function (props) { - for (var key in props) { - if (props.hasOwnProperty(key)) - this[key] = props[key]; - } -}; - -Node.prototype = { - get firstChild() { - var children = this.children; - - return children && children[0] || null; - }, - - get lastChild() { - var children = this.children; - - return children && children[children.length - 1] || null; - }, - - get nodeType() { - return nodeTypes[this.type] || nodeTypes.element; - } -}; - -Object.keys(nodePropertyShorthands).forEach(function (key) { - var shorthand = nodePropertyShorthands[key]; - - Object.defineProperty(Node.prototype, key, { - get: function () { - return this[shorthand] || null; - }, - set: function (val) { - this[shorthand] = val; - return val; - } - }); -}); - - -//Node construction -exports.createDocument = function () { - return new Node({ - type: 'root', - name: 'root', - parent: null, - prev: null, - next: null, - children: [], - 'x-mode': DOCUMENT_MODE.NO_QUIRKS - }); -}; - -exports.createDocumentFragment = function () { - return new Node({ - type: 'root', - name: 'root', - parent: null, - prev: null, - next: null, - children: [] - }); -}; - -exports.createElement = function (tagName, namespaceURI, attrs) { - var attribs = Object.create(null), - attribsNamespace = Object.create(null), - attribsPrefix = Object.create(null); - - for (var i = 0; i < attrs.length; i++) { - var attrName = attrs[i].name; - - attribs[attrName] = attrs[i].value; - attribsNamespace[attrName] = attrs[i].namespace; - attribsPrefix[attrName] = attrs[i].prefix; - } - - return new Node({ - type: tagName === 'script' || tagName === 'style' ? tagName : 'tag', - name: tagName, - namespace: namespaceURI, - attribs: attribs, - 'x-attribsNamespace': attribsNamespace, - 'x-attribsPrefix': attribsPrefix, - children: [], - parent: null, - prev: null, - next: null - }); -}; - -exports.createCommentNode = function (data) { - return new Node({ - type: 'comment', - data: data, - parent: null, - prev: null, - next: null - }); -}; - -var createTextNode = function (value) { - return new Node({ - type: 'text', - data: value, - parent: null, - prev: null, - next: null - }); -}; - - -//Tree mutation -var appendChild = exports.appendChild = function (parentNode, newNode) { - var prev = parentNode.children[parentNode.children.length - 1]; - - if (prev) { - prev.next = newNode; - newNode.prev = prev; - } - - parentNode.children.push(newNode); - newNode.parent = parentNode; -}; - -var insertBefore = exports.insertBefore = function (parentNode, newNode, referenceNode) { - var insertionIdx = parentNode.children.indexOf(referenceNode), - prev = referenceNode.prev; - - if (prev) { - prev.next = newNode; - newNode.prev = prev; - } - - referenceNode.prev = newNode; - newNode.next = referenceNode; - - parentNode.children.splice(insertionIdx, 0, newNode); - newNode.parent = parentNode; -}; - -exports.setTemplateContent = function (templateElement, contentElement) { - appendChild(templateElement, contentElement); -}; - -exports.getTemplateContent = function (templateElement) { - return templateElement.children[0]; -}; - -exports.setDocumentType = function (document, name, publicId, systemId) { - var data = doctype.serializeContent(name, publicId, systemId), - doctypeNode = null; - - for (var i = 0; i < document.children.length; i++) { - if (document.children[i].type === 'directive' && document.children[i].name === '!doctype') { - doctypeNode = document.children[i]; - break; - } - } - - if (doctypeNode) { - doctypeNode.data = data; - doctypeNode['x-name'] = name; - doctypeNode['x-publicId'] = publicId; - doctypeNode['x-systemId'] = systemId; - } - - else { - appendChild(document, new Node({ - type: 'directive', - name: '!doctype', - data: data, - 'x-name': name, - 'x-publicId': publicId, - 'x-systemId': systemId - })); - } - -}; - -exports.setDocumentMode = function (document, mode) { - document['x-mode'] = mode; -}; - -exports.getDocumentMode = function (document) { - return document['x-mode']; -}; - -exports.detachNode = function (node) { - if (node.parent) { - var idx = node.parent.children.indexOf(node), - prev = node.prev, - next = node.next; - - node.prev = null; - node.next = null; - - if (prev) - prev.next = next; - - if (next) - next.prev = prev; - - node.parent.children.splice(idx, 1); - node.parent = null; - } -}; - -exports.insertText = function (parentNode, text) { - var lastChild = parentNode.children[parentNode.children.length - 1]; - - if (lastChild && lastChild.type === 'text') - lastChild.data += text; - else - appendChild(parentNode, createTextNode(text)); -}; - -exports.insertTextBefore = function (parentNode, text, referenceNode) { - var prevNode = parentNode.children[parentNode.children.indexOf(referenceNode) - 1]; - - if (prevNode && prevNode.type === 'text') - prevNode.data += text; - else - insertBefore(parentNode, createTextNode(text), referenceNode); -}; - -exports.adoptAttributes = function (recipient, attrs) { - for (var i = 0; i < attrs.length; i++) { - var attrName = attrs[i].name; - - if (typeof recipient.attribs[attrName] === 'undefined') { - recipient.attribs[attrName] = attrs[i].value; - recipient['x-attribsNamespace'][attrName] = attrs[i].namespace; - recipient['x-attribsPrefix'][attrName] = attrs[i].prefix; - } - } -}; - - -//Tree traversing -exports.getFirstChild = function (node) { - return node.children[0]; -}; - -exports.getChildNodes = function (node) { - return node.children; -}; - -exports.getParentNode = function (node) { - return node.parent; -}; - -exports.getAttrList = function (element) { - var attrList = []; - - for (var name in element.attribs) { - attrList.push({ - name: name, - value: element.attribs[name], - namespace: element['x-attribsNamespace'][name], - prefix: element['x-attribsPrefix'][name] - }); - } - - return attrList; -}; - - -//Node data -exports.getTagName = function (element) { - return element.name; -}; - -exports.getNamespaceURI = function (element) { - return element.namespace; -}; - -exports.getTextNodeContent = function (textNode) { - return textNode.data; -}; - -exports.getCommentNodeContent = function (commentNode) { - return commentNode.data; -}; - -exports.getDocumentTypeNodeName = function (doctypeNode) { - return doctypeNode['x-name']; -}; - -exports.getDocumentTypeNodePublicId = function (doctypeNode) { - return doctypeNode['x-publicId']; -}; - -exports.getDocumentTypeNodeSystemId = function (doctypeNode) { - return doctypeNode['x-systemId']; -}; - - -//Node types -exports.isTextNode = function (node) { - return node.type === 'text'; -}; - -exports.isCommentNode = function (node) { - return node.type === 'comment'; -}; - -exports.isDocumentTypeNode = function (node) { - return node.type === 'directive' && node.name === '!doctype'; -}; - -exports.isElementNode = function (node) { - return !!node.attribs; -}; - - -/***/ }), -/* 121 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -/* tslint:disable:no-unused-variable */ -// Subject imported before Observable to bypass circular dependency issue since -// Subject extends Observable and Observable references Subject in it's -// definition -var Subject_1 = __webpack_require__(6); -exports.Subject = Subject_1.Subject; -exports.AnonymousSubject = Subject_1.AnonymousSubject; -/* tslint:enable:no-unused-variable */ -var Observable_1 = __webpack_require__(0); -exports.Observable = Observable_1.Observable; -// statics -/* tslint:disable:no-use-before-declare */ -__webpack_require__(123); -__webpack_require__(124); -__webpack_require__(125); -__webpack_require__(126); -__webpack_require__(127); -__webpack_require__(130); -__webpack_require__(131); -__webpack_require__(132); -__webpack_require__(133); -__webpack_require__(134); -__webpack_require__(135); -__webpack_require__(136); -__webpack_require__(137); -__webpack_require__(54); -__webpack_require__(138); -__webpack_require__(143); -__webpack_require__(139); -__webpack_require__(140); -__webpack_require__(141); -__webpack_require__(142); -__webpack_require__(144); -__webpack_require__(145); -__webpack_require__(55); -__webpack_require__(56); -__webpack_require__(146); -//dom -__webpack_require__(128); -__webpack_require__(129); -//operators -__webpack_require__(149); -__webpack_require__(150); -__webpack_require__(151); -__webpack_require__(152); -__webpack_require__(153); -__webpack_require__(57); -__webpack_require__(154); -__webpack_require__(155); -__webpack_require__(156); -__webpack_require__(157); -__webpack_require__(158); -__webpack_require__(159); -__webpack_require__(160); -__webpack_require__(166); -__webpack_require__(161); -__webpack_require__(162); -__webpack_require__(163); -__webpack_require__(164); -__webpack_require__(165); -__webpack_require__(167); -__webpack_require__(168); -__webpack_require__(169); -__webpack_require__(170); -__webpack_require__(173); -__webpack_require__(174); -__webpack_require__(175); -__webpack_require__(171); -__webpack_require__(176); -__webpack_require__(177); -__webpack_require__(178); -__webpack_require__(179); -__webpack_require__(45); -__webpack_require__(180); -__webpack_require__(181); -__webpack_require__(182); -__webpack_require__(147); -__webpack_require__(148); -__webpack_require__(183); -__webpack_require__(184); -__webpack_require__(172); -__webpack_require__(58); -__webpack_require__(185); -__webpack_require__(186); -__webpack_require__(187); -__webpack_require__(188); -__webpack_require__(189); -__webpack_require__(190); -__webpack_require__(191); -__webpack_require__(192); -__webpack_require__(193); -__webpack_require__(194); -__webpack_require__(195); -__webpack_require__(196); -__webpack_require__(197); -__webpack_require__(198); -__webpack_require__(199); -__webpack_require__(200); -__webpack_require__(201); -__webpack_require__(203); -__webpack_require__(202); -__webpack_require__(204); -__webpack_require__(205); -__webpack_require__(206); -__webpack_require__(207); -__webpack_require__(208); -__webpack_require__(209); -__webpack_require__(210); -__webpack_require__(211); -__webpack_require__(212); -__webpack_require__(213); -__webpack_require__(214); -__webpack_require__(215); -__webpack_require__(216); -__webpack_require__(217); -__webpack_require__(218); -__webpack_require__(219); -__webpack_require__(220); -__webpack_require__(221); -__webpack_require__(222); -__webpack_require__(223); -__webpack_require__(224); -__webpack_require__(225); -__webpack_require__(226); -__webpack_require__(227); -__webpack_require__(228); -__webpack_require__(229); -__webpack_require__(230); -__webpack_require__(231); -__webpack_require__(232); -__webpack_require__(233); -__webpack_require__(234); -__webpack_require__(235); -__webpack_require__(236); -__webpack_require__(237); -__webpack_require__(238); -__webpack_require__(239); -__webpack_require__(240); -__webpack_require__(241); -__webpack_require__(242); -__webpack_require__(243); -__webpack_require__(244); -__webpack_require__(245); -/* tslint:disable:no-unused-variable */ -var Subscription_1 = __webpack_require__(9); -exports.Subscription = Subscription_1.Subscription; -var Subscriber_1 = __webpack_require__(2); -exports.Subscriber = Subscriber_1.Subscriber; -var AsyncSubject_1 = __webpack_require__(25); -exports.AsyncSubject = AsyncSubject_1.AsyncSubject; -var ReplaySubject_1 = __webpack_require__(26); -exports.ReplaySubject = ReplaySubject_1.ReplaySubject; -var BehaviorSubject_1 = __webpack_require__(41); -exports.BehaviorSubject = BehaviorSubject_1.BehaviorSubject; -var ConnectableObservable_1 = __webpack_require__(386); -exports.ConnectableObservable = ConnectableObservable_1.ConnectableObservable; -var Notification_1 = __webpack_require__(30); -exports.Notification = Notification_1.Notification; -var EmptyError_1 = __webpack_require__(79); -exports.EmptyError = EmptyError_1.EmptyError; -var ArgumentOutOfRangeError_1 = __webpack_require__(22); -exports.ArgumentOutOfRangeError = ArgumentOutOfRangeError_1.ArgumentOutOfRangeError; -var ObjectUnsubscribedError_1 = __webpack_require__(80); -exports.ObjectUnsubscribedError = ObjectUnsubscribedError_1.ObjectUnsubscribedError; -var TimeoutError_1 = __webpack_require__(74); -exports.TimeoutError = TimeoutError_1.TimeoutError; -var UnsubscriptionError_1 = __webpack_require__(399); -exports.UnsubscriptionError = UnsubscriptionError_1.UnsubscriptionError; -var timeInterval_1 = __webpack_require__(66); -exports.TimeInterval = timeInterval_1.TimeInterval; -var timestamp_1 = __webpack_require__(67); -exports.Timestamp = timestamp_1.Timestamp; -var TestScheduler_1 = __webpack_require__(366); -exports.TestScheduler = TestScheduler_1.TestScheduler; -var VirtualTimeScheduler_1 = __webpack_require__(69); -exports.VirtualTimeScheduler = VirtualTimeScheduler_1.VirtualTimeScheduler; -var AjaxObservable_1 = __webpack_require__(59); -exports.AjaxResponse = AjaxObservable_1.AjaxResponse; -exports.AjaxError = AjaxObservable_1.AjaxError; -exports.AjaxTimeoutError = AjaxObservable_1.AjaxTimeoutError; -var asap_1 = __webpack_require__(70); -var async_1 = __webpack_require__(8); -var queue_1 = __webpack_require__(71); -var animationFrame_1 = __webpack_require__(363); -var rxSubscriber_1 = __webpack_require__(379); -var iterator_1 = __webpack_require__(78); -var observable_1 = __webpack_require__(378); -/* tslint:enable:no-unused-variable */ -/** - * @typedef {Object} Rx.Scheduler - * @property {Scheduler} queue Schedules on a queue in the current event frame - * (trampoline scheduler). Use this for iteration operations. - * @property {Scheduler} asap Schedules on the micro task queue, which uses the - * fastest transport mechanism available, either Node.js' `process.nextTick()` - * or Web Worker MessageChannel or setTimeout or others. Use this for - * asynchronous conversions. - * @property {Scheduler} async Schedules work with `setInterval`. Use this for - * time-based operations. - * @property {Scheduler} animationFrame Schedules work with `requestAnimationFrame`. - * Use this for synchronizing with the platform's painting - */ -var Scheduler = { - asap: asap_1.asap, - queue: queue_1.queue, - animationFrame: animationFrame_1.animationFrame, - async: async_1.async -}; -exports.Scheduler = Scheduler; -/** - * @typedef {Object} Rx.Symbol - * @property {Symbol|string} rxSubscriber A symbol to use as a property name to - * retrieve an "Rx safe" Observer from an object. "Rx safety" can be defined as - * an object that has all of the traits of an Rx Subscriber, including the - * ability to add and remove subscriptions to the subscription chain and - * guarantees involving event triggering (can't "next" after unsubscription, - * etc). - * @property {Symbol|string} observable A symbol to use as a property name to - * retrieve an Observable as defined by the [ECMAScript "Observable" spec](https://github.com/zenparsing/es-observable). - * @property {Symbol|string} iterator The ES6 symbol to use as a property name - * to retrieve an iterator from an object. - */ -var Symbol = { - rxSubscriber: rxSubscriber_1.rxSubscriber, - observable: observable_1.observable, - iterator: iterator_1.iterator -}; -exports.Symbol = Symbol; -//# sourceMappingURL=Rx.js.map - -/***/ }), -/* 122 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -/** - * An execution context and a data structure to order tasks and schedule their - * execution. Provides a notion of (potentially virtual) time, through the - * `now()` getter method. - * - * Each unit of work in a Scheduler is called an {@link Action}. - * - * ```ts - * class Scheduler { - * now(): number; - * schedule(work, delay?, state?): Subscription; - * } - * ``` - * - * @class Scheduler - */ -var Scheduler = (function () { - function Scheduler(SchedulerAction, now) { - if (now === void 0) { now = Scheduler.now; } - this.SchedulerAction = SchedulerAction; - this.now = now; - } - /** - * Schedules a function, `work`, for execution. May happen at some point in - * the future, according to the `delay` parameter, if specified. May be passed - * some context object, `state`, which will be passed to the `work` function. - * - * The given arguments will be processed an stored as an Action object in a - * queue of actions. - * - * @param {function(state: ?T): ?Subscription} work A function representing a - * task, or some unit of work to be executed by the Scheduler. - * @param {number} [delay] Time to wait before executing the work, where the - * time unit is implicit and defined by the Scheduler itself. - * @param {T} [state] Some contextual data that the `work` function uses when - * called by the Scheduler. - * @return {Subscription} A subscription in order to be able to unsubscribe - * the scheduled work. - */ - Scheduler.prototype.schedule = function (work, delay, state) { - if (delay === void 0) { delay = 0; } - return new this.SchedulerAction(this, work).schedule(state, delay); - }; - Scheduler.now = Date.now ? Date.now : function () { return +new Date(); }; - return Scheduler; -}()); -exports.Scheduler = Scheduler; -//# sourceMappingURL=Scheduler.js.map - -/***/ }), -/* 123 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var bindCallback_1 = __webpack_require__(261); -Observable_1.Observable.bindCallback = bindCallback_1.bindCallback; -//# sourceMappingURL=bindCallback.js.map - -/***/ }), -/* 124 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var bindNodeCallback_1 = __webpack_require__(262); -Observable_1.Observable.bindNodeCallback = bindNodeCallback_1.bindNodeCallback; -//# sourceMappingURL=bindNodeCallback.js.map - -/***/ }), -/* 125 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var combineLatest_1 = __webpack_require__(263); -Observable_1.Observable.combineLatest = combineLatest_1.combineLatest; -//# sourceMappingURL=combineLatest.js.map - -/***/ }), -/* 126 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var concat_1 = __webpack_require__(264); -Observable_1.Observable.concat = concat_1.concat; -//# sourceMappingURL=concat.js.map - -/***/ }), -/* 127 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var defer_1 = __webpack_require__(265); -Observable_1.Observable.defer = defer_1.defer; -//# sourceMappingURL=defer.js.map - -/***/ }), -/* 128 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var ajax_1 = __webpack_require__(267); -Observable_1.Observable.ajax = ajax_1.ajax; -//# sourceMappingURL=ajax.js.map - -/***/ }), -/* 129 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var webSocket_1 = __webpack_require__(268); -Observable_1.Observable.webSocket = webSocket_1.webSocket; -//# sourceMappingURL=webSocket.js.map - -/***/ }), -/* 130 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var empty_1 = __webpack_require__(269); -Observable_1.Observable.empty = empty_1.empty; -//# sourceMappingURL=empty.js.map - -/***/ }), -/* 131 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var forkJoin_1 = __webpack_require__(388); -Observable_1.Observable.forkJoin = forkJoin_1.forkJoin; -//# sourceMappingURL=forkJoin.js.map - -/***/ }), -/* 132 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var from_1 = __webpack_require__(389); -Observable_1.Observable.from = from_1.from; -//# sourceMappingURL=from.js.map - -/***/ }), -/* 133 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var fromEvent_1 = __webpack_require__(270); -Observable_1.Observable.fromEvent = fromEvent_1.fromEvent; -//# sourceMappingURL=fromEvent.js.map - -/***/ }), -/* 134 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var fromEventPattern_1 = __webpack_require__(271); -Observable_1.Observable.fromEventPattern = fromEventPattern_1.fromEventPattern; -//# sourceMappingURL=fromEventPattern.js.map - -/***/ }), -/* 135 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var fromPromise_1 = __webpack_require__(382); -Observable_1.Observable.fromPromise = fromPromise_1.fromPromise; -//# sourceMappingURL=fromPromise.js.map - -/***/ }), -/* 136 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var GenerateObservable_1 = __webpack_require__(252); -Observable_1.Observable.generate = GenerateObservable_1.GenerateObservable.create; -//# sourceMappingURL=generate.js.map - -/***/ }), -/* 137 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var if_1 = __webpack_require__(272); -Observable_1.Observable.if = if_1._if; -//# sourceMappingURL=if.js.map - -/***/ }), -/* 138 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var merge_1 = __webpack_require__(390); -Observable_1.Observable.merge = merge_1.merge; -//# sourceMappingURL=merge.js.map - -/***/ }), -/* 139 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var never_1 = __webpack_require__(274); -Observable_1.Observable.never = never_1.never; -//# sourceMappingURL=never.js.map - -/***/ }), -/* 140 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var of_1 = __webpack_require__(391); -Observable_1.Observable.of = of_1.of; -//# sourceMappingURL=of.js.map - -/***/ }), -/* 141 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var onErrorResumeNext_1 = __webpack_require__(63); -Observable_1.Observable.onErrorResumeNext = onErrorResumeNext_1.onErrorResumeNextStatic; -//# sourceMappingURL=onErrorResumeNext.js.map - -/***/ }), -/* 142 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var pairs_1 = __webpack_require__(275); -Observable_1.Observable.pairs = pairs_1.pairs; -//# sourceMappingURL=pairs.js.map - -/***/ }), -/* 143 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var race_1 = __webpack_require__(64); -Observable_1.Observable.race = race_1.raceStatic; -//# sourceMappingURL=race.js.map - -/***/ }), -/* 144 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var range_1 = __webpack_require__(276); -Observable_1.Observable.range = range_1.range; -//# sourceMappingURL=range.js.map - -/***/ }), -/* 145 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var using_1 = __webpack_require__(279); -Observable_1.Observable.using = using_1.using; -//# sourceMappingURL=using.js.map - -/***/ }), -/* 146 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var zip_1 = __webpack_require__(280); -Observable_1.Observable.zip = zip_1.zip; -//# sourceMappingURL=zip.js.map - -/***/ }), -/* 147 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var audit_1 = __webpack_require__(281); -Observable_1.Observable.prototype.audit = audit_1.audit; -//# sourceMappingURL=audit.js.map - -/***/ }), -/* 148 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var auditTime_1 = __webpack_require__(282); -Observable_1.Observable.prototype.auditTime = auditTime_1.auditTime; -//# sourceMappingURL=auditTime.js.map - -/***/ }), -/* 149 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var buffer_1 = __webpack_require__(283); -Observable_1.Observable.prototype.buffer = buffer_1.buffer; -//# sourceMappingURL=buffer.js.map - -/***/ }), -/* 150 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var bufferCount_1 = __webpack_require__(284); -Observable_1.Observable.prototype.bufferCount = bufferCount_1.bufferCount; -//# sourceMappingURL=bufferCount.js.map - -/***/ }), -/* 151 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var bufferTime_1 = __webpack_require__(285); -Observable_1.Observable.prototype.bufferTime = bufferTime_1.bufferTime; -//# sourceMappingURL=bufferTime.js.map - -/***/ }), -/* 152 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var bufferToggle_1 = __webpack_require__(286); -Observable_1.Observable.prototype.bufferToggle = bufferToggle_1.bufferToggle; -//# sourceMappingURL=bufferToggle.js.map - -/***/ }), -/* 153 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var bufferWhen_1 = __webpack_require__(287); -Observable_1.Observable.prototype.bufferWhen = bufferWhen_1.bufferWhen; -//# sourceMappingURL=bufferWhen.js.map - -/***/ }), -/* 154 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var combineAll_1 = __webpack_require__(288); -Observable_1.Observable.prototype.combineAll = combineAll_1.combineAll; -//# sourceMappingURL=combineAll.js.map - -/***/ }), -/* 155 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var combineLatest_1 = __webpack_require__(37); -Observable_1.Observable.prototype.combineLatest = combineLatest_1.combineLatest; -//# sourceMappingURL=combineLatest.js.map - -/***/ }), -/* 156 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var concat_1 = __webpack_require__(38); -Observable_1.Observable.prototype.concat = concat_1.concat; -//# sourceMappingURL=concat.js.map - -/***/ }), -/* 157 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var concatAll_1 = __webpack_require__(393); -Observable_1.Observable.prototype.concatAll = concatAll_1.concatAll; -//# sourceMappingURL=concatAll.js.map - -/***/ }), -/* 158 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var concatMap_1 = __webpack_require__(394); -Observable_1.Observable.prototype.concatMap = concatMap_1.concatMap; -//# sourceMappingURL=concatMap.js.map - -/***/ }), -/* 159 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var concatMapTo_1 = __webpack_require__(289); -Observable_1.Observable.prototype.concatMapTo = concatMapTo_1.concatMapTo; -//# sourceMappingURL=concatMapTo.js.map - -/***/ }), -/* 160 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var count_1 = __webpack_require__(290); -Observable_1.Observable.prototype.count = count_1.count; -//# sourceMappingURL=count.js.map - -/***/ }), -/* 161 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var debounce_1 = __webpack_require__(291); -Observable_1.Observable.prototype.debounce = debounce_1.debounce; -//# sourceMappingURL=debounce.js.map - -/***/ }), -/* 162 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var debounceTime_1 = __webpack_require__(292); -Observable_1.Observable.prototype.debounceTime = debounceTime_1.debounceTime; -//# sourceMappingURL=debounceTime.js.map - -/***/ }), -/* 163 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var defaultIfEmpty_1 = __webpack_require__(293); -Observable_1.Observable.prototype.defaultIfEmpty = defaultIfEmpty_1.defaultIfEmpty; -//# sourceMappingURL=defaultIfEmpty.js.map - -/***/ }), -/* 164 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var delay_1 = __webpack_require__(294); -Observable_1.Observable.prototype.delay = delay_1.delay; -//# sourceMappingURL=delay.js.map - -/***/ }), -/* 165 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var delayWhen_1 = __webpack_require__(295); -Observable_1.Observable.prototype.delayWhen = delayWhen_1.delayWhen; -//# sourceMappingURL=delayWhen.js.map - -/***/ }), -/* 166 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var dematerialize_1 = __webpack_require__(296); -Observable_1.Observable.prototype.dematerialize = dematerialize_1.dematerialize; -//# sourceMappingURL=dematerialize.js.map - -/***/ }), -/* 167 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var distinct_1 = __webpack_require__(297); -Observable_1.Observable.prototype.distinct = distinct_1.distinct; -//# sourceMappingURL=distinct.js.map - -/***/ }), -/* 168 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var distinctUntilChanged_1 = __webpack_require__(60); -Observable_1.Observable.prototype.distinctUntilChanged = distinctUntilChanged_1.distinctUntilChanged; -//# sourceMappingURL=distinctUntilChanged.js.map - -/***/ }), -/* 169 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var distinctUntilKeyChanged_1 = __webpack_require__(298); -Observable_1.Observable.prototype.distinctUntilKeyChanged = distinctUntilKeyChanged_1.distinctUntilKeyChanged; -//# sourceMappingURL=distinctUntilKeyChanged.js.map - -/***/ }), -/* 170 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var do_1 = __webpack_require__(299); -Observable_1.Observable.prototype.do = do_1._do; -Observable_1.Observable.prototype._do = do_1._do; -//# sourceMappingURL=do.js.map - -/***/ }), -/* 171 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var elementAt_1 = __webpack_require__(300); -Observable_1.Observable.prototype.elementAt = elementAt_1.elementAt; -//# sourceMappingURL=elementAt.js.map - -/***/ }), -/* 172 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var every_1 = __webpack_require__(395); -Observable_1.Observable.prototype.every = every_1.every; -//# sourceMappingURL=every.js.map - -/***/ }), -/* 173 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var exhaust_1 = __webpack_require__(301); -Observable_1.Observable.prototype.exhaust = exhaust_1.exhaust; -//# sourceMappingURL=exhaust.js.map - -/***/ }), -/* 174 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var exhaustMap_1 = __webpack_require__(302); -Observable_1.Observable.prototype.exhaustMap = exhaustMap_1.exhaustMap; -//# sourceMappingURL=exhaustMap.js.map - -/***/ }), -/* 175 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var expand_1 = __webpack_require__(303); -Observable_1.Observable.prototype.expand = expand_1.expand; -//# sourceMappingURL=expand.js.map - -/***/ }), -/* 176 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var filter_1 = __webpack_require__(42); -Observable_1.Observable.prototype.filter = filter_1.filter; -//# sourceMappingURL=filter.js.map - -/***/ }), -/* 177 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var finally_1 = __webpack_require__(304); -Observable_1.Observable.prototype.finally = finally_1._finally; -Observable_1.Observable.prototype._finally = finally_1._finally; -//# sourceMappingURL=finally.js.map - -/***/ }), -/* 178 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var find_1 = __webpack_require__(61); -Observable_1.Observable.prototype.find = find_1.find; -//# sourceMappingURL=find.js.map - -/***/ }), -/* 179 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var findIndex_1 = __webpack_require__(305); -Observable_1.Observable.prototype.findIndex = findIndex_1.findIndex; -//# sourceMappingURL=findIndex.js.map - -/***/ }), -/* 180 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var groupBy_1 = __webpack_require__(306); -Observable_1.Observable.prototype.groupBy = groupBy_1.groupBy; -//# sourceMappingURL=groupBy.js.map - -/***/ }), -/* 181 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var ignoreElements_1 = __webpack_require__(307); -Observable_1.Observable.prototype.ignoreElements = ignoreElements_1.ignoreElements; -//# sourceMappingURL=ignoreElements.js.map - -/***/ }), -/* 182 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var isEmpty_1 = __webpack_require__(308); -Observable_1.Observable.prototype.isEmpty = isEmpty_1.isEmpty; -//# sourceMappingURL=isEmpty.js.map - -/***/ }), -/* 183 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var last_1 = __webpack_require__(396); -Observable_1.Observable.prototype.last = last_1.last; -//# sourceMappingURL=last.js.map - -/***/ }), -/* 184 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var let_1 = __webpack_require__(309); -Observable_1.Observable.prototype.let = let_1.letProto; -Observable_1.Observable.prototype.letBind = let_1.letProto; -//# sourceMappingURL=let.js.map - -/***/ }), -/* 185 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var mapTo_1 = __webpack_require__(310); -Observable_1.Observable.prototype.mapTo = mapTo_1.mapTo; -//# sourceMappingURL=mapTo.js.map - -/***/ }), -/* 186 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var materialize_1 = __webpack_require__(311); -Observable_1.Observable.prototype.materialize = materialize_1.materialize; -//# sourceMappingURL=materialize.js.map - -/***/ }), -/* 187 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var max_1 = __webpack_require__(312); -Observable_1.Observable.prototype.max = max_1.max; -//# sourceMappingURL=max.js.map - -/***/ }), -/* 188 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var merge_1 = __webpack_require__(397); -Observable_1.Observable.prototype.merge = merge_1.merge; -//# sourceMappingURL=merge.js.map - -/***/ }), -/* 189 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var mergeAll_1 = __webpack_require__(77); -Observable_1.Observable.prototype.mergeAll = mergeAll_1.mergeAll; -//# sourceMappingURL=mergeAll.js.map - -/***/ }), -/* 190 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var mergeMap_1 = __webpack_require__(383); -Observable_1.Observable.prototype.mergeMap = mergeMap_1.mergeMap; -Observable_1.Observable.prototype.flatMap = mergeMap_1.mergeMap; -//# sourceMappingURL=mergeMap.js.map - -/***/ }), -/* 191 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var mergeMapTo_1 = __webpack_require__(62); -Observable_1.Observable.prototype.flatMapTo = mergeMapTo_1.mergeMapTo; -Observable_1.Observable.prototype.mergeMapTo = mergeMapTo_1.mergeMapTo; -//# sourceMappingURL=mergeMapTo.js.map - -/***/ }), -/* 192 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var mergeScan_1 = __webpack_require__(313); -Observable_1.Observable.prototype.mergeScan = mergeScan_1.mergeScan; -//# sourceMappingURL=mergeScan.js.map - -/***/ }), -/* 193 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var min_1 = __webpack_require__(314); -Observable_1.Observable.prototype.min = min_1.min; -//# sourceMappingURL=min.js.map - -/***/ }), -/* 194 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var multicast_1 = __webpack_require__(16); -Observable_1.Observable.prototype.multicast = multicast_1.multicast; -//# sourceMappingURL=multicast.js.map - -/***/ }), -/* 195 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var observeOn_1 = __webpack_require__(87); -Observable_1.Observable.prototype.observeOn = observeOn_1.observeOn; -//# sourceMappingURL=observeOn.js.map - -/***/ }), -/* 196 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var onErrorResumeNext_1 = __webpack_require__(63); -Observable_1.Observable.prototype.onErrorResumeNext = onErrorResumeNext_1.onErrorResumeNext; -//# sourceMappingURL=onErrorResumeNext.js.map - -/***/ }), -/* 197 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var Observable_1 = __webpack_require__(0); -var pairwise_1 = __webpack_require__(315); -Observable_1.Observable.prototype.pairwise = pairwise_1.pairwise; -//# sourceMappingURL=pairwise.js.map +/*! ***************************************************************************** +Copyright (C) Microsoft. 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. +***************************************************************************** */ +var Reflect; +(function (Reflect) { + "use strict"; + var hasOwn = Object.prototype.hasOwnProperty; + // feature test for Symbol support + var supportsSymbol = typeof Symbol === "function"; + var toPrimitiveSymbol = supportsSymbol && typeof Symbol.toPrimitive !== "undefined" ? Symbol.toPrimitive : "@@toPrimitive"; + var iteratorSymbol = supportsSymbol && typeof Symbol.iterator !== "undefined" ? Symbol.iterator : "@@iterator"; + var HashMap; + (function (HashMap) { + var supportsCreate = typeof Object.create === "function"; // feature test for Object.create support + var supportsProto = { __proto__: [] } instanceof Array; // feature test for __proto__ support + var downLevel = !supportsCreate && !supportsProto; + // create an object in dictionary mode (a.k.a. "slow" mode in v8) + HashMap.create = supportsCreate + ? function () { return MakeDictionary(Object.create(null)); } + : supportsProto + ? function () { return MakeDictionary({ __proto__: null }); } + : function () { return MakeDictionary({}); }; + HashMap.has = downLevel + ? function (map, key) { return hasOwn.call(map, key); } + : function (map, key) { return key in map; }; + HashMap.get = downLevel + ? function (map, key) { return hasOwn.call(map, key) ? map[key] : undefined; } + : function (map, key) { return map[key]; }; + })(HashMap || (HashMap = {})); + // Load global or shim versions of Map, Set, and WeakMap + var functionPrototype = Object.getPrototypeOf(Function); + var usePolyfill = typeof process === "object" && process.env && process.env["REFLECT_METADATA_USE_MAP_POLYFILL"] === "true"; + var _Map = !usePolyfill && typeof Map === "function" && typeof Map.prototype.entries === "function" ? Map : CreateMapPolyfill(); + var _Set = !usePolyfill && typeof Set === "function" && typeof Set.prototype.entries === "function" ? Set : CreateSetPolyfill(); + var _WeakMap = !usePolyfill && typeof WeakMap === "function" ? WeakMap : CreateWeakMapPolyfill(); + // [[Metadata]] internal slot + // https://rbuckton.github.io/reflect-metadata/#ordinary-object-internal-methods-and-internal-slots + var Metadata = new _WeakMap(); + /** + * Applies a set of decorators to a property of a target object. + * @param decorators An array of decorators. + * @param target The target object. + * @param propertyKey (Optional) The property key to decorate. + * @param attributes (Optional) The property descriptor for the target key. + * @remarks Decorators are applied in reverse order. + * @example + * + * class Example { + * // property declarations are not part of ES6, though they are valid in TypeScript: + * // static staticProperty; + * // property; + * + * constructor(p) { } + * static staticMethod(p) { } + * method(p) { } + * } + * + * // constructor + * Example = Reflect.decorate(decoratorsArray, Example); + * + * // property (on constructor) + * Reflect.decorate(decoratorsArray, Example, "staticProperty"); + * + * // property (on prototype) + * Reflect.decorate(decoratorsArray, Example.prototype, "property"); + * + * // method (on constructor) + * Object.defineProperty(Example, "staticMethod", + * Reflect.decorate(decoratorsArray, Example, "staticMethod", + * Object.getOwnPropertyDescriptor(Example, "staticMethod"))); + * + * // method (on prototype) + * Object.defineProperty(Example.prototype, "method", + * Reflect.decorate(decoratorsArray, Example.prototype, "method", + * Object.getOwnPropertyDescriptor(Example.prototype, "method"))); + * + */ + function decorate(decorators, target, propertyKey, attributes) { + if (!IsUndefined(propertyKey)) { + if (!IsArray(decorators)) + throw new TypeError(); + if (!IsObject(target)) + throw new TypeError(); + if (!IsObject(attributes) && !IsUndefined(attributes) && !IsNull(attributes)) + throw new TypeError(); + if (IsNull(attributes)) + attributes = undefined; + propertyKey = ToPropertyKey(propertyKey); + return DecorateProperty(decorators, target, propertyKey, attributes); + } + else { + if (!IsArray(decorators)) + throw new TypeError(); + if (!IsConstructor(target)) + throw new TypeError(); + return DecorateConstructor(decorators, target); + } + } + Reflect.decorate = decorate; + // 4.1.2 Reflect.metadata(metadataKey, metadataValue) + // https://rbuckton.github.io/reflect-metadata/#reflect.metadata + /** + * A default metadata decorator factory that can be used on a class, class member, or parameter. + * @param metadataKey The key for the metadata entry. + * @param metadataValue The value for the metadata entry. + * @returns A decorator function. + * @remarks + * If `metadataKey` is already defined for the target and target key, the + * metadataValue for that key will be overwritten. + * @example + * + * // constructor + * @Reflect.metadata(key, value) + * class Example { + * } + * + * // property (on constructor, TypeScript only) + * class Example { + * @Reflect.metadata(key, value) + * static staticProperty; + * } + * + * // property (on prototype, TypeScript only) + * class Example { + * @Reflect.metadata(key, value) + * property; + * } + * + * // method (on constructor) + * class Example { + * @Reflect.metadata(key, value) + * static staticMethod() { } + * } + * + * // method (on prototype) + * class Example { + * @Reflect.metadata(key, value) + * method() { } + * } + * + */ + function metadata(metadataKey, metadataValue) { + function decorator(target, propertyKey) { + if (!IsObject(target)) + throw new TypeError(); + if (!IsUndefined(propertyKey) && !IsPropertyKey(propertyKey)) + throw new TypeError(); + OrdinaryDefineOwnMetadata(metadataKey, metadataValue, target, propertyKey); + } + return decorator; + } + Reflect.metadata = metadata; + /** + * Define a unique metadata entry on the target. + * @param metadataKey A key used to store and retrieve metadata. + * @param metadataValue A value that contains attached metadata. + * @param target The target object on which to define metadata. + * @param propertyKey (Optional) The property key for the target. + * @example + * + * class Example { + * // property declarations are not part of ES6, though they are valid in TypeScript: + * // static staticProperty; + * // property; + * + * constructor(p) { } + * static staticMethod(p) { } + * method(p) { } + * } + * + * // constructor + * Reflect.defineMetadata("custom:annotation", options, Example); + * + * // property (on constructor) + * Reflect.defineMetadata("custom:annotation", options, Example, "staticProperty"); + * + * // property (on prototype) + * Reflect.defineMetadata("custom:annotation", options, Example.prototype, "property"); + * + * // method (on constructor) + * Reflect.defineMetadata("custom:annotation", options, Example, "staticMethod"); + * + * // method (on prototype) + * Reflect.defineMetadata("custom:annotation", options, Example.prototype, "method"); + * + * // decorator factory as metadata-producing annotation. + * function MyAnnotation(options): Decorator { + * return (target, key?) => Reflect.defineMetadata("custom:annotation", options, target, key); + * } + * + */ + function defineMetadata(metadataKey, metadataValue, target, propertyKey) { + if (!IsObject(target)) + throw new TypeError(); + if (!IsUndefined(propertyKey)) + propertyKey = ToPropertyKey(propertyKey); + return OrdinaryDefineOwnMetadata(metadataKey, metadataValue, target, propertyKey); + } + Reflect.defineMetadata = defineMetadata; + /** + * Gets a value indicating whether the target object or its prototype chain has the provided metadata key defined. + * @param metadataKey A key used to store and retrieve metadata. + * @param target The target object on which the metadata is defined. + * @param propertyKey (Optional) The property key for the target. + * @returns `true` if the metadata key was defined on the target object or its prototype chain; otherwise, `false`. + * @example + * + * class Example { + * // property declarations are not part of ES6, though they are valid in TypeScript: + * // static staticProperty; + * // property; + * + * constructor(p) { } + * static staticMethod(p) { } + * method(p) { } + * } + * + * // constructor + * result = Reflect.hasMetadata("custom:annotation", Example); + * + * // property (on constructor) + * result = Reflect.hasMetadata("custom:annotation", Example, "staticProperty"); + * + * // property (on prototype) + * result = Reflect.hasMetadata("custom:annotation", Example.prototype, "property"); + * + * // method (on constructor) + * result = Reflect.hasMetadata("custom:annotation", Example, "staticMethod"); + * + * // method (on prototype) + * result = Reflect.hasMetadata("custom:annotation", Example.prototype, "method"); + * + */ + function hasMetadata(metadataKey, target, propertyKey) { + if (!IsObject(target)) + throw new TypeError(); + if (!IsUndefined(propertyKey)) + propertyKey = ToPropertyKey(propertyKey); + return OrdinaryHasMetadata(metadataKey, target, propertyKey); + } + Reflect.hasMetadata = hasMetadata; + /** + * Gets a value indicating whether the target object has the provided metadata key defined. + * @param metadataKey A key used to store and retrieve metadata. + * @param target The target object on which the metadata is defined. + * @param propertyKey (Optional) The property key for the target. + * @returns `true` if the metadata key was defined on the target object; otherwise, `false`. + * @example + * + * class Example { + * // property declarations are not part of ES6, though they are valid in TypeScript: + * // static staticProperty; + * // property; + * + * constructor(p) { } + * static staticMethod(p) { } + * method(p) { } + * } + * + * // constructor + * result = Reflect.hasOwnMetadata("custom:annotation", Example); + * + * // property (on constructor) + * result = Reflect.hasOwnMetadata("custom:annotation", Example, "staticProperty"); + * + * // property (on prototype) + * result = Reflect.hasOwnMetadata("custom:annotation", Example.prototype, "property"); + * + * // method (on constructor) + * result = Reflect.hasOwnMetadata("custom:annotation", Example, "staticMethod"); + * + * // method (on prototype) + * result = Reflect.hasOwnMetadata("custom:annotation", Example.prototype, "method"); + * + */ + function hasOwnMetadata(metadataKey, target, propertyKey) { + if (!IsObject(target)) + throw new TypeError(); + if (!IsUndefined(propertyKey)) + propertyKey = ToPropertyKey(propertyKey); + return OrdinaryHasOwnMetadata(metadataKey, target, propertyKey); + } + Reflect.hasOwnMetadata = hasOwnMetadata; + /** + * Gets the metadata value for the provided metadata key on the target object or its prototype chain. + * @param metadataKey A key used to store and retrieve metadata. + * @param target The target object on which the metadata is defined. + * @param propertyKey (Optional) The property key for the target. + * @returns The metadata value for the metadata key if found; otherwise, `undefined`. + * @example + * + * class Example { + * // property declarations are not part of ES6, though they are valid in TypeScript: + * // static staticProperty; + * // property; + * + * constructor(p) { } + * static staticMethod(p) { } + * method(p) { } + * } + * + * // constructor + * result = Reflect.getMetadata("custom:annotation", Example); + * + * // property (on constructor) + * result = Reflect.getMetadata("custom:annotation", Example, "staticProperty"); + * + * // property (on prototype) + * result = Reflect.getMetadata("custom:annotation", Example.prototype, "property"); + * + * // method (on constructor) + * result = Reflect.getMetadata("custom:annotation", Example, "staticMethod"); + * + * // method (on prototype) + * result = Reflect.getMetadata("custom:annotation", Example.prototype, "method"); + * + */ + function getMetadata(metadataKey, target, propertyKey) { + if (!IsObject(target)) + throw new TypeError(); + if (!IsUndefined(propertyKey)) + propertyKey = ToPropertyKey(propertyKey); + return OrdinaryGetMetadata(metadataKey, target, propertyKey); + } + Reflect.getMetadata = getMetadata; + /** + * Gets the metadata value for the provided metadata key on the target object. + * @param metadataKey A key used to store and retrieve metadata. + * @param target The target object on which the metadata is defined. + * @param propertyKey (Optional) The property key for the target. + * @returns The metadata value for the metadata key if found; otherwise, `undefined`. + * @example + * + * class Example { + * // property declarations are not part of ES6, though they are valid in TypeScript: + * // static staticProperty; + * // property; + * + * constructor(p) { } + * static staticMethod(p) { } + * method(p) { } + * } + * + * // constructor + * result = Reflect.getOwnMetadata("custom:annotation", Example); + * + * // property (on constructor) + * result = Reflect.getOwnMetadata("custom:annotation", Example, "staticProperty"); + * + * // property (on prototype) + * result = Reflect.getOwnMetadata("custom:annotation", Example.prototype, "property"); + * + * // method (on constructor) + * result = Reflect.getOwnMetadata("custom:annotation", Example, "staticMethod"); + * + * // method (on prototype) + * result = Reflect.getOwnMetadata("custom:annotation", Example.prototype, "method"); + * + */ + function getOwnMetadata(metadataKey, target, propertyKey) { + if (!IsObject(target)) + throw new TypeError(); + if (!IsUndefined(propertyKey)) + propertyKey = ToPropertyKey(propertyKey); + return OrdinaryGetOwnMetadata(metadataKey, target, propertyKey); + } + Reflect.getOwnMetadata = getOwnMetadata; + /** + * Gets the metadata keys defined on the target object or its prototype chain. + * @param target The target object on which the metadata is defined. + * @param propertyKey (Optional) The property key for the target. + * @returns An array of unique metadata keys. + * @example + * + * class Example { + * // property declarations are not part of ES6, though they are valid in TypeScript: + * // static staticProperty; + * // property; + * + * constructor(p) { } + * static staticMethod(p) { } + * method(p) { } + * } + * + * // constructor + * result = Reflect.getMetadataKeys(Example); + * + * // property (on constructor) + * result = Reflect.getMetadataKeys(Example, "staticProperty"); + * + * // property (on prototype) + * result = Reflect.getMetadataKeys(Example.prototype, "property"); + * + * // method (on constructor) + * result = Reflect.getMetadataKeys(Example, "staticMethod"); + * + * // method (on prototype) + * result = Reflect.getMetadataKeys(Example.prototype, "method"); + * + */ + function getMetadataKeys(target, propertyKey) { + if (!IsObject(target)) + throw new TypeError(); + if (!IsUndefined(propertyKey)) + propertyKey = ToPropertyKey(propertyKey); + return OrdinaryMetadataKeys(target, propertyKey); + } + Reflect.getMetadataKeys = getMetadataKeys; + /** + * Gets the unique metadata keys defined on the target object. + * @param target The target object on which the metadata is defined. + * @param propertyKey (Optional) The property key for the target. + * @returns An array of unique metadata keys. + * @example + * + * class Example { + * // property declarations are not part of ES6, though they are valid in TypeScript: + * // static staticProperty; + * // property; + * + * constructor(p) { } + * static staticMethod(p) { } + * method(p) { } + * } + * + * // constructor + * result = Reflect.getOwnMetadataKeys(Example); + * + * // property (on constructor) + * result = Reflect.getOwnMetadataKeys(Example, "staticProperty"); + * + * // property (on prototype) + * result = Reflect.getOwnMetadataKeys(Example.prototype, "property"); + * + * // method (on constructor) + * result = Reflect.getOwnMetadataKeys(Example, "staticMethod"); + * + * // method (on prototype) + * result = Reflect.getOwnMetadataKeys(Example.prototype, "method"); + * + */ + function getOwnMetadataKeys(target, propertyKey) { + if (!IsObject(target)) + throw new TypeError(); + if (!IsUndefined(propertyKey)) + propertyKey = ToPropertyKey(propertyKey); + return OrdinaryOwnMetadataKeys(target, propertyKey); + } + Reflect.getOwnMetadataKeys = getOwnMetadataKeys; + /** + * Deletes the metadata entry from the target object with the provided key. + * @param metadataKey A key used to store and retrieve metadata. + * @param target The target object on which the metadata is defined. + * @param propertyKey (Optional) The property key for the target. + * @returns `true` if the metadata entry was found and deleted; otherwise, false. + * @example + * + * class Example { + * // property declarations are not part of ES6, though they are valid in TypeScript: + * // static staticProperty; + * // property; + * + * constructor(p) { } + * static staticMethod(p) { } + * method(p) { } + * } + * + * // constructor + * result = Reflect.deleteMetadata("custom:annotation", Example); + * + * // property (on constructor) + * result = Reflect.deleteMetadata("custom:annotation", Example, "staticProperty"); + * + * // property (on prototype) + * result = Reflect.deleteMetadata("custom:annotation", Example.prototype, "property"); + * + * // method (on constructor) + * result = Reflect.deleteMetadata("custom:annotation", Example, "staticMethod"); + * + * // method (on prototype) + * result = Reflect.deleteMetadata("custom:annotation", Example.prototype, "method"); + * + */ + function deleteMetadata(metadataKey, target, propertyKey) { + if (!IsObject(target)) + throw new TypeError(); + if (!IsUndefined(propertyKey)) + propertyKey = ToPropertyKey(propertyKey); + var metadataMap = GetOrCreateMetadataMap(target, propertyKey, /*Create*/ false); + if (IsUndefined(metadataMap)) + return false; + if (!metadataMap.delete(metadataKey)) + return false; + if (metadataMap.size > 0) + return true; + var targetMetadata = Metadata.get(target); + targetMetadata.delete(propertyKey); + if (targetMetadata.size > 0) + return true; + Metadata.delete(target); + return true; + } + Reflect.deleteMetadata = deleteMetadata; + function DecorateConstructor(decorators, target) { + for (var i = decorators.length - 1; i >= 0; --i) { + var decorator = decorators[i]; + var decorated = decorator(target); + if (!IsUndefined(decorated) && !IsNull(decorated)) { + if (!IsConstructor(decorated)) + throw new TypeError(); + target = decorated; + } + } + return target; + } + function DecorateProperty(decorators, target, propertyKey, descriptor) { + for (var i = decorators.length - 1; i >= 0; --i) { + var decorator = decorators[i]; + var decorated = decorator(target, propertyKey, descriptor); + if (!IsUndefined(decorated) && !IsNull(decorated)) { + if (!IsObject(decorated)) + throw new TypeError(); + descriptor = decorated; + } + } + return descriptor; + } + function GetOrCreateMetadataMap(O, P, Create) { + var targetMetadata = Metadata.get(O); + if (IsUndefined(targetMetadata)) { + if (!Create) + return undefined; + targetMetadata = new _Map(); + Metadata.set(O, targetMetadata); + } + var metadataMap = targetMetadata.get(P); + if (IsUndefined(metadataMap)) { + if (!Create) + return undefined; + metadataMap = new _Map(); + targetMetadata.set(P, metadataMap); + } + return metadataMap; + } + // 3.1.1.1 OrdinaryHasMetadata(MetadataKey, O, P) + // https://rbuckton.github.io/reflect-metadata/#ordinaryhasmetadata + function OrdinaryHasMetadata(MetadataKey, O, P) { + var hasOwn = OrdinaryHasOwnMetadata(MetadataKey, O, P); + if (hasOwn) + return true; + var parent = OrdinaryGetPrototypeOf(O); + if (!IsNull(parent)) + return OrdinaryHasMetadata(MetadataKey, parent, P); + return false; + } + // 3.1.2.1 OrdinaryHasOwnMetadata(MetadataKey, O, P) + // https://rbuckton.github.io/reflect-metadata/#ordinaryhasownmetadata + function OrdinaryHasOwnMetadata(MetadataKey, O, P) { + var metadataMap = GetOrCreateMetadataMap(O, P, /*Create*/ false); + if (IsUndefined(metadataMap)) + return false; + return ToBoolean(metadataMap.has(MetadataKey)); + } + // 3.1.3.1 OrdinaryGetMetadata(MetadataKey, O, P) + // https://rbuckton.github.io/reflect-metadata/#ordinarygetmetadata + function OrdinaryGetMetadata(MetadataKey, O, P) { + var hasOwn = OrdinaryHasOwnMetadata(MetadataKey, O, P); + if (hasOwn) + return OrdinaryGetOwnMetadata(MetadataKey, O, P); + var parent = OrdinaryGetPrototypeOf(O); + if (!IsNull(parent)) + return OrdinaryGetMetadata(MetadataKey, parent, P); + return undefined; + } + // 3.1.4.1 OrdinaryGetOwnMetadata(MetadataKey, O, P) + // https://rbuckton.github.io/reflect-metadata/#ordinarygetownmetadata + function OrdinaryGetOwnMetadata(MetadataKey, O, P) { + var metadataMap = GetOrCreateMetadataMap(O, P, /*Create*/ false); + if (IsUndefined(metadataMap)) + return undefined; + return metadataMap.get(MetadataKey); + } + // 3.1.5.1 OrdinaryDefineOwnMetadata(MetadataKey, MetadataValue, O, P) + // https://rbuckton.github.io/reflect-metadata/#ordinarydefineownmetadata + function OrdinaryDefineOwnMetadata(MetadataKey, MetadataValue, O, P) { + var metadataMap = GetOrCreateMetadataMap(O, P, /*Create*/ true); + metadataMap.set(MetadataKey, MetadataValue); + } + // 3.1.6.1 OrdinaryMetadataKeys(O, P) + // https://rbuckton.github.io/reflect-metadata/#ordinarymetadatakeys + function OrdinaryMetadataKeys(O, P) { + var ownKeys = OrdinaryOwnMetadataKeys(O, P); + var parent = OrdinaryGetPrototypeOf(O); + if (parent === null) + return ownKeys; + var parentKeys = OrdinaryMetadataKeys(parent, P); + if (parentKeys.length <= 0) + return ownKeys; + if (ownKeys.length <= 0) + return parentKeys; + var set = new _Set(); + var keys = []; + for (var _i = 0, ownKeys_1 = ownKeys; _i < ownKeys_1.length; _i++) { + var key = ownKeys_1[_i]; + var hasKey = set.has(key); + if (!hasKey) { + set.add(key); + keys.push(key); + } + } + for (var _a = 0, parentKeys_1 = parentKeys; _a < parentKeys_1.length; _a++) { + var key = parentKeys_1[_a]; + var hasKey = set.has(key); + if (!hasKey) { + set.add(key); + keys.push(key); + } + } + return keys; + } + // 3.1.7.1 OrdinaryOwnMetadataKeys(O, P) + // https://rbuckton.github.io/reflect-metadata/#ordinaryownmetadatakeys + function OrdinaryOwnMetadataKeys(O, P) { + var keys = []; + var metadataMap = GetOrCreateMetadataMap(O, P, /*Create*/ false); + if (IsUndefined(metadataMap)) + return keys; + var keysObj = metadataMap.keys(); + var iterator = GetIterator(keysObj); + var k = 0; + while (true) { + var next = IteratorStep(iterator); + if (!next) { + keys.length = k; + return keys; + } + var nextValue = IteratorValue(next); + try { + keys[k] = nextValue; + } + catch (e) { + try { + IteratorClose(iterator); + } + finally { + throw e; + } + } + k++; + } + } + // 6 ECMAScript Data Typ0es and Values + // https://tc39.github.io/ecma262/#sec-ecmascript-data-types-and-values + function Type(x) { + if (x === null) + return 1 /* Null */; + switch (typeof x) { + case "undefined": return 0 /* Undefined */; + case "boolean": return 2 /* Boolean */; + case "string": return 3 /* String */; + case "symbol": return 4 /* Symbol */; + case "number": return 5 /* Number */; + case "object": return x === null ? 1 /* Null */ : 6 /* Object */; + default: return 6 /* Object */; + } + } + // 6.1.1 The Undefined Type + // https://tc39.github.io/ecma262/#sec-ecmascript-language-types-undefined-type + function IsUndefined(x) { + return x === undefined; + } + // 6.1.2 The Null Type + // https://tc39.github.io/ecma262/#sec-ecmascript-language-types-null-type + function IsNull(x) { + return x === null; + } + // 6.1.5 The Symbol Type + // https://tc39.github.io/ecma262/#sec-ecmascript-language-types-symbol-type + function IsSymbol(x) { + return typeof x === "symbol"; + } + // 6.1.7 The Object Type + // https://tc39.github.io/ecma262/#sec-object-type + function IsObject(x) { + return typeof x === "object" ? x !== null : typeof x === "function"; + } + // 7.1 Type Conversion + // https://tc39.github.io/ecma262/#sec-type-conversion + // 7.1.1 ToPrimitive(input [, PreferredType]) + // https://tc39.github.io/ecma262/#sec-toprimitive + function ToPrimitive(input, PreferredType) { + switch (Type(input)) { + case 0 /* Undefined */: return input; + case 1 /* Null */: return input; + case 2 /* Boolean */: return input; + case 3 /* String */: return input; + case 4 /* Symbol */: return input; + case 5 /* Number */: return input; + } + var hint = PreferredType === 3 /* String */ ? "string" : PreferredType === 5 /* Number */ ? "number" : "default"; + var exoticToPrim = GetMethod(input, toPrimitiveSymbol); + if (exoticToPrim !== undefined) { + var result = exoticToPrim.call(input, hint); + if (IsObject(result)) + throw new TypeError(); + return result; + } + return OrdinaryToPrimitive(input, hint === "default" ? "number" : hint); + } + // 7.1.1.1 OrdinaryToPrimitive(O, hint) + // https://tc39.github.io/ecma262/#sec-ordinarytoprimitive + function OrdinaryToPrimitive(O, hint) { + if (hint === "string") { + var toString_1 = O.toString; + if (IsCallable(toString_1)) { + var result = toString_1.call(O); + if (!IsObject(result)) + return result; + } + var valueOf = O.valueOf; + if (IsCallable(valueOf)) { + var result = valueOf.call(O); + if (!IsObject(result)) + return result; + } + } + else { + var valueOf = O.valueOf; + if (IsCallable(valueOf)) { + var result = valueOf.call(O); + if (!IsObject(result)) + return result; + } + var toString_2 = O.toString; + if (IsCallable(toString_2)) { + var result = toString_2.call(O); + if (!IsObject(result)) + return result; + } + } + throw new TypeError(); + } + // 7.1.2 ToBoolean(argument) + // https://tc39.github.io/ecma262/2016/#sec-toboolean + function ToBoolean(argument) { + return !!argument; + } + // 7.1.12 ToString(argument) + // https://tc39.github.io/ecma262/#sec-tostring + function ToString(argument) { + return "" + argument; + } + // 7.1.14 ToPropertyKey(argument) + // https://tc39.github.io/ecma262/#sec-topropertykey + function ToPropertyKey(argument) { + var key = ToPrimitive(argument, 3 /* String */); + if (IsSymbol(key)) + return key; + return ToString(key); + } + // 7.2 Testing and Comparison Operations + // https://tc39.github.io/ecma262/#sec-testing-and-comparison-operations + // 7.2.2 IsArray(argument) + // https://tc39.github.io/ecma262/#sec-isarray + function IsArray(argument) { + return Array.isArray + ? Array.isArray(argument) + : argument instanceof Object + ? argument instanceof Array + : Object.prototype.toString.call(argument) === "[object Array]"; + } + // 7.2.3 IsCallable(argument) + // https://tc39.github.io/ecma262/#sec-iscallable + function IsCallable(argument) { + // NOTE: This is an approximation as we cannot check for [[Call]] internal method. + return typeof argument === "function"; + } + // 7.2.4 IsConstructor(argument) + // https://tc39.github.io/ecma262/#sec-isconstructor + function IsConstructor(argument) { + // NOTE: This is an approximation as we cannot check for [[Construct]] internal method. + return typeof argument === "function"; + } + // 7.2.7 IsPropertyKey(argument) + // https://tc39.github.io/ecma262/#sec-ispropertykey + function IsPropertyKey(argument) { + switch (Type(argument)) { + case 3 /* String */: return true; + case 4 /* Symbol */: return true; + default: return false; + } + } + // 7.3 Operations on Objects + // https://tc39.github.io/ecma262/#sec-operations-on-objects + // 7.3.9 GetMethod(V, P) + // https://tc39.github.io/ecma262/#sec-getmethod + function GetMethod(V, P) { + var func = V[P]; + if (func === undefined || func === null) + return undefined; + if (!IsCallable(func)) + throw new TypeError(); + return func; + } + // 7.4 Operations on Iterator Objects + // https://tc39.github.io/ecma262/#sec-operations-on-iterator-objects + function GetIterator(obj) { + var method = GetMethod(obj, iteratorSymbol); + if (!IsCallable(method)) + throw new TypeError(); // from Call + var iterator = method.call(obj); + if (!IsObject(iterator)) + throw new TypeError(); + return iterator; + } + // 7.4.4 IteratorValue(iterResult) + // https://tc39.github.io/ecma262/2016/#sec-iteratorvalue + function IteratorValue(iterResult) { + return iterResult.value; + } + // 7.4.5 IteratorStep(iterator) + // https://tc39.github.io/ecma262/#sec-iteratorstep + function IteratorStep(iterator) { + var result = iterator.next(); + return result.done ? false : result; + } + // 7.4.6 IteratorClose(iterator, completion) + // https://tc39.github.io/ecma262/#sec-iteratorclose + function IteratorClose(iterator) { + var f = iterator["return"]; + if (f) + f.call(iterator); + } + // 9.1 Ordinary Object Internal Methods and Internal Slots + // https://tc39.github.io/ecma262/#sec-ordinary-object-internal-methods-and-internal-slots + // 9.1.1.1 OrdinaryGetPrototypeOf(O) + // https://tc39.github.io/ecma262/#sec-ordinarygetprototypeof + function OrdinaryGetPrototypeOf(O) { + var proto = Object.getPrototypeOf(O); + if (typeof O !== "function" || O === functionPrototype) + return proto; + // TypeScript doesn't set __proto__ in ES5, as it's non-standard. + // Try to determine the superclass constructor. Compatible implementations + // must either set __proto__ on a subclass constructor to the superclass constructor, + // or ensure each class has a valid `constructor` property on its prototype that + // points back to the constructor. + // If this is not the same as Function.[[Prototype]], then this is definately inherited. + // This is the case when in ES6 or when using __proto__ in a compatible browser. + if (proto !== functionPrototype) + return proto; + // If the super prototype is Object.prototype, null, or undefined, then we cannot determine the heritage. + var prototype = O.prototype; + var prototypeProto = prototype && Object.getPrototypeOf(prototype); + if (prototypeProto == null || prototypeProto === Object.prototype) + return proto; + // If the constructor was not a function, then we cannot determine the heritage. + var constructor = prototypeProto.constructor; + if (typeof constructor !== "function") + return proto; + // If we have some kind of self-reference, then we cannot determine the heritage. + if (constructor === O) + return proto; + // we have a pretty good guess at the heritage. + return constructor; + } + // naive Map shim + function CreateMapPolyfill() { + var cacheSentinel = {}; + var arraySentinel = []; + var MapIterator = (function () { + function MapIterator(keys, values, selector) { + this._index = 0; + this._keys = keys; + this._values = values; + this._selector = selector; + } + MapIterator.prototype["@@iterator"] = function () { return this; }; + MapIterator.prototype[iteratorSymbol] = function () { return this; }; + MapIterator.prototype.next = function () { + var index = this._index; + if (index >= 0 && index < this._keys.length) { + var result = this._selector(this._keys[index], this._values[index]); + if (index + 1 >= this._keys.length) { + this._index = -1; + this._keys = arraySentinel; + this._values = arraySentinel; + } + else { + this._index++; + } + return { value: result, done: false }; + } + return { value: undefined, done: true }; + }; + MapIterator.prototype.throw = function (error) { + if (this._index >= 0) { + this._index = -1; + this._keys = arraySentinel; + this._values = arraySentinel; + } + throw error; + }; + MapIterator.prototype.return = function (value) { + if (this._index >= 0) { + this._index = -1; + this._keys = arraySentinel; + this._values = arraySentinel; + } + return { value: value, done: true }; + }; + return MapIterator; + }()); + return (function () { + function Map() { + this._keys = []; + this._values = []; + this._cacheKey = cacheSentinel; + this._cacheIndex = -2; + } + Object.defineProperty(Map.prototype, "size", { + get: function () { return this._keys.length; }, + enumerable: true, + configurable: true + }); + Map.prototype.has = function (key) { return this._find(key, /*insert*/ false) >= 0; }; + Map.prototype.get = function (key) { + var index = this._find(key, /*insert*/ false); + return index >= 0 ? this._values[index] : undefined; + }; + Map.prototype.set = function (key, value) { + var index = this._find(key, /*insert*/ true); + this._values[index] = value; + return this; + }; + Map.prototype.delete = function (key) { + var index = this._find(key, /*insert*/ false); + if (index >= 0) { + var size = this._keys.length; + for (var i = index + 1; i < size; i++) { + this._keys[i - 1] = this._keys[i]; + this._values[i - 1] = this._values[i]; + } + this._keys.length--; + this._values.length--; + if (key === this._cacheKey) { + this._cacheKey = cacheSentinel; + this._cacheIndex = -2; + } + return true; + } + return false; + }; + Map.prototype.clear = function () { + this._keys.length = 0; + this._values.length = 0; + this._cacheKey = cacheSentinel; + this._cacheIndex = -2; + }; + Map.prototype.keys = function () { return new MapIterator(this._keys, this._values, getKey); }; + Map.prototype.values = function () { return new MapIterator(this._keys, this._values, getValue); }; + Map.prototype.entries = function () { return new MapIterator(this._keys, this._values, getEntry); }; + Map.prototype["@@iterator"] = function () { return this.entries(); }; + Map.prototype[iteratorSymbol] = function () { return this.entries(); }; + Map.prototype._find = function (key, insert) { + if (this._cacheKey !== key) { + this._cacheIndex = this._keys.indexOf(this._cacheKey = key); + } + if (this._cacheIndex < 0 && insert) { + this._cacheIndex = this._keys.length; + this._keys.push(key); + this._values.push(undefined); + } + return this._cacheIndex; + }; + return Map; + }()); + function getKey(key, _) { + return key; + } + function getValue(_, value) { + return value; + } + function getEntry(key, value) { + return [key, value]; + } + } + // naive Set shim + function CreateSetPolyfill() { + return (function () { + function Set() { + this._map = new _Map(); + } + Object.defineProperty(Set.prototype, "size", { + get: function () { return this._map.size; }, + enumerable: true, + configurable: true + }); + Set.prototype.has = function (value) { return this._map.has(value); }; + Set.prototype.add = function (value) { return this._map.set(value, value), this; }; + Set.prototype.delete = function (value) { return this._map.delete(value); }; + Set.prototype.clear = function () { this._map.clear(); }; + Set.prototype.keys = function () { return this._map.keys(); }; + Set.prototype.values = function () { return this._map.values(); }; + Set.prototype.entries = function () { return this._map.entries(); }; + Set.prototype["@@iterator"] = function () { return this.keys(); }; + Set.prototype[iteratorSymbol] = function () { return this.keys(); }; + return Set; + }()); + } + // naive WeakMap shim + function CreateWeakMapPolyfill() { + var UUID_SIZE = 16; + var keys = HashMap.create(); + var rootKey = CreateUniqueKey(); + return (function () { + function WeakMap() { + this._key = CreateUniqueKey(); + } + WeakMap.prototype.has = function (target) { + var table = GetOrCreateWeakMapTable(target, /*create*/ false); + return table !== undefined ? HashMap.has(table, this._key) : false; + }; + WeakMap.prototype.get = function (target) { + var table = GetOrCreateWeakMapTable(target, /*create*/ false); + return table !== undefined ? HashMap.get(table, this._key) : undefined; + }; + WeakMap.prototype.set = function (target, value) { + var table = GetOrCreateWeakMapTable(target, /*create*/ true); + table[this._key] = value; + return this; + }; + WeakMap.prototype.delete = function (target) { + var table = GetOrCreateWeakMapTable(target, /*create*/ false); + return table !== undefined ? delete table[this._key] : false; + }; + WeakMap.prototype.clear = function () { + // NOTE: not a real clear, just makes the previous data unreachable + this._key = CreateUniqueKey(); + }; + return WeakMap; + }()); + function CreateUniqueKey() { + var key; + do + key = "@@WeakMap@@" + CreateUUID(); + while (HashMap.has(keys, key)); + keys[key] = true; + return key; + } + function GetOrCreateWeakMapTable(target, create) { + if (!hasOwn.call(target, rootKey)) { + if (!create) + return undefined; + Object.defineProperty(target, rootKey, { value: HashMap.create() }); + } + return target[rootKey]; + } + function FillRandomBytes(buffer, size) { + for (var i = 0; i < size; ++i) + buffer[i] = Math.random() * 0xff | 0; + return buffer; + } + function GenRandomBytes(size) { + if (typeof Uint8Array === "function") { + if (typeof crypto !== "undefined") + return crypto.getRandomValues(new Uint8Array(size)); + if (typeof msCrypto !== "undefined") + return msCrypto.getRandomValues(new Uint8Array(size)); + return FillRandomBytes(new Uint8Array(size), size); + } + return FillRandomBytes(new Array(size), size); + } + function CreateUUID() { + var data = GenRandomBytes(UUID_SIZE); + // mark as random - RFC 4122 § 4.4 + data[6] = data[6] & 0x4f | 0x40; + data[8] = data[8] & 0xbf | 0x80; + var result = ""; + for (var offset = 0; offset < UUID_SIZE; ++offset) { + var byte = data[offset]; + if (offset === 4 || offset === 6 || offset === 8) + result += "-"; + if (byte < 16) + result += "0"; + result += byte.toString(16).toLowerCase(); + } + return result; + } + } + // uses a heuristic used by v8 and chakra to force an object into dictionary mode. + function MakeDictionary(obj) { + obj.__ = undefined; + delete obj.__; + return obj; + } + // patch global Reflect + (function (__global) { + if (typeof __global.Reflect !== "undefined") { + if (__global.Reflect !== Reflect) { + for (var p in Reflect) { + if (hasOwn.call(Reflect, p)) { + __global.Reflect[p] = Reflect[p]; + } + } + } + } + else { + __global.Reflect = Reflect; + } + })(typeof global !== "undefined" ? global : + typeof self !== "undefined" ? self : + Function("return this;")()); +})(Reflect || (Reflect = {})); +//# sourceMappingURL=Reflect.js.map /***/ }), -/* 198 */ +/* 60 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -var Observable_1 = __webpack_require__(0); -var partition_1 = __webpack_require__(316); -Observable_1.Observable.prototype.partition = partition_1.partition; -//# sourceMappingURL=partition.js.map +var Observable_1 = __webpack_require__(2); +var first_1 = __webpack_require__(55); +Observable_1.Observable.prototype.first = first_1.first; +//# sourceMappingURL=first.js.map /***/ }), -/* 199 */ +/* 61 */ /***/ (function(module, exports, __webpack_require__) { -"use strict"; - -var Observable_1 = __webpack_require__(0); -var pluck_1 = __webpack_require__(317); -Observable_1.Observable.prototype.pluck = pluck_1.pluck; -//# sourceMappingURL=pluck.js.map +module.exports = (__webpack_require__(0))(48); /***/ }), -/* 200 */ +/* 62 */ /***/ (function(module, exports, __webpack_require__) { -"use strict"; - -var Observable_1 = __webpack_require__(0); -var publish_1 = __webpack_require__(318); -Observable_1.Observable.prototype.publish = publish_1.publish; -//# sourceMappingURL=publish.js.map +module.exports = (__webpack_require__(0))(54); /***/ }), -/* 201 */ +/* 63 */ /***/ (function(module, exports, __webpack_require__) { -"use strict"; - -var Observable_1 = __webpack_require__(0); -var publishBehavior_1 = __webpack_require__(319); -Observable_1.Observable.prototype.publishBehavior = publishBehavior_1.publishBehavior; -//# sourceMappingURL=publishBehavior.js.map +/** + * @license Angular v5.0.1 + * (c) 2010-2017 Google, Inc. https://angular.io/ + * License: MIT + */ +(function (global, factory) { + true ? factory(exports, __webpack_require__(4), __webpack_require__(53), __webpack_require__(51), __webpack_require__(26)) : + typeof define === 'function' && define.amd ? define('@angular/platform-browser/animations', ['exports', '@angular/core', '@angular/platform-browser', '@angular/animations', '@angular/animations/browser'], factory) : + (factory((global.ng = global.ng || {}, global.ng.platformBrowser = global.ng.platformBrowser || {}, global.ng.platformBrowser.animations = {}),global.ng.core,global.ng.platformBrowser,global.ng.animations,global.ng.animations.browser)); +}(this, (function (exports,_angular_core,_angular_platformBrowser,_angular_animations,_angular_animations_browser) { 'use strict'; -/***/ }), -/* 202 */ -/***/ (function(module, exports, __webpack_require__) { +/*! ***************************************************************************** +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 __()); +} -"use strict"; +/** + * @license Angular v5.0.1 + * (c) 2010-2017 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 + */ +var BrowserAnimationBuilder = (function (_super) { + __extends(BrowserAnimationBuilder, _super); + function BrowserAnimationBuilder(rootRenderer, doc) { + var _this = _super.call(this) || this; + _this._nextAnimationId = 0; + var /** @type {?} */ typeData = /** @type {?} */ ({ + id: '0', + encapsulation: _angular_core.ViewEncapsulation.None, + styles: [], + data: { animation: [] } + }); + _this._renderer = /** @type {?} */ (rootRenderer.createRenderer(doc.body, typeData)); + return _this; + } + /** + * @param {?} animation + * @return {?} + */ + BrowserAnimationBuilder.prototype.build = /** + * @param {?} animation + * @return {?} + */ + function (animation) { + var /** @type {?} */ id = this._nextAnimationId.toString(); + this._nextAnimationId++; + var /** @type {?} */ entry = Array.isArray(animation) ? _angular_animations.sequence(animation) : animation; + issueAnimationCommand(this._renderer, null, id, 'register', [entry]); + return new BrowserAnimationFactory(id, this._renderer); + }; + BrowserAnimationBuilder.decorators = [ + { type: _angular_core.Injectable }, + ]; + /** @nocollapse */ + BrowserAnimationBuilder.ctorParameters = function () { return [ + { type: _angular_core.RendererFactory2, }, + { type: undefined, decorators: [{ type: _angular_core.Inject, args: [_angular_platformBrowser.DOCUMENT,] },] }, + ]; }; + return BrowserAnimationBuilder; +}(_angular_animations.AnimationBuilder)); +var BrowserAnimationFactory = (function (_super) { + __extends(BrowserAnimationFactory, _super); + function BrowserAnimationFactory(_id, _renderer) { + var _this = _super.call(this) || this; + _this._id = _id; + _this._renderer = _renderer; + return _this; + } + /** + * @param {?} element + * @param {?=} options + * @return {?} + */ + BrowserAnimationFactory.prototype.create = /** + * @param {?} element + * @param {?=} options + * @return {?} + */ + function (element, options) { + return new RendererAnimationPlayer(this._id, element, options || {}, this._renderer); + }; + return BrowserAnimationFactory; +}(_angular_animations.AnimationFactory)); +var RendererAnimationPlayer = (function () { + function RendererAnimationPlayer(id, element, options, _renderer) { + this.id = id; + this.element = element; + this._renderer = _renderer; + this.parentPlayer = null; + this._started = false; + this.totalTime = 0; + this._command('create', options); + } + /** + * @param {?} eventName + * @param {?} callback + * @return {?} + */ + RendererAnimationPlayer.prototype._listen = /** + * @param {?} eventName + * @param {?} callback + * @return {?} + */ + function (eventName, callback) { + return this._renderer.listen(this.element, "@@" + this.id + ":" + eventName, callback); + }; + /** + * @param {?} command + * @param {...?} args + * @return {?} + */ + RendererAnimationPlayer.prototype._command = /** + * @param {?} command + * @param {...?} args + * @return {?} + */ + function (command) { + var args = []; + for (var _i = 1; _i < arguments.length; _i++) { + args[_i - 1] = arguments[_i]; + } + return issueAnimationCommand(this._renderer, this.element, this.id, command, args); + }; + /** + * @param {?} fn + * @return {?} + */ + RendererAnimationPlayer.prototype.onDone = /** + * @param {?} fn + * @return {?} + */ + function (fn) { this._listen('done', fn); }; + /** + * @param {?} fn + * @return {?} + */ + RendererAnimationPlayer.prototype.onStart = /** + * @param {?} fn + * @return {?} + */ + function (fn) { this._listen('start', fn); }; + /** + * @param {?} fn + * @return {?} + */ + RendererAnimationPlayer.prototype.onDestroy = /** + * @param {?} fn + * @return {?} + */ + function (fn) { this._listen('destroy', fn); }; + /** + * @return {?} + */ + RendererAnimationPlayer.prototype.init = /** + * @return {?} + */ + function () { this._command('init'); }; + /** + * @return {?} + */ + RendererAnimationPlayer.prototype.hasStarted = /** + * @return {?} + */ + function () { return this._started; }; + /** + * @return {?} + */ + RendererAnimationPlayer.prototype.play = /** + * @return {?} + */ + function () { + this._command('play'); + this._started = true; + }; + /** + * @return {?} + */ + RendererAnimationPlayer.prototype.pause = /** + * @return {?} + */ + function () { this._command('pause'); }; + /** + * @return {?} + */ + RendererAnimationPlayer.prototype.restart = /** + * @return {?} + */ + function () { this._command('restart'); }; + /** + * @return {?} + */ + RendererAnimationPlayer.prototype.finish = /** + * @return {?} + */ + function () { this._command('finish'); }; + /** + * @return {?} + */ + RendererAnimationPlayer.prototype.destroy = /** + * @return {?} + */ + function () { this._command('destroy'); }; + /** + * @return {?} + */ + RendererAnimationPlayer.prototype.reset = /** + * @return {?} + */ + function () { this._command('reset'); }; + /** + * @param {?} p + * @return {?} + */ + RendererAnimationPlayer.prototype.setPosition = /** + * @param {?} p + * @return {?} + */ + function (p) { this._command('setPosition', p); }; + /** + * @return {?} + */ + RendererAnimationPlayer.prototype.getPosition = /** + * @return {?} + */ + function () { return 0; }; + return RendererAnimationPlayer; +}()); +/** + * @param {?} renderer + * @param {?} element + * @param {?} id + * @param {?} command + * @param {?} args + * @return {?} + */ +function issueAnimationCommand(renderer, element, id, command, args) { + return renderer.setProperty(element, "@@" + id + ":" + command, args); +} -var Observable_1 = __webpack_require__(0); -var publishLast_1 = __webpack_require__(320); -Observable_1.Observable.prototype.publishLast = publishLast_1.publishLast; -//# sourceMappingURL=publishLast.js.map +/** + * @fileoverview added by tsickle + * @suppress {checkTypes} checked by tsc + */ +var ANIMATION_PREFIX = '@'; +var DISABLE_ANIMATIONS_FLAG = '@.disabled'; +var AnimationRendererFactory = (function () { + function AnimationRendererFactory(delegate, engine, _zone) { + this.delegate = delegate; + this.engine = engine; + this._zone = _zone; + this._currentId = 0; + this._microtaskId = 1; + this._animationCallbacksBuffer = []; + this._rendererCache = new Map(); + this._cdRecurDepth = 0; + engine.onRemovalComplete = function (element, delegate) { + // Note: if an component element has a leave animation, and the component + // a host leave animation, the view engine will call `removeChild` for the parent + // component renderer as well as for the child component renderer. + // Therefore, we need to check if we already removed the element. + if (delegate && delegate.parentNode(element)) { + delegate.removeChild(element.parentNode, element); + } + }; + } + /** + * @param {?} hostElement + * @param {?} type + * @return {?} + */ + AnimationRendererFactory.prototype.createRenderer = /** + * @param {?} hostElement + * @param {?} type + * @return {?} + */ + function (hostElement, type) { + var _this = this; + var /** @type {?} */ EMPTY_NAMESPACE_ID = ''; + // cache the delegates to find out which cached delegate can + // be used by which cached renderer + var /** @type {?} */ delegate = this.delegate.createRenderer(hostElement, type); + if (!hostElement || !type || !type.data || !type.data['animation']) { + var /** @type {?} */ renderer = this._rendererCache.get(delegate); + if (!renderer) { + renderer = new BaseAnimationRenderer(EMPTY_NAMESPACE_ID, delegate, this.engine); + // only cache this result when the base renderer is used + this._rendererCache.set(delegate, renderer); + } + return renderer; + } + var /** @type {?} */ componentId = type.id; + var /** @type {?} */ namespaceId = type.id + '-' + this._currentId; + this._currentId++; + this.engine.register(namespaceId, hostElement); + var /** @type {?} */ animationTriggers = /** @type {?} */ (type.data['animation']); + animationTriggers.forEach(function (trigger) { + return _this.engine.registerTrigger(componentId, namespaceId, hostElement, trigger.name, trigger); + }); + return new AnimationRenderer(this, namespaceId, delegate, this.engine); + }; + /** + * @return {?} + */ + AnimationRendererFactory.prototype.begin = /** + * @return {?} + */ + function () { + this._cdRecurDepth++; + if (this.delegate.begin) { + this.delegate.begin(); + } + }; + /** + * @return {?} + */ + AnimationRendererFactory.prototype._scheduleCountTask = /** + * @return {?} + */ + function () { + var _this = this; + Zone.current.scheduleMicroTask('incremenet the animation microtask', function () { return _this._microtaskId++; }); + }; + /* @internal */ + /** + * @param {?} count + * @param {?} fn + * @param {?} data + * @return {?} + */ + AnimationRendererFactory.prototype.scheduleListenerCallback = /** + * @param {?} count + * @param {?} fn + * @param {?} data + * @return {?} + */ + function (count, fn, data) { + var _this = this; + if (count >= 0 && count < this._microtaskId) { + this._zone.run(function () { return fn(data); }); + return; + } + if (this._animationCallbacksBuffer.length == 0) { + Promise.resolve(null).then(function () { + _this._zone.run(function () { + _this._animationCallbacksBuffer.forEach(function (tuple) { + var fn = tuple[0], data = tuple[1]; + fn(data); + }); + _this._animationCallbacksBuffer = []; + }); + }); + } + this._animationCallbacksBuffer.push([fn, data]); + }; + /** + * @return {?} + */ + AnimationRendererFactory.prototype.end = /** + * @return {?} + */ + function () { + var _this = this; + this._cdRecurDepth--; + // this is to prevent animations from running twice when an inner + // component does CD when a parent component insted has inserted it + if (this._cdRecurDepth == 0) { + this._zone.runOutsideAngular(function () { + _this._scheduleCountTask(); + _this.engine.flush(_this._microtaskId); + }); + } + if (this.delegate.end) { + this.delegate.end(); + } + }; + /** + * @return {?} + */ + AnimationRendererFactory.prototype.whenRenderingDone = /** + * @return {?} + */ + function () { return this.engine.whenRenderingDone(); }; + AnimationRendererFactory.decorators = [ + { type: _angular_core.Injectable }, + ]; + /** @nocollapse */ + AnimationRendererFactory.ctorParameters = function () { return [ + { type: _angular_core.RendererFactory2, }, + { type: _angular_animations_browser.ɵAnimationEngine, }, + { type: _angular_core.NgZone, }, + ]; }; + return AnimationRendererFactory; +}()); +var BaseAnimationRenderer = (function () { + function BaseAnimationRenderer(namespaceId, delegate, engine) { + this.namespaceId = namespaceId; + this.delegate = delegate; + this.engine = engine; + this.destroyNode = this.delegate.destroyNode ? function (n) { return /** @type {?} */ ((delegate.destroyNode))(n); } : null; + } + Object.defineProperty(BaseAnimationRenderer.prototype, "data", { + get: /** + * @return {?} + */ + function () { return this.delegate.data; }, + enumerable: true, + configurable: true + }); + /** + * @return {?} + */ + BaseAnimationRenderer.prototype.destroy = /** + * @return {?} + */ + function () { + this.engine.destroy(this.namespaceId, this.delegate); + this.delegate.destroy(); + }; + /** + * @param {?} name + * @param {?=} namespace + * @return {?} + */ + BaseAnimationRenderer.prototype.createElement = /** + * @param {?} name + * @param {?=} namespace + * @return {?} + */ + function (name, namespace) { + return this.delegate.createElement(name, namespace); + }; + /** + * @param {?} value + * @return {?} + */ + BaseAnimationRenderer.prototype.createComment = /** + * @param {?} value + * @return {?} + */ + function (value) { return this.delegate.createComment(value); }; + /** + * @param {?} value + * @return {?} + */ + BaseAnimationRenderer.prototype.createText = /** + * @param {?} value + * @return {?} + */ + function (value) { return this.delegate.createText(value); }; + /** + * @param {?} parent + * @param {?} newChild + * @return {?} + */ + BaseAnimationRenderer.prototype.appendChild = /** + * @param {?} parent + * @param {?} newChild + * @return {?} + */ + function (parent, newChild) { + this.delegate.appendChild(parent, newChild); + this.engine.onInsert(this.namespaceId, newChild, parent, false); + }; + /** + * @param {?} parent + * @param {?} newChild + * @param {?} refChild + * @return {?} + */ + BaseAnimationRenderer.prototype.insertBefore = /** + * @param {?} parent + * @param {?} newChild + * @param {?} refChild + * @return {?} + */ + function (parent, newChild, refChild) { + this.delegate.insertBefore(parent, newChild, refChild); + this.engine.onInsert(this.namespaceId, newChild, parent, true); + }; + /** + * @param {?} parent + * @param {?} oldChild + * @return {?} + */ + BaseAnimationRenderer.prototype.removeChild = /** + * @param {?} parent + * @param {?} oldChild + * @return {?} + */ + function (parent, oldChild) { + this.engine.onRemove(this.namespaceId, oldChild, this.delegate); + }; + /** + * @param {?} selectorOrNode + * @return {?} + */ + BaseAnimationRenderer.prototype.selectRootElement = /** + * @param {?} selectorOrNode + * @return {?} + */ + function (selectorOrNode) { return this.delegate.selectRootElement(selectorOrNode); }; + /** + * @param {?} node + * @return {?} + */ + BaseAnimationRenderer.prototype.parentNode = /** + * @param {?} node + * @return {?} + */ + function (node) { return this.delegate.parentNode(node); }; + /** + * @param {?} node + * @return {?} + */ + BaseAnimationRenderer.prototype.nextSibling = /** + * @param {?} node + * @return {?} + */ + function (node) { return this.delegate.nextSibling(node); }; + /** + * @param {?} el + * @param {?} name + * @param {?} value + * @param {?=} namespace + * @return {?} + */ + BaseAnimationRenderer.prototype.setAttribute = /** + * @param {?} el + * @param {?} name + * @param {?} value + * @param {?=} namespace + * @return {?} + */ + function (el, name, value, namespace) { + this.delegate.setAttribute(el, name, value, namespace); + }; + /** + * @param {?} el + * @param {?} name + * @param {?=} namespace + * @return {?} + */ + BaseAnimationRenderer.prototype.removeAttribute = /** + * @param {?} el + * @param {?} name + * @param {?=} namespace + * @return {?} + */ + function (el, name, namespace) { + this.delegate.removeAttribute(el, name, namespace); + }; + /** + * @param {?} el + * @param {?} name + * @return {?} + */ + BaseAnimationRenderer.prototype.addClass = /** + * @param {?} el + * @param {?} name + * @return {?} + */ + function (el, name) { this.delegate.addClass(el, name); }; + /** + * @param {?} el + * @param {?} name + * @return {?} + */ + BaseAnimationRenderer.prototype.removeClass = /** + * @param {?} el + * @param {?} name + * @return {?} + */ + function (el, name) { this.delegate.removeClass(el, name); }; + /** + * @param {?} el + * @param {?} style + * @param {?} value + * @param {?=} flags + * @return {?} + */ + BaseAnimationRenderer.prototype.setStyle = /** + * @param {?} el + * @param {?} style + * @param {?} value + * @param {?=} flags + * @return {?} + */ + function (el, style, value, flags) { + this.delegate.setStyle(el, style, value, flags); + }; + /** + * @param {?} el + * @param {?} style + * @param {?=} flags + * @return {?} + */ + BaseAnimationRenderer.prototype.removeStyle = /** + * @param {?} el + * @param {?} style + * @param {?=} flags + * @return {?} + */ + function (el, style, flags) { + this.delegate.removeStyle(el, style, flags); + }; + /** + * @param {?} el + * @param {?} name + * @param {?} value + * @return {?} + */ + BaseAnimationRenderer.prototype.setProperty = /** + * @param {?} el + * @param {?} name + * @param {?} value + * @return {?} + */ + function (el, name, value) { + if (name.charAt(0) == ANIMATION_PREFIX && name == DISABLE_ANIMATIONS_FLAG) { + this.disableAnimations(el, !!value); + } + else { + this.delegate.setProperty(el, name, value); + } + }; + /** + * @param {?} node + * @param {?} value + * @return {?} + */ + BaseAnimationRenderer.prototype.setValue = /** + * @param {?} node + * @param {?} value + * @return {?} + */ + function (node, value) { this.delegate.setValue(node, value); }; + /** + * @param {?} target + * @param {?} eventName + * @param {?} callback + * @return {?} + */ + BaseAnimationRenderer.prototype.listen = /** + * @param {?} target + * @param {?} eventName + * @param {?} callback + * @return {?} + */ + function (target, eventName, callback) { + return this.delegate.listen(target, eventName, callback); + }; + /** + * @param {?} element + * @param {?} value + * @return {?} + */ + BaseAnimationRenderer.prototype.disableAnimations = /** + * @param {?} element + * @param {?} value + * @return {?} + */ + function (element, value) { + this.engine.disableAnimations(element, value); + }; + return BaseAnimationRenderer; +}()); +var AnimationRenderer = (function (_super) { + __extends(AnimationRenderer, _super); + function AnimationRenderer(factory, namespaceId, delegate, engine) { + var _this = _super.call(this, namespaceId, delegate, engine) || this; + _this.factory = factory; + _this.namespaceId = namespaceId; + return _this; + } + /** + * @param {?} el + * @param {?} name + * @param {?} value + * @return {?} + */ + AnimationRenderer.prototype.setProperty = /** + * @param {?} el + * @param {?} name + * @param {?} value + * @return {?} + */ + function (el, name, value) { + if (name.charAt(0) == ANIMATION_PREFIX) { + if (name.charAt(1) == '.' && name == DISABLE_ANIMATIONS_FLAG) { + value = value === undefined ? true : !!value; + this.disableAnimations(el, /** @type {?} */ (value)); + } + else { + this.engine.process(this.namespaceId, el, name.substr(1), value); + } + } + else { + this.delegate.setProperty(el, name, value); + } + }; + /** + * @param {?} target + * @param {?} eventName + * @param {?} callback + * @return {?} + */ + AnimationRenderer.prototype.listen = /** + * @param {?} target + * @param {?} eventName + * @param {?} callback + * @return {?} + */ + function (target, eventName, callback) { + var _this = this; + if (eventName.charAt(0) == ANIMATION_PREFIX) { + var /** @type {?} */ element = resolveElementFromTarget(target); + var /** @type {?} */ name_1 = eventName.substr(1); + var /** @type {?} */ phase = ''; + // @listener.phase is for trigger animation callbacks + // @@listener is for animation builder callbacks + if (name_1.charAt(0) != ANIMATION_PREFIX) { + _a = parseTriggerCallbackName(name_1), name_1 = _a[0], phase = _a[1]; + } + return this.engine.listen(this.namespaceId, element, name_1, phase, function (event) { + var /** @type {?} */ countId = (/** @type {?} */ (event))['_data'] || -1; + _this.factory.scheduleListenerCallback(countId, callback, event); + }); + } + return this.delegate.listen(target, eventName, callback); + var _a; + }; + return AnimationRenderer; +}(BaseAnimationRenderer)); +/** + * @param {?} target + * @return {?} + */ +function resolveElementFromTarget(target) { + switch (target) { + case 'body': + return document.body; + case 'document': + return document; + case 'window': + return window; + default: + return target; + } +} +/** + * @param {?} triggerName + * @return {?} + */ +function parseTriggerCallbackName(triggerName) { + var /** @type {?} */ dotIndex = triggerName.indexOf('.'); + var /** @type {?} */ trigger = triggerName.substring(0, dotIndex); + var /** @type {?} */ phase = triggerName.substr(dotIndex + 1); + return [trigger, phase]; +} -/***/ }), -/* 203 */ -/***/ (function(module, exports, __webpack_require__) { +/** + * @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 InjectableAnimationEngine = (function (_super) { + __extends(InjectableAnimationEngine, _super); + function InjectableAnimationEngine(driver, normalizer) { + return _super.call(this, driver, normalizer) || this; + } + InjectableAnimationEngine.decorators = [ + { type: _angular_core.Injectable }, + ]; + /** @nocollapse */ + InjectableAnimationEngine.ctorParameters = function () { return [ + { type: _angular_animations_browser.AnimationDriver, }, + { type: _angular_animations_browser.ɵAnimationStyleNormalizer, }, + ]; }; + return InjectableAnimationEngine; +}(_angular_animations_browser.ɵAnimationEngine)); +/** + * @return {?} + */ +function instantiateSupportedAnimationDriver() { + if (_angular_animations_browser.ɵsupportsWebAnimations()) { + return new _angular_animations_browser.ɵWebAnimationsDriver(); + } + return new _angular_animations_browser.ɵNoopAnimationDriver(); +} +/** + * @return {?} + */ +function instantiateDefaultStyleNormalizer() { + return new _angular_animations_browser.ɵWebAnimationsStyleNormalizer(); +} +/** + * @param {?} renderer + * @param {?} engine + * @param {?} zone + * @return {?} + */ +function instantiateRendererFactory(renderer, engine, zone) { + return new AnimationRendererFactory(renderer, engine, zone); +} +var SHARED_ANIMATION_PROVIDERS = [ + { provide: _angular_animations.AnimationBuilder, useClass: BrowserAnimationBuilder }, + { provide: _angular_animations_browser.ɵAnimationStyleNormalizer, useFactory: instantiateDefaultStyleNormalizer }, + { provide: _angular_animations_browser.ɵAnimationEngine, useClass: InjectableAnimationEngine }, { + provide: _angular_core.RendererFactory2, + useFactory: instantiateRendererFactory, + deps: [_angular_platformBrowser.ɵDomRendererFactory2, _angular_animations_browser.ɵAnimationEngine, _angular_core.NgZone] + } +]; +/** + * Separate providers from the actual module so that we can do a local modification in Google3 to + * include them in the BrowserModule. + */ +var BROWSER_ANIMATIONS_PROVIDERS = [ + { provide: _angular_animations_browser.AnimationDriver, useFactory: instantiateSupportedAnimationDriver } +].concat(SHARED_ANIMATION_PROVIDERS); +/** + * Separate providers from the actual module so that we can do a local modification in Google3 to + * include them in the BrowserTestingModule. + */ +var BROWSER_NOOP_ANIMATIONS_PROVIDERS = [{ provide: _angular_animations_browser.AnimationDriver, useClass: _angular_animations_browser.ɵNoopAnimationDriver }].concat(SHARED_ANIMATION_PROVIDERS); -"use strict"; +/** + * @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 + */ +/** + * \@experimental Animation support is experimental. + */ +var BrowserAnimationsModule = (function () { + function BrowserAnimationsModule() { + } + BrowserAnimationsModule.decorators = [ + { type: _angular_core.NgModule, args: [{ + exports: [_angular_platformBrowser.BrowserModule], + providers: BROWSER_ANIMATIONS_PROVIDERS, + },] }, + ]; + /** @nocollapse */ + BrowserAnimationsModule.ctorParameters = function () { return []; }; + return BrowserAnimationsModule; +}()); +/** + * \@experimental Animation support is experimental. + */ +var NoopAnimationsModule = (function () { + function NoopAnimationsModule() { + } + NoopAnimationsModule.decorators = [ + { type: _angular_core.NgModule, args: [{ + exports: [_angular_platformBrowser.BrowserModule], + providers: BROWSER_NOOP_ANIMATIONS_PROVIDERS, + },] }, + ]; + /** @nocollapse */ + NoopAnimationsModule.ctorParameters = function () { return []; }; + return NoopAnimationsModule; +}()); -var Observable_1 = __webpack_require__(0); -var publishReplay_1 = __webpack_require__(321); -Observable_1.Observable.prototype.publishReplay = publishReplay_1.publishReplay; -//# sourceMappingURL=publishReplay.js.map +exports.BrowserAnimationsModule = BrowserAnimationsModule; +exports.NoopAnimationsModule = NoopAnimationsModule; +exports.ɵBrowserAnimationBuilder = BrowserAnimationBuilder; +exports.ɵBrowserAnimationFactory = BrowserAnimationFactory; +exports.ɵAnimationRenderer = AnimationRenderer; +exports.ɵAnimationRendererFactory = AnimationRendererFactory; +exports.ɵa = BaseAnimationRenderer; +exports.ɵf = BROWSER_ANIMATIONS_PROVIDERS; +exports.ɵg = BROWSER_NOOP_ANIMATIONS_PROVIDERS; +exports.ɵb = InjectableAnimationEngine; +exports.ɵd = instantiateDefaultStyleNormalizer; +exports.ɵe = instantiateRendererFactory; +exports.ɵc = instantiateSupportedAnimationDriver; -/***/ }), -/* 204 */ -/***/ (function(module, exports, __webpack_require__) { +Object.defineProperty(exports, '__esModule', { value: true }); -"use strict"; +}))); +//# sourceMappingURL=platform-browser-animations.umd.js.map -var Observable_1 = __webpack_require__(0); -var race_1 = __webpack_require__(64); -Observable_1.Observable.prototype.race = race_1.race; -//# sourceMappingURL=race.js.map /***/ }), -/* 205 */ -/***/ (function(module, exports, __webpack_require__) { +/* 64 */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return AppModuleShared; }); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__(4); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0__angular_core__); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__angular_common__ = __webpack_require__(5); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__angular_common___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1__angular_common__); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__angular_forms__ = __webpack_require__(129); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__angular_forms___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2__angular_forms__); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__angular_common_http__ = __webpack_require__(13); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__angular_common_http___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_3__angular_common_http__); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__angular_router__ = __webpack_require__(52); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__angular_router___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_4__angular_router__); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__components_app_app_component__ = __webpack_require__(28); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__components_navmenu_navmenu_component__ = __webpack_require__(68); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__components_home_home_component__ = __webpack_require__(67); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__components_fetchdata_fetchdata_component__ = __webpack_require__(66); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_9__components_counter_counter_component__ = __webpack_require__(65); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_10__components_unauthorized_unauthorized_component__ = __webpack_require__(69); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_11_angular_auth_oidc_client__ = __webpack_require__(27); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_11_angular_auth_oidc_client___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_11_angular_auth_oidc_client__); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_12__components_services_auth_service__ = __webpack_require__(14); +var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { + var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); + else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; + return c > 3 && r && Object.defineProperty(target, key, r), r; +}; + + + + + + + + + + + + + +var AppModuleShared = (function () { + function AppModuleShared() { + } + AppModuleShared = __decorate([ + __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_0__angular_core__["NgModule"])({ + declarations: [ + __WEBPACK_IMPORTED_MODULE_5__components_app_app_component__["a" /* AppComponent */], + __WEBPACK_IMPORTED_MODULE_6__components_navmenu_navmenu_component__["a" /* NavMenuComponent */], + __WEBPACK_IMPORTED_MODULE_9__components_counter_counter_component__["a" /* CounterComponent */], + __WEBPACK_IMPORTED_MODULE_8__components_fetchdata_fetchdata_component__["a" /* FetchDataComponent */], + __WEBPACK_IMPORTED_MODULE_7__components_home_home_component__["a" /* HomeComponent */], + __WEBPACK_IMPORTED_MODULE_10__components_unauthorized_unauthorized_component__["a" /* UnauthorizedComponent */] + ], + imports: [ + __WEBPACK_IMPORTED_MODULE_11_angular_auth_oidc_client__["AuthModule"].forRoot(), + __WEBPACK_IMPORTED_MODULE_1__angular_common__["CommonModule"], + __WEBPACK_IMPORTED_MODULE_3__angular_common_http__["HttpClientModule"], + __WEBPACK_IMPORTED_MODULE_2__angular_forms__["FormsModule"], + __WEBPACK_IMPORTED_MODULE_4__angular_router__["RouterModule"].forRoot([ + { path: '', redirectTo: 'home', pathMatch: 'full' }, + { path: 'home', component: __WEBPACK_IMPORTED_MODULE_7__components_home_home_component__["a" /* HomeComponent */] }, + { path: 'unauthorized', component: __WEBPACK_IMPORTED_MODULE_10__components_unauthorized_unauthorized_component__["a" /* UnauthorizedComponent */] }, + { path: 'counter', component: __WEBPACK_IMPORTED_MODULE_9__components_counter_counter_component__["a" /* CounterComponent */] }, + { path: 'fetch-data', component: __WEBPACK_IMPORTED_MODULE_8__components_fetchdata_fetchdata_component__["a" /* FetchDataComponent */] }, + { path: '**', redirectTo: 'home' } + ]) + ], + providers: [ + __WEBPACK_IMPORTED_MODULE_12__components_services_auth_service__["a" /* AuthService */], + __WEBPACK_IMPORTED_MODULE_11_angular_auth_oidc_client__["OidcSecurityService"] + ] + }) + ], AppModuleShared); + return AppModuleShared; +}()); + -var Observable_1 = __webpack_require__(0); -var reduce_1 = __webpack_require__(43); -Observable_1.Observable.prototype.reduce = reduce_1.reduce; -//# sourceMappingURL=reduce.js.map /***/ }), -/* 206 */ -/***/ (function(module, exports, __webpack_require__) { +/* 65 */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return CounterComponent; }); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__(4); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0__angular_core__); +var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { + var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); + else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; + return c > 3 && r && Object.defineProperty(target, key, r), r; +}; + +var CounterComponent = (function () { + function CounterComponent() { + this.currentCount = 0; + } + CounterComponent.prototype.incrementCounter = function () { + this.currentCount++; + }; + CounterComponent = __decorate([ + __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Component"])({ + selector: 'counter', + template: __webpack_require__(84) + }) + ], CounterComponent); + return CounterComponent; +}()); + -var Observable_1 = __webpack_require__(0); -var repeat_1 = __webpack_require__(322); -Observable_1.Observable.prototype.repeat = repeat_1.repeat; -//# sourceMappingURL=repeat.js.map /***/ }), -/* 207 */ -/***/ (function(module, exports, __webpack_require__) { +/* 66 */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return FetchDataComponent; }); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__(4); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0__angular_core__); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__services_auth_service__ = __webpack_require__(14); +var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { + var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); + else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; + return c > 3 && r && Object.defineProperty(target, key, r), r; +}; +var __metadata = (this && this.__metadata) || function (k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); +}; +var __param = (this && this.__param) || function (paramIndex, decorator) { + return function (target, key) { decorator(target, key, paramIndex); } +}; + + +var FetchDataComponent = (function () { + function FetchDataComponent(authService, apiUrl) { + var _this = this; + authService.get(apiUrl + 'SampleData/WeatherForecasts').subscribe(function (result) { + _this.forecasts = result; + }, function (error) { return console.error(error); }); + } + FetchDataComponent = __decorate([ + __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Component"])({ + selector: 'fetchdata', + template: __webpack_require__(85) + }), + __param(1, __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Inject"])('API_URL')), + __metadata("design:paramtypes", [__WEBPACK_IMPORTED_MODULE_1__services_auth_service__["a" /* AuthService */], String]) + ], FetchDataComponent); + return FetchDataComponent; +}()); + -var Observable_1 = __webpack_require__(0); -var repeatWhen_1 = __webpack_require__(323); -Observable_1.Observable.prototype.repeatWhen = repeatWhen_1.repeatWhen; -//# sourceMappingURL=repeatWhen.js.map /***/ }), -/* 208 */ -/***/ (function(module, exports, __webpack_require__) { +/* 67 */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return HomeComponent; }); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__(4); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0__angular_core__); +var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { + var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); + else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; + return c > 3 && r && Object.defineProperty(target, key, r), r; +}; + +var HomeComponent = (function () { + function HomeComponent() { + } + HomeComponent = __decorate([ + __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Component"])({ + selector: 'home', + template: __webpack_require__(86) + }) + ], HomeComponent); + return HomeComponent; +}()); + -var Observable_1 = __webpack_require__(0); -var retry_1 = __webpack_require__(324); -Observable_1.Observable.prototype.retry = retry_1.retry; -//# sourceMappingURL=retry.js.map /***/ }), -/* 209 */ -/***/ (function(module, exports, __webpack_require__) { +/* 68 */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return NavMenuComponent; }); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__(4); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0__angular_core__); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__services_auth_service__ = __webpack_require__(14); +var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { + var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); + else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; + return c > 3 && r && Object.defineProperty(target, key, r), r; +}; +var __metadata = (this && this.__metadata) || function (k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); +}; + + +var NavMenuComponent = (function () { + function NavMenuComponent(authService) { + this.authService = authService; + } + NavMenuComponent.prototype.ngOnInit = function () { + var _this = this; + this.isAuthorizedSubscription = this.authService.getIsAuthorized().subscribe(function (isAuthorized) { + _this.isAuthorized = isAuthorized; + }); + }; + NavMenuComponent.prototype.ngOnDestroy = function () { + this.isAuthorizedSubscription.unsubscribe(); + }; + NavMenuComponent.prototype.login = function () { + this.authService.login(); + }; + NavMenuComponent.prototype.refreshSession = function () { + this.authService.refreshSession(); + }; + NavMenuComponent.prototype.logout = function () { + this.authService.logout(); + }; + NavMenuComponent = __decorate([ + __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Component"])({ + selector: 'nav-menu', + template: __webpack_require__(87), + styles: [__webpack_require__(119)] + }), + __metadata("design:paramtypes", [__WEBPACK_IMPORTED_MODULE_1__services_auth_service__["a" /* AuthService */]]) + ], NavMenuComponent); + return NavMenuComponent; +}()); + -var Observable_1 = __webpack_require__(0); -var retryWhen_1 = __webpack_require__(325); -Observable_1.Observable.prototype.retryWhen = retryWhen_1.retryWhen; -//# sourceMappingURL=retryWhen.js.map /***/ }), -/* 210 */ -/***/ (function(module, exports, __webpack_require__) { +/* 69 */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return UnauthorizedComponent; }); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__(4); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0__angular_core__); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__angular_common__ = __webpack_require__(5); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__angular_common___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1__angular_common__); +var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { + var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); + else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; + return c > 3 && r && Object.defineProperty(target, key, r), r; +}; +var __metadata = (this && this.__metadata) || function (k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); +}; + + +var UnauthorizedComponent = (function () { + function UnauthorizedComponent(location) { + this.location = location; + } + UnauthorizedComponent.prototype.ngOnInit = function () { + }; + UnauthorizedComponent.prototype.login = function () { + //this.service.startSigninMainWindow(); + }; + UnauthorizedComponent.prototype.goback = function () { + this.location.back(); + }; + UnauthorizedComponent = __decorate([ + __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Component"])({ + selector: 'app-unauthorized', + template: __webpack_require__(88) + }), + __metadata("design:paramtypes", [__WEBPACK_IMPORTED_MODULE_1__angular_common__["Location"]]) + ], UnauthorizedComponent); + return UnauthorizedComponent; +}()); + -var Observable_1 = __webpack_require__(0); -var sample_1 = __webpack_require__(326); -Observable_1.Observable.prototype.sample = sample_1.sample; -//# sourceMappingURL=sample.js.map /***/ }), -/* 211 */ -/***/ (function(module, exports, __webpack_require__) { +/* 70 */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; +Object.defineProperty(__webpack_exports__, "__esModule", { value: true }); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_reflect_metadata__ = __webpack_require__(59); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_reflect_metadata___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_reflect_metadata__); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_zone_js__ = __webpack_require__(62); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_zone_js___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_zone_js__); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_rxjs_add_operator_first__ = __webpack_require__(60); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_rxjs_add_operator_first___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2_rxjs_add_operator_first__); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__angular_common__ = __webpack_require__(5); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__angular_common___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_3__angular_common__); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__angular_core__ = __webpack_require__(4); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__angular_core___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_4__angular_core__); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__angular_platform_server__ = __webpack_require__(25); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__angular_platform_server___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_5__angular_platform_server__); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6_aspnet_prerendering__ = __webpack_require__(61); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6_aspnet_prerendering___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_6_aspnet_prerendering__); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__app_app_module_server__ = __webpack_require__(58); + + + + + + + + +__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_4__angular_core__["enableProdMode"])(); +/* harmony default export */ __webpack_exports__["default"] = (__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_6_aspnet_prerendering__["createServerRenderer"])(function (params) { + var providers = [ + { provide: __WEBPACK_IMPORTED_MODULE_5__angular_platform_server__["INITIAL_CONFIG"], useValue: { document: '', url: params.url } }, + { provide: __WEBPACK_IMPORTED_MODULE_3__angular_common__["APP_BASE_HREF"], useValue: params.baseUrl }, + { provide: 'BASE_URL', useValue: params.origin + params.baseUrl }, + { provide: 'ORIGIN_URL', useValue: params.origin + params.baseUrl }, + { provide: 'API_URL', useValue: params.data.apiUrl }, + { provide: 'IDENTITY_URL', useValue: params.data.identityUrl }, + { provide: 'URL_CONFIG', useValue: params.data } + ]; + return __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_5__angular_platform_server__["platformDynamicServer"])(providers).bootstrapModule(__WEBPACK_IMPORTED_MODULE_7__app_app_module_server__["a" /* AppModule */]).then(function (moduleRef) { + var appRef = moduleRef.injector.get(__WEBPACK_IMPORTED_MODULE_4__angular_core__["ApplicationRef"]); + var state = moduleRef.injector.get(__WEBPACK_IMPORTED_MODULE_5__angular_platform_server__["PlatformState"]); + var zone = moduleRef.injector.get(__WEBPACK_IMPORTED_MODULE_4__angular_core__["NgZone"]); + return new Promise(function (resolve, reject) { + zone.onError.subscribe(function (errorInfo) { return reject(errorInfo); }); + appRef.isStable.first(function (isStable) { return isStable; }).subscribe(function () { + // Because 'onStable' fires before 'onError', we have to delay slightly before + // completing the request in case there's an error to report + setImmediate(function () { + resolve({ + html: state.renderToString(), + globals: { url_Config: params.data } + }); + moduleRef.destroy(); + }); + }); + }); + }); +})); -var Observable_1 = __webpack_require__(0); -var sampleTime_1 = __webpack_require__(327); -Observable_1.Observable.prototype.sampleTime = sampleTime_1.sampleTime; -//# sourceMappingURL=sampleTime.js.map /***/ }), -/* 212 */ +/* 71 */ /***/ (function(module, exports, __webpack_require__) { -"use strict"; +exports = module.exports = __webpack_require__(54)(undefined); +// imports -var Observable_1 = __webpack_require__(0); -var scan_1 = __webpack_require__(328); -Observable_1.Observable.prototype.scan = scan_1.scan; -//# sourceMappingURL=scan.js.map -/***/ }), -/* 213 */ -/***/ (function(module, exports, __webpack_require__) { +// module +exports.push([module.i, "@media (max-width: 767px) {\r\n /* On small screens, the nav menu spans the full width of the screen. Leave a space for it. */\r\n .body-content {\r\n padding-top: 50px;\r\n }\r\n}\r\n", ""]); -"use strict"; +// exports -var Observable_1 = __webpack_require__(0); -var sequenceEqual_1 = __webpack_require__(329); -Observable_1.Observable.prototype.sequenceEqual = sequenceEqual_1.sequenceEqual; -//# sourceMappingURL=sequenceEqual.js.map /***/ }), -/* 214 */ +/* 72 */ /***/ (function(module, exports, __webpack_require__) { -"use strict"; +exports = module.exports = __webpack_require__(54)(undefined); +// imports -var Observable_1 = __webpack_require__(0); -var share_1 = __webpack_require__(398); -Observable_1.Observable.prototype.share = share_1.share; -//# sourceMappingURL=share.js.map -/***/ }), -/* 215 */ -/***/ (function(module, exports, __webpack_require__) { +// module +exports.push([module.i, "li .glyphicon {\r\n margin-right: 10px;\r\n}\r\n\r\n/* Highlighting rules for nav menu items */\r\nli.link-active a,\r\nli.link-active a:hover,\r\nli.link-active a:focus {\r\n background-color: #4189C7;\r\n color: white;\r\n}\r\n\r\n/* Keep the nav menu independent of scrolling and on top of other items */\r\n.main-nav {\r\n position: fixed;\r\n top: 0;\r\n left: 0;\r\n right: 0;\r\n z-index: 1;\r\n}\r\n\r\n@media (min-width: 768px) {\r\n /* On small screens, convert the nav menu to a vertical sidebar */\r\n .main-nav {\r\n height: 100%;\r\n width: calc(25% - 20px);\r\n }\r\n .navbar {\r\n border-radius: 0px;\r\n border-width: 0px;\r\n height: 100%;\r\n }\r\n .navbar-header {\r\n float: none;\r\n }\r\n .navbar-collapse {\r\n border-top: 1px solid #444;\r\n padding: 0px;\r\n }\r\n .navbar ul {\r\n float: none;\r\n }\r\n .navbar li {\r\n float: none;\r\n font-size: 15px;\r\n margin: 6px;\r\n }\r\n .navbar li a {\r\n padding: 10px 16px;\r\n border-radius: 4px;\r\n }\r\n .navbar a {\r\n /* If a menu item's text is too long, truncate it */\r\n width: 100%;\r\n white-space: nowrap;\r\n overflow: hidden;\r\n text-overflow: ellipsis;\r\n }\r\n}\r\n", ""]); -"use strict"; +// exports -var Observable_1 = __webpack_require__(0); -var shareReplay_1 = __webpack_require__(330); -Observable_1.Observable.prototype.shareReplay = shareReplay_1.shareReplay; -//# sourceMappingURL=shareReplay.js.map /***/ }), -/* 216 */ +/* 73 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -var Observable_1 = __webpack_require__(0); -var single_1 = __webpack_require__(331); -Observable_1.Observable.prototype.single = single_1.single; -//# sourceMappingURL=single.js.map +module.exports = CustomEvent; -/***/ }), -/* 217 */ -/***/ (function(module, exports, __webpack_require__) { +var Event = __webpack_require__(7); -"use strict"; +function CustomEvent(type, dictionary) { + // Just use the superclass constructor to initialize + Event.call(this, type, dictionary); +} +CustomEvent.prototype = Object.create(Event.prototype, { + constructor: { value: CustomEvent } +}); -var Observable_1 = __webpack_require__(0); -var skip_1 = __webpack_require__(332); -Observable_1.Observable.prototype.skip = skip_1.skip; -//# sourceMappingURL=skip.js.map /***/ }), -/* 218 */ +/* 74 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -var Observable_1 = __webpack_require__(0); -var skipLast_1 = __webpack_require__(333); -Observable_1.Observable.prototype.skipLast = skipLast_1.skipLast; -//# sourceMappingURL=skipLast.js.map +module.exports = FilteredElementList; -/***/ }), -/* 219 */ -/***/ (function(module, exports, __webpack_require__) { +var Node = __webpack_require__(3); -"use strict"; +// +// This file defines node list implementation that lazily traverses +// the document tree (or a subtree rooted at any element) and includes +// only those elements for which a specified filter function returns true. +// It is used to implement the +// {Document,Element}.getElementsBy{TagName,ClassName}{,NS} methods. +// -var Observable_1 = __webpack_require__(0); -var skipUntil_1 = __webpack_require__(334); -Observable_1.Observable.prototype.skipUntil = skipUntil_1.skipUntil; -//# sourceMappingURL=skipUntil.js.map +function FilteredElementList(root, filter) { + this.root = root; + this.filter = filter; + this.lastModTime = root.lastModTime; + this.done = false; + this.cache = []; + this.traverse(); +} -/***/ }), -/* 220 */ -/***/ (function(module, exports, __webpack_require__) { +FilteredElementList.prototype = { + get length() { + this.checkcache(); + if (!this.done) this.traverse(); + return this.cache.length; + }, -"use strict"; + item: function(n) { + this.checkcache(); + if (!this.done && n >= this.cache.length) this.traverse(n); + return this.cache[n]; + }, -var Observable_1 = __webpack_require__(0); -var skipWhile_1 = __webpack_require__(335); -Observable_1.Observable.prototype.skipWhile = skipWhile_1.skipWhile; -//# sourceMappingURL=skipWhile.js.map + checkcache: function() { + if (this.lastModTime !== this.root.lastModTime) { + // subtree has changed, so invalidate cache + for (var i = this.cache.length-1; i>=0; i--) { + this[i] = undefined; + } + this.cache.length = 0; + this.done = false; + this.lastModTime = this.root.lastModTime; + } + }, + + // If n is specified, then traverse the tree until we've found the nth + // item (or until we've found all items). If n is not specified, + // traverse until we've found all items. + traverse: function(n) { + // increment n so we can compare to length, and so it is never falsy + if (n !== undefined) n++; + + var elt; + while ((elt = this.next()) !== null) { + this[this.cache.length] = elt; //XXX Use proxy instead + this.cache.push(elt); + if (n && this.cache.length === n) return; + } + + // no next element, so we've found everything + this.done = true; + }, + + // Return the next element under root that matches filter + next: function() { + var start = (this.cache.length === 0) ? this.root // Start at the root or at + : this.cache[this.cache.length-1]; // the last element we found + + var elt; + if (start.nodeType === Node.DOCUMENT_NODE) + elt = start.documentElement; + else + elt = start.nextElement(this.root); -/***/ }), -/* 221 */ -/***/ (function(module, exports, __webpack_require__) { + while(elt) { + if (this.filter(elt)) { + return elt; + } -"use strict"; + elt = elt.nextElement(this.root); + } + return null; + } +}; -var Observable_1 = __webpack_require__(0); -var startWith_1 = __webpack_require__(336); -Observable_1.Observable.prototype.startWith = startWith_1.startWith; -//# sourceMappingURL=startWith.js.map /***/ }), -/* 222 */ +/* 75 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -var Observable_1 = __webpack_require__(0); -var subscribeOn_1 = __webpack_require__(337); -Observable_1.Observable.prototype.subscribeOn = subscribeOn_1.subscribeOn; -//# sourceMappingURL=subscribeOn.js.map +var URL = __webpack_require__(20); +var URLUtils = __webpack_require__(41); -/***/ }), -/* 223 */ -/***/ (function(module, exports, __webpack_require__) { +module.exports = Location; -"use strict"; +function Location(window, href) { + this._window = window; + this._href = href; +} -var Observable_1 = __webpack_require__(0); -var switch_1 = __webpack_require__(338); -Observable_1.Observable.prototype.switch = switch_1._switch; -Observable_1.Observable.prototype._switch = switch_1._switch; -//# sourceMappingURL=switch.js.map +Location.prototype = Object.create(URLUtils.prototype, { + constructor: { value: Location }, -/***/ }), -/* 224 */ -/***/ (function(module, exports, __webpack_require__) { + // Special behavior when href is set + href: { + get: function() { return this._href; }, + set: function(v) { this.assign(v); } + }, -"use strict"; + assign: { value: function(url) { + // Resolve the new url against the current one + // XXX: + // This is not actually correct. It should be resolved against + // the URL of the document of the script. For now, though, I only + // support a single window and there is only one base url. + // So this is good enough for now. + var current = new URL(this._href); + var newurl = current.resolve(url); -var Observable_1 = __webpack_require__(0); -var switchMap_1 = __webpack_require__(339); -Observable_1.Observable.prototype.switchMap = switchMap_1.switchMap; -//# sourceMappingURL=switchMap.js.map + // Save the new url + this._href = newurl; -/***/ }), -/* 225 */ -/***/ (function(module, exports, __webpack_require__) { + // Start loading the new document! + // XXX + // This is just something hacked together. + // The real algorithm is: http://www.whatwg.org/specs/web-apps/current-work/multipage/history.html#navigate + }}, -"use strict"; + replace: { value: function(url) { + // XXX + // Since we aren't tracking history yet, replace is the same as assign + this.assign(url); + }}, -var Observable_1 = __webpack_require__(0); -var switchMapTo_1 = __webpack_require__(340); -Observable_1.Observable.prototype.switchMapTo = switchMapTo_1.switchMapTo; -//# sourceMappingURL=switchMapTo.js.map + reload: { value: function() { + // XXX: + // Actually, the spec is a lot more complicated than this + this.assign(this.href); + }}, -/***/ }), -/* 226 */ -/***/ (function(module, exports, __webpack_require__) { + toString: { value: function() { + return this.href; + }} -"use strict"; +}); -var Observable_1 = __webpack_require__(0); -var take_1 = __webpack_require__(341); -Observable_1.Observable.prototype.take = take_1.take; -//# sourceMappingURL=take.js.map /***/ }), -/* 227 */ +/* 76 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -var Observable_1 = __webpack_require__(0); -var takeLast_1 = __webpack_require__(342); -Observable_1.Observable.prototype.takeLast = takeLast_1.takeLast; -//# sourceMappingURL=takeLast.js.map +module.exports = { + VALUE: 1, // The value of a Text, Comment or PI node changed + ATTR: 2, // A new attribute was added or an attribute value and/or prefix changed + REMOVE_ATTR: 3, // An attribute was removed + REMOVE: 4, // A node was removed + MOVE: 5, // A node was moved + INSERT: 6 // A node (or a subtree of nodes) was inserted +}; /***/ }), -/* 228 */ +/* 77 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -var Observable_1 = __webpack_require__(0); -var takeUntil_1 = __webpack_require__(343); -Observable_1.Observable.prototype.takeUntil = takeUntil_1.takeUntil; -//# sourceMappingURL=takeUntil.js.map -/***/ }), -/* 229 */ -/***/ (function(module, exports, __webpack_require__) { +// https://html.spec.whatwg.org/multipage/webappapis.html#navigatorid +var NavigatorID = Object.create(null, { + appCodeName: { value: "Mozilla" }, + appName: { value: "Netscape" }, + appVersion: { value: "4.0" }, + platform: { value: "" }, + product: { value: "Gecko" }, + productSub: { value: "20100101" }, + userAgent: { value: "" }, + vendor: { value: "" }, + vendorSub: { value: "" }, + taintEnabled: { value: function() { return false; } } +}); -"use strict"; +module.exports = NavigatorID; -var Observable_1 = __webpack_require__(0); -var takeWhile_1 = __webpack_require__(344); -Observable_1.Observable.prototype.takeWhile = takeWhile_1.takeWhile; -//# sourceMappingURL=takeWhile.js.map /***/ }), -/* 230 */ +/* 78 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -var Observable_1 = __webpack_require__(0); -var throttle_1 = __webpack_require__(65); -Observable_1.Observable.prototype.throttle = throttle_1.throttle; -//# sourceMappingURL=throttle.js.map +module.exports = NodeIterator; -/***/ }), -/* 231 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; +var NodeFilter = __webpack_require__(10); +var NodeTraversal = __webpack_require__(36); -var Observable_1 = __webpack_require__(0); -var throttleTime_1 = __webpack_require__(345); -Observable_1.Observable.prototype.throttleTime = throttleTime_1.throttleTime; -//# sourceMappingURL=throttleTime.js.map +/* Private methods and helpers */ -/***/ }), -/* 232 */ -/***/ (function(module, exports, __webpack_require__) { +/** + * @based on WebKit's NodeIterator::moveToNext and NodeIterator::moveToPrevious + * https://trac.webkit.org/browser/trunk/Source/WebCore/dom/NodeIterator.cpp?rev=186279#L51 + */ +function move(node, stayWithin, directionIsNext) { + if (directionIsNext) { + return NodeTraversal.next(node, stayWithin); + } else { + if (node === stayWithin) { + return null; + } + return NodeTraversal.previous(node, null); + } +} -"use strict"; +/** + * @spec http://www.w3.org/TR/dom/#concept-nodeiterator-traverse + * @method + * @access private + * @param {NodeIterator} ni + * @param {string} direction One of 'next' or 'previous'. + * @return {Node|null} + */ +function traverse(ni, directionIsNext) { + var node, beforeNode; + node = ni.referenceNode; + beforeNode = ni.pointerBeforeReferenceNode; + while (true) { + if (beforeNode === directionIsNext) { + beforeNode = !beforeNode; + } else { + node = move(node, ni.root, directionIsNext); + if (node === null) { + return null; + } + } + var result = ni.filter.acceptNode(node); + if (result === NodeFilter.FILTER_ACCEPT) { + break; + } + } + ni.referenceNode = node; + ni.pointerBeforeReferenceNode = beforeNode; + return node; +} -var Observable_1 = __webpack_require__(0); -var timeInterval_1 = __webpack_require__(66); -Observable_1.Observable.prototype.timeInterval = timeInterval_1.timeInterval; -//# sourceMappingURL=timeInterval.js.map +/* Public API */ -/***/ }), -/* 233 */ -/***/ (function(module, exports, __webpack_require__) { +/** + * Implemented version: http://www.w3.org/TR/2015/WD-dom-20150618/#nodeiterator + * Latest version: http://www.w3.org/TR/dom/#nodeiterator + * + * @constructor + * @param {Node} root + * @param {number} whatToShow [optional] + * @param {Function|NodeFilter} filter [optional] + * @throws Error + */ +function NodeIterator(root, whatToShow, filter) { + var ni = this, active = false; -"use strict"; + if (!root || !root.nodeType) { + throw new Error('DOMException: NOT_SUPPORTED_ERR'); + } -var Observable_1 = __webpack_require__(0); -var timeout_1 = __webpack_require__(346); -Observable_1.Observable.prototype.timeout = timeout_1.timeout; -//# sourceMappingURL=timeout.js.map + ni.root = ni.referenceNode = root; + ni.pointerBeforeReferenceNode = true; + ni.whatToShow = Number(whatToShow) || 0; -/***/ }), -/* 234 */ -/***/ (function(module, exports, __webpack_require__) { + if (typeof filter !== 'function') { + filter = null; + } -"use strict"; + ni.filter = Object.create(NodeFilter.prototype); -var Observable_1 = __webpack_require__(0); -var timeoutWith_1 = __webpack_require__(347); -Observable_1.Observable.prototype.timeoutWith = timeoutWith_1.timeoutWith; -//# sourceMappingURL=timeoutWith.js.map + /** + * @method + * @param {Node} node + * @return {Number} Constant NodeFilter.FILTER_ACCEPT, + * NodeFilter.FILTER_REJECT or NodeFilter.FILTER_SKIP. + */ + ni.filter.acceptNode = function (node) { + /* jshint bitwise: false */ + var result; + if (active) { + throw new Error('DOMException: INVALID_STATE_ERR'); + } -/***/ }), -/* 235 */ -/***/ (function(module, exports, __webpack_require__) { + // Maps nodeType to whatToShow + if (!(((1 << (node.nodeType - 1)) & ni.whatToShow))) { + return NodeFilter.FILTER_SKIP; + } -"use strict"; + if (filter === null) { + return NodeFilter.FILTER_ACCEPT; + } -var Observable_1 = __webpack_require__(0); -var timestamp_1 = __webpack_require__(67); -Observable_1.Observable.prototype.timestamp = timestamp_1.timestamp; -//# sourceMappingURL=timestamp.js.map + active = true; + result = filter(node); + active = false; -/***/ }), -/* 236 */ -/***/ (function(module, exports, __webpack_require__) { + return result; + }; +} -"use strict"; +NodeIterator.prototype = { + constructor: NodeIterator, -var Observable_1 = __webpack_require__(0); -var toArray_1 = __webpack_require__(348); -Observable_1.Observable.prototype.toArray = toArray_1.toArray; -//# sourceMappingURL=toArray.js.map + /** + * @spec http://www.w3.org/TR/dom/#dom-nodeiterator-nextnode + * @method + * @return {Node|null} + */ + nextNode: function () { + return traverse(this, true); + }, -/***/ }), -/* 237 */ -/***/ (function(module, exports, __webpack_require__) { + /** + * @spec http://www.w3.org/TR/dom/#dom-nodeiterator-previousnode + * @method + * @return {Node|null} + */ + previousNode: function () { + return traverse(this, false); + }, -"use strict"; + /** + * @spec http://www.w3.org/TR/dom/#dom-nodeiterator-detach + * @method + * @return void + */ + detach: function() { + /* "The detach() method must do nothing. + * Its functionality (disabling a NodeIterator object) was removed, + * but the method itself is preserved for compatibility. + */ + } +}; -var Observable_1 = __webpack_require__(0); -var toPromise_1 = __webpack_require__(68); -Observable_1.Observable.prototype.toPromise = toPromise_1.toPromise; -//# sourceMappingURL=toPromise.js.map /***/ }), -/* 238 */ +/* 79 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -var Observable_1 = __webpack_require__(0); -var window_1 = __webpack_require__(349); -Observable_1.Observable.prototype.window = window_1.window; -//# sourceMappingURL=window.js.map - -/***/ }), -/* 239 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; +module.exports = TreeWalker; -var Observable_1 = __webpack_require__(0); -var windowCount_1 = __webpack_require__(350); -Observable_1.Observable.prototype.windowCount = windowCount_1.windowCount; -//# sourceMappingURL=windowCount.js.map +var NodeFilter = __webpack_require__(10); +var NodeTraversal = __webpack_require__(36); -/***/ }), -/* 240 */ -/***/ (function(module, exports, __webpack_require__) { +var mapChild = { + first: 'firstChild', + last: 'lastChild', + next: 'firstChild', + previous: 'lastChild' +}; -"use strict"; +var mapSibling = { + first: 'nextSibling', + last: 'previousSibling', + next: 'nextSibling', + previous: 'previousSibling' +}; -var Observable_1 = __webpack_require__(0); -var windowTime_1 = __webpack_require__(351); -Observable_1.Observable.prototype.windowTime = windowTime_1.windowTime; -//# sourceMappingURL=windowTime.js.map +/* Private methods and helpers */ -/***/ }), -/* 241 */ -/***/ (function(module, exports, __webpack_require__) { +/** + * @spec http://www.w3.org/TR/dom/#concept-traverse-children + * @method + * @access private + * @param {TreeWalker} tw + * @param {string} type One of 'first' or 'last'. + * @return {Node|null} + */ +function traverseChildren(tw, type) { + var child, node, parent, result, sibling; + node = tw.currentNode[mapChild[type]]; + while (node !== null) { + result = tw.filter.acceptNode(node); + if (result === NodeFilter.FILTER_ACCEPT) { + tw.currentNode = node; + return node; + } + if (result === NodeFilter.FILTER_SKIP) { + child = node[mapChild[type]]; + if (child !== null) { + node = child; + continue; + } + } + while (node !== null) { + sibling = node[mapSibling[type]]; + if (sibling !== null) { + node = sibling; + break; + } + parent = node.parentNode; + if (parent === null || parent === tw.root || parent === tw.currentNode) { + return null; + } + else { + node = parent; + } + } + } + return null; +} -"use strict"; +/** + * @spec http://www.w3.org/TR/dom/#concept-traverse-siblings + * @method + * @access private + * @param {TreeWalker} tw + * @param {TreeWalker} type One of 'next' or 'previous'. + * @return {Node|nul} + */ +function traverseSiblings(tw, type) { + var node, result, sibling; + node = tw.currentNode; + if (node === tw.root) { + return null; + } + while (true) { + sibling = node[mapSibling[type]]; + while (sibling !== null) { + node = sibling; + result = tw.filter.acceptNode(node); + if (result === NodeFilter.FILTER_ACCEPT) { + tw.currentNode = node; + return node; + } + sibling = node[mapChild[type]]; + if (result === NodeFilter.FILTER_REJECT || sibling === null) { + sibling = node[mapSibling[type]]; + } + } + node = node.parentNode; + if (node === null || node === tw.root) { + return null; + } + if (tw.filter.acceptNode(node) === NodeFilter.FILTER_ACCEPT) { + return null; + } + } +} -var Observable_1 = __webpack_require__(0); -var windowToggle_1 = __webpack_require__(352); -Observable_1.Observable.prototype.windowToggle = windowToggle_1.windowToggle; -//# sourceMappingURL=windowToggle.js.map -/***/ }), -/* 242 */ -/***/ (function(module, exports, __webpack_require__) { +/* Public API */ -"use strict"; +/** + * Implemented version: http://www.w3.org/TR/2015/WD-dom-20150618/#interface-treewalker + * Latest version: http://www.w3.org/TR/dom/#interface-treewalker + * + * @constructor + * @param {Node} root + * @param {number} whatToShow [optional] + * @param {Function|NodeFilter} filter [optional] + * @throws Error + */ +function TreeWalker(root, whatToShow, filter) { + var tw = this, active = false; -var Observable_1 = __webpack_require__(0); -var windowWhen_1 = __webpack_require__(353); -Observable_1.Observable.prototype.windowWhen = windowWhen_1.windowWhen; -//# sourceMappingURL=windowWhen.js.map + if (!root || !root.nodeType) { + throw new Error('DOMException: NOT_SUPPORTED_ERR'); + } -/***/ }), -/* 243 */ -/***/ (function(module, exports, __webpack_require__) { + tw.root = root; + tw.whatToShow = Number(whatToShow) || 0; -"use strict"; + tw.currentNode = root; -var Observable_1 = __webpack_require__(0); -var withLatestFrom_1 = __webpack_require__(354); -Observable_1.Observable.prototype.withLatestFrom = withLatestFrom_1.withLatestFrom; -//# sourceMappingURL=withLatestFrom.js.map + if (typeof filter !== 'function') { + filter = null; + } -/***/ }), -/* 244 */ -/***/ (function(module, exports, __webpack_require__) { + tw.filter = Object.create(NodeFilter.prototype); -"use strict"; + /** + * @method + * @param {Node} node + * @return {Number} Constant NodeFilter.FILTER_ACCEPT, + * NodeFilter.FILTER_REJECT or NodeFilter.FILTER_SKIP. + */ + tw.filter.acceptNode = function (node) { + /* jshint bitwise: false */ + var result; + if (active) { + throw new Error('DOMException: INVALID_STATE_ERR'); + } -var Observable_1 = __webpack_require__(0); -var zip_1 = __webpack_require__(39); -Observable_1.Observable.prototype.zip = zip_1.zipProto; -//# sourceMappingURL=zip.js.map + // Maps nodeType to whatToShow + if (!(((1 << (node.nodeType - 1)) & tw.whatToShow))) { + return NodeFilter.FILTER_SKIP; + } -/***/ }), -/* 245 */ -/***/ (function(module, exports, __webpack_require__) { + if (filter === null) { + return NodeFilter.FILTER_ACCEPT; + } -"use strict"; + active = true; + result = filter(node); + active = false; -var Observable_1 = __webpack_require__(0); -var zipAll_1 = __webpack_require__(355); -Observable_1.Observable.prototype.zipAll = zipAll_1.zipAll; -//# sourceMappingURL=zipAll.js.map + return result; + }; +} -/***/ }), -/* 246 */ -/***/ (function(module, exports, __webpack_require__) { +TreeWalker.prototype = { -"use strict"; + constructor: TreeWalker, -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; -var Observable_1 = __webpack_require__(0); -var tryCatch_1 = __webpack_require__(7); -var errorObject_1 = __webpack_require__(5); -var AsyncSubject_1 = __webpack_require__(25); -/** - * We need this JSDoc comment for affecting ESDoc. - * @extends {Ignored} - * @hide true - */ -var BoundCallbackObservable = (function (_super) { - __extends(BoundCallbackObservable, _super); - function BoundCallbackObservable(callbackFunc, selector, args, context, scheduler) { - _super.call(this); - this.callbackFunc = callbackFunc; - this.selector = selector; - this.args = args; - this.context = context; - this.scheduler = scheduler; + /** + * @spec http://www.w3.org/TR/dom/#dom-treewalker-parentnode + * @method + * @return {Node|null} + */ + parentNode: function () { + var node = this.currentNode; + while (node !== null && node !== this.root) { + node = node.parentNode; + if (node !== null && this.filter.acceptNode(node) === NodeFilter.FILTER_ACCEPT) { + this.currentNode = node; + return node; + } } - /* tslint:enable:max-line-length */ - /** - * Converts a callback API to a function that returns an Observable. - * - * Give it a function `f` of type `f(x, callback)` and - * it will return a function `g` that when called as `g(x)` will output an - * Observable. - * - * `bindCallback` is not an operator because its input and output are not - * Observables. The input is a function `func` with some parameters, but the - * last parameter must be a callback function that `func` calls when it is - * done. - * - * The output of `bindCallback` is a function that takes the same parameters - * as `func`, except the last one (the callback). When the output function - * is called with arguments, it will return an Observable. If `func` function - * calls its callback with one argument, the Observable will emit that value. - * If on the other hand callback is called with multiple values, resulting - * Observable will emit an array with these arguments. - * - * It is very important to remember, that input function `func` is not called - * when output function is, but rather when Observable returned by output - * function is subscribed. This means if `func` makes AJAX request, that request - * will be made every time someone subscribes to resulting Observable, but not before. - * - * Optionally, selector function can be passed to `bindObservable`. That function - * takes the same arguments as callback, and returns value - * that will be emitted by Observable instead of callback parameters themselves. - * Even though by default multiple arguments passed to callback appear in the stream as array, - * selector function will be called with arguments directly, just as callback would. - * This means you can imagine default selector (when one is not provided explicitly) - * as function that aggregates all its arguments into array, or simply returns first argument, - * if there is only one. - * - * Last optional parameter - {@link Scheduler} - can be used to control when call - * to `func` happens after someone subscribes to Observable, as well as when results - * passed to callback will be emitted. By default subscription to Observable calls `func` - * synchronously, but using `Scheduler.async` as last parameter will defer call to input function, - * just like wrapping that call in `setTimeout` with time `0` would. So if you use async Scheduler - * and call `subscribe` on output Observable, all function calls that are currently executing, - * will end before `func` is invoked. - * - * When it comes to emitting results passed to callback, by default they are emitted - * immediately after `func` invokes callback. In particular, if callback is called synchronously, - * then subscription to resulting Observable will call `next` function synchronously as well. - * If you want to defer that call, using `Scheduler.async` will, again, do the job. - * This means that by using `Scheduler.async` you can, in a sense, ensure that `func` - * always calls its callback asynchronously, thus avoiding terrifying Zalgo. - * - * Note that Observable created by output function will always emit only one value - * and then complete right after. Even if `func` calls callback multiple times, values from - * second and following calls will never appear in the stream. If you need to - * listen for multiple calls, you probably want to use {@link fromEvent} or - * {@link fromEventPattern} instead. - * - * If `func` depends on some context (`this` property), that context will be set - * to the same context that output function has at call time. In particular, if `func` - * is called as method of some object, in order to preserve proper behaviour, - * it is recommended to set context of output function to that object as well, - * provided `func` is not already bound. - * - * If input function calls its callback in "node style" (i.e. first argument to callback is - * optional error parameter signaling whether call failed or not), {@link bindNodeCallback} - * provides convenient error handling and probably is a better choice. - * `bindCallback` will treat such functions without any difference and error parameter - * (whether passed or not) will always be interpreted as regular callback argument. - * - * - * @example Convert jQuery's getJSON to an Observable API - * // Suppose we have jQuery.getJSON('/my/url', callback) - * var getJSONAsObservable = Rx.Observable.bindCallback(jQuery.getJSON); - * var result = getJSONAsObservable('/my/url'); - * result.subscribe(x => console.log(x), e => console.error(e)); - * - * - * @example Receive array of arguments passed to callback - * someFunction((a, b, c) => { - * console.log(a); // 5 - * console.log(b); // 'some string' - * console.log(c); // {someProperty: 'someValue'} - * }); - * - * const boundSomeFunction = Rx.Observable.bindCallback(someFunction); - * boundSomeFunction().subscribe(values => { - * console.log(values) // [5, 'some string', {someProperty: 'someValue'}] - * }); - * - * - * @example Use bindCallback with selector function - * someFunction((a, b, c) => { - * console.log(a); // 'a' - * console.log(b); // 'b' - * console.log(c); // 'c' - * }); - * - * const boundSomeFunction = Rx.Observable.bindCallback(someFunction, (a, b, c) => a + b + c); - * boundSomeFunction().subscribe(value => { - * console.log(value) // 'abc' - * }); - * - * - * @example Compare behaviour with and without async Scheduler - * function iCallMyCallbackSynchronously(cb) { - * cb(); - * } - * - * const boundSyncFn = Rx.Observable.bindCallback(iCallMyCallbackSynchronously); - * const boundAsyncFn = Rx.Observable.bindCallback(iCallMyCallbackSynchronously, null, Rx.Scheduler.async); - * - * boundSyncFn().subscribe(() => console.log('I was sync!')); - * boundAsyncFn().subscribe(() => console.log('I was async!')); - * console.log('This happened...'); - * - * // Logs: - * // I was sync! - * // This happened... - * // I was async! - * - * - * @example Use bindCallback on object method - * const boundMethod = Rx.Observable.bindCallback(someObject.methodWithCallback); - * boundMethod.call(someObject) // make sure methodWithCallback has access to someObject - * .subscribe(subscriber); - * - * - * @see {@link bindNodeCallback} - * @see {@link from} - * @see {@link fromPromise} - * - * @param {function} func Function with a callback as the last parameter. - * @param {function} [selector] A function which takes the arguments from the - * callback and maps those to a value to emit on the output Observable. - * @param {Scheduler} [scheduler] The scheduler on which to schedule the - * callbacks. - * @return {function(...params: *): Observable} A function which returns the - * Observable that delivers the same values the callback would deliver. - * @static true - * @name bindCallback - * @owner Observable - */ - BoundCallbackObservable.create = function (func, selector, scheduler) { - if (selector === void 0) { selector = undefined; } - return function () { - var args = []; - for (var _i = 0; _i < arguments.length; _i++) { - args[_i - 0] = arguments[_i]; - } - return new BoundCallbackObservable(func, selector, args, this, scheduler); - }; - }; - BoundCallbackObservable.prototype._subscribe = function (subscriber) { - var callbackFunc = this.callbackFunc; - var args = this.args; - var scheduler = this.scheduler; - var subject = this.subject; - if (!scheduler) { - if (!subject) { - subject = this.subject = new AsyncSubject_1.AsyncSubject(); - var handler = function handlerFn() { - var innerArgs = []; - for (var _i = 0; _i < arguments.length; _i++) { - innerArgs[_i - 0] = arguments[_i]; - } - var source = handlerFn.source; - var selector = source.selector, subject = source.subject; - if (selector) { - var result_1 = tryCatch_1.tryCatch(selector).apply(this, innerArgs); - if (result_1 === errorObject_1.errorObject) { - subject.error(errorObject_1.errorObject.e); - } - else { - subject.next(result_1); - subject.complete(); - } - } - else { - subject.next(innerArgs.length <= 1 ? innerArgs[0] : innerArgs); - subject.complete(); - } - }; - // use named function instance to avoid closure. - handler.source = this; - var result = tryCatch_1.tryCatch(callbackFunc).apply(this.context, args.concat(handler)); - if (result === errorObject_1.errorObject) { - subject.error(errorObject_1.errorObject.e); - } - } - return subject.subscribe(subscriber); - } - else { - return scheduler.schedule(BoundCallbackObservable.dispatch, 0, { source: this, subscriber: subscriber, context: this.context }); - } - }; - BoundCallbackObservable.dispatch = function (state) { - var self = this; - var source = state.source, subscriber = state.subscriber, context = state.context; - var callbackFunc = source.callbackFunc, args = source.args, scheduler = source.scheduler; - var subject = source.subject; - if (!subject) { - subject = source.subject = new AsyncSubject_1.AsyncSubject(); - var handler = function handlerFn() { - var innerArgs = []; - for (var _i = 0; _i < arguments.length; _i++) { - innerArgs[_i - 0] = arguments[_i]; - } - var source = handlerFn.source; - var selector = source.selector, subject = source.subject; - if (selector) { - var result_2 = tryCatch_1.tryCatch(selector).apply(this, innerArgs); - if (result_2 === errorObject_1.errorObject) { - self.add(scheduler.schedule(dispatchError, 0, { err: errorObject_1.errorObject.e, subject: subject })); - } - else { - self.add(scheduler.schedule(dispatchNext, 0, { value: result_2, subject: subject })); - } - } - else { - var value = innerArgs.length <= 1 ? innerArgs[0] : innerArgs; - self.add(scheduler.schedule(dispatchNext, 0, { value: value, subject: subject })); - } - }; - // use named function to pass values in without closure - handler.source = source; - var result = tryCatch_1.tryCatch(callbackFunc).apply(context, args.concat(handler)); - if (result === errorObject_1.errorObject) { - subject.error(errorObject_1.errorObject.e); - } - } - self.add(subject.subscribe(subscriber)); - }; - return BoundCallbackObservable; -}(Observable_1.Observable)); -exports.BoundCallbackObservable = BoundCallbackObservable; -function dispatchNext(arg) { - var value = arg.value, subject = arg.subject; - subject.next(value); - subject.complete(); -} -function dispatchError(arg) { - var err = arg.err, subject = arg.subject; - subject.error(err); -} -//# sourceMappingURL=BoundCallbackObservable.js.map + return null; + }, + + /** + * @spec http://www.w3.org/TR/dom/#dom-treewalker-firstchild + * @method + * @return {Node|null} + */ + firstChild: function () { + return traverseChildren(this, 'first'); + }, + + /** + * @spec http://www.w3.org/TR/dom/#dom-treewalker-lastchild + * @method + * @return {Node|null} + */ + lastChild: function () { + return traverseChildren(this, 'last'); + }, + + /** + * @spec http://www.w3.org/TR/dom/#dom-treewalker-previoussibling + * @method + * @return {Node|null} + */ + previousSibling: function () { + return traverseSiblings(this, 'previous'); + }, + + /** + * @spec http://www.w3.org/TR/dom/#dom-treewalker-nextsibling + * @method + * @return {Node|null} + */ + nextSibling: function () { + return traverseSiblings(this, 'next'); + }, + + /** + * @spec http://www.w3.org/TR/dom/#dom-treewalker-previousnode + * @method + * @return {Node|null} + */ + previousNode: function () { + var node, result, sibling; + node = this.currentNode; + while (node !== this.root) { + sibling = node.previousSibling; + while (sibling !== null) { + node = sibling; + result = this.filter.acceptNode(node); + while (result !== NodeFilter.FILTER_REJECT && node.lastChild !== null) { + node = node.lastChild; + result = this.filter.acceptNode(node); + } + if (result === NodeFilter.FILTER_ACCEPT) { + this.currentNode = node; + return node; + } + sibling = node.previousSibling; + } + if (node === this.root || node.parentNode === null) { + return null; + } + node = node.parentNode; + if (this.filter.acceptNode(node) === NodeFilter.FILTER_ACCEPT) { + this.currentNode = node; + return node; + } + } + return null; + }, + + /** + * @spec http://www.w3.org/TR/dom/#dom-treewalker-nextnode + * @based on WebKit's TreeWalker::nextNode + * https://trac.webkit.org/browser/trunk/Source/WebCore/dom/TreeWalker.cpp?rev=179143#L252 + * @method + * @return {Node|null} + */ + nextNode: function () { + var node, result, following; + node = this.currentNode; + result = NodeFilter.FILTER_ACCEPT; + + while (true) { + while (result !== NodeFilter.FILTER_REJECT && node.firstChild !== null) { + node = node.firstChild; + result = this.filter.acceptNode(node); + if (result === NodeFilter.FILTER_ACCEPT) { + this.currentNode = node; + return node; + } + } + following = NodeTraversal.nextSkippingChildren(node, this.root); + if (following !== null) { + node = following; + } + else { + return null; + } + result = this.filter.acceptNode(node); + if (result === NodeFilter.FILTER_ACCEPT) { + this.currentNode = node; + return node; + } + } + } +}; + /***/ }), -/* 247 */ +/* 80 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + +// https://html.spec.whatwg.org/multipage/webappapis.html#windowtimers +var WindowTimers = { + setTimeout: setTimeout, + clearTimeout: clearTimeout, + setInterval: setInterval, + clearInterval: clearInterval }; -var Observable_1 = __webpack_require__(0); -var tryCatch_1 = __webpack_require__(7); -var errorObject_1 = __webpack_require__(5); -var AsyncSubject_1 = __webpack_require__(25); -/** - * We need this JSDoc comment for affecting ESDoc. - * @extends {Ignored} - * @hide true - */ -var BoundNodeCallbackObservable = (function (_super) { - __extends(BoundNodeCallbackObservable, _super); - function BoundNodeCallbackObservable(callbackFunc, selector, args, context, scheduler) { - _super.call(this); - this.callbackFunc = callbackFunc; - this.selector = selector; - this.args = args; - this.context = context; - this.scheduler = scheduler; - } - /* tslint:enable:max-line-length */ - /** - * Converts a Node.js-style callback API to a function that returns an - * Observable. - * - * It's just like {@link bindCallback}, but the - * callback is expected to be of type `callback(error, result)`. - * - * `bindNodeCallback` is not an operator because its input and output are not - * Observables. The input is a function `func` with some parameters, but the - * last parameter must be a callback function that `func` calls when it is - * done. The callback function is expected to follow Node.js conventions, - * where the first argument to the callback is an error object, signaling - * whether call was successful. If that object is passed to callback, it means - * something went wrong. - * - * The output of `bindNodeCallback` is a function that takes the same - * parameters as `func`, except the last one (the callback). When the output - * function is called with arguments, it will return an Observable. - * If `func` calls its callback with error parameter present, Observable will - * error with that value as well. If error parameter is not passed, Observable will emit - * second parameter. If there are more parameters (third and so on), - * Observable will emit an array with all arguments, except first error argument. - * - * Optionally `bindNodeCallback` accepts selector function, which allows you to - * make resulting Observable emit value computed by selector, instead of regular - * callback arguments. It works similarly to {@link bindCallback} selector, but - * Node.js-style error argument will never be passed to that function. - * - * Note that `func` will not be called at the same time output function is, - * but rather whenever resulting Observable is subscribed. By default call to - * `func` will happen synchronously after subscription, but that can be changed - * with proper {@link Scheduler} provided as optional third parameter. Scheduler - * can also control when values from callback will be emitted by Observable. - * To find out more, check out documentation for {@link bindCallback}, where - * Scheduler works exactly the same. - * - * As in {@link bindCallback}, context (`this` property) of input function will be set to context - * of returned function, when it is called. - * - * After Observable emits value, it will complete immediately. This means - * even if `func` calls callback again, values from second and consecutive - * calls will never appear on the stream. If you need to handle functions - * that call callbacks multiple times, check out {@link fromEvent} or - * {@link fromEventPattern} instead. - * - * Note that `bindNodeCallback` can be used in non-Node.js environments as well. - * "Node.js-style" callbacks are just a convention, so if you write for - * browsers or any other environment and API you use implements that callback style, - * `bindNodeCallback` can be safely used on that API functions as well. - * - * Remember that Error object passed to callback does not have to be an instance - * of JavaScript built-in `Error` object. In fact, it does not even have to an object. - * Error parameter of callback function is interpreted as "present", when value - * of that parameter is truthy. It could be, for example, non-zero number, non-empty - * string or boolean `true`. In all of these cases resulting Observable would error - * with that value. This means usually regular style callbacks will fail very often when - * `bindNodeCallback` is used. If your Observable errors much more often then you - * would expect, check if callback really is called in Node.js-style and, if not, - * switch to {@link bindCallback} instead. - * - * Note that even if error parameter is technically present in callback, but its value - * is falsy, it still won't appear in array emitted by Observable or in selector function. - * - * - * @example Read a file from the filesystem and get the data as an Observable - * import * as fs from 'fs'; - * var readFileAsObservable = Rx.Observable.bindNodeCallback(fs.readFile); - * var result = readFileAsObservable('./roadNames.txt', 'utf8'); - * result.subscribe(x => console.log(x), e => console.error(e)); - * - * - * @example Use on function calling callback with multiple arguments - * someFunction((err, a, b) => { - * console.log(err); // null - * console.log(a); // 5 - * console.log(b); // "some string" - * }); - * var boundSomeFunction = Rx.Observable.bindNodeCallback(someFunction); - * boundSomeFunction() - * .subscribe(value => { - * console.log(value); // [5, "some string"] - * }); - * - * - * @example Use with selector function - * someFunction((err, a, b) => { - * console.log(err); // undefined - * console.log(a); // "abc" - * console.log(b); // "DEF" - * }); - * var boundSomeFunction = Rx.Observable.bindNodeCallback(someFunction, (a, b) => a + b); - * boundSomeFunction() - * .subscribe(value => { - * console.log(value); // "abcDEF" - * }); - * - * - * @example Use on function calling callback in regular style - * someFunction(a => { - * console.log(a); // 5 - * }); - * var boundSomeFunction = Rx.Observable.bindNodeCallback(someFunction); - * boundSomeFunction() - * .subscribe( - * value => {} // never gets called - * err => console.log(err) // 5 - *); - * - * - * @see {@link bindCallback} - * @see {@link from} - * @see {@link fromPromise} - * - * @param {function} func Function with a Node.js-style callback as the last parameter. - * @param {function} [selector] A function which takes the arguments from the - * callback and maps those to a value to emit on the output Observable. - * @param {Scheduler} [scheduler] The scheduler on which to schedule the - * callbacks. - * @return {function(...params: *): Observable} A function which returns the - * Observable that delivers the same values the Node.js callback would - * deliver. - * @static true - * @name bindNodeCallback - * @owner Observable - */ - BoundNodeCallbackObservable.create = function (func, selector, scheduler) { - if (selector === void 0) { selector = undefined; } - return function () { - var args = []; - for (var _i = 0; _i < arguments.length; _i++) { - args[_i - 0] = arguments[_i]; - } - return new BoundNodeCallbackObservable(func, selector, args, this, scheduler); - }; - }; - BoundNodeCallbackObservable.prototype._subscribe = function (subscriber) { - var callbackFunc = this.callbackFunc; - var args = this.args; - var scheduler = this.scheduler; - var subject = this.subject; - if (!scheduler) { - if (!subject) { - subject = this.subject = new AsyncSubject_1.AsyncSubject(); - var handler = function handlerFn() { - var innerArgs = []; - for (var _i = 0; _i < arguments.length; _i++) { - innerArgs[_i - 0] = arguments[_i]; - } - var source = handlerFn.source; - var selector = source.selector, subject = source.subject; - var err = innerArgs.shift(); - if (err) { - subject.error(err); - } - else if (selector) { - var result_1 = tryCatch_1.tryCatch(selector).apply(this, innerArgs); - if (result_1 === errorObject_1.errorObject) { - subject.error(errorObject_1.errorObject.e); - } - else { - subject.next(result_1); - subject.complete(); - } - } - else { - subject.next(innerArgs.length <= 1 ? innerArgs[0] : innerArgs); - subject.complete(); - } - }; - // use named function instance to avoid closure. - handler.source = this; - var result = tryCatch_1.tryCatch(callbackFunc).apply(this.context, args.concat(handler)); - if (result === errorObject_1.errorObject) { - subject.error(errorObject_1.errorObject.e); - } - } - return subject.subscribe(subscriber); - } - else { - return scheduler.schedule(dispatch, 0, { source: this, subscriber: subscriber, context: this.context }); - } - }; - return BoundNodeCallbackObservable; -}(Observable_1.Observable)); -exports.BoundNodeCallbackObservable = BoundNodeCallbackObservable; -function dispatch(state) { - var self = this; - var source = state.source, subscriber = state.subscriber, context = state.context; - // XXX: cast to `any` to access to the private field in `source`. - var _a = source, callbackFunc = _a.callbackFunc, args = _a.args, scheduler = _a.scheduler; - var subject = source.subject; - if (!subject) { - subject = source.subject = new AsyncSubject_1.AsyncSubject(); - var handler = function handlerFn() { - var innerArgs = []; - for (var _i = 0; _i < arguments.length; _i++) { - innerArgs[_i - 0] = arguments[_i]; - } - var source = handlerFn.source; - var selector = source.selector, subject = source.subject; - var err = innerArgs.shift(); - if (err) { - self.add(scheduler.schedule(dispatchError, 0, { err: err, subject: subject })); - } - else if (selector) { - var result_2 = tryCatch_1.tryCatch(selector).apply(this, innerArgs); - if (result_2 === errorObject_1.errorObject) { - self.add(scheduler.schedule(dispatchError, 0, { err: errorObject_1.errorObject.e, subject: subject })); - } - else { - self.add(scheduler.schedule(dispatchNext, 0, { value: result_2, subject: subject })); - } - } - else { - var value = innerArgs.length <= 1 ? innerArgs[0] : innerArgs; - self.add(scheduler.schedule(dispatchNext, 0, { value: value, subject: subject })); - } - }; - // use named function to pass values in without closure - handler.source = source; - var result = tryCatch_1.tryCatch(callbackFunc).apply(context, args.concat(handler)); - if (result === errorObject_1.errorObject) { - self.add(scheduler.schedule(dispatchError, 0, { err: errorObject_1.errorObject.e, subject: subject })); - } - } - self.add(subject.subscribe(subscriber)); -} -function dispatchNext(arg) { - var value = arg.value, subject = arg.subject; - subject.next(value); - subject.complete(); -} -function dispatchError(arg) { - var err = arg.err, subject = arg.subject; - subject.error(err); -} -//# sourceMappingURL=BoundNodeCallbackObservable.js.map + +module.exports = WindowTimers; + /***/ }), -/* 248 */ +/* 81 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; +/* jshint node:true, latedef:false */ + // jshint ignore:line +/*! +Parser-Lib +Copyright (c) 2009-2011 Nicholas C. Zakas. All rights reserved. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. + +*/ +/* Version v0.2.5+domino1, Build time: 30-January-2016 05:13:03 */ +var parserlib = Object.create(null); +(function(){ -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; -var Observable_1 = __webpack_require__(0); -var subscribeToResult_1 = __webpack_require__(3); -var OuterSubscriber_1 = __webpack_require__(4); /** - * We need this JSDoc comment for affecting ESDoc. - * @extends {Ignored} - * @hide true + * A generic base to inherit from for any object + * that needs event handling. + * @class EventTarget + * @constructor */ -var DeferObservable = (function (_super) { - __extends(DeferObservable, _super); - function DeferObservable(observableFactory) { - _super.call(this); - this.observableFactory = observableFactory; - } +function EventTarget(){ + /** - * Creates an Observable that, on subscribe, calls an Observable factory to - * make an Observable for each new Observer. - * - * Creates the Observable lazily, that is, only when it - * is subscribed. - * - * - * - * - * `defer` allows you to create the Observable only when the Observer - * subscribes, and create a fresh Observable for each Observer. It waits until - * an Observer subscribes to it, and then it generates an Observable, - * typically with an Observable factory function. It does this afresh for each - * subscriber, so although each subscriber may think it is subscribing to the - * same Observable, in fact each subscriber gets its own individual - * Observable. - * - * @example Subscribe to either an Observable of clicks or an Observable of interval, at random - * var clicksOrInterval = Rx.Observable.defer(function () { - * if (Math.random() > 0.5) { - * return Rx.Observable.fromEvent(document, 'click'); - * } else { - * return Rx.Observable.interval(1000); - * } - * }); - * clicksOrInterval.subscribe(x => console.log(x)); - * - * // Results in the following behavior: - * // If the result of Math.random() is greater than 0.5 it will listen - * // for clicks anywhere on the "document"; when document is clicked it - * // will log a MouseEvent object to the console. If the result is less - * // than 0.5 it will emit ascending numbers, one every second(1000ms). - * - * @see {@link create} - * - * @param {function(): SubscribableOrPromise} observableFactory The Observable - * factory function to invoke for each Observer that subscribes to the output - * Observable. May also return a Promise, which will be converted on the fly - * to an Observable. - * @return {Observable} An Observable whose Observers' subscriptions trigger - * an invocation of the given Observable factory function. - * @static true - * @name defer - * @owner Observable + * The array of listeners for various events. + * @type Object + * @property _listeners + * @private */ - DeferObservable.create = function (observableFactory) { - return new DeferObservable(observableFactory); - }; - DeferObservable.prototype._subscribe = function (subscriber) { - return new DeferSubscriber(subscriber, this.observableFactory); - }; - return DeferObservable; -}(Observable_1.Observable)); -exports.DeferObservable = DeferObservable; -var DeferSubscriber = (function (_super) { - __extends(DeferSubscriber, _super); - function DeferSubscriber(destination, factory) { - _super.call(this, destination); - this.factory = factory; - this.tryDefer(); - } - DeferSubscriber.prototype.tryDefer = function () { - try { - this._callFactory(); + this._listeners = Object.create(null); +} + +EventTarget.prototype = { + + //restore constructor + constructor: EventTarget, + + /** + * Adds a listener for a given event type. + * @param {String} type The type of event to add a listener for. + * @param {Function} listener The function to call when the event occurs. + * @return {void} + * @method addListener + */ + addListener: function(type, listener){ + if (!this._listeners[type]){ + this._listeners[type] = []; + } + + this._listeners[type].push(listener); + }, + + /** + * Fires an event based on the passed-in object. + * @param {Object|String} event An object with at least a 'type' attribute + * or a string indicating the event name. + * @return {void} + * @method fire + */ + fire: function(event){ + if (typeof event === "string"){ + event = { type: event }; } - catch (err) { - this._error(err); + if (typeof event.target !== "undefined"){ + event.target = this; } - }; - DeferSubscriber.prototype._callFactory = function () { - var result = this.factory(); - if (result) { - this.add(subscribeToResult_1.subscribeToResult(this, result)); + + if (typeof event.type === "undefined"){ + throw new Error("Event object missing 'type' property."); } - }; - return DeferSubscriber; -}(OuterSubscriber_1.OuterSubscriber)); -//# sourceMappingURL=DeferObservable.js.map -/***/ }), -/* 249 */ -/***/ (function(module, exports, __webpack_require__) { + if (this._listeners[event.type]){ -"use strict"; + //create a copy of the array and use that so listeners can't chane + var listeners = this._listeners[event.type].concat(); + for (var i=0, len=listeners.length; i < len; i++){ + listeners[i].call(this, event); + } + } + }, -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + /** + * Removes a listener for a given event type. + * @param {String} type The type of event to remove a listener from. + * @param {Function} listener The function to remove from the event. + * @return {void} + * @method removeListener + */ + removeListener: function(type, listener){ + if (this._listeners[type]){ + var listeners = this._listeners[type]; + for (var i=0, len=listeners.length; i < len; i++){ + if (listeners[i] === listener){ + listeners.splice(i, 1); + break; + } + } + + + } + } }; -var Observable_1 = __webpack_require__(0); /** - * We need this JSDoc comment for affecting ESDoc. - * @extends {Ignored} - * @hide true + * Convenient way to read through strings. + * @namespace parserlib.util + * @class StringReader + * @constructor + * @param {String} text The text to read. */ -var ErrorObservable = (function (_super) { - __extends(ErrorObservable, _super); - function ErrorObservable(error, scheduler) { - _super.call(this); - this.error = error; - this.scheduler = scheduler; - } +function StringReader(text){ + /** - * Creates an Observable that emits no items to the Observer and immediately - * emits an error notification. - * - * Just emits 'error', and nothing else. - * - * - * - * - * This static operator is useful for creating a simple Observable that only - * emits the error notification. It can be used for composing with other - * Observables, such as in a {@link mergeMap}. - * - * @example Emit the number 7, then emit an error. - * var result = Rx.Observable.throw(new Error('oops!')).startWith(7); - * result.subscribe(x => console.log(x), e => console.error(e)); - * - * @example Map and flatten numbers to the sequence 'a', 'b', 'c', but throw an error for 13 - * var interval = Rx.Observable.interval(1000); - * var result = interval.mergeMap(x => - * x === 13 ? - * Rx.Observable.throw('Thirteens are bad') : - * Rx.Observable.of('a', 'b', 'c') - * ); - * result.subscribe(x => console.log(x), e => console.error(e)); - * - * @see {@link create} - * @see {@link empty} - * @see {@link never} - * @see {@link of} - * - * @param {any} error The particular Error to pass to the error notification. - * @param {Scheduler} [scheduler] A {@link IScheduler} to use for scheduling - * the emission of the error notification. - * @return {Observable} An error Observable: emits only the error notification - * using the given error argument. - * @static true - * @name throw - * @owner Observable + * The input text with line endings normalized. + * @property _input + * @type String + * @private */ - ErrorObservable.create = function (error, scheduler) { - return new ErrorObservable(error, scheduler); - }; - ErrorObservable.dispatch = function (arg) { - var error = arg.error, subscriber = arg.subscriber; - subscriber.error(error); - }; - ErrorObservable.prototype._subscribe = function (subscriber) { - var error = this.error; - var scheduler = this.scheduler; - subscriber.syncErrorThrowable = true; - if (scheduler) { - return scheduler.schedule(ErrorObservable.dispatch, 0, { - error: error, subscriber: subscriber - }); - } - else { - subscriber.error(error); - } - }; - return ErrorObservable; -}(Observable_1.Observable)); -exports.ErrorObservable = ErrorObservable; -//# sourceMappingURL=ErrorObservable.js.map + this._input = text.replace(/(\r|\n){1,2}/g, "\n"); -/***/ }), -/* 250 */ -/***/ (function(module, exports, __webpack_require__) { -"use strict"; + /** + * The row for the character to be read next. + * @property _line + * @type int + * @private + */ + this._line = 1; + + + /** + * The column for the character to be read next. + * @property _col + * @type int + * @private + */ + this._col = 1; + + /** + * The index of the character in the input to be read next. + * @property _cursor + * @type int + * @private + */ + this._cursor = 0; +} + +StringReader.prototype = { + + //restore constructor + constructor: StringReader, + + //------------------------------------------------------------------------- + // Position info + //------------------------------------------------------------------------- + + /** + * Returns the column of the character to be read next. + * @return {int} The column of the character to be read next. + * @method getCol + */ + getCol: function(){ + return this._col; + }, + + /** + * Returns the row of the character to be read next. + * @return {int} The row of the character to be read next. + * @method getLine + */ + getLine: function(){ + return this._line ; + }, + + /** + * Determines if you're at the end of the input. + * @return {Boolean} True if there's no more input, false otherwise. + * @method eof + */ + eof: function(){ + return (this._cursor === this._input.length); + }, + + //------------------------------------------------------------------------- + // Basic reading + //------------------------------------------------------------------------- -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; -var Observable_1 = __webpack_require__(0); -var tryCatch_1 = __webpack_require__(7); -var isFunction_1 = __webpack_require__(81); -var errorObject_1 = __webpack_require__(5); -var Subscription_1 = __webpack_require__(9); -var toString = Object.prototype.toString; -function isNodeStyleEventEmitter(sourceObj) { - return !!sourceObj && typeof sourceObj.addListener === 'function' && typeof sourceObj.removeListener === 'function'; -} -function isJQueryStyleEventEmitter(sourceObj) { - return !!sourceObj && typeof sourceObj.on === 'function' && typeof sourceObj.off === 'function'; -} -function isNodeList(sourceObj) { - return !!sourceObj && toString.call(sourceObj) === '[object NodeList]'; -} -function isHTMLCollection(sourceObj) { - return !!sourceObj && toString.call(sourceObj) === '[object HTMLCollection]'; -} -function isEventTarget(sourceObj) { - return !!sourceObj && typeof sourceObj.addEventListener === 'function' && typeof sourceObj.removeEventListener === 'function'; -} -/** - * We need this JSDoc comment for affecting ESDoc. - * @extends {Ignored} - * @hide true - */ -var FromEventObservable = (function (_super) { - __extends(FromEventObservable, _super); - function FromEventObservable(sourceObj, eventName, selector, options) { - _super.call(this); - this.sourceObj = sourceObj; - this.eventName = eventName; - this.selector = selector; - this.options = options; - } - /* tslint:enable:max-line-length */ /** - * Creates an Observable that emits events of a specific type coming from the - * given event target. - * - * Creates an Observable from DOM events, or Node - * EventEmitter events or others. - * - * - * - * Creates an Observable by attaching an event listener to an "event target", - * which may be an object with `addEventListener` and `removeEventListener`, - * a Node.js EventEmitter, a jQuery style EventEmitter, a NodeList from the - * DOM, or an HTMLCollection from the DOM. The event handler is attached when - * the output Observable is subscribed, and removed when the Subscription is - * unsubscribed. - * - * @example Emits clicks happening on the DOM document - * var clicks = Rx.Observable.fromEvent(document, 'click'); - * clicks.subscribe(x => console.log(x)); - * - * // Results in: - * // MouseEvent object logged to console everytime a click - * // occurs on the document. - * - * @see {@link from} - * @see {@link fromEventPattern} - * - * @param {EventTargetLike} target The DOMElement, event target, Node.js - * EventEmitter, NodeList or HTMLCollection to attach the event handler to. - * @param {string} eventName The event name of interest, being emitted by the - * `target`. - * @param {EventListenerOptions} [options] Options to pass through to addEventListener - * @param {SelectorMethodSignature} [selector] An optional function to - * post-process results. It takes the arguments from the event handler and - * should return a single value. - * @return {Observable} - * @static true - * @name fromEvent - * @owner Observable + * Reads the next character without advancing the cursor. + * @param {int} count How many characters to look ahead (default is 1). + * @return {String} The next character or null if there is no next character. + * @method peek */ - FromEventObservable.create = function (target, eventName, options, selector) { - if (isFunction_1.isFunction(options)) { - selector = options; - options = undefined; + peek: function(count){ + var c = null; + count = (typeof count === "undefined" ? 1 : count); + + //if we're not at the end of the input... + if (this._cursor < this._input.length){ + + //get character and increment cursor and column + c = this._input.charAt(this._cursor + count - 1); } - return new FromEventObservable(target, eventName, selector, options); - }; - FromEventObservable.setupSubscription = function (sourceObj, eventName, handler, subscriber, options) { - var unsubscribe; - if (isNodeList(sourceObj) || isHTMLCollection(sourceObj)) { - for (var i = 0, len = sourceObj.length; i < len; i++) { - FromEventObservable.setupSubscription(sourceObj[i], eventName, handler, subscriber, options); + + return c; + }, + + /** + * Reads the next character from the input and adjusts the row and column + * accordingly. + * @return {String} The next character or null if there is no next character. + * @method read + */ + read: function(){ + var c = null; + + //if we're not at the end of the input... + if (this._cursor < this._input.length){ + + //if the last character was a newline, increment row count + //and reset column count + if (this._input.charAt(this._cursor) === "\n"){ + this._line++; + this._col=1; + } else { + this._col++; } + + //get character and increment cursor and column + c = this._input.charAt(this._cursor++); } - else if (isEventTarget(sourceObj)) { - var source_1 = sourceObj; - sourceObj.addEventListener(eventName, handler, options); - unsubscribe = function () { return source_1.removeEventListener(eventName, handler); }; + + return c; + }, + + //------------------------------------------------------------------------- + // Misc + //------------------------------------------------------------------------- + + /** + * Saves the current location so it can be returned to later. + * @method mark + * @return {void} + */ + mark: function(){ + this._bookmark = { + cursor: this._cursor, + line: this._line, + col: this._col + }; + }, + + reset: function(){ + if (this._bookmark){ + this._cursor = this._bookmark.cursor; + this._line = this._bookmark.line; + this._col = this._bookmark.col; + delete this._bookmark; } - else if (isJQueryStyleEventEmitter(sourceObj)) { - var source_2 = sourceObj; - sourceObj.on(eventName, handler); - unsubscribe = function () { return source_2.off(eventName, handler); }; + }, + + //------------------------------------------------------------------------- + // Advanced reading + //------------------------------------------------------------------------- + + /** + * Reads up to and including the given string. Throws an error if that + * string is not found. + * @param {String} pattern The string to read. + * @return {String} The string when it is found. + * @throws Error when the string pattern is not found. + * @method readTo + */ + readTo: function(pattern){ + + var buffer = "", + c; + + /* + * First, buffer must be the same length as the pattern. + * Then, buffer must end with the pattern or else reach the + * end of the input. + */ + while (buffer.length < pattern.length || buffer.lastIndexOf(pattern) !== buffer.length - pattern.length){ + c = this.read(); + if (c){ + buffer += c; + } else { + throw new Error("Expected \"" + pattern + "\" at line " + this._line + ", col " + this._col + "."); + } } - else if (isNodeStyleEventEmitter(sourceObj)) { - var source_3 = sourceObj; - sourceObj.addListener(eventName, handler); - unsubscribe = function () { return source_3.removeListener(eventName, handler); }; + + return buffer; + + }, + + /** + * Reads characters while each character causes the given + * filter function to return true. The function is passed + * in each character and either returns true to continue + * reading or false to stop. + * @param {Function} filter The function to read on each character. + * @return {String} The string made up of all characters that passed the + * filter check. + * @method readWhile + */ + readWhile: function(filter){ + + var buffer = "", + c = this.read(); + + while(c !== null && filter(c)){ + buffer += c; + c = this.read(); } - else { - throw new TypeError('Invalid event target'); - } - subscriber.add(new Subscription_1.Subscription(unsubscribe)); - }; - FromEventObservable.prototype._subscribe = function (subscriber) { - var sourceObj = this.sourceObj; - var eventName = this.eventName; - var options = this.options; - var selector = this.selector; - var handler = selector ? function () { - var args = []; - for (var _i = 0; _i < arguments.length; _i++) { - args[_i - 0] = arguments[_i]; - } - var result = tryCatch_1.tryCatch(selector).apply(void 0, args); - if (result === errorObject_1.errorObject) { - subscriber.error(errorObject_1.errorObject.e); + + return buffer; + + }, + + /** + * Reads characters that match either text or a regular expression and + * returns those characters. If a match is found, the row and column + * are adjusted; if no match is found, the reader's state is unchanged. + * reading or false to stop. + * @param {String|RegExp} matchter If a string, then the literal string + * value is searched for. If a regular expression, then any string + * matching the pattern is search for. + * @return {String} The string made up of all characters that matched or + * null if there was no match. + * @method readMatch + */ + readMatch: function(matcher){ + + var source = this._input.substring(this._cursor), + value = null; + + //if it's a string, just do a straight match + if (typeof matcher === "string"){ + if (source.indexOf(matcher) === 0){ + value = this.readCount(matcher.length); } - else { - subscriber.next(result); + } else if (matcher instanceof RegExp){ + if (matcher.test(source)){ + value = this.readCount(RegExp.lastMatch.length); } - } : function (e) { return subscriber.next(e); }; - FromEventObservable.setupSubscription(sourceObj, eventName, handler, subscriber, options); - }; - return FromEventObservable; -}(Observable_1.Observable)); -exports.FromEventObservable = FromEventObservable; -//# sourceMappingURL=FromEventObservable.js.map + } -/***/ }), -/* 251 */ -/***/ (function(module, exports, __webpack_require__) { + return value; + }, -"use strict"; -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + /** + * Reads a given number of characters. If the end of the input is reached, + * it reads only the remaining characters and does not throw an error. + * @param {int} count The number of characters to read. + * @return {String} The string made up the read characters. + * @method readCount + */ + readCount: function(count){ + var buffer = ""; + + while(count--){ + buffer += this.read(); + } + + return buffer; + } + }; -var isFunction_1 = __webpack_require__(81); -var Observable_1 = __webpack_require__(0); -var Subscription_1 = __webpack_require__(9); /** - * We need this JSDoc comment for affecting ESDoc. - * @extends {Ignored} - * @hide true + * Type to use when a syntax error occurs. + * @class SyntaxError + * @namespace parserlib.util + * @constructor + * @param {String} message The error message. + * @param {int} line The line at which the error occurred. + * @param {int} col The column at which the error occurred. */ -var FromEventPatternObservable = (function (_super) { - __extends(FromEventPatternObservable, _super); - function FromEventPatternObservable(addHandler, removeHandler, selector) { - _super.call(this); - this.addHandler = addHandler; - this.removeHandler = removeHandler; - this.selector = selector; - } +function SyntaxError(message, line, col){ + Error.call(this); + this.name = this.constructor.name; + /** - * Creates an Observable from an API based on addHandler/removeHandler - * functions. - * - * Converts any addHandler/removeHandler API to an - * Observable. - * - * - * - * Creates an Observable by using the `addHandler` and `removeHandler` - * functions to add and remove the handlers, with an optional selector - * function to project the event arguments to a result. The `addHandler` is - * called when the output Observable is subscribed, and `removeHandler` is - * called when the Subscription is unsubscribed. - * - * @example Emits clicks happening on the DOM document - * function addClickHandler(handler) { - * document.addEventListener('click', handler); - * } - * - * function removeClickHandler(handler) { - * document.removeEventListener('click', handler); - * } - * - * var clicks = Rx.Observable.fromEventPattern( - * addClickHandler, - * removeClickHandler - * ); - * clicks.subscribe(x => console.log(x)); - * - * @see {@link from} - * @see {@link fromEvent} - * - * @param {function(handler: Function): any} addHandler A function that takes - * a `handler` function as argument and attaches it somehow to the actual - * source of events. - * @param {function(handler: Function, signal?: any): void} [removeHandler] An optional function that - * takes a `handler` function as argument and removes it in case it was - * previously attached using `addHandler`. if addHandler returns signal to teardown when remove, - * removeHandler function will forward it. - * @param {function(...args: any): T} [selector] An optional function to - * post-process results. It takes the arguments from the event handler and - * should return a single value. - * @return {Observable} - * @static true - * @name fromEventPattern - * @owner Observable + * The column at which the error occurred. + * @type int + * @property col */ - FromEventPatternObservable.create = function (addHandler, removeHandler, selector) { - return new FromEventPatternObservable(addHandler, removeHandler, selector); - }; - FromEventPatternObservable.prototype._subscribe = function (subscriber) { - var _this = this; - var removeHandler = this.removeHandler; - var handler = !!this.selector ? function () { - var args = []; - for (var _i = 0; _i < arguments.length; _i++) { - args[_i - 0] = arguments[_i]; - } - _this._callSelector(subscriber, args); - } : function (e) { subscriber.next(e); }; - var retValue = this._callAddHandler(handler, subscriber); - if (!isFunction_1.isFunction(removeHandler)) { - return; - } - subscriber.add(new Subscription_1.Subscription(function () { - //TODO: determine whether or not to forward to error handler - removeHandler(handler, retValue); - })); - }; - FromEventPatternObservable.prototype._callSelector = function (subscriber, args) { - try { - var result = this.selector.apply(this, args); - subscriber.next(result); - } - catch (e) { - subscriber.error(e); - } - }; - FromEventPatternObservable.prototype._callAddHandler = function (handler, errorSubscriber) { - try { - return this.addHandler(handler) || null; - } - catch (e) { - errorSubscriber.error(e); - } - }; - return FromEventPatternObservable; -}(Observable_1.Observable)); -exports.FromEventPatternObservable = FromEventPatternObservable; -//# sourceMappingURL=FromEventPatternObservable.js.map + this.col = col; -/***/ }), -/* 252 */ -/***/ (function(module, exports, __webpack_require__) { + /** + * The line at which the error occurred. + * @type int + * @property line + */ + this.line = line; -"use strict"; + /** + * The text representation of the unit. + * @type String + * @property text + */ + this.message = message; -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; -var Observable_1 = __webpack_require__(0); -var isScheduler_1 = __webpack_require__(13); -var selfSelector = function (value) { return value; }; +} + +//inherit from Error +SyntaxError.prototype = Object.create(Error.prototype); // jshint ignore:line +SyntaxError.prototype.constructor = SyntaxError; // jshint ignore:line /** - * We need this JSDoc comment for affecting ESDoc. - * @extends {Ignored} - * @hide true + * Base type to represent a single syntactic unit. + * @class SyntaxUnit + * @namespace parserlib.util + * @constructor + * @param {String} text The text of the unit. + * @param {int} line The line of text on which the unit resides. + * @param {int} col The column of text on which the unit resides. */ -var GenerateObservable = (function (_super) { - __extends(GenerateObservable, _super); - function GenerateObservable(initialState, condition, iterate, resultSelector, scheduler) { - _super.call(this); - this.initialState = initialState; - this.condition = condition; - this.iterate = iterate; - this.resultSelector = resultSelector; - this.scheduler = scheduler; - } - GenerateObservable.create = function (initialStateOrOptions, condition, iterate, resultSelectorOrObservable, scheduler) { - if (arguments.length == 1) { - return new GenerateObservable(initialStateOrOptions.initialState, initialStateOrOptions.condition, initialStateOrOptions.iterate, initialStateOrOptions.resultSelector || selfSelector, initialStateOrOptions.scheduler); - } - if (resultSelectorOrObservable === undefined || isScheduler_1.isScheduler(resultSelectorOrObservable)) { - return new GenerateObservable(initialStateOrOptions, condition, iterate, selfSelector, resultSelectorOrObservable); - } - return new GenerateObservable(initialStateOrOptions, condition, iterate, resultSelectorOrObservable, scheduler); - }; - GenerateObservable.prototype._subscribe = function (subscriber) { - var state = this.initialState; - if (this.scheduler) { - return this.scheduler.schedule(GenerateObservable.dispatch, 0, { - subscriber: subscriber, - iterate: this.iterate, - condition: this.condition, - resultSelector: this.resultSelector, - state: state }); - } - var _a = this, condition = _a.condition, resultSelector = _a.resultSelector, iterate = _a.iterate; - do { - if (condition) { - var conditionResult = void 0; - try { - conditionResult = condition(state); - } - catch (err) { - subscriber.error(err); - return; - } - if (!conditionResult) { - subscriber.complete(); - break; - } - } - var value = void 0; - try { - value = resultSelector(state); - } - catch (err) { - subscriber.error(err); - return; - } - subscriber.next(value); - if (subscriber.closed) { - break; - } - try { - state = iterate(state); - } - catch (err) { - subscriber.error(err); - return; - } - } while (true); - }; - GenerateObservable.dispatch = function (state) { - var subscriber = state.subscriber, condition = state.condition; - if (subscriber.closed) { - return; - } - if (state.needIterate) { - try { - state.state = state.iterate(state.state); - } - catch (err) { - subscriber.error(err); - return; - } - } - else { - state.needIterate = true; - } - if (condition) { - var conditionResult = void 0; - try { - conditionResult = condition(state.state); - } - catch (err) { - subscriber.error(err); - return; - } - if (!conditionResult) { - subscriber.complete(); - return; - } - if (subscriber.closed) { - return; - } - } - var value; - try { - value = state.resultSelector(state.state); - } - catch (err) { - subscriber.error(err); - return; - } - if (subscriber.closed) { - return; - } - subscriber.next(value); - if (subscriber.closed) { - return; - } - return this.schedule(state); - }; - return GenerateObservable; -}(Observable_1.Observable)); -exports.GenerateObservable = GenerateObservable; -//# sourceMappingURL=GenerateObservable.js.map +function SyntaxUnit(text, line, col, type){ -/***/ }), -/* 253 */ -/***/ (function(module, exports, __webpack_require__) { -"use strict"; + /** + * The column of text on which the unit resides. + * @type int + * @property col + */ + this.col = col; + + /** + * The line of text on which the unit resides. + * @type int + * @property line + */ + this.line = line; + + /** + * The text representation of the unit. + * @type String + * @property text + */ + this.text = text; + + /** + * The type of syntax unit. + * @type int + * @property type + */ + this.type = type; +} + +/** + * Create a new syntax unit based solely on the given token. + * Convenience method for creating a new syntax unit when + * it represents a single token instead of multiple. + * @param {Object} token The token object to represent. + * @return {parserlib.util.SyntaxUnit} The object representing the token. + * @static + * @method fromToken + */ +SyntaxUnit.fromToken = function(token){ + return new SyntaxUnit(token.value, token.startLine, token.startCol); +}; + +SyntaxUnit.prototype = { + + //restore constructor + constructor: SyntaxUnit, + + /** + * Returns the text representation of the unit. + * @return {String} The text representation of the unit. + * @method valueOf + */ + valueOf: function(){ + return this.toString(); + }, + + /** + * Returns the text representation of the unit. + * @return {String} The text representation of the unit. + * @method toString + */ + toString: function(){ + return this.text; + } -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; -var Observable_1 = __webpack_require__(0); -var subscribeToResult_1 = __webpack_require__(3); -var OuterSubscriber_1 = __webpack_require__(4); + +/** + * Generic TokenStream providing base functionality. + * @class TokenStreamBase + * @namespace parserlib.util + * @constructor + * @param {String|StringReader} input The text to tokenize or a reader from + * which to read the input. + */ +function TokenStreamBase(input, tokenData){ + + /** + * The string reader for easy access to the text. + * @type StringReader + * @property _reader + * @private + */ + this._reader = input ? new StringReader(input.toString()) : null; + + /** + * Token object for the last consumed token. + * @type Token + * @property _token + * @private + */ + this._token = null; + + /** + * The array of token information. + * @type Array + * @property _tokenData + * @private + */ + this._tokenData = tokenData; + + /** + * Lookahead token buffer. + * @type Array + * @property _lt + * @private + */ + this._lt = []; + + /** + * Lookahead token buffer index. + * @type int + * @property _ltIndex + * @private + */ + this._ltIndex = 0; + + this._ltIndexCache = []; +} + /** - * We need this JSDoc comment for affecting ESDoc. - * @extends {Ignored} - * @hide true + * Accepts an array of token information and outputs + * an array of token data containing key-value mappings + * and matching functions that the TokenStream needs. + * @param {Array} tokens An array of token descriptors. + * @return {Array} An array of processed token data. + * @method createTokenData + * @static */ -var IfObservable = (function (_super) { - __extends(IfObservable, _super); - function IfObservable(condition, thenSource, elseSource) { - _super.call(this); - this.condition = condition; - this.thenSource = thenSource; - this.elseSource = elseSource; +TokenStreamBase.createTokenData = function(tokens){ + + var nameMap = [], + typeMap = Object.create(null), + tokenData = tokens.concat([]), + i = 0, + len = tokenData.length+1; + + tokenData.UNKNOWN = -1; + tokenData.unshift({name:"EOF"}); + + for (; i < len; i++){ + nameMap.push(tokenData[i].name); + tokenData[tokenData[i].name] = i; + if (tokenData[i].text){ + typeMap[tokenData[i].text] = i; + } } - IfObservable.create = function (condition, thenSource, elseSource) { - return new IfObservable(condition, thenSource, elseSource); - }; - IfObservable.prototype._subscribe = function (subscriber) { - var _a = this, condition = _a.condition, thenSource = _a.thenSource, elseSource = _a.elseSource; - return new IfSubscriber(subscriber, condition, thenSource, elseSource); + + tokenData.name = function(tt){ + return nameMap[tt]; }; - return IfObservable; -}(Observable_1.Observable)); -exports.IfObservable = IfObservable; -var IfSubscriber = (function (_super) { - __extends(IfSubscriber, _super); - function IfSubscriber(destination, condition, thenSource, elseSource) { - _super.call(this, destination); - this.condition = condition; - this.thenSource = thenSource; - this.elseSource = elseSource; - this.tryIf(); - } - IfSubscriber.prototype.tryIf = function () { - var _a = this, condition = _a.condition, thenSource = _a.thenSource, elseSource = _a.elseSource; - var result; - try { - result = condition(); - var source = result ? thenSource : elseSource; - if (source) { - this.add(subscribeToResult_1.subscribeToResult(this, source)); - } - else { - this._complete(); - } - } - catch (err) { - this._error(err); - } + + tokenData.type = function(c){ + return typeMap[c]; }; - return IfSubscriber; -}(OuterSubscriber_1.OuterSubscriber)); -//# sourceMappingURL=IfObservable.js.map -/***/ }), -/* 254 */ -/***/ (function(module, exports, __webpack_require__) { + return tokenData; +}; -"use strict"; +TokenStreamBase.prototype = { -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; -var isNumeric_1 = __webpack_require__(28); -var Observable_1 = __webpack_require__(0); -var async_1 = __webpack_require__(8); -/** - * We need this JSDoc comment for affecting ESDoc. - * @extends {Ignored} - * @hide true - */ -var IntervalObservable = (function (_super) { - __extends(IntervalObservable, _super); - function IntervalObservable(period, scheduler) { - if (period === void 0) { period = 0; } - if (scheduler === void 0) { scheduler = async_1.async; } - _super.call(this); - this.period = period; - this.scheduler = scheduler; - if (!isNumeric_1.isNumeric(period) || period < 0) { - this.period = 0; + //restore constructor + constructor: TokenStreamBase, + + //------------------------------------------------------------------------- + // Matching methods + //------------------------------------------------------------------------- + + /** + * Determines if the next token matches the given token type. + * If so, that token is consumed; if not, the token is placed + * back onto the token stream. You can pass in any number of + * token types and this will return true if any of the token + * types is found. + * @param {int|int[]} tokenTypes Either a single token type or an array of + * token types that the next token might be. If an array is passed, + * it's assumed that the token can be any of these. + * @param {variant} channel (Optional) The channel to read from. If not + * provided, reads from the default (unnamed) channel. + * @return {Boolean} True if the token type matches, false if not. + * @method match + */ + match: function(tokenTypes, channel){ + + //always convert to an array, makes things easier + if (!(tokenTypes instanceof Array)){ + tokenTypes = [tokenTypes]; } - if (!scheduler || typeof scheduler.schedule !== 'function') { - this.scheduler = async_1.async; + + var tt = this.get(channel), + i = 0, + len = tokenTypes.length; + + while(i < len){ + if (tt === tokenTypes[i++]){ + return true; + } } - } + + //no match found, put the token back + this.unget(); + return false; + }, + /** - * Creates an Observable that emits sequential numbers every specified - * interval of time, on a specified IScheduler. - * - * Emits incremental numbers periodically in time. - * - * - * - * - * `interval` returns an Observable that emits an infinite sequence of - * ascending integers, with a constant interval of time of your choosing - * between those emissions. The first emission is not sent immediately, but - * only after the first period has passed. By default, this operator uses the - * `async` IScheduler to provide a notion of time, but you may pass any - * IScheduler to it. - * - * @example Emits ascending numbers, one every second (1000ms) - * var numbers = Rx.Observable.interval(1000); - * numbers.subscribe(x => console.log(x)); - * - * @see {@link timer} - * @see {@link delay} - * - * @param {number} [period=0] The interval size in milliseconds (by default) - * or the time unit determined by the scheduler's clock. - * @param {Scheduler} [scheduler=async] The IScheduler to use for scheduling - * the emission of values, and providing a notion of "time". - * @return {Observable} An Observable that emits a sequential number each time - * interval. - * @static true - * @name interval - * @owner Observable + * Determines if the next token matches the given token type. + * If so, that token is consumed; if not, an error is thrown. + * @param {int|int[]} tokenTypes Either a single token type or an array of + * token types that the next token should be. If an array is passed, + * it's assumed that the token must be one of these. + * @param {variant} channel (Optional) The channel to read from. If not + * provided, reads from the default (unnamed) channel. + * @return {void} + * @method mustMatch */ - IntervalObservable.create = function (period, scheduler) { - if (period === void 0) { period = 0; } - if (scheduler === void 0) { scheduler = async_1.async; } - return new IntervalObservable(period, scheduler); - }; - IntervalObservable.dispatch = function (state) { - var index = state.index, subscriber = state.subscriber, period = state.period; - subscriber.next(index); - if (subscriber.closed) { - return; + mustMatch: function(tokenTypes, channel){ + + var token; + + //always convert to an array, makes things easier + if (!(tokenTypes instanceof Array)){ + tokenTypes = [tokenTypes]; } - state.index += 1; - this.schedule(state, period); - }; - IntervalObservable.prototype._subscribe = function (subscriber) { - var index = 0; - var period = this.period; - var scheduler = this.scheduler; - subscriber.add(scheduler.schedule(IntervalObservable.dispatch, period, { - index: index, subscriber: subscriber, period: period - })); - }; - return IntervalObservable; -}(Observable_1.Observable)); -exports.IntervalObservable = IntervalObservable; -//# sourceMappingURL=IntervalObservable.js.map -/***/ }), -/* 255 */ -/***/ (function(module, exports, __webpack_require__) { + if (!this.match.apply(this, arguments)){ + token = this.LT(1); + throw new SyntaxError("Expected " + this._tokenData[tokenTypes[0]].name + + " at line " + token.startLine + ", col " + token.startCol + ".", token.startLine, token.startCol); + } + }, -"use strict"; + //------------------------------------------------------------------------- + // Consuming methods + //------------------------------------------------------------------------- -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; -var Observable_1 = __webpack_require__(0); -var noop_1 = __webpack_require__(76); -/** - * We need this JSDoc comment for affecting ESDoc. - * @extends {Ignored} - * @hide true - */ -var NeverObservable = (function (_super) { - __extends(NeverObservable, _super); - function NeverObservable() { - _super.call(this); - } /** - * Creates an Observable that emits no items to the Observer. - * - * An Observable that never emits anything. - * - * - * - * This static operator is useful for creating a simple Observable that emits - * neither values nor errors nor the completion notification. It can be used - * for testing purposes or for composing with other Observables. Please note - * that by never emitting a complete notification, this Observable keeps the - * subscription from being disposed automatically. Subscriptions need to be - * manually disposed. - * - * @example Emit the number 7, then never emit anything else (not even complete). - * function info() { - * console.log('Will not be called'); - * } - * var result = Rx.Observable.never().startWith(7); - * result.subscribe(x => console.log(x), info, info); - * - * @see {@link create} - * @see {@link empty} - * @see {@link of} - * @see {@link throw} - * - * @return {Observable} A "never" Observable: never emits anything. - * @static true - * @name never - * @owner Observable + * Keeps reading from the token stream until either one of the specified + * token types is found or until the end of the input is reached. + * @param {int|int[]} tokenTypes Either a single token type or an array of + * token types that the next token should be. If an array is passed, + * it's assumed that the token must be one of these. + * @param {variant} channel (Optional) The channel to read from. If not + * provided, reads from the default (unnamed) channel. + * @return {void} + * @method advance */ - NeverObservable.create = function () { - return new NeverObservable(); - }; - NeverObservable.prototype._subscribe = function (subscriber) { - noop_1.noop(); - }; - return NeverObservable; -}(Observable_1.Observable)); -exports.NeverObservable = NeverObservable; -//# sourceMappingURL=NeverObservable.js.map + advance: function(tokenTypes, channel){ -/***/ }), -/* 256 */ -/***/ (function(module, exports, __webpack_require__) { + while(this.LA(0) !== 0 && !this.match(tokenTypes, channel)){ + this.get(); + } -"use strict"; + return this.LA(0); + }, -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; -var Observable_1 = __webpack_require__(0); -function dispatch(state) { - var obj = state.obj, keys = state.keys, length = state.length, index = state.index, subscriber = state.subscriber; - if (index === length) { - subscriber.complete(); - return; - } - var key = keys[index]; - subscriber.next([key, obj[key]]); - state.index = index + 1; - this.schedule(state); -} -/** - * We need this JSDoc comment for affecting ESDoc. - * @extends {Ignored} - * @hide true - */ -var PairsObservable = (function (_super) { - __extends(PairsObservable, _super); - function PairsObservable(obj, scheduler) { - _super.call(this); - this.obj = obj; - this.scheduler = scheduler; - this.keys = Object.keys(obj); - } /** - * Convert an object into an observable sequence of [key, value] pairs - * using an optional IScheduler to enumerate the object. - * - * @example Converts a javascript object to an Observable - * var obj = { - * foo: 42, - * bar: 56, - * baz: 78 - * }; - * - * var source = Rx.Observable.pairs(obj); - * - * var subscription = source.subscribe( - * function (x) { - * console.log('Next: %s', x); - * }, - * function (err) { - * console.log('Error: %s', err); - * }, - * function () { - * console.log('Completed'); - * }); - * - * @param {Object} obj The object to inspect and turn into an - * Observable sequence. - * @param {Scheduler} [scheduler] An optional IScheduler to run the - * enumeration of the input sequence on. - * @returns {(Observable>)} An observable sequence of - * [key, value] pairs from the object. - */ - PairsObservable.create = function (obj, scheduler) { - return new PairsObservable(obj, scheduler); - }; - PairsObservable.prototype._subscribe = function (subscriber) { - var _a = this, keys = _a.keys, scheduler = _a.scheduler; - var length = keys.length; - if (scheduler) { - return scheduler.schedule(dispatch, 0, { - obj: this.obj, keys: keys, length: length, index: 0, subscriber: subscriber - }); + * Consumes the next token from the token stream. + * @return {int} The token type of the token that was just consumed. + * @method get + */ + get: function(channel){ + + var tokenInfo = this._tokenData, + i =0, + token, + info; + + //check the lookahead buffer first + if (this._lt.length && this._ltIndex >= 0 && this._ltIndex < this._lt.length){ + + i++; + this._token = this._lt[this._ltIndex++]; + info = tokenInfo[this._token.type]; + + //obey channels logic + while((info.channel !== undefined && channel !== info.channel) && + this._ltIndex < this._lt.length){ + this._token = this._lt[this._ltIndex++]; + info = tokenInfo[this._token.type]; + i++; + } + + //here be dragons + if ((info.channel === undefined || channel === info.channel) && + this._ltIndex <= this._lt.length){ + this._ltIndexCache.push(i); + return this._token.type; + } } - else { - for (var idx = 0; idx < length; idx++) { - var key = keys[idx]; - subscriber.next([key, this.obj[key]]); + + //call token retriever method + token = this._getToken(); + + //if it should be hidden, don't save a token + if (token.type > -1 && !tokenInfo[token.type].hide){ + + //apply token channel + token.channel = tokenInfo[token.type].channel; + + //save for later + this._token = token; + this._lt.push(token); + + //save space that will be moved (must be done before array is truncated) + this._ltIndexCache.push(this._lt.length - this._ltIndex + i); + + //keep the buffer under 5 items + if (this._lt.length > 5){ + this._lt.shift(); } - subscriber.complete(); + + //also keep the shift buffer under 5 items + if (this._ltIndexCache.length > 5){ + this._ltIndexCache.shift(); + } + + //update lookahead index + this._ltIndex = this._lt.length; } - }; - return PairsObservable; -}(Observable_1.Observable)); -exports.PairsObservable = PairsObservable; -//# sourceMappingURL=PairsObservable.js.map -/***/ }), -/* 257 */ -/***/ (function(module, exports, __webpack_require__) { + /* + * Skip to the next token if: + * 1. The token type is marked as hidden. + * 2. The token type has a channel specified and it isn't the current channel. + */ + info = tokenInfo[token.type]; + if (info && + (info.hide || + (info.channel !== undefined && channel !== info.channel))){ + return this.get(channel); + } else { + //return just the type + return token.type; + } + }, -"use strict"; + /** + * Looks ahead a certain number of tokens and returns the token type at + * that position. This will throw an error if you lookahead past the + * end of input, past the size of the lookahead buffer, or back past + * the first token in the lookahead buffer. + * @param {int} The index of the token type to retrieve. 0 for the + * current token, 1 for the next, -1 for the previous, etc. + * @return {int} The token type of the token in the given position. + * @method LA + */ + LA: function(index){ + var total = index, + tt; + if (index > 0){ + //TODO: Store 5 somewhere + if (index > 5){ + throw new Error("Too much lookahead."); + } + + //get all those tokens + while(total){ + tt = this.get(); + total--; + } + + //unget all those tokens + while(total < index){ + this.unget(); + total++; + } + } else if (index < 0){ + + if(this._lt[this._ltIndex+index]){ + tt = this._lt[this._ltIndex+index].type; + } else { + throw new Error("Too much lookbehind."); + } + + } else { + tt = this._token.type; + } + + return tt; + + }, -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; -var Observable_1 = __webpack_require__(0); -/** - * We need this JSDoc comment for affecting ESDoc. - * @extends {Ignored} - * @hide true - */ -var RangeObservable = (function (_super) { - __extends(RangeObservable, _super); - function RangeObservable(start, count, scheduler) { - _super.call(this); - this.start = start; - this._count = count; - this.scheduler = scheduler; - } /** - * Creates an Observable that emits a sequence of numbers within a specified - * range. - * - * Emits a sequence of numbers in a range. - * - * - * - * `range` operator emits a range of sequential integers, in order, where you - * select the `start` of the range and its `length`. By default, uses no - * IScheduler and just delivers the notifications synchronously, but may use - * an optional IScheduler to regulate those deliveries. - * - * @example Emits the numbers 1 to 10 - * var numbers = Rx.Observable.range(1, 10); - * numbers.subscribe(x => console.log(x)); - * - * @see {@link timer} - * @see {@link interval} - * - * @param {number} [start=0] The value of the first integer in the sequence. - * @param {number} [count=0] The number of sequential integers to generate. - * @param {Scheduler} [scheduler] A {@link IScheduler} to use for scheduling - * the emissions of the notifications. - * @return {Observable} An Observable of numbers that emits a finite range of - * sequential integers. - * @static true - * @name range - * @owner Observable + * Looks ahead a certain number of tokens and returns the token at + * that position. This will throw an error if you lookahead past the + * end of input, past the size of the lookahead buffer, or back past + * the first token in the lookahead buffer. + * @param {int} The index of the token type to retrieve. 0 for the + * current token, 1 for the next, -1 for the previous, etc. + * @return {Object} The token of the token in the given position. + * @method LA + */ + LT: function(index){ + + //lookahead first to prime the token buffer + this.LA(index); + + //now find the token, subtract one because _ltIndex is already at the next index + return this._lt[this._ltIndex+index-1]; + }, + + /** + * Returns the token type for the next token in the stream without + * consuming it. + * @return {int} The token type of the next token in the stream. + * @method peek + */ + peek: function(){ + return this.LA(1); + }, + + /** + * Returns the actual token object for the last consumed token. + * @return {Token} The token object for the last consumed token. + * @method token */ - RangeObservable.create = function (start, count, scheduler) { - if (start === void 0) { start = 0; } - if (count === void 0) { count = 0; } - return new RangeObservable(start, count, scheduler); - }; - RangeObservable.dispatch = function (state) { - var start = state.start, index = state.index, count = state.count, subscriber = state.subscriber; - if (index >= count) { - subscriber.complete(); - return; - } - subscriber.next(start); - if (subscriber.closed) { - return; - } - state.index = index + 1; - state.start = start + 1; - this.schedule(state); - }; - RangeObservable.prototype._subscribe = function (subscriber) { - var index = 0; - var start = this.start; - var count = this._count; - var scheduler = this.scheduler; - if (scheduler) { - return scheduler.schedule(RangeObservable.dispatch, 0, { - index: index, count: count, start: start, subscriber: subscriber - }); + token: function(){ + return this._token; + }, + + /** + * Returns the name of the token for the given token type. + * @param {int} tokenType The type of token to get the name of. + * @return {String} The name of the token or "UNKNOWN_TOKEN" for any + * invalid token type. + * @method tokenName + */ + tokenName: function(tokenType){ + if (tokenType < 0 || tokenType > this._tokenData.length){ + return "UNKNOWN_TOKEN"; + } else { + return this._tokenData[tokenType].name; } - else { - do { - if (index++ >= count) { - subscriber.complete(); - break; - } - subscriber.next(start++); - if (subscriber.closed) { - break; - } - } while (true); + }, + + /** + * Returns the token type value for the given token name. + * @param {String} tokenName The name of the token whose value should be returned. + * @return {int} The token type value for the given token name or -1 + * for an unknown token. + * @method tokenName + */ + tokenType: function(tokenName){ + return this._tokenData[tokenName] || -1; + }, + + /** + * Returns the last consumed token to the token stream. + * @method unget + */ + unget: function(){ + //if (this._ltIndex > -1){ + if (this._ltIndexCache.length){ + this._ltIndex -= this._ltIndexCache.pop();//--; + this._token = this._lt[this._ltIndex - 1]; + } else { + throw new Error("Too much lookahead."); } - }; - return RangeObservable; -}(Observable_1.Observable)); -exports.RangeObservable = RangeObservable; -//# sourceMappingURL=RangeObservable.js.map + } -/***/ }), -/* 258 */ -/***/ (function(module, exports, __webpack_require__) { +}; -"use strict"; -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); +parserlib.util = { +__proto__ : null, +StringReader: StringReader, +SyntaxError : SyntaxError, +SyntaxUnit : SyntaxUnit, +EventTarget : EventTarget, +TokenStreamBase : TokenStreamBase }; -var Observable_1 = __webpack_require__(0); -var asap_1 = __webpack_require__(70); -var isNumeric_1 = __webpack_require__(28); +})(); +/* +Parser-Lib +Copyright (c) 2009-2011 Nicholas C. Zakas. All rights reserved. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. + +*/ +/* Version v0.2.5+domino1, Build time: 30-January-2016 05:13:03 */ +(function(){ +var EventTarget = parserlib.util.EventTarget, +TokenStreamBase = parserlib.util.TokenStreamBase, +StringReader = parserlib.util.StringReader, // jshint ignore:line +SyntaxError = parserlib.util.SyntaxError, +SyntaxUnit = parserlib.util.SyntaxUnit; + +var Colors = { + __proto__ :null, + aliceblue :"#f0f8ff", + antiquewhite :"#faebd7", + aqua :"#00ffff", + aquamarine :"#7fffd4", + azure :"#f0ffff", + beige :"#f5f5dc", + bisque :"#ffe4c4", + black :"#000000", + blanchedalmond :"#ffebcd", + blue :"#0000ff", + blueviolet :"#8a2be2", + brown :"#a52a2a", + burlywood :"#deb887", + cadetblue :"#5f9ea0", + chartreuse :"#7fff00", + chocolate :"#d2691e", + coral :"#ff7f50", + cornflowerblue :"#6495ed", + cornsilk :"#fff8dc", + crimson :"#dc143c", + cyan :"#00ffff", + darkblue :"#00008b", + darkcyan :"#008b8b", + darkgoldenrod :"#b8860b", + darkgray :"#a9a9a9", + darkgrey :"#a9a9a9", + darkgreen :"#006400", + darkkhaki :"#bdb76b", + darkmagenta :"#8b008b", + darkolivegreen :"#556b2f", + darkorange :"#ff8c00", + darkorchid :"#9932cc", + darkred :"#8b0000", + darksalmon :"#e9967a", + darkseagreen :"#8fbc8f", + darkslateblue :"#483d8b", + darkslategray :"#2f4f4f", + darkslategrey :"#2f4f4f", + darkturquoise :"#00ced1", + darkviolet :"#9400d3", + deeppink :"#ff1493", + deepskyblue :"#00bfff", + dimgray :"#696969", + dimgrey :"#696969", + dodgerblue :"#1e90ff", + firebrick :"#b22222", + floralwhite :"#fffaf0", + forestgreen :"#228b22", + fuchsia :"#ff00ff", + gainsboro :"#dcdcdc", + ghostwhite :"#f8f8ff", + gold :"#ffd700", + goldenrod :"#daa520", + gray :"#808080", + grey :"#808080", + green :"#008000", + greenyellow :"#adff2f", + honeydew :"#f0fff0", + hotpink :"#ff69b4", + indianred :"#cd5c5c", + indigo :"#4b0082", + ivory :"#fffff0", + khaki :"#f0e68c", + lavender :"#e6e6fa", + lavenderblush :"#fff0f5", + lawngreen :"#7cfc00", + lemonchiffon :"#fffacd", + lightblue :"#add8e6", + lightcoral :"#f08080", + lightcyan :"#e0ffff", + lightgoldenrodyellow :"#fafad2", + lightgray :"#d3d3d3", + lightgrey :"#d3d3d3", + lightgreen :"#90ee90", + lightpink :"#ffb6c1", + lightsalmon :"#ffa07a", + lightseagreen :"#20b2aa", + lightskyblue :"#87cefa", + lightslategray :"#778899", + lightslategrey :"#778899", + lightsteelblue :"#b0c4de", + lightyellow :"#ffffe0", + lime :"#00ff00", + limegreen :"#32cd32", + linen :"#faf0e6", + magenta :"#ff00ff", + maroon :"#800000", + mediumaquamarine:"#66cdaa", + mediumblue :"#0000cd", + mediumorchid :"#ba55d3", + mediumpurple :"#9370d8", + mediumseagreen :"#3cb371", + mediumslateblue :"#7b68ee", + mediumspringgreen :"#00fa9a", + mediumturquoise :"#48d1cc", + mediumvioletred :"#c71585", + midnightblue :"#191970", + mintcream :"#f5fffa", + mistyrose :"#ffe4e1", + moccasin :"#ffe4b5", + navajowhite :"#ffdead", + navy :"#000080", + oldlace :"#fdf5e6", + olive :"#808000", + olivedrab :"#6b8e23", + orange :"#ffa500", + orangered :"#ff4500", + orchid :"#da70d6", + palegoldenrod :"#eee8aa", + palegreen :"#98fb98", + paleturquoise :"#afeeee", + palevioletred :"#d87093", + papayawhip :"#ffefd5", + peachpuff :"#ffdab9", + peru :"#cd853f", + pink :"#ffc0cb", + plum :"#dda0dd", + powderblue :"#b0e0e6", + purple :"#800080", + red :"#ff0000", + rosybrown :"#bc8f8f", + royalblue :"#4169e1", + saddlebrown :"#8b4513", + salmon :"#fa8072", + sandybrown :"#f4a460", + seagreen :"#2e8b57", + seashell :"#fff5ee", + sienna :"#a0522d", + silver :"#c0c0c0", + skyblue :"#87ceeb", + slateblue :"#6a5acd", + slategray :"#708090", + slategrey :"#708090", + snow :"#fffafa", + springgreen :"#00ff7f", + steelblue :"#4682b4", + tan :"#d2b48c", + teal :"#008080", + thistle :"#d8bfd8", + tomato :"#ff6347", + turquoise :"#40e0d0", + violet :"#ee82ee", + wheat :"#f5deb3", + white :"#ffffff", + whitesmoke :"#f5f5f5", + yellow :"#ffff00", + yellowgreen :"#9acd32", + //'currentColor' color keyword http://www.w3.org/TR/css3-color/#currentcolor + currentColor :"The value of the 'color' property.", + //CSS2 system colors http://www.w3.org/TR/css3-color/#css2-system + activeBorder :"Active window border.", + activecaption :"Active window caption.", + appworkspace :"Background color of multiple document interface.", + background :"Desktop background.", + buttonface :"The face background color for 3-D elements that appear 3-D due to one layer of surrounding border.", + buttonhighlight :"The color of the border facing the light source for 3-D elements that appear 3-D due to one layer of surrounding border.", + buttonshadow :"The color of the border away from the light source for 3-D elements that appear 3-D due to one layer of surrounding border.", + buttontext :"Text on push buttons.", + captiontext :"Text in caption, size box, and scrollbar arrow box.", + graytext :"Grayed (disabled) text. This color is set to #000 if the current display driver does not support a solid gray color.", + greytext :"Greyed (disabled) text. This color is set to #000 if the current display driver does not support a solid grey color.", + highlight :"Item(s) selected in a control.", + highlighttext :"Text of item(s) selected in a control.", + inactiveborder :"Inactive window border.", + inactivecaption :"Inactive window caption.", + inactivecaptiontext :"Color of text in an inactive caption.", + infobackground :"Background color for tooltip controls.", + infotext :"Text color for tooltip controls.", + menu :"Menu background.", + menutext :"Text in menus.", + scrollbar :"Scroll bar gray area.", + threeddarkshadow :"The color of the darker (generally outer) of the two borders away from the light source for 3-D elements that appear 3-D due to two concentric layers of surrounding border.", + threedface :"The face background color for 3-D elements that appear 3-D due to two concentric layers of surrounding border.", + threedhighlight :"The color of the lighter (generally outer) of the two borders facing the light source for 3-D elements that appear 3-D due to two concentric layers of surrounding border.", + threedlightshadow :"The color of the darker (generally inner) of the two borders facing the light source for 3-D elements that appear 3-D due to two concentric layers of surrounding border.", + threedshadow :"The color of the lighter (generally inner) of the two borders away from the light source for 3-D elements that appear 3-D due to two concentric layers of surrounding border.", + window :"Window background.", + windowframe :"Window frame.", + windowtext :"Text in windows." +}; +/** + * Represents a selector combinator (whitespace, +, >). + * @namespace parserlib.css + * @class Combinator + * @extends parserlib.util.SyntaxUnit + * @constructor + * @param {String} text The text representation of the unit. + * @param {int} line The line of text on which the unit resides. + * @param {int} col The column of text on which the unit resides. + */ +function Combinator(text, line, col){ + + SyntaxUnit.call(this, text, line, col, Parser.COMBINATOR_TYPE); + + /** + * The type of modifier. + * @type String + * @property type + */ + this.type = "unknown"; + + //pretty simple + if (/^\s+$/.test(text)){ + this.type = "descendant"; + } else if (text === ">"){ + this.type = "child"; + } else if (text === "+"){ + this.type = "adjacent-sibling"; + } else if (text === "~"){ + this.type = "sibling"; + } + +} + +Combinator.prototype = new SyntaxUnit(); +Combinator.prototype.constructor = Combinator; + /** - * We need this JSDoc comment for affecting ESDoc. - * @extends {Ignored} - * @hide true + * Represents a media feature, such as max-width:500. + * @namespace parserlib.css + * @class MediaFeature + * @extends parserlib.util.SyntaxUnit + * @constructor + * @param {SyntaxUnit} name The name of the feature. + * @param {SyntaxUnit} value The value of the feature or null if none. */ -var SubscribeOnObservable = (function (_super) { - __extends(SubscribeOnObservable, _super); - function SubscribeOnObservable(source, delayTime, scheduler) { - if (delayTime === void 0) { delayTime = 0; } - if (scheduler === void 0) { scheduler = asap_1.asap; } - _super.call(this); - this.source = source; - this.delayTime = delayTime; - this.scheduler = scheduler; - if (!isNumeric_1.isNumeric(delayTime) || delayTime < 0) { - this.delayTime = 0; - } - if (!scheduler || typeof scheduler.schedule !== 'function') { - this.scheduler = asap_1.asap; - } - } - SubscribeOnObservable.create = function (source, delay, scheduler) { - if (delay === void 0) { delay = 0; } - if (scheduler === void 0) { scheduler = asap_1.asap; } - return new SubscribeOnObservable(source, delay, scheduler); - }; - SubscribeOnObservable.dispatch = function (arg) { - var source = arg.source, subscriber = arg.subscriber; - return this.add(source.subscribe(subscriber)); - }; - SubscribeOnObservable.prototype._subscribe = function (subscriber) { - var delay = this.delayTime; - var source = this.source; - var scheduler = this.scheduler; - return scheduler.schedule(SubscribeOnObservable.dispatch, delay, { - source: source, subscriber: subscriber - }); - }; - return SubscribeOnObservable; -}(Observable_1.Observable)); -exports.SubscribeOnObservable = SubscribeOnObservable; -//# sourceMappingURL=SubscribeOnObservable.js.map +function MediaFeature(name, value){ -/***/ }), -/* 259 */ -/***/ (function(module, exports, __webpack_require__) { + SyntaxUnit.call(this, "(" + name + (value !== null ? ":" + value : "") + ")", name.startLine, name.startCol, Parser.MEDIA_FEATURE_TYPE); -"use strict"; + /** + * The name of the media feature + * @type String + * @property name + */ + this.name = name; + + /** + * The value for the feature or null if there is none. + * @type SyntaxUnit + * @property value + */ + this.value = value; +} + +MediaFeature.prototype = new SyntaxUnit(); +MediaFeature.prototype.constructor = MediaFeature; -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; -var isNumeric_1 = __webpack_require__(28); -var Observable_1 = __webpack_require__(0); -var async_1 = __webpack_require__(8); -var isScheduler_1 = __webpack_require__(13); -var isDate_1 = __webpack_require__(27); /** - * We need this JSDoc comment for affecting ESDoc. - * @extends {Ignored} - * @hide true + * Represents an individual media query. + * @namespace parserlib.css + * @class MediaQuery + * @extends parserlib.util.SyntaxUnit + * @constructor + * @param {String} modifier The modifier "not" or "only" (or null). + * @param {String} mediaType The type of media (i.e., "print"). + * @param {Array} parts Array of selectors parts making up this selector. + * @param {int} line The line of text on which the unit resides. + * @param {int} col The column of text on which the unit resides. */ -var TimerObservable = (function (_super) { - __extends(TimerObservable, _super); - function TimerObservable(dueTime, period, scheduler) { - if (dueTime === void 0) { dueTime = 0; } - _super.call(this); - this.period = -1; - this.dueTime = 0; - if (isNumeric_1.isNumeric(period)) { - this.period = Number(period) < 1 && 1 || Number(period); - } - else if (isScheduler_1.isScheduler(period)) { - scheduler = period; - } - if (!isScheduler_1.isScheduler(scheduler)) { - scheduler = async_1.async; - } - this.scheduler = scheduler; - this.dueTime = isDate_1.isDate(dueTime) ? - (+dueTime - this.scheduler.now()) : - dueTime; - } +function MediaQuery(modifier, mediaType, features, line, col){ + + SyntaxUnit.call(this, (modifier ? modifier + " ": "") + (mediaType ? mediaType : "") + (mediaType && features.length > 0 ? " and " : "") + features.join(" and "), line, col, Parser.MEDIA_QUERY_TYPE); + /** - * Creates an Observable that starts emitting after an `initialDelay` and - * emits ever increasing numbers after each `period` of time thereafter. - * - * Its like {@link interval}, but you can specify when - * should the emissions start. - * - * - * - * `timer` returns an Observable that emits an infinite sequence of ascending - * integers, with a constant interval of time, `period` of your choosing - * between those emissions. The first emission happens after the specified - * `initialDelay`. The initial delay may be a {@link Date}. By default, this - * operator uses the `async` IScheduler to provide a notion of time, but you - * may pass any IScheduler to it. If `period` is not specified, the output - * Observable emits only one value, `0`. Otherwise, it emits an infinite - * sequence. - * - * @example Emits ascending numbers, one every second (1000ms), starting after 3 seconds - * var numbers = Rx.Observable.timer(3000, 1000); - * numbers.subscribe(x => console.log(x)); - * - * @example Emits one number after five seconds - * var numbers = Rx.Observable.timer(5000); - * numbers.subscribe(x => console.log(x)); - * - * @see {@link interval} - * @see {@link delay} - * - * @param {number|Date} initialDelay The initial delay time to wait before - * emitting the first value of `0`. - * @param {number} [period] The period of time between emissions of the - * subsequent numbers. - * @param {Scheduler} [scheduler=async] The IScheduler to use for scheduling - * the emission of values, and providing a notion of "time". - * @return {Observable} An Observable that emits a `0` after the - * `initialDelay` and ever increasing numbers after each `period` of time - * thereafter. - * @static true - * @name timer - * @owner Observable + * The media modifier ("not" or "only") + * @type String + * @property modifier */ - TimerObservable.create = function (initialDelay, period, scheduler) { - if (initialDelay === void 0) { initialDelay = 0; } - return new TimerObservable(initialDelay, period, scheduler); - }; - TimerObservable.dispatch = function (state) { - var index = state.index, period = state.period, subscriber = state.subscriber; - var action = this; - subscriber.next(index); - if (subscriber.closed) { - return; - } - else if (period === -1) { - return subscriber.complete(); - } - state.index = index + 1; - action.schedule(state, period); - }; - TimerObservable.prototype._subscribe = function (subscriber) { - var index = 0; - var _a = this, period = _a.period, dueTime = _a.dueTime, scheduler = _a.scheduler; - return scheduler.schedule(TimerObservable.dispatch, dueTime, { - index: index, period: period, subscriber: subscriber - }); - }; - return TimerObservable; -}(Observable_1.Observable)); -exports.TimerObservable = TimerObservable; -//# sourceMappingURL=TimerObservable.js.map + this.modifier = modifier; + + /** + * The mediaType (i.e., "print") + * @type String + * @property mediaType + */ + this.mediaType = mediaType; + + /** + * The parts that make up the selector. + * @type Array + * @property features + */ + this.features = features; + +} + +MediaQuery.prototype = new SyntaxUnit(); +MediaQuery.prototype.constructor = MediaQuery; + + +/** + * A CSS3 parser. + * @namespace parserlib.css + * @class Parser + * @constructor + * @param {Object} options (Optional) Various options for the parser: + * starHack (true|false) to allow IE6 star hack as valid, + * underscoreHack (true|false) to interpret leading underscores + * as IE6-7 targeting for known properties, ieFilters (true|false) + * to indicate that IE < 8 filters should be accepted and not throw + * syntax errors. + */ +function Parser(options){ + + //inherit event functionality + EventTarget.call(this); + + + this.options = options || {}; + + this._tokenStream = null; +} + +//Static constants +Parser.DEFAULT_TYPE = 0; +Parser.COMBINATOR_TYPE = 1; +Parser.MEDIA_FEATURE_TYPE = 2; +Parser.MEDIA_QUERY_TYPE = 3; +Parser.PROPERTY_NAME_TYPE = 4; +Parser.PROPERTY_VALUE_TYPE = 5; +Parser.PROPERTY_VALUE_PART_TYPE = 6; +Parser.SELECTOR_TYPE = 7; +Parser.SELECTOR_PART_TYPE = 8; +Parser.SELECTOR_SUB_PART_TYPE = 9; + +Parser.prototype = function(){ + + var proto = new EventTarget(), //new prototype + prop, + additions = { + __proto__: null, + + //restore constructor + constructor: Parser, + + //instance constants - yuck + DEFAULT_TYPE : 0, + COMBINATOR_TYPE : 1, + MEDIA_FEATURE_TYPE : 2, + MEDIA_QUERY_TYPE : 3, + PROPERTY_NAME_TYPE : 4, + PROPERTY_VALUE_TYPE : 5, + PROPERTY_VALUE_PART_TYPE : 6, + SELECTOR_TYPE : 7, + SELECTOR_PART_TYPE : 8, + SELECTOR_SUB_PART_TYPE : 9, + + //----------------------------------------------------------------- + // Grammar + //----------------------------------------------------------------- + + _stylesheet: function(){ + + /* + * stylesheet + * : [ CHARSET_SYM S* STRING S* ';' ]? + * [S|CDO|CDC]* [ import [S|CDO|CDC]* ]* + * [ namespace [S|CDO|CDC]* ]* + * [ [ ruleset | media | page | font_face | keyframes ] [S|CDO|CDC]* ]* + * ; + */ + + var tokenStream = this._tokenStream, + count, + token, + tt; + + this.fire("startstylesheet"); + + //try to read character set + this._charset(); + + this._skipCruft(); + + //try to read imports - may be more than one + while (tokenStream.peek() === Tokens.IMPORT_SYM){ + this._import(); + this._skipCruft(); + } + + //try to read namespaces - may be more than one + while (tokenStream.peek() === Tokens.NAMESPACE_SYM){ + this._namespace(); + this._skipCruft(); + } + + //get the next token + tt = tokenStream.peek(); + + //try to read the rest + while(tt > Tokens.EOF){ + + try { + + switch(tt){ + case Tokens.MEDIA_SYM: + this._media(); + this._skipCruft(); + break; + case Tokens.PAGE_SYM: + this._page(); + this._skipCruft(); + break; + case Tokens.FONT_FACE_SYM: + this._font_face(); + this._skipCruft(); + break; + case Tokens.KEYFRAMES_SYM: + this._keyframes(); + this._skipCruft(); + break; + case Tokens.VIEWPORT_SYM: + this._viewport(); + this._skipCruft(); + break; + case Tokens.DOCUMENT_SYM: + this._document(); + this._skipCruft(); + break; + case Tokens.UNKNOWN_SYM: //unknown @ rule + tokenStream.get(); + if (!this.options.strict){ + + //fire error event + this.fire({ + type: "error", + error: null, + message: "Unknown @ rule: " + tokenStream.LT(0).value + ".", + line: tokenStream.LT(0).startLine, + col: tokenStream.LT(0).startCol + }); + + //skip braces + count=0; + while (tokenStream.advance([Tokens.LBRACE, Tokens.RBRACE]) === Tokens.LBRACE){ + count++; //keep track of nesting depth + } + + while(count){ + tokenStream.advance([Tokens.RBRACE]); + count--; + } + + } else { + //not a syntax error, rethrow it + throw new SyntaxError("Unknown @ rule.", tokenStream.LT(0).startLine, tokenStream.LT(0).startCol); + } + break; + case Tokens.S: + this._readWhitespace(); + break; + default: + if(!this._ruleset()){ + + //error handling for known issues + switch(tt){ + case Tokens.CHARSET_SYM: + token = tokenStream.LT(1); + this._charset(false); + throw new SyntaxError("@charset not allowed here.", token.startLine, token.startCol); + case Tokens.IMPORT_SYM: + token = tokenStream.LT(1); + this._import(false); + throw new SyntaxError("@import not allowed here.", token.startLine, token.startCol); + case Tokens.NAMESPACE_SYM: + token = tokenStream.LT(1); + this._namespace(false); + throw new SyntaxError("@namespace not allowed here.", token.startLine, token.startCol); + default: + tokenStream.get(); //get the last token + this._unexpectedToken(tokenStream.token()); + } + + } + } + } catch(ex) { + if (ex instanceof SyntaxError && !this.options.strict){ + this.fire({ + type: "error", + error: ex, + message: ex.message, + line: ex.line, + col: ex.col + }); + } else { + throw ex; + } + } + + tt = tokenStream.peek(); + } + + if (tt !== Tokens.EOF){ + this._unexpectedToken(tokenStream.token()); + } + + this.fire("endstylesheet"); + }, + + _charset: function(emit){ + var tokenStream = this._tokenStream, + charset, + token, + line, + col; + + if (tokenStream.match(Tokens.CHARSET_SYM)){ + line = tokenStream.token().startLine; + col = tokenStream.token().startCol; + + this._readWhitespace(); + tokenStream.mustMatch(Tokens.STRING); + + token = tokenStream.token(); + charset = token.value; + + this._readWhitespace(); + tokenStream.mustMatch(Tokens.SEMICOLON); + + if (emit !== false){ + this.fire({ + type: "charset", + charset:charset, + line: line, + col: col + }); + } + } + }, + + _import: function(emit){ + /* + * import + * : IMPORT_SYM S* + * [STRING|URI] S* media_query_list? ';' S* + */ + + var tokenStream = this._tokenStream, + uri, + importToken, + mediaList = []; + + //read import symbol + tokenStream.mustMatch(Tokens.IMPORT_SYM); + importToken = tokenStream.token(); + this._readWhitespace(); + + tokenStream.mustMatch([Tokens.STRING, Tokens.URI]); + + //grab the URI value + uri = tokenStream.token().value.replace(/^(?:url\()?["']?([^"']+?)["']?\)?$/, "$1"); + + this._readWhitespace(); + + mediaList = this._media_query_list(); + + //must end with a semicolon + tokenStream.mustMatch(Tokens.SEMICOLON); + this._readWhitespace(); + + if (emit !== false){ + this.fire({ + type: "import", + uri: uri, + media: mediaList, + line: importToken.startLine, + col: importToken.startCol + }); + } + + }, + + _namespace: function(emit){ + /* + * namespace + * : NAMESPACE_SYM S* [namespace_prefix S*]? [STRING|URI] S* ';' S* + */ + + var tokenStream = this._tokenStream, + line, + col, + prefix, + uri; + + //read import symbol + tokenStream.mustMatch(Tokens.NAMESPACE_SYM); + line = tokenStream.token().startLine; + col = tokenStream.token().startCol; + this._readWhitespace(); + + //it's a namespace prefix - no _namespace_prefix() method because it's just an IDENT + if (tokenStream.match(Tokens.IDENT)){ + prefix = tokenStream.token().value; + this._readWhitespace(); + } + + tokenStream.mustMatch([Tokens.STRING, Tokens.URI]); + /*if (!tokenStream.match(Tokens.STRING)){ + tokenStream.mustMatch(Tokens.URI); + }*/ + + //grab the URI value + uri = tokenStream.token().value.replace(/(?:url\()?["']([^"']+)["']\)?/, "$1"); + + this._readWhitespace(); + + //must end with a semicolon + tokenStream.mustMatch(Tokens.SEMICOLON); + this._readWhitespace(); + + if (emit !== false){ + this.fire({ + type: "namespace", + prefix: prefix, + uri: uri, + line: line, + col: col + }); + } + + }, + + _media: function(){ + /* + * media + * : MEDIA_SYM S* media_query_list S* '{' S* ruleset* '}' S* + * ; + */ + var tokenStream = this._tokenStream, + line, + col, + mediaList;// = []; + + //look for @media + tokenStream.mustMatch(Tokens.MEDIA_SYM); + line = tokenStream.token().startLine; + col = tokenStream.token().startCol; + + this._readWhitespace(); + + mediaList = this._media_query_list(); + + tokenStream.mustMatch(Tokens.LBRACE); + this._readWhitespace(); + + this.fire({ + type: "startmedia", + media: mediaList, + line: line, + col: col + }); + + while(true) { + if (tokenStream.peek() === Tokens.PAGE_SYM){ + this._page(); + } else if (tokenStream.peek() === Tokens.FONT_FACE_SYM){ + this._font_face(); + } else if (tokenStream.peek() === Tokens.VIEWPORT_SYM){ + this._viewport(); + } else if (tokenStream.peek() === Tokens.DOCUMENT_SYM){ + this._document(); + } else if (!this._ruleset()){ + break; + } + } + + tokenStream.mustMatch(Tokens.RBRACE); + this._readWhitespace(); + + this.fire({ + type: "endmedia", + media: mediaList, + line: line, + col: col + }); + }, -/***/ }), -/* 260 */ -/***/ (function(module, exports, __webpack_require__) { -"use strict"; + //CSS3 Media Queries + _media_query_list: function(){ + /* + * media_query_list + * : S* [media_query [ ',' S* media_query ]* ]? + * ; + */ + var tokenStream = this._tokenStream, + mediaList = []; -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; -var Observable_1 = __webpack_require__(0); -var subscribeToResult_1 = __webpack_require__(3); -var OuterSubscriber_1 = __webpack_require__(4); -/** - * We need this JSDoc comment for affecting ESDoc. - * @extends {Ignored} - * @hide true - */ -var UsingObservable = (function (_super) { - __extends(UsingObservable, _super); - function UsingObservable(resourceFactory, observableFactory) { - _super.call(this); - this.resourceFactory = resourceFactory; - this.observableFactory = observableFactory; - } - UsingObservable.create = function (resourceFactory, observableFactory) { - return new UsingObservable(resourceFactory, observableFactory); - }; - UsingObservable.prototype._subscribe = function (subscriber) { - var _a = this, resourceFactory = _a.resourceFactory, observableFactory = _a.observableFactory; - var resource; - try { - resource = resourceFactory(); - return new UsingSubscriber(subscriber, resource, observableFactory); - } - catch (err) { - subscriber.error(err); - } - }; - return UsingObservable; -}(Observable_1.Observable)); -exports.UsingObservable = UsingObservable; -var UsingSubscriber = (function (_super) { - __extends(UsingSubscriber, _super); - function UsingSubscriber(destination, resource, observableFactory) { - _super.call(this, destination); - this.resource = resource; - this.observableFactory = observableFactory; - destination.add(resource); - this.tryUse(); - } - UsingSubscriber.prototype.tryUse = function () { - try { - var source = this.observableFactory.call(this, this.resource); - if (source) { - this.add(subscribeToResult_1.subscribeToResult(this, source)); - } - } - catch (err) { - this._error(err); - } - }; - return UsingSubscriber; -}(OuterSubscriber_1.OuterSubscriber)); -//# sourceMappingURL=UsingObservable.js.map -/***/ }), -/* 261 */ -/***/ (function(module, exports, __webpack_require__) { + this._readWhitespace(); -"use strict"; + if (tokenStream.peek() === Tokens.IDENT || tokenStream.peek() === Tokens.LPAREN){ + mediaList.push(this._media_query()); + } -var BoundCallbackObservable_1 = __webpack_require__(246); -exports.bindCallback = BoundCallbackObservable_1.BoundCallbackObservable.create; -//# sourceMappingURL=bindCallback.js.map + while(tokenStream.match(Tokens.COMMA)){ + this._readWhitespace(); + mediaList.push(this._media_query()); + } -/***/ }), -/* 262 */ -/***/ (function(module, exports, __webpack_require__) { + return mediaList; + }, -"use strict"; + /* + * Note: "expression" in the grammar maps to the _media_expression + * method. -var BoundNodeCallbackObservable_1 = __webpack_require__(247); -exports.bindNodeCallback = BoundNodeCallbackObservable_1.BoundNodeCallbackObservable.create; -//# sourceMappingURL=bindNodeCallback.js.map + */ + _media_query: function(){ + /* + * media_query + * : [ONLY | NOT]? S* media_type S* [ AND S* expression ]* + * | expression [ AND S* expression ]* + * ; + */ + var tokenStream = this._tokenStream, + type = null, + ident = null, + token = null, + expressions = []; + + if (tokenStream.match(Tokens.IDENT)){ + ident = tokenStream.token().value.toLowerCase(); + + //since there's no custom tokens for these, need to manually check + if (ident !== "only" && ident !== "not"){ + tokenStream.unget(); + ident = null; + } else { + token = tokenStream.token(); + } + } -/***/ }), -/* 263 */ -/***/ (function(module, exports, __webpack_require__) { + this._readWhitespace(); -"use strict"; + if (tokenStream.peek() === Tokens.IDENT){ + type = this._media_type(); + if (token === null){ + token = tokenStream.token(); + } + } else if (tokenStream.peek() === Tokens.LPAREN){ + if (token === null){ + token = tokenStream.LT(1); + } + expressions.push(this._media_expression()); + } -var isScheduler_1 = __webpack_require__(13); -var isArray_1 = __webpack_require__(15); -var ArrayObservable_1 = __webpack_require__(14); -var combineLatest_1 = __webpack_require__(37); -/* tslint:enable:max-line-length */ -/** - * Combines multiple Observables to create an Observable whose values are - * calculated from the latest values of each of its input Observables. - * - * Whenever any input Observable emits a value, it - * computes a formula using the latest values from all the inputs, then emits - * the output of that formula. - * - * - * - * `combineLatest` combines the values from all the Observables passed as - * arguments. This is done by subscribing to each Observable in order and, - * whenever any Observable emits, collecting an array of the most recent - * values from each Observable. So if you pass `n` Observables to operator, - * returned Observable will always emit an array of `n` values, in order - * corresponding to order of passed Observables (value from the first Observable - * on the first place and so on). - * - * Static version of `combineLatest` accepts either an array of Observables - * or each Observable can be put directly as an argument. Note that array of - * Observables is good choice, if you don't know beforehand how many Observables - * you will combine. Passing empty array will result in Observable that - * completes immediately. - * - * To ensure output array has always the same length, `combineLatest` will - * actually wait for all input Observables to emit at least once, - * before it starts emitting results. This means if some Observable emits - * values before other Observables started emitting, all that values but last - * will be lost. On the other hand, is some Observable does not emit value but - * completes, resulting Observable will complete at the same moment without - * emitting anything, since it will be now impossible to include value from - * completed Observable in resulting array. Also, if some input Observable does - * not emit any value and never completes, `combineLatest` will also never emit - * and never complete, since, again, it will wait for all streams to emit some - * value. - * - * If at least one Observable was passed to `combineLatest` and all passed Observables - * emitted something, resulting Observable will complete when all combined - * streams complete. So even if some Observable completes, result of - * `combineLatest` will still emit values when other Observables do. In case - * of completed Observable, its value from now on will always be the last - * emitted value. On the other hand, if any Observable errors, `combineLatest` - * will error immediately as well, and all other Observables will be unsubscribed. - * - * `combineLatest` accepts as optional parameter `project` function, which takes - * as arguments all values that would normally be emitted by resulting Observable. - * `project` can return any kind of value, which will be then emitted by Observable - * instead of default array. Note that `project` does not take as argument that array - * of values, but values themselves. That means default `project` can be imagined - * as function that takes all its arguments and puts them into an array. - * - * - * @example Combine two timer Observables - * const firstTimer = Rx.Observable.timer(0, 1000); // emit 0, 1, 2... after every second, starting from now - * const secondTimer = Rx.Observable.timer(500, 1000); // emit 0, 1, 2... after every second, starting 0,5s from now - * const combinedTimers = Rx.Observable.combineLatest(firstTimer, secondTimer); - * combinedTimers.subscribe(value => console.log(value)); - * // Logs - * // [0, 0] after 0.5s - * // [1, 0] after 1s - * // [1, 1] after 1.5s - * // [2, 1] after 2s - * - * - * @example Combine an array of Observables - * const observables = [1, 5, 10].map( - * n => Rx.Observable.of(n).delay(n * 1000).startWith(0) // emit 0 and then emit n after n seconds - * ); - * const combined = Rx.Observable.combineLatest(observables); - * combined.subscribe(value => console.log(value)); - * // Logs - * // [0, 0, 0] immediately - * // [1, 0, 0] after 1s - * // [1, 5, 0] after 5s - * // [1, 5, 10] after 10s - * - * - * @example Use project function to dynamically calculate the Body-Mass Index - * var weight = Rx.Observable.of(70, 72, 76, 79, 75); - * var height = Rx.Observable.of(1.76, 1.77, 1.78); - * var bmi = Rx.Observable.combineLatest(weight, height, (w, h) => w / (h * h)); - * bmi.subscribe(x => console.log('BMI is ' + x)); - * - * // With output to console: - * // BMI is 24.212293388429753 - * // BMI is 23.93948099205209 - * // BMI is 23.671253629592222 - * - * - * @see {@link combineAll} - * @see {@link merge} - * @see {@link withLatestFrom} - * - * @param {ObservableInput} observable1 An input Observable to combine with other Observables. - * @param {ObservableInput} observable2 An input Observable to combine with other Observables. - * More than one input Observables may be given as arguments - * or an array of Observables may be given as the first argument. - * @param {function} [project] An optional function to project the values from - * the combined latest values into a new value on the output Observable. - * @param {Scheduler} [scheduler=null] The IScheduler to use for subscribing to - * each input Observable. - * @return {Observable} An Observable of projected values from the most recent - * values from each input Observable, or an array of the most recent values from - * each input Observable. - * @static true - * @name combineLatest - * @owner Observable - */ -function combineLatest() { - var observables = []; - for (var _i = 0; _i < arguments.length; _i++) { - observables[_i - 0] = arguments[_i]; - } - var project = null; - var scheduler = null; - if (isScheduler_1.isScheduler(observables[observables.length - 1])) { - scheduler = observables.pop(); - } - if (typeof observables[observables.length - 1] === 'function') { - project = observables.pop(); - } - // if the first and only other argument besides the resultSelector is an array - // assume it's been called with `combineLatest([obs1, obs2, obs3], project)` - if (observables.length === 1 && isArray_1.isArray(observables[0])) { - observables = observables[0]; - } - return new ArrayObservable_1.ArrayObservable(observables, scheduler).lift(new combineLatest_1.CombineLatestOperator(project)); -} -exports.combineLatest = combineLatest; -//# sourceMappingURL=combineLatest.js.map + if (type === null && expressions.length === 0){ + return null; + } else { + this._readWhitespace(); + while (tokenStream.match(Tokens.IDENT)){ + if (tokenStream.token().value.toLowerCase() !== "and"){ + this._unexpectedToken(tokenStream.token()); + } -/***/ }), -/* 264 */ -/***/ (function(module, exports, __webpack_require__) { + this._readWhitespace(); + expressions.push(this._media_expression()); + } + } -"use strict"; + return new MediaQuery(ident, type, expressions, token.startLine, token.startCol); + }, -var concat_1 = __webpack_require__(38); -exports.concat = concat_1.concatStatic; -//# sourceMappingURL=concat.js.map + //CSS3 Media Queries + _media_type: function(){ + /* + * media_type + * : IDENT + * ; + */ + return this._media_feature(); + }, -/***/ }), -/* 265 */ -/***/ (function(module, exports, __webpack_require__) { + /** + * Note: in CSS3 Media Queries, this is called "expression". + * Renamed here to avoid conflict with CSS3 Selectors + * definition of "expression". Also note that "expr" in the + * grammar now maps to "expression" from CSS3 selectors. + * @method _media_expression + * @private + */ + _media_expression: function(){ + /* + * expression + * : '(' S* media_feature S* [ ':' S* expr ]? ')' S* + * ; + */ + var tokenStream = this._tokenStream, + feature = null, + token, + expression = null; + + tokenStream.mustMatch(Tokens.LPAREN); + + feature = this._media_feature(); + this._readWhitespace(); + + if (tokenStream.match(Tokens.COLON)){ + this._readWhitespace(); + token = tokenStream.LT(1); + expression = this._expression(); + } -"use strict"; + tokenStream.mustMatch(Tokens.RPAREN); + this._readWhitespace(); -var DeferObservable_1 = __webpack_require__(248); -exports.defer = DeferObservable_1.DeferObservable.create; -//# sourceMappingURL=defer.js.map + return new MediaFeature(feature, (expression ? new SyntaxUnit(expression, token.startLine, token.startCol) : null)); + }, -/***/ }), -/* 266 */ -/***/ (function(module, exports, __webpack_require__) { + //CSS3 Media Queries + _media_feature: function(){ + /* + * media_feature + * : IDENT + * ; + */ + var tokenStream = this._tokenStream; -"use strict"; + this._readWhitespace(); -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; -var Subject_1 = __webpack_require__(6); -var Subscriber_1 = __webpack_require__(2); -var Observable_1 = __webpack_require__(0); -var Subscription_1 = __webpack_require__(9); -var root_1 = __webpack_require__(12); -var ReplaySubject_1 = __webpack_require__(26); -var tryCatch_1 = __webpack_require__(7); -var errorObject_1 = __webpack_require__(5); -var assign_1 = __webpack_require__(373); -/** - * We need this JSDoc comment for affecting ESDoc. - * @extends {Ignored} - * @hide true - */ -var WebSocketSubject = (function (_super) { - __extends(WebSocketSubject, _super); - function WebSocketSubject(urlConfigOrSource, destination) { - if (urlConfigOrSource instanceof Observable_1.Observable) { - _super.call(this, destination, urlConfigOrSource); - } - else { - _super.call(this); - this.WebSocketCtor = root_1.root.WebSocket; - this._output = new Subject_1.Subject(); - if (typeof urlConfigOrSource === 'string') { - this.url = urlConfigOrSource; - } - else { - // WARNING: config object could override important members here. - assign_1.assign(this, urlConfigOrSource); - } - if (!this.WebSocketCtor) { - throw new Error('no WebSocket constructor can be found'); - } - this.destination = new ReplaySubject_1.ReplaySubject(); - } - } - WebSocketSubject.prototype.resultSelector = function (e) { - return JSON.parse(e.data); - }; - /** - * Wrapper around the w3c-compatible WebSocket object provided by the browser. - * - * @example Wraps browser WebSocket - * - * let socket$ = Observable.webSocket('ws://localhost:8081'); - * - * socket$.subscribe( - * (msg) => console.log('message received: ' + msg), - * (err) => console.log(err), - * () => console.log('complete') - * ); - * - * socket$.next(JSON.stringify({ op: 'hello' })); - * - * @example Wraps WebSocket from nodejs-websocket (using node.js) - * - * import { w3cwebsocket } from 'websocket'; - * - * let socket$ = Observable.webSocket({ - * url: 'ws://localhost:8081', - * WebSocketCtor: w3cwebsocket - * }); - * - * socket$.subscribe( - * (msg) => console.log('message received: ' + msg), - * (err) => console.log(err), - * () => console.log('complete') - * ); - * - * socket$.next(JSON.stringify({ op: 'hello' })); - * - * @param {string | WebSocketSubjectConfig} urlConfigOrSource the source of the websocket as an url or a structure defining the websocket object - * @return {WebSocketSubject} - * @static true - * @name webSocket - * @owner Observable - */ - WebSocketSubject.create = function (urlConfigOrSource) { - return new WebSocketSubject(urlConfigOrSource); - }; - WebSocketSubject.prototype.lift = function (operator) { - var sock = new WebSocketSubject(this, this.destination); - sock.operator = operator; - return sock; - }; - WebSocketSubject.prototype._resetState = function () { - this.socket = null; - if (!this.source) { - this.destination = new ReplaySubject_1.ReplaySubject(); - } - this._output = new Subject_1.Subject(); - }; - // TODO: factor this out to be a proper Operator/Subscriber implementation and eliminate closures - WebSocketSubject.prototype.multiplex = function (subMsg, unsubMsg, messageFilter) { - var self = this; - return new Observable_1.Observable(function (observer) { - var result = tryCatch_1.tryCatch(subMsg)(); - if (result === errorObject_1.errorObject) { - observer.error(errorObject_1.errorObject.e); - } - else { - self.next(result); - } - var subscription = self.subscribe(function (x) { - var result = tryCatch_1.tryCatch(messageFilter)(x); - if (result === errorObject_1.errorObject) { - observer.error(errorObject_1.errorObject.e); + tokenStream.mustMatch(Tokens.IDENT); + + return SyntaxUnit.fromToken(tokenStream.token()); + }, + + //CSS3 Paged Media + _page: function(){ + /* + * page: + * PAGE_SYM S* IDENT? pseudo_page? S* + * '{' S* [ declaration | margin ]? [ ';' S* [ declaration | margin ]? ]* '}' S* + * ; + */ + var tokenStream = this._tokenStream, + line, + col, + identifier = null, + pseudoPage = null; + + //look for @page + tokenStream.mustMatch(Tokens.PAGE_SYM); + line = tokenStream.token().startLine; + col = tokenStream.token().startCol; + + this._readWhitespace(); + + if (tokenStream.match(Tokens.IDENT)){ + identifier = tokenStream.token().value; + + //The value 'auto' may not be used as a page name and MUST be treated as a syntax error. + if (identifier.toLowerCase() === "auto"){ + this._unexpectedToken(tokenStream.token()); + } } - else if (result) { - observer.next(x); + + //see if there's a colon upcoming + if (tokenStream.peek() === Tokens.COLON){ + pseudoPage = this._pseudo_page(); } - }, function (err) { return observer.error(err); }, function () { return observer.complete(); }); - return function () { - var result = tryCatch_1.tryCatch(unsubMsg)(); - if (result === errorObject_1.errorObject) { - observer.error(errorObject_1.errorObject.e); + + this._readWhitespace(); + + this.fire({ + type: "startpage", + id: identifier, + pseudo: pseudoPage, + line: line, + col: col + }); + + this._readDeclarations(true, true); + + this.fire({ + type: "endpage", + id: identifier, + pseudo: pseudoPage, + line: line, + col: col + }); + + }, + + //CSS3 Paged Media + _margin: function(){ + /* + * margin : + * margin_sym S* '{' declaration [ ';' S* declaration? ]* '}' S* + * ; + */ + var tokenStream = this._tokenStream, + line, + col, + marginSym = this._margin_sym(); + + if (marginSym){ + line = tokenStream.token().startLine; + col = tokenStream.token().startCol; + + this.fire({ + type: "startpagemargin", + margin: marginSym, + line: line, + col: col + }); + + this._readDeclarations(true); + + this.fire({ + type: "endpagemargin", + margin: marginSym, + line: line, + col: col + }); + return true; + } else { + return false; } - else { - self.next(result); + }, + + //CSS3 Paged Media + _margin_sym: function(){ + + /* + * margin_sym : + * TOPLEFTCORNER_SYM | + * TOPLEFT_SYM | + * TOPCENTER_SYM | + * TOPRIGHT_SYM | + * TOPRIGHTCORNER_SYM | + * BOTTOMLEFTCORNER_SYM | + * BOTTOMLEFT_SYM | + * BOTTOMCENTER_SYM | + * BOTTOMRIGHT_SYM | + * BOTTOMRIGHTCORNER_SYM | + * LEFTTOP_SYM | + * LEFTMIDDLE_SYM | + * LEFTBOTTOM_SYM | + * RIGHTTOP_SYM | + * RIGHTMIDDLE_SYM | + * RIGHTBOTTOM_SYM + * ; + */ + + var tokenStream = this._tokenStream; + + if(tokenStream.match([Tokens.TOPLEFTCORNER_SYM, Tokens.TOPLEFT_SYM, + Tokens.TOPCENTER_SYM, Tokens.TOPRIGHT_SYM, Tokens.TOPRIGHTCORNER_SYM, + Tokens.BOTTOMLEFTCORNER_SYM, Tokens.BOTTOMLEFT_SYM, + Tokens.BOTTOMCENTER_SYM, Tokens.BOTTOMRIGHT_SYM, + Tokens.BOTTOMRIGHTCORNER_SYM, Tokens.LEFTTOP_SYM, + Tokens.LEFTMIDDLE_SYM, Tokens.LEFTBOTTOM_SYM, Tokens.RIGHTTOP_SYM, + Tokens.RIGHTMIDDLE_SYM, Tokens.RIGHTBOTTOM_SYM])) + { + return SyntaxUnit.fromToken(tokenStream.token()); + } else { + return null; } - subscription.unsubscribe(); - }; - }); - }; - WebSocketSubject.prototype._connectSocket = function () { - var _this = this; - var WebSocketCtor = this.WebSocketCtor; - var observer = this._output; - var socket = null; - try { - socket = this.protocol ? - new WebSocketCtor(this.url, this.protocol) : - new WebSocketCtor(this.url); - this.socket = socket; - if (this.binaryType) { - this.socket.binaryType = this.binaryType; - } - } - catch (e) { - observer.error(e); - return; - } - var subscription = new Subscription_1.Subscription(function () { - _this.socket = null; - if (socket && socket.readyState === 1) { - socket.close(); - } - }); - socket.onopen = function (e) { - var openObserver = _this.openObserver; - if (openObserver) { - openObserver.next(e); - } - var queue = _this.destination; - _this.destination = Subscriber_1.Subscriber.create(function (x) { return socket.readyState === 1 && socket.send(x); }, function (e) { - var closingObserver = _this.closingObserver; - if (closingObserver) { - closingObserver.next(undefined); + + }, + + _pseudo_page: function(){ + /* + * pseudo_page + * : ':' IDENT + * ; + */ + + var tokenStream = this._tokenStream; + + tokenStream.mustMatch(Tokens.COLON); + tokenStream.mustMatch(Tokens.IDENT); + + //TODO: CSS3 Paged Media says only "left", "center", and "right" are allowed + + return tokenStream.token().value; + }, + + _font_face: function(){ + /* + * font_face + * : FONT_FACE_SYM S* + * '{' S* declaration [ ';' S* declaration ]* '}' S* + * ; + */ + var tokenStream = this._tokenStream, + line, + col; + + //look for @page + tokenStream.mustMatch(Tokens.FONT_FACE_SYM); + line = tokenStream.token().startLine; + col = tokenStream.token().startCol; + + this._readWhitespace(); + + this.fire({ + type: "startfontface", + line: line, + col: col + }); + + this._readDeclarations(true); + + this.fire({ + type: "endfontface", + line: line, + col: col + }); + }, + + _viewport: function(){ + /* + * viewport + * : VIEWPORT_SYM S* + * '{' S* declaration? [ ';' S* declaration? ]* '}' S* + * ; + */ + var tokenStream = this._tokenStream, + line, + col; + + tokenStream.mustMatch(Tokens.VIEWPORT_SYM); + line = tokenStream.token().startLine; + col = tokenStream.token().startCol; + + this._readWhitespace(); + + this.fire({ + type: "startviewport", + line: line, + col: col + }); + + this._readDeclarations(true); + + this.fire({ + type: "endviewport", + line: line, + col: col + }); + + }, + + _document: function(){ + /* + * document + * : DOCUMENT_SYM S* + * _document_function [ ',' S* _document_function ]* S* + * '{' S* ruleset* '}' + * ; + */ + + var tokenStream = this._tokenStream, + token, + functions = [], + prefix = ""; + + tokenStream.mustMatch(Tokens.DOCUMENT_SYM); + token = tokenStream.token(); + if (/^@\-([^\-]+)\-/.test(token.value)) { + prefix = RegExp.$1; } - if (e && e.code) { - socket.close(e.code, e.reason); + + this._readWhitespace(); + functions.push(this._document_function()); + + while(tokenStream.match(Tokens.COMMA)) { + this._readWhitespace(); + functions.push(this._document_function()); } - else { - observer.error(new TypeError('WebSocketSubject.error must be called with an object with an error code, ' + - 'and an optional reason: { code: number, reason: string }')); + + tokenStream.mustMatch(Tokens.LBRACE); + this._readWhitespace(); + + this.fire({ + type: "startdocument", + functions: functions, + prefix: prefix, + line: token.startLine, + col: token.startCol + }); + + while(true) { + if (tokenStream.peek() === Tokens.PAGE_SYM){ + this._page(); + } else if (tokenStream.peek() === Tokens.FONT_FACE_SYM){ + this._font_face(); + } else if (tokenStream.peek() === Tokens.VIEWPORT_SYM){ + this._viewport(); + } else if (tokenStream.peek() === Tokens.MEDIA_SYM){ + this._media(); + } else if (!this._ruleset()){ + break; + } } - _this._resetState(); - }, function () { - var closingObserver = _this.closingObserver; - if (closingObserver) { - closingObserver.next(undefined); + + tokenStream.mustMatch(Tokens.RBRACE); + this._readWhitespace(); + + this.fire({ + type: "enddocument", + functions: functions, + prefix: prefix, + line: token.startLine, + col: token.startCol + }); + }, + + _document_function: function(){ + /* + * document_function + * : function | URI S* + * ; + */ + + var tokenStream = this._tokenStream, + value; + + if (tokenStream.match(Tokens.URI)) { + value = tokenStream.token().value; + this._readWhitespace(); + } else { + value = this._function(); } - socket.close(); - _this._resetState(); - }); - if (queue && queue instanceof ReplaySubject_1.ReplaySubject) { - subscription.add(queue.subscribe(_this.destination)); - } - }; - socket.onerror = function (e) { - _this._resetState(); - observer.error(e); - }; - socket.onclose = function (e) { - _this._resetState(); - var closeObserver = _this.closeObserver; - if (closeObserver) { - closeObserver.next(e); - } - if (e.wasClean) { - observer.complete(); - } - else { - observer.error(e); - } - }; - socket.onmessage = function (e) { - var result = tryCatch_1.tryCatch(_this.resultSelector)(e); - if (result === errorObject_1.errorObject) { - observer.error(errorObject_1.errorObject.e); - } - else { - observer.next(result); - } - }; - }; - WebSocketSubject.prototype._subscribe = function (subscriber) { - var _this = this; - var source = this.source; - if (source) { - return source.subscribe(subscriber); - } - if (!this.socket) { - this._connectSocket(); - } - var subscription = new Subscription_1.Subscription(); - subscription.add(this._output.subscribe(subscriber)); - subscription.add(function () { - var socket = _this.socket; - if (_this._output.observers.length === 0) { - if (socket && socket.readyState === 1) { - socket.close(); + + return value; + }, + + _operator: function(inFunction){ + + /* + * operator (outside function) + * : '/' S* | ',' S* | /( empty )/ + * operator (inside function) + * : '/' S* | '+' S* | '*' S* | '-' S* /( empty )/ + * ; + */ + + var tokenStream = this._tokenStream, + token = null; + + if (tokenStream.match([Tokens.SLASH, Tokens.COMMA]) || + (inFunction && tokenStream.match([Tokens.PLUS, Tokens.STAR, Tokens.MINUS]))){ + token = tokenStream.token(); + this._readWhitespace(); } - _this._resetState(); - } - }); - return subscription; - }; - WebSocketSubject.prototype.unsubscribe = function () { - var _a = this, source = _a.source, socket = _a.socket; - if (socket && socket.readyState === 1) { - socket.close(); - this._resetState(); - } - _super.prototype.unsubscribe.call(this); - if (!source) { - this.destination = new ReplaySubject_1.ReplaySubject(); - } - }; - return WebSocketSubject; -}(Subject_1.AnonymousSubject)); -exports.WebSocketSubject = WebSocketSubject; -//# sourceMappingURL=WebSocketSubject.js.map + return token ? PropertyValuePart.fromToken(token) : null; -/***/ }), -/* 267 */ -/***/ (function(module, exports, __webpack_require__) { + }, -"use strict"; + _combinator: function(){ -var AjaxObservable_1 = __webpack_require__(59); -exports.ajax = AjaxObservable_1.AjaxObservable.create; -//# sourceMappingURL=ajax.js.map + /* + * combinator + * : PLUS S* | GREATER S* | TILDE S* | S+ + * ; + */ -/***/ }), -/* 268 */ -/***/ (function(module, exports, __webpack_require__) { + var tokenStream = this._tokenStream, + value = null, + token; -"use strict"; + if(tokenStream.match([Tokens.PLUS, Tokens.GREATER, Tokens.TILDE])){ + token = tokenStream.token(); + value = new Combinator(token.value, token.startLine, token.startCol); + this._readWhitespace(); + } -var WebSocketSubject_1 = __webpack_require__(266); -exports.webSocket = WebSocketSubject_1.WebSocketSubject.create; -//# sourceMappingURL=webSocket.js.map + return value; + }, -/***/ }), -/* 269 */ -/***/ (function(module, exports, __webpack_require__) { + _unary_operator: function(){ -"use strict"; + /* + * unary_operator + * : '-' | '+' + * ; + */ -var EmptyObservable_1 = __webpack_require__(23); -exports.empty = EmptyObservable_1.EmptyObservable.create; -//# sourceMappingURL=empty.js.map + var tokenStream = this._tokenStream; + + if (tokenStream.match([Tokens.MINUS, Tokens.PLUS])){ + return tokenStream.token().value; + } else { + return null; + } + }, + + _property: function(){ + + /* + * property + * : IDENT S* + * ; + */ + + var tokenStream = this._tokenStream, + value = null, + hack = null, + tokenValue, + token, + line, + col; + + //check for star hack - throws error if not allowed + if (tokenStream.peek() === Tokens.STAR && this.options.starHack){ + tokenStream.get(); + token = tokenStream.token(); + hack = token.value; + line = token.startLine; + col = token.startCol; + } + + if(tokenStream.match(Tokens.IDENT)){ + token = tokenStream.token(); + tokenValue = token.value; + + //check for underscore hack - no error if not allowed because it's valid CSS syntax + if (tokenValue.charAt(0) === "_" && this.options.underscoreHack){ + hack = "_"; + tokenValue = tokenValue.substring(1); + } -/***/ }), -/* 270 */ -/***/ (function(module, exports, __webpack_require__) { + value = new PropertyName(tokenValue, hack, (line||token.startLine), (col||token.startCol)); + this._readWhitespace(); + } -"use strict"; + return value; + }, -var FromEventObservable_1 = __webpack_require__(250); -exports.fromEvent = FromEventObservable_1.FromEventObservable.create; -//# sourceMappingURL=fromEvent.js.map + //Augmented with CSS3 Selectors + _ruleset: function(){ + /* + * ruleset + * : selectors_group + * '{' S* declaration? [ ';' S* declaration? ]* '}' S* + * ; + */ -/***/ }), -/* 271 */ -/***/ (function(module, exports, __webpack_require__) { + var tokenStream = this._tokenStream, + tt, + selectors; -"use strict"; -var FromEventPatternObservable_1 = __webpack_require__(251); -exports.fromEventPattern = FromEventPatternObservable_1.FromEventPatternObservable.create; -//# sourceMappingURL=fromEventPattern.js.map + /* + * Error Recovery: If even a single selector fails to parse, + * then the entire ruleset should be thrown away. + */ + try { + selectors = this._selectors_group(); + } catch (ex){ + if (ex instanceof SyntaxError && !this.options.strict){ + + //fire error event + this.fire({ + type: "error", + error: ex, + message: ex.message, + line: ex.line, + col: ex.col + }); + + //skip over everything until closing brace + tt = tokenStream.advance([Tokens.RBRACE]); + if (tt === Tokens.RBRACE){ + //if there's a right brace, the rule is finished so don't do anything + } else { + //otherwise, rethrow the error because it wasn't handled properly + throw ex; + } -/***/ }), -/* 272 */ -/***/ (function(module, exports, __webpack_require__) { + } else { + //not a syntax error, rethrow it + throw ex; + } -"use strict"; + //trigger parser to continue + return true; + } -var IfObservable_1 = __webpack_require__(253); -exports._if = IfObservable_1.IfObservable.create; -//# sourceMappingURL=if.js.map + //if it got here, all selectors parsed + if (selectors){ -/***/ }), -/* 273 */ -/***/ (function(module, exports, __webpack_require__) { + this.fire({ + type: "startrule", + selectors: selectors, + line: selectors[0].line, + col: selectors[0].col + }); -"use strict"; + this._readDeclarations(true); -var IntervalObservable_1 = __webpack_require__(254); -exports.interval = IntervalObservable_1.IntervalObservable.create; -//# sourceMappingURL=interval.js.map + this.fire({ + type: "endrule", + selectors: selectors, + line: selectors[0].line, + col: selectors[0].col + }); -/***/ }), -/* 274 */ -/***/ (function(module, exports, __webpack_require__) { + } -"use strict"; + return selectors; -var NeverObservable_1 = __webpack_require__(255); -exports.never = NeverObservable_1.NeverObservable.create; -//# sourceMappingURL=never.js.map + }, -/***/ }), -/* 275 */ -/***/ (function(module, exports, __webpack_require__) { + //CSS3 Selectors + _selectors_group: function(){ + + /* + * selectors_group + * : selector [ COMMA S* selector ]* + * ; + */ + var tokenStream = this._tokenStream, + selectors = [], + selector; + + selector = this._selector(); + if (selector !== null){ + + selectors.push(selector); + while(tokenStream.match(Tokens.COMMA)){ + this._readWhitespace(); + selector = this._selector(); + if (selector !== null){ + selectors.push(selector); + } else { + this._unexpectedToken(tokenStream.LT(1)); + } + } + } -"use strict"; + return selectors.length ? selectors : null; + }, -var PairsObservable_1 = __webpack_require__(256); -exports.pairs = PairsObservable_1.PairsObservable.create; -//# sourceMappingURL=pairs.js.map + //CSS3 Selectors + _selector: function(){ + /* + * selector + * : simple_selector_sequence [ combinator simple_selector_sequence ]* + * ; + */ + + var tokenStream = this._tokenStream, + selector = [], + nextSelector = null, + combinator = null, + ws = null; + + //if there's no simple selector, then there's no selector + nextSelector = this._simple_selector_sequence(); + if (nextSelector === null){ + return null; + } -/***/ }), -/* 276 */ -/***/ (function(module, exports, __webpack_require__) { + selector.push(nextSelector); -"use strict"; + do { -var RangeObservable_1 = __webpack_require__(257); -exports.range = RangeObservable_1.RangeObservable.create; -//# sourceMappingURL=range.js.map + //look for a combinator + combinator = this._combinator(); -/***/ }), -/* 277 */ -/***/ (function(module, exports, __webpack_require__) { + if (combinator !== null){ + selector.push(combinator); + nextSelector = this._simple_selector_sequence(); -"use strict"; + //there must be a next selector + if (nextSelector === null){ + this._unexpectedToken(tokenStream.LT(1)); + } else { -var ErrorObservable_1 = __webpack_require__(249); -exports._throw = ErrorObservable_1.ErrorObservable.create; -//# sourceMappingURL=throw.js.map + //nextSelector is an instance of SelectorPart + selector.push(nextSelector); + } + } else { + + //if there's not whitespace, we're done + if (this._readWhitespace()){ + + //add whitespace separator + ws = new Combinator(tokenStream.token().value, tokenStream.token().startLine, tokenStream.token().startCol); + + //combinator is not required + combinator = this._combinator(); + + //selector is required if there's a combinator + nextSelector = this._simple_selector_sequence(); + if (nextSelector === null){ + if (combinator !== null){ + this._unexpectedToken(tokenStream.LT(1)); + } + } else { + + if (combinator !== null){ + selector.push(combinator); + } else { + selector.push(ws); + } + + selector.push(nextSelector); + } + } else { + break; + } -/***/ }), -/* 278 */ -/***/ (function(module, exports, __webpack_require__) { + } + } while(true); -"use strict"; + return new Selector(selector, selector[0].line, selector[0].col); + }, -var TimerObservable_1 = __webpack_require__(259); -exports.timer = TimerObservable_1.TimerObservable.create; -//# sourceMappingURL=timer.js.map + //CSS3 Selectors + _simple_selector_sequence: function(){ + /* + * simple_selector_sequence + * : [ type_selector | universal ] + * [ HASH | class | attrib | pseudo | negation ]* + * | [ HASH | class | attrib | pseudo | negation ]+ + * ; + */ + + var tokenStream = this._tokenStream, + + //parts of a simple selector + elementName = null, + modifiers = [], + + //complete selector text + selectorText= "", + + //the different parts after the element name to search for + components = [ + //HASH + function(){ + return tokenStream.match(Tokens.HASH) ? + new SelectorSubPart(tokenStream.token().value, "id", tokenStream.token().startLine, tokenStream.token().startCol) : + null; + }, + this._class, + this._attrib, + this._pseudo, + this._negation + ], + i = 0, + len = components.length, + component = null, + line, + col; + + + //get starting line and column for the selector + line = tokenStream.LT(1).startLine; + col = tokenStream.LT(1).startCol; + + elementName = this._type_selector(); + if (!elementName){ + elementName = this._universal(); + } -/***/ }), -/* 279 */ -/***/ (function(module, exports, __webpack_require__) { + if (elementName !== null){ + selectorText += elementName; + } -"use strict"; + while(true){ -var UsingObservable_1 = __webpack_require__(260); -exports.using = UsingObservable_1.UsingObservable.create; -//# sourceMappingURL=using.js.map + //whitespace means we're done + if (tokenStream.peek() === Tokens.S){ + break; + } -/***/ }), -/* 280 */ -/***/ (function(module, exports, __webpack_require__) { + //check for each component + while(i < len && component === null){ + component = components[i++].call(this); + } -"use strict"; + if (component === null){ -var zip_1 = __webpack_require__(39); -exports.zip = zip_1.zipStatic; -//# sourceMappingURL=zip.js.map + //we don't have a selector + if (selectorText === ""){ + return null; + } else { + break; + } + } else { + i = 0; + modifiers.push(component); + selectorText += component.toString(); + component = null; + } + } -/***/ }), -/* 281 */ -/***/ (function(module, exports, __webpack_require__) { -"use strict"; + return selectorText !== "" ? + new SelectorPart(elementName, modifiers, selectorText, line, col) : + null; + }, -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; -var tryCatch_1 = __webpack_require__(7); -var errorObject_1 = __webpack_require__(5); -var OuterSubscriber_1 = __webpack_require__(4); -var subscribeToResult_1 = __webpack_require__(3); -/** - * Ignores source values for a duration determined by another Observable, then - * emits the most recent value from the source Observable, then repeats this - * process. - * - * It's like {@link auditTime}, but the silencing - * duration is determined by a second Observable. - * - * - * - * `audit` is similar to `throttle`, but emits the last value from the silenced - * time window, instead of the first value. `audit` emits the most recent value - * from the source Observable on the output Observable as soon as its internal - * timer becomes disabled, and ignores source values while the timer is enabled. - * Initially, the timer is disabled. As soon as the first source value arrives, - * the timer is enabled by calling the `durationSelector` function with the - * source value, which returns the "duration" Observable. When the duration - * Observable emits a value or completes, the timer is disabled, then the most - * recent source value is emitted on the output Observable, and this process - * repeats for the next source value. - * - * @example Emit clicks at a rate of at most one click per second - * var clicks = Rx.Observable.fromEvent(document, 'click'); - * var result = clicks.audit(ev => Rx.Observable.interval(1000)); - * result.subscribe(x => console.log(x)); - * - * @see {@link auditTime} - * @see {@link debounce} - * @see {@link delayWhen} - * @see {@link sample} - * @see {@link throttle} - * - * @param {function(value: T): SubscribableOrPromise} durationSelector A function - * that receives a value from the source Observable, for computing the silencing - * duration, returned as an Observable or a Promise. - * @return {Observable} An Observable that performs rate-limiting of - * emissions from the source Observable. - * @method audit - * @owner Observable - */ -function audit(durationSelector) { - return this.lift(new AuditOperator(durationSelector)); -} -exports.audit = audit; -var AuditOperator = (function () { - function AuditOperator(durationSelector) { - this.durationSelector = durationSelector; - } - AuditOperator.prototype.call = function (subscriber, source) { - return source.subscribe(new AuditSubscriber(subscriber, this.durationSelector)); - }; - return AuditOperator; -}()); -/** - * We need this JSDoc comment for affecting ESDoc. - * @ignore - * @extends {Ignored} - */ -var AuditSubscriber = (function (_super) { - __extends(AuditSubscriber, _super); - function AuditSubscriber(destination, durationSelector) { - _super.call(this, destination); - this.durationSelector = durationSelector; - this.hasValue = false; - } - AuditSubscriber.prototype._next = function (value) { - this.value = value; - this.hasValue = true; - if (!this.throttled) { - var duration = tryCatch_1.tryCatch(this.durationSelector)(value); - if (duration === errorObject_1.errorObject) { - this.destination.error(errorObject_1.errorObject.e); - } - else { - var innerSubscription = subscribeToResult_1.subscribeToResult(this, duration); - if (innerSubscription.closed) { - this.clearThrottle(); + //CSS3 Selectors + _type_selector: function(){ + /* + * type_selector + * : [ namespace_prefix ]? element_name + * ; + */ + + var tokenStream = this._tokenStream, + ns = this._namespace_prefix(), + elementName = this._element_name(); + + if (!elementName){ + /* + * Need to back out the namespace that was read due to both + * type_selector and universal reading namespace_prefix + * first. Kind of hacky, but only way I can figure out + * right now how to not change the grammar. + */ + if (ns){ + tokenStream.unget(); + if (ns.length > 1){ + tokenStream.unget(); + } + } + + return null; + } else { + if (ns){ + elementName.text = ns + elementName.text; + elementName.col -= ns.length; + } + return elementName; } - else { - this.add(this.throttled = innerSubscription); + }, + + //CSS3 Selectors + _class: function(){ + /* + * class + * : '.' IDENT + * ; + */ + + var tokenStream = this._tokenStream, + token; + + if (tokenStream.match(Tokens.DOT)){ + tokenStream.mustMatch(Tokens.IDENT); + token = tokenStream.token(); + return new SelectorSubPart("." + token.value, "class", token.startLine, token.startCol - 1); + } else { + return null; } - } - } - }; - AuditSubscriber.prototype.clearThrottle = function () { - var _a = this, value = _a.value, hasValue = _a.hasValue, throttled = _a.throttled; - if (throttled) { - this.remove(throttled); - this.throttled = null; - throttled.unsubscribe(); - } - if (hasValue) { - this.value = null; - this.hasValue = false; - this.destination.next(value); - } - }; - AuditSubscriber.prototype.notifyNext = function (outerValue, innerValue, outerIndex, innerIndex) { - this.clearThrottle(); - }; - AuditSubscriber.prototype.notifyComplete = function () { - this.clearThrottle(); - }; - return AuditSubscriber; -}(OuterSubscriber_1.OuterSubscriber)); -//# sourceMappingURL=audit.js.map -/***/ }), -/* 282 */ -/***/ (function(module, exports, __webpack_require__) { + }, -"use strict"; + //CSS3 Selectors + _element_name: function(){ + /* + * element_name + * : IDENT + * ; + */ -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; -var async_1 = __webpack_require__(8); -var Subscriber_1 = __webpack_require__(2); -/** - * Ignores source values for `duration` milliseconds, then emits the most recent - * value from the source Observable, then repeats this process. - * - * When it sees a source values, it ignores that plus - * the next ones for `duration` milliseconds, and then it emits the most recent - * value from the source. - * - * - * - * `auditTime` is similar to `throttleTime`, but emits the last value from the - * silenced time window, instead of the first value. `auditTime` emits the most - * recent value from the source Observable on the output Observable as soon as - * its internal timer becomes disabled, and ignores source values while the - * timer is enabled. Initially, the timer is disabled. As soon as the first - * source value arrives, the timer is enabled. After `duration` milliseconds (or - * the time unit determined internally by the optional `scheduler`) has passed, - * the timer is disabled, then the most recent source value is emitted on the - * output Observable, and this process repeats for the next source value. - * Optionally takes a {@link IScheduler} for managing timers. - * - * @example Emit clicks at a rate of at most one click per second - * var clicks = Rx.Observable.fromEvent(document, 'click'); - * var result = clicks.auditTime(1000); - * result.subscribe(x => console.log(x)); - * - * @see {@link audit} - * @see {@link debounceTime} - * @see {@link delay} - * @see {@link sampleTime} - * @see {@link throttleTime} - * - * @param {number} duration Time to wait before emitting the most recent source - * value, measured in milliseconds or the time unit determined internally - * by the optional `scheduler`. - * @param {Scheduler} [scheduler=async] The {@link IScheduler} to use for - * managing the timers that handle the rate-limiting behavior. - * @return {Observable} An Observable that performs rate-limiting of - * emissions from the source Observable. - * @method auditTime - * @owner Observable - */ -function auditTime(duration, scheduler) { - if (scheduler === void 0) { scheduler = async_1.async; } - return this.lift(new AuditTimeOperator(duration, scheduler)); -} -exports.auditTime = auditTime; -var AuditTimeOperator = (function () { - function AuditTimeOperator(duration, scheduler) { - this.duration = duration; - this.scheduler = scheduler; - } - AuditTimeOperator.prototype.call = function (subscriber, source) { - return source.subscribe(new AuditTimeSubscriber(subscriber, this.duration, this.scheduler)); - }; - return AuditTimeOperator; -}()); -/** - * We need this JSDoc comment for affecting ESDoc. - * @ignore - * @extends {Ignored} - */ -var AuditTimeSubscriber = (function (_super) { - __extends(AuditTimeSubscriber, _super); - function AuditTimeSubscriber(destination, duration, scheduler) { - _super.call(this, destination); - this.duration = duration; - this.scheduler = scheduler; - this.hasValue = false; - } - AuditTimeSubscriber.prototype._next = function (value) { - this.value = value; - this.hasValue = true; - if (!this.throttled) { - this.add(this.throttled = this.scheduler.schedule(dispatchNext, this.duration, this)); - } - }; - AuditTimeSubscriber.prototype.clearThrottle = function () { - var _a = this, value = _a.value, hasValue = _a.hasValue, throttled = _a.throttled; - if (throttled) { - this.remove(throttled); - this.throttled = null; - throttled.unsubscribe(); - } - if (hasValue) { - this.value = null; - this.hasValue = false; - this.destination.next(value); - } - }; - return AuditTimeSubscriber; -}(Subscriber_1.Subscriber)); -function dispatchNext(subscriber) { - subscriber.clearThrottle(); -} -//# sourceMappingURL=auditTime.js.map + var tokenStream = this._tokenStream, + token; -/***/ }), -/* 283 */ -/***/ (function(module, exports, __webpack_require__) { + if (tokenStream.match(Tokens.IDENT)){ + token = tokenStream.token(); + return new SelectorSubPart(token.value, "elementName", token.startLine, token.startCol); -"use strict"; + } else { + return null; + } + }, -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; -var OuterSubscriber_1 = __webpack_require__(4); -var subscribeToResult_1 = __webpack_require__(3); -/** - * Buffers the source Observable values until `closingNotifier` emits. - * - * Collects values from the past as an array, and emits - * that array only when another Observable emits. - * - * - * - * Buffers the incoming Observable values until the given `closingNotifier` - * Observable emits a value, at which point it emits the buffer on the output - * Observable and starts a new buffer internally, awaiting the next time - * `closingNotifier` emits. - * - * @example On every click, emit array of most recent interval events - * var clicks = Rx.Observable.fromEvent(document, 'click'); - * var interval = Rx.Observable.interval(1000); - * var buffered = interval.buffer(clicks); - * buffered.subscribe(x => console.log(x)); - * - * @see {@link bufferCount} - * @see {@link bufferTime} - * @see {@link bufferToggle} - * @see {@link bufferWhen} - * @see {@link window} - * - * @param {Observable} closingNotifier An Observable that signals the - * buffer to be emitted on the output Observable. - * @return {Observable} An Observable of buffers, which are arrays of - * values. - * @method buffer - * @owner Observable - */ -function buffer(closingNotifier) { - return this.lift(new BufferOperator(closingNotifier)); -} -exports.buffer = buffer; -var BufferOperator = (function () { - function BufferOperator(closingNotifier) { - this.closingNotifier = closingNotifier; - } - BufferOperator.prototype.call = function (subscriber, source) { - return source.subscribe(new BufferSubscriber(subscriber, this.closingNotifier)); - }; - return BufferOperator; -}()); -/** - * We need this JSDoc comment for affecting ESDoc. - * @ignore - * @extends {Ignored} - */ -var BufferSubscriber = (function (_super) { - __extends(BufferSubscriber, _super); - function BufferSubscriber(destination, closingNotifier) { - _super.call(this, destination); - this.buffer = []; - this.add(subscribeToResult_1.subscribeToResult(this, closingNotifier)); - } - BufferSubscriber.prototype._next = function (value) { - this.buffer.push(value); - }; - BufferSubscriber.prototype.notifyNext = function (outerValue, innerValue, outerIndex, innerIndex, innerSub) { - var buffer = this.buffer; - this.buffer = []; - this.destination.next(buffer); - }; - return BufferSubscriber; -}(OuterSubscriber_1.OuterSubscriber)); -//# sourceMappingURL=buffer.js.map + //CSS3 Selectors + _namespace_prefix: function(){ + /* + * namespace_prefix + * : [ IDENT | '*' ]? '|' + * ; + */ + var tokenStream = this._tokenStream, + value = ""; + + //verify that this is a namespace prefix + if (tokenStream.LA(1) === Tokens.PIPE || tokenStream.LA(2) === Tokens.PIPE){ + + if(tokenStream.match([Tokens.IDENT, Tokens.STAR])){ + value += tokenStream.token().value; + } -/***/ }), -/* 284 */ -/***/ (function(module, exports, __webpack_require__) { + tokenStream.mustMatch(Tokens.PIPE); + value += "|"; -"use strict"; + } -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; -var Subscriber_1 = __webpack_require__(2); -/** - * Buffers the source Observable values until the size hits the maximum - * `bufferSize` given. - * - * Collects values from the past as an array, and emits - * that array only when its size reaches `bufferSize`. - * - * - * - * Buffers a number of values from the source Observable by `bufferSize` then - * emits the buffer and clears it, and starts a new buffer each - * `startBufferEvery` values. If `startBufferEvery` is not provided or is - * `null`, then new buffers are started immediately at the start of the source - * and when each buffer closes and is emitted. - * - * @example Emit the last two click events as an array - * var clicks = Rx.Observable.fromEvent(document, 'click'); - * var buffered = clicks.bufferCount(2); - * buffered.subscribe(x => console.log(x)); - * - * @example On every click, emit the last two click events as an array - * var clicks = Rx.Observable.fromEvent(document, 'click'); - * var buffered = clicks.bufferCount(2, 1); - * buffered.subscribe(x => console.log(x)); - * - * @see {@link buffer} - * @see {@link bufferTime} - * @see {@link bufferToggle} - * @see {@link bufferWhen} - * @see {@link pairwise} - * @see {@link windowCount} - * - * @param {number} bufferSize The maximum size of the buffer emitted. - * @param {number} [startBufferEvery] Interval at which to start a new buffer. - * For example if `startBufferEvery` is `2`, then a new buffer will be started - * on every other value from the source. A new buffer is started at the - * beginning of the source by default. - * @return {Observable} An Observable of arrays of buffered values. - * @method bufferCount - * @owner Observable - */ -function bufferCount(bufferSize, startBufferEvery) { - if (startBufferEvery === void 0) { startBufferEvery = null; } - return this.lift(new BufferCountOperator(bufferSize, startBufferEvery)); -} -exports.bufferCount = bufferCount; -var BufferCountOperator = (function () { - function BufferCountOperator(bufferSize, startBufferEvery) { - this.bufferSize = bufferSize; - this.startBufferEvery = startBufferEvery; - if (!startBufferEvery || bufferSize === startBufferEvery) { - this.subscriberClass = BufferCountSubscriber; - } - else { - this.subscriberClass = BufferSkipCountSubscriber; - } - } - BufferCountOperator.prototype.call = function (subscriber, source) { - return source.subscribe(new this.subscriberClass(subscriber, this.bufferSize, this.startBufferEvery)); - }; - return BufferCountOperator; -}()); -/** - * We need this JSDoc comment for affecting ESDoc. - * @ignore - * @extends {Ignored} - */ -var BufferCountSubscriber = (function (_super) { - __extends(BufferCountSubscriber, _super); - function BufferCountSubscriber(destination, bufferSize) { - _super.call(this, destination); - this.bufferSize = bufferSize; - this.buffer = []; - } - BufferCountSubscriber.prototype._next = function (value) { - var buffer = this.buffer; - buffer.push(value); - if (buffer.length == this.bufferSize) { - this.destination.next(buffer); - this.buffer = []; - } - }; - BufferCountSubscriber.prototype._complete = function () { - var buffer = this.buffer; - if (buffer.length > 0) { - this.destination.next(buffer); - } - _super.prototype._complete.call(this); - }; - return BufferCountSubscriber; -}(Subscriber_1.Subscriber)); -/** - * We need this JSDoc comment for affecting ESDoc. - * @ignore - * @extends {Ignored} - */ -var BufferSkipCountSubscriber = (function (_super) { - __extends(BufferSkipCountSubscriber, _super); - function BufferSkipCountSubscriber(destination, bufferSize, startBufferEvery) { - _super.call(this, destination); - this.bufferSize = bufferSize; - this.startBufferEvery = startBufferEvery; - this.buffers = []; - this.count = 0; - } - BufferSkipCountSubscriber.prototype._next = function (value) { - var _a = this, bufferSize = _a.bufferSize, startBufferEvery = _a.startBufferEvery, buffers = _a.buffers, count = _a.count; - this.count++; - if (count % startBufferEvery === 0) { - buffers.push([]); - } - for (var i = buffers.length; i--;) { - var buffer = buffers[i]; - buffer.push(value); - if (buffer.length === bufferSize) { - buffers.splice(i, 1); - this.destination.next(buffer); - } - } - }; - BufferSkipCountSubscriber.prototype._complete = function () { - var _a = this, buffers = _a.buffers, destination = _a.destination; - while (buffers.length > 0) { - var buffer = buffers.shift(); - if (buffer.length > 0) { - destination.next(buffer); - } - } - _super.prototype._complete.call(this); - }; - return BufferSkipCountSubscriber; -}(Subscriber_1.Subscriber)); -//# sourceMappingURL=bufferCount.js.map + return value.length ? value : null; + }, + + //CSS3 Selectors + _universal: function(){ + /* + * universal + * : [ namespace_prefix ]? '*' + * ; + */ + var tokenStream = this._tokenStream, + value = "", + ns; + + ns = this._namespace_prefix(); + if(ns){ + value += ns; + } + + if(tokenStream.match(Tokens.STAR)){ + value += "*"; + } -/***/ }), -/* 285 */ -/***/ (function(module, exports, __webpack_require__) { + return value.length ? value : null; + + }, + + //CSS3 Selectors + _attrib: function(){ + /* + * attrib + * : '[' S* [ namespace_prefix ]? IDENT S* + * [ [ PREFIXMATCH | + * SUFFIXMATCH | + * SUBSTRINGMATCH | + * '=' | + * INCLUDES | + * DASHMATCH ] S* [ IDENT | STRING ] S* + * ]? ']' + * ; + */ + + var tokenStream = this._tokenStream, + value = null, + ns, + token; + + if (tokenStream.match(Tokens.LBRACKET)){ + token = tokenStream.token(); + value = token.value; + value += this._readWhitespace(); + + ns = this._namespace_prefix(); + + if (ns){ + value += ns; + } -"use strict"; + tokenStream.mustMatch(Tokens.IDENT); + value += tokenStream.token().value; + value += this._readWhitespace(); -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; -var async_1 = __webpack_require__(8); -var Subscriber_1 = __webpack_require__(2); -var isScheduler_1 = __webpack_require__(13); -/* tslint:enable:max-line-length */ -/** - * Buffers the source Observable values for a specific time period. - * - * Collects values from the past as an array, and emits - * those arrays periodically in time. - * - * - * - * Buffers values from the source for a specific time duration `bufferTimeSpan`. - * Unless the optional argument `bufferCreationInterval` is given, it emits and - * resets the buffer every `bufferTimeSpan` milliseconds. If - * `bufferCreationInterval` is given, this operator opens the buffer every - * `bufferCreationInterval` milliseconds and closes (emits and resets) the - * buffer every `bufferTimeSpan` milliseconds. When the optional argument - * `maxBufferSize` is specified, the buffer will be closed either after - * `bufferTimeSpan` milliseconds or when it contains `maxBufferSize` elements. - * - * @example Every second, emit an array of the recent click events - * var clicks = Rx.Observable.fromEvent(document, 'click'); - * var buffered = clicks.bufferTime(1000); - * buffered.subscribe(x => console.log(x)); - * - * @example Every 5 seconds, emit the click events from the next 2 seconds - * var clicks = Rx.Observable.fromEvent(document, 'click'); - * var buffered = clicks.bufferTime(2000, 5000); - * buffered.subscribe(x => console.log(x)); - * - * @see {@link buffer} - * @see {@link bufferCount} - * @see {@link bufferToggle} - * @see {@link bufferWhen} - * @see {@link windowTime} - * - * @param {number} bufferTimeSpan The amount of time to fill each buffer array. - * @param {number} [bufferCreationInterval] The interval at which to start new - * buffers. - * @param {number} [maxBufferSize] The maximum buffer size. - * @param {Scheduler} [scheduler=async] The scheduler on which to schedule the - * intervals that determine buffer boundaries. - * @return {Observable} An observable of arrays of buffered values. - * @method bufferTime - * @owner Observable - */ -function bufferTime(bufferTimeSpan) { - var length = arguments.length; - var scheduler = async_1.async; - if (isScheduler_1.isScheduler(arguments[arguments.length - 1])) { - scheduler = arguments[arguments.length - 1]; - length--; - } - var bufferCreationInterval = null; - if (length >= 2) { - bufferCreationInterval = arguments[1]; - } - var maxBufferSize = Number.POSITIVE_INFINITY; - if (length >= 3) { - maxBufferSize = arguments[2]; - } - return this.lift(new BufferTimeOperator(bufferTimeSpan, bufferCreationInterval, maxBufferSize, scheduler)); -} -exports.bufferTime = bufferTime; -var BufferTimeOperator = (function () { - function BufferTimeOperator(bufferTimeSpan, bufferCreationInterval, maxBufferSize, scheduler) { - this.bufferTimeSpan = bufferTimeSpan; - this.bufferCreationInterval = bufferCreationInterval; - this.maxBufferSize = maxBufferSize; - this.scheduler = scheduler; - } - BufferTimeOperator.prototype.call = function (subscriber, source) { - return source.subscribe(new BufferTimeSubscriber(subscriber, this.bufferTimeSpan, this.bufferCreationInterval, this.maxBufferSize, this.scheduler)); - }; - return BufferTimeOperator; -}()); -var Context = (function () { - function Context() { - this.buffer = []; - } - return Context; -}()); -/** - * We need this JSDoc comment for affecting ESDoc. - * @ignore - * @extends {Ignored} - */ -var BufferTimeSubscriber = (function (_super) { - __extends(BufferTimeSubscriber, _super); - function BufferTimeSubscriber(destination, bufferTimeSpan, bufferCreationInterval, maxBufferSize, scheduler) { - _super.call(this, destination); - this.bufferTimeSpan = bufferTimeSpan; - this.bufferCreationInterval = bufferCreationInterval; - this.maxBufferSize = maxBufferSize; - this.scheduler = scheduler; - this.contexts = []; - var context = this.openContext(); - this.timespanOnly = bufferCreationInterval == null || bufferCreationInterval < 0; - if (this.timespanOnly) { - var timeSpanOnlyState = { subscriber: this, context: context, bufferTimeSpan: bufferTimeSpan }; - this.add(context.closeAction = scheduler.schedule(dispatchBufferTimeSpanOnly, bufferTimeSpan, timeSpanOnlyState)); - } - else { - var closeState = { subscriber: this, context: context }; - var creationState = { bufferTimeSpan: bufferTimeSpan, bufferCreationInterval: bufferCreationInterval, subscriber: this, scheduler: scheduler }; - this.add(context.closeAction = scheduler.schedule(dispatchBufferClose, bufferTimeSpan, closeState)); - this.add(scheduler.schedule(dispatchBufferCreation, bufferCreationInterval, creationState)); - } - } - BufferTimeSubscriber.prototype._next = function (value) { - var contexts = this.contexts; - var len = contexts.length; - var filledBufferContext; - for (var i = 0; i < len; i++) { - var context = contexts[i]; - var buffer = context.buffer; - buffer.push(value); - if (buffer.length == this.maxBufferSize) { - filledBufferContext = context; - } - } - if (filledBufferContext) { - this.onBufferFull(filledBufferContext); - } - }; - BufferTimeSubscriber.prototype._error = function (err) { - this.contexts.length = 0; - _super.prototype._error.call(this, err); - }; - BufferTimeSubscriber.prototype._complete = function () { - var _a = this, contexts = _a.contexts, destination = _a.destination; - while (contexts.length > 0) { - var context = contexts.shift(); - destination.next(context.buffer); - } - _super.prototype._complete.call(this); - }; - BufferTimeSubscriber.prototype._unsubscribe = function () { - this.contexts = null; - }; - BufferTimeSubscriber.prototype.onBufferFull = function (context) { - this.closeContext(context); - var closeAction = context.closeAction; - closeAction.unsubscribe(); - this.remove(closeAction); - if (!this.closed && this.timespanOnly) { - context = this.openContext(); - var bufferTimeSpan = this.bufferTimeSpan; - var timeSpanOnlyState = { subscriber: this, context: context, bufferTimeSpan: bufferTimeSpan }; - this.add(context.closeAction = this.scheduler.schedule(dispatchBufferTimeSpanOnly, bufferTimeSpan, timeSpanOnlyState)); - } - }; - BufferTimeSubscriber.prototype.openContext = function () { - var context = new Context(); - this.contexts.push(context); - return context; - }; - BufferTimeSubscriber.prototype.closeContext = function (context) { - this.destination.next(context.buffer); - var contexts = this.contexts; - var spliceIndex = contexts ? contexts.indexOf(context) : -1; - if (spliceIndex >= 0) { - contexts.splice(contexts.indexOf(context), 1); - } - }; - return BufferTimeSubscriber; -}(Subscriber_1.Subscriber)); -function dispatchBufferTimeSpanOnly(state) { - var subscriber = state.subscriber; - var prevContext = state.context; - if (prevContext) { - subscriber.closeContext(prevContext); - } - if (!subscriber.closed) { - state.context = subscriber.openContext(); - state.context.closeAction = this.schedule(state, state.bufferTimeSpan); - } -} -function dispatchBufferCreation(state) { - var bufferCreationInterval = state.bufferCreationInterval, bufferTimeSpan = state.bufferTimeSpan, subscriber = state.subscriber, scheduler = state.scheduler; - var context = subscriber.openContext(); - var action = this; - if (!subscriber.closed) { - subscriber.add(context.closeAction = scheduler.schedule(dispatchBufferClose, bufferTimeSpan, { subscriber: subscriber, context: context })); - action.schedule(state, bufferCreationInterval); - } -} -function dispatchBufferClose(arg) { - var subscriber = arg.subscriber, context = arg.context; - subscriber.closeContext(context); -} -//# sourceMappingURL=bufferTime.js.map + if(tokenStream.match([Tokens.PREFIXMATCH, Tokens.SUFFIXMATCH, Tokens.SUBSTRINGMATCH, + Tokens.EQUALS, Tokens.INCLUDES, Tokens.DASHMATCH])){ -/***/ }), -/* 286 */ -/***/ (function(module, exports, __webpack_require__) { + value += tokenStream.token().value; + value += this._readWhitespace(); -"use strict"; + tokenStream.mustMatch([Tokens.IDENT, Tokens.STRING]); + value += tokenStream.token().value; + value += this._readWhitespace(); + } -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; -var Subscription_1 = __webpack_require__(9); -var subscribeToResult_1 = __webpack_require__(3); -var OuterSubscriber_1 = __webpack_require__(4); -/** - * Buffers the source Observable values starting from an emission from - * `openings` and ending when the output of `closingSelector` emits. - * - * Collects values from the past as an array. Starts - * collecting only when `opening` emits, and calls the `closingSelector` - * function to get an Observable that tells when to close the buffer. - * - * - * - * Buffers values from the source by opening the buffer via signals from an - * Observable provided to `openings`, and closing and sending the buffers when - * a Subscribable or Promise returned by the `closingSelector` function emits. - * - * @example Every other second, emit the click events from the next 500ms - * var clicks = Rx.Observable.fromEvent(document, 'click'); - * var openings = Rx.Observable.interval(1000); - * var buffered = clicks.bufferToggle(openings, i => - * i % 2 ? Rx.Observable.interval(500) : Rx.Observable.empty() - * ); - * buffered.subscribe(x => console.log(x)); - * - * @see {@link buffer} - * @see {@link bufferCount} - * @see {@link bufferTime} - * @see {@link bufferWhen} - * @see {@link windowToggle} - * - * @param {SubscribableOrPromise} openings A Subscribable or Promise of notifications to start new - * buffers. - * @param {function(value: O): SubscribableOrPromise} closingSelector A function that takes - * the value emitted by the `openings` observable and returns a Subscribable or Promise, - * which, when it emits, signals that the associated buffer should be emitted - * and cleared. - * @return {Observable} An observable of arrays of buffered values. - * @method bufferToggle - * @owner Observable - */ -function bufferToggle(openings, closingSelector) { - return this.lift(new BufferToggleOperator(openings, closingSelector)); -} -exports.bufferToggle = bufferToggle; -var BufferToggleOperator = (function () { - function BufferToggleOperator(openings, closingSelector) { - this.openings = openings; - this.closingSelector = closingSelector; - } - BufferToggleOperator.prototype.call = function (subscriber, source) { - return source.subscribe(new BufferToggleSubscriber(subscriber, this.openings, this.closingSelector)); - }; - return BufferToggleOperator; -}()); -/** - * We need this JSDoc comment for affecting ESDoc. - * @ignore - * @extends {Ignored} - */ -var BufferToggleSubscriber = (function (_super) { - __extends(BufferToggleSubscriber, _super); - function BufferToggleSubscriber(destination, openings, closingSelector) { - _super.call(this, destination); - this.openings = openings; - this.closingSelector = closingSelector; - this.contexts = []; - this.add(subscribeToResult_1.subscribeToResult(this, openings)); - } - BufferToggleSubscriber.prototype._next = function (value) { - var contexts = this.contexts; - var len = contexts.length; - for (var i = 0; i < len; i++) { - contexts[i].buffer.push(value); - } - }; - BufferToggleSubscriber.prototype._error = function (err) { - var contexts = this.contexts; - while (contexts.length > 0) { - var context = contexts.shift(); - context.subscription.unsubscribe(); - context.buffer = null; - context.subscription = null; - } - this.contexts = null; - _super.prototype._error.call(this, err); - }; - BufferToggleSubscriber.prototype._complete = function () { - var contexts = this.contexts; - while (contexts.length > 0) { - var context = contexts.shift(); - this.destination.next(context.buffer); - context.subscription.unsubscribe(); - context.buffer = null; - context.subscription = null; - } - this.contexts = null; - _super.prototype._complete.call(this); - }; - BufferToggleSubscriber.prototype.notifyNext = function (outerValue, innerValue, outerIndex, innerIndex, innerSub) { - outerValue ? this.closeBuffer(outerValue) : this.openBuffer(innerValue); - }; - BufferToggleSubscriber.prototype.notifyComplete = function (innerSub) { - this.closeBuffer(innerSub.context); - }; - BufferToggleSubscriber.prototype.openBuffer = function (value) { - try { - var closingSelector = this.closingSelector; - var closingNotifier = closingSelector.call(this, value); - if (closingNotifier) { - this.trySubscribe(closingNotifier); - } - } - catch (err) { - this._error(err); - } - }; - BufferToggleSubscriber.prototype.closeBuffer = function (context) { - var contexts = this.contexts; - if (contexts && context) { - var buffer = context.buffer, subscription = context.subscription; - this.destination.next(buffer); - contexts.splice(contexts.indexOf(context), 1); - this.remove(subscription); - subscription.unsubscribe(); - } - }; - BufferToggleSubscriber.prototype.trySubscribe = function (closingNotifier) { - var contexts = this.contexts; - var buffer = []; - var subscription = new Subscription_1.Subscription(); - var context = { buffer: buffer, subscription: subscription }; - contexts.push(context); - var innerSubscription = subscribeToResult_1.subscribeToResult(this, closingNotifier, context); - if (!innerSubscription || innerSubscription.closed) { - this.closeBuffer(context); - } - else { - innerSubscription.context = context; - this.add(innerSubscription); - subscription.add(innerSubscription); - } - }; - return BufferToggleSubscriber; -}(OuterSubscriber_1.OuterSubscriber)); -//# sourceMappingURL=bufferToggle.js.map + tokenStream.mustMatch(Tokens.RBRACKET); -/***/ }), -/* 287 */ -/***/ (function(module, exports, __webpack_require__) { + return new SelectorSubPart(value + "]", "attribute", token.startLine, token.startCol); + } else { + return null; + } + }, -"use strict"; + //CSS3 Selectors + _pseudo: function(){ -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; -var Subscription_1 = __webpack_require__(9); -var tryCatch_1 = __webpack_require__(7); -var errorObject_1 = __webpack_require__(5); -var OuterSubscriber_1 = __webpack_require__(4); -var subscribeToResult_1 = __webpack_require__(3); -/** - * Buffers the source Observable values, using a factory function of closing - * Observables to determine when to close, emit, and reset the buffer. - * - * Collects values from the past as an array. When it - * starts collecting values, it calls a function that returns an Observable that - * tells when to close the buffer and restart collecting. - * - * - * - * Opens a buffer immediately, then closes the buffer when the observable - * returned by calling `closingSelector` function emits a value. When it closes - * the buffer, it immediately opens a new buffer and repeats the process. - * - * @example Emit an array of the last clicks every [1-5] random seconds - * var clicks = Rx.Observable.fromEvent(document, 'click'); - * var buffered = clicks.bufferWhen(() => - * Rx.Observable.interval(1000 + Math.random() * 4000) - * ); - * buffered.subscribe(x => console.log(x)); - * - * @see {@link buffer} - * @see {@link bufferCount} - * @see {@link bufferTime} - * @see {@link bufferToggle} - * @see {@link windowWhen} - * - * @param {function(): Observable} closingSelector A function that takes no - * arguments and returns an Observable that signals buffer closure. - * @return {Observable} An observable of arrays of buffered values. - * @method bufferWhen - * @owner Observable - */ -function bufferWhen(closingSelector) { - return this.lift(new BufferWhenOperator(closingSelector)); -} -exports.bufferWhen = bufferWhen; -var BufferWhenOperator = (function () { - function BufferWhenOperator(closingSelector) { - this.closingSelector = closingSelector; - } - BufferWhenOperator.prototype.call = function (subscriber, source) { - return source.subscribe(new BufferWhenSubscriber(subscriber, this.closingSelector)); - }; - return BufferWhenOperator; -}()); -/** - * We need this JSDoc comment for affecting ESDoc. - * @ignore - * @extends {Ignored} - */ -var BufferWhenSubscriber = (function (_super) { - __extends(BufferWhenSubscriber, _super); - function BufferWhenSubscriber(destination, closingSelector) { - _super.call(this, destination); - this.closingSelector = closingSelector; - this.subscribing = false; - this.openBuffer(); - } - BufferWhenSubscriber.prototype._next = function (value) { - this.buffer.push(value); - }; - BufferWhenSubscriber.prototype._complete = function () { - var buffer = this.buffer; - if (buffer) { - this.destination.next(buffer); - } - _super.prototype._complete.call(this); - }; - BufferWhenSubscriber.prototype._unsubscribe = function () { - this.buffer = null; - this.subscribing = false; - }; - BufferWhenSubscriber.prototype.notifyNext = function (outerValue, innerValue, outerIndex, innerIndex, innerSub) { - this.openBuffer(); - }; - BufferWhenSubscriber.prototype.notifyComplete = function () { - if (this.subscribing) { - this.complete(); - } - else { - this.openBuffer(); - } - }; - BufferWhenSubscriber.prototype.openBuffer = function () { - var closingSubscription = this.closingSubscription; - if (closingSubscription) { - this.remove(closingSubscription); - closingSubscription.unsubscribe(); - } - var buffer = this.buffer; - if (this.buffer) { - this.destination.next(buffer); - } - this.buffer = []; - var closingNotifier = tryCatch_1.tryCatch(this.closingSelector)(); - if (closingNotifier === errorObject_1.errorObject) { - this.error(errorObject_1.errorObject.e); - } - else { - closingSubscription = new Subscription_1.Subscription(); - this.closingSubscription = closingSubscription; - this.add(closingSubscription); - this.subscribing = true; - closingSubscription.add(subscribeToResult_1.subscribeToResult(this, closingNotifier)); - this.subscribing = false; - } - }; - return BufferWhenSubscriber; -}(OuterSubscriber_1.OuterSubscriber)); -//# sourceMappingURL=bufferWhen.js.map + /* + * pseudo + * : ':' ':'? [ IDENT | functional_pseudo ] + * ; + */ -/***/ }), -/* 288 */ -/***/ (function(module, exports, __webpack_require__) { + var tokenStream = this._tokenStream, + pseudo = null, + colons = ":", + line, + col; -"use strict"; + if (tokenStream.match(Tokens.COLON)){ -var combineLatest_1 = __webpack_require__(37); -/** - * Converts a higher-order Observable into a first-order Observable by waiting - * for the outer Observable to complete, then applying {@link combineLatest}. - * - * Flattens an Observable-of-Observables by applying - * {@link combineLatest} when the Observable-of-Observables completes. - * - * - * - * Takes an Observable of Observables, and collects all Observables from it. - * Once the outer Observable completes, it subscribes to all collected - * Observables and combines their values using the {@link combineLatest} - * strategy, such that: - * - Every time an inner Observable emits, the output Observable emits. - * - When the returned observable emits, it emits all of the latest values by: - * - If a `project` function is provided, it is called with each recent value - * from each inner Observable in whatever order they arrived, and the result - * of the `project` function is what is emitted by the output Observable. - * - If there is no `project` function, an array of all of the most recent - * values is emitted by the output Observable. - * - * @example Map two click events to a finite interval Observable, then apply combineAll - * var clicks = Rx.Observable.fromEvent(document, 'click'); - * var higherOrder = clicks.map(ev => - * Rx.Observable.interval(Math.random()*2000).take(3) - * ).take(2); - * var result = higherOrder.combineAll(); - * result.subscribe(x => console.log(x)); - * - * @see {@link combineLatest} - * @see {@link mergeAll} - * - * @param {function} [project] An optional function to map the most recent - * values from each inner Observable into a new result. Takes each of the most - * recent values from each collected inner Observable as arguments, in order. - * @return {Observable} An Observable of projected results or arrays of recent - * values. - * @method combineAll - * @owner Observable - */ -function combineAll(project) { - return this.lift(new combineLatest_1.CombineLatestOperator(project)); -} -exports.combineAll = combineAll; -//# sourceMappingURL=combineAll.js.map + if (tokenStream.match(Tokens.COLON)){ + colons += ":"; + } -/***/ }), -/* 289 */ -/***/ (function(module, exports, __webpack_require__) { + if (tokenStream.match(Tokens.IDENT)){ + pseudo = tokenStream.token().value; + line = tokenStream.token().startLine; + col = tokenStream.token().startCol - colons.length; + } else if (tokenStream.peek() === Tokens.FUNCTION){ + line = tokenStream.LT(1).startLine; + col = tokenStream.LT(1).startCol - colons.length; + pseudo = this._functional_pseudo(); + } -"use strict"; + if (pseudo){ + pseudo = new SelectorSubPart(colons + pseudo, "pseudo", line, col); + } + } -var mergeMapTo_1 = __webpack_require__(62); -/* tslint:enable:max-line-length */ -/** - * Projects each source value to the same Observable which is merged multiple - * times in a serialized fashion on the output Observable. - * - * It's like {@link concatMap}, but maps each value - * always to the same inner Observable. - * - * - * - * Maps each source value to the given Observable `innerObservable` regardless - * of the source value, and then flattens those resulting Observables into one - * single Observable, which is the output Observable. Each new `innerObservable` - * instance emitted on the output Observable is concatenated with the previous - * `innerObservable` instance. - * - * __Warning:__ if source values arrive endlessly and faster than their - * corresponding inner Observables can complete, it will result in memory issues - * as inner Observables amass in an unbounded buffer waiting for their turn to - * be subscribed to. - * - * Note: `concatMapTo` is equivalent to `mergeMapTo` with concurrency parameter - * set to `1`. - * - * @example For each click event, tick every second from 0 to 3, with no concurrency - * var clicks = Rx.Observable.fromEvent(document, 'click'); - * var result = clicks.concatMapTo(Rx.Observable.interval(1000).take(4)); - * result.subscribe(x => console.log(x)); - * - * // Results in the following: - * // (results are not concurrent) - * // For every click on the "document" it will emit values 0 to 3 spaced - * // on a 1000ms interval - * // one click = 1000ms-> 0 -1000ms-> 1 -1000ms-> 2 -1000ms-> 3 - * - * @see {@link concat} - * @see {@link concatAll} - * @see {@link concatMap} - * @see {@link mergeMapTo} - * @see {@link switchMapTo} - * - * @param {ObservableInput} innerObservable An Observable to replace each value from - * the source Observable. - * @param {function(outerValue: T, innerValue: I, outerIndex: number, innerIndex: number): any} [resultSelector] - * A function to produce the value on the output Observable based on the values - * and the indices of the source (outer) emission and the inner Observable - * emission. The arguments passed to this function are: - * - `outerValue`: the value that came from the source - * - `innerValue`: the value that came from the projected Observable - * - `outerIndex`: the "index" of the value that came from the source - * - `innerIndex`: the "index" of the value from the projected Observable - * @return {Observable} An observable of values merged together by joining the - * passed observable with itself, one after the other, for each value emitted - * from the source. - * @method concatMapTo - * @owner Observable - */ -function concatMapTo(innerObservable, resultSelector) { - return this.lift(new mergeMapTo_1.MergeMapToOperator(innerObservable, resultSelector, 1)); -} -exports.concatMapTo = concatMapTo; -//# sourceMappingURL=concatMapTo.js.map + return pseudo; + }, -/***/ }), -/* 290 */ -/***/ (function(module, exports, __webpack_require__) { + //CSS3 Selectors + _functional_pseudo: function(){ + /* + * functional_pseudo + * : FUNCTION S* expression ')' + * ; + */ + + var tokenStream = this._tokenStream, + value = null; + + if(tokenStream.match(Tokens.FUNCTION)){ + value = tokenStream.token().value; + value += this._readWhitespace(); + value += this._expression(); + tokenStream.mustMatch(Tokens.RPAREN); + value += ")"; + } -"use strict"; + return value; + }, -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; -var Subscriber_1 = __webpack_require__(2); -/** - * Counts the number of emissions on the source and emits that number when the - * source completes. - * - * Tells how many values were emitted, when the source - * completes. - * - * - * - * `count` transforms an Observable that emits values into an Observable that - * emits a single value that represents the number of values emitted by the - * source Observable. If the source Observable terminates with an error, `count` - * will pass this error notification along without emitting a value first. If - * the source Observable does not terminate at all, `count` will neither emit - * a value nor terminate. This operator takes an optional `predicate` function - * as argument, in which case the output emission will represent the number of - * source values that matched `true` with the `predicate`. - * - * @example Counts how many seconds have passed before the first click happened - * var seconds = Rx.Observable.interval(1000); - * var clicks = Rx.Observable.fromEvent(document, 'click'); - * var secondsBeforeClick = seconds.takeUntil(clicks); - * var result = secondsBeforeClick.count(); - * result.subscribe(x => console.log(x)); - * - * @example Counts how many odd numbers are there between 1 and 7 - * var numbers = Rx.Observable.range(1, 7); - * var result = numbers.count(i => i % 2 === 1); - * result.subscribe(x => console.log(x)); - * - * // Results in: - * // 4 - * - * @see {@link max} - * @see {@link min} - * @see {@link reduce} - * - * @param {function(value: T, i: number, source: Observable): boolean} [predicate] A - * boolean function to select what values are to be counted. It is provided with - * arguments of: - * - `value`: the value from the source Observable. - * - `index`: the (zero-based) "index" of the value from the source Observable. - * - `source`: the source Observable instance itself. - * @return {Observable} An Observable of one number that represents the count as - * described above. - * @method count - * @owner Observable - */ -function count(predicate) { - return this.lift(new CountOperator(predicate, this)); -} -exports.count = count; -var CountOperator = (function () { - function CountOperator(predicate, source) { - this.predicate = predicate; - this.source = source; - } - CountOperator.prototype.call = function (subscriber, source) { - return source.subscribe(new CountSubscriber(subscriber, this.predicate, this.source)); - }; - return CountOperator; -}()); -/** - * We need this JSDoc comment for affecting ESDoc. - * @ignore - * @extends {Ignored} - */ -var CountSubscriber = (function (_super) { - __extends(CountSubscriber, _super); - function CountSubscriber(destination, predicate, source) { - _super.call(this, destination); - this.predicate = predicate; - this.source = source; - this.count = 0; - this.index = 0; - } - CountSubscriber.prototype._next = function (value) { - if (this.predicate) { - this._tryPredicate(value); - } - else { - this.count++; - } - }; - CountSubscriber.prototype._tryPredicate = function (value) { - var result; - try { - result = this.predicate(value, this.index++, this.source); - } - catch (err) { - this.destination.error(err); - return; - } - if (result) { - this.count++; - } - }; - CountSubscriber.prototype._complete = function () { - this.destination.next(this.count); - this.destination.complete(); - }; - return CountSubscriber; -}(Subscriber_1.Subscriber)); -//# sourceMappingURL=count.js.map + //CSS3 Selectors + _expression: function(){ + /* + * expression + * : [ [ PLUS | '-' | DIMENSION | NUMBER | STRING | IDENT ] S* ]+ + * ; + */ + + var tokenStream = this._tokenStream, + value = ""; + + while(tokenStream.match([Tokens.PLUS, Tokens.MINUS, Tokens.DIMENSION, + Tokens.NUMBER, Tokens.STRING, Tokens.IDENT, Tokens.LENGTH, + Tokens.FREQ, Tokens.ANGLE, Tokens.TIME, + Tokens.RESOLUTION, Tokens.SLASH])){ + + value += tokenStream.token().value; + value += this._readWhitespace(); + } + + return value.length ? value : null; + + }, + + //CSS3 Selectors + _negation: function(){ + /* + * negation + * : NOT S* negation_arg S* ')' + * ; + */ + + var tokenStream = this._tokenStream, + line, + col, + value = "", + arg, + subpart = null; + + if (tokenStream.match(Tokens.NOT)){ + value = tokenStream.token().value; + line = tokenStream.token().startLine; + col = tokenStream.token().startCol; + value += this._readWhitespace(); + arg = this._negation_arg(); + value += arg; + value += this._readWhitespace(); + tokenStream.match(Tokens.RPAREN); + value += tokenStream.token().value; + + subpart = new SelectorSubPart(value, "not", line, col); + subpart.args.push(arg); + } + + return subpart; + }, + + //CSS3 Selectors + _negation_arg: function(){ + /* + * negation_arg + * : type_selector | universal | HASH | class | attrib | pseudo + * ; + */ + + var tokenStream = this._tokenStream, + args = [ + this._type_selector, + this._universal, + function(){ + return tokenStream.match(Tokens.HASH) ? + new SelectorSubPart(tokenStream.token().value, "id", tokenStream.token().startLine, tokenStream.token().startCol) : + null; + }, + this._class, + this._attrib, + this._pseudo + ], + arg = null, + i = 0, + len = args.length, + line, + col, + part; + + line = tokenStream.LT(1).startLine; + col = tokenStream.LT(1).startCol; + + while(i < len && arg === null){ + + arg = args[i].call(this); + i++; + } + + //must be a negation arg + if (arg === null){ + this._unexpectedToken(tokenStream.LT(1)); + } + + //it's an element name + if (arg.type === "elementName"){ + part = new SelectorPart(arg, [], arg.toString(), line, col); + } else { + part = new SelectorPart(null, [arg], arg.toString(), line, col); + } + + return part; + }, + + _declaration: function(){ + + /* + * declaration + * : property ':' S* expr prio? + * | /( empty )/ + * ; + */ + + var tokenStream = this._tokenStream, + property = null, + expr = null, + prio = null, + invalid = null, + propertyName= ""; + + property = this._property(); + if (property !== null){ -/***/ }), -/* 291 */ -/***/ (function(module, exports, __webpack_require__) { + tokenStream.mustMatch(Tokens.COLON); + this._readWhitespace(); -"use strict"; + expr = this._expr(); -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; -var OuterSubscriber_1 = __webpack_require__(4); -var subscribeToResult_1 = __webpack_require__(3); -/** - * Emits a value from the source Observable only after a particular time span - * determined by another Observable has passed without another source emission. - * - * It's like {@link debounceTime}, but the time span of - * emission silence is determined by a second Observable. - * - * - * - * `debounce` delays values emitted by the source Observable, but drops previous - * pending delayed emissions if a new value arrives on the source Observable. - * This operator keeps track of the most recent value from the source - * Observable, and spawns a duration Observable by calling the - * `durationSelector` function. The value is emitted only when the duration - * Observable emits a value or completes, and if no other value was emitted on - * the source Observable since the duration Observable was spawned. If a new - * value appears before the duration Observable emits, the previous value will - * be dropped and will not be emitted on the output Observable. - * - * Like {@link debounceTime}, this is a rate-limiting operator, and also a - * delay-like operator since output emissions do not necessarily occur at the - * same time as they did on the source Observable. - * - * @example Emit the most recent click after a burst of clicks - * var clicks = Rx.Observable.fromEvent(document, 'click'); - * var result = clicks.debounce(() => Rx.Observable.interval(1000)); - * result.subscribe(x => console.log(x)); - * - * @see {@link audit} - * @see {@link debounceTime} - * @see {@link delayWhen} - * @see {@link throttle} - * - * @param {function(value: T): SubscribableOrPromise} durationSelector A function - * that receives a value from the source Observable, for computing the timeout - * duration for each source value, returned as an Observable or a Promise. - * @return {Observable} An Observable that delays the emissions of the source - * Observable by the specified duration Observable returned by - * `durationSelector`, and may drop some values if they occur too frequently. - * @method debounce - * @owner Observable - */ -function debounce(durationSelector) { - return this.lift(new DebounceOperator(durationSelector)); -} -exports.debounce = debounce; -var DebounceOperator = (function () { - function DebounceOperator(durationSelector) { - this.durationSelector = durationSelector; - } - DebounceOperator.prototype.call = function (subscriber, source) { - return source.subscribe(new DebounceSubscriber(subscriber, this.durationSelector)); - }; - return DebounceOperator; -}()); -/** - * We need this JSDoc comment for affecting ESDoc. - * @ignore - * @extends {Ignored} - */ -var DebounceSubscriber = (function (_super) { - __extends(DebounceSubscriber, _super); - function DebounceSubscriber(destination, durationSelector) { - _super.call(this, destination); - this.durationSelector = durationSelector; - this.hasValue = false; - this.durationSubscription = null; - } - DebounceSubscriber.prototype._next = function (value) { - try { - var result = this.durationSelector.call(this, value); - if (result) { - this._tryNext(value, result); - } - } - catch (err) { - this.destination.error(err); - } - }; - DebounceSubscriber.prototype._complete = function () { - this.emitValue(); - this.destination.complete(); - }; - DebounceSubscriber.prototype._tryNext = function (value, duration) { - var subscription = this.durationSubscription; - this.value = value; - this.hasValue = true; - if (subscription) { - subscription.unsubscribe(); - this.remove(subscription); - } - subscription = subscribeToResult_1.subscribeToResult(this, duration); - if (!subscription.closed) { - this.add(this.durationSubscription = subscription); - } - }; - DebounceSubscriber.prototype.notifyNext = function (outerValue, innerValue, outerIndex, innerIndex, innerSub) { - this.emitValue(); - }; - DebounceSubscriber.prototype.notifyComplete = function () { - this.emitValue(); - }; - DebounceSubscriber.prototype.emitValue = function () { - if (this.hasValue) { - var value = this.value; - var subscription = this.durationSubscription; - if (subscription) { - this.durationSubscription = null; - subscription.unsubscribe(); - this.remove(subscription); - } - this.value = null; - this.hasValue = false; - _super.prototype._next.call(this, value); - } - }; - return DebounceSubscriber; -}(OuterSubscriber_1.OuterSubscriber)); -//# sourceMappingURL=debounce.js.map + //if there's no parts for the value, it's an error + if (!expr || expr.length === 0){ + this._unexpectedToken(tokenStream.LT(1)); + } -/***/ }), -/* 292 */ -/***/ (function(module, exports, __webpack_require__) { + prio = this._prio(); -"use strict"; + /* + * If hacks should be allowed, then only check the root + * property. If hacks should not be allowed, treat + * _property or *property as invalid properties. + */ + propertyName = property.toString(); + if (this.options.starHack && property.hack === "*" || + this.options.underscoreHack && property.hack === "_") { -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; -var Subscriber_1 = __webpack_require__(2); -var async_1 = __webpack_require__(8); -/** - * Emits a value from the source Observable only after a particular time span - * has passed without another source emission. - * - * It's like {@link delay}, but passes only the most - * recent value from each burst of emissions. - * - * - * - * `debounceTime` delays values emitted by the source Observable, but drops - * previous pending delayed emissions if a new value arrives on the source - * Observable. This operator keeps track of the most recent value from the - * source Observable, and emits that only when `dueTime` enough time has passed - * without any other value appearing on the source Observable. If a new value - * appears before `dueTime` silence occurs, the previous value will be dropped - * and will not be emitted on the output Observable. - * - * This is a rate-limiting operator, because it is impossible for more than one - * value to be emitted in any time window of duration `dueTime`, but it is also - * a delay-like operator since output emissions do not occur at the same time as - * they did on the source Observable. Optionally takes a {@link IScheduler} for - * managing timers. - * - * @example Emit the most recent click after a burst of clicks - * var clicks = Rx.Observable.fromEvent(document, 'click'); - * var result = clicks.debounceTime(1000); - * result.subscribe(x => console.log(x)); - * - * @see {@link auditTime} - * @see {@link debounce} - * @see {@link delay} - * @see {@link sampleTime} - * @see {@link throttleTime} - * - * @param {number} dueTime The timeout duration in milliseconds (or the time - * unit determined internally by the optional `scheduler`) for the window of - * time required to wait for emission silence before emitting the most recent - * source value. - * @param {Scheduler} [scheduler=async] The {@link IScheduler} to use for - * managing the timers that handle the timeout for each value. - * @return {Observable} An Observable that delays the emissions of the source - * Observable by the specified `dueTime`, and may drop some values if they occur - * too frequently. - * @method debounceTime - * @owner Observable - */ -function debounceTime(dueTime, scheduler) { - if (scheduler === void 0) { scheduler = async_1.async; } - return this.lift(new DebounceTimeOperator(dueTime, scheduler)); -} -exports.debounceTime = debounceTime; -var DebounceTimeOperator = (function () { - function DebounceTimeOperator(dueTime, scheduler) { - this.dueTime = dueTime; - this.scheduler = scheduler; - } - DebounceTimeOperator.prototype.call = function (subscriber, source) { - return source.subscribe(new DebounceTimeSubscriber(subscriber, this.dueTime, this.scheduler)); - }; - return DebounceTimeOperator; -}()); -/** - * We need this JSDoc comment for affecting ESDoc. - * @ignore - * @extends {Ignored} - */ -var DebounceTimeSubscriber = (function (_super) { - __extends(DebounceTimeSubscriber, _super); - function DebounceTimeSubscriber(destination, dueTime, scheduler) { - _super.call(this, destination); - this.dueTime = dueTime; - this.scheduler = scheduler; - this.debouncedSubscription = null; - this.lastValue = null; - this.hasValue = false; - } - DebounceTimeSubscriber.prototype._next = function (value) { - this.clearDebounce(); - this.lastValue = value; - this.hasValue = true; - this.add(this.debouncedSubscription = this.scheduler.schedule(dispatchNext, this.dueTime, this)); - }; - DebounceTimeSubscriber.prototype._complete = function () { - this.debouncedNext(); - this.destination.complete(); - }; - DebounceTimeSubscriber.prototype.debouncedNext = function () { - this.clearDebounce(); - if (this.hasValue) { - this.destination.next(this.lastValue); - this.lastValue = null; - this.hasValue = false; - } - }; - DebounceTimeSubscriber.prototype.clearDebounce = function () { - var debouncedSubscription = this.debouncedSubscription; - if (debouncedSubscription !== null) { - this.remove(debouncedSubscription); - debouncedSubscription.unsubscribe(); - this.debouncedSubscription = null; - } - }; - return DebounceTimeSubscriber; -}(Subscriber_1.Subscriber)); -function dispatchNext(subscriber) { - subscriber.debouncedNext(); -} -//# sourceMappingURL=debounceTime.js.map + propertyName = property.text; + } -/***/ }), -/* 293 */ -/***/ (function(module, exports, __webpack_require__) { + try { + this._validateProperty(propertyName, expr); + } catch (ex) { + invalid = ex; + } -"use strict"; + this.fire({ + type: "property", + property: property, + value: expr, + important: prio, + line: property.line, + col: property.col, + invalid: invalid + }); -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; -var Subscriber_1 = __webpack_require__(2); -/* tslint:enable:max-line-length */ -/** - * Emits a given value if the source Observable completes without emitting any - * `next` value, otherwise mirrors the source Observable. - * - * If the source Observable turns out to be empty, then - * this operator will emit a default value. - * - * - * - * `defaultIfEmpty` emits the values emitted by the source Observable or a - * specified default value if the source Observable is empty (completes without - * having emitted any `next` value). - * - * @example If no clicks happen in 5 seconds, then emit "no clicks" - * var clicks = Rx.Observable.fromEvent(document, 'click'); - * var clicksBeforeFive = clicks.takeUntil(Rx.Observable.interval(5000)); - * var result = clicksBeforeFive.defaultIfEmpty('no clicks'); - * result.subscribe(x => console.log(x)); - * - * @see {@link empty} - * @see {@link last} - * - * @param {any} [defaultValue=null] The default value used if the source - * Observable is empty. - * @return {Observable} An Observable that emits either the specified - * `defaultValue` if the source Observable emits no items, or the values emitted - * by the source Observable. - * @method defaultIfEmpty - * @owner Observable - */ -function defaultIfEmpty(defaultValue) { - if (defaultValue === void 0) { defaultValue = null; } - return this.lift(new DefaultIfEmptyOperator(defaultValue)); -} -exports.defaultIfEmpty = defaultIfEmpty; -var DefaultIfEmptyOperator = (function () { - function DefaultIfEmptyOperator(defaultValue) { - this.defaultValue = defaultValue; - } - DefaultIfEmptyOperator.prototype.call = function (subscriber, source) { - return source.subscribe(new DefaultIfEmptySubscriber(subscriber, this.defaultValue)); - }; - return DefaultIfEmptyOperator; -}()); -/** - * We need this JSDoc comment for affecting ESDoc. - * @ignore - * @extends {Ignored} - */ -var DefaultIfEmptySubscriber = (function (_super) { - __extends(DefaultIfEmptySubscriber, _super); - function DefaultIfEmptySubscriber(destination, defaultValue) { - _super.call(this, destination); - this.defaultValue = defaultValue; - this.isEmpty = true; - } - DefaultIfEmptySubscriber.prototype._next = function (value) { - this.isEmpty = false; - this.destination.next(value); - }; - DefaultIfEmptySubscriber.prototype._complete = function () { - if (this.isEmpty) { - this.destination.next(this.defaultValue); - } - this.destination.complete(); - }; - return DefaultIfEmptySubscriber; -}(Subscriber_1.Subscriber)); -//# sourceMappingURL=defaultIfEmpty.js.map + return true; + } else { + return false; + } + }, -/***/ }), -/* 294 */ -/***/ (function(module, exports, __webpack_require__) { + _prio: function(){ + /* + * prio + * : IMPORTANT_SYM S* + * ; + */ -"use strict"; + var tokenStream = this._tokenStream, + result = tokenStream.match(Tokens.IMPORTANT_SYM); -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; -var async_1 = __webpack_require__(8); -var isDate_1 = __webpack_require__(27); -var Subscriber_1 = __webpack_require__(2); -var Notification_1 = __webpack_require__(30); -/** - * Delays the emission of items from the source Observable by a given timeout or - * until a given Date. - * - * Time shifts each item by some specified amount of - * milliseconds. - * - * - * - * If the delay argument is a Number, this operator time shifts the source - * Observable by that amount of time expressed in milliseconds. The relative - * time intervals between the values are preserved. - * - * If the delay argument is a Date, this operator time shifts the start of the - * Observable execution until the given date occurs. - * - * @example Delay each click by one second - * var clicks = Rx.Observable.fromEvent(document, 'click'); - * var delayedClicks = clicks.delay(1000); // each click emitted after 1 second - * delayedClicks.subscribe(x => console.log(x)); - * - * @example Delay all clicks until a future date happens - * var clicks = Rx.Observable.fromEvent(document, 'click'); - * var date = new Date('March 15, 2050 12:00:00'); // in the future - * var delayedClicks = clicks.delay(date); // click emitted only after that date - * delayedClicks.subscribe(x => console.log(x)); - * - * @see {@link debounceTime} - * @see {@link delayWhen} - * - * @param {number|Date} delay The delay duration in milliseconds (a `number`) or - * a `Date` until which the emission of the source items is delayed. - * @param {Scheduler} [scheduler=async] The IScheduler to use for - * managing the timers that handle the time-shift for each item. - * @return {Observable} An Observable that delays the emissions of the source - * Observable by the specified timeout or Date. - * @method delay - * @owner Observable - */ -function delay(delay, scheduler) { - if (scheduler === void 0) { scheduler = async_1.async; } - var absoluteDelay = isDate_1.isDate(delay); - var delayFor = absoluteDelay ? (+delay - scheduler.now()) : Math.abs(delay); - return this.lift(new DelayOperator(delayFor, scheduler)); -} -exports.delay = delay; -var DelayOperator = (function () { - function DelayOperator(delay, scheduler) { - this.delay = delay; - this.scheduler = scheduler; - } - DelayOperator.prototype.call = function (subscriber, source) { - return source.subscribe(new DelaySubscriber(subscriber, this.delay, this.scheduler)); - }; - return DelayOperator; -}()); -/** - * We need this JSDoc comment for affecting ESDoc. - * @ignore - * @extends {Ignored} - */ -var DelaySubscriber = (function (_super) { - __extends(DelaySubscriber, _super); - function DelaySubscriber(destination, delay, scheduler) { - _super.call(this, destination); - this.delay = delay; - this.scheduler = scheduler; - this.queue = []; - this.active = false; - this.errored = false; - } - DelaySubscriber.dispatch = function (state) { - var source = state.source; - var queue = source.queue; - var scheduler = state.scheduler; - var destination = state.destination; - while (queue.length > 0 && (queue[0].time - scheduler.now()) <= 0) { - queue.shift().notification.observe(destination); - } - if (queue.length > 0) { - var delay_1 = Math.max(0, queue[0].time - scheduler.now()); - this.schedule(state, delay_1); - } - else { - source.active = false; - } - }; - DelaySubscriber.prototype._schedule = function (scheduler) { - this.active = true; - this.add(scheduler.schedule(DelaySubscriber.dispatch, this.delay, { - source: this, destination: this.destination, scheduler: scheduler - })); - }; - DelaySubscriber.prototype.scheduleNotification = function (notification) { - if (this.errored === true) { - return; - } - var scheduler = this.scheduler; - var message = new DelayMessage(scheduler.now() + this.delay, notification); - this.queue.push(message); - if (this.active === false) { - this._schedule(scheduler); - } - }; - DelaySubscriber.prototype._next = function (value) { - this.scheduleNotification(Notification_1.Notification.createNext(value)); - }; - DelaySubscriber.prototype._error = function (err) { - this.errored = true; - this.queue = []; - this.destination.error(err); - }; - DelaySubscriber.prototype._complete = function () { - this.scheduleNotification(Notification_1.Notification.createComplete()); - }; - return DelaySubscriber; -}(Subscriber_1.Subscriber)); -var DelayMessage = (function () { - function DelayMessage(time, notification) { - this.time = time; - this.notification = notification; - } - return DelayMessage; -}()); -//# sourceMappingURL=delay.js.map + this._readWhitespace(); + return result; + }, -/***/ }), -/* 295 */ -/***/ (function(module, exports, __webpack_require__) { + _expr: function(inFunction){ + /* + * expr + * : term [ operator term ]* + * ; + */ + + var values = [], + //valueParts = [], + value = null, + operator = null; + + value = this._term(inFunction); + if (value !== null){ + + values.push(value); + + do { + operator = this._operator(inFunction); + + //if there's an operator, keep building up the value parts + if (operator){ + values.push(operator); + } /*else { + //if there's not an operator, you have a full value + values.push(new PropertyValue(valueParts, valueParts[0].line, valueParts[0].col)); + valueParts = []; + }*/ + + value = this._term(inFunction); + + if (value === null){ + break; + } else { + values.push(value); + } + } while(true); + } -"use strict"; + //cleanup + /*if (valueParts.length){ + values.push(new PropertyValue(valueParts, valueParts[0].line, valueParts[0].col)); + }*/ -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; -var Subscriber_1 = __webpack_require__(2); -var Observable_1 = __webpack_require__(0); -var OuterSubscriber_1 = __webpack_require__(4); -var subscribeToResult_1 = __webpack_require__(3); -/** - * Delays the emission of items from the source Observable by a given time span - * determined by the emissions of another Observable. - * - * It's like {@link delay}, but the time span of the - * delay duration is determined by a second Observable. - * - * - * - * `delayWhen` time shifts each emitted value from the source Observable by a - * time span determined by another Observable. When the source emits a value, - * the `delayDurationSelector` function is called with the source value as - * argument, and should return an Observable, called the "duration" Observable. - * The source value is emitted on the output Observable only when the duration - * Observable emits a value or completes. - * - * Optionally, `delayWhen` takes a second argument, `subscriptionDelay`, which - * is an Observable. When `subscriptionDelay` emits its first value or - * completes, the source Observable is subscribed to and starts behaving like - * described in the previous paragraph. If `subscriptionDelay` is not provided, - * `delayWhen` will subscribe to the source Observable as soon as the output - * Observable is subscribed. - * - * @example Delay each click by a random amount of time, between 0 and 5 seconds - * var clicks = Rx.Observable.fromEvent(document, 'click'); - * var delayedClicks = clicks.delayWhen(event => - * Rx.Observable.interval(Math.random() * 5000) - * ); - * delayedClicks.subscribe(x => console.log(x)); - * - * @see {@link debounce} - * @see {@link delay} - * - * @param {function(value: T): Observable} delayDurationSelector A function that - * returns an Observable for each value emitted by the source Observable, which - * is then used to delay the emission of that item on the output Observable - * until the Observable returned from this function emits a value. - * @param {Observable} subscriptionDelay An Observable that triggers the - * subscription to the source Observable once it emits any value. - * @return {Observable} An Observable that delays the emissions of the source - * Observable by an amount of time specified by the Observable returned by - * `delayDurationSelector`. - * @method delayWhen - * @owner Observable - */ -function delayWhen(delayDurationSelector, subscriptionDelay) { - if (subscriptionDelay) { - return new SubscriptionDelayObservable(this, subscriptionDelay) - .lift(new DelayWhenOperator(delayDurationSelector)); - } - return this.lift(new DelayWhenOperator(delayDurationSelector)); -} -exports.delayWhen = delayWhen; -var DelayWhenOperator = (function () { - function DelayWhenOperator(delayDurationSelector) { - this.delayDurationSelector = delayDurationSelector; - } - DelayWhenOperator.prototype.call = function (subscriber, source) { - return source.subscribe(new DelayWhenSubscriber(subscriber, this.delayDurationSelector)); - }; - return DelayWhenOperator; -}()); -/** - * We need this JSDoc comment for affecting ESDoc. - * @ignore - * @extends {Ignored} - */ -var DelayWhenSubscriber = (function (_super) { - __extends(DelayWhenSubscriber, _super); - function DelayWhenSubscriber(destination, delayDurationSelector) { - _super.call(this, destination); - this.delayDurationSelector = delayDurationSelector; - this.completed = false; - this.delayNotifierSubscriptions = []; - this.values = []; - } - DelayWhenSubscriber.prototype.notifyNext = function (outerValue, innerValue, outerIndex, innerIndex, innerSub) { - this.destination.next(outerValue); - this.removeSubscription(innerSub); - this.tryComplete(); - }; - DelayWhenSubscriber.prototype.notifyError = function (error, innerSub) { - this._error(error); - }; - DelayWhenSubscriber.prototype.notifyComplete = function (innerSub) { - var value = this.removeSubscription(innerSub); - if (value) { - this.destination.next(value); - } - this.tryComplete(); - }; - DelayWhenSubscriber.prototype._next = function (value) { - try { - var delayNotifier = this.delayDurationSelector(value); - if (delayNotifier) { - this.tryDelay(delayNotifier, value); - } - } - catch (err) { - this.destination.error(err); - } - }; - DelayWhenSubscriber.prototype._complete = function () { - this.completed = true; - this.tryComplete(); - }; - DelayWhenSubscriber.prototype.removeSubscription = function (subscription) { - subscription.unsubscribe(); - var subscriptionIdx = this.delayNotifierSubscriptions.indexOf(subscription); - var value = null; - if (subscriptionIdx !== -1) { - value = this.values[subscriptionIdx]; - this.delayNotifierSubscriptions.splice(subscriptionIdx, 1); - this.values.splice(subscriptionIdx, 1); - } - return value; - }; - DelayWhenSubscriber.prototype.tryDelay = function (delayNotifier, value) { - var notifierSubscription = subscribeToResult_1.subscribeToResult(this, delayNotifier, value); - if (notifierSubscription && !notifierSubscription.closed) { - this.add(notifierSubscription); - this.delayNotifierSubscriptions.push(notifierSubscription); - } - this.values.push(value); - }; - DelayWhenSubscriber.prototype.tryComplete = function () { - if (this.completed && this.delayNotifierSubscriptions.length === 0) { - this.destination.complete(); - } - }; - return DelayWhenSubscriber; -}(OuterSubscriber_1.OuterSubscriber)); -/** - * We need this JSDoc comment for affecting ESDoc. - * @ignore - * @extends {Ignored} - */ -var SubscriptionDelayObservable = (function (_super) { - __extends(SubscriptionDelayObservable, _super); - function SubscriptionDelayObservable(source, subscriptionDelay) { - _super.call(this); - this.source = source; - this.subscriptionDelay = subscriptionDelay; - } - SubscriptionDelayObservable.prototype._subscribe = function (subscriber) { - this.subscriptionDelay.subscribe(new SubscriptionDelaySubscriber(subscriber, this.source)); - }; - return SubscriptionDelayObservable; -}(Observable_1.Observable)); -/** - * We need this JSDoc comment for affecting ESDoc. - * @ignore - * @extends {Ignored} - */ -var SubscriptionDelaySubscriber = (function (_super) { - __extends(SubscriptionDelaySubscriber, _super); - function SubscriptionDelaySubscriber(parent, source) { - _super.call(this); - this.parent = parent; - this.source = source; - this.sourceSubscribed = false; - } - SubscriptionDelaySubscriber.prototype._next = function (unused) { - this.subscribeToSource(); - }; - SubscriptionDelaySubscriber.prototype._error = function (err) { - this.unsubscribe(); - this.parent.error(err); - }; - SubscriptionDelaySubscriber.prototype._complete = function () { - this.subscribeToSource(); - }; - SubscriptionDelaySubscriber.prototype.subscribeToSource = function () { - if (!this.sourceSubscribed) { - this.sourceSubscribed = true; - this.unsubscribe(); - this.source.subscribe(this.parent); - } - }; - return SubscriptionDelaySubscriber; -}(Subscriber_1.Subscriber)); -//# sourceMappingURL=delayWhen.js.map + return values.length > 0 ? new PropertyValue(values, values[0].line, values[0].col) : null; + }, -/***/ }), -/* 296 */ -/***/ (function(module, exports, __webpack_require__) { + _term: function(inFunction){ + + /* + * term + * : unary_operator? + * [ NUMBER S* | PERCENTAGE S* | LENGTH S* | ANGLE S* | + * TIME S* | FREQ S* | function | ie_function ] + * | STRING S* | IDENT S* | URI S* | UNICODERANGE S* | hexcolor + * ; + */ + + var tokenStream = this._tokenStream, + unary = null, + value = null, + endChar = null, + token, + line, + col; + + //returns the operator or null + unary = this._unary_operator(); + if (unary !== null){ + line = tokenStream.token().startLine; + col = tokenStream.token().startCol; + } -"use strict"; + //exception for IE filters + if (tokenStream.peek() === Tokens.IE_FUNCTION && this.options.ieFilters){ -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; -var Subscriber_1 = __webpack_require__(2); -/** - * Converts an Observable of {@link Notification} objects into the emissions - * that they represent. - * - * Unwraps {@link Notification} objects as actual `next`, - * `error` and `complete` emissions. The opposite of {@link materialize}. - * - * - * - * `dematerialize` is assumed to operate an Observable that only emits - * {@link Notification} objects as `next` emissions, and does not emit any - * `error`. Such Observable is the output of a `materialize` operation. Those - * notifications are then unwrapped using the metadata they contain, and emitted - * as `next`, `error`, and `complete` on the output Observable. - * - * Use this operator in conjunction with {@link materialize}. - * - * @example Convert an Observable of Notifications to an actual Observable - * var notifA = new Rx.Notification('N', 'A'); - * var notifB = new Rx.Notification('N', 'B'); - * var notifE = new Rx.Notification('E', void 0, - * new TypeError('x.toUpperCase is not a function') - * ); - * var materialized = Rx.Observable.of(notifA, notifB, notifE); - * var upperCase = materialized.dematerialize(); - * upperCase.subscribe(x => console.log(x), e => console.error(e)); - * - * // Results in: - * // A - * // B - * // TypeError: x.toUpperCase is not a function - * - * @see {@link Notification} - * @see {@link materialize} - * - * @return {Observable} An Observable that emits items and notifications - * embedded in Notification objects emitted by the source Observable. - * @method dematerialize - * @owner Observable - */ -function dematerialize() { - return this.lift(new DeMaterializeOperator()); -} -exports.dematerialize = dematerialize; -var DeMaterializeOperator = (function () { - function DeMaterializeOperator() { - } - DeMaterializeOperator.prototype.call = function (subscriber, source) { - return source.subscribe(new DeMaterializeSubscriber(subscriber)); - }; - return DeMaterializeOperator; -}()); -/** - * We need this JSDoc comment for affecting ESDoc. - * @ignore - * @extends {Ignored} - */ -var DeMaterializeSubscriber = (function (_super) { - __extends(DeMaterializeSubscriber, _super); - function DeMaterializeSubscriber(destination) { - _super.call(this, destination); - } - DeMaterializeSubscriber.prototype._next = function (value) { - value.observe(this.destination); - }; - return DeMaterializeSubscriber; -}(Subscriber_1.Subscriber)); -//# sourceMappingURL=dematerialize.js.map + value = this._ie_function(); + if (unary === null){ + line = tokenStream.token().startLine; + col = tokenStream.token().startCol; + } -/***/ }), -/* 297 */ -/***/ (function(module, exports, __webpack_require__) { + //see if it's a simple block + } else if (inFunction && tokenStream.match([Tokens.LPAREN, Tokens.LBRACE, Tokens.LBRACKET])){ -"use strict"; + token = tokenStream.token(); + endChar = token.endChar; + value = token.value + this._expr(inFunction).text; + if (unary === null){ + line = tokenStream.token().startLine; + col = tokenStream.token().startCol; + } + tokenStream.mustMatch(Tokens.type(endChar)); + value += endChar; + this._readWhitespace(); + + //see if there's a simple match + } else if (tokenStream.match([Tokens.NUMBER, Tokens.PERCENTAGE, Tokens.LENGTH, + Tokens.ANGLE, Tokens.TIME, + Tokens.FREQ, Tokens.STRING, Tokens.IDENT, Tokens.URI, Tokens.UNICODE_RANGE])){ + + value = tokenStream.token().value; + if (unary === null){ + line = tokenStream.token().startLine; + col = tokenStream.token().startCol; + } + this._readWhitespace(); + } else { -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; -var OuterSubscriber_1 = __webpack_require__(4); -var subscribeToResult_1 = __webpack_require__(3); -var Set_1 = __webpack_require__(372); -/** - * Returns an Observable that emits all items emitted by the source Observable that are distinct by comparison from previous items. - * - * If a keySelector function is provided, then it will project each value from the source observable into a new value that it will - * check for equality with previously projected values. If a keySelector function is not provided, it will use each value from the - * source observable directly with an equality check against previous values. - * - * In JavaScript runtimes that support `Set`, this operator will use a `Set` to improve performance of the distinct value checking. - * - * In other runtimes, this operator will use a minimal implementation of `Set` that relies on an `Array` and `indexOf` under the - * hood, so performance will degrade as more values are checked for distinction. Even in newer browsers, a long-running `distinct` - * use might result in memory leaks. To help alleviate this in some scenarios, an optional `flushes` parameter is also provided so - * that the internal `Set` can be "flushed", basically clearing it of values. - * - * @example A simple example with numbers - * Observable.of(1, 1, 2, 2, 2, 1, 2, 3, 4, 3, 2, 1) - * .distinct() - * .subscribe(x => console.log(x)); // 1, 2, 3, 4 - * - * @example An example using a keySelector function - * interface Person { - * age: number, - * name: string - * } - * - * Observable.of( - * { age: 4, name: 'Foo'}, - * { age: 7, name: 'Bar'}, - * { age: 5, name: 'Foo'}) - * .distinct((p: Person) => p.name) - * .subscribe(x => console.log(x)); - * - * // displays: - * // { age: 4, name: 'Foo' } - * // { age: 7, name: 'Bar' } - * - * @see {@link distinctUntilChanged} - * @see {@link distinctUntilKeyChanged} - * - * @param {function} [keySelector] Optional function to select which value you want to check as distinct. - * @param {Observable} [flushes] Optional Observable for flushing the internal HashSet of the operator. - * @return {Observable} An Observable that emits items from the source Observable with distinct values. - * @method distinct - * @owner Observable - */ -function distinct(keySelector, flushes) { - return this.lift(new DistinctOperator(keySelector, flushes)); -} -exports.distinct = distinct; -var DistinctOperator = (function () { - function DistinctOperator(keySelector, flushes) { - this.keySelector = keySelector; - this.flushes = flushes; - } - DistinctOperator.prototype.call = function (subscriber, source) { - return source.subscribe(new DistinctSubscriber(subscriber, this.keySelector, this.flushes)); - }; - return DistinctOperator; -}()); -/** - * We need this JSDoc comment for affecting ESDoc. - * @ignore - * @extends {Ignored} - */ -var DistinctSubscriber = (function (_super) { - __extends(DistinctSubscriber, _super); - function DistinctSubscriber(destination, keySelector, flushes) { - _super.call(this, destination); - this.keySelector = keySelector; - this.values = new Set_1.Set(); - if (flushes) { - this.add(subscribeToResult_1.subscribeToResult(this, flushes)); - } - } - DistinctSubscriber.prototype.notifyNext = function (outerValue, innerValue, outerIndex, innerIndex, innerSub) { - this.values.clear(); - }; - DistinctSubscriber.prototype.notifyError = function (error, innerSub) { - this._error(error); - }; - DistinctSubscriber.prototype._next = function (value) { - if (this.keySelector) { - this._useKeySelector(value); - } - else { - this._finalizeNext(value, value); - } - }; - DistinctSubscriber.prototype._useKeySelector = function (value) { - var key; - var destination = this.destination; - try { - key = this.keySelector(value); - } - catch (err) { - destination.error(err); - return; - } - this._finalizeNext(key, value); - }; - DistinctSubscriber.prototype._finalizeNext = function (key, value) { - var values = this.values; - if (!values.has(key)) { - values.add(key); - this.destination.next(value); - } - }; - return DistinctSubscriber; -}(OuterSubscriber_1.OuterSubscriber)); -exports.DistinctSubscriber = DistinctSubscriber; -//# sourceMappingURL=distinct.js.map + //see if it's a color + token = this._hexcolor(); + if (token === null){ -/***/ }), -/* 298 */ -/***/ (function(module, exports, __webpack_require__) { + //if there's no unary, get the start of the next token for line/col info + if (unary === null){ + line = tokenStream.LT(1).startLine; + col = tokenStream.LT(1).startCol; + } -"use strict"; + //has to be a function + if (value === null){ + + /* + * This checks for alpha(opacity=0) style of IE + * functions. IE_FUNCTION only presents progid: style. + */ + if (tokenStream.LA(3) === Tokens.EQUALS && this.options.ieFilters){ + value = this._ie_function(); + } else { + value = this._function(); + } + } -var distinctUntilChanged_1 = __webpack_require__(60); -/* tslint:enable:max-line-length */ -/** - * Returns an Observable that emits all items emitted by the source Observable that are distinct by comparison from the previous item, - * using a property accessed by using the key provided to check if the two items are distinct. - * - * If a comparator function is provided, then it will be called for each item to test for whether or not that value should be emitted. - * - * If a comparator function is not provided, an equality check is used by default. - * - * @example An example comparing the name of persons - * - * interface Person { - * age: number, - * name: string - * } - * - * Observable.of( - * { age: 4, name: 'Foo'}, - * { age: 7, name: 'Bar'}, - * { age: 5, name: 'Foo'}, - * { age: 6, name: 'Foo'}) - * .distinctUntilKeyChanged('name') - * .subscribe(x => console.log(x)); - * - * // displays: - * // { age: 4, name: 'Foo' } - * // { age: 7, name: 'Bar' } - * // { age: 5, name: 'Foo' } - * - * @example An example comparing the first letters of the name - * - * interface Person { - * age: number, - * name: string - * } - * - * Observable.of( - * { age: 4, name: 'Foo1'}, - * { age: 7, name: 'Bar'}, - * { age: 5, name: 'Foo2'}, - * { age: 6, name: 'Foo3'}) - * .distinctUntilKeyChanged('name', (x: string, y: string) => x.substring(0, 3) === y.substring(0, 3)) - * .subscribe(x => console.log(x)); - * - * // displays: - * // { age: 4, name: 'Foo1' } - * // { age: 7, name: 'Bar' } - * // { age: 5, name: 'Foo2' } - * - * @see {@link distinct} - * @see {@link distinctUntilChanged} - * - * @param {string} key String key for object property lookup on each item. - * @param {function} [compare] Optional comparison function called to test if an item is distinct from the previous item in the source. - * @return {Observable} An Observable that emits items from the source Observable with distinct values based on the key specified. - * @method distinctUntilKeyChanged - * @owner Observable - */ -function distinctUntilKeyChanged(key, compare) { - return distinctUntilChanged_1.distinctUntilChanged.call(this, function (x, y) { - if (compare) { - return compare(x[key], y[key]); - } - return x[key] === y[key]; - }); -} -exports.distinctUntilKeyChanged = distinctUntilKeyChanged; -//# sourceMappingURL=distinctUntilKeyChanged.js.map + /*if (value === null){ + return null; + //throw new Error("Expected identifier at line " + tokenStream.token().startLine + ", character " + tokenStream.token().startCol + "."); + }*/ -/***/ }), -/* 299 */ -/***/ (function(module, exports, __webpack_require__) { + } else { + value = token.value; + if (unary === null){ + line = token.startLine; + col = token.startCol; + } + } -"use strict"; + } -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; -var Subscriber_1 = __webpack_require__(2); -/* tslint:enable:max-line-length */ -/** - * Perform a side effect for every emission on the source Observable, but return - * an Observable that is identical to the source. - * - * Intercepts each emission on the source and runs a - * function, but returns an output which is identical to the source as long as errors don't occur. - * - * - * - * Returns a mirrored Observable of the source Observable, but modified so that - * the provided Observer is called to perform a side effect for every value, - * error, and completion emitted by the source. Any errors that are thrown in - * the aforementioned Observer or handlers are safely sent down the error path - * of the output Observable. - * - * This operator is useful for debugging your Observables for the correct values - * or performing other side effects. - * - * Note: this is different to a `subscribe` on the Observable. If the Observable - * returned by `do` is not subscribed, the side effects specified by the - * Observer will never happen. `do` therefore simply spies on existing - * execution, it does not trigger an execution to happen like `subscribe` does. - * - * @example Map every click to the clientX position of that click, while also logging the click event - * var clicks = Rx.Observable.fromEvent(document, 'click'); - * var positions = clicks - * .do(ev => console.log(ev)) - * .map(ev => ev.clientX); - * positions.subscribe(x => console.log(x)); - * - * @see {@link map} - * @see {@link subscribe} - * - * @param {Observer|function} [nextOrObserver] A normal Observer object or a - * callback for `next`. - * @param {function} [error] Callback for errors in the source. - * @param {function} [complete] Callback for the completion of the source. - * @return {Observable} An Observable identical to the source, but runs the - * specified Observer or callback(s) for each item. - * @method do - * @name do - * @owner Observable - */ -function _do(nextOrObserver, error, complete) { - return this.lift(new DoOperator(nextOrObserver, error, complete)); -} -exports._do = _do; -var DoOperator = (function () { - function DoOperator(nextOrObserver, error, complete) { - this.nextOrObserver = nextOrObserver; - this.error = error; - this.complete = complete; - } - DoOperator.prototype.call = function (subscriber, source) { - return source.subscribe(new DoSubscriber(subscriber, this.nextOrObserver, this.error, this.complete)); - }; - return DoOperator; -}()); -/** - * We need this JSDoc comment for affecting ESDoc. - * @ignore - * @extends {Ignored} - */ -var DoSubscriber = (function (_super) { - __extends(DoSubscriber, _super); - function DoSubscriber(destination, nextOrObserver, error, complete) { - _super.call(this, destination); - var safeSubscriber = new Subscriber_1.Subscriber(nextOrObserver, error, complete); - safeSubscriber.syncErrorThrowable = true; - this.add(safeSubscriber); - this.safeSubscriber = safeSubscriber; - } - DoSubscriber.prototype._next = function (value) { - var safeSubscriber = this.safeSubscriber; - safeSubscriber.next(value); - if (safeSubscriber.syncErrorThrown) { - this.destination.error(safeSubscriber.syncErrorValue); - } - else { - this.destination.next(value); - } - }; - DoSubscriber.prototype._error = function (err) { - var safeSubscriber = this.safeSubscriber; - safeSubscriber.error(err); - if (safeSubscriber.syncErrorThrown) { - this.destination.error(safeSubscriber.syncErrorValue); - } - else { - this.destination.error(err); - } - }; - DoSubscriber.prototype._complete = function () { - var safeSubscriber = this.safeSubscriber; - safeSubscriber.complete(); - if (safeSubscriber.syncErrorThrown) { - this.destination.error(safeSubscriber.syncErrorValue); - } - else { - this.destination.complete(); - } - }; - return DoSubscriber; -}(Subscriber_1.Subscriber)); -//# sourceMappingURL=do.js.map + return value !== null ? + new PropertyValuePart(unary !== null ? unary + value : value, line, col) : + null; -/***/ }), -/* 300 */ -/***/ (function(module, exports, __webpack_require__) { + }, -"use strict"; + _function: function(){ + + /* + * function + * : FUNCTION S* expr ')' S* + * ; + */ + + var tokenStream = this._tokenStream, + functionText = null, + expr = null, + lt; + + if (tokenStream.match(Tokens.FUNCTION)){ + functionText = tokenStream.token().value; + this._readWhitespace(); + expr = this._expr(true); + functionText += expr; + + //START: Horrible hack in case it's an IE filter + if (this.options.ieFilters && tokenStream.peek() === Tokens.EQUALS){ + do { + + if (this._readWhitespace()){ + functionText += tokenStream.token().value; + } + + //might be second time in the loop + if (tokenStream.LA(0) === Tokens.COMMA){ + functionText += tokenStream.token().value; + } + + tokenStream.match(Tokens.IDENT); + functionText += tokenStream.token().value; + + tokenStream.match(Tokens.EQUALS); + functionText += tokenStream.token().value; + + //functionText += this._term(); + lt = tokenStream.peek(); + while(lt !== Tokens.COMMA && lt !== Tokens.S && lt !== Tokens.RPAREN){ + tokenStream.get(); + functionText += tokenStream.token().value; + lt = tokenStream.peek(); + } + } while(tokenStream.match([Tokens.COMMA, Tokens.S])); + } -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; -var Subscriber_1 = __webpack_require__(2); -var ArgumentOutOfRangeError_1 = __webpack_require__(22); -/** - * Emits the single value at the specified `index` in a sequence of emissions - * from the source Observable. - * - * Emits only the i-th value, then completes. - * - * - * - * `elementAt` returns an Observable that emits the item at the specified - * `index` in the source Observable, or a default value if that `index` is out - * of range and the `default` argument is provided. If the `default` argument is - * not given and the `index` is out of range, the output Observable will emit an - * `ArgumentOutOfRangeError` error. - * - * @example Emit only the third click event - * var clicks = Rx.Observable.fromEvent(document, 'click'); - * var result = clicks.elementAt(2); - * result.subscribe(x => console.log(x)); - * - * // Results in: - * // click 1 = nothing - * // click 2 = nothing - * // click 3 = MouseEvent object logged to console - * - * @see {@link first} - * @see {@link last} - * @see {@link skip} - * @see {@link single} - * @see {@link take} - * - * @throws {ArgumentOutOfRangeError} When using `elementAt(i)`, it delivers an - * ArgumentOutOrRangeError to the Observer's `error` callback if `i < 0` or the - * Observable has completed before emitting the i-th `next` notification. - * - * @param {number} index Is the number `i` for the i-th source emission that has - * happened since the subscription, starting from the number `0`. - * @param {T} [defaultValue] The default value returned for missing indices. - * @return {Observable} An Observable that emits a single item, if it is found. - * Otherwise, will emit the default value if given. If not, then emits an error. - * @method elementAt - * @owner Observable - */ -function elementAt(index, defaultValue) { - return this.lift(new ElementAtOperator(index, defaultValue)); -} -exports.elementAt = elementAt; -var ElementAtOperator = (function () { - function ElementAtOperator(index, defaultValue) { - this.index = index; - this.defaultValue = defaultValue; - if (index < 0) { - throw new ArgumentOutOfRangeError_1.ArgumentOutOfRangeError; - } - } - ElementAtOperator.prototype.call = function (subscriber, source) { - return source.subscribe(new ElementAtSubscriber(subscriber, this.index, this.defaultValue)); - }; - return ElementAtOperator; -}()); -/** - * We need this JSDoc comment for affecting ESDoc. - * @ignore - * @extends {Ignored} - */ -var ElementAtSubscriber = (function (_super) { - __extends(ElementAtSubscriber, _super); - function ElementAtSubscriber(destination, index, defaultValue) { - _super.call(this, destination); - this.index = index; - this.defaultValue = defaultValue; - } - ElementAtSubscriber.prototype._next = function (x) { - if (this.index-- === 0) { - this.destination.next(x); - this.destination.complete(); - } - }; - ElementAtSubscriber.prototype._complete = function () { - var destination = this.destination; - if (this.index >= 0) { - if (typeof this.defaultValue !== 'undefined') { - destination.next(this.defaultValue); - } - else { - destination.error(new ArgumentOutOfRangeError_1.ArgumentOutOfRangeError); - } - } - destination.complete(); - }; - return ElementAtSubscriber; -}(Subscriber_1.Subscriber)); -//# sourceMappingURL=elementAt.js.map + //END: Horrible Hack + + tokenStream.match(Tokens.RPAREN); + functionText += ")"; + this._readWhitespace(); + } + + return functionText; + }, + + _ie_function: function(){ + + /* (My own extension) + * ie_function + * : IE_FUNCTION S* IDENT '=' term [S* ','? IDENT '=' term]+ ')' S* + * ; + */ + + var tokenStream = this._tokenStream, + functionText = null, + lt; + + //IE function can begin like a regular function, too + if (tokenStream.match([Tokens.IE_FUNCTION, Tokens.FUNCTION])){ + functionText = tokenStream.token().value; + + do { + + if (this._readWhitespace()){ + functionText += tokenStream.token().value; + } + + //might be second time in the loop + if (tokenStream.LA(0) === Tokens.COMMA){ + functionText += tokenStream.token().value; + } + + tokenStream.match(Tokens.IDENT); + functionText += tokenStream.token().value; + + tokenStream.match(Tokens.EQUALS); + functionText += tokenStream.token().value; + + //functionText += this._term(); + lt = tokenStream.peek(); + while(lt !== Tokens.COMMA && lt !== Tokens.S && lt !== Tokens.RPAREN){ + tokenStream.get(); + functionText += tokenStream.token().value; + lt = tokenStream.peek(); + } + } while(tokenStream.match([Tokens.COMMA, Tokens.S])); + + tokenStream.match(Tokens.RPAREN); + functionText += ")"; + this._readWhitespace(); + } + + return functionText; + }, + + _hexcolor: function(){ + /* + * There is a constraint on the color that it must + * have either 3 or 6 hex-digits (i.e., [0-9a-fA-F]) + * after the "#"; e.g., "#000" is OK, but "#abcd" is not. + * + * hexcolor + * : HASH S* + * ; + */ + + var tokenStream = this._tokenStream, + token = null, + color; + + if(tokenStream.match(Tokens.HASH)){ + + //need to do some validation here + + token = tokenStream.token(); + color = token.value; + if (!/#[a-f0-9]{3,6}/i.test(color)){ + throw new SyntaxError("Expected a hex color but found '" + color + "' at line " + token.startLine + ", col " + token.startCol + ".", token.startLine, token.startCol); + } + this._readWhitespace(); + } + + return token; + }, + + //----------------------------------------------------------------- + // Animations methods + //----------------------------------------------------------------- + + _keyframes: function(){ + + /* + * keyframes: + * : KEYFRAMES_SYM S* keyframe_name S* '{' S* keyframe_rule* '}' { + * ; + */ + var tokenStream = this._tokenStream, + token, + tt, + name, + prefix = ""; + + tokenStream.mustMatch(Tokens.KEYFRAMES_SYM); + token = tokenStream.token(); + if (/^@\-([^\-]+)\-/.test(token.value)) { + prefix = RegExp.$1; + } + + this._readWhitespace(); + name = this._keyframe_name(); + + this._readWhitespace(); + tokenStream.mustMatch(Tokens.LBRACE); + + this.fire({ + type: "startkeyframes", + name: name, + prefix: prefix, + line: token.startLine, + col: token.startCol + }); + + this._readWhitespace(); + tt = tokenStream.peek(); + + //check for key + while(tt === Tokens.IDENT || tt === Tokens.PERCENTAGE) { + this._keyframe_rule(); + this._readWhitespace(); + tt = tokenStream.peek(); + } + + this.fire({ + type: "endkeyframes", + name: name, + prefix: prefix, + line: token.startLine, + col: token.startCol + }); + + this._readWhitespace(); + tokenStream.mustMatch(Tokens.RBRACE); + + }, + + _keyframe_name: function(){ + + /* + * keyframe_name: + * : IDENT + * | STRING + * ; + */ + var tokenStream = this._tokenStream; + + tokenStream.mustMatch([Tokens.IDENT, Tokens.STRING]); + return SyntaxUnit.fromToken(tokenStream.token()); + }, + + _keyframe_rule: function(){ + + /* + * keyframe_rule: + * : key_list S* + * '{' S* declaration [ ';' S* declaration ]* '}' S* + * ; + */ + var keyList = this._key_list(); + + this.fire({ + type: "startkeyframerule", + keys: keyList, + line: keyList[0].line, + col: keyList[0].col + }); + + this._readDeclarations(true); + + this.fire({ + type: "endkeyframerule", + keys: keyList, + line: keyList[0].line, + col: keyList[0].col + }); + + }, + + _key_list: function(){ + + /* + * key_list: + * : key [ S* ',' S* key]* + * ; + */ + var tokenStream = this._tokenStream, + keyList = []; + + //must be least one key + keyList.push(this._key()); + + this._readWhitespace(); + + while(tokenStream.match(Tokens.COMMA)){ + this._readWhitespace(); + keyList.push(this._key()); + this._readWhitespace(); + } -/***/ }), -/* 301 */ -/***/ (function(module, exports, __webpack_require__) { + return keyList; + }, -"use strict"; + _key: function(){ + /* + * There is a restriction that IDENT can be only "from" or "to". + * + * key + * : PERCENTAGE + * | IDENT + * ; + */ + + var tokenStream = this._tokenStream, + token; + + if (tokenStream.match(Tokens.PERCENTAGE)){ + return SyntaxUnit.fromToken(tokenStream.token()); + } else if (tokenStream.match(Tokens.IDENT)){ + token = tokenStream.token(); + + if (/from|to/i.test(token.value)){ + return SyntaxUnit.fromToken(token); + } -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; -var OuterSubscriber_1 = __webpack_require__(4); -var subscribeToResult_1 = __webpack_require__(3); -/** - * Converts a higher-order Observable into a first-order Observable by dropping - * inner Observables while the previous inner Observable has not yet completed. - * - * Flattens an Observable-of-Observables by dropping the - * next inner Observables while the current inner is still executing. - * - * - * - * `exhaust` subscribes to an Observable that emits Observables, also known as a - * higher-order Observable. Each time it observes one of these emitted inner - * Observables, the output Observable begins emitting the items emitted by that - * inner Observable. So far, it behaves like {@link mergeAll}. However, - * `exhaust` ignores every new inner Observable if the previous Observable has - * not yet completed. Once that one completes, it will accept and flatten the - * next inner Observable and repeat this process. - * - * @example Run a finite timer for each click, only if there is no currently active timer - * var clicks = Rx.Observable.fromEvent(document, 'click'); - * var higherOrder = clicks.map((ev) => Rx.Observable.interval(1000).take(5)); - * var result = higherOrder.exhaust(); - * result.subscribe(x => console.log(x)); - * - * @see {@link combineAll} - * @see {@link concatAll} - * @see {@link switch} - * @see {@link mergeAll} - * @see {@link exhaustMap} - * @see {@link zipAll} - * - * @return {Observable} An Observable that takes a source of Observables and propagates the first observable - * exclusively until it completes before subscribing to the next. - * @method exhaust - * @owner Observable - */ -function exhaust() { - return this.lift(new SwitchFirstOperator()); -} -exports.exhaust = exhaust; -var SwitchFirstOperator = (function () { - function SwitchFirstOperator() { - } - SwitchFirstOperator.prototype.call = function (subscriber, source) { - return source.subscribe(new SwitchFirstSubscriber(subscriber)); - }; - return SwitchFirstOperator; -}()); -/** - * We need this JSDoc comment for affecting ESDoc. - * @ignore - * @extends {Ignored} - */ -var SwitchFirstSubscriber = (function (_super) { - __extends(SwitchFirstSubscriber, _super); - function SwitchFirstSubscriber(destination) { - _super.call(this, destination); - this.hasCompleted = false; - this.hasSubscription = false; - } - SwitchFirstSubscriber.prototype._next = function (value) { - if (!this.hasSubscription) { - this.hasSubscription = true; - this.add(subscribeToResult_1.subscribeToResult(this, value)); - } - }; - SwitchFirstSubscriber.prototype._complete = function () { - this.hasCompleted = true; - if (!this.hasSubscription) { - this.destination.complete(); - } - }; - SwitchFirstSubscriber.prototype.notifyComplete = function (innerSub) { - this.remove(innerSub); - this.hasSubscription = false; - if (this.hasCompleted) { - this.destination.complete(); - } - }; - return SwitchFirstSubscriber; -}(OuterSubscriber_1.OuterSubscriber)); -//# sourceMappingURL=exhaust.js.map + tokenStream.unget(); + } -/***/ }), -/* 302 */ -/***/ (function(module, exports, __webpack_require__) { + //if it gets here, there wasn't a valid token, so time to explode + this._unexpectedToken(tokenStream.LT(1)); + }, -"use strict"; + //----------------------------------------------------------------- + // Helper methods + //----------------------------------------------------------------- -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; -var OuterSubscriber_1 = __webpack_require__(4); -var subscribeToResult_1 = __webpack_require__(3); -/* tslint:enable:max-line-length */ -/** - * Projects each source value to an Observable which is merged in the output - * Observable only if the previous projected Observable has completed. - * - * Maps each value to an Observable, then flattens all of - * these inner Observables using {@link exhaust}. - * - * - * - * Returns an Observable that emits items based on applying a function that you - * supply to each item emitted by the source Observable, where that function - * returns an (so-called "inner") Observable. When it projects a source value to - * an Observable, the output Observable begins emitting the items emitted by - * that projected Observable. However, `exhaustMap` ignores every new projected - * Observable if the previous projected Observable has not yet completed. Once - * that one completes, it will accept and flatten the next projected Observable - * and repeat this process. - * - * @example Run a finite timer for each click, only if there is no currently active timer - * var clicks = Rx.Observable.fromEvent(document, 'click'); - * var result = clicks.exhaustMap((ev) => Rx.Observable.interval(1000).take(5)); - * result.subscribe(x => console.log(x)); - * - * @see {@link concatMap} - * @see {@link exhaust} - * @see {@link mergeMap} - * @see {@link switchMap} - * - * @param {function(value: T, ?index: number): ObservableInput} project A function - * that, when applied to an item emitted by the source Observable, returns an - * Observable. - * @param {function(outerValue: T, innerValue: I, outerIndex: number, innerIndex: number): any} [resultSelector] - * A function to produce the value on the output Observable based on the values - * and the indices of the source (outer) emission and the inner Observable - * emission. The arguments passed to this function are: - * - `outerValue`: the value that came from the source - * - `innerValue`: the value that came from the projected Observable - * - `outerIndex`: the "index" of the value that came from the source - * - `innerIndex`: the "index" of the value from the projected Observable - * @return {Observable} An Observable containing projected Observables - * of each item of the source, ignoring projected Observables that start before - * their preceding Observable has completed. - * @method exhaustMap - * @owner Observable - */ -function exhaustMap(project, resultSelector) { - return this.lift(new SwitchFirstMapOperator(project, resultSelector)); -} -exports.exhaustMap = exhaustMap; -var SwitchFirstMapOperator = (function () { - function SwitchFirstMapOperator(project, resultSelector) { - this.project = project; - this.resultSelector = resultSelector; - } - SwitchFirstMapOperator.prototype.call = function (subscriber, source) { - return source.subscribe(new SwitchFirstMapSubscriber(subscriber, this.project, this.resultSelector)); - }; - return SwitchFirstMapOperator; -}()); -/** - * We need this JSDoc comment for affecting ESDoc. - * @ignore - * @extends {Ignored} - */ -var SwitchFirstMapSubscriber = (function (_super) { - __extends(SwitchFirstMapSubscriber, _super); - function SwitchFirstMapSubscriber(destination, project, resultSelector) { - _super.call(this, destination); - this.project = project; - this.resultSelector = resultSelector; - this.hasSubscription = false; - this.hasCompleted = false; - this.index = 0; - } - SwitchFirstMapSubscriber.prototype._next = function (value) { - if (!this.hasSubscription) { - this.tryNext(value); - } - }; - SwitchFirstMapSubscriber.prototype.tryNext = function (value) { - var index = this.index++; - var destination = this.destination; - try { - var result = this.project(value, index); - this.hasSubscription = true; - this.add(subscribeToResult_1.subscribeToResult(this, result, value, index)); - } - catch (err) { - destination.error(err); - } - }; - SwitchFirstMapSubscriber.prototype._complete = function () { - this.hasCompleted = true; - if (!this.hasSubscription) { - this.destination.complete(); - } - }; - SwitchFirstMapSubscriber.prototype.notifyNext = function (outerValue, innerValue, outerIndex, innerIndex, innerSub) { - var _a = this, resultSelector = _a.resultSelector, destination = _a.destination; - if (resultSelector) { - this.trySelectResult(outerValue, innerValue, outerIndex, innerIndex); - } - else { - destination.next(innerValue); - } - }; - SwitchFirstMapSubscriber.prototype.trySelectResult = function (outerValue, innerValue, outerIndex, innerIndex) { - var _a = this, resultSelector = _a.resultSelector, destination = _a.destination; - try { - var result = resultSelector(outerValue, innerValue, outerIndex, innerIndex); - destination.next(result); - } - catch (err) { - destination.error(err); - } - }; - SwitchFirstMapSubscriber.prototype.notifyError = function (err) { - this.destination.error(err); - }; - SwitchFirstMapSubscriber.prototype.notifyComplete = function (innerSub) { - this.remove(innerSub); - this.hasSubscription = false; - if (this.hasCompleted) { - this.destination.complete(); - } - }; - return SwitchFirstMapSubscriber; -}(OuterSubscriber_1.OuterSubscriber)); -//# sourceMappingURL=exhaustMap.js.map + /** + * Not part of CSS grammar, but useful for skipping over + * combination of white space and HTML-style comments. + * @return {void} + * @method _skipCruft + * @private + */ + _skipCruft: function(){ + while(this._tokenStream.match([Tokens.S, Tokens.CDO, Tokens.CDC])){ + //noop + } + }, -/***/ }), -/* 303 */ -/***/ (function(module, exports, __webpack_require__) { + /** + * Not part of CSS grammar, but this pattern occurs frequently + * in the official CSS grammar. Split out here to eliminate + * duplicate code. + * @param {Boolean} checkStart Indicates if the rule should check + * for the left brace at the beginning. + * @param {Boolean} readMargins Indicates if the rule should check + * for margin patterns. + * @return {void} + * @method _readDeclarations + * @private + */ + _readDeclarations: function(checkStart, readMargins){ + /* + * Reads the pattern + * S* '{' S* declaration [ ';' S* declaration ]* '}' S* + * or + * S* '{' S* [ declaration | margin ]? [ ';' S* [ declaration | margin ]? ]* '}' S* + * Note that this is how it is described in CSS3 Paged Media, but is actually incorrect. + * A semicolon is only necessary following a declaration if there's another declaration + * or margin afterwards. + */ + var tokenStream = this._tokenStream, + tt; + + + this._readWhitespace(); + + if (checkStart){ + tokenStream.mustMatch(Tokens.LBRACE); + } -"use strict"; + this._readWhitespace(); -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; -var tryCatch_1 = __webpack_require__(7); -var errorObject_1 = __webpack_require__(5); -var OuterSubscriber_1 = __webpack_require__(4); -var subscribeToResult_1 = __webpack_require__(3); -/* tslint:enable:max-line-length */ -/** - * Recursively projects each source value to an Observable which is merged in - * the output Observable. - * - * It's similar to {@link mergeMap}, but applies the - * projection function to every source value as well as every output value. - * It's recursive. - * - * - * - * Returns an Observable that emits items based on applying a function that you - * supply to each item emitted by the source Observable, where that function - * returns an Observable, and then merging those resulting Observables and - * emitting the results of this merger. *Expand* will re-emit on the output - * Observable every source value. Then, each output value is given to the - * `project` function which returns an inner Observable to be merged on the - * output Observable. Those output values resulting from the projection are also - * given to the `project` function to produce new output values. This is how - * *expand* behaves recursively. - * - * @example Start emitting the powers of two on every click, at most 10 of them - * var clicks = Rx.Observable.fromEvent(document, 'click'); - * var powersOfTwo = clicks - * .mapTo(1) - * .expand(x => Rx.Observable.of(2 * x).delay(1000)) - * .take(10); - * powersOfTwo.subscribe(x => console.log(x)); - * - * @see {@link mergeMap} - * @see {@link mergeScan} - * - * @param {function(value: T, index: number) => Observable} project A function - * that, when applied to an item emitted by the source or the output Observable, - * returns an Observable. - * @param {number} [concurrent=Number.POSITIVE_INFINITY] Maximum number of input - * Observables being subscribed to concurrently. - * @param {Scheduler} [scheduler=null] The IScheduler to use for subscribing to - * each projected inner Observable. - * @return {Observable} An Observable that emits the source values and also - * result of applying the projection function to each value emitted on the - * output Observable and and merging the results of the Observables obtained - * from this transformation. - * @method expand - * @owner Observable - */ -function expand(project, concurrent, scheduler) { - if (concurrent === void 0) { concurrent = Number.POSITIVE_INFINITY; } - if (scheduler === void 0) { scheduler = undefined; } - concurrent = (concurrent || 0) < 1 ? Number.POSITIVE_INFINITY : concurrent; - return this.lift(new ExpandOperator(project, concurrent, scheduler)); -} -exports.expand = expand; -var ExpandOperator = (function () { - function ExpandOperator(project, concurrent, scheduler) { - this.project = project; - this.concurrent = concurrent; - this.scheduler = scheduler; - } - ExpandOperator.prototype.call = function (subscriber, source) { - return source.subscribe(new ExpandSubscriber(subscriber, this.project, this.concurrent, this.scheduler)); - }; - return ExpandOperator; -}()); -exports.ExpandOperator = ExpandOperator; -/** - * We need this JSDoc comment for affecting ESDoc. - * @ignore - * @extends {Ignored} - */ -var ExpandSubscriber = (function (_super) { - __extends(ExpandSubscriber, _super); - function ExpandSubscriber(destination, project, concurrent, scheduler) { - _super.call(this, destination); - this.project = project; - this.concurrent = concurrent; - this.scheduler = scheduler; - this.index = 0; - this.active = 0; - this.hasCompleted = false; - if (concurrent < Number.POSITIVE_INFINITY) { - this.buffer = []; - } - } - ExpandSubscriber.dispatch = function (arg) { - var subscriber = arg.subscriber, result = arg.result, value = arg.value, index = arg.index; - subscriber.subscribeToProjection(result, value, index); - }; - ExpandSubscriber.prototype._next = function (value) { - var destination = this.destination; - if (destination.closed) { - this._complete(); - return; - } - var index = this.index++; - if (this.active < this.concurrent) { - destination.next(value); - var result = tryCatch_1.tryCatch(this.project)(value, index); - if (result === errorObject_1.errorObject) { - destination.error(errorObject_1.errorObject.e); - } - else if (!this.scheduler) { - this.subscribeToProjection(result, value, index); - } - else { - var state = { subscriber: this, result: result, value: value, index: index }; - this.add(this.scheduler.schedule(ExpandSubscriber.dispatch, 0, state)); - } - } - else { - this.buffer.push(value); - } - }; - ExpandSubscriber.prototype.subscribeToProjection = function (result, value, index) { - this.active++; - this.add(subscribeToResult_1.subscribeToResult(this, result, value, index)); - }; - ExpandSubscriber.prototype._complete = function () { - this.hasCompleted = true; - if (this.hasCompleted && this.active === 0) { - this.destination.complete(); - } - }; - ExpandSubscriber.prototype.notifyNext = function (outerValue, innerValue, outerIndex, innerIndex, innerSub) { - this._next(innerValue); - }; - ExpandSubscriber.prototype.notifyComplete = function (innerSub) { - var buffer = this.buffer; - this.remove(innerSub); - this.active--; - if (buffer && buffer.length > 0) { - this._next(buffer.shift()); - } - if (this.hasCompleted && this.active === 0) { - this.destination.complete(); - } - }; - return ExpandSubscriber; -}(OuterSubscriber_1.OuterSubscriber)); -exports.ExpandSubscriber = ExpandSubscriber; -//# sourceMappingURL=expand.js.map + try { -/***/ }), -/* 304 */ -/***/ (function(module, exports, __webpack_require__) { + while(true){ -"use strict"; + if (tokenStream.match(Tokens.SEMICOLON) || (readMargins && this._margin())){ + //noop + } else if (this._declaration()){ + if (!tokenStream.match(Tokens.SEMICOLON)){ + break; + } + } else { + break; + } -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; -var Subscriber_1 = __webpack_require__(2); -var Subscription_1 = __webpack_require__(9); -/** - * Returns an Observable that mirrors the source Observable, but will call a specified function when - * the source terminates on complete or error. - * @param {function} callback Function to be called when source terminates. - * @return {Observable} An Observable that mirrors the source, but will call the specified function on termination. - * @method finally - * @owner Observable - */ -function _finally(callback) { - return this.lift(new FinallyOperator(callback)); -} -exports._finally = _finally; -var FinallyOperator = (function () { - function FinallyOperator(callback) { - this.callback = callback; - } - FinallyOperator.prototype.call = function (subscriber, source) { - return source.subscribe(new FinallySubscriber(subscriber, this.callback)); - }; - return FinallyOperator; -}()); -/** - * We need this JSDoc comment for affecting ESDoc. - * @ignore - * @extends {Ignored} - */ -var FinallySubscriber = (function (_super) { - __extends(FinallySubscriber, _super); - function FinallySubscriber(destination, callback) { - _super.call(this, destination); - this.add(new Subscription_1.Subscription(callback)); - } - return FinallySubscriber; -}(Subscriber_1.Subscriber)); -//# sourceMappingURL=finally.js.map + //if ((!this._margin() && !this._declaration()) || !tokenStream.match(Tokens.SEMICOLON)){ + // break; + //} + this._readWhitespace(); + } -/***/ }), -/* 305 */ -/***/ (function(module, exports, __webpack_require__) { + tokenStream.mustMatch(Tokens.RBRACE); + this._readWhitespace(); + + } catch (ex) { + if (ex instanceof SyntaxError && !this.options.strict){ + + //fire error event + this.fire({ + type: "error", + error: ex, + message: ex.message, + line: ex.line, + col: ex.col + }); + + //see if there's another declaration + tt = tokenStream.advance([Tokens.SEMICOLON, Tokens.RBRACE]); + if (tt === Tokens.SEMICOLON){ + //if there's a semicolon, then there might be another declaration + this._readDeclarations(false, readMargins); + } else if (tt !== Tokens.RBRACE){ + //if there's a right brace, the rule is finished so don't do anything + //otherwise, rethrow the error because it wasn't handled properly + throw ex; + } -"use strict"; + } else { + //not a syntax error, rethrow it + throw ex; + } + } -var find_1 = __webpack_require__(61); -/** - * Emits only the index of the first value emitted by the source Observable that - * meets some condition. - * - * It's like {@link find}, but emits the index of the - * found value, not the value itself. - * - * - * - * `findIndex` searches for the first item in the source Observable that matches - * the specified condition embodied by the `predicate`, and returns the - * (zero-based) index of the first occurrence in the source. Unlike - * {@link first}, the `predicate` is required in `findIndex`, and does not emit - * an error if a valid value is not found. - * - * @example Emit the index of first click that happens on a DIV element - * var clicks = Rx.Observable.fromEvent(document, 'click'); - * var result = clicks.findIndex(ev => ev.target.tagName === 'DIV'); - * result.subscribe(x => console.log(x)); - * - * @see {@link filter} - * @see {@link find} - * @see {@link first} - * @see {@link take} - * - * @param {function(value: T, index: number, source: Observable): boolean} predicate - * A function called with each item to test for condition matching. - * @param {any} [thisArg] An optional argument to determine the value of `this` - * in the `predicate` function. - * @return {Observable} An Observable of the index of the first item that - * matches the condition. - * @method find - * @owner Observable - */ -function findIndex(predicate, thisArg) { - return this.lift(new find_1.FindValueOperator(predicate, this, true, thisArg)); -} -exports.findIndex = findIndex; -//# sourceMappingURL=findIndex.js.map + }, -/***/ }), -/* 306 */ -/***/ (function(module, exports, __webpack_require__) { + /** + * In some cases, you can end up with two white space tokens in a + * row. Instead of making a change in every function that looks for + * white space, this function is used to match as much white space + * as necessary. + * @method _readWhitespace + * @return {String} The white space if found, empty string if not. + * @private + */ + _readWhitespace: function(){ -"use strict"; + var tokenStream = this._tokenStream, + ws = ""; -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; -var Subscriber_1 = __webpack_require__(2); -var Subscription_1 = __webpack_require__(9); -var Observable_1 = __webpack_require__(0); -var Subject_1 = __webpack_require__(6); -var Map_1 = __webpack_require__(370); -var FastMap_1 = __webpack_require__(368); -/* tslint:enable:max-line-length */ -/** - * Groups the items emitted by an Observable according to a specified criterion, - * and emits these grouped items as `GroupedObservables`, one - * {@link GroupedObservable} per group. - * - * - * - * @example Group objects by id and return as array - * Observable.of({id: 1, name: 'aze1'}, - * {id: 2, name: 'sf2'}, - * {id: 2, name: 'dg2'}, - * {id: 1, name: 'erg1'}, - * {id: 1, name: 'df1'}, - * {id: 2, name: 'sfqfb2'}, - * {id: 3, name: 'qfs3'}, - * {id: 2, name: 'qsgqsfg2'} - * ) - * .groupBy(p => p.id) - * .flatMap( (group$) => group$.reduce((acc, cur) => [...acc, cur], [])) - * .subscribe(p => console.log(p)); - * - * // displays: - * // [ { id: 1, name: 'aze1' }, - * // { id: 1, name: 'erg1' }, - * // { id: 1, name: 'df1' } ] - * // - * // [ { id: 2, name: 'sf2' }, - * // { id: 2, name: 'dg2' }, - * // { id: 2, name: 'sfqfb2' }, - * // { id: 2, name: 'qsgqsfg2' } ] - * // - * // [ { id: 3, name: 'qfs3' } ] - * - * @example Pivot data on the id field - * Observable.of({id: 1, name: 'aze1'}, - * {id: 2, name: 'sf2'}, - * {id: 2, name: 'dg2'}, - * {id: 1, name: 'erg1'}, - * {id: 1, name: 'df1'}, - * {id: 2, name: 'sfqfb2'}, - * {id: 3, name: 'qfs1'}, - * {id: 2, name: 'qsgqsfg2'} - * ) - * .groupBy(p => p.id, p => p.name) - * .flatMap( (group$) => group$.reduce((acc, cur) => [...acc, cur], ["" + group$.key])) - * .map(arr => ({'id': parseInt(arr[0]), 'values': arr.slice(1)})) - * .subscribe(p => console.log(p)); - * - * // displays: - * // { id: 1, values: [ 'aze1', 'erg1', 'df1' ] } - * // { id: 2, values: [ 'sf2', 'dg2', 'sfqfb2', 'qsgqsfg2' ] } - * // { id: 3, values: [ 'qfs1' ] } - * - * @param {function(value: T): K} keySelector A function that extracts the key - * for each item. - * @param {function(value: T): R} [elementSelector] A function that extracts the - * return element for each item. - * @param {function(grouped: GroupedObservable): Observable} [durationSelector] - * A function that returns an Observable to determine how long each group should - * exist. - * @return {Observable>} An Observable that emits - * GroupedObservables, each of which corresponds to a unique key value and each - * of which emits those items from the source Observable that share that key - * value. - * @method groupBy - * @owner Observable - */ -function groupBy(keySelector, elementSelector, durationSelector, subjectSelector) { - return this.lift(new GroupByOperator(keySelector, elementSelector, durationSelector, subjectSelector)); -} -exports.groupBy = groupBy; -var GroupByOperator = (function () { - function GroupByOperator(keySelector, elementSelector, durationSelector, subjectSelector) { - this.keySelector = keySelector; - this.elementSelector = elementSelector; - this.durationSelector = durationSelector; - this.subjectSelector = subjectSelector; - } - GroupByOperator.prototype.call = function (subscriber, source) { - return source.subscribe(new GroupBySubscriber(subscriber, this.keySelector, this.elementSelector, this.durationSelector, this.subjectSelector)); - }; - return GroupByOperator; -}()); -/** - * We need this JSDoc comment for affecting ESDoc. - * @ignore - * @extends {Ignored} - */ -var GroupBySubscriber = (function (_super) { - __extends(GroupBySubscriber, _super); - function GroupBySubscriber(destination, keySelector, elementSelector, durationSelector, subjectSelector) { - _super.call(this, destination); - this.keySelector = keySelector; - this.elementSelector = elementSelector; - this.durationSelector = durationSelector; - this.subjectSelector = subjectSelector; - this.groups = null; - this.attemptedToUnsubscribe = false; - this.count = 0; - } - GroupBySubscriber.prototype._next = function (value) { - var key; - try { - key = this.keySelector(value); - } - catch (err) { - this.error(err); - return; - } - this._group(value, key); - }; - GroupBySubscriber.prototype._group = function (value, key) { - var groups = this.groups; - if (!groups) { - groups = this.groups = typeof key === 'string' ? new FastMap_1.FastMap() : new Map_1.Map(); - } - var group = groups.get(key); - var element; - if (this.elementSelector) { - try { - element = this.elementSelector(value); - } - catch (err) { - this.error(err); + while(tokenStream.match(Tokens.S)){ + ws += tokenStream.token().value; + } + + return ws; + }, + + + /** + * Throws an error when an unexpected token is found. + * @param {Object} token The token that was found. + * @method _unexpectedToken + * @return {void} + * @private + */ + _unexpectedToken: function(token){ + throw new SyntaxError("Unexpected token '" + token.value + "' at line " + token.startLine + ", col " + token.startCol + ".", token.startLine, token.startCol); + }, + + /** + * Helper method used for parsing subparts of a style sheet. + * @return {void} + * @method _verifyEnd + * @private + */ + _verifyEnd: function(){ + if (this._tokenStream.LA(1) !== Tokens.EOF){ + this._unexpectedToken(this._tokenStream.LT(1)); + } + }, + + //----------------------------------------------------------------- + // Validation methods + //----------------------------------------------------------------- + _validateProperty: function(property, value){ + Validation.validate(property, value); + }, + + //----------------------------------------------------------------- + // Parsing methods + //----------------------------------------------------------------- + + parse: function(input){ + this._tokenStream = new TokenStream(input, Tokens); + this._stylesheet(); + }, + + parseStyleSheet: function(input){ + //just passthrough + return this.parse(input); + }, + + parseMediaQuery: function(input){ + this._tokenStream = new TokenStream(input, Tokens); + var result = this._media_query(); + + //if there's anything more, then it's an invalid selector + this._verifyEnd(); + + //otherwise return result + return result; + }, + + /** + * Parses a property value (everything after the semicolon). + * @return {parserlib.css.PropertyValue} The property value. + * @throws parserlib.util.SyntaxError If an unexpected token is found. + * @method parserPropertyValue + */ + parsePropertyValue: function(input){ + + this._tokenStream = new TokenStream(input, Tokens); + this._readWhitespace(); + + var result = this._expr(); + + //okay to have a trailing white space + this._readWhitespace(); + + //if there's anything more, then it's an invalid selector + this._verifyEnd(); + + //otherwise return result + return result; + }, + + /** + * Parses a complete CSS rule, including selectors and + * properties. + * @param {String} input The text to parser. + * @return {Boolean} True if the parse completed successfully, false if not. + * @method parseRule + */ + parseRule: function(input){ + this._tokenStream = new TokenStream(input, Tokens); + + //skip any leading white space + this._readWhitespace(); + + var result = this._ruleset(); + + //skip any trailing white space + this._readWhitespace(); + + //if there's anything more, then it's an invalid selector + this._verifyEnd(); + + //otherwise return result + return result; + }, + + /** + * Parses a single CSS selector (no comma) + * @param {String} input The text to parse as a CSS selector. + * @return {Selector} An object representing the selector. + * @throws parserlib.util.SyntaxError If an unexpected token is found. + * @method parseSelector + */ + parseSelector: function(input){ + + this._tokenStream = new TokenStream(input, Tokens); + + //skip any leading white space + this._readWhitespace(); + + var result = this._selector(); + + //skip any trailing white space + this._readWhitespace(); + + //if there's anything more, then it's an invalid selector + this._verifyEnd(); + + //otherwise return result + return result; + }, + + /** + * Parses an HTML style attribute: a set of CSS declarations + * separated by semicolons. + * @param {String} input The text to parse as a style attribute + * @return {void} + * @method parseStyleAttribute + */ + parseStyleAttribute: function(input){ + input += "}"; // for error recovery in _readDeclarations() + this._tokenStream = new TokenStream(input, Tokens); + this._readDeclarations(); } + }; + + //copy over onto prototype + for (prop in additions){ + if (Object.prototype.hasOwnProperty.call(additions, prop)){ + proto[prop] = additions[prop]; } - else { - element = value; - } - if (!group) { - group = this.subjectSelector ? this.subjectSelector() : new Subject_1.Subject(); - groups.set(key, group); - var groupedObservable = new GroupedObservable(key, group, this); - this.destination.next(groupedObservable); - if (this.durationSelector) { - var duration = void 0; - try { - duration = this.durationSelector(new GroupedObservable(key, group)); - } - catch (err) { - this.error(err); - return; + } + + return proto; +}(); + + +/* +nth + : S* [ ['-'|'+']? INTEGER? {N} [ S* ['-'|'+'] S* INTEGER ]? | + ['-'|'+']? INTEGER | {O}{D}{D} | {E}{V}{E}{N} ] S* + ; +*/ +var Properties = { + __proto__: null, + + //A + "align-items" : "flex-start | flex-end | center | baseline | stretch", + "align-content" : "flex-start | flex-end | center | space-between | space-around | stretch", + "align-self" : "auto | flex-start | flex-end | center | baseline | stretch", + "-webkit-align-items" : "flex-start | flex-end | center | baseline | stretch", + "-webkit-align-content" : "flex-start | flex-end | center | space-between | space-around | stretch", + "-webkit-align-self" : "auto | flex-start | flex-end | center | baseline | stretch", + "alignment-adjust" : "auto | baseline | before-edge | text-before-edge | middle | central | after-edge | text-after-edge | ideographic | alphabetic | hanging | mathematical | | ", + "alignment-baseline" : "baseline | use-script | before-edge | text-before-edge | after-edge | text-after-edge | central | middle | ideographic | alphabetic | hanging | mathematical", + "animation" : 1, + "animation-delay" : { multi: "", comma: true }, + "animation-direction" : { multi: "normal | alternate", comma: true }, + "animation-duration" : { multi: "", comma: true }, + "animation-fill-mode" : { multi: "none | forwards | backwards | both", comma: true }, + "animation-iteration-count" : { multi: " | infinite", comma: true }, + "animation-name" : { multi: "none | ", comma: true }, + "animation-play-state" : { multi: "running | paused", comma: true }, + "animation-timing-function" : 1, + + //vendor prefixed + "-moz-animation-delay" : { multi: "", comma: true }, + "-moz-animation-direction" : { multi: "normal | alternate", comma: true }, + "-moz-animation-duration" : { multi: "", comma: true }, + "-moz-animation-iteration-count" : { multi: " | infinite", comma: true }, + "-moz-animation-name" : { multi: "none | ", comma: true }, + "-moz-animation-play-state" : { multi: "running | paused", comma: true }, + + "-ms-animation-delay" : { multi: "", comma: true }, + "-ms-animation-direction" : { multi: "normal | alternate", comma: true }, + "-ms-animation-duration" : { multi: "", comma: true }, + "-ms-animation-iteration-count" : { multi: " | infinite", comma: true }, + "-ms-animation-name" : { multi: "none | ", comma: true }, + "-ms-animation-play-state" : { multi: "running | paused", comma: true }, + + "-webkit-animation-delay" : { multi: "", comma: true }, + "-webkit-animation-direction" : { multi: "normal | alternate", comma: true }, + "-webkit-animation-duration" : { multi: "", comma: true }, + "-webkit-animation-fill-mode" : { multi: "none | forwards | backwards | both", comma: true }, + "-webkit-animation-iteration-count" : { multi: " | infinite", comma: true }, + "-webkit-animation-name" : { multi: "none | ", comma: true }, + "-webkit-animation-play-state" : { multi: "running | paused", comma: true }, + + "-o-animation-delay" : { multi: "", comma: true }, + "-o-animation-direction" : { multi: "normal | alternate", comma: true }, + "-o-animation-duration" : { multi: "", comma: true }, + "-o-animation-iteration-count" : { multi: " | infinite", comma: true }, + "-o-animation-name" : { multi: "none | ", comma: true }, + "-o-animation-play-state" : { multi: "running | paused", comma: true }, + + "appearance" : "icon | window | desktop | workspace | document | tooltip | dialog | button | push-button | hyperlink | radio | radio-button | checkbox | menu-item | tab | menu | menubar | pull-down-menu | pop-up-menu | list-menu | radio-group | checkbox-group | outline-tree | range | field | combo-box | signature | password | normal | none | inherit", + "azimuth" : function (expression) { + var simple = " | leftwards | rightwards | inherit", + direction = "left-side | far-left | left | center-left | center | center-right | right | far-right | right-side", + behind = false, + valid = false, + part; + + if (!ValidationTypes.isAny(expression, simple)) { + if (ValidationTypes.isAny(expression, "behind")) { + behind = true; + valid = true; + } + + if (ValidationTypes.isAny(expression, direction)) { + valid = true; + if (!behind) { + ValidationTypes.isAny(expression, "behind"); } - this.add(duration.subscribe(new GroupDurationSubscriber(key, group, this))); } } - if (!group.closed) { - group.next(element); + + if (expression.hasNext()) { + part = expression.next(); + if (valid) { + throw new ValidationError("Expected end of value but found '" + part + "'.", part.line, part.col); + } else { + throw new ValidationError("Expected (<'azimuth'>) but found '" + part + "'.", part.line, part.col); + } } - }; - GroupBySubscriber.prototype._error = function (err) { - var groups = this.groups; - if (groups) { - groups.forEach(function (group, key) { - group.error(err); - }); - groups.clear(); + }, + + //B + "backface-visibility" : "visible | hidden", + "background" : 1, + "background-attachment" : { multi: "", comma: true }, + "background-clip" : { multi: "", comma: true }, + "background-color" : " | inherit", + "background-image" : { multi: "", comma: true }, + "background-origin" : { multi: "", comma: true }, + "background-position" : { multi: "", comma: true }, + "background-repeat" : { multi: "" }, + "background-size" : { multi: "", comma: true }, + "baseline-shift" : "baseline | sub | super | | ", + "behavior" : 1, + "binding" : 1, + "bleed" : "", + "bookmark-label" : " | | ", + "bookmark-level" : "none | ", + "bookmark-state" : "open | closed", + "bookmark-target" : "none | | ", + "border" : " || || ", + "border-bottom" : " || || ", + "border-bottom-color" : " | inherit", + "border-bottom-left-radius" : "", + "border-bottom-right-radius" : "", + "border-bottom-style" : "", + "border-bottom-width" : "", + "border-collapse" : "collapse | separate | inherit", + "border-color" : { multi: " | inherit", max: 4 }, + "border-image" : 1, + "border-image-outset" : { multi: " | ", max: 4 }, + "border-image-repeat" : { multi: "stretch | repeat | round", max: 2 }, + "border-image-slice" : function(expression) { + + var valid = false, + numeric = " | ", + fill = false, + count = 0, + max = 4, + part; + + if (ValidationTypes.isAny(expression, "fill")) { + fill = true; + valid = true; + } + + while (expression.hasNext() && count < max) { + valid = ValidationTypes.isAny(expression, numeric); + if (!valid) { + break; + } + count++; } - this.destination.error(err); - }; - GroupBySubscriber.prototype._complete = function () { - var groups = this.groups; - if (groups) { - groups.forEach(function (group, key) { - group.complete(); - }); - groups.clear(); + + + if (!fill) { + ValidationTypes.isAny(expression, "fill"); + } else { + valid = true; } - this.destination.complete(); - }; - GroupBySubscriber.prototype.removeGroup = function (key) { - this.groups.delete(key); - }; - GroupBySubscriber.prototype.unsubscribe = function () { - if (!this.closed) { - this.attemptedToUnsubscribe = true; - if (this.count === 0) { - _super.prototype.unsubscribe.call(this); + + if (expression.hasNext()) { + part = expression.next(); + if (valid) { + throw new ValidationError("Expected end of value but found '" + part + "'.", part.line, part.col); + } else { + throw new ValidationError("Expected ([ | ]{1,4} && fill?) but found '" + part + "'.", part.line, part.col); } } - }; - return GroupBySubscriber; -}(Subscriber_1.Subscriber)); -/** - * We need this JSDoc comment for affecting ESDoc. - * @ignore - * @extends {Ignored} - */ -var GroupDurationSubscriber = (function (_super) { - __extends(GroupDurationSubscriber, _super); - function GroupDurationSubscriber(key, group, parent) { - _super.call(this, group); - this.key = key; - this.group = group; - this.parent = parent; - } - GroupDurationSubscriber.prototype._next = function (value) { - this.complete(); - }; - GroupDurationSubscriber.prototype._unsubscribe = function () { - var _a = this, parent = _a.parent, key = _a.key; - this.key = this.parent = null; - if (parent) { - parent.removeGroup(key); + }, + "border-image-source" : " | none", + "border-image-width" : { multi: " | | | auto", max: 4 }, + "border-left" : " || || ", + "border-left-color" : " | inherit", + "border-left-style" : "", + "border-left-width" : "", + "border-radius" : function(expression) { + + var valid = false, + simple = " | | inherit", + slash = false, + count = 0, + max = 8, + part; + + while (expression.hasNext() && count < max) { + valid = ValidationTypes.isAny(expression, simple); + if (!valid) { + + if (String(expression.peek()) === "/" && count > 0 && !slash) { + slash = true; + max = count + 5; + expression.next(); + } else { + break; + } + } + count++; } - }; - return GroupDurationSubscriber; -}(Subscriber_1.Subscriber)); -/** - * An Observable representing values belonging to the same group represented by - * a common key. The values emitted by a GroupedObservable come from the source - * Observable. The common key is available as the field `key` on a - * GroupedObservable instance. - * - * @class GroupedObservable - */ -var GroupedObservable = (function (_super) { - __extends(GroupedObservable, _super); - function GroupedObservable(key, groupSubject, refCountSubscription) { - _super.call(this); - this.key = key; - this.groupSubject = groupSubject; - this.refCountSubscription = refCountSubscription; - } - GroupedObservable.prototype._subscribe = function (subscriber) { - var subscription = new Subscription_1.Subscription(); - var _a = this, refCountSubscription = _a.refCountSubscription, groupSubject = _a.groupSubject; - if (refCountSubscription && !refCountSubscription.closed) { - subscription.add(new InnerRefCountSubscription(refCountSubscription)); + + if (expression.hasNext()) { + part = expression.next(); + if (valid) { + throw new ValidationError("Expected end of value but found '" + part + "'.", part.line, part.col); + } else { + throw new ValidationError("Expected (<'border-radius'>) but found '" + part + "'.", part.line, part.col); + } } - subscription.add(groupSubject.subscribe(subscriber)); - return subscription; - }; - return GroupedObservable; -}(Observable_1.Observable)); -exports.GroupedObservable = GroupedObservable; -/** - * We need this JSDoc comment for affecting ESDoc. - * @ignore - * @extends {Ignored} - */ -var InnerRefCountSubscription = (function (_super) { - __extends(InnerRefCountSubscription, _super); - function InnerRefCountSubscription(parent) { - _super.call(this); - this.parent = parent; - parent.count++; - } - InnerRefCountSubscription.prototype.unsubscribe = function () { - var parent = this.parent; - if (!parent.closed && !this.closed) { - _super.prototype.unsubscribe.call(this); - parent.count -= 1; - if (parent.count === 0 && parent.attemptedToUnsubscribe) { - parent.unsubscribe(); + }, + "border-right" : "