(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("58ab0796-80fa-49d6-90f4-f123be0663f5");
      if (element == null) {
        console.log("Bokeh: ERROR: autoload.js configured with elementid '58ab0796-80fa-49d6-90f4-f123be0663f5' but no matching script tag was found. ")
        return false;
      }
    
      var js_urls = ["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(Bokeh) {
          (function() {
            var fn = function() {
              Bokeh.safely(function() {
                (function(root) {
                  function embed_document(root) {
                    var docs_json = {"2203892a-869c-4583-b6c3-7d1901caca1a":{"roots":{"references":[{"attributes":{},"id":"6548512f-6f14-47db-abb1-846bbf4a5ca7","type":"LinearScale"},{"attributes":{},"id":"d212293a-51c8-4f7e-a79b-b4bdcc792050","type":"BasicTicker"},{"attributes":{"data_source":{"id":"d5377384-96cb-4562-8da5-b75c85575e16","type":"ColumnDataSource"},"glyph":{"id":"86fba92c-4942-4d11-bf95-4c51f52fd291","type":"Rect"},"hover_glyph":null,"muted_glyph":null,"nonselection_glyph":{"id":"86fba92c-4942-4d11-bf95-4c51f52fd291","type":"Rect"},"selection_glyph":{"id":"86fba92c-4942-4d11-bf95-4c51f52fd291","type":"Rect"},"view":{"id":"dc58f49d-50b7-40c9-bff9-c210ac4c04e0","type":"CDSView"}},"id":"c8038075-a0aa-4975-b96d-a0c4645afb69","type":"GlyphRenderer"},{"attributes":{"below":[{"id":"d765fcb1-4bdb-4eb6-a5b9-f358370ebb34","type":"LinearAxis"}],"left":[{"id":"60bb6b87-f6be-450f-a2c3-a4d0ac37f08e","type":"LinearAxis"}],"plot_height":400,"plot_width":400,"renderers":[{"id":"d765fcb1-4bdb-4eb6-a5b9-f358370ebb34","type":"LinearAxis"},{"id":"60d14d03-bdf3-426b-b30d-37e48e4a6f82","type":"Grid"},{"id":"60bb6b87-f6be-450f-a2c3-a4d0ac37f08e","type":"LinearAxis"},{"id":"a5bda254-5279-4173-8d05-81e536740fae","type":"Grid"},{"id":"97c12027-7d32-4ff0-bf59-4e7874fbf098","type":"BoxAnnotation"},{"id":"c8038075-a0aa-4975-b96d-a0c4645afb69","type":"GlyphRenderer"}],"title":{"id":"cb18a09b-cd33-4f74-aa45-e7ebc445ed88","type":"Title"},"toolbar":{"id":"e4fbc9b6-d08d-4654-a648-66fcd8a44dd9","type":"Toolbar"},"x_range":{"id":"bf191b90-1f58-4ee1-9fdd-95e07ac9190a","type":"Range1d"},"x_scale":{"id":"6548512f-6f14-47db-abb1-846bbf4a5ca7","type":"LinearScale"},"y_range":{"id":"b2d59b06-9b8c-49c7-ac1d-df8dbf46e499","type":"Range1d"},"y_scale":{"id":"b35c8791-5d96-4160-9649-167f25c71473","type":"LinearScale"}},"id":"166b1b52-f774-470b-800c-5369f1b4dad9","subtype":"Figure","type":"Plot"},{"attributes":{"formatter":{"id":"139ab1a1-9ec7-4b12-bf4b-b5d433e80acc","type":"BasicTickFormatter"},"plot":{"id":"166b1b52-f774-470b-800c-5369f1b4dad9","subtype":"Figure","type":"Plot"},"ticker":{"id":"a30c75e4-9715-40ff-897a-f7efac4354fb","type":"BasicTicker"}},"id":"60bb6b87-f6be-450f-a2c3-a4d0ac37f08e","type":"LinearAxis"},{"attributes":{"callback":null},"id":"bf191b90-1f58-4ee1-9fdd-95e07ac9190a","type":"Range1d"},{"attributes":{"active_drag":"auto","active_inspect":"auto","active_scroll":"auto","active_tap":"auto","tools":[{"id":"a13c495d-89fb-4037-94bf-ccb380282a8f","type":"BoxSelectTool"}]},"id":"e4fbc9b6-d08d-4654-a648-66fcd8a44dd9","type":"Toolbar"},{"attributes":{"plot":{"id":"166b1b52-f774-470b-800c-5369f1b4dad9","subtype":"Figure","type":"Plot"},"ticker":{"id":"d212293a-51c8-4f7e-a79b-b4bdcc792050","type":"BasicTicker"}},"id":"60d14d03-bdf3-426b-b30d-37e48e4a6f82","type":"Grid"},{"attributes":{"callback":null,"column_names":["y","width","height","x"],"data":{"height":[],"width":[],"x":[],"y":[]}},"id":"d5377384-96cb-4562-8da5-b75c85575e16","type":"ColumnDataSource"},{"attributes":{},"id":"139ab1a1-9ec7-4b12-bf4b-b5d433e80acc","type":"BasicTickFormatter"},{"attributes":{"formatter":{"id":"23559f13-6571-45a5-bf25-39ccd3729c5d","type":"BasicTickFormatter"},"plot":{"id":"166b1b52-f774-470b-800c-5369f1b4dad9","subtype":"Figure","type":"Plot"},"ticker":{"id":"d212293a-51c8-4f7e-a79b-b4bdcc792050","type":"BasicTicker"}},"id":"d765fcb1-4bdb-4eb6-a5b9-f358370ebb34","type":"LinearAxis"},{"attributes":{},"id":"b35c8791-5d96-4160-9649-167f25c71473","type":"LinearScale"},{"attributes":{"bottom_units":"screen","fill_alpha":{"value":0.5},"fill_color":{"value":"lightgrey"},"left_units":"screen","level":"overlay","line_alpha":{"value":1.0},"line_color":{"value":"black"},"line_dash":[4,4],"line_width":{"value":2},"plot":null,"render_mode":"css","right_units":"screen","top_units":"screen"},"id":"97c12027-7d32-4ff0-bf59-4e7874fbf098","type":"BoxAnnotation"},{"attributes":{"fill_alpha":{"value":0.3},"fill_color":{"value":"#009933"},"height":{"field":"height","units":"data"},"width":{"field":"width","units":"data"},"x":{"field":"x"},"y":{"field":"y"}},"id":"86fba92c-4942-4d11-bf95-4c51f52fd291","type":"Rect"},{"attributes":{"source":{"id":"d5377384-96cb-4562-8da5-b75c85575e16","type":"ColumnDataSource"}},"id":"dc58f49d-50b7-40c9-bff9-c210ac4c04e0","type":"CDSView"},{"attributes":{"callback":null},"id":"b2d59b06-9b8c-49c7-ac1d-df8dbf46e499","type":"Range1d"},{"attributes":{},"id":"a30c75e4-9715-40ff-897a-f7efac4354fb","type":"BasicTicker"},{"attributes":{"plot":null,"text":"Select Below"},"id":"cb18a09b-cd33-4f74-aa45-e7ebc445ed88","type":"Title"},{"attributes":{"args":{"source":{"id":"d5377384-96cb-4562-8da5-b75c85575e16","type":"ColumnDataSource"}},"code":"\n        // get data source from Callback args\n        var data = source.data;\n\n        /// get BoxSelectTool dimensions from cb_data parameter of Callback\n        var geometry = cb_data['geometry'];\n\n        /// calculate Rect attributes\n        var width = geometry['x1'] - geometry['x0'];\n        var height = geometry['y1'] - geometry['y0'];\n        var x = geometry['x0'] + width/2;\n        var y = geometry['y0'] + height/2;\n\n        /// update data source with new Rect attributes\n        data['x'].push(x);\n        data['y'].push(y);\n        data['width'].push(width);\n        data['height'].push(height);\n\n        // emit update of data source\n        source.change.emit();\n    "},"id":"9b777ebe-cb5d-41da-b362-9d8d9a509dc6","type":"CustomJS"},{"attributes":{},"id":"23559f13-6571-45a5-bf25-39ccd3729c5d","type":"BasicTickFormatter"},{"attributes":{"callback":{"id":"9b777ebe-cb5d-41da-b362-9d8d9a509dc6","type":"CustomJS"},"overlay":{"id":"97c12027-7d32-4ff0-bf59-4e7874fbf098","type":"BoxAnnotation"}},"id":"a13c495d-89fb-4037-94bf-ccb380282a8f","type":"BoxSelectTool"},{"attributes":{"dimension":1,"plot":{"id":"166b1b52-f774-470b-800c-5369f1b4dad9","subtype":"Figure","type":"Plot"},"ticker":{"id":"a30c75e4-9715-40ff-897a-f7efac4354fb","type":"BasicTicker"}},"id":"a5bda254-5279-4173-8d05-81e536740fae","type":"Grid"}],"root_ids":["166b1b52-f774-470b-800c-5369f1b4dad9"]},"title":"Bokeh Application","version":"0.12.9"}};
                    var render_items = [{"docid":"2203892a-869c-4583-b6c3-7d1901caca1a","elementid":"58ab0796-80fa-49d6-90f4-f123be0663f5","modelid":"166b1b52-f774-470b-800c-5369f1b4dad9"}];
                
                    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://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);
})();
