(function() {
  var fn = function() {
    
    (function(root) {
      function now() {
        return new Date();
      }
    
      var force = false;
    
      if (typeof (root._bokeh_onload_callbacks) === "undefined" || force === true) {
        root._bokeh_onload_callbacks = [];
        root._bokeh_is_loading = undefined;
      }
    
      
      
    
      
      
    
      function run_callbacks() {
        try {
          root._bokeh_onload_callbacks.forEach(function(callback) { callback() });
        }
        finally {
          delete root._bokeh_onload_callbacks
        }
        console.info("Bokeh: all callbacks have finished");
      }
    
      function load_libs(js_urls, callback) {
        root._bokeh_onload_callbacks.push(callback);
        if (root._bokeh_is_loading > 0) {
          console.log("Bokeh: BokehJS is being loaded, scheduling callback at", now());
          return null;
        }
        if (js_urls == null || js_urls.length === 0) {
          run_callbacks();
          return null;
        }
        console.log("Bokeh: BokehJS not loaded, scheduling load and callback at", now());
        root._bokeh_is_loading = js_urls.length;
        for (var i = 0; i < js_urls.length; i++) {
          var url = js_urls[i];
          var s = document.createElement('script');
          s.src = url;
          s.async = false;
          s.onreadystatechange = s.onload = function() {
            root._bokeh_is_loading--;
            if (root._bokeh_is_loading === 0) {
              console.log("Bokeh: all BokehJS libraries loaded");
              run_callbacks()
            }
          };
          s.onerror = function() {
            console.warn("failed to load library " + url);
          };
          console.log("Bokeh: injecting script tag for BokehJS library: ", url);
          document.getElementsByTagName("head")[0].appendChild(s);
        }
      };var element = document.getElementById("5db61790-b62f-49fc-a247-1ccbb9270e52");
      if (element == null) {
        console.log("Bokeh: ERROR: autoload.js configured with elementid '5db61790-b62f-49fc-a247-1ccbb9270e52' but no matching script tag was found. ")
        return false;
      }
    
      var js_urls = ["https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.6.0/katex.min.js", "https://cdn.pydata.org/bokeh/release/bokeh-0.12.9.min.js", "https://cdn.pydata.org/bokeh/release/bokeh-widgets-0.12.9.min.js", "https://cdn.pydata.org/bokeh/release/bokeh-tables-0.12.9.min.js", "https://cdn.pydata.org/bokeh/release/bokeh-gl-0.12.9.min.js"];
    
      var inline_js = [
        function(Bokeh) {
          Bokeh.set_log_level("info");
        },
        
        function(Bokeh) {
          (function(root, factory) {
          //  if(typeof exports === 'object' && typeof module === 'object')
          //    factory(require("Bokeh"));
          //  else if(typeof define === 'function' && define.amd)
          //    define(["Bokeh"], factory);
          //  else if(typeof exports === 'object')
          //    factory(require("Bokeh"));
          //  else
              factory(root["Bokeh"]);
          })(this, function(Bokeh) {
            var define;
            return (function outer(modules, entry) {
            if (Bokeh != null) {
              return Bokeh.register_plugin(modules, {}, entry);
            } else {
              throw new Error("Cannot find Bokeh. You have to load it prior to loading plugins.");
            }
          })
          ({
            "custom/main": function(require, module, exports) {
              var models = {
                "MyFormatter": require("custom/bk_script_48bd9f2dd7f04922bb4b6673607e3f1c.my_formatter").MyFormatter,
          "LatexLabel": require("custom/bk_script_66a16298a37e4ee1b0ce5d15ea1f8e3e.latex_label").LatexLabel,
          "DrawTool": require("custom/bk_script_7eb31cfe139c4819a47cde0b19352510.draw_tool").DrawTool
              };
              require("base").register_models(models);
              module.exports = models;
            },
            "custom/bk_script_48bd9f2dd7f04922bb4b6673607e3f1c.my_formatter": function(require, module, exports) {
          "use strict";
          Object.defineProperty(exports, "__esModule", { value: true });
          var extend = function (child, parent) { for (var key in parent) {
              if (hasProp.call(parent, key))
                  child[key] = parent[key];
          } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, hasProp = {}.hasOwnProperty;
          var tick_formatter_1 = require("models/formatters/tick_formatter");
          exports.MyFormatter = (function (superClass) {
              extend(MyFormatter, superClass);
              function MyFormatter() {
                  return MyFormatter.__super__.constructor.apply(this, arguments);
              }
              MyFormatter.prototype.type = "MyFormatter";
              MyFormatter.prototype.doFormat = function (ticks) {
                  var formatted, i, j, ref;
                  formatted = ["" + ticks[0]];
                  for (i = j = 1, ref = ticks.length; 1 <= ref ? j < ref : j > ref; i = 1 <= ref ? ++j : --j) {
                      formatted.push("+" + ((ticks[i] - ticks[0]).toPrecision(2)));
                  }
                  return formatted;
              };
              return MyFormatter;
          })(tick_formatter_1.TickFormatter);
          
          },
          "custom/bk_script_66a16298a37e4ee1b0ce5d15ea1f8e3e.latex_label": function(require, module, exports) {
          "use strict";
          Object.defineProperty(exports, "__esModule", { value: true });
          var extend = function (child, parent) { for (var key in parent) {
              if (hasProp.call(parent, key))
                  child[key] = parent[key];
          } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, hasProp = {}.hasOwnProperty;
          var label_1 = require("models/annotations/label");
          exports.LatexLabelView = (function (superClass) {
              extend(LatexLabelView, superClass);
              function LatexLabelView() {
                  return LatexLabelView.__super__.constructor.apply(this, arguments);
              }
              LatexLabelView.prototype.render = function () {
                  var angle, ctx, panel_offset, sx, sy, vx, vy;
                  ctx = this.plot_view.canvas_view.ctx;
                  switch (this.model.angle_units) {
                      case "rad":
                          angle = -1 * this.model.angle;
                          break;
                      case "deg":
                          angle = -1 * this.model.angle * Math.PI / 180.0;
                  }
                  if (this.model.x_units === "data") {
                      vx = this.xscale.compute(this.model.x);
                  }
                  else {
                      vx = this.model.x;
                  }
                  sx = this.canvas.vx_to_sx(vx);
                  if (this.model.y_units === "data") {
                      vy = this.yscale.compute(this.model.y);
                  }
                  else {
                      vy = this.model.y;
                  }
                  sy = this.canvas.vy_to_sy(vy);
                  if (this.model.panel != null) {
                      panel_offset = this._get_panel_offset();
                      sx += panel_offset.x;
                      sy += panel_offset.y;
                  }
                  this._css_text(ctx, "", sx + this.model.x_offset, sy - this.model.y_offset, angle);
                  return katex.render(this.model.text, this.el, {
                      displayMode: true
                  });
              };
              return LatexLabelView;
          })(label_1.LabelView);
          exports.LatexLabel = (function (superClass) {
              extend(LatexLabel, superClass);
              function LatexLabel() {
                  return LatexLabel.__super__.constructor.apply(this, arguments);
              }
              LatexLabel.prototype.type = 'LatexLabel';
              LatexLabel.prototype.default_view = exports.LatexLabelView;
              return LatexLabel;
          })(label_1.Label);
          
          },
          "custom/bk_script_7eb31cfe139c4819a47cde0b19352510.draw_tool": function(require, module, exports) {
          "use strict";
          Object.defineProperty(exports, "__esModule", { value: true });
          var extend = function (child, parent) { for (var key in parent) {
              if (hasProp.call(parent, key))
                  child[key] = parent[key];
          } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, hasProp = {}.hasOwnProperty;
          var p = require("core/properties");
          var gesture_tool_1 = require("models/tools/gestures/gesture_tool");
          exports.DrawToolView = (function (superClass) {
              extend(DrawToolView, superClass);
              function DrawToolView() {
                  return DrawToolView.__super__.constructor.apply(this, arguments);
              }
              DrawToolView.prototype._pan_start = function (e) {
                  return this.model.source.data = {
                      x: [],
                      y: []
                  };
              };
              DrawToolView.prototype._pan = function (e) {
                  var canvas, frame, vx, vy, x, y;
                  frame = this.plot_model.frame;
                  canvas = this.plot_view.canvas;
                  vx = canvas.sx_to_vx(e.bokeh.sx);
                  vy = canvas.sy_to_vy(e.bokeh.sy);
                  if (!frame.contains(vx, vy)) {
                      return null;
                  }
                  x = frame.xscales['default'].invert(vx);
                  y = frame.yscales['default'].invert(vy);
                  this.model.source.data.x.push(x);
                  this.model.source.data.y.push(y);
                  return this.model.source.change.emit();
              };
              DrawToolView.prototype._pan_end = function (e) {
                  return null;
              };
              return DrawToolView;
          })(gesture_tool_1.GestureToolView);
          exports.DrawTool = (function (superClass) {
              extend(DrawTool, superClass);
              function DrawTool() {
                  return DrawTool.__super__.constructor.apply(this, arguments);
              }
              DrawTool.prototype.default_view = exports.DrawToolView;
              DrawTool.prototype.type = "DrawTool";
              DrawTool.prototype.tool_name = "Drag Span";
              DrawTool.prototype.icon = "bk-tool-icon-lasso-select";
              DrawTool.prototype.event_type = "pan";
              DrawTool.prototype.default_order = 12;
              DrawTool.define({
                  source: [p.Instance]
              });
              return DrawTool;
          })(gesture_tool_1.GestureTool);
          
          }
          }, "custom/main");
          ;
          });
        },
        
        function(Bokeh) {
          (function() {
            var fn = function() {
              Bokeh.safely(function() {
                (function(root) {
                  function embed_document(root) {
                    var docs_json = {"ae413023-1ccc-48e7-b4ff-0934e12dade4":{"roots":{"references":[{"attributes":{"line_alpha":{"value":0.1},"line_color":{"value":"#1f77b4"},"x":{"field":"x"},"y":{"field":"y"}},"id":"f6dc5f3f-22ad-44c1-8ea8-6e1d1b8fba9a","type":"Line"},{"attributes":{},"id":"1d9202f1-2db6-4094-b1e1-6b862ad9be66","type":"LinearScale"},{"attributes":{},"id":"94779430-a068-4827-8759-fab86122cd1a","type":"BasicTickFormatter"},{"attributes":{},"id":"360a6515-5ce3-4d39-ba0a-8af9384b155b","type":"BasicTicker"},{"attributes":{"formatter":{"id":"41d9fab4-028d-48f2-8d32-5c11132a22a7","type":"BasicTickFormatter"},"plot":{"id":"2c40d845-60f2-416b-9c81-3335eb91f260","subtype":"Figure","type":"Plot"},"ticker":{"id":"4e9928f5-1dcd-4eb7-a729-f0d9f7f6d43f","type":"BasicTicker"}},"id":"16b3dd8f-9b39-4f93-8e74-3fd3c2fc90cd","type":"LinearAxis"},{"attributes":{"plot":{"id":"2c40d845-60f2-416b-9c81-3335eb91f260","subtype":"Figure","type":"Plot"},"ticker":{"id":"4e9928f5-1dcd-4eb7-a729-f0d9f7f6d43f","type":"BasicTicker"}},"id":"2b423e50-e5b8-4441-b241-9e0a73a2ccbb","type":"Grid"},{"attributes":{"data_source":{"id":"feae1815-05b0-4810-92d7-284e73ccb1ee","type":"ColumnDataSource"},"glyph":{"id":"ad7e3539-375b-46ad-b00d-6340f9a8ba5b","type":"Line"},"hover_glyph":null,"muted_glyph":null,"nonselection_glyph":{"id":"f6dc5f3f-22ad-44c1-8ea8-6e1d1b8fba9a","type":"Line"},"selection_glyph":null,"view":{"id":"af5f3752-8071-42ec-86b4-f43ff06679cd","type":"CDSView"}},"id":"4ebbb740-b9bc-44e6-897a-7ee74b2fe5aa","type":"GlyphRenderer"},{"attributes":{},"id":"41d9fab4-028d-48f2-8d32-5c11132a22a7","type":"BasicTickFormatter"},{"attributes":{},"id":"4e9928f5-1dcd-4eb7-a729-f0d9f7f6d43f","type":"BasicTicker"},{"attributes":{"callback":null,"end":10},"id":"d0c35cf9-1fd4-4b2a-bedd-80990902b2d1","type":"Range1d"},{"attributes":{"line_color":{"value":"#1f77b4"},"x":{"field":"x"},"y":{"field":"y"}},"id":"ad7e3539-375b-46ad-b00d-6340f9a8ba5b","type":"Line"},{"attributes":{"dimension":1,"plot":{"id":"2c40d845-60f2-416b-9c81-3335eb91f260","subtype":"Figure","type":"Plot"},"ticker":{"id":"360a6515-5ce3-4d39-ba0a-8af9384b155b","type":"BasicTicker"}},"id":"fa3fd413-e870-4c15-a31c-4597355a240e","type":"Grid"},{"attributes":{"plot":null,"text":"Drag to draw on the plot"},"id":"a36acf19-17df-44ef-bf85-cad1442cf55f","type":"Title"},{"attributes":{"formatter":{"id":"94779430-a068-4827-8759-fab86122cd1a","type":"BasicTickFormatter"},"plot":{"id":"2c40d845-60f2-416b-9c81-3335eb91f260","subtype":"Figure","type":"Plot"},"ticker":{"id":"360a6515-5ce3-4d39-ba0a-8af9384b155b","type":"BasicTicker"}},"id":"35964636-be50-4ede-a667-b7b86e268dd6","type":"LinearAxis"},{"attributes":{"source":{"id":"feae1815-05b0-4810-92d7-284e73ccb1ee","type":"ColumnDataSource"}},"id":"af5f3752-8071-42ec-86b4-f43ff06679cd","type":"CDSView"},{"attributes":{"active_drag":"auto","active_inspect":"auto","active_scroll":"auto","active_tap":"auto","tools":[{"id":"8942469a-a991-41d7-b5d2-f4a0dafddb6b","type":"DrawTool"}]},"id":"90fc8ddb-7e33-48ce-887c-458758f61bcd","type":"Toolbar"},{"attributes":{"callback":null,"column_names":["y","x"],"data":{"x":[],"y":[]}},"id":"feae1815-05b0-4810-92d7-284e73ccb1ee","type":"ColumnDataSource"},{"attributes":{"callback":null,"end":10},"id":"06c719ee-7cbc-4db7-bc06-a29734aaf53b","type":"Range1d"},{"attributes":{},"id":"566676c8-281d-42c8-8334-62bc762ae11e","type":"LinearScale"},{"attributes":{"source":{"id":"feae1815-05b0-4810-92d7-284e73ccb1ee","type":"ColumnDataSource"}},"id":"8942469a-a991-41d7-b5d2-f4a0dafddb6b","type":"DrawTool"},{"attributes":{"below":[{"id":"16b3dd8f-9b39-4f93-8e74-3fd3c2fc90cd","type":"LinearAxis"}],"left":[{"id":"35964636-be50-4ede-a667-b7b86e268dd6","type":"LinearAxis"}],"renderers":[{"id":"16b3dd8f-9b39-4f93-8e74-3fd3c2fc90cd","type":"LinearAxis"},{"id":"2b423e50-e5b8-4441-b241-9e0a73a2ccbb","type":"Grid"},{"id":"35964636-be50-4ede-a667-b7b86e268dd6","type":"LinearAxis"},{"id":"fa3fd413-e870-4c15-a31c-4597355a240e","type":"Grid"},{"id":"4ebbb740-b9bc-44e6-897a-7ee74b2fe5aa","type":"GlyphRenderer"}],"title":{"id":"a36acf19-17df-44ef-bf85-cad1442cf55f","type":"Title"},"toolbar":{"id":"90fc8ddb-7e33-48ce-887c-458758f61bcd","type":"Toolbar"},"x_range":{"id":"06c719ee-7cbc-4db7-bc06-a29734aaf53b","type":"Range1d"},"x_scale":{"id":"1d9202f1-2db6-4094-b1e1-6b862ad9be66","type":"LinearScale"},"y_range":{"id":"d0c35cf9-1fd4-4b2a-bedd-80990902b2d1","type":"Range1d"},"y_scale":{"id":"566676c8-281d-42c8-8334-62bc762ae11e","type":"LinearScale"}},"id":"2c40d845-60f2-416b-9c81-3335eb91f260","subtype":"Figure","type":"Plot"}],"root_ids":["2c40d845-60f2-416b-9c81-3335eb91f260"]},"title":"Bokeh Application","version":"0.12.9"}};
                    var render_items = [{"docid":"ae413023-1ccc-48e7-b4ff-0934e12dade4","elementid":"5db61790-b62f-49fc-a247-1ccbb9270e52","modelid":"2c40d845-60f2-416b-9c81-3335eb91f260"}];
                
                    root.Bokeh.embed.embed_items(docs_json, render_items);
                  }
                
                  if (root.Bokeh !== undefined) {
                    embed_document(root);
                  } else {
                    var attempts = 0;
                    var timer = setInterval(function(root) {
                      if (root.Bokeh !== undefined) {
                        embed_document(root);
                        clearInterval(timer);
                      }
                      attempts++;
                      if (attempts > 100) {
                        console.log("Bokeh: ERROR: Unable to embed document because BokehJS library is missing")
                        clearInterval(timer);
                      }
                    }, 10, root)
                  }
                })(window);
              });
            };
            if (document.readyState != "loading") fn();
            else document.addEventListener("DOMContentLoaded", fn);
          })();
        },
        function(Bokeh) {
          console.log("Bokeh: injecting CSS: https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.6.0/katex.min.css");
          Bokeh.embed.inject_css("https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.6.0/katex.min.css");
          console.log("Bokeh: injecting CSS: https://cdn.pydata.org/bokeh/release/bokeh-0.12.9.min.css");
          Bokeh.embed.inject_css("https://cdn.pydata.org/bokeh/release/bokeh-0.12.9.min.css");
          console.log("Bokeh: injecting CSS: https://cdn.pydata.org/bokeh/release/bokeh-widgets-0.12.9.min.css");
          Bokeh.embed.inject_css("https://cdn.pydata.org/bokeh/release/bokeh-widgets-0.12.9.min.css");
          console.log("Bokeh: injecting CSS: https://cdn.pydata.org/bokeh/release/bokeh-tables-0.12.9.min.css");
          Bokeh.embed.inject_css("https://cdn.pydata.org/bokeh/release/bokeh-tables-0.12.9.min.css");
        }
      ];
    
      function run_inline_js() {
        
        for (var i = 0; i < inline_js.length; i++) {
          inline_js[i].call(root, root.Bokeh);
        }
        
      }
    
      if (root._bokeh_is_loading === 0) {
        console.log("Bokeh: BokehJS loaded, going straight to plotting");
        run_inline_js();
      } else {
        load_libs(js_urls, function() {
          console.log("Bokeh: BokehJS plotting callback run at", now());
          run_inline_js();
        });
      }
    }(window));
  };
  if (document.readyState != "loading") fn();
  else document.addEventListener("DOMContentLoaded", fn);
})();
