269 lines
760 KiB
JavaScript
269 lines
760 KiB
JavaScript
window.Bokeh=Bokeh=function(){var t=void 0;return function e(t,r,n){function o(i){if(!r[i]){if(!t[i]){var s=new Error("Cannot find module '"+i+"'");throw s.code="MODULE_NOT_FOUND",s}var a=r[i]={exports:{}},l=function(e){var r=t[i][1][e];return o(r?r:e)};l.modules=o.modules,t[i][0].call(a.exports,l,a,a.exports,e,t,r,n)}return r[i].exports}o.modules=t;for(var i=null,s=0;s<n.length;s++)i=o(n[s]);return i}({base:[function(t,e,r){var n,o,i,s,a,l,u,c,p,h={}.hasOwnProperty;o=t("underscore"),u=t("./core/logging").logger,t("./core/util/underscore").patch(),l=t("./models/index"),p={},c=function(t){var e,r,n,i,s,a,l,u,c;s={};for(n in t)if(a=t[n],o.isArray(a)){u=a[0],c=null!=(i=a[1])?i:"";for(l in u)e=u[l],r=l+c,s[r]=e}else s[n]=a;return s},s=null,i=function(){return null==s&&(s=c(l)),s},n=function(t){var e,r;if(r=i(),p[t])return p[t];if(e=r[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 e.Model},n.register=function(t,e){return p[t]=e},n.unregister=function(t){return delete p[t]},n.register_locations=function(t,e,r){var n,o,s,a,l;null==e&&(e=!1),null==r&&(r=null),o=i(),n=c(t),l=[];for(a in n)h.call(n,a)&&(s=n[a],e||!o.hasOwnProperty(a)?l.push(o[a]=s):l.push("function"==typeof r?r(a):void 0));return l},n.registered_names=function(){return Object.keys(i())},a={},e.exports={overrides:p,index:a,Models:n}},{"./core/logging":"core/logging","./core/util/underscore":"core/util/underscore","./models/index":"models/index",underscore:"underscore"}],client:[function(t,e,r){var n,o,i,s,a,l,u,c,p,h,_,d,f,m,g,y;d=t("underscore"),p=t("es6-promise").Promise,l=t("./core/has_props"),f=t("./core/logging").logger,y=t("./document"),a=y.Document,c=y.ModelChangedEvent,h=y.RootAddedEvent,_=y.RootRemovedEvent,i="ws://localhost:5006/ws",s="default",u=function(){function t(t,e,r){this.header=t,this.metadata=e,this.content=r,this.buffers=[]}return t.assemble=function(e,r,n){var o,i,s,a,l;try{return a=JSON.parse(e),l=JSON.parse(r),o=JSON.parse(n),new t(a,l,o)}catch(s){throw i=s,f.error("Failure parsing json "+i+" "+e+" "+r+" "+n,i),i}},t.create_header=function(t,e){var r;return r={msgid:d.uniqueId(),msgtype:t},d.extend(r,e)},t.create=function(e,r,n){var o;return null==n&&(n={}),o=t.create_header(e,r),new t(o,{},n)},t.prototype.send=function(t){var e,r,n,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(n){throw r=n,f.error("Error sending ",this,r),r}},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)},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)}},n=function(){function t(e,r,n,o){this.url=e,this.id=r,this._on_have_session_hook=n,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){if(null!==this.session)return t(this.session)},t.prototype.connect=function(){var t,e,r;if(this.closed_permanently)return p.reject(new Error("Cannot connect() a closed ClientConnection"));if(null!=this.socket)return p.reject(new Error("Already connected"));this._fragments=[],this._partial=null,this._pending_replies={},this._current_handler=null;try{return r=this.url+"?bokeh-protocol-version=1.0&bokeh-session-id="+this.id,null!=window.MozWebSocket?this.socket=new MozWebSocket(r):this.socket=new WebSocket(r),new p(function(t){return function(e,r){return t.socket.binarytype="arraybuffer",t.socket.onopen=function(){return t._on_open(e,r)},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(r)}}}(this))}catch(e){return t=e,f.error("websocket creation failed to url: "+this.url),f.error(" - "+t),p.reject(t)}},t.prototype.close=function(){if(!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))return 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,r;try{if(null===this.socket)throw new Error("not connected so cannot send "+t);return t.send(this.socket)}catch(r){return e=r,f.error("Error sending message ",e,t)}},t.prototype.send_with_reply=function(t){var e;return e=new p(function(e){return function(r,n){return e._pending_replies[t.msgid()]=[r,n],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 r,n,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"):(r=a.from_json(e),n=a._compute_patch_since_json(e,r),n.events.length>0&&(f.debug("Sending "+n.events.length+" changes from model construction back to server"),i=u.create("PATCH-DOC",{},n),t.send(i)),t.session=new o(t,r,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,r;try{return this._on_message_unchecked(t)}catch(r){return e=r,f.error("Error handling message: "+e+", "+t)}},t.prototype._on_message_unchecked=function(t){var e,r;if(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=[],r=this._partial.problem(),null!==r&&this._close_bad_protocol(r))),null!=this._partial&&this._partial.complete())return e=this._partial,this._partial=null,this._current_handler(e)},t.prototype._on_close=function(t){var e,r;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,r;e=this._pending_replies;for(r in e)return t=e[r],delete this._pending_replies[r],t;return null},r=e();null!==r;)r[1]("Disconnected"),r=e();if(!this.closed_permanently)return 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){if(f.error("Closing connection: "+t),null!=this.socket)return this.socket.close(1002,t)},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,r){this._connection=t,this.document=e,this.id=r,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 r,n,o,i,s,a,u,p,f,m,g,y,v,b;if(e instanceof c){for(g=t.content.events,n=0,a=g.length;n<a;n++)if(r=g[n],"ModelChanged"===r.kind&&r.model.id===e.model.id&&r.attr===e.attr)if(m=r["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 h){for(y=t.content.events,o=0,u=y.length;o<u;o++)if(r=y[o],"RootAdded"===r.kind&&r.model.id===e.model.id)return!0}else if(e instanceof _){for(v=t.content.events,i=0,p=v.length;i<p;i++)if(r=v[i],"RootRemoved"===r.kind&&r.model.id===e.model.id)return!0}else if(e instanceof TitleChangedEvent)for(b=t.content.events,s=0,f=b.length;s<f;s++)if(r=b[s],"TitleChanged"===r.kind&&r.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 c&&!(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 r,o,i;return i=null,r=null,o=new p(function(o,i){return r=new n(t,e,function(t){var e,r;try{return o(t)}catch(r){throw e=r,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"))}),r.connect().then(function(t){},function(t){throw f.error("Failed to connect to Bokeh server "+t),t})}),o.close=function(){return r.close()},o},e.exports={pull_session:g,DEFAULT_SERVER_WEBSOCKET_URL:i,DEFAULT_SESSION_ID:s}},{"./core/has_props":"core/has_props","./core/logging":"core/logging","./document":"document","es6-promise":"es6-promise",underscore:"underscore"}],"core/backbone":[function(t,e,r){
|
|
// (c) 2010-2016 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
|
|
// Backbone may be freely distributed under the MIT license.
|
|
var n=t("underscore"),o=t("jquery"),i=t("./events").Events,s=function(t,e){var r=t||{};e||(e={}),this.attributes={},this.setv(r,e),this.changed={},this.initialize.apply(this,arguments)};n.extend(s.prototype,i,{changed:null,initialize:function(){},getv:function(t){return this.attributes[t]},setv:function(t,e,r){if(null==t)return this;var o;"object"==typeof t?(o=t,r=e):(o={})[t]=e,r||(r={});var i=r.silent,s=[],a=this._changing;this._changing=!0,a||(this._previousAttributes=n.clone(this.attributes),this.changed={});var l=this.attributes,u=this.changed,c=this._previousAttributes;for(var p in o)e=o[p],n.isEqual(l[p],e)||s.push(p),n.isEqual(c[p],e)?delete u[p]:u[p]=e,l[p]=e;if(!i){s.length&&(this._pending=!0);for(var h=0;h<s.length;h++)this.trigger("change:"+s[h],this,l[s[h]])}if(a)return this;if(!i)for(;this._pending;)this._pending=!1,this.trigger("change",this);return this._pending=!1,this._changing=!1,this},destroy:function(){this.stopListening(),this.trigger("destroy",this)},clone:function(){return new this.constructor(this.attributes)}});var a=function(t){n.extend(this,n.pick(t,u)),this._ensureElement(),this.initialize.apply(this,arguments)},l=/^(\S+)\s*(.*)$/,u=["model","el","id","attributes","className","tagName","events"];n.extend(a.prototype,i,{tagName:"div",$:function(t){return this.$el.find(t)},initialize:function(){},render:function(){return this},remove:function(){return this._removeElement(),this.stopListening(),this},_removeElement:function(){this.$el.remove()},setElement:function(t){return this.undelegateEvents(),this._setElement(t),this.delegateEvents(),this},_setElement:function(t){this.$el=t instanceof o?t:o(t),this.el=this.$el[0]},delegateEvents:function(t){if(t||(t=n.result(this,"events")),!t)return this;this.undelegateEvents();for(var e in t){var r=t[e];if(n.isFunction(r)||(r=this[r]),r){var o=e.match(l);this.delegate(o[1],o[2],n.bind(r,this))}}return this},delegate:function(t,e,r){return this.$el.on(t+".delegateEvents"+this.id,e,r),this},undelegateEvents:function(){return this.$el&&this.$el.off(".delegateEvents"+this.id),this},undelegate:function(t,e,r){return this.$el.off(t+".delegateEvents"+this.id,e,r),this},_createElement:function(t){return document.createElement(t)},_ensureElement:function(){if(this.el)this.setElement(n.result(this,"el"));else{var t=n.extend({},n.result(this,"attributes"));this.id&&(t.id=n.result(this,"id")),this.className&&(t["class"]=n.result(this,"className")),this.setElement(this._createElement(n.result(this,"tagName"))),this._setAttributes(t)}},_setAttributes:function(t){this.$el.attr(t)}}),s.getter=a.getter=function(t,e){Object.defineProperty(this.prototype,t,{get:e})},s.getters=a.getters=function(t){for(var e in t)this.getter(e,t[e])},e.exports={Model:s,View:a}},{"./events":"core/events",jquery:"jquery",underscore:"underscore"}],"core/bokeh_view":[function(t,e,r){var n,o,i,s=function(t,e){function r(){this.constructor=t}for(var n in e)a.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},a={}.hasOwnProperty;i=t("underscore"),n=t("./backbone"),o=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return s(e,t),e.prototype.initialize=function(t){if(!i.has(t,"id"))return this.id=i.uniqueId("BokehView")},e.prototype.toString=function(){return this.model.type+".View("+this.id+")"},e.prototype.bind_bokeh_events=function(){},e.prototype.remove=function(){var t,r,n;if(i.has(this,"eventers")){t=this.eventers;for(r in t)a.call(t,r)&&(n=t[r],n.off(null,null,this))}return this.trigger("remove",this),e.__super__.remove.call(this)},e}(n.View),e.exports=o},{"./backbone":"core/backbone",underscore:"underscore"}],"core/build_views":[function(t,e,r){var n,o,i;n=t("underscore"),o=function(t,e,r,o){var s,a,l,u,c,p,h,_,d,f,m;for(null==o&&(o=[]),s=[],d=n.filter(e,function(e){return!n.has(t,e.id)}),l=a=0,p=d.length;a<p;l=++a)_=d[l],m=n.extend({},r,{model:_}),l<o.length?t[_.id]=new o[l](m):t[_.id]=new _.default_view(m),t[_.id].$el.find("*[class*='ui-']").each(function(t,e){return e.className=i(e)}),s.push(t[_.id]);for(f=n.difference(n.keys(t),n.pluck(e,"id")),u=0,h=f.length;u<h;u++)c=f[u],t[c].remove(),delete t[c];return s},i=function(t){var e,r;if(null!=t.className)return e=t.className.split(" "),r=n.map(e,function(t){return t=t.trim(),0===t.indexOf("ui-")?"bk-"+t:t}),r.join(" ")},o.jQueryUIPrefixer=i,e.exports=o=o},{underscore:"underscore"}],"core/enums":[function(t,e,r){e.exports={AngleUnits:["deg","rad"],Dimension:["width","height"],Dimensions:["width","height","both"],Direction:["clock","anticlock"],FontStyle:["normal","italic","bold"],LineCap:["butt","round","square"],LineJoin:["miter","round","bevel"],Location:["above","below","left","right"],LegendLocation:["top_left","top_center","top_right","left_center","center","right_center","bottom_left","bottom_center","bottom_right"],Orientation:["vertical","horizontal"],RenderLevel:["image","underlay","glyph","annotation","overlay"],RenderMode:["canvas","css"],Side:["left","right"],SpatialUnits:["screen","data"],StartEnd:["start","end"],TextAlign:["left","right","center"],TextBaseline:["top","middle","bottom","alphabetic","hanging","ideographic"],DistributionTypes:["uniform","normal"],TransformStepModes:["after","before","center"],SizingMode:["stretch_both","scale_width","scale_height","scale_both","fixed"]}},{}],"core/events":[function(t,e,r){
|
|
// (c) 2010-2016 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
|
|
// Backbone may be freely distributed under the MIT license.
|
|
var n=t("underscore"),o={},i=/\s+/,s=function(t,e,r,o,a){var l,u=0;if(r&&"object"==typeof r){void 0!==o&&"context"in a&&void 0===a.context&&(a.context=o);for(l=n.keys(r);u<l.length;u++)e=s(t,e,l[u],r[l[u]],a)}else if(r&&i.test(r))for(l=r.split(i);u<l.length;u++)e=t(e,l[u],o,a);else e=t(e,r,o,a);return e};o.on=function(t,e,r){return a(this,t,e,r)};var a=function(t,e,r,n,o){if(t._events=s(l,t._events||{},e,r,{context:n,ctx:t,listening:o}),o){var i=t._listeners||(t._listeners={});i[o.id]=o}return t};o.listenTo=function(t,e,r){if(!t)return this;var o=t._listenId||(t._listenId=n.uniqueId("l")),i=this._listeningTo||(this._listeningTo={}),s=i[o];if(!s){var l=this._listenId||(this._listenId=n.uniqueId("l"));s=i[o]={obj:t,objId:o,id:l,listeningTo:i,count:0}}return a(t,e,r,this,s),this};var l=function(t,e,r,n){if(r){var o=t[e]||(t[e]=[]),i=n.context,s=n.ctx,a=n.listening;a&&a.count++,o.push({callback:r,context:i,ctx:i||s,listening:a})}return t};o.off=function(t,e,r){return this._events?(this._events=s(u,this._events,t,e,{context:r,listeners:this._listeners}),this):this},o.stopListening=function(t,e,r){var o=this._listeningTo;if(!o)return this;for(var i=t?[t._listenId]:n.keys(o),s=0;s<i.length;s++){var a=o[i[s]];if(!a)break;a.obj.off(e,r,this)}return this};var u=function(t,e,r,o){if(t){var i,s=0,a=o.context,l=o.listeners;if(e||r||a){for(var u=e?[e]:n.keys(t);s<u.length;s++){e=u[s];var c=t[e];if(!c)break;for(var p=[],h=0;h<c.length;h++){var _=c[h];r&&r!==_.callback&&r!==_.callback._callback||a&&a!==_.context?p.push(_):(i=_.listening,i&&0===--i.count&&(delete l[i.id],delete i.listeningTo[i.objId]))}p.length?t[e]=p:delete t[e]}return t}for(var d=n.keys(l);s<d.length;s++)i=l[d[s]],delete l[i.id],delete i.listeningTo[i.objId]}};o.once=function(t,e,r){var o=s(c,{},t,e,n.bind(this.off,this));return"string"==typeof t&&null==r&&(e=void 0),this.on(o,e,r)},o.listenToOnce=function(t,e,r){var o=s(c,{},e,r,n.bind(this.stopListening,this,t));return this.listenTo(t,o)};var c=function(t,e,r,o){if(r){var i=t[e]=n.once(function(){o(e,i),r.apply(this,arguments)});i._callback=r}return t};o.trigger=function(t){if(!this._events)return this;for(var e=Math.max(0,arguments.length-1),r=Array(e),n=0;n<e;n++)r[n]=arguments[n+1];return s(p,this._events,t,void 0,r),this};var p=function(t,e,r,n){if(t){var o=t[e],i=t.all;o&&i&&(i=i.slice()),o&&h(o,n),i&&h(i,[e].concat(n))}return t},h=function(t,e){var r,n=-1,o=t.length,i=e[0],s=e[1],a=e[2];switch(e.length){case 0:for(;++n<o;)(r=t[n]).callback.call(r.ctx);return;case 1:for(;++n<o;)(r=t[n]).callback.call(r.ctx,i);return;case 2:for(;++n<o;)(r=t[n]).callback.call(r.ctx,i,s);return;case 3:for(;++n<o;)(r=t[n]).callback.call(r.ctx,i,s,a);return;default:for(;++n<o;)(r=t[n]).callback.apply(r.ctx,e);return}};e.exports={Events:o}},{underscore:"underscore"}],"core/has_props":[function(t,e,r){var n,o,i,s,a,l,u,c,p,h=function(t,e){function r(){this.constructor=t}for(var n in e)_.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},_={}.hasOwnProperty,d=[].slice;n=t("jquery"),s=t("underscore"),o=t("./backbone"),l=t("./logging").logger,c=t("./property_mixins"),p=t("./util/refs"),u=t("./properties"),a=t("./util/math").array_max,i=function(t){function e(t,e){var r,n,o,i,a,l;this.document=null,r=t||{},e||(e={}),this.attributes={},this.properties={},i=this.props;for(o in i){if(a=i[o],l=a.type,n=a.default_value,null==l)throw new Error("undefined property type for "+this.type+"."+o);this.properties[o]=new l({obj:this,attr:o,default_value:n})}this._set_after_defaults={},this.setv(r,e),this.changed={},this._computed={},null==r.id&&(this.id=s.uniqueId(this.type)),e.defer_initialization||this.initialize.apply(this,arguments)}return h(e,t),e.prototype.props={},e.prototype.mixins=[],e.define=function(t){var e,r,n;n=[];for(e in t)r=t[e],n.push(function(t){return function(e,r){var n,o,i,a,l;if(null!=t.prototype.props[e])throw new Error("attempted to redefine property '"+t.name+"."+e+"'");if(null!=t.prototype[e])throw new Error("attempted to redefine attribute '"+t.name+"."+e+"'");return Object.defineProperty(t.prototype,e,{get:function(){return this.getv(e)},set:function(t){return this.setv(e,t)}},{configurable:!1,enumerable:!0}),l=r[0],n=r[1],o=r[2],a={type:l,default_value:n,internal:null!=o&&o},i=s.clone(t.prototype.props),i[e]=a,t.prototype.props=i}}(this)(e,r));return n},e.internal=function(t){var e,r,n,o;e={},r=function(t){return function(t,r){var n,o;return o=r[0],n=r[1],e[t]=[o,n,!0]}}(this);for(n in t)o=t[n],r(n,o);return this.define(e)},e.mixin=function(){var t,e;return e=1<=arguments.length?d.call(arguments,0):[],this.define(c.create(e)),t=this.prototype.mixins.concat(e),this.prototype.mixins=t},e.mixins=function(t){return this.mixin.apply(this,t)},e.override=function(t,e){var r,n,o;s.isString(t)?(n={},n[r]=e):n=t,o=[];for(r in n)e=n[r],o.push(function(t){return function(e,r){var n,o;if(o=t.prototype.props[e],null==o)throw new Error("attempted to override nonexistent '"+t.name+"."+e+"'");return n=s.clone(t.prototype.props),n[e]=s.extend({},o,{default_value:r}),t.prototype.props=n}}(this)(r,e));return o},e.define({id:[u.Any]}),e.prototype.toString=function(){return this.type+"("+this.id+")"},e.prototype.setv=function(t,r,n){var o,i,a,l,u;s.isObject(t)||null===t?(o=t,n=r):(o={},o[t]=r);for(t in o)if(_.call(o,t)){if(u=o[t],a=t,null==this.props[a])throw new Error("property "+this.type+"."+a+" wasn't declared");null!=n&&n.defaults||(this._set_after_defaults[t]=!0)}if(!s.isEmpty(o)){i={};for(t in o)r=o[t],i[t]=this.getv(t);if(e.__super__.setv.call(this,o,n),null==(null!=n?n.silent:void 0)){l=[];for(t in o)r=o[t],l.push(this._tell_document_about_change(t,i[t],this.getv(t)));return l}}},e.prototype.add_dependencies=function(t,e,r){var n,o,i,a,l;for(s.isArray(r)||(r=[r]),a=this._computed[t],a.dependencies=a.dependencies.concat({obj:e,fields:r}),l=[],o=0,i=r.length;o<i;o++)n=r[o],l.push(this.listenTo(e,"change:"+n,a.callbacks.changedep));return l},e.prototype.define_computed_property=function(t,e,r){var n,o,i;if(null==r&&(r=!0),null!=this.props[t]&&console.log("attempted to redefine existing property "+this.type+"."+t),s.has(this._computed,t))throw new Error("attempted to redefine existing computed property "+this.type+"."+t);return n=function(e){return function(){return e.trigger("changedep:"+t)}}(this),i=function(e){return function(){var r,n,i;if(r=!0,o.use_cache&&(i=o.cache,o.cache=void 0,n=e._get_computed(t),r=n!==i),r)return e.trigger("change:"+t,e,e._get_computed(t)),e.trigger("change",e)}}(this),o={getter:e,dependencies:[],use_cache:r,callbacks:{changedep:n,propchange:i}},this._computed[t]=o,this.listenTo(this,"changedep:"+t,o.callbacks.propchange),o},e.prototype.set=function(t,e,r){return l.warn("HasProps.set('prop_name', value) is deprecated, use HasProps.prop_name = value instead"),this.setv(t,e,r)},e.prototype.get=function(t){return l.warn("HasProps.get('prop_name') is deprecated, use HasProps.prop_name instead"),this.getv(t)},e.prototype.getv=function(t){if(null==this.props[t])throw new Error("property "+this.type+"."+t+" wasn't declared");return e.__super__.getv.call(this,t)},e.prototype._get_computed=function(t){var e,r,n;if(n=this._computed[t],null==n)throw new Error("computed property "+this.type+"."+t+" wasn't declared");return n.use_cache&&n.cache?n.cache:(r=n.getter,e=r.apply(this,[t]),n.use_cache&&(n.cache=e),e)},e.prototype.ref=function(){return p.create_ref(this)},e.prototype.set_subtype=function(t){return this._subtype=t},e.prototype.attribute_is_serializable=function(t){var e;if(e=this.props[t],null==e)throw new Error(this.type+".attribute_is_serializable('"+t+"'): "+t+" wasn't declared");return!e.internal},e.prototype.serializable_attributes=function(){var t,e,r,n;t={},r=this.attributes;for(e in r)n=r[e],this.attribute_is_serializable(e)&&(t[e]=n);return t},e._value_to_json=function(t,r,n){var o,i,a,l,u,c,p;if(r instanceof e)return r.ref();if(s.isArray(r)){for(l=[],o=i=0,a=r.length;i<a;o=++i)p=r[o],l.push(e._value_to_json(o,p,r));return l}if(s.isObject(r)){u={};for(c in r)_.call(r,c)&&(u[c]=e._value_to_json(c,r[c],r));return u}return r},e.prototype.attributes_as_json=function(t,r){var n,o,i,s;null==t&&(t=!0),null==r&&(r=e._value_to_json),n={},i=this.serializable_attributes();for(o in i)_.call(i,o)&&(s=i[o],t?n[o]=s:o in this._set_after_defaults&&(n[o]=s));return r("attributes",n,this)},e._json_record_references=function(t,r,n,o){var i,a,l,u,c,h,d;if(null===r);else if(p.is_ref(r)){if(!(r.id in n))return c=t.get_model_by_id(r.id),e._value_record_references(c,n,o)}else{if(s.isArray(r)){for(h=[],a=0,u=r.length;a<u;a++)i=r[a],h.push(e._json_record_references(t,i,n,o));return h}if(s.isObject(r)){d=[];for(l in r)_.call(r,l)&&(i=r[l],d.push(e._json_record_references(t,i,n,o)));return d}}},e._value_record_references=function(t,r,n){var o,i,a,l,u,c,p,h,d,f,m;if(null===t);else if(t instanceof e){if(!(t.id in r)&&(r[t.id]=t,n)){for(i=t._immediate_references(),d=[],a=0,c=i.length;a<c;a++)h=i[a],d.push(e._value_record_references(h,r,!0));return d}}else{if(s.isArray(t)){for(f=[],u=0,p=t.length;u<p;u++)o=t[u],f.push(e._value_record_references(o,r,n));return f}if(s.isObject(t)){m=[];for(l in t)_.call(t,l)&&(o=t[l],m.push(e._value_record_references(o,r,n)));return m}}},e.prototype._immediate_references=function(){var t,r,n,o;n={},t=this.serializable_attributes();for(r in t)o=t[r],e._value_record_references(o,n,!1);return s.values(n)},e.prototype.references=function(){var t;return t={},e._value_record_references(this,t,!0),s.values(t)},e.prototype.attach_document=function(t){var e,r,n;if(null!==this.document&&this.document!==t)throw new Error("models must be owned by only a single document");this.document=t,n=this.properties;for(e in n)r=n[e],r.update();if(null!=this._doc_attached)return this._doc_attached()},e.prototype.detach_document=function(){return this.document=null},e.prototype._tell_document_about_change=function(t,r,n){var o,i,s,a,l,u,c;if(this.attribute_is_serializable(t)&&null!==this.document){a={},e._value_record_references(n,a,!1),c={},e._value_record_references(r,c,!1),o=!1;for(i in a)if(s=a[i],!(i in c)){o=!0;break}if(!o)for(l in c)if(u=c[l],!(l in a)){o=!0;break}return o&&this.document._invalidate_all_models(),this.document._notify_change(this,t,r,n)}},e.prototype.materialize_dataspecs=function(t){var e,r,n,o;e={},o=this.properties;for(r in o)n=o[r],n.dataspec&&(!n.optional||null!==n.spec.value||r in this._set_after_defaults)&&(e["_"+r]=n.array(t),n instanceof u.Distance&&(e["max_"+r]=a(e["_"+r])));return e},e}(o.Model),e.exports=i},{"./backbone":"core/backbone","./logging":"core/logging","./properties":"core/properties","./property_mixins":"core/property_mixins","./util/math":"core/util/math","./util/refs":"core/util/refs",jquery:"jquery",underscore:"underscore"}],"core/hittest":[function(t,e,r){var n,o,i,s,a,l,u,c,p,h;c=function(t,e,r,n){var o,i,s,a,l,u,c,p;for(i=!1,l=r[r.length-1],c=n[n.length-1],o=s=0,a=r.length;0<=a?s<a:s>a;o=0<=a?++s:--s)u=r[o],p=n[o],c<e!=p<e&&l+(e-c)/(p-c)*(u-l)<t&&(i=!i),l=u,c=p;return i},u=function(){return null},n=function(){function t(){this["0d"]={glyph:null,get_view:u,indices:[]},this["1d"]={indices:[]},this["2d"]={}}return Object.defineProperty(t.prototype,"_0d",{get:function(){return this["0d"]}}),Object.defineProperty(t.prototype,"_1d",{get:function(){return this["1d"]}}),Object.defineProperty(t.prototype,"_2d",{get:function(){return this["2d"]}}),t.prototype.is_empty=function(){return 0===this._0d.indices.length&&0===this._1d.indices.length},t}(),i=function(){return new n},h=function(t,e){var r,n,o,i,s,a;return o=t[0],i=t[1],s=e[0],a=e[1],o>i&&(r=[i,o],o=r[0],i=r[1]),s>a&&(n=[a,s],s=n[0],a=n[1]),{minX:o,minY:s,maxX:i,maxY:a}},p=function(t){return t*t},s=function(t,e,r,n){return p(t-r)+p(e-n)},l=function(t,e,r){var n,o;return n=s(e.x,e.y,r.x,r.y),0===n?s(t.x,t.y,e.x,e.y):(o=((t.x-e.x)*(r.x-e.x)+(t.y-e.y)*(r.y-e.y))/n,o<0?s(t.x,t.y,e.x,e.y):o>1?s(t.x,t.y,r.x,r.y):s(t.x,t.y,e.x+o*(r.x-e.x),e.y+o*(r.y-e.y)))},a=function(t,e,r){return Math.sqrt(l(t,e,r))},o=function(t,e,r,n,o,i,s,a){var l,u,c,p,h,_,d;return c=(a-i)*(r-t)-(s-o)*(n-e),0===c?{hit:!1,x:null,y:null}:(l=e-i,u=t-o,p=(s-o)*l-(a-i)*u,h=(r-t)*l-(n-e)*u,l=p/c,u=h/c,_=t+l*(r-t),d=e+l*(n-e),{hit:l>0&&l<1&&u>0&&u<1,x:_,y:d})},e.exports={point_in_poly:c,HitTestResult:n,create_hit_test_result:i,dist_2_pts:s,dist_to_segment:a,check_2_segments_intersect:o,validate_bbox_coords:h}},{}],"core/layout/layout_canvas":[function(t,e,r){var n,o,i,s,a,l,u,c,p,h=function(t,e){function r(){this.constructor=t}for(var n in e)_.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},_={}.hasOwnProperty;u=t("underscore"),p=t("./solver"),l=p.Variable,n=p.EQ,o=p.GE,a=p.Strength,s=t("../../model"),c=t("../properties"),i=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return h(e,t),e.prototype.type="LayoutCanvas",e.prototype.initialize=function(t,r){return e.__super__.initialize.call(this,t,r),this._top=new l("top "+this.id),this._left=new l("left "+this.id),this._width=new l("width "+this.id),this._height=new l("height "+this.id),this._right=new l("right "+this.id),this._bottom=new l("bottom "+this.id)},e.getters({height:function(){return this._height.value()},width:function(){return this._width.value()},right:function(){return this._right.value()},left:function(){return this._left.value()},top:function(){return this._top.value()},bottom:function(){return this._bottom.value()}}),e.internal({layout_location:[c.Any]}),e.prototype.get_edit_variables=function(){var t;return t=[],t.push({edit_variable:this._top,strength:a.strong}),t.push({edit_variable:this._left,strength:a.strong}),t.push({edit_variable:this._width,strength:a.strong}),t.push({edit_variable:this._height,strength:a.strong}),t},e.prototype.get_constraints=function(){return[]},e}(s),e.exports={Model:i}},{"../../model":"model","../properties":"core/properties","./solver":"core/layout/solver",underscore:"underscore"}],"core/layout/side_panel":[function(t,e,r){var n,o,i,s,a,l,u,c,p,h,_,d,f,m,g,y,v,b,x,w,k,M,T,S=function(t,e){function r(){this.constructor=t}for(var n in e)z.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},z={}.hasOwnProperty;f=t("underscore"),M=t("./solver"),s=M.EQ,a=M.GE,c=t("./layout_canvas"),w=t("../../core/properties"),x=t("../../core/logging").logger,k=Math.PI/2,n="alphabetic",d="top",o="bottom",p="middle",l="hanging",u="left",h="right",i="center",v={above:{parallel:0,normal:-k,horizontal:0,vertical:-k},below:{parallel:0,normal:k,horizontal:0,vertical:k},left:{parallel:-k,normal:0,horizontal:0,vertical:-k},right:{parallel:k,normal:0,horizontal:0,vertical:k}},b={above:{justified:d,parallel:n,normal:p,horizontal:n,vertical:p},below:{justified:o,parallel:l,normal:p,horizontal:l,vertical:p},left:{justified:d,parallel:n,normal:p,horizontal:p,vertical:n},right:{justified:d,parallel:n,normal:p,horizontal:p,vertical:n}},m={above:{justified:i,parallel:i,normal:u,horizontal:i,vertical:u},below:{justified:i,parallel:i,normal:u,horizontal:i,vertical:h},left:{justified:i,parallel:i,normal:h,horizontal:h,vertical:i},right:{justified:i,parallel:i,normal:u,horizontal:u,vertical:i}},g={above:h,below:u,left:h,right:u},y={above:u,below:h,left:h,right:u},T=function(t){var e,r,n,o;if(o=t,(null==o.model.props.visible||o.model.visible!==!1)&&(n=o._get_size(),null==o._last_size&&(o._last_size=-1),n!==o._last_size))return e=o.model.document.solver(),o._last_size=n,null!=o._size_constraint&&e.remove_constraint(o._size_constraint),o._size_constraint=a(o.model.panel._size,-n),e.add_constraint(o._size_constraint),null==o._full_set&&(o._full_set=!1),o._full_set?void 0:(r=o.model.panel.side,"above"!==r&&"below"!==r||e.add_constraint(s(o.model.panel._width,[-1,o.plot_model.canvas._width])),"left"!==r&&"right"!==r||e.add_constraint(s(o.model.panel._height,[-1,o.plot_model.canvas._height])),o._full_set=!0)},_=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return S(e,t),e.internal({side:[w.String],plot:[w.Instance]}),e.prototype.initialize=function(t,r){switch(e.__super__.initialize.call(this,t,r),this.side){case"above":return this._dim=0,this._normals=[0,-1],this._size=this._height,this._anchor=this._bottom;case"below":return this._dim=0,this._normals=[0,1],this._size=this._height,this._anchor=this._top;case"left":return this._dim=1,this._normals=[-1,0],this._size=this._width,this._anchor=this._right;case"right":return this._dim=1,this._normals=[1,0],this._size=this._width,this._anchor=this._left;default:return x.error("unrecognized side: '"+this.side+"'")}},e.prototype.get_constraints=function(){var t;return t=[],t.push(a(this._top)),t.push(a(this._bottom)),t.push(a(this._left)),t.push(a(this._right)),t.push(a(this._width)),t.push(a(this._height)),t.push(s(this._left,this._width,[-1,this._right])),t.push(s(this._bottom,this._height,[-1,this._top])),t},e.prototype.apply_label_text_heuristics=function(t,e){var r,n,o;return o=this.side,f.isString(e)?(n=b[o][e],r=m[o][e]):0===e?(n=b[o][e],r=m[o][e]):e<0?(n="middle",r=g[o]):e>0&&(n="middle",r=y[o]),t.textBaseline=n,t.textAlign=r,t},e.prototype.get_label_angle_heuristic=function(t){var e;return e=this.side,v[e][t]},e}(c.Model),e.exports={Model:_,update_constraints:T}},{"../../core/logging":"core/logging","../../core/properties":"core/properties","./layout_canvas":"core/layout/layout_canvas","./solver":"core/layout/solver",underscore:"underscore"}],"core/layout/solver":[function(t,e,r){var n,o,i,s,a,l,u,c,p,h,_;c=t("underscore"),_=t("kiwi"),o=t("../events").Events,u=_.Variable,i=_.Expression,n=_.Constraint,s=_.Operator,l=_.Strength,p=function(t){return function(e){return function(){var e;return e=Object.create(i.prototype),i.apply(e,arguments),new n(e,t)}}(this)},h=function(t){return function(){var e,r,o,s;for(r=[null],o=0,s=arguments.length;o<s;o++)e=arguments[o],r.push(e);return new n(new(Function.prototype.bind.apply(i,r)),t,_.Strength.weak)}},a=function(){function t(){this.solver=new _.Solver}return c.extend(t.prototype,o),t.prototype.clear=function(){return this.solver=new _.Solver},t.prototype.toString=function(){return"Solver[num_constraints="+this.num_constraints()+", num_edit_variables="+this.num_edit_variables()+"]"},t.prototype.num_constraints=function(){return this.solver._cnMap._array.length},t.prototype.num_edit_variables=function(){return this.solver._editMap._array.length},t.prototype.update_variables=function(t){if(null==t&&(t=!0),this.solver.updateVariables(),t)return this.trigger("layout_update")},t.prototype.add_constraint=function(t){return this.solver.addConstraint(t)},t.prototype.remove_constraint=function(t){return this.solver.removeConstraint(t)},t.prototype.add_edit_variable=function(t,e){return this.solver.addEditVariable(t,e)},t.prototype.remove_edit_variable=function(t){return this.solver.removeEditVariable(t,strength)},t.prototype.suggest_value=function(t,e){return this.solver.suggestValue(t,e)},t}(),e.exports={Variable:u,Expression:i,Constraint:n,Operator:s,Strength:l,EQ:p(s.Eq),LE:p(s.Le),GE:p(s.Ge),WEAK_EQ:h(s.Eq),WEAK_LE:h(s.Le),WEAK_GE:h(s.Ge),Solver:a}},{"../events":"core/events",kiwi:"kiwi",underscore:"underscore"}],"core/logging":[function(t,e,r){var n,o,i,s,a,l,u,c,p=[].indexOf||function(t){for(var e=0,r=this.length;e<r;e++)if(e in this&&this[e]===t)return e;return-1};i=t("underscore"),u=function(){},a=function(t,e){return null!=console[t]?console[t].bind(console,e):null!=console.log?console.log.bind(console,e):u},s={},n=function(){function t(t,e){this.name=t,this.level=e}return t}(),o=function(){function t(e,r){null==r&&(r=t.INFO),this._name=e,this.set_level(r)}return t.TRACE=new n("trace",0),t.DEBUG=new n("debug",1),t.INFO=new n("info",2),t.WARN=new n("warn",6),t.ERROR=new n("error",7),t.FATAL=new n("fatal",8),t.OFF=new n("off",9),t.log_levels={trace:t.TRACE,debug:t.DEBUG,info:t.INFO,warn:t.WARN,error:t.ERROR,fatal:t.FATAL,off:t.OFF},Object.defineProperty(t,"levels",{get:function(){return Object.keys(t.log_levels)}}),t.get=function(e,r){var n;if(null==r&&(r=t.INFO),i.isString(e)&&e.length>0)return n=s[e],null==n&&(n=s[e]=new t(e,r)),n;throw new TypeError("Logger.get() expects a string name and an optional log-level")},Object.defineProperty(t.prototype,"level",{get:function(){return this.get_level()}}),t.prototype.get_level=function(){return this._log_level},t.prototype.set_level=function(e){var r,o,s,l,c;if(e instanceof n)this._log_level=e;else{if(!i.isString(e)||null==t.log_levels[e])throw new Error("Logger.set_level() expects a log-level object or a string name of a log-level");this._log_level=t.log_levels[e]}o="["+this._name+"]",l=t.log_levels,c=[];for(r in l){if(e=l[r],e===t.OFF)break;s=e.name,e.level<this._log_level.level?c.push(this[s]=u):c.push(this[s]=a(s,o))}return c},t}(),l=o.get("bokeh"),c=function(t){return p.call(o.levels,t)<0?(console.log("[bokeh] unrecognized logging level '"+t+"' passed to Bokeh.set_log_level(), ignoring"),console.log("[bokeh] valid log levels are: "+o.levels.join(", "))):(console.log("[bokeh] setting log level to: '"+t+"'"),l.set_level(t))},e.exports={Logger:o,logger:l,set_log_level:c}},{underscore:"underscore"}],"core/properties":[function(t,e,r){var n,o,i,s,a,l,u,c,p,h,_,d,f,m,g,y,v,b,x,w,k,M,T,S,z,E,A,C,j,P,N,O,D,F,q,I,R,L,B,V,G,U,Y,H,X,$,W=function(t,e){function r(){this.constructor=t}for(var n in e)J.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},J={}.hasOwnProperty,K=[].indexOf||function(t){for(var e=0,r=this.length;e<r;e++)if(e in this&&this[e]===t)return e;return-1};V=t("underscore"),v=t("./events").Events,U=t("./enums"),H=t("./util/svg_colors"),$=t("./util/color").valid_rgb,P=function(){function t(t){this.obj=t.obj,this.attr=t.attr,this.default_value=t.default_value,this._init(!1),this.listenTo(this.obj,"change:"+this.attr,function(t){return function(){return t._init(),t.obj.trigger("propchange")}}(this))}return V.extend(t.prototype,v),t.prototype.dataspec=!1,t.prototype.specifiers=["field","value"],t.prototype.update=function(){return this._init()},t.prototype.init=function(){},t.prototype.transform=function(t){return t},t.prototype.validate=function(t){},t.prototype.value=function(t){var e;if(null==t&&(t=!0),V.isUndefined(this.spec.value))throw new Error("attempted to retrieve property value for property without value specification");return e=this.transform([this.spec.value])[0],null!=this.spec.transform&&t&&(e=this.spec.transform.compute(e)),e},t.prototype.array=function(t){var e,r,n,o,i;if(!this.dataspec)throw new Error("attempted to retrieve property array for non-dataspec property");if(e=t.data,null!=this.spec.field){if(!(this.spec.field in e))throw new Error("attempted to retrieve property array for nonexistent field '"+this.spec.field+"'");o=this.transform(t.get_column(this.spec.field))}else n=t.get_length(),null==n&&(n=1),i=this.value(!1),o=function(){var t,e,o;for(o=[],r=t=0,e=n;0<=e?t<e:t>e;r=0<=e?++t:--t)o.push(i);return o}();return null!=this.spec.transform&&(o=this.spec.transform.v_compute(o)),o},t.prototype._init=function(t){var e,r,n,o;if(null==t&&(t=!0),o=this.obj,null==o)throw new Error("missing property object");if(null==o.properties)throw new Error("property object must be a HasProps");if(e=this.attr,null==e)throw new Error("missing property attr");if(r=o.getv(e),V.isUndefined(r)&&(n=this.default_value,r=function(){switch(!1){case!V.isUndefined(n):return null;case!V.isArray(n):return V.clone(n);case!V.isFunction(n):return n(o);default:return n}}(),o.setv(e,r,{silent:!0,defaults:!0})),V.isArray(r)?this.spec={value:r}:V.isObject(r)&&1===V.size(V.pick.apply(null,[r].concat(this.specifiers)))?this.spec=r:this.spec={value:r},null!=this.spec.field&&!V.isString(this.spec.field))throw new Error("field value for property '"+e+"' is not a string");if(null!=this.spec.value&&this.validate(this.spec.value),this.init(),t)return this.trigger("change")},t}(),Y=function(t,e){var r;return r=function(r){function n(){return n.__super__.constructor.apply(this,arguments)}return W(n,r),n.prototype.toString=function(){return t+"(obj: "+this.obj.id+", spec: "+JSON.stringify(this.spec)+")"},n.prototype.validate=function(r){if(!e(r))throw new Error(t+" property '"+this.attr+"' given invalid value: "+r)},n}(P)},a=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return W(e,t),e}(Y("Any",function(t){return!0})),l=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return W(e,t),e}(Y("Array",function(t){return V.isArray(t)||t instanceof Float64Array})),u=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return W(e,t),e}(Y("Bool",V.isBoolean)),c=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return W(e,t),e}(Y("Color",function(t){return null!=H[t.toLowerCase()]||"#"===t.substring(0,1)||$(t)})),k=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return W(e,t),e}(Y("Instance",function(t){return null!=t.properties})),E=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return W(e,t),e}(Y("Number",function(t){return V.isNumber(t)||V.isBoolean(t)})),j=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return W(e,t),e}(Y("Number",function(t){return(V.isNumber(t)||V.isBoolean(t))&&0<=t&&t<=1})),q=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return W(e,t),e}(Y("String",V.isString)),b=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return W(e,t),e}(q),G=function(t,e){var r;return r=function(e){function r(){return r.__super__.constructor.apply(this,arguments)}return W(r,e),r.prototype.toString=function(){return t+"(obj: "+this.obj.id+", spec: "+JSON.stringify(this.spec)+")"},r}(Y(t,function(t){return K.call(e,t)>=0}))},n=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return W(e,t),e}(G("Anchor",U.LegendLocation)),s=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return W(e,t),e}(G("AngleUnits",U.AngleUnits)),d=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return W(e,t),e.prototype.transform=function(t){var e,r,n,o;for(o=new Uint8Array(t.length),e=r=0,n=t.length;0<=n?r<n:r>n;e=0<=n?++r:--r)switch(t[e]){case"clock":o[e]=!1;break;case"anticlock":o[e]=!0}return o},e}(G("Direction",U.Direction)),h=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return W(e,t),e}(G("Dimension",U.Dimension)),_=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return W(e,t),e}(G("Dimensions",U.Dimensions)),w=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return W(e,t),e}(G("FontStyle",U.FontStyle)),T=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return W(e,t),e}(G("LineCap",U.LineCap)),S=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return W(e,t),e}(G("LineJoin",U.LineJoin)),M=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return W(e,t),e}(G("LegendLocation",U.LegendLocation)),z=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return W(e,t),e}(G("Location",U.Location)),C=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return W(e,t),e}(G("Orientation",U.Orientation)),R=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return W(e,t),e}(G("TextAlign",U.TextAlign)),L=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return W(e,t),e}(G("TextBaseline",U.TextBaseline)),N=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return W(e,t),e}(G("RenderLevel",U.RenderLevel)),O=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return W(e,t),e}(G("RenderMode",U.RenderMode)),D=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return W(e,t),e}(G("SizingMode",U.SizingMode)),F=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return W(e,t),e}(G("SpatialUnits",U.SpatialUnits)),y=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return W(e,t),e}(G("Distribution",U.DistributionTypes)),B=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return W(e,t),e}(G("TransformStepMode",U.TransformStepModes)),X=function(t,e,r){var n;return n=function(n){function o(){return o.__super__.constructor.apply(this,arguments)}return W(o,n),o.prototype.toString=function(){return t+"(obj: "+this.obj.id+", spec: "+JSON.stringify(this.spec)+")"},o.prototype.init=function(){var n;if(null==this.spec.units&&(this.spec.units=r),this.units=this.spec.units,n=this.spec.units,K.call(e,n)<0)throw new Error(t+" units must be one of "+e+", given invalid value: "+n)},o}(E)},o=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return W(e,t),e.prototype.transform=function(t){var r;return"deg"===this.spec.units&&(t=function(){var e,n,o;for(o=[],e=0,n=t.length;e<n;e++)r=t[e],o.push(r*Math.PI/180);return o}()),t=function(){var e,n,o;for(o=[],e=0,n=t.length;e<n;e++)r=t[e],o.push(-r);return o}(),e.__super__.transform.call(this,t)},e}(X("Angle",U.AngleUnits,"rad")),m=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return W(e,t),e}(X("Distance",U.SpatialUnits,"data")),i=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return W(e,t),e.prototype.dataspec=!0,e}(o),p=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return W(e,t),e.prototype.dataspec=!0,e}(c),f=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return W(e,t),e.prototype.dataspec=!0,e}(m),g=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return W(e,t),e.prototype.dataspec=!0,e}(m),x=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return W(e,t),e.prototype.dataspec=!0,e}(q),A=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return W(e,t),e.prototype.dataspec=!0,e}(E),I=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return W(e,t),e.prototype.dataspec=!0,e}(q),e.exports={Property:P,simple_prop:Y,enum_prop:G,units_prop:X,Anchor:n,Any:a,Angle:o,AngleUnits:s,Array:l,Bool:u,Boolean:u,Color:c,Dimension:h,Dimensions:_,Direction:d,Distance:m,Font:b,FontStyle:w,Instance:k,LegendLocation:M,LineCap:T,LineJoin:S,Location:z,Number:E,Percent:j,Int:E,Orientation:C,RenderLevel:N,RenderMode:O,SizingMode:D,SpatialUnits:F,String:q,TextAlign:R,TextBaseline:L,Distribution:y,TransformStepMode:B,AngleSpec:i,ColorSpec:p,DirectionSpec:f,DistanceSpec:g,FontSizeSpec:x,NumberSpec:A,StringSpec:I}},{"./enums":"core/enums","./events":"core/events","./util/color":"core/util/color","./util/svg_colors":"core/util/svg_colors",underscore:"underscore"}],"core/property_mixins":[function(t,e,r){var n,o,i,s,a,l,u,c,p,h;n=t("underscore"),p=t("./properties"),i=function(t,e){var r,n,o;n={},null==e&&(e="");for(r in t)o=t[r],n[e+r]=o;return n},s={line_color:[p.ColorSpec,"black"],line_width:[p.NumberSpec,1],line_alpha:[p.NumberSpec,1],line_join:[p.LineJoin,"miter"],line_cap:[p.LineCap,"butt"],line_dash:[p.Array,[]],line_dash_offset:[p.Number,0]},c=function(t){return i(s,t)},o={fill_color:[p.ColorSpec,"gray"],fill_alpha:[p.NumberSpec,1]},u=function(t){return i(o,t)},a={text_font:[p.Font,"helvetica"],text_font_size:[p.FontSizeSpec,"12pt"],text_font_style:[p.FontStyle,"normal"],text_color:[p.ColorSpec,"#444444"],text_alpha:[p.NumberSpec,1],text_align:[p.TextAlign,"left"],text_baseline:[p.TextBaseline,"bottom"]},h=function(t){return i(a,t)},l=function(t){var e,r,o,i,s,a,l;for(l={},r=0,i=t.length;r<i;r++){if(e=t[r],a=e.split(":"),o=a[0],s=a[1],null==this[o])throw Error("Unknown property mixin kind '"+o+"'");
|
|
l=n.extend(l,this[o](s))}return l},e.exports={line:c,fill:u,text:h,create:l}},{"./properties":"core/properties",underscore:"underscore"}],"core/selection_manager":[function(t,e,r){var n,o,i,s,a,l,u,c=function(t,e){function r(){this.constructor=t}for(var n in e)p.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},p={}.hasOwnProperty;s=t("underscore"),n=t("./has_props"),l=t("./logging").logger,i=t("./selector"),a=t("./hittest"),u=t("./properties"),o=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return c(e,t),e.prototype.type="SelectionManager",e.internal({source:[u.Any]}),e.prototype.initialize=function(t,r){return e.__super__.initialize.call(this,t,r),this.selectors={},this.inspectors={},this.last_inspection_was_empty={}},e.prototype.select=function(t,e,r,n,o){var i,s,a;return null==o&&(o=!1),a=this.source,a!==e.model.data_source&&l.warn("select called with mis-matched data sources"),i=e.hit_test(r),null!=i&&(s=this._get_selector(e),s.update(i,n,o),this.source.selected=s.indices,a.trigger("select"),a.trigger("select-"+e.model.id),!i.is_empty())},e.prototype.inspect=function(t,e,r,n){var o,i,s,a;if(a=this.source,a!==e.model.data_source&&l.warn("inspect called with mis-matched data sources"),o=e.hit_test(r),null!=o){if(s=e.model.id,o.is_empty()){if(null==this.last_inspection_was_empty[s]&&(this.last_inspection_was_empty[s]=!1),this.last_inspection_was_empty[s])return;this.last_inspection_was_empty[s]=!0}else this.last_inspection_was_empty[s]=!1;return i=this._get_inspector(e),i.update(o,!0,!1,!0),this.source.setv({inspected:i.indices},{silent:!0}),a.trigger("inspect",o,t,e,a,n),a.trigger("inspect"+e.model.id,o,t,e,a,n),!o.is_empty()}return!1},e.prototype.clear=function(t){var e,r,n,o;if(null!=t)o=this._get_selector(t),o.clear();else{r=this.selectors;for(e in r)n=r[e],n.clear()}return this.source.selected=a.create_hit_test_result()},e.prototype._get_selector=function(t){return s.setdefault(this.selectors,t.model.id,new i),this.selectors[t.model.id]},e.prototype._get_inspector=function(t){return s.setdefault(this.inspectors,t.model.id,new i),this.inspectors[t.model.id]},e}(n),e.exports=o},{"./has_props":"core/has_props","./hittest":"core/hittest","./logging":"core/logging","./properties":"core/properties","./selector":"core/selector",underscore:"underscore"}],"core/selector":[function(t,e,r){var n,o,i,s,a,l,u=function(t,e){function r(){this.constructor=t}for(var n in e)c.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},c={}.hasOwnProperty;i=t("underscore"),n=t("./has_props"),s=t("./hittest"),a=t("./logging").logger,l=t("./properties"),o=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return u(e,t),e.prototype.type="Selector",e.prototype.update=function(t,e,r,n){return null==n&&(n=!1),this.setv("timestamp",new Date,{silent:n}),this.setv("final",e,{silent:n}),r&&(t["0d"].indices=i.union(this.indices["0d"].indices,t["0d"].indices),t["0d"].glyph=this.indices["0d"].glyph||t["0d"].glyph,t["1d"].indices=i.union(this.indices["1d"].indices,t["1d"].indices),t["2d"].indices=i.union(this.indices["2d"].indices,t["2d"].indices)),this.setv("indices",t,{silent:n})},e.prototype.clear=function(){return this.timestamp=new Date,this["final"]=!0,this.indices=s.create_hit_test_result()},e.internal({indices:[l.Any,function(){return s.create_hit_test_result()}],"final":[l.Boolean],timestamp:[l.Any]}),e}(n),e.exports=o},{"./has_props":"core/has_props","./hittest":"core/hittest","./logging":"core/logging","./properties":"core/properties",underscore:"underscore"}],"core/ui_events":[function(t,e,r){var n,o,i,s,a,l,u;a=t("underscore"),n=t("jquery"),i=t("hammerjs"),u=t("jquery-mousewheel")(n),o=t("./events").Events,l=t("./logging").logger,s=function(){function t(t,e){this.toolbar=t,this.hit_area=e,this._configure_hammerjs()}return a.extend(t.prototype,o),t.prototype._configure_hammerjs=function(){return this.hammer=new i(this.hit_area[0]),this.hammer.get("doubletap").recognizeWith("tap"),this.hammer.get("tap").requireFailure("doubletap"),this.hammer.get("doubletap").dropRequireFailure("tap"),this.hammer.on("doubletap",function(t){return function(e){return t._doubletap(e)}}(this)),this.hammer.on("tap",function(t){return function(e){return t._tap(e)}}(this)),this.hammer.on("press",function(t){return function(e){return t._press(e)}}(this)),this.hammer.get("pan").set({direction:i.DIRECTION_ALL}),this.hammer.on("panstart",function(t){return function(e){return t._pan_start(e)}}(this)),this.hammer.on("pan",function(t){return function(e){return t._pan(e)}}(this)),this.hammer.on("panend",function(t){return function(e){return t._pan_end(e)}}(this)),this.hammer.get("pinch").set({enable:!0}),this.hammer.on("pinchstart",function(t){return function(e){return t._pinch_start(e)}}(this)),this.hammer.on("pinch",function(t){return function(e){return t._pinch(e)}}(this)),this.hammer.on("pinchend",function(t){return function(e){return t._pinch_end(e)}}(this)),this.hammer.get("rotate").set({enable:!0}),this.hammer.on("rotatestart",function(t){return function(e){return t._rotate_start(e)}}(this)),this.hammer.on("rotate",function(t){return function(e){return t._rotate(e)}}(this)),this.hammer.on("rotateend",function(t){return function(e){return t._rotate_end(e)}}(this)),this.hit_area.mousemove(function(t){return function(e){return t._mouse_move(e)}}(this)),this.hit_area.mouseenter(function(t){return function(e){return t._mouse_enter(e)}}(this)),this.hit_area.mouseleave(function(t){return function(e){return t._mouse_exit(e)}}(this)),this.hit_area.mousewheel(function(t){return function(e,r){return t._mouse_wheel(e,r)}}(this)),n(document).keydown(function(t){return function(e){return t._key_down(e)}}(this)),n(document).keyup(function(t){return function(e){return t._key_up(e)}}(this))},t.prototype.register_tool=function(t){var e,r,n;return e=t.model.event_type,r=t.model.id,n=t.model.type,null==e?void l.debug("Button tool: "+n):("pan"===e||"pinch"===e||"rotate"===e?(l.debug("Registering tool: "+n+" for event '"+e+"'"),null!=t["_"+e+"_start"]&&t.listenTo(this,e+":start:"+r,t["_"+e+"_start"]),t["_"+e]&&t.listenTo(this,e+":"+r,t["_"+e]),t["_"+e+"_end"]&&t.listenTo(this,e+":end:"+r,t["_"+e+"_end"])):"move"===e?(l.debug("Registering tool: "+n+" for event '"+e+"'"),null!=t._move_enter&&t.listenTo(this,"move:enter",t._move_enter),t.listenTo(this,"move",t._move),null!=t._move_exit&&t.listenTo(this,"move:exit",t._move_exit)):(l.debug("Registering tool: "+n+" for event '"+e+"'"),t.listenTo(this,e+":"+r,t["_"+e])),null!=t._keydown&&(l.debug("Registering tool: "+n+" for event 'keydown'"),t.listenTo(this,"keydown",t._keydown)),null!=t._keyup&&(l.debug("Registering tool: "+n+" for event 'keyup'"),t.listenTo(this,"keyup",t._keyup)),null!=t._doubletap&&(l.debug("Registering tool: "+n+" for event 'doubletap'"),t.listenTo(this,"doubletap",t._doubletap)),("ontouchstart"in window||navigator.maxTouchPoints>0)&&"pinch"===e?(l.debug("Registering scroll on touch screen"),t.listenTo(this,"scroll:"+r,t._scroll)):void 0)},t.prototype._trigger=function(t,e){var r,n,o;if(n=t.split(":")[0],("ontouchstart"in window||navigator.maxTouchPoints>0)&&"scroll"===t&&(n="pinch"),o=this.toolbar.gestures,r=o[n].active,null!=r)return this._trigger_event(t,r,e)},t.prototype._trigger_event=function(t,e,r){if(e.active===!0)return"scroll"===t&&(r.preventDefault(),r.stopPropagation()),this.trigger(t+":"+e.id,r)},t.prototype._bokify_hammer=function(t){var e,r,o,i,s,a,l;return"mouse"===t.pointerType?(a=t.srcEvent.pageX,l=t.srcEvent.pageY):(a=t.pointers[0].pageX,l=t.pointers[0].pageY),r=n(t.target).offset(),e=null!=(o=r.left)?o:0,s=null!=(i=r.top)?i:0,t.bokeh={sx:a-e,sy:l-s}},t.prototype._bokify_jq=function(t){var e,r,o,i,s;return r=n(t.currentTarget).offset(),e=null!=(o=r.left)?o:0,s=null!=(i=r.top)?i:0,t.bokeh={sx:t.pageX-e,sy:t.pageY-s}},t.prototype._tap=function(t){return this._bokify_hammer(t),this._trigger("tap",t)},t.prototype._doubletap=function(t){return this._bokify_hammer(t),this.trigger("doubletap",t)},t.prototype._press=function(t){return this._bokify_hammer(t),this._trigger("press",t)},t.prototype._pan_start=function(t){return this._bokify_hammer(t),t.bokeh.sx-=t.deltaX,t.bokeh.sy-=t.deltaY,this._trigger("pan:start",t)},t.prototype._pan=function(t){return this._bokify_hammer(t),this._trigger("pan",t)},t.prototype._pan_end=function(t){return this._bokify_hammer(t),this._trigger("pan:end",t)},t.prototype._pinch_start=function(t){return this._bokify_hammer(t),this._trigger("pinch:start",t)},t.prototype._pinch=function(t){return this._bokify_hammer(t),this._trigger("pinch",t)},t.prototype._pinch_end=function(t){return this._bokify_hammer(t),this._trigger("pinch:end",t)},t.prototype._rotate_start=function(t){return this._bokify_hammer(t),this._trigger("rotate:start",t)},t.prototype._rotate=function(t){return this._bokify_hammer(t),this._trigger("rotate",t)},t.prototype._rotate_end=function(t){return this._bokify_hammer(t),this._trigger("rotate:end",t)},t.prototype._mouse_enter=function(t){return this._bokify_jq(t),this.trigger("move:enter",t)},t.prototype._mouse_move=function(t){return this._bokify_jq(t),this.trigger("move",t)},t.prototype._mouse_exit=function(t){return this._bokify_jq(t),this.trigger("move:exit",t)},t.prototype._mouse_wheel=function(t,e){return this._bokify_jq(t),t.bokeh.delta=e,this._trigger("scroll",t)},t.prototype._key_down=function(t){return this.trigger("keydown",t)},t.prototype._key_up=function(t){return this.trigger("keyup",t)},t}(),e.exports={UIEvents:s}},{"./events":"core/events","./logging":"core/logging",hammerjs:"hammerjs",jquery:"jquery","jquery-mousewheel":"jquery-mousewheel",underscore:"underscore"}],"core/util/bbox":[function(t,e,r){var n,o;n=function(){return{minX:1/0,minY:1/0,maxX:-(1/0),maxY:-(1/0)}},o=function(t,e){var r;return r={},r.minX=Math.min(t.minX,e.minX),r.maxX=Math.max(t.maxX,e.maxX),r.minY=Math.min(t.minY,e.minY),r.maxY=Math.max(t.maxY,e.maxY),r},e.exports={empty:n,union:o}},{}],"core/util/canvas":[function(t,e,r){var n,o,i,s,a,l;i=function(t){if(t.setLineDash||(t.setLineDash=function(e){return t.mozDash=e,t.webkitLineDash=e}),!t.getLineDash)return t.getLineDash=function(){return t.mozDash}},s=function(t){return t.setLineDashOffset=function(e){return t.lineDashOffset=e,t.mozDashOffset=e,t.webkitLineDashOffset=e},t.getLineDashOffset=function(){return t.mozDashOffset}},o=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}},a=function(t){if(t.measureText&&null==t.html5MeasureText)return t.html5MeasureText=t.measureText,t.measureText=function(e){var r;return r=t.html5MeasureText(e),r.ascent=1.6*t.html5MeasureText("m").width,r}},l=function(t,e){var r,n;return e?(n=window.devicePixelRatio||1,r=t.webkitBackingStorePixelRatio||t.mozBackingStorePixelRatio||t.msBackingStorePixelRatio||t.oBackingStorePixelRatio||t.backingStorePixelRatio||1,n/r):1},n=function(t){var e;if(e=function(e,r,n,o,i,s,a,l){var u,c,p;null==l&&(l=!1),u=.551784,t.translate(e,r),t.rotate(i),c=n,p=o,l&&(c=-n,p=-o),t.moveTo(-c,0),t.bezierCurveTo(-c,p*u,-c*u,p,0,p),t.bezierCurveTo(c*u,p,c,p*u,c,0),t.bezierCurveTo(c,-p*u,c*u,-p,0,-p),t.bezierCurveTo(-c*u,-p,-c,-p*u,-c,0),t.rotate(-i),t.translate(-e,-r)},!t.ellipse)return t.ellipse=e},e.exports={fixup_image_smoothing:o,fixup_line_dash:i,fixup_line_dash_offset:s,fixup_measure_text:a,get_scale_ratio:l,fixup_ellipse:n}},{}],"core/util/color":[function(t,e,r){var n,o,i,s,a,l=[].indexOf||function(t){for(var e=0,r=this.length;e<r;e++)if(e in this&&this[e]===t)return e;return-1};s=t("./svg_colors"),n=function(t){var e;return e=Number(t).toString(16),e=1===e.length?"0"+e:e},o=function(t){var e,r,o;return t+="",0===t.indexOf("#")?t:null!=s[t]?s[t]:0===t.indexOf("rgb")?(r=t.match(/\d+/g),e=function(){var t,e,i;for(i=[],t=0,e=r.length;t<e;t++)o=r[t],i.push(n(o));return i}().join(""),"#"+e.slice(0,8)):t},i=function(t,e){var r,n,i;if(null==e&&(e=1),!t)return[0,0,0,0];for(r=o(t),r=r.replace(/ |#/g,""),r.length<=4&&(r=r.replace(/(.)/g,"$1$1")),r=r.match(/../g),i=function(){var t,e,o;for(o=[],t=0,e=r.length;t<e;t++)n=r[t],o.push(parseInt(n,16)/255);return o}();i.length<3;)i.push(0);return i.length<4&&i.push(e),i.slice(0,4)},a=function(t){var e,r,n,o;switch(t.substring(0,4)){case"rgba":r={start:"rgba(",len:4,alpha:!0};break;case"rgb(":r={start:"rgb(",len:3,alpha:!1};break;default:return!1}if(new RegExp(".*?(\\.).*(,)").test(t))throw new Error("color expects integers for rgb in rgb/rgba tuple, received "+t);if(e=t.replace(r.start,"").replace(")","").split(",").map(parseFloat),e.length!==r.len)throw new Error("color expects rgba "+expect_len+"-tuple, received "+t);if(r.alpha&&!(0<=(n=e[3])&&n<=1))throw new Error("color expects rgba 4-tuple to have alpha value between 0 and 1");if(l.call(function(){var t,r,n,i;for(n=e.slice(0,3),i=[],t=0,r=n.length;t<r;t++)o=n[t],i.push(0<=o&&o<=255);return i}(),!1)>=0)throw new Error("color expects rgb to have value between 0 and 255");return!0},e.exports={color2hex:o,color2rgba:i,valid_rgb:a}},{"./svg_colors":"core/util/svg_colors"}],"core/util/data_structures":[function(t,e,r){var n,o,i;i=t("underscore"),n=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 r;if(null===e)throw new Error("Can't put null in this dict");if(i.isArray(e))throw new Error("Can't put arrays in this dict");return r=this._existing(t),null===r?this._dict[t]=e:i.isArray(r)?r.push(e):this._dict[t]=[r,e]},t.prototype.remove_value=function(t,e){var r,n;return r=this._existing(t),i.isArray(r)?(n=i.without(r,e),n.length>0?this._dict[t]=n:delete this._dict[t]):i.isEqual(r,e)?delete this._dict[t]:void 0},t.prototype.get_one=function(t,e){var r;if(r=this._existing(t),i.isArray(r)){if(1===r.length)return r[0];throw new Error(e)}return r},t}(),o=function(){function t(e){if(e){if(e.constructor===t)return new t(e.values);e.constructor===Array?this.values=t.compact(e):this.values=[e]}else this.values=[]}return t.compact=function(t){var e,r,n,o;for(o=[],r=0,n=t.length;r<n;r++)e=t[r],o.indexOf(e)===-1&&o.push(e);return o},t.prototype.push=function(t){if(this.missing(t))return this.values.push(t)},t.prototype.remove=function(t){var e;return e=this.values.indexOf(t),this.values=this.values.slice(0,e).concat(this.values.slice(e+1))},t.prototype.length=function(){return this.values.length},t.prototype.includes=function(t){return this.values.indexOf(t)!==-1},t.prototype.missing=function(t){return!this.includes(t)},t.prototype.slice=function(t,e){return this.values.slice(t,e)},t.prototype.join=function(t){return this.values.join(t)},t.prototype.toString=function(){return this.join(", ")},t.prototype.includes=function(t){return this.values.indexOf(t)!==-1},t.prototype.union=function(e){return e=new t(e),new t(this.values.concat(e.values))},t.prototype.intersect=function(e){var r,n,o,i,s;for(e=new t(e),i=new t,s=e.values,n=0,o=s.length;n<o;n++)r=s[n],this.includes(r)&&e.includes(r)&&i.push(r);return i},t.prototype.diff=function(e){var r,n,o,i,s;for(e=new t(e),i=new t,s=this.values,n=0,o=s.length;n<o;n++)r=s[n],e.missing(r)&&i.push(r);return i},t}(),e.exports={MultiDict:n,Set:o}},{underscore:"underscore"}],"core/util/math":[function(t,e,r){var n,o,i,s,a,l,u,c;a=function(t){var e,r,n;for(e=t.length,r=1/0;e--;)n=t[e],n<r&&(r=n);return r},s=function(t){var e,r,n;for(e=t.length,r=-(1/0);e--;)n=t[e],n>r&&(r=n);return r},i=function(t){for(;t<0;)t+=2*Math.PI;for(;t>2*Math.PI;)t-=2*Math.PI;return t},o=function(t,e){return Math.abs(i(t-e))},n=function(t,e,r,n){var s;return t=i(t),s=o(e,r),"anticlock"===n?o(e,t)<=s&&o(t,r)<=s:!(o(e,t)<=s&&o(t,r)<=s)},u=function(){return Math.random()},l=function(t,e){return Math.atan2(e[1]-t[1],e[0]-t[0])},c=function(t,e){var r,n,o;for(r=null,n=null;;)if(r=u(),n=u(),n=(2*n-1)*Math.sqrt(2*(1/Math.E)),-4*r*r*Math.log(r)>=n*n)break;return o=n/r,o=t+e*o},e.exports={array_min:a,array_max:s,angle_norm:i,angle_dist:o,angle_between:n,atan2:l,rnorm:c,random:u}},{}],"core/util/proj4":[function(t,e,r){var n;e.exports=n=t("proj4/lib/core"),n.defaultDatum="WGS84",n.Proj=t("proj4/lib/Proj"),n.WGS84=new n.Proj("WGS84"),n.toPoint=t("proj4/lib/common/toPoint"),n.defs=t("proj4/lib/defs"),n.transform=t("proj4/lib/transform")},{"proj4/lib/Proj":"proj4/lib/Proj","proj4/lib/common/toPoint":"proj4/lib/common/toPoint","proj4/lib/core":"proj4/lib/core","proj4/lib/defs":"proj4/lib/defs","proj4/lib/transform":"proj4/lib/transform"}],"core/util/projections":[function(t,e,r){var n,o,i,s;n=t("./proj4"),s=n.defs("GOOGLE"),i=function(t,e){var r,o,i,a,l,u,c,p;for(a=[],u=[],r=o=0,c=t.length;0<=c?o<c:o>c;r=0<=c?++o:--o)p=n(s,[t[r],e[r]]),i=p[0],l=p[1],a[r]=i,u[r]=l;return[a,u]},o=function(t,e){var r,n,o,s,a,l,u,c;for(s=[],l=[],r=n=0,u=t.length;0<=u?n<u:n>u;r=0<=u?++n:--n)c=i(t[r],e[r]),o=c[0],a=c[1],s[r]=o,l[r]=a;return[s,l]},e.exports={project_xy:i,project_xsys:o}},{"./proj4":"core/util/proj4"}],"core/util/refs":[function(t,e,r){var n,o,i,s,a;o=t("underscore"),n=t("../has_props"),s=function(t){var e;if(!(t instanceof n.constructor))throw new Error("can only create refs for HasProps subclasses");return e={type:t.type,id:t.id},null!=t._subtype&&(e.subtype=t._subtype),e},a=function(t){var e;if(o.isObject(t)){if(e=o.keys(t).sort(),2===e.length)return"id"===e[0]&&"type"===e[1];if(3===e.length)return"id"===e[0]&&"subtype"===e[1]&&"type"===e[2]}return!1},i=function(t){return o.isArray(t)?o.map(t,i):t instanceof n.constructor?t.ref():void 0},e.exports={convert_to_ref:i,create_ref:s,is_ref:a}},{"../has_props":"core/has_props",underscore:"underscore"}],"core/util/selection":[function(t,e,r){var n;n=function(t){var e;return e=t.selected,e["0d"].glyph?e["0d"].indices:e["1d"].indices.length>0?e["1d"].indices:e["2d"].indices.length>0?e["2d"].indices:[]},e.exports={get_indices:n}},{}],"core/util/svg_colors":[function(t,e,r){e.exports={indianred:"#CD5C5C",lightcoral:"#F08080",salmon:"#FA8072",darksalmon:"#E9967A",lightsalmon:"#FFA07A",crimson:"#DC143C",red:"#FF0000",firebrick:"#B22222",darkred:"#8B0000",pink:"#FFC0CB",lightpink:"#FFB6C1",hotpink:"#FF69B4",deeppink:"#FF1493",mediumvioletred:"#C71585",palevioletred:"#DB7093",coral:"#FF7F50",tomato:"#FF6347",orangered:"#FF4500",darkorange:"#FF8C00",orange:"#FFA500",gold:"#FFD700",yellow:"#FFFF00",lightyellow:"#FFFFE0",lemonchiffon:"#FFFACD",lightgoldenrodyellow:"#FAFAD2",papayawhip:"#FFEFD5",moccasin:"#FFE4B5",peachpuff:"#FFDAB9",palegoldenrod:"#EEE8AA",khaki:"#F0E68C",darkkhaki:"#BDB76B",lavender:"#E6E6FA",thistle:"#D8BFD8",plum:"#DDA0DD",violet:"#EE82EE",orchid:"#DA70D6",fuchsia:"#FF00FF",magenta:"#FF00FF",mediumorchid:"#BA55D3",mediumpurple:"#9370DB",blueviolet:"#8A2BE2",darkviolet:"#9400D3",darkorchid:"#9932CC",darkmagenta:"#8B008B",purple:"#800080",indigo:"#4B0082",slateblue:"#6A5ACD",darkslateblue:"#483D8B",mediumslateblue:"#7B68EE",greenyellow:"#ADFF2F",chartreuse:"#7FFF00",lawngreen:"#7CFC00",lime:"#00FF00",limegreen:"#32CD32",palegreen:"#98FB98",lightgreen:"#90EE90",mediumspringgreen:"#00FA9A",springgreen:"#00FF7F",mediumseagreen:"#3CB371",seagreen:"#2E8B57",forestgreen:"#228B22",green:"#008000",darkgreen:"#006400",yellowgreen:"#9ACD32",olivedrab:"#6B8E23",olive:"#808000",darkolivegreen:"#556B2F",mediumaquamarine:"#66CDAA",darkseagreen:"#8FBC8F",lightseagreen:"#20B2AA",darkcyan:"#008B8B",teal:"#008080",aqua:"#00FFFF",cyan:"#00FFFF",lightcyan:"#E0FFFF",paleturquoise:"#AFEEEE",aquamarine:"#7FFFD4",turquoise:"#40E0D0",mediumturquoise:"#48D1CC",darkturquoise:"#00CED1",cadetblue:"#5F9EA0",steelblue:"#4682B4",lightsteelblue:"#B0C4DE",powderblue:"#B0E0E6",lightblue:"#ADD8E6",skyblue:"#87CEEB",lightskyblue:"#87CEFA",deepskyblue:"#00BFFF",dodgerblue:"#1E90FF",cornflowerblue:"#6495ED",royalblue:"#4169E1",blue:"#0000FF",mediumblue:"#0000CD",darkblue:"#00008B",navy:"#000080",midnightblue:"#191970",cornsilk:"#FFF8DC",blanchedalmond:"#FFEBCD",bisque:"#FFE4C4",navajowhite:"#FFDEAD",wheat:"#F5DEB3",burlywood:"#DEB887",tan:"#D2B48C",rosybrown:"#BC8F8F",sandybrown:"#F4A460",goldenrod:"#DAA520",darkgoldenrod:"#B8860B",peru:"#CD853F",chocolate:"#D2691E",saddlebrown:"#8B4513",sienna:"#A0522D",brown:"#A52A2A",maroon:"#800000",white:"#FFFFFF",snow:"#FFFAFA",honeydew:"#F0FFF0",mintcream:"#F5FFFA",azure:"#F0FFFF",aliceblue:"#F0F8FF",ghostwhite:"#F8F8FF",whitesmoke:"#F5F5F5",seashell:"#FFF5EE",beige:"#F5F5DC",oldlace:"#FDF5E6",floralwhite:"#FFFAF0",ivory:"#FFFFF0",antiquewhite:"#FAEBD7",linen:"#FAF0E6",lavenderblush:"#FFF0F5",mistyrose:"#FFE4E1",gainsboro:"#DCDCDC",lightgray:"#D3D3D3",lightgrey:"#D3D3D3",silver:"#C0C0C0",darkgray:"#A9A9A9",darkgrey:"#A9A9A9",gray:"#808080",grey:"#808080",dimgray:"#696969",dimgrey:"#696969",lightslategray:"#778899",lightslategrey:"#778899",slategray:"#708090",slategrey:"#708090",darkslategray:"#2F4F4F",darkslategrey:"#2F4F4F",black:"#000000"}},{}],"core/util/templating":[function(t,e,r){var n,o,i,s,a;i=t("underscore"),o=t("sprintf"),n=t("numbro"),s=function(t){var e;return i.isNumber(t)?(e=function(){switch(!1){case Math.floor(t)!==t:return"%d";case!(Math.abs(t)>.1&&Math.abs(t)<1e3):return"%0.3f";default:return"%0.3e"}}(),o.sprintf(e,t)):""+t},a=function(t,e,r,o){return null==o&&(o={}),t=t.replace(/(^|[^\$])\$(\w+)/g,function(t){return function(t,e,r){return e+"@$"+r}}(this)),t=t.replace(/(^|[^@])@(?:(\$?\w+)|{([^{}]+)})(?:{([^{}]+)})?/g,function(t){return function(t,a,l,u,c){var p,h,_;return l=null!=u?u:l,_="$"===l[0]?o[l.substring(1)]:null!=(p=e.get_column(l))?p[r]:void 0,h=null==_?"???":null!=c?n.format(_,c):s(_),""+a+i.escape(h)}}(this))},e.exports={replace_placeholders:a}},{numbro:"numbro",sprintf:"sprintf",underscore:"underscore"}],"core/util/text":[function(t,e,r){var n,o,i;n=t("jquery"),o={},i=function(t){var e,r,i,s,a;if(null!=o[t])return o[t];a=n("<span>Hg</span>").css({font:t}),e=n('<div style="display: inline-block; width: 1px; height: 0px;"> </div>'),i=n("<div></div>"),i.append(a,e),r=n("body"),r.append(i);try{s={},e.css({verticalAlign:"baseline"}),s.ascent=e.offset().top-a.offset().top,e.css({verticalAlign:"bottom"}),s.height=e.offset().top-a.offset().top,s.descent=s.height-s.ascent}finally{i.remove()}return o[t]=s,s},e.exports={get_text_height:i}},{jquery:"jquery"}],"core/util/throttle":[function(t,e,r){var n,o,i;n=function(t){return t()},o=("undefined"!=typeof window&&null!==window?window.requestAnimationFrame:void 0)||("undefined"!=typeof window&&null!==window?window.mozRequestAnimationFrame:void 0)||("undefined"!=typeof window&&null!==window?window.webkitRequestAnimationFrame:void 0)||("undefined"!=typeof window&&null!==window?window.msRequestAnimationFrame:void 0)||n,i=function(t,e){var r,n,i,s,a,l,u,c;return l=[null,null,null,null],n=l[0],r=l[1],c=l[2],u=l[3],a=0,s=!1,i=function(){return a=new Date,c=null,s=!1,u=t.apply(n,r)},function(){var t,l;return t=new Date,l=e-(t-a),n=this,r=arguments,l<=0&&!s?(clearTimeout(c),s=!0,o(i)):c||s||(c=setTimeout(function(){return o(i)},l)),u}},e.exports={throttle:i}},{}],"core/util/underscore":[function(t,e,r){var n,o;n=t("underscore"),o=function(){return n.uniqueId=function(t){var e,r,n,o,i;for(o=[],e="0123456789ABCDEF",r=n=0;n<=31;r=++n)o[r]=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}},n.isNullOrUndefined=function(t){return n.isNull(t)||n.isUndefined(t)},n.setdefault=function(t,e,r){return n.has(t,e)?t[e]:(t[e]=r,r)},e.exports={patch:o}},{underscore:"underscore"}],"core/util/zoom":[function(t,e,r){var n;n=function(t,e,r,n,o){var i,s,a,l,u,c,p,h,_,d,f,m,g,y,v,b,x,w,k,M,T,S,z,E,A;null==r&&(r=!0),null==n&&(n=!0),null==o&&(o=null),s=t.h_range,b=t.v_range,e>.9?e=.9:e<-.9&&(e=-.9),u=[s.start,s.end],k=u[0],w=u[1],c=[b.start,b.end],S=c[0],T=c[1],x=null!=o?o.x:(w+k)/2,M=null!=o?o.y:(T+S)/2,r?(m=k-(k-x)*e,g=w-(w-x)*e):(m=k,g=w),n?(y=S-(S-M)*e,v=T-(T-M)*e):(y=S,v=T),z={},p=t.x_mappers;for(l in p)a=p[l],h=a.v_map_from_target([m,g]),f=h[0],i=h[1],z[l]={start:f,end:i};E={},_=t.y_mappers;for(l in _)a=_[l],d=a.v_map_from_target([y,v]),f=d[0],i=d[1],E[l]={start:f,end:i};return A={xrs:z,yrs:E,factor:e}},e.exports={scale_range:n}},{}],"core/visuals":[function(t,e,r){var n,o,i,s,a,l,u,c,p=function(t,e){function r(){this.constructor=t}for(var n in e)h.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},h={}.hasOwnProperty;l=t("underscore"),c=t("./property_mixins"),u=t("./util/color").color2rgba,n=function(){function t(t,e){var r,n,o,i,s;for(null==e&&(e=""),this.obj=t,this.prefix=e,this.cache={},n=t.properties[e+this.do_attr].spec,this.doit=!l.isNull(n.value),s=this.attrs,o=0,i=s.length;o<i;o++)r=s[o],this[r]=t.properties[e+r]}return t.prototype.warm_cache=function(t){var e,r,n,o,i,s;for(i=this.attrs,s=[],r=0,n=i.length;r<n;r++)e=i[r],o=this.obj.properties[this.prefix+e],l.isUndefined(o.spec.value)?s.push(this.cache[e+"_array"]=o.array(t)):s.push(this.cache[e]=o.spec.value);return s},t.prototype.cache_select=function(t,e){var r;return r=this.obj.properties[this.prefix+t],l.isUndefined(r.spec.value)?this.cache[t]=this.cache[t+"_array"][e]:this.cache[t]=r.spec.value},t}(),i=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return p(e,t),e.prototype.attrs=l.keys(c.line()),e.prototype.do_attr="line_color",e.prototype.set_value=function(t){return t.strokeStyle=this.line_color.value(),t.globalAlpha=this.line_alpha.value(),t.lineWidth=this.line_width.value(),t.lineJoin=this.line_join.value(),t.lineCap=this.line_cap.value(),t.setLineDash(this.line_dash.value()),t.setLineDashOffset(this.line_dash_offset.value())},e.prototype.set_vectorize=function(t,e){if(this.cache_select("line_color",e),t.strokeStyle!==this.cache.line_color&&(t.strokeStyle=this.cache.line_color),this.cache_select("line_alpha",e),t.globalAlpha!==this.cache.line_alpha&&(t.globalAlpha=this.cache.line_alpha),this.cache_select("line_width",e),t.lineWidth!==this.cache.line_width&&(t.lineWidth=this.cache.line_width),this.cache_select("line_join",e),t.lineJoin!==this.cache.line_join&&(t.lineJoin=this.cache.line_join),this.cache_select("line_cap",e),t.lineCap!==this.cache.line_cap&&(t.lineCap=this.cache.line_cap),this.cache_select("line_dash",e),t.getLineDash()!==this.cache.line_dash&&t.setLineDash(this.cache.line_dash),this.cache_select("line_dash_offset",e),t.getLineDashOffset()!==this.cache.line_dash_offset)return t.setLineDashOffset(this.cache.line_dash_offset)},e.prototype.color_value=function(){var t;return t=u(this.line_color.value(),this.line_alpha.value()),"rgba("+255*t[0]+","+255*t[1]+","+255*t[2]+","+t[3]+")"},e}(n),o=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return p(e,t),e.prototype.attrs=l.keys(c.fill()),e.prototype.do_attr="fill_color",e.prototype.set_value=function(t){return t.fillStyle=this.fill_color.value(),t.globalAlpha=this.fill_alpha.value()},e.prototype.set_vectorize=function(t,e){if(this.cache_select("fill_color",e),t.fillStyle!==this.cache.fill_color&&(t.fillStyle=this.cache.fill_color),this.cache_select("fill_alpha",e),t.globalAlpha!==this.cache.fill_alpha)return t.globalAlpha=this.cache.fill_alpha},e.prototype.color_value=function(){var t;return t=u(this.fill_color.value(),this.fill_alpha.value()),"rgba("+255*t[0]+","+255*t[1]+","+255*t[2]+","+t[3]+")"},e}(n),s=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return p(e,t),e.prototype.attrs=l.keys(c.text()),e.prototype.do_attr="text_color",e.prototype.cache_select=function(t,r){var n;return"font"===t?(n=e.__super__.cache_select.call(this,"text_font_style",r)+" "+e.__super__.cache_select.call(this,"text_font_size",r)+" "+e.__super__.cache_select.call(this,"text_font",r),this.cache.font=n):e.__super__.cache_select.call(this,t,r)},e.prototype.font_value=function(){var t,e,r;return t=this.text_font.value(),e=this.text_font_size.value(),r=this.text_font_style.value(),r+" "+e+" "+t},e.prototype.color_value=function(){var t;return t=u(this.text_color.value(),this.text_alpha.value()),"rgba("+255*t[0]+","+255*t[1]+","+255*t[2]+","+t[3]+")"},e.prototype.set_value=function(t){return t.font=this.font_value(),t.fillStyle=this.text_color.value(),t.globalAlpha=this.text_alpha.value(),t.textAlign=this.text_align.value(),t.textBaseline=this.text_baseline.value()},e.prototype.set_vectorize=function(t,e){if(this.cache_select("font",e),t.font!==this.cache.font&&(t.font=this.cache.font),this.cache_select("text_color",e),t.fillStyle!==this.cache.text_color&&(t.fillStyle=this.cache.text_color),this.cache_select("text_alpha",e),t.globalAlpha!==this.cache.text_alpha&&(t.globalAlpha=this.cache.text_alpha),this.cache_select("text_align",e),t.textAlign!==this.cache.text_align&&(t.textAlign=this.cache.text_align),this.cache_select("text_baseline",e),t.textBaseline!==this.cache.text_baseline)return t.textBaseline=this.cache.text_baseline},e}(n),a=function(){function t(t){var e,r,n,a,l,u,c,p,h;for(u=t.mixins,r=0,n=u.length;r<n;r++)h=u[r],c=h.split(":"),a=c[0],l=null!=(p=c[1])?p:"",e=function(){switch(a){case"line":return i;case"fill":return o;case"text":return s}}(),this[l+a]=new e(t,l)}return t.prototype.warm_cache=function(t){var e,r,o;o=[];for(e in this)h.call(this,e)&&(r=this[e],r instanceof n?o.push(r.warm_cache(t)):o.push(void 0));return o},t}(),e.exports={Visuals:a,Line:i,Fill:o,Text:s}},{"./property_mixins":"core/property_mixins","./util/color":"core/util/color",underscore:"underscore"}],document:[function(t,e,r){var n,o,i,s,a,l,u,c,p,h,_,d,f,m,g,y,v,b,x,w,k,M,T=function(t,e){function r(){this.constructor=t}for(var n in e)S.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},S={}.hasOwnProperty,z=[].indexOf||function(t){for(var e=0,r=this.length;e<r;e++)if(e in this&&this[e]===t)return e;return-1};v=t("underscore"),n=t("jquery"),p=t("./base").Models,x=t("./version"),k=t("./core/layout/solver"),l=k.EQ,m=k.Solver,y=k.Variable,w=t("./core/logging").logger,u=t("./core/has_props"),b=t("./core/util/refs").is_ref,M=t("./core/util/data_structures"),h=M.MultiDict,f=M.Set,o=t("./models/sources/column_data_source"),a=function(){function t(t){this.document=t}return t}(),c=function(t){function e(t,r,n,o,i){this.document=t,this.model=r,this.attr=n,this.old=o,this.new_=i,e.__super__.constructor.call(this,this.document)}return T(e,t),e.prototype.json=function(t){var e,r,n,o;if("id"===this.attr)throw console.log("'id' field is immutable and should never be in a ModelChangedEvent ",this),new Error("'id' field should never change, whatever code just set it is wrong");r=this.new_,n=u._value_to_json("new_",r,this.model),o={},u._value_record_references(r,o,!0),this.model.id in o&&this.model!==r&&delete o[this.model.id];for(e in o)t[e]=o[e];return{kind:"ModelChanged",model:this.model.ref(),attr:this.attr,"new":n}},e}(a),g=function(t){function e(t,r){this.document=t,this.title=r,e.__super__.constructor.call(this,this.document)}return T(e,t),e.prototype.json=function(t){return{kind:"TitleChanged",title:this.title}},e}(a),_=function(t){function e(t,r){this.document=t,this.model=r,e.__super__.constructor.call(this,this.document)}return T(e,t),e.prototype.json=function(t){return u._value_record_references(this.model,t,!0),{kind:"RootAdded",model:this.model.ref()}},e}(a),d=function(t){function e(t,r){this.document=t,this.model=r,e.__super__.constructor.call(this,this.document)}return T(e,t),e.prototype.json=function(t){return{kind:"RootRemoved",model:this.model.ref()}},e}(a),i="Bokeh Application",s=function(){function t(){this._title=i,this._roots=[],this._all_models={},this._all_models_by_name=new h,this._all_models_freeze_count=0,this._callbacks=[],this._doc_width=new y("document_width"),this._doc_height=new y("document_height"),this._solver=new m,this._init_solver(),n(window).on("resize",function(t){
|
|
return function(){return t.resize()}}(this))}return t.prototype._init_solver=function(){var t,e,r,n,o;for(this._solver.clear(),this._solver.add_edit_variable(this._doc_width),this._solver.add_edit_variable(this._doc_height),n=this._roots,o=[],t=0,e=n.length;t<e;t++)r=n[t],r.layoutable?o.push(this._add_layoutable(r)):o.push(void 0);return o},t.prototype.solver=function(){return this._solver},t.prototype.resize=function(t,e){return null==t&&(t=null),null==e&&(e=null),this._resize(t,e),this._resize(t,e)},t.prototype._resize=function(t,e){var r,o,i,s,a,l,u,c;for(null==t&&(t=null),null==e&&(e=null),s=this._roots,r=0,o=s.length;r<o;r++)if(a=s[r],a.layoutable===!0&&(c=a.get_constrained_variables(),null!=c.width||null!=c.height)){if(l=n("#modelid_"+a.id),v.isNull(t)){for(u=0,i=l;0===u;)i=i.parent(),u=i.height();t=i.width(),e=u}null!=c.width&&(w.debug("Suggest width on Document -- "+t),this._solver.suggest_value(this._doc_width,t)),null!=c.height&&(w.debug("Suggest height on Document -- "+e),this._solver.suggest_value(this._doc_height,e))}return this._solver.update_variables(!1),this._solver.trigger("resize")},t.prototype.clear=function(){var t;this._push_all_models_freeze();try{for(t=[];this._roots.length>0;)t.push(this.remove_root(this._roots[0]));return t}finally{this._pop_all_models_freeze()}},t.prototype._destructively_move=function(t){var e,r,n,o,i,s;if(t===this)throw new Error("Attempted to overwrite a document with itself");t.clear(),s=[],this._push_all_models_freeze();try{for(;this._roots.length>0;)this.remove_root(this._roots[0]),s.push(i)}finally{this._pop_all_models_freeze()}for(e=0,n=s.length;e<n;e++)if(i=s[e],null!==i.document)throw new Error("Somehow we didn't detach "+i);if(0!==_all_models.length)throw new Error("_all_models still had stuff in it: "+this._all_models);for(r=0,o=s.length;r<o;r++)i=s[r],t.add_root(i);return t.set_title(this._title)},t.prototype._push_all_models_freeze=function(){return this._all_models_freeze_count+=1},t.prototype._pop_all_models_freeze=function(){if(this._all_models_freeze_count-=1,0===this._all_models_freeze_count)return this._recompute_all_models()},t.prototype._invalidate_all_models=function(){if(w.debug("invalidating document models"),0===this._all_models_freeze_count)return this._recompute_all_models()},t.prototype._recompute_all_models=function(){var t,e,r,n,o,i,s,a,l,u,c,p,h,_,d,m,g,y,b,x,w,k;for(p=new f,g=this._roots,r=0,o=g.length;r<o;r++)d=g[r],p=p.union(d.references());for(_=new f(v.values(this._all_models)),k=_.diff(p),w=p.diff(_),m={},y=p.values,n=0,i=y.length;n<i;n++)l=y[n],m[l.id]=l;for(b=k.values,u=0,s=b.length;u<s;u++)e=b[u],e.detach_document(),c=e.name,null!==c&&this._all_models_by_name.remove_value(c,e);for(x=w.values,h=0,a=x.length;h<a;h++)t=x[h],t.attach_document(this),c=t.name,null!==c&&this._all_models_by_name.add_value(c,t);return this._all_models=m},t.prototype.roots=function(){return this._roots},t.prototype._add_layoutable=function(t){var e,r,n,o,i,s,a,u,c,p,h;if(t.layoutable!==!0)throw new Error("Cannot add non-layoutable - "+t);for(o=t.get_edit_variables(),r=t.get_constraints(),h=t.get_constrained_variables(),i=0,a=o.length;i<a;i++)c=o[i],n=c.edit_variable,p=c.strength,this._solver.add_edit_variable(n,p);for(s=0,u=r.length;s<u;s++)e=r[s],this._solver.add_constraint(e);return null!=h.width&&this._solver.add_constraint(l(h.width,this._doc_width)),null!=h.height&&this._solver.add_constraint(l(h.height,this._doc_height)),this._solver.update_variables()},t.prototype.add_root=function(t){if(w.debug("Adding root: "+t),!(z.call(this._roots,t)>=0)){this._push_all_models_freeze();try{this._roots.push(t),t._is_root=!0}finally{this._pop_all_models_freeze()}return this._init_solver(),this._trigger_on_change(new _(this,t))}},t.prototype.remove_root=function(t){var e;if(e=this._roots.indexOf(t),!(e<0)){this._push_all_models_freeze();try{this._roots.splice(e,1),t._is_root=!1}finally{this._pop_all_models_freeze()}return this._init_solver(),this._trigger_on_change(new d(this,t))}},t.prototype.title=function(){return this._title},t.prototype.set_title=function(t){if(t!==this._title)return this._title=t,this._trigger_on_change(new g(this,t))},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){if(!(z.call(this._callbacks,t)>=0))return this._callbacks.push(t)},t.prototype.remove_on_change=function(t){var e;if(e=this._callbacks.indexOf(t),e>=0)return this._callbacks.splice(e,1)},t.prototype._trigger_on_change=function(t){var e,r,n,o,i;for(o=this._callbacks,i=[],r=0,n=o.length;r<n;r++)e=o[r],i.push(e(t));return i},t.prototype._notify_change=function(t,e,r,n){return"name"===e&&(this._all_models_by_name.remove_value(r,t),null!==n&&this._all_models_by_name.add_value(n,t)),this._trigger_on_change(new c(this,t,e,r,n))},t._references_json=function(t,e){var r,n,o,i,s;for(null==e&&(e=!0),s=[],r=0,n=t.length;r<n;r++)o=t[r],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,r){var n,o;return n=v.extend({},r,{id:t}),new(o=p(e))(n,{silent:!0,defer_initialization:!0})},t._instantiate_references_json=function(e,r){var n,o,i,s,a,l,u,c;for(c={},o=0,i=e.length;o<i;o++)s=e[o],l=s.id,u=s.type,a=s.attributes,l in r?n=r[l]:(n=t._instantiate_object(l,u,a),"subtype"in s&&n.set_subtype(s.subtype)),c[n.id]=n;return c},t._resolve_refs=function(t,e,r){var n,o,i;return i=function(t){if(b(t)){if(t.id in e)return e[t.id];if(t.id in r)return r[t.id];throw new Error("reference "+JSON.stringify(t)+" isn't known (not in Document?)")}return v.isArray(t)?n(t):v.isObject(t)?o(t):t},o=function(t){var e,r,n;r={};for(e in t)n=t[e],r[e]=i(n);return r},n=function(t){var e,r,n,o;for(n=[],e=0,r=t.length;e<r;e++)o=t[e],n.push(i(o));return n},i(t)},t._initialize_references_json=function(e,r,n){var o,i,s,a,l,c,p,h,_;for(h={},s=0,a=e.length;s<a;s++)l=e[s],p=l.id,c=l.attributes,_=!1,i=p in r?r[p]:(_=!0,n[p]),c=t._resolve_refs(c,r,n),h[i.id]=[i,c,_];return o=function(t,e){var r,n,o,i,s;r={},n=function(e,o){var i,s,a,l,c,p,h,d,f,m;if(e instanceof u){if(!(e.id in r)&&e.id in t){r[e.id]=!0,h=t[e.id],m=h[0],s=h[1],_=h[2];for(i in s)a=s[i],n(a,o);return o(e,s,_)}}else{if(v.isArray(e)){for(d=[],c=0,p=e.length;c<p;c++)a=e[c],d.push(n(a,o));return d}if(v.isObject(e)){f=[];for(l in e)a=e[l],f.push(n(a,o));return f}}},i=[];for(o in t)s=t[o],i.push(n(s[0],e));return i},o(h,function(t,e,r){if(r)return t.setv(e)}),o(h,function(t,e,r){if(r)return t.initialize(e)})},t._event_for_attribute_change=function(t,e,r,n,o){var i,s;return i=n.get_model_by_id(t.id),i.attribute_is_serializable(e)?(s={kind:"ModelChanged",model:{id:t.id,type:t.type},attr:e,"new":r},u._json_record_references(n,r,o,!0),s):null},t._events_to_sync_objects=function(e,r,n,o){var i,s,a,l,u,c,p,h,_,d,f,m,g,y,b;for(a=Object.keys(e.attributes),b=Object.keys(r.attributes),g=v.difference(a,b),i=v.difference(b,a),y=v.intersection(a,b),s=[],l=0,p=g.length;l<p;l++)u=g[l],w.warn("Server sent key "+u+" but we don't seem to have it in our JSON");for(c=0,h=i.length;c<h;c++)u=i[c],f=r.attributes[u],s.push(t._event_for_attribute_change(e,u,f,n,o));for(d=0,_=y.length;d<_;d++)u=y[d],m=e.attributes[u],f=r.attributes[u],null===m&&null===f||(null===m||null===f?s.push(t._event_for_attribute_change(e,u,f,n,o)):v.isEqual(m,f)||s.push(t._event_for_attribute_change(e,u,f,n,o)));return v.filter(s,function(t){return null!==t})},t._compute_patch_since_json=function(e,r){var n,o,i,s,a,l,u,c,p,h,_,d,f,m,g,y,b,x,w,k,M,T;for(b=r.to_json(l=!1),y=function(t){var e,r,n,o,i;for(i={},o=t.roots.references,e=0,r=o.length;e<r;e++)n=o[e],i[n.id]=n;return i},o=y(e),s={},i=[],f=e.roots.root_ids,u=0,p=f.length;u<p;u++)d=f[u],s[d]=o[d],i.push(d);for(x=y(b),k={},w=[],m=b.roots.root_ids,c=0,h=m.length;c<h;c++)d=m[c],k[d]=x[d],w.push(d);if(i.sort(),w.sort(),v.difference(i,w).length>0||v.difference(w,i).length>0)throw new Error("Not implemented: computing add/remove of document roots");T={},n=[],g=r._all_models;for(a in g)_=g[a],a in o&&(M=t._events_to_sync_objects(o[a],x[a],r,T),n=n.concat(M));return{events:n,references:t._references_json(v.values(T),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 r,n,o,i,s,a;for(null==e&&(e=!0),s=[],i=this._roots,r=0,n=i.length;r<n;r++)o=i[r],s.push(o.id);return a=v.values(this._all_models),{title:this._title,roots:{root_ids:s,references:t._references_json(a,e)}}},t.from_json_string=function(e){var r;if(null===e||null==e)throw new Error("JSON string is "+typeof e);return r=JSON.parse(e),t.from_json(r)},t.from_json=function(e){var r,n,o,i,s,a,l,u,c,p;if(w.debug("Creating Document from JSON"),"object"!=typeof e)throw new Error("JSON object has wrong type "+typeof e);for(i=e.version,p="Library versions: JS ("+x+") / Python ("+i+")",i.indexOf("-")<0&&x!==i?(w.warn("JS/Python version mismatch"),w.warn(p)):w.debug(p),c=e.roots,u=c.root_ids,l=c.references,a=t._instantiate_references_json(l,{}),t._initialize_references_json(l,{},a),r=new t,n=0,o=u.length;n<o;n++)s=u[n],r.add_root(a[s]);return r.set_title(e.title),r},t.prototype.replace_with_json=function(e){var r;return r=t.from_json(e),r._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 r,n,o,i,s,a;for(s={},o=[],n=0,i=e.length;n<i;n++){if(r=e[n],r.document!==this)throw console.log("Cannot create a patch using events from a different document, event had ",r.document," we are ",this),new Error("Cannot create a patch using events from a different document");o.push(r.json(s))}return a={events:o,references:t._references_json(v.values(s))}},t.prototype.apply_json_patch_string=function(t){return this.apply_json_patch(JSON.parse(t))},t.prototype.apply_json_patch=function(e){var r,n,i,s,a,l,u,c,p,h,_,d,f,m,g,y,v,b,x,w,k,M,T,S,z;for(w=e.references,l=e.events,x=t._instantiate_references_json(w,this._all_models),c=0,h=l.length;c<h;c++)if(a=l[c],"model"in a)if(d=a.model.id,d in this._all_models)x[d]=this._all_models[d];else if(!(d in x))throw console.log("Got an event for unknown model ",a.model),new Error("event model wasn't known");g={},f={};for(u in x)z=x[u],u in this._all_models?g[u]=z:f[u]=z;for(t._initialize_references_json(w,g,f),k=[],p=0,_=l.length;p<_;p++)switch(a=l[p],a.kind){case"ModelChanged":if(y=a.model.id,!(y in this._all_models))throw new Error("Cannot apply patch to "+y+" which is not in the document");v=this._all_models[y],r=a.attr,z=t._resolve_refs(a["new"],g,f),k.push(v.setv((m={},m[""+r]=z,m)));break;case"ColumnsStreamed":if(i=a.column_source.id,!(i in this._all_models))throw new Error("Cannot stream to "+i+" which is not in the document");if(n=this._all_models[i],!(n instanceof o.Model))throw new Error("Cannot stream to non-ColumnDataSource");s=a.data,M=a.rollover,k.push(n.stream(s,M));break;case"ColumnsPatched":if(i=a.column_source.id,!(i in this._all_models))throw new Error("Cannot patch "+i+" which is not in the document");if(n=this._all_models[i],!(n instanceof o.Model))throw new Error("Cannot patch non-ColumnDataSource");b=a.patches,k.push(n.patch(b));break;case"RootAdded":T=a.model.id,S=x[T],k.push(this.add_root(S));break;case"RootRemoved":T=a.model.id,S=x[T],k.push(this.remove_root(S));break;case"TitleChanged":k.push(this.set_title(a.title));break;default:throw new Error("Unknown patch event "+JSON.stringify(a))}return k},t}(),e.exports={Document:s,DocumentChangedEvent:a,ModelChangedEvent:c,TitleChangedEvent:g,RootAddedEvent:_,RootRemovedEvent:d,DEFAULT_TITLE:i}},{"./base":"base","./core/has_props":"core/has_props","./core/layout/solver":"core/layout/solver","./core/logging":"core/logging","./core/util/data_structures":"core/util/data_structures","./core/util/refs":"core/util/refs","./models/sources/column_data_source":"models/sources/column_data_source","./version":"version",jquery:"jquery",underscore:"underscore"}],embed:[function(t,e,r){var n,o,i,s,a,l,u,c,p,h,_,d,f,m,g,y,v,b,x,w,k,M,T,S,z,E,A,C,j,P;n=t("jquery"),c=t("underscore"),s=t("es6-promise").Promise,k=t("./base"),A=t("./client").pull_session,C=t("./core/logging"),E=C.logger,P=C.set_log_level,j=t("./document"),i=j.Document,a=j.RootAddedEvent,l=j.RootRemovedEvent,u=j.TitleChangedEvent,o="bk-root",_=function(t){var e;if(E.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)},g=function(t,e,r){if(t===r.target_name)return r.on_msg(c.bind(_,e))},d=function(t,e){var r,n,o,i,s,a,l;if("undefined"==typeof Jupyter||null===Jupyter||null==Jupyter.notebook.kernel)return console.warn("Jupyter notebooks comms not available. push_notebook() will not function");E.info("Registering Jupyter comms for target "+t),r=Jupyter.notebook.kernel.comm_manager,l=c.partial(g,t,e),a=r.comms;for(i in a)s=a[i],s.then(l);try{return r.register_target(t,function(r,n){return E.info("Registering Jupyter comms for target "+t),r.on_msg(c.bind(_,e))})}catch(o){return n=o,E.warn("Jupyter comms failed to register. push_notebook() will not function. (exception reported: "+n+")")}},p=function(t){var e;return e=new t.default_view({model:t}),k.index[t.id]=e,e},f=function(t,e,r){var o,i,s,c,h,_,d;d={},h=function(e){var r;return r=p(e),d[e.id]=r,n(t).append(r.$el)},_=function(e){var r;if(e.id in d)return r=d[e.id],n(t).remove(r.$el),delete d[e.id],delete k.index[e.id]},c=e.roots();for(o=0,i=c.length;o<i;o++)s=c[o],h(s);return r&&(window.document.title=e.title()),e.on_change(function(t){return t instanceof a?h(t.model):t instanceof l?_(t.model):r&&t instanceof u?window.document.title=t.title:void 0}),d},w=function(t,e,r){var o,i;if(o=r.get_model_by_id(e),null==o)throw new Error("Model "+e+" was not in document "+r);return i=p(o),c.delay(function(){return n(t).replaceWith(i.$el)})},b=function(t,e,r){return c.delay(function(){return f(n(t),e,r)})},v=function(t,e,r){return null==r&&(r=!1),f(n(e),t,r)},m={},h=function(t,e){var r;if(null==t||null===t)throw new Error("Missing websocket_url");return t in m||(m[t]={}),r=m[t],e in r||(r[e]=A(t,e)),r[e]},y=function(t,e,r,n){var o;return o=h(e,r),o.then(function(e){return f(t,e.document,n)},function(t){throw E.error("Failed to load Bokeh session "+r+": "+t),t})},x=function(t,e,r,o){var i;return i=h(e,o),i.then(function(e){var o,i;if(o=e.document.get_model_by_id(r),null==o)throw new Error("Did not find model "+r+" in session");return i=p(o),n(t).replaceWith(i.$el)},function(t){throw E.error("Failed to load Bokeh session "+o+": "+t),t})},S=function(t){var e;return e=n("<link href='"+t+"' rel='stylesheet' type='text/css'>"),n("body").append(e)},z=function(t){var e;return e=n("<style>").html(t),n("body").append(e)},T=function(t,e){var r;return r=t.data(),null!=r.bokehLogLevel&&r.bokehLogLevel.length>0&&P(r.bokehLogLevel),null!=r.bokehDocId&&r.bokehDocId.length>0&&(e.docid=r.bokehDocId),null!=r.bokehModelId&&r.bokehModelId.length>0&&(e.modelid=r.bokehModelId),null!=r.bokehSessionId&&r.bokehSessionId.length>0&&(e.sessionid=r.bokehSessionId),E.info("Will inject Bokeh script tag with params "+JSON.stringify(e))},M=function(t,e,r){var s,a,l,u,c,p,h,_,f,m,g,v;null==r&&(r=null),u={};for(l in t)u[l]=i.from_json(t[l]);for(g=[],h=0,f=e.length;h<f;h++){if(_=e[h],null!=_.notebook_comms_target&&d(_.notebook_comms_target,u[l]),p=_.elementid,c=n("#"+p),0===c.length)throw new Error("Error rendering Bokeh model: could not find tag with id: "+p);if(c.length>1)throw new Error("Error rendering Bokeh model: found too many tags with id: "+p);if(!document.body.contains(c[0]))throw new Error("Error rendering Bokeh model: element with id '"+p+"' must be under <body>");if("SCRIPT"===c.prop("tagName")&&(T(c,_),a=n("<div>",{"class":o}),c.replaceWith(a),s=n("<div>"),a.append(s),c=s),v=null!=_.use_for_title&&_.use_for_title,m=null,null!=_.modelid)if(null!=_.docid)w(c,_.modelid,u[_.docid]);else{if(null==_.sessionid)throw new Error("Error rendering Bokeh model "+_.modelid+" to element "+p+": no document ID or session ID specified");m=x(c,r,_.modelid,_.sessionid)}else if(null!=_.docid)b(c,u[_.docid],v);else{if(null==_.sessionid)throw new Error("Error rendering Bokeh document to element "+p+": no document ID or session ID specified");m=y(c,r,_.sessionid,v)}null!==m?g.push(m.then(function(t){return console.log("Bokeh items were rendered successfully")},function(t){return console.log("Error rendering Bokeh items ",t)})):g.push(void 0)}return g},e.exports={embed_items:M,add_document_static:b,add_document_standalone:v,inject_css:S,inject_raw_css:z,BOKEH_ROOT:o}},{"./base":"base","./client":"client","./core/logging":"core/logging","./document":"document","es6-promise":"es6-promise",jquery:"jquery",underscore:"underscore"}],main:[function(t,e,r){var n,o,i;o=t("underscore"),n={},n.require=t,n.version=t("./version"),n._=t("underscore"),n.$=t("jquery"),i=t("./core/logging"),n.logger=i.logger,n.set_log_level=i.set_log_level,n.index=t("./base").index,n.embed=t("./embed"),n.safely=t("./safely"),n.Models=t("./base").Models,e.exports=n},{"./base":"base","./core/logging":"core/logging","./embed":"embed","./safely":"safely","./version":"version",jquery:"jquery",underscore:"underscore"}],model:[function(t,e,r){var n,o,i,s,a=function(t,e){function r(){this.constructor=t}for(var n in e)l.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},l={}.hasOwnProperty;i=t("underscore"),n=t("./core/has_props"),s=t("./core/properties"),o=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return a(e,t),e.prototype.type="Model",e.define({tags:[s.Array,[]],name:[s.String]}),e.prototype.select=function(t){if(t.prototype instanceof e)return this.references().filter(function(e){return e instanceof t});if(i.isString(t))return this.references().filter(function(e){return e.name===t});throw new Error("invalid selector")},e.prototype.select_one=function(t){var e;switch(e=this.select(t),e.length){case 0:return null;case 1:return e[0];default:throw new Error("found more than one object matching given selector")}},e}(n),e.exports=o},{"./core/has_props":"core/has_props","./core/properties":"core/properties",underscore:"underscore"}],"models/annotations/annotation":[function(t,e,r){var n,o,i,s,a,l,u=function(t,e){function r(){this.constructor=t}for(var n in e)c.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},c={}.hasOwnProperty;a=t("underscore"),s=t("../../core/layout/side_panel"),l=t("../../core/properties"),i=t("../renderers/renderer"),o=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return u(e,t),e.prototype._get_panel_offset=function(){var t,e;return t=this.model.panel._left._value,e=this.model.panel._bottom._value,{x:t,y:-e}},e.prototype._get_size=function(){return-1},e}(i.View),n=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return u(e,t),e.prototype.type="Annotation",e.prototype.default_view=o,e.define({plot:[l.Instance]}),e.override({level:"annotation"}),e.prototype.add_panel=function(t){return this.panel=new s.Model({side:t}),this.panel.attach_document(this.document),this.level="overlay"},e}(i.Model),e.exports={Model:n,View:o}},{"../../core/layout/side_panel":"core/layout/side_panel","../../core/properties":"core/properties","../renderers/renderer":"models/renderers/renderer",underscore:"underscore"}],"models/annotations/arrow":[function(t,e,r){var n,o,i,s,a,l,u,c,p=function(t,e){function r(){this.constructor=t}for(var n in e)h.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},h={}.hasOwnProperty;l=t("underscore"),n=t("./annotation"),a=t("./arrow_head").OpenHead,s=t("../sources/column_data_source"),c=t("../../core/properties"),u=t("../../core/util/math").atan2,i=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return p(e,t),e.prototype.initialize=function(t){return e.__super__.initialize.call(this,t),null==this.model.source&&(this.model.source=new s.Model),this.canvas=this.plot_model.canvas,this.xmapper=this.plot_view.frame.x_mappers[this.model.x_range_name],this.ymapper=this.plot_view.frame.y_mappers[this.model.y_range_name],this.set_data(this.model.source)},e.prototype.bind_bokeh_events=function(){return this.listenTo(this.model,"change",this.plot_view.request_render),this.listenTo(this.model.source,"change",function(){return this.set_data(this.model.source),this.plot_view.request_render()})},e.prototype.set_data=function(t){return e.__super__.set_data.call(this,t),this.visuals.warm_cache(t)},e.prototype._map_data=function(){var t,e,r,n;return e="data"===this.model.start_units?this.plot_view.map_to_screen(this._x_start,this._y_start,r=this.model.x_range_name,n=this.model.y_range_name):[this.canvas.v_vx_to_sx(this._x_start),this.canvas.v_vy_to_sy(this._y_start)],t="data"===this.model.end_units?this.plot_view.map_to_screen(this._x_end,this._y_end,r=this.model.x_range_name,n=this.model.y_range_name):[this.canvas.v_vx_to_sx(this._x_end),this.canvas.v_vy_to_sy(this._y_end)],[e,t]},e.prototype.render=function(){var t;if(t=this._map_data(),this.start=t[0],this.end=t[1],this._draw_arrow_body(),null!=this.model.end&&this._draw_arrow_head(this.model.end,this.start,this.end),null!=this.model.start)return this._draw_arrow_head(this.model.start,this.end,this.start)},e.prototype._draw_arrow_body=function(){var t,e,r,n;for(t=this.plot_view.canvas_view.ctx,t.save(),e=r=0,n=this._x_start.length;0<=n?r<n:r>n;e=0<=n?++r:--r)this.visuals.line.set_vectorize(t,e),t.beginPath(),t.moveTo(this.start[0][e],this.start[1][e]),t.lineTo(this.end[0][e],this.end[1][e]),this.visuals.line.doit&&t.stroke();return t.restore()},e.prototype._draw_arrow_head=function(t,e,r){var n,o,i,s,a,l;for(o=this.plot_view.canvas_view.ctx,l=[],i=s=0,a=this._x_start.length;0<=a?s<a:s>a;i=0<=a?++s:--s)n=Math.PI/2+u([e[0][i],e[1][i]],[r[0][i],r[1][i]]),o.save(),o.translate(r[0][i],r[1][i]),o.rotate(n),t.render(o,i),l.push(o.restore());return l},e}(n.View),o=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return p(e,t),e.prototype.default_view=i,e.prototype.type="Arrow",e.mixins(["line"]),e.define({x_start:[c.NumberSpec],y_start:[c.NumberSpec],start_units:[c.String,"data"],start:[c.Instance,null],x_end:[c.NumberSpec],y_end:[c.NumberSpec],end_units:[c.String,"data"],end:[c.Instance,new a.Model({})],source:[c.Instance],x_range_name:[c.String,"default"],y_range_name:[c.String,"default"]}),e}(n.Model),e.exports={Model:o,View:i}},{"../../core/properties":"core/properties","../../core/util/math":"core/util/math","../sources/column_data_source":"models/sources/column_data_source","./annotation":"models/annotations/annotation","./arrow_head":"models/annotations/arrow_head",underscore:"underscore"}],"models/annotations/arrow_head":[function(t,e,r){var n,o,i,s,a,l,u,c,p=function(t,e){function r(){this.constructor=t}for(var n in e)h.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},h={}.hasOwnProperty;n=t("./annotation"),a=t("../renderers/renderer"),u=t("../../core/visuals").Visuals,c=t("../../core/properties"),o=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return p(e,t),e.prototype.type="ArrowHead",e.prototype.initialize=function(t){return e.__super__.initialize.call(this,t),this.visuals=new u(this)},e.prototype.render=function(t,e){return null},e}(n.Model),s=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return p(e,t),e.prototype.type="OpenHead",e.prototype.render=function(t,e){if(this.visuals.line.doit)return this.visuals.line.set_vectorize(t,e),t.beginPath(),t.moveTo(.5*this.size,this.size),t.lineTo(0,0),t.lineTo(-.5*this.size,this.size),t.stroke()},e.mixins(["line"]),e.define({size:[c.Number,25]}),e}(o),i=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return p(e,t),e.prototype.type="NormalHead",e.prototype.render=function(t,e){if(this.visuals.fill.doit&&(this.visuals.fill.set_vectorize(t,e),t.beginPath(),t.moveTo(.5*this.size,this.size),t.lineTo(0,0),t.lineTo(-.5*this.size,this.size),t.closePath(),t.fill()),this.visuals.line.doit)return this.visuals.line.set_vectorize(t,e),t.beginPath(),t.moveTo(.5*this.size,this.size),t.lineTo(0,0),t.lineTo(-.5*this.size,this.size),t.closePath(),t.stroke()},e.mixins(["line","fill"]),e.define({size:[c.Number,25]}),e.override({fill_color:"black"}),e}(o),l=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return p(e,t),e.prototype.type="VeeHead",e.prototype.render=function(t,e){if(this.visuals.fill.doit&&(this.visuals.fill.set_vectorize(t,e),t.beginPath(),t.moveTo(.5*this.size,this.size),t.lineTo(0,0),t.lineTo(-.5*this.size,this.size),t.lineTo(0,.5*this.size),t.closePath(),t.fill()),this.visuals.line.doit)return this.visuals.line.set_vectorize(t,e),t.beginPath(),t.moveTo(.5*this.size,this.size),t.lineTo(0,0),t.lineTo(-.5*this.size,this.size),t.lineTo(0,.5*this.size),t.closePath(),t.stroke()},e.mixins(["line","fill"]),e.define({size:[c.Number,25]}),e.override({fill_color:"black"}),e}(o),e.exports={OpenHead:{Model:s},NormalHead:{Model:i},VeeHead:{Model:l}}},{"../../core/properties":"core/properties","../../core/visuals":"core/visuals","../renderers/renderer":"models/renderers/renderer","./annotation":"models/annotations/annotation"}],"models/annotations/box_annotation":[function(t,e,r){var n,o,i,s,a,l=function(t,e){function r(){this.constructor=t}for(var n in e)u.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},u={}.hasOwnProperty;s=t("underscore"),n=t("./annotation"),a=t("../../core/properties"),i=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return l(e,t),e.prototype.initialize=function(t){return e.__super__.initialize.call(this,t),this.$el.appendTo(this.plot_view.$el.find("div.bk-canvas-overlays")),this.$el.addClass("bk-shading"),this.$el.hide()},e.prototype.bind_bokeh_events=function(){return"css"===this.model.render_mode?(this.listenTo(this.model,"change",this.render),this.listenTo(this.model,"data_update",this.render)):(this.listenTo(this.model,"change",this.plot_view.request_render),this.listenTo(this.model,"data_update",this.plot_view.request_render))},e.prototype.render=function(){var t,e,r,n;return null==this.model.left&&null==this.model.right&&null==this.model.top&&null==this.model.bottom?(this.$el.hide(),null):(this.frame=this.plot_model.frame,this.canvas=this.plot_model.canvas,this.xmapper=this.plot_view.frame.x_mappers[this.model.x_range_name],this.ymapper=this.plot_view.frame.y_mappers[this.model.y_range_name],e=this.canvas.vx_to_sx(this._calc_dim(this.model.left,this.model.left_units,this.xmapper,this.frame.h_range.start)),r=this.canvas.vx_to_sx(this._calc_dim(this.model.right,this.model.right_units,this.xmapper,this.frame.h_range.end)),t=this.canvas.vy_to_sy(this._calc_dim(this.model.bottom,this.model.bottom_units,this.ymapper,this.frame.v_range.start)),n=this.canvas.vy_to_sy(this._calc_dim(this.model.top,this.model.top_units,this.ymapper,this.frame.v_range.end)),"css"===this.model.render_mode?this._css_box(e,r,t,n):this._canvas_box(e,r,t,n))},e.prototype._css_box=function(t,e,r,n){var o,i,a,l,u,c,p,h;return h=Math.abs(e-t),c=Math.abs(r-n),u=this.model.line_width.value,a=this.model.line_color.value,i=this.model.fill_color.value,o=this.model.fill_alpha.value,p="left:"+t+"px; width:"+h+"px; top:"+n+"px; height:"+c+"px; border-width:"+u+"px; border-color:"+a+"; background-color:"+i+"; opacity:"+o+";",l=this.model.line_dash,s.isArray(l)&&(l=l.length<2?"solid":"dashed"),s.isString(l)&&(p+=" border-style:"+l+";"),this.$el.attr("style",p),this.$el.show()},e.prototype._canvas_box=function(t,e,r,n){var o;return o=this.plot_view.canvas_view.ctx,o.save(),o.beginPath(),o.rect(t,n,e-t,r-n),this.visuals.fill.set_value(o),o.fill(),this.visuals.line.set_value(o),o.stroke(),o.restore()},e.prototype._calc_dim=function(t,e,r,n){var o;return o=null!=t?"data"===e?r.map_to_target(t):t:n},e}(n.View),o=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return l(e,t),e.prototype.default_view=i,e.prototype.type="BoxAnnotation",e.mixins(["line","fill"]),e.define({render_mode:[a.RenderMode,"canvas"],x_range_name:[a.String,"default"],y_range_name:[a.String,"default"],top:[a.Number,null],top_units:[a.SpatialUnits,"data"],bottom:[a.Number,null],bottom_units:[a.SpatialUnits,"data"],left:[a.Number,null],left_units:[a.SpatialUnits,"data"],right:[a.Number,null],right_units:[a.SpatialUnits,"data"]}),e.override({fill_color:"#fff9ba",fill_alpha:.4,line_color:"#cccccc",line_alpha:.3}),e.prototype.update=function(t){var e,r,n,o;return r=t.left,n=t.right,o=t.top,e=t.bottom,this.setv({left:r,right:n,top:o,bottom:e},{silent:!0}),this.trigger("data_update")},e}(n.Model),e.exports={Model:o,View:i}},{"../../core/properties":"core/properties","./annotation":"models/annotations/annotation",underscore:"underscore"}],"models/annotations/color_bar":[function(t,e,r){var n,o,i,s,a,l,u,c,p,h,_,d,f,m,g,y=function(t,e){function r(){this.constructor=t}for(var n in e)v.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},v={}.hasOwnProperty;f=t("underscore"),n=t("./annotation"),i=t("../tickers/basic_ticker"),o=t("../formatters/basic_tick_formatter"),c=t("../mappers/linear_color_mapper"),p=t("../mappers/linear_mapper"),h=t("../mappers/log_mapper"),_=t("../ranges/range1d"),m=t("../../core/properties"),g=t("../../core/util/text"),d=25,u=.3,l=.8,a=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return y(e,t),e.prototype.initialize=function(t){return e.__super__.initialize.call(this,t),this._set_canvas_image()},e.prototype.bind_bokeh_events=function(){return this.listenTo(this.model,"change:visible",this.plot_view.request_render),this.listenTo(this.model.ticker,"change",this.plot_view.request_render),this.listenTo(this.model.formatter,"change",this.plot_view.request_render),this.listenTo(this.model.color_mapper,"change",function(){return this._set_canvas_image(),this.plot_view.request_render()})},e.prototype._get_panel_offset=function(){var t,e;return t=this.model.panel._left._value,e=this.model.panel._top._value,{x:t,y:-e}},e.prototype._get_size=function(){var t,e;return t=this.compute_legend_dimensions(),e=this.model.panel.side,"above"===e||"below"===e?t.height:"left"===e||"right"===e?t.width:void 0},e.prototype._set_canvas_image=function(){var t,e,r,n,o,i,s,a,l,u,p,h,_;switch(a=this.model.color_mapper.palette,"vertical"===this.model.orientation&&(a=a.slice(0).reverse()),this.model.orientation){case"vertical":l=[1,a.length],_=l[0],o=l[1];break;case"horizontal":u=[a.length,1],_=u[0],o=u[1]}return r=document.createElement("canvas"),p=[_,o],r.width=p[0],r.height=p[1],i=r.getContext("2d"),s=i.getImageData(0,0,_,o),n=new c.Model({palette:a}),t=n.v_map_screen(function(){h=[];for(var t=0,e=a.length;0<=e?t<e:t>e;0<=e?t++:t--)h.push(t);return h}.apply(this)),e=new Uint8ClampedArray(t),s.data.set(e),i.putImageData(s,0,0),this.image=r},e.prototype.compute_legend_dimensions=function(){var t,e,r,n,o,i,s,a,l,u;switch(t=this.model._computed_image_dimensions(),a=[t.height,t.width],e=a[0],r=a[1],n=this._get_label_extent(),u=this.model._title_extent(),l=this.model._tick_extent(),s=this.model.padding,this.model.orientation){case"vertical":o=e+u+2*s,i=r+l+n+2*s;break;case"horizontal":o=e+u+l+n+2*s,i=r+2*s}return{height:o,width:i}},e.prototype.compute_legend_location=function(){var t,e,r,n,o,i,s,a,l,u,c,p;if(e=this.compute_legend_dimensions(),s=[e.height,e.width],r=s[0],o=s[1],n=this.model.margin,i=this.model.location,
|
|
t=this.plot_view.frame.h_range,u=this.plot_view.frame.v_range,f.isString(i))switch(i){case"top_left":c=t.start+n,p=u.end-n;break;case"top_center":c=(t.end+t.start)/2-o/2,p=u.end-n;break;case"top_right":c=t.end-n-o,p=u.end-n;break;case"right_center":c=t.end-n-o,p=(u.end+u.start)/2+r/2;break;case"bottom_right":c=t.end-n-o,p=u.start+n+r;break;case"bottom_center":c=(t.end+t.start)/2-o/2,p=u.start+n+r;break;case"bottom_left":c=t.start+n,p=u.start+n+r;break;case"left_center":c=t.start+n,p=(u.end+u.start)/2+r/2;break;case"center":c=(t.end+t.start)/2-o/2,p=(u.end+u.start)/2+r/2}else f.isArray(i)&&2===i.length&&(c=i[0],p=i[1]);return a=this.plot_view.canvas.vx_to_sx(c),l=this.plot_view.canvas.vy_to_sy(p),{sx:a,sy:l}},e.prototype.render=function(){var t,e,r,n,o;if(this.model.visible!==!1)return t=this.plot_view.canvas_view.ctx,t.save(),null!=this.model.panel&&(o=this._get_panel_offset(),t.translate(o.x,o.y),e=this._get_frame_offset(),t.translate(e.x,e.y)),n=this.compute_legend_location(),t.translate(n.sx,n.sy),this._draw_bbox(t),r=this._get_image_offset(),t.translate(r.x,r.y),this._draw_image(t),null!=this.model.color_mapper.low&&null!=this.model.color_mapper.high&&(this._draw_major_ticks(t),this._draw_minor_ticks(t),this._draw_major_labels(t)),this.model.title&&this._draw_title(t),t.restore()},e.prototype._draw_bbox=function(t){var e;return e=this.compute_legend_dimensions(),t.save(),this.visuals.background_fill.doit&&(this.visuals.background_fill.set_value(t),t.fillRect(0,0,e.width,e.height)),this.visuals.border_line.doit&&(this.visuals.border_line.set_value(t),t.strokeRect(0,0,e.width,e.height)),t.restore()},e.prototype._draw_image=function(t){var e;return e=this.model._computed_image_dimensions(),t.save(),t.setImageSmoothingEnabled(!1),t.globalAlpha=this.model.scale_alpha,t.drawImage(this.image,0,0,e.width,e.height),this.visuals.bar_line.doit&&(this.visuals.bar_line.set_value(t),t.strokeRect(0,0,e.width,e.height)),t.restore()},e.prototype._draw_major_ticks=function(t){var e,r,n,o,i,s,a,l,u,c,p,h,_,d,f;if(this.visuals.major_tick_line.doit){for(s=this.model._normals(),o=s[0],i=s[1],r=this.model._computed_image_dimensions(),a=[r.width*o,r.height*i],d=a[0],f=a[1],l=this.model._tick_coordinates().major,c=l[0],p=l[1],h=this.model.major_tick_in,_=this.model.major_tick_out,t.save(),t.translate(d,f),this.visuals.major_tick_line.set_value(t),e=n=0,u=c.length;0<=u?n<u:n>u;e=0<=u?++n:--n)t.beginPath(),t.moveTo(Math.round(c[e]+o*_),Math.round(p[e]+i*_)),t.lineTo(Math.round(c[e]-o*h),Math.round(p[e]-i*h)),t.stroke();return t.restore()}},e.prototype._draw_minor_ticks=function(t){var e,r,n,o,i,s,a,l,u,c,p,h,_,d,f;if(this.visuals.minor_tick_line.doit){for(s=this.model._normals(),o=s[0],i=s[1],r=this.model._computed_image_dimensions(),a=[r.width*o,r.height*i],d=a[0],f=a[1],l=this.model._tick_coordinates().minor,c=l[0],p=l[1],h=this.model.minor_tick_in,_=this.model.minor_tick_out,t.save(),t.translate(d,f),this.visuals.minor_tick_line.set_value(t),e=n=0,u=c.length;0<=u?n<u:n>u;e=0<=u?++n:--n)t.beginPath(),t.moveTo(Math.round(c[e]+o*_),Math.round(p[e]+i*_)),t.lineTo(Math.round(c[e]-o*h),Math.round(p[e]-i*h)),t.stroke();return t.restore()}},e.prototype._draw_major_labels=function(t){var e,r,n,o,i,s,a,l,u,c,p,h,_,d,f,m,g,y,v;if(this.visuals.major_label_text.doit){for(l=this.model._normals(),s=l[0],a=l[1],n=this.model._computed_image_dimensions(),u=[n.width*s,n.height*a],m=u[0],y=u[1],_=this.model.label_standoff+this.model._tick_extent(),c=[_*s,_*a],g=c[0],v=c[1],p=this.model._tick_coordinates().major,d=p[0],f=p[1],i=this.model._tick_coordinates().major_labels,e=this.model.formatter.doFormat(i),this.visuals.major_label_text.set_value(t),t.save(),t.translate(m+g,y+v),r=o=0,h=d.length;0<=h?o<h:o>h;r=0<=h?++o:--o)t.fillText(e[r],Math.round(d[r]+s*this.model.label_standoff),Math.round(f[r]+a*this.model.label_standoff));return t.restore()}},e.prototype._draw_title=function(t){if(this.visuals.title_text.doit)return t.save(),this.visuals.title_text.set_value(t),t.fillText(this.model.title,0,-this.model.title_standoff),t.restore()},e.prototype._get_label_extent=function(){var t,e,r,n;if(null!=this.model.color_mapper.low&&null!=this.model.color_mapper.high){switch(t=this.plot_view.canvas_view.ctx,t.save(),this.visuals.major_label_text.set_value(t),this.model.orientation){case"vertical":e=this.model.formatter.doFormat(this.model._tick_coordinates().major_labels),n=f.max(function(){var n,o,i;for(i=[],n=0,o=e.length;n<o;n++)r=e[n],i.push(t.measureText(r.toString()).width);return i}());break;case"horizontal":n=g.get_text_height(this.visuals.major_label_text.font_value()).height}n+=this.model.label_standoff,t.restore()}else n=0;return n},e.prototype._get_frame_offset=function(){var t,e,r,n,o;switch(r=[0,0],n=r[0],o=r[1],e=this.model.panel,t=this.plot_view.frame,e.side){case"left":case"right":o=Math.abs(e.top-t.top);break;case"above":case"below":n=Math.abs(t.left)}return{x:n,y:o}},e.prototype._get_image_offset=function(){var t,e;return t=this.model.padding,e=this.model.padding+this.model._title_extent(),{x:t,y:e}},e}(n.View),s=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return y(e,t),e.prototype.default_view=a,e.prototype.type="ColorBar",e.mixins(["text:major_label_","text:title_","line:major_tick_","line:minor_tick_","line:border_","line:bar_","fill:background_"]),e.define({location:[m.Any,"top_right"],orientation:[m.Orientation,"vertical"],title:[m.String],title_standoff:[m.Number,2],height:[m.Any,"auto"],width:[m.Any,"auto"],scale_alpha:[m.Number,1],ticker:[m.Instance,function(){return new i.Model}],formatter:[m.Instance,function(){return new o.Model}],color_mapper:[m.Instance],label_standoff:[m.Number,5],margin:[m.Number,30],padding:[m.Number,10],major_tick_in:[m.Number,5],major_tick_out:[m.Number,0],minor_tick_in:[m.Number,0],minor_tick_out:[m.Number,0]}),e.override({background_fill_color:"#ffffff",background_fill_alpha:.95,bar_line_color:null,border_line_color:null,major_label_text_align:"center",major_label_text_baseline:"middle",major_label_text_font_size:"8pt",major_tick_line_color:"#ffffff",minor_tick_line_color:null,title_text_font_size:"10pt",title_text_font_style:"italic"}),e.prototype.initialize=function(t,r){return e.__super__.initialize.call(this,t,r)},e.prototype._normals=function(){var t,e,r,n;return"vertical"===this.orientation?(r=[1,0],t=r[0],e=r[1]):(n=[0,1],t=n[0],e=n[1]),[t,e]},e.prototype._title_extent=function(){var t,e;return t=this.title_text_font+" "+this.title_text_font_size+" "+this.title_text_font_style,e=this.title?g.get_text_height(t).height+this.title_standoff:0},e.prototype._tick_extent=function(){var t;return t=null!=this.color_mapper.low&&null!=this.color_mapper.high?f.max([this.major_tick_out,this.minor_tick_out]):0},e.prototype._computed_image_dimensions=function(){var t,e,r,n,o;switch(t=this.plot.plot_canvas.frame.height,e=this.plot.plot_canvas.frame.width,n=this._title_extent(),this.orientation){case"vertical":"auto"===this.height?null!=this.panel?r=t-2*this.padding-n:(r=f.max([this.color_mapper.palette.length*d,t*u]),r=f.min([r,t*l-2*this.padding-n])):r=this.height,o="auto"===this.width?d:this.width;break;case"horizontal":r="auto"===this.height?d:this.height,"auto"===this.width?null!=this.panel?o=e-2*this.padding:(o=f.max([this.color_mapper.palette.length*d,e*u]),o=f.min([o,e*l-2*this.padding])):o=this.width}return{height:r,width:o}},e.prototype._tick_coordinate_mapper=function(t){var e,r;switch(r={source_range:new _.Model({start:this.color_mapper.low,end:this.color_mapper.high}),target_range:new _.Model({start:0,end:t})},this.color_mapper.type){case"LinearColorMapper":e=new p.Model(r);break;case"LogColorMapper":e=new h.Model(r)}return e},e.prototype._tick_coordinates=function(){var t,e,r,n,o,i,s,a,l,u,c,p,h,_,d,f,m,g,y,v,b;switch(o=this._computed_image_dimensions(),this.orientation){case"vertical":y=o.height;break;case"horizontal":y=o.width}for(p=this._tick_coordinate_mapper(y),d=this._normals(),r=d[0],i=d[1],f=[this.color_mapper.low,this.color_mapper.high],v=f[0],e=f[1],b=this.ticker.get_ticks(v,e,null,this.ticker.desired_num_ticks),c=b.major,_=b.minor,l=[[],[]],h=[[],[]],n=s=0,m=c.length;0<=m?s<m:s>m;n=0<=m?++s:--s)c[n]<v||c[n]>e||(l[r].push(c[n]),l[i].push(0));for(n=a=0,g=_.length;0<=g?a<g:a>g;n=0<=g?++a:--a)_[n]<v||_[n]>e||(h[r].push(_[n]),h[i].push(0));return u=l[r].slice(0),l[r]=p.v_map_to_target(l[r]),h[r]=p.v_map_to_target(h[r]),"vertical"===this.orientation&&(l[r]=new Float64Array(function(){var e,n,o,i;for(o=l[r],i=[],n=0,e=o.length;n<e;n++)t=o[n],i.push(y-t);return i}()),h[r]=new Float64Array(function(){var e,n,o,i;for(o=h[r],i=[],n=0,e=o.length;n<e;n++)t=o[n],i.push(y-t);return i}())),{major:l,minor:h,major_labels:u}},e}(n.Model),e.exports={Model:s,View:a}},{"../../core/properties":"core/properties","../../core/util/text":"core/util/text","../formatters/basic_tick_formatter":"models/formatters/basic_tick_formatter","../mappers/linear_color_mapper":"models/mappers/linear_color_mapper","../mappers/linear_mapper":"models/mappers/linear_mapper","../mappers/log_mapper":"models/mappers/log_mapper","../ranges/range1d":"models/ranges/range1d","../tickers/basic_ticker":"models/tickers/basic_ticker","./annotation":"models/annotations/annotation",underscore:"underscore"}],"models/annotations/label":[function(t,e,r){var n,o,i,s,a=function(t,e){function r(){this.constructor=t}for(var n in e)l.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},l={}.hasOwnProperty;i=t("./text_annotation"),s=t("../../core/properties"),o=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return a(e,t),e.prototype.initialize=function(t){return e.__super__.initialize.call(this,t),this.canvas=this.plot_model.canvas,this.xmapper=this.plot_view.frame.x_mappers[this.model.x_range_name],this.ymapper=this.plot_view.frame.y_mappers[this.model.y_range_name],this.visuals.warm_cache(null)},e.prototype._get_size=function(){var t,e,r,n;return t=this.plot_view.canvas_view.ctx,this.visuals.text.set_value(t),r=this.model.panel.side,"above"===r||"below"===r?e=t.measureText(this.model.text).ascent:"left"===r||"right"===r?n=t.measureText(this.model.text).width:void 0},e.prototype.render=function(){var t,e,r,n,o,i,s;switch(e=this.plot_view.canvas_view.ctx,this.model.angle_units){case"rad":t=-1*this.model.angle;break;case"deg":t=-1*this.model.angle*Math.PI/180}return i="data"===this.model.x_units?this.xmapper.map_to_target(this.model.x):this.model.x,n=this.canvas.vx_to_sx(i),s="data"===this.model.y_units?this.ymapper.map_to_target(this.model.y):this.model.y,o=this.canvas.vy_to_sy(s),null!=this.model.panel&&(r=this._get_panel_offset(),n+=r.x,o+=r.y),"canvas"===this.model.render_mode?this._canvas_text(e,this.model.text,n+this.model.x_offset,o-this.model.y_offset,t):this._css_text(e,this.model.text,n+this.model.x_offset,o-this.model.y_offset,t)},e}(i.View),n=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return a(e,t),e.prototype.default_view=o,e.prototype.type="Label",e.mixins(["text","line:border_","fill:background_"]),e.define({x:[s.Number],x_units:[s.SpatialUnits,"data"],y:[s.Number],y_units:[s.SpatialUnits,"data"],text:[s.String],angle:[s.Angle,0],angle_units:[s.AngleUnits,"rad"],x_offset:[s.Number,0],y_offset:[s.Number,0],x_range_name:[s.String,"default"],y_range_name:[s.String,"default"],render_mode:[s.RenderMode,"canvas"]}),e.override({background_fill_color:null,border_line_color:null}),e}(i.Model),e.exports={Model:n,View:o}},{"../../core/properties":"core/properties","./text_annotation":"models/annotations/text_annotation"}],"models/annotations/label_set":[function(t,e,r){var n,o,i,s,a,l,u,c=function(t,e){function r(){this.constructor=t}for(var n in e)p.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},p={}.hasOwnProperty;l=t("underscore"),n=t("jquery"),a=t("./text_annotation"),o=t("../sources/column_data_source"),u=t("../../core/properties"),s=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return c(e,t),e.prototype.initialize=function(t){var r,o,i,s;if(e.__super__.initialize.call(this,t),this.xmapper=this.plot_view.frame.x_mappers[this.model.x_range_name],this.ymapper=this.plot_view.frame.y_mappers[this.model.y_range_name],this.set_data(this.model.source),"css"===this.model.render_mode){for(s=[],r=o=0,i=this._text.length;0<=i?o<i:o>i;r=0<=i?++o:--o)this.title_div=n("<div>").addClass("bk-annotation-child").hide(),s.push(this.title_div.appendTo(this.$el));return s}},e.prototype.bind_bokeh_events=function(){return"css"===this.model.render_mode?(this.listenTo(this.model,"change",function(){return this.set_data(this.model.source),this.render()}),this.listenTo(this.model.source,"change",function(){return this.set_data(this.model.source),this.render()})):(this.listenTo(this.model,"change",function(){return this.set_data(this.model.source),this.plot_view.request_render()}),this.listenTo(this.model.source,"change",function(){return this.set_data(this.model.source),this.plot_view.request_render()}))},e.prototype.set_data=function(t){return e.__super__.set_data.call(this,t),this.visuals.warm_cache(t)},e.prototype._map_data=function(){var t,e,r,n;return r="data"===this.model.x_units?this.xmapper.v_map_to_target(this._x):this._x.slice(0),t=this.canvas.v_vx_to_sx(r),n="data"===this.model.y_units?this.ymapper.v_map_to_target(this._y):this._y.slice(0),e=this.canvas.v_vy_to_sy(n),[t,e]},e.prototype.render=function(){var t,e,r,n,o,i,s,a,l,u,c;if(t=this.plot_view.canvas_view.ctx,o=this._map_data(),u=o[0],c=o[1],"canvas"===this.model.render_mode){for(a=[],e=r=0,i=this._text.length;0<=i?r<i:r>i;e=0<=i?++r:--r)a.push(this._v_canvas_text(t,e,this._text[e],u[e]+this._x_offset[e],c[e]-this._y_offset[e],this._angle[e]));return a}for(l=[],e=n=0,s=this._text.length;0<=s?n<s:n>s;e=0<=s?++n:--n)l.push(this._v_css_text(t,e,this._text[e],u[e]+this._x_offset[e],c[e]-this._y_offset[e],this._angle[e]));return l},e.prototype._get_size=function(){var t,e,r,n;return t=this.plot_view.canvas_view.ctx,this.visuals.text.set_value(t),r=this.model.panel.side,"above"===r||"below"===r?e=t.measureText(this._text[0]).ascent:"left"===r||"right"===r?n=t.measureText(this._text[0]).width:void 0},e.prototype._v_canvas_text=function(t,e,r,n,o,i){var s;return this.visuals.text.set_vectorize(t,e),s=this._calculate_bounding_box_dimensions(t,r),t.save(),t.beginPath(),t.translate(n,o),t.rotate(i),t.rect(s[0],s[1],s[2],s[3]),this.visuals.background_fill.doit&&(this.visuals.background_fill.set_vectorize(t,e),t.fill()),this.visuals.border_line.doit&&(this.visuals.border_line.set_vectorize(t,e),t.stroke()),this.visuals.text.doit&&(this.visuals.text.set_vectorize(t,e),t.fillText(r,0,0)),t.restore()},e.prototype._v_css_text=function(t,e,r,n,o,i){var s,a,u,c;return this.visuals.text.set_vectorize(t,e),s=this._calculate_bounding_box_dimensions(t,r),u=this.visuals.border_line.line_dash.value(),l.isArray(u)&&(c=u.length<2?"solid":"dashed"),l.isString(u)&&(c=u),this.visuals.border_line.set_vectorize(t,e),this.visuals.background_fill.set_vectorize(t,e),a={position:"absolute",left:n+s[0]+"px",top:o+s[1]+"px",color:""+this.visuals.text.text_color.value(),opacity:""+this.visuals.text.text_alpha.value(),font:""+this.visuals.text.font_value(),"line-height":"normal"},i&&l.extend(a,{transform:"rotate("+i+"rad)"}),this.visuals.background_fill.doit&&l.extend(a,{"background-color":""+this.visuals.background_fill.color_value()}),this.visuals.border_line.doit&&l.extend(a,{"border-style":""+c,"border-width":""+this.visuals.border_line.line_width.value(),"border-color":""+this.visuals.border_line.color_value()}),this.$el.children().eq(e).html(r).css(a).show()},e}(a.View),i=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return c(e,t),e.prototype.default_view=s,e.prototype.type="Label",e.mixins(["text","line:border_","fill:background_"]),e.define({x:[u.NumberSpec],y:[u.NumberSpec],x_units:[u.SpatialUnits,"data"],y_units:[u.SpatialUnits,"data"],text:[u.StringSpec,{field:"text"}],angle:[u.AngleSpec,0],x_offset:[u.NumberSpec,{value:0}],y_offset:[u.NumberSpec,{value:0}],source:[u.Instance,function(){return new o.Model}],x_range_name:[u.String,"default"],y_range_name:[u.String,"default"],render_mode:[u.RenderMode,"canvas"]}),e.override({background_fill_color:null,border_line_color:null}),e}(a.Model),e.exports={Model:i,View:s}},{"../../core/properties":"core/properties","../sources/column_data_source":"models/sources/column_data_source","./text_annotation":"models/annotations/text_annotation",jquery:"jquery",underscore:"underscore"}],"models/annotations/legend":[function(t,e,r){var n,o,i,s,a,l,u,c=function(t,e){function r(){this.constructor=t}for(var n in e)p.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},p={}.hasOwnProperty;a=t("underscore"),n=t("./annotation"),o=t("../renderers/glyph_renderer"),u=t("../../core/properties"),l=t("../../core/util/text").get_text_height,s=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return c(e,t),e.prototype.initialize=function(t){return e.__super__.initialize.call(this,t)},e.prototype.compute_legend_bbox=function(){var t,e,r,n,o,i,s,u,c,p,h,_,d,f,m,g,y,v,b,x,w,k,M;for(h=this.model.get_legend_names(),e=this.model.glyph_height,r=this.model.glyph_width,i=this.model.label_height,u=this.model.label_width,this.max_label_height=a.max([l(this.visuals.label_text.font_value()).height,i,e]),t=this.plot_view.canvas_view.ctx,t.save(),this.visuals.label_text.set_value(t),this.text_widths={},o=0,m=h.length;o<m;o++)v=h[o],this.text_widths[v]=a.max([t.measureText(v).width,u]);if(t.restore(),y=a.max(a.values(this.text_widths)),p=this.model.margin,_=this.model.padding,d=this.model.spacing,s=this.model.label_standoff,"vertical"===this.model.orientation)c=h.length*this.max_label_height+(h.length-1)*d+2*_,f=y+r+s+2*_;else{f=2*_+(h.length-1)*d,b=this.text_widths;for(v in b)w=b[v],f+=a.max([w,u])+r+s;c=this.max_label_height+2*_}if(g=this.model.location,n=this.plot_view.frame.h_range,x=this.plot_view.frame.v_range,a.isString(g))switch(g){case"top_left":k=n.start+p,M=x.end-p;break;case"top_center":k=(n.end+n.start)/2-f/2,M=x.end-p;break;case"top_right":k=n.end-p-f,M=x.end-p;break;case"right_center":k=n.end-p-f,M=(x.end+x.start)/2+c/2;break;case"bottom_right":k=n.end-p-f,M=x.start+p+c;break;case"bottom_center":k=(n.end+n.start)/2-f/2,M=x.start+p+c;break;case"bottom_left":k=n.start+p,M=x.start+p+c;break;case"left_center":k=n.start+p,M=(x.end+x.start)/2+c/2;break;case"center":k=(n.end+n.start)/2-f/2,M=(x.end+x.start)/2+c/2}else a.isArray(g)&&2===g.length&&(k=g[0],M=g[1]);return k=this.plot_view.canvas.vx_to_sx(k),M=this.plot_view.canvas.vy_to_sy(M),{x:k,y:M,width:f,height:c}},e.prototype.render=function(){var t,e;if(0!==this.model.items.length)return e=this.plot_view.canvas_view.ctx,t=this.compute_legend_bbox(),e.save(),this._draw_legend_box(e,t),this._draw_legend_items(e,t),e.restore()},e.prototype._draw_legend_box=function(t,e){var r;if(null!=this.model.panel&&(r=this._get_panel_offset(),t.translate(r.x,r.y)),t.beginPath(),t.rect(e.x,e.y,e.width,e.height),this.visuals.background_fill.set_value(t),t.fill(),this.visuals.border_line.doit)return this.visuals.border_line.set_value(t),t.stroke()},e.prototype._draw_legend_items=function(t,e){var r,n,o,i,s,a,l,u,c,p,h,_,d,f,m,g,y,v,b,x;for(n=this.model.glyph_height,o=this.model.glyph_width,c=this.model.spacing,l=this.model.label_standoff,y=x=this.model.padding,_=this.model.items,d=[],i=0,p=_.length;i<p;i++)s=_[i],u=s.get_labels_list_from_label_prop(),r=s.get_field_from_label_prop(),0!==u.length&&d.push(function(){var i,p,_;for(_=[],i=0,p=u.length;i<p;i++)a=u[i],m=e.x+y,v=e.y+x,g=m+o,b=v+n,"vertical"===this.model.orientation?x+=this.max_label_height+c:y+=this.text_widths[a]+o+l+c,this.visuals.label_text.set_value(t),t.fillText(a,g+l,v+this.max_label_height/2),_.push(function(){var e,n,o,i;for(o=s.renderers,i=[],e=0,n=o.length;e<n;e++)h=o[e],f=this.plot_view.renderer_views[h.id],i.push(f.draw_legend(t,m,g,v,b,r,a));return i}.call(this));return _}.call(this));return d},e.prototype._get_size=function(){var t,e;return t=this.compute_legend_bbox(),e=this.model.panel.side,"above"===e||"below"===e?t.height:"left"===e||"right"===e?t.width:void 0},e.prototype._get_panel_offset=function(){var t,e;return t=this.model.panel._left._value,e=this.model.panel._top._value,{x:t,y:-e}},e}(n.View),i=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return c(e,t),e.prototype.default_view=s,e.prototype.type="Legend",e.prototype.get_legend_names=function(){var t,e,r,n,o,i;for(n=[],i=this.items,t=0,o=i.length;t<o;t++)e=i[t],r=e.get_labels_list_from_label_prop(),n=n.concat(r);return n},e.mixins(["text:label_","line:border_","fill:background_"]),e.define({orientation:[u.Orientation,"vertical"],location:[u.Any,"top_right"],label_standoff:[u.Number,5],glyph_height:[u.Number,20],glyph_width:[u.Number,20],label_height:[u.Number,20],label_width:[u.Number,20],margin:[u.Number,10],padding:[u.Number,10],spacing:[u.Number,3],items:[u.Array,[]]}),e.override({border_line_color:"#e5e5e5",border_line_alpha:.5,border_line_width:1,background_fill_color:"#ffffff",background_fill_alpha:.95,label_text_font_size:"10pt",label_text_baseline:"middle"}),e}(n.Model),e.exports={Model:i,View:s}},{"../../core/properties":"core/properties","../../core/util/text":"core/util/text","../renderers/glyph_renderer":"models/renderers/glyph_renderer","./annotation":"models/annotations/annotation",underscore:"underscore"}],"models/annotations/legend_item":[function(t,e,r){var n,o,i,s,a,l,u=function(t,e){return function(){return t.apply(e,arguments)}},c=function(t,e){function r(){this.constructor=t}for(var n in e)p.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},p={}.hasOwnProperty,h=[].indexOf||function(t){for(var e=0,r=this.length;e<r;e++)if(e in this&&this[e]===t)return e;return-1};s=t("underscore"),i=t("../../model"),l=t("../../core/properties"),a=t("../../core/logging").logger,n=t("../../models/sources/column_data_source"),o=function(t){function e(){return this.get_labels_list_from_label_prop=u(this.get_labels_list_from_label_prop,this),this.get_field_from_label_prop=u(this.get_field_from_label_prop,this),e.__super__.constructor.apply(this,arguments)}return c(e,t),e.prototype.type="LegendItem",e.prototype._check_data_sources_on_renderers=function(){var t,e,r,n,o,i;if(t=this.get_field_from_label_prop(),null!=t){if(this.renderers.length<1)return!1;if(i=this.renderers[0].data_source,null!=i)for(o=this.renderers,e=0,r=o.length;e<r;e++)if(n=o[e],n.data_source!==i)return!1}return!0},e.prototype._check_field_label_on_data_source=function(){var t,e;if(t=this.get_field_from_label_prop(),null!=t){if(this.renderers.length<1)return!1;if(e=this.renderers[0].data_source,null!=e&&h.call(e.columns(),t)<0)return!1}return!0},e.prototype.initialize=function(t,r){var n,o;if(e.__super__.initialize.call(this,t,r),n=this._check_data_sources_on_renderers(),n||a.error("Non matching data sources on legend item renderers"),o=this._check_field_label_on_data_source(),!o)return a.error("Bad column name on label: "+this.label)},e.define({label:[l.StringSpec,null],renderers:[l.Array,[]]}),e.prototype.get_field_from_label_prop=function(){if(null!=this.label&&null!=this.label.field)return this.label.field},e.prototype.get_labels_list_from_label_prop=function(){var t,e,r;if(null!=this.label&&null!=this.label.value)return[this.label.value];if(e=this.get_field_from_label_prop(),null!=e){if(!this.renderers[0]||null==this.renderers[0].data_source)return["No source found"];if(r=this.renderers[0].data_source,r instanceof n.Model)return t=r.get_column(e),null!=t?s.unique(t):["Invalid field"]}return[]},e}(i),e.exports={Model:o}},{"../../core/logging":"core/logging","../../core/properties":"core/properties","../../model":"model","../../models/sources/column_data_source":"models/sources/column_data_source",underscore:"underscore"}],"models/annotations/poly_annotation":[function(t,e,r){var n,o,i,s,a,l=function(t,e){function r(){this.constructor=t}for(var n in e)u.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},u={}.hasOwnProperty;s=t("underscore"),n=t("./annotation"),a=t("../../core/properties"),i=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return l(e,t),e.prototype.bind_bokeh_events=function(){return this.listenTo(this.model,"change",this.plot_view.request_render),this.listenTo(this.model,"data_update",this.plot_view.request_render)},e.prototype.render=function(t){var e,r,n,o,i,s,a,l,u,c;if(u=this.model.xs,c=this.model.ys,u.length!==c.length)return null;if(u.length<3||c.length<3)return null;for(e=this.plot_view.canvas,t=this.plot_view.canvas_view.ctx,r=n=0,o=u.length;0<=o?n<o:n>o;r=0<=o?++n:--n)"screen"===this.model.xs_units&&(a=u[r]),"screen"===this.model.ys_units&&(l=c[r]),i=e.vx_to_sx(a),s=e.vy_to_sy(l),0===r?(t.beginPath(),t.moveTo(i,s)):t.lineTo(i,s);return t.closePath(),this.visuals.line.doit&&(this.visuals.line.set_value(t),t.stroke()),this.visuals.fill.doit?(this.visuals.fill.set_value(t),t.fill()):void 0},e}(n.View),o=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return l(e,t),e.prototype.default_view=i,e.prototype.type="PolyAnnotation",e.mixins(["line","fill"]),e.define({xs:[a.Array,[]],xs_units:[a.SpatialUnits,"data"],ys:[a.Array,[]],ys_units:[a.SpatialUnits,"data"],x_range_name:[a.String,"default"],y_range_name:[a.String,"default"]}),e.override({fill_color:"#fff9ba",fill_alpha:.4,line_color:"#cccccc",line_alpha:.3}),e.prototype.update=function(t){var e,r;return e=t.xs,r=t.ys,this.setv({xs:e,ys:r},{silent:!0}),this.trigger("data_update")},e}(n.Model),e.exports={Model:o,View:i}},{"../../core/properties":"core/properties","./annotation":"models/annotations/annotation",underscore:"underscore"}],"models/annotations/span":[function(t,e,r){var n,o,i,s,a,l=function(t,e){function r(){this.constructor=t}for(var n in e)u.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},u={}.hasOwnProperty;s=t("underscore"),n=t("./annotation"),a=t("../../core/properties"),i=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return l(e,t),e.prototype.initialize=function(t){return e.__super__.initialize.call(this,t),this.$el.appendTo(this.plot_view.$el.find("div.bk-canvas-overlays")),this.$el.css({position:"absolute"}),this.$el.hide()},e.prototype.bind_bokeh_events=function(){return this.model.for_hover?this.listenTo(this.model,"change:computed_location",this._draw_span):"canvas"===this.model.render_mode?this.listenTo(this.model,"change:location",this.plot_view.request_render):this.listenTo(this.model,"change:location",this._draw_span)},e.prototype.render=function(){return this._draw_span()},e.prototype._draw_span=function(){var t,e,r,n,o,i,s,a,l,u;return o=this.model.for_hover?this.model.computed_location:this.model.location,null==o?void this.$el.hide():(r=this.plot_model.frame,t=this.plot_model.canvas,l=this.plot_view.frame.x_mappers[this.model.x_range_name],u=this.plot_view.frame.y_mappers[this.model.y_range_name],"width"===this.model.dimension?(s=t.vy_to_sy(this._calc_dim(o,u)),i=t.vx_to_sx(r.left),a=r.width,n=this.model.properties.line_width.value()):(s=t.vy_to_sy(r.top),i=t.vx_to_sx(this._calc_dim(o,l)),a=this.model.properties.line_width.value(),n=r.height),"css"===this.model.render_mode?(this.$el.css({top:s,left:i,width:a+"px",height:n+"px","z-index":1e3,"background-color":this.model.properties.line_color.value(),opacity:this.model.properties.line_alpha.value()}),this.$el.show()):"canvas"===this.model.render_mode?(e=this.plot_view.canvas_view.ctx,e.save(),e.beginPath(),this.visuals.line.set_value(e),e.moveTo(i,s),"width"===this.model.dimension?e.lineTo(i+a,s):e.lineTo(i,s+n),e.stroke(),e.restore()):void 0)},e.prototype._calc_dim=function(t,e){var r;return r="data"===this.model.location_units?e.map_to_target(t):t},e}(n.View),o=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return l(e,t),e.prototype.default_view=i,e.prototype.type="Span",e.mixins(["line"]),e.define({render_mode:[a.RenderMode,"canvas"],x_range_name:[a.String,"default"],y_range_name:[a.String,"default"],location:[a.Number,null],location_units:[a.SpatialUnits,"data"],dimension:[a.Dimension,"width"]}),e.override({line_color:"black"}),e.internal({for_hover:[a.Boolean,!1],computed_location:[a.Number,null]}),e}(n.Model),e.exports={Model:o,View:i}},{"../../core/properties":"core/properties","./annotation":"models/annotations/annotation",underscore:"underscore"}],"models/annotations/text_annotation":[function(t,e,r){var n,o,i,s,a,l,u=function(t,e){function r(){this.constructor=t}for(var n in e)c.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},c={}.hasOwnProperty;s=t("underscore"),n=t("./annotation"),l=t("../../core/properties"),a=t("../../core/util/text").get_text_height,i=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return u(e,t),e.prototype.initialize=function(t){if(e.__super__.initialize.call(this,t),this.canvas=this.plot_model.canvas,this.frame=this.plot_model.frame,"css"===this.model.render_mode)return this.$el.addClass("bk-annotation"),this.$el.appendTo(this.plot_view.$el.find("div.bk-canvas-overlays"))},e.prototype.bind_bokeh_events=function(){return"css"===this.model.render_mode?this.listenTo(this.model,"change",this.render):this.listenTo(this.model,"change",this.plot_view.request_render)},e.prototype._calculate_text_dimensions=function(t,e){var r,n;return n=t.measureText(e).width,r=a(this.visuals.text.font_value()).height,[n,r]},e.prototype._calculate_bounding_box_dimensions=function(t,e){var r,n,o,i,s;switch(n=this._calculate_text_dimensions(t,e),o=n[0],r=n[1],t.textAlign){case"left":i=0;break;case"center":i=-o/2;break;case"right":i=-o}switch(t.textBaseline){case"top":s=0;break;case"middle":s=-.5*r;break;case"bottom":s=-1*r;break;case"alphabetic":s=-.8*r;break;case"hanging":s=-.17*r;break;case"ideographic":s=-.83*r}return[i,s,o,r]},e.prototype._get_size=function(){var t;return t=this.plot_view.canvas_view.ctx,this.visuals.text.set_value(t),t.measureText(this.model.text).ascent},e.prototype.render=function(){return null},e.prototype._canvas_text=function(t,e,r,n,o){var i;return this.visuals.text.set_value(t),i=this._calculate_bounding_box_dimensions(t,e),t.save(),t.beginPath(),t.translate(r,n),o&&t.rotate(o),t.rect(i[0],i[1],i[2],i[3]),this.visuals.background_fill.doit&&(this.visuals.background_fill.set_value(t),t.fill()),this.visuals.border_line.doit&&(this.visuals.border_line.set_value(t),t.stroke()),this.visuals.text.doit&&(this.visuals.text.set_value(t),t.fillText(e,0,0)),t.restore()},e.prototype._css_text=function(t,e,r,n,o){var i,a,l,u;return this.$el.hide(),this.visuals.text.set_value(t),i=this._calculate_bounding_box_dimensions(t,e),l=this.visuals.border_line.line_dash.value(),s.isArray(l)&&(u=l.length<2?"solid":"dashed"),s.isString(l)&&(u=l),this.visuals.border_line.set_value(t),this.visuals.background_fill.set_value(t),a={position:"absolute",left:r+i[0]+"px",top:n+i[1]+"px",color:""+this.visuals.text.text_color.value(),opacity:""+this.visuals.text.text_alpha.value(),font:""+this.visuals.text.font_value(),"line-height":"normal"},o&&s.extend(a,{transform:"rotate("+o+"rad)"}),this.visuals.background_fill.doit&&s.extend(a,{"background-color":""+this.visuals.background_fill.color_value()}),this.visuals.border_line.doit&&s.extend(a,{"border-style":""+u,"border-width":""+this.visuals.border_line.line_width.value(),"border-color":""+this.visuals.border_line.color_value()}),this.$el.html(e).css(a).show()},e}(n.View),o=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return u(e,t),
|
|
e.prototype.type="TextAnnotation",e.prototype.default_view=i,e}(n.Model),e.exports={Model:o,View:i}},{"../../core/properties":"core/properties","../../core/util/text":"core/util/text","./annotation":"models/annotations/annotation",underscore:"underscore"}],"models/annotations/title":[function(t,e,r){var n,o,i,s,a,l=function(t,e){function r(){this.constructor=t}for(var n in e)u.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},u={}.hasOwnProperty;n=t("./text_annotation"),a=t("../../core/properties"),s=t("../../core/visuals"),i=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return l(e,t),e.prototype.initialize=function(t){var r;return e.__super__.initialize.call(this,t),this.visuals.text=new s.Text(this.model),r=this.plot_view.canvas_view.ctx,r.save(),this.model.panel.apply_label_text_heuristics(r,"justified"),this.model.text_baseline=r.textBaseline,this.model.text_align=this.model.align,r.restore()},e.prototype._get_computed_location=function(){var t,e,r,n,o,i,s;switch(e=this._calculate_text_dimensions(this.plot_view.canvas_view.ctx,this.text),s=e[0],t=e[1],this.model.panel.side){case"left":o=0,i=this._get_text_location(this.model.align,this.frame.v_range)+this.model.offset;break;case"right":o=this.canvas.right-1,i=this.canvas.height-this._get_text_location(this.model.align,this.frame.v_range)-this.model.offset;break;case"above":o=this._get_text_location(this.model.align,this.frame.h_range)+this.model.offset,i=this.canvas.top-10;break;case"below":o=this._get_text_location(this.model.align,this.frame.h_range)+this.model.offset,i=0}return r=this.canvas.vx_to_sx(o),n=this.canvas.vy_to_sy(i),[r,n]},e.prototype._get_text_location=function(t,e){var r;switch(t){case"left":r=e.start;break;case"center":r=(e.end+e.start)/2;break;case"right":r=e.end}return r},e.prototype.render=function(){var t,e,r,n,o;if(t=this.model.panel.get_label_angle_heuristic("parallel"),r=this._get_computed_location(),n=r[0],o=r[1],e=this.plot_view.canvas_view.ctx,""!==this.model.text&&null!==this.model.text)return"canvas"===this.model.render_mode?this._canvas_text(e,this.model.text,n,o,t):this._css_text(e,this.model.text,n,o,t)},e.prototype._get_size=function(){var t,e;return e=this.model.text,""===e||null===e?0:(t=this.plot_view.canvas_view.ctx,this.visuals.text.set_value(t),t.measureText(e).ascent+10)},e}(n.View),o=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return l(e,t),e.prototype.default_view=i,e.prototype.type="Title",e.mixins(["line:border_","fill:background_"]),e.define({text:[a.String],text_font:[a.Font,"helvetica"],text_font_size:[a.FontSizeSpec,"10pt"],text_font_style:[a.FontStyle,"bold"],text_color:[a.ColorSpec,"#444444"],text_alpha:[a.NumberSpec,1],align:[a.TextAlign,"left"],offset:[a.Number,0],render_mode:[a.RenderMode,"canvas"]}),e.override({background_fill_color:null,border_line_color:null}),e.internal({text_align:[a.TextAlign,"left"],text_baseline:[a.TextBaseline,"bottom"]}),e}(n.Model),e.exports={Model:o,View:i}},{"../../core/properties":"core/properties","../../core/visuals":"core/visuals","./text_annotation":"models/annotations/text_annotation"}],"models/annotations/tooltip":[function(t,e,r){var n,o,i,s,a,l,u,c=function(t,e){function r(){this.constructor=t}for(var n in e)p.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},p={}.hasOwnProperty;n=t("jquery"),a=t("underscore"),o=t("./annotation"),l=t("../../core/logging").logger,u=t("../../core/properties"),s=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return c(e,t),e.prototype.className="bk-tooltip",e.prototype.initialize=function(t){return e.__super__.initialize.call(this,t),this.$el.appendTo(this.plot_view.$el.find("div.bk-canvas-overlays")),this.$el.css({"z-index":1010}),this.$el.hide()},e.prototype.bind_bokeh_events=function(){return this.listenTo(this.model,"change:data",this._draw_tips)},e.prototype.render=function(){return this._draw_tips()},e.prototype._draw_tips=function(){var t,e,r,o,i,s,l,u,c,p,h,_,d,f,m,g,y,v;if(i=this.model.data,this.$el.empty(),this.$el.hide(),this.$el.toggleClass("bk-tooltip-custom",this.model.custom),!a.isEmpty(i)){for(l=0,c=i.length;l<c;l++)m=i[l],g=m[0],y=m[1],o=m[2],this.model.inner_only&&!this.plot_view.frame.contains(g,y)||(d=n("<div />").appendTo(this.$el),d.append(o));switch(h=this.plot_view.model.canvas.vx_to_sx(g),_=this.plot_view.model.canvas.vy_to_sy(y),e=this.model.attachment){case"horizontal":v=this.plot_view.frame.width,u=this.plot_view.frame.left,p=g-u<v/2?"right":"left";break;case"vertical":s=this.plot_view.frame.height,r=this.plot_view.frame.bottom,p=y-r<s/2?"below":"above";break;default:p=e}switch(this.$el.removeClass("bk-right bk-left bk-above bk-below"),t=10,p){case"right":this.$el.addClass("bk-left"),u=h+(this.$el.outerWidth()-this.$el.innerWidth())+t,f=_-this.$el.outerHeight()/2;break;case"left":this.$el.addClass("bk-right"),u=h-this.$el.outerWidth()-t,f=_-this.$el.outerHeight()/2;break;case"above":this.$el.addClass("bk-above"),f=_+(this.$el.outerHeight()-this.$el.innerHeight())+t,u=Math.round(h-this.$el.outerWidth()/2);break;case"below":this.$el.addClass("bk-below"),f=_-this.$el.outerHeight()-t,u=Math.round(h-this.$el.outerWidth()/2)}return this.model.show_arrow&&this.$el.addClass("bk-tooltip-arrow"),this.$el.children().length>0?(this.$el.css({top:f,left:u}),this.$el.show()):void 0}},e}(o.View),i=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return c(e,t),e.prototype.default_view=s,e.prototype.type="Tooltip",e.define({attachment:[u.String,"horizontal"],inner_only:[u.Bool,!0],show_arrow:[u.Bool,!0]}),e.override({level:"overlay"}),e.internal({data:[u.Any,[]],custom:[u.Any]}),e.prototype.clear=function(){return this.data=[]},e.prototype.add=function(t,e,r){var n;return n=this.data,n.push([t,e,r]),this.data=n,this.trigger("change:data")},e}(o.Model),e.exports={Model:i,View:s}},{"../../core/logging":"core/logging","../../core/properties":"core/properties","./annotation":"models/annotations/annotation",jquery:"jquery",underscore:"underscore"}],"models/axes/axis":[function(t,e,r){var n,o,i,s,a,l,u,c,p,h=function(t,e){function r(){this.constructor=t}for(var n in e)_.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},_={}.hasOwnProperty;u=t("underscore"),l=t("../../core/layout/side_panel"),s=t("../renderers/guide_renderer"),a=t("../renderers/renderer"),i=t("../../core/layout/solver").GE,c=t("../../core/logging").logger,p=t("../../core/properties"),o=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return h(e,t),e.prototype.initialize=function(t){return e.__super__.initialize.call(this,t),this._x_range_name=this.model.x_range_name,this._y_range_name=this.model.y_range_name},e.prototype.render=function(){var t;if(this.model.visible!==!1)return t=this.plot_view.canvas_view.ctx,t.save(),this._draw_rule(t),this._draw_major_ticks(t),this._draw_minor_ticks(t),this._draw_major_labels(t),this._draw_axis_label(t),t.restore()},e.prototype.bind_bokeh_events=function(){return this.listenTo(this.model,"change",this.plot_view.request_render)},e.prototype._get_size=function(){return this._tick_extent()+this._tick_label_extent()+this._axis_label_extent()},e.prototype._draw_rule=function(t){var e,r,n,o,i,s,a,l,u,c,p,h,_,d,f,m;if(this.visuals.axis_line.doit){for(s=e=this.model.rule_coords,_=s[0],f=s[1],a=this.plot_view.map_to_screen(_,f,this._x_range_name,this._y_range_name),p=a[0],h=a[1],l=this.model.normals,o=l[0],i=l[1],u=this.model.offsets,d=u[0],m=u[1],this.visuals.axis_line.set_value(t),t.beginPath(),t.moveTo(Math.round(p[0]+o*d),Math.round(h[0]+i*m)),r=n=1,c=p.length;1<=c?n<c:n>c;r=1<=c?++n:--n)t.lineTo(Math.round(p[r]+o*d),Math.round(h[r]+i*m));return t.stroke()}},e.prototype._draw_major_ticks=function(t){var e,r,n,o,i,s,a,l,u,c,p,h,_,d,f,m,g,y,v;if(this.visuals.major_tick_line.doit){for(e=this.model.tick_coords,s=e.major,m=s[0],y=s[1],a=this.plot_view.map_to_screen(m,y,this._x_range_name,this._y_range_name),h=a[0],_=a[1],l=this.model.normals,o=l[0],i=l[1],u=this.model.offsets,g=u[0],v=u[1],d=this.model.major_tick_in,f=this.model.major_tick_out,this.visuals.major_tick_line.set_value(t),p=[],r=n=0,c=h.length;0<=c?n<c:n>c;r=0<=c?++n:--n)t.beginPath(),t.moveTo(Math.round(h[r]+o*f+o*g),Math.round(_[r]+i*f+i*v)),t.lineTo(Math.round(h[r]-o*d+o*g),Math.round(_[r]-i*d+i*v)),p.push(t.stroke());return p}},e.prototype._draw_minor_ticks=function(t){var e,r,n,o,i,s,a,l,u,c,p,h,_,d,f,m,g,y,v;if(this.visuals.minor_tick_line.doit){for(e=this.model.tick_coords,s=e.minor,m=s[0],y=s[1],a=this.plot_view.map_to_screen(m,y,this._x_range_name,this._y_range_name),h=a[0],_=a[1],l=this.model.normals,o=l[0],i=l[1],u=this.model.offsets,g=u[0],v=u[1],d=this.model.minor_tick_in,f=this.model.minor_tick_out,this.visuals.minor_tick_line.set_value(t),p=[],r=n=0,c=h.length;0<=c?n<c:n>c;r=0<=c?++n:--n)t.beginPath(),t.moveTo(Math.round(h[r]+o*f+o*g),Math.round(_[r]+i*f+i*v)),t.lineTo(Math.round(h[r]-o*d+o*g),Math.round(_[r]-i*d+i*v)),p.push(t.stroke());return p}},e.prototype._draw_major_labels=function(t){var e,r,n,o,i,s,a,l,c,p,h,_,d,f,m,g,y,v,b,x,w,k,M;for(r=this.model.tick_coords,p=r.major,x=p[0],k=p[1],h=this.plot_view.map_to_screen(x,k,this._x_range_name,this._y_range_name),v=h[0],b=h[1],_=this.model.normals,a=_[0],l=_[1],d=this.model.offsets,w=d[0],M=d[1],n=this.model.dimension,g=this.model.panel_side,c=this.model.major_label_orientation,e=u.isString(c)?this.model.panel.get_label_angle_heuristic(c):-c,y=this._tick_extent()+this.model.major_label_standoff,s=this.model.formatter.doFormat(r.major[n]),this.visuals.major_label_text.set_value(t),this.model.panel.apply_label_text_heuristics(t,c),m=[],o=i=0,f=v.length;0<=f?i<f:i>f;o=0<=f?++i:--i)e?(t.translate(v[o]+a*y+a*w,b[o]+l*y+l*M),t.rotate(e),t.fillText(s[o],0,0),t.rotate(-e),m.push(t.translate(-v[o]-a*y+a*w,-b[o]-l*y+l*M))):m.push(t.fillText(s[o],Math.round(v[o]+a*y+a*w),Math.round(b[o]+l*y+l*M)));return m},e.prototype._draw_axis_label=function(t){var e,r,n,o,i,s,a,l,u,c,p,h,_,d,f,m,g;if(r=this.model.axis_label,null!=r&&(s=this.model.rule_coords,d=s[0],m=s[1],a=this.plot_view.map_to_screen(d,m,this._x_range_name,this._y_range_name),h=a[0],_=a[1],l=this.model.normals,n=l[0],o=l[1],u=this.model.offsets,f=u[0],g=u[1],c=this.model.panel_side,i="parallel",e=this.model.panel.get_label_angle_heuristic(i),p=this._tick_extent()+this._tick_label_extent()+this.model.axis_label_standoff,h=(h[0]+h[h.length-1])/2,_=(_[0]+_[_.length-1])/2,this.visuals.axis_label_text.set_value(t),this.model.panel.apply_label_text_heuristics(t,i),d=h+n*p+n*f,m=_+o*p+o*g,!isNaN(d)&&!isNaN(m)))return e?(t.translate(d,m),t.rotate(e),t.fillText(r,0,0),t.rotate(-e),t.translate(-d,-m)):t.fillText(r,d,m)},e.prototype._tick_extent=function(){return this.model.major_tick_out},e.prototype._tick_label_extent=function(){var t,e,r,n,o,i,s,a,l,c,p,h,_,d,f,m,g,y,v;for(i=0,n=this.plot_view.canvas_view.ctx,o=this.model.dimension,r=this.model.tick_coords.major,m=this.model.panel_side,_=this.model.major_label_orientation,h=this.model.formatter.doFormat(r[o]),this.visuals.major_label_text.set_value(n),u.isString(_)?(l=1,t=this.model.panel.get_label_angle_heuristic(_)):(l=2,t=-_),t=Math.abs(t),e=Math.cos(t),f=Math.sin(t),"above"===m||"below"===m?(v=f,a=e):(v=e,a=f),c=p=0,d=h.length;0<=d?p<d:p>d;c=0<=d?++p:--p)null!=h[c]&&(y=1.1*n.measureText(h[c]).width,s=.9*n.measureText(h[c]).ascent,g=y*v+s/l*a,g>i&&(i=g));return i>0&&(i+=this.model.major_label_standoff),i},e.prototype._axis_label_extent=function(){var t,e,r,n,o,i,s,a,l,u;return o=0,l=this.model.panel_side,e=this.model.axis_label,s="parallel",n=this.plot_view.canvas_view.ctx,this.visuals.axis_label_text.set_value(n),t=Math.abs(this.model.panel.get_label_angle_heuristic(s)),r=Math.cos(t),a=Math.sin(t),e&&(o+=this.model.axis_label_standoff,this.visuals.axis_label_text.set_value(n),u=1.1*n.measureText(e).width,i=.9*n.measureText(e).ascent,o+="above"===l||"below"===l?u*a+i*r:u*r+i*a),o},e}(a.View),n=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return h(e,t),e.prototype.default_view=o,e.prototype.type="Axis",e.mixins(["line:axis_","line:major_tick_","line:minor_tick_","text:major_label_","text:axis_label_"]),e.define({bounds:[p.Any,"auto"],ticker:[p.Instance,null],formatter:[p.Instance,null],x_range_name:[p.String,"default"],y_range_name:[p.String,"default"],axis_label:[p.String,""],axis_label_standoff:[p.Int,5],major_label_standoff:[p.Int,5],major_label_orientation:[p.Any,"horizontal"],major_tick_in:[p.Number,2],major_tick_out:[p.Number,6],minor_tick_in:[p.Number,0],minor_tick_out:[p.Number,4]}),e.override({axis_line_color:"black",major_tick_line_color:"black",minor_tick_line_color:"black",major_label_text_font_size:"8pt",major_label_text_align:"center",major_label_text_baseline:"alphabetic",axis_label_text_font_size:"10pt",axis_label_text_font_style:"italic"}),e.internal({panel_side:[p.Any]}),e.prototype.initialize=function(t,r){return e.__super__.initialize.call(this,t,r),this.define_computed_property("computed_bounds",this._computed_bounds,!1),this.add_dependencies("computed_bounds",this,["bounds"]),this.add_dependencies("computed_bounds",this.plot,["x_range","y_range"])},e.getters({computed_bounds:function(){return this._get_computed("computed_bounds")},rule_coords:function(){return this._rule_coords()},tick_coords:function(){return this._tick_coords()},ranges:function(){return this._ranges()},normals:function(){return this.panel._normals},dimension:function(){return this.panel._dim},offsets:function(){return this._offsets()}}),e.prototype.add_panel=function(t){return this.panel=new l.Model({side:t}),this.panel.attach_document(this.document),this.panel_side=t},e.prototype._offsets=function(){var t,e,r,n,o;switch(r=this.panel_side,e=[0,0],n=e[0],o=e[1],t=this.plot.plot_canvas.frame,r){case"below":o=Math.abs(this.panel.top-t.bottom);break;case"above":o=Math.abs(this.panel.bottom-t.top);break;case"right":n=Math.abs(this.panel.left-t.right);break;case"left":n=Math.abs(this.panel.right-t.left)}return[n,o]},e.prototype._ranges=function(){var t,e,r,n;return e=this.dimension,r=(e+1)%2,t=this.plot.plot_canvas.frame,n=[t.x_ranges[this.x_range_name],t.y_ranges[this.y_range_name]],[n[e],n[r]]},e.prototype._computed_bounds=function(){var t,e,r,n,o,i,s,a;return o=this.ranges,r=o[0],t=o[1],a=null!=(i=this.bounds)?i:"auto",n=[r.min,r.max],"auto"===a?n:u.isArray(a)?(Math.abs(a[0]-a[1])>Math.abs(n[0]-n[1])?(s=Math.max(Math.min(a[0],a[1]),n[0]),e=Math.min(Math.max(a[0],a[1]),n[1])):(s=Math.min(a[0],a[1]),e=Math.max(a[0],a[1])),[s,e]):(c.error("user bounds '"+a+"' not understood"),null)},e.prototype._rule_coords=function(){var t,e,r,n,o,i,s,a,l,u,c,p;return n=this.dimension,o=(n+1)%2,a=this.ranges,s=a[0],e=a[1],l=this.computed_bounds,u=l[0],r=l[1],c=new Array(2),p=new Array(2),t=[c,p],i=this._get_loc(e),t[n][0]=Math.max(u,s.min),t[n][1]=Math.min(r,s.max),t[n][0]>t[n][1]&&(t[n][0]=t[n][1]=NaN),t[o][0]=i,t[o][1]=i,t},e.prototype._tick_coords=function(){var t,e,r,n,o,i,s,a,l,u,c,p,h,_,d,f,m,g,y,v,b,x,w,k,M,T,S,z;if(n=this.dimension,i=(n+1)%2,y=this.ranges,f=y[0],e=y[1],v=this.computed_bounds,M=v[0],r=v[1],T=this.ticker.get_ticks(M,r,f,{}),c=T.major,d=T.minor,l=this._get_loc(e),S=[],z=[],t=[S,z],h=[],_=[],p=[h,_],"FactorRange"===f.type)for(o=s=0,b=c.length;0<=b?s<b:s>b;o=0<=b?++s:--s)t[n].push(c[o]),t[i].push(l);else{for(x=[f.min,f.max],g=x[0],m=x[1],o=a=0,w=c.length;0<=w?a<w:a>w;o=0<=w?++a:--a)c[o]<g||c[o]>m||(t[n].push(c[o]),t[i].push(l));for(o=u=0,k=d.length;0<=k?u<k:u>k;o=0<=k?++u:--u)d[o]<g||d[o]>m||(p[n].push(d[o]),p[i].push(l))}return{major:t,minor:p}},e.prototype._get_loc=function(t){var e,r,n;switch(r=t.start,e=t.end,n=this.panel_side){case"left":case"below":return t.start;case"right":case"above":return t.end}},e}(s.Model),e.exports={Model:n,View:o}},{"../../core/layout/side_panel":"core/layout/side_panel","../../core/layout/solver":"core/layout/solver","../../core/logging":"core/logging","../../core/properties":"core/properties","../renderers/guide_renderer":"models/renderers/guide_renderer","../renderers/renderer":"models/renderers/renderer",underscore:"underscore"}],"models/axes/categorical_axis":[function(t,e,r){var n,o,i,s,a,l,u,c=function(t,e){function r(){this.constructor=t}for(var n in e)p.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},p={}.hasOwnProperty;l=t("underscore"),n=t("./axis"),s=t("../formatters/categorical_tick_formatter"),a=t("../tickers/categorical_ticker"),u=t("../../core/logging").logger,i=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return c(e,t),e}(n.View),o=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return c(e,t),e.prototype.default_view=i,e.prototype.type="CategoricalAxis",e.override({ticker:function(){return new a.Model},formatter:function(){return new s.Model}}),e.prototype._computed_bounds=function(){var t,e,r,n,o,i;return n=this.ranges,e=n[0],t=n[1],i=null!=(o=this.bounds)?o:"auto",r=[e.min,e.max],"auto"!==i&&u.warn("Categorical Axes only support user_bounds='auto', ignoring"),r},e}(n.Model),e.exports={Model:o,View:i}},{"../../core/logging":"core/logging","../formatters/categorical_tick_formatter":"models/formatters/categorical_tick_formatter","../tickers/categorical_ticker":"models/tickers/categorical_ticker","./axis":"models/axes/axis",underscore:"underscore"}],"models/axes/continuous_axis":[function(t,e,r){var n,o,i=function(t,e){function r(){this.constructor=t}for(var n in e)s.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},s={}.hasOwnProperty;n=t("./axis"),o=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return i(e,t),e.prototype.type="ContinuousAxis",e}(n.Model),e.exports={Model:o}},{"./axis":"models/axes/axis"}],"models/axes/datetime_axis":[function(t,e,r){var n,o,i,s,a,l,u=function(t,e){function r(){this.constructor=t}for(var n in e)c.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},c={}.hasOwnProperty;l=t("underscore"),a=t("./axis"),i=t("../formatters/datetime_tick_formatter"),s=t("../tickers/datetime_ticker"),o=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return u(e,t),e}(a.View),n=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return u(e,t),e.prototype.default_view=o,e.prototype.type="DatetimeAxis",e.override({ticker:function(){return new s.Model},formatter:function(){return new i.Model}}),e}(a.Model),e.exports={Model:n,View:o}},{"../formatters/datetime_tick_formatter":"models/formatters/datetime_tick_formatter","../tickers/datetime_ticker":"models/tickers/datetime_ticker","./axis":"models/axes/axis",underscore:"underscore"}],"models/axes/linear_axis":[function(t,e,r){var n,o,i,s,a,l,u,c=function(t,e){function r(){this.constructor=t}for(var n in e)p.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},p={}.hasOwnProperty;u=t("underscore"),n=t("./axis"),s=t("./continuous_axis"),o=t("../formatters/basic_tick_formatter"),i=t("../tickers/basic_ticker"),l=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return c(e,t),e}(n.View),a=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return c(e,t),e.prototype.default_view=l,e.prototype.type="LinearAxis",e.override({ticker:function(){return new i.Model},formatter:function(){return new o.Model}}),e}(s.Model),e.exports={Model:a,View:l}},{"../formatters/basic_tick_formatter":"models/formatters/basic_tick_formatter","../tickers/basic_ticker":"models/tickers/basic_ticker","./axis":"models/axes/axis","./continuous_axis":"models/axes/continuous_axis",underscore:"underscore"}],"models/axes/log_axis":[function(t,e,r){var n,o,i,s,a,l,u,c=function(t,e){function r(){this.constructor=t}for(var n in e)p.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},p={}.hasOwnProperty;u=t("underscore"),n=t("./axis"),o=t("./continuous_axis"),a=t("../formatters/log_tick_formatter"),l=t("../tickers/log_ticker"),s=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return c(e,t),e}(n.View),i=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return c(e,t),e.prototype.default_view=s,e.prototype.type="LogAxis",e.override({ticker:function(){return new l.Model},formatter:function(){return new a.Model}}),e}(o.Model),e.exports={Model:i,View:s}},{"../formatters/log_tick_formatter":"models/formatters/log_tick_formatter","../tickers/log_ticker":"models/tickers/log_ticker","./axis":"models/axes/axis","./continuous_axis":"models/axes/continuous_axis",underscore:"underscore"}],"models/callbacks/customjs":[function(t,e,r){var n,o,i,s,a=function(t,e){function r(){this.constructor=t}for(var n in e)l.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},l={}.hasOwnProperty,u=[].slice;i=t("underscore"),s=t("../../core/properties"),o=t("../../model"),n=function(e){function r(){return r.__super__.constructor.apply(this,arguments)}return a(r,e),r.prototype.type="CustomJS",r.define({args:[s.Any,{}],code:[s.String,""]}),r.getters({values:function(){return this._make_values()},func:function(){return this._make_func()}}),r.prototype.execute=function(e,r){return this.func.apply(this,u.call(this.values).concat([e],[r],[t]))},r.prototype._make_values=function(){return i.values(this.args)},r.prototype._make_func=function(){return function(t,e,r){r.prototype=t.prototype;var n=new r,o=t.apply(n,e);return Object(o)===o?o:n}(Function,u.call(i.keys(this.args)).concat(["cb_obj"],["cb_data"],["require"],[this.code]),function(){})},r}(o),e.exports={Model:n}},{"../../core/properties":"core/properties","../../model":"model",underscore:"underscore"}],"models/callbacks/open_url":[function(t,e,r){var n,o,i,s,a,l,u=function(t,e){function r(){this.constructor=t}for(var n in e)c.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},c={}.hasOwnProperty;i=t("underscore"),n=t("../../model"),a=t("../../core/properties"),s=t("../../core/util/selection").get_indices,l=t("../../core/util/templating").replace_placeholders,o=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return u(e,t),e.prototype.type="OpenURL",e.define({url:[a.String,"http://"]}),e.prototype.execute=function(t){var e,r,n,o,i;for(o=s(t),r=0,n=o.length;r<n;r++)e=o[r],i=l(this.url,t,e),window.open(i);return null},e}(n),e.exports={Model:o}},{"../../core/properties":"core/properties","../../core/util/selection":"core/util/selection","../../core/util/templating":"core/util/templating","../../model":"model",underscore:"underscore"}],"models/canvas/canvas":[function(t,e,r){var n,o,i,s,a,l,u,c,p,h,_,d,f,m,g,y,v,b,x=function(t,e){function r(){this.constructor=t}for(var n in e)w.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},w={}.hasOwnProperty;u=t("underscore"),c=t("./canvas_template"),l=t("../../core/layout/layout_canvas"),n=t("../../core/bokeh_view"),v=t("../../core/layout/solver"),a=v.GE,s=v.EQ,g=t("../../core/logging").logger,y=t("../../core/properties"),b=t("../../core/util/canvas"),h=b.fixup_image_smoothing,_=b.fixup_line_dash,d=b.fixup_line_dash_offset,f=b.fixup_measure_text,m=b.get_scale_ratio,p=b.fixup_ellipse,i=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return x(e,t),e.prototype.className="bk-canvas-wrapper",e.prototype.template=c,e.prototype.initialize=function(t){var r,n;return e.__super__.initialize.call(this,t),r=this.template({map:this.model.map}),this.$el.html(r),this.ctx=this.get_ctx(),this.ctx.glcanvas=null,_(this.ctx),d(this.ctx),h(this.ctx),f(this.ctx),p(this.ctx),this.map_div=null!=(n=this.$("div.bk-canvas-map"))?n:null,this.set_dims([this.model.initial_width,this.model.initial_height]),g.debug("CanvasView initialized")},e.prototype.get_canvas_element=function(){return this.$("canvas.bk-canvas")[0]},e.prototype.get_ctx=function(){var t,e;return t=this.$("canvas.bk-canvas"),e=t[0].getContext("2d")},e.prototype.prepare_canvas=function(t){var e,r,n,o,i;if(null==t&&(t=!1),i=this.model._width._value,n=this.model._height._value,r=window.devicePixelRatio,!u.isEqual(this.last_dims,[i,n,r])||t)return this.$el.css({width:i,height:n}),this.pixel_ratio=o=m(this.ctx,this.model.use_hidpi),e=this.$(".bk-canvas"),e.css({width:i,height:n}),e.attr("width",i*o),e.attr("height",n*o),g.debug("Rendering CanvasView [force="+t+"] with width: "+i+", height: "+n+", ratio: "+o),this.model.pixel_ratio=this.pixel_ratio,this.last_dims=[i,n,r]},e.prototype.set_dims=function(t,e){null==e&&(e=!0),this.requested_width=t[0],this.requested_height=t[1],this.update_constraints(e)},e.prototype.update_constraints=function(t){var e,r,n,o;if(null==t&&(t=!0),n=this.requested_width,r=this.requested_height,null!=n&&null!=r&&(e=50,!(n<e||r<e||u.isEqual(this.last_requested_dims,[n,r]))))return o=this.model.document.solver(),null!=this._width_constraint&&o.remove_constraint(this._width_constraint),this._width_constraint=s(this.model._width,-n),o.add_constraint(this._width_constraint),null!=this._height_constraint&&o.remove_constraint(this._height_constraint),this._height_constraint=s(this.model._height,-r),o.add_constraint(this._height_constraint),this.last_requested_dims=[n,r],o.update_variables(t)},e}(n),o=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return x(e,t),e.prototype.type="Canvas",e.prototype.default_view=i,e.internal({map:[y.Boolean,!1],initial_width:[y.Number],initial_height:[y.Number],use_hidpi:[y.Boolean,!0],pixel_ratio:[y.Number]}),e.prototype.initialize=function(t,r){return e.__super__.initialize.call(this,t,r),this.panel=this},e.prototype.vx_to_sx=function(t){return t},e.prototype.vy_to_sy=function(t){return this._height._value-(t+1)},e.prototype.v_vx_to_sx=function(t){return new Float64Array(t)},e.prototype.v_vy_to_sy=function(t){var e,r,n,o,i,s;for(e=new Float64Array(t.length),r=this._height._value,o=n=0,i=t.length;n<i;o=++n)s=t[o],e[o]=r-(s+1);return e},e.prototype.sx_to_vx=function(t){return t},e.prototype.sy_to_vy=function(t){return this._height._value-(t+1)},e.prototype.v_sx_to_vx=function(t){return new Float64Array(t)},e.prototype.v_sy_to_vy=function(t){var e,r,n,o,i,s;for(e=new Float64Array(t.length),r=this._height._value,o=n=0,i=t.length;n<i;o=++n)s=t[o],e[o]=r-(s+1);return e},e.prototype.get_constraints=function(){var t;return t=e.__super__.get_constraints.call(this),t.push(a(this._top)),t.push(a(this._bottom)),t.push(a(this._left)),t.push(a(this._right)),t.push(a(this._width)),t.push(a(this._height)),t.push(s(this._width,[-1,this._right])),t.push(s(this._height,[-1,this._top])),t},e}(l.Model),e.exports={Model:o,View:i}},{"../../core/bokeh_view":"core/bokeh_view","../../core/layout/layout_canvas":"core/layout/layout_canvas","../../core/layout/solver":"core/layout/solver","../../core/logging":"core/logging","../../core/properties":"core/properties","../../core/util/canvas":"core/util/canvas","./canvas_template":"models/canvas/canvas_template",underscore:"underscore"}],"models/canvas/canvas_template":[function(t,e,r){e.exports=function(t){t||(t={});var e=[];return function(){(function(){this.map&&e.push('\n<div class="bk-canvas-map"></div>\n'),e.push('\n<div class="bk-canvas-events" />\n<div class="bk-canvas-overlays" />\n<canvas class=\'bk-canvas\'></canvas>')}).call(this)}.call(t),e.join("")}},{}],"models/canvas/cartesian_frame":[function(t,e,r){var n,o,i,s,a,l,u,c,p,h,_,d,f,m=function(t,e){function r(){this.constructor=t}for(var n in e)g.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},g={}.hasOwnProperty;h=t("underscore"),o=t("../mappers/categorical_mapper"),a=t("../mappers/grid_mapper"),u=t("../mappers/linear_mapper"),c=t("../mappers/log_mapper"),p=t("../ranges/range1d"),f=t("../../core/layout/solver"),i=f.EQ,s=f.GE,l=t("../../core/layout/layout_canvas"),_=t("../../core/logging").logging,d=t("../../core/properties"),n=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return m(e,t),e.prototype.type="CartesianFrame",e.prototype.initialize=function(t,r){return e.__super__.initialize.call(this,t,r),this.panel=this,this._configure_mappers(),this.listenTo(this,"change",function(t){return function(){return t._configure_mappers()}}(this)),null},e.prototype._doc_attached=function(){return this.listenTo(this.document.solver(),"layout_update",function(t){return function(){return t._update_mappers()}}(this)),null},e.prototype.contains=function(t,e){return t>=this.left&&t<=this.right&&e>=this.bottom&&e<=this.top},e.prototype.map_to_screen=function(t,e,r,n,o){var i,s,a,l;return null==n&&(n="default"),null==o&&(o="default"),a=this.x_mappers[n].v_map_to_target(t),i=r.v_vx_to_sx(a),l=this.y_mappers[o].v_map_to_target(e),s=r.v_vy_to_sy(l),[i,s]},e.prototype._get_ranges=function(t,e){var r,n,o;if(o={},o["default"]=t,null!=e)for(n in e)r=e[n],o[n]=r;return o},e.prototype._get_mappers=function(t,e,r){var n,i,s,a;i={};for(s in e){if(a=e[s],"Range1d"===a.type||"DataRange1d"===a.type)n="log"===t?c.Model:u.Model;else{if("FactorRange"!==a.type)return logger.warn("unknown range type for range '"+s+"': "+a),null;n=o.Model}i[s]=new n({source_range:a,target_range:r})}return i},e.prototype._configure_frame_ranges=function(){return this._h_range=new p.Model({start:this.left,end:this.left+this.width}),this._v_range=new p.Model({start:this.bottom,end:this.bottom+this.height})},e.prototype._configure_mappers=function(){return this._configure_frame_ranges(),this._x_ranges=this._get_ranges(this.x_range,this.extra_x_ranges),this._y_ranges=this._get_ranges(this.y_range,this.extra_y_ranges),this._x_mappers=this._get_mappers(this.x_mapper_type,this._x_ranges,this._h_range),this._y_mappers=this._get_mappers(this.y_mapper_type,this._y_ranges,this._v_range)},e.prototype._update_mappers=function(){var t,e,r,n;this._configure_frame_ranges(),r=this._x_mappers;for(e in r)t=r[e],t.target_range=this._h_range;n=this._y_mappers;for(e in n)t=n[e],t.target_range=this._v_range;return null},e.getters({h_range:function(){return this._h_range},v_range:function(){return this._v_range},x_ranges:function(){return this._x_ranges},y_ranges:function(){return this._y_ranges},x_mappers:function(){return this._x_mappers},y_mappers:function(){return this._y_mappers}}),e.internal({extra_x_ranges:[d.Any,{}],extra_y_ranges:[d.Any,{}],x_range:[d.Instance],y_range:[d.Instance],x_mapper_type:[d.String,"auto"],y_mapper_type:[d.String,"auto"]}),e.prototype.get_constraints=function(){var t;return t=[],t.push(s(this._top)),t.push(s(this._bottom)),t.push(s(this._left)),t.push(s(this._right)),t.push(s(this._width)),t.push(s(this._height)),t.push(i(this._left,this._width,[-1,this._right])),t.push(i(this._bottom,this._height,[-1,this._top])),t},e}(l.Model),e.exports={Model:n}},{"../../core/layout/layout_canvas":"core/layout/layout_canvas","../../core/layout/solver":"core/layout/solver","../../core/logging":"core/logging","../../core/properties":"core/properties","../mappers/categorical_mapper":"models/mappers/categorical_mapper","../mappers/grid_mapper":"models/mappers/grid_mapper","../mappers/linear_mapper":"models/mappers/linear_mapper","../mappers/log_mapper":"models/mappers/log_mapper","../ranges/range1d":"models/ranges/range1d",underscore:"underscore"}],"models/formatters/basic_tick_formatter":[function(t,e,r){var n,o,i,s,a=function(t,e){function r(){this.constructor=t}for(var n in e)l.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},l={}.hasOwnProperty;i=t("underscore"),o=t("./tick_formatter"),s=t("../../core/properties"),
|
|
n=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return a(e,t),e.prototype.type="BasicTickFormatter",e.define({precision:[s.Any,"auto"],use_scientific:[s.Bool,!0],power_limit_high:[s.Number,5],power_limit_low:[s.Number,-3]}),e.getters({scientific_limit_low:function(){return Math.pow(10,this.power_limit_low)},scientific_limit_high:function(){return Math.pow(10,this.power_limit_high)}}),e.prototype.initialize=function(t,r){return e.__super__.initialize.call(this,t,r),this.last_precision=3},e.prototype.doFormat=function(t){var e,r,n,o,s,a,l,u,c,p,h,_,d,f,m,g,y,v,b,x,w;if(0===t.length)return[];if(w=0,t.length>=2&&(w=Math.abs(t[1]-t[0])/1e4),p=!1,this.use_scientific)for(n=0,l=t.length;n<l;n++)if(v=t[n],b=Math.abs(v),b>w&&(b>=this.scientific_limit_high||b<=this.scientific_limit_low)){p=!0;break}if(_=this.precision,null==_||i.isNumber(_)){if(a=new Array(t.length),p)for(e=o=0,d=t.length;0<=d?o<d:o>d;e=0<=d?++o:--o)a[e]=t[e].toExponential(_||void 0);else for(e=s=0,f=t.length;0<=f?s<f:s>f;e=0<=f?++s:--s)a[e]=t[e].toFixed(_||void 0).replace(/(\.[0-9]*?)0+$/,"$1").replace(/\.$/,"");return a}if("auto"===_)for(a=new Array(t.length),x=u=m=this.last_precision;m<=15?u<=15:u>=15;x=m<=15?++u:--u){if(r=!0,p){for(e=c=0,g=t.length;0<=g?c<g:c>g;e=0<=g?++c:--c)if(a[e]=t[e].toExponential(x),e>0&&a[e]===a[e-1]){r=!1;break}if(r)break}else{for(e=h=0,y=t.length;0<=y?h<y:h>y;e=0<=y?++h:--h)if(a[e]=t[e].toFixed(x).replace(/(\.[0-9]*?)0+$/,"$1").replace(/\.$/,""),e>0&&a[e]===a[e-1]){r=!1;break}if(r)break}if(r)return this.last_precision=x,a}return a},e}(o.Model),e.exports={Model:n}},{"../../core/properties":"core/properties","./tick_formatter":"models/formatters/tick_formatter",underscore:"underscore"}],"models/formatters/categorical_tick_formatter":[function(t,e,r){var n,o,i=function(t,e){function r(){this.constructor=t}for(var n in e)s.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},s={}.hasOwnProperty;o=t("../formatters/tick_formatter"),n=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return i(e,t),e.prototype.type="CategoricalTickFormatter",e.prototype.doFormat=function(t){return t},e}(o.Model),e.exports={Model:n}},{"../formatters/tick_formatter":"models/formatters/tick_formatter"}],"models/formatters/datetime_tick_formatter":[function(t,e,r){var n,o,i,s,a,l,u,c,p,h,_=function(t,e){function r(){this.constructor=t}for(var n in e)d.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},d={}.hasOwnProperty;s=t("underscore"),o=t("sprintf"),h=t("timezone"),i=t("./tick_formatter"),c=t("../../core/logging").logger,p=t("../../core/properties"),u=function(t){return Math.round(t/1e3%1*1e6)},a=function(t){return h(t,"%Y %m %d %H %M %S").split(/\s+/).map(function(t){return parseInt(t,10)})},l=function(t,e){var r;return s.isFunction(e)?e(t):(r=o.sprintf("$1%06d",u(t)),e=e.replace(/((^|[^%])(%%)*)%f/,r),e.indexOf("%")===-1?e:h(t,e))},n=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return _(e,t),e.prototype.type="DatetimeTickFormatter",e.define({microseconds:[p.Array,["%fus"]],milliseconds:[p.Array,["%3Nms","%S.%3Ns"]],seconds:[p.Array,["%Ss"]],minsec:[p.Array,[":%M:%S"]],minutes:[p.Array,[":%M","%Mm"]],hourmin:[p.Array,["%H:%M"]],hours:[p.Array,["%Hh","%H:%M"]],days:[p.Array,["%m/%d","%a%d"]],months:[p.Array,["%m/%Y","%b%y"]],years:[p.Array,["%Y"]]}),e.prototype.format_order=["microseconds","milliseconds","seconds","minsec","minutes","hourmin","hours","days","months","years"],e.prototype.strip_leading_zeros=!0,e.prototype.initialize=function(t,r){return e.__super__.initialize.call(this,t,r),this._update_width_formats()},e.prototype._update_width_formats=function(){var t,e;return e=h(new Date),t=function(t){var r,n,o;return n=function(){var n,o,i;for(i=[],n=0,o=t.length;n<o;n++)r=t[n],i.push(l(e,r).length);return i}(),o=s.sortBy(s.zip(n,t),function(t){var e,r;return r=t[0],e=t[1],r}),s.zip.apply(s,o)},this._width_formats={microseconds:t(this.microseconds),milliseconds:t(this.milliseconds),seconds:t(this.seconds),minsec:t(this.minsec),minutes:t(this.minutes),hourmin:t(this.hourmin),hours:t(this.hours),days:t(this.days),months:t(this.months),years:t(this.years)}},e.prototype._get_resolution_str=function(t,e){var r;switch(r=1.1*t,!1){case!(r<.001):return"microseconds";case!(r<1):return"milliseconds";case!(r<60):return e>=60?"minsec":"seconds";case!(r<3600):return e>=3600?"hourmin":"minutes";case!(r<86400):return"hours";case!(r<2678400):return"days";case!(r<31536e3):return"months";default:return"years"}},e.prototype.doFormat=function(t,e,r,n,o){var i,u,p,h,_,d,f,m,g,y,v,b,x,w,k,M,T,S,z,E,A,C,j,P,N,O,D,F,q;if(null==e&&(e=null),null==r&&(r=null),null==n&&(n=.3),null==o&&(o=null),0===t.length)return[];if(P=Math.abs(t[t.length-1]-t[0])/1e3,T=o?o.resolution:P/(t.length-1),A=this._get_resolution_str(T,P),S=this._width_formats[A],q=S[0],_=S[1],h=_[0],r){for(d=[],m=g=0,z=q.length;0<=z?g<z:g>z;m=0<=z?++g:--g)q[m]*t.length<n*r&&d.push(this._width_formats[m]);d.length>0&&(h=s.last(d))}for(b=[],C=this.format_order.indexOf(A),D={},E=this.format_order,y=0,x=E.length;y<x;y++)p=E[y],D[p]=0;for(D.seconds=5,D.minsec=4,D.minutes=4,D.hourmin=3,D.hours=3,v=0,w=t.length;v<w;v++){O=t[v];try{F=a(O),j=l(O,h)}catch(u){i=u,c.warn("unable to format tick for timestamp value "+O),c.warn(" - "+i),b.push("ERR");continue}for(f=!1,M=C;0===F[D[this.format_order[M]]]&&(M+=1,M!==this.format_order.length);){if(("minsec"===A||"hourmin"===A)&&!f){if("minsec"===A&&0===F[4]&&0!==F[5]||"hourmin"===A&&0===F[3]&&0!==F[4]){k=this._width_formats[this.format_order[C-1]][1][0],j=l(O,k);break}f=!0}k=this._width_formats[this.format_order[M]][1][0],j=l(O,k)}this.strip_leading_zeros?(N=j.replace(/^0+/g,""),N!==j&&isNaN(parseInt(N))&&(N="0"+N),b.push(N)):b.push(j)}return b},e}(i.Model),e.exports={Model:n}},{"../../core/logging":"core/logging","../../core/properties":"core/properties","./tick_formatter":"models/formatters/tick_formatter",sprintf:"sprintf",timezone:"timezone/index",underscore:"underscore"}],"models/formatters/func_tick_formatter":[function(t,e,r){var n,o,i,s,a=function(t,e){function r(){this.constructor=t}for(var n in e)l.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},l={}.hasOwnProperty,u=[].slice;i=t("underscore"),s=t("../../core/properties"),o=t("../formatters/tick_formatter"),n=function(e){function r(){return r.__super__.constructor.apply(this,arguments)}return a(r,e),r.prototype.type="FuncTickFormatter",r.define({args:[s.Any,{}],code:[s.String,""]}),r.prototype.initialize=function(t,e){return r.__super__.initialize.call(this,t,e)},r.prototype._make_func=function(){return function(t,e,r){r.prototype=t.prototype;var n=new r,o=t.apply(n,e);return Object(o)===o?o:n}(Function,["tick"].concat(u.call(i.keys(this.args)),["require"],[this.code]),function(){})},r.prototype.doFormat=function(e){var r,n;return r=this._make_func(),function(){var o,s,a;for(a=[],o=0,s=e.length;o<s;o++)n=e[o],a.push(r.apply(null,[n].concat(u.call(i.values(this.args)),[t])));return a}.call(this)},r}(o.Model),e.exports={Model:n}},{"../../core/properties":"core/properties","../formatters/tick_formatter":"models/formatters/tick_formatter",underscore:"underscore"}],"models/formatters/log_tick_formatter":[function(t,e,r){var n,o,i,s,a,l,u=function(t,e){function r(){this.constructor=t}for(var n in e)c.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},c={}.hasOwnProperty;s=t("underscore"),n=t("./basic_tick_formatter"),i=t("./tick_formatter"),a=t("../../core/logging").logger,l=t("../../core/properties"),o=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return u(e,t),e.prototype.type="LogTickFormatter",e.define({ticker:[l.Instance,null]}),e.prototype.initialize=function(t,r){if(e.__super__.initialize.call(this,t,r),this.basic_formatter=new n.Model,null==this.ticker)return a.warn("LogTickFormatter not configured with a ticker, using default base of 10 (labels will be incorrect if ticker base is not 10)")},e.prototype.doFormat=function(t){var e,r,n,o,i,s;if(0===t.length)return[];for(e=null!=this.ticker?this.ticker.base:10,s=!1,o=new Array(t.length),r=n=0,i=t.length;0<=i?n<i:n>i;r=0<=i?++n:--n)if(o[r]=e+"^"+Math.round(Math.log(t[r])/Math.log(e)),r>0&&o[r]===o[r-1]){s=!0;break}return s&&(o=this.basic_formatter.doFormat(t)),o},e}(i.Model),e.exports={Model:o}},{"../../core/logging":"core/logging","../../core/properties":"core/properties","./basic_tick_formatter":"models/formatters/basic_tick_formatter","./tick_formatter":"models/formatters/tick_formatter",underscore:"underscore"}],"models/formatters/numeral_tick_formatter":[function(t,e,r){var n,o,i,s,a,l=function(t,e){function r(){this.constructor=t}for(var n in e)u.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},u={}.hasOwnProperty;s=t("underscore"),n=t("numbro"),i=t("./tick_formatter"),a=t("../../core/properties"),o=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return l(e,t),e.prototype.type="NumeralTickFormatter",e.define({format:[a.String,"0,0"],language:[a.String,"en"],rounding:[a.String,"round"]}),e.prototype.doFormat=function(t){var e,r,o,i,s;return e=this.format,o=this.language,i=function(){switch(this.rounding){case"round":case"nearest":return Math.round;case"floor":case"rounddown":return Math.floor;case"ceil":case"roundup":return Math.ceil}}.call(this),r=function(){var r,a,l;for(l=[],r=0,a=t.length;r<a;r++)s=t[r],l.push(n.format(s,e,o,i));return l}()},e}(i.Model),e.exports={Model:o}},{"../../core/properties":"core/properties","./tick_formatter":"models/formatters/tick_formatter",numbro:"numbro",underscore:"underscore"}],"models/formatters/printf_tick_formatter":[function(t,e,r){var n,o,i,s,a,l=function(t,e){function r(){this.constructor=t}for(var n in e)u.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},u={}.hasOwnProperty;s=t("underscore"),o=t("sprintf"),i=t("./tick_formatter"),a=t("../../core/properties"),n=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return l(e,t),e.prototype.type="PrintfTickFormatter",e.define({format:[a.String,"%s"]}),e.prototype.doFormat=function(t){var e,r,n;return e=this.format,r=function(){var r,i,s;for(s=[],r=0,i=t.length;r<i;r++)n=t[r],s.push(o.sprintf(e,n));return s}()},e}(i.Model),e.exports={Model:n}},{"../../core/properties":"core/properties","./tick_formatter":"models/formatters/tick_formatter",sprintf:"sprintf",underscore:"underscore"}],"models/formatters/tick_formatter":[function(t,e,r){var n,o,i,s=function(t,e){function r(){this.constructor=t}for(var n in e)a.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},a={}.hasOwnProperty;i=t("underscore"),n=t("../../model"),o=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return s(e,t),e.prototype.type="TickFormatter",e.prototype.doFormat=function(t){},e}(n),e.exports={Model:o}},{"../../model":"model",underscore:"underscore"}],"models/glyphs/annular_wedge":[function(t,e,r){var n,o,i,s,a,l,u,c=function(t,e){function r(){this.constructor=t}for(var n in e)p.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},p={}.hasOwnProperty;s=t("underscore"),i=t("./glyph"),l=t("../../core/hittest"),u=t("../../core/properties"),a=t("../../core/util/math").angle_between,o=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return c(e,t),e.prototype._index_data=function(){return this._xy_index()},e.prototype._map_data=function(){var t,e,r,n;for("data"===this.model.properties.inner_radius.units?this.sinner_radius=this.sdist(this.renderer.xmapper,this._x,this._inner_radius):this.sinner_radius=this._inner_radius,"data"===this.model.properties.outer_radius.units?this.souter_radius=this.sdist(this.renderer.xmapper,this._x,this._outer_radius):this.souter_radius=this._outer_radius,this._angle=new Float32Array(this._start_angle.length),n=[],t=e=0,r=this._start_angle.length;0<=r?e<r:e>r;t=0<=r?++e:--e)n.push(this._angle[t]=this._end_angle[t]-this._start_angle[t]);return n},e.prototype._render=function(t,e,r){var n,o,i,s,a,l,u,c,p,h,_;for(h=r.sx,_=r.sy,o=r._start_angle,n=r._angle,c=r.sinner_radius,p=r.souter_radius,i=this.model.properties.direction.value(),u=[],a=0,l=e.length;a<l;a++)s=e[a],isNaN(h[s]+_[s]+c[s]+p[s]+o[s]+n[s])||(t.translate(h[s],_[s]),t.rotate(o[s]),t.moveTo(p[s],0),t.beginPath(),t.arc(0,0,p[s],0,n[s],i),t.rotate(n[s]),t.lineTo(c[s],0),t.arc(0,0,c[s],0,-n[s],!i),t.closePath(),t.rotate(-n[s]-o[s]),t.translate(-h[s],-_[s]),this.visuals.fill.doit&&(this.visuals.fill.set_vectorize(t,s),t.fill()),this.visuals.line.doit?(this.visuals.line.set_vectorize(t,s),u.push(t.stroke())):u.push(void 0));return u},e.prototype._hit_point=function(t){var e,r,n,o,i,u,c,p,h,_,d,f,m,g,y,v,b,x,w,k,M,T,S,z,E,A,C,j,P,N,O,D,F,q,I,R,L,B;for(y=[t.vx,t.vy],C=y[0],N=y[1],F=this.renderer.xmapper.map_from_target(C,!0),R=this.renderer.ymapper.map_from_target(N,!0),"data"===this.model.properties.outer_radius.units?(q=F-this.max_outer_radius,I=F+this.max_outer_radius,L=R-this.max_outer_radius,B=R+this.max_outer_radius):(j=C-this.max_outer_radius,P=C+this.max_outer_radius,v=this.renderer.xmapper.v_map_from_target([j,P],!0),q=v[0],I=v[1],O=N-this.max_outer_radius,D=N+this.max_outer_radius,b=this.renderer.ymapper.v_map_from_target([O,D],!0),L=b[0],B=b[1]),n=[],r=l.validate_bbox_coords([q,I],[L,B]),x=function(){var t,e,n,o;for(n=this.index.search(r),o=[],t=0,e=n.length;t<e;t++)g=n[t],o.push(g.i);return o}.call(this),h=0,d=x.length;h<d;h++)c=x[h],m=Math.pow(this.souter_radius[c],2),p=Math.pow(this.sinner_radius[c],2),T=this.renderer.xmapper.map_to_target(F,!0),S=this.renderer.xmapper.map_to_target(this._x[c],!0),E=this.renderer.ymapper.map_to_target(R,!0),A=this.renderer.ymapper.map_to_target(this._y[c],!0),i=Math.pow(T-S,2)+Math.pow(E-A,2),i<=m&&i>=p&&n.push([c,i]);for(o=this.model.properties.direction.value(),u=[],_=0,f=n.length;_<f;_++)w=n[_],c=w[0],i=w[1],M=this.renderer.plot_view.canvas.vx_to_sx(C),z=this.renderer.plot_view.canvas.vy_to_sy(N),e=Math.atan2(z-this.sy[c],M-this.sx[c]),a(-e,-this._start_angle[c],-this._end_angle[c],o)&&u.push([c,i]);return k=l.create_hit_test_result(),k["1d"].indices=s.chain(u).sortBy(function(t){return t[1]}).map(function(t){return t[0]}).value(),k},e.prototype.draw_legend_for_index=function(t,e,r,n,o,i){return this._generic_area_legend(t,e,r,n,o,i)},e.prototype._scxy=function(t){var e,r;return r=(this.sinner_radius[t]+this.souter_radius[t])/2,e=(this._start_angle[t]+this._end_angle[t])/2,{x:this.sx[t]+r*Math.cos(e),y:this.sy[t]+r*Math.sin(e)}},e.prototype.scx=function(t){return this._scxy(t).x},e.prototype.scy=function(t){return this._scxy(t).y},e}(i.View),n=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return c(e,t),e.prototype.default_view=o,e.prototype.type="AnnularWedge",e.coords([["x","y"]]),e.mixins(["line","fill"]),e.define({direction:[u.Direction,"anticlock"],inner_radius:[u.DistanceSpec],outer_radius:[u.DistanceSpec],start_angle:[u.AngleSpec],end_angle:[u.AngleSpec]}),e}(i.Model),e.exports={Model:n,View:o}},{"../../core/hittest":"core/hittest","../../core/properties":"core/properties","../../core/util/math":"core/util/math","./glyph":"models/glyphs/glyph",underscore:"underscore"}],"models/glyphs/annulus":[function(t,e,r){var n,o,i,s,a,l,u=function(t,e){function r(){this.constructor=t}for(var n in e)c.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},c={}.hasOwnProperty;s=t("underscore"),i=t("./glyph"),a=t("../../core/hittest"),l=t("../../core/properties"),o=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return u(e,t),e.prototype._index_data=function(){return this._xy_index()},e.prototype._map_data=function(){return"data"===this.model.properties.inner_radius.units?this.sinner_radius=this.sdist(this.renderer.xmapper,this._x,this._inner_radius):this.sinner_radius=this._inner_radius,"data"===this.model.properties.outer_radius.units?this.souter_radius=this.sdist(this.renderer.xmapper,this._x,this._outer_radius):this.souter_radius=this._outer_radius},e.prototype._render=function(t,e,r){var n,o,i,s,a,l,u,c,p,h,_,d,f;for(d=r.sx,f=r.sy,h=r.sinner_radius,_=r.souter_radius,p=[],s=0,l=e.length;s<l;s++)if(o=e[s],!isNaN(d[o]+f[o]+h[o]+_[o])){if(i=navigator.userAgent.indexOf("MSIE")>=0||navigator.userAgent.indexOf("Trident")>0||navigator.userAgent.indexOf("Edge")>0,this.visuals.fill.doit){if(this.visuals.fill.set_vectorize(t,o),t.beginPath(),i)for(c=[!1,!0],a=0,u=c.length;a<u;a++)n=c[a],t.arc(d[o],f[o],h[o],0,Math.PI,n),t.arc(d[o],f[o],_[o],Math.PI,0,!n);else t.arc(d[o],f[o],h[o],0,2*Math.PI,!0),t.arc(d[o],f[o],_[o],2*Math.PI,0,!1);t.fill()}this.visuals.line.doit?(this.visuals.line.set_vectorize(t,o),t.beginPath(),t.arc(d[o],f[o],h[o],0,2*Math.PI),t.moveTo(d[o]+_[o],f[o]),t.arc(d[o],f[o],_[o],0,2*Math.PI),p.push(t.stroke())):p.push(void 0)}return p},e.prototype._hit_point=function(t){var e,r,n,o,i,l,u,c,p,h,_,d,f,m,g,y,v,b,x,w,k,M,T,S;for(h=[t.vx,t.vy],v=h[0],b=h[1],x=this.renderer.xmapper.map_from_target(v,!0),w=x-this.max_radius,k=x+this.max_radius,M=this.renderer.ymapper.map_from_target(b,!0),T=M-this.max_radius,S=M+this.max_radius,n=[],e=a.validate_bbox_coords([w,k],[T,S]),_=function(){var t,r,n,o;for(n=this.index.search(e),o=[],t=0,r=n.length;t<r;t++)p=n[t],o.push(p.i);return o}.call(this),l=0,u=_.length;l<u;l++)o=_[l],c=Math.pow(this.souter_radius[o],2),i=Math.pow(this.sinner_radius[o],2),f=this.renderer.xmapper.map_to_target(x),m=this.renderer.xmapper.map_to_target(this._x[o]),g=this.renderer.ymapper.map_to_target(M),y=this.renderer.ymapper.map_to_target(this._y[o]),r=Math.pow(f-m,2)+Math.pow(g-y,2),r<=c&&r>=i&&n.push([o,r]);return d=a.create_hit_test_result(),d["1d"].indices=s.chain(n).sortBy(function(t){return t[1]}).map(function(t){return t[0]}).value(),d},e.prototype.draw_legend_for_index=function(t,e,r,n,o,i){var s,a,l,u,c,p,h;return a=[i],p={},p[i]=(e+r)/2,h={},h[i]=(n+o)/2,l=.5*Math.min(Math.abs(r-e),Math.abs(o-n)),u={},u[i]=.4*l,c={},c[i]=.8*l,s={sx:p,sy:h,sinner_radius:u,souter_radius:c},this._render(t,a,s)},e}(i.View),n=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return u(e,t),e.prototype.default_view=o,e.prototype.type="Annulus",e.coords([["x","y"]]),e.mixins(["line","fill"]),e.define({inner_radius:[l.DistanceSpec],outer_radius:[l.DistanceSpec]}),e}(i.Model),e.exports={Model:n,View:o}},{"../../core/hittest":"core/hittest","../../core/properties":"core/properties","./glyph":"models/glyphs/glyph",underscore:"underscore"}],"models/glyphs/arc":[function(t,e,r){var n,o,i,s,a,l=function(t,e){function r(){this.constructor=t}for(var n in e)u.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},u={}.hasOwnProperty;s=t("underscore"),i=t("./glyph"),a=t("../../core/properties"),o=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return l(e,t),e.prototype._index_data=function(){return this._xy_index()},e.prototype._map_data=function(){return"data"===this.model.properties.radius.units?this.sradius=this.sdist(this.renderer.xmapper,this._x,this._radius):this.sradius=this._radius},e.prototype._render=function(t,e,r){var n,o,i,s,a,l,u,c,p,h;if(p=r.sx,h=r.sy,c=r.sradius,o=r._start_angle,n=r._end_angle,this.visuals.line.doit){for(i=this.model.properties.direction.value(),u=[],a=0,l=e.length;a<l;a++)s=e[a],isNaN(p[s]+h[s]+c[s]+o[s]+n[s])||(t.beginPath(),t.arc(p[s],h[s],c[s],o[s],n[s],i),this.visuals.line.set_vectorize(t,s),u.push(t.stroke()));return u}},e.prototype.draw_legend_for_index=function(t,e,r,n,o,i){return this._generic_line_legend(t,e,r,n,o,i)},e}(i.View),n=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return l(e,t),e.prototype.default_view=o,e.prototype.type="Arc",e.coords([["x","y"]]),e.mixins(["line"]),e.define({direction:[a.Direction,"anticlock"],radius:[a.DistanceSpec],start_angle:[a.AngleSpec],end_angle:[a.AngleSpec]}),e}(i.Model),e.exports={Model:n,View:o}},{"../../core/properties":"core/properties","./glyph":"models/glyphs/glyph",underscore:"underscore"}],"models/glyphs/bezier":[function(t,e,r){var n,o,i,s,a,l,u=function(t,e){function r(){this.constructor=t}for(var n in e)c.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},c={}.hasOwnProperty;s=t("underscore"),l=t("rbush"),i=t("./glyph"),a=function(t,e,r,n,o,i,s,a){var l,u,c,p,h,_,d,f,m,g,y,v,b,x,w,k,M;for(w=[],p=[[],[]],_=m=0;m<=2;_=++m)if(0===_?(u=6*t-12*r+6*o,l=-3*t+9*r-9*o+3*s,h=3*r-3*t):(u=6*e-12*n+6*i,l=-3*e+9*n-9*i+3*a,h=3*n-3*e),Math.abs(l)<1e-12){if(Math.abs(u)<1e-12)continue;v=-h/u,0<v&&v<1&&w.push(v)}else c=u*u-4*h*l,y=Math.sqrt(c),c<0||(b=(-u+y)/(2*l),0<b&&b<1&&w.push(b),x=(-u-y)/(2*l),0<x&&x<1&&w.push(x));for(d=w.length,f=d;d--;)v=w[d],g=1-v,k=g*g*g*t+3*g*g*v*r+3*g*v*v*o+v*v*v*s,p[0][d]=k,M=g*g*g*e+3*g*g*v*n+3*g*v*v*i+v*v*v*a,p[1][d]=M;return p[0][f]=t,p[1][f]=e,p[0][f+1]=s,p[1][f+1]=a,[Math.min.apply(null,p[0]),Math.max.apply(null,p[1]),Math.max.apply(null,p[0]),Math.min.apply(null,p[1])]},o=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return u(e,t),e.prototype._index_data=function(){var t,e,r,n,o,i,s,u,c,p;for(e=l(),n=[],t=r=0,o=this._x0.length;0<=o?r<o:r>o;t=0<=o?++r:--r)isNaN(this._x0[t]+this._x1[t]+this._y0[t]+this._y1[t]+this._cx0[t]+this._cy0[t]+this._cx1[t]+this._cy1[t])||(i=a(this._x0[t],this._y0[t],this._x1[t],this._y1[t],this._cx0[t],this._cy0[t],this._cx1[t],this._cy1[t]),s=i[0],c=i[1],u=i[2],p=i[3],n.push({minX:s,minY:c,maxX:u,maxY:p,i:t}));return e.load(n),e},e.prototype._render=function(t,e,r){var n,o,i,s,a,l,u,c,p,h,_,d,f;if(h=r.sx0,d=r.sy0,_=r.sx1,f=r.sy1,a=r.scx,l=r.scx0,c=r.scy0,u=r.scx1,p=r.scy1,this.visuals.line.doit){for(s=[],o=0,i=e.length;o<i;o++)n=e[o],isNaN(h[n]+d[n]+_[n]+f[n]+l[n]+c[n]+u[n]+p[n])||(t.beginPath(),t.moveTo(h[n],d[n]),t.bezierCurveTo(l[n],c[n],u[n],p[n],_[n],f[n]),this.visuals.line.set_vectorize(t,n),s.push(t.stroke()));return s}},e.prototype.draw_legend_for_index=function(t,e,r,n,o,i){return this._generic_line_legend(t,e,r,n,o,i)},e}(i.View),n=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return u(e,t),e.prototype.default_view=o,e.prototype.type="Bezier",e.coords([["x0","y0"],["x1","y1"],["cx0","cy0"],["cx1","cy1"]]),e.mixins(["line"]),e}(i.Model),e.exports={Model:n,View:o}},{"./glyph":"models/glyphs/glyph",rbush:"rbush",underscore:"underscore"}],"models/glyphs/circle":[function(t,e,r){var n,o,i,s,a,l,u=function(t,e){function r(){this.constructor=t}for(var n in e)c.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},c={}.hasOwnProperty;s=t("underscore"),i=t("./glyph"),a=t("../../core/hittest"),l=t("../../core/properties"),o=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return u(e,t),e.prototype._index_data=function(){return this._xy_index()},e.prototype._map_data=function(){var t,e;return null!=this._radius?"data"===this.model.properties.radius.spec.units?(t=this.model.properties.radius_dimension.spec.value,this.sradius=this.sdist(this.renderer[t+"mapper"],this["_"+t],this._radius)):(this.sradius=this._radius,this.max_size=2*this.max_radius):this.sradius=function(){var t,r,n,o;for(n=this._size,o=[],t=0,r=n.length;t<r;t++)e=n[t],o.push(e/2);return o}.call(this)},e.prototype._mask_data=function(t){var e,r,n,o,i,s,l,u,c,p,h,_,d,f,m,g;return r=this.renderer.plot_view.frame.h_range,h=this.renderer.plot_view.frame.v_range,null!=this._radius&&"data"===this.model.properties.radius.units?(l=r.start,u=r.end,n=this.renderer.xmapper.v_map_from_target([l,u],!0),d=n[0],f=n[1],d-=this.max_radius,f+=this.max_radius,c=h.start,p=h.end,o=this.renderer.ymapper.v_map_from_target([c,p],!0),m=o[0],g=o[1],m-=this.max_radius,g+=this.max_radius):(l=r.start-this.max_size,u=r.end+this.max_size,i=this.renderer.xmapper.v_map_from_target([l,u],!0),d=i[0],f=i[1],c=h.start-this.max_size,p=h.end+this.max_size,s=this.renderer.ymapper.v_map_from_target([c,p],!0),m=s[0],g=s[1]),e=a.validate_bbox_coords([d,f],[m,g]),function(){var t,r,n,o;for(n=this.index.search(e),o=[],t=0,r=n.length;t<r;t++)_=n[t],o.push(_.i);return o}.call(this)},e.prototype._render=function(t,e,r){var n,o,i,s,a,l,u;for(l=r.sx,u=r.sy,a=r.sradius,s=[],o=0,i=e.length;o<i;o++)n=e[o],isNaN(l[n]+u[n]+a[n])||(t.beginPath(),t.arc(l[n],u[n],a[n],0,2*Math.PI,!1),this.visuals.fill.doit&&(this.visuals.fill.set_vectorize(t,n),t.fill()),this.visuals.line.doit?(this.visuals.line.set_vectorize(t,n),s.push(t.stroke())):s.push(void 0));return s},e.prototype._hit_point=function(t){var e,r,n,o,i,l,u,c,p,h,_,d,f,m,g,y,v,b,x,w,k,M,T,S,z,E,A,C,j,P,N,O,D,F,q;if(d=[t.vx,t.vy],S=d[0],A=d[1],P=this.renderer.xmapper.map_from_target(S,!0),D=this.renderer.ymapper.map_from_target(A,!0),null!=this._radius&&"data"===this.model.properties.radius.units?(N=P-this.max_radius,O=P+this.max_radius,F=D-this.max_radius,q=D+this.max_radius):(z=S-this.max_size,E=S+this.max_size,f=this.renderer.xmapper.v_map_from_target([z,E],!0),N=f[0],O=f[1],m=[Math.min(N,O),Math.max(N,O)],N=m[0],O=m[1],C=A-this.max_size,j=A+this.max_size,g=this.renderer.ymapper.v_map_from_target([C,j],!0),F=g[0],q=g[1],y=[Math.min(F,q),Math.max(F,q)],F=y[0],q=y[1]),e=a.validate_bbox_coords([N,O],[F,q]),r=function(){var t,r,n,o;for(n=this.index.search(e),o=[],t=0,r=n.length;t<r;t++)h=n[t],o.push(h.i);return o}.call(this),o=[],null!=this._radius&&"data"===this.model.properties.radius.units)for(l=0,c=r.length;l<c;l++)i=r[l],_=Math.pow(this.sradius[i],2),x=this.renderer.xmapper.map_to_target(P,!0),w=this.renderer.xmapper.map_to_target(this._x[i],!0),M=this.renderer.ymapper.map_to_target(D,!0),T=this.renderer.ymapper.map_to_target(this._y[i],!0),n=Math.pow(x-w,2)+Math.pow(M-T,2),n<=_&&o.push([i,n]);else for(b=this.renderer.plot_view.canvas.vx_to_sx(S),k=this.renderer.plot_view.canvas.vy_to_sy(A),u=0,p=r.length;u<p;u++)i=r[u],_=Math.pow(this.sradius[i],2),n=Math.pow(this.sx[i]-b,2)+Math.pow(this.sy[i]-k,2),n<=_&&o.push([i,n]);return o=s.chain(o).sortBy(function(t){return t[1]}).map(function(t){return t[0]}).value(),v=a.create_hit_test_result(),v["1d"].indices=o,v},e.prototype._hit_span=function(t){var e,r,n,o,i,s,l,u,c,p,h,_,d,f,m,g,y,v,b,x,w,k,M,T,S;return u=[t.vx,t.vy],m=u[0],v=u[1],c=this.bounds(),i=c.minX,s=c.minY,n=c.maxX,o=c.maxY,f=a.create_hit_test_result(),"h"===t.direction?(T=s,S=o,null!=this._radius&&"data"===this.model.properties.radius.units?(g=m-this.max_radius,y=m+this.max_radius,p=this.renderer.xmapper.v_map_from_target([g,y]),w=p[0],k=p[1]):(l=this.max_size/2,g=m-l,y=m+l,h=this.renderer.xmapper.v_map_from_target([g,y],!0),w=h[0],k=h[1])):(w=i,k=n,null!=this._radius&&"data"===this.model.properties.radius.units?(b=v-this.max_radius,x=v+this.max_radius,_=this.renderer.ymapper.v_map_from_target([b,x]),T=_[0],S=_[1]):(l=this.max_size/2,b=v-l,x=v+l,d=this.renderer.ymapper.v_map_from_target([b,x],!0),T=d[0],S=d[1])),e=a.validate_bbox_coords([w,k],[T,S]),r=function(){var t,r,n,o;for(n=this.index.search(e),o=[],t=0,r=n.length;t<r;t++)M=n[t],o.push(M.i);return o}.call(this),f["1d"].indices=r,f},e.prototype._hit_rect=function(t){var e,r,n,o,i,s,l,u,c;return r=this.renderer.xmapper.v_map_from_target([t.vx0,t.vx1],!0),s=r[0],l=r[1],n=this.renderer.ymapper.v_map_from_target([t.vy0,t.vy1],!0),u=n[0],c=n[1],e=a.validate_bbox_coords([s,l],[u,c]),o=a.create_hit_test_result(),o["1d"].indices=function(){var t,r,n,o;for(n=this.index.search(e),o=[],t=0,r=n.length;t<r;t++)i=n[t],o.push(i.i);return o}.call(this),o},e.prototype._hit_poly=function(t){var e,r,n,o,i,s,l,u,c,p,h,_,d;for(s=[t.vx,t.vy],_=s[0],d=s[1],p=this.renderer.plot_view.canvas.v_vx_to_sx(_),h=this.renderer.plot_view.canvas.v_vy_to_sy(d),e=function(){c=[];for(var t=0,e=this.sx.length;0<=e?t<e:t>e;0<=e?t++:t--)c.push(t);return c}.apply(this),r=[],n=i=0,l=e.length;0<=l?i<l:i>l;n=0<=l?++i:--i)o=e[n],a.point_in_poly(this.sx[n],this.sy[n],p,h)&&r.push(o);return u=a.create_hit_test_result(),u["1d"].indices=r,u},e.prototype.draw_legend_for_index=function(t,e,r,n,o,i){var s,a,l,u,c;return a=[i],u={},u[i]=(e+r)/2,c={},c[i]=(n+o)/2,l={},l[i]=.2*Math.min(Math.abs(r-e),Math.abs(o-n)),s={sx:u,sy:c,sradius:l},this._render(t,a,s)},e}(i.View),n=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return u(e,t),e.prototype.default_view=o,e.prototype.type="Circle",e.coords([["x","y"]]),e.mixins(["line","fill"]),e.define({angle:[l.AngleSpec,0],size:[l.DistanceSpec,{units:"screen",value:4}],radius:[l.DistanceSpec,null],radius_dimension:[l.String,"x"]}),e.prototype.initialize=function(t,r){return e.__super__.initialize.call(this,t,r),this.properties.radius.optional=!0},e}(i.Model),e.exports={Model:n,View:o}},{"../../core/hittest":"core/hittest","../../core/properties":"core/properties","./glyph":"models/glyphs/glyph",underscore:"underscore"}],"models/glyphs/ellipse":[function(t,e,r){var n,o,i,s,a,l=function(t,e){function r(){this.constructor=t}for(var n in e)u.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},u={}.hasOwnProperty;s=t("underscore"),i=t("./glyph"),a=t("../../core/properties"),o=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return l(e,t),e.prototype._set_data=function(){if(this.max_w2=0,"data"===this.model.properties.width.units&&(this.max_w2=this.max_width/2),this.max_h2=0,"data"===this.model.properties.height.units)return this.max_h2=this.max_height/2},e.prototype._index_data=function(){return this._xy_index()},e.prototype._map_data=function(){return"data"===this.model.properties.width.units?this.sw=this.sdist(this.renderer.xmapper,this._x,this._width,"center"):this.sw=this._width,"data"===this.model.properties.height.units?this.sh=this.sdist(this.renderer.ymapper,this._y,this._height,"center"):this.sh=this._height},e.prototype._render=function(t,e,r){var n,o,i,s,a,l,u,c;for(u=r.sx,c=r.sy,l=r.sw,a=r.sh,s=[],o=0,i=e.length;o<i;o++)n=e[o],isNaN(u[n]+c[n]+l[n]+a[n]+this._angle[n])||(t.beginPath(),t.ellipse(u[n],c[n],l[n]/2,a[n]/2,this._angle[n],0,2*Math.PI),this.visuals.fill.doit&&(this.visuals.fill.set_vectorize(t,n),t.fill()),this.visuals.line.doit?(this.visuals.line.set_vectorize(t,n),s.push(t.stroke())):s.push(void 0));return s},e.prototype.draw_legend_for_index=function(t,e,r,n,o,i){var s,a,l,u,c,p,h,_;return l=[i],h={},h[i]=(e+r)/2,_={},_[i]=(n+o)/2,u=this.sw[i]/this.sh[i],s=.8*Math.min(Math.abs(r-e),Math.abs(o-n)),p={},c={},u>1?(p[i]=s,c[i]=s/u):(p[i]=s*u,c[i]=s),a={sx:h,sy:_,sw:p,sh:c},this._render(t,l,a)},e.prototype._bounds=function(t){return this.max_wh2_bounds(t)},e}(i.View),n=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return l(e,t),e.prototype.default_view=o,e.prototype.type="Ellipse",e.coords([["x","y"]]),e.mixins(["line","fill"]),e.define({angle:[a.AngleSpec,0],width:[a.DistanceSpec],height:[a.DistanceSpec]}),e}(i.Model),e.exports={Model:n,View:o}},{"../../core/properties":"core/properties","./glyph":"models/glyphs/glyph",underscore:"underscore"}],"models/glyphs/glyph":[function(t,e,r){var n,o,i,s,a,l,u,c,p,h,_,d,f,m=function(t,e){function r(){this.constructor=t}for(var n in e)g.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},g={}.hasOwnProperty;u=t("underscore"),f=t("rbush"),o=t("../mappers/categorical_mapper"),_=t("../../core/properties"),c=t("../../core/util/bbox"),d=t("../../core/util/projections"),n=t("../../core/bokeh_view"),a=t("../../model"),l=t("../../core/visuals").Visuals,p=t("./webgl/main"),h=t("../../core/logging").logger,s=function(t){function e(){return e.__super__.constructor.apply(this,arguments);
|
|
}return m(e,t),e.prototype.initialize=function(t){var r,n,o;if(e.__super__.initialize.call(this,t),this._nohit_warned={},this.renderer=t.renderer,this.visuals=new l(this.model),null!=(null!=(o=this.renderer)?o.plot_view:void 0)&&(n=this.renderer.plot_view.canvas_view.ctx,null!=n.glcanvas&&(r=p[this.model.type+"GLGlyph"])))return this.glglyph=new r(n.glcanvas.gl,this)},e.prototype.set_visuals=function(t){if(this.visuals.warm_cache(t),null!=this.glglyph)return this.glglyph.set_visuals_changed()},e.prototype.render=function(t,e,r){if(this.model.visible){if(t.beginPath(),null!=this.glglyph&&this.glglyph.render(t,e,r))return;this._render(t,e,r)}},e.prototype.bounds=function(){var t,e;return null==this.index?c.empty():(e=this.index.data,t={minX:e.minX,minY:e.minY,maxX:e.maxX,maxY:e.maxY},this._bounds(t))},e.prototype.max_wh2_bounds=function(t){return{minX:t.minX-this.max_w2,maxX:t.maxX+this.max_w2,minY:t.minY-this.max_h2,maxY:t.maxY+this.max_h2}},e.prototype.get_anchor_point=function(t,e,r){var n,o;switch(n=r[0],o=r[1],t){case"center":return{x:this.scx(e,n,o),y:this.scy(e,n,o)};default:return null}},e.prototype.scx=function(t){return this.sx[t]},e.prototype.scy=function(t){return this.sy[t]},e.prototype._xy_index=function(){var t,e,r,n,i,s,a,l,u;for(e=f(),n=[],a=this.renderer.xmapper instanceof o.Model?this.renderer.xmapper.v_map_to_target(this._x,!0):this._x,u=this.renderer.ymapper instanceof o.Model?this.renderer.ymapper.v_map_to_target(this._y,!0):this._y,t=r=0,i=a.length;0<=i?r<i:r>i;t=0<=i?++r:--r)s=a[t],!isNaN(s)&&isFinite(s)&&(l=u[t],!isNaN(l)&&isFinite(l)&&n.push({minX:s,minY:l,maxX:s,maxY:l,i:t}));return e.load(n),e},e.prototype.sdist=function(t,e,r,n,o){var i,s,a,l,c,p,h;return null==n&&(n="edge"),null==o&&(o=!1),u.isString(e[0])&&(e=t.v_map_to_target(e)),"center"===n?(s=function(){var t,e,n;for(n=[],t=0,e=r.length;t<e;t++)i=r[t],n.push(i/2);return n}(),l=function(){var t,r,n;for(n=[],a=t=0,r=e.length;0<=r?t<r:t>r;a=0<=r?++t:--t)n.push(e[a]-s[a]);return n}(),c=function(){var t,r,n;for(n=[],a=t=0,r=e.length;0<=r?t<r:t>r;a=0<=r?++t:--t)n.push(e[a]+s[a]);return n}()):(l=e,c=function(){var t,e,n;for(n=[],a=t=0,e=l.length;0<=e?t<e:t>e;a=0<=e?++t:--t)n.push(l[a]+r[a]);return n}()),p=t.v_map_to_target(l),h=t.v_map_to_target(c),o?function(){var t,e,r;for(r=[],a=t=0,e=p.length;0<=e?t<e:t>e;a=0<=e?++t:--t)r.push(Math.ceil(Math.abs(h[a]-p[a])));return r}():function(){var t,e,r;for(r=[],a=t=0,e=p.length;0<=e?t<e:t>e;a=0<=e?++t:--t)r.push(Math.abs(h[a]-p[a]));return r}()},e.prototype.draw_legend_for_index=function(t,e,r,n,o,i){return null},e.prototype._generic_line_legend=function(t,e,r,n,o,i){return t.save(),t.beginPath(),t.moveTo(e,(n+o)/2),t.lineTo(r,(n+o)/2),this.visuals.line.doit&&(this.visuals.line.set_vectorize(t,i),t.stroke()),t.restore()},e.prototype._generic_area_legend=function(t,e,r,n,o,i){var s,a,l,u,c,p,h,_,d;if(u=[i],d=Math.abs(r-e),a=.1*d,l=Math.abs(o-n),s=.1*l,c=e+a,p=r-a,h=n+s,_=o-s,this.visuals.fill.doit&&(this.visuals.fill.set_vectorize(t,i),t.fillRect(c,h,p-c,_-h)),this.visuals.line.doit)return t.beginPath(),t.rect(c,h,p-c,_-h),this.visuals.line.set_vectorize(t,i),t.stroke()},e.prototype.hit_test=function(t){var e,r;return r=null,e="_hit_"+t.type,null!=this[e]?r=this[e](t):null==this._nohit_warned[t.type]&&(h.debug("'"+t.type+"' selection not available for "+this.model.type),this._nohit_warned[t.type]=!0),r},e.prototype.set_data=function(t){var e,r,n;return e=this.model.materialize_dataspecs(t),u.extend(this,e),this.renderer.plot_view.model.use_map&&(null!=this._x&&(r=d.project_xy(this._x,this._y),this._x=r[0],this._y=r[1]),null!=this._xs&&(n=d.project_xsys(this._xs,this._ys),this._xs=n[0],this._ys=n[1])),null!=this.glglyph&&this.glglyph.set_data_changed(this._x.length),this._set_data(),this.index=this._index_data()},e.prototype._set_data=function(){},e.prototype._index_data=function(){},e.prototype.mask_data=function(t){return null!=this.glglyph?t:this._mask_data(t)},e.prototype._mask_data=function(t){return t},e.prototype._bounds=function(t){return t},e.prototype.map_data=function(){var t,e,r,n,o,i,s,a,l,c,p,h,_,d,f,m,g;for(o=this.model._coords,e=0,n=o.length;e<n;e++)if(i=o[e],m=i[0],g=i[1],_="s"+m,f="s"+g,m="_"+m,g="_"+g,u.isArray(null!=(s=this[m])?s[0]:void 0))for(a=[[],[]],this[_]=a[0],this[f]=a[1],t=r=0,l=this[m].length;0<=l?r<l:r>l;t=0<=l?++r:--r)c=this.map_to_screen(this[m][t],this[g][t]),h=c[0],d=c[1],this[_].push(h),this[f].push(d);else p=this.map_to_screen(this[m],this[g]),this[_]=p[0],this[f]=p[1];return this._map_data()},e.prototype._map_data=function(){},e.prototype.map_to_screen=function(t,e){return this.renderer.plot_view.map_to_screen(t,e,this.model.x_range_name,this.model.y_range_name)},e}(n),i=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return m(e,t),e.prototype._coords=[],e.coords=function(t){var e,r,n,o,i,s,a;for(e=this.prototype._coords.concat(t),this.prototype._coords=e,i={},r=0,n=t.length;r<n;r++)o=t[r],s=o[0],a=o[1],i[s]=[_.NumberSpec],i[a]=[_.NumberSpec];return this.define(i)},e.define({visible:[_.Bool,!0]}),e.internal({x_range_name:[_.String,"default"],y_range_name:[_.String,"default"]}),e}(a),e.exports={Model:i,View:s}},{"../../core/bokeh_view":"core/bokeh_view","../../core/logging":"core/logging","../../core/properties":"core/properties","../../core/util/bbox":"core/util/bbox","../../core/util/projections":"core/util/projections","../../core/visuals":"core/visuals","../../model":"model","../mappers/categorical_mapper":"models/mappers/categorical_mapper","./webgl/main":"models/glyphs/webgl/main",rbush:"rbush",underscore:"underscore"}],"models/glyphs/hbar":[function(t,e,r){var n,o,i,s,a,l,u,c,p,h=function(t,e){function r(){this.constructor=t}for(var n in e)_.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},_={}.hasOwnProperty;l=t("underscore"),p=t("rbush"),a=t("./quad"),o=t("./glyph"),n=t("../mappers/categorical_mapper"),u=t("../../core/hittest"),c=t("../../core/properties"),s=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return h(e,t),e.prototype._map_data=function(){var t,e,r,n,o,i;for(i=this.renderer.ymapper.v_map_to_target(this._y),this.sy=this.renderer.plot_view.canvas.v_vy_to_sy(i),o=this.renderer.xmapper.v_map_to_target(this._right),n=this.renderer.xmapper.v_map_to_target(this._left),this.sright=this.renderer.plot_view.canvas.v_vx_to_sx(o),this.sleft=this.renderer.plot_view.canvas.v_vx_to_sx(n),this.stop=[],this.sbottom=[],this.sh=this.sdist(this.renderer.ymapper,this._y,this._height,"center"),t=e=0,r=this.sy.length;0<=r?e<r:e>r;t=0<=r?++e:--e)this.stop.push(this.sy[t]-this.sh[t]/2),this.sbottom.push(this.sy[t]+this.sh[t]/2);return null},e.prototype._index_data=function(){var t,e,r,o,i,s,a,l,u,c,h,_,d,f;for(l=function(t,e){return t instanceof n.Model?t.v_map_to_target(e,!0):e},a=l(this.renderer.xmapper,this._left),_=l(this.renderer.xmapper,this._right),f=l(this.renderer.ymapper,this._y),e=l(this.renderer.ymapper,this._height),o=p(),u=[],r=i=0,h=f.length;0<=h?i<h:i>h;r=0<=h?++i:--i)s=a[r],c=_[r],d=f[r]+.5*e[r],t=f[r]-.5*e[r],!isNaN(s+c+d+t)&&isFinite(s+c+d+t)&&u.push({minX:s,minY:t,maxX:c,maxY:d,i:r});return o.load(u),o},e.prototype._render=function(t,e,r){var n,o,i,s,a,l,u,c;for(l=r.sleft,u=r.sright,c=r.stop,a=r.sbottom,s=[],o=0,i=e.length;o<i;o++)n=e[o],isNaN(l[n]+c[n]+u[n]+a[n])||(this.visuals.fill.doit&&(this.visuals.fill.set_vectorize(t,n),t.fillRect(l[n],c[n],u[n]-l[n],a[n]-c[n])),this.visuals.line.doit?(t.beginPath(),t.rect(l[n],c[n],u[n]-l[n],a[n]-c[n]),this.visuals.line.set_vectorize(t,n),s.push(t.stroke())):s.push(void 0));return s},e.prototype._hit_point=function(t){var e,r,n,o,i,s,a;return r=[t.vx,t.vy],o=r[0],i=r[1],s=this.renderer.xmapper.map_from_target(o,!0),a=this.renderer.ymapper.map_from_target(i,!0),e=function(){var t,e,r,n;for(r=this.index.search({minX:s,minY:a,maxX:s,maxY:a}),n=[],t=0,e=r.length;t<e;t++)s=r[t],n.push(s.i);return n}.call(this),n=u.create_hit_test_result(),n["1d"].indices=e,n},e.prototype.scx=function(t){return(this.sleft[t]+this.sright[t])/2},e.prototype.draw_legend_for_index=function(t,e,r,n,o,i){return this._generic_area_legend(t,e,r,n,o,i)},e}(o.View),i=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return h(e,t),e.prototype.default_view=s,e.prototype.type="HBar",e.mixins(["line","fill"]),e.define({y:[c.NumberSpec],height:[c.DistanceSpec],left:[c.NumberSpec,0],right:[c.NumberSpec]}),e}(o.Model),e.exports={Model:i,View:s}},{"../../core/hittest":"core/hittest","../../core/properties":"core/properties","../mappers/categorical_mapper":"models/mappers/categorical_mapper","./glyph":"models/glyphs/glyph","./quad":"models/glyphs/quad",rbush:"rbush",underscore:"underscore"}],"models/glyphs/image":[function(t,e,r){var n,o,i,s,a,l,u,c=function(t,e){function r(){this.constructor=t}for(var n in e)p.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},p={}.hasOwnProperty;l=t("underscore"),n=t("../glyphs/glyph"),a=t("../mappers/linear_color_mapper"),u=t("../../core/properties"),s=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return c(e,t),e.prototype.initialize=function(t){return e.__super__.initialize.call(this,t),this.listenTo(this.model.color_mapper,"change",this._update_image)},e.prototype._update_image=function(){if(null!=this.image_data)return this._set_data(),this.renderer.plot_view.request_render()},e.prototype._index_data=function(){return this._xy_index()},e.prototype._set_data=function(){var t,e,r,n,o,i,s,a,u,c,p;for(null!=this.image_data&&this.image_data.length===this._image.length||(this.image_data=new Array(this._image.length)),null!=this._width&&this._width.length===this._image.length||(this._width=new Array(this._image.length)),null!=this._height&&this._height.length===this._image.length||(this._height=new Array(this._image.length)),p=[],i=u=0,c=this._image.length;0<=c?u<c:u>c;i=0<=c?++u:--u)null!=this._rows?(this._height[i]=this._rows[i],this._width[i]=this._cols[i]):(this._height[i]=this._image[i].length,this._width[i]=this._image[i][0].length),r=document.createElement("canvas"),r.width=this._width[i],r.height=this._height[i],o=r.getContext("2d"),s=o.getImageData(0,0,this._width[i],this._height[i]),n=this.model.color_mapper,a=null!=this._rows?this._image[i]:l.flatten(this._image[i]),t=n.v_map_screen(a),e=new Uint8ClampedArray(t),s.data.set(e),o.putImageData(s,0,0),this.image_data[i]=r,this.max_dw=0,"data"===this._dw.units&&(this.max_dw=l.max(this._dw)),this.max_dh=0,"data"===this._dh.units&&(this.max_dh=l.max(this._dh)),p.push(this._xy_index());return p},e.prototype._map_data=function(){switch(this.model.properties.dw.units){case"data":this.sw=this.sdist(this.renderer.xmapper,this._x,this._dw,"edge",this.model.dilate);break;case"screen":this.sw=this._dw}switch(this.model.properties.dh.units){case"data":return this.sh=this.sdist(this.renderer.ymapper,this._y,this._dh,"edge",this.model.dilate);case"screen":return this.sh=this._dh}},e.prototype._render=function(t,e,r){var n,o,i,s,a,l,u,c,p,h;for(o=r.image_data,c=r.sx,p=r.sy,u=r.sw,l=r.sh,a=t.getImageSmoothingEnabled(),t.setImageSmoothingEnabled(!1),i=0,s=e.length;i<s;i++)n=e[i],null!=o[n]&&(isNaN(c[n]+p[n]+u[n]+l[n])||(h=p[n],t.translate(0,h),t.scale(1,-1),t.translate(0,-h),t.drawImage(o[n],0|c[n],0|p[n],u[n],l[n]),t.translate(0,h),t.scale(1,-1),t.translate(0,-h)));return t.setImageSmoothingEnabled(a)},e.prototype.bounds=function(){var t;return t=this.index.data,{minX:t.minX,minY:t.minY,maxX:t.maxX+this.max_dw,maxY:t.maxY+this.max_dh}},e}(n.View),o=function(){return[0,2434341,5395026,7566195,9868950,12434877,14277081,15790320,16777215]},i=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return c(e,t),e.prototype.default_view=s,e.prototype.type="Image",e.coords([["x","y"]]),e.mixins([]),e.define({image:[u.NumberSpec],dw:[u.DistanceSpec],dh:[u.DistanceSpec],dilate:[u.Bool,!1],color_mapper:[u.Instance,function(){return new a.Model({palette:o()})}]}),e}(n.Model),e.exports={Model:i,View:s}},{"../../core/properties":"core/properties","../glyphs/glyph":"models/glyphs/glyph","../mappers/linear_color_mapper":"models/mappers/linear_color_mapper",underscore:"underscore"}],"models/glyphs/image_rgba":[function(t,e,r){var n,o,i,s,a,l=function(t,e){function r(){this.constructor=t}for(var n in e)u.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},u={}.hasOwnProperty;s=t("underscore"),n=t("./glyph"),a=t("../../core/properties"),i=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return l(e,t),e.prototype._index_data=function(){return this._xy_index()},e.prototype._set_data=function(t,e){var r,n,o,i,a,l,u,c,p,h,_,d,f,m;for(null!=this.image_data&&this.image_data.length===this._image.length||(this.image_data=new Array(this._image.length)),null!=this._width&&this._width.length===this._image.length||(this._width=new Array(this._image.length)),null!=this._height&&this._height.length===this._image.length||(this._height=new Array(this._image.length)),m=[],u=h=0,d=this._image.length;0<=d?h<d:h>d;u=0<=d?++h:--h)if(null==e||u===e){if(null!=this._rows?(this._height[u]=this._rows[u],this._width[u]=this._cols[u]):(this._height[u]=this._image[u].length,this._width[u]=this._image[u][0].length),o=document.createElement("canvas"),o.width=this._width[u],o.height=this._height[u],a=o.getContext("2d"),c=a.getImageData(0,0,this._width[u],this._height[u]),null!=this._rows)c.data.set(new Uint8ClampedArray(this._image[u]));else{for(l=s.flatten(this._image[u]),r=new ArrayBuffer(4*l.length),i=new Uint32Array(r),p=_=0,f=l.length;0<=f?_<f:_>f;p=0<=f?++_:--_)i[p]=l[p];n=new Uint8ClampedArray(r),c.data.set(n)}a.putImageData(c,0,0),this.image_data[u]=o,this.max_dw=0,"data"===this._dw.units&&(this.max_dw=s.max(this._dw)),this.max_dh=0,"data"===this._dh.units?m.push(this.max_dh=s.max(this._dh)):m.push(void 0)}return m},e.prototype._map_data=function(){switch(this.model.properties.dw.units){case"data":this.sw=this.sdist(this.renderer.xmapper,this._x,this._dw,"edge",this.model.dilate);break;case"screen":this.sw=this._dw}switch(this.model.properties.dh.units){case"data":return this.sh=this.sdist(this.renderer.ymapper,this._y,this._dh,"edge",this.model.dilate);case"screen":return this.sh=this._dh}},e.prototype._render=function(t,e,r){var n,o,i,s,a,l,u,c,p,h;for(o=r.image_data,c=r.sx,p=r.sy,u=r.sw,l=r.sh,a=t.getImageSmoothingEnabled(),t.setImageSmoothingEnabled(!1),i=0,s=e.length;i<s;i++)n=e[i],isNaN(c[n]+p[n]+u[n]+l[n])||(h=p[n],t.translate(0,h),t.scale(1,-1),t.translate(0,-h),t.drawImage(o[n],0|c[n],0|p[n],u[n],l[n]),t.translate(0,h),t.scale(1,-1),t.translate(0,-h));return t.setImageSmoothingEnabled(a)},e.prototype.bounds=function(){var t;return t=this.index.data,{minX:t.minX,minY:t.minY,maxX:t.maxX+this.max_dw,maxY:t.maxY+this.max_dh}},e}(n.View),o=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return l(e,t),e.prototype.default_view=i,e.prototype.type="ImageRGBA",e.coords([["x","y"]]),e.mixins([]),e.define({image:[a.NumberSpec],rows:[a.NumberSpec],cols:[a.NumberSpec],dw:[a.DistanceSpec],dh:[a.DistanceSpec],dilate:[a.Bool,!1]}),e.prototype.initialize=function(t,r){return e.__super__.initialize.call(this,t,r),this.properties.rows.optional=!0,this.properties.cols.optional=!0},e}(n.Model),e.exports={Model:o,View:i}},{"../../core/properties":"core/properties","./glyph":"models/glyphs/glyph",underscore:"underscore"}],"models/glyphs/image_url":[function(t,e,r){var n,o,i,s,a,l,u=function(t,e){function r(){this.constructor=t}for(var n in e)c.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},c={}.hasOwnProperty;s=t("underscore"),n=t("./glyph"),a=t("../../core/logging").logger,l=t("../../core/properties"),i=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return u(e,t),e.prototype.initialize=function(t){return e.__super__.initialize.call(this,t),this.listenTo(this.model,"change:global_alpha",this.renderer.request_render)},e.prototype._index_data=function(){},e.prototype._set_data=function(){var t,e,r,n,o,i,s;for(null!=this.image&&this.image.length===this._url.length||(this.image=function(){var t,r,n,o;for(n=this._url,o=[],t=0,r=n.length;t<r;t++)e=n[t],o.push(null);return o}.call(this)),i=this.model.retry_attempts,s=this.model.retry_timeout,this.retries=function(){var t,r,n,o;for(n=this._url,o=[],t=0,r=n.length;t<r;t++)e=n[t],o.push(i);return o}.call(this),o=[],t=r=0,n=this._url.length;0<=n?r<n:r>n;t=0<=n?++r:--r)null!=this._url[t]&&(e=new Image,e.onerror=function(t){return function(e,r){return function(){return t.retries[e]>0?(a.trace("ImageURL failed to load "+t._url[e]+" image, retrying in "+s+" ms"),setTimeout(function(){return r.src=t._url[e]},s)):a.warn("ImageURL unable to load "+t._url[e]+" image after "+i+" retries"),t.retries[e]-=1}}}(this)(t,e),e.onload=function(t){return function(e,r){return function(){return t.image[r]=e,t.renderer.request_render()}}}(this)(e,t),o.push(e.src=this._url[t]));return o},e.prototype._map_data=function(){var t,e,r;switch(e=function(){var t,e,n,o;if(null!=this._w)return this._w;for(n=this._x,o=[],t=0,e=n.length;t<e;t++)r=n[t],o.push(NaN);return o}.call(this),t=function(){var t,e,n,o;if(null!=this._h)return this._h;for(n=this._x,o=[],t=0,e=n.length;t<e;t++)r=n[t],o.push(NaN);return o}.call(this),this.model.properties.w.units){case"data":this.sw=this.sdist(this.renderer.xmapper,this._x,e,"edge",this.model.dilate);break;case"screen":this.sw=e}switch(this.model.properties.h.units){case"data":return this.sh=this.sdist(this.renderer.ymapper,this._y,t,"edge",this.model.dilate);case"screen":return this.sh=t}},e.prototype._render=function(t,e,r){var n,o,i,s,a,l,u,c,p,h,_,d;for(o=r._url,a=r.image,_=r.sx,d=r.sy,h=r.sw,p=r.sh,n=r._angle,i=this.renderer.plot_view.frame,t.rect(i.left+1,i.bottom+1,i.width-2,i.height-2),t.clip(),c=[],l=0,u=e.length;l<u;l++)s=e[l],isNaN(_[s]+d[s]+n[s])||this.retries[s]!==-1&&null!=a[s]&&c.push(this._render_image(t,s,a[s],_,d,h,p,n));return c},e.prototype._final_sx_sy=function(t,e,r,n,o){switch(t){case"top_left":return[e,r];case"top_center":return[e-n/2,r];case"top_right":return[e-n,r];case"right_center":return[e-n,r-o/2];case"bottom_right":return[e-n,r-o];case"bottom_center":return[e-n/2,r-o];case"bottom_left":return[e,r-o];case"left_center":return[e,r-o/2];case"center":return[e-n/2,r-o/2]}},e.prototype._render_image=function(t,e,r,n,o,i,s,a){var l,u;return isNaN(i[e])&&(i[e]=r.width),isNaN(s[e])&&(s[e]=r.height),l=this.model.anchor,u=this._final_sx_sy(l,n[e],o[e],i[e],s[e]),n=u[0],o=u[1],t.save(),t.globalAlpha=this.model.global_alpha,a[e]?(t.translate(n,o),t.rotate(a[e]),t.drawImage(r,0,0,i[e],s[e]),t.rotate(-a[e]),t.translate(-n,-o)):t.drawImage(r,n,o,i[e],s[e]),t.restore()},e}(n.View),o=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return u(e,t),e.prototype.default_view=i,e.prototype.type="ImageURL",e.coords([["x","y"]]),e.mixins([]),e.define({url:[l.StringSpec],anchor:[l.Anchor,"top_left"],global_alpha:[l.Number,1],angle:[l.AngleSpec,0],w:[l.DistanceSpec],h:[l.DistanceSpec],dilate:[l.Bool,!1],retry_attempts:[l.Number,0],retry_timeout:[l.Number,0]}),e}(n.Model),e.exports={Model:o,View:i}},{"../../core/logging":"core/logging","../../core/properties":"core/properties","./glyph":"models/glyphs/glyph",underscore:"underscore"}],"models/glyphs/line":[function(t,e,r){var n,o,i,s,a,l=function(t,e){function r(){this.constructor=t}for(var n in e)u.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},u={}.hasOwnProperty;s=t("underscore"),n=t("./glyph"),a=t("../../core/hittest"),i=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return l(e,t),e.prototype._index_data=function(){return this._xy_index()},e.prototype._render=function(t,e,r){var n,o,i,s,a,l;for(a=r.sx,l=r.sy,n=!1,this.visuals.line.set_value(t),i=0,s=e.length;i<s;i++)o=e[i],isFinite(a[o]+l[o])||!n?n?t.lineTo(a[o],l[o]):(t.beginPath(),t.moveTo(a[o],l[o]),n=!0):(t.stroke(),t.beginPath(),n=!1);if(n)return t.stroke()},e.prototype._hit_point=function(t){var e,r,n,o,i,s,l,u,c,p,h;for(c=a.create_hit_test_result(),s={x:this.renderer.plot_view.canvas.vx_to_sx(t.vx),y:this.renderer.plot_view.canvas.vy_to_sy(t.vy)},p=9999,h=Math.max(2,this.visuals.line.line_width.value()/2),r=n=0,l=this.sx.length-1;0<=l?n<l:n>l;r=0<=l?++n:--n)u=[{x:this.sx[r],y:this.sy[r]},{x:this.sx[r+1],y:this.sy[r+1]}],o=u[0],i=u[1],e=a.dist_to_segment(s,o,i),e<h&&e<p&&(p=e,c["0d"].glyph=this.model,c["0d"].get_view=function(){return this}.bind(this),c["0d"].flag=!0,c["0d"].indices=[r]);return c},e.prototype._hit_span=function(t){var e,r,n,o,i,s,l,u,c;for(n=[t.vx,t.vy],u=n[0],c=n[1],i=a.create_hit_test_result(),"v"===t.direction?(s=this.renderer.ymapper.map_from_target(c),l=this._y):(s=this.renderer.xmapper.map_from_target(u),l=this._x),e=r=0,o=l.length-1;0<=o?r<o:r>o;e=0<=o?++r:--r)l[e]<=s&&s<=l[e+1]&&(i["0d"].glyph=this.model,i["0d"].get_view=function(){return this}.bind(this),i["0d"].flag=!0,i["0d"].indices.push(e));return i},e.prototype.get_interpolation_hit=function(t,e){var r,n,o,i,s,l,u,c,p,h,_,d,f,m,g,y,v,b,x;return r=[e.vx,e.vy],h=r[0],_=r[1],n=[this._x[t],this._y[t],this._x[t+1],this._y[t+1]],m=n[0],b=n[1],g=n[2],x=n[3],"point"===e.type?(o=this.renderer.ymapper.v_map_from_target([_-1,_+1]),y=o[0],v=o[1],i=this.renderer.xmapper.v_map_from_target([h-1,h+1]),d=i[0],f=i[1]):"v"===e.direction?(s=this.renderer.ymapper.v_map_from_target([_,_]),y=s[0],v=s[1],l=[m,g],d=l[0],f=l[1]):(u=this.renderer.xmapper.v_map_from_target([h,h]),d=u[0],f=u[1],c=[b,x],y=c[0],v=c[1]),p=a.check_2_segments_intersect(d,y,f,v,m,b,g,x),[p.x,p.y]},e.prototype.draw_legend_for_index=function(t,e,r,n,o,i){return this._generic_line_legend(t,e,r,n,o,i)},e}(n.View),o=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return l(e,t),e.prototype.default_view=i,e.prototype.type="Line",e.coords([["x","y"]]),e.mixins(["line"]),e}(n.Model),e.exports={Model:o,View:i}},{"../../core/hittest":"core/hittest","./glyph":"models/glyphs/glyph",underscore:"underscore"}],"models/glyphs/multi_line":[function(t,e,r){var n,o,i,s,a,l,u=function(t,e){function r(){this.constructor=t}for(var n in e)c.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},c={}.hasOwnProperty;s=t("underscore"),l=t("rbush"),a=t("../../core/hittest"),n=t("./glyph"),i=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return u(e,t),e.prototype._index_data=function(){var t,e,r,n,o,i,a,u,c;for(e=l(),n=[],t=r=0,o=this._xs.length;0<=o?r<o:r>o;t=0<=o?++r:--r)a=function(){var e,r,n,o;for(n=this._xs[t],o=[],e=0,r=n.length;e<r;e++)i=n[e],s.isNaN(i)||o.push(i);return o}.call(this),c=function(){var e,r,n,o;for(n=this._ys[t],o=[],e=0,r=n.length;e<r;e++)u=n[e],s.isNaN(u)||o.push(u);return o}.call(this),0!==a.length&&n.push({minX:s.min(a),minY:s.min(c),maxX:s.max(a),maxY:s.max(c),i:t});return e.load(n),e},e.prototype._render=function(t,e,r){var n,o,i,s,a,l,u,c,p,h,_,d;for(h=r.sxs,d=r.sys,c=[],i=0,a=e.length;i<a;i++){for(n=e[i],l=[h[n],d[n]],p=l[0],_=l[1],this.visuals.line.set_vectorize(t,n),o=s=0,u=p.length;0<=u?s<u:s>u;o=0<=u?++s:--s)0!==o?isNaN(p[o])||isNaN(_[o])?(t.stroke(),t.beginPath()):t.lineTo(p[o],_[o]):(t.beginPath(),t.moveTo(p[o],_[o]));c.push(t.stroke())}return c},e.prototype._hit_point=function(t){var e,r,n,o,i,l,u,c,p,h,_,d,f,m,g,y;for(m=a.create_hit_test_result(),p={x:this.renderer.plot_view.canvas.vx_to_sx(t.vx),y:this.renderer.plot_view.canvas.vy_to_sy(t.vy)},g=9999,y=Math.max(2,this.visuals.line.line_width.value()/2),r={},n=i=0,_=this.sxs.length;0<=_?i<_:i>_;n=0<=_?++i:--i){for(h=null,o=l=0,d=this.sxs[n].length-1;0<=d?l<d:l>d;o=0<=d?++l:--l)f=[{x:this.sxs[n][o],y:this.sys[n][o]},{x:this.sxs[n][o+1],y:this.sys[n][o+1]}],u=f[0],c=f[1],e=a.dist_to_segment(p,u,c),e<y&&e<g&&(g=e,h=[o]);h&&(r[n]=h)}return m["1d"].indices=s.keys(r),m["2d"]=r,m},e.prototype._hit_span=function(t){var e,r,n,o,i,l,u,c,p,h,_,d,f,m;for(u=[t.vx,t.vy],f=u[0],m=u[1],h=a.create_hit_test_result(),"v"===t.direction?(_=this.renderer.ymapper.map_from_target(m),d=this._ys):(_=this.renderer.xmapper.map_from_target(f),d=this._xs),e={},r=o=0,c=d.length;0<=c?o<c:o>c;r=0<=c?++o:--o){for(l=[],n=i=0,p=d[r].length-1;0<=p?i<p:i>p;n=0<=p?++i:--i)d[r][n]<=_&&_<=d[r][n+1]&&l.push(n);l.length>0&&(e[r]=l)}return h["1d"].indices=s.keys(e),h["2d"]=e,h},e.prototype.get_interpolation_hit=function(t,e,r){var n,o,i,s,l,u,c,p,h,_,d,f,m,g,y,v,b,x,w;return n=[r.vx,r.vy],_=n[0],d=n[1],o=[this._xs[t][e],this._ys[t][e],this._xs[t][e+1],this._ys[t][e+1]],g=o[0],x=o[1],y=o[2],w=o[3],"point"===r.type?(i=this.renderer.ymapper.v_map_from_target([d-1,d+1]),v=i[0],b=i[1],s=this.renderer.xmapper.v_map_from_target([_-1,_+1]),f=s[0],m=s[1]):"v"===r.direction?(l=this.renderer.ymapper.v_map_from_target([d,d]),v=l[0],b=l[1],u=[g,y],f=u[0],m=u[1]):(c=this.renderer.xmapper.v_map_from_target([_,_]),f=c[0],m=c[1],p=[x,w],v=p[0],b=p[1]),h=a.check_2_segments_intersect(f,v,m,b,g,x,y,w),[h.x,h.y]},e.prototype.draw_legend_for_index=function(t,e,r,n,o,i){return this._generic_line_legend(t,e,r,n,o,i)},e}(n.View),o=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return u(e,t),e.prototype.default_view=i,e.prototype.type="MultiLine",e.coords([["xs","ys"]]),e.mixins(["line"]),e}(n.Model),e.exports={Model:o,View:i}},{"../../core/hittest":"core/hittest","./glyph":"models/glyphs/glyph",rbush:"rbush",underscore:"underscore"}],"models/glyphs/oval":[function(t,e,r){var n,o,i,s,a,l=function(t,e){function r(){this.constructor=t}for(var n in e)u.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},u={}.hasOwnProperty;s=t("underscore"),n=t("./glyph"),a=t("../../core/properties"),i=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return l(e,t),e.prototype._set_data=function(){if(this.max_w2=0,"data"===this.model.properties.width.units&&(this.max_w2=this.max_width/2),this.max_h2=0,"data"===this.model.properties.height.units)return this.max_h2=this.max_height/2},e.prototype._index_data=function(){return this._xy_index()},e.prototype._map_data=function(){return"data"===this.model.properties.width.units?this.sw=this.sdist(this.renderer.xmapper,this._x,this._width,"center"):this.sw=this._width,"data"===this.model.properties.height.units?this.sh=this.sdist(this.renderer.ymapper,this._y,this._height,"center"):this.sh=this._height},e.prototype._render=function(t,e,r){var n,o,i,s,a,l,u,c;for(u=r.sx,c=r.sy,l=r.sw,a=r.sh,s=[],o=0,i=e.length;o<i;o++)n=e[o],isNaN(u[n]+c[n]+l[n]+a[n]+this._angle[n])||(t.translate(u[n],c[n]),t.rotate(this._angle[n]),t.beginPath(),t.moveTo(0,-a[n]/2),t.bezierCurveTo(l[n]/2,-a[n]/2,l[n]/2,a[n]/2,0,a[n]/2),t.bezierCurveTo(-l[n]/2,a[n]/2,-l[n]/2,-a[n]/2,0,-a[n]/2),t.closePath(),this.visuals.fill.doit&&(this.visuals.fill.set_vectorize(t,n),t.fill()),this.visuals.line.doit&&(this.visuals.line.set_vectorize(t,n),t.stroke()),t.rotate(-this._angle[n]),s.push(t.translate(-u[n],-c[n])));return s},e.prototype.draw_legend_for_index=function(t,e,r,n,o,i){var s,a,l,u,c,p,h,_;return l=[i],h={},h[i]=(e+r)/2,_={},_[i]=(n+o)/2,u=this.sw[i]/this.sh[i],s=.8*Math.min(Math.abs(r-e),Math.abs(o-n)),p={},c={},u>1?(p[i]=s,c[i]=s/u):(p[i]=s*u,c[i]=s),a={sx:h,sy:_,sw:p,sh:c},this._render(t,l,a)},e.prototype._bounds=function(t){return this.max_wh2_bounds(t)},e}(n.View),o=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return l(e,t),e.prototype.default_view=i,e.prototype.type="Oval",e.coords([["x","y"]]),e.mixins(["line","fill"]),e.define({angle:[a.AngleSpec,0],width:[a.DistanceSpec],height:[a.DistanceSpec]}),e}(n.Model),e.exports={Model:o,View:i}},{"../../core/properties":"core/properties","./glyph":"models/glyphs/glyph",underscore:"underscore"}],"models/glyphs/patch":[function(t,e,r){var n,o,i,s,a=function(t,e){function r(){this.constructor=t}for(var n in e)l.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},l={}.hasOwnProperty;s=t("underscore"),n=t("./glyph"),i=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return a(e,t),e.prototype._index_data=function(){return this._xy_index()},e.prototype._render=function(t,e,r){var n,o,i,s,a,l,u;if(l=r.sx,u=r.sy,this.visuals.fill.doit){for(this.visuals.fill.set_value(t),o=0,s=e.length;o<s;o++)n=e[o],0!==n?isNaN(l[n]+u[n])?(t.closePath(),t.fill(),t.beginPath()):t.lineTo(l[n],u[n]):(t.beginPath(),t.moveTo(l[n],u[n]));t.closePath(),t.fill()}if(this.visuals.line.doit){for(this.visuals.line.set_value(t),i=0,a=e.length;i<a;i++)n=e[i],0!==n?isNaN(l[n]+u[n])?(t.closePath(),t.stroke(),t.beginPath()):t.lineTo(l[n],u[n]):(t.beginPath(),t.moveTo(l[n],u[n]));return t.closePath(),t.stroke()}},e.prototype.draw_legend_for_index=function(t,e,r,n,o,i){return this._generic_area_legend(t,e,r,n,o,i)},e}(n.View),o=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return a(e,t),e.prototype.default_view=i,e.prototype.type="Patch",e.coords([["x","y"]]),e.mixins(["line","fill"]),e}(n.Model),e.exports={Model:o,View:i}},{"./glyph":"models/glyphs/glyph",underscore:"underscore"}],"models/glyphs/patches":[function(t,e,r){var n,o,i,s,a,l,u=function(t,e){function r(){this.constructor=t}for(var n in e)c.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},c={}.hasOwnProperty;s=t("underscore"),l=t("rbush"),n=t("./glyph"),a=t("../../core/hittest"),i=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return u(e,t),e.prototype._build_discontinuous_object=function(t){var e,r,n,o,i,a,l,u,c;for(r={},n=o=0,c=t.length;0<=c?o<c:o>c;n=0<=c?++o:--o)for(r[n]=[],l=s.toArray(t[n]);l.length>0;)i=s.findLastIndex(l,function(t){return s.isNaN(t)}),i>=0?u=l.splice(i):(u=l,l=[]),e=function(){var t,e,r;for(r=[],t=0,e=u.length;t<e;t++)a=u[t],s.isNaN(a)||r.push(a);return r}(),r[n].push(e);return r},e.prototype._index_data=function(){var t,e,r,n,o,i,a,u,c,p,h,_;for(e=l(),i=[],p=this._build_discontinuous_object(this._xs),_=this._build_discontinuous_object(this._ys),t=n=0,a=this._xs.length;0<=a?n<a:n>a;t=0<=a?++n:--n)for(r=o=0,u=p[t].length;0<=u?o<u:o>u;r=0<=u?++o:--o)c=p[t][r],h=_[t][r],0!==c.length&&i.push({minX:s.min(c),minY:s.min(h),maxX:s.max(c),maxY:s.max(h),i:t});return e.load(i),e},e.prototype._mask_data=function(t){var e,r,n,o,i,s,l,u,c,p;return l=this.renderer.plot_view.x_range,r=[l.min,l.max],i=r[0],s=r[1],p=this.renderer.plot_view.y_range,n=[p.min,p.max],u=n[0],c=n[1],e=a.validate_bbox_coords([i,s],[u,c]),function(){var t,r,n,i;for(n=this.index.search(e),i=[],t=0,r=n.length;t<r;t++)o=n[t],i.push(o.i);return i}.call(this)},e.prototype._render=function(t,e,r){var n,o,i,s,a,l,u,c,p,h,_,d,f,m;for(d=r.sxs,m=r.sys,this.renderer.sxss=this._build_discontinuous_object(d),this.renderer.syss=this._build_discontinuous_object(m),h=[],i=0,a=e.length;i<a;i++){if(n=e[i],u=[d[n],m[n]],_=u[0],f=u[1],this.visuals.fill.doit){for(this.visuals.fill.set_vectorize(t,n),o=s=0,c=_.length;0<=c?s<c:s>c;o=0<=c?++s:--s)0!==o?isNaN(_[o]+f[o])?(t.closePath(),t.fill(),t.beginPath()):t.lineTo(_[o],f[o]):(t.beginPath(),t.moveTo(_[o],f[o]));t.closePath(),t.fill()}if(this.visuals.line.doit){for(this.visuals.line.set_vectorize(t,n),o=l=0,p=_.length;0<=p?l<p:l>p;o=0<=p?++l:--l)0!==o?isNaN(_[o]+f[o])?(t.closePath(),t.stroke(),t.beginPath()):t.lineTo(_[o],f[o]):(t.beginPath(),t.moveTo(_[o],f[o]));t.closePath(),h.push(t.stroke())}else h.push(void 0)}return h},e.prototype._hit_point=function(t){var e,r,n,o,i,s,l,u,c,p,h,_,d,f,m,g,y,v,b;for(u=[t.vx,t.vy],g=u[0],y=u[1],_=this.renderer.plot_view.canvas.vx_to_sx(g),f=this.renderer.plot_view.canvas.vy_to_sy(y),v=this.renderer.xmapper.map_from_target(g,!0),b=this.renderer.ymapper.map_from_target(y,!0),
|
|
e=function(){var t,e,r,n;for(r=this.index.search({minX:v,minY:b,maxX:v,maxY:b}),n=[],t=0,e=r.length;t<e;t++)v=r[t],n.push(v.i);return n}.call(this),r=[],n=s=0,c=e.length;0<=c?s<c:s>c;n=0<=c?++s:--s)for(o=e[n],d=this.renderer.sxss[o],m=this.renderer.syss[o],i=l=0,p=d.length;0<=p?l<p:l>p;i=0<=p?++l:--l)a.point_in_poly(_,f,d[i],m[i])&&r.push(o);return h=a.create_hit_test_result(),h["1d"].indices=r,h},e.prototype._get_snap_coord=function(t){var e,r,n,o;for(o=0,e=0,r=t.length;e<r;e++)n=t[e],o+=n;return o/t.length},e.prototype.scx=function(t,e,r){var n,o,i,s,l;if(1===this.renderer.sxss[t].length)return this._get_snap_coord(this.sxs[t]);for(s=this.renderer.sxss[t],l=this.renderer.syss[t],n=o=0,i=s.length;0<=i?o<i:o>i;n=0<=i?++o:--o)if(a.point_in_poly(e,r,s[n],l[n]))return this._get_snap_coord(s[n]);return null},e.prototype.scy=function(t,e,r){var n,o,i,s,l;if(1===this.renderer.syss[t].length)return this._get_snap_coord(this.sys[t]);for(s=this.renderer.sxss[t],l=this.renderer.syss[t],n=o=0,i=s.length;0<=i?o<i:o>i;n=0<=i?++o:--o)if(a.point_in_poly(e,r,s[n],l[n]))return this._get_snap_coord(l[n])},e.prototype.draw_legend_for_index=function(t,e,r,n,o,i){return this._generic_area_legend(t,e,r,n,o,i)},e}(n.View),o=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return u(e,t),e.prototype.default_view=i,e.prototype.type="Patches",e.coords([["xs","ys"]]),e.mixins(["line","fill"]),e}(n.Model),e.exports={Model:o,View:i}},{"../../core/hittest":"core/hittest","./glyph":"models/glyphs/glyph",rbush:"rbush",underscore:"underscore"}],"models/glyphs/quad":[function(t,e,r){var n,o,i,s,a,l,u,c=function(t,e){function r(){this.constructor=t}for(var n in e)p.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},p={}.hasOwnProperty;a=t("underscore"),u=t("rbush"),o=t("./glyph"),n=t("../mappers/categorical_mapper"),l=t("../../core/hittest"),s=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return c(e,t),e.prototype._index_data=function(){var t,e,r,o,i,s,a,l,c,p,h,_,d,f;for(l=function(t,e){return t instanceof n.Model?t.v_map_to_target(e,!0):e},a=l(this.renderer.xmapper,this._left),_=l(this.renderer.xmapper,this._right),f=l(this.renderer.ymapper,this._top),e=l(this.renderer.ymapper,this._bottom),o=u(),c=[],r=i=0,h=a.length;0<=h?i<h:i>h;r=0<=h?++i:--i)s=a[r],p=_[r],d=f[r],t=e[r],!isNaN(s+p+d+t)&&isFinite(s+p+d+t)&&c.push({minX:s,minY:t,maxX:p,maxY:d,i:r});return o.load(c),o},e.prototype._render=function(t,e,r){var n,o,i,s,a,l,u,c;for(l=r.sleft,u=r.sright,c=r.stop,a=r.sbottom,s=[],o=0,i=e.length;o<i;o++)n=e[o],isNaN(l[n]+c[n]+u[n]+a[n])||(this.visuals.fill.doit&&(this.visuals.fill.set_vectorize(t,n),t.fillRect(l[n],c[n],u[n]-l[n],a[n]-c[n])),this.visuals.line.doit?(t.beginPath(),t.rect(l[n],c[n],u[n]-l[n],a[n]-c[n]),this.visuals.line.set_vectorize(t,n),s.push(t.stroke())):s.push(void 0));return s},e.prototype._hit_point=function(t){var e,r,n,o,i,s,a;return r=[t.vx,t.vy],o=r[0],i=r[1],s=this.renderer.xmapper.map_from_target(o,!0),a=this.renderer.ymapper.map_from_target(i,!0),e=function(){var t,e,r,n;for(r=this.index.search({minX:s,minY:a,maxX:s,maxY:a}),n=[],t=0,e=r.length;t<e;t++)s=r[t],n.push(s.i);return n}.call(this),n=l.create_hit_test_result(),n["1d"].indices=e,n},e.prototype.get_anchor_point=function(t,e,r){var n,o,i,s;switch(o=Math.min(this.sleft[e],this.sright[e]),i=Math.max(this.sright[e],this.sleft[e]),s=Math.min(this.stop[e],this.sbottom[e]),n=Math.max(this.sbottom[e],this.stop[e]),t){case"top_left":return{x:o,y:s};case"top_center":return{x:(o+i)/2,y:s};case"top_right":return{x:i,y:s};case"right_center":return{x:i,y:(s+n)/2};case"bottom_right":return{x:i,y:n};case"bottom_center":return{x:(o+i)/2,y:n};case"bottom_left":return{x:o,y:n};case"left_center":return{x:o,y:(s+n)/2};case"center":return{x:(o+i)/2,y:(s+n)/2}}},e.prototype.scx=function(t){return(this.sleft[t]+this.sright[t])/2},e.prototype.scy=function(t){return(this.stop[t]+this.sbottom[t])/2},e.prototype.draw_legend_for_index=function(t,e,r,n,o,i){return this._generic_area_legend(t,e,r,n,o,i)},e}(o.View),i=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return c(e,t),e.prototype.default_view=s,e.prototype.type="Quad",e.coords([["right","bottom"],["left","top"]]),e.mixins(["line","fill"]),e}(o.Model),e.exports={Model:i,View:s}},{"../../core/hittest":"core/hittest","../mappers/categorical_mapper":"models/mappers/categorical_mapper","./glyph":"models/glyphs/glyph",rbush:"rbush",underscore:"underscore"}],"models/glyphs/quadratic":[function(t,e,r){var n,o,i,s,a,l,u=function(t,e){function r(){this.constructor=t}for(var n in e)c.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},c={}.hasOwnProperty;s=t("underscore"),l=t("rbush"),n=t("./glyph"),a=function(t,e,r){var n,o;return e===(t+r)/2?[t,r]:(o=(t-e)/(t-2*e+r),n=t*Math.pow(1-o,2)+2*e*(1-o)*o+r*Math.pow(o,2),[Math.min(t,r,n),Math.max(t,r,n)])},i=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return u(e,t),e.prototype._index_data=function(){var t,e,r,n,o,i,s,u,c,p,h;for(e=l(),n=[],t=r=0,o=this._x0.length;0<=o?r<o:r>o;t=0<=o?++r:--r)isNaN(this._x0[t]+this._x1[t]+this._y0[t]+this._y1[t]+this._cx[t]+this._cy[t])||(i=a(this._x0[t],this._cx[t],this._x1[t]),u=i[0],c=i[1],s=a(this._y0[t],this._cy[t],this._y1[t]),p=s[0],h=s[1],n.push({minX:u,minY:p,maxX:c,maxY:h,i:t}));return e.load(n),e},e.prototype._render=function(t,e,r){var n,o,i,s,a,l,u,c,p,h;if(u=r.sx0,p=r.sy0,c=r.sx1,h=r.sy1,a=r.scx,l=r.scy,this.visuals.line.doit){for(s=[],o=0,i=e.length;o<i;o++)n=e[o],isNaN(u[n]+p[n]+c[n]+h[n]+a[n]+l[n])||(t.beginPath(),t.moveTo(u[n],p[n]),t.quadraticCurveTo(a[n],l[n],c[n],h[n]),this.visuals.line.set_vectorize(t,n),s.push(t.stroke()));return s}},e.prototype.draw_legend_for_index=function(t,e,r,n,o,i){return this._generic_line_legend(t,e,r,n,o,i)},e}(n.View),o=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return u(e,t),e.prototype.default_view=i,e.prototype.type="Quadratic",e.coords([["x0","y0"],["x1","y1"],["cx","cy"]]),e.mixins(["line"]),e}(n.Model),e.exports={Model:o,View:i}},{"./glyph":"models/glyphs/glyph",rbush:"rbush",underscore:"underscore"}],"models/glyphs/ray":[function(t,e,r){var n,o,i,s,a,l=function(t,e){function r(){this.constructor=t}for(var n in e)u.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},u={}.hasOwnProperty;s=t("underscore"),n=t("./glyph"),a=t("../../core/properties"),i=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return l(e,t),e.prototype._index_data=function(){return this._xy_index()},e.prototype._map_data=function(){return this.slength=this.sdist(this.renderer.xmapper,this._x,this._length)},e.prototype._render=function(t,e,r){var n,o,i,s,a,l,u,c,p,h,_,d,f;if(_=r.sx,d=r.sy,h=r.slength,n=r._angle,this.visuals.line.doit){for(f=this.renderer.plot_view.frame.width,o=this.renderer.plot_view.frame.height,s=2*(f+o),i=a=0,c=h.length;0<=c?a<c:a>c;i=0<=c?++a:--a)0===h[i]&&(h[i]=s);for(p=[],l=0,u=e.length;l<u;l++)i=e[l],isNaN(_[i]+d[i]+n[i]+h[i])||(t.translate(_[i],d[i]),t.rotate(n[i]),t.beginPath(),t.moveTo(0,0),t.lineTo(h[i],0),this.visuals.line.set_vectorize(t,i),t.stroke(),t.rotate(-n[i]),p.push(t.translate(-_[i],-d[i])));return p}},e.prototype.draw_legend_for_index=function(t,e,r,n,o,i){return this._generic_line_legend(t,e,r,n,o,i)},e}(n.View),o=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return l(e,t),e.prototype.default_view=i,e.prototype.type="Ray",e.coords([["x","y"]]),e.mixins(["line"]),e.define({length:[a.DistanceSpec],angle:[a.AngleSpec]}),e}(n.Model),e.exports={Model:o,View:i}},{"../../core/properties":"core/properties","./glyph":"models/glyphs/glyph",underscore:"underscore"}],"models/glyphs/rect":[function(t,e,r){var n,o,i,s,a,l,u=function(t,e){function r(){this.constructor=t}for(var n in e)c.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},c={}.hasOwnProperty;s=t("underscore"),n=t("./glyph"),a=t("../../core/hittest"),l=t("../../core/properties"),i=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return u(e,t),e.prototype._set_data=function(){if(this.max_w2=0,"data"===this.model.properties.width.units&&(this.max_w2=this.max_width/2),this.max_h2=0,"data"===this.model.properties.height.units)return this.max_h2=this.max_height/2},e.prototype._index_data=function(){return this._xy_index()},e.prototype._map_data=function(){return"data"===this.model.properties.width.units?this.sw=this.sdist(this.renderer.xmapper,this._x,this._width,"center",this.model.dilate):this.sw=this._width,"data"===this.model.properties.height.units?this.sh=this.sdist(this.renderer.ymapper,this._y,this._height,"center",this.model.dilate):this.sh=this._height},e.prototype._render=function(t,e,r){var n,o,i,s,a,l,u,c,p,h;if(p=r.sx,h=r.sy,c=r.sw,u=r.sh,n=r._angle,this.visuals.fill.doit)for(i=0,a=e.length;i<a;i++)o=e[i],isNaN(p[o]+h[o]+c[o]+u[o]+n[o])||(this.visuals.fill.set_vectorize(t,o),n[o]?(t.translate(p[o],h[o]),t.rotate(n[o]),t.fillRect(-c[o]/2,-u[o]/2,c[o],u[o]),t.rotate(-n[o]),t.translate(-p[o],-h[o])):t.fillRect(p[o]-c[o]/2,h[o]-u[o]/2,c[o],u[o]));if(this.visuals.line.doit){for(t.beginPath(),s=0,l=e.length;s<l;s++)o=e[s],isNaN(p[o]+h[o]+c[o]+u[o]+n[o])||0!==c[o]&&0!==u[o]&&(n[o]?(t.translate(p[o],h[o]),t.rotate(n[o]),t.rect(-c[o]/2,-u[o]/2,c[o],u[o]),t.rotate(-n[o]),t.translate(-p[o],-h[o])):t.rect(p[o]-c[o]/2,h[o]-u[o]/2,c[o],u[o]),this.visuals.line.set_vectorize(t,o),t.stroke(),t.beginPath());return t.stroke()}},e.prototype._hit_rect=function(t){var e,r,n,o,i,s,l,u,c;return r=this.renderer.xmapper.v_map_from_target([t.vx0,t.vx1],!0),s=r[0],l=r[1],n=this.renderer.ymapper.v_map_from_target([t.vy0,t.vy1],!0),u=n[0],c=n[1],e=a.validate_bbox_coords([s,l],[u,c]),o=a.create_hit_test_result(),o["1d"].indices=function(){var t,r,n,o;for(n=this.index.search(e),o=[],t=0,r=n.length;t<r;t++)i=n[t],o.push(i.i);return o}.call(this),o},e.prototype._hit_point=function(t){var e,r,n,o,i,s,l,u,c,p,h,_,d,f,m,g,y,v,b,x,w,k,M,T,S,z,E,A,C,j,P,N;for(_=[t.vx,t.vy],x=_[0],M=_[1],E=this.renderer.xmapper.map_from_target(x,!0),j=this.renderer.ymapper.map_from_target(M,!0),"screen"===this.model.properties.width.units?(w=x-2*this.max_width,k=x+2*this.max_width,d=this.renderer.xmapper.v_map_from_target([w,k],!0),A=d[0],C=d[1]):(A=E-2*this.max_width,C=E+2*this.max_width),"screen"===this.model.properties.height.units?(T=M-2*this.max_height,S=M+2*this.max_height,f=this.renderer.ymapper.v_map_from_target([T,S],!0),P=f[0],N=f[1]):(P=j-2*this.max_height,N=j+2*this.max_height),i=[],e=a.validate_bbox_coords([A,C],[P,N]),m=function(){var t,r,n,o;for(n=this.index.search(e),o=[],t=0,r=n.length;t<r;t++)c=n[t],o.push(c.i);return o}.call(this),l=0,u=m.length;l<u;l++)s=m[l],v=this.renderer.plot_view.canvas.vx_to_sx(x),b=this.renderer.plot_view.canvas.vy_to_sy(M),this._angle[s]&&(n=Math.sqrt(Math.pow(v-this.sx[s],2)+Math.pow(b-this.sy[s],2)),y=Math.sin(-this._angle[s]),r=Math.cos(-this._angle[s]),p=r*(v-this.sx[s])-y*(b-this.sy[s])+this.sx[s],h=y*(v-this.sx[s])+r*(b-this.sy[s])+this.sy[s],v=p,b=h),z=Math.abs(this.sx[s]-v)<=this.sw[s]/2,o=Math.abs(this.sy[s]-b)<=this.sh[s]/2,o&&z&&i.push(s);return g=a.create_hit_test_result(),g["1d"].indices=i,g},e.prototype.draw_legend_for_index=function(t,e,r,n,o,i){return this._generic_area_legend(t,e,r,n,o,i)},e.prototype._bounds=function(t){return this.max_wh2_bounds(t)},e}(n.View),o=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return u(e,t),e.prototype.default_view=i,e.prototype.type="Rect",e.coords([["x","y"]]),e.mixins(["line","fill"]),e.define({angle:[l.AngleSpec,0],width:[l.DistanceSpec],height:[l.DistanceSpec],dilate:[l.Bool,!1]}),e}(n.Model),e.exports={Model:o,View:i}},{"../../core/hittest":"core/hittest","../../core/properties":"core/properties","./glyph":"models/glyphs/glyph",underscore:"underscore"}],"models/glyphs/segment":[function(t,e,r){var n,o,i,s,a,l=function(t,e){function r(){this.constructor=t}for(var n in e)u.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},u={}.hasOwnProperty;s=t("underscore"),a=t("rbush"),n=t("./glyph"),i=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return l(e,t),e.prototype._index_data=function(){var t,e,r,n,o;for(e=a(),n=[],t=r=0,o=this._x0.length;0<=o?r<o:r>o;t=0<=o?++r:--r)isNaN(this._x0[t]+this._x1[t]+this._y0[t]+this._y1[t])||n.push({minX:Math.min(this._x0[t],this._x1[t]),minY:Math.min(this._y0[t],this._y1[t]),maxX:Math.max(this._x0[t],this._x1[t]),maxY:Math.max(this._y0[t],this._y1[t]),i:t});return e.load(n),e},e.prototype._render=function(t,e,r){var n,o,i,s,a,l,u,c;if(a=r.sx0,u=r.sy0,l=r.sx1,c=r.sy1,this.visuals.line.doit){for(s=[],o=0,i=e.length;o<i;o++)n=e[o],isNaN(a[n]+u[n]+l[n]+c[n])||(t.beginPath(),t.moveTo(a[n],u[n]),t.lineTo(l[n],c[n]),this.visuals.line.set_vectorize(t,n),s.push(t.stroke()));return s}},e.prototype.draw_legend_for_index=function(t,e,r,n,o,i){return this._generic_line_legend(t,e,r,n,o,i)},e}(n.View),o=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return l(e,t),e.prototype.default_view=i,e.prototype.type="Segment",e.coords([["x0","y0"],["x1","y1"]]),e.mixins(["line"]),e}(n.Model),e.exports={Model:o,View:i}},{"./glyph":"models/glyphs/glyph",rbush:"rbush",underscore:"underscore"}],"models/glyphs/text":[function(t,e,r){var n,o,i,s,a,l=function(t,e){function r(){this.constructor=t}for(var n in e)u.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},u={}.hasOwnProperty;s=t("underscore"),n=t("./glyph"),a=t("../../core/properties"),i=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return l(e,t),e.prototype._index_data=function(){return this._xy_index()},e.prototype._render=function(t,e,r){var n,o,i,s,a,l,u,c,p,h;for(p=r.sx,h=r.sy,i=r._x_offset,s=r._y_offset,n=r._angle,o=r._text,c=[],l=0,u=e.length;l<u;l++)a=e[l],isNaN(p[a]+h[a]+i[a]+s[a]+n[a])||null==o[a]||(this.visuals.text.doit?(t.save(),t.translate(p[a]+i[a],h[a]+s[a]),t.rotate(n[a]),this.visuals.text.set_vectorize(t,a),t.fillText(o[a],0,0),c.push(t.restore())):c.push(void 0));return c},e.prototype.draw_legend_for_index=function(t,e,r,n,o,i){return t.save(),this.text_props.set_value(t),t.font=this.text_props.font_value(),t.font=t.font.replace(/\b[\d\.]+[\w]+\b/,"10pt"),t.textAlign="right",t.textBaseline="middle",t.fillText("text",x2,(o+y2)/2),t.restore()},e}(n.View),o=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return l(e,t),e.prototype.default_view=i,e.prototype.type="Text",e.coords([["x","y"]]),e.mixins(["text"]),e.define({text:[a.StringSpec,{field:"text"}],angle:[a.AngleSpec,0],x_offset:[a.NumberSpec,0],y_offset:[a.NumberSpec,0]}),e}(n.Model),e.exports={Model:o,View:i}},{"../../core/properties":"core/properties","./glyph":"models/glyphs/glyph",underscore:"underscore"}],"models/glyphs/vbar":[function(t,e,r){var n,o,i,s,a,l,u,c,p,h=function(t,e){function r(){this.constructor=t}for(var n in e)_.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},_={}.hasOwnProperty;l=t("underscore"),p=t("rbush"),i=t("./quad"),o=t("./glyph"),n=t("../mappers/categorical_mapper"),u=t("../../core/hittest"),c=t("../../core/properties"),a=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return h(e,t),e.prototype._map_data=function(){var t,e,r,n,o;for(this.sx=this.renderer.xmapper.v_map_to_target(this._x),o=this.renderer.ymapper.v_map_to_target(this._top),n=this.renderer.ymapper.v_map_to_target(this._bottom),this.stop=this.renderer.plot_view.canvas.v_vy_to_sy(o),this.sbottom=this.renderer.plot_view.canvas.v_vy_to_sy(n),this.sleft=[],this.sright=[],this.sw=this.sdist(this.renderer.xmapper,this._x,this._width,"center"),t=e=0,r=this.sx.length;0<=r?e<r:e>r;t=0<=r?++e:--e)this.sleft.push(this.sx[t]-this.sw[t]/2),this.sright.push(this.sx[t]+this.sw[t]/2);return null},e.prototype._index_data=function(){var t,e,r,o,i,s,a,l,u,c,h,_,d,f;for(a=function(t,e){return t instanceof n.Model?t.v_map_to_target(e,!0):e},f=a(this.renderer.xmapper,this._x),d=a(this.renderer.xmapper,this._width),_=a(this.renderer.ymapper,this._top),e=a(this.renderer.ymapper,this._bottom),o=p(),l=[],r=i=0,c=f.length;0<=c?i<c:i>c;r=0<=c?++i:--i)s=f[r]-d[r]/2,u=f[r]+d[r]/2,h=_[r],t=e[r],!isNaN(s+u+h+t)&&isFinite(s+u+h+t)&&l.push({minX:s,minY:t,maxX:u,maxY:h,i:r});return o.load(l),o},e.prototype._render=function(t,e,r){var n,o,i,s,a,l,u,c;for(l=r.sleft,u=r.sright,c=r.stop,a=r.sbottom,s=[],o=0,i=e.length;o<i;o++)n=e[o],isNaN(l[n]+c[n]+u[n]+a[n])||(this.visuals.fill.doit&&(this.visuals.fill.set_vectorize(t,n),t.fillRect(l[n],c[n],u[n]-l[n],a[n]-c[n])),this.visuals.line.doit?(t.beginPath(),t.rect(l[n],c[n],u[n]-l[n],a[n]-c[n]),this.visuals.line.set_vectorize(t,n),s.push(t.stroke())):s.push(void 0));return s},e.prototype._hit_point=function(t){var e,r,n,o,i,s,a;return r=[t.vx,t.vy],o=r[0],i=r[1],s=this.renderer.xmapper.map_from_target(o,!0),a=this.renderer.ymapper.map_from_target(i,!0),e=function(){var t,e,r,n;for(r=this.index.search({minX:s,minY:a,maxX:s,maxY:a}),n=[],t=0,e=r.length;t<e;t++)s=r[t],n.push(s.i);return n}.call(this),n=u.create_hit_test_result(),n["1d"].indices=e,n},e.prototype.scy=function(t){return(this.stop[t]+this.sbottom[t])/2},e.prototype.draw_legend_for_index=function(t,e,r,n,o,i){return this._generic_area_legend(t,e,r,n,o,i)},e}(o.View),s=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return h(e,t),e.prototype.default_view=a,e.prototype.type="VBar",e.mixins(["line","fill"]),e.define({x:[c.NumberSpec],width:[c.DistanceSpec],top:[c.NumberSpec],bottom:[c.NumberSpec,0]}),e}(o.Model),e.exports={Model:s,View:a}},{"../../core/hittest":"core/hittest","../../core/properties":"core/properties","../mappers/categorical_mapper":"models/mappers/categorical_mapper","./glyph":"models/glyphs/glyph","./quad":"models/glyphs/quad",rbush:"rbush",underscore:"underscore"}],"models/glyphs/webgl/base":[function(t,e,r){var n,o,i,s,a,l,u,c,p,h;o=t("underscore"),a=t("../../../core/util/color"),l=a.color2rgba,n=function(){function t(t,e){this.gl=t,this.glyph=e,this.nvertices=0,this.size_changed=!1,this.data_changed=!1,this.visuals_changed=!1,this.init()}return t.prototype.GLYPH="",t.prototype.VERT="",t.prototype.FRAG="",t.prototype.set_data_changed=function(t){return t!==this.nvertices&&(this.nvertices=t,this.size_changed=!0),this.data_changed=!0},t.prototype.set_visuals_changed=function(){return this.visuals_changed=!0},t.prototype.render=function(t,e,r){var n,o,i,s,a,l,u,c,p,h;return p=h=1,i=this.glyph.renderer.map_to_screen([0*p,1*p,2*p],[0*h,1*h,2*h]),n=i[0],o=i[1],p=100/Math.min(Math.max(Math.abs(n[1]-n[0]),1e-12),1e12),h=100/Math.min(Math.max(Math.abs(o[1]-o[0]),1e-12),1e12),s=this.glyph.renderer.map_to_screen([0*p,1*p,2*p],[0*h,1*h,2*h]),n=s[0],o=s[1],!(Math.abs(n[1]-n[0]-(n[2]-n[1]))>1e-6||Math.abs(o[1]-o[0]-(o[2]-o[1]))>1e-6)&&(a=[(n[1]-n[0])/p,(o[1]-o[0])/h],l=a[0],u=a[1],c={pixel_ratio:t.pixel_ratio,width:t.glcanvas.width,height:t.glcanvas.height,dx:n[0]/l,dy:o[0]/u,sx:l,sy:u},this.draw(e,r,c),!0)},t}(),p=function(t){return t<2&&(t=Math.sqrt(2*t)),t},u=function(t,e){var r,n,o,i;for(r=new Float32Array(t),n=o=0,i=t;0<=i?o<i:o>i;n=0<=i?++o:--o)r[n]=e;return r},c=function(t,e,r){var n,o,i,s,a,l,u;for(n=new Float32Array(t*e),o=s=0,l=t;0<=l?s<l:s>l;o=0<=l?++s:--s)for(i=a=0,u=e;0<=u?a<u:a>u;i=0<=u?++a:--a)n[o*e+i]=r[i];return n},h=function(t,e){return!o.isUndefined(t[e].spec.value)},s=function(t,e,r,n,o,i){var s;return o.doit?h(o,i)?(e.used=!1,t.set_attribute(r,"float",o[i].value())):(e.used=!0,s=new Float32Array(o.cache[i+"_array"]),e.set_size(4*n),e.set_data(0,s),t.set_attribute(r,"float",e)):(e.used=!1,t.set_attribute(r,"float",[0]))},i=function(t,e,r,n,o,i){var s,a,c,p,_,d,f,m,g,y,v,b,x;if(y=4,p=i+"_color",a=i+"_alpha",o.doit){if(h(o,p)&&h(o,a))return e.used=!1,x=l(o[p].value(),o[a].value()),t.set_attribute(r,"vec4",x);for(e.used=!0,_=h(o,p)?function(){var t,e,r;for(r=[],d=t=0,e=n;0<=e?t<e:t>e;d=0<=e?++t:--t)r.push(o[p].value());return r}():o.cache[p+"_array"],c=h(o,a)?u(n,o[a].value()):o.cache[a+"_array"],s=new Float32Array(n*y),d=m=0,v=n;0<=v?m<v:m>v;d=0<=v?++m:--m)for(x=l(_[d],c[d]),f=g=0,b=y;0<=b?g<b:g>b;f=0<=b?++g:--g)s[d*y+f]=x[f];return e.set_size(n*y*4),e.set_data(0,s),t.set_attribute(r,"vec4",e)}return e.used=!1,t.set_attribute(r,"vec4",[0,0,0,0])},e.exports={BaseGLGlyph:n,line_width:p,attach_float:s,attach_color:i,color2rgba:l}},{"../../../core/util/color":"core/util/color",underscore:"underscore"}],"models/glyphs/webgl/line":[function(t,e,r){var n,o,i,s,a,l,u,c,p,h,_=function(t,e){function r(){this.constructor=t}for(var n in e)d.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},d={}.hasOwnProperty;u=t("gloo2"),p=t("../../../core/logging").logger,h=t("./base"),n=h.BaseGLGlyph,c=h.line_width,a=h.attach_float,s=h.attach_color,l=h.color2rgba,o=function(){function t(t){this._atlas={},this._index=0,this._width=256,this._height=256,this.tex=new u.Texture2D(t),this.tex.set_wrapping(t.REPEAT,t.REPEAT),this.tex.set_interpolation(t.NEAREST,t.NEAREST),this.tex.set_size([this._height,this._width],t.RGBA),this.tex.set_data([0,0],[this._height,this._width],new Uint8Array(this._height*this._width*4)),this.get_atlas_data([1])}return t.prototype.get_atlas_data=function(t){var e,r,n,o,i,s;return n=t.join("-"),r=this._atlas[n],void 0===r&&(i=this.make_pattern(t),e=i[0],o=i[1],this.tex.set_data([this._index,0],[1,this._width],new Uint8Array(function(){var t,r,n;for(n=[],t=0,r=e.length;t<r;t++)s=e[t],n.push(s+10);return n}())),this._atlas[n]=[this._index/this._height,o],this._index+=1),this._atlas[n]},t.prototype.make_pattern=function(t){var e,r,n,o,i,s,a,l,u,c,p,h,_,d,f,m,g,y,v,b,x,w,k,M,T;for(t.length>1&&t.length%2&&(t=t.concat(t)),m=0,h=0,_=t.length;h<_;h++)w=t[h],m+=w;for(e=[],i=0,u=f=0,v=t.length+2;f<v;u=f+=2)n=Math.max(1e-4,t[u%t.length]),o=Math.max(1e-4,t[(u+1)%t.length]),e.push.apply(e,[i,i+n]),i+=n+o;for(d=this._width,r=new Float32Array(4*d),u=g=0,b=d;0<=b?g<b:g>b;u=0<=b?++g:--g){for(T=m*u/(d-1),c=0,M=1e16,p=y=0,x=e.length;0<=x?y<x:y>x;p=0<=x?++y:--y)k=Math.abs(e[p]-T),k<M&&(c=p,M=k);c%2===0?(l=T<=e[c]?1:0,a=e[c],s=e[c+1]):(l=T>e[c]?-1:0,a=e[c-1],s=e[c]),r[4*u+0]=e[c],r[4*u+1]=l,r[4*u+2]=a,r[4*u+3]=s}return[r,m]},t}(),i=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return _(e,t),e.prototype.GLYPH="line",e.prototype.JOINS={miter:0,round:1,bevel:2},e.prototype.CAPS={"":0,none:0,".":0,round:1,")":1,"(":1,o:1,"triangle in":2,"<":2,"triangle out":3,">":3,square:4,"[":4,"]":4,"=":4,butt:5,"|":5},e.prototype.VERT="precision mediump float;\n\nconst float PI = 3.14159265358979323846264;\nconst float THETA = 15.0 * 3.14159265358979323846264/180.0;\n\nuniform float u_pixel_ratio;\nuniform vec2 u_canvas_size, u_offset;\nuniform vec2 u_scale_aspect;\nuniform float u_scale_length;\n\nuniform vec4 u_color;\nuniform float u_antialias;\nuniform float u_length;\nuniform float u_linewidth;\nuniform float u_dash_index;\nuniform float u_closed;\n\nattribute vec2 a_position;\nattribute vec4 a_tangents;\nattribute vec2 a_segment;\nattribute vec2 a_angles;\nattribute vec2 a_texcoord;\n\nvarying vec4 v_color;\nvarying vec2 v_segment;\nvarying vec2 v_angles;\nvarying vec2 v_texcoord;\nvarying vec2 v_miter;\nvarying float v_length;\nvarying float v_linewidth;\n\nfloat cross(in vec2 v1, in vec2 v2)\n{\n return v1.x*v2.y - v1.y*v2.x;\n}\n\nfloat signed_distance(in vec2 v1, in vec2 v2, in vec2 v3)\n{\n return cross(v2-v1,v1-v3) / length(v2-v1);\n}\n\nvoid rotate( in vec2 v, in float alpha, out vec2 result )\n{\n float c = cos(alpha);\n float s = sin(alpha);\n result = vec2( c*v.x - s*v.y,\n s*v.x + c*v.y );\n}\n\nvoid main()\n{\n bool closed = (u_closed > 0.0);\n\n // Attributes and uniforms to varyings\n v_color = u_color;\n v_linewidth = u_linewidth;\n v_segment = a_segment * u_scale_length;\n v_length = u_length * u_scale_length;\n\n // Scale to map to pixel coordinates. The original algorithm from the paper\n // assumed isotropic scale. We obviously do not have this.\n vec2 abs_scale_aspect = abs(u_scale_aspect);\n vec2 abs_scale = u_scale_length * abs_scale_aspect;\n\n // Correct angles for aspect ratio\n vec2 av;\n av = vec2(1.0, tan(a_angles.x)) / abs_scale_aspect;\n v_angles.x = atan(av.y, av.x);\n av = vec2(1.0, tan(a_angles.y)) / abs_scale_aspect;\n v_angles.y = atan(av.y, av.x);\n\n // Thickness below 1 pixel are represented using a 1 pixel thickness\n // and a modified alpha\n v_color.a = min(v_linewidth, v_color.a);\n v_linewidth = max(v_linewidth, 1.0);\n\n // If color is fully transparent we just will discard the fragment anyway\n if( v_color.a <= 0.0 ) {\n gl_Position = vec4(0.0,0.0,0.0,1.0);\n return;\n }\n\n // This is the actual half width of the line\n float w = ceil(u_antialias+v_linewidth)/2.0;\n\n vec2 position = (a_position + u_offset) * abs_scale;\n\n vec2 t1 = normalize(a_tangents.xy * abs_scale_aspect); // note the scaling for aspect ratio here\n vec2 t2 = normalize(a_tangents.zw * abs_scale_aspect);\n float u = a_texcoord.x;\n float v = a_texcoord.y;\n vec2 o1 = vec2( +t1.y, -t1.x);\n vec2 o2 = vec2( +t2.y, -t2.x);\n\n // This is a join\n // ----------------------------------------------------------------\n if( t1 != t2 ) {\n float angle = atan (t1.x*t2.y-t1.y*t2.x, t1.x*t2.x+t1.y*t2.y); // Angle needs recalculation for some reason\n vec2 t = normalize(t1+t2);\n vec2 o = vec2( + t.y, - t.x);\n\n if ( u_dash_index > 0.0 )\n {\n // Broken angle\n // ----------------------------------------------------------------\n if( (abs(angle) > THETA) ) {\n position += v * w * o / cos(angle/2.0);\n float s = sign(angle);\n if( angle < 0.0 ) {\n if( u == +1.0 ) {\n u = v_segment.y + v * w * tan(angle/2.0);\n if( v == 1.0 ) {\n position -= 2.0 * w * t1 / sin(angle);\n u -= 2.0 * w / sin(angle);\n }\n } else {\n u = v_segment.x - v * w * tan(angle/2.0);\n if( v == 1.0 ) {\n position += 2.0 * w * t2 / sin(angle);\n u += 2.0*w / sin(angle);\n }\n }\n } else {\n if( u == +1.0 ) {\n u = v_segment.y + v * w * tan(angle/2.0);\n if( v == -1.0 ) {\n position += 2.0 * w * t1 / sin(angle);\n u += 2.0 * w / sin(angle);\n }\n } else {\n u = v_segment.x - v * w * tan(angle/2.0);\n if( v == -1.0 ) {\n position -= 2.0 * w * t2 / sin(angle);\n u -= 2.0*w / sin(angle);\n }\n }\n }\n // Continuous angle\n // ------------------------------------------------------------\n } else {\n position += v * w * o / cos(angle/2.0);\n if( u == +1.0 ) u = v_segment.y;\n else u = v_segment.x;\n }\n }\n\n // Solid line\n // --------------------------------------------------------------------\n else\n {\n position.xy += v * w * o / cos(angle/2.0);\n if( angle < 0.0 ) {\n if( u == +1.0 ) {\n u = v_segment.y + v * w * tan(angle/2.0);\n } else {\n u = v_segment.x - v * w * tan(angle/2.0);\n }\n } else {\n if( u == +1.0 ) {\n u = v_segment.y + v * w * tan(angle/2.0);\n } else {\n u = v_segment.x - v * w * tan(angle/2.0);\n }\n }\n }\n\n // This is a line start or end (t1 == t2)\n // ------------------------------------------------------------------------\n } else {\n position += v * w * o1;\n if( u == -1.0 ) {\n u = v_segment.x - w;\n position -= w * t1;\n } else {\n u = v_segment.y + w;\n position += w * t2;\n }\n }\n\n // Miter distance\n // ------------------------------------------------------------------------\n vec2 t;\n vec2 curr = a_position * abs_scale;\n if( a_texcoord.x < 0.0 ) {\n vec2 next = curr + t2*(v_segment.y-v_segment.x);\n\n rotate( t1, +v_angles.x/2.0, t);\n v_miter.x = signed_distance(curr, curr+t, position);\n\n rotate( t2, +v_angles.y/2.0, t);\n v_miter.y = signed_distance(next, next+t, position);\n } else {\n vec2 prev = curr - t1*(v_segment.y-v_segment.x);\n\n rotate( t1, -v_angles.x/2.0,t);\n v_miter.x = signed_distance(prev, prev+t, position);\n\n rotate( t2, -v_angles.y/2.0,t);\n v_miter.y = signed_distance(curr, curr+t, position);\n }\n\n if (!closed && v_segment.x <= 0.0) {\n v_miter.x = 1e10;\n }\n if (!closed && v_segment.y >= v_length)\n {\n v_miter.y = 1e10;\n }\n\n v_texcoord = vec2( u, v*w );\n\n // Calculate position in device coordinates. Note that we\n // already scaled with abs scale above.\n vec2 normpos = position * sign(u_scale_aspect);\n normpos += 0.5; // make up for Bokeh's offset\n normpos /= u_canvas_size / u_pixel_ratio; // in 0..1\n gl_Position = vec4(normpos*2.0-1.0, 0.0, 1.0);\n gl_Position.y *= -1.0;\n}\n",e.prototype.FRAG_="// Fragment shader that can be convenient during debugging to show the line skeleton.\nprecision mediump float;\nuniform vec4 u_color;\nvoid main () {\n gl_FragColor = u_color;\n}",e.prototype.FRAG="precision mediump float;\n\nconst float PI = 3.14159265358979323846264;\nconst float THETA = 15.0 * 3.14159265358979323846264/180.0;\n\nuniform sampler2D u_dash_atlas;\n\nuniform vec2 u_linecaps;\nuniform float u_miter_limit;\nuniform float u_linejoin;\nuniform float u_antialias;\nuniform float u_dash_phase;\nuniform float u_dash_period;\nuniform float u_dash_index;\nuniform vec2 u_dash_caps;\nuniform float u_closed;\n\nvarying vec4 v_color;\nvarying vec2 v_segment;\nvarying vec2 v_angles;\nvarying vec2 v_texcoord;\nvarying vec2 v_miter;\nvarying float v_length;\nvarying float v_linewidth;\n\n// Compute distance to cap ----------------------------------------------------\nfloat cap( int type, float dx, float dy, float t, float linewidth )\n{\n float d = 0.0;\n dx = abs(dx);\n dy = abs(dy);\n if (type == 0) discard; // None\n else if (type == 1) d = sqrt(dx*dx+dy*dy); // Round\n else if (type == 3) d = (dx+abs(dy)); // Triangle in\n else if (type == 2) d = max(abs(dy),(t+dx-abs(dy))); // Triangle out\n else if (type == 4) d = max(dx,dy); // Square\n else if (type == 5) d = max(dx+t,dy); // Butt\n return d;\n}\n\n// Compute distance to join -------------------------------------------------\nfloat join( in int type, in float d, in vec2 segment, in vec2 texcoord, in vec2 miter,\n in float linewidth )\n{\n // texcoord.x is distance from start\n // texcoord.y is distance from centerline\n // segment.x and y indicate the limits (as for texcoord.x) for this segment\n\n float dx = texcoord.x;\n\n // Round join\n if( type == 1 ) {\n if (dx < segment.x) {\n d = max(d,length( texcoord - vec2(segment.x,0.0)));\n //d = length( texcoord - vec2(segment.x,0.0));\n } else if (dx > segment.y) {\n d = max(d,length( texcoord - vec2(segment.y,0.0)));\n //d = length( texcoord - vec2(segment.y,0.0));\n }\n }\n // Bevel join\n else if ( type == 2 ) {\n if (dx < segment.x) {\n vec2 x = texcoord - vec2(segment.x,0.0);\n d = max(d, max(abs(x.x), abs(x.y)));\n\n } else if (dx > segment.y) {\n vec2 x = texcoord - vec2(segment.y,0.0);\n d = max(d, max(abs(x.x), abs(x.y)));\n }\n /* Original code for bevel which does not work for us\n if( (dx < segment.x) || (dx > segment.y) )\n d = max(d, min(abs(x.x),abs(x.y)));\n */\n }\n\n return d;\n}\n\nvoid main()\n{\n // If color is fully transparent we just discard the fragment\n if( v_color.a <= 0.0 ) {\n discard;\n }\n\n // Test if dash pattern is the solid one (0)\n bool solid = (u_dash_index == 0.0);\n\n // Test if path is closed\n bool closed = (u_closed > 0.0);\n\n vec4 color = v_color;\n float dx = v_texcoord.x;\n float dy = v_texcoord.y;\n float t = v_linewidth/2.0-u_antialias;\n float width = 1.0; //v_linewidth; original code had dashes scale with line width, we do not\n float d = 0.0;\n\n vec2 linecaps = u_linecaps;\n vec2 dash_caps = u_dash_caps;\n float line_start = 0.0;\n float line_stop = v_length;\n\n // Apply miter limit; fragments too far into the miter are simply discarded\n if( (dx < v_segment.x) || (dx > v_segment.y) ) {\n float into_miter = max(v_segment.x - dx, dx - v_segment.y);\n if (into_miter > u_miter_limit*v_linewidth/2.0)\n discard;\n }\n\n // Solid line --------------------------------------------------------------\n if( solid ) {\n d = abs(dy);\n if( (!closed) && (dx < line_start) ) {\n d = cap( int(u_linecaps.x), abs(dx), abs(dy), t, v_linewidth );\n }\n else if( (!closed) && (dx > line_stop) ) {\n d = cap( int(u_linecaps.y), abs(dx)-line_stop, abs(dy), t, v_linewidth );\n }\n else {\n d = join( int(u_linejoin), abs(dy), v_segment, v_texcoord, v_miter, v_linewidth );\n }\n\n // Dash line --------------------------------------------------------------\n } else {\n float segment_start = v_segment.x;\n float segment_stop = v_segment.y;\n float segment_center= (segment_start+segment_stop)/2.0;\n float freq = u_dash_period*width;\n float u = mod( dx + u_dash_phase*width, freq);\n vec4 tex = texture2D(u_dash_atlas, vec2(u/freq, u_dash_index)) * 255.0 -10.0; // conversion to int-like\n float dash_center= tex.x * width;\n float dash_type = tex.y;\n float _start = tex.z * width;\n float _stop = tex.a * width;\n float dash_start = dx - u + _start;\n float dash_stop = dx - u + _stop;\n\n // Compute extents of the first dash (the one relative to v_segment.x)\n // Note: this could be computed in the vertex shader\n if( (dash_stop < segment_start) && (dash_caps.x != 5.0) ) {\n float u = mod(segment_start + u_dash_phase*width, freq);\n vec4 tex = texture2D(u_dash_atlas, vec2(u/freq, u_dash_index)) * 255.0 -10.0; // conversion to int-like\n dash_center= tex.x * width;\n //dash_type = tex.y;\n float _start = tex.z * width;\n float _stop = tex.a * width;\n dash_start = segment_start - u + _start;\n dash_stop = segment_start - u + _stop;\n }\n\n // Compute extents of the last dash (the one relatives to v_segment.y)\n // Note: This could be computed in the vertex shader\n else if( (dash_start > segment_stop) && (dash_caps.y != 5.0) ) {\n float u = mod(segment_stop + u_dash_phase*width, freq);\n vec4 tex = texture2D(u_dash_atlas, vec2(u/freq, u_dash_index)) * 255.0 -10.0; // conversion to int-like\n dash_center= tex.x * width;\n //dash_type = tex.y;\n float _start = tex.z * width;\n float _stop = tex.a * width;\n dash_start = segment_stop - u + _start;\n dash_stop = segment_stop - u + _stop;\n }\n\n // This test if the we are dealing with a discontinuous angle\n bool discontinuous = ((dx < segment_center) && abs(v_angles.x) > THETA) ||\n ((dx >= segment_center) && abs(v_angles.y) > THETA);\n //if( dx < line_start) discontinuous = false;\n //if( dx > line_stop) discontinuous = false;\n\n float d_join = join( int(u_linejoin), abs(dy),\n v_segment, v_texcoord, v_miter, v_linewidth );\n\n // When path is closed, we do not have room for linecaps, so we make room\n // by shortening the total length\n if (closed) {\n line_start += v_linewidth/2.0;\n line_stop -= v_linewidth/2.0;\n }\n\n // We also need to take antialias area into account\n //line_start += u_antialias;\n //line_stop -= u_antialias;\n\n // Check is dash stop is before line start\n if( dash_stop <= line_start ) {\n discard;\n }\n // Check is dash start is beyond line stop\n if( dash_start >= line_stop ) {\n discard;\n }\n\n // Check if current dash start is beyond segment stop\n if( discontinuous ) {\n // Dash start is beyond segment, we discard\n if( (dash_start > segment_stop) ) {\n discard;\n //gl_FragColor = vec4(1.0,0.0,0.0,.25); return;\n }\n\n // Dash stop is before segment, we discard\n if( (dash_stop < segment_start) ) {\n discard; //gl_FragColor = vec4(0.0,1.0,0.0,.25); return;\n }\n\n // Special case for round caps (nicer with this)\n if( dash_caps.x == 1.0 ) {\n if( (u > _stop) && (dash_stop > segment_stop ) && (abs(v_angles.y) < PI/2.0)) {\n discard;\n }\n }\n\n // Special case for round caps (nicer with this)\n if( dash_caps.y == 1.0 ) {\n if( (u < _start) && (dash_start < segment_start ) && (abs(v_angles.x) < PI/2.0)) {\n discard;\n }\n }\n\n // Special case for triangle caps (in & out) and square\n // We make sure the cap stop at crossing frontier\n if( (dash_caps.x != 1.0) && (dash_caps.x != 5.0) ) {\n if( (dash_start < segment_start ) && (abs(v_angles.x) < PI/2.0) ) {\n float a = v_angles.x/2.0;\n float x = (segment_start-dx)*cos(a) - dy*sin(a);\n float y = (segment_start-dx)*sin(a) + dy*cos(a);\n if( x > 0.0 ) discard;\n // We transform the cap into square to avoid holes\n dash_caps.x = 4.0;\n }\n }\n\n // Special case for triangle caps (in & out) and square\n // We make sure the cap stop at crossing frontier\n if( (dash_caps.y != 1.0) && (dash_caps.y != 5.0) ) {\n if( (dash_stop > segment_stop ) && (abs(v_angles.y) < PI/2.0) ) {\n float a = v_angles.y/2.0;\n float x = (dx-segment_stop)*cos(a) - dy*sin(a);\n float y = (dx-segment_stop)*sin(a) + dy*cos(a);\n if( x > 0.0 ) discard;\n // We transform the caps into square to avoid holes\n dash_caps.y = 4.0;\n }\n }\n }\n\n // Line cap at start\n if( (dx < line_start) && (dash_start < line_start) && (dash_stop > line_start) ) {\n d = cap( int(linecaps.x), dx-line_start, dy, t, v_linewidth);\n }\n // Line cap at stop\n else if( (dx > line_stop) && (dash_stop > line_stop) && (dash_start < line_stop) ) {\n d = cap( int(linecaps.y), dx-line_stop, dy, t, v_linewidth);\n }\n // Dash cap left - dash_type = -1, 0 or 1, but there may be roundoff errors\n else if( dash_type < -0.5 ) {\n d = cap( int(dash_caps.y), abs(u-dash_center), dy, t, v_linewidth);\n if( (dx > line_start) && (dx < line_stop) )\n d = max(d,d_join);\n }\n // Dash cap right\n else if( dash_type > 0.5 ) {\n d = cap( int(dash_caps.x), abs(dash_center-u), dy, t, v_linewidth);\n if( (dx > line_start) && (dx < line_stop) )\n d = max(d,d_join);\n }\n // Dash body (plain)\n else {// if( dash_type > -0.5 && dash_type < 0.5) {\n d = abs(dy);\n }\n\n // Line join\n if( (dx > line_start) && (dx < line_stop)) {\n if( (dx <= segment_start) && (dash_start <= segment_start)\n && (dash_stop >= segment_start) ) {\n d = d_join;\n // Antialias at outer border\n float angle = PI/2.+v_angles.x;\n float f = abs( (segment_start - dx)*cos(angle) - dy*sin(angle));\n d = max(f,d);\n }\n else if( (dx > segment_stop) && (dash_start <= segment_stop)\n && (dash_stop >= segment_stop) ) {\n d = d_join;\n // Antialias at outer border\n float angle = PI/2.+v_angles.y;\n float f = abs((dx - segment_stop)*cos(angle) - dy*sin(angle));\n d = max(f,d);\n }\n else if( dx < (segment_start - v_linewidth/2.)) {\n discard;\n }\n else if( dx > (segment_stop + v_linewidth/2.)) {\n discard;\n }\n }\n else if( dx < (segment_start - v_linewidth/2.)) {\n discard;\n }\n else if( dx > (segment_stop + v_linewidth/2.)) {\n discard;\n }\n }\n\n // Distance to border ------------------------------------------------------\n d = d - t;\n if( d < 0.0 ) {\n gl_FragColor = color;\n } else {\n d /= u_antialias;\n gl_FragColor = vec4(color.rgb, exp(-d*d)*color.a);\n }\n}",
|
|
e.prototype.init=function(){var t;return t=this.gl,this._scale_aspect=0,this.prog=new u.Program(t),this.prog.set_shaders(this.VERT,this.FRAG),this.index_buffer=new u.IndexBuffer(t),this.vbo_position=new u.VertexBuffer(t),this.vbo_tangents=new u.VertexBuffer(t),this.vbo_segment=new u.VertexBuffer(t),this.vbo_angles=new u.VertexBuffer(t),this.vbo_texcoord=new u.VertexBuffer(t),this.dash_atlas=new o(t)},e.prototype.draw=function(t,e,r){var n,o,i,s,a,l,u,c,p,h,_,d,f,m,g,y,v,b,x,w;if(u=e.glglyph,u.data_changed){if(!isFinite(r.dx)||!isFinite(r.dy))return;u._baked_offset=[r.dx,r.dy],u._set_data(),u.data_changed=!1}if(this.visuals_changed&&(this._set_visuals(),this.visuals_changed=!1),v=r.sx,b=r.sy,y=Math.sqrt(v*v+b*b),v/=y,b/=y,Math.abs(this._scale_aspect-b/v)>Math.abs(.001*this._scale_aspect)&&(u._update_scale(v,b),this._scale_aspect=b/v),this.prog.set_attribute("a_position","vec2",u.vbo_position),this.prog.set_attribute("a_tangents","vec4",u.vbo_tangents),this.prog.set_attribute("a_segment","vec2",u.vbo_segment),this.prog.set_attribute("a_angles","vec2",u.vbo_angles),this.prog.set_attribute("a_texcoord","vec2",u.vbo_texcoord),this.prog.set_uniform("u_length","float",[u.cumsum]),this.prog.set_texture("u_dash_atlas",this.dash_atlas.tex),n=u._baked_offset,this.prog.set_uniform("u_pixel_ratio","float",[r.pixel_ratio]),this.prog.set_uniform("u_canvas_size","vec2",[r.width,r.height]),this.prog.set_uniform("u_offset","vec2",[r.dx-n[0],r.dy-n[1]]),this.prog.set_uniform("u_scale_aspect","vec2",[v,b]),this.prog.set_uniform("u_scale_length","float",[y]),this.I_triangles=u.I_triangles,this.I_triangles.length<65535)return this.index_buffer.set_size(2*this.I_triangles.length),this.index_buffer.set_data(0,new Uint16Array(this.I_triangles)),this.prog.draw(this.gl.TRIANGLES,this.index_buffer);for(t=this.I_triangles,c=this.I_triangles.length,s=64008,i=[],a=l=0,d=Math.ceil(c/s);0<=d?l<d:l>d;a=0<=d?++l:--l)i.push([]);for(a=h=0,f=t.length;0<=f?h<f:h>f;a=0<=f?++h:--h)w=t[a]%s,o=Math.floor(t[a]/s),i[o].push(w);for(g=[],o=_=0,m=i.length;0<=m?_<m:_>m;o=0<=m?++_:--_)x=new Uint16Array(i[o]),p=o*s*4,0!==x.length&&(this.prog.set_attribute("a_position","vec2",u.vbo_position,0,2*p),this.prog.set_attribute("a_tangents","vec4",u.vbo_tangents,0,4*p),this.prog.set_attribute("a_segment","vec2",u.vbo_segment,0,2*p),this.prog.set_attribute("a_angles","vec2",u.vbo_angles,0,2*p),this.prog.set_attribute("a_texcoord","vec2",u.vbo_texcoord,0,2*p),this.index_buffer.set_size(2*x.length),this.index_buffer.set_data(0,x),g.push(this.prog.draw(this.gl.TRIANGLES,this.index_buffer)));return g},e.prototype._set_data=function(){return this._bake(),this.vbo_position.set_size(4*this.V_position.length),this.vbo_position.set_data(0,this.V_position),this.vbo_tangents.set_size(4*this.V_tangents.length),this.vbo_tangents.set_data(0,this.V_tangents),this.vbo_angles.set_size(4*this.V_angles.length),this.vbo_angles.set_data(0,this.V_angles),this.vbo_texcoord.set_size(4*this.V_texcoord.length),this.vbo_texcoord.set_data(0,this.V_texcoord)},e.prototype._set_visuals=function(){var t,e,r,n,o,i,s;return e=l(this.glyph.visuals.line.line_color.value(),this.glyph.visuals.line.line_alpha.value()),t=this.CAPS[this.glyph.visuals.line.line_cap.value()],i=this.JOINS[this.glyph.visuals.line.line_join.value()],this.prog.set_uniform("u_color","vec4",e),this.prog.set_uniform("u_linewidth","float",[this.glyph.visuals.line.line_width.value()]),this.prog.set_uniform("u_antialias","float",[.9]),this.prog.set_uniform("u_linecaps","vec2",[t,t]),this.prog.set_uniform("u_linejoin","float",[i]),this.prog.set_uniform("u_miter_limit","float",[10]),n=this.glyph.visuals.line.line_dash.value(),r=0,o=1,n.length&&(s=this.dash_atlas.get_atlas_data(n),r=s[0],o=s[1]),this.prog.set_uniform("u_dash_index","float",[r]),this.prog.set_uniform("u_dash_phase","float",[this.glyph.visuals.line.line_dash_offset.value()]),this.prog.set_uniform("u_dash_period","float",[o]),this.prog.set_uniform("u_dash_caps","vec2",[t,t]),this.prog.set_uniform("u_closed","float",[0])},e.prototype._bake=function(){var t,e,r,n,o,i,s,a,l,u,c,p,h,_,d,f,m,g,y,v,b,x,w,k,M,T,S,z,E,A,C,j,P,N,O,D,F,q,I,R,L,B;for(x=this.nvertices,_=new Float64Array(this.glyph._x),d=new Float64Array(this.glyph._y),i=p=new Float32Array(2*x),n=new Float32Array(2*x),a=h=new Float32Array(4*x),u=new Float32Array(2*x),m=v=0,z=x;0<=z?v<z:v>z;m=0<=z?++v:--v)i[2*m+0]=_[m]+this._baked_offset[0],i[2*m+1]=d[m]+this._baked_offset[1];for(this.tangents=r=new Float32Array(2*x-2),m=M=0,E=x-1;0<=E?M<E:M>E;m=0<=E?++M:--M)r[2*m+0]=p[2*(m+1)+0]-p[2*m+0],r[2*m+1]=p[2*(m+1)+1]-p[2*m+1];for(m=T=0,A=x-1;0<=A?T<A:T>A;m=0<=A?++T:--T)a[4*(m+1)+0]=r[2*m+0],a[4*(m+1)+1]=r[2*m+1],a[4*m+2]=r[2*m+0],a[4*m+3]=r[2*m+1];for(a[0]=r[0],a[1]=r[1],a[4*(x-1)+2]=r[2*(x-2)+0],a[4*(x-1)+3]=r[2*(x-2)+1],t=new Float32Array(x),m=S=0,C=x;0<=C?S<C:S>C;m=0<=C?++S:--S)t[m]=Math.atan2(h[4*m+0]*h[4*m+3]-h[4*m+1]*h[4*m+2],h[4*m+0]*h[4*m+2]+h[4*m+1]*h[4*m+3]);for(m=F=0,j=x-1;0<=j?F<j:F>j;m=0<=j?++F:--F)n[2*m+0]=t[m],n[2*m+1]=t[m+1];for(b=4*x-4,this.V_position=s=new Float32Array(2*b),this.V_angles=o=new Float32Array(2*b),this.V_tangents=l=new Float32Array(4*b),this.V_texcoord=c=new Float32Array(2*b),k=2,m=q=0,P=x;0<=P?q<P:q>P;m=0<=P?++q:--q)for(g=I=0;I<4;g=++I){for(y=R=0;R<2;y=++R)s[2*(4*m+g-k)+y]=i[2*m+y],o[2*(4*m+g)+y]=n[2*m+y];for(y=L=0;L<4;y=++L)l[4*(4*m+g-k)+y]=a[4*m+y]}for(m=B=0,N=x;0<=N?B<=N:B>=N;m=0<=N?++B:--B)c[2*(4*m+0)+0]=-1,c[2*(4*m+1)+0]=-1,c[2*(4*m+2)+0]=1,c[2*(4*m+3)+0]=1,c[2*(4*m+0)+1]=-1,c[2*(4*m+1)+1]=1,c[2*(4*m+2)+1]=-1,c[2*(4*m+3)+1]=1;for(w=6*(x-1),this.I_triangles=e=new Uint32Array(w),D=[],m=f=0,O=x;0<=O?f<O:f>O;m=0<=O?++f:--f)e[6*m+0]=0+4*m,e[6*m+1]=1+4*m,e[6*m+2]=3+4*m,e[6*m+3]=2+4*m,e[6*m+4]=0+4*m,D.push(e[6*m+5]=3+4*m);return D},e.prototype._update_scale=function(t,e){var r,n,o,i,s,a,l,u,c,p,h,_,d,f,m,g,y,v;for(h=this.nvertices,p=4*h-4,n=this.tangents,r=new Float32Array(h-1),o=new Float32Array(2*h),this.V_segment=i=new Float32Array(2*p),a=c=0,m=h-1;0<=m?c<m:c>m;a=0<=m?++c:--c)r[a]=Math.sqrt(Math.pow(n[2*a+0]*t,2)+Math.pow(n[2*a+1]*e,2));for(s=0,a=_=0,g=h-1;0<=g?_<g:_>g;a=0<=g?++_:--_)s+=r[a],o[2*(a+1)+0]=s,o[2*a+1]=s;for(a=d=0,y=h;0<=y?d<y:d>y;a=0<=y?++d:--d)for(l=f=0;f<4;l=++f)for(u=v=0;v<2;u=++v)i[2*(4*a+l)+u]=o[2*a+u];return this.cumsum=s,this.vbo_segment.set_size(4*this.V_segment.length),this.vbo_segment.set_data(0,this.V_segment)},e}(n),e.exports={LineGLGlyph:i}},{"../../../core/logging":"core/logging","./base":"models/glyphs/webgl/base",gloo2:"gloo2"}],"models/glyphs/webgl/main":[function(t,e,r){var n,o;n=t("./line"),o=t("./markers"),e.exports={LineGLGlyph:n.LineGLGlyph,CircleGLGlyph:o.CircleGLGlyph,SquareGLGlyph:o.SquareGLGlyph,AnnulusGLGlyph:o.AnnulusGLGlyph,DiamondGLGlyph:o.DiamondGLGlyph,TriangleGLGlyph:o.TriangleGLGlyph,InvertedTriangleGLGlyph:o.InvertedTriangleGLGlyph,CrossGLGlyph:o.CrossGLGlyph,CircleCrossGLGlyph:o.CircleCrossGLGlyph,SquareCrossGLGlyph:o.SquareCrossGLGlyph,DiamondCrossGLGlyph:o.DiamondCrossGLGlyph,XGLGlyph:o.XGLGlyph,CircleXGLGlyph:o.CircleXGLGlyph,SquareXGLGlyph:o.SquareXGLGlyph,AsteriskGLGlyph:o.AsteriskGLGlyph}},{"./line":"models/glyphs/webgl/line","./markers":"models/glyphs/webgl/markers"}],"models/glyphs/webgl/markers":[function(t,e,r){var n,o,i,s,a,l,u,c,p,h,_,d,f,m,g,y,v,b,x,w,k,M,T=function(t,e){function r(){this.constructor=t}for(var n in e)S.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},S={}.hasOwnProperty;x=t("gloo2"),k=t("../../../core/logging").logger,M=t("./base"),i=M.BaseGLGlyph,w=M.line_width,b=M.attach_float,v=M.attach_color,_=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return T(e,t),e.prototype.VERT="precision mediump float;\nconst float SQRT_2 = 1.4142135623730951;\n//\nuniform float u_pixel_ratio;\nuniform vec2 u_canvas_size;\nuniform vec2 u_offset;\nuniform vec2 u_scale;\nuniform float u_antialias;\n//\nattribute float a_x;\nattribute float a_y;\nattribute float a_size;\nattribute float a_angle; // in radians\nattribute float a_linewidth;\nattribute vec4 a_fg_color;\nattribute vec4 a_bg_color;\n//\nvarying float v_linewidth;\nvarying float v_size;\nvarying vec4 v_fg_color;\nvarying vec4 v_bg_color;\nvarying vec2 v_rotation;\n\nvoid main (void)\n{\n v_size = a_size * u_pixel_ratio;\n v_linewidth = a_linewidth * u_pixel_ratio;\n v_fg_color = a_fg_color;\n v_bg_color = a_bg_color;\n v_rotation = vec2(cos(-a_angle), sin(-a_angle));\n // Calculate position - the -0.5 is to correct for canvas origin\n vec2 pos = (vec2(a_x, a_y) + u_offset) * u_scale; // in pixels\n pos += 0.5; // make up for Bokeh's offset\n pos /= u_canvas_size / u_pixel_ratio; // in 0..1\n gl_Position = vec4(pos*2.0-1.0, 0.0, 1.0);\n gl_Position.y *= -1.0;\n gl_PointSize = SQRT_2 * v_size + 2.0 * (v_linewidth + 1.5*u_antialias);\n}",e.prototype.FRAG="precision mediump float;\nconst float SQRT_2 = 1.4142135623730951;\nconst float PI = 3.14159265358979323846264;\n//\nuniform float u_antialias;\n//\nvarying vec4 v_fg_color;\nvarying vec4 v_bg_color;\nvarying float v_linewidth;\nvarying float v_size;\nvarying vec2 v_rotation;\n\nMARKERCODE\n\nvec4 outline(float distance, float linewidth, float antialias, vec4 fg_color, vec4 bg_color)\n{\n vec4 frag_color;\n float t = linewidth/2.0 - antialias;\n float signed_distance = distance;\n float border_distance = abs(signed_distance) - t;\n float alpha = border_distance/antialias;\n alpha = exp(-alpha*alpha);\n\n // If fg alpha is zero, it probably means no outline. To avoid a dark outline\n // shining through due to aa, we set the fg color to the bg color. Avoid if (i.e. branching).\n float select = float(bool(fg_color.a));\n fg_color.rgb = select * fg_color.rgb + (1.0 - select) * bg_color.rgb;\n // Similarly, if we want a transparent bg\n select = float(bool(bg_color.a));\n bg_color.rgb = select * bg_color.rgb + (1.0 - select) * fg_color.rgb;\n\n if( border_distance < 0.0)\n frag_color = fg_color;\n else if( signed_distance < 0.0 ) {\n frag_color = mix(bg_color, fg_color, sqrt(alpha));\n } else {\n if( abs(signed_distance) < (linewidth/2.0 + antialias) ) {\n frag_color = vec4(fg_color.rgb, fg_color.a * alpha);\n } else {\n discard;\n }\n }\n return frag_color;\n}\n\nvoid main()\n{\n vec2 P = gl_PointCoord.xy - vec2(0.5, 0.5);\n P = vec2(v_rotation.x*P.x - v_rotation.y*P.y,\n v_rotation.y*P.x + v_rotation.x*P.y);\n float point_size = SQRT_2*v_size + 2.0 * (v_linewidth + 1.5*u_antialias);\n float distance = marker(P*point_size, v_size);\n gl_FragColor = outline(distance, v_linewidth, u_antialias, v_fg_color, v_bg_color);\n //gl_FragColor.rgb *= gl_FragColor.a; // pre-multiply alpha\n}",e.prototype.MARKERCODE="<defined in subclasses>",e.prototype.init=function(){var t,e;return e=this.gl,t=this.FRAG.replace(/MARKERCODE/,this.MARKERCODE),this.last_trans={},this.prog=new x.Program(e),this.prog.set_shaders(this.VERT,t),this.vbo_x=new x.VertexBuffer(e),this.prog.set_attribute("a_x","float",this.vbo_x),this.vbo_y=new x.VertexBuffer(e),this.prog.set_attribute("a_y","float",this.vbo_y),this.vbo_s=new x.VertexBuffer(e),this.prog.set_attribute("a_size","float",this.vbo_s),this.vbo_a=new x.VertexBuffer(e),this.prog.set_attribute("a_angle","float",this.vbo_a),this.vbo_linewidth=new x.VertexBuffer(e),this.vbo_fg_color=new x.VertexBuffer(e),this.vbo_bg_color=new x.VertexBuffer(e),this.index_buffer=new x.IndexBuffer(e)},e.prototype.draw=function(t,e,r){var n,o,i,s,a,l,u,c,p,h,_,d,f,m,g,y,v,b,x;if(p=e.glglyph,h=p.nvertices,p.data_changed){if(!isFinite(r.dx)||!isFinite(r.dy))return;p._baked_offset=[r.dx,r.dy],p._set_data(h),p.data_changed=!1}else null==this.glyph._radius||r.sx===this.last_trans.sx&&r.sy===this.last_trans.sy||(this.last_trans=r,this.vbo_s.set_data(0,new Float32Array(function(){var t,e,r,n;for(r=this.glyph.sradius,n=[],t=0,e=r.length;t<e;t++)y=r[t],n.push(2*y);return n}.call(this))));if(this.visuals_changed&&(this._set_visuals(h),this.visuals_changed=!1),n=p._baked_offset,this.prog.set_uniform("u_pixel_ratio","float",[r.pixel_ratio]),this.prog.set_uniform("u_canvas_size","vec2",[r.width,r.height]),this.prog.set_uniform("u_offset","vec2",[r.dx-n[0],r.dy-n[1]]),this.prog.set_uniform("u_scale","vec2",[r.sx,r.sy]),this.prog.set_attribute("a_x","float",p.vbo_x),this.prog.set_attribute("a_y","float",p.vbo_y),this.prog.set_attribute("a_size","float",p.vbo_s),this.prog.set_attribute("a_angle","float",p.vbo_a),0!==t.length){if(t.length===h)return this.prog.draw(this.gl.POINTS,[0,h]);if(h<65535)return b=window.navigator.userAgent,b.indexOf("MSIE ")+b.indexOf("Trident/")+b.indexOf("Edge/")>0&&k.warn("WebGL warning: IE is known to produce 1px sprites whith selections."),this.index_buffer.set_size(2*t.length),this.index_buffer.set_data(0,new Uint16Array(t)),this.prog.draw(this.gl.POINTS,this.index_buffer);for(s=64e3,i=[],a=l=0,d=Math.ceil(h/s);0<=d?l<d:l>d;a=0<=d?++l:--l)i.push([]);for(a=u=0,f=t.length;0<=f?u<f:u>f;a=0<=f?++u:--u)x=t[a]%s,o=Math.floor(t[a]/s),i[o].push(x);for(g=[],o=c=0,m=i.length;0<=m?c<m:c>m;o=0<=m?++c:--c)v=new Uint16Array(i[o]),_=o*s*4,0!==v.length&&(this.prog.set_attribute("a_x","float",p.vbo_x,0,_),this.prog.set_attribute("a_y","float",p.vbo_y,0,_),this.prog.set_attribute("a_size","float",p.vbo_s,0,_),this.prog.set_attribute("a_angle","float",p.vbo_a,0,_),this.vbo_linewidth.used&&this.prog.set_attribute("a_linewidth","float",this.vbo_linewidth,0,_),this.vbo_fg_color.used&&this.prog.set_attribute("a_fg_color","vec4",this.vbo_fg_color,0,4*_),this.vbo_bg_color.used&&this.prog.set_attribute("a_bg_color","vec4",this.vbo_bg_color,0,4*_),this.index_buffer.set_size(2*v.length),this.index_buffer.set_data(0,v),g.push(this.prog.draw(this.gl.POINTS,this.index_buffer)));return g}},e.prototype._set_data=function(t){var e,r,n,o,i,s,a;for(n=4*t,this.vbo_x.set_size(n),this.vbo_y.set_size(n),this.vbo_a.set_size(n),this.vbo_s.set_size(n),s=new Float64Array(this.glyph._x),a=new Float64Array(this.glyph._y),e=r=0,o=t;0<=o?r<o:r>o;e=0<=o?++r:--r)s[e]+=this._baked_offset[0],a[e]+=this._baked_offset[1];return this.vbo_x.set_data(0,new Float32Array(s)),this.vbo_y.set_data(0,new Float32Array(a)),null!=this.glyph._angle&&this.vbo_a.set_data(0,new Float32Array(this.glyph._angle)),null!=this.glyph._radius?this.vbo_s.set_data(0,new Float32Array(function(){var t,e,r,n;for(r=this.glyph.sradius,n=[],t=0,e=r.length;t<e;t++)i=r[t],n.push(2*i);return n}.call(this))):this.vbo_s.set_data(0,new Float32Array(this.glyph._size))},e.prototype._set_visuals=function(t){return b(this.prog,this.vbo_linewidth,"a_linewidth",t,this.glyph.visuals.line,"line_width"),v(this.prog,this.vbo_fg_color,"a_fg_color",t,this.glyph.visuals.line,"line"),v(this.prog,this.vbo_bg_color,"a_bg_color",t,this.glyph.visuals.fill,"fill"),this.prog.set_uniform("u_antialias","float",[.8])},e}(i),a=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return T(e,t),e.prototype.GLYPH="circle",e.prototype.MARKERCODE="// --- disc\nfloat marker(vec2 P, float size)\n{\n return length(P) - size/2.0;\n}",e}(_),f=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return T(e,t),e.prototype.GLYPH="square",e.prototype.MARKERCODE="// --- square\nfloat marker(vec2 P, float size)\n{\n return max(abs(P.x), abs(P.y)) - size/2.0;\n}",e}(_),n=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return T(e,t),e.prototype.GLYPH="annulus",e.prototype.MARKERCODE="float marker(vec2 P, float size)\n{\n float r1 = length(P) - size/2.0;\n float r2 = length(P) - size/4.0; // half width\n return max(r1, -r2);\n}",e}(_),p=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return T(e,t),e.prototype.GLYPH="diamond",e.prototype.MARKERCODE="// --- diamond\nfloat marker(vec2 P, float size)\n{\n float x = SQRT_2 / 2.0 * (P.x * 1.5 - P.y);\n float y = SQRT_2 / 2.0 * (P.x * 1.5 + P.y);\n float r1 = max(abs(x), abs(y)) - size / (2.0 * SQRT_2);\n return r1 / SQRT_2;\n}",e}(_),g=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return T(e,t),e.prototype.GLYPH="triangle",e.prototype.MARKERCODE="float marker(vec2 P, float size)\n{\n P.y -= size * 0.3;\n float x = SQRT_2 / 2.0 * (P.x * 1.7 - P.y);\n float y = SQRT_2 / 2.0 * (P.x * 1.7 + P.y);\n float r1 = max(abs(x), abs(y)) - size / 1.6;\n float r2 = P.y;\n return max(r1 / SQRT_2, r2); // Instersect diamond with rectangle\n}",e}(_),h=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return T(e,t),e.prototype.GLYPH="invertedtriangle",e.prototype.MARKERCODE="float marker(vec2 P, float size)\n{\n P.y += size * 0.3;\n float x = SQRT_2 / 2.0 * (P.x * 1.7 - P.y);\n float y = SQRT_2 / 2.0 * (P.x * 1.7 + P.y);\n float r1 = max(abs(x), abs(y)) - size / 1.6;\n float r2 = - P.y;\n return max(r1 / SQRT_2, r2); // Instersect diamond with rectangle\n}",e}(_),u=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return T(e,t),e.prototype.GLYPH="cross",e.prototype.MARKERCODE='float marker(vec2 P, float size)\n{\n float square = max(abs(P.x), abs(P.y)) - size / 2.5; // 2.5 is a tweak\n float cross = min(abs(P.x), abs(P.y)) - size / 100.0; // bit of "width" for aa\n return max(square, cross);\n}',e}(_),s=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return T(e,t),e.prototype.GLYPH="circlecross",e.prototype.MARKERCODE="float marker(vec2 P, float size)\n{\n // Define quadrants\n float qs = size / 2.0; // quadrant size\n float s1 = max(abs(P.x - qs), abs(P.y - qs)) - qs;\n float s2 = max(abs(P.x + qs), abs(P.y - qs)) - qs;\n float s3 = max(abs(P.x - qs), abs(P.y + qs)) - qs;\n float s4 = max(abs(P.x + qs), abs(P.y + qs)) - qs;\n // Intersect main shape with quadrants (to form cross)\n float circle = length(P) - size/2.0;\n float c1 = max(circle, s1);\n float c2 = max(circle, s2);\n float c3 = max(circle, s3);\n float c4 = max(circle, s4);\n // Union\n return min(min(min(c1, c2), c3), c4);\n}",e}(_),d=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return T(e,t),e.prototype.GLYPH="squarecross",e.prototype.MARKERCODE="float marker(vec2 P, float size)\n{\n // Define quadrants\n float qs = size / 2.0; // quadrant size\n float s1 = max(abs(P.x - qs), abs(P.y - qs)) - qs;\n float s2 = max(abs(P.x + qs), abs(P.y - qs)) - qs;\n float s3 = max(abs(P.x - qs), abs(P.y + qs)) - qs;\n float s4 = max(abs(P.x + qs), abs(P.y + qs)) - qs;\n // Intersect main shape with quadrants (to form cross)\n float square = max(abs(P.x), abs(P.y)) - size/2.0;\n float c1 = max(square, s1);\n float c2 = max(square, s2);\n float c3 = max(square, s3);\n float c4 = max(square, s4);\n // Union\n return min(min(min(c1, c2), c3), c4);\n}",e}(_),c=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return T(e,t),e.prototype.GLYPH="diamondcross",e.prototype.MARKERCODE="float marker(vec2 P, float size)\n{\n // Define quadrants\n float qs = size / 2.0; // quadrant size\n float s1 = max(abs(P.x - qs), abs(P.y - qs)) - qs;\n float s2 = max(abs(P.x + qs), abs(P.y - qs)) - qs;\n float s3 = max(abs(P.x - qs), abs(P.y + qs)) - qs;\n float s4 = max(abs(P.x + qs), abs(P.y + qs)) - qs;\n // Intersect main shape with quadrants (to form cross)\n float x = SQRT_2 / 2.0 * (P.x * 1.5 - P.y);\n float y = SQRT_2 / 2.0 * (P.x * 1.5 + P.y);\n float diamond = max(abs(x), abs(y)) - size / (2.0 * SQRT_2);\n diamond /= SQRT_2;\n float c1 = max(diamond, s1);\n float c2 = max(diamond, s2);\n float c3 = max(diamond, s3);\n float c4 = max(diamond, s4);\n // Union\n return min(min(min(c1, c2), c3), c4);\n}",e}(_),y=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return T(e,t),e.prototype.GLYPH="x",e.prototype.MARKERCODE='float marker(vec2 P, float size)\n{\n float circle = length(P) - size / 1.6;\n float X = min(abs(P.x - P.y), abs(P.x + P.y)) - size / 100.0; // bit of "width" for aa\n return max(circle, X);\n}',e}(_),l=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return T(e,t),e.prototype.GLYPH="circlex",e.prototype.MARKERCODE='float marker(vec2 P, float size)\n{\n float x = P.x - P.y;\n float y = P.x + P.y;\n // Define quadrants\n float qs = size / 2.0; // quadrant size\n float s1 = max(abs(x - qs), abs(y - qs)) - qs;\n float s2 = max(abs(x + qs), abs(y - qs)) - qs;\n float s3 = max(abs(x - qs), abs(y + qs)) - qs;\n float s4 = max(abs(x + qs), abs(y + qs)) - qs;\n // Intersect main shape with quadrants (to form cross)\n float circle = length(P) - size/2.0;\n float c1 = max(circle, s1);\n float c2 = max(circle, s2);\n float c3 = max(circle, s3);\n float c4 = max(circle, s4);\n // Union\n float almost = min(min(min(c1, c2), c3), c4);\n // In this case, the X is also outside of the main shape\n float Xmask = length(P) - size / 1.6; // a circle\n float X = min(abs(P.x - P.y), abs(P.x + P.y)) - size / 100.0; // bit of "width" for aa\n return min(max(X, Xmask), almost);\n}',e}(_),m=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return T(e,t),e.prototype.GLYPH="squarex",e.prototype.MARKERCODE="float marker(vec2 P, float size)\n{\n float x = P.x - P.y;\n float y = P.x + P.y;\n // Define quadrants\n float qs = size / 2.0; // quadrant size\n float s1 = max(abs(x - qs), abs(y - qs)) - qs;\n float s2 = max(abs(x + qs), abs(y - qs)) - qs;\n float s3 = max(abs(x - qs), abs(y + qs)) - qs;\n float s4 = max(abs(x + qs), abs(y + qs)) - qs;\n // Intersect main shape with quadrants (to form cross)\n float square = max(abs(P.x), abs(P.y)) - size/2.0;\n float c1 = max(square, s1);\n float c2 = max(square, s2);\n float c3 = max(square, s3);\n float c4 = max(square, s4);\n // Union\n return min(min(min(c1, c2), c3), c4);\n}",e}(_),o=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return T(e,t),e.prototype.GLYPH="asterisk",e.prototype.MARKERCODE='float marker(vec2 P, float size)\n{\n // Masks\n float diamond = max(abs(SQRT_2 / 2.0 * (P.x - P.y)), abs(SQRT_2 / 2.0 * (P.x + P.y))) - size / (2.0 * SQRT_2);\n float square = max(abs(P.x), abs(P.y)) - size / (2.0 * SQRT_2);\n // Shapes\n float X = min(abs(P.x - P.y), abs(P.x + P.y)) - size / 100.0; // bit of "width" for aa\n float cross = min(abs(P.x), abs(P.y)) - size / 100.0; // bit of "width" for aa\n // Result is union of masked shapes\n return min(max(X, diamond), max(cross, square));\n}',e}(_),e.exports={CircleGLGlyph:a,SquareGLGlyph:f,AnnulusGLGlyph:n,DiamondGLGlyph:p,TriangleGLGlyph:g,InvertedTriangleGLGlyph:h,CrossGLGlyph:u,CircleCrossGLGlyph:s,SquareCrossGLGlyph:d,DiamondCrossGLGlyph:c,XGLGlyph:y,CircleXGLGlyph:l,SquareXGLGlyph:m,AsteriskGLGlyph:o}},{"../../../core/logging":"core/logging","./base":"models/glyphs/webgl/base",gloo2:"gloo2"}],"models/glyphs/wedge":[function(t,e,r){var n,o,i,s,a,l,u,c=function(t,e){function r(){this.constructor=t}for(var n in e)p.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},p={}.hasOwnProperty;s=t("underscore"),n=t("./glyph"),l=t("../../core/hittest"),u=t("../../core/properties"),a=t("../../core/util/math").angle_between,i=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return c(e,t),e.prototype._index_data=function(){return this._xy_index()},e.prototype._map_data=function(){return"data"===this.model.properties.radius.units?this.sradius=this.sdist(this.renderer.xmapper,this._x,this._radius):this.sradius=this._radius},e.prototype._render=function(t,e,r){var n,o,i,s,a,l,u,c,p,h;for(p=r.sx,h=r.sy,c=r.sradius,o=r._start_angle,n=r._end_angle,i=this.model.properties.direction.value(),u=[],a=0,l=e.length;a<l;a++)s=e[a],isNaN(p[s]+h[s]+c[s]+o[s]+n[s])||(t.beginPath(),t.arc(p[s],h[s],c[s],o[s],n[s],i),t.lineTo(p[s],h[s]),t.closePath(),this.visuals.fill.doit&&(this.visuals.fill.set_vectorize(t,s),t.fill()),this.visuals.line.doit?(this.visuals.line.set_vectorize(t,s),u.push(t.stroke())):u.push(void 0));return u},e.prototype._hit_point=function(t){var e,r,n,o,i,u,c,p,h,_,d,f,m,g,y,v,b,x,w,k,M,T,S,z,E,A,C,j,P,N,O,D,F,q,I,R,L;for(g=[t.vx,t.vy],A=g[0],P=g[1],D=this.renderer.xmapper.map_from_target(A,!0),I=this.renderer.ymapper.map_from_target(P,!0),"data"===this.model.properties.radius.units?(F=D-this.max_radius,q=D+this.max_radius,R=I-this.max_radius,L=I+this.max_radius):(C=A-this.max_radius,j=A+this.max_radius,y=this.renderer.xmapper.v_map_from_target([C,j],!0),F=y[0],q=y[1],N=P-this.max_radius,O=P+this.max_radius,v=this.renderer.ymapper.v_map_from_target([N,O],!0),R=v[0],L=v[1]),n=[],r=l.validate_bbox_coords([F,q],[R,L]),b=function(){var t,e,n,o;for(n=this.index.search(r),o=[],t=0,e=n.length;t<e;t++)f=n[t],o.push(f.i);return o}.call(this),p=0,_=b.length;p<_;p++)c=b[p],m=Math.pow(this.sradius[c],2),M=this.renderer.xmapper.map_to_target(D,!0),T=this.renderer.xmapper.map_to_target(this._x[c],!0),z=this.renderer.ymapper.map_to_target(I,!0),E=this.renderer.ymapper.map_to_target(this._y[c],!0),i=Math.pow(M-T,2)+Math.pow(z-E,2),i<=m&&n.push([c,i]);for(o=this.model.properties.direction.value(),u=[],h=0,d=n.length;h<d;h++)x=n[h],c=x[0],i=x[1],k=this.renderer.plot_view.canvas.vx_to_sx(A),S=this.renderer.plot_view.canvas.vy_to_sy(P),e=Math.atan2(S-this.sy[c],k-this.sx[c]),a(-e,-this._start_angle[c],-this._end_angle[c],o)&&u.push([c,i]);return w=l.create_hit_test_result(),w["1d"].indices=s.chain(u).sortBy(function(t){return t[1]}).map(function(t){return t[0]}).value(),w},e.prototype.draw_legend_for_index=function(t,e,r,n,o,i){return this._generic_area_legend(t,e,r,n,o,i)},e}(n.View),o=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return c(e,t),e.prototype.default_view=i,e.prototype.type="Wedge",e.coords([["x","y"]]),e.mixins(["line","fill"]),e.define({direction:[u.Direction,"anticlock"],radius:[u.DistanceSpec],start_angle:[u.AngleSpec],end_angle:[u.AngleSpec]}),e}(n.Model),e.exports={Model:o,View:i}},{"../../core/hittest":"core/hittest","../../core/properties":"core/properties","../../core/util/math":"core/util/math","./glyph":"models/glyphs/glyph",underscore:"underscore"}],"models/grids/grid":[function(t,e,r){var n,o,i,s,a,l,u=function(t,e){function r(){this.constructor=t}for(var n in e)c.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},c={}.hasOwnProperty;a=t("underscore"),i=t("../renderers/guide_renderer"),s=t("../renderers/renderer"),l=t("../../core/properties"),o=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return u(e,t),e.prototype.initialize=function(t,r){return e.__super__.initialize.call(this,t,r),this._x_range_name=this.model.x_range_name,this._y_range_name=this.model.y_range_name},e.prototype.render=function(){var t;if(this.model.visible!==!1)return t=this.plot_view.canvas_view.ctx,t.save(),this._draw_regions(t),this._draw_minor_grids(t),this._draw_grids(t),t.restore()},e.prototype.bind_bokeh_events=function(){return this.listenTo(this.model,"change",this.request_render)},e.prototype._draw_regions=function(t){var e,r,n,o,i,s,a,l,u,c,p,h;if(this.visuals.band_fill.doit)for(n=this.model.grid_coords("major",!1),p=n[0],h=n[1],this.visuals.band_fill.set_value(t),e=r=0,o=p.length-1;0<=o?r<o:r>o;e=0<=o?++r:--r)e%2===1&&(i=this.plot_view.map_to_screen(p[e],h[e],this._x_range_name,this._y_range_name),a=i[0],u=i[1],s=this.plot_view.map_to_screen(p[e+1],h[e+1],this._x_range_name,this._y_range_name),l=s[0],c=s[1],t.fillRect(a[0],u[0],l[1]-a[0],c[1]-u[0]),t.fill())},e.prototype._draw_grids=function(t){var e,r,n;if(this.visuals.grid_line.doit)return e=this.model.grid_coords("major"),r=e[0],n=e[1],this._draw_grid_helper(t,this.visuals.grid_line,r,n)},e.prototype._draw_minor_grids=function(t){var e,r,n;if(this.visuals.minor_grid_line.doit)return e=this.model.grid_coords("minor"),r=e[0],n=e[1],this._draw_grid_helper(t,this.visuals.minor_grid_line,r,n)},e.prototype._draw_grid_helper=function(t,e,r,n){var o,i,s,a,l,u,c,p;for(e.set_value(t),o=i=0,a=r.length;0<=a?i<a:i>a;o=0<=a?++i:--i){for(l=this.plot_view.map_to_screen(r[o],n[o],this._x_range_name,this._y_range_name),c=l[0],p=l[1],t.beginPath(),t.moveTo(Math.round(c[0]),Math.round(p[0])),o=s=1,u=c.length;1<=u?s<u:s>u;o=1<=u?++s:--s)t.lineTo(Math.round(c[o]),Math.round(p[o]));t.stroke()}},e}(s.View),n=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return u(e,t),e.prototype.default_view=o,e.prototype.type="Grid",e.mixins(["line:grid_","line:minor_grid_","fill:band_"]),e.define({bounds:[l.Any,"auto"],dimension:[l.Number,0],ticker:[l.Instance],x_range_name:[l.String,"default"],y_range_name:[l.String,"default"]}),e.override({level:"underlay",band_fill_color:null,band_fill_alpha:0,grid_line_color:"#e5e5e5",minor_grid_line_color:null}),e.prototype.ranges=function(){var t,e,r,n;return e=this.dimension,r=(e+1)%2,t=this.plot.plot_canvas.frame,n=[t.x_ranges[this.x_range_name],t.y_ranges[this.y_range_name]],[n[e],n[r]]},e.prototype.computed_bounds=function(){var t,e,r,n,o,i,s;return o=this.ranges(),r=o[0],t=o[1],s=this.bounds,n=[r.min,r.max],a.isArray(s)?(i=Math.min(s[0],s[1]),e=Math.max(s[0],s[1]),i<n[0]?i=n[0]:i>n[1]&&(i=null),e>n[1]?e=n[1]:e<n[0]&&(e=null)):(i=n[0],e=n[1]),[i,e]},e.prototype.grid_coords=function(t,e){var r,n,o,i,s,a,l,u,c,p,h,_,d,f,m,g,y,v,b,x,w,k,M,T,S;for(null==e&&(e=!0),c=this.dimension,h=(c+1)%2,b=this.ranges(),v=b[0],s=b[1],x=this.computed_bounds(),M=x[0],u=x[1],S=Math.min(M,u),u=Math.max(M,u),M=S,T=this.ticker.get_ticks(M,u,v,{})[t],g=v.min,m=v.max,o=s.min,n=s.max,i=[[],[]],p=_=0,w=T.length;0<=w?_<w:_>w;p=0<=w?++_:--_)if(T[p]!==g&&T[p]!==m||!e){for(a=[],l=[],r=2,y=d=0,k=r;0<=k?d<k:d>k;y=0<=k?++d:--d)f=o+(n-o)/(r-1)*y,a.push(T[p]),l.push(f);i[c].push(a),i[h].push(l)}return i},e}(i.Model),e.exports={Model:n,View:o}},{"../../core/properties":"core/properties","../renderers/guide_renderer":"models/renderers/guide_renderer","../renderers/renderer":"models/renderers/renderer",underscore:"underscore"}],"models/index":[function(t,e,r){e.exports={Arrow:t("./annotations/arrow"),BoxAnnotation:t("./annotations/box_annotation"),ColorBar:t("./annotations/color_bar"),Label:t("./annotations/label"),LabelSet:t("./annotations/label_set"),Legend:t("./annotations/legend"),LegendItem:t("./annotations/legend_item"),PolyAnnotation:t("./annotations/poly_annotation"),Span:t("./annotations/span"),Title:t("./annotations/title"),Tooltip:t("./annotations/tooltip"),OpenHead:t("./annotations/arrow_head").OpenHead,NormalHead:t("./annotations/arrow_head").NormalHead,VeeHead:t("./annotations/arrow_head").VeeHead,CategoricalAxis:t("./axes/categorical_axis"),DatetimeAxis:t("./axes/datetime_axis"),LinearAxis:t("./axes/linear_axis"),LogAxis:t("./axes/log_axis"),CustomJS:t("./callbacks/customjs"),OpenURL:t("./callbacks/open_url"),BasicTickFormatter:t("./formatters/basic_tick_formatter"),CategoricalTickFormatter:t("./formatters/categorical_tick_formatter"),DatetimeTickFormatter:t("./formatters/datetime_tick_formatter"),LogTickFormatter:t("./formatters/log_tick_formatter"),FuncTickFormatter:t("./formatters/func_tick_formatter"),NumeralTickFormatter:t("./formatters/numeral_tick_formatter"),PrintfTickFormatter:t("./formatters/printf_tick_formatter"),AnnularWedge:t("./glyphs/annular_wedge"),Annulus:t("./glyphs/annulus"),Arc:t("./glyphs/arc"),Bezier:t("./glyphs/bezier"),Circle:t("./glyphs/circle"),Ellipse:t("./glyphs/ellipse"),HBar:t("./glyphs/hbar"),Image:t("./glyphs/image"),ImageRGBA:t("./glyphs/image_rgba"),ImageURL:t("./glyphs/image_url"),Line:t("./glyphs/line"),MultiLine:t("./glyphs/multi_line"),
|
|
Oval:t("./glyphs/oval"),Patch:t("./glyphs/patch"),Patches:t("./glyphs/patches"),Quad:t("./glyphs/quad"),Quadratic:t("./glyphs/quadratic"),Ray:t("./glyphs/ray"),Rect:t("./glyphs/rect"),Segment:t("./glyphs/segment"),Text:t("./glyphs/text"),VBar:t("./glyphs/vbar"),Wedge:t("./glyphs/wedge"),Grid:t("./grids/grid"),Column:t("./layouts/column"),Row:t("./layouts/row"),Spacer:t("./layouts/spacer"),WidgetBox:t("./layouts/widget_box"),CategoricalMapper:t("./mappers/categorical_mapper"),CategoricalColorMapper:t("./mappers/categorical_color_mapper"),GridMapper:t("./mappers/grid_mapper"),LinearColorMapper:t("./mappers/linear_color_mapper"),LinearMapper:t("./mappers/linear_mapper"),LogColorMapper:t("./mappers/log_color_mapper"),LogMapper:t("./mappers/log_mapper"),Transform:t("./transforms/transform"),Jitter:t("./transforms/jitter"),Interpolator:t("./transforms/interpolator"),LinearInterpolator:t("./transforms/linear_interpolator"),StepInterpolator:t("./transforms/step_interpolator"),Asterisk:t("./markers/index").Asterisk,CircleCross:t("./markers/index").CircleCross,CircleX:t("./markers/index").CircleX,Cross:t("./markers/index").Cross,Diamond:t("./markers/index").Diamond,DiamondCross:t("./markers/index").DiamondCross,InvertedTriangle:t("./markers/index").InvertedTriangle,Square:t("./markers/index").Square,SquareCross:t("./markers/index").SquareCross,SquareX:t("./markers/index").SquareX,Triangle:t("./markers/index").Triangle,X:t("./markers/index").X,Plot:t("./plots/plot"),GMapPlot:t("./plots/gmap_plot"),DataRange1d:t("./ranges/data_range1d"),FactorRange:t("./ranges/factor_range"),Range1d:t("./ranges/range1d"),GlyphRenderer:t("./renderers/glyph_renderer"),AjaxDataSource:t("./sources/ajax_data_source"),ColumnDataSource:t("./sources/column_data_source"),GeoJSONDataSource:t("./sources/geojson_data_source"),AdaptiveTicker:t("./tickers/adaptive_ticker"),BasicTicker:t("./tickers/basic_ticker"),CategoricalTicker:t("./tickers/categorical_ticker"),CompositeTicker:t("./tickers/composite_ticker"),ContinuousTicker:t("./tickers/continuous_ticker"),DatetimeTicker:t("./tickers/datetime_ticker"),DaysTicker:t("./tickers/days_ticker"),FixedTicker:t("./tickers/fixed_ticker"),LogTicker:t("./tickers/log_ticker"),MonthsTicker:t("./tickers/months_ticker"),SingleIntervalTicker:t("./tickers/single_interval_ticker"),YearsTicker:t("./tickers/years_ticker"),TileRenderer:t("./tiles/tile_renderer"),TileSource:t("./tiles/tile_source"),TMSTileSource:t("./tiles/tms_tile_source"),WMTSTileSource:t("./tiles/wmts_tile_source"),QUADKEYTileSource:t("./tiles/quadkey_tile_source"),BBoxTileSource:t("./tiles/bbox_tile_source"),DynamicImageRenderer:t("./tiles/dynamic_image_renderer"),ImageSource:t("./tiles/image_source"),ToolEvents:t("./tools/tool_events"),Toolbar:t("./tools/toolbar"),ToolbarBox:t("./tools/toolbar_box"),ButtonTool:t("./tools/button_tool"),ActionTool:t("./tools/actions/action_tool"),ZoomInTool:t("./tools/actions/zoom_in_tool"),ZoomOutTool:t("./tools/actions/zoom_out_tool"),SaveTool:t("./tools/actions/save_tool"),UndoTool:t("./tools/actions/undo_tool"),RedoTool:t("./tools/actions/redo_tool"),ResetTool:t("./tools/actions/reset_tool"),HelpTool:t("./tools/actions/help_tool"),BoxSelectTool:t("./tools/gestures/box_select_tool"),BoxZoomTool:t("./tools/gestures/box_zoom_tool"),GestureTool:t("./tools/gestures/gesture_tool"),LassoSelectTool:t("./tools/gestures/lasso_select_tool"),PanTool:t("./tools/gestures/pan_tool"),PolySelectTool:t("./tools/gestures/poly_select_tool"),SelectTool:t("./tools/gestures/select_tool"),ResizeTool:t("./tools/gestures/resize_tool"),TapTool:t("./tools/gestures/tap_tool"),WheelPanTool:t("./tools/gestures/wheel_pan_tool"),WheelZoomTool:t("./tools/gestures/wheel_zoom_tool"),CrosshairTool:t("./tools/inspectors/crosshair_tool"),HoverTool:t("./tools/inspectors/hover_tool"),InspectTool:t("./tools/inspectors/inspect_tool")}},{"./annotations/arrow":"models/annotations/arrow","./annotations/arrow_head":"models/annotations/arrow_head","./annotations/box_annotation":"models/annotations/box_annotation","./annotations/color_bar":"models/annotations/color_bar","./annotations/label":"models/annotations/label","./annotations/label_set":"models/annotations/label_set","./annotations/legend":"models/annotations/legend","./annotations/legend_item":"models/annotations/legend_item","./annotations/poly_annotation":"models/annotations/poly_annotation","./annotations/span":"models/annotations/span","./annotations/title":"models/annotations/title","./annotations/tooltip":"models/annotations/tooltip","./axes/categorical_axis":"models/axes/categorical_axis","./axes/datetime_axis":"models/axes/datetime_axis","./axes/linear_axis":"models/axes/linear_axis","./axes/log_axis":"models/axes/log_axis","./callbacks/customjs":"models/callbacks/customjs","./callbacks/open_url":"models/callbacks/open_url","./formatters/basic_tick_formatter":"models/formatters/basic_tick_formatter","./formatters/categorical_tick_formatter":"models/formatters/categorical_tick_formatter","./formatters/datetime_tick_formatter":"models/formatters/datetime_tick_formatter","./formatters/func_tick_formatter":"models/formatters/func_tick_formatter","./formatters/log_tick_formatter":"models/formatters/log_tick_formatter","./formatters/numeral_tick_formatter":"models/formatters/numeral_tick_formatter","./formatters/printf_tick_formatter":"models/formatters/printf_tick_formatter","./glyphs/annular_wedge":"models/glyphs/annular_wedge","./glyphs/annulus":"models/glyphs/annulus","./glyphs/arc":"models/glyphs/arc","./glyphs/bezier":"models/glyphs/bezier","./glyphs/circle":"models/glyphs/circle","./glyphs/ellipse":"models/glyphs/ellipse","./glyphs/hbar":"models/glyphs/hbar","./glyphs/image":"models/glyphs/image","./glyphs/image_rgba":"models/glyphs/image_rgba","./glyphs/image_url":"models/glyphs/image_url","./glyphs/line":"models/glyphs/line","./glyphs/multi_line":"models/glyphs/multi_line","./glyphs/oval":"models/glyphs/oval","./glyphs/patch":"models/glyphs/patch","./glyphs/patches":"models/glyphs/patches","./glyphs/quad":"models/glyphs/quad","./glyphs/quadratic":"models/glyphs/quadratic","./glyphs/ray":"models/glyphs/ray","./glyphs/rect":"models/glyphs/rect","./glyphs/segment":"models/glyphs/segment","./glyphs/text":"models/glyphs/text","./glyphs/vbar":"models/glyphs/vbar","./glyphs/wedge":"models/glyphs/wedge","./grids/grid":"models/grids/grid","./layouts/column":"models/layouts/column","./layouts/row":"models/layouts/row","./layouts/spacer":"models/layouts/spacer","./layouts/widget_box":"models/layouts/widget_box","./mappers/categorical_color_mapper":"models/mappers/categorical_color_mapper","./mappers/categorical_mapper":"models/mappers/categorical_mapper","./mappers/grid_mapper":"models/mappers/grid_mapper","./mappers/linear_color_mapper":"models/mappers/linear_color_mapper","./mappers/linear_mapper":"models/mappers/linear_mapper","./mappers/log_color_mapper":"models/mappers/log_color_mapper","./mappers/log_mapper":"models/mappers/log_mapper","./markers/index":"models/markers/index","./plots/gmap_plot":"models/plots/gmap_plot","./plots/plot":"models/plots/plot","./ranges/data_range1d":"models/ranges/data_range1d","./ranges/factor_range":"models/ranges/factor_range","./ranges/range1d":"models/ranges/range1d","./renderers/glyph_renderer":"models/renderers/glyph_renderer","./sources/ajax_data_source":"models/sources/ajax_data_source","./sources/column_data_source":"models/sources/column_data_source","./sources/geojson_data_source":"models/sources/geojson_data_source","./tickers/adaptive_ticker":"models/tickers/adaptive_ticker","./tickers/basic_ticker":"models/tickers/basic_ticker","./tickers/categorical_ticker":"models/tickers/categorical_ticker","./tickers/composite_ticker":"models/tickers/composite_ticker","./tickers/continuous_ticker":"models/tickers/continuous_ticker","./tickers/datetime_ticker":"models/tickers/datetime_ticker","./tickers/days_ticker":"models/tickers/days_ticker","./tickers/fixed_ticker":"models/tickers/fixed_ticker","./tickers/log_ticker":"models/tickers/log_ticker","./tickers/months_ticker":"models/tickers/months_ticker","./tickers/single_interval_ticker":"models/tickers/single_interval_ticker","./tickers/years_ticker":"models/tickers/years_ticker","./tiles/bbox_tile_source":"models/tiles/bbox_tile_source","./tiles/dynamic_image_renderer":"models/tiles/dynamic_image_renderer","./tiles/image_source":"models/tiles/image_source","./tiles/quadkey_tile_source":"models/tiles/quadkey_tile_source","./tiles/tile_renderer":"models/tiles/tile_renderer","./tiles/tile_source":"models/tiles/tile_source","./tiles/tms_tile_source":"models/tiles/tms_tile_source","./tiles/wmts_tile_source":"models/tiles/wmts_tile_source","./tools/actions/action_tool":"models/tools/actions/action_tool","./tools/actions/help_tool":"models/tools/actions/help_tool","./tools/actions/redo_tool":"models/tools/actions/redo_tool","./tools/actions/reset_tool":"models/tools/actions/reset_tool","./tools/actions/save_tool":"models/tools/actions/save_tool","./tools/actions/undo_tool":"models/tools/actions/undo_tool","./tools/actions/zoom_in_tool":"models/tools/actions/zoom_in_tool","./tools/actions/zoom_out_tool":"models/tools/actions/zoom_out_tool","./tools/button_tool":"models/tools/button_tool","./tools/gestures/box_select_tool":"models/tools/gestures/box_select_tool","./tools/gestures/box_zoom_tool":"models/tools/gestures/box_zoom_tool","./tools/gestures/gesture_tool":"models/tools/gestures/gesture_tool","./tools/gestures/lasso_select_tool":"models/tools/gestures/lasso_select_tool","./tools/gestures/pan_tool":"models/tools/gestures/pan_tool","./tools/gestures/poly_select_tool":"models/tools/gestures/poly_select_tool","./tools/gestures/resize_tool":"models/tools/gestures/resize_tool","./tools/gestures/select_tool":"models/tools/gestures/select_tool","./tools/gestures/tap_tool":"models/tools/gestures/tap_tool","./tools/gestures/wheel_pan_tool":"models/tools/gestures/wheel_pan_tool","./tools/gestures/wheel_zoom_tool":"models/tools/gestures/wheel_zoom_tool","./tools/inspectors/crosshair_tool":"models/tools/inspectors/crosshair_tool","./tools/inspectors/hover_tool":"models/tools/inspectors/hover_tool","./tools/inspectors/inspect_tool":"models/tools/inspectors/inspect_tool","./tools/tool_events":"models/tools/tool_events","./tools/toolbar":"models/tools/toolbar","./tools/toolbar_box":"models/tools/toolbar_box","./transforms/interpolator":"models/transforms/interpolator","./transforms/jitter":"models/transforms/jitter","./transforms/linear_interpolator":"models/transforms/linear_interpolator","./transforms/step_interpolator":"models/transforms/step_interpolator","./transforms/transform":"models/transforms/transform"}],"models/layouts/box":[function(t,e,r){var n,o,i,s,a,l,u,c,p,h,_,d=function(t,e){function r(){this.constructor=t}for(var n in e)f.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},f={}.hasOwnProperty,m=[].indexOf||function(t){for(var e=0,r=this.length;e<r;e++)if(e in this&&this[e]===t)return e;return-1};p=t("underscore"),_=t("../../core/layout/solver"),i=_.EQ,s=_.GE,l=_.Strength,u=_.Variable,c=_.WEAK_EQ,h=t("../../core/properties"),a=t("./layout_dom"),o=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return d(e,t),e.prototype.className="bk-grid",e.prototype.bind_bokeh_events=function(){return e.__super__.bind_bokeh_events.call(this),this.listenTo(this.model,"change:children",this.build_child_views)},e.prototype.get_height=function(){var t,e,r;return e=this.model.get_layoutable_children(),t=p.map(e,function(t){return t._height._value}),r=this.model._horizontal?p.reduce(t,function(t,e){return Math.max(t,e)}):p.reduce(t,function(t,e){return t+e})},e.prototype.get_width=function(){var t,e,r;return e=this.model.get_layoutable_children(),t=p.map(e,function(t){return t._width._value}),r=this.model._horizontal?p.reduce(t,function(t,e){return t+e}):p.reduce(t,function(t,e){return Math.max(t,e)})},e}(a.View),n=function(t){function e(t,r){e.__super__.constructor.call(this,t,r),this._child_equal_size_width=new u,this._child_equal_size_height=new u,this._box_equal_size_top=new u,this._box_equal_size_bottom=new u,this._box_equal_size_left=new u,this._box_equal_size_right=new u,this._box_cell_align_top=new u,this._box_cell_align_bottom=new u,this._box_cell_align_left=new u,this._box_cell_align_right=new u}return d(e,t),e.prototype.default_view=o,e.define({children:[h.Array,[]]}),e.internal({spacing:[h.Number,6]}),e.prototype.get_layoutable_children=function(){return this.children},e.prototype.variables_updated=function(){var t,e,r,n;for(n=this.get_layoutable_children(),e=0,r=n.length;e<r;e++)t=n[e],t.trigger("change");return this.trigger("change")},e.prototype.get_edit_variables=function(){var t,r,n,o,i;for(r=e.__super__.get_edit_variables.call(this),i=this.get_layoutable_children(),n=0,o=i.length;n<o;n++)t=i[n],r=r.concat(t.get_edit_variables());return r},e.prototype.get_constrained_variables=function(){var t;return t=e.__super__.get_constrained_variables.call(this),t=p.extend(t,{"box-equal-size-top":this._box_equal_size_top,"box-equal-size-bottom":this._box_equal_size_bottom,"box-equal-size-left":this._box_equal_size_left,"box-equal-size-right":this._box_equal_size_right,"box-cell-align-top":this._box_cell_align_top,"box-cell-align-bottom":this._box_cell_align_bottom,"box-cell-align-left":this._box_cell_align_left,"box-cell-align-right":this._box_cell_align_right})},e.prototype.get_constraints=function(){var t,e,r,n,o,a,l,u,h,_,d,f,m;if(r=[],e=this.get_layoutable_children(),0===e.length)return r;for(o=0,u=e.length;o<u;o++)t=e[o],this._test_layoutable(t),m=t.get_constrained_variables(),f=p.keys(m),_=this._child_rect(m),this._horizontal?this._has_var("height",f)&&r.push(i(_.height,[-1,this._height])):this._has_var("width",f)&&r.push(i(_.width,[-1,this._width])),this._horizontal?this._has_var(["box-equal-size-left","box-equal-size-right","width"],f)&&r.push(i([-1,m["box-equal-size-left"]],[-1,m["box-equal-size-right"]],m.width,this._child_equal_size_width)):this._has_var(["box-equal-size-top","box-equal-size-bottom","height"],f)&&r.push(i([-1,m["box-equal-size-top"]],[-1,m["box-equal-size-bottom"]],m.height,this._child_equal_size_height)),r=r.concat(t.get_constraints());for(l=this._info(e[0].get_constrained_variables()),r.push(i(l.span.start,0)),n=a=1,d=e.length;1<=d?a<d:a>d;n=1<=d?++a:--a)h=this._info(e[n].get_constrained_variables()),l.span.size&&r.push(i(l.span.start,l.span.size,[-1,h.span.start])),r.push(c(l.whitespace.after,h.whitespace.before,0-this.spacing)),r.push(s(l.whitespace.after,h.whitespace.before,0-this.spacing)),l=h;return this._horizontal?this._has_var("width",f)&&r.push(i(l.span.start,l.span.size,[-1,this._width])):this._has_var("height",f)&&r.push(i(l.span.start,l.span.size,[-1,this._height])),r=r.concat(this._align_outer_edges_constraints(!0)),r=r.concat(this._align_outer_edges_constraints(!1)),r=r.concat(this._align_inner_cell_edges_constraints()),r=r.concat(this._box_equal_size_bounds(!0)),r=r.concat(this._box_equal_size_bounds(!1)),r=r.concat(this._box_cell_align_bounds(!0)),r=r.concat(this._box_cell_align_bounds(!1)),r=r.concat(this._box_whitespace(!0)),r=r.concat(this._box_whitespace(!1))},e.prototype._has_var=function(t,e){var r;return r="string"==typeof t?[t]:t,p.every(r,function(t){return m.call(e,t)>=0})},e.prototype._test_layoutable=function(t){var e,r,n,o,i;if(o=["origin-x","origin-y","whitespace-top","whitespace-right","whitespace-bottom","whitespace-left"],null==t.get_constrained_variables)throw new Error(t+" is missing get_constrained_variables method");for(i=t.get_constrained_variables(),e=0,n=o.length;e<n;e++){if(r=o[e],m.call(p.keys(i),r)<0)throw new Error(t+" is missing constrained_variable "+r);if(!i[r]instanceof u)throw new Error(t+" "+r+" is not a solver Variable")}return!0},e.prototype._child_rect=function(t){var e,r,n,o,i;return n=t.width,e=t.height,r=[t["origin-x"],t["origin-y"]],o=r[0],i=r[1],{x:o,y:i,width:n,height:e}},e.prototype._span=function(t){return this._horizontal?{start:t.x,size:t.width}:{start:t.y,size:t.height}},e.prototype._info=function(t){var e,r;return r=this._horizontal?{before:t["whitespace-left"],after:t["whitespace-right"]}:{before:t["whitespace-top"],after:t["whitespace-bottom"]},e=this._span(this._child_rect(t)),{span:e,whitespace:r}},e.prototype._flatten_cell_edge_variables=function(t){var r,n,o,i,s,a,l,u,c,p,h,_,d,f,m,g,y,v,b,x,w;for(x=t?e._top_bottom_inner_cell_edge_variables:e._left_right_inner_cell_edge_variables,r=t!==this._horizontal,l=this.get_layoutable_children(),o=l.length,c={},i=0,p=0,f=l.length;p<f;p++){for(a=l[p],s=a instanceof e?a._flatten_cell_edge_variables(t):{},n=a.get_constrained_variables(),h=0,m=x.length;h<m;h++)g=x[h],g in n&&(s[g]=[n[g]]);for(_ in s)w=s[_],r?(v=_.split(" "),d=v[0],b=v.length>1?v[1]:"",u=this._horizontal?"row":"col",y=d+" "+u+"-"+o+"-"+i+"-"+b):y=_,y in c?c[y]=c[y].concat(w):c[y]=w;i+=1}return c},e.prototype._align_inner_cell_edges_constraints=function(){var t,e,r,n,o,s,a,l;if(t=[],this._is_root){e=this._flatten_cell_edge_variables(this._horizontal);for(o in e)if(l=e[o],l.length>1)for(s=l[0],r=n=1,a=l.length;1<=a?n<a:n>a;r=1<=a?++n:--n)t.push(i(l[r],[-1,s]))}return t},e.prototype._find_edge_leaves=function(t){var r,n,o,i,s,a,l,u;if(o=this.get_layoutable_children(),a=[[],[]],o.length>0)if(this._horizontal===t)u=o[0],i=o[o.length-1],u instanceof e?a[0]=a[0].concat(u._find_edge_leaves(t)[0]):a[0].push(u),i instanceof e?a[1]=a[1].concat(i._find_edge_leaves(t)[1]):a[1].push(i);else for(s=0,l=o.length;s<l;s++)r=o[s],r instanceof e?(n=r._find_edge_leaves(t),a[0]=a[0].concat(n[0]),a[1]=a[1].concat(n[1])):(a[0].push(r),a[1].push(r));return a},e.prototype._align_outer_edges_constraints=function(t){var e,r,n,o,s,a,l,u,c,p;return a=this._find_edge_leaves(t),c=a[0],o=a[1],t?(p="on-edge-align-left",s="on-edge-align-right"):(p="on-edge-align-top",s="on-edge-align-bottom"),r=function(t,e){var r,n,o,i,s;for(r=[],n=0,i=t.length;n<i;n++)o=t[n],s=o.get_constrained_variables(),e in s&&r.push(s[e]);return r},u=r(c,p),n=r(o,s),l=[],e=function(t){var e,r,n,o,s;if(t.length>1){for(r=t[0],n=o=1,s=t.length;1<=s?o<s:o>s;n=1<=s?++o:--o)e=t[n],l.push(i([-1,r],e));return null}},e(u),e(n),l},e.prototype._box_insets_from_child_insets=function(t,e,r,n){var o,a,l,u,c,p,h,_,d;return p=this._find_edge_leaves(t),_=p[0],a=p[1],t?(d=e+"-left",l=e+"-right",c=this[r+"_left"],u=this[r+"_right"]):(d=e+"-top",l=e+"-bottom",c=this[r+"_top"],u=this[r+"_bottom"]),h=[],o=function(t,e,r){var o,a,l,u,c;for(o=[],a=0,u=e.length;a<u;a++)l=e[a],c=l.get_constrained_variables(),r in c&&(n?h.push(s([-1,t],c[r])):h.push(i([-1,t],c[r])));return null},o(c,_,d),o(u,a,l),h},e.prototype._box_equal_size_bounds=function(t){return this._box_insets_from_child_insets(t,"box-equal-size","_box_equal_size",!1)},e.prototype._box_cell_align_bounds=function(t){return this._box_insets_from_child_insets(t,"box-cell-align","_box_cell_align",!1)},e.prototype._box_whitespace=function(t){return this._box_insets_from_child_insets(t,"whitespace","_whitespace",!0)},e._left_right_inner_cell_edge_variables=["box-cell-align-left","box-cell-align-right"],e._top_bottom_inner_cell_edge_variables=["box-cell-align-top","box-cell-align-bottom"],e}(a.Model),e.exports={Model:n,View:o}},{"../../core/layout/solver":"core/layout/solver","../../core/properties":"core/properties","./layout_dom":"models/layouts/layout_dom",underscore:"underscore"}],"models/layouts/column":[function(t,e,r){var n,o,i,s=function(t,e){function r(){this.constructor=t}for(var n in e)a.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},a={}.hasOwnProperty;n=t("./box"),i=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return s(e,t),e.prototype.className="bk-grid-column",e}(n.View),o=function(t){function e(t,r){e.__super__.constructor.call(this,t,r),this._horizontal=!1}return s(e,t),e.prototype.type="Column",e.prototype.default_view=i,e}(n.Model),e.exports={View:i,Model:o}},{"./box":"models/layouts/box"}],"models/layouts/layout_dom":[function(t,e,r){var n,o,i,s,a,l,u,c,p,h,_,d,f,m,g=function(t,e){function r(){this.constructor=t}for(var n in e)y.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},y={}.hasOwnProperty;h=t("underscore"),n=t("jquery"),u=t("../../model"),f=t("../../core/properties"),m=t("../../core/layout/solver"),s=m.GE,i=m.EQ,c=m.Strength,p=m.Variable,_=t("../../core/build_views"),o=t("../../core/bokeh_view"),d=t("../../core/logging").logger,l=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return g(e,t),e.prototype.initialize=function(t){return e.__super__.initialize.call(this,t),this.$el.attr("id","modelid_"+this.model.id),this.$el.addClass("bk-layout-"+this.model.sizing_mode),this.child_views={},this.build_child_views(!1)},e.prototype.build_child_views=function(t){var e,r,n,o,i;for(null==t&&(t=!0),this.unbind_bokeh_events(),t&&(this.model.document._invalidate_all_models(),this.model.document._init_solver()),n=this.model.get_layoutable_children(),this.child_views={},_(this.child_views,n),this.$el.empty(),o=0,i=n.length;o<i;o++)e=n[o],r=this.child_views[e.id],this.$el.append(r.$el);return this.bind_bokeh_events()},e.prototype.unbind_bokeh_events=function(){var t,e,r,n;this.stopListening(),e=this.child_views,r=[];for(t in e)n=e[t],n.stopListening(),r.push("function"==typeof n.unbind_bokeh_events?n.unbind_bokeh_events():void 0);return r},e.prototype.bind_bokeh_events=function(){var t;return this.listenTo(this.model,"change",this.render),"fixed"===this.model.sizing_mode?this.listenToOnce(this.model.document.solver(),"resize",function(t){return function(){return t.render()}}(this)):this.listenTo(this.model.document.solver(),"resize",function(t){return function(){return t.render()}}(this)),t="Changing sizing_mode after initialization is not currently supported.",this.listenTo(this.model,"change:sizing_mode",function(){return d.warn(t)})},e.prototype.render=function(){var t,e,r;if(e=this.model.document.solver(),"fixed"===this.model.sizing_mode&&(null!=this.model.width?r=this.model.width:(r=this.get_width(),this.model.width=r),null!=this.model.height?t=this.model.height:(t=this.get_height(),this.model.height=t),e.suggest_value(this.model._width,r),e.suggest_value(this.model._height,t),e.update_variables(),this.$el.css({width:r,height:t})),"scale_width"===this.model.sizing_mode&&(t=this.get_height(),e.suggest_value(this.model._height,t),e.update_variables(),this.$el.css({width:this.model._width._value,height:this.model._height._value})),"scale_height"===this.model.sizing_mode&&(r=this.get_width(),e.suggest_value(this.model._width,r),e.update_variables(),this.$el.css({width:this.model._width._value,height:this.model._height._value})),"stretch_both"===this.model.sizing_mode)return this.$el.css({position:"absolute",left:this.model._dom_left._value,top:this.model._dom_top._value,width:this.model._width._value,height:this.model._height._value})},e.prototype.get_height=function(){return null},e.prototype.get_width=function(){return null},e}(o),a=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return g(e,t),e.prototype.type="LayoutDOM",e.prototype.initialize=function(t,r){return e.__super__.initialize.call(this,t,r),this._width=new p("_width "+this.id),this._height=new p("_height "+this.id),this._left=new p("_left "+this.id),this._right=new p("_right "+this.id),this._top=new p("_top "+this.id),this._bottom=new p("_bottom "+this.id),this._dom_top=new p("_dom_top "+this.id),this._dom_left=new p("_dom_left "+this.id),this._width_minus_right=new p("_width_minus_right "+this.id),this._height_minus_bottom=new p("_height_minus_bottom "+this.id),this._whitespace_top=new p,this._whitespace_bottom=new p,this._whitespace_left=new p,this._whitespace_right=new p},e.prototype.get_constraints=function(){var t;return t=[],t.push(s(this._dom_left)),t.push(s(this._dom_top)),t.push(s(this._left)),t.push(s(this._width,[-1,this._right])),t.push(s(this._top)),t.push(s(this._height,[-1,this._bottom])),t.push(i(this._width_minus_right,[-1,this._width],this._right)),t.push(i(this._height_minus_bottom,[-1,this._height],this._bottom)),t},e.prototype.get_layoutable_children=function(){return[]},e.prototype.get_edit_variables=function(){var t;return t=[],"fixed"===this.sizing_mode&&(t.push({edit_variable:this._height,strength:c.strong}),t.push({edit_variable:this._width,strength:c.strong})),"scale_width"===this.sizing_mode&&t.push({edit_variable:this._height,strength:c.strong}),"scale_height"===this.sizing_mode&&t.push({edit_variable:this._width,strength:c.strong}),t},e.prototype.get_constrained_variables=function(){var t;return t={"origin-x":this._dom_left,"origin-y":this._dom_top,"whitespace-top":this._whitespace_top,"whitespace-bottom":this._whitespace_bottom,"whitespace-left":this._whitespace_left,"whitespace-right":this._whitespace_right},"stretch_both"===this.sizing_mode&&(t=h.extend(t,{width:this._width,height:this._height})),"scale_width"===this.sizing_mode&&(t=h.extend(t,{width:this._width})),"scale_height"===this.sizing_mode&&(t=h.extend(t,{height:this._height})),t},e.define({height:[f.Number],width:[f.Number],disabled:[f.Bool,!1],sizing_mode:[f.SizingMode,"fixed"]}),e.internal({layoutable:[f.Bool,!0]}),e}(u),e.exports={Model:a,View:l}},{"../../core/bokeh_view":"core/bokeh_view","../../core/build_views":"core/build_views","../../core/layout/solver":"core/layout/solver","../../core/logging":"core/logging","../../core/properties":"core/properties","../../model":"model",jquery:"jquery",underscore:"underscore"}],"models/layouts/row":[function(t,e,r){var n,o,i,s=function(t,e){function r(){this.constructor=t}for(var n in e)a.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},a={}.hasOwnProperty;n=t("./box"),i=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return s(e,t),e.prototype.className="bk-grid-row",e}(n.View),o=function(t){function e(t,r){e.__super__.constructor.call(this,t,r),this._horizontal=!0}return s(e,t),e.prototype.type="Row",e.prototype.default_view=i,e}(n.Model),e.exports={View:i,Model:o}},{"./box":"models/layouts/box"}],"models/layouts/spacer":[function(t,e,r){var n,o,i,s,a=function(t,e){function r(){this.constructor=t}for(var n in e)l.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},l={}.hasOwnProperty;s=t("underscore"),n=t("./layout_dom"),i=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return a(e,t),e.prototype.className="bk-spacer-box",e.prototype.render=function(){if(e.__super__.render.call(this),"fixed"===this.sizing_mode)return this.$el.css({width:this.model.width,height:this.model.height})},e.prototype.get_height=function(){return 1},e}(n.View),o=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return a(e,t),e.prototype.type="Spacer",e.prototype.default_view=i,e.prototype.get_constrained_variables=function(){var t;return t=e.__super__.get_constrained_variables.call(this),t=s.extend(t,{"on-edge-align-top":this._top,"on-edge-align-bottom":this._height_minus_bottom,"on-edge-align-left":this._left,"on-edge-align-right":this._width_minus_right,"box-cell-align-top":this._top,"box-cell-align-bottom":this._height_minus_bottom,"box-cell-align-left":this._left,"box-cell-align-right":this._width_minus_right,"box-equal-size-top":this._top,"box-equal-size-bottom":this._height_minus_bottom,"box-equal-size-left":this._left,"box-equal-size-right":this._width_minus_right})},e}(n.Model),e.exports={Model:o}},{"./layout_dom":"models/layouts/layout_dom",underscore:"underscore"}],"models/layouts/widget_box":[function(t,e,r){var n,o,i,s,a,l,u,c,p,h,_,d,f,m,g,y=function(t,e){function r(){this.constructor=t}for(var n in e)v.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},v={}.hasOwnProperty;_=t("underscore"),n=t("jquery"),d=t("../../core/build_views"),o=t("../../core/bokeh_view"),g=t("../../core/layout/solver"),c=g.WEAK_EQ,s=g.GE,i=g.EQ,l=g.Strength,u=g.Variable,f=t("../../core/logging").logger,m=t("../../core/properties"),a=t("../layouts/layout_dom"),h=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return y(e,t),e.prototype.className="bk-widget-box",e.prototype.initialize=function(t){return e.__super__.initialize.call(this,t),this.render()},e.prototype.bind_bokeh_events=function(){return e.__super__.bind_bokeh_events.call(this),this.listenTo(this.model,"change:children",function(t){return function(){return t.build_child_views()}}(this))},e.prototype.render=function(){var t,e,r,n;return r=this.model.document.solver(),"fixed"!==this.model.sizing_mode&&"scale_height"!==this.model.sizing_mode||(n=this.get_width(),this.model._width._value!==n&&(r.suggest_value(this.model._width,n),r.update_variables())),"fixed"!==this.model.sizing_mode&&"scale_width"!==this.model.sizing_mode||(e=this.get_height(),this.model._height._value!==e&&(r.suggest_value(this.model._height,e),r.update_variables())),t=this.model._width._value-20>0?this.model._width._value-20:"100%","stretch_both"===this.model.sizing_mode?this.$el.css({position:"absolute",left:this.model._dom_left._value,top:this.model._dom_top._value,width:this.model._width._value,height:this.model._height._value}):this.$el.css({width:t})},e.prototype.get_height=function(){var t,e,r,n;e=0,n=this.child_views;for(r in n)v.call(n,r)&&(t=n[r],e+=t.el.scrollHeight);return e+20},e.prototype.get_width=function(){var t,e,r,n,o;if(null!=this.model.width)return this.model.width;o=this.el.scrollWidth+20,n=this.child_views;for(r in n)v.call(n,r)&&(t=n[r],e=t.el.scrollWidth,e>o&&(o=e));return o},e}(a.View),p=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return y(e,t),e.prototype.type="WidgetBox",e.prototype.default_view=h,e.prototype.initialize=function(t){if(e.__super__.initialize.call(this,t),"fixed"===this.sizing_mode&&null===this.width&&(this.width=300,f.info("WidgetBox mode is fixed, but no width specified. Using default of 300.")),"scale_height"===this.sizing_mode)return f.warn("sizing_mode `scale_height` is not experimental for WidgetBox. Please report your results to the bokeh dev team so we can improve.")},e.prototype.get_edit_variables=function(){var t,r,n,o,i;for(r=e.__super__.get_edit_variables.call(this),i=this.get_layoutable_children(),n=0,o=i.length;n<o;n++)t=i[n],r=r.concat(t.get_edit_variables());return r},e.prototype.get_constraints=function(){var t,r,n,o,i;for(r=e.__super__.get_constraints.call(this),i=this.get_layoutable_children(),n=0,o=i.length;n<o;n++)t=i[n],r=r.concat(t.get_constraints());return r},e.prototype.get_constrained_variables=function(){var t;return t=e.__super__.get_constrained_variables.call(this),t=_.extend(t,{"on-edge-align-top":this._top,"on-edge-align-bottom":this._height_minus_bottom,"on-edge-align-left":this._left,"on-edge-align-right":this._width_minus_right,"box-cell-align-top":this._top,"box-cell-align-bottom":this._height_minus_bottom,"box-cell-align-left":this._left,"box-cell-align-right":this._width_minus_right,"box-equal-size-top":this._top,"box-equal-size-bottom":this._height_minus_bottom}),"fixed"!==this.sizing_mode&&(t=_.extend(t,{"box-equal-size-left":this._left,"box-equal-size-right":this._width_minus_right})),t},e.prototype.get_layoutable_children=function(){return this.children},e.define({children:[m.Array,[]]}),e}(a.Model),e.exports={Model:p}},{"../../core/bokeh_view":"core/bokeh_view","../../core/build_views":"core/build_views","../../core/layout/solver":"core/layout/solver","../../core/logging":"core/logging","../../core/properties":"core/properties","../layouts/layout_dom":"models/layouts/layout_dom",jquery:"jquery",underscore:"underscore"}],"models/mappers/categorical_color_mapper":[function(t,e,r){var n,o,i,s,a=function(t,e){
|
|
function r(){this.constructor=t}for(var n in e)l.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},l={}.hasOwnProperty;i=t("underscore"),s=t("../../core/properties"),o=t("./color_mapper"),n=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return a(e,t),e.prototype.type="CategoricalColorMapper",e.define({factors:[s.Array]}),e.prototype._get_values=function(t,e){var r,n,o,i,s,a;for(a=[],o=0,s=t.length;o<s;o++)n=t[o],i=this.factors.indexOf(n),r=i<0||i>=e.length?this.nan_color:e[i],a.push(r);return a},e}(o.Model),e.exports={Model:n}},{"../../core/properties":"core/properties","./color_mapper":"models/mappers/color_mapper",underscore:"underscore"}],"models/mappers/categorical_mapper":[function(t,e,r){var n,o,i,s=function(t,e){function r(){this.constructor=t}for(var n in e)a.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},a={}.hasOwnProperty;i=t("underscore"),o=t("./linear_mapper"),n=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return s(e,t),e.prototype.map_to_target=function(t,r){var n,o,s,a,l,u;return null==r&&(r=!1),i.isNumber(t)?r?t:e.__super__.map_to_target.call(this,t):(a=this.source_range,o=a.factors,t.indexOf(":")>=0?(l=t.split(":"),n=l[0],s=l[1],s=parseFloat(s),u=o.indexOf(n)+.5+a.offset+s):u=o.indexOf(t)+1+a.offset,r?u:e.__super__.map_to_target.call(this,u))},e.prototype.v_map_to_target=function(t,r){var n,o,s,a,l,u,c,p,h,_;if(null==r&&(r=!1),i.isNumber(t[0]))return r?t:e.__super__.v_map_to_target.call(this,t);for(u=this.source_range,o=u.factors,h=Array(t.length),s=a=0,c=t.length;0<=c?a<c:a>c;s=0<=c?++a:--a)_=t[s],_.indexOf(":")>=0?(p=_.split(":"),n=p[0],l=p[1],l=parseFloat(l),h[s]=o.indexOf(n)+.5+u.offset+l):h[s]=o.indexOf(_)+1+u.offset;return r?h:e.__super__.v_map_to_target.call(this,h)},e.prototype.map_from_target=function(t,r){var n,o;return null==r&&(r=!1),t=e.__super__.map_from_target.call(this,t),r?t:(o=this.source_range,n=o.factors,n[Math.floor(t-.5-o.offset)])},e.prototype.v_map_from_target=function(t,r){var n,o,i,s,a,l,u,c,p;for(null==r&&(r=!1),p=e.__super__.v_map_from_target.call(this,t),o=i=0,l=p.length;0<=l?i<l:i>l;o=0<=l?++i:--i)p[o]=p[o];if(r)return p;for(c=Array(p),a=this.source_range,n=a.factors,o=s=0,u=t.length;0<=u?s<u:s>u;o=0<=u?++s:--s)c[o]=n[Math.floor(p[o]-.5-a.offset)];return c},e}(o.Model),e.exports={Model:n}},{"./linear_mapper":"models/mappers/linear_mapper",underscore:"underscore"}],"models/mappers/color_mapper":[function(t,e,r){var n,o,i,s,a=function(t,e){function r(){this.constructor=t}for(var n in e)l.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},l={}.hasOwnProperty;i=t("underscore"),s=t("../../core/properties"),o=t("../../model"),n=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return a(e,t),e.prototype.type="ColorMapper",e.define({palette:[s.Any],nan_color:[s.Color,"gray"]}),e.prototype.initialize=function(t,r){return e.__super__.initialize.call(this,t,r),this._little_endian=this._is_little_endian(),this._palette=this._build_palette(this.palette),this.listenTo(this,"change",function(){return this._palette=this._build_palette(this.palette)})},e.prototype.v_map_screen=function(t){var e,r,n,o,i,s,a,l,u;if(u=this._get_values(t,this._palette),e=new ArrayBuffer(4*t.length),r=new Uint32Array(e),this._little_endian)for(n=o=0,s=t.length;0<=s?o<s:o>s;n=0<=s?++o:--o)l=u[n],r[n]=255<<24|(16711680&l)>>16|65280&l|(255&l)<<16;else for(n=i=0,a=t.length;0<=a?i<a:i>a;n=0<=a?++i:--i)l=u[n],r[n]=l<<8|255;return e},e.prototype.compute=function(t){return null},e.prototype.v_compute=function(t){var e;return e=this._get_values(t,this.palette)},e.prototype._get_values=function(t,e){return[]},e.prototype._is_little_endian=function(){var t,e,r,n;return t=new ArrayBuffer(4),r=new Uint8ClampedArray(t),e=new Uint32Array(t),e[1]=168496141,n=!0,10===r[4]&&11===r[5]&&12===r[6]&&13===r[7]&&(n=!1),n},e.prototype._build_palette=function(t){var e,r,n,o,s;for(o=new Uint32Array(t.length),e=function(t){return i.isNumber(t)?t:parseInt(t.slice(1),16)},r=n=0,s=t.length;0<=s?n<s:n>s;r=0<=s?++n:--n)o[r]=e(t[r]);return o},e}(o),e.exports={Model:n}},{"../../core/properties":"core/properties","../../model":"model",underscore:"underscore"}],"models/mappers/grid_mapper":[function(t,e,r){var n,o,i=function(t,e){function r(){this.constructor=t}for(var n in e)s.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},s={}.hasOwnProperty;o=t("../../model"),n=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return i(e,t),e.prototype.map_to_target=function(t,e){var r,n;return r=this.domain_mapper.map_to_target(t),n=this.codomain_mapper.map_to_target(e),[r,n]},e.prototype.v_map_to_target=function(t,e){var r,n;return r=this.domain_mapper.v_map_to_target(t),n=this.codomain_mapper.v_map_to_target(e),[r,n]},e.prototype.map_from_target=function(t,e){var r,n;return r=this.domain_mapper.map_from_target(t),n=this.codomain_mapper.map_from_target(e),[r,n]},e.prototype.v_map_from_target=function(t,e){var r,n;return r=this.domain_mapper.v_map_from_target(t),n=this.codomain_mapper.v_map_from_target(e),[r,n]},e}(o),e.exports={Model:n}},{"../../model":"model"}],"models/mappers/linear_color_mapper":[function(t,e,r){var n,o,i,s,a=function(t,e){function r(){this.constructor=t}for(var n in e)l.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},l={}.hasOwnProperty;i=t("underscore"),s=t("../../core/properties"),n=t("./color_mapper"),o=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return a(e,t),e.prototype.type="LinearColorMapper",e.define({high:[s.Number],low:[s.Number],high_color:[s.Color],low_color:[s.Color]}),e.prototype._get_values=function(t,e){var r,n,o,s,a,l,u,c,p,h,_,d,f;for(l=null!=(_=this.low)?_:i.min(t),n=null!=(d=this.high)?d:i.max(t),u=e.length-1,f=[],c=1/(n-l),h=1/e.length,o=0,a=t.length;o<a;o++)r=t[o],isNaN(r)?f.push(this.nan_color):r!==n?(p=(r-l)*c,s=Math.floor(p/h),s<0?null!=this.low_color?f.push(this.low_color):f.push(e[0]):s>u?null!=this.high_color?f.push(this.high_color):f.push(e[u]):f.push(e[s])):f.push(e[u]);return f},e}(n.Model),e.exports={Model:o}},{"../../core/properties":"core/properties","./color_mapper":"models/mappers/color_mapper",underscore:"underscore"}],"models/mappers/linear_mapper":[function(t,e,r){var n,o,i,s=function(t,e){function r(){this.constructor=t}for(var n in e)a.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},a={}.hasOwnProperty;o=t("../../model"),i=t("../../core/properties"),n=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return s(e,t),e.prototype.initialize=function(t,r){return e.__super__.initialize.call(this,t,r),this.define_computed_property("mapper_state",this._mapper_state,!0),this.add_dependencies("mapper_state",this,["source_range","target_range"]),this.add_dependencies("mapper_state",this.source_range,["start","end"]),this.add_dependencies("mapper_state",this.target_range,["start","end"])},e.getters({mapper_state:function(){return this._get_computed("mapper_state")}}),e.prototype.map_to_target=function(t){var e,r,n;return r=this.mapper_state,n=r[0],e=r[1],n*t+e},e.prototype.v_map_to_target=function(t){var e,r,n,o,i,s,a,l;for(i=this.mapper_state,a=i[0],o=i[1],s=new Float64Array(t.length),r=e=0,n=t.length;e<n;r=++e)l=t[r],s[r]=a*l+o;return s},e.prototype.map_from_target=function(t){var e,r,n;return r=this.mapper_state,n=r[0],e=r[1],(t-e)/n},e.prototype.v_map_from_target=function(t){var e,r,n,o,i,s,a,l;for(i=this.mapper_state,a=i[0],o=i[1],s=new Float64Array(t.length),r=e=0,n=t.length;e<n;r=++e)l=t[r],s[r]=(l-o)/a;return s},e.prototype._mapper_state=function(){var t,e,r,n,o,i;return n=this.source_range.start,r=this.source_range.end,i=this.target_range.start,o=this.target_range.end,e=(o-i)/(r-n),t=-(e*n)+i,[e,t]},e.internal({source_range:[i.Any],target_range:[i.Any]}),e}(o),e.exports={Model:n}},{"../../core/properties":"core/properties","../../model":"model"}],"models/mappers/log_color_mapper":[function(t,e,r){var n,o,i,s,a,l,u=function(t,e){function r(){this.constructor=t}for(var n in e)c.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},c={}.hasOwnProperty;i=t("underscore"),a=t("../../core/properties"),n=t("./color_mapper"),s=null!=(l=Math.log1p)?l:function(t){return Math.log(1+t)},o=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return u(e,t),e.prototype.type="LogColorMapper",e.define({high:[a.Number],low:[a.Number],high_color:[a.Color],low_color:[a.Color]}),e.prototype._get_values=function(t,e){var r,n,o,a,l,u,c,p,h,_,d,f,m;for(h=e.length,c=null!=(_=this.low)?_:i.min(t),n=null!=(d=this.high)?d:i.max(t),f=h/(s(n)-s(c)),p=e.length-1,m=[],o=0,l=t.length;o<l;o++)r=t[o],isNaN(r)?m.push(this.nan_color):r>n?null!=this.high_color?m.push(this.high_color):m.push(e[p]):r!==n?r<c?null!=this.low_color?m.push(this.low_color):m.push(e[0]):(u=s(r)-s(c),a=Math.floor(u*f),a>p&&(a=p),m.push(e[a])):m.push(e[p]);return m},e}(n.Model),e.exports={Model:o}},{"../../core/properties":"core/properties","./color_mapper":"models/mappers/color_mapper",underscore:"underscore"}],"models/mappers/log_mapper":[function(t,e,r){var n,o,i,s=function(t,e){function r(){this.constructor=t}for(var n in e)a.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},a={}.hasOwnProperty;o=t("../../model"),i=t("../../core/properties"),n=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return s(e,t),e.prototype.initialize=function(t,r){return e.__super__.initialize.call(this,t,r),this.define_computed_property("mapper_state",this._mapper_state,!0),this.add_dependencies("mapper_state",this,["source_range","target_range"]),this.add_dependencies("mapper_state",this.source_range,["start","end"]),this.add_dependencies("mapper_state",this.target_range,["start","end"])},e.getters({mapper_state:function(){return this._get_computed("mapper_state")}}),e.prototype.map_to_target=function(t){var e,r,n,o,i,s,a;return i=this.mapper_state,a=i[0],o=i[1],r=i[2],e=i[3],s=0,0===r?n=0:(n=(Math.log(t)-e)/r,!isNaN(n)&&isFinite(n)||(n=0)),s=n*a+o},e.prototype.v_map_to_target=function(t){var e,r,n,o,i,s,a,l,u,c,p,h,_;if(c=this.mapper_state,h=c[0],u=c[1],n=c[2],r=c[3],p=new Float64Array(t.length),0===n)o=t.map(function(t){return 0});else for(o=t.map(function(t){return(Math.log(t)-r)/n}),e=i=0,a=o.length;i<a;e=++i)_=o[e],!isNaN(o[e])&&isFinite(o[e])||(o[e]=0);for(e=s=0,l=t.length;s<l;e=++s)_=t[e],p[e]=o[e]*h+u;return p},e.prototype.map_from_target=function(t){var e,r,n,o,i,s;return i=this.mapper_state,s=i[0],o=i[1],r=i[2],e=i[3],n=(t-o)/s,n=Math.exp(r*n+e)},e.prototype.v_map_from_target=function(t){var e,r,n,o,i,s,a,l,u,c,p;for(u=new Float64Array(t.length),l=this.mapper_state,c=l[0],a=l[1],n=l[2],r=l[3],o=t.map(function(t){return(t-a)/c}),e=i=0,s=t.length;i<s;e=++i)p=t[e],u[e]=Math.exp(n*o[e]+r);return u},e.prototype._get_safe_scale=function(t,e){var r,n,o,i;return i=t<0?0:t,r=e<0?0:e,i===r&&(0===i?(o=[1,10],i=o[0],r=o[1]):(n=Math.log(i)/Math.log(10),i=Math.pow(10,Math.floor(n)),r=Math.ceil(n)!==Math.floor(n)?Math.pow(10,Math.ceil(n)):Math.pow(10,Math.ceil(n)+1))),[i,r]},e.prototype._mapper_state=function(){var t,e,r,n,o,i,s,a,l,u,c,p;return l=this.source_range.start,a=this.source_range.end,p=this.target_range.start,c=this.target_range.end,s=c-p,o=this._get_safe_scale(l,a),u=o[0],t=o[1],0===u?(r=Math.log(t),e=0):(r=Math.log(t)-Math.log(u),e=Math.log(u)),i=s,n=p,[i,n,r,e]},e.internal({source_range:[i.Any],target_range:[i.Any]}),e}(o),e.exports={Model:n}},{"../../core/properties":"core/properties","../../model":"model"}],"models/markers/index":[function(t,e,r){var n,o,i,s,a,l,u,c,p,h,_,d,f,m,g,y,v,b,x,w=function(t,e){function r(){this.constructor=t}for(var n in e)k.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},k={}.hasOwnProperty;n=t("./marker"),o=Math.sqrt(3),f=function(t,e){var r,o;return o=function(t){function r(){return r.__super__.constructor.apply(this,arguments)}return w(r,t),r.prototype._render_one=e,r}(n.View),r=function(e){function r(){return r.__super__.constructor.apply(this,arguments)}return w(r,e),r.prototype.default_view=o,r.prototype.type=t,r}(n.Model),{Model:r,View:o}},l=function(t,e){return t.moveTo(-e,e),t.lineTo(e,-e),t.moveTo(-e,-e),t.lineTo(e,e)},i=function(t,e){return t.moveTo(0,e),t.lineTo(0,-e),t.moveTo(-e,0),t.lineTo(e,0)},s=function(t,e){return t.moveTo(0,e),t.lineTo(e/1.5,0),t.lineTo(0,-e),t.lineTo(-e/1.5,0),t.closePath()},a=function(t,e){var r,n;return n=e*o,r=n/3,t.moveTo(-e,r),t.lineTo(e,r),t.lineTo(0,r-n),t.closePath()},u=function(t,e,r,n,o,s,a){var u;u=.65*o,i(t,o),l(t,u),s.doit&&(s.set_vectorize(t,e),t.stroke())},c=function(t,e,r,n,o,s,a){t.arc(0,0,o,0,2*Math.PI,!1),a.doit&&(a.set_vectorize(t,e),t.fill()),s.doit&&(s.set_vectorize(t,e),i(t,o),t.stroke())},p=function(t,e,r,n,o,i,s){t.arc(0,0,o,0,2*Math.PI,!1),s.doit&&(s.set_vectorize(t,e),t.fill()),i.doit&&(i.set_vectorize(t,e),l(t,o),t.stroke())},h=function(t,e,r,n,o,s,a){i(t,o),s.doit&&(s.set_vectorize(t,e),t.stroke())},_=function(t,e,r,n,o,i,a){s(t,o),a.doit&&(a.set_vectorize(t,e),t.fill()),i.doit&&(i.set_vectorize(t,e),t.stroke())},d=function(t,e,r,n,o,a,l){s(t,o),l.doit&&(l.set_vectorize(t,e),t.fill()),a.doit&&(a.set_vectorize(t,e),i(t,o),t.stroke())},m=function(t,e,r,n,o,i,s){t.rotate(Math.PI),a(t,o),t.rotate(-Math.PI),s.doit&&(s.set_vectorize(t,e),t.fill()),i.doit&&(i.set_vectorize(t,e),t.stroke())},g=function(t,e,r,n,o,i,s){var a;a=2*o,t.rect(-o,-o,a,a),s.doit&&(s.set_vectorize(t,e),t.fill()),i.doit&&(i.set_vectorize(t,e),t.stroke())},y=function(t,e,r,n,o,s,a){var l;l=2*o,t.rect(-o,-o,l,l),a.doit&&(a.set_vectorize(t,e),t.fill()),s.doit&&(s.set_vectorize(t,e),i(t,o),t.stroke())},v=function(t,e,r,n,o,i,s){var a;a=2*o,t.rect(-o,-o,a,a),s.doit&&(s.set_vectorize(t,e),t.fill()),i.doit&&(i.set_vectorize(t,e),l(t,o),t.stroke())},b=function(t,e,r,n,o,i,s){a(t,o),s.doit&&(s.set_vectorize(t,e),t.fill()),i.doit&&(i.set_vectorize(t,e),t.stroke())},x=function(t,e,r,n,o,i,s){l(t,o),i.doit&&(i.set_vectorize(t,e),t.stroke())},e.exports={Asterisk:f("Asterisk",u),CircleCross:f("CircleCross",c),CircleX:f("CircleX",p),Cross:f("Cross",h),Diamond:f("Diamond",_),DiamondCross:f("DiamondCross",d),InvertedTriangle:f("InvertedTriangle",m),Square:f("Square",g),SquareCross:f("SquareCross",y),SquareX:f("SquareX",v),Triangle:f("Triangle",b),X:f("X",x)}},{"./marker":"models/markers/marker"}],"models/markers/marker":[function(t,e,r){var n,o,i,s,a,l,u=function(t,e){function r(){this.constructor=t}for(var n in e)c.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},c={}.hasOwnProperty;s=t("underscore"),n=t("../glyphs/glyph"),a=t("../../core/hittest"),l=t("../../core/properties"),i=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return u(e,t),e.prototype.draw_legend_for_index=function(t,e,r,n,o,i){var s,a,l,u,c,p;return l=[i],c={},c[i]=(e+r)/2,p={},p[i]=(n+o)/2,u={},u[i]=.4*Math.min(Math.abs(r-e),Math.abs(o-n)),s={},s[i]=0,a={sx:c,sy:p,_size:u,_angle:s},this._render(t,l,a)},e.prototype._render=function(t,e,r){var n,o,i,s,a,l,u,c,p;for(c=r.sx,p=r.sy,o=r._size,n=r._angle,u=[],s=0,a=e.length;s<a;s++)i=e[s],isNaN(c[i]+p[i]+o[i]+n[i])||(l=o[i]/2,t.beginPath(),t.translate(c[i],p[i]),n[i]&&t.rotate(n[i]),this._render_one(t,i,c[i],p[i],l,this.visuals.line,this.visuals.fill),n[i]&&t.rotate(-n[i]),u.push(t.translate(-c[i],-p[i])));return u},e.prototype._index_data=function(){return this._xy_index()},e.prototype._mask_data=function(t){var e,r,n,o,i,s,l,u,c,p,h,_,d,f;return r=this.renderer.plot_view.frame.h_range,s=r.start-this.max_size,l=r.end+this.max_size,n=this.renderer.xmapper.v_map_from_target([s,l],!0),h=n[0],_=n[1],i=this.renderer.plot_view.frame.v_range,u=i.start-this.max_size,c=i.end+this.max_size,o=this.renderer.ymapper.v_map_from_target([u,c],!0),d=o[0],f=o[1],e=a.validate_bbox_coords([h,_],[d,f]),function(){var t,r,n,o;for(n=this.index.search(e),o=[],t=0,r=n.length;t<r;t++)p=n[t],o.push(p.i);return o}.call(this)},e.prototype._hit_point=function(t){var e,r,n,o,i,l,u,c,p,h,_,d,f,m,g,y,v,b,x,w,k,M,T,S,z;for(c=[t.vx,t.vy],g=c[0],b=c[1],f=this.renderer.plot_view.canvas.vx_to_sx(g),m=this.renderer.plot_view.canvas.vy_to_sy(b),y=g-this.max_size,v=g+this.max_size,p=this.renderer.xmapper.v_map_from_target([y,v],!0),M=p[0],T=p[1],x=b-this.max_size,w=b+this.max_size,h=this.renderer.ymapper.v_map_from_target([x,w],!0),S=h[0],z=h[1],e=a.validate_bbox_coords([M,T],[S,z]),r=function(){var t,r,n,o;for(n=this.index.search(e),o=[],t=0,r=n.length;t<r;t++)k=n[t],o.push(k.i);return o}.call(this),o=[],l=0,u=r.length;l<u;l++)i=r[l],d=this._size[i]/2,n=Math.abs(this.sx[i]-f)+Math.abs(this.sy[i]-m),Math.abs(this.sx[i]-f)<=d&&Math.abs(this.sy[i]-m)<=d&&o.push([i,n]);return _=a.create_hit_test_result(),_["1d"].indices=s.chain(o).sortBy(function(t){return t[1]}).map(function(t){return t[0]}).value(),_},e.prototype._hit_rect=function(t){var e,r,n,o,i,s,l,u,c;return r=this.renderer.xmapper.v_map_from_target([t.vx0,t.vx1],!0),s=r[0],l=r[1],n=this.renderer.ymapper.v_map_from_target([t.vy0,t.vy1],!0),u=n[0],c=n[1],e=a.validate_bbox_coords([s,l],[u,c]),o=a.create_hit_test_result(),o["1d"].indices=function(){var t,r,n,o;for(n=this.index.search(e),o=[],t=0,r=n.length;t<r;t++)i=n[t],o.push(i.i);return o}.call(this),o},e.prototype._hit_poly=function(t){var e,r,n,o,i,s,l,u,c,p,h,_,d;for(s=[t.vx,t.vy],_=s[0],d=s[1],p=this.renderer.plot_view.canvas.v_vx_to_sx(_),h=this.renderer.plot_view.canvas.v_vy_to_sy(d),e=function(){c=[];for(var t=0,e=this.sx.length;0<=e?t<e:t>e;0<=e?t++:t--)c.push(t);return c}.apply(this),r=[],n=i=0,l=e.length;0<=l?i<l:i>l;n=0<=l?++i:--i)o=e[n],a.point_in_poly(this.sx[n],this.sy[n],p,h)&&r.push(o);return u=a.create_hit_test_result(),u["1d"].indices=r,u},e}(n.View),o=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return u(e,t),e.coords([["x","y"]]),e.mixins(["line","fill"]),e.define({size:[l.DistanceSpec,{units:"screen",value:4}],angle:[l.AngleSpec,0]}),e}(n.Model),e.exports={Model:o,View:i}},{"../../core/hittest":"core/hittest","../../core/properties":"core/properties","../glyphs/glyph":"models/glyphs/glyph",underscore:"underscore"}],"models/plots/gmap_plot":[function(t,e,r){var n,o,i,s,a,l,u,c=function(t,e){function r(){this.constructor=t}for(var n in e)p.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},p={}.hasOwnProperty;a=t("underscore"),l=t("../../core/logging").logger,o=t("./gmap_plot_canvas"),s=t("./plot"),u=t("../../core/properties"),i=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return c(e,t),e}(s.View),n=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return c(e,t),e.prototype.type="GMapPlot",e.prototype.default_view=i,e.prototype.initialize=function(t){return e.__super__.initialize.call(this,t),this.api_key||l.error("api_key is required. See https://developers.google.com/maps/documentation/javascript/get-api-key for more information on how to obtain your own."),this._plot_canvas=new o.Model({plot:this}),this.plot_canvas.toolbar=this.toolbar},e.define({map_options:[u.Any],api_key:[u.String]}),e}(s.Model),e.exports={Model:n,View:i}},{"../../core/logging":"core/logging","../../core/properties":"core/properties","./gmap_plot_canvas":"models/plots/gmap_plot_canvas","./plot":"models/plots/plot",underscore:"underscore"}],"models/plots/gmap_plot_canvas":[function(t,e,r){var n,o,i,s,a,l,u,c=function(t,e){return function(){return t.apply(e,arguments)}},p=function(t,e){function r(){this.constructor=t}for(var n in e)h.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},h={}.hasOwnProperty;s=t("underscore"),l=t("../../core/util/proj4"),u=l.defs("GOOGLE"),i=t("./plot_canvas"),a=t("../../core/properties"),o=function(t){function e(){return this.setRanges=c(this.setRanges,this),this.getProjectedBounds=c(this.getProjectedBounds,this),this.getLatLngBounds=c(this.getLatLngBounds,this),e.__super__.constructor.apply(this,arguments)}return p(e,t),e.prototype.initialize=function(t){return e.__super__.initialize.call(this,s.defaults(t,this.default_options)),this.zoom_count=0},e.prototype.getLatLngBounds=function(){var t,e,r,n,o,i,s;return e=this.map.getBounds(),r=e.getNorthEast(),t=e.getSouthWest(),o=t.lng(),n=r.lng(),s=t.lat(),i=r.lat(),[o,n,s,i]},e.prototype.getProjectedBounds=function(){var t,e,r,n,o,i,s,a,c,p,h;return o=this.getLatLngBounds(),c=o[0],a=o[1],h=o[2],p=o[3],i=l(u,[c,h]),e=i[0],n=i[1],s=l(u,[a,p]),t=s[0],r=s[1],[e,t,n,r]},e.prototype.setRanges=function(){var t,e,r,n,o;return o=this.getProjectedBounds(),e=o[0],t=o[1],n=o[2],r=o[3],this.x_range.setv({start:e,end:t}),this.y_range.setv({start:n,end:r})},e.prototype.update_range=function(t){var r,n,o,i,s,a,l,u;if(this.pause(),null==t.sdx&&null==t.sdy||(this.map.panBy(t.sdx,t.sdy),e.__super__.update_range.call(this,t)),null!=t.factor){if(10!==this.zoom_count)return void(this.zoom_count+=1);this.zoom_count=0,e.__super__.update_range.call(this,t),u=t.factor<0?-1:1,n=this.map.getZoom(),r=n+u,r>=2&&(this.map.setZoom(r),l=this.getProjectedBounds(),i=l[0],o=l[1],a=l[2],s=l[3],o-i<0&&this.map.setZoom(n)),this.setRanges()}return this.unpause()},e.prototype.bind_bokeh_events=function(){var t,r,n,o,i,a;return e.__super__.bind_bokeh_events.call(this),a=this.frame.width,r=this.frame.height,n=this.canvas.vx_to_sx(this.frame.left),i=this.canvas.vy_to_sy(this.frame.top),this.canvas_view.map_div.attr("style","top: "+i+"px; left: "+n+"px; position: absolute"),this.canvas_view.map_div.attr("style","width:"+a+"px;"),this.canvas_view.map_div.attr("style","height:"+r+"px;"),this.canvas_view.map_div.width(a+"px").height(r+"px"),this.initial_zoom=this.model.plot.map_options.zoom,t=function(t){return function(){var e,r,n,o;return n=window.google.maps,r={satellite:n.MapTypeId.SATELLITE,terrain:n.MapTypeId.TERRAIN,roadmap:n.MapTypeId.ROADMAP,hybrid:n.MapTypeId.HYBRID},o=t.model.plot.map_options,e={center:new n.LatLng(o.lat,o.lng),zoom:o.zoom,disableDefaultUI:!0,mapTypeId:r[o.map_type]},null!=o.styles&&(e.styles=JSON.parse(o.styles)),t.map=new n.Map(t.canvas_view.map_div[0],e),n.event.addListenerOnce(t.map,"idle",t.setRanges)}}(this),null==window._bokeh_gmap_loads&&(window._bokeh_gmap_loads=[]),null!=window.google&&null!=window.google.maps?s.defer(t):null!=window._bokeh_gmap_callback?window._bokeh_gmap_loads.push(t):(window._bokeh_gmap_loads.push(t),window._bokeh_gmap_callback=function(){return s.each(window._bokeh_gmap_loads,s.defer)},o=document.createElement("script"),o.type="text/javascript",o.src="https://maps.googleapis.com/maps/api/js?key="+this.model.plot.api_key+"&callback=_bokeh_gmap_callback",document.body.appendChild(o))},e.prototype._map_hook=function(t,e){var r,n,o,i;return n=e[0],o=e[1],i=e[2],r=e[3],this.canvas_view.map_div.attr("style","top: "+o+"px; left: "+n+"px;"),this.canvas_view.map_div.width(i+"px").height(r+"px")},e.prototype._paint_empty=function(t,e){var r,n,o,i,s,a;return s=this.canvas.width,i=this.canvas.height,o=e[0],a=e[1],n=e[2],r=e[3],t.clearRect(0,0,s,i),t.beginPath(),t.moveTo(0,0),t.lineTo(0,i),t.lineTo(s,i),t.lineTo(s,0),t.lineTo(0,0),t.moveTo(o,a),t.lineTo(o+n,a),t.lineTo(o+n,a+r),t.lineTo(o,a+r),t.lineTo(o,a),t.closePath(),t.fillStyle=this.model.plot.border_fill_color,t.fill()},e}(i.View),n=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return p(e,t),e.prototype.type="GMapPlotCanvas",e.prototype.default_view=o,e.prototype.initialize=function(t,r){return this.use_map=!0,e.__super__.initialize.call(this,t,r)},e}(i.Model),e.exports={Model:n,View:o}},{"../../core/properties":"core/properties","../../core/util/proj4":"core/util/proj4","./plot_canvas":"models/plots/plot_canvas",underscore:"underscore"}],"models/plots/plot":[function(t,e,r){var n,o,i,s,a,l,u,c,p,h,_,d,f,m,g,y,v,b,x=function(t,e){function r(){this.constructor=t}for(var n in e)w.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},w={}.hasOwnProperty,k=[].slice;g=t("underscore"),b=t("../../core/layout/solver"),m=b.WEAK_EQ,i=b.GE,o=b.EQ,p=b.Strength,f=b.Variable,y=t("../../core/logging").logger,v=t("../../core/properties"),a=t("../layouts/layout_dom"),h=t("../annotations/title"),d=t("../tools/toolbar"),_=t("../tools/tool_events"),u=t("./plot_canvas").Model,n=t("../sources/column_data_source"),s=t("../renderers/glyph_renderer"),h=t("../annotations/title"),c=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return x(e,t),e.prototype.className="bk-plot-layout",e.prototype.bind_bokeh_events=function(){var t;return e.__super__.bind_bokeh_events.call(this),t="Title object cannot be replaced. Try changing properties on title to update it after initialization.",this.listenTo(this.model,"change:title",function(e){return function(){return y.warn(t)}}(this))},e.prototype.render=function(){var t,r,n,o;if(e.__super__.render.call(this),"scale_both"===this.model.sizing_mode)return r=this.get_width_height(),o=r[0],t=r[1],n=this.model.document.solver(),n.suggest_value(this.model._width,o),n.suggest_value(this.model._height,t),this.$el.css({position:"absolute",left:this.model._dom_left._value,top:this.model._dom_top._value,width:this.model._width.value(),height:this.model._height.value()})},e.prototype.get_width_height=function(){var t,e,r,n,o,i,s,a,l;return s=this.el.parentNode.clientHeight,a=this.el.parentNode.clientWidth,t=this.model.get_aspect_ratio(),o=a,r=a/t,i=s*t,n=s,o<i?(l=o,e=r):(l=i,e=n),[l,e]},e.prototype.get_height=function(){return this.model._width._value/this.model.get_aspect_ratio()},e.prototype.get_width=function(){return this.model._height._value*this.model.get_aspect_ratio()},e}(a.View),l=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return x(e,t),e.prototype.type="Plot",e.prototype.default_view=c,e.prototype.initialize=function(t){var r,n,o,i,s,a,l,c,p,_,d;for(e.__super__.initialize.call(this,t),a=g.values(this.extra_x_ranges).concat(this.x_range),r=0,o=a.length;r<o;r++)_=a[r],s=_.plots,g.isArray(s)&&(s=s.concat(this),_.plots=s);for(l=g.values(this.extra_y_ranges).concat(this.y_range),n=0,i=l.length;n<i;n++)d=l[n],s=d.plots,g.isArray(s)&&(s=s.concat(this),d.plots=s);if(this._horizontal=!1,"left"!==(c=this.toolbar_location)&&"right"!==c||(this._horizontal=!0),null!=this.min_border&&(null==this.min_border_top&&(this.min_border_top=this.min_border),null==this.min_border_bottom&&(this.min_border_bottom=this.min_border),null==this.min_border_left&&(this.min_border_left=this.min_border),null==this.min_border_right&&(this.min_border_right=this.min_border)),null!=this.title&&(p=g.isString(this.title)?new h.Model({text:this.title}):this.title,this.add_layout(p,this.title_location)),this._plot_canvas=new u({plot:this}),this.toolbar.toolbar_location=this.toolbar_location,this.toolbar.toolbar_sticky=this.toolbar_sticky,this.plot_canvas.toolbar=this.toolbar,null==this.width&&(this.width=this.plot_width),null==this.height)return this.height=this.plot_height},e.getter("plot_canvas",function(){return this._plot_canvas}),e.prototype._doc_attached=function(){var t,e,r,n,o,i,s,a;for(s=["above","below","left","right"],t=0,n=s.length;t<n;t++)for(a=s[t],r=this.getv(a),e=0,o=r.length;e<o;e++)i=r[e],this.plot_canvas.add_renderer_to_canvas_side(i,a);return this.plot_canvas.attach_document(this.document),this._set_orientation_variables(this),this._set_orientation_variables(this.toolbar),this._set_orientation_variables(this.plot_canvas)},e.prototype.add_renderers=function(){var t,e;return t=1<=arguments.length?k.call(arguments,0):[],e=this.renderers,e=e.concat(t),this.renderers=e},e.prototype.add_layout=function(t,e){var r;if(null==e&&(e="center"),null!=t.props.plot&&(t.plot=this),this.add_renderers(t),"center"!==e)return r=this.getv(e),r.push(t)},e.prototype.add_glyph=function(t,e,r){var o;return null==r&&(r={}),null==e&&(e=new n.Model),r=g.extend({},r,{data_source:e,glyph:t}),o=new s.Model(r),this.add_renderers(o),o},e.prototype.add_tools=function(){var t,e,r,n;return n=1<=arguments.length?k.call(arguments,0):[],e=function(){var e,o,i;for(i=[],e=0,o=n.length;e<o;e++)r=n[e],null!=r.overlay&&this.add_renderers(r.overlay),null!=r.plot?i.push(r):(t=g.clone(r.attributes),t.plot=this,i.push(new r.constructor(t)));return i}.call(this),this.toolbar.tools=this.toolbar.tools.concat(e)},e.prototype.get_aspect_ratio=function(){return this.width/this.height},e.prototype.get_layoutable_children=function(){var t;return t=[this.plot_canvas],null!=this.toolbar_location&&(t=[this.toolbar,this.plot_canvas]),t},e.prototype.get_edit_variables=function(){var t,r,n,o,i;for(r=e.__super__.get_edit_variables.call(this),"scale_both"===this.sizing_mode&&(r.push({edit_variable:this._width,strength:p.strong}),r.push({edit_variable:this._height,strength:p.strong})),i=this.get_layoutable_children(),n=0,o=i.length;n<o;n++)t=i[n],r=r.concat(t.get_edit_variables());return r},e.prototype.get_constraints=function(){var t,r,n,s,a,l,u,c;for(r=e.__super__.get_constraints.call(this),null!=this.toolbar_location&&(this.toolbar_sticky===!0?r.push(o(this._sizeable,[-1,this.plot_canvas._sizeable])):r.push(o(this._sizeable,[-1,this.plot_canvas._sizeable],[-1,this.toolbar._sizeable])),r.push(o(this._full,[-1,this.plot_canvas._full])),"above"===this.toolbar_location&&(c=this.toolbar_sticky===!0?this.plot_canvas._top:this.plot_canvas._dom_top,r.push(o(c,[-1,this.toolbar._dom_top],[-1,this.toolbar._height]))),"below"===this.toolbar_location&&(this.toolbar_sticky===!1&&r.push(o(this.toolbar._dom_top,[-1,this.plot_canvas._height],this.toolbar._bottom,[-1,this.toolbar._height])),this.toolbar_sticky===!0&&(r.push(i(this.plot_canvas.below_panel._height,[-1,this.toolbar._height])),r.push(m(this.toolbar._dom_top,[-1,this.plot_canvas._height],this.plot_canvas.below_panel._height)))),"left"===this.toolbar_location&&(c=this.toolbar_sticky===!0?this.plot_canvas._left:this.plot_canvas._dom_left,r.push(o(c,[-1,this.toolbar._dom_left],[-1,this.toolbar._width]))),"right"===this.toolbar_location&&(this.toolbar_sticky===!1&&r.push(o(this.toolbar._dom_left,[-1,this.plot_canvas._width],this.toolbar._right,[-1,this.toolbar._width])),this.toolbar_sticky===!0&&(r.push(i(this.plot_canvas.right_panel._width,[-1,this.toolbar._width])),r.push(m(this.toolbar._dom_left,[-1,this.plot_canvas._width],this.plot_canvas.right_panel._width)))),"above"!==(a=this.toolbar_location)&&"below"!==a||r.push(o(this._width,[-1,this.toolbar._width],[-1,this.plot_canvas._width_minus_right])),"left"!==(l=this.toolbar_location)&&"right"!==l||(r.push(o(this._height,[-1,this.toolbar._height],[-1,this.plot_canvas.above_panel._height])),r.push(o(this.toolbar._dom_top,[-1,this.plot_canvas.above_panel._height])))),null==this.toolbar_location&&(r.push(o(this._width,[-1,this.plot_canvas._width])),r.push(o(this._height,[-1,this.plot_canvas._height]))),u=this.get_layoutable_children(),n=0,s=u.length;n<s;n++)t=u[n],r=r.concat(t.get_constraints());return r},e.prototype.get_constrained_variables=function(){var t;return t=e.__super__.get_constrained_variables.call(this),t=g.extend(t,{"on-edge-align-top":this.plot_canvas._top,"on-edge-align-bottom":this.plot_canvas._height_minus_bottom,"on-edge-align-left":this.plot_canvas._left,"on-edge-align-right":this.plot_canvas._width_minus_right,"box-cell-align-top":this.plot_canvas._top,"box-cell-align-bottom":this.plot_canvas._height_minus_bottom,"box-cell-align-left":this.plot_canvas._left,"box-cell-align-right":this.plot_canvas._width_minus_right,"box-equal-size-top":this.plot_canvas._top,"box-equal-size-bottom":this.plot_canvas._height_minus_bottom
|
|
}),"fixed"!==this.sizing_mode&&(t=g.extend(t,{"box-equal-size-left":this.plot_canvas._left,"box-equal-size-right":this.plot_canvas._width_minus_right})),t},e.prototype._set_orientation_variables=function(t){if(this._horizontal===!1&&(t._sizeable=t._height,t._full=t._width),this._horizontal===!0)return t._sizeable=t._width,t._full=t._height},e.mixins(["line:outline_","fill:background_","fill:border_"]),e.define({toolbar:[v.Instance,function(){return new d.Model}],toolbar_location:[v.Location,"right"],toolbar_sticky:[v.Bool,!0],plot_width:[v.Number,600],plot_height:[v.Number,600],title:[v.Any,function(){return new h.Model({text:""})}],title_location:[v.Location,"above"],h_symmetry:[v.Bool,!0],v_symmetry:[v.Bool,!1],above:[v.Array,[]],below:[v.Array,[]],left:[v.Array,[]],right:[v.Array,[]],renderers:[v.Array,[]],x_range:[v.Instance],extra_x_ranges:[v.Any,{}],y_range:[v.Instance],extra_y_ranges:[v.Any,{}],x_mapper_type:[v.String,"auto"],y_mapper_type:[v.String,"auto"],tool_events:[v.Instance,function(){return new _.Model}],lod_factor:[v.Number,10],lod_interval:[v.Number,300],lod_threshold:[v.Number,2e3],lod_timeout:[v.Number,500],webgl:[v.Bool,!1],hidpi:[v.Bool,!0],min_border:[v.Number,5],min_border_top:[v.Number,null],min_border_left:[v.Number,null],min_border_bottom:[v.Number,null],min_border_right:[v.Number,null]}),e.override({outline_line_color:"#e5e5e5",border_fill_color:"#ffffff",background_fill_color:"#ffffff"}),e.getters({all_renderers:function(){var t,e,r,n,o;for(n=this.renderers,r=this.toolbar.tools,t=0,e=r.length;t<e;t++)o=r[t],n=n.concat(o.synthetic_renderers);return n}}),e}(a.Model),e.exports={View:c,Model:l}},{"../../core/layout/solver":"core/layout/solver","../../core/logging":"core/logging","../../core/properties":"core/properties","../annotations/title":"models/annotations/title","../layouts/layout_dom":"models/layouts/layout_dom","../renderers/glyph_renderer":"models/renderers/glyph_renderer","../sources/column_data_source":"models/sources/column_data_source","../tools/tool_events":"models/tools/tool_events","../tools/toolbar":"models/tools/toolbar","./plot_canvas":"models/plots/plot_canvas",underscore:"underscore"}],"models/plots/plot_canvas":[function(t,e,r){var n,o,i,s,a,l,u,c,p,h,_,d,f,m,g,y,v,b,x,w,k,M,T,S=function(t,e){return function(){return t.apply(e,arguments)}},z=function(t,e){function r(){this.constructor=t}for(var n in e)E.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},E={}.hasOwnProperty,A=[].indexOf||function(t){for(var e=0,r=this.length;e<r;e++)if(e in this&&this[e]===t)return e;return-1};g=t("underscore"),n=t("jquery"),i=t("../canvas/canvas"),s=t("../canvas/cartesian_frame"),a=t("../ranges/data_range1d"),c=t("../renderers/glyph_renderer"),h=t("../layouts/layout_dom"),y=t("../../core/build_views"),f=t("../../core/ui_events").UIEvents,p=t("../../core/layout/layout_canvas"),m=t("../../core/visuals").Visuals,o=t("../../core/bokeh_view"),k=t("../../core/layout/solver"),l=k.EQ,u=k.GE,x=t("../../core/logging").logger,v=t("../../core/enums"),w=t("../../core/properties"),M=t("../../core/util/throttle").throttle,T=t("../../core/layout/side_panel").update_constraints,b=null,d=function(t){function e(){return this.remove=S(this.remove,this),this.request_render=S(this.request_render,this),e.__super__.constructor.apply(this,arguments)}return z(e,t),e.prototype.className="bk-plot-wrapper",e.prototype.state={history:[],index:-1},e.prototype.view_options=function(){return g.extend({plot_view:this},this.options)},e.prototype.pause=function(){return this.is_paused=!0},e.prototype.unpause=function(){return this.is_paused=!1,this.request_render()},e.prototype.request_render=function(){this.is_paused||this.throttled_render()},e.prototype.remove=function(){var t,r,n,o;e.__super__.remove.call(this),r=this.tool_views,n=[];for(t in r)o=r[t],n.push(o.remove());return n},e.prototype.initialize=function(t){var r,n,o,i;for(e.__super__.initialize.call(this,t),this.pause(),this.visuals=new m(this.model.plot),this._initial_state_info={range:null,selection:{},dimensions:{width:this.model.canvas.width,height:this.model.canvas.height}},this.frame=this.model.frame,this.x_range=this.frame.x_ranges["default"],this.y_range=this.frame.y_ranges["default"],this.xmapper=this.frame.x_mappers["default"],this.ymapper=this.frame.y_mappers["default"],this.canvas=this.model.canvas,this.canvas_view=new this.canvas.default_view({model:this.canvas}),this.$el.append(this.canvas_view.el),this.canvas_view.render(!0),(this.model.plot.webgl||window.location.search.indexOf("webgl=1")>0)&&window.location.search.indexOf("webgl=0")===-1&&this.init_webgl(),this.throttled_render=M(this.render,15),null==this.model.document._unrendered_plots&&(this.model.document._unrendered_plots={}),this.model.document._unrendered_plots[this.id]=!0,this.ui_event_bus=new f(this.model.toolbar,this.canvas_view.$el),this.levels={},i=v.RenderLevel,r=0,n=i.length;r<n;r++)o=i[r],this.levels[o]={};return this.renderer_views={},this.tool_views={},this.build_levels(),this.build_tools(),this.bind_bokeh_events(),this.update_dataranges(),this.unpause(),x.debug("PlotView initialized"),this},e.prototype.get_canvas_element=function(){return this.canvas_view.ctx.canvas},e.prototype.init_webgl=function(){var t,e,r;return t=this.canvas_view.ctx,e=b,null==e&&(b=e=document.createElement("canvas"),r={premultipliedAlpha:!0},e.gl=e.getContext("webgl",r)||e.getContext("experimental-webgl",r)),null!=e.gl?t.glcanvas=e:x.warn("WebGL is not supported, falling back to 2D canvas.")},e.prototype.prepare_webgl=function(t,e){var r,n,o,i;if(n=this.canvas_view.ctx,r=this.canvas_view.get_canvas_element(),n.glcanvas)return n.glcanvas.width=r.width,n.glcanvas.height=r.height,i=n.glcanvas.gl,i.viewport(0,0,n.glcanvas.width,n.glcanvas.height),i.clearColor(0,0,0,0),i.clear(i.COLOR_BUFFER_BIT||i.DEPTH_BUFFER_BIT),i.enable(i.SCISSOR_TEST),o=n.glcanvas.height-t*(e[1]+e[3]),i.scissor(t*e[0],o,t*e[2],t*e[3]),i.enable(i.BLEND),i.blendFuncSeparate(i.SRC_ALPHA,i.ONE_MINUS_SRC_ALPHA,i.ONE_MINUS_DST_ALPHA,i.ONE)},e.prototype.blit_webgl=function(t){var e;if(e=this.canvas_view.ctx,e.glcanvas)return x.debug("drawing with WebGL"),e.restore(),e.drawImage(e.glcanvas,0,0),e.save(),e.scale(t,t),e.translate(.5,.5)},e.prototype.update_dataranges=function(){var t,e,r,n,o,i,s,l,u,c,p,h,_,d,f,m,y,v,b,w,k,M,T;n=this.model.frame,e={},f=this.renderer_views;for(s in f)k=f[s],t=null!=(m=k.glyph)&&"function"==typeof m.bounds?m.bounds():void 0,null!=t&&(e[s]=t);for(r=!1,o=!1,y=g.values(n.x_ranges),i=0,u=y.length;i<u;i++)M=y[i],M instanceof a.Model&&(M.update(e,0,this.model.id),M.follow&&(r=!0)),null!=M.bounds&&(o=!0);for(v=g.values(n.y_ranges),l=0,c=v.length;l<c;l++)T=v[l],T instanceof a.Model&&(T.update(e,1,this.model.id),T.follow&&(r=!0)),null!=T.bounds&&(o=!0);if(r&&o){for(x.warn("Follow enabled so bounds are unset."),b=g.values(n.x_ranges),_=0,p=b.length;_<p;_++)M=b[_],M.bounds=null;for(w=g.values(n.y_ranges),d=0,h=w.length;d<h;d++)T=w[d],T.bounds=null}return this.range_update_timestamp=Date.now()},e.prototype.map_to_screen=function(t,e,r,n){return null==r&&(r="default"),null==n&&(n="default"),this.frame.map_to_screen(t,e,this.canvas,r,n)},e.prototype.push_state=function(t,e){var r,n;return r=(null!=(n=this.state.history[this.state.index])?n.info:void 0)||{},e=g.extend({},this._initial_state_info,r,e),this.state.history.slice(0,this.state.index+1),this.state.history.push({type:t,info:e}),this.state.index=this.state.history.length-1,this.trigger("state_changed")},e.prototype.clear_state=function(){return this.state={history:[],index:-1},this.trigger("state_changed")},e.prototype.can_undo=function(){return this.state.index>=0},e.prototype.can_redo=function(){return this.state.index<this.state.history.length-1},e.prototype.undo=function(){if(this.can_undo())return this.state.index-=1,this._do_state_change(this.state.index),this.trigger("state_changed")},e.prototype.redo=function(){if(this.can_redo())return this.state.index+=1,this._do_state_change(this.state.index),this.trigger("state_changed")},e.prototype._do_state_change=function(t){var e,r;if(e=(null!=(r=this.state.history[t])?r.info:void 0)||this._initial_state_info,null!=e.range&&this.update_range(e.range),null!=e.selection&&this.update_selection(e.selection),null!=e.dimensions)return this.canvas_view.set_dims([e.dimensions.width,e.dimensions.height])},e.prototype.reset_dimensions=function(){return this.update_dimensions(this.canvas.initial_width,this.canvas.initial_height)},e.prototype.update_dimensions=function(t,e){return this.pause(),this.model.plot.width=t,this.model.plot.height=e,this.model.document.resize(),this.unpause()},e.prototype.get_selection=function(){var t,e,r,n,o,i;for(i=[],r=this.model.plot.renderers,t=0,e=r.length;t<e;t++)n=r[t],n instanceof c.Model&&(o=n.data_source.selected,i[n.id]=o);return i},e.prototype.update_selection=function(t){var e,r,n,o,i,s,a;for(o=this.model.plot.renderers,a=[],r=0,n=o.length;r<n;r++)s=o[r],s instanceof c.Model&&(e=s.data_source,null!=t?(i=s.id,A.call(t,i)>=0?a.push(e.selected=t[s.id]):a.push(void 0)):a.push(e.selection_manager.clear()));return a},e.prototype.reset_selection=function(){return this.update_selection(null)},e.prototype._update_ranges_together=function(t){var e,r,n,o,i,s,a,l,u,c;for(c=1,e=0,n=t.length;e<n;e++)s=t[e],u=s[0],i=s[1],c=Math.min(c,this._get_weight_to_constrain_interval(u,i));if(c<1){for(l=[],r=0,o=t.length;r<o;r++)a=t[r],u=a[0],i=a[1],i.start=c*i.start+(1-c)*u.start,l.push(i.end=c*i.end+(1-c)*u.end);return l}},e.prototype._update_ranges_individually=function(t,e,r){var n,o,i,s,a,l,u,c,p,h,_,d,f,m,g,y;for(n=!1,o=0,s=t.length;o<s;o++)h=t[o],g=h[0],p=h[1],m=g.start>g.end,r||(y=this._get_weight_to_constrain_interval(g,p),y<1&&(p.start=y*p.start+(1-y)*g.start,p.end=y*p.end+(1-y)*g.end)),null!=g.bounds&&(u=g.bounds[0],l=g.bounds[1],c=Math.abs(p.end-p.start),m?(null!=u&&u>=p.end&&(n=!0,p.end=u,null==e&&null==r||(p.start=u+c)),null!=l&&l<=p.start&&(n=!0,p.start=l,null==e&&null==r||(p.end=l-c))):(null!=u&&u>=p.start&&(n=!0,p.start=u,null==e&&null==r||(p.end=u+c)),null!=l&&l<=p.end&&(n=!0,p.end=l,null==e&&null==r||(p.start=l-c))));if(!r||!n){for(f=[],i=0,a=t.length;i<a;i++)_=t[i],g=_[0],p=_[1],g.have_updated_interactively=!0,g.start!==p.start||g.end!==p.end?(g.setv(p),f.push(null!=(d=g.callback)?d.execute(g):void 0)):f.push(void 0);return f}},e.prototype._get_weight_to_constrain_interval=function(t,e){var r,n,o,i,s,a,l,u,c;return s=t.min_interval,n=t.max_interval,c=1,null!=t.bounds&&(u=t.bounds,i=u[0],r=u[1],null!=i&&null!=r&&(o=Math.abs(r-i),n=null!=n?Math.min(n,o):o)),null==s&&null==n||(l=Math.abs(t.end-t.start),a=Math.abs(e.end-e.start),s>0&&a<s&&(c=(l-s)/(l-a)),n>0&&a>n&&(c=(n-l)/(a-l)),c=Math.max(0,Math.min(1,c))),c},e.prototype.update_range=function(t,e,r){var n,o,i,s,a,l,u,c,p;if(this.pause,null==t){i=this.frame.x_ranges;for(n in i)p=i[n],p.reset(),null!=(s=p.callback)&&s.execute(p);a=this.frame.y_ranges;for(n in a)p=a[n],p.reset(),null!=(l=p.callback)&&l.execute(p);this.update_dataranges()}else{o=[],u=this.frame.x_ranges;for(n in u)p=u[n],o.push([p,t.xrs[n]]);c=this.frame.y_ranges;for(n in c)p=c[n],o.push([p,t.yrs[n]]);r&&this._update_ranges_together(o),this._update_ranges_individually(o,e,r)}return this.unpause()},e.prototype.reset_range=function(){return this.update_range(null)},e.prototype.build_levels=function(){var t,e,r,n,o,i,s,a,l,u;for(a=this.model.plot.all_renderers,s=g.keys(this.renderer_views),i=y(this.renderer_views,a,this.view_options()),l=g.difference(s,g.pluck(a,"id")),e=0,n=l.length;e<n;e++)t=l[e],delete this.levels.glyph[t];for(r=0,o=i.length;r<o;r++)u=i[r],this.levels[u.model.level][u.model.id]=u,u.bind_bokeh_events();return this},e.prototype.build_tools=function(){var t,e,r,n,o,i;for(o=this.model.plot.toolbar.tools,r=y(this.tool_views,o,this.view_options()),n=[],t=0,e=r.length;t<e;t++)i=r[t],i.bind_bokeh_events(),n.push(this.ui_event_bus.register_tool(i));return n},e.prototype.bind_bokeh_events=function(){var t,e,r,n;e=this.model.frame.x_ranges;for(t in e)n=e[t],this.listenTo(n,"change",this.request_render);r=this.model.frame.y_ranges;for(t in r)n=r[t],this.listenTo(n,"change",this.request_render);return this.listenTo(this.model.plot,"change:renderers",function(t){return function(){return t.build_levels()}}(this)),this.listenTo(this.model.plot.toolbar,"change:tools",function(t){return function(){return t.build_levels(),t.build_tools()}}(this)),this.listenTo(this.model.plot,"change",this.request_render),this.listenTo(this.model.plot,"destroy",function(t){return function(){return t.remove()}}(this)),this.listenTo(this.model.plot.document.solver(),"layout_update",function(t){return function(){return t.request_render()}}(this)),this.listenTo(this.model.plot.document.solver(),"resize",function(t){return function(){return t.resize()}}(this)),this.listenTo(this.canvas,"change:pixel_ratio",function(t){return function(){return t.request_render()}}(this))},e.prototype.set_initial_range=function(){var t,e,r,n,o,i,s;t=!0,i={},r=this.frame.x_ranges;for(e in r){if(o=r[e],null==o.start||null==o.end||g.isNaN(o.start+o.end)){t=!1;break}i[e]={start:o.start,end:o.end}}if(t){s={},n=this.frame.y_ranges;for(e in n){if(o=n[e],null==o.start||null==o.end||g.isNaN(o.start+o.end)){t=!1;break}s[e]={start:o.start,end:o.end}}}return t?(this._initial_state_info.range=this.initial_range_info={xrs:i,yrs:s},x.debug("initial ranges set")):x.warn("could not set initial ranges")},e.prototype.render=function(t){var e,r,o,i,s,a,l;if(null==t&&(t=!1),x.trace("PlotCanvas.render(force_canvas="+t+") for "+this.model.id),null!=this.model.document){Date.now()-this.interactive_timestamp<this.model.plot.lod_interval?(this.interactive=!0,i=this.model.plot.lod_timeout,setTimeout(function(t){return function(){return t.interactive&&Date.now()-t.interactive_timestamp>i&&(t.interactive=!1),t.request_render()}}(this),i)):this.interactive=!1,a=this.renderer_views;for(o in a)if(l=a[o],null==this.range_update_timestamp||l.set_data_timestamp>this.range_update_timestamp){this.update_dataranges();break}return this.update_constraints(),this.model.frame._update_mappers(),e=this.canvas_view.ctx,e.pixel_ratio=s=this.canvas_view.pixel_ratio,e.save(),e.scale(s,s),e.translate(.5,.5),r=[this.canvas.vx_to_sx(this.frame.left),this.canvas.vy_to_sy(this.frame.top),this.frame.width,this.frame.height],this._map_hook(e,r),this._paint_empty(e,r),this.prepare_webgl(s,r),e.save(),this.visuals.outline_line.doit&&(this.visuals.outline_line.set_value(e),e.strokeRect.apply(e,r)),e.restore(),this._render_levels(e,["image","underlay","glyph"],r),this.blit_webgl(s),this._render_levels(e,["annotation"],r),this._render_levels(e,["overlay"]),null==this.initial_range_info&&this.set_initial_range(),e.restore(),null!=this.model.document._unrendered_plots&&(delete this.model.document._unrendered_plots[this.id],g.isEmpty(this.model.document._unrendered_plots))?(this.model.document._unrendered_plots=null,g.delay(n.proxy(this.model.document.resize,this.model.document),1)):void 0}},e.prototype.resize=function(){var t,e,r,n;n=this.model._width._value,e=this.model._height._value,this.canvas_view.set_dims([n,e],!0),this.canvas_view.prepare_canvas();try{this.update_constraints()}catch(t){r=t}return this.$el.css({position:"absolute",left:this.model._dom_left._value,top:this.model._dom_top._value,width:this.model._width._value,height:this.model._height._value})},e.prototype.update_constraints=function(){var t,e,r,n;r=this.model.document.solver(),r.suggest_value(this.frame._width,this.canvas.width-1),r.suggest_value(this.frame._height,this.canvas.height-1),e=this.renderer_views;for(t in e)n=e[t],null!=n.model.panel&&T(n);return r.update_variables(!1)},e.prototype._render_levels=function(t,e,r){var n,o,i,s,a,l,u,c,p,h,_,d,f,m;for(t.save(),null!=r&&(t.beginPath(),t.rect.apply(t,r),t.clip(),t.beginPath()),o={},h=this.model.plot.renderers,n=i=0,a=h.length;i<a;n=++i)_=h[n],o[_.id]=n;for(m=function(t){return o[t.model.id]},s=0,l=e.length;s<l;s++)for(c=e[s],f=g.sortBy(g.values(this.levels[c]),m),p=0,u=f.length;p<u;p++)d=f[p],d.render();return t.restore()},e.prototype._map_hook=function(t,e){},e.prototype._paint_empty=function(t,e){if(t.clearRect(0,0,this.canvas_view.model.width,this.canvas_view.model.height),this.visuals.border_fill.doit&&(this.visuals.border_fill.set_value(t),t.fillRect(0,0,this.canvas_view.model.width,this.canvas_view.model.height),t.clearRect.apply(t,e)),this.visuals.background_fill.doit)return this.visuals.background_fill.set_value(t),t.fillRect.apply(t,e)},e}(o),_=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return z(e,t),e.prototype.type="PlotCanvas",e.prototype.default_view=d,e.prototype.initialize=function(t,r){var n;return e.__super__.initialize.call(this,t,r),this.canvas=new i.Model({map:null!=(n=this.use_map)&&n,initial_width:this.plot.plot_width,initial_height:this.plot.plot_height,use_hidpi:this.plot.hidpi}),this.frame=new s.Model({x_range:this.plot.x_range,extra_x_ranges:this.plot.extra_x_ranges,x_mapper_type:this.plot.x_mapper_type,y_range:this.plot.y_range,extra_y_ranges:this.plot.extra_y_ranges,y_mapper_type:this.plot.y_mapper_type}),this.above_panel=new p.Model,this.below_panel=new p.Model,this.left_panel=new p.Model,this.right_panel=new p.Model,x.debug("PlotCanvas initialized")},e.prototype.add_renderer_to_canvas_side=function(t,e){if("center"!==e)return t.add_panel(e)},e.prototype._doc_attached=function(){return this.canvas.attach_document(this.document),this.frame.attach_document(this.document),this.above_panel.attach_document(this.document),this.below_panel.attach_document(this.document),this.left_panel.attach_document(this.document),this.right_panel.attach_document(this.document),x.debug("PlotCanvas attached to document")},e.override({sizing_mode:"stretch_both"}),e.internal({plot:[w.Instance],toolbar:[w.Instance],canvas:[w.Instance],frame:[w.Instance]}),e.prototype.get_layoutable_children=function(){var t,e;return t=[this.above_panel,this.below_panel,this.left_panel,this.right_panel,this.canvas,this.frame],e=function(e){var r,n,o,i;for(i=[],r=0,n=e.length;r<n;r++)o=e[r],null!=o.panel?i.push(t.push(o.panel)):i.push(void 0);return i},e(this.plot.above),e(this.plot.below),e(this.plot.left),e(this.plot.right),t},e.prototype.get_edit_variables=function(){var t,e,r,n,o;for(e=[],o=this.get_layoutable_children(),r=0,n=o.length;r<n;r++)t=o[r],e=e.concat(t.get_edit_variables());return e},e.prototype.get_constraints=function(){var t,r,n,o,i;for(r=e.__super__.get_constraints.call(this),r=r.concat(this._get_constant_constraints()),r=r.concat(this._get_side_constraints()),i=this.get_layoutable_children(),n=0,o=i.length;n<o;n++)t=i[n],r=r.concat(t.get_constraints());return r},e.prototype._get_constant_constraints=function(){var t,e,r,n,o;return o=this.plot.min_border_top,e=this.plot.min_border_bottom,r=this.plot.min_border_left,n=this.plot.min_border_right,t=[],t.push(u(this.above_panel._height,-o)),t.push(u(this.below_panel._height,-e)),t.push(u(this.left_panel._width,-r)),t.push(u(this.right_panel._width,-n)),t.push(l(this.above_panel._top,[-1,this.canvas._top])),t.push(l(this.above_panel._bottom,[-1,this.frame._top])),t.push(l(this.below_panel._bottom,[-1,this.canvas._bottom])),t.push(l(this.below_panel._top,[-1,this.frame._bottom])),t.push(l(this.left_panel._left,[-1,this.canvas._left])),t.push(l(this.left_panel._right,[-1,this.frame._left])),t.push(l(this.right_panel._right,[-1,this.canvas._right])),t.push(l(this.right_panel._left,[-1,this.frame._right])),t.push(l(this.above_panel._height,[-1,this._top])),t.push(l(this.above_panel._height,[-1,this.canvas._top],this.frame._top)),t.push(l(this.below_panel._height,[-1,this._height],this._bottom)),t.push(l(this.below_panel._height,[-1,this.frame._bottom])),t.push(l(this.left_panel._width,[-1,this._left])),t.push(l(this.left_panel._width,[-1,this.frame._left])),t.push(l(this.right_panel._width,[-1,this._width],this._right)),t.push(l(this.right_panel._width,[-1,this.canvas._right],this.frame._right)),t},e.prototype._get_side_constraints=function(){var t,e,r,n,o,i,s,a,u,c,p,h;for(e=[],h=[["above",this.plot.above],["below",this.plot.below],["left",this.plot.left],["right",this.plot.right]],r=0,s=h.length;r<s;r++){for(c=h[r],p=c[0],i=c[1],o=this.frame,n=0,a=i.length;n<a;n++)u=i[n],t=function(){switch(p){case"above":return l(o.panel._top,[-1,u.panel._bottom]);case"below":return l(o.panel._bottom,[-1,u.panel._top]);case"left":return l(o.panel._left,[-1,u.panel._right]);case"right":return l(o.panel._right,[-1,u.panel._left])}}(),e.push(t),o=u;0!==i.length&&(t=function(){switch(p){case"above":return l(o.panel._top,[-1,this.above_panel._top]);case"below":return l(o.panel._bottom,[-1,this.below_panel._bottom]);case"left":return l(o.panel._left,[-1,this.left_panel._left]);case"right":return l(o.panel._right,[-1,this.right_panel._right])}}.call(this),e.push(t))}return e},e.prototype.plot_canvas=function(){return this},e}(h.Model),e.exports={Model:_,View:d}},{"../../core/bokeh_view":"core/bokeh_view","../../core/build_views":"core/build_views","../../core/enums":"core/enums","../../core/layout/layout_canvas":"core/layout/layout_canvas","../../core/layout/side_panel":"core/layout/side_panel","../../core/layout/solver":"core/layout/solver","../../core/logging":"core/logging","../../core/properties":"core/properties","../../core/ui_events":"core/ui_events","../../core/util/throttle":"core/util/throttle","../../core/visuals":"core/visuals","../canvas/canvas":"models/canvas/canvas","../canvas/cartesian_frame":"models/canvas/cartesian_frame","../layouts/layout_dom":"models/layouts/layout_dom","../ranges/data_range1d":"models/ranges/data_range1d","../renderers/glyph_renderer":"models/renderers/glyph_renderer",jquery:"jquery",underscore:"underscore"}],"models/ranges/data_range":[function(t,e,r){var n,o,i,s,a=function(t,e){function r(){this.constructor=t}for(var n in e)l.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},l={}.hasOwnProperty;i=t("underscore"),o=t("./range"),s=t("../../core/properties"),n=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return a(e,t),e.prototype.type="DataRange",e.define({names:[s.Array,[]],renderers:[s.Array,[]]}),e}(o.Model),e.exports={Model:n}},{"../../core/properties":"core/properties","./range":"models/ranges/range",underscore:"underscore"}],"models/ranges/data_range1d":[function(t,e,r){var n,o,i,s,a,l,u=function(t,e){function r(){this.constructor=t}for(var n in e)c.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},c={}.hasOwnProperty;i=t("underscore"),n=t("./data_range"),a=t("../../core/logging").logger,l=t("../../core/properties"),s=t("../../core/util/bbox"),o=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return u(e,t),e.prototype.type="DataRange1d",e.define({start:[l.Number],end:[l.Number],range_padding:[l.Number,.1],flipped:[l.Bool,!1],follow:[l.String],follow_interval:[l.Number],default_span:[l.Number,2],bounds:[l.Any],min_interval:[l.Any],max_interval:[l.Any]}),e.prototype.initialize=function(t,r){return e.__super__.initialize.call(this,t,r),this.plot_bounds={},this.have_updated_interactively=!1,this._initial_start=this.start,this._initial_end=this.end,this._initial_range_padding=this.range_padding,this._initial_follow=this.follow,this._initial_follow_interval=this.follow_interval,this._initial_default_span=this.default_span},e.getters({min:function(){return Math.min(this.start,this.end)},max:function(){return Math.max(this.start,this.end)}}),e.prototype.computed_renderers=function(){var t,e,r,n,o,i,s,l,u,c,p;if(i=this.names,c=this.renderers,0===c.length)for(u=this.plots,e=0,n=u.length;e<n;e++)s=u[e],t=s.renderers,p=function(){var e,r,n;for(n=[],e=0,r=t.length;e<r;e++)l=t[e],"GlyphRenderer"===l.type&&n.push(l);return n}(),c=c.concat(p);for(i.length>0&&(c=function(){var t,e,r;for(r=[],t=0,e=c.length;t<e;t++)l=c[t],i.indexOf(l.name)>=0&&r.push(l);return r}()),a.debug("computed "+c.length+" renderers for DataRange1d "+this.id),r=0,o=c.length;r<o;r++)l=c[r],a.trace(" - "+l.type+" "+l.id);return c},e.prototype._compute_plot_bounds=function(t,e){var r,n,o,i;for(i=s.empty(),r=0,n=t.length;r<n;r++)o=t[r],null!=e[o.id]&&(i=s.union(i,e[o.id]));return i},e.prototype._compute_min_max=function(t,e){var r,n,o,i,a,l,u;i=s.empty();for(r in t)u=t[r],i=s.union(i,u);return 0===e?(a=[i.minX,i.maxX],o=a[0],n=a[1]):(l=[i.minY,i.maxY],o=l[0],n=l[1]),[o,n]},e.prototype._compute_range=function(t,e){var r,n,o,i,s,a,l,u,c,p;return s=this.range_padding,null!=s&&s>0?(c=e===t?this.default_span:(e-t)*(1+s),r=(e+t)/2,a=[r-c/2,r+c/2],p=a[0],n=a[1]):(l=[t,e],p=l[0],n=l[1]),i=1,this.flipped&&(u=[n,p],p=u[0],n=u[1],i=-1),o=this.follow_interval,null!=o&&Math.abs(p-n)>o&&("start"===this.follow?n=p+i*o:"end"===this.follow&&(p=n-i*o)),[p,n]},e.prototype.update=function(t,e,r){var n,o,i,s,a,l,u,c,p,h,_;if(!this.have_updated_interactively)return h=this.computed_renderers(),this.plot_bounds[r]=this._compute_plot_bounds(h,t),u=this._compute_min_max(this.plot_bounds,e),a=u[0],s=u[1],c=this._compute_range(a,s),_=c[0],i=c[1],null!=this._initial_start&&(_=this._initial_start),null!=this._initial_end&&(i=this._initial_end),p=[this.start,this.end],o=p[0],n=p[1],_===o&&i===n||(l={},_!==o&&(l.start=_),i!==n&&(l.end=i),this.setv(l)),"auto"===this.bounds?this.bounds=[_,i]:void 0},e.prototype.reset=function(){return this.have_updated_interactively=!1,this.setv({range_padding:this._initial_range_padding,follow:this._initial_follow,follow_interval:this._initial_follow_interval,default_span:this._initial_default_span})},e}(n.Model),e.exports={Model:o}},{"../../core/logging":"core/logging","../../core/properties":"core/properties","../../core/util/bbox":"core/util/bbox","./data_range":"models/ranges/data_range",underscore:"underscore"}],"models/ranges/factor_range":[function(t,e,r){var n,o,i,s,a=function(t,e){function r(){this.constructor=t}for(var n in e)l.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},l={}.hasOwnProperty;i=t("underscore"),o=t("./range"),s=t("../../core/properties"),n=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return a(e,t),e.prototype.type="FactorRange",e.define({offset:[s.Number,0],factors:[s.Array,[]],bounds:[s.Any],min_interval:[s.Any],max_interval:[s.Any]}),e.internal({_bounds_as_factors:[s.Any],start:[s.Number],end:[s.Number]}),e.prototype.initialize=function(t,r){return e.__super__.initialize.call(this,t,r),null!=this.bounds&&"auto"!==this.bounds?this._bounds_as_factors=this.bounds:this._bounds_as_factors=this.factors,this._init(),this.listenTo(this,"change:factors",this._update_factors),this.listenTo(this,"change:offset",this._init)},e.getters({min:function(){return this.start},max:function(){return this.end}}),e.prototype.reset=function(){return this._init()},e.prototype._update_factors=function(){return this._bounds_as_factors=this.factors,this._init()},e.prototype._init=function(){var t,e,r;if(e=this.factors,null!=this.bounds&&"auto"!==this.bounds&&(e=this._bounds_as_factors,this.factors=e),r=.5+this.offset,t=e.length+r,this.start=r,this.end=t,null!=this.bounds)return this.bounds=[r,t]},e}(o.Model),e.exports={Model:n}},{"../../core/properties":"core/properties","./range":"models/ranges/range",underscore:"underscore"}],"models/ranges/range":[function(t,e,r){var n,o,i,s,a=function(t,e){function r(){this.constructor=t}for(var n in e)l.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},l={}.hasOwnProperty;i=t("underscore"),n=t("../../model"),s=t("../../core/properties"),o=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return a(e,t),e.prototype.type="Range",e.define({callback:[s.Instance]}),e.internal({plots:[s.Array,[]]}),e.prototype.reset=function(){},e}(n),e.exports={Model:o}},{"../../core/properties":"core/properties","../../model":"model",underscore:"underscore"}],"models/ranges/range1d":[function(t,e,r){var n,o,i,s,a=function(t,e){function r(){this.constructor=t}for(var n in e)l.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},l={}.hasOwnProperty;i=t("underscore"),n=t("./range"),s=t("../../core/properties"),o=function(t){function e(){var t,r;return this instanceof e?e.__super__.constructor.apply(this,arguments):(r=arguments[0],t=arguments[1],new e({start:r,end:t}))}return a(e,t),e.prototype.type="Range1d",e.define({start:[s.Number,0],end:[s.Number,1],bounds:[s.Any],min_interval:[s.Any],max_interval:[s.Any]}),e.prototype._set_auto_bounds=function(){var t,e;if("auto"===this.bounds)return e=Math.min(this._initial_start,this._initial_end),t=Math.max(this._initial_start,this._initial_end),this.bounds=[e,t]},e.prototype.initialize=function(t,r){return e.__super__.initialize.call(this,t,r),this._initial_start=this.start,this._initial_end=this.end,this._set_auto_bounds()},e.getters({min:function(){return Math.min(this.start,this.end)},max:function(){return Math.max(this.start,this.end)}}),e.prototype.reset=function(){return this.setv({start:this._initial_start,end:this._initial_end}),this._set_auto_bounds()},e}(n.Model),e.exports={Model:o}},{"../../core/properties":"core/properties","./range":"models/ranges/range",underscore:"underscore"}],"models/renderers/glyph_renderer":[function(t,e,r){var n,o,i,s,a,l,u,c=function(t,e){function r(){this.constructor=t}for(var n in e)p.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},p={}.hasOwnProperty;a=t("underscore"),s=t("./renderer"),i=t("../sources/remote_data_source"),l=t("../../core/logging").logger,u=t("../../core/properties"),o=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return c(e,t),e.prototype.initialize=function(t){var r,n,o,s,l,u,c,p,h;if(e.__super__.initialize.call(this,t),r=this.model.glyph,s=a.contains(r.mixins,"fill"),l=a.contains(r.mixins,"line"),o=a.omit(a.clone(r.attributes),"id"),c=function(t){var e;return e=a.clone(o),s&&a.extend(e,t.fill),l&&a.extend(e,t.line),new r.constructor(e)},this.glyph=this.build_glyph_view(r),h=this.model.selection_glyph,null==h&&(h=c(this.model.selection_defaults)),this.selection_glyph=this.build_glyph_view(h),p=this.model.nonselection_glyph,null==p&&(p=c(this.model.nonselection_defaults)),this.nonselection_glyph=this.build_glyph_view(p),u=this.model.hover_glyph,null!=u&&(this.hover_glyph=this.build_glyph_view(u)),n=c(this.model.decimated_defaults),this.decimated_glyph=this.build_glyph_view(n),this.xmapper=this.plot_view.frame.x_mappers[this.model.x_range_name],this.ymapper=this.plot_view.frame.y_mappers[this.model.y_range_name],this.set_data(!1),this.model.data_source instanceof i.Model)return this.model.data_source.setup(this.plot_view,this.glyph)},e.prototype.build_glyph_view=function(t){return new t.default_view({model:t,renderer:this,plot_view:this.plot_view})},e.prototype.bind_bokeh_events=function(){return this.listenTo(this.model,"change",this.request_render),this.listenTo(this.model.data_source,"change",this.set_data),this.listenTo(this.model.data_source,"patch",this.set_data),this.listenTo(this.model.data_source,"stream",this.set_data),this.listenTo(this.model.data_source,"select",this.request_render),null!=this.hover_glyph&&this.listenTo(this.model.data_source,"inspect",this.request_render),this.listenTo(this.model.glyph,"propchange",function(){return this.glyph.set_visuals(this.model.data_source),this.request_render()})},e.prototype.have_selection_glyphs=function(){return null!=this.selection_glyph&&null!=this.nonselection_glyph},e.prototype.set_data=function(t,e){var r,n,o,i,s,a,u,c,p;for(null==t&&(t=!0),p=Date.now(),c=this.model.data_source,this.glyph.model.setv({x_range_name:this.model.x_range_name,y_range_name:this.model.y_range_name},{silent:!0}),this.glyph.set_data(c,e),
|
|
this.glyph.set_visuals(c),this.decimated_glyph.set_visuals(c),this.have_selection_glyphs()&&(this.selection_glyph.set_visuals(c),this.nonselection_glyph.set_visuals(c)),null!=this.hover_glyph&&this.hover_glyph.set_visuals(c),i=c.get_length(),null==i&&(i=1),this.all_indices=function(){u=[];for(var t=0;0<=i?t<i:t>i;0<=i?t++:t--)u.push(t);return u}.apply(this),s=this.plot_model.plot.lod_factor,this.decimated=[],n=o=0,a=Math.floor(this.all_indices.length/s);0<=a?o<a:o>a;n=0<=a?++o:--o)this.decimated.push(this.all_indices[n*s]);if(r=Date.now()-p,l.debug(this.glyph.model.type+" GlyphRenderer ("+this.model.id+"): set_data finished in "+r+"ms"),this.set_data_timestamp=Date.now(),t)return this.request_render()},e.prototype.render=function(){var t,e,r,n,o,i,s,u,c,p,h,_,d,f,m,g,y,v,b,x,w,k,M,T,S,z;if(this.model.visible!==!1){if(k=Date.now(),s=this.glyph.glglyph,M=Date.now(),this.glyph.map_data(),e=Date.now()-k,T=Date.now(),p=this.glyph.mask_data(this.all_indices),r=Date.now()-T,t=this.plot_view.canvas_view.ctx,t.save(),b=this.model.data_source.selected,b=b&&0!==b.length?b["0d"].glyph?p:b["1d"].indices.length>0?b["1d"].indices:[]:[],h=this.model.data_source.inspected,h=h&&0!==h.length?h["0d"].glyph?p:h["1d"].indices.length>0?h["1d"].indices:[]:[],g=this.plot_model.plot.lod_threshold,this.plot_view.interactive&&!s&&null!=g&&this.all_indices.length>g?(p=this.decimated,u=this.decimated_glyph,v=this.decimated_glyph,w=this.selection_glyph):(u=this.glyph,v=this.nonselection_glyph,w=this.selection_glyph),null!=this.hover_glyph&&h.length&&(p=a.without.bind(null,p).apply(null,h)),b.length&&this.have_selection_glyphs()){for(z=Date.now(),x={},_=0,f=b.length;_<f;_++)c=b[_],x[c]=!0;for(b=new Array,y=new Array,d=0,m=p.length;d<m;d++)c=p[d],null!=x[c]?b.push(c):y.push(c);o=Date.now()-z,S=Date.now(),v.render(t,y,this.glyph),w.render(t,b,this.glyph),null!=this.hover_glyph&&this.hover_glyph.render(t,h,this.glyph),n=Date.now()-S}else S=Date.now(),u.render(t,p,this.glyph),this.hover_glyph&&h.length&&this.hover_glyph.render(t,h,this.glyph),n=Date.now()-S;return this.last_dtrender=n,i=Date.now()-k,l.debug(this.glyph.model.type+" GlyphRenderer ("+this.model.id+"): render finished in "+i+"ms"),l.trace(" - map_data finished in : "+e+"ms"),null!=r&&l.trace(" - mask_data finished in : "+r+"ms"),null!=o&&l.trace(" - selection mask finished in : "+o+"ms"),l.trace(" - glyph renders finished in : "+n+"ms"),t.restore()}},e.prototype.map_to_screen=function(t,e){return this.plot_view.map_to_screen(t,e,this.model.x_range_name,this.model.y_range_name)},e.prototype.draw_legend=function(t,e,r,n,o,i,s){var a;return a=this.model.get_reference_point(i,s),this.glyph.draw_legend_for_index(t,e,r,n,o,a)},e.prototype.hit_test=function(t){return this.glyph.hit_test(t)},e}(s.View),n=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return c(e,t),e.prototype.default_view=o,e.prototype.type="GlyphRenderer",e.prototype.get_reference_point=function(t,e){var r,n,o;return o=0,null!=t&&null!=this.data_source.get_column&&(r=this.data_source.get_column(t),r&&(n=r.indexOf(e),n>0&&(o=n))),o},e.define({x_range_name:[u.String,"default"],y_range_name:[u.String,"default"],data_source:[u.Instance],glyph:[u.Instance],hover_glyph:[u.Instance],nonselection_glyph:[u.Instance],selection_glyph:[u.Instance]}),e.override({level:"glyph"}),e.prototype.selection_defaults={fill:{},line:{}},e.prototype.decimated_defaults={fill:{fill_alpha:.3,fill_color:"grey"},line:{line_alpha:.3,line_color:"grey"}},e.prototype.nonselection_defaults={fill:{fill_alpha:.2,line_alpha:.2},line:{}},e}(s.Model),e.exports={Model:n,View:o}},{"../../core/logging":"core/logging","../../core/properties":"core/properties","../sources/remote_data_source":"models/sources/remote_data_source","./renderer":"models/renderers/renderer",underscore:"underscore"}],"models/renderers/guide_renderer":[function(t,e,r){var n,o,i,s,a=function(t,e){function r(){this.constructor=t}for(var n in e)l.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},l={}.hasOwnProperty;i=t("underscore"),o=t("./renderer"),s=t("../../core/properties"),n=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return a(e,t),e.prototype.type="GuideRenderer",e.define({plot:[s.Instance]}),e.override({level:"overlay"}),e}(o.Model),e.exports={Model:n}},{"../../core/properties":"core/properties","./renderer":"models/renderers/renderer",underscore:"underscore"}],"models/renderers/renderer":[function(t,e,r){var n,o,i,s,a,l,u,c,p,h=function(t,e){function r(){this.constructor=t}for(var n in e)_.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},_={}.hasOwnProperty;l=t("underscore"),n=t("../../core/bokeh_view"),a=t("../../core/visuals").Visuals,u=t("../../core/logging").logger,c=t("../../core/properties"),p=t("../../core/util/projections"),o=t("../../model"),s=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return h(e,t),e.prototype.initialize=function(t){return e.__super__.initialize.call(this,t),this.plot_view=t.plot_view,this.visuals=new a(this.model)},e.getters({plot_model:function(){return this.plot_view.model}}),e.prototype.request_render=function(){return this.plot_view.request_render()},e.prototype.set_data=function(t){var e,r,n;if(e=this.model.materialize_dataspecs(t),l.extend(this,e),this.plot_model.use_map&&(null!=this._x&&(r=p.project_xy(this._x,this._y),this._x=r[0],this._y=r[1]),null!=this._xs))return n=p.project_xsys(this._xs,this._ys),this._xs=n[0],this._ys=n[1],n},e.prototype.map_to_screen=function(t,e){return this.plot_view.map_to_screen(t,e,this.model.x_range_name,this.model.y_range_name)},e}(n),i=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return h(e,t),e.prototype.type="Renderer",e.define({level:[c.RenderLevel,null],visible:[c.Bool,!0]}),e}(o),e.exports={Model:i,View:s}},{"../../core/bokeh_view":"core/bokeh_view","../../core/logging":"core/logging","../../core/properties":"core/properties","../../core/util/projections":"core/util/projections","../../core/visuals":"core/visuals","../../model":"model",underscore:"underscore"}],"models/sources/ajax_data_source":[function(t,e,r){var n,o,i,s,a,l,u=function(t,e){return function(){return t.apply(e,arguments)}},c=function(t,e){function r(){this.constructor=t}for(var n in e)p.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},p={}.hasOwnProperty;n=t("jquery"),s=t("underscore"),i=t("./remote_data_source"),a=t("../../core/logging").logger,l=t("../../core/properties"),o=function(t){function e(){return this.get_data=u(this.get_data,this),this.setup=u(this.setup,this),this.destroy=u(this.destroy,this),e.__super__.constructor.apply(this,arguments)}return c(e,t),e.prototype.type="AjaxDataSource",e.define({mode:[l.String,"replace"],content_type:[l.String,"application/json"],http_headers:[l.Any,{}],max_size:[l.Number],method:[l.String,"POST"],if_modified:[l.Bool,!1]}),e.prototype.destroy=function(){if(null!=this.interval)return clearInterval(this.interval)},e.prototype.setup=function(t,e){if(this.pv=t,this.get_data(this.mode),this.polling_interval)return this.interval=setInterval(this.get_data,this.polling_interval,this.mode,this.max_size,this.if_modified)},e.prototype.get_data=function(t,e,r){return null==e&&(e=0),null==r&&(r=!1),n.ajax({dataType:"json",ifModified:r,url:this.data_url,xhrField:{withCredentials:!0},method:this.method,contentType:this.content_type,headers:this.http_headers}).done(function(r){return function(n){var o,i,s,l,u;if("replace"===t)r.data=n;else if("append"===t){for(l=r.data,u=r.columns(),i=0,s=u.length;i<s;i++)o=u[i],n[o]=l[o].concat(n[o]).slice(-e);r.data=n}else a.error("unsupported mode: "+t);return a.trace(n),null}}(this)).error(function(){return a.error(arguments)}),null},e}(i.Model),e.exports={Model:o}},{"../../core/logging":"core/logging","../../core/properties":"core/properties","./remote_data_source":"models/sources/remote_data_source",jquery:"jquery",underscore:"underscore"}],"models/sources/column_data_source":[function(t,e,r){var n,o,i,s,a,l,u,c=function(t,e){function r(){this.constructor=t}for(var n in e)p.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},p={}.hasOwnProperty;s=t("underscore"),o=t("./data_source"),a=t("../../core/hittest"),i=t("../../core/selection_manager"),l=t("../../core/logging").logger,u=t("../../core/properties"),n=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return c(e,t),e.prototype.type="ColumnDataSource",e.define({data:[u.Any,{}],column_names:[u.Array,[]]}),e.internal({selection_manager:[u.Instance,function(t){return new i({source:t})}],inspected:[u.Any]}),e.prototype.get_column=function(t){var e;return null!=(e=this.data[t])?e:null},e.prototype.get_length=function(){var t,e,r,n;return t=this.data,0===s.keys(t).length?null:(r=s.uniq(function(){var r;r=[];for(e in t)n=t[e],r.push(n.length);return r}()),r.length>1&&l.debug("data source has columns of inconsistent lengths"),r[0])},e.prototype.columns=function(){return s.keys(this.data)},e.prototype.stream=function(t,e){var r,n,o;r=this.data;for(n in t)o=t[n],r[n]=r[n].concat(t[n]),r[n].length>e&&(r[n]=r[n].slice(-e));return this.setv("data",r,{silent:!0}),this.trigger("stream")},e.prototype.patch=function(t){var e,r,n,o,i,s,a,l,u;e=this.data;for(i in t)for(s=t[i],r=o=0,a=s.length;0<=a?o<a:o>a;r=0<=a?++o:--o)l=s[r],n=l[0],u=l[1],e[i][n]=u;return this.setv("data",e,{silent:!0}),this.trigger("patch")},e}(o.Model),e.exports={Model:n}},{"../../core/hittest":"core/hittest","../../core/logging":"core/logging","../../core/properties":"core/properties","../../core/selection_manager":"core/selection_manager","./data_source":"models/sources/data_source",underscore:"underscore"}],"models/sources/data_source":[function(t,e,r){var n,o,i,s,a,l=function(t,e){function r(){this.constructor=t}for(var n in e)u.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},u={}.hasOwnProperty;i=t("underscore"),o=t("../../model"),s=t("../../core/hittest"),a=t("../../core/properties"),n=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return l(e,t),e.prototype.type="DataSource",e.define({selected:[a.Any,s.create_hit_test_result()],callback:[a.Any]}),e.prototype.initialize=function(t){return e.__super__.initialize.call(this,t),this.listenTo(this,"change:selected",function(t){return function(){var e;if(e=t.callback,null!=e)return i.isFunction(e)?e(t):e.execute(t)}}(this))},e}(o),e.exports={Model:n}},{"../../core/hittest":"core/hittest","../../core/properties":"core/properties","../../model":"model",underscore:"underscore"}],"models/sources/geojson_data_source":[function(t,e,r){var n,o,i,s,a,l=function(t,e){function r(){this.constructor=t}for(var n in e)u.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},u={}.hasOwnProperty;i=t("underscore"),n=t("./column_data_source"),s=t("../../core/logging").logger,a=t("../../core/properties"),o=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return l(e,t),e.prototype.type="GeoJSONDataSource",e.define({geojson:[a.Any]}),e.prototype.initialize=function(t){return e.__super__.initialize.call(this,t),this._update_data(),this.listenTo(this,"change:geojson",function(t){return function(){return t._update_data()}}(this))},e.prototype._update_data=function(){return this.data=this.geojson_to_column_data()},e.prototype._get_new_list_array=function(t){var e,r;return e=new Array(t),r=i.map(e,function(t){return[]})},e.prototype._get_new_nan_array=function(t){var e,r;return e=new Array(t),r=i.map(e,function(t){return NaN})},e.prototype._flatten_function=function(t,e){return t.concat([[NaN,NaN,NaN]]).concat(e)},e.prototype._add_properties=function(t,e,r,n){var o,i;i=[];for(o in t.properties)e.hasOwnProperty(o)||(e[o]=this._get_new_nan_array(n)),i.push(e[o][r]=t.properties[o]);return i},e.prototype._add_geometry=function(t,e,r){var n,o,a,l,u,c,p,h,_,d,f,m,g,y,v,b,x,w,k,M,T,S,z,E,A,C,j;switch(t.type){case"Point":return o=t.coordinates,e.x[r]=o[0],e.y[r]=o[1],e.z[r]=null!=(w=o[2])?w:NaN;case"LineString":for(n=t.coordinates,E=[],c=p=0,_=n.length;p<_;c=++p)o=n[c],e.xs[r][c]=o[0],e.ys[r][c]=o[1],E.push(e.zs[r][c]=null!=(k=o[2])?k:NaN);return E;case"Polygon":for(t.coordinates.length>1&&s.warn("Bokeh does not support Polygons with holes in, only exterior ring used."),a=t.coordinates[0],A=[],c=h=0,d=a.length;h<d;c=++h)o=a[c],e.xs[r][c]=o[0],e.ys[r][c]=o[1],A.push(e.zs[r][c]=null!=(M=o[2])?M:NaN);return A;case"MultiPoint":return s.warn("MultiPoint not supported in Bokeh");case"MultiLineString":for(u=i.reduce(t.coordinates,this._flatten_function),C=[],c=y=0,f=u.length;y<f;c=++y)o=u[c],e.xs[r][c]=o[0],e.ys[r][c]=o[1],C.push(e.zs[r][c]=null!=(T=o[2])?T:NaN);return C;case"MultiPolygon":for(l=[],S=t.coordinates,v=0,m=S.length;v<m;v++)x=S[v],x.length>1&&s.warn("Bokeh does not support Polygons with holes in, only exterior ring used."),l.push(x[0]);for(u=i.reduce(l,this._flatten_function),j=[],c=b=0,g=u.length;b<g;c=++b)o=u[c],e.xs[r][c]=o[0],e.ys[r][c]=o[1],j.push(e.zs[r][c]=null!=(z=o[2])?z:NaN);return j;default:throw new Error("Invalid type "+t.type)}},e.prototype._get_items_length=function(t){var e,r,n,o,i,s,a,l,u,c,p;for(e=0,o=a=0,u=t.length;a<u;o=++a)if(i=t[o],n="Feature"===i.type?i.geometry:i,"GeometryCollection"===n.type)for(p=n.geometries,s=l=0,c=p.length;l<c;s=++l)r=p[s],e+=1;else e+=1;return e},e.prototype.geojson_to_column_data=function(){var t,e,r,n,o,i,s,a,l,u,c,p,h,_,d,f;if(n=JSON.parse(this.geojson),"GeometryCollection"!==(d=n.type)&&"FeatureCollection"!==d)throw new Error("Bokeh only supports type GeometryCollection and FeatureCollection at top level");if("GeometryCollection"===n.type){if(null==n.geometries)throw new Error("No geometries found in GeometryCollection");if(0===n.geometries.length)throw new Error("geojson.geometries must have one or more items");l=n.geometries}if("FeatureCollection"===n.type){if(null==n.features)throw new Error("No features found in FeaturesCollection");if(0===n.features.length)throw new Error("geojson.features must have one or more items");l=n.features}for(a=this._get_items_length(l),e={x:this._get_new_nan_array(a),y:this._get_new_nan_array(a),z:this._get_new_nan_array(a),xs:this._get_new_list_array(a),ys:this._get_new_list_array(a),zs:this._get_new_list_array(a)},t=0,i=c=0,h=l.length;c<h;i=++c)if(s=l[i],o="Feature"===s.type?s.geometry:s,"GeometryCollection"===o.type)for(f=o.geometries,u=p=0,_=f.length;p<_;u=++p)r=f[u],this._add_geometry(r,e,t),"Feature"===s.type&&this._add_properties(s,e,t,a),t+=1;else this._add_geometry(o,e,t),"Feature"===s.type&&this._add_properties(s,e,t,a),t+=1;return e},e}(n.Model),e.exports={Model:o}},{"../../core/logging":"core/logging","../../core/properties":"core/properties","./column_data_source":"models/sources/column_data_source",underscore:"underscore"}],"models/sources/remote_data_source":[function(t,e,r){var n,o,i,s,a=function(t,e){function r(){this.constructor=t}for(var n in e)l.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},l={}.hasOwnProperty;i=t("underscore"),n=t("./column_data_source"),s=t("../../core/properties"),o=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return a(e,t),e.prototype.type="RemoteDataSource",e.define({data_url:[s.String],polling_interval:[s.Number]}),e}(n.Model),e.exports={Model:o}},{"../../core/properties":"core/properties","./column_data_source":"models/sources/column_data_source",underscore:"underscore"}],"models/tickers/adaptive_ticker":[function(t,e,r){var n,o,i,s,a,l,u,c=function(t,e){function r(){this.constructor=t}for(var n in e)p.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},p={}.hasOwnProperty;i=t("underscore"),s=t("./util").argmin,o=t("./continuous_ticker"),u=t("../../core/properties"),a=function(t,e,r){return Math.max(e,Math.min(r,t))},l=function(t,e){return null==e&&(e=Math.E),Math.log(t)/Math.log(e)},n=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return c(e,t),e.prototype.type="AdaptiveTicker",e.define({base:[u.Number,10],mantissas:[u.Array,[1,2,5]],min_interval:[u.Number,0],max_interval:[u.Number]}),e.prototype.initialize=function(t,r){var n,o;return e.__super__.initialize.call(this,t,r),n=i.last(this.mantissas)/this.base,o=i.first(this.mantissas)*this.base,this.extended_mantissas=i.flatten([n,this.mantissas,o]),this.base_factor=0===this.get_min_interval()?1:this.get_min_interval()},e.prototype.get_interval=function(t,e,r){var n,o,i,u,c,p,h,_,d;return i=e-t,c=this.get_ideal_interval(t,e,r),d=Math.floor(l(c/this.base_factor,this.base)),p=Math.pow(this.base,d)*this.base_factor,h=c/p,o=this.extended_mantissas,u=o.map(function(t){return Math.abs(r-i/(t*p))}),n=o[s(u)],_=n*p,a(_,this.get_min_interval(),this.get_max_interval())},e}(o.Model),e.exports={Model:n}},{"../../core/properties":"core/properties","./continuous_ticker":"models/tickers/continuous_ticker","./util":"models/tickers/util",underscore:"underscore"}],"models/tickers/basic_ticker":[function(t,e,r){var n,o,i,s=function(t,e){function r(){this.constructor=t}for(var n in e)a.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},a={}.hasOwnProperty;i=t("underscore"),n=t("./adaptive_ticker"),o=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return s(e,t),e.prototype.type="BasicTicker",e}(n.Model),e.exports={Model:o}},{"./adaptive_ticker":"models/tickers/adaptive_ticker",underscore:"underscore"}],"models/tickers/categorical_ticker":[function(t,e,r){var n,o,i=function(t,e){function r(){this.constructor=t}for(var n in e)s.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},s={}.hasOwnProperty;o=t("./ticker"),n=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return i(e,t),e.prototype.type="CategoricalTicker",e.prototype.get_ticks=function(t,e,r,n){var o,i,s,a,l,u,c;for(o=n.desired_n_ticks,u=[],i=r.factors,s=l=0,c=i.length;0<=c?l<c:l>c;s=0<=c?++l:--l)a=s+r.offset,a+1>t&&a+1<e&&u.push(i[s]);return{major:u,minor:[]}},e}(o.Model),e.exports={Model:n}},{"./ticker":"models/tickers/ticker"}],"models/tickers/composite_ticker":[function(t,e,r){var n,o,i,s,a,l=function(t,e){function r(){this.constructor=t}for(var n in e)u.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},u={}.hasOwnProperty;i=t("underscore"),o=t("./continuous_ticker"),s=t("./util").argmin,a=t("../../core/properties"),n=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return l(e,t),e.prototype.type="CompositeTicker",e.define({tickers:[a.Array,[]]}),e.getters({min_intervals:function(){return i.invoke(this.tickers,"get_min_interval")},max_intervals:function(){return i.invoke(this.tickers,"get_max_interval")},min_interval:function(){return i.first(this.min_intervals)},max_interval:function(){return i.first(this.max_intervals)}}),e.prototype.get_best_ticker=function(t,e,r){var n,o,a,l,u,c,p,h;return l=e-t,c=this.get_ideal_interval(t,e,r),h=[i.sortedIndex(this.min_intervals,c)-1,i.sortedIndex(this.max_intervals,c)],p=[this.min_intervals[h[0]],this.max_intervals[h[1]]],u=p.map(function(t){return Math.abs(r-l/t)}),n=s(u),n===1/0?this.tickers[0]:(a=h[n],o=this.tickers[a])},e.prototype.get_interval=function(t,e,r){var n;return n=this.get_best_ticker(t,e,r),n.get_interval(t,e,r)},e.prototype.get_ticks_no_defaults=function(t,e,r){var n,o;return n=this.get_best_ticker(t,e,r),o=n.get_ticks_no_defaults(t,e,r)},e}(o.Model),e.exports={Model:n}},{"../../core/properties":"core/properties","./continuous_ticker":"models/tickers/continuous_ticker","./util":"models/tickers/util",underscore:"underscore"}],"models/tickers/continuous_ticker":[function(t,e,r){var n,o,i,s,a=function(t,e){function r(){this.constructor=t}for(var n in e)l.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},l={}.hasOwnProperty;i=t("underscore"),o=t("./ticker"),s=t("../../core/properties"),n=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return a(e,t),e.prototype.type="ContinuousTicker",e.define({num_minor_ticks:[s.Number,5],desired_num_ticks:[s.Number,6]}),e.prototype.get_interval=void 0,e.prototype.get_min_interval=function(){return this.min_interval},e.prototype.get_max_interval=function(){var t;return null!=(t=this.max_interval)?t:1/0},e.prototype.get_ideal_interval=function(t,e,r){var n;return n=e-t,n/r},e}(o.Model),e.exports={Model:n}},{"../../core/properties":"core/properties","./ticker":"models/tickers/ticker",underscore:"underscore"}],"models/tickers/datetime_ticker":[function(t,e,r){var n,o,i,s,a,l,u,c,p,h,_,d,f,m=function(t,e){function r(){this.constructor=t}for(var n in e)g.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},g={}.hasOwnProperty;d=t("underscore"),n=t("./adaptive_ticker"),o=t("./composite_ticker"),s=t("./days_ticker"),a=t("./months_ticker"),_=t("./years_ticker"),f=t("./util"),u=f.ONE_MILLI,h=f.ONE_SECOND,c=f.ONE_MINUTE,l=f.ONE_HOUR,p=f.ONE_MONTH,i=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return m(e,t),e.prototype.type="DatetimeTicker",e.override({num_minor_ticks:0,tickers:function(){return[new n.Model({mantissas:[1,2,5],base:10,min_interval:0,max_interval:500*u,num_minor_ticks:0}),new n.Model({mantissas:[1,2,5,10,15,20,30],base:60,min_interval:h,max_interval:30*c,num_minor_ticks:0}),new n.Model({mantissas:[1,2,4,6,8,12],base:24,min_interval:l,max_interval:12*l,num_minor_ticks:0}),new s.Model({days:d.range(1,32)}),new s.Model({days:d.range(1,31,3)}),new s.Model({days:[1,8,15,22]}),new s.Model({days:[1,15]}),new a.Model({months:d.range(0,12,1)}),new a.Model({months:d.range(0,12,2)}),new a.Model({months:d.range(0,12,4)}),new a.Model({months:d.range(0,12,6)}),new _.Model({})]}}),e}(o.Model),e.exports={Model:i}},{"./adaptive_ticker":"models/tickers/adaptive_ticker","./composite_ticker":"models/tickers/composite_ticker","./days_ticker":"models/tickers/days_ticker","./months_ticker":"models/tickers/months_ticker","./util":"models/tickers/util","./years_ticker":"models/tickers/years_ticker",underscore:"underscore"}],"models/tickers/days_ticker":[function(t,e,r){var n,o,i,s,a,l,u,c,p,h=function(t,e){function r(){this.constructor=t}for(var n in e)_.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},_={}.hasOwnProperty;s=t("underscore"),i=t("./single_interval_ticker"),p=t("./util"),c=t("../../core/properties"),a=p.copy_date,u=p.last_month_no_later_than,o=p.ONE_DAY,l=function(t,e){var r,n,o,i,s;for(s=u(new Date(t)),o=u(new Date(e)),i=a(o),o.setUTCMonth(o.getUTCMonth()+1),n=[],r=s;;)if(n.push(a(r)),r.setUTCMonth(r.getUTCMonth()+1),r>o)break;return n},n=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return h(e,t),e.prototype.type="DaysTicker",e.define({days:[c.Array,[]]}),e.prototype.initialize=function(t,r){var n,i;return t.num_minor_ticks=0,e.__super__.initialize.call(this,t,r),n=this.days,i=n.length>1?(n[1]-n[0])*o:31*o,this.interval=i},e.prototype.get_ticks_no_defaults=function(t,e,r){var n,o,i,u,c,p,h,_;return h=l(t,e),u=this.days,c=function(t){return function(t,e){var r,n,o,i,s,l;for(r=[],s=0,l=u.length;s<l;s++)n=u[s],o=a(t),o.setUTCDate(n),i=new Date(o.getTime()+e/2),i.getUTCMonth()===t.getUTCMonth()&&r.push(o);return r}}(this),p=this.interval,i=s.flatten(function(){var t,e,r;for(r=[],t=0,e=h.length;t<e;t++)o=h[t],r.push(c(o,p));return r}()),n=s.invoke(i,"getTime"),_=s.filter(n,function(r){return t<=r&&r<=e}),{major:_,minor:[]}},e}(i.Model),e.exports={Model:n}},{"../../core/properties":"core/properties","./single_interval_ticker":"models/tickers/single_interval_ticker","./util":"models/tickers/util",underscore:"underscore"}],"models/tickers/fixed_ticker":[function(t,e,r){var n,o,i,s,a=function(t,e){function r(){this.constructor=t}for(var n in e)l.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},l={}.hasOwnProperty;i=t("underscore"),n=t("./continuous_ticker"),s=t("../../core/properties"),o=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return a(e,t),e.prototype.type="FixedTicker",e.define({ticks:[s.Array,[]]}),e.prototype.get_ticks_no_defaults=function(t,e,r){return{major:this.ticks,minor:[]}},e}(n.Model),e.exports={Model:o}},{"../../core/properties":"core/properties","./continuous_ticker":"models/tickers/continuous_ticker",underscore:"underscore"}],"models/tickers/log_ticker":[function(t,e,r){var n,o,i,s,a=function(t,e){function r(){this.constructor=t}for(var n in e)l.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},l={}.hasOwnProperty;i=t("underscore"),n=t("./adaptive_ticker"),s=function(t,e,r){var n,o;if(i.isUndefined(e)&&(e=t,t=0),i.isUndefined(r)&&(r=1),r>0&&t>=e||r<0&&t<=e)return[];for(o=[],n=t;r>0?n<e:n>e;)o.push(n),n+=r;return o},o=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return a(e,t),e.prototype.type="LogTicker",e.override({mantissas:[1,5]}),e.prototype.get_ticks_no_defaults=function(t,e,r){var n,o,a,l,u,c,p,h,_,d,f,m,g,y,v,b,x,w,k,M,T,S,z,E,A,C,j,P,N,O,D,F;if(A=this.num_minor_ticks,z=[],t<=0&&(t=1),t>e&&(j=[e,t],t=j[0],e=j[1]),n=this.base,k=Math.log(t)/Math.log(n),x=Math.log(e)/Math.log(n),w=x-k,w<2){if(p=this.get_interval(t,e,r),P=Math.floor(t/p),o=Math.ceil(e/p),u=i.isNaN(P)||i.isNaN(o)?[]:i.range(P,o+1),D=function(){var t,e,r;for(r=[],t=0,e=u.length;t<e;t++)l=u[t],0!==l&&r.push(l*p);return r}(),A>1){for(T=p/A,S=function(){var t,e,r;for(r=[],c=t=1,e=A;1<=e?t<=e:t>=e;c=1<=e?++t:--t)r.push(c*T);return r}(),h=0,f=S.length;h<f;h++)F=S[h],z.push(D[0]-F);for(_=0,m=D.length;_<m;_++)for(O=D[_],d=0,g=S.length;d<g;d++)F=S[d],z.push(O+F)}}else if(N=Math.ceil(k),a=Math.floor(x),p=Math.ceil((a-N)/9),D=s(N,a,p),(a-N)%p===0&&(D=D.concat([a])),D=D.map(function(t){return Math.pow(n,t)}),A>1){for(T=Math.pow(n,p)/A,S=function(){var t,e,r;for(r=[],c=t=1,e=A;1<=e?t<=e:t>=e;c=1<=e?++t:--t)r.push(c*T);return r}(),M=0,y=S.length;M<y;M++)F=S[M],z.push(D[0]/F);for(E=0,v=D.length;E<v;E++)for(O=D[E],C=0,b=S.length;C<b;C++)F=S[C],z.push(O*F)}return{major:D,minor:z}},e}(n.Model),e.exports={Model:o}},{"./adaptive_ticker":"models/tickers/adaptive_ticker",underscore:"underscore"}],"models/tickers/months_ticker":[function(t,e,r){var n,o,i,s,a,l,u,c,p,h=function(t,e){function r(){this.constructor=t}for(var n in e)_.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},_={}.hasOwnProperty;s=t("underscore"),i=t("./single_interval_ticker"),p=t("./util"),c=t("../../core/properties"),a=p.copy_date,u=p.last_year_no_later_than,o=p.ONE_MONTH,l=function(t,e){var r,n,o,i;for(i=u(new Date(t)),o=u(new Date(e)),o.setUTCFullYear(o.getUTCFullYear()+1),n=[],r=i;;)if(n.push(a(r)),r.setUTCFullYear(r.getUTCFullYear()+1),r>o)break;return n},n=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return h(e,t),e.prototype.type="MonthsTicker",e.define({months:[c.Array,[]]}),e.prototype.initialize=function(t,r){var n,i;return e.__super__.initialize.call(this,t,r),i=this.months,n=i.length>1?(i[1]-i[0])*o:12*o,this.interval=n},e.prototype.get_ticks_no_defaults=function(t,e,r){var n,o,i,u,c,p,h;return h=l(t,e),u=this.months,c=function(t){return u.map(function(e){var r;return r=a(t),r.setUTCMonth(e),r})},i=s.flatten(function(){var t,e,r;for(r=[],t=0,e=h.length;t<e;t++)o=h[t],r.push(c(o));return r}()),n=s.invoke(i,"getTime"),p=s.filter(n,function(r){return t<=r&&r<=e}),{major:p,minor:[]}},e}(i.Model),e.exports={Model:n}},{"../../core/properties":"core/properties","./single_interval_ticker":"models/tickers/single_interval_ticker","./util":"models/tickers/util",underscore:"underscore"}],"models/tickers/single_interval_ticker":[function(t,e,r){var n,o,i,s,a=function(t,e){function r(){this.constructor=t}for(var n in e)l.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},l={}.hasOwnProperty;i=t("underscore"),n=t("./continuous_ticker"),s=t("../../core/properties"),o=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return a(e,t),e.prototype.type="SingleIntervalTicker",e.define({interval:[s.Number]}),e.getters({min_interval:function(){return this.interval},max_interval:function(){return this.interval}}),e.prototype.get_interval=function(t,e,r){return this.interval},e}(n.Model),e.exports={Model:o}},{"../../core/properties":"core/properties","./continuous_ticker":"models/tickers/continuous_ticker",underscore:"underscore"}],"models/tickers/ticker":[function(t,e,r){var n,o,i,s=function(t,e){function r(){this.constructor=t}for(var n in e)a.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},a={}.hasOwnProperty;i=t("underscore"),n=t("../../model"),o=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return s(e,t),e.prototype.type="Ticker",e.prototype.get_ticks=function(t,e,r,n){var o;return o=n.desired_n_ticks,this.get_ticks_no_defaults(t,e,this.desired_num_ticks)},e.prototype.get_ticks_no_defaults=function(t,e,r){var n,o,s,a,l,u,c,p,h,_,d,f,m,g,y,v,b,x,w;if(l=this.get_interval(t,e,r),v=Math.floor(t/l),n=Math.ceil(e/l),s=i.isNaN(v)||i.isNaN(n)?[]:i.range(v,n+1),x=function(){var t,e,r;for(r=[],t=0,e=s.length;t<e;t++)o=s[t],r.push(o*l);return r}(),y=this.num_minor_ticks,g=[],y>1){for(f=l/y,m=function(){var t,e,r;for(r=[],a=t=1,e=y;1<=e?t<=e:t>=e;a=1<=e?++t:--t)r.push(a*f);return r}(),u=0,h=m.length;u<h;u++)w=m[u],g.push(x[0]-w);for(c=0,_=x.length;c<_;c++)for(b=x[c],p=0,d=m.length;p<d;p++)w=m[p],g.push(b+w)}return{major:x,minor:g}},e}(n),e.exports={Model:o}},{"../../model":"model",underscore:"underscore"}],"models/tickers/util":[function(t,e,r){var n,o,i,s,a,l,u,c,p,h,_,d;c=t("underscore"),i=1,l=1e3,s=60*l,o=60*s,n=24*o,a=30*n,u=365*n,p=function(t){var e;return e=c.min(c.range(t.length),function(e){return t[e]})},h=function(t){return new Date(t.getTime())},_=function(t){return t=h(t),t.setUTCDate(1),t.setUTCHours(0),t.setUTCMinutes(0),t.setUTCSeconds(0),t.setUTCMilliseconds(0),t},d=function(t){return t=_(t),t.setUTCMonth(0),t},e.exports={argmin:p,copy_date:h,last_month_no_later_than:_,last_year_no_later_than:d,ONE_MILLI:i,ONE_SECOND:l,ONE_MINUTE:s,ONE_HOUR:o,ONE_DAY:n,ONE_MONTH:a,ONE_YEAR:u}},{underscore:"underscore"}],"models/tickers/years_ticker":[function(t,e,r){var n,o,i,s,a,l,u,c=function(t,e){function r(){this.constructor=t}for(var n in e)p.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},p={}.hasOwnProperty;a=t("underscore"),n=t("./basic_ticker"),i=t("./single_interval_ticker"),u=t("./util"),l=u.last_year_no_later_than,o=u.ONE_YEAR,s=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return c(e,t),e.prototype.type="YearsTicker",e.prototype.initialize=function(t,r){return e.__super__.initialize.call(this,t,r),this.interval=o,this.basic_ticker=new n.Model({num_minor_ticks:0})},e.prototype.get_ticks_no_defaults=function(t,e,r){var n,o,i,s,u,c;return i=l(new Date(t)).getUTCFullYear(),o=l(new Date(e)).getUTCFullYear(),c=this.basic_ticker.get_ticks_no_defaults(i,o,r).major,n=function(){var t,e,r;for(r=[],t=0,e=c.length;t<e;t++)u=c[t],r.push(Date.UTC(u,0,1));return r}(),s=a.filter(n,function(r){return t<=r&&r<=e}),{major:s,minor:[]}},e}(i.Model),e.exports={Model:s}},{"./basic_ticker":"models/tickers/basic_ticker","./single_interval_ticker":"models/tickers/single_interval_ticker","./util":"models/tickers/util",
|
|
underscore:"underscore"}],"models/tiles/bbox_tile_source":[function(t,e,r){var n,o,i,s,a=function(t,e){function r(){this.constructor=t}for(var n in e)l.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},l={}.hasOwnProperty;i=t("underscore"),o=t("./mercator_tile_source"),s=t("../../core/properties"),n=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return a(e,t),e.prototype.type="BBoxTileSource",e.define({use_latlon:[s.Bool,!1]}),e.prototype.get_image_url=function(t,e,r){var n,o,i,s,a,l,u;return n=this.string_lookup_replace(this.url,this.extra_url_vars),this.use_latlon?(o=this.get_tile_geographic_bounds(t,e,r),a=o[0],u=o[1],s=o[2],l=o[3]):(i=this.get_tile_meter_bounds(t,e,r),a=i[0],u=i[1],s=i[2],l=i[3]),n.replace("{XMIN}",a).replace("{YMIN}",u).replace("{XMAX}",s).replace("{YMAX}",l)},e}(o),e.exports={Model:n}},{"../../core/properties":"core/properties","./mercator_tile_source":"models/tiles/mercator_tile_source",underscore:"underscore"}],"models/tiles/dynamic_image_renderer":[function(t,e,r){var n,o,i,s,a,l,u,c=function(t,e){return function(){return t.apply(e,arguments)}},p=function(t,e){function r(){this.constructor=t}for(var n in e)h.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},h={}.hasOwnProperty;a=t("underscore"),i=t("./image_pool"),s=t("../renderers/renderer"),l=t("../../core/logging").logger,u=t("../../core/properties"),o=function(t){function e(){return this._on_image_error=c(this._on_image_error,this),this._on_image_load=c(this._on_image_load,this),e.__super__.constructor.apply(this,arguments)}return p(e,t),e.prototype.bind_bokeh_events=function(){return this.listenTo(this.model,"change",this.request_render)},e.prototype.get_extent=function(){return[this.x_range.start,this.y_range.start,this.x_range.end,this.y_range.end]},e.prototype._set_data=function(){return this.map_plot=this.plot_view.model.plot,this.map_canvas=this.plot_view.canvas_view.ctx,this.map_frame=this.plot_view.frame,this.x_range=this.map_plot.x_range,this.x_mapper=this.map_frame.x_mappers["default"],this.y_range=this.map_plot.y_range,this.y_mapper=this.map_frame.y_mappers["default"],this.lastImage=void 0,this.extent=this.get_extent()},e.prototype._map_data=function(){return this.initial_extent=this.get_extent()},e.prototype._on_image_load=function(t){var e;if(e=t.target.image_data,e.img=t.target,e.loaded=!0,this.lastImage=e,this.get_extent().join(":")===e.cache_key)return this.request_render()},e.prototype._on_image_error=function(t){var e;return l.error("Error loading image: #{e.target.src}"),e=t.target.image_data,this.model.image_source.remove_image(e)},e.prototype._create_image=function(t){var e;return e=new Image,e.onload=this._on_image_load,e.onerror=this._on_image_error,e.alt="",e.image_data={bounds:t,loaded:!1,cache_key:t.join(":")},this.model.image_source.add_image(e.image_data),e.src=this.model.image_source.get_image_url(t[0],t[1],t[2],t[3],Math.ceil(this.map_frame.height),Math.ceil(this.map_frame.width)),e},e.prototype.render=function(t,e,r){var n,o;return null==this.map_initialized&&(this._set_data(),this._map_data(),this.map_initialized=!0),n=this.get_extent(),this.render_timer&&clearTimeout(this.render_timer),o=this.model.image_source.images[n.join(":")],null!=o&&o.loaded?void this._draw_image(n.join(":")):(null!=this.lastImage&&this._draw_image(this.lastImage.cache_key),null==o?this.render_timer=setTimeout(function(t){return function(){return t._create_image(n)}}(this),125):void 0)},e.prototype._draw_image=function(t){var e,r,n,o,i,s,a,l,u,c,p;if(e=this.model.image_source.images[t],null!=e)return this.map_canvas.save(),this._set_rect(),this.map_canvas.globalAlpha=this.model.alpha,r=this.plot_view.frame.map_to_screen([e.bounds[0]],[e.bounds[3]],this.plot_view.canvas),l=r[0],p=r[1],n=this.plot_view.frame.map_to_screen([e.bounds[2]],[e.bounds[1]],this.plot_view.canvas),a=n[0],c=n[1],l=l[0],p=p[0],a=a[0],c=c[0],i=a-l,o=c-p,s=l,u=p,this.map_canvas.drawImage(e.img,s,u,i,o),this.map_canvas.restore()},e.prototype._set_rect=function(){var t,e,r,n,o;return r=this.plot_model.plot.properties.outline_line_width.value(),e=this.plot_view.canvas.vx_to_sx(this.map_frame.left)+r/2,n=this.plot_view.canvas.vy_to_sy(this.map_frame.top)+r/2,o=this.map_frame.width-r,t=this.map_frame.height-r,this.map_canvas.rect(e,n,o,t),this.map_canvas.clip()},e}(s.View),n=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return p(e,t),e.prototype.default_view=o,e.prototype.type="DynamicImageRenderer",e.define({alpha:[u.Number,1],image_source:[u.Instance],render_parents:[u.Bool,!0]}),e.override({level:"underlay"}),e}(s.Model),e.exports={Model:n,View:o}},{"../../core/logging":"core/logging","../../core/properties":"core/properties","../renderers/renderer":"models/renderers/renderer","./image_pool":"models/tiles/image_pool",underscore:"underscore"}],"models/tiles/image_pool":[function(t,e,r){var n;n=function(){function t(){this.images=[]}return t.prototype.pop=function(){var t;return t=this.images.pop(),null!=t?t:new Image},t.prototype.push=function(t){if(!(this.images.length>50))return t.constructor===Array?Array.prototype.push.apply(this.images,t):this.images.push(t)},t}(),e.exports=n},{}],"models/tiles/image_source":[function(t,e,r){var n,o,i,s,a,l=function(t,e){function r(){this.constructor=t}for(var n in e)u.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},u={}.hasOwnProperty;i=t("underscore"),s=t("../../core/logging").logger,a=t("../../core/properties"),o=t("../../model"),n=function(t){function e(t){null==t&&(t={}),e.__super__.constructor.apply(this,arguments),this.images={},this.normalize_case()}return l(e,t),e.prototype.type="ImageSource",e.define({url:[a.String,""],extra_url_vars:[a.Any,{}]}),e.prototype.normalize_case=function(){"Note: should probably be refactored into subclasses.";var t;return t=this.url,t=t.replace("{xmin}","{XMIN}"),t=t.replace("{ymin}","{YMIN}"),t=t.replace("{xmax}","{XMAX}"),t=t.replace("{ymax}","{YMAX}"),t=t.replace("{height}","{HEIGHT}"),t=t.replace("{width}","{WIDTH}"),this.url=t},e.prototype.string_lookup_replace=function(t,e){var r,n,o;n=t;for(r in e)o=e[r],n=n.replace("{"+r+"}",o.toString());return n},e.prototype.add_image=function(t){return this.images[t.cache_key]=t},e.prototype.remove_image=function(t){return delete this.images[t.cache_key]},e.prototype.get_image_url=function(t,e,r,n,o,i){var s;return s=this.string_lookup_replace(this.url,this.extra_url_vars),s.replace("{XMIN}",t).replace("{YMIN}",e).replace("{XMAX}",r).replace("{YMAX}",n).replace("{WIDTH}",i).replace("{HEIGHT}",o)},e}(o),e.exports={Model:n}},{"../../core/logging":"core/logging","../../core/properties":"core/properties","../../model":"model",underscore:"underscore"}],"models/tiles/mercator_tile_source":[function(t,e,r){var n,o,i,s,a=function(t,e){function r(){this.constructor=t}for(var n in e)l.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},l={}.hasOwnProperty;i=t("underscore"),o=t("./tile_source"),s=t("../../core/properties"),n=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return a(e,t),e.prototype.type="MercatorTileSource",e.define({wrap_around:[s.Bool,!0]}),e.override({x_origin_offset:20037508.34,y_origin_offset:20037508.34,initial_resolution:156543.03392804097}),e.prototype.initialize=function(t){var r;return e.__super__.initialize.call(this,t),this._resolutions=function(){var t,e;for(e=[],r=t=0;t<=30;r=++t)e.push(this.get_resolution(r));return e}.call(this)},e.prototype._computed_initial_resolution=function(){return null!=this.initial_resolution?this.initial_resolution:2*Math.PI*6378137/this.tile_size},e.prototype.is_valid_tile=function(t,e,r){return!(!this.wrap_around&&(t<0||t>=Math.pow(2,r)))&&!(e<0||e>=Math.pow(2,r))},e.prototype.retain_children=function(t){var e,r,n,o,i,s,a;o=t.quadkey,n=o.length,r=n+3,i=this.tiles,s=[];for(e in i)a=i[e],0===a.quadkey.indexOf(o)&&a.quadkey.length>n&&a.quadkey.length<=r?s.push(a.retain=!0):s.push(void 0);return s},e.prototype.retain_neighbors=function(t){var e,r,n,o,s,a,l,u,c,p,h,_,d;r=4,s=t.tile_coords,c=s[0],p=s[1],h=s[2],n=function(){var t,e,n,o;for(o=[],_=t=e=c-r,n=c+r;e<=n?t<=n:t>=n;_=e<=n?++t:--t)o.push(_);return o}(),o=function(){var t,e,n,o;for(o=[],d=t=e=p-r,n=p+r;e<=n?t<=n:t>=n;d=e<=n?++t:--t)o.push(d);return o}(),a=this.tiles,l=[];for(e in a)u=a[e],u.tile_coords[2]===h&&i.contains(n,u.tile_coords[0])&&i.contains(o,u.tile_coords[1])?l.push(u.retain=!0):l.push(void 0);return l},e.prototype.retain_parents=function(t){var e,r,n,o,i;r=t.quadkey,n=this.tiles,o=[];for(e in n)i=n[e],o.push(i.retain=0===r.indexOf(i.quadkey));return o},e.prototype.children_by_tile_xyz=function(t,e,r){var n,o,i,s,a,l,u,c,p;for(p=this.calculate_world_x_by_tile_xyz(t,e,r),0!==p&&(l=this.normalize_xyz(t,e,r),t=l[0],e=l[1],r=l[2]),a=this.tile_xyz_to_quadkey(t,e,r),o=[],i=s=0;s<=3;i=s+=1)u=this.quadkey_to_tile_xyz(a+i.toString()),t=u[0],e=u[1],r=u[2],0!==p&&(c=this.denormalize_xyz(t,e,r,p),t=c[0],e=c[1],r=c[2]),n=this.get_tile_meter_bounds(t,e,r),null!=n&&o.push([t,e,r,n]);return o},e.prototype.parent_by_tile_xyz=function(t,e,r){var n,o;return o=this.tile_xyz_to_quadkey(t,e,r),n=o.substring(0,o.length-1),this.quadkey_to_tile_xyz(n)},e.prototype.get_resolution=function(t){return this._computed_initial_resolution()/Math.pow(2,t)},e.prototype.get_resolution_by_extent=function(t,e,r){var n,o;return n=(t[2]-t[0])/r,o=(t[3]-t[1])/e,[n,o]},e.prototype.get_level_by_extent=function(t,e,r){var n,o,i,s,a,l,u,c;for(u=(t[2]-t[0])/r,c=(t[3]-t[1])/e,l=Math.max(u,c),n=0,a=this._resolutions,o=0,i=a.length;o<i;o++){if(s=a[o],l>s){if(0===n)return 0;if(n>0)return n-1}n+=1}},e.prototype.get_closest_level_by_extent=function(t,e,r){var n,o,i,s,a;return s=(t[2]-t[0])/r,a=(t[3]-t[1])/e,o=Math.max(s,a),i=this._resolutions,n=this._resolutions.reduce(function(t,e){return Math.abs(e-o)<Math.abs(t-o)?e:t}),this._resolutions.indexOf(n)},e.prototype.snap_to_zoom=function(t,e,r,n){var o,i,s,a,l,u,c,p,h;return o=this._resolutions[n],i=r*o,s=e*o,u=t[0],h=t[1],l=t[2],p=t[3],a=(i-(l-u))/2,c=(s-(p-h))/2,[u-a,h-c,l+a,p+c]},e.prototype.tms_to_wmts=function(t,e,r){"Note this works both ways";return[t,Math.pow(2,r)-1-e,r]},e.prototype.wmts_to_tms=function(t,e,r){"Note this works both ways";return[t,Math.pow(2,r)-1-e,r]},e.prototype.pixels_to_meters=function(t,e,r){var n,o,i;return i=this.get_resolution(r),n=t*i-this.x_origin_offset,o=e*i-this.y_origin_offset,[n,o]},e.prototype.meters_to_pixels=function(t,e,r){var n,o,i;return i=this.get_resolution(r),n=(t+this.x_origin_offset)/i,o=(e+this.y_origin_offset)/i,[n,o]},e.prototype.pixels_to_tile=function(t,e){var r,n;return r=Math.ceil(t/parseFloat(this.tile_size)),r=0===r?r:r-1,n=Math.max(Math.ceil(e/parseFloat(this.tile_size))-1,0),[r,n]},e.prototype.pixels_to_raster=function(t,e,r){var n;return n=this.tile_size<<r,[t,n-e]},e.prototype.meters_to_tile=function(t,e,r){var n,o,i;return i=this.meters_to_pixels(t,e,r),n=i[0],o=i[1],this.pixels_to_tile(n,o)},e.prototype.get_tile_meter_bounds=function(t,e,r){var n,o,i,s,a,l;return n=this.pixels_to_meters(t*this.tile_size,e*this.tile_size,r),s=n[0],l=n[1],o=this.pixels_to_meters((t+1)*this.tile_size,(e+1)*this.tile_size,r),i=o[0],a=o[1],null!=s&&null!=l&&null!=i&&null!=a?[s,l,i,a]:void 0},e.prototype.get_tile_geographic_bounds=function(t,e,r){var n,o,i,s,a,l;return n=this.get_tile_meter_bounds(t,e,r),l=this.utils.meters_extent_to_geographic(n),a=l[0],s=l[1],i=l[2],o=l[3],[a,s,i,o]},e.prototype.get_tiles_by_extent=function(t,e,r){var n,o,i,s,a,l,u,c,p,h,_,d,f,m,g,y,v,b,x;for(null==r&&(r=1),v=t[0],x=t[1],y=t[2],b=t[3],i=this.meters_to_tile(v,x,e),d=i[0],g=i[1],s=this.meters_to_tile(y,b,e),_=s[0],m=s[1],d-=r,g-=r,_+=r,m+=r,p=[],f=n=a=m,l=g;n>=l;f=n+=-1)for(h=o=u=d,c=_;o<=c;h=o+=1)this.is_valid_tile(h,f,e)&&p.push([h,f,e,this.get_tile_meter_bounds(h,f,e)]);return p=this.sort_tiles_from_center(p,[d,g,_,m])},e.prototype.quadkey_to_tile_xyz=function(t){"Computes tile x, y and z values based on quadKey.";var e,r,n,o,i,s,a,l;for(i=0,s=0,a=t.length,e=r=o=a;r>0;e=r+=-1)switch(l=t.charAt(a-e),n=1<<e-1,l){case"0":continue;case"1":i|=n;break;case"2":s|=n;break;case"3":i|=n,s|=n;break;default:throw new TypeError("Invalid Quadkey: "+t)}return[i,s,a]},e.prototype.tile_xyz_to_quadkey=function(t,e,r){"Computes quadkey value based on tile x, y and z values.";var n,o,i,s,a,l;for(a="",o=i=l=r;i>0;o=i+=-1)n=0,s=1<<o-1,0!==(t&s)&&(n+=1),0!==(e&s)&&(n+=2),a+=n.toString();return a},e.prototype.children_by_tile_xyz=function(t,e,r){var n,o,i,s,a,l;for(a=this.tile_xyz_to_quadkey(t,e,r),o=[],i=s=0;s<=3;i=s+=1)l=this.quadkey_to_tile_xyz(a+i.toString()),t=l[0],e=l[1],r=l[2],n=this.get_tile_meter_bounds(t,e,r),null!=n&&o.push([t,e,r,n]);return o},e.prototype.parent_by_tile_xyz=function(t,e,r){var n,o;return o=this.tile_xyz_to_quadkey(t,e,r),n=o.substring(0,o.length-1),this.quadkey_to_tile_xyz(n)},e.prototype.get_closest_parent_by_tile_xyz=function(t,e,r){var n,o,i,s,a;for(a=this.calculate_world_x_by_tile_xyz(t,e,r),o=this.normalize_xyz(t,e,r),t=o[0],e=o[1],r=o[2],n=this.tile_xyz_to_quadkey(t,e,r);n.length>0;)if(n=n.substring(0,n.length-1),i=this.quadkey_to_tile_xyz(n),t=i[0],e=i[1],r=i[2],s=this.denormalize_xyz(t,e,r,a),t=s[0],e=s[1],r=s[2],this.tile_xyz_to_key(t,e,r)in this.tiles)return[t,e,r];return[0,0,0]},e.prototype.normalize_xyz=function(t,e,r){var n;return this.wrap_around?(n=Math.pow(2,r),[(t%n+n)%n,e,r]):[t,e,r]},e.prototype.denormalize_xyz=function(t,e,r,n){return[t+n*Math.pow(2,r),e,r]},e.prototype.denormalize_meters=function(t,e,r,n){return[t+2*n*Math.PI*6378137,e]},e.prototype.calculate_world_x_by_tile_xyz=function(t,e,r){return Math.floor(t/Math.pow(2,r))},e}(o),e.exports=n},{"../../core/properties":"core/properties","./tile_source":"models/tiles/tile_source",underscore:"underscore"}],"models/tiles/quadkey_tile_source":[function(t,e,r){var n,o,i=function(t,e){function r(){this.constructor=t}for(var n in e)s.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},s={}.hasOwnProperty;n=t("./mercator_tile_source"),o=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return i(e,t),e.prototype.type="QUADKEYTileSource",e.prototype.get_image_url=function(t,e,r){var n,o,i;return n=this.string_lookup_replace(this.url,this.extra_url_vars),i=this.tms_to_wmts(t,e,r),t=i[0],e=i[1],r=i[2],o=this.tile_xyz_to_quadkey(t,e,r),n.replace("{Q}",o)},e}(n),e.exports={Model:o}},{"./mercator_tile_source":"models/tiles/mercator_tile_source"}],"models/tiles/tile_renderer":[function(t,e,r){var n,o,i,s,a,l,u,c,p,h=function(t,e){return function(){return t.apply(e,arguments)}},_=function(t,e){function r(){this.constructor=t}for(var n in e)d.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},d={}.hasOwnProperty,f=[].indexOf||function(t){for(var e=0,r=this.length;e<r;e++)if(e in this&&this[e]===t)return e;return-1};l=t("underscore"),n=t("jquery"),o=t("./image_pool"),p=t("./wmts_tile_source"),i=t("../renderers/renderer"),u=t("../../core/logging").logger,c=t("../../core/properties"),a=function(t){function e(){return this._update=h(this._update,this),this._prefetch_tiles=h(this._prefetch_tiles,this),this._on_tile_error=h(this._on_tile_error,this),this._on_tile_cache_load=h(this._on_tile_cache_load,this),this._on_tile_load=h(this._on_tile_load,this),this._add_attribution=h(this._add_attribution,this),e.__super__.constructor.apply(this,arguments)}return _(e,t),e.prototype.initialize=function(t){return this.attributionEl=null,e.__super__.initialize.apply(this,arguments)},e.prototype.bind_bokeh_events=function(){return this.listenTo(this.model,"change",this.request_render)},e.prototype.get_extent=function(){return[this.x_range.start,this.y_range.start,this.x_range.end,this.y_range.end]},e.prototype._set_data=function(){return this.pool=new o,this.map_plot=this.plot_model.plot,this.map_canvas=this.plot_view.canvas_view.ctx,this.map_frame=this.plot_model.frame,this.x_range=this.map_plot.x_range,this.x_mapper=this.map_frame.x_mappers["default"],this.y_range=this.map_plot.y_range,this.y_mapper=this.map_frame.y_mappers["default"],this.extent=this.get_extent(),this._last_height=void 0,this._last_width=void 0},e.prototype._add_attribution=function(){var t,e,r,o,i,s;if(t=this.model.tile_source.attribution,l.isString(t)&&t.length>0)return null!=this.attributionEl?this.attributionEl.html(t):(e=this.map_plot.outline_line_width,r=this.map_plot.min_border_bottom+e,s=this.map_frame.right-this.map_frame.width,o=this.map_frame.width-e,this.attributionEl=n("<div>").html(t).addClass("bk-tile-attribution").css({position:"absolute",bottom:r+"px",right:s+"px","max-width":o+"px","background-color":"rgba(255,255,255,0.8)","font-size":"9pt","font-family":"sans-serif"}),i=this.plot_view.$el.find("div.bk-canvas-events"),this.attributionEl.appendTo(i))},e.prototype._map_data=function(){var t,e;return this.initial_extent=this.get_extent(),e=this.model.tile_source.get_level_by_extent(this.initial_extent,this.map_frame.height,this.map_frame.width),t=this.model.tile_source.snap_to_zoom(this.initial_extent,this.map_frame.height,this.map_frame.width,e),this.x_range.start=t[0],this.y_range.start=t[1],this.x_range.end=t[2],this.y_range.end=t[3],this._add_attribution()},e.prototype._on_tile_load=function(t){var e;return e=t.target.tile_data,e.img=t.target,e.current=!0,e.loaded=!0,this.request_render()},e.prototype._on_tile_cache_load=function(t){var e;return e=t.target.tile_data,e.img=t.target,e.loaded=!0},e.prototype._on_tile_error=function(t){return""},e.prototype._create_tile=function(t,e,r,n,o){var i,s,a;return null==o&&(o=!1),i=this.model.tile_source.normalize_xyz(t,e,r),a=this.pool.pop(),o?a.onload=this._on_tile_cache_load:a.onload=this._on_tile_load,a.onerror=this._on_tile_error,a.alt="",a.tile_data={tile_coords:[t,e,r],normalized_coords:i,quadkey:this.model.tile_source.tile_xyz_to_quadkey(t,e,r),cache_key:this.model.tile_source.tile_xyz_to_key(t,e,r),bounds:n,loaded:!1,x_coord:n[0],y_coord:n[3]},this.model.tile_source.tiles[a.tile_data.cache_key]=a.tile_data,a.src=(s=this.model.tile_source).get_image_url.apply(s,i),a},e.prototype._enforce_aspect_ratio=function(){var t,e,r;return(this._last_height!==this.map_frame.height||this._last_width!==this.map_frame.width)&&(t=this.get_extent(),r=this.model.tile_source.get_level_by_extent(t,this.map_frame.height,this.map_frame.width),e=this.model.tile_source.snap_to_zoom(t,this.map_frame.height,this.map_frame.width,r),this.x_range.setv({start:e[0],end:e[2]}),this.y_range.setv({start:e[1],end:e[3]}),this.extent=e,this._last_height=this.map_frame.height,this._last_width=this.map_frame.width,!0)},e.prototype.render=function(t,e,r){if(null==this.map_initialized&&(this._set_data(),this._map_data(),this.map_initialized=!0),!this._enforce_aspect_ratio())return this._update(),null!=this.prefetch_timer&&clearTimeout(this.prefetch_timer),this.prefetch_timer=setTimeout(this._prefetch_tiles,500)},e.prototype._draw_tile=function(t){var e,r,n,o,i,s,a,l,u,c,p;if(p=this.model.tile_source.tiles[t],null!=p)return e=this.plot_view.frame.map_to_screen([p.bounds[0]],[p.bounds[3]],this.plot_view.canvas),a=e[0],c=e[1],r=this.plot_view.frame.map_to_screen([p.bounds[2]],[p.bounds[1]],this.plot_view.canvas),s=r[0],u=r[1],a=a[0],c=c[0],s=s[0],u=u[0],o=s-a,n=u-c,i=a,l=c,this.map_canvas.drawImage(p.img,i,l,o,n)},e.prototype._set_rect=function(){var t,e,r,n,o;return r=this.plot_model.plot.properties.outline_line_width.value(),e=this.plot_view.canvas.vx_to_sx(this.map_frame.left)+r/2,n=this.plot_view.canvas.vy_to_sy(this.map_frame.top)+r/2,o=this.map_frame.width-r,t=this.map_frame.height-r,this.map_canvas.rect(e,n,o,t),this.map_canvas.clip()},e.prototype._render_tiles=function(t){var e,r,n;for(this.map_canvas.save(),this._set_rect(),this.map_canvas.globalAlpha=this.model.alpha,e=0,r=t.length;e<r;e++)n=t[e],this._draw_tile(n);return this.map_canvas.restore()},e.prototype._prefetch_tiles=function(){var t,e,r,n,o,i,s,a,l,u,c,p,h,_,d,f,m,g,y,v;for(_=this.model.tile_source,a=this.get_extent(),l=this.map_frame.height,f=this.map_frame.width,v=this.model.tile_source.get_level_by_extent(a,l,f),d=this.model.tile_source.get_tiles_by_extent(a,v),p=[],h=u=0,c=Math.min(10,d.length);u<=c;h=u+=1)m=h[0],g=h[1],y=h[2],t=h[3],n=this.model.tile_source.children_by_tile_xyz(m,g,y),p.push(function(){var t,a,l;for(l=[],t=0,a=n.length;t<a;t++)e=n[t],o=e[0],i=e[1],s=e[2],r=e[3],_.tile_xyz_to_key(o,i,s)in _.tiles||l.push(this._create_tile(o,i,s,r,!0));return l}.call(this));return p},e.prototype._fetch_tiles=function(t){var e,r,n,o,i,s,a,l;for(o=[],r=0,n=t.length;r<n;r++)i=t[r],s=i[0],a=i[1],l=i[2],e=i[3],o.push(this._create_tile(s,a,l,e));return o},e.prototype._update=function(){var t,e,r,n,o,i,s,a,l,u,c,p,h,_,d,m,g,y,v,b,x,w,k,M,T,S,z,E,A,C,j,P,N,O,D,F,q,I,R;for(P=this.model.tile_source,b=P.min_zoom,v=P.max_zoom,P.update(),u=this.get_extent(),R=this.extent[2]-this.extent[0]<u[2]-u[0],c=this.map_frame.height,O=this.map_frame.width,I=P.get_level_by_extent(u,c,O),A=!1,I<b?(u=this.extent,I=b,A=!0):I>v&&(u=this.extent,I=v,A=!0),A&&(this.x_range.setv({x_range:{start:u[0],end:u[2]}}),this.y_range.setv({start:u[1],end:u[3]}),this.extent=u),this.extent=u,N=P.get_tiles_by_extent(u,I),M=[],x=[],r=[],i=[],p=0,m=N.length;p<m;p++){if(C=N[p],D=C[0],F=C[1],q=C[2],t=C[3],d=P.tile_xyz_to_key(D,F,q),j=P.tiles[d],null!=j&&j.loaded===!0)r.push(d);else if(this.model.render_parents&&(E=P.get_closest_parent_by_tile_xyz(D,F,q),T=E[0],S=E[1],z=E[2],w=P.tile_xyz_to_key(T,S,z),k=P.tiles[w],null!=k&&k.loaded&&f.call(M,w)<0&&M.push(w),R))for(i=P.children_by_tile_xyz(D,F,q),h=0,g=i.length;h<g;h++)e=i[h],s=e[0],a=e[1],l=e[2],n=e[3],o=P.tile_xyz_to_key(s,a,l),o in P.tiles&&i.push(o);null==j&&x.push(C)}for(this._render_tiles(M),this._render_tiles(i),this._render_tiles(r),_=0,y=r.length;_<y;_++)C=r[_],P.tiles[C].current=!0;return null!=this.render_timer&&clearTimeout(this.render_timer),this.render_timer=setTimeout(function(t){return function(){return t._fetch_tiles(x)}}(this),65)},e}(i.View),s=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return _(e,t),e.prototype.default_view=a,e.prototype.type="TileRenderer",e.define({alpha:[c.Number,1],x_range_name:[c.String,"default"],y_range_name:[c.String,"default"],tile_source:[c.Instance,function(){return new p.Model}],render_parents:[c.Bool,!0]}),e.override({level:"underlay"}),e}(i.Model),e.exports={Model:s,View:a}},{"../../core/logging":"core/logging","../../core/properties":"core/properties","../renderers/renderer":"models/renderers/renderer","./image_pool":"models/tiles/image_pool","./wmts_tile_source":"models/tiles/wmts_tile_source",jquery:"jquery",underscore:"underscore"}],"models/tiles/tile_source":[function(t,e,r){var n,o,i,s,a,l,u,c=function(t,e){function r(){this.constructor=t}for(var n in e)p.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},p={}.hasOwnProperty;s=t("underscore"),n=t("./image_pool"),u=t("./tile_utils"),a=t("../../core/logging").logger,l=t("../../core/properties"),o=t("../../model"),i=function(t){function e(t){null==t&&(t={}),e.__super__.constructor.apply(this,arguments),this.utils=new u.ProjectionUtils,this.pool=new n,this.tiles={},this.normalize_case()}return c(e,t),e.prototype.type="TileSource",e.define({url:[l.String,""],tile_size:[l.Number,256],max_zoom:[l.Number,30],min_zoom:[l.Number,0],extra_url_vars:[l.Any,{}],attribution:[l.String,""],x_origin_offset:[l.Number],y_origin_offset:[l.Number],initial_resolution:[l.Number]}),e.prototype.initialize=function(t){return e.__super__.initialize.call(this,t),this.normalize_case()},e.prototype.string_lookup_replace=function(t,e){var r,n,o;n=t;for(r in e)o=e[r],n=n.replace("{"+r+"}",o.toString());return n},e.prototype.normalize_case=function(){"Note: should probably be refactored into subclasses.";var t;return t=this.url,t=t.replace("{x}","{X}"),t=t.replace("{y}","{Y}"),t=t.replace("{z}","{Z}"),t=t.replace("{q}","{Q}"),t=t.replace("{xmin}","{XMIN}"),t=t.replace("{ymin}","{YMIN}"),t=t.replace("{xmax}","{XMAX}"),t=t.replace("{ymax}","{YMAX}"),this.url=t},e.prototype.update=function(){var t,e,r,n;a.debug("TileSource: tile cache count: "+Object.keys(this.tiles).length),e=this.tiles,r=[];for(t in e)n=e[t],n.current=!1,r.push(n.retain=!1);return r},e.prototype.tile_xyz_to_key=function(t,e,r){var n;return n=t+":"+e+":"+r},e.prototype.key_to_tile_xyz=function(t){var e;return function(){var r,n,o,i;for(o=t.split(":"),i=[],r=0,n=o.length;r<n;r++)e=o[r],i.push(parseInt(e));return i}()},e.prototype.sort_tiles_from_center=function(t,e){var r,n,o,i,s,a;return i=e[0],a=e[1],o=e[2],s=e[3],r=(o-i)/2+i,n=(s-a)/2+a,t.sort(function(t,e){var o,i;return o=Math.sqrt(Math.pow(r-t[0],2)+Math.pow(n-t[1],2)),i=Math.sqrt(Math.pow(r-e[0],2)+Math.pow(n-e[1],2)),o-i}),t},e.prototype.prune_tiles=function(){var t,e,r,n,o;e=this.tiles;for(t in e)o=e[t],o.retain=o.current||o.tile_coords[2]<3,o.current&&(this.retain_neighbors(o),this.retain_children(o),this.retain_parents(o));r=this.tiles,n=[];for(t in r)o=r[t],o.retain?n.push(void 0):n.push(this.remove_tile(t));return n},e.prototype.remove_tile=function(t){var e;if(e=this.tiles[t],null!=e)return this.pool.push(e.img),delete this.tiles[t]},e.prototype.get_image_url=function(t,e,r){var n;return n=this.string_lookup_replace(this.url,this.extra_url_vars),n.replace("{X}",t).replace("{Y}",e).replace("{Z}",r)},e.prototype.retain_neighbors=function(t){throw Error("Not Implemented")},e.prototype.retain_parents=function(t){throw Error("Not Implemented")},e.prototype.retain_children=function(t){throw Error("Not Implemented")},e.prototype.tile_xyz_to_quadkey=function(t,e,r){throw Error("Not Implemented")},e.prototype.quadkey_to_tile_xyz=function(t){throw Error("Not Implemented")},e}(o),e.exports=i},{"../../core/logging":"core/logging","../../core/properties":"core/properties","../../model":"model","./image_pool":"models/tiles/image_pool","./tile_utils":"models/tiles/tile_utils",underscore:"underscore"}],"models/tiles/tile_utils":[function(t,e,r){var n,o,i,s;i=t("../../core/util/proj4"),o=i.defs("GOOGLE"),s=i.defs("WGS84"),n=function(){function t(){this.origin_shift=2*Math.PI*6378137/2}return t.prototype.geographic_to_meters=function(t,e){return i(s,o,[t,e])},t.prototype.meters_to_geographic=function(t,e){return i(o,s,[t,e])},t.prototype.geographic_extent_to_meters=function(t){var e,r,n,o,i,s;return o=t[0],s=t[1],n=t[2],i=t[3],e=this.geographic_to_meters(o,s),o=e[0],s=e[1],r=this.geographic_to_meters(n,i),n=r[0],i=r[1],[o,s,n,i]},t.prototype.meters_extent_to_geographic=function(t){var e,r,n,o,i,s;return o=t[0],s=t[1],n=t[2],i=t[3],e=this.meters_to_geographic(o,s),o=e[0],s=e[1],r=this.meters_to_geographic(n,i),n=r[0],i=r[1],[o,s,n,i]},t}(),e.exports={ProjectionUtils:n}},{"../../core/util/proj4":"core/util/proj4"}],"models/tiles/tms_tile_source":[function(t,e,r){var n,o,i=function(t,e){function r(){this.constructor=t}for(var n in e)s.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},s={}.hasOwnProperty;n=t("./mercator_tile_source"),o=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return i(e,t),e.prototype.type="TMSTileSource",e.prototype.get_image_url=function(t,e,r){var n;return n=this.string_lookup_replace(this.url,this.extra_url_vars),n.replace("{X}",t).replace("{Y}",e).replace("{Z}",r)},e}(n),e.exports={Model:o}},{"./mercator_tile_source":"models/tiles/mercator_tile_source"}],"models/tiles/wmts_tile_source":[function(t,e,r){var n,o,i=function(t,e){function r(){this.constructor=t}for(var n in e)s.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},s={}.hasOwnProperty;n=t("./mercator_tile_source"),o=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return i(e,t),e.prototype.type="WMTSTileSource",e.prototype.get_image_url=function(t,e,r){var n,o;return n=this.string_lookup_replace(this.url,this.extra_url_vars),o=this.tms_to_wmts(t,e,r),t=o[0],e=o[1],r=o[2],n.replace("{X}",t).replace("{Y}",e).replace("{Z}",r)},e}(n),e.exports={Model:o}},{"./mercator_tile_source":"models/tiles/mercator_tile_source"}],"models/tools/actions/action_tool":[function(t,e,r){var n,o,i,s,a=function(t,e){function r(){this.constructor=t}for(var n in e)l.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},l={}.hasOwnProperty;s=t("../button_tool"),o=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return a(e,t),e.prototype._clicked=function(){return this.model.trigger("do")},e}(s.ButtonView),i=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return a(e,t),e.prototype.initialize=function(t){return e.__super__.initialize.call(this,t),this.listenTo(this.model,"do",this["do"])},e}(s.View),n=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return a(e,t),e}(s.Model),e.exports={Model:n,View:i,ButtonView:o}},{"../button_tool":"models/tools/button_tool"}],"models/tools/actions/help_tool":[function(t,e,r){var n,o,i,s,a,l=function(t,e){function r(){this.constructor=t}for(var n in e)u.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},u={}.hasOwnProperty;s=t("underscore"),n=t("./action_tool"),a=t("../../../core/properties"),i=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return l(e,t),e.prototype["do"]=function(){return window.open(this.model.redirect)},e}(n.View),o=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return l(e,t),e.prototype.default_view=i,e.prototype.type="HelpTool",e.prototype.tool_name="Help",e.prototype.icon="bk-tool-icon-help",e.define({help_tooltip:[a.String,"Click the question mark to learn more about Bokeh plot tools."],redirect:[a.String,"http://bokeh.pydata.org/en/latest/docs/user_guide/tools.html"]}),e.getters({tooltip:function(){return this.help_tooltip}}),e}(n.Model),e.exports={Model:o,View:i}},{"../../../core/properties":"core/properties","./action_tool":"models/tools/actions/action_tool",underscore:"underscore"}],"models/tools/actions/redo_tool":[function(t,e,r){var n,o,i,s=function(t,e){function r(){this.constructor=t}for(var n in e)a.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},a={}.hasOwnProperty;n=t("./action_tool"),i=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return s(e,t),e.prototype.initialize=function(t){return e.__super__.initialize.call(this,t),this.listenTo(this.plot_view,"state_changed",function(t){return function(){return t.model.disabled=!t.plot_view.can_redo()}}(this))},e.prototype["do"]=function(){return this.plot_view.redo()},e}(n.View),o=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return s(e,t),e.prototype.default_view=i,e.prototype.type="RedoTool",e.prototype.tool_name="Redo",e.prototype.icon="bk-tool-icon-redo",e.override({disabled:!0}),e}(n.Model),e.exports={Model:o,View:i}},{"./action_tool":"models/tools/actions/action_tool"}],"models/tools/actions/reset_tool":[function(t,e,r){var n,o,i,s,a=function(t,e){function r(){this.constructor=t}for(var n in e)l.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},l={}.hasOwnProperty;n=t("./action_tool"),s=t("../../../core/properties"),i=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return a(e,t),e.prototype["do"]=function(){if(this.plot_view.clear_state(),this.plot_view.reset_range(),this.plot_view.reset_selection(),this.model.reset_size)return this.plot_view.reset_dimensions()},e}(n.View),o=function(t){function e(){return e.__super__.constructor.apply(this,arguments);
|
|
}return a(e,t),e.prototype.default_view=i,e.prototype.type="ResetTool",e.prototype.tool_name="Reset",e.prototype.icon="bk-tool-icon-reset",e.define({reset_size:[s.Bool,!0]}),e}(n.Model),e.exports={Model:o,View:i}},{"../../../core/properties":"core/properties","./action_tool":"models/tools/actions/action_tool"}],"models/tools/actions/save_tool":[function(t,e,r){var n,o,i,s,a=function(t,e){function r(){this.constructor=t}for(var n in e)l.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},l={}.hasOwnProperty;s=t("underscore"),n=t("./action_tool"),i=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return a(e,t),e.prototype["do"]=function(){var t,e,r,n;return e=this.plot_view.get_canvas_element(),n="bokeh_plot.png",null!=e.msToBlob?(t=e.msToBlob(),window.navigator.msSaveBlob(t,n)):(r=document.createElement("a"),r.href=e.toDataURL("image/png"),r.download=n,r.target="_blank",r.dispatchEvent(new MouseEvent("click")))},e}(n.View),o=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return a(e,t),e.prototype.default_view=i,e.prototype.type="SaveTool",e.prototype.tool_name="Save",e.prototype.icon="bk-tool-icon-save",e}(n.Model),e.exports={Model:o,View:i}},{"./action_tool":"models/tools/actions/action_tool",underscore:"underscore"}],"models/tools/actions/undo_tool":[function(t,e,r){var n,o,i,s=function(t,e){function r(){this.constructor=t}for(var n in e)a.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},a={}.hasOwnProperty;n=t("./action_tool"),i=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return s(e,t),e.prototype.initialize=function(t){return e.__super__.initialize.call(this,t),this.listenTo(this.plot_view,"state_changed",function(t){return function(){return t.model.disabled=!t.plot_view.can_undo()}}(this))},e.prototype["do"]=function(){return this.plot_view.undo()},e}(n.View),o=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return s(e,t),e.prototype.default_view=i,e.prototype.type="UndoTool",e.prototype.tool_name="Undo",e.prototype.icon="bk-tool-icon-undo",e.override({disabled:!0}),e}(n.Model),e.exports={Model:o,View:i}},{"./action_tool":"models/tools/actions/action_tool"}],"models/tools/actions/zoom_in_tool":[function(t,e,r){var n,o,i,s,a,l,u=function(t,e){function r(){this.constructor=t}for(var n in e)c.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},c={}.hasOwnProperty;n=t("./action_tool"),l=t("../../../core/util/zoom").scale_range,s=t("../../../core/logging").logger,a=t("../../../core/properties"),i=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return u(e,t),e.prototype["do"]=function(){var t,e,r,n,o;return e=this.plot_model.frame,t=this.model.dimensions,r="width"===t||"both"===t,n="height"===t||"both"===t,o=l(e,this.model.factor,r,n),this.plot_view.push_state("zoom_out",{range:o}),this.plot_view.update_range(o,!1,!0),this.plot_view.interactive_timestamp=Date.now(),null},e}(n.View),o=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return u(e,t),e.prototype.default_view=i,e.prototype.type="ZoomInTool",e.prototype.tool_name="Zoom In",e.prototype.icon="bk-tool-icon-zoom-in",e.getters({tooltip:function(){return this._get_dim_tooltip(this.tool_name,this.dimensions)}}),e.define({factor:[a.Percent,.1],dimensions:[a.Dimensions,"both"]}),e}(n.Model),e.exports={Model:o,View:i}},{"../../../core/logging":"core/logging","../../../core/properties":"core/properties","../../../core/util/zoom":"core/util/zoom","./action_tool":"models/tools/actions/action_tool"}],"models/tools/actions/zoom_out_tool":[function(t,e,r){var n,o,i,s,a,l,u=function(t,e){function r(){this.constructor=t}for(var n in e)c.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},c={}.hasOwnProperty;n=t("./action_tool"),l=t("../../../core/util/zoom").scale_range,s=t("../../../core/logging").logger,a=t("../../../core/properties"),i=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return u(e,t),e.prototype["do"]=function(){var t,e,r,n,o;return e=this.plot_model.frame,t=this.model.dimensions,r="width"===t||"both"===t,n="height"===t||"both"===t,o=l(e,-this.model.factor,r,n),this.plot_view.push_state("zoom_out",{range:o}),this.plot_view.update_range(o,!1,!0),this.plot_view.interactive_timestamp=Date.now(),null},e}(n.View),o=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return u(e,t),e.prototype.default_view=i,e.prototype.type="ZoomOutTool",e.prototype.tool_name="Zoom Out",e.prototype.icon="bk-tool-icon-zoom-out",e.getters({tooltip:function(){return this._get_dim_tooltip(this.tool_name,this.dimensions)}}),e.define({factor:[a.Percent,.1],dimensions:[a.Dimensions,"both"]}),e}(n.Model),e.exports={Model:o,View:i}},{"../../../core/logging":"core/logging","../../../core/properties":"core/properties","../../../core/util/zoom":"core/util/zoom","./action_tool":"models/tools/actions/action_tool"}],"models/tools/button_tool":[function(t,e,r){var n,o,i,s,a,l,u,c,p=function(t,e){function r(){this.constructor=t}for(var n in e)h.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},h={}.hasOwnProperty;l=t("underscore"),n=t("../../core/bokeh_view"),a=t("./tool"),u=t("./button_tool_template"),c=t("../../core/properties"),i=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return p(e,t),e.prototype.tagName="li",e.prototype.template=u,e.prototype.events=function(){return{"click .bk-toolbar-button":"_clicked"}},e.prototype.initialize=function(t){return e.__super__.initialize.call(this,t),this.$el.html(this.template({model:this.model})),this.listenTo(this.model,"change:active",function(t){return function(){return t.render()}}(this)),this.listenTo(this.model,"change:disabled",function(t){return function(){return t.render()}}(this)),this.render()},e.prototype.render=function(){return this.$el.children("button").prop("disabled",this.model.disabled).toggleClass("active",this.model.active),this},e.prototype._clicked=function(t){},e}(n),s=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return p(e,t),e}(a.View),o=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return p(e,t),e.prototype.icon=null,e.getters({tooltip:function(){return this.tool_name}}),e.internal({disabled:[c.Boolean,!1]}),e}(a.Model),e.exports={Model:o,View:s,ButtonView:i}},{"../../core/bokeh_view":"core/bokeh_view","../../core/properties":"core/properties","./button_tool_template":"models/tools/button_tool_template","./tool":"models/tools/tool",underscore:"underscore"}],"models/tools/button_tool_template":[function(t,e,r){e.exports=function(t){t||(t={});var e=[],r=function(t){return t&&t.ecoSafe?t:"undefined"!=typeof t&&null!=t?n(t):""},n=function(t){return(""+t).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")};return function(){(function(){e.push('<button type="button" class="bk-toolbar-button hover">\n <div class=\'bk-btn-icon '),e.push(r(this.model.icon)),e.push("' />\n <span class='tip'>"),e.push(r(this.model.tooltip)),e.push("</span>\n</button>\n")}).call(this)}.call(t),e.join("")}},{}],"models/tools/gestures/box_select_tool":[function(t,e,r){var n,o,i,s,a,l,u,c=function(t,e){function r(){this.constructor=t}for(var n in e)p.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},p={}.hasOwnProperty;l=t("underscore"),a=t("./select_tool"),n=t("../../annotations/box_annotation"),u=t("../../../core/properties"),i=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return c(e,t),e.prototype._pan_start=function(t){var e;return e=this.plot_view.canvas,this._baseboint=[e.sx_to_vx(t.bokeh.sx),e.sy_to_vy(t.bokeh.sy)],null},e.prototype._pan=function(t){var e,r,n,o,i,s,a,l,u;return r=this.plot_view.canvas,n=[r.sx_to_vx(t.bokeh.sx),r.sy_to_vy(t.bokeh.sy)],i=this.plot_model.frame,o=this.model.dimensions,s=this.model._get_dim_limits(this._baseboint,n,i,o),l=s[0],u=s[1],this.model.overlay.update({left:l[0],right:l[1],top:u[1],bottom:u[0]}),this.model.select_every_mousemove&&(e=null!=(a=t.srcEvent.shiftKey)&&a,this._select(l,u,!1,e)),null},e.prototype._pan_end=function(t){var e,r,n,o,i,s,a,l,u;return r=this.plot_view.canvas,n=[r.sx_to_vx(t.bokeh.sx),r.sy_to_vy(t.bokeh.sy)],i=this.plot_model.frame,o=this.model.dimensions,s=this.model._get_dim_limits(this._baseboint,n,i,o),l=s[0],u=s[1],e=null!=(a=t.srcEvent.shiftKey)&&a,this._select(l,u,!0,e),this.model.overlay.update({left:null,right:null,top:null,bottom:null}),this._baseboint=null,this.plot_view.push_state("box_select",{selection:this.plot_view.get_selection()}),null},e.prototype._select=function(t,e,r,n){var o,i,s,a,l,u,c,p,h,_,d;for(p=t[0],h=t[1],_=e[0],d=e[1],null==n&&(n=!1),i={type:"rect",vx0:p,vx1:h,vy0:_,vy1:d},u=this.model.computed_renderers,s=0,a=u.length;s<a;s++)l=u[s],o=l.data_source,c=o.selection_manager,c.select(this,this.plot_view.renderer_views[l.id],i,r,n);return null!=this.model.callback&&this._emit_callback(i),this._save_geometry(i,r,n),null},e.prototype._emit_callback=function(t){var e,r,n,o,i;n=this.model.computed_renderers[0],e=this.plot_model.canvas,r=this.plot_model.frame,t.sx0=e.vx_to_sx(t.vx0),t.sx1=e.vx_to_sx(t.vx1),t.sy0=e.vy_to_sy(t.vy0),t.sy1=e.vy_to_sy(t.vy1),o=r.x_mappers[n.x_range_name],i=r.y_mappers[n.y_range_name],t.x0=o.map_from_target(t.vx0),t.x1=o.map_from_target(t.vx1),t.y0=i.map_from_target(t.vy0),t.y1=i.map_from_target(t.vy1),this.model.callback.execute(this.model,{geometry:t})},e}(a.View),s=function(){return new n.Model({level:"overlay",render_mode:"css",top_units:"screen",left_units:"screen",bottom_units:"screen",right_units:"screen",fill_color:"lightgrey",fill_alpha:.5,line_color:"black",line_alpha:1,line_width:2,line_dash:[4,4]})},o=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return c(e,t),e.prototype.default_view=i,e.prototype.type="BoxSelectTool",e.prototype.tool_name="Box Select",e.prototype.icon="bk-tool-icon-box-select",e.prototype.event_type="pan",e.prototype.default_order=30,e.define({dimensions:[u.Dimensions,"both"],select_every_mousemove:[u.Bool,!1],callback:[u.Instance],overlay:[u.Instance,s]}),e.getters({tooltip:function(){return this._get_dim_tooltip(this.tool_name,this.dimensions)}}),e}(a.Model),e.exports={Model:o,View:i}},{"../../../core/properties":"core/properties","../../annotations/box_annotation":"models/annotations/box_annotation","./select_tool":"models/tools/gestures/select_tool",underscore:"underscore"}],"models/tools/gestures/box_zoom_tool":[function(t,e,r){var n,o,i,s,a,l,u,c=function(t,e){function r(){this.constructor=t}for(var n in e)p.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},p={}.hasOwnProperty;l=t("underscore"),a=t("./gesture_tool"),n=t("../../annotations/box_annotation"),u=t("../../../core/properties"),i=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return c(e,t),e.prototype._match_aspect=function(t,e,r){var n,o,i,s,a,l,u,c,p,h,_,d,f,m,g,y,v,b;return s=r.h_range.end,a=r.h_range.start,d=r.v_range.end,m=r.v_range.start,y=s-a,i=d-m,n=y/i,g=Math.abs(t[0]-e[0]),f=Math.abs(t[1]-e[1]),_=0===f?0:g/f,_>=n?(u=[1,_/n],v=u[0],b=u[1]):(c=[n/_,1],v=c[0],b=c[1]),t[0]<=e[0]?(l=t[0],p=t[0]+g*v,p>s&&(p=s)):(p=t[0],l=t[0]-g*v,l<a&&(l=a)),g=Math.abs(p-l),t[1]<=e[1]?(o=t[1],h=t[1]+g/n,h>d&&(h=d)):(h=t[1],o=t[1]-g/n,o<m&&(o=m)),f=Math.abs(h-o),t[0]<=e[0]?p=t[0]+n*f:l=t[0]-n*f,[[l,p],[o,h]]},e.prototype._pan_start=function(t){var e;return e=this.plot_view.canvas,this._baseboint=[e.sx_to_vx(t.bokeh.sx),e.sy_to_vy(t.bokeh.sy)],null},e.prototype._pan=function(t){var e,r,n,o,i,s,a,l;return e=this.plot_view.canvas,r=[e.sx_to_vx(t.bokeh.sx),e.sy_to_vy(t.bokeh.sy)],o=this.plot_model.frame,n=this.model.dimensions,this.model.match_aspect&&"both"===n?(i=this._match_aspect(this._baseboint,r,o),a=i[0],l=i[1]):(s=this.model._get_dim_limits(this._baseboint,r,o,n),a=s[0],l=s[1]),this.model.overlay.update({left:a[0],right:a[1],top:l[1],bottom:l[0]}),null},e.prototype._pan_end=function(t){var e,r,n,o,i,s,a,l;return e=this.plot_view.canvas,r=[e.sx_to_vx(t.bokeh.sx),e.sy_to_vy(t.bokeh.sy)],o=this.plot_model.frame,n=this.model.dimensions,this.model.match_aspect&&"both"===n?(i=this._match_aspect(this._baseboint,r,o),a=i[0],l=i[1]):(s=this.model._get_dim_limits(this._baseboint,r,o,n),a=s[0],l=s[1]),this._update(a,l),this.model.overlay.update({left:null,right:null,top:null,bottom:null}),this._baseboint=null,null},e.prototype._update=function(t,e){var r,n,o,i,s,a,l,u,c,p,h;if(!(Math.abs(t[1]-t[0])<=5||Math.abs(e[1]-e[0])<=5)){c={},i=this.plot_view.frame.x_mappers;for(o in i)n=i[o],s=n.v_map_from_target(t,!0),u=s[0],r=s[1],c[o]={start:u,end:r};p={},a=this.plot_view.frame.y_mappers;for(o in a)n=a[o],l=n.v_map_from_target(e,!0),u=l[0],r=l[1],p[o]={start:u,end:r};return h={xrs:c,yrs:p},this.plot_view.push_state("box_zoom",{range:h}),this.plot_view.update_range(h)}},e}(a.View),s=function(){return new n.Model({level:"overlay",render_mode:"css",top_units:"screen",left_units:"screen",bottom_units:"screen",right_units:"screen",fill_color:"lightgrey",fill_alpha:.5,line_color:"black",line_alpha:1,line_width:2,line_dash:[4,4]})},o=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return c(e,t),e.prototype.default_view=i,e.prototype.type="BoxZoomTool",e.prototype.tool_name="Box Zoom",e.prototype.icon="bk-tool-icon-box-zoom",e.prototype.event_type="pan",e.prototype.default_order=20,e.getters({tooltip:function(){return this._get_dim_tooltip(this.tool_name,this.dimensions)}}),e.define({dimensions:[u.Dimensions,"both"],overlay:[u.Instance,s],match_aspect:[u.Bool,!1]}),e}(a.Model),e.exports={Model:o,View:i}},{"../../../core/properties":"core/properties","../../annotations/box_annotation":"models/annotations/box_annotation","./gesture_tool":"models/tools/gestures/gesture_tool",underscore:"underscore"}],"models/tools/gestures/gesture_tool":[function(t,e,r){var n,o,i,s,a,l=function(t,e){function r(){this.constructor=t}for(var n in e)u.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},u={}.hasOwnProperty;a=t("underscore"),n=t("../button_tool"),i=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return l(e,t),e.prototype._clicked=function(){var t;return t=this.model.active,this.model.active=!t},e}(n.ButtonView),s=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return l(e,t),e}(n.View),o=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return l(e,t),e.prototype.event_type=null,e.prototype.default_order=null,e}(n.Model),e.exports={Model:o,View:s,ButtonView:i}},{"../button_tool":"models/tools/button_tool",underscore:"underscore"}],"models/tools/gestures/lasso_select_tool":[function(t,e,r){var n,o,i,s,a,l,u,c=function(t,e){function r(){this.constructor=t}for(var n in e)p.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},p={}.hasOwnProperty;l=t("underscore"),a=t("./select_tool"),s=t("../../annotations/poly_annotation"),u=t("../../../core/properties"),i=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return c(e,t),e.prototype.initialize=function(t){return e.__super__.initialize.call(this,t),this.listenTo(this.model,"change:active",this._active_change),this.data=null},e.prototype._active_change=function(){if(!this.model.active)return this._clear_overlay()},e.prototype._keyup=function(t){if(13===t.keyCode)return this._clear_overlay()},e.prototype._pan_start=function(t){var e,r,n;return e=this.plot_view.canvas,r=e.sx_to_vx(t.bokeh.sx),n=e.sy_to_vy(t.bokeh.sy),this.data={vx:[r],vy:[n]},null},e.prototype._pan=function(t){var e,r,n,o,i,s,a,l;if(r=this.plot_view.canvas,a=r.sx_to_vx(t.bokeh.sx),l=r.sy_to_vy(t.bokeh.sy),n=this.plot_model.frame.h_range,s=this.plot_model.frame.v_range,a>n.end&&(a=n.end),a<n.start&&(a=n.start),l>s.end&&(l=s.end),l<s.start&&(l=s.start),this.data.vx.push(a),this.data.vy.push(l),o=this.model.overlay,o.update({xs:this.data.vx,ys:this.data.vy}),this.model.select_every_mousemove)return e=null!=(i=t.srcEvent.shiftKey)&&i,this._select(this.data.vx,this.data.vy,!1,e)},e.prototype._pan_end=function(t){var e,r;return this._clear_overlay(),e=null!=(r=t.srcEvent.shiftKey)&&r,this._select(this.data.vx,this.data.vy,!0,e),this.plot_view.push_state("lasso_select",{selection:this.plot_view.get_selection()})},e.prototype._clear_overlay=function(){return this.model.overlay.update({xs:[],ys:[]})},e.prototype._select=function(t,e,r,n){var o,i,s,a,l,u,c;for(i={type:"poly",vx:t,vy:e},u=this.model.computed_renderers,s=0,a=u.length;s<a;s++)l=u[s],o=l.data_source,c=o.selection_manager,c.select(this,this.plot_view.renderer_views[l.id],i,r,n);return null!=this.model.callback&&this._emit_callback(i),this._save_geometry(i,r,n),null},e.prototype._emit_callback=function(t){var e,r,n,o,i;n=this.model.computed_renderers[0],e=this.plot_model.canvas,r=this.plot_model.frame,t.sx=e.v_vx_to_sx(t.vx),t.sy=e.v_vy_to_sy(t.vy),o=r.x_mappers[n.x_range_name],i=r.y_mappers[n.y_range_name],t.x=o.v_map_from_target(t.vx),t.y=i.v_map_from_target(t.vy),this.model.callback.execute(this.model,{geometry:t})},e}(a.View),n=function(){return new s.Model({level:"overlay",xs_units:"screen",ys_units:"screen",fill_color:"lightgrey",fill_alpha:.5,line_color:"black",line_alpha:1,line_width:2,line_dash:[4,4]})},o=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return c(e,t),e.prototype.default_view=i,e.prototype.type="LassoSelectTool",e.prototype.tool_name="Lasso Select",e.prototype.icon="bk-tool-icon-lasso-select",e.prototype.event_type="pan",e.prototype.default_order=12,e.define({select_every_mousemove:[u.Bool,!0],callback:[u.Instance],overlay:[u.Instance,n]}),e}(a.Model),e.exports={Model:o,View:i}},{"../../../core/properties":"core/properties","../../annotations/poly_annotation":"models/annotations/poly_annotation","./select_tool":"models/tools/gestures/select_tool",underscore:"underscore"}],"models/tools/gestures/pan_tool":[function(t,e,r){var n,o,i,s,a,l=function(t,e){function r(){this.constructor=t}for(var n in e)u.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},u={}.hasOwnProperty;s=t("underscore"),n=t("./gesture_tool"),a=t("../../../core/properties"),i=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return l(e,t),e.prototype._pan_start=function(t){var e,r,n,o,i,s;return this.last_dx=0,this.last_dy=0,e=this.plot_view.canvas,r=this.plot_view.frame,i=e.sx_to_vx(t.bokeh.sx),s=e.sy_to_vy(t.bokeh.sy),r.contains(i,s)||(n=r.h_range,o=r.v_range,(i<n.start||i>n.end)&&(this.v_axis_only=!0),(s<o.start||s>o.end)&&(this.h_axis_only=!0)),this.plot_view.interactive_timestamp=Date.now()},e.prototype._pan=function(t){return this._update(t.deltaX,-t.deltaY),this.plot_view.interactive_timestamp=Date.now()},e.prototype._pan_end=function(t){if(this.h_axis_only=!1,this.v_axis_only=!1,null!=this.pan_info)return this.plot_view.push_state("pan",{range:this.pan_info})},e.prototype._update=function(t,e){var r,n,o,i,s,a,l,u,c,p,h,_,d,f,m,g,y,v,b,x,w,k,M,T,S,z,E;o=this.plot_view.frame,u=t-this.last_dx,c=e-this.last_dy,i=o.h_range,x=i.start-u,b=i.end-u,S=o.v_range,T=S.start-c,M=S.end-c,r=this.model.dimensions,"width"!==r&&"both"!==r||this.v_axis_only?(y=i.start,v=i.end,f=0):(y=x,v=b,f=-u),"height"!==r&&"both"!==r||this.h_axis_only?(w=S.start,k=S.end,m=0):(w=T,k=M,m=c),this.last_dx=t,this.last_dy=e,z={},p=o.x_mappers;for(l in p)a=p[l],h=a.v_map_from_target([y,v],!0),g=h[0],n=h[1],z[l]={start:g,end:n};E={},_=o.y_mappers;for(l in _)a=_[l],d=a.v_map_from_target([w,k],!0),g=d[0],n=d[1],E[l]={start:g,end:n};return this.pan_info={xrs:z,yrs:E,sdx:f,sdy:m},this.plot_view.update_range(this.pan_info,s=!0),null},e}(n.View),o=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return l(e,t),e.prototype.default_view=i,e.prototype.type="PanTool",e.prototype.tool_name="Pan",e.prototype.icon="bk-tool-icon-pan",e.prototype.event_type="pan",e.prototype.default_order=10,e.define({dimensions:[a.Dimensions,"both"]}),e.getters({tooltip:function(){return this._get_dim_tooltip("Pan",this.dimensions)}}),e}(n.Model),e.exports={Model:o,View:i}},{"../../../core/properties":"core/properties","./gesture_tool":"models/tools/gestures/gesture_tool",underscore:"underscore"}],"models/tools/gestures/poly_select_tool":[function(t,e,r){var n,o,i,s,a,l,u,c=function(t,e){function r(){this.constructor=t}for(var n in e)p.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},p={}.hasOwnProperty;l=t("underscore"),a=t("./select_tool"),o=t("../../annotations/poly_annotation"),u=t("../../../core/properties"),s=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return c(e,t),e.prototype.initialize=function(t){return e.__super__.initialize.call(this,t),this.listenTo(this.model,"change:active",this._active_change),this.data=null},e.prototype._active_change=function(){if(!this.model.active)return this._clear_data()},e.prototype._keyup=function(t){if(13===t.keyCode)return this._clear_data()},e.prototype._doubletap=function(t){var e,r;return e=null!=(r=t.srcEvent.shiftKey)&&r,this._select(this.data.vx,this.data.vy,!0,e),this._clear_data()},e.prototype._clear_data=function(){return this.data=null,this.model.overlay.update({xs:[],ys:[]})},e.prototype._tap=function(t){var e,r,n,o,i;return e=this.plot_view.canvas,o=e.sx_to_vx(t.bokeh.sx),i=e.sy_to_vy(t.bokeh.sy),null==this.data?(this.data={vx:[o],vy:[i]},null):(this.data.vx.push(o),this.data.vy.push(i),n=this.model.overlay,r={},r.vx=l.clone(this.data.vx),r.vy=l.clone(this.data.vy),n.update({xs:this.data.vx,ys:this.data.vy}))},e.prototype._select=function(t,e,r,n){var o,i,s,a,l,u,c;for(i={type:"poly",vx:t,vy:e},u=this.model.computed_renderers,s=0,a=u.length;s<a;s++)l=u[s],o=l.data_source,c=o.selection_manager,c.select(this,this.plot_view.renderer_views[l.id],i,r,n);return this._save_geometry(i,r,n),this.plot_view.push_state("poly_select",{selection:this.plot_view.get_selection()}),null},e}(a.View),n=function(){return new o.Model({level:"overlay",xs_units:"screen",ys_units:"screen",fill_color:"lightgrey",fill_alpha:.5,line_color:"black",line_alpha:1,line_width:2,line_dash:[4,4]})},i=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return c(e,t),e.prototype.default_view=s,e.prototype.type="PolySelectTool",e.prototype.tool_name="Poly Select",e.prototype.icon="bk-tool-icon-polygon-select",e.prototype.event_type="tap",e.prototype.default_order=11,e.define({overlay:[u.Instance,n]}),e}(a.Model),e.exports={Model:i,View:s}},{"../../../core/properties":"core/properties","../../annotations/poly_annotation":"models/annotations/poly_annotation","./select_tool":"models/tools/gestures/select_tool",underscore:"underscore"}],"models/tools/gestures/resize_tool":[function(t,e,r){var n,o,i,s,a,l=function(t,e){function r(){this.constructor=t}for(var n in e)u.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},u={}.hasOwnProperty;s=t("underscore"),n=t("./gesture_tool"),a=t("../../../core/properties"),i=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return l(e,t),e.prototype.className="bk-resize-popup",e.prototype.initialize=function(t){var r;return e.__super__.initialize.call(this,t),r=this.plot_view.$el.find("div.bk-canvas-wrapper"),this.$el.appendTo(r),this.$el.hide(),this.active=!1,null},e.prototype.activate=function(){return this.active=!0,this.render(),null},e.prototype.deactivate=function(){return this.active=!1,this.render(),null},e.prototype.render=function(t){var e,r,n,o;return this.active?(e=this.plot_view.canvas,r=this.plot_view.frame,n=e.vx_to_sx(r.h_range.end-40),o=e.vy_to_sy(r.v_range.start+40),this.$el.attr("style","position:absolute; top:"+o+"px; left:"+n+"px;"),this.$el.show()):this.$el.hide(),this},e.prototype._pan_start=function(t){var e;return e=this.plot_view.canvas,this.ch=e.height,this.cw=e.width,this.plot_view.interactive_timestamp=Date.now(),null},e.prototype._pan=function(t){return this._update(t.deltaX,t.deltaY),this.plot_view.interactive_timestamp=Date.now(),null},e.prototype._pan_end=function(t){return this.plot_view.push_state("resize",{dimensions:{width:this.plot_view.canvas.width,height:this.plot_view.canvas.height}})},e.prototype._update=function(t,e){var r,n;n=this.cw+t,r=this.cw+e,n<100||r<100||this.plot_view.update_dimensions(n,r)},e}(n.View),o=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return l(e,t),e.prototype.default_view=i,e.prototype.type="ResizeTool",e.prototype.tool_name="Resize",e.prototype.icon="bk-tool-icon-resize",e.prototype.event_type="pan",e.prototype.default_order=40,e}(n.Model),e.exports={Model:o,View:i}},{"../../../core/properties":"core/properties","./gesture_tool":"models/tools/gestures/gesture_tool",underscore:"underscore"}],"models/tools/gestures/select_tool":[function(t,e,r){var n,o,i,s,a,l,u,c=function(t,e){function r(){this.constructor=t}for(var n in e)p.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},p={}.hasOwnProperty;a=t("underscore"),n=t("./gesture_tool"),o=t("../../renderers/glyph_renderer"),l=t("../../../core/logging").logger,u=t("../../../core/properties"),s=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return c(e,t),e.prototype._keyup=function(t){var e,r,n,o,i,s,a;if(27===t.keyCode){for(i=this.model.computed_renderers,s=[],r=0,n=i.length;r<n;r++)o=i[r],e=o.data_source,a=e.selection_manager,s.push(a.clear());return s}},e.prototype._save_geometry=function(t,e,r){var n,o,i,s,u,c,p,h;switch(n=a.clone(t),p=this.plot_view.frame.x_mappers["default"],h=this.plot_view.frame.y_mappers["default"],n.type){case"point":n.x=p.map_from_target(n.vx),n.y=h.map_from_target(n.vy);break;case"rect":n.x0=p.map_from_target(n.vx0),n.y0=h.map_from_target(n.vy0),n.x1=p.map_from_target(n.vx1),n.y1=h.map_from_target(n.vy1);break;case"poly":for(n.x=new Array(n.vx.length),n.y=new Array(n.vy.length),i=s=0,u=n.vx.length;0<=u?s<u:s>u;i=0<=u?++s:--s)n.x[i]=p.map_from_target(n.vx[i]),n.y[i]=h.map_from_target(n.vy[i]);break;default:l.debug("Unrecognized selection geometry type: '"+n.type+"'")}return e&&(c=this.plot_model.plot.tool_events,r?(o=c.geometries,o.push(n)):o=[n],c.geometries=o),null},e}(n.View),i=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return c(e,t),e.define({renderers:[u.Array,[]],names:[u.Array,[]]}),e.internal({multi_select_modifier:[u.String,"shift"]}),e.prototype.initialize=function(t,r){return e.__super__.initialize.call(this,t,r),this.define_computed_property("computed_renderers",function(){var t,e,r,n;return n=this.renderers,e=this.names,0===n.length&&(t=this.plot.renderers,n=function(){var e,n,i;for(i=[],e=0,n=t.length;e<n;e++)r=t[e],r instanceof o.Model&&i.push(r);return i}()),e.length>0&&(n=function(){var t,o,i;for(i=[],t=0,o=n.length;t<o;t++)r=n[t],e.indexOf(r.name)>=0&&i.push(r);return i}()),n},!0),this.add_dependencies("computed_renderers",this,["renderers","names","plot"]),this.add_dependencies("computed_renderers",this.plot,["renderers"])},e.getters({computed_renderers:function(){return this._get_computed("computed_renderers")}}),e}(n.Model),e.exports={Model:i,View:s}},{"../../../core/logging":"core/logging","../../../core/properties":"core/properties","../../renderers/glyph_renderer":"models/renderers/glyph_renderer","./gesture_tool":"models/tools/gestures/gesture_tool",underscore:"underscore"}],"models/tools/gestures/tap_tool":[function(t,e,r){var n,o,i,s,a,l=function(t,e){function r(){this.constructor=t}for(var n in e)u.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},u={}.hasOwnProperty;s=t("underscore"),n=t("./select_tool"),a=t("../../../core/properties"),i=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return l(e,t),e.prototype._tap=function(t){var e,r,n,o,i;return r=this.plot_view.canvas,o=r.sx_to_vx(t.bokeh.sx),i=r.sy_to_vy(t.bokeh.sy),e=null!=(n=t.srcEvent.shiftKey)&&n,this._select(o,i,!0,e)},e.prototype._select=function(t,e,r,n){var o,i,a,l,u,c,p,h,_,d,f;for(u={type:"point",vx:t,vy:e},o=this.model.callback,this._save_geometry(u,r,n),i={geometries:this.plot_model.plot.tool_events.geometries},_=this.model.computed_renderers,c=0,p=_.length;c<p;c++)h=_[c],l=h.data_source,d=l.selection_manager,f=this.plot_view.renderer_views[h.id],a="select"===this.model.behavior?d.select(this,f,u,r,n):d.inspect(this,f,u,{geometry:u}),a&&null!=o&&(s.isFunction(o)?o(l,i):o.execute(l,i));return"select"===this.model.behavior&&this.plot_view.push_state("tap",{selection:this.plot_view.get_selection()}),null},e}(n.View),o=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return l(e,t),e.prototype.default_view=i,e.prototype.type="TapTool",e.prototype.tool_name="Tap",e.prototype.icon="bk-tool-icon-tap-select",e.prototype.event_type="tap",e.prototype.default_order=10,e.define({behavior:[a.String,"select"],callback:[a.Any]}),e}(n.Model),e.exports={Model:o,View:i}},{"../../../core/properties":"core/properties","./select_tool":"models/tools/gestures/select_tool",underscore:"underscore"}],"models/tools/gestures/wheel_pan_tool":[function(t,e,r){var n,o,i,s,a,l=function(t,e){function r(){this.constructor=t}for(var n in e)u.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},u={}.hasOwnProperty;s=t("underscore"),n=t("./gesture_tool"),a=t("../../../core/properties"),i=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return l(e,t),e.prototype._scroll=function(t){var e,r,n,o;return n=navigator.userAgent.toLowerCase().indexOf("firefox")>-1?20:1,e=null!=(null!=(o=t.originalEvent)?o.deltaY:void 0)?-t.originalEvent.deltaY*n:t.bokeh.delta,r=this.model.speed*e,r>.9?r=.9:r<-.9&&(r=-.9),this._update_ranges(r)},e.prototype._update_ranges=function(t){var e,r,n,o,i,s,a,l,u,c,p,h,_,d,f,m,g,y,v,b,x,w,k,M,T,S;switch(r=this.plot_model.frame,n=r.h_range,y=r.v_range,a=[n.start,n.end],b=a[0],v=a[1],l=[y.start,y.end],k=l[0],w=l[1],this.model.dimension){case"height":M=Math.abs(w-k),d=b,f=v,m=k+M*t,g=w+M*t;break;case"width":x=Math.abs(v-b),d=b-x*t,f=v-x*t,m=k,g=w}T={},u=r.x_mappers;for(i in u)o=u[i],c=o.v_map_from_target([d,f],!0),_=c[0],e=c[1],T[i]={start:_,end:e};S={},p=r.y_mappers;for(i in p)o=p[i],h=o.v_map_from_target([m,g],!0),_=h[0],e=h[1],S[i]={start:_,end:e};return s={xrs:T,yrs:S,factor:t},this.plot_view.push_state("wheel_pan",{range:s}),this.plot_view.update_range(s,!1,!0),this.plot_view.interactive_timestamp=Date.now(),null},e}(n.View),o=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return l(e,t),e.prototype.type="WheelPanTool",e.prototype.default_view=i,e.prototype.tool_name="Wheel Pan",e.prototype.icon="bk-tool-icon-wheel-pan",e.prototype.event_type="scroll",e.prototype.default_order=12,e.getters({tooltip:function(){return this._get_dim_tooltip(this.tool_name,this.dimension)}}),e.define({dimension:[a.Dimension,"width"]}),e.internal({speed:[a.Number,.001]}),e}(n.Model),e.exports={Model:o,View:i}},{"../../../core/properties":"core/properties","./gesture_tool":"models/tools/gestures/gesture_tool",underscore:"underscore"}],"models/tools/gestures/wheel_zoom_tool":[function(t,e,r){var n,o,i,s,a,l,u,c=function(t,e){function r(){this.constructor=t}for(var n in e)p.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,
|
|
t},p={}.hasOwnProperty;s=t("underscore"),n=t("./gesture_tool"),u=t("../../../core/util/zoom").scale_range,l=t("../../../core/properties"),"undefined"!=typeof a&&null!==a||(a={}),i=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return c(e,t),e.prototype._pinch=function(t){var e;return e=t.scale>=1?20*(t.scale-1):-20/t.scale,t.bokeh.delta=e,this._scroll(t)},e.prototype._scroll=function(t){var e,r,n,o,i,s,a,l,c,p,h,_,d;return o=this.plot_model.frame,s=o.h_range,p=o.v_range,h=this.plot_view.canvas.sx_to_vx(t.bokeh.sx),_=this.plot_view.canvas.sy_to_vy(t.bokeh.sy),r=this.model.dimensions,i=("width"===r||"both"===r)&&s.min<h&&h<s.max,c=("height"===r||"both"===r)&&p.min<_&&_<p.max,a=navigator.userAgent.toLowerCase().indexOf("firefox")>-1?20:1,e=null!=(null!=(l=t.originalEvent)?l.deltaY:void 0)?-t.originalEvent.deltaY*a:t.bokeh.delta,n=this.model.speed*e,d=u(o,n,i,c,{x:h,y:_}),this.plot_view.push_state("wheel_zoom",{range:d}),this.plot_view.update_range(d,!1,!0),this.plot_view.interactive_timestamp=Date.now(),null},e}(n.View),o=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return c(e,t),e.prototype.default_view=i,e.prototype.type="WheelZoomTool",e.prototype.tool_name="Wheel Zoom",e.prototype.icon="bk-tool-icon-wheel-zoom",e.prototype.event_type="ontouchstart"in window||navigator.maxTouchPoints>0?"pinch":"scroll",e.prototype.default_order=10,e.getters({tooltip:function(){return this._get_dim_tooltip(this.tool_name,this.dimensions)}}),e.define({dimensions:[l.Dimensions,"both"]}),e.internal({speed:[l.Number,1/600]}),e}(n.Model),e.exports={Model:o,View:i}},{"../../../core/properties":"core/properties","../../../core/util/zoom":"core/util/zoom","./gesture_tool":"models/tools/gestures/gesture_tool",underscore:"underscore"}],"models/tools/inspectors/crosshair_tool":[function(t,e,r){var n,o,i,s,a,l,u=function(t,e){function r(){this.constructor=t}for(var n in e)c.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},c={}.hasOwnProperty;a=t("underscore"),i=t("./inspect_tool"),s=t("../../annotations/span"),l=t("../../../core/properties"),o=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return u(e,t),e.prototype._move=function(t){var e,r,n,o;if(this.model.active)return r=this.plot_model.frame,e=this.plot_model.canvas,n=e.sx_to_vx(t.bokeh.sx),o=e.sy_to_vy(t.bokeh.sy),r.contains(n,o)||(n=o=null),this._update_spans(n,o)},e.prototype._move_exit=function(t){return this._update_spans(null,null)},e.prototype._update_spans=function(t,e){var r;if(r=this.model.dimensions,"width"!==r&&"both"!==r||(this.model.spans.width.computed_location=e),"height"===r||"both"===r)return this.model.spans.height.computed_location=t},e}(i.View),n=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return u(e,t),e.prototype.default_view=o,e.prototype.type="CrosshairTool",e.prototype.tool_name="Crosshair",e.define({dimensions:[l.Dimensions,"both"],line_color:[l.Color,"black"],line_width:[l.Number,1],line_alpha:[l.Number,1]}),e.internal({location_units:[l.SpatialUnits,"screen"],render_mode:[l.RenderMode,"css"],spans:[l.Any]}),e.getters({tooltip:function(){return this._get_dim_tooltip("Crosshair",this.dimensions)},synthetic_renderers:function(){return a.values(this.spans)}}),e.prototype.initialize=function(t,r){return e.__super__.initialize.call(this,t,r),this.spans={width:new s.Model({for_hover:!0,dimension:"width",render_mode:this.render_mode,location_units:this.location_units,line_color:this.line_color,line_width:this.line_width,line_alpha:this.line_alpha}),height:new s.Model({for_hover:!0,dimension:"height",render_mode:this.render_mode,location_units:this.location_units,line_color:this.line_color,line_width:this.line_width,line_alpha:this.line_alpha})}},e}(i.Model),e.exports={Model:n,View:o}},{"../../../core/properties":"core/properties","../../annotations/span":"models/annotations/span","./inspect_tool":"models/tools/inspectors/inspect_tool",underscore:"underscore"}],"models/tools/inspectors/hover_tool":[function(t,e,r){var n,o,i,s,a,l,u,c,p,h,_,d,f=function(t,e){function r(){this.constructor=t}for(var n in e)m.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},m={}.hasOwnProperty;u=t("underscore"),n=t("jquery"),a=t("./inspect_tool"),l=t("../../annotations/tooltip"),o=t("../../renderers/glyph_renderer"),p=t("../../../core/hittest"),h=t("../../../core/logging").logger,d=t("../../../core/util/templating").replace_placeholders,_=t("../../../core/properties"),c=function(t){var e,r,n,o,i;return"#"===t.substr(0,1)?t:(r=/(.*?)rgb\((\d+), (\d+), (\d+)\)/.exec(t),o=parseInt(r[2]),n=parseInt(r[3]),e=parseInt(r[4]),i=e|n<<8|o<<16,r[1]+"#"+i.toString(16))},s=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return f(e,t),e.prototype.bind_bokeh_events=function(){var t,e,r,n;for(n=this.model.computed_renderers,t=0,e=n.length;t<e;t++)r=n[t],this.listenTo(r.data_source,"inspect",this._update);return this.plot_view.canvas_view.$el.css("cursor","crosshair")},e.prototype._clear=function(){var t,e,r,n;this._inspect(1/0,1/0),t=this.model.ttmodels,e=[];for(r in t)n=t[r],e.push(n.clear());return e},e.prototype._move=function(t){var e,r,n;if(this.model.active)return e=this.plot_view.canvas,r=e.sx_to_vx(t.bokeh.sx),n=e.sy_to_vy(t.bokeh.sy),this.plot_view.frame.contains(r,n)?this._inspect(r,n):this._clear()},e.prototype._move_exit=function(){return this._clear()},e.prototype._inspect=function(t,e,r){var n,o,i,s,a,l,u,c;for(n={type:"point",vx:t,vy:e},"mouse"===this.model.mode?n.type="point":(n.type="span","vline"===this.model.mode?n.direction="h":n.direction="v"),o=[],i=[],u=this.model.computed_renderers,s=0,a=u.length;s<a;s++)l=u[s],c=l.data_source.selection_manager,c.inspect(this,this.plot_view.renderer_views[l.id],n,{geometry:n});null!=this.model.callback&&this._emit_callback(n)},e.prototype._update=function(t,e,r,n,o){var i,s,a,l,c,h,_,d,f,m,g,y,v,b,x,w,k,M,T,S,z,E,A,C,j,P,N,O,D,F,q,I,R,L,B,V,G,U,Y,H,X,$,W,J,K,Q,Z,tt,et,rt,nt;if(g=o.geometry,J=null!=(E=this.model.ttmodels[r.model.id])?E:null,null!=J&&(J.clear(),null!==t["0d"].glyph||0!==t["1d"].indices.length)){for(Q=g.vx,Z=g.vy,i=this.plot_model.canvas,m=this.plot_model.frame,$=i.vx_to_sx(Q),W=i.vy_to_sy(Z),et=m.x_mappers[r.model.x_range_name],nt=m.y_mappers[r.model.y_range_name],tt=et.map_from_target(Q),rt=nt.map_from_target(Z),A=t["0d"].indices,b=0,w=A.length;b<w;b++){switch(y=A[b],h=r.glyph._x[y+1],_=r.glyph._y[y+1],this.model.line_policy){case"interp":F=r.glyph.get_interpolation_hit(y,g),h=F[0],_=F[1],U=et.map_to_target(h),Y=nt.map_to_target(_);break;case"prev":U=i.sx_to_vx(r.glyph.sx[y]),Y=i.sy_to_vy(r.glyph.sy[y]);break;case"next":U=i.sx_to_vx(r.glyph.sx[y+1]),Y=i.sy_to_vy(r.glyph.sy[y+1]);break;case"nearest":s=r.glyph.sx[y],a=r.glyph.sy[y],d=p.dist_2_pts(s,a,$,W),l=r.glyph.sx[y+1],c=r.glyph.sy[y+1],f=p.dist_2_pts(l,c,$,W),d<f?(q=[s,a],H=q[0],X=q[1]):(I=[l,c],H=I[0],X=I[1],y+=1),h=r.glyph._x[y],_=r.glyph._y[y],U=i.sx_to_vx(H),Y=i.sy_to_vy(X);break;default:R=[Q,Z],U=R[0],Y=R[1]}K={index:y,x:tt,y:rt,vx:Q,vy:Z,sx:$,sy:W,data_x:h,data_y:_,rx:U,ry:Y},J.add(U,Y,this._render_tooltips(n,y,K))}for(L=t["1d"].indices,x=0,k=L.length;x<k;x++)if(y=L[x],u.isEmpty(t["2d"]))h=null!=(P=r.glyph._x)?P[y]:void 0,_=null!=(N=r.glyph._y)?N[y]:void 0,"snap_to_data"===this.model.point_policy?(z=r.glyph.get_anchor_point(this.model.anchor,y,[$,W]),null!=z?(tt=z.x,rt=z.y):(O=r.glyph.get_anchor_point("center",y,[$,W]),tt=O.x,rt=O.y),U=i.sx_to_vx(tt),Y=i.sy_to_vy(rt)):(D=[Q,Z],U=D[0],Y=D[1]),K={index:y,x:tt,y:rt,vx:Q,vy:Z,sx:$,sy:W,data_x:h,data_y:_},J.add(U,Y,this._render_tooltips(n,y,K));else for(B=u.pairs(t["2d"]),T=0,M=B.length;T<M;T++){switch(S=B[T],V=[S[0],S[1][0]],y=V[0],v=V[1],h=r.glyph._xs[y][v],_=r.glyph._ys[y][v],this.model.line_policy){case"interp":G=r.glyph.get_interpolation_hit(y,v,g),h=G[0],_=G[1],U=et.map_to_target(h),Y=nt.map_to_target(_);break;case"prev":U=i.sx_to_vx(r.glyph.sxs[y][v]),Y=i.sy_to_vy(r.glyph.sys[y][v]);break;case"next":U=i.sx_to_vx(r.glyph.sxs[y][v+1]),Y=i.sy_to_vy(r.glyph.sys[y][v+1]);break;case"nearest":s=r.glyph.sx[y][v],a=r.glyph.sy[y][v],d=p.dist_2_pts(s,a,$,W),l=r.glyph.sx[y][v+1],c=r.glyph.sy[y][v+1],f=p.dist_2_pts(l,c,$,W),d<f?(C=[s,a],H=C[0],X=C[1]):(j=[l,c],H=j[0],X=j[1],v+=1),h=r.glyph._x[y][v],_=r.glyph._y[y][v],U=i.sx_to_vx(H),Y=i.sy_to_vy(X)}K={index:y,segment_index:v,x:tt,y:rt,vx:Q,vy:Z,sx:$,sy:W,data_x:h,data_y:_},J.add(U,Y,this._render_tooltips(n,y,K))}return null}},e.prototype._emit_callback=function(t){var e,r,n,o,i,s,a,l,c,p;a=this.model.computed_renderers[0],i=this.plot_view.renderer_views[a.id].hit_test(t),r=this.plot_model.canvas,o=this.plot_model.frame,t.sx=r.vx_to_sx(t.vx),t.sy=r.vy_to_sy(t.vy),c=o.x_mappers[a.x_range_name],p=o.y_mappers[a.y_range_name],t.x=c.map_from_target(t.vx),t.y=p.map_from_target(t.vy),e=this.model.callback,l=[e,{index:i,geometry:t}],s=l[0],n=l[1],u.isFunction(e)?e(s,n):e.execute(s,n)},e.prototype._render_tooltips=function(t,e,r){var o,i,s,a,l,p,h,_,f,m,g,y,v,b,x,w,k,M;if(k=this.model.tooltips,u.isString(k))return n("<div>").html(d(k,t,e,r));if(u.isFunction(k))return k(t,r);for(x=n("<table></table>"),l=0,h=k.length;l<h;l++){if(m=k[l],p=m[0],M=m[1],y=n("<tr></tr>"),y.append(n("<td class='bk-tooltip-row-label'>").text(p+": ")),w=n("<td class='bk-tooltip-row-value'></td>"),M.indexOf("$color")>=0){if(g=M.match(/\$color(\[.*\])?:(\w*)/),_=g[0],f=g[1],o=g[2],s=t.get_column(o),null==s){v=n("<span>").text(o+" unknown"),w.append(v);continue}if(a=(null!=f?f.indexOf("hex"):void 0)>=0,b=(null!=f?f.indexOf("swatch"):void 0)>=0,i=s[e],null==i){v=n("<span>(null)</span>"),w.append(v);continue}a&&(i=c(i)),v=n("<span>").text(i),w.append(v),b&&(v=n("<span class='bk-tooltip-color-block'> </span>"),v.css({backgroundColor:i})),w.append(v)}else M=M.replace("$~","$data_"),M=d(M,t,e,r),w.append(n("<span>").html(M));y.append(w),x.append(y)}return x},e}(a.View),i=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return f(e,t),e.prototype.default_view=s,e.prototype.type="HoverTool",e.prototype.tool_name="Hover Tool",e.prototype.icon="bk-tool-icon-hover",e.define({tooltips:[_.Any,[["index","$index"],["data (x, y)","($x, $y)"],["canvas (x, y)","($sx, $sy)"]]],renderers:[_.Array,[]],names:[_.Array,[]],mode:[_.String,"mouse"],point_policy:[_.String,"snap_to_data"],line_policy:[_.String,"prev"],show_arrow:[_.Boolean,!0],anchor:[_.String,"center"],attachment:[_.String,"horizontal"],callback:[_.Any]}),e.prototype.initialize=function(t,r){return e.__super__.initialize.call(this,t,r),this.define_computed_property("computed_renderers",function(){var t,e,r,n;return n=this.renderers,e=this.names,0===n.length&&(t=this.plot.renderers,n=function(){var e,n,i;for(i=[],e=0,n=t.length;e<n;e++)r=t[e],r instanceof o.Model&&i.push(r);return i}()),e.length>0&&(n=function(){var t,o,i;for(i=[],t=0,o=n.length;t<o;t++)r=n[t],e.indexOf(r.name)>=0&&i.push(r);return i}()),n},!0),this.add_dependencies("computed_renderers",this,["renderers","names","plot"]),this.add_dependencies("computed_renderers",this.plot,["renderers"]),this.define_computed_property("ttmodels",function(){var t,e,r,n,o,i,s;if(s={},i=this.tooltips,null!=i)for(n=this.computed_renderers,t=0,e=n.length;t<e;t++)r=n[t],o=new l.Model({custom:u.isString(i)||u.isFunction(i),attachment:this.attachment,show_arrow:this.show_arrow}),s[r.id]=o;return s}),this.add_dependencies("ttmodels",this,["computed_renderers","tooltips"])},e.getters({computed_renderers:function(){return this._get_computed("computed_renderers")},ttmodels:function(){return this._get_computed("ttmodels")},synthetic_renderers:function(){return u.values(this.ttmodels)}}),e}(a.Model),e.exports={Model:i,View:s}},{"../../../core/hittest":"core/hittest","../../../core/logging":"core/logging","../../../core/properties":"core/properties","../../../core/util/templating":"core/util/templating","../../annotations/tooltip":"models/annotations/tooltip","../../renderers/glyph_renderer":"models/renderers/glyph_renderer","./inspect_tool":"models/tools/inspectors/inspect_tool",jquery:"jquery",underscore:"underscore"}],"models/tools/inspectors/inspect_tool":[function(t,e,r){var n,o,i,s,a,l,u,c=function(t,e){function r(){this.constructor=t}for(var n in e)p.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},p={}.hasOwnProperty;l=t("underscore"),n=t("../../../core/bokeh_view"),a=t("../tool"),u=t("./inspect_tool_list_item_template"),i=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return c(e,t),e.prototype.className="bk-toolbar-inspector",e.prototype.template=u,e.prototype.events={'click [type="checkbox"]':"_clicked"},e.prototype.initialize=function(t){return this.listenTo(this.model,"change:active",this.render),this.render()},e.prototype.render=function(){return this.$el.html(this.template({model:this.model})),this},e.prototype._clicked=function(t){var e;return e=this.model.active,this.model.active=!e},e}(n),s=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return c(e,t),e}(a.View),o=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return c(e,t),e.prototype.event_type="move",e.override({active:!0}),e.prototype.bind_bokeh_events=function(){return e.__super__.bind_bokeh_events.call(this),this.listenTo(events,"move",this._inspect)},e.prototype._inspect=function(t,e,r){},e.prototype._exit_inner=function(){},e.prototype._exit_outer=function(){},e}(a.Model),e.exports={Model:o,View:s,ListItemView:i}},{"../../../core/bokeh_view":"core/bokeh_view","../tool":"models/tools/tool","./inspect_tool_list_item_template":"models/tools/inspectors/inspect_tool_list_item_template",underscore:"underscore"}],"models/tools/inspectors/inspect_tool_list_item_template":[function(t,e,r){e.exports=function(t){t||(t={});var e=[],r=function(t){return t&&t.ecoSafe?t:"undefined"!=typeof t&&null!=t?n(t):""},n=function(t){return(""+t).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")};return function(){(function(){e.push('<input type="checkbox" '),this.model.active&&e.push("checked"),e.push(">"),e.push(r(this.model.tool_name)),e.push("</input>\n")}).call(this)}.call(t),e.join("")}},{}],"models/tools/tool":[function(t,e,r){var n,o,i,s,a,l,u,c=function(t,e){function r(){this.constructor=t}for(var n in e)p.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},p={}.hasOwnProperty;a=t("underscore"),l=t("../../core/logging").logger,u=t("../../core/properties"),n=t("../../core/bokeh_view"),o=t("../../model"),s=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return c(e,t),e.prototype.initialize=function(t){return e.__super__.initialize.call(this,t),this.plot_view=t.plot_view},e.getters({plot_model:function(){return this.plot_view.model}}),e.prototype.bind_bokeh_events=function(){return this.listenTo(this.model,"change:active",function(t){return function(){return t.model.active?t.activate():t.deactivate()}}(this))},e.prototype.activate=function(){},e.prototype.deactivate=function(){},e}(n),i=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return c(e,t),e.getters({synthetic_renderers:function(){return[]}}),e.define({plot:[u.Instance]}),e.internal({active:[u.Boolean,!1]}),e.prototype._get_dim_tooltip=function(t,e){switch(e){case"width":return t+" (x-axis)";case"height":return t+" (y-axis)";case"both":return t}},e.prototype._get_dim_limits=function(t,e,r,n){var o,i,s,l,u,c,p,h;return s=t[0],c=t[1],l=e[0],p=e[1],o=r.h_range,"width"===n||"both"===n?(u=[a.min([s,l]),a.max([s,l])],u=[a.max([u[0],o.min]),a.min([u[1],o.max])]):u=[o.min,o.max],i=r.v_range,"height"===n||"both"===n?(h=[a.min([c,p]),a.max([c,p])],h=[a.max([h[0],i.min]),a.min([h[1],i.max])]):h=[i.min,i.max],[u,h]},e}(o),e.exports={Model:i,View:s}},{"../../core/bokeh_view":"core/bokeh_view","../../core/logging":"core/logging","../../core/properties":"core/properties","../../model":"model",underscore:"underscore"}],"models/tools/tool_events":[function(t,e,r){var n,o,i,s,a,l=function(t,e){function r(){this.constructor=t}for(var n in e)u.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},u={}.hasOwnProperty;i=t("underscore"),n=t("../../model"),s=t("../../core/logging").logger,a=t("../../core/properties"),o=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return l(e,t),e.prototype.type="ToolEvents",e.define({geometries:[a.Array,[]]}),e}(n),e.exports={Model:o}},{"../../core/logging":"core/logging","../../core/properties":"core/properties","../../model":"model",underscore:"underscore"}],"models/tools/tool_proxy":[function(t,e,r){var n,o,i,s=function(t,e){function r(){this.constructor=t}for(var n in e)a.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},a={}.hasOwnProperty;i=t("../../core/properties"),n=t("../../model"),o=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return s(e,t),e.prototype.initialize=function(t){return e.__super__.initialize.call(this,t),this.listenTo(this,"do",this["do"]),this.listenTo(this,"change:active",this.set_active)},e.prototype["do"]=function(){var t,e,r,n;for(r=this.tools,t=0,e=r.length;t<e;t++)n=r[t],n.trigger("do");return null},e.prototype.set_active=function(){var t,e,r,n;for(r=this.tools,t=0,e=r.length;t<e;t++)n=r[t],n.active=this.active;return null},e.define({tools:[i.Array,[]],active:[i.Bool,!1],tooltip:[i.String],tool_name:[i.String],disabled:[i.Bool,!1],event_type:[i.String],icon:[i.String]}),e.prototype._clicked=function(){var t;return t=this.model.active,this.model.active=!t},e}(n),e.exports={ToolProxy:o}},{"../../core/properties":"core/properties","../../model":"model"}],"models/tools/toolbar":[function(t,e,r){var n,o,i,s,a,l,u,c,p=function(t,e){function r(){this.constructor=t}for(var n in e)h.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},h={}.hasOwnProperty;u=t("underscore"),c=t("../../core/properties"),n=t("./actions/action_tool"),i=t("./actions/help_tool"),o=t("./gestures/gesture_tool"),s=t("./inspectors/inspect_tool"),l=t("./toolbar_base"),a=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return p(e,t),e.prototype.type="Toolbar",e.prototype.default_view=l.View,e.prototype.initialize=function(t,r){return e.__super__.initialize.call(this,t,r),this.listenTo(this,"change:tools",this._init_tools),this._init_tools()},e.prototype._init_tools=function(){var t,e,r,a,l,c,p;for(a=this.tools,e=0,r=a.length;e<r;e++)if(c=a[e],c instanceof s.Model)u.some(this.inspectors,function(t){return function(t){return t.id===c.id}}(this))||(this.inspectors=this.inspectors.concat([c]));else if(c instanceof i.Model)u.some(this.help,function(t){return function(t){return t.id===c.id}}(this))||(this.help=this.help.concat([c]));else if(c instanceof n.Model)u.some(this.actions,function(t){return function(t){return t.id===c.id}}(this))||(this.actions=this.actions.concat([c]));else if(c instanceof o.Model){if(t=c.event_type,!(t in this.gestures)){logger.warn("Toolbar: unknown event type '"+t+"' for tool: "+c.type+" ("+c.id+")");continue}u.some(this.gestures[t].tools,function(t){return function(t){return t.id===c.id}}(this))||(this.gestures[t].tools=this.gestures[t].tools.concat([c])),this.listenTo(c,"change:active",u.bind(this._active_change,c))}l=[];for(t in this.gestures)if(p=this.gestures[t].tools,0!==p.length){if(this.gestures[t].tools=u.sortBy(p,function(t){return t.default_order}),"tap"===t){if(null===this.active_tap)continue;"auto"===this.active_tap?this.gestures[t].tools[0].active=!0:this.active_tap.active=!0}if("pan"===t){if(null===this.active_drag)continue;"auto"===this.active_drag?this.gestures[t].tools[0].active=!0:this.active_drag.active=!0}if("pinch"===t||"scroll"===t){if(null===this.active_scroll||"auto"===this.active_scroll)continue;l.push(this.active_scroll.active=!0)}else l.push(void 0)}return l},e.define({active_drag:[c.Any,"auto"],active_scroll:[c.Any,"auto"],active_tap:[c.Any,"auto"]}),e}(l.Model),e.exports={Model:a}},{"../../core/properties":"core/properties","./actions/action_tool":"models/tools/actions/action_tool","./actions/help_tool":"models/tools/actions/help_tool","./gestures/gesture_tool":"models/tools/gestures/gesture_tool","./inspectors/inspect_tool":"models/tools/inspectors/inspect_tool","./toolbar_base":"models/tools/toolbar_base",underscore:"underscore"}],"models/tools/toolbar_base":[function(t,e,r){var n,o,i,s,a,l,u,c,p,h,_,d,f,m,g,y,v=function(t,e){function r(){this.constructor=t}for(var n in e)b.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},b={}.hasOwnProperty,x=function(t,e){return function(){return t.apply(e,arguments)}};d=t("underscore"),n=t("jquery"),o=t("bootstrap/dropdown"),f=t("../../core/logging").logger,g=t("../../core/layout/solver"),s=g.EQ,_=g.Variable,m=t("../../core/properties"),c=t("../layouts/layout_dom"),i=t("./actions/action_tool"),l=t("./actions/help_tool"),a=t("./gestures/gesture_tool"),u=t("./inspectors/inspect_tool"),y=t("./toolbar_template"),h=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return v(e,t),e.prototype.className="bk-toolbar-wrapper",e.prototype.template=y,e.prototype.render=function(){var t,e,r,o,s,l,c,p;"fixed"!==this.model.sizing_mode&&this.$el.css({left:this.model._dom_left._value,top:this.model._dom_top._value,width:this.model._width._value,height:this.model._height._value}),l=null!=this.model.toolbar_location?this.model.toolbar_location:"above",c=this.model.toolbar_sticky===!0?"sticky":"not-sticky",this.$el.html(this.template({logo:this.model.logo,location:l,sticky:c})),s=this.model.inspectors,e=this.$(".bk-bs-dropdown[type='inspectors']"),0===s.length?e.hide():(t=n('<a href="#" data-bk-bs-toggle="dropdown" class="bk-bs-dropdown-toggle">inspect <span class="bk-bs-caret"></a>'),t.appendTo(e),p=n('<ul class="bk-bs-dropdown-menu" />'),d.each(s,function(t){var e;return e=n("<li />"),e.append(new u.ListItemView({model:t}).el),e.appendTo(p)}),p.on("click",function(t){return t.stopPropagation()}),p.appendTo(e),t.dropdown()),e=this.$(".bk-button-bar-list[type='help']"),d.each(this.model.help,function(t){return e.append(new i.ButtonView({model:t}).el)}),e=this.$(".bk-button-bar-list[type='actions']"),d.each(this.model.actions,function(t){return e.append(new i.ButtonView({model:t}).el)}),o=this.model.gestures;for(r in o)e=this.$(".bk-button-bar-list[type='"+r+"']"),d.each(o[r].tools,function(t){return e.append(new a.ButtonView({model:t}).el)});return this},e}(c.View),p=function(t){function e(){return this._active_change=x(this._active_change,this),e.__super__.constructor.apply(this,arguments)}return v(e,t),e.prototype.type="ToolbarBase",e.prototype.default_view=h,e.prototype._active_change=function(t){var e,r,n;return r=t.event_type,n=this.gestures,e=n[r].active,null!=e&&e!==t&&(f.debug("Toolbar: deactivating tool: "+e.type+" ("+e.id+") for event type '"+r+"'"),e.active=!1),n[r].active=t,this.gestures=n,f.debug("Toolbar: activating tool: "+t.type+" ("+t.id+") for event type '"+r+"'"),null},e.prototype.get_constraints=function(){var t;return t=e.__super__.get_constraints.call(this),t.push(s(this._sizeable,-30)),t},e.define({tools:[m.Array,[]],logo:[m.String,"normal"]}),e.internal({gestures:[m.Any,function(){return{pan:{tools:[],active:null},tap:{tools:[],active:null},doubletap:{tools:[],active:null},scroll:{tools:[],active:null},pinch:{tools:[],active:null},press:{tools:[],active:null},rotate:{tools:[],active:null}}}],actions:[m.Array,[]],inspectors:[m.Array,[]],help:[m.Array,[]],toolbar_location:[m.Location,"right"],toolbar_sticky:[m.Bool]}),e.override({sizing_mode:null}),e}(c.Model),e.exports={Model:p,View:h}},{"../../core/layout/solver":"core/layout/solver","../../core/logging":"core/logging","../../core/properties":"core/properties","../layouts/layout_dom":"models/layouts/layout_dom","./actions/action_tool":"models/tools/actions/action_tool","./actions/help_tool":"models/tools/actions/help_tool","./gestures/gesture_tool":"models/tools/gestures/gesture_tool","./inspectors/inspect_tool":"models/tools/inspectors/inspect_tool","./toolbar_template":"models/tools/toolbar_template","bootstrap/dropdown":"bootstrap/dropdown",jquery:"jquery",underscore:"underscore"}],"models/tools/toolbar_box":[function(t,e,r){var n,o,i,s,a,l,u,c,p,h,_,d,f=function(t,e){function r(){this.constructor=t}for(var n in e)m.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},m={}.hasOwnProperty;_=t("underscore"),d=t("../../core/properties"),n=t("./actions/action_tool"),s=t("./actions/help_tool"),i=t("./gestures/gesture_tool"),a=t("./inspectors/inspect_tool"),u=t("./toolbar_base"),l=t("./tool_proxy").ToolProxy,o=t("../layouts/box"),p=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return f(e,t),e.prototype.type="ToolbarBoxToolbar",e.prototype.default_view=u.View,e.prototype.initialize=function(t){if(e.__super__.initialize.call(this,t),this._init_tools(),this.merge_tools===!0)return this._merge_tools()},e.define({merge_tools:[d.Bool,!0]}),e.prototype._init_tools=function(){var t,e,r,o,l,u;for(o=this.tools,l=[],e=0,r=o.length;e<r;e++)u=o[e],u instanceof a.Model?_.some(this.inspectors,function(t){return function(t){return t.id===u.id}}(this))?l.push(void 0):l.push(this.inspectors=this.inspectors.concat([u])):u instanceof s.Model?_.some(this.help,function(t){return function(t){return t.id===u.id}}(this))?l.push(void 0):l.push(this.help=this.help.concat([u])):u instanceof n.Model?_.some(this.actions,function(t){return function(t){return t.id===u.id}}(this))?l.push(void 0):l.push(this.actions=this.actions.concat([u])):u instanceof i.Model?(t=u.event_type,_.some(this.gestures[t].tools,function(t){return function(t){return t.id===u.id}}(this))?l.push(void 0):l.push(this.gestures[t].tools=this.gestures[t].tools.concat([u]))):l.push(void 0);return l},e.prototype._merge_tools=function(){var t,e,r,n,o,i,s,a,u,c,p,h,d,f,m,g,y,v,b,x,w,k,M,T,S,z,E,A,C,j;for(u={},t={},o={},v=[],b=[],w=this.help,s=0,d=w.length;s<d;s++)i=w[s],_.contains(b,i.redirect)||(v.push(i),b.push(i.redirect));this.help=v,k=this.gestures;for(n in k){a=k[n],n in o||(o[n]={}),M=a.tools;for(c=0,f=M.length;c<f;c++)A=M[c],A.type in o[n]||(o[n][A.type]=[]),o[n][A.type].push(A)}for(T=this.inspectors,p=0,m=T.length;p<m;p++)A=T[p],A.type in u||(u[A.type]=[]),u[A.type].push(A);for(S=this.actions,h=0,g=S.length;h<g;h++)A=S[h],A.type in t||(t[A.type]=[]),t[A.type].push(A);y=function(t,e){return null==e&&(e=!1),new l({tools:t,event_type:t[0].event_type,tooltip:t[0].tool_name,tool_name:t[0].tool_name,icon:t[0].icon,active:e})};for(n in o){this.gestures[n].tools=[],z=o[n];for(C in z)j=z[C],j.length>0&&(x=y(j),this.gestures[n].tools.push(x),this.listenTo(x,"change:active",_.bind(this._active_change,x)))}this.actions=[];for(C in t)j=t[C],j.length>0&&this.actions.push(y(j));this.inspectors=[];for(C in u)j=u[C],j.length>0&&this.inspectors.push(y(j,e=!0));E=[];for(r in this.gestures)j=this.gestures[r].tools,0!==j.length&&(this.gestures[r].tools=_.sortBy(j,function(t){return t.default_order}),"pinch"!==r&&"scroll"!==r?E.push(this.gestures[r].tools[0].active=!0):E.push(void 0));return E},e}(u.Model),h=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return f(e,t),e.prototype.className="bk-toolbar-box",e.prototype.get_width=function(){return this.model._horizontal===!0?30:null},e.prototype.get_height=function(){return 30},e}(o.View),c=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return f(e,t),e.prototype.type="ToolbarBox",e.prototype.default_view=h,e.prototype.initialize=function(t){var r;return e.__super__.initialize.call(this,t),this._toolbar=new p(t),"left"===(r=this.toolbar_location)||"right"===r?(this._horizontal=!0,this._toolbar._sizeable=this._toolbar._width):(this._horizontal=!1,this._toolbar._sizeable=this._toolbar._height)},e.prototype._doc_attached=function(){return this._toolbar.attach_document(this.document)},e.prototype.get_layoutable_children=function(){return[this._toolbar]},e.define({toolbar_location:[d.Location,"right"],merge_tools:[d.Bool,!0],tools:[d.Any,[]],logo:[d.String,"normal"]}),e}(o.Model),e.exports={Model:c,View:h}},{"../../core/properties":"core/properties","../layouts/box":"models/layouts/box","./actions/action_tool":"models/tools/actions/action_tool","./actions/help_tool":"models/tools/actions/help_tool","./gestures/gesture_tool":"models/tools/gestures/gesture_tool","./inspectors/inspect_tool":"models/tools/inspectors/inspect_tool","./tool_proxy":"models/tools/tool_proxy","./toolbar_base":"models/tools/toolbar_base",underscore:"underscore"}],"models/tools/toolbar_template":[function(t,e,r){e.exports=function(t){t||(t={});var e=[],r=function(t){return t&&t.ecoSafe?t:"undefined"!=typeof t&&null!=t?n(t):""},n=function(t){return(""+t).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")};return function(){(function(){e.push('<div class="bk-toolbar-'),e.push(r(this.location)),e.push(" bk-plot-"),e.push(r(this.location)),e.push(" bk-toolbar-"),e.push(r(this.sticky)),e.push(' bk-toolbar-active">\n '),null!=this.logo&&"grey"===this.logo?e.push("\n <a href='http://bokeh.pydata.org/' target='_blank' class='bk-logo bk-logo-small grey'></a>\n "):null!=this.logo&&e.push("\n <a href='http://bokeh.pydata.org/' target='_blank' class='bk-logo bk-logo-small'></a>\n "),e.push("\n <div class='bk-button-bar'>\n <ul class='bk-button-bar-list' type=\"pan\" />\n <ul class='bk-button-bar-list' type=\"scroll\" />\n <ul class='bk-button-bar-list' type=\"pinch\" />\n <ul class='bk-button-bar-list' type=\"tap\" />\n <ul class='bk-button-bar-list' type=\"press\" />\n <ul class='bk-button-bar-list' type=\"rotate\" />\n <ul class='bk-button-bar-list' type=\"actions\" />\n <div class='bk-button-bar-list bk-bs-dropdown' type=\"inspectors\" />\n <ul class='bk-button-bar-list' type=\"help\" />\n </div>\n</div>\n")}).call(this)}.call(t),e.join("")}},{}],"models/transforms/interpolator":[function(t,e,r){var n,o,i,s,a,l=function(t,e){function r(){this.constructor=t}for(var n in e)u.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},u={}.hasOwnProperty,c=[].indexOf||function(t){for(var e=0,r=this.length;e<r;e++)if(e in this&&this[e]===t)return e;return-1};i=t("underscore"),o=t("./transform"),a=t("../../core/properties"),s=t("../../core/logging").logger,n=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return l(e,t),e.prototype.initialize=function(t,r){return e.__super__.initialize.call(this,t,r),this._x_sorted=[],this._y_sorted=[],this._sorted_dirty=!0,this.on("change",function(){return this._sorted_dirty=!0})},e.define({x:[a.Any],y:[a.Any],data:[a.Any],clip:[a.Bool,!0]}),e.prototype.sort=function(t){var e,r,n,o,i,s,a,l,u,p,h;if(null==t&&(t=!1),typeof this.x!=typeof this.y)throw Error("The parameters for x and y must be of the same type, either both strings which define a column in the data source or both arrays of the same length");if("string"==typeof this.x&&null===this.data)throw Error("If the x and y parameters are not specified as an array, the data parameter is reqired.");if(this._sorted_dirty!==!1){if(p=[],h=[],"string"==typeof this.x){if(r=this.data,e=r.columns(),a=this.x,c.call(e,a)<0)throw Error("The x parameter does not correspond to a valid column name defined in the data parameter");if(l=this.y,c.call(e,l)<0)throw Error("The x parameter does not correspond to a valid column name defined in the data parameter");p=r.get_column(this.x),h=r.get_column(this.y)}else p=this.x,h=this.y;if(p.length!==h.length)throw Error("The length for x and y do not match");
|
|
if(p.length<2)throw Error("x and y must have at least two elements to support interpolation");s=[];for(o in p)s.push({x:p[o],y:h[o]});for(t===!0?s.sort(function(t,e){var r,n;return null!=(r=t.x<e.x)?r:-{1:null!=(n=t.x===e.x)?n:{0:1}}}):s.sort(function(t,e){var r,n;return null!=(r=t.x>e.x)?r:-{1:null!=(n=t.x===e.x)?n:{0:1}}}),i=n=0,u=s.length-1;0<=u?n<=u:n>=u;i=0<=u?++n:--n)this._x_sorted[i]=s[i].x,this._y_sorted[i]=s[i].y;return this._sorted_dirty=!1}},e}(o.Model),e.exports={Model:n}},{"../../core/logging":"core/logging","../../core/properties":"core/properties","./transform":"models/transforms/transform",underscore:"underscore"}],"models/transforms/jitter":[function(t,e,r){var n,o,i,s,a,l=function(t,e){function r(){this.constructor=t}for(var n in e)u.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},u={}.hasOwnProperty;i=t("underscore"),o=t("./transform"),a=t("../../core/properties"),s=t("../../core/util/math"),n=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return l(e,t),e.define({mean:[a.Number,0],width:[a.Number,1],distribution:[a.Distribution,"uniform"]}),e.prototype.compute=function(t){return"uniform"===this.distribution?t+this.mean+(s.random()-.5)*this.width:"normal"===this.distribution?t+s.rnorm(this.mean,this.width):void 0},e.prototype.v_compute=function(t){var e,r,n,o,i;for(o=new Float64Array(t.length),r=e=0,n=t.length;e<n;r=++e)i=t[r],o[r]=this.compute(i);return o},e}(o.Model),e.exports={Model:n}},{"../../core/properties":"core/properties","../../core/util/math":"core/util/math","./transform":"models/transforms/transform",underscore:"underscore"}],"models/transforms/linear_interpolator":[function(t,e,r){var n,o,i,s,a=function(t,e){function r(){this.constructor=t}for(var n in e)l.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},l={}.hasOwnProperty;s=t("underscore"),i=t("./transform"),n=t("./interpolator"),o=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return a(e,t),e.prototype.compute=function(t){var e,r,n,o,i,a,l;if(this.sort(e=!1),this.clip===!0){if(t<this._x_sorted[0]||t>this._x_sorted[this._x_sorted.length-1])return null}else{if(t<this._x_sorted[0])return this._y_sorted[0];if(t>this._x_sorted[this._x_sorted.length-1])return this._y_sorted[this._y_sorted.length-1]}return r=s.findLastIndex(this._x_sorted,function(e){return t>=e}),o=this._x_sorted[r],i=this._x_sorted[r+1],a=this._y_sorted[r],l=this._y_sorted[r+1],n=a+(t-o)/(i-o)*(l-a)},e.prototype.v_compute=function(t){var e,r,n,o,i;for(o=new Float64Array(t.length),r=e=0,n=t.length;e<n;r=++e)i=t[r],o[r]=this.compute(i);return o},e}(n.Model),e.exports={Model:o}},{"./interpolator":"models/transforms/interpolator","./transform":"models/transforms/transform",underscore:"underscore"}],"models/transforms/step_interpolator":[function(t,e,r){var n,o,i,s,a,l=function(t,e){function r(){this.constructor=t}for(var n in e)u.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},u={}.hasOwnProperty;s=t("underscore"),i=t("./transform"),n=t("./interpolator"),a=t("../../core/properties"),o=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return l(e,t),e.define({mode:[a.TransformStepMode,"after"]}),e.prototype.compute=function(t){var e,r,n,o,i,a;if(this.sort(e=!1),this.clip===!0){if(t<this._x_sorted[0]||t>this._x_sorted[this._x_sorted.length-1])return null}else{if(t<this._x_sorted[0])return this._y_sorted[0];if(t>this._x_sorted[this._x_sorted.length-1])return this._y_sorted[this._y_sorted.length-1]}return n=-1,"after"===this.mode&&(n=s.findLastIndex(this._x_sorted,function(e){return t>=e})),"before"===this.mode&&(n=s.findIndex(this._x_sorted,function(e){return t<=e})),"center"===this.mode&&(r=function(){var e,r,n,o;for(n=this._x_sorted,o=[],e=0,r=n.length;e<r;e++)a=n[e],o.push(Math.abs(a-t));return o}.call(this),o=s.min(r),n=s.findIndex(r,function(t){return o===t})),i=n!==-1?this._y_sorted[n]:null},e.prototype.v_compute=function(t){var e,r,n,o,i;for(o=new Float64Array(t.length),r=e=0,n=t.length;e<n;r=++e)i=t[r],o[r]=this.compute(i);return o},e}(n.Model),e.exports={Model:o}},{"../../core/properties":"core/properties","./interpolator":"models/transforms/interpolator","./transform":"models/transforms/transform",underscore:"underscore"}],"models/transforms/transform":[function(t,e,r){var n,o,i,s=function(t,e){function r(){this.constructor=t}for(var n in e)a.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},a={}.hasOwnProperty;i=t("underscore"),n=t("../../model"),o=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return s(e,t),e}(n),e.exports={Model:o}},{"../../model":"model",underscore:"underscore"}],safely:[function(t,e,r){var n,o;n=function(t){var e,r,n,o,i,s;return r=document.createElement("div"),r.style["background-color"]="#f2dede",r.style.border="1px solid #a94442",r.style["border-radius"]="4px",r.style.display="inline-block",r.style["font-family"]="sans-serif",r.style["margin-top"]="5px",r.style["min-width"]="200px",r.style.padding="5px 5px 5px 10px",n=document.createElement("span"),n.style["background-color"]="#a94442",n.style["border-radius"]="0px 4px 0px 0px",n.style.color="white",n.style.cursor="pointer",n.style["float"]="right",n.style["font-size"]="0.8em",n.style.margin="-6px -6px 0px 0px",n.style.padding="2px 5px 4px 5px",n.title="close",n.setAttribute("aria-label","close"),n.appendChild(document.createTextNode("x")),n.addEventListener("click",function(){return e.removeChild(r)}),s=document.createElement("h3"),s.style.color="#a94442",s.style.margin="8px 0px 0px 0px",s.style.padding="0px",s.appendChild(document.createTextNode("Bokeh Error")),o=document.createElement("pre"),o.style["white-space"]="unset",o.appendChild(document.createTextNode(null!=(i=t.message)?i:t)),r.appendChild(n),r.appendChild(s),r.appendChild(o),e=document.getElementsByTagName("body")[0],e.insertBefore(r,e.firstChild)},o=function(t,e){var r,o;null==e&&(e=!1);try{return t()}catch(o){if(r=o,n(r),!e)throw r}},e.exports=o},{}],version:[function(t,e,r){var n;n="0.12.3",e.exports=n},{}],"es6-promise":[function(e,r,n){(function(n,o){/*!
|
|
* @overview es6-promise - a tiny implementation of Promises/A+.
|
|
* @copyright Copyright (c) 2014 Yehuda Katz, Tom Dale, Stefan Penner and contributors (Conversion to ES6 API by Jake Archibald)
|
|
* @license Licensed under MIT license
|
|
* See https://raw.githubusercontent.com/jakearchibald/es6-promise/master/LICENSE
|
|
* @version 3.0.2
|
|
*/
|
|
(function(){"use strict";function i(t){return"function"==typeof t||"object"==typeof t&&null!==t}function s(t){return"function"==typeof t}function a(t){return"object"==typeof t&&null!==t}function l(t){H=t}function u(t){J=t}function c(){return function(){n.nextTick(f)}}function p(){return function(){Y(f)}}function h(){var t=0,e=new Z(f),r=document.createTextNode("");return e.observe(r,{characterData:!0}),function(){r.data=t=++t%2}}function _(){var t=new MessageChannel;return t.port1.onmessage=f,function(){t.port2.postMessage(0)}}function d(){return function(){setTimeout(f,1)}}function f(){for(var t=0;t<W;t+=2){var e=rt[t],r=rt[t+1];e(r),rt[t]=void 0,rt[t+1]=void 0}W=0}function m(){try{var t=e,r=t("vertx");return Y=r.runOnLoop||r.runOnContext,p()}catch(n){return d()}}function g(){}function y(){return new TypeError("You cannot resolve a promise with itself")}function v(){return new TypeError("A promises callback cannot return that same promise.")}function b(t){try{return t.then}catch(e){return st.error=e,st}}function x(t,e,r,n){try{t.call(e,r,n)}catch(o){return o}}function w(t,e,r){J(function(t){var n=!1,o=x(r,e,function(r){n||(n=!0,e!==r?T(t,r):z(t,r))},function(e){n||(n=!0,E(t,e))},"Settle: "+(t._label||" unknown promise"));!n&&o&&(n=!0,E(t,o))},t)}function k(t,e){e._state===ot?z(t,e._result):e._state===it?E(t,e._result):A(e,void 0,function(e){T(t,e)},function(e){E(t,e)})}function M(t,e){if(e.constructor===t.constructor)k(t,e);else{var r=b(e);r===st?E(t,st.error):void 0===r?z(t,e):s(r)?w(t,e,r):z(t,e)}}function T(t,e){t===e?E(t,y()):i(e)?M(t,e):z(t,e)}function S(t){t._onerror&&t._onerror(t._result),C(t)}function z(t,e){t._state===nt&&(t._result=e,t._state=ot,0!==t._subscribers.length&&J(C,t))}function E(t,e){t._state===nt&&(t._state=it,t._result=e,J(S,t))}function A(t,e,r,n){var o=t._subscribers,i=o.length;t._onerror=null,o[i]=e,o[i+ot]=r,o[i+it]=n,0===i&&t._state&&J(C,t)}function C(t){var e=t._subscribers,r=t._state;if(0!==e.length){for(var n,o,i=t._result,s=0;s<e.length;s+=3)n=e[s],o=e[s+r],n?N(r,n,o,i):o(i);t._subscribers.length=0}}function j(){this.error=null}function P(t,e){try{return t(e)}catch(r){return at.error=r,at}}function N(t,e,r,n){var o,i,a,l,u=s(r);if(u){if(o=P(r,n),o===at?(l=!0,i=o.error,o=null):a=!0,e===o)return void E(e,v())}else o=n,a=!0;e._state!==nt||(u&&a?T(e,o):l?E(e,i):t===ot?z(e,o):t===it&&E(e,o))}function O(t,e){try{e(function(e){T(t,e)},function(e){E(t,e)})}catch(r){E(t,r)}}function D(t,e){var r=this;r._instanceConstructor=t,r.promise=new t(g),r._validateInput(e)?(r._input=e,r.length=e.length,r._remaining=e.length,r._init(),0===r.length?z(r.promise,r._result):(r.length=r.length||0,r._enumerate(),0===r._remaining&&z(r.promise,r._result))):E(r.promise,r._validationError())}function F(t){return new lt(this,t).promise}function q(t){function e(t){T(o,t)}function r(t){E(o,t)}var n=this,o=new n(g);if(!$(t))return E(o,new TypeError("You must pass an array to race.")),o;for(var i=t.length,s=0;o._state===nt&&s<i;s++)A(n.resolve(t[s]),void 0,e,r);return o}function I(t){var e=this;if(t&&"object"==typeof t&&t.constructor===e)return t;var r=new e(g);return T(r,t),r}function R(t){var e=this,r=new e(g);return E(r,t),r}function L(){throw new TypeError("You must pass a resolver function as the first argument to the promise constructor")}function B(){throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.")}function V(t){this._id=_t++,this._state=void 0,this._result=void 0,this._subscribers=[],g!==t&&(s(t)||L(),this instanceof V||B(),O(this,t))}function G(){var t;if("undefined"!=typeof o)t=o;else if("undefined"!=typeof self)t=self;else try{t=Function("return this")()}catch(e){throw new Error("polyfill failed because global object is unavailable in this environment")}var r=t.Promise;r&&"[object Promise]"===Object.prototype.toString.call(r.resolve())&&!r.cast||(t.Promise=dt)}var U;U=Array.isArray?Array.isArray:function(t){return"[object Array]"===Object.prototype.toString.call(t)};var Y,H,X,$=U,W=0,J=({}.toString,function(t,e){rt[W]=t,rt[W+1]=e,W+=2,2===W&&(H?H(f):X())}),K="undefined"!=typeof window?window:void 0,Q=K||{},Z=Q.MutationObserver||Q.WebKitMutationObserver,tt="undefined"!=typeof n&&"[object process]"==={}.toString.call(n),et="undefined"!=typeof Uint8ClampedArray&&"undefined"!=typeof importScripts&&"undefined"!=typeof MessageChannel,rt=new Array(1e3);X=tt?c():Z?h():et?_():void 0===K&&"function"==typeof e?m():d();var nt=void 0,ot=1,it=2,st=new j,at=new j;D.prototype._validateInput=function(t){return $(t)},D.prototype._validationError=function(){return new Error("Array Methods must be provided an Array")},D.prototype._init=function(){this._result=new Array(this.length)};var lt=D;D.prototype._enumerate=function(){for(var t=this,e=t.length,r=t.promise,n=t._input,o=0;r._state===nt&&o<e;o++)t._eachEntry(n[o],o)},D.prototype._eachEntry=function(t,e){var r=this,n=r._instanceConstructor;a(t)?t.constructor===n&&t._state!==nt?(t._onerror=null,r._settledAt(t._state,e,t._result)):r._willSettleAt(n.resolve(t),e):(r._remaining--,r._result[e]=t)},D.prototype._settledAt=function(t,e,r){var n=this,o=n.promise;o._state===nt&&(n._remaining--,t===it?E(o,r):n._result[e]=r),0===n._remaining&&z(o,n._result)},D.prototype._willSettleAt=function(t,e){var r=this;A(t,void 0,function(t){r._settledAt(ot,e,t)},function(t){r._settledAt(it,e,t)})};var ut=F,ct=q,pt=I,ht=R,_t=0,dt=V;V.all=ut,V.race=ct,V.resolve=pt,V.reject=ht,V._setScheduler=l,V._setAsap=u,V._asap=J,V.prototype={constructor:V,then:function(t,e){var r=this,n=r._state;if(n===ot&&!t||n===it&&!e)return this;var o=new this.constructor(g),i=r._result;if(n){var s=arguments[n-1];J(function(){N(n,o,s,i)})}else A(r,o,t,e);return o},"catch":function(t){return this.then(null,t)}};var ft=G,mt={Promise:dt,polyfill:ft};"function"==typeof t&&t.amd?t(function(){return mt}):"undefined"!=typeof r&&r.exports?r.exports=mt:"undefined"!=typeof this&&(this.ES6Promise=mt),ft()}).call(this)}).call(this,e("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{_process:"_process"}],hammerjs:[function(e,r,n){/*! Hammer.JS - v2.0.7 - 2016-04-22
|
|
* http://hammerjs.github.io/
|
|
*
|
|
* Copyright (c) 2016 Jorik Tangelder;
|
|
* Licensed under the MIT license */
|
|
!function(e,n,o,i){"use strict";function s(t,e,r){return setTimeout(p(t,r),e)}function a(t,e,r){return!!Array.isArray(t)&&(l(t,r[e],r),!0)}function l(t,e,r){var n;if(t)if(t.forEach)t.forEach(e,r);else if(t.length!==i)for(n=0;n<t.length;)e.call(r,t[n],n,t),n++;else for(n in t)t.hasOwnProperty(n)&&e.call(r,t[n],n,t)}function u(t,r,n){var o="DEPRECATED METHOD: "+r+"\n"+n+" AT \n";return function(){var r=new Error("get-stack-trace"),n=r&&r.stack?r.stack.replace(/^[^\(]+?[\n$]/gm,"").replace(/^\s+at\s+/gm,"").replace(/^Object.<anonymous>\s*\(/gm,"{anonymous}()@"):"Unknown Stack Trace",i=e.console&&(e.console.warn||e.console.log);return i&&i.call(e.console,o,n),t.apply(this,arguments)}}function c(t,e,r){var n,o=e.prototype;n=t.prototype=Object.create(o),n.constructor=t,n._super=o,r&&_t(n,r)}function p(t,e){return function(){return t.apply(e,arguments)}}function h(t,e){return typeof t==mt?t.apply(e?e[0]||i:i,e):t}function _(t,e){return t===i?e:t}function d(t,e,r){l(y(e),function(e){t.addEventListener(e,r,!1)})}function f(t,e,r){l(y(e),function(e){t.removeEventListener(e,r,!1)})}function m(t,e){for(;t;){if(t==e)return!0;t=t.parentNode}return!1}function g(t,e){return t.indexOf(e)>-1}function y(t){return t.trim().split(/\s+/g)}function v(t,e,r){if(t.indexOf&&!r)return t.indexOf(e);for(var n=0;n<t.length;){if(r&&t[n][r]==e||!r&&t[n]===e)return n;n++}return-1}function b(t){return Array.prototype.slice.call(t,0)}function x(t,e,r){for(var n=[],o=[],i=0;i<t.length;){var s=e?t[i][e]:t[i];v(o,s)<0&&n.push(t[i]),o[i]=s,i++}return r&&(n=e?n.sort(function(t,r){return t[e]>r[e]}):n.sort()),n}function w(t,e){for(var r,n,o=e[0].toUpperCase()+e.slice(1),s=0;s<dt.length;){if(r=dt[s],n=r?r+o:e,n in t)return n;s++}return i}function k(){return wt++}function M(t){var r=t.ownerDocument||t;return r.defaultView||r.parentWindow||e}function T(t,e){var r=this;this.manager=t,this.callback=e,this.element=t.element,this.target=t.options.inputTarget,this.domHandler=function(e){h(t.options.enable,[t])&&r.handler(e)},this.init()}function S(t){var e,r=t.options.inputClass;return new(e=r?r:Tt?L:St?G:Mt?Y:R)(t,z)}function z(t,e,r){var n=r.pointers.length,o=r.changedPointers.length,i=e&Pt&&n-o===0,s=e&(Ot|Dt)&&n-o===0;r.isFirst=!!i,r.isFinal=!!s,i&&(t.session={}),r.eventType=e,E(t,r),t.emit("hammer.input",r),t.recognize(r),t.session.prevInput=r}function E(t,e){var r=t.session,n=e.pointers,o=n.length;r.firstInput||(r.firstInput=j(e)),o>1&&!r.firstMultiple?r.firstMultiple=j(e):1===o&&(r.firstMultiple=!1);var i=r.firstInput,s=r.firstMultiple,a=s?s.center:i.center,l=e.center=P(n);e.timeStamp=vt(),e.deltaTime=e.timeStamp-i.timeStamp,e.angle=F(a,l),e.distance=D(a,l),A(r,e),e.offsetDirection=O(e.deltaX,e.deltaY);var u=N(e.deltaTime,e.deltaX,e.deltaY);e.overallVelocityX=u.x,e.overallVelocityY=u.y,e.overallVelocity=yt(u.x)>yt(u.y)?u.x:u.y,e.scale=s?I(s.pointers,n):1,e.rotation=s?q(s.pointers,n):0,e.maxPointers=r.prevInput?e.pointers.length>r.prevInput.maxPointers?e.pointers.length:r.prevInput.maxPointers:e.pointers.length,C(r,e);var c=t.element;m(e.srcEvent.target,c)&&(c=e.srcEvent.target),e.target=c}function A(t,e){var r=e.center,n=t.offsetDelta||{},o=t.prevDelta||{},i=t.prevInput||{};e.eventType!==Pt&&i.eventType!==Ot||(o=t.prevDelta={x:i.deltaX||0,y:i.deltaY||0},n=t.offsetDelta={x:r.x,y:r.y}),e.deltaX=o.x+(r.x-n.x),e.deltaY=o.y+(r.y-n.y)}function C(t,e){var r,n,o,s,a=t.lastInterval||e,l=e.timeStamp-a.timeStamp;if(e.eventType!=Dt&&(l>jt||a.velocity===i)){var u=e.deltaX-a.deltaX,c=e.deltaY-a.deltaY,p=N(l,u,c);n=p.x,o=p.y,r=yt(p.x)>yt(p.y)?p.x:p.y,s=O(u,c),t.lastInterval=e}else r=a.velocity,n=a.velocityX,o=a.velocityY,s=a.direction;e.velocity=r,e.velocityX=n,e.velocityY=o,e.direction=s}function j(t){for(var e=[],r=0;r<t.pointers.length;)e[r]={clientX:gt(t.pointers[r].clientX),clientY:gt(t.pointers[r].clientY)},r++;return{timeStamp:vt(),pointers:e,center:P(e),deltaX:t.deltaX,deltaY:t.deltaY}}function P(t){var e=t.length;if(1===e)return{x:gt(t[0].clientX),y:gt(t[0].clientY)};for(var r=0,n=0,o=0;o<e;)r+=t[o].clientX,n+=t[o].clientY,o++;return{x:gt(r/e),y:gt(n/e)}}function N(t,e,r){return{x:e/t||0,y:r/t||0}}function O(t,e){return t===e?Ft:yt(t)>=yt(e)?t<0?qt:It:e<0?Rt:Lt}function D(t,e,r){r||(r=Ut);var n=e[r[0]]-t[r[0]],o=e[r[1]]-t[r[1]];return Math.sqrt(n*n+o*o)}function F(t,e,r){r||(r=Ut);var n=e[r[0]]-t[r[0]],o=e[r[1]]-t[r[1]];return 180*Math.atan2(o,n)/Math.PI}function q(t,e){return F(e[1],e[0],Yt)+F(t[1],t[0],Yt)}function I(t,e){return D(e[0],e[1],Yt)/D(t[0],t[1],Yt)}function R(){this.evEl=Xt,this.evWin=$t,this.pressed=!1,T.apply(this,arguments)}function L(){this.evEl=Kt,this.evWin=Qt,T.apply(this,arguments),this.store=this.manager.session.pointerEvents=[]}function B(){this.evTarget=te,this.evWin=ee,this.started=!1,T.apply(this,arguments)}function V(t,e){var r=b(t.touches),n=b(t.changedTouches);return e&(Ot|Dt)&&(r=x(r.concat(n),"identifier",!0)),[r,n]}function G(){this.evTarget=ne,this.targetIds={},T.apply(this,arguments)}function U(t,e){var r=b(t.touches),n=this.targetIds;if(e&(Pt|Nt)&&1===r.length)return n[r[0].identifier]=!0,[r,r];var o,i,s=b(t.changedTouches),a=[],l=this.target;if(i=r.filter(function(t){return m(t.target,l)}),e===Pt)for(o=0;o<i.length;)n[i[o].identifier]=!0,o++;for(o=0;o<s.length;)n[s[o].identifier]&&a.push(s[o]),e&(Ot|Dt)&&delete n[s[o].identifier],o++;return a.length?[x(i.concat(a),"identifier",!0),a]:void 0}function Y(){T.apply(this,arguments);var t=p(this.handler,this);this.touch=new G(this.manager,t),this.mouse=new R(this.manager,t),this.primaryTouch=null,this.lastTouches=[]}function H(t,e){t&Pt?(this.primaryTouch=e.changedPointers[0].identifier,X.call(this,e)):t&(Ot|Dt)&&X.call(this,e)}function X(t){var e=t.changedPointers[0];if(e.identifier===this.primaryTouch){var r={x:e.clientX,y:e.clientY};this.lastTouches.push(r);var n=this.lastTouches,o=function(){var t=n.indexOf(r);t>-1&&n.splice(t,1)};setTimeout(o,oe)}}function $(t){for(var e=t.srcEvent.clientX,r=t.srcEvent.clientY,n=0;n<this.lastTouches.length;n++){var o=this.lastTouches[n],i=Math.abs(e-o.x),s=Math.abs(r-o.y);if(i<=ie&&s<=ie)return!0}return!1}function W(t,e){this.manager=t,this.set(e)}function J(t){if(g(t,pe))return pe;var e=g(t,he),r=g(t,_e);return e&&r?pe:e||r?e?he:_e:g(t,ce)?ce:ue}function K(){if(!ae)return!1;var t={},r=e.CSS&&e.CSS.supports;return["auto","manipulation","pan-y","pan-x","pan-x pan-y","none"].forEach(function(n){t[n]=!r||e.CSS.supports("touch-action",n)}),t}function Q(t){this.options=_t({},this.defaults,t||{}),this.id=k(),this.manager=null,this.options.enable=_(this.options.enable,!0),this.state=fe,this.simultaneous={},this.requireFail=[]}function Z(t){return t&be?"cancel":t&ye?"end":t&ge?"move":t&me?"start":""}function tt(t){return t==Lt?"down":t==Rt?"up":t==qt?"left":t==It?"right":""}function et(t,e){var r=e.manager;return r?r.get(t):t}function rt(){Q.apply(this,arguments)}function nt(){rt.apply(this,arguments),this.pX=null,this.pY=null}function ot(){rt.apply(this,arguments)}function it(){Q.apply(this,arguments),this._timer=null,this._input=null}function st(){rt.apply(this,arguments)}function at(){rt.apply(this,arguments)}function lt(){Q.apply(this,arguments),this.pTime=!1,this.pCenter=!1,this._timer=null,this._input=null,this.count=0}function ut(t,e){return e=e||{},e.recognizers=_(e.recognizers,ut.defaults.preset),new ct(t,e)}function ct(t,e){this.options=_t({},ut.defaults,e||{}),this.options.inputTarget=this.options.inputTarget||t,this.handlers={},this.session={},this.recognizers=[],this.oldCssProps={},this.element=t,this.input=S(this),this.touchAction=new W(this,this.options.touchAction),pt(this,!0),l(this.options.recognizers,function(t){var e=this.add(new t[0](t[1]));t[2]&&e.recognizeWith(t[2]),t[3]&&e.requireFailure(t[3])},this)}function pt(t,e){var r=t.element;if(r.style){var n;l(t.options.cssProps,function(o,i){n=w(r.style,i),e?(t.oldCssProps[n]=r.style[n],r.style[n]=o):r.style[n]=t.oldCssProps[n]||""}),e||(t.oldCssProps={})}}function ht(t,e){var r=n.createEvent("Event");r.initEvent(t,!0,!0),r.gesture=e,e.target.dispatchEvent(r)}var _t,dt=["","webkit","Moz","MS","ms","o"],ft=n.createElement("div"),mt="function",gt=Math.round,yt=Math.abs,vt=Date.now;_t="function"!=typeof Object.assign?function(t){if(t===i||null===t)throw new TypeError("Cannot convert undefined or null to object");for(var e=Object(t),r=1;r<arguments.length;r++){var n=arguments[r];if(n!==i&&null!==n)for(var o in n)n.hasOwnProperty(o)&&(e[o]=n[o])}return e}:Object.assign;var bt=u(function(t,e,r){for(var n=Object.keys(e),o=0;o<n.length;)(!r||r&&t[n[o]]===i)&&(t[n[o]]=e[n[o]]),o++;return t},"extend","Use `assign`."),xt=u(function(t,e){return bt(t,e,!0)},"merge","Use `assign`."),wt=1,kt=/mobile|tablet|ip(ad|hone|od)|android/i,Mt="ontouchstart"in e,Tt=w(e,"PointerEvent")!==i,St=Mt&&kt.test(navigator.userAgent),zt="touch",Et="pen",At="mouse",Ct="kinect",jt=25,Pt=1,Nt=2,Ot=4,Dt=8,Ft=1,qt=2,It=4,Rt=8,Lt=16,Bt=qt|It,Vt=Rt|Lt,Gt=Bt|Vt,Ut=["x","y"],Yt=["clientX","clientY"];T.prototype={handler:function(){},init:function(){this.evEl&&d(this.element,this.evEl,this.domHandler),this.evTarget&&d(this.target,this.evTarget,this.domHandler),this.evWin&&d(M(this.element),this.evWin,this.domHandler)},destroy:function(){this.evEl&&f(this.element,this.evEl,this.domHandler),this.evTarget&&f(this.target,this.evTarget,this.domHandler),this.evWin&&f(M(this.element),this.evWin,this.domHandler)}};var Ht={mousedown:Pt,mousemove:Nt,mouseup:Ot},Xt="mousedown",$t="mousemove mouseup";c(R,T,{handler:function(t){var e=Ht[t.type];e&Pt&&0===t.button&&(this.pressed=!0),e&Nt&&1!==t.which&&(e=Ot),this.pressed&&(e&Ot&&(this.pressed=!1),this.callback(this.manager,e,{pointers:[t],changedPointers:[t],pointerType:At,srcEvent:t}))}});var Wt={pointerdown:Pt,pointermove:Nt,pointerup:Ot,pointercancel:Dt,pointerout:Dt},Jt={2:zt,3:Et,4:At,5:Ct},Kt="pointerdown",Qt="pointermove pointerup pointercancel";e.MSPointerEvent&&!e.PointerEvent&&(Kt="MSPointerDown",Qt="MSPointerMove MSPointerUp MSPointerCancel"),c(L,T,{handler:function(t){var e=this.store,r=!1,n=t.type.toLowerCase().replace("ms",""),o=Wt[n],i=Jt[t.pointerType]||t.pointerType,s=i==zt,a=v(e,t.pointerId,"pointerId");o&Pt&&(0===t.button||s)?a<0&&(e.push(t),a=e.length-1):o&(Ot|Dt)&&(r=!0),a<0||(e[a]=t,this.callback(this.manager,o,{pointers:e,changedPointers:[t],pointerType:i,srcEvent:t}),r&&e.splice(a,1))}});var Zt={touchstart:Pt,touchmove:Nt,touchend:Ot,touchcancel:Dt},te="touchstart",ee="touchstart touchmove touchend touchcancel";c(B,T,{handler:function(t){var e=Zt[t.type];if(e===Pt&&(this.started=!0),this.started){var r=V.call(this,t,e);e&(Ot|Dt)&&r[0].length-r[1].length===0&&(this.started=!1),this.callback(this.manager,e,{pointers:r[0],changedPointers:r[1],pointerType:zt,srcEvent:t})}}});var re={touchstart:Pt,touchmove:Nt,touchend:Ot,touchcancel:Dt},ne="touchstart touchmove touchend touchcancel";c(G,T,{handler:function(t){var e=re[t.type],r=U.call(this,t,e);r&&this.callback(this.manager,e,{pointers:r[0],changedPointers:r[1],pointerType:zt,srcEvent:t})}});var oe=2500,ie=25;c(Y,T,{handler:function(t,e,r){var n=r.pointerType==zt,o=r.pointerType==At;if(!(o&&r.sourceCapabilities&&r.sourceCapabilities.firesTouchEvents)){if(n)H.call(this,e,r);else if(o&&$.call(this,r))return;this.callback(t,e,r)}},destroy:function(){this.touch.destroy(),this.mouse.destroy()}});var se=w(ft.style,"touchAction"),ae=se!==i,le="compute",ue="auto",ce="manipulation",pe="none",he="pan-x",_e="pan-y",de=K();W.prototype={set:function(t){t==le&&(t=this.compute()),ae&&this.manager.element.style&&de[t]&&(this.manager.element.style[se]=t),this.actions=t.toLowerCase().trim()},update:function(){this.set(this.manager.options.touchAction)},compute:function(){var t=[];return l(this.manager.recognizers,function(e){h(e.options.enable,[e])&&(t=t.concat(e.getTouchAction()))}),J(t.join(" "))},preventDefaults:function(t){var e=t.srcEvent,r=t.offsetDirection;if(this.manager.session.prevented)return void e.preventDefault();var n=this.actions,o=g(n,pe)&&!de[pe],i=g(n,_e)&&!de[_e],s=g(n,he)&&!de[he];if(o){var a=1===t.pointers.length,l=t.distance<2,u=t.deltaTime<250;if(a&&l&&u)return}return s&&i?void 0:o||i&&r&Bt||s&&r&Vt?this.preventSrc(e):void 0},preventSrc:function(t){this.manager.session.prevented=!0,t.preventDefault()}};var fe=1,me=2,ge=4,ye=8,ve=ye,be=16,xe=32;Q.prototype={defaults:{},set:function(t){return _t(this.options,t),this.manager&&this.manager.touchAction.update(),this},recognizeWith:function(t){if(a(t,"recognizeWith",this))return this;var e=this.simultaneous;return t=et(t,this),e[t.id]||(e[t.id]=t,t.recognizeWith(this)),this},dropRecognizeWith:function(t){return a(t,"dropRecognizeWith",this)?this:(t=et(t,this),delete this.simultaneous[t.id],this)},requireFailure:function(t){if(a(t,"requireFailure",this))return this;var e=this.requireFail;return t=et(t,this),v(e,t)===-1&&(e.push(t),t.requireFailure(this)),this},dropRequireFailure:function(t){if(a(t,"dropRequireFailure",this))return this;t=et(t,this);var e=v(this.requireFail,t);return e>-1&&this.requireFail.splice(e,1),this},hasRequireFailures:function(){return this.requireFail.length>0},canRecognizeWith:function(t){return!!this.simultaneous[t.id]},emit:function(t){function e(e){r.manager.emit(e,t)}var r=this,n=this.state;n<ye&&e(r.options.event+Z(n)),e(r.options.event),t.additionalEvent&&e(t.additionalEvent),n>=ye&&e(r.options.event+Z(n))},tryEmit:function(t){return this.canEmit()?this.emit(t):void(this.state=xe)},canEmit:function(){for(var t=0;t<this.requireFail.length;){if(!(this.requireFail[t].state&(xe|fe)))return!1;t++}return!0},recognize:function(t){var e=_t({},t);return h(this.options.enable,[this,e])?(this.state&(ve|be|xe)&&(this.state=fe),this.state=this.process(e),void(this.state&(me|ge|ye|be)&&this.tryEmit(e))):(this.reset(),void(this.state=xe))},process:function(t){},getTouchAction:function(){},reset:function(){}},c(rt,Q,{defaults:{pointers:1},attrTest:function(t){var e=this.options.pointers;return 0===e||t.pointers.length===e},process:function(t){var e=this.state,r=t.eventType,n=e&(me|ge),o=this.attrTest(t);return n&&(r&Dt||!o)?e|be:n||o?r&Ot?e|ye:e&me?e|ge:me:xe}}),c(nt,rt,{defaults:{event:"pan",threshold:10,pointers:1,direction:Gt},getTouchAction:function(){var t=this.options.direction,e=[];return t&Bt&&e.push(_e),t&Vt&&e.push(he),e},directionTest:function(t){var e=this.options,r=!0,n=t.distance,o=t.direction,i=t.deltaX,s=t.deltaY;return o&e.direction||(e.direction&Bt?(o=0===i?Ft:i<0?qt:It,r=i!=this.pX,n=Math.abs(t.deltaX)):(o=0===s?Ft:s<0?Rt:Lt,r=s!=this.pY,n=Math.abs(t.deltaY))),t.direction=o,r&&n>e.threshold&&o&e.direction},attrTest:function(t){return rt.prototype.attrTest.call(this,t)&&(this.state&me||!(this.state&me)&&this.directionTest(t))},emit:function(t){this.pX=t.deltaX,this.pY=t.deltaY;var e=tt(t.direction);e&&(t.additionalEvent=this.options.event+e),this._super.emit.call(this,t)}}),c(ot,rt,{defaults:{event:"pinch",threshold:0,pointers:2},getTouchAction:function(){return[pe]},attrTest:function(t){return this._super.attrTest.call(this,t)&&(Math.abs(t.scale-1)>this.options.threshold||this.state&me)},emit:function(t){if(1!==t.scale){var e=t.scale<1?"in":"out";t.additionalEvent=this.options.event+e}this._super.emit.call(this,t)}}),c(it,Q,{defaults:{event:"press",pointers:1,time:251,threshold:9},getTouchAction:function(){return[ue]},process:function(t){var e=this.options,r=t.pointers.length===e.pointers,n=t.distance<e.threshold,o=t.deltaTime>e.time;if(this._input=t,!n||!r||t.eventType&(Ot|Dt)&&!o)this.reset();else if(t.eventType&Pt)this.reset(),this._timer=s(function(){this.state=ve,this.tryEmit()},e.time,this);else if(t.eventType&Ot)return ve;return xe},reset:function(){clearTimeout(this._timer)},emit:function(t){this.state===ve&&(t&&t.eventType&Ot?this.manager.emit(this.options.event+"up",t):(this._input.timeStamp=vt(),this.manager.emit(this.options.event,this._input)))}}),c(st,rt,{defaults:{event:"rotate",threshold:0,pointers:2},getTouchAction:function(){return[pe]},attrTest:function(t){return this._super.attrTest.call(this,t)&&(Math.abs(t.rotation)>this.options.threshold||this.state&me)}}),c(at,rt,{defaults:{event:"swipe",threshold:10,velocity:.3,direction:Bt|Vt,pointers:1},getTouchAction:function(){return nt.prototype.getTouchAction.call(this)},attrTest:function(t){var e,r=this.options.direction;return r&(Bt|Vt)?e=t.overallVelocity:r&Bt?e=t.overallVelocityX:r&Vt&&(e=t.overallVelocityY),this._super.attrTest.call(this,t)&&r&t.offsetDirection&&t.distance>this.options.threshold&&t.maxPointers==this.options.pointers&&yt(e)>this.options.velocity&&t.eventType&Ot},emit:function(t){var e=tt(t.offsetDirection);e&&this.manager.emit(this.options.event+e,t),this.manager.emit(this.options.event,t)}}),c(lt,Q,{defaults:{event:"tap",pointers:1,taps:1,interval:300,time:250,threshold:9,posThreshold:10},getTouchAction:function(){return[ce]},process:function(t){var e=this.options,r=t.pointers.length===e.pointers,n=t.distance<e.threshold,o=t.deltaTime<e.time;if(this.reset(),t.eventType&Pt&&0===this.count)return this.failTimeout();if(n&&o&&r){if(t.eventType!=Ot)return this.failTimeout();var i=!this.pTime||t.timeStamp-this.pTime<e.interval,a=!this.pCenter||D(this.pCenter,t.center)<e.posThreshold;this.pTime=t.timeStamp,this.pCenter=t.center,a&&i?this.count+=1:this.count=1,this._input=t;var l=this.count%e.taps;if(0===l)return this.hasRequireFailures()?(this._timer=s(function(){this.state=ve,this.tryEmit()},e.interval,this),me):ve}return xe},failTimeout:function(){return this._timer=s(function(){this.state=xe},this.options.interval,this),xe},reset:function(){clearTimeout(this._timer)},emit:function(){this.state==ve&&(this._input.tapCount=this.count,this.manager.emit(this.options.event,this._input))}}),ut.VERSION="2.0.7",ut.defaults={domEvents:!1,touchAction:le,enable:!0,inputTarget:null,inputClass:null,preset:[[st,{enable:!1}],[ot,{enable:!1},["rotate"]],[at,{direction:Bt}],[nt,{direction:Bt},["swipe"]],[lt],[lt,{event:"doubletap",taps:2},["tap"]],[it]],cssProps:{userSelect:"none",touchSelect:"none",touchCallout:"none",contentZooming:"none",userDrag:"none",tapHighlightColor:"rgba(0,0,0,0)"}};var we=1,ke=2;ct.prototype={set:function(t){return _t(this.options,t),t.touchAction&&this.touchAction.update(),t.inputTarget&&(this.input.destroy(),this.input.target=t.inputTarget,this.input.init()),this},stop:function(t){this.session.stopped=t?ke:we},recognize:function(t){var e=this.session;if(!e.stopped){this.touchAction.preventDefaults(t);var r,n=this.recognizers,o=e.curRecognizer;(!o||o&&o.state&ve)&&(o=e.curRecognizer=null);for(var i=0;i<n.length;)r=n[i],e.stopped===ke||o&&r!=o&&!r.canRecognizeWith(o)?r.reset():r.recognize(t),!o&&r.state&(me|ge|ye)&&(o=e.curRecognizer=r),i++}},get:function(t){if(t instanceof Q)return t;for(var e=this.recognizers,r=0;r<e.length;r++)if(e[r].options.event==t)return e[r];return null},add:function(t){if(a(t,"add",this))return this;var e=this.get(t.options.event);return e&&this.remove(e),this.recognizers.push(t),t.manager=this,this.touchAction.update(),t},remove:function(t){if(a(t,"remove",this))return this;if(t=this.get(t)){var e=this.recognizers,r=v(e,t);r!==-1&&(e.splice(r,1),this.touchAction.update())}return this},on:function(t,e){if(t!==i&&e!==i){var r=this.handlers;return l(y(t),function(t){r[t]=r[t]||[],r[t].push(e)}),this}},off:function(t,e){if(t!==i){var r=this.handlers;return l(y(t),function(t){e?r[t]&&r[t].splice(v(r[t],e),1):delete r[t]}),this}},emit:function(t,e){this.options.domEvents&&ht(t,e);var r=this.handlers[t]&&this.handlers[t].slice();if(r&&r.length){e.type=t,e.preventDefault=function(){e.srcEvent.preventDefault()};for(var n=0;n<r.length;)r[n](e),n++}},destroy:function(){this.element&&pt(this,!1),this.handlers={},this.session={},this.input.destroy(),this.element=null}},_t(ut,{INPUT_START:Pt,INPUT_MOVE:Nt,INPUT_END:Ot,INPUT_CANCEL:Dt,STATE_POSSIBLE:fe,STATE_BEGAN:me,STATE_CHANGED:ge,STATE_ENDED:ye,STATE_RECOGNIZED:ve,STATE_CANCELLED:be,STATE_FAILED:xe,DIRECTION_NONE:Ft,DIRECTION_LEFT:qt,DIRECTION_RIGHT:It,DIRECTION_UP:Rt,DIRECTION_DOWN:Lt,DIRECTION_HORIZONTAL:Bt,DIRECTION_VERTICAL:Vt,DIRECTION_ALL:Gt,Manager:ct,Input:T,TouchAction:W,TouchInput:G,MouseInput:R,PointerEventInput:L,TouchMouseInput:Y,SingleTouchInput:B,Recognizer:Q,AttrRecognizer:rt,Tap:lt,Pan:nt,Swipe:at,Pinch:ot,Rotate:st,Press:it,on:d,off:f,each:l,merge:xt,extend:bt,assign:_t,inherit:c,bindFn:p,prefixed:w});var Me="undefined"!=typeof e?e:"undefined"!=typeof self?self:{};Me.Hammer=ut,"function"==typeof t&&t.amd?t(function(){return ut}):"undefined"!=typeof r&&r.exports?r.exports=ut:e[o]=ut}(window,document,"Hammer")},{}],"jquery-mousewheel":[function(e,r,n){/*!
|
|
* jQuery Mousewheel 3.1.13
|
|
*
|
|
* Copyright jQuery Foundation and other contributors
|
|
* Released under the MIT license
|
|
* http://jquery.org/license
|
|
*/
|
|
!function(e){"function"==typeof t&&t.amd?t(["jquery"],e):"object"==typeof n?r.exports=e:e(jQuery)}(function(t){function e(e){var s=e||window.event,a=l.call(arguments,1),u=0,p=0,h=0,_=0,d=0,f=0;if(e=t.event.fix(s),e.type="mousewheel","detail"in s&&(h=s.detail*-1),"wheelDelta"in s&&(h=s.wheelDelta),"wheelDeltaY"in s&&(h=s.wheelDeltaY),"wheelDeltaX"in s&&(p=s.wheelDeltaX*-1),"axis"in s&&s.axis===s.HORIZONTAL_AXIS&&(p=h*-1,h=0),u=0===h?p:h,"deltaY"in s&&(h=s.deltaY*-1,u=h),"deltaX"in s&&(p=s.deltaX,0===h&&(u=p*-1)),0!==h||0!==p){if(1===s.deltaMode){var m=t.data(this,"mousewheel-line-height");u*=m,h*=m,p*=m}else if(2===s.deltaMode){var g=t.data(this,"mousewheel-page-height");u*=g,h*=g,p*=g}if(_=Math.max(Math.abs(h),Math.abs(p)),(!i||_<i)&&(i=_,n(s,_)&&(i/=40)),n(s,_)&&(u/=40,p/=40,h/=40),u=Math[u>=1?"floor":"ceil"](u/i),p=Math[p>=1?"floor":"ceil"](p/i),h=Math[h>=1?"floor":"ceil"](h/i),c.settings.normalizeOffset&&this.getBoundingClientRect){var y=this.getBoundingClientRect();d=e.clientX-y.left,f=e.clientY-y.top}return e.deltaX=p,e.deltaY=h,e.deltaFactor=i,e.offsetX=d,e.offsetY=f,e.deltaMode=0,a.unshift(e,u,p,h),o&&clearTimeout(o),o=setTimeout(r,200),(t.event.dispatch||t.event.handle).apply(this,a)}}function r(){i=null}function n(t,e){return c.settings.adjustOldDeltas&&"mousewheel"===t.type&&e%120===0}var o,i,s=["wheel","mousewheel","DOMMouseScroll","MozMousePixelScroll"],a="onwheel"in document||document.documentMode>=9?["wheel"]:["mousewheel","DomMouseScroll","MozMousePixelScroll"],l=Array.prototype.slice;if(t.event.fixHooks)for(var u=s.length;u;)t.event.fixHooks[s[--u]]=t.event.mouseHooks;var c=t.event.special.mousewheel={version:"3.1.12",setup:function(){if(this.addEventListener)for(var r=a.length;r;)this.addEventListener(a[--r],e,!1);else this.onmousewheel=e;t.data(this,"mousewheel-line-height",c.getLineHeight(this)),t.data(this,"mousewheel-page-height",c.getPageHeight(this))},teardown:function(){if(this.removeEventListener)for(var r=a.length;r;)this.removeEventListener(a[--r],e,!1);else this.onmousewheel=null;t.removeData(this,"mousewheel-line-height"),t.removeData(this,"mousewheel-page-height")},getLineHeight:function(e){var r=t(e),n=r["offsetParent"in t.fn?"offsetParent":"parent"]();return n.length||(n=t("body")),parseInt(n.css("fontSize"),10)||parseInt(r.css("fontSize"),10)||16},getPageHeight:function(e){return t(e).height()},settings:{adjustOldDeltas:!0,normalizeOffset:!0}};t.fn.extend({mousewheel:function(t){return t?this.bind("mousewheel",t):this.trigger("mousewheel")},unmousewheel:function(t){return this.unbind("mousewheel",t)}})})},{}],jquery:[function(e,r,n){/*!
|
|
* jQuery JavaScript Library v2.2.4
|
|
* http://jquery.com/
|
|
*
|
|
* Includes Sizzle.js
|
|
* http://sizzlejs.com/
|
|
*
|
|
* Copyright jQuery Foundation and other contributors
|
|
* Released under the MIT license
|
|
* http://jquery.org/license
|
|
*
|
|
* Date: 2016-05-20T17:23Z
|
|
*/
|
|
!function(t,e){"object"==typeof r&&"object"==typeof r.exports?r.exports=t.document?e(t,!0):function(t){if(!t.document)throw new Error("jQuery requires a window with a document");return e(t)}:e(t)}("undefined"!=typeof window?window:this,function(e,r){function n(t){var e=!!t&&"length"in t&&t.length,r=st.type(t);return"function"!==r&&!st.isWindow(t)&&("array"===r||0===e||"number"==typeof e&&e>0&&e-1 in t)}function o(t,e,r){if(st.isFunction(e))return st.grep(t,function(t,n){return!!e.call(t,n,t)!==r});if(e.nodeType)return st.grep(t,function(t){return t===e!==r});if("string"==typeof e){if(mt.test(e))return st.filter(e,t,r);e=st.filter(e,t)}return st.grep(t,function(t){return tt.call(e,t)>-1!==r})}function i(t,e){for(;(t=t[e])&&1!==t.nodeType;);return t}function s(t){var e={};return st.each(t.match(wt)||[],function(t,r){e[r]=!0}),e}function a(){J.removeEventListener("DOMContentLoaded",a),e.removeEventListener("load",a),st.ready()}function l(){this.expando=st.expando+l.uid++}function u(t,e,r){var n;if(void 0===r&&1===t.nodeType)if(n="data-"+e.replace(At,"-$&").toLowerCase(),r=t.getAttribute(n),"string"==typeof r){try{r="true"===r||"false"!==r&&("null"===r?null:+r+""===r?+r:Et.test(r)?st.parseJSON(r):r)}catch(o){}zt.set(t,e,r)}else r=void 0;return r}function c(t,e,r,n){var o,i=1,s=20,a=n?function(){return n.cur()}:function(){return st.css(t,e,"")},l=a(),u=r&&r[3]||(st.cssNumber[e]?"":"px"),c=(st.cssNumber[e]||"px"!==u&&+l)&&jt.exec(st.css(t,e));if(c&&c[3]!==u){u=u||c[3],r=r||[],c=+l||1;do i=i||".5",c/=i,st.style(t,e,c+u);while(i!==(i=a()/l)&&1!==i&&--s)}return r&&(c=+c||+l||0,o=r[1]?c+(r[1]+1)*r[2]:+r[2],n&&(n.unit=u,n.start=c,n.end=o)),o}function p(t,e){var r="undefined"!=typeof t.getElementsByTagName?t.getElementsByTagName(e||"*"):"undefined"!=typeof t.querySelectorAll?t.querySelectorAll(e||"*"):[];return void 0===e||e&&st.nodeName(t,e)?st.merge([t],r):r}function h(t,e){for(var r=0,n=t.length;r<n;r++)St.set(t[r],"globalEval",!e||St.get(e[r],"globalEval"))}function _(t,e,r,n,o){for(var i,s,a,l,u,c,_=e.createDocumentFragment(),d=[],f=0,m=t.length;f<m;f++)if(i=t[f],i||0===i)if("object"===st.type(i))st.merge(d,i.nodeType?[i]:i);else if(It.test(i)){for(s=s||_.appendChild(e.createElement("div")),a=(Dt.exec(i)||["",""])[1].toLowerCase(),l=qt[a]||qt._default,s.innerHTML=l[1]+st.htmlPrefilter(i)+l[2],c=l[0];c--;)s=s.lastChild;st.merge(d,s.childNodes),s=_.firstChild,s.textContent=""}else d.push(e.createTextNode(i));for(_.textContent="",f=0;i=d[f++];)if(n&&st.inArray(i,n)>-1)o&&o.push(i);else if(u=st.contains(i.ownerDocument,i),s=p(_.appendChild(i),"script"),u&&h(s),r)for(c=0;i=s[c++];)Ft.test(i.type||"")&&r.push(i);return _}function d(){return!0}function f(){return!1}function m(){try{return J.activeElement}catch(t){}}function g(t,e,r,n,o,i){var s,a;if("object"==typeof e){"string"!=typeof r&&(n=n||r,r=void 0);for(a in e)g(t,a,r,n,e[a],i);return t}if(null==n&&null==o?(o=r,n=r=void 0):null==o&&("string"==typeof r?(o=n,n=void 0):(o=n,n=r,r=void 0)),o===!1)o=f;else if(!o)return t;return 1===i&&(s=o,o=function(t){return st().off(t),s.apply(this,arguments)},o.guid=s.guid||(s.guid=st.guid++)),t.each(function(){st.event.add(this,e,o,n,r)})}function y(t,e){return st.nodeName(t,"table")&&st.nodeName(11!==e.nodeType?e:e.firstChild,"tr")?t.getElementsByTagName("tbody")[0]||t.appendChild(t.ownerDocument.createElement("tbody")):t}function v(t){return t.type=(null!==t.getAttribute("type"))+"/"+t.type,t}function b(t){var e=Yt.exec(t.type);return e?t.type=e[1]:t.removeAttribute("type"),t}function x(t,e){var r,n,o,i,s,a,l,u;if(1===e.nodeType){if(St.hasData(t)&&(i=St.access(t),s=St.set(e,i),u=i.events)){delete s.handle,s.events={};for(o in u)for(r=0,n=u[o].length;r<n;r++)st.event.add(e,o,u[o][r])}zt.hasData(t)&&(a=zt.access(t),l=st.extend({},a),zt.set(e,l))}}function w(t,e){var r=e.nodeName.toLowerCase();"input"===r&&Ot.test(t.type)?e.checked=t.checked:"input"!==r&&"textarea"!==r||(e.defaultValue=t.defaultValue)}function k(t,e,r,n){e=Q.apply([],e);var o,i,s,a,l,u,c=0,h=t.length,d=h-1,f=e[0],m=st.isFunction(f);if(m||h>1&&"string"==typeof f&&!ot.checkClone&&Ut.test(f))return t.each(function(o){var i=t.eq(o);m&&(e[0]=f.call(this,o,i.html())),k(i,e,r,n)});if(h&&(o=_(e,t[0].ownerDocument,!1,t,n),i=o.firstChild,1===o.childNodes.length&&(o=i),i||n)){for(s=st.map(p(o,"script"),v),a=s.length;c<h;c++)l=o,c!==d&&(l=st.clone(l,!0,!0),a&&st.merge(s,p(l,"script"))),r.call(t[c],l,c);if(a)for(u=s[s.length-1].ownerDocument,st.map(s,b),c=0;c<a;c++)l=s[c],Ft.test(l.type||"")&&!St.access(l,"globalEval")&&st.contains(u,l)&&(l.src?st._evalUrl&&st._evalUrl(l.src):st.globalEval(l.textContent.replace(Ht,"")))}return t}function M(t,e,r){for(var n,o=e?st.filter(e,t):t,i=0;null!=(n=o[i]);i++)r||1!==n.nodeType||st.cleanData(p(n)),n.parentNode&&(r&&st.contains(n.ownerDocument,n)&&h(p(n,"script")),n.parentNode.removeChild(n));return t}function T(t,e){var r=st(e.createElement(t)).appendTo(e.body),n=st.css(r[0],"display");return r.detach(),n}function S(t){var e=J,r=$t[t];return r||(r=T(t,e),"none"!==r&&r||(Xt=(Xt||st("<iframe frameborder='0' width='0' height='0'/>")).appendTo(e.documentElement),e=Xt[0].contentDocument,e.write(),e.close(),r=T(t,e),Xt.detach()),$t[t]=r),r}function z(t,e,r){var n,o,i,s,a=t.style;return r=r||Kt(t),s=r?r.getPropertyValue(e)||r[e]:void 0,""!==s&&void 0!==s||st.contains(t.ownerDocument,t)||(s=st.style(t,e)),r&&!ot.pixelMarginRight()&&Jt.test(s)&&Wt.test(e)&&(n=a.width,o=a.minWidth,i=a.maxWidth,a.minWidth=a.maxWidth=a.width=s,s=r.width,a.width=n,a.minWidth=o,a.maxWidth=i),void 0!==s?s+"":s}function E(t,e){return{get:function(){return t()?void delete this.get:(this.get=e).apply(this,arguments)}}}function A(t){if(t in oe)return t;for(var e=t[0].toUpperCase()+t.slice(1),r=ne.length;r--;)if(t=ne[r]+e,t in oe)return t}function C(t,e,r){var n=jt.exec(e);return n?Math.max(0,n[2]-(r||0))+(n[3]||"px"):e}function j(t,e,r,n,o){for(var i=r===(n?"border":"content")?4:"width"===e?1:0,s=0;i<4;i+=2)"margin"===r&&(s+=st.css(t,r+Pt[i],!0,o)),n?("content"===r&&(s-=st.css(t,"padding"+Pt[i],!0,o)),"margin"!==r&&(s-=st.css(t,"border"+Pt[i]+"Width",!0,o))):(s+=st.css(t,"padding"+Pt[i],!0,o),"padding"!==r&&(s+=st.css(t,"border"+Pt[i]+"Width",!0,o)));return s}function P(t,e,r){var n=!0,o="width"===e?t.offsetWidth:t.offsetHeight,i=Kt(t),s="border-box"===st.css(t,"boxSizing",!1,i);if(o<=0||null==o){if(o=z(t,e,i),(o<0||null==o)&&(o=t.style[e]),Jt.test(o))return o;n=s&&(ot.boxSizingReliable()||o===t.style[e]),o=parseFloat(o)||0}return o+j(t,e,r||(s?"border":"content"),n,i)+"px"}function N(t,e){for(var r,n,o,i=[],s=0,a=t.length;s<a;s++)n=t[s],n.style&&(i[s]=St.get(n,"olddisplay"),r=n.style.display,e?(i[s]||"none"!==r||(n.style.display=""),""===n.style.display&&Nt(n)&&(i[s]=St.access(n,"olddisplay",S(n.nodeName)))):(o=Nt(n),"none"===r&&o||St.set(n,"olddisplay",o?r:st.css(n,"display"))));for(s=0;s<a;s++)n=t[s],n.style&&(e&&"none"!==n.style.display&&""!==n.style.display||(n.style.display=e?i[s]||"":"none"));return t}function O(t,e,r,n,o){return new O.prototype.init(t,e,r,n,o)}function D(){return e.setTimeout(function(){ie=void 0}),ie=st.now()}function F(t,e){var r,n=0,o={height:t};for(e=e?1:0;n<4;n+=2-e)r=Pt[n],o["margin"+r]=o["padding"+r]=t;return e&&(o.opacity=o.width=t),o}function q(t,e,r){for(var n,o=(L.tweeners[e]||[]).concat(L.tweeners["*"]),i=0,s=o.length;i<s;i++)if(n=o[i].call(r,e,t))return n}function I(t,e,r){var n,o,i,s,a,l,u,c,p=this,h={},_=t.style,d=t.nodeType&&Nt(t),f=St.get(t,"fxshow");r.queue||(a=st._queueHooks(t,"fx"),null==a.unqueued&&(a.unqueued=0,l=a.empty.fire,a.empty.fire=function(){a.unqueued||l()}),a.unqueued++,p.always(function(){p.always(function(){a.unqueued--,st.queue(t,"fx").length||a.empty.fire()})})),1===t.nodeType&&("height"in e||"width"in e)&&(r.overflow=[_.overflow,_.overflowX,_.overflowY],u=st.css(t,"display"),c="none"===u?St.get(t,"olddisplay")||S(t.nodeName):u,"inline"===c&&"none"===st.css(t,"float")&&(_.display="inline-block")),r.overflow&&(_.overflow="hidden",p.always(function(){_.overflow=r.overflow[0],_.overflowX=r.overflow[1],_.overflowY=r.overflow[2]}));for(n in e)if(o=e[n],ae.exec(o)){if(delete e[n],i=i||"toggle"===o,o===(d?"hide":"show")){if("show"!==o||!f||void 0===f[n])continue;d=!0}h[n]=f&&f[n]||st.style(t,n)}else u=void 0;if(st.isEmptyObject(h))"inline"===("none"===u?S(t.nodeName):u)&&(_.display=u);else{f?"hidden"in f&&(d=f.hidden):f=St.access(t,"fxshow",{}),i&&(f.hidden=!d),d?st(t).show():p.done(function(){st(t).hide()}),p.done(function(){var e;St.remove(t,"fxshow");for(e in h)st.style(t,e,h[e])});for(n in h)s=q(d?f[n]:0,n,p),n in f||(f[n]=s.start,d&&(s.end=s.start,s.start="width"===n||"height"===n?1:0))}}function R(t,e){var r,n,o,i,s;for(r in t)if(n=st.camelCase(r),o=e[n],i=t[r],st.isArray(i)&&(o=i[1],i=t[r]=i[0]),r!==n&&(t[n]=i,delete t[r]),s=st.cssHooks[n],s&&"expand"in s){i=s.expand(i),delete t[n];for(r in i)r in t||(t[r]=i[r],e[r]=o)}else e[n]=o}function L(t,e,r){var n,o,i=0,s=L.prefilters.length,a=st.Deferred().always(function(){delete l.elem}),l=function(){if(o)return!1;for(var e=ie||D(),r=Math.max(0,u.startTime+u.duration-e),n=r/u.duration||0,i=1-n,s=0,l=u.tweens.length;s<l;s++)u.tweens[s].run(i);return a.notifyWith(t,[u,i,r]),i<1&&l?r:(a.resolveWith(t,[u]),!1)},u=a.promise({elem:t,props:st.extend({},e),opts:st.extend(!0,{specialEasing:{},easing:st.easing._default},r),originalProperties:e,originalOptions:r,startTime:ie||D(),duration:r.duration,tweens:[],createTween:function(e,r){var n=st.Tween(t,u.opts,e,r,u.opts.specialEasing[e]||u.opts.easing);return u.tweens.push(n),n},stop:function(e){var r=0,n=e?u.tweens.length:0;if(o)return this;for(o=!0;r<n;r++)u.tweens[r].run(1);return e?(a.notifyWith(t,[u,1,0]),a.resolveWith(t,[u,e])):a.rejectWith(t,[u,e]),this}}),c=u.props;for(R(c,u.opts.specialEasing);i<s;i++)if(n=L.prefilters[i].call(u,t,c,u.opts))return st.isFunction(n.stop)&&(st._queueHooks(u.elem,u.opts.queue).stop=st.proxy(n.stop,n)),n;return st.map(c,q,u),st.isFunction(u.opts.start)&&u.opts.start.call(t,u),st.fx.timer(st.extend(l,{elem:t,anim:u,queue:u.opts.queue})),u.progress(u.opts.progress).done(u.opts.done,u.opts.complete).fail(u.opts.fail).always(u.opts.always)}function B(t){return t.getAttribute&&t.getAttribute("class")||""}function V(t){return function(e,r){"string"!=typeof e&&(r=e,e="*");var n,o=0,i=e.toLowerCase().match(wt)||[];if(st.isFunction(r))for(;n=i[o++];)"+"===n[0]?(n=n.slice(1)||"*",(t[n]=t[n]||[]).unshift(r)):(t[n]=t[n]||[]).push(r)}}function G(t,e,r,n){function o(a){var l;return i[a]=!0,st.each(t[a]||[],function(t,a){var u=a(e,r,n);return"string"!=typeof u||s||i[u]?s?!(l=u):void 0:(e.dataTypes.unshift(u),o(u),!1)}),l}var i={},s=t===ze;return o(e.dataTypes[0])||!i["*"]&&o("*")}function U(t,e){var r,n,o=st.ajaxSettings.flatOptions||{};for(r in e)void 0!==e[r]&&((o[r]?t:n||(n={}))[r]=e[r]);return n&&st.extend(!0,t,n),t}function Y(t,e,r){for(var n,o,i,s,a=t.contents,l=t.dataTypes;"*"===l[0];)l.shift(),void 0===n&&(n=t.mimeType||e.getResponseHeader("Content-Type"));if(n)for(o in a)if(a[o]&&a[o].test(n)){l.unshift(o);break}if(l[0]in r)i=l[0];else{for(o in r){if(!l[0]||t.converters[o+" "+l[0]]){i=o;break}s||(s=o)}i=i||s}if(i)return i!==l[0]&&l.unshift(i),r[i]}function H(t,e,r,n){var o,i,s,a,l,u={},c=t.dataTypes.slice();if(c[1])for(s in t.converters)u[s.toLowerCase()]=t.converters[s];for(i=c.shift();i;)if(t.responseFields[i]&&(r[t.responseFields[i]]=e),!l&&n&&t.dataFilter&&(e=t.dataFilter(e,t.dataType)),l=i,i=c.shift())if("*"===i)i=l;else if("*"!==l&&l!==i){if(s=u[l+" "+i]||u["* "+i],!s)for(o in u)if(a=o.split(" "),a[1]===i&&(s=u[l+" "+a[0]]||u["* "+a[0]])){s===!0?s=u[o]:u[o]!==!0&&(i=a[0],c.unshift(a[1]));break}if(s!==!0)if(s&&t["throws"])e=s(e);else try{e=s(e)}catch(p){return{state:"parsererror",error:s?p:"No conversion from "+l+" to "+i}}}return{state:"success",data:e}}function X(t,e,r,n){var o;if(st.isArray(e))st.each(e,function(e,o){r||je.test(t)?n(t,o):X(t+"["+("object"==typeof o&&null!=o?e:"")+"]",o,r,n)});else if(r||"object"!==st.type(e))n(t,e);else for(o in e)X(t+"["+o+"]",e[o],r,n)}function $(t){return st.isWindow(t)?t:9===t.nodeType&&t.defaultView}var W=[],J=e.document,K=W.slice,Q=W.concat,Z=W.push,tt=W.indexOf,et={},rt=et.toString,nt=et.hasOwnProperty,ot={},it="2.2.4",st=function(t,e){return new st.fn.init(t,e)},at=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,lt=/^-ms-/,ut=/-([\da-z])/gi,ct=function(t,e){return e.toUpperCase()};st.fn=st.prototype={jquery:it,constructor:st,selector:"",length:0,toArray:function(){return K.call(this)},get:function(t){return null!=t?t<0?this[t+this.length]:this[t]:K.call(this)},pushStack:function(t){var e=st.merge(this.constructor(),t);return e.prevObject=this,e.context=this.context,e},each:function(t){return st.each(this,t)},map:function(t){return this.pushStack(st.map(this,function(e,r){return t.call(e,r,e)}))},slice:function(){return this.pushStack(K.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},eq:function(t){var e=this.length,r=+t+(t<0?e:0);return this.pushStack(r>=0&&r<e?[this[r]]:[])},end:function(){return this.prevObject||this.constructor()},push:Z,sort:W.sort,splice:W.splice},st.extend=st.fn.extend=function(){var t,e,r,n,o,i,s=arguments[0]||{},a=1,l=arguments.length,u=!1;for("boolean"==typeof s&&(u=s,s=arguments[a]||{},a++),"object"==typeof s||st.isFunction(s)||(s={}),a===l&&(s=this,a--);a<l;a++)if(null!=(t=arguments[a]))for(e in t)r=s[e],n=t[e],s!==n&&(u&&n&&(st.isPlainObject(n)||(o=st.isArray(n)))?(o?(o=!1,i=r&&st.isArray(r)?r:[]):i=r&&st.isPlainObject(r)?r:{},s[e]=st.extend(u,i,n)):void 0!==n&&(s[e]=n));return s},st.extend({expando:"jQuery"+(it+Math.random()).replace(/\D/g,""),isReady:!0,error:function(t){throw new Error(t)},noop:function(){},isFunction:function(t){return"function"===st.type(t)},isArray:Array.isArray,isWindow:function(t){return null!=t&&t===t.window},isNumeric:function(t){var e=t&&t.toString();return!st.isArray(t)&&e-parseFloat(e)+1>=0},isPlainObject:function(t){var e;if("object"!==st.type(t)||t.nodeType||st.isWindow(t))return!1;if(t.constructor&&!nt.call(t,"constructor")&&!nt.call(t.constructor.prototype||{},"isPrototypeOf"))return!1;for(e in t);return void 0===e||nt.call(t,e)},isEmptyObject:function(t){var e;for(e in t)return!1;return!0},type:function(t){return null==t?t+"":"object"==typeof t||"function"==typeof t?et[rt.call(t)]||"object":typeof t},globalEval:function(t){var e,r=eval;t=st.trim(t),t&&(1===t.indexOf("use strict")?(e=J.createElement("script"),e.text=t,J.head.appendChild(e).parentNode.removeChild(e)):r(t))},camelCase:function(t){return t.replace(lt,"ms-").replace(ut,ct)},nodeName:function(t,e){return t.nodeName&&t.nodeName.toLowerCase()===e.toLowerCase()},each:function(t,e){var r,o=0;if(n(t))for(r=t.length;o<r&&e.call(t[o],o,t[o])!==!1;o++);else for(o in t)if(e.call(t[o],o,t[o])===!1)break;return t},trim:function(t){return null==t?"":(t+"").replace(at,"")},makeArray:function(t,e){var r=e||[];return null!=t&&(n(Object(t))?st.merge(r,"string"==typeof t?[t]:t):Z.call(r,t)),r},inArray:function(t,e,r){return null==e?-1:tt.call(e,t,r)},merge:function(t,e){for(var r=+e.length,n=0,o=t.length;n<r;n++)t[o++]=e[n];return t.length=o,t},grep:function(t,e,r){for(var n,o=[],i=0,s=t.length,a=!r;i<s;i++)n=!e(t[i],i),n!==a&&o.push(t[i]);return o},map:function(t,e,r){var o,i,s=0,a=[];if(n(t))for(o=t.length;s<o;s++)i=e(t[s],s,r),null!=i&&a.push(i);else for(s in t)i=e(t[s],s,r),null!=i&&a.push(i);return Q.apply([],a)},guid:1,proxy:function(t,e){var r,n,o;if("string"==typeof e&&(r=t[e],e=t,t=r),st.isFunction(t))return n=K.call(arguments,2),o=function(){return t.apply(e||this,n.concat(K.call(arguments)))},o.guid=t.guid=t.guid||st.guid++,o},now:Date.now,support:ot}),"function"==typeof Symbol&&(st.fn[Symbol.iterator]=W[Symbol.iterator]),st.each("Boolean Number String Function Array Date RegExp Object Error Symbol".split(" "),function(t,e){et["[object "+e+"]"]=e.toLowerCase()});var pt=/*!
|
|
* Sizzle CSS Selector Engine v2.2.1
|
|
* http://sizzlejs.com/
|
|
*
|
|
* Copyright jQuery Foundation and other contributors
|
|
* Released under the MIT license
|
|
* http://jquery.org/license
|
|
*
|
|
* Date: 2015-10-17
|
|
*/
|
|
function(t){function e(t,e,r,n){var o,i,s,a,l,u,p,_,d=e&&e.ownerDocument,f=e?e.nodeType:9;if(r=r||[],"string"!=typeof t||!t||1!==f&&9!==f&&11!==f)return r;if(!n&&((e?e.ownerDocument||e:L)!==P&&j(e),e=e||P,O)){if(11!==f&&(u=gt.exec(t)))if(o=u[1]){if(9===f){if(!(s=e.getElementById(o)))return r;if(s.id===o)return r.push(s),r}else if(d&&(s=d.getElementById(o))&&I(e,s)&&s.id===o)return r.push(s),r}else{if(u[2])return Q.apply(r,e.getElementsByTagName(t)),r;if((o=u[3])&&x.getElementsByClassName&&e.getElementsByClassName)return Q.apply(r,e.getElementsByClassName(o)),r}if(x.qsa&&!Y[t+" "]&&(!D||!D.test(t))){if(1!==f)d=e,_=t;else if("object"!==e.nodeName.toLowerCase()){for((a=e.getAttribute("id"))?a=a.replace(vt,"\\$&"):e.setAttribute("id",a=R),p=T(t),i=p.length,l=ht.test(a)?"#"+a:"[id='"+a+"']";i--;)p[i]=l+" "+h(p[i]);_=p.join(","),d=yt.test(t)&&c(e.parentNode)||e}if(_)try{return Q.apply(r,d.querySelectorAll(_)),r}catch(m){}finally{a===R&&e.removeAttribute("id")}}}return z(t.replace(at,"$1"),e,r,n)}function r(){function t(r,n){return e.push(r+" ")>w.cacheLength&&delete t[e.shift()],t[r+" "]=n}var e=[];return t}function n(t){return t[R]=!0,t}function o(t){var e=P.createElement("div");try{return!!t(e)}catch(r){return!1}finally{e.parentNode&&e.parentNode.removeChild(e),e=null}}function i(t,e){for(var r=t.split("|"),n=r.length;n--;)w.attrHandle[r[n]]=e}function s(t,e){var r=e&&t,n=r&&1===t.nodeType&&1===e.nodeType&&(~e.sourceIndex||X)-(~t.sourceIndex||X);if(n)return n;if(r)for(;r=r.nextSibling;)if(r===e)return-1;return t?1:-1}function a(t){return function(e){var r=e.nodeName.toLowerCase();return"input"===r&&e.type===t}}function l(t){return function(e){var r=e.nodeName.toLowerCase();return("input"===r||"button"===r)&&e.type===t}}function u(t){return n(function(e){return e=+e,n(function(r,n){for(var o,i=t([],r.length,e),s=i.length;s--;)r[o=i[s]]&&(r[o]=!(n[o]=r[o]))})})}function c(t){return t&&"undefined"!=typeof t.getElementsByTagName&&t}function p(){}function h(t){for(var e=0,r=t.length,n="";e<r;e++)n+=t[e].value;return n}function _(t,e,r){var n=e.dir,o=r&&"parentNode"===n,i=V++;return e.first?function(e,r,i){for(;e=e[n];)if(1===e.nodeType||o)return t(e,r,i)}:function(e,r,s){var a,l,u,c=[B,i];if(s){for(;e=e[n];)if((1===e.nodeType||o)&&t(e,r,s))return!0}else for(;e=e[n];)if(1===e.nodeType||o){if(u=e[R]||(e[R]={}),l=u[e.uniqueID]||(u[e.uniqueID]={}),(a=l[n])&&a[0]===B&&a[1]===i)return c[2]=a[2];if(l[n]=c,c[2]=t(e,r,s))return!0}}}function d(t){return t.length>1?function(e,r,n){for(var o=t.length;o--;)if(!t[o](e,r,n))return!1;return!0}:t[0]}function f(t,r,n){for(var o=0,i=r.length;o<i;o++)e(t,r[o],n);return n}function m(t,e,r,n,o){for(var i,s=[],a=0,l=t.length,u=null!=e;a<l;a++)(i=t[a])&&(r&&!r(i,n,o)||(s.push(i),u&&e.push(a)));return s}function g(t,e,r,o,i,s){return o&&!o[R]&&(o=g(o)),i&&!i[R]&&(i=g(i,s)),n(function(n,s,a,l){var u,c,p,h=[],_=[],d=s.length,g=n||f(e||"*",a.nodeType?[a]:a,[]),y=!t||!n&&e?g:m(g,h,t,a,l),v=r?i||(n?t:d||o)?[]:s:y;if(r&&r(y,v,a,l),o)for(u=m(v,_),o(u,[],a,l),c=u.length;c--;)(p=u[c])&&(v[_[c]]=!(y[_[c]]=p));if(n){if(i||t){if(i){for(u=[],c=v.length;c--;)(p=v[c])&&u.push(y[c]=p);i(null,v=[],u,l)}for(c=v.length;c--;)(p=v[c])&&(u=i?tt(n,p):h[c])>-1&&(n[u]=!(s[u]=p))}}else v=m(v===s?v.splice(d,v.length):v),i?i(null,s,v,l):Q.apply(s,v)})}function y(t){for(var e,r,n,o=t.length,i=w.relative[t[0].type],s=i||w.relative[" "],a=i?1:0,l=_(function(t){return t===e},s,!0),u=_(function(t){return tt(e,t)>-1},s,!0),c=[function(t,r,n){var o=!i&&(n||r!==E)||((e=r).nodeType?l(t,r,n):u(t,r,n));return e=null,o}];a<o;a++)if(r=w.relative[t[a].type])c=[_(d(c),r)];else{if(r=w.filter[t[a].type].apply(null,t[a].matches),r[R]){for(n=++a;n<o&&!w.relative[t[n].type];n++);return g(a>1&&d(c),a>1&&h(t.slice(0,a-1).concat({value:" "===t[a-2].type?"*":""})).replace(at,"$1"),r,a<n&&y(t.slice(a,n)),n<o&&y(t=t.slice(n)),n<o&&h(t))}c.push(r)}return d(c)}function v(t,r){var o=r.length>0,i=t.length>0,s=function(n,s,a,l,u){var c,p,h,_=0,d="0",f=n&&[],g=[],y=E,v=n||i&&w.find.TAG("*",u),b=B+=null==y?1:Math.random()||.1,x=v.length;for(u&&(E=s===P||s||u);d!==x&&null!=(c=v[d]);d++){if(i&&c){for(p=0,s||c.ownerDocument===P||(j(c),a=!O);h=t[p++];)if(h(c,s||P,a)){l.push(c);break}u&&(B=b)}o&&((c=!h&&c)&&_--,n&&f.push(c))}if(_+=d,o&&d!==_){for(p=0;h=r[p++];)h(f,g,s,a);if(n){if(_>0)for(;d--;)f[d]||g[d]||(g[d]=J.call(l));g=m(g)}Q.apply(l,g),u&&!n&&g.length>0&&_+r.length>1&&e.uniqueSort(l)}return u&&(B=b,E=y),f};return o?n(s):s}var b,x,w,k,M,T,S,z,E,A,C,j,P,N,O,D,F,q,I,R="sizzle"+1*new Date,L=t.document,B=0,V=0,G=r(),U=r(),Y=r(),H=function(t,e){return t===e&&(C=!0),0},X=1<<31,$={}.hasOwnProperty,W=[],J=W.pop,K=W.push,Q=W.push,Z=W.slice,tt=function(t,e){for(var r=0,n=t.length;r<n;r++)if(t[r]===e)return r;return-1},et="checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",rt="[\\x20\\t\\r\\n\\f]",nt="(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",ot="\\["+rt+"*("+nt+")(?:"+rt+"*([*^$|!~]?=)"+rt+"*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|("+nt+"))|)"+rt+"*\\]",it=":("+nt+")(?:\\((('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|((?:\\\\.|[^\\\\()[\\]]|"+ot+")*)|.*)\\)|)",st=new RegExp(rt+"+","g"),at=new RegExp("^"+rt+"+|((?:^|[^\\\\])(?:\\\\.)*)"+rt+"+$","g"),lt=new RegExp("^"+rt+"*,"+rt+"*"),ut=new RegExp("^"+rt+"*([>+~]|"+rt+")"+rt+"*"),ct=new RegExp("="+rt+"*([^\\]'\"]*?)"+rt+"*\\]","g"),pt=new RegExp(it),ht=new RegExp("^"+nt+"$"),_t={ID:new RegExp("^#("+nt+")"),CLASS:new RegExp("^\\.("+nt+")"),TAG:new RegExp("^("+nt+"|[*])"),ATTR:new RegExp("^"+ot),PSEUDO:new RegExp("^"+it),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+rt+"*(even|odd|(([+-]|)(\\d*)n|)"+rt+"*(?:([+-]|)"+rt+"*(\\d+)|))"+rt+"*\\)|)","i"),bool:new RegExp("^(?:"+et+")$","i"),needsContext:new RegExp("^"+rt+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+rt+"*((?:-\\d)?\\d*)"+rt+"*\\)|)(?=[^-]|$)","i")},dt=/^(?:input|select|textarea|button)$/i,ft=/^h\d$/i,mt=/^[^{]+\{\s*\[native \w/,gt=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,yt=/[+~]/,vt=/'|\\/g,bt=new RegExp("\\\\([\\da-f]{1,6}"+rt+"?|("+rt+")|.)","ig"),xt=function(t,e,r){var n="0x"+e-65536;return n!==n||r?e:n<0?String.fromCharCode(n+65536):String.fromCharCode(n>>10|55296,1023&n|56320)},wt=function(){j()};try{Q.apply(W=Z.call(L.childNodes),L.childNodes),W[L.childNodes.length].nodeType}catch(kt){Q={apply:W.length?function(t,e){K.apply(t,Z.call(e))}:function(t,e){for(var r=t.length,n=0;t[r++]=e[n++];);t.length=r-1}}}x=e.support={},M=e.isXML=function(t){var e=t&&(t.ownerDocument||t).documentElement;return!!e&&"HTML"!==e.nodeName},j=e.setDocument=function(t){var e,r,n=t?t.ownerDocument||t:L;return n!==P&&9===n.nodeType&&n.documentElement?(P=n,N=P.documentElement,O=!M(P),(r=P.defaultView)&&r.top!==r&&(r.addEventListener?r.addEventListener("unload",wt,!1):r.attachEvent&&r.attachEvent("onunload",wt)),x.attributes=o(function(t){return t.className="i",!t.getAttribute("className")}),x.getElementsByTagName=o(function(t){return t.appendChild(P.createComment("")),!t.getElementsByTagName("*").length}),x.getElementsByClassName=mt.test(P.getElementsByClassName),x.getById=o(function(t){return N.appendChild(t).id=R,!P.getElementsByName||!P.getElementsByName(R).length}),x.getById?(w.find.ID=function(t,e){if("undefined"!=typeof e.getElementById&&O){var r=e.getElementById(t);return r?[r]:[]}},w.filter.ID=function(t){var e=t.replace(bt,xt);return function(t){return t.getAttribute("id")===e}}):(delete w.find.ID,w.filter.ID=function(t){var e=t.replace(bt,xt);return function(t){var r="undefined"!=typeof t.getAttributeNode&&t.getAttributeNode("id");return r&&r.value===e}}),w.find.TAG=x.getElementsByTagName?function(t,e){return"undefined"!=typeof e.getElementsByTagName?e.getElementsByTagName(t):x.qsa?e.querySelectorAll(t):void 0}:function(t,e){var r,n=[],o=0,i=e.getElementsByTagName(t);if("*"===t){for(;r=i[o++];)1===r.nodeType&&n.push(r);return n}return i},w.find.CLASS=x.getElementsByClassName&&function(t,e){if("undefined"!=typeof e.getElementsByClassName&&O)return e.getElementsByClassName(t)},F=[],D=[],(x.qsa=mt.test(P.querySelectorAll))&&(o(function(t){N.appendChild(t).innerHTML="<a id='"+R+"'></a><select id='"+R+"-\r\\' msallowcapture=''><option selected=''></option></select>",t.querySelectorAll("[msallowcapture^='']").length&&D.push("[*^$]="+rt+"*(?:''|\"\")"),t.querySelectorAll("[selected]").length||D.push("\\["+rt+"*(?:value|"+et+")"),t.querySelectorAll("[id~="+R+"-]").length||D.push("~="),t.querySelectorAll(":checked").length||D.push(":checked"),t.querySelectorAll("a#"+R+"+*").length||D.push(".#.+[+~]")}),o(function(t){var e=P.createElement("input");e.setAttribute("type","hidden"),t.appendChild(e).setAttribute("name","D"),t.querySelectorAll("[name=d]").length&&D.push("name"+rt+"*[*^$|!~]?="),t.querySelectorAll(":enabled").length||D.push(":enabled",":disabled"),t.querySelectorAll("*,:x"),D.push(",.*:")})),(x.matchesSelector=mt.test(q=N.matches||N.webkitMatchesSelector||N.mozMatchesSelector||N.oMatchesSelector||N.msMatchesSelector))&&o(function(t){x.disconnectedMatch=q.call(t,"div"),q.call(t,"[s!='']:x"),F.push("!=",it)}),D=D.length&&new RegExp(D.join("|")),F=F.length&&new RegExp(F.join("|")),e=mt.test(N.compareDocumentPosition),I=e||mt.test(N.contains)?function(t,e){var r=9===t.nodeType?t.documentElement:t,n=e&&e.parentNode;return t===n||!(!n||1!==n.nodeType||!(r.contains?r.contains(n):t.compareDocumentPosition&&16&t.compareDocumentPosition(n)))}:function(t,e){if(e)for(;e=e.parentNode;)if(e===t)return!0;return!1},H=e?function(t,e){if(t===e)return C=!0,0;var r=!t.compareDocumentPosition-!e.compareDocumentPosition;return r?r:(r=(t.ownerDocument||t)===(e.ownerDocument||e)?t.compareDocumentPosition(e):1,1&r||!x.sortDetached&&e.compareDocumentPosition(t)===r?t===P||t.ownerDocument===L&&I(L,t)?-1:e===P||e.ownerDocument===L&&I(L,e)?1:A?tt(A,t)-tt(A,e):0:4&r?-1:1)}:function(t,e){if(t===e)return C=!0,0;var r,n=0,o=t.parentNode,i=e.parentNode,a=[t],l=[e];if(!o||!i)return t===P?-1:e===P?1:o?-1:i?1:A?tt(A,t)-tt(A,e):0;if(o===i)return s(t,e);for(r=t;r=r.parentNode;)a.unshift(r);for(r=e;r=r.parentNode;)l.unshift(r);for(;a[n]===l[n];)n++;return n?s(a[n],l[n]):a[n]===L?-1:l[n]===L?1:0},P):P},e.matches=function(t,r){return e(t,null,null,r)},e.matchesSelector=function(t,r){if((t.ownerDocument||t)!==P&&j(t),r=r.replace(ct,"='$1']"),x.matchesSelector&&O&&!Y[r+" "]&&(!F||!F.test(r))&&(!D||!D.test(r)))try{var n=q.call(t,r);if(n||x.disconnectedMatch||t.document&&11!==t.document.nodeType)return n}catch(o){}return e(r,P,null,[t]).length>0},e.contains=function(t,e){return(t.ownerDocument||t)!==P&&j(t),I(t,e)},e.attr=function(t,e){(t.ownerDocument||t)!==P&&j(t);var r=w.attrHandle[e.toLowerCase()],n=r&&$.call(w.attrHandle,e.toLowerCase())?r(t,e,!O):void 0;return void 0!==n?n:x.attributes||!O?t.getAttribute(e):(n=t.getAttributeNode(e))&&n.specified?n.value:null},e.error=function(t){throw new Error("Syntax error, unrecognized expression: "+t)},e.uniqueSort=function(t){var e,r=[],n=0,o=0;if(C=!x.detectDuplicates,A=!x.sortStable&&t.slice(0),t.sort(H),C){for(;e=t[o++];)e===t[o]&&(n=r.push(o));for(;n--;)t.splice(r[n],1)}return A=null,t},k=e.getText=function(t){var e,r="",n=0,o=t.nodeType;if(o){if(1===o||9===o||11===o){if("string"==typeof t.textContent)return t.textContent;for(t=t.firstChild;t;t=t.nextSibling)r+=k(t)}else if(3===o||4===o)return t.nodeValue}else for(;e=t[n++];)r+=k(e);return r},w=e.selectors={cacheLength:50,createPseudo:n,match:_t,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(t){return t[1]=t[1].replace(bt,xt),t[3]=(t[3]||t[4]||t[5]||"").replace(bt,xt),"~="===t[2]&&(t[3]=" "+t[3]+" "),t.slice(0,4)},CHILD:function(t){return t[1]=t[1].toLowerCase(),"nth"===t[1].slice(0,3)?(t[3]||e.error(t[0]),t[4]=+(t[4]?t[5]+(t[6]||1):2*("even"===t[3]||"odd"===t[3])),t[5]=+(t[7]+t[8]||"odd"===t[3])):t[3]&&e.error(t[0]),t},PSEUDO:function(t){var e,r=!t[6]&&t[2];return _t.CHILD.test(t[0])?null:(t[3]?t[2]=t[4]||t[5]||"":r&&pt.test(r)&&(e=T(r,!0))&&(e=r.indexOf(")",r.length-e)-r.length)&&(t[0]=t[0].slice(0,e),t[2]=r.slice(0,e)),t.slice(0,3))}},filter:{TAG:function(t){var e=t.replace(bt,xt).toLowerCase();return"*"===t?function(){return!0}:function(t){return t.nodeName&&t.nodeName.toLowerCase()===e}},CLASS:function(t){var e=G[t+" "];return e||(e=new RegExp("(^|"+rt+")"+t+"("+rt+"|$)"))&&G(t,function(t){return e.test("string"==typeof t.className&&t.className||"undefined"!=typeof t.getAttribute&&t.getAttribute("class")||"")})},ATTR:function(t,r,n){return function(o){var i=e.attr(o,t);return null==i?"!="===r:!r||(i+="","="===r?i===n:"!="===r?i!==n:"^="===r?n&&0===i.indexOf(n):"*="===r?n&&i.indexOf(n)>-1:"$="===r?n&&i.slice(-n.length)===n:"~="===r?(" "+i.replace(st," ")+" ").indexOf(n)>-1:"|="===r&&(i===n||i.slice(0,n.length+1)===n+"-"))}},CHILD:function(t,e,r,n,o){var i="nth"!==t.slice(0,3),s="last"!==t.slice(-4),a="of-type"===e;return 1===n&&0===o?function(t){return!!t.parentNode}:function(e,r,l){var u,c,p,h,_,d,f=i!==s?"nextSibling":"previousSibling",m=e.parentNode,g=a&&e.nodeName.toLowerCase(),y=!l&&!a,v=!1;if(m){if(i){for(;f;){for(h=e;h=h[f];)if(a?h.nodeName.toLowerCase()===g:1===h.nodeType)return!1;d=f="only"===t&&!d&&"nextSibling"}return!0}if(d=[s?m.firstChild:m.lastChild],s&&y){for(h=m,p=h[R]||(h[R]={}),c=p[h.uniqueID]||(p[h.uniqueID]={}),u=c[t]||[],_=u[0]===B&&u[1],v=_&&u[2],h=_&&m.childNodes[_];h=++_&&h&&h[f]||(v=_=0)||d.pop();)if(1===h.nodeType&&++v&&h===e){c[t]=[B,_,v];break}}else if(y&&(h=e,p=h[R]||(h[R]={}),c=p[h.uniqueID]||(p[h.uniqueID]={}),u=c[t]||[],_=u[0]===B&&u[1],v=_),v===!1)for(;(h=++_&&h&&h[f]||(v=_=0)||d.pop())&&((a?h.nodeName.toLowerCase()!==g:1!==h.nodeType)||!++v||(y&&(p=h[R]||(h[R]={}),c=p[h.uniqueID]||(p[h.uniqueID]={}),c[t]=[B,v]),h!==e)););return v-=o,v===n||v%n===0&&v/n>=0}}},PSEUDO:function(t,r){var o,i=w.pseudos[t]||w.setFilters[t.toLowerCase()]||e.error("unsupported pseudo: "+t);return i[R]?i(r):i.length>1?(o=[t,t,"",r],w.setFilters.hasOwnProperty(t.toLowerCase())?n(function(t,e){for(var n,o=i(t,r),s=o.length;s--;)n=tt(t,o[s]),t[n]=!(e[n]=o[s])}):function(t){return i(t,0,o)}):i}},pseudos:{not:n(function(t){var e=[],r=[],o=S(t.replace(at,"$1"));return o[R]?n(function(t,e,r,n){for(var i,s=o(t,null,n,[]),a=t.length;a--;)(i=s[a])&&(t[a]=!(e[a]=i))}):function(t,n,i){return e[0]=t,o(e,null,i,r),e[0]=null,!r.pop()}}),has:n(function(t){return function(r){return e(t,r).length>0}}),contains:n(function(t){return t=t.replace(bt,xt),function(e){return(e.textContent||e.innerText||k(e)).indexOf(t)>-1}}),lang:n(function(t){return ht.test(t||"")||e.error("unsupported lang: "+t),t=t.replace(bt,xt).toLowerCase(),function(e){var r;do if(r=O?e.lang:e.getAttribute("xml:lang")||e.getAttribute("lang"))return r=r.toLowerCase(),r===t||0===r.indexOf(t+"-");while((e=e.parentNode)&&1===e.nodeType);return!1}}),target:function(e){var r=t.location&&t.location.hash;return r&&r.slice(1)===e.id},root:function(t){return t===N},focus:function(t){return t===P.activeElement&&(!P.hasFocus||P.hasFocus())&&!!(t.type||t.href||~t.tabIndex)},enabled:function(t){return t.disabled===!1},disabled:function(t){return t.disabled===!0},checked:function(t){var e=t.nodeName.toLowerCase();return"input"===e&&!!t.checked||"option"===e&&!!t.selected},selected:function(t){return t.parentNode&&t.parentNode.selectedIndex,t.selected===!0},empty:function(t){for(t=t.firstChild;t;t=t.nextSibling)if(t.nodeType<6)return!1;return!0},parent:function(t){return!w.pseudos.empty(t)},header:function(t){return ft.test(t.nodeName)},input:function(t){return dt.test(t.nodeName)},button:function(t){var e=t.nodeName.toLowerCase();return"input"===e&&"button"===t.type||"button"===e},text:function(t){var e;return"input"===t.nodeName.toLowerCase()&&"text"===t.type&&(null==(e=t.getAttribute("type"))||"text"===e.toLowerCase())},first:u(function(){return[0]}),last:u(function(t,e){return[e-1]}),eq:u(function(t,e,r){return[r<0?r+e:r]}),even:u(function(t,e){for(var r=0;r<e;r+=2)t.push(r);return t}),odd:u(function(t,e){for(var r=1;r<e;r+=2)t.push(r);return t}),lt:u(function(t,e,r){for(var n=r<0?r+e:r;--n>=0;)t.push(n);return t}),gt:u(function(t,e,r){for(var n=r<0?r+e:r;++n<e;)t.push(n);return t})}},w.pseudos.nth=w.pseudos.eq;for(b in{radio:!0,checkbox:!0,file:!0,password:!0,image:!0})w.pseudos[b]=a(b);for(b in{submit:!0,reset:!0})w.pseudos[b]=l(b);return p.prototype=w.filters=w.pseudos,w.setFilters=new p,T=e.tokenize=function(t,r){var n,o,i,s,a,l,u,c=U[t+" "];if(c)return r?0:c.slice(0);for(a=t,l=[],u=w.preFilter;a;){n&&!(o=lt.exec(a))||(o&&(a=a.slice(o[0].length)||a),l.push(i=[])),n=!1,(o=ut.exec(a))&&(n=o.shift(),i.push({value:n,type:o[0].replace(at," ")}),a=a.slice(n.length));for(s in w.filter)!(o=_t[s].exec(a))||u[s]&&!(o=u[s](o))||(n=o.shift(),i.push({value:n,type:s,matches:o}),a=a.slice(n.length));if(!n)break}return r?a.length:a?e.error(t):U(t,l).slice(0)},S=e.compile=function(t,e){var r,n=[],o=[],i=Y[t+" "];if(!i){for(e||(e=T(t)),r=e.length;r--;)i=y(e[r]),i[R]?n.push(i):o.push(i);i=Y(t,v(o,n)),i.selector=t}return i},z=e.select=function(t,e,r,n){var o,i,s,a,l,u="function"==typeof t&&t,p=!n&&T(t=u.selector||t);if(r=r||[],1===p.length){if(i=p[0]=p[0].slice(0),i.length>2&&"ID"===(s=i[0]).type&&x.getById&&9===e.nodeType&&O&&w.relative[i[1].type]){if(e=(w.find.ID(s.matches[0].replace(bt,xt),e)||[])[0],!e)return r;u&&(e=e.parentNode),t=t.slice(i.shift().value.length)}for(o=_t.needsContext.test(t)?0:i.length;o--&&(s=i[o],!w.relative[a=s.type]);)if((l=w.find[a])&&(n=l(s.matches[0].replace(bt,xt),yt.test(i[0].type)&&c(e.parentNode)||e))){if(i.splice(o,1),t=n.length&&h(i),!t)return Q.apply(r,n),r;break}}return(u||S(t,p))(n,e,!O,r,!e||yt.test(t)&&c(e.parentNode)||e),r},x.sortStable=R.split("").sort(H).join("")===R,x.detectDuplicates=!!C,j(),x.sortDetached=o(function(t){return 1&t.compareDocumentPosition(P.createElement("div"))}),o(function(t){return t.innerHTML="<a href='#'></a>","#"===t.firstChild.getAttribute("href")})||i("type|href|height|width",function(t,e,r){if(!r)return t.getAttribute(e,"type"===e.toLowerCase()?1:2)}),x.attributes&&o(function(t){return t.innerHTML="<input/>",t.firstChild.setAttribute("value",""),""===t.firstChild.getAttribute("value")})||i("value",function(t,e,r){if(!r&&"input"===t.nodeName.toLowerCase())return t.defaultValue}),o(function(t){return null==t.getAttribute("disabled")})||i(et,function(t,e,r){var n;if(!r)return t[e]===!0?e.toLowerCase():(n=t.getAttributeNode(e))&&n.specified?n.value:null}),e}(e);st.find=pt,st.expr=pt.selectors,st.expr[":"]=st.expr.pseudos,st.uniqueSort=st.unique=pt.uniqueSort,st.text=pt.getText,st.isXMLDoc=pt.isXML,st.contains=pt.contains;var ht=function(t,e,r){for(var n=[],o=void 0!==r;(t=t[e])&&9!==t.nodeType;)if(1===t.nodeType){if(o&&st(t).is(r))break;n.push(t)}return n},_t=function(t,e){for(var r=[];t;t=t.nextSibling)1===t.nodeType&&t!==e&&r.push(t);return r},dt=st.expr.match.needsContext,ft=/^<([\w-]+)\s*\/?>(?:<\/\1>|)$/,mt=/^.[^:#\[\.,]*$/;st.filter=function(t,e,r){var n=e[0];return r&&(t=":not("+t+")"),1===e.length&&1===n.nodeType?st.find.matchesSelector(n,t)?[n]:[]:st.find.matches(t,st.grep(e,function(t){return 1===t.nodeType}))},st.fn.extend({find:function(t){var e,r=this.length,n=[],o=this;if("string"!=typeof t)return this.pushStack(st(t).filter(function(){for(e=0;e<r;e++)if(st.contains(o[e],this))return!0}));for(e=0;e<r;e++)st.find(t,o[e],n);return n=this.pushStack(r>1?st.unique(n):n),n.selector=this.selector?this.selector+" "+t:t,n},filter:function(t){return this.pushStack(o(this,t||[],!1))},not:function(t){return this.pushStack(o(this,t||[],!0))},is:function(t){return!!o(this,"string"==typeof t&&dt.test(t)?st(t):t||[],!1).length}});var gt,yt=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/,vt=st.fn.init=function(t,e,r){var n,o;if(!t)return this;if(r=r||gt,"string"==typeof t){if(n="<"===t[0]&&">"===t[t.length-1]&&t.length>=3?[null,t,null]:yt.exec(t),!n||!n[1]&&e)return!e||e.jquery?(e||r).find(t):this.constructor(e).find(t);if(n[1]){if(e=e instanceof st?e[0]:e,st.merge(this,st.parseHTML(n[1],e&&e.nodeType?e.ownerDocument||e:J,!0)),ft.test(n[1])&&st.isPlainObject(e))for(n in e)st.isFunction(this[n])?this[n](e[n]):this.attr(n,e[n]);return this}return o=J.getElementById(n[2]),o&&o.parentNode&&(this.length=1,this[0]=o),this.context=J,this.selector=t,this}return t.nodeType?(this.context=this[0]=t,this.length=1,this):st.isFunction(t)?void 0!==r.ready?r.ready(t):t(st):(void 0!==t.selector&&(this.selector=t.selector,this.context=t.context),st.makeArray(t,this))};vt.prototype=st.fn,gt=st(J);var bt=/^(?:parents|prev(?:Until|All))/,xt={children:!0,contents:!0,next:!0,prev:!0};st.fn.extend({has:function(t){var e=st(t,this),r=e.length;return this.filter(function(){for(var t=0;t<r;t++)if(st.contains(this,e[t]))return!0})},closest:function(t,e){for(var r,n=0,o=this.length,i=[],s=dt.test(t)||"string"!=typeof t?st(t,e||this.context):0;n<o;n++)for(r=this[n];r&&r!==e;r=r.parentNode)if(r.nodeType<11&&(s?s.index(r)>-1:1===r.nodeType&&st.find.matchesSelector(r,t))){i.push(r);break}return this.pushStack(i.length>1?st.uniqueSort(i):i)},index:function(t){return t?"string"==typeof t?tt.call(st(t),this[0]):tt.call(this,t.jquery?t[0]:t):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(t,e){return this.pushStack(st.uniqueSort(st.merge(this.get(),st(t,e))))},addBack:function(t){return this.add(null==t?this.prevObject:this.prevObject.filter(t))}}),st.each({parent:function(t){var e=t.parentNode;return e&&11!==e.nodeType?e:null},parents:function(t){return ht(t,"parentNode")},parentsUntil:function(t,e,r){return ht(t,"parentNode",r)},next:function(t){return i(t,"nextSibling")},prev:function(t){return i(t,"previousSibling")},nextAll:function(t){return ht(t,"nextSibling")},prevAll:function(t){return ht(t,"previousSibling")},nextUntil:function(t,e,r){return ht(t,"nextSibling",r)},prevUntil:function(t,e,r){return ht(t,"previousSibling",r)},siblings:function(t){return _t((t.parentNode||{}).firstChild,t)},children:function(t){return _t(t.firstChild)},contents:function(t){return t.contentDocument||st.merge([],t.childNodes)}},function(t,e){st.fn[t]=function(r,n){var o=st.map(this,e,r);return"Until"!==t.slice(-5)&&(n=r),n&&"string"==typeof n&&(o=st.filter(n,o)),this.length>1&&(xt[t]||st.uniqueSort(o),bt.test(t)&&o.reverse()),this.pushStack(o)}});var wt=/\S+/g;st.Callbacks=function(t){t="string"==typeof t?s(t):st.extend({},t);var e,r,n,o,i=[],a=[],l=-1,u=function(){for(o=t.once,n=e=!0;a.length;l=-1)for(r=a.shift();++l<i.length;)i[l].apply(r[0],r[1])===!1&&t.stopOnFalse&&(l=i.length,r=!1);t.memory||(r=!1),e=!1,o&&(i=r?[]:"")},c={add:function(){return i&&(r&&!e&&(l=i.length-1,a.push(r)),function n(e){st.each(e,function(e,r){st.isFunction(r)?t.unique&&c.has(r)||i.push(r):r&&r.length&&"string"!==st.type(r)&&n(r)})}(arguments),r&&!e&&u()),this},remove:function(){return st.each(arguments,function(t,e){for(var r;(r=st.inArray(e,i,r))>-1;)i.splice(r,1),r<=l&&l--}),this},has:function(t){return t?st.inArray(t,i)>-1:i.length>0},empty:function(){return i&&(i=[]),this},disable:function(){return o=a=[],i=r="",this},disabled:function(){return!i},lock:function(){return o=a=[],r||(i=r=""),this},locked:function(){return!!o},fireWith:function(t,r){return o||(r=r||[],r=[t,r.slice?r.slice():r],a.push(r),e||u()),this},fire:function(){return c.fireWith(this,arguments),this},fired:function(){return!!n}};return c},st.extend({Deferred:function(t){var e=[["resolve","done",st.Callbacks("once memory"),"resolved"],["reject","fail",st.Callbacks("once memory"),"rejected"],["notify","progress",st.Callbacks("memory")]],r="pending",n={state:function(){return r},always:function(){return o.done(arguments).fail(arguments),this},then:function(){var t=arguments;return st.Deferred(function(r){st.each(e,function(e,i){var s=st.isFunction(t[e])&&t[e];o[i[1]](function(){var t=s&&s.apply(this,arguments);t&&st.isFunction(t.promise)?t.promise().progress(r.notify).done(r.resolve).fail(r.reject):r[i[0]+"With"](this===n?r.promise():this,s?[t]:arguments)})}),t=null}).promise()},promise:function(t){return null!=t?st.extend(t,n):n}},o={};return n.pipe=n.then,st.each(e,function(t,i){var s=i[2],a=i[3];n[i[1]]=s.add,a&&s.add(function(){r=a},e[1^t][2].disable,e[2][2].lock),o[i[0]]=function(){return o[i[0]+"With"](this===o?n:this,arguments),this},o[i[0]+"With"]=s.fireWith}),n.promise(o),t&&t.call(o,o),o},when:function(t){var e,r,n,o=0,i=K.call(arguments),s=i.length,a=1!==s||t&&st.isFunction(t.promise)?s:0,l=1===a?t:st.Deferred(),u=function(t,r,n){return function(o){r[t]=this,n[t]=arguments.length>1?K.call(arguments):o,n===e?l.notifyWith(r,n):--a||l.resolveWith(r,n)}};if(s>1)for(e=new Array(s),r=new Array(s),n=new Array(s);o<s;o++)i[o]&&st.isFunction(i[o].promise)?i[o].promise().progress(u(o,r,e)).done(u(o,n,i)).fail(l.reject):--a;return a||l.resolveWith(n,i),l.promise()}});var kt;st.fn.ready=function(t){return st.ready.promise().done(t),this},st.extend({isReady:!1,readyWait:1,holdReady:function(t){t?st.readyWait++:st.ready(!0)},ready:function(t){(t===!0?--st.readyWait:st.isReady)||(st.isReady=!0,t!==!0&&--st.readyWait>0||(kt.resolveWith(J,[st]),st.fn.triggerHandler&&(st(J).triggerHandler("ready"),st(J).off("ready"))))}}),st.ready.promise=function(t){return kt||(kt=st.Deferred(),"complete"===J.readyState||"loading"!==J.readyState&&!J.documentElement.doScroll?e.setTimeout(st.ready):(J.addEventListener("DOMContentLoaded",a),e.addEventListener("load",a))),kt.promise(t)},st.ready.promise();var Mt=function(t,e,r,n,o,i,s){var a=0,l=t.length,u=null==r;if("object"===st.type(r)){o=!0;for(a in r)Mt(t,e,a,r[a],!0,i,s)}else if(void 0!==n&&(o=!0,st.isFunction(n)||(s=!0),u&&(s?(e.call(t,n),e=null):(u=e,e=function(t,e,r){return u.call(st(t),r)})),e))for(;a<l;a++)e(t[a],r,s?n:n.call(t[a],a,e(t[a],r)));return o?t:u?e.call(t):l?e(t[0],r):i},Tt=function(t){return 1===t.nodeType||9===t.nodeType||!+t.nodeType};l.uid=1,l.prototype={register:function(t,e){var r=e||{};return t.nodeType?t[this.expando]=r:Object.defineProperty(t,this.expando,{value:r,writable:!0,configurable:!0}),t[this.expando]},cache:function(t){if(!Tt(t))return{};var e=t[this.expando];return e||(e={},Tt(t)&&(t.nodeType?t[this.expando]=e:Object.defineProperty(t,this.expando,{value:e,configurable:!0}))),e},set:function(t,e,r){var n,o=this.cache(t);if("string"==typeof e)o[e]=r;else for(n in e)o[n]=e[n];return o},get:function(t,e){return void 0===e?this.cache(t):t[this.expando]&&t[this.expando][e]},access:function(t,e,r){var n;return void 0===e||e&&"string"==typeof e&&void 0===r?(n=this.get(t,e),void 0!==n?n:this.get(t,st.camelCase(e))):(this.set(t,e,r),void 0!==r?r:e)},remove:function(t,e){var r,n,o,i=t[this.expando];if(void 0!==i){if(void 0===e)this.register(t);else{st.isArray(e)?n=e.concat(e.map(st.camelCase)):(o=st.camelCase(e),e in i?n=[e,o]:(n=o,n=n in i?[n]:n.match(wt)||[])),r=n.length;for(;r--;)delete i[n[r]]}(void 0===e||st.isEmptyObject(i))&&(t.nodeType?t[this.expando]=void 0:delete t[this.expando])}},hasData:function(t){var e=t[this.expando];return void 0!==e&&!st.isEmptyObject(e)}};var St=new l,zt=new l,Et=/^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,At=/[A-Z]/g;st.extend({hasData:function(t){return zt.hasData(t)||St.hasData(t)},data:function(t,e,r){return zt.access(t,e,r)},removeData:function(t,e){zt.remove(t,e)},_data:function(t,e,r){return St.access(t,e,r)},_removeData:function(t,e){St.remove(t,e)}}),st.fn.extend({data:function(t,e){var r,n,o,i=this[0],s=i&&i.attributes;if(void 0===t){if(this.length&&(o=zt.get(i),1===i.nodeType&&!St.get(i,"hasDataAttrs"))){for(r=s.length;r--;)s[r]&&(n=s[r].name,0===n.indexOf("data-")&&(n=st.camelCase(n.slice(5)),u(i,n,o[n])));St.set(i,"hasDataAttrs",!0)}return o}return"object"==typeof t?this.each(function(){zt.set(this,t)}):Mt(this,function(e){var r,n;if(i&&void 0===e){if(r=zt.get(i,t)||zt.get(i,t.replace(At,"-$&").toLowerCase()),void 0!==r)return r;if(n=st.camelCase(t),r=zt.get(i,n),void 0!==r)return r;if(r=u(i,n,void 0),void 0!==r)return r}else n=st.camelCase(t),this.each(function(){var r=zt.get(this,n);zt.set(this,n,e),t.indexOf("-")>-1&&void 0!==r&&zt.set(this,t,e)})},null,e,arguments.length>1,null,!0)},removeData:function(t){return this.each(function(){zt.remove(this,t)})}}),st.extend({queue:function(t,e,r){var n;if(t)return e=(e||"fx")+"queue",n=St.get(t,e),r&&(!n||st.isArray(r)?n=St.access(t,e,st.makeArray(r)):n.push(r)),n||[]},dequeue:function(t,e){e=e||"fx";var r=st.queue(t,e),n=r.length,o=r.shift(),i=st._queueHooks(t,e),s=function(){st.dequeue(t,e)};"inprogress"===o&&(o=r.shift(),n--),o&&("fx"===e&&r.unshift("inprogress"),delete i.stop,o.call(t,s,i)),!n&&i&&i.empty.fire()},_queueHooks:function(t,e){var r=e+"queueHooks";return St.get(t,r)||St.access(t,r,{empty:st.Callbacks("once memory").add(function(){St.remove(t,[e+"queue",r])})})}}),st.fn.extend({queue:function(t,e){var r=2;return"string"!=typeof t&&(e=t,t="fx",r--),arguments.length<r?st.queue(this[0],t):void 0===e?this:this.each(function(){var r=st.queue(this,t,e);st._queueHooks(this,t),"fx"===t&&"inprogress"!==r[0]&&st.dequeue(this,t)})},dequeue:function(t){return this.each(function(){st.dequeue(this,t)})},clearQueue:function(t){return this.queue(t||"fx",[])},promise:function(t,e){var r,n=1,o=st.Deferred(),i=this,s=this.length,a=function(){--n||o.resolveWith(i,[i])};for("string"!=typeof t&&(e=t,t=void 0),t=t||"fx";s--;)r=St.get(i[s],t+"queueHooks"),r&&r.empty&&(n++,r.empty.add(a));return a(),o.promise(e)}});var Ct=/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source,jt=new RegExp("^(?:([+-])=|)("+Ct+")([a-z%]*)$","i"),Pt=["Top","Right","Bottom","Left"],Nt=function(t,e){return t=e||t,"none"===st.css(t,"display")||!st.contains(t.ownerDocument,t)},Ot=/^(?:checkbox|radio)$/i,Dt=/<([\w:-]+)/,Ft=/^$|\/(?:java|ecma)script/i,qt={option:[1,"<select multiple='multiple'>","</select>"],thead:[1,"<table>","</table>"],col:[2,"<table><colgroup>","</colgroup></table>"],tr:[2,"<table><tbody>","</tbody></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],_default:[0,"",""]};qt.optgroup=qt.option,qt.tbody=qt.tfoot=qt.colgroup=qt.caption=qt.thead,qt.th=qt.td;var It=/<|&#?\w+;/;!function(){var t=J.createDocumentFragment(),e=t.appendChild(J.createElement("div")),r=J.createElement("input");r.setAttribute("type","radio"),r.setAttribute("checked","checked"),r.setAttribute("name","t"),e.appendChild(r),ot.checkClone=e.cloneNode(!0).cloneNode(!0).lastChild.checked,e.innerHTML="<textarea>x</textarea>",ot.noCloneChecked=!!e.cloneNode(!0).lastChild.defaultValue}();var Rt=/^key/,Lt=/^(?:mouse|pointer|contextmenu|drag|drop)|click/,Bt=/^([^.]*)(?:\.(.+)|)/;st.event={global:{},add:function(t,e,r,n,o){var i,s,a,l,u,c,p,h,_,d,f,m=St.get(t);if(m)for(r.handler&&(i=r,r=i.handler,o=i.selector),r.guid||(r.guid=st.guid++),(l=m.events)||(l=m.events={}),(s=m.handle)||(s=m.handle=function(e){return"undefined"!=typeof st&&st.event.triggered!==e.type?st.event.dispatch.apply(t,arguments):void 0}),e=(e||"").match(wt)||[""],u=e.length;u--;)a=Bt.exec(e[u])||[],_=f=a[1],d=(a[2]||"").split(".").sort(),_&&(p=st.event.special[_]||{},_=(o?p.delegateType:p.bindType)||_,p=st.event.special[_]||{},c=st.extend({type:_,origType:f,data:n,handler:r,guid:r.guid,selector:o,needsContext:o&&st.expr.match.needsContext.test(o),namespace:d.join(".")},i),(h=l[_])||(h=l[_]=[],h.delegateCount=0,p.setup&&p.setup.call(t,n,d,s)!==!1||t.addEventListener&&t.addEventListener(_,s)),p.add&&(p.add.call(t,c),c.handler.guid||(c.handler.guid=r.guid)),o?h.splice(h.delegateCount++,0,c):h.push(c),st.event.global[_]=!0)},remove:function(t,e,r,n,o){var i,s,a,l,u,c,p,h,_,d,f,m=St.hasData(t)&&St.get(t);if(m&&(l=m.events)){for(e=(e||"").match(wt)||[""],u=e.length;u--;)if(a=Bt.exec(e[u])||[],_=f=a[1],d=(a[2]||"").split(".").sort(),_){for(p=st.event.special[_]||{},_=(n?p.delegateType:p.bindType)||_,h=l[_]||[],a=a[2]&&new RegExp("(^|\\.)"+d.join("\\.(?:.*\\.|)")+"(\\.|$)"),s=i=h.length;i--;)c=h[i],!o&&f!==c.origType||r&&r.guid!==c.guid||a&&!a.test(c.namespace)||n&&n!==c.selector&&("**"!==n||!c.selector)||(h.splice(i,1),
|
|
c.selector&&h.delegateCount--,p.remove&&p.remove.call(t,c));s&&!h.length&&(p.teardown&&p.teardown.call(t,d,m.handle)!==!1||st.removeEvent(t,_,m.handle),delete l[_])}else for(_ in l)st.event.remove(t,_+e[u],r,n,!0);st.isEmptyObject(l)&&St.remove(t,"handle events")}},dispatch:function(t){t=st.event.fix(t);var e,r,n,o,i,s=[],a=K.call(arguments),l=(St.get(this,"events")||{})[t.type]||[],u=st.event.special[t.type]||{};if(a[0]=t,t.delegateTarget=this,!u.preDispatch||u.preDispatch.call(this,t)!==!1){for(s=st.event.handlers.call(this,t,l),e=0;(o=s[e++])&&!t.isPropagationStopped();)for(t.currentTarget=o.elem,r=0;(i=o.handlers[r++])&&!t.isImmediatePropagationStopped();)t.rnamespace&&!t.rnamespace.test(i.namespace)||(t.handleObj=i,t.data=i.data,n=((st.event.special[i.origType]||{}).handle||i.handler).apply(o.elem,a),void 0!==n&&(t.result=n)===!1&&(t.preventDefault(),t.stopPropagation()));return u.postDispatch&&u.postDispatch.call(this,t),t.result}},handlers:function(t,e){var r,n,o,i,s=[],a=e.delegateCount,l=t.target;if(a&&l.nodeType&&("click"!==t.type||isNaN(t.button)||t.button<1))for(;l!==this;l=l.parentNode||this)if(1===l.nodeType&&(l.disabled!==!0||"click"!==t.type)){for(n=[],r=0;r<a;r++)i=e[r],o=i.selector+" ",void 0===n[o]&&(n[o]=i.needsContext?st(o,this).index(l)>-1:st.find(o,this,null,[l]).length),n[o]&&n.push(i);n.length&&s.push({elem:l,handlers:n})}return a<e.length&&s.push({elem:this,handlers:e.slice(a)}),s},props:"altKey bubbles cancelable ctrlKey currentTarget detail eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "),fixHooks:{},keyHooks:{props:"char charCode key keyCode".split(" "),filter:function(t,e){return null==t.which&&(t.which=null!=e.charCode?e.charCode:e.keyCode),t}},mouseHooks:{props:"button buttons clientX clientY offsetX offsetY pageX pageY screenX screenY toElement".split(" "),filter:function(t,e){var r,n,o,i=e.button;return null==t.pageX&&null!=e.clientX&&(r=t.target.ownerDocument||J,n=r.documentElement,o=r.body,t.pageX=e.clientX+(n&&n.scrollLeft||o&&o.scrollLeft||0)-(n&&n.clientLeft||o&&o.clientLeft||0),t.pageY=e.clientY+(n&&n.scrollTop||o&&o.scrollTop||0)-(n&&n.clientTop||o&&o.clientTop||0)),t.which||void 0===i||(t.which=1&i?1:2&i?3:4&i?2:0),t}},fix:function(t){if(t[st.expando])return t;var e,r,n,o=t.type,i=t,s=this.fixHooks[o];for(s||(this.fixHooks[o]=s=Lt.test(o)?this.mouseHooks:Rt.test(o)?this.keyHooks:{}),n=s.props?this.props.concat(s.props):this.props,t=new st.Event(i),e=n.length;e--;)r=n[e],t[r]=i[r];return t.target||(t.target=J),3===t.target.nodeType&&(t.target=t.target.parentNode),s.filter?s.filter(t,i):t},special:{load:{noBubble:!0},focus:{trigger:function(){if(this!==m()&&this.focus)return this.focus(),!1},delegateType:"focusin"},blur:{trigger:function(){if(this===m()&&this.blur)return this.blur(),!1},delegateType:"focusout"},click:{trigger:function(){if("checkbox"===this.type&&this.click&&st.nodeName(this,"input"))return this.click(),!1},_default:function(t){return st.nodeName(t.target,"a")}},beforeunload:{postDispatch:function(t){void 0!==t.result&&t.originalEvent&&(t.originalEvent.returnValue=t.result)}}}},st.removeEvent=function(t,e,r){t.removeEventListener&&t.removeEventListener(e,r)},st.Event=function(t,e){return this instanceof st.Event?(t&&t.type?(this.originalEvent=t,this.type=t.type,this.isDefaultPrevented=t.defaultPrevented||void 0===t.defaultPrevented&&t.returnValue===!1?d:f):this.type=t,e&&st.extend(this,e),this.timeStamp=t&&t.timeStamp||st.now(),void(this[st.expando]=!0)):new st.Event(t,e)},st.Event.prototype={constructor:st.Event,isDefaultPrevented:f,isPropagationStopped:f,isImmediatePropagationStopped:f,isSimulated:!1,preventDefault:function(){var t=this.originalEvent;this.isDefaultPrevented=d,t&&!this.isSimulated&&t.preventDefault()},stopPropagation:function(){var t=this.originalEvent;this.isPropagationStopped=d,t&&!this.isSimulated&&t.stopPropagation()},stopImmediatePropagation:function(){var t=this.originalEvent;this.isImmediatePropagationStopped=d,t&&!this.isSimulated&&t.stopImmediatePropagation(),this.stopPropagation()}},st.each({mouseenter:"mouseover",mouseleave:"mouseout",pointerenter:"pointerover",pointerleave:"pointerout"},function(t,e){st.event.special[t]={delegateType:e,bindType:e,handle:function(t){var r,n=this,o=t.relatedTarget,i=t.handleObj;return o&&(o===n||st.contains(n,o))||(t.type=i.origType,r=i.handler.apply(this,arguments),t.type=e),r}}}),st.fn.extend({on:function(t,e,r,n){return g(this,t,e,r,n)},one:function(t,e,r,n){return g(this,t,e,r,n,1)},off:function(t,e,r){var n,o;if(t&&t.preventDefault&&t.handleObj)return n=t.handleObj,st(t.delegateTarget).off(n.namespace?n.origType+"."+n.namespace:n.origType,n.selector,n.handler),this;if("object"==typeof t){for(o in t)this.off(o,e,t[o]);return this}return e!==!1&&"function"!=typeof e||(r=e,e=void 0),r===!1&&(r=f),this.each(function(){st.event.remove(this,t,r,e)})}});var Vt=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:-]+)[^>]*)\/>/gi,Gt=/<script|<style|<link/i,Ut=/checked\s*(?:[^=]|=\s*.checked.)/i,Yt=/^true\/(.*)/,Ht=/^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g;st.extend({htmlPrefilter:function(t){return t.replace(Vt,"<$1></$2>")},clone:function(t,e,r){var n,o,i,s,a=t.cloneNode(!0),l=st.contains(t.ownerDocument,t);if(!(ot.noCloneChecked||1!==t.nodeType&&11!==t.nodeType||st.isXMLDoc(t)))for(s=p(a),i=p(t),n=0,o=i.length;n<o;n++)w(i[n],s[n]);if(e)if(r)for(i=i||p(t),s=s||p(a),n=0,o=i.length;n<o;n++)x(i[n],s[n]);else x(t,a);return s=p(a,"script"),s.length>0&&h(s,!l&&p(t,"script")),a},cleanData:function(t){for(var e,r,n,o=st.event.special,i=0;void 0!==(r=t[i]);i++)if(Tt(r)){if(e=r[St.expando]){if(e.events)for(n in e.events)o[n]?st.event.remove(r,n):st.removeEvent(r,n,e.handle);r[St.expando]=void 0}r[zt.expando]&&(r[zt.expando]=void 0)}}}),st.fn.extend({domManip:k,detach:function(t){return M(this,t,!0)},remove:function(t){return M(this,t)},text:function(t){return Mt(this,function(t){return void 0===t?st.text(this):this.empty().each(function(){1!==this.nodeType&&11!==this.nodeType&&9!==this.nodeType||(this.textContent=t)})},null,t,arguments.length)},append:function(){return k(this,arguments,function(t){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var e=y(this,t);e.appendChild(t)}})},prepend:function(){return k(this,arguments,function(t){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var e=y(this,t);e.insertBefore(t,e.firstChild)}})},before:function(){return k(this,arguments,function(t){this.parentNode&&this.parentNode.insertBefore(t,this)})},after:function(){return k(this,arguments,function(t){this.parentNode&&this.parentNode.insertBefore(t,this.nextSibling)})},empty:function(){for(var t,e=0;null!=(t=this[e]);e++)1===t.nodeType&&(st.cleanData(p(t,!1)),t.textContent="");return this},clone:function(t,e){return t=null!=t&&t,e=null==e?t:e,this.map(function(){return st.clone(this,t,e)})},html:function(t){return Mt(this,function(t){var e=this[0]||{},r=0,n=this.length;if(void 0===t&&1===e.nodeType)return e.innerHTML;if("string"==typeof t&&!Gt.test(t)&&!qt[(Dt.exec(t)||["",""])[1].toLowerCase()]){t=st.htmlPrefilter(t);try{for(;r<n;r++)e=this[r]||{},1===e.nodeType&&(st.cleanData(p(e,!1)),e.innerHTML=t);e=0}catch(o){}}e&&this.empty().append(t)},null,t,arguments.length)},replaceWith:function(){var t=[];return k(this,arguments,function(e){var r=this.parentNode;st.inArray(this,t)<0&&(st.cleanData(p(this)),r&&r.replaceChild(e,this))},t)}}),st.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(t,e){st.fn[t]=function(t){for(var r,n=[],o=st(t),i=o.length-1,s=0;s<=i;s++)r=s===i?this:this.clone(!0),st(o[s])[e](r),Z.apply(n,r.get());return this.pushStack(n)}});var Xt,$t={HTML:"block",BODY:"block"},Wt=/^margin/,Jt=new RegExp("^("+Ct+")(?!px)[a-z%]+$","i"),Kt=function(t){var r=t.ownerDocument.defaultView;return r&&r.opener||(r=e),r.getComputedStyle(t)},Qt=function(t,e,r,n){var o,i,s={};for(i in e)s[i]=t.style[i],t.style[i]=e[i];o=r.apply(t,n||[]);for(i in e)t.style[i]=s[i];return o},Zt=J.documentElement;!function(){function t(){a.style.cssText="-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;position:relative;display:block;margin:auto;border:1px;padding:1px;top:1%;width:50%",a.innerHTML="",Zt.appendChild(s);var t=e.getComputedStyle(a);r="1%"!==t.top,i="2px"===t.marginLeft,n="4px"===t.width,a.style.marginRight="50%",o="4px"===t.marginRight,Zt.removeChild(s)}var r,n,o,i,s=J.createElement("div"),a=J.createElement("div");a.style&&(a.style.backgroundClip="content-box",a.cloneNode(!0).style.backgroundClip="",ot.clearCloneStyle="content-box"===a.style.backgroundClip,s.style.cssText="border:0;width:8px;height:0;top:0;left:-9999px;padding:0;margin-top:1px;position:absolute",s.appendChild(a),st.extend(ot,{pixelPosition:function(){return t(),r},boxSizingReliable:function(){return null==n&&t(),n},pixelMarginRight:function(){return null==n&&t(),o},reliableMarginLeft:function(){return null==n&&t(),i},reliableMarginRight:function(){var t,r=a.appendChild(J.createElement("div"));return r.style.cssText=a.style.cssText="-webkit-box-sizing:content-box;box-sizing:content-box;display:block;margin:0;border:0;padding:0",r.style.marginRight=r.style.width="0",a.style.width="1px",Zt.appendChild(s),t=!parseFloat(e.getComputedStyle(r).marginRight),Zt.removeChild(s),a.removeChild(r),t}}))}();var te=/^(none|table(?!-c[ea]).+)/,ee={position:"absolute",visibility:"hidden",display:"block"},re={letterSpacing:"0",fontWeight:"400"},ne=["Webkit","O","Moz","ms"],oe=J.createElement("div").style;st.extend({cssHooks:{opacity:{get:function(t,e){if(e){var r=z(t,"opacity");return""===r?"1":r}}}},cssNumber:{animationIterationCount:!0,columnCount:!0,fillOpacity:!0,flexGrow:!0,flexShrink:!0,fontWeight:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{"float":"cssFloat"},style:function(t,e,r,n){if(t&&3!==t.nodeType&&8!==t.nodeType&&t.style){var o,i,s,a=st.camelCase(e),l=t.style;return e=st.cssProps[a]||(st.cssProps[a]=A(a)||a),s=st.cssHooks[e]||st.cssHooks[a],void 0===r?s&&"get"in s&&void 0!==(o=s.get(t,!1,n))?o:l[e]:(i=typeof r,"string"===i&&(o=jt.exec(r))&&o[1]&&(r=c(t,e,o),i="number"),null!=r&&r===r&&("number"===i&&(r+=o&&o[3]||(st.cssNumber[a]?"":"px")),ot.clearCloneStyle||""!==r||0!==e.indexOf("background")||(l[e]="inherit"),s&&"set"in s&&void 0===(r=s.set(t,r,n))||(l[e]=r)),void 0)}},css:function(t,e,r,n){var o,i,s,a=st.camelCase(e);return e=st.cssProps[a]||(st.cssProps[a]=A(a)||a),s=st.cssHooks[e]||st.cssHooks[a],s&&"get"in s&&(o=s.get(t,!0,r)),void 0===o&&(o=z(t,e,n)),"normal"===o&&e in re&&(o=re[e]),""===r||r?(i=parseFloat(o),r===!0||isFinite(i)?i||0:o):o}}),st.each(["height","width"],function(t,e){st.cssHooks[e]={get:function(t,r,n){if(r)return te.test(st.css(t,"display"))&&0===t.offsetWidth?Qt(t,ee,function(){return P(t,e,n)}):P(t,e,n)},set:function(t,r,n){var o,i=n&&Kt(t),s=n&&j(t,e,n,"border-box"===st.css(t,"boxSizing",!1,i),i);return s&&(o=jt.exec(r))&&"px"!==(o[3]||"px")&&(t.style[e]=r,r=st.css(t,e)),C(t,r,s)}}}),st.cssHooks.marginLeft=E(ot.reliableMarginLeft,function(t,e){if(e)return(parseFloat(z(t,"marginLeft"))||t.getBoundingClientRect().left-Qt(t,{marginLeft:0},function(){return t.getBoundingClientRect().left}))+"px"}),st.cssHooks.marginRight=E(ot.reliableMarginRight,function(t,e){if(e)return Qt(t,{display:"inline-block"},z,[t,"marginRight"])}),st.each({margin:"",padding:"",border:"Width"},function(t,e){st.cssHooks[t+e]={expand:function(r){for(var n=0,o={},i="string"==typeof r?r.split(" "):[r];n<4;n++)o[t+Pt[n]+e]=i[n]||i[n-2]||i[0];return o}},Wt.test(t)||(st.cssHooks[t+e].set=C)}),st.fn.extend({css:function(t,e){return Mt(this,function(t,e,r){var n,o,i={},s=0;if(st.isArray(e)){for(n=Kt(t),o=e.length;s<o;s++)i[e[s]]=st.css(t,e[s],!1,n);return i}return void 0!==r?st.style(t,e,r):st.css(t,e)},t,e,arguments.length>1)},show:function(){return N(this,!0)},hide:function(){return N(this)},toggle:function(t){return"boolean"==typeof t?t?this.show():this.hide():this.each(function(){Nt(this)?st(this).show():st(this).hide()})}}),st.Tween=O,O.prototype={constructor:O,init:function(t,e,r,n,o,i){this.elem=t,this.prop=r,this.easing=o||st.easing._default,this.options=e,this.start=this.now=this.cur(),this.end=n,this.unit=i||(st.cssNumber[r]?"":"px")},cur:function(){var t=O.propHooks[this.prop];return t&&t.get?t.get(this):O.propHooks._default.get(this)},run:function(t){var e,r=O.propHooks[this.prop];return this.options.duration?this.pos=e=st.easing[this.easing](t,this.options.duration*t,0,1,this.options.duration):this.pos=e=t,this.now=(this.end-this.start)*e+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),r&&r.set?r.set(this):O.propHooks._default.set(this),this}},O.prototype.init.prototype=O.prototype,O.propHooks={_default:{get:function(t){var e;return 1!==t.elem.nodeType||null!=t.elem[t.prop]&&null==t.elem.style[t.prop]?t.elem[t.prop]:(e=st.css(t.elem,t.prop,""),e&&"auto"!==e?e:0)},set:function(t){st.fx.step[t.prop]?st.fx.step[t.prop](t):1!==t.elem.nodeType||null==t.elem.style[st.cssProps[t.prop]]&&!st.cssHooks[t.prop]?t.elem[t.prop]=t.now:st.style(t.elem,t.prop,t.now+t.unit)}}},O.propHooks.scrollTop=O.propHooks.scrollLeft={set:function(t){t.elem.nodeType&&t.elem.parentNode&&(t.elem[t.prop]=t.now)}},st.easing={linear:function(t){return t},swing:function(t){return.5-Math.cos(t*Math.PI)/2},_default:"swing"},st.fx=O.prototype.init,st.fx.step={};var ie,se,ae=/^(?:toggle|show|hide)$/,le=/queueHooks$/;st.Animation=st.extend(L,{tweeners:{"*":[function(t,e){var r=this.createTween(t,e);return c(r.elem,t,jt.exec(e),r),r}]},tweener:function(t,e){st.isFunction(t)?(e=t,t=["*"]):t=t.match(wt);for(var r,n=0,o=t.length;n<o;n++)r=t[n],L.tweeners[r]=L.tweeners[r]||[],L.tweeners[r].unshift(e)},prefilters:[I],prefilter:function(t,e){e?L.prefilters.unshift(t):L.prefilters.push(t)}}),st.speed=function(t,e,r){var n=t&&"object"==typeof t?st.extend({},t):{complete:r||!r&&e||st.isFunction(t)&&t,duration:t,easing:r&&e||e&&!st.isFunction(e)&&e};return n.duration=st.fx.off?0:"number"==typeof n.duration?n.duration:n.duration in st.fx.speeds?st.fx.speeds[n.duration]:st.fx.speeds._default,null!=n.queue&&n.queue!==!0||(n.queue="fx"),n.old=n.complete,n.complete=function(){st.isFunction(n.old)&&n.old.call(this),n.queue&&st.dequeue(this,n.queue)},n},st.fn.extend({fadeTo:function(t,e,r,n){return this.filter(Nt).css("opacity",0).show().end().animate({opacity:e},t,r,n)},animate:function(t,e,r,n){var o=st.isEmptyObject(t),i=st.speed(e,r,n),s=function(){var e=L(this,st.extend({},t),i);(o||St.get(this,"finish"))&&e.stop(!0)};return s.finish=s,o||i.queue===!1?this.each(s):this.queue(i.queue,s)},stop:function(t,e,r){var n=function(t){var e=t.stop;delete t.stop,e(r)};return"string"!=typeof t&&(r=e,e=t,t=void 0),e&&t!==!1&&this.queue(t||"fx",[]),this.each(function(){var e=!0,o=null!=t&&t+"queueHooks",i=st.timers,s=St.get(this);if(o)s[o]&&s[o].stop&&n(s[o]);else for(o in s)s[o]&&s[o].stop&&le.test(o)&&n(s[o]);for(o=i.length;o--;)i[o].elem!==this||null!=t&&i[o].queue!==t||(i[o].anim.stop(r),e=!1,i.splice(o,1));!e&&r||st.dequeue(this,t)})},finish:function(t){return t!==!1&&(t=t||"fx"),this.each(function(){var e,r=St.get(this),n=r[t+"queue"],o=r[t+"queueHooks"],i=st.timers,s=n?n.length:0;for(r.finish=!0,st.queue(this,t,[]),o&&o.stop&&o.stop.call(this,!0),e=i.length;e--;)i[e].elem===this&&i[e].queue===t&&(i[e].anim.stop(!0),i.splice(e,1));for(e=0;e<s;e++)n[e]&&n[e].finish&&n[e].finish.call(this);delete r.finish})}}),st.each(["toggle","show","hide"],function(t,e){var r=st.fn[e];st.fn[e]=function(t,n,o){return null==t||"boolean"==typeof t?r.apply(this,arguments):this.animate(F(e,!0),t,n,o)}}),st.each({slideDown:F("show"),slideUp:F("hide"),slideToggle:F("toggle"),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(t,e){st.fn[t]=function(t,r,n){return this.animate(e,t,r,n)}}),st.timers=[],st.fx.tick=function(){var t,e=0,r=st.timers;for(ie=st.now();e<r.length;e++)t=r[e],t()||r[e]!==t||r.splice(e--,1);r.length||st.fx.stop(),ie=void 0},st.fx.timer=function(t){st.timers.push(t),t()?st.fx.start():st.timers.pop()},st.fx.interval=13,st.fx.start=function(){se||(se=e.setInterval(st.fx.tick,st.fx.interval))},st.fx.stop=function(){e.clearInterval(se),se=null},st.fx.speeds={slow:600,fast:200,_default:400},st.fn.delay=function(t,r){return t=st.fx?st.fx.speeds[t]||t:t,r=r||"fx",this.queue(r,function(r,n){var o=e.setTimeout(r,t);n.stop=function(){e.clearTimeout(o)}})},function(){var t=J.createElement("input"),e=J.createElement("select"),r=e.appendChild(J.createElement("option"));t.type="checkbox",ot.checkOn=""!==t.value,ot.optSelected=r.selected,e.disabled=!0,ot.optDisabled=!r.disabled,t=J.createElement("input"),t.value="t",t.type="radio",ot.radioValue="t"===t.value}();var ue,ce=st.expr.attrHandle;st.fn.extend({attr:function(t,e){return Mt(this,st.attr,t,e,arguments.length>1)},removeAttr:function(t){return this.each(function(){st.removeAttr(this,t)})}}),st.extend({attr:function(t,e,r){var n,o,i=t.nodeType;if(3!==i&&8!==i&&2!==i)return"undefined"==typeof t.getAttribute?st.prop(t,e,r):(1===i&&st.isXMLDoc(t)||(e=e.toLowerCase(),o=st.attrHooks[e]||(st.expr.match.bool.test(e)?ue:void 0)),void 0!==r?null===r?void st.removeAttr(t,e):o&&"set"in o&&void 0!==(n=o.set(t,r,e))?n:(t.setAttribute(e,r+""),r):o&&"get"in o&&null!==(n=o.get(t,e))?n:(n=st.find.attr(t,e),null==n?void 0:n))},attrHooks:{type:{set:function(t,e){if(!ot.radioValue&&"radio"===e&&st.nodeName(t,"input")){var r=t.value;return t.setAttribute("type",e),r&&(t.value=r),e}}}},removeAttr:function(t,e){var r,n,o=0,i=e&&e.match(wt);if(i&&1===t.nodeType)for(;r=i[o++];)n=st.propFix[r]||r,st.expr.match.bool.test(r)&&(t[n]=!1),t.removeAttribute(r)}}),ue={set:function(t,e,r){return e===!1?st.removeAttr(t,r):t.setAttribute(r,r),r}},st.each(st.expr.match.bool.source.match(/\w+/g),function(t,e){var r=ce[e]||st.find.attr;ce[e]=function(t,e,n){var o,i;return n||(i=ce[e],ce[e]=o,o=null!=r(t,e,n)?e.toLowerCase():null,ce[e]=i),o}});var pe=/^(?:input|select|textarea|button)$/i,he=/^(?:a|area)$/i;st.fn.extend({prop:function(t,e){return Mt(this,st.prop,t,e,arguments.length>1)},removeProp:function(t){return this.each(function(){delete this[st.propFix[t]||t]})}}),st.extend({prop:function(t,e,r){var n,o,i=t.nodeType;if(3!==i&&8!==i&&2!==i)return 1===i&&st.isXMLDoc(t)||(e=st.propFix[e]||e,o=st.propHooks[e]),void 0!==r?o&&"set"in o&&void 0!==(n=o.set(t,r,e))?n:t[e]=r:o&&"get"in o&&null!==(n=o.get(t,e))?n:t[e]},propHooks:{tabIndex:{get:function(t){var e=st.find.attr(t,"tabindex");return e?parseInt(e,10):pe.test(t.nodeName)||he.test(t.nodeName)&&t.href?0:-1}}},propFix:{"for":"htmlFor","class":"className"}}),ot.optSelected||(st.propHooks.selected={get:function(t){var e=t.parentNode;return e&&e.parentNode&&e.parentNode.selectedIndex,null},set:function(t){var e=t.parentNode;e&&(e.selectedIndex,e.parentNode&&e.parentNode.selectedIndex)}}),st.each(["tabIndex","readOnly","maxLength","cellSpacing","cellPadding","rowSpan","colSpan","useMap","frameBorder","contentEditable"],function(){st.propFix[this.toLowerCase()]=this});var _e=/[\t\r\n\f]/g;st.fn.extend({addClass:function(t){var e,r,n,o,i,s,a,l=0;if(st.isFunction(t))return this.each(function(e){st(this).addClass(t.call(this,e,B(this)))});if("string"==typeof t&&t)for(e=t.match(wt)||[];r=this[l++];)if(o=B(r),n=1===r.nodeType&&(" "+o+" ").replace(_e," ")){for(s=0;i=e[s++];)n.indexOf(" "+i+" ")<0&&(n+=i+" ");a=st.trim(n),o!==a&&r.setAttribute("class",a)}return this},removeClass:function(t){var e,r,n,o,i,s,a,l=0;if(st.isFunction(t))return this.each(function(e){st(this).removeClass(t.call(this,e,B(this)))});if(!arguments.length)return this.attr("class","");if("string"==typeof t&&t)for(e=t.match(wt)||[];r=this[l++];)if(o=B(r),n=1===r.nodeType&&(" "+o+" ").replace(_e," ")){for(s=0;i=e[s++];)for(;n.indexOf(" "+i+" ")>-1;)n=n.replace(" "+i+" "," ");a=st.trim(n),o!==a&&r.setAttribute("class",a)}return this},toggleClass:function(t,e){var r=typeof t;return"boolean"==typeof e&&"string"===r?e?this.addClass(t):this.removeClass(t):st.isFunction(t)?this.each(function(r){st(this).toggleClass(t.call(this,r,B(this),e),e)}):this.each(function(){var e,n,o,i;if("string"===r)for(n=0,o=st(this),i=t.match(wt)||[];e=i[n++];)o.hasClass(e)?o.removeClass(e):o.addClass(e);else void 0!==t&&"boolean"!==r||(e=B(this),e&&St.set(this,"__className__",e),this.setAttribute&&this.setAttribute("class",e||t===!1?"":St.get(this,"__className__")||""))})},hasClass:function(t){var e,r,n=0;for(e=" "+t+" ";r=this[n++];)if(1===r.nodeType&&(" "+B(r)+" ").replace(_e," ").indexOf(e)>-1)return!0;return!1}});var de=/\r/g,fe=/[\x20\t\r\n\f]+/g;st.fn.extend({val:function(t){var e,r,n,o=this[0];{if(arguments.length)return n=st.isFunction(t),this.each(function(r){var o;1===this.nodeType&&(o=n?t.call(this,r,st(this).val()):t,null==o?o="":"number"==typeof o?o+="":st.isArray(o)&&(o=st.map(o,function(t){return null==t?"":t+""})),e=st.valHooks[this.type]||st.valHooks[this.nodeName.toLowerCase()],e&&"set"in e&&void 0!==e.set(this,o,"value")||(this.value=o))});if(o)return e=st.valHooks[o.type]||st.valHooks[o.nodeName.toLowerCase()],e&&"get"in e&&void 0!==(r=e.get(o,"value"))?r:(r=o.value,"string"==typeof r?r.replace(de,""):null==r?"":r)}}}),st.extend({valHooks:{option:{get:function(t){var e=st.find.attr(t,"value");return null!=e?e:st.trim(st.text(t)).replace(fe," ")}},select:{get:function(t){for(var e,r,n=t.options,o=t.selectedIndex,i="select-one"===t.type||o<0,s=i?null:[],a=i?o+1:n.length,l=o<0?a:i?o:0;l<a;l++)if(r=n[l],(r.selected||l===o)&&(ot.optDisabled?!r.disabled:null===r.getAttribute("disabled"))&&(!r.parentNode.disabled||!st.nodeName(r.parentNode,"optgroup"))){if(e=st(r).val(),i)return e;s.push(e)}return s},set:function(t,e){for(var r,n,o=t.options,i=st.makeArray(e),s=o.length;s--;)n=o[s],(n.selected=st.inArray(st.valHooks.option.get(n),i)>-1)&&(r=!0);return r||(t.selectedIndex=-1),i}}}}),st.each(["radio","checkbox"],function(){st.valHooks[this]={set:function(t,e){if(st.isArray(e))return t.checked=st.inArray(st(t).val(),e)>-1}},ot.checkOn||(st.valHooks[this].get=function(t){return null===t.getAttribute("value")?"on":t.value})});var me=/^(?:focusinfocus|focusoutblur)$/;st.extend(st.event,{trigger:function(t,r,n,o){var i,s,a,l,u,c,p,h=[n||J],_=nt.call(t,"type")?t.type:t,d=nt.call(t,"namespace")?t.namespace.split("."):[];if(s=a=n=n||J,3!==n.nodeType&&8!==n.nodeType&&!me.test(_+st.event.triggered)&&(_.indexOf(".")>-1&&(d=_.split("."),_=d.shift(),d.sort()),u=_.indexOf(":")<0&&"on"+_,t=t[st.expando]?t:new st.Event(_,"object"==typeof t&&t),t.isTrigger=o?2:3,t.namespace=d.join("."),t.rnamespace=t.namespace?new RegExp("(^|\\.)"+d.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,t.result=void 0,t.target||(t.target=n),r=null==r?[t]:st.makeArray(r,[t]),p=st.event.special[_]||{},o||!p.trigger||p.trigger.apply(n,r)!==!1)){if(!o&&!p.noBubble&&!st.isWindow(n)){for(l=p.delegateType||_,me.test(l+_)||(s=s.parentNode);s;s=s.parentNode)h.push(s),a=s;a===(n.ownerDocument||J)&&h.push(a.defaultView||a.parentWindow||e)}for(i=0;(s=h[i++])&&!t.isPropagationStopped();)t.type=i>1?l:p.bindType||_,c=(St.get(s,"events")||{})[t.type]&&St.get(s,"handle"),c&&c.apply(s,r),c=u&&s[u],c&&c.apply&&Tt(s)&&(t.result=c.apply(s,r),t.result===!1&&t.preventDefault());return t.type=_,o||t.isDefaultPrevented()||p._default&&p._default.apply(h.pop(),r)!==!1||!Tt(n)||u&&st.isFunction(n[_])&&!st.isWindow(n)&&(a=n[u],a&&(n[u]=null),st.event.triggered=_,n[_](),st.event.triggered=void 0,a&&(n[u]=a)),t.result}},simulate:function(t,e,r){var n=st.extend(new st.Event,r,{type:t,isSimulated:!0});st.event.trigger(n,null,e)}}),st.fn.extend({trigger:function(t,e){return this.each(function(){st.event.trigger(t,e,this)})},triggerHandler:function(t,e){var r=this[0];if(r)return st.event.trigger(t,e,r,!0)}}),st.each("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error contextmenu".split(" "),function(t,e){st.fn[e]=function(t,r){return arguments.length>0?this.on(e,null,t,r):this.trigger(e)}}),st.fn.extend({hover:function(t,e){return this.mouseenter(t).mouseleave(e||t)}}),ot.focusin="onfocusin"in e,ot.focusin||st.each({focus:"focusin",blur:"focusout"},function(t,e){var r=function(t){st.event.simulate(e,t.target,st.event.fix(t))};st.event.special[e]={setup:function(){var n=this.ownerDocument||this,o=St.access(n,e);o||n.addEventListener(t,r,!0),St.access(n,e,(o||0)+1)},teardown:function(){var n=this.ownerDocument||this,o=St.access(n,e)-1;o?St.access(n,e,o):(n.removeEventListener(t,r,!0),St.remove(n,e))}}});var ge=e.location,ye=st.now(),ve=/\?/;st.parseJSON=function(t){return JSON.parse(t+"")},st.parseXML=function(t){var r;if(!t||"string"!=typeof t)return null;try{r=(new e.DOMParser).parseFromString(t,"text/xml")}catch(n){r=void 0}return r&&!r.getElementsByTagName("parsererror").length||st.error("Invalid XML: "+t),r};var be=/#.*$/,xe=/([?&])_=[^&]*/,we=/^(.*?):[ \t]*([^\r\n]*)$/gm,ke=/^(?:about|app|app-storage|.+-extension|file|res|widget):$/,Me=/^(?:GET|HEAD)$/,Te=/^\/\//,Se={},ze={},Ee="*/".concat("*"),Ae=J.createElement("a");Ae.href=ge.href,st.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:ge.href,type:"GET",isLocal:ke.test(ge.protocol),global:!0,processData:!0,async:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":Ee,text:"text/plain",html:"text/html",xml:"application/xml, text/xml",json:"application/json, text/javascript"},contents:{xml:/\bxml\b/,html:/\bhtml/,json:/\bjson\b/},responseFields:{xml:"responseXML",text:"responseText",json:"responseJSON"},converters:{"* text":String,"text html":!0,"text json":st.parseJSON,"text xml":st.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(t,e){return e?U(U(t,st.ajaxSettings),e):U(st.ajaxSettings,t)},ajaxPrefilter:V(Se),ajaxTransport:V(ze),ajax:function(t,r){function n(t,r,n,a){var u,p,y,v,x,k=r;2!==b&&(b=2,l&&e.clearTimeout(l),o=void 0,s=a||"",w.readyState=t>0?4:0,u=t>=200&&t<300||304===t,n&&(v=Y(h,w,n)),v=H(h,v,w,u),u?(h.ifModified&&(x=w.getResponseHeader("Last-Modified"),x&&(st.lastModified[i]=x),x=w.getResponseHeader("etag"),x&&(st.etag[i]=x)),204===t||"HEAD"===h.type?k="nocontent":304===t?k="notmodified":(k=v.state,p=v.data,y=v.error,u=!y)):(y=k,!t&&k||(k="error",t<0&&(t=0))),w.status=t,w.statusText=(r||k)+"",u?f.resolveWith(_,[p,k,w]):f.rejectWith(_,[w,k,y]),w.statusCode(g),g=void 0,c&&d.trigger(u?"ajaxSuccess":"ajaxError",[w,h,u?p:y]),m.fireWith(_,[w,k]),c&&(d.trigger("ajaxComplete",[w,h]),--st.active||st.event.trigger("ajaxStop")))}"object"==typeof t&&(r=t,t=void 0),r=r||{};var o,i,s,a,l,u,c,p,h=st.ajaxSetup({},r),_=h.context||h,d=h.context&&(_.nodeType||_.jquery)?st(_):st.event,f=st.Deferred(),m=st.Callbacks("once memory"),g=h.statusCode||{},y={},v={},b=0,x="canceled",w={readyState:0,getResponseHeader:function(t){var e;if(2===b){if(!a)for(a={};e=we.exec(s);)a[e[1].toLowerCase()]=e[2];e=a[t.toLowerCase()]}return null==e?null:e},getAllResponseHeaders:function(){return 2===b?s:null},setRequestHeader:function(t,e){var r=t.toLowerCase();return b||(t=v[r]=v[r]||t,y[t]=e),this},overrideMimeType:function(t){return b||(h.mimeType=t),this},statusCode:function(t){var e;if(t)if(b<2)for(e in t)g[e]=[g[e],t[e]];else w.always(t[w.status]);return this},abort:function(t){var e=t||x;return o&&o.abort(e),n(0,e),this}};if(f.promise(w).complete=m.add,w.success=w.done,w.error=w.fail,h.url=((t||h.url||ge.href)+"").replace(be,"").replace(Te,ge.protocol+"//"),h.type=r.method||r.type||h.method||h.type,h.dataTypes=st.trim(h.dataType||"*").toLowerCase().match(wt)||[""],null==h.crossDomain){u=J.createElement("a");try{u.href=h.url,u.href=u.href,h.crossDomain=Ae.protocol+"//"+Ae.host!=u.protocol+"//"+u.host}catch(k){h.crossDomain=!0}}if(h.data&&h.processData&&"string"!=typeof h.data&&(h.data=st.param(h.data,h.traditional)),G(Se,h,r,w),2===b)return w;c=st.event&&h.global,c&&0===st.active++&&st.event.trigger("ajaxStart"),h.type=h.type.toUpperCase(),h.hasContent=!Me.test(h.type),i=h.url,h.hasContent||(h.data&&(i=h.url+=(ve.test(i)?"&":"?")+h.data,delete h.data),h.cache===!1&&(h.url=xe.test(i)?i.replace(xe,"$1_="+ye++):i+(ve.test(i)?"&":"?")+"_="+ye++)),h.ifModified&&(st.lastModified[i]&&w.setRequestHeader("If-Modified-Since",st.lastModified[i]),st.etag[i]&&w.setRequestHeader("If-None-Match",st.etag[i])),(h.data&&h.hasContent&&h.contentType!==!1||r.contentType)&&w.setRequestHeader("Content-Type",h.contentType),w.setRequestHeader("Accept",h.dataTypes[0]&&h.accepts[h.dataTypes[0]]?h.accepts[h.dataTypes[0]]+("*"!==h.dataTypes[0]?", "+Ee+"; q=0.01":""):h.accepts["*"]);for(p in h.headers)w.setRequestHeader(p,h.headers[p]);if(h.beforeSend&&(h.beforeSend.call(_,w,h)===!1||2===b))return w.abort();x="abort";for(p in{success:1,error:1,complete:1})w[p](h[p]);if(o=G(ze,h,r,w)){if(w.readyState=1,c&&d.trigger("ajaxSend",[w,h]),2===b)return w;h.async&&h.timeout>0&&(l=e.setTimeout(function(){w.abort("timeout")},h.timeout));try{b=1,o.send(y,n)}catch(k){if(!(b<2))throw k;n(-1,k)}}else n(-1,"No Transport");return w},getJSON:function(t,e,r){return st.get(t,e,r,"json")},getScript:function(t,e){return st.get(t,void 0,e,"script")}}),st.each(["get","post"],function(t,e){st[e]=function(t,r,n,o){return st.isFunction(r)&&(o=o||n,n=r,r=void 0),st.ajax(st.extend({url:t,type:e,dataType:o,data:r,success:n},st.isPlainObject(t)&&t))}}),st._evalUrl=function(t){return st.ajax({url:t,type:"GET",dataType:"script",async:!1,global:!1,"throws":!0})},st.fn.extend({wrapAll:function(t){var e;return st.isFunction(t)?this.each(function(e){st(this).wrapAll(t.call(this,e))}):(this[0]&&(e=st(t,this[0].ownerDocument).eq(0).clone(!0),this[0].parentNode&&e.insertBefore(this[0]),e.map(function(){for(var t=this;t.firstElementChild;)t=t.firstElementChild;return t}).append(this)),this)},wrapInner:function(t){return st.isFunction(t)?this.each(function(e){st(this).wrapInner(t.call(this,e))}):this.each(function(){var e=st(this),r=e.contents();r.length?r.wrapAll(t):e.append(t)})},wrap:function(t){var e=st.isFunction(t);return this.each(function(r){st(this).wrapAll(e?t.call(this,r):t)})},unwrap:function(){return this.parent().each(function(){st.nodeName(this,"body")||st(this).replaceWith(this.childNodes)}).end()}}),st.expr.filters.hidden=function(t){return!st.expr.filters.visible(t)},st.expr.filters.visible=function(t){return t.offsetWidth>0||t.offsetHeight>0||t.getClientRects().length>0};var Ce=/%20/g,je=/\[\]$/,Pe=/\r?\n/g,Ne=/^(?:submit|button|image|reset|file)$/i,Oe=/^(?:input|select|textarea|keygen)/i;st.param=function(t,e){var r,n=[],o=function(t,e){e=st.isFunction(e)?e():null==e?"":e,n[n.length]=encodeURIComponent(t)+"="+encodeURIComponent(e)};if(void 0===e&&(e=st.ajaxSettings&&st.ajaxSettings.traditional),st.isArray(t)||t.jquery&&!st.isPlainObject(t))st.each(t,function(){o(this.name,this.value)});else for(r in t)X(r,t[r],e,o);return n.join("&").replace(Ce,"+")},st.fn.extend({serialize:function(){return st.param(this.serializeArray())},serializeArray:function(){return this.map(function(){var t=st.prop(this,"elements");return t?st.makeArray(t):this}).filter(function(){var t=this.type;return this.name&&!st(this).is(":disabled")&&Oe.test(this.nodeName)&&!Ne.test(t)&&(this.checked||!Ot.test(t))}).map(function(t,e){var r=st(this).val();return null==r?null:st.isArray(r)?st.map(r,function(t){return{name:e.name,value:t.replace(Pe,"\r\n")}}):{name:e.name,value:r.replace(Pe,"\r\n")}}).get()}}),st.ajaxSettings.xhr=function(){try{return new e.XMLHttpRequest}catch(t){}};var De={0:200,1223:204},Fe=st.ajaxSettings.xhr();ot.cors=!!Fe&&"withCredentials"in Fe,ot.ajax=Fe=!!Fe,st.ajaxTransport(function(t){var r,n;if(ot.cors||Fe&&!t.crossDomain)return{send:function(o,i){var s,a=t.xhr();if(a.open(t.type,t.url,t.async,t.username,t.password),t.xhrFields)for(s in t.xhrFields)a[s]=t.xhrFields[s];t.mimeType&&a.overrideMimeType&&a.overrideMimeType(t.mimeType),t.crossDomain||o["X-Requested-With"]||(o["X-Requested-With"]="XMLHttpRequest");
|
|
for(s in o)a.setRequestHeader(s,o[s]);r=function(t){return function(){r&&(r=n=a.onload=a.onerror=a.onabort=a.onreadystatechange=null,"abort"===t?a.abort():"error"===t?"number"!=typeof a.status?i(0,"error"):i(a.status,a.statusText):i(De[a.status]||a.status,a.statusText,"text"!==(a.responseType||"text")||"string"!=typeof a.responseText?{binary:a.response}:{text:a.responseText},a.getAllResponseHeaders()))}},a.onload=r(),n=a.onerror=r("error"),void 0!==a.onabort?a.onabort=n:a.onreadystatechange=function(){4===a.readyState&&e.setTimeout(function(){r&&n()})},r=r("abort");try{a.send(t.hasContent&&t.data||null)}catch(l){if(r)throw l}},abort:function(){r&&r()}}}),st.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/\b(?:java|ecma)script\b/},converters:{"text script":function(t){return st.globalEval(t),t}}}),st.ajaxPrefilter("script",function(t){void 0===t.cache&&(t.cache=!1),t.crossDomain&&(t.type="GET")}),st.ajaxTransport("script",function(t){if(t.crossDomain){var e,r;return{send:function(n,o){e=st("<script>").prop({charset:t.scriptCharset,src:t.url}).on("load error",r=function(t){e.remove(),r=null,t&&o("error"===t.type?404:200,t.type)}),J.head.appendChild(e[0])},abort:function(){r&&r()}}}});var qe=[],Ie=/(=)\?(?=&|$)|\?\?/;st.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var t=qe.pop()||st.expando+"_"+ye++;return this[t]=!0,t}}),st.ajaxPrefilter("json jsonp",function(t,r,n){var o,i,s,a=t.jsonp!==!1&&(Ie.test(t.url)?"url":"string"==typeof t.data&&0===(t.contentType||"").indexOf("application/x-www-form-urlencoded")&&Ie.test(t.data)&&"data");if(a||"jsonp"===t.dataTypes[0])return o=t.jsonpCallback=st.isFunction(t.jsonpCallback)?t.jsonpCallback():t.jsonpCallback,a?t[a]=t[a].replace(Ie,"$1"+o):t.jsonp!==!1&&(t.url+=(ve.test(t.url)?"&":"?")+t.jsonp+"="+o),t.converters["script json"]=function(){return s||st.error(o+" was not called"),s[0]},t.dataTypes[0]="json",i=e[o],e[o]=function(){s=arguments},n.always(function(){void 0===i?st(e).removeProp(o):e[o]=i,t[o]&&(t.jsonpCallback=r.jsonpCallback,qe.push(o)),s&&st.isFunction(i)&&i(s[0]),s=i=void 0}),"script"}),st.parseHTML=function(t,e,r){if(!t||"string"!=typeof t)return null;"boolean"==typeof e&&(r=e,e=!1),e=e||J;var n=ft.exec(t),o=!r&&[];return n?[e.createElement(n[1])]:(n=_([t],e,o),o&&o.length&&st(o).remove(),st.merge([],n.childNodes))};var Re=st.fn.load;st.fn.load=function(t,e,r){if("string"!=typeof t&&Re)return Re.apply(this,arguments);var n,o,i,s=this,a=t.indexOf(" ");return a>-1&&(n=st.trim(t.slice(a)),t=t.slice(0,a)),st.isFunction(e)?(r=e,e=void 0):e&&"object"==typeof e&&(o="POST"),s.length>0&&st.ajax({url:t,type:o||"GET",dataType:"html",data:e}).done(function(t){i=arguments,s.html(n?st("<div>").append(st.parseHTML(t)).find(n):t)}).always(r&&function(t,e){s.each(function(){r.apply(this,i||[t.responseText,e,t])})}),this},st.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(t,e){st.fn[e]=function(t){return this.on(e,t)}}),st.expr.filters.animated=function(t){return st.grep(st.timers,function(e){return t===e.elem}).length},st.offset={setOffset:function(t,e,r){var n,o,i,s,a,l,u,c=st.css(t,"position"),p=st(t),h={};"static"===c&&(t.style.position="relative"),a=p.offset(),i=st.css(t,"top"),l=st.css(t,"left"),u=("absolute"===c||"fixed"===c)&&(i+l).indexOf("auto")>-1,u?(n=p.position(),s=n.top,o=n.left):(s=parseFloat(i)||0,o=parseFloat(l)||0),st.isFunction(e)&&(e=e.call(t,r,st.extend({},a))),null!=e.top&&(h.top=e.top-a.top+s),null!=e.left&&(h.left=e.left-a.left+o),"using"in e?e.using.call(t,h):p.css(h)}},st.fn.extend({offset:function(t){if(arguments.length)return void 0===t?this:this.each(function(e){st.offset.setOffset(this,t,e)});var e,r,n=this[0],o={top:0,left:0},i=n&&n.ownerDocument;if(i)return e=i.documentElement,st.contains(e,n)?(o=n.getBoundingClientRect(),r=$(i),{top:o.top+r.pageYOffset-e.clientTop,left:o.left+r.pageXOffset-e.clientLeft}):o},position:function(){if(this[0]){var t,e,r=this[0],n={top:0,left:0};return"fixed"===st.css(r,"position")?e=r.getBoundingClientRect():(t=this.offsetParent(),e=this.offset(),st.nodeName(t[0],"html")||(n=t.offset()),n.top+=st.css(t[0],"borderTopWidth",!0),n.left+=st.css(t[0],"borderLeftWidth",!0)),{top:e.top-n.top-st.css(r,"marginTop",!0),left:e.left-n.left-st.css(r,"marginLeft",!0)}}},offsetParent:function(){return this.map(function(){for(var t=this.offsetParent;t&&"static"===st.css(t,"position");)t=t.offsetParent;return t||Zt})}}),st.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(t,e){var r="pageYOffset"===e;st.fn[t]=function(n){return Mt(this,function(t,n,o){var i=$(t);return void 0===o?i?i[e]:t[n]:void(i?i.scrollTo(r?i.pageXOffset:o,r?o:i.pageYOffset):t[n]=o)},t,n,arguments.length)}}),st.each(["top","left"],function(t,e){st.cssHooks[e]=E(ot.pixelPosition,function(t,r){if(r)return r=z(t,e),Jt.test(r)?st(t).position()[e]+"px":r})}),st.each({Height:"height",Width:"width"},function(t,e){st.each({padding:"inner"+t,content:e,"":"outer"+t},function(r,n){st.fn[n]=function(n,o){var i=arguments.length&&(r||"boolean"!=typeof n),s=r||(n===!0||o===!0?"margin":"border");return Mt(this,function(e,r,n){var o;return st.isWindow(e)?e.document.documentElement["client"+t]:9===e.nodeType?(o=e.documentElement,Math.max(e.body["scroll"+t],o["scroll"+t],e.body["offset"+t],o["offset"+t],o["client"+t])):void 0===n?st.css(e,r,s):st.style(e,r,n,s)},e,i?n:void 0,i,null)}})}),st.fn.extend({bind:function(t,e,r){return this.on(t,null,e,r)},unbind:function(t,e){return this.off(t,null,e)},delegate:function(t,e,r,n){return this.on(e,t,r,n)},undelegate:function(t,e,r){return 1===arguments.length?this.off(t,"**"):this.off(e,t||"**",r)},size:function(){return this.length}}),st.fn.andSelf=st.fn.addBack,"function"==typeof t&&t.amd&&t("jquery",[],function(){return st});var Le=e.jQuery,Be=e.$;return st.noConflict=function(t){return e.$===st&&(e.$=Be),t&&e.jQuery===st&&(e.jQuery=Le),st},r||(e.jQuery=e.$=st),st})},{}],numbro:[function(t,e,r){function n(t){this._value=t}function o(t){var e,r="";for(e=0;e<t;e++)r+="0";return r}function i(t,e){var r,n,i,s,a;return a=t.toString(),r=a.split("e")[0],s=a.split("e")[1],n=r.split(".")[0],i=r.split(".")[1]||"",a=n+i+o(s-i.length),e>0&&(a+="."+o(e)),a}function s(t,e,r,n){var o,s,a=Math.pow(10,e);return s=t.toFixed(0).search("e")>-1?i(t,e):(r(t*a)/a).toFixed(e),n&&(o=new RegExp("0{1,"+n+"}$"),s=s.replace(o,"")),s}function a(t,e,r){var n;return n=e.indexOf("$")>-1?l(t,e,r):e.indexOf("%")>-1?u(t,e,r):e.indexOf(":")>-1?c(t):p(t,e,r)}function l(t,e,r){var n,o,i=e,s=i.indexOf("$"),a=i.indexOf("("),l=i.indexOf("+"),u=i.indexOf("-"),c="",h="";if(i.indexOf("$")===-1?"infix"===y[b].currency.position?(h=y[b].currency.symbol,y[b].currency.spaceSeparated&&(h=" "+h+" ")):y[b].currency.spaceSeparated&&(c=" "):i.indexOf(" $")>-1?(c=" ",i=i.replace(" $","")):i.indexOf("$ ")>-1?(c=" ",i=i.replace("$ ","")):i=i.replace("$",""),o=p(t,i,r,h),e.indexOf("$")===-1)switch(y[b].currency.position){case"postfix":o.indexOf(")")>-1?(o=o.split(""),o.splice(-1,0,c+y[b].currency.symbol),o=o.join("")):o=o+c+y[b].currency.symbol;break;case"infix":break;case"prefix":o.indexOf("(")>-1||o.indexOf("-")>-1?(o=o.split(""),n=Math.max(a,u)+1,o.splice(n,0,y[b].currency.symbol+c),o=o.join("")):o=y[b].currency.symbol+c+o;break;default:throw Error('Currency position should be among ["prefix", "infix", "postfix"]')}else s<=1?o.indexOf("(")>-1||o.indexOf("+")>-1||o.indexOf("-")>-1?(o=o.split(""),n=1,(s<a||s<l||s<u)&&(n=0),o.splice(n,0,y[b].currency.symbol+c),o=o.join("")):o=y[b].currency.symbol+c+o:o.indexOf(")")>-1?(o=o.split(""),o.splice(-1,0,c+y[b].currency.symbol),o=o.join("")):o=o+c+y[b].currency.symbol;return o}function u(t,e,r){var n,o="";return t=100*t,e.indexOf(" %")>-1?(o=" ",e=e.replace(" %","")):e=e.replace("%",""),n=p(t,e,r),n.indexOf(")")>-1?(n=n.split(""),n.splice(-1,0,o+"%"),n=n.join("")):n=n+o+"%",n}function c(t){var e=Math.floor(t/60/60),r=Math.floor((t-60*e*60)/60),n=Math.round(t-60*e*60-60*r);return e+":"+(r<10?"0"+r:r)+":"+(n<10?"0"+n:n)}function p(t,e,r,n){var o,i,a,l,u,c,p,h,_,d,f,m,g,v,w,k,M,T,S=!1,z=!1,E=!1,A="",C=!1,j=!1,P=!1,N=!1,O=!1,D="",F="",q=Math.abs(t),I=["B","KiB","MiB","GiB","TiB","PiB","EiB","ZiB","YiB"],R=["B","KB","MB","GB","TB","PB","EB","ZB","YB"],L="",B=!1,V=!1,G="";if(0===t&&null!==x)return x;if(!isFinite(t))return""+t;if(0===e.indexOf("{")){var U=e.indexOf("}");if(U===-1)throw Error('Format should also contain a "}"');m=e.slice(1,U),e=e.slice(U+1)}else m="";if(e.indexOf("}")===e.length-1){var Y=e.indexOf("{");if(Y===-1)throw Error('Format should also contain a "{"');g=e.slice(Y+1,-1),e=e.slice(0,Y+1)}else g="";var H;if(H=e.indexOf(".")===-1?e.match(/([0-9]+).*/):e.match(/([0-9]+)\..*/),T=null===H?-1:H[1].length,e.indexOf("-")!==-1&&(B=!0),e.indexOf("(")>-1?(S=!0,e=e.slice(1,-1)):e.indexOf("+")>-1&&(z=!0,e=e.replace(/\+/g,"")),e.indexOf("a")>-1){if(d=e.split(".")[0].match(/[0-9]+/g)||["0"],d=parseInt(d[0],10),C=e.indexOf("aK")>=0,j=e.indexOf("aM")>=0,P=e.indexOf("aB")>=0,N=e.indexOf("aT")>=0,O=C||j||P||N,e.indexOf(" a")>-1?(A=" ",e=e.replace(" a","")):e=e.replace("a",""),u=Math.floor(Math.log(q)/Math.LN10)+1,p=u%3,p=0===p?3:p,d&&0!==q&&(c=Math.floor(Math.log(q)/Math.LN10)+1-d,h=3*~~((Math.min(d,u)-p)/3),q/=Math.pow(10,h),e.indexOf(".")===-1&&d>3))for(e+="[.]",k=0===c?0:3*~~(c/3)-c,k=k<0?k+3:k,o=0;o<k;o++)e+="0";Math.floor(Math.log(Math.abs(t))/Math.LN10)+1!==d&&(q>=Math.pow(10,12)&&!O||N?(A+=y[b].abbreviations.trillion,t/=Math.pow(10,12)):q<Math.pow(10,12)&&q>=Math.pow(10,9)&&!O||P?(A+=y[b].abbreviations.billion,t/=Math.pow(10,9)):q<Math.pow(10,9)&&q>=Math.pow(10,6)&&!O||j?(A+=y[b].abbreviations.million,t/=Math.pow(10,6)):(q<Math.pow(10,6)&&q>=Math.pow(10,3)&&!O||C)&&(A+=y[b].abbreviations.thousand,t/=Math.pow(10,3)))}if(e.indexOf("b")>-1)for(e.indexOf(" b")>-1?(D=" ",e=e.replace(" b","")):e=e.replace("b",""),l=0;l<=I.length;l++)if(i=Math.pow(1024,l),a=Math.pow(1024,l+1),t>=i&&t<a){D+=I[l],i>0&&(t/=i);break}if(e.indexOf("d")>-1)for(e.indexOf(" d")>-1?(D=" ",e=e.replace(" d","")):e=e.replace("d",""),l=0;l<=R.length;l++)if(i=Math.pow(1e3,l),a=Math.pow(1e3,l+1),t>=i&&t<a){D+=R[l],i>0&&(t/=i);break}if(e.indexOf("o")>-1&&(e.indexOf(" o")>-1?(F=" ",e=e.replace(" o","")):e=e.replace("o",""),y[b].ordinal&&(F+=y[b].ordinal(t))),e.indexOf("[.]")>-1&&(E=!0,e=e.replace("[.]",".")),_=t.toString().split(".")[0],f=e.split(".")[1],v=e.indexOf(","),f){if(f.indexOf("*")!==-1?L=s(t,t.toString().split(".")[1].length,r):f.indexOf("[")>-1?(f=f.replace("]",""),f=f.split("["),L=s(t,f[0].length+f[1].length,r,f[1].length)):L=s(t,f.length,r),_=L.split(".")[0],L.split(".")[1].length){var X=n?A+n:y[b].delimiters.decimal;L=X+L.split(".")[1]}else L="";E&&0===Number(L.slice(1))&&(L="")}else _=s(t,null,r);return _.indexOf("-")>-1&&(_=_.slice(1),V=!0),_.length<T&&(_=new Array(T-_.length+1).join("0")+_),v>-1&&(_=_.toString().replace(/(\d)(?=(\d{3})+(?!\d))/g,"$1"+y[b].delimiters.thousands)),0===e.indexOf(".")&&(_=""),w=e.indexOf("("),M=e.indexOf("-"),G=w<M?(S&&V?"(":"")+(B&&V||!S&&V?"-":""):(B&&V||!S&&V?"-":"")+(S&&V?"(":""),m+G+(!V&&z&&0!==t?"+":"")+_+L+(F?F:"")+(A&&!n?A:"")+(D?D:"")+(S&&V?")":"")+g}function h(t,e){y[t]=e}function _(t){b=t;var e=y[t].defaults;e&&e.format&&f.defaultFormat(e.format),e&&e.currencyFormat&&f.defaultCurrencyFormat(e.currencyFormat)}function d(t,e,r,n){return m.isString(r)&&r!==f.culture()&&f.setCulture(r),a(Number(t),m.isString(e)?e:w,m.isUndefined(n)?Math.round:n)}/*!
|
|
* numbro.js
|
|
* version : 1.6.2
|
|
* author : Företagsplatsen AB
|
|
* license : MIT
|
|
* http://www.foretagsplatsen.se
|
|
*/
|
|
var f,m=t("underscore"),g="1.6.2",y={},v=y,b="en-US",x=null,w="0,0",k="0$",M=("undefined"!=typeof e&&e.exports,{delimiters:{thousands:",",decimal:"."},abbreviations:{thousand:"k",million:"m",billion:"b",trillion:"t"},ordinal:function(t){var e=t%10;return 1===~~(t%100/10)?"th":1===e?"st":2===e?"nd":3===e?"rd":"th"},currency:{symbol:"$",position:"prefix"},defaults:{currencyFormat:",0000 a"},formats:{fourDigits:"0000 a",fullWithTwoDecimals:"$ ,0.00",fullWithTwoDecimalsNoCurrency:",0.00"}});f=function(t){return f.isNumbro(t)?t=t.value():0===t||"undefined"==typeof t?t=0:Number(t)||(t=f.fn.unformat(t)),new n(Number(t))},f.version=g,f.isNumbro=function(t){return t instanceof n},f.setLanguage=function(t,e){console.warn("`setLanguage` is deprecated since version 1.6.0. Use `setCulture` instead");var r=t,n=t.split("-")[0],o=null;v[r]||(Object.keys(v).forEach(function(t){o||t.split("-")[0]!==n||(o=t)}),r=o||e||"en-US"),_(r)},f.setCulture=function(t,e){var r=t,n=t.split("-")[1],o=null;y[r]||(n&&Object.keys(y).forEach(function(t){o||t.split("-")[1]!==n||(o=t)}),r=o||e||"en-US"),_(r)},f.language=function(t,e){if(console.warn("`language` is deprecated since version 1.6.0. Use `culture` instead"),!t)return b;if(t&&!e){if(!v[t])throw new Error("Unknown language : "+t);_(t)}return!e&&v[t]||h(t,e),f},f.culture=function(t,e){if(!t)return b;if(t&&!e){if(!y[t])throw new Error("Unknown culture : "+t);_(t)}return!e&&y[t]||h(t,e),f},f.languageData=function(t){if(console.warn("`languageData` is deprecated since version 1.6.0. Use `cultureData` instead"),!t)return v[b];if(!v[t])throw new Error("Unknown language : "+t);return v[t]},f.cultureData=function(t){if(!t)return y[b];if(!y[t])throw new Error("Unknown culture : "+t);return y[t]},f.culture("en-US",M),f.languages=function(){return console.warn("`languages` is deprecated since version 1.6.0. Use `cultures` instead"),v},f.cultures=function(){return y},f.zeroFormat=function(t){x="string"==typeof t?t:null},f.defaultFormat=function(t){w="string"==typeof t?t:"0.0"},f.defaultCurrencyFormat=function(t){k="string"==typeof t?t:"0$"},f.validate=function(t,e){var r,n,o,i,s,a,l,u;if("string"!=typeof t&&(t+="",console.warn&&console.warn("Numbro.js: Value is not string. It has been co-erced to: ",t)),t=t.trim(),t.match(/^\d+$/))return!0;if(""===t)return!1;try{l=f.cultureData(e)}catch(c){l=f.cultureData(f.culture())}return o=l.currency.symbol,s=l.abbreviations,r=l.delimiters.decimal,n="."===l.delimiters.thousands?"\\.":l.delimiters.thousands,u=t.match(/^[^\d]+/),(null===u||(t=t.substr(1),u[0]===o))&&(u=t.match(/[^\d]+$/),(null===u||(t=t.slice(0,-1),u[0]===s.thousand||u[0]===s.million||u[0]===s.billion||u[0]===s.trillion))&&(a=new RegExp(n+"{2}"),!t.match(/[^\d.,]/g)&&(i=t.split(r),!(i.length>2)&&(i.length<2?!!i[0].match(/^\d+.*\d$/)&&!i[0].match(a):1===i[0].length?!!i[0].match(/^\d+$/)&&!i[0].match(a)&&!!i[1].match(/^\d+$/):!!i[0].match(/^\d+.*\d$/)&&!i[0].match(a)&&!!i[1].match(/^\d+$/)))))},e.exports={format:d}},{underscore:"underscore"}],_process:[function(t,e,r){function n(t){if(u===setTimeout)return setTimeout(t,0);try{return u(t,0)}catch(e){try{return u.call(null,t,0)}catch(e){return u.call(this,t,0)}}}function o(t){if(c===clearTimeout)return clearTimeout(t);try{return c(t)}catch(e){try{return c.call(null,t)}catch(e){return c.call(this,t)}}}function i(){d&&h&&(d=!1,h.length?_=h.concat(_):f=-1,_.length&&s())}function s(){if(!d){var t=n(i);d=!0;for(var e=_.length;e;){for(h=_,_=[];++f<e;)h&&h[f].run();f=-1,e=_.length}h=null,d=!1,o(t)}}function a(t,e){this.fun=t,this.array=e}function l(){}var u,c,p=e.exports={};!function(){try{u=setTimeout}catch(t){u=function(){throw new Error("setTimeout is not defined")}}try{c=clearTimeout}catch(t){c=function(){throw new Error("clearTimeout is not defined")}}}();var h,_=[],d=!1,f=-1;p.nextTick=function(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)e[r-1]=arguments[r];_.push(new a(t,e)),1!==_.length||d||n(s)},a.prototype.run=function(){this.fun.apply(null,this.array)},p.title="browser",p.browser=!0,p.env={},p.argv=[],p.version="",p.versions={},p.on=l,p.addListener=l,p.once=l,p.off=l,p.removeListener=l,p.removeAllListeners=l,p.emit=l,p.binding=function(t){throw new Error("process.binding is not supported")},p.cwd=function(){return"/"},p.chdir=function(t){throw new Error("process.chdir is not supported")},p.umask=function(){return 0}},{}],"proj4/lib/Proj":[function(t,e,r){function n(t,e){if(!(this instanceof n))return new n(t);e=e||function(t){if(t)throw t};var r=o(t);if("object"!=typeof r)return void e(t);var s=a(r),l=n.projections.get(s.projName);l?(i(this,s),i(this,l),this.init(),e(null,this)):e(t)}var o=t("./parseCode"),i=t("./extend"),s=t("./projections"),a=t("./deriveConstants");n.projections=s,n.projections.start(),e.exports=n},{"./deriveConstants":"proj4/lib/deriveConstants","./extend":"proj4/lib/extend","./parseCode":"proj4/lib/parseCode","./projections":"proj4/lib/projections"}],"proj4/lib/adjust_axis":[function(t,e,r){e.exports=function(t,e,r){var n,o,i,s=r.x,a=r.y,l=r.z||0;for(i=0;i<3;i++)if(!e||2!==i||void 0!==r.z)switch(0===i?(n=s,o="x"):1===i?(n=a,o="y"):(n=l,o="z"),t.axis[i]){case"e":r[o]=n;break;case"w":r[o]=-n;break;case"n":r[o]=n;break;case"s":r[o]=-n;break;case"u":void 0!==r[o]&&(r.z=n);break;case"d":void 0!==r[o]&&(r.z=-n);break;default:return null}return r}},{}],"proj4/lib/common/adjust_lon":[function(t,e,r){var n=2*Math.PI,o=3.14159265359,i=t("./sign");e.exports=function(t){return Math.abs(t)<=o?t:t-i(t)*n}},{"./sign":"proj4/lib/common/sign"}],"proj4/lib/common/msfnz":[function(t,e,r){e.exports=function(t,e,r){var n=t*e;return r/Math.sqrt(1-n*n)}},{}],"proj4/lib/common/phi2z":[function(t,e,r){var n=Math.PI/2;e.exports=function(t,e){for(var r,o,i=.5*t,s=n-2*Math.atan(e),a=0;a<=15;a++)if(r=t*Math.sin(s),o=n-2*Math.atan(e*Math.pow((1-r)/(1+r),i))-s,s+=o,Math.abs(o)<=1e-10)return s;return-9999}},{}],"proj4/lib/common/sign":[function(t,e,r){e.exports=function(t){return t<0?-1:1}},{}],"proj4/lib/common/toPoint":[function(t,e,r){e.exports=function(t){var e={x:t[0],y:t[1]};return t.length>2&&(e.z=t[2]),t.length>3&&(e.m=t[3]),e}},{}],"proj4/lib/common/tsfnz":[function(t,e,r){var n=Math.PI/2;e.exports=function(t,e,r){var o=t*r,i=.5*t;return o=Math.pow((1-o)/(1+o),i),Math.tan(.5*(n-e))/o}},{}],"proj4/lib/constants/Datum":[function(t,e,r){r.wgs84={towgs84:"0,0,0",ellipse:"WGS84",datumName:"WGS84"},r.ch1903={towgs84:"674.374,15.056,405.346",ellipse:"bessel",datumName:"swiss"},r.ggrs87={towgs84:"-199.87,74.79,246.62",ellipse:"GRS80",datumName:"Greek_Geodetic_Reference_System_1987"},r.nad83={towgs84:"0,0,0",ellipse:"GRS80",datumName:"North_American_Datum_1983"},r.nad27={nadgrids:"@conus,@alaska,@ntv2_0.gsb,@ntv1_can.dat",ellipse:"clrk66",datumName:"North_American_Datum_1927"},r.potsdam={towgs84:"606.0,23.0,413.0",ellipse:"bessel",datumName:"Potsdam Rauenberg 1950 DHDN"},r.carthage={towgs84:"-263.0,6.0,431.0",ellipse:"clark80",datumName:"Carthage 1934 Tunisia"},r.hermannskogel={towgs84:"653.0,-212.0,449.0",ellipse:"bessel",datumName:"Hermannskogel"},r.ire65={towgs84:"482.530,-130.596,564.557,-1.042,-0.214,-0.631,8.15",ellipse:"mod_airy",datumName:"Ireland 1965"},r.rassadiran={towgs84:"-133.63,-157.5,-158.62",ellipse:"intl",datumName:"Rassadiran"},r.nzgd49={towgs84:"59.47,-5.04,187.44,0.47,-0.1,1.024,-4.5993",ellipse:"intl",datumName:"New Zealand Geodetic Datum 1949"},r.osgb36={towgs84:"446.448,-125.157,542.060,0.1502,0.2470,0.8421,-20.4894",ellipse:"airy",datumName:"Airy 1830"},r.s_jtsk={towgs84:"589,76,480",ellipse:"bessel",datumName:"S-JTSK (Ferro)"},r.beduaram={towgs84:"-106,-87,188",ellipse:"clrk80",datumName:"Beduaram"},r.gunung_segara={towgs84:"-403,684,41",ellipse:"bessel",datumName:"Gunung Segara Jakarta"},r.rnb72={towgs84:"106.869,-52.2978,103.724,-0.33657,0.456955,-1.84218,1",ellipse:"intl",datumName:"Reseau National Belge 1972"}},{}],"proj4/lib/constants/Ellipsoid":[function(t,e,r){r.MERIT={a:6378137,rf:298.257,ellipseName:"MERIT 1983"},r.SGS85={a:6378136,rf:298.257,ellipseName:"Soviet Geodetic System 85"},r.GRS80={a:6378137,rf:298.257222101,ellipseName:"GRS 1980(IUGG, 1980)"},r.IAU76={a:6378140,rf:298.257,ellipseName:"IAU 1976"},r.airy={a:6377563.396,b:6356256.91,ellipseName:"Airy 1830"},r.APL4={a:6378137,rf:298.25,ellipseName:"Appl. Physics. 1965"},r.NWL9D={a:6378145,rf:298.25,ellipseName:"Naval Weapons Lab., 1965"},r.mod_airy={a:6377340.189,b:6356034.446,ellipseName:"Modified Airy"},r.andrae={a:6377104.43,rf:300,ellipseName:"Andrae 1876 (Den., Iclnd.)"},r.aust_SA={a:6378160,rf:298.25,ellipseName:"Australian Natl & S. Amer. 1969"},r.GRS67={a:6378160,rf:298.247167427,ellipseName:"GRS 67(IUGG 1967)"},r.bessel={a:6377397.155,rf:299.1528128,ellipseName:"Bessel 1841"},r.bess_nam={a:6377483.865,rf:299.1528128,ellipseName:"Bessel 1841 (Namibia)"},r.clrk66={a:6378206.4,b:6356583.8,ellipseName:"Clarke 1866"},r.clrk80={a:6378249.145,rf:293.4663,ellipseName:"Clarke 1880 mod."},r.clrk58={a:6378293.645208759,rf:294.2606763692654,ellipseName:"Clarke 1858"},r.CPM={a:6375738.7,rf:334.29,ellipseName:"Comm. des Poids et Mesures 1799"},r.delmbr={a:6376428,rf:311.5,ellipseName:"Delambre 1810 (Belgium)"},r.engelis={a:6378136.05,rf:298.2566,ellipseName:"Engelis 1985"},r.evrst30={a:6377276.345,rf:300.8017,ellipseName:"Everest 1830"},r.evrst48={a:6377304.063,rf:300.8017,ellipseName:"Everest 1948"},r.evrst56={a:6377301.243,rf:300.8017,ellipseName:"Everest 1956"},r.evrst69={a:6377295.664,rf:300.8017,ellipseName:"Everest 1969"},r.evrstSS={a:6377298.556,rf:300.8017,ellipseName:"Everest (Sabah & Sarawak)"},r.fschr60={a:6378166,rf:298.3,ellipseName:"Fischer (Mercury Datum) 1960"},r.fschr60m={a:6378155,rf:298.3,ellipseName:"Fischer 1960"},r.fschr68={a:6378150,rf:298.3,ellipseName:"Fischer 1968"},r.helmert={a:6378200,rf:298.3,ellipseName:"Helmert 1906"},r.hough={a:6378270,rf:297,ellipseName:"Hough"},r.intl={a:6378388,rf:297,ellipseName:"International 1909 (Hayford)"},r.kaula={a:6378163,rf:298.24,ellipseName:"Kaula 1961"},r.lerch={a:6378139,rf:298.257,ellipseName:"Lerch 1979"},r.mprts={a:6397300,rf:191,ellipseName:"Maupertius 1738"},r.new_intl={a:6378157.5,b:6356772.2,ellipseName:"New International 1967"},r.plessis={a:6376523,rf:6355863,ellipseName:"Plessis 1817 (France)"},r.krass={a:6378245,rf:298.3,ellipseName:"Krassovsky, 1942"},r.SEasia={a:6378155,b:6356773.3205,ellipseName:"Southeast Asia"},r.walbeck={a:6376896,b:6355834.8467,ellipseName:"Walbeck"},r.WGS60={a:6378165,rf:298.3,ellipseName:"WGS 60"},r.WGS66={a:6378145,rf:298.25,ellipseName:"WGS 66"},r.WGS7={a:6378135,rf:298.26,ellipseName:"WGS 72"},r.WGS84={a:6378137,rf:298.257223563,ellipseName:"WGS 84"},r.sphere={a:6370997,b:6370997,ellipseName:"Normal Sphere (r=6370997)"}},{}],"proj4/lib/constants/PrimeMeridian":[function(t,e,r){r.greenwich=0,r.lisbon=-9.131906111111,r.paris=2.337229166667,r.bogota=-74.080916666667,r.madrid=-3.687938888889,r.rome=12.452333333333,r.bern=7.439583333333,r.jakarta=106.807719444444,r.ferro=-17.666666666667,r.brussels=4.367975,r.stockholm=18.058277777778,r.athens=23.7163375,r.oslo=10.722916666667},{}],"proj4/lib/constants/units":[function(t,e,r){r.ft={to_meter:.3048},r["us-ft"]={to_meter:1200/3937}},{}],"proj4/lib/core":[function(t,e,r){function n(t,e,r){var n;return Array.isArray(r)?(n=a(t,e,r),3===r.length?[n.x,n.y,n.z]:[n.x,n.y]):a(t,e,r)}function o(t){return t instanceof s?t:t.oProj?t.oProj:s(t)}function i(t,e,r){t=o(t);var i,s=!1;return"undefined"==typeof e?(e=t,t=l,s=!0):("undefined"!=typeof e.x||Array.isArray(e))&&(r=e,e=t,t=l,s=!0),e=o(e),r?n(t,e,r):(i={forward:function(r){return n(t,e,r)},inverse:function(r){return n(e,t,r)}},s&&(i.oProj=e),i)}var s=t("./Proj"),a=t("./transform"),l=s("WGS84");e.exports=i},{"./Proj":"proj4/lib/Proj","./transform":"proj4/lib/transform"}],"proj4/lib/datum":[function(t,e,r){var n=Math.PI/2,o=1,i=2,s=3,a=4,l=5,u=484813681109536e-20,c=1.0026,p=.3826834323650898,h=function(t){return this instanceof h?(this.datum_type=a,void(t&&(t.datumCode&&"none"===t.datumCode&&(this.datum_type=l),t.datum_params&&(this.datum_params=t.datum_params.map(parseFloat),0===this.datum_params[0]&&0===this.datum_params[1]&&0===this.datum_params[2]||(this.datum_type=o),this.datum_params.length>3&&(0===this.datum_params[3]&&0===this.datum_params[4]&&0===this.datum_params[5]&&0===this.datum_params[6]||(this.datum_type=i,this.datum_params[3]*=u,this.datum_params[4]*=u,this.datum_params[5]*=u,this.datum_params[6]=this.datum_params[6]/1e6+1))),this.datum_type=t.grids?s:this.datum_type,this.a=t.a,this.b=t.b,this.es=t.es,this.ep2=t.ep2,this.datum_type===s&&(this.grids=t.grids)))):new h(t)};h.prototype={compare_datums:function(t){return this.datum_type===t.datum_type&&(!(this.a!==t.a||Math.abs(this.es-t.es)>5e-11)&&(this.datum_type===o?this.datum_params[0]===t.datum_params[0]&&this.datum_params[1]===t.datum_params[1]&&this.datum_params[2]===t.datum_params[2]:this.datum_type===i?this.datum_params[0]===t.datum_params[0]&&this.datum_params[1]===t.datum_params[1]&&this.datum_params[2]===t.datum_params[2]&&this.datum_params[3]===t.datum_params[3]&&this.datum_params[4]===t.datum_params[4]&&this.datum_params[5]===t.datum_params[5]&&this.datum_params[6]===t.datum_params[6]:this.datum_type!==s&&t.datum_type!==s||this.nadgrids===t.nadgrids))},geodetic_to_geocentric:function(t){var e,r,o,i,s,a,l,u=t.x,c=t.y,p=t.z?t.z:0,h=0;if(c<-n&&c>-1.001*n)c=-n;else if(c>n&&c<1.001*n)c=n;else if(c<-n||c>n)return null;return u>Math.PI&&(u-=2*Math.PI),s=Math.sin(c),l=Math.cos(c),a=s*s,i=this.a/Math.sqrt(1-this.es*a),e=(i+p)*l*Math.cos(u),r=(i+p)*l*Math.sin(u),o=(i*(1-this.es)+p)*s,t.x=e,t.y=r,t.z=o,h},geocentric_to_geodetic:function(t){var e,r,o,i,s,a,l,u,c,p,h,_,d,f,m,g,y,v=1e-12,b=v*v,x=30,w=t.x,k=t.y,M=t.z?t.z:0;if(d=!1,e=Math.sqrt(w*w+k*k),r=Math.sqrt(w*w+k*k+M*M),e/this.a<v){if(d=!0,m=0,r/this.a<v)return g=n,void(y=-this.b)}else m=Math.atan2(k,w);o=M/r,i=e/r,s=1/Math.sqrt(1-this.es*(2-this.es)*i*i),u=i*(1-this.es)*s,c=o*s,f=0;do f++,l=this.a/Math.sqrt(1-this.es*c*c),y=e*u+M*c-l*(1-this.es*c*c),a=this.es*l/(l+y),s=1/Math.sqrt(1-a*(2-a)*i*i),p=i*(1-a)*s,h=o*s,_=h*u-p*c,u=p,c=h;while(_*_>b&&f<x);return g=Math.atan(h/Math.abs(p)),t.x=m,t.y=g,t.z=y,t},geocentric_to_geodetic_noniter:function(t){var e,r,o,i,s,a,l,u,h,_,d,f,m,g,y,v,b,x=t.x,w=t.y,k=t.z?t.z:0;if(x=parseFloat(x),w=parseFloat(w),k=parseFloat(k),b=!1,0!==x)e=Math.atan2(w,x);else if(w>0)e=n;else if(w<0)e=-n;else if(b=!0,e=0,k>0)r=n;else{if(!(k<0))return r=n,void(o=-this.b);r=-n}return s=x*x+w*w,i=Math.sqrt(s),a=k*c,u=Math.sqrt(a*a+s),_=a/u,f=i/u,d=_*_*_,l=k+this.b*this.ep2*d,v=i-this.a*this.es*f*f*f,h=Math.sqrt(l*l+v*v),m=l/h,g=v/h,y=this.a/Math.sqrt(1-this.es*m*m),o=g>=p?i/g-y:g<=-p?i/-g-y:k/m+y*(this.es-1),b===!1&&(r=Math.atan(m/g)),t.x=e,t.y=r,t.z=o,t},geocentric_to_wgs84:function(t){if(this.datum_type===o)t.x+=this.datum_params[0],t.y+=this.datum_params[1],t.z+=this.datum_params[2];else if(this.datum_type===i){var e=this.datum_params[0],r=this.datum_params[1],n=this.datum_params[2],s=this.datum_params[3],a=this.datum_params[4],l=this.datum_params[5],u=this.datum_params[6],c=u*(t.x-l*t.y+a*t.z)+e,p=u*(l*t.x+t.y-s*t.z)+r,h=u*(-a*t.x+s*t.y+t.z)+n;t.x=c,t.y=p,t.z=h}},geocentric_from_wgs84:function(t){if(this.datum_type===o)t.x-=this.datum_params[0],t.y-=this.datum_params[1],t.z-=this.datum_params[2];else if(this.datum_type===i){var e=this.datum_params[0],r=this.datum_params[1],n=this.datum_params[2],s=this.datum_params[3],a=this.datum_params[4],l=this.datum_params[5],u=this.datum_params[6],c=(t.x-e)/u,p=(t.y-r)/u,h=(t.z-n)/u;t.x=c+l*p-a*h,t.y=-l*c+p+s*h,t.z=a*c-s*p+h}}},e.exports=h},{}],"proj4/lib/datum_transform":[function(t,e,r){var n=1,o=2,i=3,s=5,a=6378137,l=.006694379990141316;e.exports=function(t,e,r){function u(t){return t===n||t===o}var c,p,h;if(t.compare_datums(e))return r;if(t.datum_type===s||e.datum_type===s)return r;var _=t.a,d=t.es,f=e.a,m=e.es,g=t.datum_type;if(g===i)if(0===this.apply_gridshift(t,0,r))t.a=a,t.es=l;else{if(!t.datum_params)return t.a=_,t.es=t.es,r;for(c=1,p=0,h=t.datum_params.length;p<h;p++)c*=t.datum_params[p];if(0===c)return t.a=_,t.es=t.es,r;g=t.datum_params.length>3?o:n}return e.datum_type===i&&(e.a=a,e.es=l),(t.es!==e.es||t.a!==e.a||u(g)||u(e.datum_type))&&(t.geodetic_to_geocentric(r),u(t.datum_type)&&t.geocentric_to_wgs84(r),u(e.datum_type)&&e.geocentric_from_wgs84(r),e.geocentric_to_geodetic(r)),e.datum_type===i&&this.apply_gridshift(e,1,r),t.a=_,t.es=d,e.a=f,e.es=m,r}},{}],"proj4/lib/defs":[function(t,e,r){function n(t){var e=this;if(2===arguments.length){var r=arguments[1];"string"==typeof r?"+"===r.charAt(0)?n[t]=i(arguments[1]):n[t]=s(arguments[1]):n[t]=r}else if(1===arguments.length){if(Array.isArray(t))return t.map(function(t){Array.isArray(t)?n.apply(e,t):n(t)});if("string"==typeof t){if(t in n)return n[t]}else"EPSG"in t?n["EPSG:"+t.EPSG]=t:"ESRI"in t?n["ESRI:"+t.ESRI]=t:"IAU2000"in t?n["IAU2000:"+t.IAU2000]=t:console.log(t);return}}var o=t("./global"),i=t("./projString"),s=t("./wkt");o(n),e.exports=n},{"./global":"proj4/lib/global","./projString":"proj4/lib/projString","./wkt":"proj4/lib/wkt"}],"proj4/lib/deriveConstants":[function(t,e,r){var n=t("./constants/Datum"),o=t("./constants/Ellipsoid"),i=t("./extend"),s=t("./datum"),a=1e-10,l=.16666666666666666,u=.04722222222222222,c=.022156084656084655;e.exports=function(t){if(t.datumCode&&"none"!==t.datumCode){var e=n[t.datumCode];e&&(t.datum_params=e.towgs84?e.towgs84.split(","):null,t.ellps=e.ellipse,t.datumName=e.datumName?e.datumName:t.datumCode)}if(!t.a){var r=o[t.ellps]?o[t.ellps]:o.WGS84;i(t,r)}return t.rf&&!t.b&&(t.b=(1-1/t.rf)*t.a),(0===t.rf||Math.abs(t.a-t.b)<a)&&(t.sphere=!0,t.b=t.a),t.a2=t.a*t.a,t.b2=t.b*t.b,t.es=(t.a2-t.b2)/t.a2,t.e=Math.sqrt(t.es),t.R_A&&(t.a*=1-t.es*(l+t.es*(u+t.es*c)),t.a2=t.a*t.a,t.b2=t.b*t.b,t.es=0),t.ep2=(t.a2-t.b2)/t.b2,t.k0||(t.k0=1),t.axis||(t.axis="enu"),t.datum||(t.datum=s(t)),t}},{"./constants/Datum":"proj4/lib/constants/Datum","./constants/Ellipsoid":"proj4/lib/constants/Ellipsoid","./datum":"proj4/lib/datum","./extend":"proj4/lib/extend"}],"proj4/lib/extend":[function(t,e,r){e.exports=function(t,e){t=t||{};var r,n;if(!e)return t;for(n in e)r=e[n],void 0!==r&&(t[n]=r);return t}},{}],"proj4/lib/global":[function(t,e,r){e.exports=function(t){t("EPSG:4326","+title=WGS 84 (long/lat) +proj=longlat +ellps=WGS84 +datum=WGS84 +units=degrees"),t("EPSG:4269","+title=NAD83 (long/lat) +proj=longlat +a=6378137.0 +b=6356752.31414036 +ellps=GRS80 +datum=NAD83 +units=degrees"),t("EPSG:3857","+title=WGS 84 / Pseudo-Mercator +proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +no_defs"),t.WGS84=t["EPSG:4326"],t["EPSG:3785"]=t["EPSG:3857"],t.GOOGLE=t["EPSG:3857"],t["EPSG:900913"]=t["EPSG:3857"],t["EPSG:102113"]=t["EPSG:3857"]}},{}],"proj4/lib/parseCode":[function(t,e,r){function n(t){return"string"==typeof t}function o(t){return t in l}function i(t){var e=["GEOGCS","GEOCCS","PROJCS","LOCAL_CS"];return e.reduce(function(e,r){return e+1+t.indexOf(r)},0)}function s(t){return"+"===t[0]}function a(t){return n(t)?o(t)?l[t]:i(t)?u(t):s(t)?c(t):void 0:t}var l=t("./defs"),u=t("./wkt"),c=t("./projString");e.exports=a},{"./defs":"proj4/lib/defs","./projString":"proj4/lib/projString","./wkt":"proj4/lib/wkt"}],"proj4/lib/projString":[function(t,e,r){var n=.017453292519943295,o=t("./constants/PrimeMeridian"),i=t("./constants/units");e.exports=function(t){var e={},r={};t.split("+").map(function(t){return t.trim()}).filter(function(t){return t}).forEach(function(t){var e=t.split("=");e.push(!0),r[e[0].toLowerCase()]=e[1]});var s,a,l,u={proj:"projName",datum:"datumCode",rf:function(t){e.rf=parseFloat(t)},lat_0:function(t){e.lat0=t*n},lat_1:function(t){e.lat1=t*n},lat_2:function(t){e.lat2=t*n},lat_ts:function(t){e.lat_ts=t*n},lon_0:function(t){e.long0=t*n},lon_1:function(t){e.long1=t*n},lon_2:function(t){e.long2=t*n},alpha:function(t){e.alpha=parseFloat(t)*n},lonc:function(t){e.longc=t*n},x_0:function(t){e.x0=parseFloat(t)},y_0:function(t){e.y0=parseFloat(t)},k_0:function(t){e.k0=parseFloat(t)},k:function(t){e.k0=parseFloat(t)},a:function(t){e.a=parseFloat(t)},b:function(t){e.b=parseFloat(t)},r_a:function(){e.R_A=!0},zone:function(t){e.zone=parseInt(t,10)},south:function(){e.utmSouth=!0},towgs84:function(t){e.datum_params=t.split(",").map(function(t){return parseFloat(t)})},to_meter:function(t){e.to_meter=parseFloat(t)},units:function(t){e.units=t,i[t]&&(e.to_meter=i[t].to_meter)},from_greenwich:function(t){e.from_greenwich=t*n},pm:function(t){e.from_greenwich=(o[t]?o[t]:parseFloat(t))*n},nadgrids:function(t){"@null"===t?e.datumCode="none":e.nadgrids=t},axis:function(t){var r="ewnsud";3===t.length&&r.indexOf(t.substr(0,1))!==-1&&r.indexOf(t.substr(1,1))!==-1&&r.indexOf(t.substr(2,1))!==-1&&(e.axis=t)}};for(s in r)a=r[s],s in u?(l=u[s],"function"==typeof l?l(a):e[l]=a):e[s]=a;return"string"==typeof e.datumCode&&"WGS84"!==e.datumCode&&(e.datumCode=e.datumCode.toLowerCase()),e}},{"./constants/PrimeMeridian":"proj4/lib/constants/PrimeMeridian","./constants/units":"proj4/lib/constants/units"}],"proj4/lib/projections":[function(t,e,r){function n(t,e){var r=s.length;return t.names?(s[r]=t,t.names.forEach(function(t){i[t.toLowerCase()]=r}),this):(console.log(e),!0)}var o=[t("./projections/merc"),t("./projections/longlat")],i={},s=[];r.add=n,r.get=function(t){if(!t)return!1;var e=t.toLowerCase();return"undefined"!=typeof i[e]&&s[i[e]]?s[i[e]]:void 0},r.start=function(){o.forEach(n)}},{"./projections/longlat":"proj4/lib/projections/longlat","./projections/merc":"proj4/lib/projections/merc"}],"proj4/lib/projections/longlat":[function(t,e,r){function n(t){return t}r.init=function(){},r.forward=n,r.inverse=n,r.names=["longlat","identity"]},{}],"proj4/lib/projections/merc":[function(t,e,r){var n=t("../common/msfnz"),o=Math.PI/2,i=1e-10,s=57.29577951308232,a=t("../common/adjust_lon"),l=Math.PI/4,u=t("../common/tsfnz"),c=t("../common/phi2z");r.init=function(){var t=this.b/this.a;this.es=1-t*t,"x0"in this||(this.x0=0),"y0"in this||(this.y0=0),this.e=Math.sqrt(this.es),this.lat_ts?this.sphere?this.k0=Math.cos(this.lat_ts):this.k0=n(this.e,Math.sin(this.lat_ts),Math.cos(this.lat_ts)):this.k0||(this.k?this.k0=this.k:this.k0=1)},r.forward=function(t){var e=t.x,r=t.y;if(r*s>90&&r*s<-90&&e*s>180&&e*s<-180)return null;var n,c;if(Math.abs(Math.abs(r)-o)<=i)return null;if(this.sphere)n=this.x0+this.a*this.k0*a(e-this.long0),c=this.y0+this.a*this.k0*Math.log(Math.tan(l+.5*r));else{var p=Math.sin(r),h=u(this.e,r,p);n=this.x0+this.a*this.k0*a(e-this.long0),c=this.y0-this.a*this.k0*Math.log(h)}return t.x=n,t.y=c,t},r.inverse=function(t){var e,r,n=t.x-this.x0,i=t.y-this.y0;if(this.sphere)r=o-2*Math.atan(Math.exp(-i/(this.a*this.k0)));else{var s=Math.exp(-i/(this.a*this.k0));if(r=c(this.e,s),r===-9999)return null}return e=a(this.long0+n/(this.a*this.k0)),t.x=e,t.y=r,t},r.names=["Mercator","Popular Visualisation Pseudo Mercator","Mercator_1SP","Mercator_Auxiliary_Sphere","merc"]},{"../common/adjust_lon":"proj4/lib/common/adjust_lon","../common/msfnz":"proj4/lib/common/msfnz","../common/phi2z":"proj4/lib/common/phi2z","../common/tsfnz":"proj4/lib/common/tsfnz"}],"proj4/lib/transform":[function(t,e,r){var n=.017453292519943295,o=57.29577951308232,i=1,s=2,a=t("./datum_transform"),l=t("./adjust_axis"),u=t("./Proj"),c=t("./common/toPoint");e.exports=function p(t,e,r){function h(t,e){return(t.datum.datum_type===i||t.datum.datum_type===s)&&"WGS84"!==e.datumCode}var _;return Array.isArray(r)&&(r=c(r)),t.datum&&e.datum&&(h(t,e)||h(e,t))&&(_=new u("WGS84"),p(t,_,r),t=_),"enu"!==t.axis&&l(t,!1,r),"longlat"===t.projName?(r.x*=n,r.y*=n):(t.to_meter&&(r.x*=t.to_meter,r.y*=t.to_meter),t.inverse(r)),t.from_greenwich&&(r.x+=t.from_greenwich),r=a(t.datum,e.datum,r),e.from_greenwich&&(r.x-=e.from_greenwich),"longlat"===e.projName?(r.x*=o,r.y*=o):(e.forward(r),e.to_meter&&(r.x/=e.to_meter,r.y/=e.to_meter)),"enu"!==e.axis&&l(e,!0,r),r}},{"./Proj":"proj4/lib/Proj","./adjust_axis":"proj4/lib/adjust_axis","./common/toPoint":"proj4/lib/common/toPoint","./datum_transform":"proj4/lib/datum_transform"}],"proj4/lib/wkt":[function(t,e,r){function n(t,e,r){t[e]=r.map(function(t){var e={};return o(t,e),e}).reduce(function(t,e){return u(t,e)},{})}function o(t,e){var r;return Array.isArray(t)?(r=t.shift(),"PARAMETER"===r&&(r=t.shift()),1===t.length?Array.isArray(t[0])?(e[r]={},o(t[0],e[r])):e[r]=t[0]:t.length?"TOWGS84"===r?e[r]=t:(e[r]={},["UNIT","PRIMEM","VERT_DATUM"].indexOf(r)>-1?(e[r]={name:t[0].toLowerCase(),convert:t[1]},3===t.length&&(e[r].auth=t[2])):"SPHEROID"===r?(e[r]={name:t[0],a:t[1],rf:t[2]},4===t.length&&(e[r].auth=t[3])):["GEOGCS","GEOCCS","DATUM","VERT_CS","COMPD_CS","LOCAL_CS","FITTED_CS","LOCAL_DATUM"].indexOf(r)>-1?(t[0]=["name",t[0]],n(e,r,t)):t.every(function(t){return Array.isArray(t)})?n(e,r,t):o(t,e[r])):e[r]=!0,void 0):void(e[t]=!0)}function i(t,e){var r=e[0],n=e[1];!(r in t)&&n in t&&(t[r]=t[n],3===e.length&&(t[r]=e[2](t[r])))}function s(t){return t*l}function a(t){function e(e){var r=t.to_meter||1;return parseFloat(e,10)*r}"GEOGCS"===t.type?t.projName="longlat":"LOCAL_CS"===t.type?(t.projName="identity",t.local=!0):"object"==typeof t.PROJECTION?t.projName=Object.keys(t.PROJECTION)[0]:t.projName=t.PROJECTION,t.UNIT&&(t.units=t.UNIT.name.toLowerCase(),"metre"===t.units&&(t.units="meter"),t.UNIT.convert&&("GEOGCS"===t.type?t.DATUM&&t.DATUM.SPHEROID&&(t.to_meter=parseFloat(t.UNIT.convert,10)*t.DATUM.SPHEROID.a):t.to_meter=parseFloat(t.UNIT.convert,10))),t.GEOGCS&&(t.GEOGCS.DATUM?t.datumCode=t.GEOGCS.DATUM.name.toLowerCase():t.datumCode=t.GEOGCS.name.toLowerCase(),"d_"===t.datumCode.slice(0,2)&&(t.datumCode=t.datumCode.slice(2)),"new_zealand_geodetic_datum_1949"!==t.datumCode&&"new_zealand_1949"!==t.datumCode||(t.datumCode="nzgd49"),"wgs_1984"===t.datumCode&&("Mercator_Auxiliary_Sphere"===t.PROJECTION&&(t.sphere=!0),t.datumCode="wgs84"),"_ferro"===t.datumCode.slice(-6)&&(t.datumCode=t.datumCode.slice(0,-6)),"_jakarta"===t.datumCode.slice(-8)&&(t.datumCode=t.datumCode.slice(0,-8)),~t.datumCode.indexOf("belge")&&(t.datumCode="rnb72"),t.GEOGCS.DATUM&&t.GEOGCS.DATUM.SPHEROID&&(t.ellps=t.GEOGCS.DATUM.SPHEROID.name.replace("_19","").replace(/[Cc]larke\_18/,"clrk"),"international"===t.ellps.toLowerCase().slice(0,13)&&(t.ellps="intl"),t.a=t.GEOGCS.DATUM.SPHEROID.a,t.rf=parseFloat(t.GEOGCS.DATUM.SPHEROID.rf,10)),~t.datumCode.indexOf("osgb_1936")&&(t.datumCode="osgb36")),t.b&&!isFinite(t.b)&&(t.b=t.a);var r=function(e){return i(t,e)},n=[["standard_parallel_1","Standard_Parallel_1"],["standard_parallel_2","Standard_Parallel_2"],["false_easting","False_Easting"],["false_northing","False_Northing"],["central_meridian","Central_Meridian"],["latitude_of_origin","Latitude_Of_Origin"],["latitude_of_origin","Central_Parallel"],["scale_factor","Scale_Factor"],["k0","scale_factor"],["latitude_of_center","Latitude_of_center"],["lat0","latitude_of_center",s],["longitude_of_center","Longitude_Of_Center"],["longc","longitude_of_center",s],["x0","false_easting",e],["y0","false_northing",e],["long0","central_meridian",s],["lat0","latitude_of_origin",s],["lat0","standard_parallel_1",s],["lat1","standard_parallel_1",s],["lat2","standard_parallel_2",s],["alpha","azimuth",s],["srsCode","name"]];n.forEach(r),t.long0||!t.longc||"Albers_Conic_Equal_Area"!==t.projName&&"Lambert_Azimuthal_Equal_Area"!==t.projName||(t.long0=t.longc),t.lat_ts||!t.lat1||"Stereographic_South_Pole"!==t.projName&&"Polar Stereographic (variant B)"!==t.projName||(t.lat0=s(t.lat1>0?90:-90),t.lat_ts=t.lat1)}var l=.017453292519943295,u=t("./extend");e.exports=function(t,e){var r=JSON.parse((","+t).replace(/\s*\,\s*([A-Z_0-9]+?)(\[)/g,',["$1",').slice(1).replace(/\s*\,\s*([A-Z_0-9]+?)\]/g,',"$1"]').replace(/,\["VERTCS".+/,"")),n=r.shift(),i=r.shift();r.unshift(["name",i]),r.unshift(["type",n]),r.unshift("output");var s={};return o(r,s),a(s.output),u(e,s.output)}},{"./extend":"proj4/lib/extend"}],"quickselect/index":[function(t,e,r){"use strict";function n(t,e,r,s,a){for(r=r||0,s=s||t.length-1,a=a||i;s>r;){if(s-r>600){var l=s-r+1,u=e-r+1,c=Math.log(l),p=.5*Math.exp(2*c/3),h=.5*Math.sqrt(c*p*(l-p)/l)*(u-l/2<0?-1:1),_=Math.max(r,Math.floor(e-u*p/l+h)),d=Math.min(s,Math.floor(e+(l-u)*p/l+h));n(t,e,_,d,a)}var f=t[e],m=r,g=s;for(o(t,r,e),a(t[s],f)>0&&o(t,r,s);m<g;){for(o(t,m,g),m++,g--;a(t[m],f)<0;)m++;for(;a(t[g],f)>0;)g--}0===a(t[r],f)?o(t,r,g):(g++,o(t,g,s)),g<=e&&(r=g+1),e<=g&&(s=g-1)}}function o(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}function i(t,e){return t<e?-1:t>e?1:0}e.exports=n},{}],rbush:[function(t,e,r){"use strict";function n(t,e){return this instanceof n?(this._maxEntries=Math.max(4,t||9),this._minEntries=Math.max(2,Math.ceil(.4*this._maxEntries)),e&&this._initFormat(e),void this.clear()):new n(t,e)}function o(t,e,r){if(!r)return e.indexOf(t);for(var n=0;n<e.length;n++)if(r(t,e[n]))return n;return-1}function i(t,e){s(t,0,t.children.length,e,t)}function s(t,e,r,n,o){o||(o=m(null)),o.minX=1/0,o.minY=1/0,o.maxX=-(1/0),o.maxY=-(1/0);for(var i,s=e;s<r;s++)i=t.children[s],a(o,t.leaf?n(i):i);return o}function a(t,e){return t.minX=Math.min(t.minX,e.minX),t.minY=Math.min(t.minY,e.minY),t.maxX=Math.max(t.maxX,e.maxX),t.maxY=Math.max(t.maxY,e.maxY),t}function l(t,e){return t.minX-e.minX}function u(t,e){return t.minY-e.minY}function c(t){return(t.maxX-t.minX)*(t.maxY-t.minY)}function p(t){return t.maxX-t.minX+(t.maxY-t.minY)}function h(t,e){return(Math.max(e.maxX,t.maxX)-Math.min(e.minX,t.minX))*(Math.max(e.maxY,t.maxY)-Math.min(e.minY,t.minY))}function _(t,e){var r=Math.max(t.minX,e.minX),n=Math.max(t.minY,e.minY),o=Math.min(t.maxX,e.maxX),i=Math.min(t.maxY,e.maxY);return Math.max(0,o-r)*Math.max(0,i-n)}function d(t,e){return t.minX<=e.minX&&t.minY<=e.minY&&e.maxX<=t.maxX&&e.maxY<=t.maxY}function f(t,e){return e.minX<=t.maxX&&e.minY<=t.maxY&&e.maxX>=t.minX&&e.maxY>=t.minY}function m(t){return{children:t,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-(1/0),maxY:-(1/0)}}function g(t,e,r,n,o){for(var i,s=[e,r];s.length;)r=s.pop(),e=s.pop(),r-e<=n||(i=e+Math.ceil((r-e)/n/2)*n,y(t,i,e,r,o),s.push(e,i,i,r))}e.exports=n;var y=t("quickselect");n.prototype={all:function(){return this._all(this.data,[])},search:function(t){var e=this.data,r=[],n=this.toBBox;if(!f(t,e))return r;for(var o,i,s,a,l=[];e;){for(o=0,i=e.children.length;o<i;o++)s=e.children[o],a=e.leaf?n(s):s,f(t,a)&&(e.leaf?r.push(s):d(t,a)?this._all(s,r):l.push(s));e=l.pop()}return r},collides:function(t){var e=this.data,r=this.toBBox;if(!f(t,e))return!1;for(var n,o,i,s,a=[];e;){for(n=0,o=e.children.length;n<o;n++)if(i=e.children[n],s=e.leaf?r(i):i,f(t,s)){if(e.leaf||d(t,s))return!0;a.push(i)}e=a.pop()}return!1},load:function(t){if(!t||!t.length)return this;if(t.length<this._minEntries){for(var e=0,r=t.length;e<r;e++)this.insert(t[e]);return this}var n=this._build(t.slice(),0,t.length-1,0);if(this.data.children.length)if(this.data.height===n.height)this._splitRoot(this.data,n);else{if(this.data.height<n.height){var o=this.data;this.data=n,n=o}this._insert(n,this.data.height-n.height-1,!0)}else this.data=n;return this},insert:function(t){return t&&this._insert(t,this.data.height-1),this},clear:function(){return this.data=m([]),this},remove:function(t,e){if(!t)return this;for(var r,n,i,s,a=this.data,l=this.toBBox(t),u=[],c=[];a||u.length;){if(a||(a=u.pop(),n=u[u.length-1],r=c.pop(),s=!0),a.leaf&&(i=o(t,a.children,e),i!==-1))return a.children.splice(i,1),u.push(a),this._condense(u),this;s||a.leaf||!d(a,l)?n?(r++,a=n.children[r],s=!1):a=null:(u.push(a),c.push(r),r=0,n=a,a=a.children[0])}return this},toBBox:function(t){return t},compareMinX:l,compareMinY:u,toJSON:function(){return this.data},fromJSON:function(t){return this.data=t,this},_all:function(t,e){for(var r=[];t;)t.leaf?e.push.apply(e,t.children):r.push.apply(r,t.children),t=r.pop();return e},_build:function(t,e,r,n){var o,s=r-e+1,a=this._maxEntries;if(s<=a)return o=m(t.slice(e,r+1)),i(o,this.toBBox),o;n||(n=Math.ceil(Math.log(s)/Math.log(a)),a=Math.ceil(s/Math.pow(a,n-1))),o=m([]),o.leaf=!1,o.height=n;var l,u,c,p,h=Math.ceil(s/a),_=h*Math.ceil(Math.sqrt(a));
|
|
for(g(t,e,r,_,this.compareMinX),l=e;l<=r;l+=_)for(c=Math.min(l+_-1,r),g(t,l,c,h,this.compareMinY),u=l;u<=c;u+=h)p=Math.min(u+h-1,c),o.children.push(this._build(t,u,p,n-1));return i(o,this.toBBox),o},_chooseSubtree:function(t,e,r,n){for(var o,i,s,a,l,u,p,_;;){if(n.push(e),e.leaf||n.length-1===r)break;for(p=_=1/0,o=0,i=e.children.length;o<i;o++)s=e.children[o],l=c(s),u=h(t,s)-l,u<_?(_=u,p=l<p?l:p,a=s):u===_&&l<p&&(p=l,a=s);e=a||e.children[0]}return e},_insert:function(t,e,r){var n=this.toBBox,o=r?t:n(t),i=[],s=this._chooseSubtree(o,this.data,e,i);for(s.children.push(t),a(s,o);e>=0&&i[e].children.length>this._maxEntries;)this._split(i,e),e--;this._adjustParentBBoxes(o,i,e)},_split:function(t,e){var r=t[e],n=r.children.length,o=this._minEntries;this._chooseSplitAxis(r,o,n);var s=this._chooseSplitIndex(r,o,n),a=m(r.children.splice(s,r.children.length-s));a.height=r.height,a.leaf=r.leaf,i(r,this.toBBox),i(a,this.toBBox),e?t[e-1].children.push(a):this._splitRoot(r,a)},_splitRoot:function(t,e){this.data=m([t,e]),this.data.height=t.height+1,this.data.leaf=!1,i(this.data,this.toBBox)},_chooseSplitIndex:function(t,e,r){var n,o,i,a,l,u,p,h;for(u=p=1/0,n=e;n<=r-e;n++)o=s(t,0,n,this.toBBox),i=s(t,n,r,this.toBBox),a=_(o,i),l=c(o)+c(i),a<u?(u=a,h=n,p=l<p?l:p):a===u&&l<p&&(p=l,h=n);return h},_chooseSplitAxis:function(t,e,r){var n=t.leaf?this.compareMinX:l,o=t.leaf?this.compareMinY:u,i=this._allDistMargin(t,e,r,n),s=this._allDistMargin(t,e,r,o);i<s&&t.children.sort(n)},_allDistMargin:function(t,e,r,n){t.children.sort(n);var o,i,l=this.toBBox,u=s(t,0,e,l),c=s(t,r-e,r,l),h=p(u)+p(c);for(o=e;o<r-e;o++)i=t.children[o],a(u,t.leaf?l(i):i),h+=p(u);for(o=r-e-1;o>=e;o--)i=t.children[o],a(c,t.leaf?l(i):i),h+=p(c);return h},_adjustParentBBoxes:function(t,e,r){for(var n=r;n>=0;n--)a(e[n],t)},_condense:function(t){for(var e,r=t.length-1;r>=0;r--)0===t[r].children.length?r>0?(e=t[r-1].children,e.splice(e.indexOf(t[r]),1)):this.clear():i(t[r],this.toBBox)},_initFormat:function(t){var e=["return a"," - b",";"];this.compareMinX=new Function("a","b",e.join(t[0])),this.compareMinY=new Function("a","b",e.join(t[1])),this.toBBox=new Function("a","return {minX: a"+t[0]+", minY: a"+t[1]+", maxX: a"+t[2]+", maxY: a"+t[3]+"};")}}},{quickselect:"quickselect/index"}],sprintf:[function(t,e,r){/**
|
|
sprintf() for JavaScript 0.7-beta1
|
|
http://www.diveintojavascript.com/projects/javascript-sprintf
|
|
|
|
Copyright (c) Alexandru Marasteanu <alexaholic [at) gmail (dot] com>
|
|
All rights reserved.
|
|
|
|
Redistribution and use in source and binary forms, with or without
|
|
modification, are permitted provided that the following conditions are met:
|
|
* Redistributions of source code must retain the above copyright
|
|
notice, this list of conditions and the following disclaimer.
|
|
* Redistributions in binary form must reproduce the above copyright
|
|
notice, this list of conditions and the following disclaimer in the
|
|
documentation and/or other materials provided with the distribution.
|
|
* Neither the name of sprintf() for JavaScript nor the
|
|
names of its contributors may be used to endorse or promote products
|
|
derived from this software without specific prior written permission.
|
|
|
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
|
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
DISCLAIMED. IN NO EVENT SHALL Alexandru Marasteanu BE LIABLE FOR ANY
|
|
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
|
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
|
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
|
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
|
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
|
|
Changelog:
|
|
2010.11.07 - 0.7-beta1-node
|
|
- converted it to a node.js compatible module
|
|
|
|
2010.09.06 - 0.7-beta1
|
|
- features: vsprintf, support for named placeholders
|
|
- enhancements: format cache, reduced global namespace pollution
|
|
|
|
2010.05.22 - 0.6:
|
|
- reverted to 0.4 and fixed the bug regarding the sign of the number 0
|
|
Note:
|
|
Thanks to Raphael Pigulla <raph (at] n3rd [dot) org> (http://www.n3rd.org/)
|
|
who warned me about a bug in 0.5, I discovered that the last update was
|
|
a regress. I appologize for that.
|
|
|
|
2010.05.09 - 0.5:
|
|
- bug fix: 0 is now preceeded with a + sign
|
|
- bug fix: the sign was not at the right position on padded results (Kamal Abdali)
|
|
- switched from GPL to BSD license
|
|
|
|
2007.10.21 - 0.4:
|
|
- unit test and patch (David Baird)
|
|
|
|
2007.09.17 - 0.3:
|
|
- bug fix: no longer throws exception on empty paramenters (Hans Pufal)
|
|
|
|
2007.09.11 - 0.2:
|
|
- feature: added argument swapping
|
|
|
|
2007.04.03 - 0.1:
|
|
- initial release
|
|
**/
|
|
var n=function(){function t(t){return Object.prototype.toString.call(t).slice(8,-1).toLowerCase()}function e(t,e){for(var r=[];e>0;r[--e]=t);return r.join("")}var r=function(){return r.cache.hasOwnProperty(arguments[0])||(r.cache[arguments[0]]=r.parse(arguments[0])),r.format.call(null,r.cache[arguments[0]],arguments)};return r.object_stringify=function(t,e,n,o){var i="";if(null!=t)switch(typeof t){case"function":return"[Function"+(t.name?": "+t.name:"")+"]";case"object":if(t instanceof Error)return"["+t.toString()+"]";if(e>=n)return"[Object]";if(o&&(o=o.slice(0),o.push(t)),null!=t.length){i+="[";var s=[];for(var a in t)o&&o.indexOf(t[a])>=0?s.push("[Circular]"):s.push(r.object_stringify(t[a],e+1,n,o));i+=s.join(", ")+"]"}else{if("getMonth"in t)return"Date("+t+")";i+="{";var s=[];for(var l in t)t.hasOwnProperty(l)&&(o&&o.indexOf(t[l])>=0?s.push(l+": [Circular]"):s.push(l+": "+r.object_stringify(t[l],e+1,n,o)));i+=s.join(", ")+"}"}return i;case"string":return'"'+t+'"'}return""+t},r.format=function(o,i){var s,a,l,u,c,p,h,_=1,d=o.length,f="",m=[];for(a=0;a<d;a++)if(f=t(o[a]),"string"===f)m.push(o[a]);else if("array"===f){if(u=o[a],u[2])for(s=i[_],l=0;l<u[2].length;l++){if(!s.hasOwnProperty(u[2][l]))throw new Error(n('[sprintf] property "%s" does not exist',u[2][l]));s=s[u[2][l]]}else s=u[1]?i[u[1]]:i[_++];if(/[^sO]/.test(u[8])&&"number"!=t(s))throw new Error(n('[sprintf] expecting number but found %s "'+s+'"',t(s)));switch(u[8]){case"b":s=s.toString(2);break;case"c":s=String.fromCharCode(s);break;case"d":s=parseInt(s,10);break;case"e":s=u[7]?s.toExponential(u[7]):s.toExponential();break;case"f":s=u[7]?parseFloat(s).toFixed(u[7]):parseFloat(s);break;case"O":s=r.object_stringify(s,0,parseInt(u[7])||5);break;case"o":s=s.toString(8);break;case"s":s=(s=String(s))&&u[7]?s.substring(0,u[7]):s;break;case"u":s=Math.abs(s);break;case"x":s=s.toString(16);break;case"X":s=s.toString(16).toUpperCase()}s=/[def]/.test(u[8])&&u[3]&&s>=0?"+"+s:s,p=u[4]?"0"==u[4]?"0":u[4].charAt(1):" ",h=u[6]-String(s).length,c=u[6]?e(p,h):"",m.push(u[5]?s+c:c+s)}return m.join("")},r.cache={},r.parse=function(t){for(var e=t,r=[],n=[],o=0;e;){if(null!==(r=/^[^\x25]+/.exec(e)))n.push(r[0]);else if(null!==(r=/^\x25{2}/.exec(e)))n.push("%");else{if(null===(r=/^\x25(?:([1-9]\d*)\$|\(([^\)]+)\))?(\+)?(0|'[^$])?(-)?(\d+)?(?:\.(\d+))?([b-fosOuxX])/.exec(e)))throw new Error("[sprintf] "+e);if(r[2]){o|=1;var i=[],s=r[2],a=[];if(null===(a=/^([a-z_][a-z_\d]*)/i.exec(s)))throw new Error("[sprintf] "+s);for(i.push(a[1]);""!==(s=s.substring(a[0].length));)if(null!==(a=/^\.([a-z_][a-z_\d]*)/i.exec(s)))i.push(a[1]);else{if(null===(a=/^\[(\d+)\]/.exec(s)))throw new Error("[sprintf] "+s);i.push(a[1])}r[2]=i}else o|=2;if(3===o)throw new Error("[sprintf] mixing positional and named placeholders is not (yet) supported");n.push(r)}e=e.substring(r[0].length)}return n},r}(),o=function(t,e){var r=e.slice();return r.unshift(t),n.apply(null,r)};e.exports=n,n.sprintf=n,n.vsprintf=o},{}],"timezone/index":[function(e,r,n){!function(e){"object"==typeof r&&r.exports?r.exports=e():"function"==typeof t?t(e):this.tz=e()}(function(){function t(t,e,r){var n,o=e.day[1];do n=new Date(Date.UTC(r,e.month,Math.abs(o++)));while(e.day[0]<7&&n.getUTCDay()!=e.day[0]);return n={clock:e.clock,sort:n.getTime(),rule:e,save:6e4*e.save,offset:t.offset},n[n.clock]=n.sort+6e4*e.time,n.posix?n.wallclock=n[n.clock]+(t.offset+e.saved):n.posix=n[n.clock]-(t.offset+e.saved),n}function e(e,r,n){var o,i,s,a,l,u,c,p=e[e.zone],h=[],_=new Date(n).getUTCFullYear(),d=1;for(o=1,i=p.length;o<i&&!(p[o][r]<=n);o++);if(s=p[o],s.rules){for(u=e[s.rules],c=_+1;c>=_-d;--c)for(o=0,i=u.length;o<i;o++)u[o].from<=c&&c<=u[o].to?h.push(t(s,u[o],c)):u[o].to<c&&1==d&&(d=c-u[o].to);for(h.sort(function(t,e){return t.sort-e.sort}),o=0,i=h.length;o<i;o++)n>=h[o][r]&&h[o][h[o].clock]>s[h[o].clock]&&(a=h[o])}return a&&((l=/^(.*)\/(.*)$/.exec(s.format))?a.abbrev=l[a.save?2:1]:a.abbrev=s.format.replace(/%s/,a.rule.letter)),a||s}function r(t,r){return"UTC"==t.zone?r:(t.entry=e(t,"posix",r),r+t.entry.offset+t.entry.save)}function n(t,r){if("UTC"==t.zone)return r;var n,o;return t.entry=n=e(t,"wallclock",r),o=r-n.wallclock,0<o&&o<n.save?null:r-n.offset-n.save}function o(t,e,o){var i,s=+(o[1]+1),a=o[2]*s,l=u.indexOf(o[3].toLowerCase());if(l>9)e+=a*p[l-10];else{if(i=new Date(r(t,e)),l<7)for(;a;)i.setUTCDate(i.getUTCDate()+s),i.getUTCDay()==l&&(a-=s);else 7==l?i.setUTCFullYear(i.getUTCFullYear()+a):8==l?i.setUTCMonth(i.getUTCMonth()+a):i.setUTCDate(i.getUTCDate()+a);null==(e=n(t,i.getTime()))&&(e=n(t,i.getTime()+864e5*s)-864e5*s)}return e}function i(t){if(!t.length)return"0.0.38";var e,i,s,a,l,u=Object.create(this),p=[];for(e=0;e<t.length;e++)if(a=t[e],Array.isArray(a))e||isNaN(a[1])?a.splice.apply(t,[e--,1].concat(a)):l=a;else if(isNaN(a)){if(s=typeof a,"string"==s)~a.indexOf("%")?u.format=a:e||"*"!=a?!e&&(s=/^(\d{4})-(\d{2})-(\d{2})(?:[T\s](\d{2}):(\d{2})(?::(\d{2})(?:\.(\d+))?)?(Z|(([+-])(\d{2}(:\d{2}){0,2})))?)?$/.exec(a))?(l=[],l.push.apply(l,s.slice(1,8)),s[9]?(l.push(s[10]+1),l.push.apply(l,s[11].split(/:/))):s[8]&&l.push(1)):/^\w{2,3}_\w{2}$/.test(a)?u.locale=a:(s=c.exec(a))?p.push(s):u.zone=a:l=a;else if("function"==s){if(s=a.call(u))return s}else if(/^\w{2,3}_\w{2}$/.test(a.name))u[a.name]=a;else if(a.zones){for(s in a.zones)u[s]=a.zones[s];for(s in a.rules)u[s]=a.rules[s]}}else e||(l=a);if(u[u.locale]||delete u.locale,u[u.zone]||delete u.zone,null!=l){if("*"==l)l=u.clock();else if(Array.isArray(l)){for(i=!l[7],e=0;e<11;e++)l[e]=+(l[e]||0);--l[1],l=Date.UTC.apply(Date.UTC,l.slice(0,8))+-l[7]*(36e5*l[8]+6e4*l[9]+1e3*l[10])}else l=Math.floor(l);if(!isNaN(l)){if(i&&(l=n(u,l)),null==l)return l;for(e=0,i=p.length;e<i;e++)l=o(u,l,p[e]);return u.format?(s=new Date(r(u,l)),u.format.replace(/%([-0_^]?)(:{0,3})(\d*)(.)/g,function(t,e,r,n,o){var i,a,c="0";if(i=u[o]){for(t=String(i.call(u,s,l,e,r.length)),"_"==(e||i.style)&&(c=" "),a="-"==e?0:i.pad||0;t.length<a;)t=c+t;for(a="-"==e?0:n||i.pad;t.length<a;)t=c+t;"N"==o&&a<t.length&&(t=t.slice(0,a)),"^"==e&&(t=t.toUpperCase())}return t})):l}}return function(){return u.convert(arguments)}}function s(t,e){var r,n,o;return n=new Date(Date.UTC(t.getUTCFullYear(),0)),r=Math.floor((t.getTime()-n.getTime())/864e5),n.getUTCDay()==e?o=0:(o=7-n.getUTCDay()+e,8==o&&(o=1)),r>=o?Math.floor((r-o)/7)+1:0}function a(t){var e,r,n;return r=t.getUTCFullYear(),e=new Date(Date.UTC(r,0)).getUTCDay(),n=s(t,1)+(e>1&&e<=4?1:0),n?53!=n||4==e||3==e&&29==new Date(r,1,29).getDate()?[n,t.getUTCFullYear()]:[1,t.getUTCFullYear()+1]:(r=t.getUTCFullYear()-1,e=new Date(Date.UTC(r,0)).getUTCDay(),n=4==e||3==e&&29==new Date(r,1,29).getDate()?53:52,[n,t.getUTCFullYear()-1])}var l={clock:function(){return+new Date},zone:"UTC",entry:{abbrev:"UTC",offset:0,save:0},UTC:1,z:function(t,e,r,n){var o,i,s=this.entry.offset+this.entry.save,a=Math.abs(s/1e3),l=[],u=3600;for(o=0;o<3;o++)l.push(("0"+Math.floor(a/u)).slice(-2)),a%=u,u/=60;return"^"!=r||s?("^"==r&&(n=3),3==n?(i=l.join(":"),i=i.replace(/:00$/,""),"^"!=r&&(i=i.replace(/:00$/,""))):n?(i=l.slice(0,n+1).join(":"),"^"==r&&(i=i.replace(/:00$/,""))):i=l.slice(0,2).join(""),i=(s<0?"-":"+")+i,i=i.replace(/([-+])(0)/,{_:" $1","-":"$1"}[r]||"$1$2")):"Z"},"%":function(t){return"%"},n:function(t){return"\n"},t:function(t){return"\t"},U:function(t){return s(t,0)},W:function(t){return s(t,1)},V:function(t){return a(t)[0]},G:function(t){return a(t)[1]},g:function(t){return a(t)[1]%100},j:function(t){return Math.floor((t.getTime()-Date.UTC(t.getUTCFullYear(),0))/864e5)+1},s:function(t){return Math.floor(t.getTime()/1e3)},C:function(t){return Math.floor(t.getUTCFullYear()/100)},N:function(t){return t.getTime()%1e3*1e6},m:function(t){return t.getUTCMonth()+1},Y:function(t){return t.getUTCFullYear()},y:function(t){return t.getUTCFullYear()%100},H:function(t){return t.getUTCHours()},M:function(t){return t.getUTCMinutes()},S:function(t){return t.getUTCSeconds()},e:function(t){return t.getUTCDate()},d:function(t){return t.getUTCDate()},u:function(t){return t.getUTCDay()||7},w:function(t){return t.getUTCDay()},l:function(t){return t.getUTCHours()%12||12},I:function(t){return t.getUTCHours()%12||12},k:function(t){return t.getUTCHours()},Z:function(t){return this.entry.abbrev},a:function(t){return this[this.locale].day.abbrev[t.getUTCDay()]},A:function(t){return this[this.locale].day.full[t.getUTCDay()]},h:function(t){return this[this.locale].month.abbrev[t.getUTCMonth()]},b:function(t){return this[this.locale].month.abbrev[t.getUTCMonth()]},B:function(t){return this[this.locale].month.full[t.getUTCMonth()]},P:function(t){return this[this.locale].meridiem[Math.floor(t.getUTCHours()/12)].toLowerCase()},p:function(t){return this[this.locale].meridiem[Math.floor(t.getUTCHours()/12)]},R:function(t,e){return this.convert([e,"%H:%M"])},T:function(t,e){return this.convert([e,"%H:%M:%S"])},D:function(t,e){return this.convert([e,"%m/%d/%y"])},F:function(t,e){return this.convert([e,"%Y-%m-%d"])},x:function(t,e){return this.convert([e,this[this.locale].date])},r:function(t,e){return this.convert([e,this[this.locale].time12||"%I:%M:%S"])},X:function(t,e){return this.convert([e,this[this.locale].time24])},c:function(t,e){return this.convert([e,this[this.locale].dateTime])},convert:i,locale:"en_US",en_US:{date:"%m/%d/%Y",time24:"%I:%M:%S %p",time12:"%I:%M:%S %p",dateTime:"%a %d %b %Y %I:%M:%S %p %Z",meridiem:["AM","PM"],month:{abbrev:"Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec".split("|"),full:"January|February|March|April|May|June|July|August|September|October|November|December".split("|")},day:{abbrev:"Sun|Mon|Tue|Wed|Thu|Fri|Sat".split("|"),full:"Sunday|Monday|Tuesday|Wednesday|Thursday|Friday|Saturday".split("|")}}},u="Sunday|Monday|Tuesday|Wednesday|Thursday|Friday|Saturday|year|month|day|hour|minute|second|millisecond",c=new RegExp("^\\s*([+-])(\\d+)\\s+("+u+")s?\\s*$","i"),p=[36e5,6e4,1e3,1];return u=u.toLowerCase().split("|"),"delmHMSUWVgCIky".replace(/./g,function(t){l[t].pad=2}),l.N.pad=9,l.j.pad=3,l.k.style="_",l.l.style="_",l.e.style="_",function(){return l.convert(arguments)}})},{}],underscore:[function(e,r,n){
|
|
// (c) 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
|
|
// Underscore may be freely distributed under the MIT license.
|
|
(function(){function e(t){function e(e,r,n,o,i,s){for(;i>=0&&i<s;i+=t){var a=o?o[i]:i;n=r(n,e[a],a,e)}return n}return function(r,n,o,i){n=w(n,i,4);var s=!A(r)&&x.keys(r),a=(s||r).length,l=t>0?0:a-1;return arguments.length<3&&(o=r[s?s[l]:l],l+=t),e(r,n,o,s,l,a)}}function o(t){return function(e,r,n){r=k(r,n);for(var o=E(e),i=t>0?0:o-1;i>=0&&i<o;i+=t)if(r(e[i],i,e))return i;return-1}}function i(t,e,r){return function(n,o,i){var s=0,a=E(n);if("number"==typeof i)t>0?s=i>=0?i:Math.max(i+a,s):a=i>=0?Math.min(i+1,a):i+a+1;else if(r&&i&&a)return i=r(n,o),n[i]===o?i:-1;if(o!==o)return i=e(_.call(n,s,a),x.isNaN),i>=0?i+s:-1;for(i=t>0?s:a-1;i>=0&&i<a;i+=t)if(n[i]===o)return i;return-1}}function s(t,e){var r=O.length,n=t.constructor,o=x.isFunction(n)&&n.prototype||c,i="constructor";for(x.has(t,i)&&!x.contains(e,i)&&e.push(i);r--;)i=O[r],i in t&&t[i]!==o[i]&&!x.contains(e,i)&&e.push(i)}var a=this,l=a._,u=Array.prototype,c=Object.prototype,p=Function.prototype,h=u.push,_=u.slice,d=c.toString,f=c.hasOwnProperty,m=Array.isArray,g=Object.keys,y=p.bind,v=Object.create,b=function(){},x=function(t){return t instanceof x?t:this instanceof x?void(this._wrapped=t):new x(t)};"undefined"!=typeof n?("undefined"!=typeof r&&r.exports&&(n=r.exports=x),n._=x):a._=x,x.VERSION="1.8.3";var w=function(t,e,r){if(void 0===e)return t;switch(null==r?3:r){case 1:return function(r){return t.call(e,r)};case 2:return function(r,n){return t.call(e,r,n)};case 3:return function(r,n,o){return t.call(e,r,n,o)};case 4:return function(r,n,o,i){return t.call(e,r,n,o,i)}}return function(){return t.apply(e,arguments)}},k=function(t,e,r){return null==t?x.identity:x.isFunction(t)?w(t,e,r):x.isObject(t)?x.matcher(t):x.property(t)};x.iteratee=function(t,e){return k(t,e,1/0)};var M=function(t,e){return function(r){var n=arguments.length;if(n<2||null==r)return r;for(var o=1;o<n;o++)for(var i=arguments[o],s=t(i),a=s.length,l=0;l<a;l++){var u=s[l];e&&void 0!==r[u]||(r[u]=i[u])}return r}},T=function(t){if(!x.isObject(t))return{};if(v)return v(t);b.prototype=t;var e=new b;return b.prototype=null,e},S=function(t){return function(e){return null==e?void 0:e[t]}},z=Math.pow(2,53)-1,E=S("length"),A=function(t){var e=E(t);return"number"==typeof e&&e>=0&&e<=z};x.each=x.forEach=function(t,e,r){e=w(e,r);var n,o;if(A(t))for(n=0,o=t.length;n<o;n++)e(t[n],n,t);else{var i=x.keys(t);for(n=0,o=i.length;n<o;n++)e(t[i[n]],i[n],t)}return t},x.map=x.collect=function(t,e,r){e=k(e,r);for(var n=!A(t)&&x.keys(t),o=(n||t).length,i=Array(o),s=0;s<o;s++){var a=n?n[s]:s;i[s]=e(t[a],a,t)}return i},x.reduce=x.foldl=x.inject=e(1),x.reduceRight=x.foldr=e(-1),x.find=x.detect=function(t,e,r){var n;if(n=A(t)?x.findIndex(t,e,r):x.findKey(t,e,r),void 0!==n&&n!==-1)return t[n]},x.filter=x.select=function(t,e,r){var n=[];return e=k(e,r),x.each(t,function(t,r,o){e(t,r,o)&&n.push(t)}),n},x.reject=function(t,e,r){return x.filter(t,x.negate(k(e)),r)},x.every=x.all=function(t,e,r){e=k(e,r);for(var n=!A(t)&&x.keys(t),o=(n||t).length,i=0;i<o;i++){var s=n?n[i]:i;if(!e(t[s],s,t))return!1}return!0},x.some=x.any=function(t,e,r){e=k(e,r);for(var n=!A(t)&&x.keys(t),o=(n||t).length,i=0;i<o;i++){var s=n?n[i]:i;if(e(t[s],s,t))return!0}return!1},x.contains=x.includes=x.include=function(t,e,r,n){return A(t)||(t=x.values(t)),("number"!=typeof r||n)&&(r=0),x.indexOf(t,e,r)>=0},x.invoke=function(t,e){var r=_.call(arguments,2),n=x.isFunction(e);return x.map(t,function(t){var o=n?e:t[e];return null==o?o:o.apply(t,r)})},x.pluck=function(t,e){return x.map(t,x.property(e))},x.where=function(t,e){return x.filter(t,x.matcher(e))},x.findWhere=function(t,e){return x.find(t,x.matcher(e))},x.max=function(t,e,r){var n,o,i=-(1/0),s=-(1/0);if(null==e&&null!=t){t=A(t)?t:x.values(t);for(var a=0,l=t.length;a<l;a++)n=t[a],n>i&&(i=n)}else e=k(e,r),x.each(t,function(t,r,n){o=e(t,r,n),(o>s||o===-(1/0)&&i===-(1/0))&&(i=t,s=o)});return i},x.min=function(t,e,r){var n,o,i=1/0,s=1/0;if(null==e&&null!=t){t=A(t)?t:x.values(t);for(var a=0,l=t.length;a<l;a++)n=t[a],n<i&&(i=n)}else e=k(e,r),x.each(t,function(t,r,n){o=e(t,r,n),(o<s||o===1/0&&i===1/0)&&(i=t,s=o)});return i},x.shuffle=function(t){for(var e,r=A(t)?t:x.values(t),n=r.length,o=Array(n),i=0;i<n;i++)e=x.random(0,i),e!==i&&(o[i]=o[e]),o[e]=r[i];return o},x.sample=function(t,e,r){return null==e||r?(A(t)||(t=x.values(t)),t[x.random(t.length-1)]):x.shuffle(t).slice(0,Math.max(0,e))},x.sortBy=function(t,e,r){return e=k(e,r),x.pluck(x.map(t,function(t,r,n){return{value:t,index:r,criteria:e(t,r,n)}}).sort(function(t,e){var r=t.criteria,n=e.criteria;if(r!==n){if(r>n||void 0===r)return 1;if(r<n||void 0===n)return-1}return t.index-e.index}),"value")};var C=function(t){return function(e,r,n){var o={};return r=k(r,n),x.each(e,function(n,i){var s=r(n,i,e);t(o,n,s)}),o}};x.groupBy=C(function(t,e,r){x.has(t,r)?t[r].push(e):t[r]=[e]}),x.indexBy=C(function(t,e,r){t[r]=e}),x.countBy=C(function(t,e,r){x.has(t,r)?t[r]++:t[r]=1}),x.toArray=function(t){return t?x.isArray(t)?_.call(t):A(t)?x.map(t,x.identity):x.values(t):[]},x.size=function(t){return null==t?0:A(t)?t.length:x.keys(t).length},x.partition=function(t,e,r){e=k(e,r);var n=[],o=[];return x.each(t,function(t,r,i){(e(t,r,i)?n:o).push(t)}),[n,o]},x.first=x.head=x.take=function(t,e,r){if(null!=t)return null==e||r?t[0]:x.initial(t,t.length-e)},x.initial=function(t,e,r){return _.call(t,0,Math.max(0,t.length-(null==e||r?1:e)))},x.last=function(t,e,r){if(null!=t)return null==e||r?t[t.length-1]:x.rest(t,Math.max(0,t.length-e))},x.rest=x.tail=x.drop=function(t,e,r){return _.call(t,null==e||r?1:e)},x.compact=function(t){return x.filter(t,x.identity)};var j=function(t,e,r,n){for(var o=[],i=0,s=n||0,a=E(t);s<a;s++){var l=t[s];if(A(l)&&(x.isArray(l)||x.isArguments(l))){e||(l=j(l,e,r));var u=0,c=l.length;for(o.length+=c;u<c;)o[i++]=l[u++]}else r||(o[i++]=l)}return o};x.flatten=function(t,e){return j(t,e,!1)},x.without=function(t){return x.difference(t,_.call(arguments,1))},x.uniq=x.unique=function(t,e,r,n){x.isBoolean(e)||(n=r,r=e,e=!1),null!=r&&(r=k(r,n));for(var o=[],i=[],s=0,a=E(t);s<a;s++){var l=t[s],u=r?r(l,s,t):l;e?(s&&i===u||o.push(l),i=u):r?x.contains(i,u)||(i.push(u),o.push(l)):x.contains(o,l)||o.push(l)}return o},x.union=function(){return x.uniq(j(arguments,!0,!0))},x.intersection=function(t){for(var e=[],r=arguments.length,n=0,o=E(t);n<o;n++){var i=t[n];if(!x.contains(e,i)){for(var s=1;s<r&&x.contains(arguments[s],i);s++);s===r&&e.push(i)}}return e},x.difference=function(t){var e=j(arguments,!0,!0,1);return x.filter(t,function(t){return!x.contains(e,t)})},x.zip=function(){return x.unzip(arguments)},x.unzip=function(t){for(var e=t&&x.max(t,E).length||0,r=Array(e),n=0;n<e;n++)r[n]=x.pluck(t,n);return r},x.object=function(t,e){for(var r={},n=0,o=E(t);n<o;n++)e?r[t[n]]=e[n]:r[t[n][0]]=t[n][1];return r},x.findIndex=o(1),x.findLastIndex=o(-1),x.sortedIndex=function(t,e,r,n){r=k(r,n,1);for(var o=r(e),i=0,s=E(t);i<s;){var a=Math.floor((i+s)/2);r(t[a])<o?i=a+1:s=a}return i},x.indexOf=i(1,x.findIndex,x.sortedIndex),x.lastIndexOf=i(-1,x.findLastIndex),x.range=function(t,e,r){null==e&&(e=t||0,t=0),r=r||1;for(var n=Math.max(Math.ceil((e-t)/r),0),o=Array(n),i=0;i<n;i++,t+=r)o[i]=t;return o};var P=function(t,e,r,n,o){if(!(n instanceof e))return t.apply(r,o);var i=T(t.prototype),s=t.apply(i,o);return x.isObject(s)?s:i};x.bind=function(t,e){if(y&&t.bind===y)return y.apply(t,_.call(arguments,1));if(!x.isFunction(t))throw new TypeError("Bind must be called on a function");var r=_.call(arguments,2),n=function(){return P(t,n,e,this,r.concat(_.call(arguments)))};return n},x.partial=function(t){var e=_.call(arguments,1),r=function(){for(var n=0,o=e.length,i=Array(o),s=0;s<o;s++)i[s]=e[s]===x?arguments[n++]:e[s];for(;n<arguments.length;)i.push(arguments[n++]);return P(t,r,this,this,i)};return r},x.bindAll=function(t){var e,r,n=arguments.length;if(n<=1)throw new Error("bindAll must be passed function names");for(e=1;e<n;e++)r=arguments[e],t[r]=x.bind(t[r],t);return t},x.memoize=function(t,e){var r=function(n){var o=r.cache,i=""+(e?e.apply(this,arguments):n);return x.has(o,i)||(o[i]=t.apply(this,arguments)),o[i]};return r.cache={},r},x.delay=function(t,e){var r=_.call(arguments,2);return setTimeout(function(){return t.apply(null,r)},e)},x.defer=x.partial(x.delay,x,1),x.throttle=function(t,e,r){var n,o,i,s=null,a=0;r||(r={});var l=function(){a=r.leading===!1?0:x.now(),s=null,i=t.apply(n,o),s||(n=o=null)};return function(){var u=x.now();a||r.leading!==!1||(a=u);var c=e-(u-a);return n=this,o=arguments,c<=0||c>e?(s&&(clearTimeout(s),s=null),a=u,i=t.apply(n,o),s||(n=o=null)):s||r.trailing===!1||(s=setTimeout(l,c)),i}},x.debounce=function(t,e,r){var n,o,i,s,a,l=function(){var u=x.now()-s;u<e&&u>=0?n=setTimeout(l,e-u):(n=null,r||(a=t.apply(i,o),n||(i=o=null)))};return function(){i=this,o=arguments,s=x.now();var u=r&&!n;return n||(n=setTimeout(l,e)),u&&(a=t.apply(i,o),i=o=null),a}},x.wrap=function(t,e){return x.partial(e,t)},x.negate=function(t){return function(){return!t.apply(this,arguments)}},x.compose=function(){var t=arguments,e=t.length-1;return function(){for(var r=e,n=t[e].apply(this,arguments);r--;)n=t[r].call(this,n);return n}},x.after=function(t,e){return function(){if(--t<1)return e.apply(this,arguments)}},x.before=function(t,e){var r;return function(){return--t>0&&(r=e.apply(this,arguments)),t<=1&&(e=null),r}},x.once=x.partial(x.before,2);var N=!{toString:null}.propertyIsEnumerable("toString"),O=["valueOf","isPrototypeOf","toString","propertyIsEnumerable","hasOwnProperty","toLocaleString"];x.keys=function(t){if(!x.isObject(t))return[];if(g)return g(t);var e=[];for(var r in t)x.has(t,r)&&e.push(r);return N&&s(t,e),e},x.allKeys=function(t){if(!x.isObject(t))return[];var e=[];for(var r in t)e.push(r);return N&&s(t,e),e},x.values=function(t){for(var e=x.keys(t),r=e.length,n=Array(r),o=0;o<r;o++)n[o]=t[e[o]];return n},x.mapObject=function(t,e,r){e=k(e,r);for(var n,o=x.keys(t),i=o.length,s={},a=0;a<i;a++)n=o[a],s[n]=e(t[n],n,t);return s},x.pairs=function(t){for(var e=x.keys(t),r=e.length,n=Array(r),o=0;o<r;o++)n[o]=[e[o],t[e[o]]];return n},x.invert=function(t){for(var e={},r=x.keys(t),n=0,o=r.length;n<o;n++)e[t[r[n]]]=r[n];return e},x.functions=x.methods=function(t){var e=[];for(var r in t)x.isFunction(t[r])&&e.push(r);return e.sort()},x.extend=M(x.allKeys),x.extendOwn=x.assign=M(x.keys),x.findKey=function(t,e,r){e=k(e,r);for(var n,o=x.keys(t),i=0,s=o.length;i<s;i++)if(n=o[i],e(t[n],n,t))return n},x.pick=function(t,e,r){var n,o,i={},s=t;if(null==s)return i;x.isFunction(e)?(o=x.allKeys(s),n=w(e,r)):(o=j(arguments,!1,!1,1),n=function(t,e,r){return e in r},s=Object(s));for(var a=0,l=o.length;a<l;a++){var u=o[a],c=s[u];n(c,u,s)&&(i[u]=c)}return i},x.omit=function(t,e,r){if(x.isFunction(e))e=x.negate(e);else{var n=x.map(j(arguments,!1,!1,1),String);e=function(t,e){return!x.contains(n,e)}}return x.pick(t,e,r)},x.defaults=M(x.allKeys,!0),x.create=function(t,e){var r=T(t);return e&&x.extendOwn(r,e),r},x.clone=function(t){return x.isObject(t)?x.isArray(t)?t.slice():x.extend({},t):t},x.tap=function(t,e){return e(t),t},x.isMatch=function(t,e){var r=x.keys(e),n=r.length;if(null==t)return!n;for(var o=Object(t),i=0;i<n;i++){var s=r[i];if(e[s]!==o[s]||!(s in o))return!1}return!0};var D=function(t,e,r,n){if(t===e)return 0!==t||1/t===1/e;if(null==t||null==e)return t===e;t instanceof x&&(t=t._wrapped),e instanceof x&&(e=e._wrapped);var o=d.call(t);if(o!==d.call(e))return!1;switch(o){case"[object RegExp]":case"[object String]":return""+t==""+e;case"[object Number]":return+t!==+t?+e!==+e:0===+t?1/+t===1/e:+t===+e;case"[object Date]":case"[object Boolean]":return+t===+e}var i="[object Array]"===o;if(!i){if("object"!=typeof t||"object"!=typeof e)return!1;var s=t.constructor,a=e.constructor;if(s!==a&&!(x.isFunction(s)&&s instanceof s&&x.isFunction(a)&&a instanceof a)&&"constructor"in t&&"constructor"in e)return!1}r=r||[],n=n||[];for(var l=r.length;l--;)if(r[l]===t)return n[l]===e;if(r.push(t),n.push(e),i){if(l=t.length,l!==e.length)return!1;for(;l--;)if(!D(t[l],e[l],r,n))return!1}else{var u,c=x.keys(t);if(l=c.length,x.keys(e).length!==l)return!1;for(;l--;)if(u=c[l],!x.has(e,u)||!D(t[u],e[u],r,n))return!1}return r.pop(),n.pop(),!0};x.isEqual=function(t,e){return D(t,e)},x.isEmpty=function(t){return null==t||(A(t)&&(x.isArray(t)||x.isString(t)||x.isArguments(t))?0===t.length:0===x.keys(t).length)},x.isElement=function(t){return!(!t||1!==t.nodeType)},x.isArray=m||function(t){return"[object Array]"===d.call(t)},x.isObject=function(t){var e=typeof t;return"function"===e||"object"===e&&!!t},x.each(["Arguments","Function","String","Number","Date","RegExp","Error"],function(t){x["is"+t]=function(e){return d.call(e)==="[object "+t+"]"}}),x.isArguments(arguments)||(x.isArguments=function(t){return x.has(t,"callee")}),"function"!=typeof/./&&"object"!=typeof Int8Array&&(x.isFunction=function(t){return"function"==typeof t||!1}),x.isFinite=function(t){return isFinite(t)&&!isNaN(parseFloat(t))},x.isNaN=function(t){return x.isNumber(t)&&t!==+t},x.isBoolean=function(t){return t===!0||t===!1||"[object Boolean]"===d.call(t)},x.isNull=function(t){return null===t},x.isUndefined=function(t){return void 0===t},x.has=function(t,e){return null!=t&&f.call(t,e)},x.noConflict=function(){return a._=l,this},x.identity=function(t){return t},x.constant=function(t){return function(){return t}},x.noop=function(){},x.property=S,x.propertyOf=function(t){return null==t?function(){}:function(e){return t[e]}},x.matcher=x.matches=function(t){return t=x.extendOwn({},t),function(e){return x.isMatch(e,t)}},x.times=function(t,e,r){var n=Array(Math.max(0,t));e=w(e,r,1);for(var o=0;o<t;o++)n[o]=e(o);return n},x.random=function(t,e){return null==e&&(e=t,t=0),t+Math.floor(Math.random()*(e-t+1))},x.now=Date.now||function(){return(new Date).getTime()};var F={"&":"&","<":"<",">":">",'"':""","'":"'","`":"`"},q=x.invert(F),I=function(t){var e=function(e){return t[e]},r="(?:"+x.keys(t).join("|")+")",n=RegExp(r),o=RegExp(r,"g");return function(t){return t=null==t?"":""+t,n.test(t)?t.replace(o,e):t}};x.escape=I(F),x.unescape=I(q),x.result=function(t,e,r){var n=null==t?void 0:t[e];return void 0===n&&(n=r),x.isFunction(n)?n.call(t):n};var R=0;x.uniqueId=function(t){var e=++R+"";return t?t+e:e},x.templateSettings={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,escape:/<%-([\s\S]+?)%>/g};var L=/(.)^/,B={"'":"'","\\":"\\","\r":"r","\n":"n","\u2028":"u2028","\u2029":"u2029"},V=/\\|'|\r|\n|\u2028|\u2029/g,G=function(t){return"\\"+B[t]};x.template=function(t,e,r){!e&&r&&(e=r),e=x.defaults({},e,x.templateSettings);var n=RegExp([(e.escape||L).source,(e.interpolate||L).source,(e.evaluate||L).source].join("|")+"|$","g"),o=0,i="__p+='";t.replace(n,function(e,r,n,s,a){return i+=t.slice(o,a).replace(V,G),o=a+e.length,r?i+="'+\n((__t=("+r+"))==null?'':_.escape(__t))+\n'":n?i+="'+\n((__t=("+n+"))==null?'':__t)+\n'":s&&(i+="';\n"+s+"\n__p+='"),e}),i+="';\n",e.variable||(i="with(obj||{}){\n"+i+"}\n"),i="var __t,__p='',__j=Array.prototype.join,print=function(){__p+=__j.call(arguments,'');};\n"+i+"return __p;\n";try{var s=new Function(e.variable||"obj","_",i)}catch(a){throw a.source=i,a}var l=function(t){return s.call(this,t,x)},u=e.variable||"obj";return l.source="function("+u+"){\n"+i+"}",l},x.chain=function(t){var e=x(t);return e._chain=!0,e};var U=function(t,e){return t._chain?x(e).chain():e};x.mixin=function(t){x.each(x.functions(t),function(e){var r=x[e]=t[e];x.prototype[e]=function(){var t=[this._wrapped];return h.apply(t,arguments),U(this,r.apply(x,t))}})},x.mixin(x),x.each(["pop","push","reverse","shift","sort","splice","unshift"],function(t){var e=u[t];x.prototype[t]=function(){var r=this._wrapped;return e.apply(r,arguments),"shift"!==t&&"splice"!==t||0!==r.length||delete r[0],U(this,r)}}),x.each(["concat","join","slice"],function(t){var e=u[t];x.prototype[t]=function(){return U(this,e.apply(this._wrapped,arguments))}}),x.prototype.value=function(){return this._wrapped},x.prototype.valueOf=x.prototype.toJSON=x.prototype.value,x.prototype.toString=function(){return""+this._wrapped},"function"==typeof t&&t.amd&&t("underscore",[],function(){return x})}).call(this)},{}],"bootstrap/dropdown":[function(t,e,r){function n(t){i(s).remove(),i(a).each(function(){var e=o(i(this)),r={relatedTarget:this};e.hasClass("bk-bs-open")&&(e.trigger(t=i.Event("hide.bk-bs.dropdown",r)),t.isDefaultPrevented()||e.removeClass("bk-bs-open").trigger("hidden.bk-bs.dropdown",r))})}function o(t){var e=t.attr("data-bk-bs-target");e||(e=t.attr("href"),e=e&&/#[A-Za-z]/.test(e)&&e.replace(/.*(?=#[^\s]*$)/,""));var r=e&&i(e);return r&&r.length?r:t.parent()}var i=t("jquery"),s=".bk-bs-dropdown-backdrop",a="[data-bk-bs-toggle=dropdown]",l=function(t){i(t).on("click.bk-bs.dropdown",this.toggle)};l.prototype.toggle=function(t){var e=i(this);if(!e.is(".bk-bs-disabled, :disabled")){var r=o(e),s=r.hasClass("bk-bs-open");if(n(),!s){"ontouchstart"in document.documentElement&&!r.closest(".bk-bs-navbar-nav").length&&i('<div class="bk-bs-dropdown-backdrop"/>').insertAfter(i(this)).on("click",n);var a={relatedTarget:this};if(r.trigger(t=i.Event("show.bk-bs.dropdown",a)),t.isDefaultPrevented())return;r.toggleClass("bk-bs-open").trigger("shown.bk-bs.dropdown",a),e.focus()}return!1}},l.prototype.keydown=function(t){if(/(38|40|27)/.test(t.keyCode)){var e=i(this);if(t.preventDefault(),t.stopPropagation(),!e.is(".bk-bs-disabled, :disabled")){var r=o(e),n=r.hasClass("bk-bs-open");if(!n||n&&27==t.keyCode)return 27==t.which&&r.find(a).focus(),e.click();var s=" li:not(.bk-bs-divider):visible a",l=r.find("[role=menu]"+s+", [role=listbox]"+s);if(l.length){var u=l.index(l.filter(":focus"));38==t.keyCode&&u>0&&u--,40==t.keyCode&&u<l.length-1&&u++,~u||(u=0),l.eq(u).focus()}}}};var u=i.fn.dropdown;i.fn.dropdown=function(t){return this.each(function(){var e=i(this),r=e.data("bk-bs.dropdown");r||e.data("bk-bs.dropdown",r=new l(this)),"string"==typeof t&&r[t].call(e)})},i.fn.dropdown.Constructor=l,i.fn.dropdown.noConflict=function(){return i.fn.dropdown=u,this},i(document).on("click.bk-bs.dropdown.data-api",n).on("click.bk-bs.dropdown.data-api",".bk-bs-dropdown form",function(t){t.stopPropagation()}).on("click.bk-bs.dropdown.data-api",a,l.prototype.toggle).on("keydown.bk-bs.dropdown.data-api",a+", [role=menu], [role=listbox]",l.prototype.keydown)},{jquery:"jquery"}],gloo2:[function(e,r,n){(function(e){!function(e,o){"function"==typeof t&&t.amd?t([],o):"undefined"!=typeof n?(r.exports=o(),"undefined"==typeof window&&(e.gloo2=r.exports)):e.gloo2=o()}(this,function(){var t,r,n,o,i,s,a,l,u,c,p=function(t,e){return Array.isArray(t)&&Array.isArray(e)?t.concat(e):t+e},h=function(t){for(var e=0;e<t.length;e++)if(!g(t[e]))return!1;return!0},_=function(t,e){if(null==e);else{if(Array.isArray(e)){for(var r=0;r<e.length;r++)if(d(t,e[r]))return!0;return!1}if(e.constructor===Object){for(var n in e)if(t==n)return!0;return!1}if(e.constructor==String)return e.indexOf(t)>=0}var o=Error("Not a container: "+e);throw o.name="TypeError",o},d=function T(t,e){if(null==t||null==e);else{if(Array.isArray(t)&&Array.isArray(e)){for(var r=0,n=t.length==e.length;n&&r<t.length;)n=T(t[r],e[r]),r+=1;return n}if(t.constructor===Object&&e.constructor===Object){var o=Object.keys(t),i=Object.keys(e);o.sort(),i.sort();for(var s,r=0,n=T(o,i);n&&r<o.length;)s=o[r],n=T(t[s],e[s]),r+=1;return n}}return t==e},f=function(t,r){if("undefined"==typeof t||"undefined"!=typeof window&&window===t||"undefined"!=typeof e&&e===t)throw"Class constructor is called as a function.";for(var n in t)void 0!==Object[n]||"function"!=typeof t[n]||t[n].nobind||(t[n]=t[n].bind(t));t.__init__&&t.__init__.apply(t,r)},m=function(t,e){if(("number"==typeof t)+("number"==typeof e)===1){if(t.constructor===String)return k.call(t,e);if(e.constructor===String)return k.call(e,t);if(Array.isArray(e)){var r=t;t=e,e=r}if(Array.isArray(t)){for(var n=[],o=0;o<e;o++)n=n.concat(t);return n}}return t*e},g=function(t){return null===t||"object"!=typeof t?t:void 0!==t.length?!!t.length&&t:void 0!==t.byteLength?!!t.byteLength&&t:t.constructor!==Object||!!Object.getOwnPropertyNames(t).length&&t},y=function(t){return Array.isArray(this)?void this.push(t):this.append.apply(this,arguments)},v=function(t,e){return this.constructor!==Object?this.get.apply(this,arguments):void 0!==this[t]?this[t]:void 0!==e?e:null},b=function(){return"function"==typeof this.keys?this.keys.apply(this,arguments):Object.keys(this)},x=function(t){if(this.constructor!==String)return this.lstrip.apply(this,arguments);t=void 0===t?" \t\r\n":t;for(var e=0;e<this.length;e++)if(t.indexOf(this[e])<0)return this.slice(e);return""},w=function(t){if(!Array.isArray(this))return this.remove.apply(this,arguments);for(var e=0;e<this.length;e++)if(d(this[e],t))return void this.splice(e,1);var r=Error(t);throw r.name="ValueError",r},k=function(t){if(this.repeat)return this.repeat(t);if(t<1)return"";for(var e="",r=this.valueOf();t>1;)1&t&&(e+=r),t>>=1,r+=r;return e+r},M=function(t){return this.constructor!==String?this.startswith.apply(this,arguments):0==this.indexOf(t)};return c=window.console,l="0.3",u=function(t,e){var r,n,o,i,s,a,l;for(e=void 0===e?"periodic check":e,i=[];;){if(n=t.getError(),d(n,t.NO_ERROR)||g(i)&&d(n,i[i.length-1]))break;y.call(i,n)}if(i.length){for(s="",a=i,"object"!=typeof a||Array.isArray(a)||(a=Object.keys(a)),l=0;l<a.length;l+=1)r=a[l],s=p(s,r);throw o=new Error("RuntimeError:"+("OpenGL got errors ("+e+"): "+s)),o.name="RuntimeError",o}return null},r=function(){f(this,arguments)},r.prototype._base_class=Object,r.prototype._class_name="GlooObject",r.prototype.__init__=function(t){if(this._gl=t,this.handle=null,this._create(),null===this.handle)throw"AssertionError: this.handle !== null";return null},r.prototype._create=function(){var t;throw t=new Error("NotImplementedError:"),t.name="NotImplementedError",t},o=function(){f(this,arguments)},o.prototype=Object.create(r.prototype),o.prototype._base_class=r.prototype,o.prototype._class_name="Program",o.prototype.UTYPEMAP={"float":"uniform1fv",vec2:"uniform2fv",vec3:"uniform3fv",vec4:"uniform4fv","int":"uniform1iv",ivec2:"uniform2iv",ivec3:"uniform3iv",ivec4:"uniform4iv",bool:"uniform1iv",bvec2:"uniform2iv",bvec3:"uniform3iv",bvec4:"uniform4iv",mat2:"uniformMatrix2fv",mat3:"uniformMatrix3fv",mat4:"uniformMatrix4fv",sampler1D:"uniform1i",sampler2D:"uniform1i",sampler3D:"uniform1i"},o.prototype.ATYPEMAP={"float":"vertexAttrib1f",vec2:"vertexAttrib2f",vec3:"vertexAttrib3f",vec4:"vertexAttrib4f"},o.prototype.ATYPEINFO={"float":[1,5126],vec2:[2,5126],vec3:[3,5126],vec4:[4,5126]},o.prototype._create=function(){return this.handle=this._gl.createProgram(),this.locations={},this._unset_variables=[],this._validated=!1,this._samplers={},this._attributes={},this._known_invalid=[],null},o.prototype["delete"]=function(){return this._gl.deleteProgram(this.handle),null},o.prototype.activate=function(){return this._gl.useProgram(this.handle),null},o.prototype.deactivate=function(){return this._gl.useProgram(0),null},o.prototype.set_shaders=function(t,e){var r,n,o,i,s,a,l,u,c,h,_,d,f;for(a=this._gl,this._linked=!1,f=a.createShader(a.VERTEX_SHADER),s=a.createShader(a.FRAGMENT_SHADER),_=[[t,f,"vertex"],[e,s,"fragment"]],u=0;u<2;u+=1)if(h=_[u],r=h[0],l=h[1],d=h[2],a.shaderSource(l,r),a.compileShader(l),c=a.getShaderParameter(l,a.COMPILE_STATUS),!g(c))throw i=a.getShaderInfoLog(l),o=new Error("RuntimeError:"+p("errors in "+d+" shader:\n",i)),o.name="RuntimeError",o;if(a.attachShader(this.handle,f),a.attachShader(this.handle,s),a.linkProgram(this.handle),!g(a.getProgramParameter(this.handle,a.LINK_STATUS)))throw n=new Error("RuntimeError:Program link error:\n"+a.getProgramInfoLog(this.handle)),n.name="RuntimeError",n;return this._unset_variables=this._get_active_attributes_and_uniforms(),a.detachShader(this.handle,f),a.detachShader(this.handle,s),a.deleteShader(f),a.deleteShader(s),this._known_invalid=[],this._linked=!0,null},o.prototype._get_active_attributes_and_uniforms=function(){var t,e,r,n,o,i,s,a,l,u,c,h,_,d,f,m,v,b,x;for(a=this._gl,this.locations={},d=new window.RegExp("(\\w+)\\s*(\\[(\\d+)\\])\\s*"),o=a.getProgramParameter(this.handle,a.ACTIVE_UNIFORMS),e=a.getProgramParameter(this.handle,a.ACTIVE_ATTRIBUTES),t=[],b=[],m=[[t,e,a.getActiveAttrib,a.getAttribLocation],[b,o,a.getActiveUniform,a.getUniformLocation]],"object"!=typeof m||Array.isArray(m)||(m=Object.keys(m)),v=0;v<m.length;v+=1)for(x=m[v],f=x,r=f[0],n=f[1],i=f[2],s=f[3],l=0;l<n;l+=1){if(u=i.call(a,this.handle,l),_=u.name,h=_.match(d),g(h))for(_=h[1],c=0;c<u.size;c+=1)y.call(r,[""+_+"["+c+"]",u.type]);else y.call(r,[_,u.type]);this.locations[_]=s.call(a,this.handle,_)}return p(function(){var e,r,n,o=[];for(r=t,"object"!=typeof r||Array.isArray(r)||(r=Object.keys(r)),n=0;n<r.length;n++)e=r[n],o.push(e[0]);return o}.apply(this),function(){var t,e,r,n=[];for(e=b,"object"!=typeof e||Array.isArray(e)||(e=Object.keys(e)),r=0;r<e.length;r++)t=e[r],n.push(t[0]);return n}.apply(this))},o.prototype.set_texture=function(t,e){var r,n,o;if(!g(this._linked))throw r=new Error("RuntimeError:Cannot set uniform when program has no code"),r.name="RuntimeError",r;return n=v.call(this.locations,t,-1),g(n<0)?(_(t,this._known_invalid)||(y.call(this._known_invalid,t),c.log("Variable "+t+" is not an active texture")),null):(_(t,this._unset_variables)&&w.call(this._unset_variables,t),this.activate(),o=b.call(this._samplers).length,_(t,this._samplers)&&(o=this._samplers[t][this._samplers[t].length-1]),this._samplers[t]=[e._target,e.handle,o],this._gl.uniform1i(n,o),null)},o.prototype.set_uniform=function(t,e,r){var n,o,i,s,a,l,u;if(!g(this._linked))throw i=new Error("RuntimeError:Cannot set uniform when program has no code"),i.name="RuntimeError",i;if(a=v.call(this.locations,t,-1),g(a<0))return _(t,this._known_invalid)||(y.call(this._known_invalid,t),c.log("Variable "+t+" is not an active uniform")),null;if(_(t,this._unset_variables)&&w.call(this._unset_variables,t),o=1,M.call(e,"mat")||(n=v.call({"int":"float",bool:"float"},e,x.call(e,"ib")),o=Math.floor(r.length/this.ATYPEINFO[n][0])),g(o>1))for(l=0;l<o;l+=1)_(""+t+"["+l+"]",this._unset_variables)&&(u=""+t+"["+l+"]",_(u,this._unset_variables)&&w.call(this._unset_variables,u));return s=this.UTYPEMAP[e],this.activate(),M.call(e,"mat")?this._gl[s](a,!1,r):this._gl[s](a,r),null},o.prototype.set_attribute=function(t,e,r,n,o){var i,s,l,u,p,h,d,f;if(n=void 0===n?0:n,o=void 0===o?0:o,!g(this._linked))throw s=new Error("RuntimeError:Cannot set attribute when program has no code"),s.name="RuntimeError",s;return h=r instanceof a,p=v.call(this.locations,t,-1),g(p<0)?(_(t,this._known_invalid)||(y.call(this._known_invalid,t),g(h)&&g(o>0)||c.log("Variable "+t+" is not an active attribute")),null):(_(t,this._unset_variables)&&w.call(this._unset_variables,t),this.activate(),g(h)?(f=this.ATYPEINFO[e],d=f[0],u=f[1],l="vertexAttribPointer",i=[d,u,this._gl.FALSE,n,o],this._attributes[t]=[r.handle,p,l,i]):(l=this.ATYPEMAP[e],this._attributes[t]=[0,p,l,r]),null)},o.prototype._pre_draw=function(){var t,e,r,n,o,i,s,a,l,u,c,h;this.activate(),s=this._samplers;for(h in s)s.hasOwnProperty(h)&&(h=s[h],i=h,l=i[0],a=i[1],u=i[2],this._gl.activeTexture(p(this._gl.TEXTURE0,u)),this._gl.bindTexture(l,a));o=this._attributes;for(h in o)o.hasOwnProperty(h)&&(h=o[h],n=h,c=n[0],e=n[1],r=n[2],t=n[3],g(c)?(this._gl.bindBuffer(this._gl.ARRAY_BUFFER,c),this._gl.enableVertexAttribArray(e),this._gl[r].apply(this._gl,[].concat([e],t))):(this._gl.bindBuffer(this._gl.ARRAY_BUFFER,null),this._gl.disableVertexAttribArray(e),this._gl[r].apply(this._gl,[].concat([e],t))));return g(this._validated)||(this._validated=!0,this._validate()),null},o.prototype._validate=function(){var t;if(this._unset_variables.length&&c.log("Program has unset variables: "+this._unset_variables),this._gl.validateProgram(this.handle),!g(this._gl.getProgramParameter(this.handle,this._gl.VALIDATE_STATUS)))throw c.log(this._gl.getProgramInfoLog(this.handle)),t=new Error("RuntimeError:Program validation error"),t.name="RuntimeError",t;return null},o.prototype.draw=function(t,e){var r,o,i,s,a;if(!g(this._linked))throw o=new Error("RuntimeError:Cannot draw program if code has not been set"),o.name="RuntimeError",o;return u(this._gl,"before draw"),g(e instanceof n)?(this._pre_draw(),e.activate(),r=e._buffer_size/2,s=this._gl.UNSIGNED_SHORT,this._gl.drawElements(t,r,s,0),e.deactivate()):(a=e,i=a[0],r=a[1],g(r)&&(this._pre_draw(),this._gl.drawArrays(t,i,r))),u(this._gl,"after draw"),null},t=function(){f(this,arguments)},t.prototype=Object.create(r.prototype),t.prototype._base_class=r.prototype,t.prototype._class_name="Buffer",t.prototype._target=null,t.prototype._usage=35048,t.prototype._create=function(){return this.handle=this._gl.createBuffer(),this._buffer_size=0,null},t.prototype["delete"]=function(){return this._gl.deleteBuffer(this.handle),null},t.prototype.activate=function(){return this._gl.bindBuffer(this._target,this.handle),null},t.prototype.deactivate=function(){return this._gl.bindBuffer(this._target,null),null},t.prototype.set_size=function(t){return d(t,this._buffer_size)||(this.activate(),this._gl.bufferData(this._target,t,this._usage),this._buffer_size=t),null},t.prototype.set_data=function(t,e){return this.activate(),this._gl.bufferSubData(this._target,t,e),null},a=function(){f(this,arguments)},a.prototype=Object.create(t.prototype),a.prototype._base_class=t.prototype,a.prototype._class_name="VertexBuffer",a.prototype._target=34962,n=function(){f(this,arguments)},n.prototype=Object.create(t.prototype),n.prototype._base_class=t.prototype,n.prototype._class_name="IndexBuffer",n.prototype._target=34963,i=function(){f(this,arguments)},i.prototype=Object.create(r.prototype),i.prototype._base_class=r.prototype,i.prototype._class_name="Texture2D",i.prototype._target=3553,i.prototype._types={Int8Array:5120,Uint8Array:5121,Int16Array:5122,Uint16Array:5123,Int32Array:5124,Uint32Array:5125,Float32Array:5126},i.prototype._create=function(){return this.handle=this._gl.createTexture(),this._shape_format=null,null},i.prototype["delete"]=function(){return this._gl.deleteTexture(this.handle),null},i.prototype.activate=function(){return this._gl.bindTexture(this._target,this.handle),null},i.prototype.deactivate=function(){return this._gl.bindTexture(this._target,0),null},i.prototype._get_alignment=function(t){var e,r,n,o;for(r=[4,8,2,1],n=r,"object"!=typeof n||Array.isArray(n)||(n=Object.keys(n)),o=0;o<n.length;o+=1)if(e=n[o],d(t%e,0))return e;return null},i.prototype.set_wrapping=function(t,e){return this.activate(),this._gl.texParameterf(this._target,this._gl.TEXTURE_WRAP_S,t),this._gl.texParameterf(this._target,this._gl.TEXTURE_WRAP_T,e),null},i.prototype.set_interpolation=function(t,e){return this.activate(),this._gl.texParameterf(this._target,this._gl.TEXTURE_MIN_FILTER,t),this._gl.texParameterf(this._target,this._gl.TEXTURE_MAG_FILTER,e),null},i.prototype.set_size=function(t,e){var r,n,o;return n=t,r=n[0],o=n[1],d([r,o,e],this._shape_format)||(this._shape_format=[r,o,e],this.activate(),this._gl.texImage2D(this._target,0,e,o,r,0,e,this._gl.UNSIGNED_BYTE,null)),this.u_shape=[r,o],null},i.prototype.set_data=function(t,e,r){var n,o,i,s,a,l,u,c,p,h,_;if(d(e.length,2)&&(e=[e[0],e[1],1]),this.activate(),s=this._shape_format[2],u=e,l=u[0],p=u[1],n=u[2],c=t,_=c[0],h=c[1],a=v.call(this._types,r.constructor.name,null),null===a)throw i=new Error("ValueError:"+("Type "+r.constructor.name+" not allowed for texture")),i.name="ValueError",i;return o=this._get_alignment(m(e[e.length-2],e[e.length-1])),d(o,4)||this._gl.pixelStorei(this._gl.UNPACK_ALIGNMENT,o),this._gl.texSubImage2D(this._target,0,h,_,p,l,s,a,r),d(o,4)||this._gl.pixelStorei(this._gl.UNPACK_ALIGNMENT,4),null},s=function(){f(this,arguments)},s.prototype=Object.create(i.prototype),s.prototype._base_class=i.prototype,s.prototype._class_name="Texture3DLike",s.prototype.GLSL_SAMPLE_NEAREST="\n vec4 sample3D(sampler2D tex, vec3 texcoord, vec3 shape, vec2 tiles) {\n shape.xyz = shape.zyx; // silly row-major convention\n float nrows = tiles.y, ncols = tiles.x;\n // Don't let adjacent frames be interpolated into this one\n texcoord.x = min(texcoord.x * shape.x, shape.x - 0.5);\n texcoord.x = max(0.5, texcoord.x) / shape.x;\n texcoord.y = min(texcoord.y * shape.y, shape.y - 0.5);\n texcoord.y = max(0.5, texcoord.y) / shape.y;\n\n float zindex = floor(texcoord.z * shape.z);\n\n // Do a lookup in the 2D texture\n float u = (mod(zindex, ncols) + texcoord.x) / ncols;\n float v = (floor(zindex / ncols) + texcoord.y) / nrows;\n\n return texture2D(tex, vec2(u,v));\n }\n ",
|
|
s.prototype.GLSL_SAMPLE_LINEAR="\n vec4 sample3D(sampler2D tex, vec3 texcoord, vec3 shape, vec2 tiles) {\n shape.xyz = shape.zyx; // silly row-major convention\n float nrows = tiles.y, ncols = tiles.x;\n // Don't let adjacent frames be interpolated into this one\n texcoord.x = min(texcoord.x * shape.x, shape.x - 0.5);\n texcoord.x = max(0.5, texcoord.x) / shape.x;\n texcoord.y = min(texcoord.y * shape.y, shape.y - 0.5);\n texcoord.y = max(0.5, texcoord.y) / shape.y;\n\n float z = texcoord.z * shape.z;\n float zindex1 = floor(z);\n float u1 = (mod(zindex1, ncols) + texcoord.x) / ncols;\n float v1 = (floor(zindex1 / ncols) + texcoord.y) / nrows;\n\n float zindex2 = zindex1 + 1.0;\n float u2 = (mod(zindex2, ncols) + texcoord.x) / ncols;\n float v2 = (floor(zindex2 / ncols) + texcoord.y) / nrows;\n\n vec4 s1 = texture2D(tex, vec2(u1, v1));\n vec4 s2 = texture2D(tex, vec2(u2, v2));\n\n return s1 * (zindex2 - z) + s2 * (z - zindex1);\n }\n ",s.prototype._get_tile_info=function(t){var e,r,n,o;if(r=this._gl.getParameter(this._gl.MAX_TEXTURE_SIZE),o=Math.floor(r/t[1]),o=Math.min(o,t[0]),n=window.Math.ceil(t[0]/o),g(m(n,t[2])>r))throw e=new Error("RuntimeError:"+("Cannot fit 3D data with shape "+t+" onto simulated 2D texture.")),e.name="RuntimeError",e;return[o,n]},s.prototype.set_size=function(t,e){var r,n,o,i;return i=this._get_tile_info(t),n=i[0],r=i[1],o=[m(t[1],n),m(t[2],r)],s.prototype._base_class.set_size.call(this,o,e),this.u_shape=[t[0],t[1],t[2]],this.u_tiles=[r,n],null},s.prototype.set_data=function(t,e,r){var n,o,i,a,l,u,c,p,_,f,g,y,v;if(d(e.length,3)&&(e=[e[0],e[1],e[2],1]),!h(function(){var e,r,n,o=[];for(r=t,"object"!=typeof r||Array.isArray(r)||(r=Object.keys(r)),n=0;n<r.length;n++)e=r[n],o.push(d(e,0));return o}.apply(this)))throw a=new Error("ValueError:Texture3DLike does not support nonzero offset (for now)"),a.name="ValueError",a;if(_=this._get_tile_info(e),u=_[0],l=_[1],p=[m(e[1],u),m(e[2],l),e[3]],d(l,1))s.prototype._base_class.set_data.call(this,[0,0],p,r);else for(n=r.constructor,v=new n(m(m(p[0],p[1]),p[2])),s.prototype._base_class.set_data.call(this,[0,0],p,v),y=0;y<e[0];y+=1)f=[Math.floor(y/l),y%l],c=f[0],o=f[1],i=Math.floor(r.length/e[0]),g=r.slice(m(y,i),m(y+1,i)),s.prototype._base_class.set_data.call(this,[m(c,e[1]),m(o,e[2])],e.slice(1),g);return null},{Buffer:t,GlooObject:r,IndexBuffer:n,Program:o,Texture2D:i,Texture3DLike:s,VertexBuffer:a,check_error:u,console:c}})}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],kiwi:[function(t,e,r){/*-----------------------------------------------------------------------------
|
|
| Copyright (c) 2014, Nucleic Development Team.
|
|
|
|
|
| Distributed under the terms of the Modified BSD License.
|
|
|
|
|
| The full license is in the file COPYING.txt, distributed with this software.
|
|
|----------------------------------------------------------------------------*/
|
|
var n;!function(t){function e(t){return t instanceof Array?new l(t):t.__iter__()}function r(t){return t instanceof Array?new u(t):t.__reversed__()}function n(t){return t.__next__()}function o(t){if(t instanceof Array)return t.slice();for(var e,r=[],n=t.__iter__();void 0!==(e=n.__next__());)r.push(e);return r}function i(t,e){if(t instanceof Array){for(var r=0,n=t.length;r<n;++r)if(e(t[r])===!1)return}else for(var o,i=t.__iter__();void 0!==(o=i.__next__());)if(e(o)===!1)return}function s(t,e){var r=[];if(t instanceof Array)for(var n=0,o=t.length;n<o;++n)r.push(e(t[n]));else for(var i,s=t.__iter__();void 0!==(i=s.__next__());)r.push(e(i));return r}function a(t,e){var r,n=[];if(t instanceof Array)for(var o=0,i=t.length;o<i;++o)r=t[o],e(r)&&n.push(r);else for(var s=t.__iter__();void 0!==(r=s.__next__());)e(r)&&n.push(r);return n}var l=function(){function t(t,e){"undefined"==typeof e&&(e=0),this._array=t,this._index=Math.max(0,Math.min(e,t.length))}return t.prototype.__next__=function(){return this._array[this._index++]},t.prototype.__iter__=function(){return this},t}();t.ArrayIterator=l;var u=function(){function t(t,e){"undefined"==typeof e&&(e=t.length),this._array=t,this._index=Math.max(0,Math.min(e,t.length))}return t.prototype.__next__=function(){return this._array[--this._index]},t.prototype.__iter__=function(){return this},t}();t.ReverseArrayIterator=u,t.iter=e,t.reversed=r,t.next=n,t.asArray=o,t.forEach=i,t.map=s,t.filter=a}(n||(n={}));/*-----------------------------------------------------------------------------
|
|
| Copyright (c) 2014, Nucleic Development Team.
|
|
|
|
|
| Distributed under the terms of the Modified BSD License.
|
|
|
|
|
| The full license is in the file COPYING.txt, distributed with this software.
|
|
|----------------------------------------------------------------------------*/
|
|
var n;!function(t){var e=function(){function t(t,e){this.first=t,this.second=e}return t.prototype.copy=function(){return new t(this.first,this.second)},t}();t.Pair=e}(n||(n={}));/*-----------------------------------------------------------------------------
|
|
| Copyright (c) 2014, Nucleic Development Team.
|
|
|
|
|
| Distributed under the terms of the Modified BSD License.
|
|
|
|
|
| The full license is in the file COPYING.txt, distributed with this software.
|
|
|----------------------------------------------------------------------------*/
|
|
var n;!function(t){function e(t,e,r){for(var n,o,i=0,s=t.length;s>0;)n=s>>1,o=i+n,r(t[o],e)<0?(i=o+1,s-=n+1):s=n;return i}function r(t,r,n){var o=e(t,r,n);if(o===t.length)return-1;var i=t[o];return 0!==n(i,r)?-1:o}function n(t,r,n){var o=e(t,r,n);if(o!==t.length){var i=t[o];if(0===n(i,r))return i}}function o(e,r){var n=t.asArray(e),o=n.length;if(o<=1)return n;n.sort(r);for(var i=[n[0]],s=1,a=0;s<o;++s){var l=n[s];0!==r(i[a],l)&&(i.push(l),++a)}return i}function i(t,e,r){for(var n=0,o=0,i=t.length,s=e.length;n<i&&o<s;){var a=r(t[n],e[o]);if(a<0)++n;else{if(!(a>0))return!1;++o}}return!0}function s(t,e,r){var n=t.length,o=e.length;if(n>o)return!1;for(var i=0,s=0;i<n&&s<o;){var a=r(t[i],e[s]);if(a<0)return!1;a>0?++s:(++i,++s)}return!(i<n)}function a(t,e,r){for(var n=0,o=0,i=t.length,s=e.length,a=[];n<i&&o<s;){var l=t[n],u=e[o],c=r(l,u);c<0?(a.push(l),++n):c>0?(a.push(u),++o):(a.push(l),++n,++o)}for(;n<i;)a.push(t[n]),++n;for(;o<s;)a.push(e[o]),++o;return a}function l(t,e,r){for(var n=0,o=0,i=t.length,s=e.length,a=[];n<i&&o<s;){var l=t[n],u=e[o],c=r(l,u);c<0?++n:c>0?++o:(a.push(l),++n,++o)}return a}function u(t,e,r){for(var n=0,o=0,i=t.length,s=e.length,a=[];n<i&&o<s;){var l=t[n],u=e[o],c=r(l,u);c<0?(a.push(l),++n):c>0?++o:(++n,++o)}for(;n<i;)a.push(t[n]),++n;return a}function c(t,e,r){for(var n=0,o=0,i=t.length,s=e.length,a=[];n<i&&o<s;){var l=t[n],u=e[o],c=r(l,u);c<0?(a.push(l),++n):c>0?(a.push(u),++o):(++n,++o)}for(;n<i;)a.push(t[n]),++n;for(;o<s;)a.push(e[o]),++o;return a}t.lowerBound=e,t.binarySearch=r,t.binaryFind=n,t.asSet=o,t.setIsDisjoint=i,t.setIsSubset=s,t.setUnion=a,t.setIntersection=l,t.setDifference=u,t.setSymmetricDifference=c}(n||(n={}));/*-----------------------------------------------------------------------------
|
|
| Copyright (c) 2014, Nucleic Development Team.
|
|
|
|
|
| Distributed under the terms of the Modified BSD License.
|
|
|
|
|
| The full license is in the file COPYING.txt, distributed with this software.
|
|
|----------------------------------------------------------------------------*/
|
|
var n;!function(t){var e=function(){function e(){this._array=[]}return e.prototype.size=function(){return this._array.length},e.prototype.empty=function(){return 0===this._array.length},e.prototype.itemAt=function(t){return this._array[t]},e.prototype.takeAt=function(t){return this._array.splice(t,1)[0]},e.prototype.clear=function(){this._array=[]},e.prototype.swap=function(t){var e=this._array;this._array=t._array,t._array=e},e.prototype.__iter__=function(){return t.iter(this._array)},e.prototype.__reversed__=function(){return t.reversed(this._array)},e}();t.ArrayBase=e}(n||(n={}));/*-----------------------------------------------------------------------------
|
|
| Copyright (c) 2014, Nucleic Development Team.
|
|
|
|
|
| Distributed under the terms of the Modified BSD License.
|
|
|
|
|
| The full license is in the file COPYING.txt, distributed with this software.
|
|
|----------------------------------------------------------------------------*/
|
|
var n,o=this.__extends||function(t,e){function r(){this.constructor=t}for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);r.prototype=e.prototype,t.prototype=new r};!function(t){function e(t){return function(e,r){return t(e.first,r)}}function r(t,e,r){for(var n=0,o=0,i=t.length,s=e.length,a=[];n<i&&o<s;){var l=t[n],u=e[o],c=r(l.first,u.first);c<0?(a.push(l.copy()),++n):c>0?(a.push(u.copy()),++o):(a.push(u.copy()),++n,++o)}for(;n<i;)a.push(t[n].copy()),++n;for(;o<s;)a.push(e[o].copy()),++o;return a}var n=function(n){function i(t){n.call(this),this._compare=t,this._wrapped=e(t)}return o(i,n),i.prototype.comparitor=function(){return this._compare},i.prototype.indexOf=function(e){return t.binarySearch(this._array,e,this._wrapped)},i.prototype.contains=function(e){return t.binarySearch(this._array,e,this._wrapped)>=0},i.prototype.find=function(e){return t.binaryFind(this._array,e,this._wrapped)},i.prototype.setDefault=function(e,r){var n=this._array,o=t.lowerBound(n,e,this._wrapped);if(o===n.length){var i=new t.Pair(e,r());return n.push(i),i}var s=n[o];if(0!==this._compare(s.first,e)){var i=new t.Pair(e,r());return n.splice(o,0,i),i}return s},i.prototype.insert=function(e,r){var n=this._array,o=t.lowerBound(n,e,this._wrapped);if(o===n.length){var i=new t.Pair(e,r);return n.push(i),i}var s=n[o];if(0!==this._compare(s.first,e)){var i=new t.Pair(e,r);return n.splice(o,0,i),i}return s.second=r,s},i.prototype.update=function(e){var n=this;if(e instanceof i){var o=e;this._array=r(this._array,o._array,this._compare)}else t.forEach(e,function(t){n.insert(t.first,t.second)})},i.prototype.erase=function(e){var r=this._array,n=t.binarySearch(r,e,this._wrapped);if(!(n<0))return r.splice(n,1)[0]},i.prototype.copy=function(){for(var t=new i(this._compare),e=t._array,r=this._array,n=0,o=r.length;n<o;++n)e.push(r[n].copy());return t},i}(t.ArrayBase);t.AssociativeArray=n}(n||(n={}));/*-----------------------------------------------------------------------------
|
|
| Copyright (c) 2014, Nucleic Development Team.
|
|
|
|
|
| Distributed under the terms of the Modified BSD License.
|
|
|
|
|
| The full license is in the file COPYING.txt, distributed with this software.
|
|
|----------------------------------------------------------------------------*/
|
|
var n;!function(t){function e(e,n){return e instanceof r?e._array:t.asSet(e,n)}var r=function(r){function n(t){r.call(this),this._compare=t}return o(n,r),n.prototype.comparitor=function(){return this._compare},n.prototype.indexOf=function(e){return t.binarySearch(this._array,e,this._compare)},n.prototype.contains=function(e){return t.binarySearch(this._array,e,this._compare)>=0},n.prototype.insert=function(e){var r=this._array,n=t.lowerBound(r,e,this._compare);return n===r.length?(r.push(e),!0):0!==this._compare(r[n],e)&&(r.splice(n,0,e),!0)},n.prototype.erase=function(e){var r=this._array,n=t.binarySearch(r,e,this._compare);return!(n<0)&&(r.splice(n,1),!0)},n.prototype.copy=function(){var t=new n(this._compare);return t._array=this._array.slice(),t},n.prototype.isDisjoint=function(r){var n=this._compare,o=e(r,n);return t.setIsDisjoint(this._array,o,n)},n.prototype.isSubset=function(r){var n=this._compare,o=e(r,n);return t.setIsSubset(this._array,o,n)},n.prototype.isSuperset=function(r){var n=this._compare,o=e(r,n);return t.setIsSubset(o,this._array,n)},n.prototype.union=function(r){var o=this._compare,i=new n(o),s=e(r,o);return i._array=t.setUnion(this._array,s,o),i},n.prototype.intersection=function(r){var o=this._compare,i=new n(o),s=e(r,o);return i._array=t.setIntersection(this._array,s,o),i},n.prototype.difference=function(r){var o=this._compare,i=new n(o),s=e(r,o);return i._array=t.setDifference(this._array,s,o),i},n.prototype.symmetricDifference=function(r){var o=this._compare,i=new n(o),s=e(r,o);return i._array=t.setSymmetricDifference(this._array,s,o),i},n.prototype.unionUpdate=function(r){var n=this._compare,o=e(r,n);this._array=t.setUnion(this._array,o,n)},n.prototype.intersectionUpdate=function(r){var n=this._compare,o=e(r,n);this._array=t.setIntersection(this._array,o,n)},n.prototype.differenceUpdate=function(r){var n=this._compare,o=e(r,n);this._array=t.setDifference(this._array,o,n)},n.prototype.symmetricDifferenceUpdate=function(r){var n=this._compare,o=e(r,n);this._array=t.setSymmetricDifference(this._array,o,n)},n}(t.ArrayBase);t.UniqueArray=r}(n||(n={}));/*-----------------------------------------------------------------------------
|
|
| Copyright (c) 2014, Nucleic Development Team.
|
|
|
|
|
| Distributed under the terms of the Modified BSD License.
|
|
|
|
|
| The full license is in the file COPYING.txt, distributed with this software.
|
|
|----------------------------------------------------------------------------*/
|
|
/*-----------------------------------------------------------------------------
|
|
| Copyright (c) 2014, Nucleic Development Team.
|
|
|
|
|
| Distributed under the terms of the Modified BSD License.
|
|
|
|
|
| The full license is in the file COPYING.txt, distributed with this software.
|
|
|----------------------------------------------------------------------------*/
|
|
var i;!function(t){!function(t){t[t.Le=0]="Le",t[t.Ge=1]="Ge",t[t.Eq=2]="Eq"}(t.Operator||(t.Operator={}));var e=(t.Operator,function(){function e(e,n,o){"undefined"==typeof o&&(o=t.Strength.required),this._id=r++,this._operator=n,this._expression=e,this._strength=t.Strength.clip(o)}return e.Compare=function(t,e){return t.id()-e.id()},e.prototype.id=function(){return this._id},e.prototype.expression=function(){return this._expression},e.prototype.op=function(){return this._operator},e.prototype.strength=function(){return this._strength},e}());t.Constraint=e;var r=0}(i||(i={}));/*-----------------------------------------------------------------------------
|
|
| Copyright (c) 2014, Nucleic Development Team.
|
|
|
|
|
| Distributed under the terms of the Modified BSD License.
|
|
|
|
|
| The full license is in the file COPYING.txt, distributed with this software.
|
|
|----------------------------------------------------------------------------*/
|
|
var i;!function(t){function e(t){return new n.AssociativeArray(t)}t.createMap=e}(i||(i={}));/*-----------------------------------------------------------------------------
|
|
| Copyright (c) 2014, Nucleic Development Team.
|
|
|
|
|
| Distributed under the terms of the Modified BSD License.
|
|
|
|
|
| The full license is in the file COPYING.txt, distributed with this software.
|
|
|----------------------------------------------------------------------------*/
|
|
var i;!function(t){var e=function(){function t(t){"undefined"==typeof t&&(t=""),this._value=0,this._context=null,this._id=r++,this._name=t}return t.Compare=function(t,e){return t.id()-e.id()},t.prototype.id=function(){return this._id},t.prototype.name=function(){return this._name},t.prototype.setName=function(t){this._name=t},t.prototype.context=function(){return this._context},t.prototype.setContext=function(t){this._context=t},t.prototype.value=function(){return this._value},t.prototype.setValue=function(t){this._value=t},t}();t.Variable=e;var r=0}(i||(i={}));/*-----------------------------------------------------------------------------
|
|
| Copyright (c) 2014, Nucleic Development Team.
|
|
|
|
|
| Distributed under the terms of the Modified BSD License.
|
|
|
|
|
| The full license is in the file COPYING.txt, distributed with this software.
|
|
|----------------------------------------------------------------------------*/
|
|
var i;!function(t){function e(e){for(var r=0,n=function(){return 0},o=t.createMap(t.Variable.Compare),i=0,s=e.length;i<s;++i){var a=e[i];if("number"==typeof a)r+=a;else if(a instanceof t.Variable)o.setDefault(a,n).second+=1;else{if(!(a instanceof Array))throw new Error("invalid Expression argument: "+a);if(2!==a.length)throw new Error("array must have length 2");var l=a[0],u=a[1];if("number"!=typeof l)throw new Error("array item 0 must be a number");if(!(u instanceof t.Variable))throw new Error("array item 1 must be a variable");o.setDefault(u,n).second+=l}}return{terms:o,constant:r}}var r=function(){function t(){var t=e(arguments);this._terms=t.terms,this._constant=t.constant}return t.prototype.terms=function(){return this._terms},t.prototype.constant=function(){return this._constant},t.prototype.value=function(){var t=this._constant;return n.forEach(this._terms,function(e){t+=e.first.value()*e.second}),t},t}();t.Expression=r}(i||(i={}));/*-----------------------------------------------------------------------------
|
|
| Copyright (c) 2014, Nucleic Development Team.
|
|
|
|
|
| Distributed under the terms of the Modified BSD License.
|
|
|
|
|
| The full license is in the file COPYING.txt, distributed with this software.
|
|
|----------------------------------------------------------------------------*/
|
|
var i;!function(t){!function(t){function e(t,e,r,n){"undefined"==typeof n&&(n=1);var o=0;return o+=1e6*Math.max(0,Math.min(1e3,t*n)),o+=1e3*Math.max(0,Math.min(1e3,e*n)),o+=Math.max(0,Math.min(1e3,r*n))}function r(e){return Math.max(0,Math.min(t.required,e))}t.create=e,t.required=e(1e3,1e3,1e3),t.strong=e(1,0,0),t.medium=e(0,1,0),t.weak=e(0,0,1),t.clip=r}(t.Strength||(t.Strength={}));t.Strength}(i||(i={}));/*-----------------------------------------------------------------------------
|
|
| Copyright (c) 2014, Nucleic Development Team.
|
|
|
|
|
| Distributed under the terms of the Modified BSD License.
|
|
|
|
|
| The full license is in the file COPYING.txt, distributed with this software.
|
|
|----------------------------------------------------------------------------*/
|
|
var i;!function(t){function e(t){var e=1e-8;return t<0?-t<e:t<e}function r(){return t.createMap(t.Constraint.Compare)}function n(){return t.createMap(l.Compare)}function o(){return t.createMap(t.Variable.Compare)}function i(){return t.createMap(t.Variable.Compare)}var s=function(){function s(){this._cnMap=r(),this._rowMap=n(),this._varMap=o(),this._editMap=i(),this._infeasibleRows=[],this._objective=new c,this._artificial=null,this._idTick=0}return s.prototype.addConstraint=function(t){var r=this._cnMap.find(t);if(void 0!==r)throw new Error("duplicate constraint");var n=this._createRow(t),o=n.row,i=n.tag,s=this._chooseSubject(o,i);if(0===s.type()&&o.allDummies()){if(!e(o.constant()))throw new Error("unsatisfiable constraint");s=i.marker}if(0===s.type()){if(!this._addWithArtificialVariable(o)){for(var a,l="",u=0;a=t._expression._terms._array[u];u++)l+=a.first._name,l+=", ";var c=["LE","GE","EQ"];throw new Error("Unsatisfiable constraint ["+l.slice(0,-2)+"] operator: "+c[t._operator])}}else o.solveFor(s),this._substitute(s,o),this._rowMap.insert(s,o);this._cnMap.insert(t,i),this._optimize(this._objective)},s.prototype.removeConstraint=function(t){var e=this._cnMap.erase(t);if(void 0===e)throw new Error("unknown constraint");this._removeConstraintEffects(t,e.second);var r=e.second.marker,n=this._rowMap.erase(r);if(void 0===n){var o=this._getMarkerLeavingSymbol(r);if(0===o.type())throw new Error("failed to find leaving row");n=this._rowMap.erase(o),n.second.solveForEx(o,r),this._substitute(r,n.second)}this._optimize(this._objective)},s.prototype.hasConstraint=function(t){return this._cnMap.contains(t)},s.prototype.addEditVariable=function(e,r){var n=this._editMap.find(e);if(void 0!==n)throw new Error("duplicate edit variable");if(r=t.Strength.clip(r),r===t.Strength.required)throw new Error("bad required strength");var o=new t.Expression(e),i=new t.Constraint(o,2,r);this.addConstraint(i);var s=this._cnMap.find(i).second,a={tag:s,constraint:i,constant:0};this._editMap.insert(e,a)},s.prototype.removeEditVariable=function(t){var e=this._editMap.erase(t);if(void 0===e)throw new Error("unknown edit variable");this.removeConstraint(e.second.constraint)},s.prototype.hasEditVariable=function(t){return this._editMap.contains(t)},s.prototype.suggestValue=function(t,e){var r=this._editMap.find(t);if(void 0===r)throw new Error("unknown edit variable");var n=this._rowMap,o=r.second,i=e-o.constant;o.constant=e;var s=o.tag.marker,a=n.find(s);if(void 0!==a)return a.second.add(-i)<0&&this._infeasibleRows.push(s),void this._dualOptimize();var l=o.tag.other,a=n.find(l);if(void 0!==a)return a.second.add(i)<0&&this._infeasibleRows.push(l),void this._dualOptimize();for(var u=0,c=n.size();u<c;++u){var a=n.itemAt(u),p=a.second,h=p.coefficientFor(s);0!==h&&p.add(i*h)<0&&1!==a.first.type()&&this._infeasibleRows.push(a.first)}this._dualOptimize()},s.prototype.updateVariables=function(){for(var t=this._varMap,e=this._rowMap,r=0,n=t.size();r<n;++r){var o=t.itemAt(r),i=e.find(o.second);void 0!==i?o.first.setValue(i.second.constant()):o.first.setValue(0)}},s.prototype._getVarSymbol=function(t){var e=this,r=function(){return e._makeSymbol(1)};return this._varMap.setDefault(t,r).second},s.prototype._createRow=function(r){for(var n=r.expression(),o=new c(n.constant()),i=n.terms(),s=0,a=i.size();s<a;++s){var l=i.itemAt(s);if(!e(l.second)){var p=this._getVarSymbol(l.first),h=this._rowMap.find(p);void 0!==h?o.insertRow(h.second,l.second):o.insertSymbol(p,l.second)}}var _=this._objective,d=r.strength(),f={marker:u,other:u};switch(r.op()){case 0:case 1:var m=0===r.op()?1:-1,g=this._makeSymbol(2);if(f.marker=g,o.insertSymbol(g,m),d<t.Strength.required){var y=this._makeSymbol(3);f.other=y,o.insertSymbol(y,-m),_.insertSymbol(y,d)}break;case 2:if(d<t.Strength.required){var v=this._makeSymbol(3),b=this._makeSymbol(3);f.marker=v,f.other=b,o.insertSymbol(v,-1),o.insertSymbol(b,1),_.insertSymbol(v,d),_.insertSymbol(b,d)}else{var x=this._makeSymbol(4);f.marker=x,o.insertSymbol(x)}}return o.constant()<0&&o.reverseSign(),{row:o,tag:f}},s.prototype._chooseSubject=function(t,e){for(var r=t.cells(),n=0,o=r.size();n<o;++n){var i=r.itemAt(n);if(1===i.first.type())return i.first}var s=e.marker.type();return(2===s||3===s)&&t.coefficientFor(e.marker)<0?e.marker:(s=e.other.type(),(2===s||3===s)&&t.coefficientFor(e.other)<0?e.other:u)},s.prototype._addWithArtificialVariable=function(t){var r=this._makeSymbol(2);this._rowMap.insert(r,t.copy()),this._artificial=t.copy(),this._optimize(this._artificial);var n=e(this._artificial.constant());this._artificial=null;var o=this._rowMap.erase(r);if(void 0!==o){var i=o.second;if(i.isConstant())return n;var s=this._anyPivotableSymbol(i);if(0===s.type())return!1;i.solveForEx(r,s),this._substitute(s,i),this._rowMap.insert(s,i)}for(var a=this._rowMap,l=0,u=a.size();l<u;++l)a.itemAt(l).second.removeSymbol(r);return this._objective.removeSymbol(r),n},s.prototype._substitute=function(t,e){for(var r=this._rowMap,n=0,o=r.size();n<o;++n){var i=r.itemAt(n);i.second.substitute(t,e),i.second.constant()<0&&1!==i.first.type()&&this._infeasibleRows.push(i.first)}this._objective.substitute(t,e),this._artificial&&this._artificial.substitute(t,e)},s.prototype._optimize=function(t){for(;;){var e=this._getEnteringSymbol(t);if(0===e.type())return;var r=this._getLeavingSymbol(e);if(0===r.type())throw new Error("the objective is unbounded");var n=this._rowMap.erase(r).second;n.solveForEx(r,e),this._substitute(e,n),this._rowMap.insert(e,n)}},s.prototype._dualOptimize=function(){for(var t=this._rowMap,e=this._infeasibleRows;0!==e.length;){var r=e.pop(),n=t.find(r);if(void 0!==n&&n.second.constant()<0){var o=this._getDualEnteringSymbol(n.second);if(0===o.type())throw new Error("dual optimize failed");var i=n.second;t.erase(r),i.solveForEx(r,o),this._substitute(o,i),t.insert(o,i)}}},s.prototype._getEnteringSymbol=function(t){for(var e=t.cells(),r=0,n=e.size();r<n;++r){var o=e.itemAt(r),i=o.first;if(o.second<0&&4!==i.type())return i}return u},s.prototype._getDualEnteringSymbol=function(t){for(var e=Number.MAX_VALUE,r=u,n=t.cells(),o=0,i=n.size();o<i;++o){var s=n.itemAt(o),a=s.first,l=s.second;if(l>0&&4!==a.type()){var c=this._objective.coefficientFor(a),p=c/l;p<e&&(e=p,r=a)}}return r},s.prototype._getLeavingSymbol=function(t){for(var e=Number.MAX_VALUE,r=u,n=this._rowMap,o=0,i=n.size();o<i;++o){var s=n.itemAt(o),a=s.first;if(1!==a.type()){var l=s.second,c=l.coefficientFor(t);if(c<0){var p=-l.constant()/c;p<e&&(e=p,r=a)}}}return r},s.prototype._getMarkerLeavingSymbol=function(t){for(var e=Number.MAX_VALUE,r=e,n=e,o=u,i=o,s=o,a=o,l=this._rowMap,c=0,p=l.size();c<p;++c){var h=l.itemAt(c),_=h.second,d=_.coefficientFor(t);if(0!==d){var f=h.first;if(1===f.type())a=f;else if(d<0){var m=-_.constant()/d;m<r&&(r=m,i=f)}else{var m=_.constant()/d;m<n&&(n=m,s=f)}}}return i!==o?i:s!==o?s:a},s.prototype._removeConstraintEffects=function(t,e){3===e.marker.type()&&this._removeMarkerEffects(e.marker,t.strength()),3===e.other.type()&&this._removeMarkerEffects(e.other,t.strength())},s.prototype._removeMarkerEffects=function(t,e){var r=this._rowMap.find(t);void 0!==r?this._objective.insertRow(r.second,-e):this._objective.insertSymbol(t,-e)},s.prototype._anyPivotableSymbol=function(t){for(var e=t.cells(),r=0,n=e.size();r<n;++r){var o=e.itemAt(r),i=o.first.type();if(2===i||3===i)return o.first}return u},s.prototype._makeSymbol=function(t){return new l(t,(this._idTick++))},s}();t.Solver=s;var a;!function(t){t[t.Invalid=0]="Invalid",t[t.External=1]="External",t[t.Slack=2]="Slack",t[t.Error=3]="Error",t[t.Dummy=4]="Dummy"}(a||(a={}));var l=function(){function t(t,e){this._id=e,this._type=t}return t.Compare=function(t,e){return t.id()-e.id()},t.prototype.id=function(){return this._id},t.prototype.type=function(){return this._type},t}(),u=new l(0,(-1)),c=function(){function r(e){"undefined"==typeof e&&(e=0),this._cellMap=t.createMap(l.Compare),this._constant=e}return r.prototype.cells=function(){return this._cellMap},r.prototype.constant=function(){return this._constant},r.prototype.isConstant=function(){return this._cellMap.empty()},r.prototype.allDummies=function(){for(var t=this._cellMap,e=0,r=t.size();e<r;++e){var n=t.itemAt(e);if(4!==n.first.type())return!1}return!0},r.prototype.copy=function(){var t=new r(this._constant);return t._cellMap=this._cellMap.copy(),t},r.prototype.add=function(t){return this._constant+=t},r.prototype.insertSymbol=function(t,r){"undefined"==typeof r&&(r=1);var n=this._cellMap.setDefault(t,function(){return 0});e(n.second+=r)&&this._cellMap.erase(t)},r.prototype.insertRow=function(t,e){"undefined"==typeof e&&(e=1),this._constant+=t._constant*e;for(var r=t._cellMap,n=0,o=r.size();n<o;++n){var i=r.itemAt(n);this.insertSymbol(i.first,i.second*e)}},r.prototype.removeSymbol=function(t){this._cellMap.erase(t)},r.prototype.reverseSign=function(){this._constant=-this._constant;for(var t=this._cellMap,e=0,r=t.size();e<r;++e){var n=t.itemAt(e);n.second=-n.second}},r.prototype.solveFor=function(t){var e=this._cellMap,r=e.erase(t),n=-1/r.second;this._constant*=n;for(var o=0,i=e.size();o<i;++o)e.itemAt(o).second*=n},r.prototype.solveForEx=function(t,e){this.insertSymbol(t,-1),this.solveFor(e)},r.prototype.coefficientFor=function(t){var e=this._cellMap.find(t);return void 0!==e?e.second:0},r.prototype.substitute=function(t,e){var r=this._cellMap.erase(t);void 0!==r&&this.insertRow(e,r.second)},r}()}(i||(i={})),/*-----------------------------------------------------------------------------
|
|
| Copyright (c) 2014, Nucleic Development Team.
|
|
|
|
|
| Distributed under the terms of the Modified BSD License.
|
|
|
|
|
| The full license is in the file COPYING.txt, distributed with this software.
|
|
|----------------------------------------------------------------------------*/
|
|
e.exports=i},{}]},{},["main"])}();/*
|
|
Copyright (c) 2012, Continuum Analytics, Inc.
|
|
All rights reserved.
|
|
|
|
Redistribution and use in source and binary forms, with or without modification,
|
|
are permitted provided that the following conditions are met:
|
|
|
|
Redistributions of source code must retain the above copyright notice,
|
|
this list of conditions and the following disclaimer.
|
|
|
|
Redistributions in binary form must reproduce the above copyright notice,
|
|
this list of conditions and the following disclaimer in the documentation
|
|
and/or other materials provided with the distribution.
|
|
|
|
Neither the name of Continuum Analytics nor the names of any contributors
|
|
may be used to endorse or promote products derived from this software
|
|
without specific prior written permission.
|
|
|
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
|
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
|
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
|
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
|
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
|
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
|
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
|
|
THE POSSIBILITY OF SUCH DAMAGE.
|
|
*/
|