Files
shiny/inst/www/shared/shiny.min.js
2015-01-08 11:03:30 -08:00

5 lines
49 KiB
JavaScript

/*! shiny 0.10.2.9006 | (c) 2012-2015 RStudio, Inc. | License: GPL-3 */
!function(){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 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="undefined"==typeof d,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=new OutputBindingAdapter(g,d);q.bindOutput(h,i),$(g).data("shiny-output-binding",i),$(g).addClass("shiny-bound-output")}}setTimeout(m,0),setTimeout(p,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]);q.unbindOutput(e,d),$(b[c]).removeClass("shiny-bound-output")}}setTimeout(p,0)}function c(a){return"checkbox"===a.type||"radio"===a.type?a.checked?!0:!1:$(a).val()}function d(a,b,c){var d=a.getId(b);if(d){var e=a.getValue(b),f=a.getType(b);f&&(d=d+":"+f),v.setInput(d,e,!c)}}function e(a){void 0===a&&(a=document);for(var b=inputBindings.getBindings(),c={},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&&!w[j]){var k=f.getType(i),l=k?j+":"+k:j;c[l]=f.getValue(i);var m=function(){var a=f,b=i;return function(c){d(a,b,c)}}();f.subscribe(i,m),$(i).data("shiny-input-binding",f),$(i).addClass("shiny-bound-input");var n=f.getRatePolicy(i);null!==n&&t.setRatePolicy(l,n.policy,n.delay),w[j]={binding:f,node:i},q.isConnected()&&d(f,i,!1)}}return c}function f(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 w[e],d.unsubscribe(b[c])}}}function g(a,b){if(!a.name)return null;var c=$('input:checked[type="'+$escape(a.type)+'"][name="'+$escape(a.name)+'"]'),d=c.map(function(){return this.value}).get();return b?d.length>0?d[0]:null:d}function h(a,b){function d(a){return"checkbox"===a.type&&e(a,"shiny-input-checkboxgroup")||"radio"===a.type&&e(a,"shiny-input-radiogroup")?!0:!1}function e(a,b){return null===a?!1:f(a,b)?!0:e(a.parentNode,b)}function f(a,b){return(" "+a.className+" ").indexOf(" "+b+" ")>-1}$(document).on("change input",a,function(){if(!d(this)&&(this.name&&v.setInput(this.name,g(this,b)),!b)){var a=this["data-input-id"]||this.id;a&&v.setInput(a,c(this))}})}function i(a,b,d){var e={};return $(a).find(b).each(function(){if(this.name&&(e[this.name]=g(this,d)),!d){var a=this["data-input-id"]||this.id;a&&(e[a]=c(this))}}),e}function j(b){return a(b),$.extend({},i(b,'input[type="checkbox"]',!1),i(b,'input[type="radio"]',!0),e(b))}function k(a){f(a),b(a)}function l(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 m(){$(".shiny-image-output, .shiny-plot-output").each(function(){(0!==this.offsetWidth||0!==this.offsetHeight)&&(v.setInput(".clientdata_output_"+this.id+"_width",this.offsetWidth),v.setInput(".clientdata_output_"+this.id+"_height",this.offsetHeight))}),$(".shiny-bound-output").each(function(){$(this).data("shiny-output-binding").onResize()})}function n(a){return null===a||0!==a.offsetWidth||0!==a.offsetHeight?!1:"none"===getStyle(a,"display")?!0:n(a.parentNode)}function o(){var a={};$(".shiny-bound-output").each(function(){delete y[this.id],n(this)?v.setInput(".clientdata_output_"+this.id+"_hidden",!0):(a[this.id]=!0,v.setInput(".clientdata_output_"+this.id+"_hidden",!1))});for(var b in y)y.hasOwnProperty(b)&&v.setInput(".clientdata_output_"+b+"_hidden",!0);y=a}function p(){z.normalCall()}var q=exports.shinyapp=new ShinyApp,r=new InputBatchSender(q),s=new InputNoResendDecorator(r),t=new InputRateDecorator(s),u=new InputDeferDecorator(s),v=t;$('input[type="submit"], button[type="submit"]').each(function(){v=u,$(this).click(function(a){a.preventDefault(),u.submit()})}),exports.onInputChange=function(a,b){v.setInput(a,b)};var w={};exports.bindAll=function(a){var b=j(a);$.each(b,function(a,b){v.setInput(a,b)})},exports.unbindAll=k,exports.initializeInputs=l,l(document),h('input[type="checkbox"]',!1),h('input[type="radio"]',!0);var x=j(document);$(".shiny-image-output, .shiny-plot-output").each(function(){(0!==this.offsetWidth||0!==this.offsetHeight)&&(x[".clientdata_output_"+this.id+"_width"]=this.offsetWidth,x[".clientdata_output_"+this.id+"_height"]=this.offsetHeight)});var y={};$(".shiny-bound-output").each(function(){n(this)?x[".clientdata_output_"+this.id+"_hidden"]=!0:(y[this.id]=!0,x[".clientdata_output_"+this.id+"_hidden"]=!1)});var z=new Debouncer(null,o,0);r.lastChanceCallback.push(function(){z.isPending()&&z.immediateCall()}),$(window).resize(debounce(500,m));var A=["modal","dropdown","tab","tooltip","popover","collapse"];$.each(A,function(a,b){$("body").on("shown.bs."+b+".sendImageSize","*",m),$("body").on("shown.bs."+b+".sendOutputHiddenState hidden.bs."+b+".sendOutputHiddenState","*",p)}),$("body").on("shown.sendImageSize","*",m),$("body").on("shown.sendOutputHiddenState hidden.sendOutputHiddenState","*",p),x[".clientdata_pixelratio"]=pixelRatio(),$(window).resize(function(){v.setInput(".clientdata_pixelratio",pixelRatio())}),x[".clientdata_url_protocol"]=window.location.protocol,x[".clientdata_url_hostname"]=window.location.hostname,x[".clientdata_url_port"]=window.location.port,x[".clientdata_url_pathname"]=window.location.pathname,x[".clientdata_url_search"]=window.location.search,x[".clientdata_url_hash_initial"]=window.location.hash;var B=x[".clientdata_singletons"]=$('script[type="application/shiny-singletons"]').text();singletons.registerNames(B.split(/,/));var C=$('script[type="application/html-dependencies"]').text();$.each(C.split(/;/),function(a,b){var c=/\s*^(.+)\[(.+)\]\s*$/.exec(b);c&&registerDependency(c[1],c[2])}),s.reset(x),q.connect(x)}var $=jQuery,exports=window.Shiny=window.Shiny||{},isQt=!1;/\bQt\//.test(window.navigator.userAgent)&&($(document.documentElement).addClass("qt"),isQt=!0),/\bQt\/5/.test(window.navigator.userAgent)&&/Linux/.test(window.navigator.userAgent)&&$(document.documentElement).addClass("qt5"),$(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.$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),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=function(){$(this).trigger("shown")},f=function(){$(this).trigger("hidden")},g=$(document).find("[data-display-if]"),h=0;h<g.length;h++){var i=$(g[h]),j=i.data("data-display-if-func");if(!j){var k=i.attr("data-display-if");j=scopeExprToFunc(k),i.data("data-display-if-func",j)}j(d)?(i.trigger("show"),i.show(0,e)):(i.trigger("hide"),i.hide(0,f))}};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){var c,d,e=$(a),f=null;if(b){c=e.data("click-id"),d=e.data("hover-id"),e.data("coordmap",b.coordmap),delete b.coordmap,f=document.createElement("img"),$.each(b,function(a,b){null!==b&&(f[a]=b)});var g=function(a){if("undefined"!=typeof a.offsetX)return{x:a.offsetX,y:a.offsetY};var b=e.offset();return{x:a.pageX-b.left,y:a.pageY-b.top}},h=function(a){return function(b){function c(a){var b=a-f.bounds.left,c=(f.usr.right-f.usr.left)/(f.bounds.right-f.bounds.left);return b*c+f.usr.left}function d(a){var b=a-f.bounds.bottom,c=(f.usr.top-f.usr.bottom)/(f.bounds.top-f.bounds.bottom);return b*c+f.usr.bottom}if(null===b)return void exports.onInputChange(a,null);var f=e.data("coordmap"),h=g(b),i=c(h.x);f.log.x&&(i=Math.pow(10,i));var j=d(h.y);f.log.y&&(j=Math.pow(10,j)),exports.onInputChange(a,{x:i,y:j,".nonce":Math.random()})}};if(!e.data("hover-func")){var i=e.data("hover-delay-type")||"debounce",j="throttle"===i?throttle:debounce,k=j(e.data("hover-delay")||300,h(d));e.data("hover-func",k)}c&&$(f).on("mousedown",h(c)),d&&($(f).on("mousemove",e.data("hover-func")),$(f).on("mouseout",function(){e.data("hover-func")(null)})),(c||d)&&$(f).addClass("crosshair")}e.empty(),f&&e.append(f)}}),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},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("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),c.update(d)
},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().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 $el.next("div.selectize-control").css("width",config.data("width")),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){var b=$('label[for="'+$escape(a.id)+'"]');return b.length>0?$.trim(b.text()):"LABEL"===a.parentNode.tagName?$.trim($(a.parentNode).find("span").text()):null},_setLabel:function(a,b){var c=$('label[for="'+$escape(a.id)+'"]');return c.length>0&&c.text(b),"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){var b=$('label[for="'+$escape(a.id)+'"]');return b.length>0?$.trim(b.text()):"LABEL"===a.parentNode.tagName?$.trim($(a.parentNode).find("span").text()):null},_setLabel:function(a,b){var c=$('label[for="'+$escape(a.id)+'"]');return c.length>0&&c.text(b),"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