(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("e39e5e61-15ce-4ef2-ac5b-1e2169545908");
      if (element == null) {
        console.log("Bokeh: ERROR: autoload.js configured with elementid 'e39e5e61-15ce-4ef2-ac5b-1e2169545908' 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_19e8333060364f84afa0c1ffb433f451.my_formatter").MyFormatter,
          "LatexLabel": require("custom/bk_script_3ae07ca84853402c8d2505982164ff11.latex_label").LatexLabel,
          "DrawTool": require("custom/bk_script_502328f464bf49758330ba587c29bc31.draw_tool").DrawTool
              };
              require("base").register_models(models);
              module.exports = models;
            },
            "custom/bk_script_19e8333060364f84afa0c1ffb433f451.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_3ae07ca84853402c8d2505982164ff11.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_502328f464bf49758330ba587c29bc31.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 = {"01c1f316-c2cb-44aa-ad36-eec1f6d2d2f5":{"roots":{"references":[{"attributes":{"dimension":1,"plot":{"id":"4fd5d0c1-0814-4ca0-9b43-8976e4f289a1","subtype":"Figure","type":"Plot"},"ticker":{"id":"2ffcad82-de3d-4fca-9ab2-3c7c8b274ece","type":"BasicTicker"}},"id":"c582dc4a-2a00-4b15-9310-3526056fe367","type":"Grid"},{"attributes":{},"id":"e37df074-366c-403b-92c0-d11be95c9ba2","type":"BasicTickFormatter"},{"attributes":{"source":{"id":"b4e377ca-ff7d-4813-8ef0-d7d83baec686","type":"ColumnDataSource"}},"id":"2ec2a68c-20a4-4105-ba65-832bdf0f79c3","type":"CDSView"},{"attributes":{},"id":"128c1112-60fe-4bfb-ba03-d93a25a4ca03","type":"BasicTicker"},{"attributes":{"plot":null,"text":"Drag to draw on the plot"},"id":"feb92ad0-7f1e-4b51-9ce1-f612f975d3b3","type":"Title"},{"attributes":{"line_color":{"value":"#1f77b4"},"x":{"field":"x"},"y":{"field":"y"}},"id":"f9de7d23-c6a4-44c4-ac1d-477ccfe5e35d","type":"Line"},{"attributes":{"plot":{"id":"4fd5d0c1-0814-4ca0-9b43-8976e4f289a1","subtype":"Figure","type":"Plot"},"ticker":{"id":"128c1112-60fe-4bfb-ba03-d93a25a4ca03","type":"BasicTicker"}},"id":"828ec233-f5dc-4342-9e74-f8b37060af68","type":"Grid"},{"attributes":{},"id":"b4aa334a-5d27-46df-9f2f-a04daf40f691","type":"BasicTickFormatter"},{"attributes":{},"id":"2ffcad82-de3d-4fca-9ab2-3c7c8b274ece","type":"BasicTicker"},{"attributes":{"line_alpha":{"value":0.1},"line_color":{"value":"#1f77b4"},"x":{"field":"x"},"y":{"field":"y"}},"id":"0e4c6e78-d37f-4d87-89cc-b8b187da91f1","type":"Line"},{"attributes":{"source":{"id":"b4e377ca-ff7d-4813-8ef0-d7d83baec686","type":"ColumnDataSource"}},"id":"5cc5aa2a-952b-4b2c-ae11-834a1e63fc74","type":"DrawTool"},{"attributes":{"active_drag":"auto","active_inspect":"auto","active_scroll":"auto","active_tap":"auto","tools":[{"id":"5cc5aa2a-952b-4b2c-ae11-834a1e63fc74","type":"DrawTool"}]},"id":"13244cc8-0c37-409d-a957-dcd71f85bf2f","type":"Toolbar"},{"attributes":{"callback":null,"column_names":["y","x"],"data":{"x":[],"y":[]}},"id":"b4e377ca-ff7d-4813-8ef0-d7d83baec686","type":"ColumnDataSource"},{"attributes":{},"id":"c5a65c07-9aae-4b69-a436-e816c6b225f7","type":"LinearScale"},{"attributes":{"callback":null,"end":10},"id":"d0d9d5aa-08ef-41f4-8917-778e50547fac","type":"Range1d"},{"attributes":{"formatter":{"id":"e37df074-366c-403b-92c0-d11be95c9ba2","type":"BasicTickFormatter"},"plot":{"id":"4fd5d0c1-0814-4ca0-9b43-8976e4f289a1","subtype":"Figure","type":"Plot"},"ticker":{"id":"2ffcad82-de3d-4fca-9ab2-3c7c8b274ece","type":"BasicTicker"}},"id":"1e533e34-211b-4d65-b1b9-c1f8f37184a8","type":"LinearAxis"},{"attributes":{},"id":"d2c8e9ed-0ac1-4e04-a3ff-ac501c075521","type":"LinearScale"},{"attributes":{"data_source":{"id":"b4e377ca-ff7d-4813-8ef0-d7d83baec686","type":"ColumnDataSource"},"glyph":{"id":"f9de7d23-c6a4-44c4-ac1d-477ccfe5e35d","type":"Line"},"hover_glyph":null,"muted_glyph":null,"nonselection_glyph":{"id":"0e4c6e78-d37f-4d87-89cc-b8b187da91f1","type":"Line"},"selection_glyph":null,"view":{"id":"2ec2a68c-20a4-4105-ba65-832bdf0f79c3","type":"CDSView"}},"id":"7ab74635-5770-44a8-9293-5ce3d5a276c6","type":"GlyphRenderer"},{"attributes":{"callback":null,"end":10},"id":"8ce6c165-677b-4c58-a047-96b1aaa3547f","type":"Range1d"},{"attributes":{"formatter":{"id":"b4aa334a-5d27-46df-9f2f-a04daf40f691","type":"BasicTickFormatter"},"plot":{"id":"4fd5d0c1-0814-4ca0-9b43-8976e4f289a1","subtype":"Figure","type":"Plot"},"ticker":{"id":"128c1112-60fe-4bfb-ba03-d93a25a4ca03","type":"BasicTicker"}},"id":"e8ef2226-f0b4-418f-9c21-a28fb6439c19","type":"LinearAxis"},{"attributes":{"below":[{"id":"e8ef2226-f0b4-418f-9c21-a28fb6439c19","type":"LinearAxis"}],"left":[{"id":"1e533e34-211b-4d65-b1b9-c1f8f37184a8","type":"LinearAxis"}],"renderers":[{"id":"e8ef2226-f0b4-418f-9c21-a28fb6439c19","type":"LinearAxis"},{"id":"828ec233-f5dc-4342-9e74-f8b37060af68","type":"Grid"},{"id":"1e533e34-211b-4d65-b1b9-c1f8f37184a8","type":"LinearAxis"},{"id":"c582dc4a-2a00-4b15-9310-3526056fe367","type":"Grid"},{"id":"7ab74635-5770-44a8-9293-5ce3d5a276c6","type":"GlyphRenderer"}],"title":{"id":"feb92ad0-7f1e-4b51-9ce1-f612f975d3b3","type":"Title"},"toolbar":{"id":"13244cc8-0c37-409d-a957-dcd71f85bf2f","type":"Toolbar"},"x_range":{"id":"d0d9d5aa-08ef-41f4-8917-778e50547fac","type":"Range1d"},"x_scale":{"id":"d2c8e9ed-0ac1-4e04-a3ff-ac501c075521","type":"LinearScale"},"y_range":{"id":"8ce6c165-677b-4c58-a047-96b1aaa3547f","type":"Range1d"},"y_scale":{"id":"c5a65c07-9aae-4b69-a436-e816c6b225f7","type":"LinearScale"}},"id":"4fd5d0c1-0814-4ca0-9b43-8976e4f289a1","subtype":"Figure","type":"Plot"}],"root_ids":["4fd5d0c1-0814-4ca0-9b43-8976e4f289a1"]},"title":"Bokeh Application","version":"0.12.9"}};
                    var render_items = [{"docid":"01c1f316-c2cb-44aa-ad36-eec1f6d2d2f5","elementid":"e39e5e61-15ce-4ef2-ac5b-1e2169545908","modelid":"4fd5d0c1-0814-4ca0-9b43-8976e4f289a1"}];
                
                    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);
})();
