Files
shiny/inst/www/shared/shiny.min.js

5 lines
56 KiB
JavaScript

/*! shiny 0.11.1.9003 | (c) 2012-2015 RStudio, Inc. | License: GPL-3 | file LICENSE */
!function(){function getIEVersion(){var a=-1;if(browser.isIE){var b=navigator.userAgent,c=new RegExp("MSIE ([0-9]{1,}[\\.0-9]{0,})");null!==c.exec(b)&&(a=parseFloat(RegExp.$1))}return a}function escapeHTML(a){return a.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;").replace(/\//g,"&#x2F;")}function randomId(){return Math.floor(4294967296+64424509440*Math.random()).toString(16)}function strToBool(a){if(!a||!a.toLowerCase)return void 0;switch(a.toLowerCase()){case"true":return!0;case"false":return!1;default:return void 0}}function getStyle(a,b){var c;if(a.currentStyle)c=a.currentStyle[b];else if(window.getComputedStyle){var d=document.defaultView.getComputedStyle(a,null);d&&(c=d.getPropertyValue(b))}return c}function padZeros(a,b){for(var c=a.toString();c.length<b;)c="0"+c;return c}function parseDate(a){var b=new Date(a);return isNaN(b)&&(b=new Date(a.replace(/-/g,"/"))),b}function slice(a,b,c){if(a.slice)return a.slice(b,c);if(a.mozSlice)return a.mozSlice(b,c);if(a.webkitSlice)return a.webkitSlice(b,c);throw"Blob doesn't support slice"}function makeResizeFilter(a,b){var c={};return function(){var d={w:a.offsetWidth,h:a.offsetHeight};(0!==d.w||0!==d.h)&&(d.w!==c.w||d.h!==c.h)&&(c=d,b(d.w,d.h))}}function makeBlob(a){try{return new Blob(a)}catch(b){var c=new _BlobBuilder;return $.each(a,function(a,b){c.append(b)}),c.getBlob()}}function pixelRatio(){return window.devicePixelRatio?window.devicePixelRatio:1}function scopeExprToFunc(a){var b=new Function("with (this) {return ("+a+");}");return function(a){return b.call(a)}}function debounce(a,b){var c,d,e=null;return function(){c=this,d=arguments,null!==e&&(clearTimeout(e),e=null),e=setTimeout(function(){null!==e&&(e=null,b.apply(c,d))},a)}}function throttle(a,b){function c(){d=null,e=null,null===g?(g=setTimeout(function(){g=null,f&&(f=!1,c.apply(d,e))},a),b.apply(this,arguments)):(f=!0,d=this,e=arguments)}var d,e,f=!1,g=null;return c}function mergeSort(a,b){function c(a,b,c){for(var d=0,e=0,f=[];d<b.length&&e<c.length;)f.push(a(b[d],c[e])<=0?b[d++]:c[e++]);for(;d<b.length;)f.push(b[d++]);for(;e<c.length;)f.push(c[e++]);return f}a=a.slice(0);for(var d=1;d<a.length;d*=2)for(var e=0;e<a.length;e+=2*d){var f=a.slice(e,e+d),g=a.slice(e+d,e+2*d),h=c(b,f,g),i=[e,h.length];Array.prototype.push.apply(i,h),Array.prototype.splice.apply(a,i)}return a}function asArray(a){return null===a?[]:$.isArray(a)?a:[a]}function registerDependency(a,b){htmlDependencies[a]=b}function renderDependency(a){if(htmlDependencies.hasOwnProperty(a.name))return!1;registerDependency(a.name,a.version);var b=a.src.href,c=$("head").first();if(a.meta){var d=$.map(asArray(a.meta),function(a,b){return $("<meta>").attr("name",b).attr("content",a)});c.append(d)}if(a.stylesheet){var e=$.map(asArray(a.stylesheet),function(a){return $("<link rel='stylesheet' type='text/css'>").attr("href",b+"/"+encodeURI(a))});c.append(e)}if(a.script){var f=$.map(asArray(a.script),function(a){return $("<script>").attr("src",b+"/"+encodeURI(a))});c.append(f)}if(a.attachment){var g=a.attachment;if("string"==typeof g&&(g=[g]),$.isArray(g)){var h={};$.each(g,function(a,b){h[a+1+""]=b}),g=h}var i=$.map(g,function(c,d){return $("<link rel='attachment'>").attr("id",a.name+"-"+d+"-attachment").attr("href",b+"/"+encodeURI(c))});c.append(i)}if(a.head){var j=$("<head></head>");j.html(a.head),c.append(j.children())}return!0}function uploadFiles(a){var b=$(a.target),c=b.data("currentUploader");c&&c.abort();var d=a.target.files,e=browser.isIE&&8===browser.IEVersion,f=fileInputBinding.getId(a.target);(e||0!==d.length)&&(e?new IE8FileUploader(exports.shinyapp,f,a.target):b.data("currentUploader",new FileUploader(exports.shinyapp,f,d)))}function initShiny(){function a(a){void 0===a&&(a=document),a=$(a);for(var b=outputBindings.getBindings(),c=0;c<b.length;c++)for(var d=b[c].binding,e=d.find(a)||[],f=0;f<e.length;f++){var g=e[f],h=d.getId(g);if(h){var i=$(g);if(!i.data("shiny-output-binding")){var k=new OutputBindingAdapter(g,d);o.bindOutput(h,k),i.data("shiny-output-binding",k),i.addClass("shiny-bound-output")}}}setTimeout(j,0),setTimeout(m,0)}function b(a){void 0===a&&(a=document);for(var b=$(a).find(".shiny-bound-output"),c=0;c<b.length;c++){var d=$(b[c]).data("shiny-output-binding");if(d){var e=d.binding.getId(b[c]);o.unbindOutput(e,d),$(b[c]).removeClass("shiny-bound-output")}}setTimeout(m,0)}function c(a,b,c){var d=a.getId(b);if(d){var e=a.getValue(b),f=a.getType(b);f&&(d=d+":"+f),t.setInput(d,e,!c)}}function d(a){void 0===a&&(a=document);for(var b=inputBindings.getBindings(),d={},e=0;e<b.length;e++)for(var f=b[e].binding,g=f.find(a)||[],h=0;h<g.length;h++){var i=g[h],j=f.getId(i);if(j&&!u[j]){var k=f.getType(i),l=k?j+":"+k:j;d[l]=f.getValue(i);var m=function(){var a=f,b=i;return function(d){c(a,b,d)}}();f.subscribe(i,m),$(i).data("shiny-input-binding",f),$(i).addClass("shiny-bound-input");var n=f.getRatePolicy(i);null!==n&&r.setRatePolicy(l,n.policy,n.delay),u[j]={binding:f,node:i},o.isConnected()&&c(f,i,!1)}}return d}function e(a){void 0===a&&(a=document);for(var b=$(a).find(".shiny-bound-input"),c=0;c<b.length;c++){var d=$(b[c]).data("shiny-input-binding");if(d){var e=d.getId(b[c]);$(b[c]).removeClass("shiny-bound-input"),delete u[e],d.unsubscribe(b[c])}}}function f(b){return a(b),d(b)}function g(a){e(a),b(a)}function h(a){void 0===a&&(a=document);for(var b=inputBindings.getBindings(),c=0;c<b.length;c++)for(var d=b[c].binding,e=d.find(a)||[],f=0;f<e.length;f++)d.initialize(e[f])}function i(){$(".shiny-image-output, .shiny-plot-output").each(function(){(0!==this.offsetWidth||0!==this.offsetHeight)&&(t.setInput(".clientdata_output_"+this.id+"_width",this.offsetWidth),t.setInput(".clientdata_output_"+this.id+"_height",this.offsetHeight))}),$(".shiny-bound-output").each(function(){$(this).data("shiny-output-binding").onResize()})}function j(){w.normalCall()}function k(a){return null===a||0!==a.offsetWidth||0!==a.offsetHeight?!1:"none"===getStyle(a,"display")?!0:k(a.parentNode)}function l(){var a={};$(".shiny-bound-output").each(function(){delete x[this.id],k(this)?t.setInput(".clientdata_output_"+this.id+"_hidden",!0):(a[this.id]=!0,t.setInput(".clientdata_output_"+this.id+"_hidden",!1))});for(var b in x)x.hasOwnProperty(b)&&t.setInput(".clientdata_output_"+b+"_hidden",!0);x=a}function m(){y.normalCall()}function n(a,b){return a=a.split("."),function(c){for(var d=c.namespace.split("."),e=0;e<a.length;e++)if(-1===d.indexOf(a[e]))return;b.apply(this,arguments)}}var o=exports.shinyapp=new ShinyApp,p=new InputBatchSender(o),q=new InputNoResendDecorator(p),r=new InputRateDecorator(q),s=new InputDeferDecorator(q),t=r;$('input[type="submit"], button[type="submit"]').each(function(){t=s,$(this).click(function(a){a.preventDefault(),s.submit()})}),exports.onInputChange=function(a,b){t.setInput(a,b)};var u={};exports.bindAll=function(a){var b=f(a);$.each(b,function(a,b){t.setInput(a,b)})},exports.unbindAll=g,exports.initializeInputs=h,h(document);var v=f(document);$(".shiny-image-output, .shiny-plot-output").each(function(){(0!==this.offsetWidth||0!==this.offsetHeight)&&(v[".clientdata_output_"+this.id+"_width"]=this.offsetWidth,v[".clientdata_output_"+this.id+"_height"]=this.offsetHeight)});var w=new Debouncer(null,i,0);p.lastChanceCallback.push(function(){w.isPending()&&w.immediateCall()});var x={};$(".shiny-bound-output").each(function(){k(this)?v[".clientdata_output_"+this.id+"_hidden"]=!0:(x[this.id]=!0,v[".clientdata_output_"+this.id+"_hidden"]=!1)});var y=new Debouncer(null,l,0);p.lastChanceCallback.push(function(){y.isPending()&&y.immediateCall()}),$(window).resize(debounce(500,j));var z=["modal","dropdown","tab","tooltip","popover","collapse"];$.each(z,function(a,b){$("body").on("shown.bs."+b+".sendImageSize","*",n("bs",j)),$("body").on("shown.bs."+b+".sendOutputHiddenState hidden.bs."+b+".sendOutputHiddenState","*",n("bs",m))}),$("body").on("shown.sendImageSize","*",j),$("body").on("shown.sendOutputHiddenState hidden.sendOutputHiddenState","*",m),v[".clientdata_pixelratio"]=pixelRatio(),$(window).resize(function(){t.setInput(".clientdata_pixelratio",pixelRatio())}),v[".clientdata_url_protocol"]=window.location.protocol,v[".clientdata_url_hostname"]=window.location.hostname,v[".clientdata_url_port"]=window.location.port,v[".clientdata_url_pathname"]=window.location.pathname,v[".clientdata_url_search"]=window.location.search,v[".clientdata_url_hash_initial"]=window.location.hash;var A=v[".clientdata_singletons"]=$('script[type="application/shiny-singletons"]').text();singletons.registerNames(A.split(/,/));var B=$('script[type="application/html-dependencies"]').text();$.each(B.split(/;/),function(a,b){var c=/\s*^(.+)\[(.+)\]\s*$/.exec(b);c&&registerDependency(c[1],c[2])}),q.reset(v),o.connect(v)}var $=jQuery,exports=window.Shiny=window.Shiny||{},browser={};browser.isQt=!1,/\bQt\//.test(window.navigator.userAgent)&&($(document.documentElement).addClass("qt"),browser.isQt=!0),/\bQt\/5/.test(window.navigator.userAgent)&&/Linux/.test(window.navigator.userAgent)&&$(document.documentElement).addClass("qt5"),browser.isIE="Microsoft Internet Explorer"===navigator.appName,browser.IEVersion=getIEVersion(),$(document).on("submit","form:not([action])",function(a){a.preventDefault()}),$(document).on("click","a.action-button",function(a){a.preventDefault()});var $escape=exports.$escape=function(a){return a.replace(/([!"#$%&'()*+,.\/:;<=>?@\[\\\]^`{|}~])/g,"\\$1")},_BlobBuilder=window.BlobBuilder||window.WebKitBlobBuilder||window.MozBlobBuilder||window.MSBlobBuilder,Invoker=function(a,b){this.target=a,this.func=b};(function(){this.normalCall=this.immediateCall=function(){this.func.apply(this.target,arguments)}}).call(Invoker.prototype);var Debouncer=function(a,b,c){this.target=a,this.func=b,this.delayMs=c,this.timerId=null,this.args=null};(function(){this.normalCall=function(){var a=this;this.$clearTimer(),this.args=arguments,this.timerId=setTimeout(function(){null!==a.timerId&&(a.$clearTimer(),a.$invoke())},this.delayMs)},this.immediateCall=function(){this.$clearTimer(),this.args=arguments,this.$invoke()},this.isPending=function(){return null!==this.timerId},this.$clearTimer=function(){null!==this.timerId&&(clearTimeout(this.timerId),this.timerId=null)},this.$invoke=function(){this.func.apply(this.target,this.args),this.args=null}}).call(Debouncer.prototype);var Throttler=function(a,b,c){this.target=a,this.func=b,this.delayMs=c,this.timerId=null,this.args=null};(function(){this.normalCall=function(){var a=this;this.args=arguments,null===this.timerId&&(this.$invoke(),this.timerId=setTimeout(function(){null!==a.timerId&&(a.$clearTimer(),a.args&&a.normalCall.apply(a,a.args))},this.delayMs))},this.immediateCall=function(){this.$clearTimer(),this.args=arguments,this.$invoke()},this.isPending=function(){return null!==this.timerId},this.$clearTimer=function(){null!==this.timerId&&(clearTimeout(this.timerId),this.timerId=null)},this.$invoke=function(){this.func.apply(this.target,this.args),this.args=null}}).call(Throttler.prototype);var InputBatchSender=function(a){this.shinyapp=a,this.timerId=null,this.pendingData={},this.reentrant=!1,this.lastChanceCallback=[]};(function(){this.setInput=function(a,b){var c=this;this.pendingData[a]=b,this.timerId||this.reentrant||(this.timerId=setTimeout(function(){c.reentrant=!0;try{$.each(c.lastChanceCallback,function(a,b){b()}),c.timerId=null;var a=c.pendingData;c.pendingData={},c.shinyapp.sendInput(a)}finally{c.reentrant=!1}},0))}}).call(InputBatchSender.prototype);var InputNoResendDecorator=function(a,b){this.target=a,this.lastSentValues=b||{}};(function(){this.setInput=function(a,b){var c=JSON.stringify(b);this.lastSentValues[a]!==c&&(this.lastSentValues[a]=c,this.target.setInput(a,b))},this.reset=function(a){a=a||{};var b={};$.each(a,function(a,c){b[a]=JSON.stringify(c)}),this.lastSentValues=b}}).call(InputNoResendDecorator.prototype);var InputDeferDecorator=function(a){this.target=a,this.pendingInput={}};(function(){this.setInput=function(a,b){/^\./.test(a)?this.target.setInput(a,b):this.pendingInput[a]=b},this.submit=function(){for(var a in this.pendingInput)this.pendingInput.hasOwnProperty(a)&&this.target.setInput(a,this.pendingInput[a])}}).call(InputDeferDecorator.prototype);var InputRateDecorator=function(a){this.target=a,this.inputRatePolicies={}};(function(){this.setInput=function(a,b,c){this.$ensureInit(a),c?this.inputRatePolicies[a].immediateCall(a,b,c):this.inputRatePolicies[a].normalCall(a,b,c)},this.setRatePolicy=function(a,b,c){"direct"===b?this.inputRatePolicies[a]=new Invoker(this,this.$doSetInput):"debounce"===b?this.inputRatePolicies[a]=new Debouncer(this,this.$doSetInput,c):"throttle"===b&&(this.inputRatePolicies[a]=new Throttler(this,this.$doSetInput,c))},this.$ensureInit=function(a){a in this.inputRatePolicies||this.setRatePolicy(a,"direct")},this.$doSetInput=function(a,b){this.target.setInput(a,b)}}).call(InputRateDecorator.prototype);var ShinyApp=function(){this.$socket=null,this.$inputValues={},this.$bindings={},this.$values={},this.$errors={},this.$conditionals={},this.$pendingMessages=[],this.$activeRequests={},this.$nextRequestId=0};(function(){function addMessageHandler(a,b){if(messageHandlers[a])throw'handler for message of type "'+a+'" already added.';if("function"!=typeof b)throw"handler must be a function.";if(1!==b.length)throw"handler must be a function that takes one argument.";messageHandlerOrder.push(a),messageHandlers[a]=b}function addCustomMessageHandler(a,b){if(customMessageHandlers[a])throw'handler for message of type "'+a+'" already added.';if("function"!=typeof b)throw"handler must be a function.";if(1!==b.length)throw"handler must be a function that takes one argument.";customMessageHandlerOrder.push(a),customMessageHandlers[a]=b}this.connect=function(a){if(this.$socket)throw"Connect was already called on this application object";$.extend(a,{".clientdata_allowDataUriScheme":"undefined"!=typeof WebSocket}),this.$socket=this.createSocket(),this.$initialInput=a,$.extend(this.$inputValues,a),this.$updateConditionals()},this.isConnected=function(){return!!this.$socket},this.createSocket=function(){var a=this,b=exports.createSocket||function(){var a="ws:";"https:"===window.location.protocol&&(a="wss:");var b=window.location.pathname;/^([$#!&-;=?-[\]_a-z~]|%[0-9a-fA-F]{2})+$/.test(b)||(b=encodeURI(b),browser.isQt&&(b=encodeURI(b))),/\/$/.test(b)||(b+="/"),b+="websocket/";var c=new WebSocket(a+"//"+window.location.host+b);return c.binaryType="arraybuffer",c},c=b();return c.onopen=function(){for(c.send(JSON.stringify({method:"init",data:a.$initialInput}));a.$pendingMessages.length;){var b=a.$pendingMessages.shift();c.send(b)}},c.onmessage=function(b){a.dispatchMessage(b.data)},c.onclose=function(){$(document.body).addClass("disconnected"),a.$notifyDisconnected()},c},this.sendInput=function(a){var b=JSON.stringify({method:"update",data:a});this.$sendMsg(b),$.extend(this.$inputValues,a),this.$updateConditionals()},this.$notifyDisconnected=function(){var a=function(a){return"127.0.0.1"==a?"localhost":a},b=parent!==window?document.referrer:null;if(b){var c=document.createElement("a");if(c.href=b,a(c.hostname)==a(window.location.hostname)){var d=c.protocol.replace(":",""),e=d+"://"+c.hostname;c.port&&(e=e+":"+c.port),parent.postMessage("disconnected",e)}}},this.makeRequest=function(a,b,c,d,e){for(var f=this.$nextRequestId;this.$activeRequests[f];)f=(f+1)%1e9;this.$nextRequestId=f+1,this.$activeRequests[f]={onSuccess:c,onError:d};var g=JSON.stringify({method:a,args:b,tag:f});if(e){var h=function(a){var b=new ArrayBuffer(4),c=new DataView(b);return c.setUint32(0,a,!0),b},i=[];i.push(h(16908802));var j=makeBlob([g]);i.push(h(j.size)),i.push(j);for(var k=0;k<e.length;k++)i.push(h(e[k].byteLength||e[k].size||0)),i.push(e[k]);g=makeBlob(i)}this.$sendMsg(g)},this.$sendMsg=function(a){this.$socket.readyState?this.$socket.send(a):this.$pendingMessages.push(a)},this.receiveError=function(a,b){if(this.$errors[a]!==b){this.$errors[a]=b,delete this.$values[a];var c=this.$bindings[a];c&&c.onValueError&&c.onValueError(b)}},this.receiveOutput=function(a,b){if(this.$values[a]!==b){this.$values[a]=b,delete this.$errors[a];var c=this.$bindings[a];return c&&c.onValueChange(b),b}},this.bindOutput=function(a,b){if(!a)throw"Can't bind an element with no ID";if(this.$bindings[a])throw"Duplicate binding for ID "+a;return this.$bindings[a]=b,void 0!==this.$values[a]?b.onValueChange(this.$values[a]):void 0!==this.$errors[a]&&b.onValueError(this.$errors[a]),b},this.unbindOutput=function(a,b){return this.$bindings[a]===b?(delete this.$bindings[a],!0):!1},this.$updateConditionals=function(){var a={};for(var b in this.$inputValues)if(this.$inputValues.hasOwnProperty(b)){var c=b.replace(/:.*/,"");a[c]=this.$inputValues[b]}for(var d={input:a,output:this.$values},e=$(document).find("[data-display-if]"),f=0;f<e.length;f++){var g=$(e[f]),h=g.data("data-display-if-func");if(!h){var i=g.attr("data-display-if");h=scopeExprToFunc(i),g.data("data-display-if-func",h)}var j=h(d),k="none"!==g.css("display");j!==k&&(j?(g.trigger("show"),g.show(),g.trigger("shown")):(g.trigger("hide"),g.hide(),g.trigger("hidden")))}};var messageHandlerOrder=[],messageHandlers={},customMessageHandlerOrder=[],customMessageHandlers={};exports.addCustomMessageHandler=addCustomMessageHandler,this.dispatchMessage=function(a){var b=JSON.parse(a);this._sendMessagesToHandlers(b,messageHandlers,messageHandlerOrder),this.$updateConditionals()},this._sendMessagesToHandlers=function(a,b,c){for(var d=0;d<c.length;d++){var e=c[d];a[e]&&b[e].call(this,a[e])}},addMessageHandler("values",function(a){$(document.documentElement).removeClass("shiny-busy");for(var b in this.$bindings)this.$bindings.hasOwnProperty(b)&&this.$bindings[b].showProgress(!1);for(var c in a)a.hasOwnProperty(c)&&this.receiveOutput(c,a[c])}),addMessageHandler("errors",function(a){for(var b in a)a.hasOwnProperty(b)&&this.receiveError(b,a[b])}),addMessageHandler("inputMessages",function(a){for(var b=0;b<a.length;b++){var c=$(".shiny-bound-input#"+$escape(a[b].id)),d=c.data("shiny-input-binding");c.length>0&&d.receiveMessage(c[0],a[b].message)}}),addMessageHandler("javascript",function(message){eval(message)}),addMessageHandler("console",function(a){for(var b=0;b<a.length;b++)console.log&&console.log(a[b])}),addMessageHandler("progress",function(a){if(a.type&&a.message){var b=progressHandlers[a.type];b&&b.call(this,a.message)}}),addMessageHandler("response",function(a){var b=a.tag,c=this.$activeRequests[b];c&&(delete this.$activeRequests[b],"value"in a?c.onSuccess(a.value):c.onError(a.error))}),addMessageHandler("custom",function(a){exports.oncustommessage&&exports.oncustommessage(a),this._sendMessagesToHandlers(a,customMessageHandlers,customMessageHandlerOrder)}),addMessageHandler("config",function(a){this.config=a});var progressHandlers={binding:function(a){$(document.documentElement).addClass("shiny-busy");var b=a.id,c=this.$bindings[b];c&&c.showProgress&&c.showProgress(!0)},open:function(a){var b=$(".shiny-progress-container");0===b.length&&(b=$('<div class="shiny-progress-container"></div>'),$("body").append(b));var c=$(".shiny-progress.open").length,d=$(progressHandlers.progressHTML);d.attr("id",a.id),b.append(d);var e=d.find(".progress");e.css("top",c*e.height()+"px");var f=d.find(".progress-text");f.css("top",3*e.height()+c*f.outerHeight()+"px"),d.hide()},update:function(a){var b=$("#"+a.id+".shiny-progress");"undefined"!=typeof a.message&&b.find(".progress-message").text(a.message),"undefined"!=typeof a.detail&&b.find(".progress-detail").text(a.detail),"undefined"!=typeof a.value&&(null!==a.value?(b.find(".progress").show(),b.find(".bar").width(100*a.value+"%")):b.find(".progress").hide()),b.fadeIn()},close:function(a){var b=$("#"+a.id+".shiny-progress");b.removeClass("open"),b.fadeOut({complete:function(){b.remove(),0===$(".shiny-progress").length&&$(".shiny-progress-container").remove()}})},progressHTML:'<div class="shiny-progress open"><div class="progress progress-striped active"><div class="progress-bar bar"></div></div><div class="progress-text"><span class="progress-message">message</span><span class="progress-detail"></span></div></div>'};exports.progressHandlers=progressHandlers}).call(ShinyApp.prototype);var FileProcessor=function(a){this.files=a,this.fileIndex=-1,this.aborted=!1,this.completed=!1,this.$run()};(function(){this.onBegin=function(a,b){setTimeout(b,0)},this.onFile=function(a,b){setTimeout(b,0)},this.onComplete=function(){},this.onAbort=function(){},this.abort=function(){this.completed||this.aborted||(this.aborted=!0,this.onAbort())},this.$getRun=function(){var a=this,b=!1;return function(){b||(b=!0,a.$run())}},this.$run=function(){if(!this.aborted&&!this.completed){if(this.fileIndex<0)return this.fileIndex=0,void this.onBegin(this.files,this.$getRun());if(this.fileIndex===this.files.length)return this.completed=!0,void this.onComplete();var a=this.files[this.fileIndex++];this.onFile(a,this.$getRun())}}}).call(FileProcessor.prototype);var BindingRegistry=function(){this.bindings=[],this.bindingNames={}};(function(){this.register=function(a,b,c){var d={binding:a,priority:c||0};this.bindings.unshift(d),b&&(this.bindingNames[b]=d,a.name=b)},this.setPriority=function(a,b){var c=this.bindingNames[a];if(!c)throw"Tried to set priority on unknown binding "+a;c.priority=b||0},this.getPriority=function(a){var b=this.bindingNames[a];return b?b.priority:!1},this.getBindings=function(){return mergeSort(this.bindings,function(a,b){return b.priority-a.priority})}}).call(BindingRegistry.prototype);var inputBindings=exports.inputBindings=new BindingRegistry,outputBindings=exports.outputBindings=new BindingRegistry,OutputBinding=exports.OutputBinding=function(){};(function(){this.find=function(){throw"Not implemented"},this.getId=function(a){return a["data-input-id"]||a.id},this.onValueChange=function(a,b){this.clearError(a),this.renderValue(a,b)},this.onValueError=function(a,b){this.renderError(a,b)},this.renderError=function(a,b){if(this.clearError(a),""===b.message)return void $(a).empty();var c="shiny-output-error";null!==b.type&&(c=c+" "+$.map(asArray(b.type),function(a){return c+"-"+a}).join(" ")),$(a).addClass(c).text(b.message)},this.clearError=function(a){$(a).attr("class",function(a,b){return b.replace(/(^|\s)shiny-output-error\S*/g,"")})},this.showProgress=function(a,b){var c="recalculating";b?$(a).addClass(c):$(a).removeClass(c)}}).call(OutputBinding.prototype);var textOutputBinding=new OutputBinding;$.extend(textOutputBinding,{find:function(a){return $(a).find(".shiny-text-output")},renderValue:function(a,b){$(a).text(b)}}),outputBindings.register(textOutputBinding,"shiny.textOutput");var imageOutputBinding=new OutputBinding;$.extend(imageOutputBinding,{find:function(a){return $(a).find(".shiny-image-output, .shiny-plot-output")},renderValue:function(a,b){function c(a){var b=l.offset();return{x:a.pageX-b.left,y:a.pageY-b.top}}function d(a,b){function c(a){var c=a-e.bounds.left,d=(e.usr.right-e.usr.left)/(e.bounds.right-e.bounds.left),f=c*d+e.usr.left;if(b){var g=Math.max(e.usr.right,e.usr.left),h=Math.min(e.usr.right,e.usr.left);f>g?f=g:h>f&&(f=h)}return f}function d(a){var c=a-e.bounds.bottom,d=(e.usr.top-e.usr.bottom)/(e.bounds.top-e.bounds.bottom),f=c*d+e.usr.bottom;if(b){var g=Math.max(e.usr.top,e.usr.bottom),h=Math.min(e.usr.top,e.usr.bottom);f>g?f=g:h>f&&(f=h)}return f}b=b||!0;var e=n.coordmap;if(!e)return a;var f=c(a.x);e.log.x&&(f=Math.pow(10,f));var g=d(a.y);return e.log.y&&(g=Math.pow(10,g)),{x:f,y:g}}function e(){return n.coordmap?n.coordmap.bounds:{top:0,left:0,right:m.clientWidth-1,bottom:m.clientHeight-1}}function f(a,b){b=b||0;var c=e();return a.x<c.right+b&&a.x>c.left-b&&a.y<c.bottom+b&&a.y>c.top-b}function g(a){var b=e(),c={x:a.x,y:a.y};return a.x>b.right?c.x=b.right:a.x<b.left&&(c.x=b.left),a.y>b.bottom?c.y=b.bottom:a.y<b.top&&(c.y=b.top),c}function h(a,b){return b=b||!0,function(e){if(null===e)return void exports.onInputChange(a,null);var g=c(e);if(!b||f(g)){var h=d(g);h[".nonce"]=Math.random(),exports.onInputChange(a,h)}}}function i(a){var b=h(a,n.clickClip);return{mousedown:function(a){1===a.which&&b(a)},onRemoveImg:function(){b(null)}}}function j(a){var b,c=h(a,n.hoverClip);return b="throttle"===n.hoverDelayType?new Throttler(null,c,n.hoverDelay):new Debouncer(null,c,n.hoverDelay),{mousemove:function(a){b.normalCall(a)},onRemoveImg:function(){b.immediateCall(null)}}}function k(b){function h(a,b){return{xmin:Math.min(a.x,b.x),xmax:Math.max(a.x,b.x),ymin:Math.min(a.y,b.y),ymax:Math.max(a.y,b.y)}}function i(a,b,c){a instanceof Array||(a=[a]);var d=Math.max.apply(null,a),e=Math.min.apply(null,a),f=0;d>c?f=c-d:b>e&&(f=b-e);for(var g=[],h=0;h<a.length;h++)g[h]=a[h]+f;return g}function j(a){l.removeClass("crosshair"),l.removeClass("grabbable"),l.removeClass("grabbing"),a&&l.addClass(a)}function k(){var a=w.bounds;if(isNaN(a.xmin))return void exports.onInputChange(b,null);var c=d({x:a.xmin,y:a.ymin},n.brushClip),e=d({x:a.xmax,y:a.ymax},n.brushClip),f={xmin:Math.min(c.x,e.x),xmax:Math.max(c.x,e.x),ymin:Math.min(c.y,e.y),ymax:Math.max(c.y,e.y)};exports.onInputChange(b,f)}function m(a){if(!w.brushing&&!w.dragging&&1===a.which){var b=c(a);(!n.brushClip||f(b,v))&&(w.up={x:0/0,y:0/0},w.down=b,w.isInsideBrush(b)?(w.startDragging(b),j("grabbing"),$(document).on("mousemove.image_brush",q).on("mouseup.image_brush",s)):(w.startBrushing(g(b)),$(document).on("mousemove.image_brush",p).on("mouseup.image_brush",r)))}}function o(a){var b=c(a);w.brushing||w.dragging||j(w.isInsideBrush(b)?"grabbable":f(b,v)?"crosshair":null)}function p(a){w.brushTo(c(a)),u.normalCall()}function q(a){w.dragTo(c(a)),u.normalCall()}function r(a){return 1===a.which?($(document).off("mousemove.image_brush").off("mouseup.image_brush"),w.up=c(a),w.stopBrushing(),j("crosshair"),w.down.x===w.up.x&&w.down.y===w.up.y?(w.reset(),void u.immediateCall()):void(u.isPending()&&u.immediateCall())):void 0}function s(a){1===a.which&&($(document).off("mousemove.image_brush").off("mouseup.image_brush"),w.up=c(a),w.stopDragging(),j("grabbable"),u.isPending()&&u.immediateCall())}function t(){n.brushResetOnNew&&(w.reset(),u.immediateCall())}var u,v=20,w={brushing:!1,dragging:!1,down:{x:0/0,y:0/0},up:{x:0/0,y:0/0},bounds:{xmin:0/0,xmax:0/0,ymin:0/0,ymax:0/0},dragStartBounds:{xmin:0/0,xmax:0/0,ymin:0/0,ymax:0/0},$div:null,reset:function(){return this.brushing=!1,this.dragging=!1,this.down={x:0/0,y:0/0},this.up={x:0/0,y:0/0},this.bounds={xmin:0/0,xmax:0/0,ymin:0/0,ymax:0/0},this.dragStartBounds={xmin:0/0,xmax:0/0,ymin:0/0,ymax:0/0},this.$div&&this.$div.remove(),this},importOldBrush:function(){var b=l.find("#"+a.id+"_brush");if(0!==b.length){var c=l.offset(),d=b.offset();this.bounds={xmin:d.left-c.left,xmax:d.left-c.left+b.width(),ymin:d.top-c.top,ymax:d.top-c.top+b.height()},this.$div=b}},isInsideBrush:function(a){var b=this.bounds;return a.x<=b.xmax&&a.x>=b.xmin&&a.y<=b.ymax&&a.y>=b.ymin},setBounds:function(a){var b=e(),c={x:a.xmin,y:a.ymin},d={x:a.xmax,y:a.ymax};n.brushClip&&(c=g(c),d=g(d)),"xy"===n.brushDirection||("x"===n.brushDirection?(c.y=b.top,d.y=b.bottom):"y"===n.brushDirection&&(c.x=b.left,d.x=b.right)),this.bounds={xmin:c.x,xmax:d.x,ymin:c.y,ymax:d.y}},addDiv:function(){this.$div&&this.$div.remove(),this.$div=$(document.createElement("div")).attr("id",a.id+"_brush").css({"background-color":n.brushFill,opacity:n.brushOpacity,"pointer-events":"none",position:"absolute"});var b="1px solid "+n.brushStroke;"xy"===n.brushDirection?this.$div.css({border:b}):"x"===n.brushDirection?this.$div.css({"border-left":b,"border-right":b}):"y"===n.brushDirection&&this.$div.css({"border-top":b,"border-bottom":b}),l.append(this.$div),this.$div.offset({x:0,y:0}).width(0).height(0).show()},updateDiv:function(){var a=l.offset(),b=this.bounds;this.$div.offset({top:a.top+b.ymin,left:a.left+b.xmin}).width(b.xmax-b.xmin).height(b.ymax-b.ymin).show()},startBrushing:function(){this.brushing=!0,this.addDiv(),this.setBounds(h(this.down,this.down)),this.updateDiv()},brushTo:function(a){this.setBounds(h(this.down,a)),this.updateDiv()},stopBrushing:function(){this.brushing=!1,this.setBounds(h(this.down,this.up))},startDragging:function(){this.dragging=!0,this.dragStartBounds=$.extend({},this.bounds)},dragTo:function(a){var b=a.x-this.down.x,c=a.y-this.down.y,d=this.dragStartBounds,f={xmin:d.xmin+b,xmax:d.xmax+b,ymin:d.ymin+c,ymax:d.ymax+c};if(n.brushClip){var g=e(),h=[f.xmin,f.xmax],j=[f.ymin,f.ymax];h=i(h,g.left,g.right),j=i(j,g.top,g.bottom),f={xmin:h[0],xmax:h[1],ymin:j[0],ymax:j[1]}}this.setBounds(f),this.updateDiv()},stopDragging:function(){this.dragging=!1}};return u="throttle"===n.brushDelayType?new Throttler(null,k,n.brushDelay):new Debouncer(null,k,n.brushDelay),n.brushResetOnNew||w.importOldBrush(),{mousedown:m,mousemove:o,onRemoveImg:t}}var l=$(a),m=null;if(l.off(".image_output"),l.find("img").trigger("remove"),!b)return void l.empty();var n={clickId:l.data("click-id"),clickClip:strToBool(l.data("click-clip"))||!0,dblclickId:l.data("dblclick-id"),dblclickClip:strToBool(l.data("dblclick-clip"))||!0,dblclickDelay:l.data("dblclick-delay")||400,hoverId:l.data("hover-id"),hoverClip:l.data("hover-clip")||!0,hoverDelayType:l.data("hover-delay-type")||"debounce",hoverDelay:l.data("hover-delay")||300,brushId:l.data("brush-id"),brushClip:strToBool(l.data("brush-clip"))||!0,brushDelayType:l.data("brush-delay-type")||"debounce",brushDelay:l.data("brush-delay")||300,brushFill:l.data("brush-fill")||"#666",brushStroke:l.data("brush-stroke")||"#000",brushOpacity:l.data("brush-opacity")||.3,brushDirection:l.data("brush-direction")||"xy",brushResetOnNew:strToBool(l.data("brush-reset-on-new"))||!1,coordmap:b.coordmap};m=document.createElement("img"),$.each(b,function(a,b){null!==b&&(m[a]=b)});var o=$(m),p={clickCount:0,clickTimer:null,pending_e:null,triggerEvent:function(a,b){var c=$.Event(a,{which:b.which,pageX:b.pageX,pageY:b.pageY,offsetX:b.offsetX,offsetY:b.offsetY});l.trigger(c)},triggerPendingMousedown2:function(){this.pending_e&&(this.triggerEvent("mousedown2",this.pending_e),this.pending_e=null)},scheduleMousedown2:function(a){this.pending_e=a;var b=this;this.clickTimer=setTimeout(function(){b.triggerPendingMousedown2()},n.dblclickDelay)},mousedown:function(a){return 1===a.which?n.dblclickId?void(null===this.pending_e?this.scheduleMousedown2(a):(clearTimeout(this.clickTimer),this.pending_e&&Math.abs(this.pending_e.offsetX-a.offsetX)>2||Math.abs(this.pending_e.offsetY-a.offsetY)>2?(this.triggerPendingMousedown2(),this.scheduleMousedown2(a)):(this.pending_e=null,this.triggerEvent("dblclick2",a)))):void this.triggerEvent("mousedown2",a):void 0},dblclickIE8:function(a){a.which=1,this.triggerEvent("dblclick2",a)}};if(l.on("mousedown.image_output",function(a){p.mousedown(a)}),browser.isIE&&8===browser.IEVersion&&l.on("dblclick.image_output",function(a){p.dblclickIE8(a)}),n.clickId){var q=i(n.clickId);l.on("mousedown2.image_output",q.mousedown),o.on("remove",q.onRemoveImg)}if(n.dblclickId){var r=i(n.dblclickId);l.on("dblclick2.image_output",r.mousedown),o.on("remove",r.onRemoveImg)}if(n.hoverId){var s=j(n.hoverId);l.on("mousemove.image_output",s.mousemove),o.on("remove",s.onRemoveImg)}if(n.brushId){o.css("-webkit-user-drag","none"),o.on("dragstart",function(){return!1}),l.on("selectstart.image_output",function(){return!1});var t=k(n.brushId);l.on("mousedown.image_output",t.mousedown),l.on("mousemove.image_output",t.mousemove),o.on("remove",t.onRemoveImg)}(n.clickId||n.dblclickId||n.hoverId||n.brushId)&&l.addClass("crosshair"),l.find("img").remove(),m&&l.append(m)}}),outputBindings.register(imageOutputBinding,"shiny.imageOutput");var htmlOutputBinding=new OutputBinding;$.extend(htmlOutputBinding,{find:function(a){return $(a).find(".shiny-html-output")},onValueError:function(a,b){exports.unbindAll(a),this.renderError(a,b)},renderValue:function(a,b){exports.unbindAll(a);var c,d=[];null===b?c="":"string"==typeof b?c=b:"object"==typeof b&&(c=b.html,d=b.deps),exports.renderHtml(c,a,d),exports.initializeInputs(a),exports.bindAll(a)
}}),outputBindings.register(htmlOutputBinding,"shiny.htmlOutput");var renderDependencies=exports.renderDependencies=function(a){a&&$.each(a,function(a,b){renderDependency(b)})};exports.renderHtml=function(a,b,c){return renderDependencies(c),singletons.renderHtml(a,b)};var htmlDependencies={},singletons={knownSingletons:{},renderHtml:function(a,b){var c=this._processHtml(a);return this._addToHead(c.head),this.register(c.singletons),$(b).html(c.html),c},register:function(a){$.extend(this.knownSingletons,a)},registerNames:function(a){if("string"==typeof a)this.knownSingletons[a]=!0;else if(a instanceof Array)for(var b=0;b<a.length;b++)this.knownSingletons[a[b]]=!0},_addToHead:function(a){if(a.length>0)for(var b=$("<div>"+a+"</div>")[0],c=$("head");b.hasChildNodes();)c.append(b.firstChild)},_processHtml:function(a){for(var b,c=this,d={},e=function(a,b,e,f){return c.knownSingletons[e]||d[e]?"":(d[e]=!0,f)};;){if(b=a.replace(c._reSingleton,e),a.length===b.length)break;a=b}for(var f=[],g=function(a,b){return f.push(b),""};;){if(b=a.replace(c._reHead,g),a.length===b.length)break;a=b}return{html:a,head:f.join("\n"),singletons:d}},_reSingleton:/<!--(SHINY.SINGLETON\[([\w]+)\])-->([\s\S]*?)<!--\/\1-->/,_reHead:/<head(?:\s[^>]*)?>([\s\S]*?)<\/head>/},downloadLinkOutputBinding=new OutputBinding;$.extend(downloadLinkOutputBinding,{find:function(a){return $(a).find("a.shiny-download-link")},renderValue:function(a,b){$(a).attr("href",b)}}),outputBindings.register(downloadLinkOutputBinding,"shiny.downloadLink");var datatableOutputBinding=new OutputBinding;$.extend(datatableOutputBinding,{find:function(a){return $(a).find(".shiny-datatable-output")},onValueError:function(a,b){exports.unbindAll(a),this.renderError(a,b)},renderValue:function(el,data){var $el=$(el).empty();if(data&&data.colnames){var colnames=$.makeArray(data.colnames),header=$.map(colnames,function(a){return"<th>"+a+"</th>"}).join("");header="<thead><tr>"+header+"</tr></thead>";var footer="";(null===data.options||data.options.searching!==!1)&&(footer=$.map(colnames,function(a){return'<th><input type="text" placeholder="'+escapeHTML(a.replace(/(<([^>]+)>)/gi,""))+'" /></th>'}).join(""),footer="<tfoot>"+footer+"</tfoot>");var content='<table class="table table-striped table-hover">'+header+footer+"</table>";$el.append(content),data.evalOptions&&$.each(data.evalOptions,function(i,x){data.options[x]=eval("("+data.options[x]+")")});var searchCI=null===data.options||"undefined"==typeof data.options.search||data.options.search.caseInsensitive!==!1,oTable=$(el).children("table").DataTable($.extend({processing:!0,serverSide:!0,order:[],orderClasses:!1,pageLength:25,ajax:{url:data.action,type:"POST",data:function(a){a.search.caseInsensitive=searchCI,a.escape=data.escape}}},data.options));if("string"==typeof data.callback){var callback=eval("("+data.callback+")");"function"==typeof callback&&callback(oTable)}$el.find("label input").first().unbind("keyup").keyup(debounce(data.searchDelay,function(){oTable.search(this.value).draw()}));var searchInputs=$el.find("tfoot input");searchInputs.length>0&&($.each(oTable.settings()[0].aoColumns,function(a,b){b.bSearchable||searchInputs.eq(a).hide()}),searchInputs.keyup(debounce(data.searchDelay,function(){oTable.column(searchInputs.index(this)).search(this.value).draw()}))),$el.parents(".tab-content").css("overflow","visible")}}}),outputBindings.register(datatableOutputBinding,"shiny.datatableOutput");var InputBinding=exports.InputBinding=function(){};(function(){this.find=function(){throw"Not implemented"},this.getId=function(a){return a["data-input-id"]||a.id},this.getType=function(){return!1},this.getValue=function(){throw"Not implemented"},this.subscribe=function(){},this.unsubscribe=function(){},this.receiveMessage=function(){throw"Not implemented"},this.getState=function(){throw"Not implemented"},this.getRatePolicy=function(){return null},this.initialize=function(){},this.dispose=function(){}}).call(InputBinding.prototype);var textInputBinding=new InputBinding;$.extend(textInputBinding,{find:function(a){return $(a).find('input[type="text"], input[type="password"], input[type="search"], input[type="url"], input[type="email"]')},getId:function(a){return InputBinding.prototype.getId.call(this,a)||a.name},getValue:function(a){return a.value},setValue:function(a,b){a.value=b},subscribe:function(a,b){$(a).on("keyup.textInputBinding input.textInputBinding",function(){b(!0)}),$(a).on("change.textInputBinding",function(){b(!1)})},unsubscribe:function(a){$(a).off(".textInputBinding")},receiveMessage:function(a,b){b.hasOwnProperty("value")&&this.setValue(a,b.value),b.hasOwnProperty("label")&&$(a).parent().find('label[for="'+$escape(a.id)+'"]').text(b.label),$(a).trigger("change")},getState:function(a){return{label:$(a).parent().find('label[for="'+$escape(a.id)+'"]').text(),value:a.value}},getRatePolicy:function(){return{policy:"debounce",delay:250}}}),inputBindings.register(textInputBinding,"shiny.textInput");var textareaInputBinding={};$.extend(textareaInputBinding,textInputBinding,{find:function(a){return $(a).find("textarea")}}),inputBindings.register(textareaInputBinding,"shiny.textareaInput");var numberInputBinding={};$.extend(numberInputBinding,textInputBinding,{find:function(a){return $(a).find('input[type="number"]')},getValue:function(a){var b=$(a).val();return/^\s*$/.test(b)?null:isNaN(b)?b:+b},setValue:function(a,b){a.value=b},getType:function(){return"shiny.number"},receiveMessage:function(a,b){b.hasOwnProperty("value")&&(a.value=b.value),b.hasOwnProperty("min")&&(a.min=b.min),b.hasOwnProperty("max")&&(a.max=b.max),b.hasOwnProperty("step")&&(a.step=b.step),b.hasOwnProperty("label")&&$(a).parent().find('label[for="'+$escape(a.id)+'"]').text(b.label),$(a).trigger("change")},getState:function(a){return{label:$(a).parent().find('label[for="'+$escape(a.id)+'"]').text(),value:this.getValue(a),min:Number(a.min),max:Number(a.max),step:Number(a.step)}}}),inputBindings.register(numberInputBinding,"shiny.numberInput");var checkboxInputBinding=new InputBinding;$.extend(checkboxInputBinding,{find:function(a){return $(a).find('input[type="checkbox"]')},getValue:function(a){return a.checked},setValue:function(a,b){a.checked=b},subscribe:function(a,b){$(a).on("change.checkboxInputBinding",function(){b(!0)})},unsubscribe:function(a){$(a).off(".checkboxInputBinding")},getState:function(a){return{label:$(a).parent().find("span").text(),value:a.checked}},receiveMessage:function(a,b){b.hasOwnProperty("value")&&(a.checked=b.value),b.hasOwnProperty("label")&&$(a).parent().find("span").text(b.label),$(a).trigger("change")}}),inputBindings.register(checkboxInputBinding,"shiny.checkboxInput");var sliderInputBinding={};$.extend(sliderInputBinding,textInputBinding,{find:function(a){return $.fn.ionRangeSlider?$(a).find("input.js-range-slider"):[]},getValue:function(a){var b=$(a).data("ionRangeSlider").result;return 2==this._numValues(a)?[+b.from,+b.to]:+b.from},setValue:function(a,b){var c=$(a).data("ionRangeSlider");c.update(2==this._numValues(a)&&b instanceof Array?{from:b[0],to:b[1]}:{from:b})},subscribe:function(a,b){$(a).on("change.sliderInputBinding",function(){b(!$(a).data("updating")&&!$(a).data("animating"))})},unsubscribe:function(a){$(a).off(".sliderInputBinding")},receiveMessage:function(a,b){var c=$(a).data("ionRangeSlider"),d={};b.hasOwnProperty("value")&&(2==this._numValues(a)&&b.value instanceof Array?(d.from=b.value[0],d.to=b.value[1]):(d.from=b.value,d.to=b.value)),b.hasOwnProperty("min")&&(d.min=b.min),b.hasOwnProperty("max")&&(d.max=b.max),b.hasOwnProperty("step")&&(d.step=b.step),b.hasOwnProperty("label")&&$(a).parent().find('label[for="'+$escape(a.id)+'"]').text(b.label),$(a).data("updating",!0);try{c.update(d)}finally{$(a).data("updating",!1)}},getRatePolicy:function(){return{policy:"debounce",delay:250}},getState:function(){},initialize:function(a){$(a).ionRangeSlider()},_numValues:function(a){return"double"===$(a).data("ionRangeSlider").options.type?2:1}}),inputBindings.register(sliderInputBinding,"shiny.sliderInput");var dateInputBinding=new InputBinding;$.extend(dateInputBinding,{find:function(a){return $(a).find(".shiny-date-input")},getType:function(){return"shiny.date"},getValue:function(a){var b=$(a).find("input").data("datepicker").getUTCDate();return this._formatDate(b)},setValue:function(a,b){var c=this._newDate(b);isNaN(c)||$(a).find("input").datepicker("update",c)},getState:function(a){var b=$(a),c=b.find("input"),d=c.data("datepicker").startDate,e=c.data("datepicker").endDate;d=d===-1/0?null:this._formatDate(d),e=1/0===e?null:this._formatDate(e);var f=c.data("datepicker").startViewMode;return 2===f?f="decade":1===f?f="year":0===f&&(f="month"),{label:b.find('label[for="'+$escape(a.id)+'"]').text(),value:this.getValue(a),valueString:c.val(),min:d,max:e,language:c.data("datepicker").language,weekstart:c.data("datepicker").weekStart,format:this._formatToString(c.data("datepicker").format),startview:f}},receiveMessage:function(a,b){var c=$(a).find("input");b.hasOwnProperty("value")&&this.setValue(a,b.value),b.hasOwnProperty("label")&&$(a).find('label[for="'+$escape(a.id)+'"]').text(b.label),b.hasOwnProperty("min")&&this._setMin(c[0],b.min),b.hasOwnProperty("max")&&this._setMax(c[0],b.max),$(a).trigger("change")},subscribe:function(a,b){$(a).on("keyup.dateInputBinding input.dateInputBinding",function(){b(!0)}),$(a).on("changeDate.dateInputBinding change.dateInputBinding",function(){b(!1)})},unsubscribe:function(a){$(a).off(".dateInputBinding")},getRatePolicy:function(){return{policy:"debounce",delay:250}},initialize:function(a){var b=$(a).find("input"),c=b.data("initial-date");(void 0===c||null===c)&&(c=this._dateAsUTC(new Date)),this.setValue(a,c),this._setMin(b[0],b.data("min-date")),this._setMax(b[0],b.data("max-date"))},_formatDate:function(a){return a instanceof Date?a.getUTCFullYear()+"-"+padZeros(a.getUTCMonth()+1,2)+"-"+padZeros(a.getUTCDate(),2):null},_formatToString:function(a){for(var b="",c=0;c<a.parts.length;c++)b+=a.separators[c]+a.parts[c];return b+=a.separators[c]},_setMin:function(a,b){null===b?$(a).datepicker("setStartDate",null):(b=this._newDate(b),isNaN(b)||$(a).datepicker("setStartDate",b))},_setMax:function(a,b){null===b?$(a).datepicker("setEndDate",null):(b=this._newDate(b),isNaN(b)||$(a).datepicker("setEndDate",b))},_newDate:function(a){if(a instanceof Date)return a;if(!a)return null;var b=parseDate(a);return isNaN(b)?null:new Date(b.getTime())},_dateAsUTC:function(a){return new Date(a.getTime()-6e4*a.getTimezoneOffset())}}),inputBindings.register(dateInputBinding,"shiny.dateInput");var dateRangeInputBinding={};$.extend(dateRangeInputBinding,dateInputBinding,{find:function(a){return $(a).find(".shiny-date-range-input")},getValue:function(a){var b=$(a).find("input"),c=b.eq(0).data("datepicker").getUTCDate(),d=b.eq(1).data("datepicker").getUTCDate();return[this._formatDate(c),this._formatDate(d)]},setValue:function(a,b){if(b instanceof Array){var c=$(a).find("input");if(void 0!==b[0]){var d=this._newDate(b[0]);c.eq(0).datepicker("update",d)}if(void 0!==b[1]){var e=this._newDate(b[1]);c.eq(1).datepicker("update",e)}}},getState:function(a){var b=$(a),c=b.find("input"),d=c.eq(0),e=c.eq(1),f=d.data("datepicker").startDate,g=d.data("datepicker").endDate;f=f===-1/0?null:this._formatDate(f),g=1/0===g?null:this._formatDate(g);var h=d.data("datepicker").startViewMode;return 2===h?h="decade":1===h?h="year":0===h&&(h="month"),{label:b.find('label[for="'+$escape(a.id)+'"]').text(),value:this.getValue(a),valueString:[d.val(),e.val()],min:f,max:g,weekstart:d.data("datepicker").weekStart,format:this._formatToString(d.data("datepicker").format),language:d.data("datepicker").language,startview:h}},receiveMessage:function(a,b){var c=$(a),d=c.find("input"),e=d.eq(0),f=d.eq(1);b.hasOwnProperty("value")&&this.setValue(a,b.value),b.hasOwnProperty("label")&&c.find('label[for="'+$escape(a.id)+'"]').text(b.label),b.hasOwnProperty("min")&&(this._setMin(e[0],b.min),this._setMin(f[0],b.min)),b.hasOwnProperty("max")&&(this._setMax(e[0],b.max),this._setMax(f[0],b.max)),c.trigger("change")},initialize:function(a){var b=$(a),c=b.find("input"),d=c.eq(0),e=c.eq(1),f=d.data("initial-date"),g=e.data("initial-date");(void 0===f||null===f)&&(f=this._dateAsUTC(new Date)),(void 0===g||null===g)&&(g=this._dateAsUTC(new Date)),this.setValue(a,[f,g]),this._setMin(d[0],d.data("min-date")),this._setMin(e[0],d.data("min-date")),this._setMax(d[0],e.data("max-date")),this._setMax(e[0],e.data("max-date"))},subscribe:function(a,b){$(a).on("keyup.dateRangeInputBinding input.dateRangeInputBinding",function(){b(!0)}),$(a).on("changeDate.dateRangeInputBinding change.dateRangeInputBinding",function(){b(!1)})},unsubscribe:function(a){$(a).off(".dateRangeInputBinding")}}),inputBindings.register(dateRangeInputBinding,"shiny.dateRangeInput");var selectInputBinding=new InputBinding;$.extend(selectInputBinding,{find:function(a){return $(a).find("select")},getId:function(a){return InputBinding.prototype.getId.call(this,a)||a.name},getValue:function(a){return $(a).val()},setValue:function(a,b){var c=this._selectize(a);"undefined"!=typeof c?c.setValue(b):$(a).val(b)},getState:function(a){for(var b=new Array(a.length),c=0;c<a.length;c++)b[c]={value:a[c].value,label:a[c].label};return{label:$(a).parent().find('label[for="'+$escape(a.id)+'"]').text(),value:this.getValue(a),options:b}},receiveMessage:function(a,b){var c,d=$(a);b.hasOwnProperty("options")&&(c=this._selectize(a),c&&c.destroy(),d.empty().append(b.options),this._selectize(a)),b.hasOwnProperty("config")&&(d.parent().find('script[data-for="'+$escape(a.id)+'"]').replaceWith(b.config),this._selectize(a,!0)),b.hasOwnProperty("url")&&(c=this._selectize(a),c.clearOptions(),c.settings.load=function(a,d){if(!a.length)return d();var e=c.settings;$.ajax({url:b.url,data:{query:a,field:JSON.stringify([e.searchField]),conju:e.searchConjunction,maxop:e.maxOptions},type:"GET",error:function(){d()},success:function(a){d(a)}})},b.hasOwnProperty("selected")&&c.addOption(b.selected)),b.hasOwnProperty("value")&&this.setValue(a,b.value),b.hasOwnProperty("label")&&$(a).parent().parent().find('label[for="'+$escape(a.id)+'"]').text(b.label),$(a).trigger("change")},subscribe:function(a,b){$(a).on("change.selectInputBinding",function(){b()})},unsubscribe:function(a){$(a).off(".selectInputBinding")},initialize:function(a){this._selectize(a)},_selectize:function(el,update){if($.fn.selectize){var $el=$(el),config=$el.parent().find('script[data-for="'+$escape(el.id)+'"]');if(0!==config.length){var options=$.extend({labelField:"label",valueField:"value",searchField:["label"]},JSON.parse(config.html()));"undefined"!=typeof config.data("nonempty")&&(options=$.extend(options,{onItemRemove:function(a){""===this.getValue()&&$("select#"+$escape(el.id)).empty().append($("<option/>",{value:a,selected:!0})).trigger("change")},onDropdownClose:function(){""===this.getValue()&&this.setValue($("select#"+$escape(el.id)).val())}})),config.data("eval")instanceof Array&&$.each(config.data("eval"),function(i,x){options[x]=eval("("+options[x]+")")});var control=$el.selectize(options)[0].selectize;if(update){var settings=$.extend(control.settings,options);control.destroy(),control=$el.selectize(settings)[0].selectize}return control}}}}),inputBindings.register(selectInputBinding,"shiny.selectInput");var radioInputBinding=new InputBinding;$.extend(radioInputBinding,{find:function(a){return $(a).find(".shiny-input-radiogroup")},getValue:function(a){return $('input:radio[name="'+$escape(a.id)+'"]:checked').val()},setValue:function(a,b){$('input:radio[name="'+$escape(a.id)+'"][value="'+$escape(b)+'"]').prop("checked",!0)},getState:function(a){for(var b=$('input:radio[name="'+$escape(a.id)+'"]'),c=new Array(b.length),d=0;d<c.length;d++)c[d]={value:b[d].value,label:this._getLabel(b[d])};return{label:$(a).parent().find('label[for="'+$escape(a.id)+'"]').text(),value:this.getValue(a),options:c}},receiveMessage:function(a,b){var c=$(a);b.hasOwnProperty("options")&&(c.find("div.shiny-options-group").remove(),c.find("label.radio").remove(),c.append(b.options)),b.hasOwnProperty("value")&&this.setValue(a,b.value),b.hasOwnProperty("label")&&$(a).parent().find('label[for="'+$escape(a.id)+'"]').text(b.label),$(a).trigger("change")},subscribe:function(a,b){$(a).on("change.radioInputBinding",function(){b()})},unsubscribe:function(a){$(a).off(".radioInputBinding")},_getLabel:function(a){return"LABEL"===a.parentNode.tagName?$.trim($(a.parentNode).find("span").text()):null},_setLabel:function(a,b){return"LABEL"===a.parentNode.tagName&&$(a.parentNode).find("span").text(b),null}}),inputBindings.register(radioInputBinding,"shiny.radioInput");var checkboxGroupInputBinding=new InputBinding;$.extend(checkboxGroupInputBinding,{find:function(a){return $(a).find(".shiny-input-checkboxgroup")},getValue:function(a){for(var b=$('input:checkbox[name="'+$escape(a.id)+'"]:checked'),c=new Array(b.length),d=0;d<b.length;d++)c[d]=b[d].value;return c},setValue:function(a,b){if($('input:checkbox[name="'+$escape(a.id)+'"]').prop("checked",!1),b instanceof Array)for(var c=0;c<b.length;c++)$('input:checkbox[name="'+$escape(a.id)+'"][value="'+$escape(b[c])+'"]').prop("checked",!0);else $('input:checkbox[name="'+$escape(a.id)+'"][value="'+$escape(b)+'"]').prop("checked",!0)},getState:function(a){for(var b=$('input:checkbox[name="'+$escape(a.id)+'"]'),c=new Array(b.length),d=0;d<c.length;d++)c[d]={value:b[d].value,label:this._getLabel(b[d])};return{label:$(a).find('label[for="'+$escape(a.id)+'"]').text(),value:this.getValue(a),options:c}},receiveMessage:function(a,b){var c=$(a);b.hasOwnProperty("options")&&(c.find("div.shiny-options-group").remove(),c.find("label.checkbox").remove(),c.append(b.options)),b.hasOwnProperty("value")&&this.setValue(a,b.value),b.hasOwnProperty("label")&&c.find('label[for="'+$escape(a.id)+'"]').text(b.label),$(a).trigger("change")},subscribe:function(a,b){$(a).on("change.checkboxGroupInputBinding",function(){b()})},unsubscribe:function(a){$(a).off(".checkboxGroupInputBinding")},_getLabel:function(a){return"LABEL"===a.parentNode.tagName?$.trim($(a.parentNode).find("span").text()):null},_setLabel:function(a,b){return"LABEL"===a.parentNode.tagName&&$(a.parentNode).find("span").text(b),null}}),inputBindings.register(checkboxGroupInputBinding,"shiny.checkboxGroupInput");var actionButtonInputBinding=new InputBinding;$.extend(actionButtonInputBinding,{find:function(a){return $(a).find(".action-button")},getValue:function(a){return $(a).data("val")||0},setValue:function(a,b){$(a).data("val",b)},getType:function(){return"shiny.action"},subscribe:function(a,b){$(a).on("click.actionButtonInputBinding",function(){var a=$(this),c=a.data("val")||0;a.data("val",c+1),b()})},getState:function(a){return{value:this.getValue(a)}},receiveMessage:function(){},unsubscribe:function(a){$(a).off(".actionButtonInputBinding")}}),inputBindings.register(actionButtonInputBinding,"shiny.actionButtonInput");var bootstrapTabInputBinding=new InputBinding;$.extend(bootstrapTabInputBinding,{find:function(a){return $(a).find("ul.nav.shiny-tab-input")},getValue:function(a){var b=$(a).find("li:not(.dropdown).active").children("a");return 1===b.length?this._getTabName(b):null},setValue:function(a,b){var c=this,d=$(a).find("li:not(.dropdown)").children("a");d.each(function(){return c._getTabName($(this))===b?($(this).tab("show"),!1):void 0})},getState:function(a){return{value:this.getValue(a)}},receiveMessage:function(a,b){b.hasOwnProperty("value")&&this.setValue(a,b.value)},subscribe:function(a,b){$(a).on("shown.bootstrapTabInputBinding shown.bs.tab.bootstrapTabInputBinding",function(){b()})},unsubscribe:function(a){$(a).off(".bootstrapTabInputBinding")},_getTabName:function(a){return a.attr("data-value")||a.text()}}),inputBindings.register(bootstrapTabInputBinding,"shiny.bootstrapTabInput");var IE8FileUploader=function(a,b,c){this.shinyapp=a,this.id=b,this.fileEl=c,this.beginUpload()};(function(){this.beginUpload=function(){var a=this,b="shinyupload_iframe_"+this.id;this.iframe=document.createElement("iframe"),this.iframe.id=b,this.iframe.name=b,this.iframe.setAttribute("style","position: fixed; top: 0; left: 0; width: 0; height: 0; border: none"),$("body").append(this.iframe);var c=function(){a.shinyapp.makeRequest("uploadieFinish",[],function(){},function(){}),$(a.iframe).remove()};this.iframe.attachEvent?this.iframe.attachEvent("onload",c):this.iframe.onload=c,this.form=document.createElement("form"),this.form.method="POST",this.form.setAttribute("enctype","multipart/form-data"),this.form.action="session/"+encodeURI(this.shinyapp.config.sessionId)+"/uploadie/"+encodeURI(this.id),this.form.id="shinyupload_form_"+this.id,this.form.target=b,$(this.form).insertAfter(this.fileEl).append(this.fileEl),this.form.submit()}}).call(IE8FileUploader.prototype);var FileUploader=function(a,b,c){this.shinyapp=a,this.id=b,FileProcessor.call(this,c)};$.extend(FileUploader.prototype,FileProcessor.prototype),function(){this.makeRequest=function(a,b,c,d,e){this.shinyapp.makeRequest(a,b,c,d,e)},this.onBegin=function(a,b){var c=this;this.$setError(null),this.$setActive(!0),this.$setVisible(!0),this.onProgress(null,0),this.totalBytes=0,this.progressBytes=0,$.each(a,function(a,b){c.totalBytes+=b.size});var d=$.map(a,function(a){return{name:a.name,size:a.size,type:a.type}});this.makeRequest("uploadInit",[d],function(a){c.jobId=a.jobId,c.uploadUrl=a.uploadUrl,b()},function(a){c.onError(a)})},this.onFile=function(a,b){var c=this;this.onProgress(a,0),$.ajax(this.uploadUrl,{type:"POST",cache:!1,xhr:function(){var b=$.ajaxSettings.xhr();return b.upload&&(b.upload.onprogress=function(b){b.lengthComputable&&c.onProgress(a,(c.progressBytes+b.loaded)/c.totalBytes)}),b},data:a,processData:!1,success:function(){c.progressBytes+=a.size,b()},error:function(a,b){c.onError(a.responseText||b)}})},this.onComplete=function(){var a=this;this.makeRequest("uploadEnd",[this.jobId,this.id],function(){a.$setActive(!1),a.onProgress(null,1),a.$bar().text("Upload complete")},function(b){a.onError(b)}),this.$bar().text("Finishing upload")},this.onError=function(a){this.$setError(a||""),this.$setActive(!1)},this.onAbort=function(){this.$setVisible(!1)},this.onProgress=function(a,b){this.$bar().width(Math.round(100*b)+"%"),this.$bar().text(a?a.name:"")},this.$container=function(){return $("#"+$escape(this.id)+"_progress.shiny-file-input-progress")},this.$bar=function(){return $("#"+$escape(this.id)+"_progress.shiny-file-input-progress .progress-bar")},this.$setVisible=function(a){this.$container().css("visibility",a?"visible":"hidden")},this.$setError=function(a){this.$bar().toggleClass("bar-danger",null!==a),null!==a&&(this.onProgress(null,1),this.$bar().text(a))},this.$setActive=function(a){this.$container().toggleClass("active",!!a)}}.call(FileUploader.prototype);var fileInputBinding=new InputBinding;$.extend(fileInputBinding,{find:function(a){return $(a).find('input[type="file"]')},getId:function(a){return InputBinding.prototype.getId.call(this,a)||a.name},getValue:function(){return null},setValue:function(){},subscribe:function(a){$(a).on("change.fileInputBinding",uploadFiles)},unsubscribe:function(a){$(a).off(".fileInputBinding")}}),inputBindings.register(fileInputBinding,"shiny.fileInputBinding");var OutputBindingAdapter=function(a,b){this.el=a,this.binding=b,b.resize&&(this.onResize=makeResizeFilter(a,function(c,d){b.resize(a,c,d)}))};(function(){this.onValueChange=function(a){this.binding.onValueChange(this.el,a)},this.onValueError=function(a){this.binding.onValueError(this.el,a)},this.showProgress=function(a){this.binding.showProgress(this.el,a)},this.onResize=function(){}}).call(OutputBindingAdapter.prototype),$(function(){setTimeout(initShiny,1)}),$(document).on("click",".slider-animate-button",function(a){a.preventDefault();var b=$(this),c=$("#"+$escape(b.attr("data-target-id"))),d="Play",e="Pause",f=void 0!==b.attr("data-loop")&&!/^\s*false\s*$/i.test(b.attr("data-loop")),g=b.attr("data-interval");if(g=isNaN(g)?1500:+g,c.data("animTimer"))clearTimeout(c.data("animTimer")),c.removeData("animTimer"),b.attr("title",d),b.removeClass("playing"),c.removeData("animating");else{var h,i;if(c.hasClass("jslider"))h=c.slider(),h.canStepNext()||h.resetToStart(),i=setInterval(function(){f&&!h.canStepNext()?h.resetToStart():(h.stepNext(),f||h.canStepNext()||b.click())},g);else{h=c.data("ionRangeSlider");var j=function(){return h.result.from<h.result.max},k=function(){h.update({from:h.result.min})},l=function(){h.update({from:h.result.from+h.options.step})};j()||k(),i=setInterval(function(){f&&!j()?k():(l(),f||j()||b.click())},g)}c.data("animTimer",i),b.attr("title",e),b.addClass("playing"),c.data("animating",!0)}}),$(document).on("keydown",function(a){if(114===a.which&&(a.ctrlKey||a.metaKey)&&!a.shiftKey&&!a.altKey){var b="reactlog?w="+exports.shinyapp.config.workerId;window.open(b),a.preventDefault()}})}();
//# sourceMappingURL=shiny.min.js.map