text: define("splunkjs/compiled/views",function(){}),define("views/Base",["jquery","backbone","underscore"],function(e,t,n){return t.View.extend({awake:!0,touch:!1,initialize:function(){var e=this.render;this.children={},this.render=n.bind(function(){var t=(new Date).getTime(),n;return this.awake?e.apply(this):this.touch=!0,n=(new Date).getTime(),this.options.instrument!==!1&&this.$el.attr("data-render-time",(n-t)/1e3),this},this),this.options.moduleId&&(this.moduleId=this.options.moduleId),this.$el.attr("data-cid",this.cid);if(this.moduleId){var t=this.cssNamespace();this.options.dontAddModuleIdAsClass||this.$el.addClass(t),this.$el.attr("data-view",this.moduleId)}this.options.template&&(this.template=this.options.template),this.template&&(this.compiledTemplate=this.compileTemplate(this.template))},wake:function(e){return e||(e={}),this.awake=!0,this.touch&&(this.touch=!1,e.syncRender?this.render():this.debouncedRender()),n.each(this.children,function(t){n.isFunction(t.wake)&&t.wake(e)}),this},sleep:function(){return this.awake=!1,n.each(this.children,function(e){n.isFunction(e.sleep)&&e.sleep()}),this},debouncedRender:function(){this._debouncedRender||(this._debouncedRender=n.debounce(this.render,0)),this._debouncedRender.apply(this,arguments)},debouncedReflow:function(){this._debouncedReflow||(this._debouncedReflow=n.debounce(this.reflow,0)),this._debouncedReflow.apply(this,arguments)},compileTemplate:n.memoize(function(e){return n.template(e)}),cssNamespace:function(){return(this.moduleId||"").toLowerCase().replace(/\//g,"-").replace(/\_/g,"").replace(/^views-/,"").replace(/-master$/,"")},uniqueNS:function(){return(this.moduleId||"unidentified").toLowerCase().replace(/\//g,"-")+"-"+this.cid},dispose:function(){this.stopListening()},stopListening:function(){this.modelsOff(this.model),this.collectionsOff(this.collection),t.View.prototype.stopListening.apply(this,arguments)},remove:function(){return this.removeChildren(),this._isAddedToDocument&&(this.onRemovedFromDocument(),this._isAddedToDocument=!1),this.stopListening(),this.$el.remove(),this},debouncedRemove:function(e){e||(e={});var t={detach:!1};return n.defaults(e,t),e.detach&&this.$el.detach(),this._debouncedRemove||(this._debouncedRemove=n.debounce(this.remove,0)),this._debouncedRemove.apply(this,arguments),this},removeChildren:function(){n.each(this.children,function(e){n.isArray(e)?n.each(e,function(e){e.remove()}):e.remove()})},modelsOff:function(e){return e instanceof t.Model?(n.isFunction(e.associatedOff)&&e.associatedOff(null,null,this),e.off(null,null,this)):n(e).each(function(t){n.isFunction(e.associatedOff)&&e.associatedOff(null,null,this),this.modelsOff(t)},this),this},collectionsOff:function(e){return e instanceof t.Collection?e.off(null,null,this):n(e).each(function(e){this.collectionsOff(e)},this),this},detach:function(){this._isAddedToDocument&&(this.onRemovedFromDocument(),this._isAddedToDocument=!1),this.$el.detach()},appendTo:function(e){return this.attachToDocument(e,"appendTo")},prependTo:function(e){return this.attachToDocument(e,"prependTo")},replaceAll:function(e){return this.attachToDocument(e,"replaceAll")},insertAfter:function(e){return this.attachToDocument(e,"insertAfter")},insertBefore:function(e){return this.attachToDocument(e,"insertBefore")},attachToDocument:function(t,r){if(n.isString(t))throw new Error(r+" does not support selectors or HTML strings");t=e(t);if(t.length===0)return this;var i=t[0],s=this.el.parentNode;return s&&s!==i&&this._isAddedToDocument&&(this.onRemovedFromDocument(),this._isAddedToDocument=!1),this.$el[r](t),s!==i&&this.isAttachedToDocument()&&(this._isAddedToDocument=!0,this.onAddedToDocument()),this},onAddedToDocument:function(){var e=this;n.each(this.children,function(t){n.isFunction(t.onAddedToDocument)&&e.isAncestorOf(t)&&!t._isAddedToDocument&&(t._isAddedToDocument=!0,t.onAddedToDocument())})},onRemovedFromDocument:function(){var e=this;n.each(this.children,function(t){n.isFunction(t.onRemovedFromDocument)&&e.isAncestorOf(t)&&t._isAddedToDocument&&(t.onRemovedFromDocument(),t._isAddedToDocument=!1)})},isAttachedToDocument:function(){return e.contains(document.documentElement,this.el)},isAncestorOf:function(t){return t.el?e.contains(this.el,t.el):!1},isDescendantOf:function(t){return t.el?e.contains(t.el,this.el):!1},reflow:function(){n(this.children).each(function(e){n.isFunction(e.reflow)&&e.reflow()})}})}),define("views/shared/Modal",["jquery","underscore","views/Base","bootstrap.transition","bootstrap.modal"],function(e,t,n){var r="modal fade",i="modal-wide",s="modal-header",o="modal-body",u="modal-body modal-body-scrolling",a="modal-footer",f="."+s,l=f+" > h3",c="modal-loading",h="."+c,p='<div class="'+c+'"></div>',d=".modal-body",v=d+" > div.form",m='<div class="form form-horizontal"></div>',g='<div class="form form-horizontal form-complex"></div>',y='<div class="form form-horizontal form-justified"></div>',b="."+a,w='<a href="#" class="btn cancel modal-btn-cancel pull-left" data-dismiss="modal">'+t("Cancel").t()+"</a>",E='<a href="#" class="btn back modal-btn-back">'+t("Back").t()+"</a>",S='<a href="#" class="btn btn-primary modal-btn-primary pull-right">'+t("Save").t()+"</a>",x='<a href="#" class="btn btn-primary modal-btn-primary pull-right" data-dismiss="modal">'+t("Done").t()+"</a>",T='<a href="#" class="btn btn-primary modal-btn-primary">'+t("Delete").t()+"</a>",N='<a href="#" class="btn btn-primary modal-btn-primary">'+t("Next").t()+"</a>",C='<a href="#" class="btn modal-btn-continue pull-left" data-dismiss="modal">'+t("Continue Editing").t()+"</a>",k='                <div class="'+s+'">                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>                    <h3>&nbsp;</h3>                </div>                <div class="'+u+'">                </div>                <div class="'+a+'">                </div>            ',L={ENTER:13,TAB:9},A='.btn, input[type="text"], input[type="password"], textarea';return n.extend({className:r,attributes:{style:"display:none",tabIndex:-1},initialize:function(){n.prototype.initialize.apply(this,arguments);var e={show:!1,keyboard:!0,backdrop:!0};this.keydownEventCode=null,this.keydownEventTarget=null,this.$el.modal(t.extend({},e,t.pick(this.options,["backdrop","keyboard","show","remote"]))),this.shown=!1,this.options.onHiddenRemove&&this.on("hidden",this.remove,this)},events:{show:function(e){if(e.target!==e.currentTarget)return;this.trigger("show")},shown:function(e){if(e.target!==e.currentTarget)return;this.shown=!0;var t=this.$(A);t.length>0&&t.first().focus(),this.trigger("shown")},hide:function(e){if(e.target!==e.currentTarget)return;this.trigger("hide")},hidden:function(e){if(e.target!==e.currentTarget)return;this.shown=!1,this.trigger("hidden")},keydown:function(n){var r=n.which;this.keydownEventCode=n.which,this.keydownEventTarget=n.target;if(r===L.TAB){var i="a[href], area[href], input:not([disabled]),select:not([disabled]), textarea:not([disabled]),button:not([disabled]), iframe, object, embed, *[tabindex],*[contenteditable]",s=this.el.querySelectorAll(i);s=t.uniq(s);for(var o=0;o<s.length;o++){var u=e(s[o]);if(!u.is(":visible")||u.css("visibility")==="hidden")s.splice(o,1),o--}var a=s[0],f=s[s.length-1];t.contains(s,n.target)&&(n.preventDefault(),n.target===f&&!n.shiftKey?a.focus():n.target===a&&n.shiftKey?f.focus():n.shiftKey?s[t.indexOf(s,n.target)-1].focus():s[t.indexOf(s,n.target)+1].focus())}},keyup:function(t){var n=t.which;if(n===L.ENTER&&this.keydownEventCode===L.ENTER){var r=e(t.target);t.target!==this.keydownEventTarget&&e(this.keydownEventTarget).is("input")&&e(this.keydownEventTarget).attr("type")==="text"&&(r=e(this.keydownEventTarget)),r.is("input")&&r.attr("type")==="text"&&this.$el.find(".btn-primary:visible").length===1&&(r.is(A)&&r.blur(),t.preventDefault(),this.keydownEventCode=null,this.keydownEventTarget=null,this.$el.find(".btn-primary:visible").click())}}},hide:function(){this.$el.modal("hide")},show:function(){this.$el.modal("show")},toggle:function(){this.$el.modal("toggle")},remove:function(){this.shown&&this.hide(),n.prototype.remove.apply(this,arguments)}},{CLASS_NAME:r,CLASS_MODAL_WIDE:i,HEADER_CLASS:s,BODY_CLASS:u,FOOTER_CLASS:a,HEADER_SELECTOR:f,HEADER_TITLE_SELECTOR:l,BODY_SELECTOR:d,BODY_FORM_SELECTOR:v,LOADING_CLASS:c,LOADING_SELECTOR:h,LOADING_HORIZONTAL:p,FOOTER_SELECTOR:b,TEMPLATE:k,FORM_HORIZONTAL:m,FORM_HORIZONTAL_COMPLEX:g,FORM_HORIZONTAL_JUSTIFIED:y,BUTTON_CANCEL:w,BUTTON_BACK:E,BUTTON_SAVE:S,BUTTON_CONTINUE:C,BUTTON_DELETE:T,BUTTON_DONE:x,BUTTON_NEXT:N})}),define("views/shared/controls/Control",["jquery","underscore","backbone","module","views/Base"],function(e,t,n,r,i){return i.extend({moduleId:r.id,className:"control",initialize:function(){i.prototype.initialize.apply(this,arguments);var e={defaultValue:"",enabled:!0,flag:!1,validate:!1,forceUpdate:!1,updateModel:!0};return t.defaults(this.options,e),this._value=this.options.defaultValue,this.model&&(this.registerListeners(),this.setValueFromModel(!1)),this},registerListeners:function(){this.model.on("change:"+this.options.modelAttribute,this.setValueFromModel,this)},getValue:function(){return this._value},getModelAttribute:function(){return this.options.modelAttribute},setValue:function(e,t){var n=this._setValue(e,t);return this.options.updateModel&&this.updateModel(),n},_setValue:function(e,t,n){e=this.normalizeValue(e);if(this._value!==e){var r=this._value;this._value=e,t===!1||this.render(),n||this.trigger("change",e,r)}return this},normalizeValue:function(e){return e},unsetValue:function(){this.model.unset(this.getModelAttribute())},setValueFromModel:function(e){return this._setValue(this.model.get(this.options.modelAttribute),e),this},updateModel:function(){var e={validate:this.options.validate,forceUpdate:this.options.forceUpdate};return this.model?this.model[this.options.save?"save":"set"](this.getUpdatedModelAttributes(),e):!0},getUpdatedModelAttributes:function(){var e={};return e[this.options.modelAttribute]=this._value,e},enable:function(){this.$el.removeClass("enabled")},disable:function(){this.$el.addClass("enabled")}})}),define("views/shared/delegates/Base",["backbone"],function(e){return e.View.extend({dispose:function(){return this.stopListening(),this},remove:function(){return this.dispose(),this}})}),define("views/shared/delegates/PopdownDialog",["jquery","underscore","views/shared/delegates/Base"],function(e,t,n){return n.extend({initialize:function(){var e={arrow:".arrow",mode:"dialog",adjustPosition:!0,minMargin:20,allowPopUp:!0,direction:"auto",zIndex:"auto",scrollContainer:window,ignoreClasses:[]};t.defaults(this.options,e),this.isShown=!1,this.addEventHandlers=t.bind(this.addEventHandlers,this),this.dialogClick=t.bind(this.dialogClick,this),this.keepInBoundsDebounced=t.debounce(this.keepInBounds,100),this.$el.attr("id")||this.$el.attr("id","dialog-"+this.cid),this.options.show&&this.show(this.options.show)},events:{click:"dialogClick"},arrow:function(){return this.$el.find(this.options.arrow).first()},scrollContainer:function(){return this.$scrollContainer||(this.$scrollContainer=e(this.options.scrollContainer)),this.$scrollContainer},toggle:function(e){return this.trigger("toggle",e),this[this.isShown?"hide":"show"](e),this.trigger("toggled",e),!0},show:function(e){this.trigger("show",e),this.isShown||t.defer(this.addEventHandlers,e),this.options.zIndex!="auto"&&this.$el.css("zIndex",this.options.zIndex),this.options.adjustPosition&&e&&this.adjustPosition(e),this.isShown=!0,this.$el.addClass("open").show(),e.attr("data-dialog-id",this.$el.attr("id")),this.trigger("shown",e)},hide:function(){if(!this.isShown)return!1;this.trigger("hide"),this.removeEventHandlers(),this.isShown=!1,this.$el.removeClass("open").hide(),this.trigger("hidden")},addEventHandlers:function(t){return e("html").on("mousedown.popdown."+this.cid,this.bodyMouseDown.bind(this)),e(window).on("keydown."+this.cid,this.windowKeydown.bind(this)),this.options.scrollContainer!==window&&(this.scrollPosition={top:this.scrollContainer().scrollTop(),left:this.scrollContainer().scrollLeft()},this.scrollContainer().on("scroll."+this.cid,this.containerScroll.bind(this))),this},removeEventHandlers:function(){return e("html").off("."+this.cid),e(window).off("."+this.cid),this.options.scrollContainer!==window&&this.scrollContainer().off("."+this.cid),this},dispose:function(){return this.removeEventHandlers(),n.prototype.dispose.apply(this,arguments),this},measure:function(e,t){var n={};return n.width=e.outerWidth(),n.halfWidth=n.width/2,n.height=e.outerHeight(),n.halfHeight=n.height/2,t!==!1&&(n.offset=e.offset(),n.position=e.position(),n.center={left:n.offset.left+n.halfWidth,top:n.offset.top+n.halfHeight}),n},adjustPosition:function(e){var t=this.options.direction;this["adjustPosition"+t.charAt(0).toUpperCase()+t.slice(1)](e)},adjustPositionAuto:function(t){this.$el.css({top:-9999,left:-9999,bottom:"auto"}),this.$el.show();var n={},r={left:0,top:0},i=!0;n.toggle=this.measure(t),n.dialog=this.measure(this.$el),n.arrow=this.measure(this.arrow(),!1),n.window=this.measure(e(window),!1),n.window.top=e(window).scrollTop(),n.window.bottom=n.window.height+e(window).scrollTop(),n.dialogParent={offset:this.$el.offsetParent().offset()},n.toggle.relativeOffset={left:n.toggle.offset.left-n.dialogParent.offset.left+n.toggle.halfWidth,top:Math.floor(n.toggle.offset.top-n.dialogParent.offset.top)},n.toggle.center.left<n.dialog.halfWidth+this.options.minMargin?r.left=n.dialog.halfWidth-n.toggle.center.left+this.options.minMargin:n.toggle.center.left+n.dialog.halfWidth+this.options.minMargin>n.window.width&&(r.left=n.window.width-(n.toggle.center.left+n.dialog.halfWidth+this.options.minMargin)),r.left=Math.round(r.left);var s=n.toggle.offset.top+n.toggle.height+n.dialog.height+this.options.minMargin,o=n.toggle.offset.top-n.dialog.height-this.options.minMargin;s>n.window.bottom&&this.options.allowPopUp&&o>n.window.top?(r.top=-n.dialog.height-n.arrow.halfWidth,r.bottom=n.toggle.height+n.arrow.halfWidth,this.$el.addClass("up"),i=this.options.attachDialogTo||this.$el.parent()[0]==e("body")[0]||this.$el.parent()[0]==e(".modal:visible")[0]):(r.top=n.toggle.height,this.$el.removeClass("up"),s>n.window.bottom&&(this.scrollContainer().scrollTop(this.scrollContainer().scrollTop()+s-n.window.bottom),n.toggle.offset=t.offset(),n.toggle.relativeOffset.top=n.toggle.offset.top-n.dialogParent.offset.top)),this.position={top:i?r.top+n.toggle.relativeOffset.top:"auto",left:n.toggle.relativeOffset.left,marginLeft:-n.dialog.halfWidth+r.left,bottom:i?"auto":r.bottom},this.$el.css(this.position),this.arrow().css("marginLeft",0-n.arrow.halfWidth-r.left),n.dialog.halfWidth-n.arrow.halfWidth-r.left<8?this.$el.css("borderTopLeftRadius",Math.max(n.dialog.halfWidth-n.arrow.halfWidth-r.left,0)):this.$el.css("borderTopLeftRadius","")},adjustPositionRight:function(t){this.$el.addClass("right"),this.$el.css({top:-9999,left:-9999}),this.$el.show();var n={},r={left:0,top:0},i=function(){return Math.round(r.top)+n.toggle.relativeOffset.top-n.dialog.halfHeight+n.toggle.halfHeight}.bind(this);n.toggle=this.measure(t),n.dialog=this.measure(this.$el),n.arrow=this.measure(this.arrow(),!1),n.window=this.measure(e(window),!1),n.window.top=e(window).scrollTop(),n.window.bottom=n.window.height+e(window).scrollTop(),n.arrow.minMargin=10,n.arrow.maxShift=n.dialog.halfHeight-n.arrow.halfHeight-n.arrow.minMargin,n.dialogParent={offset:this.$el.offsetParent().offset()},n.toggle.relativeOffset={left:n.toggle.offset.left-n.dialogParent.offset.left+n.toggle.width,top:Math.floor(n.toggle.offset.top-n.dialogParent.offset.top)},n.toggle.center.top-n.window.top<n.dialog.halfHeight+this.options.minMargin?r.top=n.dialog.halfHeight-(n.toggle.center.top-n.window.top)+this.options.minMargin:n.toggle.center.top+n.dialog.halfHeight+this.options.minMargin>n.window.bottom&&(r.top=n.window.bottom-(n.toggle.center.top+n.dialog.halfHeight+this.options.minMargin)),i()<this.options.minMargin&&(r.top=r.top+(this.options.minMargin-i())),r.top>n.arrow.maxShift?r.top-=r.top-n.arrow.maxShift:-r.top>n.arrow.maxShift&&(r.top-=r.top+n.arrow.maxShift),this.position={top:i(),left:n.toggle.relativeOffset.left,marginLeft:n.arrow.halfWidth},this.$el.css(this.position),this.arrow().css("marginTop",0-n.arrow.halfHeight-r.top)},containerScroll:function(e){var t=this.scrollContainer().scrollTop(),n=this.scrollContainer().scrollLeft();this.position.top=this.position.top+(this.scrollPosition.top-t),this.position.left=this.position.left+(this.scrollPosition.left-n),this.$el.css(this.position),this.scrollPosition={top:t,left:n},this.keepInBoundsDebounced()},keepInBounds:function(e){var t=this.scrollContainer().offset().top,n=t+this.scrollContainer().outerHeight(),r=this.$el.hasClass("up")?this.$el.offset().top+this.$el.outerHeight():this.$el.offset().top;(r<t||r>n)&&this.hide()},bodyMouseDown:function(t){var n=e(t.target);if(!this.isShown)return;if(e.contains(this.$el[0],t.target)||t.target===this.$el[0])return;for(var r=0;r<this.options.ignoreClasses.length;r++)if(n.closest("."+this.options.ignoreClasses[r]).length)return;this.hide(t)},dialogClick:function(e){this.options.mode!="dialog"&&this.hide()},windowKeydown:function(e){var t=27,n=13;return e.keyCode==t?(this.hide(),!0):(e.keyCode==n&&this.bodyMouseDown(e),!0)},pointTo:function(e){this.isShown?this.adjustPosition(e):this.show(e)}})}),define("views/shared/delegates/Popdown",["jquery","underscore","views/shared/delegates/Base","views/shared/delegates/PopdownDialog"],function(e,t,n,r){return n.extend({initialize:function(){var e={toggle:"> .popdown-toggle, > .dropdown-toggle",dialog:"> .popdown-dialog, > .dropdown-menu",arrow:".arrow",mode:"menu",adjustPosition:!0,minMargin:20,attachDialogTo:!1,allowPopUp:!0,scrollContainer:window,ignoreClasses:[]};t.defaults(this.options,e),this.children={},this.events={},this.events["mousedown "+this.options.toggle]="toggle",this.events["keydown "+this.options.toggle]="keydownToggle",this.events["click "+this.options.toggle]="clickToggle",this.delegateEvents(this.events),this.$activeToggle=this.$(this.options.toggle).first(),this.options.show&&this.show()},delegate:function(){if(!this.children.hasOwnProperty("delegate")){var n=t.clone(this.options);n.el=this.options.dialog instanceof e?this.options.dialog[0]:this.$(this.options.dialog)[0],t.isString(this.options.scrollContainer)&&(this.options.scrollContainer=this.$activeToggle.closest(this.options.scrollContainer)),n.scrollConter=this.options.dialog instanceof e?this.options.dialog[0]:this.$(this.options.dialog)[0],this.children.delegate=new r(n),this.listenTo(this.children.delegate,"toggle",this.hearToggle),this.listenTo(this.children.delegate,"toggled",this.hearToggled),this.listenTo(this.children.delegate,"show",this.hearShow),this.listenTo(this.children.delegate,"shown",this.hearShown),this.listenTo(this.children.delegate,"hide",this.hearHide),this.listenTo(this.children.delegate,"hidden",this.hearHidden),this.options.attachDialogTo&&e(this.options.attachDialogTo).append(this.children.delegate.el)}return this.children.delegate},toggle:function(t){t.preventDefault();if(e(t.currentTarget).is(".disabled, :disabled"))return;return this.delegate().toggle(e(t.currentTarget)),!0},hearToggle:function(e){this.trigger("toggle",e)},hearToggled:function(e){this.trigger("toggled",e)},show:function(){this.delegate().show(this.$activeToggle)},hearShow:function(t){this.trigger("show",t),e(window).on("resize.popdown."+this.cid,this.windowResize.bind(this)),this.$activeToggle.removeClass("active"),this.$activeToggle=t.addClass("active")},hearShown:function(e){this.trigger("shown",e)},hide:function(t){if(!this.delegate().isShown)return!1;e(window).off("."+this.cid),this.$activeToggle.removeClass("active"),e.contains(this.children.delegate.el,e(":focus")[0])&&this.$activeToggle.focus(),this.children.delegate.hide()},clickToggle:function(e){e.preventDefault()},keydownToggle:function(e){var t=13;e.keyCode==t&&this.toggle(e)},hearHide:function(e){this.trigger("hide",e),this.$activeToggle.removeClass("active")},hearHidden:function(e){this.trigger("hidden",e)},dispose:function(){return this.children.delegate&&this.children.delegate.remove(),n.prototype.dispose.apply(this,arguments),this},adjustPosition:function(){this.delegate(),this.children.delegate.adjustPosition(this.$activeToggle)},windowResize:function(e){this.children.delegate&&this.children.delegate.isShown&&this.adjustPosition(this.$activeToggle)},pointTo:function(e){this.$activeToggle=e,this.delegate().adjustPosition(this.$activeToggle)},remove:function(){return n.prototype.remove.apply(this),this.children.delegate&&this.children.delegate.remove(),this.children.delegate&&this.options.attachDialogTo&&this.children.delegate.$el.remove(),e(window).off("resize.popdown."+this.cid),e(window).off("."+this.cid),this}})}),define("views/shared/controls/SyntheticSelectControl",["jquery","underscore","backbone","module","views/shared/controls/Control","views/shared/delegates/Popdown","util/math_utils","bootstrap.tooltip"],function(e,t,n,r,i,s,o,u){return i.extend({moduleId:r.id,className:"control btn-group",keys:{UP_ARROW:38,DOWN_ARROW:40},items:undefined,groupedItems:undefined,renderList:!0,initialize:function(){var e={toggleClassName:"",menuClassName:"",iconClassName:"icon-large",iconURLClassName:"icon-large",descriptionPosition:"right",label:"",popdownOptions:{el:this.el},html:"",nearestValue:!1};t.defaults(this.options,e),t.defaults(this.options.popdownOptions,e.popdownOptions),this.normalizeItems(this.options.items,this.options.groupedItems);var n=this.options.modelAttribute;n&&this.$el.attr("data-name",n),i.prototype.initialize.call(this,arguments)},setItems:function(e){this.normalizeItems(e,undefined),this.debouncedRender()},setGroupedItems:function(e){this.normalizeItems(undefined,e),this.debouncedRender()},normalizeItems:function(e,n){if(!e&&n){this.items=[],this.groupedItems=n.slice();if(!(n instanceof Array&&n[0].items instanceof Array&&!t.isUndefined(n[0].items[0].value)))throw new Error("Invalid groupedItems Input");t.each(n,function(e,n){t.each(e.items,function(e,t){this.items.push(e)},this)},this)}else if(e){this.items=e.slice(),this.groupedItems=[];var r={};r.label="",r.items=this.items,this.groupedItems.push(r)}this.options.nearestValue&&(this.valuesAsInts=[],t.each(this.items,function(e){var n=parseInt(e.value,10);if(t.isNaN(n))throw new Error("You cannot use the nearestValue option with a SyntheticSelect control that has values other than ints!");this.valuesAsInts.push(n)},this)),this.renderList=!0},stopListening:function(){e(window).off("."+this.cid),this.$menu&&this.$menu.off("."+this.cid),i.prototype.stopListening.apply(this,arguments)},show:function(){this.$menu.find(".icon-check:visible").closest("a").focus(),this.$menu.on("click."+this.cid,"a",this.click.bind(this)),e(window).on("keydown."+this.cid,this.keydown.bind(this)),this.trigger("popdownShown")},hide:function(){e(window).off("."+this.cid),this.$menu.off("."+this.cid),this.trigger("popdownHidden")},disable:function(){this.options.enabled=!1,this.$("a.dropdown-toggle").addClass("disabled")},enable:function(){this.options.enabled=!0,this.$("a.dropdown-toggle").removeClass("disabled")},tooltip:function(e){this.$("a.dropdown-toggle").tooltip(e)},click:function(t){var n=e(t.currentTarget);n.hasClass("disabled")||this.setValue(n.data("value"),!0),t.preventDefault()},keydown:function(n){if(n.shiftKey||n.ctrlKey||n.metaKey||n.altKey)return!0;var r=e(":focus"),i=!1,s=-1,o=-1,u=r.data("value");e.contains(this.el,r[0])&&t.each(this.items,function(e,t){e["value"]==u?s=t:!1},this);if(n.keyCode===this.keys.DOWN_ARROW){if(s<this.items.length-1)return this.$menu.find("[data-value="+this.items[s+1].value+"]").focus(),!1}else{if(n.keyCode===this.keys.UP_ARROW)return s>0?(this.$menu.find("[data-value="+this.items[s-1].value+"]").focus(),!1):(this.$(".dropdown-toggle").focus(),!1);if(n.keyCode>=48&&n.keyCode<=57||n.keyCode>=65&&n.keyCode<=90||n.keyCode>=97&&n.keyCode<=122||n.keyCode>=128&&n.keyCode<=165){var a=!1;this.$menu.find(" a").each(function(){if(a)return;var t=e(this),r=t.text().replace(/^\s\s*/,"").substring(0,1).toLowerCase(),i=String.fromCharCode(n.keyCode).toLowerCase();i==r&&t.focus()})}}},findItem:function(){if(!this.items||!this.items.length)return void 0;if(this.options.nearestValue){var e=o.nearestMatchAndIndexInArray(this._value,this.valuesAsInts);if(e.index!=void 0)return this.items[e.index]}return t.find(this.items,function(e){return t.isEqual(this._value,e.value)},this)||this.items[0]},render:function(){var n=this.groupedItems,r=this.items;if(!r||!r.length)return this;var i=this.findItem();if(this.renderList){var o=this.compiledTemplate({groupedItems:n,item:i,options:this.options,menuWidthClass:this.options.menuWidth!="normal"?"dropdown-menu-"+this.options.menuWidth:""});this.$el.html(o),this.$el.find(".dropdown-menu a").each(function(t,n){e(n).data("value",r[t].value)}),this.$menu=this.$(".dropdown-menu"),this.children.popdown&&this.children.popdown.remove(),this.children.popdown=new s(this.options.popdownOptions),this.children.popdown.on("shown",this.show.bind(this)),this.children.popdown.on("hidden",this.hide.bind(this)),this.renderList=!1}var u=this.options.additionalClassNames;return u&&this.$el.addClass(u),this.$menu.find("a").each(function(n,r){var s=e(r);s.find(".icon-check")[t.isEqual(s.data("value"),i.value)?"show":"hide"]()}),i.label&&this.$(".dropdown-toggle > .link-label").text(t(this.options.label).t()+" "+t(i.label).t()),this.$(".dropdown-toggle > i").attr("class","icon-"+i.icon),this},template:'            <a class="dropdown-toggle <%- options.toggleClassName %>" href="#">                <% if (item.icon) { %> <i class="icon-<%-item.icon%> icon-large"></i><% } %>                <span class="link-label"><%- options.label %> <%- item.label %></span><span class="caret"></span>            </a>            <div class="dropdown-menu dropdown-menu-selectable <%- options.menuClassName %> <%- menuWidthClass %> ">            <div class="arrow"></div>                <% _.each(groupedItems, function(group, key, fullItems) { %>                <ul>                <% _.each(group.items, function(element, index, list) { %>                    <li><a class="<%- element.enabled === false ? "disabled" : ""%>" href="#" data-value="<%- element.value %>">                        <i class="icon-check"></i>                        <% if (element.icon) { %> <i class="icon-<%-element.icon%> <%-options.iconClassName %>"></i><% } %>                        <% if (element.iconURL) { %> <img class="<%-options.iconURLClassName %>" src="<%-element.iconURL%>" alt="icon"><% } %>                        <span class="link-label"><%- element.label %></span>                        <% if (element.description && (options.descriptionPosition == "right")) { %> <span class="link-description"><%- element.description %></span><% } %>                        <% if (element.description && (options.descriptionPosition == "bottom")) { %> <span class="link-description-below"><%- element.description %></span><% } %>                    </a></li>                <% }); %>                </ul>                <% }); %>            </div>        '})}),define("views/shared/controls/SyntheticRadioControl",["jquery","underscore","module","views/shared/controls/Control","bootstrap.tooltip"],function(e,t,n,r){return r.extend({className:"control btn-group",moduleId:n.id,initialize:function(){var e={buttonClassName:"btn",elastic:!1};t.defaults(this.options,e);var n={iconSize:"icon-large"};t.each(this.options.items,function(e,r,i){t.defaults(e,n)}),this.options.modelAttribute&&this.$el.attr("data-name",this.options.modelAttribute),this.$el.addClass("btn-group-radio"),r.prototype.initialize.call(this,this.options)},events:{"click button":function(t){!this.options.enabled||this.setValue(e(t.currentTarget).data("value"),!0),t.preventDefault()}},disable:function(){this.options.enabled=!1,this.$("button").addClass("disabled")},enable:function(){this.options.enabled=!0,this.$("button").removeClass("disabled")},render:function(){if(!this.el.innerHTML){var n=t.template(this.template,{items:this.options.items,buttonClassName:this.options.buttonClassName,help:this.options.help,elastic:this.options.elastic,enabled:this.options.enabled,modelAttribute:this.options.modelAttribute});this.$el.html(n),this.$('[rel="tooltip"]').tooltip({animation:!1,container:"body"});var r=this.options.items;this.$el.find("button").each(function(t,n){e(n).attr("data-value",r[t].value).data("value",r[t].value)})}var i=this._value;this.$el.find("button").each(function(n,r){var s=e(r);s[t.isEqual(s.data("value"),i)?"addClass":"removeClass"]("active")});var s=this.options.additionalClassNames;return s&&this.$el.addClass(s),this},remove:function(){this.$('[rel="tooltip"]').tooltip("destroy"),r.prototype.remove.call(this)},template:'            <% _.each(items, function(item, index){ %>                <button name="<%- modelAttribute || "" %>"                         <% if (elastic) { %> style="width:<%- Math.round(100*(1/items.length)) %>%" <% } %>                         <% if (item.tooltip) { %> rel="tooltip" title="<%=item.tooltip%>" <% }                         %> class="<%=buttonClassName%> <%- item.className || "" %> <%- enabled ? "" : "disabled" %>">                    <% if (item.icon) { %> <i class="icon-<%-item.icon%> <%-item.iconSize%>"></i><% } %>                    <% if(item.label){ %> <%= item.label%> <%}%>                </button>            <% }) %>        '})}),define("views/shared/controls/SyntheticCheckboxControl",["underscore","module","views/shared/controls/Control","splunk.util"],function(e,t,n,r){return n.extend({className:"control",moduleId:t.id,initialize:function(){var t={checkboxClassName:"btn",defaultValue:!1,label:""};e.defaults(this.options,t),this.options.modelAttribute&&this.$el.attr("data-name",this.options.modelAttribute),n.prototype.initialize.call(this,arguments)},events:{"click label":function(e){!this.options.enabled||this.setValue(!this._value),e.preventDefault()},"click .btn":function(e){e.preventDefault()}},disable:function(){this.options.enabled=!1,this.$("label").addClass("disabled"),this.$(".btn").addClass("disabled")},enable:function(){this.options.enabled=!0,this.$("label").removeClass("disabled"),this.$(".btn").removeClass("disabled")},normalizeValue:function(e){return r.normalizeBoolean(e)?1:0},render:function(){var t=this.options.invertValue?!this.getValue():this.getValue();if(!this.el.innerHTML){var n=e.template(this.template,{options:this.options,checked:t});this.$el.html(n),this.options.enabled||this.disable()}else this.$(".icon-check")[t?"show":"hide"]();var r=this.options.additionalClassNames;return r&&this.$el.addClass(r),this},template:'            <label class="checkbox">                  <a href="#" data-name="<%- options.modelAttribute || "" %>" class="<%- options.checkboxClassName %>"><i class="icon-check" <% if (!checked) {%>style="display:none"<% } %>></i></a>                  <%= options.label%>            </label>        '})}),define("views/shared/controls/TextareaControl",["underscore","module","views/shared/controls/Control"],function(e,t,n){var r=13;return n.extend({moduleId:t.id,initialize:function(){var t={textareaClassName:"",placeholder:"",useSyntheticPlaceholder:!1};e.defaults(this.options,t),this.options.placeholder&&!this.supportsNativePlaceholder()&&(this.options.useSyntheticPlaceholder=!0),this.options.modelAttribute&&this.$el.attr("data-name",this.options.modelAttribute),n.prototype.initialize.call(this,arguments)},events:{"change textarea":function(e){!this.options.enabled||this.setValue(this.$("textarea").val(),!1),!this.options.enabled||this.updatePlaceholder()},"click .placeholder":function(e){!this.options.enabled||this.$textarea.focus()},"keyup textarea":function(e){this.updatePlaceholder()},"mouseup textarea":function(e){this.updatePlaceholder()},"keypress textarea":function(e){e.which==r&&e.stopPropagation()}},updatePlaceholder:function(){!this.options.useSyntheticPlaceholder||this.$placeholder[this.$textarea.val()===""?"show":"hide"]()},supportsNativePlaceholder:function(){var e=document.createElement("input");return e.hasOwnProperty&&e.hasOwnProperty("placeholder")?!0:!1},disable:function(){this.options.enabled=!1,this.$textarea.hide(),this.$disabledTextarea.show()},enable:function(){this.options.enabled=!0,this.$textarea.show(),this.$disabledTextarea.hide()},render:function(){if(!this.el.innerHTML){var t=e.template(this.template,{options:this.options,value:this._value||""});this.$el.html(t),this.$textarea=this.$("textarea"),this.$disabledTextarea=this.$(".uneditable-input"),!this.options.useSyntheticPlaceholder||(this.$placeholder=this.$(".placeholder"))}else this.$textarea.val(this._value),this.$disabledTextarea.text(this._value);this.updatePlaceholder();var n=this.options.additionalClassNames;return n&&this.$el.addClass(n),this},template:'            <span class="uneditable-input uneditable-input-multiline <%= options.inputClassName %>" <% if(options.enabled){ %>style="display:none"<%}%>><%- value %></span>            <textarea type="text" name="<%- options.modelAttribute || "" %>" class="<%= options.textareaClassName %>" <% if(options.placeholder && !options.useSyntheticPlaceholder){ %>placeholder="<%- options.placeholder %>"<%}%> <% if(!options.enabled){ %>style="display:none"<%}%>><%- value %></textarea>            <% if (options.useSyntheticPlaceholder) { %> <span class="placeholder"><%- options.placeholder %></span><% } %>        '})}),define("views/shared/controls/LabelControl",["underscore","module","views/shared/controls/Control","bootstrap.tooltip"],function(e,t,n){return n.extend({moduleId:t.id,initialize:function(){var t={inputClassName:"input-label",defaultValue:"label",iconSize:"icon-large"};e.defaults(this.options,t),n.prototype.initialize.call(this,arguments)},render:function(){var t=this._value||"";if(!this.el.innerHTML){var n=e.template(this.template,{options:this.options,value:t});this.$el.html(n),this.$span=this.$("span")}else this.$span.text(t);var r=this.options.additionalClassNames;return r&&this.$el.addClass(r),this.options.modelAttribute&&this.$el.attr("data-name",this.options.modelAttribute),this.options.tooltip&&this.$(".tooltip-text").tooltip({animation:!1,title:this.options.tooltip}),this},template:'            <span class="<%= options.inputClassName %><% if(options.tooltip) { %> tooltip-text<% } %>">                <% if (options.icon) { %> <i class="icon-<%-options.icon%> <%-options.iconSize%>"></i><% } %>                <%- value %>            </span>        '})}),define("views/shared/controls/TextControl",["underscore","module","views/shared/controls/Control"],function(e,t,n){return n.extend({moduleId:t.id,initialize:function(){var t={inputClassName:"",placeholder:"",prepend:!1,append:!1,useSyntheticPlaceholder:!1,trimLeadingSpace:!0,trimTrailingSpace:!0,password:!1};e.defaults(this.options,t),this.options.placeholder&&!this.supportsNativePlaceholder()&&(this.options.useSyntheticPlaceholder=!0),this.options.modelAttribute&&this.$el.attr("data-name",this.options.modelAttribute),n.prototype.initialize.call(this,arguments)},events:{"change input":function(e){var t=this.$input.val();this.options.trimLeadingSpace&&(t=t.replace(/^\s+/g,"")),this.options.trimTrailingSpace&&(t=t.replace(/\s+$/g,"")),this.setValue(t,!1),this.updatePlaceholder()},"click .placeholder":function(e){this.$input.focus()},"keyup input":function(e){this.updatePlaceholder(),this.trigger("keyup",e,this.$input.val())},"mouseup input":function(e){this.updatePlaceholder()}},updatePlaceholder:function(){!this.options.useSyntheticPlaceholder||this.$placeholder[this.$input.val()===""?"show":"hide"]()},supportsNativePlaceholder:function(){var e=document.createElement("input");return"placeholder"in e},disable:function(){this.$input.hide(),this.$disabledInput.css("display","inline-block")},enable:function(){this.$input.show(),this.$disabledInput.hide()},render:function(){if(!this.el.innerHTML){var t=e.template(this.template,{options:this.options,value:this._value||""});this.$el.html(t),this.$input=this.$("input"),this.$disabledInput=this.$(".uneditable-input"),!this.options.useSyntheticPlaceholder||(this.$placeholder=this.$(".placeholder")),this.options.prepend&&this.$el.addClass("input-prepend").prepend(this.options.prepend),this.options.append&&this.$el.addClass("input-append").append(this.options.append)}else this.$input.val(this._value),this.$disabledInput.text(this._value);this.updatePlaceholder();var n=this.options.additionalClassNames;return n&&this.$el.addClass(n),this},template:'        <span class="uneditable-input <%= options.inputClassName %>" <% if(options.enabled){ %>style="display:none"<%}%>><%- value %></span>        <input type="<% if (options.password){%>password<%}else{%>text<%}%>" name="<%- options.modelAttribute || "" %>" class="<%= options.inputClassName %>" value="<%- value %>" <% if(options.placeholder && !options.useSyntheticPlaceholder){ %>placeholder="<%- options.placeholder %>"<%}%> <% if(!options.enabled){ %>style="display:none"<%}%>>            <% if (options.useSyntheticPlaceholder) { %> <span class="placeholder"><%- options.placeholder %></span><% } %>        '})}),define("views/shared/controls/DateControl",["jquery","underscore","backbone","module","views/shared/controls/Control","jquery.ui.datepicker"],function(e,t,n,r,i,s){return i.extend({moduleId:r.id,initialize:function(){var e={inputClassName:"",help:"MM/DD/YYYY"};t.defaults(this.options,e),i.prototype.initialize.call(this,this.options),this.model.on("change",this.render,this)},events:{"change input[type=text]":function(e){this.setValue(this.$("input").datepicker("getDate"),!1)}},updateModel:function(){var e={validate:this.options.validate,forceUpdate:this.options.forceUpdate};return this.model?this.model.setMonDayYearFromJSDate(this._value,e):!0},render:function(){if(!this.el.innerHTML){var e=t.template(this.template,{options:this.options});this.$el.html(e),this.$("input").datepicker({defaultDate:this.model.jsDate()});var n=this.options.additionalClassNames;n&&this.$el.addClass(n)}var r=this.$("input").datepicker("getDate"),i=this.model.jsDate();return(!r||r.getTime()!==i.getTime())&&this.$("input").datepicker("setDate",i),this.$("input").blur(),this},template:'            <input type="text" size="8" class="<%= options.inputClassName %>" value=""/>        '})}),define("views/shared/controls/ControlGroup",["jquery","underscore","module","backbone","views/Base","views/shared/controls/Control","views/shared/controls/SyntheticSelectControl","views/shared/controls/SyntheticRadioControl","views/shared/controls/SyntheticCheckboxControl","views/shared/controls/TextControl","views/shared/controls/TextareaControl","views/shared/controls/DateControl","views/shared/controls/LabelControl","bootstrap.tooltip"],function(e,t,n,r,i,s,o,u,a,f,l,c,h){return i.extend({className:"control-group",moduleId:n.id,initialize:function(){var n={label:"",controls:[],error:!1,_errorMsg:"",controlClass:"",enabled:!0,required:!1};t.defaults(this.options,n),this.options.controls.length==0&&(this.options.controls=[{type:this.options.controlType,options:this.options.controlOptions}]),this.controlTypes={SyntheticSelect:o,SyntheticRadio:u,SyntheticCheckbox:a,Text:f,Textarea:l,Date:c,Label:h},i.prototype.initialize.call(this,arguments),this.options.enabled||this.$el.addClass("disabled"),t(this.options.controls).isArray()||(this.options.controls=[this.options.controls]),this.childList=[],t.each(this.options.controls,function(t,n){if(t instanceof r.View)this.children["child"+n]=t,this.childList.push(t);else{var i=e.extend(!0,{validate:!!this.options.validate,forceUpdate:!!this.options.forceUpdate,enabled:!!this.options.enabled},t.options),s=this.children["child"+n]=new this.controlTypes[t.type](i);this.childList.push(s)}},this),this.perAttrValidation={},t.isArray(this.options.controls)&&t.each(this.options.controls,function(e,n){e.options&&e.options.model&&(this.perAttrValidation[e.options.modelAttribute]=!0,e.options.model.on("attributeValidated:"+e.options.modelAttribute,function(e,n,r){this.perAttrValidation[n]=e,this.error(t.any(this.perAttrValidation,function(e){return!e}))},this))},this),this.options.controlOptions&&this.options.controlOptions.model instanceof r.Model&&(t.isArray(this.options.controlOptions)||(this.perAttrValidation[this.options.controlOptions.modelAttribute]=!0,this.options.controlOptions.model.on("attributeValidated:"+this.options.controlOptions.modelAttribute,function(e,n,r){this.perAttrValidation[n]=e,this.error(t.any(this.perAttrValidation,function(e){return!e}))},this)))},events:{"click a.tooltip-link":function(e){e.preventDefault()}},render:function(){if(!this.el.innerHTML){var e=t.template(this.template,{_:t,controlCid:this.children.child0.cid,label:this.options.label,help:this.options.help,controlClass:this.options.controlClass,helpClass:this.options.helpClass,tooltip:this.options.tooltip,required:this.options.required});this.$el.html(e),this.options.tooltip&&this.$(".tooltip-link").tooltip({animation:!1,title:this.options.tooltip}),t.each(this.childList,function(e,t){this.$(".controls").append(e.render().$el),t||e.$el.attr("id","control-"+this.children.child0.cid)},this),this.options.help&&this.$(".controls").append(this.$(".help-block"))}return this.error(this.options.error),this},hide:function(){this.$el.hide()},show:function(){this.$el.show()},enable:function(){this.$el.removeClass("disabled"),t(this.getAllControls()).invoke("enable")},disable:function(){this.$el.addClass("disabled"),t(this.getAllControls()).invoke("disable")},getModelAttributes:function(){var e=[];return t.each(this.childList,function(t){e.push(t.getModelAttribute())},this),e},error:function(e,t){return e?this.$el.addClass("error"):this.$el.removeClass("error"),this._errorMsg=t,this},getAllControls:function(){return t(this.children).filter(function(e){return e instanceof s})},template:'                <label class="control-label" for="control-<%- controlCid %>">                <%- label %>                <% if (tooltip) { %>                    <a href="#" class="tooltip-link"><%- _("?").t() %></a>                <% } %>                <% if (required) { %>                    <span class="required">*</span>                <% } %>                </label>                <div class="controls <%- controlClass %>">                <% if (help) { %> <span class="help-block <%- helpClass %>"><%= help %></span><% } %>                </div>                        '})}),define("helpers/FlashMessagesHelper",["jquery","underscore","models/FlashMessage","util/splunkd_utils"],function(e,t,n,r){var i=function(n,r){this.options=r||{},this.defaults=e.extend(!0,{},this.options),t.defaults(this.defaults,{removeDuplicates:!0});if(t.isUndefined(n))throw"FlashMessagesHelper must be created with a valid FlashMessages collection";this.flashMessagesCollection=n,this.registered={},this.clientModelMessages={},this.serverModelMessages={},this.generalMessages={}};return i.prototype={register:function(e,n){this.registered[e.cid]={instance:e},n&&(this.registered[e.cid].whitelist=t(n).isArray()?n:[n]),e.on("serverValidated",t.debounce(this.serverValidationHandler,0),this),e.on("validated",t.debounce(this.clientValidationHandler,0),this)},unregister:function(e){e.off(null,null,this),delete this.clientModelMessages[e.cid],delete this.serverModelMessages[e.cid],delete this.registered[e.cid]},destroy:function(){var e=t(this.registered).pluck("instance");t(e).each(function(e){this.unregister(e)},this)},clientValidationHandler:function(e,t,n){this.clientModelMessages[t.cid]=n,this.updateFlashMessageCollection()},serverValidationHandler:function(e,t,n){this.serverModelMessages[t.cid]=n,this.updateFlashMessageCollection()},addGeneralMessage:function(e,t){this.generalMessages[e]=t,this.updateFlashMessageCollection()},removeGeneralMessage:function(e){t(this.generalMessages).has(e)&&(delete this.generalMessages[e],this.updateFlashMessageCollection())},getGeneralMessagesSize:function(){return t(this.generalMessages).size()},getClientModelMessagesSize:function(){return t(this.clientModelMessages).size()},getServerModelMessagesSize:function(){return t(this.serverModelMessages).size()},updateFlashMessageCollection:function(){var e=[],i=[],s=[];t(this.clientModelMessages).each(function(i){t(i).each(function(t){e.push(new n({type:r.ERROR,html:t}))},this)},this),t(this.serverModelMessages).each(function(e,s){var o=this.registered[s]?this.registered[s].whitelist:null;t(e).each(function(e){(!o||t(o).contains(e.type))&&i.push(new n({type:r.normalizeType(e.type),html:t.escape(e.message)}))},this)},this),t(this.generalMessages).each(function(e){s.push(new n({type:r.normalizeType(e.type),html:e.html}))},this);var o=t.union(e,i,s);this.defaults.removeDuplicates&&(o=t(o).uniq(function(e){return e.get("html")})),this.defaults.postProcess&&(o=this.defaults.postProcess(o)),this.flashMessagesCollection.reset(o)}},i}),define("views/shared/FlashMessages",["jquery","underscore","backbone","views/Base","collections/FlashMessages","helpers/FlashMessagesHelper","module"],function(e,t,n,r,i,s,o){return r.extend({moduleId:o.id,className:"alerts",initialize:function(o){r.prototype.initialize.call(this,o),this.flashMsgCollection=new i,this.flashMsgHelper=new s(this.flashMsgCollection,this.options.helperOptions),this.flashMsgCollection.on("add remove reset",this.render,this),this.model instanceof n.Model?(this.flashMsgHelper.register(this.model,this.options.whitelist),this.model.error&&this.model.error.get("messages")&&this.flashMsgHelper.serverValidationHandler(!0,this.model,this.model.error.get("messages"))):t(this.model).each(function(e,t){this.flashMsgHelper.register(e,this.options.whitelist),e.error&&e.error.get("messages")&&this.flashMsgHelper.serverValidationHandler(!0,e,e.error.get("messages"))},this),this.collection instanceof n.Collection?(this.flashMsgHelper.register(this.collection,this.options.whitelist),this.collection.each(function(e){this.flashMsgHelper.register(e,this.options.whitelist)},this)):t(this.collection).each(function(e){this.flashMsgHelper.register(e,this.options.whitelist),e.each(function(e){this.flashMsgHelper.register(e,this.options.whitelist)},this)},this),this.beforeUnloadHandler=t(function(){this.sleep()}).bind(this),e(window).on("beforeunload",this.beforeUnloadHandler)},register:function(e,t){this.flashMsgHelper.register(e,t)},unregister:function(e){this.flashMsgHelper.unregister(e)},remove:function(){return this.flashMsgCollection.off(null,null,this),this.flashMsgHelper.destroy(),e(window).off("beforeunload",this.beforeUnloadHandler),r.prototype.remove.apply(this,arguments)},render:function(){return this.$el.empty(),this.$el.append(this.compiledTemplate({flashMessages:this.flashMsgCollection})),this.flashMsgCollection.length?this.$el.show():this.$el.hide(),this},template:'                <% flashMessages.each(function(flashMessage){ %>                     <div class="alert alert-<%- flashMessage.get("type") %>">                        <i class="icon-alert"></i>                        <%= flashMessage.get("html") %>                    </div>                <% }); %>             '})}),define("util/pdf_utils",["underscore","jquery","splunk.util","util/console","models/AlertAction","models/Job","splunk.config"],function(e,t,n,r,i,s,o){function c(n,i,u,a){var f=t.Deferred();return l().done(function(t){u=u.split(/[,\s]+/).join(",");var l={server:t.getSetting("mailserver","localhost"),use_ssl:t.getSetting("use_ssl","false"),use_tls:t.getSetting("use_tls","false"),to:u,sendpdf:"True",from:t.getSetting("from","splunk@localhost"),papersize:a.paperSize||"a2",paperorientation:a.paperOrientation||"portrait",pdfview:n},c="| sendemail "+e(l).map(function(e,t){return[t,JSON.stringify(e)].join("=")}).join(" ");r.log("Starting search %o",c);var h=new s;h.save({},{data:{search:c,earliest_time:"0",latest_time:"now",app:i,namespace:i,owner:o.USERNAME,ui_dispatch_app:i,ui_dispatch_view:n,preview:!1}}).done(e.bind(function(){h.startPolling(),h.entry.content.on("change:isDone",function(t,n){if(n){var i=h.entry.content.get("messages");e(i).each(function(e){e.type==="ERROR"&&r.error(e.text)}),e(i).any(function(e){return e.type==="ERROR"})?f.reject(e(i).pluck("text")[0]):f.resolve(),e.defer(e.bind(h.destroy,h))}}),h.entry.content.on("change:isFailed",function(t,n){n&&f.reject(),e.defer(e.bind(h.destroy,h))}),h.on("error",function(){f.reject("Error creating search job"),e.defer(e.bind(h.destroy,h))})},this)).fail(e.bind(function(){r.log("Search creation fail",arguments)},this))}).fail(function(){f.reject()}),f.promise()}function h(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}var u="pdfgen",a="deprecated",f=e.once(function(){var e=t.Deferred();return o.PDFGEN_IS_AVAILABLE?e.resolve(!0,u):t.getJSON(n.make_url("report/is_enabled")).success(function(t){t&&t.status=="enabled"?e.resolve(!0,a):e.resolve(!1,t&&t.status)}).error(function(){e.resolve(!1)}),e.promise()}),l=e.once(function(){var e=t.Deferred(),n=new i({id:"email"});return n.fetch().done(function(){e.resolve(n)}).fail(function(){e.reject()}),e.promise()}),p=function(i,s,o){var u=n.make_full_url("splunkd/__raw/services/pdfgen/render"),a=t('<form method="POST" target="_blank"></form>').attr("action",u);t("<input/>").attr({type:"hidden",name:"input-dashboard-xml",value:h(i)}).appendTo(a),t("<input/>").attr({type:"hidden",name:"namespace",value:s}).appendTo(a),t("<input/>").attr({type:"hidden",name:"splunk_form_key",value:n.getFormKey()}).appendTo(a),o&&e.each(o,function(e,n){t("<input/>").attr({type:"hidden",name:n,value:e}).appendTo(a)}),r.log("submitting form",a[0]),a.appendTo(document.body).submit(),e.defer(function(){a.remove()})},d=function(r,i,s,o){var l=t.Deferred();return f().done(function(t,f){var c=o?"input-"+o:"input-dashboard",h={namespace:i};h[c]=r,f===u?(s=e.extend(h,s||{}),l.resolve(n.make_full_url("splunkd/__raw/services/pdfgen/render",s))):f===a?l.resolve([n.make_url("app",i,r),n.propToQueryString({output:"pdf"})].join("?")):l.reject()}).fail(function(){l.reject()}),l.promise()};return{isPdfServiceAvailable:f,getRenderURL:d,downloadReportFromXML:p,getEmailAlertSettings:l,sendTestEmail:c}}),define("views/shared/jobstatus/buttons/ExportResultsDialog",["underscore","models/Base","module","views/shared/Modal","views/shared/controls/ControlGroup","views/shared/FlashMessages","uri/route","util/pdf_utils","util/math_utils"],function(e,t,n,r,i,s,o,u,a){return r.extend({moduleId:n.id,initialize:function(n){r.prototype.initialize.apply(this,arguments);var f=t.extend({defaults:{fileName:"",format:"csv",limitResults:"unlimited",maxResults:1e3},validation:{maxResults:{fn:"validateMaxResults"}},validateMaxResults:function(t,n,r){if((r.format==="pdf"||r.limitResults==="limit")&&(!a.isInteger(t)||parseFloat(t)<=0))return e("Max results must be an integer greater than 0").t()}});this.model={searchJob:this.model.searchJob,application:this.model.application,report:this.model.report,inmem:new f},this.children.flashMessage=new s({model:this.model.inmem}),this.deferredPdfAvailable=$.Deferred(),this.deferredInitializeFormat=$.Deferred(),this.usePanelType=n.usePanelType,this.resultTypeIsReport=this.usePanelType?this.model.report.entry.content.get("display.general.type")!=="events":!!this.model.searchJob.entry.content.get("reportSearch"),this.model.report?this.deferredPdfAvailable=u.isPdfServiceAvailable():this.deferredPdfAvailable.resolve(!1),$.when(this.deferredPdfAvailable).then(function(t){var n=[{label:e("CSV").t(),value:"csv"},{label:e("XML").t(),value:"xml"},{label:e("JSON").t(),value:"json"}];this.model.report&&this.model.report.id&&t&&n.unshift({label:e("PDF").t(),value:"pdf"}),this.resultTypeIsReport||n.unshift({label:e("Raw Events").t(),value:"raw"}),this.children.formatControl=new i({controlType:"SyntheticSelect",controlOptions:{modelAttribute:"format",model:this.model.inmem,items:n,save:!1,toggleClassName:"btn",labelPosition:"outside",elastic:!0,popdownOptions:{attachDialogTo:".modal:visible",scrollContainer:".modal:visible .modal-body:visible"}},label:e("Format").t()}),this.deferredInitializeFormat.resolve()}.bind(this)),this.children.filenameControl=new i({controlType:"Text",controlOptions:{modelAttribute:"fileName",model:this.model.inmem,placeholder:"optional"},label:e("File Name").t()}),this.children.limitResultsControl=new i({controlType:"SyntheticRadio",controlOptions:{modelAttribute:"limitResults",model:this.model.inmem,items:[{label:e("Unlimited").t(),value:"unlimited"},{label:e("Limited").t(),value:"limit"}],save:!1,toggleClassName:"btn",labelPosition:"outside",elastic:!0},label:e("Number of Results").t()}),this.children.maxResultsControl=new i({controlType:"Text",controlOptions:{modelAttribute:"maxResults",model:this.model.inmem},label:e("Max Results").t()}),this.model.inmem.on("change:limitResults",this.toggleMaxResults,this),this.model.inmem.on("change:format",this.toggleByFormat,this),this.model.inmem.on("validated",function(e,t,n){if(e){var r=this.model.inmem.get("format"),i=this.model.inmem.get("maxResults"),s=this.model.inmem.get("limitResults")==="limit"?i:0;if(r==="pdf"){var a="",f=this.model.report.entry.content.get("action.email.reportPaperOrientation"),l=this.model.report.entry.content.get("action.email.reportPaperSize")||"a2";f==="landscape"&&(a="-landscape"),u.getRenderURL(this.model.report.entry.get("name"),this.model.report.entry.acl.get("app"),{sid:this.model.searchJob.id,"paper-size":l+a,"max-rows-per-table":i},"report").done(function(e){this.hide(),window.open(e)}.bind(this))}else window.location.href=o.exportUrl(this.model.application.get("root"),this.model.application.get("locale"),this.model.searchJob.get("id"),this.model.inmem.get("fileName"),this.model.inmem.get("format"),this.model.inmem.get("limitResults"),i,s,this.resultTypeIsReport),this.hide()}},this)},events:$.extend({},r.prototype.events,{"click .btn-primary":function(e){this.model.inmem.validate(),e.preventDefault()}}),toggleByFormat:function(){this.model.inmem.get("format")==="pdf"?(this.children.filenameControl.$el.hide(),this.children.limitResultsControl.$el.hide(),this.children.maxResultsControl.$el.show()):(this.children.filenameControl.$el.show(),this.children.limitResultsControl.$el.show(),this.toggleMaxResults())},toggleMaxResults:function(){this.model.inmem.get("limitResults")==="unlimited"?this.children.maxResultsControl.$el.hide():this.children.maxResultsControl.$el.show()},render:function(){$.when(this.deferredInitializeFormat).then(function(){return this.$el.html(r.TEMPLATE),this.$(r.HEADER_TITLE_SELECTOR).html(e("Export Results").t()),this.$(r.BODY_SELECTOR).prepend(this.children.flashMessage.render().el),this.$(r.BODY_SELECTOR).append(r.FORM_HORIZONTAL_JUSTIFIED),this.$(r.BODY_FORM_SELECTOR).append(this.children.formatControl.render().el),this.$(r.BODY_FORM_SELECTOR).append(this.children.filenameControl.render().el),this.$(r.BODY_FORM_SELECTOR).append(this.children.limitResultsControl.render().el),this.$(r.BODY_FORM_SELECTOR).append(this.children.maxResultsControl.render().el),this.toggleByFormat(),this.toggleMaxResults(),this.$(r.FOOTER_SELECTOR).append(r.BUTTON_CANCEL),this.$(r.FOOTER_SELECTOR).append('<a href="#" class="btn btn-primary modal-btn-primary">'+e("Export").t()+"</a>"),this}.bind(this))}})}),define("views/shared/delegates/StopScrollPropagation",["jquery","underscore","views/shared/delegates/Base"],function(e,t,n){return n.extend({initialize:function(){var e={selector:""};t.defaults(this.options,e),this.events={},this.events["mousewheel "+this.options.selector]="mousewheel",this.events["DOMMouseScroll "+this.options.selector]="mousewheel",this.delegateEvents(this.events)},mousewheel:function(e){var t=-e.originalEvent.wheelDelta||e.originalEvent.detail*20;e.currentTarget.scrollTop+=t,e.stopPropagation(),e.preventDefault()}})}),define("views/shared/delegates/TextareaResize",["jquery","views/shared/delegates/Base","underscore","splunk.logger"],function(e,t,n,r){return t.extend({maxHeightMultiple:5,maxHeight:null,lineHeight:null,minHeight:null,initialize:function(){this.logger=r.getLogger("textarea_resize.js"),this.content=null,this.shadow=null;var t={maxLines:this.maxHeightMultiple};n.defaults(this.options,t),this.lineHeight=parseInt(this.$el.css("lineHeight"),10)||parseInt(this.$el.css("fontSize"),10)+1||20,this.minHeight=this.options.minHeight||this.options.lineHeight,this.maxHeight=this.options.maxLines*this.lineHeight,this._createShadow(),this.resizeTextarea(),e(window).on("resize",this.resizeTextarea.bind(this))},events:{focus:"_startObserving",blur:"_stopObserving",keyup:"resizeTextarea"},_createShadow:function(){if(!this.shadow){var t=new Array("paddingTop","paddingRight","paddingBottom","paddingLeft","fontSize","lineHeight","fontFamily","fontWeight","wordWrap","whiteSpace","borderLeftWidth","borderLeftColor","borderLeftStyle","borderRightWidth","borderRightColor","borderRightStyle","borderTopWidth","borderTopColor","borderTopStyle","borderBottomWidth","borderBottomColor","borderBottomStyle","boxSizing");this.shadow=e('<div class="shadowTextarea"></div>').css({position:"absolute",left:"-9999px",top:"-9999px",marginRight:"-3000px"}).appendTo(this.$el.parent()),e.browser.mozilla&&e.browser.version.substr(0,3)<"1.9"&&this.shadow.css("position","fixed");var r={};n.each(t,function(e){var t=this.$el.css(e);r[e]=e=="whiteSpace"&&t=="normal"?"pre-wrap":t},this),this.shadow.css(r),this._adjustShadowWidth()}},_adjustShadowWidth:function(){this.shadow&&this.shadow.width(this.$el.width())},resizeTextarea:function(){this.$el.val()!=this.content&&(this.content=this.$el.val(),this.shadow.text(this.content)),this._adjustShadowWidth();if(Math.abs(this.shadow.height()-this.$el.height())>3){var e=this.shadow.height();e>=this.maxHeight?this._setHeight(this.maxHeight,"auto"):e<=this.minHeight?this._setHeight(this.minHeight,"hidden"):this._setHeight(e,"hidden")}},_setHeight:function(e,t){var n=Math.floor(parseInt(e,10))-1;this.$el.height()!=n&&(this.$el.height(n),this.$el.css("overflow",t))},_startObserving:function(){if(this.timer)return;this.timer=setInterval(function(){this.resizeTextarea()}.bind(this),200)},_stopObserving:function(){clearInterval(this.timer),delete this.timer},isMultiline:function(){var e=Math.round(this.$el.height()/this.lineHeight);return e>1},remove:function(){return t.prototype.remove.apply(this),e(window).off("resize",this.resizeTextarea),this._stopObserving(),this}})}),define("views/shared/delegates/Accordion",["jquery","underscore","views/shared/delegates/Base"],function(e,t,n){return n.extend({initialize:function(){var e={group:".accordion-group",toggle:".accordion-toggle",body:".accordion-body",defaultGroup:".accordion-group:first-child",icon:".icon-accordion-toggle",inactiveIconClass:"icon-triangle-right-small",activeIconClass:"icon-triangle-down-small",activeClass:"active",speed:300};t.defaults(this.options,e),this.$(this.options.body).hide(),this.$(this.options.icon).addClass(this.options.inactiveIconClass),this.show(this.$(this.options.defaultGroup),!1)},events:{"click .accordion-toggle":"toggle"},toggle:function(t){t.preventDefault();var n=e(t.currentTarget).closest(this.options.group);if(n.hasClass(this.options.activeClass))return;this.trigger("toggle"),this.show(n,!0),this.trigger("toggled")},show:function(t,n){var r=this,i=e(t),s=this.$(this.options.group+"."+this.options.activeClass),o=function(){r.trigger("shown")},u=function(){r.trigger("hidden")};this.trigger("show"),this.trigger("hide"),s.removeClass(this.options.activeClass),i.addClass(this.options.activeClass),s.find(this.options.icon).addClass(this.options.inactiveIconClass).removeClass(this.options.activeIconClass),i.find(this.options.icon).addClass(this.options.activeIconClass).removeClass(this.options.inactiveIconClass),n?(s.find(this.options.body).slideUp({duration:this.options.speed,queue:!1,complete:u}),i.find(this.options.body).slideDown({duration:this.options.speed,queue:!1,complete:o})):(s.find(this.options.body).hide({duration:0,queue:!1,complete:u}),i.find(this.options.body).show({duration:0,queue:!1,complete:o}))}})}),define("views/shared/delegates/ColumnSort",["jquery","underscore","backbone","views/shared/delegates/Base"],function(e,t,n,r){var i={SORTABLE_ROW:"sorts",NOT_SORTABLE_CLASS:"not-sortable",SORT_DISABLED_CLASS:"sort-disabled",SORTED_CLASS:"active",ASCENDING:"asc",DESCENDING:"desc",SORT_KEY_ATTR:"data-sort-key",SORT:"sort"},s="th."+i.SORTABLE_ROW,o="i.icon-sorts";return r.extend({events:function(){var e={};return e["click "+s]="onColumnHeaderClick",e}(),initialize:function(){this.model||(this.model=new n.Model);var r={sortKeyAttr:"sortKey",sortDirAttr:"sortDirection"};this.options=e.extend(!0,r,this.options),this.autoUpdate=!!this.options.autoUpdate,this.autoUpdate&&this.model.on("change:"+this.options.sortKeyAttr+" change:"+this.options.sortDirAttr,t.debounce(function(){this.update()},0),this)},update:function(e){e=e||this.$el;var t=e.find(s),n=this.model.get(this.options.sortKeyAttr),r=t.filter("["+i.SORT_KEY_ATTR+'="'+n+'"]'),u=this.model.get(this.options.sortDirAttr);t.removeClass(i.SORTED_CLASS).find(o).removeClass(i.ASCENDING+" "+i.DESCENDING),r.addClass(i.SORTED_CLASS).find(o).addClass(u==="asc"?i.ASCENDING:i.DESCENDING)},onColumnHeaderClick:function(t){t.preventDefault();var n=e(t.currentTarget);if(n.hasClass(i.NOT_SORTABLE_CLASS)||n.hasClass(i.SORT_DISABLED_CLASS))return;var r=n.attr(i.SORT_KEY_ATTR),s=n.find(o).hasClass(i.DESCENDING)?"asc":"desc",u={};u[this.options.sortKeyAttr]=r,u[this.options.sortDirAttr]=s,this.model.set(u),this.trigger(i.SORT,r,s)}},i)}),define("views/shared/delegates/DetachedTableHeader",["jquery","underscore","views/shared/delegates/Base"],function(e,t,n){return n.extend({syncColumnWidths:function(){if(!this.$table)return;var n=this.$table.find("thead > tr"),r=n.find("th"),i=this.$headerTable.find("thead > tr"),s=i.find("th"),o=!1,u=[];this.$table.css("table-layout",this.options.defaultLayout),this.options.flexWidthColumn!==!1&&(o=r.eq(this.options.flexWidthColumn)),r.not(o[0]).css("width",""),t(r).each(function(t,n){if(o&&t===o[0])return;var r=e(t),i={width:r[0].clientWidth-parseFloat(r.css("padding-right"))-parseFloat(r.css("padding-left")),index:n};u.push(i)},this),this.$headerTable.width(this.$table.outerWidth()),t.each(u,function(e){var t=r.eq(e.index),n=s.eq(e.index);t.width(e.width),n.width(e.width)}),this.$table.css("table-layout","fixed")}})}),define("views/shared/delegates/TableDock",["jquery","underscore","views/shared/delegates/DetachedTableHeader"],function(e,t,n){return n.extend({awake:!0,touch:!1,initialize:function(e){var r={table:"> table",offset:0,dockScrollBar:!0,flexWidthColumn:-1,defaultLayout:"auto"};t.defaults(this.options,r),n.prototype.initialize.call(this,e),this.disabled=!1,this.dockedScrollHidden=!0,this.left=0,this.scrollLeft=!1,this.eventNS="table-dock-"+this.cid,this.awake&&this.bindListeners()},bindListeners:function(){var n=t.debounce(this.handleWindowResize,50);e(window).on("resize."+this.eventNS,t(n).bind(this)),e(window).on("scroll."+this.eventNS,t(this.handleWindowScroll).bind(this)),this.options.dockScrollBar&&this.$el.on("scroll."+this.eventNS,t(this.handleContainerScroll).bind(this))},unbindListeners:function(){e(window).off("resize."+this.eventNS),e(window).off("scroll."+this.eventNS),this.options.dockScrollBar&&this.$el.off("."+this.eventNS)},destroy:function(){this.unbindListeners()},update:function(){this._updateDebounced||(this._updateDebounced=t.debounce(this._update)),this._updateDebounced()},_update:function(){if(!this.awake){this.touch=!0;return}this.$table=this.$(this.options.table).first(),this.updateHeaders(),this.options.dockScrollBar&&this.updateScroll(),this.$table.is(":visible")?this.syncMeasurements():t.defer(this.syncMeasurements.bind(this))},syncMeasurements:function(){this.scrollLeft=!1,this.syncColumnWidths(),this.options.dockScrollBar&&this.syncScrollWidths(),this.handleWindowScroll(),this.options.dockScrollBar&&this.handleContainerScroll(),this.trigger("updated",this.$headerTable)},disable:function(){this.disabled=!0,this.$disable&&this.$disable.show()},enable:function(){this.disabled=!1,this.$disable&&this.$disable.hide()},updateHeaders:function(){this.$header&&this.$header.remove(),this.$header=e('<div class="header-table-docked" style="display:none"><table></table><div class="disable"></div></div>').css({top:this.options.offset,left:this.left,right:0}),this.$disable=this.$header.find("> .disable")[this.disabled?"show":"hide"](),this.$headerTable=this.$header.find("> table"),this.$headerTable.attr("class",this.$table.attr("class")),this.$table.find("> thead").clone().appendTo(this.$headerTable),this.$header.prependTo(this.el),this.$headerTable.on("click","th",function(t){t.preventDefault(),t.stopPropagation();var n=e(t.currentTarget).prevAll().length+1;this.$table.find("> thead > tr > th:nth-child("+n+")").click()}.bind(this)),this.$headerTable.on("click","th a",function(e){e.preventDefault()})},updateScroll:function(){this.$dockedScroll&&this.$dockedScroll.remove(),this.$dockedScroll=e("<div />").addClass("table-scroll-bar-docked").hide().appendTo(this.$el).css("left",this.$el.position().left),this.$dockedScroll.on("scroll",t(this.handleDockedScrollChange).bind(this))},handleWindowResize:function(){if(!this.$table||!this.$table.is(":visible"))return;this.syncColumnWidths(),this.options.dockScrollBar&&(this.updateDockedScrollBar(),this.syncScrollWidths())},handleWindowScroll:function(t){if(!this.$table||!this.$table.is(":visible"))return;var n=e(window).scrollTop(),r=this.$table.offset().top;n>=r-this.options.offset?this.$header.is(":visible")||this.$header.css("top",this.options.offset).show():(this.$header.css("top","-1000px").width(),this.$header.hide()),this.options.dockScrollBar&&this.updateDockedScrollBar()},handleContainerScroll:function(){if(!this.$table)return;var e=this.$el.scrollLeft();if(this.scrollLeft===e)return;this.$headerTable.css("marginLeft",-e+"px"),this.$dockedScroll.scrollLeft(e),this.scrollLeft=e},handleDockedScrollChange:function(){var e=this.$el.scrollLeft(),t=this.$dockedScroll.scrollLeft();e!==t&&(this.$headerTable.css("marginLeft",-t+"px"),this.$el.scrollLeft(t))},syncColumnWidths:function(){n.prototype.syncColumnWidths.apply(this,arguments),this.left=this.$el.position().left,this.$header.css({left:this.left})},syncScrollWidths:function(){if(!this.$table||!this.$table[0])return;var t=parseFloat(this.$table[0].scrollWidth),n=e("<div />").width(t).height(1);this.$dockedScroll.html(n)},updateDockedScrollBar:function(){var t=e(window).scrollTop(),n=this.$table.offset().top,r=e(window).height(),i=this.$el.outerHeight();if(n+i>t+r){if(!this.dockedScrollHidden)return;this.$dockedScroll.show(),this.dockedScrollHidden=!1,this.handleContainerScroll()}else this.dockedScrollHidden||(this.$dockedScroll.hide(),this.dockedScrollHidden=!0)},wake:function(){return this.awake=!0,this.bindListeners(),this.touch?t.defer(this.update.bind(this)):(t.defer(this.handleWindowResize.bind(this)),t.defer(this.handleWindowScroll.bind(this)),this.options.dockScrollBar&&t.defer(this.handleContainerScroll.bind(this))),this},sleep:function(){return this.awake=!1,this.unbindListeners(),this},remove:function(){return n.prototype.remove.apply(this),e(window).off("resize."+this.eventNS),e(window).off("scroll."+this.eventNS),this}})}),define("views/shared/delegates/TableHeadStatic",["jquery","underscore","views/shared/delegates/DetachedTableHeader"],function(e,t,n){return n.extend({awake:!0,touch:!1,initialize:function(e){var r={headerContainer:"> .header-table-static",scrollContainer:"> .scroll-table-wrapper",table:"> .scroll-table-wrapper > table",offset:0,flexWidthColumn:-1,defaultLayout:"auto"};t.defaults(this.options,r),n.prototype.initialize.call(this,e),this.awake&&this.bindListeners()},bindListeners:function(){var n=t.debounce(this.handleWindowResize,50);e(window).on("resize."+this.cid,t(n).bind(this)),e(this.$(this.options.scrollContainer)).on("scroll."+this.cid,t(this.handleContainerScroll).bind(this))},unbindListeners:function(){e(window).off("resize."+this.cid),e(this.$(this.options.scrollContainer)).off("scroll."+this.cid)},destroy:function(){this.unbindListeners()},remove:function(){return n.prototype.remove.apply(this),e(window).off("resize."+this.cid),this},update:function(){if(!this.awake){this.touch=!0;return}this.$scrollContainer=this.$(this.options.scrollContainer),this.$table=this.$(this.options.table).first(),this.$headerContainer=this.$(this.options.headerContainer),this.$headerContainer.empty();var n=e('<div class="header-table-wrapper"></div>').appendTo(this.$headerContainer);n.css({"margin-right":this.$scrollContainer[0].offsetWidth-this.$scrollContainer[0].clientWidth}),this.$headerTable=e("<table>"),this.$headerTable.attr("class",this.$table.attr("class")).width(this.$table.outerWidth()).css("table-layout","fixed"),this.$table.find("> thead").clone().css("visibility","visible").appendTo(this.$headerTable),n.prepend(this.$headerTable),this.$table.find("thead").css("visibility","hidden"),this.$headerTable.on("click","th",function(t){t.preventDefault(),t.stopPropagation();var n=e(t.currentTarget).prevAll().length+1;this.$table.find("> thead > tr > th:nth-child("+n+")").click()}.bind(this)),this.$headerTable.on("click","th a",function(e){e.preventDefault()}),this.scrollLeft=0;var r=t(function(){this.syncColumnWidths(),this.handleContainerScroll(),this.trigger("updated",this.$headerTable)}).bind(this);this.$table.is(":visible")?r():t.defer(r)},handleContainerScroll:function(){if(!this.$table)return;var e=this.$scrollContainer.scrollLeft();e!==this.scrollLeft&&(this.$headerTable.css("marginLeft",-e+"px"),this.scrollLeft=e)},handleWindowResize:function(){if(!this.$table)return;this.syncColumnWidths()},wake:function(){return this.awake=!0,this.bindListeners(),this.touch?t.defer(this.update.bind(this)):(t.defer(this.handleWindowResize.bind(this)),t.defer(this.handleContainerScroll.bind(this))),this},sleep:function(){return this.awake=!1,this.unbindListeners(),this}})});