270 lines
766 KiB
JavaScript
270 lines
766 KiB
JavaScript
window.Bokeh=Bokeh=function(){var t=void 0;return function e(t,n,r){function o(i){function s(e){var n=t[i][1][e];return o(n?n:e)}if(!n[i]){if(!t[i]){var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var l=n[i]={exports:{}};s.modules=o.modules,t[i][0].call(l.exports,s,l,l.exports,e,t,n,r)}return n[i].exports}o.modules=t;for(var i=null,s=0;s<r.length;s++)i=o(r[s]);return i}({"common/base":[function(t,e,n){var r,o,i,s,a,l,u,h,c,p,_,d,f,m,g=function(t,e){function n(){this.constructor=t}for(var r in e)y.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},y={}.hasOwnProperty;s=t("underscore"),r=t("./collection"),("undefined"==typeof m||null===m)&&(m={location:{href:"local"}}),p=t("./logging").logger,t("./custom").monkey_patch(),i={},f=m.location.href,f.indexOf("/bokeh")>0?i.prefix=f.slice(0,f.lastIndexOf("/bokeh"))+"/":i.prefix="/",console.log("Bokeh: setting prefix to",i.prefix),c=t("./models"),u={},d=function(t){var e;return new(e=function(e){function n(){return n.__super__.constructor.apply(this,arguments)}return g(n,e),n.prototype.model=t,n}(r))},_=function(t){var e,n,r,o,i,a,l,u,h;i={};for(r in t)if(a=t[r],s.isArray(a)){u=a[0],h=null!=(o=a[1])?o:"";for(l in u)e=u[l],n=l+h,i[n]=e}else i[r]=a;return i},l=null,a=function(){return null==l&&(l=_(c)),l},o=function(t){var e,n;if(n=a(),u[t])return u[t];if(e=n[t],null==e)throw new Error("Module `"+t+"' does not exists. The problem may be two fold. Either a model was requested that's available in an extra bundle, e.g. a widget, or a custom model was requested, but it wasn't registered before first usage.");return null==e.Collection&&(e.Collection=d(e.Model)),e.Collection},o.register=function(t,e){return u[t]=e},o.register_locations=function(t,e,n){var r,o,i,s,l;null==e&&(e=!1),null==n&&(n=null),o=a(),r=_(t),l=[];for(s in r)y.call(r,s)&&(i=r[s],e||!o.hasOwnProperty(s)?l.push(o[s]=i):l.push("function"==typeof n?n(s):void 0));return l},o.registered_names=function(){return Object.keys(a())},h={},e.exports={collection_overrides:u,locations:c,index:h,Collections:o,Config:i}},{"./collection":"common/collection","./custom":"common/custom","./logging":"common/logging","./models":"common/models",underscore:"underscore"}],"common/bbox":[function(t,e,n){var r,o;r=function(){return[[1/0,-(1/0)],[1/0,-(1/0)]]},o=function(t,e){return t[0][0]=Math.min(t[0][0],e[0][0]),t[0][1]=Math.max(t[0][1],e[0][1]),t[1][0]=Math.min(t[1][0],e[1][0]),t[1][1]=Math.max(t[1][1],e[1][1]),t},e.exports={empty:r,extend:o}},{}],"common/build_views":[function(t,e,n){var r,o,i;r=t("underscore"),o=function(t,e,n,o){var s,a,l,u,h,c,p,_,d,f,m;for(null==o&&(o=[]),s=[],d=r.filter(e,function(e){return!r.has(t,e.id)}),l=a=0,c=d.length;c>a;l=++a)_=d[l],m=r.extend({},n,{model:_}),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=r.difference(r.keys(t),r.pluck(e,"id")),u=0,p=f.length;p>u;u++)h=f[u],t[h].remove(),delete t[h];return s},i=function(t){var e,n;if(null!=t.className)return e=t.className.split(" "),n=r.map(e,function(t){return t=t.trim(),0===t.indexOf("ui-")?"bk-"+t:t}),n.join(" ")},o.jQueryUIPrefixer=i,e.exports=o=o},{underscore:"underscore"}],"common/canvas":[function(t,e,n){var r,o,i,s,a,l,u,h,c,p,_,d,f=function(t,e){function n(){this.constructor=t}for(var r in e)m.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},m={}.hasOwnProperty;c=t("underscore"),_=t("kiwi"),a=_.Expression,i=_.Constraint,u=_.Operator,p=t("./canvas_template"),s=t("./continuum_view"),l=t("./layout_box"),d=t("./logging").logger,h=t("./solver"),o=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return f(e,t),e.prototype.className="bk-canvas-wrapper",e.prototype.template=p,e.prototype.initialize=function(t){var n,r,o;return e.__super__.initialize.call(this,t),o={map:this.mget("map")},n=this.template(o),this.$el.html(n),this.canvas_wrapper=this.$el,this.canvas=this.$("canvas.bk-canvas"),this.canvas_events=this.$("div.bk-canvas-events"),this.canvas_overlay=this.$("div.bk-canvas-overlays"),this.map_div=null!=(r=this.$("div.bk-canvas-map"))?r:null,this.ctx=this.canvas[0].getContext("2d"),this.ctx.glcanvas=null,d.debug("CanvasView initialized")},e.prototype.render=function(t){var e,n,r,o,i;return null==t&&(t=!1),this.model.new_bounds||t?(this.mget("use_hidpi")?(n=window.devicePixelRatio||1,e=this.ctx.webkitBackingStorePixelRatio||this.ctx.mozBackingStorePixelRatio||this.ctx.msBackingStorePixelRatio||this.ctx.oBackingStorePixelRatio||this.ctx.backingStorePixelRatio||1,o=n/e):o=1,i=this.mget("width"),r=this.mget("height"),this.$el.attr("style","z-index: 50; width:"+i+"px; height:"+r+"px"),this.canvas.attr("style","width:"+i+"px;height:"+r+"px"),this.canvas.attr("width",i*o).attr("height",r*o),this.$el.attr("width",i).attr("height",r),this.canvas_events.attr("style","z-index:100; position:absolute; top:0; left:0; width:"+i+"px; height:"+r+"px;"),this.canvas_overlay.attr("style","z-index:75; position:absolute; top:0; left:0; width:"+i+"px; height:"+r+"px;"),this.ctx.scale(o,o),this.ctx.translate(.5,.5),this._fixup_line_dash(this.ctx),this._fixup_line_dash_offset(this.ctx),this._fixup_image_smoothing(this.ctx),this._fixup_measure_text(this.ctx),this.model.new_bounds=!1):void 0},e.prototype._fixup_line_dash=function(t){return t.setLineDash||(t.setLineDash=function(e){return t.mozDash=e,t.webkitLineDash=e}),t.getLineDash?void 0:t.getLineDash=function(){return t.mozDash}},e.prototype._fixup_line_dash_offset=function(t){return t.setLineDashOffset=function(e){return t.lineDashOffset=e,t.mozDashOffset=e,t.webkitLineDashOffset=e},t.getLineDashOffset=function(){return t.mozDashOffset}},e.prototype._fixup_image_smoothing=function(t){return t.setImageSmoothingEnabled=function(e){return t.imageSmoothingEnabled=e,t.mozImageSmoothingEnabled=e,t.oImageSmoothingEnabled=e,t.webkitImageSmoothingEnabled=e},t.getImageSmoothingEnabled=function(){var e;return null!=(e=t.imageSmoothingEnabled)?e:!0}},e.prototype._fixup_measure_text=function(t){return t.measureText&&null==t.html5MeasureText?(t.html5MeasureText=t.measureText,t.measureText=function(e){var n;return n=t.html5MeasureText(e),n.ascent=1.6*t.html5MeasureText("m").width,n}):void 0},e}(s),r=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return f(e,t),e.prototype.type="Canvas",e.prototype.default_view=o,e.prototype.initialize=function(t,n){var r;return r=new h,this.set("solver",r),e.__super__.initialize.call(this,t,n),this.new_bounds=!0,r.add_constraint(new i(new a(this._left),u.Eq)),r.add_constraint(new i(new a(this._bottom),u.Eq)),this._set_dims([this.get("canvas_width"),this.get("canvas_height")]),d.debug("Canvas initialized")},e.prototype.vx_to_sx=function(t){return t},e.prototype.vy_to_sy=function(t){return this.get("height")-(t+1)},e.prototype.v_vx_to_sx=function(t){var e,n,r,o;for(n=e=0,r=t.length;r>e;n=++e)o=t[n],t[n]=o;return t},e.prototype.v_vy_to_sy=function(t){var e,n,r,o,i;for(e=this.get("height"),r=n=0,o=t.length;o>n;r=++n)i=t[r],t[r]=e-(i+1);return t},e.prototype.sx_to_vx=function(t){return t},e.prototype.sy_to_vy=function(t){return this.get("height")-(t+1)},e.prototype.v_sx_to_vx=function(t){var e,n,r,o;for(n=e=0,r=t.length;r>e;n=++e)o=t[n],t[n]=o;return t},e.prototype.v_sy_to_vy=function(t){var e,n,r,o,i;for(e=this.get("height"),r=n=0,o=t.length;o>n;r=++n)i=t[r],t[r]=e-(i+1);return t},e.prototype._set_width=function(t,e){return null==e&&(e=!0),null!=this._width_constraint&&this.solver.remove_constraint(this._width_constraint),this._width_constraint=new i(new a(this._width,-t),u.Eq),this.solver.add_constraint(this._width_constraint),e&&this.solver.update_variables(),this.new_bounds=!0},e.prototype._set_height=function(t,e){return null==e&&(e=!0),null!=this._height_constraint&&this.solver.remove_constraint(this._height_constraint),this._height_constraint=new i(new a(this._height,-t),u.Eq),this.solver.add_constraint(this._height_constraint),e&&this.solver.update_variables(),this.new_bounds=!0},e.prototype._set_dims=function(t,e){return null==e&&(e=!0),this._set_width(t[0],!1),this._set_height(t[1],!1),this.solver.update_variables(e)},e.prototype.defaults=function(){return c.extend({},e.__super__.defaults.call(this),{width:300,height:300,map:!1,mousedown_callbacks:[],mousemove_callbacks:[],use_hidpi:!0})},e}(l.Model),e.exports={Model:r}},{"./canvas_template":"common/canvas_template","./continuum_view":"common/continuum_view","./layout_box":"common/layout_box","./logging":"common/logging","./solver":"common/solver",kiwi:"kiwi",underscore:"underscore"}],"common/canvas_template":[function(t,e,n){e.exports=function(t){t||(t={});var e,n=[],r=t.safe,o=t.escape;return e=t.safe=function(t){if(t&&t.ecoSafe)return t;("undefined"==typeof t||null==t)&&(t="");var e=new String(t);return e.ecoSafe=!0,e},o||(o=t.escape=function(t){return(""+t).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}),function(){(function(){this.map&&n.push('\n<div class="bk-canvas-map"></div>\n'),n.push('\n<div class="bk-canvas-events" />\n<div class="bk-canvas-overlays" />\n<canvas class=\'bk-canvas\'></canvas>')}).call(this)}.call(t),t.safe=r,t.escape=o,n.join("")}},{}],"common/cartesian_frame":[function(t,e,n){var r,o,i,s,a,l,u,h,c=function(t,e){function n(){this.constructor=t}for(var r in e)p.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},p={}.hasOwnProperty;u=t("underscore"),s=t("./layout_box"),h=t("./logging").logging,a=t("../models/mappers/linear_mapper"),l=t("../models/mappers/log_mapper"),o=t("../models/mappers/categorical_mapper"),i=t("../models/mappers/grid_mapper"),r=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return c(e,t),e.prototype.type="CartesianFrame",e.prototype.initialize=function(t,n){return e.__super__.initialize.call(this,t,n),this.register_property("x_ranges",function(){return this._get_ranges("x")},!0),this.add_dependencies("x_ranges",this,["x_range","extra_x_ranges"]),this.register_property("y_ranges",function(){return this._get_ranges("y")},!0),this.add_dependencies("y_ranges",this,["y_range","extra_y_ranges"]),this.register_property("x_mappers",function(){return this._get_mappers("x",this.get("x_ranges"),this.get("h_range"))},!0),this.add_dependencies("x_ranges",this,["x_ranges","h_range"]),this.register_property("y_mappers",function(){return this._get_mappers("y",this.get("y_ranges"),this.get("v_range"))},!0),this.add_dependencies("y_ranges",this,["y_ranges","v_range"]),this.register_property("mapper",function(){return new i.Model({domain_mapper:this.get("x_mapper"),codomain_mapper:this.get("y_mapper")})},!0),this.add_dependencies("mapper",this,["x_mapper","y_mapper"]),this.listenTo(this.solver,"layout_update",this._update_mappers)},e.prototype.map_to_screen=function(t,e,n,r,o){var i,s,a,l;return null==r&&(r="default"),null==o&&(o="default"),a=this.get("x_mappers")[r].v_map_to_target(t),i=n.v_vx_to_sx(a),l=this.get("y_mappers")[o].v_map_to_target(e),s=n.v_vy_to_sy(l),[i,s]},e.prototype._get_ranges=function(t){var e,n,r,o;if(o={},o["default"]=this.get(t+"_range"),e=this.get("extra_"+t+"_ranges"),null!=e)for(n in e)r=e[n],o[n]=this.resolve_ref(r);return o},e.prototype._get_mappers=function(t,e,n){var r,i,s,u;i={};for(s in e){if(u=e[s],"Range1d"===u.type||"DataRange1d"===u.type)r="log"===this.get(t+"_mapper_type")?l.Model:a.Model;else{if("FactorRange"!==u.type)return logger.warn("unknown range type for range '"+s+"': "+u),null;r=o.Model}i[s]=new r({source_range:u,target_range:n})}return i},e.prototype._update_mappers=function(){var t,e,n,r,o;n=this.get("x_mappers");for(e in n)t=n[e],t.set("target_range",this.get("h_range"));r=this.get("y_mappers"),o=[];for(e in r)t=r[e],o.push(t.set("target_range",this.get("v_range")));return o},e.prototype.defaults=function(){return u.extend({},e.__super__.defaults.call(this),{extra_x_ranges:{},extra_y_ranges:{}})},e}(s.Model),e.exports={Model:r}},{"../models/mappers/categorical_mapper":"models/mappers/categorical_mapper","../models/mappers/grid_mapper":"models/mappers/grid_mapper","../models/mappers/linear_mapper":"models/mappers/linear_mapper","../models/mappers/log_mapper":"models/mappers/log_mapper","./layout_box":"common/layout_box","./logging":"common/logging",underscore:"underscore"}],"common/client":[function(t,e,n){var r,o,i,s,a,l,u,h,c,p,_,d,f,m,g,y;d=t("underscore"),c=t("es6-promise").Promise,f=t("./logging").logger,y=t("./document"),a=y.Document,h=y.ModelChangedEvent,p=y.RootAddedEvent,_=y.RootRemovedEvent,l=t("./has_props"),i="ws://localhost:5006/ws",s="default",u=function(){function t(t,e,n){this.header=t,this.metadata=e,this.content=n,this.buffers=[]}return t.assemble=function(e,n,r){var o,i,s,a,l;try{return a=JSON.parse(e),l=JSON.parse(n),o=JSON.parse(r),new t(a,l,o)}catch(s){throw i=s,f.error("Failure parsing json "+i+" "+e+" "+n+" "+r,i),i}},t.create_header=function(t,e){var n;return n={msgid:d.uniqueId(),msgtype:t},d.extend(n,e)},t.create=function(e,n,r){var o;return null==r&&(r={}),o=t.create_header(e,n),new t(o,{},r)},t.prototype.send=function(t){var e,n,r,o,i;try{return o=JSON.stringify(this.header),i=JSON.stringify(this.metadata),e=JSON.stringify(this.content),t.send(o),t.send(i),t.send(e)}catch(r){throw n=r,f.error("Error sending ",this,n),n}},t.prototype.complete=function(){return null!=this.header&&null!=this.metadata&&null!=this.content?"num_buffers"in this.header?this.buffers.length===this.header.num_buffers:!0:!1},t.prototype.add_buffer=function(t){return this.buffers.push(t)},t.prototype._header_field=function(t){return t in this.header?this.header[t]:null},t.prototype.msgid=function(){return this._header_field("msgid")},t.prototype.msgtype=function(){return this._header_field("msgtype")},t.prototype.sessid=function(){return this._header_field("sessid")},t.prototype.reqid=function(){return this._header_field("reqid")},t.prototype.problem=function(){return"msgid"in this.header?"msgtype"in this.header?null:"No msgtype in header":"No msgid in header"},t}(),m={"PATCH-DOC":function(t,e){return t._for_session(function(t){return t._handle_patch(e)})},OK:function(t,e){return f.debug("Unhandled OK reply to "+e.reqid())},ERROR:function(t,e){return f.error("Unhandled ERROR reply to "+e.reqid()+": "+e.content.text)}},r=function(){function t(e,n,r,o){this.url=e,this.id=n,this._on_have_session_hook=r,this._on_closed_permanently_hook=o,this._number=t._connection_count,t._connection_count=this._number+1,null==this.url&&(this.url=i),null==this.id&&(this.id=s),f.debug("Creating websocket "+this._number+" to '"+this.url+"' session '"+this.id+"'"),this.socket=null,this.closed_permanently=!1,this._fragments=[],this._partial=null,this._current_handler=null,this._pending_ack=null,this._pending_replies={},this.session=null}return t._connection_count=0,t.prototype._for_session=function(t){return null!==this.session?t(this.session):void 0},t.prototype.connect=function(){var t,e,n;if(this.closed_permanently)return c.reject(new Error("Cannot connect() a closed ClientConnection"));if(null!=this.socket)return c.reject(new Error("Already connected"));this._fragments=[],this._partial=null,this._pending_replies={},this._current_handler=null;try{return n=this.url+"?bokeh-protocol-version=1.0&bokeh-session-id="+this.id,null!=window.MozWebSocket?this.socket=new MozWebSocket(n):this.socket=new WebSocket(n),new c(function(t){return function(e,n){return t.socket.binarytype="arraybuffer",t.socket.onopen=function(){return t._on_open(e,n)},t.socket.onmessage=function(e){return t._on_message(e)},t.socket.onclose=function(e){return t._on_close(e)},t.socket.onerror=function(){return t._on_error(n)}}}(this))}catch(e){return t=e,f.error("websocket creation failed to url: "+this.url),f.error(" - "+t),c.reject(t)}},t.prototype.close=function(){return this.closed_permanently||(f.debug("Permanently closing websocket connection "+this._number),this.closed_permanently=!0,null!=this.socket&&this.socket.close(1e3,"close method called on ClientConnection "+this._number),this._for_session(function(t){return t._connection_closed()}),null==this._on_closed_permanently_hook)?void 0:(this._on_closed_permanently_hook(),this._on_closed_permanently_hook=null)},t.prototype._schedule_reconnect=function(t){var e;return e=function(t){return function(){t.closed_permanently||f.info("Websocket connection "+t._number+" disconnected, will not attempt to reconnect")}}(this),setTimeout(e,t)},t.prototype.send=function(t){var e,n;try{if(null===this.socket)throw new Error("not connected so cannot send "+t);return t.send(this.socket)}catch(n){return e=n,f.error("Error sending message ",e,t)}},t.prototype.send_with_reply=function(t){var e;return e=new c(function(e){return function(n,r){return e._pending_replies[t.msgid()]=[n,r],e.send(t)}}(this)),e.then(function(t){if("ERROR"===t.msgtype())throw new Error("Error reply "+t.content.text);return t},function(t){throw t})},t.prototype._pull_doc_json=function(){var t,e;return t=u.create("PULL-DOC-REQ",{}),e=this.send_with_reply(t),e.then(function(t){if(!("doc"in t.content))throw new Error("No 'doc' field in PULL-DOC-REPLY");return t.content.doc},function(t){throw t})},t.prototype._repull_session_doc=function(){return null===this.session?f.debug("Pulling session for first time"):f.debug("Repulling session"),this._pull_doc_json().then(function(t){return function(e){var n,r,i;return null!==t.session?(t.session.document.replace_with_json(e),f.debug("Updated existing session with new pulled doc")):t.closed_permanently?f.debug("Got new document after connection was already closed"):(n=a.from_json(e),r=a._compute_patch_since_json(e,n),r.events.length>0&&(f.debug("Sending "+r.events.length+" changes from model construction back to server"),i=u.create("PATCH-DOC",{},r),t.send(i)),t.session=new o(t,n,t.id),f.debug("Created a new session from new pulled doc"),null!=t._on_have_session_hook?(t._on_have_session_hook(t.session),t._on_have_session_hook=null):void 0)}}(this),function(t){throw t})["catch"](function(t){return null!=console.trace&&console.trace(t),f.error("Failed to repull session "+t)})},t.prototype._on_open=function(t,e){return f.info("Websocket connection "+this._number+" is now open"),this._pending_ack=[t,e],this._current_handler=function(t){return function(e){return t._awaiting_ack_handler(e)}}(this)},t.prototype._on_message=function(t){var e,n;try{return this._on_message_unchecked(t)}catch(n){return e=n,f.error("Error handling message: "+e+", "+t)}},t.prototype._on_message_unchecked=function(t){var e,n;return null==this._current_handler&&f.error("got a message but haven't set _current_handler"),t.data instanceof ArrayBuffer?null==this._partial||this._partial.complete()?this._close_bad_protocol("Got binary from websocket but we were expecting text"):this._partial.add_buffer(t.data):null!=this._partial?this._close_bad_protocol("Got text from websocket but we were expecting binary"):(this._fragments.push(t.data),3===this._fragments.length&&(this._partial=u.assemble(this._fragments[0],this._fragments[1],this._fragments[2]),this._fragments=[],n=this._partial.problem(),null!==n&&this._close_bad_protocol(n))),null!=this._partial&&this._partial.complete()?(e=this._partial,this._partial=null,this._current_handler(e)):void 0},t.prototype._on_close=function(t){var e,n;for(f.info("Lost websocket "+this._number+" connection, "+t.code+" ("+t.reason+")"),this.socket=null,null!=this._pending_ack&&(this._pending_ack[1](new Error("Lost websocket connection, "+t.code+" ("+t.reason+")")),this._pending_ack=null),e=function(){var t,e,n;e=this._pending_replies;for(n in e)return t=e[n],delete this._pending_replies[n],t;return null},n=e();null!==n;)n[1]("Disconnected"),n=e();return this.closed_permanently?void 0:this._schedule_reconnect(2e3)},t.prototype._on_error=function(t){return f.debug("Websocket error on socket "+this._number),t(new Error("Could not open websocket"))},t.prototype._close_bad_protocol=function(t){return f.error("Closing connection: "+t),null!=this.socket?this.socket.close(1002,t):void 0},t.prototype._awaiting_ack_handler=function(t){return"ACK"!==t.msgtype()?this._close_bad_protocol("First message was not an ACK"):(this._current_handler=function(t){return function(e){return t._steady_state_handler(e)}}(this),this._repull_session_doc(),null!=this._pending_ack?(this._pending_ack[0](this),this._pending_ack=null):void 0)},t.prototype._steady_state_handler=function(t){var e;return t.reqid()in this._pending_replies?(e=this._pending_replies[t.reqid()],delete this._pending_replies[t.reqid()],e[0](t)):t.msgtype()in m?m[t.msgtype()](this,t):f.debug("Doing nothing with message "+t.msgtype())},t}(),o=function(){function t(t,e,n){this._connection=t,this.document=e,this.id=n,this._current_patch=null,this.document_listener=function(t){return function(e){return t._document_changed(e)}}(this),this.document.on_change(this.document_listener)}return t.prototype.close=function(){return this._connection.close()},t.prototype._connection_closed=function(){return this.document.remove_on_change(this.document_listener)},t.prototype.request_server_info=function(){var t,e;return t=u.create("SERVER-INFO-REQ",{}),e=this._connection.send_with_reply(t),e.then(function(t){return t.content})},t.prototype.force_roundtrip=function(){return this.request_server_info().then(function(t){})},t.prototype._should_suppress_on_change=function(t,e){var n,r,o,i,s,a,u,c,f,m,g,y,v,b;if(e instanceof h){for(g=t.content.events,r=0,a=g.length;a>r;r++)if(n=g[r],"ModelChanged"===n.kind&&n.model.id===e.model.id&&n.attr===e.attr)if(m=n["new"],e.new_ instanceof l){if("object"==typeof m&&"id"in m&&m.id===e.new_.id)return!0}else if(d.isEqual(m,e.new_))return!0}else if(e instanceof p){for(y=t.content.events,o=0,u=y.length;u>o;o++)if(n=y[o],"RootAdded"===n.kind&&n.model.id===e.model.id)return!0}else if(e instanceof _){for(v=t.content.events,i=0,c=v.length;c>i;i++)if(n=v[i],"RootRemoved"===n.kind&&n.model.id===e.model.id)return!0}else if(e instanceof TitleChangedEvent)for(b=t.content.events,s=0,f=b.length;f>s;s++)if(n=b[s],"TitleChanged"===n.kind&&n.title===e.title)return!0;return!1},t.prototype._document_changed=function(t){var e;if(!(null!=this._current_patch&&this._should_suppress_on_change(this._current_patch,t)||t instanceof h&&!(t.attr in t.model.serializable_attributes())))return e=u.create("PATCH-DOC",{},this.document.create_json_patch([t])),this._connection.send(e)},t.prototype._handle_patch=function(t){this._current_patch=t;try{return this.document.apply_json_patch(t.content)}finally{this._current_patch=null}},t}(),g=function(t,e){var n,o,i;return i=null,n=null,o=new c(function(o,i){return n=new r(t,e,function(t){var e,n;try{return o(t)}catch(n){throw e=n,f.error("Promise handler threw an error, closing session "+error),t.close(),e}},function(){return i(new Error("Connection was closed before we successfully pulled a session"))}),n.connect().then(function(t){},function(t){throw f.error("Failed to connect to Bokeh server "+t),t})}),o.close=function(){return n.close()},o},e.exports={pull_session:g,DEFAULT_SERVER_WEBSOCKET_URL:i,DEFAULT_SESSION_ID:s}},{"./document":"common/document","./has_props":"common/has_props","./logging":"common/logging","es6-promise":"es6-promise",underscore:"underscore"}],"common/collection":[function(t,e,n){var r,o,i=function(t,e){function n(){this.constructor=t}for(var r in e)s.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},s={}.hasOwnProperty;r=t("backbone"),o=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return i(e,t),e}(r.Collection),e.exports=o},{backbone:"backbone"}],"common/color":[function(t,e,n){var r,o,i,s;o=function(t){var e;return e=Number(t).toString(16),e=1===e.length?"0"+e:e},i=function(t){var e,n,i;return t+="",0===t.indexOf("#")?t:null!=r[t]?r[t]:0===t.indexOf("rgb")?(n=t.match(/\d+/g),e=function(){var t,e,r;for(r=[],t=0,e=n.length;e>t;t++)i=n[t],r.push(o(i));return r}().join(""),"#"+e.slice(0,8)):t},s=function(t,e){var n,r,o;if(null==e&&(e=1),!t)return[0,0,0,0];for(n=i(t),n=n.replace(/ |#/g,""),n.length<=4&&(n=n.replace(/(.)/g,"$1$1")),n=n.match(/../g),o=function(){var t,e,o;for(o=[],t=0,e=n.length;e>t;t++)r=n[t],o.push(parseInt(r,16)/255);return o}();o.length<3;)o.push(0);return o.length<4&&o.push(e),o.slice(0,4)},r={k:"#000000",w:"#FFFFFF",r:"#FF0000",g:"#00FF00",b:"#0000FF",y:"#FFFF00",m:"#FF00FF",c:"#00FFFF",aqua:"#00ffff",aliceblue:"#f0f8ff",antiquewhite:"#faebd7",black:"#000000",blue:"#0000ff",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgreen:"#006400",darkturquoise:"#00ced1",deepskyblue:"#00bfff",green:"#008000",lime:"#00ff00",mediumblue:"#0000cd",mediumspringgreen:"#00fa9a",navy:"#000080",springgreen:"#00ff7f",teal:"#008080",midnightblue:"#191970",dodgerblue:"#1e90ff",lightseagreen:"#20b2aa",forestgreen:"#228b22",seagreen:"#2e8b57",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",limegreen:"#32cd32",mediumseagreen:"#3cb371",turquoise:"#40e0d0",royalblue:"#4169e1",steelblue:"#4682b4",darkslateblue:"#483d8b",mediumturquoise:"#48d1cc",indigo:"#4b0082",darkolivegreen:"#556b2f",cadetblue:"#5f9ea0",cornflowerblue:"#6495ed",mediumaquamarine:"#66cdaa",dimgray:"#696969",dimgrey:"#696969",slateblue:"#6a5acd",olivedrab:"#6b8e23",slategray:"#708090",slategrey:"#708090",lightslategray:"#778899",lightslategrey:"#778899",mediumslateblue:"#7b68ee",lawngreen:"#7cfc00",aquamarine:"#7fffd4",chartreuse:"#7fff00",gray:"#808080",grey:"#808080",maroon:"#800000",olive:"#808000",purple:"#800080",lightskyblue:"#87cefa",skyblue:"#87ceeb",blueviolet:"#8a2be2",darkmagenta:"#8b008b",darkred:"#8b0000",saddlebrown:"#8b4513",darkseagreen:"#8fbc8f",lightgreen:"#90ee90",mediumpurple:"#9370db",darkviolet:"#9400d3",palegreen:"#98fb98",darkorchid:"#9932cc",yellowgreen:"#9acd32",sienna:"#a0522d",brown:"#a52a2a",darkgray:"#a9a9a9",darkgrey:"#a9a9a9",greenyellow:"#adff2f",lightblue:"#add8e6",paleturquoise:"#afeeee",lightsteelblue:"#b0c4de",powderblue:"#b0e0e6",firebrick:"#b22222",darkgoldenrod:"#b8860b",mediumorchid:"#ba55d3",rosybrown:"#bc8f8f",darkkhaki:"#bdb76b",silver:"#c0c0c0",mediumvioletred:"#c71585",indianred:"#cd5c5c",peru:"#cd853f",chocolate:"#d2691e",tan:"#d2b48c",lightgray:"#d3d3d3",lightgrey:"#d3d3d3",thistle:"#d8bfd8",goldenrod:"#daa520",orchid:"#da70d6",palevioletred:"#db7093",crimson:"#dc143c",gainsboro:"#dcdcdc",plum:"#dda0dd",burlywood:"#deb887",lightcyan:"#e0ffff",lavender:"#e6e6fa",darksalmon:"#e9967a",palegoldenrod:"#eee8aa",violet:"#ee82ee",azure:"#f0ffff",honeydew:"#f0fff0",khaki:"#f0e68c",lightcoral:"#f08080",sandybrown:"#f4a460",beige:"#f5f5dc",mintcream:"#f5fffa",wheat:"#f5deb3",whitesmoke:"#f5f5f5",ghostwhite:"#f8f8ff",lightgoldenrodyellow:"#fafad2",linen:"#faf0e6",salmon:"#fa8072",oldlace:"#fdf5e6",bisque:"#ffe4c4",blanchedalmond:"#ffebcd",coral:"#ff7f50",cornsilk:"#fff8dc",darkorange:"#ff8c00",deeppink:"#ff1493",floralwhite:"#fffaf0",fuchsia:"#ff00ff",gold:"#ffd700",hotpink:"#ff69b4",ivory:"#fffff0",lavenderblush:"#fff0f5",lemonchiffon:"#fffacd",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightyellow:"#ffffe0",magenta:"#ff00ff",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",orange:"#ffa500",orangered:"#ff4500",papayawhip:"#ffefd5",peachpuff:"#ffdab9",pink:"#ffc0cb",red:"#ff0000",seashell:"#fff5ee",snow:"#fffafa",tomato:"#ff6347",white:"#ffffff",yellow:"#ffff00"},e.exports={color2hex:i,color2rgba:s}},{}],"common/continuum_view":[function(t,e,n){var r,o,i,s=function(t,e){function n(){this.constructor=t}for(var r in e)a.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},a={}.hasOwnProperty;i=t("underscore"),r=t("backbone"),o=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return s(e,t),e.prototype.initialize=function(t){return i.has(t,"id")?void 0:this.id=i.uniqueId("ContinuumView")},e.prototype.bind_bokeh_events=function(){return"pass"},e.prototype.delegateEvents=function(t){return e.__super__.delegateEvents.call(this,t)},e.prototype.remove=function(){var t,n,r;if(i.has(this,"eventers")){t=this.eventers;for(n in t)a.call(t,n)&&(r=t[n],r.off(null,null,this))}return this.trigger("remove",this),e.__super__.remove.call(this)},e.prototype.mget=function(){return this.model.get.apply(this.model,arguments)},e.prototype.mset=function(){return this.model.set.apply(this.model,arguments)},e.prototype.render_end=function(){return"pass"},e}(r.View),e.exports=o},{backbone:"backbone",underscore:"underscore"}],"common/custom":[function(t,e,n){var r,o;r=t("underscore"),o=function(){return r.uniqueId=function(t){var e,n,r,o,i;for(o=[],e="0123456789ABCDEF",n=r=0;31>=r;n=++r)o[n]=e.substr(Math.floor(16*Math.random()),1);return o[12]="4",o[16]=e.substr(3&o[16]|8,1),i=o.join(""),t?t+"-"+i:i}},r.isNullOrUndefined=function(t){return r.isNull(t)||r.isUndefined(t)},r.setdefault=function(t,e,n){return r.has(t,e)?t[e]:(t[e]=n,n)},e.exports={monkey_patch:o}},{underscore:"underscore"}],"common/document":[function(t,e,n){var r,o,i,s,a,l,u,h,c,p,_,d,f=function(t,e){function n(){this.constructor=t}for(var r in e)m.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},m={}.hasOwnProperty,g=[].indexOf||function(t){for(var e=0,n=this.length;n>e;e++)if(e in this&&this[e]===t)return e;return-1};p=t("underscore"),d=t("./logging").logger,a=t("./has_props"),r=t("./base").Collections,s=function(){function t(t){this.document=t}return t}(),l=function(t){function e(t,n,r,o,i){this.document=t,this.model=n,this.attr=r,this.old=o,this.new_=i,e.__super__.constructor.call(this,this.document)}return f(e,t),e}(s),c=function(t){function e(t,n){this.document=t,this.title=n,e.__super__.constructor.call(this,this.document)}return f(e,t),e}(s),u=function(t){function e(t,n){this.document=t,this.model=n,e.__super__.constructor.call(this,this.document)}return f(e,t),e}(s),h=function(t){function e(t,n){this.document=t,this.model=n,e.__super__.constructor.call(this,this.document)}return f(e,t),e}(s),o="Bokeh Application",_=function(){function t(){this._dict={}}return t.prototype._existing=function(t){return t in this._dict?this._dict[t]:null},t.prototype.add_value=function(t,e){var n;if(null===e)throw new Error("Can't put null in this dict");if(p.isArray(e))throw new Error("Can't put arrays in this dict");return n=this._existing(t),null===n?this._dict[t]=e:p.isArray(n)?n.push(e):this._dict[t]=[n,e]},t.prototype.remove_value=function(t,e){var n,r;return n=this._existing(t),p.isArray(n)?(r=p.without(n,e),r.length>0?this._dict[t]=r:delete this._dict[t]):p.isEqual(n,e)?delete this._dict[t]:void 0},t.prototype.get_one=function(t,e){var n;if(n=this._existing(t),p.isArray(n)){if(1===n.length)return n[0];throw new Error(e)}return n},t}(),i=function(){function t(){this._title=o,this._roots=[],this._all_models={},this._all_models_by_name=new _,this._all_model_counts={},this._callbacks=[]}return t.prototype.clear=function(){var t;for(t=[];this._roots.length>0;)t.push(this.remove_root(this._roots[0]));return t},t.prototype._destructively_move=function(t){var e;for(t.clear();this._roots.length>0;)e=this._roots[0],this.remove_root(e),t.add_root(e);return t.set_title(this._title)},t.prototype.roots=function(){return this._roots},t.prototype.add_root=function(t){return g.call(this._roots,t)>=0?void 0:(this._roots.push(t),t.attach_document(this),this._trigger_on_change(new u(this,t)))},t.prototype.remove_root=function(t){var e;return e=this._roots.indexOf(t),0>e?void 0:(this._roots.splice(e,1),t.detach_document(),this._trigger_on_change(new h(this,t)))},t.prototype.title=function(){return this._title},t.prototype.set_title=function(t){return t!==this._title?(this._title=t,this._trigger_on_change(new c(this,t))):void 0},t.prototype.get_model_by_id=function(t){return t in this._all_models?this._all_models[t]:null},t.prototype.get_model_by_name=function(t){
|
|
return this._all_models_by_name.get_one(t,"Multiple models are named '"+t+"'")},t.prototype.on_change=function(t){return g.call(this._callbacks,t)>=0?void 0:this._callbacks.push(t)},t.prototype.remove_on_change=function(t){var e;return e=this._callbacks.indexOf(t),e>=0?this._callbacks.splice(e,1):void 0},t.prototype._trigger_on_change=function(t){var e,n,r,o,i;for(o=this._callbacks,i=[],n=0,r=o.length;r>n;n++)e=o[n],i.push(e(t));return i},t.prototype._notify_change=function(t,e,n,r){return"name"===e&&(this._all_models_by_name.remove_value(n,t),null!==r&&this._all_models_by_name.add_value(r,t)),this._trigger_on_change(new l(this,t,e,n,r))},t.prototype._notify_attach=function(t){var e;if(!t.serializable_in_document())throw console.log("Attempted to attach nonserializable to document ",t),new Error("Should not attach nonserializable model "+t.constructor.name+" to document");return t.id in this._all_model_counts?this._all_model_counts[t.id]=this._all_model_counts[t.id]+1:this._all_model_counts[t.id]=1,this._all_models[t.id]=t,e=t.get("name"),null!==e?this._all_models_by_name.add_value(e,t):void 0},t.prototype._notify_detach=function(t){var e,n;return this._all_model_counts[t.id]-=1,e=this._all_model_counts[t.id],0===e&&(delete this._all_models[t.id],delete this._all_model_counts[t.id],n=t.get("name"),null!==n&&this._all_models_by_name.remove_value(n,t)),e},t._references_json=function(t,e){var n,r,o,i,s;for(null==e&&(e=!0),s=[],n=0,r=t.length;r>n;n++){if(o=t[n],!o.serializable_in_document())throw console.log("nonserializable value in references ",o),new Error("references should never contain nonserializable value");i=o.ref(),i.attributes=o.attributes_as_json(e),delete i.attributes.id,s.push(i)}return s},t._instantiate_object=function(t,e,n){var o,i;if(i=p.extend({},n,{id:t}),o=r(e),null==o)throw new Error("unknown model type "+e+" for "+t);return new o.model(i,{silent:!0,defer_initialization:!0})},t._instantiate_references_json=function(e,n){var r,o,i,s,a,l,u,h;for(h={},o=0,i=e.length;i>o;o++)s=e[o],l=s.id,u=s.type,a=s.attributes,l in n?r=n[l]:(r=t._instantiate_object(l,u,a),"subtype"in s&&r.set_subtype(s.subtype)),h[r.id]=r;return h},t._resolve_refs=function(t,e,n){var r,o,i;return i=function(t){if(a._is_ref(t)){if(t.id in e)return e[t.id];if(t.id in n)return n[t.id];throw new Error("reference "+JSON.stringify(t)+" isn't known (not in Document?)")}return p.isArray(t)?r(t):p.isObject(t)?o(t):t},o=function(t){var e,n,r;n={};for(e in t)r=t[e],n[e]=i(r);return n},r=function(t){var e,n,r,o;for(r=[],e=0,n=t.length;n>e;e++)o=t[e],r.push(i(o));return r},i(t)},t._initialize_references_json=function(e,n,r){var o,i,s,l,u,h,c,_,d;for(_={},s=0,l=e.length;l>s;s++)u=e[s],c=u.id,h=u.attributes,d=!1,i=c in n?n[c]:(d=!0,r[c]),h=t._resolve_refs(h,n,r),_[i.id]=[i,h,d];return o=function(t,e){var n,r,o,i,s;n={},r=function(e,o){var i,s,l,u,h,c,_,f,m,g;if(e instanceof a){if(!(e.id in n)&&e.id in t){n[e.id]=!0,_=t[e.id],g=_[0],s=_[1],d=_[2];for(i in s)l=s[i],r(l,o);return o(e,s,d)}}else{if(p.isArray(e)){for(f=[],h=0,c=e.length;c>h;h++)l=e[h],f.push(r(l,o));return f}if(p.isObject(e)){m=[];for(u in e)l=e[u],m.push(r(l,o));return m}}},i=[];for(o in t)s=t[o],i.push(r(s[0],e));return i},o(_,function(t,e,n){return n?t.set(e):void 0}),o(_,function(t,e,n){return n?t.initialize(e):void 0})},t._event_for_attribute_change=function(t,e,n,r,o){var i,s;return i=r.get_model_by_id(t.id),i.attribute_is_serializable(e)?(s={kind:"ModelChanged",model:{id:t.id,type:t.type},attr:e,"new":n},a._json_record_references(r,n,o,!0),s):null},t._events_to_sync_objects=function(e,n,r,o){var i,s,a,l,u,h,c,_,f,m,g,y,v,b,x;for(a=Object.keys(e.attributes),x=Object.keys(n.attributes),v=p.difference(a,x),i=p.difference(x,a),b=p.intersection(a,x),s=[],l=0,c=v.length;c>l;l++)u=v[l],d.warn("Server sent key "+u+" but we don't seem to have it in our JSON");for(h=0,_=i.length;_>h;h++)u=i[h],g=n.attributes[u],s.push(t._event_for_attribute_change(e,u,g,r,o));for(m=0,f=b.length;f>m;m++)u=b[m],y=e.attributes[u],g=n.attributes[u],null===y&&null===g||(null===y||null===g?s.push(t._event_for_attribute_change(e,u,g,r,o)):p.isEqual(y,g)||s.push(t._event_for_attribute_change(e,u,g,r,o)));return p.filter(s,function(t){return null!==t})},t._compute_patch_since_json=function(e,n){var r,o,i,s,a,l,u,h,c,_,d,f,m,g,y,v,b,x,w,k,M,j;for(b=n.to_json(l=!1),v=function(t){var e,n,r,o,i;for(i={},o=t.roots.references,e=0,n=o.length;n>e;e++)r=o[e],i[r.id]=r;return i},o=v(e),s={},i=[],m=e.roots.root_ids,u=0,c=m.length;c>u;u++)f=m[u],s[f]=o[f],i.push(f);for(x=v(b),k={},w=[],g=b.roots.root_ids,h=0,_=g.length;_>h;h++)f=g[h],k[f]=x[f],w.push(f);if(i.sort(),w.sort(),p.difference(i,w).length>0||p.difference(w,i).length>0)throw new Error("Not implemented: computing add/remove of document roots");j={},r=[],y=n._all_models;for(a in y)d=y[a],a in o&&(M=t._events_to_sync_objects(o[a],x[a],n,j),r=r.concat(M));return{events:r,references:t._references_json(p.values(j),l=!1)}},t.prototype.to_json_string=function(t){return null==t&&(t=!0),JSON.stringify(this.to_json(t))},t.prototype.to_json=function(e){var n,r,o,i,s,a,l,u;for(null==e&&(e=!0),a=[],s=this._roots,n=0,o=s.length;o>n;n++)i=s[n],a.push(i.id);return l=function(){var t,e;t=this._all_models,e=[];for(r in t)u=t[r],e.push(u);return e}.call(this),{title:this._title,roots:{root_ids:a,references:t._references_json(l,e)}}},t.from_json_string=function(e){var n;if(null===e||null==e)throw new Error("JSON string is "+typeof e);return n=JSON.parse(e),t.from_json(n)},t.from_json=function(e){var n,r,o,i,s,a,l,u;if("object"!=typeof e)throw new Error("JSON object has wrong type "+typeof e);for(u=e.roots,l=u.root_ids,a=u.references,s=t._instantiate_references_json(a,{}),t._initialize_references_json(a,{},s),n=new t,r=0,o=l.length;o>r;r++)i=l[r],n.add_root(s[i]);return n.set_title(e.title),n},t.prototype.replace_with_json=function(e){var n;return n=t.from_json(e),n._destructively_move(this)},t.prototype.create_json_patch_string=function(t){return JSON.stringify(this.create_json_patch(t))},t.prototype.create_json_patch=function(e){var n,r,o,i,s,_,d,f,m,g;for(d={},s=[],o=0,_=e.length;_>o;o++){if(n=e[o],n.document!==this)throw console.log("Cannot create a patch using events from a different document, event had ",n.document," we are ",this),new Error("Cannot create a patch using events from a different document");if(n instanceof l){if("id"===n.attr)throw console.log("'id' field is immutable and should never be in a ModelChangedEvent ",n),new Error("'id' field should never change, whatever code just set it is wrong");f=n.new_,m=a._value_to_json("new_",f,n.model),g={},a._value_record_references(f,g,!0),n.model.id in g&&n.model!==f&&delete g[n.model.id];for(r in g)d[r]=g[r];i={kind:"ModelChanged",model:n.model.ref(),attr:n.attr,"new":m},s.push(i)}else n instanceof u?(a._value_record_references(n.model,d,!0),i={kind:"RootAdded",model:n.model.ref()},s.push(i)):n instanceof h?(i={kind:"RootRemoved",model:n.model.ref()},s.push(i)):n instanceof c&&(i={kind:"TitleChanged",title:n.title},s.push(i))}return{events:s,references:t._references_json(p.values(d))}},t.prototype.apply_json_patch_string=function(t){return this.apply_json_patch(JSON.parse(t))},t.prototype.apply_json_patch=function(e){var n,r,o,i,s,a,l,u,h,c,p,_,d,f,m,g,y,v,b,x,w,k,M,j;for(b=e.references,a=e.events,v=t._instantiate_references_json(b,this._all_models),u=0,c=a.length;c>u;u++)if(s=a[u],"model"in s){if(_=s.model.id,!(_ in this._all_models))throw console.log("Got an event for unknown model ",s.model),new Error("event model wasn't known");v[_]=this._all_models[_]}m={},d={};for(l in v)j=v[l],l in this._all_models?m[l]=j:d[l]=j;for(t._initialize_references_json(b,m,d),x=[],h=0,p=a.length;p>h;h++)if(s=a[h],"ModelChanged"===s.kind){if(g=s.model.id,!(g in this._all_models))throw new Error("Cannot apply patch to "+g+" which is not in the document");y=this._all_models[g],n=s.attr,j=t._resolve_refs(s["new"],m,d),x.push(y.set((f={},f[""+n]=j,f)))}else if("ColumnsStreamed"===s.kind){if(o=s.column_source.id,!(o in this._all_models))throw new Error("Cannot stream to "+o+" which is not in the document");r=this._all_models[o],i=s.data,w=s.rollover,x.push(r.stream(i,w))}else if("RootAdded"===s.kind)k=s.model.id,M=v[k],x.push(this.add_root(M));else if("RootRemoved"===s.kind)k=s.model.id,M=v[k],x.push(this.remove_root(M));else{if("TitleChanged"!==s.kind)throw new Error("Unknown patch event "+JSON.stringify(s));x.push(this.set_title(s.title))}return x},t}(),e.exports={Document:i,DocumentChangedEvent:s,ModelChangedEvent:l,TitleChangedEvent:c,RootAddedEvent:u,RootRemovedEvent:h,DEFAULT_TITLE:o}},{"./base":"common/base","./has_props":"common/has_props","./logging":"common/logging",underscore:"underscore"}],"common/embed":[function(t,e,n){var r,o,i,s,a,l,u,h,c,p,_,d,f,m,g,y,v,b,x,w,k,M,j,T,z,E,P,S;r=t("jquery"),h=t("underscore"),o=t("backbone"),x=t("./base"),E=t("./logging"),T=E.logger,S=E.set_log_level,P=t("./document"),i=P.Document,a=P.RootAddedEvent,l=P.RootRemovedEvent,u=P.TitleChangedEvent,z=t("./client").pull_session,s=t("es6-promise").Promise,_=function(t){var e;if(T.debug("handling notebook comms"),e=JSON.parse(t.content.data),"events"in e&&"references"in e)return this.apply_json_patch(e);if("doc"in e)return this.replace_with_json(e.doc);throw new Error("handling notebook comms message: ",t)},d=function(t,e){var n;return"undefined"!=typeof Jupyter&&null!==Jupyter?(n=Jupyter.notebook.kernel.comm_manager,n.register_target(t,function(n,r){return T.info("Registering Jupyter comms for target "+t),n.on_msg(h.bind(_,e))})):console.warn("Juptyer notebooks comms not available. push_notebook will not function")},c=function(t){var e;return e=new t.default_view({model:t}),x.index[t.id]=e,e},b=function(t,e,n){var o,i;if(o=n.get_model_by_id(e),null==o)throw new Error("Model "+e+" was not in document "+n);return i=c(o),h.delay(function(){return r(t).replaceWith(i.$el)})},f=function(t,e,n){var o,i,s,h,p,_,d;d={},p=function(e){var n;return n=c(e),d[e.id]=n,r(t).append(n.$el)},_=function(e){var n;return e.id in d?(n=d[e.id],r(t).remove(n.$el),delete d[e.id],delete x.index[e.id]):void 0},h=e.roots();for(o=0,i=h.length;i>o;o++)s=h[o],p(s);return n&&(window.document.title=e.title()),e.on_change(function(t){return t instanceof a?p(t.model):t instanceof l?_(t.model):n&&t instanceof u?window.document.title=t.title:void 0})},y=function(t,e,n){return h.delay(function(){return f(r(t),e,n)})},m={},p=function(t,e){var n;if(null==t||null===t)throw new Error("Missing websocket_url");return t in m||(m[t]={}),n=m[t],e in n||(n[e]=z(t,e)),n[e]},g=function(t,e,n,r){var o;return o=p(e,n),o.then(function(e){return f(t,e.document,r)},function(t){throw T.error("Failed to load Bokeh session "+n+": "+t),t})},v=function(t,e,n,o){var i;return i=p(e,o),i.then(function(e){var o,i;if(o=e.document.get_model_by_id(n),null==o)throw new Error("Did not find model "+n+" in session");return i=c(o),r(t).replaceWith(i.$el)},function(t){throw T.error("Failed to load Bokeh session "+o+": "+t),t})},M=function(t){var e;return e=r("<link href='"+t+"' rel='stylesheet' type='text/css'>"),r("body").append(e)},j=function(t){var e;return e=r("<style>").html(t),r("body").append(e)},k=function(t,e){var n;return n=t.data(),null!=n.bokehLogLevel&&n.bokehLogLevel.length>0&&S(n.bokehLogLevel),null!=n.bokehDocId&&n.bokehDocId.length>0&&(e.docid=n.bokehDocId),null!=n.bokehModelId&&n.bokehModelId.length>0&&(e.modelid=n.bokehModelId),null!=n.bokehSessionId&&n.bokehSessionId.length>0&&(e.sessionid=n.bokehSessionId),T.info("Will inject Bokeh script tag with params "+JSON.stringify(e))},w=function(t,e,n){var o,s,a,l,u,h,c,p,_,f,m;null==n&&(n=null),a={};for(s in t)a[s]=i.from_json(t[s]);for(f=[],h=0,p=e.length;p>h;h++){if(c=e[h],null!=c.notebook_comms_target&&d(c.notebook_comms_target,a[s]),u=c.elementid,l=r("#"+u),0===l.length)throw new Error("Error rendering Bokeh model: could not find tag with id: "+u);if(l.length>1)throw new Error("Error rendering Bokeh model: found too many tags with id: "+u);if(!document.body.contains(l[0]))throw new Error("Error rendering Bokeh model: element with id '"+u+"' must be under <body>");if("SCRIPT"===l.prop("tagName")&&(k(l,c),o=r("<div>",{"class":"bokeh-container"}),l.replaceWith(o),l=o),m=null!=c.use_for_title&&c.use_for_title,_=null,null!=c.modelid)if(null!=c.docid)b(l,c.modelid,a[c.docid]);else{if(null==c.sessionid)throw new Error("Error rendering Bokeh model "+c.modelid+" to element "+u+": no document ID or session ID specified");_=v(l,n,c.modelid,c.sessionid)}else if(null!=c.docid)y(l,a[c.docid],m);else{if(null==c.sessionid)throw new Error("Error rendering Bokeh document to element "+u+": no document ID or session ID specified");_=g(l,n,c.sessionid,m)}null!==_?f.push(_.then(function(t){return console.log("Bokeh items were rendered successfully")},function(t){return console.log("Error rendering Bokeh items ",t)})):f.push(void 0)}return f},e.exports={embed_items:w,inject_css:M,inject_raw_css:j}},{"./base":"common/base","./client":"common/client","./document":"common/document","./logging":"common/logging",backbone:"backbone","es6-promise":"es6-promise",jquery:"jquery",underscore:"underscore"}],"common/has_props":[function(t,e,n){var r,o,i,s,a,l=function(t,e){return function(){return t.apply(e,arguments)}},u=function(t,e){function n(){this.constructor=t}for(var r in e)h.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},h={}.hasOwnProperty;r=t("jquery"),s=t("underscore"),o=t("backbone"),a=t("./logging").logger,i=function(e){function n(t,e){this.resolve_ref=l(this.resolve_ref,this),this.convert_to_ref=l(this.convert_to_ref,this);var n,r;this.document=null,n=t||{},e||(e={}),this.cid=s.uniqueId("c"),this.attributes={},e.collection&&(this.collection=e.collection),e.parse&&(n=this.parse(n,e)||{}),r=s.result(this,"defaults"),this.set(r,{defaults:!0}),this._set_after_defaults={},this.set(n,e),this.changed={},this._base=!1,this.properties={},this.property_cache={},s.has(n,this.idAttribute)||(this.id=s.uniqueId(this.type),this.attributes[this.idAttribute]=this.id),e.defer_initialization||this.initialize.apply(this,arguments)}return u(n,e),n.prototype.toString=function(){return this.type+"("+this.id+")"},n.prototype.destroy=function(t){return n.__super__.destroy.call(this,t),this.stopListening()},n.prototype.isNew=function(){return!1},n.prototype.attrs_and_props=function(){var t,e,n,r,o;for(t=s.clone(this.attributes),o=s.keys(this.properties),e=0,n=o.length;n>e;e++)r=o[e],t[r]=this.get(r);return t},n.prototype.forceTrigger=function(t){var e,n,r,o,i;for(s.isArray(t)||(t=[t]),i={},n=this._changing,this._changing=!0,t.length&&(this._pending=!0),r=0,o=t.length;o>r;r++)e=t[r],this.trigger("change:"+e,this,this.attributes[e],i);if(n)return this;for(;this._pending;)this._pending=!1,this.trigger("change",this,i);return this._pending=!1,this._changing=!1,this},n.prototype.set_obj=function(t,e,n){var r,o;s.isObject(t)||null===t?(r=t,n=e):(r={},r[t]=e);for(t in r)h.call(r,t)&&(o=r[t],r[t]=this.convert_to_ref(o));return this.set(r,n)},n.prototype.set=function(t,e,r){var o,i,a,l,u,c,p,_;s.isObject(t)||null===t?(o=t,r=e):(o={},o[t]=e),p=[];for(t in o)h.call(o,t)&&(_=o[t],null!=r&&r.defaults||(this._set_after_defaults[t]=!0),s.has(this,"properties")&&s.has(this.properties,t)&&this.properties[t].setter&&(this.properties[t].setter.call(this,_,t),p.push(t)));if(!s.isEmpty(p))for(o=s.clone(o),i=0,a=p.length;a>i;i++)t=p[i],delete o[t];if(!s.isEmpty(o)){l={};for(t in o)e=o[t],l[t]=this.get(t,u=!1);if(n.__super__.set.call(this,o,r),null==(null!=r?r.silent:void 0)){c=[];for(t in o)e=o[t],c.push(this._tell_document_about_change(t,l[t],this.get(t,u=!1)));return c}}},n.prototype.convert_to_ref=function(t){return s.isArray(t)?s.map(t,this.convert_to_ref):t instanceof n?t.ref():void 0},n.prototype.add_dependencies=function(t,e,n){var r,o,i,a,l;for(s.isArray(n)||(n=[n]),a=this.properties[t],a.dependencies=a.dependencies.concat({obj:e,fields:n}),l=[],o=0,i=n.length;i>o;o++)r=n[o],l.push(this.listenTo(e,"change:"+r,a.callbacks.changedep));return l},n.prototype.register_setter=function(t,e){var n;return n=this.properties[t],n.setter=e},n.prototype.register_property=function(t,e,n){var r,o,i;return s.isUndefined(n)&&(n=!0),s.has(this.properties,t)&&this.remove_property(t),r=function(e){return function(){return e.trigger("changedep:"+t)}}(this),i=function(e){return function(){var n,r,i;return n=!0,o.use_cache&&(i=e.get_cache(t),e.clear_cache(t),r=e.get(t),n=r!==i),n?(e.trigger("change:"+t,e,e.get(t)),e.trigger("change",e)):void 0}}(this),o={getter:e,dependencies:[],use_cache:n,setter:null,callbacks:{changedep:r,propchange:i}},this.properties[t]=o,this.listenTo(this,"changedep:"+t,o.callbacks.propchange),o},n.prototype.remove_property=function(t){var e,n,r,o,i,s,a,l,u,h;for(u=this.properties[t],n=u.dependencies,o=0,s=n.length;s>o;o++)for(e=n[o],l=e.obj,h=e.fields,i=0,a=h.length;a>i;i++)r=h[i],l.off("change:"+r,u.callbacks.changedep,this);return this.off("changedep:"+e),delete this.properties[t],u.use_cache?this.clear_cache(t):void 0},n.prototype.has_cache=function(t){return s.has(this.property_cache,t)},n.prototype.add_cache=function(t,e){return this.property_cache[t]=e},n.prototype.clear_cache=function(t,e){return delete this.property_cache[t]},n.prototype.get_cache=function(t){return this.property_cache[t]},n.prototype.get=function(t,e){var r;return null==e&&(e=!0),s.has(this.properties,t)?this._get_prop(t):(r=n.__super__.get.call(this,t),e?this.resolve_ref(r):r)},n.prototype._get_prop=function(t){var e,n,r;return r=this.properties[t],r.use_cache&&this.has_cache(t)?this.property_cache[t]:(n=r.getter,e=n.apply(this,[t]),this.properties[t].use_cache&&this.add_cache(t,e),e)},n.prototype.ref=function(){var t;return t={type:this.type,id:this.id},null!=this._subtype&&(t.subtype=this._subtype),t},n._is_ref=function(t){var e;if(s.isObject(t)){if(e=s.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},n.prototype.set_subtype=function(t){return this._subtype=t},n.prototype.resolve_ref=function(t){var e,r;if(s.isUndefined(t))return t;if(s.isArray(t))return function(){var e,n,o;for(o=[],e=0,n=t.length;n>e;e++)r=t[e],o.push(this.resolve_ref(r));return o}.call(this);if(n._is_ref(t)){if(t.type===this.type&&t.id===this.id)return this;if(this.document){if(e=this.document.get_model_by_id(t.id),null===e)throw new Error(this+" refers to "+JSON.stringify(t)+" but it isn't in document "+this._document);return e}throw new Error(this+" Cannot resolve ref "+JSON.stringify(t)+" when not in a Document")}return t},n.prototype.get_base=function(){return this._base||(this._base=t("./base")),this._base},n.prototype.sync=function(t,e,n){return n.success(e.attributes,null,{})},n.prototype.defaults=function(){return{}},n.prototype.serializable_in_document=function(){return!0},n.prototype.nonserializable_attribute_names=function(){return[]},n.prototype._get_nonserializable_dict=function(){var t,e,n,r,o;if(null==this.constructor._nonserializable_names_cache){for(r={},o=this.nonserializable_attribute_names(),t=0,e=o.length;e>t;t++)n=o[t],r[n]=!0;this.constructor._nonserializable_names_cache=r}return this.constructor._nonserializable_names_cache},n.prototype.attribute_is_serializable=function(t){return!(t in this._get_nonserializable_dict())&&t in this.attributes},n.prototype.serializable_attributes=function(){var t,e,n,r,o;n=this._get_nonserializable_dict(),t={},r=this.attributes;for(e in r)o=r[e],e in n||(t[e]=o);return t},n.prototype.toJSON=function(t){throw new Error("bug: toJSON should not be called on "+this+", models require special serialization measures")},n._value_to_json=function(t,e,r){var o,i,a,l,u,c,p;if(e instanceof n)return e.ref();if(s.isArray(e)){for(l=[],o=i=0,a=e.length;a>i;o=++i)p=e[o],p instanceof n&&!p.serializable_in_document()?console.log("May need to add "+t+" to nonserializable_attribute_names of "+(null!=r?r.constructor.name:void 0)+" because array contains a nonserializable type "+p.constructor.name+" under index "+o):l.push(n._value_to_json(o,p,e));return l}if(s.isObject(e)){u={};for(c in e)h.call(e,c)&&(e[c]instanceof n&&!e[c].serializable_in_document()?console.log("May need to add "+t+" to nonserializable_attribute_names of "+(null!=r?r.constructor.name:void 0)+" because value of type "+e.constructor.name+" contains a nonserializable type "+e[c].constructor.name+" under "+c):u[c]=n._value_to_json(c,e[c],e));return u}return e},n.prototype.attributes_as_json=function(t){var e,r,o,i,s;null==t&&(t=!0),e={},r=!1,i=this.serializable_attributes();for(o in i)h.call(i,o)&&(s=i[o],t?e[o]=s:o in this._set_after_defaults&&(e[o]=s),s instanceof n&&!s.serializable_in_document()&&(console.log("May need to add "+o+" to nonserializable_attribute_names of "+this.constructor.name+" because value "+s.constructor.name+" is not serializable"),r=!0));return r?{}:n._value_to_json("attributes",e,this)},n._json_record_references=function(t,e,r,o){var i,a,l,u,c,p,_;if(null===e);else if(n._is_ref(e)){if(!(e.id in r))return c=t.get_model_by_id(e.id),n._value_record_references(c,r,o)}else{if(s.isArray(e)){for(p=[],a=0,u=e.length;u>a;a++)i=e[a],p.push(n._json_record_references(t,i,r,o));return p}if(s.isObject(e)){_=[];for(l in e)h.call(e,l)&&(i=e[l],_.push(n._json_record_references(t,i,r,o)));return _}}},n._value_record_references=function(t,e,r){var o,i,a,l,u,c,p,_,d,f,m;if(null===t);else if(t instanceof n){if(!(t.id in e)&&(e[t.id]=t,r)){for(i=t._immediate_references(),d=[],a=0,c=i.length;c>a;a++)_=i[a],d.push(n._value_record_references(_,e,!0));return d}}else{if(s.isArray(t)){for(f=[],u=0,p=t.length;p>u;u++){if(o=t[u],o instanceof n&&!o.serializable_in_document())throw console.log("Array contains nonserializable item, we shouldn't traverse this property ",o),new Error("Trying to record refs for array with nonserializable item");f.push(n._value_record_references(o,e,r))}return f}if(s.isObject(t)){m=[];for(l in t)if(h.call(t,l)){if(o=t[l],o instanceof n&&!o.serializable_in_document())throw console.log("Dict contains nonserializable item under "+l+", we shouldn't traverse this property ",o),new Error("Trying to record refs for dict with nonserializable item");m.push(n._value_record_references(o,e,r))}return m}}},n.prototype._immediate_references=function(){var t,e,r,o;r={},t=this.serializable_attributes();for(e in t)o=t[e],o instanceof n&&!o.serializable_in_document()&&console.log("May need to add "+e+" to nonserializable_attribute_names of "+this.constructor.name+" because value "+o.constructor.name+" is not serializable"),n._value_record_references(o,r,!1);return s.values(r)},n.prototype.attach_document=function(t){var e,n,r,o,i,s;if(null!==this.document&&this.document!==t)throw new Error("Models must be owned by only a single document");if(n=null===this.document,this.document=t,null!==t&&(t._notify_attach(this),n)){for(i=this._immediate_references(),s=[],r=0,o=i.length;o>r;r++)e=i[r],s.push(e.attach_document(t));return s}},n.prototype.detach_document=function(){var t,e,n,r,o;if(null!==this.document&&0===this.document._notify_detach(this)){for(this.document=null,r=this._immediate_references(),o=[],e=0,n=r.length;n>e;e++)t=r[e],o.push(t.detach_document());return o}},n.prototype._tell_document_about_change=function(t,e,r){var o,i,s,a,l,u;if(this.attribute_is_serializable(t)){if(e instanceof n&&!e.serializable_in_document())return void console.log("May need to add "+t+" to nonserializable_attribute_names of "+this.constructor.name+" because old value "+e.constructor.name+" is not serializable");if(r instanceof n&&!r.serializable_in_document())return void console.log("May need to add "+t+" to nonserializable_attribute_names of "+this.constructor.name+" because new value "+r.constructor.name+" is not serializable");if(null!==this.document){s={},n._value_record_references(r,s,!1),u={},n._value_record_references(e,u,!1);for(o in s)i=s[o],o in u||i.attach_document(this.document);for(a in u)l=u[a],a in s||l.detach_document();return this.document._notify_change(this,t,e,r)}}},n}(o.Model),e.exports=i},{"./base":"common/base","./logging":"common/logging",backbone:"backbone",jquery:"jquery",underscore:"underscore"}],"common/hittest":[function(t,e,n){var r,o,i,s,a,l,u;l=function(t,e,n,r){var o,i,s,a,l,u,h,c;for(i=!1,l=n[n.length-1],h=r[r.length-1],o=s=0,a=n.length;a>=0?a>s:s>a;o=a>=0?++s:--s)u=n[o],c=r[o],e>h!=e>c&&t>l+(e-h)/(c-h)*(u-l)&&(i=!i),l=u,h=c;return i},o=function(){var t;return t={"0d":{glyph:null,indices:[]},"1d":{indices:[]},"2d":{indices:[]}}},u=function(t){return t*t},i=function(t,e,n,r){return u(t-n)+u(e-r)},a=function(t,e,n){var r,o;return r=i(e.x,e.y,n.x,n.y),0===r?i(t.x,t.y,e.x,e.y):(o=((t.x-e.x)*(n.x-e.x)+(t.y-e.y)*(n.y-e.y))/r,0>o?i(t.x,t.y,e.x,e.y):o>1?i(t.x,t.y,n.x,n.y):i(t.x,t.y,e.x+o*(n.x-e.x),e.y+o*(n.y-e.y)))},s=function(t,e,n){return Math.sqrt(a(t,e,n))},r=function(t,e,n,r,o,i,s,a){var l,u,h,c,p,_,d;return h=(a-i)*(n-t)-(s-o)*(r-e),0===h?{hit:!1,x:null,y:null}:(l=e-i,u=t-o,c=(s-o)*l-(a-i)*u,p=(n-t)*l-(r-e)*u,l=c/h,u=p/h,_=t+l*(n-t),d=e+l*(r-e),{hit:l>0&&1>l&&u>0&&1>u,x:_,y:d})},e.exports={point_in_poly:l,create_hit_test_result:o,dist_2_pts:i,dist_to_segment:s,check_2_segments_intersect:r}},{}],"common/layout_box":[function(t,e,n){var r,o,i,s,a,l,u,h,c,p,_,d,f=function(t,e){function n(){this.constructor=t}for(var r in e)m.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},m={}.hasOwnProperty;_=t("underscore"),d=t("kiwi"),p=d.Variable,i=d.Expression,r=d.Constraint,h=d.Operator,o=h.Eq,l=h.Le,s=h.Ge,u=t("../model"),c=t("../models/ranges/range1d"),a=function(t){function e(t,n){this.solver=null,this._initialized=!1,e.__super__.constructor.call(this,t,n)}return f(e,t),e.prototype.type="LayoutBox",e.prototype.nonserializable_attribute_names=function(){return e.__super__.nonserializable_attribute_names.call(this).concat(["solver","layout_location"])},e.prototype.initialize=function(t,n){return e.__super__.initialize.call(this,t,n),this._initialized=!0,this._initialize_if_we_have_solver()},e.prototype.set=function(t,n,r){return e.__super__.set.call(this,t,n,r),this._initialize_if_we_have_solver()},e.prototype._initialize_if_we_have_solver=function(){var t,e,n,a,l,u,h,_;if(this._initialized)if(null==this.solver){if(this.solver=this.get("solver"),null!=this.solver){for(this.var_constraints={},u=["top","left","width","height"],t=0,n=u.length;n>t;t++)_=u[t],l="_"+_,this[l]=new p(_),this.register_property(_,this._get_var,!1),this.register_setter(_,this._set_var),this.solver.add_edit_variable(this[l],d.Strength.strong);for(h=["right","bottom"],e=0,a=h.length;a>e;e++)_=h[e],l="_"+_,this[l]=new p(_),this.register_property(_,this._get_var,!1);return this.solver.add_constraint(new r(new i(this._top),s)),this.solver.add_constraint(new r(new i(this._bottom),s)),this.solver.add_constraint(new r(new i(this._left),s)),this.solver.add_constraint(new r(new i(this._right),s)),this.solver.add_constraint(new r(new i(this._width),s)),this.solver.add_constraint(new r(new i(this._height),s)),this.solver.add_constraint(new r(new i(this._left,this._width,[-1,this._right]),o)),this.solver.add_constraint(new r(new i(this._bottom,this._height,[-1,this._top]),o)),this._h_range=new c.Model({start:this.get("left"),end:this.get("left")+this.get("width")}),this.register_property("h_range",function(t){return function(){return t._h_range.set("start",t.get("left")),t._h_range.set("end",t.get("left")+t.get("width")),t._h_range}}(this),!1),this.add_dependencies("h_range",this,["left","width"]),this._v_range=new c.Model({start:this.get("bottom"),end:this.get("bottom")+this.get("height")}),this.register_property("v_range",function(t){return function(){return t._v_range.set("start",t.get("bottom")),t._v_range.set("end",t.get("bottom")+t.get("height")),t._v_range}}(this),!1),this.add_dependencies("v_range",this,["bottom","height"]),this._aspect_constraint=null,this.register_property("aspect",function(t){return function(){return t.get("width")/t.get("height")}}(this),!0),this.register_setter("aspect",this._set_aspect),this.add_dependencies("aspect",this,["width","height"])}}else if(this.get("solver")!==this.solver)throw new Error("We do not support changing the solver attribute on LayoutBox")},e.prototype.contains=function(t,e){return t>=this.get("left")&&t<=this.get("right")&&e>=this.get("bottom")&&e<=this.get("top")},e.prototype._set_var=function(t,e){var n,s;return s=this["_"+e],_.isNumber(t)?this.solver.suggest_value(s,t):_.isString(t)?void 0:(n=new r(new i(s,[-1,t]),o),null==this.var_constraints[e]&&(this.var_constraints[e]=[]),this.var_constraints[e].push(n),this.solver.add_constraint(n))},e.prototype._get_var=function(t){return this["_"+t].value()},e.prototype._set_aspect=function(t){var e;return null!=this._aspect_constraint?(this.solver.remove_constraint(this.aspect_constraint),e=new r(new i([t,this._height],[-1,this._width]),o),this._aspect_constraint=e,this.solver.add_constraint(e)):void 0},e}(u),e.exports={Model:a}},{"../model":"model","../models/ranges/range1d":"models/ranges/range1d",kiwi:"kiwi",underscore:"underscore"}],"common/logging":[function(t,e,n){var r,o,i;r=t("jsnlog").JL,o=r("Bokeh"),o.setOptions({appenders:[r.createConsoleAppender("consoleAppender")]}),i=function(t){var e;return e={trace:r.getTraceLevel(),debug:r.getDebugLevel(),info:r.getInfoLevel(),warn:r.getWarnLevel(),error:r.getErrorLevel(),fatal:r.getFatalLevel()},t in e?(console.log("Bokeh: setting log level to: '"+t+"'"),o.setOptions({level:e[t]})):(console.log("Bokeh: Unrecognized logging level '"+t+"' passed to Bokeh.set_log_level, ignoring."),void console.log("Bokeh: Valid log levels are: "+Object.keys(e)))},e.exports={logger:o,set_log_level:i}},{jsnlog:"jsnlog"}],"common/mathutils":[function(t,e,n){var r,o,i,s,a;a=function(t){var e,n,r;for(e=t.length,n=1/0;e--;)r=t[e],n>r&&(n=r);return n},s=function(t){var e,n,r;for(e=t.length,n=-(1/0);e--;)r=t[e],r>n&&(n=r);return n},i=function(t){for(;0>t;)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))},r=function(t,e,n,r){var s;return t=i(t),s=o(e,n),"anticlock"===r?o(e,t)<=s&&o(t,n)<=s:!(o(e,t)<=s&&o(t,n)<=s)},e.exports={arrayMin:a,arrayMax:s,angle_norm:i,angle_dist:o,angle_between:r}},{}],"common/models":[function(t,e,n){e.exports={Canvas:t("./canvas"),LayoutBox:t("./layout_box"),CartesianFrame:t("./cartesian_frame"),SelectionManager:t("./selection_manager"),Selector:t("./selector"),ToolEvents:t("./tool_events"),BoxAnnotation:t("../models/annotations/box_annotation"),Legend:t("../models/annotations/legend"),PolyAnnotation:t("../models/annotations/poly_annotation"),Span:t("../models/annotations/span"),Tooltip:t("../models/annotations/tooltip"),CategoricalAxis:t("../models/axes/categorical_axis"),DatetimeAxis:t("../models/axes/datetime_axis"),LinearAxis:t("../models/axes/linear_axis"),LogAxis:t("../models/axes/log_axis"),CustomJS:t("../models/callbacks/customjs"),OpenURL:t("../models/callbacks/open_url"),BasicTickFormatter:t("../models/formatters/basic_tick_formatter"),CategoricalTickFormatter:t("../models/formatters/categorical_tick_formatter"),DatetimeTickFormatter:t("../models/formatters/datetime_tick_formatter"),LogTickFormatter:t("../models/formatters/log_tick_formatter"),NumeralTickFormatter:t("../models/formatters/numeral_tick_formatter"),PrintfTickFormatter:t("../models/formatters/printf_tick_formatter"),AnnularWedge:t("../models/glyphs/annular_wedge"),Annulus:t("../models/glyphs/annulus"),Arc:t("../models/glyphs/arc"),Bezier:t("../models/glyphs/bezier"),Circle:t("../models/glyphs/circle"),Gear:t("../models/glyphs/gear"),Image:t("../models/glyphs/image"),ImageRGBA:t("../models/glyphs/image_rgba"),ImageURL:t("../models/glyphs/image_url"),Line:t("../models/glyphs/line"),MultiLine:t("../models/glyphs/multi_line"),Oval:t("../models/glyphs/oval"),Patch:t("../models/glyphs/patch"),Patches:t("../models/glyphs/patches"),Quad:t("../models/glyphs/quad"),
|
|
Quadratic:t("../models/glyphs/quadratic"),Ray:t("../models/glyphs/ray"),Rect:t("../models/glyphs/rect"),Segment:t("../models/glyphs/segment"),Text:t("../models/glyphs/text"),Wedge:t("../models/glyphs/wedge"),Grid:t("../models/grids/grid"),GridPlot:t("../models/layouts/grid_plot"),HBox:t("../models/layouts/hbox"),VBox:t("../models/layouts/vbox"),VBoxForm:t("../models/layouts/vboxform"),CategoricalMapper:t("../models/mappers/categorical_mapper"),GridMapper:t("../models/mappers/grid_mapper"),LinearColorMapper:t("../models/mappers/linear_color_mapper"),LinearMapper:t("../models/mappers/linear_mapper"),LogMapper:t("../models/mappers/log_mapper"),Asterisk:t("../models/markers/asterisk"),CircleCross:t("../models/markers/circle_cross"),CircleX:t("../models/markers/circle_x"),Cross:t("../models/markers/cross"),Diamond:t("../models/markers/diamond"),DiamondCross:t("../models/markers/diamond_cross"),InvertedTriangle:t("../models/markers/inverted_triangle"),Square:t("../models/markers/square"),SquareCross:t("../models/markers/square_cross"),SquareX:t("../models/markers/square_x"),Triangle:t("../models/markers/triangle"),X:t("../models/markers/x"),Plot:t("../models/plots/plot"),GMapPlot:t("../models/plots/gmap_plot"),DataRange1d:t("../models/ranges/data_range1d"),FactorRange:t("../models/ranges/factor_range"),Range1d:t("../models/ranges/range1d"),GlyphRenderer:t("../models/renderers/glyph_renderer"),AjaxDataSource:t("../models/sources/ajax_data_source"),BlazeDataSource:t("../models/sources/blaze_data_source"),ColumnDataSource:t("../models/sources/column_data_source"),GeoJSONDataSource:t("../models/sources/geojson_data_source"),AdaptiveTicker:t("../models/tickers/adaptive_ticker"),BasicTicker:t("../models/tickers/basic_ticker"),CategoricalTicker:t("../models/tickers/categorical_ticker"),CompositeTicker:t("../models/tickers/composite_ticker"),ContinuousTicker:t("../models/tickers/continuous_ticker"),DatetimeTicker:t("../models/tickers/datetime_ticker"),DaysTicker:t("../models/tickers/days_ticker"),FixedTicker:t("../models/tickers/fixed_ticker"),LogTicker:t("../models/tickers/log_ticker"),MonthsTicker:t("../models/tickers/months_ticker"),SingleIntervalTicker:t("../models/tickers/single_interval_ticker"),YearsTicker:t("../models/tickers/years_ticker"),TileRenderer:t("../models/tiles/tile_renderer"),TileSource:t("../models/tiles/tile_source"),TMSTileSource:t("../models/tiles/tms_tile_source"),WMTSTileSource:t("../models/tiles/wmts_tile_source"),QUADKEYTileSource:t("../models/tiles/quadkey_tile_source"),BBoxTileSource:t("../models/tiles/bbox_tile_source"),DynamicImageRenderer:t("../models/tiles/dynamic_image_renderer"),ImageSource:t("../models/tiles/image_source"),ButtonTool:t("../models/tools/button_tool"),ActionTool:t("../models/tools/actions/action_tool"),PreviewSaveTool:t("../models/tools/actions/preview_save_tool"),UndoTool:t("../models/tools/actions/undo_tool"),RedoTool:t("../models/tools/actions/redo_tool"),ResetTool:t("../models/tools/actions/reset_tool"),HelpTool:t("../models/tools/actions/help_tool"),BoxSelectTool:t("../models/tools/gestures/box_select_tool"),BoxZoomTool:t("../models/tools/gestures/box_zoom_tool"),GestureTool:t("../models/tools/gestures/gesture_tool"),LassoSelectTool:t("../models/tools/gestures/lasso_select_tool"),PanTool:t("../models/tools/gestures/pan_tool"),PolySelectTool:t("../models/tools/gestures/poly_select_tool"),SelectTool:t("../models/tools/gestures/select_tool"),ResizeTool:t("../models/tools/gestures/resize_tool"),TapTool:t("../models/tools/gestures/tap_tool"),WheelZoomTool:t("../models/tools/gestures/wheel_zoom_tool"),CrosshairTool:t("../models/tools/inspectors/crosshair_tool"),HoverTool:t("../models/tools/inspectors/hover_tool"),InspectTool:t("../models/tools/inspectors/inspect_tool")}},{"../models/annotations/box_annotation":"models/annotations/box_annotation","../models/annotations/legend":"models/annotations/legend","../models/annotations/poly_annotation":"models/annotations/poly_annotation","../models/annotations/span":"models/annotations/span","../models/annotations/tooltip":"models/annotations/tooltip","../models/axes/categorical_axis":"models/axes/categorical_axis","../models/axes/datetime_axis":"models/axes/datetime_axis","../models/axes/linear_axis":"models/axes/linear_axis","../models/axes/log_axis":"models/axes/log_axis","../models/callbacks/customjs":"models/callbacks/customjs","../models/callbacks/open_url":"models/callbacks/open_url","../models/formatters/basic_tick_formatter":"models/formatters/basic_tick_formatter","../models/formatters/categorical_tick_formatter":"models/formatters/categorical_tick_formatter","../models/formatters/datetime_tick_formatter":"models/formatters/datetime_tick_formatter","../models/formatters/log_tick_formatter":"models/formatters/log_tick_formatter","../models/formatters/numeral_tick_formatter":"models/formatters/numeral_tick_formatter","../models/formatters/printf_tick_formatter":"models/formatters/printf_tick_formatter","../models/glyphs/annular_wedge":"models/glyphs/annular_wedge","../models/glyphs/annulus":"models/glyphs/annulus","../models/glyphs/arc":"models/glyphs/arc","../models/glyphs/bezier":"models/glyphs/bezier","../models/glyphs/circle":"models/glyphs/circle","../models/glyphs/gear":"models/glyphs/gear","../models/glyphs/image":"models/glyphs/image","../models/glyphs/image_rgba":"models/glyphs/image_rgba","../models/glyphs/image_url":"models/glyphs/image_url","../models/glyphs/line":"models/glyphs/line","../models/glyphs/multi_line":"models/glyphs/multi_line","../models/glyphs/oval":"models/glyphs/oval","../models/glyphs/patch":"models/glyphs/patch","../models/glyphs/patches":"models/glyphs/patches","../models/glyphs/quad":"models/glyphs/quad","../models/glyphs/quadratic":"models/glyphs/quadratic","../models/glyphs/ray":"models/glyphs/ray","../models/glyphs/rect":"models/glyphs/rect","../models/glyphs/segment":"models/glyphs/segment","../models/glyphs/text":"models/glyphs/text","../models/glyphs/wedge":"models/glyphs/wedge","../models/grids/grid":"models/grids/grid","../models/layouts/grid_plot":"models/layouts/grid_plot","../models/layouts/hbox":"models/layouts/hbox","../models/layouts/vbox":"models/layouts/vbox","../models/layouts/vboxform":"models/layouts/vboxform","../models/mappers/categorical_mapper":"models/mappers/categorical_mapper","../models/mappers/grid_mapper":"models/mappers/grid_mapper","../models/mappers/linear_color_mapper":"models/mappers/linear_color_mapper","../models/mappers/linear_mapper":"models/mappers/linear_mapper","../models/mappers/log_mapper":"models/mappers/log_mapper","../models/markers/asterisk":"models/markers/asterisk","../models/markers/circle_cross":"models/markers/circle_cross","../models/markers/circle_x":"models/markers/circle_x","../models/markers/cross":"models/markers/cross","../models/markers/diamond":"models/markers/diamond","../models/markers/diamond_cross":"models/markers/diamond_cross","../models/markers/inverted_triangle":"models/markers/inverted_triangle","../models/markers/square":"models/markers/square","../models/markers/square_cross":"models/markers/square_cross","../models/markers/square_x":"models/markers/square_x","../models/markers/triangle":"models/markers/triangle","../models/markers/x":"models/markers/x","../models/plots/gmap_plot":"models/plots/gmap_plot","../models/plots/plot":"models/plots/plot","../models/ranges/data_range1d":"models/ranges/data_range1d","../models/ranges/factor_range":"models/ranges/factor_range","../models/ranges/range1d":"models/ranges/range1d","../models/renderers/glyph_renderer":"models/renderers/glyph_renderer","../models/sources/ajax_data_source":"models/sources/ajax_data_source","../models/sources/blaze_data_source":"models/sources/blaze_data_source","../models/sources/column_data_source":"models/sources/column_data_source","../models/sources/geojson_data_source":"models/sources/geojson_data_source","../models/tickers/adaptive_ticker":"models/tickers/adaptive_ticker","../models/tickers/basic_ticker":"models/tickers/basic_ticker","../models/tickers/categorical_ticker":"models/tickers/categorical_ticker","../models/tickers/composite_ticker":"models/tickers/composite_ticker","../models/tickers/continuous_ticker":"models/tickers/continuous_ticker","../models/tickers/datetime_ticker":"models/tickers/datetime_ticker","../models/tickers/days_ticker":"models/tickers/days_ticker","../models/tickers/fixed_ticker":"models/tickers/fixed_ticker","../models/tickers/log_ticker":"models/tickers/log_ticker","../models/tickers/months_ticker":"models/tickers/months_ticker","../models/tickers/single_interval_ticker":"models/tickers/single_interval_ticker","../models/tickers/years_ticker":"models/tickers/years_ticker","../models/tiles/bbox_tile_source":"models/tiles/bbox_tile_source","../models/tiles/dynamic_image_renderer":"models/tiles/dynamic_image_renderer","../models/tiles/image_source":"models/tiles/image_source","../models/tiles/quadkey_tile_source":"models/tiles/quadkey_tile_source","../models/tiles/tile_renderer":"models/tiles/tile_renderer","../models/tiles/tile_source":"models/tiles/tile_source","../models/tiles/tms_tile_source":"models/tiles/tms_tile_source","../models/tiles/wmts_tile_source":"models/tiles/wmts_tile_source","../models/tools/actions/action_tool":"models/tools/actions/action_tool","../models/tools/actions/help_tool":"models/tools/actions/help_tool","../models/tools/actions/preview_save_tool":"models/tools/actions/preview_save_tool","../models/tools/actions/redo_tool":"models/tools/actions/redo_tool","../models/tools/actions/reset_tool":"models/tools/actions/reset_tool","../models/tools/actions/undo_tool":"models/tools/actions/undo_tool","../models/tools/button_tool":"models/tools/button_tool","../models/tools/gestures/box_select_tool":"models/tools/gestures/box_select_tool","../models/tools/gestures/box_zoom_tool":"models/tools/gestures/box_zoom_tool","../models/tools/gestures/gesture_tool":"models/tools/gestures/gesture_tool","../models/tools/gestures/lasso_select_tool":"models/tools/gestures/lasso_select_tool","../models/tools/gestures/pan_tool":"models/tools/gestures/pan_tool","../models/tools/gestures/poly_select_tool":"models/tools/gestures/poly_select_tool","../models/tools/gestures/resize_tool":"models/tools/gestures/resize_tool","../models/tools/gestures/select_tool":"models/tools/gestures/select_tool","../models/tools/gestures/tap_tool":"models/tools/gestures/tap_tool","../models/tools/gestures/wheel_zoom_tool":"models/tools/gestures/wheel_zoom_tool","../models/tools/inspectors/crosshair_tool":"models/tools/inspectors/crosshair_tool","../models/tools/inspectors/hover_tool":"models/tools/inspectors/hover_tool","../models/tools/inspectors/inspect_tool":"models/tools/inspectors/inspect_tool","./canvas":"common/canvas","./cartesian_frame":"common/cartesian_frame","./layout_box":"common/layout_box","./selection_manager":"common/selection_manager","./selector":"common/selector","./tool_events":"common/tool_events"}],"common/plot_template":[function(t,e,n){e.exports=function(t){t||(t={});var e,n=[],r=t.safe,o=t.escape;return e=t.safe=function(t){if(t&&t.ecoSafe)return t;("undefined"==typeof t||null==t)&&(t="");var e=new String(t);return e.ecoSafe=!0,e},o||(o=t.escape=function(t){return(""+t).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}),function(){(function(){n.push("<div class='bk-plot-wrapper'>\n <table>\n <tr>\n <td></td>\n <td class='bk-plot-above'></td>\n <td></td>\n </tr>\n <tr>\n <td class=\"bk-plot-left\"></td>\n <td class='bk-plot-canvas-wrapper'></td>\n <td class=\"bk-plot-right\"></td>\n </tr>\n <tr>\n <td></td>\n <td class='bk-plot-below'></td>\n <td></td>\n </tr>\n </table>\n</div>\n")}).call(this)}.call(t),t.safe=r,t.escape=o,n.join("")}},{}],"common/plot_utils":[function(t,e,n){var r,o,i,s;r=["image","underlay","glyph","overlay","annotation","tool"],o=function(t){return t()},i=("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)||o,s=function(t,e){var n,r,o,s,a,l,u,h;return l=[null,null,null,null],r=l[0],n=l[1],h=l[2],u=l[3],a=0,s=!1,o=function(){return a=new Date,h=null,s=!1,u=t.apply(r,n)},function(){var t,l;return t=new Date,l=e-(t-a),r=this,n=arguments,0>=l&&!s?(clearTimeout(h),s=!0,i(o)):h||(h=setTimeout(function(){return i(o)},l)),u}},e.exports={LEVELS:r,throttle_animation:s}},{}],"common/plot_widget":[function(t,e,n){var r,o,i=function(t,e){function n(){this.constructor=t}for(var r in e)s.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},s={}.hasOwnProperty;r=t("./continuum_view"),o=function(t){function n(){return n.__super__.constructor.apply(this,arguments)}return i(n,t),n.prototype.tagName="div",n.prototype.initialize=function(t){return this.plot_model=t.plot_model,this.plot_view=t.plot_view},n.prototype.bind_bokeh_events=function(){},n.prototype.request_render=function(){return this.plot_view.request_render()},e.exports=n,n}(r)},{"./continuum_view":"common/continuum_view"}],"common/properties":[function(t,e,n){var r,o,i,s,a,l,u,h,c,p,_,d,f,m,g,y,v,b,x,w,k,M,j,T=function(t,e){function n(){this.constructor=t}for(var r in e)z.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},z={}.hasOwnProperty,E=[].indexOf||function(t){for(var e=0,n=this.length;n>e;e++)if(e in this&&this[e]===t)return e;return-1};v=t("underscore"),_=t("./has_props"),M=t("./svg_colors"),m=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return T(e,t),e.prototype.initialize=function(t,n){return e.__super__.initialize.call(this,t,n),this.obj=this.get("obj"),this.attr=this.get("attr"),this.listenTo(this.obj,"change:"+this.attr,function(){return this._init(),this.obj.trigger("propchange")}),this._init()},e.prototype.serializable_in_document=function(){var t;return null!=this.get("obj")?(t=this.get("obj").serializable_in_document(),t||console.log(" 'obj' field of "+this.constructor.name+" has a nonserializable value of type "+this.get("obj").constructor.name),t):!0},e.prototype._init=function(){var t;if(t=this.obj.get(this.attr),v.isObject(t)&&!v.isArray(t))if(this.spec=t,v.isUndefined(this.spec.value)){if(null==this.spec.field)throw new Error("spec for property '"+attr+"' needs one of 'value' or 'field'");this.field=this.spec.field}else this.fixed_value=this.spec.value;else this.fixed_value=t;if(null!=this.field&&!v.isString(this.field))throw new Error("field value for property '"+attr+"' is not a string");return null!=this.fixed_value?this.validate(this.fixed_value,this.attr):void 0},e.prototype.value=function(){var t;return t=null!=this.fixed_value?this.fixed_value:NaN,this.transform([t])[0]},e.prototype.array=function(t){var e,n,r,o;return e=t.get("data"),null!=this.field&&this.field in e?this.transform(t.get_column(this.field)):(r=t.get_length(),null==r&&(r=1),o=this.value(),function(){var t,e,i;for(i=[],n=t=0,e=r;e>=0?e>t:t>e;n=e>=0?++t:--t)i.push(o);return i}())},e.prototype.transform=function(t){return t},e.prototype.validate=function(t,e){return!0},e}(_),f=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return T(e,t),e.prototype.validate=function(t,e){if(!v.isNumber(t))throw new Error("numeric property '"+e+"' given invalid value: "+t);return!0},e.prototype.transform=function(t){var e,n,r,o;for(o=new Float64Array(t.length),e=n=0,r=t.length;r>=0?r>n:n>r;e=r>=0?++n:--n)o[e]=t[e];return o},e}(m),r=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return T(e,t),e.prototype._init=function(){var t,n;if(e.__super__._init.call(this),this.units=null!=(t=null!=(n=this.spec)?n.units:void 0)?t:"rad","deg"!==this.units&&"rad"!==this.units)throw new Error("Angle units must be one of 'deg' or 'rad', given invalid value: "+this.units)},e.prototype.transform=function(t){var n;return"deg"===this.units&&(t=function(){var e,r,o;for(o=[],e=0,r=t.length;r>e;e++)n=t[e],o.push(n*Math.PI/180);return o}()),t=function(){var e,r,o;for(o=[],e=0,r=t.length;r>e;e++)n=t[e],o.push(-n);return o}(),e.__super__.transform.call(this,t)},e}(f),h=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return T(e,t),e.prototype._init=function(){var t,n;if(e.__super__._init.call(this),this.units=null!=(t=null!=(n=this.spec)?n.units:void 0)?t:"data","data"!==this.units&&"screen"!==this.units)throw new Error("Distance units must be one of 'data' or 'screen', given invalid value: "+this.units)},e}(f),o=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return T(e,t),e.prototype.validate=function(t,e){if(!v.isArray(t))throw new Error("array property '"+e+"' given invalid value: "+t);return!0},e}(m),i=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return T(e,t),e.prototype.validate=function(t,e){if(!v.isBoolean(t))throw new Error("boolean property '"+e+"' given invalid value: "+t);return!0},e}(m),l=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return T(e,t),e.prototype.validate=function(t,e){if(!v.isNumber(t)&&!v.isString(t))throw new Error("coordinate property '"+e+"' given invalid value: "+t);return!0},e}(m),s=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return T(e,t),e.prototype.validate=function(t,e){if(null==M[t.toLowerCase()]&&"#"!==t.substring(0,1)&&!this.valid_rgb(t))throw new Error("color property '"+e+"' given invalid value: "+t);return!0},e.prototype.valid_rgb=function(t){var e,n,r,o;switch(t.substring(0,4)){case"rgba":n={start:"rgba(",len:4,alpha:!0};break;case"rgb(":n={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(n.start,"").replace(")","").split(",").map(parseFloat),e.length!==n.len)throw new Error("color expects rgba "+expect_len+"-tuple, received "+t);if(n.alpha&&!(0<=(r=e[3])&&1>=r))throw new Error("color expects rgba 4-tuple to have alpha value between 0 and 1");if(E.call(function(){var t,n,r,i;for(r=e.slice(0,3),i=[],t=0,n=r.length;n>t;t++)o=r[t],i.push(o>=0&&255>=o);return i}(),!1)>=0)throw new Error("color expects rgb to have value between 0 and 255");return!0},e}(m),g=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return T(e,t),e.prototype.validate=function(t,e){if(!v.isString(t))throw new Error("string property '"+e+"' given invalid value: "+t);return!0},e}(m),c=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return T(e,t),e.prototype.initialize=function(t,n){return this.levels=t.values.split(" "),e.__super__.initialize.call(this,t,n)},e.prototype.validate=function(t,e){if(E.call(this.levels,t)<0)throw new Error("enum property '"+e+"' given invalid value: "+t+", valid values are: "+this.levels);return!0},e}(m),u=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return T(e,t),e.prototype.initialize=function(t,n){return t.values="anticlock clock",e.__super__.initialize.call(this,t,n)},e.prototype.transform=function(t){var e,n,r,o;for(o=new Uint8Array(t.length),e=n=0,r=t.length;r>=0?r>n:n>r;e=r>=0?++n:--n)switch(t[e]){case"clock":o[e]=!1;break;case"anticlock":o[e]=!0}return o},e}(c),a=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return T(e,t),e.prototype.initialize=function(t,n){return this.cache={},e.__super__.initialize.call(this,t,n)},e.prototype.warm_cache=function(t,e){var n,r,o,i,s;for(s=[],r=0,o=e.length;o>r;r++)n=e[r],i=this[n],null!=i.fixed_value?s.push(this.cache[n]=i.fixed_value):s.push(this.cache[n+"_array"]=i.array(t));return s},e.prototype.cache_select=function(t,e){var n;return n=this[t],null!=n.fixed_value?this.cache[t]=n.fixed_value:this.cache[t]=this.cache[t+"_array"][e]},e}(_),d=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return T(e,t),e.prototype.initialize=function(t,n){var r,i;return e.__super__.initialize.call(this,t,n),r=this.get("obj"),i=this.get("prefix"),this.color=new s({obj:r,attr:i+"line_color"}),this.width=new f({obj:r,attr:i+"line_width"}),this.alpha=new f({obj:r,attr:i+"line_alpha"}),this.join=new c({obj:r,attr:i+"line_join",values:"miter round bevel"}),this.cap=new c({obj:r,attr:i+"line_cap",values:"butt round square"}),this.dash=new o({obj:r,attr:i+"line_dash"}),this.dash_offset=new f({obj:r,attr:i+"line_dash_offset"}),this.do_stroke=!0,!v.isUndefined(this.color.fixed_value)&&v.isNull(this.color.fixed_value)?this.do_stroke=!1:void 0},e.prototype.warm_cache=function(t){return e.__super__.warm_cache.call(this,t,["color","width","alpha","join","cap","dash","dash_offset"])},e.prototype.set_value=function(t){return t.strokeStyle=this.color.value(),t.globalAlpha=this.alpha.value(),t.lineWidth=this.width.value(),t.lineJoin=this.join.value(),t.lineCap=this.cap.value(),t.setLineDash(this.dash.value()),t.setLineDashOffset(this.dash_offset.value())},e.prototype.set_vectorize=function(t,e){return this.cache_select("color",e),t.strokeStyle!==this.cache.fill&&(t.strokeStyle=this.cache.color),this.cache_select("alpha",e),t.globalAlpha!==this.cache.alpha&&(t.globalAlpha=this.cache.alpha),this.cache_select("width",e),t.lineWidth!==this.cache.width&&(t.lineWidth=this.cache.width),this.cache_select("join",e),t.lineJoin!==this.cache.join&&(t.lineJoin=this.cache.join),this.cache_select("cap",e),t.lineCap!==this.cache.cap&&(t.lineCap=this.cache.cap),this.cache_select("dash",e),t.getLineDash()!==this.cache.dash&&t.setLineDash(this.cache.dash),this.cache_select("dash_offset",e),t.getLineDashOffset()!==this.cache.dash_offset?t.setLineDashOffset(this.cache.dash_offset):void 0},e}(a),p=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return T(e,t),e.prototype.initialize=function(t,n){var r,o;return e.__super__.initialize.call(this,t,n),r=this.get("obj"),o=this.get("prefix"),this.color=new s({obj:r,attr:o+"fill_color"}),this.alpha=new f({obj:r,attr:o+"fill_alpha"}),this.do_fill=!0,!v.isUndefined(this.color.fixed_value)&&v.isNull(this.color.fixed_value)?this.do_fill=!1:void 0},e.prototype.warm_cache=function(t){return e.__super__.warm_cache.call(this,t,["color","alpha"])},e.prototype.set_value=function(t){return t.fillStyle=this.color.value(),t.globalAlpha=this.alpha.value()},e.prototype.set_vectorize=function(t,e){return this.cache_select("color",e),t.fillStyle!==this.cache.fill&&(t.fillStyle=this.cache.color),this.cache_select("alpha",e),t.globalAlpha!==this.cache.alpha?t.globalAlpha=this.cache.alpha:void 0},e}(a),y=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return T(e,t),e.prototype.initialize=function(t,n){var r,o;return e.__super__.initialize.call(this,t,n),r=this.get("obj"),o=this.get("prefix"),this.font=new g({obj:r,attr:o+"text_font"}),this.font_size=new g({obj:r,attr:o+"text_font_size"}),this.font_style=new c({obj:r,attr:o+"text_font_style",values:"normal italic bold"}),this.color=new s({obj:r,attr:o+"text_color"}),this.alpha=new f({obj:r,attr:o+"text_alpha"}),this.align=new c({obj:r,attr:o+"text_align",values:"left right center"}),this.baseline=new c({obj:r,attr:o+"text_baseline",values:"top middle bottom alphabetic hanging"})},e.prototype.warm_cache=function(t){return e.__super__.warm_cache.call(this,t,["font","font_size","font_style","color","alpha","align","baseline"])},e.prototype.cache_select=function(t,n){var r;return"font"===t?(r=e.__super__.cache_select.call(this,"font_style",n)+" "+e.__super__.cache_select.call(this,"font_size",n)+" "+e.__super__.cache_select.call(this,"font",n),this.cache.font=r):e.__super__.cache_select.call(this,t,n)},e.prototype.font_value=function(){var t,e,n;return t=this.font.value(),e=this.font_size.value(),n=this.font_style.value(),n+" "+e+" "+t},e.prototype.set_value=function(t){return t.font=this.font_value(),t.fillStyle=this.color.value(),t.globalAlpha=this.alpha.value(),t.textAlign=this.align.value(),t.textBaseline=this.baseline.value()},e.prototype.set_vectorize=function(t,e){return this.cache_select("font",e),t.font!==this.cache.font&&(t.font=this.cache.font),this.cache_select("color",e),t.fillStyle!==this.cache.color&&(t.fillStyle=this.cache.color),this.cache_select("alpha",e),t.globalAlpha!==this.cache.alpha&&(t.globalAlpha=this.cache.alpha),this.cache_select("align",e),t.textAlign!==this.cache.align&&(t.textAlign=this.cache.align),this.cache_select("baseline",e),t.textBaseline!==this.cache.baseline?t.textBaseline=this.cache.baseline:void 0},e}(a),b=function(t,e){var n,o,i,s,a;for(null==e&&(e="angles"),a={},s=t[e],o=0,i=s.length;i>o;o++)n=s[o],a[n]=new r({obj:t,attr:n});return a},x=function(t,e){var n,r,o,i,s,a,u;for(null==e&&(e="coords"),s={},o=t[e],n=0,r=o.length;r>n;n++)i=o[n],a=i[0],u=i[1],s[a]=new l({obj:t,attr:a}),s[u]=new l({obj:t,attr:u});return s},w=function(t,e){var n,r,o,i,s;for(null==e&&(e="distances"),s={},i=t[e],r=0,o=i.length;o>r;r++)n=i[r],("?"!==n[0]||(n=n.slice(1),null!=t.get(n)))&&(s[n]=new h({obj:t,attr:n}));return s},k=function(t,e){var n,r,a,l,h,p,_,d;for(null==e&&(e="fields"),_={},h=t[e],a=0,l=h.length;l>a;a++)if(r=h[a],d="number",r.indexOf(":")>-1&&(p=r.split(":"),r=p[0],d=p[1],n=p[2]),"?"!==r[0]||(r=r.slice(1),null!=t.attributes[r]))switch(d){case"array":_[r]=new o({obj:t,attr:r});break;case"bool":_[r]=new i({obj:t,attr:r});break;case"color":_[r]=new s({obj:t,attr:r});break;case"direction":_[r]=new u({obj:t,attr:r});break;case"enum":_[r]=new c({obj:t,attr:r,values:n});break;case"number":_[r]=new f({obj:t,attr:r});break;case"string":_[r]=new g({obj:t,attr:r})}return _},j=function(t,e){var n,r,o,i,s,a,l,u;for(null==e&&(e="visuals"),u={},a=t[e],n=0,r=a.length;r>n;n++)switch(s=a[n],i="",s.indexOf(":")>-1&&(l=s.split(":"),s=l[0],i=l[1]),o=""+i+s,s){case"line":u[o]=new d({obj:t,prefix:i});break;case"fill":u[o]=new p({obj:t,prefix:i});break;case"text":u[o]=new y({obj:t,prefix:i})}return u},e.exports={Angle:r,Array:o,Bool:i,Color:s,Coord:l,Direction:u,Distance:h,Enum:c,Numeric:f,Property:m,String:g,Line:d,Fill:p,Text:y,factories:{coords:x,distances:w,angles:b,fields:k,visuals:j}}},{"./has_props":"common/has_props","./svg_colors":"common/svg_colors",underscore:"underscore"}],"common/selection_manager":[function(t,e,n){var r,o,i,s,a,l,u=function(t,e){function n(){this.constructor=t}for(var r in e)h.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},h={}.hasOwnProperty;s=t("underscore"),r=t("./has_props"),l=t("./logging").logger,i=t("./selector"),a=t("./hittest"),o=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return u(e,t),e.prototype.type="SelectionManager",e.prototype.initialize=function(t,n){return e.__super__.initialize.call(this,t,n),this.selectors={},this.inspectors={},this.empty=a.create_hit_test_result(),this.last_inspection_was_empty={}},e.prototype.serializable_in_document=function(){return!1},e.prototype.select=function(t,e,n,r,o){var i,s,a;return null==o&&(o=!1),a=this.get("source"),a!==e.mget("data_source")&&l.warn("select called with mis-matched data sources"),i=e.hit_test(n),null!=i?(s=this._get_selector(e),s.update(i,r,o),this.get("source").set({selected:s.get("indices")}),a.trigger("select"),a.trigger("select-"+e.mget("id"))):void 0},e.prototype.inspect=function(t,e,n,r){var o,i,a,u;if(u=this.get("source"),u!==e.mget("data_source")&&l.warn("inspect called with mis-matched data sources"),o=e.hit_test(n),null!=o){if(a=e.model.id,s.isEqual(o,this.empty)){if(null==this.last_inspection_was_empty[a]&&(this.last_inspection_was_empty[a]=!1),this.last_inspection_was_empty[a])return;this.last_inspection_was_empty[a]=!0}else this.last_inspection_was_empty[a]=!1;return i=this._get_inspector(e),i.update(o,!0,!1,!0),this.get("source").set({inspected:i.get("indices")},{silent:!0}),u.trigger("inspect",o,t,e,u,r),u.trigger("inspect"+e.mget("id"),o,t,e,u,r)}},e.prototype.clear=function(t){var e,n,r,o;if(null!=t)o=this._get_selector(t),o.clear();else{n=this.selectors;for(e in n)r=n[e],r.clear()}return this.get("source").set({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}(r),e.exports=o},{"./has_props":"common/has_props","./hittest":"common/hittest","./logging":"common/logging","./selector":"common/selector",underscore:"underscore"}],"common/selector":[function(t,e,n){var r,o,i,s,a,l=function(t,e){function n(){this.constructor=t}for(var r in e)u.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},u={}.hasOwnProperty;i=t("underscore"),r=t("./has_props"),s=t("./hittest"),a=t("./logging").logger,o=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return l(e,t),e.prototype.type="Selector",e.prototype.update=function(t,e,n,r){return null==r&&(r=!1),this.set("timestamp",new Date,{silent:r}),this.set("final",e,{silent:r}),n&&(t["0d"].indices=i.union(this.get("indices")["0d"].indices,t["0d"].indices),t["0d"].glyph=this.get("indices")["0d"].glyph||t["0d"].glyph,t["1d"].indices=i.union(this.get("indices")["1d"].indices,t["1d"].indices),t["2d"].indices=i.union(this.get("indices")["2d"].indices,t["2d"].indices)),this.set("indices",t,{silent:r})},e.prototype.clear=function(){return this.set("timestamp",new Date),this.set("final",!0),this.set("indices",s.create_hit_test_result())},e.prototype.defaults=function(){return i.extend({},e.__super__.defaults.call(this),{indices:s.create_hit_test_result()})},e}(r),e.exports=o},{"./has_props":"common/has_props","./hittest":"common/hittest","./logging":"common/logging",underscore:"underscore"}],"common/solver":[function(t,e,n){var r,o,i,s;i=t("underscore"),r=t("backbone"),s=t("kiwi"),o=function(){function t(){this.solver=new s.Solver}return t.prototype.update_variables=function(t){return null==t&&(t=!0),this.solver.updateVariables(),t?this.trigger("layout_update"):void 0},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 null==e&&(e=s.Strength.strong),this.solver.addEditVariable(t,e)},t.prototype.suggest_value=function(t,e){return this.solver.suggestValue(t,e)},t}(),i.extend(o.prototype,r.Events),e.exports=o},{backbone:"backbone",kiwi:"kiwi",underscore:"underscore"}],"common/svg_colors":[function(t,e,n){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",lightgrey:"#D3D3D3",silver:"#C0C0C0",darkgray:"#A9A9A9",darkgrey:"#A9A9A9",gray:"#808080",grey:"#808080",dimgray:"#696969",dimgrey:"#696969",lightslategray:"#778899",lightslategrey:"#778899",slategray:"#708090",darkslategray:"#2F4F4F",darkslategrey:"#2F4F4F",black:"#000000"}},{}],"common/textutils":[function(t,e,n){var r,o,i;r=t("jquery"),o={},i=function(t){var e,n,i,s,a;if(null!=o[t])return o[t];a=r("<span>Hg</span>").css({font:t}),e=r('<div style="display: inline-block; width: 1px; height: 0px;"> </div>'),i=r("<div></div>"),i.append(a,e),n=r("body"),n.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={getTextHeight:i}},{jquery:"jquery"}],"common/tool_events":[function(t,e,n){var r,o,i,s,a=function(t,e){function n(){this.constructor=t}for(var r in e)l.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},l={}.hasOwnProperty;i=t("underscore"),r=t("../model"),s=t("./logging").logger,o=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return a(e,t),e.prototype.type="ToolEvents",e.prototype.defaults=function(){return i.extend({},e.__super__.defaults.call(this),{geometries:[]})},e}(r),e.exports={Model:o}},{"../model":"model","./logging":"common/logging",underscore:"underscore"}],"common/tool_manager":[function(t,e,n){var r,o,i,s,a,l,u,h,c,p,_,d,f,m=function(t,e){function n(){this.constructor=t}for(var r in e)g.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},g={}.hasOwnProperty,y=function(t,e){return function(){return t.apply(e,arguments)}};_=t("underscore"),r=t("jquery"),o=t("bootstrap/dropdown"),s=t("backbone"),i=t("../models/tools/actions/action_tool"),u=t("../models/tools/actions/help_tool"),a=t("../models/tools/gestures/gesture_tool"),h=t("../models/tools/inspectors/inspect_tool"),d=t("./logging").logger,f=t("./toolbar_template"),l=t("./has_props"),p=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return m(e,t),e.prototype.template=f,e.prototype.initialize=function(t){return e.__super__.initialize.call(this,t),this.listenTo(this.model,"change",this.render),this.have_rendered=!1},e.prototype.render=function(){var t,e,n,o,s,l;if(!this.have_rendered){this.have_rendered=!0,this.$el.html(this.template(this.model.attributes)),this.$el.addClass("bk-sidebar"),this.$el.addClass("bk-toolbar-active"),e=this.$(".bk-button-bar-list"),s=this.model.get("inspectors"),e=this.$(".bk-bs-dropdown[type='inspectors']"),0===s.length?e.hide():(t=r('<a href="#" data-bk-bs-toggle="dropdown" class="bk-bs-dropdown-toggle">inspect <span class="bk-bs-caret"></a>'),t.appendTo(e),l=r('<ul class="bk-bs-dropdown-menu" />'),_.each(s,function(t){var e;return e=r("<li />"),e.append(new h.ListItemView({model:t}).el),e.appendTo(l)}),l.on("click",function(t){return t.stopPropagation()}),l.appendTo(e),t.dropdown()),e=this.$(".bk-button-bar-list[type='help']"),_.each(this.model.get("help"),function(t){return e.append(new i.ButtonView({model:t}).el)}),e=this.$(".bk-button-bar-list[type='actions']"),_.each(this.model.get("actions"),function(t){return e.append(new i.ButtonView({model:t}).el)}),o=this.model.get("gestures");for(n in o)e=this.$(".bk-button-bar-list[type='"+n+"']"),_.each(o[n].tools,function(t){return e.append(new a.ButtonView({model:t}).el)});return this}},e}(s.View),c=function(t){function e(){return this._active_change=y(this._active_change,this),e.__super__.constructor.apply(this,arguments)}return m(e,t),e.prototype.type="ToolManager",e.prototype.initialize=function(t,n){return e.__super__.initialize.call(this,t,n),this._init_tools()},e.prototype.serializable_in_document=function(){return!1},e.prototype._init_tools=function(){var t,e,n,r,o,s,l,c,p,f,m;for(n=this.get("gestures"),c=this.get("tools"),o=0,l=c.length;l>o;o++)if(f=c[o],f instanceof h.Model)s=this.get("inspectors"),s.push(f),this.set("inspectors",s);else if(f instanceof u.Model)r=this.get("help"),r.push(f),this.set("help",r);else if(f instanceof i.Model)t=this.get("actions"),t.push(f),this.set("actions",t);else if(f instanceof a.Model){if(e=f.get("event_type"),!(e in n)){d.warn("ToolManager: unknown event type '"+e+"' for tool: "+f.type+" ("+f.id+")");continue}n[e].tools.push(f),this.listenTo(f,"change:active",_.bind(this._active_change,f))}p=[];for(e in n)m=n[e].tools,0!==m.length&&(n[e].tools=_.sortBy(m,function(t){return t.get("default_order")}),"pinch"!==e&&"scroll"!==e?p.push(n[e].tools[0].set("active",!0)):p.push(void 0));return p},e.prototype._active_change=function(t){var e,n,r;return n=t.get("event_type"),r=this.get("gestures"),e=r[n].active,null!=e&&e!==t&&(d.debug("ToolManager: deactivating tool: "+e.type+" ("+e.id+") for event type '"+n+"'"),e.set("active",!1)),r[n].active=t,this.set("gestures",r),d.debug("ToolManager: activating tool: "+t.type+" ("+t.id+") for event type '"+n+"'"),null},e.prototype.defaults=function(){return{gestures:{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:[],inspectors:[],help:[]}},e}(l),e.exports={Model:c,View:p}},{"../models/tools/actions/action_tool":"models/tools/actions/action_tool","../models/tools/actions/help_tool":"models/tools/actions/help_tool","../models/tools/gestures/gesture_tool":"models/tools/gestures/gesture_tool","../models/tools/inspectors/inspect_tool":"models/tools/inspectors/inspect_tool","./has_props":"common/has_props","./logging":"common/logging","./toolbar_template":"common/toolbar_template",backbone:"backbone","bootstrap/dropdown":"bootstrap/dropdown",jquery:"jquery",underscore:"underscore"}],"common/toolbar_template":[function(t,e,n){e.exports=function(t){t||(t={});var e,n=[],r=t.safe,o=t.escape;return e=t.safe=function(t){if(t&&t.ecoSafe)return t;("undefined"==typeof t||null==t)&&(t="");var e=new String(t);return e.ecoSafe=!0,e},o||(o=t.escape=function(t){return(""+t).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}),function(){(function(){null!=this.logo&&"grey"===this.logo?n.push("\n <a href='http://bokeh.pydata.org/' target='_blank' class='bk-logo bk-logo-small grey'></a>\n"):null!=this.logo&&n.push("\n<a href='http://bokeh.pydata.org/' target='_blank' class='bk-logo bk-logo-small'></a>\n"),n.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")}).call(this)}.call(t),t.safe=r,t.escape=o,n.join("")}},{}],"common/ui_events":[function(t,e,n){var r,o,i,s,a,l,u=function(t,e){function n(){this.constructor=t}for(var r in e)h.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},h={}.hasOwnProperty;r=t("jquery"),o=t("backbone"),i=t("hammerjs"),l=t("jquery-mousewheel")(r),a=t("./logging").logger,s=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return u(e,t),e.prototype.initialize=function(t,n){return e.__super__.initialize.call(this,t,n),this._hammer_element()},e.prototype._hammer_element=function(){var t;return t=this.get("hit_area"),this.hammer=new i(t[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)),t.mousemove(function(t){return function(e){return t._mouse_move(e)}}(this)),t.mouseenter(function(t){return function(e){return t._mouse_enter(e)}}(this)),t.mouseleave(function(t){return function(e){return t._mouse_exit(e)}}(this)),t.mousewheel(function(t){return function(e,n){return t._mouse_wheel(e,n)}}(this)),r(document).keydown(function(t){return function(e){return t._key_down(e)}}(this)),r(document).keyup(function(t){return function(e){return t._key_up(e)}}(this))},e.prototype.register_tool=function(t){var e,n,r;return e=t.mget("event_type"),n=t.mget("id"),r=t.model.type,null==e?void a.debug("Button tool: "+r):("pan"===e||"pinch"===e||"rotate"===e?(a.debug("Registering tool: "+r+" for event '"+e+"'"),null!=t["_"+e+"_start"]&&t.listenTo(this,e+":start:"+n,t["_"+e+"_start"]),t["_"+e]&&t.listenTo(this,e+":"+n,t["_"+e]),t["_"+e+"_end"]&&t.listenTo(this,e+":end:"+n,t["_"+e+"_end"])):"move"===e?(a.debug("Registering tool: "+r+" 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)):(a.debug("Registering tool: "+r+" for event '"+e+"'"),t.listenTo(this,e+":"+n,t["_"+e])),null!=t._keydown&&(a.debug("Registering tool: "+r+" for event 'keydown'"),t.listenTo(this,"keydown",t._keydown)),null!=t._keyup&&(a.debug("Registering tool: "+r+" for event 'keyup'"),t.listenTo(this,"keyup",t._keyup)),null!=t._doubletap?(a.debug("Registering tool: "+r+" for event 'doubletap'"),t.listenTo(this,"doubletap",t._doubletap)):void 0)},e.prototype._trigger=function(t,e){var n,r,o,i;return i=this.get("tool_manager"),r=t.split(":")[0],o=i.get("gestures"),n=o[r].active,null!=n?this._trigger_event(t,n,e):void 0},e.prototype._trigger_event=function(t,e,n){return e.get("active")===!0?("scroll"===t&&(n.preventDefault(),n.stopPropagation()),this.trigger(t+":"+e.id,n)):void 0},e.prototype._bokify_hammer=function(t){var e,n,o,i,s,a,l;return"mouse"===t.pointerType?(a=t.srcEvent.pageX,l=t.srcEvent.pageY):(a=t.center.x,l=t.center.y),n=r(t.target).offset(),e=null!=(o=n.left)?o:0,s=null!=(i=n.top)?i:0,t.bokeh={sx:a-e,sy:l-s}},e.prototype._bokify_jq=function(t){var e,n,o,i,s;return n=r(t.currentTarget).offset(),e=null!=(o=n.left)?o:0,s=null!=(i=n.top)?i:0,t.bokeh={sx:t.pageX-e,sy:t.pageY-s}},e.prototype._tap=function(t){return this._bokify_hammer(t),this._trigger("tap",t)},e.prototype._doubletap=function(t){return this._bokify_hammer(t),this.trigger("doubletap",t)},e.prototype._press=function(t){return this._bokify_hammer(t),this._trigger("press",t)},e.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)},e.prototype._pan=function(t){return this._bokify_hammer(t),this._trigger("pan",t)},e.prototype._pan_end=function(t){return this._bokify_hammer(t),this._trigger("pan:end",t)},e.prototype._pinch_start=function(t){return this._bokify_hammer(t),this._trigger("pinch:start",t)},e.prototype._pinch=function(t){return this._bokify_hammer(t),this._trigger("pinch",t)},e.prototype._pinch_end=function(t){return this._bokify_hammer(t),this._trigger("pinch:end",t)},e.prototype._rotate_start=function(t){return this._bokify_hammer(t),this._trigger("rotate:start",t)},e.prototype._rotate=function(t){return this._bokify_hammer(t),this._trigger("rotate",t)},e.prototype._rotate_end=function(t){return this._bokify_hammer(t),this._trigger("rotate:end",t)},e.prototype._mouse_enter=function(t){return this._bokify_jq(t),this.trigger("move:enter",t)},e.prototype._mouse_move=function(t){return this._bokify_jq(t),this.trigger("move",t)},e.prototype._mouse_exit=function(t){return this._bokify_jq(t),this.trigger("move:exit",t)},e.prototype._mouse_wheel=function(t,e){return this._bokify_jq(t),t.bokeh.delta=e,this._trigger("scroll",t)},e.prototype._key_down=function(t){return this.trigger("keydown",t)},e.prototype._key_up=function(t){return this.trigger("keyup",t)},e}(o.Model),e.exports=s},{"./logging":"common/logging",backbone:"backbone",hammerjs:"hammerjs/hammer",jquery:"jquery","jquery-mousewheel":"jquery-mousewheel"}],main:[function(t,e,n){var r,o;r={},r.require=t,r.version="0.11.1",r._=t("underscore"),r.$=t("jquery"),r.Backbone=t("backbone"),r.Backbone.$=r.$,o=t("./common/logging"),r.logger=o.logger,r.set_log_level=o.set_log_level,window.Float64Array||(r.logger.warn("Float64Array is not supported. Using generic Array instead."),window.Float64Array=Array),r.index=t("./common/base").index,r.embed=t("./common/embed"),r.Collections=t("./common/base").Collections,r.Config=t("./common/base").Config,r.Bokeh=r,e.exports=r},{"./common/base":"common/base","./common/embed":"common/embed","./common/logging":"common/logging",backbone:"backbone",jquery:"jquery",underscore:"underscore"}],model:[function(t,e,n){var r,o,i,s=function(t,e){function n(){this.constructor=t}for(var r in e)a.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},a={}.hasOwnProperty;i=t("underscore"),r=t("./common/has_props"),o=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return s(e,t),e.prototype.type="Model",e.prototype.defaults=function(){return i.extend({},e.__super__.defaults.call(this),{tags:[],name:null})},e}(r),e.exports=o},{"./common/has_props":"common/has_props",underscore:"underscore"}],"models/annotations/annotation":[function(t,e,n){var r,o,i,s=function(t,e){function n(){this.constructor=t}for(var r in e)a.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},a={}.hasOwnProperty;i=t("underscore"),o=t("../renderers/renderer"),r=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return s(e,t),e.prototype.type="Annotation",e.prototype.defaults=function(){return i.extend({},e.__super__.defaults.call(this),{level:"overlay",plot:null})},e}(o),e.exports={Model:r}},{"../renderers/renderer":"models/renderers/renderer",underscore:"underscore"}],"models/annotations/box_annotation":[function(t,e,n){var r,o,i,s,a,l,u=function(t,e){function n(){this.constructor=t}for(var r in e)h.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},h={}.hasOwnProperty;a=t("underscore"),r=t("./annotation"),s=t("../../common/plot_widget"),l=t("../../common/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.fill_props=new l.Fill({obj:this.model,prefix:""}),this.line_props=new l.Line({obj:this.model,prefix:""}),this.$el.appendTo(this.plot_view.$el.find("div.bk-canvas-overlays")),this.$el.addClass("shading"),this.$el.hide()},e.prototype.bind_bokeh_events=function(){return"css"===this.mget("render_mode")?this.listenTo(this.model,"data_update",this.render):this.listenTo(this.model,"data_update",this.plot_view.request_render)},e.prototype.render=function(){var t,e,n,r;return null==this.mget("left")&&null==this.mget("right")&&null==this.mget("top")&&null==this.mget("bottom")?(this.$el.hide(),null):(this.frame=this.plot_model.get("frame"),this.canvas=this.plot_model.get("canvas"),this.xmapper=this.plot_view.frame.get("x_mappers")[this.mget("x_range_name")],this.ymapper=this.plot_view.frame.get("y_mappers")[this.mget("y_range_name")],e=this.canvas.vx_to_sx(this._calc_dim("left",this.xmapper,this.frame.get("h_range").get("start"))),n=this.canvas.vx_to_sx(this._calc_dim("right",this.xmapper,this.frame.get("h_range").get("end"))),t=this.canvas.vy_to_sy(this._calc_dim("bottom",this.ymapper,this.frame.get("v_range").get("start"))),r=this.canvas.vy_to_sy(this._calc_dim("top",this.ymapper,this.frame.get("v_range").get("end"))),"css"===this.mget("render_mode")?this._css_box(e,n,t,r):this._canvas_box(e,n,t,r))},e.prototype._css_box=function(t,e,n,r){var o,i,s,l,u,h,c,p;return p=Math.abs(e-t),h=Math.abs(n-r),u=this.mget("line_width").value,s=this.mget("line_color").value,i=this.mget("fill_color").value,o=this.mget("fill_alpha").value,c="left:"+t+"px; width:"+p+"px; top:"+r+"px; height:"+h+"px; border-width:"+u+"px; border-color:"+s+"; background-color:"+i+"; opacity:"+o+";",l=this.mget("line_dash"),a.isArray(l)&&(l=l.length<2?"solid":"dashed"),a.isString(l)&&(c+=" border-style:"+l+";"),this.$el.attr("style",c),this.$el.show()},e.prototype._canvas_box=function(t,e,n,r){var o;return o=this.plot_view.canvas_view.ctx,o.save(),o.beginPath(),o.rect(t,r,e-t,n-r),this.fill_props.set_value(o),o.fill(),this.line_props.set_value(o),o.stroke(),o.restore()},e.prototype._calc_dim=function(t,e,n){var r;return r=null!=this.mget(t)?"data"===this.mget(t+"_units")?e.map_to_target(this.mget(t)):this.mget(t):n},e}(s),o=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return u(e,t),e.prototype.default_view=i,e.prototype.type="BoxAnnotation",e.prototype.nonserializable_attribute_names=function(){return e.__super__.nonserializable_attribute_names.call(this).concat(["silent_update"])},e.prototype.update=function(t){var e,n,r,o;return n=t.left,r=t.right,o=t.top,e=t.bottom,this.get("silent_update")?(this.attributes.left=n,this.attributes.right=r,this.attributes.top=o,this.attributes.bottom=e):this.set({left:n,right:r,top:o,bottom:e}),this.trigger("data_update")},e.prototype.defaults=function(){return a.extend({},e.__super__.defaults.call(this),{silent_update:!1,render_mode:"canvas",x_range_name:"default",y_range_name:"default",level:"annotation",left:null,right:null,top:null,bottom:null,left_units:"data",right_units:"data",top_units:"data",bottom_units:"data",fill_color:"#fff9ba",fill_alpha:.4,line_color:"#cccccc",line_width:1,line_alpha:.3,line_join:"miter",line_cap:"butt",line_dash:[],line_dash_offset:0})},e}(r.Model),e.exports={Model:o,View:i}},{"../../common/plot_widget":"common/plot_widget","../../common/properties":"common/properties","./annotation":"models/annotations/annotation",underscore:"underscore"}],"models/annotations/legend":[function(t,e,n){var r,o,i,s,a,l,u,h=function(t,e){function n(){this.constructor=t}for(var r in e)c.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},c={}.hasOwnProperty;a=t("underscore"),r=t("./annotation"),s=t("../../common/plot_widget"),l=t("../../common/properties"),u=t("../../common/textutils"),i=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.label_props=new l.Text({obj:this.model,prefix:"label_"}),this.border_props=new l.Line({obj:this.model,prefix:"border_"}),this.background_props=new l.Fill({obj:this.model,prefix:"background_"}),this.need_calc_dims=!0,this.listenTo(this.plot_model.solver,"layout_update",function(){return this.need_calc_dims=!0})},e.prototype.calc_dims=function(t){var e,n,r,o,i,s,l,h,c,p,_,d,f,m,g;if(l=function(){var t,e,r,o,i;for(r=this.mget("legends"),i=[],t=0,e=r.length;e>t;t++)o=r[t],s=o[0],n=o[1],i.push(s);return i}.call(this),o=this.mget("label_height"),this.glyph_height=this.mget("glyph_height"),i=this.mget("label_width"),this.glyph_width=this.mget("glyph_width"),c=this.mget("legend_spacing"),this.label_height=a.max([u.getTextHeight(this.label_props.font_value()),o,this.glyph_height]),this.legend_height=this.label_height,this.legend_height=l.length*this.legend_height+(1+l.length)*c,e=this.plot_view.canvas_view.ctx,e.save(),this.label_props.set_value(e),d=a.map(l,function(t){return e.measureText(t).width}),e.restore(),_=a.max(d),this.label_width=a.max([_,i]),this.legend_width=this.label_width+this.glyph_width+3*c,p=this.mget("location"),h=this.mget("legend_padding"),r=this.plot_view.frame.get("h_range"),f=this.plot_view.frame.get("v_range"),a.isString(p))switch(p){case"top_left":m=r.get("start")+h,g=f.get("end")-h;break;case"top_center":m=(r.get("end")+r.get("start"))/2-this.legend_width/2,g=f.get("end")-h;break;case"top_right":m=r.get("end")-h-this.legend_width,g=f.get("end")-h;break;case"right_center":m=r.get("end")-h-this.legend_width,g=(f.get("end")+f.get("start"))/2+this.legend_height/2;break;case"bottom_right":m=r.get("end")-h-this.legend_width,g=f.get("start")+h+this.legend_height;break;case"bottom_center":m=(r.get("end")+r.get("start"))/2-this.legend_width/2,g=f.get("start")+h+this.legend_height;break;case"bottom_left":m=r.get("start")+h,g=f.get("start")+h+this.legend_height;break;case"left_center":m=r.get("start")+h,g=(f.get("end")+f.get("start"))/2+this.legend_height/2;break;case"center":m=(r.get("end")+r.get("start"))/2-this.legend_width/2,g=(f.get("end")+f.get("start"))/2+this.legend_height/2}else a.isArray(p)&&2===p.length&&(m=p[0],g=p[1]);return m=this.plot_view.canvas.vx_to_sx(m),g=this.plot_view.canvas.vy_to_sy(g),this.box_coords=[m,g]},e.prototype.render=function(){var t,e,n,r,o,i,s,a,l,u,h,c,p,_,d,f,m,g,y,v,b,x;for(this.need_calc_dims&&(this.calc_dims(),this.need_calc_dims=!1),t=this.plot_view.canvas_view.ctx,t.save(),t.beginPath(),t.rect(this.box_coords[0],this.box_coords[1],this.legend_width,this.legend_height),this.background_props.set_value(t),t.fill(),this.border_props.do_stroke&&(this.border_props.set_value(t),t.stroke()),s=this.mget("legend_spacing"),u=this.mget("legends"),r=n=0,a=u.length;a>n;r=++n)for(h=u[r],i=h[0],e=h[1],b=r*this.label_height,x=(1+r)*s,g=this.box_coords[1]+this.label_height/2+b+x,d=this.box_coords[0]+s,f=this.box_coords[0]+2*s+this.label_width,m=f+this.glyph_width,y=this.box_coords[1]+b+x,v=y+this.glyph_height,this.label_props.set_value(t),t.fillText(i,d,g),c=this.model.resolve_ref(e),o=0,l=c.length;l>o;o++)p=c[o],_=this.plot_view.renderers[p.id],_.draw_legend(t,f,m,y,v);return t.restore()},e}(s),o=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return h(e,t),e.prototype.default_view=i,e.prototype.type="Legend",e.prototype.defaults=function(){return a.extend({},e.__super__.defaults.call(this),{legends:[],level:"annotation",border_line_color:"black",border_line_width:1,border_line_alpha:1,border_line_join:"miter",border_line_cap:"butt",border_line_dash:[],border_line_dash_offset:0,background_fill_color:"#ffffff",background_fill_alpha:1,label_standoff:15,label_text_font:"helvetica",label_text_font_size:"10pt",label_text_font_style:"normal",label_text_color:"#444444",label_text_alpha:1,label_text_align:"left",label_text_baseline:"middle",glyph_height:20,glyph_width:20,label_height:20,label_width:50,legend_padding:10,legend_spacing:3,location:"top_right"})},e}(r.Model),e.exports={Model:o,View:i}},{"../../common/plot_widget":"common/plot_widget","../../common/properties":"common/properties","../../common/textutils":"common/textutils","./annotation":"models/annotations/annotation",underscore:"underscore"}],"models/annotations/poly_annotation":[function(t,e,n){var r,o,i,s,a,l,u=function(t,e){function n(){this.constructor=t}for(var r in e)h.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},h={}.hasOwnProperty;a=t("underscore"),r=t("./annotation"),o=t("../../common/plot_widget"),l=t("../../common/properties"),s=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.line=new l.Line({obj:this.model,prefix:""}),this.fill=new l.Fill({obj:this.model,prefix:""})},e.prototype.bind_bokeh_events=function(){return this.listenTo(this.model,"data_update",this.plot_view.request_render)},e.prototype.render=function(t){var e,n,r,o,i,s,a,l,u,h;if(u=this.mget("xs"),h=this.mget("ys"),u.length!==h.length)return null;if(u.length<3||h.length<3)return null;for(e=this.plot_view.canvas,t=this.plot_view.canvas_view.ctx,n=r=0,o=u.length;o>=0?o>r:r>o;n=o>=0?++r:--r)"screen"===this.mget("xs_units")&&(a=u[n]),"screen"===this.mget("ys_units")&&(l=h[n]),i=e.vx_to_sx(a),s=e.vy_to_sy(l),0===n?(t.beginPath(),t.moveTo(i,s)):t.lineTo(i,s);return t.closePath(),this.line.do_stroke&&(this.line.set_value(t),t.stroke()),this.fill.do_fill?(this.fill.set_value(t),t.fill()):void 0},e}(o),i=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return u(e,t),e.prototype.default_view=s,e.prototype.type="PolyAnnotation",e.prototype.nonserializable_attribute_names=function(){return e.__super__.nonserializable_attribute_names.call(this).concat(["silent_update"])},e.prototype.update=function(t){var e,n;return e=t.xs,n=t.ys,this.get("silent_update")?(this.attributes.xs=e,this.attributes.ys=n):this.set({xs:e,ys:n}),this.trigger("data_update")},e.prototype.defaults=function(){return a.extend({},e.__super__.defaults.call(this),{silent_update:!1,plot:null,xs:[],ys:[],xs_units:"data",ys_units:"data",x_range_name:"default",y_range_name:"default",level:"annotation",fill_color:"#fff9ba",fill_alpha:.4,line_width:1,line_color:"#cccccc",line_alpha:.3,line_alpha:.3,line_join:"miter",line_cap:"butt",line_dash:[],line_dash_offset:0})},e}(r.Model),e.exports={Model:i,View:s}},{"../../common/plot_widget":"common/plot_widget","../../common/properties":"common/properties","./annotation":"models/annotations/annotation",underscore:"underscore"}],"models/annotations/span":[function(t,e,n){var r,o,i,s,a,l,u=function(t,e){function n(){this.constructor=t}for(var r in e)h.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},h={}.hasOwnProperty;a=t("underscore"),r=t("./annotation"),o=t("../../common/plot_widget"),l=t("../../common/properties"),s=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.line_props=new l.Line({obj:this.model,prefix:""}),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.mget("for_hover")?this.listenTo(this.model,"change:computed_location",this._draw_span):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,n,r,o,i,s,a,l,u;return o=this.mget("for_hover")?this.mget("computed_location"):this.mget("location"),null==o?void this.$el.hide():(n=this.plot_model.get("frame"),t=this.plot_model.get("canvas"),l=this.plot_view.frame.get("x_mappers")[this.mget("x_range_name")],u=this.plot_view.frame.get("y_mappers")[this.mget("y_range_name")],"width"===this.mget("dimension")?(s=t.vy_to_sy(this._calc_dim(o,u)),i=t.vx_to_sx(n.get("left")),a=n.get("width"),r=this.line_props.width.value()):(s=t.vy_to_sy(n.get("top")),i=t.vx_to_sx(this._calc_dim(o,l)),a=this.line_props.width.value(),r=n.get("height")),"css"===this.mget("render_mode")?(this.$el.css({top:s,left:i,width:a+"px",height:r+"px","z-index":1e3,"background-color":this.line_props.color.value(),opacity:this.line_props.alpha.value()}),this.$el.show()):"canvas"===this.mget("render_mode")?(e=this.plot_view.canvas_view.ctx,e.save(),e.beginPath(),this.line_props.set_value(e),e.moveTo(i,s),"width"===this.mget("dimension")?e.lineTo(i+a,s):e.lineTo(i,s+r),e.stroke(),e.restore()):void 0)},e.prototype._calc_dim=function(t,e){var n;return n="data"===this.mget("location_units")?e.map_to_target(t):t},e}(o),i=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return u(e,t),e.prototype.default_view=s,e.prototype.type="Span",e.prototype.nonserializable_attribute_names=function(){return e.__super__.nonserializable_attribute_names.call(this).concat(["for_hover","computed_location"])},e.prototype.defaults=function(){return a.extend({},e.__super__.defaults.call(this),{for_hover:!1,x_range_name:"default",y_range_name:"default",render_mode:"canvas",location_units:"data",level:"annotation",dimension:"width",location:null,line_color:"black",line_width:1,line_alpha:1,line_dash:[],line_dash_offset:0,line_cap:"butt",line_join:"miter"})},e}(r.Model),e.exports={Model:i,View:s}},{"../../common/plot_widget":"common/plot_widget","../../common/properties":"common/properties","./annotation":"models/annotations/annotation",underscore:"underscore"}],"models/annotations/tooltip":[function(t,e,n){var r,o,i,s,a,l,u,h=function(t,e){function n(){this.constructor=t}for(var r in e)c.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},c={}.hasOwnProperty;r=t("jquery"),l=t("underscore"),o=t("./annotation"),i=t("../../common/plot_widget"),u=t("../../common/logging").logger,a=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return h(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,n,o,i,s,a,u,h,c,p,_,d,f,m;if(this.$el.empty(),this.$el.hide(),this.$el.toggleClass("bk-tooltip-custom",this.mget("custom")),!l.isEmpty(this.mget("data"))){for(a=this.mget("data"),n=0,i=a.length;i>n;n++)d=a[n],f=d[0],m=d[1],e=d[2],(!this.mget("inner_only")||this.plot_view.frame.contains(f,m))&&(p=r("<div />").appendTo(this.$el),
|
|
p.append(e));switch(h=this.plot_view.mget("canvas").vx_to_sx(f),c=this.plot_view.mget("canvas").vy_to_sy(m),u=this.mget("side"),"auto"===u&&(s=this.plot_view.frame.get("width"),u=f-this.plot_view.frame.get("left")<s/2?"right":"left"),this.$el.removeClass("bk-right"),this.$el.removeClass("bk-left"),t=10,u){case"right":this.$el.addClass("bk-left"),o=h+(this.$el.outerWidth()-this.$el.innerWidth())+t;break;case"left":this.$el.addClass("bk-right"),o=h-this.$el.outerWidth()-t}return _=c-this.$el.outerHeight()/2,this.$el.children().length>0?(this.$el.css({top:_,left:o}),this.$el.show()):void 0}},e}(i),s=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return h(e,t),e.prototype.default_view=a,e.prototype.type="Tooltip",e.prototype.nonserializable_attribute_names=function(){return e.__super__.nonserializable_attribute_names.call(this).concat(["data","custom"])},e.prototype.clear=function(){return this.set("data",[])},e.prototype.add=function(t,e,n){var r;return r=this.get("data"),r.push([t,e,n]),this.set("data",r)},e.prototype.defaults=function(){return l.extend({},e.__super__.defaults.call(this),{level:"overlay",side:"auto",inner_only:!0})},e}(o.Model),e.exports={Model:s,View:a}},{"../../common/logging":"common/logging","../../common/plot_widget":"common/plot_widget","./annotation":"models/annotations/annotation",jquery:"jquery",underscore:"underscore"}],"models/axes/axis":[function(t,e,n){var r,o,i,s,a,l,u,h,c,p,_,d,f,m,g,y,v,b,x,w,k,M,j=function(t,e){function n(){this.constructor=t}for(var r in e)T.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},T={}.hasOwnProperty;d=t("underscore"),x=t("kiwi"),a=t("../renderers/guide_renderer"),h=t("../../common/layout_box"),w=t("../../common/logging").logger,p=t("../../common/plot_widget"),M=t("../../common/properties"),k=Math.PI/2,r="alphabetic",c="middle",l="hanging",u="left",_="right",s="center",y={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:{parallel:r,normal:c,horizontal:r,vertical:c},below:{parallel:l,normal:c,horizontal:l,vertical:c},left:{parallel:r,normal:c,horizontal:c,vertical:r},right:{parallel:r,normal:c,horizontal:c,vertical:r}},f={above:{parallel:s,normal:u,horizontal:s,vertical:u},below:{parallel:s,normal:u,horizontal:s,vertical:_},left:{parallel:s,normal:_,horizontal:_,vertical:s},right:{parallel:s,normal:u,horizontal:u,vertical:s}},m={above:_,below:u,left:_,right:u},g={above:u,below:_,left:_,right:u},v=function(t,e,n){var r,o;return d.isString(n)?(o=b[e][n],r=f[e][n]):0===n?(o=b[e][n],r=f[e][n]):0>n?(o="middle",r=m[e]):n>0&&(o="middle",r=g[e]),t.textBaseline=o,t.textAlign=r},i=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return j(e,t),e.prototype.initialize=function(t){return e.__super__.initialize.call(this,t),this.rule_props=new M.Line({obj:this.model,prefix:"axis_"}),this.major_tick_props=new M.Line({obj:this.model,prefix:"major_tick_"}),this.minor_tick_props=new M.Line({obj:this.model,prefix:"minor_tick_"}),this.major_label_props=new M.Text({obj:this.model,prefix:"major_label_"}),this.axis_label_props=new M.Text({obj:this.model,prefix:"axis_label_"}),this.x_range_name=this.mget("x_range_name"),this.y_range_name=this.mget("y_range_name")},e.prototype.render=function(){var t;if(this.mget("visible"))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._draw_rule=function(t){var e,n,r,o,i,s,a,l,u,h,c,p,_,d,f,m;if(this.rule_props.do_stroke){for(s=e=this.mget("rule_coords"),_=s[0],f=s[1],a=this.plot_view.map_to_screen(_,f,this.x_range_name,this.y_range_name),c=a[0],p=a[1],l=this.mget("normals"),o=l[0],i=l[1],u=this.mget("offsets"),d=u[0],m=u[1],this.rule_props.set_value(t),t.beginPath(),t.moveTo(Math.round(c[0]+o*d),Math.round(p[0]+i*m)),n=r=1,h=c.length;h>=1?h>r:r>h;n=h>=1?++r:--r)t.lineTo(Math.round(c[n]+o*d),Math.round(p[n]+i*m));return t.stroke()}},e.prototype._draw_major_ticks=function(t){var e,n,r,o,i,s,a,l,u,h,c,p,_,d,f,m,g,y,v;if(this.major_tick_props.do_stroke){for(e=this.mget("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),p=a[0],_=a[1],l=this.mget("normals"),o=l[0],i=l[1],u=this.mget("offsets"),g=u[0],v=u[1],d=this.mget("major_tick_in"),f=this.mget("major_tick_out"),this.major_tick_props.set_value(t),c=[],n=r=0,h=p.length;h>=0?h>r:r>h;n=h>=0?++r:--r)t.beginPath(),t.moveTo(Math.round(p[n]+o*f+o*g),Math.round(_[n]+i*f+i*v)),t.lineTo(Math.round(p[n]-o*d+o*g),Math.round(_[n]-i*d+i*v)),c.push(t.stroke());return c}},e.prototype._draw_minor_ticks=function(t){var e,n,r,o,i,s,a,l,u,h,c,p,_,d,f,m,g,y,v;if(this.minor_tick_props.do_stroke){for(e=this.mget("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),p=a[0],_=a[1],l=this.mget("normals"),o=l[0],i=l[1],u=this.mget("offsets"),g=u[0],v=u[1],d=this.mget("minor_tick_in"),f=this.mget("minor_tick_out"),this.minor_tick_props.set_value(t),c=[],n=r=0,h=p.length;h>=0?h>r:r>h;n=h>=0?++r:--r)t.beginPath(),t.moveTo(Math.round(p[n]+o*f+o*g),Math.round(_[n]+i*f+i*v)),t.lineTo(Math.round(p[n]-o*d+o*g),Math.round(_[n]-i*d+i*v)),c.push(t.stroke());return c}},e.prototype._draw_major_labels=function(t){var e,n,r,o,i,s,a,l,u,h,c,p,_,f,m,g,b,x,w,k,M,j,T;for(n=this.mget("tick_coords"),h=n.major,k=h[0],j=h[1],c=this.plot_view.map_to_screen(k,j,this.x_range_name,this.y_range_name),x=c[0],w=c[1],p=this.mget("normals"),a=p[0],l=p[1],_=this.mget("offsets"),M=_[0],T=_[1],r=this.mget("dimension"),g=this.mget("layout_location"),u=this.mget("major_label_orientation"),e=d.isString(u)?y[g][u]:-u,b=this.model._tick_extent(this)+this.mget("major_label_standoff"),s=this.mget("formatter").format(n.major[r]),this.major_label_props.set_value(t),v(t,g,u),m=[],o=i=0,f=x.length;f>=0?f>i:i>f;o=f>=0?++i:--i)e?(t.translate(x[o]+a*b+a*M,w[o]+l*b+l*T),t.rotate(e),t.fillText(s[o],0,0),t.rotate(-e),m.push(t.translate(-x[o]-a*b+a*M,-w[o]-l*b+l*T))):m.push(t.fillText(s[o],Math.round(x[o]+a*b+a*M),Math.round(w[o]+l*b+l*T)));return m},e.prototype._draw_axis_label=function(t){var e,n,r,o,i,s,a,l,u,h,c,p,_,d,f,m,g;return n=this.mget("axis_label"),null!=n?(s=this.mget("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),p=a[0],_=a[1],l=this.mget("normals"),r=l[0],o=l[1],u=this.mget("offsets"),f=u[0],g=u[1],h=this.mget("layout_location"),i="parallel",e=y[h][i],c=this.model._tick_extent(this)+this.model._tick_label_extent(this)+this.mget("axis_label_standoff"),p=(p[0]+p[p.length-1])/2,_=(_[0]+_[_.length-1])/2,this.axis_label_props.set_value(t),v(t,h,i),e?(t.translate(p+r*c+r*f,_+o*c+o*g),t.rotate(e),t.fillText(n,0,0),t.rotate(-e),t.translate(-p-r*c+r*f,-_-o*c+o*g)):t.fillText(n,p+r*c+r*f,_+o*c+o*g)):void 0},e}(p),o=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return j(e,t),e.prototype.default_view=i,e.prototype.type="Axis",e.prototype.initialize=function(t,n){return e.__super__.initialize.call(this,t,n),this.register_property("computed_bounds",this._computed_bounds,!1),this.add_dependencies("computed_bounds",this,["bounds"]),this.add_dependencies("computed_bounds",this.get("plot"),["x_range","y_range"]),this.register_property("rule_coords",this._rule_coords,!1),this.add_dependencies("rule_coords",this,["computed_bounds","side"]),this.register_property("tick_coords",this._tick_coords,!1),this.add_dependencies("tick_coords",this,["computed_bounds","layout_location"]),this.register_property("ranges",this._ranges,!0),this.register_property("normals",function(){return this._normals},!0),this.register_property("dimension",function(){return this._dim},!0),this.register_property("offsets",this._offsets,!0)},e.prototype.nonserializable_attribute_names=function(){return e.__super__.nonserializable_attribute_names.call(this).concat(["layout_location"])},e.prototype.initialize_layout=function(t){var e,n;return e=new h.Model({solver:t}),this.panel=e,this._top=e._top,this._bottom=e._bottom,this._left=e._left,this._right=e._right,this._width=e._width,this._height=e._height,n=this.get("layout_location"),"above"===n?(this._dim=0,this._normals=[0,-1],this._size=e._height,this._anchor=e._bottom):"below"===n?(this._dim=0,this._normals=[0,1],this._size=e._height,this._anchor=e._top):"left"===n?(this._dim=1,this._normals=[-1,0],this._size=e._width,this._anchor=e._right):"right"===n?(this._dim=1,this._normals=[1,0],this._size=e._width,this._anchor=e._left):w.error("unrecognized side: '"+n+"'")},e.prototype.update_layout=function(t,e){var n;if(this.get("visible")&&(n=this._tick_extent(t)+this._tick_label_extent(t)+this._axis_label_extent(t),null==this._last_size&&(this._last_size=-1),n!==this._last_size))return this._last_size=n,null!=this._size_constraint&&e.remove_constraint(this._size_constraint),this._size_constraint=new x.Constraint(new x.Expression(this._size,-n),x.Operator.Eq),e.add_constraint(this._size_constraint)},e.prototype._offsets=function(){var t,e,n,r,o;return n=this.get("layout_location"),e=[0,0],r=e[0],o=e[1],t=this.get("plot").get("frame"),"below"===n?o=Math.abs(this.panel.get("top")-t.get("bottom")):"above"===n?o=Math.abs(this.panel.get("bottom")-t.get("top")):"right"===n?r=Math.abs(this.panel.get("left")-t.get("right")):"left"===n&&(r=Math.abs(this.panel.get("right")-t.get("left"))),[r,o]},e.prototype._ranges=function(){var t,e,n,r;return e=this.get("dimension"),n=(e+1)%2,t=this.get("plot").get("frame"),r=[t.get("x_ranges")[this.get("x_range_name")],t.get("y_ranges")[this.get("y_range_name")]],[r[e],r[n]]},e.prototype._computed_bounds=function(){var t,e,n,r,o,i,s,a;return o=this.get("ranges"),n=o[0],t=o[1],a=null!=(i=this.get("bounds"))?i:"auto",r=[n.get("min"),n.get("max")],"auto"===a?r:d.isArray(a)?(Math.abs(a[0]-a[1])>Math.abs(r[0]-r[1])?(s=Math.max(Math.min(a[0],a[1]),r[0]),e=Math.min(Math.max(a[0],a[1]),r[1])):(s=Math.min(a[0],a[1]),e=Math.max(a[0],a[1])),[s,e]):(w.error("user bounds '"+a+"' not understood"),null)},e.prototype._rule_coords=function(){var t,e,n,r,o,i,s,a,l,u,h,c;return r=this.get("dimension"),o=(r+1)%2,a=this.get("ranges"),s=a[0],e=a[1],l=this.get("computed_bounds"),u=l[0],n=l[1],h=new Array(2),c=new Array(2),t=[h,c],i=this._get_loc(e),t[r][0]=Math.max(u,s.get("min")),t[r][1]=Math.min(n,s.get("max")),t[r][0]>t[r][1]&&(t[r][0]=t[r][1]=NaN),t[o][0]=i,t[o][1]=i,t},e.prototype._tick_coords=function(){var t,e,n,r,o,i,s,a,l,u,h,c,p,_,d,f,m,g,y,v,b,x,w,k,M,j,T,z;if(r=this.get("dimension"),i=(r+1)%2,y=this.get("ranges"),f=y[0],e=y[1],v=this.get("computed_bounds"),M=v[0],n=v[1],j=this.get("ticker").get_ticks(M,n,f,{}),h=j.major,d=j.minor,l=this._get_loc(e),T=[],z=[],t=[T,z],p=[],_=[],c=[p,_],"FactorRange"===f.type)for(o=s=0,b=h.length;b>=0?b>s:s>b;o=b>=0?++s:--s)t[r].push(h[o]),t[i].push(l);else{for(x=[f.get("min"),f.get("max")],g=x[0],m=x[1],o=a=0,w=h.length;w>=0?w>a:a>w;o=w>=0?++a:--a)h[o]<g||h[o]>m||(t[r].push(h[o]),t[i].push(l));for(o=u=0,k=d.length;k>=0?k>u:u>k;o=k>=0?++u:--u)d[o]<g||d[o]>m||(c[r].push(d[o]),c[i].push(l))}return{major:t,minor:c}},e.prototype._get_loc=function(t){var e,n,r,o;return n=t.get("start"),e=t.get("end"),o=this.get("layout_location"),"left"===o||"below"===o?r="start":("right"===o||"above"===o)&&(r="end"),t.get(r)},e.prototype._tick_extent=function(t){return this.get("major_tick_out")},e.prototype._tick_label_extent=function(t){var e,n,r,o,i,s,a,l,u,h,c,p,_,f,m,g,v,b,x;for(s=0,i=this.get("dimension"),o=t.plot_view.canvas_view.ctx,r=this.get("tick_coords").major,g=this.get("layout_location"),_=this.get("major_label_orientation"),p=this.get("formatter").format(r[i]),t.major_label_props.set_value(o),d.isString(_)?(u=1,e=y[g][_]):(u=2,e=-_),e=Math.abs(e),n=Math.cos(e),m=Math.sin(e),"above"===g||"below"===g?(x=m,l=n):(x=n,l=m),h=c=0,f=p.length;f>=0?f>c:c>f;h=f>=0?++c:--c)null!=p[h]&&(b=1.1*o.measureText(p[h]).width,a=.9*o.measureText(p[h]).ascent,v=b*x+a/u*l,v>s&&(s=v));return s>0&&(s+=this.get("major_label_standoff")),s},e.prototype._axis_label_extent=function(t){var e,n,r,o,i,s,a,l,u;return o=0,l=this.get("layout_location"),s="parallel",r=t.plot_view.canvas_view.ctx,t.axis_label_props.set_value(r),e=Math.abs(y[l][s]),n=Math.cos(e),a=Math.sin(e),this.get("axis_label")&&(o+=this.get("axis_label_standoff"),t.axis_label_props.set_value(r),u=1.1*r.measureText(this.get("axis_label")).width,i=.9*r.measureText(this.get("axis_label")).ascent,o+="above"===l||"below"===l?u*a+i*n:u*n+i*a),o},e.prototype.defaults=function(){return d.extend({},e.__super__.defaults.call(this),{location:"auto",bounds:"auto",x_range_name:"default",y_range_name:"default",axis_label:"",visible:!0,axis_line_color:"black",axis_line_width:1,axis_line_alpha:1,axis_line_join:"miter",axis_line_cap:"butt",axis_line_dash:[],axis_line_dash_offset:0,major_tick_in:2,major_tick_out:6,major_tick_line_color:"black",major_tick_line_width:1,major_tick_line_alpha:1,major_tick_line_join:"miter",major_tick_line_cap:"butt",major_tick_line_dash:[],major_tick_line_dash_offset:0,minor_tick_in:0,minor_tick_out:4,minor_tick_line_color:"black",minor_tick_line_width:1,minor_tick_line_alpha:1,minor_tick_line_join:"miter",minor_tick_line_cap:"butt",minor_tick_line_dash:[],minor_tick_line_dash_offset:0,major_label_standoff:5,major_label_orientation:"horizontal",major_label_text_font:"helvetica",major_label_text_font_size:"10pt",major_label_text_font_style:"normal",major_label_text_color:"#444444",major_label_text_alpha:1,major_label_text_align:"center",major_label_text_baseline:"alphabetic",axis_label_standoff:5,axis_label_text_font:"helvetica",axis_label_text_font_size:"16pt",axis_label_text_font_style:"normal",axis_label_text_color:"#444444",axis_label_text_alpha:1,axis_label_text_align:"center",axis_label_text_baseline:"alphabetic"})},e}(a.Model),e.exports={Model:o,View:i}},{"../../common/layout_box":"common/layout_box","../../common/logging":"common/logging","../../common/plot_widget":"common/plot_widget","../../common/properties":"common/properties","../renderers/guide_renderer":"models/renderers/guide_renderer",kiwi:"kiwi",underscore:"underscore"}],"models/axes/categorical_axis":[function(t,e,n){var r,o,i,s,a,l,u,h=function(t,e){function n(){this.constructor=t}for(var r in e)c.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},c={}.hasOwnProperty;l=t("underscore"),u=t("../../common/logging").logger,a=t("../tickers/categorical_ticker"),s=t("../formatters/categorical_tick_formatter"),r=t("./axis"),i=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return h(e,t),e}(r.View),o=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return h(e,t),e.prototype.default_view=i,e.prototype.type="CategoricalAxis",e.prototype.defaults=function(){return l.extend({},e.__super__.defaults.call(this),{ticker:new a.Model,formatter:new s.Model})},e.prototype._computed_bounds=function(){var t,e,n,r,o,i;return r=this.get("ranges"),e=r[0],t=r[1],i=null!=(o=this.get("bounds"))?o:"auto",n=[e.get("min"),e.get("max")],"auto"!==i&&u.warn("Categorical Axes only support user_bounds='auto', ignoring"),n},e}(r.Model),e.exports={Model:o,View:i}},{"../../common/logging":"common/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,n){var r,o,i=function(t,e){function n(){this.constructor=t}for(var r in e)s.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},s={}.hasOwnProperty;r=t("./axis"),o=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return i(e,t),e.prototype.type="ContinuousAxis",e}(r.Model),e.exports={Model:o}},{"./axis":"models/axes/axis"}],"models/axes/datetime_axis":[function(t,e,n){var r,o,i,s,a,l,u=function(t,e){function n(){this.constructor=t}for(var r in e)h.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},h={}.hasOwnProperty;l=t("underscore"),a=t("./axis"),s=t("../tickers/datetime_ticker"),i=t("../formatters/datetime_tick_formatter"),o=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return u(e,t),e}(a.View),r=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.prototype.defaults=function(){return l.extend({},e.__super__.defaults.call(this),{axis_label:"",ticker:new s.Model,formatter:new i.Model})},e}(a.Model),e.exports={Model:r,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,n){var r,o,i,s,a,l,u,h=function(t,e){function n(){this.constructor=t}for(var r in e)c.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},c={}.hasOwnProperty;u=t("underscore"),r=t("./axis"),s=t("./continuous_axis"),i=t("../tickers/basic_ticker"),o=t("../formatters/basic_tick_formatter"),l=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return h(e,t),e}(r.View),a=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return h(e,t),e.prototype.default_view=l,e.prototype.type="LinearAxis",e.prototype.defaults=function(){return u.extend({},e.__super__.defaults.call(this),{ticker:new i.Model,formatter: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,n){var r,o,i,s,a,l,u,h=function(t,e){function n(){this.constructor=t}for(var r in e)c.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},c={}.hasOwnProperty;u=t("underscore"),r=t("./axis"),o=t("./continuous_axis"),l=t("../tickers/log_ticker"),a=t("../formatters/log_tick_formatter"),s=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return h(e,t),e}(r.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="LogAxis",e.prototype.defaults=function(){return u.extend({},e.__super__.defaults.call(this),{ticker:new l.Model,formatter: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,n){var r,o,i,s=function(t,e){function n(){this.constructor=t}for(var r in e)a.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},a={}.hasOwnProperty,l=[].slice;i=t("underscore"),o=t("../../model"),r=function(e){function n(){return n.__super__.constructor.apply(this,arguments)}return s(n,e),n.prototype.type="CustomJS",n.prototype.initialize=function(t,e){return n.__super__.initialize.call(this,t,e),this.register_property("values",this._make_values,!0),this.add_dependencies("values",this,["args"]),this.register_property("func",this._make_func,!0),this.add_dependencies("func",this,["args","code"])},n.prototype.execute=function(e,n){return this.get("func").apply(null,l.call(this.get("values")).concat([e],[n],[t]))},n.prototype._make_values=function(){return i.values(this.get("args"))},n.prototype._make_func=function(){var e,n;return e=this.get("code"),e=function(){switch(this.get("lang")){case"javascript":return e;case"coffeescript":return n=t("coffee-script"),n.compile(e,{bare:!0,shiftLine:!0})}}.call(this),function(t,e,n){n.prototype=t.prototype;var r=new n,o=t.apply(r,e);return Object(o)===o?o:r}(Function,l.call(i.keys(this.get("args"))).concat(["cb_obj"],["cb_data"],["require"],[e]),function(){})},n.prototype.defaults=function(){return i.extend({},n.__super__.defaults.call(this),{args:{},code:"",lang:"javascript"})},n}(o),e.exports={Model:r}},{"../../model":"model","coffee-script":void 0,underscore:"underscore"}],"models/callbacks/open_url":[function(t,e,n){var r,o,i,s,a=function(t,e){function n(){this.constructor=t}for(var r in e)l.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},l={}.hasOwnProperty;s=t("underscore"),i=t("../../util/util"),r=t("../../model"),o=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return a(e,t),e.prototype.type="OpenURL",e.prototype.execute=function(t){var e,n,r,o,s;for(o=i.get_indices(t),n=0,r=o.length;r>n;n++)e=o[n],s=i.replace_placeholders(this.get("url"),t,e),window.open(s);return null},e.prototype.defaults=function(){return s.extend({},e.__super__.defaults.call(this),{url:"http://"})},e}(r),e.exports={Model:o}},{"../../model":"model","../../util/util":"util/util",underscore:"underscore"}],"models/component":[function(t,e,n){var r,o,i,s=function(t,e){function n(){this.constructor=t}for(var r in e)a.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},a={}.hasOwnProperty;i=t("underscore"),o=t("../model"),r=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return s(e,t),e.prototype.type="Component",e.prototype.defaults=function(){return i.extend({},e.__super__.defaults.call(this),{disabled:!1})},e}(o),e.exports={Model:r}},{"../model":"model",underscore:"underscore"}],"models/formatters/basic_tick_formatter":[function(t,e,n){var r,o,i,s=function(t,e){function n(){this.constructor=t}for(var r in e)a.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},a={}.hasOwnProperty;i=t("underscore"),o=t("./tick_formatter"),r=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return s(e,t),e.prototype.type="BasicTickFormatter",e.prototype.initialize=function(t,n){return e.__super__.initialize.call(this,t,n),this.register_property("scientific_limit_low",function(){return Math.pow(10,this.get("power_limit_low"))},!0),this.add_dependencies("scientific_limit_low",this,["power_limit_low"]),this.register_property("scientific_limit_high",function(){return Math.pow(10,this.get("power_limit_high"))},!0),this.add_dependencies("scientific_limit_high",this,["power_limit_high"]),this.last_precision=3},e.prototype.format=function(t){var e,n,r,o,s,a,l,u,h,c,p,_,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),c=!1,this.get("use_scientific"))for(r=0,l=t.length;l>r;r++)if(v=t[r],b=Math.abs(v),b>w&&(b>=this.get("scientific_limit_high")||b<=this.get("scientific_limit_low"))){c=!0;break}if(_=this.get("precision"),null==_||i.isNumber(_)){if(a=new Array(t.length),c)for(e=o=0,d=t.length;d>=0?d>o:o>d;e=d>=0?++o:--o)a[e]=t[e].toExponential(_||void 0);else for(e=s=0,f=t.length;f>=0?f>s:s>f;e=f>=0?++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;15>=m?15>=u:u>=15;x=15>=m?++u:--u){if(n=!0,c){for(e=h=0,g=t.length;g>=0?g>h:h>g;e=g>=0?++h:--h)if(a[e]=t[e].toExponential(x),e>0&&a[e]===a[e-1]){n=!1;break}if(n)break}else{for(e=p=0,y=t.length;y>=0?y>p:p>y;e=y>=0?++p:--p)if(a[e]=t[e].toFixed(x).replace(/(\.[0-9]*?)0+$/,"$1").replace(/\.$/,""),e>0&&a[e]===a[e-1]){n=!1;break}if(n)break}if(n)return this.last_precision=x,a}return a},e.prototype.defaults=function(){return i.extend({},e.__super__.defaults.call(this),{precision:"auto",use_scientific:!0,power_limit_high:5,power_limit_low:-3})},e}(o.Model),e.exports={Model:r}},{"./tick_formatter":"models/formatters/tick_formatter",underscore:"underscore"}],"models/formatters/categorical_tick_formatter":[function(t,e,n){var r,o,i=function(t,e){function n(){this.constructor=t}for(var r in e)s.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},s={}.hasOwnProperty;o=t("../formatters/tick_formatter"),r=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return i(e,t),e.prototype.type="CategoricalTickFormatter",e.prototype.format=function(t){return t},e}(o.Model),e.exports={Model:r}},{"../formatters/tick_formatter":"models/formatters/tick_formatter"}],"models/formatters/datetime_tick_formatter":[function(t,e,n){var r,o,i,s,a,l,u,h,c,p,_,d=function(t,e){function n(){this.constructor=t}for(var r in e)f.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},f={}.hasOwnProperty;s=t("underscore"),o=t("sprintf"),_=t("timezone"),i=t("./tick_formatter"),p=t("../../common/logging").logger,c=function(t){return Math.round(t/1e3%1*1e6)},h=function(t){var e,n;return e=new Date(t),n=e.getFullYear(),e.getMonth()>=7&&(n+=1),o.sprintf("'%02d",n%100)},l=function(t){var e,n;return e=new Date(t),n=e.getFullYear(),e.getMonth()>=7&&(n+=1),o.sprintf("%d",n)},a=function(t){return _(t,"%Y %m %d %H %M %S").split(/\s+/).map(function(t){return parseInt(t,10)})},u=function(t,e){var n;return s.isFunction(e)?e(t):(n=o.sprintf("$1%06d",c(t)),e=e.replace(/((^|[^%])(%%)*)%f/,n),-1===e.indexOf("%")?e:_(t,e))},r=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return d(e,t),e.prototype.type="DatetimeTickFormatter",e.prototype.format_order=["microseconds","milliseconds","seconds","minsec","minutes","hourmin","hours","days","months","years"],e.prototype._formats={microseconds:["%fus"],milliseconds:["%3Nms","%S.%3Ns"],seconds:["%Ss"],minsec:[":%M:%S"],minutes:[":%M","%Mm"],hourmin:["%H:%M"],hours:["%Hh","%H:%M"],days:["%m/%d","%a%d"],months:["%m/%Y","%b%y"],years:["%Y",h,l]},e.prototype.strip_leading_zeros=!0,e.prototype.initialize=function(t,n){var r,o,i,a,l,h,c,p;e.__super__.initialize.call(this,t,n),r=s.extend({},this._formats,this.get("formats")),l=_(new Date),this.formats={},h=[];for(o in r)a=r[o],c=function(){var t,e,n;for(n=[],t=0,e=a.length;e>t;t++)i=a[t],n.push(u(l,i).length);return n}(),p=s.sortBy(s.zip(c,a),function(t){var e,n;return n=t[0],e=t[1],n}),h.push(this.formats[o]=s.zip.apply(s,p));return h},e.prototype._get_resolution_str=function(t,e){var n,r;return n=1.1*t,r=.001>n?"microseconds":1>n?"milliseconds":60>n?e>=60?"minsec":"seconds":3600>n?e>=3600?"hourmin":"minutes":86400>n?"hours":2678400>n?"days":31536e3>n?"months":"years"},e.prototype.format=function(t,e,n,r,o){var i,l,h,c,_,d,f,m,g,y,v,b,x,w,k,M,j,T,z,E,P,S,C,A,O,N,q,F,D;if(null==e&&(e=null),null==n&&(n=null),null==r&&(r=.3),null==o&&(o=null),0===t.length)return[];if(A=Math.abs(t[t.length-1]-t[0])/1e3,j=o?o.resolution:A/(t.length-1),P=this._get_resolution_str(j,A),T=this.formats[P],D=T[0],_=T[1],c=_[0],n){for(d=[],m=g=0,z=D.length;z>=0?z>g:g>z;m=z>=0?++g:--g)D[m]*t.length<r*n&&d.push(this.formats[m]);d.length>0&&(c=s.last(d))}for(b=[],S=this.format_order.indexOf(P),q={},E=this.format_order,y=0,x=E.length;x>y;y++)h=E[y],q[h]=0;for(q.seconds=5,q.minsec=4,q.minutes=4,q.hourmin=3,q.hours=3,v=0,w=t.length;w>v;v++){N=t[v];try{F=a(N),C=u(N,c)}catch(l){i=l,p.warn("unable to format tick for timestamp value "+N),p.warn(" - "+i),b.push("ERR");continue}for(f=!1,M=S;0===F[q[this.format_order[M]]]&&(M+=1,M!==this.format_order.length);){if(("minsec"===P||"hourmin"===P)&&!f){if("minsec"===P&&0===F[4]&&0!==F[5]||"hourmin"===P&&0===F[3]&&0!==F[4]){k=this.formats[this.format_order[S-1]][1][0],C=u(N,k);break}f=!0}k=this.formats[this.format_order[M]][1][0],C=u(N,k)}this.strip_leading_zeros?(O=C.replace(/^0+/g,""),O!==C&&isNaN(parseInt(O))&&(O="0"+O),b.push(O)):b.push(C)}return b},e.prototype.defaults=function(){return s.extend({},e.__super__.defaults.call(this),{formats:{}})},e}(i.Model),e.exports={Model:r}},{"../../common/logging":"common/logging","./tick_formatter":"models/formatters/tick_formatter",sprintf:"sprintf",timezone:"timezone/index",underscore:"underscore"}],"models/formatters/log_tick_formatter":[function(t,e,n){var r,o,i,s,a,l=function(t,e){function n(){this.constructor=t}for(var r in e)u.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},u={}.hasOwnProperty;s=t("underscore"),a=t("../../common/logging").logger,i=t("./tick_formatter"),r=t("./basic_tick_formatter"),o=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return l(e,t),e.prototype.type="LogTickFormatter",e.prototype.defaults=function(){return s.extend({},e.__super__.defaults.call(this),{ticker:null})},e.prototype.initialize=function(t,n){return e.__super__.initialize.call(this,t,n),this.basic_formatter=new r.Model,null==this.get("ticker")?a.warn("LogTickFormatter not configured with a ticker, using default base of 10 (labels will be incorrect if ticker base is not 10)"):void 0},e.prototype.format=function(t){var e,n,r,o,i,s;if(0===t.length)return[];for(e=null!=this.get("ticker")?this.get("ticker").get("base"):10,s=!1,o=new Array(t.length),n=r=0,i=t.length;i>=0?i>r:r>i;n=i>=0?++r:--r)if(o[n]=e+"^"+Math.round(Math.log(t[n])/Math.log(e)),n>0&&o[n]===o[n-1]){s=!0;break}return s&&(o=this.basic_formatter.format(t)),o},e}(i.Model),e.exports={Model:o}},{"../../common/logging":"common/logging","./basic_tick_formatter":"models/formatters/basic_tick_formatter","./tick_formatter":"models/formatters/tick_formatter",underscore:"underscore"}],"models/formatters/numeral_tick_formatter":[function(t,e,n){var r,o,i,s,a=function(t,e){function n(){this.constructor=t}for(var r in e)l.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},l={}.hasOwnProperty;s=t("underscore"),r=t("numeral"),i=t("./tick_formatter"),o=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return a(e,t),e.prototype.type="NumeralTickFormatter",e.prototype.format=function(t){var e,n,o,i,s;return e=this.get("format"),o=this.get("language"),i=function(){switch(this.get("rounding")){case"round":case"nearest":return Math.round;case"floor":case"rounddown":return Math.floor;case"ceil":case"roundup":return Math.ceil}}.call(this),n=function(){var n,a,l;for(l=[],n=0,a=t.length;a>n;n++)s=t[n],l.push(r.format(s,e,o,i));return l}()},e.prototype.defaults=function(){return s.extend({},e.__super__.defaults.call(this),{format:"0,0",language:"en",rounding:"round"})},e}(i.Model),e.exports={Model:o}},{"./tick_formatter":"models/formatters/tick_formatter",numeral:"numeral",underscore:"underscore"}],"models/formatters/printf_tick_formatter":[function(t,e,n){var r,o,i,s,a=function(t,e){function n(){this.constructor=t}for(var r in e)l.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},l={}.hasOwnProperty;s=t("underscore"),o=t("sprintf"),i=t("./tick_formatter"),r=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return a(e,t),e.prototype.type="PrintfTickFormatter",e.prototype.format=function(t){var e,n,r;return e=this.get("format"),n=function(){var n,i,s;for(s=[],n=0,i=t.length;i>n;n++)r=t[n],s.push(o.sprintf(e,r));return s}()},e.prototype.defaults=function(){return s.extend({},e.__super__.defaults.call(this),{format:"%s"})},e}(i.Model),e.exports={Model:r}},{"./tick_formatter":"models/formatters/tick_formatter",sprintf:"sprintf",underscore:"underscore"}],"models/formatters/tick_formatter":[function(t,e,n){
|
|
var r,o,i,s=function(t,e){function n(){this.constructor=t}for(var r in e)a.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},a={}.hasOwnProperty;i=t("underscore"),r=t("../../model"),o=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return s(e,t),e.prototype.type="TickFormatter",e}(r),e.exports={Model:o}},{"../../model":"model",underscore:"underscore"}],"models/glyphs/annular_wedge":[function(t,e,n){var r,o,i,s,a,l,u=function(t,e){function n(){this.constructor=t}for(var r in e)h.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},h={}.hasOwnProperty;s=t("underscore"),l=t("../../common/mathutils"),i=t("./glyph"),a=t("../../common/hittest"),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,n,r;for("data"===this.distances.inner_radius.units?this.sinner_radius=this.sdist(this.renderer.xmapper,this.x,this.inner_radius):this.sinner_radius=this.inner_radius,"data"===this.distances.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),r=[],t=e=0,n=this.start_angle.length;n>=0?n>e:e>n;t=n>=0?++e:--e)r.push(this.angle[t]=this.end_angle[t]-this.start_angle[t]);return r},e.prototype._render=function(t,e,n){var r,o,i,s,a,l,u,h,c,p,_;for(p=n.sx,_=n.sy,c=n.start_angle,r=n.angle,u=n.sinner_radius,h=n.souter_radius,o=n.direction,l=[],s=0,a=e.length;a>s;s++)i=e[s],isNaN(p[i]+_[i]+u[i]+h[i]+c[i]+r[i]+o[i])||(t.translate(p[i],_[i]),t.rotate(this.start_angle[i]),t.moveTo(h[i],0),t.beginPath(),t.arc(0,0,h[i],0,r[i],o[i]),t.rotate(this.angle[i]),t.lineTo(u[i],0),t.arc(0,0,u[i],0,-r[i],!o[i]),t.closePath(),t.rotate(-r[i]-c[i]),t.translate(-p[i],-_[i]),this.visuals.fill.do_fill&&(this.visuals.fill.set_vectorize(t,i),t.fill()),this.visuals.line.do_stroke?(this.visuals.line.set_vectorize(t,i),l.push(t.stroke())):l.push(void 0));return l},e.prototype._hit_point=function(t){var e,n,r,o,i,u,h,c,p,_,d,f,m,g,y,v,b,x,w,k,M,j,T,z,E,P,S,C,A,O,N,q,F,D,I,R;for(m=[t.vx,t.vy],E=m[0],C=m[1],N=this.renderer.xmapper.map_from_target(E,!0),D=this.renderer.ymapper.map_from_target(C,!0),"data"===this.distances.outer_radius.units?(q=N-this.max_outer_radius,F=N+this.max_outer_radius,I=D-this.max_outer_radius,R=D+this.max_outer_radius):(P=E-this.max_outer_radius,S=E+this.max_outer_radius,g=this.renderer.xmapper.v_map_from_target([P,S],!0),q=g[0],F=g[1],A=C-this.max_outer_radius,O=C+this.max_outer_radius,y=this.renderer.ymapper.v_map_from_target([A,O],!0),I=y[0],R=y[1]),n=[],v=function(){var t,e,n,r;for(n=this.index.search([q,I,F,R]),r=[],t=0,e=n.length;e>t;t++)f=n[t],r.push(f[4].i);return r}.call(this),h=0,p=v.length;p>h;h++)i=v[h],d=Math.pow(this.souter_radius[i],2),u=Math.pow(this.sinner_radius[i],2),k=this.renderer.xmapper.map_to_target(N,!0),M=this.renderer.xmapper.map_to_target(this.x[i],!0),T=this.renderer.ymapper.map_to_target(D,!0),z=this.renderer.ymapper.map_to_target(this.y[i],!0),r=Math.pow(k-M,2)+Math.pow(T-z,2),d>=r&&r>=u&&n.push([i,r]);for(o=[],c=0,_=n.length;_>c;c++)b=n[c],i=b[0],r=b[1],w=this.renderer.plot_view.canvas.vx_to_sx(E),j=this.renderer.plot_view.canvas.vy_to_sy(C),e=Math.atan2(j-this.sy[i],w-this.sx[i]),l.angle_between(-e,-this.start_angle[i],-this.end_angle[i],this.direction[i])&&o.push([i,r]);return x=a.create_hit_test_result(),x["1d"].indices=s.chain(o).sortBy(function(t){return t[1]}).map(function(t){return t[0]}).value(),x},e.prototype.draw_legend=function(t,e,n,r,o){return this._generic_area_legend(t,e,n,r,o)},e}(i.View),r=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return u(e,t),e.prototype.default_view=o,e.prototype.type="AnnularWedge",e.prototype.distances=["inner_radius","outer_radius"],e.prototype.angles=["start_angle","end_angle"],e.prototype.fields=["direction:direction"],e.prototype.defaults=function(){return s.extend({},e.__super__.defaults.call(this),{direction:"anticlock"})},e}(i.Model),e.exports={Model:r,View:o}},{"../../common/hittest":"common/hittest","../../common/mathutils":"common/mathutils","./glyph":"models/glyphs/glyph",underscore:"underscore"}],"models/glyphs/annulus":[function(t,e,n){var r,o,i,s,a,l=function(t,e){function n(){this.constructor=t}for(var r in e)u.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},u={}.hasOwnProperty;s=t("underscore"),i=t("./glyph"),a=t("../../common/hittest"),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.distances.inner_radius.units?this.sinner_radius=this.sdist(this.renderer.xmapper,this.x,this.inner_radius):this.sinner_radius=this.inner_radius,"data"===this.distances.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,n){var r,o,i,s,a,l,u,h,c,p,_,d,f;for(d=n.sx,f=n.sy,p=n.sinner_radius,_=n.souter_radius,c=[],s=0,l=e.length;l>s;s++)if(o=e[s],!isNaN(d[o]+f[o]+p[o]+_[o])){if(i=navigator.userAgent.indexOf("MSIE")>=0||navigator.userAgent.indexOf("Trident")>0||navigator.userAgent.indexOf("Edge")>0,this.visuals.fill.do_fill){if(this.visuals.fill.set_vectorize(t,o),t.beginPath(),i)for(h=[!1,!0],a=0,u=h.length;u>a;a++)r=h[a],t.arc(d[o],f[o],p[o],0,Math.PI,r),t.arc(d[o],f[o],_[o],Math.PI,0,!r);else t.arc(d[o],f[o],p[o],0,2*Math.PI,!0),t.arc(d[o],f[o],_[o],2*Math.PI,0,!1);t.fill()}this.visuals.line.do_stroke?(this.visuals.line.set_vectorize(t,o),t.beginPath(),t.arc(d[o],f[o],p[o],0,2*Math.PI),t.moveTo(d[o]+_[o],f[o]),t.arc(d[o],f[o],_[o],0,2*Math.PI),c.push(t.stroke())):c.push(void 0)}return c},e.prototype._hit_point=function(t){var e,n,r,o,i,l,u,h,c,p,_,d,f,m,g,y,v,b,x,w,k,M,j;for(c=[t.vx,t.vy],y=c[0],v=c[1],b=this.renderer.xmapper.map_from_target(y,!0),x=b-this.max_radius,w=b+this.max_radius,k=this.renderer.ymapper.map_from_target(v,!0),M=k-this.max_radius,j=k+this.max_radius,n=[],p=function(){var t,e,n,r;for(n=this.index.search([x,M,w,j]),r=[],t=0,e=n.length;e>t;t++)h=n[t],r.push(h[4].i);return r}.call(this),i=0,l=p.length;l>i;i++)r=p[i],u=Math.pow(this.souter_radius[r],2),o=Math.pow(this.sinner_radius[r],2),d=this.renderer.xmapper.map_to_target(b),f=this.renderer.xmapper.map_to_target(this.x[r]),m=this.renderer.ymapper.map_to_target(k),g=this.renderer.ymapper.map_to_target(this.y[r]),e=Math.pow(d-f,2)+Math.pow(m-g,2),u>=e&&e>=o&&n.push([r,e]);return _=a.create_hit_test_result(),_["1d"].indices=s.chain(n).sortBy(function(t){return t[1]}).map(function(t){return t[0]}).value(),_},e.prototype.draw_legend=function(t,e,n,r,o){var i,s,a,l,u,h,c,p,_;return u=null!=(l=this.get_reference_point())?l:0,s=[u],p={},p[u]=(e+n)/2,_={},_[u]=(r+o)/2,a=.5*Math.min(Math.abs(n-e),Math.abs(o-r)),h={},h[u]=.4*a,c={},c[u]=.8*a,i={sx:p,sy:_,sinner_radius:h,souter_radius:c},this._render(t,s,i)},e}(i.View),r=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return l(e,t),e.prototype.default_view=o,e.prototype.type="Annulus",e.prototype.distances=["inner_radius","outer_radius"],e}(i.Model),e.exports={Model:r,View:o}},{"../../common/hittest":"common/hittest","./glyph":"models/glyphs/glyph",underscore:"underscore"}],"models/glyphs/arc":[function(t,e,n){var r,o,i,s,a=function(t,e){function n(){this.constructor=t}for(var r in e)l.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},l={}.hasOwnProperty;s=t("underscore"),i=t("./glyph"),o=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._map_data=function(){return"data"===this.distances.radius.units?this.sradius=this.sdist(this.renderer.xmapper,this.x,this.radius):this.sradius=this.radius},e.prototype._render=function(t,e,n){var r,o,i,s,a,l,u,h,c,p;if(c=n.sx,p=n.sy,u=n.sradius,h=n.start_angle,o=n.end_angle,r=n.direction,this.visuals.line.do_stroke){for(l=[],s=0,a=e.length;a>s;s++)i=e[s],isNaN(c[i]+p[i]+u[i]+h[i]+o[i]+r[i])||(t.beginPath(),t.arc(c[i],p[i],u[i],h[i],o[i],r[i]),this.visuals.line.set_vectorize(t,i),l.push(t.stroke()));return l}},e.prototype.draw_legend=function(t,e,n,r,o){return this._generic_line_legend(t,e,n,r,o)},e}(i.View),r=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return a(e,t),e.prototype.default_view=o,e.prototype.type="Arc",e.prototype.visuals=["line"],e.prototype.distances=["radius"],e.prototype.angles=["start_angle","end_angle"],e.prototype.fields=["direction:direction"],e.prototype.defaults=function(){return s.extend({},e.__super__.defaults.call(this),{direction:"anticlock"})},e}(i.Model),e.exports={Model:r,View:o}},{"./glyph":"models/glyphs/glyph",underscore:"underscore"}],"models/glyphs/bezier":[function(t,e,n){var r,o,i,s,a,l,u=function(t,e){function n(){this.constructor=t}for(var r in e)h.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},h={}.hasOwnProperty;s=t("underscore"),l=t("rbush"),i=t("./glyph"),a=function(t,e,n,r,o,i,s,a){var l,u,h,c,p,_,d,f,m,g,y,v,b,x,w,k,M;for(w=[],c=[[],[]],_=m=0;2>=m;_=++m)if(0===_?(u=6*t-12*n+6*o,l=-3*t+9*n-9*o+3*s,p=3*n-3*t):(u=6*e-12*r+6*i,l=-3*e+9*r-9*i+3*a,p=3*r-3*e),Math.abs(l)<1e-12){if(Math.abs(u)<1e-12)continue;v=-p/u,v>0&&1>v&&w.push(v)}else h=u*u-4*p*l,y=Math.sqrt(h),0>h||(b=(-u+y)/(2*l),b>0&&1>b&&w.push(b),x=(-u-y)/(2*l),x>0&&1>x&&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*n+3*g*v*v*o+v*v*v*s,c[0][d]=k,M=g*g*g*e+3*g*g*v*r+3*g*v*v*i+v*v*v*a,c[1][d]=M;return c[0][f]=t,c[1][f]=e,c[0][f+1]=s,c[1][f+1]=a,[Math.min.apply(null,c[0]),Math.max.apply(null,c[1]),Math.max.apply(null,c[0]),Math.min.apply(null,c[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,n,r,o,i,s,u,h,c;for(e=l(),r=[],t=n=0,o=this.x0.length;o>=0?o>n:n>o;t=o>=0?++n:--n)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],h=i[1],u=i[2],c=i[3],r.push([s,h,u,c,{i:t}]));return e.load(r),e},e.prototype._render=function(t,e,n){var r,o,i,s,a,l,u,h,c,p,_,d,f;if(p=n.sx0,d=n.sy0,_=n.sx1,f=n.sy1,a=n.scx,l=n.scx0,h=n.scy0,u=n.scx1,c=n.scy1,this.visuals.line.do_stroke){for(s=[],o=0,i=e.length;i>o;o++)r=e[o],isNaN(p[r]+d[r]+_[r]+f[r]+l[r]+h[r]+u[r]+c[r])||(t.beginPath(),t.moveTo(p[r],d[r]),t.bezierCurveTo(l[r],h[r],u[r],c[r],_[r],f[r]),this.visuals.line.set_vectorize(t,r),s.push(t.stroke()));return s}},e.prototype.draw_legend=function(t,e,n,r,o){return this._generic_line_legend(t,e,n,r,o)},e}(i.View),r=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.prototype.visuals=["line"],e.prototype.coords=[["x0","y0"],["x1","y1"],["cx0","cy0"],["cx1","cy1"]],e}(i.Model),e.exports={Model:r,View:o}},{"./glyph":"models/glyphs/glyph",rbush:"rbush",underscore:"underscore"}],"models/glyphs/bokehgl":[function(t,e,n){var r,o,i,s,a,l,u,h,c,p,_,d,f,m,g=function(t,e){function n(){this.constructor=t}for(var r in e)y.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},y={}.hasOwnProperty;f=t("gloo2"),c=t("../../common/color"),p=c.color2rgba,m=function(t){return 2>t&&(t=Math.sqrt(2*t)),t},_=function(t,e){var n,r,o,i;for(n=new Float32Array(t),r=o=0,i=t;i>=0?i>o:o>i;r=i>=0?++o:--o)n[r]=e;return n},d=function(t,e,n){var r,o,i,s,a,l,u;for(r=new Float32Array(t*e),o=s=0,l=t;l>=0?l>s:s>l;o=l>=0?++s:--s)for(i=a=0,u=e;u>=0?u>a:a>u;i=u>=0?++a:--a)r[o*e+i]=n[i];return r},h=function(t,e,n,r,o,i){var s;return e.used=!0,null!=o[i].fixed_value?(t.set_attribute(n,"float",null,o[i].fixed_value),e.used=!1):(s=new Float32Array(o.cache[i+"_array"]),e.set_size(4*r),e.set_data(0,s),t.set_attribute(n,"float",[e,0,0])),s},u=function(t,e,n,r,o){var i,s,a,l,u,h,c,d,f,m,g;if(c=4,e.used=!0,null!=o.color.fixed_value&&null!=o.alpha.fixed_value)g=p(o.color.fixed_value,o.alpha.fixed_value),t.set_attribute(n,"vec4",null,g),e.used=!1;else{for(a=null!=o.color.fixed_value?function(){var t,e,n;for(n=[],l=t=0,e=r;e>=0?e>t:t>e;l=e>=0?++t:--t)n.push(o.color.fixed_value);return n}():o.cache.color_array,s=null!=o.alpha.fixed_value?_(r,o.alpha.fixed_value):o.cache.alpha_array,i=new Float32Array(r*c),l=h=0,f=r;f>=0?f>h:h>f;l=f>=0?++h:--h)for(g=p(a[l],s[l]),u=d=0,m=c;m>=0?m>d:d>m;u=m>=0?++d:--d)i[l*c+u]=g[u];e.set_size(r*c*4),e.set_data(0,i),t.set_attribute(n,"vec4",[e,0,0])}return i},i=function(){function t(t){this._atlas={},this._index=0,this._width=256,this._height=256,this.tex=new f.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.get_atlas_data([1])}return t.prototype.get_atlas_data=function(t){var e,n,r,o,i,s;return r=t.join("-"),n=this._atlas[r],void 0===n&&(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,n,r;for(r=[],t=0,n=e.length;n>t;t++)s=e[t],r.push(s+10);return r}())),this._atlas[r]=[this._index/this._height,o],this._index+=1),this._atlas[r]},t.prototype.make_pattern=function(t){var e,n,r,o,i,s,a,l,u,h,c,p,_,d,f,m,g,y,v,b,x,w,k,M,j;for(t.length>1&&t.length%2&&(t=t.concat(t)),m=0,p=0,_=t.length;_>p;p++)w=t[p],m+=w;for(e=[],i=0,u=f=0,v=t.length+2;v>f;u=f+=2)r=Math.max(1e-4,t[u%t.length]),o=Math.max(1e-4,t[(u+1)%t.length]),e.push.apply(e,[i,i+r]),i+=r+o;for(d=this._width,n=new Float32Array(4*d),u=g=0,b=d;b>=0?b>g:g>b;u=b>=0?++g:--g){for(j=m*u/(d-1),h=0,M=1e16,c=y=0,x=e.length;x>=0?x>y:y>x;c=x>=0?++y:--y)k=Math.abs(e[c]-j),M>k&&(h=c,M=k);h%2===0?(l=j<=e[h]?1:0,a=e[h],s=e[h+1]):(l=j>e[h]?-1:0,a=e[h-1],s=e[h]),n[4*u+0]=e[h],n[4*u+1]=l,n[4*u+2]=a,n[4*u+3]=s}return[n,m]},t}(),r=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}(),s=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return g(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 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(1.25*u_antialias+v_linewidth)/2.0;\n \n vec2 position = a_position * 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) + (u_offset - vec2(0.5, 0.5));\n normpos /= u_canvas_size; // 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 )\n{\n float d = 0.0;\n dx = abs(dx);\n dy = abs(dy);\n \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 miter_limit, in float linewidth )\n{\n float dx = texcoord.x;\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 // Miter limit\n if( (dx < segment.x) || (dx > segment.y) ) {\n d = max(d, min(abs(miter.x),abs(miter.y)) - miter_limit*linewidth/2.0 );\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 // 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 );\n }\n else if( (!closed) && (dx > line_stop) ) {\n d = cap( int(u_linecaps.y), abs(dx)-line_stop, abs(dy), t );\n }\n else {\n d = join( int(u_linejoin), abs(dy), v_segment, v_texcoord, v_miter, u_miter_limit, 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, u_miter_limit, 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);\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);\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);\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);\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 }\n else {\n d /= u_antialias;\n gl_FragColor = vec4(color.xyz, exp(-d*d)*color.a);\n }\n}",
|
|
e.prototype.init=function(){var t;return t=this.gl,this._scale_aspect=0,this.prog=new f.Program(t),this.prog.set_shaders(this.VERT,this.FRAG),this.index_buffer=new f.IndexBuffer(t),this.vbo_position=new f.VertexBuffer(t),this.vbo_tangents=new f.VertexBuffer(t),this.vbo_segment=new f.VertexBuffer(t),this.vbo_angles=new f.VertexBuffer(t),this.vbo_texcoord=new f.VertexBuffer(t),this.dash_atlas=new i(t)},e.prototype.draw=function(t,e,n){var r,o,i,s,a,l,u,h,c,p,_,d,f,m,g,y,v,b;if(this.data_changed&&(this._set_data(),this.data_changed=!1),this.visuals_changed&&(this._set_visuals(),this.visuals_changed=!1),g=n.sx,y=n.sy,m=Math.sqrt(g*g+y*y),g/=m,y/=m,Math.abs(this._scale_aspect-y/g)>Math.abs(.001*this._scale_aspect)&&(this._update_scale(g,y),this._scale_aspect=y/g),this.prog.set_attribute("a_position","vec2",[e.glglyph.vbo_position,0,0]),this.prog.set_attribute("a_tangents","vec4",[e.glglyph.vbo_tangents,0,0]),this.prog.set_attribute("a_segment","vec2",[e.glglyph.vbo_segment,0,0]),this.prog.set_attribute("a_angles","vec2",[e.glglyph.vbo_angles,0,0]),this.prog.set_attribute("a_texcoord","vec2",[e.glglyph.vbo_texcoord,0,0]),this.prog.set_uniform("u_length","float",[e.glglyph.cumsum]),this.prog.set_texture("u_dash_atlas",this.dash_atlas.tex),this.prog.set_uniform("u_canvas_size","vec2",[n.width,n.height]),this.prog.set_uniform("u_offset","vec2",[n.dx[0],n.dy[0]]),this.prog.set_uniform("u_scale_aspect","vec2",[g,y]),this.prog.set_uniform("u_scale_length","float",[m]),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,l=this.I_triangles.length,i=64008,o=[],s=a=0,p=Math.ceil(l/i);p>=0?p>a:a>p;s=p>=0?++a:--a)o.push([]);for(s=h=0,_=t.length;_>=0?_>h:h>_;s=_>=0?++h:--h)b=t[s]%i,r=Math.floor(t[s]/i),o[r].push(b);for(f=[],r=c=0,d=o.length;d>=0?d>c:c>d;r=d>=0?++c:--c)v=new Uint16Array(o[r]),u=r*i*4,0!==v.length&&(this.prog.set_attribute("a_position","vec2",[e.glglyph.vbo_position,0,2*u]),this.prog.set_attribute("a_tangents","vec4",[e.glglyph.vbo_tangents,0,4*u]),this.prog.set_attribute("a_segment","vec2",[e.glglyph.vbo_segment,0,2*u]),this.prog.set_attribute("a_angles","vec2",[e.glglyph.vbo_angles,0,2*u]),this.prog.set_attribute("a_texcoord","vec2",[e.glglyph.vbo_texcoord,0,2*u]),this.index_buffer.set_size(2*v.length),this.index_buffer.set_data(0,v),f.push(this.prog.draw(this.gl.TRIANGLES,this.index_buffer)));return f},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,n,r,o,i;return window.X=this,c=p(this.glyph.visuals.line.color.value(),this.glyph.visuals.line.alpha.value()),t=this.CAPS[this.glyph.visuals.line.cap.value()],o=this.JOINS[this.glyph.visuals.line.join.value()],this.prog.set_uniform("u_color","vec4",c),this.prog.set_uniform("u_linewidth","float",[this.glyph.visuals.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",[o]),this.prog.set_uniform("u_miter_limit","float",[10]),n=this.glyph.visuals.line.dash.value(),e=0,r=1,n.length&&(i=this.dash_atlas.get_atlas_data(n),e=i[0],r=i[1]),this.prog.set_uniform("u_dash_index","float",[e]),this.prog.set_uniform("u_dash_phase","float",[this.glyph.visuals.line.dash_offset.value()]),this.prog.set_uniform("u_dash_period","float",[r]),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,n,r,o,i,s,a,l,u,h,c,p,_,d,f,m,g,y,v,b,x,w,k,M,j,T,z,E,P,S,C,A,O,N,q,F,D,I,R,B,L;for(w=this.nvertices,_=new Float32Array(this.glyph.x),d=new Float32Array(this.glyph.y),i=c=new Float32Array(2*w),r=new Float32Array(2*w),a=p=new Float32Array(4*w),u=new Float32Array(2*w),g=b=0,E=w;E>=0?E>b:b>E;g=E>=0?++b:--b)i[2*g+0]=_[g],i[2*g+1]=d[g];for(this.tangents=n=new Float32Array(2*w-2),g=j=0,P=w-1;P>=0?P>j:j>P;g=P>=0?++j:--j)n[2*g+0]=c[2*(g+1)+0]-c[2*g+0],n[2*g+1]=c[2*(g+1)+1]-c[2*g+1];for(g=T=0,S=w-1;S>=0?S>T:T>S;g=S>=0?++T:--T)a[4*(g+1)+0]=n[2*g+0],a[4*(g+1)+1]=n[2*g+1],a[4*g+2]=n[2*g+0],a[4*g+3]=n[2*g+1];for(a[0]=n[0],a[1]=n[1],a[4*(w-1)+2]=n[2*(w-2)+0],a[4*(w-1)+3]=n[2*(w-2)+1],t=new Float32Array(w),g=z=0,C=w;C>=0?C>z:z>C;g=C>=0?++z:--z)t[g]=Math.atan2(p[4*g+0]*p[4*g+3]-p[4*g+1]*p[4*g+2],p[4*g+0]*p[4*g+2]+p[4*g+1]*p[4*g+3]);for(g=D=0,A=w-1;A>=0?A>D:D>A;g=A>=0?++D:--D)r[2*g+0]=t[g],r[2*g+1]=t[g+1];for(x=4*w-4,this.V_position=s=new Float32Array(2*x),this.V_angles=o=new Float32Array(2*x),this.V_tangents=l=new Float32Array(4*x),this.V_texcoord=h=new Float32Array(2*x),M=2,g=I=0,O=w;O>=0?O>I:I>O;g=O>=0?++I:--I)for(y=R=0;4>R;y=++R){for(v=B=0;2>B;v=++B)s[2*(4*g+y-M)+v]=i[2*g+v],o[2*(4*g+y)+v]=r[2*g+v];for(v=L=0;4>L;v=++L)l[4*(4*g+y-M)+v]=a[4*g+v]}for(g=f=0,N=w;N>=0?N>=f:f>=N;g=N>=0?++f:--f)h[2*(4*g+0)+0]=-1,h[2*(4*g+1)+0]=-1,h[2*(4*g+2)+0]=1,h[2*(4*g+3)+0]=1,h[2*(4*g+0)+1]=-1,h[2*(4*g+1)+1]=1,h[2*(4*g+2)+1]=-1,h[2*(4*g+3)+1]=1;for(k=6*(w-1),this.I_triangles=e=new Uint32Array(k),F=[],g=m=0,q=w;q>=0?q>m:m>q;g=q>=0?++m:--m)e[6*g+0]=0+4*g,e[6*g+1]=1+4*g,e[6*g+2]=3+4*g,e[6*g+3]=2+4*g,e[6*g+4]=0+4*g,F.push(e[6*g+5]=3+4*g);return F},e.prototype._update_scale=function(t,e){var n,r,o,i,s,a,l,u,h,c,p,_,d,f,m,g,y,v;for(p=this.nvertices,c=4*p-4,r=this.tangents,n=new Float32Array(p-1),o=new Float32Array(2*p),this.V_segment=i=new Float32Array(2*c),a=h=0,m=p-1;m>=0?m>h:h>m;a=m>=0?++h:--h)n[a]=Math.sqrt(Math.pow(r[2*a+0]*t,2)+Math.pow(r[2*a+1]*e,2));for(s=0,a=_=0,g=p-1;g>=0?g>_:_>g;a=g>=0?++_:--_)s+=n[a],o[2*(a+1)+0]=s,o[2*a+1]=s;for(a=d=0,y=p;y>=0?y>d:d>y;a=y>=0?++d:--d)for(l=f=0;4>f;l=++f)for(u=v=0;2>v;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}(r),a=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return g(e,t),e.prototype.VERT="precision mediump float;\nconst float SQRT_2 = 1.4142135623730951;\n//\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;\n v_linewidth = a_linewidth;\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_scale + u_offset - vec2(0.5, 0.5); // in pixels\n pos /= u_canvas_size; // 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 * (a_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 f.Program(e),this.prog.set_shaders(this.VERT,t),this.vbo_x=new f.VertexBuffer(e),this.prog.set_attribute("a_x","float",[this.vbo_x,0,0]),this.vbo_y=new f.VertexBuffer(e),this.prog.set_attribute("a_y","float",[this.vbo_y,0,0]),this.vbo_s=new f.VertexBuffer(e),this.prog.set_attribute("a_size","float",[this.vbo_s,0,0]),this.vbo_a=new f.VertexBuffer(e),this.prog.set_attribute("a_angle","float",[this.vbo_a,0,0]),this.vbo_linewidth=new f.VertexBuffer(e),this.vbo_fg_color=new f.VertexBuffer(e),this.vbo_bg_color=new f.VertexBuffer(e),this.index_buffer=new f.IndexBuffer(e)},e.prototype.draw=function(t,e,n){var r,o,i,s,a,l,u,h,c,p,_,d,f,m,g,y;if(l=e.glglyph.nvertices,this.data_changed?(this._set_data(l),this.data_changed=!1):null==this.glyph.radius||n.sx===this.last_trans.sx&&n.sy===this.last_trans.sy||(this.last_trans=n,this.vbo_s.set_data(0,new Float32Array(function(){var t,e,n,r;for(n=this.glyph.sradius,r=[],t=0,e=n.length;e>t;t++)m=n[t],r.push(2*m);return r}.call(this)))),this.visuals_changed&&(this._set_visuals(l),this.visuals_changed=!1),this.prog.set_uniform("u_canvas_size","vec2",[n.width,n.height]),this.prog.set_uniform("u_offset","vec2",[n.dx[0],n.dy[0]]),this.prog.set_uniform("u_scale","vec2",[n.sx,n.sy]),this.prog.set_attribute("a_x","float",[e.glglyph.vbo_x,0,0]),this.prog.set_attribute("a_y","float",[e.glglyph.vbo_y,0,0]),this.prog.set_attribute("a_size","float",[e.glglyph.vbo_s,0,0]),this.prog.set_attribute("a_angle","float",[e.glglyph.vbo_a,0,0]),0!==t.length){if(t.length===l)return this.prog.draw(this.gl.POINTS,[0,l]);if(65535>l)return 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(i=64e3,o=[],s=a=0,p=Math.ceil(l/i);p>=0?p>a:a>p;s=p>=0?++a:--a)o.push([]);for(s=h=0,_=t.length;_>=0?_>h:h>_;s=_>=0?++h:--h)y=t[s]%i,r=Math.floor(t[s]/i),o[r].push(y);for(f=[],r=c=0,d=o.length;d>=0?d>c:c>d;r=d>=0?++c:--c)g=new Uint16Array(o[r]),u=r*i*4,0!==g.length&&(this.prog.set_attribute("a_x","float",[e.glglyph.vbo_x,0,u]),this.prog.set_attribute("a_y","float",[e.glglyph.vbo_y,0,u]),this.prog.set_attribute("a_size","float",[e.glglyph.vbo_s,0,u]),this.prog.set_attribute("a_angle","float",[e.glglyph.vbo_a,0,u]),this.vbo_linewidth.used&&this.prog.set_attribute("a_linewidth","float",[this.vbo_linewidth,0,u]),this.vbo_fg_color.used&&this.prog.set_attribute("a_fg_color","vec4",[this.vbo_fg_color,0,4*u]),this.vbo_bg_color.used&&this.prog.set_attribute("a_bg_color","vec4",[this.vbo_bg_color,0,4*u]),this.index_buffer.set_size(2*g.length),this.index_buffer.set_data(0,g),f.push(this.prog.draw(this.gl.POINTS,this.index_buffer)));return f}},e.prototype._set_data=function(t){var e,n;return e=4*t,this.vbo_x.set_size(e),this.vbo_y.set_size(e),this.vbo_a.set_size(e),this.vbo_s.set_size(e),this.vbo_x.set_data(0,new Float32Array(this.glyph.x)),this.vbo_y.set_data(0,new Float32Array(this.glyph.y)),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,o;for(r=this.glyph.sradius,o=[],t=0,e=r.length;e>t;t++)n=r[t],o.push(2*n);return o}.call(this))):this.vbo_s.set_data(0,new Float32Array(this.glyph.size))},e.prototype._set_visuals=function(t){return h(this.prog,this.vbo_linewidth,"a_linewidth",t,this.glyph.visuals.line,"width"),u(this.prog,this.vbo_fg_color,"a_fg_color",t,this.glyph.visuals.line),u(this.prog,this.vbo_bg_color,"a_bg_color",t,this.glyph.visuals.fill),this.prog.set_uniform("u_antialias","float",[.9])},e}(r),o=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return g(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}(a),l=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return g(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}(a),e.exports={CircleGLGlyph:o,SquareGLGlyph:l,LineGLGlyph:s}},{"../../common/color":"common/color",gloo2:"gloo2"}],"models/glyphs/circle":[function(t,e,n){var r,o,i,s,a,l,u=function(t,e){function n(){this.constructor=t}for(var r in e)h.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},h={}.hasOwnProperty;s=t("underscore"),a=t("./bokehgl"),i=t("./glyph"),l=t("../../common/hittest"),o=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return u(e,t),e.prototype._init_gl=function(t){return this.glglyph=new a.CircleGLGlyph(t,this)},e.prototype._index_data=function(){return this._xy_index()},e.prototype._map_data=function(){var t,e;return null!=this.radius?"data"===this.distances.radius.units?(t=this.fields.radius_dimension.fixed_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,n,r,o;for(r=this.size,o=[],t=0,n=r.length;n>t;t++)e=r[t],o.push(e/2);return o}.call(this)},e.prototype._mask_data=function(t){var e,n,r,o,i,s,a,l,u,h,c,p,_,d,f,m,g;return e=this.renderer.plot_view.frame.get("h_range"),p=this.renderer.plot_view.frame.get("v_range"),null!=this.radius&&"data"===this.distances.radius.units?(l=e.get("start"),u=e.get("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,h=p.get("start"),c=p.get("end"),r=this.renderer.ymapper.v_map_from_target([h,c],!0),m=r[0],g=r[1],m-=this.max_radius,g+=this.max_radius):(l=e.get("start")-this.max_size,u=e.get("end")+this.max_size,o=this.renderer.xmapper.v_map_from_target([l,u],!0),d=o[0],f=o[1],h=p.get("start")-this.max_size,c=p.get("end")+this.max_size,i=this.renderer.ymapper.v_map_from_target([h,c],!0),m=i[0],g=i[1]),d>f&&(s=[f,d],d=s[0],f=s[1]),m>g&&(a=[g,m],m=a[0],g=a[1]),function(){var t,e,n,r;for(n=this.index.search([d,m,f,g]),r=[],t=0,e=n.length;e>t;t++)_=n[t],r.push(_[4].i);return r}.call(this)},e.prototype._render=function(t,e,n){var r,o,i,s,a,l,u;for(l=n.sx,u=n.sy,a=n.sradius,s=[],o=0,i=e.length;i>o;o++)r=e[o],isNaN(l[r]+u[r]+a[r])||(t.beginPath(),t.arc(l[r],u[r],a[r],0,2*Math.PI,!1),this.visuals.fill.do_fill&&(this.visuals.fill.set_vectorize(t,r),t.fill()),this.visuals.line.do_stroke?(this.visuals.line.set_vectorize(t,r),s.push(t.stroke())):s.push(void 0));return s},e.prototype._hit_point=function(t){var e,n,r,o,i,a,u,h,c,p,_,d,f,m,g,y,v,b,x,w,k,M,j,T,z,E,P,S,C,A,O,N,q,F;if(_=[t.vx,t.vy],j=_[0],E=_[1],C=this.renderer.xmapper.map_from_target(j,!0),N=this.renderer.ymapper.map_from_target(E,!0),null!=this.radius&&"data"===this.distances.radius.units?(A=C-this.max_radius,O=C+this.max_radius,q=N-this.max_radius,F=N+this.max_radius):(T=j-this.max_size,z=j+this.max_size,d=this.renderer.xmapper.v_map_from_target([T,z],!0),A=d[0],O=d[1],f=[Math.min(A,O),Math.max(A,O)],A=f[0],O=f[1],P=E-this.max_size,S=E+this.max_size,m=this.renderer.ymapper.v_map_from_target([P,S],!0),q=m[0],F=m[1],g=[Math.min(q,F),Math.max(q,F)],q=g[0],F=g[1]),e=function(){var t,e,n,r;for(n=this.index.search([A,q,O,F]),r=[],t=0,e=n.length;e>t;t++)c=n[t],r.push(c[4].i);return r}.call(this),r=[],null!=this.radius&&"data"===this.distances.radius.units)for(i=0,u=e.length;u>i;i++)o=e[i],p=Math.pow(this.sradius[o],2),b=this.renderer.xmapper.map_to_target(C,!0),x=this.renderer.xmapper.map_to_target(this.x[o],!0),k=this.renderer.ymapper.map_to_target(N,!0),M=this.renderer.ymapper.map_to_target(this.y[o],!0),n=Math.pow(b-x,2)+Math.pow(k-M,2),p>=n&&r.push([o,n]);else for(v=this.renderer.plot_view.canvas.vx_to_sx(j),w=this.renderer.plot_view.canvas.vy_to_sy(E),a=0,h=e.length;h>a;a++)o=e[a],p=Math.pow(this.sradius[o],2),n=Math.pow(this.sx[o]-v,2)+Math.pow(this.sy[o]-w,2),p>=n&&r.push([o,n]);return r=s.chain(r).sortBy(function(t){return t[1]}).map(function(t){return t[0]}).value(),y=l.create_hit_test_result(),y["1d"].indices=r,y},e.prototype._hit_span=function(t){var e,n,r,o,i,s,a,u,h,c,p,_,d,f,m,g,y,v,b,x,w,k;return r=[t.vx,t.vy],c=r[0],d=r[1],o=this.bounds(),v=o[0],k=o[1],h=l.create_hit_test_result(),"h"===t.direction?(x=k[0],w=k[1],null!=this.radius&&"data"===this.distances.radius.units?(p=c-this.max_radius,_=c+this.max_radius,i=this.renderer.xmapper.v_map_from_target([p,_]),g=i[0],y=i[1]):(n=this.max_size/2,p=c-n,_=c+n,s=this.renderer.xmapper.v_map_from_target([p,_],!0),g=s[0],y=s[1])):(g=v[0],y=v[1],null!=this.radius&&"data"===this.distances.radius.units?(f=d-this.max_radius,m=d+this.max_radius,a=this.renderer.ymapper.v_map_from_target([f,m]),x=a[0],w=a[1]):(n=this.max_size/2,f=d-n,m=d+n,u=this.renderer.ymapper.v_map_from_target([f,m],!0),x=u[0],w=u[1])),e=function(){var t,e,n,r;for(n=this.index.search([g,x,y,w]),r=[],t=0,e=n.length;e>t;t++)b=n[t],r.push(b[4].i);return r}.call(this),h["1d"].indices=e,h},e.prototype._hit_rect=function(t){var e,n,r,o,i,s,a,u;return e=this.renderer.xmapper.v_map_from_target([t.vx0,t.vx1],!0),i=e[0],s=e[1],n=this.renderer.ymapper.v_map_from_target([t.vy0,t.vy1],!0),a=n[0],u=n[1],r=l.create_hit_test_result(),r["1d"].indices=function(){var t,e,n,r;for(n=this.index.search([i,a,s,u]),r=[],t=0,e=n.length;e>t;t++)o=n[t],r.push(o[4].i);return r}.call(this),r},e.prototype._hit_poly=function(t){var e,n,r,o,i,a,u,h,c,p,_,d,f;for(a=[s.clone(t.vx),s.clone(t.vy)],d=a[0],f=a[1],p=this.renderer.plot_view.canvas.v_vx_to_sx(d),_=this.renderer.plot_view.canvas.v_vy_to_sy(f),e=function(){c=[];for(var t=0,e=this.sx.length;e>=0?e>t:t>e;e>=0?t++:t--)c.push(t);return c}.apply(this),n=[],r=i=0,u=e.length;u>=0?u>i:i>u;r=u>=0?++i:--i)o=e[r],l.point_in_poly(this.sx[r],this.sy[r],p,_)&&n.push(o);return h=l.create_hit_test_result(),h["1d"].indices=n,h},e.prototype.draw_legend=function(t,e,n,r,o){var i,s,a,l,u,h,c;return l=null!=(a=this.get_reference_point())?a:0,s=[l],h={},h[l]=(e+n)/2,c={},c[l]=(r+o)/2,u={},u[l]=.2*Math.min(Math.abs(n-e),Math.abs(o-r)),i={sx:h,sy:c,sradius:u},this._render(t,s,i)},e}(i.View),r=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.prototype.distances=["?radius","?size"],e.prototype.fields=["radius_dimension:string"],e.prototype.defaults=function(){return s.extend({},e.__super__.defaults.call(this),{size:{units:"screen",value:4},angle:{units:"rad",value:0},radius:null,radius_dimension:"x"})},e}(i.Model),e.exports={Model:r,View:o}},{"../../common/hittest":"common/hittest","./bokehgl":"models/glyphs/bokehgl","./glyph":"models/glyphs/glyph",underscore:"underscore"}],"models/glyphs/gear":[function(t,e,n){var r,o,i,s,a,l,u=function(t,e){function n(){this.constructor=t}for(var r in e)h.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},h={}.hasOwnProperty;l=t("underscore"),a=t("./glyph"),i=t("gear_utils"),r=t("../../util/bezier"),s=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 this.smodule=this.sdist(this.renderer.xmapper,this.x,this.module,"edge")},e.prototype._render=function(t,e,n){var r,o,s,a,l,u,h,c,p,_,d,f,m,g,y,v,b,x,w,k,M,j,T,z,E;for(M=n.sx,j=n.sy,k=n.smodule,o=n.angle,T=n.teeth,d=n.pressure_angle,w=n.shaft_size,l=n.internal,h=0,p=e.length;p>h;h++)if(a=e[h],!isNaN(M[a]+j[a]+o[a]+k[a]+T[a]+d[a]+w[a]+l[a])){for(_=k[a]*T[a]/2,s=l[a]?i.create_internal_gear_tooth:i.create_gear_tooth,b=s(k[a],T[a],d[a]),f=b.slice(0,3),r=f[0],z=f[1],E=f[2],v=b.slice(3),t.save(),t.translate(M[a],j[a]),t.rotate(o[a]),t.beginPath(),y=2*Math.PI/T[a],t.moveTo(z,E),u=c=0,m=T[a];m>=0?m>c:c>m;u=m>=0?++c:--c)this._render_seq(t,v),t.rotate(y);t.closePath(),l[a]?(g=_+2.75*k[a],t.moveTo(g,0),t.arc(0,0,g,0,2*Math.PI,!0)):w[a]>0&&(x=_*w[a],t.moveTo(x,0),t.arc(0,0,x,0,2*Math.PI,!0)),this.visuals.fill.do_fill&&(this.visuals.fill.set_vectorize(t,a),t.fill()),this.visuals.line.do_stroke&&(this.visuals.line.set_vectorize(t,a),t.stroke()),t.restore()}},e.prototype._render_seq=function(t,e){var n,o,i,s,a,u,h,c,p,_,d,f,m,g,y,v,b,x,w,k,M,j,T,z,E,P,S,C,A;for(u=0;u<e.length;)switch(l.isString(e[u])&&(n=e[u],u+=1),n){case"M":f=e.slice(u,u+2),S=f[0],A=f[1],t.moveTo(S,A),m=[S,A],_=m[0],d=m[1],u+=2;break;case"L":y=e.slice(u,u+2),S=y[0],A=y[1],t.lineTo(S,A),v=[S,A],_=v[0],d=v[1],u+=2;break;case"C":b=e.slice(u,u+6),o=b[0],s=b[1],i=b[2],a=b[3],S=b[4],A=b[5],t.bezierCurveTo(o,s,i,a,S,A),x=[S,A],_=x[0],d=x[1],u+=6;break;case"Q":w=e.slice(u,u+4),o=w[0],s=w[1],S=w[2],A=w[3],t.quadraticCurveTo(o,s,S,A),k=[S,A],_=k[0],d=k[1],u+=4;break;case"A":for(M=e.slice(u,u+7),T=M[0],z=M[1],C=M[2],c=M[3],P=M[4],S=M[5],A=M[6],E=r.arc_to_bezier(_,d,T,z,-C,c,1-P,S,A),h=0,p=E.length;p>h;h++)j=E[h],o=j[0],s=j[1],i=j[2],a=j[3],S=j[4],A=j[5],t.bezierCurveTo(o,s,i,a,S,A);g=[S,A],_=g[0],d=g[1],u+=7;break;default:throw new Error("unexpected command: "+n)}},e.prototype.draw_legend=function(t,e,n,r,o){return this._generic_area_legend(t,e,n,r,o)},e}(a.View),o=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return u(e,t),e.prototype.default_view=s,e.prototype.type="Gear",e.prototype.angles=["angle"],e.prototype.fields=["module","internal:bool","pressure_angle","shaft_size","teeth"],e.prototype.defaults=function(){return l.extend({},e.__super__.defaults.call(this),{angle:0,pressure_angle:20,shaft_size:.3,internal:!1})},e}(a.Model),e.exports={Model:o,View:s}},{"../../util/bezier":"util/bezier","./glyph":"models/glyphs/glyph",gear_utils:"gear_utils",underscore:"underscore"}],"models/glyphs/glyph":[function(t,e,n){var r,o,i,s,a,l,u,h,c,p,_,d,f,m=function(t,e){function n(){this.constructor=t}for(var r in e)g.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},g={}.hasOwnProperty;l=t("underscore"),d=t("rbush"),h=t("../../common/bbox"),c=t("../../common/logging").logger,u=t("../../common/mathutils").arrayMax,a=t("../../model"),o=t("../../common/continuum_view"),_=t("../../common/properties"),r=t("../mappers/categorical_mapper"),p=t("proj4"),f=p.defs("GOOGLE"),s=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return m(e,t),e.prototype.initialize=function(t){var n,r,o,i,s;e.__super__.initialize.call(this,t),this.model.glyph_view=this,this.renderer=t.renderer,null!=(null!=(i=this.renderer)?i.plot_view:void 0)&&(n=this.renderer.plot_view.canvas_view.ctx,null!=n.glcanvas&&this._init_gl(n.glcanvas.gl)),s=_.factories;for(o in s)r=s[o],this[o]={},this[o]=l.extend(this[o],r(this.model));return this.warned={},this},e.prototype.render=function(t,e,n){if(this.mget("visible")){if(t.beginPath(),null!=this.glglyph&&this._render_gl(t,e,n))return;return this._render(t,e,n)}},e.prototype._render_gl=function(t,e,n){var r,o,i,s,a,l,u;return l=u=1,i=this.renderer.map_to_screen([0*l,1*l,2*l],[0*u,1*u,2*u]),r=i[0],o=i[1],l=100/Math.min(Math.max(Math.abs(r[1]-r[0]),1e-12),1e12),u=100/Math.min(Math.max(Math.abs(o[1]-o[0]),1e-12),1e12),s=this.renderer.map_to_screen([0*l,1*l,2*l],[0*u,1*u,2*u]),r=s[0],o=s[1],Math.abs(r[1]-r[0]-(r[2]-r[1]))>1e-6||Math.abs(o[1]-o[0]-(o[2]-o[1]))>1e-6?!1:(a={width:t.glcanvas.width,height:t.glcanvas.height,dx:r,dy:o,sx:(r[1]-r[0])/l,sy:(o[1]-o[0])/u},this.glglyph.draw(e,n,a),!0)},e.prototype.map_data=function(){var t,e,n,r,o,i,s,a,u,h,c,p,_,d,f,m,g;for(o=this.model.coords,e=0,r=o.length;r>e;e++)if(i=o[e],m=i[0],g=i[1],_="s"+m,f="s"+g,l.isArray(null!=(s=this[m])?s[0]:void 0))for(a=[[],[]],this[_]=a[0],this[f]=a[1],t=n=0,u=this[m].length;u>=0?u>n:n>u;t=u>=0?++n:--n)h=this.renderer.map_to_screen(this[m][t],this[g][t]),p=h[0],d=h[1],this[_].push(p),this[f].push(d);else c=this.renderer.map_to_screen(this[m],this[g]),this[_]=c[0],this[f]=c[1];return this._map_data()},e.prototype.project_xy=function(t,e){var n,r,o,i,s,a,l,u;for(i=[],a=[],n=r=0,l=t.length;l>=0?l>r:r>l;n=l>=0?++r:--r)u=p(f,[t[n],e[n]]),o=u[0],s=u[1],i[n]=o,a[n]=s;return[i,a]},e.prototype.project_xsys=function(t,e){var n,r,o,i,s,a,l,u;for(i=[],a=[],n=r=0,l=t.length;l>=0?l>r:r>l;n=l>=0?++r:--r)u=this.project_xy(t[n],e[n]),o=u[0],s=u[1],i[n]=o,a[n]=s;return[i,a]},e.prototype.set_data=function(t){var e,n,r,o,i,s,a,l;r=this.coords;for(e in r)n=r[e],this[e]=n.array(t);this.renderer.plot_model.use_map&&(null!=this.x&&(o=this.project_xy(this.x,this.y),this.x=o[0],this.y=o[1]),null!=this.xs&&(i=this.project_xsys(this.xs,this.ys),this.xs=i[0],this.ys=i[1])),s=this.angles;for(e in s)n=s[e],this[e]=n.array(t);a=this.distances;for(e in a)n=a[e],this[e]=n.array(t),this["max_"+e]=u(this[e]);l=this.fields;for(e in l)n=l[e],this[e]=n.array(t);return null!=this.glglyph&&this.glglyph.set_data_changed(this.x.length),this._set_data(),this.index=this._index_data()},e.prototype.set_visuals=function(t){var e,n,r;r=this.visuals;for(e in r)n=r[e],n.warm_cache(t);return null!=this.glglyph?this.glglyph.set_visuals_changed():void 0},e.prototype.bounds=function(){var t;return null==this.index?h.empty():(t=this.index.data.bbox,this._bounds([[t[0],t[2]],[t[1],t[3]]]))},e.prototype.scx=function(t){return this.sx[t]},e.prototype.scy=function(t){return this.sy[t]},e.prototype._init_gl=function(){return!1},e.prototype._set_data=function(){return null},e.prototype._map_data=function(){return null},e.prototype._mask_data=function(t){return t},e.prototype._bounds=function(t){return t},e.prototype._xy_index=function(){var t,e,n,o,i,s,a,l,u;for(e=d(),o=[],a=this.renderer.xmapper instanceof r.Model?this.renderer.xmapper.v_map_to_target(this.x,!0):this.x,u=this.renderer.ymapper instanceof r.Model?this.renderer.ymapper.v_map_to_target(this.y,!0):this.y,t=n=0,i=a.length;i>=0?i>n:n>i;t=i>=0?++n:--n)s=a[t],!isNaN(s)&&isFinite(s)&&(l=u[t],!isNaN(l)&&isFinite(l)&&o.push([s,l,s,l,{i:t}]));return e.load(o),e},e.prototype.sdist=function(t,e,n,r,o){var i,s,a,u,h,c,p;return null==r&&(r="edge"),null==o&&(o=!1),l.isString(e[0])&&(e=t.v_map_to_target(e)),"center"===r?(s=function(){var t,e,r;for(r=[],t=0,e=n.length;e>t;t++)i=n[t],r.push(i/2);return r}(),u=function(){var t,n,r;for(r=[],a=t=0,n=e.length;n>=0?n>t:t>n;a=n>=0?++t:--t)r.push(e[a]-s[a]);return r}(),h=function(){var t,n,r;for(r=[],a=t=0,n=e.length;n>=0?n>t:t>n;a=n>=0?++t:--t)r.push(e[a]+s[a]);return r}()):(u=e,h=function(){var t,e,r;for(r=[],a=t=0,e=u.length;e>=0?e>t:t>e;a=e>=0?++t:--t)r.push(u[a]+n[a]);return r}()),c=t.v_map_to_target(u),p=t.v_map_to_target(h),o?function(){var t,e,n;for(n=[],a=t=0,e=c.length;e>=0?e>t:t>e;a=e>=0?++t:--t)n.push(Math.ceil(Math.abs(p[a]-c[a])));return n}():function(){var t,e,n;for(n=[],a=t=0,e=c.length;e>=0?e>t:t>e;a=e>=0?++t:--t)n.push(Math.abs(p[a]-c[a]));return n}()},e.prototype.hit_test=function(t){var e,n;return n=null,e="_hit_"+t.type,null!=this[e]?n=this[e](t):null==this.warned[t.type]&&(c.error("'"+t.type+"' selection not available for "+this.model.type),this.warned[t.type]=!0),n},e.prototype.get_reference_point=function(){var t;return t=this.mget("reference_point"),l.isNumber(t)?this.data[t]:t},e.prototype.draw_legend=function(t,e,n,r,o){return null},e.prototype._generic_line_legend=function(t,e,n,r,o){var i,s;return s=null!=(i=this.get_reference_point())?i:0,t.save(),t.beginPath(),t.moveTo(e,(r+o)/2),t.lineTo(n,(r+o)/2),this.visuals.line.do_stroke&&(this.visuals.line.set_vectorize(t,s),t.stroke()),t.restore()},e.prototype._generic_area_legend=function(t,e,n,r,o){var i,s,a,l,u,h,c,p,_,d,f;return h=null!=(u=this.get_reference_point())?u:0,l=[h],f=Math.abs(n-e),s=.1*f,a=Math.abs(o-r),i=.1*a,c=e+s,p=n-s,_=r+i,d=o-i,this.visuals.fill.do_fill&&(this.visuals.fill.set_vectorize(t,h),t.fillRect(c,_,p-c,d-_)),this.visuals.line.do_stroke?(t.beginPath(),t.rect(c,_,p-c,d-_),this.visuals.line.set_vectorize(t,h),t.stroke()):void 0},e}(o),i=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return m(e,t),e.prototype.visuals=["line","fill"],e.prototype.coords=[["x","y"]],e.prototype.distances=[],e.prototype.angles=[],e.prototype.fields=[],e.prototype.fill_defaults={fill_color:"gray",fill_alpha:1},e.prototype.line_defaults={line_color:"black",line_width:1,line_alpha:1,line_join:"miter",line_cap:"butt",line_dash:[],line_dash_offset:0},e.prototype.text_defaults={text_font:"helvetica",text_font_size:"12pt",text_font_style:"normal",text_color:"#444444",text_alpha:1,text_align:"left",text_baseline:"bottom"},e.prototype.defaults=function(){var t,n,r,o,i,s;for(s=l.extend({},e.__super__.defaults.call(this),{visible:!0}),i=this.visuals,n=0,r=i.length;r>n;n++){switch(o=i[n]){case"line":t=this.line_defaults;break;case"fill":t=this.fill_defaults;break;case"text":t=this.text_defaults;break;default:c.warn("unknown visual property type '"+o+"'");continue}s=l.extend(s,t)}return s},e}(a),e.exports={Model:i,View:s}},{"../../common/bbox":"common/bbox","../../common/continuum_view":"common/continuum_view","../../common/logging":"common/logging","../../common/mathutils":"common/mathutils","../../common/properties":"common/properties","../../model":"model","../mappers/categorical_mapper":"models/mappers/categorical_mapper",proj4:"proj4",rbush:"rbush",underscore:"underscore"}],"models/glyphs/image":[function(t,e,n){var r,o,i,s,a,l,u=function(t,e){function n(){this.constructor=t}for(var r in e)h.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},h={}.hasOwnProperty;l=t("underscore"),r=t("../glyphs/glyph"),a=t("../mappers/linear_color_mapper"),o=t("../../palettes/palettes").Greys9,s=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._set_data=function(){var t,e,n,r,o,i,s,a,u,h,c;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)),c=[],i=u=0,h=this.image.length;h>=0?h>u:u>h;i=h>=0?++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),n=document.createElement("canvas"),n.width=this.width[i],n.height=this.height[i],o=n.getContext("2d"),s=o.getImageData(0,0,this.width[i],this.height[i]),r=this.mget("color_mapper"),a=null!=this.rows?this.image[i]:l.flatten(this.image[i]),
|
|
t=r.v_map_screen(a),e=new Uint8ClampedArray(t),s.data.set(e),o.putImageData(s,0,0),this.image_data[i]=n,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)),c.push(this._xy_index());return c},e.prototype._map_data=function(){return this.sw=this.sdist(this.renderer.xmapper,this.x,this.dw,"edge",this.mget("dilate")),this.sh=this.sdist(this.renderer.ymapper,this.y,this.dh,"edge",this.mget("dilate"))},e.prototype._render=function(t,e,n){var r,o,i,s,a,l,u,h,c,p;for(o=n.image_data,h=n.sx,c=n.sy,u=n.sw,l=n.sh,a=t.getImageSmoothingEnabled(),t.setImageSmoothingEnabled(!1),i=0,s=e.length;s>i;i++)r=e[i],null!=o[r]&&(isNaN(h[r]+c[r]+u[r]+l[r])||(p=c[r],t.translate(0,p),t.scale(1,-1),t.translate(0,-p),t.drawImage(o[r],0|h[r],0|c[r],u[r],l[r]),t.translate(0,p),t.scale(1,-1),t.translate(0,-p)));return t.setImageSmoothingEnabled(a)},e.prototype.bounds=function(){var t;return t=this.index.data.bbox,[[t[0],t[2]+this.max_dw],[t[1],t[3]+this.max_dh]]},e}(r.View),i=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return u(e,t),e.prototype.default_view=s,e.prototype.type="Image",e.prototype.visuals=[],e.prototype.distances=["dw","dh"],e.prototype.fields=["image:array","?rows","?cols"],e.prototype.defaults=function(){return l.extend({},e.__super__.defaults.call(this),{dilate:!1,color_mapper:new a.Model({palette:o})})},e}(r.Model),e.exports={Model:i,View:s}},{"../../palettes/palettes":"palettes/palettes","../glyphs/glyph":"models/glyphs/glyph","../mappers/linear_color_mapper":"models/mappers/linear_color_mapper",underscore:"underscore"}],"models/glyphs/image_rgba":[function(t,e,n){var r,o,i,s,a=function(t,e){function n(){this.constructor=t}for(var r in e)l.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},l={}.hasOwnProperty;s=t("underscore"),r=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._set_data=function(t,e){var n,r,o,i,a,l,u,h,c,p,_,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=p=0,d=this.image.length;d>=0?d>p:p>d;u=d>=0?++p:--p)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"),h=a.getImageData(0,0,this.width[u],this.height[u]),null!=this.rows)h.data.set(new Uint8ClampedArray(this.image[u]));else{for(l=s.flatten(this.image[u]),n=new ArrayBuffer(4*l.length),i=new Uint32Array(n),c=_=0,f=l.length;f>=0?f>_:_>f;c=f>=0?++_:--_)i[c]=l[c];r=new Uint8ClampedArray(n),h.data.set(r)}a.putImageData(h,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(){return this.sw=this.sdist(this.renderer.xmapper,this.x,this.dw,"edge",this.mget("dilate")),this.sh=this.sdist(this.renderer.ymapper,this.y,this.dh,"edge",this.mget("dilate"))},e.prototype._render=function(t,e,n){var r,o,i,s,a,l,u,h,c,p;for(o=n.image_data,h=n.sx,c=n.sy,u=n.sw,l=n.sh,a=t.getImageSmoothingEnabled(),t.setImageSmoothingEnabled(!1),i=0,s=e.length;s>i;i++)r=e[i],isNaN(h[r]+c[r]+u[r]+l[r])||(p=c[r],t.translate(0,p),t.scale(1,-1),t.translate(0,-p),t.drawImage(o[r],0|h[r],0|c[r],u[r],l[r]),t.translate(0,p),t.scale(1,-1),t.translate(0,-p));return t.setImageSmoothingEnabled(a)},e.prototype.bounds=function(){var t;return t=this.index.data.bbox,[[t[0],t[2]+this.max_dw],[t[1],t[3]+this.max_dh]]},e}(r.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="ImageRGBA",e.prototype.visuals=[],e.prototype.distances=["dw","dh"],e.prototype.fields=["image:array","?rows","?cols"],e.prototype.defaults=function(){return s.extend({},e.__super__.defaults.call(this),{dilate:!1,rows:null,cols:null})},e}(r.Model),e.exports={Model:o,View:i}},{"./glyph":"models/glyphs/glyph",underscore:"underscore"}],"models/glyphs/image_url":[function(t,e,n){var r,o,i,s,a,l=function(t,e){function n(){this.constructor=t}for(var r in e)u.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},u={}.hasOwnProperty;s=t("underscore"),r=t("./glyph"),a=t("../../common/logging").logger,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.listenTo(this.model,"change:global_alpha",this.renderer.request_render)},e.prototype._index_data=function(){},e.prototype._set_data=function(){var t,e,n,r,o,i,s;for((null==this.image||this.image.length!==this.url.length)&&(this.image=function(){var t,n,r,o;for(r=this.url,o=[],t=0,n=r.length;n>t;t++)e=r[t],o.push(null);return o}.call(this)),i=this.mget("retry_attempts"),s=this.mget("retry_timeout"),this.retries=function(){var t,n,r,o;for(r=this.url,o=[],t=0,n=r.length;n>t;t++)e=r[t],o.push(i);return o}.call(this),o=[],t=n=0,r=this.url.length;r>=0?r>n:n>r;t=r>=0?++n:--n)e=new Image,e.onerror=function(t){return function(e,n){return function(){return t.retries[e]>0?(a.trace("ImageURL failed to load "+t.url[e]+" image, retrying in "+s+" ms"),setTimeout(function(){return n.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,n){return function(){return t.image[n]=e,t.renderer.request_render()}}}(this)(e,t),o.push(e.src=this.url[t]);return o},e.prototype._map_data=function(){return this.sw=this.sdist(this.renderer.xmapper,this.x,this.w,"edge",this.mget("dilate")),this.sh=this.sdist(this.renderer.ymapper,this.y,this.h,"edge",this.mget("dilate"))},e.prototype._render=function(t,e,n){var r,o,i,s,a,l,u,h,c,p,_,d;for(d=n.url,s=n.image,p=n.sx,_=n.sy,c=n.sw,h=n.sh,r=n.angle,o=this.renderer.plot_view.frame,t.rect(o.get("left")+1,o.get("bottom")+1,o.get("width")-2,o.get("height")-2),t.clip(),u=[],a=0,l=e.length;l>a;a++)i=e[a],isNaN(p[i]+_[i]+r[i])||-1!==this.retries[i]&&null!=s[i]&&u.push(this._render_image(t,i,s[i],p,_,c,h,r));return u},e.prototype._final_sx_sy=function(t,e,n,r,o){switch(t){case"top_left":return[e,n];case"top_center":return[e-r/2,n];case"top_right":return[e-r,n];case"right_center":return[e-r,n-o/2];case"bottom_right":return[e-r,n-o];case"bottom_center":return[e-r/2,n-o];case"bottom_left":return[e,n-o];case"left_center":return[e,n-o/2];case"center":return[e-r/2,n-o/2]}},e.prototype._render_image=function(t,e,n,r,o,i,s,a){var l,u;return isNaN(i[e])&&(i[e]=n.width),isNaN(s[e])&&(s[e]=n.height),l=this.mget("anchor"),u=this._final_sx_sy(l,r[e],o[e],i[e],s[e]),r=u[0],o=u[1],t.save(),t.globalAlpha=this.mget("global_alpha"),a[e]?(t.translate(r,o),t.rotate(a[e]),t.drawImage(n,0,0,i[e],s[e]),t.rotate(-a[e]),t.translate(-r,-o)):t.drawImage(n,r,o,i[e],s[e]),t.restore()},e}(r.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="ImageURL",e.prototype.visuals=[],e.prototype.distances=["w","h"],e.prototype.angles=["angle"],e.prototype.fields=["url:string"],e.prototype.defaults=function(){return s.extend({},e.__super__.defaults.call(this),{anchor:"top_left",angle:0,dilate:!1,retry_attempts:0,retry_timeout:0,global_alpha:1})},e}(r.Model),e.exports={Model:o,View:i}},{"../../common/logging":"common/logging","./glyph":"models/glyphs/glyph",underscore:"underscore"}],"models/glyphs/line":[function(t,e,n){var r,o,i,s,a,l,u=function(t,e){function n(){this.constructor=t}for(var r in e)h.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},h={}.hasOwnProperty;s=t("underscore"),r=t("./glyph"),l=t("../../common/hittest"),a=t("./bokehgl"),i=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return u(e,t),e.prototype._init_gl=function(t){return this.glglyph=new a.LineGLGlyph(t,this)},e.prototype._index_data=function(){return this._xy_index()},e.prototype._render=function(t,e,n){var r,o,i,s,a,l;for(a=n.sx,l=n.sy,r=!1,this.visuals.line.set_value(t),i=0,s=e.length;s>i;i++)o=e[i],isFinite(a[o]+l[o])||!r?r?t.lineTo(a[o],l[o]):(t.beginPath(),t.moveTo(a[o],l[o]),r=!0):(t.stroke(),t.beginPath(),r=!1);return r?t.stroke():void 0},e.prototype._hit_point=function(t){var e,n,r,o,i,s,a,u,h,c,p;for(h=l.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)},c=9999,p=Math.max(2,this.visuals.line.width.value()/2),n=r=0,a=this.sx.length-1;a>=0?a>r:r>a;n=a>=0?++r:--r)u=[{x:this.sx[n],y:this.sy[n]},{x:this.sx[n+1],y:this.sy[n+1]}],o=u[0],i=u[1],e=l.dist_to_segment(s,o,i),p>e&&c>e&&(c=e,h["0d"].glyph=this.model,h["0d"].flag=!0,h["0d"].indices=[n]);return h},e.prototype._hit_span=function(t){var e,n,r,o,i,s,a,u,h;for(r=[t.vx,t.vy],u=r[0],h=r[1],i=l.create_hit_test_result(),"v"===t.direction?(s=this.renderer.ymapper.map_from_target(h),a=this.y):(s=this.renderer.xmapper.map_from_target(u),a=this.x),e=n=0,o=a.length-1;o>=0?o>n:n>o;e=o>=0?++n:--n)a[e]<=s&&s<=a[e+1]&&(i["0d"].glyph=this.model,i["0d"].flag=!0,i["0d"].indices.push(e));return i},e.prototype.get_interpolation_hit=function(t,e){var n,r,o,i,s,a,u,h,c,p,_,d,f,m,g,y,v,b,x;return n=[e.vx,e.vy],p=n[0],_=n[1],r=[this.x[t],this.y[t],this.x[t+1],this.y[t+1]],m=r[0],b=r[1],g=r[2],x=r[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([p-1,p+1]),d=i[0],f=i[1]):"v"===e.direction?(s=this.renderer.ymapper.v_map_from_target([_,_]),y=s[0],v=s[1],a=[m,g],d=a[0],f=a[1]):(u=this.renderer.xmapper.v_map_from_target([p,p]),d=u[0],f=u[1],h=[b,x],y=h[0],v=h[1]),c=l.check_2_segments_intersect(d,y,f,v,m,b,g,x),[c.x,c.y]},e.prototype.draw_legend=function(t,e,n,r,o){return this._generic_line_legend(t,e,n,r,o)},e}(r.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="Line",e.prototype.visuals=["line"],e}(r.Model),e.exports={Model:o,View:i}},{"../../common/hittest":"common/hittest","./bokehgl":"models/glyphs/bokehgl","./glyph":"models/glyphs/glyph",underscore:"underscore"}],"models/glyphs/multi_line":[function(t,e,n){var r,o,i,s,a,l=function(t,e){function n(){this.constructor=t}for(var r in e)u.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},u={}.hasOwnProperty;s=t("underscore"),a=t("rbush"),r=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,n,r,o,i,l,u,h;for(e=a(),r=[],t=n=0,o=this.xs.length;o>=0?o>n:n>o;t=o>=0?++n:--n)l=function(){var e,n,r,o;for(r=this.xs[t],o=[],e=0,n=r.length;n>e;e++)i=r[e],s.isNaN(i)||o.push(i);return o}.call(this),h=function(){var e,n,r,o;for(r=this.ys[t],o=[],e=0,n=r.length;n>e;e++)u=r[e],s.isNaN(u)||o.push(u);return o}.call(this),0!==l.length&&r.push([s.min(l),s.min(h),s.max(l),s.max(h),{i:t}]);return e.load(r),e},e.prototype._render=function(t,e,n){var r,o,i,s,a,l,u,h,c,p,_,d;for(p=n.sxs,d=n.sys,h=[],i=0,a=e.length;a>i;i++){for(r=e[i],l=[p[r],d[r]],c=l[0],_=l[1],this.visuals.line.set_vectorize(t,r),o=s=0,u=c.length;u>=0?u>s:s>u;o=u>=0?++s:--s)0!==o?isNaN(c[o])||isNaN(_[o])?(t.stroke(),t.beginPath()):t.lineTo(c[o],_[o]):(t.beginPath(),t.moveTo(c[o],_[o]));h.push(t.stroke())}return h},e.prototype.draw_legend=function(t,e,n,r,o){return this._generic_line_legend(t,e,n,r,o)},e}(r.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="MultiLine",e.prototype.visuals=["line"],e.prototype.coords=[["xs","ys"]],e}(r.Model),e.exports={Model:o,View:i}},{"./glyph":"models/glyphs/glyph",rbush:"rbush",underscore:"underscore"}],"models/glyphs/oval":[function(t,e,n){var r,o,i,s,a=function(t,e){function n(){this.constructor=t}for(var r in e)l.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},l={}.hasOwnProperty;s=t("underscore"),r=t("./glyph"),i=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return a(e,t),e.prototype._set_data=function(){return this.max_w2=0,"data"===this.distances.width.units&&(this.max_w2=this.max_width/2),this.max_h2=0,"data"===this.distances.height.units?this.max_h2=this.max_height/2:void 0},e.prototype._index_data=function(){return this._xy_index()},e.prototype._map_data=function(){return"data"===this.distances.width.units?this.sw=this.sdist(this.renderer.xmapper,this.x,this.width,"center"):this.sw=this.width,"data"===this.distances.height.units?this.sh=this.sdist(this.renderer.ymapper,this.y,this.height,"center"):this.sh=this.height},e.prototype._render=function(t,e,n){var r,o,i,s,a,l,u,h;for(u=n.sx,h=n.sy,l=n.sw,a=n.sh,s=[],o=0,i=e.length;i>o;o++)r=e[o],isNaN(u[r]+h[r]+l[r]+a[r]+this.angle[r])||(t.translate(u[r],h[r]),t.rotate(this.angle[r]),t.beginPath(),t.moveTo(0,-a[r]/2),t.bezierCurveTo(l[r]/2,-a[r]/2,l[r]/2,a[r]/2,0,a[r]/2),t.bezierCurveTo(-l[r]/2,a[r]/2,-l[r]/2,-a[r]/2,0,-a[r]/2),t.closePath(),this.visuals.fill.do_fill&&(this.visuals.fill.set_vectorize(t,r),t.fill()),this.visuals.line.do_stroke&&(this.visuals.line.set_vectorize(t,r),t.stroke()),t.rotate(-this.angle[r]),s.push(t.translate(-u[r],-h[r])));return s},e.prototype.draw_legend=function(t,e,n,r,o){var i,s,a,l,u,h,c,p,_,d;return u=null!=(l=this.get_reference_point())?l:0,a=[u],_={},_[u]=(e+n)/2,d={},d[u]=(r+o)/2,h=this.sw[u]/this.sh[u],i=.8*Math.min(Math.abs(n-e),Math.abs(o-r)),p={},c={},h>1?(p[u]=i,c[u]=i/h):(p[u]=i*h,c[u]=i),s={sx:_,sy:d,sw:p,sh:c},this._render(t,a,s)},e.prototype._bounds=function(t){return[[t[0][0]-this.max_w2,t[0][1]+this.max_w2],[t[1][0]-this.max_h2,t[1][1]+this.max_h2]]},e}(r.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="Oval",e.prototype.distances=["width","height"],e.prototype.angles=["angle"],e.prototype.defaults=function(){return s.extend({},e.__super__.defaults.call(this),{angle:0})},e}(r.Model),e.exports={Model:o,View:i}},{"./glyph":"models/glyphs/glyph",underscore:"underscore"}],"models/glyphs/patch":[function(t,e,n){var r,o,i,s,a=function(t,e){function n(){this.constructor=t}for(var r in e)l.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},l={}.hasOwnProperty;s=t("underscore"),r=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,n){var r,o,i,s,a,l,u;if(l=n.sx,u=n.sy,this.visuals.fill.do_fill){for(this.visuals.fill.set_value(t),o=0,s=e.length;s>o;o++)r=e[o],0!==r?isNaN(l[r]+u[r])?(t.closePath(),t.fill(),t.beginPath()):t.lineTo(l[r],u[r]):(t.beginPath(),t.moveTo(l[r],u[r]));t.closePath(),t.fill()}if(this.visuals.line.do_stroke){for(this.visuals.line.set_value(t),i=0,a=e.length;a>i;i++)r=e[i],0!==r?isNaN(l[r]+u[r])?(t.closePath(),t.stroke(),t.beginPath()):t.lineTo(l[r],u[r]):(t.beginPath(),t.moveTo(l[r],u[r]));return t.closePath(),t.stroke()}},e.prototype.draw_legend=function(t,e,n,r,o){return this._generic_area_legend(t,e,n,r,o)},e}(r.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}(r.Model),e.exports={Model:o,View:i}},{"./glyph":"models/glyphs/glyph",underscore:"underscore"}],"models/glyphs/patches":[function(t,e,n){var r,o,i,s,a,l,u=function(t,e){function n(){this.constructor=t}for(var r in e)h.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},h={}.hasOwnProperty;s=t("underscore"),r=t("./glyph"),l=t("rbush"),a=t("../../common/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,n,r,o,i,a,l,u,h;for(n={},r=o=0,h=t.length;h>=0?h>o:o>h;r=h>=0?++o:--o)for(n[r]=[],l=s.toArray(t[r]);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,n;for(n=[],t=0,e=u.length;e>t;t++)a=u[t],s.isNaN(a)||n.push(a);return n}(),n[r].push(e);return n},e.prototype._index_data=function(){var t,e,n,r,o,i,a,u,h,c,p,_;for(e=l(),i=[],c=this._build_discontinuous_object(this.xs),_=this._build_discontinuous_object(this.ys),t=r=0,a=this.xs.length;a>=0?a>r:r>a;t=a>=0?++r:--r)for(n=o=0,u=c[t].length;u>=0?u>o:o>u;n=u>=0?++o:--o)h=c[t][n],p=_[t][n],0!==h.length&&i.push([s.min(h),s.min(p),s.max(h),s.max(p),{i:t}]);return e.load(i),e},e.prototype._mask_data=function(t){var e,n,r,o,i,s,a,l,u;return s=this.renderer.plot_view.x_range,e=[s.get("min"),s.get("max")],o=e[0],i=e[1],u=this.renderer.plot_view.y_range,n=[u.get("min"),u.get("max")],a=n[0],l=n[1],function(){var t,e,n,s;for(n=this.index.search([o,a,i,l]),s=[],t=0,e=n.length;e>t;t++)r=n[t],s.push(r[4].i);return s}.call(this)},e.prototype._render=function(t,e,n){var r,o,i,s,a,l,u,h,c,p,_,d,f,m;for(d=n.sxs,m=n.sys,this.sxss=this._build_discontinuous_object(d),this.syss=this._build_discontinuous_object(m),p=[],i=0,a=e.length;a>i;i++){if(r=e[i],u=[d[r],m[r]],_=u[0],f=u[1],this.visuals.fill.do_fill){for(this.visuals.fill.set_vectorize(t,r),o=s=0,h=_.length;h>=0?h>s:s>h;o=h>=0?++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.do_stroke){for(this.visuals.line.set_vectorize(t,r),o=l=0,c=_.length;c>=0?c>l:l>c;o=c>=0?++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(),p.push(t.stroke())}else p.push(void 0)}return p},e.prototype._hit_point=function(t){var e,n,r,o,i,s,l,u,h,c,p,_,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,n,r;for(n=this.index.search([v,b,v,b]),r=[],t=0,e=n.length;e>t;t++)v=n[t],r.push(v[4].i);return r}.call(this),n=[],r=s=0,h=e.length;h>=0?h>s:s>h;r=h>=0?++s:--s)for(o=e[r],d=this.sxss[o],m=this.syss[o],i=l=0,c=d.length;c>=0?c>l:l>c;i=c>=0?++l:--l)a.point_in_poly(_,f,d[i],m[i])&&n.push(o);return p=a.create_hit_test_result(),p["1d"].indices=n,p},e.prototype._get_snap_coord=function(t){var e,n,r,o;for(o=0,e=0,n=t.length;n>e;e++)r=t[e],o+=r;return o/t.length},e.prototype.scx=function(t,e,n){var r,o,i,s,l;if(1===this.sxss[t].length)return this._get_snap_coord(this.sxs[t]);for(s=this.sxss[t],l=this.syss[t],r=o=0,i=s.length;i>=0?i>o:o>i;r=i>=0?++o:--o)if(a.point_in_poly(e,n,s[r],l[r]))return this._get_snap_coord(s[r]);return null},e.prototype.scy=function(t,e,n){var r,o,i,s,l;if(1===this.syss[t].length)return this._get_snap_coord(this.sys[t]);for(s=this.sxss[t],l=this.syss[t],r=o=0,i=s.length;i>=0?i>o:o>i;r=i>=0?++o:--o)if(a.point_in_poly(e,n,s[r],l[r]))return this._get_snap_coord(l[r])},e.prototype.draw_legend=function(t,e,n,r,o){return this._generic_area_legend(t,e,n,r,o)},e}(r.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.prototype.coords=[["xs","ys"]],e}(r.Model),e.exports={Model:o,View:i}},{"../../common/hittest":"common/hittest","./glyph":"models/glyphs/glyph",rbush:"rbush",underscore:"underscore"}],"models/glyphs/quad":[function(t,e,n){var r,o,i,s,a,l,u=function(t,e){function n(){this.constructor=t}for(var r in e)h.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},h={}.hasOwnProperty;s=t("underscore"),l=t("rbush"),r=t("./glyph"),a=t("../../common/hittest"),i=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return u(e,t),e.prototype._index_data=function(){var t,e,n,r,o;for(e=l(),r=[],t=n=0,o=this.left.length;o>=0?o>n:n>o;t=o>=0?++n:--n)isNaN(this.left[t]+this.right[t]+this.top[t]+this.bottom[t])||r.push([this.left[t],this.bottom[t],this.right[t],this.top[t],{i:t}]);return e.load(r),e},e.prototype._render=function(t,e,n){var r,o,i,s,a,l,u,h;for(l=n.sleft,u=n.sright,h=n.stop,a=n.sbottom,s=[],o=0,i=e.length;i>o;o++)r=e[o],isNaN(l[r]+h[r]+u[r]+a[r])||(this.visuals.fill.do_fill&&(this.visuals.fill.set_vectorize(t,r),t.fillRect(l[r],h[r],u[r]-l[r],a[r]-h[r])),this.visuals.line.do_stroke?(t.beginPath(),t.rect(l[r],h[r],u[r]-l[r],a[r]-h[r]),this.visuals.line.set_vectorize(t,r),s.push(t.stroke())):s.push(void 0));return s},e.prototype._hit_point=function(t){var e,n,r,o,i,s,l;return n=[t.vx,t.vy],o=n[0],i=n[1],s=this.renderer.xmapper.map_from_target(o,!0),l=this.renderer.ymapper.map_from_target(i,!0),e=function(){var t,e,n,r;for(n=this.index.search([s,l,s,l]),r=[],t=0,e=n.length;e>t;t++)s=n[t],r.push(s[4].i);return r}.call(this),r=a.create_hit_test_result(),r["1d"].indices=e,r},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=function(t,e,n,r,o){return this._generic_area_legend(t,e,n,r,o)},e}(r.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="Quad",e.prototype.coords=[["right","bottom"],["left","top"]],e}(r.Model),e.exports={Model:o,View:i}},{"../../common/hittest":"common/hittest","./glyph":"models/glyphs/glyph",rbush:"rbush",underscore:"underscore"}],"models/glyphs/quadratic":[function(t,e,n){var r,o,i,s,a,l,u=function(t,e){function n(){this.constructor=t}for(var r in e)h.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},h={}.hasOwnProperty;s=t("underscore"),l=t("rbush"),r=t("./glyph"),a=function(t,e,n){var r,o;return e===(t+n)/2?[t,n]:(o=(t-e)/(t-2*e+n),r=t*Math.pow(1-o,2)+2*e*(1-o)*o+n*Math.pow(o,2),[Math.min(t,n,r),Math.max(t,n,r)])},i=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return u(e,t),e.prototype._index_data=function(){var t,e,n,r,o,i,s,u,h,c,p;for(e=l(),r=[],t=n=0,o=this.x0.length;o>=0?o>n:n>o;t=o>=0?++n:--n)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],h=i[1],s=a(this.y0[t],this.cy[t],this.y1[t]),c=s[0],p=s[1],r.push([u,c,h,p,{i:t}]));return e.load(r),e},e.prototype._render=function(t,e,n){var r,o,i,s,a,l,u,h,c,p;if(u=n.sx0,c=n.sy0,h=n.sx1,p=n.sy1,a=n.scx,l=n.scy,this.visuals.line.do_stroke){for(s=[],o=0,i=e.length;i>o;o++)r=e[o],isNaN(u[r]+c[r]+h[r]+p[r]+a[r]+l[r])||(t.beginPath(),t.moveTo(u[r],c[r]),t.quadraticCurveTo(a[r],l[r],h[r],p[r]),this.visuals.line.set_vectorize(t,r),s.push(t.stroke()));return s}},e.prototype.draw_legend=function(t,e,n,r,o){return this._generic_line_legend(t,e,n,r,o)},e}(r.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.prototype.visuals=["line"],e.prototype.coords=[["x0","y0"],["x1","y1"],["cx","cy"]],e}(r.Model),e.exports={Model:o,View:i}},{"./glyph":"models/glyphs/glyph",rbush:"rbush",underscore:"underscore"}],"models/glyphs/ray":[function(t,e,n){var r,o,i,s,a=function(t,e){function n(){this.constructor=t}for(var r in e)l.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},l={}.hasOwnProperty;s=t("underscore"),r=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._map_data=function(){return this.slength=this.sdist(this.renderer.xmapper,this.x,this.length)},e.prototype._render=function(t,e,n){var r,o,i,s,a,l,u,h,c,p,_,d,f;if(_=n.sx,d=n.sy,p=n.slength,r=n.angle,this.visuals.line.do_stroke){for(f=this.renderer.plot_view.frame.get("width"),o=this.renderer.plot_view.frame.get("height"),s=2*(f+o),i=a=0,h=p.length;h>=0?h>a:a>h;i=h>=0?++a:--a)0===p[i]&&(p[i]=s);for(c=[],l=0,u=e.length;u>l;l++)i=e[l],isNaN(_[i]+d[i]+r[i]+p[i])||(t.translate(_[i],d[i]),t.rotate(r[i]),t.beginPath(),t.moveTo(0,0),t.lineTo(p[i],0),this.visuals.line.set_vectorize(t,i),t.stroke(),t.rotate(-r[i]),c.push(t.translate(-_[i],-d[i])));return c}},e.prototype.draw_legend=function(t,e,n,r,o){return this._generic_line_legend(t,e,n,r,o)},e}(r.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="Ray",e.prototype.visuals=["line"],e.prototype.distances=["length"],e.prototype.angles=["angle"],e}(r.Model),e.exports={Model:o,View:i}},{"./glyph":"models/glyphs/glyph",underscore:"underscore"}],"models/glyphs/rect":[function(t,e,n){var r,o,i,s,a,l=function(t,e){function n(){this.constructor=t}for(var r in e)u.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},u={}.hasOwnProperty;s=t("underscore"),r=t("./glyph"),a=t("../../common/hittest"),i=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return l(e,t),e.prototype._set_data=function(){return this.max_w2=0,"data"===this.distances.width.units&&(this.max_w2=this.max_width/2),this.max_h2=0,"data"===this.distances.height.units?this.max_h2=this.max_height/2:void 0},e.prototype._index_data=function(){return this._xy_index()},e.prototype._map_data=function(){return"data"===this.distances.width.units?this.sw=this.sdist(this.renderer.xmapper,this.x,this.width,"center",this.mget("dilate")):this.sw=this.width,"data"===this.distances.height.units?this.sh=this.sdist(this.renderer.ymapper,this.y,this.height,"center",this.mget("dilate")):this.sh=this.height},e.prototype._render=function(t,e,n){var r,o,i,s,a,l,u,h,c,p;if(c=n.sx,p=n.sy,h=n.sw,u=n.sh,r=n.angle,this.visuals.fill.do_fill)for(i=0,a=e.length;a>i;i++)o=e[i],isNaN(c[o]+p[o]+h[o]+u[o]+r[o])||(this.visuals.fill.set_vectorize(t,o),r[o]?(t.translate(c[o],p[o]),t.rotate(r[o]),t.fillRect(-h[o]/2,-u[o]/2,h[o],u[o]),t.rotate(-r[o]),t.translate(-c[o],-p[o])):t.fillRect(c[o]-h[o]/2,p[o]-u[o]/2,h[o],u[o]));if(this.visuals.line.do_stroke){for(t.beginPath(),s=0,l=e.length;l>s;s++)o=e[s],isNaN(c[o]+p[o]+h[o]+u[o]+r[o])||0!==h[o]&&0!==u[o]&&(r[o]?(t.translate(c[o],p[o]),t.rotate(r[o]),t.rect(-h[o]/2,-u[o]/2,h[o],u[o]),t.rotate(-r[o]),t.translate(-c[o],-p[o])):t.rect(c[o]-h[o]/2,p[o]-u[o]/2,h[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,n,r,o,i,s,l,u;return e=this.renderer.xmapper.v_map_from_target([t.vx0,t.vx1],!0),i=e[0],s=e[1],n=this.renderer.ymapper.v_map_from_target([t.vy0,t.vy1],!0),l=n[0],u=n[1],r=a.create_hit_test_result(),r["1d"].indices=function(){var t,e,n,r;for(n=this.index.search([i,l,s,u]),r=[],t=0,e=n.length;e>t;t++)o=n[t],r.push(o[4].i);return r}.call(this),r},e.prototype._hit_point=function(t){var e,n,r,o,i,s,l,u,h,c,p,_,d,f,m,g,y,v,b,x,w,k,M,j,T,z,E,P,S,C,A;for(p=[t.vx,t.vy],b=p[0],k=p[1],z=this.renderer.xmapper.map_from_target(b,!0),S=this.renderer.ymapper.map_from_target(k,!0),"screen"===this.distances.width.units?(x=b-2*this.max_width,w=b+2*this.max_width,_=this.renderer.xmapper.v_map_from_target([x,w],!0),E=_[0],P=_[1]):(E=z-2*this.max_width,P=z+2*this.max_width),"screen"===this.distances.height.units?(M=k-2*this.max_height,j=k+2*this.max_height,d=this.renderer.ymapper.v_map_from_target([M,j],!0),C=d[0],A=d[1]):(C=S-2*this.max_height,A=S+2*this.max_height),o=[],f=function(){var t,e,n,r;for(n=this.index.search([E,C,P,A]),r=[],t=0,e=n.length;e>t;t++)u=n[t],r.push(u[4].i);return r}.call(this),s=0,l=f.length;l>s;s++)i=f[s],y=this.renderer.plot_view.canvas.vx_to_sx(b),v=this.renderer.plot_view.canvas.vy_to_sy(k),this.angle[i]&&(n=Math.sqrt(Math.pow(y-this.sx[i],2)+Math.pow(v-this.sy[i],2)),g=Math.sin(-this.angle[i]),e=Math.cos(-this.angle[i]),h=e*(y-this.sx[i])-g*(v-this.sy[i])+this.sx[i],c=g*(y-this.sx[i])+e*(v-this.sy[i])+this.sy[i],y=h,v=c),T=Math.abs(this.sx[i]-y)<=this.sw[i]/2,r=Math.abs(this.sy[i]-v)<=this.sh[i]/2,r&&T&&o.push(i);return m=a.create_hit_test_result(),m["1d"].indices=o,m},e.prototype.draw_legend=function(t,e,n,r,o){return this._generic_area_legend(t,e,n,r,o)},e.prototype._bounds=function(t){return[[t[0][0]-this.max_w2,t[0][1]+this.max_w2],[t[1][0]-this.max_h2,t[1][1]+this.max_h2]]},e}(r.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="Rect",e.prototype.distances=["width","height"],e.prototype.angles=["angle"],e.prototype.defaults=function(){return s.extend({},e.__super__.defaults.call(this),{angle:0,dilate:!1})},e}(r.Model),e.exports={Model:o,View:i}},{"../../common/hittest":"common/hittest","./glyph":"models/glyphs/glyph",underscore:"underscore"}],"models/glyphs/segment":[function(t,e,n){var r,o,i,s,a,l=function(t,e){function n(){this.constructor=t}for(var r in e)u.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},u={}.hasOwnProperty;s=t("underscore"),a=t("rbush"),r=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,n,r,o;for(e=a(),r=[],t=n=0,o=this.x0.length;o>=0?o>n:n>o;t=o>=0?++n:--n)isNaN(this.x0[t]+this.x1[t]+this.y0[t]+this.y1[t])||r.push([this.x0[t],this.y0[t],this.x1[t],this.y1[t],{i:t}]);return e.load(r),e},e.prototype._render=function(t,e,n){var r,o,i,s,a,l,u,h;if(a=n.sx0,u=n.sy0,l=n.sx1,h=n.sy1,this.visuals.line.do_stroke){for(s=[],o=0,i=e.length;i>o;o++)r=e[o],isNaN(a[r]+u[r]+l[r]+h[r])||(t.beginPath(),t.moveTo(a[r],u[r]),t.lineTo(l[r],h[r]),this.visuals.line.set_vectorize(t,r),s.push(t.stroke()));return s}},e.prototype.draw_legend=function(t,e,n,r,o){return this._generic_line_legend(t,e,n,r,o)},e}(r.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.prototype.visuals=["line"],e.prototype.coords=[["x0","y0"],["x1","y1"]],e}(r.Model),e.exports={Model:o,View:i}},{"./glyph":"models/glyphs/glyph",rbush:"rbush",underscore:"underscore"}],"models/glyphs/text":[function(t,e,n){var r,o,i,s,a,l=function(t,e){function n(){this.constructor=t}for(var r in e)u.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},u={}.hasOwnProperty;s=t("underscore"),r=t("./glyph"),a=t("../../common/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.text_props=new a.Text({obj:this.model,prefix:""})},e.prototype._index_data=function(){return this._xy_index()},e.prototype._render=function(t,e,n){var r,o,i,s,a,l,u,h,c,p;for(l=n.sx,u=n.sy,c=n.x_offset,p=n.y_offset,r=n.angle,h=n.text,a=[],i=0,s=e.length;s>i;i++)o=e[i],isNaN(l[o]+u[o]+c[o]+p[o]+r[o])||null==h[o]||(t.save(),t.translate(l[o]+c[o],u[o]+p[o]),t.rotate(r[o]),this.visuals.text.set_vectorize(t,o),t.fillText(h[o],0,0),a.push(t.restore()));return a},e.prototype.draw_legend=function(t,e,n,r,o){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",n,(r+o)/2),t.restore()},e}(r.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.prototype.visuals=["text"],e.prototype.angles=["angle"],e.prototype.fields=["text:string","x_offset","y_offset"],e.prototype.defaults=function(){return s.extend({},e.__super__.defaults.call(this),{angle:0,x_offset:0,y_offset:0,text:{field:"text"}})},e}(r.Model),e.exports={Model:o,View:i}},{"../../common/properties":"common/properties","./glyph":"models/glyphs/glyph",underscore:"underscore"}],"models/glyphs/wedge":[function(t,e,n){var r,o,i,s,a,l,u=function(t,e){function n(){this.constructor=t}for(var r in e)h.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},h={}.hasOwnProperty;s=t("underscore"),l=t("../../common/mathutils"),r=t("./glyph"),a=t("../../common/hittest"),i=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.distances.radius.units?this.sradius=this.sdist(this.renderer.xmapper,this.x,this.radius):this.sradius=this.radius},e.prototype._render=function(t,e,n){var r,o,i,s,a,l,u,h,c,p;for(c=n.sx,p=n.sy,u=n.sradius,h=n.start_angle,o=n.end_angle,r=n.direction,l=[],s=0,a=e.length;a>s;s++)i=e[s],isNaN(c[i]+p[i]+u[i]+h[i]+o[i]+r[i])||(t.beginPath(),t.arc(c[i],p[i],u[i],h[i],o[i],r[i]),t.lineTo(c[i],p[i]),t.closePath(),this.visuals.fill.do_fill&&(this.visuals.fill.set_vectorize(t,i),t.fill()),this.visuals.line.do_stroke?(this.visuals.line.set_vectorize(t,i),l.push(t.stroke())):l.push(void 0));return l},e.prototype._hit_point=function(t){var e,n,r,o,i,u,h,c,p,_,d,f,m,g,y,v,b,x,w,k,M,j,T,z,E,P,S,C,A,O,N,q,F,D,I;for(f=[t.vx,t.vy],z=f[0],S=f[1],O=this.renderer.xmapper.map_from_target(z,!0),F=this.renderer.ymapper.map_from_target(S,!0),"data"===this.distances.radius.units?(N=O-this.max_radius,q=O+this.max_radius,D=F-this.max_radius,I=F+this.max_radius):(E=z-this.max_radius,P=z+this.max_radius,m=this.renderer.xmapper.v_map_from_target([E,P],!0),N=m[0],q=m[1],C=S-this.max_radius,A=S+this.max_radius,g=this.renderer.ymapper.v_map_from_target([C,A],!0),D=g[0],I=g[1]),n=[],y=function(){var t,e,n,r;for(n=this.index.search([N,D,q,I]),r=[],t=0,e=n.length;e>t;t++)_=n[t],r.push(_[4].i);return r}.call(this),u=0,c=y.length;c>u;u++)i=y[u],d=Math.pow(this.sradius[i],2),w=this.renderer.xmapper.map_to_target(O,!0),k=this.renderer.xmapper.map_to_target(this.x[i],!0),j=this.renderer.ymapper.map_to_target(F,!0),T=this.renderer.ymapper.map_to_target(this.y[i],!0),r=Math.pow(w-k,2)+Math.pow(j-T,2),d>=r&&n.push([i,r]);for(o=[],h=0,p=n.length;p>h;h++)v=n[h],i=v[0],r=v[1],x=this.renderer.plot_view.canvas.vx_to_sx(z),M=this.renderer.plot_view.canvas.vy_to_sy(S),e=Math.atan2(M-this.sy[i],x-this.sx[i]),l.angle_between(-e,-this.start_angle[i],-this.end_angle[i],this.direction[i])&&o.push([i,r]);return b=a.create_hit_test_result(),b["1d"].indices=s.chain(o).sortBy(function(t){return t[1]}).map(function(t){return t[0]}).value(),b},e.prototype.draw_legend=function(t,e,n,r,o){return this._generic_area_legend(t,e,n,r,o)},e}(r.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="Wedge",e.prototype.distances=["radius"],e.prototype.angles=["start_angle","end_angle"],e.prototype.fields=["direction:direction"],e.prototype.defaults=function(){return s.extend({},e.__super__.defaults.call(this),{direction:"anticlock"})},e}(r.Model),e.exports={Model:o,View:i}},{"../../common/hittest":"common/hittest","../../common/mathutils":"common/mathutils","./glyph":"models/glyphs/glyph",underscore:"underscore"}],"models/grids/grid":[function(t,e,n){var r,o,i,s,a,l,u=function(t,e){function n(){this.constructor=t}for(var r in e)h.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},h={}.hasOwnProperty;a=t("underscore"),i=t("../renderers/guide_renderer"),s=t("../../common/plot_widget"),l=t("../../common/properties"),o=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return u(e,t),e.prototype.initialize=function(t,n){return e.__super__.initialize.call(this,t,n),this.grid_props=new l.Line({obj:this.model,prefix:"grid_"}),this.minor_grid_props=new l.Line({obj:this.model,prefix:"minor_grid_"}),this.band_props=new l.Fill({obj:this.model,prefix:"band_"}),this.x_range_name=this.mget("x_range_name"),this.y_range_name=this.mget("y_range_name")},e.prototype.render=function(){var t;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,n,r,o,i,s,a,l,u,h,c,p;if(this.band_props.do_fill)for(r=this.mget("grid_coords"),c=r[0],p=r[1],this.band_props.set_value(t),e=n=0,o=c.length-1;o>=0?o>n:n>o;e=o>=0?++n:--n)e%2===1&&(i=this.plot_view.map_to_screen(c[e],p[e],this.x_range_name,this.y_range_name),a=i[0],u=i[1],s=this.plot_view.map_to_screen(c[e+1],p[e+1],this.x_range_name,this.y_range_name),l=s[0],h=s[1],t.fillRect(a[0],u[0],l[1]-a[0],h[1]-u[0]),t.fill())},e.prototype._draw_grids=function(t){var e,n,r;if(this.grid_props.do_stroke)return e=this.mget("grid_coords"),n=e[0],r=e[1],this._draw_grid_helper(t,this.grid_props,n,r)},e.prototype._draw_minor_grids=function(t){var e,n,r;if(this.minor_grid_props.do_stroke)return e=this.mget("minor_grid_coords"),n=e[0],r=e[1],this._draw_grid_helper(t,this.minor_grid_props,n,r)},e.prototype._draw_grid_helper=function(t,e,n,r){var o,i,s,a,l,u,h,c;for(e.set_value(t),o=i=0,a=n.length;a>=0?a>i:i>a;o=a>=0?++i:--i){for(l=this.plot_view.map_to_screen(n[o],r[o],this.x_range_name,this.y_range_name),h=l[0],c=l[1],t.beginPath(),t.moveTo(Math.round(h[0]),Math.round(c[0])),o=s=1,u=h.length;u>=1?u>s:s>u;o=u>=1?++s:--s)t.lineTo(Math.round(h[o]),Math.round(c[o]));t.stroke()}},e}(s),r=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.prototype.initialize=function(t,n){return e.__super__.initialize.call(this,t,n),this.register_property("computed_bounds",this._bounds,!1),this.add_dependencies("computed_bounds",this,["bounds"]),this.register_property("grid_coords",this._grid_coords,!1),this.add_dependencies("grid_coords",this,["computed_bounds","dimension","ticker"]),this.register_property("minor_grid_coords",this._minor_grid_coords,!1),this.add_dependencies("minor_grid_coords",this,["computed_bounds","dimension","ticker"]),this.register_property("ranges",this._ranges,!0)},e.prototype._ranges=function(){var t,e,n,r;return e=this.get("dimension"),n=(e+1)%2,t=this.get("plot").get("frame"),r=[t.get("x_ranges")[this.get("x_range_name")],t.get("y_ranges")[this.get("y_range_name")]],[r[e],r[n]]},e.prototype._bounds=function(){var t,e,n,r,o,i,s;return o=this.get("ranges"),n=o[0],t=o[1],s=this.get("bounds"),r=[n.get("min"),n.get("max")],a.isArray(s)?(i=Math.min(s[0],s[1]),e=Math.max(s[0],s[1]),i<r[0]?i=r[0]:i>r[1]&&(i=null),e>r[1]?e=r[1]:e<r[0]&&(e=null)):(i=r[0],e=r[1]),[i,e]},e.prototype._grid_coords=function(){return this._grid_coords_helper("major")},e.prototype._minor_grid_coords=function(){return this._grid_coords_helper("minor")},e.prototype._grid_coords_helper=function(t){var e,n,r,o,i,s,a,l,u,h,c,p,_,d,f,m,g,y,v,b,x,w,k,M,j;for(u=this.get("dimension"),c=(u+1)%2,v=this.get("ranges"),y=v[0],i=v[1],b=this.get("computed_bounds"),k=b[0],l=b[1],j=Math.min(k,l),l=Math.max(k,l),k=j,M=this.get("ticker").get_ticks(k,l,y,{})[t],m=y.get("min"),f=y.get("max"),r=i.get("min"),n=i.get("max"),o=[[],[]],h=p=0,x=M.length;x>=0?x>p:p>x;h=x>=0?++p:--p)if(M[h]!==m&&M[h]!==f){for(s=[],a=[],e=2,g=_=0,w=e;w>=0?w>_:_>w;g=w>=0?++_:--_)d=r+(n-r)/(e-1)*g,s.push(M[h]),a.push(d);o[u].push(s),o[c].push(a)}return o},e.prototype.defaults=function(){return a.extend({},e.__super__.defaults.call(this),{x_range_name:"default",y_range_name:"default",level:"underlay",bounds:"auto",dimension:0,ticker:null,band_fill_color:null,band_fill_alpha:0,grid_line_color:"#cccccc",grid_line_width:1,grid_line_alpha:1,grid_line_join:"miter",grid_line_cap:"butt",grid_line_dash:[],grid_line_dash_offset:0,minor_grid_line_color:null,minor_grid_line_width:1,minor_grid_line_alpha:1,minor_grid_line_join:"miter",minor_grid_line_cap:"butt",minor_grid_line_dash:[],minor_grid_line_dash_offset:0})},e}(i.Model),e.exports={Model:r,View:o}},{"../../common/plot_widget":"common/plot_widget","../../common/properties":"common/properties","../renderers/guide_renderer":"models/renderers/guide_renderer",underscore:"underscore"}],"models/layouts/basebox":[function(t,e,n){var r,o,i,s=function(t,e){function n(){this.constructor=t}for(var r in e)a.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},a={}.hasOwnProperty;i=t("underscore"),o=t("./layout"),r=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return s(e,t),e.prototype.type="BaseBox",e.prototype.defaults=function(){return i.extend({},e.__super__.defaults.call(this),{width:null,height:null})},e}(o.Model),e.exports={Model:r}},{"./layout":"models/layouts/layout",underscore:"underscore"}],"models/layouts/grid_plot":[function(t,e,n){var r,o,i,s,a,l,u,h,c,p,_,d,f,m,g,y=function(t,e){function n(){this.constructor=t}for(var r in e)v.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},v={}.hasOwnProperty,b=function(t,e){return function(){return t.apply(e,arguments)}};r=t("jquery"),d=t("underscore"),o=t("backbone"),f=t("../../common/build_views"),s=t("../../common/continuum_view"),i=t("../component"),c=t("../../common/has_props"),m=t("../../common/logging").logger,p=t("../../common/tool_manager"),g=t("../../common/plot_template"),_=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.listenTo(this,"do",this["do"]),this.listenTo(this,"change:active",this.active),null},e.prototype["do"]=function(){var t,e,n,r;for(n=this.attributes.tools,t=0,e=n.length;e>t;t++)r=n[t],r.trigger("do");return null},e.prototype.active=function(){var t,e,n,r;for(n=this.attributes.tools,t=0,e=n.length;e>t;t++)r=n[t],r.set("active",this.attributes.active);return null},e.prototype.attrs_and_props=function(){return this.attributes.tools[0].attrs_and_props()},e.prototype.get=function(t){return this.attributes.tools[0].get(t)},e.prototype.set=function(t,n){var r,o,i,s;for(e.__super__.set.call(this,t,n),t=d.omit(t,"tools"),i=this.attributes.tools,r=0,o=i.length;o>r;r++)s=i[r],s.set(t,n);return null},e}(o.Model),u=function(t){function e(){return this._active_change=b(this._active_change,this),e.__super__.constructor.apply(this,arguments)}return y(e,t),e.prototype._init_tools=function(){var t,e,n,r,o,i,s,a,l,u,h,c,p,f,m,g,y,v,b,x,w,k,M,j,T,z,E;for(i={},t={},n={},m=this.get("tool_managers"),r=0,u=m.length;u>r;r++){M=m[r],g=M.get("gestures");for(e in g){o=g[e],e in n||(n[e]={}),y=o.tools;for(s=0,h=y.length;h>s;s++)T=y[s],T.type in n[e]||(n[e][T.type]=[]),n[e][T.type].push(T)}for(v=M.get("inspectors"),a=0,c=v.length;c>a;a++)T=v[a],T.type in i||(i[T.type]=[]),i[T.type].push(T);for(b=M.get("actions"),l=0,p=b.length;p>l;l++)T=b[l],T.type in t||(t[T.type]=[]),t[T.type].push(T)}for(e in n){x=n[e];for(E in x)z=x[E],z.length===this.get("num_plots")&&(f=new _({tools:z}),this.get("gestures")[e].tools.push(f),this.listenTo(f,"change:active",d.bind(this._active_change,f)))}for(E in t)z=t[E],z.length===this.get("num_plots")&&(f=new _({tools:z}),j=this.get("actions"),j.push(f),this.set("actions",j));for(E in i)z=i[E],z.length===this.get("num_plots")&&(f=new _({tools:z}),j=this.get("inspectors"),j.push(f),this.set("inspectors",j));w=this.get("gestures"),k=[];for(e in w)o=w[e],z=o.tools,0!==z.length&&(o.tools=d.sortBy(z,function(t){return t.get("default_order")}),"pinch"!==e&&"scroll"!==e?k.push(o.tools[0].set("active",!0)):k.push(void 0));return k},e.prototype._active_change=function(t){var e,n,r;return n=t.get("event_type"),r=this.get("gestures"),e=r[n].active,null!=e&&e!==t&&(m.debug("GridToolManager: deactivating tool: "+e.type+" ("+e.id+") for event type '"+n+"'"),e.set("active",!1)),r[n].active=t,this.set("gestures",r),m.debug("GridToolManager: activating tool: "+t.type+" ("+t.id+") for event type '"+n+"'"),null},e.prototype.defaults=function(){return d.extend({},e.__super__.defaults.call(this),{tool_manangers:[]})},e}(p.Model),h=function(t){function e(){return this.layout_widths=b(this.layout_widths,this),this.layout_heights=b(this.layout_heights,this),this.setup_layout_properties=b(this.setup_layout_properties,this),e.__super__.constructor.apply(this,arguments)}return y(e,t),e.prototype.setup_layout_properties=function(){var t,e,n,r,o,i;for(this.register_property("layout_heights",this.layout_heights,!1),this.register_property("layout_widths",this.layout_widths,!1),n=this.get("viewstates"),r=[],t=0,e=n.length;e>t;t++)o=n[t],r.push(function(){var t,e,n;for(n=[],t=0,e=o.length;e>t;t++)i=o[t],this.add_dependencies("layout_heights",i,"height"),n.push(this.add_dependencies("layout_widths",i,"width"));return n}.call(this));return r},e.prototype.initialize=function(t,n){var r,o;return e.__super__.initialize.call(this,t,n),this.setup_layout_properties(),this.listenTo(this,"change:viewstates",this.setup_layout_properties),r=function(t){return function(){return d.reduce(t.get("layout_heights"),function(t,e){return t+e},0)}}(this),this.register_property("height",r,!1),this.add_dependencies("height",this,"layout_heights"),o=function(t){return function(){return d.reduce(t.get("layout_widths"),function(t,e){return t+e},0)}}(this),this.register_property("width",o,!1),this.add_dependencies("width",this,"layout_widths")},e.prototype.position_child_x=function(t,e){return t},e.prototype.position_child_y=function(t,e){return this.get("height")-t-e},e.prototype.maxdim=function(t,e){return 0===e.length?0:d.max(d.map(e,function(e){return null!=e?e.get(t):0}))},e.prototype.layout_heights=function(){var t,e;return e=function(){var e,n,r,o;for(r=this.get("viewstates"),o=[],e=0,n=r.length;n>e;e++)t=r[e],o.push(this.maxdim("height",t));return o}.call(this)},e.prototype.layout_widths=function(){var t,e,n,r,o,i;return o=this.get("viewstates")[0].length,n=function(){var t,e,n,s;for(n=d.range(o),s=[],t=0,e=n.length;e>t;t++)r=n[t],s.push(function(){var t,e,n,o;for(n=this.get("viewstates"),o=[],t=0,e=n.length;e>t;t++)i=n[t],o.push(i[r]);return o}.call(this));return s}.call(this),e=function(){var e,r,o;for(o=[],e=0,r=n.length;r>e;e++)t=n[e],o.push(this.maxdim("width",t));return o}.call(this)},e.prototype.defaults=function(){return d.extend({},e.__super__.defaults.call(this),{viewstates:[[]],border_space:0})},e}(c),l=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return y(e,t),e.prototype.className="",e.prototype.template=g,e.prototype.initialize=function(t){var n,r;return e.__super__.initialize.call(this,t),this.viewstate=new h,this.child_views={},this.build_children(),this.bind_bokeh_events(),this.$el.html(this.template()),n=this.mget("toolbar_location"),null!=n&&(r=".bk-plot-"+n,m.debug("attaching toolbar to "+r+" for plot "+this.model.id),this.tm_view=new p.View({model:this.mget("tool_manager"),el:this.$(r)})),this.render(),this},e.prototype.bind_bokeh_events=function(){return this.listenTo(this.model,"change:children",this.build_children),this.listenTo(this.model,"change",this.render),this.listenTo(this.viewstate,"change",this.render),this.listenTo(this.model,"destroy",this.remove)},e.prototype.build_children=function(){var t,e,n,r,o,i,s,a,l,u,h,c,p,_,d,m,g,y,v;for(t=[],p=this.mget("children"),e=0,i=p.length;i>e;e++)for(g=p[e],n=0,s=g.length;s>n;n++)c=g[n],null!=c&&(c.set("toolbar_location",null),t.push(c));for(f(this.child_views,t,{}),y=[],_=this.mget("children"),r=0,a=_.length;a>r;r++){for(g=_[r],v=[],o=0,l=g.length;l>o;o++)c=g[o],null!=c&&v.push(this.child_views[c.id].canvas);y.push(v)}for(this.viewstate.set("viewstates",y),d=this.mget("children"),m=[],h=0,u=d.length;u>h;h++)g=d[h],m.push(function(){var t,e,n;for(n=[],e=0,t=g.length;t>e;e++)c=g[e],null!=c&&n.push(this.listenTo(c.solver,"layout_update",this.render));return n}.call(this));return m},e.prototype.render=function(){var t,n,o,i,s,a,l,u,h,c,_,f,m,g,y,v,b,x,w,k,M,j,T,z,E,P,S,C,A;for(e.__super__.render.call(this),v=d.values(this.child_views),a=0,c=v.length;c>a;a++)z=v[a],z.$el.detach();for(i=r("<div />"),this.$(".bk-plot-canvas-wrapper").empty(),this.$(".bk-plot-canvas-wrapper").append(i),M=this.mget("toolbar_location"),null!=M&&(j=".bk-plot-"+M,this.tm_view=new p.View({model:this.mget("tool_manager"),el:this.$(j)}),this.tm_view.render()),k=this.viewstate.get("layout_heights"),o=this.viewstate.get("layout_widths"),C=[0],d.reduceRight(k.slice(1),function(t,e){var n;return n=t+e,C.push(n),n},0),C.reverse(),P=[0],d.reduce(o.slice(0),function(t,e){var n;return n=t+e,P.push(n),n},0),g=[],h=null,b=this.mget("children"),x=l=0,_=b.length;_>l;x=++l)for(w=b[x],n=u=0,f=w.length;f>u;n=++u)m=w[n],null!=m&&(z=this.child_views[m.id],A=this.viewstate.position_child_y(C[x],z.canvas.get("height")),S=this.viewstate.position_child_x(P[n],z.canvas.get("width")),y=r("<div class='gp_plotwrapper'></div>"),y.attr("style","position: absolute; left:"+S+"px; top:"+A+"px"),y.append(z.$el),i.append(y));return t=function(t,e){return t+e},T=d.reduce(k,t,0),s=T,E=d.reduce(o,t,0),i.attr("style","position:relative; height:"+s+"px;width:"+E+"px")},e}(s),a=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return y(e,t),e.prototype.type="GridPlot",e.prototype.default_view=l,e.prototype.initialize=function(t,n){return e.__super__.initialize.call(this,t,n),this.register_property("tool_manager",function(){var t,e,n,r,o;for(t=[],o=d.flatten(this.get("children")),e=0,n=o.length;n>e;e++)r=o[e],null!=r&&t.push(r);return new u({tool_managers:function(){var e,n,o;for(o=[],e=0,n=t.length;n>e;e++)r=t[e],o.push(r.get("tool_manager"));return o}(),toolbar_location:this.get("toolbar_location"),num_plots:t.length})},!0)},e.prototype.defaults=function(){return d.extend({},e.__super__.defaults.call(this),{children:[[]],border_space:0,toolbar_location:"left",disabled:!1})},e}(i.Model),e.exports={Model:a,View:l}},{"../../common/build_views":"common/build_views","../../common/continuum_view":"common/continuum_view","../../common/has_props":"common/has_props","../../common/logging":"common/logging","../../common/plot_template":"common/plot_template","../../common/tool_manager":"common/tool_manager","../component":"models/component",backbone:"backbone",jquery:"jquery",underscore:"underscore"}],"models/layouts/hbox":[function(t,e,n){var r,o,i,s,a,l,u,h=function(t,e){function n(){this.constructor=t}for(var r in e)c.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},c={}.hasOwnProperty;l=t("underscore"),r=t("jquery"),u=t("../../common/build_views"),i=t("../../common/continuum_view"),o=t("./basebox"),a=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return h(e,t),e.prototype.tag="div",e.prototype.attributes={"class":"bk-hbox"},e.prototype.initialize=function(t){return e.__super__.initialize.call(this,t),this.views={},this.render(),this.listenTo(this.model,"change",this.render)},e.prototype.render=function(){var t,e,n,o,i,s,a,l,h,p;e=this.model.children(),u(this.views,e),l=this.views;for(s in l)c.call(l,s)&&(h=l[s],h.$el.detach());for(this.$el.empty(),p=this.mget("width"),null!=p&&this.$el.css({width:p+"px"}),n=this.mget("height"),null!=n&&this.$el.css({height:n+"px"}),i=o=0,a=e.length;a>o;i=++o)t=e[i],this.$el.append(this.views[t.id].$el),i<e.length-1&&this.$el.append(r('<div class="bk-hbox-spacer"></div>'));return this},e}(i),s=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return h(e,t),e.prototype.type="HBox",e.prototype.default_view=a,e.prototype.defaults=function(){return l.extend({},e.__super__.defaults.call(this),{children:[]})},e.prototype.children=function(){return this.get("children")},e}(o.Model),e.exports={Model:s,View:a}},{"../../common/build_views":"common/build_views","../../common/continuum_view":"common/continuum_view","./basebox":"models/layouts/basebox",jquery:"jquery",underscore:"underscore"}],"models/layouts/layout":[function(t,e,n){var r,o,i,s=function(t,e){function n(){this.constructor=t}for(var r in e)a.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},a={}.hasOwnProperty;i=t("underscore"),r=t("../component"),o=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return s(e,t),e.prototype.type="Layout",e.prototype.defaults=function(){return i.extend({},e.__super__.defaults.call(this),{width:null,height:null})},e}(r.Model),e.exports={Model:o}},{"../component":"models/component",underscore:"underscore"}],"models/layouts/vbox":[function(t,e,n){var r,o,i,s,a,l,u,h=function(t,e){function n(){this.constructor=t}for(var r in e)c.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},c={}.hasOwnProperty;l=t("underscore"),r=t("jquery"),u=t("../../common/build_views"),i=t("../../common/continuum_view"),o=t("./basebox"),a=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return h(e,t),e.prototype.tag="div",e.prototype.attributes={"class":"bk-vbox"},e.prototype.initialize=function(t){return e.__super__.initialize.call(this,t),this.views={},this.render(),this.listenTo(this.model,"change",this.render)},e.prototype.render=function(){var t,e,n,o,i,s,a,l,h,p,_;e=this.model.children(),u(this.views,e),a=this.views;for(i in a)c.call(a,i)&&(p=a[i],p.$el.detach());for(this.$el.empty(),_=this.mget("width"),null!=_&&this.$el.css({width:_+"px"}),n=this.mget("height"),null!=n?(this.$el.css({height:n+"px"}),h=n/(2*e.length)):h=20,l=r("<div>").addClass("bk-vbox-spacer").css({height:h}),this.$el.append(r(l)),o=0,s=e.length;s>o;o++)t=e[o],this.$el.append(this.views[t.id].$el),this.$el.append(r(l));return this},e}(i),s=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return h(e,t),e.prototype.type="VBox",e.prototype.default_view=a,e.prototype.defaults=function(){return l.extend({},e.__super__.defaults.call(this),{children:[]})},e.prototype.children=function(){return this.get("children")},e}(o.Model),e.exports={Model:s,View:a}},{"../../common/build_views":"common/build_views","../../common/continuum_view":"common/continuum_view","./basebox":"models/layouts/basebox",jquery:"jquery",underscore:"underscore"}],"models/layouts/vboxform":[function(t,e,n){var r,o,i,s,a,l,u=function(t,e){function n(){this.constructor=t}for(var r in e)h.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},h={}.hasOwnProperty;a=t("underscore"),l=t("../../common/build_views"),r=t("../../common/continuum_view"),o=t("./vbox"),s=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return u(e,t),e.prototype.tagName="form",e.prototype.attributes={"class":"bk-widget-form",role:"form"},e.prototype.initialize=function(t){return e.__super__.initialize.call(this,t),this.views={},this.render()},e.prototype.render=function(){var t,e,n,r,o,i,s;e=this.model.children(),l(this.views,e),i=this.views;for(r in i)h.call(i,r)&&(s=i[r],s.$el.detach());for(this.$el.empty(),n=0,o=e.length;o>n;n++)t=e[n],this.$el.append("<br/"),this.$el.append(this.views[t.id].$el);return this},e}(r),i=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return u(e,t),e.prototype.type="VBoxForm",e.prototype.default_view=s,e.prototype.defaults=function(){return a.extend({},e.__super__.defaults.call(this),{children:[]})},e.prototype.children=function(){return this.get("children")},e}(o.Model),e.exports={Model:i,View:s}},{"../../common/build_views":"common/build_views","../../common/continuum_view":"common/continuum_view","./vbox":"models/layouts/vbox",underscore:"underscore"}],"models/mappers/categorical_mapper":[function(t,e,n){var r,o,i,s=function(t,e){function n(){this.constructor=t}for(var r in e)a.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},a={}.hasOwnProperty;i=t("underscore"),o=t("./linear_mapper"),r=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return s(e,t),e.prototype.map_to_target=function(t,n){var r,o,s,a,l,u;return null==n&&(n=!1),i.isNumber(t)?n?t:e.__super__.map_to_target.call(this,t):(a=this.get("source_range"),o=a.get("factors"),t.indexOf(":")>=0?(l=t.split(":"),r=l[0],s=l[1],s=parseFloat(s),u=o.indexOf(r)+.5+a.get("offset")+s):u=o.indexOf(t)+1+a.get("offset"),n?u:e.__super__.map_to_target.call(this,u))},e.prototype.v_map_to_target=function(t,n){var r,o,s,a,l,u,h,c,p,_;if(null==n&&(n=!1),i.isNumber(t[0]))return n?t:e.__super__.v_map_to_target.call(this,t);for(u=this.get("source_range"),o=u.get("factors"),p=Array(t.length),s=a=0,h=t.length;h>=0?h>a:a>h;s=h>=0?++a:--a)_=t[s],_.indexOf(":")>=0?(c=_.split(":"),r=c[0],l=c[1],l=parseFloat(l),p[s]=o.indexOf(r)+.5+u.get("offset")+l):p[s]=o.indexOf(_)+1+u.get("offset");return n?p:e.__super__.v_map_to_target.call(this,p)},e.prototype.map_from_target=function(t,n){var r,o;return null==n&&(n=!1),t=e.__super__.map_from_target.call(this,t),n?t:(o=this.get("source_range"),r=o.get("factors"),r[Math.floor(t-.5-o.get("offset"))])},e.prototype.v_map_from_target=function(t,n){var r,o,i,s,a,l,u,h,c;for(null==n&&(n=!1),c=e.__super__.v_map_from_target.call(this,t),o=i=0,l=c.length;l>=0?l>i:i>l;o=l>=0?++i:--i)c[o]=c[o];if(n)return c;for(h=Array(c),a=this.get("source_range"),r=a.get("factors"),o=s=0,u=t.length;u>=0?u>s:s>u;o=u>=0?++s:--s)h[o]=r[Math.floor(c[o]-.5-a.get("offset"))];return h},e}(o.Model),e.exports={Model:r}},{"./linear_mapper":"models/mappers/linear_mapper",underscore:"underscore"}],"models/mappers/grid_mapper":[function(t,e,n){var r,o,i=function(t,e){function n(){this.constructor=t}for(var r in e)s.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},s={}.hasOwnProperty;o=t("../../model"),r=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return i(e,t),e.prototype.map_to_target=function(t,e){var n,r;return n=this.get("domain_mapper").map_to_target(t),r=this.get("codomain_mapper").map_to_target(e),[n,r]},e.prototype.v_map_to_target=function(t,e){var n,r;return n=this.get("domain_mapper").v_map_to_target(t),r=this.get("codomain_mapper").v_map_to_target(e),[n,r]},e.prototype.map_from_target=function(t,e){var n,r;return n=this.get("domain_mapper").map_from_target(t),r=this.get("codomain_mapper").map_from_target(e),[n,r]},e.prototype.v_map_from_target=function(t,e){var n,r;return n=this.get("domain_mapper").v_map_from_target(t),r=this.get("codomain_mapper").v_map_from_target(e),[n,r]},e}(o),e.exports={Model:r}},{"../../model":"model"}],"models/mappers/linear_color_mapper":[function(t,e,n){var r,o,i,s=function(t,e){function n(){this.constructor=t}for(var r in e)a.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},a={}.hasOwnProperty;i=t("underscore"),o=t("../../model"),r=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return s(e,t),e.prototype.initialize=function(t,n){return e.__super__.initialize.call(this,t,n),this.palette=this._build_palette(this.get("palette")),this.little_endian=this._is_little_endian(),null!=this.get("reserve_color")?(this.reserve_color=parseInt(this.get("reserve_color").slice(1),16),this.reserve_val=this.get("reserve_val")):void 0},e.prototype.defaults=function(){return i.extend({},e.__super__.defaults.call(this),{high:null,low:null,palette:null,reserve_val:null,reserve_color:"#ffffff"})},e.prototype.v_map_screen=function(t){var e,n,r,o,s,a,l,u,h,c,p,_,d,f,m,g;if(n=new ArrayBuffer(4*t.length),r=new Uint32Array(n),h=null!=(p=this.get("low"))?p:i.min(t),s=null!=(_=this.get("high"))?_:i.max(t),e=this.palette.length-1,m=e/(s-h),c=-m*h,this.little_endian)for(a=l=0,d=t.length;d>=0?d>l:l>d;a=d>=0?++l:--l)o=t[a],o===this.reserve_val?g=this.reserve_color:(o>s&&(o=s),h>o&&(o=h),g=this.palette[Math.floor(o*m+c)]),r[a]=255<<24|(16711680&g)>>16|65280&g|(255&g)<<16;else for(a=u=0,f=t.length;f>=0?f>u:u>f;a=f>=0?++u:--u)o=t[a],o===this.reserve_val?g=this.reserve_color:(o>s&&(o=s),h>o&&(o=h),g=this.palette[Math.floor(o*m+c)]),r[a]=g<<8|255;return n},e.prototype._is_little_endian=function(){var t,e,n,r;return t=new ArrayBuffer(4),n=new Uint8ClampedArray(t),e=new Uint32Array(t),e[1]=168496141,r=!0,10===n[4]&&11===n[5]&&12===n[6]&&13===n[7]&&(r=!1),r},e.prototype._build_palette=function(t){var e,n,r,o,s;for(o=new Uint32Array(t.length+1),e=function(t){return i.isNumber(t)?t:parseInt(t.slice(1),16)},n=r=0,s=t.length;s>=0?s>r:r>s;n=s>=0?++r:--r)o[n]=e(t[n]);return o[o.length-1]=e(t[t.length-1]),o},e}(o),e.exports={Model:r}},{"../../model":"model",underscore:"underscore"}],"models/mappers/linear_mapper":[function(t,e,n){var r,o,i=function(t,e){function n(){this.constructor=t}for(var r in e)s.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},s={}.hasOwnProperty;o=t("../../model"),r=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return i(e,t),e.prototype.initialize=function(t,n){return e.__super__.initialize.call(this,t,n),this.register_property("mapper_state",this._mapper_state,!0),this.add_dependencies("mapper_state",this,["source_range","target_range"]),this.add_dependencies("mapper_state",this.get("source_range"),["start","end"]),this.add_dependencies("mapper_state",this.get("target_range"),["start","end"])},e.prototype.map_to_target=function(t){var e,n,r;return n=this.get("mapper_state"),r=n[0],e=n[1],r*t+e},e.prototype.v_map_to_target=function(t){var e,n,r,o,i,s,a,l;for(i=this.get("mapper_state"),a=i[0],o=i[1],s=new Float64Array(t.length),n=e=0,r=t.length;r>e;n=++e)l=t[n],s[n]=a*l+o;return s},e.prototype.map_from_target=function(t){var e,n,r;return n=this.get("mapper_state"),r=n[0],e=n[1],(t-e)/r},e.prototype.v_map_from_target=function(t){var e,n,r,o,i,s,a,l;for(i=this.get("mapper_state"),a=i[0],o=i[1],s=new Float64Array(t.length),n=e=0,r=t.length;r>e;n=++e)l=t[n],s[n]=(l-o)/a;return s},e.prototype._mapper_state=function(){var t,e,n,r,o,i;return r=this.get("source_range").get("start"),n=this.get("source_range").get("end"),i=this.get("target_range").get("start"),o=this.get("target_range").get("end"),e=(o-i)/(n-r),t=-(e*r)+i,[e,t]},e}(o),e.exports={Model:r}},{"../../model":"model"}],"models/mappers/log_mapper":[function(t,e,n){var r,o,i=function(t,e){function n(){this.constructor=t}for(var r in e)s.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},s={}.hasOwnProperty;o=t("../../model"),r=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return i(e,t),e.prototype.initialize=function(t,n){return e.__super__.initialize.call(this,t,n),this.register_property("mapper_state",this._mapper_state,!0),this.add_dependencies("mapper_state",this,["source_range","target_range"]),this.add_dependencies("mapper_state",this.get("source_range"),["start","end"]),this.add_dependencies("mapper_state",this.get("target_range"),["start","end"])},e.prototype.map_to_target=function(t){var e,n,r,o,i,s,a;return i=this.get("mapper_state"),a=i[0],o=i[1],n=i[2],e=i[3],s=0,0===n?r=0:(r=(Math.log(t)-e)/n,(isNaN(r)||!isFinite(r))&&(r=0)),s=r*a+o},e.prototype.v_map_to_target=function(t){var e,n,r,o,i,s,a,l,u,h,c,p,_;if(h=this.get("mapper_state"),
|
|
p=h[0],u=h[1],r=h[2],n=h[3],c=new Float64Array(t.length),0===r)o=t.map(function(t){return 0});else for(o=t.map(function(t){return(Math.log(t)-n)/r}),e=i=0,a=o.length;a>i;e=++i)_=o[e],(isNaN(o[e])||!isFinite(o[e]))&&(o[e]=0);for(e=s=0,l=t.length;l>s;e=++s)_=t[e],c[e]=o[e]*p+u;return c},e.prototype.map_from_target=function(t){var e,n,r,o,i,s;return i=this.get("mapper_state"),s=i[0],o=i[1],n=i[2],e=i[3],r=(t-o)/s,r=Math.exp(n*r+e)},e.prototype.v_map_from_target=function(t){var e,n,r,o,i,s,a,l,u,h,c;for(u=new Float64Array(t.length),l=this.get("mapper_state"),h=l[0],a=l[1],r=l[2],n=l[3],o=t.map(function(t){return(t-a)/h}),e=i=0,s=t.length;s>i;e=++i)c=t[e],u[e]=Math.exp(r*o[e]+n);return u},e.prototype._get_safe_scale=function(t,e){var n,r,o,i;return i=0>t?0:t,n=0>e?0:e,i===n&&(0===i?(o=[1,10],i=o[0],n=o[1]):(r=Math.log(i)/Math.log(10),i=Math.pow(10,Math.floor(r)),n=Math.ceil(r)!==Math.floor(r)?Math.pow(10,Math.ceil(r)):Math.pow(10,Math.ceil(r)+1))),[i,n]},e.prototype._mapper_state=function(){var t,e,n,r,o,i,s,a,l,u,h,c;return l=this.get("source_range").get("start"),a=this.get("source_range").get("end"),c=this.get("target_range").get("start"),h=this.get("target_range").get("end"),s=h-c,o=this._get_safe_scale(l,a),u=o[0],t=o[1],0===u?(n=Math.log(t),e=0):(n=Math.log(t)-Math.log(u),e=Math.log(u)),i=s,r=c,[i,r,n,e]},e}(o),e.exports={Model:r}},{"../../model":"model"}],"models/markers/asterisk":[function(t,e,n){var r,o,i,s,a=function(t,e){function n(){this.constructor=t}for(var r in e)l.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},l={}.hasOwnProperty;s=t("underscore"),i=t("./marker"),o=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return a(e,t),e.prototype._render=function(t,e,n){var r,o,i,s,a,l,u,h,c,p;for(c=n.sx,p=n.sy,h=n.size,r=n.angle,u=[],i=0,s=e.length;s>i;i++)o=e[i],isNaN(c[o]+p[o]+h[o]+r[o])||(a=h[o]/2,l=.65*a,t.beginPath(),t.translate(c[o],p[o]),r[o]&&t.rotate(r[o]),t.moveTo(0,a),t.lineTo(0,-a),t.moveTo(-a,0),t.lineTo(a,0),t.moveTo(-l,l),t.lineTo(l,-l),t.moveTo(-l,-l),t.lineTo(l,l),r[o]&&t.rotate(-r[o]),this.visuals.line.do_stroke&&(this.visuals.line.set_vectorize(t,o),t.stroke()),u.push(t.translate(-c[o],-p[o])));return u},e}(i.View),r=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return a(e,t),e.prototype.default_view=o,e.prototype.type="Asterisk",e.prototype.props=["line"],e}(i.Model),e.exports={Model:r,View:o}},{"./marker":"models/markers/marker",underscore:"underscore"}],"models/markers/circle_cross":[function(t,e,n){var r,o,i,s,a=function(t,e){function n(){this.constructor=t}for(var r in e)l.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},l={}.hasOwnProperty;s=t("underscore"),i=t("./marker"),o=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return a(e,t),e.prototype._render=function(t,e,n){var r,o,i,s,a,l,u,h,c;for(h=n.sx,c=n.sy,u=n.size,r=n.angle,l=[],i=0,s=e.length;s>i;i++)o=e[i],isNaN(h[o]+c[o]+u[o]+r[o])||(a=u[o]/2,t.beginPath(),t.translate(h[o],c[o]),t.arc(0,0,a,0,2*Math.PI,!1),this.visuals.fill.do_fill&&(this.visuals.fill.set_vectorize(t,o),t.fill()),this.visuals.line.do_stroke&&(this.visuals.line.set_vectorize(t,o),r[o]&&t.rotate(r[o]),t.moveTo(0,a),t.lineTo(0,-a),t.moveTo(-a,0),t.lineTo(a,0),r[o]&&t.rotate(-r[o]),t.stroke()),l.push(t.translate(-h[o],-c[o])));return l},e}(i.View),r=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return a(e,t),e.prototype.default_view=o,e.prototype.type="CircleCross",e}(i.Model),e.exports={Model:r,View:o}},{"./marker":"models/markers/marker",underscore:"underscore"}],"models/markers/circle_x":[function(t,e,n){var r,o,i,s,a=function(t,e){function n(){this.constructor=t}for(var r in e)l.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},l={}.hasOwnProperty;s=t("underscore"),i=t("./marker"),o=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return a(e,t),e.prototype._render=function(t,e,n){var r,o,i,s,a,l,u,h,c;for(h=n.sx,c=n.sy,u=n.size,r=n.angle,l=[],i=0,s=e.length;s>i;i++)o=e[i],isNaN(h[o]+c[o]+u[o]+r[o])||(a=u[o]/2,t.beginPath(),t.translate(h[o],c[o]),t.arc(0,0,a,0,2*Math.PI,!1),this.visuals.fill.do_fill&&(this.visuals.fill.set_vectorize(t,o),t.fill()),this.visuals.line.do_stroke&&(this.visuals.line.set_vectorize(t,o),r[o]&&t.rotate(r[o]),t.moveTo(-a,a),t.lineTo(a,-a),t.moveTo(-a,-a),t.lineTo(a,a),r[o]&&t.rotate(-r[o]),t.stroke()),l.push(t.translate(-h[o],-c[o])));return l},e}(i.View),r=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return a(e,t),e.prototype.default_view=o,e.prototype.type="CircleX",e}(i.Model),e.exports={Model:r,View:o}},{"./marker":"models/markers/marker",underscore:"underscore"}],"models/markers/cross":[function(t,e,n){var r,o,i,s,a=function(t,e){function n(){this.constructor=t}for(var r in e)l.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},l={}.hasOwnProperty;s=t("underscore"),i=t("./marker"),o=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return a(e,t),e.prototype._render=function(t,e,n){var r,o,i,s,a,l,u,h,c;for(h=n.sx,c=n.sy,u=n.size,r=n.angle,l=[],i=0,s=e.length;s>i;i++)o=e[i],isNaN(h[o]+c[o]+u[o]+r[o])||(a=u[o]/2,t.beginPath(),t.translate(h[o],c[o]),r[o]&&t.rotate(r[o]),t.moveTo(0,a),t.lineTo(0,-a),t.moveTo(-a,0),t.lineTo(a,0),r[o]&&t.rotate(-r[o]),this.visuals.line.do_stroke&&(this.visuals.line.set_vectorize(t,o),r[o]&&t.rotate(r[o]),t.stroke(),r[o]&&t.rotate(-r[o])),l.push(t.translate(-h[o],-c[o])));return l},e}(i.View),r=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return a(e,t),e.prototype.default_view=o,e.prototype.type="Cross",e.prototype.props=["line"],e}(i.Model),e.exports={Model:r,View:o}},{"./marker":"models/markers/marker",underscore:"underscore"}],"models/markers/diamond":[function(t,e,n){var r,o,i,s,a=function(t,e){function n(){this.constructor=t}for(var r in e)l.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},l={}.hasOwnProperty;s=t("underscore"),i=t("./marker"),o=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return a(e,t),e.prototype._render=function(t,e,n){var r,o,i,s,a,l,u,h,c;for(h=n.sx,c=n.sy,u=n.size,r=n.angle,l=[],i=0,s=e.length;s>i;i++)o=e[i],isNaN(h[o]+c[o]+u[o]+r[o])||(a=u[o]/2,t.beginPath(),t.translate(h[o],c[o]),r[o]&&t.rotate(r[o]),t.moveTo(0,a),t.lineTo(a/1.5,0),t.lineTo(0,-a),t.lineTo(-a/1.5,0),r[o]&&t.rotate(-r[o]),t.translate(-h[o],-c[o]),t.closePath(),this.visuals.fill.do_fill&&(this.visuals.fill.set_vectorize(t,o),t.fill()),this.visuals.line.do_stroke?(this.visuals.line.set_vectorize(t,o),l.push(t.stroke())):l.push(void 0));return l},e}(i.View),r=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return a(e,t),e.prototype.default_view=o,e.prototype.type="Diamond",e}(i.Model),e.exports={Model:r,View:o}},{"./marker":"models/markers/marker",underscore:"underscore"}],"models/markers/diamond_cross":[function(t,e,n){var r,o,i,s,a=function(t,e){function n(){this.constructor=t}for(var r in e)l.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},l={}.hasOwnProperty;s=t("underscore"),i=t("./marker"),o=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return a(e,t),e.prototype._render=function(t,e,n){var r,o,i,s,a,l,u,h,c;for(h=n.sx,c=n.sy,u=n.size,r=n.angle,l=[],i=0,s=e.length;s>i;i++)o=e[i],isNaN(h[o]+c[o]+u[o]+r[o])||(a=u[o]/2,t.beginPath(),t.translate(h[o],c[o]),r[o]&&t.rotate(r[o]),t.moveTo(0,a),t.lineTo(a/1.5,0),t.lineTo(0,-a),t.lineTo(-a/1.5,0),r[o]&&t.rotate(-r[o]),t.closePath(),this.visuals.fill.do_fill&&(this.visuals.fill.set_vectorize(t,o),t.fill()),this.visuals.line.do_stroke&&(this.visuals.line.set_vectorize(t,o),r[o]&&t.rotate(r[o]),t.moveTo(0,a),t.lineTo(0,-a),t.moveTo(-a/1.5,0),t.lineTo(a/1.5,0),r[o]&&t.rotate(-r[o]),t.stroke()),l.push(t.translate(-h[o],-c[o])));return l},e}(i.View),r=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return a(e,t),e.prototype.default_view=o,e.prototype.type="DiamondCross",e}(i.Model),e.exports={Model:r,View:o}},{"./marker":"models/markers/marker",underscore:"underscore"}],"models/markers/inverted_triangle":[function(t,e,n){var r,o,i,s,a=function(t,e){function n(){this.constructor=t}for(var r in e)l.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},l={}.hasOwnProperty;s=t("underscore"),i=t("./marker"),o=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return a(e,t),e.prototype._render=function(t,e,n){var r,o,i,s,a,l,u,h,c,p,_;for(p=n.sx,_=n.sy,c=n.size,o=n.angle,h=[],a=0,l=e.length;l>a;a++)s=e[a],isNaN(p[s]+_[s]+c[s]+o[s])||(r=c[s]*Math.sqrt(3)/6,u=c[s]/2,i=c[s]*Math.sqrt(3)/2,t.beginPath(),t.translate(p[s],_[s]),o[s]&&t.rotate(o[s]),t.moveTo(-u,-r),t.lineTo(u,-r),t.lineTo(0,-r+i),o[s]&&t.rotate(-o[s]),t.translate(-p[s],-_[s]),t.closePath(),this.visuals.fill.do_fill&&(this.visuals.fill.set_vectorize(t,s),t.fill()),this.visuals.line.do_stroke?(this.visuals.line.set_vectorize(t,s),h.push(t.stroke())):h.push(void 0));return h},e}(i.View),r=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return a(e,t),e.prototype.default_view=o,e.prototype.type="InvertedTriangle",e}(i.Model),e.exports={Model:r,View:o}},{"./marker":"models/markers/marker",underscore:"underscore"}],"models/markers/marker":[function(t,e,n){var r,o,i,s,a,l=function(t,e){function n(){this.constructor=t}for(var r in e)u.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},u={}.hasOwnProperty;s=t("underscore"),r=t("../glyphs/glyph"),a=t("../../common/hittest"),i=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return l(e,t),e.prototype.draw_legend=function(t,e,n,r,o){var i,s,a,l,u,h,c,p;return u=null!=(l=this.get_reference_point())?l:0,a=[u],c={},c[u]=(e+n)/2,p={},p[u]=(r+o)/2,h={},h[u]=.4*Math.min(Math.abs(n-e),Math.abs(o-r)),i={},i[u]=0,s={sx:c,sy:p,size:h,angle:i},this._render(t,a,s)},e.prototype._index_data=function(){return this._xy_index()},e.prototype._mask_data=function(t){var e,n,r,o,i,s,a,l,u,h,c,p,_,d,f;return e=this.renderer.plot_view.frame.get("h_range"),a=e.get("start")-this.max_size,l=e.get("end")+this.max_size,n=this.renderer.xmapper.v_map_from_target([a,l],!0),p=n[0],_=n[1],r=[Math.min(p,_),Math.max(p,_)],p=r[0],_=r[1],s=this.renderer.plot_view.frame.get("v_range"),u=s.get("start")-this.max_size,h=s.get("end")+this.max_size,o=this.renderer.ymapper.v_map_from_target([u,h],!0),d=o[0],f=o[1],i=[Math.min(d,f),Math.max(d,f)],d=i[0],f=i[1],function(){var t,e,n,r;for(n=this.index.search([p,d,_,f]),r=[],t=0,e=n.length;e>t;t++)c=n[t],r.push(c[4].i);return r}.call(this)},e.prototype._hit_point=function(t){var e,n,r,o,i,l,u,h,c,p,_,d,f,m,g,y,v,b,x,w,k,M,j,T;for(u=[t.vx,t.vy],m=u[0],v=u[1],d=this.renderer.plot_view.canvas.vx_to_sx(m),f=this.renderer.plot_view.canvas.vy_to_sy(v),g=m-this.max_size,y=m+this.max_size,h=this.renderer.xmapper.v_map_from_target([g,y],!0),k=h[0],M=h[1],b=v-this.max_size,x=v+this.max_size,c=this.renderer.ymapper.v_map_from_target([b,x],!0),j=c[0],T=c[1],e=function(){var t,e,n,r;for(n=this.index.search([k,j,M,T]),r=[],t=0,e=n.length;e>t;t++)w=n[t],r.push(w[4].i);return r}.call(this),r=[],i=0,l=e.length;l>i;i++)o=e[i],_=this.size[o]/2,n=Math.abs(this.sx[o]-d)+Math.abs(this.sy[o]-f),Math.abs(this.sx[o]-d)<=_&&Math.abs(this.sy[o]-f)<=_&&r.push([o,n]);return p=a.create_hit_test_result(),p["1d"].indices=s.chain(r).sortBy(function(t){return t[1]}).map(function(t){return t[0]}).value(),p},e.prototype._hit_rect=function(t){var e,n,r,o,i,s,l,u;return e=this.renderer.xmapper.v_map_from_target([t.vx0,t.vx1],!0),i=e[0],s=e[1],n=this.renderer.ymapper.v_map_from_target([t.vy0,t.vy1],!0),l=n[0],u=n[1],r=a.create_hit_test_result(),r["1d"].indices=function(){var t,e,n,r;for(n=this.index.search([i,l,s,u]),r=[],t=0,e=n.length;e>t;t++)o=n[t],r.push(o[4].i);return r}.call(this),r},e.prototype._hit_poly=function(t){var e,n,r,o,i,s,l,u,h,c,p,_,d;for(s=[t.vx,t.vy],_=s[0],d=s[1],c=this.renderer.plot_view.canvas.v_vx_to_sx(_),p=this.renderer.plot_view.canvas.v_vy_to_sy(d),e=function(){h=[];for(var t=0,e=this.sx.length;e>=0?e>t:t>e;e>=0?t++:t--)h.push(t);return h}.apply(this),n=[],r=i=0,l=e.length;l>=0?l>i:i>l;r=l>=0?++i:--i)o=e[r],a.point_in_poly(this.sx[r],this.sy[r],c,p)&&n.push(o);return u=a.create_hit_test_result(),u["1d"].indices=n,u},e}(r.View),o=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return l(e,t),e.prototype.distances=["size"],e.prototype.angles=["angle"],e.prototype.defaults=function(){return s.extend({},e.__super__.defaults.call(this),{size:{units:"screen",value:4},angle:0})},e}(r.Model),e.exports={Model:o,View:i}},{"../../common/hittest":"common/hittest","../glyphs/glyph":"models/glyphs/glyph",underscore:"underscore"}],"models/markers/square":[function(t,e,n){var r,o,i,s,a,l=function(t,e){function n(){this.constructor=t}for(var r in e)u.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},u={}.hasOwnProperty;s=t("underscore"),r=t("./marker"),a=t("../glyphs/bokehgl"),i=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return l(e,t),e.prototype._init_gl=function(t){return this.glglyph=new a.SquareGLGlyph(t,this)},e.prototype._render=function(t,e,n){var r,o,i,s,a,l,u,h;for(u=n.sx,h=n.sy,l=n.size,r=n.angle,a=[],i=0,s=e.length;s>i;i++)o=e[i],isNaN(u[o]+h[o]+l[o]+r[o])||(t.beginPath(),t.translate(u[o],h[o]),r[o]&&t.rotate(r[o]),t.rect(-l[o]/2,-l[o]/2,l[o],l[o]),r[o]&&t.rotate(-r[o]),this.visuals.fill.do_fill&&(this.visuals.fill.set_vectorize(t,o),t.fill()),this.visuals.line.do_stroke&&(this.visuals.line.set_vectorize(t,o),t.stroke()),a.push(t.translate(-u[o],-h[o])));return a},e}(r.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="Square",e}(r.Model),e.exports={Model:o,View:i}},{"../glyphs/bokehgl":"models/glyphs/bokehgl","./marker":"models/markers/marker",underscore:"underscore"}],"models/markers/square_cross":[function(t,e,n){var r,o,i,s,a=function(t,e){function n(){this.constructor=t}for(var r in e)l.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},l={}.hasOwnProperty;s=t("underscore"),r=t("./marker"),i=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return a(e,t),e.prototype._render=function(t,e,n){var r,o,i,s,a,l,u,h,c;for(h=n.sx,c=n.sy,u=n.size,r=n.angle,l=[],i=0,s=e.length;s>i;i++)o=e[i],isNaN(h[o]+c[o]+u[o]+r[o])||(t.beginPath(),t.translate(h[o],c[o]),r[o]&&t.rotate(r[o]),t.rect(-u[o]/2,-u[o]/2,u[o],u[o]),r[o]&&t.rotate(-r[o]),this.visuals.fill.do_fill&&(this.visuals.fill.set_vectorize(t,o),t.fill()),this.visuals.line.do_stroke&&(this.visuals.line.set_vectorize(t,o),a=u[o]/2,r[o]&&t.rotate(r[o]),t.moveTo(0,a),t.lineTo(0,-a),t.moveTo(-a,0),t.lineTo(a,0),r[o]&&t.rotate(-r[o]),t.stroke()),l.push(t.translate(-h[o],-c[o])));return l},e}(r.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="SquareCross",e}(r.Model),e.exports={Model:o,View:i}},{"./marker":"models/markers/marker",underscore:"underscore"}],"models/markers/square_x":[function(t,e,n){var r,o,i,s,a=function(t,e){function n(){this.constructor=t}for(var r in e)l.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},l={}.hasOwnProperty;s=t("underscore"),r=t("./marker"),i=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return a(e,t),e.prototype._render=function(t,e,n){var r,o,i,s,a,l,u,h,c;for(h=n.sx,c=n.sy,u=n.size,r=n.angle,l=[],i=0,s=e.length;s>i;i++)o=e[i],isNaN(h[o]+c[o]+u[o]+r[o])||(t.beginPath(),t.translate(h[o],c[o]),r[o]&&t.rotate(r[o]),t.rect(-u[o]/2,-u[o]/2,u[o],u[o]),r[o]&&t.rotate(-r[o]),this.visuals.fill.do_fill&&(this.visuals.fill.set_vectorize(t,o),t.fill()),this.visuals.line.do_stroke&&(this.visuals.line.set_vectorize(t,o),t.stroke(),a=u[o]/2,r[o]&&t.rotate(r[o]),t.moveTo(-a,a),t.lineTo(a,-a),t.moveTo(-a,-a),t.lineTo(a,a),r[o]&&t.rotate(-r[o]),t.stroke()),l.push(t.translate(-h[o],-c[o])));return l},e}(r.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="SquareX",e}(r.Model),e.exports={Model:o,View:i}},{"./marker":"models/markers/marker",underscore:"underscore"}],"models/markers/triangle":[function(t,e,n){var r,o,i,s,a=function(t,e){function n(){this.constructor=t}for(var r in e)l.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},l={}.hasOwnProperty;s=t("underscore"),r=t("./marker"),i=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return a(e,t),e.prototype._render=function(t,e,n){var r,o,i,s,a,l,u,h,c,p,_;for(p=n.sx,_=n.sy,c=n.size,o=n.angle,h=[],a=0,l=e.length;l>a;a++)s=e[a],isNaN(p[s]+_[s]+c[s]+o[s])||(r=c[s]*Math.sqrt(3)/6,u=c[s]/2,i=c[s]*Math.sqrt(3)/2,t.beginPath(),t.translate(p[s],_[s]),o[s]&&t.rotate(o[s]),t.moveTo(-u,r),t.lineTo(u,r),t.lineTo(0,r-i),o[s]&&t.rotate(-o[s]),t.translate(-p[s],-_[s]),t.closePath(),this.visuals.fill.do_fill&&(this.visuals.fill.set_vectorize(t,s),t.fill()),this.visuals.line.do_stroke?(this.visuals.line.set_vectorize(t,s),h.push(t.stroke())):h.push(void 0));return h},e}(r.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="Triangle",e}(r.Model),e.exports={Model:o,View:i}},{"./marker":"models/markers/marker",underscore:"underscore"}],"models/markers/x":[function(t,e,n){var r,o,i,s,a=function(t,e){function n(){this.constructor=t}for(var r in e)l.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},l={}.hasOwnProperty;s=t("underscore"),r=t("./marker"),i=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return a(e,t),e.prototype._render=function(t,e,n){var r,o,i,s,a,l,u,h,c;for(h=n.sx,c=n.sy,u=n.size,r=n.angle,l=[],i=0,s=e.length;s>i;i++)o=e[i],isNaN(h[o]+c[o]+u[o]+r[o])||(a=u[o]/2,t.beginPath(),t.translate(h[o],c[o]),r[o]&&t.rotate(r[o]),t.moveTo(-a,a),t.lineTo(a,-a),t.moveTo(-a,-a),t.lineTo(a,a),r[o]&&t.rotate(-r[o]),this.visuals.line.do_stroke&&(this.visuals.line.set_vectorize(t,o),t.stroke()),l.push(t.translate(-h[o],-c[o])));return l},e}(r.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="X",e.prototype.props=["line"],e}(r.Model),e.exports={Model:o,View:i}},{"./marker":"models/markers/marker",underscore:"underscore"}],"models/plots/gmap_plot":[function(t,e,n){var r,o,i,s,a,l,u,h=function(t,e){return function(){return t.apply(e,arguments)}},c=function(t,e){function n(){this.constructor=t}for(var r in e)p.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},p={}.hasOwnProperty;a=t("underscore"),s=t("../../common/solver"),i=t("./plot"),l=t("proj4"),u=l.defs("GOOGLE"),o=function(t){function e(){return this.setRanges=h(this.setRanges,this),this.getProjectedBounds=h(this.getProjectedBounds,this),this.getLatLngBounds=h(this.getLatLngBounds,this),e.__super__.constructor.apply(this,arguments)}return c(e,t),e.prototype.initialize=function(t){return e.__super__.initialize.call(this,a.defaults(t,this.default_options)),this.zoom_count=0},e.prototype.getLatLngBounds=function(){var t,e,n,r,o,i,s;return e=this.map.getBounds(),n=e.getNorthEast(),t=e.getSouthWest(),o=t.lng(),r=n.lng(),s=t.lat(),i=n.lat(),[o,r,s,i]},e.prototype.getProjectedBounds=function(){var t,e,n,r,o,i,s,a,h,c,p;return o=this.getLatLngBounds(),h=o[0],a=o[1],p=o[2],c=o[3],i=l(u,[h,p]),e=i[0],r=i[1],s=l(u,[a,c]),t=s[0],n=s[1],[e,t,r,n]},e.prototype.setRanges=function(){var t,e,n,r,o;return o=this.getProjectedBounds(),e=o[0],t=o[1],r=o[2],n=o[3],this.x_range.set({start:e,end:t,silent:!0}),this.y_range.set({start:r,end:n,silent:!0})},e.prototype.update_range=function(t){var n,r,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,r=this.map.getZoom(),n=r+u,n>=2&&(this.map.setZoom(n),l=this.getProjectedBounds(),i=l[0],o=l[1],a=l[2],s=l[3],0>o-i&&this.map.setZoom(r)),this.setRanges()}return this.unpause()},e.prototype.bind_bokeh_events=function(){var t,n,r,o,i,s;return e.__super__.bind_bokeh_events.call(this),s=this.frame.get("width"),n=this.frame.get("height"),r=this.canvas.vx_to_sx(this.frame.get("left")),i=this.canvas.vy_to_sy(this.frame.get("top")),this.canvas_view.map_div.attr("style","top: "+i+"px; left: "+r+"px; position: absolute"),this.canvas_view.map_div.attr("style","width:"+s+"px;"),this.canvas_view.map_div.attr("style","height:"+n+"px;"),this.canvas_view.map_div.width(s+"px").height(n+"px"),this.initial_zoom=this.mget("map_options").zoom,t=function(t){return function(){var e,n,r,o;return r=window.google.maps,n={satellite:r.MapTypeId.SATELLITE,terrain:r.MapTypeId.TERRAIN,roadmap:r.MapTypeId.ROADMAP,hybrid:r.MapTypeId.HYBRID},o=t.mget("map_options"),e={center:new r.LatLng(o.lat,o.lng),zoom:o.zoom,disableDefaultUI:!0,mapTypeId:n[o.map_type]},null!=o.styles&&(e.styles=JSON.parse(o.styles)),t.map=new r.Map(t.canvas_view.map_div[0],e),r.event.addListenerOnce(t.map,"idle",t.setRanges)}}(this),null==window._bokeh_gmap_loads&&(window._bokeh_gmap_loads=[]),null!=window.google&&null!=window.google.maps?a.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 a.each(window._bokeh_gmap_loads,a.defer)},o=document.createElement("script"),o.type="text/javascript",o.src="https://maps.googleapis.com/maps/api/js?v=3&callback=_bokeh_gmap_callback",document.body.appendChild(o))},e.prototype._map_hook=function(t,e){var n,r,o,i;return r=e[0],o=e[1],i=e[2],n=e[3],this.canvas_view.map_div.attr("style","top: "+o+"px; left: "+r+"px;"),this.canvas_view.map_div.width(i+"px").height(n+"px")},e.prototype._paint_empty=function(t,e){var n,r,o,i,s,a;return s=this.canvas.get("width"),i=this.canvas.get("height"),o=e[0],a=e[1],r=e[2],n=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+r,a),t.lineTo(o+r,a+n),t.lineTo(o,a+n),t.lineTo(o,a),t.closePath(),t.fillStyle=this.mget("border_fill"),t.fill()},e}(i.View),r=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return c(e,t),e.prototype.type="GMapPlot",e.prototype.default_view=o,e.prototype.defaults=function(){return a.extend({},e.__super__.defaults.call(this),{map_options:null,disabled:!1})},e.prototype.initialize=function(t,n){return this.use_map=!0,e.__super__.initialize.call(this,t,n)},e}(i.Model),e.exports={Model:r,View:o}},{"../../common/solver":"common/solver","./plot":"models/plots/plot",proj4:"proj4",underscore:"underscore"}],"models/plots/plot":[function(t,e,n){var r,o,i,s,a,l,u,h,c,p,_,d,f,m,g,y,v,b,x,w,k,M,j,T,z,E,P,S,C,A,O=function(t,e){return function(){return t.apply(e,arguments)}},N=function(t,e){function n(){this.constructor=t}for(var r in e)q.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},q={}.hasOwnProperty,F=[].indexOf||function(t){for(var e=0,n=this.length;n>e;e++)if(e in this&&this[e]===t)return e;return-1};M=t("underscore"),r=t("jquery"),o=t("backbone"),E=t("kiwi"),c=E.Expression,l=E.Constraint,g=E.Operator,h=g.Eq,f=g.Le,p=g.Ge,j=t("../../common/build_views"),i=t("../../common/canvas"),s=t("../../common/cartesian_frame"),u=t("../../common/continuum_view"),k=t("../../common/ui_events"),a=t("../component"),d=t("../../common/layout_box"),P=t("../../common/logging").logger,C=t("../../common/plot_utils"),b=t("../../common/solver"),w=t("../../common/tool_manager"),S=t("../../common/plot_template"),A=t("../../common/properties"),_=t("../renderers/glyph_renderer"),x=t("../../common/tool_events"),z=null,m=50,T=function(t){return function(t,e,n,r,o,i){var s,a,l,u;return t&&(l=Math.max(n,i),s=parseInt(l/o),i>s&&(s=i,l=parseInt(s*o))),e&&(a=Math.max(r,i),u=parseInt(a*o),i>u&&(u=i,a=parseInt(u/o))),e||t?e&&t?u>l?[l,s]:[u,a]:e?[u,a]:[l,s]:null}}(this),v=function(t){function e(){return this.resize_width_height=O(this.resize_width_height,this),this.resize=O(this.resize,this),this.remove=O(this.remove,this),this.request_render=O(this.request_render,this),e.__super__.constructor.apply(this,arguments)}return N(e,t),e.prototype.className="bk-plot",e.prototype.template=S,e.prototype.state={history:[],index:-1},e.prototype.view_options=function(){return M.extend({plot_model:this.model,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(!0)},e.prototype.remove=function(){var t,n,r,o;e.__super__.remove.call(this),n=this.tools,r=[];for(t in n)o=n[t],r.push(o.remove());return r},e.prototype.initialize=function(t){var n,o,i,s,a,l,u,h,c,p;for(e.__super__.initialize.call(this,t),this.pause(),this._initial_state_info={range:null,selection:{},dimensions:{width:this.mget("canvas").get("width"),height:this.mget("canvas").get("height")}},this.model.initialize_layout(this.model.solver),this.frame=this.mget("frame"),this.x_range=this.frame.get("x_ranges")["default"],this.y_range=this.frame.get("y_ranges")["default"],this.xmapper=this.frame.get("x_mappers")["default"],this.ymapper=this.frame.get("y_mappers")["default"],this.$el.html(this.template()),this.canvas=this.mget("canvas"),this.canvas_view=new this.canvas.default_view({model:this.canvas}),this.$(".bk-plot-canvas-wrapper").append(this.canvas_view.el),this.canvas_view.render(),(this.mget("webgl")||window.location.search.indexOf("webgl=1")>0)&&-1===window.location.search.indexOf("webgl=0")&&this.init_webgl(),this.throttled_render=C.throttle_animation(this.render,15),this.outline_props=new A.Line({obj:this.model,prefix:"outline_"}),this.title_props=new A.Text({obj:this.model,prefix:"title_"}),this.background_props=new A.Fill({obj:this.model,prefix:"background_"}),this.border_props=new A.Fill({obj:this.model,prefix:"border_"}),this.renderers={},this.tools={},this.levels={},a=C.LEVELS,o=0,i=a.length;i>o;o++)s=a[o],this.levels[s]={};this.build_levels(),this.bind_bokeh_events(),this.model.add_constraints(this.canvas.solver),this.listenTo(this.canvas.solver,"layout_update",this.request_render),this.ui_event_bus=new k({tool_manager:this.mget("tool_manager"),hit_area:this.canvas_view.$el}),l=this.tools;for(n in l)h=l[n],this.ui_event_bus.register_tool(h);return c=this.mget("toolbar_location"),null!=c&&(p=".bk-plot-"+c,P.debug("attaching toolbar to "+p+" for plot "+this.model.id),this.tm_view=new w.View({model:this.mget("tool_manager"),el:this.$(p)})),this.update_dataranges(),this.mget("responsive")&&(u=M.throttle(this.resize,100),r(window).on("resize",u),M.delay(this.resize,10)),this.unpause(),P.debug("PlotView initialized"),this},e.prototype.init_webgl=function(){var t,e;return t=z,null==t&&(z=t=document.createElement("canvas"),e={premultipliedAlpha:!0},t.gl=t.getContext("webgl",e)||t.getContext("experimental-webgl",e)),null!=t.gl?this.canvas_view.ctx.glcanvas=t:P.warn("WebGL is not supported, falling back to 2D canvas.")},e.prototype.update_dataranges=function(){var t,e,n,r,o,i,s,a,l,u,h,c,p,_,d,f,m,g,y,v,b,x,w;r=this.model.get("frame"),e={},d=this.renderers;for(s in d)b=d[s],t=null!=(f=b.glyph)&&"function"==typeof f.bounds?f.bounds():void 0,null!=t&&(e[s]=t);for(n=!1,o=!1,m=M.values(r.get("x_ranges")),i=0,l=m.length;l>i;i++)x=m[i],"function"==typeof x.update&&x.update(e,0,this.model.id),null!=x.get("follow")&&(n=!0),null!=x.get("bounds")&&(o=!0);for(g=M.values(r.get("y_ranges")),a=0,u=g.length;u>a;a++)w=g[a],"function"==typeof w.update&&w.update(e,1,this.model.id),null!=w.get("follow")&&(n=!0),null!=w.get("bounds")&&(o=!0);if(n&&o){for(P.warn("Follow enabled so bounds are unset."),y=M.values(r.get("x_ranges")),p=0,h=y.length;h>p;p++)x=y[p],x.set("bounds",null);for(v=M.values(r.get("y_ranges")),_=0,c=v.length;c>_;_++)w=v[_],w.set("bounds",null)}return this.range_update_timestamp=Date.now()},e.prototype.map_to_screen=function(t,e,n,r){return null==n&&(n="default"),null==r&&(r="default"),this.frame.map_to_screen(t,e,this.canvas,n,r)},e.prototype.push_state=function(t,e){var n,r;return n=(null!=(r=this.state.history[this.state.index])?r.info:void 0)||{},e=M.extend({},this._initial_state_info,n,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(){return this.can_undo()?(this.state.index-=1,this._do_state_change(this.state.index),this.trigger("state_changed")):void 0},e.prototype.redo=function(){return this.can_redo()?(this.state.index+=1,this._do_state_change(this.state.index),this.trigger("state_changed")):void 0},e.prototype._do_state_change=function(t){var e,n;return e=(null!=(n=this.state.history[t])?n.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?this.update_dimensions(e.dimensions):void 0},e.prototype.update_dimensions=function(t){return this.canvas._set_dims([t.width,t.height])},e.prototype.reset_dimensions=function(){return this.update_dimensions({width:this.canvas.get("canvas_width"),height:this.canvas.get("canvas_height")})},e.prototype.get_selection=function(){var t,e,n,r,o,i;for(i=[],n=this.mget("renderers"),t=0,e=n.length;e>t;t++)r=n[t],r instanceof _.Model&&(o=r.get("data_source").get("selected"),i[r.id]=o);return i},e.prototype.update_selection=function(t){var e,n,r,o,i,s,a;for(o=this.mget("renderers"),a=[],n=0,r=o.length;r>n;n++)s=o[n],s instanceof _.Model&&(e=s.get("data_source"),null!=t?(i=s.id,F.call(t,i)>=0?a.push(e.set("selected",t[s.id])):a.push(void 0)):a.push(e.get("selection_manager").clear()));return a},e.prototype.reset_selection=function(){return this.update_selection(null)},e.prototype._update_single_range=function(t,e,n){var r,o,i,s;return s=t.get("start")>t.get("end")?!0:!1,null!=t.get("bounds")&&(o=t.get("bounds")[0],r=t.get("bounds")[1],s?(null!=o&&o>=e.end&&(e.end=o,null!=n&&(e.start=t.get("start"))),null!=r&&r<=e.start&&(e.start=r,null!=n&&(e.end=t.get("end")))):(null!=o&&o>=e.start&&(e.start=o,null!=n&&(e.end=t.get("end"))),null!=r&&r<=e.end&&(e.end=r,null!=n&&(e.start=t.get("start"))))),t.get("start")!==e.start||t.get("end")!==e.end?(t.have_updated_interactively=!0,t.set(e),null!=(i=t.get("callback"))?i.execute(t):void 0):void 0},e.prototype.update_range=function(t,e){var n,r,o,i,s,a;if(this.pause,null==t){r=this.frame.get("x_ranges");for(n in r)a=r[n],a.reset();o=this.frame.get("y_ranges");for(n in o)a=o[n],a.reset();this.update_dataranges()}else{i=this.frame.get("x_ranges");for(n in i)a=i[n],this._update_single_range(a,t.xrs[n],e);s=this.frame.get("y_ranges");for(n in s)a=s[n],this._update_single_range(a,t.yrs[n],e)}return this.unpause();
|
|
},e.prototype.reset_range=function(){return this.update_range(null)},e.prototype.build_levels=function(){var t,e,n,r,o,i,s,a,l,u,h,c,p,_;for(l=M.keys(this.renderers),_=j(this.renderers,this.mget("renderers"),this.view_options()),u=M.difference(l,M.pluck(this.mget("renderers"),"id")),e=0,r=u.length;r>e;e++)t=u[e],delete this.levels.glyph[t];for(c=j(this.tools,this.mget("tools"),this.view_options()),n=0,o=_.length;o>n;n++)p=_[n],s=p.mget("level"),this.levels[s][p.model.id]=p,p.bind_bokeh_events();for(a=0,i=c.length;i>a;a++)h=c[a],s=h.mget("level"),this.levels[s][h.model.id]=h,h.bind_bokeh_events();return this},e.prototype.bind_bokeh_events=function(){var t,e,n,r;e=this.mget("frame").get("x_ranges");for(t in e)r=e[t],this.listenTo(r,"change",this.request_render);n=this.mget("frame").get("y_ranges");for(t in n)r=n[t],this.listenTo(r,"change",this.request_render);return this.listenTo(this.model,"change:renderers",this.build_levels),this.listenTo(this.model,"change:tool",this.build_levels),this.listenTo(this.model,"change",this.request_render),this.listenTo(this.model,"destroy",function(t){return function(){return t.remove()}}(this))},e.prototype.set_initial_range=function(){var t,e,n,r,o,i,s;t=!0,i={},n=this.frame.get("x_ranges");for(e in n){if(o=n[e],null==o.get("start")||null==o.get("end")||M.isNaN(o.get("start")+o.get("end"))){t=!1;break}i[e]={start:o.get("start"),end:o.get("end")}}if(t){s={},r=this.frame.get("y_ranges");for(e in r){if(o=r[e],null==o.get("start")||null==o.get("end")||M.isNaN(o.get("start")+o.get("end"))){t=!1;break}s[e]={start:o.get("start"),end:o.get("end")}}}return t?(this._initial_state_info.range=this.initial_range_info={xrs:i,yrs:s},P.debug("initial ranges set")):P.warn("could not set initial ranges")},e.prototype.render=function(t){var n,r,o,i,s,a,l,u,h,c,p,_,d,f,m,g,y,v,b,x,w,k;null==t&&(t=!1),P.trace("Plot.render(force_canvas="+t+")"),Date.now()-this.interactive_timestamp<this.mget("lod_interval")?(this.interactive=!0,c=this.mget("lod_timeout"),setTimeout(function(t){return function(){return t.interactive&&Date.now()-t.interactive_timestamp>c&&(t.interactive=!1),t.request_render()}}(this),c)):this.interactive=!1,k=this.mget("plot_width"),u=this.mget("plot_height"),(this.canvas.get("canvas_width")!==k||this.canvas.get("canvas_height")!==u)&&this.canvas._set_dims([k,u],v=!1),e.__super__.render.call(this),this.canvas_view.render(t),null!=this.tm_view&&this.tm_view.render(),r=this.canvas_view.ctx,s=this.model.get("frame"),n=this.model.get("canvas"),p=this.renderers;for(h in p)b=p[h],null!=b.model.update_layout&&b.model.update_layout(b,this.canvas.solver);_=this.renderers;for(h in _)if(b=_[h],null==this.range_update_timestamp||b.set_data_timestamp>this.range_update_timestamp){this.update_dataranges();break}return y=this.mget("title"),y&&(this.title_props.set_value(this.canvas_view.ctx),g=r.measureText(this.mget("title")).ascent+this.model.get("title_standoff"),g!==this.model.title_panel.get("height")&&this.model.title_panel.set("height",g)),this.model.get("frame").set("width",n.get("width")-1),this.model.get("frame").set("height",n.get("height")-1),this.canvas.solver.update_variables(!1),this.model.get("frame")._update_mappers(),a=[this.canvas.vx_to_sx(this.frame.get("left")),this.canvas.vy_to_sy(this.frame.get("top")),this.frame.get("width"),this.frame.get("height")],this._map_hook(r,a),this._paint_empty(r,a),r.glcanvas&&(r.glcanvas.width=this.canvas_view.canvas[0].width,r.glcanvas.height=this.canvas_view.canvas[0].height,l=r.glcanvas.gl,l.viewport(0,0,r.glcanvas.width,r.glcanvas.height),l.clearColor(0,0,0,0),l.clear(l.COLOR_BUFFER_BIT||l.DEPTH_BUFFER_BIT),l.enable(l.SCISSOR_TEST),i=r.glcanvas.height-(a[1]+a[3]),l.scissor(a[0],i,a[2],a[3]),l.enable(l.BLEND),l.blendFuncSeparate(l.SRC_ALPHA,l.ONE_MINUS_SRC_ALPHA,l.ONE_MINUS_DST_ALPHA,l.ONE)),this.outline_props.do_stroke&&(this.outline_props.set_value(r),r.strokeRect.apply(r,a)),this._render_levels(r,["image","underlay","glyph","annotation"],a),r.glcanvas&&(d=.5,o=0,r.drawImage(r.glcanvas,d,d,r.glcanvas.width,r.glcanvas.height,o,o,r.glcanvas.width,r.glcanvas.height),P.debug("drawing with WebGL")),this._render_levels(r,["overlay","tool"]),y&&(x=function(){switch(this.title_props.align.value()){case"left":return 0;case"center":return this.canvas.get("width")/2;case"right":return this.canvas.get("width")}}.call(this),w=this.model.title_panel.get("bottom")+this.model.get("title_standoff"),f=this.canvas.vx_to_sx(x),m=this.canvas.vy_to_sy(w),this.title_props.set_value(r),r.fillText(y,f,m)),null==this.initial_range_info?this.set_initial_range():void 0},e.prototype.resize=function(){return this.resize_width_height(!0,!1)},e.prototype.resize_width_height=function(t,e,n){var r,o,i,s,a;if(null==n&&(n=!0),this._re_resized=this._re_resized||0,!this.el.parentNode&&this._re_resized<14)return setTimeout(function(r){return function(){return r.resize_width_height(t,e,n)}}(this),Math.pow(2,this._re_resized)),void(this._re_resized+=1);if(i=this.el.clientWidth,o=this.el.parentNode.clientHeight-50,s=this.mget("min_size"),n===!1){if(t&&e)return this.canvas._set_dims([Math.max(s,i),Math.max(s,o)]);if(t)return this.canvas._set_dims([Math.max(s,i),this.canvas.get("height")]);if(e)return this.canvas._set_dims([this.canvas.get("width"),Math.max(s,o)])}else if(r=this.canvas.get("width")/this.canvas.get("height"),a=T(t,e,i,o,r,s),null!=a)return this.canvas._set_dims(a)},e.prototype._render_levels=function(t,e,n){var r,o,i,s,a,l,u,h,c,p,_,d,f,m;for(t.save(),null!=n&&(t.beginPath(),t.rect.apply(t,n),t.clip(),t.beginPath()),o={},p=this.mget("renderers"),r=i=0,a=p.length;a>i;r=++i)_=p[r],o[_.id]=r;for(m=function(t){return o[t.model.id]},s=0,l=e.length;l>s;s++)for(h=e[s],f=M.sortBy(M.values(this.levels[h]),m),c=0,u=f.length;u>c;c++)d=f[c],d.render();return t.restore()},e.prototype._map_hook=function(t,e){},e.prototype._paint_empty=function(t,e){return this.border_props.set_value(t),t.fillRect(0,0,this.canvas_view.mget("width"),this.canvas_view.mget("height")),t.clearRect.apply(t,e),this.background_props.set_value(t),t.fillRect.apply(t,e)},e}(u),y=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return N(e,t),e.prototype.type="Plot",e.prototype.default_view=v,e.prototype.initialize=function(t,n){var r,o,s,a,l,u,h,c,p,_,d;for(e.__super__.initialize.call(this,t,n),h=M.values(this.get("extra_x_ranges")).concat(this.get("x_range")),o=0,a=h.length;a>o;o++)_=h[o],_=this.resolve_ref(_),u=_.get("plots"),M.isArray(u)&&(u=u.concat(this),_.set("plots",u));for(c=M.values(this.get("extra_y_ranges")).concat(this.get("y_range")),s=0,l=c.length;l>s;s++)d=c[s],d=this.resolve_ref(d),u=d.get("plots"),M.isArray(u)&&(u=u.concat(this),d.set("plots",u));return r=new i.Model({map:null!=(p=this.use_map)?p:!1,canvas_width:this.get("plot_width"),canvas_height:this.get("plot_height"),hidpi:this.get("hidpi"),solver:new b}),this.set("canvas",r),this.solver=r.get("solver"),this.set("tool_manager",new w.Model({tools:this.get("tools"),toolbar_location:this.get("toolbar_location"),logo:this.get("logo")})),P.debug("Plot initialized")},e.prototype.initialize_layout=function(t){var e,n,r;return n=function(e){return function(n,r){var o,i,s,a,l;for(a=e.get(n),o=null,i=0,s=a.length;s>i;i++)if(l=a[i],l.get("name")===r){o=l;break}return null!=o?o.set("solver",t):(o=new d.Model({name:r,solver:t}),a.push(o),e.set(n,a)),o}}(this),e=this.get("canvas"),r=new s.Model({x_range:this.get("x_range"),extra_x_ranges:this.get("extra_x_ranges"),x_mapper_type:this.get("x_mapper_type"),y_range:this.get("y_range"),extra_y_ranges:this.get("extra_y_ranges"),y_mapper_type:this.get("y_mapper_type"),solver:t}),this.set("frame",r),this.title_panel=n("above","title_panel"),this.title_panel._anchor=this.title_panel._bottom},e.prototype.add_constraints=function(t){var e,n,r,o,i;return i=this.get("min_border_top"),n=this.get("min_border_bottom"),r=this.get("min_border_left"),o=this.get("min_border_right"),e=function(t){return function(e,n,r,o,i,s){var a,u,_,f,m,g,y,v,b,x,w,k;for(f=t.get("canvas"),g=t.get("frame"),a=new d.Model({solver:e}),u="_"+o[0],_="_"+o[1],e.add_constraint(new l(new c(a["_"+i],-n),p),E.Strength.strong),e.add_constraint(new l(new c(g[u],[-1,a[_]]),h)),e.add_constraint(new l(new c(a[u],[-1,f[u]]),h)),v=g,m=t.get(r),y=0,b=m.length;b>y;y++)w=m[y],(null!=(k=w.get("location"))?k:!0)?w.set("layout_location",r,{silent:!0}):w.set("layout_location",w.get("location"),{silent:!0}),null!=w.initialize_layout&&w.initialize_layout(e),e.add_constraint(new l(new c(v[u],[-1,w[_]]),h),E.Strength.strong),v=w;return x=new d.Model({solver:e}),e.add_constraint(new l(new c(v[u],[-1,x[_]]),h),E.Strength.strong),e.add_constraint(new l(new c(x[u],[-1,f[u]]),h),E.Strength.strong)}}(this),e(t,i,"above",["top","bottom"],"height",f),e(t,n,"below",["bottom","top"],"height",p),e(t,r,"left",["left","right"],"width",p),e(t,o,"right",["right","left"],"width",f)},e.prototype.add_renderers=function(t){var e;return e=this.get("renderers"),e=e.concat(t),this.set("renderers",e)},e.prototype.nonserializable_attribute_names=function(){return e.__super__.nonserializable_attribute_names.call(this).concat(["solver","canvas","tool_manager","frame","min_size"])},e.prototype.serializable_attributes=function(){var t;return t=e.__super__.serializable_attributes.call(this),"renderers"in t&&(t.renderers=M.filter(t.renderers,function(t){return t.serializable_in_document()})),t},e.prototype.defaults=function(){return M.extend({},e.__super__.defaults.call(this),{renderers:[],tools:[],tool_events:new x.Model,h_symmetry:!0,v_symmetry:!1,x_mapper_type:"auto",y_mapper_type:"auto",plot_width:600,plot_height:600,title:"",above:[],below:[],left:[],right:[],toolbar_location:"above",logo:"normal",lod_factor:10,lod_interval:300,lod_threshold:2e3,lod_timeout:500,webgl:!1,responsive:!1,min_size:120,hidpi:!0,title_standoff:8,x_range:null,extra_x_ranges:{},y_range:null,extra_y_ranges:{},background_fill_color:"#ffffff",background_fill_alpha:1,border_fill_color:"#ffffff",border_fill_alpha:1,min_border:m,min_border_top:m,min_border_left:m,min_border_bottom:m,min_border_right:m,title_text_font:"helvetica",title_text_font_size:"20pt",title_text_font_style:"normal",title_text_color:"#444444",title_text_alpha:1,title_text_align:"center",title_text_baseline:"alphabetic",outline_line_color:"#aaaaaa",outline_line_width:1,outline_line_alpha:1,outline_line_join:"miter",outline_line_cap:"butt",outline_line_dash:[],outline_line_dash_offset:0})},e}(a.Model),e.exports={get_size_for_available_space:T,Model:y,View:v}},{"../../common/build_views":"common/build_views","../../common/canvas":"common/canvas","../../common/cartesian_frame":"common/cartesian_frame","../../common/continuum_view":"common/continuum_view","../../common/layout_box":"common/layout_box","../../common/logging":"common/logging","../../common/plot_template":"common/plot_template","../../common/plot_utils":"common/plot_utils","../../common/properties":"common/properties","../../common/solver":"common/solver","../../common/tool_events":"common/tool_events","../../common/tool_manager":"common/tool_manager","../../common/ui_events":"common/ui_events","../component":"models/component","../renderers/glyph_renderer":"models/renderers/glyph_renderer",backbone:"backbone",jquery:"jquery",kiwi:"kiwi",underscore:"underscore"}],"models/ranges/data_range":[function(t,e,n){var r,o,i,s=function(t,e){function n(){this.constructor=t}for(var r in e)a.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},a={}.hasOwnProperty;i=t("underscore"),o=t("./range"),r=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return s(e,t),e.prototype.type="DataRange",e.prototype.defaults=function(){return i.extend({},e.__super__.defaults.call(this),{names:[],renderers:[]})},e}(o.Model),e.exports={Model:r}},{"./range":"models/ranges/range",underscore:"underscore"}],"models/ranges/data_range1d":[function(t,e,n){var r,o,i,s,a,l=function(t,e){function n(){this.constructor=t}for(var r in e)u.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},u={}.hasOwnProperty;i=t("underscore"),s=t("../../common/bbox"),a=t("../../common/logging").logger,r=t("./data_range"),o=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return l(e,t),e.prototype.type="DataRange1d",e.prototype.initialize=function(t,n){return e.__super__.initialize.call(this,t,n),this.register_property("min",function(){return Math.min(this.get("start"),this.get("end"))},!0),this.add_dependencies("min",this,["start","end"]),this.register_property("max",function(){return Math.max(this.get("start"),this.get("end"))},!0),this.add_dependencies("max",this,["start","end"]),this.register_property("computed_renderers",function(){return this._compute_renderers()},!0),this.add_dependencies("computed_renderers",this,["plots","renderers","names"]),this.plot_bounds={},this.have_updated_interactively=!1,this._initial_start=this.get("start"),this._initial_end=this.get("end"),this._initial_range_padding=this.get("range_padding"),this._initial_follow=this.get("follow"),this._initial_follow_interval=this.get("follow_interval"),this._initial_default_span=this.get("default_span")},e.prototype._compute_renderers=function(){var t,e,n,r,o,i,s,l,u,h,c;if(i=this.get("names"),h=this.get("renderers"),0===h.length)for(u=this.get("plots"),e=0,r=u.length;r>e;e++)s=u[e],t=s.get("renderers"),c=function(){var e,n,r;for(r=[],e=0,n=t.length;n>e;e++)l=t[e],"GlyphRenderer"===l.type&&r.push(l);return r}(),h=h.concat(c);for(i.length>0&&(h=function(){var t,e,n;for(n=[],t=0,e=h.length;e>t;t++)l=h[t],i.indexOf(l.get("name"))>=0&&n.push(l);return n}()),a.debug("computed "+h.length+" renderers for DataRange1d "+this.id),n=0,o=h.length;o>n;n++)l=h[n],a.trace(" - "+l.type+" "+l.id);return h},e.prototype._compute_plot_bounds=function(t,e){var n,r,o,i;for(i=new s.empty,n=0,r=t.length;r>n;n++)o=t[n],null!=e[o.id]&&(i=s.extend(i,e[o.id]));return i},e.prototype._compute_min_max=function(t,e){var n,r,o,i,a,l;i=new s.empty;for(n in t)l=t[n],i=s.extend(i,l);return a=i[e],o=a[0],r=a[1],[o,r]},e.prototype._compute_range=function(t,e){var n,r,o,i,s,a,l,u,h,c;return s=this.get("range_padding"),null!=s&&s>0?(h=e===t?this.get("default_span"):(e-t)*(1+s),n=(e+t)/2,a=[n-h/2,n+h/2],c=a[0],r=a[1]):(l=[t,e],c=l[0],r=l[1]),i=1,this.get("flipped")&&(u=[r,c],c=u[0],r=u[1],i=-1),o=this.get("follow_interval"),null!=o&&Math.abs(c-r)>o&&("start"===this.get("follow")?r=c+i*o:"end"===this.get("follow")&&(c=r-i*o)),[c,r]},e.prototype.update=function(t,e,n){var r,o,i,s,a,l,u,h,c,p,_;if(!this.have_updated_interactively)return p=this.get("computed_renderers"),this.plot_bounds[n]=this._compute_plot_bounds(p,t),u=this._compute_min_max(this.plot_bounds,e),a=u[0],s=u[1],h=this._compute_range(a,s),_=h[0],i=h[1],null!=this._initial_start&&(_=this._initial_start),null!=this._initial_end&&(i=this._initial_end),c=[this.get("start"),this.get("end")],o=c[0],r=c[1],(_!==o||i!==r)&&(l={},_!==o&&(l.start=_),i!==r&&(l.end=i),this.set(l)),"auto"===this.get("bounds")?this.set("bounds",[_,i]):void 0},e.prototype.reset=function(){return this.have_updated_interactively=!1,this.set({range_padding:this._initial_range_padding,follow:this._initial_follow,follow_interval:this._initial_follow_interval,default_span:this._initial_default_span})},e.prototype.nonserializable_attribute_names=function(){return e.__super__.nonserializable_attribute_names.call(this).concat(["plots"])},e.prototype.defaults=function(){return i.extend({},e.__super__.defaults.call(this),{start:null,end:null,range_padding:.1,flipped:!1,follow:null,follow_interval:null,default_span:2,plots:[],bounds:null})},e}(r.Model),e.exports={Model:o}},{"../../common/bbox":"common/bbox","../../common/logging":"common/logging","./data_range":"models/ranges/data_range",underscore:"underscore"}],"models/ranges/factor_range":[function(t,e,n){var r,o,i,s=function(t,e){function n(){this.constructor=t}for(var r in e)a.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},a={}.hasOwnProperty;i=t("underscore"),o=t("./range"),r=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return s(e,t),e.prototype.type="FactorRange",e.prototype.initialize=function(t,n){return e.__super__.initialize.call(this,t,n),null!=this.get("bounds")&&"auto"!==this.get("bounds")?this.set("_bounds_as_factors",this.get("bounds")):this.set("_bounds_as_factors",this.get("factors")),this._init(),this.register_property("min",function(){return this.get("start")},!1),this.add_dependencies("min",this,["factors","offset"]),this.register_property("max",function(){return this.get("end")},!1),this.add_dependencies("max",this,["factors","offset"]),this.listenTo(this,"change:factors",this._update_factors),this.listenTo(this,"change:offset",this._init)},e.prototype.reset=function(){return this._init()},e.prototype._update_factors=function(){return this.set("_bounds_as_factors",this.get("factors")),this._init()},e.prototype._init=function(){var t,e,n;return e=this.get("factors"),null!=this.get("bounds")&&"auto"!==this.get("bounds")&&(e=this.get("_bounds_as_factors"),this.set("factors",e)),n=.5+this.get("offset"),t=e.length+n,this.set("start",n),this.set("end",t),null!=this.get("bounds")?this.set("bounds",[n,t]):void 0},e.prototype.defaults=function(){return i.extend({},e.__super__.defaults.call(this),{offset:0,factors:[],bounds:null})},e}(o.Model),e.exports={Model:r}},{"./range":"models/ranges/range",underscore:"underscore"}],"models/ranges/range":[function(t,e,n){var r,o,i,s=function(t,e){function n(){this.constructor=t}for(var r in e)a.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},a={}.hasOwnProperty;i=t("underscore"),r=t("../../model"),o=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return s(e,t),e.prototype.type="Range",e.prototype.defaults=function(){return i.extend({},e.__super__.defaults.call(this),{callback:null})},e.prototype.reset=function(){},e}(r),e.exports={Model:o}},{"../../model":"model",underscore:"underscore"}],"models/ranges/range1d":[function(t,e,n){var r,o,i,s=function(t,e){function n(){this.constructor=t}for(var r in e)a.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},a={}.hasOwnProperty;i=t("underscore"),r=t("./range"),o=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return s(e,t),e.prototype.type="Range1d",e.prototype._set_auto_bounds=function(){var t,e;return"auto"===this.get("bounds")?(e=Math.min(this._initial_start,this._initial_end),t=Math.max(this._initial_start,this._initial_end),this.set("bounds",[e,t])):void 0},e.prototype.initialize=function(t,n){return e.__super__.initialize.call(this,t,n),this.register_property("min",function(){return Math.min(this.get("start"),this.get("end"))},!0),this.add_dependencies("min",this,["start","end"]),this.register_property("max",function(){return Math.max(this.get("start"),this.get("end"))},!0),this.add_dependencies("max",this,["start","end"]),this._initial_start=this.get("start"),this._initial_end=this.get("end"),this._set_auto_bounds()},e.prototype.reset=function(){return this.set({start:this._initial_start,end:this._initial_end}),this._set_auto_bounds()},e.prototype.defaults=function(){return i.extend({},e.__super__.defaults.call(this),{start:0,end:1,bounds:null})},e}(r.Model),e.exports={Model:o}},{"./range":"models/ranges/range",underscore:"underscore"}],"models/renderers/glyph_renderer":[function(t,e,n){var r,o,i,s,a,l,u,h=function(t,e){function n(){this.constructor=t}for(var r in e)c.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},c={}.hasOwnProperty;l=t("underscore"),u=t("../../common/logging").logger,a=t("./renderer"),i=t("../../common/plot_widget"),s=t("../sources/remote_data_source"),o=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return h(e,t),e.prototype.initialize=function(t){var n,r,o,i;return e.__super__.initialize.call(this,t),this.glyph=this.build_glyph_view(this.mget("glyph")),i=this.mget("selection_glyph"),null==i&&(i=this.mget("glyph").clone(),i.set(this.model.selection_defaults,{silent:!0})),this.selection_glyph=this.build_glyph_view(i),o=this.mget("nonselection_glyph"),null==o&&(o=this.mget("glyph").clone(),o.set(this.model.nonselection_defaults,{silent:!0})),this.nonselection_glyph=this.build_glyph_view(o),r=this.mget("hover_glyph"),null!=r&&(this.hover_glyph=this.build_glyph_view(r)),n=this.mget("glyph").clone(),n.set(this.model.decimated_defaults,{silent:!0}),this.decimated_glyph=this.build_glyph_view(n),this.xmapper=this.plot_view.frame.get("x_mappers")[this.mget("x_range_name")],this.ymapper=this.plot_view.frame.get("y_mappers")[this.mget("y_range_name")],this.set_data(!1),this.mget("data_source")instanceof s.Model?this.mget("data_source").setup(this.plot_view,this.glyph):void 0},e.prototype.build_glyph_view=function(t){return new t.default_view({model:t,renderer:this})},e.prototype.bind_bokeh_events=function(){return this.listenTo(this.model,"change",this.request_render),this.listenTo(this.mget("data_source"),"change",this.set_data),this.listenTo(this.mget("data_source"),"stream",this.set_data),this.listenTo(this.mget("data_source"),"select",this.request_render),null!=this.hover_glyph&&this.listenTo(this.mget("data_source"),"inspect",this.request_render),this.listenTo(this.mget("glyph"),"propchange",function(){return this.glyph.set_visuals(this.mget("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 n,r,o,i,s,a,l,h,c;for(null==t&&(t=!0),c=Date.now(),h=this.mget("data_source"),this.glyph.set_data(h,e),this.glyph.set_visuals(h),this.decimated_glyph.set_visuals(h),this.have_selection_glyphs()&&(this.selection_glyph.set_visuals(h),this.nonselection_glyph.set_visuals(h)),null!=this.hover_glyph&&this.hover_glyph.set_visuals(h),i=h.get_length(),null==i&&(i=1),this.all_indices=function(){l=[];for(var t=0;i>=0?i>t:t>i;i>=0?t++:t--)l.push(t);return l}.apply(this),s=this.plot_model.get("lod_factor"),this.decimated=[],r=o=0,a=Math.floor(this.all_indices.length/s);a>=0?a>o:o>a;r=a>=0?++o:--o)this.decimated.push(this.all_indices[r*s]);return n=Date.now()-c,u.debug(this.glyph.model.type+" GlyphRenderer ("+this.model.id+"): set_data finished in "+n+"ms"),this.set_data_timestamp=Date.now(),t?this.request_render():void 0},e.prototype.render=function(){var t,e,n,r,o,i,s,a,h,c,p,_,d,f,m,g,y,v,b,x,w,k,M,j,T,z;if(k=Date.now(),s=this.glyph.glglyph,M=Date.now(),this.glyph.map_data(),e=Date.now()-k,j=Date.now(),c=s?this.all_indices:this.glyph._mask_data(this.all_indices),n=Date.now()-j,t=this.plot_view.canvas_view.ctx,t.save(),b=this.mget("data_source").get("selected"),b=b&&0!==b.length?b["0d"].glyph?c:b["1d"].indices.length>0?b["1d"].indices:b["2d"].indices.length>0?b["2d"].indices:[]:[],p=this.mget("data_source").get("inspected"),p=p&&0!==p.length?p["0d"].glyph?c:p["1d"].indices.length>0?p["1d"].indices:p["2d"].indices.length>0?p["2d"].indices:[]:[],g=this.plot_model.get("lod_threshold"),this.plot_view.interactive&&!s&&null!=g&&this.all_indices.length>g?(c=this.decimated,a=this.decimated_glyph,v=this.decimated_glyph,w=this.selection_glyph):(a=this.glyph,v=this.nonselection_glyph,w=this.selection_glyph),null!=this.hover_glyph&&p.length&&(c=l.without.bind(null,c).apply(null,p)),b.length&&this.have_selection_glyphs()){for(z=Date.now(),x={},_=0,f=b.length;f>_;_++)h=b[_],x[h]=!0;for(b=new Array,y=new Array,d=0,m=c.length;m>d;d++)h=c[d],null!=x[h]?b.push(h):y.push(h);o=Date.now()-z,T=Date.now(),v.render(t,y,this.glyph),w.render(t,b,this.glyph),null!=this.hover_glyph&&this.hover_glyph.render(t,p,this.glyph),r=Date.now()-T}else T=Date.now(),a.render(t,c,this.glyph),this.hover_glyph&&p.length&&this.hover_glyph.render(t,p,this.glyph),r=Date.now()-T;return this.last_dtrender=r,i=Date.now()-k,u.debug(this.glyph.model.type+" GlyphRenderer ("+this.model.id+"): render finished in "+i+"ms"),u.trace(" - map_data finished in : "+e+"ms"),null!=n&&u.trace(" - mask_data finished in : "+n+"ms"),null!=o&&u.trace(" - selection mask finished in : "+o+"ms"),u.trace(" - glyph renders finished in : "+r+"ms"),t.restore()},e.prototype.map_to_screen=function(t,e){return this.plot_view.map_to_screen(t,e,this.mget("x_range_name"),this.mget("y_range_name"))},e.prototype.draw_legend=function(t,e,n,r,o){return this.glyph.draw_legend(t,e,n,r,o)},e.prototype.hit_test=function(t){return this.glyph.hit_test(t)},e}(i),r=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return h(e,t),e.prototype.default_view=o,e.prototype.type="GlyphRenderer",e.prototype.selection_defaults={},e.prototype.decimated_defaults={fill_alpha:.3,line_alpha:.3,fill_color:"grey",line_color:"grey"},e.prototype.nonselection_defaults={fill_alpha:.2,line_alpha:.2},e.prototype.defaults=function(){return l.extend({},e.__super__.defaults.call(this),{x_range_name:"default",y_range_name:"default",data_source:null,level:"glyph",glyph:null,hover_glyph:null,nonselection_glyph:null,selection_glyph:null})},e}(a),e.exports={Model:r,View:o}},{"../../common/logging":"common/logging","../../common/plot_widget":"common/plot_widget","../sources/remote_data_source":"models/sources/remote_data_source","./renderer":"models/renderers/renderer",underscore:"underscore"}],"models/renderers/guide_renderer":[function(t,e,n){var r,o,i,s=function(t,e){function n(){this.constructor=t}for(var r in e)a.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},a={}.hasOwnProperty;i=t("underscore"),o=t("./renderer"),r=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return s(e,t),e.prototype.type="GuideRenderer",e.prototype.defaults=function(){return i.extend({},e.__super__.defaults.call(this),{plot:null,level:"overlay"})},e}(o),e.exports={Model:r}},{"./renderer":"models/renderers/renderer",underscore:"underscore"}],"models/renderers/renderer":[function(t,e,n){var r,o,i=function(t,e){function n(){this.constructor=t}for(var r in e)s.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},s={}.hasOwnProperty;r=t("../../model"),o=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return i(e,t),e.prototype.type="Renderer",e}(r),e.exports=o},{"../../model":"model"}],"models/sources/ajax_data_source":[function(t,e,n){var r,o,i,s,a,l=function(t,e){return function(){return t.apply(e,arguments)}},u=function(t,e){function n(){this.constructor=t}for(var r in e)h.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},h={}.hasOwnProperty;r=t("jquery"),s=t("underscore"),a=t("../../common/logging").logger,i=t("./remote_data_source"),o=function(t){function e(){return this.defaults=l(this.defaults,this),this.get_data=l(this.get_data,this),this.setup=l(this.setup,this),this.destroy=l(this.destroy,this),e.__super__.constructor.apply(this,arguments)}return u(e,t),e.prototype.type="AjaxDataSource",e.prototype.destroy=function(){return null!=this.interval?clearInterval(this.interval):void 0},e.prototype.setup=function(t,e){return this.pv=t,this.get_data(this.get("mode")),this.get("polling_interval")?this.interval=setInterval(this.get_data,this.get("polling_interval"),this.get("mode"),this.get("max_size"),this.get("if_modified")):void 0},e.prototype.get_data=function(t,e,n){return null==e&&(e=0),null==n&&(n=!1),r.ajax({dataType:"json",ifModified:n,url:this.get("data_url"),xhrField:{withCredentials:!0},method:this.get("method"),contentType:this.get("content_type"),headers:this.get("http_headers")}).done(function(n){return function(r){var o,i,s,l,u;if("replace"===t)n.set("data",r);else if("append"===t){for(l=n.get("data"),u=n.columns(),i=0,s=u.length;s>i;i++)o=u[i],r[o]=l[o].concat(r[o]).slice(-e);n.set("data",r)}else a.error("unsupported mode: "+t);return a.trace(r),null}}(this)).error(function(){return a.error(arguments)}),null},e.prototype.defaults=function(){return s.extend({},e.__super__.defaults.call(this),{mode:"replace",data_url:null,content_type:"application/json",http_headers:{},max_size:null,method:"POST",if_modified:!1})},e}(i.Model),e.exports={Model:o}},{"../../common/logging":"common/logging","./remote_data_source":"models/sources/remote_data_source",jquery:"jquery",underscore:"underscore"}],"models/sources/blaze_data_source":[function(t,e,n){var r,o,i,s,a,l,u,h=function(t,e){return function(){return t.apply(e,arguments)}},c=function(t,e){function n(){this.constructor=t}for(var r in e)p.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},p={}.hasOwnProperty;r=t("jquery"),l=t("underscore"),o=t("backbone"),u=t("../../common/logging").logger,a=t("./remote_data_source"),i=function(t){function e(){return this.update=h(this.update,this),this.setup=h(this.setup,this),this.destroy=h(this.destroy,this),this.defaults=h(this.defaults,this),e.__super__.constructor.apply(this,arguments)}return c(e,t),e.prototype.type="BlazeDataSource",e.prototype.defaults=function(){return l.extend({},e.__super__.defaults.call(this),{expr:{},local:null,namespace:{}})},e.prototype.destroy=function(){return null!=this.interval?clearInterval(this.interval):void 0},e.prototype.setup=function(t,e){return this.pv=t,this.update(),this.get("polling_interval")?this.interval=setInterval(this.update,this.get("polling_interval")):void 0},e.prototype.update=function(){var t;return t=JSON.stringify({expr:this.get("expr"),namespace:this.get("namespace")}),r.ajax({dataType:"json",url:this.get("data_url"),data:t,xhrField:{withCredentials:!0},method:"POST",contentType:"application/json"}).done(function(t){return function(e){var n,r,o,i,s,a,u,h;for(r=l.zip.apply(l,e.data),o={},h=e.names,s=i=0,a=h.length;a>i;s=++i)n=h[s],o[n]=r[s];return u=l.clone(t.get("data")),l.extend(u,o),t.set("data",u),null}}(this))},e}(a.Model),s=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return c(e,t),e.prototype.model=i,e}(o.Collection),e.exports={Model:i,Collection:new s}},{"../../common/logging":"common/logging","./remote_data_source":"models/sources/remote_data_source",backbone:"backbone",jquery:"jquery",underscore:"underscore"}],"models/sources/column_data_source":[function(t,e,n){var r,o,i,s,a,l,u=function(t,e){return function(){return t.apply(e,arguments)}},h=function(t,e){function n(){this.constructor=t}for(var r in e)c.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},c={}.hasOwnProperty;s=t("underscore"),o=t("./data_source"),l=t("../../common/logging").logger,i=t("../../common/selection_manager"),a=t("../../common/hittest"),r=function(t){function e(){return this.defaults=u(this.defaults,this),e.__super__.constructor.apply(this,arguments)}return h(e,t),e.prototype.type="ColumnDataSource",e.prototype.nonserializable_attribute_names=function(){return e.__super__.nonserializable_attribute_names.call(this).concat(["selection_manager","inspected"])},e.prototype.get_column=function(t){var e;return null!=(e=this.get("data")[t])?e:null},e.prototype.get_length=function(){var t,e,n,r;return t=this.get("data"),0===s.keys(t).length?null:(n=s.uniq(function(){var n;n=[];for(e in t)r=t[e],n.push(r.length);return n}()),n.length>1&&l.debug("data source has columns of inconsistent lengths"),n[0])},e.prototype.columns=function(){return s.keys(this.get("data"))},e.prototype.stream=function(t,e){var n,r,o;n=this.get("data");for(r in t)o=t[r],n[r]=n[r].concat(t[r]),n[r].length>e&&(n[r]=n[r].slice(-e));return this.set("data",n,{silent:!0}),this.trigger("stream")},e.prototype.defaults=function(){return s.extend({},e.__super__.defaults.call(this),{data:{},selection_manager:new i({
|
|
source:this}),column_names:[]})},e}(o.Model),e.exports={Model:r}},{"../../common/hittest":"common/hittest","../../common/logging":"common/logging","../../common/selection_manager":"common/selection_manager","./data_source":"models/sources/data_source",underscore:"underscore"}],"models/sources/data_source":[function(t,e,n){var r,o,i,s,a=function(t,e){return function(){return t.apply(e,arguments)}},l=function(t,e){function n(){this.constructor=t}for(var r in e)u.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},u={}.hasOwnProperty;i=t("underscore"),o=t("../../model"),s=t("../../common/hittest"),r=function(t){function e(){return this.defaults=a(this.defaults,this),e.__super__.constructor.apply(this,arguments)}return l(e,t),e.prototype.type="DataSource",e.prototype.defaults=function(){return i.extend({},e.__super__.defaults.call(this),{selected:s.create_hit_test_result(),callback:null})},e.prototype.initialize=function(t){return e.__super__.initialize.call(this,t),this.listenTo(this,"change:selected",function(t){return function(){var e;return null!=(e=t.get("callback"))?e.execute(t):void 0}}(this))},e}(o),e.exports={Model:r}},{"../../common/hittest":"common/hittest","../../model":"model",underscore:"underscore"}],"models/sources/geojson_data_source":[function(t,e,n){var r,o,i,s,a=function(t,e){function n(){this.constructor=t}for(var r in e)l.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},l={}.hasOwnProperty;i=t("underscore"),s=t("../../common/logging").logger,r=t("./column_data_source"),o=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return a(e,t),e.prototype.type="GeoJSONDataSource",e.prototype.initialize=function(t){return e.__super__.initialize.call(this,t),this.geojson_to_column_data(),this.register_property("data",this.geojson_to_column_data,!0),this.add_dependencies("data",this,["geojson"])},e.prototype.defaults=function(){return i.extend({},e.__super__.defaults.call(this),{geojson:null})},e.prototype.nonserializable_attribute_names=function(){return e.__super__.nonserializable_attribute_names.call(this).concat(["data"])},e.prototype._get_new_list_array=function(t){var e,n;return e=new Array(t),n=i.map(e,function(t){return[]})},e.prototype._get_new_nan_array=function(t){var e,n;return e=new Array(t),n=i.map(e,function(t){return NaN})},e.prototype.geojson_to_column_data=function(){var t,e,n,r,o,a,l,u,h,c,p,_,d,f,m,g,y,v,b,x,w,k,M,j,T,z,E,P,S,C,A,O,N,q;if(u=JSON.parse(this.get("geojson")),"GeometryCollection"!==(P=u.type)&&"FeatureCollection"!==P)throw new Error("Bokeh only supports type GeometryCollection and FeatureCollection at top level");if("GeometryCollection"===u.type){if(null==u.geometries)throw new Error("No geometries found in GeometryCollection");if(0===u.geometries.length)throw new Error("geojson.geometries must have one or more items");_=u.geometries}if("FeatureCollection"===u.type){if(null==u.features)throw new Error("No features found in FeaturesCollection");if(0===u.features.length)throw new Error("geojson.features must have one or more items");_=u.features}for(n={x:this._get_new_nan_array(_.length),y:this._get_new_nan_array(_.length),z:this._get_new_nan_array(_.length),xs:this._get_new_list_array(_.length),ys:this._get_new_list_array(_.length),zs:this._get_new_list_array(_.length)},a=function(t,e){return t.concat([[NaN,NaN,NaN]]).concat(e)},c=f=0,g=_.length;g>f;c=++f){if(p=_[c],"Feature"===p.type){h=p.geometry;for(E in p.properties)n.hasOwnProperty(E)||(n[E]=this._get_new_nan_array(_.length)),n[E][c]=p.properties[E]}else h=p;switch(h.type){case"Point":e=h.coordinates,n.x[c]=e[0],n.y[c]=e[1],n.z[c]=null!=(S=e[2])?S:NaN;break;case"LineString":for(t=h.coordinates,d=m=0,y=t.length;y>m;d=++m)e=t[d],n.xs[c][d]=e[0],n.ys[c][d]=e[1],n.zs[c][d]=null!=(C=e[2])?C:NaN;break;case"Polygon":for(h.coordinates.length>1&&s.warn("Bokeh does not support Polygons with holes in, only exterior ring used."),r=h.coordinates[0],d=k=0,v=r.length;v>k;d=++k)e=r[d],n.xs[c][d]=e[0],n.ys[c][d]=e[1],n.zs[c][d]=null!=(A=e[2])?A:NaN;break;case"MultiPoint":s.warn("MultiPoint not supported in Bokeh");break;case"MultiLineString":for(l=i.reduce(h.coordinates,a),d=M=0,b=l.length;b>M;d=++M)e=l[d],n.xs[c][d]=e[0],n.ys[c][d]=e[1],n.zs[c][d]=null!=(O=e[2])?O:NaN;break;case"MultiPolygon":for(o=[],N=h.coordinates,j=0,x=N.length;x>j;j++)z=N[j],z.length>1&&s.warn("Bokeh does not support Polygons with holes in, only exterior ring used."),o.push(z[0]);for(l=i.reduce(o,a),d=T=0,w=l.length;w>T;d=++T)e=l[d],n.xs[c][d]=e[0],n.ys[c][d]=e[1],n.zs[c][d]=null!=(q=e[2])?q:NaN;break;default:throw new Error("Invalid type "+h.type)}}return n},e}(r.Model),e.exports={Model:o}},{"../../common/logging":"common/logging","./column_data_source":"models/sources/column_data_source",underscore:"underscore"}],"models/sources/remote_data_source":[function(t,e,n){var r,o,i,s=function(t,e){return function(){return t.apply(e,arguments)}},a=function(t,e){function n(){this.constructor=t}for(var r in e)l.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},l={}.hasOwnProperty;i=t("underscore"),r=t("./column_data_source"),o=function(t){function e(){return this.defaults=s(this.defaults,this),e.__super__.constructor.apply(this,arguments)}return a(e,t),e.prototype.type="RemoteDataSource",e.prototype.defaults=function(){return i.extend({},e.__super__.defaults.call(this),{data:{},data_url:null,polling_interval:null})},e}(r.Model),e.exports={Model:o}},{"./column_data_source":"models/sources/column_data_source",underscore:"underscore"}],"models/tickers/adaptive_ticker":[function(t,e,n){var r,o,i,s,a,l,u=function(t,e){function n(){this.constructor=t}for(var r in e)h.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},h={}.hasOwnProperty;i=t("underscore"),o=t("./continuous_ticker"),s=t("./util").argmin,a=function(t,e,n){return Math.max(e,Math.min(n,t))},l=function(t,e){return null==e&&(e=Math.E),Math.log(t)/Math.log(e)},r=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return u(e,t),e.prototype.type="AdaptiveTicker",e.prototype.initialize=function(t,n){var r,o;return e.__super__.initialize.call(this,t,n),r=i.last(this.get("mantissas"))/this.get("base"),o=i.first(this.get("mantissas"))*this.get("base"),this.extended_mantissas=i.flatten([r,this.get("mantissas"),o]),this.base_factor=0===this.get_min_interval()?1:this.get_min_interval()},e.prototype.get_interval=function(t,e,n){var r,o,i,u,h,c,p,_,d;return i=e-t,h=this.get_ideal_interval(t,e,n),d=Math.floor(l(h/this.base_factor,this.get("base"))),c=Math.pow(this.get("base"),d)*this.base_factor,p=h/c,o=this.extended_mantissas,u=o.map(function(t){return Math.abs(n-i/(t*c))}),r=o[s(u)],_=r*c,a(_,this.get_min_interval(),this.get_max_interval())},e.prototype.defaults=function(){return i.extend({},e.__super__.defaults.call(this),{base:10,mantissas:[1,2,5],min_interval:0,max_interval:null})},e}(o.Model),e.exports={Model:r}},{"./continuous_ticker":"models/tickers/continuous_ticker","./util":"models/tickers/util",underscore:"underscore"}],"models/tickers/basic_ticker":[function(t,e,n){var r,o,i,s=function(t,e){function n(){this.constructor=t}for(var r in e)a.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},a={}.hasOwnProperty;i=t("underscore"),r=t("./adaptive_ticker"),o=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return s(e,t),e.prototype.type="BasicTicker",e}(r.Model),e.exports={Model:o}},{"./adaptive_ticker":"models/tickers/adaptive_ticker",underscore:"underscore"}],"models/tickers/categorical_ticker":[function(t,e,n){var r,o,i=function(t,e){function n(){this.constructor=t}for(var r in e)s.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},s={}.hasOwnProperty;o=t("./ticker"),r=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,n,r){var o,i,s,a,l,u,h;for(o=r.desired_n_ticks,u=[],i=n.get("factors"),s=l=0,h=i.length;h>=0?h>l:l>h;s=h>=0?++l:--l)a=s+n.get("offset"),a+1>t&&e>a+1&&u.push(i[s]);return{major:u,minor:[]}},e}(o.Model),e.exports={Model:r}},{"./ticker":"models/tickers/ticker"}],"models/tickers/composite_ticker":[function(t,e,n){var r,o,i,s,a=function(t,e){function n(){this.constructor=t}for(var r in e)l.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},l={}.hasOwnProperty;i=t("underscore"),o=t("./continuous_ticker"),s=t("./util").argmin,r=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return a(e,t),e.prototype.type="CompositeTicker",e.prototype.initialize=function(t,n){var r;return e.__super__.initialize.call(this,t,n),r=this.get("tickers"),this.register_property("min_intervals",function(){return i.invoke(r,"get_min_interval")},!0),this.add_dependencies("min_intervals",this,["tickers"]),this.register_property("max_intervals",function(){return i.invoke(r,"get_max_interval")},!0),this.add_dependencies("max_intervals",this,["tickers"]),this.register_property("min_interval",function(){return i.first(this.get("min_intervals"))},!0),this.add_dependencies("min_interval",this,["min_intervals"]),this.register_property("max_interval",function(){return i.first(this.get("max_intervals"))},!0),this.add_dependencies("max_interval",this,["max_interval"])},e.prototype.defaults=function(){return i.extend({},e.__super__.defaults.call(this),{tickers:[]})},e.prototype.get_best_ticker=function(t,e,n){var r,o,a,l,u,h,c,p;return l=e-t,h=this.get_ideal_interval(t,e,n),p=[i.sortedIndex(this.get("min_intervals"),h)-1,i.sortedIndex(this.get("max_intervals"),h)],c=[this.get("min_intervals")[p[0]],this.get("max_intervals")[p[1]]],u=c.map(function(t){return Math.abs(n-l/t)}),r=s(u),r===1/0?this.get("tickers")[0]:(a=p[r],o=this.get("tickers")[a])},e.prototype.get_interval=function(t,e,n){var r;return r=this.get_best_ticker(t,e,n),r.get_interval(t,e,n)},e.prototype.get_ticks_no_defaults=function(t,e,n){var r,o;return r=this.get_best_ticker(t,e,n),o=r.get_ticks_no_defaults(t,e,n)},e}(o.Model),e.exports={Model:r}},{"./continuous_ticker":"models/tickers/continuous_ticker","./util":"models/tickers/util",underscore:"underscore"}],"models/tickers/continuous_ticker":[function(t,e,n){var r,o,i,s=function(t,e){function n(){this.constructor=t}for(var r in e)a.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},a={}.hasOwnProperty;i=t("underscore"),o=t("./ticker"),r=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return s(e,t),e.prototype.type="ContinuousTicker",e.prototype.get_interval=void 0,e.prototype.get_min_interval=function(){return this.get("min_interval")},e.prototype.get_max_interval=function(){var t;return null!=(t=this.get("max_interval"))?t:1/0},e.prototype.get_ideal_interval=function(t,e,n){var r;return r=e-t,r/n},e.prototype.defaults=function(){return i.extend({},e.__super__.defaults.call(this),{num_minor_ticks:5,desired_num_ticks:6})},e}(o.Model),e.exports={Model:r}},{"./ticker":"models/tickers/ticker",underscore:"underscore"}],"models/tickers/datetime_ticker":[function(t,e,n){var r,o,i,s,a,l,u,h,c,p,_,d,f,m=function(t,e){function n(){this.constructor=t}for(var r in e)g.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},g={}.hasOwnProperty;d=t("underscore"),r=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,p=f.ONE_SECOND,h=f.ONE_MINUTE,l=f.ONE_HOUR,c=f.ONE_MONTH,i=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return m(e,t),e.prototype.type="DatetimeTicker",e.prototype.defaults=function(){return d.extend({},e.__super__.defaults.call(this),{num_minor_ticks:0,tickers:[new r.Model({mantissas:[1,2,5],base:10,min_interval:0,max_interval:500*u,num_minor_ticks:0}),new r.Model({mantissas:[1,2,5,10,15,20,30],base:60,min_interval:p,max_interval:30*h,num_minor_ticks:0}),new r.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,n){var r,o,i,s,a,l,u,h,c=function(t,e){function n(){this.constructor=t}for(var r in e)p.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},p={}.hasOwnProperty;s=t("underscore"),i=t("./single_interval_ticker"),h=t("./util"),a=h.copy_date,u=h.last_month_no_later_than,o=h.ONE_DAY,l=function(t,e){var n,r,o,i,s;for(s=u(new Date(t)),o=u(new Date(e)),i=a(o),o.setUTCMonth(o.getUTCMonth()+1),r=[],n=s;;)if(r.push(a(n)),n.setUTCMonth(n.getUTCMonth()+1),n>o)break;return r},r=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return c(e,t),e.prototype.type="DaysTicker",e.prototype.initialize=function(t,n){var r,i;return t.num_minor_ticks=0,e.__super__.initialize.call(this,t,n),r=this.get("days"),i=r.length>1?(r[1]-r[0])*o:31*o,this.set("interval",i)},e.prototype.get_ticks_no_defaults=function(t,e,n){var r,o,i,u,h,c,p,_;return p=l(t,e),u=this.get("days"),h=function(t){return function(t,e){var n,r,o,i,s,l;for(n=[],s=0,l=u.length;l>s;s++)r=u[s],o=a(t),o.setUTCDate(r),i=new Date(o.getTime()+e/2),i.getUTCMonth()===t.getUTCMonth()&&n.push(o);return n}}(this),c=this.get("interval"),i=s.flatten(function(){var t,e,n;for(n=[],t=0,e=p.length;e>t;t++)o=p[t],n.push(h(o,c));return n}()),r=s.invoke(i,"getTime"),_=s.filter(r,function(n){return n>=t&&e>=n}),{major:_,minor:[]}},e.prototype.defaults=function(){return s.extend({},e.__super__.defaults.call(this),{days:[]})},e}(i.Model),e.exports={Model:r}},{"./single_interval_ticker":"models/tickers/single_interval_ticker","./util":"models/tickers/util",underscore:"underscore"}],"models/tickers/fixed_ticker":[function(t,e,n){var r,o,i,s=function(t,e){function n(){this.constructor=t}for(var r in e)a.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},a={}.hasOwnProperty;i=t("underscore"),r=t("./continuous_ticker"),o=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return s(e,t),e.prototype.type="FixedTicker",e.prototype.get_ticks_no_defaults=function(t,e,n){return{major:this.get("ticks"),minor:[]}},e.prototype.defaults=function(){return i.extend({},e.__super__.defaults.call(this),{ticks:[]})},e}(r.Model),e.exports={Model:o}},{"./continuous_ticker":"models/tickers/continuous_ticker",underscore:"underscore"}],"models/tickers/log_ticker":[function(t,e,n){var r,o,i,s,a=function(t,e){function n(){this.constructor=t}for(var r in e)l.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},l={}.hasOwnProperty;i=t("underscore"),r=t("./adaptive_ticker"),s=function(t,e,n){var r,o;if(i.isUndefined(e)&&(e=t,t=0),i.isUndefined(n)&&(n=1),n>0&&t>=e||0>n&&e>=t)return[];for(o=[],r=t;n>0?e>r:r>e;)o.push(r),r+=n;return o},o=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return a(e,t),e.prototype.type="LogTicker",e.prototype.get_ticks_no_defaults=function(t,e,n){var r,o,a,l,u,h,c,p,_,d,f,m,g,y,v,b,x,w,k,M,j,T,z,E,P,S,C,A,O,N,q,F;if(P=this.get("num_minor_ticks"),z=[],0>=t&&(t=1),t>e&&(C=[e,t],t=C[0],e=C[1]),r=this.get("base"),k=Math.log(t)/Math.log(r),x=Math.log(e)/Math.log(r),w=x-k,2>w){if(c=this.get_interval(t,e,n),A=Math.floor(t/c),o=Math.ceil(e/c),u=i.isNaN(A)||i.isNaN(o)?[]:i.range(A,o+1),q=function(){var t,e,n;for(n=[],t=0,e=u.length;e>t;t++)l=u[t],0!==l&&n.push(l*c);return n}(),P>1){for(j=c/P,T=function(){var t,e,n;for(n=[],h=t=1,e=P;e>=1?e>=t:t>=e;h=e>=1?++t:--t)n.push(h*j);return n}(),p=0,f=T.length;f>p;p++)F=T[p],z.push(q[0]-F);for(_=0,m=q.length;m>_;_++)for(N=q[_],d=0,g=T.length;g>d;d++)F=T[d],z.push(N+F)}}else if(O=Math.ceil(k),a=Math.floor(x),c=Math.ceil((a-O)/9),q=s(O,a,c),(a-O)%c===0&&(q=q.concat([a])),q=q.map(function(t){return Math.pow(r,t)}),P>1){for(j=Math.pow(r,c)/P,T=function(){var t,e,n;for(n=[],h=t=1,e=P;e>=1?e>=t:t>=e;h=e>=1?++t:--t)n.push(h*j);return n}(),M=0,y=T.length;y>M;M++)F=T[M],z.push(q[0]/F);for(E=0,v=q.length;v>E;E++)for(N=q[E],S=0,b=T.length;b>S;S++)F=T[S],z.push(N*F)}return{major:q,minor:z}},e.prototype.defaults=function(){return i.extend({},e.__super__.defaults.call(this),{mantissas:[1,5]})},e}(r.Model),e.exports={Model:o}},{"./adaptive_ticker":"models/tickers/adaptive_ticker",underscore:"underscore"}],"models/tickers/months_ticker":[function(t,e,n){var r,o,i,s,a,l,u,h,c=function(t,e){function n(){this.constructor=t}for(var r in e)p.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},p={}.hasOwnProperty;s=t("underscore"),i=t("./single_interval_ticker"),h=t("./util"),a=h.copy_date,u=h.last_year_no_later_than,o=h.ONE_MONTH,l=function(t,e){var n,r,o,i;for(i=u(new Date(t)),o=u(new Date(e)),o.setUTCFullYear(o.getUTCFullYear()+1),r=[],n=i;;)if(r.push(a(n)),n.setUTCFullYear(n.getUTCFullYear()+1),n>o)break;return r},r=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return c(e,t),e.prototype.type="MonthsTicker",e.prototype.initialize=function(t,n){var r,i;return e.__super__.initialize.call(this,t,n),i=this.get("months"),r=i.length>1?(i[1]-i[0])*o:12*o,this.set("interval",r)},e.prototype.get_ticks_no_defaults=function(t,e,n){var r,o,i,u,h,c,p;return p=l(t,e),u=this.get("months"),h=function(t){return u.map(function(e){var n;return n=a(t),n.setUTCMonth(e),n})},i=s.flatten(function(){var t,e,n;for(n=[],t=0,e=p.length;e>t;t++)o=p[t],n.push(h(o));return n}()),r=s.invoke(i,"getTime"),c=s.filter(r,function(n){return n>=t&&e>=n}),{major:c,minor:[]}},e.prototype.defaults=function(){return s.extend({},e.__super__.defaults.call(this),{months:[]})},e}(i.Model),e.exports={Model:r}},{"./single_interval_ticker":"models/tickers/single_interval_ticker","./util":"models/tickers/util",underscore:"underscore"}],"models/tickers/single_interval_ticker":[function(t,e,n){var r,o,i,s=function(t,e){function n(){this.constructor=t}for(var r in e)a.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},a={}.hasOwnProperty;i=t("underscore"),r=t("./continuous_ticker"),o=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return s(e,t),e.prototype.type="SingleIntervalTicker",e.prototype.initialize=function(t,n){return e.__super__.initialize.call(this,t,n),this.register_property("min_interval",function(){return this.get("interval")},!0),this.add_dependencies("min_interval",this,["interval"]),this.register_property("max_interval",function(){return this.get("interval")},!0),this.add_dependencies("max_interval",this,["interval"])},e.prototype.get_interval=function(t,e,n){return this.get("interval")},e.prototype.defaults=function(){return i.extend({},e.__super__.defaults.call(this),{interval:null})},e}(r.Model),e.exports={Model:o}},{"./continuous_ticker":"models/tickers/continuous_ticker",underscore:"underscore"}],"models/tickers/ticker":[function(t,e,n){var r,o,i,s=function(t,e){function n(){this.constructor=t}for(var r in e)a.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},a={}.hasOwnProperty;i=t("underscore"),r=t("../../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,n,r){var o;return o=r.desired_n_ticks,this.get_ticks_no_defaults(t,e,this.get("desired_num_ticks"))},e.prototype.get_ticks_no_defaults=function(t,e,n){var r,o,s,a,l,u,h,c,p,_,d,f,m,g,y,v,b,x,w;if(l=this.get_interval(t,e,n),v=Math.floor(t/l),r=Math.ceil(e/l),s=i.isNaN(v)||i.isNaN(r)?[]:i.range(v,r+1),x=function(){var t,e,n;for(n=[],t=0,e=s.length;e>t;t++)o=s[t],n.push(o*l);return n}(),y=this.get("num_minor_ticks"),g=[],y>1){for(f=l/y,m=function(){var t,e,n;for(n=[],a=t=1,e=y;e>=1?e>=t:t>=e;a=e>=1?++t:--t)n.push(a*f);return n}(),u=0,p=m.length;p>u;u++)w=m[u],g.push(x[0]-w);for(h=0,_=x.length;_>h;h++)for(b=x[h],c=0,d=m.length;d>c;c++)w=m[c],g.push(b+w)}return{major:x,minor:g}},e}(r),e.exports={Model:o}},{"../../model":"model",underscore:"underscore"}],"models/tickers/util":[function(t,e,n){var r,o,i,s,a,l,u,h,c,p,_,d;h=t("underscore"),i=1,l=1e3,s=60*l,o=60*s,r=24*o,a=30*r,u=365*r,c=function(t){var e;return e=h.min(h.range(t.length),function(e){return t[e]})},p=function(t){return new Date(t.getTime())},_=function(t){return t=p(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:c,copy_date:p,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:r,ONE_MONTH:a,ONE_YEAR:u}},{underscore:"underscore"}],"models/tickers/years_ticker":[function(t,e,n){var r,o,i,s,a,l,u,h=function(t,e){function n(){this.constructor=t}for(var r in e)c.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},c={}.hasOwnProperty;a=t("underscore"),r=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 h(e,t),e.prototype.type="YearsTicker",e.prototype.initialize=function(t,n){return e.__super__.initialize.call(this,t,n),this.set("interval",o),this.basic_ticker=new r.Model({num_minor_ticks:0})},e.prototype.get_ticks_no_defaults=function(t,e,n){var r,o,i,s,u,h;return i=l(new Date(t)).getUTCFullYear(),o=l(new Date(e)).getUTCFullYear(),h=this.basic_ticker.get_ticks_no_defaults(i,o,n).major,r=function(){var t,e,n;for(n=[],t=0,e=h.length;e>t;t++)u=h[t],n.push(Date.UTC(u,0,1));return n}(),s=a.filter(r,function(n){return n>=t&&e>=n}),{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,n){var r,o,i,s=function(t,e){return function(){return t.apply(e,arguments)}},a=function(t,e){function n(){this.constructor=t}for(var r in e)l.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},l={}.hasOwnProperty;i=t("underscore"),o=t("./mercator_tile_source"),r=function(t){function e(){return this.defaults=s(this.defaults,this),e.__super__.constructor.apply(this,arguments)}return a(e,t),e.prototype.type="BBoxTileSource",e.prototype.defaults=function(){return i.extend({},e.__super__.defaults.call(this),{use_latlon:!1})},e.prototype.get_image_url=function(t,e,n){var r,o,i,s,a,l,u;return r=this.string_lookup_replace(this.get("url"),this.get("extra_url_vars")),this.get("use_latlon")?(o=this.get_tile_geographic_bounds(t,e,n),a=o[0],u=o[1],s=o[2],l=o[3]):(i=this.get_tile_meter_bounds(t,e,n),a=i[0],u=i[1],s=i[2],l=i[3]),r.replace("{XMIN}",a).replace("{YMIN}",u).replace("{XMAX}",s).replace("{YMAX}",l)},e}(o),e.exports={Model:r}},{"./mercator_tile_source":"models/tiles/mercator_tile_source",underscore:"underscore"}],"models/tiles/dynamic_image_renderer":[function(t,e,n){var r,o,i,s,a,l,u,h,c=function(t,e){return function(){return t.apply(e,arguments)}},p=function(t,e){function n(){this.constructor=t}for(var r in e)_.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},_={}.hasOwnProperty;l=t("underscore"),a=t("../renderers/renderer"),s=t("../../common/plot_widget"),h=t("../../common/properties"),i=t("./image_pool"),u=t("../../common/logging").logger,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.get("start"),this.y_range.get("start"),this.x_range.get("end"),this.y_range.get("end")]},e.prototype._set_data=function(){return this.map_plot=this.plot_view.model,this.map_canvas=this.plot_view.canvas_view.ctx,this.map_frame=this.plot_view.frame,this.x_range=this.map_plot.get("x_range"),this.x_mapper=this.map_frame.get("x_mappers")["default"],this.y_range=this.map_plot.get("y_range"),this.y_mapper=this.map_frame.get("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;return e=t.target.image_data,e.img=t.target,e.loaded=!0,this.lastImage=e,this.get_extent().join(":")===e.cache_key?this.request_render():void 0},e.prototype._on_image_error=function(t){var e;return u.error("Error loading image: #{e.target.src}"),e=t.target.image_data,this.mget("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.mget("image_source").add_image(e.image_data),e.src=this.mget("image_source").get_image_url(t[0],t[1],t[2],t[3],Math.ceil(this.map_frame.get("height")),Math.ceil(this.map_frame.get("width"))),e},e.prototype.render=function(t,e,n){var r,o;return null==this.map_initialized&&(this._set_data(),this._map_data(),this.map_initialized=!0),r=this.get_extent(),this.render_timer&&clearTimeout(this.render_timer),o=this.mget("image_source").images[r.join(":")],null!=o&&o.loaded?void this._draw_image(r.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(r)}}(this),125):void 0)},e.prototype._draw_image=function(t){var e,n,r,o,i,s,a,l,u,h,c;return e=this.mget("image_source").images[t],null!=e?(this.map_canvas.save(),this._set_rect(),this.map_canvas.globalAlpha=this.mget("alpha"),n=this.plot_view.frame.map_to_screen([e.bounds[0]],[e.bounds[3]],this.plot_view.canvas),l=n[0],c=n[1],r=this.plot_view.frame.map_to_screen([e.bounds[2]],[e.bounds[1]],this.plot_view.canvas),a=r[0],h=r[1],l=l[0],c=c[0],a=a[0],h=h[0],i=a-l,o=h-c,s=l,u=c,this.map_canvas.drawImage(e.img,s,u,i,o),this.map_canvas.restore()):void 0},e.prototype._set_rect=function(){var t,e,n,r,o;return n=this.plot_view.outline_props.width.value(),e=this.plot_view.canvas.vx_to_sx(this.map_frame.get("left"))+n/2,r=this.plot_view.canvas.vy_to_sy(this.map_frame.get("top"))+n/2,o=this.map_frame.get("width")-n,t=this.map_frame.get("height")-n,this.map_canvas.rect(e,r,o,t),this.map_canvas.clip()},e}(s),r=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.prototype.visuals=[],e.prototype.defaults=function(){return l.extend({},e.__super__.defaults.call(this),{alpha:1,image_source:null,render_parents:!0,level:"underlay"})},e}(a),e.exports={Model:r,View:o}},{"../../common/logging":"common/logging","../../common/plot_widget":"common/plot_widget","../../common/properties":"common/properties","../renderers/renderer":"models/renderers/renderer","./image_pool":"models/tiles/image_pool",underscore:"underscore"}],"models/tiles/image_pool":[function(t,e,n){var r;r=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){return this.images.length>50?void 0:t.constructor===Array?Array.prototype.push.apply(this.images,t):this.images.push(t)},t}(),e.exports=r},{}],"models/tiles/image_source":[function(t,e,n){var r,o,i,s,a=function(t,e){return function(){return t.apply(e,arguments)}},l=function(t,e){function n(){this.constructor=t}for(var r in e)u.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},u={}.hasOwnProperty;i=t("underscore"),o=t("../../model"),s=t("../../common/logging").logger,r=function(t){function e(t){null==t&&(t={}),this.defaults=a(this.defaults,this),e.__super__.constructor.apply(this,arguments),this.images={},this.normalize_case()}return l(e,t),e.prototype.normalize_case=function(){"Note: should probably be refactored into subclasses.";var t;return t=this.get("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.set("url",t)},e.prototype.defaults=function(){return i.extend({},e.__super__.defaults.call(this),{url:"",extra_url_vars:{}})},e.prototype.type="ImageSource",e.prototype.string_lookup_replace=function(t,e){var n,r,o;r=t;for(n in e)o=e[n],r=r.replace("{"+n+"}",o.toString());return r},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,n,r,o,i){var s;return s=this.string_lookup_replace(this.get("url"),this.get("extra_url_vars")),s.replace("{XMIN}",t).replace("{YMIN}",e).replace("{XMAX}",n).replace("{YMAX}",r).replace("{WIDTH}",i).replace("{HEIGHT}",o)},e}(o),e.exports={Model:r}},{"../../common/logging":"common/logging","../../model":"model",underscore:"underscore"}],"models/tiles/mercator_tile_source":[function(t,e,n){var r,o,i,s=function(t,e){return function(){return t.apply(e,arguments)}},a=function(t,e){function n(){this.constructor=t}for(var r in e)l.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},l={}.hasOwnProperty;i=t("underscore"),o=t("./tile_source"),r=function(t){function e(){return this.defaults=s(this.defaults,this),e.__super__.constructor.apply(this,arguments)}return a(e,t),e.prototype.type="MercatorTileSource",e.prototype.initialize=function(t){var n;return e.__super__.initialize.call(this,t),this._resolutions=function(){var t,e;for(e=[],n=t=0;30>=t;n=++t)e.push(this.get_resolution(n));return e}.call(this)},e.prototype._computed_initial_resolution=function(){return null!=this.get("initial_resolution")?this.get("initial_resolution"):2*Math.PI*6378137/this.get("tile_size")},e.prototype.is_valid_tile=function(t,e,n){return!this.get("wrap_around")&&(0>t||t>=Math.pow(2,n))?!1:0>e||e>=Math.pow(2,n)?!1:!0},e.prototype.retain_children=function(t){var e,n,r,o,i,s,a;o=t.quadkey,r=o.length,n=r+3,i=this.tiles,s=[];for(e in i)a=i[e],0===a.quadkey.indexOf(o)&&a.quadkey.length>r&&a.quadkey.length<=n?s.push(a.retain=!0):s.push(void 0);return s},e.prototype.retain_neighbors=function(t){var e,n,r,o,s,a,l,u,h,c,p,_,d;n=4,s=t.tile_coords,h=s[0],c=s[1],p=s[2],r=function(){var t,e,r,o;for(o=[],_=t=e=h-n,r=h+n;r>=e?r>=t:t>=r;_=r>=e?++t:--t)o.push(_);return o}(),o=function(){var t,e,r,o;for(o=[],d=t=e=c-n,r=c+n;r>=e?r>=t:t>=r;d=r>=e?++t:--t)o.push(d);return o}(),a=this.tiles,l=[];for(e in a)u=a[e],u.tile_coords[2]===p&&i.contains(r,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,n,r,o,i;n=t.quadkey,r=this.tiles,o=[];for(e in r)i=r[e],o.push(i.retain=0===n.indexOf(i.quadkey));
|
|
return o},e.prototype.children_by_tile_xyz=function(t,e,n){var r,o,i,s,a,l,u,h,c;for(c=this.calculate_world_x_by_tile_xyz(t,e,n),0!==c&&(l=this.normalize_xyz(t,e,n),t=l[0],e=l[1],n=l[2]),a=this.tile_xyz_to_quadkey(t,e,n),o=[],i=s=0;3>=s;i=s+=1)u=this.quadkey_to_tile_xyz(a+i.toString()),t=u[0],e=u[1],n=u[2],0!==c&&(h=this.denormalize_xyz(t,e,n,c),t=h[0],e=h[1],n=h[2]),r=this.get_tile_meter_bounds(t,e,n),null!=r&&o.push([t,e,n,r]);return o},e.prototype.parent_by_tile_xyz=function(t,e,n){var r,o;return o=this.tile_xyz_to_quadkey(t,e,n),r=o.substring(0,o.length-1),this.quadkey_to_tile_xyz(r)},e.prototype.get_resolution=function(t){return this._computed_initial_resolution()/Math.pow(2,t)},e.prototype.get_resolution_by_extent=function(t,e,n){var r,o;return r=(t[2]-t[0])/n,o=(t[3]-t[1])/e,[r,o]},e.prototype.get_level_by_extent=function(t,e,n){var r,o,i,s,a,l,u,h;for(u=(t[2]-t[0])/n,h=(t[3]-t[1])/e,l=Math.max(u,h),r=0,a=this._resolutions,o=0,i=a.length;i>o;o++){if(s=a[o],l>s){if(0===r)return 0;if(r>0)return r-1}r+=1}},e.prototype.get_closest_level_by_extent=function(t,e,n){var r,o,i,s,a;return s=(t[2]-t[0])/n,a=(t[3]-t[1])/e,o=Math.max(s,a),i=this._resolutions,r=this._resolutions.reduce(function(t,e){return Math.abs(e-o)<Math.abs(t-o)?e:t}),this._resolutions.indexOf(r)},e.prototype.snap_to_zoom=function(t,e,n,r){var o,i,s,a,l,u,h,c,p;return o=this._resolutions[r],i=n*o,s=e*o,u=t[0],p=t[1],l=t[2],c=t[3],a=(i-(l-u))/2,h=(s-(c-p))/2,[u-a,p-h,l+a,c+h]},e.prototype.tms_to_wmts=function(t,e,n){"Note this works both ways";return[t,Math.pow(2,n)-1-e,n]},e.prototype.wmts_to_tms=function(t,e,n){"Note this works both ways";return[t,Math.pow(2,n)-1-e,n]},e.prototype.pixels_to_meters=function(t,e,n){var r,o,i;return i=this.get_resolution(n),r=t*i-this.get("x_origin_offset"),o=e*i-this.get("y_origin_offset"),[r,o]},e.prototype.meters_to_pixels=function(t,e,n){var r,o,i;return i=this.get_resolution(n),r=(t+this.get("x_origin_offset"))/i,o=(e+this.get("y_origin_offset"))/i,[r,o]},e.prototype.pixels_to_tile=function(t,e){var n,r;return n=Math.ceil(t/parseFloat(this.get("tile_size"))),n=0===n?n:n-1,r=Math.max(Math.ceil(e/parseFloat(this.get("tile_size")))-1,0),[n,r]},e.prototype.pixels_to_raster=function(t,e,n){var r;return r=this.get("tile_size")<<n,[t,r-e]},e.prototype.meters_to_tile=function(t,e,n){var r,o,i;return i=this.meters_to_pixels(t,e,n),r=i[0],o=i[1],this.pixels_to_tile(r,o)},e.prototype.get_tile_meter_bounds=function(t,e,n){var r,o,i,s,a,l;return r=this.pixels_to_meters(t*this.get("tile_size"),e*this.get("tile_size"),n),s=r[0],l=r[1],o=this.pixels_to_meters((t+1)*this.get("tile_size"),(e+1)*this.get("tile_size"),n),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,n){var r,o,i,s,a,l;return r=this.get_tile_meter_bounds(t,e,n),l=this.utils.meters_extent_to_geographic(r),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,n){var r,o,i,s,a,l,u,h,c,p,_,d,f,m,g,y,v,b,x;for(null==n&&(n=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-=n,g-=n,_+=n,m+=n,c=[],f=r=a=m,l=g;r>=l;f=r+=-1)for(p=o=u=d,h=_;h>=o;p=o+=1)this.is_valid_tile(p,f,e)&&c.push([p,f,e,this.get_tile_meter_bounds(p,f,e)]);return c=this.sort_tiles_from_center(c,[d,g,_,m])},e.prototype.quadkey_to_tile_xyz=function(t){"Computes tile x, y and z values based on quadKey.";var e,n,r,o,i,s,a,l;for(i=0,s=0,a=t.length,e=n=o=a;n>0;e=n+=-1)if(l=t.charAt(a-e),r=1<<e-1,"0"!==l)if("1"===l)i|=r;else if("2"===l)s|=r;else{if("3"!==l)throw new TypeError("Invalid Quadkey: "+t);i|=r,s|=r}return[i,s,a]},e.prototype.tile_xyz_to_quadkey=function(t,e,n){"Computes quadkey value based on tile x, y and z values.";var r,o,i,s,a,l;for(a="",o=i=l=n;i>0;o=i+=-1)r=0,s=1<<o-1,0!==(t&s)&&(r+=1),0!==(e&s)&&(r+=2),a+=r.toString();return a},e.prototype.children_by_tile_xyz=function(t,e,n){var r,o,i,s,a,l;for(a=this.tile_xyz_to_quadkey(t,e,n),o=[],i=s=0;3>=s;i=s+=1)l=this.quadkey_to_tile_xyz(a+i.toString()),t=l[0],e=l[1],n=l[2],r=this.get_tile_meter_bounds(t,e,n),null!=r&&o.push([t,e,n,r]);return o},e.prototype.parent_by_tile_xyz=function(t,e,n){var r,o;return o=this.tile_xyz_to_quadkey(t,e,n),r=o.substring(0,o.length-1),this.quadkey_to_tile_xyz(r)},e.prototype.get_closest_parent_by_tile_xyz=function(t,e,n){var r,o,i,s,a;for(a=this.calculate_world_x_by_tile_xyz(t,e,n),o=this.normalize_xyz(t,e,n),t=o[0],e=o[1],n=o[2],r=this.tile_xyz_to_quadkey(t,e,n);r.length>0;)if(r=r.substring(0,r.length-1),i=this.quadkey_to_tile_xyz(r),t=i[0],e=i[1],n=i[2],s=this.denormalize_xyz(t,e,n,a),t=s[0],e=s[1],n=s[2],this.tile_xyz_to_key(t,e,n)in this.tiles)return[t,e,n];return[0,0,0]},e.prototype.normalize_xyz=function(t,e,n){var r;return this.get("wrap_around")?(r=Math.pow(2,n),[(t%r+r)%r,e,n]):[t,e,n]},e.prototype.denormalize_xyz=function(t,e,n,r){return[t+r*Math.pow(2,n),e,n]},e.prototype.denormalize_meters=function(t,e,n,r){return[t+2*r*Math.PI*6378137,e]},e.prototype.calculate_world_x_by_tile_xyz=function(t,e,n){return Math.floor(t/Math.pow(2,n))},e.prototype.defaults=function(){return i.extend({},e.__super__.defaults.call(this),{x_origin_offset:20037508.34,y_origin_offset:20037508.34,initial_resolution:156543.03392804097,wrap_around:!0})},e}(o),e.exports=r},{"./tile_source":"models/tiles/tile_source",underscore:"underscore"}],"models/tiles/quadkey_tile_source":[function(t,e,n){var r,o,i=function(t,e){function n(){this.constructor=t}for(var r in e)s.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},s={}.hasOwnProperty;r=t("./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,n){var r,o,i;return r=this.string_lookup_replace(this.get("url"),this.get("extra_url_vars")),i=this.tms_to_wmts(t,e,n),t=i[0],e=i[1],n=i[2],o=this.tile_xyz_to_quadkey(t,e,n),r.replace("{Q}",o)},e}(r),e.exports={Model:o}},{"./mercator_tile_source":"models/tiles/mercator_tile_source"}],"models/tiles/tile_renderer":[function(t,e,n){var r,o,i,s,a,l,u,h,c,p,_=function(t,e){return function(){return t.apply(e,arguments)}},d=function(t,e){function n(){this.constructor=t}for(var r in e)f.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},f={}.hasOwnProperty,m=[].indexOf||function(t){for(var e=0,n=this.length;n>e;e++)if(e in this&&this[e]===t)return e;return-1};u=t("underscore"),r=t("jquery"),s=t("../renderers/renderer"),i=t("../../common/plot_widget"),c=t("../../common/properties"),p=t("./wmts_tile_source"),o=t("./image_pool"),h=t("../../common/logging").logger,l=function(t){function e(){return this._update=_(this._update,this),this._prefetch_tiles=_(this._prefetch_tiles,this),this._on_tile_error=_(this._on_tile_error,this),this._on_tile_cache_load=_(this._on_tile_cache_load,this),this._on_tile_load=_(this._on_tile_load,this),this._add_attribution=_(this._add_attribution,this),e.__super__.constructor.apply(this,arguments)}return d(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.get("start"),this.y_range.get("start"),this.x_range.get("end"),this.y_range.get("end")]},e.prototype._set_data=function(){return this.pool=new o,this.map_plot=this.plot_view.model,this.map_canvas=this.plot_view.canvas_view.ctx,this.map_frame=this.plot_view.frame,this.x_range=this.map_plot.get("x_range"),this.x_mapper=this.map_frame.get("x_mappers")["default"],this.y_range=this.map_plot.get("y_range"),this.y_mapper=this.map_frame.get("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,n,o,i,s;return t=this.mget("tile_source").get("attribution"),u.isString(t)&&t.length>0?null!=this.attributionEl?this.attributionEl.html(t):(e=this.map_plot.get("outline_line_width"),n=this.map_plot.get("min_border_bottom")+e,s=this.map_frame.get("right")-this.map_frame.get("width"),o=this.map_frame.get("width")-e,this.attributionEl=r("<div>").html(t).addClass("bk-tile-attribution").css({position:"absolute",bottom:n+"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)):void 0},e.prototype._map_data=function(){var t,e;return this.initial_extent=this.get_extent(),e=this.mget("tile_source").get_level_by_extent(this.initial_extent,this.map_frame.get("height"),this.map_frame.get("width")),t=this.mget("tile_source").snap_to_zoom(this.initial_extent,this.map_frame.get("height"),this.map_frame.get("width"),e),this.x_range.set("start",t[0]),this.y_range.set("start",t[1]),this.x_range.set("end",t[2]),this.y_range.set("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,n,r,o){var i,s,a;return null==o&&(o=!1),i=this.mget("tile_source").normalize_xyz(t,e,n),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,n],normalized_coords:i,quadkey:this.mget("tile_source").tile_xyz_to_quadkey(t,e,n),cache_key:this.mget("tile_source").tile_xyz_to_key(t,e,n),bounds:r,loaded:!1,x_coord:r[0],y_coord:r[3]},this.mget("tile_source").tiles[a.tile_data.cache_key]=a.tile_data,a.src=(s=this.mget("tile_source")).get_image_url.apply(s,i),a},e.prototype._enforce_aspect_ratio=function(){var t,e,n;return this._last_height!==this.map_frame.get("height")||this._last_width!==this.map_frame.get("width")?(t=this.get_extent(),n=this.mget("tile_source").get_level_by_extent(t,this.map_frame.get("height"),this.map_frame.get("width")),e=this.mget("tile_source").snap_to_zoom(t,this.map_frame.get("height"),this.map_frame.get("width"),n),this.x_range.set({start:e[0],end:e[2]}),this.y_range.set({start:e[1],end:e[3]}),this.extent=e,this._last_height=this.map_frame.get("height"),this._last_width=this.map_frame.get("width"),!0):!1},e.prototype.render=function(t,e,n){return null==this.map_initialized&&(this._set_data(),this._map_data(),this.map_initialized=!0),this._enforce_aspect_ratio()?void 0:(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,n,r,o,i,s,a,l,u,h,c;return c=this.mget("tile_source").tiles[t],null!=c?(e=this.plot_view.frame.map_to_screen([c.bounds[0]],[c.bounds[3]],this.plot_view.canvas),a=e[0],h=e[1],n=this.plot_view.frame.map_to_screen([c.bounds[2]],[c.bounds[1]],this.plot_view.canvas),s=n[0],u=n[1],a=a[0],h=h[0],s=s[0],u=u[0],o=s-a,r=u-h,i=a,l=h,this.map_canvas.drawImage(c.img,i,l,o,r)):void 0},e.prototype._set_rect=function(){var t,e,n,r,o;return n=this.plot_view.outline_props.width.value(),e=this.plot_view.canvas.vx_to_sx(this.map_frame.get("left"))+n/2,r=this.plot_view.canvas.vy_to_sy(this.map_frame.get("top"))+n/2,o=this.map_frame.get("width")-n,t=this.map_frame.get("height")-n,this.map_canvas.rect(e,r,o,t),this.map_canvas.clip()},e.prototype._render_tiles=function(t){var e,n,r;for(this.map_canvas.save(),this._set_rect(),this.map_canvas.globalAlpha=this.mget("alpha"),e=0,n=t.length;n>e;e++)r=t[e],this._draw_tile(r);return this.map_canvas.restore()},e.prototype._prefetch_tiles=function(){var t,e,n,r,o,i,s,a,l,u,h,c,p,_,d,f,m,g,y,v;for(_=this.mget("tile_source"),a=this.get_extent(),l=this.map_frame.get("height"),f=this.map_frame.get("width"),v=this.mget("tile_source").get_level_by_extent(a,l,f),d=this.mget("tile_source").get_tiles_by_extent(a,v),c=[],p=u=0,h=Math.min(10,d.length);h>=u;p=u+=1)m=p[0],g=p[1],y=p[2],t=p[3],r=this.mget("tile_source").children_by_tile_xyz(m,g,y),c.push(function(){var t,a,l;for(l=[],t=0,a=r.length;a>t;t++)e=r[t],o=e[0],i=e[1],s=e[2],n=e[3],_.tile_xyz_to_key(o,i,s)in _.tiles||l.push(this._create_tile(o,i,s,n,!0));return l}.call(this));return c},e.prototype._fetch_tiles=function(t){var e,n,r,o,i,s,a,l;for(o=[],n=0,r=t.length;r>n;n++)i=t[n],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,n,r,o,i,s,a,l,u,h,c,p,_,d,f,g,y,v,b,x,w,k,M,j,T,z,E,P,S,C,A,O,N,q,F,D,I,R;for(A=this.mget("tile_source"),b=A.get("min_zoom"),v=A.get("max_zoom"),A.update(),u=this.get_extent(),R=this.extent[2]-this.extent[0]<u[2]-u[0],h=this.map_frame.get("height"),N=this.map_frame.get("width"),I=A.get_level_by_extent(u,h,N),P=!1,b>I?(u=this.extent,I=b,P=!0):I>v&&(u=this.extent,I=v,P=!0),P&&(this.x_range.set({x_range:{start:u[0],end:u[2]}}),this.y_range.set({start:u[1],end:u[3]}),this.extent=u),this.extent=u,O=A.get_tiles_by_extent(u,I),M=[],x=[],n=[],i=[],c=0,f=O.length;f>c;c++){if(S=O[c],q=S[0],F=S[1],D=S[2],t=S[3],d=A.tile_xyz_to_key(q,F,D),C=A.tiles[d],null!=C&&C.loaded===!0)n.push(d);else if(this.mget("render_parents")&&(E=A.get_closest_parent_by_tile_xyz(q,F,D),j=E[0],T=E[1],z=E[2],w=A.tile_xyz_to_key(j,T,z),k=A.tiles[w],null!=k&&k.loaded&&m.call(M,w)<0&&M.push(w),R))for(i=A.children_by_tile_xyz(q,F,D),p=0,g=i.length;g>p;p++)e=i[p],s=e[0],a=e[1],l=e[2],r=e[3],o=A.tile_xyz_to_key(s,a,l),o in A.tiles&&i.push(o);null==C&&x.push(S)}for(this._render_tiles(M),this._render_tiles(i),this._render_tiles(n),_=0,y=n.length;y>_;_++)S=n[_],A.tiles[S].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),a=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return d(e,t),e.prototype.default_view=l,e.prototype.type="TileRenderer",e.prototype.visuals=[],e.prototype.defaults=function(){return u.extend({},e.__super__.defaults.call(this),{alpha:1,x_range_name:"default",y_range_name:"default",tile_source:new p.Model,render_parents:!0,level:"underlay"})},e}(s),e.exports={Model:a,View:l}},{"../../common/logging":"common/logging","../../common/plot_widget":"common/plot_widget","../../common/properties":"common/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,n){var r,o,i,s,a,l,u=function(t,e){return function(){return t.apply(e,arguments)}},h=function(t,e){function n(){this.constructor=t}for(var r in e)c.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},c={}.hasOwnProperty;s=t("underscore"),o=t("../../model"),r=t("./image_pool"),l=t("./tile_utils"),a=t("../../common/logging").logger,i=function(t){function e(t){null==t&&(t={}),this.defaults=u(this.defaults,this),e.__super__.constructor.apply(this,arguments),this.utils=new l.ProjectionUtils,this.pool=new r,this.tiles={},this.normalize_case()}return h(e,t),e.prototype.type="TileSource",e.prototype.initialize=function(t){return e.__super__.initialize.call(this,t),this.normalize_case()},e.prototype.defaults=function(){return s.extend({},e.__super__.defaults.call(this),{url:"",tile_size:256,max_zoom:30,min_zoom:0,extra_url_vars:{},attribution:""})},e.prototype.string_lookup_replace=function(t,e){var n,r,o;r=t;for(n in e)o=e[n],r=r.replace("{"+n+"}",o.toString());return r},e.prototype.normalize_case=function(){"Note: should probably be refactored into subclasses.";var t;return t=this.get("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.set("url",t)},e.prototype.update=function(){var t,e,n,r;a.debug("TileSource: tile cache count: "+Object.keys(this.tiles).length),e=this.tiles,n=[];for(t in e)r=e[t],r.current=!1,n.push(r.retain=!1);return n},e.prototype.tile_xyz_to_key=function(t,e,n){var r;return r=t+":"+e+":"+n},e.prototype.key_to_tile_xyz=function(t){var e;return function(){var n,r,o,i;for(o=t.split(":"),i=[],n=0,r=o.length;r>n;n++)e=o[n],i.push(parseInt(e));return i}()},e.prototype.sort_tiles_from_center=function(t,e){var n,r,o,i,s,a;return i=e[0],a=e[1],o=e[2],s=e[3],n=(o-i)/2+i,r=(s-a)/2+a,t.sort(function(t,e){var o,i;return o=Math.sqrt(Math.pow(n-t[0],2)+Math.pow(r-t[1],2)),i=Math.sqrt(Math.pow(n-e[0],2)+Math.pow(r-e[1],2)),o-i}),t},e.prototype.prune_tiles=function(){var t,e,n,r,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));n=this.tiles,r=[];for(t in n)o=n[t],o.retain?r.push(void 0):r.push(this.remove_tile(t));return r},e.prototype.remove_tile=function(t){var e;return e=this.tiles[t],null!=e?(this.pool.push(e.img),delete this.tiles[t]):void 0},e.prototype.get_image_url=function(t,e,n){var r;return r=this.string_lookup_replace(this.get("url"),this.get("extra_url_vars")),r.replace("{X}",t).replace("{Y}",e).replace("{Z}",n)},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,n){throw Error("Not Implemented")},e.prototype.quadkey_to_tile_xyz=function(t){throw Error("Not Implemented")},e}(o),e.exports=i},{"../../common/logging":"common/logging","../../model":"model","./image_pool":"models/tiles/image_pool","./tile_utils":"models/tiles/tile_utils",underscore:"underscore"}],"models/tiles/tile_utils":[function(t,e,n){var r,o,i,s;i=t("proj4"),o=i.defs("GOOGLE"),s=i.defs("WGS84"),r=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,n,r,o,i,s;return o=t[0],s=t[1],r=t[2],i=t[3],e=this.geographic_to_meters(o,s),o=e[0],s=e[1],n=this.geographic_to_meters(r,i),r=n[0],i=n[1],[o,s,r,i]},t.prototype.meters_extent_to_geographic=function(t){var e,n,r,o,i,s;return o=t[0],s=t[1],r=t[2],i=t[3],e=this.meters_to_geographic(o,s),o=e[0],s=e[1],n=this.meters_to_geographic(r,i),r=n[0],i=n[1],[o,s,r,i]},t}(),e.exports={ProjectionUtils:r}},{proj4:"proj4"}],"models/tiles/tms_tile_source":[function(t,e,n){var r,o,i=function(t,e){function n(){this.constructor=t}for(var r in e)s.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},s={}.hasOwnProperty;r=t("./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,n){var r;return r=this.string_lookup_replace(this.get("url"),this.get("extra_url_vars")),r.replace("{X}",t).replace("{Y}",e).replace("{Z}",n)},e}(r),e.exports={Model:o}},{"./mercator_tile_source":"models/tiles/mercator_tile_source"}],"models/tiles/wmts_tile_source":[function(t,e,n){var r,o,i=function(t,e){function n(){this.constructor=t}for(var r in e)s.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},s={}.hasOwnProperty;r=t("./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,n){var r,o;return r=this.string_lookup_replace(this.get("url"),this.get("extra_url_vars")),o=this.tms_to_wmts(t,e,n),t=o[0],e=o[1],n=o[2],r.replace("{X}",t).replace("{Y}",e).replace("{Z}",n)},e}(r),e.exports={Model:o}},{"./mercator_tile_source":"models/tiles/mercator_tile_source"}],"models/tools/actions/action_tool":[function(t,e,n){var r,o,i,s,a=function(t,e){function n(){this.constructor=t}for(var r in e)l.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,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),r=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return a(e,t),e}(s.Model),e.exports={Model:r,View:i,ButtonView:o}},{"../button_tool":"models/tools/button_tool"}],"models/tools/actions/help_tool":[function(t,e,n){var r,o,i,s,a=function(t,e){function n(){this.constructor=t}for(var r in e)l.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},l={}.hasOwnProperty;s=t("underscore"),r=t("./action_tool"),i=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return a(e,t),e.prototype["do"]=function(){return window.open(this.mget("redirect"))},e}(r.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="HelpTool",e.prototype.tool_name="Help",e.prototype.icon="bk-tool-icon-help",e.prototype.initialize=function(t,n){return e.__super__.initialize.call(this,t,n),this.register_property("tooltip",function(){return this.get("help_tooltip")})},e.prototype.defaults=function(){return s.extend({},e.__super__.defaults.call(this),{help_tooltip:"Click the question mark to learn more about Bokeh plot tools.",redirect:"http://bokeh.pydata.org/en/latest/docs/user_guide/tools.html"})},e}(r.Model),e.exports={Model:o,View:i}},{"./action_tool":"models/tools/actions/action_tool",underscore:"underscore"}],"models/tools/actions/preview_save_tool":[function(t,e,n){var r,o,i,s,a,l,u,h=function(t,e){function n(){this.constructor=t}for(var r in e)c.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},c={}.hasOwnProperty;l=t("underscore"),r=t("jquery"),o=t("bootstrap/modal"),i=t("./action_tool"),u=t("./preview_save_tool_template"),a=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return h(e,t),e.prototype.className="bk-bs-modal",e.prototype.template=u,e.prototype.initialize=function(t){return e.__super__.initialize.call(this,t),this.render()},e.prototype.render=function(){return this.$el.empty(),this.$el.html(this.template()),this.$el.attr("tabindex","-1"),this.$el.on("hidden",function(t){return function(){return t.$el.modal("hide")}}(this)),this.$el.modal({show:!1})},e.prototype["do"]=function(){var t;return t=this.plot_view.canvas_view.canvas[0],this.$(".bk-bs-modal-body img").attr("src",t.toDataURL()),this.$el.modal("show")},e}(i.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="PreviewSaveTool",e.prototype.tool_name="Preview/Save",e.prototype.icon="bk-tool-icon-save",e}(i.Model),e.exports={Model:s,View:a}},{"./action_tool":"models/tools/actions/action_tool","./preview_save_tool_template":"models/tools/actions/preview_save_tool_template","bootstrap/modal":"bootstrap/modal",jquery:"jquery",underscore:"underscore"}],"models/tools/actions/preview_save_tool_template":[function(t,e,n){e.exports=function(t){t||(t={});var e,n=[],r=t.safe,o=t.escape;return e=t.safe=function(t){if(t&&t.ecoSafe)return t;("undefined"==typeof t||null==t)&&(t="");var e=new String(t);return e.ecoSafe=!0,e},o||(o=t.escape=function(t){return(""+t).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}),function(){(function(){n.push('<div class="bk-bs-modal-dialog">\n <div class="bk-bs-modal-content">\n <div class="bk-bs-modal-header">\n <button type="button" class="bk-bs-close" data-bk-bs-dismiss="modal">×</button>\n <h4 class="bk-bs-modal-title">Image Preview (right click -> \'Save As\' to save PNG)</h4>\n </div>\n <div class="bk-bs-modal-body">\n <img style="max-height: 300px; max-width: 400px">\n </div>\n <div class="bk-bs-modal-footer">\n <button type="button" class="bk-bs-btn bk-bs-btn-primary" data-bk-bs-dismiss="modal">Close</button>\n </div>\n </div>\n</div>')}).call(this)}.call(t),t.safe=r,t.escape=o,n.join("")}},{}],"models/tools/actions/redo_tool":[function(t,e,n){var r,o,i,s=function(t,e){function n(){this.constructor=t}for(var r in e)a.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},a={}.hasOwnProperty;r=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.set("disabled",!t.plot_view.can_redo())}}(this))},e.prototype["do"]=function(){return this.plot_view.redo()},e}(r.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.prototype.disabled=!0,e}(r.Model),e.exports={Model:o,View:i}},{"./action_tool":"models/tools/actions/action_tool"}],"models/tools/actions/reset_tool":[function(t,e,n){var r,o,i,s=function(t,e){function n(){this.constructor=t}for(var r in e)a.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},a={}.hasOwnProperty;r=t("./action_tool"),i=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return s(e,t),e.prototype["do"]=function(){return this.plot_view.clear_state(),this.plot_view.reset_range(),this.plot_view.reset_selection(),this.plot_view.reset_dimensions()},e}(r.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="ResetTool",e.prototype.tool_name="Reset",e.prototype.icon="bk-tool-icon-reset",e}(r.Model),e.exports={Model:o,View:i}},{"./action_tool":"models/tools/actions/action_tool"}],"models/tools/actions/undo_tool":[function(t,e,n){var r,o,i,s=function(t,e){function n(){this.constructor=t}for(var r in e)a.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},a={}.hasOwnProperty;r=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.set("disabled",!t.plot_view.can_undo())}}(this))},e.prototype["do"]=function(){return this.plot_view.undo()},e}(r.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.prototype.disabled=!0,e}(r.Model),e.exports={Model:o,View:i}},{"./action_tool":"models/tools/actions/action_tool"}],"models/tools/button_tool":[function(t,e,n){var r,o,i,s,a,l,u,h=function(t,e){function n(){this.constructor=t}for(var r in e)c.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},c={}.hasOwnProperty;l=t("underscore"),r=t("backbone"),a=t("./tool"),u=t("./button_tool_template"),i=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return h(e,t),e.prototype.tagName="li",e.prototype.template=u,e.prototype.events=function(){return"ontouchstart"in document?{"touchstart .bk-toolbar-button":"_clicked"}:{"click .bk-toolbar-button":"_clicked"}},e.prototype.initialize=function(t){return e.__super__.initialize.call(this,t),this.$el.html(this.template(this.model.attrs_and_props())),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.get("disabled")).toggleClass("active",this.model.get("active")),this},e.prototype._clicked=function(t){},e}(r.View),s=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return h(e,t),e}(a.View),o=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return h(e,t),e.prototype.initialize=function(t,n){return e.__super__.initialize.call(this,t,n),this.register_property("tooltip",function(){return this.get("tool_name")})},e.prototype.nonserializable_attribute_names=function(){return e.__super__.nonserializable_attribute_names.call(this).concat(["icon","disabled"])},e.prototype.defaults=function(){return l.extend({},e.__super__.defaults.call(this),{active:!1,disabled:null!=this.disabled?this.disabled:!1,tool_name:this.tool_name,icon:this.icon})},e}(a.Model),e.exports={Model:o,View:s,ButtonView:i}},{"./button_tool_template":"models/tools/button_tool_template","./tool":"models/tools/tool",backbone:"backbone",underscore:"underscore"}],"models/tools/button_tool_template":[function(t,e,n){e.exports=function(t){t||(t={});var e,n=[],r=function(t){return t&&t.ecoSafe?t:"undefined"!=typeof t&&null!=t?i(t):""},o=t.safe,i=t.escape;return e=t.safe=function(t){if(t&&t.ecoSafe)return t;("undefined"==typeof t||null==t)&&(t="");var e=new String(t);return e.ecoSafe=!0,e},i||(i=t.escape=function(t){return(""+t).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}),function(){(function(){n.push('<button type="button" class="bk-toolbar-button hover">\n <div class=\'bk-btn-icon '),n.push(r(this.icon)),n.push("' />\n <span class='tip'>"),n.push(r(this.tooltip)),n.push("</span>\n</button>\n")}).call(this)}.call(t),t.safe=o,t.escape=i,n.join("")}},{}],"models/tools/gestures/box_select_tool":[function(t,e,n){var r,o,i,s,a,l=function(t,e){function n(){this.constructor=t}for(var r in e)u.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},u={}.hasOwnProperty;a=t("underscore"),s=t("./select_tool"),r=t("../../annotations/box_annotation"),i=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return l(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,n,r,o,i,s,a,l,u;return n=this.plot_view.canvas,r=[n.sx_to_vx(t.bokeh.sx),n.sy_to_vy(t.bokeh.sy)],i=this.plot_model.get("frame"),o=this.mget("dimensions"),s=this.model._get_dim_limits(this._baseboint,r,i,o),l=s[0],u=s[1],this.mget("overlay").update({left:l[0],right:l[1],top:u[1],bottom:u[0]}),this.mget("select_every_mousemove")&&(e=null!=(a=t.srcEvent.shiftKey)?a:!1,this._select(l,u,!1,e)),null},e.prototype._pan_end=function(t){var e,n,r,o,i,s,a,l,u;return n=this.plot_view.canvas,r=[n.sx_to_vx(t.bokeh.sx),n.sy_to_vy(t.bokeh.sy)],i=this.plot_model.get("frame"),o=this.mget("dimensions"),s=this.model._get_dim_limits(this._baseboint,r,i,o),l=s[0],u=s[1],e=null!=(a=t.srcEvent.shiftKey)?a:!1,this._select(l,u,!0,e),this.mget("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,n,r){var o,i,s,a,l,u,h,c,p,_,d;
|
|
for(c=t[0],p=t[1],_=e[0],d=e[1],null==r&&(r=!1),i={type:"rect",vx0:c,vx1:p,vy0:_,vy1:d},u=this.mget("renderers"),s=0,a=u.length;a>s;s++)l=u[s],o=l.get("data_source"),h=o.get("selection_manager"),h.select(this,this.plot_view.renderers[l.id],i,n,r);return null!=this.mget("callback")&&this._emit_callback(i),this._save_geometry(i,n,r),null},e.prototype._emit_callback=function(t){var e,n,r,o,i;r=this.mget("renderers")[0],e=this.plot_model.get("canvas"),n=this.plot_model.get("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=n.get("x_mappers")[r.get("x_range_name")],i=n.get("y_mappers")[r.get("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.mget("callback").execute(this.model,{geometry:t})},e}(s.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="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.prototype.initialize=function(t,n){return e.__super__.initialize.call(this,t,n),this.get("overlay").set("silent_update",!0,{silent:!0}),this.register_property("tooltip",function(){return this._get_dim_tooltip(this.get("tool_name"),this._check_dims(this.get("dimensions"),"box select tool"))},!1),this.add_dependencies("tooltip",this,["dimensions"])},e.prototype.defaults=function(){return a.extend({},e.__super__.defaults.call(this),{dimensions:["width","height"],select_every_mousemove:!1,callback:null,overlay:new r.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]})})},e}(s.Model),e.exports={Model:o,View:i}},{"../../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,n){var r,o,i,s,a,l=function(t,e){function n(){this.constructor=t}for(var r in e)u.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},u={}.hasOwnProperty;a=t("underscore"),s=t("./gesture_tool"),r=t("../../annotations/box_annotation"),i=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return l(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,n,r,o,i,s,a;return e=this.plot_view.canvas,n=[e.sx_to_vx(t.bokeh.sx),e.sy_to_vy(t.bokeh.sy)],o=this.plot_model.get("frame"),r=this.mget("dimensions"),i=this.model._get_dim_limits(this._baseboint,n,o,r),s=i[0],a=i[1],this.mget("overlay").update({left:s[0],right:s[1],top:a[1],bottom:a[0]}),null},e.prototype._pan_end=function(t){var e,n,r,o,i,s,a;return e=this.plot_view.canvas,n=[e.sx_to_vx(t.bokeh.sx),e.sy_to_vy(t.bokeh.sy)],o=this.plot_model.get("frame"),r=this.mget("dimensions"),i=this.model._get_dim_limits(this._baseboint,n,o,r),s=i[0],a=i[1],this._update(s,a),this.mget("overlay").update({left:null,right:null,top:null,bottom:null}),this._baseboint=null,null},e.prototype._update=function(t,e){var n,r,o,i,s,a,l,u,h,c,p;if(!(Math.abs(t[1]-t[0])<=5||Math.abs(e[1]-e[0])<=5)){h={},i=this.plot_view.frame.get("x_mappers");for(o in i)r=i[o],s=r.v_map_from_target(t,!0),u=s[0],n=s[1],h[o]={start:u,end:n};c={},a=this.plot_view.frame.get("y_mappers");for(o in a)r=a[o],l=r.v_map_from_target(e,!0),u=l[0],n=l[1],c[o]={start:u,end:n};return p={xrs:h,yrs:c},this.plot_view.push_state("box_zoom",{range:p}),this.plot_view.update_range(p)}},e}(s.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="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.prototype.initialize=function(t,n){return e.__super__.initialize.call(this,t,n),this.get("overlay").set("silent_update",!0,{silent:!0}),this.register_property("tooltip",function(){return this._get_dim_tooltip(this.get("tool_name"),this._check_dims(this.get("dimensions"),"box zoom tool"))},!1),this.add_dependencies("tooltip",this,["dimensions"])},e.prototype.defaults=function(){return a.extend({},e.__super__.defaults.call(this),{dimensions:["width","height"],overlay:new r.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]})})},e}(s.Model),e.exports={Model:o,View:i}},{"../../annotations/box_annotation":"models/annotations/box_annotation","./gesture_tool":"models/tools/gestures/gesture_tool",underscore:"underscore"}],"models/tools/gestures/gesture_tool":[function(t,e,n){var r,o,i,s,a,l=function(t,e){function n(){this.constructor=t}for(var r in e)u.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},u={}.hasOwnProperty;a=t("underscore"),r=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.get("active"),this.model.set("active",!t)},e}(r.ButtonView),s=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return l(e,t),e}(r.View),o=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return l(e,t),e.prototype.nonserializable_attribute_names=function(){return e.__super__.nonserializable_attribute_names.call(this).concat(["event_type","default_order"])},e.prototype.defaults=function(){return a.extend({},e.__super__.defaults.call(this),{event_type:this.event_type,default_order:this.default_order})},e}(r.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,n){var r,o,i,s,a,l=function(t,e){function n(){this.constructor=t}for(var r in e)u.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},u={}.hasOwnProperty;a=t("underscore"),s=t("./select_tool"),i=t("../../annotations/poly_annotation"),o=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.listenTo(this.model,"change:active",this._active_change),this.data=null},e.prototype._active_change=function(){return this.mget("active")?void 0:this._clear_overlay()},e.prototype._keyup=function(t){return 13===t.keyCode?this._clear_overlay():void 0},e.prototype._pan_start=function(t){var e,n,r;return e=this.plot_view.canvas,n=e.sx_to_vx(t.bokeh.sx),r=e.sy_to_vy(t.bokeh.sy),this.data={vx:[n],vy:[r]},null},e.prototype._pan=function(t){var e,n,r,o,i,s;return n=this.plot_view.canvas,i=n.sx_to_vx(t.bokeh.sx),s=n.sy_to_vy(t.bokeh.sy),this.data.vx.push(i),this.data.vy.push(s),r=this.mget("overlay"),r.update({xs:this.data.vx,ys:this.data.vy}),this.mget("select_every_mousemove")?(e=null!=(o=t.srcEvent.shiftKey)?o:!1,this._select(this.data.vx,this.data.vy,!1,e)):void 0},e.prototype._pan_end=function(t){var e,n;return this._clear_overlay(),e=null!=(n=t.srcEvent.shiftKey)?n:!1,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.mget("overlay").update({xs:[],ys:[]})},e.prototype._select=function(t,e,n,r){var o,i,s,a,l,u,h;for(i={type:"poly",vx:t,vy:e},u=this.mget("renderers"),s=0,a=u.length;a>s;s++)l=u[s],o=l.get("data_source"),h=o.get("selection_manager"),h.select(this,this.plot_view.renderers[l.id],i,n,r);return this._save_geometry(i,n,r),null},e}(s.View),r=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return l(e,t),e.prototype.default_view=o,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.prototype.initialize=function(t,n){return e.__super__.initialize.call(this,t,n),this.get("overlay").set("silent_update",!0,{silent:!0})},e.prototype.defaults=function(){return a.extend({},e.__super__.defaults.call(this),{select_every_mousemove:!0,overlay:new i.Model({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]})})},e}(s.Model),e.exports={Model:r,View:o}},{"../../annotations/poly_annotation":"models/annotations/poly_annotation","./select_tool":"models/tools/gestures/select_tool",underscore:"underscore"}],"models/tools/gestures/pan_tool":[function(t,e,n){var r,o,i,s,a=function(t,e){function n(){this.constructor=t}for(var r in e)l.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},l={}.hasOwnProperty;s=t("underscore"),r=t("./gesture_tool"),i=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return a(e,t),e.prototype._pan_start=function(t){var e,n,r,o,i,s;return this.last_dx=0,this.last_dy=0,e=this.plot_view.canvas,n=this.plot_view.frame,i=e.sx_to_vx(t.bokeh.sx),s=e.sy_to_vy(t.bokeh.sy),n.contains(i,s)||(r=n.get("h_range"),o=n.get("v_range"),(i<r.get("start")||i>r.get("end"))&&(this.v_axis_only=!0),(s<o.get("start")||s>o.get("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){return this.h_axis_only=!1,this.v_axis_only=!1,null!=this.pan_info?this.plot_view.push_state("pan",{range:this.pan_info}):void 0},e.prototype._update=function(t,e){var n,r,o,i,a,l,u,h,c,p,_,d,f,m,g,y,v,b,x,w,k,M,j,T,z,E,P;o=this.plot_view.frame,h=t-this.last_dx,c=e-this.last_dy,i=s.clone(o.get("h_range")),w=i.get("start")-h,x=i.get("end")-h,z=s.clone(o.get("v_range")),T=z.get("start")-c,j=z.get("end")-c,n=this.mget("dimensions"),n.indexOf("width")>-1&&!this.v_axis_only?(v=w,b=x,m=-h):(v=i.get("start"),b=i.get("end"),m=0),n.indexOf("height")>-1&&!this.h_axis_only?(k=T,M=j,g=c):(k=z.get("start"),M=z.get("end"),g=0),this.last_dx=t,this.last_dy=e,E={},p=o.get("x_mappers");for(u in p)l=p[u],_=l.v_map_from_target([v,b],!0),y=_[0],r=_[1],E[u]={start:y,end:r};P={},d=o.get("y_mappers");for(u in d)l=d[u],f=l.v_map_from_target([k,M],!0),y=f[0],r=f[1],P[u]={start:y,end:r};return this.pan_info={xrs:E,yrs:P,sdx:m,sdy:g},this.plot_view.update_range(this.pan_info,a=!0),null},e}(r.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="PanTool",e.prototype.tool_name="Pan",e.prototype.icon="bk-tool-icon-pan",e.prototype.event_type="pan",e.prototype.default_order=10,e.prototype.initialize=function(t,n){return e.__super__.initialize.call(this,t,n),this.register_property("tooltip",function(){return this._get_dim_tooltip("Pan",this._check_dims(this.get("dimensions"),"pan tool"))},!1),this.add_dependencies("tooltip",this,["dimensions"])},e.prototype.nonserializable_attribute_names=function(){return e.__super__.nonserializable_attribute_names.call(this).concat(["level","default_order","event_type"])},e.prototype.defaults=function(){return s.extend({},e.__super__.defaults.call(this),{dimensions:["width","height"]})},e}(r.Model),e.exports={Model:o,View:i}},{"./gesture_tool":"models/tools/gestures/gesture_tool",underscore:"underscore"}],"models/tools/gestures/poly_select_tool":[function(t,e,n){var r,o,i,s,a,l=function(t,e){function n(){this.constructor=t}for(var r in e)u.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},u={}.hasOwnProperty;a=t("underscore"),s=t("./select_tool"),r=t("../../annotations/poly_annotation"),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.listenTo(this.model,"change:active",this._active_change),this.data=null},e.prototype._active_change=function(){return this.mget("active")?void 0:this._clear_data()},e.prototype._keyup=function(t){return 13===t.keyCode?this._clear_data():void 0},e.prototype._doubletap=function(t){var e,n;return e=null!=(n=t.srcEvent.shiftKey)?n:!1,this._select(this.data.vx,this.data.vy,!0,e),this._clear_data()},e.prototype._clear_data=function(){return this.data=null,this.mget("overlay").update({xs:[],ys:[]})},e.prototype._tap=function(t){var e,n,r,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),r=this.mget("overlay"),n={},n.vx=a.clone(this.data.vx),n.vy=a.clone(this.data.vy),r.update({xs:this.data.vx,ys:this.data.vy}))},e.prototype._select=function(t,e,n,r){var o,i,s,a,l,u,h;for(i={type:"poly",vx:t,vy:e},u=this.mget("renderers"),s=0,a=u.length;a>s;s++)l=u[s],o=l.get("data_source"),h=o.get("selection_manager"),h.select(this,this.plot_view.renderers[l.id],i,n,r);return this._save_geometry(i,n,r),this.plot_view.push_state("poly_select",{selection:this.plot_view.get_selection()}),null},e}(s.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="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.prototype.defaults=function(){return a.extend({},e.__super__.defaults.call(this),{overlay:new r.Model({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]})})},e.prototype.initialize=function(t,n){return e.__super__.initialize.call(this,t,n),this.get("overlay").set("silent_update",!0,{silent:!0})},e}(s.Model),e.exports={Model:o,View:i}},{"../../annotations/poly_annotation":"models/annotations/poly_annotation","./select_tool":"models/tools/gestures/select_tool",underscore:"underscore"}],"models/tools/gestures/resize_tool":[function(t,e,n){var r,o,i,s,a=function(t,e){function n(){this.constructor=t}for(var r in e)l.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},l={}.hasOwnProperty;s=t("underscore"),r=t("./gesture_tool"),i=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return a(e,t),e.prototype.className="bk-resize-popup",e.prototype.initialize=function(t){var n;return e.__super__.initialize.call(this,t),n=this.plot_view.$el.find("div.bk-canvas-wrapper"),this.$el.appendTo(n),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,n,r,o;return this.active?(e=this.plot_view.canvas,n=this.plot_view.frame,r=e.vx_to_sx(n.get("h_range").get("end")-40),o=e.vy_to_sy(n.get("v_range").get("start")+40),this.$el.attr("style","position:absolute; top:"+o+"px; left:"+r+"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.get("height"),this.cw=e.get("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.get("width"),height:this.plot_view.canvas.get("height")}})},e.prototype._update=function(t,e){var n;return this.plot_view.pause(),n=this.plot_view.canvas,n._set_dims([this.cw+t,this.ch+e]),this.plot_view.unpause(),null},e}(r.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="ResizeTool",e.prototype.tool_name="Resize",e.prototype.icon="bk-tool-icon-resize",e.prototype.event_type="pan",e.prototype.default_order=40,e.prototype.nonserializable_attribute_names=function(){return e.__super__.nonserializable_attribute_names.call(this).concat(["data"])},e.prototype.defaults=function(){return s.extend({},e.__super__.defaults.call(this),{level:"overlay",data:{}})},e}(r.Model),e.exports={Model:o,View:i}},{"./gesture_tool":"models/tools/gestures/gesture_tool",underscore:"underscore"}],"models/tools/gestures/select_tool":[function(t,e,n){var r,o,i,s,a,l=function(t,e){function n(){this.constructor=t}for(var r in e)u.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},u={}.hasOwnProperty;s=t("underscore"),a=t("../../../common/logging").logger,r=t("./gesture_tool"),i=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return l(e,t),e.prototype._keyup=function(t){var e,n,r,o,i,s,a;if(27===t.keyCode){for(i=this.mget("renderers"),s=[],n=0,r=i.length;r>n;n++)o=i[n],e=o.get("data_source"),a=e.get("selection_manager"),s.push(a.clear());return s}},e.prototype._save_geometry=function(t,e,n){var r,o,i,l,u,h,c,p;if(r=s.clone(t),c=this.plot_view.frame.get("x_mappers")["default"],p=this.plot_view.frame.get("y_mappers")["default"],"point"===r.type)r.x=c.map_from_target(r.vx),r.y=p.map_from_target(r.vy);else if("rect"===r.type)r.x0=c.map_from_target(r.vx0),r.y0=p.map_from_target(r.vy0),r.x1=c.map_from_target(r.vx1),r.y1=p.map_from_target(r.vy1);else if("poly"===r.type)for(r.x=new Array(r.vx.length),r.y=new Array(r.vy.length),i=l=0,u=r.vx.length;u>=0?u>l:l>u;i=u>=0?++l:--l)r.x[i]=c.map_from_target(r.vx[i]),r.y[i]=p.map_from_target(r.vy[i]);else a.debug("Unrecognized selection geometry type: '"+r.type+"'");return e&&(h=this.plot_model.get("tool_events"),n?(o=h.get("geometries"),o.push(r)):o=[r],h.set("geometries",o)),null},e}(r.View),o=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return l(e,t),e.prototype.initialize=function(t,n){var r,o,i,s,l,u;for(e.__super__.initialize.call(this,t,n),s=this.get("names"),u=this.get("renderers"),0===u.length&&(r=this.get("plot").get("renderers"),u=function(){var t,e,n;for(n=[],t=0,e=r.length;e>t;t++)l=r[t],"GlyphRenderer"===l.type&&n.push(l);return n}()),s.length>0&&(u=function(){var t,e,n;for(n=[],t=0,e=u.length;e>t;t++)l=u[t],s.indexOf(l.get("name"))>=0&&n.push(l);return n}()),this.set("renderers",u),a.debug("setting "+u.length+" renderers for "+this.type+" "+this.id),o=0,i=u.length;i>o;o++)l=u[o],a.debug(" - "+l.type+" "+l.id);return null},e.prototype.nonserializable_attribute_names=function(){return e.__super__.nonserializable_attribute_names.call(this).concat(["multi_select_modifier"])},e.prototype.defaults=function(){return s.extend({},e.__super__.defaults.call(this),{renderers:[],names:[],multi_select_modifier:"shift"})},e}(r.Model),e.exports={Model:o,View:i}},{"../../../common/logging":"common/logging","./gesture_tool":"models/tools/gestures/gesture_tool",underscore:"underscore"}],"models/tools/gestures/tap_tool":[function(t,e,n){var r,o,i,s,a=function(t,e){function n(){this.constructor=t}for(var r in e)l.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},l={}.hasOwnProperty;s=t("underscore"),r=t("./select_tool"),i=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return a(e,t),e.prototype._tap=function(t){var e,n,r,o,i;return n=this.plot_view.canvas,o=n.sx_to_vx(t.bokeh.sx),i=n.sy_to_vy(t.bokeh.sy),e=null!=(r=t.srcEvent.shiftKey)?r:!1,this._select(o,i,!0,e)},e.prototype._select=function(t,e,n,r){var o,i,s,a,l,u,h,c;for(s={type:"point",vx:t,vy:e},o=this.mget("callback"),h=this.mget("renderers"),a=0,l=h.length;l>a;a++)u=h[a],i=u.get("data_source"),c=i.get("selection_manager"),c.select(this,this.plot_view.renderers[u.id],s,n,r),null!=o&&o.execute(i);return this._save_geometry(s,n,r),this.plot_view.push_state("tap",{selection:this.plot_view.get_selection()}),null},e}(r.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="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.prototype.defaults=function(){return s.extend({},e.__super__.defaults.call(this),{callback:null})},e}(r.Model),e.exports={Model:o,View:i}},{"./select_tool":"models/tools/gestures/select_tool",underscore:"underscore"}],"models/tools/gestures/wheel_zoom_tool":[function(t,e,n){var r,o,i,s,a,l=function(t,e){function n(){this.constructor=t}for(var r in e)u.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},u={}.hasOwnProperty;s=t("underscore"),r=t("./gesture_tool"),("undefined"==typeof a||null===a)&&(a={}),i=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return l(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,n,r,o,i,s,a,l,u,h,c,p,_,d,f,m,g,y,v,b,x,w,k,M,j,T,z,E,P,S,C;i=this.plot_model.get("frame"),a=i.get("h_range"),w=i.get("v_range"),k=this.plot_view.canvas.sx_to_vx(t.bokeh.sx),T=this.plot_view.canvas.sy_to_vy(t.bokeh.sy),(k<a.get("start")||k>a.get("end"))&&(x=!0),(T<w.get("start")||T>w.get("end"))&&(s=!0),u=navigator.userAgent.toLowerCase().indexOf("firefox")>-1?20:1,e=null!=(null!=(c=t.originalEvent)?c.deltaY:void 0)?-t.originalEvent.deltaY*u:t.bokeh.delta,o=this.mget("speed")*e,o>.9?o=.9:-.9>o&&(o=-.9),j=a.get("start"),M=a.get("end"),E=w.get("start"),z=w.get("end"),n=this.mget("dimensions"),n.indexOf("width")>-1&&!x?(g=j-(j-k)*o,y=M-(M-k)*o):(g=j,y=M),n.indexOf("height")>-1&&!s?(v=E-(E-T)*o,b=z-(z-T)*o):(v=E,b=z),P={},p=i.get("x_mappers");for(h in p)l=p[h],_=l.v_map_from_target([g,y],!0),m=_[0],r=_[1],P[h]={start:m,end:r};S={},d=i.get("y_mappers");for(h in d)l=d[h],f=l.v_map_from_target([v,b],!0),m=f[0],r=f[1],S[h]={start:m,end:r};return C={xrs:P,yrs:S,factor:o},this.plot_view.push_state("wheel_zoom",{range:C}),this.plot_view.update_range(C),this.plot_view.interactive_timestamp=Date.now(),null},e}(r.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="WheelZoomTool",e.prototype.tool_name="Wheel Zoom",e.prototype.icon="bk-tool-icon-wheel-zoom",e.prototype.event_type="ontouchstart"in window.document?"pinch":"scroll",e.prototype.default_order=10,e.prototype.initialize=function(t,n){return e.__super__.initialize.call(this,t,n),this.register_property("tooltip",function(){return this._get_dim_tooltip(this.get("tool_name"),this._check_dims(this.get("dimensions"),"wheel zoom tool"))},!1),this.add_dependencies("tooltip",this,["dimensions"])},e.prototype.nonserializable_attribute_names=function(){return e.__super__.nonserializable_attribute_names.call(this).concat(["speed"])},e.prototype.defaults=function(){return s.extend({},e.__super__.defaults.call(this),{dimensions:["width","height"],speed:1/600})},e}(r.Model),e.exports={Model:o,View:i}},{"./gesture_tool":"models/tools/gestures/gesture_tool",underscore:"underscore"}],"models/tools/inspectors/crosshair_tool":[function(t,e,n){var r,o,i,s,a,l=function(t,e){function n(){this.constructor=t}for(var r in e)u.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},u={}.hasOwnProperty;a=t("underscore"),s=t("../../annotations/span"),i=t("./inspect_tool"),o=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return l(e,t),e.prototype._move=function(t){var e,n,r,o,i,s,a,l,u,h;if(this.mget("active")){for(r=this.plot_model.get("frame"),e=this.plot_model.get("canvas"),u=e.sx_to_vx(t.bokeh.sx),h=e.sy_to_vy(t.bokeh.sy),s=this.mget("dimensions"),a=[],o=0,i=s.length;i>o;o++)n=s[o],l=this.mget("spans")[n],r.contains(u,h)?"width"===n?a.push(l.set("computed_location",h)):a.push(l.set("computed_location",u)):a.push(l.unset("computed_location"));return a}},e.prototype._move_exit=function(t){var e,n,r,o,i,s;for(o=this.mget("dimensions"),i=[],n=0,r=o.length;r>n;n++)e=o[n],s=this.mget("spans")[e],i.push(s.unset("computed_location"));return i},e}(i.View),r=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return l(e,t),e.prototype.default_view=o,e.prototype.type="CrosshairTool",e.prototype.tool_name="Crosshair",e.prototype.initialize=function(t,n){var r;return e.__super__.initialize.call(this,t,n),this.register_property("tooltip",function(){return this._get_dim_tooltip("Crosshair",this._check_dims(this.get("dimensions"),"crosshair tool"))},!1),this.add_dependencies("tooltip",this,["dimensions"]),this.set("spans",{width:new s.Model({for_hover:!0,dimension:"width",render_mode:this.get("render_mode"),location_units:this.get("location_units"),line_color:this.get("line_color"),line_width:this.get("line_width"),line_alpha:this.get("line_alpha")}),height:new s.Model({for_hover:!0,dimension:"height",render_mode:this.get("render_mode"),location_units:this.get("location_units"),line_color:this.get("line_color"),line_width:this.get("line_width"),line_alpha:this.get("line_alpha")})}),r=this.get("plot").get("renderers"),r.push(this.get("spans").width),r.push(this.get("spans").height),this.get("plot").set("renderers",r)},e.prototype.nonserializable_attribute_names=function(){return e.__super__.nonserializable_attribute_names.call(this).concat(["location_units","render_mode","spans"])},e.prototype.defaults=function(){return a.extend({},e.__super__.defaults.call(this),{dimensions:["width","height"],location_units:"screen",render_mode:"css",line_color:"black",line_width:1,line_alpha:1})},e}(i.Model),e.exports={Model:r,View:o}},{"../../annotations/span":"models/annotations/span","./inspect_tool":"models/tools/inspectors/inspect_tool",underscore:"underscore"}],"models/tools/inspectors/hover_tool":[function(t,e,n){var r,o,i,s,a,l,u,h,c,p,_=function(t,e){function n(){this.constructor=t}for(var r in e)d.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},d={}.hasOwnProperty;u=t("underscore"),r=t("jquery"),p=t("../../../common/logging").logger,a=t("../../annotations/tooltip"),l=t("../../../util/util"),s=t("./inspect_tool"),c=t("../../../common/hittest"),h=function(t){var e,n,r,o,i;return"#"===t.substr(0,1)?t:(n=/(.*?)rgb\((\d+), (\d+), (\d+)\)/.exec(t),o=parseInt(n[2]),r=parseInt(n[3]),e=parseInt(n[4]),i=e|r<<8|o<<16,n[1]+"#"+i.toString(16))},i=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return _(e,t),e.prototype.bind_bokeh_events=function(){var t,e,n,r;for(r=this.mget("computed_renderers"),t=0,e=r.length;e>t;t++)n=r[t],this.listenTo(n.get("data_source"),"inspect",this._update);return this.plot_view.canvas_view.canvas_wrapper.css("cursor","crosshair")},e.prototype._move=function(t){var e,n,r,o,i,s;if(this.mget("active")){if(e=this.plot_view.canvas,i=e.sx_to_vx(t.bokeh.sx),s=e.sy_to_vy(t.bokeh.sy),this.plot_view.frame.contains(i,s))return this._inspect(i,s);n=this.mget("ttmodels");for(r in n)o=n[r],o.clear()}},e.prototype._move_exit=function(){var t,e,n,r;t=this.mget("ttmodels"),e=[];for(n in t)r=t[n],e.push(r.clear());return e},e.prototype._inspect=function(t,e,n){var r,o,i,s,a,l,u,h;for(r={type:"point",vx:t,vy:e},"mouse"===this.mget("mode")?r.type="point":(r.type="span","vline"===this.mget("mode")?r.direction="h":r.direction="v"),o=[],i=[],u=this.mget("computed_renderers"),s=0,a=u.length;a>s;s++)l=u[s],h=l.get("data_source").get("selection_manager"),h.inspect(this,this.plot_view.renderers[l.id],r,{geometry:r});null!=this.mget("callback")&&this._emit_callback(r)},e.prototype._update=function(t,e,n,r,o){var i,s,a,l,u,h,p,_,d,f,m,g,y,v,b,x,w,k,M,j,T,z,E,P,S,C,A,O,N,q,F,D,I,R,B,L,G,U,$,V,H,Y,W;if(m=o.geometry,L=null!=(M=this.mget("ttmodels")[n.model.id])?M:null,null!=L&&(L.clear(),j=[t["1d"].indices,t["2d"].indices],y=j[0],v=j[1],null!==t["0d"].glyph||0!==y.length||0!==v.length)){for(U=m.vx,$=m.vy,i=this.plot_model.get("canvas"),f=this.plot_model.get("frame"),R=i.vx_to_sx(U),B=i.vy_to_sy($),H=f.get("x_mappers")[n.mget("x_range_name")],W=f.get("y_mappers")[n.mget("y_range_name")],V=H.map_from_target(U),Y=W.map_from_target($),z=t["0d"].indices,b=0,w=z.length;w>b;b++)g=z[b],h=n.glyph.x[g+1],p=n.glyph.y[g+1],"interp"===this.mget("line_policy")?(E=n.glyph.get_interpolation_hit(g,m),h=E[0],p=E[1],q=H.map_to_target(h),F=W.map_to_target(p)):"prev"===this.mget("line_policy")?(q=i.sx_to_vx(n.glyph.sx[g]),F=i.sy_to_vy(n.glyph.sy[g])):"next"===this.mget("line_policy")?(q=i.sx_to_vx(n.glyph.sx[g+1]),F=i.sy_to_vy(n.glyph.sy[g+1])):"nearest"===this.mget("line_policy")?(s=n.glyph.sx[g],a=n.glyph.sy[g],_=c.dist_2_pts(s,a,R,B),l=n.glyph.sx[g+1],u=n.glyph.sy[g+1],d=c.dist_2_pts(l,u,R,B),d>_?(P=[s,a],D=P[0],I=P[1]):(S=[l,u],D=S[0],I=S[1],g+=1),h=n.glyph.x[g],p=n.glyph.y[g],q=i.sx_to_vx(D),F=i.sy_to_vy(I)):(C=[U,$],q=C[0],F=C[1]),G={index:g,x:V,y:Y,vx:U,vy:$,sx:R,sy:B,data_x:h,data_y:p,rx:q,ry:F},L.add(q,F,this._render_tooltips(r,g,G));for(A=t["1d"].indices,x=0,k=A.length;k>x;x++)g=A[x],h=null!=(O=n.glyph.x)?O[g]:void 0,p=null!=(N=n.glyph.y)?N[g]:void 0,"snap_to_data"===this.mget("point_policy")?(q=i.sx_to_vx(n.glyph.scx(g,R,B)),F=i.sy_to_vy(n.glyph.scy(g,R,B))):(T=[U,$],q=T[0],F=T[1]),G={index:g,x:V,y:Y,vx:U,vy:$,sx:R,sy:B,data_x:h,data_y:p},L.add(q,F,this._render_tooltips(r,g,G));return null}},e.prototype._emit_callback=function(t){var e,n,r,o,i,s;o=this.mget("computed_renderers")[0],r=this.plot_view.renderers[o.id].hit_test(t),e=this.plot_model.get("canvas"),n=this.plot_model.get("frame"),t.sx=e.vx_to_sx(t.vx),t.sy=e.vy_to_sy(t.vy),i=n.get("x_mappers")[o.get("x_range_name")],s=n.get("y_mappers")[o.get("y_range_name")],t.x=i.map_from_target(t.vx),t.y=s.map_from_target(t.vy),this.mget("callback").execute(this.model,{index:r,geometry:t})},e.prototype._render_tooltips=function(t,e,n){var o,i,s,a,c,p,_,d,f,m,g,y,v,b,x,w,k,M;if(k=this.mget("tooltips"),u.isString(k))return r("<div>").html(l.replace_placeholders(k,t,e,n));for(x=r("<table></table>"),c=0,_=k.length;_>c;c++){if(m=k[c],p=m[0],M=m[1],y=r("<tr></tr>"),y.append(r("<td class='bk-tooltip-row-label'>").text(p+": ")),w=r("<td class='bk-tooltip-row-value'></td>"),M.indexOf("$color")>=0){if(g=M.match(/\$color(\[.*\])?:(\w*)/),d=g[0],f=g[1],o=g[2],s=t.get_column(o),null==s){v=r("<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=r("<span>(null)</span>"),w.append(v);continue}a&&(i=h(i)),v=r("<span>").text(i),w.append(v),b&&(v=r("<span class='bk-tooltip-color-block'> </span>"),v.css({backgroundColor:i})),w.append(v)}else M=M.replace("$~","$data_"),M=l.replace_placeholders(M,t,e,n),w.append(r("<span>").html(M));y.append(w),x.append(y)}return x},e}(s.View),o=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return _(e,t),e.prototype.default_view=i,e.prototype.type="HoverTool",e.prototype.tool_name="Hover Tool",e.prototype.icon="bk-tool-icon-hover",e.prototype.nonserializable_attribute_names=function(){return e.__super__.nonserializable_attribute_names.call(this).concat(["ttmodels","computed_renderers"])},e.prototype.initialize=function(t,n){return e.__super__.initialize.call(this,t,n)},e.prototype.initialize=function(t,n){var r,o,i,s,l,h,c,_,d,f,m,g;for(e.__super__.initialize.call(this,t,n),h=this.get("names"),d=this.get("renderers"),0===d.length&&(r=this.get("plot").get("renderers"),d=function(){var t,e,n;for(n=[],t=0,e=r.length;e>t;t++)c=r[t],"GlyphRenderer"===c.type&&n.push(c);
|
|
return n}()),h.length>0&&(d=function(){var t,e,n;for(n=[],t=0,e=d.length;e>t;t++)c=d[t],h.indexOf(c.get("name"))>=0&&n.push(c);return n}()),this.set("computed_renderers",d),p.debug("setting "+d.length+" computed renderers for "+this.type+" "+this.id),o=0,s=d.length;s>o;o++)c=d[o],p.debug(" - "+c.type+" "+c.id);if(g={},d=this.get("plot").get("renderers"),m=this.get("tooltips"),null!=m)for(_=this.get("computed_renderers"),i=0,l=_.length;l>i;i++)c=_[i],f=new a.Model,f.set("custom",u.isString(m)),g[c.id]=f,d.push(f);this.set("ttmodels",g),this.get("plot").set("renderers",d)},e.prototype.defaults=function(){return u.extend({},e.__super__.defaults.call(this),{tooltips:[["index","$index"],["data (x, y)","($x, $y)"],["canvas (x, y)","($sx, $sy)"]],renderers:[],names:[],mode:"mouse",point_policy:"snap_to_data",line_policy:"prev",callback:null})},e}(s.Model),e.exports={Model:o,View:i}},{"../../../common/hittest":"common/hittest","../../../common/logging":"common/logging","../../../util/util":"util/util","../../annotations/tooltip":"models/annotations/tooltip","./inspect_tool":"models/tools/inspectors/inspect_tool",jquery:"jquery",underscore:"underscore"}],"models/tools/inspectors/inspect_tool":[function(t,e,n){var r,o,i,s,a,l,u,h=function(t,e){function n(){this.constructor=t}for(var r in e)c.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},c={}.hasOwnProperty;l=t("underscore"),r=t("backbone"),a=t("../tool"),u=t("./inspect_tool_list_item_template"),i=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return h(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(this.model.attrs_and_props())),this},e.prototype._clicked=function(t){var e;return e=this.model.get("active"),this.model.set("active",!e)},e}(r.View),s=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return h(e,t),e}(a.View),o=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return h(e,t),e.prototype.event_type="move",e.prototype.nonserializable_attribute_names=function(){var t;return t=l.without(e.__super__.nonserializable_attribute_names.call(this),"active"),t.concat(["event_type","inner_only"])},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,n){},e.prototype._exit_inner=function(){},e.prototype._exit_outer=function(){},e.prototype.defaults=function(){return l.extend({},e.__super__.defaults.call(this),{inner_only:!0,active:!0,event_type:"move"})},e}(a.Model),e.exports={Model:o,View:s,ListItemView:i}},{"../tool":"models/tools/tool","./inspect_tool_list_item_template":"models/tools/inspectors/inspect_tool_list_item_template",backbone:"backbone",underscore:"underscore"}],"models/tools/inspectors/inspect_tool_list_item_template":[function(t,e,n){e.exports=function(t){t||(t={});var e,n=[],r=function(t){return t&&t.ecoSafe?t:"undefined"!=typeof t&&null!=t?i(t):""},o=t.safe,i=t.escape;return e=t.safe=function(t){if(t&&t.ecoSafe)return t;("undefined"==typeof t||null==t)&&(t="");var e=new String(t);return e.ecoSafe=!0,e},i||(i=t.escape=function(t){return(""+t).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}),function(){(function(){n.push('<input type="checkbox" '),this.active&&n.push("checked"),n.push(">"),n.push(r(this.tool_name)),n.push("</input>\n")}).call(this)}.call(t),t.safe=o,t.escape=i,n.join("")}},{}],"models/tools/tool":[function(t,e,n){var r,o,i,s,a,l,u=function(t,e){function n(){this.constructor=t}for(var r in e)h.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},h={}.hasOwnProperty;a=t("underscore"),r=t("../../model"),l=t("../../common/logging").logger,o=t("../../common/plot_widget"),s=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return u(e,t),e.prototype.bind_bokeh_events=function(){return this.listenTo(this.model,"change:active",function(t){return function(){return t.mget("active")?t.activate():t.deactivate()}}(this))},e.prototype.activate=function(){},e.prototype.deactivate=function(){},e}(o),i=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return u(e,t),e.prototype.nonserializable_attribute_names=function(){return e.__super__.nonserializable_attribute_names.call(this).concat(["active","level","tool_name"])},e.prototype._check_dims=function(t,e){var n,r,o;return r=[!1,!1],o=r[0],n=r[1],0===t.length?l.warn(e+" given empty dimensions"):1===t.length?"width"!==t[0]&&"height"!==t[0]&&l.warn(e+" given unrecognized dimensions: "+t):2===t.length?(t.indexOf("width")<0||t.indexOf("height")<0)&&l.warn(e+" given unrecognized dimensions: "+t):l.warn(e+" given more than two dimensions: "+t),t.indexOf("width")>=0&&(o=!0),t.indexOf("height")>=0&&(n=!0),[o,n]},e.prototype._get_dim_tooltip=function(t,e){var n,r;return r=e[0],n=e[1],r&&!n?t+" (x-axis)":n&&!r?t+" (y-axis)":t},e.prototype._get_dim_limits=function(t,e,n,r){var o,i,s,l,u,h,c,p;return s=t[0],h=t[1],l=e[0],c=e[1],o=n.get("h_range"),r.indexOf("width")>=0?(u=[a.min([s,l]),a.max([s,l])],u=[a.max([u[0],o.get("min")]),a.min([u[1],o.get("max")])]):u=[o.get("min"),o.get("max")],i=n.get("v_range"),r.indexOf("height")>=0?(p=[a.min([h,c]),a.max([h,c])],p=[a.max([p[0],i.get("min")]),a.min([p[1],i.get("max")])]):p=[i.get("min"),i.get("max")],[u,p]},e.prototype.defaults=function(){return a.extend({},e.__super__.defaults.call(this),{plot:null,tool_name:this.tool_name,level:"overlay"})},e}(r),e.exports={Model:i,View:s}},{"../../common/logging":"common/logging","../../common/plot_widget":"common/plot_widget","../../model":"model",underscore:"underscore"}],"palettes/palettes":[function(t,e,n){e.exports={YlGn3:[3253076,11394446,16252089],YlGn4:[2327619,7915129,12773017,16777164],YlGn5:[26679,3253076,7915129,12773017,16777164],YlGn6:[26679,3253076,7915129,11394446,14282915,16777164],YlGn7:[23090,2327619,4303709,7915129,11394446,14282915,16777164],YlGn8:[23090,2327619,4303709,7915129,11394446,14282915,16252089,16777189],YlGn9:[17705,26679,2327619,4303709,7915129,11394446,14282915,16252089,16777189],YlGnBu3:[2916280,8375739,15595697],YlGnBu4:[2252456,4306628,10607284,16777164],YlGnBu5:[2438292,2916280,4306628,10607284,16777164],YlGnBu6:[2438292,2916280,4306628,8375739,13101492,16777164],YlGnBu7:[797828,2252456,1937856,4306628,8375739,13101492,16777164],YlGnBu8:[797828,2252456,1937856,4306628,8375739,13101492,15595697,16777177],YlGnBu9:[531800,2438292,2252456,1937856,4306628,8375739,13101492,15595697,16777177],GnBu3:[4432586,11066805,14742491],GnBu4:[2854078,8113348,12248252,15792616],GnBu5:[551084,4432586,8113348,12248252,15792616],GnBu6:[551084,4432586,8113348,11066805,13429701,15792616],GnBu7:[546974,2854078,5157843,8113348,11066805,13429701,15792616],GnBu8:[546974,2854078,5157843,8113348,11066805,13429701,14742491,16252144],GnBu9:[540801,551084,2854078,5157843,8113348,11066805,13429701,14742491,16252144],BuGn3:[2925151,10082505,15070713],BuGn4:[2329413,6734500,11723490,15595771],BuGn5:[27948,2925151,6734500,11723490,15595771],BuGn6:[27948,2925151,6734500,10082505,13429990,15595771],BuGn7:[22564,2329413,4304502,6734500,10082505,13429990,15595771],BuGn8:[22564,2329413,4304502,6734500,10082505,13429990,15070713,16252157],BuGn9:[17435,27948,2329413,4304502,6734500,10082505,13429990,15070713,16252157],PuBuGn3:[1872025,10927579,15524592],PuBuGn4:[164234,6793679,12437985,16183287],PuBuGn5:[93273,1872025,6793679,12437985,16183287],PuBuGn6:[93273,1872025,6793679,10927579,13685222,16183287],PuBuGn7:[91216,164234,3576e3,6793679,10927579,13685222,16183287],PuBuGn8:[91216,164234,3576e3,6793679,10927579,13685222,15524592,16775163],PuBuGn9:[83510,93273,164234,3576e3,6793679,10927579,13685222,15524592,16775163],PuBu3:[2854078,10927579,15525874],PuBu4:[356528,7645647,12437985,15855350],PuBu5:[285325,2854078,7645647,12437985,15855350],PuBu6:[285325,2854078,7645647,10927579,13685222,15855350],PuBu7:[216699,356528,3576e3,7645647,10927579,13685222,15855350],PuBu8:[216699,356528,3576e3,7645647,10927579,13685222,15525874,16775163],PuBu9:[145496,285325,356528,3576e3,7645647,10927579,13685222,15525874,16775163],BuPu3:[8935079,10403034,14740724],BuPu4:[8929693,9213638,11783651,15595771],BuPu5:[8458108,8935079,9213638,11783651,15595771],BuPu6:[8458108,8935079,9213638,10403034,12571622,15595771],BuPu7:[7209323,8929693,9202609,9213638,10403034,12571622,15595771],BuPu8:[7209323,8929693,9202609,9213638,10403034,12571622,14740724,16252157],BuPu9:[5046347,8458108,8929693,9202609,9213638,10403034,12571622,14740724,16252157],RdPu3:[12917642,16424885,16638173],RdPu4:[11403646,16214177,16495801,16706530],RdPu5:[7995767,12917642,16214177,16495801,16706530],RdPu6:[7995767,12917642,16214177,16424885,16565696,16706530],RdPu7:[7995767,11403646,14496919,16214177,16424885,16565696,16706530],RdPu8:[7995767,11403646,14496919,16214177,16424885,16565696,16638173,16775155],RdPu9:[4784234,7995767,11403646,14496919,16214177,16424885,16565696,16638173,16775155],PuRd3:[14490743,13210823,15196655],PuRd4:[13505110,14640560,14136792,15855350],PuRd5:[9961539,14490743,14640560,14136792,15855350],PuRd6:[9961539,14490743,14640560,13210823,13941210,15855350],PuRd7:[9502783,13505110,15149450,14640560,13210823,13941210,15855350],PuRd8:[9502783,13505110,15149450,14640560,13210823,13941210,15196655,16250105],PuRd9:[6750239,9961539,13505110,15149450,14640560,13210823,13941210,15196655,16250105],OrRd3:[14895667,16628612,16705736],OrRd4:[14102559,16551257,16632970,16707801],OrRd5:[11730944,14895667,16551257,16632970,16707801],OrRd6:[11730944,14895667,16551257,16628612,16635038,16707801],OrRd7:[10027008,14102559,15689032,16551257,16628612,16635038,16707801],OrRd8:[10027008,14102559,15689032,16551257,16628612,16635038,16705736,16775148],OrRd9:[8323072,11730944,14102559,15689032,16551257,16628612,16635038,16705736,16775148],YlOrRd3:[15743776,16691788,16772512],YlOrRd4:[14883356,16616764,16698460,16777138],YlOrRd5:[12386342,15743776,16616764,16698460,16777138],YlOrRd6:[12386342,15743776,16616764,16691788,16701814,16777138],YlOrRd7:[11599910,14883356,16535082,16616764,16691788,16701814,16777138],YlOrRd8:[11599910,14883356,16535082,16616764,16691788,16701814,16772512,16777164],YlOrRd9:[8388646,12386342,14883356,16535082,16616764,16691788,16701814,16772512,16777164],YlOrBr3:[14245646,16696399,16775100],YlOrBr4:[13388802,16685353,16701838,16777172],YlOrBr5:[10040324,14245646,16685353,16701838,16777172],YlOrBr6:[10040324,14245646,16685353,16696399,16704401,16777172],YlOrBr7:[9186564,13388802,15495188,16685353,16696399,16704401,16777172],YlOrBr8:[9186564,13388802,15495188,16685353,16696399,16704401,16775100,16777189],YlOrBr9:[6694150,10040324,13388802,15495188,16685353,16696399,16704401,16775100,16777189],Purples3:[7695281,12369372,15724021],Purples4:[6967715,10394312,13355490,15921399],Purples5:[5515151,7695281,10394312,13355490,15921399],Purples6:[5515151,7695281,10394312,12369372,14342891,15921399],Purples7:[4854918,6967715,8420794,10394312,12369372,14342891,15921399],Purples8:[4854918,6967715,8420794,10394312,12369372,14342891,15724021,16579581],Purples9:[4128893,5515151,6967715,8420794,10394312,12369372,14342891,15724021,16579581],Blues3:[3244733,10406625,14609399],Blues4:[2191797,7057110,12441575,15725567],Blues5:[545180,3244733,7057110,12441575,15725567],Blues6:[545180,3244733,7057110,10406625,13032431,15725567],Blues7:[542100,2191797,4362950,7057110,10406625,13032431,15725567],Blues8:[542100,2191797,4362950,7057110,10406625,13032431,14609399,16251903],Blues9:[536683,545180,2191797,4362950,7057110,10406625,13032431,14609399,16251903],Greens3:[3253076,10607003,15070688],Greens4:[2329413,7652470,12248243,15595753],Greens5:[27948,3253076,7652470,12248243,15595753],Greens6:[27948,3253076,7652470,10607003,13101504,15595753],Greens7:[23090,2329413,4303709,7652470,10607003,13101504,15595753],Greens8:[23090,2329413,4303709,7652470,10607003,13101504,15070688,16252149],Greens9:[17435,27948,2329413,4303709,7652470,10607003,13101504,15070688,16252149],Oranges3:[15095053,16625259,16705230],Oranges4:[14239489,16616764,16629381,16707038],Oranges5:[10892803,15095053,16616764,16629381,16707038],Oranges6:[10892803,15095053,16616764,16625259,16634018,16707038],Oranges7:[9186564,14239745,15821075,16616764,16625259,16634018,16707038],Oranges8:[9186564,14239745,15821075,16616764,16625259,16634018,16705230,16774635],Oranges9:[8333060,10892803,14239745,15821075,16616764,16625259,16634018,16705230,16774635],Reds3:[14560550,16552562,16703698],Reds4:[13309981,16476746,16559761,16704985],Reds5:[10817301,14560550,16476746,16559761,16704985],Reds6:[10817301,14560550,16476746,16552562,16563105,16704985],Reds7:[10027021,13309981,15678252,16476746,16552562,16563105,16704985],Reds8:[10027021,13309981,15678252,16476746,16552562,16563105,16703698,16774640],Reds9:[6750221,10817301,13309981,15678252,16476746,16552562,16563105,16703698,16774640],Greys3:[6513507,12434877,15790320],Greys4:[5395026,9868950,13421772,16250871],Greys5:[2434341,6513507,9868950,13421772,16250871],Greys6:[2434341,6513507,9868950,12434877,14277081,16250871],Greys7:[2434341,5395026,7566195,9868950,12434877,14277081,16250871],Greys8:[2434341,5395026,7566195,9868950,12434877,14277081,15790320,16777215],Greys9:[0,2434341,5395026,7566195,9868950,12434877,14277081,15790320,16777215],PuOr3:[10063555,16250871,15835968],PuOr4:[6175897,11709394,16627811,15098113],PuOr5:[6175897,11709394,16250871,16627811,15098113],PuOr6:[5515144,10063555,14211819,16703670,15835968,11753478],PuOr7:[5515144,10063555,14211819,16250871,16703670,15835968,11753478],PuOr8:[5515144,8418220,11709394,14211819,16703670,16627811,14713364,11753478],PuOr9:[5515144,8418220,11709394,14211819,16250871,16703670,16627811,14713364,11753478],PuOr10:[2949195,5515144,8418220,11709394,14211819,16703670,16627811,14713364,11753478,8338184],PuOr11:[2949195,5515144,8418220,11709394,14211819,16250871,16703670,16627811,14713364,11753478,8338184],BrBG3:[5944492,16119285,14201701],BrBG4:[99697,8441281,14664317,10903834],BrBG5:[99697,8441281,16119285,14664317,10903834],BrBG6:[91742,5944492,13101797,16181443,14201701,9195786],BrBG7:[91742,5944492,13101797,16119285,16181443,14201701,9195786],BrBG8:[91742,3512207,8441281,13101797,16181443,14664317,12550445,9195786],BrBG9:[91742,3512207,8441281,13101797,16119285,16181443,14664317,12550445,9195786],BrBG10:[15408,91742,3512207,8441281,13101797,16181443,14664317,12550445,9195786,5517317],BrBG11:[15408,91742,3512207,8441281,13101797,16119285,16181443,14664317,12550445,9195786,5517317],PRGn3:[8372091,16250871,11505091],PRGn4:[34871,10935200,12756431,8073876],PRGn5:[34871,10935200,16250871,12756431,8073876],PRGn6:[1800247,8372091,14282963,15193320,11505091,7744131],PRGn7:[1800247,8372091,14282963,16250871,15193320,11505091,7744131],PRGn8:[1800247,5942881,10935200,14282963,15193320,12756431,10055851,7744131],PRGn9:[1800247,5942881,10935200,14282963,16250871,15193320,12756431,10055851,7744131],PRGn10:[17435,1800247,5942881,10935200,14282963,15193320,12756431,10055851,7744131,4194379],PRGn11:[17435,1800247,5942881,10935200,14282963,16250871,15193320,12756431,10055851,7744131,4194379],PiYG3:[10606442,16250871,15311817],PiYG4:[5090342,12116358,15840986,13638795],PiYG5:[5090342,12116358,16250871,15840986,13638795],PiYG6:[5083681,10606442,15136208,16638191,15311817,12917629],PiYG7:[5083681,10606442,15136208,16250871,16638191,15311817,12917629],PiYG8:[5083681,8371265,12116358,15136208,16638191,15840986,14579630,12917629],PiYG9:[5083681,8371265,12116358,15136208,16250871,16638191,15840986,14579630,12917629],PiYG10:[2581529,5083681,8371265,12116358,15136208,16638191,15840986,14579630,12917629,9306450],PiYG11:[2581529,5083681,8371265,12116358,15136208,16250871,16638191,15840986,14579630,12917629,9306450],RdBu3:[6793679,16250871,15698530],RdBu4:[356784,9618910,16033154,13238304],RdBu5:[356784,9618910,16250871,16033154,13238304],RdBu6:[2188972,6793679,13755888,16636871,15698530,11671595],RdBu7:[2188972,6793679,13755888,16250871,16636871,15698530,11671595],RdBu8:[2188972,4428739,9618910,13755888,16636871,16033154,14049357,11671595],RdBu9:[2188972,4428739,9618910,13755888,16250871,16636871,16033154,14049357,11671595],RdBu10:[340065,2188972,4428739,9618910,13755888,16636871,16033154,14049357,11671595,6750239],RdBu11:[340065,2188972,4428739,9618910,13755888,16250871,16636871,16033154,14049357,11671595,6750239],RdGy3:[10066329,16777215,15698530],RdGy4:[4210752,12237498,16033154,13238304],RdGy5:[4210752,12237498,16777215,16033154,13238304],RdGy6:[5066061,10066329,14737632,16636871,15698530,11671595],RdGy7:[5066061,10066329,14737632,16777215,16636871,15698530,11671595],RdGy8:[5066061,8882055,12237498,14737632,16636871,16033154,14049357,11671595],RdGy9:[5066061,8882055,12237498,14737632,16777215,16636871,16033154,14049357,11671595],RdGy10:[1710618,5066061,8882055,12237498,14737632,16636871,16033154,14049357,11671595,6750239],RdGy11:[1710618,5066061,8882055,12237498,14737632,16777215,16636871,16033154,14049357,11671595,6750239],RdYlBu3:[9551835,16777151,16551257],RdYlBu4:[2915254,11262441,16625249,14096668],RdYlBu5:[2915254,11262441,16777151,16625249,14096668],RdYlBu6:[4552116,9551835,14742520,16703632,16551257,14102567],RdYlBu7:[4552116,9551835,14742520,16777151,16703632,16551257,14102567],RdYlBu8:[4552116,7646673,11262441,14742520,16703632,16625249,16018755,14102567],RdYlBu9:[4552116,7646673,11262441,14742520,16777151,16703632,16625249,16018755,14102567],RdYlBu10:[3225237,4552116,7646673,11262441,14742520,16703632,16625249,16018755,14102567,10813478],RdYlBu11:[3225237,4552116,7646673,11262441,14742520,16777151,16703632,16625249,16018755,14102567,10813478],Spectral3:[10081684,16777151,16551257],Spectral4:[2851770,11263396,16625249,14096668],Spectral5:[2851770,11263396,16777151,16625249,14096668],Spectral6:[3311805,10081684,15136152,16703627,16551257,13975119],Spectral7:[3311805,10081684,15136152,16777151,16703627,16551257,13975119],Spectral8:[3311805,6734501,11263396,15136152,16703627,16625249,16018755,13975119],Spectral9:[3311805,6734501,11263396,15136152,16777151,16703627,16625249,16018755,13975119],Spectral10:[6180770,3311805,6734501,11263396,15136152,16703627,16625249,16018755,13975119,10355010],Spectral11:[6180770,3311805,6734501,11263396,15136152,16777151,16703627,16625249,16018755,13975119,10355010],RdYlGn3:[9555808,16777151,16551257],RdYlGn4:[1742401,10934634,16625249,14096668],RdYlGn5:[1742401,10934634,16777151,16625249,14096668],RdYlGn6:[1742928,9555808,14282635,16703627,16551257,14102567],RdYlGn7:[1742928,9555808,14282635,16777151,16703627,16551257,14102567],RdYlGn8:[1742928,6733155,10934634,14282635,16703627,16625249,16018755,14102567],RdYlGn9:[1742928,6733155,10934634,14282635,16777151,16703627,16625249,16018755,14102567],RdYlGn10:[26679,1742928,6733155,10934634,14282635,16703627,16625249,16018755,14102567,10813478],RdYlGn11:[26679,1742928,6733155,10934634,14282635,16777151,16703627,16625249,16018755,14102567,10813478]}},{}],"util/bezier":[function(t,e,n){var r,o;o=function(t,e,n,r,o,i,s,a){var l,u,h,c,p,_,d,f,m,g,y,v;return l=a*o,u=-s*i,h=s*o,c=a*i,_=.5*(r-n),p=8/3*Math.sin(.5*_)*Math.sin(.5*_)/Math.sin(_),d=t+Math.cos(n)-p*Math.sin(n),g=e+Math.sin(n)+p*Math.cos(n),m=t+Math.cos(r),v=e+Math.sin(r),f=m+p*Math.sin(r),y=v-p*Math.cos(r),[l*d+u*g,h*d+c*g,l*f+u*y,h*f+c*y,l*m+u*v,h*m+c*v]},r=function(t,e,n,r,i,s,a,l,u){var h,c,p,_,d,f,m,g,y,v,b,x,w,k,M,j,T,z,E,P,S,C,A,O,N,q,F,D,I;return z=i*(Math.PI/180),T=Math.sin(z),d=Math.cos(z),x=Math.abs(n),w=Math.abs(r),y=d*(t-l)*.5+T*(e-u)*.5,v=d*(e-u)*.5-T*(t-l)*.5,g=y*y/(x*x)+v*v/(w*w),g>1&&(g=Math.sqrt(g),x*=g,w*=g),h=d/x,c=T/x,p=-T/w,_=d/w,O=h*t+c*e,F=p*t+_*e,N=h*l+c*u,D=p*l+_*u,f=(N-O)*(N-O)+(D-F)*(D-F),j=1/f-.25,0>j&&(j=0),M=Math.sqrt(j),a===s&&(M=-M),q=.5*(O+N)-M*(D-F),I=.5*(F+D)+M*(N-O),E=Math.atan2(F-I,O-q),P=Math.atan2(D-I,N-q),A=P-E,0>A&&1===a?A+=2*Math.PI:A>0&&0===a&&(A-=2*Math.PI),k=Math.ceil(Math.abs(A/(.5*Math.PI+.001))),b=function(){var t,e,n;for(n=[],m=t=0,e=k;e>=0?e>t:t>e;m=e>=0?++t:--t)S=E+m*A/k,C=E+(m+1)*A/k,n.push(o(q,I,S,C,x,w,T,d));return n}()},e.exports={arc_to_bezier:r,segment_to_bezier:o}},{}],"util/util":[function(t,e,n){var r,o,i,s,a,l;i=t("underscore"),o=t("sprintf"),r=t("numeral"),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},l=function(t,e,n,o){return null==o&&(o={}),t=t.replace(/(^|[^\$])\$(\w+)/g,function(t){return function(t,e,n){return e+"@$"+n}}(this)),t=t.replace(/(^|[^@])@(?:(\$?\w+)|{([^{}]+)})(?:{([^{}]+)})?/g,function(t){return function(t,a,l,u,h){var c,p,_;return l=null!=u?u:l,_="$"===l[0]?o[l.substring(1)]:null!=(c=e.get_column(l))?c[n]:void 0,p=null==_?"???":null!=h?r.format(_,h):s(_),""+a+i.escape(p)}}(this))},a=function(t){var e;return e=t.get("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={replace_placeholders:l,get_indices:a}},{numeral:"numeral",sprintf:"sprintf",underscore:"underscore"}],backbone:[function(e,n,r){(function(n){
|
|
// (c) 2010-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
|
|
// Backbone may be freely distributed under the MIT license.
|
|
!function(o){var i="object"==typeof self&&self.self==self&&self||"object"==typeof n&&n.global==n&&n;if("function"==typeof t&&t.amd)t(["underscore","jquery","exports"],function(t,e,n){i.Backbone=o(i,n,t,e)});else if("undefined"!=typeof r){var s,a=e("underscore");try{s=e("jquery")}catch(l){}o(i,r,a,s)}else i.Backbone=o(i,{},i._,i.jQuery||i.Zepto||i.ender||i.$)}(function(t,e,n,r){var o=t.Backbone,i=Array.prototype.slice;e.VERSION="1.2.3",e.$=r,e.noConflict=function(){return t.Backbone=o,this},e.emulateHTTP=!1,e.emulateJSON=!1;var s=function(t,e,r){switch(t){case 1:return function(){return n[e](this[r])};case 2:return function(t){return n[e](this[r],t)};case 3:return function(t,o){return n[e](this[r],l(t,this),o)};case 4:return function(t,o,i){return n[e](this[r],l(t,this),o,i)};default:return function(){var t=i.call(arguments);return t.unshift(this[r]),n[e].apply(n,t)}}},a=function(t,e,r){n.each(e,function(e,o){n[o]&&(t.prototype[o]=s(e,o,r))})},l=function(t,e){return n.isFunction(t)?t:n.isObject(t)&&!e._isModel(t)?u(t):n.isString(t)?function(e){return e.get(t)}:t},u=function(t){var e=n.matches(t);return function(t){return e(t.attributes)}},h=e.Events={},c=/\s+/,p=function(t,e,r,o,i){var s,a=0;if(r&&"object"==typeof r){void 0!==o&&"context"in i&&void 0===i.context&&(i.context=o);for(s=n.keys(r);a<s.length;a++)e=p(t,e,s[a],r[s[a]],i)}else if(r&&c.test(r))for(s=r.split(c);a<s.length;a++)e=t(e,s[a],o,i);else e=t(e,r,o,i);return e};h.on=function(t,e,n){return _(this,t,e,n)};var _=function(t,e,n,r,o){if(t._events=p(d,t._events||{},e,n,{context:r,ctx:t,listening:o}),o){var i=t._listeners||(t._listeners={});i[o.id]=o}return t};h.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 a=this._listenId||(this._listenId=n.uniqueId("l"));s=i[o]={obj:t,objId:o,id:a,listeningTo:i,count:0}}return _(t,e,r,this,s),this};var d=function(t,e,n,r){if(n){var o=t[e]||(t[e]=[]),i=r.context,s=r.ctx,a=r.listening;a&&a.count++,o.push({callback:n,context:i,ctx:i||s,listening:a})}return t};h.off=function(t,e,n){return this._events?(this._events=p(f,this._events,t,e,{context:n,listeners:this._listeners}),this):this},h.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 n.isEmpty(o)&&(this._listeningTo=void 0),this};var f=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 h=t[e];if(!h)break;for(var c=[],p=0;p<h.length;p++){var _=h[p];r&&r!==_.callback&&r!==_.callback._callback||a&&a!==_.context?c.push(_):(i=_.listening,i&&0===--i.count&&(delete l[i.id],delete i.listeningTo[i.objId]))}c.length?t[e]=c:delete t[e]}return n.size(t)?t:void 0}for(var d=n.keys(l);s<d.length;s++)i=l[d[s]],delete l[i.id],delete i.listeningTo[i.objId]}};h.once=function(t,e,r){var o=p(m,{},t,e,n.bind(this.off,this));return this.on(o,void 0,r)},h.listenToOnce=function(t,e,r){var o=p(m,{},e,r,n.bind(this.stopListening,this,t));return this.listenTo(t,o)};var m=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};h.trigger=function(t){if(!this._events)return this;for(var e=Math.max(0,arguments.length-1),n=Array(e),r=0;e>r;r++)n[r]=arguments[r+1];return p(g,this._events,t,void 0,n),this};var g=function(t,e,n,r){if(t){var o=t[e],i=t.all;o&&i&&(i=i.slice()),o&&y(o,r),i&&y(i,[e].concat(r))}return t},y=function(t,e){var n,r=-1,o=t.length,i=e[0],s=e[1],a=e[2];switch(e.length){case 0:for(;++r<o;)(n=t[r]).callback.call(n.ctx);return;case 1:for(;++r<o;)(n=t[r]).callback.call(n.ctx,i);return;case 2:for(;++r<o;)(n=t[r]).callback.call(n.ctx,i,s);return;case 3:for(;++r<o;)(n=t[r]).callback.call(n.ctx,i,s,a);return;default:for(;++r<o;)(n=t[r]).callback.apply(n.ctx,e);return}};h.bind=h.on,h.unbind=h.off,n.extend(e,h);var v=e.Model=function(t,e){var r=t||{};e||(e={}),this.cid=n.uniqueId(this.cidPrefix),this.attributes={},e.collection&&(this.collection=e.collection),e.parse&&(r=this.parse(r,e)||{}),r=n.defaults({},r,n.result(this,"defaults")),this.set(r,e),this.changed={},this.initialize.apply(this,arguments)};n.extend(v.prototype,h,{changed:null,validationError:null,idAttribute:"id",cidPrefix:"c",initialize:function(){},toJSON:function(t){return n.clone(this.attributes)},sync:function(){return e.sync.apply(this,arguments)},get:function(t){return this.attributes[t]},escape:function(t){return n.escape(this.get(t))},has:function(t){return null!=this.get(t)},matches:function(t){return!!n.iteratee(t,this)(this.attributes)},set:function(t,e,r){if(null==t)return this;var o;if("object"==typeof t?(o=t,r=e):(o={})[t]=e,r||(r={}),!this._validate(o,r))return!1;var i=r.unset,s=r.silent,a=[],l=this._changing;this._changing=!0,l||(this._previousAttributes=n.clone(this.attributes),this.changed={});var u=this.attributes,h=this.changed,c=this._previousAttributes;for(var p in o)e=o[p],n.isEqual(u[p],e)||a.push(p),n.isEqual(c[p],e)?delete h[p]:h[p]=e,i?delete u[p]:u[p]=e;if(this.id=this.get(this.idAttribute),!s){a.length&&(this._pending=r);for(var _=0;_<a.length;_++)this.trigger("change:"+a[_],this,u[a[_]],r)}if(l)return this;if(!s)for(;this._pending;)r=this._pending,this._pending=!1,this.trigger("change",this,r);return this._pending=!1,this._changing=!1,this},unset:function(t,e){return this.set(t,void 0,n.extend({},e,{unset:!0}))},clear:function(t){var e={};for(var r in this.attributes)e[r]=void 0;return this.set(e,n.extend({},t,{unset:!0}))},hasChanged:function(t){return null==t?!n.isEmpty(this.changed):n.has(this.changed,t)},changedAttributes:function(t){if(!t)return this.hasChanged()?n.clone(this.changed):!1;var e=this._changing?this._previousAttributes:this.attributes,r={};for(var o in t){var i=t[o];n.isEqual(e[o],i)||(r[o]=i)}return n.size(r)?r:!1},previous:function(t){return null!=t&&this._previousAttributes?this._previousAttributes[t]:null},previousAttributes:function(){return n.clone(this._previousAttributes)},fetch:function(t){t=n.extend({parse:!0},t);var e=this,r=t.success;return t.success=function(n){var o=t.parse?e.parse(n,t):n;return e.set(o,t)?(r&&r.call(t.context,e,n,t),void e.trigger("sync",e,n,t)):!1},L(this,t),this.sync("read",this,t)},save:function(t,e,r){var o;null==t||"object"==typeof t?(o=t,r=e):(o={})[t]=e,r=n.extend({validate:!0,parse:!0},r);var i=r.wait;if(o&&!i){if(!this.set(o,r))return!1}else if(!this._validate(o,r))return!1;var s=this,a=r.success,l=this.attributes;r.success=function(t){s.attributes=l;var e=r.parse?s.parse(t,r):t;return i&&(e=n.extend({},o,e)),e&&!s.set(e,r)?!1:(a&&a.call(r.context,s,t,r),void s.trigger("sync",s,t,r))},L(this,r),o&&i&&(this.attributes=n.extend({},l,o));var u=this.isNew()?"create":r.patch?"patch":"update";"patch"!==u||r.attrs||(r.attrs=o);var h=this.sync(u,this,r);return this.attributes=l,h},destroy:function(t){t=t?n.clone(t):{};var e=this,r=t.success,o=t.wait,i=function(){e.stopListening(),e.trigger("destroy",e,e.collection,t)};t.success=function(n){o&&i(),r&&r.call(t.context,e,n,t),e.isNew()||e.trigger("sync",e,n,t)};var s=!1;return this.isNew()?n.defer(t.success):(L(this,t),s=this.sync("delete",this,t)),o||i(),s},url:function(){var t=n.result(this,"urlRoot")||n.result(this.collection,"url")||B();if(this.isNew())return t;var e=this.get(this.idAttribute);return t.replace(/[^\/]$/,"$&/")+encodeURIComponent(e)},parse:function(t,e){return t},clone:function(){return new this.constructor(this.attributes)},isNew:function(){return!this.has(this.idAttribute)},isValid:function(t){return this._validate({},n.defaults({validate:!0},t))},_validate:function(t,e){if(!e.validate||!this.validate)return!0;t=n.extend({},this.attributes,t);var r=this.validationError=this.validate(t,e)||null;return r?(this.trigger("invalid",this,r,n.extend(e,{validationError:r})),!1):!0}});var b={keys:1,values:1,pairs:1,invert:1,pick:0,omit:0,chain:1,isEmpty:1};a(v,b,"attributes");var x=e.Collection=function(t,e){e||(e={}),e.model&&(this.model=e.model),void 0!==e.comparator&&(this.comparator=e.comparator),this._reset(),this.initialize.apply(this,arguments),t&&this.reset(t,n.extend({silent:!0},e))},w={add:!0,remove:!0,merge:!0},k={add:!0,remove:!1},M=function(t,e,n){n=Math.min(Math.max(n,0),t.length);for(var r=Array(t.length-n),o=e.length,i=0;i<r.length;i++)r[i]=t[i+n];for(i=0;o>i;i++)t[i+n]=e[i];for(i=0;i<r.length;i++)t[i+o+n]=r[i]};n.extend(x.prototype,h,{model:v,initialize:function(){},toJSON:function(t){return this.map(function(e){return e.toJSON(t)})},sync:function(){return e.sync.apply(this,arguments)},add:function(t,e){return this.set(t,n.extend({merge:!1},e,k))},remove:function(t,e){e=n.extend({},e);var r=!n.isArray(t);t=r?[t]:n.clone(t);var o=this._removeModels(t,e);return!e.silent&&o&&this.trigger("update",this,e),r?o[0]:o},set:function(t,e){if(null!=t){e=n.defaults({},e,w),e.parse&&!this._isModel(t)&&(t=this.parse(t,e));var r=!n.isArray(t);t=r?[t]:t.slice();var o=e.at;null!=o&&(o=+o),0>o&&(o+=this.length+1);for(var i,s=[],a=[],l=[],u={},h=e.add,c=e.merge,p=e.remove,_=!1,d=this.comparator&&null==o&&e.sort!==!1,f=n.isString(this.comparator)?this.comparator:null,m=0;m<t.length;m++){i=t[m];var g=this.get(i);if(g){if(c&&i!==g){var y=this._isModel(i)?i.attributes:i;e.parse&&(y=g.parse(y,e)),g.set(y,e),d&&!_&&(_=g.hasChanged(f))}u[g.cid]||(u[g.cid]=!0,s.push(g)),t[m]=g}else h&&(i=t[m]=this._prepareModel(i,e),i&&(a.push(i),this._addReference(i,e),u[i.cid]=!0,s.push(i)))}if(p){for(m=0;m<this.length;m++)i=this.models[m],u[i.cid]||l.push(i);l.length&&this._removeModels(l,e)}var v=!1,b=!d&&h&&p;if(s.length&&b?(v=this.length!=s.length||n.some(this.models,function(t,e){return t!==s[e]}),this.models.length=0,M(this.models,s,0),this.length=this.models.length):a.length&&(d&&(_=!0),M(this.models,a,null==o?this.length:o),this.length=this.models.length),_&&this.sort({silent:!0}),!e.silent){for(m=0;m<a.length;m++)null!=o&&(e.index=o+m),i=a[m],i.trigger("add",i,this,e);(_||v)&&this.trigger("sort",this,e),(a.length||l.length)&&this.trigger("update",this,e)}return r?t[0]:t}},reset:function(t,e){e=e?n.clone(e):{};for(var r=0;r<this.models.length;r++)this._removeReference(this.models[r],e);return e.previousModels=this.models,this._reset(),t=this.add(t,n.extend({silent:!0},e)),e.silent||this.trigger("reset",this,e),t},push:function(t,e){return this.add(t,n.extend({at:this.length},e))},pop:function(t){var e=this.at(this.length-1);return this.remove(e,t)},unshift:function(t,e){return this.add(t,n.extend({at:0},e))},shift:function(t){var e=this.at(0);return this.remove(e,t)},slice:function(){return i.apply(this.models,arguments)},get:function(t){if(null!=t){var e=this.modelId(this._isModel(t)?t.attributes:t);return this._byId[t]||this._byId[e]||this._byId[t.cid]}},at:function(t){return 0>t&&(t+=this.length),this.models[t]},where:function(t,e){return this[e?"find":"filter"](t)},findWhere:function(t){return this.where(t,!0)},sort:function(t){var e=this.comparator;if(!e)throw new Error("Cannot sort a set without a comparator");t||(t={});var r=e.length;return n.isFunction(e)&&(e=n.bind(e,this)),1===r||n.isString(e)?this.models=this.sortBy(e):this.models.sort(e),t.silent||this.trigger("sort",this,t),this},pluck:function(t){return n.invoke(this.models,"get",t)},fetch:function(t){t=n.extend({parse:!0},t);var e=t.success,r=this;return t.success=function(n){var o=t.reset?"reset":"set";r[o](n,t),e&&e.call(t.context,r,n,t),r.trigger("sync",r,n,t)},L(this,t),this.sync("read",this,t)},create:function(t,e){e=e?n.clone(e):{};var r=e.wait;if(t=this._prepareModel(t,e),!t)return!1;r||this.add(t,e);var o=this,i=e.success;return e.success=function(t,e,n){r&&o.add(t,n),i&&i.call(n.context,t,e,n)},t.save(null,e),t},parse:function(t,e){return t},clone:function(){return new this.constructor(this.models,{model:this.model,comparator:this.comparator})},modelId:function(t){return t[this.model.prototype.idAttribute||"id"]},_reset:function(){this.length=0,this.models=[],this._byId={}},_prepareModel:function(t,e){if(this._isModel(t))return t.collection||(t.collection=this),t;e=e?n.clone(e):{},e.collection=this;var r=new this.model(t,e);return r.validationError?(this.trigger("invalid",this,r.validationError,e),!1):r},_removeModels:function(t,e){for(var n=[],r=0;r<t.length;r++){var o=this.get(t[r]);if(o){var i=this.indexOf(o);this.models.splice(i,1),this.length--,e.silent||(e.index=i,o.trigger("remove",o,this,e)),n.push(o),this._removeReference(o,e)}}return n.length?n:!1},_isModel:function(t){return t instanceof v},_addReference:function(t,e){this._byId[t.cid]=t;var n=this.modelId(t.attributes);null!=n&&(this._byId[n]=t),t.on("all",this._onModelEvent,this)},_removeReference:function(t,e){delete this._byId[t.cid];var n=this.modelId(t.attributes);null!=n&&delete this._byId[n],this===t.collection&&delete t.collection,t.off("all",this._onModelEvent,this)},_onModelEvent:function(t,e,n,r){if("add"!==t&&"remove"!==t||n===this){if("destroy"===t&&this.remove(e,r),"change"===t){var o=this.modelId(e.previousAttributes()),i=this.modelId(e.attributes);o!==i&&(null!=o&&delete this._byId[o],null!=i&&(this._byId[i]=e))}this.trigger.apply(this,arguments)}}});var j={forEach:3,each:3,map:3,collect:3,reduce:4,foldl:4,inject:4,reduceRight:4,foldr:4,find:3,detect:3,filter:3,select:3,reject:3,every:3,all:3,some:3,any:3,include:3,includes:3,contains:3,invoke:0,max:3,min:3,toArray:1,size:1,first:3,head:3,take:3,initial:3,rest:3,tail:3,drop:3,last:3,without:0,difference:0,indexOf:3,shuffle:1,lastIndexOf:3,isEmpty:1,chain:1,sample:3,partition:3,groupBy:3,countBy:3,sortBy:3,indexBy:3};a(x,j,"models");var T=e.View=function(t){this.cid=n.uniqueId("view"),n.extend(this,n.pick(t,E)),this._ensureElement(),this.initialize.apply(this,arguments)},z=/^(\S+)\s*(.*)$/,E=["model","collection","el","id","attributes","className","tagName","events"];n.extend(T.prototype,h,{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 e.$?t:e.$(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(z);this.delegate(o[1],o[2],n.bind(r,this))}}return this},delegate:function(t,e,n){return this.$el.on(t+".delegateEvents"+this.cid,e,n),this},undelegateEvents:function(){return this.$el&&this.$el.off(".delegateEvents"+this.cid),this},undelegate:function(t,e,n){return this.$el.off(t+".delegateEvents"+this.cid,e,n),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)}}),e.sync=function(t,r,o){var i=P[t];n.defaults(o||(o={}),{emulateHTTP:e.emulateHTTP,emulateJSON:e.emulateJSON});var s={type:i,dataType:"json"};if(o.url||(s.url=n.result(r,"url")||B()),null!=o.data||!r||"create"!==t&&"update"!==t&&"patch"!==t||(s.contentType="application/json",s.data=JSON.stringify(o.attrs||r.toJSON(o))),o.emulateJSON&&(s.contentType="application/x-www-form-urlencoded",s.data=s.data?{model:s.data}:{}),o.emulateHTTP&&("PUT"===i||"DELETE"===i||"PATCH"===i)){s.type="POST",o.emulateJSON&&(s.data._method=i);var a=o.beforeSend;o.beforeSend=function(t){return t.setRequestHeader("X-HTTP-Method-Override",i),a?a.apply(this,arguments):void 0}}"GET"===s.type||o.emulateJSON||(s.processData=!1);var l=o.error;o.error=function(t,e,n){o.textStatus=e,o.errorThrown=n,l&&l.call(o.context,t,e,n)};var u=o.xhr=e.ajax(n.extend(s,o));return r.trigger("request",r,u,o),u};var P={create:"POST",update:"PUT",patch:"PATCH","delete":"DELETE",read:"GET"};e.ajax=function(){return e.$.ajax.apply(e.$,arguments)};var S=e.Router=function(t){t||(t={}),t.routes&&(this.routes=t.routes),this._bindRoutes(),this.initialize.apply(this,arguments)},C=/\((.*?)\)/g,A=/(\(\?)?:\w+/g,O=/\*\w+/g,N=/[\-{}\[\]+?.,\\\^$|#\s]/g;n.extend(S.prototype,h,{initialize:function(){},route:function(t,r,o){n.isRegExp(t)||(t=this._routeToRegExp(t)),n.isFunction(r)&&(o=r,r=""),o||(o=this[r]);var i=this;return e.history.route(t,function(n){var s=i._extractParameters(t,n);i.execute(o,s,r)!==!1&&(i.trigger.apply(i,["route:"+r].concat(s)),i.trigger("route",r,s),e.history.trigger("route",i,r,s))}),this},execute:function(t,e,n){t&&t.apply(this,e)},navigate:function(t,n){return e.history.navigate(t,n),this},_bindRoutes:function(){if(this.routes){this.routes=n.result(this,"routes");for(var t,e=n.keys(this.routes);null!=(t=e.pop());)this.route(t,this.routes[t])}},_routeToRegExp:function(t){return t=t.replace(N,"\\$&").replace(C,"(?:$1)?").replace(A,function(t,e){return e?t:"([^/?]+)"}).replace(O,"([^?]*?)"),new RegExp("^"+t+"(?:\\?([\\s\\S]*))?$")},_extractParameters:function(t,e){var r=t.exec(e).slice(1);return n.map(r,function(t,e){return e===r.length-1?t||null:t?decodeURIComponent(t):null})}});var q=e.History=function(){this.handlers=[],this.checkUrl=n.bind(this.checkUrl,this),"undefined"!=typeof window&&(this.location=window.location,this.history=window.history)},F=/^[#\/]|\s+$/g,D=/^\/+|\/+$/g,I=/#.*$/;q.started=!1,n.extend(q.prototype,h,{interval:50,atRoot:function(){var t=this.location.pathname.replace(/[^\/]$/,"$&/");return t===this.root&&!this.getSearch()},matchRoot:function(){var t=this.decodeFragment(this.location.pathname),e=t.slice(0,this.root.length-1)+"/";return e===this.root},decodeFragment:function(t){return decodeURI(t.replace(/%25/g,"%2525"))},getSearch:function(){var t=this.location.href.replace(/#.*/,"").match(/\?.+/);return t?t[0]:""},getHash:function(t){var e=(t||this).location.href.match(/#(.*)$/);return e?e[1]:""},getPath:function(){var t=this.decodeFragment(this.location.pathname+this.getSearch()).slice(this.root.length-1);return"/"===t.charAt(0)?t.slice(1):t},getFragment:function(t){return null==t&&(t=this._usePushState||!this._wantsHashChange?this.getPath():this.getHash()),t.replace(F,"")},start:function(t){if(q.started)throw new Error("Backbone.history has already been started");if(q.started=!0,this.options=n.extend({root:"/"},this.options,t),this.root=this.options.root,this._wantsHashChange=this.options.hashChange!==!1,this._hasHashChange="onhashchange"in window&&(void 0===document.documentMode||document.documentMode>7),this._useHashChange=this._wantsHashChange&&this._hasHashChange,this._wantsPushState=!!this.options.pushState,this._hasPushState=!(!this.history||!this.history.pushState),this._usePushState=this._wantsPushState&&this._hasPushState,this.fragment=this.getFragment(),this.root=("/"+this.root+"/").replace(D,"/"),this._wantsHashChange&&this._wantsPushState){if(!this._hasPushState&&!this.atRoot()){var e=this.root.slice(0,-1)||"/";return this.location.replace(e+"#"+this.getPath()),!0}this._hasPushState&&this.atRoot()&&this.navigate(this.getHash(),{replace:!0})}if(!this._hasHashChange&&this._wantsHashChange&&!this._usePushState){this.iframe=document.createElement("iframe"),this.iframe.src="javascript:0",this.iframe.style.display="none",this.iframe.tabIndex=-1;var r=document.body,o=r.insertBefore(this.iframe,r.firstChild).contentWindow;o.document.open(),o.document.close(),o.location.hash="#"+this.fragment}var i=window.addEventListener||function(t,e){return attachEvent("on"+t,e)};return this._usePushState?i("popstate",this.checkUrl,!1):this._useHashChange&&!this.iframe?i("hashchange",this.checkUrl,!1):this._wantsHashChange&&(this._checkUrlInterval=setInterval(this.checkUrl,this.interval)),this.options.silent?void 0:this.loadUrl()},stop:function(){var t=window.removeEventListener||function(t,e){return detachEvent("on"+t,e)};this._usePushState?t("popstate",this.checkUrl,!1):this._useHashChange&&!this.iframe&&t("hashchange",this.checkUrl,!1),this.iframe&&(document.body.removeChild(this.iframe),this.iframe=null),this._checkUrlInterval&&clearInterval(this._checkUrlInterval),q.started=!1},route:function(t,e){this.handlers.unshift({route:t,callback:e})},checkUrl:function(t){var e=this.getFragment();return e===this.fragment&&this.iframe&&(e=this.getHash(this.iframe.contentWindow)),e===this.fragment?!1:(this.iframe&&this.navigate(e),void this.loadUrl())},loadUrl:function(t){return this.matchRoot()?(t=this.fragment=this.getFragment(t),n.some(this.handlers,function(e){return e.route.test(t)?(e.callback(t),!0):void 0})):!1},navigate:function(t,e){if(!q.started)return!1;e&&e!==!0||(e={trigger:!!e}),t=this.getFragment(t||"");var n=this.root;(""===t||"?"===t.charAt(0))&&(n=n.slice(0,-1)||"/");var r=n+t;if(t=this.decodeFragment(t.replace(I,"")),this.fragment!==t){if(this.fragment=t,this._usePushState)this.history[e.replace?"replaceState":"pushState"]({},document.title,r);else{if(!this._wantsHashChange)return this.location.assign(r);if(this._updateHash(this.location,t,e.replace),this.iframe&&t!==this.getHash(this.iframe.contentWindow)){var o=this.iframe.contentWindow;e.replace||(o.document.open(),o.document.close()),this._updateHash(o.location,t,e.replace)}}return e.trigger?this.loadUrl(t):void 0}},_updateHash:function(t,e,n){if(n){var r=t.href.replace(/(javascript:|#).*$/,"");t.replace(r+"#"+e)}else t.hash="#"+e}}),e.history=new q;var R=function(t,e){var r,o=this;r=t&&n.has(t,"constructor")?t.constructor:function(){return o.apply(this,arguments)},n.extend(r,o,e);var i=function(){this.constructor=r};return i.prototype=o.prototype,r.prototype=new i,t&&n.extend(r.prototype,t),r.__super__=o.prototype,r};v.extend=x.extend=S.extend=T.extend=q.extend=R;var B=function(){throw new Error('A "url" property or function must be specified')},L=function(t,e){var n=e.error;e.error=function(r){n&&n.call(e.context,t,r,e),t.trigger("error",t,r,e)}};return e})}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{jquery:"jquery",underscore:"underscore"}],_process:[function(t,e,n){function r(){h=!1,a.length?u=a.concat(u):c=-1,u.length&&o()}function o(){if(!h){var t=setTimeout(r);h=!0;for(var e=u.length;e;){for(a=u,u=[];++c<e;)a&&a[c].run();c=-1,e=u.length}a=null,h=!1,clearTimeout(t)}}function i(t,e){this.fun=t,this.array=e}function s(){}var a,l=e.exports={},u=[],h=!1,c=-1;l.nextTick=function(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)e[n-1]=arguments[n];u.push(new i(t,e)),1!==u.length||h||setTimeout(o,0)},i.prototype.run=function(){this.fun.apply(null,this.array)},l.title="browser",l.browser=!0,l.env={},l.argv=[],l.version="",l.versions={},l.on=s,l.addListener=s,l.once=s,l.off=s,l.removeListener=s,l.removeAllListeners=s,l.emit=s,l.binding=function(t){throw new Error("process.binding is not supported")},l.cwd=function(){return"/"},l.chdir=function(t){throw new Error("process.chdir is not supported")},l.umask=function(){return 0}},{}],"es6-promise":[function(e,n,r){(function(r,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 h(){return function(){r.nextTick(f)}}function c(){return function(){V(f)}}function p(){var t=0,e=new Z(f),n=document.createTextNode("");return e.observe(n,{characterData:!0}),function(){n.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;X>t;t+=2){var e=nt[t],n=nt[t+1];e(n),nt[t]=void 0,nt[t+1]=void 0}X=0}function m(){try{var t=e,n=t("vertx");return V=n.runOnLoop||n.runOnContext,c()}catch(r){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,n,r){try{t.call(e,n,r)}catch(o){return o}}function w(t,e,n){J(function(t){var r=!1,o=x(n,e,function(n){r||(r=!0,e!==n?j(t,n):z(t,n))},function(e){r||(r=!0,E(t,e))},"Settle: "+(t._label||" unknown promise"));!r&&o&&(r=!0,E(t,o))},t)}function k(t,e){e._state===ot?z(t,e._result):e._state===it?E(t,e._result):P(e,void 0,function(e){j(t,e)},function(e){E(t,e)})}function M(t,e){if(e.constructor===t.constructor)k(t,e);else{var n=b(e);n===st?E(t,st.error):void 0===n?z(t,e):s(n)?w(t,e,n):z(t,e)}}function j(t,e){t===e?E(t,y()):i(e)?M(t,e):z(t,e)}function T(t){t._onerror&&t._onerror(t._result),S(t)}function z(t,e){t._state===rt&&(t._result=e,t._state=ot,0!==t._subscribers.length&&J(S,t))}function E(t,e){t._state===rt&&(t._state=it,t._result=e,J(T,t))}function P(t,e,n,r){var o=t._subscribers,i=o.length;t._onerror=null,o[i]=e,o[i+ot]=n,o[i+it]=r,0===i&&t._state&&J(S,t)}function S(t){var e=t._subscribers,n=t._state;if(0!==e.length){for(var r,o,i=t._result,s=0;s<e.length;s+=3)r=e[s],o=e[s+n],r?O(n,r,o,i):o(i);t._subscribers.length=0}}function C(){this.error=null}function A(t,e){try{return t(e)}catch(n){return at.error=n,at}}function O(t,e,n,r){var o,i,a,l,u=s(n);if(u){if(o=A(n,r),o===at?(l=!0,i=o.error,o=null):a=!0,e===o)return void E(e,v())}else o=r,a=!0;e._state!==rt||(u&&a?j(e,o):l?E(e,i):t===ot?z(e,o):t===it&&E(e,o))}function N(t,e){try{e(function(e){j(t,e)},function(e){E(t,e)})}catch(n){E(t,n)}}function q(t,e){var n=this;n._instanceConstructor=t,n.promise=new t(g),n._validateInput(e)?(n._input=e,n.length=e.length,n._remaining=e.length,n._init(),0===n.length?z(n.promise,n._result):(n.length=n.length||0,n._enumerate(),0===n._remaining&&z(n.promise,n._result))):E(n.promise,n._validationError())}function F(t){return new lt(this,t).promise}function D(t){function e(t){j(o,t)}function n(t){E(o,t)}var r=this,o=new r(g);if(!W(t))return E(o,new TypeError("You must pass an array to race.")),o;for(var i=t.length,s=0;o._state===rt&&i>s;s++)P(r.resolve(t[s]),void 0,e,n);return o}function I(t){var e=this;if(t&&"object"==typeof t&&t.constructor===e)return t;var n=new e(g);return j(n,t),n}function R(t){var e=this,n=new e(g);return E(n,t),n}function B(){throw new TypeError("You must pass a resolver function as the first argument to the promise constructor")}function L(){throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.")}function G(t){this._id=_t++,this._state=void 0,this._result=void 0,this._subscribers=[],g!==t&&(s(t)||B(),this instanceof G||L(),N(this,t))}function U(){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 n=t.Promise;(!n||"[object Promise]"!==Object.prototype.toString.call(n.resolve())||n.cast)&&(t.Promise=dt)}var $;$=Array.isArray?Array.isArray:function(t){return"[object Array]"===Object.prototype.toString.call(t)};var V,H,Y,W=$,X=0,J=({}.toString,function(t,e){nt[X]=t,nt[X+1]=e,X+=2,2===X&&(H?H(f):Y())}),Q="undefined"!=typeof window?window:void 0,K=Q||{},Z=K.MutationObserver||K.WebKitMutationObserver,tt="undefined"!=typeof r&&"[object process]"==={}.toString.call(r),et="undefined"!=typeof Uint8ClampedArray&&"undefined"!=typeof importScripts&&"undefined"!=typeof MessageChannel,nt=new Array(1e3);Y=tt?h():Z?p():et?_():void 0===Q&&"function"==typeof e?m():d();var rt=void 0,ot=1,it=2,st=new C,at=new C;q.prototype._validateInput=function(t){return W(t)},q.prototype._validationError=function(){return new Error("Array Methods must be provided an Array")},q.prototype._init=function(){this._result=new Array(this.length)};var lt=q;q.prototype._enumerate=function(){for(var t=this,e=t.length,n=t.promise,r=t._input,o=0;n._state===rt&&e>o;o++)t._eachEntry(r[o],o)},q.prototype._eachEntry=function(t,e){var n=this,r=n._instanceConstructor;a(t)?t.constructor===r&&t._state!==rt?(t._onerror=null,n._settledAt(t._state,e,t._result)):n._willSettleAt(r.resolve(t),e):(n._remaining--,n._result[e]=t)},q.prototype._settledAt=function(t,e,n){var r=this,o=r.promise;o._state===rt&&(r._remaining--,t===it?E(o,n):r._result[e]=n),0===r._remaining&&z(o,r._result)},q.prototype._willSettleAt=function(t,e){var n=this;P(t,void 0,function(t){n._settledAt(ot,e,t)},function(t){n._settledAt(it,e,t)})};var ut=F,ht=D,ct=I,pt=R,_t=0,dt=G;G.all=ut,G.race=ht,G.resolve=ct,G.reject=pt,G._setScheduler=l,G._setAsap=u,G._asap=J,G.prototype={constructor:G,then:function(t,e){var n=this,r=n._state;if(r===ot&&!t||r===it&&!e)return this;var o=new this.constructor(g),i=n._result;if(r){var s=arguments[r-1];J(function(){O(r,o,s,i)})}else P(n,o,t,e);return o},"catch":function(t){return this.then(null,t)}};var ft=U,mt={Promise:dt,polyfill:ft};"function"==typeof t&&t.amd?t(function(){return mt}):"undefined"!=typeof n&&n.exports?n.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/hammer":[function(e,n,r){/*! Hammer.JS - v2.0.6 - 2015-12-23
|
|
* http://hammerjs.github.io/
|
|
*
|
|
* Copyright (c) 2015 Jorik Tangelder;
|
|
* Licensed under the license */
|
|
!function(e,r,o,i){"use strict";function s(t,e,n){return setTimeout(c(t,n),e)}function a(t,e,n){return Array.isArray(t)?(l(t,n[e],n),!0):!1}function l(t,e,n){var r;if(t)if(t.forEach)t.forEach(e,n);else if(t.length!==i)for(r=0;r<t.length;)e.call(n,t[r],r,t),r++;else for(r in t)t.hasOwnProperty(r)&&e.call(n,t[r],r,t)}function u(t,n,r){var o="DEPRECATED METHOD: "+n+"\n"+r+" AT \n";return function(){var n=new Error("get-stack-trace"),r=n&&n.stack?n.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,r),t.apply(this,arguments)}}function h(t,e,n){var r,o=e.prototype;r=t.prototype=Object.create(o),r.constructor=t,r._super=o,n&&ut(r,n)}function c(t,e){return function(){return t.apply(e,arguments)}}function p(t,e){return typeof t==pt?t.apply(e?e[0]||i:i,e):t}function _(t,e){return t===i?e:t}function d(t,e,n){l(y(e),function(e){t.addEventListener(e,n,!1)})}function f(t,e,n){l(y(e),function(e){t.removeEventListener(e,n,!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,n){if(t.indexOf&&!n)return t.indexOf(e);for(var r=0;r<t.length;){if(n&&t[r][n]==e||!n&&t[r]===e)return r;r++}return-1}function b(t){return Array.prototype.slice.call(t,0)}function x(t,e,n){for(var r=[],o=[],i=0;i<t.length;){var s=e?t[i][e]:t[i];v(o,s)<0&&r.push(t[i]),o[i]=s,i++}return n&&(r=e?r.sort(function(t,n){return t[e]>n[e]}):r.sort()),r}function w(t,e){for(var n,r,o=e[0].toUpperCase()+e.slice(1),s=0;s<ht.length;){if(n=ht[s],r=n?n+o:e,r in t)return r;s++}return i}function k(){return yt++}function M(t){var n=t.ownerDocument||t;return n.defaultView||n.parentWindow||e}function j(t,e){var n=this;this.manager=t,this.callback=e,this.element=t.element,this.target=t.options.inputTarget,this.domHandler=function(e){p(t.options.enable,[t])&&n.handler(e)},this.init()}function T(t){var e,n=t.options.inputClass;return new(e=n?n:xt?B:wt?U:bt?V:R)(t,z)}function z(t,e,n){var r=n.pointers.length,o=n.changedPointers.length,i=e&Et&&r-o===0,s=e&(St|Ct)&&r-o===0;n.isFirst=!!i,n.isFinal=!!s,i&&(t.session={}),n.eventType=e,E(t,n),t.emit("hammer.input",n),t.recognize(n),t.session.prevInput=n}function E(t,e){var n=t.session,r=e.pointers,o=r.length;n.firstInput||(n.firstInput=C(e)),o>1&&!n.firstMultiple?n.firstMultiple=C(e):1===o&&(n.firstMultiple=!1);var i=n.firstInput,s=n.firstMultiple,a=s?s.center:i.center,l=e.center=A(r);e.timeStamp=ft(),e.deltaTime=e.timeStamp-i.timeStamp,e.angle=F(a,l),e.distance=q(a,l),P(n,e),e.offsetDirection=N(e.deltaX,e.deltaY);var u=O(e.deltaTime,e.deltaX,e.deltaY);e.overallVelocityX=u.x,e.overallVelocityY=u.y,e.overallVelocity=dt(u.x)>dt(u.y)?u.x:u.y,e.scale=s?I(s.pointers,r):1,e.rotation=s?D(s.pointers,r):0,e.maxPointers=n.prevInput?e.pointers.length>n.prevInput.maxPointers?e.pointers.length:n.prevInput.maxPointers:e.pointers.length,S(n,e);var h=t.element;m(e.srcEvent.target,h)&&(h=e.srcEvent.target),e.target=h}function P(t,e){var n=e.center,r=t.offsetDelta||{},o=t.prevDelta||{},i=t.prevInput||{};(e.eventType===Et||i.eventType===St)&&(o=t.prevDelta={x:i.deltaX||0,y:i.deltaY||0},r=t.offsetDelta={x:n.x,y:n.y}),e.deltaX=o.x+(n.x-r.x),e.deltaY=o.y+(n.y-r.y)}function S(t,e){var n,r,o,s,a=t.lastInterval||e,l=e.timeStamp-a.timeStamp;if(e.eventType!=Ct&&(l>zt||a.velocity===i)){var u=e.deltaX-a.deltaX,h=e.deltaY-a.deltaY,c=O(l,u,h);r=c.x,o=c.y,n=dt(c.x)>dt(c.y)?c.x:c.y,s=N(u,h),t.lastInterval=e}else n=a.velocity,r=a.velocityX,o=a.velocityY,s=a.direction;e.velocity=n,e.velocityX=r,e.velocityY=o,e.direction=s}function C(t){for(var e=[],n=0;n<t.pointers.length;)e[n]={clientX:_t(t.pointers[n].clientX),clientY:_t(t.pointers[n].clientY)},n++;return{timeStamp:ft(),pointers:e,center:A(e),deltaX:t.deltaX,deltaY:t.deltaY}}function A(t){var e=t.length;if(1===e)return{x:_t(t[0].clientX),y:_t(t[0].clientY)};for(var n=0,r=0,o=0;e>o;)n+=t[o].clientX,r+=t[o].clientY,o++;return{x:_t(n/e),y:_t(r/e)}}function O(t,e,n){return{x:e/t||0,y:n/t||0}}function N(t,e){return t===e?At:dt(t)>=dt(e)?0>t?Ot:Nt:0>e?qt:Ft}function q(t,e,n){n||(n=Bt);var r=e[n[0]]-t[n[0]],o=e[n[1]]-t[n[1]];return Math.sqrt(r*r+o*o)}function F(t,e,n){n||(n=Bt);var r=e[n[0]]-t[n[0]],o=e[n[1]]-t[n[1]];return 180*Math.atan2(o,r)/Math.PI}function D(t,e){return F(e[1],e[0],Lt)+F(t[1],t[0],Lt)}function I(t,e){return q(e[0],e[1],Lt)/q(t[0],t[1],Lt)}function R(){this.evEl=Ut,this.evWin=$t,this.allow=!0,this.pressed=!1,j.apply(this,arguments)}function B(){this.evEl=Yt,this.evWin=Wt,j.apply(this,arguments),this.store=this.manager.session.pointerEvents=[]}function L(){this.evTarget=Jt,this.evWin=Qt,this.started=!1,j.apply(this,arguments)}function G(t,e){var n=b(t.touches),r=b(t.changedTouches);return e&(St|Ct)&&(n=x(n.concat(r),"identifier",!0)),[n,r]}function U(){this.evTarget=Zt,this.targetIds={},j.apply(this,arguments)}function $(t,e){var n=b(t.touches),r=this.targetIds;if(e&(Et|Pt)&&1===n.length)return r[n[0].identifier]=!0,[n,n];var o,i,s=b(t.changedTouches),a=[],l=this.target;if(i=n.filter(function(t){return m(t.target,l)}),e===Et)for(o=0;o<i.length;)r[i[o].identifier]=!0,o++;for(o=0;o<s.length;)r[s[o].identifier]&&a.push(s[o]),e&(St|Ct)&&delete r[s[o].identifier],o++;return a.length?[x(i.concat(a),"identifier",!0),a]:void 0}function V(){j.apply(this,arguments);var t=c(this.handler,this);this.touch=new U(this.manager,t),this.mouse=new R(this.manager,t)}function H(t,e){this.manager=t,this.set(e)}function Y(t){if(g(t,ie))return ie;var e=g(t,se),n=g(t,ae);return e&&n?ie:e||n?e?se:ae:g(t,oe)?oe:re}function W(t){this.options=ut({},this.defaults,t||{}),this.id=k(),this.manager=null,this.options.enable=_(this.options.enable,!0),this.state=le,this.simultaneous={},this.requireFail=[]}function X(t){return t&_e?"cancel":t&ce?"end":t&he?"move":t&ue?"start":""}function J(t){return t==Ft?"down":t==qt?"up":t==Ot?"left":t==Nt?"right":""}function Q(t,e){var n=e.manager;return n?n.get(t):t}function K(){W.apply(this,arguments)}function Z(){K.apply(this,arguments),this.pX=null,this.pY=null}function tt(){K.apply(this,arguments)}function et(){W.apply(this,arguments),this._timer=null,this._input=null}function nt(){K.apply(this,arguments)}function rt(){K.apply(this,arguments)}function ot(){W.apply(this,arguments),this.pTime=!1,this.pCenter=!1,this._timer=null,this._input=null,this.count=0}function it(t,e){return e=e||{},e.recognizers=_(e.recognizers,it.defaults.preset),new st(t,e)}function st(t,e){this.options=ut({},it.defaults,e||{}),this.options.inputTarget=this.options.inputTarget||t,this.handlers={},this.session={},this.recognizers=[],this.element=t,this.input=T(this),this.touchAction=new H(this,this.options.touchAction),at(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 at(t,e){var n=t.element;n.style&&l(t.options.cssProps,function(t,r){n.style[w(n.style,r)]=e?t:""})}function lt(t,e){var n=r.createEvent("Event");n.initEvent(t,!0,!0),n.gesture=e,e.target.dispatchEvent(n)}var ut,ht=["","webkit","Moz","MS","ms","o"],ct=r.createElement("div"),pt="function",_t=Math.round,dt=Math.abs,ft=Date.now;ut="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),n=1;n<arguments.length;n++){var r=arguments[n];if(r!==i&&null!==r)for(var o in r)r.hasOwnProperty(o)&&(e[o]=r[o])}return e}:Object.assign;var mt=u(function(t,e,n){for(var r=Object.keys(e),o=0;o<r.length;)(!n||n&&t[r[o]]===i)&&(t[r[o]]=e[r[o]]),o++;return t},"extend","Use `assign`."),gt=u(function(t,e){return mt(t,e,!0)},"merge","Use `assign`."),yt=1,vt=/mobile|tablet|ip(ad|hone|od)|android/i,bt="ontouchstart"in e,xt=w(e,"PointerEvent")!==i,wt=bt&&vt.test(navigator.userAgent),kt="touch",Mt="pen",jt="mouse",Tt="kinect",zt=25,Et=1,Pt=2,St=4,Ct=8,At=1,Ot=2,Nt=4,qt=8,Ft=16,Dt=Ot|Nt,It=qt|Ft,Rt=Dt|It,Bt=["x","y"],Lt=["clientX","clientY"];j.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 Gt={mousedown:Et,mousemove:Pt,mouseup:St},Ut="mousedown",$t="mousemove mouseup";h(R,j,{handler:function(t){var e=Gt[t.type];e&Et&&0===t.button&&(this.pressed=!0),e&Pt&&1!==t.which&&(e=St),this.pressed&&this.allow&&(e&St&&(this.pressed=!1),this.callback(this.manager,e,{pointers:[t],changedPointers:[t],pointerType:jt,srcEvent:t}))}});var Vt={pointerdown:Et,pointermove:Pt,pointerup:St,pointercancel:Ct,pointerout:Ct},Ht={2:kt,3:Mt,4:jt,5:Tt},Yt="pointerdown",Wt="pointermove pointerup pointercancel";e.MSPointerEvent&&!e.PointerEvent&&(Yt="MSPointerDown",Wt="MSPointerMove MSPointerUp MSPointerCancel"),h(B,j,{handler:function(t){var e=this.store,n=!1,r=t.type.toLowerCase().replace("ms",""),o=Vt[r],i=Ht[t.pointerType]||t.pointerType,s=i==kt,a=v(e,t.pointerId,"pointerId");o&Et&&(0===t.button||s)?0>a&&(e.push(t),a=e.length-1):o&(St|Ct)&&(n=!0),0>a||(e[a]=t,this.callback(this.manager,o,{pointers:e,changedPointers:[t],pointerType:i,srcEvent:t}),n&&e.splice(a,1))}});var Xt={touchstart:Et,touchmove:Pt,touchend:St,touchcancel:Ct},Jt="touchstart",Qt="touchstart touchmove touchend touchcancel";h(L,j,{handler:function(t){var e=Xt[t.type];if(e===Et&&(this.started=!0),this.started){var n=G.call(this,t,e);e&(St|Ct)&&n[0].length-n[1].length===0&&(this.started=!1),this.callback(this.manager,e,{pointers:n[0],changedPointers:n[1],pointerType:kt,srcEvent:t})}}});var Kt={touchstart:Et,touchmove:Pt,touchend:St,touchcancel:Ct},Zt="touchstart touchmove touchend touchcancel";h(U,j,{handler:function(t){var e=Kt[t.type],n=$.call(this,t,e);n&&this.callback(this.manager,e,{pointers:n[0],changedPointers:n[1],pointerType:kt,srcEvent:t})}}),h(V,j,{handler:function(t,e,n){var r=n.pointerType==kt,o=n.pointerType==jt;if(r)this.mouse.allow=!1;else if(o&&!this.mouse.allow)return;e&(St|Ct)&&(this.mouse.allow=!0),this.callback(t,e,n)},destroy:function(){this.touch.destroy(),this.mouse.destroy()}});var te=w(ct.style,"touchAction"),ee=te!==i,ne="compute",re="auto",oe="manipulation",ie="none",se="pan-x",ae="pan-y";H.prototype={set:function(t){t==ne&&(t=this.compute()),ee&&this.manager.element.style&&(this.manager.element.style[te]=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){p(e.options.enable,[e])&&(t=t.concat(e.getTouchAction()))}),Y(t.join(" "))},preventDefaults:function(t){if(!ee){var e=t.srcEvent,n=t.offsetDirection;if(this.manager.session.prevented)return void e.preventDefault();var r=this.actions,o=g(r,ie),i=g(r,ae),s=g(r,se);if(o){var a=1===t.pointers.length,l=t.distance<2,u=t.deltaTime<250;if(a&&l&&u)return}if(!s||!i)return o||i&&n&Dt||s&&n&It?this.preventSrc(e):void 0}},preventSrc:function(t){this.manager.session.prevented=!0,t.preventDefault()}};var le=1,ue=2,he=4,ce=8,pe=ce,_e=16,de=32;W.prototype={defaults:{},set:function(t){return ut(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=Q(t,this),e[t.id]||(e[t.id]=t,t.recognizeWith(this)),this},dropRecognizeWith:function(t){return a(t,"dropRecognizeWith",this)?this:(t=Q(t,this),delete this.simultaneous[t.id],this)},requireFailure:function(t){if(a(t,"requireFailure",this))return this;var e=this.requireFail;return t=Q(t,this),-1===v(e,t)&&(e.push(t),t.requireFailure(this)),this},dropRequireFailure:function(t){if(a(t,"dropRequireFailure",this))return this;t=Q(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){n.manager.emit(e,t)}var n=this,r=this.state;ce>r&&e(n.options.event+X(r)),e(n.options.event),t.additionalEvent&&e(t.additionalEvent),r>=ce&&e(n.options.event+X(r))},tryEmit:function(t){return this.canEmit()?this.emit(t):void(this.state=de)},canEmit:function(){for(var t=0;t<this.requireFail.length;){if(!(this.requireFail[t].state&(de|le)))return!1;t++}return!0},recognize:function(t){var e=ut({},t);return p(this.options.enable,[this,e])?(this.state&(pe|_e|de)&&(this.state=le),this.state=this.process(e),void(this.state&(ue|he|ce|_e)&&this.tryEmit(e))):(this.reset(),void(this.state=de))},process:function(t){},getTouchAction:function(){},reset:function(){}},h(K,W,{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,n=t.eventType,r=e&(ue|he),o=this.attrTest(t);return r&&(n&Ct||!o)?e|_e:r||o?n&St?e|ce:e&ue?e|he:ue:de}}),h(Z,K,{defaults:{event:"pan",threshold:10,pointers:1,direction:Rt},getTouchAction:function(){var t=this.options.direction,e=[];return t&Dt&&e.push(ae),t&It&&e.push(se),e},directionTest:function(t){var e=this.options,n=!0,r=t.distance,o=t.direction,i=t.deltaX,s=t.deltaY;return o&e.direction||(e.direction&Dt?(o=0===i?At:0>i?Ot:Nt,n=i!=this.pX,r=Math.abs(t.deltaX)):(o=0===s?At:0>s?qt:Ft,n=s!=this.pY,r=Math.abs(t.deltaY))),t.direction=o,n&&r>e.threshold&&o&e.direction},attrTest:function(t){return K.prototype.attrTest.call(this,t)&&(this.state&ue||!(this.state&ue)&&this.directionTest(t))},emit:function(t){this.pX=t.deltaX,this.pY=t.deltaY;var e=J(t.direction);e&&(t.additionalEvent=this.options.event+e),this._super.emit.call(this,t)}}),h(tt,K,{defaults:{event:"pinch",threshold:0,pointers:2},getTouchAction:function(){return[ie]},attrTest:function(t){return this._super.attrTest.call(this,t)&&(Math.abs(t.scale-1)>this.options.threshold||this.state&ue)},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)}}),h(et,W,{defaults:{event:"press",pointers:1,time:251,threshold:9},getTouchAction:function(){return[re]},process:function(t){var e=this.options,n=t.pointers.length===e.pointers,r=t.distance<e.threshold,o=t.deltaTime>e.time;if(this._input=t,!r||!n||t.eventType&(St|Ct)&&!o)this.reset();else if(t.eventType&Et)this.reset(),this._timer=s(function(){this.state=pe,this.tryEmit()},e.time,this);else if(t.eventType&St)return pe;return de},reset:function(){clearTimeout(this._timer)},emit:function(t){this.state===pe&&(t&&t.eventType&St?this.manager.emit(this.options.event+"up",t):(this._input.timeStamp=ft(),this.manager.emit(this.options.event,this._input)))}}),h(nt,K,{defaults:{event:"rotate",threshold:0,pointers:2},getTouchAction:function(){return[ie]},attrTest:function(t){return this._super.attrTest.call(this,t)&&(Math.abs(t.rotation)>this.options.threshold||this.state&ue)}}),h(rt,K,{defaults:{event:"swipe",threshold:10,velocity:.3,direction:Dt|It,pointers:1},getTouchAction:function(){return Z.prototype.getTouchAction.call(this)},attrTest:function(t){var e,n=this.options.direction;return n&(Dt|It)?e=t.overallVelocity:n&Dt?e=t.overallVelocityX:n&It&&(e=t.overallVelocityY),this._super.attrTest.call(this,t)&&n&t.offsetDirection&&t.distance>this.options.threshold&&t.maxPointers==this.options.pointers&&dt(e)>this.options.velocity&&t.eventType&St},emit:function(t){var e=J(t.offsetDirection);e&&this.manager.emit(this.options.event+e,t),this.manager.emit(this.options.event,t)}}),h(ot,W,{defaults:{event:"tap",pointers:1,taps:1,interval:300,time:250,threshold:9,posThreshold:10},getTouchAction:function(){return[oe]},process:function(t){var e=this.options,n=t.pointers.length===e.pointers,r=t.distance<e.threshold,o=t.deltaTime<e.time;if(this.reset(),t.eventType&Et&&0===this.count)return this.failTimeout();if(r&&o&&n){if(t.eventType!=St)return this.failTimeout();var i=this.pTime?t.timeStamp-this.pTime<e.interval:!0,a=!this.pCenter||q(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=pe,this.tryEmit()},e.interval,this),ue):pe}return de},failTimeout:function(){return this._timer=s(function(){this.state=de},this.options.interval,this),de},reset:function(){clearTimeout(this._timer)},emit:function(){this.state==pe&&(this._input.tapCount=this.count,this.manager.emit(this.options.event,this._input))}}),it.VERSION="2.0.6",it.defaults={domEvents:!1,touchAction:ne,enable:!0,inputTarget:null,inputClass:null,preset:[[nt,{enable:!1}],[tt,{enable:!1},["rotate"]],[rt,{direction:Dt}],[Z,{direction:Dt},["swipe"]],[ot],[ot,{event:"doubletap",taps:2},["tap"]],[et]],cssProps:{userSelect:"none",touchSelect:"none",touchCallout:"none",contentZooming:"none",userDrag:"none",tapHighlightColor:"rgba(0,0,0,0)"}};var fe=1,me=2;st.prototype={set:function(t){return ut(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?me:fe},recognize:function(t){var e=this.session;if(!e.stopped){this.touchAction.preventDefaults(t);var n,r=this.recognizers,o=e.curRecognizer;(!o||o&&o.state&pe)&&(o=e.curRecognizer=null);for(var i=0;i<r.length;)n=r[i],e.stopped===me||o&&n!=o&&!n.canRecognizeWith(o)?n.reset():n.recognize(t),!o&&n.state&(ue|he|ce)&&(o=e.curRecognizer=n),i++}},get:function(t){if(t instanceof W)return t;for(var e=this.recognizers,n=0;n<e.length;n++)if(e[n].options.event==t)return e[n];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,n=v(e,t);-1!==n&&(e.splice(n,1),this.touchAction.update())}return this},on:function(t,e){var n=this.handlers;return l(y(t),function(t){n[t]=n[t]||[],n[t].push(e)}),this},off:function(t,e){var n=this.handlers;return l(y(t),function(t){e?n[t]&&n[t].splice(v(n[t],e),1):delete n[t]}),this},emit:function(t,e){this.options.domEvents&<(t,e);var n=this.handlers[t]&&this.handlers[t].slice();if(n&&n.length){e.type=t,e.preventDefault=function(){e.srcEvent.preventDefault()};for(var r=0;r<n.length;)n[r](e),r++}},destroy:function(){this.element&&at(this,!1),this.handlers={},this.session={},this.input.destroy(),this.element=null}},ut(it,{INPUT_START:Et,INPUT_MOVE:Pt,INPUT_END:St,INPUT_CANCEL:Ct,STATE_POSSIBLE:le,STATE_BEGAN:ue,STATE_CHANGED:he,STATE_ENDED:ce,STATE_RECOGNIZED:pe,STATE_CANCELLED:_e,STATE_FAILED:de,DIRECTION_NONE:At,DIRECTION_LEFT:Ot,DIRECTION_RIGHT:Nt,DIRECTION_UP:qt,DIRECTION_DOWN:Ft,DIRECTION_HORIZONTAL:Dt,DIRECTION_VERTICAL:It,DIRECTION_ALL:Rt,Manager:st,Input:j,TouchAction:H,TouchInput:U,MouseInput:R,PointerEventInput:B,TouchMouseInput:V,SingleTouchInput:L,Recognizer:W,AttrRecognizer:K,Tap:ot,Pan:Z,Swipe:rt,Pinch:tt,Rotate:nt,Press:et,on:d,off:f,each:l,merge:gt,extend:mt,assign:ut,inherit:h,bindFn:c,prefixed:w});var ge="undefined"!=typeof e?e:"undefined"!=typeof self?self:{};ge.Hammer=it,"function"==typeof t&&t.amd?t(function(){return it}):"undefined"!=typeof n&&n.exports?n.exports=it:e[o]=it}(window,document,"Hammer")},{}],"jquery-mousewheel":[function(e,n,r){/*!
|
|
* 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 r?n.exports=e:e(jQuery)}(function(t){function e(e){var s=e||window.event,a=l.call(arguments,1),u=0,c=0,p=0,_=0,d=0,f=0;if(e=t.event.fix(s),e.type="mousewheel","detail"in s&&(p=-1*s.detail),"wheelDelta"in s&&(p=s.wheelDelta),"wheelDeltaY"in s&&(p=s.wheelDeltaY),"wheelDeltaX"in s&&(c=-1*s.wheelDeltaX),"axis"in s&&s.axis===s.HORIZONTAL_AXIS&&(c=-1*p,p=0),u=0===p?c:p,"deltaY"in s&&(p=-1*s.deltaY,u=p),"deltaX"in s&&(c=s.deltaX,0===p&&(u=-1*c)),0!==p||0!==c){if(1===s.deltaMode){var m=t.data(this,"mousewheel-line-height");u*=m,p*=m,c*=m}else if(2===s.deltaMode){var g=t.data(this,"mousewheel-page-height");u*=g,p*=g,c*=g}if(_=Math.max(Math.abs(p),Math.abs(c)),(!i||i>_)&&(i=_,r(s,_)&&(i/=40)),r(s,_)&&(u/=40,c/=40,p/=40),u=Math[u>=1?"floor":"ceil"](u/i),c=Math[c>=1?"floor":"ceil"](c/i),p=Math[p>=1?"floor":"ceil"](p/i),h.settings.normalizeOffset&&this.getBoundingClientRect){var y=this.getBoundingClientRect();d=e.clientX-y.left,f=e.clientY-y.top}return e.deltaX=c,e.deltaY=p,e.deltaFactor=i,e.offsetX=d,e.offsetY=f,e.deltaMode=0,a.unshift(e,u,c,p),o&&clearTimeout(o),o=setTimeout(n,200),(t.event.dispatch||t.event.handle).apply(this,a)}}function n(){i=null}function r(t,e){return h.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 h=t.event.special.mousewheel={version:"3.1.12",setup:function(){if(this.addEventListener)for(var n=a.length;n;)this.addEventListener(a[--n],e,!1);else this.onmousewheel=e;t.data(this,"mousewheel-line-height",h.getLineHeight(this)),t.data(this,"mousewheel-page-height",h.getPageHeight(this))},teardown:function(){if(this.removeEventListener)for(var n=a.length;n;)this.removeEventListener(a[--n],e,!1);else this.onmousewheel=null;t.removeData(this,"mousewheel-line-height"),t.removeData(this,"mousewheel-page-height")},getLineHeight:function(e){var n=t(e),r=n["offsetParent"in t.fn?"offsetParent":"parent"]();return r.length||(r=t("body")),parseInt(r.css("fontSize"),10)||parseInt(n.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,n,r){/*!
|
|
* jQuery JavaScript Library v2.2.0
|
|
* 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-01-08T20:02Z
|
|
*/
|
|
!function(t,e){"object"==typeof n&&"object"==typeof n.exports?n.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,n){function r(t){var e=!!t&&"length"in t&&t.length,n=st.type(t);return"function"===n||st.isWindow(t)?!1:"array"===n||0===e||"number"==typeof e&&e>0&&e-1 in t}function o(t,e,n){if(st.isFunction(e))return st.grep(t,function(t,r){return!!e.call(t,r,t)!==n});if(e.nodeType)return st.grep(t,function(t){return t===e!==n});if("string"==typeof e){if(mt.test(e))return st.filter(e,t,n);e=st.filter(e,t)}return st.grep(t,function(t){return tt.call(e,t)>-1!==n})}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,n){e[n]=!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,n){var r;if(void 0===n&&1===t.nodeType)if(r="data-"+e.replace(Pt,"-$&").toLowerCase(),n=t.getAttribute(r),"string"==typeof n){try{n="true"===n?!0:"false"===n?!1:"null"===n?null:+n+""===n?+n:Et.test(n)?st.parseJSON(n):n}catch(o){}zt.set(t,e,n)}else n=void 0;return n}function h(t,e,n,r){var o,i=1,s=20,a=r?function(){return r.cur()}:function(){return st.css(t,e,"")},l=a(),u=n&&n[3]||(st.cssNumber[e]?"":"px"),h=(st.cssNumber[e]||"px"!==u&&+l)&&Ct.exec(st.css(t,e));if(h&&h[3]!==u){u=u||h[3],n=n||[],h=+l||1;do i=i||".5",h/=i,st.style(t,e,h+u);while(i!==(i=a()/l)&&1!==i&&--s)}return n&&(h=+h||+l||0,o=n[1]?h+(n[1]+1)*n[2]:+n[2],r&&(r.unit=u,r.start=h,r.end=o)),o}function c(t,e){var n="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],n):n}function p(t,e){for(var n=0,r=t.length;r>n;n++)Tt.set(t[n],"globalEval",!e||Tt.get(e[n],"globalEval"))}function _(t,e,n,r,o){for(var i,s,a,l,u,h,_=e.createDocumentFragment(),d=[],f=0,m=t.length;m>f;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=(qt.exec(i)||["",""])[1].toLowerCase(),l=Dt[a]||Dt._default,s.innerHTML=l[1]+st.htmlPrefilter(i)+l[2],h=l[0];h--;)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(r&&st.inArray(i,r)>-1)o&&o.push(i);else if(u=st.contains(i.ownerDocument,i),s=c(_.appendChild(i),"script"),u&&p(s),n)for(h=0;i=s[h++];)Ft.test(i.type||"")&&n.push(i);return _}function d(){return!0}function f(){return!1}function m(){try{return J.activeElement}catch(t){}}function g(t,e,n,r,o,i){var s,a;if("object"==typeof e){"string"!=typeof n&&(r=r||n,n=void 0);for(a in e)g(t,a,n,r,e[a],i);return t}if(null==r&&null==o?(o=n,r=n=void 0):null==o&&("string"==typeof n?(o=r,r=void 0):(o=r,r=n,n=void 0)),o===!1)o=f;else if(!o)return this;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,r,n)})}function y(t,e){return st.nodeName(t,"table")&&st.nodeName(11!==e.nodeType?e:e.firstChild,"tr")?t.getElementsByTagName("tbody")[0]||t:t}function v(t){return t.type=(null!==t.getAttribute("type"))+"/"+t.type,t}function b(t){var e=Vt.exec(t.type);return e?t.type=e[1]:t.removeAttribute("type"),t}function x(t,e){var n,r,o,i,s,a,l,u;if(1===e.nodeType){if(Tt.hasData(t)&&(i=Tt.access(t),s=Tt.set(e,i),u=i.events)){delete s.handle,s.events={};for(o in u)for(n=0,r=u[o].length;r>n;n++)st.event.add(e,o,u[o][n])}zt.hasData(t)&&(a=zt.access(t),l=st.extend({},a),zt.set(e,l))}}function w(t,e){var n=e.nodeName.toLowerCase();"input"===n&&Nt.test(t.type)?e.checked=t.checked:("input"===n||"textarea"===n)&&(e.defaultValue=t.defaultValue)}function k(t,e,n,r){e=K.apply([],e);var o,i,s,a,l,u,h=0,p=t.length,d=p-1,f=e[0],m=st.isFunction(f);if(m||p>1&&"string"==typeof f&&!ot.checkClone&&$t.test(f))return t.each(function(o){var i=t.eq(o);m&&(e[0]=f.call(this,o,i.html())),k(i,e,n,r)});if(p&&(o=_(e,t[0].ownerDocument,!1,t,r),i=o.firstChild,1===o.childNodes.length&&(o=i),i||r)){for(s=st.map(c(o,"script"),v),a=s.length;p>h;h++)l=o,h!==d&&(l=st.clone(l,!0,!0),a&&st.merge(s,c(l,"script"))),n.call(t[h],l,h);if(a)for(u=s[s.length-1].ownerDocument,st.map(s,b),h=0;a>h;h++)l=s[h],Ft.test(l.type||"")&&!Tt.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,n){for(var r,o=e?st.filter(e,t):t,i=0;null!=(r=o[i]);i++)n||1!==r.nodeType||st.cleanData(c(r)),r.parentNode&&(n&&st.contains(r.ownerDocument,r)&&p(c(r,"script")),r.parentNode.removeChild(r));return t}function j(t,e){var n=st(e.createElement(t)).appendTo(e.body),r=st.css(n[0],"display");return n.detach(),r}function T(t){var e=J,n=Wt[t];return n||(n=j(t,e),"none"!==n&&n||(Yt=(Yt||st("<iframe frameborder='0' width='0' height='0'/>")).appendTo(e.documentElement),e=Yt[0].contentDocument,e.write(),e.close(),n=j(t,e),Yt.detach()),Wt[t]=n),n}function z(t,e,n){var r,o,i,s,a=t.style;return n=n||Qt(t),n&&(s=n.getPropertyValue(e)||n[e],""!==s||st.contains(t.ownerDocument,t)||(s=st.style(t,e)),!ot.pixelMarginRight()&&Jt.test(s)&&Xt.test(e)&&(r=a.width,o=a.minWidth,i=a.maxWidth,a.minWidth=a.maxWidth=a.width=s,s=n.width,a.width=r,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 P(t){if(t in oe)return t;for(var e=t[0].toUpperCase()+t.slice(1),n=re.length;n--;)if(t=re[n]+e,t in oe)return t}function S(t,e,n){var r=Ct.exec(e);return r?Math.max(0,r[2]-(n||0))+(r[3]||"px"):e}function C(t,e,n,r,o){for(var i=n===(r?"border":"content")?4:"width"===e?1:0,s=0;4>i;i+=2)"margin"===n&&(s+=st.css(t,n+At[i],!0,o)),r?("content"===n&&(s-=st.css(t,"padding"+At[i],!0,o)),"margin"!==n&&(s-=st.css(t,"border"+At[i]+"Width",!0,o))):(s+=st.css(t,"padding"+At[i],!0,o),"padding"!==n&&(s+=st.css(t,"border"+At[i]+"Width",!0,o)));return s}function A(t,n,r){var o=!0,i="width"===n?t.offsetWidth:t.offsetHeight,s=Qt(t),a="border-box"===st.css(t,"boxSizing",!1,s);if(J.msFullscreenElement&&e.top!==e&&t.getClientRects().length&&(i=Math.round(100*t.getBoundingClientRect()[n])),0>=i||null==i){if(i=z(t,n,s),(0>i||null==i)&&(i=t.style[n]),Jt.test(i))return i;o=a&&(ot.boxSizingReliable()||i===t.style[n]),i=parseFloat(i)||0}return i+C(t,n,r||(a?"border":"content"),o,s)+"px"}function O(t,e){for(var n,r,o,i=[],s=0,a=t.length;a>s;s++)r=t[s],r.style&&(i[s]=Tt.get(r,"olddisplay"),n=r.style.display,e?(i[s]||"none"!==n||(r.style.display=""),""===r.style.display&&Ot(r)&&(i[s]=Tt.access(r,"olddisplay",T(r.nodeName)))):(o=Ot(r),"none"===n&&o||Tt.set(r,"olddisplay",o?n:st.css(r,"display"))));for(s=0;a>s;s++)r=t[s],r.style&&(e&&"none"!==r.style.display&&""!==r.style.display||(r.style.display=e?i[s]||"":"none"));return t}function N(t,e,n,r,o){return new N.prototype.init(t,e,n,r,o)}function q(){return e.setTimeout(function(){ie=void 0}),ie=st.now()}function F(t,e){var n,r=0,o={height:t};for(e=e?1:0;4>r;r+=2-e)n=At[r],o["margin"+n]=o["padding"+n]=t;return e&&(o.opacity=o.width=t),o}function D(t,e,n){for(var r,o=(B.tweeners[e]||[]).concat(B.tweeners["*"]),i=0,s=o.length;s>i;i++)if(r=o[i].call(n,e,t))return r}function I(t,e,n){var r,o,i,s,a,l,u,h,c=this,p={},_=t.style,d=t.nodeType&&Ot(t),f=Tt.get(t,"fxshow");n.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++,c.always(function(){c.always(function(){a.unqueued--,st.queue(t,"fx").length||a.empty.fire()})})),1===t.nodeType&&("height"in e||"width"in e)&&(n.overflow=[_.overflow,_.overflowX,_.overflowY],u=st.css(t,"display"),h="none"===u?Tt.get(t,"olddisplay")||T(t.nodeName):u,"inline"===h&&"none"===st.css(t,"float")&&(_.display="inline-block")),n.overflow&&(_.overflow="hidden",c.always(function(){_.overflow=n.overflow[0],_.overflowX=n.overflow[1],_.overflowY=n.overflow[2]}));for(r in e)if(o=e[r],ae.exec(o)){if(delete e[r],i=i||"toggle"===o,o===(d?"hide":"show")){if("show"!==o||!f||void 0===f[r])continue;d=!0}p[r]=f&&f[r]||st.style(t,r)}else u=void 0;if(st.isEmptyObject(p))"inline"===("none"===u?T(t.nodeName):u)&&(_.display=u);else{f?"hidden"in f&&(d=f.hidden):f=Tt.access(t,"fxshow",{}),i&&(f.hidden=!d),d?st(t).show():c.done(function(){st(t).hide()}),c.done(function(){var e;Tt.remove(t,"fxshow");for(e in p)st.style(t,e,p[e])});for(r in p)s=D(d?f[r]:0,r,c),r in f||(f[r]=s.start,d&&(s.end=s.start,s.start="width"===r||"height"===r?1:0))}}function R(t,e){var n,r,o,i,s;for(n in t)if(r=st.camelCase(n),o=e[r],i=t[n],st.isArray(i)&&(o=i[1],i=t[n]=i[0]),n!==r&&(t[r]=i,delete t[n]),s=st.cssHooks[r],s&&"expand"in s){i=s.expand(i),delete t[r];for(n in i)n in t||(t[n]=i[n],e[n]=o)}else e[r]=o}function B(t,e,n){var r,o,i=0,s=B.prefilters.length,a=st.Deferred().always(function(){delete l.elem}),l=function(){if(o)return!1;for(var e=ie||q(),n=Math.max(0,u.startTime+u.duration-e),r=n/u.duration||0,i=1-r,s=0,l=u.tweens.length;l>s;s++)u.tweens[s].run(i);return a.notifyWith(t,[u,i,n]),1>i&&l?n:(a.resolveWith(t,[u]),!1)},u=a.promise({elem:t,props:st.extend({},e),opts:st.extend(!0,{specialEasing:{},easing:st.easing._default},n),originalProperties:e,originalOptions:n,startTime:ie||q(),duration:n.duration,tweens:[],createTween:function(e,n){var r=st.Tween(t,u.opts,e,n,u.opts.specialEasing[e]||u.opts.easing);return u.tweens.push(r),r},stop:function(e){var n=0,r=e?u.tweens.length:0;if(o)return this;for(o=!0;r>n;n++)u.tweens[n].run(1);return e?(a.notifyWith(t,[u,1,0]),a.resolveWith(t,[u,e])):a.rejectWith(t,[u,e]),this}}),h=u.props;for(R(h,u.opts.specialEasing);s>i;i++)if(r=B.prefilters[i].call(u,t,h,u.opts))return st.isFunction(r.stop)&&(st._queueHooks(u.elem,u.opts.queue).stop=st.proxy(r.stop,r)),r;return st.map(h,D,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 L(t){return t.getAttribute&&t.getAttribute("class")||""}function G(t){return function(e,n){"string"!=typeof e&&(n=e,e="*");var r,o=0,i=e.toLowerCase().match(wt)||[];if(st.isFunction(n))for(;r=i[o++];)"+"===r[0]?(r=r.slice(1)||"*",(t[r]=t[r]||[]).unshift(n)):(t[r]=t[r]||[]).push(n)}}function U(t,e,n,r){function o(a){var l;return i[a]=!0,st.each(t[a]||[],function(t,a){var u=a(e,n,r);return"string"!=typeof u||s||i[u]?s?!(l=u):void 0:(e.dataTypes.unshift(u),o(u),!1)}),l}var i={},s=t===Te;return o(e.dataTypes[0])||!i["*"]&&o("*")}function $(t,e){var n,r,o=st.ajaxSettings.flatOptions||{};for(n in e)void 0!==e[n]&&((o[n]?t:r||(r={}))[n]=e[n]);return r&&st.extend(!0,t,r),t}function V(t,e,n){for(var r,o,i,s,a=t.contents,l=t.dataTypes;"*"===l[0];)l.shift(),void 0===r&&(r=t.mimeType||e.getResponseHeader("Content-Type"));if(r)for(o in a)if(a[o]&&a[o].test(r)){l.unshift(o);break}if(l[0]in n)i=l[0];else{for(o in n){if(!l[0]||t.converters[o+" "+l[0]]){i=o;break}s||(s=o)}i=i||s}return i?(i!==l[0]&&l.unshift(i),n[i]):void 0}function H(t,e,n,r){var o,i,s,a,l,u={},h=t.dataTypes.slice();if(h[1])for(s in t.converters)u[s.toLowerCase()]=t.converters[s];for(i=h.shift();i;)if(t.responseFields[i]&&(n[t.responseFields[i]]=e),!l&&r&&t.dataFilter&&(e=t.dataFilter(e,t.dataType)),l=i,i=h.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],h.unshift(a[1]));break}if(s!==!0)if(s&&t["throws"])e=s(e);else try{e=s(e)}catch(c){return{state:"parsererror",error:s?c:"No conversion from "+l+" to "+i}}}return{state:"success",data:e}}function Y(t,e,n,r){var o;if(st.isArray(e))st.each(e,function(e,o){n||Se.test(t)?r(t,o):Y(t+"["+("object"==typeof o&&null!=o?e:"")+"]",o,n,r)});else if(n||"object"!==st.type(e))r(t,e);else for(o in e)Y(t+"["+o+"]",e[o],n,r)}function W(t){return st.isWindow(t)?t:9===t.nodeType&&t.defaultView}var X=[],J=e.document,Q=X.slice,K=X.concat,Z=X.push,tt=X.indexOf,et={},nt=et.toString,rt=et.hasOwnProperty,ot={},it="2.2.0",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,ht=function(t,e){return e.toUpperCase()};st.fn=st.prototype={jquery:it,constructor:st,selector:"",length:0,toArray:function(){return Q.call(this)},get:function(t){return null!=t?0>t?this[t+this.length]:this[t]:Q.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,n){return t.call(e,n,e)}))},slice:function(){return this.pushStack(Q.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},eq:function(t){var e=this.length,n=+t+(0>t?e:0);return this.pushStack(n>=0&&e>n?[this[n]]:[])},end:function(){return this.prevObject||this.constructor()},push:Z,sort:X.sort,splice:X.splice},st.extend=st.fn.extend=function(){var t,e,n,r,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--);l>a;a++)if(null!=(t=arguments[a]))for(e in t)n=s[e],r=t[e],s!==r&&(u&&r&&(st.isPlainObject(r)||(o=st.isArray(r)))?(o?(o=!1,i=n&&st.isArray(n)?n:[]):i=n&&st.isPlainObject(n)?n:{},s[e]=st.extend(u,i,r)):void 0!==r&&(s[e]=r));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){return"object"!==st.type(t)||t.nodeType||st.isWindow(t)?!1:t.constructor&&!rt.call(t.constructor.prototype,"isPrototypeOf")?!1:!0},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[nt.call(t)]||"object":typeof t},globalEval:function(t){var e,n=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)):n(t))},camelCase:function(t){return t.replace(lt,"ms-").replace(ut,ht)},nodeName:function(t,e){return t.nodeName&&t.nodeName.toLowerCase()===e.toLowerCase()},each:function(t,e){var n,o=0;if(r(t))for(n=t.length;n>o&&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 n=e||[];return null!=t&&(r(Object(t))?st.merge(n,"string"==typeof t?[t]:t):Z.call(n,t)),n},inArray:function(t,e,n){return null==e?-1:tt.call(e,t,n)},merge:function(t,e){for(var n=+e.length,r=0,o=t.length;n>r;r++)t[o++]=e[r];return t.length=o,t},grep:function(t,e,n){for(var r,o=[],i=0,s=t.length,a=!n;s>i;i++)r=!e(t[i],i),r!==a&&o.push(t[i]);return o},map:function(t,e,n){var o,i,s=0,a=[];if(r(t))for(o=t.length;o>s;s++)i=e(t[s],s,n),null!=i&&a.push(i);else for(s in t)i=e(t[s],s,n),null!=i&&a.push(i);return K.apply([],a)},guid:1,proxy:function(t,e){var n,r,o;return"string"==typeof e&&(n=t[e],e=t,t=n),st.isFunction(t)?(r=Q.call(arguments,2),o=function(){return t.apply(e||this,r.concat(Q.call(arguments)))},o.guid=t.guid=t.guid||st.guid++,o):void 0},now:Date.now,support:ot}),"function"==typeof Symbol&&(st.fn[Symbol.iterator]=X[Symbol.iterator]),st.each("Boolean Number String Function Array Date RegExp Object Error Symbol".split(" "),function(t,e){et["[object "+e+"]"]=e.toLowerCase()});var ct=/*!
|
|
* 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,n,r){var o,i,s,a,l,u,c,_,d=e&&e.ownerDocument,f=e?e.nodeType:9;if(n=n||[],"string"!=typeof t||!t||1!==f&&9!==f&&11!==f)return n;if(!r&&((e?e.ownerDocument||e:B)!==A&&C(e),e=e||A,N)){if(11!==f&&(u=gt.exec(t)))if(o=u[1]){if(9===f){if(!(s=e.getElementById(o)))return n;if(s.id===o)return n.push(s),n}else if(d&&(s=d.getElementById(o))&&I(e,s)&&s.id===o)return n.push(s),n}else{if(u[2])return K.apply(n,e.getElementsByTagName(t)),n;if((o=u[3])&&x.getElementsByClassName&&e.getElementsByClassName)return K.apply(n,e.getElementsByClassName(o)),n}if(x.qsa&&!V[t+" "]&&(!q||!q.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),c=j(t),i=c.length,l=pt.test(a)?"#"+a:"[id='"+a+"']";i--;)c[i]=l+" "+p(c[i]);_=c.join(","),d=yt.test(t)&&h(e.parentNode)||e}if(_)try{return K.apply(n,d.querySelectorAll(_)),n}catch(m){}finally{a===R&&e.removeAttribute("id")}}}return z(t.replace(at,"$1"),e,n,r)}function n(){function t(n,r){return e.push(n+" ")>w.cacheLength&&delete t[e.shift()],t[n+" "]=r}var e=[];return t}function r(t){return t[R]=!0,t}function o(t){var e=A.createElement("div");try{return!!t(e)}catch(n){return!1}finally{e.parentNode&&e.parentNode.removeChild(e),e=null}}function i(t,e){for(var n=t.split("|"),r=n.length;r--;)w.attrHandle[n[r]]=e}function s(t,e){var n=e&&t,r=n&&1===t.nodeType&&1===e.nodeType&&(~e.sourceIndex||Y)-(~t.sourceIndex||Y);if(r)return r;if(n)for(;n=n.nextSibling;)if(n===e)return-1;return t?1:-1}function a(t){return function(e){var n=e.nodeName.toLowerCase();return"input"===n&&e.type===t}}function l(t){return function(e){var n=e.nodeName.toLowerCase();return("input"===n||"button"===n)&&e.type===t}}function u(t){return r(function(e){return e=+e,r(function(n,r){for(var o,i=t([],n.length,e),s=i.length;s--;)n[o=i[s]]&&(n[o]=!(r[o]=n[o]))})})}function h(t){return t&&"undefined"!=typeof t.getElementsByTagName&&t}function c(){}function p(t){for(var e=0,n=t.length,r="";n>e;e++)r+=t[e].value;return r}function _(t,e,n){var r=e.dir,o=n&&"parentNode"===r,i=G++;return e.first?function(e,n,i){for(;e=e[r];)if(1===e.nodeType||o)return t(e,n,i)}:function(e,n,s){var a,l,u,h=[L,i];if(s){for(;e=e[r];)if((1===e.nodeType||o)&&t(e,n,s))return!0}else for(;e=e[r];)if(1===e.nodeType||o){if(u=e[R]||(e[R]={}),l=u[e.uniqueID]||(u[e.uniqueID]={}),(a=l[r])&&a[0]===L&&a[1]===i)return h[2]=a[2];if(l[r]=h,h[2]=t(e,n,s))return!0}}}function d(t){return t.length>1?function(e,n,r){for(var o=t.length;o--;)if(!t[o](e,n,r))return!1;return!0}:t[0]}function f(t,n,r){for(var o=0,i=n.length;i>o;o++)e(t,n[o],r);return r}function m(t,e,n,r,o){for(var i,s=[],a=0,l=t.length,u=null!=e;l>a;a++)(i=t[a])&&(!n||n(i,r,o))&&(s.push(i),u&&e.push(a));return s}function g(t,e,n,o,i,s){return o&&!o[R]&&(o=g(o)),i&&!i[R]&&(i=g(i,s)),r(function(r,s,a,l){var u,h,c,p=[],_=[],d=s.length,g=r||f(e||"*",a.nodeType?[a]:a,[]),y=!t||!r&&e?g:m(g,p,t,a,l),v=n?i||(r?t:d||o)?[]:s:y;if(n&&n(y,v,a,l),o)for(u=m(v,_),o(u,[],a,l),h=u.length;h--;)(c=u[h])&&(v[_[h]]=!(y[_[h]]=c));if(r){if(i||t){if(i){for(u=[],h=v.length;h--;)(c=v[h])&&u.push(y[h]=c);i(null,v=[],u,l)}for(h=v.length;h--;)(c=v[h])&&(u=i?tt(r,c):p[h])>-1&&(r[u]=!(s[u]=c))}}else v=m(v===s?v.splice(d,v.length):v),i?i(null,s,v,l):K.apply(s,v)})}function y(t){for(var e,n,r,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),h=[function(t,n,r){var o=!i&&(r||n!==E)||((e=n).nodeType?l(t,n,r):u(t,n,r));return e=null,o}];o>a;a++)if(n=w.relative[t[a].type])h=[_(d(h),n)];else{if(n=w.filter[t[a].type].apply(null,t[a].matches),n[R]){for(r=++a;o>r&&!w.relative[t[r].type];r++);return g(a>1&&d(h),a>1&&p(t.slice(0,a-1).concat({value:" "===t[a-2].type?"*":""})).replace(at,"$1"),n,r>a&&y(t.slice(a,r)),o>r&&y(t=t.slice(r)),o>r&&p(t))}h.push(n)}return d(h)}function v(t,n){var o=n.length>0,i=t.length>0,s=function(r,s,a,l,u){var h,c,p,_=0,d="0",f=r&&[],g=[],y=E,v=r||i&&w.find.TAG("*",u),b=L+=null==y?1:Math.random()||.1,x=v.length;for(u&&(E=s===A||s||u);d!==x&&null!=(h=v[d]);d++){if(i&&h){for(c=0,s||h.ownerDocument===A||(C(h),a=!N);p=t[c++];)if(p(h,s||A,a)){l.push(h);break}u&&(L=b)}o&&((h=!p&&h)&&_--,r&&f.push(h))}if(_+=d,o&&d!==_){for(c=0;p=n[c++];)p(f,g,s,a);if(r){if(_>0)for(;d--;)f[d]||g[d]||(g[d]=J.call(l));g=m(g)}K.apply(l,g),u&&!r&&g.length>0&&_+n.length>1&&e.uniqueSort(l)}return u&&(L=b,E=y),f};return o?r(s):s}var b,x,w,k,M,j,T,z,E,P,S,C,A,O,N,q,F,D,I,R="sizzle"+1*new Date,B=t.document,L=0,G=0,U=n(),$=n(),V=n(),H=function(t,e){return t===e&&(S=!0),0},Y=1<<31,W={}.hasOwnProperty,X=[],J=X.pop,Q=X.push,K=X.push,Z=X.slice,tt=function(t,e){for(var n=0,r=t.length;r>n;n++)if(t[n]===e)return n;return-1},et="checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",nt="[\\x20\\t\\r\\n\\f]",rt="(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",ot="\\["+nt+"*("+rt+")(?:"+nt+"*([*^$|!~]?=)"+nt+"*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|("+rt+"))|)"+nt+"*\\]",it=":("+rt+")(?:\\((('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|((?:\\\\.|[^\\\\()[\\]]|"+ot+")*)|.*)\\)|)",st=new RegExp(nt+"+","g"),at=new RegExp("^"+nt+"+|((?:^|[^\\\\])(?:\\\\.)*)"+nt+"+$","g"),lt=new RegExp("^"+nt+"*,"+nt+"*"),ut=new RegExp("^"+nt+"*([>+~]|"+nt+")"+nt+"*"),ht=new RegExp("="+nt+"*([^\\]'\"]*?)"+nt+"*\\]","g"),ct=new RegExp(it),pt=new RegExp("^"+rt+"$"),_t={ID:new RegExp("^#("+rt+")"),CLASS:new RegExp("^\\.("+rt+")"),TAG:new RegExp("^("+rt+"|[*])"),ATTR:new RegExp("^"+ot),PSEUDO:new RegExp("^"+it),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+nt+"*(even|odd|(([+-]|)(\\d*)n|)"+nt+"*(?:([+-]|)"+nt+"*(\\d+)|))"+nt+"*\\)|)","i"),bool:new RegExp("^(?:"+et+")$","i"),needsContext:new RegExp("^"+nt+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+nt+"*((?:-\\d)?\\d*)"+nt+"*\\)|)(?=[^-]|$)","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}"+nt+"?|("+nt+")|.)","ig"),xt=function(t,e,n){var r="0x"+e-65536;return r!==r||n?e:0>r?String.fromCharCode(r+65536):String.fromCharCode(r>>10|55296,1023&r|56320)},wt=function(){C()};try{K.apply(X=Z.call(B.childNodes),B.childNodes),X[B.childNodes.length].nodeType}catch(kt){K={apply:X.length?function(t,e){Q.apply(t,Z.call(e))}:function(t,e){for(var n=t.length,r=0;t[n++]=e[r++];);t.length=n-1}}}x=e.support={},M=e.isXML=function(t){var e=t&&(t.ownerDocument||t).documentElement;return e?"HTML"!==e.nodeName:!1},C=e.setDocument=function(t){var e,n,r=t?t.ownerDocument||t:B;return r!==A&&9===r.nodeType&&r.documentElement?(A=r,O=A.documentElement,N=!M(A),(n=A.defaultView)&&n.top!==n&&(n.addEventListener?n.addEventListener("unload",wt,!1):n.attachEvent&&n.attachEvent("onunload",wt)),x.attributes=o(function(t){return t.className="i",!t.getAttribute("className")}),x.getElementsByTagName=o(function(t){return t.appendChild(A.createComment("")),!t.getElementsByTagName("*").length}),x.getElementsByClassName=mt.test(A.getElementsByClassName),x.getById=o(function(t){return O.appendChild(t).id=R,!A.getElementsByName||!A.getElementsByName(R).length}),x.getById?(w.find.ID=function(t,e){if("undefined"!=typeof e.getElementById&&N){var n=e.getElementById(t);return n?[n]:[]}},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 n="undefined"!=typeof t.getAttributeNode&&t.getAttributeNode("id");return n&&n.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 n,r=[],o=0,i=e.getElementsByTagName(t);if("*"===t){for(;n=i[o++];)1===n.nodeType&&r.push(n);return r}return i},w.find.CLASS=x.getElementsByClassName&&function(t,e){return"undefined"!=typeof e.getElementsByClassName&&N?e.getElementsByClassName(t):void 0},F=[],q=[],(x.qsa=mt.test(A.querySelectorAll))&&(o(function(t){O.appendChild(t).innerHTML="<a id='"+R+"'></a><select id='"+R+"-\r\\' msallowcapture=''><option selected=''></option></select>",t.querySelectorAll("[msallowcapture^='']").length&&q.push("[*^$]="+nt+"*(?:''|\"\")"),t.querySelectorAll("[selected]").length||q.push("\\["+nt+"*(?:value|"+et+")"),t.querySelectorAll("[id~="+R+"-]").length||q.push("~="),t.querySelectorAll(":checked").length||q.push(":checked"),t.querySelectorAll("a#"+R+"+*").length||q.push(".#.+[+~]")}),o(function(t){var e=A.createElement("input");e.setAttribute("type","hidden"),t.appendChild(e).setAttribute("name","D"),t.querySelectorAll("[name=d]").length&&q.push("name"+nt+"*[*^$|!~]?="),t.querySelectorAll(":enabled").length||q.push(":enabled",":disabled"),t.querySelectorAll("*,:x"),q.push(",.*:")})),(x.matchesSelector=mt.test(D=O.matches||O.webkitMatchesSelector||O.mozMatchesSelector||O.oMatchesSelector||O.msMatchesSelector))&&o(function(t){x.disconnectedMatch=D.call(t,"div"),D.call(t,"[s!='']:x"),F.push("!=",it)}),q=q.length&&new RegExp(q.join("|")),F=F.length&&new RegExp(F.join("|")),e=mt.test(O.compareDocumentPosition),I=e||mt.test(O.contains)?function(t,e){var n=9===t.nodeType?t.documentElement:t,r=e&&e.parentNode;return t===r||!(!r||1!==r.nodeType||!(n.contains?n.contains(r):t.compareDocumentPosition&&16&t.compareDocumentPosition(r)))}: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 S=!0,0;var n=!t.compareDocumentPosition-!e.compareDocumentPosition;return n?n:(n=(t.ownerDocument||t)===(e.ownerDocument||e)?t.compareDocumentPosition(e):1,1&n||!x.sortDetached&&e.compareDocumentPosition(t)===n?t===A||t.ownerDocument===B&&I(B,t)?-1:e===A||e.ownerDocument===B&&I(B,e)?1:P?tt(P,t)-tt(P,e):0:4&n?-1:1)}:function(t,e){if(t===e)return S=!0,0;var n,r=0,o=t.parentNode,i=e.parentNode,a=[t],l=[e];if(!o||!i)return t===A?-1:e===A?1:o?-1:i?1:P?tt(P,t)-tt(P,e):0;if(o===i)return s(t,e);for(n=t;n=n.parentNode;)a.unshift(n);for(n=e;n=n.parentNode;)l.unshift(n);for(;a[r]===l[r];)r++;return r?s(a[r],l[r]):a[r]===B?-1:l[r]===B?1:0},A):A},e.matches=function(t,n){return e(t,null,null,n)},e.matchesSelector=function(t,n){if((t.ownerDocument||t)!==A&&C(t),n=n.replace(ht,"='$1']"),x.matchesSelector&&N&&!V[n+" "]&&(!F||!F.test(n))&&(!q||!q.test(n)))try{var r=D.call(t,n);if(r||x.disconnectedMatch||t.document&&11!==t.document.nodeType)return r}catch(o){}return e(n,A,null,[t]).length>0},e.contains=function(t,e){return(t.ownerDocument||t)!==A&&C(t),I(t,e)},e.attr=function(t,e){(t.ownerDocument||t)!==A&&C(t);var n=w.attrHandle[e.toLowerCase()],r=n&&W.call(w.attrHandle,e.toLowerCase())?n(t,e,!N):void 0;return void 0!==r?r:x.attributes||!N?t.getAttribute(e):(r=t.getAttributeNode(e))&&r.specified?r.value:null},e.error=function(t){throw new Error("Syntax error, unrecognized expression: "+t)},e.uniqueSort=function(t){var e,n=[],r=0,o=0;if(S=!x.detectDuplicates,P=!x.sortStable&&t.slice(0),t.sort(H),S){for(;e=t[o++];)e===t[o]&&(r=n.push(o));for(;r--;)t.splice(n[r],1)}return P=null,t},k=e.getText=function(t){var e,n="",r=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)n+=k(t)}else if(3===o||4===o)return t.nodeValue}else for(;e=t[r++];)n+=k(e);return n},w=e.selectors={cacheLength:50,createPseudo:r,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,n=!t[6]&&t[2];return _t.CHILD.test(t[0])?null:(t[3]?t[2]=t[4]||t[5]||"":n&&ct.test(n)&&(e=j(n,!0))&&(e=n.indexOf(")",n.length-e)-n.length)&&(t[0]=t[0].slice(0,e),t[2]=n.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=U[t+" "];return e||(e=new RegExp("(^|"+nt+")"+t+"("+nt+"|$)"))&&U(t,function(t){return e.test("string"==typeof t.className&&t.className||"undefined"!=typeof t.getAttribute&&t.getAttribute("class")||"")})},ATTR:function(t,n,r){return function(o){var i=e.attr(o,t);return null==i?"!="===n:n?(i+="","="===n?i===r:"!="===n?i!==r:"^="===n?r&&0===i.indexOf(r):"*="===n?r&&i.indexOf(r)>-1:"$="===n?r&&i.slice(-r.length)===r:"~="===n?(" "+i.replace(st," ")+" ").indexOf(r)>-1:"|="===n?i===r||i.slice(0,r.length+1)===r+"-":!1):!0}},CHILD:function(t,e,n,r,o){var i="nth"!==t.slice(0,3),s="last"!==t.slice(-4),a="of-type"===e;return 1===r&&0===o?function(t){return!!t.parentNode}:function(e,n,l){var u,h,c,p,_,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(p=e;p=p[f];)if(a?p.nodeName.toLowerCase()===g:1===p.nodeType)return!1;d=f="only"===t&&!d&&"nextSibling"}return!0}if(d=[s?m.firstChild:m.lastChild],s&&y){for(p=m,c=p[R]||(p[R]={}),h=c[p.uniqueID]||(c[p.uniqueID]={}),u=h[t]||[],_=u[0]===L&&u[1],v=_&&u[2],p=_&&m.childNodes[_];p=++_&&p&&p[f]||(v=_=0)||d.pop();)if(1===p.nodeType&&++v&&p===e){h[t]=[L,_,v];break}}else if(y&&(p=e,c=p[R]||(p[R]={}),h=c[p.uniqueID]||(c[p.uniqueID]={}),u=h[t]||[],_=u[0]===L&&u[1],v=_),v===!1)for(;(p=++_&&p&&p[f]||(v=_=0)||d.pop())&&((a?p.nodeName.toLowerCase()!==g:1!==p.nodeType)||!++v||(y&&(c=p[R]||(p[R]={}),h=c[p.uniqueID]||(c[p.uniqueID]={}),h[t]=[L,v]),p!==e)););return v-=o,v===r||v%r===0&&v/r>=0}}},PSEUDO:function(t,n){var o,i=w.pseudos[t]||w.setFilters[t.toLowerCase()]||e.error("unsupported pseudo: "+t);return i[R]?i(n):i.length>1?(o=[t,t,"",n],w.setFilters.hasOwnProperty(t.toLowerCase())?r(function(t,e){for(var r,o=i(t,n),s=o.length;s--;)r=tt(t,o[s]),t[r]=!(e[r]=o[s])}):function(t){return i(t,0,o)}):i}},pseudos:{not:r(function(t){var e=[],n=[],o=T(t.replace(at,"$1"));return o[R]?r(function(t,e,n,r){for(var i,s=o(t,null,r,[]),a=t.length;a--;)(i=s[a])&&(t[a]=!(e[a]=i))}):function(t,r,i){return e[0]=t,o(e,null,i,n),e[0]=null,!n.pop()}}),has:r(function(t){return function(n){return e(t,n).length>0}}),contains:r(function(t){return t=t.replace(bt,xt),function(e){return(e.textContent||e.innerText||k(e)).indexOf(t)>-1}}),lang:r(function(t){return pt.test(t||"")||e.error("unsupported lang: "+t),t=t.replace(bt,xt).toLowerCase(),function(e){var n;do if(n=N?e.lang:e.getAttribute("xml:lang")||e.getAttribute("lang"))return n=n.toLowerCase(),n===t||0===n.indexOf(t+"-");while((e=e.parentNode)&&1===e.nodeType);return!1}}),target:function(e){var n=t.location&&t.location.hash;return n&&n.slice(1)===e.id},root:function(t){return t===O},focus:function(t){return t===A.activeElement&&(!A.hasFocus||A.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,n){return[0>n?n+e:n]}),even:u(function(t,e){for(var n=0;e>n;n+=2)t.push(n);return t}),odd:u(function(t,e){for(var n=1;e>n;n+=2)t.push(n);return t}),lt:u(function(t,e,n){for(var r=0>n?n+e:n;--r>=0;)t.push(r);return t}),gt:u(function(t,e,n){for(var r=0>n?n+e:n;++r<e;)t.push(r);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 c.prototype=w.filters=w.pseudos,w.setFilters=new c,j=e.tokenize=function(t,n){var r,o,i,s,a,l,u,h=$[t+" "];if(h)return n?0:h.slice(0);for(a=t,l=[],u=w.preFilter;a;){(!r||(o=lt.exec(a)))&&(o&&(a=a.slice(o[0].length)||a),l.push(i=[])),r=!1,(o=ut.exec(a))&&(r=o.shift(),i.push({value:r,type:o[0].replace(at," ")}),a=a.slice(r.length));for(s in w.filter)!(o=_t[s].exec(a))||u[s]&&!(o=u[s](o))||(r=o.shift(),i.push({value:r,type:s,matches:o}),a=a.slice(r.length));if(!r)break}return n?a.length:a?e.error(t):$(t,l).slice(0)},T=e.compile=function(t,e){var n,r=[],o=[],i=V[t+" "];if(!i){for(e||(e=j(t)),n=e.length;n--;)i=y(e[n]),i[R]?r.push(i):o.push(i);i=V(t,v(o,r)),i.selector=t}return i},z=e.select=function(t,e,n,r){var o,i,s,a,l,u="function"==typeof t&&t,c=!r&&j(t=u.selector||t);if(n=n||[],1===c.length){if(i=c[0]=c[0].slice(0),i.length>2&&"ID"===(s=i[0]).type&&x.getById&&9===e.nodeType&&N&&w.relative[i[1].type]){if(e=(w.find.ID(s.matches[0].replace(bt,xt),e)||[])[0],!e)return n;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])&&(r=l(s.matches[0].replace(bt,xt),yt.test(i[0].type)&&h(e.parentNode)||e))){if(i.splice(o,1),t=r.length&&p(i),!t)return K.apply(n,r),n;break}}return(u||T(t,c))(r,e,!N,n,!e||yt.test(t)&&h(e.parentNode)||e),n},x.sortStable=R.split("").sort(H).join("")===R,x.detectDuplicates=!!S,C(),x.sortDetached=o(function(t){return 1&t.compareDocumentPosition(A.createElement("div"))}),o(function(t){return t.innerHTML="<a href='#'></a>","#"===t.firstChild.getAttribute("href")})||i("type|href|height|width",function(t,e,n){return n?void 0: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,n){return n||"input"!==t.nodeName.toLowerCase()?void 0:t.defaultValue}),o(function(t){return null==t.getAttribute("disabled")})||i(et,function(t,e,n){var r;return n?void 0:t[e]===!0?e.toLowerCase():(r=t.getAttributeNode(e))&&r.specified?r.value:null}),e}(e);st.find=ct,st.expr=ct.selectors,st.expr[":"]=st.expr.pseudos,st.uniqueSort=st.unique=ct.uniqueSort,st.text=ct.getText,st.isXMLDoc=ct.isXML,st.contains=ct.contains;var pt=function(t,e,n){for(var r=[],o=void 0!==n;(t=t[e])&&9!==t.nodeType;)if(1===t.nodeType){if(o&&st(t).is(n))break;r.push(t)}return r},_t=function(t,e){for(var n=[];t;t=t.nextSibling)1===t.nodeType&&t!==e&&n.push(t);return n},dt=st.expr.match.needsContext,ft=/^<([\w-]+)\s*\/?>(?:<\/\1>|)$/,mt=/^.[^:#\[\.,]*$/;st.filter=function(t,e,n){var r=e[0];return n&&(t=":not("+t+")"),1===e.length&&1===r.nodeType?st.find.matchesSelector(r,t)?[r]:[]:st.find.matches(t,st.grep(e,function(t){return 1===t.nodeType}))},st.fn.extend({find:function(t){var e,n=this.length,r=[],o=this;if("string"!=typeof t)return this.pushStack(st(t).filter(function(){for(e=0;n>e;e++)if(st.contains(o[e],this))return!0}));for(e=0;n>e;e++)st.find(t,o[e],r);return r=this.pushStack(n>1?st.unique(r):r),r.selector=this.selector?this.selector+" "+t:t,r},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,n){var r,o;if(!t)return this;if(n=n||gt,"string"==typeof t){if(r="<"===t[0]&&">"===t[t.length-1]&&t.length>=3?[null,t,null]:yt.exec(t),!r||!r[1]&&e)return!e||e.jquery?(e||n).find(t):this.constructor(e).find(t);if(r[1]){if(e=e instanceof st?e[0]:e,st.merge(this,st.parseHTML(r[1],e&&e.nodeType?e.ownerDocument||e:J,!0)),ft.test(r[1])&&st.isPlainObject(e))for(r in e)st.isFunction(this[r])?this[r](e[r]):this.attr(r,e[r]);return this}return o=J.getElementById(r[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!==n.ready?n.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),n=e.length;return this.filter(function(){for(var t=0;n>t;t++)if(st.contains(this,e[t]))return!0})},closest:function(t,e){for(var n,r=0,o=this.length,i=[],s=dt.test(t)||"string"!=typeof t?st(t,e||this.context):0;o>r;r++)for(n=this[r];n&&n!==e;n=n.parentNode)if(n.nodeType<11&&(s?s.index(n)>-1:1===n.nodeType&&st.find.matchesSelector(n,t))){i.push(n);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 pt(t,"parentNode")},parentsUntil:function(t,e,n){return pt(t,"parentNode",n)},next:function(t){return i(t,"nextSibling")},prev:function(t){return i(t,"previousSibling")},nextAll:function(t){return pt(t,"nextSibling")},prevAll:function(t){return pt(t,"previousSibling")},nextUntil:function(t,e,n){return pt(t,"nextSibling",n)},prevUntil:function(t,e,n){return pt(t,"previousSibling",n)},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(n,r){var o=st.map(this,e,n);return"Until"!==t.slice(-5)&&(r=n),r&&"string"==typeof r&&(o=st.filter(r,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,n,r,o,i=[],a=[],l=-1,u=function(){for(o=t.once,r=e=!0;a.length;l=-1)for(n=a.shift();++l<i.length;)i[l].apply(n[0],n[1])===!1&&t.stopOnFalse&&(l=i.length,n=!1);t.memory||(n=!1),e=!1,o&&(i=n?[]:"")},h={add:function(){return i&&(n&&!e&&(l=i.length-1,a.push(n)),function r(e){st.each(e,function(e,n){st.isFunction(n)?t.unique&&h.has(n)||i.push(n):n&&n.length&&"string"!==st.type(n)&&r(n)})}(arguments),n&&!e&&u()),this},remove:function(){return st.each(arguments,function(t,e){for(var n;(n=st.inArray(e,i,n))>-1;)i.splice(n,1),l>=n&&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=n="",this},disabled:function(){return!i},lock:function(){return o=a=[],n||(i=n=""),this},locked:function(){return!!o},fireWith:function(t,n){return o||(n=n||[],n=[t,n.slice?n.slice():n],a.push(n),e||u()),this},fire:function(){return h.fireWith(this,arguments),this},fired:function(){return!!r}};return h},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")]],n="pending",r={state:function(){return n},always:function(){return o.done(arguments).fail(arguments),this},then:function(){var t=arguments;return st.Deferred(function(n){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(n.notify).done(n.resolve).fail(n.reject):n[i[0]+"With"](this===r?n.promise():this,s?[t]:arguments)})}),t=null}).promise()},promise:function(t){return null!=t?st.extend(t,r):r}},o={};return r.pipe=r.then,st.each(e,function(t,i){var s=i[2],a=i[3];r[i[1]]=s.add,a&&s.add(function(){n=a},e[1^t][2].disable,e[2][2].lock),o[i[0]]=function(){return o[i[0]+"With"](this===o?r:this,arguments),this},o[i[0]+"With"]=s.fireWith}),r.promise(o),t&&t.call(o,o),o},when:function(t){var e,n,r,o=0,i=Q.call(arguments),s=i.length,a=1!==s||t&&st.isFunction(t.promise)?s:0,l=1===a?t:st.Deferred(),u=function(t,n,r){return function(o){n[t]=this,r[t]=arguments.length>1?Q.call(arguments):o,r===e?l.notifyWith(n,r):--a||l.resolveWith(n,r)}};if(s>1)for(e=new Array(s),n=new Array(s),r=new Array(s);s>o;o++)i[o]&&st.isFunction(i[o].promise)?i[o].promise().progress(u(o,n,e)).done(u(o,r,i)).fail(l.reject):--a;return a||l.resolveWith(r,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,n,r,o,i,s){var a=0,l=t.length,u=null==n;if("object"===st.type(n)){o=!0;for(a in n)Mt(t,e,a,n[a],!0,i,s)}else if(void 0!==r&&(o=!0,st.isFunction(r)||(s=!0),u&&(s?(e.call(t,r),e=null):(u=e,e=function(t,e,n){return u.call(st(t),n)})),e))for(;l>a;a++)e(t[a],n,s?r:r.call(t[a],a,e(t[a],n)));return o?t:u?e.call(t):l?e(t[0],n):i},jt=function(t){return 1===t.nodeType||9===t.nodeType||!+t.nodeType};l.uid=1,l.prototype={register:function(t,e){var n=e||{};return t.nodeType?t[this.expando]=n:Object.defineProperty(t,this.expando,{value:n,writable:!0,configurable:!0}),t[this.expando]},cache:function(t){if(!jt(t))return{};var e=t[this.expando];return e||(e={},jt(t)&&(t.nodeType?t[this.expando]=e:Object.defineProperty(t,this.expando,{value:e,configurable:!0}))),e},set:function(t,e,n){var r,o=this.cache(t);if("string"==typeof e)o[e]=n;else for(r in e)o[r]=e[r];return o},get:function(t,e){return void 0===e?this.cache(t):t[this.expando]&&t[this.expando][e]},access:function(t,e,n){var r;return void 0===e||e&&"string"==typeof e&&void 0===n?(r=this.get(t,e),void 0!==r?r:this.get(t,st.camelCase(e))):(this.set(t,e,n),void 0!==n?n:e)},remove:function(t,e){var n,r,o,i=t[this.expando];if(void 0!==i){if(void 0===e)this.register(t);else{st.isArray(e)?r=e.concat(e.map(st.camelCase)):(o=st.camelCase(e),e in i?r=[e,o]:(r=o,r=r in i?[r]:r.match(wt)||[])),n=r.length;for(;n--;)delete i[r[n]]}(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 Tt=new l,zt=new l,Et=/^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,Pt=/[A-Z]/g;st.extend({hasData:function(t){return zt.hasData(t)||Tt.hasData(t)},data:function(t,e,n){return zt.access(t,e,n)},removeData:function(t,e){zt.remove(t,e)},_data:function(t,e,n){return Tt.access(t,e,n)},_removeData:function(t,e){Tt.remove(t,e)}}),st.fn.extend({data:function(t,e){var n,r,o,i=this[0],s=i&&i.attributes;if(void 0===t){if(this.length&&(o=zt.get(i),1===i.nodeType&&!Tt.get(i,"hasDataAttrs"))){for(n=s.length;n--;)s[n]&&(r=s[n].name,0===r.indexOf("data-")&&(r=st.camelCase(r.slice(5)),u(i,r,o[r])));Tt.set(i,"hasDataAttrs",!0)}return o}return"object"==typeof t?this.each(function(){zt.set(this,t)}):Mt(this,function(e){var n,r;if(i&&void 0===e){if(n=zt.get(i,t)||zt.get(i,t.replace(Pt,"-$&").toLowerCase()),void 0!==n)return n;if(r=st.camelCase(t),n=zt.get(i,r),void 0!==n)return n;if(n=u(i,r,void 0),void 0!==n)return n}else r=st.camelCase(t),this.each(function(){var n=zt.get(this,r);zt.set(this,r,e),t.indexOf("-")>-1&&void 0!==n&&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,n){var r;return t?(e=(e||"fx")+"queue",r=Tt.get(t,e),n&&(!r||st.isArray(n)?r=Tt.access(t,e,st.makeArray(n)):r.push(n)),r||[]):void 0},dequeue:function(t,e){e=e||"fx";var n=st.queue(t,e),r=n.length,o=n.shift(),i=st._queueHooks(t,e),s=function(){st.dequeue(t,e)};"inprogress"===o&&(o=n.shift(),r--),o&&("fx"===e&&n.unshift("inprogress"),delete i.stop,o.call(t,s,i)),!r&&i&&i.empty.fire()},_queueHooks:function(t,e){var n=e+"queueHooks";return Tt.get(t,n)||Tt.access(t,n,{empty:st.Callbacks("once memory").add(function(){Tt.remove(t,[e+"queue",n])})})}}),st.fn.extend({queue:function(t,e){var n=2;return"string"!=typeof t&&(e=t,t="fx",n--),arguments.length<n?st.queue(this[0],t):void 0===e?this:this.each(function(){var n=st.queue(this,t,e);st._queueHooks(this,t),"fx"===t&&"inprogress"!==n[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 n,r=1,o=st.Deferred(),i=this,s=this.length,a=function(){--r||o.resolveWith(i,[i])};for("string"!=typeof t&&(e=t,t=void 0),t=t||"fx";s--;)n=Tt.get(i[s],t+"queueHooks"),n&&n.empty&&(r++,n.empty.add(a));return a(),o.promise(e)}});var St=/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source,Ct=new RegExp("^(?:([+-])=|)("+St+")([a-z%]*)$","i"),At=["Top","Right","Bottom","Left"],Ot=function(t,e){return t=e||t,"none"===st.css(t,"display")||!st.contains(t.ownerDocument,t)},Nt=/^(?:checkbox|radio)$/i,qt=/<([\w:-]+)/,Ft=/^$|\/(?:java|ecma)script/i,Dt={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,"",""]};Dt.optgroup=Dt.option,Dt.tbody=Dt.tfoot=Dt.colgroup=Dt.caption=Dt.thead,Dt.th=Dt.td;var It=/<|&#?\w+;/;!function(){var t=J.createDocumentFragment(),e=t.appendChild(J.createElement("div")),n=J.createElement("input");n.setAttribute("type","radio"),n.setAttribute("checked","checked"),n.setAttribute("name","t"),e.appendChild(n),ot.checkClone=e.cloneNode(!0).cloneNode(!0).lastChild.checked,e.innerHTML="<textarea>x</textarea>",ot.noCloneChecked=!!e.cloneNode(!0).lastChild.defaultValue}();var Rt=/^key/,Bt=/^(?:mouse|pointer|contextmenu|drag|drop)|click/,Lt=/^([^.]*)(?:\.(.+)|)/;st.event={global:{},add:function(t,e,n,r,o){var i,s,a,l,u,h,c,p,_,d,f,m=Tt.get(t);if(m)for(n.handler&&(i=n,n=i.handler,o=i.selector),n.guid||(n.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=Lt.exec(e[u])||[],_=f=a[1],d=(a[2]||"").split(".").sort(),_&&(c=st.event.special[_]||{},_=(o?c.delegateType:c.bindType)||_,c=st.event.special[_]||{},h=st.extend({type:_,origType:f,data:r,handler:n,guid:n.guid,selector:o,needsContext:o&&st.expr.match.needsContext.test(o),namespace:d.join(".")},i),(p=l[_])||(p=l[_]=[],p.delegateCount=0,c.setup&&c.setup.call(t,r,d,s)!==!1||t.addEventListener&&t.addEventListener(_,s)),c.add&&(c.add.call(t,h),h.handler.guid||(h.handler.guid=n.guid)),o?p.splice(p.delegateCount++,0,h):p.push(h),st.event.global[_]=!0)},remove:function(t,e,n,r,o){var i,s,a,l,u,h,c,p,_,d,f,m=Tt.hasData(t)&&Tt.get(t);if(m&&(l=m.events)){for(e=(e||"").match(wt)||[""],u=e.length;u--;)if(a=Lt.exec(e[u])||[],_=f=a[1],d=(a[2]||"").split(".").sort(),_){for(c=st.event.special[_]||{},_=(r?c.delegateType:c.bindType)||_,p=l[_]||[],a=a[2]&&new RegExp("(^|\\.)"+d.join("\\.(?:.*\\.|)")+"(\\.|$)"),s=i=p.length;i--;)h=p[i],!o&&f!==h.origType||n&&n.guid!==h.guid||a&&!a.test(h.namespace)||r&&r!==h.selector&&("**"!==r||!h.selector)||(p.splice(i,1),
|
|
h.selector&&p.delegateCount--,c.remove&&c.remove.call(t,h));s&&!p.length&&(c.teardown&&c.teardown.call(t,d,m.handle)!==!1||st.removeEvent(t,_,m.handle),delete l[_])}else for(_ in l)st.event.remove(t,_+e[u],n,r,!0);st.isEmptyObject(l)&&Tt.remove(t,"handle events")}},dispatch:function(t){t=st.event.fix(t);var e,n,r,o,i,s=[],a=Q.call(arguments),l=(Tt.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,n=0;(i=o.handlers[n++])&&!t.isImmediatePropagationStopped();)(!t.rnamespace||t.rnamespace.test(i.namespace))&&(t.handleObj=i,t.data=i.data,r=((st.event.special[i.origType]||{}).handle||i.handler).apply(o.elem,a),void 0!==r&&(t.result=r)===!1&&(t.preventDefault(),t.stopPropagation()));return u.postDispatch&&u.postDispatch.call(this,t),t.result}},handlers:function(t,e){var n,r,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(r=[],n=0;a>n;n++)i=e[n],o=i.selector+" ",void 0===r[o]&&(r[o]=i.needsContext?st(o,this).index(l)>-1:st.find(o,this,null,[l]).length),r[o]&&r.push(i);r.length&&s.push({elem:l,handlers:r})}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 n,r,o,i=e.button;return null==t.pageX&&null!=e.clientX&&(n=t.target.ownerDocument||J,r=n.documentElement,o=n.body,t.pageX=e.clientX+(r&&r.scrollLeft||o&&o.scrollLeft||0)-(r&&r.clientLeft||o&&o.clientLeft||0),t.pageY=e.clientY+(r&&r.scrollTop||o&&o.scrollTop||0)-(r&&r.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,n,r,o=t.type,i=t,s=this.fixHooks[o];for(s||(this.fixHooks[o]=s=Bt.test(o)?this.mouseHooks:Rt.test(o)?this.keyHooks:{}),r=s.props?this.props.concat(s.props):this.props,t=new st.Event(i),e=r.length;e--;)n=r[e],t[n]=i[n];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(){return this!==m()&&this.focus?(this.focus(),!1):void 0},delegateType:"focusin"},blur:{trigger:function(){return this===m()&&this.blur?(this.blur(),!1):void 0},delegateType:"focusout"},click:{trigger:function(){return"checkbox"===this.type&&this.click&&st.nodeName(this,"input")?(this.click(),!1):void 0},_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,n){t.removeEventListener&&t.removeEventListener(e,n)},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,preventDefault:function(){var t=this.originalEvent;this.isDefaultPrevented=d,t&&t.preventDefault()},stopPropagation:function(){var t=this.originalEvent;this.isPropagationStopped=d,t&&t.stopPropagation()},stopImmediatePropagation:function(){var t=this.originalEvent;this.isImmediatePropagationStopped=d,t&&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 n,r=this,o=t.relatedTarget,i=t.handleObj;return(!o||o!==r&&!st.contains(r,o))&&(t.type=i.origType,n=i.handler.apply(this,arguments),t.type=e),n}}}),st.fn.extend({on:function(t,e,n,r){return g(this,t,e,n,r)},one:function(t,e,n,r){return g(this,t,e,n,r,1)},off:function(t,e,n){var r,o;if(t&&t.preventDefault&&t.handleObj)return r=t.handleObj,st(t.delegateTarget).off(r.namespace?r.origType+"."+r.namespace:r.origType,r.selector,r.handler),this;if("object"==typeof t){for(o in t)this.off(o,e,t[o]);return this}return(e===!1||"function"==typeof e)&&(n=e,e=void 0),n===!1&&(n=f),this.each(function(){st.event.remove(this,t,n,e)})}});var Gt=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:-]+)[^>]*)\/>/gi,Ut=/<script|<style|<link/i,$t=/checked\s*(?:[^=]|=\s*.checked.)/i,Vt=/^true\/(.*)/,Ht=/^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g;st.extend({htmlPrefilter:function(t){return t.replace(Gt,"<$1></$2>")},clone:function(t,e,n){var r,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=c(a),i=c(t),r=0,o=i.length;o>r;r++)w(i[r],s[r]);if(e)if(n)for(i=i||c(t),s=s||c(a),r=0,o=i.length;o>r;r++)x(i[r],s[r]);else x(t,a);return s=c(a,"script"),s.length>0&&p(s,!l&&c(t,"script")),a},cleanData:function(t){for(var e,n,r,o=st.event.special,i=0;void 0!==(n=t[i]);i++)if(jt(n)){if(e=n[Tt.expando]){if(e.events)for(r in e.events)o[r]?st.event.remove(n,r):st.removeEvent(n,r,e.handle);n[Tt.expando]=void 0}n[zt.expando]&&(n[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(c(t,!1)),t.textContent="");return this},clone:function(t,e){return t=null==t?!1: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]||{},n=0,r=this.length;if(void 0===t&&1===e.nodeType)return e.innerHTML;if("string"==typeof t&&!Ut.test(t)&&!Dt[(qt.exec(t)||["",""])[1].toLowerCase()]){t=st.htmlPrefilter(t);try{for(;r>n;n++)e=this[n]||{},1===e.nodeType&&(st.cleanData(c(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 n=this.parentNode;st.inArray(this,t)<0&&(st.cleanData(c(this)),n&&n.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 n,r=[],o=st(t),i=o.length-1,s=0;i>=s;s++)n=s===i?this:this.clone(!0),st(o[s])[e](n),Z.apply(r,n.get());return this.pushStack(r)}});var Yt,Wt={HTML:"block",BODY:"block"},Xt=/^margin/,Jt=new RegExp("^("+St+")(?!px)[a-z%]+$","i"),Qt=function(t){var n=t.ownerDocument.defaultView;return n.opener||(n=e),n.getComputedStyle(t)},Kt=function(t,e,n,r){var o,i,s={};for(i in e)s[i]=t.style[i],t.style[i]=e[i];o=n.apply(t,r||[]);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);n="1%"!==t.top,i="2px"===t.marginLeft,r="4px"===t.width,a.style.marginRight="50%",o="4px"===t.marginRight,Zt.removeChild(s)}var n,r,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(),n},boxSizingReliable:function(){return null==r&&t(),r},pixelMarginRight:function(){return null==r&&t(),o},reliableMarginLeft:function(){return null==r&&t(),i},reliableMarginRight:function(){var t,n=a.appendChild(J.createElement("div"));return n.style.cssText=a.style.cssText="-webkit-box-sizing:content-box;box-sizing:content-box;display:block;margin:0;border:0;padding:0",n.style.marginRight=n.style.width="0",a.style.width="1px",Zt.appendChild(s),t=!parseFloat(e.getComputedStyle(n).marginRight),Zt.removeChild(s),a.removeChild(n),t}}))}();var te=/^(none|table(?!-c[ea]).+)/,ee={position:"absolute",visibility:"hidden",display:"block"},ne={letterSpacing:"0",fontWeight:"400"},re=["Webkit","O","Moz","ms"],oe=J.createElement("div").style;st.extend({cssHooks:{opacity:{get:function(t,e){if(e){var n=z(t,"opacity");return""===n?"1":n}}}},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,n,r){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]=P(a)||a),s=st.cssHooks[e]||st.cssHooks[a],void 0===n?s&&"get"in s&&void 0!==(o=s.get(t,!1,r))?o:l[e]:(i=typeof n,"string"===i&&(o=Ct.exec(n))&&o[1]&&(n=h(t,e,o),i="number"),null!=n&&n===n&&("number"===i&&(n+=o&&o[3]||(st.cssNumber[a]?"":"px")),ot.clearCloneStyle||""!==n||0!==e.indexOf("background")||(l[e]="inherit"),s&&"set"in s&&void 0===(n=s.set(t,n,r))||(l[e]=n)),void 0)}},css:function(t,e,n,r){var o,i,s,a=st.camelCase(e);return e=st.cssProps[a]||(st.cssProps[a]=P(a)||a),s=st.cssHooks[e]||st.cssHooks[a],s&&"get"in s&&(o=s.get(t,!0,n)),void 0===o&&(o=z(t,e,r)),"normal"===o&&e in ne&&(o=ne[e]),""===n||n?(i=parseFloat(o),n===!0||isFinite(i)?i||0:o):o}}),st.each(["height","width"],function(t,e){st.cssHooks[e]={get:function(t,n,r){return n?te.test(st.css(t,"display"))&&0===t.offsetWidth?Kt(t,ee,function(){return A(t,e,r)}):A(t,e,r):void 0},set:function(t,n,r){var o,i=r&&Qt(t),s=r&&C(t,e,r,"border-box"===st.css(t,"boxSizing",!1,i),i);return s&&(o=Ct.exec(n))&&"px"!==(o[3]||"px")&&(t.style[e]=n,n=st.css(t,e)),S(t,n,s)}}}),st.cssHooks.marginLeft=E(ot.reliableMarginLeft,function(t,e){return e?(parseFloat(z(t,"marginLeft"))||t.getBoundingClientRect().left-Kt(t,{marginLeft:0},function(){return t.getBoundingClientRect().left}))+"px":void 0}),st.cssHooks.marginRight=E(ot.reliableMarginRight,function(t,e){return e?Kt(t,{display:"inline-block"},z,[t,"marginRight"]):void 0}),st.each({margin:"",padding:"",border:"Width"},function(t,e){st.cssHooks[t+e]={expand:function(n){for(var r=0,o={},i="string"==typeof n?n.split(" "):[n];4>r;r++)o[t+At[r]+e]=i[r]||i[r-2]||i[0];return o}},Xt.test(t)||(st.cssHooks[t+e].set=S)}),st.fn.extend({css:function(t,e){return Mt(this,function(t,e,n){var r,o,i={},s=0;if(st.isArray(e)){for(r=Qt(t),o=e.length;o>s;s++)i[e[s]]=st.css(t,e[s],!1,r);return i}return void 0!==n?st.style(t,e,n):st.css(t,e)},t,e,arguments.length>1)},show:function(){return O(this,!0)},hide:function(){return O(this)},toggle:function(t){return"boolean"==typeof t?t?this.show():this.hide():this.each(function(){Ot(this)?st(this).show():st(this).hide()})}}),st.Tween=N,N.prototype={constructor:N,init:function(t,e,n,r,o,i){this.elem=t,this.prop=n,this.easing=o||st.easing._default,this.options=e,this.start=this.now=this.cur(),this.end=r,this.unit=i||(st.cssNumber[n]?"":"px")},cur:function(){var t=N.propHooks[this.prop];return t&&t.get?t.get(this):N.propHooks._default.get(this)},run:function(t){var e,n=N.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),n&&n.set?n.set(this):N.propHooks._default.set(this),this}},N.prototype.init.prototype=N.prototype,N.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)}}},N.propHooks.scrollTop=N.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=N.prototype.init,st.fx.step={};var ie,se,ae=/^(?:toggle|show|hide)$/,le=/queueHooks$/;st.Animation=st.extend(B,{tweeners:{"*":[function(t,e){var n=this.createTween(t,e);return h(n.elem,t,Ct.exec(e),n),n}]},tweener:function(t,e){st.isFunction(t)?(e=t,t=["*"]):t=t.match(wt);for(var n,r=0,o=t.length;o>r;r++)n=t[r],B.tweeners[n]=B.tweeners[n]||[],B.tweeners[n].unshift(e)},prefilters:[I],prefilter:function(t,e){e?B.prefilters.unshift(t):B.prefilters.push(t)}}),st.speed=function(t,e,n){var r=t&&"object"==typeof t?st.extend({},t):{complete:n||!n&&e||st.isFunction(t)&&t,duration:t,easing:n&&e||e&&!st.isFunction(e)&&e};return r.duration=st.fx.off?0:"number"==typeof r.duration?r.duration:r.duration in st.fx.speeds?st.fx.speeds[r.duration]:st.fx.speeds._default,(null==r.queue||r.queue===!0)&&(r.queue="fx"),r.old=r.complete,r.complete=function(){st.isFunction(r.old)&&r.old.call(this),r.queue&&st.dequeue(this,r.queue)},r},st.fn.extend({fadeTo:function(t,e,n,r){return this.filter(Ot).css("opacity",0).show().end().animate({opacity:e},t,n,r)},animate:function(t,e,n,r){var o=st.isEmptyObject(t),i=st.speed(e,n,r),s=function(){var e=B(this,st.extend({},t),i);(o||Tt.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,n){var r=function(t){var e=t.stop;delete t.stop,e(n)};return"string"!=typeof t&&(n=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=Tt.get(this);if(o)s[o]&&s[o].stop&&r(s[o]);else for(o in s)s[o]&&s[o].stop&&le.test(o)&&r(s[o]);for(o=i.length;o--;)i[o].elem!==this||null!=t&&i[o].queue!==t||(i[o].anim.stop(n),e=!1,i.splice(o,1));(e||!n)&&st.dequeue(this,t)})},finish:function(t){return t!==!1&&(t=t||"fx"),this.each(function(){var e,n=Tt.get(this),r=n[t+"queue"],o=n[t+"queueHooks"],i=st.timers,s=r?r.length:0;for(n.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;s>e;e++)r[e]&&r[e].finish&&r[e].finish.call(this);delete n.finish})}}),st.each(["toggle","show","hide"],function(t,e){var n=st.fn[e];st.fn[e]=function(t,r,o){return null==t||"boolean"==typeof t?n.apply(this,arguments):this.animate(F(e,!0),t,r,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,n,r){return this.animate(e,t,n,r)}}),st.timers=[],st.fx.tick=function(){var t,e=0,n=st.timers;for(ie=st.now();e<n.length;e++)t=n[e],t()||n[e]!==t||n.splice(e--,1);n.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,n){return t=st.fx?st.fx.speeds[t]||t:t,n=n||"fx",this.queue(n,function(n,r){var o=e.setTimeout(n,t);r.stop=function(){e.clearTimeout(o)}})},function(){var t=J.createElement("input"),e=J.createElement("select"),n=e.appendChild(J.createElement("option"));t.type="checkbox",ot.checkOn=""!==t.value,ot.optSelected=n.selected,e.disabled=!0,ot.optDisabled=!n.disabled,t=J.createElement("input"),t.value="t",t.type="radio",ot.radioValue="t"===t.value}();var ue,he=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,n){var r,o,i=t.nodeType;if(3!==i&&8!==i&&2!==i)return"undefined"==typeof t.getAttribute?st.prop(t,e,n):(1===i&&st.isXMLDoc(t)||(e=e.toLowerCase(),o=st.attrHooks[e]||(st.expr.match.bool.test(e)?ue:void 0)),void 0!==n?null===n?void st.removeAttr(t,e):o&&"set"in o&&void 0!==(r=o.set(t,n,e))?r:(t.setAttribute(e,n+""),n):o&&"get"in o&&null!==(r=o.get(t,e))?r:(r=st.find.attr(t,e),null==r?void 0:r))},attrHooks:{type:{set:function(t,e){if(!ot.radioValue&&"radio"===e&&st.nodeName(t,"input")){var n=t.value;return t.setAttribute("type",e),n&&(t.value=n),e}}}},removeAttr:function(t,e){var n,r,o=0,i=e&&e.match(wt);if(i&&1===t.nodeType)for(;n=i[o++];)r=st.propFix[n]||n,st.expr.match.bool.test(n)&&(t[r]=!1),t.removeAttribute(n)}}),ue={set:function(t,e,n){return e===!1?st.removeAttr(t,n):t.setAttribute(n,n),n}},st.each(st.expr.match.bool.source.match(/\w+/g),function(t,e){var n=he[e]||st.find.attr;he[e]=function(t,e,r){var o,i;return r||(i=he[e],he[e]=o,o=null!=n(t,e,r)?e.toLowerCase():null,he[e]=i),o}});var ce=/^(?:input|select|textarea|button)$/i,pe=/^(?: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,n){var r,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!==n?o&&"set"in o&&void 0!==(r=o.set(t,n,e))?r:t[e]=n:o&&"get"in o&&null!==(r=o.get(t,e))?r:t[e]},propHooks:{tabIndex:{get:function(t){var e=st.find.attr(t,"tabindex");return e?parseInt(e,10):ce.test(t.nodeName)||pe.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}}),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,n,r,o,i,s,a,l=0;if(st.isFunction(t))return this.each(function(e){st(this).addClass(t.call(this,e,L(this)))});if("string"==typeof t&&t)for(e=t.match(wt)||[];n=this[l++];)if(o=L(n),r=1===n.nodeType&&(" "+o+" ").replace(_e," ")){for(s=0;i=e[s++];)r.indexOf(" "+i+" ")<0&&(r+=i+" ");a=st.trim(r),o!==a&&n.setAttribute("class",a)}return this},removeClass:function(t){var e,n,r,o,i,s,a,l=0;if(st.isFunction(t))return this.each(function(e){st(this).removeClass(t.call(this,e,L(this)))});if(!arguments.length)return this.attr("class","");if("string"==typeof t&&t)for(e=t.match(wt)||[];n=this[l++];)if(o=L(n),r=1===n.nodeType&&(" "+o+" ").replace(_e," ")){for(s=0;i=e[s++];)for(;r.indexOf(" "+i+" ")>-1;)r=r.replace(" "+i+" "," ");a=st.trim(r),o!==a&&n.setAttribute("class",a)}return this},toggleClass:function(t,e){var n=typeof t;return"boolean"==typeof e&&"string"===n?e?this.addClass(t):this.removeClass(t):st.isFunction(t)?this.each(function(n){st(this).toggleClass(t.call(this,n,L(this),e),e)}):this.each(function(){var e,r,o,i;if("string"===n)for(r=0,o=st(this),i=t.match(wt)||[];e=i[r++];)o.hasClass(e)?o.removeClass(e):o.addClass(e);else(void 0===t||"boolean"===n)&&(e=L(this),e&&Tt.set(this,"__className__",e),this.setAttribute&&this.setAttribute("class",e||t===!1?"":Tt.get(this,"__className__")||""))})},hasClass:function(t){var e,n,r=0;for(e=" "+t+" ";n=this[r++];)if(1===n.nodeType&&(" "+L(n)+" ").replace(_e," ").indexOf(e)>-1)return!0;return!1}});var de=/\r/g;st.fn.extend({val:function(t){var e,n,r,o=this[0];{if(arguments.length)return r=st.isFunction(t),this.each(function(n){var o;1===this.nodeType&&(o=r?t.call(this,n,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!==(n=e.get(o,"value"))?n:(n=o.value,"string"==typeof n?n.replace(de,""):null==n?"":n)}}}),st.extend({valHooks:{option:{get:function(t){return st.trim(t.value)}},select:{get:function(t){for(var e,n,r=t.options,o=t.selectedIndex,i="select-one"===t.type||0>o,s=i?null:[],a=i?o+1:r.length,l=0>o?a:i?o:0;a>l;l++)if(n=r[l],(n.selected||l===o)&&(ot.optDisabled?!n.disabled:null===n.getAttribute("disabled"))&&(!n.parentNode.disabled||!st.nodeName(n.parentNode,"optgroup"))){if(e=st(n).val(),i)return e;s.push(e)}return s},set:function(t,e){for(var n,r,o=t.options,i=st.makeArray(e),s=o.length;s--;)r=o[s],(r.selected=st.inArray(st.valHooks.option.get(r),i)>-1)&&(n=!0);return n||(t.selectedIndex=-1),i}}}}),st.each(["radio","checkbox"],function(){st.valHooks[this]={set:function(t,e){return st.isArray(e)?t.checked=st.inArray(st(t).val(),e)>-1:void 0}},ot.checkOn||(st.valHooks[this].get=function(t){return null===t.getAttribute("value")?"on":t.value})});var fe=/^(?:focusinfocus|focusoutblur)$/;st.extend(st.event,{trigger:function(t,n,r,o){var i,s,a,l,u,h,c,p=[r||J],_=rt.call(t,"type")?t.type:t,d=rt.call(t,"namespace")?t.namespace.split("."):[];if(s=a=r=r||J,3!==r.nodeType&&8!==r.nodeType&&!fe.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=r),n=null==n?[t]:st.makeArray(n,[t]),c=st.event.special[_]||{},o||!c.trigger||c.trigger.apply(r,n)!==!1)){if(!o&&!c.noBubble&&!st.isWindow(r)){for(l=c.delegateType||_,fe.test(l+_)||(s=s.parentNode);s;s=s.parentNode)p.push(s),a=s;a===(r.ownerDocument||J)&&p.push(a.defaultView||a.parentWindow||e)}for(i=0;(s=p[i++])&&!t.isPropagationStopped();)t.type=i>1?l:c.bindType||_,h=(Tt.get(s,"events")||{})[t.type]&&Tt.get(s,"handle"),h&&h.apply(s,n),h=u&&s[u],h&&h.apply&&jt(s)&&(t.result=h.apply(s,n),t.result===!1&&t.preventDefault());return t.type=_,o||t.isDefaultPrevented()||c._default&&c._default.apply(p.pop(),n)!==!1||!jt(r)||u&&st.isFunction(r[_])&&!st.isWindow(r)&&(a=r[u],a&&(r[u]=null),st.event.triggered=_,r[_](),st.event.triggered=void 0,a&&(r[u]=a)),t.result}},simulate:function(t,e,n){var r=st.extend(new st.Event,n,{type:t,isSimulated:!0});st.event.trigger(r,null,e),r.isDefaultPrevented()&&n.preventDefault()}}),st.fn.extend({trigger:function(t,e){return this.each(function(){st.event.trigger(t,e,this)})},triggerHandler:function(t,e){var n=this[0];return n?st.event.trigger(t,e,n,!0):void 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,n){return arguments.length>0?this.on(e,null,t,n):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 n=function(t){st.event.simulate(e,t.target,st.event.fix(t))};st.event.special[e]={setup:function(){var r=this.ownerDocument||this,o=Tt.access(r,e);o||r.addEventListener(t,n,!0),Tt.access(r,e,(o||0)+1)},teardown:function(){var r=this.ownerDocument||this,o=Tt.access(r,e)-1;o?Tt.access(r,e,o):(r.removeEventListener(t,n,!0),Tt.remove(r,e))}}});var me=e.location,ge=st.now(),ye=/\?/;st.parseJSON=function(t){return JSON.parse(t+"")},st.parseXML=function(t){var n;if(!t||"string"!=typeof t)return null;try{n=(new e.DOMParser).parseFromString(t,"text/xml")}catch(r){n=void 0}return(!n||n.getElementsByTagName("parsererror").length)&&st.error("Invalid XML: "+t),n};var ve=/#.*$/,be=/([?&])_=[^&]*/,xe=/^(.*?):[ \t]*([^\r\n]*)$/gm,we=/^(?:about|app|app-storage|.+-extension|file|res|widget):$/,ke=/^(?:GET|HEAD)$/,Me=/^\/\//,je={},Te={},ze="*/".concat("*"),Ee=J.createElement("a");Ee.href=me.href,st.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:me.href,type:"GET",isLocal:we.test(me.protocol),global:!0,processData:!0,async:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":ze,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?$($(t,st.ajaxSettings),e):$(st.ajaxSettings,t)},ajaxPrefilter:G(je),ajaxTransport:G(Te),ajax:function(t,n){function r(t,n,r,a){var u,c,y,v,x,k=n;2!==b&&(b=2,l&&e.clearTimeout(l),o=void 0,s=a||"",w.readyState=t>0?4:0,u=t>=200&&300>t||304===t,r&&(v=V(p,w,r)),v=H(p,v,w,u),u?(p.ifModified&&(x=w.getResponseHeader("Last-Modified"),x&&(st.lastModified[i]=x),x=w.getResponseHeader("etag"),x&&(st.etag[i]=x)),204===t||"HEAD"===p.type?k="nocontent":304===t?k="notmodified":(k=v.state,c=v.data,y=v.error,u=!y)):(y=k,(t||!k)&&(k="error",0>t&&(t=0))),w.status=t,w.statusText=(n||k)+"",u?f.resolveWith(_,[c,k,w]):f.rejectWith(_,[w,k,y]),w.statusCode(g),g=void 0,h&&d.trigger(u?"ajaxSuccess":"ajaxError",[w,p,u?c:y]),m.fireWith(_,[w,k]),h&&(d.trigger("ajaxComplete",[w,p]),--st.active||st.event.trigger("ajaxStop")))}"object"==typeof t&&(n=t,t=void 0),n=n||{};var o,i,s,a,l,u,h,c,p=st.ajaxSetup({},n),_=p.context||p,d=p.context&&(_.nodeType||_.jquery)?st(_):st.event,f=st.Deferred(),m=st.Callbacks("once memory"),g=p.statusCode||{},y={},v={},b=0,x="canceled",w={readyState:0,getResponseHeader:function(t){var e;if(2===b){if(!a)for(a={};e=xe.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 n=t.toLowerCase();return b||(t=v[n]=v[n]||t,y[t]=e),this},overrideMimeType:function(t){return b||(p.mimeType=t),this},statusCode:function(t){var e;if(t)if(2>b)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),r(0,e),this}};if(f.promise(w).complete=m.add,w.success=w.done,w.error=w.fail,p.url=((t||p.url||me.href)+"").replace(ve,"").replace(Me,me.protocol+"//"),p.type=n.method||n.type||p.method||p.type,p.dataTypes=st.trim(p.dataType||"*").toLowerCase().match(wt)||[""],null==p.crossDomain){u=J.createElement("a");try{u.href=p.url,u.href=u.href,p.crossDomain=Ee.protocol+"//"+Ee.host!=u.protocol+"//"+u.host}catch(k){p.crossDomain=!0}}if(p.data&&p.processData&&"string"!=typeof p.data&&(p.data=st.param(p.data,p.traditional)),U(je,p,n,w),2===b)return w;h=st.event&&p.global,h&&0===st.active++&&st.event.trigger("ajaxStart"),p.type=p.type.toUpperCase(),p.hasContent=!ke.test(p.type),i=p.url,p.hasContent||(p.data&&(i=p.url+=(ye.test(i)?"&":"?")+p.data,delete p.data),p.cache===!1&&(p.url=be.test(i)?i.replace(be,"$1_="+ge++):i+(ye.test(i)?"&":"?")+"_="+ge++)),p.ifModified&&(st.lastModified[i]&&w.setRequestHeader("If-Modified-Since",st.lastModified[i]),st.etag[i]&&w.setRequestHeader("If-None-Match",st.etag[i])),(p.data&&p.hasContent&&p.contentType!==!1||n.contentType)&&w.setRequestHeader("Content-Type",p.contentType),w.setRequestHeader("Accept",p.dataTypes[0]&&p.accepts[p.dataTypes[0]]?p.accepts[p.dataTypes[0]]+("*"!==p.dataTypes[0]?", "+ze+"; q=0.01":""):p.accepts["*"]);for(c in p.headers)w.setRequestHeader(c,p.headers[c]);if(p.beforeSend&&(p.beforeSend.call(_,w,p)===!1||2===b))return w.abort();x="abort";for(c in{success:1,error:1,complete:1})w[c](p[c]);if(o=U(Te,p,n,w)){if(w.readyState=1,h&&d.trigger("ajaxSend",[w,p]),2===b)return w;p.async&&p.timeout>0&&(l=e.setTimeout(function(){w.abort("timeout")},p.timeout));try{b=1,o.send(y,r)}catch(k){if(!(2>b))throw k;r(-1,k)}}else r(-1,"No Transport");return w},getJSON:function(t,e,n){return st.get(t,e,n,"json")},getScript:function(t,e){return st.get(t,void 0,e,"script")}}),st.each(["get","post"],function(t,e){st[e]=function(t,n,r,o){return st.isFunction(n)&&(o=o||r,r=n,n=void 0),st.ajax(st.extend({url:t,type:e,dataType:o,data:n,success:r},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),n=e.contents();n.length?n.wrapAll(t):e.append(t)})},wrap:function(t){var e=st.isFunction(t);return this.each(function(n){st(this).wrapAll(e?t.call(this,n):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 Pe=/%20/g,Se=/\[\]$/,Ce=/\r?\n/g,Ae=/^(?:submit|button|image|reset|file)$/i,Oe=/^(?:input|select|textarea|keygen)/i;st.param=function(t,e){var n,r=[],o=function(t,e){e=st.isFunction(e)?e():null==e?"":e,r[r.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(n in t)Y(n,t[n],e,o);return r.join("&").replace(Pe,"+")},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)&&!Ae.test(t)&&(this.checked||!Nt.test(t))}).map(function(t,e){var n=st(this).val();return null==n?null:st.isArray(n)?st.map(n,function(t){return{name:e.name,value:t.replace(Ce,"\r\n")}}):{name:e.name,value:n.replace(Ce,"\r\n")}}).get()}}),st.ajaxSettings.xhr=function(){try{return new e.XMLHttpRequest}catch(t){}};var Ne={0:200,1223:204},qe=st.ajaxSettings.xhr();ot.cors=!!qe&&"withCredentials"in qe,ot.ajax=qe=!!qe,st.ajaxTransport(function(t){var n,r;return ot.cors||qe&&!t.crossDomain?{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]);n=function(t){return function(){n&&(n=r=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(Ne[a.status]||a.status,a.statusText,"text"!==(a.responseType||"text")||"string"!=typeof a.responseText?{binary:a.response}:{text:a.responseText},a.getAllResponseHeaders()))}},a.onload=n(),r=a.onerror=n("error"),void 0!==a.onabort?a.onabort=r:a.onreadystatechange=function(){4===a.readyState&&e.setTimeout(function(){n&&r()})},n=n("abort");try{a.send(t.hasContent&&t.data||null)}catch(l){if(n)throw l}},abort:function(){n&&n()}}:void 0}),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,n;return{send:function(r,o){e=st("<script>").prop({charset:t.scriptCharset,src:t.url}).on("load error",n=function(t){e.remove(),n=null,t&&o("error"===t.type?404:200,t.type)}),J.head.appendChild(e[0])},abort:function(){n&&n()}}}});var Fe=[],De=/(=)\?(?=&|$)|\?\?/;st.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var t=Fe.pop()||st.expando+"_"+ge++;return this[t]=!0,t}}),st.ajaxPrefilter("json jsonp",function(t,n,r){var o,i,s,a=t.jsonp!==!1&&(De.test(t.url)?"url":"string"==typeof t.data&&0===(t.contentType||"").indexOf("application/x-www-form-urlencoded")&&De.test(t.data)&&"data");return a||"jsonp"===t.dataTypes[0]?(o=t.jsonpCallback=st.isFunction(t.jsonpCallback)?t.jsonpCallback():t.jsonpCallback,a?t[a]=t[a].replace(De,"$1"+o):t.jsonp!==!1&&(t.url+=(ye.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},r.always(function(){void 0===i?st(e).removeProp(o):e[o]=i,t[o]&&(t.jsonpCallback=n.jsonpCallback,Fe.push(o)),s&&st.isFunction(i)&&i(s[0]),s=i=void 0}),"script"):void 0}),ot.createHTMLDocument=function(){var t=J.implementation.createHTMLDocument("").body;return t.innerHTML="<form></form><form></form>",2===t.childNodes.length}(),st.parseHTML=function(t,e,n){if(!t||"string"!=typeof t)return null;"boolean"==typeof e&&(n=e,e=!1),e=e||(ot.createHTMLDocument?J.implementation.createHTMLDocument(""):J);var r=ft.exec(t),o=!n&&[];return r?[e.createElement(r[1])]:(r=_([t],e,o),o&&o.length&&st(o).remove(),st.merge([],r.childNodes))};var Ie=st.fn.load;st.fn.load=function(t,e,n){if("string"!=typeof t&&Ie)return Ie.apply(this,arguments);var r,o,i,s=this,a=t.indexOf(" ");return a>-1&&(r=st.trim(t.slice(a)),t=t.slice(0,a)),st.isFunction(e)?(n=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(r?st("<div>").append(st.parseHTML(t)).find(r):t)}).always(n&&function(t,e){s.each(function(){n.apply(s,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,n){var r,o,i,s,a,l,u,h=st.css(t,"position"),c=st(t),p={};"static"===h&&(t.style.position="relative"),a=c.offset(),i=st.css(t,"top"),l=st.css(t,"left"),u=("absolute"===h||"fixed"===h)&&(i+l).indexOf("auto")>-1,u?(r=c.position(),s=r.top,o=r.left):(s=parseFloat(i)||0,o=parseFloat(l)||0),st.isFunction(e)&&(e=e.call(t,n,st.extend({},a))),null!=e.top&&(p.top=e.top-a.top+s),null!=e.left&&(p.left=e.left-a.left+o),"using"in e?e.using.call(t,p):c.css(p)}},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,n,r=this[0],o={top:0,left:0},i=r&&r.ownerDocument;if(i)return e=i.documentElement,st.contains(e,r)?(o=r.getBoundingClientRect(),n=W(i),{top:o.top+n.pageYOffset-e.clientTop,left:o.left+n.pageXOffset-e.clientLeft}):o},position:function(){if(this[0]){var t,e,n=this[0],r={top:0,left:0};return"fixed"===st.css(n,"position")?e=n.getBoundingClientRect():(t=this.offsetParent(),e=this.offset(),st.nodeName(t[0],"html")||(r=t.offset()),r.top+=st.css(t[0],"borderTopWidth",!0)-t.scrollTop(),r.left+=st.css(t[0],"borderLeftWidth",!0)-t.scrollLeft()),{top:e.top-r.top-st.css(n,"marginTop",!0),left:e.left-r.left-st.css(n,"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 n="pageYOffset"===e;st.fn[t]=function(r){return Mt(this,function(t,r,o){var i=W(t);return void 0===o?i?i[e]:t[r]:void(i?i.scrollTo(n?i.pageXOffset:o,n?o:i.pageYOffset):t[r]=o)},t,r,arguments.length)}}),st.each(["top","left"],function(t,e){st.cssHooks[e]=E(ot.pixelPosition,function(t,n){return n?(n=z(t,e),Jt.test(n)?st(t).position()[e]+"px":n):void 0})}),st.each({Height:"height",Width:"width"},function(t,e){st.each({padding:"inner"+t,content:e,"":"outer"+t},function(n,r){st.fn[r]=function(r,o){var i=arguments.length&&(n||"boolean"!=typeof r),s=n||(r===!0||o===!0?"margin":"border");return Mt(this,function(e,n,r){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===r?st.css(e,n,s):st.style(e,n,r,s)},e,i?r:void 0,i,null)}})}),st.fn.extend({bind:function(t,e,n){return this.on(t,null,e,n)},unbind:function(t,e){return this.off(t,null,e)},delegate:function(t,e,n,r){return this.on(e,t,n,r)},undelegate:function(t,e,n){return 1===arguments.length?this.off(t,"**"):this.off(e,t||"**",n)},size:function(){return this.length}}),st.fn.andSelf=st.fn.addBack,"function"==typeof t&&t.amd&&t("jquery",[],function(){return st});var Re=e.jQuery,Be=e.$;return st.noConflict=function(t){return e.$===st&&(e.$=Be),t&&e.jQuery===st&&(e.jQuery=Re),st},n||(e.jQuery=e.$=st),st})},{}],jsnlog:[function(t,e,n){function r(t){if(!t)return r.__;Array.prototype.reduce||(Array.prototype.reduce=function(t,e){for(var n=e,r=0;r<this.length;r++)n=t(n,this[r],r,this);return n});var e="",n=("."+t).split(".").reduce(function(t,n,o,i){e?e+="."+n:e=n;var s=t["__"+e];return void 0===s&&(r.Logger.prototype=t,s=new r.Logger(e),t["__"+e]=s),s},r.__);return n}var r,o=this.__extends||function(t,e){function n(){this.constructor=t}for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r]);n.prototype=e.prototype,t.prototype=new n};!function(t){function e(t,e,n){return void 0!==e[t]?null===e[t]?void delete n[t]:void(n[t]=e[t]):void 0}function n(e){if(null!=t.enabled&&!t.enabled)return!1;if(null!=t.maxMessages&&t.maxMessages<1)return!1;try{if(e.userAgentRegex&&!new RegExp(e.userAgentRegex).test(navigator.userAgent))return!1}catch(n){}try{if(e.ipRegex&&t.clientIP&&!new RegExp(e.ipRegex).test(t.clientIP))return!1}catch(n){}return!0}function r(t,e){try{if(t.disallow&&new RegExp(t.disallow).test(e))return!1}catch(n){}return!0}function i(t){return"function"==typeof t?t instanceof RegExp?t.toString():t():t}function s(t){var e,n=i(t);switch(typeof n){case"string":return new v(n,null,n);case"number":return e=n.toString(),new v(e,null,e);case"boolean":return e=n.toString(),new v(e,null,e);case"undefined":return new v("undefined",null,"undefined");case"object":return n instanceof RegExp||n instanceof String||n instanceof Number||n instanceof Boolean?(e=n.toString(),new v(e,null,e)):new v(null,n,JSON.stringify(n));default:return new v("unknown",null,"unknown")}}function a(t){return e("enabled",t,this),e("maxMessages",t,this),e("defaultAjaxUrl",t,this),e("clientIP",t,this),e("requestId",t,this),e("defaultBeforeSend",t,this),this}function l(){return-2147483648}function u(){return 1e3}function h(){return 2e3}function c(){return 3e3}function p(){return 4e3}function _(){return 5e3}function d(){return 6e3}function f(){return 2147483647}function m(t){return 1e3>=t?"trace":2e3>=t?"debug":3e3>=t?"info":4e3>=t?"warn":5e3>=t?"error":"fatal"}function g(t){return new k(t)}function y(t){return new M(t)}t.enabled,t.maxMessages,t.defaultAjaxUrl,t.clientIP,t.defaultBeforeSend,t.requestId="";var v=function(){function t(t,e,n){this.msg=t,this.meta=e,this.finalString=n}return t}();t.setOptions=a,t.getAllLevel=l,t.getTraceLevel=u,t.getDebugLevel=h,t.getInfoLevel=c,t.getWarnLevel=p,t.getErrorLevel=_,t.getFatalLevel=d,t.getOffLevel=f;var b=function(){function t(t,e){this.inner=e,this.name="JL.Exception",this.message=s(t).finalString}return t}();t.Exception=b,b.prototype=new Error;var x=function(){function t(t,e,n,r){this.l=t,this.m=e,this.n=n,this.t=r}return t}();t.LogItem=x;var w=function(){function o(e,n){this.appenderName=e,this.sendLogItems=n,this.level=t.getTraceLevel(),this.sendWithBufferLevel=2147483647,this.storeInBufferLevel=-2147483648,this.bufferSize=0,this.batchSize=1,this.buffer=[],this.batchBuffer=[]}return o.prototype.setOptions=function(t){return e("level",t,this),e("ipRegex",t,this),e("userAgentRegex",t,this),e("disallow",t,this),e("sendWithBufferLevel",t,this),e("storeInBufferLevel",t,this),e("bufferSize",t,this),e("batchSize",t,this),this.bufferSize<this.buffer.length&&(this.buffer.length=this.bufferSize),this},o.prototype.log=function(t,e,o,i,s,a,l){var u;if(n(this)&&r(this,a)&&!(s<this.storeInBufferLevel))return u=new x(s,a,l,(new Date).getTime()),s<this.level?void(this.bufferSize>0&&(this.buffer.push(u),this.buffer.length>this.bufferSize&&this.buffer.shift())):(s<this.sendWithBufferLevel?this.batchBuffer.push(u):(this.buffer.length&&(this.batchBuffer=this.batchBuffer.concat(this.buffer),this.buffer.length=0),this.batchBuffer.push(u)),this.batchBuffer.length>=this.batchSize?void this.sendBatch():void 0)},o.prototype.sendBatch=function(){0!=this.batchBuffer.length&&(null!=t.maxMessages&&t.maxMessages<1||(null!=t.maxMessages&&(t.maxMessages-=this.batchBuffer.length),this.sendLogItems(this.batchBuffer),this.batchBuffer.length=0))},o}();t.Appender=w;var k=function(n){function r(t){n.call(this,t,r.prototype.sendLogItemsAjax)}return o(r,n),r.prototype.setOptions=function(t){return e("url",t,this),e("beforeSend",t,this),n.prototype.setOptions.call(this,t),this},r.prototype.sendLogItemsAjax=function(e){try{var n="/jsnlog.logger";null!=t.defaultAjaxUrl&&(n=t.defaultAjaxUrl),this.url&&(n=this.url);var r=JSON.stringify({r:t.requestId,lg:e}),o=this.getXhr(n);"function"==typeof this.beforeSend?this.beforeSend.call(this,o):"function"==typeof t.defaultBeforeSend&&t.defaultBeforeSend.call(this,o),o.send(r)}catch(i){}},r.prototype.getXhr=function(e){var n=new XMLHttpRequest;if(!("withCredentials"in n)&&"undefined"!=typeof XDomainRequest){var r=new XDomainRequest;return r.open("POST",e),r}return n.open("POST",e),n.setRequestHeader("Content-Type","application/json"),n.setRequestHeader("JSNLog-RequestId",t.requestId),n},r}(w);t.AjaxAppender=k;var M=function(e){function n(t){e.call(this,t,n.prototype.sendLogItemsConsole)}return o(n,e),n.prototype.clog=function(t){console.log(t)},n.prototype.cerror=function(t){console.error?console.error(t):this.clog(t)},n.prototype.cwarn=function(t){console.warn?console.warn(t):this.clog(t)},n.prototype.cinfo=function(t){console.info?console.info(t):this.clog(t)},n.prototype.cdebug=function(t){console.debug?console.debug(t):this.cinfo(t)},n.prototype.sendLogItemsConsole=function(e){try{if(!console)return;var n;for(n=0;n<e.length;++n){var r=e[n],o=r.n+": "+r.m;"undefined"==typeof window&&(o=new Date(r.t)+" | "+o),r.l<=t.getDebugLevel()?this.cdebug(o):r.l<=t.getInfoLevel()?this.cinfo(o):r.l<=t.getWarnLevel()?this.cwarn(o):this.cerror(o)}}catch(i){}},n}(w);t.ConsoleAppender=M;var j=function(){function t(t){this.loggerName=t,this.seenRegexes=[]}return t.prototype.setOptions=function(t){return e("level",t,this),e("userAgentRegex",t,this),e("disallow",t,this),e("ipRegex",t,this),e("appenders",t,this),e("onceOnly",t,this),this.seenRegexes=[],this},t.prototype.buildExceptionObject=function(t){var e={};return t.stack?e.stack=t.stack:e.e=t,t.message&&(e.message=t.message),t.name&&(e.name=t.name),t.data&&(e.data=t.data),t.inner&&(e.inner=this.buildExceptionObject(t.inner)),e},t.prototype.log=function(t,e,o){var a,l,u=0;if(!this.appenders)return this;if(t>=this.level&&n(this)&&(o?(l=this.buildExceptionObject(o),l.logData=i(e)):l=e,a=s(l),r(this,a.finalString))){if(this.onceOnly)for(u=this.onceOnly.length-1;u>=0;){if(new RegExp(this.onceOnly[u]).test(a.finalString)){if(this.seenRegexes[u])return this;this.seenRegexes[u]=!0}u--}for(a.meta=a.meta||{},a.meta.loggerName=this.loggerName,u=this.appenders.length-1;u>=0;)this.appenders[u].log(m(t),a.msg,a.meta,function(){},t,a.finalString,this.loggerName),u--}return this},t.prototype.trace=function(t){return this.log(u(),t)},t.prototype.debug=function(t){return this.log(h(),t)},t.prototype.info=function(t){return this.log(c(),t)},t.prototype.warn=function(t){return this.log(p(),t)},t.prototype.error=function(t){return this.log(_(),t)},t.prototype.fatal=function(t){return this.log(d(),t)},t.prototype.fatalException=function(t,e){return this.log(d(),t,e)},t}();t.Logger=j,t.createAjaxAppender=g,t.createConsoleAppender=y;var T=new k("");"undefined"==typeof window&&(T=new M("")),t.__=new t.Logger(""),t.__.setOptions({level:t.getDebugLevel(),appenders:[T]})}(r||(r={}));var n;"undefined"!=typeof n&&(n.JL=r);var i;"function"==typeof i&&i.amd&&i("jsnlog",[],function(){return r}),"function"==typeof __jsnlog_configure&&__jsnlog_configure(r)},{}],"proj4/lib/Point":[function(t,e,n){function r(t,e,n){if(!(this instanceof r))return new r(t,e,n);if(Array.isArray(t))this.x=t[0],this.y=t[1],this.z=t[2]||0;else if("object"==typeof t)this.x=t.x,this.y=t.y,this.z=t.z||0;else if("string"==typeof t&&"undefined"==typeof e){var o=t.split(",");this.x=parseFloat(o[0],10),this.y=parseFloat(o[1],10),this.z=parseFloat(o[2],10)||0}else this.x=t,this.y=e,this.z=n||0;console.warn("proj4.Point will be removed in version 3, use proj4.toPoint")}var o=t("mgrs");r.fromMGRS=function(t){return new r(o.toPoint(t))},r.prototype.toMGRS=function(t){return o.forward([this.x,this.y],t)},e.exports=r},{mgrs:"proj4/node_modules/mgrs/mgrs"}],"proj4/lib/Proj":[function(t,e,n){function r(t,e){if(!(this instanceof r))return new r(t);e=e||function(t){if(t)throw t};var n=o(t);if("object"!=typeof n)return void e(t);var s=a(n),l=r.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");r.projections=s,r.projections.start(),e.exports=r},{"./deriveConstants":"proj4/lib/deriveConstants","./extend":"proj4/lib/extend","./parseCode":"proj4/lib/parseCode","./projections":"proj4/lib/projections"}],"proj4/lib/adjust_axis":[function(t,e,n){e.exports=function(t,e,n){var r,o,i,s=n.x,a=n.y,l=n.z||0;for(i=0;3>i;i++)if(!e||2!==i||void 0!==n.z)switch(0===i?(r=s,o="x"):1===i?(r=a,o="y"):(r=l,o="z"),t.axis[i]){case"e":n[o]=r;break;case"w":n[o]=-r;break;case"n":n[o]=r;break;case"s":n[o]=-r;break;case"u":void 0!==n[o]&&(n.z=r);break;case"d":void 0!==n[o]&&(n.z=-r);break;default:return null}return n}},{}],"proj4/lib/common/adjust_lat":[function(t,e,n){var r=Math.PI/2,o=t("./sign");e.exports=function(t){return Math.abs(t)<r?t:t-o(t)*Math.PI}},{"./sign":"proj4/lib/common/sign"}],"proj4/lib/common/adjust_lon":[function(t,e,n){var r=2*Math.PI,o=3.14159265359,i=t("./sign");e.exports=function(t){return Math.abs(t)<=o?t:t-i(t)*r}},{"./sign":"proj4/lib/common/sign"}],"proj4/lib/common/asinz":[function(t,e,n){e.exports=function(t){return Math.abs(t)>1&&(t=t>1?1:-1),Math.asin(t)}},{}],"proj4/lib/common/e0fn":[function(t,e,n){e.exports=function(t){return 1-.25*t*(1+t/16*(3+1.25*t))}},{}],"proj4/lib/common/e1fn":[function(t,e,n){e.exports=function(t){return.375*t*(1+.25*t*(1+.46875*t))}},{}],"proj4/lib/common/e2fn":[function(t,e,n){e.exports=function(t){return.05859375*t*t*(1+.75*t)}},{}],"proj4/lib/common/e3fn":[function(t,e,n){e.exports=function(t){return t*t*t*(35/3072)}},{}],"proj4/lib/common/gN":[function(t,e,n){e.exports=function(t,e,n){var r=e*n;return t/Math.sqrt(1-r*r)}},{}],"proj4/lib/common/imlfn":[function(t,e,n){e.exports=function(t,e,n,r,o){var i,s;i=t/e;for(var a=0;15>a;a++)if(s=(t-(e*i-n*Math.sin(2*i)+r*Math.sin(4*i)-o*Math.sin(6*i)))/(e-2*n*Math.cos(2*i)+4*r*Math.cos(4*i)-6*o*Math.cos(6*i)),i+=s,Math.abs(s)<=1e-10)return i;return NaN}},{}],"proj4/lib/common/iqsfnz":[function(t,e,n){var r=Math.PI/2;e.exports=function(t,e){var n=1-(1-t*t)/(2*t)*Math.log((1-t)/(1+t));if(Math.abs(Math.abs(e)-n)<1e-6)return 0>e?-1*r:r;for(var o,i,s,a,l=Math.asin(.5*e),u=0;30>u;u++)if(i=Math.sin(l),s=Math.cos(l),a=t*i,o=Math.pow(1-a*a,2)/(2*s)*(e/(1-t*t)-i/(1-a*a)+.5/t*Math.log((1-a)/(1+a))),l+=o,Math.abs(o)<=1e-10)return l;return NaN}},{}],"proj4/lib/common/mlfn":[function(t,e,n){e.exports=function(t,e,n,r,o){return t*o-e*Math.sin(2*o)+n*Math.sin(4*o)-r*Math.sin(6*o)}},{}],"proj4/lib/common/msfnz":[function(t,e,n){e.exports=function(t,e,n){var r=t*e;return n/Math.sqrt(1-r*r)}},{}],"proj4/lib/common/phi2z":[function(t,e,n){var r=Math.PI/2;e.exports=function(t,e){for(var n,o,i=.5*t,s=r-2*Math.atan(e),a=0;15>=a;a++)if(n=t*Math.sin(s),o=r-2*Math.atan(e*Math.pow((1-n)/(1+n),i))-s,s+=o,Math.abs(o)<=1e-10)return s;return-9999}},{}],"proj4/lib/common/pj_enfn":[function(t,e,n){var r=1,o=.25,i=.046875,s=.01953125,a=.01068115234375,l=.75,u=.46875,h=.013020833333333334,c=.007120768229166667,p=.3645833333333333,_=.005696614583333333,d=.3076171875;e.exports=function(t){var e=[];e[0]=r-t*(o+t*(i+t*(s+t*a))),e[1]=t*(l-t*(i+t*(s+t*a)));var n=t*t;return e[2]=n*(u-t*(h+t*c)),n*=t,e[3]=n*(p-t*_),e[4]=n*t*d,e}},{}],"proj4/lib/common/pj_inv_mlfn":[function(t,e,n){var r=t("./pj_mlfn"),o=1e-10,i=20;e.exports=function(t,e,n){for(var s=1/(1-e),a=t,l=i;l;--l){var u=Math.sin(a),h=1-e*u*u;if(h=(r(a,u,Math.cos(a),n)-t)*(h*Math.sqrt(h))*s,a-=h,Math.abs(h)<o)return a}return a}},{"./pj_mlfn":"proj4/lib/common/pj_mlfn"}],"proj4/lib/common/pj_mlfn":[function(t,e,n){e.exports=function(t,e,n,r){return n*=e,e*=e,r[0]*t-n*(r[1]+e*(r[2]+e*(r[3]+e*r[4])))}},{}],"proj4/lib/common/qsfnz":[function(t,e,n){e.exports=function(t,e){var n;return t>1e-7?(n=t*e,(1-t*t)*(e/(1-n*n)-.5/t*Math.log((1-n)/(1+n)))):2*e}},{}],"proj4/lib/common/sign":[function(t,e,n){e.exports=function(t){return 0>t?-1:1}},{}],"proj4/lib/common/srat":[function(t,e,n){e.exports=function(t,e){return Math.pow((1-t)/(1+t),e)}},{}],"proj4/lib/common/toPoint":[function(t,e,n){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,n){var r=Math.PI/2;e.exports=function(t,e,n){var o=t*n,i=.5*t;return o=Math.pow((1-o)/(1+o),i),Math.tan(.5*(r-e))/o}},{}],"proj4/lib/constants/Datum":[function(t,e,n){n.wgs84={towgs84:"0,0,0",ellipse:"WGS84",datumName:"WGS84"},n.ch1903={towgs84:"674.374,15.056,405.346",ellipse:"bessel",datumName:"swiss"},n.ggrs87={towgs84:"-199.87,74.79,246.62",ellipse:"GRS80",datumName:"Greek_Geodetic_Reference_System_1987"},n.nad83={towgs84:"0,0,0",ellipse:"GRS80",datumName:"North_American_Datum_1983"},n.nad27={nadgrids:"@conus,@alaska,@ntv2_0.gsb,@ntv1_can.dat",ellipse:"clrk66",datumName:"North_American_Datum_1927"},n.potsdam={towgs84:"606.0,23.0,413.0",ellipse:"bessel",datumName:"Potsdam Rauenberg 1950 DHDN"},n.carthage={towgs84:"-263.0,6.0,431.0",ellipse:"clark80",datumName:"Carthage 1934 Tunisia"},n.hermannskogel={towgs84:"653.0,-212.0,449.0",ellipse:"bessel",datumName:"Hermannskogel"},n.ire65={towgs84:"482.530,-130.596,564.557,-1.042,-0.214,-0.631,8.15",ellipse:"mod_airy",datumName:"Ireland 1965"},n.rassadiran={towgs84:"-133.63,-157.5,-158.62",ellipse:"intl",datumName:"Rassadiran"},n.nzgd49={towgs84:"59.47,-5.04,187.44,0.47,-0.1,1.024,-4.5993",ellipse:"intl",datumName:"New Zealand Geodetic Datum 1949"},n.osgb36={towgs84:"446.448,-125.157,542.060,0.1502,0.2470,0.8421,-20.4894",ellipse:"airy",datumName:"Airy 1830"},n.s_jtsk={towgs84:"589,76,480",ellipse:"bessel",datumName:"S-JTSK (Ferro)"},n.beduaram={towgs84:"-106,-87,188",ellipse:"clrk80",datumName:"Beduaram"},n.gunung_segara={towgs84:"-403,684,41",ellipse:"bessel",datumName:"Gunung Segara Jakarta"},n.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,n){n.MERIT={a:6378137,rf:298.257,ellipseName:"MERIT 1983"},n.SGS85={a:6378136,rf:298.257,ellipseName:"Soviet Geodetic System 85"},n.GRS80={a:6378137,rf:298.257222101,ellipseName:"GRS 1980(IUGG, 1980)"},n.IAU76={a:6378140,rf:298.257,ellipseName:"IAU 1976"},n.airy={a:6377563.396,b:6356256.91,ellipseName:"Airy 1830"},n.APL4={a:6378137,rf:298.25,ellipseName:"Appl. Physics. 1965"},n.NWL9D={a:6378145,rf:298.25,ellipseName:"Naval Weapons Lab., 1965"},n.mod_airy={a:6377340.189,b:6356034.446,ellipseName:"Modified Airy"},n.andrae={a:6377104.43,rf:300,ellipseName:"Andrae 1876 (Den., Iclnd.)"},n.aust_SA={a:6378160,rf:298.25,ellipseName:"Australian Natl & S. Amer. 1969"},n.GRS67={a:6378160,rf:298.247167427,ellipseName:"GRS 67(IUGG 1967)"},n.bessel={a:6377397.155,rf:299.1528128,ellipseName:"Bessel 1841"},n.bess_nam={a:6377483.865,rf:299.1528128,ellipseName:"Bessel 1841 (Namibia)"},n.clrk66={a:6378206.4,b:6356583.8,ellipseName:"Clarke 1866"},n.clrk80={a:6378249.145,rf:293.4663,ellipseName:"Clarke 1880 mod."},n.clrk58={a:6378293.645208759,rf:294.2606763692654,ellipseName:"Clarke 1858"},n.CPM={a:6375738.7,rf:334.29,ellipseName:"Comm. des Poids et Mesures 1799"},n.delmbr={a:6376428,rf:311.5,ellipseName:"Delambre 1810 (Belgium)"},n.engelis={a:6378136.05,rf:298.2566,ellipseName:"Engelis 1985"},n.evrst30={a:6377276.345,rf:300.8017,ellipseName:"Everest 1830"},n.evrst48={a:6377304.063,rf:300.8017,ellipseName:"Everest 1948"},n.evrst56={a:6377301.243,rf:300.8017,ellipseName:"Everest 1956"},n.evrst69={a:6377295.664,rf:300.8017,ellipseName:"Everest 1969"},n.evrstSS={a:6377298.556,rf:300.8017,ellipseName:"Everest (Sabah & Sarawak)"},n.fschr60={a:6378166,rf:298.3,ellipseName:"Fischer (Mercury Datum) 1960"},n.fschr60m={a:6378155,rf:298.3,ellipseName:"Fischer 1960"},n.fschr68={a:6378150,rf:298.3,ellipseName:"Fischer 1968"},n.helmert={a:6378200,rf:298.3,ellipseName:"Helmert 1906"},n.hough={a:6378270,rf:297,ellipseName:"Hough"},n.intl={a:6378388,rf:297,ellipseName:"International 1909 (Hayford)"},n.kaula={a:6378163,rf:298.24,ellipseName:"Kaula 1961"},n.lerch={a:6378139,rf:298.257,ellipseName:"Lerch 1979"},n.mprts={a:6397300,rf:191,ellipseName:"Maupertius 1738"},n.new_intl={a:6378157.5,b:6356772.2,ellipseName:"New International 1967"},n.plessis={a:6376523,rf:6355863,ellipseName:"Plessis 1817 (France)"},n.krass={a:6378245,rf:298.3,ellipseName:"Krassovsky, 1942"},n.SEasia={a:6378155,b:6356773.3205,ellipseName:"Southeast Asia"},n.walbeck={a:6376896,b:6355834.8467,ellipseName:"Walbeck"},n.WGS60={a:6378165,rf:298.3,ellipseName:"WGS 60"},n.WGS66={a:6378145,rf:298.25,ellipseName:"WGS 66"},n.WGS7={a:6378135,rf:298.26,ellipseName:"WGS 72"},n.WGS84={a:6378137,rf:298.257223563,ellipseName:"WGS 84"},n.sphere={a:6370997,b:6370997,ellipseName:"Normal Sphere (r=6370997)"}},{}],"proj4/lib/constants/PrimeMeridian":[function(t,e,n){n.greenwich=0,n.lisbon=-9.131906111111,n.paris=2.337229166667,n.bogota=-74.080916666667,n.madrid=-3.687938888889,n.rome=12.452333333333,n.bern=7.439583333333,n.jakarta=106.807719444444,n.ferro=-17.666666666667,n.brussels=4.367975,n.stockholm=18.058277777778,n.athens=23.7163375,n.oslo=10.722916666667},{}],"proj4/lib/constants/units":[function(t,e,n){n.ft={to_meter:.3048},n["us-ft"]={to_meter:1200/3937}},{}],"proj4/lib/core":[function(t,e,n){function r(t,e,n){var r;return Array.isArray(n)?(r=a(t,e,n),3===n.length?[r.x,r.y,r.z]:[r.x,r.y]):a(t,e,n)}function o(t){return t instanceof s?t:t.oProj?t.oProj:s(t)}function i(t,e,n){t=o(t);var i,s=!1;return"undefined"==typeof e?(e=t,t=l,s=!0):("undefined"!=typeof e.x||Array.isArray(e))&&(n=e,e=t,t=l,s=!0),e=o(e),n?r(t,e,n):(i={forward:function(n){return r(t,e,n)},inverse:function(n){return r(e,t,n)}},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,n){var r=Math.PI/2,o=1,i=2,s=3,a=4,l=5,u=484813681109536e-20,h=1.0026,c=.3826834323650898,p=function(t){return this instanceof p?(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 p(t)};p.prototype={compare_datums:function(t){return this.datum_type!==t.datum_type?!1:this.a!==t.a||Math.abs(this.es-t.es)>5e-11?!1: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:!0},geodetic_to_geocentric:function(t){var e,n,o,i,s,a,l,u=t.x,h=t.y,c=t.z?t.z:0,p=0;if(-r>h&&h>-1.001*r)h=-r;else if(h>r&&1.001*r>h)h=r;else if(-r>h||h>r)return null;return u>Math.PI&&(u-=2*Math.PI),s=Math.sin(h),l=Math.cos(h),a=s*s,i=this.a/Math.sqrt(1-this.es*a),e=(i+c)*l*Math.cos(u),n=(i+c)*l*Math.sin(u),o=(i*(1-this.es)+c)*s,t.x=e,t.y=n,t.z=o,p},geocentric_to_geodetic:function(t){var e,n,o,i,s,a,l,u,h,c,p,_,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),n=Math.sqrt(w*w+k*k+M*M),e/this.a<v){if(d=!0,m=0,n/this.a<v)return g=r,void(y=-this.b)}else m=Math.atan2(k,w);o=M/n,i=e/n,s=1/Math.sqrt(1-this.es*(2-this.es)*i*i),u=i*(1-this.es)*s,h=o*s,f=0;do f++,l=this.a/Math.sqrt(1-this.es*h*h),y=e*u+M*h-l*(1-this.es*h*h),a=this.es*l/(l+y),s=1/Math.sqrt(1-a*(2-a)*i*i),c=i*(1-a)*s,p=o*s,_=p*u-c*h,u=c,h=p;while(_*_>b&&x>f);return g=Math.atan(p/Math.abs(c)),t.x=m,t.y=g,t.z=y,t},geocentric_to_geodetic_noniter:function(t){var e,n,o,i,s,a,l,u,p,_,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=r;else if(0>w)e=-r;else if(b=!0,e=0,k>0)n=r;else{if(!(0>k))return n=r,void(o=-this.b);n=-r}return s=x*x+w*w,i=Math.sqrt(s),a=k*h,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,p=Math.sqrt(l*l+v*v),m=l/p,g=v/p,y=this.a/Math.sqrt(1-this.es*m*m),o=g>=c?i/g-y:-c>=g?i/-g-y:k/m+y*(this.es-1),b===!1&&(n=Math.atan(m/g)),t.x=e,t.y=n,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],n=this.datum_params[1],r=this.datum_params[2],s=this.datum_params[3],a=this.datum_params[4],l=this.datum_params[5],u=this.datum_params[6],h=u*(t.x-l*t.y+a*t.z)+e,c=u*(l*t.x+t.y-s*t.z)+n,p=u*(-a*t.x+s*t.y+t.z)+r;t.x=h,t.y=c,t.z=p}},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],n=this.datum_params[1],r=this.datum_params[2],s=this.datum_params[3],a=this.datum_params[4],l=this.datum_params[5],u=this.datum_params[6],h=(t.x-e)/u,c=(t.y-n)/u,p=(t.z-r)/u;t.x=h+l*c-a*p,t.y=-l*h+c+s*p,t.z=a*h-s*c+p}}},e.exports=p},{}],"proj4/lib/datum_transform":[function(t,e,n){var r=1,o=2,i=3,s=5,a=6378137,l=.006694379990141316;e.exports=function(t,e,n){function u(t){return t===r||t===o}var h,c,p;if(t.compare_datums(e))return n;if(t.datum_type===s||e.datum_type===s)return n;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,n))t.a=a,t.es=l;else{if(!t.datum_params)return t.a=_,t.es=t.es,n;for(h=1,c=0,p=t.datum_params.length;p>c;c++)h*=t.datum_params[c];if(0===h)return t.a=_,t.es=t.es,n;g=t.datum_params.length>3?o:r}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(n),u(t.datum_type)&&t.geocentric_to_wgs84(n),u(e.datum_type)&&e.geocentric_from_wgs84(n),e.geocentric_to_geodetic(n)),e.datum_type===i&&this.apply_gridshift(e,1,n),t.a=_,t.es=d,e.a=f,e.es=m,n}},{}],"proj4/lib/defs":[function(t,e,n){function r(t){var e=this;if(2===arguments.length){var n=arguments[1];"string"==typeof n?"+"===n.charAt(0)?r[t]=i(arguments[1]):r[t]=s(arguments[1]):r[t]=n}else if(1===arguments.length){if(Array.isArray(t))return t.map(function(t){Array.isArray(t)?r.apply(e,t):r(t)});if("string"==typeof t){if(t in r)return r[t]}else"EPSG"in t?r["EPSG:"+t.EPSG]=t:"ESRI"in t?r["ESRI:"+t.ESRI]=t:"IAU2000"in t?r["IAU2000:"+t.IAU2000]=t:console.log(t);return}}var o=t("./global"),i=t("./projString"),s=t("./wkt");o(r),e.exports=r},{"./global":"proj4/lib/global","./projString":"proj4/lib/projString","./wkt":"proj4/lib/wkt"}],"proj4/lib/deriveConstants":[function(t,e,n){var r=t("./constants/Datum"),o=t("./constants/Ellipsoid"),i=t("./extend"),s=t("./datum"),a=1e-10,l=.16666666666666666,u=.04722222222222222,h=.022156084656084655;e.exports=function(t){if(t.datumCode&&"none"!==t.datumCode){var e=r[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 n=o[t.ellps]?o[t.ellps]:o.WGS84;i(t,n)}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*h)),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,n){e.exports=function(t,e){t=t||{};var n,r;if(!e)return t;for(r in e)n=e[r],void 0!==n&&(t[r]=n);return t}},{}],"proj4/lib/global":[function(t,e,n){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/includedProjections":[function(t,e,n){var r=[t("./projections/tmerc"),t("./projections/utm"),t("./projections/sterea"),t("./projections/stere"),t("./projections/somerc"),t("./projections/omerc"),t("./projections/lcc"),t("./projections/krovak"),t("./projections/cass"),t("./projections/laea"),t("./projections/aea"),t("./projections/gnom"),t("./projections/cea"),t("./projections/eqc"),t("./projections/poly"),t("./projections/nzmg"),t("./projections/mill"),t("./projections/sinu"),t("./projections/moll"),t("./projections/eqdc"),t("./projections/vandg"),t("./projections/aeqd")];e.exports=function(t){r.forEach(function(e){t.Proj.projections.add(e)})}},{"./projections/aea":"proj4/lib/projections/aea",
|
|
"./projections/aeqd":"proj4/lib/projections/aeqd","./projections/cass":"proj4/lib/projections/cass","./projections/cea":"proj4/lib/projections/cea","./projections/eqc":"proj4/lib/projections/eqc","./projections/eqdc":"proj4/lib/projections/eqdc","./projections/gnom":"proj4/lib/projections/gnom","./projections/krovak":"proj4/lib/projections/krovak","./projections/laea":"proj4/lib/projections/laea","./projections/lcc":"proj4/lib/projections/lcc","./projections/mill":"proj4/lib/projections/mill","./projections/moll":"proj4/lib/projections/moll","./projections/nzmg":"proj4/lib/projections/nzmg","./projections/omerc":"proj4/lib/projections/omerc","./projections/poly":"proj4/lib/projections/poly","./projections/sinu":"proj4/lib/projections/sinu","./projections/somerc":"proj4/lib/projections/somerc","./projections/stere":"proj4/lib/projections/stere","./projections/sterea":"proj4/lib/projections/sterea","./projections/tmerc":"proj4/lib/projections/tmerc","./projections/utm":"proj4/lib/projections/utm","./projections/vandg":"proj4/lib/projections/vandg"}],proj4:[function(t,e,n){var r=t("./core");r.defaultDatum="WGS84",r.Proj=t("./Proj"),r.WGS84=new r.Proj("WGS84"),r.Point=t("./Point"),r.toPoint=t("./common/toPoint"),r.defs=t("./defs"),r.transform=t("./transform"),r.mgrs=t("mgrs"),r.version=t("../package.json").version,t("./includedProjections")(r),e.exports=r},{"../package.json":"proj4/package.json","./Point":"proj4/lib/Point","./Proj":"proj4/lib/Proj","./common/toPoint":"proj4/lib/common/toPoint","./core":"proj4/lib/core","./defs":"proj4/lib/defs","./includedProjections":"proj4/lib/includedProjections","./transform":"proj4/lib/transform",mgrs:"proj4/node_modules/mgrs/mgrs"}],"proj4/lib/parseCode":[function(t,e,n){function r(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,n){return e+1+t.indexOf(n)},0)}function s(t){return"+"===t[0]}function a(t){return r(t)?o(t)?l[t]:i(t)?u(t):s(t)?h(t):void 0:t}var l=t("./defs"),u=t("./wkt"),h=t("./projString");e.exports=a},{"./defs":"proj4/lib/defs","./projString":"proj4/lib/projString","./wkt":"proj4/lib/wkt"}],"proj4/lib/projString":[function(t,e,n){var r=.017453292519943295,o=t("./constants/PrimeMeridian"),i=t("./constants/units");e.exports=function(t){var e={},n={};t.split("+").map(function(t){return t.trim()}).filter(function(t){return t}).forEach(function(t){var e=t.split("=");e.push(!0),n[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*r},lat_1:function(t){e.lat1=t*r},lat_2:function(t){e.lat2=t*r},lat_ts:function(t){e.lat_ts=t*r},lon_0:function(t){e.long0=t*r},lon_1:function(t){e.long1=t*r},lon_2:function(t){e.long2=t*r},alpha:function(t){e.alpha=parseFloat(t)*r},lonc:function(t){e.longc=t*r},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*r},pm:function(t){e.from_greenwich=(o[t]?o[t]:parseFloat(t))*r},nadgrids:function(t){"@null"===t?e.datumCode="none":e.nadgrids=t},axis:function(t){var n="ewnsud";3===t.length&&-1!==n.indexOf(t.substr(0,1))&&-1!==n.indexOf(t.substr(1,1))&&-1!==n.indexOf(t.substr(2,1))&&(e.axis=t)}};for(s in n)a=n[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,n){function r(t,e){var n=s.length;return t.names?(s[n]=t,t.names.forEach(function(t){i[t.toLowerCase()]=n}),this):(console.log(e),!0)}var o=[t("./projections/merc"),t("./projections/longlat")],i={},s=[];n.add=r,n.get=function(t){if(!t)return!1;var e=t.toLowerCase();return"undefined"!=typeof i[e]&&s[i[e]]?s[i[e]]:void 0},n.start=function(){o.forEach(r)}},{"./projections/longlat":"proj4/lib/projections/longlat","./projections/merc":"proj4/lib/projections/merc"}],"proj4/lib/projections/aea":[function(t,e,n){var r=1e-10,o=t("../common/msfnz"),i=t("../common/qsfnz"),s=t("../common/adjust_lon"),a=t("../common/asinz");n.init=function(){Math.abs(this.lat1+this.lat2)<r||(this.temp=this.b/this.a,this.es=1-Math.pow(this.temp,2),this.e3=Math.sqrt(this.es),this.sin_po=Math.sin(this.lat1),this.cos_po=Math.cos(this.lat1),this.t1=this.sin_po,this.con=this.sin_po,this.ms1=o(this.e3,this.sin_po,this.cos_po),this.qs1=i(this.e3,this.sin_po,this.cos_po),this.sin_po=Math.sin(this.lat2),this.cos_po=Math.cos(this.lat2),this.t2=this.sin_po,this.ms2=o(this.e3,this.sin_po,this.cos_po),this.qs2=i(this.e3,this.sin_po,this.cos_po),this.sin_po=Math.sin(this.lat0),this.cos_po=Math.cos(this.lat0),this.t3=this.sin_po,this.qs0=i(this.e3,this.sin_po,this.cos_po),Math.abs(this.lat1-this.lat2)>r?this.ns0=(this.ms1*this.ms1-this.ms2*this.ms2)/(this.qs2-this.qs1):this.ns0=this.con,this.c=this.ms1*this.ms1+this.ns0*this.qs1,this.rh=this.a*Math.sqrt(this.c-this.ns0*this.qs0)/this.ns0)},n.forward=function(t){var e=t.x,n=t.y;this.sin_phi=Math.sin(n),this.cos_phi=Math.cos(n);var r=i(this.e3,this.sin_phi,this.cos_phi),o=this.a*Math.sqrt(this.c-this.ns0*r)/this.ns0,a=this.ns0*s(e-this.long0),l=o*Math.sin(a)+this.x0,u=this.rh-o*Math.cos(a)+this.y0;return t.x=l,t.y=u,t},n.inverse=function(t){var e,n,r,o,i,a;return t.x-=this.x0,t.y=this.rh-t.y+this.y0,this.ns0>=0?(e=Math.sqrt(t.x*t.x+t.y*t.y),r=1):(e=-Math.sqrt(t.x*t.x+t.y*t.y),r=-1),o=0,0!==e&&(o=Math.atan2(r*t.x,r*t.y)),r=e*this.ns0/this.a,this.sphere?a=Math.asin((this.c-r*r)/(2*this.ns0)):(n=(this.c-r*r)/this.ns0,a=this.phi1z(this.e3,n)),i=s(o/this.ns0+this.long0),t.x=i,t.y=a,t},n.phi1z=function(t,e){var n,o,i,s,l,u=a(.5*e);if(r>t)return u;for(var h=t*t,c=1;25>=c;c++)if(n=Math.sin(u),o=Math.cos(u),i=t*n,s=1-i*i,l=.5*s*s/o*(e/(1-h)-n/s+.5/t*Math.log((1-i)/(1+i))),u+=l,Math.abs(l)<=1e-7)return u;return null},n.names=["Albers_Conic_Equal_Area","Albers","aea"]},{"../common/adjust_lon":"proj4/lib/common/adjust_lon","../common/asinz":"proj4/lib/common/asinz","../common/msfnz":"proj4/lib/common/msfnz","../common/qsfnz":"proj4/lib/common/qsfnz"}],"proj4/lib/projections/aeqd":[function(t,e,n){var r=t("../common/adjust_lon"),o=Math.PI/2,i=1e-10,s=t("../common/mlfn"),a=t("../common/e0fn"),l=t("../common/e1fn"),u=t("../common/e2fn"),h=t("../common/e3fn"),c=t("../common/gN"),p=t("../common/asinz"),_=t("../common/imlfn");n.init=function(){this.sin_p12=Math.sin(this.lat0),this.cos_p12=Math.cos(this.lat0)},n.forward=function(t){var e,n,p,_,d,f,m,g,y,v,b,x,w,k,M,j,T,z,E,P,S,C,A,O=t.x,N=t.y,q=Math.sin(t.y),F=Math.cos(t.y),D=r(O-this.long0);return this.sphere?Math.abs(this.sin_p12-1)<=i?(t.x=this.x0+this.a*(o-N)*Math.sin(D),t.y=this.y0-this.a*(o-N)*Math.cos(D),t):Math.abs(this.sin_p12+1)<=i?(t.x=this.x0+this.a*(o+N)*Math.sin(D),t.y=this.y0+this.a*(o+N)*Math.cos(D),t):(z=this.sin_p12*q+this.cos_p12*F*Math.cos(D),j=Math.acos(z),T=j/Math.sin(j),t.x=this.x0+this.a*T*F*Math.sin(D),t.y=this.y0+this.a*T*(this.cos_p12*q-this.sin_p12*F*Math.cos(D)),t):(e=a(this.es),n=l(this.es),p=u(this.es),_=h(this.es),Math.abs(this.sin_p12-1)<=i?(d=this.a*s(e,n,p,_,o),f=this.a*s(e,n,p,_,N),t.x=this.x0+(d-f)*Math.sin(D),t.y=this.y0-(d-f)*Math.cos(D),t):Math.abs(this.sin_p12+1)<=i?(d=this.a*s(e,n,p,_,o),f=this.a*s(e,n,p,_,N),t.x=this.x0+(d+f)*Math.sin(D),t.y=this.y0+(d+f)*Math.cos(D),t):(m=q/F,g=c(this.a,this.e,this.sin_p12),y=c(this.a,this.e,q),v=Math.atan((1-this.es)*m+this.es*g*this.sin_p12/(y*F)),b=Math.atan2(Math.sin(D),this.cos_p12*Math.tan(v)-this.sin_p12*Math.cos(D)),E=0===b?Math.asin(this.cos_p12*Math.sin(v)-this.sin_p12*Math.cos(v)):Math.abs(Math.abs(b)-Math.PI)<=i?-Math.asin(this.cos_p12*Math.sin(v)-this.sin_p12*Math.cos(v)):Math.asin(Math.sin(D)*Math.cos(v)/Math.sin(b)),x=this.e*this.sin_p12/Math.sqrt(1-this.es),w=this.e*this.cos_p12*Math.cos(b)/Math.sqrt(1-this.es),k=x*w,M=w*w,P=E*E,S=P*E,C=S*E,A=C*E,j=g*E*(1-P*M*(1-M)/6+S/8*k*(1-2*M)+C/120*(M*(4-7*M)-3*x*x*(1-7*M))-A/48*k),t.x=this.x0+j*Math.sin(b),t.y=this.y0+j*Math.cos(b),t))},n.inverse=function(t){t.x-=this.x0,t.y-=this.y0;var e,n,d,f,m,g,y,v,b,x,w,k,M,j,T,z,E,P,S,C,A,O,N;if(this.sphere){if(e=Math.sqrt(t.x*t.x+t.y*t.y),e>2*o*this.a)return;return n=e/this.a,d=Math.sin(n),f=Math.cos(n),m=this.long0,Math.abs(e)<=i?g=this.lat0:(g=p(f*this.sin_p12+t.y*d*this.cos_p12/e),y=Math.abs(this.lat0)-o,m=r(Math.abs(y)<=i?this.lat0>=0?this.long0+Math.atan2(t.x,-t.y):this.long0-Math.atan2(-t.x,t.y):this.long0+Math.atan2(t.x*d,e*this.cos_p12*f-t.y*this.sin_p12*d))),t.x=m,t.y=g,t}return v=a(this.es),b=l(this.es),x=u(this.es),w=h(this.es),Math.abs(this.sin_p12-1)<=i?(k=this.a*s(v,b,x,w,o),e=Math.sqrt(t.x*t.x+t.y*t.y),M=k-e,g=_(M/this.a,v,b,x,w),m=r(this.long0+Math.atan2(t.x,-1*t.y)),t.x=m,t.y=g,t):Math.abs(this.sin_p12+1)<=i?(k=this.a*s(v,b,x,w,o),e=Math.sqrt(t.x*t.x+t.y*t.y),M=e-k,g=_(M/this.a,v,b,x,w),m=r(this.long0+Math.atan2(t.x,t.y)),t.x=m,t.y=g,t):(e=Math.sqrt(t.x*t.x+t.y*t.y),z=Math.atan2(t.x,t.y),j=c(this.a,this.e,this.sin_p12),E=Math.cos(z),P=this.e*this.cos_p12*E,S=-P*P/(1-this.es),C=3*this.es*(1-S)*this.sin_p12*this.cos_p12*E/(1-this.es),A=e/j,O=A-S*(1+S)*Math.pow(A,3)/6-C*(1+3*S)*Math.pow(A,4)/24,N=1-S*O*O/2-A*O*O*O/6,T=Math.asin(this.sin_p12*Math.cos(O)+this.cos_p12*Math.sin(O)*E),m=r(this.long0+Math.asin(Math.sin(z)*Math.sin(O)/Math.cos(T))),g=Math.atan((1-this.es*N*this.sin_p12/Math.sin(T))*Math.tan(T)/(1-this.es)),t.x=m,t.y=g,t)},n.names=["Azimuthal_Equidistant","aeqd"]},{"../common/adjust_lon":"proj4/lib/common/adjust_lon","../common/asinz":"proj4/lib/common/asinz","../common/e0fn":"proj4/lib/common/e0fn","../common/e1fn":"proj4/lib/common/e1fn","../common/e2fn":"proj4/lib/common/e2fn","../common/e3fn":"proj4/lib/common/e3fn","../common/gN":"proj4/lib/common/gN","../common/imlfn":"proj4/lib/common/imlfn","../common/mlfn":"proj4/lib/common/mlfn"}],"proj4/lib/projections/cass":[function(t,e,n){var r=t("../common/mlfn"),o=t("../common/e0fn"),i=t("../common/e1fn"),s=t("../common/e2fn"),a=t("../common/e3fn"),l=t("../common/gN"),u=t("../common/adjust_lon"),h=t("../common/adjust_lat"),c=t("../common/imlfn"),p=Math.PI/2,_=1e-10;n.init=function(){this.sphere||(this.e0=o(this.es),this.e1=i(this.es),this.e2=s(this.es),this.e3=a(this.es),this.ml0=this.a*r(this.e0,this.e1,this.e2,this.e3,this.lat0))},n.forward=function(t){var e,n,o=t.x,i=t.y;if(o=u(o-this.long0),this.sphere)e=this.a*Math.asin(Math.cos(i)*Math.sin(o)),n=this.a*(Math.atan2(Math.tan(i),Math.cos(o))-this.lat0);else{var s=Math.sin(i),a=Math.cos(i),h=l(this.a,this.e,s),c=Math.tan(i)*Math.tan(i),p=o*Math.cos(i),_=p*p,d=this.es*a*a/(1-this.es),f=this.a*r(this.e0,this.e1,this.e2,this.e3,i);e=h*p*(1-_*c*(1/6-(8-c+8*d)*_/120)),n=f-this.ml0+h*s/a*_*(.5+(5-c+6*d)*_/24)}return t.x=e+this.x0,t.y=n+this.y0,t},n.inverse=function(t){t.x-=this.x0,t.y-=this.y0;var e,n,r=t.x/this.a,o=t.y/this.a;if(this.sphere){var i=o+this.lat0;e=Math.asin(Math.sin(i)*Math.cos(r)),n=Math.atan2(Math.tan(r),Math.cos(i))}else{var s=this.ml0/this.a+o,a=c(s,this.e0,this.e1,this.e2,this.e3);if(Math.abs(Math.abs(a)-p)<=_)return t.x=this.long0,t.y=p,0>o&&(t.y*=-1),t;var d=l(this.a,this.e,Math.sin(a)),f=d*d*d/this.a/this.a*(1-this.es),m=Math.pow(Math.tan(a),2),g=r*this.a/d,y=g*g;e=a-d*Math.tan(a)/f*g*g*(.5-(1+3*m)*g*g/24),n=g*(1-y*(m/3+(1+3*m)*m*y/15))/Math.cos(a)}return t.x=u(n+this.long0),t.y=h(e),t},n.names=["Cassini","Cassini_Soldner","cass"]},{"../common/adjust_lat":"proj4/lib/common/adjust_lat","../common/adjust_lon":"proj4/lib/common/adjust_lon","../common/e0fn":"proj4/lib/common/e0fn","../common/e1fn":"proj4/lib/common/e1fn","../common/e2fn":"proj4/lib/common/e2fn","../common/e3fn":"proj4/lib/common/e3fn","../common/gN":"proj4/lib/common/gN","../common/imlfn":"proj4/lib/common/imlfn","../common/mlfn":"proj4/lib/common/mlfn"}],"proj4/lib/projections/cea":[function(t,e,n){var r=t("../common/adjust_lon"),o=t("../common/qsfnz"),i=t("../common/msfnz"),s=t("../common/iqsfnz");n.init=function(){this.sphere||(this.k0=i(this.e,Math.sin(this.lat_ts),Math.cos(this.lat_ts)))},n.forward=function(t){var e,n,i=t.x,s=t.y,a=r(i-this.long0);if(this.sphere)e=this.x0+this.a*a*Math.cos(this.lat_ts),n=this.y0+this.a*Math.sin(s)/Math.cos(this.lat_ts);else{var l=o(this.e,Math.sin(s));e=this.x0+this.a*this.k0*a,n=this.y0+this.a*l*.5/this.k0}return t.x=e,t.y=n,t},n.inverse=function(t){t.x-=this.x0,t.y-=this.y0;var e,n;return this.sphere?(e=r(this.long0+t.x/this.a/Math.cos(this.lat_ts)),n=Math.asin(t.y/this.a*Math.cos(this.lat_ts))):(n=s(this.e,2*t.y*this.k0/this.a),e=r(this.long0+t.x/(this.a*this.k0))),t.x=e,t.y=n,t},n.names=["cea"]},{"../common/adjust_lon":"proj4/lib/common/adjust_lon","../common/iqsfnz":"proj4/lib/common/iqsfnz","../common/msfnz":"proj4/lib/common/msfnz","../common/qsfnz":"proj4/lib/common/qsfnz"}],"proj4/lib/projections/eqc":[function(t,e,n){var r=t("../common/adjust_lon"),o=t("../common/adjust_lat");n.init=function(){this.x0=this.x0||0,this.y0=this.y0||0,this.lat0=this.lat0||0,this.long0=this.long0||0,this.lat_ts=this.lat_ts||0,this.title=this.title||"Equidistant Cylindrical (Plate Carre)",this.rc=Math.cos(this.lat_ts)},n.forward=function(t){var e=t.x,n=t.y,i=r(e-this.long0),s=o(n-this.lat0);return t.x=this.x0+this.a*i*this.rc,t.y=this.y0+this.a*s,t},n.inverse=function(t){var e=t.x,n=t.y;return t.x=r(this.long0+(e-this.x0)/(this.a*this.rc)),t.y=o(this.lat0+(n-this.y0)/this.a),t},n.names=["Equirectangular","Equidistant_Cylindrical","eqc"]},{"../common/adjust_lat":"proj4/lib/common/adjust_lat","../common/adjust_lon":"proj4/lib/common/adjust_lon"}],"proj4/lib/projections/eqdc":[function(t,e,n){var r=t("../common/e0fn"),o=t("../common/e1fn"),i=t("../common/e2fn"),s=t("../common/e3fn"),a=t("../common/msfnz"),l=t("../common/mlfn"),u=t("../common/adjust_lon"),h=t("../common/adjust_lat"),c=t("../common/imlfn"),p=1e-10;n.init=function(){Math.abs(this.lat1+this.lat2)<p||(this.lat2=this.lat2||this.lat1,this.temp=this.b/this.a,this.es=1-Math.pow(this.temp,2),this.e=Math.sqrt(this.es),this.e0=r(this.es),this.e1=o(this.es),this.e2=i(this.es),this.e3=s(this.es),this.sinphi=Math.sin(this.lat1),this.cosphi=Math.cos(this.lat1),this.ms1=a(this.e,this.sinphi,this.cosphi),this.ml1=l(this.e0,this.e1,this.e2,this.e3,this.lat1),Math.abs(this.lat1-this.lat2)<p?this.ns=this.sinphi:(this.sinphi=Math.sin(this.lat2),this.cosphi=Math.cos(this.lat2),this.ms2=a(this.e,this.sinphi,this.cosphi),this.ml2=l(this.e0,this.e1,this.e2,this.e3,this.lat2),this.ns=(this.ms1-this.ms2)/(this.ml2-this.ml1)),this.g=this.ml1+this.ms1/this.ns,this.ml0=l(this.e0,this.e1,this.e2,this.e3,this.lat0),this.rh=this.a*(this.g-this.ml0))},n.forward=function(t){var e,n=t.x,r=t.y;if(this.sphere)e=this.a*(this.g-r);else{var o=l(this.e0,this.e1,this.e2,this.e3,r);e=this.a*(this.g-o)}var i=this.ns*u(n-this.long0),s=this.x0+e*Math.sin(i),a=this.y0+this.rh-e*Math.cos(i);return t.x=s,t.y=a,t},n.inverse=function(t){t.x-=this.x0,t.y=this.rh-t.y+this.y0;var e,n,r,o;this.ns>=0?(n=Math.sqrt(t.x*t.x+t.y*t.y),e=1):(n=-Math.sqrt(t.x*t.x+t.y*t.y),e=-1);var i=0;if(0!==n&&(i=Math.atan2(e*t.x,e*t.y)),this.sphere)return o=u(this.long0+i/this.ns),r=h(this.g-n/this.a),t.x=o,t.y=r,t;var s=this.g-n/this.a;return r=c(s,this.e0,this.e1,this.e2,this.e3),o=u(this.long0+i/this.ns),t.x=o,t.y=r,t},n.names=["Equidistant_Conic","eqdc"]},{"../common/adjust_lat":"proj4/lib/common/adjust_lat","../common/adjust_lon":"proj4/lib/common/adjust_lon","../common/e0fn":"proj4/lib/common/e0fn","../common/e1fn":"proj4/lib/common/e1fn","../common/e2fn":"proj4/lib/common/e2fn","../common/e3fn":"proj4/lib/common/e3fn","../common/imlfn":"proj4/lib/common/imlfn","../common/mlfn":"proj4/lib/common/mlfn","../common/msfnz":"proj4/lib/common/msfnz"}],"proj4/lib/projections/gauss":[function(t,e,n){var r=Math.PI/4,o=t("../common/srat"),i=Math.PI/2,s=20;n.init=function(){var t=Math.sin(this.lat0),e=Math.cos(this.lat0);e*=e,this.rc=Math.sqrt(1-this.es)/(1-this.es*t*t),this.C=Math.sqrt(1+this.es*e*e/(1-this.es)),this.phic0=Math.asin(t/this.C),this.ratexp=.5*this.C*this.e,this.K=Math.tan(.5*this.phic0+r)/(Math.pow(Math.tan(.5*this.lat0+r),this.C)*o(this.e*t,this.ratexp))},n.forward=function(t){var e=t.x,n=t.y;return t.y=2*Math.atan(this.K*Math.pow(Math.tan(.5*n+r),this.C)*o(this.e*Math.sin(n),this.ratexp))-i,t.x=this.C*e,t},n.inverse=function(t){for(var e=1e-14,n=t.x/this.C,a=t.y,l=Math.pow(Math.tan(.5*a+r)/this.K,1/this.C),u=s;u>0&&(a=2*Math.atan(l*o(this.e*Math.sin(t.y),-.5*this.e))-i,!(Math.abs(a-t.y)<e));--u)t.y=a;return u?(t.x=n,t.y=a,t):null},n.names=["gauss"]},{"../common/srat":"proj4/lib/common/srat"}],"proj4/lib/projections/gnom":[function(t,e,n){var r=t("../common/adjust_lon"),o=1e-10,i=t("../common/asinz");n.init=function(){this.sin_p14=Math.sin(this.lat0),this.cos_p14=Math.cos(this.lat0),this.infinity_dist=1e3*this.a,this.rc=1},n.forward=function(t){var e,n,i,s,a,l,u,h,c=t.x,p=t.y;return i=r(c-this.long0),e=Math.sin(p),n=Math.cos(p),s=Math.cos(i),l=this.sin_p14*e+this.cos_p14*n*s,a=1,l>0||Math.abs(l)<=o?(u=this.x0+this.a*a*n*Math.sin(i)/l,h=this.y0+this.a*a*(this.cos_p14*e-this.sin_p14*n*s)/l):(u=this.x0+this.infinity_dist*n*Math.sin(i),h=this.y0+this.infinity_dist*(this.cos_p14*e-this.sin_p14*n*s)),t.x=u,t.y=h,t},n.inverse=function(t){var e,n,o,s,a,l;return t.x=(t.x-this.x0)/this.a,t.y=(t.y-this.y0)/this.a,t.x/=this.k0,t.y/=this.k0,(e=Math.sqrt(t.x*t.x+t.y*t.y))?(s=Math.atan2(e,this.rc),n=Math.sin(s),o=Math.cos(s),l=i(o*this.sin_p14+t.y*n*this.cos_p14/e),a=Math.atan2(t.x*n,e*this.cos_p14*o-t.y*this.sin_p14*n),a=r(this.long0+a)):(l=this.phic0,a=0),t.x=a,t.y=l,t},n.names=["gnom"]},{"../common/adjust_lon":"proj4/lib/common/adjust_lon","../common/asinz":"proj4/lib/common/asinz"}],"proj4/lib/projections/krovak":[function(t,e,n){var r=t("../common/adjust_lon");n.init=function(){this.a=6377397.155,this.es=.006674372230614,this.e=Math.sqrt(this.es),this.lat0||(this.lat0=.863937979737193),this.long0||(this.long0=.4334234309119251),this.k0||(this.k0=.9999),this.s45=.785398163397448,this.s90=2*this.s45,this.fi0=this.lat0,this.e2=this.es,this.e=Math.sqrt(this.e2),this.alfa=Math.sqrt(1+this.e2*Math.pow(Math.cos(this.fi0),4)/(1-this.e2)),this.uq=1.04216856380474,this.u0=Math.asin(Math.sin(this.fi0)/this.alfa),this.g=Math.pow((1+this.e*Math.sin(this.fi0))/(1-this.e*Math.sin(this.fi0)),this.alfa*this.e/2),this.k=Math.tan(this.u0/2+this.s45)/Math.pow(Math.tan(this.fi0/2+this.s45),this.alfa)*this.g,this.k1=this.k0,this.n0=this.a*Math.sqrt(1-this.e2)/(1-this.e2*Math.pow(Math.sin(this.fi0),2)),this.s0=1.37008346281555,this.n=Math.sin(this.s0),this.ro0=this.k1*this.n0/Math.tan(this.s0),this.ad=this.s90-this.uq},n.forward=function(t){var e,n,o,i,s,a,l,u=t.x,h=t.y,c=r(u-this.long0);return e=Math.pow((1+this.e*Math.sin(h))/(1-this.e*Math.sin(h)),this.alfa*this.e/2),n=2*(Math.atan(this.k*Math.pow(Math.tan(h/2+this.s45),this.alfa)/e)-this.s45),o=-c*this.alfa,i=Math.asin(Math.cos(this.ad)*Math.sin(n)+Math.sin(this.ad)*Math.cos(n)*Math.cos(o)),s=Math.asin(Math.cos(n)*Math.sin(o)/Math.cos(i)),a=this.n*s,l=this.ro0*Math.pow(Math.tan(this.s0/2+this.s45),this.n)/Math.pow(Math.tan(i/2+this.s45),this.n),t.y=l*Math.cos(a)/1,t.x=l*Math.sin(a)/1,this.czech||(t.y*=-1,t.x*=-1),t},n.inverse=function(t){var e,n,r,o,i,s,a,l,u=t.x;t.x=t.y,t.y=u,this.czech||(t.y*=-1,t.x*=-1),s=Math.sqrt(t.x*t.x+t.y*t.y),i=Math.atan2(t.y,t.x),o=i/Math.sin(this.s0),r=2*(Math.atan(Math.pow(this.ro0/s,1/this.n)*Math.tan(this.s0/2+this.s45))-this.s45),e=Math.asin(Math.cos(this.ad)*Math.sin(r)-Math.sin(this.ad)*Math.cos(r)*Math.cos(o)),n=Math.asin(Math.cos(r)*Math.sin(o)/Math.cos(e)),t.x=this.long0-n/this.alfa,a=e,l=0;var h=0;do t.y=2*(Math.atan(Math.pow(this.k,-1/this.alfa)*Math.pow(Math.tan(e/2+this.s45),1/this.alfa)*Math.pow((1+this.e*Math.sin(a))/(1-this.e*Math.sin(a)),this.e/2))-this.s45),Math.abs(a-t.y)<1e-10&&(l=1),a=t.y,h+=1;while(0===l&&15>h);return h>=15?null:t},n.names=["Krovak","krovak"]},{"../common/adjust_lon":"proj4/lib/common/adjust_lon"}],"proj4/lib/projections/laea":[function(t,e,n){var r=Math.PI/2,o=Math.PI/4,i=1e-10,s=t("../common/qsfnz"),a=t("../common/adjust_lon");n.S_POLE=1,n.N_POLE=2,n.EQUIT=3,n.OBLIQ=4,n.init=function(){var t=Math.abs(this.lat0);if(Math.abs(t-r)<i?this.mode=this.lat0<0?this.S_POLE:this.N_POLE:Math.abs(t)<i?this.mode=this.EQUIT:this.mode=this.OBLIQ,this.es>0){var e;switch(this.qp=s(this.e,1),this.mmf=.5/(1-this.es),this.apa=this.authset(this.es),this.mode){case this.N_POLE:this.dd=1;break;case this.S_POLE:this.dd=1;break;case this.EQUIT:this.rq=Math.sqrt(.5*this.qp),this.dd=1/this.rq,this.xmf=1,this.ymf=.5*this.qp;break;case this.OBLIQ:this.rq=Math.sqrt(.5*this.qp),e=Math.sin(this.lat0),this.sinb1=s(this.e,e)/this.qp,this.cosb1=Math.sqrt(1-this.sinb1*this.sinb1),this.dd=Math.cos(this.lat0)/(Math.sqrt(1-this.es*e*e)*this.rq*this.cosb1),this.ymf=(this.xmf=this.rq)/this.dd,this.xmf*=this.dd}}else this.mode===this.OBLIQ&&(this.sinph0=Math.sin(this.lat0),this.cosph0=Math.cos(this.lat0))},n.forward=function(t){var e,n,l,u,h,c,p,_,d,f,m=t.x,g=t.y;if(m=a(m-this.long0),this.sphere){if(h=Math.sin(g),f=Math.cos(g),l=Math.cos(m),this.mode===this.OBLIQ||this.mode===this.EQUIT){if(n=this.mode===this.EQUIT?1+f*l:1+this.sinph0*h+this.cosph0*f*l,i>=n)return null;n=Math.sqrt(2/n),e=n*f*Math.sin(m),n*=this.mode===this.EQUIT?h:this.cosph0*h-this.sinph0*f*l}else if(this.mode===this.N_POLE||this.mode===this.S_POLE){if(this.mode===this.N_POLE&&(l=-l),Math.abs(g+this.phi0)<i)return null;n=o-.5*g,n=2*(this.mode===this.S_POLE?Math.cos(n):Math.sin(n)),e=n*Math.sin(m),n*=l}}else{switch(p=0,_=0,d=0,l=Math.cos(m),u=Math.sin(m),h=Math.sin(g),c=s(this.e,h),(this.mode===this.OBLIQ||this.mode===this.EQUIT)&&(p=c/this.qp,_=Math.sqrt(1-p*p)),this.mode){case this.OBLIQ:d=1+this.sinb1*p+this.cosb1*_*l;break;case this.EQUIT:d=1+_*l;break;case this.N_POLE:d=r+g,c=this.qp-c;break;case this.S_POLE:d=g-r,c=this.qp+c}if(Math.abs(d)<i)return null;switch(this.mode){case this.OBLIQ:case this.EQUIT:d=Math.sqrt(2/d),n=this.mode===this.OBLIQ?this.ymf*d*(this.cosb1*p-this.sinb1*_*l):(d=Math.sqrt(2/(1+_*l)))*p*this.ymf,e=this.xmf*d*_*u;break;case this.N_POLE:case this.S_POLE:c>=0?(e=(d=Math.sqrt(c))*u,n=l*(this.mode===this.S_POLE?d:-d)):e=n=0}}return t.x=this.a*e+this.x0,t.y=this.a*n+this.y0,t},n.inverse=function(t){t.x-=this.x0,t.y-=this.y0;var e,n,o,s,l,u,h,c=t.x/this.a,p=t.y/this.a;if(this.sphere){var _,d=0,f=0;if(_=Math.sqrt(c*c+p*p),n=.5*_,n>1)return null;switch(n=2*Math.asin(n),(this.mode===this.OBLIQ||this.mode===this.EQUIT)&&(f=Math.sin(n),d=Math.cos(n)),this.mode){case this.EQUIT:n=Math.abs(_)<=i?0:Math.asin(p*f/_),c*=f,p=d*_;break;case this.OBLIQ:n=Math.abs(_)<=i?this.phi0:Math.asin(d*this.sinph0+p*f*this.cosph0/_),c*=f*this.cosph0,p=(d-Math.sin(n)*this.sinph0)*_;break;case this.N_POLE:p=-p,n=r-n;break;case this.S_POLE:n-=r}e=0!==p||this.mode!==this.EQUIT&&this.mode!==this.OBLIQ?Math.atan2(c,p):0}else{if(h=0,this.mode===this.OBLIQ||this.mode===this.EQUIT){if(c/=this.dd,p*=this.dd,u=Math.sqrt(c*c+p*p),i>u)return t.x=0,t.y=this.phi0,t;s=2*Math.asin(.5*u/this.rq),o=Math.cos(s),c*=s=Math.sin(s),this.mode===this.OBLIQ?(h=o*this.sinb1+p*s*this.cosb1/u,l=this.qp*h,p=u*this.cosb1*o-p*this.sinb1*s):(h=p*s/u,l=this.qp*h,p=u*o)}else if(this.mode===this.N_POLE||this.mode===this.S_POLE){if(this.mode===this.N_POLE&&(p=-p),l=c*c+p*p,!l)return t.x=0,t.y=this.phi0,t;h=1-l/this.qp,this.mode===this.S_POLE&&(h=-h)}e=Math.atan2(c,p),n=this.authlat(Math.asin(h),this.apa)}return t.x=a(this.long0+e),t.y=n,t},n.P00=.3333333333333333,n.P01=.17222222222222222,n.P02=.10257936507936508,n.P10=.06388888888888888,n.P11=.0664021164021164,n.P20=.016415012942191543,n.authset=function(t){var e,n=[];return n[0]=t*this.P00,e=t*t,n[0]+=e*this.P01,n[1]=e*this.P10,e*=t,n[0]+=e*this.P02,n[1]+=e*this.P11,n[2]=e*this.P20,n},n.authlat=function(t,e){var n=t+t;return t+e[0]*Math.sin(n)+e[1]*Math.sin(n+n)+e[2]*Math.sin(n+n+n)},n.names=["Lambert Azimuthal Equal Area","Lambert_Azimuthal_Equal_Area","laea"]},{"../common/adjust_lon":"proj4/lib/common/adjust_lon","../common/qsfnz":"proj4/lib/common/qsfnz"}],"proj4/lib/projections/lcc":[function(t,e,n){var r=1e-10,o=t("../common/msfnz"),i=t("../common/tsfnz"),s=Math.PI/2,a=t("../common/sign"),l=t("../common/adjust_lon"),u=t("../common/phi2z");n.init=function(){if(this.lat2||(this.lat2=this.lat1),this.k0||(this.k0=1),this.x0=this.x0||0,this.y0=this.y0||0,!(Math.abs(this.lat1+this.lat2)<r)){var t=this.b/this.a;this.e=Math.sqrt(1-t*t);var e=Math.sin(this.lat1),n=Math.cos(this.lat1),s=o(this.e,e,n),a=i(this.e,this.lat1,e),l=Math.sin(this.lat2),u=Math.cos(this.lat2),h=o(this.e,l,u),c=i(this.e,this.lat2,l),p=i(this.e,this.lat0,Math.sin(this.lat0));Math.abs(this.lat1-this.lat2)>r?this.ns=Math.log(s/h)/Math.log(a/c):this.ns=e,isNaN(this.ns)&&(this.ns=e),this.f0=s/(this.ns*Math.pow(a,this.ns)),this.rh=this.a*this.f0*Math.pow(p,this.ns),this.title||(this.title="Lambert Conformal Conic")}},n.forward=function(t){var e=t.x,n=t.y;Math.abs(2*Math.abs(n)-Math.PI)<=r&&(n=a(n)*(s-2*r));var o,u,h=Math.abs(Math.abs(n)-s);if(h>r)o=i(this.e,n,Math.sin(n)),u=this.a*this.f0*Math.pow(o,this.ns);else{if(h=n*this.ns,0>=h)return null;u=0}var c=this.ns*l(e-this.long0);return t.x=this.k0*(u*Math.sin(c))+this.x0,t.y=this.k0*(this.rh-u*Math.cos(c))+this.y0,t},n.inverse=function(t){var e,n,r,o,i,a=(t.x-this.x0)/this.k0,h=this.rh-(t.y-this.y0)/this.k0;this.ns>0?(e=Math.sqrt(a*a+h*h),n=1):(e=-Math.sqrt(a*a+h*h),n=-1);var c=0;if(0!==e&&(c=Math.atan2(n*a,n*h)),0!==e||this.ns>0){if(n=1/this.ns,r=Math.pow(e/(this.a*this.f0),n),o=u(this.e,r),-9999===o)return null}else o=-s;return i=l(c/this.ns+this.long0),t.x=i,t.y=o,t},n.names=["Lambert Tangential Conformal Conic Projection","Lambert_Conformal_Conic","Lambert_Conformal_Conic_2SP","lcc"]},{"../common/adjust_lon":"proj4/lib/common/adjust_lon","../common/msfnz":"proj4/lib/common/msfnz","../common/phi2z":"proj4/lib/common/phi2z","../common/sign":"proj4/lib/common/sign","../common/tsfnz":"proj4/lib/common/tsfnz"}],"proj4/lib/projections/longlat":[function(t,e,n){function r(t){return t}n.init=function(){},n.forward=r,n.inverse=r,n.names=["longlat","identity"]},{}],"proj4/lib/projections/merc":[function(t,e,n){var r=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"),h=t("../common/phi2z");n.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=r(this.e,Math.sin(this.lat_ts),Math.cos(this.lat_ts)):this.k0||(this.k?this.k0=this.k:this.k0=1)},n.forward=function(t){var e=t.x,n=t.y;if(n*s>90&&-90>n*s&&e*s>180&&-180>e*s)return null;var r,h;if(Math.abs(Math.abs(n)-o)<=i)return null;if(this.sphere)r=this.x0+this.a*this.k0*a(e-this.long0),h=this.y0+this.a*this.k0*Math.log(Math.tan(l+.5*n));else{var c=Math.sin(n),p=u(this.e,n,c);r=this.x0+this.a*this.k0*a(e-this.long0),h=this.y0-this.a*this.k0*Math.log(p)}return t.x=r,t.y=h,t},n.inverse=function(t){var e,n,r=t.x-this.x0,i=t.y-this.y0;if(this.sphere)n=o-2*Math.atan(Math.exp(-i/(this.a*this.k0)));else{var s=Math.exp(-i/(this.a*this.k0));if(n=h(this.e,s),-9999===n)return null}return e=a(this.long0+r/(this.a*this.k0)),t.x=e,t.y=n,t},n.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/projections/mill":[function(t,e,n){var r=t("../common/adjust_lon");n.init=function(){},n.forward=function(t){var e=t.x,n=t.y,o=r(e-this.long0),i=this.x0+this.a*o,s=this.y0+this.a*Math.log(Math.tan(Math.PI/4+n/2.5))*1.25;return t.x=i,t.y=s,t},n.inverse=function(t){t.x-=this.x0,t.y-=this.y0;var e=r(this.long0+t.x/this.a),n=2.5*(Math.atan(Math.exp(.8*t.y/this.a))-Math.PI/4);return t.x=e,t.y=n,t},n.names=["Miller_Cylindrical","mill"]},{"../common/adjust_lon":"proj4/lib/common/adjust_lon"}],"proj4/lib/projections/moll":[function(t,e,n){var r=t("../common/adjust_lon"),o=1e-10;n.init=function(){},n.forward=function(t){for(var e=t.x,n=t.y,i=r(e-this.long0),s=n,a=Math.PI*Math.sin(n),l=0;!0;l++){var u=-(s+Math.sin(s)-a)/(1+Math.cos(s));if(s+=u,Math.abs(u)<o)break}s/=2,Math.PI/2-Math.abs(n)<o&&(i=0);var h=.900316316158*this.a*i*Math.cos(s)+this.x0,c=1.4142135623731*this.a*Math.sin(s)+this.y0;return t.x=h,t.y=c,t},n.inverse=function(t){var e,n;t.x-=this.x0,t.y-=this.y0,n=t.y/(1.4142135623731*this.a),Math.abs(n)>.999999999999&&(n=.999999999999),e=Math.asin(n);var o=r(this.long0+t.x/(.900316316158*this.a*Math.cos(e)));o<-Math.PI&&(o=-Math.PI),o>Math.PI&&(o=Math.PI),n=(2*e+Math.sin(2*e))/Math.PI,Math.abs(n)>1&&(n=1);var i=Math.asin(n);return t.x=o,t.y=i,t},n.names=["Mollweide","moll"]},{"../common/adjust_lon":"proj4/lib/common/adjust_lon"}],"proj4/lib/projections/nzmg":[function(t,e,n){var r=484813681109536e-20;n.iterations=1,n.init=function(){this.A=[],this.A[1]=.6399175073,this.A[2]=-.1358797613,this.A[3]=.063294409,this.A[4]=-.02526853,this.A[5]=.0117879,this.A[6]=-.0055161,this.A[7]=.0026906,this.A[8]=-.001333,this.A[9]=67e-5,this.A[10]=-34e-5,this.B_re=[],this.B_im=[],this.B_re[1]=.7557853228,this.B_im[1]=0,this.B_re[2]=.249204646,this.B_im[2]=.003371507,this.B_re[3]=-.001541739,this.B_im[3]=.04105856,this.B_re[4]=-.10162907,this.B_im[4]=.01727609,this.B_re[5]=-.26623489,this.B_im[5]=-.36249218,this.B_re[6]=-.6870983,this.B_im[6]=-1.1651967,this.C_re=[],this.C_im=[],this.C_re[1]=1.3231270439,this.C_im[1]=0,this.C_re[2]=-.577245789,this.C_im[2]=-.007809598,this.C_re[3]=.508307513,this.C_im[3]=-.112208952,this.C_re[4]=-.15094762,this.C_im[4]=.18200602,this.C_re[5]=1.01418179,this.C_im[5]=1.64497696,this.C_re[6]=1.9660549,this.C_im[6]=2.5127645,this.D=[],this.D[1]=1.5627014243,this.D[2]=.5185406398,this.D[3]=-.03333098,this.D[4]=-.1052906,this.D[5]=-.0368594,this.D[6]=.007317,this.D[7]=.0122,this.D[8]=.00394,this.D[9]=-.0013},n.forward=function(t){var e,n=t.x,o=t.y,i=o-this.lat0,s=n-this.long0,a=i/r*1e-5,l=s,u=1,h=0;for(e=1;10>=e;e++)u*=a,h+=this.A[e]*u;var c,p,_=h,d=l,f=1,m=0,g=0,y=0;for(e=1;6>=e;e++)c=f*_-m*d,p=m*_+f*d,f=c,m=p,g=g+this.B_re[e]*f-this.B_im[e]*m,y=y+this.B_im[e]*f+this.B_re[e]*m;return t.x=y*this.a+this.x0,t.y=g*this.a+this.y0,t},n.inverse=function(t){var e,n,o,i=t.x,s=t.y,a=i-this.x0,l=s-this.y0,u=l/this.a,h=a/this.a,c=1,p=0,_=0,d=0;for(e=1;6>=e;e++)n=c*u-p*h,o=p*u+c*h,c=n,p=o,_=_+this.C_re[e]*c-this.C_im[e]*p,d=d+this.C_im[e]*c+this.C_re[e]*p;for(var f=0;f<this.iterations;f++){var m,g,y=_,v=d,b=u,x=h;for(e=2;6>=e;e++)m=y*_-v*d,g=v*_+y*d,y=m,v=g,b+=(e-1)*(this.B_re[e]*y-this.B_im[e]*v),x+=(e-1)*(this.B_im[e]*y+this.B_re[e]*v);y=1,v=0;var w=this.B_re[1],k=this.B_im[1];for(e=2;6>=e;e++)m=y*_-v*d,g=v*_+y*d,y=m,v=g,w+=e*(this.B_re[e]*y-this.B_im[e]*v),k+=e*(this.B_im[e]*y+this.B_re[e]*v);var M=w*w+k*k;_=(b*w+x*k)/M,d=(x*w-b*k)/M}var j=_,T=d,z=1,E=0;for(e=1;9>=e;e++)z*=j,E+=this.D[e]*z;var P=this.lat0+E*r*1e5,S=this.long0+T;return t.x=S,t.y=P,t},n.names=["New_Zealand_Map_Grid","nzmg"]},{}],"proj4/lib/projections/omerc":[function(t,e,n){var r=t("../common/tsfnz"),o=t("../common/adjust_lon"),i=t("../common/phi2z"),s=Math.PI/2,a=Math.PI/4,l=1e-10;n.init=function(){this.no_off=this.no_off||!1,this.no_rot=this.no_rot||!1,isNaN(this.k0)&&(this.k0=1);var t=Math.sin(this.lat0),e=Math.cos(this.lat0),n=this.e*t;this.bl=Math.sqrt(1+this.es/(1-this.es)*Math.pow(e,4)),this.al=this.a*this.bl*this.k0*Math.sqrt(1-this.es)/(1-n*n);var i=r(this.e,this.lat0,t),s=this.bl/e*Math.sqrt((1-this.es)/(1-n*n));1>s*s&&(s=1);var a,l;
|
|
if(isNaN(this.longc)){var u=r(this.e,this.lat1,Math.sin(this.lat1)),h=r(this.e,this.lat2,Math.sin(this.lat2));this.lat0>=0?this.el=(s+Math.sqrt(s*s-1))*Math.pow(i,this.bl):this.el=(s-Math.sqrt(s*s-1))*Math.pow(i,this.bl);var c=Math.pow(u,this.bl),p=Math.pow(h,this.bl);a=this.el/c,l=.5*(a-1/a);var _=(this.el*this.el-p*c)/(this.el*this.el+p*c),d=(p-c)/(p+c),f=o(this.long1-this.long2);this.long0=.5*(this.long1+this.long2)-Math.atan(_*Math.tan(.5*this.bl*f)/d)/this.bl,this.long0=o(this.long0);var m=o(this.long1-this.long0);this.gamma0=Math.atan(Math.sin(this.bl*m)/l),this.alpha=Math.asin(s*Math.sin(this.gamma0))}else a=this.lat0>=0?s+Math.sqrt(s*s-1):s-Math.sqrt(s*s-1),this.el=a*Math.pow(i,this.bl),l=.5*(a-1/a),this.gamma0=Math.asin(Math.sin(this.alpha)/s),this.long0=this.longc-Math.asin(l*Math.tan(this.gamma0))/this.bl;this.no_off?this.uc=0:this.lat0>=0?this.uc=this.al/this.bl*Math.atan2(Math.sqrt(s*s-1),Math.cos(this.alpha)):this.uc=-1*this.al/this.bl*Math.atan2(Math.sqrt(s*s-1),Math.cos(this.alpha))},n.forward=function(t){var e,n,i,u=t.x,h=t.y,c=o(u-this.long0);if(Math.abs(Math.abs(h)-s)<=l)i=h>0?-1:1,n=this.al/this.bl*Math.log(Math.tan(a+i*this.gamma0*.5)),e=-1*i*s*this.al/this.bl;else{var p=r(this.e,h,Math.sin(h)),_=this.el/Math.pow(p,this.bl),d=.5*(_-1/_),f=.5*(_+1/_),m=Math.sin(this.bl*c),g=(d*Math.sin(this.gamma0)-m*Math.cos(this.gamma0))/f;n=Math.abs(Math.abs(g)-1)<=l?Number.POSITIVE_INFINITY:.5*this.al*Math.log((1-g)/(1+g))/this.bl,e=Math.abs(Math.cos(this.bl*c))<=l?this.al*this.bl*c:this.al*Math.atan2(d*Math.cos(this.gamma0)+m*Math.sin(this.gamma0),Math.cos(this.bl*c))/this.bl}return this.no_rot?(t.x=this.x0+e,t.y=this.y0+n):(e-=this.uc,t.x=this.x0+n*Math.cos(this.alpha)+e*Math.sin(this.alpha),t.y=this.y0+e*Math.cos(this.alpha)-n*Math.sin(this.alpha)),t},n.inverse=function(t){var e,n;this.no_rot?(n=t.y-this.y0,e=t.x-this.x0):(n=(t.x-this.x0)*Math.cos(this.alpha)-(t.y-this.y0)*Math.sin(this.alpha),e=(t.y-this.y0)*Math.cos(this.alpha)+(t.x-this.x0)*Math.sin(this.alpha),e+=this.uc);var r=Math.exp(-1*this.bl*n/this.al),a=.5*(r-1/r),u=.5*(r+1/r),h=Math.sin(this.bl*e/this.al),c=(h*Math.cos(this.gamma0)+a*Math.sin(this.gamma0))/u,p=Math.pow(this.el/Math.sqrt((1+c)/(1-c)),1/this.bl);return Math.abs(c-1)<l?(t.x=this.long0,t.y=s):Math.abs(c+1)<l?(t.x=this.long0,t.y=-1*s):(t.y=i(this.e,p),t.x=o(this.long0-Math.atan2(a*Math.cos(this.gamma0)-h*Math.sin(this.gamma0),Math.cos(this.bl*e/this.al))/this.bl)),t},n.names=["Hotine_Oblique_Mercator","Hotine Oblique Mercator","Hotine_Oblique_Mercator_Azimuth_Natural_Origin","Hotine_Oblique_Mercator_Azimuth_Center","omerc"]},{"../common/adjust_lon":"proj4/lib/common/adjust_lon","../common/phi2z":"proj4/lib/common/phi2z","../common/tsfnz":"proj4/lib/common/tsfnz"}],"proj4/lib/projections/poly":[function(t,e,n){var r=t("../common/e0fn"),o=t("../common/e1fn"),i=t("../common/e2fn"),s=t("../common/e3fn"),a=t("../common/adjust_lon"),l=t("../common/adjust_lat"),u=t("../common/mlfn"),h=1e-10,c=t("../common/gN"),p=20;n.init=function(){this.temp=this.b/this.a,this.es=1-Math.pow(this.temp,2),this.e=Math.sqrt(this.es),this.e0=r(this.es),this.e1=o(this.es),this.e2=i(this.es),this.e3=s(this.es),this.ml0=this.a*u(this.e0,this.e1,this.e2,this.e3,this.lat0)},n.forward=function(t){var e,n,r,o=t.x,i=t.y,s=a(o-this.long0);if(r=s*Math.sin(i),this.sphere)Math.abs(i)<=h?(e=this.a*s,n=-1*this.a*this.lat0):(e=this.a*Math.sin(r)/Math.tan(i),n=this.a*(l(i-this.lat0)+(1-Math.cos(r))/Math.tan(i)));else if(Math.abs(i)<=h)e=this.a*s,n=-1*this.ml0;else{var p=c(this.a,this.e,Math.sin(i))/Math.tan(i);e=p*Math.sin(r),n=this.a*u(this.e0,this.e1,this.e2,this.e3,i)-this.ml0+p*(1-Math.cos(r))}return t.x=e+this.x0,t.y=n+this.y0,t},n.inverse=function(t){var e,n,r,o,i,s,l,c,_;if(r=t.x-this.x0,o=t.y-this.y0,this.sphere)if(Math.abs(o+this.a*this.lat0)<=h)e=a(r/this.a+this.long0),n=0;else{s=this.lat0+o/this.a,l=r*r/this.a/this.a+s*s,c=s;var d;for(i=p;i;--i)if(d=Math.tan(c),_=-1*(s*(c*d+1)-c-.5*(c*c+l)*d)/((c-s)/d-1),c+=_,Math.abs(_)<=h){n=c;break}e=a(this.long0+Math.asin(r*Math.tan(c)/this.a)/Math.sin(n))}else if(Math.abs(o+this.ml0)<=h)n=0,e=a(this.long0+r/this.a);else{s=(this.ml0+o)/this.a,l=r*r/this.a/this.a+s*s,c=s;var f,m,g,y,v;for(i=p;i;--i)if(v=this.e*Math.sin(c),f=Math.sqrt(1-v*v)*Math.tan(c),m=this.a*u(this.e0,this.e1,this.e2,this.e3,c),g=this.e0-2*this.e1*Math.cos(2*c)+4*this.e2*Math.cos(4*c)-6*this.e3*Math.cos(6*c),y=m/this.a,_=(s*(f*y+1)-y-.5*f*(y*y+l))/(this.es*Math.sin(2*c)*(y*y+l-2*s*y)/(4*f)+(s-y)*(f*g-2/Math.sin(2*c))-g),c-=_,Math.abs(_)<=h){n=c;break}f=Math.sqrt(1-this.es*Math.pow(Math.sin(n),2))*Math.tan(n),e=a(this.long0+Math.asin(r*f/this.a)/Math.sin(n))}return t.x=e,t.y=n,t},n.names=["Polyconic","poly"]},{"../common/adjust_lat":"proj4/lib/common/adjust_lat","../common/adjust_lon":"proj4/lib/common/adjust_lon","../common/e0fn":"proj4/lib/common/e0fn","../common/e1fn":"proj4/lib/common/e1fn","../common/e2fn":"proj4/lib/common/e2fn","../common/e3fn":"proj4/lib/common/e3fn","../common/gN":"proj4/lib/common/gN","../common/mlfn":"proj4/lib/common/mlfn"}],"proj4/lib/projections/sinu":[function(t,e,n){var r=t("../common/adjust_lon"),o=t("../common/adjust_lat"),i=t("../common/pj_enfn"),s=20,a=t("../common/pj_mlfn"),l=t("../common/pj_inv_mlfn"),u=Math.PI/2,h=1e-10,c=t("../common/asinz");n.init=function(){this.sphere?(this.n=1,this.m=0,this.es=0,this.C_y=Math.sqrt((this.m+1)/this.n),this.C_x=this.C_y/(this.m+1)):this.en=i(this.es)},n.forward=function(t){var e,n,o=t.x,i=t.y;if(o=r(o-this.long0),this.sphere){if(this.m)for(var l=this.n*Math.sin(i),u=s;u;--u){var c=(this.m*i+Math.sin(i)-l)/(this.m+Math.cos(i));if(i-=c,Math.abs(c)<h)break}else i=1!==this.n?Math.asin(this.n*Math.sin(i)):i;e=this.a*this.C_x*o*(this.m+Math.cos(i)),n=this.a*this.C_y*i}else{var p=Math.sin(i),_=Math.cos(i);n=this.a*a(i,p,_,this.en),e=this.a*o*_/Math.sqrt(1-this.es*p*p)}return t.x=e,t.y=n,t},n.inverse=function(t){var e,n,i,s;return t.x-=this.x0,i=t.x/this.a,t.y-=this.y0,e=t.y/this.a,this.sphere?(e/=this.C_y,i/=this.C_x*(this.m+Math.cos(e)),this.m?e=c((this.m*e+Math.sin(e))/this.n):1!==this.n&&(e=c(Math.sin(e)/this.n)),i=r(i+this.long0),e=o(e)):(e=l(t.y/this.a,this.es,this.en),s=Math.abs(e),u>s?(s=Math.sin(e),n=this.long0+t.x*Math.sqrt(1-this.es*s*s)/(this.a*Math.cos(e)),i=r(n)):u>s-h&&(i=this.long0)),t.x=i,t.y=e,t},n.names=["Sinusoidal","sinu"]},{"../common/adjust_lat":"proj4/lib/common/adjust_lat","../common/adjust_lon":"proj4/lib/common/adjust_lon","../common/asinz":"proj4/lib/common/asinz","../common/pj_enfn":"proj4/lib/common/pj_enfn","../common/pj_inv_mlfn":"proj4/lib/common/pj_inv_mlfn","../common/pj_mlfn":"proj4/lib/common/pj_mlfn"}],"proj4/lib/projections/somerc":[function(t,e,n){n.init=function(){var t=this.lat0;this.lambda0=this.long0;var e=Math.sin(t),n=this.a,r=this.rf,o=1/r,i=2*o-Math.pow(o,2),s=this.e=Math.sqrt(i);this.R=this.k0*n*Math.sqrt(1-i)/(1-i*Math.pow(e,2)),this.alpha=Math.sqrt(1+i/(1-i)*Math.pow(Math.cos(t),4)),this.b0=Math.asin(e/this.alpha);var a=Math.log(Math.tan(Math.PI/4+this.b0/2)),l=Math.log(Math.tan(Math.PI/4+t/2)),u=Math.log((1+s*e)/(1-s*e));this.K=a-this.alpha*l+this.alpha*s/2*u},n.forward=function(t){var e=Math.log(Math.tan(Math.PI/4-t.y/2)),n=this.e/2*Math.log((1+this.e*Math.sin(t.y))/(1-this.e*Math.sin(t.y))),r=-this.alpha*(e+n)+this.K,o=2*(Math.atan(Math.exp(r))-Math.PI/4),i=this.alpha*(t.x-this.lambda0),s=Math.atan(Math.sin(i)/(Math.sin(this.b0)*Math.tan(o)+Math.cos(this.b0)*Math.cos(i))),a=Math.asin(Math.cos(this.b0)*Math.sin(o)-Math.sin(this.b0)*Math.cos(o)*Math.cos(i));return t.y=this.R/2*Math.log((1+Math.sin(a))/(1-Math.sin(a)))+this.y0,t.x=this.R*s+this.x0,t},n.inverse=function(t){for(var e=t.x-this.x0,n=t.y-this.y0,r=e/this.R,o=2*(Math.atan(Math.exp(n/this.R))-Math.PI/4),i=Math.asin(Math.cos(this.b0)*Math.sin(o)+Math.sin(this.b0)*Math.cos(o)*Math.cos(r)),s=Math.atan(Math.sin(r)/(Math.cos(this.b0)*Math.cos(r)-Math.sin(this.b0)*Math.tan(o))),a=this.lambda0+s/this.alpha,l=0,u=i,h=-1e3,c=0;Math.abs(u-h)>1e-7;){if(++c>20)return;l=1/this.alpha*(Math.log(Math.tan(Math.PI/4+i/2))-this.K)+this.e*Math.log(Math.tan(Math.PI/4+Math.asin(this.e*Math.sin(u))/2)),h=u,u=2*Math.atan(Math.exp(l))-Math.PI/2}return t.x=a,t.y=u,t},n.names=["somerc"]},{}],"proj4/lib/projections/stere":[function(t,e,n){var r=Math.PI/2,o=1e-10,i=t("../common/sign"),s=t("../common/msfnz"),a=t("../common/tsfnz"),l=t("../common/phi2z"),u=t("../common/adjust_lon");n.ssfn_=function(t,e,n){return e*=n,Math.tan(.5*(r+t))*Math.pow((1-e)/(1+e),.5*n)},n.init=function(){this.coslat0=Math.cos(this.lat0),this.sinlat0=Math.sin(this.lat0),this.sphere?1===this.k0&&!isNaN(this.lat_ts)&&Math.abs(this.coslat0)<=o&&(this.k0=.5*(1+i(this.lat0)*Math.sin(this.lat_ts))):(Math.abs(this.coslat0)<=o&&(this.lat0>0?this.con=1:this.con=-1),this.cons=Math.sqrt(Math.pow(1+this.e,1+this.e)*Math.pow(1-this.e,1-this.e)),1===this.k0&&!isNaN(this.lat_ts)&&Math.abs(this.coslat0)<=o&&(this.k0=.5*this.cons*s(this.e,Math.sin(this.lat_ts),Math.cos(this.lat_ts))/a(this.e,this.con*this.lat_ts,this.con*Math.sin(this.lat_ts))),this.ms1=s(this.e,this.sinlat0,this.coslat0),this.X0=2*Math.atan(this.ssfn_(this.lat0,this.sinlat0,this.e))-r,this.cosX0=Math.cos(this.X0),this.sinX0=Math.sin(this.X0))},n.forward=function(t){var e,n,i,s,l,h,c=t.x,p=t.y,_=Math.sin(p),d=Math.cos(p),f=u(c-this.long0);return Math.abs(Math.abs(c-this.long0)-Math.PI)<=o&&Math.abs(p+this.lat0)<=o?(t.x=NaN,t.y=NaN,t):this.sphere?(e=2*this.k0/(1+this.sinlat0*_+this.coslat0*d*Math.cos(f)),t.x=this.a*e*d*Math.sin(f)+this.x0,t.y=this.a*e*(this.coslat0*_-this.sinlat0*d*Math.cos(f))+this.y0,t):(n=2*Math.atan(this.ssfn_(p,_,this.e))-r,s=Math.cos(n),i=Math.sin(n),Math.abs(this.coslat0)<=o?(l=a(this.e,p*this.con,this.con*_),h=2*this.a*this.k0*l/this.cons,t.x=this.x0+h*Math.sin(c-this.long0),t.y=this.y0-this.con*h*Math.cos(c-this.long0),t):(Math.abs(this.sinlat0)<o?(e=2*this.a*this.k0/(1+s*Math.cos(f)),t.y=e*i):(e=2*this.a*this.k0*this.ms1/(this.cosX0*(1+this.sinX0*i+this.cosX0*s*Math.cos(f))),t.y=e*(this.cosX0*i-this.sinX0*s*Math.cos(f))+this.y0),t.x=e*s*Math.sin(f)+this.x0,t))},n.inverse=function(t){t.x-=this.x0,t.y-=this.y0;var e,n,i,s,a,h=Math.sqrt(t.x*t.x+t.y*t.y);if(this.sphere){var c=2*Math.atan(h/(.5*this.a*this.k0));return e=this.long0,n=this.lat0,o>=h?(t.x=e,t.y=n,t):(n=Math.asin(Math.cos(c)*this.sinlat0+t.y*Math.sin(c)*this.coslat0/h),e=u(Math.abs(this.coslat0)<o?this.lat0>0?this.long0+Math.atan2(t.x,-1*t.y):this.long0+Math.atan2(t.x,t.y):this.long0+Math.atan2(t.x*Math.sin(c),h*this.coslat0*Math.cos(c)-t.y*this.sinlat0*Math.sin(c))),t.x=e,t.y=n,t)}if(Math.abs(this.coslat0)<=o){if(o>=h)return n=this.lat0,e=this.long0,t.x=e,t.y=n,t;t.x*=this.con,t.y*=this.con,i=h*this.cons/(2*this.a*this.k0),n=this.con*l(this.e,i),e=this.con*u(this.con*this.long0+Math.atan2(t.x,-1*t.y))}else s=2*Math.atan(h*this.cosX0/(2*this.a*this.k0*this.ms1)),e=this.long0,o>=h?a=this.X0:(a=Math.asin(Math.cos(s)*this.sinX0+t.y*Math.sin(s)*this.cosX0/h),e=u(this.long0+Math.atan2(t.x*Math.sin(s),h*this.cosX0*Math.cos(s)-t.y*this.sinX0*Math.sin(s)))),n=-1*l(this.e,Math.tan(.5*(r+a)));return t.x=e,t.y=n,t},n.names=["stere","Stereographic_South_Pole","Polar Stereographic (variant B)"]},{"../common/adjust_lon":"proj4/lib/common/adjust_lon","../common/msfnz":"proj4/lib/common/msfnz","../common/phi2z":"proj4/lib/common/phi2z","../common/sign":"proj4/lib/common/sign","../common/tsfnz":"proj4/lib/common/tsfnz"}],"proj4/lib/projections/sterea":[function(t,e,n){var r=t("./gauss"),o=t("../common/adjust_lon");n.init=function(){r.init.apply(this),this.rc&&(this.sinc0=Math.sin(this.phic0),this.cosc0=Math.cos(this.phic0),this.R2=2*this.rc,this.title||(this.title="Oblique Stereographic Alternative"))},n.forward=function(t){var e,n,i,s;return t.x=o(t.x-this.long0),r.forward.apply(this,[t]),e=Math.sin(t.y),n=Math.cos(t.y),i=Math.cos(t.x),s=this.k0*this.R2/(1+this.sinc0*e+this.cosc0*n*i),t.x=s*n*Math.sin(t.x),t.y=s*(this.cosc0*e-this.sinc0*n*i),t.x=this.a*t.x+this.x0,t.y=this.a*t.y+this.y0,t},n.inverse=function(t){var e,n,i,s,a;if(t.x=(t.x-this.x0)/this.a,t.y=(t.y-this.y0)/this.a,t.x/=this.k0,t.y/=this.k0,a=Math.sqrt(t.x*t.x+t.y*t.y)){var l=2*Math.atan2(a,this.R2);e=Math.sin(l),n=Math.cos(l),s=Math.asin(n*this.sinc0+t.y*e*this.cosc0/a),i=Math.atan2(t.x*e,a*this.cosc0*n-t.y*this.sinc0*e)}else s=this.phic0,i=0;return t.x=i,t.y=s,r.inverse.apply(this,[t]),t.x=o(t.x+this.long0),t},n.names=["Stereographic_North_Pole","Oblique_Stereographic","Polar_Stereographic","sterea","Oblique Stereographic Alternative"]},{"../common/adjust_lon":"proj4/lib/common/adjust_lon","./gauss":"proj4/lib/projections/gauss"}],"proj4/lib/projections/tmerc":[function(t,e,n){var r=t("../common/e0fn"),o=t("../common/e1fn"),i=t("../common/e2fn"),s=t("../common/e3fn"),a=t("../common/mlfn"),l=t("../common/adjust_lon"),u=Math.PI/2,h=1e-10,c=t("../common/sign"),p=t("../common/asinz");n.init=function(){this.e0=r(this.es),this.e1=o(this.es),this.e2=i(this.es),this.e3=s(this.es),this.ml0=this.a*a(this.e0,this.e1,this.e2,this.e3,this.lat0)},n.forward=function(t){var e,n,r,o=t.x,i=t.y,s=l(o-this.long0),u=Math.sin(i),h=Math.cos(i);if(this.sphere){var c=h*Math.sin(s);if(Math.abs(Math.abs(c)-1)<1e-10)return 93;n=.5*this.a*this.k0*Math.log((1+c)/(1-c)),e=Math.acos(h*Math.cos(s)/Math.sqrt(1-c*c)),0>i&&(e=-e),r=this.a*this.k0*(e-this.lat0)}else{var p=h*s,_=Math.pow(p,2),d=this.ep2*Math.pow(h,2),f=Math.tan(i),m=Math.pow(f,2);e=1-this.es*Math.pow(u,2);var g=this.a/Math.sqrt(e),y=this.a*a(this.e0,this.e1,this.e2,this.e3,i);n=this.k0*g*p*(1+_/6*(1-m+d+_/20*(5-18*m+Math.pow(m,2)+72*d-58*this.ep2)))+this.x0,r=this.k0*(y-this.ml0+g*f*(_*(.5+_/24*(5-m+9*d+4*Math.pow(d,2)+_/30*(61-58*m+Math.pow(m,2)+600*d-330*this.ep2)))))+this.y0}return t.x=n,t.y=r,t},n.inverse=function(t){var e,n,r,o,i,s,a=6;if(this.sphere){var _=Math.exp(t.x/(this.a*this.k0)),d=.5*(_-1/_),f=this.lat0+t.y/(this.a*this.k0),m=Math.cos(f);e=Math.sqrt((1-m*m)/(1+d*d)),i=p(e),0>f&&(i=-i),s=0===d&&0===m?this.long0:l(Math.atan2(d,m)+this.long0)}else{var g=t.x-this.x0,y=t.y-this.y0;for(e=(this.ml0+y/this.k0)/this.a,n=e,o=0;!0&&(r=(e+this.e1*Math.sin(2*n)-this.e2*Math.sin(4*n)+this.e3*Math.sin(6*n))/this.e0-n,n+=r,!(Math.abs(r)<=h));o++)if(o>=a)return 95;if(Math.abs(n)<u){var v=Math.sin(n),b=Math.cos(n),x=Math.tan(n),w=this.ep2*Math.pow(b,2),k=Math.pow(w,2),M=Math.pow(x,2),j=Math.pow(M,2);e=1-this.es*Math.pow(v,2);var T=this.a/Math.sqrt(e),z=T*(1-this.es)/e,E=g/(T*this.k0),P=Math.pow(E,2);i=n-T*x*P/z*(.5-P/24*(5+3*M+10*w-4*k-9*this.ep2-P/30*(61+90*M+298*w+45*j-252*this.ep2-3*k))),s=l(this.long0+E*(1-P/6*(1+2*M+w-P/20*(5-2*w+28*M-3*k+8*this.ep2+24*j)))/b)}else i=u*c(y),s=this.long0}return t.x=s,t.y=i,t},n.names=["Transverse_Mercator","Transverse Mercator","tmerc"]},{"../common/adjust_lon":"proj4/lib/common/adjust_lon","../common/asinz":"proj4/lib/common/asinz","../common/e0fn":"proj4/lib/common/e0fn","../common/e1fn":"proj4/lib/common/e1fn","../common/e2fn":"proj4/lib/common/e2fn","../common/e3fn":"proj4/lib/common/e3fn","../common/mlfn":"proj4/lib/common/mlfn","../common/sign":"proj4/lib/common/sign"}],"proj4/lib/projections/utm":[function(t,e,n){var r=.017453292519943295,o=t("./tmerc");n.dependsOn="tmerc",n.init=function(){this.zone&&(this.lat0=0,this.long0=(6*Math.abs(this.zone)-183)*r,this.x0=5e5,this.y0=this.utmSouth?1e7:0,this.k0=.9996,o.init.apply(this),this.forward=o.forward,this.inverse=o.inverse)},n.names=["Universal Transverse Mercator System","utm"]},{"./tmerc":"proj4/lib/projections/tmerc"}],"proj4/lib/projections/vandg":[function(t,e,n){var r=t("../common/adjust_lon"),o=Math.PI/2,i=1e-10,s=t("../common/asinz");n.init=function(){this.R=this.a},n.forward=function(t){var e,n,a=t.x,l=t.y,u=r(a-this.long0);Math.abs(l)<=i&&(e=this.x0+this.R*u,n=this.y0);var h=s(2*Math.abs(l/Math.PI));(Math.abs(u)<=i||Math.abs(Math.abs(l)-o)<=i)&&(e=this.x0,n=l>=0?this.y0+Math.PI*this.R*Math.tan(.5*h):this.y0+Math.PI*this.R*-Math.tan(.5*h));var c=.5*Math.abs(Math.PI/u-u/Math.PI),p=c*c,_=Math.sin(h),d=Math.cos(h),f=d/(_+d-1),m=f*f,g=f*(2/_-1),y=g*g,v=Math.PI*this.R*(c*(f-y)+Math.sqrt(p*(f-y)*(f-y)-(y+p)*(m-y)))/(y+p);0>u&&(v=-v),e=this.x0+v;var b=p+f;return v=Math.PI*this.R*(g*b-c*Math.sqrt((y+p)*(p+1)-b*b))/(y+p),n=l>=0?this.y0+v:this.y0-v,t.x=e,t.y=n,t},n.inverse=function(t){var e,n,o,s,a,l,u,h,c,p,_,d,f;return t.x-=this.x0,t.y-=this.y0,_=Math.PI*this.R,o=t.x/_,s=t.y/_,a=o*o+s*s,l=-Math.abs(s)*(1+a),u=l-2*s*s+o*o,h=-2*l+1+2*s*s+a*a,f=s*s/h+(2*u*u*u/h/h/h-9*l*u/h/h)/27,c=(l-u*u/3/h)/h,p=2*Math.sqrt(-c/3),_=3*f/c/p,Math.abs(_)>1&&(_=_>=0?1:-1),d=Math.acos(_)/3,n=t.y>=0?(-p*Math.cos(d+Math.PI/3)-u/3/h)*Math.PI:-(-p*Math.cos(d+Math.PI/3)-u/3/h)*Math.PI,e=Math.abs(o)<i?this.long0:r(this.long0+Math.PI*(a-1+Math.sqrt(1+2*(o*o-s*s)+a*a))/2/o),t.x=e,t.y=n,t},n.names=["Van_der_Grinten_I","VanDerGrinten","vandg"]},{"../common/adjust_lon":"proj4/lib/common/adjust_lon","../common/asinz":"proj4/lib/common/asinz"}],"proj4/lib/transform":[function(t,e,n){var r=.017453292519943295,o=57.29577951308232,i=1,s=2,a=t("./datum_transform"),l=t("./adjust_axis"),u=t("./Proj"),h=t("./common/toPoint");e.exports=function c(t,e,n){function p(t,e){return(t.datum.datum_type===i||t.datum.datum_type===s)&&"WGS84"!==e.datumCode}var _;return Array.isArray(n)&&(n=h(n)),t.datum&&e.datum&&(p(t,e)||p(e,t))&&(_=new u("WGS84"),c(t,_,n),t=_),"enu"!==t.axis&&l(t,!1,n),"longlat"===t.projName?(n.x*=r,n.y*=r):(t.to_meter&&(n.x*=t.to_meter,n.y*=t.to_meter),t.inverse(n)),t.from_greenwich&&(n.x+=t.from_greenwich),n=a(t.datum,e.datum,n),e.from_greenwich&&(n.x-=e.from_greenwich),"longlat"===e.projName?(n.x*=o,n.y*=o):(e.forward(n),e.to_meter&&(n.x/=e.to_meter,n.y/=e.to_meter)),"enu"!==e.axis&&l(e,!0,n),n}},{"./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,n){function r(t,e,n){t[e]=n.map(function(t){var e={};return o(t,e),e}).reduce(function(t,e){return u(t,e)},{})}function o(t,e){var n;return Array.isArray(t)?(n=t.shift(),"PARAMETER"===n&&(n=t.shift()),1===t.length?Array.isArray(t[0])?(e[n]={},o(t[0],e[n])):e[n]=t[0]:t.length?"TOWGS84"===n?e[n]=t:(e[n]={},["UNIT","PRIMEM","VERT_DATUM"].indexOf(n)>-1?(e[n]={name:t[0].toLowerCase(),convert:t[1]},3===t.length&&(e[n].auth=t[2])):"SPHEROID"===n?(e[n]={name:t[0],a:t[1],rf:t[2]},4===t.length&&(e[n].auth=t[3])):["GEOGCS","GEOCCS","DATUM","VERT_CS","COMPD_CS","LOCAL_CS","FITTED_CS","LOCAL_DATUM"].indexOf(n)>-1?(t[0]=["name",t[0]],r(e,n,t)):t.every(function(t){return Array.isArray(t)})?r(e,n,t):o(t,e[n])):e[n]=!0,void 0):void(e[t]=!0)}function i(t,e){var n=e[0],r=e[1];!(n in t)&&r in t&&(t[n]=t[r],3===e.length&&(t[n]=e[2](t[n])))}function s(t){return t*l}function a(t){function e(e){var n=t.to_meter||1;return parseFloat(e,10)*n}"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 n=function(e){return i(t,e)},r=[["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"]];r.forEach(n),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 n=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".+/,"")),r=n.shift(),i=n.shift();n.unshift(["name",i]),n.unshift(["type",r]),n.unshift("output");var s={};return o(n,s),a(s.output),u(e,s.output)}},{"./extend":"proj4/lib/extend"}],"proj4/node_modules/mgrs/mgrs":[function(t,e,n){function r(t){return t*(Math.PI/180)}function o(t){return 180*(t/Math.PI)}function i(t){var e,n,o,i,s,l,u,h,c,p=t.lat,_=t.lon,d=6378137,f=.00669438,m=.9996,g=r(p),y=r(_);c=Math.floor((_+180)/6)+1,180===_&&(c=60),p>=56&&64>p&&_>=3&&12>_&&(c=32),p>=72&&84>p&&(_>=0&&9>_?c=31:_>=9&&21>_?c=33:_>=21&&33>_?c=35:_>=33&&42>_&&(c=37)),e=6*(c-1)-180+3,h=r(e),n=f/(1-f),o=d/Math.sqrt(1-f*Math.sin(g)*Math.sin(g)),i=Math.tan(g)*Math.tan(g),s=n*Math.cos(g)*Math.cos(g),l=Math.cos(g)*(y-h),u=d*((1-f/4-3*f*f/64-5*f*f*f/256)*g-(3*f/8+3*f*f/32+45*f*f*f/1024)*Math.sin(2*g)+(15*f*f/256+45*f*f*f/1024)*Math.sin(4*g)-35*f*f*f/3072*Math.sin(6*g));var v=m*o*(l+(1-i+s)*l*l*l/6+(5-18*i+i*i+72*s-58*n)*l*l*l*l*l/120)+5e5,b=m*(u+o*Math.tan(g)*(l*l/2+(5-i+9*s+4*s*s)*l*l*l*l/24+(61-58*i+i*i+600*s-330*n)*l*l*l*l*l*l/720));return 0>p&&(b+=1e7),{northing:Math.round(b),easting:Math.round(v),zoneNumber:c,zoneLetter:a(p)}}function s(t){var e=t.northing,n=t.easting,r=t.zoneLetter,i=t.zoneNumber;if(0>i||i>60)return null;var a,l,u,h,c,p,_,d,f,m,g=.9996,y=6378137,v=.00669438,b=(1-Math.sqrt(1-v))/(1+Math.sqrt(1-v)),x=n-5e5,w=e;"N">r&&(w-=1e7),d=6*(i-1)-180+3,a=v/(1-v),_=w/g,f=_/(y*(1-v/4-3*v*v/64-5*v*v*v/256)),m=f+(3*b/2-27*b*b*b/32)*Math.sin(2*f)+(21*b*b/16-55*b*b*b*b/32)*Math.sin(4*f)+151*b*b*b/96*Math.sin(6*f),l=y/Math.sqrt(1-v*Math.sin(m)*Math.sin(m)),u=Math.tan(m)*Math.tan(m),h=a*Math.cos(m)*Math.cos(m),c=y*(1-v)/Math.pow(1-v*Math.sin(m)*Math.sin(m),1.5),p=x/(l*g);var k=m-l*Math.tan(m)/c*(p*p/2-(5+3*u+10*h-4*h*h-9*a)*p*p*p*p/24+(61+90*u+298*h+45*u*u-252*a-3*h*h)*p*p*p*p*p*p/720);k=o(k);var M=(p-(1+2*u+h)*p*p*p/6+(5-2*h+28*u-3*h*h+8*a+24*u*u)*p*p*p*p*p/120)/Math.cos(m);M=d+o(M);var j;if(t.accuracy){var T=s({northing:t.northing+t.accuracy,easting:t.easting+t.accuracy,zoneLetter:t.zoneLetter,zoneNumber:t.zoneNumber});j={top:T.lat,right:T.lon,bottom:k,left:M}}else j={lat:k,lon:M};return j}function a(t){var e="Z";return 84>=t&&t>=72?e="X":72>t&&t>=64?e="W":64>t&&t>=56?e="V":56>t&&t>=48?e="U":48>t&&t>=40?e="T":40>t&&t>=32?e="S":32>t&&t>=24?e="R":24>t&&t>=16?e="Q":16>t&&t>=8?e="P":8>t&&t>=0?e="N":0>t&&t>=-8?e="M":-8>t&&t>=-16?e="L":-16>t&&t>=-24?e="K":-24>t&&t>=-32?e="J":-32>t&&t>=-40?e="H":-40>t&&t>=-48?e="G":-48>t&&t>=-56?e="F":-56>t&&t>=-64?e="E":-64>t&&t>=-72?e="D":-72>t&&t>=-80&&(e="C"),e}function l(t,e){var n="00000"+t.easting,r="00000"+t.northing;return t.zoneNumber+t.zoneLetter+u(t.easting,t.northing,t.zoneNumber)+n.substr(n.length-5,e)+r.substr(r.length-5,e)}function u(t,e,n){var r=h(n),o=Math.floor(t/1e5),i=Math.floor(e/1e5)%20;return c(o,i,r)}function h(t){var e=t%m;return 0===e&&(e=m),e}function c(t,e,n){var r=n-1,o=g.charCodeAt(r),i=y.charCodeAt(r),s=o+t-1,a=i+e,l=!1;s>k&&(s=s-k+v-1,l=!0),(s===b||b>o&&s>b||(s>b||b>o)&&l)&&s++,(s===x||x>o&&s>x||(s>x||x>o)&&l)&&(s++,s===b&&s++),s>k&&(s=s-k+v-1),a>w?(a=a-w+v-1,l=!0):l=!1,(a===b||b>i&&a>b||(a>b||b>i)&&l)&&a++,(a===x||x>i&&a>x||(a>x||x>i)&&l)&&(a++,a===b&&a++),a>w&&(a=a-w+v-1);var u=String.fromCharCode(s)+String.fromCharCode(a);return u}function p(t){if(t&&0===t.length)throw"MGRSPoint coverting from nothing";for(var e,n=t.length,r=null,o="",i=0;!/[A-Z]/.test(e=t.charAt(i));){if(i>=2)throw"MGRSPoint bad conversion from: "+t;o+=e,i++}var s=parseInt(o,10);if(0===i||i+3>n)throw"MGRSPoint bad conversion from: "+t;var a=t.charAt(i++);if("A">=a||"B"===a||"Y"===a||a>="Z"||"I"===a||"O"===a)throw"MGRSPoint zone letter "+a+" not handled: "+t;r=t.substring(i,i+=2);for(var l=h(s),u=_(r.charAt(0),l),c=d(r.charAt(1),l);c<f(a);)c+=2e6;var p=n-i;if(p%2!==0)throw"MGRSPoint has to have an even number \nof digits after the zone letter and two 100km letters - front \nhalf for easting meters, second half for \nnorthing meters"+t;var m,g,y,v,b,x=p/2,w=0,k=0;return x>0&&(m=1e5/Math.pow(10,x),g=t.substring(i,i+x),w=parseFloat(g)*m,y=t.substring(i+x),k=parseFloat(y)*m),v=w+u,b=k+c,{easting:v,northing:b,zoneLetter:a,zoneNumber:s,accuracy:m}}function _(t,e){for(var n=g.charCodeAt(e-1),r=1e5,o=!1;n!==t.charCodeAt(0);){if(n++,n===b&&n++,n===x&&n++,n>k){if(o)throw"Bad character: "+t;n=v,o=!0}r+=1e5}return r}function d(t,e){if(t>"V")throw"MGRSPoint given invalid Northing "+t;for(var n=y.charCodeAt(e-1),r=0,o=!1;n!==t.charCodeAt(0);){if(n++,n===b&&n++,n===x&&n++,n>w){if(o)throw"Bad character: "+t;n=v,o=!0}r+=1e5}return r}function f(t){var e;switch(t){case"C":e=11e5;break;case"D":e=2e6;break;case"E":e=28e5;break;case"F":e=37e5;break;case"G":e=46e5;break;case"H":e=55e5;break;case"J":e=64e5;break;case"K":e=73e5;break;case"L":e=82e5;break;case"M":e=91e5;break;case"N":e=0;break;case"P":e=8e5;break;case"Q":e=17e5;break;case"R":e=26e5;break;case"S":e=35e5;break;case"T":e=44e5;break;case"U":e=53e5;break;case"V":e=62e5;break;case"W":e=7e6;break;case"X":e=79e5;break;default:e=-1}if(e>=0)return e;throw"Invalid zone letter: "+t}var m=6,g="AJSAJS",y="AFAFAF",v=65,b=73,x=79,w=86,k=90;n.forward=function(t,e){return e=e||5,l(i({lat:t[1],lon:t[0]}),e)},n.inverse=function(t){var e=s(p(t.toUpperCase()));return e.lat&&e.lon?[e.lon,e.lat,e.lon,e.lat]:[e.left,e.bottom,e.right,e.top]},n.toPoint=function(t){var e=s(p(t.toUpperCase()));return e.lat&&e.lon?[e.lon,e.lat]:[(e.left+e.right)/2,(e.top+e.bottom)/2]}},{}],"proj4/package.json":[function(t,e,n){e.exports={name:"proj4",version:"2.3.12",description:"Proj4js is a JavaScript library to transform point coordinates from one coordinate system to another, including datum transformations.",main:"lib/index.js",directories:{test:"test",doc:"docs"},scripts:{test:"./node_modules/istanbul/lib/cli.js test ./node_modules/mocha/bin/_mocha test/test.js"},repository:{type:"git",url:"git://github.com/proj4js/proj4js.git"},author:"",license:"MIT",jam:{main:"dist/proj4.js",include:["dist/proj4.js","README.md","AUTHORS","LICENSE.md"]},devDependencies:{"grunt-cli":"~0.1.13",grunt:"~0.4.2","grunt-contrib-connect":"~0.6.0","grunt-contrib-jshint":"~0.8.0",chai:"~1.8.1",mocha:"~1.17.1","grunt-mocha-phantomjs":"~0.4.0",browserify:"~3.24.5","grunt-browserify":"~1.3.0","grunt-contrib-uglify":"~0.3.2",curl:"git://github.com/cujojs/curl.git",istanbul:"~0.2.4",tin:"~0.4.0"},dependencies:{mgrs:"~0.0.2"},contributors:[{name:"Mike Adair",email:"madair@dmsolutions.ca"},{name:"Richard Greenwood",email:"rich@greenwoodmap.com"},{name:"Calvin Metcalf",email:"calvin.metcalf@gmail.com"},{name:"Richard Marsden",url:"http://www.winwaed.com"},{name:"T. Mittan"},{name:"D. Steinwand"},{name:"S. Nelson"}],gitHead:"cd07cad5c6a5b6ed82b59a21356848979eafe22c",bugs:{url:"https://github.com/proj4js/proj4js/issues"},homepage:"https://github.com/proj4js/proj4js#readme",_id:"proj4@2.3.12",_shasum:"96b9ed2a810dad6e62f1e32b4dad37c276b427a2",_from:"proj4@>=2.3.10 <3.0.0",_npmVersion:"2.11.3",_nodeVersion:"0.12.7",_npmUser:{name:"ahocevar",email:"andreas.hocevar@gmail.com"},dist:{shasum:"96b9ed2a810dad6e62f1e32b4dad37c276b427a2",tarball:"http://registry.npmjs.org/proj4/-/proj4-2.3.12.tgz"},maintainers:[{name:"cwmma",email:"calvin.metcalf@gmail.com"},{name:"ahocevar",email:"andreas.hocevar@gmail.com"}],_resolved:"https://registry.npmjs.org/proj4/-/proj4-2.3.12.tgz"}},{}],rbush:[function(e,n,r){/*
|
|
(c) 2015, Vladimir Agafonkin
|
|
RBush, a JavaScript library for high-performance 2D spatial indexing of points and rectangles.
|
|
https://github.com/mourner/rbush
|
|
*/
|
|
!function(){"use strict";function e(t,n){return this instanceof e?(this._maxEntries=Math.max(4,t||9),this._minEntries=Math.max(2,Math.ceil(.4*this._maxEntries)),n&&this._initFormat(n),void this.clear()):new e(t,n)}function r(t,e){t.bbox=o(t,0,t.children.length,e)}function o(t,e,n,r){for(var o,a=i(),l=e;n>l;l++)o=t.children[l],s(a,t.leaf?r(o):o.bbox);return a}function i(){return[1/0,1/0,-(1/0),-(1/0)]}function s(t,e){return t[0]=Math.min(t[0],e[0]),t[1]=Math.min(t[1],e[1]),t[2]=Math.max(t[2],e[2]),t[3]=Math.max(t[3],e[3]),t}function a(t,e){return t.bbox[0]-e.bbox[0]}function l(t,e){return t.bbox[1]-e.bbox[1]}function u(t){return(t[2]-t[0])*(t[3]-t[1])}function h(t){return t[2]-t[0]+(t[3]-t[1])}function c(t,e){return(Math.max(e[2],t[2])-Math.min(e[0],t[0]))*(Math.max(e[3],t[3])-Math.min(e[1],t[1]))}function p(t,e){var n=Math.max(t[0],e[0]),r=Math.max(t[1],e[1]),o=Math.min(t[2],e[2]),i=Math.min(t[3],e[3]);return Math.max(0,o-n)*Math.max(0,i-r)}function _(t,e){return t[0]<=e[0]&&t[1]<=e[1]&&e[2]<=t[2]&&e[3]<=t[3]}function d(t,e){return e[0]<=t[2]&&e[1]<=t[3]&&e[2]>=t[0]&&e[3]>=t[1]}function f(t,e,n,r,o){for(var i,s=[e,n];s.length;)n=s.pop(),e=s.pop(),r>=n-e||(i=e+Math.ceil((n-e)/r/2)*r,m(t,e,n,i,o),s.push(e,i,i,n))}function m(t,e,n,r,o){for(var i,s,a,l,u,h,c,p,_;n>e;){for(n-e>600&&(i=n-e+1,s=r-e+1,a=Math.log(i),l=.5*Math.exp(2*a/3),u=.5*Math.sqrt(a*l*(i-l)/i)*(0>s-i/2?-1:1),h=Math.max(e,Math.floor(r-s*l/i+u)),c=Math.min(n,Math.floor(r+(i-s)*l/i+u)),m(t,h,c,r,o)),p=t[r],s=e,_=n,g(t,e,r),o(t[n],p)>0&&g(t,e,n);_>s;){for(g(t,s,_),s++,_--;o(t[s],p)<0;)s++;for(;o(t[_],p)>0;)_--}0===o(t[e],p)?g(t,e,_):(_++,g(t,_,n)),r>=_&&(e=_+1),_>=r&&(n=_-1)}}function g(t,e,n){var r=t[e];t[e]=t[n],t[n]=r}e.prototype={all:function(){return this._all(this.data,[])},search:function(t){var e=this.data,n=[],r=this.toBBox;if(!d(t,e.bbox))return n;for(var o,i,s,a,l=[];e;){for(o=0,i=e.children.length;i>o;o++)s=e.children[o],a=e.leaf?r(s):s.bbox,d(t,a)&&(e.leaf?n.push(s):_(t,a)?this._all(s,n):l.push(s));e=l.pop()}return n},collides:function(t){var e=this.data,n=this.toBBox;if(!d(t,e.bbox))return!1;for(var r,o,i,s,a=[];e;){for(r=0,o=e.children.length;o>r;r++)if(i=e.children[r],s=e.leaf?n(i):i.bbox,d(t,s)){if(e.leaf||_(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,n=t.length;n>e;e++)this.insert(t[e]);return this}var r=this._build(t.slice(),0,t.length-1,0);if(this.data.children.length)if(this.data.height===r.height)this._splitRoot(this.data,r);else{if(this.data.height<r.height){var o=this.data;this.data=r,r=o}this._insert(r,this.data.height-r.height-1,!0)}else this.data=r;return this},insert:function(t){return t&&this._insert(t,this.data.height-1),this},clear:function(){return this.data={children:[],height:1,bbox:i(),leaf:!0},this},remove:function(t){if(!t)return this;for(var e,n,r,o,i=this.data,s=this.toBBox(t),a=[],l=[];i||a.length;){if(i||(i=a.pop(),n=a[a.length-1],e=l.pop(),o=!0),i.leaf&&(r=i.children.indexOf(t),-1!==r))return i.children.splice(r,1),a.push(i),this._condense(a),this;o||i.leaf||!_(i.bbox,s)?n?(e++,i=n.children[e],o=!1):i=null:(a.push(i),l.push(e),e=0,n=i,i=i.children[0])}return this},toBBox:function(t){return t},compareMinX:function(t,e){return t[0]-e[0]},compareMinY:function(t,e){return t[1]-e[1]},toJSON:function(){return this.data},fromJSON:function(t){return this.data=t,this},_all:function(t,e){for(var n=[];t;)t.leaf?e.push.apply(e,t.children):n.push.apply(n,t.children),t=n.pop();return e},_build:function(t,e,n,o){var i,s=n-e+1,a=this._maxEntries;if(a>=s)return i={children:t.slice(e,n+1),height:1,bbox:null,leaf:!0},r(i,this.toBBox),i;o||(o=Math.ceil(Math.log(s)/Math.log(a)),a=Math.ceil(s/Math.pow(a,o-1))),i={children:[],height:o,bbox:null,leaf:!1};var l,u,h,c,p=Math.ceil(s/a),_=p*Math.ceil(Math.sqrt(a));for(f(t,e,n,_,this.compareMinX),l=e;n>=l;l+=_)for(h=Math.min(l+_-1,n),f(t,l,h,p,this.compareMinY),u=l;h>=u;u+=p)c=Math.min(u+p-1,h),i.children.push(this._build(t,u,c,o-1));return r(i,this.toBBox),i},_chooseSubtree:function(t,e,n,r){for(var o,i,s,a,l,h,p,_;;){if(r.push(e),e.leaf||r.length-1===n)break;for(p=_=1/0,o=0,i=e.children.length;i>o;o++)s=e.children[o],l=u(s.bbox),h=c(t,s.bbox)-l,_>h?(_=h,p=p>l?l:p,a=s):h===_&&p>l&&(p=l,a=s);e=a}return e},_insert:function(t,e,n){var r=this.toBBox,o=n?t.bbox:r(t),i=[],a=this._chooseSubtree(o,this.data,e,i);for(a.children.push(t),s(a.bbox,o);e>=0&&i[e].children.length>this._maxEntries;)this._split(i,e),e--;this._adjustParentBBoxes(o,i,e)},_split:function(t,e){var n=t[e],o=n.children.length,i=this._minEntries;this._chooseSplitAxis(n,i,o);var s=this._chooseSplitIndex(n,i,o),a={children:n.children.splice(s,n.children.length-s),height:n.height,bbox:null,leaf:!1};n.leaf&&(a.leaf=!0),r(n,this.toBBox),r(a,this.toBBox),e?t[e-1].children.push(a):this._splitRoot(n,a)},_splitRoot:function(t,e){this.data={children:[t,e],height:t.height+1,bbox:null,leaf:!1},r(this.data,this.toBBox)},_chooseSplitIndex:function(t,e,n){var r,i,s,a,l,h,c,_;for(h=c=1/0,r=e;n-e>=r;r++)i=o(t,0,r,this.toBBox),s=o(t,r,n,this.toBBox),a=p(i,s),l=u(i)+u(s),h>a?(h=a,_=r,c=c>l?l:c):a===h&&c>l&&(c=l,_=r);return _},_chooseSplitAxis:function(t,e,n){var r=t.leaf?this.compareMinX:a,o=t.leaf?this.compareMinY:l,i=this._allDistMargin(t,e,n,r),s=this._allDistMargin(t,e,n,o);s>i&&t.children.sort(r)},_allDistMargin:function(t,e,n,r){t.children.sort(r);var i,a,l=this.toBBox,u=o(t,0,e,l),c=o(t,n-e,n,l),p=h(u)+h(c);for(i=e;n-e>i;i++)a=t.children[i],s(u,t.leaf?l(a):a.bbox),p+=h(u);for(i=n-e-1;i>=e;i--)a=t.children[i],s(c,t.leaf?l(a):a.bbox),p+=h(c);return p},_adjustParentBBoxes:function(t,e,n){for(var r=n;r>=0;r--)s(e[r].bbox,t)},_condense:function(t){for(var e,n=t.length-1;n>=0;n--)0===t[n].children.length?n>0?(e=t[n-1].children,e.splice(e.indexOf(t[n]),1)):this.clear():r(t[n],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 [a"+t.join(", a")+"];")}},"function"==typeof t&&t.amd?t("rbush",function(){return e}):"undefined"!=typeof n?n.exports=e:"undefined"!=typeof self?self.rbush=e:window.rbush=e}()},{}],sprintf:[function(t,e,n){/**
|
|
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 r=function(){function t(t){return Object.prototype.toString.call(t).slice(8,-1).toLowerCase()}function e(t,e){for(var n=[];e>0;n[--e]=t);return n.join("")}var n=function(){return n.cache.hasOwnProperty(arguments[0])||(n.cache[arguments[0]]=n.parse(arguments[0])),n.format.call(null,n.cache[arguments[0]],arguments)};return n.object_stringify=function(t,e,r,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>=r)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(n.object_stringify(t[a],e+1,r,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+": "+n.object_stringify(t[l],e+1,r,o)));i+=s.join(", ")+"}"}return i;case"string":return'"'+t+'"'}return""+t},n.format=function(o,i){var s,a,l,u,h,c,p,_=1,d=o.length,f="",m=[];for(a=0;d>a;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(r('[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(r('[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=n.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,c=u[4]?"0"==u[4]?"0":u[4].charAt(1):" ",p=u[6]-String(s).length,h=u[6]?e(c,p):"",m.push(u[5]?s+h:h+s)}return m.join("")},n.cache={},n.parse=function(t){for(var e=t,n=[],r=[],o=0;e;){if(null!==(n=/^[^\x25]+/.exec(e)))r.push(n[0]);else if(null!==(n=/^\x25{2}/.exec(e)))r.push("%");else{if(null===(n=/^\x25(?:([1-9]\d*)\$|\(([^\)]+)\))?(\+)?(0|'[^$])?(-)?(\d+)?(?:\.(\d+))?([b-fosOuxX])/.exec(e)))throw new Error("[sprintf] "+e);if(n[2]){o|=1;var i=[],s=n[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])}n[2]=i}else o|=2;if(3===o)throw new Error("[sprintf] mixing positional and named placeholders is not (yet) supported");r.push(n)}e=e.substring(n[0].length)}return r},n}(),o=function(t,e){var n=e.slice();return n.unshift(t),r.apply(null,n)};e.exports=r,r.sprintf=r,r.vsprintf=o},{}],"timezone/index":[function(e,n,r){!function(e){"object"==typeof n&&n.exports?n.exports=e():"function"==typeof t?t(e):this.tz=e()}(function(){function t(t,e,n){var r,o=e.day[1];do r=new Date(Date.UTC(n,e.month,Math.abs(o++)));while(e.day[0]<7&&r.getUTCDay()!=e.day[0]);return r={clock:e.clock,sort:r.getTime(),rule:e,save:6e4*e.save,offset:t.offset},r[r.clock]=r.sort+6e4*e.time,r.posix?r.wallclock=r[r.clock]+(t.offset+e.saved):r.posix=r[r.clock]-(t.offset+e.saved),r}function e(e,n,r){var o,i,s,a,l,u,h,c=e[e.zone],p=[],_=new Date(r).getUTCFullYear(),d=1;for(o=1,i=c.length;i>o&&!(c[o][n]<=r);o++);if(s=c[o],s.rules){for(u=e[s.rules],h=_+1;h>=_-d;--h)for(o=0,i=u.length;i>o;o++)u[o].from<=h&&h<=u[o].to?p.push(t(s,u[o],h)):u[o].to<h&&1==d&&(d=h-u[o].to);for(p.sort(function(t,e){return t.sort-e.sort}),o=0,i=p.length;i>o;o++)r>=p[o][n]&&p[o][p[o].clock]>s[p[o].clock]&&(a=p[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 n(t,n){return"UTC"==t.zone?n:(t.entry=e(t,"posix",n),n+t.entry.offset+t.entry.save)}function r(t,n){if("UTC"==t.zone)return n;var r,o;return t.entry=r=e(t,"wallclock",n),o=n-r.wallclock,o>0&&o<r.save?null:n-r.offset-r.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*c[l-10];else{if(i=new Date(n(t,e)),7>l)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=r(t,i.getTime()))&&(e=r(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),c=[];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=h.exec(a))?c.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;11>e;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=r(u,l)),null==l)return l;for(e=0,i=c.length;i>e;e++)l=o(u,l,c[e]);return u.format?(s=new Date(n(u,l)),u.format.replace(/%([-0_^]?)(:{0,3})(\d*)(.)/g,function(t,e,n,r,o){var i,a,h="0";if(i=u[o]){for(t=String(i.call(u,s,l,e,n.length)),"_"==(e||i.style)&&(h=" "),a="-"==e?0:i.pad||0;t.length<a;)t=h+t;for(a="-"==e?0:r||i.pad;t.length<a;)t=h+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 n,r,o;return r=new Date(Date.UTC(t.getUTCFullYear(),0)),n=Math.floor((t.getTime()-r.getTime())/864e5),r.getUTCDay()==e?o=0:(o=7-r.getUTCDay()+e,8==o&&(o=1)),n>=o?Math.floor((n-o)/7)+1:0}function a(t){var e,n,r;return n=t.getUTCFullYear(),e=new Date(Date.UTC(n,0)).getUTCDay(),r=s(t,1)+(e>1&&4>=e?1:0),r?53!=r||4==e||3==e&&29==new Date(n,1,29).getDate()?[r,t.getUTCFullYear()]:[1,t.getUTCFullYear()+1]:(n=t.getUTCFullYear()-1,e=new Date(Date.UTC(n,0)).getUTCDay(),r=4==e||3==e&&29==new Date(n,1,29).getDate()?53:52,[r,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,n,r){var o,i,s=this.entry.offset+this.entry.save,a=Math.abs(s/1e3),l=[],u=3600;for(o=0;3>o;o++)l.push(("0"+Math.floor(a/u)).slice(-2)),a%=u,u/=60;return"^"!=n||s?("^"==n&&(r=3),3==r?(i=l.join(":"),i=i.replace(/:00$/,""),"^"!=n&&(i=i.replace(/:00$/,""))):r?(i=l.slice(0,r+1).join(":"),"^"==n&&(i=i.replace(/:00$/,""))):i=l.slice(0,2).join(""),i=(0>s?"-":"+")+i,i=i.replace(/([-+])(0)/,{_:" $1","-":"$1"}[n]||"$1$2")):"Z"},"%":function(t){return"%"},n:function(t){return"\n"},t:function(t){return" "},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",h=new RegExp("^\\s*([+-])(\\d+)\\s+("+u+")s?\\s*$","i"),c=[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,n,r){
|
|
// (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,n,r,o,i,s){for(;i>=0&&s>i;i+=t){var a=o?o[i]:i;r=n(r,e[a],a,e)}return r}return function(n,r,o,i){r=w(r,i,4);var s=!P(n)&&x.keys(n),a=(s||n).length,l=t>0?0:a-1;return arguments.length<3&&(o=n[s?s[l]:l],l+=t),e(n,r,o,s,l,a)}}function o(t){return function(e,n,r){n=k(n,r);for(var o=E(e),i=t>0?0:o-1;i>=0&&o>i;i+=t)if(n(e[i],i,e))return i;return-1}}function i(t,e,n){return function(r,o,i){var s=0,a=E(r);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(n&&i&&a)return i=n(r,o),r[i]===o?i:-1;if(o!==o)return i=e(_.call(r,s,a),x.isNaN),i>=0?i+s:-1;for(i=t>0?s:a-1;i>=0&&a>i;i+=t)if(r[i]===o)return i;return-1}}function s(t,e){var n=N.length,r=t.constructor,o=x.isFunction(r)&&r.prototype||h,i="constructor";for(x.has(t,i)&&!x.contains(e,i)&&e.push(i);n--;)i=N[n],i in t&&t[i]!==o[i]&&!x.contains(e,i)&&e.push(i)}var a=this,l=a._,u=Array.prototype,h=Object.prototype,c=Function.prototype,p=u.push,_=u.slice,d=h.toString,f=h.hasOwnProperty,m=Array.isArray,g=Object.keys,y=c.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 r?("undefined"!=typeof n&&n.exports&&(r=n.exports=x),r._=x):a._=x,x.VERSION="1.8.3";var w=function(t,e,n){if(void 0===e)return t;switch(null==n?3:n){case 1:return function(n){return t.call(e,n)};case 2:return function(n,r){return t.call(e,n,r)};case 3:return function(n,r,o){return t.call(e,n,r,o)};case 4:return function(n,r,o,i){return t.call(e,n,r,o,i)}}return function(){return t.apply(e,arguments)}},k=function(t,e,n){return null==t?x.identity:x.isFunction(t)?w(t,e,n):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(n){var r=arguments.length;if(2>r||null==n)return n;for(var o=1;r>o;o++)for(var i=arguments[o],s=t(i),a=s.length,l=0;a>l;l++){var u=s[l];e&&void 0!==n[u]||(n[u]=i[u])}return n}},j=function(t){if(!x.isObject(t))return{};if(v)return v(t);b.prototype=t;var e=new b;return b.prototype=null,e},T=function(t){return function(e){return null==e?void 0:e[t]}},z=Math.pow(2,53)-1,E=T("length"),P=function(t){var e=E(t);return"number"==typeof e&&e>=0&&z>=e};x.each=x.forEach=function(t,e,n){e=w(e,n);var r,o;if(P(t))for(r=0,o=t.length;o>r;r++)e(t[r],r,t);else{var i=x.keys(t);for(r=0,o=i.length;o>r;r++)e(t[i[r]],i[r],t)}return t},x.map=x.collect=function(t,e,n){e=k(e,n);for(var r=!P(t)&&x.keys(t),o=(r||t).length,i=Array(o),s=0;o>s;s++){var a=r?r[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,n){var r;return r=P(t)?x.findIndex(t,e,n):x.findKey(t,e,n),void 0!==r&&-1!==r?t[r]:void 0},x.filter=x.select=function(t,e,n){var r=[];return e=k(e,n),x.each(t,function(t,n,o){e(t,n,o)&&r.push(t)}),r},x.reject=function(t,e,n){return x.filter(t,x.negate(k(e)),n)},x.every=x.all=function(t,e,n){e=k(e,n);for(var r=!P(t)&&x.keys(t),o=(r||t).length,i=0;o>i;i++){var s=r?r[i]:i;if(!e(t[s],s,t))return!1}return!0},x.some=x.any=function(t,e,n){e=k(e,n);for(var r=!P(t)&&x.keys(t),o=(r||t).length,i=0;o>i;i++){var s=r?r[i]:i;if(e(t[s],s,t))return!0}return!1},x.contains=x.includes=x.include=function(t,e,n,r){return P(t)||(t=x.values(t)),("number"!=typeof n||r)&&(n=0),x.indexOf(t,e,n)>=0},x.invoke=function(t,e){var n=_.call(arguments,2),r=x.isFunction(e);return x.map(t,function(t){var o=r?e:t[e];return null==o?o:o.apply(t,n)})},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,n){var r,o,i=-(1/0),s=-(1/0);if(null==e&&null!=t){t=P(t)?t:x.values(t);for(var a=0,l=t.length;l>a;a++)r=t[a],r>i&&(i=r)}else e=k(e,n),x.each(t,function(t,n,r){o=e(t,n,r),(o>s||o===-(1/0)&&i===-(1/0))&&(i=t,s=o)});return i},x.min=function(t,e,n){var r,o,i=1/0,s=1/0;if(null==e&&null!=t){t=P(t)?t:x.values(t);for(var a=0,l=t.length;l>a;a++)r=t[a],i>r&&(i=r)}else e=k(e,n),x.each(t,function(t,n,r){o=e(t,n,r),(s>o||o===1/0&&i===1/0)&&(i=t,s=o)});return i},x.shuffle=function(t){for(var e,n=P(t)?t:x.values(t),r=n.length,o=Array(r),i=0;r>i;i++)e=x.random(0,i),e!==i&&(o[i]=o[e]),o[e]=n[i];return o},x.sample=function(t,e,n){return null==e||n?(P(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,n){return e=k(e,n),x.pluck(x.map(t,function(t,n,r){return{value:t,index:n,criteria:e(t,n,r)}}).sort(function(t,e){var n=t.criteria,r=e.criteria;if(n!==r){if(n>r||void 0===n)return 1;if(r>n||void 0===r)return-1}return t.index-e.index}),"value")};var S=function(t){return function(e,n,r){var o={};return n=k(n,r),x.each(e,function(r,i){var s=n(r,i,e);t(o,r,s)}),o}};x.groupBy=S(function(t,e,n){x.has(t,n)?t[n].push(e):t[n]=[e]}),x.indexBy=S(function(t,e,n){t[n]=e}),x.countBy=S(function(t,e,n){x.has(t,n)?t[n]++:t[n]=1}),x.toArray=function(t){return t?x.isArray(t)?_.call(t):P(t)?x.map(t,x.identity):x.values(t):[]},x.size=function(t){return null==t?0:P(t)?t.length:x.keys(t).length},x.partition=function(t,e,n){e=k(e,n);var r=[],o=[];return x.each(t,function(t,n,i){(e(t,n,i)?r:o).push(t)}),[r,o]},x.first=x.head=x.take=function(t,e,n){return null!=t?null==e||n?t[0]:x.initial(t,t.length-e):void 0},x.initial=function(t,e,n){return _.call(t,0,Math.max(0,t.length-(null==e||n?1:e)))},x.last=function(t,e,n){return null!=t?null==e||n?t[t.length-1]:x.rest(t,Math.max(0,t.length-e)):void 0},x.rest=x.tail=x.drop=function(t,e,n){return _.call(t,null==e||n?1:e)},x.compact=function(t){return x.filter(t,x.identity)};var C=function(t,e,n,r){for(var o=[],i=0,s=r||0,a=E(t);a>s;s++){var l=t[s];if(P(l)&&(x.isArray(l)||x.isArguments(l))){e||(l=C(l,e,n));var u=0,h=l.length;for(o.length+=h;h>u;)o[i++]=l[u++]}else n||(o[i++]=l)}return o};x.flatten=function(t,e){return C(t,e,!1)},x.without=function(t){return x.difference(t,_.call(arguments,1))},x.uniq=x.unique=function(t,e,n,r){x.isBoolean(e)||(r=n,n=e,e=!1),null!=n&&(n=k(n,r));for(var o=[],i=[],s=0,a=E(t);a>s;s++){var l=t[s],u=n?n(l,s,t):l;e?(s&&i===u||o.push(l),i=u):n?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(C(arguments,!0,!0))},x.intersection=function(t){for(var e=[],n=arguments.length,r=0,o=E(t);o>r;r++){var i=t[r];if(!x.contains(e,i)){for(var s=1;n>s&&x.contains(arguments[s],i);s++);s===n&&e.push(i)}}return e},x.difference=function(t){var e=C(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,n=Array(e),r=0;e>r;r++)n[r]=x.pluck(t,r);return n},x.object=function(t,e){for(var n={},r=0,o=E(t);o>r;r++)e?n[t[r]]=e[r]:n[t[r][0]]=t[r][1];return n},x.findIndex=o(1),x.findLastIndex=o(-1),x.sortedIndex=function(t,e,n,r){n=k(n,r,1);for(var o=n(e),i=0,s=E(t);s>i;){var a=Math.floor((i+s)/2);n(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,n){null==e&&(e=t||0,t=0),n=n||1;for(var r=Math.max(Math.ceil((e-t)/n),0),o=Array(r),i=0;r>i;i++,t+=n)o[i]=t;return o};var A=function(t,e,n,r,o){if(!(r instanceof e))return t.apply(n,o);var i=j(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 n=_.call(arguments,2),r=function(){return A(t,r,e,this,n.concat(_.call(arguments)))};return r},x.partial=function(t){var e=_.call(arguments,1),n=function(){for(var r=0,o=e.length,i=Array(o),s=0;o>s;s++)i[s]=e[s]===x?arguments[r++]:e[s];for(;r<arguments.length;)i.push(arguments[r++]);return A(t,n,this,this,i)};return n},x.bindAll=function(t){var e,n,r=arguments.length;if(1>=r)throw new Error("bindAll must be passed function names");for(e=1;r>e;e++)n=arguments[e],t[n]=x.bind(t[n],t);return t},x.memoize=function(t,e){var n=function(r){var o=n.cache,i=""+(e?e.apply(this,arguments):r);return x.has(o,i)||(o[i]=t.apply(this,arguments)),o[i]};return n.cache={},n},x.delay=function(t,e){var n=_.call(arguments,2);return setTimeout(function(){return t.apply(null,n)},e)},x.defer=x.partial(x.delay,x,1),x.throttle=function(t,e,n){var r,o,i,s=null,a=0;n||(n={});var l=function(){a=n.leading===!1?0:x.now(),s=null,i=t.apply(r,o),s||(r=o=null)};return function(){var u=x.now();a||n.leading!==!1||(a=u);var h=e-(u-a);return r=this,o=arguments,0>=h||h>e?(s&&(clearTimeout(s),s=null),a=u,i=t.apply(r,o),s||(r=o=null)):s||n.trailing===!1||(s=setTimeout(l,h)),i}},x.debounce=function(t,e,n){var r,o,i,s,a,l=function(){var u=x.now()-s;e>u&&u>=0?r=setTimeout(l,e-u):(r=null,n||(a=t.apply(i,o),r||(i=o=null)))};return function(){i=this,o=arguments,s=x.now();var u=n&&!r;return r||(r=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 n=e,r=t[e].apply(this,arguments);n--;)r=t[n].call(this,r);return r}},x.after=function(t,e){return function(){return--t<1?e.apply(this,arguments):void 0}},x.before=function(t,e){var n;return function(){return--t>0&&(n=e.apply(this,arguments)),1>=t&&(e=null),n}},x.once=x.partial(x.before,2);var O=!{toString:null}.propertyIsEnumerable("toString"),N=["valueOf","isPrototypeOf","toString","propertyIsEnumerable","hasOwnProperty","toLocaleString"];x.keys=function(t){if(!x.isObject(t))return[];if(g)return g(t);var e=[];for(var n in t)x.has(t,n)&&e.push(n);return O&&s(t,e),e},x.allKeys=function(t){if(!x.isObject(t))return[];var e=[];for(var n in t)e.push(n);return O&&s(t,e),e},x.values=function(t){for(var e=x.keys(t),n=e.length,r=Array(n),o=0;n>o;o++)r[o]=t[e[o]];return r},x.mapObject=function(t,e,n){e=k(e,n);for(var r,o=x.keys(t),i=o.length,s={},a=0;i>a;a++)r=o[a],s[r]=e(t[r],r,t);return s},x.pairs=function(t){for(var e=x.keys(t),n=e.length,r=Array(n),o=0;n>o;o++)r[o]=[e[o],t[e[o]]];return r},x.invert=function(t){for(var e={},n=x.keys(t),r=0,o=n.length;o>r;r++)e[t[n[r]]]=n[r];return e},x.functions=x.methods=function(t){var e=[];for(var n in t)x.isFunction(t[n])&&e.push(n);return e.sort()},x.extend=M(x.allKeys),x.extendOwn=x.assign=M(x.keys),x.findKey=function(t,e,n){e=k(e,n);for(var r,o=x.keys(t),i=0,s=o.length;s>i;i++)if(r=o[i],e(t[r],r,t))return r},x.pick=function(t,e,n){var r,o,i={},s=t;if(null==s)return i;x.isFunction(e)?(o=x.allKeys(s),r=w(e,n)):(o=C(arguments,!1,!1,1),r=function(t,e,n){return e in n},s=Object(s));for(var a=0,l=o.length;l>a;a++){var u=o[a],h=s[u];r(h,u,s)&&(i[u]=h)}return i},x.omit=function(t,e,n){if(x.isFunction(e))e=x.negate(e);else{var r=x.map(C(arguments,!1,!1,1),String);e=function(t,e){return!x.contains(r,e)}}return x.pick(t,e,n)},x.defaults=M(x.allKeys,!0),x.create=function(t,e){var n=j(t);return e&&x.extendOwn(n,e),n},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 n=x.keys(e),r=n.length;if(null==t)return!r;for(var o=Object(t),i=0;r>i;i++){var s=n[i];if(e[s]!==o[s]||!(s in o))return!1}return!0};var q=function(t,e,n,r){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}n=n||[],r=r||[];for(var l=n.length;l--;)if(n[l]===t)return r[l]===e;if(n.push(t),r.push(e),i){if(l=t.length,l!==e.length)return!1;for(;l--;)if(!q(t[l],e[l],n,r))return!1}else{var u,h=x.keys(t);if(l=h.length,x.keys(e).length!==l)return!1;for(;l--;)if(u=h[l],!x.has(e,u)||!q(t[u],e[u],n,r))return!1}return n.pop(),r.pop(),!0};x.isEqual=function(t,e){return q(t,e)},x.isEmpty=function(t){return null==t?!0:P(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=T,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,n){var r=Array(Math.max(0,t));e=w(e,n,1);for(var o=0;t>o;o++)r[o]=e(o);return r},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={"&":"&","<":"<",">":">",'"':""","'":"'","`":"`"},D=x.invert(F),I=function(t){var e=function(e){return t[e]},n="(?:"+x.keys(t).join("|")+")",r=RegExp(n),o=RegExp(n,"g");return function(t){return t=null==t?"":""+t,r.test(t)?t.replace(o,e):t}};x.escape=I(F),x.unescape=I(D),x.result=function(t,e,n){var r=null==t?void 0:t[e];return void 0===r&&(r=n),x.isFunction(r)?r.call(t):r};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 B=/(.)^/,L={"'":"'","\\":"\\","\r":"r","\n":"n","\u2028":"u2028","\u2029":"u2029"},G=/\\|'|\r|\n|\u2028|\u2029/g,U=function(t){return"\\"+L[t]};x.template=function(t,e,n){!e&&n&&(e=n),e=x.defaults({},e,x.templateSettings);var r=RegExp([(e.escape||B).source,(e.interpolate||B).source,(e.evaluate||B).source].join("|")+"|$","g"),o=0,i="__p+='";t.replace(r,function(e,n,r,s,a){return i+=t.slice(o,a).replace(G,U),o=a+e.length,n?i+="'+\n((__t=("+n+"))==null?'':_.escape(__t))+\n'":r?i+="'+\n((__t=("+r+"))==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 $=function(t,e){return t._chain?x(e).chain():e};x.mixin=function(t){x.each(x.functions(t),function(e){var n=x[e]=t[e];x.prototype[e]=function(){var t=[this._wrapped];return p.apply(t,arguments),$(this,n.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 n=this._wrapped;return e.apply(n,arguments),"shift"!==t&&"splice"!==t||0!==n.length||delete n[0],$(this,n)}}),x.each(["concat","join","slice"],function(t){var e=u[t];x.prototype[t]=function(){return $(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,n){function r(t){i(s).remove(),i(a).each(function(){var e=o(i(this)),n={relatedTarget:this};e.hasClass("bk-bs-open")&&(e.trigger(t=i.Event("hide.bk-bs.dropdown",n)),t.isDefaultPrevented()||e.removeClass("bk-bs-open").trigger("hidden.bk-bs.dropdown",n))})}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 n=e&&i(e);return n&&n.length?n: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 n=o(e),s=n.hasClass("bk-bs-open");if(r(),!s){"ontouchstart"in document.documentElement&&!n.closest(".bk-bs-navbar-nav").length&&i('<div class="bk-bs-dropdown-backdrop"/>').insertAfter(i(this)).on("click",r);var a={relatedTarget:this};if(n.trigger(t=i.Event("show.bk-bs.dropdown",a)),t.isDefaultPrevented())return;n.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 n=o(e),r=n.hasClass("bk-bs-open");if(!r||r&&27==t.keyCode)return 27==t.which&&n.find(a).focus(),e.click();var s=" li:not(.bk-bs-divider):visible a",l=n.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),n=e.data("bk-bs.dropdown");n||e.data("bk-bs.dropdown",n=new l(this)),"string"==typeof t&&n[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",r).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"}],"bootstrap/modal":[function(t,e,n){var r=t("jquery"),o=function(t,e){this.options=e,this.$element=r(t),this.$backdrop=this.isShown=null,this.options.remote&&this.$element.find(".bk-bs-modal-content").load(this.options.remote,r.proxy(function(){this.$element.trigger("loaded.bk-bs.modal")},this))};o.DEFAULTS={backdrop:!0,keyboard:!0,show:!0},o.prototype.toggle=function(t){return this[this.isShown?"hide":"show"](t)},o.prototype.show=function(t){var e=this,n=r.Event("show.bk-bs.modal",{relatedTarget:t});this.$element.trigger(n),this.isShown||n.isDefaultPrevented()||(this.isShown=!0,this.escape(),this.$element.on("click.dismiss.bk-bs.modal",'[data-bk-bs-dismiss="modal"]',r.proxy(this.hide,this)),this.backdrop(function(){var n=r.support.transition&&e.$element.hasClass("bk-bs-fade");e.$element.parent().length||e.$element.appendTo(document.body),e.$element.show().scrollTop(0),n&&e.$element[0].offsetWidth,e.$element.addClass("bk-bs-in").attr("aria-hidden",!1),e.enforceFocus();var o=r.Event("shown.bk-bs.modal",{relatedTarget:t});n?e.$element.find(".bk-bs-modal-dialog").one(r.support.transition.end,function(){e.$element.focus().trigger(o)}).emulateTransitionEnd(300):e.$element.focus().trigger(o)}))},o.prototype.hide=function(t){t&&t.preventDefault(),t=r.Event("hide.bk-bs.modal"),this.$element.trigger(t),this.isShown&&!t.isDefaultPrevented()&&(this.isShown=!1,this.escape(),r(document).off("focusin.bk-bs.modal"),this.$element.removeClass("bk-bs-in").attr("aria-hidden",!0).off("click.dismiss.bk-bs.modal"),r.support.transition&&this.$element.hasClass("bk-bs-fade")?this.$element.one(r.support.transition.end,r.proxy(this.hideModal,this)).emulateTransitionEnd(300):this.hideModal())},o.prototype.enforceFocus=function(){r(document).off("focusin.bk-bs.modal").on("focusin.bk-bs.modal",r.proxy(function(t){this.$element[0]===t.target||this.$element.has(t.target).length||this.$element.focus()},this))},o.prototype.escape=function(){this.isShown&&this.options.keyboard?this.$element.on("keyup.dismiss.bk-bs.modal",r.proxy(function(t){27==t.which&&this.hide()},this)):this.isShown||this.$element.off("keyup.dismiss.bk-bs.modal")},o.prototype.hideModal=function(){var t=this;this.$element.hide(),this.backdrop(function(){t.removeBackdrop(),t.$element.trigger("hidden.bk-bs.modal")})},o.prototype.removeBackdrop=function(){this.$backdrop&&this.$backdrop.remove(),this.$backdrop=null},o.prototype.backdrop=function(t){var e=this.$element.hasClass("bk-bs-fade")?"bk-bs-fade":"";if(this.isShown&&this.options.backdrop){var n=r.support.transition&&e;if(this.$backdrop=r('<div class="bk-bs-modal-backdrop '+e+'" />').appendTo(document.body),this.$element.on("click.dismiss.bk-bs.modal",r.proxy(function(t){t.target===t.currentTarget&&("static"==this.options.backdrop?this.$element[0].focus.call(this.$element[0]):this.hide.call(this))},this)),n&&this.$backdrop[0].offsetWidth,this.$backdrop.addClass("bk-bs-in"),!t)return;n?this.$backdrop.one(r.support.transition.end,t).emulateTransitionEnd(150):t()}else!this.isShown&&this.$backdrop?(this.$backdrop.removeClass("bk-bs-in"),r.support.transition&&this.$element.hasClass("bk-bs-fade")?this.$backdrop.one(r.support.transition.end,t).emulateTransitionEnd(150):t()):t&&t()};var i=r.fn.modal;r.fn.modal=function(t,e){return this.each(function(){var n=r(this),i=n.data("bk-bs.modal"),s=r.extend({},o.DEFAULTS,n.data(),"object"==typeof t&&t);i||n.data("bk-bs.modal",i=new o(this,s)),"string"==typeof t?i[t](e):s.show&&i.show(e)})},r.fn.modal.Constructor=o,r.fn.modal.noConflict=function(){return r.fn.modal=i,this},r(document).on("click.bk-bs.modal.data-api",'[data-bk-bs-toggle="modal"]',function(t){var e=r(this),n=e.attr("href"),o=r(e.attr("data-bk-bs-target")||n&&n.replace(/.*(?=#[^\s]+$)/,"")),i=o.data("bk-bs.modal")?"toggle":r.extend({remote:!/#/.test(n)&&n},o.data(),e.data());e.is("a")&&t.preventDefault(),o.modal(i,this).one("hide",function(){e.is(":visible")&&e.focus()})}),r(document).on("show.bk-bs.modal",".bk-bs-modal",function(){r(document.body).addClass("bk-bs-modal-open")}).on("hidden.bk-bs.modal",".bk-bs-modal",function(){r(document.body).removeClass("bk-bs-modal-open")})},{jquery:"jquery"}],gear_utils:[function(t,e,n){var r,o,i;!function(){"use strict";r=function(t,e,n,r,o,i){function s(t,e){var n,r=50,o=0;for(n=1;r>=n;n++)o+=e(Math.cos(m*(n-.5)/r))*Math.cos(m*t*(n-.5)/r);return 2*o/r}function a(t,e){var n,r,o,i,a=[],l=[],u=[[],[]];for(n=0;t+1>n;n++)u[0][n]=0,u[1][n]=0;for(u[0][0]=1,u[1][1]=1,o=1;t+1>o;o++){for(u[o+1]=[0],r=0;r<u[o].length-1;r++)u[o+1][r+1]=2*u[o][r];for(r=0;r<u[o-1].length;r++)u[o+1][r]-=u[o-1][r]}for(o=0;t>=o;o++)l[o]=s(o,e),a[o]=0;for(o=0;t>=o;o++)for(i=0;t>=i;i++)a[i]+=l[o]*u[o][i];return a[0]-=s(0,e)/2,a}function l(t){var e=2*t-1,n=e*(p-_)/2+(_+p)/2;return v*(Math.cos(n)+n*Math.sin(n))}function u(t){var e=2*t-1,n=e*(p-_)/2+(_+p)/2;return v*(Math.sin(n)-n*Math.cos(n))}function h(t,e){var n,r=1;for(n=t-e+1;t>=n;n++)r*=n;for(n=1;e>=n;n++)r/=n;return r}function c(t,e){var n,r,o=a(x,e);for(n=0,r=0;t>=r;r++)n+=h(t,r)*o[r]/h(x,r);return n}var p,_,d,f,m=Math.PI,g=t*e/2,y=n||20,v=g*Math.cos(y*m/180),b=g+t,x=r||3,w=Math.sqrt(b*b-v*v)/v,k=i||1,M=.01,j=[];for(void 0!==o&&k>o&&(M=o),p=Math.sqrt(k)*w,_=Math.sqrt(M)*w,d=0;x>=d;d++)f={},f.x=c(d,l),f.y=c(d,u),j.push(f);return j},o=function(t,e,n){function o(t,e){return Math.sqrt(e*e-t*t)/t-Math.acos(t/e)}function i(t,e){var n=Math.sin(e),r=Math.cos(e);return{x:t.x*r-t.y*n,y:t.x*n+t.y*r}}function s(t,e){return{x:t*Math.cos(e),y:t*Math.sin(e)}}var a,l,u,h,c,p,_,d,f,m,g,y,v,b,x,w,k=t,M=e,j=n||20,T=k,z=1.25*k,E=z-T,P=M*k/2,S=P*Math.cos(j*Math.PI/180),C=P+T,A=P-z,O=1.5*E,N=2*Math.PI/M,q=o(S,P),F=q,D=Math.atan(O/(O+A));for(a=Math.sqrt((A+O)*(A+O)-O*O),a>S&&(a=A+E),a>S&&(F-=o(S,a)),l=1,u=.01,a>S&&(u=(a*a-S*S)/(C*C-S*S)),h=u+(l-u)/4,c=r(k,M,j,3,u,h),p=r(k,M,j,3,h,l),_=c.concat(p.slice(1)),d=[],x=0;x<_.length;x++)b=i(_[x],-q-N/4),_[x]=b,d[x]={x:b.x,y:-b.y};return f=s(a,-N/4-F),m={x:f.x,y:-f.y},y=s(A,N/4+F+D),v=s(A,3*N/4-F-D),g=i(f,N),w=[],w.push("M",f.x,f.y),S>a&&w.push("L",_[0].x,_[0].y),w.push("C",_[1].x,_[1].y,_[2].x,_[2].y,_[3].x,_[3].y,_[4].x,_[4].y,_[5].x,_[5].y,_[6].x,_[6].y),w.push("A",C,C,0,0,0,d[6].x,d[6].y),w.push("C",d[5].x,d[5].y,d[4].x,d[4].y,d[3].x,d[3].y,d[2].x,d[2].y,d[1].x,d[1].y,d[0].x,d[0].y),S>a&&w.push("L",m.x,m.y),v.y>y.y&&(w.push("A",O,O,0,0,1,y.x,y.y),w.push("A",A,A,0,0,0,v.x,v.y)),w.push("A",O,O,0,0,1,g.x,g.y),w},i=function(t,e,n){function o(t,e){return Math.sqrt(e*e-t*t)/t-Math.acos(t/e)}function i(t,e){var n=Math.sin(e),r=Math.cos(e);return{x:t.x*r-t.y*n,y:t.x*n+t.y*r}}function s(t,e){return{x:t*Math.cos(e),y:t*Math.sin(e)}}var a,l,u,h,c,p,_,d,f,m,g,y,v,b,x,w,k,M,j,T,z,E=t,P=e,S=n||20,C=.6*E,A=1.25*E,O=P*E/2,N=O*Math.cos(S*Math.PI/180),q=O-C,F=O+A,D=.25*E,I=F-D,R=1.5*D;for(a=2*Math.PI/P,l=o(N,O),u=l,q>N&&(u-=o(N,q)),h=o(N,I)-l,c=1.414*D/I,p=1,_=.01,q>N&&(_=(q*q-N*N)/(I*I-N*N)),d=_+(p-_)/4,f=r(E,P,S,3,_,d),m=r(E,P,S,3,d,p),y=f.concat(m.slice(1)),g=[],b=0;b<y.length;b++)v=i(y[b],a/4-l),y[b]=v,g[b]={x:v.x,y:-v.y};return w={x:g[6].x,y:g[6].y},M=s(q,-a/4+u),j={x:M.x,y:-M.y},T=s(F,a/4+h+c),z=s(F,3*a/4-h-c),k=i(w,a),x=[],x.push("M",g[6].x,g[6].y),x.push("C",g[5].x,g[5].y,g[4].x,g[4].y,g[3].x,g[3].y,g[2].x,g[2].y,g[1].x,g[1].y,g[0].x,g[0].y),N>q&&x.push("L",M.x,M.y),x.push("A",q,q,0,0,0,j.x,j.y),N>q&&x.push("L",y[0].x,y[0].y),x.push("C",y[1].x,y[1].y,y[2].x,y[2].y,y[3].x,y[3].y,y[4].x,y[4].y,y[5].x,y[5].y,y[6].x,y[6].y),T.y<z.y&&(x.push("A",R,R,0,0,0,T.x,T.y),x.push("A",F,F,0,0,0,z.x,z.y)),x.push("A",R,R,0,0,0,k.x,k.y),x}}(),e.exports={create_gear_tooth:o,create_internal_gear_tooth:i}},{}],gloo2:[function(e,n,r){!function(e,o){"function"==typeof t&&t.amd?t([],o):"undefined"!=typeof r?(n.exports=o(),"undefined"==typeof window&&(e.gloo2=n.exports)):e.gloo2=o()}(this,function(){var t,e,n,r,o,i,s;return s=function(t,e){var n,r,o,i,s,a,l,u;for(e=void 0===e?"periodic check":e,l=[];;){if(s=t.getError(),s==t.NO_ERROR||l&&s==l[l.length-1])break;(l.append||l.push).apply(l,[s])}if(l.length){for(u="",n=l,"object"!=typeof n||Array.isArray(n)||(n=Object.keys(n)),o=n.length,r=0;o>r;r+=1)i=n[r],u+=i;throw a=new Error("RuntimeError:"+("OpenGL got errors ("+e+"): "+u)),a.name="RuntimeError",a}},e=function(){this.__init__&&this.__init__.apply(this,arguments)},e.prototype._base_class=Object,e.prototype.__init__=function(t){if(this._gl=t,this._handle=null,this._create(),null===this._handle)throw"AssertionError: this._handle !== null"},e.prototype._create=function(){var t;throw t=new Error("NotImplementedError:"),t.name="NotImplementedError",t},r=function(){this.__init__&&this.__init__.apply(this,arguments)},r.prototype=Object.create(e.prototype),r.prototype._base_class=e.prototype,r.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"},r.prototype.ATYPEMAP={"float":"vertexAttrib1f",vec2:"vertexAttrib2f",vec3:"vertexAttrib3f",vec4:"vertexAttrib4f"},r.prototype.ATYPEINFO={"float":[1,5126],vec2:[2,5126],vec3:[3,5126],vec4:[4,5126]},r.prototype._create=function(){this._handle=this._gl.createProgram(),this._handles=[],this._unset_variables=[],this._validated=!1,this._samplers={},this._attributes={},this._known_invalid=[]},r.prototype["delete"]=function(){this._gl.deleteProgram(this._handle)},r.prototype.activate=function(){this._gl.useProgram(this._handle)},r.prototype.deactivate=function(){this._gl.useProgram(0)},r.prototype.set_shaders=function(t,e){var n,r,o,i,s,a,l,u,h,c,p,_,d;for(l=this._gl,this._linked=!1,d=l.createShader(l.VERTEX_SHADER),a=l.createShader(l.FRAGMENT_SHADER),p=[[t,d,"vertex"],[e,a,"fragment"]],h=0;2>h;h+=1)if(r=p[h],n=r[0],u=r[1],_=r[2],l.shaderSource(u,n),l.compileShader(u),c=l.getShaderParameter(u,l.COMPILE_STATUS),!c)throw s=l.getShaderInfoLog(u),i=new Error("RuntimeError:"+("errors in "+_+" shader:\n"+s)),i.name="RuntimeError",i;if(l.attachShader(this._handle,d),l.attachShader(this._handle,a),l.linkProgram(this._handle),!l.getProgramParameter(this._handle,l.LINK_STATUS))throw o=new Error("RuntimeError:Program link error:\n"+l.getProgramInfoLog(this._handle)),o.name="RuntimeError",o;l.detachShader(this._handle,d),l.detachShader(this._handle,a),l.deleteShader(d),l.deleteShader(a),this._unset_variables=this._get_active_attributes_and_uniforms(),this._handles={},this._known_invalid=[],this._linked=!0},r.prototype._get_active_attributes_and_uniforms=function(){var t,e,n,r,o,i,s,a,l,u,h,c,p,_,d,f,m,g,y,v,b,x,w,k,M;for(m=this._gl,x=new RegExp("(\\w+)\\s*(\\[(\\d+)\\])\\s*"),o=m.getProgramParameter(this._handle,m.ACTIVE_UNIFORMS),e=m.getProgramParameter(this._handle,m.ACTIVE_ATTRIBUTES),t=[],w=[],c=[[t,e,m.getActiveAttrib],[w,o,m.getActiveUniform]],"object"!=typeof c||Array.isArray(c)||(c=Object.keys(c)),_=c.length,p=0;_>p;p+=1)for(M=c[p],h=M,n=h[0],r=h[1],f=h[2],g=0;r>g;g+=1)if(y=f.call(m,this._handle,g),b=y.name,v=b.match(x))for(b=v.group(0),g=0;g<y.size;g+=1)(n.append||n.push).apply(n,[[""+b+"["+g+"]",y.type]]);else(n.append||n.push).apply(n,[[b,y.type]]);for(M=[],d=t,"object"!=typeof d||Array.isArray(d)||(d=Object.keys(d)),s=d.length,i=0;s>i;i+=1)k=d[i],(M.append||M.push).apply(M,[k[0]]);for(a=w,"object"!=typeof a||Array.isArray(a)||(a=Object.keys(a)),u=a.length,l=0;u>l;l+=1)k=a[l],(M.append||M.push).apply(M,[k[0]]);return M},r.prototype.set_texture=function(t,e){var n,r,o,i,s,a,l;if(!this._linked)throw s=new Error("RuntimeError:Cannot set uniform when program has no code"),s.name="RuntimeError",s;if(a="function"==typeof(n=this._handles).get?n.get(t,-1):n[t]||-1,0>a){if(((r=this._known_invalid).indexOf?r:Object.keys(r)).indexOf(t)>=0)return;if(a=this._gl.getUniformLocation(this._handle,t),((o=this._unset_variables).indexOf?o:Object.keys(o)).indexOf(t)>=0&&(this._unset_variables.remove||function(t){this.splice(this.indexOf(t),1)}).apply(this._unset_variables,[t]),this._handles[t]=a,0>a)return(this._known_invalid.append||this._known_invalid.push).apply(this._known_invalid,[t]),void console.log("Variable "+t+" is not an active uniform")}this.activate(),l=Object.keys(this._samplers).length,((i=this._samplers).indexOf?i:Object.keys(i)).indexOf(t)>=0&&(l=this._samplers[t][this._samplers[t].length-1]),this._samplers[t]=[e._target,e._handle,l],this._gl.uniform1i(a,l)},r.prototype.set_uniform=function(t,e,n){var r,o,i,s,a,l,u,h,c,p,_;if(!this._linked)throw u=new Error("RuntimeError:Cannot set uniform when program has no code"),u.name="RuntimeError",u;if(c="function"==typeof(o=this._handles).get?o.get(t,-1):o[t]||-1,r=1,0>c){if(((i=this._known_invalid).indexOf?i:Object.keys(i)).indexOf(t)>=0)return;if(c=this._gl.getUniformLocation(this._handle,t),((s=this._unset_variables).indexOf?s:Object.keys(s)).indexOf(t)>=0&&(this._unset_variables.remove||function(t){this.splice(this.indexOf(t),1)}).apply(this._unset_variables,[t]),0!=e.indexOf("mat")&&(r=Math.floor(n.length/this.ATYPEINFO[e][0])),r>1)for(p=0;r>p;p+=1)((a=this._unset_variables).indexOf?a:Object.keys(a)).indexOf(""+t+"["+p+"]")>=0&&(_=""+t+"["+p+"]",((l=this._unset_variables).indexOf?l:Object.keys(l)).indexOf(_)>=0&&(this._unset_variables.remove||function(t){this.splice(this.indexOf(t),1)}).apply(this._unset_variables,[_]));if(this._handles[t]=c,0>c)return this._known_invalid.add(t),void logger.info("Variable "+t+" is not an active uniform")}h=this.UTYPEMAP[e],this.activate(),this._gl[h](c,n)},r.prototype.set_attribute=function(t,e,n,r){var o,i,s,a,l,u,h,c,p,_,d,f,m,g;if(r=void 0===r?null:r,
|
|
!this._linked)throw h=new Error("RuntimeError:Cannot set attribute when program has no code"),h.name="RuntimeError",h;if(_="function"==typeof(i=this._handles).get?i.get(t,-1):i[t]||-1,0>_){if(((s=this._known_invalid).indexOf?s:Object.keys(s)).indexOf(t)>=0)return;if(_=this._gl.getAttribLocation(this._handle,t),((a=this._unset_variables).indexOf?a:Object.keys(a)).indexOf(t)>=0&&(this._unset_variables.remove||function(t){this.splice(this.indexOf(t),1)}).apply(this._unset_variables,[t]),this._handles[t]=_,0>_){if((this._known_invalid.append||this._known_invalid.push).apply(this._known_invalid,[t]),n&&0!=n[0]&&n[2]>0)return;return void console.log("Variable "+t+" is not an active attribute")}}this.activate(),null===n?(c=this.ATYPEMAP[e],this._attributes[t]=[0,_,c,r]):(l=n,g=l[0],m=l[1],d=l[2],u=this.ATYPEINFO[e],f=u[0],p=u[1],c="vertexAttribPointer",o=[f,p,this._gl.FALSE,m,d],this._attributes[t]=[g._handle,_,c,o])},r.prototype._pre_draw=function(){var t,e,n,r,o,i,s,a,l,u,h,c;this.activate(),r=this._samplers;for(c in r)r.hasOwnProperty(c)&&(c=r[c],n=c,l=n[0],a=n[1],u=n[2],this._gl.activeTexture(this._gl.TEXTURE0+u),this._gl.bindTexture(l,a));i=this._attributes;for(c in i)i.hasOwnProperty(c)&&(c=i[c],o=c,h=o[0],e=o[1],s=o[2],t=o[3],h?(this._gl.bindBuffer(this._gl.ARRAY_BUFFER,h),this._gl.enableVertexAttribArray(e),this._gl[s].apply(this._gl,[e].concat(t))):(this._gl.bindBuffer(this._gl.ARRAY_BUFFER,null),this._gl.disableVertexAttribArray(e),this._gl[s].apply(this._gl,[e].concat(t))));this._validated||(this._validated=!0,this._validate())},r.prototype._validate=function(){var t;if(this._unset_variables.length&&console.log("Program has unset variables: "+this._unset_variables),this._gl.validateProgram(this._handle),!this._gl.getProgramParameter(this._handle,this._gl.VALIDATE_STATUS))throw console.log(this._gl.getProgramInfoLog(this._handle)),t=new Error("RuntimeError:Program validation error"),t.name="RuntimeError",t},r.prototype.draw=function(t,e){var r,o,i,a,l,u;if(!this._linked)throw a=new Error("RuntimeError:Cannot draw program if code has not been set"),a.name="RuntimeError",a;s(this._gl,"before draw"),e instanceof n?(this._pre_draw(),e.activate(),r=e._buffer_size/2,u=this._gl.UNSIGNED_SHORT,this._gl.drawElements(t,r,u,0),e.deactivate()):(o=e,l=o[0],r=o[1],r&&(this._pre_draw(),this._gl.drawArrays(t,l,r))),i=this._gl.getError(),s(this._gl,"after draw")},t=function(){this.__init__&&this.__init__.apply(this,arguments)},t.prototype=Object.create(e.prototype),t.prototype._base_class=e.prototype,t.prototype._target=null,t.prototype._usage=35048,t.prototype._create=function(){this._handle=this._gl.createBuffer(),this._buffer_size=0},t.prototype["delete"]=function(){this._gl.deleteBuffer(this._handle)},t.prototype.activate=function(){this._gl.bindBuffer(this._target,this._handle)},t.prototype.deactivate=function(){this._gl.bindBuffer(this._target,null)},t.prototype.set_size=function(t){t!=this._buffer_size&&(this.activate(),this._gl.bufferData(this._target,t,this._usage),this._buffer_size=t)},t.prototype.set_data=function(t,e){var n;this.activate(),n=e.length*e.BYTES_PER_ELEMENT,this._gl.bufferSubData(this._target,t,e)},i=function(){this.__init__&&this.__init__.apply(this,arguments)},i.prototype=Object.create(t.prototype),i.prototype._base_class=t.prototype,i.prototype._target=34962,n=function(){this.__init__&&this.__init__.apply(this,arguments)},n.prototype=Object.create(t.prototype),n.prototype._base_class=t.prototype,n.prototype._target=34963,o=function(){this.__init__&&this.__init__.apply(this,arguments)},o.prototype=Object.create(e.prototype),o.prototype._base_class=e.prototype,o.prototype._target=3553,o.prototype._types={Int8Array:5120,Uint8Array:5121,Int16Array:5122,Uint16Array:5123,Int32Array:5124,Int32Array:5125,Float32Array:5126},o.prototype._create=function(){this._handle=this._gl.createTexture(),this._shape_format=null},o.prototype["delete"]=function(){this._gl.deleteTexture(this._handle)},o.prototype.activate=function(){this._gl.bindTexture(this._target,this._handle)},o.prototype.deactivate=function(){this._gl.bindTexture(this._target,0)},o.prototype._get_alignment=function(t){var e,n,r,o,i;for(n=[4,8,2,1],r=n,"object"!=typeof r||Array.isArray(r)||(r=Object.keys(r)),i=r.length,o=0;i>o;o+=1)if(e=r[o],t%e==0)return e},o.prototype.set_wrapping=function(t,e){this.activate(),this._gl.texParameterf(this._target,this._gl.TEXTURE_WRAP_S,t),this._gl.texParameterf(this._target,this._gl.TEXTURE_WRAP_T,e)},o.prototype.set_interpolation=function(t,e){this.activate(),this._gl.texParameterf(this._target,this._gl.TEXTURE_MIN_FILTER,t),this._gl.texParameterf(this._target,this._gl.TEXTURE_MAG_FILTER,e)},o.prototype.set_size=function(t,e){var n,r,o;n=t,r=n[0],o=n[1],[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))},o.prototype.set_data=function(t,e,n){var r,o,i,s,a,l,u,h,c,p,_;if(this.activate(),l=this._shape_format[2],o=e,h=o[0],c=o[1],i=t,_=i[0],p=i[1],u="function"==typeof(s=this._types).get?s.get(n.constructor.name,null):s[n.constructor.name]||null,null===u)throw a=new Error("ValueError:"+("Type "+n.constructor.name+" not allowed for texture")),a.name="ValueError",a;r=this._get_alignment(e[e.length-2]*e[e.length-1]),4!=r&&this._gl.pixelStorei(this._gl.UNPACK_ALIGNMENT,r),this._gl.texSubImage2D(this._target,0,p,_,c,h,l,u,n),4!=r&&this._gl.pixelStorei(this._gl.UNPACK_ALIGNMENT,4)},{Buffer:t,GlooObject:e,IndexBuffer:n,Program:r,Texture2D:o,VertexBuffer:i,check_error:s}})},{}],kiwi:[function(t,e,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 r;!function(t){function e(t){return t instanceof Array?new l(t):t.__iter__()}function n(t){return t instanceof Array?new u(t):t.__reversed__()}function r(t){return t.__next__()}function o(t){if(t instanceof Array)return t.slice();for(var e,n=[],r=t.__iter__();void 0!==(e=r.__next__());)n.push(e);return n}function i(t,e){if(t instanceof Array){for(var n=0,r=t.length;r>n;++n)if(e(t[n])===!1)return}else for(var o,i=t.__iter__();void 0!==(o=i.__next__());)if(e(o)===!1)return}function s(t,e){var n=[];if(t instanceof Array)for(var r=0,o=t.length;o>r;++r)n.push(e(t[r]));else for(var i,s=t.__iter__();void 0!==(i=s.__next__());)n.push(e(i));return n}function a(t,e){var n,r=[];if(t instanceof Array)for(var o=0,i=t.length;i>o;++o)n=t[o],e(n)&&r.push(n);else for(var s=t.__iter__();void 0!==(n=s.__next__());)e(n)&&r.push(n);return r}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=n,t.next=r,t.asArray=o,t.forEach=i,t.map=s,t.filter=a}(r||(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 r;!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}(r||(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 r;!function(t){function e(t,e,n){for(var r,o,i=0,s=t.length;s>0;)r=s>>1,o=i+r,n(t[o],e)<0?(i=o+1,s-=r+1):s=r;return i}function n(t,n,r){var o=e(t,n,r);if(o===t.length)return-1;var i=t[o];return 0!==r(i,n)?-1:o}function r(t,n,r){var o=e(t,n,r);if(o!==t.length){var i=t[o];if(0===r(i,n))return i}}function o(e,n){var r=t.asArray(e),o=r.length;if(1>=o)return r;r.sort(n);for(var i=[r[0]],s=1,a=0;o>s;++s){var l=r[s];0!==n(i[a],l)&&(i.push(l),++a)}return i}function i(t,e,n){for(var r=0,o=0,i=t.length,s=e.length;i>r&&s>o;){var a=n(t[r],e[o]);if(0>a)++r;else{if(!(a>0))return!1;++o}}return!0}function s(t,e,n){var r=t.length,o=e.length;if(r>o)return!1;for(var i=0,s=0;r>i&&o>s;){var a=n(t[i],e[s]);if(0>a)return!1;a>0?++s:(++i,++s)}return r>i?!1:!0}function a(t,e,n){for(var r=0,o=0,i=t.length,s=e.length,a=[];i>r&&s>o;){var l=t[r],u=e[o],h=n(l,u);0>h?(a.push(l),++r):h>0?(a.push(u),++o):(a.push(l),++r,++o)}for(;i>r;)a.push(t[r]),++r;for(;s>o;)a.push(e[o]),++o;return a}function l(t,e,n){for(var r=0,o=0,i=t.length,s=e.length,a=[];i>r&&s>o;){var l=t[r],u=e[o],h=n(l,u);0>h?++r:h>0?++o:(a.push(l),++r,++o)}return a}function u(t,e,n){for(var r=0,o=0,i=t.length,s=e.length,a=[];i>r&&s>o;){var l=t[r],u=e[o],h=n(l,u);0>h?(a.push(l),++r):h>0?++o:(++r,++o)}for(;i>r;)a.push(t[r]),++r;return a}function h(t,e,n){for(var r=0,o=0,i=t.length,s=e.length,a=[];i>r&&s>o;){var l=t[r],u=e[o],h=n(l,u);0>h?(a.push(l),++r):h>0?(a.push(u),++o):(++r,++o)}for(;i>r;)a.push(t[r]),++r;for(;s>o;)a.push(e[o]),++o;return a}t.lowerBound=e,t.binarySearch=n,t.binaryFind=r,t.asSet=o,t.setIsDisjoint=i,t.setIsSubset=s,t.setUnion=a,t.setIntersection=l,t.setDifference=u,t.setSymmetricDifference=h}(r||(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 r;!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}(r||(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 r,o=this.__extends||function(t,e){function n(){this.constructor=t}for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r]);n.prototype=e.prototype,t.prototype=new n};!function(t){function e(t){return function(e,n){return t(e.first,n)}}function n(t,e,n){for(var r=0,o=0,i=t.length,s=e.length,a=[];i>r&&s>o;){var l=t[r],u=e[o],h=n(l.first,u.first);0>h?(a.push(l.copy()),++r):h>0?(a.push(u.copy()),++o):(a.push(u.copy()),++r,++o)}for(;i>r;)a.push(t[r].copy()),++r;for(;s>o;)a.push(e[o].copy()),++o;return a}var r=function(r){function i(t){r.call(this),this._compare=t,this._wrapped=e(t)}return o(i,r),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,n){var r=this._array,o=t.lowerBound(r,e,this._wrapped);if(o===r.length){var i=new t.Pair(e,n());return r.push(i),i}var s=r[o];if(0!==this._compare(s.first,e)){var i=new t.Pair(e,n());return r.splice(o,0,i),i}return s},i.prototype.insert=function(e,n){var r=this._array,o=t.lowerBound(r,e,this._wrapped);if(o===r.length){var i=new t.Pair(e,n);return r.push(i),i}var s=r[o];if(0!==this._compare(s.first,e)){var i=new t.Pair(e,n);return r.splice(o,0,i),i}return s.second=n,s},i.prototype.update=function(e){var r=this;if(e instanceof i){var o=e;this._array=n(this._array,o._array,this._compare)}else t.forEach(e,function(t){r.insert(t.first,t.second)})},i.prototype.erase=function(e){var n=this._array,r=t.binarySearch(n,e,this._wrapped);return 0>r?void 0:n.splice(r,1)[0]},i.prototype.copy=function(){for(var t=new i(this._compare),e=t._array,n=this._array,r=0,o=n.length;o>r;++r)e.push(n[r].copy());return t},i}(t.ArrayBase);t.AssociativeArray=r}(r||(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 r;!function(t){function e(e,r){return e instanceof n?e._array:t.asSet(e,r)}var n=function(n){function r(t){n.call(this),this._compare=t}return o(r,n),r.prototype.comparitor=function(){return this._compare},r.prototype.indexOf=function(e){return t.binarySearch(this._array,e,this._compare)},r.prototype.contains=function(e){return t.binarySearch(this._array,e,this._compare)>=0},r.prototype.insert=function(e){var n=this._array,r=t.lowerBound(n,e,this._compare);return r===n.length?(n.push(e),!0):0!==this._compare(n[r],e)?(n.splice(r,0,e),!0):!1},r.prototype.erase=function(e){var n=this._array,r=t.binarySearch(n,e,this._compare);return 0>r?!1:(n.splice(r,1),!0)},r.prototype.copy=function(){var t=new r(this._compare);return t._array=this._array.slice(),t},r.prototype.isDisjoint=function(n){var r=this._compare,o=e(n,r);return t.setIsDisjoint(this._array,o,r)},r.prototype.isSubset=function(n){var r=this._compare,o=e(n,r);return t.setIsSubset(this._array,o,r)},r.prototype.isSuperset=function(n){var r=this._compare,o=e(n,r);return t.setIsSubset(o,this._array,r)},r.prototype.union=function(n){var o=this._compare,i=new r(o),s=e(n,o);return i._array=t.setUnion(this._array,s,o),i},r.prototype.intersection=function(n){var o=this._compare,i=new r(o),s=e(n,o);return i._array=t.setIntersection(this._array,s,o),i},r.prototype.difference=function(n){var o=this._compare,i=new r(o),s=e(n,o);return i._array=t.setDifference(this._array,s,o),i},r.prototype.symmetricDifference=function(n){var o=this._compare,i=new r(o),s=e(n,o);return i._array=t.setSymmetricDifference(this._array,s,o),i},r.prototype.unionUpdate=function(n){var r=this._compare,o=e(n,r);this._array=t.setUnion(this._array,o,r)},r.prototype.intersectionUpdate=function(n){var r=this._compare,o=e(n,r);this._array=t.setIntersection(this._array,o,r)},r.prototype.differenceUpdate=function(n){var r=this._compare,o=e(n,r);this._array=t.setDifference(this._array,o,r)},r.prototype.symmetricDifferenceUpdate=function(n){var r=this._compare,o=e(n,r);this._array=t.setSymmetricDifference(this._array,o,r)},r}(t.ArrayBase);t.UniqueArray=n}(r||(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.
|
|
|----------------------------------------------------------------------------*/
|
|
/*-----------------------------------------------------------------------------
|
|
| 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,r,o){"undefined"==typeof o&&(o=t.Strength.required),this._id=n++,this._operator=r,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 n=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 r.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=n++,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 n=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 n=0,r=function(){return 0},o=t.createMap(t.Variable.Compare),i=0,s=e.length;s>i;++i){var a=e[i];if("number"==typeof a)n+=a;else if(a instanceof t.Variable)o.setDefault(a,r).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,r).second+=l}}return{terms:o,constant:n}}var n=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 r.forEach(this._terms,function(e){t+=e.first.value()*e.second}),t},t}();t.Expression=n}(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,n,r){"undefined"==typeof r&&(r=1);var o=0;return o+=1e6*Math.max(0,Math.min(1e3,t*r)),o+=1e3*Math.max(0,Math.min(1e3,e*r)),o+=Math.max(0,Math.min(1e3,n*r))}function n(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=n}(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 0>t?e>-t:e>t}function n(){return t.createMap(t.Constraint.Compare)}function r(){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=n(),this._rowMap=r(),this._varMap=o(),this._editMap=i(),this._infeasibleRows=[],this._objective=new h,this._artificial=null,this._idTick=0}return s.prototype.addConstraint=function(t){var n=this._cnMap.find(t);if(void 0!==n)throw new Error("duplicate constraint");var r=this._createRow(t),o=r.row,i=r.tag,s=this._chooseSubject(o,i);if(0===s.type()&&o.allDummies()){if(!e(o.constant()))throw new Error("unsatifiable constraint");s=i.marker}if(0===s.type()){if(!this._addWithArtificialVariable(o))throw new Error("unsatisfiable constraint")}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 n=e.second.marker,r=this._rowMap.erase(n);if(void 0===r){var o=this._getMarkerLeavingSymbol(n);if(0===o.type())throw new Error("failed to find leaving row");r=this._rowMap.erase(o),r.second.solveForEx(o,n),this._substitute(n,r.second)}this._optimize(this._objective)},s.prototype.hasConstraint=function(t){return this._cnMap.contains(t)},s.prototype.addEditVariable=function(e,n){var r=this._editMap.find(e);if(void 0!==r)throw new Error("duplicate edit variable");if(n=t.Strength.clip(n),n===t.Strength.required)throw new Error("bad required strength");var o=new t.Expression(e),i=new t.Constraint(o,2,n);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 n=this._editMap.find(t);if(void 0===n)throw new Error("unknown edit variable");var r=this._rowMap,o=n.second,i=e-o.constant;o.constant=e;var s=o.tag.marker,a=r.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=r.find(l);if(void 0!==a)return a.second.add(i)<0&&this._infeasibleRows.push(l),void this._dualOptimize();for(var u=0,h=r.size();h>u;++u){var a=r.itemAt(u),c=a.second,p=c.coefficientFor(s);0!==p&&c.add(i*p)<0&&1!==a.first.type()&&this._infeasibleRows.push(a.first)}this._dualOptimize()},s.prototype.updateVariables=function(){for(var t=this._varMap,e=this._rowMap,n=0,r=t.size();r>n;++n){var o=t.itemAt(n),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,n=function(){return e._makeSymbol(1)};return this._varMap.setDefault(t,n).second},s.prototype._createRow=function(n){for(var r=n.expression(),o=new h(r.constant()),i=r.terms(),s=0,a=i.size();a>s;++s){var l=i.itemAt(s);if(!e(l.second)){var c=this._getVarSymbol(l.first),p=this._rowMap.find(c);void 0!==p?o.insertRow(p.second,l.second):o.insertSymbol(c,l.second)}}var _=this._objective,d=n.strength(),f={marker:u,other:u};switch(n.op()){case 0:case 1:var m=0===n.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 n=t.cells(),r=0,o=n.size();o>r;++r){var i=n.itemAt(r);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 n=this._makeSymbol(2);this._rowMap.insert(n,t.copy()),this._artificial=t.copy(),this._optimize(this._artificial);var r=e(this._artificial.constant());this._artificial=null;var o=this._rowMap.erase(n);if(void 0!==o){var i=o.second;if(i.isConstant())return r;var s=this._anyPivotableSymbol(i);if(0===s.type())return!1;i.solveForEx(n,s),this._substitute(s,i),this._rowMap.insert(s,i)}for(var a=this._rowMap,l=0,u=a.size();u>l;++l)a.itemAt(l).second.removeSymbol(n);return this._objective.removeSymbol(n),r},s.prototype._substitute=function(t,e){for(var n=this._rowMap,r=0,o=n.size();o>r;++r){var i=n.itemAt(r);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 n=this._getLeavingSymbol(e);if(0===n.type())throw new Error("the objective is unbounded");var r=this._rowMap.erase(n).second;r.solveForEx(n,e),this._substitute(e,r),this._rowMap.insert(e,r)}},s.prototype._dualOptimize=function(){for(var t=this._rowMap,e=this._infeasibleRows;0!==e.length;){var n=e.pop(),r=t.find(n);if(void 0!==r&&r.second.constant()<0){var o=this._getDualEnteringSymbol(r.second);if(0===o.type())throw new Error("dual optimize failed");var i=r.second;t.erase(n),i.solveForEx(n,o),this._substitute(o,i),t.insert(o,i)}}},s.prototype._getEnteringSymbol=function(t){for(var e=t.cells(),n=0,r=e.size();r>n;++n){var o=e.itemAt(n),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,n=u,r=t.cells(),o=0,i=r.size();i>o;++o){var s=r.itemAt(o),a=s.first,l=s.second;if(l>0&&4!==a.type()){var h=this._objective.coefficientFor(a),c=h/l;e>c&&(e=c,n=a)}}return n},s.prototype._getLeavingSymbol=function(t){for(var e=Number.MAX_VALUE,n=u,r=this._rowMap,o=0,i=r.size();i>o;++o){var s=r.itemAt(o),a=s.first;if(1!==a.type()){var l=s.second,h=l.coefficientFor(t);if(0>h){var c=-l.constant()/h;e>c&&(e=c,n=a)}}}return n},s.prototype._getMarkerLeavingSymbol=function(t){for(var e=Number.MAX_VALUE,n=e,r=e,o=u,i=o,s=o,a=o,l=this._rowMap,h=0,c=l.size();c>h;++h){var p=l.itemAt(h),_=p.second,d=_.coefficientFor(t);if(0!==d){var f=p.first;if(1===f.type())a=f;else if(0>d){var m=-_.constant()/d;n>m&&(n=m,i=f)}else{var m=_.constant()/d;r>m&&(r=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 n=this._rowMap.find(t);void 0!==n?this._objective.insertRow(n.second,-e):this._objective.insertSymbol(t,-e)},s.prototype._anyPivotableSymbol=function(t){for(var e=t.cells(),n=0,r=e.size();r>n;++n){var o=e.itemAt(n),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),h=function(){function n(e){"undefined"==typeof e&&(e=0),this._cellMap=t.createMap(l.Compare),this._constant=e}return n.prototype.cells=function(){return this._cellMap},n.prototype.constant=function(){return this._constant},n.prototype.isConstant=function(){return this._cellMap.empty()},n.prototype.allDummies=function(){for(var t=this._cellMap,e=0,n=t.size();n>e;++e){var r=t.itemAt(e);if(4!==r.first.type())return!1}return!0},n.prototype.copy=function(){var t=new n(this._constant);return t._cellMap=this._cellMap.copy(),t},n.prototype.add=function(t){return this._constant+=t},n.prototype.insertSymbol=function(t,n){"undefined"==typeof n&&(n=1);var r=this._cellMap.setDefault(t,function(){return 0});e(r.second+=n)&&this._cellMap.erase(t)},n.prototype.insertRow=function(t,e){"undefined"==typeof e&&(e=1),this._constant+=t._constant*e;for(var n=t._cellMap,r=0,o=n.size();o>r;++r){var i=n.itemAt(r);this.insertSymbol(i.first,i.second*e)}},n.prototype.removeSymbol=function(t){this._cellMap.erase(t)},n.prototype.reverseSign=function(){this._constant=-this._constant;for(var t=this._cellMap,e=0,n=t.size();n>e;++e){var r=t.itemAt(e);r.second=-r.second}},n.prototype.solveFor=function(t){var e=this._cellMap,n=e.erase(t),r=-1/n.second;this._constant*=r;for(var o=0,i=e.size();i>o;++o)e.itemAt(o).second*=r},n.prototype.solveForEx=function(t,e){this.insertSymbol(t,-1),this.solveFor(e)},n.prototype.coefficientFor=function(t){var e=this._cellMap.find(t);return void 0!==e?e.second:0},n.prototype.substitute=function(t,e){var n=this._cellMap.erase(t);void 0!==n&&this.insertRow(e,n.second)},n}()}(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},{}],numeral:[function(t,e,n){function r(t,e,n,r){var o,i,s=Math.pow(10,e);return i=(n(t*s)/s).toFixed(e),r&&(o=new RegExp("0{1,"+r+"}$"),i=i.replace(o,"")),i}function o(t,e,n,r){var o;return o=e.indexOf("$")>-1?i(t,e,n,r):e.indexOf("%")>-1?s(t,e,n,r):e.indexOf(":")>-1?a(t,e,n):l(t,e,n,r)}function i(t,e,n,r){var o,i,s=e.indexOf("$"),a=e.indexOf("("),u=e.indexOf("-"),h="";return e.indexOf(" $")>-1?(h=" ",e=e.replace(" $","")):e.indexOf("$ ")>-1?(h=" ",e=e.replace("$ ","")):e=e.replace("$",""),i=l(t,e,n,r),1>=s?i.indexOf("(")>-1||i.indexOf("-")>-1?(i=i.split(""),o=1,(a>s||u>s)&&(o=0),i.splice(o,0,n.currency.symbol+h),i=i.join("")):i=n.currency.symbol+h+i:i.indexOf(")")>-1?(i=i.split(""),i.splice(-1,0,h+n.currency.symbol),i=i.join("")):i=i+h+n.currency.symbol,i}function s(t,e,n,r){var o,i="",t=100*t;return e.indexOf(" %")>-1?(i=" ",e=e.replace(" %","")):e=e.replace("%",""),o=l(t,e,n,r),o.indexOf(")")>-1?(o=o.split(""),o.splice(-1,0,i+"%"),o=o.join("")):o=o+i+"%",o}function a(t,e){var n=Math.floor(t/60/60),r=Math.floor((t-60*n*60)/60),o=Math.round(t-60*n*60-60*r);return n+":"+(10>r?"0"+r:r)+":"+(10>o?"0"+o:o)}function l(t,e,n,o){var i,s,a,l,u,h,c=!1,p=!1,_=!1,d="",f=!1,m=!1,g=!1,y=!1,v=!1,b="",x="",w=Math.abs(t),k=["B","KB","MB","GB","TB","PB","EB","ZB","YB"],M="",j=!1;if(e.indexOf("(")>-1?(c=!0,e=e.slice(1,-1)):e.indexOf("+")>-1&&(p=!0,e=e.replace(/\+/g,"")),e.indexOf("a")>-1&&(f=e.indexOf("aK")>=0,m=e.indexOf("aM")>=0,g=e.indexOf("aB")>=0,y=e.indexOf("aT")>=0,v=f||m||g||y,e.indexOf(" a")>-1?(d=" ",e=e.replace(" a","")):e=e.replace("a",""),w>=Math.pow(10,12)&&!v||y?(d+=n.abbreviations.trillion,t/=Math.pow(10,12)):w<Math.pow(10,12)&&w>=Math.pow(10,9)&&!v||g?(d+=n.abbreviations.billion,t/=Math.pow(10,9)):w<Math.pow(10,9)&&w>=Math.pow(10,6)&&!v||m?(d+=n.abbreviations.million,t/=Math.pow(10,6)):(w<Math.pow(10,6)&&w>=Math.pow(10,3)&&!v||f)&&(d+=n.abbreviations.thousand,t/=Math.pow(10,3))),e.indexOf("b")>-1)for(e.indexOf(" b")>-1?(b=" ",e=e.replace(" b","")):e=e.replace("b",""),a=0;a<=k.length;a++)if(i=Math.pow(1024,a),s=Math.pow(1024,a+1),t>=i&&s>t){b+=k[a],i>0&&(t/=i);break}return e.indexOf("o")>-1&&(e.indexOf(" o")>-1?(x=" ",e=e.replace(" o","")):e=e.replace("o",""),x+=n.ordinal(t)),e.indexOf("[.]")>-1&&(_=!0,e=e.replace("[.]",".")),l=t.toString().split(".")[0],u=e.split(".")[1],h=e.indexOf(","),u?(u.indexOf("[")>-1?(u=u.replace("]",""),u=u.split("["),M=r(t,u[0].length+u[1].length,o,u[1].length)):M=r(t,u.length,o),l=M.split(".")[0],M=M.split(".")[1].length?n.delimiters.decimal+M.split(".")[1]:"",_&&0===Number(M.slice(1))&&(M="")):l=r(t,null,o),l.indexOf("-")>-1&&(l=l.slice(1),j=!0),h>-1&&(l=l.toString().replace(/(\d)(?=(\d{3})+(?!\d))/g,"$1"+n.delimiters.thousands)),0===e.indexOf(".")&&(l=""),(c&&j?"(":"")+(!c&&j?"-":"")+(!j&&p?"+":"")+l+M+(x?x:"")+(d?d:"")+(b?b:"")+(c&&j?")":"")}function u(t,e){p[t]=e}function h(t,e,n,r){return o(Number(t),c.isString(e)?e:_,c.isString(n)?p[n]:p[d],c.isUndefined(r)?Math.round:r)}/*!
|
|
* numeral.js
|
|
* version : 1.5.3
|
|
* author : Adam Draper
|
|
* license : MIT
|
|
* http://adamwdraper.github.com/Numeral-js/
|
|
*/
|
|
var c=t("underscore"),p={},_="0,0",d="en";u("en",{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:"$"}}),e.exports={format:h}},{underscore:"underscore"}]},{},["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.
|
|
*/
|