text: // Generated by BUCKLESCRIPT VERSION 5.0.6, PLEASE EDIT WITH CARE
  'use strict';
  
  var Curry = require("bs-platform/lib/js/curry.js");
  var Root$AgdaMode = require("./View/Root.bs.js");
  var Async$AgdaMode = require("./Util/Async.bs.js");
  var Event$AgdaMode = require("./Util/Event.bs.js");
  var Editors$AgdaMode = require("./Editors.bs.js");
  var Caml_chrome_debugger = require("bs-platform/lib/js/caml_chrome_debugger.js");
  var RunningInfo$AgdaMode = require("./RunningInfo.bs.js");
  var Instance__Handler$AgdaMode = require("./Instance/Instance__Handler.bs.js");
  var Instance__Connections$AgdaMode = require("./Instance/Instance__Connections.bs.js");
  
  function activate(instance) {
    return Curry._1(instance[/* view */2][/* activate */0], /* () */0);
  }
  
  function deactivate(instance) {
    return Curry._1(instance[/* view */2][/* deactivate */1], /* () */0);
  }
  
  function destroy(instance) {
    return Curry._1(instance[/* view */2][/* destroy */7], /* () */0);
  }
  
  function make(textEditor) {
    atom.views.getView(textEditor).classList.add("agda");
    var editors = Editors$AgdaMode.make(textEditor);
    var view = Root$AgdaMode.initialize(editors);
    var instance = /* record */Caml_chrome_debugger.record([
        "isLoaded",
        "editors",
        "view",
        "history",
        "highlightings",
        "goals",
        "connection",
        "runningInfo",
        "handleResponse",
        "dispatch",
        "onDispatch"
      ], [
        false,
        editors,
        view,
        Caml_chrome_debugger.record([
            "checkpoints",
            "needsReloading"
          ], [
            [],
            false
          ]),
        [],
        [],
        undefined,
        RunningInfo$AgdaMode.make(/* () */0),
        Instance__Handler$AgdaMode.handleResponseAndRecoverCursor,
        Instance__Handler$AgdaMode.dispatch,
        Event$AgdaMode.make(/* () */0)
      ]);
    var destructor0 = Event$AgdaMode.onOk((function (path) {
              Instance__Connections$AgdaMode.connectWithAgdaPath(instance, path);
              return /* () */0;
            }))(instance[/* view */2][/* onInquireConnection */17]);
    var destructor1 = Event$AgdaMode.onOk((function (ev) {
              switch (ev.tag | 0) {
                case 0 : 
                    Instance__Handler$AgdaMode.dispatch(/* Jump */Caml_chrome_debugger.variant("Jump", 9, [ev[0]]), instance);
                    return /* () */0;
                case 1 : 
                case 2 : 
                    return /* () */0;
                
              }
            }))(instance[/* view */2][/* onMouseEvent */9]);
    Async$AgdaMode.finalOk((function (param) {
            Curry._1(destructor0, /* () */0);
            return Curry._1(destructor1, /* () */0);
          }), Event$AgdaMode.once(instance[/* view */2][/* onDestroy */8]));
    return instance;
  }
  
  function dispatchUndo(instance) {
    instance[/* editors */1][/* source */1].undo();
    if (instance[/* history */3][/* needsReloading */1]) {
      Instance__Handler$AgdaMode.dispatch(/* Load */0, instance);
      instance[/* history */3][/* needsReloading */1] = false;
      return /* () */0;
    } else {
      return 0;
    }
  }
  
  function getID(instance) {
    return Editors$AgdaMode.getID(instance[/* editors */1]);
  }
  
  var $$Event = 0;
  
  var Goals = 0;
  
  var Highlightings = 0;
  
  var Connections = 0;
  
  var TextEditors = 0;
  
  var Handler = 0;
  
  var handleCommandError = Instance__Handler$AgdaMode.handleCommandError;
  
  var dispatch = Instance__Handler$AgdaMode.dispatch;
  
  exports.$$Event = $$Event;
  exports.Goals = Goals;
  exports.Highlightings = Highlightings;
  exports.Connections = Connections;
  exports.TextEditors = TextEditors;
  exports.Handler = Handler;
  exports.handleCommandError = handleCommandError;
  exports.dispatch = dispatch;
  exports.activate = activate;
  exports.deactivate = deactivate;
  exports.destroy = destroy;
  exports.make = make;
  exports.dispatchUndo = dispatchUndo;
  exports.getID = getID;
  /* Root-AgdaMode Not a pure module */
  