text: /**
   * @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 __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 __());
  };
  export var EventListener = (function () {
      /**
       * @param {?} name
       * @param {?} callback
       */
      function EventListener(name, callback) {
          this.name = name;
          this.callback = callback;
      }
      ;
      return EventListener;
  }());
  function EventListener_tsickle_Closure_declarations() {
      /** @type {?} */
      EventListener.prototype.name;
      /** @type {?} */
      EventListener.prototype.callback;
  }
  /**
   * \@experimental All debugging apis are currently experimental.
   */
  export var DebugNode = (function () {
      /**
       * @param {?} nativeNode
       * @param {?} parent
       * @param {?} _debugInfo
       */
      function DebugNode(nativeNode, parent, _debugInfo) {
          this._debugInfo = _debugInfo;
          this.nativeNode = nativeNode;
          if (parent && parent instanceof DebugElement) {
              parent.addChild(this);
          }
          else {
              this.parent = null;
          }
          this.listeners = [];
      }
      Object.defineProperty(DebugNode.prototype, "injector", {
          /**
           * @return {?}
           */
          get: function () { return this._debugInfo ? this._debugInfo.injector : null; },
          enumerable: true,
          configurable: true
      });
      Object.defineProperty(DebugNode.prototype, "componentInstance", {
          /**
           * @return {?}
           */
          get: function () { return this._debugInfo ? this._debugInfo.component : null; },
          enumerable: true,
          configurable: true
      });
      Object.defineProperty(DebugNode.prototype, "context", {
          /**
           * @return {?}
           */
          get: function () { return this._debugInfo ? this._debugInfo.context : null; },
          enumerable: true,
          configurable: true
      });
      Object.defineProperty(DebugNode.prototype, "references", {
          /**
           * @return {?}
           */
          get: function () {
              return this._debugInfo ? this._debugInfo.references : null;
          },
          enumerable: true,
          configurable: true
      });
      Object.defineProperty(DebugNode.prototype, "providerTokens", {
          /**
           * @return {?}
           */
          get: function () { return this._debugInfo ? this._debugInfo.providerTokens : null; },
          enumerable: true,
          configurable: true
      });
      Object.defineProperty(DebugNode.prototype, "source", {
          /**
           * @return {?}
           */
          get: function () { return this._debugInfo ? this._debugInfo.source : null; },
          enumerable: true,
          configurable: true
      });
      return DebugNode;
  }());
  function DebugNode_tsickle_Closure_declarations() {
      /** @type {?} */
      DebugNode.prototype.nativeNode;
      /** @type {?} */
      DebugNode.prototype.listeners;
      /** @type {?} */
      DebugNode.prototype.parent;
      /** @type {?} */
      DebugNode.prototype._debugInfo;
  }
  /**
   * \@experimental All debugging apis are currently experimental.
   */
  export var DebugElement = (function (_super) {
      __extends(DebugElement, _super);
      /**
       * @param {?} nativeNode
       * @param {?} parent
       * @param {?} _debugInfo
       */
      function DebugElement(nativeNode, parent, _debugInfo) {
          _super.call(this, nativeNode, parent, _debugInfo);
          this.properties = {};
          this.attributes = {};
          this.classes = {};
          this.styles = {};
          this.childNodes = [];
          this.nativeElement = nativeNode;
      }
      /**
       * @param {?} child
       * @return {?}
       */
      DebugElement.prototype.addChild = function (child) {
          if (child) {
              this.childNodes.push(child);
              child.parent = this;
          }
      };
      /**
       * @param {?} child
       * @return {?}
       */
      DebugElement.prototype.removeChild = function (child) {
          var /** @type {?} */ childIndex = this.childNodes.indexOf(child);
          if (childIndex !== -1) {
              child.parent = null;
              this.childNodes.splice(childIndex, 1);
          }
      };
      /**
       * @param {?} child
       * @param {?} newChildren
       * @return {?}
       */
      DebugElement.prototype.insertChildrenAfter = function (child, newChildren) {
          var /** @type {?} */ siblingIndex = this.childNodes.indexOf(child);
          if (siblingIndex !== -1) {
              var /** @type {?} */ previousChildren = this.childNodes.slice(0, siblingIndex + 1);
              var /** @type {?} */ nextChildren = this.childNodes.slice(siblingIndex + 1);
              this.childNodes = previousChildren.concat(newChildren, nextChildren);
              for (var /** @type {?} */ i = 0; i < newChildren.length; ++i) {
                  var /** @type {?} */ newChild = newChildren[i];
                  if (newChild.parent) {
                      newChild.parent.removeChild(newChild);
                  }
                  newChild.parent = this;
              }
          }
      };
      /**
       * @param {?} predicate
       * @return {?}
       */
      DebugElement.prototype.query = function (predicate) {
          var /** @type {?} */ results = this.queryAll(predicate);
          return results[0] || null;
      };
      /**
       * @param {?} predicate
       * @return {?}
       */
      DebugElement.prototype.queryAll = function (predicate) {
          var /** @type {?} */ matches = [];
          _queryElementChildren(this, predicate, matches);
          return matches;
      };
      /**
       * @param {?} predicate
       * @return {?}
       */
      DebugElement.prototype.queryAllNodes = function (predicate) {
          var /** @type {?} */ matches = [];
          _queryNodeChildren(this, predicate, matches);
          return matches;
      };
      Object.defineProperty(DebugElement.prototype, "children", {
          /**
           * @return {?}
           */
          get: function () {
              return (this.childNodes.filter(function (node) { return node instanceof DebugElement; }));
          },
          enumerable: true,
          configurable: true
      });
      /**
       * @param {?} eventName
       * @param {?} eventObj
       * @return {?}
       */
      DebugElement.prototype.triggerEventHandler = function (eventName, eventObj) {
          this.listeners.forEach(function (listener) {
              if (listener.name == eventName) {
                  listener.callback(eventObj);
              }
          });
      };
      return DebugElement;
  }(DebugNode));
  function DebugElement_tsickle_Closure_declarations() {
      /** @type {?} */
      DebugElement.prototype.name;
      /** @type {?} */
      DebugElement.prototype.properties;
      /** @type {?} */
      DebugElement.prototype.attributes;
      /** @type {?} */
      DebugElement.prototype.classes;
      /** @type {?} */
      DebugElement.prototype.styles;
      /** @type {?} */
      DebugElement.prototype.childNodes;
      /** @type {?} */
      DebugElement.prototype.nativeElement;
  }
  /**
   * \@experimental
   * @param {?} debugEls
   * @return {?}
   */
  export function asNativeElements(debugEls) {
      return debugEls.map(function (el) { return el.nativeElement; });
  }
  /**
   * @param {?} element
   * @param {?} predicate
   * @param {?} matches
   * @return {?}
   */
  function _queryElementChildren(element, predicate, matches) {
      element.childNodes.forEach(function (node) {
          if (node instanceof DebugElement) {
              if (predicate(node)) {
                  matches.push(node);
              }
              _queryElementChildren(node, predicate, matches);
          }
      });
  }
  /**
   * @param {?} parentNode
   * @param {?} predicate
   * @param {?} matches
   * @return {?}
   */
  function _queryNodeChildren(parentNode, predicate, matches) {
      if (parentNode instanceof DebugElement) {
          parentNode.childNodes.forEach(function (node) {
              if (predicate(node)) {
                  matches.push(node);
              }
              if (node instanceof DebugElement) {
                  _queryNodeChildren(node, predicate, matches);
              }
          });
      }
  }
  // Need to keep the nodes in a global Map so that multiple angular apps are supported.
  var /** @type {?} */ _nativeNodeToDebugNode = new Map();
  /**
   * \@experimental
   * @param {?} nativeNode
   * @return {?}
   */
  export function getDebugNode(nativeNode) {
      return _nativeNodeToDebugNode.get(nativeNode);
  }
  /**
   * @return {?}
   */
  export function getAllDebugNodes() {
      return Array.from(_nativeNodeToDebugNode.values());
  }
  /**
   * @param {?} node
   * @return {?}
   */
  export function indexDebugNode(node) {
      _nativeNodeToDebugNode.set(node.nativeNode, node);
  }
  /**
   * @param {?} node
   * @return {?}
   */
  export function removeDebugNodeFromIndex(node) {
      _nativeNodeToDebugNode.delete(node.nativeNode);
  }
  //# sourceMappingURL=debug_node.js.map