{"size": 1436, "ext": "js", "max_stars_repo_path": "node_modules/marko/dist/runtime/components/ComponentsContext.js", "max_stars_repo_name": "TaisSantana/crud-node", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "node_modules/marko/dist/runtime/components/ComponentsContext.js", "max_issues_repo_name": "TaisSantana/crud-node", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "node_modules/marko/dist/runtime/components/ComponentsContext.js", "max_forks_repo_name": "TaisSantana/crud-node", "max_forks_repo_forks_event_min_datetime": "2020-12-04T23:52:51.000Z", "max_forks_repo_forks_event_max_datetime": "2020-12-04T23:52:51.000Z"}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": 1, "avg_line_length": 25.6428571429, "max_line_length": 81, "alphanum_fraction": 0.7249303621}
"use strict";

var GlobalComponentsContext = require("./GlobalComponentsContext");

function ComponentsContext(out, parentComponentsContext) {
  var globalComponentsContext;
  var componentDef;

  if (parentComponentsContext) {
    globalComponentsContext = parentComponentsContext.k_;
    componentDef = parentComponentsContext.p_;

    var nestedContextsForParent;
    if (!(nestedContextsForParent = parentComponentsContext._V_)) {
      nestedContextsForParent = parentComponentsContext._V_ = [];
    }

    nestedContextsForParent.push(this);
  } else {
    globalComponentsContext = out.global.h_;
    if (globalComponentsContext === undefined) {
      out.global.h_ = globalComponentsContext = new GlobalComponentsContext(out);
    }
  }

  this.k_ = globalComponentsContext;
  this.h_ = [];
  this.E_ = out;
  this.p_ = componentDef;
  this._V_ = undefined;
  this.v_ = parentComponentsContext && parentComponentsContext.v_;
}

ComponentsContext.prototype = {
  F_: function (doc) {
    var componentDefs = this.h_;

    ComponentsContext._W_(componentDefs, doc);

    this.E_.emit("_X_");

    // Reset things stored in global since global is retained for
    // future renders
    this.E_.global.h_ = undefined;

    return componentDefs;
  }
};

function getComponentsContext(out) {
  return out.h_ || (out.h_ = new ComponentsContext(out));
}

module.exports = exports = ComponentsContext;

exports.u_ = getComponentsContext;