------------------------ Local utility functions Utility function to help find submodels and sub collections in _setupSubViewConfig
510809
function (string, obj, instOf) {
        if (string instanceof instOf) {
            return string;
        }
        if (string === true && obj instanceof instOf) {
            return obj;
        }
        if (!obj) { return null; }
        obj = obj.get(string);
        if (obj instanceof instOf) {
            return obj;
        }
        return null;
    }
688975
function(view, config) {
  var formInputs = getForm(view);

  formInputs = _.reject(formInputs, function(el) {
    var reject;
    var myType = getElementType(el);
    var extractor = config.keyExtractors.get(myType);
    var identifier = extractor($(el));

    var foundInIgnored = _.find(config.ignoredTypes, function(ignoredTypeOrSelector) {
      return (ignoredTypeOrSelector === myType) || $(el).is(ignoredTypeOrSelector);
    });

    var foundInInclude = _.includes(config.include, identifier);
    var foundInExclude = _.includes(config.exclude, identifier);

    if (foundInInclude) {
      reject = false;
    } else {
      if (config.include) {
        reject = true;
      } else {
        reject = (foundInExclude || foundInIgnored);
      }
    }

    return reject;
  });

  return formInputs;
}
744718
function findSuiteRec(suite, findFn) {
  if (findFn(suite)) return suite;

  for (const child of suite.children || []) {
    const result = findSuiteRec(child, findFn);

    if (result !== null) {
      return result;
    }
  }

  return null;
}
1357342
function (localConfig, propertyName, propertyObject) {
    var presetCheck = defaultConfig.presets[propertyName][propertyObject];
    if (presetCheck) return $.extend(true, {}, presetCheck, localConfig);
    return localConfig
  }
52499
function setupOptions(opts) {
    var options = Object.create(null);
    for (var opt in defaultOptions) {
        if (opts && Object.prototype.hasOwnProperty.call(opts, opt)) {
            var incomingOpt = opts[opt];
            options[opt] = typeof incomingOpt === 'function' ? incomingOpt() : incomingOpt;
        } else if (defaultOptions.hasOwnProperty(opt)) {
            var defaultOpt = defaultOptions[opt];
            options[opt] = typeof defaultOpt === 'function' ? defaultOpt() : defaultOpt;
        }
    }
    return options;
  }
850988
function getSubField (field, index, property) {
    // get list of sub fields by index
    var fields = field.values.length > index
        ? field.values[index]
        : field.fields
    // find field for property
    return _.find(fields, field => field.property === property)
}
976124
function cssobj$1 (obj, config, state) {
  config = config || {};

  var local = config.local;
  config.local = !local
    ? {space: ''}
  : local && typeof local === 'object' ? local : {};

  config.plugins = [].concat(
    config.plugins || [],
    cssobj_plugin_selector_localize(config.local),
    cssobj_plugin_post_cssom(config.cssom)
  );

  return cssobj(config)(obj, state)
}
1182463
function (smList, cb) {
            // sub-module creation is now entirely managed in ModuleCtrlFactory
            // simple shortcut for aria.templates.ModuleCtrlFactory.loadSubModules
            ariaTemplatesModuleCtrlFactory.__loadSubModules(this, smList, {
                fn : this.__onLoadSubModulesComplete,
                scope : this,
                args : cb
            });
        }
1046663
function collectionFind(filter, options) {
        if (!filter) {
            // TODO - limit of ten by
            return collections[ this['_collection'] ]
        }

        if ( typeof(filter) !== 'object' ) { // == findAll
            throw new Error('filter must be an object');
        } else {
            //console.log('search into ', this['_collection'], collections[ this['_collection'] ], collections);
            var content             = collections[ this['_collection'] ]
                , condition         = filter.count()
                , i                 = 0
                , found             = []
                , localeLowerCase   = '';

            for (var o in content) {
                for (var f in filter) {
                    localeLowerCase = ( typeof(filter[f]) != 'boolean' ) ? filter[f].toLocaleLowerCase() : filter[f];
                    if ( filter[f] && keywords.indexOf(localeLowerCase) > -1 && localeLowerCase == 'not null' && typeof(content[o][f]) != 'undefined' && typeof(content[o][f]) !== 'object' && content[o][f] != 'null' && content[o][f] != 'undefined' ) {
                        if (found.indexOf(content[o][f]) < 0 ) {
                            found[i] = content[o][f];
                            ++i
                        }

                    } else if ( typeof(content[o][f]) != 'undefined' && typeof(content[o][f]) !== 'object' && content[o][f] === filter[f] ) {
                        found[i] = content[o];
                        ++i
                    }
                }
            }
        }

        return found
    }
1252160
function(key, ctx, partials, returnFound) {
      var val = false,
          v = null,
          found = false,
          doModelGet = this.options.modelGet;

      for (var i = ctx.length - 1; i >= 0; i--) {
        v = ctx[i];
        val = findInScope(key, v, doModelGet);
        if (val != null) {
          found = true;
          break;
        }
      }

      if (!found) {
        return (returnFound) ? false : "";
      }

      if (!returnFound && typeof val == 'function') {
        val = this.mv(val, ctx, partials);
      }

      return val;
    }
