<commit_before>elation.require([
  "engine.external.three.FlyControls",
  "engine.external.three.OrbitControls",
  "engine.external.three.TransformControls",
  //"engine.external.highlight",
  "engine.things.manipulator",
  "ui.accordion",
  "ui.buttonbar",
  "ui.slider",
  "ui.combobox",
  "ui.select",
  "ui.tabs",
  //"ui.list",
  "ui.grid",
  "ui.panel",
  "ui.treeview",
  "ui.window",
  "ui.indicator",
  "ui.contextmenu",
  "ui.toolbox",
  "ui.label",
  "ui.label",
], function() {
  elation.requireCSS('engine.systems.admin');

  elation.template.add('engine.systems.admin.scenetree.thing', '<span class="engine_thing">{name}</span> ({type})');
  elation.template.add('engine.systems.admin.inspector.property', '{?children}<span>{name}</span>{:else}<label for="engine_admin_inspector_properties_{fullname}">{name}</label><input id="engine_admin_inspector_properties_{fullname}" value="{value}">{/children}');
  elation.template.add('engine.systems.admin.inspector.object', '<span class="engine_thing_object engine_thing_object_{type}">{object.name} ({type})</span>');
  elation.template.add('engine.systems.admin.inspector.function', '<span class="engine_thing_function{?function.own} engine_thing_function_own{/function.own}" title="this.{function.name} = {function.content}">{function.name}</span>');

  elation.template.add('engine.systems.admin.addthing', 'Add new <select name="type" data-elation-component="ui.select" data-elation-args.items="{thingtypes}"></select> named <input name="name"> <input type="submit" value="add">');
  elation.template.add('engine.systems.admin.definething', '<input name="thingtype" placeholder="type name"> <textarea name="thingdef">function() {}</textarea> <input type="submit">');
  elation.template.add('engine.systems.admin.assets.material', '<div data-elation-component="engine.systems.admin.assets.material" data-elation-args.materialname="{name}"><data class="elation-args"></data>{name}</div>');
  elation.template.add('engine.systems.admin.assets.geometry', '<div data-elation-component="engine.systems.admin.assets.geometry" data-elation-args.geometryname="{name}"><data class="elation-args"></data>{name}</div>');

  elation.extend("engine.systems.admin", function(args) {
    elation.implement(this, elation.engine.systems.system);

    this.cameraactive = true;

    this.system_attach = function(ev) {
      console.log('INIT: admin');

      //elation.html.addclass(this.container, "engine_admin");
      this.world = this.engine.systems.world;

      //this.inspector = elation.engine.systems.admin.inspector('admin', elation.html.create({append: document.body}), {engine: this.engine});
      this.scenetree = elation.engine.systems.admin.scenetree(null, elation.html.create({append: document.body}), {world: this.world, admin: this});
      this.assets = elation.engine.systems.admin.assets(null, elation.html.create({append: document.body}), {world: this.world, admin: this});
      this.worldcontrol = elation.engine.systems.admin.worldcontrol(null, elation.html.create({append: document.body}), {engine: this.engine});
    }
    this.engine_frame = function(ev) {
      /* FIXME - silly hack! */
      if ( this.cameraactive && !this.admincontrols) {
        this.createCamera();

        this.engine.systems.controls.addCommands('admin', {
          'add_thing': elation.bind(this, function(ev) { if (ev.value == 1) { this.scenetree.addItem(); }}),
          'toggle_camera': elation.bind(this, function(ev) { if (ev.value == 1) { this.toggleControls(); }}),
          'toggle_admin': elation.bind(this, function(ev) { if (ev.value == 1) { this.toggleAdmin(); }}),
  /*
          'move_left': elation.bind(this, this.moveleft),
          'move_right': elation.bind(this, this.moveright),
          'move_forward': elation.bind(this, this.moveforward),
          'move_back': elation.bind(this, this.moveback),
  */
        });
        this.engine.systems.controls.addBindings('admin', {
          'keyboard_ctrl_a': 'add_thing',<commit_msg>Don't call addclass on non-existent container<commit_after>elation.require([
  "engine.external.three.FlyControls",
  "engine.external.three.OrbitControls",
  "engine.external.three.TransformControls",
  //"engine.external.highlight",
  "engine.things.manipulator",
  "ui.accordion",
  "ui.buttonbar",
  "ui.slider",
  "ui.combobox",
  "ui.select",
  "ui.tabs",
  //"ui.list",
  "ui.grid",
  "ui.panel",
  "ui.treeview",
  "ui.window",
  "ui.indicator",
  "ui.contextmenu",
  "ui.toolbox",
  "ui.label",
  "ui.label",
], function() {
  elation.requireCSS('engine.systems.admin');

  elation.template.add('engine.systems.admin.scenetree.thing', '<span class="engine_thing">{name}</span> ({type})');
  elation.template.add('engine.systems.admin.inspector.property', '{?children}<span>{name}</span>{:else}<label for="engine_admin_inspector_properties_{fullname}">{name}</label><input id="engine_admin_inspector_properties_{fullname}" value="{value}">{/children}');
  elation.template.add('engine.systems.admin.inspector.object', '<span class="engine_thing_object engine_thing_object_{type}">{object.name} ({type})</span>');
  elation.template.add('engine.systems.admin.inspector.function', '<span class="engine_thing_function{?function.own} engine_thing_function_own{/function.own}" title="this.{function.name} = {function.content}">{function.name}</span>');

  elation.template.add('engine.systems.admin.addthing', 'Add new <select name="type" data-elation-component="ui.select" data-elation-args.items="{thingtypes}"></select> named <input name="name"> <input type="submit" value="add">');
  elation.template.add('engine.systems.admin.definething', '<input name="thingtype" placeholder="type name"> <textarea name="thingdef">function() {}</textarea> <input type="submit">');
  elation.template.add('engine.systems.admin.assets.material', '<div data-elation-component="engine.systems.admin.assets.material" data-elation-args.materialname="{name}"><data class="elation-args"></data>{name}</div>');
  elation.template.add('engine.systems.admin.assets.geometry', '<div data-elation-component="engine.systems.admin.assets.geometry" data-elation-args.geometryname="{name}"><data class="elation-args"></data>{name}</div>');

  elation.extend("engine.systems.admin", function(args) {
    elation.implement(this, elation.engine.systems.system);

    this.cameraactive = true;

    this.system_attach = function(ev) {
      console.log('INIT: admin');

      this.world = this.engine.systems.world;

      //this.inspector = elation.engine.systems.admin.inspector('admin', elation.html.create({append: document.body}), {engine: this.engine});
      this.scenetree = elation.engine.systems.admin.scenetree(null, elation.html.create({append: document.body}), {world: this.world, admin: this});
      this.assets = elation.engine.systems.admin.assets(null, elation.html.create({append: document.body}), {world: this.world, admin: this});
      this.worldcontrol = elation.engine.systems.admin.worldcontrol(null, elation.html.create({append: document.body}), {engine: this.engine});
    }
    this.engine_frame = function(ev) {
      /* FIXME - silly hack! */
      if ( this.cameraactive && !this.admincontrols) {
        this.createCamera();

        this.engine.systems.controls.addCommands('admin', {
          'add_thing': elation.bind(this, function(ev) { if (ev.value == 1) { this.scenetree.addItem(); }}),
          'toggle_camera': elation.bind(this, function(ev) { if (ev.value == 1) { this.toggleControls(); }}),
          'toggle_admin': elation.bind(this, function(ev) { if (ev.value == 1) { this.toggleAdmin(); }}),
  /*
          'move_left': elation.bind(this, this.moveleft),
          'move_right': elation.bind(this, this.moveright),
          'move_forward': elation.bind(this, this.moveforward),
          'move_back': elation.bind(this, this.moveback),
  */
        });
        this.engine.systems.controls.addBindings('admin', {
          'keyboard_ctrl_a': 'add_thing',
{'fraction_non_alphanumeric': 0.18993364216852385, 'fraction_numerical': 0.0007512207336922499, 'mean_word_length': 4.873529411764705, 'pattern_counts': {'":': 0, '<': 57, '<?xml version=': 0, '>': 57, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5969039', 'n_tokens_mistral': 2640, 'n_tokens_neox': 2541, 'n_words': 332}