').append(this.TEXTAREA),this.TEXTAREA_PARENT.css({top:0,left:0,display:"none"}),this.instance.rootElement.append(this.TEXTAREA_PARENT);var e=this;n.PluginHooks.push("afterRender",function(){setTimeout(function(){e.refreshDimensions()},0)})},i.prototype.bindEvents=function(){var t=this;this.TEXTAREA_PARENT.off(".editor").on("keydown.editor",function(e){var n=(e.ctrlKey||e.metaKey)&&!e.altKey;if(17===e.keyCode||224===e.keyCode||91===e.keyCode||93===e.keyCode)return e.stopPropagation(),void 0;switch(e.keyCode){case 38:case 40:t.finishEditing(!1);break;case 9:t.finishEditing(!1),e.preventDefault();break;case 39:t.getCaretPosition(t.TEXTAREA[0])===t.TEXTAREA.val().length?t.finishEditing(!1):e.stopPropagation();break;case 37:0===t.getCaretPosition(t.TEXTAREA[0])?t.finishEditing(!1):e.stopPropagation();break;case 27:t.instance.destroyEditor(!0),e.stopPropagation();break;case 13:var i=t.instance.getSelected(),s=!(i[0]===i[2]&&i[1]===i[3]);e.ctrlKey&&!s||e.altKey?(t.TEXTAREA.val(t.TEXTAREA.val()+"\n"),t.TEXTAREA[0].focus(),e.stopPropagation()):t.finishEditing(!1,n),e.preventDefault();break;default:e.stopPropagation()}})},i.prototype.getCaretPosition=function(t){if(t.selectionStart)return t.selectionStart;if(document.selection){t.focus();var e=document.selection.createRange();if(null==e)return 0;var n=t.createTextRange(),i=n.duplicate();return n.moveToBookmark(e.getBookmark()),i.setEndPoint("EndToStart",n),i.text.length}return 0},i.prototype.setCaretPosition=function(t,e){if(t.setSelectionRange)t.focus(),t.setSelectionRange(e,e);else if(t.createTextRange){var n=t.createTextRange();n.collapse(!0),n.moveEnd("character",e),n.moveStart("character",e),n.select()}},i.prototype.beginEditing=function(t,e,i,s,o){if(!this.isCellEdited){this.isCellEdited=!0,this.row=t,this.col=e,this.prop=i;var r={row:t,col:e};if(this.instance.view.scrollViewport(r),this.instance.view.render(),this.TEXTAREA.on("cut.editor",function(t){t.stopPropagation()}),this.TEXTAREA.on("paste.editor",function(t){t.stopPropagation()}),this.instance.getCellMeta(t,e).isWritable&&(this.TEXTAREA[0].value=s?n.helper.stringify(this.originalValue)+(o||""):"",this.refreshDimensions(),this.TEXTAREA[0].focus(),this.setCaretPosition(this.TEXTAREA[0],this.TEXTAREA[0].value.length),this.instance.getSettings().asyncRendering)){var a=this;setTimeout(function(){a.refreshDimensions()},0)}}},i.prototype.refreshDimensions=function(){if(this.isCellEdited){this.TD=this.instance.getCell(this.row,this.col);var e=t(this.TD),n=e.offset(),i=this.instance.rootElement.offset(),s=this.instance.rootElement.scrollTop(),o=this.instance.rootElement.scrollLeft(),r=n.top-i.top+s-1,a=n.left-i.left+o-1,l=this.instance.getSettings(),c=l.rowHeaders===!1?0:1,h=l.colHeaders===!1?0:1;0>r&&(r=0),0>a&&(a=0),c>0&&parseInt(e.css("border-top-width"))>0&&(r+=1),h>0&&parseInt(e.css("border-left-width"))>0&&(a+=1),t.browser.msie&&7>=parseInt(t.browser.version,10)&&(r-=1),this.TEXTAREA_PARENT.css({top:r,left:a});var u=e.width(),d=e.outerHeight()-4;parseInt(e.css("border-top-width"))>0&&(d-=1),parseInt(e.css("border-left-width"))>0&&c>0&&(u-=1),this.TEXTAREA.autoResize({maxHeight:200,minHeight:d,minWidth:u,maxWidth:Math.max(168,u),animate:!1,extraSpace:0}),this.TEXTAREA_PARENT[0].style.display="block"}},i.prototype.finishEditing=function(e,n){if(this.isCellEdited&&(this.isCellEdited=!1,!e)){var i=[[t.trim(this.TEXTAREA[0].value)]];if(n){var s=this.instance.getSelected();this.instance.populateFromArray({row:s[0],col:s[1]},i,{row:s[2],col:s[3]},!1,"edit")}else this.instance.populateFromArray({row:this.row,col:this.col},i,null,!1,"edit")}this.instance.$table.off(".editor"),document.activeElement===this.TEXTAREA[0]&&this.TD.focus(),this.instance.view.wt.update("onCellDblClick",null),this.TEXTAREA_PARENT[0].style.display="none"},n.TextEditor=function(t,e,s,o,r,a){function l(){t.textEditor.beginEditing(s,o,r,!0)}return t.textEditor||(t.textEditor=new i(t)),t.textEditor.TD=e,t.textEditor.isCellEdited=!1,t.textEditor.originalValue=a,t.$table.on("keydown.editor",function(e){var i=(e.ctrlKey||e.metaKey)&&!e.altKey;if(!t.textEditor.isCellEdited)if(n.helper.isPrintableChar(e.keyCode))i||t.textEditor.beginEditing(s,o,r);else if(113===e.keyCode)t.textEditor.beginEditing(s,o,r,!0),e.stopPropagation(),e.preventDefault();else if(13===e.keyCode&&t.getSettings().enterBeginsEditing){var a=t.getSelected(),l=!(a[0]===a[2]&&a[1]===a[3]);i&&!l||e.altKey?t.textEditor.beginEditing(s,o,r,!0,"\n"):t.textEditor.beginEditing(s,o,r,!0),e.preventDefault(),e.stopPropagation()}}),t.view.wt.update("onCellDblClick",l),function(e){t.textEditor.finishEditing(e)}};for(var S in i.prototype)i.prototype.hasOwnProperty(S)&&(s.prototype[S]=i.prototype[S]);s.prototype._bindEvents=i.prototype.bindEvents,s.prototype.bindEvents=function(){var t=this;this.typeahead.listen(),this.TEXTAREA.off("keydown"),this.TEXTAREA.off("keyup"),this.TEXTAREA.off("keypress"),this.TEXTAREA_PARENT.off(".acEditor").on("keydown.acEditor",function(e){switch(e.keyCode){case 38:t.typeahead.prev(),e.stopImmediatePropagation();break;case 40:t.typeahead.next(),e.stopImmediatePropagation();break;case 13:e.preventDefault()}}),this.TEXTAREA_PARENT.on("keyup.acEditor",function(e){(n.helper.isPrintableChar(e.keyCode)||113===e.keyCode||13===e.keyCode||8===e.keyCode||46===e.keyCode)&&t.typeahead.lookup()}),this._bindEvents()},s.prototype._beginEditing=i.prototype.beginEditing,s.prototype.beginEditing=function(t,e,n,i,s){this._beginEditing(t,e,n,i,s)},s.prototype._finishEditing=i.prototype.finishEditing,s.prototype.finishEditing=function(t,e){this.isMenuExpanded()&&this.typeahead.$menu.find(".active").length&&!t&&this.typeahead.select(),this._finishEditing(t,e)},s.prototype.isMenuExpanded=function(){return this.typeahead.$menu.is(":visible")?this.typeahead:!1},n.AutocompleteEditor=function(t,e,i,o,r,a,l){function c(){t.autocompleteEditor.beginEditing(i,o,r,!0),setTimeout(function(){t.autocompleteEditor.typeahead.lookup()},1)}var h,u;t.autocompleteEditor||(t.autocompleteEditor=new s(t)),t.autocompleteEditor.TD=e,t.autocompleteEditor.isCellEdited=!1,t.autocompleteEditor.originalValue=a;var d=t.autocompleteEditor.typeahead;d.select=function(){var e=this.hide();return t.destroyEditor(!0),"function"==typeof l.onSelect?l.onSelect(i,o,r,this.$menu.find(".active").attr("data-value"),this.$menu.find(".active").index()):t.setDataAtCell(i,r,this.$menu.find(".active").attr("data-value")),e},d.render=function(t){return d._render.call(this,t),l.strict||this.$menu.find("li:eq(0)").removeClass("active"),this};for(h in l)if(l.hasOwnProperty(h))if("options"===h)for(u in l.options)l.options.hasOwnProperty(u)&&(d.options[u]=l.options[u]);else d[h]=l[h];t.$table.on("keydown.editor",function(e){var s=(e.ctrlKey||e.metaKey)&&!e.altKey;if(!t.autocompleteEditor.isCellEdited)if(n.helper.isPrintableChar(e.keyCode))s||t.autocompleteEditor.beginEditing(i,o,r);else if(113===e.keyCode)t.autocompleteEditor.beginEditing(i,o,r,!0),e.stopPropagation(),e.preventDefault();else if(13===e.keyCode&&t.getSettings().enterBeginsEditing){var a=t.getSelected(),l=!(a[0]===a[2]&&a[1]===a[3]);
-s&&!l||e.altKey?t.autocompleteEditor.beginEditing(i,o,r,!0,"\n"):t.autocompleteEditor.beginEditing(i,o,r,!0),e.preventDefault(),e.stopPropagation()}}),t.view.wt.update("onCellDblClick",c);var p=function(e){t.autocompleteEditor.finishEditing(e)};return p},n.CheckboxEditor=function(t,e,i,s,r,a,l){function c(){o(t,i,r,l)}return l===void 0&&(l={}),l.checkedTemplate===void 0&&(l.checkedTemplate=!0),l.uncheckedTemplate===void 0&&(l.uncheckedTemplate=!1),t.$table.on("keydown.editor",function(e){var s=(e.ctrlKey||e.metaKey)&&!e.altKey;!s&&n.helper.isPrintableChar(e.keyCode)&&(o(t,i,r,l),e.stopPropagation(),e.preventDefault())}),t.view.wt.update("onCellDblClick",c),function(){t.$table.off(".editor"),t.view.wt.update("onCellDblClick",null)}},n.AutocompleteCell={renderer:n.AutocompleteRenderer,editor:n.AutocompleteEditor},n.CheckboxCell={renderer:n.CheckboxRenderer,editor:n.CheckboxEditor},n.TextCell={renderer:n.TextRenderer,editor:n.TextEditor},n.NumericCell={renderer:n.NumericRenderer,editor:n.TextEditor,dataType:"number"},n.cellTypes={autocomplete:n.AutocompleteCell,checkbox:n.CheckboxCell,text:n.TextCell,numeric:n.NumericCell},n.PluginHooks={hooks:{beforeInit:[],afterInit:[],afterLoadData:[],beforeRender:[],afterRender:[],beforeGet:[],beforeSet:[],beforeGetCellMeta:[],afterGetCellMeta:[],afterGetColHeader:[],afterGetColWidth:[],walkontableConfig:[]},push:function(t,e){this.hooks[t].push(e)},unshift:function(t,e){this.hooks[t].unshift(e)},run:function(t,e,n,i,s,o,r){for(var a=0,l=this.hooks[e].length;l>a;a++)this.hooks[e][a].call(t,n,i,s,o,r)}},n.PluginModifiers={modifiers:{col:[]},push:function(t,e){this.modifiers[t].push(e)},unshift:function(t,e){this.modifiers[t].unshift(e)},run:function(t,e,n,i,s,o,r){for(var a=0,l=this.modifiers[e].length;l>a;a++)n=this.modifiers[e][a].call(t,n,i,s,o,r);return n}};var R=new r;n.PluginHooks.push("beforeInit",R.beforeInit),n.PluginHooks.push("beforeRender",R.determineColumnsWidth),n.PluginHooks.push("afterGetColWidth",R.getColWidth);var T=new a;n.PluginHooks.push("afterInit",T.afterInit),n.PluginHooks.push("beforeGet",T.translateRow),n.PluginHooks.push("beforeSet",T.translateRow),n.PluginHooks.push("afterGetColHeader",T.getColHeader),n.PluginHooks.push("afterInit",l),n.PluginHooks.push("beforeGetCellMeta",function(t,e,i){var s,o,r,a=this.getSettings(),l=this.getData();if(a.autoComplete)for(s=0,o=a.autoComplete.length;o>s;s++)if(a.autoComplete[s].match(t,e,l)){i.type===void 0?i.type=n.AutocompleteCell:(i.type.renderer===void 0&&(i.type.renderer=n.AutocompleteCell.renderer),i.type.editor===void 0&&(i.type.editor=n.AutocompleteCell.editor));for(r in a.autoComplete[s])a.autoComplete[s].hasOwnProperty(r)&&"match"!==r&&i[s]===void 0&&(i[r]="source"===r?a.autoComplete[s][r](t,e):a.autoComplete[s][r]);break}}),jQuery.browser||function(){var t,e;jQuery.uaMatch=function(t){t=t.toLowerCase();var e=/(chrome)[ \/]([\w.]+)/.exec(t)||/(webkit)[ \/]([\w.]+)/.exec(t)||/(opera)(?:.*version|)[ \/]([\w.]+)/.exec(t)||/(msie) ([\w.]+)/.exec(t)||0>t.indexOf("compatible")&&/(mozilla)(?:.*? rv:([\w.]+)|)/.exec(t)||[];return{browser:e[1]||"",version:e[2]||"0"}},t=jQuery.uaMatch(navigator.userAgent),e={},t.browser&&(e[t.browser]=!0,e.version=t.version),e.chrome?e.webkit=!0:e.webkit&&(e.safari=!0),jQuery.browser=e}();var E=new c;n.PluginHooks.push("beforeInit",E.beforeInit),n.PluginHooks.push("afterInit",E.afterInit),n.PluginHooks.push("afterGetColHeader",E.getColHeader),n.PluginModifiers.push("col",E.modifyCol);var k=new h;n.PluginHooks.push("beforeInit",k.beforeInit),n.PluginHooks.push("afterInit",k.afterInit),n.PluginHooks.push("afterGetColHeader",k.getColHeader),n.PluginHooks.push("afterGetColWidth",k.getColWidth),function(t){function e(i){return this.filter(e.resizableFilterSelector).each(function(){new n(t(this),i)}),this}function n(n,i){this.clones||(this.config=t.extend({},e.defaults,i),this.el=n,this.nodeName=n[0].nodeName.toLowerCase(),this.previousScrollTop=null,"original"===i.maxWidth&&(i.maxWidth=n.width()),"original"===i.minWidth&&(i.minWidth=n.width()),"original"===i.maxHeight&&(i.maxHeight=n.height()),"original"===i.minHeight&&(i.minHeight=n.height()),"textarea"===this.nodeName&&n.css({resize:"none",overflowY:"hidden"}),n.data("AutoResizer",this),this.createClone(),this.injectClone(),this.bind())}e.defaults={onResize:function(){},animate:{duration:200,complete:function(){}},extraSpace:50,minHeight:"original",maxHeight:500,minWidth:"original",maxWidth:500},e.cloneCSSProperties=["lineHeight","textDecoration","letterSpacing","fontSize","fontFamily","fontStyle","fontWeight","textTransform","textAlign","direction","wordSpacing","fontSizeAdjust","padding"],e.cloneCSSValues={position:"absolute",top:-9999,left:-9999,opacity:0,overflow:"hidden",border:"1px solid black",padding:"0.49em"},e.resizableFilterSelector="textarea,input:not(input[type]),input[type=text],input[type=password]",e.AutoResizer=n,t.fn.autoResize=e,n.prototype={bind:function(){var e=t.proxy(function(){return this.check(),!0},this);this.unbind(),this.el.bind("keyup.autoResize",e).bind("change.autoResize",e),this.check(null,!0)},unbind:function(){this.el.unbind(".autoResize")},createClone:function(){var n=this.el,i=this,s=this.config;this.clones=t(),("original"!==s.minHeight||"original"!==s.maxHeight)&&(this.hClone=n.clone().height("auto"),this.clones=this.clones.add(this.hClone)),("original"!==s.minWidth||"original"!==s.maxWidth)&&(this.wClone=t("
").width("auto").css({whiteSpace:"nowrap","float":"left"}),this.clones=this.clones.add(this.wClone)),t.each(e.cloneCSSProperties,function(t,e){i.clones.css(e,n.css(e))}),this.clones.removeAttr("name").removeAttr("id").attr("tabIndex",-1).css(e.cloneCSSValues)},check:function(t,e){var n=this.config,i=this.wClone,s=this.hClone,o=this.el,r=o.val();if(i){i.text(r);var a=i.outerWidth(),l=a+n.extraSpace>=n.minWidth?a+n.extraSpace:n.minWidth,c=o.width();l=Math.min(l,n.maxWidth),(c>l&&l>=n.minWidth||l>=n.minWidth&&n.maxWidth>=l)&&(n.onResize.call(o),o.scrollLeft(0),n.animate&&!e?o.stop(1,1).animate({width:l},n.animate):o.width(l))}if(s){l&&s.width(l),s.height(0).val(r).scrollTop(1e4);var h=s[0].scrollTop+n.extraSpace;if(this.previousScrollTop===h)return;if(this.previousScrollTop=h,h>=n.maxHeight)return o.css("overflowY",""),void 0;o.css("overflowY","hidden"),n.minHeight>h&&(h=n.minHeight),n.onResize.call(o),n.animate&&!e?o.stop(1,1).animate({height:h},n.animate):o.height(h)}},destroy:function(){this.unbind(),this.el.removeData("AutoResizer"),this.clones.remove(),delete this.el,delete this.hClone,delete this.wClone,delete this.clones},injectClone:function(){(e.cloneContainer||(e.cloneContainer=t("
").appendTo("body"))).empty().append(this.clones)}}}(jQuery),function(t){function e(t){return t.split('"').length-1}t.SheetClip={parse:function(t){var n,i,s,o,r,a,l,c=[],h=0;for(s=t.split("\n"),s.length>1&&""===s[s.length-1]&&s.pop(),n=0,i=s.length;i>n;n+=1){for(s[n]=s[n].split(" "),o=0,r=s[n].length;r>o;o+=1)c[h]||(c[h]=[]),a&&0===o?(l=c[h].length-1,c[h][l]=c[h][l]+"\n"+s[n][0],a&&1===e(s[n][0])%2&&(a=!1,c[h][l]=c[h][l].substring(0,c[h][l].length-1).replace(/""/g,'"'))):o===r-1&&0===s[n][o].indexOf('"')?(c[h].push(s[n][o].substring(1).replace(/""/g,'"')),a=!0):(c[h].push(s[n][o].replace(/""/g,'"')),a=!1);a||(h+=1)}return c},stringify:function(t){var e,n,i,s,o,r="";for(e=0,n=t.length;n>e;e+=1){for(i=0,s=t[e].length;s>i;i+=1)i>0&&(r+=" "),o=t[e][i],r+="string"==typeof o?o.indexOf("\n")>-1?'"'+o.replace(/"/g,'""')+'"':o:null===o||void 0===o?"":o;r+="\n"}return r}}}(e),u.prototype.appear=function(e){var n,i,s,o,r,a,l,c,h,u,d,p;if(!this.disabled){var f=this.instance.getSetting("offsetRow"),g=this.instance.getSetting("offsetColumn"),m=this.instance.getSetting("displayRows"),v=this.instance.getSetting("displayColumns"),w=!1,y=!1,b=!1,C=!1;null!==m&&(e[0]>f+m-1||f>e[2]?w=y=b=C=!0:(f>e[0]&&(e[0]=f,w=!0),e[2]>f+m-1&&(e[2]=f+m-1,b=!0))),null!==v&&(e[1]>g+v-1||g>e[3]?w=y=b=C=!0:(g>e[1]&&(e[1]=g,y=!0),e[3]>g+v-1&&(e[3]=g+v-1,C=!0))),4>w+y+b+C&&(n=e[0]!==e[2]||e[1]!==e[3],i=t(this.instance.wtTable.getCell([e[0],e[1]])),s=n?t(this.instance.wtTable.getCell([e[2],e[3]])):i,o=this.wtDom.offset(i[0]),r=n?this.wtDom.offset(s[0]):o,a=this.wtDom.offset(this.instance.wtTable.TABLE),c=o.top,d=r.top+s.outerHeight()-c,u=o.left,p=r.left+s.outerWidth()-u,l=c-a.top-1,h=u-a.left-1,parseInt(i.css("border-top-width"))>0&&(l+=1,d-=1),parseInt(i.css("border-left-width"))>0&&(h+=1,p-=1)),w?this.top.style.display="none":(this.top.style.top=l+"px",this.top.style.left=h+"px",this.top.style.width=p+"px",this.top.style.display="block"),y?this.left.style.display="none":(this.left.style.top=l+"px",this.left.style.left=h+"px",this.left.style.height=d+"px",this.left.style.display="block");var x=Math.floor(this.settings.border.width/2);b?this.bottom.style.display="none":(this.bottom.style.top=l+d-x+"px",this.bottom.style.left=h+"px",this.bottom.style.width=p+"px",this.bottom.style.display="block"),C?this.right.style.display="none":(this.right.style.top=l+"px",this.right.style.left=h+p-x+"px",this.right.style.height=d+1+"px",this.right.style.display="block"),b&&C||!this.hasSetting(this.settings.border.cornerVisible)?this.corner.style.display="none":(this.corner.style.top=l+d-4+"px",this.corner.style.left=h+p-4+"px",this.corner.style.display="block")}},u.prototype.disappear=function(){this.top.style.display="none",this.left.style.display="none",this.bottom.style.display="none",this.right.style.display="none",this.corner.style.display="none"},u.prototype.hasSetting=function(t){return"function"==typeof t?t():!!t},d.prototype.draw=function(t){if(this.hasSetting("async")){var e=this;e.drawFrame=setTimeout(function(){e._doDraw(t)},0)}else this._doDraw(t);return this},d.prototype._doDraw=function(t){t=t&&this.getSetting("offsetRow")===this.lastOffsetRow&&this.getSetting("offsetColumn")===this.lastOffsetColumn,this.lastOffsetRow=this.getSetting("offsetRow"),this.lastOffsetColumn=this.getSetting("offsetColumn"),this.wtTable.draw(t),this.getSetting("onDraw")},d.prototype.update=function(t,e){return this.wtSettings.update(t,e)},d.prototype.scrollVertical=function(t){return this.wtScroll.scrollVertical(t)},d.prototype.scrollHorizontal=function(t){return this.wtScroll.scrollHorizontal(t)},d.prototype.scrollViewport=function(t){if(this.hasSetting("async")){var e=this;clearTimeout(e.scrollFrame),e.scrollFrame=setTimeout(function(){e.wtScroll.scrollViewport(t)},0)}else this.wtScroll.scrollViewport(t);return this},d.prototype.getViewport=function(){return[this.getSetting("offsetRow"),this.getSetting("offsetColumn"),null!==this.wtTable.visibilityEdgeRow?this.wtTable.visibilityEdgeRow:this.getSetting("totalRows")-1,null!==this.wtTable.visibilityEdgeColumn?this.wtTable.visibilityEdgeColumn:this.getSetting("totalColumns")-1]},d.prototype.getSetting=function(t,e,n,i){return this.wtSettings.getSetting(t,e,n,i)},d.prototype.hasSetting=function(t){return this.wtSettings.has(t)},p.prototype.closest=function(t,e){for(;null!=t;){if(1===t.nodeType&&e.indexOf(t.nodeName)>-1)return t;t=t.parentNode}return null},p.prototype.prevSiblings=function(t){for(var e=[];null!=(t=t.previousSibling);)1===t.nodeType&&e.push(t);return e},p.prototype.tdHasClass=function(t,e,n){return!!(this.tdCache[t]&&this.tdCache[t][e]&&this.tdCache[t][e][n])},p.prototype.tdAddClass=function(t,e,n){this.tdHasClass(t,e,n)||(this.tdCache[t]||(this.tdCache[t]=[]),this.tdCache[t][e]||(this.tdCache[t][e]={},this.tdCache[t][e]._node=this.instance.wtTable.getCell([t+this.instance.getSetting("offsetRow"),e+this.instance.getSetting("offsetColumn")])),this.tdCache[t][e]._node.className+=" "+n,this.tdCache[t][e][n]=!0)},p.prototype.tdRemoveClass=function(t,e,n){if(this.tdHasClass(t,e,n)){var i=RegExp("(\\s|^)"+n+"(\\s|$)");this.tdCache[t][e]._node.className=this.tdCache[t][e]._node.className.replace(i," ").replace(/^\s\s*/,"").replace(/\s\s*$/,""),this.tdCache[t][e][n]=!1}},p.prototype.tdResetCache=function(){for(var t in this.tdCache)if(this.tdCache.hasOwnProperty(t))for(var e in this.tdCache[t])if(this.tdCache[t].hasOwnProperty(e))for(var n in this.tdCache[t][e])this.tdCache[t][e].hasOwnProperty(n)&&"_node"!==n&&(this.tdCache[t][e][n]=!1)},p.prototype.hasClass=function(t,e){return t.className.match(RegExp("(\\s|^)"+e+"(\\s|$)"))},p.prototype.addClass=function(t,e){this.hasClass(t,e)||(t.className+=" "+e)},p.prototype.removeClass=function(t,e){if(this.hasClass(t,e)){var n=RegExp("(\\s|^)"+e+"(\\s|$)");t.className=t.className.replace(n," ").replace(/^\s\s*/,"").replace(/\s\s*$/,"")}},p.prototype.removeTextNodes=function(t,e){if(3===t.nodeType)e.removeChild(t);else if(["TABLE","THEAD","TBODY","TFOOT","TR"].indexOf(t.nodeName)>-1)for(var n=t.childNodes,i=n.length-1;i>=0;i--)this.removeTextNodes(n[i],t)},p.prototype.offset=function(t){for(var e=t.offsetLeft,n=t.offsetTop;t=t.offsetParent;)e+=t.offsetLeft,n+=t.offsetTop;return{left:e,top:n}},f.prototype.parentCell=function(t){var e={};return e.TD=this.wtDom.closest(t,["TD","TH"]),e.TD?e.coords=this.instance.wtTable.getCoords(e.TD):!e.TD&&this.wtDom.hasClass(t,"wtBorder")&&this.wtDom.hasClass(t,"current")&&!this.wtDom.hasClass(t,"corner")&&(e.coords=this.instance.selections.current.selected[0],e.TD=this.instance.wtTable.getCell(e.coords)),e},Array.prototype.indexOf||(Array.prototype.indexOf=function(t){var e=this.length>>>0,n=Number(arguments[1])||0;for(n=0>n?Math.ceil(n):Math.floor(n),0>n&&(n+=e);e>n;n++)if(n in this&&this[n]===t)return n;return-1}),e.requestAnimFrame=function(){return e.requestAnimationFrame||e.webkitRequestAnimationFrame||e.mozRequestAnimationFrame||e.oRequestAnimationFrame||e.msRequestAnimationFrame||function(t){return e.setTimeout(t,1e3/60)}}(),e.cancelRequestAnimFrame=function(){return e.cancelAnimationFrame||e.webkitCancelRequestAnimationFrame||e.mozCancelRequestAnimationFrame||e.oCancelRequestAnimationFrame||e.msCancelRequestAnimationFrame||clearTimeout}(),g.prototype.refreshScrollbars=function(){this.wtScrollbarH.prepare(),this.wtScrollbarV.prepare(),this.instance.wtTable.recalcViewportCells(),this.wtScrollbarH.refresh(),this.wtScrollbarV.refresh()},g.prototype.scrollVertical=function(t){if(!this.instance.drawn)throw Error("scrollVertical can only be called after table was drawn to DOM");var e=this.instance.getSetting("offsetRow"),n=e+t;if(n>0){var i=this.instance.getSetting("totalRows"),s=(this.instance.getSetting("height")||1/0)-this.instance.getSetting("scrollbarHeight");n>=i&&(n=i-1);var o=this.instance.wtTable.TBODY.firstChild.firstChild;"TH"===o.nodeName&&(o=o.nextSibling);for(var r=this.instance.wtDom.offset(o),a=this.instance.wtTable.tableOffset,l=r.top-a.top,c=n;s>l&&i>c;)l+=this.instance.getSetting("rowHeight",c),c++;if(s>l)for(;n>0&&(l+=this.instance.getSetting("rowHeight",n-1),s>l);)n--}else 0>n&&(n=0);return n!==e&&this.instance.update("offsetRow",n),this.instance},g.prototype.scrollHorizontal=function(t){if(!this.instance.drawn)throw Error("scrollHorizontal can only be called after table was drawn to DOM");var e=this.instance.getSetting("offsetColumn"),n=e+t;if(n>0){var i=this.instance.getSetting("totalColumns"),s=this.instance.getSetting("width");n>=i&&(n=i-1);var o=this.instance.wtTable.TBODY.firstChild.firstChild;"TH"===o.nodeName&&(o=o.nextSibling);for(var r=this.instance.wtDom.offset(o),a=this.instance.wtTable.tableOffset,l=r.left-a.left,c=n;s>l&&i>c;)l+=this.instance.getSetting("columnWidth",c),c++;if(s>l)for(;n>0&&(l+=this.instance.getSetting("columnWidth",n-1),s>l);)n--}else 0>n&&(n=0);return n!==e&&this.instance.update("offsetColumn",n),this.instance},g.prototype.scrollViewport=function(t){var e=this.instance.getSetting("offsetRow"),n=this.instance.getSetting("offsetColumn"),i=this.instance.getSetting("viewportRows"),s=this.instance.getSetting("viewportColumns"),o=this.instance.getSetting("totalRows"),r=this.instance.getSetting("totalColumns");if(0>t[0]||t[0]>o-1)throw Error("row "+t[0]+" does not exist");if(0>t[1]||t[1]>r-1)throw Error("column "+t[1]+" does not exist");return i=i||1,s=s||1,o>i&&(t[0]>e+i-1?this.scrollVertical(t[0]-(e+i-1)):e>t[0]?this.scrollVertical(t[0]-e):this.scrollVertical(0)),s>0&&r>s&&(t[1]>n+s-1?this.scrollHorizontal(t[1]-(n+s-1)):n>t[1]?this.scrollHorizontal(t[1]-n):this.scrollHorizontal(0)),this.instance},m.prototype.onScroll=function(t){if(this.instance.drawn){var e="vertical"===this.type?["offsetRow","totalRows","viewportRows","top","height"]:["offsetColumn","totalColumns","viewportColumns","left","width"],n=this.instance.getSetting(e[1]),i=this.instance.getSetting(e[2]);if(n>i){var s=Math.round(parseInt(this.handle.style[e[3]])*n/parseInt(this.slider.style[e[4]]));1===t?"vertical"===this.type?this.instance.scrollVertical(1/0).draw():this.instance.scrollHorizontal(1/0).draw():s!==this.instance.getSetting(e[0])?"vertical"===this.type?this.instance.scrollVertical(s-this.instance.getSetting(e[0])).draw():this.instance.scrollHorizontal(s-this.instance.getSetting(e[0])).draw():this.refresh()}}},m.prototype.getHandleSizeRatio=function(t,e){return e?(t>e&&(t=e),t/e):1},m.prototype.prepare=function(){if(!this.skipRefresh){var t,e;"vertical"===this.type?(t=this.getHandleSizeRatio(this.instance.getSetting("viewportRows"),this.instance.getSetting("totalRows")),e=this.instance.getSetting("scrollV")):(t=this.getHandleSizeRatio(this.instance.getSetting("viewportColumns"),this.instance.getSetting("totalColumns")),e=this.instance.getSetting("scrollH")),this.visible=(1===t||isNaN(t))&&"auto"===e||"none"===e?!1:!0}},m.prototype.refresh=function(){if(!this.skipRefresh){if(!this.visible)return this.slider.style.display="none",void 0;var t,e,n,i,s,o,r=this.$table.outerWidth(),a=this.$table.outerHeight(),l=this.instance.hasSetting("width")?this.instance.getSetting("width"):r,c=this.instance.hasSetting("height")?this.instance.getSetting("height"):a;l&&c&&(this.instance.hasSetting("width")&&this.instance.wtScroll.wtScrollbarV.visible&&(l-=this.instance.getSetting("scrollbarWidth")),l>r+this.instance.getSetting("scrollbarWidth")&&(l=r),this.instance.hasSetting("height")&&this.instance.wtScroll.wtScrollbarH.visible&&(c-=this.instance.getSetting("scrollbarHeight")),c>a+this.instance.getSetting("scrollbarHeight")&&(c=a),"vertical"===this.type?(s=this.instance.getSetting("offsetRow"),o=this.instance.getSetting("totalRows"),t=this.getHandleSizeRatio(this.instance.getSetting("viewportRows"),o),e=c-2,this.slider.style.top=this.$table.position().top+"px",this.slider.style.left=l-1+"px",this.slider.style.height=e+"px"):(s=this.instance.getSetting("offsetColumn"),o=this.instance.getSetting("totalColumns"),t=this.getHandleSizeRatio(this.instance.getSetting("viewportColumns"),o),e=l-2,this.slider.style.left=this.$table.position().left+"px",this.slider.style.top=c-1+"px",this.slider.style.width=e+"px"),n=Math.round(e*t),10>n&&(n=15),i=Math.round(e*(s/o)),i>l-n&&(i=l-n),"vertical"===this.type?(this.handle.style.height=n+"px",this.handle.style.top=i+"px"):(this.handle.style.width=n+"px",this.handle.style.left=i+"px"),this.slider.style.display="block",this.dragdealer.setWrapperOffset(),this.dragdealer.setBounds())}},v.prototype.add=function(t){this.selected.push(t)},v.prototype.remove=function(t){var e=this.isSelected(t);e>-1&&this.selected.splice(e,1)},v.prototype.clear=function(){this.selected.length=0},v.prototype.isSelected=function(t){for(var e=0,n=this.selected.length;n>e;e++)if(this.selected[e][0]===t[0]&&this.selected[e][1]===t[1])return e;return-1},v.prototype.getSelected=function(){return this.selected},v.prototype.getCorners=function(){var t,e,n,i,s,o=this.selected.length;if(o>0&&(t=n=this.selected[0][0],e=i=this.selected[0][1],o>1))for(s=1;o>s;s++)t>this.selected[s][0]?t=this.selected[s][0]:this.selected[s][0]>n&&(n=this.selected[s][0]),e>this.selected[s][1]?e=this.selected[s][1]:this.selected[s][1]>i&&(i=this.selected[s][1]);return[t,e,n,i]},v.prototype.draw=function(t){var e,n,i,s=this.instance.getSetting("offsetRow"),o=s+this.instance.getSetting("displayRows")-1,r=this.instance.getSetting("offsetColumn"),a=r+this.instance.getSetting("displayColumns")-1;if(this.selected.length){for(e=this.getCorners(),n=s;o>=n;n++)for(i=r;a>=i;i++)n>=e[0]&&e[2]>=n&&i>=e[1]&&e[3]>=i?(this.settings.highlightRowClassName&&this.wtDom.tdRemoveClass(n-s,i-r,this.settings.highlightRowClassName),this.settings.highlightColumnClassName&&this.wtDom.tdRemoveClass(n-s,i-r,this.settings.highlightColumnClassName),this.settings.className&&this.wtDom.tdAddClass(n-s,i-r,this.settings.className)):n>=e[0]&&e[2]>=n?(this.settings.highlightColumnClassName&&this.wtDom.tdRemoveClass(n-s,i-r,this.settings.highlightColumnClassName),this.settings.highlightRowClassName&&this.wtDom.tdAddClass(n-s,i-r,this.settings.highlightRowClassName),this.settings.className&&this.wtDom.tdRemoveClass(n-s,i-r,this.settings.className)):i>=e[1]&&e[3]>=i?(this.settings.highlightRowClassName&&this.wtDom.tdRemoveClass(n-s,i-r,this.settings.highlightRowClassName),this.settings.highlightColumnClassName&&this.wtDom.tdAddClass(n-s,i-r,this.settings.highlightColumnClassName),this.settings.className&&this.wtDom.tdRemoveClass(n-s,i-r,this.settings.className)):(this.settings.highlightRowClassName&&this.wtDom.tdRemoveClass(n-s,i-r,this.settings.highlightRowClassName),this.settings.highlightColumnClassName&&this.wtDom.tdRemoveClass(n-s,i-r,this.settings.highlightColumnClassName),this.settings.className&&this.wtDom.tdRemoveClass(n-s,i-r,this.settings.className));this.border&&this.border.appear(e)}else{if(t)for(n=0;o-s>=n;n++)for(i=0;a-r>=i;i++)this.settings.highlightRowClassName&&this.wtDom.tdRemoveClass(n,i,this.settings.highlightRowClassName),this.settings.highlightColumnClassName&&this.wtDom.tdRemoveClass(n,i,this.settings.highlightColumnClassName),this.settings.className&&this.wtDom.tdRemoveClass(n,i,this.settings.className);this.border&&this.border.disappear()}},w.prototype.update=function(t,e){if(void 0===e)for(var n in t)t.hasOwnProperty(n)&&(this.settings[n]=t[n]);else this.settings[t]=e;return this.instance},w.prototype.getSetting=function(t,e,n,i){return this[t]?this[t](e,n,i):this._getSetting(t,e,n,i)},w.prototype._getSetting=function(t,e,n,i){return"function"==typeof this.settings[t]?this.settings[t](e,n,i):void 0!==e&&"[object Array]"===Object.prototype.toString.call(this.settings[t])&&void 0!==e?this.settings[t][e]:this.settings[t]},w.prototype.has=function(t){return!!this.settings[t]},w.prototype.rowHeight=function(t){return this.rowHeightCache[t]!==void 0?this.rowHeightCache[t]:20},w.prototype.columnWidth=function(t){return Math.min(200,this._getSetting("columnWidth",t))},w.prototype.displayRows=function(){var t,e;return this.settings.height?(t=Math.ceil(this.settings.height/20),e=this.getSetting("totalRows")-this.getSetting("offsetRow"),0>e?(this.update("offsetRow",Math.max(0,this.getSetting("totalRows")-t)),t):Math.min(t,e)):this.getSetting("totalRows")},w.prototype.displayColumns=function(){var t,e;return this.settings.width?(t=Math.ceil(this.settings.width/50),e=this.getSetting("totalColumns")-this.getSetting("offsetColumn"),0>e?(this.update("offsetColumn",Math.max(0,this.getSetting("totalColumns")-t)),t):Math.min(t,e)):this.getSetting("totalColumns")},w.prototype.viewportRows=function(){return null!==this.instance.wtTable.visibilityEdgeRow?this.instance.wtTable.visibilityEdgeRow-this.instance.wtTable.visibilityStartRow:this.getSetting("displayRows")},w.prototype.viewportColumns=function(){return null!==this.instance.wtTable.visibilityEdgeColumn?this.instance.wtTable.visibilityEdgeColumn-this.instance.wtTable.visibilityStartColumn:this.getSetting("displayColumns")},y.prototype.refreshHiderDimensions=function(){var t=this.instance.getSetting("height"),e=this.instance.getSetting("width");(t||e)&&(this.hider.style.overflow="hidden"),t&&(this.hider.style.height=this.instance.wtScroll.wtScrollbarH.visible?t-this.instance.getSetting("scrollbarHeight")+"px":t+"px"),e&&(this.hider.style.width=this.instance.wtScroll.wtScrollbarV.visible?e-this.instance.getSetting("scrollbarWidth")+"px":e+"px")},y.prototype.refreshStretching=function(){var t=this.instance.getSetting("stretchH"),e=this.instance.getSetting("totalColumns"),n=this.instance.getSetting("displayColumns"),i=Math.min(n,e),s=this.instance.getSetting("offsetColumn"),o=this.instance.getSetting("frozenColumns"),r=o?o.length:0;if(this.instance.hasSetting("columnWidth")){"hybrid"===t&&(t=this.instance.wtScroll.wtScrollbarH.visible?"last":"none");var a;if(this.instance.wtTable.TBODY.firstChild&&this.instance.wtTable.TBODY.firstChild.firstChild?a=this.instance.wtTable.TBODY.firstChild.firstChild:this.instance.wtTable.THEAD.firstChild&&this.instance.wtTable.THEAD.firstChild.firstChild&&(a=this.instance.wtTable.THEAD.firstChild.firstChild),r&&(a=a.nextSibling),a){var l,c=this.instance.wtDom.offset(a),h=this.instance.wtTable.tableOffset,u=c.left-h.left,d=[],p=0;for(l=0;i>l;l++)d.push(this.instance.getSetting("columnWidth",s+l)),p+=d[l];var f=p+u;if("all"===t||"last"===t){var g=this.instance.getSetting("width");this.instance.wtScroll.wtScrollbarV.visible&&(g-=this.instance.getSetting("scrollbarWidth"));var m=g-f;if(m>0)if("all"===t){var v,w=m,y=m/p;for(l=0;i>l;l++)d[l]&&(l===i-1?v=d[l]+w:(v=d[l]+Math.floor(y*d[l]),w-=Math.floor(y*d[l]))),d[l]=v}else d[d.length-1]&&(d[d.length-1]=d[d.length-1]+m)}for(l=0;i>l;l++)this.COLGROUP.childNodes[l+r].style.width=d[l]?d[l]+"px":""}}},y.prototype.adjustAvailableNodes=function(){var t,e,n,i=this.instance.getSetting("totalRows"),s=this.instance.getSetting("totalColumns"),o=this.instance.getSetting("displayRows"),r=this.instance.getSetting("displayColumns"),a=this.instance.getSetting("frozenColumns"),l=a?a.length:0;for(o=Math.min(o,i),t=Math.min(r,s);t+l>this.colgroupChildrenLength;)this.COLGROUP.appendChild(document.createElement("COL")),this.colgroupChildrenLength++;for(;this.colgroupChildrenLength>t+l;)this.COLGROUP.removeChild(this.COLGROUP.lastChild),this.colgroupChildrenLength--;if(this.instance.hasSetting("columnHeaders")){for(;t+l>this.theadChildrenLength;)this.THEAD.firstChild.appendChild(document.createElement("TH")),this.theadChildrenLength++;for(;this.theadChildrenLength>t+l;)this.THEAD.firstChild.removeChild(this.THEAD.firstChild.lastChild),this.theadChildrenLength--}for(;o>this.tbodyChildrenLength;){for(e=document.createElement("TR"),n=0;l>n;n++)e.appendChild(document.createElement("TH"));this.TBODY.appendChild(e),this.tbodyChildrenLength++}for(;this.tbodyChildrenLength>o;)this.TBODY.removeChild(this.TBODY.lastChild),this.tbodyChildrenLength--;for(var c,h=this.TBODY.childNodes,u=0,d=h.length;d>u;u++){for(c=h[u].childNodes.length;t+l>c;){var p=document.createElement("TD");p.setAttribute("tabindex",1e4),h[u].appendChild(p),c++}for(;c>t+l;)h[u].removeChild(h[u].lastChild),c--}},y.prototype.draw=function(t){if(t||(this.tableOffset=this.wtDom.offset(this.TABLE),this.adjustAvailableNodes(),this._doDraw()),this.instance.hasSetting("async")){var n=this;e.cancelRequestAnimFrame(this.selectionsFrame),n.selectionsFrame=e.requestAnimFrame(function(){n.refreshPositions(t)})}else this.refreshPositions(t);return this.instance.drawn=!0,this},y.prototype._doDraw=function(){var t,e,n,i,s,o,r,a=this.instance.getSetting("offsetRow"),l=this.instance.getSetting("offsetColumn"),c=this.instance.getSetting("totalRows"),h=this.instance.getSetting("totalColumns"),u=this.instance.getSetting("displayRows"),d=this.instance.getSetting("displayColumns"),p=this.instance.getSetting("frozenColumns"),f=p?p.length:0;for(u=Math.min(u,c),n=Math.min(d,h),e=0;this.colgroupChildrenLength>e;e++)f>e?(this.wtDom.addClass(this.COLGROUP.childNodes[e],"rowHeader"),"function"==typeof p[e]&&p[e](null,this.COLGROUP.childNodes[e])):this.wtDom.removeClass(this.COLGROUP.childNodes[e],"rowHeader");if(this.refreshStretching(),f&&this.instance.hasSetting("columnHeaders"))for(e=0;f>e;e++)s=this.THEAD.childNodes[0].childNodes[e],"function"==typeof p[e]?p[e](null,s):s.innerHTML="",this.hasEmptyCellProblem&&""===s.innerHTML&&(s.innerHTML=" ");if(this.instance.hasSetting("columnHeaders"))for(e=0;n>e;e++)this.instance.getSetting("columnHeaders",l+e,this.THEAD.childNodes[0].childNodes[f+e]);for(this.visibilityEdgeRow=this.visibilityEdgeColumn=null,this.visibilityStartRow=a,this.visibilityStartColumn=l,t=0;u>t;t++){for(i=this.TBODY.childNodes[t],e=0;f>e;e++)s=i.childNodes[e],r="function"==typeof p[e]?p[e](a+t,s):p[e],void 0!==r&&(s.innerHTML=r);var g=null,m=null;for(this.wtDom.tdResetCache(),e=0;n>e&&!(null!==this.visibilityEdgeColumn&&l+e>this.visibilityEdgeColumn);e++){o=i.childNodes[e+f],o.className="",this.instance.getSetting("cellRenderer",a+t,l+e,o),this.hasEmptyCellProblem&&""===o.innerHTML&&(o.innerHTML=" ");var v=this.isCellVisible(a+t,l+e,o);null===this.visibilityEdgeColumn&&v&D?m=l+e:null===this.visibilityEdgeColumn&&v&H&&(this.visibilityEdgeColumn=l+e),null===this.visibilityEdgeRow&&v&M?g=a+t:null===this.visibilityEdgeRow&&v&$&&(this.visibilityEdgeRow=a+t)}}null===this.visibilityEdgeRow&&(this.visibilityEdgeRow=g+1),null===this.visibilityEdgeColumn&&(this.visibilityEdgeColumn=m+1)},y.prototype.refreshPositions=function(t){this.instance.wtScroll.refreshScrollbars(),this.refreshHiderDimensions(),this.refreshStretching(),this.refreshSelections(t)},y.prototype.refreshSelections=function(t){var e;if(this.instance.selections)for(e in this.instance.selections)this.instance.selections.hasOwnProperty(e)&&this.instance.selections[e].draw(t)},y.prototype.recalcViewportCells=function(){this.instance.wtScroll.wtScrollbarV.visible&&this.visibilityEdgeColumnRemainder<=this.instance.getSetting("scrollbarWidth")&&(this.visibilityEdgeColumn--,this.visibilityEdgeColumnRemainder=1/0),this.instance.wtScroll.wtScrollbarH.visible&&this.visibilityEdgeRowRemainder<=this.instance.getSetting("scrollbarHeight")&&(this.visibilityEdgeRow--,this.visibilityEdgeRowRemainder=1/0)};var D=1,M=2,H=4,$=8,A=22,P=50;y.prototype.isCellVisible=function(e,n,i){var s=0,o=(this.instance.getSetting("scrollV"),this.instance.getSetting("scrollH"),this.wtDom.offset(i)),r=this.tableOffset,a=o.top-r.top,l=o.left-r.left,c=t(i),h=c.outerWidth(),u=c.outerHeight(),d=this.instance.hasSetting("width")?this.instance.getSetting("width"):1/0,p=this.instance.hasSetting("height")?this.instance.getSetting("height"):1/0;return this.instance.wtSettings.rowHeightCache[e]=u,a>p?s|=P:a+u>p?(this.visibilityEdgeRowRemainder=p-a,s|=$):s|=M,l>d?s|=A:l+h>d?(this.visibilityEdgeColumnRemainder=d-l,s|=H):s|=D,s},y.prototype.getCell=function(t){var e=this.instance.getSetting("offsetRow");if(e>t[0])return-1;if(t[0]>e+this.instance.getSetting("displayRows")-1)return-2;var n=this.instance.getSetting("offsetColumn");if(n>t[1])return-3;if(t[1]>n+this.instance.getSetting("displayColumns")-1)return-4;var i=this.instance.getSetting("frozenColumns"),s=i?i.length:0;return this.TBODY.childNodes[t[0]-e].childNodes[t[1]-n+s]},y.prototype.getCoords=function(t){var e=this.instance.getSetting("frozenColumns"),n=e?e.length:0;return[this.wtDom.prevSiblings(t.parentNode).length+this.instance.getSetting("offsetRow"),t.cellIndex+this.instance.getSetting("offsetColumn")-n]};var O={x:0,y:0,init:function(){this.setEvent("mouse"),this.setEvent("touch")},setEvent:function(t){var e=document["on"+t+"move"]||function(){};document["on"+t+"move"]=function(t){e(t),O.refresh(t)}},refresh:function(t){t||(t=e.event),"mousemove"==t.type?this.set(t):t.touches&&this.set(t.touches[0])},set:function(t){t.pageX||t.pageY?(this.x=t.pageX,this.y=t.pageY):(t.clientX||t.clientY)&&(this.x=t.clientX+document.body.scrollLeft+document.documentElement.scrollLeft,this.y=t.clientY+document.body.scrollTop+document.documentElement.scrollTop)}};O.init();var N={get:function(t){var e=0,n=0;if(t.offsetParent)do n+=t.offsetLeft,e+=t.offsetTop;while(t=t.offsetParent);return[n,e]}},L=function(t,e){if("string"==typeof t&&(t=document.getElementById(t)),t){var n=t.getElementsByTagName("div")[0];n&&-1!=n.className.search(/(^|\s)handle(\s|$)/)&&(this.init(t,n,e||{}),this.setup())}};L.prototype={init:function(t,e,n){this.wrapper=t,this.handle=e,this.options=n,this.disabled=this.getOption("disabled",!1),this.horizontal=this.getOption("horizontal",!0),this.vertical=this.getOption("vertical",!1),this.slide=this.getOption("slide",!0),this.steps=this.getOption("steps",0),this.snap=this.getOption("snap",!1),this.loose=this.getOption("loose",!1),this.speed=this.getOption("speed",10)/100,this.xPrecision=this.getOption("xPrecision",0),this.yPrecision=this.getOption("yPrecision",0),this.callback=n.callback||null,this.animationCallback=n.animationCallback||null,this.bounds={left:n.left||0,right:-(n.right||0),top:n.top||0,bottom:-(n.bottom||0),x0:0,x1:0,xRange:0,y0:0,y1:0,yRange:0},this.value={prev:[-1,-1],current:[n.x||0,n.y||0],target:[n.x||0,n.y||0]},this.offset={wrapper:[0,0],mouse:[0,0],prev:[-999999,-999999],current:[0,0],target:[0,0]},this.change=[0,0],this.activity=!1,this.dragging=!1,this.tapping=!1
-},getOption:function(t,e){return void 0!==this.options[t]?this.options[t]:e},setup:function(){this.setWrapperOffset(),this.setBoundsPadding(),this.setBounds(),this.setSteps(),this.addListeners()},setWrapperOffset:function(){this.offset.wrapper=N.get(this.wrapper)},setBoundsPadding:function(){this.bounds.left||this.bounds.right||(this.bounds.left=N.get(this.handle)[0]-this.offset.wrapper[0],this.bounds.right=-this.bounds.left),this.bounds.top||this.bounds.bottom||(this.bounds.top=N.get(this.handle)[1]-this.offset.wrapper[1],this.bounds.bottom=-this.bounds.top)},setBounds:function(){this.bounds.x0=this.bounds.left,this.bounds.x1=this.wrapper.offsetWidth+this.bounds.right,this.bounds.xRange=this.bounds.x1-this.bounds.x0-this.handle.offsetWidth,this.bounds.y0=this.bounds.top,this.bounds.y1=this.wrapper.offsetHeight+this.bounds.bottom,this.bounds.yRange=this.bounds.y1-this.bounds.y0-this.handle.offsetHeight,this.bounds.xStep=1/(this.xPrecision||Math.max(this.wrapper.offsetWidth,this.handle.offsetWidth)),this.bounds.yStep=1/(this.yPrecision||Math.max(this.wrapper.offsetHeight,this.handle.offsetHeight))},setSteps:function(){if(this.steps>1){this.stepRatios=[];for(var t=0;this.steps-1>=t;t++)this.stepRatios[t]=t/(this.steps-1)}},addListeners:function(){var t=this;this.wrapper.onselectstart=function(){return!1},this.handle.onmousedown=this.handle.ontouchstart=function(e){t.handleDownHandler(e)},this.wrapper.onmousedown=this.wrapper.ontouchstart=function(e){t.wrapperDownHandler(e)};var n=document.onmouseup||function(){};document.onmouseup=function(e){n(e),t.documentUpHandler(e)};var i=document.ontouchend||function(){};document.ontouchend=function(e){i(e),t.documentUpHandler(e)};var s=e.onresize||function(){};e.onresize=function(e){s(e),t.documentResizeHandler(e)},this.wrapper.onmousemove=function(){t.activity=!0},this.wrapper.onclick=function(){return!t.activity},this.interval=setInterval(function(){t.animate()},25),t.animate(!1,!0)},handleDownHandler:function(t){this.activity=!1,O.refresh(t),this.preventDefaults(t,!0),this.startDrag(),this.cancelEvent(t)},wrapperDownHandler:function(t){O.refresh(t),this.preventDefaults(t,!0),this.startTap()},documentUpHandler:function(){this.stopDrag(),this.stopTap()},documentResizeHandler:function(){this.setWrapperOffset(),this.setBounds(),this.update()},enable:function(){this.disabled=!1,this.handle.className=this.handle.className.replace(/\s?disabled/g,"")},disable:function(){this.disabled=!0,this.handle.className+=" disabled"},setStep:function(t,e,n){this.setValue(this.steps&&t>1?(t-1)/(this.steps-1):0,this.steps&&e>1?(e-1)/(this.steps-1):0,n)},setValue:function(t,e,n){this.setTargetValue([t,e||0]),n&&this.groupCopy(this.value.current,this.value.target)},startTap:function(t){this.disabled||(this.tapping=!0,void 0===t&&(t=[O.x-this.offset.wrapper[0]-this.handle.offsetWidth/2,O.y-this.offset.wrapper[1]-this.handle.offsetHeight/2]),this.setTargetOffset(t))},stopTap:function(){!this.disabled&&this.tapping&&(this.tapping=!1,this.setTargetValue(this.value.current),this.result())},startDrag:function(){this.disabled||(this.offset.mouse=[O.x-N.get(this.handle)[0],O.y-N.get(this.handle)[1]],this.dragging=!0)},stopDrag:function(){if(!this.disabled&&this.dragging){this.dragging=!1;var t=this.groupClone(this.value.current);if(this.slide){var e=this.change;t[0]+=4*e[0],t[1]+=4*e[1]}this.setTargetValue(t),this.result()}},feedback:function(){var t=this.value.current;this.snap&&this.steps>1&&(t=this.getClosestSteps(t)),this.groupCompare(t,this.value.prev)||("function"==typeof this.animationCallback&&this.animationCallback(t[0],t[1]),this.groupCopy(this.value.prev,t))},result:function(){"function"==typeof this.callback&&this.callback(this.value.target[0],this.value.target[1])},animate:function(t,e){if(!t||this.dragging){if(this.dragging){var n=this.groupClone(this.value.target),i=[O.x-this.offset.wrapper[0]-this.offset.mouse[0],O.y-this.offset.wrapper[1]-this.offset.mouse[1]];this.setTargetOffset(i,this.loose),this.change=[this.value.target[0]-n[0],this.value.target[1]-n[1]]}(this.dragging||e)&&this.groupCopy(this.value.current,this.value.target),(this.dragging||this.glide()||e)&&(this.update(),this.feedback())}},glide:function(){var t=[this.value.target[0]-this.value.current[0],this.value.target[1]-this.value.current[1]];return t[0]||t[1]?(Math.abs(t[0])>this.bounds.xStep||Math.abs(t[1])>this.bounds.yStep?(this.value.current[0]+=t[0]*this.speed,this.value.current[1]+=t[1]*this.speed):this.groupCopy(this.value.current,this.value.target),!0):!1},update:function(){this.offset.current=this.snap?this.getOffsetsByRatios(this.getClosestSteps(this.value.current)):this.getOffsetsByRatios(this.value.current),this.show()},show:function(){this.groupCompare(this.offset.current,this.offset.prev)||(this.horizontal&&(this.handle.style.left=this.offset.current[0]+""+"px"),this.vertical&&(this.handle.style.top=this.offset.current[1]+""+"px"),this.groupCopy(this.offset.prev,this.offset.current))},setTargetValue:function(t,e){var n=e?this.getLooseValue(t):this.getProperValue(t);this.groupCopy(this.value.target,n),this.offset.target=this.getOffsetsByRatios(n)},setTargetOffset:function(t,e){var n=this.getRatiosByOffsets(t),i=e?this.getLooseValue(n):this.getProperValue(n);this.groupCopy(this.value.target,i),this.offset.target=this.getOffsetsByRatios(i)},getLooseValue:function(t){var e=this.getProperValue(t);return[e[0]+(t[0]-e[0])/4,e[1]+(t[1]-e[1])/4]},getProperValue:function(t){var e=this.groupClone(t);return e[0]=Math.max(e[0],0),e[1]=Math.max(e[1],0),e[0]=Math.min(e[0],1),e[1]=Math.min(e[1],1),(!this.dragging&&!this.tapping||this.snap)&&this.steps>1&&(e=this.getClosestSteps(e)),e},getRatiosByOffsets:function(t){return[this.getRatioByOffset(t[0],this.bounds.xRange,this.bounds.x0),this.getRatioByOffset(t[1],this.bounds.yRange,this.bounds.y0)]},getRatioByOffset:function(t,e,n){return e?(t-n)/e:0},getOffsetsByRatios:function(t){return[this.getOffsetByRatio(t[0],this.bounds.xRange,this.bounds.x0),this.getOffsetByRatio(t[1],this.bounds.yRange,this.bounds.y0)]},getOffsetByRatio:function(t,e,n){return Math.round(t*e)+n},getClosestSteps:function(t){return[this.getClosestStep(t[0]),this.getClosestStep(t[1])]},getClosestStep:function(t){for(var e=0,n=1,i=0;this.steps-1>=i;i++)n>Math.abs(this.stepRatios[i]-t)&&(n=Math.abs(this.stepRatios[i]-t),e=i);return this.stepRatios[e]},groupCompare:function(t,e){return t[0]==e[0]&&t[1]==e[1]},groupCopy:function(t,e){t[0]=e[0],t[1]=e[1]},groupClone:function(t){return[t[0],t[1]]},preventDefaults:function(t,n){t||(t=e.event),t.preventDefault&&t.preventDefault(),t.returnValue=!1,n&&document.selection&&document.selection.empty()},cancelEvent:function(t){t||(t=e.event),t.stopPropagation&&t.stopPropagation(),t.cancelBubble=!0}},function(t){function n(n){var i=n||e.event,s=[].slice.call(arguments,1),o=0,r=0,a=0;return n=t.event.fix(i),n.type="mousewheel",i.wheelDelta&&(o=i.wheelDelta/120),i.detail&&(o=-i.detail/3),a=o,void 0!==i.axis&&i.axis===i.HORIZONTAL_AXIS&&(a=0,r=-1*o),void 0!==i.wheelDeltaY&&(a=i.wheelDeltaY/120),void 0!==i.wheelDeltaX&&(r=-1*i.wheelDeltaX/120),s.unshift(n,o,r,a),(t.event.dispatch||t.event.handle).apply(this,s)}var i=["DOMMouseScroll","mousewheel"];if(t.event.fixHooks)for(var s=i.length;s;)t.event.fixHooks[i[--s]]=t.event.mouseHooks;t.event.special.mousewheel={setup:function(){if(this.addEventListener)for(var t=i.length;t;)this.addEventListener(i[--t],n,!1);else this.onmousewheel=n},teardown:function(){if(this.removeEventListener)for(var t=i.length;t;)this.removeEventListener(i[--t],n,!1);else this.onmousewheel=null}},t.fn.extend({mousewheel:function(t){return t?this.bind("mousewheel",t):this.trigger("mousewheel")},unmousewheel:function(t){return this.unbind("mousewheel",t)}})}(jQuery),C.prototype.selectNodeText=function(){this.elTextarea.select()},C.prototype.copyable=function(t){if("string"!=typeof t&&void 0===t.toString)throw Error("copyable requires string parameter");this.elTextarea.value=t},C.prototype.onCopy=function(t){this.copyCallback=t},C.prototype.onCut=function(t){this.cutCallback=t},C.prototype.onPaste=function(t){this.pasteCallback=t},C.prototype.triggerCut=function(t){var e=this;e.cutCallback&&setTimeout(function(){e.cutCallback(t)},0)},C.prototype.triggerPaste=function(t,e){var n=this;n.pasteCallback&&setTimeout(function(){n.pasteCallback((e||n.elTextarea.value).replace(/\n$/,""),t)},0)},C.prototype._bindEvent=function(){return document.addEventListener?function(t,e,n){t.addEventListener(e,n,!1)}:function(t,n,i){t.attachEvent("on"+n,function(){var n=e.event;return n.target=n.srcElement,n.relatedTarget=n.relatedTarget||"mouseover"==n.type?n.fromElement:n.toElement,3===n.target.nodeType&&(n.target=n.target.parentNode),i.call(t,n)})}}()})(jQuery,window,Handsontable),!function(t){"use strict";var e=function(e,n){this.$element=t(e),this.options=t.extend({},t.fn.typeahead.defaults,n),this.matcher=this.options.matcher||this.matcher,this.sorter=this.options.sorter||this.sorter,this.highlighter=this.options.highlighter||this.highlighter,this.updater=this.options.updater||this.updater,this.source=this.options.source,this.$menu=t(this.options.menu),this.shown=!1,this.listen()};e.prototype={constructor:e,select:function(){var t=this.$menu.find(".active").attr("data-value");return this.$element.val(this.updater(t)).change(),this.hide()},updater:function(t){return t},show:function(){var e=t.extend({},this.$element.position(),{height:this.$element[0].offsetHeight});return this.$menu.insertAfter(this.$element).css({top:e.top+e.height,left:e.left}).show(),this.shown=!0,this},hide:function(){return this.$menu.hide(),this.shown=!1,this},lookup:function(){var e;return this.query=this.$element.val(),!this.query||this.query.length
"+e+""})},render:function(e){var n=this;return e=t(e).map(function(e,i){return e=t(n.options.item).attr("data-value",i),e.find("a").html(n.highlighter(i)),e[0]}),e.first().addClass("active"),this.$menu.html(e),this},next:function(){var e=this.$menu.find(".active").removeClass("active"),n=e.next();n.length||(n=t(this.$menu.find("li")[0])),n.addClass("active")},prev:function(){var t=this.$menu.find(".active").removeClass("active"),e=t.prev();e.length||(e=this.$menu.find("li").last()),e.addClass("active")},listen:function(){this.$element.on("focus",t.proxy(this.focus,this)).on("blur",t.proxy(this.blur,this)).on("keypress",t.proxy(this.keypress,this)).on("keyup",t.proxy(this.keyup,this)),this.eventSupported("keydown")&&this.$element.on("keydown",t.proxy(this.keydown,this)),this.$menu.on("click",t.proxy(this.click,this)).on("mouseenter","li",t.proxy(this.mouseenter,this)).on("mouseleave","li",t.proxy(this.mouseleave,this))},eventSupported:function(t){var e=t in this.$element;return e||(this.$element.setAttribute(t,"return;"),e="function"==typeof this.$element[t]),e},move:function(t){if(this.shown){switch(t.keyCode){case 9:case 13:case 27:t.preventDefault();break;case 38:t.preventDefault(),this.prev();break;case 40:t.preventDefault(),this.next()}t.stopPropagation()}},keydown:function(e){this.suppressKeyPressRepeat=~t.inArray(e.keyCode,[40,38,9,13,27]),this.move(e)},keypress:function(t){this.suppressKeyPressRepeat||this.move(t)},keyup:function(t){switch(t.keyCode){case 40:case 38:case 16:case 17:case 18:break;case 9:case 13:if(!this.shown)return;this.select();break;case 27:if(!this.shown)return;this.hide();break;default:this.lookup()}t.stopPropagation(),t.preventDefault()},focus:function(){this.focused=!0},blur:function(){this.focused=!1,!this.mousedover&&this.shown&&this.hide()},click:function(t){t.stopPropagation(),t.preventDefault(),this.select(),this.$element.focus()},mouseenter:function(e){this.mousedover=!0,this.$menu.find(".active").removeClass("active"),t(e.currentTarget).addClass("active")},mouseleave:function(){this.mousedover=!1,!this.focused&&this.shown&&this.hide()}};var n=t.fn.typeahead;t.fn.typeahead=function(n){return this.each(function(){var i=t(this),s=i.data("typeahead"),o="object"==typeof n&&n;s||i.data("typeahead",s=new e(this,o)),"string"==typeof n&&s[n]()})},t.fn.typeahead.defaults={source:[],items:8,menu:'',item:'',minLength:1},t.fn.typeahead.Constructor=e,t.fn.typeahead.noConflict=function(){return t.fn.typeahead=n,this},t(document).on("focus.typeahead.data-api",'[data-provide="typeahead"]',function(){var e=t(this);e.data("typeahead")||e.typeahead(e.data())})}(window.jQuery),function(){function t(t){this._n=t}function e(t,e,n){var i,s=Math.pow(10,e);if(i=(Math.round(t*s)/s).toFixed(e),n){var o=RegExp("0{1,"+n+"}$");i=i.replace(o,"")}return i}function n(t,e){var n;return n=e.indexOf("$")>-1?s(t,e):e.indexOf("%")>-1?o(t,e):e.indexOf(":")>-1?r(t,e):l(t,e)}function i(t,e){if(e.indexOf(":")>-1)t._n=a(e);else if(e===f)t._n=0;else{var n=e;"."!==d[p].delimiters.decimal&&(e=e.replace(/\./g,"").replace(d[p].delimiters.decimal,"."));for(var i=RegExp(d[p].abbreviations.thousand+"(?:\\)|(\\"+d[p].currency.symbol+")?(?:\\))?)?$"),s=RegExp(d[p].abbreviations.million+"(?:\\)|(\\"+d[p].currency.symbol+")?(?:\\))?)?$"),o=RegExp(d[p].abbreviations.billion+"(?:\\)|(\\"+d[p].currency.symbol+")?(?:\\))?)?$"),r=RegExp(d[p].abbreviations.trillion+"(?:\\)|(\\"+d[p].currency.symbol+")?(?:\\))?)?$"),l=["KB","MB","GB","TB","PB","EB","ZB","YB"],c=!1,h=0;l.length>=h&&!(c=e.indexOf(l[h])>-1?Math.pow(1024,h+1):!1);h++);t._n=(c?c:1)*(n.match(i)?Math.pow(10,3):1)*(n.match(s)?Math.pow(10,6):1)*(n.match(o)?Math.pow(10,9):1)*(n.match(r)?Math.pow(10,12):1)*(e.indexOf("%")>-1?.01:1)*Number((e.indexOf("(")>-1?"-":"")+e.replace(/[^0-9\.-]+/g,"")),t._n=c?Math.ceil(t._n):t._n}return t._n}function s(t,e){var i=1>=e.indexOf("$")?!0:!1,s="";e.indexOf(" $")>-1?(s=" ",e=e.replace(" $","")):e.indexOf("$ ")>-1?(s=" ",e=e.replace("$ ","")):e=e.replace("$","");var o=n(t,e);return i?o.indexOf("(")>-1||o.indexOf("-")>-1?(o=o.split(""),o.splice(1,0,d[p].currency.symbol+s),o=o.join("")):o=d[p].currency.symbol+s+o:o.indexOf(")")>-1?(o=o.split(""),o.splice(-1,0,s+d[p].currency.symbol),o=o.join("")):o=o+s+d[p].currency.symbol,o}function o(t,e){var i="";e.indexOf(" %")>-1?(i=" ",e=e.replace(" %","")):e=e.replace("%",""),t._n=100*t._n;var s=n(t,e);return s.indexOf(")")>-1?(s=s.split(""),s.splice(-1,0,i+"%"),s=s.join("")):s=s+i+"%",s}function r(t){var e=Math.floor(t._n/60/60),n=Math.floor((t._n-60*60*e)/60),i=Math.round(t._n-60*60*e-60*n);return e+":"+(10>n?"0"+n:n)+":"+(10>i?"0"+i:i)}function a(t){var e=t.split(":"),n=0;return 3===e.length?(n+=60*60*Number(e[0]),n+=60*Number(e[1]),n+=Number(e[2])):2===e.lenght&&(n+=60*Number(e[0]),n+=Number(e[1])),Number(n)}function l(t,n){var i=!1,s=!1,o="",r="",a="",l=Math.abs(t._n);if(0===t._n&&null!==f)return f;if(n.indexOf("(")>-1&&(i=!0,n=n.slice(1,-1)),n.indexOf("a")>-1&&(n.indexOf(" a")>-1?(o=" ",n=n.replace(" a","")):n=n.replace("a",""),l>=Math.pow(10,12)?(o+=d[p].abbreviations.trillion,t._n=t._n/Math.pow(10,12)):Math.pow(10,12)>l&&l>=Math.pow(10,9)?(o+=d[p].abbreviations.billion,t._n=t._n/Math.pow(10,9)):Math.pow(10,9)>l&&l>=Math.pow(10,6)?(o+=d[p].abbreviations.million,t._n=t._n/Math.pow(10,6)):Math.pow(10,6)>l&&l>=Math.pow(10,3)&&(o+=d[p].abbreviations.thousand,t._n=t._n/Math.pow(10,3))),n.indexOf("b")>-1){n.indexOf(" b")>-1?(r=" ",n=n.replace(" b","")):n=n.replace("b","");for(var c,h,u=["B","KB","MB","GB","TB","PB","EB","ZB","YB"],g=0;u.length>=g;g++)if(c=Math.pow(1024,g),h=Math.pow(1024,g+1),t._n>=c&&h>t._n){r+=u[g],c>0&&(t._n=t._n/c);break}}n.indexOf("o")>-1&&(n.indexOf(" o")>-1?(a=" ",n=n.replace(" o","")):n=n.replace("o",""),a+=d[p].ordinal(t._n)),n.indexOf("[.]")>-1&&(s=!0,n=n.replace("[.]","."));var m=(""+t._n).split(".")[0],v=n.split(".")[1],w=n.indexOf(","),y="",b=!1;return v?(v.indexOf("[")>-1?(v=v.replace("]",""),v=v.split("["),y=e(t._n,v[0].length+v[1].length,v[1].length)):y=e(t._n,v.length),m=y.split(".")[0],y=y.split(".")[1].length?d[p].delimiters.decimal+y.split(".")[1]:"",s&&0===Number(y)&&(y="")):m=e(t._n,null),m.indexOf("-")>-1&&(m=m.slice(1),b=!0),w>-1&&(m=(""+m).replace(/(\d)(?=(\d{3})+(?!\d))/g,"$1"+d[p].delimiters.thousands)),0===n.indexOf(".")&&(m=""),(i&&b?"(":"")+(!i&&b?"-":"")+m+y+(a?a:"")+(o?o:"")+(r?r:"")+(i&&b?")":"")}function c(t,e){d[t]=e}var h,u="1.4.7",d={},p="en",f=null,g="undefined"!=typeof module&&module.exports;h=function(e){return h.isNumeral(e)?e=e.value():Number(e)||(e=0),new t(Number(e))},h.version=u,h.isNumeral=function(e){return e instanceof t},h.language=function(t,e){return t?(t&&!e&&(p=t),(e||!d[t])&&c(t,e),h):p},h.language("en",{delimiters:{thousands:",",decimal:"."},abbreviations:{thousand:"k",million:"m",billion:"b",trillion:"t"},ordinal:function(t){var e=t%10;return 1===~~(t%100/10)?"th":1===e?"st":2===e?"nd":3===e?"rd":"th"},currency:{symbol:"$"}}),h.zeroFormat=function(t){f="string"==typeof t?t:null},h.fn=t.prototype={clone:function(){return h(this)},format:function(t){return n(this,t?t:h.defaultFormat)},unformat:function(t){return i(this,t?t:h.defaultFormat)},value:function(){return this._n},valueOf:function(){return this._n},set:function(t){return this._n=Number(t),this},add:function(t){return this._n=this._n+Number(t),this},subtract:function(t){return this._n=this._n-Number(t),this},multiply:function(t){return this._n=this._n*Number(t),this},divide:function(t){return this._n=this._n/Number(t),this},difference:function(t){var e=this._n-Number(t);return 0>e&&(e=-e),e}},g&&(module.exports=h),"undefined"==typeof ender&&(this.numeral=h),"function"==typeof define&&define.amd&&define([],function(){return h})}.call(this),function(t,e){function n(t){for(var e,n=t.split(/\s+/),i=[],s=0;e=n[s];s++)e=e[0].toUpperCase(),i.push(e);return i}function i(e){return e.id&&t('label[for="'+e.id+'"]').val()||e.name}function s(n,o,r){return r||(r=0),o.each(function(){var o,a,l=t(this),c=this,h=this.nodeName.toLowerCase();switch("label"==h&&l.find("input, textarea, select").length&&(o=l.text(),l=l.children().first(),c=l.get(0),h=c.nodeName.toLowerCase()),h){case"menu":a={name:l.attr("label"),items:{}},r=s(a.items,l.children(),r);break;case"a":case"button":a={name:l.text(),disabled:!!l.attr("disabled"),callback:function(){return function(){l.click()}}()};break;case"menuitem":case"command":switch(l.attr("type")){case e:case"command":case"menuitem":a={name:l.attr("label"),disabled:!!l.attr("disabled"),callback:function(){return function(){l.click()}}()};break;case"checkbox":a={type:"checkbox",disabled:!!l.attr("disabled"),name:l.attr("label"),selected:!!l.attr("checked")};break;case"radio":a={type:"radio",disabled:!!l.attr("disabled"),name:l.attr("label"),radio:l.attr("radiogroup"),value:l.attr("id"),selected:!!l.attr("checked")};break;default:a=e}break;case"hr":a="-------";break;case"input":switch(l.attr("type")){case"text":a={type:"text",name:o||i(c),disabled:!!l.attr("disabled"),value:l.val()};break;case"checkbox":a={type:"checkbox",name:o||i(c),disabled:!!l.attr("disabled"),selected:!!l.attr("checked")};break;case"radio":a={type:"radio",name:o||i(c),disabled:!!l.attr("disabled"),radio:!!l.attr("name"),value:l.val(),selected:!!l.attr("checked")};break;default:a=e}break;case"select":a={type:"select",name:o||i(c),disabled:!!l.attr("disabled"),selected:l.val(),options:{}},l.children().each(function(){a.options[this.value]=t(this).text()});break;case"textarea":a={type:"textarea",name:o||i(c),disabled:!!l.attr("disabled"),value:l.val()};break;case"label":break;default:a={type:"html",html:l.clone(!0)}}a&&(r++,n["key"+r]=a)}),r}t.support.htmlMenuitem="HTMLMenuItemElement"in window,t.support.htmlCommand="HTMLCommandElement"in window,t.support.eventSelectstart="onselectstart"in document.documentElement;var o=null,r=!1,a=t(window),l=0,c={},h={},u={},d={selector:null,appendTo:null,trigger:"right",autoHide:!1,delay:200,determinePosition:function(e){if(t.ui&&t.ui.position)e.css("display","block").position({my:"center top",at:"center bottom",of:this,offset:"0 5",collision:"fit"}).css("display","none");else{var n=this.offset();n.top+=this.outerHeight(),n.left+=this.outerWidth()/2-e.outerWidth()/2,e.css(n)}},position:function(n,i,s){var o;if(!i&&!s)return n.determinePosition.call(this,n.$menu),e;if("maintain"===i&&"maintain"===s)o=n.$menu.position();else{var r=n.$trigger.parents().andSelf().filter(function(){return"fixed"==t(this).css("position")}).length;r&&(s-=a.scrollTop(),i-=a.scrollLeft()),o={top:s,left:i}}var l=a.scrollTop()+a.height(),c=a.scrollLeft()+a.width(),h=n.$menu.height(),u=n.$menu.width();o.top+h>l&&(o.top-=h),o.left+u>c&&(o.left-=u),n.$menu.css(o)},positionSubmenu:function(e){if(t.ui&&t.ui.position)e.css("display","block").position({my:"left top",at:"right top",of:this,collision:"fit"}).css("display","");else{var n={top:0,left:this.outerWidth()};e.css(n)}},zIndex:1,animation:{duration:50,show:"slideDown",hide:"slideUp"},events:{show:t.noop,hide:t.noop},callback:null,items:{}},p={timer:null,pageX:null,pageY:null},f=function(t){for(var e=0,n=t;;)if(e=Math.max(e,parseInt(n.css("z-index"),10)||0),n=n.parent(),!n||!n.length||"html body".indexOf(n.prop("nodeName").toLowerCase())>-1)break;return e},g={abortevent:function(t){t.preventDefault(),t.stopImmediatePropagation()},contextmenu:function(e){var n=t(this);if(e.preventDefault(),e.stopImmediatePropagation(),!("right"!=e.data.trigger&&e.originalEvent||n.hasClass("context-menu-disabled"))){if(o=n,e.data.build){var i=e.data.build(o,e);if(i===!1)return;if(e.data=t.extend(!0,{},d,e.data,i||{}),!e.data.items||t.isEmptyObject(e.data.items))throw window.console&&(console.error||console.log)("No items specified to show in contextMenu"),Error("No Items sepcified");e.data.$trigger=o,m.create(e.data)}m.show.call(n,e.data,e.pageX,e.pageY)}},click:function(e){e.preventDefault(),e.stopImmediatePropagation(),t(this).trigger(t.Event("contextmenu",{data:e.data,pageX:e.pageX,pageY:e.pageY}))},mousedown:function(e){var n=t(this);o&&o.length&&!o.is(n)&&o.data("contextMenu").$menu.trigger("contextmenu:hide"),2==e.button&&(o=n.data("contextMenuActive",!0))},mouseup:function(e){var n=t(this);n.data("contextMenuActive")&&o&&o.length&&o.is(n)&&!n.hasClass("context-menu-disabled")&&(e.preventDefault(),e.stopImmediatePropagation(),o=n,n.trigger(t.Event("contextmenu",{data:e.data,pageX:e.pageX,pageY:e.pageY}))),n.removeData("contextMenuActive")},mouseenter:function(e){var n=t(this),i=t(e.relatedTarget),s=t(document);i.is(".context-menu-list")||i.closest(".context-menu-list").length||o&&o.length||(p.pageX=e.pageX,p.pageY=e.pageY,p.data=e.data,s.on("mousemove.contextMenuShow",g.mousemove),p.timer=setTimeout(function(){p.timer=null,s.off("mousemove.contextMenuShow"),o=n,n.trigger(t.Event("contextmenu",{data:p.data,pageX:p.pageX,pageY:p.pageY}))},e.data.delay))},mousemove:function(t){p.pageX=t.pageX,p.pageY=t.pageY},mouseleave:function(e){var n=t(e.relatedTarget);if(!n.is(".context-menu-list")&&!n.closest(".context-menu-list").length){try{clearTimeout(p.timer)}catch(e){}p.timer=null}},layerClick:function(n){var i,s,o,r=t(this),l=r.data("contextMenuRoot"),h=!1,u=n.button,d=n.pageX,p=n.pageY;n.preventDefault(),n.stopImmediatePropagation(),r.on("mouseup",function(){h=!0}),setTimeout(function(){var f,g;if("left"==l.trigger&&0==u||"right"==l.trigger&&2==u)if(document.elementFromPoint){l.$layer.hide(),i=document.elementFromPoint(d-a.scrollLeft(),p-a.scrollTop()),l.$layer.show(),o=[];for(var m in c)o.push(m);if(i=t(i).closest(o.join(", ")),i.length&&i.is(l.$trigger[0]))return l.position.call(l.$trigger,l,d,p),e}else if(s=l.$trigger.offset(),f=t(window),s.top+=f.scrollTop(),s.top<=n.pageY&&(s.left+=f.scrollLeft(),s.left<=n.pageX&&(s.bottom=s.top+l.$trigger.outerHeight(),s.bottom>=n.pageY&&(s.right=s.left+l.$trigger.outerWidth(),s.right>=n.pageX))))return l.position.call(l.$trigger,l,d,p),e;g=function(t){t&&(t.preventDefault(),t.stopImmediatePropagation()),l.$menu.trigger("contextmenu:hide"),i&&i.length&&setTimeout(function(){i.contextMenu({x:d,y:p})},50)},h?g():r.on("mouseup",g)},50)},keyStop:function(t,e){e.isInput||t.preventDefault(),t.stopPropagation()},key:function(t){var n=o.data("contextMenu")||{};switch(n.$menu.children(),t.keyCode){case 9:case 38:if(g.keyStop(t,n),n.isInput){if(9==t.keyCode&&t.shiftKey)return t.preventDefault(),n.$selected&&n.$selected.find("input, textarea, select").blur(),n.$menu.trigger("prevcommand"),e;if(38==t.keyCode&&"checkbox"==n.$selected.find("input, textarea, select").prop("type"))return t.preventDefault(),e}else if(9!=t.keyCode||t.shiftKey)return n.$menu.trigger("prevcommand"),e;case 40:if(g.keyStop(t,n),!n.isInput)return n.$menu.trigger("nextcommand"),e;if(9==t.keyCode)return t.preventDefault(),n.$selected&&n.$selected.find("input, textarea, select").blur(),n.$menu.trigger("nextcommand"),e;if(40==t.keyCode&&"checkbox"==n.$selected.find("input, textarea, select").prop("type"))return t.preventDefault(),e;break;case 37:if(g.keyStop(t,n),n.isInput||!n.$selected||!n.$selected.length)break;if(!n.$selected.parent().hasClass("context-menu-root")){var i=n.$selected.parent().parent();return n.$selected.trigger("contextmenu:blur"),n.$selected=i,e}break;case 39:if(g.keyStop(t,n),n.isInput||!n.$selected||!n.$selected.length)break;var s=n.$selected.data("contextMenu")||{};if(s.$menu&&n.$selected.hasClass("context-menu-submenu"))return n.$selected=null,s.$selected=null,s.$menu.trigger("nextcommand"),e;break;case 35:case 36:return n.$selected&&n.$selected.find("input, textarea, select").length?e:((n.$selected&&n.$selected.parent()||n.$menu).children(":not(.disabled, .not-selectable)")[36==t.keyCode?"first":"last"]().trigger("contextmenu:focus"),t.preventDefault(),e);case 13:if(g.keyStop(t,n),n.isInput){if(n.$selected&&!n.$selected.is("textarea, select"))return t.preventDefault(),e;break}return n.$selected&&n.$selected.trigger("mouseup"),e;case 32:case 33:case 34:return g.keyStop(t,n),e;case 27:return g.keyStop(t,n),n.$menu.trigger("contextmenu:hide"),e;default:var r=String.fromCharCode(t.keyCode).toUpperCase();if(n.accesskeys[r])return n.accesskeys[r].$node.trigger(n.accesskeys[r].$menu?"contextmenu:focus":"mouseup"),e}t.stopPropagation(),n.$selected&&n.$selected.trigger(t)},prevItem:function(e){e.stopPropagation();var n=t(this).data("contextMenu")||{};if(n.$selected){var i=n.$selected;n=n.$selected.parent().data("contextMenu")||{},n.$selected=i}for(var s=n.$menu.children(),o=n.$selected&&n.$selected.prev().length?n.$selected.prev():s.last(),r=o;o.hasClass("disabled")||o.hasClass("not-selectable");)if(o=o.prev().length?o.prev():s.last(),o.is(r))return;n.$selected&&g.itemMouseleave.call(n.$selected.get(0),e),g.itemMouseenter.call(o.get(0),e);var a=o.find("input, textarea, select");a.length&&a.focus()},nextItem:function(e){e.stopPropagation();var n=t(this).data("contextMenu")||{};if(n.$selected){var i=n.$selected;n=n.$selected.parent().data("contextMenu")||{},n.$selected=i}for(var s=n.$menu.children(),o=n.$selected&&n.$selected.next().length?n.$selected.next():s.first(),r=o;o.hasClass("disabled")||o.hasClass("not-selectable");)if(o=o.next().length?o.next():s.first(),o.is(r))return;n.$selected&&g.itemMouseleave.call(n.$selected.get(0),e),g.itemMouseenter.call(o.get(0),e);var a=o.find("input, textarea, select");a.length&&a.focus()},focusInput:function(){var e=t(this).closest(".context-menu-item"),n=e.data(),i=n.contextMenu,s=n.contextMenuRoot;s.$selected=i.$selected=e,s.isInput=i.isInput=!0},blurInput:function(){var e=t(this).closest(".context-menu-item"),n=e.data(),i=n.contextMenu,s=n.contextMenuRoot;s.isInput=i.isInput=!1},menuMouseenter:function(){var e=t(this).data().contextMenuRoot;e.hovering=!0},menuMouseleave:function(e){var n=t(this).data().contextMenuRoot;n.$layer&&n.$layer.is(e.relatedTarget)&&(n.hovering=!1)},itemMouseenter:function(n){var i=t(this),s=i.data(),o=s.contextMenu,r=s.contextMenuRoot;return r.hovering=!0,n&&r.$layer&&r.$layer.is(n.relatedTarget)&&(n.preventDefault(),n.stopImmediatePropagation()),(o.$menu?o:r).$menu.children(".hover").trigger("contextmenu:blur"),i.hasClass("disabled")||i.hasClass("not-selectable")?(o.$selected=null,e):(i.trigger("contextmenu:focus"),e)},itemMouseleave:function(n){var i=t(this),s=i.data(),o=s.contextMenu,r=s.contextMenuRoot;return r!==o&&r.$layer&&r.$layer.is(n.relatedTarget)?(r.$selected&&r.$selected.trigger("contextmenu:blur"),n.preventDefault(),n.stopImmediatePropagation(),r.$selected=o.$selected=o.$node,e):(i.trigger("contextmenu:blur"),e)},itemClick:function(e){var n,i=t(this),s=i.data(),o=s.contextMenu,r=s.contextMenuRoot,a=s.contextMenuKey;if(o.items[a]&&!i.hasClass("disabled")&&!i.hasClass("context-menu-submenu")){if(e.preventDefault(),e.stopImmediatePropagation(),t.isFunction(r.callbacks[a]))n=r.callbacks[a];else{if(!t.isFunction(r.callback))return;n=r.callback}n.call(r.$trigger,a,r)!==!1?r.$menu.trigger("contextmenu:hide"):r.$menu.parent().length&&m.update.call(r.$trigger,r)}},inputClick:function(t){t.stopImmediatePropagation()},hideMenu:function(e,n){var i=t(this).data("contextMenuRoot");m.hide.call(i.$trigger,i,n&&n.force)},focusItem:function(e){e.stopPropagation();var n=t(this),i=n.data(),s=i.contextMenu,o=i.contextMenuRoot;n.addClass("hover").siblings(".hover").trigger("contextmenu:blur"),s.$selected=o.$selected=n,s.$node&&o.positionSubmenu.call(s.$node,s.$menu)},blurItem:function(e){e.stopPropagation();var n=t(this),i=n.data(),s=i.contextMenu;i.contextMenuRoot,n.removeClass("hover"),s.$selected=null}},m={show:function(n,i,s){var r=t(this),a={};if(t("#context-menu-layer").trigger("mousedown"),n.$trigger=r,n.events.show.call(r,n)===!1)return o=null,e;if(m.update.call(r,n),n.position.call(r,n,i,s),n.zIndex&&(a.zIndex=f(r)+n.zIndex),m.layer.call(n.$menu,n,a.zIndex),n.$menu.find("ul").css("zIndex",a.zIndex+1),n.$menu.css(a)[n.animation.show](n.animation.duration),r.data("contextMenu",n),t(document).off("keydown.contextMenu").on("keydown.contextMenu",g.key),n.autoHide){var l=r.position();l.right=l.left+r.outerWidth(),l.bottom=l.top+this.outerHeight(),t(document).on("mousemove.contextMenuAutoHide",function(t){!n.$layer||n.hovering||t.pageX>=l.left&&t.pageX<=l.right&&t.pageY>=l.top&&t.pageY<=l.bottom||n.$menu.trigger("contextmenu:hide")})}},hide:function(n,i){var s=t(this);if(n||(n=s.data("contextMenu")||{}),i||!n.events||n.events.hide.call(s,n)!==!1){if(n.$layer){setTimeout(function(t){return function(){t.remove()}}(n.$layer),10);try{delete n.$layer}catch(r){n.$layer=null}}o=null,n.$menu.find(".hover").trigger("contextmenu:blur"),n.$selected=null,t(document).off(".contextMenuAutoHide").off("keydown.contextMenu"),n.$menu&&n.$menu[n.animation.hide](n.animation.duration,function(){n.build&&(n.$menu.remove(),t.each(n,function(t){switch(t){case"ns":case"selector":case"build":case"trigger":return!0;default:n[t]=e;try{delete n[t]}catch(i){}return!0}}))})}},create:function(i,s){s===e&&(s=i),i.$menu=t('').data({contextMenu:i,contextMenuRoot:s}),t.each(["callbacks","commands","inputs"],function(t,e){i[e]={},s[e]||(s[e]={})}),s.accesskeys||(s.accesskeys={}),t.each(i.items,function(e,o){var r=t(''),a=null,l=null;if(o.$node=r.data({contextMenu:i,contextMenuRoot:s,contextMenuKey:e}),o.accesskey)for(var c,h=n(o.accesskey),d=0;c=h[d];d++)if(!s.accesskeys[c]){s.accesskeys[c]=o,o._name=o.name.replace(RegExp("("+c+")","i"),'');
-break}if("string"==typeof o)r.addClass("context-menu-separator not-selectable");else if(o.type&&u[o.type])u[o.type].call(r,o,i,s),t.each([i,s],function(n,i){i.commands[e]=o,t.isFunction(o.callback)&&(i.callbacks[e]=o.callback)});else{switch("html"==o.type?r.addClass("context-menu-html not-selectable"):o.type?(a=t("").appendTo(r),t("").html(o._name||o.name).appendTo(a),r.addClass("context-menu-input"),i.hasTypes=!0,t.each([i,s],function(t,n){n.commands[e]=o,n.inputs[e]=o})):o.items&&(o.type="sub"),o.type){case"text":l=t('').val(o.value||"").appendTo(a);break;case"textarea":l=t('').val(o.value||"").appendTo(a),o.height&&l.height(o.height);break;case"checkbox":l=t('').val(o.value||"").prop("checked",!!o.selected).prependTo(a);break;case"radio":l=t('').val(o.value||"").prop("checked",!!o.selected).prependTo(a);break;case"select":l=t('