1150624
function docletModel(doclet) {
  return function(context, cb) {
    logger.debug('doclet', doclet);
    var viewModel = _.extend({},
      util.rstMixin,
      util.docletChildren(context, doclet, util.mainDocletKinds),
      // (doclet.kind === 'module' ? {} :
      //   util.docletChildren(context, doclet, util.subDocletKinds)
      // ), {
      util.docletChildren(context, doclet, util.subDocletKinds), {
        doclet: doclet,
        example: util.example
      }
    );
    util.view('doclet.rst', viewModel, cb);
  };
}
964802
function newSubschemaContext(defaultLoaders = [], defaultResolvers = {}, defaultPropTypes = PropTypes, defaultInjectorFactory = injectorFactory, Subschema = {
    Conditional,
    Field,
    FieldSet,
    RenderContent,
    RenderTemplate,
    Form,
    NewChildContext,
    Dom,
    PropTypes,
    ValueManager,
    css,
    eventable,
    loaderFactory,
    tutils,
    validators,
    warning,
    injectorFactory,
    cachedInjector,
    stringInjector

}) {
    const {loader, injector,  ...rest} = Subschema;


    const _injector = defaultInjectorFactory();
    for (let key of Object.keys(defaultResolvers)) {
        if (key in defaultPropTypes) {
            _injector.resolver(defaultPropTypes[key], defaultResolvers[key]);
        }
    }
    const defaultLoader = loaderFactory(defaultLoaders);
    const defaultInjector = cachedInjector(stringInjector(_injector, defaultPropTypes));

    //Form needs these to kick off the whole thing.  Its defaults can be overriden with
    // properties.
    rest.Form.defaultProps.loader = defaultLoader;
    rest.Form.defaultProps.injector = defaultInjector;
    rest.loader = defaultLoader;
    rest.injector = defaultInjector;

    return rest;

}
753347
function findNodes (rhs, config) {
  var pt = this
  config = config || {}
  if (config.excludeSubtree)
    return []
  config.nodePredicate = config.nodePredicate || function (config, node) { return node }
  config.makeChildConfig = config.makeChildConfig || function (config, node, nChild) { return config }
  var nodePredicate = config.nodePredicate, makeChildConfig = config.makeChildConfig
  return rhs.reduce (function (result, node) {
    var foundNode = nodePredicate (config, node)
    var childConfig = function (n) { return makeChildConfig (config, node, n) }
    var r = null
    if (typeof(node) === 'object')
      switch (node.type) {
      case 'lookup':
        break
      case 'assign':
        r = pt.findNodes ((node.value || []).concat (node.local || []), childConfig())
        break
      case 'alt':
        r = node.opts.reduce (function (altResults, opt) {
          return altResults.concat (pt.findNodes (opt, childConfig()))
        }, [])
        break
      case 'rep':
        r = pt.findNodes (node.unit, childConfig())
        break
      case 'func':
	switch (node.funcname) {
	case 'eval':
	  r = pt.findNodes (node.args.concat (node.value || []), childConfig())
	  break
	case 'link':
	  r = pt.findNodes ([node.args[0]], childConfig(0))
	    .concat (pt.findNodes ([node.args[1]], childConfig(1)))
	  break
	case 'strictquote':
	case 'quote':
	case 'unquote':
        default:
	  r = pt.findNodes (node.args, childConfig())
          break
	}
        break
      case 'cond':
        r = pt.findNodes (node.test.concat (node.t, node.f), childConfig())
        break
      case 'root':
      case 'alt_sampled':
        r = pt.findNodes (node.rhs, childConfig())
        break
      case 'rep_sampled':
        r = pt.findNodes (node.reps.reduce (function (all, rep) { return all.concat(rep) }, []), childConfig())
        break
      default:
      case 'sym':
        r = pt.findNodes (node.rhs || node.bind || [], childConfig())
        break
      }
    return result.concat(foundNode ? [foundNode] : []).concat(r || []);
  }, [])
}
965240
function getViewsOf(model) {
        return getRefsTo(model, function (ref) {
            return (ref instanceof Core.View) && (ref.model === model);
        });
    }
905711
function buildStack(app, name, view) {
    var layoutExists = false;
    var registered = 0;
    var layouts = {};

    // get all collections with `viewType` layout
    var collections = app.viewTypes.layout;
    var len = collections.length;
    var idx = -1;

    while (++idx < len) {
      var collection = app[collections[idx]];

      // detect if at least one of the collections has
      // our starting layout
      if (!layoutExists && collection.getView(name)) {
        layoutExists = true;
      }

      // add the collection views to the layouts object
      for (var key in collection.views) {
        layouts[key] = collection.views[key];
        registered++;
      }
    }

    if (registered === 0) {
      throw app.formatError('layouts', 'registered', name, view);
    }

    if (layoutExists === false) {
      throw app.formatError('layouts', 'notfound', name, view);
    }
    return layouts;
  }
1017756
function (subType) {
        var series = this._componentsMap.get('series');
        return filter(series, function (oneSeries) {
            return oneSeries.subType === subType;
        });
    }
1281226
def settings_view_decorator(function):
    

    dec = settings.CLOUD_BROWSER_VIEW_DECORATOR

    # Trade-up string to real decorator.
    if isinstance(dec, str):
        # Split into module and decorator strings.
        mod_str, _, dec_str = dec.rpartition('.')
        if not (mod_str and dec_str):
            raise ImportError("Unable to import module: %s" % mod_str)

        # Import and try to get decorator function.
        mod = import_module(mod_str)
        if not hasattr(mod, dec_str):
            raise ImportError("Unable to import decorator: %s" % dec)

        dec = getattr(mod, dec_str)

    if dec and callable(dec):
        return dec(function)

    return function