Evaluate spirits visibility.
@todo: Off to plugin somehow.
@todo: Test for this stuff.
@param {Array<gui.Spirit>}
517007
function(spirits) {
		if (gui.hasModule("gui-layout@wunderbyte.com")) {
			gui.DOMPlugin.group(spirits).forEach(function(spirit) {
				gui.VisibilityPlugin.$init(spirit);
			}, this);
		}
	}
1106063
function() {
		var proto = Element.prototype;
		if (gui.Type.isDefined(proto.spirit)) {
			throw new Error("Spiritual loaded twice?");
		} else {
			proto.spirit = null; // defineProperty fails in iOS5
		}
	}
826607
function(spirit) {
		spirit.life.ready = true;
		spirit.onready();
		spirit.life.dispatch(gui.LIFE_READY);
	}
806251
private boolean isDebugVisible(Value v)
	{
		return v instanceof ReferenceValue || v instanceof NumericValue
				|| v instanceof CharacterValue || v instanceof BooleanValue
				|| v instanceof SetValue || v instanceof SeqValue
				|| v instanceof MapValue || v instanceof TokenValue
				|| v instanceof RecordValue || v instanceof ObjectValue
				|| v instanceof NilValue || v instanceof FunctionValue;
	}
1026981
function evaluate(code) {
  const context = {
    module: {
      exports: {},
    },
  };

  // eslint-disable-next-line no-new-func
  const renderFunction = new Function('module', code);
  renderFunction(context.module);

  const template = context.module.exports;

  return template;
}
83394
function evalOptions(options) {
      var animate = typeof options.animate === 'function' ? options.animate.call() : options.animate;
      var fisheye = typeof options.fisheye === 'function' ? options.fisheye.call() : options.fisheye;
      
      options.animate = animate;
      options.fisheye = fisheye;
    }
928872
private String visibility(Options opt, ProgramElementDoc e) {
	return opt.showVisibility ? Visibility.get(e).symbol : " ";
    }
1298490
function(_silent) {
        if (this.enableHighlight) {
            if (this.tree.singleNodeHighlight) {
                if (this.tree._currentlyHighlighted) {
                    this.tree._currentlyHighlighted.unhighlight(_silent);
                }
                this.tree._currentlyHighlighted = this;
            }
            this.highlightState = 1;
            this._setHighlightClassName();
            if (!this.tree.singleNodeHighlight) {
				if (this.propagateHighlightDown) {
					for (var i = 0;i < this.children.length;i++) {
						this.children[i].highlight(true);
					}
				}
				if (this.propagateHighlightUp) {
					if (this.parent) {
						this.parent._childrenHighlighted();
					}
				}
			}
            if (!_silent) {
                this.tree.fireEvent('highlightEvent',this);
            }
        }
    }
477589
function(spirit) {
		var all = this._spirits;
		var key = spirit.$instanceid;
		if (!all.inside[key]) {
			if (all.outside[key]) {
				delete all.outside[key];
			}
			all.inside[key] = spirit;
			all.incoming.push(spirit);
			gui.Tick.dispatch(gui.$TICK_INSIDE, 4, this.$contextid);
		}
	}
677444
protected function evaluateVisible()
	{
		return empty($this->_on) || in_array($this->getParent()->getModel()->getScenario(),$this->_on);
	}
862379
function(arg, handler) {
		handler = handler ? handler : this.spirit;
		gui.Array.make(arg).forEach(function(type) {
			if (this._addchecks(type, [handler])) {
				if (!this._handlers[type]) {
					this._handlers[type] = [];
				}
				this._handlers[type].push(handler);
			}
		}, this);
		return this.spirit;
	}
430047
function(action, thisp) {
			this.init(action, thisp);
			if(gui.debug) {
				console.warn('gui.ready() is for spirits, use gui.init()');
			}
			return false;
		}
780581
def visible?
      msg = '#visible? behavior will be changing slightly, consider switching to #present? ' \
            '(more details: http://watir.com/element-existentialism/)'
      Watir.logger.warn msg, ids: [:visible_element]
      displayed = display_check
      if displayed.nil? && display_check
        Watir.logger.deprecate 'Checking `#visible? == false` to determine a stale element',
                               '`#stale? == true`',
                               reference: 'http://watir.com/staleness-changes',
                               ids: [:stale_visible]
      end
      raise unknown_exception if displayed.nil?

      displayed
    end
1227766
function(element, handler, arg) {
		var hasspirit = gui.hasModule('gui-spirits@wunderbyte.com');
		var directive = gui.Crawler.CONTINUE;
		var spirit = hasspirit ? element.spirit : null;
		if (spirit) {
			directive = spirit.oncrawler(this);
		}
		if (!directive) {
			if (handler) {
				if (gui.Type.isFunction(handler.handleElement)) {
					directive = handler.handleElement(element, arg);
				}
				if (directive !== gui.Crawler.STOP) {
					if (spirit && gui.Type.isFunction(handler.handleSpirit)) {
						directive = this._handleSpirit(spirit, handler);
					}
				}
			}
		}
		if (!directive) {
			directive = gui.Crawler.CONTINUE;
		}
		return directive;
	}
415721
function(visible, force) {
			if (this._overviewRulerVisible === visible && !force) { return; }
			this._overviewRulerVisible = visible;
			if (!this._overviewRuler) { return; }
			var textView = this._textView;
			if (visible) {
				textView.addRuler(this._overviewRuler);
			} else {
				textView.removeRuler(this._overviewRuler);
			}
		}
415895
async function _evaluateContexts(contexts = []) {
  const c = Array.isArray(contexts) ? contexts : [contexts]
  const ep = c.map(evaluateContext)
  const res = await Promise.all(ep)
  return res
}
255992
function showInvisibles(str) {
  let ret = '';
  for (let i = 0; i < str.length; i++) {
    switch (str[i]) {
      case ' ':
        ret += '·'; // Middle Dot, \u00B7
        break;
      case '\n':
        ret += '⏎'; // Return Symbol, \u23ce
        break;
      case '\t':
        ret += '↹'; // Left Arrow To Bar Over Right Arrow To Bar, \u21b9
        break;
      case '\r':
        ret += '␍'; // Carriage Return Symbol, \u240D
        break;
      default:
        ret += str[i];
        break;
    }
  }
  return ret;
}