window.Bokeh=Bokeh=function(){var t=void 0;return function e(t,n,r){function o(i){function s(e){var n=t[i][1][e];return o(n?n:e)}if(!n[i]){if(!t[i]){var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var l=n[i]={exports:{}};s.modules=o.modules,t[i][0].call(l.exports,s,l,l.exports,e,t,n,r)}return n[i].exports}o.modules=t;for(var i=null,s=0;s0?i.prefix=f.slice(0,f.lastIndexOf("/bokeh"))+"/":i.prefix="/",console.log("Bokeh: setting prefix to",i.prefix),c=t("./models"),u={},d=function(t){var e;return new(e=function(e){function n(){return n.__super__.constructor.apply(this,arguments)}return g(n,e),n.prototype.model=t,n}(r))},_=function(t){var e,n,r,o,i,a,l,u,h;i={};for(r in t)if(a=t[r],s.isArray(a)){u=a[0],h=null!=(o=a[1])?o:"";for(l in u)e=u[l],n=l+h,i[n]=e}else i[r]=a;return i},l=null,a=function(){return null==l&&(l=_(c)),l},o=function(t){var e,n;if(n=a(),u[t])return u[t];if(e=n[t],null==e)throw new Error("Module `"+t+"' does not exists. The problem may be two fold. Either a model was requested that's available in an extra bundle, e.g. a widget, or a custom model was requested, but it wasn't registered before first usage.");return null==e.Collection&&(e.Collection=d(e.Model)),e.Collection},o.register=function(t,e){return u[t]=e},o.register_locations=function(t,e,n){var r,o,i,s,l;null==e&&(e=!1),null==n&&(n=null),o=a(),r=_(t),l=[];for(s in r)y.call(r,s)&&(i=r[s],e||!o.hasOwnProperty(s)?l.push(o[s]=i):l.push("function"==typeof n?n(s):void 0));return l},o.registered_names=function(){return Object.keys(a())},h={},e.exports={collection_overrides:u,locations:c,index:h,Collections:o,Config:i}},{"./collection":"common/collection","./custom":"common/custom","./logging":"common/logging","./models":"common/models",underscore:"underscore"}],"common/bbox":[function(t,e,n){var r,o;r=function(){return[[1/0,-(1/0)],[1/0,-(1/0)]]},o=function(t,e){return t[0][0]=Math.min(t[0][0],e[0][0]),t[0][1]=Math.max(t[0][1],e[0][1]),t[1][0]=Math.min(t[1][0],e[1][0]),t[1][1]=Math.max(t[1][1],e[1][1]),t},e.exports={empty:r,extend:o}},{}],"common/build_views":[function(t,e,n){var r,o,i;r=t("underscore"),o=function(t,e,n,o){var s,a,l,u,h,c,p,_,d,f,m;for(null==o&&(o=[]),s=[],d=r.filter(e,function(e){return!r.has(t,e.id)}),l=a=0,c=d.length;c>a;l=++a)_=d[l],m=r.extend({},n,{model:_}),lu;u++)h=f[u],t[h].remove(),delete t[h];return s},i=function(t){var e,n;if(null!=t.className)return e=t.className.split(" "),n=r.map(e,function(t){return t=t.trim(),0===t.indexOf("ui-")?"bk-"+t:t}),n.join(" ")},o.jQueryUIPrefixer=i,e.exports=o=o},{underscore:"underscore"}],"common/canvas":[function(t,e,n){var r,o,i,s,a,l,u,h,c,p,_,d,f=function(t,e){function n(){this.constructor=t}for(var r in e)m.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},m={}.hasOwnProperty;c=t("underscore"),_=t("kiwi"),a=_.Expression,i=_.Constraint,u=_.Operator,p=t("./canvas_template"),s=t("./continuum_view"),l=t("./layout_box"),d=t("./logging").logger,h=t("./solver"),o=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return f(e,t),e.prototype.className="bk-canvas-wrapper",e.prototype.template=p,e.prototype.initialize=function(t){var n,r,o;return e.__super__.initialize.call(this,t),o={map:this.mget("map")},n=this.template(o),this.$el.html(n),this.canvas_wrapper=this.$el,this.canvas=this.$("canvas.bk-canvas"),this.canvas_events=this.$("div.bk-canvas-events"),this.canvas_overlay=this.$("div.bk-canvas-overlays"),this.map_div=null!=(r=this.$("div.bk-canvas-map"))?r:null,this.ctx=this.canvas[0].getContext("2d"),this.ctx.glcanvas=null,d.debug("CanvasView initialized")},e.prototype.render=function(t){var e,n,r,o,i;return null==t&&(t=!1),this.model.new_bounds||t?(this.mget("use_hidpi")?(n=window.devicePixelRatio||1,e=this.ctx.webkitBackingStorePixelRatio||this.ctx.mozBackingStorePixelRatio||this.ctx.msBackingStorePixelRatio||this.ctx.oBackingStorePixelRatio||this.ctx.backingStorePixelRatio||1,o=n/e):o=1,i=this.mget("width"),r=this.mget("height"),this.$el.attr("style","z-index: 50; width:"+i+"px; height:"+r+"px"),this.canvas.attr("style","width:"+i+"px;height:"+r+"px"),this.canvas.attr("width",i*o).attr("height",r*o),this.$el.attr("width",i).attr("height",r),this.canvas_events.attr("style","z-index:100; position:absolute; top:0; left:0; width:"+i+"px; height:"+r+"px;"),this.canvas_overlay.attr("style","z-index:75; position:absolute; top:0; left:0; width:"+i+"px; height:"+r+"px;"),this.ctx.scale(o,o),this.ctx.translate(.5,.5),this._fixup_line_dash(this.ctx),this._fixup_line_dash_offset(this.ctx),this._fixup_image_smoothing(this.ctx),this._fixup_measure_text(this.ctx),this.model.new_bounds=!1):void 0},e.prototype._fixup_line_dash=function(t){return t.setLineDash||(t.setLineDash=function(e){return t.mozDash=e,t.webkitLineDash=e}),t.getLineDash?void 0:t.getLineDash=function(){return t.mozDash}},e.prototype._fixup_line_dash_offset=function(t){return t.setLineDashOffset=function(e){return t.lineDashOffset=e,t.mozDashOffset=e,t.webkitLineDashOffset=e},t.getLineDashOffset=function(){return t.mozDashOffset}},e.prototype._fixup_image_smoothing=function(t){return t.setImageSmoothingEnabled=function(e){return t.imageSmoothingEnabled=e,t.mozImageSmoothingEnabled=e,t.oImageSmoothingEnabled=e,t.webkitImageSmoothingEnabled=e},t.getImageSmoothingEnabled=function(){var e;return null!=(e=t.imageSmoothingEnabled)?e:!0}},e.prototype._fixup_measure_text=function(t){return t.measureText&&null==t.html5MeasureText?(t.html5MeasureText=t.measureText,t.measureText=function(e){var n;return n=t.html5MeasureText(e),n.ascent=1.6*t.html5MeasureText("m").width,n}):void 0},e}(s),r=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return f(e,t),e.prototype.type="Canvas",e.prototype.default_view=o,e.prototype.initialize=function(t,n){var r;return r=new h,this.set("solver",r),e.__super__.initialize.call(this,t,n),this.new_bounds=!0,r.add_constraint(new i(new a(this._left),u.Eq)),r.add_constraint(new i(new a(this._bottom),u.Eq)),this._set_dims([this.get("canvas_width"),this.get("canvas_height")]),d.debug("Canvas initialized")},e.prototype.vx_to_sx=function(t){return t},e.prototype.vy_to_sy=function(t){return this.get("height")-(t+1)},e.prototype.v_vx_to_sx=function(t){var e,n,r,o;for(n=e=0,r=t.length;r>e;n=++e)o=t[n],t[n]=o;return t},e.prototype.v_vy_to_sy=function(t){var e,n,r,o,i;for(e=this.get("height"),r=n=0,o=t.length;o>n;r=++n)i=t[r],t[r]=e-(i+1);return t},e.prototype.sx_to_vx=function(t){return t},e.prototype.sy_to_vy=function(t){return this.get("height")-(t+1)},e.prototype.v_sx_to_vx=function(t){var e,n,r,o;for(n=e=0,r=t.length;r>e;n=++e)o=t[n],t[n]=o;return t},e.prototype.v_sy_to_vy=function(t){var e,n,r,o,i;for(e=this.get("height"),r=n=0,o=t.length;o>n;r=++n)i=t[r],t[r]=e-(i+1);return t},e.prototype._set_width=function(t,e){return null==e&&(e=!0),null!=this._width_constraint&&this.solver.remove_constraint(this._width_constraint),this._width_constraint=new i(new a(this._width,-t),u.Eq),this.solver.add_constraint(this._width_constraint),e&&this.solver.update_variables(),this.new_bounds=!0},e.prototype._set_height=function(t,e){return null==e&&(e=!0),null!=this._height_constraint&&this.solver.remove_constraint(this._height_constraint),this._height_constraint=new i(new a(this._height,-t),u.Eq),this.solver.add_constraint(this._height_constraint),e&&this.solver.update_variables(),this.new_bounds=!0},e.prototype._set_dims=function(t,e){return null==e&&(e=!0),this._set_width(t[0],!1),this._set_height(t[1],!1),this.solver.update_variables(e)},e.prototype.defaults=function(){return c.extend({},e.__super__.defaults.call(this),{width:300,height:300,map:!1,mousedown_callbacks:[],mousemove_callbacks:[],use_hidpi:!0})},e}(l.Model),e.exports={Model:r}},{"./canvas_template":"common/canvas_template","./continuum_view":"common/continuum_view","./layout_box":"common/layout_box","./logging":"common/logging","./solver":"common/solver",kiwi:"kiwi",underscore:"underscore"}],"common/canvas_template":[function(t,e,n){e.exports=function(t){t||(t={});var e,n=[],r=t.safe,o=t.escape;return e=t.safe=function(t){if(t&&t.ecoSafe)return t;("undefined"==typeof t||null==t)&&(t="");var e=new String(t);return e.ecoSafe=!0,e},o||(o=t.escape=function(t){return(""+t).replace(/&/g,"&").replace(//g,">").replace(/"/g,""")}),function(){(function(){this.map&&n.push('\n
\n'),n.push('\n
\n
\n')}).call(this)}.call(t),t.safe=r,t.escape=o,n.join("")}},{}],"common/cartesian_frame":[function(t,e,n){var r,o,i,s,a,l,u,h,c=function(t,e){function n(){this.constructor=t}for(var r in e)p.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},p={}.hasOwnProperty;u=t("underscore"),s=t("./layout_box"),h=t("./logging").logging,a=t("../models/mappers/linear_mapper"),l=t("../models/mappers/log_mapper"),o=t("../models/mappers/categorical_mapper"),i=t("../models/mappers/grid_mapper"),r=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return c(e,t),e.prototype.type="CartesianFrame",e.prototype.initialize=function(t,n){return e.__super__.initialize.call(this,t,n),this.register_property("x_ranges",function(){return this._get_ranges("x")},!0),this.add_dependencies("x_ranges",this,["x_range","extra_x_ranges"]),this.register_property("y_ranges",function(){return this._get_ranges("y")},!0),this.add_dependencies("y_ranges",this,["y_range","extra_y_ranges"]),this.register_property("x_mappers",function(){return this._get_mappers("x",this.get("x_ranges"),this.get("h_range"))},!0),this.add_dependencies("x_ranges",this,["x_ranges","h_range"]),this.register_property("y_mappers",function(){return this._get_mappers("y",this.get("y_ranges"),this.get("v_range"))},!0),this.add_dependencies("y_ranges",this,["y_ranges","v_range"]),this.register_property("mapper",function(){return new i.Model({domain_mapper:this.get("x_mapper"),codomain_mapper:this.get("y_mapper")})},!0),this.add_dependencies("mapper",this,["x_mapper","y_mapper"]),this.listenTo(this.solver,"layout_update",this._update_mappers)},e.prototype.map_to_screen=function(t,e,n,r,o){var i,s,a,l;return null==r&&(r="default"),null==o&&(o="default"),a=this.get("x_mappers")[r].v_map_to_target(t),i=n.v_vx_to_sx(a),l=this.get("y_mappers")[o].v_map_to_target(e),s=n.v_vy_to_sy(l),[i,s]},e.prototype._get_ranges=function(t){var e,n,r,o;if(o={},o["default"]=this.get(t+"_range"),e=this.get("extra_"+t+"_ranges"),null!=e)for(n in e)r=e[n],o[n]=this.resolve_ref(r);return o},e.prototype._get_mappers=function(t,e,n){var r,i,s,u;i={};for(s in e){if(u=e[s],"Range1d"===u.type||"DataRange1d"===u.type)r="log"===this.get(t+"_mapper_type")?l.Model:a.Model;else{if("FactorRange"!==u.type)return logger.warn("unknown range type for range '"+s+"': "+u),null;r=o.Model}i[s]=new r({source_range:u,target_range:n})}return i},e.prototype._update_mappers=function(){var t,e,n,r,o;n=this.get("x_mappers");for(e in n)t=n[e],t.set("target_range",this.get("h_range"));r=this.get("y_mappers"),o=[];for(e in r)t=r[e],o.push(t.set("target_range",this.get("v_range")));return o},e.prototype.defaults=function(){return u.extend({},e.__super__.defaults.call(this),{extra_x_ranges:{},extra_y_ranges:{}})},e}(s.Model),e.exports={Model:r}},{"../models/mappers/categorical_mapper":"models/mappers/categorical_mapper","../models/mappers/grid_mapper":"models/mappers/grid_mapper","../models/mappers/linear_mapper":"models/mappers/linear_mapper","../models/mappers/log_mapper":"models/mappers/log_mapper","./layout_box":"common/layout_box","./logging":"common/logging",underscore:"underscore"}],"common/client":[function(t,e,n){var r,o,i,s,a,l,u,h,c,p,_,d,f,m,g,y;d=t("underscore"),c=t("es6-promise").Promise,f=t("./logging").logger,y=t("./document"),a=y.Document,h=y.ModelChangedEvent,p=y.RootAddedEvent,_=y.RootRemovedEvent,l=t("./has_props"),i="ws://localhost:5006/ws",s="default",u=function(){function t(t,e,n){this.header=t,this.metadata=e,this.content=n,this.buffers=[]}return t.assemble=function(e,n,r){var o,i,s,a,l;try{return a=JSON.parse(e),l=JSON.parse(n),o=JSON.parse(r),new t(a,l,o)}catch(s){throw i=s,f.error("Failure parsing json "+i+" "+e+" "+n+" "+r,i),i}},t.create_header=function(t,e){var n;return n={msgid:d.uniqueId(),msgtype:t},d.extend(n,e)},t.create=function(e,n,r){var o;return null==r&&(r={}),o=t.create_header(e,n),new t(o,{},r)},t.prototype.send=function(t){var e,n,r,o,i;try{return o=JSON.stringify(this.header),i=JSON.stringify(this.metadata),e=JSON.stringify(this.content),t.send(o),t.send(i),t.send(e)}catch(r){throw n=r,f.error("Error sending ",this,n),n}},t.prototype.complete=function(){return null!=this.header&&null!=this.metadata&&null!=this.content?"num_buffers"in this.header?this.buffers.length===this.header.num_buffers:!0:!1},t.prototype.add_buffer=function(t){return this.buffers.push(t)},t.prototype._header_field=function(t){return t in this.header?this.header[t]:null},t.prototype.msgid=function(){return this._header_field("msgid")},t.prototype.msgtype=function(){return this._header_field("msgtype")},t.prototype.sessid=function(){return this._header_field("sessid")},t.prototype.reqid=function(){return this._header_field("reqid")},t.prototype.problem=function(){return"msgid"in this.header?"msgtype"in this.header?null:"No msgtype in header":"No msgid in header"},t}(),m={"PATCH-DOC":function(t,e){return t._for_session(function(t){return t._handle_patch(e)})},OK:function(t,e){return f.debug("Unhandled OK reply to "+e.reqid())},ERROR:function(t,e){return f.error("Unhandled ERROR reply to "+e.reqid()+": "+e.content.text)}},r=function(){function t(e,n,r,o){this.url=e,this.id=n,this._on_have_session_hook=r,this._on_closed_permanently_hook=o,this._number=t._connection_count,t._connection_count=this._number+1,null==this.url&&(this.url=i),null==this.id&&(this.id=s),f.debug("Creating websocket "+this._number+" to '"+this.url+"' session '"+this.id+"'"),this.socket=null,this.closed_permanently=!1,this._fragments=[],this._partial=null,this._current_handler=null,this._pending_ack=null,this._pending_replies={},this.session=null}return t._connection_count=0,t.prototype._for_session=function(t){return null!==this.session?t(this.session):void 0},t.prototype.connect=function(){var t,e,n;if(this.closed_permanently)return c.reject(new Error("Cannot connect() a closed ClientConnection"));if(null!=this.socket)return c.reject(new Error("Already connected"));this._fragments=[],this._partial=null,this._pending_replies={},this._current_handler=null;try{return n=this.url+"?bokeh-protocol-version=1.0&bokeh-session-id="+this.id,null!=window.MozWebSocket?this.socket=new MozWebSocket(n):this.socket=new WebSocket(n),new c(function(t){return function(e,n){return t.socket.binarytype="arraybuffer",t.socket.onopen=function(){return t._on_open(e,n)},t.socket.onmessage=function(e){return t._on_message(e)},t.socket.onclose=function(e){return t._on_close(e)},t.socket.onerror=function(){return t._on_error(n)}}}(this))}catch(e){return t=e,f.error("websocket creation failed to url: "+this.url),f.error(" - "+t),c.reject(t)}},t.prototype.close=function(){return this.closed_permanently||(f.debug("Permanently closing websocket connection "+this._number),this.closed_permanently=!0,null!=this.socket&&this.socket.close(1e3,"close method called on ClientConnection "+this._number),this._for_session(function(t){return t._connection_closed()}),null==this._on_closed_permanently_hook)?void 0:(this._on_closed_permanently_hook(),this._on_closed_permanently_hook=null)},t.prototype._schedule_reconnect=function(t){var e;return e=function(t){return function(){t.closed_permanently||f.info("Websocket connection "+t._number+" disconnected, will not attempt to reconnect")}}(this),setTimeout(e,t)},t.prototype.send=function(t){var e,n;try{if(null===this.socket)throw new Error("not connected so cannot send "+t);return t.send(this.socket)}catch(n){return e=n,f.error("Error sending message ",e,t)}},t.prototype.send_with_reply=function(t){var e;return e=new c(function(e){return function(n,r){return e._pending_replies[t.msgid()]=[n,r],e.send(t)}}(this)),e.then(function(t){if("ERROR"===t.msgtype())throw new Error("Error reply "+t.content.text);return t},function(t){throw t})},t.prototype._pull_doc_json=function(){var t,e;return t=u.create("PULL-DOC-REQ",{}),e=this.send_with_reply(t),e.then(function(t){if(!("doc"in t.content))throw new Error("No 'doc' field in PULL-DOC-REPLY");return t.content.doc},function(t){throw t})},t.prototype._repull_session_doc=function(){return null===this.session?f.debug("Pulling session for first time"):f.debug("Repulling session"),this._pull_doc_json().then(function(t){return function(e){var n,r,i;return null!==t.session?(t.session.document.replace_with_json(e),f.debug("Updated existing session with new pulled doc")):t.closed_permanently?f.debug("Got new document after connection was already closed"):(n=a.from_json(e),r=a._compute_patch_since_json(e,n),r.events.length>0&&(f.debug("Sending "+r.events.length+" changes from model construction back to server"),i=u.create("PATCH-DOC",{},r),t.send(i)),t.session=new o(t,n,t.id),f.debug("Created a new session from new pulled doc"),null!=t._on_have_session_hook?(t._on_have_session_hook(t.session),t._on_have_session_hook=null):void 0)}}(this),function(t){throw t})["catch"](function(t){return null!=console.trace&&console.trace(t),f.error("Failed to repull session "+t)})},t.prototype._on_open=function(t,e){return f.info("Websocket connection "+this._number+" is now open"),this._pending_ack=[t,e],this._current_handler=function(t){return function(e){return t._awaiting_ack_handler(e)}}(this)},t.prototype._on_message=function(t){var e,n;try{return this._on_message_unchecked(t)}catch(n){return e=n,f.error("Error handling message: "+e+", "+t)}},t.prototype._on_message_unchecked=function(t){var e,n;return null==this._current_handler&&f.error("got a message but haven't set _current_handler"),t.data instanceof ArrayBuffer?null==this._partial||this._partial.complete()?this._close_bad_protocol("Got binary from websocket but we were expecting text"):this._partial.add_buffer(t.data):null!=this._partial?this._close_bad_protocol("Got text from websocket but we were expecting binary"):(this._fragments.push(t.data),3===this._fragments.length&&(this._partial=u.assemble(this._fragments[0],this._fragments[1],this._fragments[2]),this._fragments=[],n=this._partial.problem(),null!==n&&this._close_bad_protocol(n))),null!=this._partial&&this._partial.complete()?(e=this._partial,this._partial=null,this._current_handler(e)):void 0},t.prototype._on_close=function(t){var e,n;for(f.info("Lost websocket "+this._number+" connection, "+t.code+" ("+t.reason+")"),this.socket=null,null!=this._pending_ack&&(this._pending_ack[1](new Error("Lost websocket connection, "+t.code+" ("+t.reason+")")),this._pending_ack=null),e=function(){var t,e,n;e=this._pending_replies;for(n in e)return t=e[n],delete this._pending_replies[n],t;return null},n=e();null!==n;)n[1]("Disconnected"),n=e();return this.closed_permanently?void 0:this._schedule_reconnect(2e3)},t.prototype._on_error=function(t){return f.debug("Websocket error on socket "+this._number),t(new Error("Could not open websocket"))},t.prototype._close_bad_protocol=function(t){return f.error("Closing connection: "+t),null!=this.socket?this.socket.close(1002,t):void 0},t.prototype._awaiting_ack_handler=function(t){return"ACK"!==t.msgtype()?this._close_bad_protocol("First message was not an ACK"):(this._current_handler=function(t){return function(e){return t._steady_state_handler(e)}}(this),this._repull_session_doc(),null!=this._pending_ack?(this._pending_ack[0](this),this._pending_ack=null):void 0)},t.prototype._steady_state_handler=function(t){var e;return t.reqid()in this._pending_replies?(e=this._pending_replies[t.reqid()],delete this._pending_replies[t.reqid()],e[0](t)):t.msgtype()in m?m[t.msgtype()](this,t):f.debug("Doing nothing with message "+t.msgtype())},t}(),o=function(){function t(t,e,n){this._connection=t,this.document=e,this.id=n,this._current_patch=null,this.document_listener=function(t){return function(e){return t._document_changed(e)}}(this),this.document.on_change(this.document_listener)}return t.prototype.close=function(){return this._connection.close()},t.prototype._connection_closed=function(){return this.document.remove_on_change(this.document_listener)},t.prototype.request_server_info=function(){var t,e;return t=u.create("SERVER-INFO-REQ",{}),e=this._connection.send_with_reply(t),e.then(function(t){return t.content})},t.prototype.force_roundtrip=function(){return this.request_server_info().then(function(t){})},t.prototype._should_suppress_on_change=function(t,e){var n,r,o,i,s,a,u,c,f,m,g,y,v,b;if(e instanceof h){for(g=t.content.events,r=0,a=g.length;a>r;r++)if(n=g[r],"ModelChanged"===n.kind&&n.model.id===e.model.id&&n.attr===e.attr)if(m=n["new"],e.new_ instanceof l){if("object"==typeof m&&"id"in m&&m.id===e.new_.id)return!0}else if(d.isEqual(m,e.new_))return!0}else if(e instanceof p){for(y=t.content.events,o=0,u=y.length;u>o;o++)if(n=y[o],"RootAdded"===n.kind&&n.model.id===e.model.id)return!0}else if(e instanceof _){for(v=t.content.events,i=0,c=v.length;c>i;i++)if(n=v[i],"RootRemoved"===n.kind&&n.model.id===e.model.id)return!0}else if(e instanceof TitleChangedEvent)for(b=t.content.events,s=0,f=b.length;f>s;s++)if(n=b[s],"TitleChanged"===n.kind&&n.title===e.title)return!0;return!1},t.prototype._document_changed=function(t){var e;if(!(null!=this._current_patch&&this._should_suppress_on_change(this._current_patch,t)||t instanceof h&&!(t.attr in t.model.serializable_attributes())))return e=u.create("PATCH-DOC",{},this.document.create_json_patch([t])),this._connection.send(e)},t.prototype._handle_patch=function(t){this._current_patch=t;try{return this.document.apply_json_patch(t.content)}finally{this._current_patch=null}},t}(),g=function(t,e){var n,o,i;return i=null,n=null,o=new c(function(o,i){return n=new r(t,e,function(t){var e,n;try{return o(t)}catch(n){throw e=n,f.error("Promise handler threw an error, closing session "+error),t.close(),e}},function(){return i(new Error("Connection was closed before we successfully pulled a session"))}),n.connect().then(function(t){},function(t){throw f.error("Failed to connect to Bokeh server "+t),t})}),o.close=function(){return n.close()},o},e.exports={pull_session:g,DEFAULT_SERVER_WEBSOCKET_URL:i,DEFAULT_SESSION_ID:s}},{"./document":"common/document","./has_props":"common/has_props","./logging":"common/logging","es6-promise":"es6-promise",underscore:"underscore"}],"common/collection":[function(t,e,n){var r,o,i=function(t,e){function n(){this.constructor=t}for(var r in e)s.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},s={}.hasOwnProperty;r=t("backbone"),o=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return i(e,t),e}(r.Collection),e.exports=o},{backbone:"backbone"}],"common/color":[function(t,e,n){var r,o,i,s;o=function(t){var e;return e=Number(t).toString(16),e=1===e.length?"0"+e:e},i=function(t){var e,n,i;return t+="",0===t.indexOf("#")?t:null!=r[t]?r[t]:0===t.indexOf("rgb")?(n=t.match(/\d+/g),e=function(){var t,e,r;for(r=[],t=0,e=n.length;e>t;t++)i=n[t],r.push(o(i));return r}().join(""),"#"+e.slice(0,8)):t},s=function(t,e){var n,r,o;if(null==e&&(e=1),!t)return[0,0,0,0];for(n=i(t),n=n.replace(/ |#/g,""),n.length<=4&&(n=n.replace(/(.)/g,"$1$1")),n=n.match(/../g),o=function(){var t,e,o;for(o=[],t=0,e=n.length;e>t;t++)r=n[t],o.push(parseInt(r,16)/255);return o}();o.length<3;)o.push(0);return o.length<4&&o.push(e),o.slice(0,4)},r={k:"#000000",w:"#FFFFFF",r:"#FF0000",g:"#00FF00",b:"#0000FF",y:"#FFFF00",m:"#FF00FF",c:"#00FFFF",aqua:"#00ffff",aliceblue:"#f0f8ff",antiquewhite:"#faebd7",black:"#000000",blue:"#0000ff",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgreen:"#006400",darkturquoise:"#00ced1",deepskyblue:"#00bfff",green:"#008000",lime:"#00ff00",mediumblue:"#0000cd",mediumspringgreen:"#00fa9a",navy:"#000080",springgreen:"#00ff7f",teal:"#008080",midnightblue:"#191970",dodgerblue:"#1e90ff",lightseagreen:"#20b2aa",forestgreen:"#228b22",seagreen:"#2e8b57",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",limegreen:"#32cd32",mediumseagreen:"#3cb371",turquoise:"#40e0d0",royalblue:"#4169e1",steelblue:"#4682b4",darkslateblue:"#483d8b",mediumturquoise:"#48d1cc",indigo:"#4b0082",darkolivegreen:"#556b2f",cadetblue:"#5f9ea0",cornflowerblue:"#6495ed",mediumaquamarine:"#66cdaa",dimgray:"#696969",dimgrey:"#696969",slateblue:"#6a5acd",olivedrab:"#6b8e23",slategray:"#708090",slategrey:"#708090",lightslategray:"#778899",lightslategrey:"#778899",mediumslateblue:"#7b68ee",lawngreen:"#7cfc00",aquamarine:"#7fffd4",chartreuse:"#7fff00",gray:"#808080",grey:"#808080",maroon:"#800000",olive:"#808000",purple:"#800080",lightskyblue:"#87cefa",skyblue:"#87ceeb",blueviolet:"#8a2be2",darkmagenta:"#8b008b",darkred:"#8b0000",saddlebrown:"#8b4513",darkseagreen:"#8fbc8f",lightgreen:"#90ee90",mediumpurple:"#9370db",darkviolet:"#9400d3",palegreen:"#98fb98",darkorchid:"#9932cc",yellowgreen:"#9acd32",sienna:"#a0522d",brown:"#a52a2a",darkgray:"#a9a9a9",darkgrey:"#a9a9a9",greenyellow:"#adff2f",lightblue:"#add8e6",paleturquoise:"#afeeee",lightsteelblue:"#b0c4de",powderblue:"#b0e0e6",firebrick:"#b22222",darkgoldenrod:"#b8860b",mediumorchid:"#ba55d3",rosybrown:"#bc8f8f",darkkhaki:"#bdb76b",silver:"#c0c0c0",mediumvioletred:"#c71585",indianred:"#cd5c5c",peru:"#cd853f",chocolate:"#d2691e",tan:"#d2b48c",lightgray:"#d3d3d3",lightgrey:"#d3d3d3",thistle:"#d8bfd8",goldenrod:"#daa520",orchid:"#da70d6",palevioletred:"#db7093",crimson:"#dc143c",gainsboro:"#dcdcdc",plum:"#dda0dd",burlywood:"#deb887",lightcyan:"#e0ffff",lavender:"#e6e6fa",darksalmon:"#e9967a",palegoldenrod:"#eee8aa",violet:"#ee82ee",azure:"#f0ffff",honeydew:"#f0fff0",khaki:"#f0e68c",lightcoral:"#f08080",sandybrown:"#f4a460",beige:"#f5f5dc",mintcream:"#f5fffa",wheat:"#f5deb3",whitesmoke:"#f5f5f5",ghostwhite:"#f8f8ff",lightgoldenrodyellow:"#fafad2",linen:"#faf0e6",salmon:"#fa8072",oldlace:"#fdf5e6",bisque:"#ffe4c4",blanchedalmond:"#ffebcd",coral:"#ff7f50",cornsilk:"#fff8dc",darkorange:"#ff8c00",deeppink:"#ff1493",floralwhite:"#fffaf0",fuchsia:"#ff00ff",gold:"#ffd700",hotpink:"#ff69b4",ivory:"#fffff0",lavenderblush:"#fff0f5",lemonchiffon:"#fffacd",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightyellow:"#ffffe0",magenta:"#ff00ff",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",orange:"#ffa500",orangered:"#ff4500",papayawhip:"#ffefd5",peachpuff:"#ffdab9",pink:"#ffc0cb",red:"#ff0000",seashell:"#fff5ee",snow:"#fffafa",tomato:"#ff6347",white:"#ffffff",yellow:"#ffff00"},e.exports={color2hex:i,color2rgba:s}},{}],"common/continuum_view":[function(t,e,n){var r,o,i,s=function(t,e){function n(){this.constructor=t}for(var r in e)a.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},a={}.hasOwnProperty;i=t("underscore"),r=t("backbone"),o=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return s(e,t),e.prototype.initialize=function(t){return i.has(t,"id")?void 0:this.id=i.uniqueId("ContinuumView")},e.prototype.bind_bokeh_events=function(){return"pass"},e.prototype.delegateEvents=function(t){return e.__super__.delegateEvents.call(this,t)},e.prototype.remove=function(){var t,n,r;if(i.has(this,"eventers")){t=this.eventers;for(n in t)a.call(t,n)&&(r=t[n],r.off(null,null,this))}return this.trigger("remove",this),e.__super__.remove.call(this)},e.prototype.mget=function(){return this.model.get.apply(this.model,arguments)},e.prototype.mset=function(){return this.model.set.apply(this.model,arguments)},e.prototype.render_end=function(){return"pass"},e}(r.View),e.exports=o},{backbone:"backbone",underscore:"underscore"}],"common/custom":[function(t,e,n){var r,o;r=t("underscore"),o=function(){return r.uniqueId=function(t){var e,n,r,o,i;for(o=[],e="0123456789ABCDEF",n=r=0;31>=r;n=++r)o[n]=e.substr(Math.floor(16*Math.random()),1);return o[12]="4",o[16]=e.substr(3&o[16]|8,1),i=o.join(""),t?t+"-"+i:i}},r.isNullOrUndefined=function(t){return r.isNull(t)||r.isUndefined(t)},r.setdefault=function(t,e,n){return r.has(t,e)?t[e]:(t[e]=n,n)},e.exports={monkey_patch:o}},{underscore:"underscore"}],"common/document":[function(t,e,n){var r,o,i,s,a,l,u,h,c,p,_,d,f=function(t,e){function n(){this.constructor=t}for(var r in e)m.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},m={}.hasOwnProperty,g=[].indexOf||function(t){for(var e=0,n=this.length;n>e;e++)if(e in this&&this[e]===t)return e;return-1};p=t("underscore"),d=t("./logging").logger,a=t("./has_props"),r=t("./base").Collections,s=function(){function t(t){this.document=t}return t}(),l=function(t){function e(t,n,r,o,i){this.document=t,this.model=n,this.attr=r,this.old=o,this.new_=i,e.__super__.constructor.call(this,this.document)}return f(e,t),e}(s),c=function(t){function e(t,n){this.document=t,this.title=n,e.__super__.constructor.call(this,this.document)}return f(e,t),e}(s),u=function(t){function e(t,n){this.document=t,this.model=n,e.__super__.constructor.call(this,this.document)}return f(e,t),e}(s),h=function(t){function e(t,n){this.document=t,this.model=n,e.__super__.constructor.call(this,this.document)}return f(e,t),e}(s),o="Bokeh Application",_=function(){function t(){this._dict={}}return t.prototype._existing=function(t){return t in this._dict?this._dict[t]:null},t.prototype.add_value=function(t,e){var n;if(null===e)throw new Error("Can't put null in this dict");if(p.isArray(e))throw new Error("Can't put arrays in this dict");return n=this._existing(t),null===n?this._dict[t]=e:p.isArray(n)?n.push(e):this._dict[t]=[n,e]},t.prototype.remove_value=function(t,e){var n,r;return n=this._existing(t),p.isArray(n)?(r=p.without(n,e),r.length>0?this._dict[t]=r:delete this._dict[t]):p.isEqual(n,e)?delete this._dict[t]:void 0},t.prototype.get_one=function(t,e){var n;if(n=this._existing(t),p.isArray(n)){if(1===n.length)return n[0];throw new Error(e)}return n},t}(),i=function(){function t(){this._title=o,this._roots=[],this._all_models={},this._all_models_by_name=new _,this._all_model_counts={},this._callbacks=[]}return t.prototype.clear=function(){var t;for(t=[];this._roots.length>0;)t.push(this.remove_root(this._roots[0]));return t},t.prototype._destructively_move=function(t){var e;for(t.clear();this._roots.length>0;)e=this._roots[0],this.remove_root(e),t.add_root(e);return t.set_title(this._title)},t.prototype.roots=function(){return this._roots},t.prototype.add_root=function(t){return g.call(this._roots,t)>=0?void 0:(this._roots.push(t),t.attach_document(this),this._trigger_on_change(new u(this,t)))},t.prototype.remove_root=function(t){var e;return e=this._roots.indexOf(t),0>e?void 0:(this._roots.splice(e,1),t.detach_document(),this._trigger_on_change(new h(this,t)))},t.prototype.title=function(){return this._title},t.prototype.set_title=function(t){return t!==this._title?(this._title=t,this._trigger_on_change(new c(this,t))):void 0},t.prototype.get_model_by_id=function(t){return t in this._all_models?this._all_models[t]:null},t.prototype.get_model_by_name=function(t){ return this._all_models_by_name.get_one(t,"Multiple models are named '"+t+"'")},t.prototype.on_change=function(t){return g.call(this._callbacks,t)>=0?void 0:this._callbacks.push(t)},t.prototype.remove_on_change=function(t){var e;return e=this._callbacks.indexOf(t),e>=0?this._callbacks.splice(e,1):void 0},t.prototype._trigger_on_change=function(t){var e,n,r,o,i;for(o=this._callbacks,i=[],n=0,r=o.length;r>n;n++)e=o[n],i.push(e(t));return i},t.prototype._notify_change=function(t,e,n,r){return"name"===e&&(this._all_models_by_name.remove_value(n,t),null!==r&&this._all_models_by_name.add_value(r,t)),this._trigger_on_change(new l(this,t,e,n,r))},t.prototype._notify_attach=function(t){var e;if(!t.serializable_in_document())throw console.log("Attempted to attach nonserializable to document ",t),new Error("Should not attach nonserializable model "+t.constructor.name+" to document");return t.id in this._all_model_counts?this._all_model_counts[t.id]=this._all_model_counts[t.id]+1:this._all_model_counts[t.id]=1,this._all_models[t.id]=t,e=t.get("name"),null!==e?this._all_models_by_name.add_value(e,t):void 0},t.prototype._notify_detach=function(t){var e,n;return this._all_model_counts[t.id]-=1,e=this._all_model_counts[t.id],0===e&&(delete this._all_models[t.id],delete this._all_model_counts[t.id],n=t.get("name"),null!==n&&this._all_models_by_name.remove_value(n,t)),e},t._references_json=function(t,e){var n,r,o,i,s;for(null==e&&(e=!0),s=[],n=0,r=t.length;r>n;n++){if(o=t[n],!o.serializable_in_document())throw console.log("nonserializable value in references ",o),new Error("references should never contain nonserializable value");i=o.ref(),i.attributes=o.attributes_as_json(e),delete i.attributes.id,s.push(i)}return s},t._instantiate_object=function(t,e,n){var o,i;if(i=p.extend({},n,{id:t}),o=r(e),null==o)throw new Error("unknown model type "+e+" for "+t);return new o.model(i,{silent:!0,defer_initialization:!0})},t._instantiate_references_json=function(e,n){var r,o,i,s,a,l,u,h;for(h={},o=0,i=e.length;i>o;o++)s=e[o],l=s.id,u=s.type,a=s.attributes,l in n?r=n[l]:(r=t._instantiate_object(l,u,a),"subtype"in s&&r.set_subtype(s.subtype)),h[r.id]=r;return h},t._resolve_refs=function(t,e,n){var r,o,i;return i=function(t){if(a._is_ref(t)){if(t.id in e)return e[t.id];if(t.id in n)return n[t.id];throw new Error("reference "+JSON.stringify(t)+" isn't known (not in Document?)")}return p.isArray(t)?r(t):p.isObject(t)?o(t):t},o=function(t){var e,n,r;n={};for(e in t)r=t[e],n[e]=i(r);return n},r=function(t){var e,n,r,o;for(r=[],e=0,n=t.length;n>e;e++)o=t[e],r.push(i(o));return r},i(t)},t._initialize_references_json=function(e,n,r){var o,i,s,l,u,h,c,_,d;for(_={},s=0,l=e.length;l>s;s++)u=e[s],c=u.id,h=u.attributes,d=!1,i=c in n?n[c]:(d=!0,r[c]),h=t._resolve_refs(h,n,r),_[i.id]=[i,h,d];return o=function(t,e){var n,r,o,i,s;n={},r=function(e,o){var i,s,l,u,h,c,_,f,m,g;if(e instanceof a){if(!(e.id in n)&&e.id in t){n[e.id]=!0,_=t[e.id],g=_[0],s=_[1],d=_[2];for(i in s)l=s[i],r(l,o);return o(e,s,d)}}else{if(p.isArray(e)){for(f=[],h=0,c=e.length;c>h;h++)l=e[h],f.push(r(l,o));return f}if(p.isObject(e)){m=[];for(u in e)l=e[u],m.push(r(l,o));return m}}},i=[];for(o in t)s=t[o],i.push(r(s[0],e));return i},o(_,function(t,e,n){return n?t.set(e):void 0}),o(_,function(t,e,n){return n?t.initialize(e):void 0})},t._event_for_attribute_change=function(t,e,n,r,o){var i,s;return i=r.get_model_by_id(t.id),i.attribute_is_serializable(e)?(s={kind:"ModelChanged",model:{id:t.id,type:t.type},attr:e,"new":n},a._json_record_references(r,n,o,!0),s):null},t._events_to_sync_objects=function(e,n,r,o){var i,s,a,l,u,h,c,_,f,m,g,y,v,b,x;for(a=Object.keys(e.attributes),x=Object.keys(n.attributes),v=p.difference(a,x),i=p.difference(x,a),b=p.intersection(a,x),s=[],l=0,c=v.length;c>l;l++)u=v[l],d.warn("Server sent key "+u+" but we don't seem to have it in our JSON");for(h=0,_=i.length;_>h;h++)u=i[h],g=n.attributes[u],s.push(t._event_for_attribute_change(e,u,g,r,o));for(m=0,f=b.length;f>m;m++)u=b[m],y=e.attributes[u],g=n.attributes[u],null===y&&null===g||(null===y||null===g?s.push(t._event_for_attribute_change(e,u,g,r,o)):p.isEqual(y,g)||s.push(t._event_for_attribute_change(e,u,g,r,o)));return p.filter(s,function(t){return null!==t})},t._compute_patch_since_json=function(e,n){var r,o,i,s,a,l,u,h,c,_,d,f,m,g,y,v,b,x,w,k,M,j;for(b=n.to_json(l=!1),v=function(t){var e,n,r,o,i;for(i={},o=t.roots.references,e=0,n=o.length;n>e;e++)r=o[e],i[r.id]=r;return i},o=v(e),s={},i=[],m=e.roots.root_ids,u=0,c=m.length;c>u;u++)f=m[u],s[f]=o[f],i.push(f);for(x=v(b),k={},w=[],g=b.roots.root_ids,h=0,_=g.length;_>h;h++)f=g[h],k[f]=x[f],w.push(f);if(i.sort(),w.sort(),p.difference(i,w).length>0||p.difference(w,i).length>0)throw new Error("Not implemented: computing add/remove of document roots");j={},r=[],y=n._all_models;for(a in y)d=y[a],a in o&&(M=t._events_to_sync_objects(o[a],x[a],n,j),r=r.concat(M));return{events:r,references:t._references_json(p.values(j),l=!1)}},t.prototype.to_json_string=function(t){return null==t&&(t=!0),JSON.stringify(this.to_json(t))},t.prototype.to_json=function(e){var n,r,o,i,s,a,l,u;for(null==e&&(e=!0),a=[],s=this._roots,n=0,o=s.length;o>n;n++)i=s[n],a.push(i.id);return l=function(){var t,e;t=this._all_models,e=[];for(r in t)u=t[r],e.push(u);return e}.call(this),{title:this._title,roots:{root_ids:a,references:t._references_json(l,e)}}},t.from_json_string=function(e){var n;if(null===e||null==e)throw new Error("JSON string is "+typeof e);return n=JSON.parse(e),t.from_json(n)},t.from_json=function(e){var n,r,o,i,s,a,l,u;if("object"!=typeof e)throw new Error("JSON object has wrong type "+typeof e);for(u=e.roots,l=u.root_ids,a=u.references,s=t._instantiate_references_json(a,{}),t._initialize_references_json(a,{},s),n=new t,r=0,o=l.length;o>r;r++)i=l[r],n.add_root(s[i]);return n.set_title(e.title),n},t.prototype.replace_with_json=function(e){var n;return n=t.from_json(e),n._destructively_move(this)},t.prototype.create_json_patch_string=function(t){return JSON.stringify(this.create_json_patch(t))},t.prototype.create_json_patch=function(e){var n,r,o,i,s,_,d,f,m,g;for(d={},s=[],o=0,_=e.length;_>o;o++){if(n=e[o],n.document!==this)throw console.log("Cannot create a patch using events from a different document, event had ",n.document," we are ",this),new Error("Cannot create a patch using events from a different document");if(n instanceof l){if("id"===n.attr)throw console.log("'id' field is immutable and should never be in a ModelChangedEvent ",n),new Error("'id' field should never change, whatever code just set it is wrong");f=n.new_,m=a._value_to_json("new_",f,n.model),g={},a._value_record_references(f,g,!0),n.model.id in g&&n.model!==f&&delete g[n.model.id];for(r in g)d[r]=g[r];i={kind:"ModelChanged",model:n.model.ref(),attr:n.attr,"new":m},s.push(i)}else n instanceof u?(a._value_record_references(n.model,d,!0),i={kind:"RootAdded",model:n.model.ref()},s.push(i)):n instanceof h?(i={kind:"RootRemoved",model:n.model.ref()},s.push(i)):n instanceof c&&(i={kind:"TitleChanged",title:n.title},s.push(i))}return{events:s,references:t._references_json(p.values(d))}},t.prototype.apply_json_patch_string=function(t){return this.apply_json_patch(JSON.parse(t))},t.prototype.apply_json_patch=function(e){var n,r,o,i,s,a,l,u,h,c,p,_,d,f,m,g,y,v,b,x,w,k,M,j;for(b=e.references,a=e.events,v=t._instantiate_references_json(b,this._all_models),u=0,c=a.length;c>u;u++)if(s=a[u],"model"in s){if(_=s.model.id,!(_ in this._all_models))throw console.log("Got an event for unknown model ",s.model),new Error("event model wasn't known");v[_]=this._all_models[_]}m={},d={};for(l in v)j=v[l],l in this._all_models?m[l]=j:d[l]=j;for(t._initialize_references_json(b,m,d),x=[],h=0,p=a.length;p>h;h++)if(s=a[h],"ModelChanged"===s.kind){if(g=s.model.id,!(g in this._all_models))throw new Error("Cannot apply patch to "+g+" which is not in the document");y=this._all_models[g],n=s.attr,j=t._resolve_refs(s["new"],m,d),x.push(y.set((f={},f[""+n]=j,f)))}else if("ColumnsStreamed"===s.kind){if(o=s.column_source.id,!(o in this._all_models))throw new Error("Cannot stream to "+o+" which is not in the document");r=this._all_models[o],i=s.data,w=s.rollover,x.push(r.stream(i,w))}else if("RootAdded"===s.kind)k=s.model.id,M=v[k],x.push(this.add_root(M));else if("RootRemoved"===s.kind)k=s.model.id,M=v[k],x.push(this.remove_root(M));else{if("TitleChanged"!==s.kind)throw new Error("Unknown patch event "+JSON.stringify(s));x.push(this.set_title(s.title))}return x},t}(),e.exports={Document:i,DocumentChangedEvent:s,ModelChangedEvent:l,TitleChangedEvent:c,RootAddedEvent:u,RootRemovedEvent:h,DEFAULT_TITLE:o}},{"./base":"common/base","./has_props":"common/has_props","./logging":"common/logging",underscore:"underscore"}],"common/embed":[function(t,e,n){var r,o,i,s,a,l,u,h,c,p,_,d,f,m,g,y,v,b,x,w,k,M,j,T,z,E,P,S;r=t("jquery"),h=t("underscore"),o=t("backbone"),x=t("./base"),E=t("./logging"),T=E.logger,S=E.set_log_level,P=t("./document"),i=P.Document,a=P.RootAddedEvent,l=P.RootRemovedEvent,u=P.TitleChangedEvent,z=t("./client").pull_session,s=t("es6-promise").Promise,_=function(t){var e;if(T.debug("handling notebook comms"),e=JSON.parse(t.content.data),"events"in e&&"references"in e)return this.apply_json_patch(e);if("doc"in e)return this.replace_with_json(e.doc);throw new Error("handling notebook comms message: ",t)},d=function(t,e){var n;return"undefined"!=typeof Jupyter&&null!==Jupyter?(n=Jupyter.notebook.kernel.comm_manager,n.register_target(t,function(n,r){return T.info("Registering Jupyter comms for target "+t),n.on_msg(h.bind(_,e))})):console.warn("Juptyer notebooks comms not available. push_notebook will not function")},c=function(t){var e;return e=new t.default_view({model:t}),x.index[t.id]=e,e},b=function(t,e,n){var o,i;if(o=n.get_model_by_id(e),null==o)throw new Error("Model "+e+" was not in document "+n);return i=c(o),h.delay(function(){return r(t).replaceWith(i.$el)})},f=function(t,e,n){var o,i,s,h,p,_,d;d={},p=function(e){var n;return n=c(e),d[e.id]=n,r(t).append(n.$el)},_=function(e){var n;return e.id in d?(n=d[e.id],r(t).remove(n.$el),delete d[e.id],delete x.index[e.id]):void 0},h=e.roots();for(o=0,i=h.length;i>o;o++)s=h[o],p(s);return n&&(window.document.title=e.title()),e.on_change(function(t){return t instanceof a?p(t.model):t instanceof l?_(t.model):n&&t instanceof u?window.document.title=t.title:void 0})},y=function(t,e,n){return h.delay(function(){return f(r(t),e,n)})},m={},p=function(t,e){var n;if(null==t||null===t)throw new Error("Missing websocket_url");return t in m||(m[t]={}),n=m[t],e in n||(n[e]=z(t,e)),n[e]},g=function(t,e,n,r){var o;return o=p(e,n),o.then(function(e){return f(t,e.document,r)},function(t){throw T.error("Failed to load Bokeh session "+n+": "+t),t})},v=function(t,e,n,o){var i;return i=p(e,o),i.then(function(e){var o,i;if(o=e.document.get_model_by_id(n),null==o)throw new Error("Did not find model "+n+" in session");return i=c(o),r(t).replaceWith(i.$el)},function(t){throw T.error("Failed to load Bokeh session "+o+": "+t),t})},M=function(t){var e;return e=r(""),r("body").append(e)},j=function(t){var e;return e=r("