WRMCB=function(e){var c=console;if(c&&c.log&&c.error){c.log('Error running batched script.');c.error(e);}}
;
try {
/* module-key = 'com.atlassian.confluence.extra.team-calendars:jira-resources', location = 'com/atlassian/confluence/extra/calendar3/lib/jira/globals.js' */
if(!window.JIRA){window.JIRA={}}if(!window.JIRA.begetObject){window.JIRA.begetObject=function(b){var a=function(){};a.prototype=b;return new a()}};
}catch(e){WRMCB(e)};
;
try {
/* module-key = 'com.atlassian.confluence.extra.team-calendars:jira-resources', location = 'com/atlassian/confluence/extra/calendar3/lib/jira/Dropdown.js' */
JIRA.Dropdown=function(){var a=[];return{addInstance:function(){a.push(this)},hideInstances:function(){var b=this;jQuery(a).each(function(){if(b!==this){this.hideDropdown()}})},getHash:function(){if(!this.hash){this.hash={container:this.dropdown,hide:this.hideDropdown,show:this.displayDropdown}}return this.hash},displayDropdown:function(){if(JIRA.Dropdown.current===this){return}this.hideInstances();JIRA.Dropdown.current=this;this.dropdown.css({display:"block"});this.displayed=true;var b=this.dropdown;setTimeout(function(){var d=jQuery(window);var c=b.offset().top+b.attr("offsetHeight")-d.height()+10;if(d.scrollTop()<c){jQuery("html,body").animate({scrollTop:c},300,"linear")}},100)},hideDropdown:function(){if(this.displayed===false){return}JIRA.Dropdown.current=null;this.dropdown.css({display:"none"});this.displayed=false},init:function(b,d){var c=this;this.addInstance(this);this.dropdown=jQuery(d);this.dropdown.css({display:"none"});jQuery(document).keydown(function(f){if(f.keyCode===9){c.hideDropdown()}});if(b.target){jQuery.aop.before(b,function(){if(!c.displayed){c.displayDropdown()}})}else{c.dropdown.css("top",jQuery(b).outerHeight()+"px");b.click(function(f){if(!c.displayed){c.displayDropdown();f.stopPropagation()}else{c.hideDropdown()}f.preventDefault()})}jQuery(document.body).click(function(){if(c.displayed){c.hideDropdown()}})}}}();JIRA.Dropdown.Standard=function(a,c){var b=JIRA.begetObject(JIRA.Dropdown);b.init(a,c);return b};JIRA.Dropdown.AutoComplete=function(a,c){var b=JIRA.begetObject(JIRA.Dropdown);b.init=function(d,e){this.addInstance(this);this.dropdown=jQuery(e).click(function(f){f.stopPropagation()});this.dropdown.css({display:"none"});if(d.target){jQuery.aop.before(d,function(){if(!b.displayed){b.displayDropdown()}})}else{d.click(function(f){if(!b.displayed){b.displayDropdown();f.stopPropagation()}})}jQuery(document.body).click(function(){if(b.displayed){b.hideDropdown()}})};b.init(a,c);return b};
}catch(e){WRMCB(e)};
;
try {
/* module-key = 'com.atlassian.confluence.extra.team-calendars:jira-resources', location = 'com/atlassian/confluence/extra/calendar3/lib/jira/JiraAutoComplete.js' */
JIRA.AutoComplete=function(){var c;var b=function(e,d){if(b.t){clearTimeout(b.t);b.t=undefined}b.t=setTimeout(e,d*1000)};var a={9:true,13:true,14:true,25:true,27:true,38:true,40:true,224:true};return{dispatcher:function(){},getSavedResponse:function(){},saveResponse:function(){},renderSuggestions:function(){},disable:function(){this.disabled=true},enable:function(){this.disabled=false},set:function(e){for(var d in e){if(e.hasOwnProperty(d)){this[d]=e[d]}}},completeField:function(d){if(d){this.field.val(d).focus()}},textToSuggestionCursorPosition:function(){return this.field.val()},_makeRequest:function(d){var e=this,f=AJS.$.extend({},d);if(this.pendingRequest){this.pendingRequest.abort()}f.complete=function(){e.pendingRequest=null};f.error=function(g){if(!g.aborted&&g.status!==0&&d.error){d.error.apply(this,arguments)}};f.timeout=Confluence.TeamCalendars.ajaxTimeout;return this.pendingRequest=AJS.$.ajax(f)},addSuggestionControls:function(h){var m=this;var l=function(q,i){var r=(m.autoSelectFirst===false)?-1:0;if(m.allowArrowCarousel){if(q>i){return r}else{if(q<r){return i}else{return q}}}else{if(q>i){return i}else{if(q<r){m.responseContainer.scrollTop(0);return r}else{return q}}}};var d=function(i){if(m.selectedIndex!==undefined&&m.selectedIndex>-1){m.suggestionNodes[m.selectedIndex][0].removeClass("active")}m.selectedIndex=l(i,m.suggestionNodes.length-1);if(m.selectedIndex>-1){m.suggestionNodes[m.selectedIndex][0].addClass("active")}};var p=function(){return m.suggestionNodes&&m.suggestionNodes[m.selectedIndex]&&m.suggestionNodes[m.selectedIndex][0].hasClass("active")};var n=function(i){if(m.responseContainer.is(":visible")){if(i.keyCode===13){if(p()&&!m.pendingRequest){m.completeField(m.suggestionNodes[m.selectedIndex][1])}i.preventDefault()}}};var g=function(s){if(m.responseContainer.is(":visible")){if(m.field[0]!==document.activeElement){m.field.focus()}if(s.keyCode===40){d(m.selectedIndex+1);if(m.selectedIndex>=0){var q=m.responseContainer.height();var i=m.suggestionNodes[m.selectedIndex][0].position().top+m.suggestionNodes[m.selectedIndex][0].outerHeight();if(i-q>0){m.responseContainer.scrollTop(m.responseContainer.scrollTop()+i-q+2)}}else{m.responseContainer.scrollTop(0)}s.preventDefault()}else{if(s.keyCode===38){d(m.selectedIndex-1);if(m.selectedIndex>=0){var r=m.suggestionNodes[m.selectedIndex][0].position().top;if(r<0){m.responseContainer.scrollTop(m.responseContainer.scrollTop()+r-2)}}s.preventDefault()}else{if(s.keyCode===9){if(p()){m.completeField(m.suggestionNodes[m.selectedIndex][1]);s.preventDefault()}else{m.dropdownController.hideDropdown()}}}}}};if(h.length){this.selectedIndex=0;this.suggestionNodes=h;for(var k=0;k<m.suggestionNodes.length;k++){var o={instance:this,index:k};this.suggestionNodes[k][0].bind("mouseover",o,j).bind("mouseout",o,f).bind("click",o,e)}if(!this.keyboardHandlerBinded){jQuery(this.field).keypress(n);if(jQuery.browser.mozilla){jQuery(this.field).keypress(g)}else{jQuery(this.field).keydown(g)}this.keyboardHandlerBinded=true}if(m.autoSelectFirst===false){d(-1)}else{d(0)}c=this}function j(i){if(m.dropdownController.displayed){d(i.data.index)}}function f(i){if(i.data.index===0){m.selectedIndex=-1}jQuery(this).removeClass("active")}function e(i){m.completeField(m.suggestionNodes[i.data.index][1])}},clearResponseContainer:function(){this.responseContainer.empty();this.suggestionNodes=undefined},delay:b,buildResponseContainer:function(){var d=this.field.parent().addClass("atlassian-autocomplete");this.responseContainer=jQuery(document.createElement("div"));this.responseContainer.addClass("suggestions").css({top:this.field.outerHeight()+"px"}).appendTo(d)},keyUpHandler:(function(){var d=jQuery.browser.msie&&jQuery.browser.version==8;function e(){if(!this.responseContainer){this.buildResponseContainer()}this.dispatcher(this.field.val())}return function(f){if(this.field.val().length>=this.minQueryLength){if(!(f.keyCode in a)||(this.responseContainer&&!this.responseContainer.is(":visible")&&(f.keyCode==38||f.keyCode==40))){if(d){b(jQuery.proxy(e,this),0.2)}else{e.call(this)}}}return f}})(),addMultiSelectAdvice:function(f){var e=this;var d=function(h){if(!d.isAlerting){d.isAlerting=true;var g=jQuery(document.createElement("div")).css({"float":"left",display:"none"}).addClass("warningBox").html("Oops! You have already entered the value <em>"+h+"</em>").appendTo(e.field.parent()).show("fast",function(){e.delay(function(){g.hide("fast",function(){g.remove();d.isAlerting=false})},4)})}};jQuery.aop.before({target:this,method:"dispatcher"},function(h){var g=this.field.val();h[0]=jQuery.trim(g.slice(g.lastIndexOf(f)+1));return h});jQuery.aop.before({target:this,method:"completeField"},function(h){var j=h[0],i=this.field.val().split(f);var g=jQuery(i).map(function(){return jQuery.trim(this)}).get();if(!this.allowDuplicates&&new RegExp("(?:^|[\\s"+f+"])"+j+"\\s*"+f).test(this.field.val())){d(j);g[g.length-1]=""}else{g[g.length-1]=j;g[g.length]=""}h[0]=g.join(f.replace(/([^\s]$)/,"$1 "));return h})},addDropdownAdvice:function(){var d=this;jQuery.aop.after({target:this,method:"buildResponseContainer"},function(e){this.dropdownController=JIRA.Dropdown.AutoComplete({target:this,method:"renderSuggestions"},this.responseContainer);if(AJS.$.browser.msie){jQuery.aop.before({target:this.dropdownController,method:"displayDropdown"},function(){d.field.parent().addClass("atlassian-autocomplete")});jQuery.aop.after({target:this.dropdownController,method:"hideDropdown"},function(){d.field.parent().removeClass("atlassian-autocomplete")})}jQuery.aop.after({target:this.dropdownController,method:"hideDropdown"},function(){this.dropdown.removeClass("dropdown-ready")});return e});jQuery.aop.after({target:this,method:"renderSuggestions"},function(e){if(e&&e.length>0){this.dropdownController.displayDropdown();if(this.maxHeight&&this.dropdownController.dropdown.attr("scrollHeight")>this.maxHeight){this.dropdownController.dropdown.css({height:this.maxHeight,overflowX:"visible",overflowY:"scroll"})}else{if(this.maxHeight){this.dropdownController.dropdown.css({height:"",overflowX:"",overflowY:""})}}this.dropdownController.dropdown.addClass("dropdown-ready")}else{this.dropdownController.hideDropdown()}return e});jQuery.aop.after({target:this,method:"completeField"},function(e){this.dropdownController.hideDropdown();return e});jQuery.aop.after({target:this,method:"keyUpHandler"},function(f){if((!(this.field.val().length>=this.minQueryLength)||f.keyCode===27)&&this.dropdownController&&this.dropdownController.displayed){this.dropdownController.hideDropdown();if(f.keyCode===27){f.stopPropagation()}}return f})},init:function(d){var e=this;this.set(d);this.field=this.field||jQuery("#"+this.fieldID);this.field.attr("autocomplete","off").keyup(function(f){if(!e.disabled){e.keyUpHandler(f)}}).keydown(function(g){var f=27;if(g.keyCode===f&&e.responseContainer&&e.responseContainer.is(":visible")){g.preventDefault()}}).click(function(f){if(c===e){f.stopPropagation()}}).blur(function(){if(e.pendingRequest){e.pendingRequest.abort()}});this.addDropdownAdvice();if(d.delimChar){this.addMultiSelectAdvice(d.delimChar)}}}}();
}catch(e){WRMCB(e)};
;
try {
/* module-key = 'com.atlassian.confluence.extra.team-calendars:jira-resources', location = 'com/atlassian/confluence/extra/calendar3/lib/jira/JQLAutoComplete.js' */
(function(){var F=[{value:"=",displayName:"="},{value:"!=",displayName:"!="},{value:"~",displayName:"~"},{value:"<=",displayName:"&lt;="},{value:">=",displayName:"&gt;="},{value:">",displayName:"&gt;"},{value:"<",displayName:"&lt;"},{value:"!~",displayName:"!~"},{value:"is not",displayName:"is not"},{value:"is",displayName:"is"},{value:"not in",displayName:"not in"},{value:"in",displayName:"in"},{value:"was",displayName:"was"},{value:"was not",displayName:"was not"},{value:"was in",displayName:"was in"},{value:"was not in",displayName:"was not in"},{value:"changed",displayName:"changed"}];var o=[{value:"AND",displayName:"AND"},{value:"OR",displayName:"OR"}];var x=[{value:"AND",displayName:"AND"},{value:"OR",displayName:"OR"},{value:"ORDER BY",displayName:"ORDER BY"}];var s=[{value:"ASC",displayName:"ASC"},{value:"DESC",displayName:"DESC"}];var t=[{value:"EMPTY",displayName:"EMPTY",types:["java.lang.Object"]}];var E=[{value:"NOT",displayName:"NOT"}];var i=[{value:"AFTER",displayName:"AFTER",type:"java.util.Date",supportsList:"false"},{value:"BEFORE",displayName:"BEFORE",type:"java.util.Date",supportsList:"false"},{value:"BY",displayName:"BY",type:"com.opensymphony.user.User",supportsList:"false",auto:"true"},{value:"DURING",displayName:"DURING",type:"java.util.Date",supportsList:"true"},{value:"ON",displayName:"ON",type:"java.util.Date",supportsList:"false"}];var n=i.concat([{value:"FROM",displayName:"FROM",type:"java.lang.String",supportsList:"true",auto:"true"},{value:"TO",displayName:"TO",type:"java.lang.String",supportsList:"true",auto:"true"}]);var y=i.concat(x);var k=i.concat(o);var v=n.concat(x);var p=n.concat(o);var h=/^AND\s/i;var A=/^OR\s/i;var e=/^NOT\s/i;var w=/^\s+not/i;var d=/^\s+in/i;var m=/^\s+(not\s+in|not|in)/i;var u=/^\s*,/;var r=/^\s+asc/i;var H=/^\s+desc/i;var l=/^order\s+by/i;var D=/^\s/;var g=/^u[a-fA-F0-9]{4}/;var z=/^\s-\scf\[\d\d\d\d\d\]/;var c=/[\r\n]/;var a=/\d/;var G=/[^=!~<>(),\s&|]/;var f=/[{}*\/%+$#@?.;\][]/;var b=/[\s(]/;var C=/[^trn"'\\\s]/;var q=/^NO?$/i;var B=/^IN?$/i;var j=/^(after|before|by|during|from|on|to)/i;JIRA.JQLAutoComplete=function(T){var N=JIRA.begetObject(JIRA.AutoComplete);var I=T.parser;var U;var J=jQuery.grep(T.jqlFieldNames,function(V){return V.searchable});var P=jQuery.grep(T.jqlFieldNames,function(V){return V.orderable});var R=T.jqlFunctionNames;var M=jQuery("#"+T.errorID);var Q=0;var K=jQuery("#jqlcolumnnum");var S=jQuery("#jqlrownum");var L=T.jiraApplicationId;var O=T.baseUrl;N.textToSuggestionCursorPosition=function(){return this.field.selectionRange().textBefore};N.pushSuggestionsOnHtmlStack=function(ab,Z,ac,Y,V){var X=Math.min(15,ab.length);for(var aa=0;aa<X;aa++){var W;var ae;if(ab[aa].value){var ad=ab[aa];if(U&&V){W=((U.getNeedsOpenParen())?"(":"")+ad.value}else{W=ad.value}ae=ad.displayName}else{ae=ab[aa];W=displayName}Z.push(W);ac.push('<li id="',Y,aa,'">',ae,"</li>")}};N.renderSuggestions=function(W,Y,V){var Z=[];if(W instanceof Array){if(W.length<1&&(Y&&Y.length<1)&&(V&&V.length<1)){return Z}var X=["<ul>"];if(V&&V.length>0){N.pushSuggestionsOnHtmlStack(V,Z,X,"jql_operator_suggest_",false)}N.pushSuggestionsOnHtmlStack(W,Z,X,"jql_value_suggest_",true);if(Y&&Y.length>0){N.pushSuggestionsOnHtmlStack(Y,Z,X,"jql_function_suggest_",false)}X.push("</ul>");N.responseContainer.html(X.join("")).find("li").each(function(aa){Z[aa]=[jQuery(this),Z[aa]]});N.addSuggestionControls(Z)}return Z};N.completeField=function(X){var Y=N.getReplacementStartIndex(U,X);var V=N.getReplacementEndIndex(U,Y);N.replaceValue(Y,V,X);var W=I.parse(this.field.val());N.updateParseIndicator(W)};N.prepareOperandSuggestions=function(aa,ad,ac,Y,Z){if(aa){var W=Q;var V=(Z==null)?((U.getLastOperand()===null)?"":N.stripEscapeCharacters(U.getLastOperand())):Z;var ab=ad+":"+V;var X={fieldName:N.stripEscapeCharacters(ad)};if(U.getLastOperand()!==null||Z!==null){X.fieldValue=V}if(!N.getSavedResponse(ab)){N.dropdownController.dropdown.removeClass("dropdown-ready");this.delay(function(){N._makeRequest({url:O+"/rest/calendar-services/1.0/calendar/jira/"+encodeURIComponent(L)+"/jql/autocomplete.json",dataType:"json",data:X,success:function(ae){var af;if(ae!==null&&ae.results!==null){af=ae.results}else{af=[]}N.saveResponse(ab,af);N.renderSuggestionsForOperands(V,af,ac,Y,W)},error:function(){N.renderSuggestionsForOperands(V,[],ac,Y,W)}})},N.queryDelay)}else{N.renderSuggestionsForOperands(V,N.getSavedResponse(ab),ac,Y,W)}}else{N.renderSuggestionsForOperands(N.stripEscapeCharacters(U.getLastOperand()),[],ac,Y,Q)}};N.preparePredicateSuggestions=function(ab,V){var Z=Q;if(typeof V=="undefined"){V=null}var Y=N.slimListForPredicates(V,R,ab);N.boldMatchingString(V,Y);var W=(V==null)?((U.getLastOperand()===null)?"":N.stripEscapeCharacters(U.getLastOperand())):V;var aa=ab+":"+W;var X={predicateName:N.stripEscapeCharacters(ab)};if(U.getLastOperand()!==null||V!==null){X.predicateValue=W}if(U.getLastFieldName()!==null){X.fieldName=U.getLastFieldName();aa=U.getLastFieldName()+":"+aa}if(N.predicateSupportsAutoComplete(ab)){if(!N.getSavedResponse(aa)){N.dropdownController.dropdown.removeClass("dropdown-ready");this.delay(function(){N._makeRequest({url:O+"/rest/calendar-services/1.0/calendar/jira/"+encodeURIComponent(L)+"/jql/autocomplete.json",dataType:"json",data:X,success:function(ac){var ad;if(ac!==null&&ac.results!==null){ad=ac.results}else{ad=[]}N.saveResponse(aa,ad);N.renderSuggestions(ad,Y)},error:function(){N.renderSuggestionsForOperands(W,[])}})},N.queryDelay)}else{N.renderSuggestions(N.getSavedResponse(aa),Y)}}else{N.renderSuggestions([],Y)}};N.incompleteOperator=function(){var V=U.getTokens();if(V==null||V.length<2){return""}else{var V=N.textToSuggestionCursorPosition().split(" ");if(V.length>2){return V[V.length-1]}}return""};N.incompletePredicateValue=function(){var V=U.getTokens();if(V==null||V.length<3){return""}else{var V=N.textToSuggestionCursorPosition().split(/[\s(,]+/);if(V.length>3){return V[V.length-1]}}return""};N.dispatcher=function(X){var af=this;var V=jQuery(af.field).selectionRange();var ad=X.substring(0,V.start);U=I.parse(ad).getResult();Q++;if(U.getNeedsField()){af.renderSuggestionsFromMap(af.stripEscapeCharacters(U.getLastFieldName()),J,E,true)}else{if(U.getNeedsOperatorOrOperand()){var W=U.getLastOperator();var Z=W.length;var Y=(W.length>0)?ad.substr(U.getLastOperatorStartIndex()):null;var ai=(af.isEmptyOnlyOperator(U.getLastOperator()))?t:R;var ac=af.getSuggestionsForOperators(Y,F);if(Z>0){var ab=W.length-(W.replace(/\s+/g,"")).length;U.setLastOperandStartIndex(U.getLastOperatorStartIndex()+Z+ab+1)}if(ac&&ac.length>0){var ag=U.getTokens();var ah=af.incompleteOperator();af.prepareOperandSuggestions(true,U.getLastFieldName(),ai,ac,ah)}}else{if(U.getNeedsOperator()){af.renderSuggestionsForOperators(U.getLastOperator(),F)}else{if(U.getNeedsPredicateOperand()){var ak=U.getLastWasPredicate();af.preparePredicateSuggestions(ak,af.stripEscapeCharacters(U.getLastOperand()))}else{if(U.getNeedsLogicalOperator()){if(U.getNeedsWasPredicate()){if(U.getNeedsOrderBy()){var aj=(U.getLastOrderBy()===null)?U.getLastWasPredicate():U.getLastOrderBy();if(U.getLastOperator()=="was"){af.renderSuggestionsFromMap(aj,y,false)}else{af.renderSuggestionsFromMap(aj,v,false)}}else{if(U.getLastOperator()=="was"){af.renderSuggestionsFromMap(U.getLastWasPredicate(),k,false)}else{af.renderSuggestionsFromMap(U.getLastWasPredicate(),p,false)}}}else{if(U.getNeedsOrderBy()){var aj=(U.getLastOrderBy()===null)?U.getLastLogicalOperator():U.getLastOrderBy();af.renderSuggestionsFromMap(aj,x,false)}else{af.renderSuggestionsFromMap(U.getLastLogicalOperator(),o,false)}}}else{if(U.getNeedsOrderByField()){af.renderSuggestionsFromMap(af.stripEscapeCharacters(U.getLastOrderByFieldName()),P,true)}else{if(U.getNeedsOrderByDirection()){af.renderSuggestionsFromMap(U.getLastOrderByDirection(),s,false)}else{if(U.getNeedsOperand()){var al=U.getLastFieldName();var ae=false;if(!af.isEmptyOnlyOperator(U.getLastOperator())){for(var aa=0;aa<J.length;aa++){if(af.equalsIgnoreCase(U.getUnquotedString(J[aa].value),al)||(J[aa].cfid&&af.equalsIgnoreCase(J[aa].cfid,al))){ae=J[aa].auto;break}}}var ai=(af.isEmptyOnlyOperator(U.getLastOperator()))?t:R;af.prepareOperandSuggestions(ae,al,ai,{})}else{af.dropdownController.hideDropdown()}}}}}}}}af.parse(X)};N.stripEscapeCharacters=function(Y){if(Y==null){return Y}var V="";var X=Y.split("");for(var W=0;W<X.length;W++){if(X[W]=="\\"){if(!g.test(Y.substring(W,Y.length))){W++;if(W>=Y.length){break}}}V+=X[W]}return V};N.parse=function(W){var V=I.parse(W);N.updateParseIndicator(V);N.updateColumnLineCount();return V.getResult()};N.renderSuggestionsFromMap=function(W,Y,X,Z){if(!X){X={}}var V=N.slimListForMapResults(W,Y,Z);var aa=N.slimListForMapResults(W,X,Z);N.boldMatchingString(W,aa);N.boldMatchingString(W,V);N.renderSuggestions(V,aa);if(V.length===0&&aa.length===0){N.dropdownController.hideDropdown()}};N.getSuggestionsForOperators=function(W,Z){var V=N.slimListForMapResults(W,Z,false);var aa=U.getLastFieldName();var Y;for(var X=0;X<J.length;X++){if(N.equalsIgnoreCase(U.getUnquotedString(J[X].value),aa)||(J[X].cfid&&N.equalsIgnoreCase(J[X].cfid,aa))){Y=J[X].operators;break}}if(Y){V=jQuery.grep(V,function(ab){return jQuery.inArray(ab.value,Y)>-1})}N.boldMatchingString(W,V);return V};N.renderSuggestionsForOperators=function(W,X){var V=N.getSuggestionsForOperators(W,X);N.renderSuggestions(V);if(V.length===0){N.dropdownController.hideDropdown()}};N.renderSuggestionsForOperands=function(W,X,Z,V,aa){if(aa===Q){var Y=N.slimListForFunctionResults(W,Z,U.getLastOperator());N.boldMatchingString(W,Y);N.renderSuggestions(X,Y,V);if(X.length===0&&Y.length===0&&V.length==0){N.dropdownController.hideDropdown()}}};N.boldMatchingString=function(W,Z){if(W==null||Z.length===0){return}var aa=W.length;for(var X=0,ab=aa;X<ab;X++){switch(W.charAt(X)){case"<":case">":aa+=3;break;case"&":aa+=4;break;case'"':aa+=5;break}}for(var Y=0;Y<Z.length;Y++){if(Z[Y].displayName){var V=Z[Y].displayName;Z[Y]={value:Z[Y].value,displayName:"<b>"+V.substring(0,aa)+"</b>"+V.substring(aa)}}else{Z[Y]={value:Z[Y],displayName:"<b>"+Z[Y].substring(0,aa)+"</b>"+Z[Y].substring(aa)}}}};N.htmlEscape=function(W){if(W==null){return null}var V="";var Y=W.split("");for(var X=0;X<Y.length;X++){if(Y[X]==="<"){V+="&lt;"}else{if(Y[X]===">"){V+="&gt;"}else{if(Y[X]==="&"){V+="&amp;"}else{if(Y[X]==='"'){V+="&quot;"}else{V+=Y[X]}}}}}return V},N.getReplacementStartIndex=function(V,W){var X=jQuery(this.field);var Y;if(V.getNeedsField()){Y=V.getLastFieldNameStartIndex()}else{if(V.getNeedsOperatorOrOperand()){if(V.getNeedsOperator()&&N.isWasOperator(W)){Y=V.getLastOperatorStartIndex()}else{Y=V.getLastOperandStartIndex()}}else{if(V.getNeedsOperand()){Y=V.getLastOperandStartIndex()}else{if(V.getNeedsOperator()){Y=V.getLastOperatorStartIndex()}else{if(V.getNeedsOrderByField()){Y=V.getLastOrderByFieldNameStartIndex()}else{if(V.getNeedsOrderByDirection()){Y=V.getLastOrderByDirectionStartIndex()}else{if(V.getNeedsPredicateOperand()){Y=V.getLastOperandStartIndex()}else{if(V.getNeedsLogicalOperator()){if(V.getLastLogicalOperatorStartIndex()!==null&&V.getLastLogicalOperatorStartIndex()!==0){Y=V.getLastLogicalOperatorStartIndex()}else{if(V.getLastOrderBy()!==null&&V.getLastOrderByStartIndex()!==0){Y=V.getLastOrderByStartIndex()}else{if(V.getLastWasPredicate()!=null&&V.getLastWasPredicateStartIndex()!==0){Y=V.getLastWasPredicateStartIndex()}else{if(V.getMustBeOperatorOrPredicate()===true){Y=X.selectionRange().start}else{Y=X.selectionRange().start-1}}}}}else{if(V.getNeedsWasPredicate()){Y=V.getLastWasPredicateStartIndex()}else{Y=X.selectionRange().start-1}}}}}}}}}return Y!=null?Y:X.selectionRange().start};N.getReplacementEndIndex=function(ah,V){var ag=jQuery(this.field);var W=ag.selectionRange();var Z=null;if(W.start===W.end&&W.end!==this.field.val().length){var aa=ah.getTokens().length-1;var Y=I.parse(this.field.val());if(!Y.getParseError()){var X=Y.getResult().getTokens()[aa];if(X!==null&&X!=="("&&X!==")"){var af=this.field.val();var ac=af.substring(V,af.length);var ae=ac.split("");var ad=0;for(var ab=0;ab<ae.length;ab++){if(D.test(ae[ab])){ad++}else{break}}Z=V+X.length+ad}}}if(Z===null){Z=W.end}if(Z<V){N.replaceValue(V,Z," ");Z=V}return Z};N.replaceValue=function(Z,V,Y){var X=jQuery(this.field);X.selectionRange(Z,V);X.selection(Y);var W=X.selectionRange().end;X.selectionRange(W,W)};N.slimListForMapResults=function(V,Y,Z){var X=N.htmlEscape(V);var W=jQuery.grep(Y,function(aa){return N.startsWithIgnoreCaseNullsMeanAll(X,aa.displayName)});if(!Z){if(W.length===1&&!N.startsWithNotEqualsIgnoreCaseNullMeansAll(X,W[0].displayName)){return{}}}return W};N.slimListForFunctionResults=function(V,aa,X){var ab=U.getLastFieldName();var Z;for(var Y=0;Y<J.length;Y++){if(N.equalsIgnoreCase(U.getUnquotedString(J[Y].value),ab)||(J[Y].cfid&&N.equalsIgnoreCase(J[Y].cfid,ab))){Z=J[Y].types;break}}var W=jQuery.grep(aa,function(ac){if((ac.isList&&!N.isListSupportingOperator(X))||(!ac.isList&&N.isListSupportingOperator(X))){return false}if(Z){var ae=jQuery.inArray("java.lang.Object",ac.types)>-1||jQuery.inArray("java.lang.Object",Z)>-1;for(var ad=0;ad<Z.length&&!ae;ad++){ae=jQuery.inArray(Z[ad],ac.types)!==-1}if(!ae){return false}}else{return false}return N.startsWithIgnoreCaseNullsMeanAll(V,ac.value)||N.startsWithIgnoreCaseNullsMeanAll(V,ac.displayName)});if(W.length===1&&!N.startsWithNotEqualsIgnoreCaseNullMeansAll(V,W[0].displayName)){return{}}return W};N.slimListForPredicates=function(Y,ab,W){var V;var X;for(var aa=0;aa<n.length;aa++){if(N.equalsIgnoreCase(U.getUnquotedString(n[aa].value),W)){V=n[aa].type;X=n[aa].supportsList;break}}var Z=jQuery.grep(ab,function(ac){if(typeof ac.isList!="undefined"){if((ac.isList&&!!X)||(!ac.isList&&X)){return false}}var ad=jQuery.inArray(V,ac.types)!==-1;return ad?N.startsWithIgnoreCaseNullsMeanAll(Y,ac.value)||N.startsWithIgnoreCaseNullsMeanAll(Y,ac.displayName):false});if(Z.length===1&&!N.startsWithNotEqualsIgnoreCaseNullMeansAll(Y,Z[0].displayName)){return{}}return Z};N.predicateSupportsAutoComplete=function(V){var X;for(var W=0;W<n.length;W++){if(N.equalsIgnoreCase(U.getUnquotedString(n[W].value),V)){X=n[W].auto;break}}return X};N.isListSupportingOperator=function(V){return V==="in"||V==="not in"||V=="was not in"||V=="was in"};N.isEmptyOnlyOperator=function(V){return V==="is"||V==="is not"};N.isWasOperator=function(V){return V==="was"||V==="was in"||V=="was not in"||V=="was not"};N.isChangedOperator=function(V){return V==="changed"};N.startsWithIgnoreCaseNullsMeanAll=function(V,W){if(W===null||V===null){return true}if(W.length<V.length){return false}else{return V.toLowerCase()==W.substr(0,V.length).toLowerCase()}};N.startsWithNotEqualsIgnoreCaseNullMeansAll=function(V,Y){if(Y===null||V===null){return true}if(Y.length<V.length){return false}else{var W=V.toLowerCase()==Y.substr(0,V.length).toLowerCase();if(W){var X=null;if(z.test(Y.substr(V.length,Y.length))){X=Y.substr(0,V.length)}else{X=Y}return V.toLowerCase()!=X.toLowerCase()}return false}};N.equalsIgnoreCase=function(W,V){if(W===null&&V===null){return true}else{if(W===null||W===null){return false}else{return W.toLowerCase()===V.toLowerCase()}}};N.getSavedResponse=function(V){if(!this.requested){this.requested={}}return this.requested[V]};N.saveResponse=function(W,V){if(typeof W==="string"&&typeof V==="object"){if(!this.requested){this.requested={}}this.requested[W]=V}};N.startsWithIgnoreCase=function(V,W){if(W===null||V===null||W.length<V.length){return false}else{return V.toLowerCase()==W.substr(0,V.length).toLowerCase()}};N.updateParseIndicator=function(V){if(V.getParseError()){M.attr("title",V.getResult().getParseErrorMsg()).removeClass("jqlgood").addClass("jqlerror")}else{M.attr("title","").removeClass("jqlerror").addClass("jqlgood")}};N.updateColumnLineCount=function(){var aa=jQuery(N.field);var Z=0;if(N.field[0]===document.activeElement){var ab=aa.selectionRange();Z=ab.start}else{Z=N.field[0].value.length}var V=1;var X=1;var Y=N.field.val();for(var W=0;W<Z;W++){if(c.test(Y.charAt(W))){V++;X=1}else{X++}}K.text(X);S.text(V)};N.init(T);return N};JIRA.JQLAutoComplete.MyParser=function(J){var I=J;return{parse:function(K){var L=JIRA.JQLAutoComplete.Token();L.init(K);this.jql(L);return L},orderByClause:function(L){var M=L.remainingString();var N=M.match(l);if(N){var K=M.substring(0,N[0].length);L.consumeCharacters(K.length);L.getResult().setLastOrderBy(K,L);if(!L.isComplete()){M=L.remainingString();if(D.test(M)){this.chewWhitespace(L);this.orderByFields(L)}else{L.getResult().resetLogicalOperators();L.setParseError()}}else{L.getResult().resetLogicalOperators();L.setParseError()}}else{L.consumeCharacters(M.length);L.getResult().setLastOrderBy(M,L);L.setParseError()}},orderByFields:function(K){this.orderByField(K);this.chewWhitespace(K);if(K.isComplete()){if(!K.getResult().getNeedsOrderByField()){K.getResult().setLastOrderByDirection("",K)}}else{var L=K.remainingString();if(this.startsWithIgnoreCase(",",L)){K.consumeCharacter();this.orderByFields(K);this.chewWhitespace(K)}else{L=K.remainingString();if(L!==null){K.consumeCharacters(L.length)}K.getResult().setNeedsOrderByDirection();K.getResult().setLastOrderByDirection(L,K);K.setParseError()}}},orderByField:function(K){this.chewWhitespace(K);var M=this.fieldName(K);if(M.length!==0){K.getResult().setLastOrderByFieldName(M,K);var L=K.remainingString();if(!K.isComplete()&&!u.test(L)){if(r.test(L)){this.chewWhitespace(K);K.consumeCharacters(3);K.getResult().setLastOrderByDirection("asc",K);K.getResult().setNeedsOrderByComma()}else{if(H.test(L)){this.chewWhitespace(K);K.consumeCharacters(4);K.getResult().setLastOrderByDirection("desc",K);K.getResult().setNeedsOrderByComma()}else{K.getResult().setNeedsOrderByDirection()}}}else{K.getResult().setNeedsOrderByField();this.chewWhitespace(K)}}else{K.getResult().setLastOrderByFieldName("",K);K.getResult().setNeedsOrderByField();K.setParseError()}},jql:function(K){this.orClause(K);var L=K.remainingString();if(this.startsWithIgnoreCase("ord",L)){this.orderByClause(K)}},orClause:function(K){while(!K.isComplete()&&!this.startsWithIgnoreCase(")",K.remainingString())){this.chewWhitespace(K);var L=K.remainingString();if(this.startsWithIgnoreCase("ord",L)){break}if(K.getResult().getMustBeOperatorOrPredicate()){K.getResult().resetLastPredicates()}else{K.getResult().resetLogicalOperators();this.andClause(K)}if(!K.isComplete()&&K.getResult().getLastLogicalOperator()===null){if(K.getResult().getNeedsWasPredicate()){this.predicateClause(K)}if(K.isComplete()){return}L=K.remainingString();if(this.startsWithIgnoreCase("ord",L)){break}else{if(L!==null&&(A.test(L)||this.startsWithIgnoreCase("|",L)||this.startsWithIgnoreCase("||",L))){if(this.startsWithIgnoreCase("||",L)){K.getResult().setLastLogicalOperator("||",K.getTokenStringIdx());K.consumeCharacters(2)}else{if(A.test(L)){K.getResult().setLastLogicalOperator("OR",K.getTokenStringIdx());K.consumeCharacters(3)}else{K.getResult().setLastLogicalOperator("|",K.getTokenStringIdx());K.consumeCharacters(1)}}K.getResult().resetTerminalClause();if(K.isComplete()){K.setParseError()}K.getResult().setNeedsField()}else{if(!this.startsWithIgnoreCase(")",L)||!K.getInParens()){this.chewWhitespace(K);var N=(L===null)?K.getMaxTokenStringIdx():K.getMaxTokenStringIdx()-L.length;var M;if(L!=null){M=L.split(" ");K.getResult().setLastLogicalOperator(M[0],N);K.getResult().setLastWasPredicate(M[0],K);K.getResult().setNeedsLogicalOperator(K)}if(K.getResult().getLastWasOperator()==null){K.setParseError()}else{if(M!=null){if(j.test(M[0])){K.getResult().setLastLogicalOperator(null);K.getResult().resetNeedsPredicateOperand()}else{if(h.test(L)){K.consumeCharacters(4);K.getResult().resetTerminalClause();K.getResult().setNeedsField()}if(K.isComplete()||M.length==1){K.setParseError()}}}}}}}}}},andClause:function(K){this.chewWhitespace(K);this.notClause(K);if(!K.isComplete()&&K.getResult().getLastLogicalOperator()===null){this.chewWhitespace(K);var L=K.remainingString();if(L!==null&&(h.test(L)||this.startsWithIgnoreCase("&",L)||this.startsWithIgnoreCase("&&",L))){if(this.startsWithIgnoreCase("&&",L)){K.getResult().setLastLogicalOperator("&&",K.getTokenStringIdx());K.consumeCharacters(2)}else{if(this.startsWithIgnoreCase("&",L)){K.getResult().setLastLogicalOperator("&",K.getTokenStringIdx());K.consumeCharacters(1)}else{K.getResult().setLastLogicalOperator("AND",K.getTokenStringIdx());K.consumeCharacters(4)}}K.getResult().resetTerminalClause();if(K.isComplete()){K.setParseError()}K.getResult().setNeedsField()}else{K.getResult().setNeedsLogicalOperator(K);if(K.isComplete()){K.getResult().setLastLogicalOperator(null,K.getMaxTokenStringIdx())}}}},notClause:function(K){this.chewWhitespace(K);if(!K.isComplete()){this.chewWhitespace(K);var L=K.remainingString();if(L!==null&&(e.test(L)||this.startsWithIgnoreCase("!",L))){K.getResult().needsField=false;if(this.startsWithIgnoreCase("!",L)){K.getResult().setLastLogicalOperator("!",K.getTokenStringIdx());K.consumeCharacters(1)}else{K.getResult().setLastLogicalOperator("NOT",K.getTokenStringIdx());K.consumeCharacters(4)}K.getResult().resetTerminalClause();if(K.isComplete()){K.setParseError()}K.getResult().setNeedsField()}else{this.terminalClause(K)}}else{this.terminalClause(K);K.setParseError()}},predicateClause:function(K){this.chewWhitespace(K);if(!K.isComplete()){var L=K.remainingString();var M=L.split(/[\s(]+/);if(L!==null){K.getResult().setMustBeOperatorOrPredicate(false);if(this.startsWithLogicalOperator(L)){if(M.length==1){K.setParseError();K.getResult().resetLogicalOperators();return}return}K.getResult().resetNeedsPredicateOperand();K.consumeCharacters(M[0].length);K.getResult().setLastWasPredicate(M[0],K);if(M.length==1){K.setParseError();return}if(this.wasPredicateComplete(M[0])){K.getResult().setNeedsPredicateOperand();this.predicateOperand(K)}else{K.setParseError()}}}else{K.setParseError()}},predicateOperand:function(L){this.chewWhitespace(L);var K=this.collectPredicateOperands(L);if(K==null||K==""){L.getResult().setLastOperandStartIndex(L.getTokenStringIdx());L.setParseError()}if(L.remainingString()!=null){L.getResult().resetNeedsPredicateOperand();L.getResult().resetLastPredicates();L.getResult().setMustBeOperatorOrPredicate(true);L.getResult().setNeedsLogicalOperator(L);this.chewWhitespace(L)}},collectPredicateOperands:function(L){if(L.getResult().getLastWasPredicate()==="DURING"){L.getResult().setNeedsOpenParen(true)}var K=this.listOperand(L,true);if(K.length===0){K=this.functionOperand(L);if(K.length===0){K=this.singleValueOperand(L)}else{L.getResult().setNeedsOpenParen(false)}}else{L.getResult().setNeedsOpenParen(false)}return L.getResult().getUnquotedString(K)},terminalClause:function(M){M.getResult().resetTerminalClause();this.chewWhitespace(M);var N=M.remainingString();if(this.startsWithIgnoreCase("(",N)){M.getResult().addToken("(");M.setInParens();M.consumeCharacter();this.orClause(M);this.chewWhitespace(M);N=M.remainingString();if(this.startsWithIgnoreCase(")",N)){M.getResult().addToken(")");M.consumeCharacter();M.setOutOfParens();if(M.isComplete()){M.getResult().resetLogicalOperators();M.getResult().resetLastPredicates()}}else{M.setParseError()}}else{this.field(M);if(!M.isComplete()){this.oper(M);if(!M.isComplete()){if(M.getResult().getLastWasOperator()==="changed"){M.getResult().setNeedsLogicalOperator(M);return}this.operand(M);if(M.getResult().getOperandComplete()){var K=M.getResult().getLastWasOperator();M.getResult().setNeedsNothing();if(K){M.getResult().setLastWasOperator(K)}}else{if(M.isComplete()&&!M.getResult().getNeedsListComma()){M.getResult().setNeedsOperand()}}}else{if(M.getResult().getLastOperator()=="was"||M.getResult().getLastOperator()=="was not"){M.getResult().setNeedsOperandOrOperator()}else{if(M.getResult().getLastWasOperator()==="changed"){var L=M.currentCharacter();if(L!==null&&b.test(L)){M.getResult().setNeedsLogicalOperator(M)}else{M.getResult().resetLogicalOperators()}return}else{M.getResult().setNeedsOperator()}}M.setParseError()}}else{M.getResult().setNeedsField();M.setParseError()}}},field:function(K){var L=this.fieldName(K);if(L.length!==0){K.getResult().setLastFieldName(L,K)}else{if(K.getResult().getLastFieldName()===null){remainingString=K.remainingString();K.getResult().setNeedsField();K.getResult().setLastFieldName(remainingString,K);K.setParseError()}}},fieldName:function(M){this.chewWhitespace(M);var O=M.remainingString();if(this.startsWithIgnoreCase("cf",O)){var L=M.getTokenStringIdx();var K=M.remainingString();M.consumeCharacters(2);this.chewWhitespace(M);O=M.remainingString();if(this.startsWithIgnoreCase("[",O)){M.consumeCharacter();O=M.remainingString();var N=this.numberValue(M);if(N.length!==0){this.chewWhitespace(M);O=M.remainingString();if(this.startsWithIgnoreCase("]",O)){M.consumeCharacter();return K.substring(0,M.getTokenStringIdx()-L)}}}M.setParseError();return K}else{return this.fieldOrFunctionName(M)}},oper:function(M){this.chewWhitespace(M);var N=M.remainingString();var L=this.getLongestOperatorMatch(N,F);if(L!==null){M.getResult().setLastOperator(L,M.getTokenStringIdx());if(this.isWasOperator(L)||this.isChangedOperator(L)){M.getResult().setLastWasOperator(L)}M.consumeCharacters(L.length);if(L=="in"||L=="is"||L=="is not"||L=="not in"||L=="was"||L=="was not"||L=="was in"||L=="was not in"){var K=M.currentCharacter();if(K!==null&&!b.test(K)){M.setParseError()}}if(L=="was"){M.getResult().setNeedsOperandOrOperator();this.chewWhitespace(M);var N=M.remainingString();if(N!=null&&(q.test(N)||B.test(N))){M.setParseError()}}else{if(L=="was not"){M.getResult().setNeedsOperandOrOperator();this.chewWhitespace(M);var N=M.remainingString();if(N!=null&&(B.test(N))){M.setParseError()}}else{if(L=="changed"){M.getResult().setNeedsLogicalOperator(M)}else{M.getResult().setNeedsOperand()}}}}else{if(M.getResult().getLastOperator()===null){var O=(N===null)?M.getMaxTokenStringIdx():M.getMaxTokenStringIdx()-N.length;M.getResult().setLastOperator(N,O);M.getResult().setNeedsOperator();M.setParseError()}}},operand:function(L){this.chewWhitespace(L);if(L.getResult().getLastOperator()==="in"||L.getResult().getLastOperator()==="not in"||L.getResult().getLastOperator()==="was not in"||L.getResult().getLastOperator()==="was in"){L.getResult().setNeedsOpenParen(true)}var K=this.listOperand(L,true);if(K.length===0){K=this.functionOperand(L);if(K.length===0){K=this.singleValueOperand(L)}else{L.getResult().setNeedsOpenParen(false)}}else{L.getResult().setNeedsOpenParen(false)}if(K===null||K.length===0){var M=L.remainingString();L.getResult().setLastOperand(M,L);L.getResult().setNeedsOperand();L.setParseError()}if(K.length!==0){return K}return""},singleValueOperand:function(L){var K=this.stringValue(L);if(K.length!==0){L.getResult().setLastOperand(K,L);if(K.toLowerCase()!="empty"&&K.toLowerCase()!="null"&&this.isReservedWord(K.toLowerCase())){L.setParseError()}return K}return""},functionOperand:function(N){var M=N.getTokenStringIdx();var O=this.fieldOrFunctionName(N);this.chewWhitespace(N);var L=this.listOperand(N,false);if(O.length!==0&&L.length!==0){var K=O+L;N.getResult().setLastOperand(K,N);return K}else{N.backTrackToIdx(M);return""}},listOperand:function(L,M){if(L.currentCharacter()=="("){L.consumeCharacter();var K=this.collectListValues(L,M);var N="("+K;this.chewWhitespace(L);if(L.currentCharacter()==")"){L.consumeCharacter();N+=")";if(N=="()"&&M){L.getResult().setLastOperand(N,L)}if(M){L.getResult().setOperandComplete();L.getResult().resetNeedsPredicateOperand()}}else{L.setParseError()}return N}else{return""}},collectListValues:function(M,N){if(N){M.getResult().setNeedsOperand()}this.chewWhitespace(M);var K=(N)?this.operand(M):this.stringValue(M);if(K.length!==0){if(this.chewWhitespace(M)&&N){M.getResult().setNeedsListComma()}if(M.currentCharacter()==","){M.consumeCharacter();var L=this.collectListValues(M,N);if(L.length===0){M.setParseError()}return K+", "+L}else{return K}}else{return""}},startsWithIgnoreCase:function(K,L){if(L===null||K===null||L.length<K.length){return false}else{return K.toLowerCase()==L.substr(0,K.length).toLowerCase()}},startsWithLogicalOperator:function(K){if(K===null){return false}else{return this.startsWithOr(K)||this.startsWithAnd(K)||this.startsWithNot(K)||this.startsWithBraces(K)}},startsWithOr:function(K){return this.startsWithIgnoreCase("|",K)||this.startsWithIgnoreCase("||",K)||this.startsWithIgnoreCase("or",K)},startsWithAnd:function(K){return this.startsWithIgnoreCase("&",K)||this.startsWithIgnoreCase("&&",K)||this.startsWithIgnoreCase("and",K)},startsWithNot:function(K){return this.startsWithIgnoreCase("!",K)||this.startsWithIgnoreCase("not",K)},startsWithBraces:function(K){return this.startsWithIgnoreCase("(",K)||this.startsWithIgnoreCase(")",K)},chewWhitespace:function(M){var L=false;var K=M.currentCharacter();while(K!==null&&D.test(K)){M.consumeCharacter();K=M.currentCharacter();L=true}return L},getLongestOperatorMatch:function(O,K){var L=null;if(this.startsWithIgnoreCase("is",O)){var N=O.substring(2).match(w);if(N){L=O.substring(0,N[0].length+2)}else{L="is"}}if(this.startsWithIgnoreCase("was",O)){var N=O.substring(3).match(m);if(N){L=O.substring(0,N[0].length+3)}else{L="was"}}else{if(this.startsWithIgnoreCase("not",O)){var P=O.substring(3).match(d);if(P){L=O.substring(0,P[0].length+3)}}else{for(var M=0;M<K.length;M++){if(this.startsWithIgnoreCase(K[M].value,O)){if(L===null||F[M].value.length>L){L=F[M].value}}}}}return L},getValueMinusExtraWhitespace:function(N){if(N===null){return null}var O="";var P=true;var L=N.split("");for(var M=0;M<L.length;M++){var K=L[M];if(D.test(K)){if(P){P=false;O=O+K}}else{P=true;O=O+K}}return O},fieldOrFunctionName:function(L){var K=this.stringValue(L);if(K==='""'||K==="''"){L.setParseError()}if(this.isReservedWord(K.toLowerCase())){L.setParseError()}return K},isReservedWord:function(K){return jQuery.inArray(K,I)!==-1},isWasOperator:function(K){return K==="was"||K==="was in"||K=="was not in"||K=="was not"},isChangedOperator:function(K){return K==="changed"},stringValue:function(M){var K="";var P=false;var N=false;var L=M.currentCharacter();while(L!==null&&(P||N||G.test(L))){K=K+L;M.consumeCharacter();if(L=="\\"){L=M.currentCharacter();if(L===null){M.setParseError();break}else{if(C.test(L)){var O=M.remainingString();if(!g.test(O)){M.setParseError();break}}}K=K+L;M.consumeCharacter()}else{if(f.test(L)&&!(P||N)){M.setParseError();break}else{if(L=='"'&&!N){P=!P}else{if(L=="'"&&!P){N=!N}}}}L=M.currentCharacter()}if(M.isComplete()&&(P||N)){M.setParseError()}return K},numberValue:function(L){var M="";this.chewWhitespace(L);var K=L.currentCharacter();while(K!==null){if(a.test(K)){M=M+K;L.consumeCharacter()}else{break}K=L.currentCharacter()}return M},wasPredicateComplete:function(L){var O=false;var N=n.length;for(var M=0,K=N;M<K;++M){if(L.toLowerCase()==n[M].value.toLowerCase()){O=true;break}}return O}}};JIRA.JQLAutoComplete.ParseResult=function(){var J=[];var I=0;return{getTokens:function(){return J},addToken:function(K){J[I++]=K},setLastFieldName:function(L,K){this.fieldNameStartIndex=(L===null)?K.getMaxTokenStringIdx():(K.getTokenStringIdx()-L.length);this.lastFieldName=this.getUnquotedString(L);J[I++]=L},getLastFieldName:function(){return this.lastFieldName},getLastFieldNameStartIndex:function(){return this.fieldNameStartIndex},setLastOrderByFieldName:function(L,K){this.orderByFieldNameStartIndex=(L===null)?K.getMaxTokenStringIdx():(K.getTokenStringIdx()-L.length);this.lastOrderByFieldName=this.getUnquotedString(L);this.lastOrderByDirection=null;J[I++]=L},getLastOrderByFieldName:function(){return this.lastOrderByFieldName},getLastOrderByFieldNameStartIndex:function(){return this.orderByFieldNameStartIndex},setLastOrderByDirection:function(L,K){this.orderByDirectionStartIndex=(L===null)?K.getMaxTokenStringIdx():(K.getTokenStringIdx()-L.length);this.lastOrderByDirection=L;J[I++]=L},getLastOrderByDirection:function(){return this.lastOrderByDirection},getLastOrderByDirectionStartIndex:function(){return this.orderByDirectionStartIndex},setNeedsField:function(){this.needsOperator=false;this.needsOperand=false;this.needsLogicalOperator=false;this.needsOrderBy=false;this.needsField=true;this.needsOrderByField=false;this.needsOrderByDirection=false;this.needsListComma=false;this.needsWasPredicate=false;this.lastWasOperator=null},getNeedsField:function(){return this.needsField},setNeedsOrderByField:function(){this.needsOperator=false;this.needsOperand=false;this.needsLogicalOperator=false;this.needsOrderBy=false;this.needsField=false;this.needsOrderByField=true;this.needsOrderByDirection=false;this.lastOrderByDirection=null;this.needsListComma=false},getNeedsOrderByField:function(){return this.needsOrderByField},setNeedsOrderByDirection:function(){this.needsOperator=false;this.needsOperand=false;this.needsLogicalOperator=false;this.needsOrderBy=false;this.needsField=false;this.needsOrderByField=false;this.needsOrderByDirection=true;this.needsListComma=false},getNeedsOrderByDirection:function(){return this.needsOrderByDirection},setNeedsOrderByComma:function(){this.needsOperator=false;this.needsOperand=false;this.needsLogicalOperator=false;this.needsOrderBy=false;this.needsField=false;this.needsOrderByField=false;this.needsOrderByDirection=false;this.needsListComma=false},setNeedsListComma:function(){this.needsOperator=false;this.needsOperand=false;this.needsLogicalOperator=false;this.needsOrderBy=false;this.needsField=false;this.needsOrderByField=false;this.needsOrderByDirection=false;this.needsListComma=true},getNeedsListComma:function(){return this.needsListComma},setLastOperator:function(K,L){this.lastOperator=K;this.operatorStartIndex=L;J[I++]=K},setLastWasOperator:function(K){this.lastWasOperator=K},getLastWasOperator:function(){return this.lastWasOperator},getLastOperator:function(){return this.lastOperator},getLastOperatorStartIndex:function(){return this.operatorStartIndex},setLastOperand:function(L,K){this.operandStartIndex=(L===null)?K.getMaxTokenStringIdx():(K.getTokenStringIdx()-L.length);this.lastOperand=this.getUnquotedString(L);J[I++]=L},getLastOperand:function(){return this.lastOperand},setNeedsOperand:function(){this.needsField=false;this.needsOperator=false;this.needsLogicalOperator=false;this.needsOperand=true;this.needsOrderBy=false;this.needsOrderByField=false;this.needsOrderByDirection=false;this.needsListComma=false},setNeedsOperandOrOperator:function(){this.needsField=false;this.needsOperator=true;this.needsLogicalOperator=false;this.needsOperand=true;this.needsOrderBy=false;this.needsOrderByField=false;this.needsOrderByDirection=false;this.needsListComma=false},getNeedsOperand:function(){return this.needsOperand},setNeedsPredicateOperand:function(){this.needsPredicateOperand=true},resetNeedsPredicateOperand:function(){this.needsPredicateOperand=false;this.needsOperand=false},getNeedsPredicateOperand:function(){return this.needsPredicateOperand},getLastOperandStartIndex:function(){return this.operandStartIndex},setLastOperandStartIndex:function(K){this.operandStartIndex=K},setLastLogicalOperator:function(K,L){this.lastLogicalOperator=K;this.logicalOperatorStartIndex=L;J[I++]=K},setNeedsOperator:function(){this.needsField=false;this.needsOperand=false;this.needsLogicalOperator=false;this.needsOrderBy=false;this.needsOperator=true;this.needsOrderByField=false;this.needsOrderByDirection=false;this.needsListComma=false},getNeedsOperatorOrOperand:function(){return this.needsOperator&&this.needsOperand},getNeedsOperator:function(){return this.needsOperator},getLastLogicalOperator:function(){return this.lastLogicalOperator},getLastLogicalOperatorStartIndex:function(){return this.logicalOperatorStartIndex},setNeedsLogicalOperator:function(K){this.needsLogicalOperator=true;this.needsOperator=false;this.needsOperand=false;this.needsField=false;this.needsOrderByField=false;this.needsOrderByDirection=false;this.needsListComma=false;this.needsOrderBy=!K.getInParens();if(this.lastWasOperator!=null){this.needsWasPredicate=true}},setNeedsOpenParen:function(K){this.needsOpenParen=K},getNeedsOpenParen:function(){return this.needsOpenParen},getNeedsLogicalOperator:function(){return this.needsLogicalOperator},getNeedsOrderBy:function(){return this.needsOrderBy},getNeedsWasPredicate:function(){return this.needsWasPredicate},setLastWasPredicate:function(K,L){this.wasPredicateStartIndex=(K===null)?L.getMaxTokenStringIdx():(L.getTokenStringIdx()-K.length);this.lastWasPredicate=K;J[I++]=K},getLastWasPredicate:function(){return this.lastWasPredicate},resetLastPredicates:function(){this.lastLogicalOperator=null;this.lastWasPredicate=null;this.lastOperand=null;this.wasPredicateStartIndex=null;this.operandStartIndex=null},getLastWasPredicateStartIndex:function(){return this.wasPredicateStartIndex},setLastOrderBy:function(L,K){this.orderByStartIndex=(L===null)?K.getMaxTokenStringIdx():(K.getTokenStringIdx()-L.length);this.lastOrderBy=L;J[I++]=L},getLastOrderBy:function(){return this.lastOrderBy},getLastOrderByStartIndex:function(){return this.orderByStartIndex},resetLogicalOperators:function(){this.lastLogicalOperator=null;this.logicalOperatorStartIndex=null;this.needsLogicalOperator=null},getUnquotedString:function(K){var L=K!=null&&K.length>=3&&K.charAt(K.length-2)!="\\";if(K!=null&&K.charAt(0)=='"'){K=K.substring(1,K.length);if(K.charAt(K.length-1)=='"'&&L){K=K.substring(0,K.length-1)}}else{if(K!=null&&K.charAt(0)=="'"){K=K.substring(1,K.length);if(K.charAt(K.length-1)=="'"&&L){K=K.substring(0,K.length-1)}}}return K},setParseError:function(K){this.parseError=true;this.parseErrorMsg=K},getParseError:function(){return this.parseError},getParseErrorMsg:function(){return this.parseErrorMsg},setNeedsNothing:function(){this.needsOperator=false;this.needsOperand=false;this.needsLogicalOperator=false;this.needsOrderBy=false;this.needsField=false;this.needsOrderByField=false;this.needsOrderByDirection=false;this.needsOpenParen=false;this.needsListComma=false;this.needsWasPredicate=null;this.needsPredicateOperand=null;this.mustBeOperatorOrPredicate=null;this.lastWasOperator=null},setOperandComplete:function(){this.operandComplete=true},getOperandComplete:function(){return this.operandComplete},setMustBeOperatorOrPredicate:function(K){this.mustBeOperatorOrPredicate=K},getMustBeOperatorOrPredicate:function(){return this.mustBeOperatorOrPredicate},resetTerminalClause:function(){this.lastFieldName=null;this.fieldNameStartIndex=null;this.needsField=null;this.lastOperator=null;this.operatorStartIndex=null;this.needsOperator=null;this.lastOperand=null;this.operandStartIndex=null;this.needsOperand=null;this.operandComplete=null;this.needsOpenParen=null;this.needsListComma=false;this.mustBeOperatorOrPredicate=null},init:function(){this.lastFieldName=null;this.fieldNameStartIndex=null;this.needsField=null;this.lastOperator=null;this.operatorStartIndex=null;this.needsOperator=null;this.lastOperand=null;this.operandStartIndex=null;this.needsOperand=null;this.lastLogicalOperator=null;this.logicalOperatorStartIndex=null;this.lastOrderByFieldName=null;this.lastOrderByFieldNameStartIndex=null;this.lastOrderByDirection=null;this.lastOrderByDirectionStartIndex=null;this.orderByStartIndex=null;this.lastOrderBy=null;this.needsOrderBy=null;this.needsOrderByField=null;this.needsOrderByDirection=null;this.operandComplete=null;this.needsOpenParen=null;this.needsListComma=null;this.wasPredicateStartIndex=null;this.lastWasPredicate=null;this.needsWasPredicate=null;this.needsPredicateOperand=null;this.mustBeOperatorOrPredicate=null;this.lastWasOperator=null}}};JIRA.JQLAutoComplete.Token=function(){return{init:function(I){this.tokenStringIdx=0;this.tokenString=I;this.parseError=false;this.parseErrorMsg=null;this.result=JIRA.JQLAutoComplete.ParseResult();this.result.init();this.inParens=0},consumeCharacter:function(){this.tokenStringIdx++},consumeCharacters:function(I){this.tokenStringIdx=this.tokenStringIdx+I},backTrackToIdx:function(I){this.tokenStringIdx=I;this.parseError=false;this.parseErrorMsg=null;this.result.parseError=false;this.result.parseErrorMsg=null},getTokenStringIdx:function(){return this.tokenStringIdx},currentCharacter:function(){if(this.tokenStringIdx>=this.tokenString.length){return null}return this.tokenString.charAt(this.tokenStringIdx)},remainingString:function(){if(this.tokenStringIdx>=this.tokenString.length){return null}return this.tokenString.substr(this.tokenStringIdx,this.tokenString.length)},getMaxTokenStringIdx:function(){return this.tokenString.length},isComplete:function(){if(this.parseError){return true}return this.tokenStringIdx>=this.tokenString.length},setInParens:function(){this.inParens++},setOutOfParens:function(){if(this.inParens!==0){this.inParens--}},getInParens:function(){return this.inParens!==0},setParseError:function(){this.parseError=true;var J=((this.tokenStringIdx-9)<0)?0:this.tokenStringIdx-9;var I=this.tokenString.substring(J,this.tokenStringIdx-1);this.result.setParseError("..."+I+"^"+this.tokenString.substring(this.tokenStringIdx,this.tokenString.length))},getParseError:function(){return this.parseError},getResult:function(){return this.result}}};jQuery(function(){jQuery(".jql-autocomplete-params").each(function(){var N={};jQuery(this).find("input").each(function(){var O=jQuery(this);N[O.attr("id")]=O.val()});var K=JSON.parse(jQuery("#jqlFieldz").text());var L=JSON.parse(jQuery("#jqlFunctionNamez").text());var M=JSON.parse(jQuery("#jqlReservedWordz").text());var J=JIRA.JQLAutoComplete({fieldID:"jqltext",parser:JIRA.JQLAutoComplete.MyParser(M),queryDelay:0.65,jqlFieldNames:K,jqlFunctionNames:L,minQueryLength:0,allowArrowCarousel:true,autoSelectFirst:false,errorID:"jqlerrormsg"});var I=jQuery("#jqltext");I.unbind("keypress",submitOnEnter).keypress(function(O){if(J.dropdownController===null||!J.dropdownController.displayed||J.selectedIndex<0){if(O.keyCode==13&&!O.ctrlKey&&!O.shiftKey){jQuery("#jqlform").submit();return false}else{return true}}});J.buildResponseContainer();J.parse(I.text());J.updateColumnLineCount();I.click(function(){J.dropdownController.hideDropdown()})})})})();
}catch(e){WRMCB(e)};
;
try {
/* module-key = 'com.atlassian.confluence.extra.team-calendars:timeline-resources', location = 'com/atlassian/confluence/extra/calendar3/lib/timeline.js' */
if(typeof links==="undefined"){links={}}if(typeof google==="undefined"){google=undefined}links.Timeline=function(a){if(!a){return}this.dom={};this.conversion={};this.eventParams={};this.groups=[];this.groupIndexes={};this.items=[];this.renderQueue={show:[],hide:[],update:[]};this.renderedItems=[];this.clusterGenerator=new links.Timeline.ClusterGenerator(this);this.currentClusters=[];this.selection=undefined;this.listeners={};this.size={actualHeight:0,axis:{characterMajorHeight:0,characterMajorWidth:0,characterMinorHeight:0,characterMinorWidth:0,height:0,labelMajorTop:0,labelMinorTop:0,line:0,lineMajorWidth:0,lineMinorHeight:0,lineMinorTop:0,lineMinorWidth:0,top:0},contentHeight:0,contentLeft:0,contentWidth:0,frameHeight:0,frameWidth:0,groupsLeft:0,groupsWidth:0,items:{top:0}};this.dom.container=a;this.options={width:"100%",height:"auto",minHeight:0,autoHeight:true,eventMargin:10,eventMarginAxis:20,dragAreaWidth:10,min:undefined,max:undefined,zoomMin:10,zoomMax:1000*60*60*24*365*10000,moveable:true,zoomable:true,selectable:true,editable:false,snapEvents:true,groupChangeable:true,showCurrentTime:true,showCustomTime:false,showMajorLabels:true,showMinorLabels:true,showNavigation:false,showButtonNew:false,groupsOnRight:false,axisOnTop:false,stackEvents:true,animate:true,animateZoom:true,cluster:false,style:"box",customStackOrder:false,locale:"en",MONTHS:new Array("January","February","March","April","May","June","July","August","September","October","November","December"),DAYS:new Array("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"),MONTHS_SHORT:new Array("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"),DAYS_SHORT:new Array("Sun","Mon","Tue","Wed","Thu","Fri","Sat"),ZOOM_IN:"Zoom in",ZOOM_OUT:"Zoom out",MOVE_LEFT:"Move left",MOVE_RIGHT:"Move right",NEW:"New",CREATE_NEW_EVENT:"Create new event"};this.clientTimeOffset=0;var c=this.dom;while(c.container.hasChildNodes()){c.container.removeChild(c.container.firstChild)}this.step=new links.Timeline.StepDate();this.itemTypes={box:links.Timeline.ItemBox,range:links.Timeline.ItemRange,dot:links.Timeline.ItemDot};this.data=[];this.firstDraw=true;this.setVisibleChartRange(undefined,undefined,false);this.render();var b=this;setTimeout(function(){b.trigger("ready")},0)};links.Timeline.prototype.draw=function(b,a){this.setOptions(a);this.setData(b);if(a&&(a.start||a.end)){this.setVisibleChartRange(a.start,a.end)}else{if(this.firstDraw){this.setVisibleChartRangeAuto()}}this.firstDraw=false};links.Timeline.prototype.setOptions=function(b){if(b){for(var d in b){if(b.hasOwnProperty(d)){this.options[d]=b[d]}}if(typeof links.locales!=="undefined"&&this.options.locale!=="en"){var c=links.locales[this.options.locale];if(c){for(var a in c){if(c.hasOwnProperty(a)){this.options[a]=c[a]}}}}if(b.showButtonAdd!=undefined){this.options.showButtonNew=b.showButtonAdd;console.log("WARNING: Option showButtonAdd is deprecated. Use showButtonNew instead")}if(b.intervalMin!=undefined){this.options.zoomMin=b.intervalMin;console.log("WARNING: Option intervalMin is deprecated. Use zoomMin instead")}if(b.intervalMax!=undefined){this.options.zoomMax=b.intervalMax;console.log("WARNING: Option intervalMax is deprecated. Use zoomMax instead")}if(b.scale&&b.step){this.step.setScale(b.scale,b.step)}}this.options.autoHeight=(this.options.height==="auto")};links.Timeline.prototype.addItemType=function(a,b){this.itemTypes[a]=b};links.Timeline.mapColumnIds=function(b){var c={},f=b.getNumberOfColumns(),e=true;for(var a=0;a<f;a++){var d=b.getColumnId(a)||b.getColumnLabel(a);c[d]=a;if(d=="start"||d=="end"||d=="content"||d=="group"||d=="className"||d=="editable"){e=false}}if(e){c.start=0;c.end=1;c.content=2}return c};links.Timeline.prototype.setData=function(e){this.unselectItem();if(!e){e=[]}this.stackCancelAnimation();this.clearItems();this.data=e;var b=this.items;this.deleteGroups();if(google&&google.visualization&&e instanceof google.visualization.DataTable){var f=links.Timeline.mapColumnIds(e);for(var g=0,d=e.getNumberOfRows();g<d;g++){b.push(this.createItem({start:((f.start!=undefined)?e.getValue(g,f.start):undefined),end:((f.end!=undefined)?e.getValue(g,f.end):undefined),content:((f.content!=undefined)?e.getValue(g,f.content):undefined),group:((f.group!=undefined)?e.getValue(g,f.group):undefined),className:((f.className!=undefined)?e.getValue(g,f.className):undefined),editable:((f.editable!=undefined)?e.getValue(g,f.editable):undefined)}))}}else{if(links.Timeline.isArray(e)){for(var g=0,d=e.length;g<d;g++){var a=e[g];var c=this.createItem(a);b.push(c)}}else{throw"Unknown data type. DataTable or Array expected."}}if(this.options.cluster){this.clusterGenerator.setData(this.items)}this.render({animate:false})};links.Timeline.prototype.getData=function(){return this.data};links.Timeline.prototype.updateData=function(e,j){var d=this.data,a;if(google&&google.visualization&&d instanceof google.visualization.DataTable){var g=(e+1)-d.getNumberOfRows();if(g>0){d.addRows(g)}var f=links.Timeline.mapColumnIds(d);for(a in j){if(j.hasOwnProperty(a)){var b=f[a];if(b==undefined){var h=j[a];var c="string";if(typeof(h)=="number"){c="number"}else{if(typeof(h)=="boolean"){c="boolean"}else{if(h instanceof Date){c="datetime"}}}b=d.addColumn(c,a)}d.setValue(e,b,j[a])}}}else{if(links.Timeline.isArray(d)){var k=d[e];if(k==undefined){k={};d[e]=k}for(a in j){if(j.hasOwnProperty(a)){k[a]=j[a]}}}else{throw"Cannot update data, unknown type of data"}}};links.Timeline.prototype.getItemIndex=function(f){var g=f,j=this.dom,h=j.items.frame,b=this.items,c=undefined;while(g.parentNode&&g.parentNode!==h){g=g.parentNode}if(g.parentNode===h){for(var d=0,a=b.length;d<a;d++){if(b[d].dom===g){c=d;break}}}return c};links.Timeline.prototype.setSize=function(b,a){if(b){this.options.width=b;this.dom.frame.style.width=b}if(a){this.options.height=a;this.options.autoHeight=(this.options.height==="auto");if(a!=="auto"){this.dom.frame.style.height=a}}this.render({animate:false})};links.Timeline.prototype.setVisibleChartRange=function(f,b,e){var c={};if(!f||!b){c=this.getDataRange(true)}if(!f){if(b){if(c.min&&c.min.valueOf()<b.valueOf()){f=c.min}else{f=new Date(b.valueOf());f.setDate(f.getDate()-7)}}else{f=new Date();f.setDate(f.getDate()-3)}}if(!b){if(c.max){b=c.max}else{b=new Date(f.valueOf());b.setDate(b.getDate()+7)}}if(b<=f){b=new Date(f.valueOf());b.setDate(b.getDate()+7)}var d=this.options.min?this.options.min:undefined;if(d!=undefined&&f.valueOf()<d.valueOf()){f=new Date(d.valueOf())}var a=this.options.max?this.options.max:undefined;if(a!=undefined&&b.valueOf()>a.valueOf()){b=new Date(a.valueOf())}this.applyRange(f,b);if(e==undefined||e==true){this.render({animate:false})}else{this.recalcConversion()}};links.Timeline.prototype.setVisibleChartRangeAuto=function(){var a=this.getDataRange(true);this.setVisibleChartRange(a.min,a.max)};links.Timeline.prototype.setVisibleChartRangeNow=function(){var a=new Date();var b=(this.end.valueOf()-this.start.valueOf());var d=new Date(a.valueOf()-b/2);var c=new Date(d.valueOf()+b);this.setVisibleChartRange(d,c)};links.Timeline.prototype.getVisibleChartRange=function(){return{start:new Date(this.start.valueOf()),end:new Date(this.end.valueOf())}};links.Timeline.prototype.getDataRange=function(b){var g=this.items,d=undefined,h=undefined;if(g){for(var f=0,e=g.length;f<e;f++){var k=g[f],a=k.start!=undefined?k.start.valueOf():undefined,c=k.end!=undefined?k.end.valueOf():a;if(d!=undefined&&a!=undefined){d=Math.min(d.valueOf(),a.valueOf())}else{d=a}if(h!=undefined&&c!=undefined){h=Math.max(h,c)}else{h=c}}}if(d&&h&&b){var j=(h-d);d=d-j*0.05;h=h+j*0.05}return{min:d!=undefined?new Date(d):undefined,max:h!=undefined?new Date(h):undefined}};links.Timeline.prototype.render=function(j){var e=this.reflowFrame();var h=this.reflowAxis();var d=this.reflowGroups();var g=this.reflowItems();var f=(e||h||d||g);var a=this.options.animate;if(j&&j.animate!=undefined){a=j.animate}this.recalcConversion();this.clusterItems();this.filterItems();this.stackItems(a);this.recalcItems();var b=this.repaint();if(b){var c=j?j.renderTimesLeft:undefined;if(c==undefined){c=5}if(c>0){this.render({animate:j?j.animate:undefined,renderTimesLeft:(c-1)})}}};links.Timeline.prototype.repaint=function(){var b=this.repaintFrame();var a=this.repaintAxis();var d=this.repaintGroups();var c=this.repaintItems();this.repaintCurrentTime();this.repaintCustomTime();return(b||a||d||c)};links.Timeline.prototype.reflowFrame=function(){var f=this.dom,d=this.options,e=this.size,b=false;var a=f.frame?f.frame.offsetWidth:0,c=f.frame?f.frame.children[0].clientHeight:0;b=b||(e.frameWidth!==a);b=b||(e.frameHeight!==c);e.frameWidth=a;e.frameHeight=c;return b};links.Timeline.prototype.repaintFrame=function(){var b=false,d=this.dom,j=this.options,h=this.size;if(!d.frame){d.frame=document.createElement("DIV");d.frame.className="timeline-frame";d.frame.style.position="relative";d.frame.style.overflowX="hidden";d.frame.style.overflowY="auto";d.container.appendChild(d.frame);b=true}var g=j.autoHeight?(h.actualHeight+"px"):(j.height||"100%");var a=j.width||"100%";b=b||(d.frame.style.height!=g);b=b||(d.frame.style.width!=a);d.frame.style.height=j.viewHeight?j.viewHeight:g;d.frame.style.width=a;if(!d.content){d.content=document.createElement("DIV");d.content.style.position="relative";d.content.style.overflow="hidden";d.frame.appendChild(d.content);var e=document.createElement("DIV");e.style.position="absolute";e.style.left="0px";e.style.top="0px";e.style.height="100%";e.style.width="0px";d.content.appendChild(e);d.contentTimelines=e;var c=this.eventParams,f=this;if(!c.onMouseDown){c.onMouseDown=function(k){f.onMouseDown(k)};links.Timeline.addEventListener(d.content,"mousedown",c.onMouseDown)}if(!c.onTouchStart){c.onTouchStart=function(k){f.onTouchStart(k)};links.Timeline.addEventListener(d.content,"touchstart",c.onTouchStart)}if(!c.onDblClick){c.onDblClick=function(k){f.onDblClick(k)};links.Timeline.addEventListener(d.content,"dblclick",c.onDblClick)}b=true}d.content.style.left=h.contentLeft+"px";d.content.style.top="0px";d.content.style.width=h.contentWidth+"px";d.content.style.height=g;this.repaintNavigation();this.reflowAxis();this.repaintAxis();return b};links.Timeline.prototype.reflowAxis=function(){var j=false,h=this.dom,o=this.options,n=this.size,l=h.axis;var k=(l&&l.characterMinor)?l.characterMinor.clientWidth:0,g=(l&&l.characterMinor)?l.characterMinor.clientHeight:0,b=(l&&l.characterMajor)?l.characterMajor.clientWidth:0,e=(l&&l.characterMajor)?l.characterMajor.clientHeight:0,d=(o.showMinorLabels?g:0)+(o.showMajorLabels?e:0);var f=h.frame?h.frame.children[0].clientHeight:n.frameHeight;var a=o.axisOnTop?0:f-d,c=o.axisOnTop?d:a;j=j||(n.axis.top!==a);j=j||(n.axis.line!==c);j=j||(n.axis.height!==d);n.axis.top=a;n.axis.line=c;n.axis.height=d;n.axis.labelMajorTop=o.axisOnTop?0:c+(o.showMinorLabels?g:0);n.axis.labelMinorTop=o.axisOnTop?(o.showMajorLabels?e:0):c;n.axis.lineMinorTop=o.axisOnTop?n.axis.labelMinorTop:0;n.axis.lineMinorHeight=o.showMajorLabels?n.frameHeight-e:n.frameHeight;if(l&&l.minorLines&&l.minorLines.length){n.axis.lineMinorWidth=l.minorLines[0].offsetWidth}else{n.axis.lineMinorWidth=1}if(l&&l.majorLines&&l.majorLines.length){n.axis.lineMajorWidth=l.majorLines[0].offsetWidth}else{n.axis.lineMajorWidth=1}j=j||(n.axis.characterMinorWidth!==k);j=j||(n.axis.characterMinorHeight!==g);j=j||(n.axis.characterMajorWidth!==b);j=j||(n.axis.characterMajorHeight!==e);n.axis.characterMinorWidth=k;n.axis.characterMinorHeight=g;n.axis.characterMajorWidth=b;n.axis.characterMajorHeight=e;var m=Math.max(n.frameHeight-d,0);n.contentLeft=o.groupsOnRight?0:n.groupsWidth;n.contentWidth=Math.max(n.frameWidth-n.groupsWidth,0);n.contentHeight=m;n.axis.lineMinorHeight=m;return j};links.Timeline.prototype.repaintAxis=function(){var f=false,j=this.dom,r=this.options,q=this.size,e=this.step;var g=j.axis;if(!g){g={};j.axis=g}if(!q.axis.properties){q.axis.properties={}}if(!g.minorTexts){g.minorTexts=[]}if(!g.minorLines){g.minorLines=[]}if(!g.majorTexts){g.majorTexts=[]}if(!g.majorLines){g.majorLines=[]}if(!g.frame){g.frame=document.createElement("DIV");g.frame.style.position="absolute";g.frame.style.left="0px";g.frame.style.top="0px";j.content.appendChild(g.frame)}j.content.removeChild(g.frame);g.frame.style.width=(q.contentWidth)+"px";g.frame.style.height=(q.axis.height)+"px";var d=this.screenToTime(0);var h=this.screenToTime(q.contentWidth);if(q.axis.characterMinorWidth){this.minimumStep=this.screenToTime(q.axis.characterMinorWidth*6)-this.screenToTime(0);e.setRange(d,h,this.minimumStep)}var o=this.repaintAxisCharacters();f=f||o;this.repaintAxisStartOverwriting();e.start();var a=undefined;var l=0;while(!e.end()&&l<1000){l++;var p=e.getCurrent(),n=this.timeToScreen(p),k=e.isMajor();if(r.showMinorLabels){this.repaintAxisMinorText(n,e.getLabelMinor(r))}if(k&&r.showMajorLabels){if(n>0){if(a==undefined){a=n}this.repaintAxisMajorText(n,e.getLabelMajor(r))}this.repaintAxisMajorLine(n)}else{this.repaintAxisMinorLine(n)}e.next()}if(r.showMajorLabels){var c=this.screenToTime(0),m=this.step.getLabelMajor(r,c),b=m.length*q.axis.characterMajorWidth+10;if(a==undefined||b<a){this.repaintAxisMajorText(0,m,c)}}this.repaintAxisEndOverwriting();this.repaintAxisHorizontal();j.content.insertBefore(g.frame,j.content.firstChild);return f};links.Timeline.prototype.repaintAxisCharacters=function(){var c=false,f=this.dom,b=f.axis,e;if(!b.characterMinor){e=document.createTextNode("0");var a=document.createElement("DIV");a.className="timeline-axis-text timeline-axis-text-minor";a.appendChild(e);a.style.position="absolute";a.style.visibility="hidden";a.style.paddingLeft="0px";a.style.paddingRight="0px";b.frame.appendChild(a);b.characterMinor=a;c=true}if(!b.characterMajor){e=document.createTextNode("0");var d=document.createElement("DIV");d.className="timeline-axis-text timeline-axis-text-major";d.appendChild(e);d.style.position="absolute";d.style.visibility="hidden";d.style.paddingLeft="0px";d.style.paddingRight="0px";b.frame.appendChild(d);b.characterMajor=d;c=true}return c};links.Timeline.prototype.repaintAxisStartOverwriting=function(){var a=this.size.axis.properties;a.minorTextNum=0;a.minorLineNum=0;a.majorTextNum=0;a.majorLineNum=0};links.Timeline.prototype.repaintAxisEndOverwriting=function(){var b=this.dom,j=this.size.axis.properties,a=this.dom.axis.frame,e;var l=b.axis.minorTexts;e=j.minorTextNum;while(l.length>e){var c=l[e];a.removeChild(c);l.splice(e,1)}var d=b.axis.minorLines;e=j.minorLineNum;while(d.length>e){var f=d[e];a.removeChild(f);d.splice(e,1)}var m=b.axis.majorTexts;e=j.majorTextNum;while(m.length>e){var h=m[e];a.removeChild(h);m.splice(e,1)}var g=b.axis.majorLines;e=j.majorLineNum;while(g.length>e){var k=g[e];a.removeChild(k);g.splice(e,1)}};links.Timeline.prototype.repaintAxisHorizontal=function(){var e=this.dom.axis,d=this.size,c=this.options;var a=(c.showMinorLabels||c.showMajorLabels);if(a){if(!e.backgroundLine){var f=document.createElement("DIV");f.className="timeline-axis";f.style.position="absolute";f.style.left="0px";f.style.width="100%";f.style.border="none";e.frame.insertBefore(f,e.frame.firstChild);e.backgroundLine=f}if(e.backgroundLine){e.backgroundLine.style.top=d.axis.top+"px";e.backgroundLine.style.height=d.axis.height+"px"}}else{if(e.backgroundLine){e.frame.removeChild(e.backgroundLine);delete e.backgroundLine}}if(a){if(e.line){var b=e.frame.removeChild(e.line);e.frame.appendChild(b)}else{var b=document.createElement("DIV");b.className="timeline-axis";b.style.position="absolute";b.style.left="0px";b.style.width="100%";b.style.height="0px";e.frame.appendChild(b);e.line=b}e.line.style.top=d.axis.line+"px"}else{if(e.line&&e.line.parentElement){e.frame.removeChild(e.line);delete e.line}}};links.Timeline.prototype.repaintAxisMinorText=function(h,j){var k=this.size,b=this.dom,e=k.axis.properties,a=b.axis.frame,g=b.axis.minorTexts,c=e.minorTextNum,f;if(c<g.length){f=g[c]}else{var d=document.createTextNode("");f=document.createElement("DIV");f.appendChild(d);f.className="timeline-axis-text timeline-axis-text-minor";f.style.position="absolute";a.appendChild(f);g.push(f)}f.childNodes[0].nodeValue=j;f.style.left=(h-8)+"px";f.style.top=k.axis.labelMinorTop+"px";e.minorTextNum++};links.Timeline.prototype.repaintAxisMinorLine=function(a){var e=this.size.axis,h=this.dom,d=e.properties,g=h.axis.frame,f=h.axis.minorLines,c=d.minorLineNum,b;if(c<f.length){b=f[c]}else{b=document.createElement("DIV");b.className="timeline-axis-grid timeline-axis-grid-minor";b.style.position="absolute";b.style.width="0px";g.appendChild(b);f.push(b)}b.style.top=e.lineMinorTop+"px";b.style.height=e.lineMinorHeight+"px";b.style.left=(a-e.lineMinorWidth/2)+"px";d.minorLineNum++};links.Timeline.prototype.repaintAxisMajorText=function(f,h){var j=this.size,d=j.axis.properties,a=this.dom.axis.frame,g=this.dom.axis.majorTexts,b=d.majorTextNum,e;if(b<g.length){e=g[b]}else{var c=document.createTextNode(h);e=document.createElement("DIV");e.className="timeline-axis-text timeline-axis-text-major";e.appendChild(c);e.style.position="absolute";e.style.top="0px";a.appendChild(e);g.push(e)}e.childNodes[0].nodeValue=h;e.style.top=j.axis.labelMajorTop+"px";e.style.left=f+"px";d.majorTextNum++};links.Timeline.prototype.repaintAxisMajorLine=function(a){var e=this.size,g=e.axis.properties,f=this.size.axis,h=this.dom.axis.frame,d=this.dom.axis.majorLines,c=g.majorLineNum,b;if(c<d.length){b=d[c]}else{b=document.createElement("DIV");b.className="timeline-axis-grid timeline-axis-grid-major";b.style.position="absolute";b.style.top="0px";b.style.width="0px";h.appendChild(b);d.push(b)}b.style.left=(a-f.lineMajorWidth/2)+"px";b.style.height=e.contentHeight+"px";g.majorLineNum++};links.Timeline.prototype.reflowItems=function(){var g=false,f,e,h,d=this.groups,c=this.renderedItems;if(d){AJS.$.each(d,function(m,l){l.itemsHeight=0})}for(f=0,e=c.length;f<e;f++){var k=c[f],a=k.dom;h=k.group;if(a){var b=a?a.clientWidth:0;var j=a?a.clientHeight:0;g=g||(k.width!=b);g=g||(k.height!=j);k.width=b;k.height=j;k.reflow()}if(h){h.itemsHeight=h.itemsHeight?Math.max(h.itemsHeight,k.height):k.height}}return g};links.Timeline.prototype.recalcItems=function(){var q=false,p,l,r,t,f,d,s=this.groups,k=this.size,b=this.options,n=this.renderedItems;var a=0;if(s.length==0){if(b.autoHeight||b.cluster){var m=0,o=0;if(this.stack&&this.stack.finalItems){f=this.stack.finalItems;t=f[0];if(t&&t.top){m=t.top;o=t.top+t.height}for(p=1,l=f.length;p<l;p++){t=f[p];m=Math.min(m,t.top);o=Math.max(o,t.top+t.height)}}else{r=n[0];if(r&&r.top){m=r.top;o=r.top+r.height}for(p=1,l=n.length;p<l;p++){r=n[p];if(r.top){m=Math.min(m,r.top);o=Math.max(o,(r.top+r.height))}}}a=(o-m)+2*b.eventMarginAxis+k.axis.height;if(a<b.minHeight){a=b.minHeight}if(k.actualHeight!=a&&b.autoHeight&&!b.axisOnTop){var g=a-k.actualHeight;if(this.stack&&this.stack.finalItems){f=this.stack.finalItems;for(p=0,l=f.length;p<l;p++){f[p].top+=g;f[p].item.top+=g}}else{for(p=0,l=n.length;p<l;p++){n[p].top+=g}}}}}else{a=k.axis.height+2*b.eventMarginAxis;for(p=0,l=s.length;p<l;p++){d=s[p];var j=Math.max(d.labelHeight||0,d.itemsHeight||0);q=q||(j!=d.height);d.height=j;a+=s[p].height+b.eventMargin}var c=b.eventMargin,h=b.axisOnTop?b.eventMarginAxis+c/2:k.contentHeight-b.eventMarginAxis+c/2,e=k.axis.height;for(p=0,l=s.length;p<l;p++){d=s[p];if(b.axisOnTop){d.top=h+e;d.labelTop=h+e+(d.height-d.labelHeight)/2;d.lineTop=h+e+d.height+c/2;h+=d.height+c}else{h-=d.height+c;d.top=h;d.labelTop=h+(d.height-d.labelHeight)/2;d.lineTop=h-c/2}}for(p=0,l=n.length;p<l;p++){r=n[p];d=r.group;if(d){r.top=d.top}}q=true}if(a<b.minHeight){a=b.minHeight}q=q||(a!=k.actualHeight);k.actualHeight=a;return q};links.Timeline.prototype.clearItems=function(){var a=this.renderQueue.hide;AJS.$.each(this.renderedItems,function(c,b){a.push(b)});this.clusterGenerator.clear();this.items=[]};links.Timeline.prototype.repaintItems=function(){var h,g,n,k;var d=false,f=this.dom,o=this.size,m=this,b=this.renderedItems;if(!f.items){f.items={}}var a=f.items.frame;if(!a){a=document.createElement("DIV");a.style.position="relative";f.content.appendChild(a);f.items.frame=a}a.style.left="0px";a.style.top=o.items.top+"px";a.style.height="0px";f.content.removeChild(a);var j=this.renderQueue;var c=[];d=d||(j.show.length>0)||(j.update.length>0)||(j.hide.length>0);while(n=j.show.shift()){n.showDOM(a);n.getImageUrls(c);b.push(n)}while(n=j.update.shift()){n.updateDOM(a);n.getImageUrls(c);k=AJS.$.inArray(n,this.renderedItems);if(k==-1){b.push(n)}}while(n=j.hide.shift()){n.hideDOM(a);k=AJS.$.inArray(n,this.renderedItems);if(k!=-1){b.splice(k,1)}}AJS.$.each(b,function(q,p){p.updatePosition(m)});this.repaintDeleteButton();this.repaintDragAreas();f.content.appendChild(a);if(c.length){var l=function(){m.render()};var e=false;links.imageloader.loadAll(c,l,e)}return d};links.Timeline.prototype.reflowGroups=function(){var f=false,m=this.options,l=this.size,d=this.dom;var j=0;var b=this.groups;var g=this.dom.groups?this.dom.groups.labels:[];for(var e=0,c=b.length;e<c;e++){var k=b[e];var h=g[e];k.labelWidth=h?h.clientWidth:0;k.labelHeight=h?h.clientHeight:0;k.width=k.labelWidth;j=Math.max(j,k.width)}if(m.groupsWidth!==undefined){j=d.groups.frame?d.groups.frame.clientWidth:0}j+=1;var a=m.groupsOnRight?l.frameWidth-j:0;f=f||(l.groupsWidth!==j);f=f||(l.groupsLeft!==a);l.groupsWidth=j;l.groupsLeft=a;return f};links.Timeline.prototype.repaintGroups=function(){var u=this.dom,f=this,b=this.options,n=this.size,w=this.groups;if(u.groups===undefined){u.groups={}}var v=u.groups.labels;if(!v){v=[];u.groups.labels=v}var g=u.groups.labelLines;if(!g){g=[];u.groups.labelLines=g}var o=u.groups.itemLines;if(!o){o=[];u.groups.itemLines=o}var m=u.groups.frame;if(!m){m=document.createElement("DIV");m.className="timeline-groups-axis";m.style.position="absolute";m.style.overflow="hidden";m.style.top="0px";m.style.height="100%";u.frame.appendChild(m);u.groups.frame=m}m.style.left=n.groupsLeft+"px";m.style.width=(b.groupsWidth!==undefined)?b.groupsWidth:n.groupsWidth+"px";if(w.length==0){m.style.display="none"}else{m.style.display=""}var q=v.length,k=w.length;for(var s=0,r=Math.min(q,k);s<r;s++){var h=w[s];var j=v[s];j.innerHTML=this.getGroupName(h);j.style.display=""}for(var s=q;s<k;s++){var h=w[s];var j=document.createElement("DIV");j.className="timeline-groups-text";j.style.position="absolute";if(b.groupsWidth===undefined){j.style.whiteSpace="nowrap"}j.innerHTML=this.getGroupName(h);m.appendChild(j);v[s]=j;var e=document.createElement("DIV");e.className="timeline-axis-grid timeline-axis-grid-minor";e.style.position="absolute";e.style.left="0px";e.style.width="100%";e.style.height="0px";e.style.borderTopStyle="solid";m.appendChild(e);g[s]=e;var d=document.createElement("DIV");d.className="timeline-axis-grid timeline-axis-grid-minor";d.style.position="absolute";d.style.left="0px";d.style.width="100%";d.style.height="0px";d.style.borderTopStyle="solid";u.content.insertBefore(d,u.content.firstChild);o[s]=d}for(var s=k;s<q;s++){var j=v[s],e=g[s],d=o[s];m.removeChild(j);m.removeChild(e);u.content.removeChild(d)}v.splice(k,q-k);g.splice(k,q-k);o.splice(k,q-k);m.style.borderStyle=b.groupsOnRight?"none none none solid":"none solid none none";for(var s=0,r=w.length;s<r;s++){var h=w[s],j=v[s],e=g[s],d=o[s];j.style.top=h.labelTop+"px";e.style.top=h.lineTop+"px";d.style.top=h.lineTop+"px";d.style.width=n.contentWidth+"px"}if(!u.groups.background){var t=document.createElement("DIV");t.className="timeline-axis";t.style.position="absolute";t.style.left="0px";t.style.width="100%";t.style.border="none";m.appendChild(t);u.groups.background=t}u.groups.background.style.top=n.axis.top+"px";u.groups.background.style.height=n.axis.height+"px";if(!u.groups.line){var l=document.createElement("DIV");l.className="timeline-axis";l.style.position="absolute";l.style.left="0px";l.style.width="100%";l.style.height="0px";m.appendChild(l);u.groups.line=l}u.groups.line.style.top=n.axis.line+"px";if(u.groups.frame&&w.length){var p=[];links.imageloader.filterImageUrls(u.groups.frame,p);if(p.length){var c=function(){f.render()};var a=false;links.imageloader.loadAll(p,c,a)}}};links.Timeline.prototype.repaintCurrentTime=function(){var l=this.options,e=this.dom,k=this.size;if(!l.showCurrentTime){if(e.currentTime){e.contentTimelines.removeChild(e.currentTime);delete e.currentTime}return}if(!e.currentTime){var a=document.createElement("DIV");a.className="timeline-currenttime";a.style.position="absolute";a.style.top="0px";a.style.height="100%";e.contentTimelines.appendChild(a);e.currentTime=a}else{e.currentTime.style.height=k.contentHeight+"px"}var b=new Date();var f=new Date(b.valueOf()+this.clientTimeOffset);var h=this.timeToScreen(f);var d=(h>-k.contentWidth&&h<2*k.contentWidth);e.currentTime.style.display=d?"":"none";e.currentTime.style.left=h+"px";e.currentTime.title="Current time: "+f;if(this.currentTimeTimer!=undefined){clearTimeout(this.currentTimeTimer);delete this.currentTimeTimer}var j=this;var g=function(){j.repaintCurrentTime()};var c=1/this.conversion.factor/2;if(c<30){c=30}this.currentTimeTimer=setTimeout(g,c)};links.Timeline.prototype.repaintCustomTime=function(){var c=this.options,g=this.dom,d=this.size;if(!c.showCustomTime){if(g.customTime){g.contentTimelines.removeChild(g.customTime);delete g.customTime}return}if(!g.customTime){var b=document.createElement("DIV");b.className="timeline-customtime";b.style.position="absolute";b.style.top="0px";b.style.height="100%";var e=document.createElement("DIV");e.style.position="relative";e.style.top="0px";e.style.left="-10px";e.style.height="100%";e.style.width="20px";b.appendChild(e);g.contentTimelines.appendChild(b);g.customTime=b;this.customTime=new Date()}var a=this.timeToScreen(this.customTime),f=(a>-d.contentWidth&&a<2*d.contentWidth);g.customTime.style.display=f?"":"none";g.customTime.style.left=a+"px";g.customTime.title="Time: "+this.customTime};links.Timeline.prototype.repaintDeleteButton=function(){var d=this,g=this.dom,f=g.items.frame;var h=g.items.deleteButton;if(!h){h=document.createElement("DIV");h.className="timeline-navigation-delete";h.style.position="absolute";f.appendChild(h);g.items.deleteButton=h}var a=this.selection?this.selection.index:-1,c=this.selection?this.items[a]:undefined;if(c&&c.rendered&&this.isEditable(c)){var b=c.getRight(this),e=c.top;h.style.left=b+"px";h.style.top=e+"px";h.style.display="";f.removeChild(h);f.appendChild(h)}else{h.style.display="none"}};links.Timeline.prototype.repaintDragAreas=function(){var k=this,m=this.options,d=this.dom,a=this.dom.items.frame;var c=d.items.dragLeft;if(!c){c=document.createElement("DIV");c.className="timeline-event-range-drag-left";c.style.position="absolute";a.appendChild(c);d.items.dragLeft=c}var e=d.items.dragRight;if(!e){e=document.createElement("DIV");e.className="timeline-event-range-drag-right";e.style.position="absolute";a.appendChild(e);d.items.dragRight=e}var f=this.selection?this.selection.index:-1,l=this.selection?this.items[f]:undefined;if(l&&l.rendered&&this.isEditable(l)&&(l instanceof links.Timeline.ItemRange)){var b=this.timeToScreen(l.start),h=this.timeToScreen(l.end),g=l.top,j=l.height;c.style.left=b+"px";c.style.top=g+"px";c.style.width=m.dragAreaWidth+"px";c.style.height=j+"px";c.style.display="";a.removeChild(c);a.appendChild(c);e.style.left=(h-m.dragAreaWidth)+"px";e.style.top=g+"px";e.style.width=m.dragAreaWidth+"px";e.style.height=j+"px";e.style.display="";a.removeChild(e);a.appendChild(e)}else{c.style.display="none";e.style.display="none"}};links.Timeline.prototype.repaintNavigation=function(){var l=this,m=this.options,g=this.dom,e=g.frame,f=g.navBar;if(!f){var a=m.showButtonNew&&m.editable;var d=m.showNavigation&&(m.zoomable||m.moveable);if(d||a){f=document.createElement("DIV");f.style.position="absolute";f.className="timeline-navigation";if(m.groupsOnRight){f.style.left="10px"}else{f.style.right="32px"}if(m.axisOnTop){f.style.bottom="10px"}else{f.style.top="10px"}g.navBar=f;g.container.appendChild(f)}if(a){f.addButton=document.createElement("DIV");f.addButton.className="timeline-navigation-new";f.addButton.title=m.CREATE_NEW_EVENT;var j=function(o){links.Timeline.preventDefault(o);links.Timeline.stopPropagation(o);var t=l.size.contentWidth;var s=t/2;var v=l.screenToTime(s-t/10);var n=l.screenToTime(s+t/10);if(m.snapEvents){l.step.snap(v);l.step.snap(n)}var q=m.NEW;var u=l.groups.length?l.groups[0].content:undefined;var r=true;l.addItem({start:v,end:n,content:q,group:u},r);var p=(l.items.length-1);l.selectItem(p);l.applyAdd=true;l.trigger("add");if(l.applyAdd){l.render({animate:false});l.selectItem(p)}else{l.deleteItem(p)}};links.Timeline.addEventListener(f.addButton,"mousedown",j);f.appendChild(f.addButton)}if(a&&d){f.addButton.style.borderRightWidth="1px";f.addButton.style.borderRightStyle="solid"}if(d){if(m.zoomable){f.zoomInButton=document.createElement("DIV");f.zoomInButton.className="timeline-navigation-zoom-in";f.zoomInButton.title=this.options.ZOOM_IN;var c=function(n){links.Timeline.preventDefault(n);links.Timeline.stopPropagation(n);l.zoom(0.4);l.trigger("rangechange");l.trigger("rangechanged")};links.Timeline.addEventListener(f.zoomInButton,"mousedown",c);f.appendChild(f.zoomInButton);f.zoomOutButton=document.createElement("DIV");f.zoomOutButton.className="timeline-navigation-zoom-out";f.zoomOutButton.title=this.options.ZOOM_OUT;var h=function(n){links.Timeline.preventDefault(n);links.Timeline.stopPropagation(n);l.zoom(-0.4);l.trigger("rangechange");l.trigger("rangechanged")};links.Timeline.addEventListener(f.zoomOutButton,"mousedown",h);f.appendChild(f.zoomOutButton)}if(m.moveable){f.moveLeftButton=document.createElement("DIV");f.moveLeftButton.className="timeline-navigation-move-left";f.moveLeftButton.title=this.options.MOVE_LEFT;var k=function(n){links.Timeline.preventDefault(n);links.Timeline.stopPropagation(n);l.move(-0.2);l.trigger("rangechange");l.trigger("rangechanged")};links.Timeline.addEventListener(f.moveLeftButton,"mousedown",k);f.appendChild(f.moveLeftButton);f.moveRightButton=document.createElement("DIV");f.moveRightButton.className="timeline-navigation-move-right";f.moveRightButton.title=this.options.MOVE_RIGHT;var b=function(n){links.Timeline.preventDefault(n);links.Timeline.stopPropagation(n);l.move(0.2);l.trigger("rangechange");l.trigger("rangechanged")};links.Timeline.addEventListener(f.moveRightButton,"mousedown",b);f.appendChild(f.moveRightButton)}}}};links.Timeline.prototype.setCurrentTime=function(b){var a=new Date();this.clientTimeOffset=(b.valueOf()-a.valueOf());this.repaintCurrentTime()};links.Timeline.prototype.getCurrentTime=function(){var a=new Date();return new Date(a.valueOf()+this.clientTimeOffset)};links.Timeline.prototype.setCustomTime=function(a){this.customTime=new Date(a.valueOf());this.repaintCustomTime()};links.Timeline.prototype.getCustomTime=function(){return new Date(this.customTime.valueOf())};links.Timeline.prototype.setScale=function(b,a){this.step.setScale(b,a);this.render()};links.Timeline.prototype.setAutoScale=function(a){this.step.setAutoScale(a);this.render()};links.Timeline.prototype.redraw=function(){this.setData(this.data)};links.Timeline.prototype.checkResize=function(){this.render()};links.Timeline.prototype.isEditable=function(a){if(a){if(a.editable!=undefined){return a.editable}else{return this.options.editable}}return false};links.Timeline.prototype.recalcConversion=function(){this.conversion.offset=this.start.valueOf();this.conversion.factor=this.size.contentWidth/(this.end.valueOf()-this.start.valueOf())};links.Timeline.prototype.screenToTime=function(a){var b=this.conversion;return new Date(a/b.factor+b.offset)};links.Timeline.prototype.timeToScreen=function(b){var a=this.conversion;return(b.valueOf()-a.offset)*a.factor};links.Timeline.prototype.onTouchStart=function(c){var e=this.eventParams,b=this;if(e.touchDown){return}e.touchDown=true;e.zoomed=false;this.onMouseDown(c);if(!e.onTouchMove){e.onTouchMove=function(f){b.onTouchMove(f)};links.Timeline.addEventListener(document,"touchmove",e.onTouchMove)}if(!e.onTouchEnd){e.onTouchEnd=function(f){b.onTouchEnd(f)};links.Timeline.addEventListener(document,"touchend",e.onTouchEnd)}var d=links.Timeline.getTarget(c);var a=this.getItemIndex(d);e.doubleTapStartPrev=e.doubleTapStart;e.doubleTapStart=(new Date()).valueOf();e.doubleTapItemPrev=e.doubleTapItem;e.doubleTapItem=a;links.Timeline.preventDefault(c)};links.Timeline.prototype.onTouchMove=function(d){var g=this.eventParams;if(d.scale&&d.scale!==1){g.zoomed=true}if(!g.zoomed){this.onMouseMove(d)}else{if(this.options.zoomable){g.zoomed=true;var f=d.scale,b=(g.end.valueOf()-g.start.valueOf()),c=b/f,e=c-b,h=new Date(parseInt(g.start.valueOf()-e/2)),a=new Date(parseInt(g.end.valueOf()+e/2));this.setVisibleChartRange(h,a);this.trigger("rangechange")}}links.Timeline.preventDefault(d)};links.Timeline.prototype.onTouchEnd=function(d){var f=this.eventParams;var c=this;f.touchDown=false;if(f.zoomed){this.trigger("rangechanged")}if(f.onTouchMove){links.Timeline.removeEventListener(document,"touchmove",f.onTouchMove);delete f.onTouchMove}if(f.onTouchEnd){links.Timeline.removeEventListener(document,"touchend",f.onTouchEnd);delete f.onTouchEnd}this.onMouseUp(d);var g=500;var a=(new Date()).valueOf();var e=links.Timeline.getTarget(d);var b=this.getItemIndex(e);if(f.doubleTapStartPrev&&(a-f.doubleTapStartPrev)<g&&f.doubleTapItem==f.doubleTapItemPrev){f.touchDown=true;c.onDblClick(d);f.touchDown=false}links.Timeline.preventDefault(d)};links.Timeline.prototype.onMouseDown=function(b){b=b||window.event;var e=this.eventParams,q=this.options,f=this.dom;var p=b.which?(b.which==1):(b.button==1);if(!p&&!e.touchDown){return}e.mouseX=links.Timeline.getPageX(b);e.mouseY=links.Timeline.getPageY(b);e.frameLeft=links.Timeline.getAbsoluteLeft(this.dom.content);e.frameTop=links.Timeline.getAbsoluteTop(this.dom.content);e.previousLeft=0;e.previousOffset=0;e.moved=false;e.start=new Date(this.start.valueOf());e.end=new Date(this.end.valueOf());e.target=links.Timeline.getTarget(b);var d=(f.items&&f.items.dragLeft)?f.items.dragLeft:undefined;var g=(f.items&&f.items.dragRight)?f.items.dragRight:undefined;e.itemDragLeft=(e.target===d);e.itemDragRight=(e.target===g);if(e.itemDragLeft||e.itemDragRight){e.itemIndex=this.selection?this.selection.index:undefined}else{e.itemIndex=this.getItemIndex(e.target)}e.customTime=(e.target===f.customTime||e.target.parentNode===f.customTime)?this.customTime:undefined;e.addItem=(q.editable&&b.ctrlKey);if(e.addItem){var l=e.mouseX-e.frameLeft;var k=e.mouseY-e.frameTop;var n=this.screenToTime(l);if(q.snapEvents){this.step.snap(n)}var a=new Date(n.valueOf());var h=q.NEW;var m=this.getGroupFromHeight(k);this.addItem({start:n,end:a,content:h,group:this.getGroupName(m)});e.itemIndex=(this.items.length-1);this.selectItem(e.itemIndex);e.itemDragRight=true}var o=this.items[e.itemIndex];var c=this.isSelected(e.itemIndex);e.editItem=c&&this.isEditable(o);if(e.editItem){e.itemStart=o.start;e.itemEnd=o.end;e.itemGroup=o.group;e.itemLeft=o.start?this.timeToScreen(o.start):undefined;e.itemRight=o.end?this.timeToScreen(o.end):undefined}else{this.dom.frame.style.cursor="move"}if(!e.touchDown){var j=this;if(!e.onMouseMove){e.onMouseMove=function(r){j.onMouseMove(r)};links.Timeline.addEventListener(document,"mousemove",e.onMouseMove)}if(!e.onMouseUp){e.onMouseUp=function(r){j.onMouseUp(r)};links.Timeline.addEventListener(document,"mouseup",e.onMouseUp)}links.Timeline.preventDefault(b)}};links.Timeline.prototype.onMouseMove=function(w){w=w||window.event;var D=this.eventParams,r=this.size,z=this.dom,e=this.options;var m=links.Timeline.getPageX(w);var k=links.Timeline.getPageY(w);if(D.mouseX==undefined){D.mouseX=m}if(D.mouseY==undefined){D.mouseY=k}var t=m-D.mouseX;var s=k-D.mouseY;if(Math.abs(t)>=1){D.moved=true}if(D.customTime){var o=this.timeToScreen(D.customTime);var q=o+t;this.customTime=this.screenToTime(q);this.repaintCustomTime();this.trigger("timechange")}else{if(D.editItem){this.trigger("moved");var B=this.items[D.itemIndex],f,C;if(D.itemDragLeft){f=D.itemLeft+t;C=D.itemRight;B.start=this.screenToTime(f);if(e.snapEvents){this.step.snap(B.start);f=this.timeToScreen(B.start)}if(f>C){f=C;B.start=this.screenToTime(f)}}else{if(D.itemDragRight){f=D.itemLeft;C=D.itemRight+t;B.end=this.screenToTime(C);if(e.snapEvents){this.step.snap(B.end);C=this.timeToScreen(B.end)}if(C<f){C=f;B.end=this.screenToTime(C)}}else{f=D.itemLeft+t;B.start=this.screenToTime(f);if(e.snapEvents){this.step.snap(B.start);f=this.timeToScreen(B.start)}if(B.end){C=f+(D.itemRight-D.itemLeft);B.end=this.screenToTime(C)}}}B.setPosition(f,C);var u=D.itemDragLeft||D.itemDragRight;if(this.groups.length&&!u){var n=k-D.frameTop;var j=this.getGroupFromHeight(n);if(e.groupsChangeable&&B.group!==j){var g=AJS.$.inArray(B,this.items);this.changeItem(g,{group:this.getGroupName(j)})}else{this.repaintDeleteButton();this.repaintDragAreas()}}else{this.render()}}else{if(e.moveable){var A=(D.end.valueOf()-D.start.valueOf());var E=Math.round((-t)/r.contentWidth*A);var b=new Date(D.start.valueOf()+E);var a=new Date(D.end.valueOf()+E);this.applyRange(b,a);var l=(this.start.valueOf()-b.valueOf());if(l){E+=l}this.recalcConversion();var d=D.previousLeft||0;var v=parseFloat(z.items.frame.style.left)||0;var p=D.previousOffset||0;var c=p+(v-d);var h=-E/A*r.contentWidth+c;z.items.frame.style.left=(h)+"px";D.previousOffset=c;D.previousLeft=parseFloat(z.items.frame.style.left)||h;this.repaintCurrentTime();this.repaintCustomTime();this.repaintAxis();this.trigger("rangechange")}}}links.Timeline.preventDefault(w)};links.Timeline.prototype.onMouseUp=function(d){var e=this.eventParams,a=this.options;d=d||window.event;this.dom.frame.style.cursor="auto";if(e.onMouseMove){links.Timeline.removeEventListener(document,"mousemove",e.onMouseMove);delete e.onMouseMove}if(e.onMouseUp){links.Timeline.removeEventListener(document,"mouseup",e.onMouseUp);delete e.onMouseUp}if(e.customTime){this.trigger("timechanged")}else{if(e.editItem){var c=this.items[e.itemIndex];if(e.moved||e.addItem){this.applyChange=true;this.applyAdd=true;this.updateData(e.itemIndex,{start:c.start,end:c.end});this.trigger(e.addItem?"add":"change");if(e.addItem){if(this.applyAdd){this.updateData(e.itemIndex,{start:c.start,end:c.end,content:c.content,group:this.getGroupName(c.group)})}else{this.deleteItem(e.itemIndex)}}else{if(this.applyChange){this.updateData(e.itemIndex,{start:c.start,end:c.end})}else{delete this.applyChange;delete this.applyAdd;var c=this.items[e.itemIndex],b=c.dom;c.start=e.itemStart;c.end=e.itemEnd;c.group=e.itemGroup;c.setPosition(e.itemLeft,e.itemRight)}}if(this.options.cluster){this.clusterGenerator.updateData()}this.render()}}else{if(!e.moved&&!e.zoomed){if(e.target===this.dom.items.deleteButton){if(this.selection){this.confirmDeleteItem(this.selection.index)}}else{if(a.selectable){if(e.itemIndex!=undefined){if(!this.isSelected(e.itemIndex)){this.selectItem(e.itemIndex);this.trigger("select")}}else{this.unselectItem();this.trigger("select")}}}}else{this.render();if((e.moved&&a.moveable)||(e.zoomed&&a.zoomable)){this.trigger("rangechanged")}}}}};links.Timeline.prototype.onDblClick=function(d){var f=this.eventParams,a=this.options,e=this.dom,b=this.size;d=d||window.event;if(f.itemIndex!=undefined){var c=this.items[f.itemIndex];if(c&&this.isEditable(c)){this.trigger("edit")}}else{if(a.editable){this.trigger("add")}}links.Timeline.preventDefault(d)};links.Timeline.prototype.onMouseWheel=function(c){if(!this.options.zoomable){return}if(!c){c=window.event}var d=0;if(c.wheelDelta){d=c.wheelDelta/120}else{if(c.detail){d=-c.detail/3}}if(d){var b=this;var a=function(){var g=d/5;var f=links.Timeline.getAbsoluteLeft(b.dom.content);var e=links.Timeline.getPageX(c);var h=(e!=undefined&&f!=undefined)?b.screenToTime(e-f):undefined;b.zoom(g,h);b.trigger("rangechange");b.trigger("rangechanged")};a()}links.Timeline.preventDefault(c)};links.Timeline.prototype.zoom=function(g,h){if(h==undefined){h=new Date((this.start.valueOf()+this.end.valueOf())/2)}if(g>=1){g=0.9}if(g<=-1){g=-0.9}if(g<0){g=g/(1+g)}var e=(this.start.valueOf()-h);var d=(this.end.valueOf()-h);var a=new Date(this.start.valueOf()-e*g);var f=new Date(this.end.valueOf()-d*g);var c=(f.valueOf()-a.valueOf());var b=Number(this.options.zoomMin)||10;if(b<10){b=10}if(c>=b){this.applyRange(a,f,h);this.render({animate:this.options.animate&&this.options.animateZoom})}};links.Timeline.prototype.move=function(b){var d=(this.end.valueOf()-this.start.valueOf());var a=new Date(this.start.valueOf()+d*b);var c=new Date(this.end.valueOf()+d*b);this.applyRange(a,c);this.render()};links.Timeline.prototype.applyRange=function(b,e,a){var c=b.valueOf();var n=e.valueOf();var d=(n-c);var q=this.options;var k=1000*60*60*24*365;var h=Number(q.zoomMin)||10;if(h<10){h=10}var p=Number(q.zoomMax)||10000*k;if(p>10000*k){p=10000*k}if(p<h){p=h}var g=q.min?q.min.valueOf():undefined;var m=q.max?q.max.valueOf():undefined;if(g!=undefined&&m!=undefined){if(g>=m){var l=1000*60*60*24;m=g+l}if(p>(m-g)){p=(m-g)}if(h>(m-g)){h=(m-g)}}if(c>=n){n+=1000*60*60*24}if(d<h){var o=(h-d);var j=a?(a.valueOf()-c)/d:0.5;c-=Math.round(o*j);n+=Math.round(o*(1-j))}if(d>p){var o=(d-p);var j=a?(a.valueOf()-c)/d:0.5;c+=Math.round(o*j);n-=Math.round(o*(1-j))}if(g!=undefined){var o=(c-g);if(o<0){c-=o;n-=o}}if(m!=undefined){var o=(m-n);if(o<0){c+=o;n+=o}}this.start=new Date(c);this.end=new Date(n)};links.Timeline.prototype.confirmDeleteItem=function(a){this.applyDelete=true;if(!this.isSelected(a)){this.selectItem(a)}this.trigger("delete");if(this.applyDelete){this.deleteItem(a)}delete this.applyDelete};links.Timeline.prototype.deleteItem=function(a,c){if(a>=this.items.length){throw"Cannot delete row, index out of range"}if(this.selection){if(this.selection.index==a){this.unselectItem()}else{if(this.selection.index>a){this.selection.index--}}}var b=this.items.splice(a,1)[0];this.renderQueue.hide.push(b);if(this.data){if(google&&google.visualization&&this.data instanceof google.visualization.DataTable){this.data.removeRow(a)}else{if(links.Timeline.isArray(this.data)){this.data.splice(a,1)}else{throw"Cannot delete row from data, unknown data type"}}}if(this.options.cluster){this.clusterGenerator.updateData()}if(!c){this.render()}};links.Timeline.prototype.deleteAllItems=function(){this.unselectItem();this.clearItems();this.deleteGroups();if(this.data){if(google&&google.visualization&&this.data instanceof google.visualization.DataTable){this.data.removeRows(0,this.data.getNumberOfRows())}else{if(links.Timeline.isArray(this.data)){this.data.splice(0,this.data.length)}else{throw"Cannot delete row from data, unknown data type"}}}if(this.options.cluster){this.clusterGenerator.updateData()}this.render()};links.Timeline.prototype.getGroupFromHeight=function(b){var c,d,a=this.groups;if(a.length){if(this.options.axisOnTop){for(c=a.length-1;c>=0;c--){d=a[c];if(b>d.top){return d}}}else{for(c=0;c<a.length;c++){d=a[c];if(b>d.top){return d}}}return d}return undefined};links.Timeline.Item=function(c,a){if(c){this.start=c.start;this.end=c.end;this.content=c.content;this.className=c.className;this.editable=c.editable;this.group=c.group}this.top=0;this.left=0;this.width=0;this.height=0;this.lineWidth=0;this.dotWidth=0;this.dotHeight=0;this.rendered=false;if(a){for(var b in a){if(a.hasOwnProperty(b)){this[b]=a[b]}}}};links.Timeline.Item.prototype.reflow=function(){return false};links.Timeline.Item.prototype.getImageUrls=function(a){if(this.dom){links.imageloader.filterImageUrls(this.dom,a)}};links.Timeline.Item.prototype.select=function(){};links.Timeline.Item.prototype.unselect=function(){};links.Timeline.Item.prototype.createDOM=function(){};links.Timeline.Item.prototype.showDOM=function(a){};links.Timeline.Item.prototype.hideDOM=function(a){};links.Timeline.Item.prototype.updateDOM=function(){};links.Timeline.Item.prototype.updatePosition=function(a){};links.Timeline.Item.prototype.isRendered=function(){return this.rendered};links.Timeline.Item.prototype.isVisible=function(b,a){return false};links.Timeline.Item.prototype.setPosition=function(b,a){};links.Timeline.Item.prototype.getRight=function(a){return 0};links.Timeline.Item.prototype.getWidth=function(a){return this.width||0};links.Timeline.ItemBox=function(b,a){links.Timeline.Item.call(this,b,a)};links.Timeline.ItemBox.prototype=new links.Timeline.Item();links.Timeline.ItemBox.prototype.reflow=function(){var e=this.dom,c=e.dot.offsetHeight,d=e.dot.offsetWidth,a=e.line.offsetWidth,b=((this.dotHeight!=c)||(this.dotWidth!=d)||(this.lineWidth!=a));this.dotHeight=c;this.dotWidth=d;this.lineWidth=a;return b};links.Timeline.ItemBox.prototype.select=function(){var a=this.dom;links.Timeline.addClassName(a,"timeline-event-selected");links.Timeline.addClassName(a.line,"timeline-event-selected");links.Timeline.addClassName(a.dot,"timeline-event-selected")};links.Timeline.ItemBox.prototype.unselect=function(){var a=this.dom;links.Timeline.removeClassName(a,"timeline-event-selected");links.Timeline.removeClassName(a.line,"timeline-event-selected");links.Timeline.removeClassName(a.dot,"timeline-event-selected")};links.Timeline.ItemBox.prototype.createDOM=function(){var c=document.createElement("DIV");c.style.position="absolute";c.style.left=this.left+"px";c.style.top=this.top+"px";var b=document.createElement("DIV");b.className="timeline-event-content";b.innerHTML=this.content;c.appendChild(b);var d=document.createElement("DIV");d.style.position="absolute";d.style.width="0px";c.line=d;var a=document.createElement("DIV");a.style.position="absolute";a.style.width="0px";a.style.height="0px";c.dot=a;this.dom=c;this.updateDOM();return c};links.Timeline.ItemBox.prototype.showDOM=function(a){var b=this.dom;if(!b){b=this.createDOM()}if(b.parentNode!=a){if(b.parentNode){this.hideDOM()}a.appendChild(b);a.insertBefore(b.line,a.firstChild);a.appendChild(b.dot);this.rendered=true}};links.Timeline.ItemBox.prototype.hideDOM=function(){var c=this.dom;if(c){var b=c.parentNode;if(b){var a=function(d){if(d&&d.parentNode){d.parentNode.removeChild(d)}};a(c.line);a(c.dot);a(c);this.rendered=false}}};links.Timeline.ItemBox.prototype.updateDOM=function(){var b=this.dom;if(b){var c=b.line;var a=b.dot;b.firstChild.innerHTML=this.content;b.className="timeline-event timeline-event-box";c.className="timeline-event timeline-event-line";a.className="timeline-event timeline-event-dot";if(this.isCluster){links.Timeline.addClassName(b,"timeline-event-cluster");links.Timeline.addClassName(c,"timeline-event-cluster");links.Timeline.addClassName(a,"timeline-event-cluster")}if(this.className){links.Timeline.addClassName(b,this.className);links.Timeline.addClassName(c,this.className);links.Timeline.addClassName(a,this.className)}}};links.Timeline.ItemBox.prototype.updatePosition=function(g){var e=this.dom;if(e){var c=g.timeToScreen(this.start),f=g.options.axisOnTop,a=g.size.axis.top,d=g.size.axis.height,h=(g.options.box&&g.options.box.align)?g.options.box.align:undefined;e.style.top=this.top+"px";if(h=="right"){e.style.left=(c-this.width)+"px"}else{if(h=="left"){e.style.left=(c)+"px"}else{e.style.left=(c-this.width/2)+"px"}}var j=e.line;var b=e.dot;j.style.left=(c-this.lineWidth/2)+"px";b.style.left=(c-this.dotWidth/2)+"px";if(f){j.style.top=d+"px";j.style.height=Math.max(this.top-d,0)+"px";b.style.top=(d-this.dotHeight/2)+"px"}else{j.style.top=(this.top+this.height)+"px";j.style.height=Math.max(a-this.top-this.height,0)+"px";b.style.top=(a-this.dotHeight/2)+"px"}}};links.Timeline.ItemBox.prototype.isVisible=function(b,a){if(this.cluster){return false}return(this.start>b)&&(this.start<a)};links.Timeline.ItemBox.prototype.setPosition=function(b,a){var c=this.dom;c.style.left=(b-this.width/2)+"px";c.line.style.left=(b-this.lineWidth/2)+"px";c.dot.style.left=(b-this.dotWidth/2)+"px";if(this.group){this.top=this.group.top;c.style.top=this.top+"px"}};links.Timeline.ItemBox.prototype.getRight=function(c){var a=(c.options.box&&c.options.box.align)?c.options.box.align:undefined;var d=c.timeToScreen(this.start);var b;if(a=="right"){b=d}else{if(a=="left"){b=(d+this.width)}else{b=(d+this.width/2)}}return b};links.Timeline.ItemRange=function(b,a){links.Timeline.Item.call(this,b,a)};links.Timeline.ItemRange.prototype=new links.Timeline.Item();links.Timeline.ItemRange.prototype.select=function(){var a=this.dom;links.Timeline.addClassName(a,"timeline-event-selected")};links.Timeline.ItemRange.prototype.unselect=function(){var a=this.dom;links.Timeline.removeClassName(a,"timeline-event-selected")};links.Timeline.ItemRange.prototype.createDOM=function(){var b=document.createElement("DIV");b.style.position="absolute";var a=document.createElement("DIV");a.className="timeline-event-content";b.appendChild(a);this.dom=b;this.updateDOM();return b};links.Timeline.ItemRange.prototype.showDOM=function(a){var b=this.dom;if(!b){b=this.createDOM()}if(b.parentNode!=a){if(b.parentNode){this.hideDOM()}a.appendChild(b);this.rendered=true}};links.Timeline.ItemRange.prototype.hideDOM=function(){var a=this.dom;if(a){if(a.parentNode){a.parentNode.removeChild(a)}this.rendered=false}};links.Timeline.ItemRange.prototype.updateDOM=function(){var a=this.dom;if(a){a.firstChild.innerHTML=this.content;a.className="timeline-event timeline-event-range";if(this.isCluster){links.Timeline.addClassName(a,"timeline-event-cluster")}if(this.className){links.Timeline.addClassName(a,this.className)}}};links.Timeline.ItemRange.prototype.updatePosition=function(c){var e=this.dom;if(e){var a=c.size.contentWidth,d=c.timeToScreen(this.start),b=c.timeToScreen(this.end);if(d<-a){d=-a}if(b>2*a){b=2*a}e.style.top=this.top+"px";e.style.left=d+"px";e.style.width=Math.max(b-d,1)+"px"}};links.Timeline.ItemRange.prototype.isVisible=function(b,a){if(this.cluster){return false}return(this.end>b)&&(this.start<a)};links.Timeline.ItemRange.prototype.setPosition=function(b,a){var c=this.dom;c.style.left=b+"px";c.style.width=(a-b)+"px";if(this.group){this.top=this.group.top;c.style.top=this.top+"px"}};links.Timeline.ItemRange.prototype.getRight=function(a){return a.timeToScreen(this.end)};links.Timeline.ItemRange.prototype.getWidth=function(a){return a.timeToScreen(this.end)-a.timeToScreen(this.start)};links.Timeline.ItemDot=function(b,a){links.Timeline.Item.call(this,b,a)};links.Timeline.ItemDot.prototype=new links.Timeline.Item();links.Timeline.ItemDot.prototype.reflow=function(){var e=this.dom,c=e.dot.offsetHeight,d=e.dot.offsetWidth,b=e.content.offsetHeight,a=((this.dotHeight!=c)||(this.dotWidth!=d)||(this.contentHeight!=b));this.dotHeight=c;this.dotWidth=d;this.contentHeight=b;return a};links.Timeline.ItemDot.prototype.select=function(){var a=this.dom;links.Timeline.addClassName(a,"timeline-event-selected")};links.Timeline.ItemDot.prototype.unselect=function(){var a=this.dom;links.Timeline.removeClassName(a,"timeline-event-selected")};links.Timeline.ItemDot.prototype.createDOM=function(){var c=document.createElement("DIV");c.style.position="absolute";var b=document.createElement("DIV");b.className="timeline-event-content";c.appendChild(b);var a=document.createElement("DIV");a.style.position="absolute";a.style.width="0px";a.style.height="0px";c.appendChild(a);c.content=b;c.dot=a;this.dom=c;this.updateDOM();return c};links.Timeline.ItemDot.prototype.showDOM=function(a){var b=this.dom;if(!b){b=this.createDOM()}if(b.parentNode!=a){if(b.parentNode){this.hideDOM()}a.appendChild(b);this.rendered=true}};links.Timeline.ItemDot.prototype.hideDOM=function(){var a=this.dom;if(a){if(a.parentNode){a.parentNode.removeChild(a)}this.rendered=false}};links.Timeline.ItemDot.prototype.updateDOM=function(){if(this.dom){var b=this.dom;var a=b.dot;b.firstChild.innerHTML=this.content;a.className="timeline-event timeline-event-dot";if(this.isCluster){links.Timeline.addClassName(b,"timeline-event-cluster");links.Timeline.addClassName(a,"timeline-event-cluster")}if(this.className){links.Timeline.addClassName(b,this.className);links.Timeline.addClassName(a,this.className)}}};links.Timeline.ItemDot.prototype.updatePosition=function(a){var c=this.dom;if(c){var b=a.timeToScreen(this.start);c.style.top=this.top+"px";c.style.left=(b-this.dotWidth/2)+"px";c.content.style.marginLeft=(1.5*this.dotWidth)+"px";c.dot.style.top=((this.height-this.dotHeight)/2)+"px"}};links.Timeline.ItemDot.prototype.isVisible=function(b,a){if(this.cluster){return false}return(this.start>b)&&(this.start<a)};links.Timeline.ItemDot.prototype.setPosition=function(b,a){var c=this.dom;c.style.left=(b-this.dotWidth/2)+"px";if(this.group){this.top=this.group.top;c.style.top=this.top+"px"}};links.Timeline.ItemDot.prototype.getRight=function(a){return a.timeToScreen(this.start)+this.width};links.Timeline.prototype.getItem=function(a){if(a>=this.items.length){throw"Cannot get item, index out of range"}var c=this.items[a];var b={};b.start=new Date(c.start.valueOf());if(c.end){b.end=new Date(c.end.valueOf())}b.content=c.content;if(c.group){b.group=this.getGroupName(c.group)}if("className" in c){b.className=this.getGroupName(c.className)}if(c.hasOwnProperty("editable")&&(typeof c.editable!="undefined")){b.editable=c.editable}return b};links.Timeline.prototype.addItem=function(a,b){var c=[a];this.addItems(c,b)};links.Timeline.prototype.addItems=function(d,c){var b=this,a=this.items;AJS.$.each(d,function(g,e){var f=a.length;a.push(b.createItem(e));b.updateData(f,e)});if(this.options.cluster){this.clusterGenerator.updateData()}if(!c){this.render({animate:false})}};links.Timeline.prototype.createItem=function(a){var c=a.end?"range":this.options.style;var e={start:a.start,end:a.end,content:a.content,className:a.className,editable:a.editable,group:this.getGroup(a.group)};var d,b=this.options;if(b.axisOnTop){d=this.size.axis.height+b.eventMarginAxis+b.eventMargin/2}else{d=this.size.contentHeight-b.eventMarginAxis-b.eventMargin/2}if(c in this.itemTypes){return new this.itemTypes[c](e,{top:d})}console.log('ERROR: Unknown event style "'+c+'"');return new links.Timeline.Item(e,{top:d})};links.Timeline.prototype.changeItem=function(b,a,d){var e=this.items[b];if(!e){throw"Cannot change item, index out of range"}var c=this.createItem({start:a.hasOwnProperty("start")?a.start:e.start,end:a.hasOwnProperty("end")?a.end:e.end,content:a.hasOwnProperty("content")?a.content:e.content,group:a.hasOwnProperty("group")?a.group:this.getGroupName(e.group),className:a.hasOwnProperty("className")?a.className:e.className,editable:a.hasOwnProperty("editable")?a.editable:e.editable});this.items[b]=c;this.renderQueue.hide.push(e);this.renderQueue.show.push(c);this.updateData(b,a);if(this.options.cluster){this.clusterGenerator.updateData()}if(!d){this.render({animate:false});c.select()}};links.Timeline.prototype.deleteGroups=function(){this.groups=[];this.groupIndexes={}};links.Timeline.prototype.getGroup=function(g){var b=this.groups,c=this.groupIndexes,e=undefined;var f=c[g];if(f==undefined&&g!=undefined){e={content:g,labelTop:0,lineTop:0};b.push(e);b=b.sort(function(j,h){if(j.content>h.content){return 1}if(j.content<h.content){return -1}return 0});for(var d=0,a=b.length;d<a;d++){c[b[d].content]=d}}else{e=b[f]}return e};links.Timeline.prototype.getGroupName=function(a){return a?a.content:undefined};links.Timeline.prototype.cancelChange=function(){this.applyChange=false};links.Timeline.prototype.cancelDelete=function(){this.applyDelete=false};links.Timeline.prototype.cancelAdd=function(){this.applyAdd=false};links.Timeline.prototype.setSelection=function(g,h){if(g!=undefined&&g.length>0){if(g[0].row!=undefined){var e=g[0].row;if(this.items[e]){var j=this.items[e];this.selectItem(e);var a=j.start;var c=j.end;var k;if(c!=undefined){k=(c.valueOf()+a.valueOf())/2}else{k=a.valueOf()}var f=(this.end.valueOf()-this.start.valueOf()),d=new Date(k-f/2),b=new Date(k+f/2);if(!h){this.setVisibleChartRange(d,b)}return true}}}else{this.unselectItem()}return false};links.Timeline.prototype.getSelection=function(){var a=[];if(this.selection){a.push({row:this.selection.index})}return a};links.Timeline.prototype.selectItem=function(a){this.unselectItem();this.selection=undefined;if(this.items[a]!=undefined){var c=this.items[a],b=c.dom;this.selection={index:a};if(c&&c.dom){if(this.isEditable(c)){c.dom.style.cursor="move"}c.select()}this.repaintDeleteButton();this.repaintDragAreas()}};links.Timeline.prototype.isSelected=function(a){return(this.selection&&this.selection.index==a)};links.Timeline.prototype.unselectItem=function(){if(this.selection){var b=this.items[this.selection.index];if(b&&b.dom){var a=b.dom;a.style.cursor="";b.unselect()}this.selection=undefined;this.repaintDeleteButton();this.repaintDragAreas()}};links.Timeline.prototype.stackItems=function(b){if(this.groups.length>0){return}if(b==undefined){b=false}var a=this.stack;if(!a){a={};this.stack=a}a.sortedItems=this.stackOrder(this.renderedItems);a.finalItems=this.stackCalculateFinal(a.sortedItems);if(b||a.timer){var d=this;var c=function(){var e=d.stackMoveOneStep(a.sortedItems,a.finalItems);d.repaint();if(!e){a.timer=setTimeout(c,30)}else{delete a.timer}};if(!a.timer){a.timer=setTimeout(c,30)}}else{this.stackMoveToFinal(a.sortedItems,a.finalItems)}};links.Timeline.prototype.stackCancelAnimation=function(){if(this.stack&&this.stack.timer){clearTimeout(this.stack.timer);delete this.stack.timer}};links.Timeline.prototype.stackOrder=function(a){var c=a.concat([]);var b=this.options.customStackOrder&&(typeof this.options.customStackOrder==="function")?this.options.customStackOrder:function(e,d){if((e instanceof links.Timeline.ItemRange)&&!(d instanceof links.Timeline.ItemRange)){return -1}if(!(e instanceof links.Timeline.ItemRange)&&(d instanceof links.Timeline.ItemRange)){return 1}result=(e.start-d.start);if(!result){result=(d.width-e.width)}if(!result){result=(d.bottom-e.bottom)}return result};c.sort(b);return c};links.Timeline.prototype.stackCalculateFinal=function(l){var p,o,j=this.size,d=j.axis.top,g=j.axis.height,a=this.options,t=a.axisOnTop,c=a.eventMargin,n=a.eventMarginAxis,f=[];for(p=0,o=l.length;p<o;p++){var r=l[p],h,e,k=r.height,m=r.getWidth(this),s=r.getRight(this),b=s-m;if(t){h=g+n+c/2}else{h=d-k-n-c/2}e=h+k;f[p]={left:b,top:h,right:s,bottom:e,height:k,item:r}}if(this.options.stackEvents){for(p=0,o=f.length;p<o;p++){var u=f[p];var q=null;do{q=this.stackItemsCheckOverlap(f,p,0,p-1);if(q!=null){if(t){u.top=q.top+q.height+c}else{u.top=q.top-u.height-c}u.bottom=u.top+u.height}}while(q)}}return f};links.Timeline.prototype.stackMoveOneStep=function(e,j){var c=true;for(i=0,iMax=j.length;i<iMax;i++){var d=j[i],k=d.item;var h=parseInt(k.top);var f=parseInt(d.top);var g=(f-h);if(g){var a=(f==h)?0:((f>h)?1:-1);if(Math.abs(g)>4){a=g/4}var b=parseInt(h+a);if(b!=f){c=false}k.top=b;k.bottom=k.top+k.height}else{k.top=d.top;k.bottom=d.bottom}k.left=d.left;k.right=d.right}return c};links.Timeline.prototype.stackMoveToFinal=function(a,b){for(i=0,iMax=b.length;i<iMax;i++){var d=b[i],c=d.item;c.left=d.left;c.top=d.top;c.right=d.right;c.bottom=d.bottom}};links.Timeline.prototype.stackItemsCheckOverlap=function(h,a,g,f){var b=this.options.eventMargin,j=this.collision;var e=h[a];for(var c=f;c>=g;c--){var d=h[c];if(j(e,d,b)){if(c!=a){return d}}}return undefined};links.Timeline.prototype.collision=function(b,a,c){if(c==undefined){c=0}return(b.left-c<a.right&&b.right+c>a.left&&b.top-c<a.bottom&&b.bottom+c>a.top)};links.Timeline.prototype.trigger=function(d){var c=null,b,a;switch(d){case"rangechange":case"rangechanged":c={start:new Date(this.start.valueOf()),end:new Date(this.end.valueOf())};break;case"timechange":case"timechanged":c={time:new Date(this.customTime.valueOf())};break;case"add":b=this.eventParams.mouseX-links.Timeline.getAbsoluteLeft(this.dom.content);a=this.screenToTime(b);c={start:a};break}links.events.trigger(this,d,c);if(google&&google.visualization){google.visualization.events.trigger(this,d,c)}};links.Timeline.prototype.clusterItems=function(){if(!this.options.cluster){return}var b=this.clusterGenerator.getClusters(this.conversion.factor);if(this.clusters!=b){var a=this.renderQueue;if(this.clusters){AJS.$.each(this.clusters,function(d,c){a.hide.push(c);AJS.$.each(c.items,function(f,e){e.cluster=undefined})})}AJS.$.each(b,function(d,c){AJS.$.each(c.items,function(f,e){e.cluster=c})});this.clusters=b}};links.Timeline.prototype.filterItems=function(){var a=this.renderQueue,d=(this.end-this.start),e=new Date(this.start.valueOf()-d),b=new Date(this.end.valueOf()+d);function c(f){AJS.$.each(f,function(h,g){var k=g.rendered;var j=g.isVisible(e,b);if(k!=j){if(k){a.hide.push(g)}if(j&&AJS.$.inArray(g,a.show)==-1){a.show.push(g)}}})}c(this.items);if(this.clusters){c(this.clusters)}};links.Timeline.ClusterGenerator=function(a){this.timeline=a;this.clear()};links.Timeline.ClusterGenerator.prototype.clear=function(){this.items=[];this.groups={};this.clearCache()};links.Timeline.ClusterGenerator.prototype.clearCache=function(){this.cache={};this.cacheLevel=-1;this.cache[this.cacheLevel]=[]};links.Timeline.ClusterGenerator.prototype.setData=function(a,b){this.items=a||[];this.dataChanged=true;this.applyOnChangedLevel=true;if(b&&b.applyOnChangedLevel){this.applyOnChangedLevel=b.applyOnChangedLevel}};links.Timeline.ClusterGenerator.prototype.updateData=function(){this.dataChanged=true;this.applyOnChangedLevel=false};links.Timeline.ClusterGenerator.prototype.filterData=function(){var b=this.items||[];var a={};this.groups=a;AJS.$.each(b,function(e,d){var g=d.group?d.group.content:"";var f=a[g];if(!f){f=[];a[g]=f}f.push(d);if(d.start){if(d.end){d.center=(d.start.valueOf()+d.end.valueOf())/2}else{d.center=d.start.valueOf()}}});for(var c in a){if(a.hasOwnProperty(c)){a[c].sort(function(e,d){return(e.center-d.center)})}}this.dataChanged=false};links.Timeline.ClusterGenerator.prototype.getClusters=function(K){var a=-1,b=2,x=0,H=5;if(K>0){a=Math.round(Math.log(100/K)/Math.log(b));x=Math.pow(b,a);if(this.timeline.groups&&this.timeline.groups.length){x*=4}}if(this.dataChanged){var w=(a!=this.cacheLevel);var D=this.applyOnChangedLevel?w:true;if(D){this.clearCache();this.filterData()}}this.cacheLevel=a;var h=this.cache[a];if(!h){h=[];for(var q in this.groups){if(this.groups.hasOwnProperty(q)){var r=this.groups[q];var z=r.length;var G=0;while(G<z){var J=r[G];var v=1;var E=G-1;while(E>=0&&(J.center-r[E].center)<x/2){if(!r[E].cluster){v++}E--}var C=G+1;while(C<r.length&&(r[C].center-J.center)<x/2){v++;C++}var A=h.length-1;while(A>=0&&(J.center-h[A].center)<x/2){if(J.group==h[A].group){v++}A--}if(v>H){var n=v-H+1;var d=[];var t=undefined;var y=undefined;var F=undefined;var f=false;var g=0;var u=G;while(d.length<n&&u<r.length){var s=r[u];var e=s.start.valueOf();var c=s.end?s.end.valueOf():s.start.valueOf();d.push(s);if(g){t=(g/(g+1))*t+(1/(g+1))*s.center}else{t=s.center}y=(y!=undefined)?Math.min(y,e):e;F=(F!=undefined)?Math.max(F,c):c;f=f||(s instanceof links.Timeline.ItemRange);g++;u++}var I;var L="Cluster containing "+g+" events. Zoom in to see the individual events.";var B='<div title="'+L+'">'+g+" events</div>";var o=J.group?J.group.content:undefined;if(f){I=this.timeline.createItem({start:new Date(y),end:new Date(F),content:B,group:o})}else{I=this.timeline.createItem({start:new Date(t),content:B,group:o})}I.isCluster=true;I.items=d;AJS.$.each(I.items,function(k,j){j.cluster=I});h.push(I);G+=n}else{delete J.cluster;G+=1}}}}this.cache[a]=h}return h};links.events=links.events||{listeners:[],indexOf:function(b){var d=this.listeners;for(var c=0,a=this.listeners.length;c<a;c++){var e=d[c];if(e&&e.object==b){return c}}return -1},addListener:function(b,d,f){var a=this.indexOf(b);var e=this.listeners[a];if(!e){e={object:b,events:{}};this.listeners.push(e)}var c=e.events[d];if(!c){c=[];e.events[d]=c}if(AJS.$.inArray(f,c)==-1){c.push(f)}},removeListener:function(c,a,j){var f=this.indexOf(c);var b=this.listeners[f];if(b){var h=b.events[a];if(h){var f=AJS.$.inArray(j,h);if(f!=-1){h.splice(f,1)}if(h.length==0){delete b.events[a]}}var d=0;var k=b.events;for(var g in k){if(k.hasOwnProperty(g)){d++}}if(d==0){delete this.listeners[f]}}},removeAllListeners:function(){this.listeners=[]},trigger:function(c,g,e){var b=this.indexOf(c);var h=this.listeners[b];if(h){var f=h.events[g];if(f){for(var d=0,a=f.length;d<a;d++){f[d](e)}}}}};links.Timeline.StepDate=function(c,a,b){this.current=new Date();this._start=new Date();this._end=new Date();this.autoScale=true;this.scale=links.Timeline.StepDate.SCALE.DAY;this.step=1;this.setRange(c,a,b)};links.Timeline.StepDate.SCALE={MILLISECOND:1,SECOND:2,MINUTE:3,HOUR:4,DAY:5,WEEKDAY:6,MONTH:7,YEAR:8};links.Timeline.StepDate.prototype.setRange=function(c,a,b){if(!(c instanceof Date)||!(a instanceof Date)){return}this._start=(c!=undefined)?new Date(c.valueOf()):new Date();this._end=(a!=undefined)?new Date(a.valueOf()):new Date();if(this.autoScale){this.setMinimumStep(b)}};links.Timeline.StepDate.prototype.start=function(){this.current=new Date(this._start.valueOf());this.roundToMinor()};links.Timeline.StepDate.prototype.roundToMinor=function(){switch(this.scale){case links.Timeline.StepDate.SCALE.YEAR:this.current.setFullYear(this.step*Math.floor(this.current.getFullYear()/this.step));this.current.setMonth(0);case links.Timeline.StepDate.SCALE.MONTH:this.current.setDate(1);case links.Timeline.StepDate.SCALE.DAY:case links.Timeline.StepDate.SCALE.WEEKDAY:this.current.setHours(0);case links.Timeline.StepDate.SCALE.HOUR:this.current.setMinutes(0);case links.Timeline.StepDate.SCALE.MINUTE:this.current.setSeconds(0);case links.Timeline.StepDate.SCALE.SECOND:this.current.setMilliseconds(0)}if(this.step!=1){switch(this.scale){case links.Timeline.StepDate.SCALE.MILLISECOND:this.current.setMilliseconds(this.current.getMilliseconds()-this.current.getMilliseconds()%this.step);break;case links.Timeline.StepDate.SCALE.SECOND:this.current.setSeconds(this.current.getSeconds()-this.current.getSeconds()%this.step);break;case links.Timeline.StepDate.SCALE.MINUTE:this.current.setMinutes(this.current.getMinutes()-this.current.getMinutes()%this.step);break;case links.Timeline.StepDate.SCALE.HOUR:this.current.setHours(this.current.getHours()-this.current.getHours()%this.step);break;case links.Timeline.StepDate.SCALE.WEEKDAY:case links.Timeline.StepDate.SCALE.DAY:this.current.setDate((this.current.getDate()-1)-(this.current.getDate()-1)%this.step+1);break;case links.Timeline.StepDate.SCALE.MONTH:this.current.setMonth(this.current.getMonth()-this.current.getMonth()%this.step);break;case links.Timeline.StepDate.SCALE.YEAR:this.current.setFullYear(this.current.getFullYear()-this.current.getFullYear()%this.step);break;default:break}}};links.Timeline.StepDate.prototype.end=function(){return(this.current.valueOf()>this._end.valueOf())};links.Timeline.StepDate.prototype.next=function(){var b=this.current.valueOf();if(this.current.getMonth()<6){switch(this.scale){case links.Timeline.StepDate.SCALE.MILLISECOND:this.current=new Date(this.current.valueOf()+this.step);break;case links.Timeline.StepDate.SCALE.SECOND:this.current=new Date(this.current.valueOf()+this.step*1000);break;case links.Timeline.StepDate.SCALE.MINUTE:this.current=new Date(this.current.valueOf()+this.step*1000*60);break;case links.Timeline.StepDate.SCALE.HOUR:this.current=new Date(this.current.valueOf()+this.step*1000*60*60);var a=this.current.getHours();this.current.setHours(a-(a%this.step));break;case links.Timeline.StepDate.SCALE.WEEKDAY:case links.Timeline.StepDate.SCALE.DAY:this.current.setDate(this.current.getDate()+this.step);break;case links.Timeline.StepDate.SCALE.MONTH:this.current.setMonth(this.current.getMonth()+this.step);break;case links.Timeline.StepDate.SCALE.YEAR:this.current.setFullYear(this.current.getFullYear()+this.step);break;default:break}}else{switch(this.scale){case links.Timeline.StepDate.SCALE.MILLISECOND:this.current=new Date(this.current.valueOf()+this.step);break;case links.Timeline.StepDate.SCALE.SECOND:this.current.setSeconds(this.current.getSeconds()+this.step);break;case links.Timeline.StepDate.SCALE.MINUTE:this.current.setMinutes(this.current.getMinutes()+this.step);break;case links.Timeline.StepDate.SCALE.HOUR:this.current.setHours(this.current.getHours()+this.step);break;case links.Timeline.StepDate.SCALE.WEEKDAY:case links.Timeline.StepDate.SCALE.DAY:this.current.setDate(this.current.getDate()+this.step);break;case links.Timeline.StepDate.SCALE.MONTH:this.current.setMonth(this.current.getMonth()+this.step);break;case links.Timeline.StepDate.SCALE.YEAR:this.current.setFullYear(this.current.getFullYear()+this.step);break;default:break}}if(this.step!=1){switch(this.scale){case links.Timeline.StepDate.SCALE.MILLISECOND:if(this.current.getMilliseconds()<this.step){this.current.setMilliseconds(0)}break;case links.Timeline.StepDate.SCALE.SECOND:if(this.current.getSeconds()<this.step){this.current.setSeconds(0)}break;case links.Timeline.StepDate.SCALE.MINUTE:if(this.current.getMinutes()<this.step){this.current.setMinutes(0)}break;case links.Timeline.StepDate.SCALE.HOUR:if(this.current.getHours()<this.step){this.current.setHours(0)}break;case links.Timeline.StepDate.SCALE.WEEKDAY:case links.Timeline.StepDate.SCALE.DAY:if(this.current.getDate()<this.step+1){this.current.setDate(1)}break;case links.Timeline.StepDate.SCALE.MONTH:if(this.current.getMonth()<this.step){this.current.setMonth(0)}break;case links.Timeline.StepDate.SCALE.YEAR:break;default:break}}if(this.current.valueOf()==b){this.current=new Date(this._end.valueOf())}};links.Timeline.StepDate.prototype.getCurrent=function(){return this.current};links.Timeline.StepDate.prototype.setScale=function(b,a){this.scale=b;if(a>0){this.step=a}this.autoScale=false};links.Timeline.StepDate.prototype.setAutoScale=function(a){this.autoScale=a};links.Timeline.StepDate.prototype.setMinimumStep=function(f){if(f==undefined){return}var b=(1000*60*60*24*30*12);var a=(1000*60*60*24*30);var e=(1000*60*60*24);var g=(1000*60*60);var d=(1000*60);var h=(1000);var c=(1);if(b*1000>f){this.scale=links.Timeline.StepDate.SCALE.YEAR;this.step=1000}if(b*500>f){this.scale=links.Timeline.StepDate.SCALE.YEAR;this.step=500}if(b*100>f){this.scale=links.Timeline.StepDate.SCALE.YEAR;this.step=100}if(b*50>f){this.scale=links.Timeline.StepDate.SCALE.YEAR;this.step=50}if(b*10>f){this.scale=links.Timeline.StepDate.SCALE.YEAR;this.step=10}if(b*5>f){this.scale=links.Timeline.StepDate.SCALE.YEAR;this.step=5}if(b>f){this.scale=links.Timeline.StepDate.SCALE.YEAR;this.step=1}if(a*3>f){this.scale=links.Timeline.StepDate.SCALE.MONTH;this.step=3}if(a>f){this.scale=links.Timeline.StepDate.SCALE.MONTH;this.step=1}if(e*5>f){this.scale=links.Timeline.StepDate.SCALE.DAY;this.step=5}if(e*2>f){this.scale=links.Timeline.StepDate.SCALE.DAY;this.step=2}if(e>f){this.scale=links.Timeline.StepDate.SCALE.DAY;this.step=1}if(e/2>f){this.scale=links.Timeline.StepDate.SCALE.WEEKDAY;this.step=1}if(g*4>f){this.scale=links.Timeline.StepDate.SCALE.HOUR;this.step=4}if(g>f){this.scale=links.Timeline.StepDate.SCALE.HOUR;this.step=1}if(d*15>f){this.scale=links.Timeline.StepDate.SCALE.MINUTE;this.step=15}if(d*10>f){this.scale=links.Timeline.StepDate.SCALE.MINUTE;this.step=10}if(d*5>f){this.scale=links.Timeline.StepDate.SCALE.MINUTE;this.step=5}if(d>f){this.scale=links.Timeline.StepDate.SCALE.MINUTE;this.step=1}if(h*15>f){this.scale=links.Timeline.StepDate.SCALE.SECOND;this.step=15}if(h*10>f){this.scale=links.Timeline.StepDate.SCALE.SECOND;this.step=10}if(h*5>f){this.scale=links.Timeline.StepDate.SCALE.SECOND;this.step=5}if(h>f){this.scale=links.Timeline.StepDate.SCALE.SECOND;this.step=1}if(c*200>f){this.scale=links.Timeline.StepDate.SCALE.MILLISECOND;this.step=200}if(c*100>f){this.scale=links.Timeline.StepDate.SCALE.MILLISECOND;this.step=100}if(c*50>f){this.scale=links.Timeline.StepDate.SCALE.MILLISECOND;this.step=50}if(c*10>f){this.scale=links.Timeline.StepDate.SCALE.MILLISECOND;this.step=10}if(c*5>f){this.scale=links.Timeline.StepDate.SCALE.MILLISECOND;this.step=5}if(c>f){this.scale=links.Timeline.StepDate.SCALE.MILLISECOND;this.step=1}};links.Timeline.StepDate.prototype.snap=function(a){if(this.scale==links.Timeline.StepDate.SCALE.YEAR){var b=a.getFullYear()+Math.round(a.getMonth()/12);a.setFullYear(Math.round(b/this.step)*this.step);a.setMonth(0);a.setDate(0);a.setHours(0);a.setMinutes(0);a.setSeconds(0);a.setMilliseconds(0)}else{if(this.scale==links.Timeline.StepDate.SCALE.MONTH){if(a.getDate()>15){a.setDate(1);a.setMonth(a.getMonth()+1)}else{a.setDate(1)}a.setHours(0);a.setMinutes(0);a.setSeconds(0);a.setMilliseconds(0)}else{if(this.scale==links.Timeline.StepDate.SCALE.DAY||this.scale==links.Timeline.StepDate.SCALE.WEEKDAY){switch(this.step){case 5:case 2:a.setHours(Math.round(a.getHours()/24)*24);break;default:a.setHours(Math.round(a.getHours()/12)*12);break}a.setMinutes(0);a.setSeconds(0);a.setMilliseconds(0)}else{if(this.scale==links.Timeline.StepDate.SCALE.HOUR){switch(this.step){case 4:a.setMinutes(Math.round(a.getMinutes()/60)*60);break;default:a.setMinutes(Math.round(a.getMinutes()/30)*30);break}a.setSeconds(0);a.setMilliseconds(0)}else{if(this.scale==links.Timeline.StepDate.SCALE.MINUTE){switch(this.step){case 15:case 10:a.setMinutes(Math.round(a.getMinutes()/5)*5);a.setSeconds(0);break;case 5:a.setSeconds(Math.round(a.getSeconds()/60)*60);break;default:a.setSeconds(Math.round(a.getSeconds()/30)*30);break}a.setMilliseconds(0)}else{if(this.scale==links.Timeline.StepDate.SCALE.SECOND){switch(this.step){case 15:case 10:a.setSeconds(Math.round(a.getSeconds()/5)*5);a.setMilliseconds(0);break;case 5:a.setMilliseconds(Math.round(a.getMilliseconds()/1000)*1000);break;default:a.setMilliseconds(Math.round(a.getMilliseconds()/500)*500);break}}else{if(this.scale==links.Timeline.StepDate.SCALE.MILLISECOND){var c=this.step>5?this.step/2:1;a.setMilliseconds(Math.round(a.getMilliseconds()/c)*c)}}}}}}}};links.Timeline.StepDate.prototype.isMajor=function(){switch(this.scale){case links.Timeline.StepDate.SCALE.MILLISECOND:return(this.current.getMilliseconds()==0);case links.Timeline.StepDate.SCALE.SECOND:return(this.current.getSeconds()==0);case links.Timeline.StepDate.SCALE.MINUTE:return(this.current.getHours()==0)&&(this.current.getMinutes()==0);case links.Timeline.StepDate.SCALE.HOUR:return(this.current.getHours()==0);case links.Timeline.StepDate.SCALE.WEEKDAY:case links.Timeline.StepDate.SCALE.DAY:return(this.current.getDate()==1);case links.Timeline.StepDate.SCALE.MONTH:return(this.current.getMonth()==0);case links.Timeline.StepDate.SCALE.YEAR:return false;default:return false}};links.Timeline.StepDate.prototype.getLabelMinor=function(b,a){if(a==undefined){a=this.current}switch(this.scale){case links.Timeline.StepDate.SCALE.MILLISECOND:return String(a.getMilliseconds());case links.Timeline.StepDate.SCALE.SECOND:return String(a.getSeconds());case links.Timeline.StepDate.SCALE.MINUTE:return this.addZeros(a.getHours(),2)+":"+this.addZeros(a.getMinutes(),2);case links.Timeline.StepDate.SCALE.HOUR:return this.addZeros(a.getHours(),2)+":"+this.addZeros(a.getMinutes(),2);case links.Timeline.StepDate.SCALE.WEEKDAY:return b.DAYS_SHORT[a.getDay()]+" "+a.getDate();case links.Timeline.StepDate.SCALE.DAY:return String(a.getDate());case links.Timeline.StepDate.SCALE.MONTH:return b.MONTHS_SHORT[a.getMonth()];case links.Timeline.StepDate.SCALE.YEAR:return String(a.getFullYear());default:return""}};links.Timeline.StepDate.prototype.getLabelMajor=function(b,a){if(a==undefined){a=this.current}switch(this.scale){case links.Timeline.StepDate.SCALE.MILLISECOND:return this.addZeros(a.getHours(),2)+":"+this.addZeros(a.getMinutes(),2)+":"+this.addZeros(a.getSeconds(),2);case links.Timeline.StepDate.SCALE.SECOND:return a.getDate()+" "+b.MONTHS[a.getMonth()]+" "+this.addZeros(a.getHours(),2)+":"+this.addZeros(a.getMinutes(),2);case links.Timeline.StepDate.SCALE.MINUTE:return b.DAYS[a.getDay()]+" "+a.getDate()+" "+b.MONTHS[a.getMonth()]+" "+a.getFullYear();case links.Timeline.StepDate.SCALE.HOUR:return b.DAYS[a.getDay()]+" "+a.getDate()+" "+b.MONTHS[a.getMonth()]+" "+a.getFullYear();case links.Timeline.StepDate.SCALE.WEEKDAY:case links.Timeline.StepDate.SCALE.DAY:return b.MONTHS[a.getMonth()]+" "+a.getFullYear();case links.Timeline.StepDate.SCALE.MONTH:return String(a.getFullYear());default:return""}};links.Timeline.StepDate.prototype.addZeros=function(b,a){var c=""+b;while(c.length<a){c="0"+c}return c};links.imageloader=(function(){var g={};var c={};function a(h){if(g[h]==true){return true}var j=new Image();j.src=h;if(j.complete){return true}return false}function b(h){return(c[h]!=undefined)}function f(h,m,j){if(j==undefined){j=true}if(a(h)){if(j){m(h)}return}if(b(h)&&!j){return}var l=c[h];if(!l){var k=new Image();k.src=h;l=[];c[h]=l;k.onload=function(o){g[h]=true;delete c[h];for(var n=0;n<l.length;n++){l[n](h)}}}if(AJS.$.inArray(m,l)==-1){l.push(m)}}function e(k,m,j){var l=[];AJS.$.each(k,function(o,n){if(!a(n)){l.push(n)}});if(l.length){var h=l.length;AJS.$.each(l,function(o,n){f(n,function(){h--;if(h==0){m()}},j)})}else{if(j){m()}}}function d(j,k){var l=j.firstChild;while(l){if(l.tagName=="IMG"){var h=l.src;if(AJS.$.inArray(h,k)==-1){k.push(h)}}d(l,k);l=l.nextSibling}}return{isLoaded:a,isLoading:b,load:f,loadAll:e,filterImageUrls:d}})();links.Timeline.addEventListener=function(b,d,c,a){if(b.addEventListener){if(a===undefined){a=false}if(d==="mousewheel"&&navigator.userAgent.indexOf("Firefox")>=0){d="DOMMouseScroll"}b.addEventListener(d,c,a)}else{b.attachEvent("on"+d,c)}};links.Timeline.removeEventListener=function(b,d,c,a){if(b.removeEventListener){if(a===undefined){a=false}if(d==="mousewheel"&&navigator.userAgent.indexOf("Firefox")>=0){d="DOMMouseScroll"}b.removeEventListener(d,c,a)}else{b.detachEvent("on"+d,c)}};links.Timeline.getTarget=function(a){if(!a){a=window.event}var b;if(a.target){b=a.target}else{if(a.srcElement){b=a.srcElement}}if(b.nodeType!=undefined&&b.nodeType==3){b=b.parentNode}return b};links.Timeline.stopPropagation=function(a){if(!a){a=window.event}if(a.stopPropagation){a.stopPropagation()}else{a.cancelBubble=true}};links.Timeline.preventDefault=function(a){if(!a){a=window.event}if(a.preventDefault){a.preventDefault()}else{a.returnValue=false}};links.Timeline.getAbsoluteLeft=function(b){var f=document.documentElement;var a=document.body;var d=b.offsetLeft;var c=b.offsetParent;while(c!=null&&c!=a&&c!=f){d+=c.offsetLeft;d-=c.scrollLeft;c=c.offsetParent}return d};links.Timeline.getAbsoluteTop=function(b){var f=document.documentElement;var a=document.body;var d=b.offsetTop;var c=b.offsetParent;while(c!=null&&c!=a&&c!=f){d+=c.offsetTop;d-=c.scrollTop;c=c.offsetParent}return d};links.Timeline.getPageY=function(c){if("pageY" in c){return c.pageY}else{var b;if(("targetTouches" in c)&&c.targetTouches.length){b=c.targetTouches[0].clientY}else{b=c.clientY}var d=document.documentElement;var a=document.body;return b+(d&&d.scrollTop||a&&a.scrollTop||0)-(d&&d.clientTop||a&&a.clientTop||0)}};links.Timeline.getPageX=function(c){if("pageY" in c){return c.pageX}else{var b;if(("targetTouches" in c)&&c.targetTouches.length){b=c.targetTouches[0].clientX}else{b=c.clientX}var d=document.documentElement;var a=document.body;return b+(d&&d.scrollLeft||a&&a.scrollLeft||0)-(d&&d.clientLeft||a&&a.clientLeft||0)}};links.Timeline.addClassName=function(c,b){var a=c.className.split(" ");if(AJS.$.inArray(b,a)==-1){a.push(b);c.className=a.join(" ")}};links.Timeline.removeClassName=function(d,c){var b=d.className.split(" ");var a=AJS.$.inArray(c,b);if(a!=-1){b.splice(a,1);d.className=b.join(" ")}};links.Timeline.isArray=function(a){if(a instanceof Array){return true}return(Object.prototype.toString.call(a)==="[object Array]")};links.Timeline.parseJSONDate=function(b){if(b==undefined){return undefined}if(b instanceof Date){return b}var a=b.match(/\/Date\((-?\d+)([-\+]?\d{2})?(\d{2})?\)\//i);if(a){var c=a[2]?(3600000*a[2])+(60000*a[3]*(a[2]/Math.abs(a[2]))):0;return new Date((1*a[1])+c)}return Date.parse(b)};
}catch(e){WRMCB(e)};
;
try {
/* module-key = 'com.atlassian.confluence.extra.team-calendars:auto-complete-search-helper', location = 'com/atlassian/confluence/extra/calendar3/components/auto-complete-search-helper/auto-complete-search-helper.js' */
define("tc/auto-complete-search-helper",["jquery","tc/calendar-util"],function(b,a){return{makeAutoCompleteSearch:function(f,e,d,h,c,g){e.keydown(function(j){var i=b("li.active",h);if(27==j.keyCode){if(!h.hasClass("hidden")){h.addClass("hidden");return false}}if(38==j.keyCode){if(!h.hasClass("hidden")){if(i.length){if(i.prev().length){i.removeClass("active").prev().addClass("active")}}else{b(".aui-dropdown li:last",h).addClass("active")}return false}}if(40==j.keyCode){if(!h.hasClass("hidden")){if(i.length){if(i.next().length){i.removeClass("active").next().addClass("active")}}else{b(".aui-dropdown li:first",h).addClass("active")}return false}return false}if(13==j.keyCode){if(!h.hasClass("hidden")){b(".aui-dropdown li.active a",h).trigger("click");return false}}if(b.trim(e.val())){setTimeout(function(){if(!b.trim(e.val())){h.addClass("hidden");return}b.ajax({cache:false,data:b.extend({search:"name",query:e.val()},d),dataType:"json",error:function(k,m,l){if(k.status!==400){a.showAjaxError(f,k,m,l)}},success:function(m){var n=b(document.createElement("ol"));var p=function(s){return k.id?a.getParameter(f,"baseUrl")+"/pages/viewpage.action?pageId="+encodeURIComponent(s.id):"#"};for(var r=0;r<m.group.length;++r){var l=m.group[r];if(l.result){for(var q=0;q<l.result.length;++q){var k=l.result[q];if(g&&!g(k)){continue}var o=b(document.createElement("li")).mouseover(function(){b("li.active",h).removeClass("active");b(this).addClass("active")});if(k.thumbnailLink){b(document.createElement("img")).attr("src",k.thumbnailLink.href).appendTo(o)}if(k.link&&k.link.length){b(document.createElement("span")).attr("title",k.title||(k.space?" "+k.space.name:"")).text(k.title).appendTo(b(document.createElement("a")).data("result",k).attr("href",p(k)||"").addClass(k.type?"content-type-"+k.type:"").click(function(){if(c){c(e,b(this))}h.addClass("hidden");return false}).appendTo(o))}o.appendTo(n)}}}if(n.children().length){b("li",n).each(function(s){if(s>4){b(this).remove()}});b(".aui-dropdown",h).empty().append(n);h.removeClass("hidden").dropDown("Standard")}else{h.addClass("hidden")}},timeout:a.ajaxTimeout,url:a.getParameter(f,"baseUrl")+"/rest/prototype/1/search.json"})},300)}}).focus(function(){if(e.hasClass("with-hint")){e.removeClass("with-hint").val("")}}).blur(function(){if(!b.trim(e.val())){e.addClass("with-hint").val("Confluence page or URL")}})}}});
}catch(e){WRMCB(e)};
;
try {
/* module-key = 'com.atlassian.confluence.extra.team-calendars:event-delete-dialog', location = 'com/atlassian/confluence/extra/calendar3/components/event-delete-dialog/event-delete-dialog.js' */
define("tc/event-delete-dialog",["jquery"],function(a){return function(f,c,e){var i;var h=function(k,j){if(!e.isProcessingEvent(f)){e.setProcessingEvent(f,true,j);e.deleteEvent(f,k,function(l,n,m){e.showAjaxError(f,l,n,m,e.ERROR_CLASS_EVENT_DELETE);j.hide();e.setProcessingEvent(f,false,j)},function(l){if(l.success){var o=e.getSubCalendar(f,c.subCalendarId);var m=c.eventType;var n;if(m==="custom"&&o&&o.customEventTypes&&o.customEventTypes.length){a.each(o.customEventTypes,function(p,q){if(q.customEventTypeId===c.customEventTypeId){n={customEventTypeName:q.title}}})}Confluence.TeamCalendars.fireEventForAnalytics("event.delete.default."+m+".context."+e.getParameter(f,"calendarContext"),n);e.setGenericErrors(f,null,e.ERROR_CLASS_EVENT_DELETE);if(k.singleInstance){e.getCalendarPanel(f).fullCalendar("removeEvents",[c.id])}else{e.reloadSubCalendar(f,o.id||o.parentId)}}else{e.setGenericErrors(f,"Uh oh. Looks like something unexpectedly went wrong. Please check the Confluence log file.",e.ERROR_CLASS_EVENT_DELETE)}j.hide();e.setProcessingEvent(f,false,j)});return false}};if(c.recur){i=new AJS.Dialog({width:550,height:270,id:"tc-confirm-event-delete"});i.addHeader("Delete Recurring Event");i.addPanel("",Confluence.TeamCalendars.Templates.confirmRecurringEventDelete({elementIdSuffix:e.getParameter(f,"elementIdSuffix")}),"tc-delete-event-confirmation-panel");var d=i.getCurrentPanel().body;var g=a("<span class='spinner hidden aui-icon aui-icon-wait'></span>");var b=function(k){var j=k.getPage(0).buttonpanel;g.prependTo(j)};i.enableOkButton=function(){a(":button",d).each(function(j,k){a(k).removeAttr("disabled").removeClass("ui-state-disabled")});g.addClass("hidden")};i.disableOkButton=function(){a(":button",d).each(function(j,k){a(k).attr("disabled","disabled").addClass("ui-state-disabled")});g.removeClass("hidden")};a(".tc-delete-this-instance-only",d).click(function(){h({subCalendarId:c.subCalendarId,uid:c.id,recurrenceId:c.recurId||"",originalStart:c.originalStart||"",singleInstance:true},i);return false});a(".tc-delete-future-instances-only",d).click(function(){h({subCalendarId:c.subCalendarId,uid:c.id,recurUntil:a.fullCalendar.formatDate(c.start,"yyyyMMdd")},i);return false});a(".tc-delete-all-instances",d).click(function(){h({subCalendarId:c.subCalendarId,uid:c.id},i);return false});i.addLink("Cancel",function(){i.hide();return false});b(i)}else{i=new AJS.Dialog(280,170);i.addHeader("Delete Event");i.addPanel("",Confluence.TeamCalendars.Templates.confirmEventDelete(),"tc-delete-event-confirmation-panel");i.addButton("Yes",function(){h({subCalendarId:c.subCalendarId,uid:c.id},i)});i.addLink("Cancel",function(){i.hide();return false})}return i}});
}catch(e){WRMCB(e)};
;
try {
/* module-key = 'com.atlassian.confluence.extra.team-calendars:event-delete-dialog', location = '/com/atlassian/confluence/extra/calendar3/components/event-delete-dialog/event-delete-dialog.soy' */
// This file was automatically generated from event-delete-dialog.soy.
// Please don't edit this file by hand.

/**
 * @fileoverview Templates in namespace Confluence.TeamCalendars.Templates.
 */

if (typeof Confluence == 'undefined') { var Confluence = {}; }
if (typeof Confluence.TeamCalendars == 'undefined') { Confluence.TeamCalendars = {}; }
if (typeof Confluence.TeamCalendars.Templates == 'undefined') { Confluence.TeamCalendars.Templates = {}; }


Confluence.TeamCalendars.Templates.confirmEventDelete = function(opt_data, opt_ignored) {
  return '<p>' + soy.$$escapeHtml('Are you sure? This cannot be undone') + '</p>';
};
if (goog.DEBUG) {
  Confluence.TeamCalendars.Templates.confirmEventDelete.soyTemplateName = 'Confluence.TeamCalendars.Templates.confirmEventDelete';
}


Confluence.TeamCalendars.Templates.confirmRecurringEventDelete = function(opt_data, opt_ignored) {
  return '<ul class="tc-delete-recurring-event-options"><li><input type="button" value="' + soy.$$escapeHtml('This instance only') + '" class="tc-delete-this-instance-only tc-delete-button aui-button"><span class="tc-delete-description">' + soy.$$escapeHtml('All other events in this series will remain unchanged.') + '</span></li><li><input type="button" value="' + soy.$$escapeHtml('All future instances') + '" class="tc-delete-future-instances-only tc-delete-button aui-button"><span class="tc-delete-description">' + soy.$$escapeHtml('This and all future instances will be removed.') + '</span></li><li class="tc-last-delete-option"><input type="button" value="' + soy.$$escapeHtml('All in the series') + '" class="tc-delete-all-instances tc-delete-button aui-button"><span class="tc-delete-description">' + soy.$$escapeHtml('The entire series will be removed.') + '</span></li></ul>';
};
if (goog.DEBUG) {
  Confluence.TeamCalendars.Templates.confirmRecurringEventDelete.soyTemplateName = 'Confluence.TeamCalendars.Templates.confirmRecurringEventDelete';
}


Confluence.TeamCalendars.Templates.confirmCustomEventNameDelete = function(opt_data, opt_ignored) {
  return '<p>' + soy.$$escapeHtml('This will delete all') + ' <strong>' + soy.$$escapeHtml(opt_data.customEventName) + '</strong> ' + soy.$$escapeHtml('events and remove this type of event from the calendar. This cannot be undone. Are you sure?') + '</p>';
};
if (goog.DEBUG) {
  Confluence.TeamCalendars.Templates.confirmCustomEventNameDelete.soyTemplateName = 'Confluence.TeamCalendars.Templates.confirmCustomEventNameDelete';
}

}catch(e){WRMCB(e)};
;
try {
/* module-key = 'com.atlassian.confluence.extra.team-calendars:user-timezone-setup', location = 'com/atlassian/confluence/extra/calendar3/components/user-timezone-setup/user-timezone-setup.soy' */
// This file was automatically generated from user-timezone-setup.soy.
// Please don't edit this file by hand.

/**
 * @fileoverview Templates in namespace Confluence.TeamCalendars.Templates.
 */

if (typeof Confluence == 'undefined') { var Confluence = {}; }
if (typeof Confluence.TeamCalendars == 'undefined') { Confluence.TeamCalendars = {}; }
if (typeof Confluence.TeamCalendars.Templates == 'undefined') { Confluence.TeamCalendars.Templates = {}; }


Confluence.TeamCalendars.Templates.userTimezoneSetup = function(opt_data, opt_ignored) {
  return '<div class="user-time-zone-desc"></div><div class="user-time-zone-select hidden"><select name="userTimeZoneSetupSelect" id="userTimeZoneSetupSelect" disabled="disabled"></select>&nbsp;<span class="spinner aui-icon aui-icon-wait"></span></div>';
};
if (goog.DEBUG) {
  Confluence.TeamCalendars.Templates.userTimezoneSetup.soyTemplateName = 'Confluence.TeamCalendars.Templates.userTimezoneSetup';
}

}catch(e){WRMCB(e)};
;
try {
/* module-key = 'com.atlassian.confluence.extra.team-calendars:user-timezone-setup', location = 'com/atlassian/confluence/extra/calendar3/components/user-timezone-setup/user-timezone-setup.js' */
define("tc/user-timezone-setup",["jquery","tc/util","tc-backbone","tc/templates"],function(b,d,e,a){var c=e.View.extend({dialog:null,options:null,$userTimeZoneSelectContainer:null,userTimeZone:"",isPDLEnabled:false,baseUrlRest:"",baseUrlCalendarService:"",ajaxTimeout:120000,template:a.userTimezoneSetup(),defaults:{callbackHandler:null,textTitleDialog:"Setup Team Calendars",textDescTimeZoneSetup:"Your time zone is currently set to {0}. If that is not your time zone, please select the right one.",textBtnOk:"OK"},initialize:function(f){this.options=b.extend({},this.defaults,f);if(!this.options.callbackHandler){AJS.debug("tc/user-timezone-setup: requires 'callbackHandler' object")}var g=Confluence.TeamCalendars;this.userTimeZone=g.getUserTimeZone();this.isPDLEnabled=g.isPDLEnabled();this.baseUrlRest=g.getRestBaseUrl();this.baseUrlCalendarService=g.getCalendarServiceBaseUrl("/preferences/timezone.json");this.ajaxTimeout=g.ajaxTimeout;this.options.textDescTimeZoneSetup=AJS.format(this.options.textDescTimeZoneSetup,this.userTimeZone)},render:function(){this._createDialog();this._populateTimeZoneDropDown();return this.dialog},_createDialog:function(){var f=this;this.dialog=new AJS.Dialog({width:512,height:this.isPDLEnabled?220:200,id:"team-calendars-timezone-setup-dialog"});this.dialog.addHeader(this.options.textTitleDialog);this.dialog.addPanel("",this.template,"setup-calendar-panel");this.dialog.addButton(this.options.textBtnOk,function(){f.dialog.hide();f.dialog.remove();f.options.callbackHandler.showCalendarWizard()},"set-timezone-button");this.el=this.dialog.getCurrentPanel().body;this.$el=b(this.el);this.$el.find(".user-time-zone-desc").text(this.options.textDescTimeZoneSetup);this.$userTimeZoneSelectContainer=this.$el.find(".user-time-zone-select");this.$userTimeZoneSelectContainer.removeClass("hidden");this.$userTimeZoneSelectContainer.find("select").change(_.bind(this._changeSelectionTimeZone,this));this.options.callbackHandler.suppressMessage("MESSAGE_KEY_TIMEZONE_SETUP");return this.dialog},_populateTimeZoneDropDown:function(){var g=this,f=this.$el.find("#userTimeZoneSetupSelect"),h=this.dialog.popup.element.find(".set-timezone-button");h.disable();g.$userTimeZoneSelectContainer.addClass("loading");b.ajax({type:"GET",url:this.baseUrlRest+"/timezones/user",success:function(i){f.html(a.timeZoneDropDown(i)).val(g.userTimeZone).removeAttr("disabled");g.$userTimeZoneSelectContainer.removeClass("loading");h.enable()},error:function(i,k,j){g.options.callbackHandler.showAjaxError(i,k,j);g.$userTimeZoneSelectContainer.removeClass("loading")},timeout:this.ajaxTimeout})},_changeSelectionTimeZone:function(){var h=this;this.$userTimeZoneSelectContainer.addClass("loading");var g=this.dialog.popup.element.find(".set-timezone-button").attr("disabled","disabled");var f=this.$userTimeZoneSelectContainer.find("option:selected");b.ajax({url:this.baseUrlCalendarService,cache:false,data:{timeZoneId:f.val()},error:function(i,k,j){h.options.callbackHandler.showAjaxError(i,k,j,"error-config-update");g.removeAttr("disabled");h.$userTimeZoneSelectContainer.removeClass("loading")},success:function(){h.options.callbackHandler.setGenericErrors(null,"error-config-update");h.options.callbackHandler.setParameter("userTimeZoneId",f.val());h.$el.find(".user-time-zone-desc").text(h.options.textDescTimeZoneSetup);g.removeAttr("disabled");h.$userTimeZoneSelectContainer.removeClass("loading")},type:"PUT",timeout:this.ajaxTimeout})}});return c});
}catch(e){WRMCB(e)};
;
try {
/* module-key = 'com.atlassian.confluence.extra.team-calendars:user-timezone-setup', location = 'com/atlassian/confluence/extra/calendar3/components/user-timezone-setup/user-timezone-setup-combat.js' */
require(["tc/user-timezone-setup"],function(a){if(!Confluence.TeamCalendars.Dialogs){Confluence.TeamCalendars.Dialogs={}}Confluence.TeamCalendars.Dialogs.getTimeZoneSetupDialog=function(b){return new a({callbackHandler:b}).render()}});
}catch(e){WRMCB(e)};
;
try {
/* module-key = 'com.atlassian.confluence.extra.team-calendars:import-subcalendar', location = 'com/atlassian/confluence/extra/calendar3/components/import-subcalendar/import-subcalendar.soy' */
// This file was automatically generated from import-subcalendar.soy.
// Please don't edit this file by hand.

/**
 * @fileoverview Templates in namespace Confluence.TeamCalendars.Templates.
 */

if (typeof Confluence == 'undefined') { var Confluence = {}; }
if (typeof Confluence.TeamCalendars == 'undefined') { Confluence.TeamCalendars = {}; }
if (typeof Confluence.TeamCalendars.Templates == 'undefined') { Confluence.TeamCalendars.Templates = {}; }


Confluence.TeamCalendars.Templates.importSubcalendar = function(opt_data, opt_ignored) {
  return '<div class="aui-message error calendar-error hidden"><p class="title"><span class="aui-icon icon-error"></span><strong>' + soy.$$escapeHtml('Error(s) occurred.') + '</strong></p><div class="error-content"><ul class="error-messages hidden"></ul></div></div><div class="aui-message warning tc-need-timezone hidden"><p class="title"><span class="aui-icon icon-warning"></span><strong>' + soy.$$escapeHtml('Unable to determine calendar timezone') + '</strong></p><p>' + soy.$$escapeHtml('The timezone for this calendar could not be determined. Please set the timezone below.') + '</p></div><form name="importSubCalendarForm" class="sub-calendar-import-form aui" method="POST" action="' + soy.$$escapeHtml("/wiki") + '/plugins/calendar/importsubcalendar.action" enctype="multipart/form-data" target="import-iframe-sink"><input type="hidden" name="calendarId" value=""><input type="hidden" name="decorator" value="none"><input type="hidden" name="color" value=""><input type="hidden" name="spaceKey" value=""><div class="field-group"><label for="import-name">' + soy.$$escapeHtml('Name') + '<span class="aui-icon icon-required"></span></label><input name="name" id="import-name"  type="text" class="text" value="" autocomplete="off"><div class="description">' + soy.$$escapeHtml('Leave this blank to use the calendar\x27s name from the ICS file.') + '</div><div class="error name-error"></div></div><div class="field-group"><label for="import-description">' + soy.$$escapeHtml('Description') + '</label><textarea name="description" id="import-description" rows="4" class="textarea"></textarea></div><div class="field-group field-group-space-permission"><label for="spaceKeyAutocomplete">' + soy.$$escapeHtml('Linked space') + '<span class="aui-icon icon-required"></span></label><input name="spaceKeyAutocomplete" id="spaceKeyAutocomplete" type="text" class="autocomplete-space text" data-max="5" data-none-message="' + soy.$$escapeHtml('No spaces found') + '"><div class="description">' + soy.$$escapeHtml('Link this calendar to a space.') + '</div><div class="error spaceKeyAutocomplete-error"></div></div><div class="field-group"><label for="ical-file">' + soy.$$escapeHtml('Upload iCal') + '<span class="aui-icon icon-required"></span></label><input type="file" class="file upfile" name="file_0" size="25"><div class="error file_0-error"></div></div><div class="field-group tc-field-group-timezone hidden"><label for="timeZone">' + soy.$$escapeHtml('Time zone') + '<span class="aui-icon icon-required"></span></label><select name="timeZoneId" class="select timeZone"></select><span class="spinner aui-icon aui-icon-wait"></span><div class="error timeZoneId-error"></div></div><iframe class="subcalendar-import-result hidden" name="import-iframe-sink" src="' + soy.$$escapeHtml("/wiki") + '/fourohfour.action"></iframe></form>';
};
if (goog.DEBUG) {
  Confluence.TeamCalendars.Templates.importSubcalendar.soyTemplateName = 'Confluence.TeamCalendars.Templates.importSubcalendar';
}

}catch(e){WRMCB(e)};
;
try {
/* module-key = 'com.atlassian.confluence.extra.team-calendars:import-subcalendar', location = 'com/atlassian/confluence/extra/calendar3/components/import-subcalendar/import-subcalendar.js' */
define("tc/import-subcalendar",["jquery","underscore","tc/util","tc-backbone","tc/templates","tc/calendar-util"],function(e,a,f,g,c,b){var d=g.View.extend({dialog:null,$uploadIframe:null,$submitButton:null,options:null,template:c.importSubcalendar(),events:{"selected.autocomplete-content input[name='spaceKeyAutocomplete']":"_selectSpace","submit .sub-calendar-import-form":"_submit"},defaults:{callbackHandler:null,textTitleDialog:"Import calendar",textBtnImport:"Import",textLinkCancel:"Cancel"},initialize:function(h){this.options=e.extend({},this.defaults,h);if(!this.options.callbackHandler){AJS.debug("tc/import-subcalendar: requires 'callbackHandler' object")}},render:function(){this._createSubCalendarImportDialog();this._populateSubCalendarImportForm();this.$submitButton=this.dialog.popup.element.find(".submit");return this.dialog},_createSubCalendarImportDialog:function(){var h=this,i=function(){var j=h.$el.find("form.sub-calendar-import-form");j.submit();return false};if(this.dialog){return}this.dialog=new AJS.ConfluenceDialog({height:429,width:512,onSubmit:i,id:"import-calendar-dialog"});this.dialog.addHeader(this.options.textTitleDialog);this.dialog.addPanel("",this.template,"calendar-dialog-panel");this.dialog.addButton(this.options.textBtnImport,i,"submit");this.dialog.addLink(this.options.textLinkCancel,a.bind(this._cancelDialog,this));this.el=this.dialog.getCurrentPanel().body;this.$el=e(this.el);this.$uploadIframe=this.$el.find(".subcalendar-import-result");this.delegateEvents();this.$el.find(".subcalendar-import-result").load(a.bind(this._loadedResultImport,this))},_populateSubCalendarImportForm:function(){this.$el.find("input[name='name'], textarea[name='description'], input[name='spaceKey'], input[name='spaceKeyAutocomplete']").val("");this.$el.find("input[name='color']").val(this.options.callbackHandler.getNextCalendarColor());this.$el.find(".field-group .error").empty();if(AJS.Meta.get("space-key")){this.$el.find("input[name='spaceKey']").val(AJS.Meta.get("space-key"));var h=e(".field-group-space-permission",this.$el);h.css("display","none")}},_submit:function(){this.options.callbackHandler.setProcessingSubCalendar(true);this.spinnerDefer=this.options.callbackHandler.setSubCalendarSpinnerIconVisible(true);this.$uploadIframe.data("activated",true);b.disableButton(this.$submitButton,"Importing...")},_selectSpace:function(i,h){this.$el.find("input[name='spaceKey']").val(h.content.key);this.$el.find("input[name='spaceKeyAutocomplete']").val(h.content.name)},_cancelDialog:function(){this.dialog.remove();this.dialog=null;return false},_loadedResultImport:function(){var j=this;if(!this.$uploadIframe.data("activated")){return}var l=this.$uploadIframe[0].contentWindow||this.$uploadIframe[0].contentDocument;l=l.document?l.document:l;var i=e(l).find(".subcalendar-id").text();if(e(".import-timezone-required",l).length){b.disableButton(this.$submitButton);j.$el.find(".tc-need-timezone").show();j.$el.find(".tc-field-group-timezone").show();Confluence.TeamCalendars.populateTimeZoneDropDown(j.$el.find(".tc-field-group-timezone .timeZone"),Confluence.TeamCalendars.getUserTimeZone(),function(){b.enableButton(j.$submitButton,"Import")},function(m,o,n){j.options.callbackHandler.showAjaxError(m,o,n)});j.dialog.updateHeight()}else{if(!e(".import-successful",l).length){var h=[];e(".field-errors input",l).each(function(){h.push({field:this.name,errorMessages:[this.value]})});if(h.length){Confluence.TeamCalendars.setFieldErrors(j.$el.find(".sub-calendar-import-form")[0],h);j.dialog.updateHeight()}var k=[];e(".action-error",l).each(function(){k.push(e(this).text())});if(k.length){Confluence.TeamCalendars.setGenericErrors(j.el,k,"error-subcalendar-update")}}else{j.dialog.remove();j.options.callbackHandler.handleImport(i)}}b.enableButton(this.$submitButton,"Import");if(this.spinnerDefer){this.spinnerDefer.resolve()}j.options.callbackHandler.setProcessingSubCalendar(false)}});return d});
}catch(e){WRMCB(e)};
;
try {
/* module-key = 'com.atlassian.confluence.extra.team-calendars:import-subcalendar', location = 'com/atlassian/confluence/extra/calendar3/components/import-subcalendar/import-subcalendar-compat.js' */
require(["tc/import-subcalendar"],function(a){if(!Confluence.TeamCalendars.Dialogs){Confluence.TeamCalendars.Dialogs={}}Confluence.TeamCalendars.Dialogs.getSubCalendarImportDialog=function(b){return new a({callbackHandler:b}).render()}});
}catch(e){WRMCB(e)};
;
try {
/* module-key = 'com.atlassian.confluence.extra.team-calendars:customeventtype-edit', location = 'com/atlassian/confluence/extra/calendar3/components/customeventype/customeventtype-model.js' */
define("tc/customeventtype-model",["jquery","tc-backbone"],function(b,c){var a=c.Model.extend({defaults:function(){return{title:"",icon:"",subCalendar:"",disable:false,isCustomEvent:false,id:"",created:"",periodInMins:""}},validate:function(d){if(!d.isCustomEvent){return false}var e=[];if(!d.title){e.push({field:"title",message:"Event name is required"})}d.title=b.trim(d.title);if(d.title.length<=0){e.push({field:"title",message:"Event name is required"})}else{if(d.title.length>256){e.push({field:"title",message:"Event name should be less than or equal to 256 characters"})}}if(!d.icon){e.push({field:"icon",message:"Event icon is required"})}return e.length>0?e:false},toggle:function(){this.set({disable:!this.get("disable")})}});return a});
}catch(e){WRMCB(e)};
;
try {
/* module-key = 'com.atlassian.confluence.extra.team-calendars:customeventtype-edit', location = 'com/atlassian/confluence/extra/calendar3/components/customeventype/customeventtype-edit/customeventtype-edit.soy' */
// This file was automatically generated from customeventtype-edit.soy.
// Please don't edit this file by hand.

/**
 * @fileoverview Templates in namespace Confluence.TeamCalendars.Templates.
 */

if (typeof Confluence == 'undefined') { var Confluence = {}; }
if (typeof Confluence.TeamCalendars == 'undefined') { Confluence.TeamCalendars = {}; }
if (typeof Confluence.TeamCalendars.Templates == 'undefined') { Confluence.TeamCalendars.Templates = {}; }


Confluence.TeamCalendars.Templates.editCustomEventType = function(opt_data, opt_ignored) {
  return '<tr id="edit-custom-event-type-form"><td colspan="3"><div class="aui-message warning tooltip-warning hidden"><span class="title"><span class="aui-icon icon-warning"></span>' + soy.$$escapeHtml('Save or cancel your custom event type before continuing.') + '</span></div><form class="aui form-add-custom">' + ((opt_data.isCustomEventType) ? '<fieldset class="field-group custom-event-title"><label for="event-title">' + soy.$$escapeHtml('Event Name') + '<span class="aui-icon icon-required">required</span></label><input class="text medium-field" type="text" id="custom-eventtype-title" name="event-title" title="Event Title" value="' + soy.$$escapeHtml(opt_data.title) + '"/><p class="hidden error custom_event_type_field_error" data-field-name="title"></p></fieldset><fieldset class="field-group select-avatar tc-event-type-item"><label for="event-title">' + soy.$$escapeHtml('Event Icon') + '<span class="aui-icon icon-required">required</span></label><div class = "custom-eventtype-icons"><button class="' + ((opt_data.icon == 'campaign') ? 'selected' : '') + '"><span class="aui-icon icon-teamcals campaign" data-icon = "campaign"></span></button><button class="' + ((opt_data.icon == 'conference') ? 'selected' : '') + '"><span class="aui-icon icon-teamcals conference" data-icon = "conference"></span></button><button class="' + ((opt_data.icon == 'deployment') ? 'selected' : '') + '"><span class="aui-icon icon-teamcals deployment" data-icon = "deployment" ></span></button><button class="' + ((opt_data.icon == 'home') ? 'selected' : '') + '"><span class="aui-icon icon-teamcals home" data-icon = "home"></span></button><button class="' + ((opt_data.icon == 'marketing_email') ? 'selected' : '') + '"><span class="aui-icon icon-teamcals marketing_email" data-icon = "marketing_email"></span></button><button class="' + ((opt_data.icon == 'meeting') ? 'selected' : '') + '"><span class="aui-icon icon-teamcals meeting" data-icon = "meeting"></span></button><button class="' + ((opt_data.icon == 'milestone') ? 'selected' : '') + '"><span class="aui-icon icon-teamcals milestone" data-icon = "milestone"></span></button><button class="' + ((opt_data.icon == 'outage') ? 'selected' : '') + '"><span class="aui-icon icon-teamcals outage" data-icon = "outage"></span></button><button class="' + ((opt_data.icon == 'party') ? 'selected' : '') + '"><span class="aui-icon icon-teamcals party" data-icon = "party"></span></button><button class="' + ((opt_data.icon == 'sporting_event') ? 'selected' : '') + '"><span class="aui-icon icon-teamcals sporting_event" data-icon = "sporting_event"></span></button><button class="' + ((opt_data.icon == 'testing') ? 'selected' : '') + '"><span class="aui-icon icon-teamcals testing" data-icon = "testing"></span></button><button class="' + ((opt_data.icon == 'training') ? 'selected' : '') + '"><span class="aui-icon icon-teamcals training" data-icon = "training"></span></button><button class="' + ((opt_data.icon == 'workshop') ? 'selected' : '') + '"><span class="aui-icon icon-teamcals workshop" data-icon = "workshop"></span></button><button class="' + ((opt_data.icon == 'events') ? 'selected' : '') + '"><span class="aui-icon icon-teamcals events" data-icon = "events"></span></button><button class="' + ((opt_data.icon == 'travel') ? 'selected' : '') + '"><span class="aui-icon icon-teamcals travel" data-icon = "travel"></span></button><!--<button class="' + ((opt_data.icon == 'birthdays') ? 'selected' : '') + '"><span class="aui-icon icon-teamcals birthdays" data-icon = "birthdays"></span></button>--><button class="' + ((opt_data.icon == 'leaves') ? 'selected' : '') + '"><span class="aui-icon icon-teamcals leaves" data-icon = "leaves"></span></button><button class="' + ((opt_data.icon == 'jira_box') ? 'selected' : '') + '"><span class="aui-icon icon-teamcals jira_box" data-icon = "jira_box"></span></button><button class="' + ((opt_data.icon == 'sprints') ? 'selected' : '') + '"><span class="aui-icon icon-teamcals sprints" data-icon = "sprints"></span></button></div><p class="hidden error custom_event_type_field_error" data-field-name="icon"></p></fieldset>' : '<fieldset class="field-group"><span class="event-type-link" title="' + soy.$$escapeHtml(opt_data.title) + '"><span class="' + soy.$$escapeHtml(opt_data.icon) + '"></span><span class="event-type-label">' + soy.$$escapeHtml(opt_data.title) + '</span></span></fieldset>') + '<fieldset><div class="field-group"><label for="dBase">' + soy.$$escapeHtml('Reminder') + '</label><select class="select" id="period-reminder" name="period" title="database select"><option value="0" ' + ((opt_data.periodInMins == 0) ? 'selected' : '') + '>' + soy.$$escapeHtml('None') + '</option><option value="5" ' + ((opt_data.periodInMins == 5) ? 'selected' : '') + '>' + soy.$$escapeHtml(AJS.format('{0} minutes','5')) + ' ' + soy.$$escapeHtml('before') + '</option><option value="10" ' + ((opt_data.periodInMins == 10) ? 'selected' : '') + '>' + soy.$$escapeHtml(AJS.format('{0} minutes','10')) + ' ' + soy.$$escapeHtml('before') + '</option><option value="20" ' + ((opt_data.periodInMins == 20) ? 'selected' : '') + '>' + soy.$$escapeHtml(AJS.format('{0} minutes','20')) + ' ' + soy.$$escapeHtml('before') + '</option><option value="30" ' + ((opt_data.periodInMins == 30) ? 'selected' : '') + '>' + soy.$$escapeHtml(AJS.format('{0} minutes','30')) + ' ' + soy.$$escapeHtml('before') + '</option><option value="60" ' + ((opt_data.periodInMins == 60) ? 'selected' : '') + '>' + soy.$$escapeHtml(AJS.format('{0} hour','1')) + ' ' + soy.$$escapeHtml('before') + '</option><option value="120" ' + ((opt_data.periodInMins == 120) ? 'selected' : '') + '>' + soy.$$escapeHtml(AJS.format('{0} hours','2')) + ' ' + soy.$$escapeHtml('before') + '</option><option value="240" ' + ((opt_data.periodInMins == 240) ? 'selected' : '') + '>' + soy.$$escapeHtml(AJS.format('{0} hours','4')) + ' ' + soy.$$escapeHtml('before') + '</option><option value="480" ' + ((opt_data.periodInMins == 480) ? 'selected' : '') + '>' + soy.$$escapeHtml(AJS.format('{0} hours','8')) + ' ' + soy.$$escapeHtml('before') + '</option><option value="1440" ' + ((opt_data.periodInMins == 1440) ? 'selected' : '') + '>' + soy.$$escapeHtml(AJS.format('{0} day','1')) + ' ' + soy.$$escapeHtml('before') + '</option><option value="2880" ' + ((opt_data.periodInMins == 2880) ? 'selected' : '') + '>' + soy.$$escapeHtml(AJS.format('{0} days','2')) + ' ' + soy.$$escapeHtml('before') + '</option><option value="4320" ' + ((opt_data.periodInMins == 4320) ? 'selected' : '') + '>' + soy.$$escapeHtml(AJS.format('{0} days','3')) + ' ' + soy.$$escapeHtml('before') + '</option><option value="10080" ' + ((opt_data.periodInMins == 10080) ? 'selected' : '') + '>' + soy.$$escapeHtml(AJS.format('{0} week','1')) + ' ' + soy.$$escapeHtml('before') + '</option><option value="20160" ' + ((opt_data.periodInMins == 20160) ? 'selected' : '') + '>' + soy.$$escapeHtml(AJS.format('{0} weeks','2')) + ' ' + soy.$$escapeHtml('before') + '</option><option value="30240" ' + ((opt_data.periodInMins == 30240) ? 'selected' : '') + '>' + soy.$$escapeHtml(AJS.format('{0} weeks','3')) + ' ' + soy.$$escapeHtml('before') + '</option><option value="40320" ' + ((opt_data.periodInMins == 40320) ? 'selected' : '') + '>' + soy.$$escapeHtml(AJS.format('{0} weeks','4')) + ' ' + soy.$$escapeHtml('before') + '</option></select></div></fieldset><div class="event-type-info"><div class="tc-aui-help-content"><div class="event-type-info-text"><span>' + soy.$$escapeHtml('Changes will affect everyone that uses this calendar; including reminder times.') + '</span></div></div></div><span class="buttons-container"><span class="buttons"><input class="button button-panel-button save" tabindex="30" type="button" value="' + soy.$$escapeHtml('Save') + '" id="save-custom-event-type"><a class="cancel" tabindex="31"  href="#">Cancel</a></span></span></form></td></tr>';
};
if (goog.DEBUG) {
  Confluence.TeamCalendars.Templates.editCustomEventType.soyTemplateName = 'Confluence.TeamCalendars.Templates.editCustomEventType';
}

}catch(e){WRMCB(e)};
;
try {
/* module-key = 'com.atlassian.confluence.extra.team-calendars:customeventtype-edit', location = 'com/atlassian/confluence/extra/calendar3/components/customeventype/customeventtype-edit/customeventtype-edit.js' */
define("tc/customeventtype-edit",["jquery","underscore","tc-backbone"],function(c,a,d){var b=d.View.extend({parentCustomEventTypeDiv:null,mediator:null,isOpen:null,events:{"click input.save":"_updateCustomEventType","click a.cancel":"_closeInlineDialog","click .select-avatar button":"_selectIconCustomEventType",keydown:"handleKey"},initialize:function(e){if(!e){return}this.mediator=e.mediator;this.parentCustomEventTypeDiv=e.parentCustomEventTypeDiv;this.model.on("invalid",a.bind(this._handleError,this));this.mediator.on("Custom-Event-Type.edit.open",a.bind(this.shouldRemoveMe,this));this.mediator.trigger("Custom-Event-Type.edit.open",this)},render:function(){var e=this;var f=e.model.get("isCustomEvent")===true;c(".custom-event-type-items-instructional").addClass("hidden");c(e.parentCustomEventTypeDiv).addClass("hidden");c(e.parentCustomEventTypeDiv).after(Confluence.TeamCalendars.Templates.editCustomEventType({title:e.model.get("title"),icon:e.model.get("icon"),periodInMins:e.model.get("periodInMins"),isCustomEventType:f}));e.$editCustomEventTypeForm=c("#edit-custom-event-type-form");e.el=e.$editCustomEventTypeForm;e.$el=c(e.el);e.delegateEvents();e.$editCustomEventTypeForm.find(".custom-event-title input").focus();this.isOpen=true},shouldRemoveMe:function(){if(this.isOpen){this.remove()}},remove:function(){this._closeInlineDialog()},handleKey:function(f){if(f.which===13){f.preventDefault();f.stopPropagation();this._updateCustomEventType()}if(f.which===27){f.preventDefault();f.stopPropagation();this._closeInlineDialog()}},_closeInlineDialog:function(){c(this.parentCustomEventTypeDiv).removeClass("hidden");if(this.model.collection&&this.model.collection.customEventTypes().length===0){c(".custom-event-type-items-instructional").removeClass("hidden")}this.$editCustomEventTypeForm.remove()},_updateCustomEventType:function(){this.$editCustomEventTypeForm.find(".custom_event_type_field_error").each(function(l,m){var k=c(m);if(!k.hasClass("hidden")){k.addClass("hidden")}});var j=this.$editCustomEventTypeForm.find(".custom-event-title input").val();var f=this.$editCustomEventTypeForm.find(".select-avatar button.selected span").data("icon");var e=this.$editCustomEventTypeForm.find("#period-reminder").val();var h=this.model.get("title");var g=this.model.get("icon");var i=this.model.get("periodInMins");this.model.set({title:j!==undefined?j:h,icon:f!==undefined?f:g,periodInMins:e});if(!this.model.isValid()){this.model.set({title:h,icon:g,periodInMins:i});return}this.mediator.trigger("Custom-Event-Type.save",this.model);this._closeInlineDialog()},_handleError:function(f,h){var g=this;var e=function(j){var i=a.where(h,{field:j});if(i.length>0){return i[0].message}return""};this.$editCustomEventTypeForm.find(".custom_event_type_field_error").each(function(j,k){var i=c(k);var l=i.data("field-name");i.html(e(l));if(i.hasClass("hidden")){i.removeClass("hidden")}if(l==="title"){g.$editCustomEventTypeForm.find("#custom-eventtype-title").focus()}})},_selectIconCustomEventType:function(e){if(!e){e=window.event}e.preventDefault();c(".select-avatar.tc-event-type-item button").removeClass("selected");var f=e.target||e.srcElement;if(f.nodeName==="SPAN"){c(f).parent().addClass("selected")}else{c(f).addClass("selected")}}});return b});
}catch(e){WRMCB(e)};
;
try {
/* module-key = 'com.atlassian.confluence.extra.team-calendars:customeventtype-edit', location = 'com/atlassian/confluence/extra/calendar3/components/customeventype/customeventtype-edit/customeventtype-edit-compat.js' */
require(["tc/customeventtype-edit","tc/customeventtype-model"],function(a,b){if(!Confluence.TeamCalendars.Dialogs){Confluence.TeamCalendars.Dialogs={}}Confluence.TeamCalendars.Dialogs.getCustomEventTypeEdit=function(f,c){var e=$(f).parent().parent();var g=$(e).find("span.custom-event-type").data();var d=new b({title:g.title,icon:g.icon,subCalendar:c,periodInMins:g.periodInMins});return new a({parentCustomEventTypeDiv:e,dataCustomEventType:g,model:d}).render()}});
}catch(e){WRMCB(e)};
;
try {
/* module-key = 'com.atlassian.confluence.extra.team-calendars:event-edit', location = 'com/atlassian/confluence/extra/calendar3/components/manage-event/event-edit/event-edit-dialog.soy' */
// This file was automatically generated from event-edit-dialog.soy.
// Please don't edit this file by hand.

/**
 * @fileoverview Templates in namespace Confluence.TeamCalendars.Templates.
 */

if (typeof Confluence == 'undefined') { var Confluence = {}; }
if (typeof Confluence.TeamCalendars == 'undefined') { Confluence.TeamCalendars = {}; }
if (typeof Confluence.TeamCalendars.Templates == 'undefined') { Confluence.TeamCalendars.Templates = {}; }


Confluence.TeamCalendars.Templates.eventEdit = function(opt_data, opt_ignored) {
  return '<form name="event-edit" class="aui event-edit" method="POST" action="#"><input type="hidden" name="uid" value=""><input type="hidden" name="originalStartDate" value=""><input type="hidden" name="originalSubCalendarId" value=""><input type="hidden" name="originalEventType" value=""><input type="hidden" name="originalCustomEventTypeId" value=""><input type="hidden" name="childSubCalendarId" value=""><div class="event-type subcalendar-event"><div class="aui-message error calendar-error hidden"><p class="title"><span class="aui-icon icon-error"></span><strong>' + soy.$$escapeHtml('Error(s) occurred.') + '</strong></p><div class="error-content"><ul class="error-messages hidden"></ul></div></div><div class="field-group field-group-calendar"><label for="calendar">' + soy.$$escapeHtml('Calendar') + '<span class="aui-icon icon-required"></span></label><select name="calendar" id="calendar" class="sub-calendar-select select"></select><a href="#" id="calendar-tooltip" class="aui-icon icon-help hidden" original-title="show tooltip" title="' + soy.$$escapeHtml('This field is enabled when the field \x22Edit this instance only\x22 is unchecked') + '"></a></div><div class="field-group field-group-event-type"><label for="event-type">' + soy.$$escapeHtml('Event Type') + '<span class="aui-icon icon-required"></span></label><select name="event-type" id="event-type" class="event-type-select select"></select><a href="#" id="calendar-tooltip" class="aui-icon icon-help hidden" original-title="show tooltip" title="' + soy.$$escapeHtml('This field is enabled when the field \x22Edit this instance only\x22 is unchecked') + '"></a><div class="error type-error"></div></div><div id="event-fields-container"></div></form>';
};
if (goog.DEBUG) {
  Confluence.TeamCalendars.Templates.eventEdit.soyTemplateName = 'Confluence.TeamCalendars.Templates.eventEdit';
}

}catch(e){WRMCB(e)};
;
try {
/* module-key = 'com.atlassian.confluence.extra.team-calendars:event-edit', location = 'com/atlassian/confluence/extra/calendar3/components/manage-event/event-edit/event-fields.soy' */
// This file was automatically generated from event-fields.soy.
// Please don't edit this file by hand.

/**
 * @fileoverview Templates in namespace Confluence.TeamCalendars.Templates.Fields.
 */

if (typeof Confluence == 'undefined') { var Confluence = {}; }
if (typeof Confluence.TeamCalendars == 'undefined') { Confluence.TeamCalendars = {}; }
if (typeof Confluence.TeamCalendars.Templates == 'undefined') { Confluence.TeamCalendars.Templates = {}; }
if (typeof Confluence.TeamCalendars.Templates.Fields == 'undefined') { Confluence.TeamCalendars.Templates.Fields = {}; }


Confluence.TeamCalendars.Templates.Fields.text = function(opt_data, opt_ignored) {
  return '<div class="field-group field-' + soy.$$escapeHtml(opt_data.id) + '" id="field-text-' + soy.$$escapeHtml(opt_data.id) + '"><label for="' + soy.$$escapeHtml(opt_data.id) + '">' + soy.$$escapeHtml(opt_data.label) + ((opt_data.required) ? '<span class="aui-icon icon-required"></span>' : '') + '</label><input type="text" class="text" name="' + soy.$$escapeHtml(opt_data.id) + '" id="' + soy.$$escapeHtml(opt_data.id) + '-text" value="" ' + ((opt_data.readOnly) ? ' readonly="readonly"' : '') + '><div class="error ' + soy.$$escapeHtml(opt_data.id) + '-error"></div></div>';
};
if (goog.DEBUG) {
  Confluence.TeamCalendars.Templates.Fields.text.soyTemplateName = 'Confluence.TeamCalendars.Templates.Fields.text';
}


Confluence.TeamCalendars.Templates.Fields.inforReminderLabel = function(opt_data, opt_ignored) {
  return '<div class="field-group field-' + soy.$$escapeHtml(opt_data.id) + '" id="field-text-' + soy.$$escapeHtml(opt_data.id) + '"><label for="' + soy.$$escapeHtml(opt_data.id) + '">' + soy.$$escapeHtml(opt_data.label) + '</label><div class="bodyInforReminderLabel">' + Confluence.TeamCalendars.Templates.Fields.bodyInforReminderLabel(opt_data) + '</div></div>';
};
if (goog.DEBUG) {
  Confluence.TeamCalendars.Templates.Fields.inforReminderLabel.soyTemplateName = 'Confluence.TeamCalendars.Templates.Fields.inforReminderLabel';
}


Confluence.TeamCalendars.Templates.Fields.bodyInforReminderLabel = function(opt_data, opt_ignored) {
  return '' + ((opt_data.reminderPeriod > 0) ? '<span class="span-label field-value-normal">' + soy.$$filterNoAutoescape(opt_data.reminderPeriodText) + '</span><p/><div class="reminder-info"><div class="reminder-info-icon"><span class="aui-icon aui-icon-small aui-iconfont-info">Info</span></div><div class="reminder-info-text"><span>' + soy.$$filterNoAutoescape('Reminders are inherited from the event type. \x3ca href\x3d\x22#\x22 id\x3d\x22calendar-reminder-setting\x22\x3eEdit event type\x3c/a\x3e') + '</span></div></div>' : '<span class="span-label field-value-normal">' + soy.$$escapeHtml(opt_data.reminderPeriodText) + ' ' + soy.$$filterNoAutoescape('\x3ca href\x3d\x22#\x22 id\x3d\x22calendar-reminder-setting\x22 class\x3d\x22add-reminder-setting\x22\x3eAdd reminder\x3c/a\x3e') + '</span>');
};
if (goog.DEBUG) {
  Confluence.TeamCalendars.Templates.Fields.bodyInforReminderLabel.soyTemplateName = 'Confluence.TeamCalendars.Templates.Fields.bodyInforReminderLabel';
}


Confluence.TeamCalendars.Templates.Fields.textarea = function(opt_data, opt_ignored) {
  return '<div class="field-group field-' + soy.$$escapeHtml(opt_data.id) + '" id="field-textarea-' + soy.$$escapeHtml(opt_data.id) + '"><label for="' + soy.$$escapeHtml(opt_data.id) + '">' + soy.$$escapeHtml(opt_data.label) + ((opt_data.required) ? '<span class="aui-icon icon-required"></span>' : '') + '</label><textarea name="' + soy.$$escapeHtml(opt_data.id) + '" id="' + soy.$$escapeHtml(opt_data.id) + '-textarea" class="textarea" rows="' + soy.$$escapeHtml(opt_data.size) + '" ' + ((opt_data.readOnly) ? ' readonly="readonly"' : '') + '></textarea><div class="error ' + soy.$$escapeHtml(opt_data.id) + '-error"></div></div>';
};
if (goog.DEBUG) {
  Confluence.TeamCalendars.Templates.Fields.textarea.soyTemplateName = 'Confluence.TeamCalendars.Templates.Fields.textarea';
}


Confluence.TeamCalendars.Templates.Fields.page = function(opt_data, opt_ignored) {
  return '<div class="field-group field-' + soy.$$escapeHtml(opt_data.id) + ' field-group-eventlink" id="field-page-' + soy.$$escapeHtml(opt_data.id) + '"><label for="' + soy.$$escapeHtml(opt_data.id) + '">' + soy.$$escapeHtml(opt_data.label) + ((opt_data.required) ? '<span class="aui-icon icon-required"></span>' : '') + '</label><input type="text" class="text" name="' + soy.$$escapeHtml(opt_data.id) + '" id="' + soy.$$escapeHtml(opt_data.id) + '-text" value="" ' + ((opt_data.readOnly) ? ' readonly="readonly"' : '') + '><div class="' + soy.$$escapeHtml(opt_data.id) + '-suggestions aui-dd-parent hidden" ><div class="aui-dropdown"></div></div><div class="error ' + soy.$$escapeHtml(opt_data.id) + '-error"></div></div>';
};
if (goog.DEBUG) {
  Confluence.TeamCalendars.Templates.Fields.page.soyTemplateName = 'Confluence.TeamCalendars.Templates.Fields.page';
}


Confluence.TeamCalendars.Templates.Fields.when = function(opt_data, opt_ignored) {
  return '<div id="field-when"><fieldset class="date-select"><legend><span>' + soy.$$escapeHtml('When') + '<span class="aui-icon icon-required"></span></span></legend><div class="field-group"><label for="startDate">' + soy.$$escapeHtml('Start date') + '</label><input class="datepicker-field date-field start text" type="text" name="startDate" id="' + soy.$$escapeHtml(opt_data.id) + '-startDate" size="10" value="" autocomplete="off" ' + ((opt_data.disableStartDateTime) ? ' disabled="disabled"' : '') + '><label for="startTime">' + soy.$$escapeHtml('Start time') + '</label><input type="text" class="time-field text" name="startTime" id="' + soy.$$escapeHtml(opt_data.id) + '-startTime" size="8" ' + ((opt_data.disableStartDateTime) ? ' disabled="disabled"' : '') + '><span>' + soy.$$escapeHtml('to') + '</span><label for="endTime">' + soy.$$escapeHtml('End date') + '</label><input type="text" class="time-field text" name="endTime" id="' + soy.$$escapeHtml(opt_data.id) + '-endTime" size="8" ' + ((opt_data.disableEndDateTime) ? ' disabled="disabled"' : '') + '><label for="endDate">' + soy.$$escapeHtml('End time') + '</label><input class="datepicker-field date-field end text" type="text" name="endDate" id="' + soy.$$escapeHtml(opt_data.id) + '-endDate" size="10" value="" autocomplete="off" ' + ((opt_data.disableEndDateTime) ? ' disabled="disabled"' : '') + '><div class="error when-error"></div></div></fieldset><div class="field-group field-group-allday"><label for="allDayEvent">' + soy.$$escapeHtml('All day event') + '</label><input type="checkbox" class="checkbox" name="allDayEvent" id="' + soy.$$escapeHtml(opt_data.id) + '-allDayEvent" value="true" ' + ((opt_data.disableAllDay) ? ' disabled="disabled"' : '') + '></div></div>';
};
if (goog.DEBUG) {
  Confluence.TeamCalendars.Templates.Fields.when.soyTemplateName = 'Confluence.TeamCalendars.Templates.Fields.when';
}


Confluence.TeamCalendars.Templates.Fields.repeats = function(opt_data, opt_ignored) {
  return '<div id="field-repeats"><input type="hidden" name="freq" value=""><input type="hidden" name="byday" value=""><input type="hidden" name="recurrenceId" value=""><div class="field-group edit-this-instance-only-container hidden"><label for="editthisinstanceonly">' + soy.$$escapeHtml('Edit this instance only') + '</label><input type="checkbox" class="checkbox" name="editthisinstanceonly" id="editthisinstanceonly" value="true" checked="checked"></div><div class="field-group field-group-frequency"><label for="freq-select">' + soy.$$escapeHtml('Repeat') + '</label><select name="freq-select" id="' + soy.$$escapeHtml(opt_data.id) + '-freq-select" class="select"><option value="">' + soy.$$escapeHtml('Doesn\x27t repeat') + '</option><option value="DAILY">' + soy.$$escapeHtml('Daily') + '</option><option value="WEEKLY-BYDAY">' + soy.$$escapeHtml('Weekdays') + '</option><option value="WEEKLY">' + soy.$$escapeHtml('Weekly') + '</option><option value="MONTHLY">' + soy.$$escapeHtml('Monthly') + '</option><option value="YEARLY">' + soy.$$escapeHtml('Yearly') + '</option></select></div><div class="hidden field-group interval-container"><label for="interval">' + soy.$$escapeHtml('Repeat every') + '</label><input type="text" class="text" name="interval" id="' + soy.$$escapeHtml(opt_data.id) + '-interval" maxlength="2"><span class="interval-label"></span><div class="error interval-error"></div></div><fieldset class="date-select recur-ends hidden"><legend><span>' + soy.$$escapeHtml('End repeat') + '</span></legend><div class="field-group"><label for="recur-end-never">' + soy.$$escapeHtml('Never') + '</label><input type="radio" class="radio recur-ends-never" name="recur-end" id="' + soy.$$escapeHtml(opt_data.id) + '-recur-end-never" checked="checked"><span class="label">' + soy.$$escapeHtml('Never') + '</span><label for="recur-end-until">' + soy.$$escapeHtml('On date') + '</label><input type="radio" class="radio recur-ends-until" name="recur-end" id="' + soy.$$escapeHtml(opt_data.id) + '-recur-end-until" disabled="disabled"><span class="label">' + soy.$$escapeHtml('On date') + '</span><input class="datepicker-field date-field text" type="text" class="" name="until" id="' + soy.$$escapeHtml(opt_data.id) + '-until" value="" size="10" disabled="disabled"  autocomplete="off"><div class="error until-error"></div></div></fieldset></div>';
};
if (goog.DEBUG) {
  Confluence.TeamCalendars.Templates.Fields.repeats.soyTemplateName = 'Confluence.TeamCalendars.Templates.Fields.repeats';
}


Confluence.TeamCalendars.Templates.Fields.user = function(opt_data, opt_ignored) {
  return '<div class="field-group field-group-' + soy.$$escapeHtml(opt_data.id) + '" id="field-user-' + soy.$$escapeHtml(opt_data.id) + '"><label for="' + soy.$$escapeHtml(opt_data.id) + '">' + soy.$$escapeHtml(opt_data.label) + ((opt_data.required) ? '<span class="aui-icon icon-required"></span>' : '') + '</label><input type="text" class="text autocomplete-user" name="' + soy.$$escapeHtml(opt_data.id) + '" id="' + soy.$$escapeHtml(opt_data.id) + '-user-picker" value="" data-max="10" data-none-message="' + soy.$$escapeHtml('No users found.') + '" data-template="{title}"><ul class="invitees hidden"></ul><div class="error ' + soy.$$escapeHtml(opt_data.id) + '-error"></div></div>';
};
if (goog.DEBUG) {
  Confluence.TeamCalendars.Templates.Fields.user.soyTemplateName = 'Confluence.TeamCalendars.Templates.Fields.user';
}


Confluence.TeamCalendars.Templates.Fields.userSelection = function(opt_data, opt_ignored) {
  return '<li class="invitee" title="' + soy.$$escapeHtml(opt_data.fullName) + ' (' + soy.$$escapeHtml(opt_data.userName) + ')"><div class="invitee-left" threedots="' + soy.$$escapeHtml(opt_data.fullName) + ' (' + soy.$$escapeHtml(opt_data.userName) + ')"><img src="' + soy.$$escapeHtml(opt_data.imgPath) + '"><span class="invitee-name-display">' + soy.$$escapeHtml(opt_data.fullName) + '<span class="user-name">(' + soy.$$escapeHtml(opt_data.userName) + ')</span></span></div><div class="invitee-right"><a class="delete-invitee" title="' + soy.$$escapeHtml('Delete') + '"></a></div><div class="clear"></div></li>';
};
if (goog.DEBUG) {
  Confluence.TeamCalendars.Templates.Fields.userSelection.soyTemplateName = 'Confluence.TeamCalendars.Templates.Fields.userSelection';
}


Confluence.TeamCalendars.Templates.Fields.serverSelector = function(opt_data, opt_ignored) {
  return '<div class="field-group field-group-jira field-group-jira-server" id="field-serverSelector"><label for="tc-jira-server">' + soy.$$escapeHtml('Server') + '<span class="aui-icon icon-required"></span></label><select name="tc-jira-server" class="select tc-jira-server"></select><span class="spinner aui-icon aui-icon-wait"></span><div class="error server-error"></div><div class="error oauth-error hidden"></div></div>';
};
if (goog.DEBUG) {
  Confluence.TeamCalendars.Templates.Fields.serverSelector.soyTemplateName = 'Confluence.TeamCalendars.Templates.Fields.serverSelector';
}


Confluence.TeamCalendars.Templates.Fields.projectSelector = function(opt_data, opt_ignored) {
  return '<div class="field-group field-group-jira field-group-jira-project" id="field-projectSelector"><label for="tc-jira-project">' + soy.$$escapeHtml('Project') + '<span class="aui-icon icon-required"></span></label><select name="tc-jira-project" class="select tc-jira-project"></select><span class="spinner aui-icon aui-icon-wait"></span><div class="error project-error"></div></div>';
};
if (goog.DEBUG) {
  Confluence.TeamCalendars.Templates.Fields.projectSelector.soyTemplateName = 'Confluence.TeamCalendars.Templates.Fields.projectSelector';
}

}catch(e){WRMCB(e)};
;
try {
/* module-key = 'com.atlassian.confluence.extra.team-calendars:event-edit', location = 'com/atlassian/confluence/extra/calendar3/components/manage-event/event-edit/event-edit-dialog.js' */
define("tc/event-edit-dialog",["jquery","tc/event-field-handlers","tc/event-types","tc-backbone","tc/calendar-util"],function(b,e,i,g,c){var j,h,d,f={};var a=g.View.extend({disableCalSelect:function(){b("select#calendar").attr("disabled",true);if(AJS.Meta.get("build-number")>=4520){b("#event-type").auiSelect2("enable",false)}else{b("#event-type").auiSelect2("disable")}},enableCalSelect:function(){b("select#calendar").attr("disabled",false);if(AJS.Meta.get("build-number")>=4520){b("#event-type").auiSelect2("enable",true)}else{b("#event-type").auiSelect2("enable")}},showToolTip:function(){b("#edit-event-dialog .subcalendar-event select.event-type-select").css("display","none");var l=window.navigator.userAgent;var k=l.indexOf("MSIE ");if(AJS.Meta.get("build-number")<4520||k>0||!!navigator.userAgent.match(/Trident.*rv\:11\./)){b("#edit-event-dialog .field-group-event-type .icon-help").css("top","-10px")}b("#calendar-tooltip.icon-help").removeClass("hidden").tooltip({aria:true})},hiddenToolTip:function(){b("#calendar-tooltip.icon-help").addClass("hidden")},getField:function(k,l){return b("input[name='"+l+"']",k)},getSelect:function(k,l){return b("select[name='"+l+"']",k)},getTextSelect:function(k,l){return b("select[name='"+l+"'] option:selected",k).text()},getTextArea:function(k,l){return b("textarea[name='"+l+"']",k)},show:function(){d.show()},hide:function(){d.hide()},remove:function(){d.remove()},getEditEventDialog:function(H,A,p,K){var C,y,o,N,u,I=[],O,J=Confluence.TeamCalendars.LocalStorage,x=H.originalEventSubCalendarId,m=this;var D=580,B=700;if(d&&d.isVisible()){return d}if(d){d.remove();d=null;AJS.log("Warning: old event edit dialog was not destroyed before creating a new one.")}j=p;h=K;u=i.DefaultEventType;function z(P){var Q={};b.each(P,function(R,S){if(S===undefined){Q[R]=""}else{Q[R]=S}});return Q}function w(X,Q){var Y,P,U,V,ac,S,W,R,ab,T,aa,Z;if(j.isProcessingEvent(h)){return false}j.setProcessingEvent(h,true,C);Y=m.getField(N,"originalSubCalendarId").val();Z=m.getField(N,"childSubCalendarId").val();P=m.getField(N,"originalStartDate").val();U=b("option:selected",m.getSelect(N,"calendar")).val();V=m.getField(N,"uid").val();W=m.getSelect(N,"event-type").val();R=c.isCustomEventType(W)?i.CustomEventType:u[W];ac=m.getField(N,"allDayEvent").is(":checked");S=m.getField(N,"until");ab=m.getField(N,"originalEventType").val();T=m.getField(N,"originalCustomEventTypeId").val();aa=c.isCustomEventType(W)?W:"";J.setItem("last-selected-calendar",U);J.setItem("last-selected-calendar-type",W);if(!V){h.data(j.PREF_LAST_ALL_DAY_USED,ac.toString());k()}if(!R){return}if(R.customHandler){R.customHandler.submitForm(X,m.getField(X,"name").val(),U,j.getRenderedMacroCallbackHandler(h),function(){d.remove();j.setProcessingEvent(h,false,C);j.updateAvailableSubCalendarsInSubCalendarPanel(h)},function(){j.setProcessingEvent(h,false,C)});return}j.updateEvent(h,(function(){var ad={originalSubCalendarId:Y,originalStartDate:P,subCalendarId:U,uid:V,eventType:c.isCustomEventType(W)?"custom":W,originalEventType:ab,customEventTypeId:aa,originalCustomEventTypeId:T,childSubCalendarId:Z};b.each(Q,function(ae,af){b.extend(ad,z(af.getData()))});return ad})(),function(ad,af,ae){j.getCalendarPanel(h).fullCalendar("unselect");j.showAjaxError(h,ad,af,ae,j.ERROR_CLASS_EVENT_UPDATE);j.setProcessingEvent(h,false,C)},function(ag){j.getCalendarPanel(h).fullCalendar("unselect");j.setGenericErrors(h,null,j.ERROR_CLASS_EVENT_UPDATE);if(ag.success){Confluence.TeamCalendars.setFieldErrors(X,null);var ah=j.getSubCalendar(h,ag.subCalendar.id);if(!ah){var af=j.getSubCalendar(h,ag.subCalendar.parentId);ah=ag.subCalendar;if(ah.type==="custom"||ah.subscriptionType==="custom"){var aj=ah.customEventTypes;var ak=af.customEventTypes;if(aj&&aj.length){if(ak&&ak.length){var ae=false;for(var ai=0;ai<ak.length;ai++){if(ak[ai].customEventTypeId===aj[0].customEventTypeId){ae=true;break}}if(!ae){ak.push(aj[0])}}else{af.customEventTypes.push(aj[0])}}}af.childSubCalendars=b.merge([ah],af.childSubCalendars||[]);j.updateAvailableSubCalendarsInSubCalendarPanel(h);j.addSubCalendarEventSource(h,ah.id);if(x&&ag.subCalendar&&(ag.subCalendar.parentId!==Y||ah.id!==x)){j.reloadSubCalendar(h,x)}}else{var ad=[ah.id];if(x&&(ah.id!==x||ag.subCalendar.parentId!==Y)){ad.push(x)}j.reloadSubCalendar(h,ad)}d.remove()}else{Confluence.TeamCalendars.setFieldErrors(X,ag.fieldErrors)}j.setProcessingEvent(h,false,C)});return false}function G(Q,R){var S=j.getSubCalendarsWhichCanAddEvents(h);S.sort(function(Y,X){var W=Y.name.toLowerCase(),V=X.name.toLowerCase();return W.localeCompare(V)});var U=m.getSelect(Q,"calendar");b.each(S,function(W,V){U.append(b("<option/>",{value:V.id,text:V.name}))});if(S.length===1){U.parent().hide()}if(R.subCalendarId){var P=j.getSubCalendar(h,R.subCalendarId);if(P){U.val(P.parentId||R.subCalendarId)}}else{var T=J.getItem("last-selected-calendar");if(T){U.val(T)}}if(R!==undefined&&(c.isJiraEvent(R)||c.isJiraEventStream(R.eventType))){U.disable()}U.change(function(){var Y=m.getField(Q,"originalSubCalendarId").val();var W=m.getField(Q,"originalEventType").val();if(S.length>1&&Y!==""&&W!==""){var X=b(this).find("option:selected");var V=m.getSelect(Q,"event-type").val();if(Y===X.val()&&V===W){b("#editthisinstanceonly").enable()}else{b("#editthisinstanceonly").disable()}}v(Q,true)})}function t(Q){var R=c.isCustomEventType(Q.id)?Q.css:Q.id;var P=b("<div/>",{"class":"tc-event-type-item",title:Q.text}).append(b("<span/>",{"class":"icon_type "+R})).append(b("<span/>",{"class":"ellipsis_text",text:Q.text}));return b("<div/>").append(P).html()}function l(R){var P=j.getSubCalendarsWhichCanAddEvents(h);for(var Q in P){if(P[Q].id===R){return P[Q].disableEventTypes}}}function q(R){var P=j.getSubCalendarsWhichCanAddEvents(h);for(var Q in P){if(P[Q].id===R){return P[Q].customEventTypes}}}function F(T,Q){var S;if(!Q){return S}var R=q(T);if(R&&R.length){for(var P=0;P<R.length;P++){if(R[P].customEventTypeId===Q){S=R[P];break}}}return S}function s(P){P.sort(function(R,Q){return R.title.toUpperCase().localeCompare(Q.title.toUpperCase())});return P}function v(R,S){var X=m.getSelect(R,"event-type");if(S){X.empty()}var Y=m.getField(R,"originalEventType").val();var Q=m.getField(R,"originalSubCalendarId").val();var V=m.getSelect(R,"calendar").find("option:selected").val();var Z=l(V);var aa=s(q(V));var U=F(Q,H.customEventTypeId);var W=function(ab){for(var ac in Z){if(ab===Z[ac]){return true}}return false};if(H.id){b.each(u,function(ab,ac){if((Y===ac.id||!W(ac.id)&&(c.isJiraEvent(H)||ac.hiddenFromEventCreation===undefined))){X.append(b("<option/>",{value:ac.id,text:ac.name}))}});b.each(aa,function(ab,ac){if(!W(ac.customEventTypeId)){X.append(b("<option/>",{value:ac.customEventTypeId,"class":ac.icon,"data-custom-id":ac.customEventTypeId,text:ac.title}))}});if(S&&U){var P=false;for(var T=0;T<aa.length;T++){if(aa[T].title===U.title){P=true;break}}if(!P){X.append(b("<option/>",{value:U.customEventTypeId,"class":U.icon,"data-custom-id":U.customEventTypeId,text:U.title}))}}}else{b.each(u,function(ab,ac){if(!W(ac.id)&&(c.isJiraEvent(H)||ac.hiddenFromEventCreation===undefined)){X.append(b("<option/>",{value:ac.id,text:ac.name}))}});b.each(aa,function(ab,ac){if(!W(ac.customEventTypeId)){X.append(b("<option/>",{value:ac.customEventTypeId,"class":ac.icon,"data-custom-id":ac.customEventTypeId,text:ac.title}))}});b.each(u,function(ab,ac){if(ac.hiddenFromEventCreation!==undefined&&ac.hiddenFromEventCreation===false&&!W(ac.id)){X.append(b("<option/>",{value:ac.id,text:ac.name}))}});if(X.children().length>0){b(".field-group-event-type .type-error",R).empty();b("#event-fields-container",R).show();m.enableOkButton()}else{X.append(b("<option/>",{value:"",text:""}));b(".field-group-event-type .type-error",R).append(b("<span/>",{text:"All event types are disabled. Please add new event type to the calendar."}));b("#event-fields-container",R).hide();C.disableOkButton({buttonText:"OK"})}X.append(b("<option/>",{value:"addNewCustomEventType","class":"addNewCustomEventType",text:"Add new event type"}))}if(AJS.$.fn.auiSelect2){b(".event-edit #event-type").auiSelect2({formatSelection:t,formatResult:t,minimumResultsForSearch:-1});if(H.id&&c.isJiraEvent(H)){if(AJS.Meta.get("build-number")>=4520){b("#event-type").auiSelect2("enable",false)}else{b("#event-type").auiSelect2("disable")}}}if(H.eventType&&H.eventType==="custom"){X.change(L).val(H.customEventTypeId).trigger("change")}else{X.change(L).val(H.eventType||J.getItem("last-selected-calendar-type")||"other").trigger("change")}}function n(){m.getField(N,"uid").val(H.id||"");m.getField(N,"originalStartDate").val(H.originalStart||"");m.getField(N,"originalSubCalendarId").val(H.subCalendarId||"");m.getField(N,"originalEventType").val(H.eventType||"");m.getField(N,"originalCustomEventTypeId").val(H.customEventTypeId||"");m.getField(N,"childSubCalendarId").val(H.childSubCalendarId||"")}function L(R){if(!d){return}var Q=R.target.value;if(Q==="addNewCustomEventType"){var T=b("option:selected",m.getSelect(N,"calendar")).val();d.remove();var P=j.getSubCalendar(h,T);var S=j.showCustomEventEditForm(h,P);return}r(Q);if(!c.isJiraEventStream(Q)){m.getSelect(N,"event-type").data("previous",Q)}M()}function M(){if(d){d.getCurrentPanel().body.css({height:"auto"});b("#"+d.id).css({height:"auto"})}}function r(Y){if(!Y){return}var U=c.isCustomEventType(Y)?i.CustomEventType.fields:u[Y].fields,Q=[],ab=b("#event-fields-container"),V=c.isJiraEventStream(Y),X=V?b("#"+Y+"-event-fields",ab):b("#tc-event-fields",ab),W=m.getSelect(N,"event-type").val(),S=m.getSelect(N,"event-type").data("previous"),P,ac=m.getField(N,"originalEventType").val();b.each(b.grep(U,function(ad){return ad.type==="repeats"&&ad.defaultRecur}),function(ad,ae){if(!H.id){H.recur=ae.defaultRecur}});if(H&&c.isJiraEventStream(H.eventType)){m.getSelect(N,"event-type").attr("disabled","disabled")}if(!V&&S){var Z=c.isCustomEventType(S)?i.CustomEventType.fields:u[S].fields;b.each(b.grep(Z,function(ad){return ad.type==="text"&&ad.copyto}),function(ae,ad){P=m.getField(X,ad.id).val()})}b(".event-fields",ab).each(function(){b(this).find(".error").empty();b(this).hide()});if(X.length&&V){X.show();Q=I[Y]}else{if(X.length){X.show();b("#tc-event-fields >div").hide()}else{if(V){X=b("<div/>",{id:Y+"-event-fields","class":"event-fields"})}else{X=b("<div/>",{id:"tc-event-fields","class":"event-fields"})}ab.append(X)}b.each(U,function(ad,ae){if(V){Q[ad]=e[ae.type](ae,X,H,j,h,m);Q[ad].add();Q[ad].init()}else{Q[ad]=e.getEventField(ae,X,H,j,h,m,P)}});I[Y]=Q}var T=function(){return f[W]!==false};if(T()){C.enableOkButton()}else{C.disableOkButton({buttonText:"OK"})}C.unbind("submit").submit(function(){w(X,Q);return false});if(ac!==undefined&&ac!==""){var R=m.getField(N,"originalSubCalendarId").val();var aa=m.getSelect(N,"calendar").val();if(ac===Y&&aa===R){b("#editthisinstanceonly").enable()}else{b("#editthisinstanceonly").disable()}}b(X).off("click.calendar-reminder-setting").on("click.calendar-reminder-setting","#calendar-reminder-setting",function(){var ad=m.getSelect(N,"calendar").val();d.hide();var ae=j.getSubCalendar(h,ad);j.showCustomEventEditForm(h,ae,W);return})}AJS.unbind("show-dialog-edit-event.teamcalendar").bind("show-dialog-edit-event.teamcalendar",function(R){var S=c.isJiraEventStream(m.getSelectedEventType())?"#"+m.getSelectedEventType()+"-event-fields":"#tc-event-fields";var Q=b("#field-text-reminder .bodyInforReminderLabel",b(S,N));var T=j.getCurrentReminderForEventType(h,m);var P=T&&T.periodInMins>0;b(Q).empty().append(Confluence.TeamCalendars.Templates.Fields.bodyInforReminderLabel({reminderPeriodText:P?AJS.format("{0} before",c.showInforReminder(T.periodInMins)):"None.",reminderPeriod:P?T.periodInMins:0}));d.show()});AJS.unbind("remove-dialog-edit-event.teamcalendar").bind("remove-dialog-edit-event.teamcalendar",function(P){if(d){d.remove()}});AJS.bind("remove.dialog",function(Q,P){if(P.dialog.id=="edit-event-dialog"){d=null}});y=function(){C.submit();AJS.unbind("show-dialog-edit-event.teamcalendar");return false};o=function(){d.remove();AJS.unbind("show-dialog-edit-event.teamcalendar");return false};d=new AJS.ConfluenceDialog({id:"edit-event-dialog",width:D,height:B,onSubmit:y,onCancel:o});d.addHeader(H.title||"Create event");d.addButton("OK",y,"submit");d.addLink("Cancel",o);O=d.popup.element.find(".submit");d.addPanel("",Confluence.TeamCalendars.Templates.eventEdit(),"calendar-dialog-panel");N=d.getCurrentPanel().body;var E=function(P){f[m.getSelect(N,"event-type").val()]=P};var k=function(){var P="myCalendars";if(AJS.Meta.get("space-key")){if(AJS.Meta.get("content-id")){P="embedded"}else{if(c.isSingleCalendarView(K)){P="singleCalendar"}else{P="spaceCalendars"}}}Confluence.TeamCalendars.fireEventForAnalytics("add.event."+P)};C=b("form[name='event-edit']",N);C.disableOkButton=function(P){var Q=b.extend({buttonText:"Adding..."},P);O.text(Q.buttonText).attr("disabled","disabled").addClass("ui-state-disabled");E(false)};C.enableOkButton=function(P){var Q=b.extend({buttonText:"OK"},P);O.removeAttr("disabled").removeClass("ui-state-disabled").text(Q.buttonText);E(true)};G(N,H);d.disableOkButton=C.disableOkButton;d.enableOkButton=C.enableOkButton;v(N);n();return d},disableOkButton:function(k){d.disableOkButton(k)},enableOkButton:function(k){d.enableOkButton(k)},getSelectedEventType:function(){return this.getSelect(d.popup.element,"event-type").val()},getSelectedSubCalendarId:function(){return this.getSelect(d.popup.element,"calendar").val()},getTextSelectedEventType:function(){return this.getTextSelect(d.popup.element,"event-type")},getTextSelectedSubCalendar:function(){return this.getTextSelect(d.popup.element,"calendar")}});return a});
}catch(e){WRMCB(e)};
;
try {
/* module-key = 'com.atlassian.confluence.extra.team-calendars:event-edit', location = 'com/atlassian/confluence/extra/calendar3/components/manage-event/event-edit/event-field-handlers.js' */
define("tc/event-field-handlers",["jquery","tc/jira-event-field-process","tc/calendar-util"],function(f,g,c){f.fn.tcDatePicker=f.fn.datepicker.noConflict();var d=f.datepicker.noConflict();function e(j,h){var i=j instanceof f?j:f(j);i.tcDatePicker(h)}function a(j,h,i){if(/^[1-9]\d*$/.test(h)||h==="0"){if(j==="DAILY"){i.text(parseInt(h)>1?"days":"day")}else{if(j==="WEEKLY"){i.text(parseInt(h)>1?"weeks":"week")}else{if(j==="MONTHLY"){i.text(parseInt(h)>1?"months":"month")}else{if(j==="YEARLY"){i.text(parseInt(h)>1?"years":"year")}}}}}else{i.text("")}}var b={text:function(m,h,j,l,k,i){return{add:function(){h.append(Confluence.TeamCalendars.Templates.Fields.text({id:m.id,label:m.label,required:m.required,readOnly:m.readOnly}))},init:function(){f("#"+m.id+"-text",h).val(j[m.property]||"").keydown(function(){var o=f(this),n=o.val();if(!o.data("valueChangedByUser")){setTimeout(function(){if(n!==o.val()){o.data("valueChangedByUser",true)}},300)}})},setData:function(n){i.getField(h,m.id).val(n)},getData:function(){var n={};n[m.id]=i.getField(h,m.id).val();return n},getElementId:function(){return"#field-text-"+m.id}}},textarea:function(m,h,j,l,k,i){return{add:function(){h.append(Confluence.TeamCalendars.Templates.Fields.textarea({id:m.id,size:m.size,required:m.required,label:m.label,readOnly:m.readOnly}))},init:function(){f("#"+m.id+"-textarea",h).val(j[m.property]||"")},getData:function(){var n={};n[m.id]=f("textarea[name="+m.id+"]",h).val();return n},getElementId:function(){return"#field-textarea-"+m.id}}},page:function(m,h,j,l,k,i){return{add:function(){h.append(Confluence.TeamCalendars.Templates.Fields.page({id:m.id,label:m.label,required:m.required,readOnly:m.readOnly}))},init:function(){f("#"+m.id+"-text",h).val(j[m.property]||"");l.makeAutoCompleteSearch(k,f("input[name='"+m.id+"']",h),{type:["page","blogpost"]},f("."+m.id+"-suggestions",h),function(o,n){o.val(n.attr("href"))})},getData:function(){var o={},n=i.getField(h,m.id);o[m.id]=n.hasClass("with-hint")?"":n.val();return o},getElementId:function(){return"#field-page-"+m.id}}},when:function(m,h,j,l,k,i){return{add:function(){var p,q,n,o;h.append(Confluence.TeamCalendars.Templates.Fields.when({id:m.id,disableStartDateTime:m.disableStartDateTime,disableEndDateTime:m.disableEndDateTime,disableAllDay:m.disableAllDay}));p=i.getField(h,"startTime");q=i.getField(h,"endTime");n=i.getField(h,"allDayEvent");o=l.getParameter(k,"timeSuggestion");p.autocompleteTC({source:o,minLength:2});q.autocompleteTC({source:o,minLength:2});n.click(function(){if(this.checked){p.addClass("hidden");q.addClass("hidden")}else{p.removeClass("hidden");q.removeClass("hidden");if(!p.val()){p.val(l.getDefaultStartTime(k))}if(!q.val()){q.val(l.getDefaultEndTime(k))}}})},init:function(){f(".start, .end",h).each(function(){var r=f(this);e(r,{dateFormat:"ddmmyy",dayNames:l.getDayNames(),dayNamesMin:l.getDayNamesShort(),dayNamesShort:l.getDayNamesShort(),firstDay:l.getParameter(k,"firstDayOfWeek"),monthNames:l.getMonthNames(),monthNamesShort:l.getMonthNamesShort(),beforeShow:function(){f("#ui-datepicker-div").addClass("tc-datepicker")},onClose:function(){f("#ui-datepicker-div").removeClass("tc-datepicker")},onSelect:function(w){var u=d.parseDate("ddmmyy",w);if(r.hasClass("start")){var t=f(".end",h),v=new Date(parseInt(r.data("date"))),s=new Date(t.data("date")-(v.getTime()-u.getTime()));t.tcDatePicker("option","defaultDate",s);t.tcDatePicker("setDate",s);t.data("date",s.getTime()).val(function(){l.formatDate(k,s,"date",function(x){t.val(x)});return "Formatting..."})}r.tcDatePicker("option","defaultDate",u);r.tcDatePicker("setDate",u);r.data("date",u.getTime()).val(function(){l.formatDate(k,u,"date",function(x){r.val(x)});return "Formatting..."})},showAnim:""})});var p=i.getField(h,"startTime"),q=i.getField(h,"endTime"),n=i.getField(h,"allDayEvent"),o=function(s,r,u){var t=f("input[name="+s+"]",h);t.tcDatePicker("option","defaultDate",r);t.tcDatePicker("setDate",r);t.data("date",r.getTime()).val(u||function(){l.formatDate(k,r,"date",function(v){t.val(v)});return "Formatting..."})};j.start&&o("startDate",j.start,j.localizedStartDate);o("endDate",j.end||j.start,j.localizedEndDate);if(j.allDay){p.val("").addClass("hidden");q.val("").addClass("hidden");n.attr("checked","checked")}else{p.val(j.originalStartTime||j.localizedStartTime||function(){l.formatDate(k,j.start,"time",function(r){p.val(r)});return "Formatting..."}).removeClass("hidden");q.val(j.originalEndTime||j.localizedEndTime||function(){l.formatDate(k,j.end||new Date(j.start.getTime()+3600000),"time",function(r){q.val(r)});return "Formatting..."}).removeClass("hidden");n.removeAttr("checked","checked")}},getData:function(){return{startDate:i.getField(h,"startDate").val(),startTime:i.getField(h,"startTime").val(),endDate:i.getField(h,"endDate").val(),endTime:i.getField(h,"endTime").val(),allDayEvent:i.getField(h,"allDayEvent").is(":checked")}},getElementId:function(){return"#field-when"}}},repeats:function(m,h,j,l,k,i){return{add:function(){var q,u,t,o,n,p,s;h.append(Confluence.TeamCalendars.Templates.Fields.repeats({id:m.id}));q=f("select[name='calendar']",h);u=f("select[name='freq-select']",h);t=f("input[name='interval']",h);o=f(".recur-ends",h);n=f(".recur-ends-never",o);p=f(".recur-ends-until",o);s=f("input[name='until']",o);var r=function(w,v,y){var x=f("input[name="+w+"]",h);x.tcDatePicker("option","defaultDate",v);x.tcDatePicker("setDate",v);x.data("date",v.getTime()).val(y)};f("input[name='editthisinstanceonly']",h).change(function(){if(f(this).is(":checked")){i.disableCalSelect();i.showToolTip();q.attr("disabled","disabled");u.attr("disabled","disabled");t.attr("readonly","readonly");n.attr("disabled","disabled");p.attr("disabled","disabled");s.attr("readonly","readonly").tcDatePicker("disable");r("startDate",j.start,j.localizedStartDate);r("endDate",j.end||j.start,j.localizedEndDate)}else{i.enableCalSelect();i.hiddenToolTip();u.removeAttr("disabled");t.removeAttr("readonly");if(f("option:selected",u).val()){n.removeAttr("disabled");p.removeAttr("disabled");if(p.is(":checked")){s.removeAttr("readonly").tcDatePicker("enable")}else{s.tcDatePicker("disable")}}var w=d.parseDate("yy-mm-dd",j.originalStartDateTime.split("T")[0]);var v=d.parseDate("yy-mm-dd",j.originalEndDateTime.split("T")[0]);r("startDate",w,j.localizedOriginalStartDate);r("endDate",v,j.localizedOriginalEndDate)}});u.change(function(){var y=f("option:selected",this).val();var v=f("input[name='freq']",h);var w=f("input[name='byday']",h);var x=f(".interval-container",h);if(y){if(y==="WEEKLY-BYDAY"){t.attr("readonly","readonly").val("1");x.addClass("hidden");v.val("WEEKLY");w.val("MO,TU,WE,TH,FR")}else{t.removeAttr("readonly").val("1");x.removeClass("hidden");v.val(y);w.val("")}o.removeClass("hidden");n.removeAttr("disabled");if(p.removeAttr("disabled").is(":checked")){s.removeAttr("disabled").removeAttr("readonly")}}else{t.val("1");x.addClass("hidden");o.addClass("hidden");n.attr("disabled","disabled");p.attr("disabled","disabled");s.val("").attr("disabled","disabled").attr("readonly","readonly");v.val("");w.val("")}t.trigger("keydown")});t.keydown(function(){setTimeout(function(){var x=f("option:selected",u).val();var w=f(".interval-label",h);var v=f.trim(t.val());a(x,v,w)},300)});f(".recur-ends-never",h).click(function(){s.val("").attr("disabled","disabled").attr("readonly","readonly").tcDatePicker("disable")});f(".recur-ends-until",h).click(function(){s.removeAttr("disabled","disabled").removeAttr("readonly").tcDatePicker("enable")})},init:function(){var n=f(".recur-ends .datepicker-field",h);e(n,{dateFormat:"ddmmyy",dayNames:l.getDayNames(),dayNamesMin:l.getDayNamesShort(),dayNamesShort:l.getDayNamesShort(),firstDay:l.getParameter(k,"firstDayOfWeek"),monthNames:l.getMonthNames(),monthNamesShort:l.getMonthNamesShort(),beforeShow:function(){f("#ui-datepicker-div").addClass("tc-datepicker")},onClose:function(){f("#ui-datepicker-div").removeClass("tc-datepicker")},onSelect:function(s){var r=f(this),q=d.parseDate("ddmmyy",s);r.tcDatePicker("option","defaultDate",q);r.tcDatePicker("setDate",q);r.data("date",q.getTime()).val(function(){l.formatDate(k,q,"date",function(t){r.val(t)});return "Formatting..."})},showAnim:""});var o=function(q){return !q.id};var p=function(){i.getField(h,"recurrenceId").val(j.recurId||"");var w=i.getField(h,"freq").val("");var E=i.getField(h,"byday").val("");var u=i.getField(h,"interval").val("1").attr("readonly","readonly");var x=u.closest(".interval-container");var A=i.getSelect(h,"freq-select");f("option",A.attr("disabled","disabled")).removeAttr("selected");var B=i.getField(h,"editthisinstanceonly");var F=B.closest(".edit-this-instance-only-container");var C=f(".recur-ends",h);var D=i.getField(h,"recur-end").removeAttr("checked").attr("disabled","disabled");var v=i.getField(h,"until").attr("disabled","disabled").attr("readonly","readonly").val("");v.tcDatePicker("disable");if(!o(j)&&j.recur){i.disableCalSelect();i.showToolTip();F.removeClass("hidden");B.attr("checked","checked");var r=j.recur.freq;var z=j.recur.byDay;var s=j.recur.interval;C.removeClass("hidden");w.val(r||"");E.val(z||"");if(z){f("option[value='WEEKLY-BYDAY']",A).attr("selected","selected");x.addClass("hidden")}else{f("option[value='"+r+"']",A).attr("selected","selected");x.removeClass("hidden");u.val(s||"1")}var y=f(".interval-label",h);a(r,s,y);var q=j.recur.until;if(q){f(D[1]).attr("checked","checked");v.removeAttr("disabled");var t=f.fullCalendar.parseDate(q);v.tcDatePicker("setDate",t);v.tcDatePicker("option","defaultDate",t);v.val(j.recur.localizedUntil||function(){l.formatDate(k,t,"date",function(G){v.val(G)});return "Formatting..."})}else{f(D[0]).attr("checked","checked")}}else{if(o(j)&&j.recur){A.removeAttr("disabled");A.val(j.recur.freq).change();f(D[0]).attr("checked","checked")}else{i.enableCalSelect();i.hiddenToolTip();F.addClass("hidden");f("option:first",A.removeAttr("disabled")).attr("selected","selected");x.addClass("hidden");C.addClass("hidden");f(D[0]).attr("checked","checked")}}};p()},getData:function(){var n=i.getField(h,"until");return{freq:i.getField(h,"freq").val(),byday:i.getField(h,"byday").val(),interval:i.getField(h,"interval").val()||"",until:n.val(),repeatEnds:!(n.attr("readonly")||n.attr("disabled")),recurrenceId:i.getField(h,"recurrenceId").val(),editAllInRecurrenceSeries:!i.getField(h,"editthisinstanceonly").is(":checked")}},getElementId:function(){return"#field-repeats"}}},user:function(m,h,j,l,k,i){return{add:function(){h.append(Confluence.TeamCalendars.Templates.Fields.user({id:m.id,label:m.label,required:m.required}));Confluence.runBinderComponents()},init:function(){var p=f(".invitees",h),o=function(){f(this).closest("li").remove();if(!f("li",p).length){p.addClass("hidden")}},n=function(){f(".invitee-left",p).filter(function(){return !f(this).attr("threedots")}).ThreeDots({max_rows:1,text_span_class:"invitee-name-display",whole_word:false})};f("#"+m.id+"-user-picker",h).bind("selected.autocomplete-user",function(u,s){var r=s.content.userKey||s.content.username,q,v=f(".invitee",p).filter(function(){return f(this).data("entity").id===r}).length>0;if(!v){if(f("li",p).length===3){p.addClass("boxed")}q=f(Confluence.TeamCalendars.Templates.Fields.userSelection({fullName:s.content.title,userName:s.content.username,imgPath:s.content.thumbnailLink.href}));q.data("entity",{id:r,displayName:s.content.title}).find(".delete-invitee").click(o);p.prepend(q).removeClass("hidden");n()}f(this).val("").focus();var t=f(".who-error",h);if(t.children().length){t.empty()}});if(j.invitees&&j.invitees.length){f.each(j.invitees,function(r,q){p.append(f(Confluence.TeamCalendars.Templates.Fields.userSelection({fullName:q.displayName,userName:q.name,imgPath:q.avatarIconUrl})).data("entity",{id:q.id,displayName:q.displayName}))});f(".delete-invitee",p.removeClass("hidden")).unbind("click").click(o);n()}},getData:function(){var n={};var o=f(".invitee",h);if(o.length){n.person=f.map(o,function(p){return f(p).data("entity").id})}if(m.setTitle){n.what=o.length?f.map(o,function(p){return f(p).data("entity").displayName}).join(", "):""}return n},getElementId:function(){return"#field-user-"+m.id}}},getEventField:function(t,o,h,w,v,j,l){var r=b[t.type](t,o,h,w,v,j);var k=f(r.getElementId(),o);if(k.length){if(t.required){var s=k.find("label:first span.icon-required");if(s.length===0){k.find("label:first").append(f("<span/>",{"class":"aui-icon icon icon-required"}))}}else{k.find("label:first span.icon-required").remove()}o.append(k.show());if(t.type==="repeats"){var i=f("select[name='freq-select']",o);var q=f("input[name='interval']",o);var u=f("input[name=until]",o);var n=!(u.attr("readonly")||u.attr("disabled"));var m=f("input[name=recur-end]",o);if(t.defaultRecur){k.data("repeatData",{repeat:i.val(),interval:q.val(),repeatEnd:n,until:u.val()});i.val("YEARLY").change()}else{var p=k.data("repeatData");if(p){i.val(p.repeat).change();q.val(p.interval);if(p.repeatEnd&&p.repeatEnd==true){f(m[1]).attr("checked","checked");u.removeAttr("readonly").val(p.until).tcDatePicker("enable")}else{f(m[0]).attr("checked","checked")}k.removeData("repeatData")}}}}else{r.add();r.init()}if(t.copyto&&l!==undefined){r.setData(l)}return r},reminder:function(m,h,j,l,k,i){return{add:function(){var o=l.getCurrentReminderForEventType(k,i);f(h).find("#field-text-"+m.id).remove();var n=o&&o.periodInMins>0;h.append(Confluence.TeamCalendars.Templates.Fields.inforReminderLabel({id:m.id,label:m.label,reminderPeriodText:n?AJS.format("{0} before",c.showInforReminder(o.periodInMins)):"None.",reminderPeriod:n?o.periodInMins:0}))},init:function(){},getData:function(){return{}},getElementId:function(){return""}}},"jira-hidden-fields":function(m,h,j,l,k,i){return{add:function(){h.append(Confluence.TeamCalendars.Templates.hiddenJiraFields())},init:function(){var o=g.getSubCalendarForEvent(l,k,j),n=l.getRenderedMacroCallbackHandler(k),p=Confluence.TeamCalendars.getEditCalendarDialogHelper(h,o,n);if(!o||!o.id){p.setSubCalendarIdField("");p.setNameField("");p.setColorField("");p.setSpaceToDefault()}else{p.setSubCalendarIdField(o.id);p.setNameField(o.name);p.setColorField(o.color);p.setSpaceKeyField(o.spaceKey)}},getData:function(){}}},"jira-server-select":function(m,h,j,l,k,i){return{add:function(){h.append(Confluence.TeamCalendars.Templates.Fields.serverSelector());g.getServerSelect(h).disable()},init:function(){var o=g.getServerSelect(h),p=f(".field-group-jira-server .spinner");AJS.unbind("server-select-ready.teamcalendars");AJS.unbind("server-select-change.teamcalendars");function n(r){var q=g.getSubCalendarForEvent(l,k,j);f.each(r.jiraLinks,function(s,t){var u=f("<option/>",{value:t.id,text:t.name,"data-display-url":t.displayUrl});if(r.jiraLinks.length===1){u.prop("selected",true);var v=o.parent();v.children().hide();v.css("min-height",0);f(".oauth-error",v).show()}u.appendTo(o)});if(r.jiraLinks.length>1){f(".field-group-jira-server",h).removeClass("hidden")}if(q){if(q.applicationId){o.val(q.applicationId)}else{if(q.sourceSubCalendar&&q.sourceSubCalendar.applicationId){o.val(q.sourceSubCalendar.applicationId)}}}}o.change(function(){AJS.trigger("server-select-change.teamcalendars",h)});f.ajax({cache:false,error:function(q,s,r){l.showAjaxError(h.parent().parent(),q,s,r)},success:function(q){n(q);AJS.trigger("server-select-ready.teamcalendars",h)},complete:function(){o.enable();p.hide()},timeout:Confluence.TeamCalendars.ajaxTimeout,url:Confluence.TeamCalendars.getCalendarServiceBaseUrl("/jira/jiraLinks")})},getData:function(){}}},"jira-project-select":function(m,h,j,l,k,i){return{add:function(){h.append(Confluence.TeamCalendars.Templates.Fields.projectSelector());f(".tc-jira-project",h).disable()},init:function(){function n(o){if(o.id===h[0].id){f(".oauth-approve",h).remove();g.populateProjectList(m,h,j,l,k,i)}}AJS.bind("server-select-ready.teamcalendars",function(p,o){n(o)});AJS.bind("server-select-change.teamcalendars",function(p,o){n(o)})},getData:function(){}}},"jira-dates":function(m,h,j,l,k,i){return{add:function(){h.append(Confluence.TeamCalendars.Templates.editJiraCalendar())},init:function(){AJS.bind("server-select-ready.teamcalendars",function(){g.initJiraDate(m,h,j,l,k,i)});AJS.bind("server-select-change.teamcalendars",function(){g.initJiraDate(m,h,j,l,k,i)})},getData:function(){}}}};return b});
}catch(e){WRMCB(e)};
;
try {
/* module-key = 'com.atlassian.confluence.extra.team-calendars:event-edit', location = 'com/atlassian/confluence/extra/calendar3/components/manage-event/event-edit/jira-event-field-process.js' */
define("tc/jira-event-field-process",["jquery","tc/calendar-util"],function(c,a){function e(k,f,j,l,i){function g(){if(!c("input[name='subCalendarId']",f).val()){Confluence.TeamCalendars.fireEventForAnalytics("event.create.default."+k.type+".context."+j.getParameter("calendarContext"),{})}}if(j.isProcessingSubCalendar()){return false}var h=j.setSubCalendarSpinnerIconVisible(true);g();if(j.getIncludedCalendars()){k.include=j.getIncludedCalendars()}var m=k.subCalendarId;a.putCalendarContextParams(k);c.ajax({cache:false,converters:{"text json":function(n){return n}},data:k,dataFilter:function(n){var o=c.parseJSON(n);if(o.success){Confluence.TeamCalendars.mergeSubCalendarObjectsToArray(o.payload)}return o},dataType:"json",error:function(n,p,o){j.showAjaxUpdateError(n,p,o);l()},success:function(o){j.setGenericUpdateError();if(o.success){Confluence.TeamCalendars.setFieldErrors(f,null);var n=m;if(n){j.setSubCalendars(m,o.payload);j.reloadSubCalendar(m)}else{m=o.modifiedSubCalendarId;j.setSubCalendars(m,o.payload)}i();if(!o.modifiedSubCalendarId&&j.shouldShowFeatureDiscoveryDialog(m)){j.getSubCalendarFeatureDiscoveryDialog(m)}}else{Confluence.TeamCalendars.setFieldErrors(f,o.fieldErrors);l()}},complete:function(){if(h){h.resolve()}},type:"PUT",timeout:Confluence.TeamCalendars.ajaxTimeout,url:Confluence.TeamCalendars.getCalendarServiceBaseUrl("/subcalendars.json")});return false}function b(f,g,i,j,h){return{type:h,parentId:i,subCalendarId:c("input[name='subCalendarId']",f).val(),name:g,description:"",color:c("input[name='color']",f).val(),location:"jira://".concat(encodeURIComponent(d.getServerSelect(f).val()||""),"?projectKey=",encodeURIComponent(c("select[name='tc-jira-project'] option:selected",f).val()),"&dateFieldName=",j)}}var d={getServerSelect:function(f){return c(".tc-jira-server",f)},getJiraOptions:function(f,h,g){c.ajax({cache:false,dataType:"json",error:function(i,k,j){f(i,k,j)},success:function(i){h(i);var j=AJS.format("We didn\'\'t find any projects. \u003ca href=\"{0}\" target=\"_blank\"\u003eCreate a JIRA project\u003c/a\u003e before continuing.",c(".tc-jira-server option:selected").data("display-url"));c(".option-project .unavailable-message").html(j)},timeout:Confluence.TeamCalendars.ajaxTimeout,url:Confluence.getBaseUrl()+"/rest/calendar-services/1.0/calendar/jira/"+encodeURIComponent(g)+"/query/options.json"})},getSubCalendarForEvent:function(h,g,f){if(f.eventType==="jira-calendar"||f.eventType==="jira-agile-sprint-calendar"||f.eventType==="jira-project-releases-calendar"){return h.getSubCalendar(g,f.subCalendarId)}return null},showOauthRequitedMessage:function(j,g,i,l,k){var h=c.parseJSON(j.responseText);var f=c(".oauth-error",g).empty().removeClass("hidden");i.disableOkButton({buttonText:"OK"});c(document.createElement("div")).addClass("oauth-approve aui-message hint").html(AJS.format("\u003cp class=\"title\"\u003e\u003cspan class=\"aui-icon aui-icon-info\"\u003e\u003c/span\u003e\u003c/p\u003e\u003cp class=\"info-approve\"\u003e\u003ca href=\"#\" class=\"approve-dance\"\u003e{0}\u003c/a\u003e to see list of projects\u003c/p\u003e",c(document.createElement("span")).text("Login & Approve").html())).appendTo(f).find(".approve-dance").click(function(){AppLinks.authenticateRemoteCredentials(h.oAuthUrl,function(){l.removeClass("hidden");f.addClass("hidden");i.enableOkButton();k()},function(){alert("Approval unsuccessful. Could you please try again?")});return false})},populateProjectList:function(m,j,g,p,o,i){var l=c(".tc-jira-project",j),n=c(".field-group-jira-project .spinner"),f=i.getSelectedEventType(),h=d.getServerSelect().val(),k=function(){var s=c("input[name='name']",j),q=d.getSubCalendarForEvent(p,o,g),r=function(t){if(!s.data("valueChangedByUser")){return t}return s.val()};if(!q){if(f==="jira-agile-sprint-calendar"){s.val(r(AJS.format("{0} - Sprints",c("option:selected",l).text())))}else{if(f==="jira-project-releases-calendar"){s.val(r(AJS.format("{0} - Releases",c("option:selected",l).text())))}}}};l.change(k).disable();n.show();d.getJiraOptions(function(q,s,r){n.hide();if(Confluence.TeamCalendars.isRequireOauth(q)){l.empty();d.showOauthRequitedMessage(q,j,i,l,function(){d.populateProjectList(h)})}else{l.enable();p.showAjaxError(j.parent().parent(),q,s,r)}},function(q){var s=q.projects,t=l.empty(),r=d.getSubCalendarForEvent(p,o,g);n.hide();l.enable();c.each(s,function(u,v){c(document.createElement("option")).val(v.key).text(v.name).appendTo(t)});if(r){t.val(r.projectKey)}else{k()}},h)},initJiraDate:function(q,n,h,u,t,m){var p=d.getSubCalendarForEvent(u,t,h),j=u.getRenderedMacroCallbackHandler(t),r=c("select[name='project']",n),s=function(){if(!p){var v=c("input[name='name']",n);v.val(function(){if(!v.data("valueChangedByUser")){return c("option:selected",r).val()?AJS.format("{0} - Issues",c("option:selected",r).text()):""}return v.val()});o()}};r.off("change").on("change",s);var o=function(){c(".project-error",n).empty();c(".name-error",n).empty();c(".dateFieldName-error",n).empty()};var k=function(w){var v=c(".field-group-jira-show",n);if(w){v.css("display","none")}else{v.css("display","block")}};var l=function(){var B=c(".form-mode",n),w=d.getServerSelect(n),v=c(".jira-query-options .option-project",n),z=c("select[name='project']",v),y=c(".timeZoneIdDisplay",n),x=Confluence.TeamCalendars.getEditCalendarDialogHelper(n,p,j);Confluence.TeamCalendars.setFieldErrors(n,null);c("input[name='searchFilterName']",n).addClass("with-hint").val("Search filter");c("textarea[name='jql']",n).addClass("with-hint").val("JQL query");if(!p||!p.id){x.setFormModeCreate();x.setSubCalendarIdField("");x.setNameField("");x.setDescriptionField("");x.setColorField("");x.setSpaceToDefault();x.setTimeZoneIdDisplayField("");y.hide();i(null,function(){f(function(){s()})})}else{x.setFormModeEdit();x.setSubCalendarIdField(p.id);x.setNameField(p.name);x.setDescriptionField(p.description);x.setColorField(p.color);x.setSpaceKeyField(p.spaceKey);x.setSpaceKeyAutocompleteField(p.spaceName);i(null,function(){var H=c(".jira-query-options",n),I="option-project-selected option-search-filter-selected option-jql-selected",D;c(".matrix input.radio",H).removeAttr("checked");var L=p.sourceSubCalendar||p;if(L.projectKey){var K=false;c("option",z).removeAttr("selected").each(function(){var M=c(this);if(M.val()===L.projectKey){M.attr("selected","selected");K=true;return false}});if(!K){z.append(c(document.createElement("option")).val(L.projectKey).text(L.projectName||L.projectKey).attr("selected","selected"))}c(".radio-project input.radio",H.removeClass(I).addClass("option-project-selected")).attr("checked","checked");D=v.data("hiddenDateFields")}else{if(L.searchFilterId){var E=c(".option-search-filter",H);var G=c("input[name='searchFilterName']",E);c("input[name='searchFilter']",E).val(L.searchFilterId);var C=L.searchFilterName||L.searchFilterId;var F=c(G).data("searchFilters");if(F){C=c.map(F,function(M){if(M.id===L.searchFilterId&&M.name.length>0){return M.name}})}c(G).removeClass("with-hint").val(C);c(".radio-search-filter input.radio",H.removeClass(I).addClass("option-search-filter-selected")).attr("checked","checked");D=E.data("hideDateFields")}else{if(L.jql){var J=c(".option-jql",H);c("textarea[name='jql']",J).removeClass("with-hint").val(L.jql);c(".radio-jql input.radio",H.removeClass(I).addClass("option-jql-selected")).attr("checked","checked")}}}f(function(){var N=c(".field-group-jira-show .single-dates .date-fields div.checkbox",n),M={},O=L.dateFieldNames||[];c(".date-fields input",n).removeAttr("checked");N.each(function(){var Q=c("input",this),P=Q.val();if(c.inArray(P,O)!==-1){Q.attr("checked","checked")}M[P]=c("label",this).text()});c.each(L.durations||[],function(P,V){var Q=M[V.startDateFieldName||""],U=M[V.endDateFieldName||""];if(Q&&U){var T=c(".field-group-jira-show .duration .date-fields",n),S=V.startDateFieldName+"/"+V.endDateFieldName,R="duration-"+S;c("<div/>",{"class":"checkbox"}).append(c("<input/>",{id:R,name:"dateFieldName",type:"checkbox",value:S,checked:"checked"})).append(c("<label/>",{"for":R,html:AJS.format("Start: {0}",c("<span/>",{text:Q}).html())+"<br>"+AJS.format("End: {0}",c("<span/>",{text:U}).html())})).appendTo(T);T.parent().addClass("has-selected-duration")}});if(D){k(D)}})});y.text(p.timeZoneId)}var A=c("input[name='name'], input[name='description'], input[name='spaceKeyAutocomplete'], input[name='searchFilterName'], textarea[name='jql']",n);if(j.isCalendarInEditMode()){A.removeAttr("readonly");w.removeAttr("disabled");z.removeAttr("disabled")}else{B.removeClass().addClass("form-mode read-only");A.attr("readonly","readonly");w.attr("disabled","disabled");z.attr("disabled","disabled")}};var g=function(){c("select[name='server']",n).change(function(){var x=c("select[name='server'] option:selected",n);if(x.length&&x.val()){i(null,function(){f()})}});c("input[name='spaceKeyAutocomplete']",n).bind("selected.autocomplete-content",function(y,x){c("input[name='spaceKey']",n).val(x.content.key);c(this).val(x.content.name);c(".spaceKeyAutocomplete-error",n).empty()});c(".jira-query-options .query-group input.radio",n).off("change").on("change",function(){var z=c(this).val(),y=c(".jira-query-options",n).removeClass("option-project-selected option-search-filter-selected option-jql-selected").addClass(z+"-selected"),x=c("."+z,y);c("input",x).focus(function(){var A=c(this);if(A.hasClass("with-hint")){A.removeClass("with-hint").val("")}});if("option-jql"===z){c("textarea",x).trigger("keydown",[true])}f(function(){k(x.data("hideDateFields")||!c(".option-value",x).val());var A=c(".duration",n);if(c(".date-fields",A).children().length){A.addClass("has-selected-duration")}else{A.removeClass("has-selected-duration")}})});var w=c(".option-search-filter",n);var v=c(".search-filter-suggestions",w);c("input[name='searchFilterName']",w).keydown(function(){var x=c(this);var y=x.val();setTimeout(function(){var A=x.val();if(!A||A!==y){v.empty()}if(A!==y){A=A.toLowerCase();var C=c.grep(x.data("searchFilters")||[],function(D){return D.name.toLowerCase().indexOf(A)!==-1});if(C.length){var z=c(document.createElement("div")).addClass("dropdown-container").append(c(document.createElement("div")).addClass("aui-dd-parent").append(c(document.createElement("a")).addClass("aui-dd-trigger").attr("href","#").text("Show autocomplete")).append(c(document.createElement("ul")).addClass("aui-dropdown")));var B=c(".aui-dropdown",z).appendTo(c(".aui-dd-parent",z));c.each(C,function(E,D){var F=c(document.createElement("li")).append(c(document.createElement("a")).attr("href","#").text(D.name)).data("searchFilter",D).appendTo(B).click(function(){x.val(D.name);c("input[name='searchFilter']",w).val(D.id);c(".error",w).empty();f()});if(D.description){F.attr("title",D.description)}});z.appendTo(v).dropDown("Standard",{alignment:"left"});v.removeClass("hidden")}}},300)});c("select[name='project']",n).change(function(){f()});c(".jira-query-options input[name='searchFilterName']",n).keydown(function(y){var B=y.keyCode;var x=c(this);if(!(B===38||B===40||B===13)){setTimeout(function(){n.click();var D=x.val().toLowerCase();if(D){var C=x.data("searchFilters");if(C&&c.isArray(C)){var E=c(".search-filter-suggestions .aui-dropdown li",n).each(function(){var F=c(this);if(F.data("searchFilter").name.toLowerCase().indexOf(D)===-1){F.addClass("hidden")}else{F.removeClass("hidden")}});if(E.filter(function(){return !c(this).hasClass("hidden")}).length){c(".search-filter-suggestions .aui-dd-trigger",n).trigger("click")}}}},300)}else{if(B===13){y.preventDefault();var A=c(".search-filter-suggestions .aui-dropdown li.active",n);if(A.length){var z=A.data("searchFilter");x.val(z.name);c("input[name='searchFilter']",n).val(z.id);c(".option-search-filter .error",n).empty();n.click();f()}}}});c(".add-duration",n).unbind().click(function(){AJS.log("Open Jira Duration Dialog");var z=new AJS.Dialog({height:423,width:520,id:"add-jira-duration-dialog"});z.addHeader("Add duration between issue dates");z.addPanel("",Confluence.TeamCalendars.Templates.editJiraSubCalendarDurations(),"calendar-dialog-panel");var E=z.getCurrentPanel().body,D=c(".field-group-jira-show .duration .date-fields",n),B=c(".field-group-jira-show .single-dates .date-fields",n);z.addSubmit("Add",function(){var I=c(".duration-start select option:selected",E),G=c(".duration-end select option:selected",E),H=I.val()+"/"+G.val(),K=c("div.checkbox",D).filter(function(){return c("input",this).val()===H});if(K.length){c("input",K).attr("checked","checked")}else{var J="duration-"+H;c("<div/>",{"class":"checkbox"}).append(c("<input/>",{id:J,type:"checkbox",name:"dateFieldName",value:H,checked:"checked"})).append(c("<label/>",{"for":J,html:AJS.format("Start: {0}",I.html())+"<br>"+AJS.format("End: {0}",G.html())})).prependTo(D);D.parent().addClass("has-selected-duration")}z.remove();m.show()});z.addCancel("Cancel",function(){z.remove();m.show()});var y=c.map(c("div.checkbox",B).filter(function(){return c(this).data("mappableAsDuration")}),function(G){return c("<option/>",{value:c("input",G).val(),text:c("label",G).text()})}),A=c(".duration-start select",E),F=c(".duration-end select",E),x=function(H,G){var I=z.popup.element.find(".button-panel-submit-button");if(G&&H&&G!==H){I.prop("disabled",false).removeClass("ui-state-disabled")}else{I.prop("disabled",true).addClass("ui-state-disabled")}};c.each(y,function(H,G){c(G).appendTo(A).clone().appendTo(F)});if(!y.length){c(".duration-fields",E).addClass("hidden");c(".add-fields",c(".no-selectable-date-fields",E).removeClass("hidden")).html(AJS.format("If you are a JIRA administrator, you \u003ca href=\"{0}/secure/admin/ViewCustomFields.jspa\" target=\"_blank\"\u003ecan create custom date fields\u003c/a\u003e and they will appear as options for issue start and end dates.",c(".field-group-jira-server select option:checked",n).data("display-url")))}var C=function(G,I){var H=c("option:selected",I).val();c("option",I).filter(function(){return c(this).val()}).remove();c.each(y,function(K,J){if(J.val()!==G){J.clone().appendTo(I)}});c("option",I).removeAttr("selected").filter(function(){return c(this).val()===H}).attr("selected","selected")};A.change(function(){var G=c("option:selected",this).val();C(G,F);x(G,c("option:selected",F).val())});F.change(function(){var G=c("option:selected",this).val();C(G,A);x(G,c("option:selected",A).val())});m.hide();x();z.show();return false});c(".subcalendar-cancel",n).click(function(){m.remove();return false});return n};var i=function(z,D){var A=c(".jira-query-options",n);var C=c(".query-group input.radio",A).attr("disabled","disabled").removeAttr("checked","checked");var v=c(".field-group .project-select-label",A);var y=c(".query-group",A);var F=c(".compatibility-group, .field-group-jira-show",A);var x=c(".form-mode",n).addClass("jira-query-options-loading");var w=d.getServerSelect(n).val();var B=function(G,I,H){x.removeClass("jira-query-options-loading");y.addClass("hidden");v.removeClass("hidden");F.addClass("hidden");if(Confluence.TeamCalendars.isRequireOauth(G)){d.showOauthRequitedMessage(G,n,m,F,l)}else{if(z&&c.isFunction(z)){z(G,I,H)}}};var E=function(I){F.removeClass("hidden");x.removeClass("jira-query-options-loading");C.removeAttr("disabled","disabled");if(!I.searchRequests){c(".radio-search-filer input",n).attr("disabled","disabled")}if(!A.hasClass("option-project-selected")){A.removeClass("option-search-filter-selected option-jql-selected").addClass("option-project-selected")}c(".radio-project input",A).attr("checked","checked");if(I.jqlNotSupported){y.addClass("hidden");v.removeClass("hidden")}else{v.addClass("hidden");y.removeClass("hidden");var O=new Date().getTime();var H="jql-"+O;c("textarea[name='jql']",A).before(c(document.createElement("textarea")).attr({autocomplete:"off",cols:"20",id:H,name:"jql",rows:1,wrap:"off",placeholder:"JQL query"}).addClass("textarea with-hint").focus(function(){var S=c(this);if(S.hasClass("with-hint")){S.removeClass("with-hint").val("")}}).val("")).remove();var P=/.+\/jql\/autocomplete.json\?fieldName=[^&]+&fieldValue=.*/;var R=c(".jqlAutoCompleteSpinner",A);A.ajaxSend(function(U,T,S){if(P.test(S.url||"")){R.removeClass("hidden")}}).ajaxComplete(function(U,T,S){if(P.test(S.url||"")){R.addClass("hidden")}});c(".option-jql label",A).attr("for",H);var L="jql-error-"+O;c(".jql-error",A).before(c(document.createElement("div")).addClass("error jql-error").attr("id",L)).remove();c(".dropdown-ready",A).remove();JIRA.JQLAutoComplete({fieldID:H,parser:JIRA.JQLAutoComplete.MyParser(c.parseJSON(I.jqlReservedKeywordsJson||"[]")),queryDelay:0.65,jqlFieldNames:c.parseJSON(I.visibleFieldNamesJson||"[]"),jqlFunctionNames:c.parseJSON(I.visibleFunctionNamesJson||"[]"),minQueryLength:0,allowArrowCarousel:true,autoSelectFirst:false,errorID:L,jiraApplicationId:d.getServerSelect().val(),baseUrl:Confluence.getBaseUrl()});c("textarea[name='jql']",n).keydown(function(U,T){var V=c(this);var S=V.val();if(T||U.keyCode!==27){setTimeout(function(){var X=V.val();var Y=c(".jql-error",n);if(X&&!V.hasClass("with-hint")&&(T||X!==S)){c.ajax({cache:false,data:{jql:X},error:function(){Y.empty().text("Unable to validate JQL against selected JIRA instance.")},success:function(ac){var ab=c(".jql-ok",n),aa=c(".jql-bad",n),Z=c(".duration",n);if(ac.valid){ab.removeClass("hidden");aa.addClass("hidden");f(function(){Z.addClass("can-add-duration");if(c(".date-fields div.checkbox",Z).length){Z.addClass("has-selected-duration")}else{Z.removeClass("has-selected-duration")}});V.focus()}else{ab.addClass("hidden");aa.removeClass("hidden");c(".date-fields",n).empty();k(true);Z.removeClass("can-add-duration")}},type:"PUT",url:Confluence.getBaseUrl().concat("/rest/calendar-services/1.0/calendar/jira/",encodeURIComponent(d.getServerSelect(n).val()),"/jql/validate.json"),timeout:Confluence.TeamCalendars.ajaxTimeout})}},300)}else{var W=c(".option-jql .suggestions",A);if(W.is(":visible")){W.hide();return false}}})}var Q=I.searchRequests;var K=c(".option-search-filter",n);var G=c("input[name='searchFilterName']",K).removeData("searchFilters");if(Q&&c.isArray(Q)&&Q.length){G.data("searchFilters",Q);c(".option-content",K.removeData("hideDateFields")).removeClass("disabled")}else{G.attr("disabled","disabled");c(".option-content",K.data("hideDateFields",true)).addClass("disabled")}var J=I.projects;var N=c(".option-project",n);if(J&&c.isArray(J)&&J.length){var M=c("select",N).empty();c(document.createElement("option")).val("").text("Select").appendTo(M);c.each(J,function(S,T){c(document.createElement("option")).val(T.key).text(T.name).appendTo(M)});c(".option-content",N.removeData("hideDateFields")).removeClass("disabled")}else{c(".option-content",N.data("hideDateFields",true)).addClass("disabled")}if(!I.dateRangeSupported){c(".duration",n).css("visibility","hidden")}else{c(".duration",n).css("visibility","visible")}m.enableOkButton();if(D&&c.isFunction(D)){D(I)}};d.getJiraOptions(B,E,w)};var f=function(y){var x=c(".field-group-jira-show div.checkbox",n).filter(function(){return c("input",this).is(":checked")}),D=c(".jira-query-options .matrix .radio:checked",n).val(),F=c(".duration",n),A={},w="";if("option-project"===D){var v=encodeURIComponent(c(".jira-query-options .option-project select option:selected",n).val());if(v){w="/project/"+v}}else{if("option-search-filter"===D){var C=c(".jira-query-options .option-search-filter input[name='searchFilter']",n).val();if(C){w="/filter/"+encodeURIComponent(C)}}else{if("option-jql"===D){A.query=c(".jira-query-options .option-jql textarea",n).val()||"";if(A.query){w="/jql"}}}}F.removeClass("can-add-duration");if(w){var B=c(".date-fields-spinner-container",n).removeClass("hidden"),E=c(".single-dates .date-fields",n).empty(),z=c(".date-fields",F).empty();c.ajax({cache:false,data:A,dataType:"json",error:function(){B.addClass("hidden");c(".dateFieldName-error",n).text("Error retrieving list of date fields.")},success:function(I){B.addClass("hidden");var J=c("<div/>"),H=c.map(x,function(K){return c("input",K).val()}),G=c.map(I,function(K){return K.key});c.each(I,function(L,K){c("<div/>",{"class":"checkbox"}).append(c("<input/>",{id:"option-"+K.key,name:"dateFieldName",type:"checkbox",value:K.key,checked:c.inArray(K.key,H)!==-1})).append(c("<label/>",{"for":"option-"+K.key,text:K.name})).data("mappableAsDuration",K.customfield||K.key==="duedate"||K.key==="created"||K.key==="resolution").appendTo(J)});x.filter(function(){var L=c("input",this).val();if(L.indexOf("/")!==-1){var K=L.split("/",2);return K.length===2&&c.inArray(K[0],G)!==-1&&c.inArray(K[1],G)!==-1}return false}).appendTo(z.empty());J.appendTo(E.empty());if(J.children().length){k(false);F.addClass("can-add-duration")}else{F.removeClass("can-add-duration")}if(y&&c.isFunction(y)){y(I)}},timeout:Confluence.TeamCalendars.ajaxTimeout,url:Confluence.getBaseUrl().concat("/rest/calendar-services/1.0/calendar/jira/",encodeURIComponent(d.getServerSelect(n).val()),"/date-fields",w,".json")})}else{k(true);if(y&&c.isFunction(y)){y()}}};g();l()},CustomSubmitter:{JiraIssues:{submitForm:function(f,i,j,h,g,k){function l(){var q="",n=c(".field-group-jira-show .date-fields div.checkbox").filter(function(){return c("input:checked",this).length});c.each(n,function(){var s=c("input",this).val();if(s.indexOf("/")!==-1){var r=s.split("/",2);if(q){q+="&"}q+="duration="+encodeURIComponent(r[0]+"/"+r[1])}else{if(q){q+="&"}q+="dateFieldName="+encodeURIComponent(s)}});var o={type:"jira",parentId:j,subCalendarId:c("input[name='subCalendarId']",f).val(),name:i,description:"",color:c("input[name='color']",f).val()},m="jira://"+encodeURIComponent(d.getServerSelect(f).val()||"")+"?",p=c(".jira-query-options .matrix input.radio:checked",f).val();if("option-project"===p){m+="projectKey="+encodeURIComponent(c("select[name='project'] option:selected",f).val())}else{if("option-search-filter"===p){m+="searchFilterId="+c("input[name='searchFilter']",f).val()}else{m+="jql="+encodeURIComponent(c("textarea[name='jql']",f).val())}}if(q){m+="&"+q}o.location=m;return o}e(l(),f,h,k,g)}},JiraAgileSprints:{submitForm:function(f,i,j,h,g,k){var l=b(f,i,j,"sprint","jira-agile-sprint");e(l,f,h,k,g)}},JiraProjectReleases:{submitForm:function(f,i,j,h,g,k){var l=b(f,i,j,"versiondue","jira-project-releases");e(l,f,h,k,g)}}}};return d});
}catch(e){WRMCB(e)};
;
try {
/* module-key = 'com.atlassian.confluence.extra.team-calendars:event-edit', location = 'com/atlassian/confluence/extra/calendar3/components/manage-event/event-edit/event-types.js' */
define("tc/event-types",["jquery","tc/jira-event-field-process"],function(c,d){var b={fields:[{type:"user",id:"who",label:"Who",required:true,property:"what",setTitle:true},{type:"when",id:"people"},{type:"repeats",id:"people"},{type:"reminder",id:"reminder",label:"Reminder"},{type:"text",id:"description",property:"description",label:"Summary",copyto:"what"},{type:"page",id:"url",property:"workingUrl",label:"Related page"}]};var a={DefaultEventType:{travel:c.extend({},b,{id:"travel",name:"Travel"}),leaves:c.extend({},b,{id:"leaves",name:"Leave"}),birthdays:c.extend(true,{},b,{id:"birthdays",name:"Birthdays",fields:[{},{},{defaultRecur:{freq:"YEARLY"}}]}),jira:{id:"jira",name:"JIRA Issue Dates",hiddenFromEventCreation:true,fields:[{type:"text",id:"what",property:"title",label:"What",required:true,readOnly:true},{type:"when",id:"simple",disableEndDateTime:true,disableAllDay:true},{type:"reminder",id:"reminder",label:"Reminder"},{type:"page",id:"url",property:"workingUrl",label:"Related page",readOnly:true},{type:"textarea",id:"description",property:"description",label:"Description",size:5,readOnly:true}]},"jira-agile-sprint":{id:"jira-agile-sprint",name:"JIRA Agile Sprints",hiddenFromEventCreation:true,fields:[{type:"text",id:"what",property:"title",label:"What",required:true,readOnly:true},{type:"when",id:"simple",disableEndDateTime:true,disableAllDay:true},{type:"reminder",id:"reminder",label:"Reminder"},{type:"page",id:"url",property:"workingUrl",label:"Related page",readOnly:true},{type:"textarea",id:"description",property:"description",label:"Description",size:5,readOnly:true}]},"jira-project-releases":{id:"jira-project-releases",name:"JIRA Project Releases",hiddenFromEventCreation:true,fields:[{type:"text",id:"what",property:"title",label:"What",required:true,readOnly:true},{type:"when",id:"simple",disableEndDateTime:true,disableAllDay:true},{type:"reminder",id:"reminder",label:"Reminder"},{type:"page",id:"url",property:"workingUrl",label:"Related page",readOnly:true},{type:"textarea",id:"description",property:"description",label:"Description",size:5,readOnly:true}]},other:{id:"other",name:"Events",fields:[{type:"text",id:"what",property:"title",label:"What",required:true,copyto:"description"},{type:"user",id:"who",label:"Who",property:"what"},{type:"when",id:"simple"},{type:"repeats",id:"simple"},{type:"reminder",id:"reminder",label:"Reminder"},{type:"text",id:"where",property:"where",label:"Where"},{type:"page",id:"url",property:"workingUrl",label:"Related page"},{type:"textarea",id:"description",property:"description",label:"Description",size:5}]},"jira-calendar":{id:"jira-calendar",name:"JIRA Issue Dates",customHandler:d.CustomSubmitter.JiraIssues,hiddenFromEventCreation:!Confluence.TeamCalendars.hasJiraLink,fields:[{type:"jira-server-select",id:"server",property:"server",label:"Server",required:true},{type:"text",id:"name",property:"name",required:true,label:"Name"},{type:"reminder",id:"reminder",label:"Reminder"},{type:"jira-dates",id:"jira-dates"}]},"jira-agile-sprint-calendar":{id:"jira-agile-sprint-calendar",name:"JIRA Agile Sprints",customHandler:d.CustomSubmitter.JiraAgileSprints,hiddenFromEventCreation:!Confluence.TeamCalendars.hasJiraLink,fields:[{type:"jira-hidden-fields",id:"",property:"",required:true,label:""},{type:"jira-server-select",id:"server",property:"server",label:"Server",required:true},{type:"jira-project-select",id:"project",property:"project",label:"Project",required:true},{type:"text",id:"name",property:"title",required:true,label:"Name"},{type:"reminder",id:"reminder",label:"Reminder"}]},"jira-project-releases-calendar":{id:"jira-project-releases-calendar",name:"JIRA Project Releases",customHandler:d.CustomSubmitter.JiraProjectReleases,hiddenFromEventCreation:!Confluence.TeamCalendars.hasJiraLink,fields:[{type:"jira-hidden-fields",id:"",property:"",required:true,label:""},{type:"jira-server-select",id:"server",property:"server",label:"Server",required:true},{type:"jira-project-select",id:"project",property:"project",label:"Project",required:true},{type:"text",id:"name",property:"title",required:true,label:"Name"},{type:"reminder",id:"reminder",label:"Reminder"}]}},CustomEventType:{id:"custom",name:"Event",fields:[{type:"text",id:"what",property:"title",label:"What",required:true,copyto:"description"},{type:"user",id:"who",label:"Who",property:"what"},{type:"when",id:"simple"},{type:"repeats",id:"simple"},{type:"reminder",id:"reminder",label:"Reminder"},{type:"text",id:"where",property:"where",label:"Where"},{type:"page",id:"url",property:"workingUrl",label:"Related page"},{type:"textarea",id:"description",property:"description",label:"Description",size:5}]}};return a});
}catch(e){WRMCB(e)};
;
try {
/* module-key = 'com.atlassian.confluence.extra.team-calendars:event-edit', location = 'com/atlassian/confluence/extra/calendar3/components/manage-event/event-edit/event-edit-dialog-combat.js' */
require(["tc/event-edit-dialog"],function(a){if(!Confluence.TeamCalendars.Dialogs){Confluence.TeamCalendars.Dialogs={}}Confluence.TeamCalendars.Dialogs.getEditEventDialog=function(d,c,e,b){return new a().getEditEventDialog(d,c,e,b)}});
}catch(e){WRMCB(e)};
;
try {
/* module-key = 'com.atlassian.confluence.extra.team-calendars:eventtypes-edit', location = 'com/atlassian/confluence/extra/calendar3/components/customeventype/customeventtype-list.js' */
define("tc/customeventtype-list",["jquery","tc-backbone","tc/customeventtype-model","underscore"],function(c,e,d,a){var b=e.Collection.extend({model:d,select:function(g){this.selectedId=g;var f=this.selectedItem();this.trigger("selected",this);return f},selectedItem:function(){if(this.selectedId){return this.findWhere({id:this.selectedId})}return undefined},defaultEventTypes:function(){return this.where({isCustomEvent:false})},customEventTypes:function(){return this.where({isCustomEvent:true})},initialize:function(){this.sortField="name";this.sortDirection="ASC"},setSortField:function(g,f){this.sortField=g;this.sortDirection=f},comparator:function(f){return f.get(this.sortField)},sortBy:function(g,f){var i=this.models,h=this.sortDirection;return a.pluck(a.map(i,function(l,j,k){return{value:l,index:j,criteria:g.call(f,l,j,k)}}).sort(function(m,j){var l=h==="ASC"?m.criteria:j.criteria,k=h==="ASC"?j.criteria:m.criteria;if(l!==k){if(l>k||l===void 0){return 1}if(l<k||k===void 0){return -1}}return m.index<j.index?-1:1}),"value")}});return b});
}catch(e){WRMCB(e)};
;
try {
/* module-key = 'com.atlassian.confluence.extra.team-calendars:eventtypes-edit', location = 'com/atlassian/confluence/extra/calendar3/components/customeventype/customeventtype-model.js' */
define("tc/customeventtype-model",["jquery","tc-backbone"],function(b,c){var a=c.Model.extend({defaults:function(){return{title:"",icon:"",subCalendar:"",disable:false,isCustomEvent:false,id:"",created:"",periodInMins:""}},validate:function(d){if(!d.isCustomEvent){return false}var e=[];if(!d.title){e.push({field:"title",message:"Event name is required"})}d.title=b.trim(d.title);if(d.title.length<=0){e.push({field:"title",message:"Event name is required"})}else{if(d.title.length>256){e.push({field:"title",message:"Event name should be less than or equal to 256 characters"})}}if(!d.icon){e.push({field:"icon",message:"Event icon is required"})}return e.length>0?e:false},toggle:function(){this.set({disable:!this.get("disable")})}});return a});
}catch(e){WRMCB(e)};
;
try {
/* module-key = 'com.atlassian.confluence.extra.team-calendars:eventtypes-edit', location = 'com/atlassian/confluence/extra/calendar3/components/customeventype/customeventtype-view/customeventtype-view.js' */
define("tc/customeventtype-view",["jquery","tc-backbone","tc/dialogs","tc/templates","tc/customeventtype-edit","tc/calendar-util"],function(f,g,b,d,e,c){var a=g.View.extend({tagName:"tr",mediator:null,confirmDialog:null,events:{"click .hidden-link":"_toggle","click .edit-eventtypes-link":"_edit","click .remove-eventtypes-link":"_removeFromCollection"},initialize:function(h){this.mediator=h.mediator;this.listenTo(this.model,"change",this.render);this.listenTo(this.model,"destroy",this.remove);this.listenTo(this.model.collection,"selected",this.selected)},render:function(){if(!this.$el.hasClass("event-type-item")){this.$el.addClass("event-type-item")}if(this.model.get("disable")){this.$el.addClass("event-type-item-hidden")}else{this.$el.removeClass("event-type-item-hidden")}this.$el.find(".eventtypes-icon-link a").each(function(j,k){var l=f(k).data("tipsy");if(l){l.disable();l.hide()}});var h=f.extend({},this.model,{showInforReminder:c.showInforReminder(this.model.attributes.periodInMins)});this.$el.html(Confluence.TeamCalendars.Templates.viewCustomEventType({eventTypeModel:h}));var i=this.$el.find(".eventtypes-icon-link a");if(i.tooltip){i.tooltip({aria:true})}return this},removeEventListener:function(){this.$el.off("click",".hide-eventtypes-link")},remove:function(){this.$el.remove()},selected:function(i){var h=i.selectedItem();if(h.id===this.model.id){this._edit()}},_toggle:function(){this.model.toggle()},_edit:function(){var h=new e({model:this.model,parentCustomEventTypeDiv:this.$el,mediator:this.mediator});h.render();f("#edit-calendar-dialog").find(".eventtypes-edit-dialog-panel").scrollTop(h.$el.position().top)},_removeFromCollection:function(){var h=this;h.mediator.trigger("close-edit-custom-event-dialog");h._showConfirmCustomEventTypeDeleteDialog(h.model)},_getCustomEventTypeData:function(h){return{subCalendarId:h.get("subCalendar").id,customEventTypeId:h.get("id")}},_showConfirmCustomEventTypeDeleteDialog:function(h){var j=this;function i(l){if(l.keyCode===27){j._calltrigerOpenEditCustomEventTypeDialog(i)}}f(document).keyup(i);var k=new AJS.Dialog(450,"auto","confirm-delete-custom-event-type");k.addHeader("Delete Event Type");k.addPanel("",Confluence.TeamCalendars.Templates.confirmCustomEventNameDelete({customEventName:h.get("title")}),"tc-confirm-delete-custom-event-type-dialog");k.addButton("Yes",function(){j._removeCustomEventType(h,k,i)});k.addLink("Cancel",function(){k.hide();j._calltrigerOpenEditCustomEventTypeDialog(i);return false});j.confirmDialog=k;j.confirmDialog.show();j.confirmDialog.updateHeight();return k},_removeCustomEventType:function(i,l,j){var k=this;var h=k._getCustomEventTypeData(i);f.ajax({cache:false,data:h,dataType:"json",error:function(m,o,n){l.hide()},success:function(){i.collection.remove(i);l.hide();k._calltrigerOpenEditCustomEventTypeDialog(j);var m={customEventTypeName:i.get("title")};Confluence.TeamCalendars.fireEventForAnalytics("customeventtype.delete",m)},type:"DELETE",timeout:Confluence.TeamCalendars.ajaxTimeout,url:Confluence.TeamCalendars.getCalendarServiceBaseUrl("/eventtype/custom.json")})},_calltrigerOpenEditCustomEventTypeDialog:function(h){this.mediator.trigger("open-edit-custom-event-dialog");if(this.confirmDialog){this.confirmDialog.hide();this.confirmDialog.remove()}f(document).unbind("keyup",h)}});return a});
}catch(e){WRMCB(e)};
;
try {
/* module-key = 'com.atlassian.confluence.extra.team-calendars:eventtypes-edit', location = 'com/atlassian/confluence/extra/calendar3/components/customeventype/customeventtype-view/customeventtype-view.soy' */
// This file was automatically generated from customeventtype-view.soy.
// Please don't edit this file by hand.

/**
 * @fileoverview Templates in namespace Confluence.TeamCalendars.Templates.
 */

if (typeof Confluence == 'undefined') { var Confluence = {}; }
if (typeof Confluence.TeamCalendars == 'undefined') { Confluence.TeamCalendars = {}; }
if (typeof Confluence.TeamCalendars.Templates == 'undefined') { Confluence.TeamCalendars.Templates = {}; }


Confluence.TeamCalendars.Templates.viewCustomEventType = function(opt_data, opt_ignored) {
  return '<td class="custom-event-type-title" data-id="' + soy.$$escapeHtml(opt_data.eventTypeModel.attributes.id) + '" data-title="' + soy.$$escapeHtml(opt_data.eventTypeModel.attributes.title) + '"><span class="event-type-link" title="' + soy.$$escapeHtml(opt_data.eventTypeModel.attributes.title) + '"><span class="' + soy.$$escapeHtml(opt_data.eventTypeModel.attributes.icon) + '"></span><span class="event-type-label">' + soy.$$escapeHtml(opt_data.eventTypeModel.attributes.title) + '</span></span></td><td class="event-type-reminder-title"><span class="event-type-reminder-info" title="' + soy.$$escapeHtml(opt_data.eventTypeModel.showInforReminder) + '">' + soy.$$escapeHtml(opt_data.eventTypeModel.showInforReminder) + '</span></td><td class="eventtypes-icon-link">' + ((opt_data.eventTypeModel.attributes.isCustomEvent) ? '<a href="#" class="aui-icon edit-eventtypes-link" title="' + soy.$$escapeHtml('Edit Event') + '"></a><a href="#" class="aui-icon hidden-link ' + ((opt_data.eventTypeModel.attributes.disable) ? ' show-eventtypes-link ' : ' hide-eventtypes-link ') + '" title="' + ((opt_data.eventTypeModel.attributes.disable) ? ' ' + soy.$$escapeHtml('Show Event') + ' ' : ' ' + soy.$$escapeHtml('Hide Event') + ' ') + '"/><a href="#" class="aui-icon remove-eventtypes-link" title="' + soy.$$escapeHtml('Delete Event') + '"></a>' : '<a href="#" class="aui-icon edit-eventtypes-link" title="' + soy.$$escapeHtml('Edit Event') + '"></a><a href="#" class="aui-icon hidden-link ' + ((opt_data.eventTypeModel.attributes.disable) ? ' show-eventtypes-link ' : ' hide-eventtypes-link ') + '" title="' + ((opt_data.eventTypeModel.attributes.disable) ? ' ' + soy.$$escapeHtml('Show Event') + ' ' : ' ' + soy.$$escapeHtml('Hide Event') + ' ') + '"/>') + '</td>';
};
if (goog.DEBUG) {
  Confluence.TeamCalendars.Templates.viewCustomEventType.soyTemplateName = 'Confluence.TeamCalendars.Templates.viewCustomEventType';
}

}catch(e){WRMCB(e)};
;
try {
/* module-key = 'com.atlassian.confluence.extra.team-calendars:eventtypes-edit', location = 'com/atlassian/confluence/extra/calendar3/components/customeventype/customeventtypes-edit-dialog/customeventtypes-edit-dialog.js' */
define("tc/eventtypes-edit-dialog",["jquery","underscore","tc-backbone","tc/dialogs","tc/templates","tc/customeventtype-view","tc/customeventtype-edit","tc/customeventtype-model","tc/customeventtype-list","tc/event-types"],function(e,i,h,g,k,d,a,f,c,j){var b=h.View.extend({editDialog:null,subCalendar:null,callbackHandler:null,mediator:null,events:{"click .add-custom-event-type-item span":"_showAddEventypeForm"},initialize:function(l){this.options=e.extend({},this.defaults,l);this.mediator=i.extend({},h.Events);this.subCalendar=this.options.subCalendar;this.callbackHandler=this.options.callbackHandler;this.collection=this._buildCustomEventTypeCollection();this.editDialog=this.options.editDialog;this.listenTo(this.collection,"reset add remove",this.render);this.mediator.on("Custom-Event-Type.save",i.bind(this._updateEventType,this,this.callbackHandler));this.mediator.on("close-edit-custom-event-dialog",i.bind(this._closeEditCustomEventTypeDialog,this));this.mediator.on("open-edit-custom-event-dialog",i.bind(this._openEditCustomEventTypeDialog,this));this.$el.html(k.editCalendarEventTypes({subCalendarId:this.subCalendar.id,eventTypes:this.collection}));this.editDialog.addPanel("Event Types",this.$el,"eventtypes-edit-dialog-panel")},render:function(){if(this.collection.customEventTypes().length===0){this.$el.find(".custom-event-type-items-instructional").removeClass("hidden")}else{this.$el.find(".custom-event-type-items-instructional").addClass("hidden")}this.$el.find(".event-type-item").remove();this._renderCustomeEventTypes(this.$el.find(".default-event-type-items"),this.collection.defaultEventTypes());this.collection.setSortField("created","DESC");this.collection.sort();this._renderCustomeEventTypes(this.$el.find(".custom-event-type-items"),this.collection.customEventTypes());this.editDialog.getCurrentPanel().onselect=function(){e("#edit-calendar-dialog").find(".button-panel-button.submit").removeClass("hidden")};return this.editDialog},selectCustomEvent:function(l){this.collection.select(l)},getDisableEventTypes:function(){var l=this.collection.chain().filter(function(m){return m.get("disable")===true}).map(function(m){return m.id}).value();return l},showAddEventypeForm:function(){e(".add-custom-event-type-item span").click()},_renderCustomeEventTypes:function(l,n){var m=this;e(n).each(function(o,q){var p=new d({model:q,mediator:m.mediator});l.after(p.render().el)})},_buildCustomEventTypeCollection:function(){var o=this;var t=o.subCalendar.disableEventTypes;var s=o.subCalendar.customEventTypes;var m=o.subCalendar.sanboxEventTypeReminders;var l=j.DefaultEventType;var n=new c();var q=function(u){for(var v in t){if(u===t[v]){return true}}return false};var r=function(u){for(var v in m){if(u===m[v].eventTypeId){return m[v].periodInMins}}};var p=new Array();e.each(l,function(u,w){if(!w.hiddenFromEventCreation){var v=new f({title:w.name,subCalendar:o.subCalendar,disable:q(w.id),id:w.id,icon:w.id,periodInMins:r(w.id)});p.push(v)}});if(s){e.each(s,function(u,w){var v=new f({title:w.title,subCalendar:o.subCalendar,disable:q(w.customEventTypeId),id:w.customEventTypeId,icon:w.icon,isCustomEvent:true,created:w.created,periodInMins:w.periodInMins});p.push(v)})}n.add(p);return n},_showAddEventypeForm:function(n){var o=e(n.target).closest(".add-custom-event-type-item");var l=new f({id:null,subCalendar:this.subCalendar,isCustomEvent:true});l.collection=this.collection;var m=new a({model:l,parentCustomEventTypeDiv:o,mediator:this.mediator});m.render();this.$el.parent().scrollTop(this.$el.find("#edit-custom-event-type-form form").position().top)},_updateEventType:function(m,l){if(l.get("isCustomEvent")===true){this._updateCustomEventType(m,l)}else{this._updateSanboxEventType(m,l)}},_updateCustomEventType:function(n,p){var o=this;var l=o._getCustomEventTypes(p);var m=this.$el.find("#save-custom-event-type");e(m).val("Saving...").attr("disabled","disabled").addClass("ui-state-disabled");e.ajax({cache:false,data:l,dataType:"json",error:function(q,s,r){n.showAjaxUpdateError(q,s,r)},success:function(r){var t=new f({subCalendar:o.subCalendar,isCustomEvent:true,title:r.title,icon:r.icon,id:r.customEventTypeId,created:r.created,periodInMins:r.periodInMins});var u={customEventTypeName:r.title};var s=true;var q=o.collection.where({id:r.customEventTypeId});if(q&&q.length>0){s=false}if(s){Confluence.TeamCalendars.fireEventForAnalytics("customeventtype.create",u)}else{Confluence.TeamCalendars.fireEventForAnalytics("customeventtype.update",u)}o.collection.add(t);o.$el.parent().scrollTop(o.$el.find(".add-custom-event-type-item").position().top)},type:"PUT",timeout:Confluence.TeamCalendars.ajaxTimeout,url:Confluence.TeamCalendars.getCalendarServiceBaseUrl("/eventtype/custom.json")})},_updateSanboxEventType:function(o,n){var p=this;var l=p._getSanboxEventTypes(n);var m=this.$el.find("#save-custom-event-type");e(m).val("Saving...").attr("disabled","disabled").addClass("ui-state-disabled");e.ajax({cache:false,data:l,dataType:"json",error:function(q,s,r){o.showAjaxUpdateError(q,s,r)},success:function(q){p.collection.add(n);p.$el.parent().scrollTop(p.$el.find(".add-custom-event-type-item").position().top)},type:"PUT",timeout:Confluence.TeamCalendars.ajaxTimeout,url:Confluence.TeamCalendars.getCalendarServiceBaseUrl("/eventtype/sandbox.json")})},_selectIconCustomEventType:function(l){l.preventDefault();e(l.target).siblings(".icon-teamcals").removeClass("selected");e(l.target).addClass("selected")},_getCustomEventTypes:function(l){return{title:l.get("title"),icon:l.get("icon"),subCalendarId:l.get("subCalendar").id,customEventTypeId:l.get("id"),created:l.get("created"),periodInMins:l.get("periodInMins")}},_getSanboxEventTypes:function(l){return{title:l.get("title"),icon:l.get("icon"),subCalendarId:l.get("subCalendar").id,eventTypeId:l.get("id"),created:l.get("created"),periodInMins:l.get("periodInMins")}},_closeEditCustomEventTypeDialog:function(){this.editDialog.hide()},_openEditCustomEventTypeDialog:function(){this.editDialog.show()}});return b});
}catch(e){WRMCB(e)};
;
try {
/* module-key = 'com.atlassian.confluence.extra.team-calendars:eventtypes-edit', location = 'com/atlassian/confluence/extra/calendar3/components/customeventype/customeventtypes-edit-dialog/customeventtypes-edit-dialog.soy' */
// This file was automatically generated from customeventtypes-edit-dialog.soy.
// Please don't edit this file by hand.

/**
 * @fileoverview Templates in namespace Confluence.TeamCalendars.Templates.
 */

if (typeof Confluence == 'undefined') { var Confluence = {}; }
if (typeof Confluence.TeamCalendars == 'undefined') { Confluence.TeamCalendars = {}; }
if (typeof Confluence.TeamCalendars.Templates == 'undefined') { Confluence.TeamCalendars.Templates = {}; }


Confluence.TeamCalendars.Templates.editCalendarEventTypes = function(opt_data, opt_ignored) {
  return '<form name="editSubCalendarEventTypesForm" class="sub-calendar-edit-event-types-form aui" method="POST" action="#"><input type="hidden" name="subCalendarId" value="' + soy.$$escapeHtml(opt_data.subCalendarId) + '"><div class="form-mode create"><table id="eventtypes-edit-table" class="tc-event-type-item aui"><colgroup><col span="1" class="aui-restfultable-order"><col span="1"><col span="1" class="aui-restfultable-operations"></colgroup><tbody class="ui-sortable"><tr class="default-event-type-items"><td class="event-types-title">' + soy.$$escapeHtml('Default Event Types') + '</td><td class="event-types-title">' + soy.$$escapeHtml('Reminder') + '</td><td class="event-types-title"/></tr><tr class="custom-event-type-items"><td class="event-types-title">' + soy.$$escapeHtml('Custom Event Types') + '</td><td class="event-types-title">' + soy.$$escapeHtml('Reminder') + '</td><td class="event-types-title"/></tr><tr class="custom-event-type-items-instructional"><td class="custom-event-types-instructional" colspan="3">' + soy.$$escapeHtml('Plan any type of event, like training, rosters, and campaigns!') + '</td></tr><tr class="add-custom-event-type-item"><td><span class="custom-event-type-link" title="' + soy.$$escapeHtml('Add new event type') + '"><span class="add-event-type-icon"/><span class="add-event-type-label">' + soy.$$escapeHtml('Add new event type') + '</span></span></td><td class="event-types-title"/></tr></tbody></table></div></form>';
};
if (goog.DEBUG) {
  Confluence.TeamCalendars.Templates.editCalendarEventTypes.soyTemplateName = 'Confluence.TeamCalendars.Templates.editCalendarEventTypes';
}

}catch(e){WRMCB(e)};
;
try {
/* module-key = 'com.atlassian.confluence.extra.team-calendars:mycalendar-tour-resources', location = 'com/atlassian/confluence/extra/calendar3/components/local-stogare/local-storage.js' */
define("tc/localStorage",["jquery"],function(e){var c=function(){return{getItem:function(h){e.cookie(h)},setItem:function(i,j,h){e.cookie(i,j,h)}}}();var g="team-calendars",a=Confluence.storageManager?Confluence.storageManager(g):(localStorage?localStorage:c),b=AJS.Meta.get("remote-user"),d="confluence."+b+"."+g;var f=function(h){return Confluence.storageManager?h:d+"."+h};return{getItem:function(h){return a.getItem(f(h))},setItem:function(i,j,h){try{a.setItem(f(i),j,h)}catch(k){console.log(k)}}}});
}catch(e){WRMCB(e)};
;
try {
/* module-key = 'com.atlassian.confluence.extra.team-calendars:mycalendar-tour-resources', location = 'com/atlassian/confluence/extra/calendar3/components/local-stogare/local-storage-compat.js' */
require(["tc/localStorage"],function(a){Confluence.TeamCalendars.LocalStorage=a});
}catch(e){WRMCB(e)};
;
try {
/* module-key = 'com.atlassian.confluence.extra.team-calendars:mycalendar-tour-resources', location = 'com/atlassian/confluence/extra/calendar3/components/my-calendar-tour/my-calendar-tour.js' */
define("tc/myCalendarTour",["jquery","underscore","tc/localStorage"],function(n,C,s){var j="team.calendar";var d=j+".tour";var h=false;var p=false;var r=true;var e=d+".currentLegIndex";var m=d+".currentAttachedCalendar";var x=d+".done";var l="div[data-sub-calendar-id='#calendarID']";var t=function(F){var G=F.calendarID;if(!G){return null}return l.replace("#calendarID",G)};var b={selectMenuItem:function(G,I){var H=t(G);if(!H){return}var F=H+I;n(F).parent().addClass("active")},unSelectMenuItem:function(G,I){var H=t(G);if(!H){return}var F=H+I;n(F).parent().removeClass("active")}};var c={openMenu:function(F){var G=t(F);if(n(G+" .subcalendar-dropdown-menu.parent-subCalendar.active").size()>0){return}n(G+" .subcalendar-dropdown-menu .subcalendar-dropdown-menu-button .aui-button.aui-button-compact").click()},closeMenu:function(F){var G=t(F);if(n(G+" .subcalendar-dropdown-menu.parent-subCalendar.active").size()>0){r=false;n(".calendar-panel").click()}},hightLightEditMenuItem:function(F){return b.selectMenuItem(F," .parent-subCalendar a.subcalendar-edit")},unHightLightEditMenuItem:function(F){return b.unSelectMenuItem(F," .parent-subCalendar a.subcalendar-edit")},hightLightRestrictionMenuItem:function(F){return b.selectMenuItem(F," .parent-subCalendar a.subcalendar-restrict")},unHightLightRestrictionMenuItem:function(F){return b.unSelectMenuItem(F," .parent-subCalendar a.subcalendar-restrict")},hightLightShareMenuItem:function(F){return b.selectMenuItem(F," .parent-subCalendar a.subcalendar-share-or-embed")},unHightLightShareMenuItem:function(F){return b.unSelectMenuItem(F," .parent-subCalendar a.subcalendar-share-or-embed")}};var z=function(F){i(F);a(F);A(F)};var k=function(F){w(F);E(F);D()};var a=function(F){n(document).on("keydown",B)};var E=function(F){n(document).off("keydown",B)};var B=function(F){if(F.keyCode===27){p=true;u.stop()}};var i=function(G){var F=this;if(!h){n("body").on("click."+d,function(I){var H=n(I.target);if(!r){r=true;return}if(H.closest(".tourbus-leg-inner").length===0){p=true;G.stop()}});h=true}};var w=function(F){if(h){n("body").off("click."+d)}h=false};var A=function(F){n(window).bind("resize."+d,function(G){F.repositionLegs()})};var D=function(){n(window).unbind("resize."+d)};var v=function(F){var G=t({calendarID:F});if(n(G).is(G)){C.each(n("ol.tourbus-legs li.tc-tour-dynamic"),function(J){var I=n(J);var H=I.data("el");I.attr("data-el",G+" "+H)});return true}return false};var g=function(G,F){if(!G||!F){AJS.log("Team Calendar tour - could not execute action because invalid calendarID or actionsString");return}C.each(F.split(" "),function(I){var H=c[I];if(H){AJS.log("Team Calendar tour - leg actions - "+I);H({calendarID:G});AJS.log("Team Calendar tour - leg actions - "+I+" done")}})};var o=function(){AJS.log("Team Calendar tour - mark as DONE");s.setItem(x,"done")};var y=function(){return s.getItem(x)==="done"};var q=function(){if(AJS.dropDown.current&&AJS.dropDown.current.hide){AJS.log("Team Calendar tour - hidding dropdown menu");AJS.dropDown.current.hide()}};var f=undefined;var u=undefined;return{tcStorage:s,tourBus:u,start:function(G){if(n(".aui-message.error.license-invalid").size()>0){AJS.log("Team Calendar tour - is available when license is valid");return}if(y()){AJS.log("Team Calendar tour - is already done");return}if(n(".plugin-calendar-container.page").size()>0){AJS.log("Team Calendar tour - is only available on MyCalendar");return}if(!G){G=s.getItem(m)}else{s.setItem(e,0);s.setItem(m,G)}var F=s.getItem(e);if(!F){F=0}if(!v(G)){AJS.log("Team Calendar tour - could not attached to target elements");return}if(u){p=true;q();u.stop();u.destroy();p=false}f=n("#my-calendar-tour").tourbus({startAt:F,onDepart:function(H){AJS.log("Team Calendar tour - depart");z(H)},onStop:function(H){AJS.log("Team Calendar tour - stop");k(H);c.closeMenu({calendarID:G});if(!p){o();s.setItem(e,0);Confluence.TeamCalendars.fireEventForAnalytics("tour.finish",{stepNumber:-1});p=false}},onLegStart:function(L,N){AJS.log("Team Calendar tour - leg start");s.setItem(e,N.currentLegIndex);var M=L.$el.find(".order");var I=N.currentLegIndex;var H=M.html();H=H.replace("#legIndex",++I);H=H.replace("#totalLegs",N.totalLegs);M.html(H);AJS.log("Team Calendar tour - leg - executing before actions");var J=L.$original.data("before-leg-actions");g(G,J);AJS.log("Team Calendar tour - leg start - before actions executed");L.reposition();var K={stepNumber:N.currentLegIndex};Confluence.TeamCalendars.fireEventForAnalytics("tour.step",K)},onLegEnd:function(I,J){AJS.log("Team Calendar tour - leg end");AJS.log("Team Calendar tour - leg - executing after actions");var H=I.$original.data("after-leg-actions");g(G,H);AJS.log("Team Calendar tour - leg end - after actions executed")},leg:{zindex:2400,width:270,margin:15}});u=f.data("tourbus");if(!u.running){u.depart()}},stop:function(){if(u){o();u.stop()}},softStop:function(){if(u){o();u.hideLeg()}},destroy:function(){if(u){u.destroy()}},showLeg:function(F){if(u){u.showLeg(F)}},hideLeg:function(){if(u){u.hideLeg();var F={stepNumber:u.currentLegIndex}}},isShowCustomEventTypeFrom:function(G){if(y()){return false}var F=s.getItem(m);if(F===""||!F){return false}var H=s.getItem(e);if(H!=="0"){return false}if(F!==G){return false}return true},reposition:function(){if(u&&!y()){u.repositionLegs()}}}});
}catch(e){WRMCB(e)};
;
try {
/* module-key = 'com.atlassian.confluence.extra.team-calendars:mycalendar-tour-resources', location = 'com/atlassian/confluence/extra/calendar3/components/my-calendar-tour/my-calendar-tour.soy' */
// This file was automatically generated from my-calendar-tour.soy.
// Please don't edit this file by hand.

/**
 * @fileoverview Templates in namespace Confluence.TeamCalendars.Templates.
 */

if (typeof Confluence == 'undefined') { var Confluence = {}; }
if (typeof Confluence.TeamCalendars == 'undefined') { Confluence.TeamCalendars = {}; }
if (typeof Confluence.TeamCalendars.Templates == 'undefined') { Confluence.TeamCalendars.Templates = {}; }


Confluence.TeamCalendars.Templates.calendarTourContent = function(opt_data, opt_ignored) {
  return '<ol class="tourbus-legs" id="my-calendar-tour" ><li class="tc-tour-dynamic" data-el=".parent-subCalendar a.subcalendar-edit" data-orientation="left" data-align="left" data-arrow="50%" data-before-leg-actions="openMenu hightLightEditMenuItem" data-after-leg-actions="unHightLightEditMenuItem closeMenu"><span class="tourbus-title">' + soy.$$escapeHtml('EDIT THE CALENDAR') + '</span><p>' + soy.$$escapeHtml('Customise the different types of events you\x27d like to manage in this calendar.') + '</p><button class="tourbus-btn tourbus-next aui-button">Next</button><button class="tourbus-btn tourbus-stop aui-button aui-button-link">Skip tour</button><span class="order">#legIndex/#totalLegs</span></li><li class="tc-tour-dynamic" data-el=".parent-subCalendar a.subcalendar-restrict" data-orientation="left" data-align="left" data-arrow="50%" data-before-leg-actions="openMenu hightLightRestrictionMenuItem" data-after-leg-actions="unHightLightRestrictionMenuItem closeMenu"><span class="tourbus-title">' + soy.$$escapeHtml('RESTRICT THE CALENDAR') + '</span><p>' + soy.$$escapeHtml('Optionally, restrict who can view or add events to the team calendar.') + '</p><button class="tourbus-btn tourbus-next aui-button">Next</button><button class="tourbus-btn tourbus-stop aui-button aui-button-link">Skip tour</button><span class="order">#legIndex/#totalLegs</span></li><li class="tc-tour-dynamic" data-el=".parent-subCalendar a.subcalendar-share-or-embed" data-orientation="left" data-align="left" data-arrow="50%" data-before-leg-actions="openMenu hightLightShareMenuItem" data-after-leg-actions="unHightLightShareMenuItem  closeMenu"><span class="tourbus-title">' + soy.$$escapeHtml('SHARE WITH YOUR TEAM') + '</span><p>' + soy.$$escapeHtml('Grab the calendar\x27s URL and email it to your team, or paste it on a page to embed the calendar.') + '</p><button class="tourbus-btn tourbus-next aui-button">Next</button><button class="tourbus-btn tourbus-stop aui-button aui-button-link">Skip tour</button><span class="order">#legIndex/#totalLegs</span></li><li data-el="#add-event-link" data-orientation="left" data-arrow="17%" ><span class="tourbus-title">' + soy.$$escapeHtml('ADD AN EVENT') + '</span><p>' + soy.$$escapeHtml('The calendar is ready to go! Click any day on the calendar to add an event or use the Add event button.') + '</p><button class="tourbus-btn tourbus-stop aui-button">Done</button><span class="order">#legIndex/#totalLegs</span></li></ol>';
};
if (goog.DEBUG) {
  Confluence.TeamCalendars.Templates.calendarTourContent.soyTemplateName = 'Confluence.TeamCalendars.Templates.calendarTourContent';
}

}catch(e){WRMCB(e)};
;
try {
/* module-key = 'com.atlassian.confluence.extra.team-calendars:mycalendar-tour-resources', location = 'com/atlassian/confluence/extra/calendar3/components/my-calendar-tour/my-calendar-tour-compat.js' */
require(["tc/myCalendarTour"],function(a){if(!Confluence.TeamCalendars){Confluence.TeamCalendars={}}Confluence.TeamCalendars.CalendarTour=function(){return a}});
}catch(e){WRMCB(e)};
;
try {
/* module-key = 'com.atlassian.confluence.extra.team-calendars:calendar-share-embedded', location = 'com/atlassian/confluence/extra/calendar3/components/calendar-share-dialog/calendar-share-dialog.js' */
define("tc/calendar-share-dialog",["jquery","underscore","tc-backbone","tc/templates","tc/calendar-util"],function(e,a,f,c,b){var d=f.View.extend({calendarDiv:null,subCalendar:null,calendarPlugin:null,editDialog:null,initialize:function(g){this.calendarDiv=g.calendarDiv;this.subCalendar=g.subCalendar;this.calendarPlugin=g.calendarPlugin;this.editDialog=g.editDialog;this.$el.html(c.shareSubCalendar({elementIdSuffix:b.getParameter(this.calendarDiv,"elementIdSuffix")}));this.editDialog.addPanel("Embed",this.$el,"calendar-share-dialog-panel")},render:function(){var j=this;var k=this.calendarPlugin.doesSubCalendarHaveRestrictions(j.subCalendar),h,g;h=j.editDialog.getCurrentPanel().body;g=e(".share-restrictions-link",h);var i="";if(j.subCalendar.spaceKey){i=AJS.format("{0}/display/{1}/calendar/{2}?calendarName={3}",b.getParameter(j.calendarDiv,"baseUrl"),encodeURIComponent(j.subCalendar.spaceKey),encodeURIComponent(j.subCalendar.subscriptionId||j.subCalendar.id),encodeURIComponent(j.subCalendar.name))}else{i=AJS.format("{0}/calendar/previewcalendar.action?subCalendarId={1}",b.getParameter(j.calendarDiv,"baseUrl"),encodeURIComponent(j.subCalendar.subscriptionId||j.subCalendar.id))}e(".share-address-field",this.editDialog.getCurrentPanel().body).val(i);if(k){if(j.calendarPlugin.isSubCalendarAdministratable(j.calendarDiv,j.subCalendar)){g.click(function(){j.editDialog.hide();j.calendarPlugin.getSubCalendarRestrictionsDialog(j.calendarDiv,j.subCalendar).show()})}else{g.addClass("hidden")}}else{e(".description",h).addClass("hidden");var l=e(".autoconvert",h);if(j.calendarPlugin.isAutoConvertSupported(j.calendarDiv)){l.removeClass("hidden")}else{l.addClass("hidden")}}this.editDialog.getCurrentPanel().onselect=function(){e("#edit-calendar-dialog").find(".button-panel-button.submit").addClass("hidden");e(".share-address-field",j.editDialog.getCurrentPanel().body).focus().select()};return j.editDialog}});return d});
}catch(e){WRMCB(e)};
;
try {
/* module-key = 'com.atlassian.confluence.extra.team-calendars:calendar-share-embedded', location = 'com/atlassian/confluence/extra/calendar3/components/calendar-share-dialog/subcalendar-share-dialog.soy' */
// This file was automatically generated from subcalendar-share-dialog.soy.
// Please don't edit this file by hand.

/**
 * @fileoverview Templates in namespace Confluence.TeamCalendars.Templates.
 */

if (typeof Confluence == 'undefined') { var Confluence = {}; }
if (typeof Confluence.TeamCalendars == 'undefined') { Confluence.TeamCalendars = {}; }
if (typeof Confluence.TeamCalendars.Templates == 'undefined') { Confluence.TeamCalendars.Templates = {}; }


Confluence.TeamCalendars.Templates.shareSubCalendar = function(opt_data, opt_ignored) {
  return '<div><label for="share-address-' + soy.$$escapeHtml(opt_data.elementIdSuffix) + '" class="share-address-label">' + soy.$$escapeHtml('Calendar link:') + '</label><input type="text" name="share-address" id="share-address-' + soy.$$escapeHtml(opt_data.elementIdSuffix) + '" class="share-address-field"><div class="description autoconvert hidden">' + soy.$$escapeHtml('Grab this link and paste it on a Confluence page to embed the calendar in your content.') + '</div><div class="description icon-lock">' + soy.$$filterNoAutoescape('Restrictions apply to this calendar. \x3ca class\x3d\x22share-restrictions-link\x22 href\x3d\x22#\x22\x3eCheck restrictions.\x3c/a\x3e') + '</div></div>';
};
if (goog.DEBUG) {
  Confluence.TeamCalendars.Templates.shareSubCalendar.soyTemplateName = 'Confluence.TeamCalendars.Templates.shareSubCalendar';
}

}catch(e){WRMCB(e)};
;
try {
/* module-key = 'com.atlassian.confluence.extra.team-calendars:calendar-ical-address', location = 'com/atlassian/confluence/extra/calendar3/components/calendar-reset-url-dialog/calendar-reset-url-dialog.js' */
define("tc/calendar-reset-url-dialog",["jquery","underscore","tc-backbone","tc/templates","tc/calendar-util","tc/util"],function(e,b,g,d,c,f){var a=g.View.extend({resetUrlSubCalendarDialog:null,calendarDiv:null,subCalendar:null,calendarPlugin:null,initialize:function(h){this.calendarDiv=h.calendarDiv;this.subCalendar=h.subCalendar;this.calendarPlugin=h.calendarPlugin;this.resetUrlSubCalendarDialog=e("#calendar-reset-private-urls-dialog")},render:function(){var k=this;if(this.resetUrlSubCalendarDialog){this.resetUrlSubCalendarDialog.remove()}var h=new AJS.Dialog({width:512,height:235,id:"calendar-reset-private-urls-dialog"}),i=function(){h.hide();h.remove()};h.addHeader("Reset Subscription");h.addPanel("",d.resetSubCalendarPrivateUrl(),"calendar-private-url-reset-dialog-panel");var j=h.getCurrentPanel().body;h.addButton("Reset",function(){var l=k.calendarPlugin.setSubCalendarSpinnerIconVisible(true);var n=e(".reset-progress",j).addClass("reset-in-progress");var m=e("#calendar-reset-private-urls-dialog .subcalendar-private-url-reset-button").attr("disabled","disabled");e.ajax({cache:false,success:function(){n.removeClass("reset-in-progress").addClass("reset-done");e("#calendar-reset-private-urls-dialog .reset-cancel").text("Close");m.removeAttr("disabled")},type:"PUT",timeout:c.ajaxTimeout,url:k.calendarPlugin.getCalendarServiceBaseUrl(k.calendarDiv,"/subcalendar/privateurl/reset/"+encodeURIComponent(k.subCalendar.id)),error:function(o,q,p){m.removeAttr("disabled");c.showAjaxError(k.calendarDiv,o,q,p,k.calendarPlugin.ERROR_CLASS_RESET_PRIVATE_URLS)},complete:function(){if(l){l.resolve()}}})},"subcalendar-private-url-reset-button");h.addLink("Cancel",function(){i();return false},"reset-cancel");e(".calendar-title",j).text(k.subCalendar.name);e(".subscribe-to-calendar",j).click(function(){i();this.calendarPlugin.getSubCalendarIcalAddressDialog(k.calendarDiv,k.subCalendar).show();return false});h.show();return h}});return a});
}catch(e){WRMCB(e)};
;
try {
/* module-key = 'com.atlassian.confluence.extra.team-calendars:calendar-ical-address', location = 'com/atlassian/confluence/extra/calendar3/components/calendar-ical-address-dialog/subcalendar-privateurl-subscribe-dialog.soy' */
// This file was automatically generated from subcalendar-privateurl-subscribe-dialog.soy.
// Please don't edit this file by hand.

/**
 * @fileoverview Templates in namespace Confluence.TeamCalendars.Templates.
 */

if (typeof Confluence == 'undefined') { var Confluence = {}; }
if (typeof Confluence.TeamCalendars == 'undefined') { Confluence.TeamCalendars = {}; }
if (typeof Confluence.TeamCalendars.Templates == 'undefined') { Confluence.TeamCalendars.Templates = {}; }


Confluence.TeamCalendars.Templates.subCalendarPrivateUrlSubscribe = function(opt_data, opt_ignored) {
  return '<p>' + soy.$$filterNoAutoescape(AJS.format('Add to Outlook, iCal or other calendar applications by copying the link below and following the \x3ca href\x3d\x22{0}\x22 target\x3d\x22_blank\x22\x3einstructions\x3c/a\x3e.','http://confluence.atlassian.com/x/_wJKE')) + '</p><input type="text" name="ical-address" id="ical-address-' + soy.$$escapeHtml(opt_data.elementIdSuffix) + '" class="ical-address-field"><div class="subscribe-or">' + soy.$$escapeHtml('OR') + '</div><a class="subscribe-google-calendar" href="#" target="_blank"></a><p class="private-url-warning">' + soy.$$filterNoAutoescape('Note: This subscription link is private. If you\x27ve accidentally shared your subscription link, \x3cb\x3e\x3ca href\x3d\x22#\x22 class\x3d\x22reset-subscription-url\x22\x3eyou should reset it\x3c/a\x3e\x3c/b\x3e.') + '</p>';
};
if (goog.DEBUG) {
  Confluence.TeamCalendars.Templates.subCalendarPrivateUrlSubscribe.soyTemplateName = 'Confluence.TeamCalendars.Templates.subCalendarPrivateUrlSubscribe';
}

}catch(e){WRMCB(e)};
;
try {
/* module-key = 'com.atlassian.confluence.extra.team-calendars:calendar-ical-address', location = 'com/atlassian/confluence/extra/calendar3/components/calendar-basic-auth-ical-address-dialog/calendar-basic-auth-ical-address-dialog.js' */
define("tc/calendar-basic-auth-ical-address-dialog",["jquery","underscore","tc-backbone","tc/templates","tc/calendar-util","tc/util"],function(e,b,g,d,c,f){var a=g.View.extend({calendarBasicAuthIcalAddressDialog:null,calendarDiv:null,subCalendar:null,calendarPlugin:null,editDialog:null,$icalAddressField:null,initialize:function(h){this.calendarDiv=h.calendarDiv;this.subCalendar=h.subCalendar;this.calendarPlugin=h.calendarPlugin;this.editDialog=h.editDialog;this.$el=h.el;this.$el.html(d.subCalendarBasicAuthSubscribe({elementIdSuffix:c.getParameter(this.calendarDiv,"elementIdSuffix")}))},render:function(){var h=this;h.$icalAddressField=e(".ical-address-basic-field",this.$el);h.$icalAddressField.val(c.getParameter(h.calendarDiv,"baseUrl")+"/rest/calendar-services/1.0/calendar/export/subcalendar/"+encodeURIComponent(h.subCalendar.id)+".ics?os_authType=basic&isSubscribe=true")}});return a});
}catch(e){WRMCB(e)};
;
try {
/* module-key = 'com.atlassian.confluence.extra.team-calendars:calendar-ical-address', location = 'com/atlassian/confluence/extra/calendar3/components/calendar-basic-auth-ical-address-dialog/subcalendar-basic-subscribe-dialog.soy' */
// This file was automatically generated from subcalendar-basic-subscribe-dialog.soy.
// Please don't edit this file by hand.

/**
 * @fileoverview Templates in namespace Confluence.TeamCalendars.Templates.
 */

if (typeof Confluence == 'undefined') { var Confluence = {}; }
if (typeof Confluence.TeamCalendars == 'undefined') { Confluence.TeamCalendars = {}; }
if (typeof Confluence.TeamCalendars.Templates == 'undefined') { Confluence.TeamCalendars.Templates = {}; }


Confluence.TeamCalendars.Templates.subCalendarBasicAuthSubscribe = function(opt_data, opt_ignored) {
  return '<div><label for="ical-address-' + soy.$$escapeHtml(opt_data.elementIdSuffix) + '" class="ical-address-label">' + soy.$$escapeHtml('Calendar Address:') + '</label><input type="text" name="ical-address" id="ical-address-' + soy.$$escapeHtml(opt_data.elementIdSuffix) + '" class="ical-address-basic-field"></div><p>' + soy.$$filterNoAutoescape(AJS.format('You can subscribe to this Confluence calendar from your calendar application. Copy the calendar address above and \x3ca href\x3d\x22{0}\x22 target\x3d\x22_blank\x22\x3efollow the instructions for the calendar application you wish to use\x3c/a\x3e.','http://confluence.atlassian.com/x/ewn2Dg')) + '</p>';
};
if (goog.DEBUG) {
  Confluence.TeamCalendars.Templates.subCalendarBasicAuthSubscribe.soyTemplateName = 'Confluence.TeamCalendars.Templates.subCalendarBasicAuthSubscribe';
}

}catch(e){WRMCB(e)};
;
try {
/* module-key = 'com.atlassian.confluence.extra.team-calendars:calendar-ical-address', location = 'com/atlassian/confluence/extra/calendar3/components/calendar-ical-address-dialog/calendar-ical-address-dialog.js' */
define("tc/calendar-ical-address-dialog",["jquery","underscore","tc-backbone","tc/templates","tc/calendar-util","tc/util","tc/calendar-reset-url-dialog","tc/calendar-basic-auth-ical-address-dialog"],function(b,g,f,i,d,e,a,h){var c=f.View.extend({calendarDiv:null,subCalendar:null,calendarPlugin:null,editDialog:null,$icalAddressField:null,initialize:function(j){this.calendarDiv=j.calendarDiv;this.subCalendar=j.subCalendar;this.calendarPlugin=j.calendarPlugin;this.editDialog=j.editDialog;this.$el.html(i.subCalendarPrivateUrlSubscribe({elementIdSuffix:d.getParameter(this.calendarDiv,"elementIdSuffix")}));this.editDialog.addPanel("Subscribe",this.$el,"calendar-ical-subscription-dialog-panel")},render:function(){var j=this;var k=j.calendarPlugin.getParameter(j.calendarDiv,"privateUrlsEnabled")==="true";if(k){j._renderPrivateUrlSubscription()}else{j._renderBasicUrlSubscription()}this.editDialog.getCurrentPanel().onselect=function(){b("#edit-calendar-dialog").find(".button-panel-button.submit").addClass("hidden");j.focusToIcalField()};return this.editDialog},_renderBasicUrlSubscription:function(){var j=new h({editDialog:this.editDialog,subCalendar:this.subCalendar,calendarPlugin:this.calendarPlugin,calendarDiv:this.calendarDiv,el:this.$el});j.render();this.$icalAddressField=j.$icalAddressField},_renderPrivateUrlSubscription:function(){var n=this;var j=n.calendarPlugin.isHttpsServer(n.calendarDiv),l=function(){n.editDialog.hide();n.editDialog.remove()};var k=this.$el;n.$icalAddressField=b(".ical-address-field",k);b(".reset-subscription-url",k).click(function(){l();var o=new a({calendarPlugin:n.calendarPlugin,calendarDiv:n.calendarDiv,subCalendar:n.subCalendar});o.render();return false});if(!j){b(".subscribe-or",k).remove();b(".subscribe-google-calendar",k).remove()}var m=n.calendarPlugin.setSubCalendarSpinnerIconVisible(true);b.ajax({cache:false,success:function(o){b(".ical-address-field",k).val(o).focus().select();if(j){b("a.subscribe-google-calendar",k).attr({href:"https://www.google.com/calendar/render?cid="+encodeURIComponent(o),title:AJS.format("Subscribe to {0} from Google Calendar",n.subCalendar.name)})}},error:function(o,q,p){n.calendarPlugin.showAjaxError(n.calendarDiv,o,q,p,n.calendarPlugin.ERROR_CLASS_PRIVATE_URL)},complete:function(){if(m){m.resolve()}},type:"GET",timeout:d.ajaxTimeout,url:n.calendarPlugin.getCalendarServiceBaseUrl(n.calendarDiv,"/subcalendar/privateurl/"+encodeURIComponent(n.subCalendar.id))})},focusToIcalField:function(){this.$icalAddressField.focus().select()}});return c});
}catch(e){WRMCB(e)};
;
try {
/* module-key = 'com.atlassian.confluence.extra.team-calendars:calendar-edit', location = 'com/atlassian/confluence/extra/calendar3/components/calendar-restriction-dialog/calendar-restrictons-dialog.js' */
define("tc/calendar-restriction-dialog",["jquery","underscore","tc-backbone","tc/templates","tc/calendar-util"],function(e,a,f,c,b){var d=f.View.extend({restrictionDialog:null,calendarDiv:null,subCalendar:null,calendarPlugin:null,calendarCache:null,editDialog:null,initialize:function(g){this.calendarDiv=g.calendarDiv;this.subCalendar=g.subCalendar;this.calendarPlugin=g.calendarPlugin;this.calendarCache=g.calendarCache;this.editDialog=g.editDialog;this.$el.html(c.restrictSubCalendar({elementIdSuffix:this.calendarPlugin.getParameter(this.calendarDiv,"elementIdSuffix"),pdlEnabled:b.isPDLEnabled()}));this.editDialog.addPanel("Restrictions",this.$el,"setup-calendar-panel")},render:function(){var h=this;this.editDialog.getCurrentPanel().onselect=function(){e("#edit-calendar-dialog").find(".button-panel-button.submit").removeClass("hidden")};var g=e("form",h.editDialog.getCurrentPanel().body);e("input[name='subCalendarId']",g).val(h.subCalendar.id||"");e(".field-group-permissions",g).each(function(){var i=e(this);e(".permissions-details",i).each(function(k){var l=e(this);var j=e(".autocomplete-user",i);j.bind("selected.autocomplete-user",function(n,m){h._addUsersToPermissionFieldGroup(i,{id:m.content.userKey||m.content.username,name:m.content.username,fullName:m.content.title,avatarUrl:m.content.thumbnailLink.href},true);j.val("")}).focus(function(){if(j.hasClass("with-hint")){j.removeClass("with-hint").val("")}}).blur(function(){if(!j.val()){j.addClass("with-hint").val("Enter user name")}}).keydown(function(m){if(m.keyCode===13&&!e(".autocomplete .aui-dropdown .active").length){setTimeout(function(){var n=j.val();if(n){h._addGroupsToPermissionFieldGroup(i,n.split(","),true,true);j.val("")}else{h.submitRestrictionsDialog(h.editDialog)}},300);e(".autocomplete .aui-dropdown .no-results").trigger("click");return false}});e(".group-picker-trigger",l).click(function(){var m="Team_Calendars_group_picker_callback_"+h.calendarPlugin.getParameter(h.calendarDiv,"elementIdSuffix")+"_"+k;window[m]=function(n){h._addGroupsToPermissionFieldGroup(i,n.split(","),false,true)};window.open(h.calendarPlugin.getParameter(h.calendarDiv,"baseUrl")+"/spaces/opengrouppicker.action?key=ds&startIndex=0&actionName=dosearchgroups.action&onPopupSubmit="+encodeURIComponent(m),m,"dependent=1,height=512,width=384,resizable=1,status=0").focus();return false})})});e(".field-group-permissions",g).each(function(){var j=e(this);var k=e(".option-view-restrictions",j);var i=e(".option-edit-restrictions",j);h._addUsersToPermissionFieldGroup(j,h.subCalendar.usersPermittedToEdit||[]);h._addGroupsToPermissionFieldGroup(j,h.subCalendar.groupsPermittedToEdit||[]);i.removeAttr("checked");k.attr("checked","checked");h._addUsersToPermissionFieldGroup(j,h.subCalendar.usersPermittedToView||[]);h._addGroupsToPermissionFieldGroup(j,h.subCalendar.groupsPermittedToView||[])});return h.editDialog},submitRestrictionsDialog:function(k){var l=this;var o=e("form",k.getCurrentPanel().body);var j=function(p){return e.map(e(".permitted-entity",p),function(r){var q=e(r).data("entity");return e.isPlainObject(q)?q.id:null})};var i=function(p){return e.map(e(".permitted-entity",p),function(r){var q=e(r).data("entity");return typeof q==="string"?q:null})};var h={subCalendarId:e("input[name='subCalendarId']",o).val()};b.putCalendarContextParams(h);var m=e(".view-permissions",o);if(m.length){h.updateUsersPermittedToView=true;h.usersPermittedToView=j(m);if(!h.usersPermittedToView.length){delete h.usersPermittedToView}h.updateGroupsPermittedToView=true;h.groupsPermittedToView=i(m);if(!h.groupsPermittedToView.length){delete h.groupsPermittedToView}}var n=e(".edit-permissions",o);if(n.length){h.updateUsersPermittedToEdit=true;h.usersPermittedToEdit=j(n);if(!h.usersPermittedToEdit.length){delete h.usersPermittedToEdit}h.updateGroupsPermittedToEdit=true;h.groupsPermittedToEdit=i(n);if(!h.groupsPermittedToEdit.length){delete h.groupsPermittedToEdit}}if(l.calendarPlugin.getParameter(l.calendarDiv,"include")){h.include=l.calendarPlugin.getParameter(l.calendarDiv,"include")}if(!l.calendarPlugin.isProcessingSubCalendar(l.calendarDiv)){var g=l.calendarPlugin.setSubCalendarSpinnerIconVisible(true);e.ajax({cache:false,converters:{"text json":function(p){return p}},data:h,dataType:"json",dataFilter:function(p){var q=e.parseJSON(p);if(q.success){l.calendarPlugin.mergeSubCalendarObjectsToArray(q.payload)}return q},error:function(p,r,q){l.calendarPlugin.showAjaxError(l.calendarDiv,p,r,q,l.calendarPlugin.ERROR_CLASS_SUB_CALENDAR_UPDATE);l.calendarPlugin.setProcessingSubCalendar(l.calendarDiv,false)},success:function(p){l.calendarCache.removeCalendar(l.subCalendar.id);l.calendarPlugin.setGenericErrors(l.calendarDiv,null,l.calendarPlugin.ERROR_CLASS_SUB_CALENDAR_UPDATE);l.calendarPlugin.setSubCalendars(l.calendarDiv,p.payload);l.calendarPlugin.updateAvailableSubCalendarsInSubCalendarPanel(l.calendarDiv);l.calendarPlugin.setProcessingSubCalendar(l.calendarDiv,false);k.hide()},complete:function(){if(g){g.resolve()}},type:"PUT",timeout:l.calendarPlugin.ajaxTimeout,url:l.calendarPlugin.getCalendarServiceBaseUrl(l.calendarDiv,"/subcalendars/restrictions.json")})}return false},_showHideHint:function(h){var g=e(".permission-table",h);var i=e(".permitted-entities",g);if(e(".permitted-entity",i).length){h.addClass("has-restrictions");g.removeClass("hidden")}else{h.removeClass("has-restrictions");g.addClass("hidden")}},_getRestrictionGroup:function(g){return e("input[name='restriction-type']:checked",g).val()==="view"?e(".view-permissions",g):e(".edit-permissions",g)},_addUsersToPermissionFieldGroup:function(l,n,h){var g=this;var j=g._getRestrictionGroup(l);var k=e(".permitted-entities",j);var m=function(o){return e(".permitted-entity",k).filter(function(){var p=e(this).data("entity");return e.isPlainObject(p)&&p.id===o.id}).length};var i;if(e.isPlainObject(n)){i=[n]}else{if(e.isArray(n)){i=n}}if(e.isArray(i)){e.each(i,function(p,o){if(!m(o)){var q=e(document.createElement("tr")).addClass("permitted-entity").append(e(document.createElement("td")).append(e(document.createElement("img")).attr("src",o.avatarUrl)).append(e(document.createElement("span")).text(o.fullName).append(e(document.createElement("span")).addClass("user-name").text("("+o.name+")")))).append(e(document.createElement("td")).addClass("delete-permitted-entity").append(e(document.createElement("a")).addClass("remove").attr("href","#").attr("title","Delete").text("Delete").click(function(){e(this).closest("tr").remove();g._showHideHint(j);return false}))).data("entity",o);if(h){q.prependTo(k)}else{k.append(q)}}});e(".error",l).empty()}g._showHideHint(j)},_addGroupsToPermissionFieldGroup:function(j,s,o,k){var m=this;var h=m._getRestrictionGroup(j),n=e(".permitted-entities",h),p=function(t){return e(".permitted-entity",n).filter(function(){var u=e(this).data("entity");return(typeof u==="string")&&u===t}).length},r=function(t){if(Confluence.TeamCalendars.isPDLEnabled()){return e("<td/>").append(e("<span/>",{"class":"group",text:t}))}else{return e("<td/>").append(e("<img/>",{src:Confluence.getBaseUrl()+"/images/icons/group_16.gif"})).append(e("<span/>",{text:t}))}};if(s.length){var g=function(t){e.each(t,function(u,w){w=e.trim(w);if(w&&!p(w)){var v=e(document.createElement("tr")).addClass("permitted-entity").append(r(w)).append(e(document.createElement("td")).addClass("delete-permitted-entity").append(e(document.createElement("a")).addClass("remove").attr("href","#").attr("title","Delete").text("Delete").click(function(){e(this).closest("tr").remove();m._showHideHint(h);return false}))).data("entity",w);if(k){v.prependTo(n)}else{n.append(v)}}})};var i=e(".error",j);if(o){var l;var q;e.ajax({cache:false,data:{groupNames:e.map(s,function(t){return e.trim(t)})},dataType:"json",success:function(t){l=t;q=e.map(s,function(u){return e.inArray(e.trim(u),l)===-1?e.trim(u):null});g(l);i.empty();if(q.length){i.text(AJS.format("Invalid group names(s) specified: {0}",q.join(", ")))}m._showHideHint(h)},type:"GET",timeout:m.calendarPlugin.ajaxTimeout,url:m.calendarPlugin.getCalendarServiceBaseUrl(m.calendarDiv,"/util/validate/group.json")})}else{i.empty();g(s);m._showHideHint(h)}}}});return d});
}catch(e){WRMCB(e)};
;
try {
/* module-key = 'com.atlassian.confluence.extra.team-calendars:calendar-edit', location = 'com/atlassian/confluence/extra/calendar3/components/calendar-edit-dialog/calendar-edit-dialog.js' */
define("tc/calendar-edit-dialog",["jquery","underscore","tc-backbone","tc/calendar-util","tc/util","tc/myCalendarTour","tc/eventtypes-edit-dialog","tc/calendar-restriction-dialog","tc/calendar-share-dialog","tc/calendar-ical-address-dialog"],function(d,k,j,g,i,h,b,f,a,e){var c=j.View.extend({subCalendarType:null,editForm:null,subCalendarTypeObj:null,editDialog:null,subCalendar:null,callbackHandler:null,submitButton:null,eventTypesEditDialogView:null,shareCalendarDialogView:null,calendarIcalAddressDialog:null,calendarDiv:null,calendarPlugin:null,calendarCache:null,restrictionDialog:null,initialize:function(l){this.options=d.extend({},this.defaults,l);if(!this.options.subCalendar){AJS.debug("tc/eventtypes-edit-dialog: requires 'subCalendar' object")}if(!this.options.callbackHandler){AJS.debug("tc/eventtypes-edit-dialog: requires 'callbackHandler' object")}this.callbackHandler=this.options.callbackHandler;this.subCalendar=this.options.subCalendar;this.subCalendarType=(typeof this.subCalendar==="string")?this.subCalendar:this.subCalendar.type;this.subCalendarTypeObj=Confluence.TeamCalendars.subcalendar[this.subCalendarType];this.calendarDiv=l.calendarDiv;this.calendarPlugin=l.calendarPlugin;this.calendarCache=l.calendarCache},render:function(){this._editCalendarDialog();if(g.isInternalSubscriptionSubCalendar(this.subCalendar)&&g.isJiraSubCalendar(this.subCalendar)){return this.editDialog}this.eventTypesEditDialogView=new b({editDialog:this.editDialog,subCalendar:this.subCalendar,callbackHandler:this.callbackHandler});this.eventTypesEditDialogView.render();this.restrictionDialog=new f({editDialog:this.editDialog,calendarPlugin:this.calendarPlugin,calendarDiv:this.calendarDiv,subCalendar:this.subCalendar,calendarCache:this.calendarCache});this.restrictionDialog.render();this.shareCalendarDialogView=new a({editDialog:this.editDialog,subCalendar:this.subCalendar,calendarPlugin:this.calendarPlugin,calendarDiv:this.calendarDiv});this.shareCalendarDialogView.render();this.calendarIcalAddressDialog=new e({editDialog:this.editDialog,subCalendar:this.subCalendar,calendarPlugin:this.calendarPlugin,calendarDiv:this.calendarDiv});this.calendarIcalAddressDialog.render();return this.editDialog},showRestrictionOption:function(){this.editDialog.gotoPanel(g.panelEditCalendar.RESTRICTION_PANEL)},showShareOption:function(){this.editDialog.gotoPanel(g.panelEditCalendar.SHARE_EMBEDDED_PANEL)},showSubscriptionOption:function(){this.editDialog.gotoPanel(g.panelEditCalendar.SUBSCRIBE_PANEL)},selectCustomEvent:function(l){this.editDialog.gotoPanel(g.panelEditCalendar.EVENT_TYPE_PANEL);this.eventTypesEditDialogView.selectCustomEvent(l)},showAddEventTypeForm:function(){this.editDialog.gotoPanel(g.panelEditCalendar.EVENT_TYPE_PANEL);this.eventTypesEditDialogView.showAddEventypeForm()},_editCalendarDialog:function(){var l=this;l.editDialog=new AJS.ConfluenceDialog({width:l.subCalendarTypeObj.dialogWidth||630,height:l.subCalendarTypeObj.dialogHeight||537,onSubmit:function(){l.editForm.submit();return false},onCancel:function(){l._callBackCancel(l.editDialog,l.callbackHandler);l.editDialog.remove()},id:"edit-calendar-dialog"});l.subCalendarTypeHandler=l.subCalendarTypeObj.getDialog(l.editDialog,d.isPlainObject(l.subCalendar)?l.subCalendar:null,l.callbackHandler);l.editDialog.popup.element.css("overflow","visible");l.editForm=l.subCalendarTypeHandler.initializeForm(k.bind(l._callBackCancel,l,l.editDialog,l.callbackHandler));l.submitButton=l.editDialog.popup.element.find(".submit");l.editForm.submit(function(){if(l.editDialog.getCurrentPanel()!==undefined){if(l.editDialog.getCurrentPanel().id===g.panelEditCalendar.GENERAL_PANEL){return l._submitCalendarEdit(l.callbackHandler,l.subCalendarTypeHandler,l.editDialog,l.editForm,l.subCalendarTypeObj)}else{if(l.editDialog.getCurrentPanel().id===g.panelEditCalendar.EVENT_TYPE_PANEL){var o=l.editDialog.getCurrentPanel().body;var n=d("form.sub-calendar-edit-event-types-form",o);var m=d("#edit-custom-event-type-form",n);if(d(m).length){d(m).find(".tooltip-warning").removeClass("hidden");d(o).scrollTop(d(m).find("form.form-add-custom").position().top);d(m).find(".custom-event-title input").focus();return false}return l._submitEventTypesEdit(n,l.editDialog,l.callbackHandler,l.subCalendarTypeHandler,l.submitButton)}else{if(l.editDialog.getCurrentPanel().id===g.panelEditCalendar.RESTRICTION_PANEL){return l._submitRestrictionEdit(l.editDialog)}}}}})},_submitCalendarEdit:function(n,o,r,t,w){if(n.isProcessingSubCalendar()){return false}n.setProcessingSubCalendar(true);var l=n.setSubCalendarSpinnerIconVisible(true);o.onSubmitStart();var p=o.getFormDataAsAjaxData();if(n.getIncludedCalendars()){p.include=n.getIncludedCalendars()}var q=p.subCalendarId;var y=p.spaceKey;var s=p.viewingSpaceKey;var v=this.subCalendar.spaceKey;var m=this.calendarPlugin;var x=this.calendarDiv;var u=this.subCalendar.childSubCalendars;d.ajax({cache:false,converters:{"text json":function(z){return z}},data:p,dataFilter:function(z){var A=d.parseJSON(z);if(A.success){g.mergeSubCalendarObjectsToArray(A.payload)}return A},dataType:"json",error:function(z,B,A){n.showAjaxUpdateError(z,B,A);o.onSubmitEnd();n.setProcessingSubCalendar(false)},success:function(z){n.setGenericUpdateError();if(z.success){g.setFieldErrors(t,null);if((y!==v)&&(s!=="")){q=z.modifiedSubCalendarId;d("input[name='subCalendarId']",t).val(q);m.removeSubCalendarEventSource(x,q);m.removeSubCalendarEventSource(x,u);n.setSubCalendars(q,z.payload)}else{if(q){n.setSubCalendars(q,z.payload);n.reloadSubCalendar(q)}else{q=z.modifiedSubCalendarId;d("input[name='subCalendarId']",t).val(q);n.setSubCalendars(q,z.payload)}}n.refreshCalendarInfo(z.payload);n.updateAvailableSubCalendarsInSubCalendarPanel();o.onSubmitEnd();r.remove()}else{g.setFieldErrors(t,z.fieldErrors);o.onSubmitEnd();if(!w.dynamicDialogHeight){i.showDialogInUpdatedHeight(r)}}n.setProcessingSubCalendar(false)},complete:function(){if(l){l.resolve()}},type:"PUT",timeout:g.ajaxTimeout,url:g.getCalendarServiceBaseUrl("/subcalendars.json")});return false},_submitEventTypesEdit:function(m,r,p,l,q){var o=this._getEventTypeData(m);var s=o.subCalendarId;var n=p.setSubCalendarSpinnerIconVisible(true);d(q).text("Updating...").attr("disabled","disabled").addClass("ui-state-disabled");d.ajax({cache:false,converters:{"text json":function(t){return t}},data:o,dataFilter:function(t){var u=d.parseJSON(t);if(u.success){g.mergeSubCalendarObjectsToArray(u.payload)}return u},dataType:"json",error:function(t,v,u){p.showAjaxUpdateError(t,v,u);l.onSubmitEnd();d(q).text("OK").removeAttr("disabled").removeClass("ui-state-disabled");AJS.trigger("remove-dialog-edit-event.teamcalendar")},success:function(t){if(t.success){if(s){p.setSubCalendar(s,t.payload);p.reloadSubCalendar(s)}p.updateAvailableSubCalendarsInSubCalendarPanel();l.onSubmitEnd();r.remove();AJS.trigger("show-dialog-edit-event.teamcalendar")}},complete:function(){if(n){n.resolve()}},type:"PUT",timeout:g.ajaxTimeout,url:g.getCalendarServiceBaseUrl("/eventtype/disable.json")});return false},_getEventTypeData:function(l){var m=this.eventTypesEditDialogView.getDisableEventTypes();return{subCalendarId:d("input[name='subCalendarId']",l).val(),disableEventTypes:m}},_callBackCancel:function(n,m){if(this.CalendarTour){this.CalendarTour.start()}var l=m.setSubCalendarSpinnerIconVisible(true);var o=d("input[name='subCalendarId']",n.getCurrentPanel().body).val();d.ajax({cache:false,converters:{"text json":function(p){return p}},data:{subCalendarId:o},dataFilter:function(p){var q=d.parseJSON(p);if(q.success){g.mergeSubCalendarObjectsToArray(q.payload)}return q},dataType:"json",error:function(p,r,q){m.showAjaxUpdateError(p,r,q)},success:function(p){if(p.success){if(o&&p.payload&&p.payload.length){d.each(p.payload,function(q,r){if(r.id===o){m.setSubCalendar(o,r);m.reloadSubCalendar(o)}})}m.updateAvailableSubCalendarsInSubCalendarPanel();AJS.trigger("show-dialog-edit-event.teamcalendar")}},complete:function(){l.resolve()},type:"GET",timeout:g.ajaxTimeout,url:g.getCalendarServiceBaseUrl("/subcalendars.json")})},_submitRestrictionEdit:function(l){this.restrictionDialog.submitRestrictionsDialog(l);return false}});return c});
}catch(e){WRMCB(e)};
;
try {
/* module-key = 'com.atlassian.confluence.extra.team-calendars:calendar-edit', location = 'com/atlassian/confluence/extra/calendar3/components/calendar-edit-dialog/calendar-edit-dialog-compat.js' */
require(["tc/calendar-edit-dialog"],function(a){if(!Confluence.TeamCalendars.Dialogs){Confluence.TeamCalendars.Dialogs={}}Confluence.TeamCalendars.Dialogs.getSubCalendarEditDialog=function(d,c,f,e,b){return new a({subCalendar:d,callbackHandler:c,calendarDiv:f,calendarPlugin:e,calendarCache:b})}});
}catch(e){WRMCB(e)};
;
try {
/* module-key = 'com.atlassian.confluence.extra.team-calendars:calendar-add-dialog', location = 'com/atlassian/confluence/extra/calendar3/components/calendar-add-dialog/calendar-add-dialog.js' */
define("tc/calendar-add-dialog",["jquery","tc-backbone","tc/templates","tc/dialogs","tc/util","tc/calendar-util"],function(f,h,e,d,g,c){var b;var a=h.View.extend({events:{"click .option-new":"addNewCalendar","click .option-existing":"addExistingCalendar","click .option-subscription":"subscribeByUrl","click .option-import":"importCalendar"},defaults:{title:"Add Calendar"},initialize:function(i){i=i||{};this.callbackHandler=i.callbackHandler;this.dialogOptions=f.extend({},this.defaults,i.dialogOptions)},hide:function(){b.hide()},render:function(){if(!b){b=this.dialog=new AJS.Dialog(600,320,"add-calendar-dialog");b.addHeader(this.dialogOptions.title);b.addPanel(this.dialogOptions.title,e.addDialog(),"add-calendar-panel");if(this.dialogOptions.addClass){f("#add-calendar-dialog").addClass(this.dialogOptions.addClass)}b.addCancel("Cancel",function(){b.hide();return false});this.setElement(b.getCurPanel().body)}b.show()},addNewCalendar:function(){var i=d.getSubCalendarCreateDialog("parent",this.callbackHandler);g.showDialogInUpdatedHeight(i);f("input[name='name']",i.getCurrentPanel().body).focus();c.fireEventForAnalytics("add.calendar.click.new."+c.getCalendarContext());this.hide()},addExistingCalendar:function(){var i=f("meta[name='ajs-page-id']").length>=1;var j=d.getSubCalendarSubscribeDialog(f.extend({callbackHandler:this.callbackHandler,heading:i?"Add Existing Team Calendar":"Popular Team Calendars",showSearch:i,searchParams:{showSubCalendarsInView:AJS.Meta.get("space-key")!==undefined||i},disableWatching:i,id:"internal-subscription-calendar-dialog"}));g.showDialogInUpdatedHeight(j);c.fireEventForAnalytics("add.calendar.click.existing."+c.getCalendarContext());this.hide()},subscribeByUrl:function(){var i=d.getSubCalendarCreateDialog("subscription",this.callbackHandler);g.showDialogInUpdatedHeight(i);f("input[name='name']",i.getCurrentPanel().body).focus();c.fireEventForAnalytics("add.calendar.click.subscribe."+c.getCalendarContext());this.hide()},importCalendar:function(){var i=d.getSubCalendarImportDialog(this.callbackHandler);g.showDialogInUpdatedHeight(i);f("input[name='name']",i.getCurrentPanel()).focus();c.fireEventForAnalytics("add.calendar.click.import."+c.getCalendarContext());this.hide()}});return a});
}catch(e){WRMCB(e)};
;
try {
/* module-key = 'com.atlassian.confluence.extra.team-calendars:calendar-add-dialog', location = 'com/atlassian/confluence/extra/calendar3/components/calendar-add-dialog/calendar-add-dialog-compat.js' */
require(["tc/calendar-add-dialog"],function(a){if(!Confluence.TeamCalendars.Dialogs){Confluence.TeamCalendars.Dialogs={}}Confluence.TeamCalendars.Dialogs.getAddDialog=function(b,c){return new a({callbackHandler:b,dialogOptions:c}).render()}});
}catch(e){WRMCB(e)};
;
try {
/* module-key = 'com.atlassian.confluence.extra.team-calendars:calendar-add-dialog', location = 'com/atlassian/confluence/extra/calendar3/components/calendar-add-dialog/calendar-add-dialog.soy' */
// This file was automatically generated from calendar-add-dialog.soy.
// Please don't edit this file by hand.

/**
 * @fileoverview Templates in namespace Confluence.TeamCalendars.Templates.
 */

if (typeof Confluence == 'undefined') { var Confluence = {}; }
if (typeof Confluence.TeamCalendars == 'undefined') { Confluence.TeamCalendars = {}; }
if (typeof Confluence.TeamCalendars.Templates == 'undefined') { Confluence.TeamCalendars.Templates = {}; }


Confluence.TeamCalendars.Templates.addDialog = function(opt_data, opt_ignored) {
  return '<div class="add-calendar subcalendar-wizard"><div><ul class="add-calendar-options"><li class="option-new"><div class="title">' + soy.$$escapeHtml('Add New Calendar') + '</div></li><li class="option-import"><div class="title">' + soy.$$escapeHtml('Import Calendar') + '</div></li></ul><ul class="add-calendar-options"><li class="option-existing"><div class="title">' + soy.$$escapeHtml('Add Existing Calendar') + '</div></li><li class="option-subscription"><div class="title">' + soy.$$escapeHtml('Subscribe by URL') + '</div></li></ul></div></div>';
};
if (goog.DEBUG) {
  Confluence.TeamCalendars.Templates.addDialog.soyTemplateName = 'Confluence.TeamCalendars.Templates.addDialog';
}

}catch(e){WRMCB(e)};
;
try {
/* module-key = 'com.atlassian.confluence.extra.team-calendars:calendar-add-inline-dialog', location = 'com/atlassian/confluence/extra/calendar3/components/calendar-add-inline-dialog/calendar-add-inline-dialog.js' */
define("tc/calendar-add-inline-dialog",["jquery","tc-backbone","tc/templates","tc/dialogs","tc/util"],function(d,f,b,a,e){var c=f.View.extend({initialize:function(g){g=g||{};this.callbackHandler=g.callbackHandler},hide:function(){this.dialog.hide()},render:function(){var g=this.callbackHandler;if(!this.dialog){this.dialog=AJS.InlineDialog(d("#inline-dialog-more"),"inline-dialog-more",function(i,h,j){i.html(b.addInlineDialog());i.find(".option-new").on("click",function(){var k=a.getSubCalendarCreateDialog("parent",g);e.showDialogInUpdatedHeight(k);d("input[name='name']",k.getCurrentPanel().body).focus();d("#inline-dialog-more").removeClass("active");d("#inline-dialog-inline-dialog-more").hide();Confluence.TeamCalendars.fireEventForAnalytics("add.calendar.click.new."+Confluence.TeamCalendars.getCalendarContext())});i.find(".option-import").on("click",function(){var k=a.getSubCalendarImportDialog(g);e.showDialogInUpdatedHeight(k);d("input[name='name']",k.getCurrentPanel()).focus();d("#inline-dialog-more").removeClass("active");d("#inline-dialog-inline-dialog-more").hide();Confluence.TeamCalendars.fireEventForAnalytics("add.calendar.click.import."+Confluence.TeamCalendars.getCalendarContext())});i.find(".option-existing").on("click",function(){var k=d("meta[name='ajs-page-id']").length>=1;var l=a.getSubCalendarSubscribeDialog(d.extend({callbackHandler:g,heading:k?"Add Existing Team Calendar":"Popular Team Calendars",showSearch:k,searchParams:{showSubCalendarsInView:AJS.Meta.get("space-key")!==undefined||k},disableWatching:k,id:"internal-subscription-calendar-dialog"}));e.showDialogInUpdatedHeight(l);d("#inline-dialog-more").removeClass("active");d("#inline-dialog-inline-dialog-more").hide();Confluence.TeamCalendars.fireEventForAnalytics("add.calendar.click.existing."+Confluence.TeamCalendars.getCalendarContext())});i.find(".option-subscription").on("click",function(){var k=a.getSubCalendarCreateDialog("subscription",g);e.showDialogInUpdatedHeight(k);d("input[name='name']",k.getCurrentPanel().body).focus();d("#inline-dialog-more").removeClass("active");d("#inline-dialog-inline-dialog-more").hide();Confluence.TeamCalendars.fireEventForAnalytics("add.calendar.click.subscribe."+Confluence.TeamCalendars.getCalendarContext())});j();return false})}}});return c});
}catch(e){WRMCB(e)};
;
try {
/* module-key = 'com.atlassian.confluence.extra.team-calendars:calendar-add-inline-dialog', location = 'com/atlassian/confluence/extra/calendar3/components/calendar-add-inline-dialog/calendar-add-inline-dialog.soy' */
// This file was automatically generated from calendar-add-inline-dialog.soy.
// Please don't edit this file by hand.

/**
 * @fileoverview Templates in namespace Confluence.TeamCalendars.Templates.
 */

if (typeof Confluence == 'undefined') { var Confluence = {}; }
if (typeof Confluence.TeamCalendars == 'undefined') { Confluence.TeamCalendars = {}; }
if (typeof Confluence.TeamCalendars.Templates == 'undefined') { Confluence.TeamCalendars.Templates = {}; }


Confluence.TeamCalendars.Templates.addInlineDialog = function(opt_data, opt_ignored) {
  return '<div id="add-calendar-inline-dialog" class="add-calendar subcalendar-wizard"><ul class="add-calendar-options"><li class="option-new"><div class="title">' + soy.$$escapeHtml('Add new calendar') + '</div><div class="description">' + soy.$$escapeHtml('Create a brand new calendar') + '<div></li></ul><ul class="add-calendar-options"><li class="option-existing"><div class="title">' + soy.$$escapeHtml('Add existing calendar') + '</div><div class="description">' + soy.$$escapeHtml('Find and add a calendar from Confluence') + '<div></li></ul><ul class="add-calendar-options"><li class="option-import"><div class="title">' + soy.$$escapeHtml('Import calendar') + '</div><div class="description">' + soy.$$escapeHtml('Import an ICS file to create a calendar') + '<div></li></ul><ul class="add-calendar-options"><li class="option-subscription"><div class="title">' + soy.$$escapeHtml('Subscribe by URL') + '</div><div class="description">' + soy.$$escapeHtml('Subscribe to a calendar using its URL') + '<div></li></ul></div>';
};
if (goog.DEBUG) {
  Confluence.TeamCalendars.Templates.addInlineDialog.soyTemplateName = 'Confluence.TeamCalendars.Templates.addInlineDialog';
}

}catch(e){WRMCB(e)};
;
try {
/* module-key = 'com.atlassian.confluence.extra.team-calendars:manage-event', location = 'com/atlassian/confluence/extra/calendar3/components/manage-event/manage-event.js' */
define("tc/manage-event",["jquery","tc/event-delete-dialog","tc/calendar-util"],function(c,a,b){var d=function(g,e){var h;function f(n,l,j,i,m,k){if(!l.end&&!m){l.end=new Date(l.start.getTime()+(1000*60*60*2))}g.setProcessingEvent(n,true);g.setSuppressEventToolTip(n,true);d(g,e).updateEvent(n,(function(){var p=g.getSubCalendar(n,l.subCalendarId),o={subCalendarId:p.parentId,uid:l.id,eventType:l.eventType,originalStartDate:l.originalStart||"",what:l.title,url:l.workingUrl,dragAndDropUpdate:true,start:c.fullCalendar.formatDate(l.start,"ddMMyyyyHHmm"),end:c.fullCalendar.formatDate(l.end||l.start,"ddMMyyyyHHmm"),allDayEvent:m,where:l.where,description:l.description,freq:l.recur?l.recur.freq:"",byday:l.recur?l.recur.byDay:"",interval:l.recur?l.recur.interval:"",until:l.recur?l.recur.localizedUntil||"":"",recurrenceId:l.recurId||"",editAllInRecurrenceSeries:"false",customEventTypeId:l.customEventTypeId,childSubCalendarId:l.subCalendarId||""};if(p.eventInviteesSupported){o.person=c.map(l.invitees||[],function(q){return q.id})}return o})(),function(o,q,p){g.showAjaxError(n,o,q,p,g.ERROR_CLASS_EVENT_UPDATE);k();g.setSuppressEventToolTip(n,false);g.setProcessingEvent(n,false)},function(p){if(p.success){g.setGenericErrors(n,null,g.ERROR_CLASS_EVENT_UPDATE);var o=p.event;c.each(g.getCalendarPanel(n).fullCalendar("clientEvents",l.id),function(r,q){q.localizedStartDate=o.localizedStartDate;q.localizedStartTime=o.localizedStartTime;q.localizedEndDate=o.localizedEndDate;q.localizedEndTime=o.localizedEndTime;q.recurId=o.recurId;q.invitees=o.invitees;q.iconUrl=o.iconUrl;q.confluenceFormattedStartDate=o.confluenceFormattedStartDate;q.expandDates=o.expandDates;if(o.extraProperties){q.extraProperties=o.extraProperties}});if(l.calendarReloadRequiredOnUpdate){g.reloadSubCalendar(n,[l.subCalendarId])}}else{g.setGenericErrors(n,"Uh oh. Looks like something unexpectedly went wrong. Please check the Confluence log file.",g.ERROR_CLASS_EVENT_UPDATE);k()}g.setSuppressEventToolTip(n,false);g.setProcessingEvent(n,false)})}return{getEventDetailsDialog:function(r,j,p,i){var m=g.getSubCalendar(r,j.subCalendarId),k=g.getSubCalendar(r,m.parentId),q=(function(){return(c.inArray(g.getCalendarPanel(r).fullCalendar("getView").name,["month","agendaWeek"])!==-1)||g.getParameter(r,"showSubCalendarNameInEventPopup")!=="true"})(),o=function(){var w=null;var v=k?k:m;if(b.isCustomEventType(j.eventType)){var s=v.customEventTypes;c.each(s,function(x,y){if(y.customEventTypeId===j.customEventTypeId&&y.periodInMins>0){w=AJS.format("{0} before",b.showInforReminder(y.periodInMins));return false}})}else{var u=v.sanboxEventTypeReminders;if(u&&u.length>0){var t=j.eventType;if(b.isJiraType(t)){t+="-calendar"}c.each(u,function(y,x){if(x.eventTypeId===t&&x.periodInMins>0){w=AJS.format("{0} before",b.showInforReminder(x.periodInMins));return false}})}}return w},n=function(){return c("<div/>").html(Confluence.TeamCalendars.Templates.eventPopup({contextClass:q?"mycalendars":"",baseUrl:g.getParameter(r,"baseUrl"),event:c.extend(c.extend({},j),{colour:m.color,subCalendarDisplayName:k&&!Confluence.TeamCalendars.isSubscriptionSubCalendar(m)?k.name:m.name,subCalendarId:k?k.id:m.id,inviteesSupported:m.inviteesSupported,period:o()})}))},l=AJS.InlineDialog(p,g.dialogSequence++,function(u,s,w){var t=n();c(".field-duration",t).each(function(){var x=c(this);if(j.localizedStartDate!==j.localizedEndDate){x.empty().html("<span class='aui-icon aui-icon-wait'></span>");g.formatDate(r,[j._start,j._end],"dd MMM",function(y){if(typeof y==="string"){x.text(y);return}if(j.allDayFlipped?!j.allDay:j.allDay){x.empty().text(AJS.format("{0} - {1}",y[0],y[1]))}else{x.empty().text(AJS.format("{0}, {1} - {2}, {3}",y[0],j.localizedStartTime,j.localizedEndTime,y[1]))}})}else{if(!((j.allDayFlipped?!j.allDay:j.allDay))){x.empty().text(j.localizedStartTime+" - "+j.localizedEndTime)}}});var v=c(".edit-controls",t);if(g.isEventEditable(r,j)){v.each(function(){if(g.getParameter(r,"redirectEditInEventPopup")==="true"){c(".event-edit",this).unbind("click").attr("href",g.getParameter(r,"baseUrl").concat("/calendar/mycalendar.action","?startDayOfMonth=",c.fullCalendar.formatDate(j.start,"d"),"&startMonthOfYear=",(parseInt(c.fullCalendar.formatDate(j.start,"M"))-1),"&startYear=",c.fullCalendar.formatDate(j.start,"yyyy"),"&editSubCalendarId=",encodeURIComponent(g.getSubCalendar(r,j.subCalendarId).id),"&editEventId=",encodeURIComponent(j.id),"&editView=month"))}else{c(".event-edit",this).unbind("click").click(function(){l.hide();var z=g.getSubCalendar(r,j.subCalendarId),y=Confluence.TeamCalendars.Dialogs.getEditEventDialog(c.extend({},j,{eventType:z.subscriptionType||z.type,subCalendarId:z.parentId,originalEventSubCalendarId:z.id,childSubCalendarId:j.subCalendarId||""}),null,g,r);y.show();return false})}var x=c(".event-delete",this);if(g.isEventDeletable(r,j)&&g.getParameter(r,"hideDeleteInEventPopup")==="false"){x.click(function(){l.hide();a(r,j,g).show();return false})}else{x.remove()}})}else{v.each(function(){c(".edit-control",this).remove()})}v.each(function(){c(".event-hyperlink-separator:first-child, .event-hyperlink-separator:last-child",this).remove()});t.appendTo(u.empty());w()},(function(){var s={hideDelay:0,noBind:true,isRelativeToMouse:true,showDelay:0,width:Confluence.TeamCalendars.isPDLEnabled()&&c.inArray("jira-version",j.className)!==-1?380:360,hideCallback:function(){g.setSuppressEventToolTip(r,false);if(AJS.InlineDialog.current&&AJS.InlineDialog.current.popup){AJS.InlineDialog.current.popup.hide()}},initCallback:function(){g.setSuppressEventToolTip(r,true);c(".event-field.reminder-icon").tooltip({gravity:"s"})}};return i?c.extend(s,i):s})());l.addClass("event-display-dialog");return l},updateEvent:function(m,l,j,i){l.userTimeZoneId=Confluence.TeamCalendars.getUserTimeZone();var k=g.setSubCalendarSpinnerIconVisible(true);c.ajax({cache:false,data:l,dataFilter:function(o){var n=c.parseJSON(o);if(n.success){Confluence.TeamCalendars.mergeSubCalendarObjectsToArray([n.subCalendar])}return n},dataType:"text",error:function(n,p,o){if(j){j(n,p,o)}},success:function(o){var p=l.eventType,n=g.getParameter(m,"calendarContext");var q;if(p==="custom"){if(o.subCalendar&&o.subCalendar.customEventTypes){c.each(o.subCalendar.customEventTypes,function(r,s){if(s.customEventTypeId===l.customEventTypeId){q={customEventTypeName:s.title}}})}}if(l.uid){Confluence.TeamCalendars.fireEventForAnalytics("event.update.default."+p+".context."+n,q)}else{Confluence.TeamCalendars.fireEventForAnalytics("event.create.default."+p+".context."+n,q)}e.removeCalendar(l.subCalendarId);e.removeCalendar(l.originalSubCalendarId);if(i){i(o)}g.reloadSubCalendarDisableEvent(m,l)},complete:function(){if(k){k.resolve()}},type:"PUT",timeout:g.ajaxTimeout,url:g.getCalendarServiceBaseUrl(m,"/events.json")})},deleteEvent:function(k,l,j,i){c.ajax({cache:false,data:l,dataType:"json",error:function(m,o,n){if(j){j(m,o,n)}},success:function(m){e.removeCalendar(l.subCalendarId);if(i){i(m)}},type:"DELETE",timeout:g.ajaxTimeout,url:g.getCalendarServiceBaseUrl(k,"/events.json")})},eventClick:function(j,i,k){g.setEventTooltipVisible(k);if(i.shiftKey){if(g.isEventEditable(k,j)){var l=g.getSubCalendar(k,j.subCalendarId);Confluence.TeamCalendars.Dialogs.getEditEventDialog(c.extend({},j,{eventType:l.subscriptionType||l.type,subCalendarId:l.parentId,originalEventSubCalendarId:l.id,childSubCalendarId:j.subCalendarId||""}),null,g,k).show()}return false}if((i.ctrlKey||i.metaKey)&&j.workingUrl){window.location=j.workingUrl;return false}g.getEventDetailsDialog(k,j,c(i.currentTarget)).show(i);return false},eventRender:function(j,m,i,k){if(j.disableResizing){c(".ui-resizable-handle",m).hide()}m.mousemove(function(n){m.data("mouseCoords",{pageX:n.pageX,pageY:n.pageY})}).hover(function(){setTimeout(function(){var n=m.data("mouseCoords");if(!g.isEventToolTipSuppressed(k)&&n){g.setEventTooltipVisible(k,j,n,true)}},5000)},function(){m.removeData("mouseCoords");g.setEventTooltipVisible(k);g.setSuppressEventToolTip(k,false)});c(".fc-event-time, .fc-event-title",m).css("color",m.css("color"));if("agendaWeek"===i.name){m.parent().addClass(j.allDay?"fc-agenda-head":"fc-agenda-body");if(!j.allDay){c(".fc-event-inner",m).css({"border-right-color":j.secondaryBorderColor||j.borderColor,"border-bottom-color":j.secondaryBorderColor||j.borderColor,"border-left-color":j.secondaryBorderColor||j.borderColor})}}if("month"===i.name||"agendaWeek"===i.name){var l;if(c.inArray("other",j.className)!==-1||j.eventType==="custom"){if(j.shortTitle){l=j.shortTitle+": "+j.title}else{if(j.invitees&&j.invitees.length){l=j.invitees[0].displayName+": "+j.title}else{l=j.title}}}else{l=j.shortTitle||j.title}c(".fc-event-title",m).text(l);if("month"===i.name||("agendaWeek"===i.name&&j.allDay)){c(".fc-event-inner",m).before(Confluence.TeamCalendars.Templates.iconEventTypePrinting({eventType:j.className,isCustom:j.eventType==="custom"?true:false}))}}},eventDrop:function(l,j,i,m,k,n){if(g.isEventEditable(n,l)&&!g.isProcessingEvent(n)){f(n,l,j,i,m,k)}else{k()}},eventResize:function(l,j,i,k,m){if(g.isEventEditable(m,l)&&!g.isProcessingEvent(m)){f(m,l,j,i,l.allDay,k)}else{k()}},eventDragStart:function(i){g.setSuppressEventToolTip(i,true);g.setEventTooltipVisible(i);g.hideInlineAuiDialogs()},eventDragEnd:function(i){g.setSuppressEventToolTip(i,false)},eventResizeStart:function(i){g.setSuppressEventToolTip(i,true);g.setEventTooltipVisible(i);g.hideInlineAuiDialogs()},eventResizeStop:function(i){g.setSuppressEventToolTip(i,false)}}};return d});
}catch(e){WRMCB(e)};
;
try {
/* module-key = 'com.atlassian.confluence.extra.team-calendars:manage-i18n-text', location = 'com/atlassian/confluence/extra/calendar3/components/manage-i18n-text/manage-i18n-text.js' */
define("tc/manage-i18n-text",["jquery"],function(b){var a=function(c){return{getEventTypeNames:function(e){var d={"calendar3.subcalendar.type.parent":"Calendars","calendar3.subcalendar.type.local":"Events Calendars","calendar3.subcalendar.type.subscription":"Subscriptions","calendar3.subcalendar.type.jira":"JIRA Calendars","calendar3.subcalendar.type.people":"People Calendars","calendar3.subcalendar.type.other":"Events","calendar3.subcalendar.type.generic-people":"People","calendar3.subcalendar.type.travel":"Travel","calendar3.subcalendar.type.leaves":"Leave","calendar3.subcalendar.type.birthdays":"Birthdays","calendar3.subcalendar.type.jira-agile-sprint":"JIRA Agile Sprints","calendar3.subcalendar.type.jira-project-releases":"JIRA Project Releases","calendar3.subcalendar.type.jira-issue-dates":"JIRA Issue Dates","calendar3.subcalendar.type.unknown":"Unknown Type"};return d[e]?d[e]:d},getMonthNames:function(){return[this.getText("calendar3.month.long.january"),this.getText("calendar3.month.long.february"),this.getText("calendar3.month.long.march"),this.getText("calendar3.month.long.april"),this.getText("calendar3.month.long.may"),this.getText("calendar3.month.long.june"),this.getText("calendar3.month.long.july"),this.getText("calendar3.month.long.august"),this.getText("calendar3.month.long.september"),this.getText("calendar3.month.long.october"),this.getText("calendar3.month.long.november"),this.getText("calendar3.month.long.december")]},getMonthNamesShort:function(){return[this.getText("calendar3.month.short.january"),this.getText("calendar3.month.short.february"),this.getText("calendar3.month.short.march"),this.getText("calendar3.month.short.april"),this.getText("calendar3.month.short.may"),this.getText("calendar3.month.short.june"),this.getText("calendar3.month.short.july"),this.getText("calendar3.month.short.august"),this.getText("calendar3.month.short.september"),this.getText("calendar3.month.short.october"),this.getText("calendar3.month.short.november"),this.getText("calendar3.month.short.december")]},getDayNames:function(){return[this.getText("calendar3.day.long.sunday"),this.getText("calendar3.day.long.monday"),this.getText("calendar3.day.long.tuesday"),this.getText("calendar3.day.long.wednesday"),this.getText("calendar3.day.long.thursday"),this.getText("calendar3.day.long.friday"),this.getText("calendar3.day.long.saturday")]},getDayNamesShort:function(){return[this.getText("calendar3.day.short.sunday"),this.getText("calendar3.day.short.monday"),this.getText("calendar3.day.short.tuesday"),this.getText("calendar3.day.short.wednesday"),this.getText("calendar3.day.short.thursday"),this.getText("calendar3.day.short.friday"),this.getText("calendar3.day.short.saturday")]},getText:function(d){return this.getI18nMessages()[d]},getI18nMessages:function(){if(!c){c={};b("fieldset input",b("<div/>",{html:b("#team-calendars-messages").html()})).each(function(){c[this.name]=this.value})}return c}}};return a});
}catch(e){WRMCB(e)};
;
try {
/* module-key = 'com.atlassian.confluence.extra.team-calendars:full-calendar-option', location = 'com/atlassian/confluence/extra/calendar3/components/full-calendar/full-calendar-option.js' */
define("tc/full-calendar-option",["jquery","tc/manage-event"],function(b,c){var a=function(f,e,d){return{calendarDiv:e,calendarPlugin:f,defaultView:f.getParameter(e,"defaultView")||"month",year:parseInt(f.getParameter(e,"startingYear")),month:parseInt(f.getParameter(e,"startingMonth")),date:parseInt(f.getParameter(e,"startingDay")),header:false,firstDay:f.getParameter(e,"firstDayOfWeek"),weekends:f.getParameter(e,"hideWeekends")==="false",viewRender:function(g){var h=function(){if(Confluence.TeamCalendars.isPDLEnabled()){b(".change-view",e).removeClass("active");b(".change-view-"+g.name,e).addClass("active")}else{b(".change-view",e).each(function(){b(this).closest("li").removeClass("active")});b(".change-view-"+g.name,e).closest("li").addClass("active")}};Confluence.TeamCalendars.updateDateDisplay(e,g.title);h();if(g.name==="basicDay"){f.getCalendarPanel(e).addClass("borderless")}else{f.getCalendarPanel(e).removeClass("borderless")}if(f.isCalendarInEditMode(e)){var i=e.data("lastSelectedView");if(!i){e.data("lastSelectedView",g.name)}else{if(g.name!==i){e.data("lastSelectedView",g.name);b.ajax({cache:false,data:{view:g.name},dataType:"json",error:function(j,l,k){f.showAjaxError(e,j,l,k,f.ERROR_CLASS_CONFIG_UPDATE)},success:function(){f.setGenericErrors(e,null,f.ERROR_CLASS_CONFIG_UPDATE)},type:"PUT",timeout:f.ajaxTimeout,url:f.getCalendarServiceBaseUrl(e,"/preferences/view.json")})}}}},allDayText:"All day",firstHour:8,columnFormat:{week:"ddd d"},titleFormat:{week:"MMM d[ yyyy]{ '&#8212;'[ MMM] d, yyyy}"},buttonText:{today:"Today",month:"Month",week:"Week",day:"List"},monthNames:f.getMonthNames(),monthNamesShort:f.getMonthNamesShort(),dayNames:f.getDayNames(),dayNamesShort:f.getDayNamesShort(),dayClick:function(h,i,g){if(b(".event-details-popup:visible").length===0){if(f.getSubCalendarsWhichCanAddEvents(e).length){Confluence.TeamCalendars.Dialogs.getEditEventDialog({start:h,localizedStartTime:i?f.getDefaultStartTime(e):null,localizedEndTime:i?f.getDefaultEndTime(e):null,allDay:(function(){if(f.getCalendarPanel(e).fullCalendar("getView").name==="month"){return(e.data(f.PREF_LAST_ALL_DAY_USED)||i.toString())==="true"}return i})()},null,f,e).show()}}else{g.stopPropagation();f.hideInlineAuiDialogs()}},eventClick:function(h,g){return c(f).eventClick(h,g,e)},eventRender:function(h,i,g){c(f).eventRender(h,i,g,e)},eventDrop:function(j,h,g,k,i){c(f,d).eventDrop(j,h,g,k,i,e)},eventDragStart:function(){c(f,d).eventDragStart(e)},eventDragEnd:function(){c(f,d).eventDragEnd(e)},eventResize:function(j,h,g,i){c(f,d).eventResize(j,h,g,i,e)},eventResizeStart:function(){c(f,d).eventResizeStart(e)},eventResizeStop:function(){c(f,d).eventResizeStop(e)},loading:function(g){if(!g){window.isTeamCalendarsLoaded=true}if(!g&&this.spinnerDefer){this.spinnerDefer.resolve()}if(g){this.spinnerDefer=f.setSubCalendarSpinnerIconVisible(e,g)}},selectable:true,selectHelper:true,select:function(g,j,i,h){if(!b(".event-details-popup:visible").length&&f.getSubCalendarsWhichCanAddEvents(e).length){Confluence.TeamCalendars.Dialogs.getEditEventDialog({start:g,end:j,localizedStartTime:i?f.getDefaultStartTime(e):null,localizedEndTime:i?f.getDefaultEndTime(e):null,allDay:(function(){if(f.getCalendarPanel(e).fullCalendar("getView").name==="month"){if(j.getTime()-g.getTime()>0){return i.toString()==="true"}return(e.data(f.PREF_LAST_ALL_DAY_USED)||i.toString())==="true"}return i})()},null,f,e).show()}else{if(h){h.stopPropagation()}f.hideInlineAuiDialogs()}}}};return a});
}catch(e){WRMCB(e)};
;
try {
/* module-key = 'com.atlassian.confluence.extra.team-calendars:subcalendar-panel', location = 'com/atlassian/confluence/extra/calendar3/components/subcalendar-panel/subcalendar-panel.js' */
define("tc/subcalendar-panel",["jquery","tc/calendar-util","tc/myCalendarTour","tc/subcalendar-entry-view","tc/subcalendar-menu-builder","tc/non-space-calendars-handler"],function(g,e,b,d,f,c){var a=function(o,m,h){var i=g("div.sub-calendar-names",m);var n=function(s){var r=(function(){var t=new d({CalendarPlugin:o,subCalendar:s,calendarDiv:m,cache:h}).render();return t})();return r};var q=function(){if(o.getSubCalendarsWhichCanAddEvents(m).length){g(".add-event-button",m).removeClass("hidden");g(".toolbar-group-addevent, .add-event-button",m).removeClass("hidden")}else{g(".add-event-button",m).addClass("hidden");g(".toolbar-group-addevent, .add-event-button",m).addClass("hidden")}};var j=function(){if("true"===o.getParameter(m,"readOnly")){g("#add-calendar-menu").addClass("hidden")}else{g("#add-calendar-menu").removeClass("hidden")}};var l=function(){g("<div/>",{"class":"no-subcalendars-msg",text:"You haven\'t created or subscribed to any calendars"}).appendTo(i)};var p=function(s,v){var t=g.grep(v,function(y,x){return y.type==="parent"||y.subscriptionType==="parent"});var r=function(x){var y=g(s).find(".subcalendar-item");y.each(function(A,C){var z=g(C);var F=z.data("sub-calendar-id");var D=g.grep(x,function(G){return G.subCalendarId==F});var E=o.getParameter(m,"hideWatchMenuItem")==="true";if(D.length>0&&D[0].isWatchable&&!E){var B="not-watched";if(D[0].watchedViaContent){B="watching-via-content"}else{if(D[0].watched){B="watched"}}z.addClass(B)}z.addClass("disable-loading-watching-status");b.reposition()});AJS.trigger("calendar.watch.statuses.loaded",x)};var u={};var w=g.map(t,function(x,y){return x.id});u.include=w;g.ajax({cache:false,data:u,dataType:"json",error:function(x,z,y){o.showAjaxError(m,x,z,y,o.ERROR_CLASS_SUB_CALENDAR_LIST)},success:function(y){if(y.success){var x=y.payload;r(x);o.setGenericErrors(m,null,o.ERROR_CLASS_SUB_CALENDAR_LIST)}else{o.setGenericErrors(m,"Uh oh. Looks like something unexpectedly went wrong. Please check the Confluence log file.",o.ERROR_CLASS_SUB_CALENDAR_LIST)}},type:"GET",timeout:o.ajaxTimeout,url:Confluence.TeamCalendars.getCalendarServiceBaseUrl("/subcalendars/watching/status.json")})};var k=function(r){f.build(m,o,r)};return{initSubCalendarPanel:function(){var s=function(u){Confluence.TeamCalendars.Dialogs.getEditEventDialog({start:new Date(),localizedStartTime:o.getDefaultStartTime(u),localizedEndTime:o.getDefaultEndTime(u),allDay:(u.data(o.PREF_LAST_ALL_DAY_USED)||"true")==="true"},null,o,m).show()};g(".toolbar-group-addevent .trigger-addevent, .calendar-toolbar .add-event, .add-event-button",m).click(function(){s(m);return false});var r=o.setSubCalendarSpinnerIconVisible(true);var t=function(){if(r){r.resolve()}};o.refreshCachedSubCalendars(m,function(v){if("true"===o.getParameter(m,"showHiddenSubCalendars")&&g.isArray(v)){g.each(v,function(x,w){w.eventsHidden=false})}o.updateAvailableSubCalendarsInSubCalendarPanel(m);t();if(o.isCalendarInEditMode(m)){var u=function(){m.unbind("calendar-plugin.resized",u);if("true"===o.getParameter(m,"isShowCalendarWizard")){var x=function(){Confluence.TeamCalendars.Dialogs.getSubCalendarSubscribeDialog({heading:"Welcome to Team Calendars!",callbackHandler:o.getRenderedMacroCallbackHandler(m)}).show()};var w=function(){Confluence.TeamCalendars.Dialogs.getAddDialog(o.getRenderedMacroCallbackHandler(m),{title:"Welcome to Team Calendars!",addClass:"create-calendar-first-time"})};e.showCalendarPopupHaveAnEmptySubcalendar(x,w)}};m.bind("calendar-plugin.resized",u)}},function(){t()})},updateAvailableSubCalendarsInSubCalendarPanel:function(){i.empty();q();j();var r=e.getSortedSubCalendarsByTypeAndName(o.getSubCalendars(m));k(r);window.isTeamCalendarsLoaded=true;if(!r.length){e.toggleNoCalendarPage(true);g(".no-calendar-page #add-button").click(function(s){Confluence.TeamCalendars.Dialogs.getAddDialog(o.getRenderedMacroCallbackHandler(m));s.preventDefault()});l()}else{e.toggleNoCalendarPage(false)}g.each(r,function(s,t){i.append(n(t))});if(!e.isSingleCalendarView(m)){b.start()}p(i,r);c.handle(o,m,h,r)}}};return a});
}catch(e){WRMCB(e)};
;
try {
/* module-key = 'com.atlassian.confluence.extra.team-calendars:subcalendar-panel', location = 'com/atlassian/confluence/extra/calendar3/components/subcalendar-panel/subcalendar-entry-view.js' */
define("tc/subcalendar-entry-view",["jquery","underscore","tc/calendar-util","tc-backbone","tc/child-subcalendar-entry-view","tc/subcalendar-menu-view","tc/subcalendar-displayer"],function(f,b,d,h,g,e,a){var c=h.View.extend({initialize:function(i){this.cache=i.cache;this.CalendarPlugin=i.CalendarPlugin;this.subCalendar=i.subCalendar;this.calendarDiv=i.calendarDiv;this.template=Confluence.TeamCalendars.Templates.subCalendarPanelEntry;this.childSubCalendarIds=[];this.childSubCalendarViews=[];AJS.trigger("calendar.loaded",this.subCalendar)},events:{"click .subcalendar-name":"_onClick"},render:function(){this.$el.html(this.template({subCalendar:this.subCalendar,autoConvertSupported:this.CalendarPlugin.isAutoConvertSupported(this.calendarDiv),subCalendarClasses:this.CalendarPlugin.getParameter(this.calendarDiv,"subCalendarColorClass")}));this.entryView=this.$(".subcalendar-item");this._ellipsisLongCalendarNames();this._renderChildSubCalendars();this._initEventsVisibility();if(!d.isSingleCalendarView(this.calendarDiv)){this.subcalendarDisplayer=new a({CalendarPlugin:this.CalendarPlugin,calendarDiv:this.calendarDiv,entryView:this.entryView,subCalendar:this.subCalendar,childSubCalendarIds:this.childSubCalendarIds,childSubCalendarViews:this.childSubCalendarViews})}if(d.isSpaceCalendarView(this.calendarDiv)&&!d.isDummySubscriptionParentSubCalendar(this.subCalendar)&&this.subCalendar.spaceKey!==undefined){this.$(".subcalendar-name").addClass("header-color")}this.menuView=new e({cache:this.cache,CalendarPlugin:this.CalendarPlugin,calendarDiv:this.calendarDiv,subCalendar:this.subCalendar,subCalendarEntryView:this.entryView,autoConvertSupported:this.CalendarPlugin.isAutoConvertSupported(this.calendarDiv),subCalendarClasses:this.CalendarPlugin.getParameter(this.calendarDiv,"subCalendarColorClass"),template:Confluence.TeamCalendars.Templates.subCalendarMenu,subcalendarDisplayer:this.subcalendarDisplayer});this.$(".subcalendar-info").append(this.menuView.render());return this.$el},_ellipsisLongCalendarNames:function(){this.$(".subcalendar-name").attr("title",this.$(".ellipsis_text").text())},_renderChildSubCalendars:function(){if(this.subCalendar.childSubCalendars){this.childSubCalendarIds=[];this.childSubCalendarViews=[];var i=this;b.each(this.subCalendar.childSubCalendars,function(k){var j=k.customEventTypes;if(j&&j.length){b.each(j,function(l){i._renderChildSubCalendar(k,l)})}else{i._renderChildSubCalendar(k)}})}},_renderChildSubCalendar:function(k,j){var l=this.$(".child-subcalendars");var i={cache:this.cache,CalendarPlugin:this.CalendarPlugin,calendarDiv:this.calendarDiv,parentView:this.entryView,parentSubCalendar:this.subCalendar,childSubCalendar:k};if(j){i.customEventType=j;i.template=Confluence.TeamCalendars.Templates.customEventTypePanelEntry}else{i.template=Confluence.TeamCalendars.Templates.childSubCalendarPanelEntry}var m=new g(i).render();l.append(m);this.childSubCalendarIds.push(k.id);this.childSubCalendarViews.push(m.find(".child-subcalendar"))},_onClick:function(){if(!d.isSpaceCalendarView(this.calendarDiv)||d.isDummySubscriptionParentSubCalendar(this.subCalendar)||this.subCalendar.spaceKey===undefined){return}Confluence.TeamCalendars.fireEventForAnalytics("view.calendar.detail.click");window.location.href=AJS.contextPath()+"/display/"+encodeURIComponent(this.subCalendar.spaceKey)+"/calendar/"+encodeURIComponent(this.subCalendar.subscriptionId||this.subCalendar.id)+"?calendarName="+encodeURIComponent(this.subCalendar.name)},_initEventsVisibility:function(){var j=[];var i=[];if(d.isSubscriptionSubCalendar(this.subCalendar)){if(this.subCalendar.eventsHidden||f.inArray(this.subCalendar.id,i)!==-1){this.entryView.addClass("subcalendar-disabled");i.push(this.subCalendar.id)}else{if(!d.isDummySubscriptionParentSubCalendar(this.subCalendar)){j.push(this.subCalendar.id)}}}b.each(this.childSubCalendarViews,function(k){var l=this.CalendarPlugin.getSubCalendar(this.calendarDiv,k.data("subCalendarId"));if(!d.isSingleCalendarView(this.calendarDiv)&&(l.eventsHidden||f.inArray(l.id,i)!==-1)){k.addClass("subcalendar-disabled");i.push(l.id)}else{j.push(l.id)}},this);if(j.length){this.CalendarPlugin.addSubCalendarEventSource(this.calendarDiv,j)}if(i.length){this.entryView.addClass("subcalendar-disabled")}if(this.childSubCalendarViews.length){this.CalendarPlugin.checkCalendarHasAllChildDisable(this.entryView)}else{if(!d.isSingleCalendarView(this.calendarDiv)&&this.subCalendar.eventsHidden){this.entryView.addClass("subcalendar-disabled")}}}});return c});
}catch(e){WRMCB(e)};
;
try {
/* module-key = 'com.atlassian.confluence.extra.team-calendars:subcalendar-panel', location = 'com/atlassian/confluence/extra/calendar3/components/subcalendar-panel/subcalendar-menu-view.js' */
define("tc/subcalendar-menu-view",["jquery","underscore","tc-backbone","tc/myCalendarTour","tc/calendar-util"],function(e,j,i,h,f){var k=i.View.extend({initialize:function(l){this.cache=l.cache;this.CalendarPlugin=l.CalendarPlugin;this.calendarDiv=l.calendarDiv;this.subCalendar=l.subCalendar;this.parentSubCalendar=l.parentSubCalendar;this.$subCalendarEntryView=l.subCalendarEntryView;this.template=l.template;this.subcalendarDisplayer=l.subcalendarDisplayer},events:{"click .subcalendar-addevent":"_onAddEventClick","click .subcalendar-watch":"_onWatchClick","click .subcalendar-unwatch":"_onUnWatchClick","click .subcalendar-edit, .subcalendar-view":"_onEditClick","click .subcalendar-restrict":"_onRestrictClick","click .subcalendar-remove":"_onRemoveClick","click .subcalendar-share, .subcalendar-share-or-embed":"_onShareClick","click .subcalendar-subscribe":"_onSubscribeClick","click .subcalendar-reload":"_onRefreshClick","click .subcalendar-reminder":"_onReminderClick","click .custom-event-type-edit, .setting-reminder-setting":"_onEditEventTypeClick","click .color-cell":"_onColorCellClick","click .subcalendar-display-hide, .subcalendar-display-show":"_onDisplayClick"},render:function(){this.$el.html(this.template({subCalendar:this.subCalendar,autoConvertSupported:this.CalendarPlugin.isAutoConvertSupported(this.calendarDiv),subCalendarClasses:this.CalendarPlugin.getParameter(this.calendarDiv,"subCalendarColorClass"),parentSubCalendar:this.parentSubCalendar}));this._initExportLink();this._initDetailLink();this._initMenuItemsDropDown();return this.$el},_initMenuItemsDropDown:function(){this.$(".subcalendar-dropdown-menu").dropDown("Standard",{alignment:"right",hideHandler:function(){h.hideLeg()}})},_initExportLink:function(){this.$(".subcalendar-icalexport").attr("href",this.CalendarPlugin.getCalendarServiceBaseUrl(this.calendarDiv,"/export/subcalendar/"+encodeURIComponent(this.subCalendar.id+".ics")+"?os_authType=basic&isSubscribe=false"))},_initDetailLink:function(){this.$(".subcalendar-page").attr("href",AJS.contextPath()+"/display/"+encodeURIComponent(this.subCalendar.spaceKey)+"/calendar/"+encodeURIComponent(this.subCalendar.subscriptionId||this.subCalendar.id)+"?calendarName="+encodeURIComponent(this.subCalendar.name))},_onAddEventClick:function(l){Confluence.TeamCalendars.Dialogs.getEditEventDialog({start:new Date(),localizedStartTime:this.CalendarPlugin.getDefaultStartTime(this.calendarDiv),localizedEndTime:this.CalendarPlugin.getDefaultEndTime(this.calendarDiv),allDay:(this.calendarDiv.data(this.CalendarPlugin.PREF_LAST_ALL_DAY_USED)||"true")==="true",subCalendarId:this.subCalendar.id},this.subCalendar,this.CalendarPlugin,this.calendarDiv).show();l.preventDefault()},_onWatchClick:function(l){d(this.CalendarPlugin,this.calendarDiv,this.subCalendar,true,j.bind(function(){this.$subCalendarEntryView.addClass("watched").removeClass("not-watched")},this));l.preventDefault()},_onUnWatchClick:function(l){d(this.CalendarPlugin,this.calendarDiv,this.subCalendar,false,j.bind(function(){this.$subCalendarEntryView.removeClass("watched").addClass("not-watched")},this));l.preventDefault()},_onEditClick:function(l){this.CalendarPlugin.showSubCalendarEdit(this.calendarDiv,this.subCalendar);e("#edit-calendar-dialog").find(".button-panel-button.submit").removeClass("hidden");l.preventDefault()},_onRestrictClick:function(l){this.CalendarPlugin.getSubCalendarRestrictionsDialog(this.calendarDiv,this.subCalendar);l.preventDefault()},_onRemoveClick:function(l){if(this.CalendarPlugin.isSubCalendarDeletable(this.calendarDiv,this.subCalendar)){if(f.isJiraSubCalendar(this.subCalendar)){this.CalendarPlugin.deleteSubCalendar(this.calendarDiv,this.subCalendar)}else{this.CalendarPlugin.removeSubCalendarDialog(this.calendarDiv,this.subCalendar)}}else{this.CalendarPlugin.unsubscribeFromSubcalendar(this.calendarDiv,this.subCalendar)}l.preventDefault()},_onShareClick:function(l){this.CalendarPlugin.getSubCalendarShareDialog(this.calendarDiv,this.subCalendar);l.preventDefault()},_onSubscribeClick:function(l){this.CalendarPlugin.getSubCalendarIcalAddressDialog(this.calendarDiv,this.subCalendar);l.preventDefault()},_onRefreshClick:function(m){if(!this.CalendarPlugin.isSubCalendarEventsUpdatable(this.calendarDiv,this.subCalendar)||g(this.subCalendar)||f.isSubscriptionSubCalendar(this.subCalendar)){var l=this;e.ajax({cache:false,data:{subCalendarId:this.subCalendar.id},dataType:"json",error:function(n,p,o){l.CalendarPlugin.showAjaxError(l.calendarDiv,n,p,o,l.CalendarPlugin.ERROR_CLASS_SUB_CALENDAR_LIST_EVENTS+l.CalendarPlugin.getStringAsHex(l.subCalendar.id))},success:function(n){l.CalendarPlugin.setGenericErrors(l.calendarDiv,null,l.CalendarPlugin.ERROR_CLASS_SUB_CALENDAR_LIST_EVENTS+l.CalendarPlugin.getStringAsHex(l.subCalendar.id));if(n.success){l.CalendarPlugin.reloadSubCalendar(l.calendarDiv,l.subCalendar.id)}},type:"PUT",timeout:this.CalendarPlugin.ajaxTimeout,url:this.CalendarPlugin.getCalendarServiceBaseUrl(this.calendarDiv,"/subcalendars/admin/refresh.json")})}else{this.CalendarPlugin.reloadSubCalendar(this.calendarDiv,this.subCalendar.id)}m.preventDefault()},_onReminderClick:function(l){b(this.CalendarPlugin,this.calendarDiv,this.subCalendar,this.subCalendar.id,j.bind(function(){this.$subCalendarEntryView.find(".reminder-me").toggleClass("hidden");this.$subCalendarEntryView.find(".unreminder-me").toggleClass("hidden")},this),this.$subCalendarEntryView.find(".reminder-me.hidden").length?false:true);l.preventDefault()},_onEditEventTypeClick:function(l){var m=this.$subCalendarEntryView.data("customEventTypeId");if(!m){m=f.isInternalSubscriptionSubCalendar(this.subCalendar)?this.subCalendar.subscriptionType:this.subCalendar.type}this.CalendarPlugin.showCustomEventEditForm(this.calendarDiv,this.parentSubCalendar,m);l.preventDefault()},_onColorCellClick:function(n){if(!this.CalendarPlugin.isProcessingSubCalendar(this.calendarDiv)){this.CalendarPlugin.setProcessingSubCalendar(this.calendarDiv,true);var o=e(n.target);var l=this.subCalendar;var m=this;a(this.CalendarPlugin,this.calendarDiv,l,o.data("colour"),function(p){if(p.success){m.cache.removeCalendar(l.id);m.CalendarPlugin.setGenericErrors(m.calendarDiv,null,m.CalendarPlugin.ERROR_CLASS_SUB_CALENDAR_UPDATE);m.CalendarPlugin.setSubCalendars(m.calendarDiv,p.payload);m.CalendarPlugin.removeSubCalendarEventSource(m.calendarDiv,l.id);m.CalendarPlugin.updateAvailableSubCalendarsInSubCalendarPanel(m.calendarDiv);m.$subCalendarEntryView.removeClass().addClass("aui-dd-parent "+o.data("colour"))}else{m.CalendarPlugin.setGenericErrors(m.calendarDiv,"Unable to change the colour of the calendar. Please authenticate first.",m.CalendarPlugin.ERROR_CLASS_SUB_CALENDAR_UPDATE)}c(m.CalendarPlugin,m.calendarDiv)},c(m.CalendarPlugin,m.calendarDiv))}n.preventDefault()},_onDisplayClick:function(l){this.subcalendarDisplayer.toggleVisibility();l.preventDefault()}});var d=function(p,o,m,n,l){e.ajax({cache:false,data:{subCalendarId:m.id},dataType:"json",error:function(q,s,r){p.showAjaxError(o,q,s,r,p.ERROR_CLASS_SUB_CALENDAR_WATCH+p.getStringAsHex(m.id))},success:function(){if(l){l()}},type:n?"PUT":"DELETE",timeout:p.ajaxTimeout,url:p.getCalendarServiceBaseUrl(o,"/preferences/subcalendars/watch.json")})};var g=function(l){return l&&(f.isJiraSubCalendar(l)||e.grep(l.childSubCalendars||[],function(m){return g(m)}).length)};var b=function(p,o,n,m,l,q){e.ajax({cache:false,data:{subCalendarId:m,isReminder:q},dataType:"json",error:function(r,t,s){p.showAjaxError(o,r,t,s,p.ERROR_CLASS_SUB_CALENDAR_WATCH+p.getStringAsHex(n.id))},success:function(){if(l){l()}},type:"PUT",timeout:p.ajaxTimeout,url:p.getCalendarServiceBaseUrl(o,"/preferences/subcalendars/setreminder.json")})};var c=function(m,l){m.setProcessingSubCalendar(l,false)};var a=function(r,q,o,p,l,m){var n=r.setSubCalendarSpinnerIconVisible(true);e.ajax({cache:false,converters:{"text json":function(s){return s}},data:(function(){var s={subCalendarId:o.id,color:p};if(r.getParameter(q,"include")){s.include=r.getParameter(q,"include")}f.putCalendarContextParams(s);return s})(),dataType:"json",dataFilter:function(s){var t=e.parseJSON(s);if(t.success){r.mergeSubCalendarObjectsToArray(t.payload)}return t},error:function(s,u,t){r.showAjaxError(q,s,u,t,r.ERROR_CLASS_SUB_CALENDAR_UPDATE);if(m){m(s,u,t)}},success:function(s){if(l){l(s)}},complete:function(){if(n){n.resolve()}},type:"PUT",timeout:r.ajaxTimeout,url:r.getCalendarServiceBaseUrl(q,"/subcalendars/color.json")})};return k});
}catch(e){WRMCB(e)};
;
try {
/* module-key = 'com.atlassian.confluence.extra.team-calendars:subcalendar-panel', location = 'com/atlassian/confluence/extra/calendar3/components/subcalendar-panel/child-subcalendar-entry-view.js' */
define("tc/child-subcalendar-entry-view",["jquery","tc-backbone","tc/calendar-util","tc/subcalendar-menu-view","tc/subcalendar-displayer"],function(d,f,b,c,a){var e=f.View.extend({initialize:function(g){this.cache=g.cache;this.parentSubCalendar=g.parentSubCalendar;this.childSubCalendar=g.childSubCalendar;this.customEventType=g.customEventType;this.CalendarPlugin=g.CalendarPlugin;this.calendarDiv=g.calendarDiv;this.parentView=g.parentView;this.template=g.template},events:{"hover .child-subcalendar":"_onHover","click .child-subcalendar-name":"_onClick"},render:function(){this.$el.html(this.template({childSubCalendar:this.childSubCalendar,customEventType:this.customEventType}));this.entryView=this.$(".child-subcalendar");var g={cache:this.cache,CalendarPlugin:this.CalendarPlugin,calendarDiv:this.calendarDiv,subCalendar:this.childSubCalendar,parentSubCalendar:this.parentSubCalendar,subCalendarEntryView:this.entryView,autoConvertSupported:this.CalendarPlugin.isAutoConvertSupported(this.calendarDiv),subCalendarClasses:this.CalendarPlugin.getParameter(this.calendarDiv,"subCalendarColorClass")};if(this.customEventType){g.template=Confluence.TeamCalendars.Templates.customEventTypeMenu}else{g.template=Confluence.TeamCalendars.Templates.childSubCalendarMenu}this.entryView.append(new c(g).render());this._ellipsisChildSubCalendarName();this.subcalendarDisplayer=new a({CalendarPlugin:this.CalendarPlugin,calendarDiv:this.calendarDiv,entryView:this.entryView,subCalendar:this.childSubCalendar,parentView:this.parentView,parentSubCalendar:this.parentSubCalendar});return this.$el},_ellipsisChildSubCalendarName:function(){var g=this.$(".child-subcalendar-name");if(!g.attr("threedots")){g.attr("title",this.$(".ellipsis_text").text())}},_onHover:function(){this.entryView.toggleClass("active-child-subcalendar")},_onClick:function(){this.subcalendarDisplayer.toggleVisibility()}});return e});
}catch(e){WRMCB(e)};
;
try {
/* module-key = 'com.atlassian.confluence.extra.team-calendars:subcalendar-panel', location = 'com/atlassian/confluence/extra/calendar3/components/subcalendar-panel/subcalendar-menu-builder.js' */
define("tc/subcalendar-menu-builder",["jquery","underscore","tc/calendar-util"],function(c,a,b){var d=function(p,r,h){var n=r.getParameter(p,"readOnly")==="true",l=r.getParameter(p,"isNotificationsEnabled")==="true",k=r.getParameter(p,"hideEditMenuItem")==="true",m=r.getParameter(p,"hideRemoveMenuItem")==="true",i=r.getParameter(p,"hideColorGrid")==="true",g=AJS.Meta.get("remote-user");function e(s,t){if(b.isSingleCalendarView(p)){j(s,t)}else{o(s,t)}}function o(t,u){var v=b.isJiraSubCalendar(t),s=b.isSubscriptionSubCalendar(t);t.displayName=t.name;if(b.isSubscriptionSubCalendar(t)&&!u){t.menuOptions={showMenu:false}}else{t.menuOptions={showMenu:true,showAddEvent:!n&&!v&&t.eventsEditable,showNotifications:l&&!u,showEdit:q(t)||b.isSubscriptionSubCalendar(t),showView:!k&&!n&&!t.editable,showRestrictions:!n&&t.administrable&&!v,showRemove:!m&&!n&&t.editable&&((!u||b.isSubscriptionSubCalendar(t))?true:t.eventsEditable),showShareAndSubscribe:t.eventsViewable&&!v,showSubscribe:!v,showColourGrid:!i&&(s||v)&&g.length>0,showReload:t.reloadable,showDisplayLink:true}}}function j(s,t){o(s,t);var u=s.menuOptions;u.showEdit=false;u.showRemove=false;if(b.isJiraSubCalendar(s)){u.showEdit=true;u.showRemove=true}u.showRestrictions=false;u.showDisplayLink=false;s.menuOptions=u}function q(s){return !n&&s.editable&&s.eventsEditable}function f(s,v){var t=v.subscriptionType||v.type;if(b.isEventTypeSanbox(t)||b.isJiraType(t)){var u=b.getPeriodReminderEventTypeSanboxOrJira(s,t);return u!==undefined&&u>0}else{if(b.isCustomEventType(t)){return v.customEventTypes[0].periodInMins>0}}}a.each(h,function(s){e(s,false);if(s.childSubCalendars){a.each(s.childSubCalendars,function(v){var t=v.typeKey;var u=r.getEventTypeNames(t);if(b.isSubscriptionSubCalendar(v)){e(v,true);v.menuOptions=c.extend(v.menuOptions,{showDisplayLink:false})}else{if(b.isJiraSubCalendar(v)){e(v,true);v.menuOptions=c.extend(v.menuOptions,{showReminder:g.length>0&&f(s,v),showSettingReminder:g.length>0&&!f(s,v)&&q(s),showDisplayLink:false})}else{v.menuOptions={showMenu:true,showColourGrid:g.length>0,showReload:true,showReminder:g.length>0&&f(s,v),showSettingReminder:g.length>0&&!f(s,v)&&q(s)};v.displayName=u}}})}})};return{build:d}});
}catch(e){WRMCB(e)};
;
try {
/* module-key = 'com.atlassian.confluence.extra.team-calendars:subcalendar-panel', location = 'com/atlassian/confluence/extra/calendar3/components/subcalendar-panel/subcalendar-displayer.js' */
define("tc/subcalendar-displayer",["jquery","underscore","tc/calendar-util"],function(d,b,c){var a=function(n){var l=n.CalendarPlugin,k=n.calendarDiv,h=n.entryView,i=n.subCalendar,e=n.childSubCalendarIds,f=n.childSubCalendarViews,m=n.parentView,g=n.parentSubCalendar;var j=function(){var q;var r=h.hasClass("child-subcalendar");if(r){q=[i.id]}else{q=b.clone(e)}var o=!h.hasClass("subcalendar-disabled");h.toggleClass("subcalendar-disabled",o);if(!r){h.toggleClass("allchildsubcalendar-disabled",o);b.each(f,b.bind(function(s){s.toggleClass("subcalendar-disabled",o)},this))}if(!c.isDummySubscriptionParentSubCalendar(r?g:i)){q.push(i.id)}if(!c.isSingleCalendarView(k)){l.setSubCalendarEventsHidden(k,q,o,m)}if(o){l.removeSubCalendarEventSource(k,q)}else{l.addSubCalendarEventSource(k,q)}var p="";if(r){if(o){p="hide.event.click."}else{p="show.event.click."}}else{if(o){p="hide.calendar.click."}else{p="show.calendar.click."}}if(c.isSingleCalendarView(k)){p+="singleCalendar"}else{p+=Confluence.TeamCalendars.getCalendarContext()}Confluence.TeamCalendars.fireEventForAnalytics(p)};return{toggleVisibility:function(){j()}}};return a});
}catch(e){WRMCB(e)};
;
try {
/* module-key = 'com.atlassian.confluence.extra.team-calendars:calendars-in-space', location = 'com/atlassian/confluence/extra/calendar3/components/calendars-in-space/calendar-navigation-buttons-view.js' */
define("tc/subcalendar-navigation-buttons-view",["jquery","underscore","tc/calendar-util","tc/util","tc/calendar-add-inline-dialog","tc-backbone"],function(d,a,b,f,c,g){var e=g.View.extend({events:{"click .edit-calendar-button, #editCalendarLink":"_onEditButtonClick","click .add-calendar-button":"_onAddButtonClick"},initialize:function(h){this.calendarDiv=h.calendarDiv;this.CalendarPlugin=h.CalendarPlugin;AJS.bind("calendar.loaded",a.bind(this._onCalendarLoaded,this));AJS.bind("calendar.removed",a.bind(this._onCalendarRemoved,this));AJS.bind("calendar.watch.statuses.loaded",a.bind(this._onWatchStatusLoaded,this));this.inlineAddCalendarDialog=new c({callbackHandler:this.CalendarPlugin.getRenderedMacroCallbackHandler(this.calendarDiv)})},render:function(){this._initShareButton();if(b.isSpaceCalendarView(this.calendarDiv)){var i=!d(".no-calendar-page").is(":visible");this.$(".add-calendar-button").toggleClass("hidden",!i);this.$(".add-calendar-button-more").toggleClass("hidden",!i)}else{if(b.isSingleCalendarView(this.calendarDiv)){if(this.subCalendar){var h=this.CalendarPlugin.getParameter(this.calendarDiv,"readOnly")!=="true"&&this.subCalendar.editable&&this.subCalendar.eventsEditable;this.$(".edit-calendar-button").toggleClass("hidden",!h)}}}this.inlineAddCalendarDialog.render()},_initShareButton:function(){var i=!d(".no-calendar-page").is(":visible");var j=b.getParameter(this.calendarDiv,"enableShareCalendar");var k=true;if(this.subCalendar){k=this.subCalendar.eventsViewable}this.$(".share-calendar-button").toggleClass("hidden",!i||!j||!k);if(AJS.Confluence.SharePage&&!this.shareDialogLoaded){AJS.Confluence.SharePage.initDialog(d(".share-calendar-button"),"shareContentPopup",{offsetX:-110});this.shareDialogLoaded=true;var h="spaceCalendars";if(b.isSingleCalendarView(this.calendarDiv)){h="singleCalendar"}d(".share-calendar-button").click(function(l){Confluence.TeamCalendars.fireEventForAnalytics("share.calendar.click."+h)})}},_onEditButtonClick:function(h){this.CalendarPlugin.showSubCalendarEdit(this.calendarDiv,this.subCalendar);d("#edit-calendar-dialog").find(".button-panel-button.submit").removeClass("hidden");h.preventDefault();return false},_onCalendarLoaded:function(i,h){if(b.isSingleCalendarView(this.calendarDiv)){this.subCalendar=h}var j=this.CalendarPlugin.getParameter(this.calendarDiv,"contentId");AJS.params.pageId=j?j:AJS.params.pageId;this.render()},_onCalendarRemoved:function(){this.render()},_onWatchStatusLoaded:function(i,h){},_onAddButtonClick:function(i){Confluence.TeamCalendars.fireEventForAnalytics("add.calendar.click.new."+Confluence.TeamCalendars.getCalendarContext());var h=Confluence.TeamCalendars.Dialogs.getSubCalendarCreateDialog("parent",this.CalendarPlugin.getRenderedMacroCallbackHandler(this.calendarDiv));f.showDialogInUpdatedHeight(h);d("input[name='name']",h.getCurrentPanel().body).focus();d("#inline-dialog-inline-dialog-more").hide();i.preventDefault();return false}});return e});
}catch(e){WRMCB(e)};
;
try {
/* module-key = 'com.atlassian.confluence.extra.team-calendars:calendars-in-space', location = 'com/atlassian/confluence/extra/calendar3/components/calendars-in-space/calendar-restriction-button-view.js' */
define("tc/subcalendar-restriction-button-view",["jquery","underscore","tc/calendar-util"],function(d,a,b){var c=Backbone.View.extend({events:{"click .restrict-calendar-button":"_onRestrictionClick"},initialize:function(e){this.calendarDiv=e.calendarDiv;this.CalendarPlugin=e.CalendarPlugin;AJS.bind("calendar.loaded",a.bind(this._onCalendarLoaded,this))},render:function(){var e=b.hasRestriction(this.subCalendar);this.$(".restrict-calendar-button.restricted").toggleClass("hidden",!e);this.$(".restrict-calendar-button.no-restricted").toggleClass("hidden",e)},_onRestrictionClick:function(){if(this.CalendarPlugin.getParameter(this.calendarDiv,"readOnly")!=="true"&&this.subCalendar.administrable&&!b.isJiraSubCalendar(this.subCalendar)){this.CalendarPlugin.getSubCalendarRestrictionsDialog(this.calendarDiv,this.subCalendar)}event.preventDefault()},_onCalendarLoaded:function(f,e){if(b.isSingleCalendarView(this.calendarDiv)){this.subCalendar=e;this.render()}}});return c});
}catch(e){WRMCB(e)};
;
try {
/* module-key = 'com.atlassian.confluence.extra.team-calendars:internal-subscription-subcalendar', location = 'com/atlassian/confluence/extra/calendar3/components/internal-subscription-subcalendar/internal-subscription-subcalendar.js' */
define("tc/internal-subscription-subcalendar",["jquery","tc/templates","tc/calendar-util"],function(d,b,a){var c=Backbone.View.extend({getDialog:function(i,f,e){var h;var g;var j=function(m,l){m.resetFieldErrors();if(m.isNewCalendar()){m.setFormModeCreate();m.setHeading("New calendar",i);m.setSubCalendarIdField("");m.setSubscriptionIdField("");m.setNameField("");m.setDescriptionField("");m.setColorField(e.getNextCalendarColor());m.setSpaceToDefault();m.setTimeZoneIdDisplayField("")}else{m.setFormModeEdit();m.setHeading(f.name,i);m.setSubCalendarIdField(f.id);m.setSubscriptionIdField(f.subscriptionId||"");m.setNameField(f.name);m.setDescriptionField(f.description);m.setColorField(f.color);m.setSpaceKeyField(f.spaceKey);m.setSpaceKeyAutocompleteField(f.spaceName);m.setTimeZoneIdDisplayField(f.timeZoneId);if(!(f.restrictable&&f.administrable)){d(".field-group-permissions",l).remove()}}var n=d("textarea[name='description'], input[name='spaceKeyAutocomplete']",l);if(e.isCalendarInEditMode()){n.removeAttr("readonly")}else{m.setFormModeReadOnly();n.attr("readonly","readonly")}if(m.isNewCalendar()&&AJS.Meta.get("space-key")){var k=d(".field-group-space-permission",l);k.addClass("hidden")}};return{initializeForm:function(k){i.addHeader("New calendar");i.addPanel("General",b.editInternalSubcalendar(),"calendar-dialog-panel");g=d("form.sub-calendar-edit-form",i.getCurrentPanel().body);h=Confluence.TeamCalendars.getEditCalendarDialogHelper(g,f,e);h.initSpaceDropDown();h.initOkButton("OK",i);h.initCloseButton(i,k);j(h,g);return g},getFormDataAsAjaxData:function(){var k={type:"internal-subscription",subCalendarId:d("input[name='subCalendarId']",g).val(),name:d("input[name='name']",g).val(),description:d("textarea[name='description']",g).val(),color:d("input[name='color']",g).val(),spaceKey:d("input[name='spaceKeyAutocomplete']",g).val()?d("input[name='spaceKey']",g).val():"",location:"subscription://"+d("input[name='subscriptionId']",g).val()};a.putCalendarContextParams(k);return k},onSubmitStart:function(){h.disableOkButton("Adding...")},onSubmitEnd:function(){h.enableOkButton("OK")}}},weight:1000,typeName:"Unknown Type"});return c});
}catch(e){WRMCB(e)};
;
try {
/* module-key = 'com.atlassian.confluence.extra.team-calendars:internal-subscription-subcalendar', location = 'com/atlassian/confluence/extra/calendar3/components/internal-subscription-subcalendar/internal-subscription-subcalendar.soy' */
// This file was automatically generated from internal-subscription-subcalendar.soy.
// Please don't edit this file by hand.

/**
 * @fileoverview Templates in namespace Confluence.TeamCalendars.Templates.
 */

if (typeof Confluence == 'undefined') { var Confluence = {}; }
if (typeof Confluence.TeamCalendars == 'undefined') { Confluence.TeamCalendars = {}; }
if (typeof Confluence.TeamCalendars.Templates == 'undefined') { Confluence.TeamCalendars.Templates = {}; }


Confluence.TeamCalendars.Templates.editInternalSubcalendar = function(opt_data, opt_ignored) {
  return '<form name="editSubCalendarForm" class="sub-calendar-edit-form aui" method="POST" action="#"><input type="hidden" name="subCalendarId" value=""><input type="hidden" name="type" value="internal-subscription"><input type="hidden" name="color" value=""><input type="hidden" name="subscriptionId" value=""><input type="hidden" name="spaceKey" value=""><div class="form-mode create"><div class="subcalendar-type subcalendar-interal-subscription"><div class="field-group field-group-name"><label for="name">' + soy.$$escapeHtml('Name') + '<span class="aui-icon icon-required"></span></label><input name="name" id="name" type="text" class="text" value="" autocomplete="off"><div class="error name-error"></div></div><div class="field-group field-group-description"><label for="description">' + soy.$$escapeHtml('Description') + '</label><textarea name="description" id="description" rows="5" class="textarea"></textarea></div><div class="field-group field-group-space-permission"><label for="spaceKeyAutocomplete">' + soy.$$escapeHtml('Related space') + '<span class="aui-icon icon-required"></span></label><input name="spaceKeyAutocomplete" id="spaceKeyAutocomplete" type="text" class="autocomplete-space text" data-max="5" data-none-message="' + soy.$$escapeHtml('No spaces found') + '"><div class="description">' + soy.$$escapeHtml('Link this calendar to a space.') + '</div><div class="error spaceKeyAutocomplete-error"></div></div><div class="field-group field-group-timezone-display"><label>' + soy.$$escapeHtml('Time zone') + '</label><span class="timeZoneIdDisplay field-value"></span></div></div></div></form>';
};
if (goog.DEBUG) {
  Confluence.TeamCalendars.Templates.editInternalSubcalendar.soyTemplateName = 'Confluence.TeamCalendars.Templates.editInternalSubcalendar';
}

}catch(e){WRMCB(e)};
;
try {
/* module-key = 'com.atlassian.confluence.extra.team-calendars:internal-subscription-subcalendar', location = 'com/atlassian/confluence/extra/calendar3/components/internal-subscription-subcalendar/internal-subscription-subcalendar-compact.js' */
require(["tc/internal-subscription-subcalendar"],function(a){if(!window.Confluence.TeamCalendars.subcalendar){window.Confluence.TeamCalendars.subcalendar={}}if(!window.Confluence.TeamCalendars.subcalendar["internal-subscription"]){window.Confluence.TeamCalendars.subcalendar["internal-subscription"]=new a({})}});
}catch(e){WRMCB(e)};
;
try {
/* module-key = 'com.atlassian.confluence.extra.team-calendars:infinite-list', location = 'com/atlassian/confluence/extra/calendar3/components/infinite-list/infinitelist.js' */
define("tc/infinite-list",["jquery","underscore","tc-backbone","exports"],function(d,b,e,a){function c(p){var h=p.$el;var o=p.load;var n=p.$container||d(window);var i=p.body||document.body;var g=p.scrollMargin||300;var k=p.isLoadMoreItems||false;var j=h.data("page-size");var l=1;function f(){o(l,j);l+=1}function m(){var r=k==true?k:h.children().length>=j;var q=i.scrollHeight-n.scrollTop()-g<=n.height();if(r&&q){f()}}n.bind("scroll.list",b.debounce(m,100));m();this.destroy=function(){n.off("scroll.list")}}b.extend(c.prototype,e.Events);a.init=function(f){return new c(f)}});
}catch(e){WRMCB(e)};
;
try {
/* module-key = 'com.atlassian.confluence.extra.team-calendars:non-space-calendars-dialog', location = 'com/atlassian/confluence/extra/calendar3/components/non-space-calendars-dialog/non-space-calendar-entry-view.js' */
define("tc/non-space-calendar-entry-view",["jquery","underscore","tc-backbone","ajs","tc/calendar-util"],function(d,b,f,a,c){var e=f.View.extend({initialize:function(g){this.template=Confluence.TeamCalendars.Templates.nonSpaceCalendarEntry;this.subCalendar=g.subCalendar;this.CalendarPlugin=g.CalendarPlugin;this.calendarDiv=g.calendarDiv;this.cache=g.cache},render:function(){this.$el.html(this.template({subCalendar:this.subCalendar}));this.spaceKeyAutocompleteField=this.$("input.autocomplete-space");this.spaceKeyField=this.$("input.space-key");this.spaceKeyAutocompleteField.keypress(b.bind(function(g){if(g.which!==13){this.spaceKeyField.val(g.which)}},this));this.spaceKeyAutocompleteField.bind("selected.autocomplete-content",b.bind(function(h,g){this.spaceKeyField.val(g.content.key);this.spaceKeyAutocompleteField.val(g.content.name)},this));this.successIcon=this.$(".success-icon");this.errorIcon=this.$(".error-icon");this.spinnerIcon=this.$(".spinner");this.errorMessageDiv=this.$(".error-message");return this.$el},getData:function(){return{calendarId:this.subCalendar.id,spaceKey:this.spaceKeyField.val()}},isUpdateSuccessfully:function(){return this.spaceKeyAutocompleteField.attr("updated")==="true"},updateSubCalendar:function(){if(this.isUpdateSuccessfully()){return}var g=this.getData();if(!g.spaceKey){return}this.spinnerIcon.show();return d.ajax({cache:false,data:JSON.stringify(g),contentType:"application/json",dataFilter:function(h){var i=d.parseJSON(h);if(i.success){c.mergeSubCalendarObjectsToArray(i.payload)}return i},dataType:"json",converters:{"text json":function(h){return h}},error:b.bind(function(i,k,j){var h=JSON.parse(i.responseText)[0]||"Uh oh. Looks like something unexpectedly went wrong. Please check the Confluence log file.";this._showResult(false,h);c.fireEventForAnalytics("non.space.calendars.upgrade.one.calendar.failed")},this),success:b.bind(function(h){if(h.success){this._showResult(true,"");this._hide();this.CalendarPlugin.setSubCalendar(g.calendarId,this.calendarDiv,h.payload);c.fireEventForAnalytics("non.space.calendars.upgrade.one.calendar.successful")}else{var i=(h.fieldErrors&&h.fieldErrors.length)?h.fieldErrors[0].errorMessages[0]:"Uh oh. Looks like something unexpectedly went wrong. Please check the Confluence log file.";this._showResult(false,i);c.fireEventForAnalytics("non.space.calendars.upgrade.one.calendar.failed")}},this),type:"POST",timeout:c.ajaxTimeout,url:Confluence.TeamCalendars.getCalendarServiceBaseUrl("/subcalendar/space")})},_hide:function(){this.$el.animate({height:0,opacity:0},500,function(){d(this).remove()})},_showResult:function(h,g){this.spinnerIcon.hide();this.successIcon.toggleClass("hidden",!h);this.errorIcon.toggleClass("hidden",h);this.errorMessageDiv.toggleClass("hidden",h);if(h){this.spaceKeyAutocompleteField.prop("disabled",true);this.spaceKeyAutocompleteField.attr("updated","true")}if(g){this.errorMessageDiv.text(g)}}});return e});
}catch(e){WRMCB(e)};
;
try {
/* module-key = 'com.atlassian.confluence.extra.team-calendars:non-space-calendars-dialog', location = 'com/atlassian/confluence/extra/calendar3/components/non-space-calendars-dialog/non-space-calendars-dialog-view.js' */
define("tc/non-space-calendars-dialog-view",["jquery","underscore","tc-backbone","ajs","tc/calendar-util","tc/non-space-calendar-entry-view"],function(e,b,h,a,d,f){var c;var g=h.View.extend({events:{},initialize:function(i){this.subCalendars=i.subCalendars;this.nonSpaceCalendarEntryViews=[];this.CalendarPlugin=i.CalendarPlugin;this.calendarDiv=i.calendarDiv;this.cache=i.cache},setSubCalendars:function(i){this.subCalendars=i},render:function(){if(!c){c=this.dialog=new a.Dialog(600,600,"non-space-calendars-dialog");var i="Your calendars need a related space";c.addHeader(i);c.addPanel(i,Confluence.TeamCalendars.Templates.nonSpaceCalendarsDialog(),"non-space-calendars-panel");c.addSubmit("Save",b.bind(this._onSubmit,this));c.addCancel("Not right now",b.bind(this._onCancel,this));this.setElement(c.getCurPanel().body)}this._renderNonSpaceCalendarEntries();c.show()},_renderNonSpaceCalendarEntries:function(){this.nonSpaceCalendarEntryViews=[];this.$(".non-space-calendars-list").empty();b.each(this.subCalendars,b.bind(function(j){var i=new f({subCalendar:j,CalendarPlugin:this.CalendarPlugin,calendarDiv:this.calendarDiv,cache:this.cache});this.nonSpaceCalendarEntryViews.push(i);this.$(".non-space-calendars-list").append(i.render())},this))},_onSubmit:function(){var i=[];b.each(this.nonSpaceCalendarEntryViews,function(j){var k=j.updateSubCalendar("onSubmit");if(k!==undefined){i.push(k)}});e.when.apply(e,i).done(b.bind(function(){var j=true;b.each(this.nonSpaceCalendarEntryViews,function(k){if(!k.isUpdateSuccessfully()){j=false}});if(j){this.CalendarPlugin.updateAvailableSubCalendarsInSubCalendarPanel(this.calendarDiv);c.hide();d.fireEventForAnalytics("non.space.calendars.upgrade.all.calendars.successful")}},this));d.fireEventForAnalytics("non.space.calendars.upgrade.dialog.submit.click");return false},_onCancel:function(){var i=false;b.each(this.nonSpaceCalendarEntryViews,function(j){if(j.isUpdateSuccessfully()){i=true}});if(i){this.CalendarPlugin.updateAvailableSubCalendarsInSubCalendarPanel(this.calendarDiv)}c.hide();d.fireEventForAnalytics("non.space.calendars.upgrade.dialog.cancel.click");return false}});return g});
}catch(e){WRMCB(e)};
;
try {
/* module-key = 'com.atlassian.confluence.extra.team-calendars:non-space-calendars-dialog', location = 'com/atlassian/confluence/extra/calendar3/components/non-space-calendars-dialog/non-space-calendars-handler.js' */
define("tc/non-space-calendars-handler",["jquery","underscore","tc/calendar-util","tc/non-space-calendars-warning-view"],function(d,a,b,e){var c;return{handle:function(j,i,f,h){if(b.isMyCalendarView(i)){var g=a.filter(h,function(k){return k.eventsEditable&&(k.spaceKey===undefined||k.spaceKey==="")});if(!c){c=new e({el:".non-space-calendars-warning",CalendarPlugin:j,calendarDiv:i,cache:f})}c.render(g)}}}});
}catch(e){WRMCB(e)};
;
try {
/* module-key = 'com.atlassian.confluence.extra.team-calendars:non-space-calendars-dialog', location = 'com/atlassian/confluence/extra/calendar3/components/non-space-calendars-dialog/non-space-calendars-warning-view.js' */
define("tc/non-space-calendars-warning-view",["jquery","underscore","tc-backbone","ajs","tc/calendar-util","tc/non-space-calendars-dialog-view"],function(d,b,g,a,c,f){var e=g.View.extend({events:{"click .fix-calendars-link":"_onFixCalendarLinkClick"},initialize:function(h){this.CalendarPlugin=h.CalendarPlugin;this.calendarDiv=h.calendarDiv;this.cache=h.cache},render:function(h){this.nonSpaceCalendars=h;this.$(".title strong").text(a.format("{0} of these calendars need a related space.",this.nonSpaceCalendars.length));if(this.nonSpaceCalendars&&this.nonSpaceCalendars.length>0){this.show()}else{this.hide()}},show:function(){this.$el.removeClass("hidden")},hide:function(){this.$el.addClass("hidden")},_onFixCalendarLinkClick:function(){if(!this.nonSpaceCalendarsDialogView){this.nonSpaceCalendarsDialogView=new f({subCalendars:this.nonSpaceCalendars,CalendarPlugin:this.CalendarPlugin,calendarDiv:this.calendarDiv,cache:this.cache})}this.nonSpaceCalendarsDialogView.setSubCalendars(this.nonSpaceCalendars);this.nonSpaceCalendarsDialogView.render();c.fireEventForAnalytics("non.space.calendars.upgrade.link.click");return false}});return e});
}catch(e){WRMCB(e)};
;
try {
/* module-key = 'com.atlassian.confluence.extra.team-calendars:non-space-calendars-dialog', location = 'com/atlassian/confluence/extra/calendar3/components/non-space-calendars-dialog/non-space-calendars-dialog.soy' */
// This file was automatically generated from non-space-calendars-dialog.soy.
// Please don't edit this file by hand.

/**
 * @fileoverview Templates in namespace Confluence.TeamCalendars.Templates.
 */

if (typeof Confluence == 'undefined') { var Confluence = {}; }
if (typeof Confluence.TeamCalendars == 'undefined') { Confluence.TeamCalendars = {}; }
if (typeof Confluence.TeamCalendars.Templates == 'undefined') { Confluence.TeamCalendars.Templates = {}; }


Confluence.TeamCalendars.Templates.nonSpaceCalendarsDialog = function(opt_data, opt_ignored) {
  return '<div class="non-space-calendars-dialog"><div class="info"><span><b>' + soy.$$escapeHtml('Set a related space for these calendars, to make them easier to:') + '</b></span><ul><li><b>' + soy.$$escapeHtml('Discover') + '</b> \u2013 ' + soy.$$escapeHtml('Calendars where you work, in your team or project space') + '</li><li><b>' + soy.$$escapeHtml('Watch') + '</b> \u2013 ' + soy.$$escapeHtml('When you watch a space, youre automatically watching its calendars') + '</li><li><b>' + soy.$$escapeHtml('Manage') + '</b> \u2013 ' + soy.$$escapeHtml('Only people with permission to view a space can see its calendars') + '</li><li><b>' + soy.$$escapeHtml('Share') + '</b> \u2013 ' + soy.$$escapeHtml('Share space calendars just like you would with a Confluence page') + '</li></ul></div><div class="separator"></div><form class="aui non-space-calendars-form"><div class="header"><div class="col1"><b>' + soy.$$escapeHtml('Calendar') + '</b></div><div class="col2"><b>' + soy.$$escapeHtml('Related Space') + '</b></div></div><div class="non-space-calendars-list"></div></form></div>';
};
if (goog.DEBUG) {
  Confluence.TeamCalendars.Templates.nonSpaceCalendarsDialog.soyTemplateName = 'Confluence.TeamCalendars.Templates.nonSpaceCalendarsDialog';
}


Confluence.TeamCalendars.Templates.nonSpaceCalendarEntry = function(opt_data, opt_ignored) {
  return '<div class="field-group field-group-' + soy.$$escapeHtml(opt_data.subCalendar.id) + '"><label for="spaceKeyAutocomplete-' + soy.$$escapeHtml(opt_data.subCalendar.id) + '">' + soy.$$escapeHtml(opt_data.subCalendar.name) + '</label><input name="spaceKeyAutocomplete-' + soy.$$escapeHtml(opt_data.subCalendar.id) + '" type="text" class="autocomplete-space text" data-max="5" placeholder="' + soy.$$escapeHtml('Enter space name') + '" data-none-message="' + soy.$$escapeHtml('No spaces found') + '" data-template="{key}" data-dropdown-target=".field-group-' + soy.$$escapeHtml(opt_data.subCalendar.id) + ' .dropdown"><div class="status-icon"><div class="spinner invisible aui-icon aui-icon-wait hidden"></div><span class="aui-icon aui-icon-error error-icon hidden"></span><span class="success aui-icon aui-icon-success success-icon hidden"></span></div><div class="spaceKeyAutocomplete-error error-message"></div><div class="dropdown"></div><input name="spaceKey-' + soy.$$escapeHtml(opt_data.subCalendar.id) + '" type="hidden" class="space-key"></input></div>';
};
if (goog.DEBUG) {
  Confluence.TeamCalendars.Templates.nonSpaceCalendarEntry.soyTemplateName = 'Confluence.TeamCalendars.Templates.nonSpaceCalendarEntry';
}

}catch(e){WRMCB(e)};
;
try {
/* module-key = 'com.atlassian.confluence.extra.team-calendars:calendar-resources', location = 'com/atlassian/confluence/extra/calendar3/lib/jquery-plugins/jquery.ThreeDots.js' */
(function(e){e.fn.ThreeDots=function(h){var g=this;if((typeof h=="object")||(h==undefined)){e.fn.ThreeDots.the_selected=this;var g=e.fn.ThreeDots.update(h)}return g};e.fn.ThreeDots.update=function(u){var k,t=null;var m,j,s,q,o;var l,i;var r,h,n;if((typeof u=="object")||(u==undefined)){e.fn.ThreeDots.c_settings=e.extend({},e.fn.ThreeDots.settings,u);var p=e.fn.ThreeDots.c_settings.max_rows;if(p<1){return e.fn.ThreeDots.the_selected}var g=false;jQuery.each(e.fn.ThreeDots.c_settings.valid_delimiters,function(v,w){if(((new String(w)).length==1)){g=true}});if(g==false){return e.fn.ThreeDots.the_selected}e.fn.ThreeDots.the_selected.each(function(){k=e(this);if(e(k).children("."+e.fn.ThreeDots.c_settings.text_span_class).length==0){return true}l=e(k).children("."+e.fn.ThreeDots.c_settings.text_span_class).get(0);var y=a(k,true);var x=e(l).text();d(k,l,y);var v=e(l).text();if((h=e(k).attr("threedots"))!=undefined){e(l).text(h);e(k).children("."+e.fn.ThreeDots.c_settings.e_span_class).remove()}r=e(l).text();if(r.length<=0){r=""}e(k).attr("threedots",x);if(a(k,y)>p){curr_ellipsis=e(k).append('<span style="white-space:nowrap" class="'+e.fn.ThreeDots.c_settings.e_span_class+'">'+e.fn.ThreeDots.c_settings.ellipsis_string+"</span>");while(a(k,y)>p){i=b(e(l).text());e(l).text(i.updated_string);t=i.word;n=i.del;if(n==null){break}}if(t!=null){var w=c(k,y);if((a(k,y)<=p-1)||(w)||(!e.fn.ThreeDots.c_settings.whole_word)){r=e(l).text();if(i.del!=null){e(l).text(r+n)}if(a(k,y)>p){e(l).text(r)}else{e(l).text(e(l).text()+t);if((a(k,y)>p+1)||(!e.fn.ThreeDots.c_settings.whole_word)||(v==t)||w){while((a(k,y)>p)){if(e(l).text().length>0){e(l).text(e(l).text().substr(0,e(l).text().length-1))}else{break}}}}}}}if(x==e(e(k).children("."+e.fn.ThreeDots.c_settings.text_span_class).get(0)).text()){e(k).children("."+e.fn.ThreeDots.c_settings.e_span_class).remove()}else{if((e(k).children("."+e.fn.ThreeDots.c_settings.e_span_class)).length>0){if(e.fn.ThreeDots.c_settings.alt_text_t){e(k).children("."+e.fn.ThreeDots.c_settings.text_span_class).attr("title",x)}if(e.fn.ThreeDots.c_settings.alt_text_e){e(k).children("."+e.fn.ThreeDots.c_settings.e_span_class).attr("title",x)}}}})}return e.fn.ThreeDots.the_selected};e.fn.ThreeDots.settings={valid_delimiters:[" ",",","."],ellipsis_string:"...",max_rows:2,text_span_class:"ellipsis_text",e_span_class:"threedots_ellipsis",whole_word:true,allow_dangle:false,alt_text_e:false,alt_text_t:false};function c(k,h){if(e.fn.ThreeDots.c_settings.allow_dangle==true){return false}var l=e(k).children("."+e.fn.ThreeDots.c_settings.e_span_class).get(0);var g=e(l).css("display");var i=a(k,h);e(l).css("display","none");var j=a(k,h);e(l).css("display",g);if(i>j){return true}else{return false}}function a(i,j){var g=typeof j;if((g=="object")||(g==undefined)){return e(i).height()/j.lh}else{if(g=="boolean"){var h=f(e(i));return{lh:h}}}}function b(k){var j;var i=e.fn.ThreeDots.c_settings.valid_delimiters;k=jQuery.trim(k);var g=-1;var h=null;var l=null;jQuery.each(i,function(m,o){if(((new String(o)).length!=1)||(o==null)){return false}var n=k.lastIndexOf(o);if(n!=-1){if(n>g){g=n;h=k.substring(g+1);l=o}}});if(g>0){return{updated_string:jQuery.trim(k.substring(0,g)),word:h,del:l}}else{return{updated_string:"",word:jQuery.trim(k),del:null}}}function f(h){e(h).append("<div id='temp_ellipsis_div' style='position:absolute; visibility:hidden'>H</div>");var g=e("#temp_ellipsis_div").height();e("#temp_ellipsis_div").remove();return g}function d(k,l,m){var q=e(l).text();var i=q;var o=e.fn.ThreeDots.c_settings.max_rows;var h,g,n,r,j;var p;if(a(k,m)<=o){return}else{p=0;curr_length=i.length;curr_middle=Math.floor((curr_length-p)/2);h=q.substring(p,p+curr_middle);g=q.substring(p+curr_middle);while(curr_middle!=0){e(l).text(h);if(a(k,m)<=(o)){j=Math.floor(g.length/2);n=g.substring(0,j);p=h.length;i=h+n;curr_length=i.length;e(l).text(i)}else{i=h;curr_length=i.length}curr_middle=Math.floor((curr_length-p)/2);h=q.substring(0,p+curr_middle);g=q.substring(p+curr_middle)}}}})(jQuery);
}catch(e){WRMCB(e)};
;
try {
/* module-key = 'com.atlassian.confluence.extra.team-calendars:calendar-resources', location = 'com/atlassian/confluence/extra/calendar3/lib/jquery-plugins/jquery.ui.autocomplete.js' */
(function(a){a.widget("ui.autocompleteTC",{options:{minLength:1,delay:300},_create:function(){var b=this,c=this.element[0].ownerDocument;this.element.addClass("ui-autocomplete-input").attr("autocomplete","off").attr({role:"textbox","aria-autocomplete":"list","aria-haspopup":"true"}).bind("keydown.autocomplete",function(d){var e=a.ui.keyCode;switch(d.keyCode){case e.PAGE_UP:b._move("previousPage",d);break;case e.PAGE_DOWN:b._move("nextPage",d);break;case e.UP:b._move("previous",d);d.preventDefault();break;case e.DOWN:b._move("next",d);d.preventDefault();break;case e.ENTER:if(b.menu.active){d.preventDefault()}case e.TAB:if(!b.menu.active){return}b.menu.select(d);break;case e.ESCAPE:b.element.val(b.term);b.close(d);break;case e.LEFT:case e.RIGHT:case e.SHIFT:case e.CONTROL:case e.ALT:break;default:clearTimeout(b.searching);b.searching=setTimeout(function(){b.search(null,d)},b.options.delay);break}}).bind("focus.autocomplete",function(){b.selectedItem=null;b.previous=b.element.val()}).bind("blur.autocomplete",function(d){clearTimeout(b.searching);b.closing=setTimeout(function(){b.close(d);b._change(d)},150)});this._initSource();this.response=function(){return b._response.apply(b,arguments)};this.menu=a("<ul></ul>").addClass("ui-autocomplete").appendTo("body",c).menu({focus:function(e,f){var d=f.item.data("item.autocomplete");if(false!==b._trigger("focus",null,{item:d})){if(/^key/.test(e.originalEvent.type)){b.element.val(d.value)}}},selected:function(f,g){var e=g.item.data("item.autocomplete");if(false!==b._trigger("select",f,{item:e})){b.element.val(e.value)}b.close(f);var d=b.previous;if(b.element[0]!==c.activeElement){b.element.focus();b.previous=d}b.selectedItem=e},blur:function(d,e){if(b.menu.element.is(":visible")){b.element.val(b.term)}}}).zIndex(this.element.zIndex()+1).css({top:0,left:0}).hide().data("menu");if(a.fn.bgiframe){this.menu.element.bgiframe()}},destroy:function(){this.element.removeClass("ui-autocomplete-input").removeAttr("autocomplete").removeAttr("role").removeAttr("aria-autocomplete").removeAttr("aria-haspopup");this.menu.element.remove();a.Widget.prototype.destroy.call(this)},_setOption:function(b){a.Widget.prototype._setOption.apply(this,arguments);if(b==="source"){this._initSource()}},_initSource:function(){var c,b;if(a.isArray(this.options.source)){c=this.options.source;this.source=function(e,d){d(a.ui.autocompleteTC.filter(c,e.term))}}else{if(typeof this.options.source==="string"){b=this.options.source;this.source=function(e,d){a.getJSON(b,e,d)}}else{this.source=this.options.source}}},search:function(c,b){c=c!=null?c:this.element.val();if(c.length<this.options.minLength){return this.close(b)}clearTimeout(this.closing);if(this._trigger("search")===false){return}return this._search(c)},_search:function(b){this.term=this.element.addClass("ui-autocomplete-loading").val();this.source({term:b},this.response)},_response:function(b){if(b.length){b=this._normalize(b);this._suggest(b);this._trigger("open")}else{this.close()}this.element.removeClass("ui-autocomplete-loading")},close:function(b){clearTimeout(this.closing);if(this.menu.element.is(":visible")){this._trigger("close",b);this.menu.element.hide();this.menu.deactivate()}},_change:function(b){if(this.previous!==this.element.val()){this._trigger("change",b,{item:this.selectedItem})}},_normalize:function(b){if(b.length&&b[0].label&&b[0].value){return b}return a.map(b,function(c){if(typeof c==="string"){return{label:c,value:c}}return a.extend({label:c.label||c.value,value:c.value||c.label},c)})},_suggest:function(b){var c=this.menu.element.empty().zIndex(this.element.zIndex()+1),d,e;this._renderMenu(c,b);this.menu.deactivate();this.menu.refresh();this.menu.element.show().position({my:"left top",at:"left bottom",of:this.element,collision:"none"});d=c.width("").width();e=this.element.width();c.width(Math.max(d,e))},_renderMenu:function(d,c){var b=this;a.each(c,function(e,f){b._renderItem(d,f)})},_renderItem:function(b,c){return a("<li></li>").data("item.autocomplete",c).append("<a>"+c.label+"</a>").appendTo(b)},_move:function(c,b){if(!this.menu.element.is(":visible")){this.search(null,b);return}if(this.menu.first()&&/^previous/.test(c)||this.menu.last()&&/^next/.test(c)){this.element.val(this.term);this.menu.deactivate();return}this.menu[c](b)},widget:function(){return this.menu.element}});a.extend(a.ui.autocompleteTC,{escapeRegex:function(b){return b.replace(/([\^\$\(\)\[\]\{\}\*\.\+\?\|\\])/gi,"\\$1")},filter:function(d,b){var c=new RegExp(a.ui.autocompleteTC.escapeRegex(b),"i");return a.grep(d,function(e){return c.test(e.label||e.value||e)})}})}(jQuery));(function(a){a.widget("ui.menu",{_create:function(){var b=this;this.element.addClass("ui-menu ui-widget ui-widget-content ui-corner-all").attr({role:"listbox","aria-activedescendant":"ui-active-menuitem"}).click(function(c){if(!a(c.target).closest(".ui-menu-item a").length){return}c.preventDefault();b.select(c)});this.refresh()},refresh:function(){var c=this;var b=this.element.children("li:not(.ui-menu-item):has(a)").addClass("ui-menu-item").attr("role","menuitem");b.children("a").addClass("ui-corner-all").attr("tabindex",-1).mouseenter(function(d){c.activate(d,a(this).parent())}).mouseleave(function(){c.deactivate()})},activate:function(e,d){this.deactivate();if(this.hasScroll()){var f=d.offset().top-this.element.offset().top,b=this.element.attr("scrollTop"),c=this.element.height();if(f<0){this.element.attr("scrollTop",b+f)}else{if(f>c){this.element.attr("scrollTop",b+f-c+d.height())}}}this.active=d.eq(0).children("a").addClass("ui-state-hover").attr("id","ui-active-menuitem").end();this._trigger("focus",e,{item:d})},deactivate:function(){if(!this.active){return}this.active.children("a").removeClass("ui-state-hover").removeAttr("id");this._trigger("blur");this.active=null},next:function(b){this.move("next",".ui-menu-item:first",b)},previous:function(b){this.move("prev",".ui-menu-item:last",b)},first:function(){return this.active&&!this.active.prev().length},last:function(){return this.active&&!this.active.next().length},move:function(e,d,c){if(!this.active){this.activate(c,this.element.children(d));return}var b=this.active[e+"All"](".ui-menu-item").eq(0);if(b.length){this.activate(c,b)}else{this.activate(c,this.element.children(d))}},nextPage:function(d){if(this.hasScroll()){if(!this.active||this.last()){this.activate(d,this.element.children(":first"));return}var e=this.active.offset().top,c=this.element.height(),b=this.element.children("li").filter(function(){var f=a(this).offset().top-e-c+a(this).height();return f<10&&f>-10});if(!b.length){b=this.element.children(":last")}this.activate(d,b)}else{this.activate(d,this.element.children(!this.active||this.last()?":first":":last"))}},previousPage:function(c){if(this.hasScroll()){if(!this.active||this.first()){this.activate(c,this.element.children(":last"));return}var d=this.active.offset().top,b=this.element.height();result=this.element.children("li").filter(function(){var e=a(this).offset().top-d+b-a(this).height();return e<10&&e>-10});if(!result.length){result=this.element.children(":first")}this.activate(c,result)}else{this.activate(c,this.element.children(!this.active||this.first()?":last":":first"))}},hasScroll:function(){return this.element.height()<this.element.attr("scrollHeight")},select:function(b){this._trigger("selected",b,{item:this.active})}})}(jQuery));
}catch(e){WRMCB(e)};
;
try {
/* module-key = 'com.atlassian.confluence.extra.team-calendars:calendar-resources', location = 'com/atlassian/confluence/extra/calendar3/lib/jquery-plugins/jquery.ui.datepicker.js' */
(function($,undefined){$.extend($.ui,{datepicker:{version:"1.8.11"}});var PROP_NAME="datepicker";var dpuuid=new Date().getTime();function Datepicker(){this.debug=false;this._curInst=null;this._keyEvent=false;this._disabledInputs=[];this._datepickerShowing=false;this._inDialog=false;this._mainDivId="ui-datepicker-div";this._inlineClass="ui-datepicker-inline";this._appendClass="ui-datepicker-append";this._triggerClass="ui-datepicker-trigger";this._dialogClass="ui-datepicker-dialog";this._disableClass="ui-datepicker-disabled";this._unselectableClass="ui-datepicker-unselectable";this._currentClass="ui-datepicker-current-day";this._dayOverClass="ui-datepicker-days-cell-over";this.regional=[];this.regional[""]={closeText:"Done",prevText:"Prev",nextText:"Next",currentText:"Today",monthNames:["January","February","March","April","May","June","July","August","September","October","November","December"],monthNamesShort:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],dayNames:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],dayNamesShort:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],dayNamesMin:["Su","Mo","Tu","We","Th","Fr","Sa"],weekHeader:"Wk",dateFormat:"mm/dd/yy",firstDay:0,isRTL:false,showMonthAfterYear:false,yearSuffix:""};this._defaults={showOn:"focus",showAnim:"fadeIn",showOptions:{},defaultDate:null,appendText:"",buttonText:"...",buttonImage:"",buttonImageOnly:false,hideIfNoPrevNext:false,navigationAsDateFormat:false,gotoCurrent:false,changeMonth:false,changeYear:false,yearRange:"c-10:c+10",showOtherMonths:false,selectOtherMonths:false,showWeek:false,calculateWeek:this.iso8601Week,shortYearCutoff:"+10",minDate:null,maxDate:null,duration:"fast",beforeShowDay:null,beforeShow:null,onSelect:null,onChangeMonthYear:null,onClose:null,numberOfMonths:1,showCurrentAtPos:0,stepMonths:1,stepBigMonths:12,altField:"",altFormat:"",constrainInput:true,showButtonPanel:false,autoSize:false};$.extend(this._defaults,this.regional[""]);this.dpDiv=$('<div id="'+this._mainDivId+'" class="ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all"></div>')}$.extend(Datepicker.prototype,{markerClassName:"hasDatepicker",log:function(){if(this.debug){console.log.apply("",arguments)}},_widgetDatepicker:function(){return this.dpDiv},setDefaults:function(settings){extendRemove(this._defaults,settings||{});return this},_attachDatepicker:function(target,settings){var inlineSettings=null;for(var attrName in this._defaults){var attrValue=target.getAttribute("date:"+attrName);if(attrValue){inlineSettings=inlineSettings||{};try{inlineSettings[attrName]=eval(attrValue)}catch(err){inlineSettings[attrName]=attrValue}}}var nodeName=target.nodeName.toLowerCase();var inline=(nodeName=="div"||nodeName=="span");if(!target.id){this.uuid+=1;target.id="dp"+this.uuid}var inst=this._newInst($(target),inline);inst.settings=$.extend({},settings||{},inlineSettings||{});if(nodeName=="input"){this._connectDatepicker(target,inst)}else{if(inline){this._inlineDatepicker(target,inst)}}},_newInst:function(target,inline){var id=target[0].id.replace(/([^A-Za-z0-9_-])/g,"\\\\$1");return{id:id,input:target,selectedDay:0,selectedMonth:0,selectedYear:0,drawMonth:0,drawYear:0,inline:inline,dpDiv:(!inline?this.dpDiv:$('<div class="'+this._inlineClass+' ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all"></div>'))}},_connectDatepicker:function(target,inst){var input=$(target);inst.append=$([]);inst.trigger=$([]);if(input.hasClass(this.markerClassName)){return}this._attachments(input,inst);input.addClass(this.markerClassName).keydown(this._doKeyDown).keypress(this._doKeyPress).keyup(this._doKeyUp).bind("setData.datepicker",function(event,key,value){inst.settings[key]=value}).bind("getData.datepicker",function(event,key){return this._get(inst,key)});this._autoSize(inst);$.data(target,PROP_NAME,inst)},_attachments:function(input,inst){var appendText=this._get(inst,"appendText");var isRTL=this._get(inst,"isRTL");if(inst.append){inst.append.remove()}if(appendText){inst.append=$('<span class="'+this._appendClass+'">'+appendText+"</span>");input[isRTL?"before":"after"](inst.append)}input.unbind("focus",this._showDatepicker);if(inst.trigger){inst.trigger.remove()}var showOn=this._get(inst,"showOn");if(showOn=="focus"||showOn=="both"){input.focus(this._showDatepicker)}if(showOn=="button"||showOn=="both"){var buttonText=this._get(inst,"buttonText");var buttonImage=this._get(inst,"buttonImage");inst.trigger=$(this._get(inst,"buttonImageOnly")?$("<img/>").addClass(this._triggerClass).attr({src:buttonImage,alt:buttonText,title:buttonText}):$('<button type="button"></button>').addClass(this._triggerClass).html(buttonImage==""?buttonText:$("<img/>").attr({src:buttonImage,alt:buttonText,title:buttonText})));input[isRTL?"before":"after"](inst.trigger);inst.trigger.click(function(){if(TC_DATE_PICKER._datepickerShowing&&TC_DATE_PICKER._lastInput==input[0]){TC_DATE_PICKER._hideDatepicker()}else{TC_DATE_PICKER._showDatepicker(input[0])}return false})}},_autoSize:function(inst){if(this._get(inst,"autoSize")&&!inst.inline){var date=new Date(2009,12-1,20);var dateFormat=this._get(inst,"dateFormat");if(dateFormat.match(/[DM]/)){var findMax=function(names){var max=0;var maxI=0;for(var i=0;i<names.length;i++){if(names[i].length>max){max=names[i].length;maxI=i}}return maxI};date.setMonth(findMax(this._get(inst,(dateFormat.match(/MM/)?"monthNames":"monthNamesShort"))));date.setDate(findMax(this._get(inst,(dateFormat.match(/DD/)?"dayNames":"dayNamesShort")))+20-date.getDay())}inst.input.attr("size",this._formatDate(inst,date).length)}},_inlineDatepicker:function(target,inst){var divSpan=$(target);if(divSpan.hasClass(this.markerClassName)){return}divSpan.addClass(this.markerClassName).append(inst.dpDiv).bind("setData.datepicker",function(event,key,value){inst.settings[key]=value}).bind("getData.datepicker",function(event,key){return this._get(inst,key)});$.data(target,PROP_NAME,inst);this._setDate(inst,this._getDefaultDate(inst),true);this._updateDatepicker(inst);this._updateAlternate(inst);inst.dpDiv.show()},_dialogDatepicker:function(input,date,onSelect,settings,pos){var inst=this._dialogInst;if(!inst){this.uuid+=1;var id="dp"+this.uuid;this._dialogInput=$('<input type="text" id="'+id+'" style="position: absolute; top: -100px; width: 0px; z-index: -10;"/>');this._dialogInput.keydown(this._doKeyDown);$("body").append(this._dialogInput);inst=this._dialogInst=this._newInst(this._dialogInput,false);inst.settings={};$.data(this._dialogInput[0],PROP_NAME,inst)}extendRemove(inst.settings,settings||{});date=(date&&date.constructor==Date?this._formatDate(inst,date):date);this._dialogInput.val(date);this._pos=(pos?(pos.length?pos:[pos.pageX,pos.pageY]):null);if(!this._pos){var browserWidth=document.documentElement.clientWidth;var browserHeight=document.documentElement.clientHeight;var scrollX=document.documentElement.scrollLeft||document.body.scrollLeft;var scrollY=document.documentElement.scrollTop||document.body.scrollTop;this._pos=[(browserWidth/2)-100+scrollX,(browserHeight/2)-150+scrollY]}this._dialogInput.css("left",(this._pos[0]+20)+"px").css("top",this._pos[1]+"px");inst.settings.onSelect=onSelect;this._inDialog=true;this.dpDiv.addClass(this._dialogClass);this._showDatepicker(this._dialogInput[0]);if($.blockUI){$.blockUI(this.dpDiv)}$.data(this._dialogInput[0],PROP_NAME,inst);return this},_destroyDatepicker:function(target){var $target=$(target);var inst=$.data(target,PROP_NAME);if(!$target.hasClass(this.markerClassName)){return}var nodeName=target.nodeName.toLowerCase();$.removeData(target,PROP_NAME);if(nodeName=="input"){inst.append.remove();inst.trigger.remove();$target.removeClass(this.markerClassName).unbind("focus",this._showDatepicker).unbind("keydown",this._doKeyDown).unbind("keypress",this._doKeyPress).unbind("keyup",this._doKeyUp)}else{if(nodeName=="div"||nodeName=="span"){$target.removeClass(this.markerClassName).empty()}}},_enableDatepicker:function(target){var $target=$(target);var inst=$.data(target,PROP_NAME);if(!$target.hasClass(this.markerClassName)){return}var nodeName=target.nodeName.toLowerCase();if(nodeName=="input"){target.disabled=false;inst.trigger.filter("button").each(function(){this.disabled=false}).end().filter("img").css({opacity:"1.0",cursor:""})}else{if(nodeName=="div"||nodeName=="span"){var inline=$target.children("."+this._inlineClass);inline.children().removeClass("ui-state-disabled")}}this._disabledInputs=$.map(this._disabledInputs,function(value){return(value==target?null:value)})},_disableDatepicker:function(target){var $target=$(target);var inst=$.data(target,PROP_NAME);if(!$target.hasClass(this.markerClassName)){return}var nodeName=target.nodeName.toLowerCase();if(nodeName=="input"){target.disabled=true;inst.trigger.filter("button").each(function(){this.disabled=true}).end().filter("img").css({opacity:"0.5",cursor:"default"})}else{if(nodeName=="div"||nodeName=="span"){var inline=$target.children("."+this._inlineClass);inline.children().addClass("ui-state-disabled")}}this._disabledInputs=$.map(this._disabledInputs,function(value){return(value==target?null:value)});this._disabledInputs[this._disabledInputs.length]=target},_isDisabledDatepicker:function(target){if(!target){return false}for(var i=0;i<this._disabledInputs.length;i++){if(this._disabledInputs[i]==target){return true}}return false},_getInst:function(target){try{return $.data(target,PROP_NAME)}catch(err){throw"Missing instance data for this datepicker"}},_optionDatepicker:function(target,name,value){var inst=this._getInst(target);if(arguments.length==2&&typeof name=="string"){return(name=="defaults"?$.extend({},TC_DATE_PICKER._defaults):(inst?(name=="all"?$.extend({},inst.settings):this._get(inst,name)):null))}var settings=name||{};if(typeof name=="string"){settings={};settings[name]=value}if(inst){if(this._curInst==inst){this._hideDatepicker()}var date=this._getDateDatepicker(target,true);var minDate=this._getMinMaxDate(inst,"min");var maxDate=this._getMinMaxDate(inst,"max");extendRemove(inst.settings,settings);if(minDate!==null&&settings.dateFormat!==undefined&&settings.minDate===undefined){inst.settings.minDate=this._formatDate(inst,minDate)}if(maxDate!==null&&settings.dateFormat!==undefined&&settings.maxDate===undefined){inst.settings.maxDate=this._formatDate(inst,maxDate)}this._attachments($(target),inst);this._autoSize(inst);this._setDateDatepicker(target,date);this._updateDatepicker(inst)}},_changeDatepicker:function(target,name,value){this._optionDatepicker(target,name,value)},_refreshDatepicker:function(target){var inst=this._getInst(target);if(inst){this._updateDatepicker(inst)}},_setDateDatepicker:function(target,date){var inst=this._getInst(target);if(inst){this._setDate(inst,date);this._updateDatepicker(inst);this._updateAlternate(inst)}},_getDateDatepicker:function(target,noDefault){var inst=this._getInst(target);if(inst&&!inst.inline){this._setDateFromField(inst,noDefault)}return(inst?this._getDate(inst):null)},_doKeyDown:function(event){var inst=TC_DATE_PICKER._getInst(event.target);var handled=true;var isRTL=inst.dpDiv.is(".ui-datepicker-rtl");inst._keyEvent=true;if(TC_DATE_PICKER._datepickerShowing){switch(event.keyCode){case 9:TC_DATE_PICKER._hideDatepicker();handled=false;break;case 13:var sel=$("td."+TC_DATE_PICKER._dayOverClass+":not(."+TC_DATE_PICKER._currentClass+")",inst.dpDiv);if(sel[0]){TC_DATE_PICKER._selectDay(event.target,inst.selectedMonth,inst.selectedYear,sel[0])}else{TC_DATE_PICKER._hideDatepicker()}return false;break;case 27:TC_DATE_PICKER._hideDatepicker();break;case 33:TC_DATE_PICKER._adjustDate(event.target,(event.ctrlKey?-TC_DATE_PICKER._get(inst,"stepBigMonths"):-TC_DATE_PICKER._get(inst,"stepMonths")),"M");break;case 34:TC_DATE_PICKER._adjustDate(event.target,(event.ctrlKey?+TC_DATE_PICKER._get(inst,"stepBigMonths"):+TC_DATE_PICKER._get(inst,"stepMonths")),"M");break;case 35:if(event.ctrlKey||event.metaKey){TC_DATE_PICKER._clearDate(event.target)}handled=event.ctrlKey||event.metaKey;break;case 36:if(event.ctrlKey||event.metaKey){TC_DATE_PICKER._gotoToday(event.target)}handled=event.ctrlKey||event.metaKey;break;case 37:if(event.ctrlKey||event.metaKey){TC_DATE_PICKER._adjustDate(event.target,(isRTL?+1:-1),"D")}handled=event.ctrlKey||event.metaKey;if(event.originalEvent.altKey){TC_DATE_PICKER._adjustDate(event.target,(event.ctrlKey?-TC_DATE_PICKER._get(inst,"stepBigMonths"):-TC_DATE_PICKER._get(inst,"stepMonths")),"M")}break;case 38:if(event.ctrlKey||event.metaKey){TC_DATE_PICKER._adjustDate(event.target,-7,"D")}handled=event.ctrlKey||event.metaKey;break;case 39:if(event.ctrlKey||event.metaKey){TC_DATE_PICKER._adjustDate(event.target,(isRTL?-1:+1),"D")}handled=event.ctrlKey||event.metaKey;if(event.originalEvent.altKey){TC_DATE_PICKER._adjustDate(event.target,(event.ctrlKey?+TC_DATE_PICKER._get(inst,"stepBigMonths"):+TC_DATE_PICKER._get(inst,"stepMonths")),"M")}break;case 40:if(event.ctrlKey||event.metaKey){TC_DATE_PICKER._adjustDate(event.target,+7,"D")}handled=event.ctrlKey||event.metaKey;break;default:handled=false}}else{if(event.keyCode==36&&event.ctrlKey){TC_DATE_PICKER._showDatepicker(this)}else{handled=false}}if(handled){event.preventDefault();event.stopPropagation()}},_doKeyPress:function(event){var inst=TC_DATE_PICKER._getInst(event.target);if(TC_DATE_PICKER._get(inst,"constrainInput")){var chars=TC_DATE_PICKER._possibleChars(TC_DATE_PICKER._get(inst,"dateFormat"));var chr=String.fromCharCode(event.charCode==undefined?event.keyCode:event.charCode);return event.ctrlKey||event.metaKey||(chr<" "||!chars||chars.indexOf(chr)>-1)}},_doKeyUp:function(event){var inst=TC_DATE_PICKER._getInst(event.target);if(inst.input.val()!=inst.lastVal){try{var date=TC_DATE_PICKER.parseDate(TC_DATE_PICKER._get(inst,"dateFormat"),(inst.input?inst.input.val():null),TC_DATE_PICKER._getFormatConfig(inst));if(date){TC_DATE_PICKER._setDateFromField(inst);TC_DATE_PICKER._updateAlternate(inst);TC_DATE_PICKER._updateDatepicker(inst)}}catch(event){TC_DATE_PICKER.log(event)}}return true},_showDatepicker:function(input){input=input.target||input;if(input.nodeName.toLowerCase()!="input"){input=$("input",input.parentNode)[0]}if(TC_DATE_PICKER._isDisabledDatepicker(input)||TC_DATE_PICKER._lastInput==input){return}var inst=TC_DATE_PICKER._getInst(input);if(TC_DATE_PICKER._curInst&&TC_DATE_PICKER._curInst!=inst){TC_DATE_PICKER._curInst.dpDiv.stop(true,true)}var beforeShow=TC_DATE_PICKER._get(inst,"beforeShow");extendRemove(inst.settings,(beforeShow?beforeShow.apply(input,[input,inst]):{}));inst.lastVal=null;TC_DATE_PICKER._lastInput=input;TC_DATE_PICKER._setDateFromField(inst);if(TC_DATE_PICKER._inDialog){input.value=""}if(!TC_DATE_PICKER._pos){TC_DATE_PICKER._pos=TC_DATE_PICKER._findPos(input);TC_DATE_PICKER._pos[1]+=input.offsetHeight}var isFixed=false;$(input).parents().each(function(){isFixed|=$(this).css("position")=="fixed";return !isFixed});if(isFixed&&$.browser.opera){TC_DATE_PICKER._pos[0]-=document.documentElement.scrollLeft;TC_DATE_PICKER._pos[1]-=document.documentElement.scrollTop}var offset={left:TC_DATE_PICKER._pos[0],top:TC_DATE_PICKER._pos[1]};TC_DATE_PICKER._pos=null;inst.dpDiv.empty();inst.dpDiv.css({position:"absolute",display:"block",top:"-1000px"});TC_DATE_PICKER._updateDatepicker(inst);offset=TC_DATE_PICKER._checkOffset(inst,offset,isFixed);inst.dpDiv.css({position:(TC_DATE_PICKER._inDialog&&$.blockUI?"static":(isFixed?"fixed":"absolute")),display:"none",left:offset.left+"px",top:offset.top+"px"});if(!inst.inline){var showAnim=TC_DATE_PICKER._get(inst,"showAnim");var duration=TC_DATE_PICKER._get(inst,"duration");var postProcess=function(){TC_DATE_PICKER._datepickerShowing=true;var cover=inst.dpDiv.find("iframe.ui-datepicker-cover");if(!!cover.length){var borders=TC_DATE_PICKER._getBorders(inst.dpDiv);cover.css({left:-borders[0],top:-borders[1],width:inst.dpDiv.outerWidth(),height:inst.dpDiv.outerHeight()})}};inst.dpDiv.zIndex($(input).zIndex()+1);if($.effects&&$.effects[showAnim]){inst.dpDiv.show(showAnim,TC_DATE_PICKER._get(inst,"showOptions"),duration,postProcess)}else{inst.dpDiv[showAnim||"show"]((showAnim?duration:null),postProcess)}if(!showAnim||!duration){postProcess()}if(inst.input.is(":visible")&&!inst.input.is(":disabled")){inst.input.focus()}TC_DATE_PICKER._curInst=inst}},_updateDatepicker:function(inst){var self=this;var borders=TC_DATE_PICKER._getBorders(inst.dpDiv);inst.dpDiv.empty().append(this._generateHTML(inst));var cover=inst.dpDiv.find("iframe.ui-datepicker-cover");if(!!cover.length){cover.css({left:-borders[0],top:-borders[1],width:inst.dpDiv.outerWidth(),height:inst.dpDiv.outerHeight()})}inst.dpDiv.find("button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a").bind("mouseout",function(){$(this).removeClass("ui-state-hover");if(this.className.indexOf("ui-datepicker-prev")!=-1){$(this).removeClass("ui-datepicker-prev-hover")}if(this.className.indexOf("ui-datepicker-next")!=-1){$(this).removeClass("ui-datepicker-next-hover")}}).bind("mouseover",function(){if(!self._isDisabledDatepicker(inst.inline?inst.dpDiv.parent()[0]:inst.input[0])){$(this).parents(".ui-datepicker-calendar").find("a").removeClass("ui-state-hover");$(this).addClass("ui-state-hover");if(this.className.indexOf("ui-datepicker-prev")!=-1){$(this).addClass("ui-datepicker-prev-hover")}if(this.className.indexOf("ui-datepicker-next")!=-1){$(this).addClass("ui-datepicker-next-hover")}}}).end().find("."+this._dayOverClass+" a").trigger("mouseover").end();var numMonths=this._getNumberOfMonths(inst);var cols=numMonths[1];var width=17;if(cols>1){inst.dpDiv.addClass("ui-datepicker-multi-"+cols).css("width",(width*cols)+"em")}else{inst.dpDiv.removeClass("ui-datepicker-multi-2 ui-datepicker-multi-3 ui-datepicker-multi-4").width("")}inst.dpDiv[(numMonths[0]!=1||numMonths[1]!=1?"add":"remove")+"Class"]("ui-datepicker-multi");inst.dpDiv[(this._get(inst,"isRTL")?"add":"remove")+"Class"]("ui-datepicker-rtl");if(inst==TC_DATE_PICKER._curInst&&TC_DATE_PICKER._datepickerShowing&&inst.input&&inst.input.is(":visible")&&!inst.input.is(":disabled")&&inst.input[0]!=document.activeElement){inst.input.focus()}if(inst.yearshtml){var origyearshtml=inst.yearshtml;setTimeout(function(){if(origyearshtml===inst.yearshtml){inst.dpDiv.find("select.ui-datepicker-year:first").replaceWith(inst.yearshtml)}origyearshtml=inst.yearshtml=null},0)}},_getBorders:function(elem){var convert=function(value){return{thin:1,medium:2,thick:3}[value]||value};return[parseFloat(convert(elem.css("border-left-width"))),parseFloat(convert(elem.css("border-top-width")))]},_checkOffset:function(inst,offset,isFixed){var dpWidth=inst.dpDiv.outerWidth();var dpHeight=inst.dpDiv.outerHeight();var inputWidth=inst.input?inst.input.outerWidth():0;var inputHeight=inst.input?inst.input.outerHeight():0;var viewWidth=document.documentElement.clientWidth+$(document).scrollLeft();var viewHeight=document.documentElement.clientHeight+$(document).scrollTop();offset.left-=(this._get(inst,"isRTL")?(dpWidth-inputWidth):0);offset.left-=(isFixed&&offset.left==inst.input.offset().left)?$(document).scrollLeft():0;offset.top-=(isFixed&&offset.top==(inst.input.offset().top+inputHeight))?$(document).scrollTop():0;offset.left-=Math.min(offset.left,(offset.left+dpWidth>viewWidth&&viewWidth>dpWidth)?Math.abs(offset.left+dpWidth-viewWidth):0);offset.top-=Math.min(offset.top,(offset.top+dpHeight>viewHeight&&viewHeight>dpHeight)?Math.abs(dpHeight+inputHeight):0);return offset},_findPos:function(obj){var inst=this._getInst(obj);var isRTL=this._get(inst,"isRTL");while(obj&&(obj.type=="hidden"||obj.nodeType!=1||$.expr.filters.hidden(obj))){obj=obj[isRTL?"previousSibling":"nextSibling"]}var position=$(obj).offset();return[position.left,position.top]},_hideDatepicker:function(input){var inst=this._curInst;if(!inst||(input&&inst!=$.data(input,PROP_NAME))){return}if(this._datepickerShowing){var showAnim=this._get(inst,"showAnim");var duration=this._get(inst,"duration");var postProcess=function(){TC_DATE_PICKER._tidyDialog(inst);this._curInst=null};if($.effects&&$.effects[showAnim]){inst.dpDiv.hide(showAnim,TC_DATE_PICKER._get(inst,"showOptions"),duration,postProcess)}else{inst.dpDiv[(showAnim=="slideDown"?"slideUp":(showAnim=="fadeIn"?"fadeOut":"hide"))]((showAnim?duration:null),postProcess)}if(!showAnim){postProcess()}var onClose=this._get(inst,"onClose");if(onClose){onClose.apply((inst.input?inst.input[0]:null),[(inst.input?inst.input.val():""),inst])}this._datepickerShowing=false;this._lastInput=null;if(this._inDialog){this._dialogInput.css({position:"absolute",left:"0",top:"-100px"});if($.blockUI){$.unblockUI();$("body").append(this.dpDiv)}}this._inDialog=false}},_tidyDialog:function(inst){inst.dpDiv.removeClass(this._dialogClass).unbind(".ui-datepicker-calendar")},_checkExternalClick:function(event){if(!TC_DATE_PICKER._curInst){return}var $target=$(event.target);if($target[0].id!=TC_DATE_PICKER._mainDivId&&$target.parents("#"+TC_DATE_PICKER._mainDivId).length==0&&!$target.hasClass(TC_DATE_PICKER.markerClassName)&&!$target.hasClass(TC_DATE_PICKER._triggerClass)&&TC_DATE_PICKER._datepickerShowing&&!(TC_DATE_PICKER._inDialog&&$.blockUI)){TC_DATE_PICKER._hideDatepicker()}},_adjustDate:function(id,offset,period){var target=$(id);var inst=this._getInst(target[0]);if(this._isDisabledDatepicker(target[0])){return}this._adjustInstDate(inst,offset+(period=="M"?this._get(inst,"showCurrentAtPos"):0),period);this._updateDatepicker(inst)},_gotoToday:function(id){var target=$(id);var inst=this._getInst(target[0]);if(this._get(inst,"gotoCurrent")&&inst.currentDay){inst.selectedDay=inst.currentDay;inst.drawMonth=inst.selectedMonth=inst.currentMonth;inst.drawYear=inst.selectedYear=inst.currentYear}else{var date=new Date();inst.selectedDay=date.getDate();inst.drawMonth=inst.selectedMonth=date.getMonth();inst.drawYear=inst.selectedYear=date.getFullYear()}this._notifyChange(inst);this._adjustDate(target)},_selectMonthYear:function(id,select,period){var target=$(id);var inst=this._getInst(target[0]);inst._selectingMonthYear=false;inst["selected"+(period=="M"?"Month":"Year")]=inst["draw"+(period=="M"?"Month":"Year")]=parseInt(select.options[select.selectedIndex].value,10);this._notifyChange(inst);this._adjustDate(target)},_clickMonthYear:function(id){var target=$(id);var inst=this._getInst(target[0]);if(inst.input&&inst._selectingMonthYear){setTimeout(function(){inst.input.focus()},0)}inst._selectingMonthYear=!inst._selectingMonthYear},_selectDay:function(id,month,year,td){var target=$(id);if($(td).hasClass(this._unselectableClass)||this._isDisabledDatepicker(target[0])){return}var inst=this._getInst(target[0]);inst.selectedDay=inst.currentDay=$("a",td).html();inst.selectedMonth=inst.currentMonth=month;inst.selectedYear=inst.currentYear=year;this._selectDate(id,this._formatDate(inst,inst.currentDay,inst.currentMonth,inst.currentYear))},_clearDate:function(id){var target=$(id);var inst=this._getInst(target[0]);this._selectDate(target,"")},_selectDate:function(id,dateStr){var target=$(id);var inst=this._getInst(target[0]);dateStr=(dateStr!=null?dateStr:this._formatDate(inst));if(inst.input){inst.input.val(dateStr)}this._updateAlternate(inst);var onSelect=this._get(inst,"onSelect");if(onSelect){onSelect.apply((inst.input?inst.input[0]:null),[dateStr,inst])}else{if(inst.input){inst.input.trigger("change")}}if(inst.inline){this._updateDatepicker(inst)}else{this._hideDatepicker();this._lastInput=inst.input[0];if(typeof(inst.input[0])!="object"){inst.input.focus()}this._lastInput=null}},_updateAlternate:function(inst){var altField=this._get(inst,"altField");if(altField){var altFormat=this._get(inst,"altFormat")||this._get(inst,"dateFormat");var date=this._getDate(inst);var dateStr=this.formatDate(altFormat,date,this._getFormatConfig(inst));$(altField).each(function(){$(this).val(dateStr)})}},noWeekends:function(date){var day=date.getDay();return[(day>0&&day<6),""]},iso8601Week:function(date){var checkDate=new Date(date.getTime());checkDate.setDate(checkDate.getDate()+4-(checkDate.getDay()||7));var time=checkDate.getTime();checkDate.setMonth(0);checkDate.setDate(1);return Math.floor(Math.round((time-checkDate)/86400000)/7)+1},parseDate:function(format,value,settings){if(format==null||value==null){throw"Invalid arguments"}value=(typeof value=="object"?value.toString():value+"");if(value==""){return null}var shortYearCutoff=(settings?settings.shortYearCutoff:null)||this._defaults.shortYearCutoff;shortYearCutoff=(typeof shortYearCutoff!="string"?shortYearCutoff:new Date().getFullYear()%100+parseInt(shortYearCutoff,10));var dayNamesShort=(settings?settings.dayNamesShort:null)||this._defaults.dayNamesShort;var dayNames=(settings?settings.dayNames:null)||this._defaults.dayNames;var monthNamesShort=(settings?settings.monthNamesShort:null)||this._defaults.monthNamesShort;var monthNames=(settings?settings.monthNames:null)||this._defaults.monthNames;var year=-1;var month=-1;var day=-1;var doy=-1;var literal=false;var lookAhead=function(match){var matches=(iFormat+1<format.length&&format.charAt(iFormat+1)==match);if(matches){iFormat++}return matches};var getNumber=function(match){var isDoubled=lookAhead(match);var size=(match=="@"?14:(match=="!"?20:(match=="y"&&isDoubled?4:(match=="o"?3:2))));var digits=new RegExp("^\\d{1,"+size+"}");var num=value.substring(iValue).match(digits);if(!num){throw"Missing number at position "+iValue}iValue+=num[0].length;return parseInt(num[0],10)};var getName=function(match,shortNames,longNames){var names=(lookAhead(match)?longNames:shortNames);for(var i=0;i<names.length;i++){if(value.substr(iValue,names[i].length).toLowerCase()==names[i].toLowerCase()){iValue+=names[i].length;return i+1}}throw"Unknown name at position "+iValue};var checkLiteral=function(){if(value.charAt(iValue)!=format.charAt(iFormat)){throw"Unexpected literal at position "+iValue}iValue++};var iValue=0;for(var iFormat=0;iFormat<format.length;iFormat++){if(literal){if(format.charAt(iFormat)=="'"&&!lookAhead("'")){literal=false}else{checkLiteral()}}else{switch(format.charAt(iFormat)){case"d":day=getNumber("d");break;case"D":getName("D",dayNamesShort,dayNames);break;case"o":doy=getNumber("o");break;case"m":month=getNumber("m");break;case"M":month=getName("M",monthNamesShort,monthNames);break;case"y":year=getNumber("y");break;case"@":var date=new Date(getNumber("@"));year=date.getFullYear();month=date.getMonth()+1;day=date.getDate();break;case"!":var date=new Date((getNumber("!")-this._ticksTo1970)/10000);year=date.getFullYear();month=date.getMonth()+1;day=date.getDate();break;case"'":if(lookAhead("'")){checkLiteral()}else{literal=true}break;default:checkLiteral()}}}if(year==-1){year=new Date().getFullYear()}else{if(year<100){year+=new Date().getFullYear()-new Date().getFullYear()%100+(year<=shortYearCutoff?0:-100)}}if(doy>-1){month=1;day=doy;do{var dim=this._getDaysInMonth(year,month-1);if(day<=dim){break}month++;day-=dim}while(true)}var date=this._daylightSavingAdjust(new Date(year,month-1,day));if(date.getFullYear()!=year||date.getMonth()+1!=month||date.getDate()!=day){throw"Invalid date"}return date},ATOM:"yy-mm-dd",COOKIE:"D, dd M yy",ISO_8601:"yy-mm-dd",RFC_822:"D, d M y",RFC_850:"DD, dd-M-y",RFC_1036:"D, d M y",RFC_1123:"D, d M yy",RFC_2822:"D, d M yy",RSS:"D, d M y",TICKS:"!",TIMESTAMP:"@",W3C:"yy-mm-dd",_ticksTo1970:(((1970-1)*365+Math.floor(1970/4)-Math.floor(1970/100)+Math.floor(1970/400))*24*60*60*10000000),formatDate:function(format,date,settings){if(!date){return""}var dayNamesShort=(settings?settings.dayNamesShort:null)||this._defaults.dayNamesShort;var dayNames=(settings?settings.dayNames:null)||this._defaults.dayNames;var monthNamesShort=(settings?settings.monthNamesShort:null)||this._defaults.monthNamesShort;var monthNames=(settings?settings.monthNames:null)||this._defaults.monthNames;var lookAhead=function(match){var matches=(iFormat+1<format.length&&format.charAt(iFormat+1)==match);if(matches){iFormat++}return matches};var formatNumber=function(match,value,len){var num=""+value;if(lookAhead(match)){while(num.length<len){num="0"+num}}return num};var formatName=function(match,value,shortNames,longNames){return(lookAhead(match)?longNames[value]:shortNames[value])};var output="";var literal=false;if(date){for(var iFormat=0;iFormat<format.length;iFormat++){if(literal){if(format.charAt(iFormat)=="'"&&!lookAhead("'")){literal=false}else{output+=format.charAt(iFormat)}}else{switch(format.charAt(iFormat)){case"d":output+=formatNumber("d",date.getDate(),2);break;case"D":output+=formatName("D",date.getDay(),dayNamesShort,dayNames);break;case"o":output+=formatNumber("o",(date.getTime()-new Date(date.getFullYear(),0,0).getTime())/86400000,3);break;case"m":output+=formatNumber("m",date.getMonth()+1,2);break;case"M":output+=formatName("M",date.getMonth(),monthNamesShort,monthNames);break;case"y":output+=(lookAhead("y")?date.getFullYear():(date.getYear()%100<10?"0":"")+date.getYear()%100);break;case"@":output+=date.getTime();break;case"!":output+=date.getTime()*10000+this._ticksTo1970;break;case"'":if(lookAhead("'")){output+="'"}else{literal=true}break;default:output+=format.charAt(iFormat)}}}}return output},_possibleChars:function(format){var chars="";var literal=false;var lookAhead=function(match){var matches=(iFormat+1<format.length&&format.charAt(iFormat+1)==match);if(matches){iFormat++}return matches};for(var iFormat=0;iFormat<format.length;iFormat++){if(literal){if(format.charAt(iFormat)=="'"&&!lookAhead("'")){literal=false}else{chars+=format.charAt(iFormat)}}else{switch(format.charAt(iFormat)){case"d":case"m":case"y":case"@":chars+="0123456789";break;case"D":case"M":return null;case"'":if(lookAhead("'")){chars+="'"}else{literal=true}break;default:chars+=format.charAt(iFormat)}}}return chars},_get:function(inst,name){return inst.settings[name]!==undefined?inst.settings[name]:this._defaults[name]},_setDateFromField:function(inst,noDefault){if(inst.input.val()==inst.lastVal){return}var dateFormat=this._get(inst,"dateFormat");var dates=inst.lastVal=inst.input?inst.input.val():null;var date,defaultDate;date=defaultDate=this._getDefaultDate(inst);var settings=this._getFormatConfig(inst);try{date=this.parseDate(dateFormat,dates,settings)||defaultDate}catch(event){this.log(event);dates=(noDefault?"":dates)}inst.selectedDay=date.getDate();inst.drawMonth=inst.selectedMonth=date.getMonth();inst.drawYear=inst.selectedYear=date.getFullYear();inst.currentDay=(dates?date.getDate():0);inst.currentMonth=(dates?date.getMonth():0);inst.currentYear=(dates?date.getFullYear():0);this._adjustInstDate(inst)},_getDefaultDate:function(inst){return this._restrictMinMax(inst,this._determineDate(inst,this._get(inst,"defaultDate"),new Date()))},_determineDate:function(inst,date,defaultDate){var offsetNumeric=function(offset){var date=new Date();date.setDate(date.getDate()+offset);return date};var offsetString=function(offset){try{return TC_DATE_PICKER.parseDate(TC_DATE_PICKER._get(inst,"dateFormat"),offset,TC_DATE_PICKER._getFormatConfig(inst))}catch(e){}var date=(offset.toLowerCase().match(/^c/)?TC_DATE_PICKER._getDate(inst):null)||new Date();var year=date.getFullYear();var month=date.getMonth();var day=date.getDate();var pattern=/([+-]?[0-9]+)\s*(d|D|w|W|m|M|y|Y)?/g;var matches=pattern.exec(offset);while(matches){switch(matches[2]||"d"){case"d":case"D":day+=parseInt(matches[1],10);break;case"w":case"W":day+=parseInt(matches[1],10)*7;break;case"m":case"M":month+=parseInt(matches[1],10);day=Math.min(day,TC_DATE_PICKER._getDaysInMonth(year,month));break;case"y":case"Y":year+=parseInt(matches[1],10);day=Math.min(day,TC_DATE_PICKER._getDaysInMonth(year,month));break}matches=pattern.exec(offset)}return new Date(year,month,day)};var newDate=(date==null||date===""?defaultDate:(typeof date=="string"?offsetString(date):(typeof date=="number"?(isNaN(date)?defaultDate:offsetNumeric(date)):new Date(date.getTime()))));newDate=(newDate&&newDate.toString()=="Invalid Date"?defaultDate:newDate);if(newDate){newDate.setHours(0);newDate.setMinutes(0);newDate.setSeconds(0);newDate.setMilliseconds(0)}return this._daylightSavingAdjust(newDate)},_daylightSavingAdjust:function(date){if(!date){return null}date.setHours(date.getHours()>12?date.getHours()+2:0);return date},_setDate:function(inst,date,noChange){var clear=!date;var origMonth=inst.selectedMonth;var origYear=inst.selectedYear;var newDate=this._restrictMinMax(inst,this._determineDate(inst,date,new Date()));inst.selectedDay=inst.currentDay=newDate.getDate();inst.drawMonth=inst.selectedMonth=inst.currentMonth=newDate.getMonth();inst.drawYear=inst.selectedYear=inst.currentYear=newDate.getFullYear();if((origMonth!=inst.selectedMonth||origYear!=inst.selectedYear)&&!noChange){this._notifyChange(inst)}this._adjustInstDate(inst);if(inst.input){inst.input.val(clear?"":this._formatDate(inst))}},_getDate:function(inst){var startDate=(!inst.currentYear||(inst.input&&inst.input.val()=="")?null:this._daylightSavingAdjust(new Date(inst.currentYear,inst.currentMonth,inst.currentDay)));return startDate},_generateHTML:function(inst){var today=new Date();today=this._daylightSavingAdjust(new Date(today.getFullYear(),today.getMonth(),today.getDate()));var isRTL=this._get(inst,"isRTL");var showButtonPanel=this._get(inst,"showButtonPanel");var hideIfNoPrevNext=this._get(inst,"hideIfNoPrevNext");var navigationAsDateFormat=this._get(inst,"navigationAsDateFormat");var numMonths=this._getNumberOfMonths(inst);var showCurrentAtPos=this._get(inst,"showCurrentAtPos");var stepMonths=this._get(inst,"stepMonths");var isMultiMonth=(numMonths[0]!=1||numMonths[1]!=1);var currentDate=this._daylightSavingAdjust((!inst.currentDay?new Date(9999,9,9):new Date(inst.currentYear,inst.currentMonth,inst.currentDay)));var minDate=this._getMinMaxDate(inst,"min");var maxDate=this._getMinMaxDate(inst,"max");var drawMonth=inst.drawMonth-showCurrentAtPos;var drawYear=inst.drawYear;if(drawMonth<0){drawMonth+=12;drawYear--}if(maxDate){var maxDraw=this._daylightSavingAdjust(new Date(maxDate.getFullYear(),maxDate.getMonth()-(numMonths[0]*numMonths[1])+1,maxDate.getDate()));maxDraw=(minDate&&maxDraw<minDate?minDate:maxDraw);while(this._daylightSavingAdjust(new Date(drawYear,drawMonth,1))>maxDraw){drawMonth--;if(drawMonth<0){drawMonth=11;drawYear--}}}inst.drawMonth=drawMonth;inst.drawYear=drawYear;var prevText=this._get(inst,"prevText");prevText=(!navigationAsDateFormat?prevText:this.formatDate(prevText,this._daylightSavingAdjust(new Date(drawYear,drawMonth-stepMonths,1)),this._getFormatConfig(inst)));var prev=(this._canAdjustMonth(inst,-1,drawYear,drawMonth)?'<a class="ui-datepicker-prev ui-corner-all" onclick="DP_jQuery_'+dpuuid+".datepicker._adjustDate('#"+inst.id+"', -"+stepMonths+", 'M');\" title=\""+prevText+'"><span class="ui-icon ui-icon-circle-triangle-'+(isRTL?"e":"w")+'">'+prevText+"</span></a>":(hideIfNoPrevNext?"":'<a class="ui-datepicker-prev ui-corner-all ui-state-disabled" title="'+prevText+'"><span class="ui-icon ui-icon-circle-triangle-'+(isRTL?"e":"w")+'">'+prevText+"</span></a>"));var nextText=this._get(inst,"nextText");nextText=(!navigationAsDateFormat?nextText:this.formatDate(nextText,this._daylightSavingAdjust(new Date(drawYear,drawMonth+stepMonths,1)),this._getFormatConfig(inst)));var next=(this._canAdjustMonth(inst,+1,drawYear,drawMonth)?'<a class="ui-datepicker-next ui-corner-all" onclick="DP_jQuery_'+dpuuid+".datepicker._adjustDate('#"+inst.id+"', +"+stepMonths+", 'M');\" title=\""+nextText+'"><span class="ui-icon ui-icon-circle-triangle-'+(isRTL?"w":"e")+'">'+nextText+"</span></a>":(hideIfNoPrevNext?"":'<a class="ui-datepicker-next ui-corner-all ui-state-disabled" title="'+nextText+'"><span class="ui-icon ui-icon-circle-triangle-'+(isRTL?"w":"e")+'">'+nextText+"</span></a>"));var currentText=this._get(inst,"currentText");var gotoDate=(this._get(inst,"gotoCurrent")&&inst.currentDay?currentDate:today);currentText=(!navigationAsDateFormat?currentText:this.formatDate(currentText,gotoDate,this._getFormatConfig(inst)));var controls=(!inst.inline?'<button type="button" class="ui-datepicker-close ui-state-default ui-priority-primary ui-corner-all" onclick="DP_jQuery_'+dpuuid+'.datepicker._hideDatepicker();">'+this._get(inst,"closeText")+"</button>":"");var buttonPanel=(showButtonPanel)?'<div class="ui-datepicker-buttonpane ui-widget-content">'+(isRTL?controls:"")+(this._isInRange(inst,gotoDate)?'<button type="button" class="ui-datepicker-current ui-state-default ui-priority-secondary ui-corner-all" onclick="DP_jQuery_'+dpuuid+".datepicker._gotoToday('#"+inst.id+"');\">"+currentText+"</button>":"")+(isRTL?"":controls)+"</div>":"";var firstDay=parseInt(this._get(inst,"firstDay"),10);firstDay=(isNaN(firstDay)?0:firstDay);var showWeek=this._get(inst,"showWeek");var dayNames=this._get(inst,"dayNames");var dayNamesShort=this._get(inst,"dayNamesShort");var dayNamesMin=this._get(inst,"dayNamesMin");var monthNames=this._get(inst,"monthNames");var monthNamesShort=this._get(inst,"monthNamesShort");var beforeShowDay=this._get(inst,"beforeShowDay");var showOtherMonths=this._get(inst,"showOtherMonths");var selectOtherMonths=this._get(inst,"selectOtherMonths");var calculateWeek=this._get(inst,"calculateWeek")||this.iso8601Week;var defaultDate=this._getDefaultDate(inst);var html="";for(var row=0;row<numMonths[0];row++){var group="";for(var col=0;col<numMonths[1];col++){var selectedDate=this._daylightSavingAdjust(new Date(drawYear,drawMonth,inst.selectedDay));var cornerClass=" ui-corner-all";var calender="";if(isMultiMonth){calender+='<div class="ui-datepicker-group';if(numMonths[1]>1){switch(col){case 0:calender+=" ui-datepicker-group-first";cornerClass=" ui-corner-"+(isRTL?"right":"left");break;case numMonths[1]-1:calender+=" ui-datepicker-group-last";cornerClass=" ui-corner-"+(isRTL?"left":"right");break;default:calender+=" ui-datepicker-group-middle";cornerClass="";break}}calender+='">'}calender+='<div class="ui-datepicker-header ui-widget-header ui-helper-clearfix'+cornerClass+'">'+(/all|left/.test(cornerClass)&&row==0?(isRTL?next:prev):"")+(/all|right/.test(cornerClass)&&row==0?(isRTL?prev:next):"")+this._generateMonthYearHeader(inst,drawMonth,drawYear,minDate,maxDate,row>0||col>0,monthNames,monthNamesShort)+'</div><table class="ui-datepicker-calendar"><thead><tr>';var thead=(showWeek?'<th class="ui-datepicker-week-col">'+this._get(inst,"weekHeader")+"</th>":"");for(var dow=0;dow<7;dow++){var day=(dow+firstDay)%7;thead+="<th"+((dow+firstDay+6)%7>=5?' class="ui-datepicker-week-end"':"")+'><span title="'+dayNames[day]+'">'+dayNamesMin[day]+"</span></th>"}calender+=thead+"</tr></thead><tbody>";var daysInMonth=this._getDaysInMonth(drawYear,drawMonth);if(drawYear==inst.selectedYear&&drawMonth==inst.selectedMonth){inst.selectedDay=Math.min(inst.selectedDay,daysInMonth)}var leadDays=(this._getFirstDayOfMonth(drawYear,drawMonth)-firstDay+7)%7;var numRows=(isMultiMonth?6:Math.ceil((leadDays+daysInMonth)/7));var printDate=this._daylightSavingAdjust(new Date(drawYear,drawMonth,1-leadDays));for(var dRow=0;dRow<numRows;dRow++){calender+="<tr>";var tbody=(!showWeek?"":'<td class="ui-datepicker-week-col">'+this._get(inst,"calculateWeek")(printDate)+"</td>");for(var dow=0;dow<7;dow++){var daySettings=(beforeShowDay?beforeShowDay.apply((inst.input?inst.input[0]:null),[printDate]):[true,""]);var otherMonth=(printDate.getMonth()!=drawMonth);var unselectable=(otherMonth&&!selectOtherMonths)||!daySettings[0]||(minDate&&printDate<minDate)||(maxDate&&printDate>maxDate);tbody+='<td class="'+((dow+firstDay+6)%7>=5?" ui-datepicker-week-end":"")+(otherMonth?" ui-datepicker-other-month":"")+((printDate.getTime()==selectedDate.getTime()&&drawMonth==inst.selectedMonth&&inst._keyEvent)||(defaultDate.getTime()==printDate.getTime()&&defaultDate.getTime()==selectedDate.getTime())?" "+this._dayOverClass:"")+(unselectable?" "+this._unselectableClass+" ui-state-disabled":"")+(otherMonth&&!showOtherMonths?"":" "+daySettings[1]+(printDate.getTime()==currentDate.getTime()?" "+this._currentClass:"")+(printDate.getTime()==today.getTime()?" ui-datepicker-today":""))+'"'+((!otherMonth||showOtherMonths)&&daySettings[2]?' title="'+daySettings[2]+'"':"")+(unselectable?"":' onclick="DP_jQuery_'+dpuuid+".datepicker._selectDay('#"+inst.id+"',"+printDate.getMonth()+","+printDate.getFullYear()+', this);return false;"')+">"+(otherMonth&&!showOtherMonths?"&#xa0;":(unselectable?'<span class="ui-state-default">'+printDate.getDate()+"</span>":'<a class="ui-state-default'+(printDate.getTime()==today.getTime()?" ui-state-highlight":"")+(printDate.getTime()==currentDate.getTime()?" ui-state-active":"")+(otherMonth?" ui-priority-secondary":"")+'" href="#">'+printDate.getDate()+"</a>"))+"</td>";printDate.setDate(printDate.getDate()+1);printDate=this._daylightSavingAdjust(printDate)}calender+=tbody+"</tr>"}drawMonth++;if(drawMonth>11){drawMonth=0;drawYear++}calender+="</tbody></table>"+(isMultiMonth?"</div>"+((numMonths[0]>0&&col==numMonths[1]-1)?'<div class="ui-datepicker-row-break"></div>':""):"");group+=calender}html+=group}html+=buttonPanel+($.browser.msie&&parseInt($.browser.version,10)<7&&!inst.inline?'<iframe src="javascript:false;" class="ui-datepicker-cover" frameborder="0"></iframe>':"");inst._keyEvent=false;return html},_generateMonthYearHeader:function(inst,drawMonth,drawYear,minDate,maxDate,secondary,monthNames,monthNamesShort){var changeMonth=this._get(inst,"changeMonth");var changeYear=this._get(inst,"changeYear");var showMonthAfterYear=this._get(inst,"showMonthAfterYear");var html='<div class="ui-datepicker-title">';var monthHtml="";if(secondary||!changeMonth){monthHtml+='<span class="ui-datepicker-month">'+monthNames[drawMonth]+"</span>"}else{var inMinYear=(minDate&&minDate.getFullYear()==drawYear);var inMaxYear=(maxDate&&maxDate.getFullYear()==drawYear);monthHtml+='<select class="ui-datepicker-month" onchange="DP_jQuery_'+dpuuid+".datepicker._selectMonthYear('#"+inst.id+"', this, 'M');\" onclick=\"DP_jQuery_"+dpuuid+".datepicker._clickMonthYear('#"+inst.id+"');\">";for(var month=0;month<12;month++){if((!inMinYear||month>=minDate.getMonth())&&(!inMaxYear||month<=maxDate.getMonth())){monthHtml+='<option value="'+month+'"'+(month==drawMonth?' selected="selected"':"")+">"+monthNamesShort[month]+"</option>"}}monthHtml+="</select>"}if(!showMonthAfterYear){html+=monthHtml+(secondary||!(changeMonth&&changeYear)?"&#xa0;":"")}inst.yearshtml="";if(secondary||!changeYear){html+='<span class="ui-datepicker-year">'+drawYear+"</span>"}else{var years=this._get(inst,"yearRange").split(":");var thisYear=new Date().getFullYear();var determineYear=function(value){var year=(value.match(/c[+-].*/)?drawYear+parseInt(value.substring(1),10):(value.match(/[+-].*/)?thisYear+parseInt(value,10):parseInt(value,10)));return(isNaN(year)?thisYear:year)};var year=determineYear(years[0]);var endYear=Math.max(year,determineYear(years[1]||""));year=(minDate?Math.max(year,minDate.getFullYear()):year);endYear=(maxDate?Math.min(endYear,maxDate.getFullYear()):endYear);inst.yearshtml+='<select class="ui-datepicker-year" onchange="DP_jQuery_'+dpuuid+".datepicker._selectMonthYear('#"+inst.id+"', this, 'Y');\" onclick=\"DP_jQuery_"+dpuuid+".datepicker._clickMonthYear('#"+inst.id+"');\">";for(;year<=endYear;year++){inst.yearshtml+='<option value="'+year+'"'+(year==drawYear?' selected="selected"':"")+">"+year+"</option>"}inst.yearshtml+="</select>";if(!$.browser.mozilla){html+=inst.yearshtml;inst.yearshtml=null}else{html+='<select class="ui-datepicker-year"><option value="'+drawYear+'" selected="selected">'+drawYear+"</option></select>"}}html+=this._get(inst,"yearSuffix");if(showMonthAfterYear){html+=(secondary||!(changeMonth&&changeYear)?"&#xa0;":"")+monthHtml}html+="</div>";return html},_adjustInstDate:function(inst,offset,period){var year=inst.drawYear+(period=="Y"?offset:0);var month=inst.drawMonth+(period=="M"?offset:0);var day=Math.min(inst.selectedDay,this._getDaysInMonth(year,month))+(period=="D"?offset:0);var date=this._restrictMinMax(inst,this._daylightSavingAdjust(new Date(year,month,day)));inst.selectedDay=date.getDate();inst.drawMonth=inst.selectedMonth=date.getMonth();inst.drawYear=inst.selectedYear=date.getFullYear();if(period=="M"||period=="Y"){this._notifyChange(inst)}},_restrictMinMax:function(inst,date){var minDate=this._getMinMaxDate(inst,"min");var maxDate=this._getMinMaxDate(inst,"max");var newDate=(minDate&&date<minDate?minDate:date);newDate=(maxDate&&newDate>maxDate?maxDate:newDate);return newDate},_notifyChange:function(inst){var onChange=this._get(inst,"onChangeMonthYear");if(onChange){onChange.apply((inst.input?inst.input[0]:null),[inst.selectedYear,inst.selectedMonth+1,inst])}},_getNumberOfMonths:function(inst){var numMonths=this._get(inst,"numberOfMonths");return(numMonths==null?[1,1]:(typeof numMonths=="number"?[1,numMonths]:numMonths))},_getMinMaxDate:function(inst,minMax){return this._determineDate(inst,this._get(inst,minMax+"Date"),null)},_getDaysInMonth:function(year,month){return 32-this._daylightSavingAdjust(new Date(year,month,32)).getDate()},_getFirstDayOfMonth:function(year,month){return new Date(year,month,1).getDay()},_canAdjustMonth:function(inst,offset,curYear,curMonth){var numMonths=this._getNumberOfMonths(inst);var date=this._daylightSavingAdjust(new Date(curYear,curMonth+(offset<0?offset:numMonths[0]*numMonths[1]),1));if(offset<0){date.setDate(this._getDaysInMonth(date.getFullYear(),date.getMonth()))}return this._isInRange(inst,date)},_isInRange:function(inst,date){var minDate=this._getMinMaxDate(inst,"min");var maxDate=this._getMinMaxDate(inst,"max");return((!minDate||date.getTime()>=minDate.getTime())&&(!maxDate||date.getTime()<=maxDate.getTime()))},_getFormatConfig:function(inst){var shortYearCutoff=this._get(inst,"shortYearCutoff");shortYearCutoff=(typeof shortYearCutoff!="string"?shortYearCutoff:new Date().getFullYear()%100+parseInt(shortYearCutoff,10));return{shortYearCutoff:shortYearCutoff,dayNamesShort:this._get(inst,"dayNamesShort"),dayNames:this._get(inst,"dayNames"),monthNamesShort:this._get(inst,"monthNamesShort"),monthNames:this._get(inst,"monthNames")}},_formatDate:function(inst,day,month,year){if(!day){inst.currentDay=inst.selectedDay;inst.currentMonth=inst.selectedMonth;inst.currentYear=inst.selectedYear}var date=(day?(typeof day=="object"?day:this._daylightSavingAdjust(new Date(year,month,day))):this._daylightSavingAdjust(new Date(inst.currentYear,inst.currentMonth,inst.currentDay)));return this.formatDate(this._get(inst,"dateFormat"),date,this._getFormatConfig(inst))}});function extendRemove(target,props){$.extend(target,props);for(var name in props){if(props[name]==null||props[name]==undefined){target[name]=props[name]}}return target}function isArray(a){return(a&&(($.browser.safari&&typeof a=="object"&&a.length)||(a.constructor&&a.constructor.toString().match(/\Array\(\)/))))}var oldFnDatepicker=$.fn.datepicker;$.fn.datepicker=function(options){if(!this.length){return this}if(!TC_DATE_PICKER.initialized){$(document).mousedown(TC_DATE_PICKER._checkExternalClick).find("body").append(TC_DATE_PICKER.dpDiv);TC_DATE_PICKER.initialized=true}var otherArgs=Array.prototype.slice.call(arguments,1);if(typeof options=="string"&&(options=="isDisabled"||options=="getDate"||options=="widget")){return TC_DATE_PICKER["_"+options+"Datepicker"].apply(TC_DATE_PICKER,[this[0]].concat(otherArgs))}if(options=="option"&&arguments.length==2&&typeof arguments[1]=="string"){return TC_DATE_PICKER["_"+options+"Datepicker"].apply(TC_DATE_PICKER,[this[0]].concat(otherArgs))}return this.each(function(){typeof options=="string"?TC_DATE_PICKER["_"+options+"Datepicker"].apply(TC_DATE_PICKER,[this].concat(otherArgs)):TC_DATE_PICKER._attachDatepicker(this,options)})};$.fn.datepicker.noConflict=function(){$.fn.datepicker=oldFnDatepicker||$.fn.datepicker;return this};var TC_DATE_PICKER=new Datepicker();var oldDatepicker=$.datepicker;$.datepicker=TC_DATE_PICKER;TC_DATE_PICKER.initialized=false;TC_DATE_PICKER.uuid=new Date().getTime();TC_DATE_PICKER.version="1.8.11";TC_DATE_PICKER.noConflict=function(){$.datepicker=oldDatepicker||$.datepicker;return this};window["DP_jQuery_"+dpuuid]=$})(jQuery);
}catch(e){WRMCB(e)};
;
try {
/* module-key = 'com.atlassian.confluence.extra.team-calendars:calendar-resources', location = 'com/atlassian/confluence/extra/calendar3/lib/jquery-plugins/jquery.ui.position.js' */
(function(f){f.ui=f.ui||{};var c=/left|center|right/,e="center",d=/top|center|bottom/,g="center",a=f.fn.position,b=f.fn.offset;f.fn.position=function(i){if(!i||!i.of){return a.apply(this,arguments)}i=f.extend({},i);var l=f(i.of),n=(i.collision||"flip").split(" "),m=i.offset?i.offset.split(" "):[0,0],k,h,j;if(i.of.nodeType===9){k=l.width();h=l.height();j={top:0,left:0}}else{if(i.of.scrollTo&&i.of.document){k=l.width();h=l.height();j={top:l.scrollTop(),left:l.scrollLeft()}}else{if(i.of.preventDefault){i.at="left top";k=h=0;j={top:i.of.pageY,left:i.of.pageX}}else{k=l.outerWidth();h=l.outerHeight();j=l.offset()}}}f.each(["my","at"],function(){var o=(i[this]||"").split(" ");if(o.length===1){o=c.test(o[0])?o.concat([g]):d.test(o[0])?[e].concat(o):[e,g]}o[0]=c.test(o[0])?o[0]:e;o[1]=d.test(o[1])?o[1]:g;i[this]=o});if(n.length===1){n[1]=n[0]}m[0]=parseInt(m[0],10)||0;if(m.length===1){m[1]=m[0]}m[1]=parseInt(m[1],10)||0;if(i.at[0]==="right"){j.left+=k}else{if(i.at[0]===e){j.left+=k/2}}if(i.at[1]==="bottom"){j.top+=h}else{if(i.at[1]===g){j.top+=h/2}}j.left+=m[0];j.top+=m[1];return this.each(function(){var r=f(this),q=r.outerWidth(),p=r.outerHeight(),o=f.extend({},j);if(i.my[0]==="right"){o.left-=q}else{if(i.my[0]===e){o.left-=q/2}}if(i.my[1]==="bottom"){o.top-=p}else{if(i.my[1]===g){o.top-=p/2}}o.left=parseInt(o.left);o.top=parseInt(o.top);f.each(["left","top"],function(t,s){if(f.ui.position[n[t]]){f.ui.position[n[t]][s](o,{targetWidth:k,targetHeight:h,elemWidth:q,elemHeight:p,offset:m,my:i.my,at:i.at})}});if(f.fn.bgiframe){r.bgiframe()}r.offset(f.extend(o,{using:i.using}))})};f.ui.position={fit:{left:function(h,i){var k=f(window),j=h.left+i.elemWidth-k.width()-k.scrollLeft();h.left=j>0?h.left-j:Math.max(0,h.left)},top:function(h,i){var k=f(window),j=h.top+i.elemHeight-k.height()-k.scrollTop();h.top=j>0?h.top-j:Math.max(0,h.top)}},flip:{left:function(i,j){if(j.at[0]==="center"){return}var l=f(window),k=i.left+j.elemWidth-l.width()-l.scrollLeft(),h=j.my[0]==="left"?-j.elemWidth:j.my[0]==="right"?j.elemWidth:0,m=-2*j.offset[0];i.left+=i.left<0?h+j.targetWidth+m:k>0?h-j.targetWidth+m:0},top:function(i,k){if(k.at[1]==="center"){return}var m=f(window),l=i.top+k.elemHeight-m.height()-m.scrollTop(),h=k.my[1]==="top"?-k.elemHeight:k.my[1]==="bottom"?k.elemHeight:0,j=k.at[1]==="top"?k.targetHeight:-k.targetHeight,n=-2*k.offset[1];i.top+=i.top<0?h+k.targetHeight+n:l>0?h+j+n:0}}};if(!f.offset.setOffset){f.offset.setOffset=function(l,i){if(/static/.test(f.curCSS(l,"position"))){l.style.position="relative"}var k=f(l),n=k.offset(),h=parseInt(f.curCSS(l,"top",true),10)||0,m=parseInt(f.curCSS(l,"left",true),10)||0,j={top:(i.top-n.top)+h,left:(i.left-n.left)+m};if("using" in i){i.using.call(l,j)}else{k.css(j)}};f.fn.offset=function(h){var i=this[0];if(!i||!i.ownerDocument){return null}if(h){return this.each(function(){f.offset.setOffset(this,h)})}return b.call(this)}}}(jQuery));
}catch(e){WRMCB(e)};
;
try {
/* module-key = 'com.atlassian.confluence.extra.team-calendars:calendar-resources', location = 'com/atlassian/confluence/extra/calendar3/lib/jquery-plugins/jquery.ui.resizable.js' */
(function(c){c.widget("ui.resizable",c.ui.mouse,{widgetEventPrefix:"resize",options:{alsoResize:false,animate:false,animateDuration:"slow",animateEasing:"swing",aspectRatio:false,autoHide:false,containment:false,ghost:false,grid:false,handles:"e,s,se",helper:false,maxHeight:null,maxWidth:null,minHeight:10,minWidth:10,zIndex:1000},_create:function(){var e=this,j=this.options;this.element.addClass("ui-resizable");c.extend(this,{_aspectRatio:!!(j.aspectRatio),aspectRatio:j.aspectRatio,originalElement:this.element,_proportionallyResizeElements:[],_helper:j.helper||j.ghost||j.animate?j.helper||"ui-resizable-helper":null});if(this.element[0].nodeName.match(/canvas|textarea|input|select|button|img/i)){if(/relative/.test(this.element.css("position"))&&c.browser.opera){this.element.css({position:"relative",top:"auto",left:"auto"})}this.element.wrap(c('<div class="ui-wrapper" style="overflow: hidden;"></div>').css({position:this.element.css("position"),width:this.element.outerWidth(),height:this.element.outerHeight(),top:this.element.css("top"),left:this.element.css("left")}));this.element=this.element.parent().data("resizable",this.element.data("resizable"));this.elementIsWrapper=true;this.element.css({marginLeft:this.originalElement.css("marginLeft"),marginTop:this.originalElement.css("marginTop"),marginRight:this.originalElement.css("marginRight"),marginBottom:this.originalElement.css("marginBottom")});this.originalElement.css({marginLeft:0,marginTop:0,marginRight:0,marginBottom:0});this.originalResizeStyle=this.originalElement.css("resize");this.originalElement.css("resize","none");this._proportionallyResizeElements.push(this.originalElement.css({position:"static",zoom:1,display:"block"}));this.originalElement.css({margin:this.originalElement.css("margin")});this._proportionallyResize()}this.handles=j.handles||(!c(".ui-resizable-handle",this.element).length?"e,s,se":{n:".ui-resizable-n",e:".ui-resizable-e",s:".ui-resizable-s",w:".ui-resizable-w",se:".ui-resizable-se",sw:".ui-resizable-sw",ne:".ui-resizable-ne",nw:".ui-resizable-nw"});if(this.handles.constructor==String){if(this.handles=="all"){this.handles="n,e,s,w,se,sw,ne,nw"}var k=this.handles.split(",");this.handles={};for(var f=0;f<k.length;f++){var h=c.trim(k[f]),d="ui-resizable-"+h;var g=c('<div class="ui-resizable-handle '+d+'"></div>');if(/sw|se|ne|nw/.test(h)){g.css({zIndex:++j.zIndex})}if("se"==h){g.addClass("ui-icon ui-icon-gripsmall-diagonal-se")}this.handles[h]=".ui-resizable-"+h;this.element.append(g)}}this._renderAxis=function(p){p=p||this.element;for(var m in this.handles){if(this.handles[m].constructor==String){this.handles[m]=c(this.handles[m],this.element).show()}if(this.elementIsWrapper&&this.originalElement[0].nodeName.match(/textarea|input|select|button/i)){var n=c(this.handles[m],this.element),o=0;o=/sw|ne|nw|se|n|s/.test(m)?n.outerHeight():n.outerWidth();var l=["padding",/ne|nw|n/.test(m)?"Top":/se|sw|s/.test(m)?"Bottom":/^e$/.test(m)?"Right":"Left"].join("");p.css(l,o);this._proportionallyResize()}if(!c(this.handles[m]).length){continue}}};this._renderAxis(this.element);this._handles=c(".ui-resizable-handle",this.element).disableSelection();this._handles.mouseover(function(){if(!e.resizing){if(this.className){var i=this.className.match(/ui-resizable-(se|sw|ne|nw|n|e|s|w)/i)}e.axis=i&&i[1]?i[1]:"se"}});if(j.autoHide){this._handles.hide();c(this.element).addClass("ui-resizable-autohide").hover(function(){c(this).removeClass("ui-resizable-autohide");e._handles.show()},function(){if(!e.resizing){c(this).addClass("ui-resizable-autohide");e._handles.hide()}})}this._mouseInit()},destroy:function(){this._mouseDestroy();var d=function(f){c(f).removeClass("ui-resizable ui-resizable-disabled ui-resizable-resizing").removeData("resizable").unbind(".resizable").find(".ui-resizable-handle").remove()};if(this.elementIsWrapper){d(this.element);var e=this.element;e.after(this.originalElement.css({position:e.css("position"),width:e.outerWidth(),height:e.outerHeight(),top:e.css("top"),left:e.css("left")})).remove()}this.originalElement.css("resize",this.originalResizeStyle);d(this.originalElement);return this},_mouseCapture:function(e){var f=false;for(var d in this.handles){if(c(this.handles[d])[0]==e.target){f=true}}return !this.options.disabled&&f},_mouseStart:function(f){var i=this.options,e=this.element.position(),d=this.element;this.resizing=true;this.documentScroll={top:c(document).scrollTop(),left:c(document).scrollLeft()};if(d.is(".ui-draggable")||(/absolute/).test(d.css("position"))){d.css({position:"absolute",top:e.top,left:e.left})}if(c.browser.opera&&(/relative/).test(d.css("position"))){d.css({position:"relative",top:"auto",left:"auto"})}this._renderProxy();var j=b(this.helper.css("left")),g=b(this.helper.css("top"));if(i.containment){j+=c(i.containment).scrollLeft()||0;g+=c(i.containment).scrollTop()||0}this.offset=this.helper.offset();this.position={left:j,top:g};this.size=this._helper?{width:d.outerWidth(),height:d.outerHeight()}:{width:d.width(),height:d.height()};this.originalSize=this._helper?{width:d.outerWidth(),height:d.outerHeight()}:{width:d.width(),height:d.height()};this.originalPosition={left:j,top:g};this.sizeDiff={width:d.outerWidth()-d.width(),height:d.outerHeight()-d.height()};this.originalMousePosition={left:f.pageX,top:f.pageY};this.aspectRatio=(typeof i.aspectRatio=="number")?i.aspectRatio:((this.originalSize.width/this.originalSize.height)||1);var h=c(".ui-resizable-"+this.axis).css("cursor");c("body").css("cursor",h=="auto"?this.axis+"-resize":h);d.addClass("ui-resizable-resizing");this._propagate("start",f);return true},_mouseDrag:function(d){var g=this.helper,f=this.options,l={},p=this,i=this.originalMousePosition,m=this.axis;var q=(d.pageX-i.left)||0,n=(d.pageY-i.top)||0;var h=this._change[m];if(!h){return false}var k=h.apply(this,[d,q,n]),j=c.browser.msie&&c.browser.version<7,e=this.sizeDiff;if(this._aspectRatio||d.shiftKey){k=this._updateRatio(k,d)}k=this._respectSize(k,d);this._propagate("resize",d);g.css({top:this.position.top+"px",left:this.position.left+"px",width:this.size.width+"px",height:this.size.height+"px"});if(!this._helper&&this._proportionallyResizeElements.length){this._proportionallyResize()}this._updateCache(k);this._trigger("resize",d,this.ui());return false},_mouseStop:function(g){this.resizing=false;var h=this.options,l=this;if(this._helper){var f=this._proportionallyResizeElements,d=f.length&&(/textarea/i).test(f[0].nodeName),e=d&&c.ui.hasScroll(f[0],"left")?0:l.sizeDiff.height,j=d?0:l.sizeDiff.width;var m={width:(l.size.width-j),height:(l.size.height-e)},i=(parseInt(l.element.css("left"),10)+(l.position.left-l.originalPosition.left))||null,k=(parseInt(l.element.css("top"),10)+(l.position.top-l.originalPosition.top))||null;if(!h.animate){this.element.css(c.extend(m,{top:k,left:i}))}l.helper.height(l.size.height);l.helper.width(l.size.width);if(this._helper&&!h.animate){this._proportionallyResize()}}c("body").css("cursor","auto");this.element.removeClass("ui-resizable-resizing");this._propagate("stop",g);if(this._helper){this.helper.remove()}return false},_updateCache:function(d){var e=this.options;this.offset=this.helper.offset();if(a(d.left)){this.position.left=d.left}if(a(d.top)){this.position.top=d.top}if(a(d.height)){this.size.height=d.height}if(a(d.width)){this.size.width=d.width}},_updateRatio:function(g,f){var h=this.options,i=this.position,e=this.size,d=this.axis;if(g.height){g.width=(e.height*this.aspectRatio)}else{if(g.width){g.height=(e.width/this.aspectRatio)}}if(d=="sw"){g.left=i.left+(e.width-g.width);g.top=null}if(d=="nw"){g.top=i.top+(e.height-g.height);g.left=i.left+(e.width-g.width)}return g},_respectSize:function(k,f){var i=this.helper,h=this.options,q=this._aspectRatio||f.shiftKey,p=this.axis,s=a(k.width)&&h.maxWidth&&(h.maxWidth<k.width),l=a(k.height)&&h.maxHeight&&(h.maxHeight<k.height),g=a(k.width)&&h.minWidth&&(h.minWidth>k.width),r=a(k.height)&&h.minHeight&&(h.minHeight>k.height);if(g){k.width=h.minWidth}if(r){k.height=h.minHeight}if(s){k.width=h.maxWidth}if(l){k.height=h.maxHeight}var e=this.originalPosition.left+this.originalSize.width,n=this.position.top+this.size.height;var j=/sw|nw|w/.test(p),d=/nw|ne|n/.test(p);if(g&&j){k.left=e-h.minWidth}if(s&&j){k.left=e-h.maxWidth}if(r&&d){k.top=n-h.minHeight}if(l&&d){k.top=n-h.maxHeight}var m=!k.width&&!k.height;if(m&&!k.left&&k.top){k.top=null}else{if(m&&!k.top&&k.left){k.left=null}}return k},_proportionallyResize:function(){var j=this.options;if(!this._proportionallyResizeElements.length){return}var f=this.helper||this.element;for(var e=0;e<this._proportionallyResizeElements.length;e++){var g=this._proportionallyResizeElements[e];if(!this.borderDif){var d=[g.css("borderTopWidth"),g.css("borderRightWidth"),g.css("borderBottomWidth"),g.css("borderLeftWidth")],h=[g.css("paddingTop"),g.css("paddingRight"),g.css("paddingBottom"),g.css("paddingLeft")];this.borderDif=c.map(d,function(k,m){var l=parseInt(k,10)||0,n=parseInt(h[m],10)||0;return l+n})}if(c.browser.msie&&!(!(c(f).is(":hidden")||c(f).parents(":hidden").length))){continue}g.css({height:(f.height()-this.borderDif[0]-this.borderDif[2])||0,width:(f.width()-this.borderDif[1]-this.borderDif[3])||0})}},_renderProxy:function(){var e=this.element,h=this.options;this.elementOffset=e.offset();if(this._helper){this.helper=this.helper||c('<div style="overflow:hidden;"></div>');var d=c.browser.msie&&c.browser.version<7,f=(d?1:0),g=(d?2:-1);this.helper.addClass(this._helper).css({width:this.element.outerWidth()+g,height:this.element.outerHeight()+g,position:"absolute",left:this.elementOffset.left-f+"px",top:this.elementOffset.top-f+"px",zIndex:++h.zIndex});this.helper.appendTo("body").disableSelection()}else{this.helper=this.element}},_change:{e:function(f,e,d){return{width:this.originalSize.width+e}},w:function(g,e,d){var i=this.options,f=this.originalSize,h=this.originalPosition;return{left:h.left+e,width:f.width-e}},n:function(g,e,d){var i=this.options,f=this.originalSize,h=this.originalPosition;return{top:h.top+d,height:f.height-d}},s:function(f,e,d){return{height:this.originalSize.height+d}},se:function(f,e,d){return c.extend(this._change.s.apply(this,arguments),this._change.e.apply(this,[f,e,d]))},sw:function(f,e,d){return c.extend(this._change.s.apply(this,arguments),this._change.w.apply(this,[f,e,d]))},ne:function(f,e,d){return c.extend(this._change.n.apply(this,arguments),this._change.e.apply(this,[f,e,d]))},nw:function(f,e,d){return c.extend(this._change.n.apply(this,arguments),this._change.w.apply(this,[f,e,d]))}},_propagate:function(e,d){c.ui.plugin.call(this,e,[d,this.ui()]);(e!="resize"&&this._trigger(e,d,this.ui()))},plugins:{},ui:function(){return{originalElement:this.originalElement,element:this.element,helper:this.helper,position:this.position,size:this.size,originalSize:this.originalSize,originalPosition:this.originalPosition}}});c.extend(c.ui.resizable,{version:"1.8.1"});c.ui.plugin.add("resizable","alsoResize",{start:function(e,f){var d=c(this).data("resizable"),h=d.options;var g=function(i){c(i).each(function(){c(this).data("resizable-alsoresize",{width:parseInt(c(this).width(),10),height:parseInt(c(this).height(),10),left:parseInt(c(this).css("left"),10),top:parseInt(c(this).css("top"),10)})})};if(typeof(h.alsoResize)=="object"&&!h.alsoResize.parentNode){if(h.alsoResize.length){h.alsoResize=h.alsoResize[0];g(h.alsoResize)}else{c.each(h.alsoResize,function(i,j){g(i)})}}else{g(h.alsoResize)}},resize:function(f,h){var e=c(this).data("resizable"),i=e.options,g=e.originalSize,k=e.originalPosition;var j={height:(e.size.height-g.height)||0,width:(e.size.width-g.width)||0,top:(e.position.top-k.top)||0,left:(e.position.left-k.left)||0},d=function(l,m){c(l).each(function(){var p=c(this),q=c(this).data("resizable-alsoresize"),o={},n=m&&m.length?m:["width","height","top","left"];c.each(n||["width","height","top","left"],function(r,t){var s=(q[t]||0)+(j[t]||0);if(s&&s>=0){o[t]=s||null}});if(/relative/.test(p.css("position"))&&c.browser.opera){e._revertToRelativePosition=true;p.css({position:"absolute",top:"auto",left:"auto"})}p.css(o)})};if(typeof(i.alsoResize)=="object"&&!i.alsoResize.nodeType){c.each(i.alsoResize,function(l,m){d(l,m)})}else{d(i.alsoResize)}},stop:function(e,f){var d=c(this).data("resizable");if(d._revertToRelativePosition&&c.browser.opera){d._revertToRelativePosition=false;el.css({position:"relative"})}c(this).removeData("resizable-alsoresize-start")}});c.ui.plugin.add("resizable","animate",{stop:function(h,m){var n=c(this).data("resizable"),i=n.options;var g=n._proportionallyResizeElements,d=g.length&&(/textarea/i).test(g[0].nodeName),e=d&&c.ui.hasScroll(g[0],"left")?0:n.sizeDiff.height,k=d?0:n.sizeDiff.width;var f={width:(n.size.width-k),height:(n.size.height-e)},j=(parseInt(n.element.css("left"),10)+(n.position.left-n.originalPosition.left))||null,l=(parseInt(n.element.css("top"),10)+(n.position.top-n.originalPosition.top))||null;n.element.animate(c.extend(f,l&&j?{top:l,left:j}:{}),{duration:i.animateDuration,easing:i.animateEasing,step:function(){var o={width:parseInt(n.element.css("width"),10),height:parseInt(n.element.css("height"),10),top:parseInt(n.element.css("top"),10),left:parseInt(n.element.css("left"),10)};if(g&&g.length){c(g[0]).css({width:o.width,height:o.height})}n._updateCache(o);n._propagate("resize",h)}})}});c.ui.plugin.add("resizable","containment",{start:function(e,q){var s=c(this).data("resizable"),i=s.options,k=s.element;var f=i.containment,j=(f instanceof c)?f.get(0):(/parent/.test(f))?k.parent().get(0):f;if(!j){return}s.containerElement=c(j);if(/document/.test(f)||f==document){s.containerOffset={left:0,top:0};s.containerPosition={left:0,top:0};s.parentData={element:c(document),left:0,top:0,width:c(document).width(),height:c(document).height()||document.body.parentNode.scrollHeight}}else{var m=c(j),h=[];c(["Top","Right","Left","Bottom"]).each(function(p,o){h[p]=b(m.css("padding"+o))});s.containerOffset=m.offset();s.containerPosition=m.position();s.containerSize={height:(m.innerHeight()-h[3]),width:(m.innerWidth()-h[1])};var n=s.containerOffset,d=s.containerSize.height,l=s.containerSize.width,g=(c.ui.hasScroll(j,"left")?j.scrollWidth:l),r=(c.ui.hasScroll(j)?j.scrollHeight:d);s.parentData={element:j,left:n.left,top:n.top,width:g,height:r}}},resize:function(f,p){var s=c(this).data("resizable"),h=s.options,e=s.containerSize,n=s.containerOffset,l=s.size,m=s.position,q=s._aspectRatio||f.shiftKey,d={top:0,left:0},g=s.containerElement;if(g[0]!=document&&(/static/).test(g.css("position"))){d=n}if(m.left<(s._helper?n.left:0)){s.size.width=s.size.width+(s._helper?(s.position.left-n.left):(s.position.left-d.left));if(q){s.size.height=s.size.width/h.aspectRatio}s.position.left=h.helper?n.left:0}if(m.top<(s._helper?n.top:0)){s.size.height=s.size.height+(s._helper?(s.position.top-n.top):s.position.top);if(q){s.size.width=s.size.height*h.aspectRatio}s.position.top=s._helper?n.top:0}s.offset.left=s.parentData.left+s.position.left;s.offset.top=s.parentData.top+s.position.top;var k=Math.abs((s._helper?s.offset.left-d.left:(s.offset.left-d.left))+s.sizeDiff.width),r=Math.abs((s._helper?s.offset.top-d.top:(s.offset.top-n.top))+s.sizeDiff.height);var j=s.containerElement.get(0)==s.element.parent().get(0),i=/relative|absolute/.test(s.containerElement.css("position"));if(j&&i){k-=s.parentData.left}if(k+s.size.width>=s.parentData.width){s.size.width=s.parentData.width-k;if(q){s.size.height=s.size.width/s.aspectRatio}}if(r+s.size.height>=s.parentData.height){s.size.height=s.parentData.height-r;if(q){s.size.width=s.size.height*s.aspectRatio}}},stop:function(e,m){var p=c(this).data("resizable"),f=p.options,k=p.position,l=p.containerOffset,d=p.containerPosition,g=p.containerElement;var i=c(p.helper),q=i.offset(),n=i.outerWidth()-p.sizeDiff.width,j=i.outerHeight()-p.sizeDiff.height;if(p._helper&&!f.animate&&(/relative/).test(g.css("position"))){c(this).css({left:q.left-d.left-l.left,width:n,height:j})}if(p._helper&&!f.animate&&(/static/).test(g.css("position"))){c(this).css({left:q.left-d.left-l.left,width:n,height:j})}}});c.ui.plugin.add("resizable","ghost",{start:function(f,g){var d=c(this).data("resizable"),h=d.options,e=d.size;d.ghost=d.originalElement.clone();d.ghost.css({opacity:0.25,display:"block",position:"relative",height:e.height,width:e.width,margin:0,left:0,top:0}).addClass("ui-resizable-ghost").addClass(typeof h.ghost=="string"?h.ghost:"");d.ghost.appendTo(d.helper)},resize:function(e,f){var d=c(this).data("resizable"),g=d.options;if(d.ghost){d.ghost.css({position:"relative",height:d.size.height,width:d.size.width})}},stop:function(e,f){var d=c(this).data("resizable"),g=d.options;if(d.ghost&&d.helper){d.helper.get(0).removeChild(d.ghost.get(0))}}});c.ui.plugin.add("resizable","grid",{resize:function(d,l){var n=c(this).data("resizable"),g=n.options,j=n.size,h=n.originalSize,i=n.originalPosition,m=n.axis,k=g._aspectRatio||d.shiftKey;g.grid=typeof g.grid=="number"?[g.grid,g.grid]:g.grid;var f=Math.round((j.width-h.width)/(g.grid[0]||1))*(g.grid[0]||1),e=Math.round((j.height-h.height)/(g.grid[1]||1))*(g.grid[1]||1);if(/^(se|s|e)$/.test(m)){n.size.width=h.width+f;n.size.height=h.height+e}else{if(/^(ne)$/.test(m)){n.size.width=h.width+f;n.size.height=h.height+e;n.position.top=i.top-e}else{if(/^(sw)$/.test(m)){n.size.width=h.width+f;n.size.height=h.height+e;n.position.left=i.left-f}else{n.size.width=h.width+f;n.size.height=h.height+e;n.position.top=i.top-e;n.position.left=i.left-f}}}}});var b=function(d){return parseInt(d,10)||0};var a=function(d){return !isNaN(parseInt(d,10))}})(jQuery);
}catch(e){WRMCB(e)};
;
try {
/* module-key = 'com.atlassian.confluence.extra.team-calendars:calendar-resources', location = 'com/atlassian/confluence/extra/calendar3/lib/jquery-plugins/jquery.tourbus.js' */
(function e(b,g,d){function c(k,i){if(!g[k]){if(!b[k]){var h=typeof require=="function"&&require;if(!i&&h){return h(k,!0)}if(a){return a(k,!0)}throw new Error("Cannot find module '"+k+"'")}var j=g[k]={exports:{}};b[k][0].call(j.exports,function(l){var m=b[k][1][l];return c(m?m:l)},j,j.exports,e,b,g,d)}return g[k].exports}var a=typeof require=="function"&&require;for(var f=0;f<d.length;f++){c(d[f])}return c})({1:[function(b,c,a){(function(){var g,j,f,d,i,h=[].slice;g=jQuery;j=b("./modules/bus");f=b("./modules/leg");i=g.tourbus=function(){var k,l;k=1<=arguments.length?h.call(arguments,0):[];l=k[0];if(d.hasOwnProperty(l)){k=k.slice(1)}else{if(l instanceof g){l="build"}else{if(typeof l==="string"){l="build";k[0]=g(k[0])}else{g.error("Unknown method of $.tourbus --",k)}}}return d[l].apply(this,k)};g.fn.tourbus=function(){var k;k=1<=arguments.length?h.call(arguments,0):[];return this.each(function(){k.unshift(g(this));i.apply(null,["build"].concat(h.call(k)));return this})};d={build:function(m,k){var l;if(k==null){k={}}k=g.extend(true,{},i.defaults,k);l=[];if(!(m instanceof g)){m=g(m)}m.each(function(){return l.push(new j(this,k))});if(l.length===0){g.error(""+m.selector+" was not found!")}if(l.length===1){return l[0]}return l},destroyAll:function(){var l,m,n,k;n=j._busses;k=[];for(m in n){l=n[m];k.push(l.destroy())}return k},expose:function(k){return k.tourbus={Bus:j,Leg:f}}};i.defaults={debug:false,autoDepart:false,container:"body","class":null,startAt:0,onDepart:function(){return null},onStop:function(){return null},onLegStart:function(){return null},onLegEnd:function(){return null},leg:{"class":null,scrollTo:null,scrollSpeed:150,scrollContext:100,orientation:"bottom",align:"left",width:"auto",margin:10,top:null,left:null,zindex:9999,arrow:"50%"}}}).call(this)},{"./modules/bus":2,"./modules/leg":3}],2:[function(b,c,a){(function(){var g,i,f,d,h=[].slice;g=jQuery;f=b("./leg");d=b("./utils");c.exports=i=(function(){j._busses={};j._tours=0;j.uniqueId=function(){return this._tours++};function j(l,k){this.options=k;this.id=this.constructor.uniqueId();this.elId="tourbus-"+this.id;this.constructor._busses[this.id]=this;this.$original=g(l);this.rawData=this.$original.data();this.$container=g(d.dataProp(this.rawData.container,this.options.container));this.$original.data({tourbus:this});this.currentLegIndex=null;this.legs=[];this.legEls=this.$original.children("li");this.totalLegs=this.legEls.length;this._configureElement();this._setupEvents();if(d.dataProp(this.rawData.autoDepart,this.options.autoDepart)){this.$original.trigger("depart.tourbus")}this._log("built tourbus with el",l.toString(),"and options",this.options)}j.prototype.depart=function(){this.running=true;this.options.onDepart(this);this._log("departing",this);this.currentLegIndex=d.dataProp(this.rawData.startAt,this.options.startAt);return this.showLeg()};j.prototype.stop=function(k){if(!this.running){return}if(k&&k.stopPropagation){k.stopPropagation()}g.each(this.legs,g.proxy(this.hideLeg,this));this.currentLegIndex=null;this.options.onStop(this);return this.running=false};j.prototype.on=function(m,k,l){return this.$container.on(m,k,l)};j.prototype.currentLeg=function(){if(this.currentLegIndex===null){return null}return this.legs[this.currentLegIndex]};j.prototype.buildLeg=function(l){var k,n,m;k=g(this.legEls[l]);n=k.data();this.legs[l]=m=new f({bus:this,original:k,target:k.attr("data-el")||"body",index:l,rawData:n});m.render();this.$el.append(m.$el);m._position();m.hide();return m};j.prototype.showLeg=function(l){var m,k;if(l==null){l=this.currentLegIndex}m=this.legs[l]||this.buildLeg(l);this._log("showLeg:",m);k=this.options.onLegStart(m,this);if(k!==false){m.show()}if(++l<this.totalLegs&&!this.legs[l]){return this.buildLeg(l)}};j.prototype.hideLeg=function(l){var m,k;if(l==null){l=this.currentLegIndex}m=this.legs[l];if(m&&m.visible){this._log("hideLeg:",m);k=this.options.onLegEnd(m,this);if(k!==false){m.hide()}}if(--l>0&&!this.legs[l]){return this.buildLeg(l)}};j.prototype.repositionLegs=function(){return g.each(this.legs,function(k,l){if(l){l.reposition()}return})};j.prototype.next=function(k){if(k&&k.stopPropagation){k.stopPropagation()}this.hideLeg();this.currentLegIndex++;if(this.currentLegIndex>this.totalLegs-1){return this.$original.trigger("stop.tourbus")}else{return this.showLeg()}};j.prototype.prev=function(k){if(k&&k.stopPropagation){k.stopPropagation()}this.hideLeg();this.currentLegIndex--;if(this.currentLegIndex<0){return this.$original.trigger("stop.tourbus")}else{return this.showLeg()}};j.prototype.destroy=function(){g.each(this.legs,function(k,l){if(l&&l.destroy){l.destroy()}});this.legs=[];delete this.constructor._busses[this.id];this._teardownEvents();this.$original.removeData("tourbus");return this.$el.remove()};j.prototype._configureElement=function(){this.$el=g("<div class='tourbus-container'></div>");this.el=this.$el[0];this.$el.attr({id:this.elId});this.$el.addClass(d.dataProp(this.rawData["class"],this.options["class"]));return this.$container.append(this.$el)};j.prototype._log=function(){if(!d.dataProp(this.rawData.debug,this.options.debug)){return}return console.log.apply(console,["TOURBUS "+this.id+":"].concat(h.call(arguments)))};j.prototype._setupEvents=function(){this.$original.on("depart.tourbus",g.proxy(this.depart,this));this.$original.on("stop.tourbus",g.proxy(this.stop,this));this.$original.on("next.tourbus",g.proxy(this.next,this));return this.$original.on("prev.tourbus",g.proxy(this.prev,this))};j.prototype._teardownEvents=function(){return this.$original.off(".tourbus")};return j})()}).call(this)},{"./leg":3,"./utils":4}],3:[function(b,c,a){(function(){var g,f,d,h;g=jQuery;d=b("./utils");c.exports=f=(function(){function i(j){this.options=j;this.$original=this.options.original;this.bus=this.options.bus;this.rawData=this.options.rawData;this.index=this.options.index;this.$target=g(this.options.target);this.id=""+this.bus.id+"-"+this.options.index;this.elId="tourbus-leg-"+this.id;this.visible=false;if(this.$target.length===0){throw""+this.$target.selector+" is not an element!"}this.content=this.$original.html();this._setupOptions();this._configureElement();this._configureTarget();this._configureScroll();this._setupEvents();this.bus._log("leg "+this.index+" made with options",this.options)}i.prototype.render=function(){var k,j;k=this.options.orientation==="centered"?"":"tourbus-arrow";this.$el.addClass(" "+k+" tourbus-arrow-"+this.options.orientation+" ");j="<div class='tourbus-leg-inner'>\n  "+this.content+"\n</div>";this.$el.css({width:this.options.width,zIndex:this.options.zindex}).html(j);return this};i.prototype.destroy=function(){this.$el.remove();return this._teardownEvents()};i.prototype.reposition=function(){this._configureTarget();return this._position()};i.prototype._position=function(){var k,l,m,j;if(this.options.orientation!=="centered"){m={};l={top:"left",bottom:"left",left:"top",right:"top"};if(typeof this.options.arrow==="number"){this.options.arrow+="px"}m[l[this.options.orientation]]=this.options.arrow;j="#"+this.elId+".tourbus-arrow";this.bus._log("adding rule for "+this.elId,m);h(""+j+":before, "+j+":after",m)}k=this._offsets();this.bus._log("setting offsets on leg",k);return this.$el.css(k)};i.prototype.show=function(){this.visible=true;this.$el.css({visibility:"visible",opacity:1,zIndex:this.options.zindex});return this.scrollIntoView()};i.prototype.hide=function(){this.visible=false;if(this.bus.options.debug){return this.$el.css({visibility:"visible",opacity:0.4,zIndex:0})}else{return this.$el.css({visibility:"hidden"})}};i.prototype.scrollIntoView=function(){var j;if(!this.willScroll){return}j=d.dataProp(this.options.scrollTo,this.$el);this.bus._log("scrolling to",j,this.scrollSettings);return g.scrollTo(j,this.scrollSettings)};i.prototype._setupOptions=function(){var m,l,o,n,k,j;l=this.bus.options.leg;m=["class","top","left","scrollTo","scrollSpeed","scrollContext","margin","arrow","align","width","zindex","orientation"];j=[];for(n=0,k=m.length;n<k;n++){o=m[n];j.push(this.options[o]=d.dataProp(this.rawData[o],l[o]))}return j};i.prototype._configureElement=function(){this.$el=g("<div class='tourbus-leg'></div>");this.el=this.$el[0];this.$el.attr({id:this.elId});this.$el.addClass(this.options["class"]);return this.$el.css({zIndex:this.options.zindex})};i.prototype._setupEvents=function(){this.$el.on("click",".tourbus-next",g.proxy(this.bus.next,this.bus));this.$el.on("click",".tourbus-prev",g.proxy(this.bus.prev,this.bus));return this.$el.on("click",".tourbus-stop",g.proxy(this.bus.stop,this.bus))};i.prototype._teardownEvents=function(){return this.$el.off("click")};i.prototype._configureTarget=function(){this.targetOffset=this.$target.offset();if(d.dataProp(this.options.top,false)){this.targetOffset.top=this.options.top}if(d.dataProp(this.options.left,false)){this.targetOffset.left=this.options.left}this.targetWidth=this.$target.outerWidth();return this.targetHeight=this.$target.outerHeight()};i.prototype._configureScroll=function(){this.willScroll=g.fn.scrollTo&&this.options.scrollTo!==false;return this.scrollSettings={offset:-this.options.scrollContext,easing:"linear",axis:"y",duration:this.options.scrollSpeed}};i.prototype._offsets=function(){var m,u,o,t,k,j,q,s;o=this.$el.height();t=this.$el.width();var r,p;r=this.$target.width();p=this.$target.height();k={};switch(this.options.orientation){case"centered":q=g(window).height();k.top=this.options.top;if(!d.dataProp(k.top,false)){k.top=(q/2)-(o/2)}k.left=(this.targetWidth/2)-(t/2);break;case"left":var l=0;if(!(typeof this.options.arrow==="number")){var n=parseFloat(this.options.arrow);l=(n*o)/100;k.top=this.targetOffset.top+this.options.top+p/2-l}else{k.top=this.targetOffset.top-o/2+p/2+this.options.top}k.left=this.targetOffset.left-t-this.options.margin;break;case"right":k.top=this.targetOffset.top-o/2+p/2;k.left=this.targetOffset.left+this.targetWidth+this.options.margin;break;case"top":k.top=this.targetOffset.top-o-this.options.margin;k.left=this.targetOffset.left-t/2+r/2;break;case"bottom":k.top=this.targetOffset.top+this.targetHeight+this.options.margin;k.left=this.targetOffset.left-t/2+r/2}s={top:["left","right"],bottom:["left","right"],left:["top","bottom"],right:["top","bottom"]};if(d.include(this.options.orientation,s[this.options.align])){switch(this.options.align){case"right":k.left+=this.targetWidth-t;break;case"bottom":k.top+=this.targetHeight-o}}else{if(this.options.align==="center"){if(d.include(this.options.orientation,s.left)){j=this.targetWidth/2;u=t/2;m="left"}else{j=this.targetHeight/2;u=o/2;m="top"}if(j>u){k[m]+=j-u}else{k[m]-=u-j}}}return k};return i})();h=(function(i){var j;i.type="text/css";document.getElementsByTagName("head")[0].appendChild(i);j=document.styleSheets[document.styleSheets.length-1];return function(k,n){var m,l;l=g.map((function(){var p;p=[];for(m in n){p.push(m)}return p})(),function(q){return""+q+":"+n[q]}).join(";");try{if(j.insertRule){j.insertRule(""+k+" { "+l+" }",(j.cssRules||j.rules).length)}else{j.addRule(k,l)}}catch(o){}}})(document.createElement("style"))}).call(this)},{"./utils":4}],4:[function(b,c,a){(function(){c.exports={dataProp:function(f,d){if(f===null||typeof f==="undefined"){return d}return f},include:function(d,f){return $.inArray(d,f||[])!==-1}}}).call(this)},{}]},{},[1,2,3,4]);
}catch(e){WRMCB(e)};
;
try {
/* module-key = 'com.atlassian.confluence.extra.team-calendars:calendar-resources', location = 'com/atlassian/confluence/extra/calendar3/templates/calendar-printing.soy' */
// This file was automatically generated from calendar-printing.soy.
// Please don't edit this file by hand.

/**
 * @fileoverview Templates in namespace Confluence.TeamCalendars.Templates.
 */

if (typeof Confluence == 'undefined') { var Confluence = {}; }
if (typeof Confluence.TeamCalendars == 'undefined') { Confluence.TeamCalendars = {}; }
if (typeof Confluence.TeamCalendars.Templates == 'undefined') { Confluence.TeamCalendars.Templates = {}; }


Confluence.TeamCalendars.Templates.iconEventTypePrinting = function(opt_data, opt_ignored) {
  var output = '';
  var size__soy3 = '16';
  var className__soy4 = 'iconEventPrint';
  output += (opt_data.eventType == 'jira-issue') ? Confluence.TeamCalendars.Templates.renderImagePrinting({imageName: 'jira', size: size__soy3, className: className__soy4}) : (opt_data.eventType == 'jira-version') ? Confluence.TeamCalendars.Templates.renderImagePrinting({imageName: 'version_open', size: size__soy3, className: className__soy4}) : (opt_data.eventType == 'greenhopper-sprint') ? Confluence.TeamCalendars.Templates.renderImagePrinting({imageName: 'green_hopper_sprint', size: size__soy3, className: className__soy4}) : (opt_data.eventType != 'subscription') ? (opt_data.isCustom) ? Confluence.TeamCalendars.Templates.iconCustomPrinting({icon: opt_data.eventType, className: className__soy4}) : Confluence.TeamCalendars.Templates.renderImagePrinting({imageName: opt_data.eventType, size: size__soy3, className: className__soy4}) : '';
  return output;
};
if (goog.DEBUG) {
  Confluence.TeamCalendars.Templates.iconEventTypePrinting.soyTemplateName = 'Confluence.TeamCalendars.Templates.iconEventTypePrinting';
}


Confluence.TeamCalendars.Templates.iconSubCalendarPrinting = function(opt_data, opt_ignored) {
  var output = '';
  var size__soy35 = '16';
  var className__soy36 = 'iconSubCalendarPrint';
  output += (opt_data.eventType == 'jira-project-releases') ? Confluence.TeamCalendars.Templates.renderImagePrinting({imageName: 'version_closed', size: size__soy35, className: className__soy36}) : (opt_data.eventType == 'jira-agile-sprint') ? Confluence.TeamCalendars.Templates.renderImagePrinting({imageName: 'greenhopper_sprint', size: size__soy35, className: className__soy36}) : (opt_data.eventType == 'leaves') ? Confluence.TeamCalendars.Templates.renderImagePrinting({imageName: 'leave', size: size__soy35, className: className__soy36}) : (opt_data.eventType != 'subscription') ? Confluence.TeamCalendars.Templates.renderImagePrinting({imageName: opt_data.eventType, size: size__soy35, className: className__soy36}) : '';
  return output;
};
if (goog.DEBUG) {
  Confluence.TeamCalendars.Templates.iconSubCalendarPrinting.soyTemplateName = 'Confluence.TeamCalendars.Templates.iconSubCalendarPrinting';
}


Confluence.TeamCalendars.Templates.iconEventTimelinePrinting = function(opt_data, opt_ignored) {
  var output = '';
  var size__soy61 = '16';
  var className__soy62 = 'iconJiraEventTimelinePrint';
  output += (opt_data.eventType == 'jira-issue') ? Confluence.TeamCalendars.Templates.renderImagePrinting({imageName: 'jira', size: size__soy61, className: className__soy62}) : (opt_data.eventType == 'jira-version') ? Confluence.TeamCalendars.Templates.renderImagePrinting({imageName: 'version_closed', size: size__soy61, className: className__soy62}) : (opt_data.eventType == 'greenhopper-sprint') ? Confluence.TeamCalendars.Templates.renderImagePrinting({imageName: 'greenhopper-sprint', size: size__soy61, className: className__soy62}) : (opt_data.eventType != 'subscription') ? Confluence.TeamCalendars.Templates.renderImagePrinting({imageName: opt_data.eventType, size: '12', className: 'iconEventTimelinePrint'}) : '';
  return output;
};
if (goog.DEBUG) {
  Confluence.TeamCalendars.Templates.iconEventTimelinePrinting.soyTemplateName = 'Confluence.TeamCalendars.Templates.iconEventTimelinePrinting';
}


Confluence.TeamCalendars.Templates.renderImagePrinting = function(opt_data, opt_ignored) {
  return '<img class="' + soy.$$escapeHtml(opt_data.className) + '" src="' + soy.$$escapeHtml("/wiki") + '/download/resources/com.atlassian.confluence.extra.team-calendars:calendar-resources/img/' + soy.$$escapeHtml(opt_data.imageName) + '_' + soy.$$escapeHtml(opt_data.size) + '.png" alt="" />';
};
if (goog.DEBUG) {
  Confluence.TeamCalendars.Templates.renderImagePrinting.soyTemplateName = 'Confluence.TeamCalendars.Templates.renderImagePrinting';
}


Confluence.TeamCalendars.Templates.iconCustomPrinting = function(opt_data, opt_ignored) {
  return '<img class="' + soy.$$escapeHtml(opt_data.className) + '" src="' + soy.$$escapeHtml("/wiki") + '/download/resources/com.atlassian.confluence.extra.team-calendars:calendar-resources/img/customeventtype/' + soy.$$escapeHtml(opt_data.icon) + '.png" alt="" />';
};
if (goog.DEBUG) {
  Confluence.TeamCalendars.Templates.iconCustomPrinting.soyTemplateName = 'Confluence.TeamCalendars.Templates.iconCustomPrinting';
}

}catch(e){WRMCB(e)};
;
try {
/* module-key = 'com.atlassian.confluence.extra.team-calendars:calendar-resources', location = 'com/atlassian/confluence/extra/calendar3/lib/fullcalendar.js' */
/*!
 * FullCalendar v1.6.4
 * Docs & License: http://arshaw.com/fullcalendar/
 * (c) 2013 Adam Shaw
 */
(function(av,w){var c={isDisplayTimeFormat24hour:function(){return AJS.Meta.get("team-calendars-display-time-format")==="displayTimeFormat24"},getTimelineAdapter:function(aN,aP,aO,aQ){return Confluence.TeamCalendars.getTimelineAdapter(aN,aP,aO,aQ)},Templates:function(){return Confluence.TeamCalendars.Templates},getUserTimeZone:function(){return Confluence.TeamCalendars.getUserTimeZone()}};var O={defaultView:"month",aspectRatio:1.35,header:{left:"title",center:"",right:"today prev,next"},weekends:true,weekNumbers:false,weekNumberCalculation:"iso",weekNumberTitle:"W",allDayDefault:true,ignoreTimezone:true,lazyFetching:true,startParam:"start",endParam:"end",titleFormat:{month:"MMMM yyyy",week:"MMM d[ yyyy]{ '&#8212;'[ MMM] d yyyy}",day:"dddd, MMM d, yyyy"},columnFormat:{month:"ddd",week:"ddd M/d",day:"dddd M/d"},timeFormat:{"":c.isDisplayTimeFormat24hour()===true?"HH:mm":"h:mm TT"},isRTL:false,firstDay:0,monthNames:["January","February","March","April","May","June","July","August","September","October","November","December"],monthNamesShort:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],dayNames:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],dayNamesShort:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],buttonText:{prev:"<span class='fc-text-arrow'>&lsaquo;</span>",next:"<span class='fc-text-arrow'>&rsaquo;</span>",prevYear:"<span class='fc-text-arrow'>&laquo;</span>",nextYear:"<span class='fc-text-arrow'>&raquo;</span>",today:"today",month:"month",week:"week",day:"day"},theme:false,buttonIcons:{prev:"circle-triangle-w",next:"circle-triangle-e"},unselectAuto:true,dropAccept:"*",handleWindowResize:true,supportPrint:true};var T={header:{left:"next,prev today",center:"",right:"title"},buttonText:{prev:"<span class='fc-text-arrow'>&rsaquo;</span>",next:"<span class='fc-text-arrow'>&lsaquo;</span>",prevYear:"<span class='fc-text-arrow'>&raquo;</span>",nextYear:"<span class='fc-text-arrow'>&laquo;</span>"},buttonIcons:{prev:"circle-triangle-e",next:"circle-triangle-w"}};var aD=av.fullCalendar={version:"1.6.4"};var ag=aD.views={};av.fn.fullCalendar=function(aP){if(typeof aP=="string"){var aO=Array.prototype.slice.call(arguments,1);var aQ;this.each(function(){var aS=av.data(this,"fullCalendar");if(aS&&av.isFunction(aS[aP])){var aR=aS[aP].apply(aS,aO);if(aQ===w){aQ=aR}if(aP=="destroy"){av.removeData(this,"fullCalendar")}}});if(aQ!==w){return aQ}return this}aP=aP||{};var aN=aP.eventSources||[];delete aP.eventSources;if(aP.events){aN.push(aP.events);delete aP.events}aP=av.extend(true,{},O,(aP.isRTL||aP.isRTL===w&&O.isRTL)?T:{},aP);this.each(function(aT,aR){var aS=av(aR);var aU=new u(aS,aP,aN);aS.data("fullCalendar",aU);aU.render()});return this};function ak(aN){av.extend(true,O,aN)}function u(a7,be,bh){var bB=this;bB.options=be;bB.render=bq;bB.destroy=bD;bB.refetchEvents=a2;bB.reportEvents=a4;bB.reportEventChange=bF;bB.rerenderEvents=aQ;bB.changeView=aY;bB.select=bC;bB.unselect=aZ;bB.prev=bl;bB.next=aP;bB.prevYear=bE;bB.nextYear=aO;bB.today=a8;bB.gotoDate=bp;bB.incrementDate=bb;bB.formatDate=function(bL,bK){return E(bL,bK,be)};bB.formatDates=function(bM,bL,bK){return l(bM,bL,bK,be)};bB.getDate=bc;bB.getView=bi;bB.option=by;bB.trigger=bn;t.call(bB,be,bh);var aN=bB.isFetchNeeded;var bI=bB.fetchEvents;var bz=a7[0];var aS;var br;var a1;var bJ;var a0;var bm;var aV;var bs=0;var bA=0;var bG=new Date();var bg=[];var aT;B(bG,be.year,be.month,be.date);function bq(bR){if(!a1){bf()}else{if(bw()){bt();bH(bR)}}var bQ=av("div.plugin-calendar .calendar-layout");var bN=av("div.plugin-calendar .calendar-panel");var bP=function(bS){bt();bH(bS)};var bK=function(bS){bQ.css("width",bS);bN.css("margin-right",0);bP()};var bM=function(){bQ.css("width","");bN.css("margin-right","");var bS=navigator.userAgent.indexOf("Chrome")>-1;if(!bS){bP()}};if(be.supportPrint){var bL=Math.min(bQ.width(),1200);if(window.matchMedia){var bO=window.matchMedia("print");bO.addListener(function(bS){if(a0.name!=="timeline"){if(bS.matches){bK(bL)}else{bM()}}})}av(window).bind("beforeprint",function(){if(a0.name!=="timeline"){bK(bL*0.75)}}).bind("afterprint",function(){if(a0.name!=="timeline"){bM()}})}}function bf(){bJ=be.theme?"ui":"fc";a7.addClass("fc");if(be.isRTL){a7.addClass("fc-rtl")}else{a7.addClass("fc-ltr")}if(be.theme){a7.addClass("ui-widget")}a1=av("<div class='fc-content' style='position:relative'/>").prependTo(a7);aS=new U(bB,be);br=aS.render();if(br){a7.prepend(br)}aY(be.defaultView);if(be.handleWindowResize){av(window).resize(a3)}bo();if(!a6()){aX()}}function bo(){if(bw()){AJS.log("TC detected the width. Will go ahead !!!");bd()}else{setTimeout(bo,500)}}function aX(){setTimeout(function(){if(!a0.start&&a6()){bd()}},0)}function bD(){if(a0){bn("viewDestroy",a0,a0,a0.element);a0.triggerEventDestroy()}av(window).unbind("resize",a3);aS.destroy();a1.remove();a7.removeClass("fc fc-rtl ui-widget")}function bw(){return a7.is(":visible")}function a6(){return av("body").is(":visible")}function aY(bK){if(!a0||bK!=a0.name){bu(bK)}}function bu(bK){bA++;if(a0){bn("viewDestroy",a0,a0,a0.element);aZ();a0.triggerEventDestroy();aR();a0.element.remove();aS.deactivateButton(a0.name)}aS.activateButton(bK);a0=new ag[bK](av("<div class='fc-view fc-view-"+bK+"' style='position:relative'/>").appendTo(a1),bB);bd();a5();bA--}function bd(bK){if(!a0.start||bK||bG<a0.start||bG>=a0.end){if(bw()){bH(bK)}}}function bH(bK){bA++;if(a0.start){bn("viewDestroy",a0,a0,a0.element);aZ();bj()}aR();a0.render(bG,bK||0);bx();a5();(a0.afterRender||at)();a9();bk();bn("viewRender",a0,a0,a0.element);a0.trigger("viewDisplay",bz);bA--;aW()}function ba(){if(bw()){aZ();bj();bt();bx();aU()}}function bt(){if(be.contentHeight){aV=be.contentHeight}else{if(be.height){aV=be.height-(br?br.height():0)-I(a1)}else{aV=Math.round(a1.width()/Math.max(be.aspectRatio,0.5))}}}function bx(){if(aV===w){bt()}bA++;a0.setHeight(aV);a0.setWidth(a1.width());bA--;bm=a7.outerWidth()}function a3(){if(!bA){if(a0.start){var bK=++bs;setTimeout(function(){if(bK==bs&&!bA&&bw()){if(bm!=(bm=a7.outerWidth())){bA++;ba();a0.trigger("windowResize",bz);bA--}}},200)}else{aX()}}}function a2(){bj();bv()}function aQ(bK){bj();aU(bK)}function aU(bK){if(bw()){a0.setEventData(bg);a0.renderEvents(bg,bK);a0.trigger("eventAfterAllRender")}}function bj(){a0.triggerEventDestroy();a0.clearEvents();a0.clearEventData()}function aW(){if(!be.lazyFetching||aN(a0.visStart,a0.visEnd)){bv()}else{aU()}}function bv(){bI(a0.visStart,a0.visEnd)}function a4(bK){bg=bK;aU()}function bF(bK){aQ(bK)}function a9(){aS.updateTitle(a0.title)}function bk(){var bK=new Date();if(bK>=a0.start&&bK<a0.end){aS.disableButton("today")}else{aS.enableButton("today")}}function bC(bM,bK,bL){a0.select(bM,bK,bL===w?true:bL)}function aZ(){if(a0){a0.unselect()}}function bl(){if(a0.prev){a0.prev()}else{bd(-1)}}function aP(){if(a0.next){a0.next()}else{bd(1)}}function bE(){aj(bG,-1);bd()}function aO(){aj(bG,1);bd()}function a8(){if(a0.gotoToday){a0.gotoToday()}else{bG=new Date();bd()}}function bp(bL,bM,bK){if(bL instanceof Date){bG=P(bL)}else{B(bG,bL,bM,bK)}bd()}function bb(bL,bK,bM){if(bL!==w){aj(bG,bL)}if(bK!==w){q(bG,bK)}if(bM!==w){aF(bG,bM)}bd()}function bc(){return P(bG)}function aR(){a1.css({width:"100%",height:a1.height(),overflow:"hidden"})}function a5(){a1.css({width:"",height:"",overflow:""})}function bi(){return a0}function by(bK,bL){if(bL===w){return be[bK]}if(bK=="height"||bK=="contentHeight"||bK=="aspectRatio"){be[bK]=bL;ba()}}function bn(bK,bL){if(be[bK]){return be[bK].apply(bL||bz,Array.prototype.slice.call(arguments,2))}}if(be.droppable){av(document).bind("dragstart",function(bM,bN){var bK=bM.target;var bO=av(bK);if(!bO.parents(".fc").length){var bL=be.dropAccept;if(av.isFunction(bL)?bL.call(bK,bO):bO.is(bL)){aT=bK;a0.dragStart(aT,bM,bN)}}}).bind("dragstop",function(bK,bL){if(aT){a0.dragStop(aT,bK,bL);aT=null}})}}function U(aQ,aZ){var aY=this;aY.render=aO;aY.destroy=aU;aY.updateTitle=aS;aY.activateButton=aN;aY.deactivateButton=aW;aY.disableButton=aP;aY.enableButton=aT;var aR=av([]);var aV;function aO(){aV=aZ.theme?"ui":"fc";var a0=aZ.header;if(a0){aR=av("<table class='fc-header' style='width:100%'/>").append(av("<tr/>").append(aX("left")).append(aX("center")).append(aX("right")));return aR}}function aU(){aR.remove()}function aX(a0){var a2=av("<td class='fc-header-"+a0+"'/>");var a1=aZ.header[a0];if(a1){av.each(a1.split(" "),function(a4){if(a4>0){a2.append("<span class='fc-header-space'/>")}var a3;av.each(this.split(","),function(a7,a6){if(a6=="title"){a2.append("<span class='fc-header-title'><h2>&nbsp;</h2></span>");if(a3){a3.addClass(aV+"-corner-right")}a3=null}else{var a5;if(aQ[a6]){a5=aQ[a6]}else{if(ag[a6]){a5=function(){a8.removeClass(aV+"-state-hover");aQ.changeView(a6)}}}if(a5){var a9=aZ.theme?H(aZ.buttonIcons,a6):null;var ba=H(aZ.buttonText,a6);var a8=av("<span class='fc-button fc-button-"+a6+" "+aV+"-state-default'>"+(a9?"<span class='fc-icon-wrap'><span class='ui-icon ui-icon-"+a9+"'/></span>":ba)+"</span>").click(function(){if(!a8.hasClass(aV+"-state-disabled")){a5()}}).mousedown(function(){a8.not("."+aV+"-state-active").not("."+aV+"-state-disabled").addClass(aV+"-state-down")}).mouseup(function(){a8.removeClass(aV+"-state-down")}).hover(function(){a8.not("."+aV+"-state-active").not("."+aV+"-state-disabled").addClass(aV+"-state-hover")},function(){a8.removeClass(aV+"-state-hover").removeClass(aV+"-state-down")}).appendTo(a2);aM(a8);if(!a3){a8.addClass(aV+"-corner-left")}a3=a8}}});if(a3){a3.addClass(aV+"-corner-right")}})}return a2}function aS(a0){aR.find("h2").html(a0)}function aN(a0){aR.find("span.fc-button-"+a0).addClass(aV+"-state-active")}function aW(a0){aR.find("span.fc-button-"+a0).removeClass(aV+"-state-active")}function aP(a0){aR.find("span.fc-button-"+a0).addClass(aV+"-state-disabled")}function aT(a0){aR.find("span.fc-button-"+a0).removeClass(aV+"-state-disabled")}}aD.sourceNormalizers=[];aD.sourceFetchers=[];var o={dataType:"json",cache:false};var X=1;function t(aT,a1){var a3=this;a3.isFetchNeeded=aV;a3.fetchEvents=a2;a3.addEventSource=aQ;a3.removeEventSource=aR;a3.updateEvent=a6;a3.renderEvent=aZ;a3.removeEvents=bi;a3.clientEvents=bc;a3.normalizeEvent=aY;var a5=a3.trigger;var aN=a3.getView;var a8=a3.reportEvents;var ba={events:[]};var aO=[ba];var bf,bb;var aP=0;var bg=0;var be=0;var a4=[];for(var bd=0;bd<a1.length;bd++){a7(a1[bd])}function aV(bk,bj){return !bf||bk<bf||bj>bb}function a2(bn,bk){bf=bn;bb=bk;a4=[];var bm=++aP;var bj=aO.length;bg=bj;for(var bl=0;bl<bj;bl++){aU(aO[bl],bm)}}function aU(bk,bj){a9(bk,function(bm){if(bj==aP){if(bm){if(aT.eventDataTransform){bm=av.map(bm,aT.eventDataTransform)}if(bk.eventDataTransform){bm=av.map(bm,bk.eventDataTransform)}for(var bl=0;bl<bm.length;bl++){bm[bl].source=bk;aY(bm[bl])}a4=a4.concat(bm)}a8(a4)}})}function a9(bj,bt){var bo;var bs=aD.sourceFetchers;var bq;for(bo=0;bo<bs.length;bo++){bq=bs[bo](bj,bf,bb,bt);if(bq===true){return}else{if(typeof bq=="object"){a9(bq,bt);return}}}var bv=bj.events;if(bv){if(av.isFunction(bv)){aX();bv(P(bf),P(bb),function(bx){bt(bx);bh()})}else{if(av.isArray(bv)){bt(bv)}else{bt()}}}else{var bk=bj.url;if(bk){var bu=bj.success;var br=bj.error;var bl=bj.complete;var bw;if(av.isFunction(bj.data)){bw=bj.data()}else{bw=bj.data}var bn=av.extend({},bw||{});var bp=aK(bj.startParam,aT.startParam);var bm=aK(bj.endParam,aT.endParam);if(bp){bn[bp]=Math.round(+bf/1000)}if(bm){bn[bm]=Math.round(+bb/1000)}aX();av.ajax(av.extend({},o,bj,{data:bn,success:function(by){by=by||[];var bx=K(bu,this,arguments);if(av.isArray(bx)){by=bx}bt(by)},error:function(){K(br,this,arguments);bt()},complete:function(){K(bl,this,arguments);bh()}}))}else{bt()}}}function aQ(bj){bj=a7(bj);if(bj){bg++;aU(bj,aP)}}function a7(bj){if(av.isFunction(bj)||av.isArray(bj)){bj={events:bj}}else{if(typeof bj=="string"){bj={url:bj}}}if(typeof bj=="object"){a0(bj);aO.push(bj);return bj}}function aR(bj){aO=av.grep(aO,function(bk){return !aW(bk,bj)});a4=av.grep(a4,function(bk){return !aW(bk.source,bj)});a8(a4)}function a6(bo){var bm,bk=a4.length,bp,bj=aN().defaultEventEnd,bn=bo.start-bo._start,bl=bo.end?(bo.end-(bo._end||bj(bo))):0;for(bm=0;bm<bk;bm++){bp=a4[bm];if(bp._id==bo._id&&bp!=bo){bp.start=new Date(+bp.start+bn);if(bo.end){if(bp.end){bp.end=new Date(+bp.end+bl)}else{bp.end=new Date(+bj(bp)+bl)}}else{bp.end=null}bp.title=bo.title;bp.url=bo.url;bp.allDay=bo.allDay;bp.className=bo.className;bp.editable=bo.editable;bp.color=bo.color;bp.backgroundColor=bo.backgroundColor;bp.borderColor=bo.borderColor;bp.textColor=bo.textColor;aY(bp)}}aY(bo);a8(a4)}function aZ(bk,bj){aY(bk);if(!bk.source){if(bj){ba.events.push(bk);bk.source=ba}a4.push(bk)}a8(a4)}function bi(bk){if(!bk){a4=[];for(var bj=0;bj<aO.length;bj++){if(av.isArray(aO[bj].events)){aO[bj].events=[]}}}else{if(!av.isFunction(bk)){var bl=bk+"";bk=function(bm){return bm._id==bl}}a4=av.grep(a4,bk,true);for(var bj=0;bj<aO.length;bj++){if(av.isArray(aO[bj].events)){aO[bj].events=av.grep(aO[bj].events,bk,true)}}}a8(a4)}function bc(bj){if(av.isFunction(bj)){return av.grep(a4,bj)}else{if(bj){bj+="";return av.grep(a4,function(bk){return bk._id==bj})}}return a4}function aX(){if(!be++){a5("loading",null,true,aN())}}function bh(){if(!--be){a5("loading",null,false,aN())}}function aY(bk){var bl=bk.source||{};var bj=aK(bl.ignoreTimezone,aT.ignoreTimezone);bk._id=bk._id||(bk.id===w?"_fc"+X++:bk.id+"");if(bk.date){if(!bk.start){bk.start=bk.date}delete bk.date}bk._start=P(bk.start=ab(bk.start,bj));bk.end=ab(bk.end,bj);if(bk.end&&bk.end<=bk.start){bk.end=null}bk._end=bk.end?P(bk.end):null;if(bk.allDay===w){bk.allDay=aK(bl.allDayDefault,aT.allDayDefault)}if(bk.className){if(typeof bk.className=="string"){bk.className=bk.className.split(/\s+/)}}else{bk.className=[]}}function a0(bl){if(bl.className){if(typeof bl.className=="string"){bl.className=bl.className.split(/\s+/)}}else{bl.className=[]}var bk=aD.sourceNormalizers;for(var bj=0;bj<bk.length;bj++){bk[bj](bl)}}function aW(bk,bj){return bk&&bj&&aS(bk)==aS(bj)}function aS(bj){return((typeof bj=="object")?(bj.events||bj.url):"")||bj}}aD.addDays=aF;aD.cloneDate=P;aD.parseDate=ab;aD.parseISO8601=p;aD.parseTime=aJ;aD.formatDate=E;aD.formatDates=l;var R=["sun","mon","tue","wed","thu","fri","sat"],ay=86400000,am=3600000,V=60000;function aj(aO,aP,aN){aO.setFullYear(aO.getFullYear()+aP);if(!aN){f(aO)}return aO}function q(aQ,aR,aP){if(+aQ){var aN=aQ.getMonth()+aR,aO=P(aQ);aO.setDate(1);aO.setMonth(aN);aQ.setMonth(aN);if(!aP){f(aQ)}while(aQ.getMonth()!=aO.getMonth()){aQ.setDate(aQ.getDate()+(aQ<aO?1:-1))}}return aQ}function aF(aQ,aR,aP){if(+aQ){var aN=aQ.getDate()+aR,aO=P(aQ);aO.setHours(9);aO.setDate(aN);aQ.setDate(aN);if(!aP){f(aQ)}aH(aQ,aO)}return aQ}function aH(aO,aN){if(+aO){while(aO.getDate()!=aN.getDate()){aO.setTime(+aO+(aO<aN?1:-1)*am)}}}function k(aN,aO){aN.setMinutes(aN.getMinutes()+aO);return aN}function f(aN){aN.setHours(0);aN.setMinutes(0);aN.setSeconds(0);aN.setMilliseconds(0);return aN}function P(aN,aO){if(aO){return f(new Date(+aN))}return new Date(+aN)}function h(){var aN=0,aO;do{aO=new Date(1970,aN++,1)}while(aO.getHours());return aO}function aC(aO,aN){return Math.round((P(aO,true)-P(aN,true))/ay)}function B(aO,aQ,aN,aP){if(aQ!==w&&aQ!=aO.getFullYear()){aO.setDate(1);aO.setMonth(0);aO.setFullYear(aQ)}if(aN!==w&&aN!=aO.getMonth()){aO.setDate(1);aO.setMonth(aN)}if(aP!==w){aO.setDate(aP)}}function ab(aO,aN){if(typeof aO=="object"){return aO}if(typeof aO=="number"){return new Date(aO*1000)}if(typeof aO=="string"){if(aO.match(/^\d+(\.\d+)?$/)){return new Date(parseFloat(aO)*1000)}if(aN===w){aN=true}return p(aO,aN)||(aO?new Date(aO):null)}return null}function p(aR,aO){var aN=aR.match(/^([0-9]{4})(-([0-9]{2})(-([0-9]{2})([T ]([0-9]{2}):([0-9]{2})(:([0-9]{2})(\.([0-9]+))?)?(Z|(([-+])([0-9]{2})(:?([0-9]{2}))?))?)?)?)?$/);if(!aN){return null}var aQ=new Date(aN[1],0,1,9,0);if(aO||!aN[13]){var aP=new Date(aN[1],0,1,9,0);if(aN[3]){aQ.setMonth(aN[3]-1);aP.setMonth(aN[3]-1)}if(aN[5]){aQ.setDate(aN[5]);aP.setDate(aN[5])}aH(aQ,aP);if(aN[7]){aQ.setHours(aN[7])}if(aN[8]){aQ.setMinutes(aN[8])}if(aN[10]){aQ.setSeconds(aN[10])}if(aN[12]){aQ.setMilliseconds(Number("0."+aN[12])*1000)}aH(aQ,aP)}else{aQ.setUTCFullYear(aN[1],aN[3]?aN[3]-1:0,aN[5]||1);aQ.setUTCHours(aN[7]||0,aN[8]||0,aN[10]||0,aN[12]?Number("0."+aN[12])*1000:0);if(aN[14]){var aS=Number(aN[16])*60+(aN[18]?Number(aN[18]):0);aS*=aN[15]=="-"?1:-1;aQ=new Date(+aQ+(aS*60*1000))}}return aQ}function aJ(aP){if(typeof aP=="number"){return aP*60}if(typeof aP=="object"){return aP.getHours()*60+aP.getMinutes()}var aN=aP.match(/(\d+)(?::(\d+))?\s*(\w+)?/);if(aN){var aO=parseInt(aN[1],10);if(aN[3]){aO%=12;if(aN[3].toLowerCase().charAt(0)=="p"){aO+=12}}return aO*60+(aN[2]?parseInt(aN[2],10):0)}}function E(aO,aP,aN){return l(aO,null,aP,aN)}function l(aZ,aY,aX,a0){a0=a0||O;var aO=aZ,aQ=aY,aR,aS=aX.length,aU,aP,aW,aT="";for(aR=0;aR<aS;aR++){aU=aX.charAt(aR);if(aU=="'"){for(aP=aR+1;aP<aS;aP++){if(aX.charAt(aP)=="'"){if(aO){if(aP==aR+1){aT+="'"}else{aT+=aX.substring(aR+1,aP)}aR=aP}break}}}else{if(aU=="("){for(aP=aR+1;aP<aS;aP++){if(aX.charAt(aP)==")"){var aN=E(aO,aX.substring(aR+1,aP),a0);if(parseInt(aN.replace(/\D/,""),10)){aT+=aN}aR=aP;break}}}else{if(aU=="["){for(aP=aR+1;aP<aS;aP++){if(aX.charAt(aP)=="]"){var aV=aX.substring(aR+1,aP);var aN=E(aO,aV,a0);if(aN!=E(aQ,aV,a0)){aT+=aN}aR=aP;break}}}else{if(aU=="{"){aO=aY;aQ=aZ}else{if(aU=="}"){aO=aZ;aQ=aY}else{for(aP=aS;aP>aR;aP--){if(aW=aB[aX.substring(aR,aP)]){if(aO){aT+=aW(aO,a0)}aR=aP-1;break}}if(aP==aR){if(aO){aT+=aU}}}}}}}}return aT}var aB={s:function(aN){return aN.getSeconds()},ss:function(aN){return ad(aN.getSeconds())},m:function(aN){return aN.getMinutes()},mm:function(aN){return ad(aN.getMinutes())},h:function(aN){return aN.getHours()%12||12},hh:function(aN){return ad(aN.getHours()%12||12)},H:function(aN){return aN.getHours()},HH:function(aN){return ad(aN.getHours())},d:function(aN){return aN.getDate()},dd:function(aN){return ad(aN.getDate())},ddd:function(aO,aN){return aN.dayNamesShort[aO.getDay()]},dddd:function(aO,aN){return aN.dayNames[aO.getDay()]},M:function(aN){return aN.getMonth()+1},MM:function(aN){return ad(aN.getMonth()+1)},MMM:function(aO,aN){return aN.monthNamesShort[aO.getMonth()]},MMMM:function(aO,aN){return aN.monthNames[aO.getMonth()]},yy:function(aN){return(aN.getFullYear()+"").substring(2)},yyyy:function(aN){return aN.getFullYear()},t:function(aN){return aN.getHours()<12?"a":"p"},tt:function(aN){return aN.getHours()<12?"am":"pm"},T:function(aN){return aN.getHours()<12?"A":"P"},TT:function(aN){return aN.getHours()<12?"AM":"PM"},u:function(aN){return E(aN,"yyyy-MM-dd'T'HH:mm:ss'Z'")},S:function(aO){var aN=aO.getDate();if(aN>10&&aN<20){return"th"}return["st","nd","rd"][aN%10-1]||"th"},w:function(aO,aN){return aN.weekNumberCalculation(aO)},W:function(aN){return x(aN)}};aD.dateFormatters=aB;function x(aN){var aO;var aP=new Date(aN.getTime());aP.setDate(aP.getDate()+4-(aP.getDay()||7));aO=aP.getTime();aP.setMonth(0);aP.setDate(1);return Math.floor(Math.round((aO-aP)/86400000)/7)+1}aD.applyAll=K;function ap(aN){if(aN.end){return s(aN.end,aN.allDay)}else{return aF(P(aN.start),1)}}function s(aN,aO){aN=P(aN);return aO||aN.getHours()||aN.getMinutes()?aF(aN,1):f(aN)}function v(aO,aN,aP){aO.unbind("mouseover").mouseover(function(aT){var aS=aT.target,aU,aR,aQ;while(aS!=this){aU=aS;aS=aS.parentNode}if((aR=aU._fci)!==w){aU._fci=w;aQ=aN[aR];aP(aQ.event,aQ.element,aQ);av(aT.target).trigger(aT)}aT.stopPropagation()})}function aw(aP,aQ,aN){for(var aO=0,aR;aO<aP.length;aO++){aR=av(aP[aO]);aR.width(Math.max(0,aQ-j(aR,aN)))}}function aa(aQ,aN,aO){for(var aP=0,aR;aP<aQ.length;aP++){aR=av(aQ[aP]);aR.height(Math.max(0,aN-I(aR,aO)))}}function j(aO,aN){return ai(aO)+r(aO)+(aN?ah(aO):0)}function ai(aN){return(parseFloat(av.css(aN[0],"paddingLeft",true))||0)+(parseFloat(av.css(aN[0],"paddingRight",true))||0)}function ah(aN){return(parseFloat(av.css(aN[0],"marginLeft",true))||0)+(parseFloat(av.css(aN[0],"marginRight",true))||0)}function r(aN){return(parseFloat(av.css(aN[0],"borderLeftWidth",true))||0)+(parseFloat(av.css(aN[0],"borderRightWidth",true))||0)}function I(aO,aN){return A(aO)+ar(aO)+(aN?m(aO):0)}function A(aN){return(parseFloat(av.css(aN[0],"paddingTop",true))||0)+(parseFloat(av.css(aN[0],"paddingBottom",true))||0)}function m(aN){return(parseFloat(av.css(aN[0],"marginTop",true))||0)+(parseFloat(av.css(aN[0],"marginBottom",true))||0)}function ar(aN){return(parseFloat(av.css(aN[0],"borderTopWidth",true))||0)+(parseFloat(av.css(aN[0],"borderBottomWidth",true))||0)}function at(){}function a(aO,aN){return aO-aN}function au(aN){return Math.max.apply(Math,aN)}function ad(aN){return(aN<10?"0":"")+aN}function H(aR,aN){if(aR[aN]!==w){return aR[aN]}var aQ=aN.split(/(?=[A-Z])/),aP=aQ.length-1,aO;for(;aP>=0;aP--){aO=aR[aQ[aP].toLowerCase()];if(aO!==w){return aO}}return aR[""]}function aI(aN){return aN.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/'/g,"&#039;").replace(/"/g,"&quot;").replace(/\n/g,"<br />")}function aM(aN){aN.attr("unselectable","on").css("MozUserSelect","none").bind("selectstart.ui",function(){return false})}function g(aN){aN.children().removeClass("fc-first fc-last").filter(":first-child").addClass("fc-first").end().filter(":last-child").addClass("fc-last")}function M(aN,aO){aN.each(function(aP,aQ){aQ.className=aQ.className.replace(/^fc-\w*/,"fc-"+R[aO.getDay()])})}function S(aO,aP){var aN=aO.source||{};var aU=aO.color;var aS=aN.color;var aR=aP("eventColor");var aV=aO.backgroundColor||aU||aN.backgroundColor||aS||aP("eventBackgroundColor")||aR;var aQ=aO.borderColor||aU||aN.borderColor||aS||aP("eventBorderColor")||aR;var aW=aO.textColor||aN.textColor||aP("eventTextColor");var aT=[];if(aV){aT.push("background-color:"+aV)}if(aQ){aT.push("border-color:"+aQ)}if(aW){aT.push("color:"+aW)}return aT.join(";")}function K(aQ,aR,aO){if(av.isFunction(aQ)){aQ=[aQ]}if(aQ){var aP;var aN;for(aP=0;aP<aQ.length;aP++){aN=aQ[aP].apply(aR,aO)||aN}return aN}}function aK(){for(var aN=0;aN<arguments.length;aN++){if(arguments[aN]!==w){return arguments[aN]}}}ag.timeline=z;function z(aO,aR){var aN=this;aN.name="timeline";aN.render=aP;aN.title="";var aQ=c.getTimelineAdapter(aO,aR.options.calendarPlugin,aR.options.calendarDiv,aN);function aP(aS,aT){aQ.setDate(aS)}aN.update=function(){aR.refetchEvents(true)};aN.unselect=function(){};aN.setHeight=function(){};aN.setWidth=function(){};aN.clearEvents=function(){};aN.renderEvents=function(aS){aQ.renderEvents(aS)};aN.trigger=function(aS,aT){return aR.trigger.apply(aR,[aS,aT||aN].concat(Array.prototype.slice.call(arguments,2),[aN]))};aN.next=function(){aQ.next()};aN.prev=function(){aQ.prev()};aN.gotoDate=function(aS){aR.gotoDate(aS)};aN.triggerEventDestroy=function(){};aN.clearEventData=function(){};aN.setEventData=function(aS){aQ.renderEvents(aS)};aN.element=av(".fc-view-timeline")}ag.month=ae;function ae(aS,aR){var aV=this;aV.render=aN;C.call(aV,aS,aR,"month");var aO=aV.opt;var aP=aV.renderBasic;var aT=aV.skipHiddenDays;var aQ=aV.getCellsPerWeek;var aU=aR.formatDate;function aN(aY,a3){if(a3){q(aY,a3);aY.setDate(1)}var aW=aO("firstDay");var aX=P(aY,true);aX.setDate(1);var aZ=q(P(aX),1);var a4=P(aX);aF(a4,-((a4.getDay()-aW+7)%7));aT(a4);var a0=P(aZ);aF(a0,(7-a0.getDay()+aW)%7);aT(a0,-1,true);var a2=aQ();var a1=Math.round(aC(a0,a4)/7);if(aO("weekMode")=="fixed"){aF(a0,(6-a1)*7);a1=6}aV.title=aU(aX,aO("titleFormat"));aV.start=aX;aV.end=aZ;aV.visStart=a4;aV.visEnd=a0;aP(a1,a2,true)}}ag.basicWeek=aE;function aE(aS,aR){var aV=this;aV.render=aN;C.call(aV,aS,aR,"basicWeek");var aO=aV.opt;var aP=aV.renderBasic;var aU=aV.skipHiddenDays;var aQ=aV.getCellsPerWeek;var aT=aR.formatDates;function aN(a0,a2){if(a2){aF(a0,a2*7)}var a1=aF(P(a0),-((a0.getDay()-aO("firstDay")+7)%7));var aY=aF(P(a1),7);var aX=P(a1);aU(aX);var aW=P(aY);aU(aW,-1,true);var aZ=aQ();aV.start=a1;aV.end=aY;aV.visStart=aX;aV.visEnd=aW;aV.title=aT(aX,aF(P(aW),-1),aO("titleFormat"));aP(1,aZ,false)}}ag.basicDay=L;function L(aQ,a1){var aZ=this;aZ.render=a7;var aW=0;var a4=false;C.call(aZ,aQ,a1,"basicDay");var aO=aZ.opt,a6=aZ.renderBasic,aU=aZ.skipHiddenDays,a0=a1.formatDate,aV=a1.options.calendarDiv,a3=a1.options.calendarPlugin,aX=1000*60*60*24,a5=parseInt(a3.getParameter(aV,"maxUpcomingDays")),aY=av("<div/>").appendTo(aQ),aT=a3.getParameter(aV,"autoAdjustUpcomingEventsHeight")==="true",aN=a3.getParameter(aV,"hideMoreEventsButtonInUpcomingEventsOnClick")==="true",aP=function(){if(aT){aQ.css({height:(av(".events-container",aY).height()+5)+"px",overflow:"hidden"})}},aS=false,a2=a5;var aR=function(bj,bm,bh){if(bj.length){aY.empty();a4=true;var bl=[],bb=new Date(),bd=new Date();aQ.removeClass("no-event");av.each(bj,function(bp,bo){var bn=bo.allDay;if(bo.expandDates&&bo.end&&bo.end.getTime()-bo.start.getTime()>=aX){var bq=bo.end;bb.setTime(bo.start.getTime()+aX);if(bn){while(bb<=bq){bd.setTime(bb.getTime()+aX);if(bb>=bm&&bd<=bh){bl.push(av.extend({},bo,{start:new Date(bb.getTime()),end:new Date(bd.getTime()),expanded:true}))}bb.setTime(bd.getTime())}}else{while(bb<bq){bd.setTime(bb.getTime()+Math.min(bq.getTime()-bb.getTime(),aX));if(bb>=bm&&bd<=bh){bl.push(av.extend({},bo,{start:new Date(bb.getTime()),end:new Date(bd.getTime()),allDay:bd.getTime()-bb.getTime()>=aX,showLastIndicator:bd>=bq,expanded:true}))}bb.setTime(bd.getTime())}}}});av.each(bl,function(bn,bo){bj.push(bo)});bj.sort(function(bo,bp){var bn=bo.expanded===bp.expanded?0:(bo.expanded?1:-1);if(0==bn){bn=bo.allDay===bp.allDay?0:(bo.allDay?1:-1)}if(0===bn){bn=bo.start.getTime()-bp.start.getTime()}if(0==bn){bn=bo.title>bp.title?1:(bp.title>bo.title?-1:0)}if(0==bn){bn=bo.subCalendarId>bp.subCalendarId?1:(bp.subCalendarId>bo.subCalendarId?-1:0)}return bn});bj=av.grep(bj,function(bn){return bn.start>=bm});var ba={};av.each(bj,function(bs,bp){var bn=a0(new Date(),"yyyyMMdd"),bo=a0(bp.start,"yyyyMMdd"),br=ba[bo],bq;if(!ba[bo]){br={today:bo===bn,groupKey:bo,groupDay:bo.substring(6),dateFormatKey:bo.substring(6)+bo.substring(4,6)+bo.substring(0,4),events:[bp]};ba[bo]=br}else{bq=br.events;bq.push(bp)}});var bi=parseInt(a3.getParameter(aV,"maxEventsPerUpcomingDay")),be={},bc={};av.each(ba,function(bn,bp){var bo=bp.events;if(bo&&bo.length&&bo.length>bi){bp.hiddenEventsCount=bo.length-bi;bp.events=bo.slice(0,bi)}bp.events=av.map(bp.events,function(br){var bs=bc[br.subCalendarId]||a3.getSubCalendar(aV,br.subCalendarId),bq=bc[bs.parentId]||a3.getSubCalendar(aV,bs.parentId),bt=av.extend({subCalendar:bs,parentSubCalendar:bq},br);bc[bs.id]=bs;if(bq){bc[bq.id]=bq}be[bt.id]=bt;return bt})});var bk=[];av.each(ba,function(bn){bk.push(bn)});bk.sort(function(bn,bo){return bn>bo?1:(bo>bn?-1:0)});var a8=av("<div/>").html(c.Templates().upcomingEvents({eventGroups:av.map(bk,function(bn){return ba[bn]})})),bg=av(".more-events",a8).click(function(){var bo=av(".events-container",a8),bn=bg.offset().top-bo.offset().top+bo.scrollTop(),bp=av(".toggleable",a8);if(bp.length){bp.removeClass("hidden toggleable");aQ.animate({scrollTop:bn});if(aN){bg.addClass("hidden");aQ.css("overflow","auto")}else{aP()}}else{bg.prop("disabled","disabled").text("Loading...");av.ajax({cache:false,converters:{"text json":function(bq){return bq}},data:{subCalendarIds:(function(){return av.map(av(".child-subcalendar",aV).filter(function(){return !av(this).hasClass("subcalendar-disabled")}),function(bq){return av(bq).data("subCalendarId")})})(),userTimeZoneId:c.getUserTimeZone(),start:a0(bm,"u"),daysMore:a2+=a5},dataFilter:function(bq){var br=av.parseJSON(bq||"[]");av.each(br,function(bs,bt){a1.normalizeEvent(bt)});return br},dataType:"json",error:function(bq,bs,br){a3.showAjaxError(aV,bq,bs,br)},success:function(bq){bq=a3.getEventsTruncated(aV,bq||[],true);var br=new Date(bm.getTime()+(a2*aX));aR(bq,bm,br);av(".more-events",aY).before(av("<div/>",{"class":"showing-events-till",text:AJS.format("Displaying events until {0}",a0(br,"dd MMM yyyy"))}));aP()},type:"GET",url:a3.getCalendarServiceBaseUrl(aV,"/events/multiplexed.json")})}return !(aS=true)});aY.append(a8);av(".event-description",a8).ThreeDots({max_rows:1});av(".events li",a8).each(function(bo){var bn=av(this);if(!aS&&bo>=10&&!bn.prev().length){var bp=bn.closest(".event-group");if(!bp.hasClass("toggleable")){bp.addClass("toggleable")}}a3.getEventDetailsDialog(aV,be[av(this).attr("data-event-id")],bn.hover(function(){bn.addClass("highlighted");a3.hideInlineAuiDialogs()},function(){bn.removeClass("highlighted")}),{hideDelay:10000,noBind:false})});var a9=av(".toggleable",a8).addClass("hidden");if(a9.length||!aN){bg.removeClass("hidden")}aP();var bf=function(bn,bp){var bo=bp.attr("data-group-date");bp.text(a0(new Date(parseInt(bo.substring(4)),parseInt(bo.substring(2,4),10)-1,parseInt(bo.substring(0,2),10)),bn))};av(".other-days",a8).each(function(){bf("dddd",av(this))});av(".day",a8).each(function(){bf("dd",av(this))});av(".month",a8).each(function(){bf("MMM",av(this))})}else{if(aW>1&&!a4){aY.empty();av("<div/>",{text:AJS.format("No upcoming events in the next {0} days",a5)}).appendTo(aY.empty())}else{if(!a4){aY.empty();aW=aW+1;window.setTimeout(function(){aZ.renderEvents([])},1000);av("<span class='calendar-upcoming-spinner aui-icon aui-icon-wait'>Loading...</span>").appendTo(aY.empty())}}}};av("<div/>",{"class":"no-events-message",text:"Loading..."}).appendTo(aY);aZ.renderEvents=function(a9){aQ.css("MozUserSelect","text").attr("unselectable","off").unbind("selectstart.ui");var a8=new Date(aZ.visStart.getTime()+aX*(a2=a5));aR((function(be,bd,bc){var ba=[];var bb=function(bf){if(bf.allDay){return(bf.start>=bd&&bf.start<bc)||(bf.start<bd&&bf.end>=bd)||(bf.start>=bc&&bf.start<bc)}else{return(bf.start>=bd&&bf.start<bc)||(bf.start<bd&&bf.end>bd)||(bf.start>=bc&&bf.start<bc)}};av.each(be,function(bg,bf){if(bb(bf)){ba.push(bf)}});return ba})(a9,aZ.visStart,a8),aZ.visStart,a8)};function a7(a9,bb){if(bb){aF(a9,bb)}aU(a9,bb<0?-1:1);var ba=P(a9,true);var a8=aF(P(ba),1);aZ.title=a0(a9,aO("titleFormat"));aZ.start=aZ.visStart=ba;aZ.end=aZ.visEnd=a8;a6(1,1,false)}}ak({weekMode:"fixed"});function C(a8,bz,a0){var by=this;by.renderBasic=bs;by.setHeight=bw;by.setWidth=bH;by.renderDayOverlay=bo;by.defaultSelectionEnd=bn;by.renderSelection=bA;by.clearSelection=aN;by.reportDayClick=a6;by.dragStart=aS;by.dragStop=a1;by.defaultEventEnd=bM;by.getHoverListener=function(){return aT};by.colLeft=bO;by.colRight=bb;by.colContentLeft=bv;by.colContentRight=bt;by.getIsCellAllDay=function(){return true};by.allDayRow=a5;by.getRowCnt=function(){return bf};by.getColCnt=function(){return aV};by.getColWidth=function(){return bk};by.getDaySegmentContainer=function(){return a4};aG.call(by,a8,bz,a0);d.call(by);ao.call(by);an.call(by);var bd=by.opt;var bp=by.trigger;var bK=by.renderOverlay;var aZ=by.clearOverlays;var bu=by.daySelectionMousedown;var aO=by.cellToDate;var bD=by.dateToCell;var br=by.rangeToSegments;var bx=bz.formatDate;var be;var a7;var a2;var bi;var aY;var a9;var bl;var bj;var aQ;var a4;var bL;var bN;var bk;var a3;var bf,aV;var ba;var bB;var aT;var bE;var bF;var bP;var aW;var bc;var bC;var bm;aM(a8.addClass("fc-grid"));function bs(bQ,bR,bS){bf=bQ;aV=bR;ba=bS;bI();if(!bi){aR()}bh()}function bI(){bP=bd("theme")?"ui":"fc";aW=bd("columnFormat");bc=bd("weekNumbers");bC=bd("weekNumberTitle");if(bd("weekNumberCalculation")!="iso"){bm="w"}else{bm="W"}}function aR(){a4=av("<div class='fc-event-container' style='position:absolute;z-index:8;top:0;left:0'/>").appendTo(a8)}function bh(){var bQ=bq();if(be){be.remove()}be=av(bQ).appendTo(a8);a7=be.find("thead");a2=a7.find(".fc-day-header");bi=be.find("tbody");aY=bi.find("tr");a9=bi.find(".fc-day");bl=aY.find("td:first-child");bj=aY.eq(0).find(".fc-day > div");aQ=aY.eq(0).find(".fc-day-content > div");g(a7.add(a7.find("tr")));g(aY);aY.eq(0).addClass("fc-first");aY.filter(":last").addClass("fc-last");a9.each(function(bS,bT){var bR=aO(Math.floor(bS/aV),bS%aV);bp("dayRender",by,bR,av(bT))});aU(a9)}function bq(){var bQ="<table class='fc-border-separate' style='width:100%' cellspacing='0'>"+aP()+bg()+"</table>";return bQ}function aP(){var bT=bP+"-widget-header";var bS="";var bR;var bQ;bS+="<thead><tr>";if(bc){bS+="<th class='fc-week-number "+bT+"'>"+aI(bC)+"</th>"}for(bR=0;bR<aV;bR++){bQ=aO(0,bR);bS+="<th class='fc-day-header fc-"+R[bQ.getDay()]+" "+bT+"'>"+aI(bx(bQ,aW))+"</th>"}bS+="</tr></thead>";return bS}function bg(){var bS=bP+"-widget-content";var bT="";var bU;var bR;var bQ;bT+="<tbody>";for(bU=0;bU<bf;bU++){bT+="<tr class='fc-week'>";if(bc){bQ=aO(bU,0);bT+="<td class='fc-week-number "+bS+"'><div>"+aI(bx(bQ,bm))+"</div></td>"}for(bR=0;bR<aV;bR++){bQ=aO(bU,bR);bT+=aX(bQ)}bT+="</tr>"}bT+="</tbody>";return bT}function aX(bS){var bR=bP+"-widget-content";var bU=by.start.getMonth();var bQ=f(new Date());var bT="";var bV=["fc-day","fc-"+R[bS.getDay()],bR];if(bS.getMonth()!=bU){bV.push("fc-other-month")}if(+bS==+bQ){bV.push("fc-today",bP+"-state-highlight")}else{if(bS<bQ){bV.push("fc-past")}else{bV.push("fc-future")}}bT+="<td class='"+bV.join(" ")+"' data-date='"+bx(bS,"yyyy-MM-dd")+"'><div>";if(ba){bT+="<div class='fc-day-number'>"+bS.getDate()+"</div>"}bT+="<div class='fc-day-content'><div style='position:relative'>&nbsp;</div></div></div></td>";return bT}function bw(bR){bN=bR;var bU=bN-a7.height();var bT;var bS;var bQ;if(bd("weekMode")=="variable"){bT=bS=Math.floor(bU/(bf==1?2:6))}else{bT=Math.floor(bU/bf);bS=bU-bT*(bf-1)}bl.each(function(bV,bW){if(bV<bf){bQ=av(bW);bQ.find("> div").css("min-height",(bV==bf-1?bS:bT)-I(bQ))}})}function bH(bQ){bL=bQ;bE.clear();bF.clear();a3=0;if(bc){a3=a7.find("th.fc-week-number").outerWidth()}bk=Math.floor((bL-a3)/aV);aw(a2.slice(0,-1),bk)}function aU(bQ){bQ.click(bJ).mousedown(bu)}function bJ(bR){if(!bd("selectable")){var bQ=p(av(this).data("date"));bp("dayClick",this,bQ,true,bR)}}function bo(bU,bV,bQ){if(bQ){bB.build()}var bR=br(bU,bV);for(var bS=0;bS<bR.length;bS++){var bT=bR[bS];aU(bG(bT.row,bT.leftCol,bT.row,bT.rightCol))}}function bG(bT,bU,bR,bS){var bQ=bB.rect(bT,bU,bR,bS,a8);return bK(bQ,a8)}function bn(bQ,bR){return P(bQ)}function bA(bQ,bS,bR){bo(bQ,aF(P(bS),1),true)}function aN(){aZ()}function a6(bS,bU,bT){var bQ=bD(bS);var bR=a9[bQ.row*aV+bQ.col];bp("dayClick",bR,bS,bU,bT)}function aS(bS,bQ,bR){aT.start(function(bT){aZ();if(bT){bG(bT.row,bT.col,bT.row,bT.col)}},bQ)}function a1(bU,bR,bS){var bQ=aT.stop();aZ();if(bQ){var bT=aO(bQ);bp("drop",bU,bT,true,bR,bS)}}function bM(bQ){return P(bQ.start)}bB=new Q(function(bQ,bT){var bS,bU,bR;a2.each(function(bW,bV){bS=av(bV);bU=bS.offset().left;if(bW){bR[1]=bU}bR=[bU];bT[bW]=bR});bR[1]=bU+bS.outerWidth();aY.each(function(bW,bV){if(bW<bf){bS=av(bV);bU=bS.offset().top;if(bW){bR[1]=bU}bR=[bU];bQ[bW]=bR}});bR[1]=bU+bS.outerHeight()});aT=new aq(bB);bE=new n(function(bQ){return bj.eq(bQ)});bF=new n(function(bQ){return aQ.eq(bQ)});function bO(bQ){return bE.left(bQ)}function bb(bQ){return bE.right(bQ)}function bv(bQ){return bF.left(bQ)}function bt(bQ){return bF.right(bQ)}function a5(bQ){return aY.eq(bQ)}}function an(){var aO=this;aO.renderEvents=aN;aO.clearEvents=aP;Z.call(aO);function aN(aR,aQ){aO.renderDayEvents(aR,aQ)}function aP(){aO.getDaySegmentContainer().empty()}}ag.agendaWeek=i;function i(aS,aR){var aV=this;aV.render=aN;J.call(aV,aS,aR,"agendaWeek");var aO=aV.opt;var aP=aV.renderAgenda;var aU=aV.skipHiddenDays;var aQ=aV.getCellsPerWeek;var aT=aR.formatDates;function aN(a0,a2){if(a2){aF(a0,a2*7)}var a1=aF(P(a0),-((a0.getDay()-aO("firstDay")+7)%7));var aY=aF(P(a1),7);var aX=P(a1);aU(aX);var aW=P(aY);aU(aW,-1,true);var aZ=aQ();aV.title=aT(aX,aF(P(aW),-1),aO("titleFormat"));aV.start=a1;aV.end=aY;aV.visStart=aX;aV.visEnd=aW;aP(aZ)}}ag.agendaDay=az;function az(aR,aU){var aQ=this;aQ.render=aS;J.call(aQ,aR,aU,"agendaDay");var aP=aQ.opt;var aN=aQ.renderAgenda;var aO=aQ.skipHiddenDays;var aT=aU.formatDate;function aS(aW,aY){if(aY){aF(aW,aY)}aO(aW,aY<0?-1:1);var aX=P(aW,true);var aV=aF(P(aX),1);aQ.title=aT(aW,aP("titleFormat"));aQ.start=aQ.visStart=aX;aQ.end=aQ.visEnd=aV;aN(1)}}ak({allDaySlot:true,allDayText:"all-day",firstHour:6,slotMinutes:30,defaultEventMinutes:30,axisFormat:c.isDisplayTimeFormat24hour()===true?"HH:mm":"h(:mm)tt",timeFormat:{agenda:c.isDisplayTimeFormat24hour()===true?"HH:mm{ - HH:mm}":"h:mm{ - h:mm}"},dragOpacity:{agenda:0.5},minTime:0,maxTime:24,slotEventOverlap:true});function J(cc,a3,bg){var bd=this;bd.renderAgenda=aZ;bd.setWidth=bp;bd.setHeight=bl;bd.afterRender=bV;bd.defaultEventEnd=bU;bd.timePosition=cf;bd.getIsCellAllDay=bw;bd.allDayRow=bD;bd.getCoordinateGrid=function(){return bI};bd.getHoverListener=function(){return cb};bd.colLeft=b6;bd.colRight=bN;bd.colContentLeft=cg;bd.colContentRight=aV;bd.getDaySegmentContainer=function(){return a8};bd.getSlotSegmentContainer=function(){return aT};bd.getMinMinute=function(){return bk};bd.getMaxMinute=function(){return aP};bd.getSlotContainer=function(){return a6};bd.getRowCnt=function(){return 1};bd.getColCnt=function(){return bG};bd.getColWidth=function(){return aW};bd.getSnapHeight=function(){return b8};bd.getSnapMinutes=function(){return bt};bd.defaultSelectionEnd=bo;bd.renderDayOverlay=aR;bd.renderSelection=b4;bd.clearSelection=bZ;bd.reportDayClick=ba;bd.dragStart=aX;bd.dragStop=cd;aG.call(bd,cc,a3,bg);d.call(bd);ao.call(bd);W.call(bd);var bB=bd.opt;var bE=bd.trigger;var bs=bd.renderOverlay;var aQ=bd.clearOverlays;var bu=bd.reportSelection;var b2=bd.unselect;var bz=bd.daySelectionMousedown;var a5=bd.slotSegHtml;var bb=bd.cellToDate;var aY=bd.dateToCell;var bi=bd.rangeToSegments;var a9=a3.formatDate;var bQ;var b9;var bX;var bW;var bf;var aS;var aN;var bT;var bM;var ce;var a8;var ca;var b1;var bq;var a6;var aT;var a0;var aU;var bx;var bK;var bm;var aW;var bA;var bH;var bt;var a4;var b8;var bG;var bL;var bI;var cb;var bF;var by;var bh={};var br;var aO;var bk,aP;var a2;var bR;var bC;var bv;aM(cc.addClass("fc-agenda"));function aZ(ch){bG=ch;bJ();if(!bQ){be()}else{bP()}}function bJ(){br=bB("theme")?"ui":"fc";aO=bB("isRTL");bk=aJ(bB("minTime"));aP=aJ(bB("maxTime"));a2=bB("columnFormat");bR=bB("weekNumbers");bC=bB("weekNumberTitle");if(bB("weekNumberCalculation")!="iso"){bv="w"}else{bv="W"}bt=bB("snapMinutes")||bB("slotMinutes")}function be(){var cm=br+"-widget-header";var ch=br+"-widget-content";var cl;var co;var ck;var cn;var cj;var ci=bB("slotMinutes")%15==0;bP();ce=av("<div style='position:absolute;z-index:2;left:0;width:100%'/>").appendTo(cc);if(bB("allDaySlot")){a8=av("<div class='fc-event-container' style='position:absolute;z-index:8;top:0;left:0'/>").appendTo(ce);cl="<table style='width:100%' class='fc-agenda-allday' cellspacing='0'><tr><th class='"+cm+" fc-agenda-axis'>"+bB("allDayText")+"</th><td><div class='fc-day-content'><div style='position:relative'/></div></td><th class='"+cm+" fc-agenda-gutter'>&nbsp;</th></tr></table>";ca=av(cl).appendTo(ce);b1=ca.find("tr");bn(b1.find("td"));ce.append("<div class='fc-agenda-divider "+cm+"'><div class='fc-agenda-divider-inner'/></div>")}else{a8=av([])}bq=av("<div style='position:absolute;width:100%;overflow-x:hidden;overflow-y:auto'/>").appendTo(ce);a6=av("<div style='position:relative;width:100%;overflow:hidden'/>").appendTo(bq);aT=av("<div class='fc-event-container' style='position:absolute;z-index:8;top:0;left:0'/>").appendTo(a6);cl="<table class='fc-agenda-slots' style='width:100%' cellspacing='0'><tbody>";co=h();cn=k(P(co),aP);k(co,bk);bL=0;for(ck=0;co<cn;ck++){cj=co.getMinutes();cl+="<tr class='fc-slot"+ck+" "+(!cj?"":"fc-minor")+"'><th class='fc-agenda-axis "+cm+"'>"+((!ci||!cj)?a9(co,bB("axisFormat")):"&nbsp;")+"</th><td class='"+ch+"'><div style='position:relative'>&nbsp;</div></td></tr>";k(co,bB("slotMinutes"));bL++}cl+="</tbody></table>";a0=av(cl).appendTo(a6);b0(a0.find("td"))}function bP(){var ch=b7();if(bQ){bQ.remove()}bQ=av(ch).appendTo(cc);b9=bQ.find("thead");bX=b9.find("th").slice(1,-1);bW=bQ.find("tbody");bf=bW.find("td").slice(0,-1);aS=bf.find("> div");aN=bf.find(".fc-day-content > div");bT=bf.eq(0);bM=aS.eq(0);g(b9.add(b9.find("tr")));g(bW.add(bW.find("tr")))}function b7(){var ch="<table style='width:100%' class='fc-agenda-days fc-border-separate' cellspacing='0'>"+b5()+bY()+"</table>";return ch}function b5(){var ck=br+"-widget-header";var ci;var cj="";var cl;var ch;cj+="<thead><tr>";if(bR){ci=bb(0,0);cl=a9(ci,bv);if(aO){cl+=bC}else{cl=bC+cl}cj+="<th class='fc-agenda-axis fc-week-number "+ck+"'>"+aI(cl)+"</th>"}else{cj+="<th class='fc-agenda-axis "+ck+"'>&nbsp;</th>"}for(ch=0;ch<bG;ch++){ci=bb(0,ch);cj+="<th class='fc-"+R[ci.getDay()]+" fc-col"+ch+" "+ck+"'>"+aI(a9(ci,a2))+"</th>"}cj+="<th class='fc-agenda-gutter "+ck+"'>&nbsp;</th></tr></thead>";return cj}function bY(){var cj=br+"-widget-header";var ck=br+"-widget-content";var cm;var co=f(new Date());var cl;var cp;var ci;var ch;var cn="";cn+="<tbody><tr><th class='fc-agenda-axis "+cj+"'>&nbsp;</th>";cp="";for(cl=0;cl<bG;cl++){cm=bb(0,cl);ch=["fc-col"+cl,"fc-"+R[cm.getDay()],ck];if(+cm==+co){ch.push(br+"-state-highlight","fc-today")}else{if(cm<co){ch.push("fc-past")}else{ch.push("fc-future")}}ci="<td class='"+ch.join(" ")+"'><div><div class='fc-day-content'><div style='position:relative'>&nbsp;</div></div></div></td>";cp+=ci}cn+=cp;cn+="<td class='fc-agenda-gutter "+ck+"'>&nbsp;</td></tr></tbody>";return cn}function bl(ch){if(ch===w){ch=bK}bK=ch;bh={};var cj=bW.position().top;var ci=bq.position().top;var ck=Math.min(ch-cj,a0.height()+ci+1);bM.height(ck-I(bT));ce.css("top",cj);bq.height(ck-ci-1);bH=a0.find("tr:first").height()+1;a4=bB("slotMinutes")/bt;b8=bH/a4}function bp(ck){bx=ck;bF.clear();by.clear();var ch=b9.find("th:first");if(ca){ch=ch.add(ca.find("th:first"))}ch=ch.add(a0.find("th:first"));bm=0;aw(ch.width("").each(function(cl,cm){bm=Math.max(bm,av(cm).outerWidth())}),bm);var ci=bQ.find(".fc-agenda-gutter");if(ca){ci=ci.add(ca.find("th.fc-agenda-gutter"))}var cj=bq[0].clientWidth;bA=bq.width()-cj;if(bA){aw(ci,bA);ci.show().prev().removeClass("fc-last")}else{ci.hide().prev().addClass("fc-last")}aW=Math.floor((cj-bm)/bG);aw(bX.slice(0,-1),aW)}function bj(){var ck=h();var ci=P(ck);ci.setHours(bB("firstHour"));var cj=cf(ck,ci)+1;function ch(){bq.scrollTop(cj)}ch();setTimeout(ch,0)}function bV(){bj()}function bn(ch){ch.click(bO).mousedown(bz)}function b0(ch){ch.click(bO).mousedown(a1)}function bO(cl){if(!bB("selectable")){var cj=Math.min(bG-1,Math.floor((cl.pageX-bQ.offset().left-bm)/aW));var ci=bb(0,cj);var cm=this.parentNode.className.match(/fc-slot(\d+)/);if(cm){var ck=parseInt(cm[1])*bB("slotMinutes");var ch=Math.floor(ck/60);ci.setHours(ch);ci.setMinutes(ck%60+bk);bE("dayClick",bf[cj],ci,false,cl)}else{bE("dayClick",bf[cj],ci,true,cl)}}}function aR(cl,cm,ch){if(ch){bI.build()}var ci=bi(cl,cm);for(var cj=0;cj<ci.length;cj++){var ck=ci[cj];bn(a7(ck.row,ck.leftCol,ck.row,ck.rightCol))}}function a7(ck,cl,ci,cj){var ch=bI.rect(ck,cl,ci,cj,ce);return bs(ch,ce)}function bc(cl,cq){for(var cj=0;cj<bG;cj++){var cm=bb(0,cj);var ci=aF(P(cm),1);var ck=new Date(Math.max(cm,cl));var cp=new Date(Math.min(ci,cq));if(ck<cp){var co=bI.rect(0,cj,0,cj,a6);var cn=cf(cm,ck);var ch=cf(cm,cp);co.top=cn;co.height=ch-cn;b0(bs(co,a6))}}}bI=new Q(function(cp,cn){var cl,ci,ch;bX.each(function(cs,cr){cl=av(cr);ci=cl.offset().left;if(cs){ch[1]=ci}ch=[ci];cn[cs]=ch});ch[1]=ci+cl.outerWidth();if(bB("allDaySlot")){cl=b1;ci=cl.offset().top;cp[0]=[ci,ci+cl.outerHeight()]}var co=a6.offset().top;var cq=bq.offset().top;var ck=cq+bq.outerHeight();function cm(cr){return Math.max(cq,Math.min(ck,cr))}for(var cj=0;cj<bL*a4;cj++){cp.push([cm(co+b8*cj),cm(co+b8*(cj+1))])}});cb=new aq(bI);bF=new n(function(ch){return aS.eq(ch)});by=new n(function(ch){return aN.eq(ch)});function b6(ch){return bF.left(ch)}function cg(ch){return by.left(ch)}function bN(ch){return bF.right(ch)}function aV(ch){return by.right(ch)}function bw(ch){return bB("allDaySlot")&&!ch.row}function bS(ch){var cj=bb(0,ch.col);var ci=ch.row;if(bB("allDaySlot")){ci--}if(ci>=0){k(cj,bk+ci*bt)}return cj}function cf(ci,cm){ci=P(ci,true);if(cm<k(P(ci),bk)){return 0}if(cm>=k(P(ci),aP)){return a0.height()}var ch=bB("slotMinutes"),cl=cm.getHours()*60+cm.getMinutes()-bk,ck=Math.floor(cl/ch),cj=bh[ck];if(cj===w){cj=bh[ck]=a0.find("tr").eq(ck).find("td div")[0].offsetTop}return Math.max(0,Math.round(cj-1+bH*((cl%ch)/ch)))}function bD(ch){return b1}function bU(ch){var ci=P(ch.start);if(ch.allDay){return ci}return k(ci,bB("defaultEventMinutes"))}function bo(ch,ci){if(ci){return P(ch)}return k(P(ch),bB("slotMinutes"))}function b4(ch,cj,ci){if(ci){if(bB("allDaySlot")){aR(ch,aF(P(cj),1),true)}}else{b3(ch,cj)}}function b3(ch,cn){var cl=bB("selectHelper");bI.build();if(cl){var cj=aY(ch).col;if(cj>=0&&cj<bG){var ck=bI.rect(0,cj,0,cj,a6);var cm=cf(ch,ch);var ci=cf(ch,cn);if(ci>cm){ck.top=cm;ck.height=ci-cm;ck.left+=2;ck.width-=5;if(av.isFunction(cl)){var co=cl(ch,cn);if(co){ck.position="absolute";aU=av(co).css(ck).appendTo(a6)}}else{ck.isStart=true;ck.isEnd=true;aU=av(a5({title:"",start:ch,end:cn,className:["fc-select-helper"],editable:false},ck));aU.css("opacity",bB("dragOpacity"))}if(aU){b0(aU);a6.append(aU);aw(aU,ck.width,true);aa(aU,ck.height,true)}}}}else{bc(ch,cn)}}function bZ(){aQ();if(aU){aU.remove();aU=null}}function a1(ch){if(ch.which==1&&bB("selectable")){b2(ch);var ci;cb.start(function(ck,cj){bZ();if(ck&&ck.col==cj.col&&!bw(ck)){var cm=bS(cj);var cl=bS(ck);ci=[cm,k(P(cm),bt),cl,k(P(cl),bt)].sort(a);b3(ci[0],ci[3])}else{ci=null}},ch);av(document).one("mouseup",function(cj){cb.stop();if(ci){if(+ci[0]==+ci[1]){ba(ci[0],false,cj)}bu(ci[0],ci[3],false,cj)}})}}function ba(ch,cj,ci){bE("dayClick",bf[aY(ch).col],ch,cj,ci)}function aX(cj,ch,ci){cb.start(function(ck){aQ();if(ck){if(bw(ck)){a7(ck.row,ck.col,ck.row,ck.col)}else{var cm=bS(ck);var cl=k(P(cm),bB("defaultEventMinutes"));bc(cm,cl)}}},ch)}function cd(ck,ci,cj){var ch=cb.stop();aQ();if(ch){bE("drop",ck,bS(ch),bw(ch),ci,cj)}}}function W(){var bm=this;bm.renderEvents=aS;bm.clearEvents=a7;bm.slotSegHtml=a8;Z.call(bm);var a2=bm.opt;var a9=bm.trigger;var aQ=bm.isEventDraggable;var br=bm.isEventResizable;var bs=bm.eventEnd;var bc=bm.eventElementHandlers;var bi=bm.setHeight;var aR=bm.getDaySegmentContainer;var bu=bm.getSlotSegmentContainer;var aP=bm.getHoverListener;var aO=bm.getMaxMinute;var bd=bm.getMinMinute;var aV=bm.timePosition;var bf=bm.getIsCellAllDay;var bh=bm.colContentLeft;var be=bm.colContentRight;var aN=bm.cellToDate;var bj=bm.getColCnt;var a3=bm.getColWidth;var bl=bm.getSnapHeight;var aX=bm.getSnapMinutes;var aZ=bm.getSlotContainer;var a0=bm.reportEventElement;var aT=bm.showEvents;var a1=bm.hideEvents;var bp=bm.eventDrop;var a5=bm.eventResize;var ba=bm.renderDayOverlay;var aU=bm.clearOverlays;var bv=bm.renderDayEvents;var bn=bm.calendar;var bk=bn.formatDate;var a4=bn.formatDates;bm.draggableDayEvent=aY;function aS(bA,by){var bz,bx=bA.length,bB=[],bw=[];for(bz=0;bz<bx;bz++){if(bA[bz].allDay){bB.push(bA[bz])}else{bw.push(bA[bz])}}if(a2("allDaySlot")){bv(bB,by);bi()}aW(a6(bw),by)}function a7(){aR().empty();bu().empty()}function a6(bG){var bE=bj(),bC=bd(),bx=aO(),bD,bA=av.map(bG,bt),bB,bz,by,bF,bw=[];for(bB=0;bB<bE;bB++){bD=aN(0,bB);k(bD,bC);bF=bg(bG,bA,bD,k(P(bD),bx-bC));bF=al(bF);for(bz=0;bz<bF.length;bz++){by=bF[bz];by.col=bB;bw.push(by)}}return bw}function bg(bI,bC,by,bB){var bz=[],bD,bF=bI.length,bx,bG,bE,bH,bJ,bw,bA;for(bD=0;bD<bF;bD++){bx=bI[bD];bG=bx.start;bE=bC[bD];if(bE>by&&bG<bB){if(bG<by){bH=P(by);bw=false}else{bH=bG;bw=true}if(bE>bB){bJ=P(bB);bA=false}else{bJ=bE;bA=true}bz.push({event:bx,start:bH,end:bJ,isStart:bw,isEnd:bA})}}return bz.sort(y)}function bt(bw){if(bw.end){return P(bw.end)}else{return k(P(bw.start),a2("defaultEventMinutes"))}}function aW(bH,bI){var bM,bP=bH.length,bO,bK,bE,bA,bB,bD,by,bJ,bw,bQ,bC="",bR,bN,bz,bG,bF,bL=bu(),bx=a2("isRTL");for(bM=0;bM<bP;bM++){bO=bH[bM];bK=bO.event;bE=aV(bO.start,bO.start);bA=aV(bO.start,bO.end);bB=bh(bO.col);bD=be(bO.col);by=bD-bB;bD-=by*0.025;by=bD-bB;bJ=by*(bO.forwardCoord-bO.backwardCoord);if(a2("slotEventOverlap")){bJ=Math.max((bJ-(20/2))*2,bJ)}if(bx){bQ=bD-bO.backwardCoord*by;bw=bQ-bJ}else{bw=bB+bO.backwardCoord*by;bQ=bw+bJ}bw=Math.max(bw,bB);bQ=Math.min(bQ,bD);bJ=bQ-bw;bO.top=bE;bO.left=bw;bO.outerWidth=bJ;bO.outerHeight=bA-bE;bC+=a8(bK,bO)}bL[0].innerHTML=bC;bR=bL.children();for(bM=0;bM<bP;bM++){bO=bH[bM];bK=bO.event;bN=av(bR[bM]);bz=a9("eventRender",bK,bK,bN);if(bz===false){bN.remove()}else{if(bz&&bz!==true){bN.remove();bN=av(bz).css({position:"absolute",top:bO.top,left:bO.left}).appendTo(bL)}bO.element=bN;if(bK._id===bI){bo(bK,bN,bO)}else{bN[0]._fci=bM}a0(bK,bN)}}v(bL,bH,bo);for(bM=0;bM<bP;bM++){bO=bH[bM];if(bN=bO.element){bO.vsides=I(bN,true);bO.hsides=j(bN,true);bG=bN.find(".fc-event-title");if(bG.length){bO.contentTop=bG[0].offsetTop}}}for(bM=0;bM<bP;bM++){bO=bH[bM];if(bN=bO.element){bN[0].style.width=Math.max(0,bO.outerWidth-bO.hsides)+"px";bF=Math.max(0,bO.outerHeight-bO.vsides);bN[0].style.height=bF+"px";bK=bO.event;if(bO.contentTop!==w&&bF-bO.contentTop<10){bN.find("div.fc-event-time").text(bk(bK.start,a2("timeFormat"))+" - "+bK.title);bN.find("div.fc-event-title").remove()}a9("eventAfterRender",bK,bK,bN)}}}function a8(bB,bw){var bA="<";var by=bB.url;var bx=S(bB,a2);var bz=["fc-event","fc-event-vert"];if(aQ(bB)){bz.push("fc-event-draggable")}if(bw.isStart){bz.push("fc-event-start")}if(bw.isEnd){bz.push("fc-event-end")}bz=bz.concat(bB.className);if(bB.source){bz=bz.concat(bB.source.className||[])}if(by){bA+="a href='"+aI(bB.url)+"'"}else{bA+="div"}bA+=" class='"+bz.join(" ")+"' style='position:absolute;top:"+bw.top+"px;left:"+bw.left+"px;"+bx+"'><div class='fc-event-inner'><div class='fc-event-time'>"+aI(a4(bB.start,bB.end,a2("timeFormat")))+"</div><div class='fc-event-title'>"+aI(bB.title||"")+"</div></div><div class='fc-event-bg'></div>";if(bw.isEnd&&br(bB)){bA+="<div class='ui-resizable-handle ui-resizable-s'>=</div>"}bA+="</"+(by?"a":"div")+">";return bA}function bo(by,bx,bw){var bz=bx.find("div.fc-event-time");if(aQ(by)){bb(by,bx,bz)}if(bw.isEnd&&br(by)){bq(by,bx,bz)}bc(by,bx)}function aY(bx,bG,bB){var bw=bB.isStart;var bH;var bF;var bJ=true;var bA;var bz=aP();var bC=a3();var by=bl();var bI=aX();var bE=bd();bG.draggable({opacity:a2("dragOpacity","month"),revertDuration:a2("dragRevertDuration"),start:function(bK,bL){a9("eventDragStart",bG,bx,bK,bL);a1(bx,bG);bH=bG.width();bz.start(function(bN,bM){aU();if(bN){bF=false;var bP=aN(0,bM.col);var bO=aN(0,bN.col);bA=aC(bO,bP);if(!bN.row){ba(aF(P(bx.start),bA),aF(ap(bx),bA));bD()}else{if(bw){if(bJ){bG.width(bC-10);aa(bG,by*Math.round((bx.end?((bx.end-bx.start)/V):a2("defaultEventMinutes"))/bI));bG.draggable("option","grid",[bC,1]);bJ=false}}else{bF=true}}bF=bF||(bJ&&!bA)}else{bD();bF=true}bG.draggable("option","revert",bF)},bK,"drag")},stop:function(bL,bM){bz.stop();aU();a9("eventDragStop",bG,bx,bL,bM);if(bF){bD();bG.css("filter","");aT(bx,bG)}else{var bK=0;if(!bJ){bK=Math.round((bG.offset().top-aZ().offset().top)/by)*bI+bE-(bx.start.getHours()*60+bx.start.getMinutes())}bp(this,bx,bA,bK,bJ,bL,bM)}}});function bD(){if(!bJ){bG.width(bH).height("").draggable("option","grid",null);bJ=true}}}function bb(bJ,bL,by){var bE=bm.getCoordinateGrid();var bH=bj();var bQ=a3();var bI=bl();var bD=aX();var bP;var bN;var bO,bG;var bw,bz;var bx,bC;var bA;var bK,bB;bL.draggable({scroll:false,grid:[bQ,bI],axis:bH==1?"y":false,opacity:a2("dragOpacity"),revertDuration:a2("dragRevertDuration"),start:function(bR,bS){F(bR);a9("eventDragStart",bL,bJ,bR,bS);a1(bJ,bL);bE.build();bP=bL.position();bN=bE.cell(bR.pageX,bR.pageY);bO=bG=true;bw=bz=bf(bN);bx=bC=0;bA=0;bK=bB=0},drag:function(bV,bW){F(bV);var bR=bE.cell(bV.pageX,bV.pageY);bO=!!bR;if(bO){bw=bf(bR);bx=Math.round((bW.position.left-bP.left)/bQ);if(bx!=bC){var bU=aN(0,bN.col);var bT=bN.col+bx;bT=Math.max(0,bT);bT=Math.min(bH-1,bT);var bS=aN(0,bT);bA=aC(bS,bU)}if(!bw){bK=Math.round((bW.position.top-bP.top)/bI)*bD}}if(bO!=bG||bw!=bz||bx!=bC||bK!=bB){bM();bG=bO;bz=bw;bC=bx;bB=bK}bL.draggable("option","revert",!bO)},stop:function(bR,bS){F(bR);aU();a9("eventDragStop",bL,bJ,bR,bS);if(bO&&(bw||bA||bK)){bp(this,bJ,bA,bw?0:bK,bw,bR,bS)}else{bO=true;bw=false;bx=0;bA=0;bK=0;bM();bL.css("filter","");bL.css(bP);aT(bJ,bL)}}});function bM(){aU();if(bO){if(bw){by.hide();bL.draggable("option","grid",null);ba(aF(P(bJ.start),bA),aF(ap(bJ),bA))}else{bF(bK);by.css("display","");bL.draggable("option","grid",[bQ,bI])}}}function bF(bS){var bR=k(P(bJ.start),bS);var bT;if(bJ.end){bT=k(P(bJ.end),bS)}by.text(a4(bR,bT,a2("timeFormat")))}}function bq(bA,by,bB){var bz,bw;var bC=bl();var bx=aX();by.resizable({handles:{s:".ui-resizable-handle"},grid:bC,minHeight:bC,start:function(bD,bE){bz=bw=0;a9("eventResizeStart",this,bA,bD,bE)},resize:function(bD,bE){bz=Math.round((Math.max(bC,by.height())-bE.originalSize.height)/bC);if(bz!=bw){bB.text(a4(bA.start,(!bz&&!bA.end)?null:k(bs(bA),bx*bz),a2("timeFormat")));bw=bz}},stop:function(bD,bE){a9("eventResizeStop",this,bA,bD,bE);if(bz){a5(this,bA,0,bx*bz,bD,bE)}}})}}function al(aN){var aP=G(aN);var aQ=aP[0];var aO;Y(aP);if(aQ){for(aO=0;aO<aQ.length;aO++){ac(aQ[aO])}for(aO=0;aO<aQ.length;aO++){N(aQ[aO],0,0)}}return D(aP)}function G(aO){var aR=[];var aQ,aN;var aP;for(aQ=0;aQ<aO.length;aQ++){aN=aO[aQ];for(aP=0;aP<aR.length;aP++){if(!aL(aN,aR[aP]).length){break}}(aR[aP]||(aR[aP]=[])).push(aN)}return aR}function Y(aR){var aQ,aS;var aP,aN;var aO;for(aQ=0;aQ<aR.length;aQ++){aS=aR[aQ];for(aP=0;aP<aS.length;aP++){aN=aS[aP];aN.forwardSegs=[];for(aO=aQ+1;aO<aR.length;aO++){aL(aN,aR[aO],aN.forwardSegs)}}}}function ac(aO){var aN=aO.forwardSegs;var aR=0;var aQ,aP;if(aO.forwardPressure===w){for(aQ=0;aQ<aN.length;aQ++){aP=aN[aQ];ac(aP);aR=Math.max(aR,1+aP.forwardPressure)}aO.forwardPressure=aR}}function N(aO,aQ,aR){var aN=aO.forwardSegs;var aP;if(aO.forwardCoord===w){if(!aN.length){aO.forwardCoord=1}else{aN.sort(aA);N(aN[0],aQ+1,aR);aO.forwardCoord=aN[0].backwardCoord}aO.backwardCoord=aO.forwardCoord-(aO.forwardCoord-aR)/(aQ+1);for(aP=0;aP<aN.length;aP++){N(aN[aP],0,aO.forwardCoord)}}}function D(aQ){var aN=[];var aP,aR;var aO;for(aP=0;aP<aQ.length;aP++){aR=aQ[aP];for(aO=0;aO<aR.length;aO++){aN.push(aR[aO])}}return aN}function aL(aN,aQ,aP){aP=aP||[];for(var aO=0;aO<aQ.length;aO++){if(e(aN,aQ[aO])){aP.push(aQ[aO])}}return aP}function e(aO,aN){return aO.end>aN.start&&aO.start<aN.end}function aA(aO,aN){return aN.forwardPressure-aO.forwardPressure||(aO.backwardCoord||0)-(aN.backwardCoord||0)||y(aO,aN)}function y(aO,aN){return aO.start-aN.start||(aN.end-aN.start)-(aO.end-aO.start)||(aO.event.title||"").localeCompare(aN.event.title)}function aG(a2,bm,aZ){var bl=this;bl.element=a2;bl.calendar=bm;bl.name=aZ;bl.opt=a7;bl.trigger=bf;bl.isEventDraggable=aS;bl.isEventResizable=br;bl.setEventData=bo;bl.clearEventData=aR;bl.eventEnd=bs;bl.reportEventElement=a5;bl.triggerEventDestroy=be;bl.eventElementHandlers=bh;bl.showEvents=aU;bl.hideEvents=a6;bl.eventDrop=bp;bl.eventResize=ba;var bu=bl.defaultEventEnd;var bg=bm.normalizeEvent;var bq=bm.reportEventChange;var a4={};var aY={};var bt=[];var bc=bm.options;function a7(bz,bx){var by=bc[bz];if(av.isPlainObject(by)){return H(by,bx||aZ)}return by}function bf(bx,by){return bm.trigger.apply(bm,[bx,by||bl].concat(Array.prototype.slice.call(arguments,2),[bl]))}function aS(bx){var by=bx.source||{};return aK(bx.startEditable,by.startEditable,a7("eventStartEditable"),bx.editable,by.editable,a7("editable"))&&!a7("disableDragging")}function br(bx){var by=bx.source||{};return aK(bx.durationEditable,by.durationEditable,a7("eventDurationEditable"),bx.editable,by.editable,a7("editable"))&&!a7("disableResizing")}function bo(bz){a4={};var by,bx=bz.length,bA;for(by=0;by<bx;by++){bA=bz[by];if(a4[bA._id]){a4[bA._id].push(bA)}else{a4[bA._id]=[bA]}}}function aR(){a4={};aY={};bt=[]}function bs(bx){return bx.end?P(bx.end):bu(bx)}function a5(by,bx){bt.push({event:by,element:bx});if(aY[by._id]){aY[by._id].push(bx)}else{aY[by._id]=[bx]}}function be(){av.each(bt,function(bx,by){bl.trigger("eventDestroy",by.event,by.event,by.element)})}function bh(by,bx){bx.click(function(bz){if(!bx.hasClass("ui-draggable-dragging")&&!bx.hasClass("ui-resizable-resizing")){return bf("eventClick",this,by,bz)}}).hover(function(bz){bf("eventMouseover",this,by,bz)},function(bz){bf("eventMouseout",this,by,bz)})}function aU(by,bx){a3(by,bx,"show")}function a6(by,bx){a3(by,bx,"hide")}function a3(bA,bz,bC){var bB=aY[bA._id],by,bx=bB.length;for(by=0;by<bx;by++){if(!bz||bB[by][0]!=bz[0]){bB[by][bC]()}}}function bp(bA,by,bz,bB,bE,bD,bC){var bF=by.allDay;var bx=by._id;a8(a4[bx],bz,bB,bE);bf("eventDrop",bA,by,bz,bB,bE,function(){a8(a4[bx],-bz,-bB,bF);bq(bx)},bD,bC);bq(bx)}function ba(bD,bB,by,bx,bA,bC){var bz=bB._id;a0(a4[bz],by,bx);bf("eventResize",bD,bB,by,bx,function(){a0(a4[bz],-by,-bx);bq(bz)},bA,bC);bq(bz)}function a8(bB,bz,by,bC){by=by||0;for(var bD,bx=bB.length,bA=0;bA<bx;bA++){bD=bB[bA];if(bC!==w){bD.allDay=bC}k(aF(bD.start,bz,true),by);if(bD.end){bD.end=k(aF(bD.end,bz,true),by)}bg(bD,bc)}}function a0(bB,bz,by){by=by||0;for(var bC,bx=bB.length,bA=0;bA<bx;bA++){bC=bB[bA];bC.end=k(aF(bs(bC),bz,true),by);bg(bC,bc)}}bl.isHiddenDay=aW;bl.skipHiddenDays=aT;bl.getCellsPerWeek=bj;bl.dateToCell=bn;bl.dateToDayOffset=bb;bl.dayOffsetToCellOffset=aP;bl.cellOffsetToCell=a1;bl.cellToDate=aQ;bl.cellToCellOffset=aN;bl.cellOffsetToDayOffset=bd;bl.dayOffsetToDate=bw;bl.rangeToSegments=bi;var a9=a7("hiddenDays")||[];var aO=[];var bv;var aV=[];var aX=[];var bk=a7("isRTL");(function(){if(a7("weekends")===false){a9.push(0,6)}for(var by=0,bx=0;by<7;by++){aV[by]=bx;aO[by]=av.inArray(by,a9)!=-1;if(!aO[by]){aX[bx]=by;bx++}}bv=bx;if(!bv){throw"invalid hiddenDays"}})();function aW(bx){if(typeof bx=="object"){bx=bx.getDay()}return aO[bx]}function bj(){return bv}function aT(by,bz,bx){bz=bz||1;while(aO[(by.getDay()+(bx?bz:0)+7)%7]){aF(by,bz)}}function aQ(){var bz=aN.apply(null,arguments);var bx=bd(bz);var by=bw(bx);return by}function aN(bC,bA){var bz=bl.getColCnt();var by=bk?-1:1;var bx=bk?bz-1:0;if(typeof bC=="object"){bA=bC.col;bC=bC.row}var bB=bC*bz+(bA*by+bx);return bB}function bd(by){var bx=bl.visStart.getDay();by+=aV[bx];return Math.floor(by/bv)*7+aX[(by%bv+bv)%bv]-bx}function bw(bx){var by=P(bl.visStart);aF(by,bx);return by}function bn(bz){var by=bb(bz);var bA=aP(by);var bx=a1(bA);return bx}function bb(bx){return aC(bx,bl.visStart)}function aP(by){var bx=bl.visStart.getDay();by+=bx;return Math.floor(by/7)*bv+aV[(by%7+7)%7]-aV[bx]}function a1(bC){var bA=bl.getColCnt();var by=bk?-1:1;var bx=bk?bA-1:0;var bB=Math.floor(bC/bA);var bz=((bC%bA+bA)%bA)*by+bx;return{row:bB,col:bz}}function bi(by,bN){var bB=bl.getRowCnt();var bL=bl.getColCnt();var bM=[];var bP=bb(by);var bK=bb(bN);var bO=aP(bP);var bC=aP(bK)-1;for(var bD=0;bD<bB;bD++){var bz=bD*bL;var bH=bz+bL-1;var bI=Math.max(bO,bz);var bA=Math.min(bC,bH);if(bI<=bA){var bx=a1(bI);var bJ=a1(bA);var bG=[bx.col,bJ.col].sort();var bE=bd(bI)==bP;var bF=bd(bA)+1==bK;bM.push({row:bD,leftCol:bG[0],rightCol:bG[1],isStart:bE,isEnd:bF})}}return bM}}function Z(){var bu=this;bu.renderDayEvents=bB;bu.draggableDayEvent=a3;bu.resizableDayEvent=bo;var a8=bu.opt;var bl=bu.trigger;var aV=bu.isEventDraggable;var bx=bu.isEventResizable;var by=bu.eventEnd;var a6=bu.reportEventElement;var bn=bu.eventElementHandlers;var aY=bu.showEvents;var a7=bu.hideEvents;var bw=bu.eventDrop;var bc=bu.eventResize;var bC=bu.getRowCnt;var bt=bu.getColCnt;var ba=bu.getColWidth;var a2=bu.allDayRow;var bA=bu.colLeft;var a4=bu.colRight;var bs=bu.colContentLeft;var bq=bu.colContentRight;var bv=bu.dateToCell;var aW=bu.getDaySegmentContainer;var bb=bu.calendar.formatDates;var bm=bu.renderDayOverlay;var aZ=bu.clearOverlays;var aP=bu.clearSelection;var aU=bu.getHoverListener;var bp=bu.rangeToSegments;var aS=bu.cellToDate;var aO=bu.cellToCellOffset;var bj=bu.cellOffsetToDayOffset;var be=bu.dateToDayOffset;var aR=bu.dayOffsetToCellOffset;function bB(bF,bE){var bD=a1(bF,false,true);af(bD,function(bH,bG){a6(bH.event,bG)});a0(bD,bE);af(bD,function(bH,bG){bl("eventAfterRender",bH.event,bH.event,bG)})}function bf(bE,bH,bG){var bD=a1([bE],true,false);var bF=[];af(bD,function(bJ,bI){if(bJ.row===bH){bI.css("top",bG)}bF.push(bI[0])});return bF}function a1(bG,bK,bI){var bH=aW();var bF=bK?av("<div/>"):bH;var bD=a5(bG);var bE;var bJ;bz(bD);bE=bd(bD);bF[0].innerHTML=bE;bJ=bF.children();if(bK){bH.append(bJ)}aX(bD,bJ);af(bD,function(bM,bL){bM.hsides=j(bL,true)});af(bD,function(bM,bL){bL.width(Math.max(0,bM.outerWidth-bM.hsides))});af(bD,function(bM,bL){bM.outerHeight=bL.outerHeight(true)});aT(bD,bI);return bD}function a5(bF){var bD=[];for(var bE=0;bE<bF.length;bE++){var bG=bk(bF[bE]);bD.push.apply(bD,bG)}return bD}function bk(bG){var bD=bG.start;var bH=ap(bG);var bE=bp(bD,bH);for(var bF=0;bF<bE.length;bF++){bE[bF].event=bG}return bE}function bz(bE){var bH=a8("isRTL");for(var bG=0;bG<bE.length;bG++){var bI=bE[bG];var bJ=(bH?bI.isEnd:bI.isStart)?bs:bA;var bD=(bH?bI.isStart:bI.isEnd)?bq:a4;var bK=bJ(bI.leftCol);var bF=bD(bI.rightCol);bI.left=bK;bI.outerWidth=bF-bK}}function bd(bD){var bF="";for(var bE=0;bE<bD.length;bE++){bF+=a9(bD[bE])}return bF}function a9(bI){var bG="";var bF=a8("isRTL");var bH=bI.event;var bE=bH.url;var bJ=["fc-event","fc-event-hori"];if(aV(bH)){bJ.push("fc-event-draggable")}if(bI.isStart){bJ.push("fc-event-start")}if(bI.isEnd){bJ.push("fc-event-end")}bJ=bJ.concat(bH.className);if(bH.source){bJ=bJ.concat(bH.source.className||[])}var bD=S(bH,a8);if(bE){bG+="<a href='"+aI(bE)+"'"}else{bG+="<div"}bG+=" class='"+bJ.join(" ")+"' style='position:absolute;left:"+bI.left+"px;"+bD+"'><div class='fc-event-inner'>";if(!bH.allDay&&bI.isStart){bG+="<span class='fc-event-time'>"+aI(bb(bH.start,bH.end,a8("timeFormat")))+"</span>"}bG+="<span class='fc-event-title'>"+aI(bH.title||"")+"</span></div>";if(bI.isEnd&&bx(bH)){bG+="<div class='ui-resizable-handle ui-resizable-"+(bF?"w":"e")+"'>&nbsp;&nbsp;&nbsp;</div>"}bG+="</"+(bE?"a":"div")+">";return bG}function aX(bE,bJ){for(var bG=0;bG<bE.length;bG++){var bI=bE[bG];var bH=bI.event;var bF=bJ.eq(bG);var bD=bl("eventRender",bH,bH,bF);if(bD===false){bF.remove()}else{if(bD&&bD!==true){bD=av(bD).css({position:"absolute",left:bI.left});bF.replaceWith(bD);bF=bD}bI.element=bF}}}function aT(bF,bH){var bI=aN(bF);var bD=br();var bE=[];if(bH){for(var bG=0;bG<bD.length;bG++){bD[bG].height(bI[bG])}}for(var bG=0;bG<bD.length;bG++){bE.push(bD[bG].position().top)}af(bF,function(bK,bJ){bJ.css("top",bE[bK.row]+bK.top)})}function aN(bF){var bH=bC();var bM=bt();var bN=[];var bD=bi(bF);for(var bL=0;bL<bH;bL++){var bK=bD[bL];var bJ=[];for(var bI=0;bI<bM;bI++){bJ.push(0)}for(var bE=0;bE<bK.length;bE++){var bG=bK[bE];bG.top=au(bJ.slice(bG.leftCol,bG.rightCol+1));for(var bI=bG.leftCol;bI<=bG.rightCol;bI++){bJ[bI]=bG.top+bG.outerHeight}}bN.push(au(bJ))}return bN}function bi(bE){var bI=bC();var bH=[];var bD;var bG;var bF;for(bD=0;bD<bE.length;bD++){bG=bE[bD];bF=bG.row;if(bG.element){if(bH[bF]){bH[bF].push(bG)}else{bH[bF]=[bG]}}}for(bF=0;bF<bI;bF++){bH[bF]=aQ(bH[bF]||[])}return bH}function aQ(bE){var bG=[];var bD=bh(bE);for(var bF=0;bF<bD.length;bF++){bG.push.apply(bG,bD[bF])}return bG}function bh(bF){bF.sort(ax);var bE=[];for(var bG=0;bG<bF.length;bG++){var bH=bF[bG];for(var bD=0;bD<bE.length;bD++){if(!b(bH,bE[bD])){break}}if(bE[bD]){bE[bD].push(bH)}else{bE[bD]=[bH]}}return bE}function br(){var bD;var bF=bC();var bE=[];for(bD=0;bD<bF;bD++){bE[bD]=a2(bD).find("div.fc-day-content > div")}return bE}function a0(bE,bD){var bF=aW();af(bE,function(bJ,bH,bG){var bI=bJ.event;if(bI._id===bD){bg(bI,bH,bJ)}else{bH[0]._fci=bG}});v(bF,bE,bg)}function bg(bF,bD,bE){if(aV(bF)){bu.draggableDayEvent(bF,bD,bE)}if(bE.isEnd&&bx(bF)){bu.resizableDayEvent(bF,bD,bE)}bn(bF,bD)}function a3(bG,bF){var bE=aU();var bD;bF.draggable({delay:50,opacity:a8("dragOpacity"),revertDuration:a8("dragRevertDuration"),start:function(bH,bI){bl("eventDragStart",bF,bG,bH,bI);a7(bG,bF);bE.start(function(bK,bJ,bN,bO){bF.draggable("option","revert",!bK||!bN&&!bO);aZ();if(bK){var bM=aS(bJ);var bL=aS(bK);bD=aC(bL,bM);bm(aF(P(bG.start),bD),aF(ap(bG),bD))}else{bD=0}},bH,"drag")},stop:function(bH,bI){bE.stop();aZ();bl("eventDragStop",bF,bG,bH,bI);if(bD){bw(this,bG,bD,0,bG.allDay,bH,bI)}else{bF.css("filter","");aY(bG,bF)}}})}function bo(bG,bE,bF){var bD=a8("isRTL");var bI=bD?"w":"e";var bH=bE.find(".ui-resizable-"+bI);var bJ=false;aM(bE);bE.mousedown(function(bK){bK.preventDefault()}).click(function(bK){if(bJ){bK.preventDefault();bK.stopImmediatePropagation()}});bH.mousedown(function(bS){if(bS.which!=1){return}bJ=true;var bM=aU();var bQ=bC();var bT=bt();var bL=bE.css("top");var bO;var bK;var bR=av.extend({},bG);var bN=aR(be(bG.start));aP();av("body").css("cursor",bI+"-resize").one("mouseup",bP);bl("eventResizeStart",this,bG,bS);bM.start(function(bV,bU){if(bV){var bY=aO(bU);var bX=aO(bV);bX=Math.max(bX,bN);bO=bj(bX)-bj(bY);if(bO){bR.end=aF(by(bG),bO,true);var bW=bK;bK=bf(bR,bF.row,bL);bK=av(bK);bK.find("*").css("cursor",bI+"-resize");if(bW){bW.remove()}a7(bG)}else{if(bK){aY(bG);bK.remove();bK=null}}aZ();bm(bG.start,aF(ap(bG),bO))}},bS);function bP(bU){bl("eventResizeStop",this,bG,bU);av("body").css("cursor","");bM.stop();aZ();if(bO){bc(this,bG,bO,0,bU)}setTimeout(function(){bJ=false},0)}})}}function b(aO,aQ){for(var aN=0;aN<aQ.length;aN++){var aP=aQ[aN];if(aP.leftCol<=aO.rightCol&&aP.rightCol>=aO.leftCol){return true}}return false}function af(aN,aR){for(var aP=0;aP<aN.length;aP++){var aQ=aN[aP];var aO=aQ.element;if(aO){aR(aQ,aO,aP)}}}function ax(aO,aN){return(aN.rightCol-aN.leftCol)-(aO.rightCol-aO.leftCol)||aN.event.allDay-aO.event.allDay||aO.event.start-aN.event.start||(aO.event.title||"").localeCompare(aN.event.title)}function ao(){var aX=this;aX.select=aV;aX.unselect=aR;aX.reportSelection=aN;aX.daySelectionMousedown=aU;var aP=aX.opt;var aQ=aX.trigger;var aS=aX.defaultSelectionEnd;var aO=aX.renderSelection;var aW=aX.clearSelection;var aT=false;if(aP("selectable")&&aP("unselectAuto")){av(document).mousedown(function(aY){var aZ=aP("unselectCancel");if(aZ){if(av(aY.target).parents(aZ).length){return}}aR(aY)})}function aV(aY,a0,aZ){aR();if(!a0){a0=aS(aY,aZ)}aO(aY,a0,aZ);aN(aY,a0,aZ)}function aR(aY){if(aT){aT=false;aW();aQ("unselect",null,aY)}}function aN(aY,a1,a0,aZ){aT=true;aQ("select",null,aY,a1,a0,aZ)}function aU(a2){var a0=aX.cellToDate;var aZ=aX.getIsCellAllDay;var aY=aX.getHoverListener();var a3=aX.reportDayClick;if(a2.which==1&&aP("selectable")){aR(a2);var a1=this;var a4;aY.start(function(a6,a5){aW();if(a6&&aZ(a6)){a4=[a0(a5),a0(a6)].sort(a);aO(a4[0],a4[1],true)}else{a4=null}},a2);av(document).one("mouseup",function(a5){aY.stop();if(a4){if(+a4[0]==+a4[1]){a3(a4[0],true,a5)}aN(a4[0],a4[1],true,a5)}})}}}function d(){var aQ=this;aQ.renderOverlay=aO;aQ.clearOverlays=aN;var aP=[];var aR=[];function aO(aT,aS){var aU=aR.shift();if(!aU){aU=av("<div class='fc-cell-overlay' style='position:absolute;z-index:3'/>")}if(aU[0].parentNode!=aS[0]){aU.appendTo(aS)}aP.push(aU.css(aT).show());return aU}function aN(){var aS;while(aS=aP.shift()){aR.push(aS.hide().unbind())}}}function Q(aN){var aO=this;var aP;var aQ;aO.build=function(){aP=[];aQ=[];aN(aP,aQ)};aO.cell=function(aR,aX){var aW=aP.length;var aS=aQ.length;var aT,aU=-1,aV=-1;for(aT=0;aT<aW;aT++){if(aX>=aP[aT][0]&&aX<aP[aT][1]){aU=aT;break}}for(aT=0;aT<aS;aT++){if(aR>=aQ[aT][0]&&aR<aQ[aT][1]){aV=aT;break}}return(aU>=0&&aV>=0)?{row:aU,col:aV}:null};aO.rect=function(aU,aW,aS,aT,aV){var aR=aV.offset();return{top:aP[aU][0]-aR.top,left:aQ[aW][0]-aR.left,width:aQ[aT][1]-aQ[aW][0],height:aP[aS][1]-aP[aU][0]}}}function aq(aS){var aQ=this;var aR;var aT;var aO;var aN;aQ.start=function(aU,aV,aW){aT=aU;aO=aN=null;aS.build();aP(aV);aR=aW||"mousemove";av(document).bind(aR,aP)};function aP(aU){F(aU);var aV=aS.cell(aU.pageX,aU.pageY);if(!aV!=!aN||aV&&(aV.row!=aN.row||aV.col!=aN.col)){if(aV){if(!aO){aO=aV}aT(aV,aO,aV.row-aO.row,aV.col-aO.col)}else{aT(aV,aO)}aN=aV}}aQ.stop=function(){av(document).unbind(aR,aP);return aN}}function F(aN){if(aN.pageX===w){aN.pageX=aN.originalEvent.pageX;aN.pageY=aN.originalEvent.pageY}}function n(aO){var aN=this,aP={},aS={},aR={};function aQ(aT){return aP[aT]=aP[aT]||aO(aT)}aN.left=function(aT){return aS[aT]=aS[aT]===w?aQ(aT).position().left:aS[aT]};aN.right=function(aT){return aR[aT]=aR[aT]===w?aN.left(aT)+aQ(aT).width():aR[aT]};aN.clear=function(){aP={};aS={};aR={}}}})(jQuery);
}catch(e){WRMCB(e)};
;
try {
/* module-key = 'com.atlassian.confluence.extra.team-calendars:calendar-resources', location = 'com/atlassian/confluence/extra/calendar3/js/calendar-data-cache.js' */
define("tc/calendar-cache",["jquery"],function(a){function b(){var c=[];function d(k,h){var f=false;for(var g=0;g<h.length;g++){for(var e=0;e<c[k].data.length;e++){if(h[g].id===c[k].data[e].id){f=true;break}}if(!f){c[k].data.push(h[g])}f=false}}return{hasCalendar:function(e){return c[e]},getCalendarStart:function(e){if(c[e]){return c[e].start}return null},getCalendarEnd:function(e){if(c[e]){return c[e].end}return null},addDataToCalendar:function(f,g,h,e){if(!c[f]){c[f]={data:g}}else{d(f,g)}if(!c[f].start||h.getTime()<c[f].start.getTime()){c[f].start=h}if(!c[f].end||e.getTime()>c[f].end.getTime()){c[f].end=e}},removeCalendar:function(f){if(a.isArray(f)){var e=this;a.each(f,function(h,g){if(a.isPlainObject(g)&&g.id&&typeof g.id==="string"){e.removeCalendar(g.id)}else{e.removeCalendar(g.toString())}})}else{delete c[f]}},removeAllCalendars:function(){c=[]},getCalendarData:function(e){if(!c[e]){return null}return c[e].data}}}return b});
}catch(e){WRMCB(e)};
;
try {
/* module-key = 'com.atlassian.confluence.extra.team-calendars:calendar-resources', location = 'com/atlassian/confluence/extra/calendar3/components/calendar-remove-dialog/calendar-remove-dialog.js' */
define("tc/calendar-remove-dialog",["jquery","underscore","tc-backbone","tc/templates","tc/calendar-util","tc/util"],function(e,a,g,d,c,f){var b=g.View.extend({removeSubCalendarDialog:null,calendarDiv:null,subCalendar:null,calendarPlugin:null,initialize:function(h){this.calendarDiv=h.calendarDiv;this.subCalendar=h.subCalendar;this.calendarPlugin=h.calendarPlugin;this.removeSubCalendarDialog=e("#remove-calendar-dialog")},render:function(){var k=this;var h;var i=AJS.Meta.get("space-key")!==undefined||e("meta[name='ajs-page-id']").length>=1;if(this.removeSubCalendarDialog){this.removeSubCalendarDialog.remove()}h=c.isPDLEnabled()?230:200;this.removeSubCalendarDialog=new AJS.Dialog({width:512,height:h,id:"remove-calendar-dialog"});this.removeSubCalendarDialog.addHeader("Remove Calendar","subcalendar-remove-header calendar-dialog-panel");this.removeSubCalendarDialog.addPanel("subcalendar-remove-calendar",d.removeSubCalendar({inSpace:i}),"remove-subcalendar-form");var j=e(".calendar-to-remove",this.removeSubCalendarDialog.getPanel());j.attr("title",this.subCalendar.name);j.text(this.subCalendar.name);this.removeSubCalendarDialog.addButton("OK",function(){if(e("#deletecalendaroption:checked",k.removeSubCalendarDialog.getPanel()).length){k.calendarPlugin.deleteSubCalendar(k.calendarDiv,k.subCalendar)}else{k.calendarPlugin.unsubscribeFromSubcalendar(k.calendarDiv,k.subCalendar)}k.removeSubCalendarDialog.hide()});this.removeSubCalendarDialog.addLink("Cancel",function(){k.removeSubCalendarDialog.hide()});this.removeSubCalendarDialog.show()}});return b});
}catch(e){WRMCB(e)};
;
try {
/* module-key = 'com.atlassian.confluence.extra.team-calendars:calendar-resources', location = 'com/atlassian/confluence/extra/calendar3/components/calendar-feature-discovery-dialog/calendar-feature-discovery-dialog.js' */
define("tc/calendar-feature-discovery-dialog",["jquery","underscore","tc-backbone","tc/templates","tc/dialogs","tc/calendar-util","tc/util"],function(f,a,h,d,c,b,g){var e=h.View.extend({featureDiscoveryDialog:null,calendarDiv:null,subCalendar:null,calendarPlugin:null,initialize:function(i){this.calendarDiv=i.calendarDiv;this.subCalendar=i.subCalendar;this.calendarPlugin=i.calendarPlugin;this.featureDiscoveryDialog=f("#team-calendars-feature-discovery-dialog")},render:function(){var k=this;if(this.featureDiscoveryDialog){this.featureDiscoveryDialog.remove()}var i=b.isPDLEnabled()?385:340,l=new AJS.Dialog({width:596,height:i,id:"team-calendars-feature-discovery-dialog"});l.addHeader("Congratulations, you have created a new Calendar!");l.addPanel("",d.subCalendarFeatures({autoConvertSupported:b.getParameter(this.calendarDiv,"autoConvertSupported")==="true",subCalendar:this.subCalendar}),"setup-calendar-panel");var j=l.getCurrentPanel().body;f(".add-event",j).click(function(){l.remove();var m=c.getEditEventDialog({start:new Date(),localizedStartTime:k.calendarPlugin.getDefaultStartTime(k.calendarDiv),localizedEndTime:k.calendarPlugin.getDefaultEndTime(k.calendarDiv),allDay:(k.calendarDiv.data(k.calendarPlugin.PREF_LAST_ALL_DAY_USED)||"true")==="true",subCalendarId:k.subCalendar.id},k.subCalendar,k.calendarPlugin,k.calendarDiv);m.show();return false});f(".restrict",j).click(function(){l.remove();k.calendarPlugin.getSubCalendarRestrictionsDialog(k.calendarDiv,k.subCalendar).show();return false});f(".embed, .embed-or-share, .share",j).click(function(){l.remove();var m=k.calendarPlugin.getSubCalendarShareDialog(k.calendarDiv,k.subCalendar);m.show();f(".share-address-field",m.getCurrentPanel().body).focus().select();return false});l.addLink("Close",function(){l.remove()});l.show()}});return e});
}catch(e){WRMCB(e)};
;
try {
/* module-key = 'com.atlassian.confluence.extra.team-calendars:calendar-resources', location = 'com/atlassian/confluence/extra/calendar3/components/calendar-subcalendar-subscribe-dialog/calendar-subcalendar-subscribe-dialog.js' */
define("tc/calendar-subcalendar-subscribe-dialog",["jquery","underscore","tc-backbone","tc/templates","tc/calendar-util","tc/util","tc/infinite-list"],function(e,a,h,c,b,f,g){var d=h.View.extend({subCalendarSubscibeDialog:null,callbackHandler:null,options:null,initialize:function(i){this.options=i;this.callbackHandler=i.callbackHandler;this.subCalendarSubscibeDialog=e(this.options.id!==undefined?this.options.id:"internal-subscription-calendar-dialog")},render:function(){var p=this;if(this.subCalendarSubscibeDialog){this.subCalendarSubscibeDialog.remove()}var k=function(G,I,F,K,E,J){var H=e(".results",G.getCurrentPanel().body);e.ajax({cache:false,converters:{"text json":function(L){return L}},data:I,dataFilter:function(L){var M=e.parseJSON(L);if(M.success){Confluence.TeamCalendars.mergeSubCalendarObjectsToArray(M.payload)}return M.payload},dataType:"json",error:function(N,L,M){if(K){K(I,H)}},success:function(M){if(!J){H.empty()}if(M&&M.length){var L=e(c.calendarSearchResultTable()),N=J?e("tbody",e(H)):e("tbody",L),O=function(P){N.append(e(c.calendarSearchResult({name:P.name,description:P.description||"",relatedSpace:P.spaceName||"",numSubscribers:P.subscriberCount})).click(function(){var Q=e(this),R=Q.hasClass("active");if(R){Q.removeClass("active");e(".subcalendar-select",Q).removeAttr("checked")}else{Q.addClass("active");e(".subcalendar-select",Q).attr("checked","checked")}var S=true,T=e("tr.active",N);T.each(function(){if(e(this).data("subCalendar").watchable){S=false;return false}});if(T.length){D();o()}else{w();i()}if(!T.length||S){i()}else{if(!S&&!R){o()}}}).data("subCalendar",P))};e.each(M,function(Q,P){if(Confluence.TeamCalendars.isDummySubscriptionParentSubCalendar(P)){e.each(P.childSubCalendars||[],function(R,S){O(S)})}else{O(P)}});if(!J){H.append(L)}e(".ellipsedColumn",L).each(function(){var Q=e(this);var P=Q.text();Q.attr("title",P).addClass("relative").ThreeDots({max_rows:1}).removeClass("relative")});if(E){E(M)}}else{if(K){K(I,H)}}},timeout:Confluence.TeamCalendars.ajaxTimeout,url:Confluence.TeamCalendars.getCalendarServiceBaseUrl(F)})};var v=(function(){var I=p.options.id!==undefined?p.options.id:"internal-subscription-calendar-dialog";var F=new AJS.Dialog({width:800,height:400,id:I});F.addHeader("Add Existing Team Calendar");F.addPanel("",c.subscribeDialog(),"subscribe-to-subcalendars-panel");var G=F.getCurrentPanel().body;e("#subscribe-intro",G).append("Here\'s a list of popular calendars you might also like, or you can \u003cspan class=\"show-search\"\u003e\u003ca  href=\"#\"\u003esearch for other calendars\u003c/a\u003e\u003c/span\u003e. If you don\'t see what you\'re looking for, \u003ca class=\"create-your-subcalendar\" href=\"#\"\u003ecreate a calendar\u003c/a\u003e of your own.");e(".create-your-subcalendar",G).click(function(){F.remove();var L=Confluence.TeamCalendars.Dialogs.getSubCalendarCreateDialog("parent",p.callbackHandler);f.showDialogInUpdatedHeight(L);e("input[name='name']",L.getCurrentPanel().body).focus();return false});var K=e(".search",G);e(".form",K).submit(function(){return false});var E;e("textarea[name='query']",K).text("Search").addClass("blank-search").keydown(function(L){if(L.keyCode===13){return false}var N=e(this),M=N.hasClass("blank-search")?N.removeClass("blank-search").val("").val():N.val();if(E!==undefined){clearTimeout(E)}E=setTimeout(function(){var P=N.val();if(!N.hasClass("blank-search")&&P&&P!==M){var O=AJS.Meta.get("space-key")!==undefined||e("meta[name='ajs-page-id']").length>=1;K.addClass("searching");k(F,e.extend({term:P,startIndex:0,pageSize:10,showSubscriberCount:true,showSubCalendarsInView:O},p.options.searchParams||{}),"/search/subcalendars.json",function(R,Q){K.removeClass("searching");w();i();Q.empty().append(e(document.createElement("span")).addClass("no-subcalendars-found").text(AJS.format("No results found for {0}",R.term)))},function(){K.removeClass("searching");D();r()})}},500)}).blur(function(){var L=e(this);if(!e.trim(L.val())){L.addClass("blank-search").val("Search")}});if(F.addHelpText&&e.isFunction(F.addHelpText)){F.addHelpText(e(document.createElement("span")).addClass("show-popular").html("You can also browse \u003ca href=\"#\"\u003epopular calendars\u003c/a\u003e."));e("span.show-popular a",F.getCurrentPanel().page.buttonpanel).unbind("click").click(function(){F.remove();Confluence.TeamCalendars.Dialogs.getSubCalendarSubscribeDialog({callbackHandler:p.callbackHandler,heading:"Popular Team Calendars"}).show();return false});F.addHelpText(e(document.createElement("span")).addClass("show-search").html("You can also \u003ca href=\"#\"\u003esearch for calendars\u003c/a\u003e."));var J=function(){F.remove();Confluence.TeamCalendars.Dialogs.getSubCalendarSubscribeDialog(e.extend(e.extend({},p.options),{callbackHandler:p.callbackHandler,heading:"Add Existing Team Calendar",showSearch:true})).show();return false};e("#"+F.id).find("span.show-search a").unbind("click").click(J)}var H=e(".dialog-button-panel",F.popup.element);if(!p.options.disableWatching){e(document.createElement("input")).attr({type:"checkbox",name:"watch"}).addClass("watch-selected-subcalendars").appendTo(H);e(document.createElement("span")).addClass("watch-select-subcalendars-label").text("Watch selected calendars").appendTo(H)}e("<span class='spinner hidden aui-icon aui-icon-wait'>Loading...</span>").appendTo(H);F.addButton("Add",function(){var M=e("tr.active",G);if(M.length&&!p.callbackHandler.isProcessingSubCalendar()){p.callbackHandler.setProcessingSubCalendar(true);var L=p.callbackHandler.setSubCalendarSpinnerIconVisible();w();i();l();e.ajax({cache:false,converters:{"text json":function(N){return N}},data:(function(){var N={color:p.callbackHandler.getNextCalendarColor(),watchSubCalendars:e(".watch-selected-subcalendars",F.popup.element).is(":checked")};var O=[];M.each(function(){O.push(e(this).data("subCalendar").id)});N.subCalendarIds=O;if(p.callbackHandler.getIncludedCalendars()){N.include=p.callbackHandler.getIncludedCalendars()}b.putCalendarContextParams(N);return N})(),dataFilter:function(N){var O=e.parseJSON(N);if(O.success){Confluence.TeamCalendars.mergeSubCalendarObjectsToArray(O.payload)}return O},dataType:"json",error:function(N,P,O){Confluence.TeamCalendars.showAjaxError(G,N,P,O,"error-subcalendar-refresh");p.callbackHandler.setProcessingSubCalendar(false);D();o();n()},success:function(N){if(!N.success){b.setGenericErrors(G,"Uh oh. Looks like something unexpectedly went wrong. Please check the Confluence log file.","error-subcalendar-refresh");return}p.callbackHandler.setSubCalendars(AJS.$.map(M,function(O){return e(O).data("subCalendar").id}).toString(),N.payload);p.callbackHandler.updateAvailableSubCalendarsInSubCalendarPanel();b.setGenericErrors(G,null,"error-subcalendar-refresh");F.remove();p.callbackHandler.setProcessingSubCalendar(false)},complete:function(){if(L){L.resolve()}},type:"PUT",timeout:Confluence.TeamCalendars.ajaxTimeout,url:Confluence.TeamCalendars.getCalendarServiceBaseUrl("/subcalendars/subscribe.json")})}else{F.remove()}},"subscribe-to-subcalendar-button");F.addLink("Cancel",function(){F.remove();return false});return F})();var B=function(){var E=A.showSearch?e(".subscribe-to-subcalendars-panel.search .spinner"):e(".subscribe-to-subcalendars-panel.popular .spinner");e(E).css("display","none")};var s=function(){var E=A.showSearch?e(".subscribe-to-subcalendars-panel.search .spinner"):e(".subscribe-to-subcalendars-panel.popular .spinner");e(E).css("display","inline-block")};var y=function(){B();t.destroy()};var q=function(F,E){s();k(v,e.extend({startIndex:F,pageSize:E},p.options.searchParams||{}),"/search/subcalendars/popular",y,function(){B()},true)};var z=function(G,F){var E=e("textarea[name='query']",e(".subscribe-to-subcalendars-panel.search")).val();s();k(v,e.extend({startIndex:G,pageSize:F,term:E,showSubscriberCount:true,showSubCalendarsInView:e("meta[name='ajs-page-id']").length>=1},p.options.searchParams||{}),"/search/subcalendars.json",y,function(){B()},true)};var t=null;function r(){if(t){t.destroy()}t=g.init({$el:e(".tc-subscription-result"),load:A.showSearch?z:q,$container:e(".subscribe-to-subcalendars-panel .tc-table-content"),body:e(".subscribe-to-subcalendars-panel .tc-subscription-result")[0],scrollMargin:30,isLoadMoreItems:A.showSearch?true:false})}var C=v.getCurrentPanel();var m=C.body;var w=function(){e(".subscribe-to-subcalendar-button","#internal-subscription-calendar-dialog").attr("disabled","disabled").addClass("ui-state-disabled")};var D=function(){e(".subscribe-to-subcalendar-button","#internal-subscription-calendar-dialog").removeAttr("disabled","disabled").removeClass("ui-state-disabled")};var i=function(){e(".watch-selected-subcalendars","#internal-subscription-calendar-dialog").disable()};var o=function(){e(".watch-selected-subcalendars","#internal-subscription-calendar-dialog").enable()};var l=function(){e(".spinner","#internal-subscription-calendar-dialog").removeClass("hidden")};var n=function(){e(".spinner","#internal-subscription-calendar-dialog").addClass("hidden")};var A=e.extend({heading:"Add Existing Team Calendar"},this.options);var u=C.page.header;u.empty().text(A.heading);if(A.showSearch){u.removeClass("welcome-heading-with-logo")}else{u.addClass("welcome-heading-with-logo")}if(Confluence.TeamCalendars.isPDLEnabled()){if(A.showSearch){m.removeClass("popular").addClass("search")}else{m.removeClass("search").addClass("popular")}}e(".results",m).empty();e(".mode",m).removeClass().addClass("mode"+(A.showSearch?"":" new-user"));var j=e(".watch-selected-subcalendars");i();if(p.callbackHandler.isAutoWatchSet()){j.attr("checked","checked")}else{j.removeAttr("checked")}w();i();if(A.showSearch){if(Confluence.TeamCalendars.isCalendarSearchDisabled){e("#tc-subscribe-no-search-warning",m).removeClass("hidden");e(".search",m).addClass("hidden");k(v,{},"/search/subcalendars/all",n,function(){e("#tc-subscribe-no-search-warning .spinner",m).addClass("hidden")})}e("input[name='query']",m).val("");e(".dialog-tip .show-popular",C.page.buttonpanel).removeClass("hidden");e(".dialog-tip .show-search",C.page.buttonpanel).addClass("hidden")}else{var x=e(".preamble",m).addClass("loading");var n=function(){x.removeClass("loading")};k(v,e.extend({startIndex:0,pageSize:10},p.options.searchParams||{}),"/search/subcalendars/popular",n,function(){n();r()});e(".dialog-tip .show-popular",C.page.buttonpanel).addClass("hidden");e(".dialog-tip .show-search",C.page.buttonpanel).removeClass("hidden")}p.subCalendarSubscibeDialog=v;v.show();return v}});return d});
}catch(e){WRMCB(e)};
;
try {
/* module-key = 'com.atlassian.confluence.extra.team-calendars:calendar-resources', location = 'com/atlassian/confluence/extra/calendar3/components/calendar-subcalendar-subscribe-dialog/calendar-subcalendar-subscribe-dialog-compat.js' */
require(["tc/calendar-subcalendar-subscribe-dialog"],function(a){if(!Confluence.TeamCalendars.Dialogs){Confluence.TeamCalendars.Dialogs={}}Confluence.TeamCalendars.Dialogs.getSubCalendarSubscribeDialog=function(b){return new a(b).render()}});
}catch(e){WRMCB(e)};
;
try {
/* module-key = 'com.atlassian.confluence.extra.team-calendars:calendar-resources', location = 'com/atlassian/confluence/extra/calendar3/js/add-from-macro-dialog.js' */
(function(a){Confluence.TeamCalendars.Dialogs.getAddDialogForMacro=function(d){var b=d.params?d.params.id:"";var c={isProcessingSubCalendar:function(){return false},setProcessingSubCalendar:function(e){},setSubCalendarSpinnerIconVisible:function(e){},getIncludedCalendars:function(){return b?b.split(","):[]},showAjaxUpdateError:function(e,g,f){Confluence.TeamCalendars.showAjaxError(a("#editor-messages"),e,g,f,"error-subcalendar-update")},showAjaxError:function(f,h,g,e){Confluence.TeamCalendars.showAjaxError(a("#editor-messages"),f,h,g,e)},setGenericErrors:function(f,e){Confluence.TeamCalendars.setGenericErrors(a("#editor-messages"),null,e)},setGenericUpdateError:function(){Confluence.TeamCalendars.setGenericErrors(a("#editor-messages"),null,"error-subcalendar-update")},setSubCalendars:function(e){if(!b){Confluence.TeamCalendars.fireEventForAnalytics("subcalendar.parent.embedded")}var f=e+(b?","+b:"");d.params=a.extend(d.params,{id:f});d.body="";AJS.Rte.BookmarkManager.restoreBookmark();var g=tinymce.confluence.MacroUtils.insertMacro({macro:d,contentId:Confluence.Editor.getContentId()});a.when(g).done(function(h){if(h){var i=new Confluence.TeamCalendars.HelpTip({body:"\u003ch3\u003eCalendar added, what next?\u003c/h3\u003e \u003cp\u003eEmbed additional calendars, or modify the look of them, by pressing \u003cstrong\u003e\'Edit\'\u003c/strong\u003e when selecting this.\u003c/p\u003e\u003cp\u003eWhen you are ready, save your page to start adding events!\u003c/p\u003e",anchor:a(h),id:"first-calendar-help-tip"});i.show()}})},setParameter:function(e,f){},getParameter:function(e){},reloadSubCalendar:function(e){},getSubCalendars:function(){return d.params},updateAvailableSubCalendarsInSubCalendarPanel:function(){},getNextCalendarColor:function(){return""},isAutoWatchSet:function(){return false},refreshCachedSubCalendars:function(f,e){},handleImport:function(e){this.setSubCalendars(e)},isCalendarInEditMode:function(){return true},suppressMessage:function(f,e){Confluence.TeamCalendars.suppressMessage(a("#editor-messages"),f,e)},showCalendarWizard:function(){Confluence.TeamCalendars.Dialogs.getAddDialog(c)},getSubCalendarsWhichCanAddEvents:function(){return[]}};if(Confluence.TeamCalendars.shouldShowTimezoneSetup()){Confluence.TeamCalendars.Dialogs.getTimeZoneSetupDialog(c).show()}else{AJS.Rte.BookmarkManager.storeBookmark();Confluence.TeamCalendars.Dialogs.getAddDialog(c,{title:"Insert Calendar"})}}}(AJS.$));
}catch(e){WRMCB(e)};
;
try {
/* module-key = 'com.atlassian.confluence.extra.team-calendars:calendar-resources', location = 'com/atlassian/confluence/extra/calendar3/js/calendar-edit-dialog.js' */
(function(a){Confluence.TeamCalendars.getEditCalendarDialogHelper=function(d,c,b){var h,g=a(".form-mode",d),f=a("input[name='spaceKey']",d),e=a("input[name='spaceKeyAutocomplete']",d);return{initSpaceDropDown:function(){e.keypress(function(i){if(i.which!==13){f.val(i.which)}});e.bind("selected.autocomplete-content",function(j,i){f.val(i.content.key);a(this).val(i.content.name);a(".spaceKeyAutocomplete-error",d).empty()})},initTimeZoneSelect:function(){a("select[name='timeZoneIdSelect']",d).change(function(){a("input[name='timeZoneId']",d).val(a("option:selected",this).val())})},initCloseButton:function(i,j){i.addLink("Cancel",function(){if(typeof j==="function"){j()}i.remove();return false})},initOkButton:function(i,j){j.addButton(i,function(){d.submit();return false},"submit");h=j.popup.element.find(".submit")},populateTimeZoneDropDown:function(j){var k=c?c.timeZoneId:Confluence.TeamCalendars.getUserTimeZone();var i=a("#timeZoneIdSelect",j.body);h.disable();Confluence.TeamCalendars.populateTimeZoneDropDown(i,k,function(){h.enable();i.addClass("ready")},function(l,n,m){b.showAjaxError(l,n,m)})},disableOkButton:function(i){h.text(i).attr("disabled","disabled").addClass("ui-state-disabled")},enableOkButton:function(i){h.text(i).removeAttr("disabled").removeClass("ui-state-disabled")},isNewCalendar:function(){return c?false:true},resetFieldErrors:function(){Confluence.TeamCalendars.setFieldErrors(d,null)},setFormModeEdit:function(){g.removeClass().addClass("form-mode edit")},setFormModeCreate:function(){g.removeClass().addClass("form-mode create")},setFormModeReadOnly:function(){g.removeClass().addClass("form-mode read-only")},setHeading:function(j,i){return i.getCurrentPanel().page.header.empty().text(j).addClass("calendar-heading")},setSubCalendarIdField:function(i){a("input[name='subCalendarId']",d).val(i)},setNameField:function(i){a("input[name='name']",d).val(i)},setDescriptionField:function(i){a("textarea[name='description']",d).val(i)},setColorField:function(i){a("input[name='color']",d).val(i)},setSpaceKeyField:function(i){f.val(i)},setSpaceKeyAutocompleteField:function(i){e.val(i)},setTimeZoneIdField:function(i){a("input[name='timeZoneId']",d).val(i)},setTimeZoneIdDisplayField:function(i){a(".timeZoneIdDisplay",d).text(i)},setSubscriptionIdField:function(i){a("input[name='subscriptionId']",d).val(i)},setLocationField:function(i){a("input[name='location']",d).val(i)},setUserNameField:function(i){a("input[name='username']",d).val(i)},setSpaceToDefault:function(){f.val(AJS.Meta.get("space-key")||"");e.val(AJS.Meta.get("space-name")||"")}}};Confluence.TeamCalendars.Dialogs.getSubCalendarCreateDialog=function(e,d){var i=require("tc/util"),c=(typeof e==="string")?e:e.type,f,h=Confluence.TeamCalendars.subcalendar[c],g=new AJS.ConfluenceDialog({width:h.dialogWidth||521,height:"auto",onSubmit:function(){f.submit();return false},id:"create-calendar-dialog"}),b=h.getDialog(g,a.isPlainObject(e)?e:null,d);g.popup.element.css("overflow","visible");f=b.initializeForm();f.submit(function(){if(d.isProcessingSubCalendar()){return false}d.setProcessingSubCalendar(true);var k=d.setSubCalendarSpinnerIconVisible(true);b.onSubmitStart();var j=b.getFormDataAsAjaxData();if(d.getIncludedCalendars()){j.include=d.getIncludedCalendars()}var l=j.subCalendarId;a.ajax({cache:false,converters:{"text json":function(m){return m}},data:j,dataFilter:function(m){var n=a.parseJSON(m);if(n.success){Confluence.TeamCalendars.mergeSubCalendarObjectsToArray(n.payload)}return n},dataType:"json",error:function(m,o,n){d.showAjaxUpdateError(m,o,n);b.onSubmitEnd();d.setProcessingSubCalendar(false)},success:function(n){d.setGenericUpdateError();if(n.success){Confluence.TeamCalendars.setFieldErrors(f,null);var m=l;if(m){d.setSubCalendars(l,n.payload);d.reloadSubCalendar(l)}else{l=n.modifiedSubCalendarId;a("input[name='subCalendarId']",f).val(l);d.setSubCalendars(l,n.payload)}d.updateAvailableSubCalendarsInSubCalendarPanel();b.onSubmitEnd();g.remove();if(!m){Confluence.TeamCalendars.CalendarTour().start(l)}}else{Confluence.TeamCalendars.setFieldErrors(f,n.fieldErrors);b.onSubmitEnd();if(!h.dynamicDialogHeight){i.showDialogInUpdatedHeight(g)}}d.setProcessingSubCalendar(false)},complete:function(){if(k){k.resolve()}},type:"PUT",timeout:Confluence.TeamCalendars.ajaxTimeout,url:Confluence.TeamCalendars.getCalendarServiceBaseUrl("/subcalendars.json")});return false});return g}}(AJS.$));
}catch(e){WRMCB(e)};
;
try {
/* module-key = 'com.atlassian.confluence.extra.team-calendars:calendar-resources', location = 'com/atlassian/confluence/extra/calendar3/js/calendar-plugin.js' */
define("tc/calendar-plugin",["jquery","underscore","ajs","tc/calendar-cache","tc/util","tc/calendar-util","tc/manage-event","tc/manage-i18n-text","tc/full-calendar-option","tc/subcalendar-panel","tc/auto-complete-search-helper","tc/calendar-remove-dialog","tc/calendar-feature-discovery-dialog","tc/calendar-share-dialog","tc/calendar-restriction-dialog","tc/myCalendarTour","tc/subcalendar-navigation-buttons-view","tc/subcalendar-restriction-button-view","tc/load-favicon"],function(f,u,k,n,h,l,i,t,p,g,s,j,e,d,a,r,c,b,m){var o=new n();var q={spinnerDeferTasks:[],ajaxTimeout:Confluence.TeamCalendars.ajaxTimeout,i18nMessages:null,dialogSequence:0,ERROR_CLASS_EVENT_UPDATE:"error-event-update",ERROR_CLASS_EVENT_DELETE:"error-event-delete",ERROR_CLASS_SUB_CALENDAR_LIST:"error-subcalendar-refresh",ERROR_CLASS_SUB_CALENDAR_DELETE:"error-subcalendar-delete",ERROR_CLASS_SUB_CALENDAR_UPDATE:"error-subcalendar-update",ERROR_CLASS_SUB_CALENDAR_WATCH:"error-subcalendar-watch",ERROR_CLASS_SUB_CALENDAR_LIST_EVENTS:"error-subcalendar-list-events-",ERROR_CLASS_SUB_CALENDAR_TOGGLE_EVENTS:"error-subcalendar-toggle-events-",ERROR_CLASS_CONFIG_UPDATE:"error-config-update",ERROR_CLASS_PRIVATE_URL:"error-private-url",ERROR_CLASS_RESET_PRIVATE_URLS:"error-reset-private-urls",PREF_LAST_ALL_DAY_USED:"pref-all-day-event-default",init:function(w){var v=new p(q,w,o);if(q.getParameter(w,"width")){w.parent().css("width",q.getParameter(w,"width")+"px")}if(q.getParameter(w,"height")){v.height=parseInt(q.getParameter(w,"height"))}else{v.aspectRatio=1.9}if(q.getParameter(w,"displayWeekNumber")){v.weekNumbers=(q.getParameter(w,"displayWeekNumber")==="true")}this.getCalendarPanel(w).fullCalendar(v);this.initCalendarDiv(w)},getEventTypeNames:function(v){return t(this.i18nMessages).getEventTypeNames(v)},getMonthNames:function(){return t(this.i18nMessages).getMonthNames()},getMonthNamesShort:function(){return t(this.i18nMessages).getMonthNamesShort()},getDayNames:function(){return t(this.i18nMessages).getDayNames()},getDayNamesShort:function(){return t(this.i18nMessages).getDayNamesShort()},hideInlineAuiDialogs:function(){f("body").trigger("click")},isEventToolTipSuppressed:function(v){return v.data("shouldSuppressEventToolTip")},setSuppressEventToolTip:function(w,v){w.data("shouldSuppressEventToolTip",v)},setEventTooltipVisible:function(y,x,v,z){if(z&&(this.isEventEditable(y,x)||x.workingUrl)){var w=f("body > .event-tooltip").length?f("body > .event-tooltip"):f("<div/>",{"class":"event-tooltip"}).appendTo(f("body"));f("p",w).remove();if(this.isEventEditable(y,x)){w.append(f("<p/>",{text:"Hold shift then click to bring up the edit dialog"}))}if(x.workingUrl){w.append(f("<p/>",{"class":"follow-hint",text:k.format("Control/Command + click to go to {0}",x.workingUrl)}))}w.css({left:v.pageX+"px",top:(v.pageY+5)+"px"}).show()}else{f("body > .event-tooltip").hide()}},getParameter:function(w,v){return l.getParameter(w,v)},getParameters:function(v){return l.getParameters(v)},setParameter:function(x,v,w){l.setParameter(x,v,w)},getCalendarPanel:function(v){return f(".calendar-panel .calendar",v)},getTimelineHeight:function(v){return q.getParameter(v,"timelineHeight")},getMaxMonthToDisplayTimelineCalendar:function(v){return q.getParameter(v,"maxMonthToDisplayTimelineCalendar")},getDefaultStartTime:function(v){return this.getParameter(v,"timeSuggestion")[16]},getDefaultEndTime:function(v){return this.getParameter(v,"timeSuggestion")[18]},reloadSubCalendar:function(v,w){if(!w){return}w=f.isArray(w)?w:[w];f(".sub-calendar-panel .subcalendar-item",v).each(function(){var E=f(this),A=E.data("subCalendarId"),z=f(".child-subcalendar",E),F=q.getSubCalendar(v,A),y=f.map(z,function(H){return f(H).data("subCalendarId")});if(f.inArray(A,w)!==-1){var D=function(I){for(var H=0;H<z.length;H++){if(f(z[H]).data("sub-calendar-id")===I){return !f(z[H]).hasClass("subcalendar-disabled")}}return false};if(Confluence.TeamCalendars.isSubscriptionSubCalendar(F)){o.removeCalendar(A);q.removeSubCalendarEventSource(v,A);q.addSubCalendarEventSource(v,A)}q.removeSubCalendarEventSource(v,f.map(y,function(H){o.removeCalendar(H);return H}));if(F.childSubCalendars!==undefined){var x=f.map(F.childSubCalendars,function(H){if(D(H.id)||!H.eventsHidden){return H.id}});q.addSubCalendarEventSource(v,x)}}else{var C=[];z.filter(function(){return f.inArray(f(this).data("subCalendarId"),w)!==-1}).each(function(){var H=f(this),I=H.data("subCalendarId");o.removeCalendar(I);if(H.hasClass("subcalendar-disabled")){H.removeClass("subcalendar-disabled")}else{q.removeSubCalendarEventSource(v,I)}q.addSubCalendarEventSource(v,I);C.push(I)});if(C.length){var G=C;var B=q.getSubCalendar(v,A);if(!l.isDummySubscriptionParentSubCalendar(B)){G.push(B.id)}q.setSubCalendarEventsHidden(v,G,false,E)}}})},makeAutoCompleteSearch:function(y,x,w,A,v,z){s.makeAutoCompleteSearch(y,x,w,A,v,z)},isProcessingEvent:function(v){return v.data("processingEvent")},setProcessingEvent:function(x,w,v){if(v){if(w){if(v.disableOkButton){v.disableOkButton()}}else{if(v.enableOkButton){v.enableOkButton()}}}x.data("processingEvent",w)},showAjaxError:function(w,y,A,z,v,x){if(!q.isPageUnloading){Confluence.TeamCalendars.showAjaxError(w,y,A,z,v,x)}},showHTMLGenericError:function(w,x,v){if(!q.isPageUnloading){Confluence.TeamCalendars.showHTMLGenericError(w,x,v)}},showRestrictedCalendarsWarning:function(v){f(".restricted-calendars-warning",v).removeClass("hidden")},deleteEvent:function(x,y,w,v){i(q,o).deleteEvent(x,y,w,v)},getCalendarServiceBaseUrl:function(w,v){return Confluence.TeamCalendars.getCalendarServiceBaseUrl(v)},getSubCalendars:function(x,y){var w=x.data("subCalendars")||[];if(y){var v=[];f.each(w,function(A,z){if(y(z)){v.push(z)}});return v}return w},isSubCalendarDeletable:function(w,v){return this.isCalendarInEditMode(w)&&v.deletable},isSubCalendarAdministratable:function(w,v){return this.isCalendarInEditMode(w)&&v.administrable},isSubCalendarEventsUpdatable:function(w,v){return this.isCalendarInEditMode(w)&&v.eventsEditable},canAddEventsToSubcalendar:function(w,v){return this.isSubCalendarEventsUpdatable(w,v)&&!Confluence.TeamCalendars.isJiraSubCalendar(v)},doesSubCalendarHaveRestrictions:function(v){return v.usersPermittedToView.length||v.groupsPermittedToView.length||v.usersPermittedToEdit.length||v.groupsPermittedToEdit.length},getSubCalendarsWhichCanAddEvents:function(v){return this.getSubCalendars(v,function(w){return q.canAddEventsToSubcalendar(v,w)})},getParentSubCalendar:function(x,w){var v=null;f.each(this.getSubCalendars(x),function(A,z){if(z.id===w){v=z;return false}else{var y=f.grep(z.childSubCalendars||[],function(B){return B.id==w});if((v=y&&y.length?z:null)){return false}}});return v},getSubCalendar:function(w,x){var v=null;f.each(this.getSubCalendars(w),function(z,y){if(y.id===x){v=y;return false}else{v=f.grep(y.childSubCalendars||[],function(A){return A.id==x});if((v=v&&v.length?v[0]:null)){return false}}});return v},getSanboxEventTypeRemindersFromSubCalendar:function(w,x){var v=this.getSubCalendar(w,x);if(v){return v.sanboxEventTypeReminders}},getCurrentReminderForEventType:function(A,z){var B=null;var y=z.getSelectedSubCalendarId();var w=z.getSelectedEventType();if(l.isCustomEventType(w)){var x=this.getCustomEventTypeFromSubCalendar(A,y);if(x){f.each(x,function(C,D){if(D.customEventTypeId===w&&D.periodInMins>0){B=D;return false}})}}else{var v=this.getSanboxEventTypeRemindersFromSubCalendar(A,y);if(v){f.each(v,function(C,D){if(D.eventTypeId===w||D.eventTypeId===w+"-calendar"){B=D;return false}})}}return B},getCustomEventTypeFromSubCalendar:function(w,x){var v=this.getSubCalendar(w,x);if(v){return v.customEventTypes}},setSubCalendar:function(z,y,x){var w=y.data("subCalendars");for(var v=0;v<w.length;v++){if(w[v].id===z){w[v]=f.isArray(x)?x[0]:x}}y.data("subCalendars",w)},setSubCalendars:function(w,v){if(l.isSpaceCalendarView(w)){v=u.filter(v,function(x){return x.eventsViewable||l.isDummySubscriptionParentSubCalendar(x)})}w.data("subCalendars",f.isArray(v)?v:(v?[v]:null))},showSubCalendarEdit:function(y,v){var z;if(Confluence.TeamCalendars.isJiraSubCalendar(v)){var A=Confluence.TeamCalendars.isInternalSubscriptionSubCalendar(v);z=Confluence.TeamCalendars.Dialogs.getEditEventDialog({title:A?v.sourceSubCalendar.name:v.name,eventType:(A?v.sourceSubCalendar.type:v.type)+"-calendar",subCalendarId:v.id},v,q,y).show()}else{var w=Confluence.TeamCalendars.Dialogs.getSubCalendarEditDialog(v,q.getRenderedMacroCallbackHandler(y),y,q,o);z=w.render();var x=z.getCurrentPanel().body;Confluence.TeamCalendars.setFieldErrors(x,null);z.show();z.gotoPanel(l.panelEditCalendar.GENERAL_PANEL);f("input[name='name']",x).focus();z.belongedView=w;if(r.isShowCustomEventTypeFrom(v.id)){w.showAddEventTypeForm()}if(!this.isSubCalendarAdministratable(y,v)){f(z.getPanel(l.panelEditCalendar.GENERAL_PANEL).button).addClass("hidden");f(z.getPanel(l.panelEditCalendar.EVENT_TYPE_PANEL).button).addClass("hidden");f(z.getPanel(l.panelEditCalendar.RESTRICTION_PANEL).button).addClass("hidden")}z.getCurrentPanel().onselect=function(){f("#edit-calendar-dialog").find(".button-panel-button.submit").removeClass("hidden")}}return z},showCustomEventEditForm:function(y,v,x,A){var z=this.showSubCalendarEdit(y,v);if(!(!Confluence.TeamCalendars.isInternalSubscriptionSubCalendar(v)&&Confluence.TeamCalendars.isJiraSubCalendar(v))){var w=z.belongedView;if(x){x=Confluence.TeamCalendars.isJiraType(x)?x+"-calendar":x;w.selectCustomEvent(x)}else{w.showAddEventTypeForm()}}z.gotoPanel(l.panelEditCalendar.EVENT_TYPE_PANEL);return z},updateCustomEventType:function(z,B,w){var A=this.getSubCalendars(z);for(var y=0;y<A.length;y++){if(A[y].id===B){var x=false;for(var v=0;v<A[y].customEventTypes.length;v++){if(A[y].customEventTypes[v].customEventTypeId===w.customEventTypeData){A[y].customEventTypes[v]=w;x=true;break}}if(!x){A[y].customEventTypes.push(w)}break}}z.data("subCalendars",A)},refreshCachedSubCalendars:function(y,v,w){var x={};if(q.getParameter(y,"include")){x.include=q.getParameter(y,"include")}l.putCalendarContextParams(x);f.ajax({cache:false,converters:{"text json":function(z){return z}},data:x,dataFilter:function(z){var A=f.parseJSON(z);if(A.success){q.mergeSubCalendarObjectsToArray(A.payload)}return A},dataType:"json",error:function(z,B,A){q.showAjaxError(y,z,B,A,q.ERROR_CLASS_SUB_CALENDAR_LIST);if(w){w(z,B,A)}},success:function(z){if(z.success){q.setSubCalendars(y,z.payload);if(v){v(z.payload)}q.setGenericErrors(y,null,q.ERROR_CLASS_SUB_CALENDAR_LIST)}else{q.setGenericErrors(y,"Uh oh. Looks like something unexpectedly went wrong. Please check the Confluence log file.",q.ERROR_CLASS_SUB_CALENDAR_LIST)}},type:"GET",timeout:q.ajaxTimeout,url:Confluence.TeamCalendars.getCalendarServiceBaseUrl("/subcalendars.json")})},mergeSubCalendarObjectsToArray:function(v){return Confluence.TeamCalendars.mergeSubCalendarObjectsToArray(v)},setGenericErrors:function(w,x,v){Confluence.TeamCalendars.setGenericErrors(w,x,v)},shouldShowFeatureDiscoveryDialog:function(v,w){return q.getParameter(v,"showCalendarDiscoveryDialog")==="true"},setSubCalendarEventsHidden:function(w,y,v,x){y=f.isArray(y)?y:y;return f.ajax({cache:false,data:{subCalendarId:y},dataType:"json",type:v?"PUT":"DELETE",error:function(z,B,A){f.each(y,function(C,D){q.showAjaxError(w,z,B,A,q.ERROR_CLASS_SUB_CALENDAR_TOGGLE_EVENTS+q.getStringAsHex(D))})},success:function(){f.each(y,function(z,A){q.getSubCalendar(w,A).eventsHidden=v;q.checkCalendarHasAllChildDisable(x);q.setGenericErrors(w,null,q.ERROR_CLASS_SUB_CALENDAR_TOGGLE_EVENTS+q.getStringAsHex(A))})},timeout:q.ajaxTimeout,url:q.getCalendarServiceBaseUrl(w,"/preferences/events/hidden.json")})},checkCalendarHasAllChildDisable:function(v){f(v).filter(function(){var w=f("li.child-subcalendar",v);var x=f("li.child-subcalendar:not(.subcalendar-disabled)",v);if(w.length!==0&&x.length===0){v.addClass("allchildsubcalendar-disabled").addClass("subcalendar-disabled")}else{v.removeClass("allchildsubcalendar-disabled").removeClass("subcalendar-disabled")}})},updateAvailableSubCalendarsInSubCalendarPanel:function(v){g(q,v,o).updateAvailableSubCalendarsInSubCalendarPanel()},unsubscribeFromSubcalendar:function(y,w){if(!q.isProcessingSubCalendar(y)){q.setProcessingSubCalendar(y,true);var v=q.setSubCalendarSpinnerIconVisible(y,true);var x=function(){if(v){v.resolve()}};if(w.subscriptionId){q._deleteSubCalendarInternal(y,w.id,function(z,B,A){q.showAjaxError(y,z,B,A,q.ERROR_CLASS_SUB_CALENDAR_DELETE);x();q.setProcessingSubCalendar(y,false)},function(z){if(z.success){q.setGenericErrors(y,null,q.ERROR_CLASS_SUB_CALENDAR_UPDATE);f.each(f.merge([w],w.childSubCalendars||[]),function(B,A){q.setGenericErrors(y,null,q.ERROR_CLASS_SUB_CALENDAR_LIST_EVENTS+q.getStringAsHex(A.id))});q.setGenericErrors(y,null,q.ERROR_CLASS_SUB_CALENDAR_DELETE);q.removeSubCalendarEventSource(y,w.id);q.removeSubCalendarEventSource(y,w.childSubCalendars);q.setSubCalendars(y,z.payload);q.updateAvailableSubCalendarsInSubCalendarPanel(y)}else{q.setGenericErrors(y,"Uh oh. Looks like something unexpectedly went wrong. Please check the Confluence log file.",q.ERROR_CLASS_SUB_CALENDAR_DELETE)}x();q.setProcessingSubCalendar(y,false)})}else{f.ajax({cache:false,converters:{"text json":function(z){return z}},data:(function(){var z={subCalendarId:w.id};if(q.getParameter(y,"include")){z.include=q.getParameter(y,"include")}l.putCalendarContextParams(z);return z})(),dataType:"json",dataFilter:function(z){var A=f.parseJSON(z);if(A.success){q.mergeSubCalendarObjectsToArray(A.payload)}return A},error:function(z,B,A){q.showAjaxError(y,z,B,A);q.setProcessingSubCalendar(y,false)},success:function(z){if(l.isSingleCalendarView(y)){window.location.href=k.contextPath()+"/display/"+encodeURIComponent(k.Meta.get("space-key"))+"/calendars"}else{q.setGenericErrors(y,null,q.ERROR_CLASS_SUB_CALENDAR_UPDATE);q.removeSubCalendarEventSource(y,w.id);q.removeSubCalendarEventSource(y,w.childSubCalendars);q.setSubCalendars(y,z.payload);q.updateAvailableSubCalendarsInSubCalendarPanel(y);q.setProcessingSubCalendar(y,false)}k.trigger("calendar.removed")},complete:function(){x()},type:"DELETE",timeout:q.ajaxTimeout,url:q.getCalendarServiceBaseUrl(y,"/subcalendars/preferences.json")})}}},getNextUnusedSubCalendarColor:function(A){var z=q.getSubCalendars(A);var y=q.getParameter(A,"subCalendarColorClass");for(var w=0;w<y.length;++w){var x=y[w];var B=false;for(var v=0;v<z.length;++v){if(x===z[v].color){B=true;break}}if(!B){return x}}return z.length?y[z.length%y.length]:"subcalendar-blue"},setProcessingSubCalendar:function(w,v){w.data("processingSubCalendar",v)},isProcessingSubCalendar:function(v){return v.data("processingSubCalendar")},getDeleteSubCalendarConfirmationDialog:function(x,v,w){var y=this.createDeleteSubCalendarConfirmationDialog(x,v,w);f("input[name='subCalendarId']",y.getCurrentPanel().body).val(v.id);return y},createDeleteSubCalendarConfirmationDialog:function(A,w,z){var x=new k.Dialog({height:290,width:550,id:"delete-calendar-dialog"});x.addHeader(Confluence.TeamCalendars.isJiraSubCalendar(w)?"Delete Event":"Delete Calendar");x.addPanel("Delete Calendar",Confluence.TeamCalendars.Templates.confirmRemoveSubCalendar({subCalendar:w,subscriberCount:z}),"delete-subcalendar-confirmation-panel");var y=x.getCurrentPanel().body;f("form.sub-calendar-delete-confirm",y).submit(function(){return false});var v=q.setSubCalendarSpinnerIconVisible(A,true);x.addButton(Confluence.TeamCalendars.isJiraSubCalendar(w)?"Delete Event":"Delete Calendar",function(){if(!q.isProcessingSubCalendar(A)){q.setProcessingSubCalendar(A,true);var B=q.getSubCalendar(A,f("input[name='subCalendarId']",y).val());q._deleteSubCalendarInternal(A,B.subscriptionId||B.id,function(C,E,D){q.showAjaxError(A,C,E,D,q.ERROR_CLASS_SUB_CALENDAR_DELETE);x.remove();v.resolve();q.setProcessingSubCalendar(A,false)},function(C){if(C.success){q.setGenericErrors(A,null,q.ERROR_CLASS_SUB_CALENDAR_UPDATE);f.each(f.merge([B],B.childSubCalendars||[]),function(E,D){q.setGenericErrors(A,null,q.ERROR_CLASS_SUB_CALENDAR_LIST_EVENTS+q.getStringAsHex(D.id))});q.setGenericErrors(A,null,q.ERROR_CLASS_SUB_CALENDAR_DELETE);q.removeSubCalendarEventSource(A,B.id);q.removeSubCalendarEventSource(A,B.childSubCalendars);q.setSubCalendars(A,C.payload);q.updateAvailableSubCalendarsInSubCalendarPanel(A)}else{q.setGenericErrors(A,"Uh oh. Looks like something unexpectedly went wrong. Please check the Confluence log file.",q.ERROR_CLASS_SUB_CALENDAR_DELETE)}x.remove();v.resolve();q.setProcessingSubCalendar(A,false)})}return false});x.addLink("Cancel",function(){x.remove();v.resolve();return false});return x},deleteSubCalendar:function(y,w){if(!q.isProcessingSubCalendar(y)){q.setProcessingSubCalendar(y,true);var v=q.setSubCalendarSpinnerIconVisible(y,true);var x={subCalendarId:w.subscriptionId||w.id};l.putCalendarContextParams(x);f.ajax({cache:false,data:x,dataType:"json",error:function(z,B,A){q.showAjaxError(y,z,B,A,q.ERROR_CLASS_SUB_CALENDAR_DELETE);q.setProcessingSubCalendar(y,false)},success:function(A){var D=y.data("subCalendarEditFormDialog");if(D){D.hide()}var E=q.getDeleteSubCalendarConfirmationDialog(y,w,A.subscriptionCount),B=E.getCurrentPanel().body,z=f(".calendar-to-delete",B);z.removeAttr("ThreeDots").empty().append(f(document.createElement("span")).addClass("ellipsis_text").text(w.name));q.setProcessingSubCalendar(y,false);var C=function(F){if(27===F.keyCode){q.setProcessingSubCalendar(y,false);v.resolve();f(document).unbind("keypress",C)}};f(document).keypress(C);E.show();z.ThreeDots()},complete:function(){if(v){v.resolve()}},type:"GET",timeout:q.ajaxTimeout,url:q.getCalendarServiceBaseUrl(y,"/subcalendars/links.json")})}},_deleteSubCalendarInternal:function(y,z,w,v){var x={subCalendarId:z};if(q.getParameter(y,"include")){x.include=q.getParameter(y,"include")}l.putCalendarContextParams(x);f.ajax({cache:false,converters:{"text json":function(A){return A}},data:x,dataFilter:function(A){var B=f.parseJSON(A);if(B.success){q.mergeSubCalendarObjectsToArray(B.payload)}return B},dataType:"json",error:function(A,C,B){if(w){w(A,C,B)}},success:function(A){if(l.isSingleCalendarView(y)){window.location.href=k.contextPath()+"/display/"+encodeURIComponent(k.Meta.get("space-key"))+"/calendars"}else{if(v){v(A)}}k.trigger("calendar.removed")},type:"DELETE",timeout:q.ajaxTimeout,url:q.getCalendarServiceBaseUrl(y,"/subcalendars.json")})},addSubCalendarEventSource:function(w,y){if(!y){return}var x=Confluence.TeamCalendars.getAsArray(y),v=w.data("visibleEventSources")||{};f.each(x,function(A,z){if(!v[z]){v[z]=q.getSubCalendarEventSource(w,z);q.getCalendarPanel(w).fullCalendar("addEventSource",v[z])}});w.data("visibleEventSources",v)},removeSubCalendarEventSource:function(w,y){if(!y){return}var x=Confluence.TeamCalendars.getAsArray(y),v=w.data("visibleEventSources")||{};f.each(x,function(A,z){if(v[z]){q.getCalendarPanel(w).fullCalendar("removeEventSource",v[z]);v[z]=null}});w.data("visibleEventSources",v)},isHttpsServer:function(v){return q.getParameter(v,"baseUrl").substring(5,0).toLowerCase()!="https"},getSubCalendarEventSource:function(y,z){var w=y.data("eventSources")||{},v=function(A,C){var B=A.data("retrieveEventsQueue")||{};if(!B[C]){B[C]=[]}A.data("retrieveEventsQueue",B);return B[C]},x=w[z]||function(B,I,E){if(!(isNaN(B.getTime())||isNaN(I.getTime()))){if(o.hasCalendar(z)&&o.getCalendarStart(z).getTime()<B.getTime()&&o.getCalendarEnd(z).getTime()>I.getTime()){var C=q.getEventsTruncated(y,o.getCalendarData(z));E(C);return}var K=v(y,z);for(var G=0;G<K.length;++G){var J=K.shift();if(!J.aborted&&J.xhr.readyState!==4){try{J.xhr.abort()}catch(F){}J.xhr.aborted=true}}var H=new Date(B.getTime()-(1000*60*60*24*30)),L=new Date(I.getTime()+(1000*60*60*24*30)),A={subCalendarId:z,userTimeZoneId:Confluence.TeamCalendars.getUserTimeZone(),start:f.fullCalendar.formatDate(H,"u"),end:f.fullCalendar.formatDate(L,"u")},D=q.getSubCalendars(y,function(O){if(!O.childSubCalendar){return false}var N=false;f.each(O.childSubCalendar,function(P,Q){if(Q.id===z){N=true;return false}});return N});if(D.length){A.parentSubCalendarId=D[0].id}var M=f.ajax({cache:false,data:A,dataType:"json",error:function(T,P,R){if(Confluence.TeamCalendars.isRequireOauth(T)){var O=f.parseJSON(T.responseText),U=f(".jira-calendars-oauth-warnings",y),N=O.oAuthUrl,V=f("div",U).filter(function(){return N===f(this).data("oAuthUrl")}),Q=function(){U.append(Confluence.TeamCalendars.Templates.requireOauthMessage({oAuthUrl:N,subCalendarIdsArrayJson:JSON.stringify([z]),subCalendarNamesArrayJson:JSON.stringify([O.subCalendarName]),subCalendarName:f("<div/>",{text:O.subCalendarName}).html()})).find(".approve-dance").click(function(){AppLinks.authenticateRemoteCredentials(O.oAuthUrl,function(){var X=f("div",U).filter(function(){return N===f(this).data("oAuthUrl")});q.reloadSubCalendar(y,X.data("subCalendarIds"));X.remove()},function(){alert("Approval unsuccessful. Could you please try again?")});return false})},W=function(){var Y=V.data("subCalendarIds");if(f.inArray(z,Y)===-1){Y.push(z)}var X=V.data("subCalendarNames");if(f.inArray(O.subCalendarName,X)===-1){X.push(O.subCalendarName)}f("span.subcalendar-names",V.data("subCalendarIds",Y).data("subCalendarNames",X)).text(X.join(", "))};if(!V.length){Q()}else{W()}}else{if(T.status==403){if(q.getParameter(y,"showHiddenSubCalendars")==="true"){q.showRestrictedCalendarsWarning(y)}else{if(!l.isSpaceCalendarView(y)){q.showAjaxError(y,T,P,R,q.ERROR_CLASS_SUB_CALENDAR_LIST_EVENTS+q.getStringAsHex(z))}}}else{if(P!=="abort"){var S=q.getSubCalendar(y,z);q.showAjaxError(y,T,P,R,q.ERROR_CLASS_SUB_CALENDAR_LIST_EVENTS+q.getStringAsHex(z),S);f(y).find("#calendar-change-jql").click(function(){var Y=this;var Z=f(Y).parent().data("jiraCalendarId");if(Z){var X=q.getSubCalendar(y,Z);if(X&&X.eventsEditable){q.showSubCalendarEdit(y,X);f("#edit-calendar-dialog").find(".button-panel-button.submit").removeClass("hidden")}}})}}}E([])},success:function(P,O){var T=P.events;var S=[];q.setGenericErrors(y,null,q.ERROR_CLASS_SUB_CALENDAR_LIST_EVENTS+q.getStringAsHex(z));T=f.map(T||[],function(V){if(V.className==="greenhopper-sprint"&&!V.allDay){V.allDay=!V.allDay;V.allDayFlipped=true}return V});if(O==="success"&&T){S=q.getEventsTruncated(y,T)}E(S);o.addDataToCalendar(z,S,H,L);var R=q.getSubCalendar(y,z);if(R.warnings&&R.warnings.length){q.setGenericErrors(y,R.warnings,q.ERROR_CLASS_SUB_CALENDAR_LIST_EVENTS+q.getStringAsHex(z))}var U=q.getParameter(y,"editSubCalendarId"),N=q.getParameter(y,"editEventUid");if(U&&N){var Q=q.getCalendarPanel(y).fullCalendar("clientEvents",function(V){return V.subCalendarId===U&&V.id===N});if(Q.length){q.setParameter(y,"editSubCalendarId","");q.setParameter(y,"editEventUid","");f("#calendar-dialog-panel").remove();Confluence.TeamCalendars.Dialogs.getEditEventDialog(Q[0],R,q,y).show()}}},type:"GET",timeout:q.ajaxTimeout,url:q.getCalendarServiceBaseUrl(y,"/events.json")});K.push({xhr:M})}};w[z]=x;y.data("eventSources",w);return x},getEventsTruncated:function(B,w,K){var L=this.getCalendarPanel(B).fullCalendar("getView");var C=parseInt(this.getParameter(B,"maxEventsToDisplayPerCalendar"));var z={};f.each(w,function(O,N){if(!z[N.subCalendarId]){z[N.subCalendarId]=[]}z[N.subCalendarId].push(N)});var A=function(N){N.sort(function(P,R){var O=P._start||f.fullCalendar.parseISO8601(P.start,true);var Q=R._start||f.fullCalendar.parseISO8601(R.start,true);return O.getTime()-Q.getTime()})};var I=function(R,P,O){A(R);var N;var Q=-1;f.each(R,function(U,T){var S=T._start||f.fullCalendar.parseISO8601(T.start,true);if(S>=P){Q=U;return false}});if(-1===Q){N=R.slice(-C)}else{N=R.slice(Q,Math.min(Q+C,R.length))}D.push(q.getParentSubCalendar(B,R[0].subCalendarId).name);return N};var D=[];var F={};f.each(z,function(R,Q){var P=L.visStart;var O=L.visEnd;var N=[];f.each(Q,function(V,T){var S=T._start||f.fullCalendar.parseISO8601(T.start,true);var U=T._end||(T.end?f.fullCalendar.parseISO8601(T.end,true):S);if((S>=P&&S<=O)||(U>=P&&U<=O)){N.push(T)}if(N.length>C){N=I(Q,P,O);return}});F[R]=N});if(D.length){var E=f(".events-truncated-message-container",B);var M=function(N){N.sort(function(P,O){return P>O?1:(O>P?-1:0)})};var J=function(O){var N=f(document.createElement("ul"));f.each(O,function(P,Q){N.append(f(document.createElement("li")).text(Q))});return N};var y;if(K){M(D);y=J(D)}else{var x=[];var H=f.map(f("ul li",E),function(N){return f(N).text()});var G=f.map(this.getSubCalendars(B),function(N){return N.name});f.each(H,function(O,N){if(f.inArray(N,G)>-1){x.push(N)}});f.each(D,function(N,O){if(-1===f.inArray(O,x)){x.push(O)}});M(x);y=J(x)}k.messages.warning(E.empty(),{title:"Some events were not shown in the calendars below because there were too many of them",body:f(document.createElement("div")).append(y).html()});r.start();var v=[];f.each(F,function(O,N){f.merge(v,N)});return v}else{return w}},isCalendarInEditMode:function(v){return this.getParameter(v,"readOnly")!=="true"},isEventEditable:function(w,v){return this.isCalendarInEditMode(w)&&this.isSubCalendarEventsUpdatable(w,this.getSubCalendar(w,v.subCalendarId))&&v.editable},isEventDeletable:function(x,w){var v=q.getSubCalendar(x,w.subCalendarId);return q.isEventEditable(x,w)&&!Confluence.TeamCalendars.isJiraSubCalendar(v)},getEventDetailsDialog:function(y,w,x,v){return i(q,o).getEventDetailsDialog(y,w,x,v)},updateEvent:function(y,x,w,v){i(q,o).updateEvent(y,x,w,v)},setSubCalendarSpinnerIconVisible:function(y,A){var v=f.Deferred();var w=this;this.spinnerDeferTasks.push(v.promise());var x=function(B){var C=f(".calendar-panel .right-controls .spinner, .calendar-toolbar .spinner",y);if(B){C.removeClass("invisible")}else{C.addClass("invisible")}w._toggleEnableButton(f(".page-prev",y),!B);w._toggleEnableButton(f(".page-next",y),!B)};if(A){x(A)}f.when.apply(f,this.spinnerDeferTasks).done(function(){x(false);this.spinnerDeferTasks=[]});var z=setTimeout(function(){v.resolve()},10*1000);return{resolve:function(){v.resolve();clearTimeout(z)}}},_toggleEnableButton:function(w,v){w.attr("aria-disabled",!v);if(v){w.removeAttr("disabled")}else{w.attr("disabled","disabled")}},reloadSubCalendarDisableEvent:function(y,x){if(x.uid&&(x.originalEventType!==x.eventType||x.originalSubCalendarId!==x.subCalendarId)){var w=q.getSubCalendar(y,x.subCalendarId).disableEventTypes;for(var v=0;v<w.length;v++){if(w[v]===x.eventType){w.splice(v,1);break}}q.getSubCalendar(y,x.subCalendarId).disableEventTypes=w}},initCalendarToolbar:function(w){var v=this;f(".feedback-form-trigger",w).click(function(){var y=new k.Dialog(700,512);y.addHeader("Team Calendars Plugin Feedback");y.addPanel("","<div class='loading-message'></div><iframe src='https://atlassian.wufoo.com/forms/team-calendars-feedback/' frameborder='0'></iframe>","calendar-feedback-dialog-panel");var x=y.getCurrentPanel().body;var z=f(".loading-message",x).text("Loading...");f("iframe",x).load(function(){z.remove()});y.addCancel("Cancel",function(){y.hide();return false});y.show();return false});f(".change-view",w).click(function(){v.hideInlineAuiDialogs();var x=f(this);q.getCalendarPanel(w).fullCalendar("changeView",x.data("viewName"));var y=l.getCalendarContext(w);Confluence.TeamCalendars.fireEventForAnalytics("view."+x.data("analyticsViewName")+".render."+y);return false});f(".today",w).click(function(){v.hideInlineAuiDialogs();o.removeAllCalendars();q.getCalendarPanel(w).fullCalendar("today");return false});f(".page-prev",w).click(function(){v.hideInlineAuiDialogs();var x=q.getCalendarPanel(w);delete x.fullCalendar("getView").daysMore;if(x.fullCalendar("getView").name==="basicDay"){x.fullCalendar("incrementDate",0,0,-parseInt(q.getParameter(w,"maxUpcomingDays")))}else{x.fullCalendar("prev")}return false});f(".page-next",w).click(function(){v.hideInlineAuiDialogs();var x=q.getCalendarPanel(w);delete x.fullCalendar("getView").daysMore;if(x.fullCalendar("getView").name==="basicDay"){x.fullCalendar("incrementDate",0,0,parseInt(q.getParameter(w,"maxUpcomingDays")))}else{x.fullCalendar("next")}return false})},getStringAsHex:function(w){var y="";if(w){var v=w.length;for(var z=0;z<v;++z){var x=w.charCodeAt(z);y+=x.length>1?x:"0"+x}}return y},formatDate:function(A,x,z,w){if(w){var v=f.isArray(x);if(v&&!x.length){w();return}var y={date:f.map(v?x:[x],function(B){return f.fullCalendar.formatDate(B,"ddMMyyyyHHmm")}),pattern:z};f.ajax({cache:false,data:y,dataType:"json",error:function(){w(k.format("Unable to format date/time {0}",y.date.join(", ")))},success:function(B){w(v?B:B[0])},timeout:q.ajaxTimeout,url:q.getCalendarServiceBaseUrl(A,"/util/format/date.json")})}},initWhatsNew:function(x){var w=f(".whatsnew");if(w.length){w.removeClass("hidden");var v=function(y){Confluence.TeamCalendars.suppressMessage(x,"MESSAGE_KEY_PREFIX_WHATSNEW_"+q.getParameter(x,"pluginVersion"),function(){if(f.isFunction(y)){y()}})};f("button",w).click(function(){window.open(f(this).data("url"),"_blank");return false});f(".aui-iconfont-close-dialog",w).click(function(){v(function(){w.addClass("hidden")})})}},initButtons:function(v){new c({el:"#navigation",calendarDiv:v,CalendarPlugin:this}).render();new b({el:"#calendar-restriction-buttons",calendarDiv:v,CalendarPlugin:this})},getSubCalendarRestrictionsDialog:function(x,v){var y=this.showSubCalendarEdit(x,v);var w=y.belongedView;w.showRestrictionOption();return y},removeSubCalendarDialog:function(x,v){var w=new j({calendarPlugin:this,calendarDiv:x,subCalendar:v});w.render()},getSubCalendarFeatureDiscoveryDialog:function(x,v){var w=new e({calendarPlugin:this,calendarDiv:x,subCalendar:v});return{show:function(){w.render()}}},isAutoConvertSupported:function(v){return this.getParameter(v,"autoConvertSupported")==="true"},getSubCalendarShareDialog:function(x,v){var y=this.showSubCalendarEdit(x,v);var w=y.belongedView;w.showShareOption();return y},getSubCalendarIcalAddressDialog:function(x,v){var y=this.showSubCalendarEdit(x,v);var w=y.belongedView;w.showSubscriptionOption();return y},initCalendarDiv:function(w){var v=q.getRenderedMacroCallbackHandler(w);this.initCalendarToolbar(w);g(q,w).initSubCalendarPanel();this.initWhatsNew(w);this.initButtons(w);f(document).keydown(function(x){if(x.keyCode===27){q.getCalendarPanel(w).fullCalendar("unselect")}});if(Confluence.TeamCalendars.shouldShowTimezoneSetup()){Confluence.TeamCalendars.Dialogs.getTimeZoneSetupDialog(v).show()}else{v.showCalendarWizard()}},getRenderedMacroCallbackHandler:function(v){return{isProcessingSubCalendar:function(){return q.isProcessingSubCalendar(v)},setProcessingSubCalendar:function(w){return q.setProcessingSubCalendar(v,w)},setSubCalendarSpinnerIconVisible:function(w){return q.setSubCalendarSpinnerIconVisible(v,w)},getIncludedCalendars:function(){return q.getParameter(v,"include")},mergeSubCalendarObjectsToArray:function(w){return q.mergeSubCalendarObjectsToArray(w)},showAjaxUpdateError:function(w,y,x){q.showAjaxError(v,w,y,x,q.ERROR_CLASS_SUB_CALENDAR_UPDATE)},showAjaxError:function(x,z,y,w){q.showAjaxError(v,x,z,y,w)},showHTMLGenericError:function(x,y,w){q.showHTMLGenericError(x,y,w)},setGenericUpdateError:function(){q.setGenericErrors(v,null,q.ERROR_CLASS_SUB_CALENDAR_UPDATE)},setGenericErrors:function(x,w){Confluence.TeamCalendars.setGenericErrors(v,null,w)},setParameter:function(w,x){q.setParameter(v,w,x)},getParameter:function(w){return q.getParameter(v,w)},setSubCalendar:function(x,w){q.setSubCalendar(x,v,w)},setSubCalendars:function(w,x){q.setSubCalendars(v,x)},reloadSubCalendar:function(w){q.reloadSubCalendar(v,w)},getSubCalendars:function(){return q.getSubCalendars(v)},updateAvailableSubCalendarsInSubCalendarPanel:function(){q.updateAvailableSubCalendarsInSubCalendarPanel(v)},refreshCalendarInfo:function(w){if(l.isSingleCalendarView(v)&&w.length){f("#title-text span").text(w[0].name);f(".calendar-description p").text(w[0].description)}},shouldShowFeatureDiscoveryDialog:function(w){return q.shouldShowFeatureDiscoveryDialog(v,w)},getSubCalendarFeatureDiscoveryDialog:function(w){q.getSubCalendarFeatureDiscoveryDialog(v,q.getSubCalendar(v,w)).show()},getNextCalendarColor:function(){return q.getNextUnusedSubCalendarColor(v)},isAutoWatchSet:function(){return q.getParameter(v,"autowatch")==="true"},refreshCachedSubCalendars:function(w,x){q.refreshCachedSubCalendars(v,w,x)},handleImport:function(w){this.refreshCachedSubCalendars(function(){q.updateAvailableSubCalendarsInSubCalendarPanel(v);if(q.shouldShowFeatureDiscoveryDialog(v)){q.getSubCalendarFeatureDiscoveryDialog(v,q.getSubCalendar(v,w)).show()}},function(x,z,y){q.showAjaxError(v,x,z,y,q.ERROR_CLASS_SUB_CALENDAR_UPDATE)});r.start(w)},isCalendarInEditMode:function(){return q.isCalendarInEditMode(v)},suppressMessage:function(x,w){Confluence.TeamCalendars.suppressMessage(v,x,w)},showCalendarWizard:function(){var y=function(){Confluence.TeamCalendars.Dialogs.getSubCalendarSubscribeDialog({heading:"Welcome to Team Calendars!",callbackHandler:q.getRenderedMacroCallbackHandler(v),id:"welcome-to-popular-dialog"}).show()};var w=function(){Confluence.TeamCalendars.Dialogs.getAddDialog(q.getRenderedMacroCallbackHandler(v),{title:"Welcome to Team Calendars!",addClass:"create-calendar-first-time"})};var x=k.Meta.get("space-key")?(l.getParamsFromUrl()["openAddCalDialog"]==="true"):false;if(x){if(l.isValidLicense()){w()}}else{if("true"===q.getParameter(v,"isShowCalendarWizard")){Confluence.TeamCalendars.showCalendarPopupHaveAnEmptySubcalendar(y,w)}}},getSubCalendarsWhichCanAddEvents:function(){return q.getSubCalendarsWhichCanAddEvents(v)},updateCustomEventType:function(x,w){q.updateCustomEventType(v,x,w)}}},onTeamCalendarsLoaded:function(){if(f(".user-calendar, .space-calendar").length>0){m.render()}f("div.plugin-calendar:not(.init-started)").each(function(){var A=f(this);A.addClass("init-started");var y=f("#team-calendars-display-week-number").attr("content");q.setParameter(A,"displayWeekNumber",y);if(!q.getParameter(A,"defaultView")){var w=q.getCalendarPanel(A).text("Loading...");f.ajax({cache:false,dataType:"json",error:function(){w.empty();q.init(A)},success:function(B){q.setParameter(A,"defaultView",B.view==="agendaDay"?"basicDay":B.view);w.empty();q.init(A)},timeout:q.ajaxTimeout,url:q.getCalendarServiceBaseUrl(A,"/preferences.json")})}else{var z=A.closest(".dashboard-calendar-container");if(z){var x=setInterval(function(){q.init(A);clearInterval(x)},100)}else{q.init(A)}}});var v=f(".ia-splitter-handle-highlight");v.mousedown(function(){v.on("mousemove",function(){f(window).trigger("resize")})}).mouseup(function(){f(window).trigger("resize");v.off("mousemove")});f(".expand-collapse-trigger").click(function(){f(window).trigger("resize")})}};f(function(){q.isPageUnloading=false;k.$(window).bind("beforeunload",function(){q.isPageUnloading=true});f(document).keydown(function(v){var w=true;f(".aui-inline-dialog:visible:first .event-details-popup").each(function(){if(v.keyCode===8||v.keyCode===46){f(".event-delete",this).click();w=false}});return w});f("body").keyup(function(v){if((v.keyCode?v.keyCode:v.which)===219){f(window).trigger("resize")}})});return q});
}catch(e){WRMCB(e)};
;
try {
/* module-key = 'com.atlassian.confluence.extra.team-calendars:calendar-resources', location = 'com/atlassian/confluence/extra/calendar3/js/child-subcalendars.js' */
(function(a){if(!window.Confluence.TeamCalendars.subcalendar){window.Confluence.TeamCalendars.subcalendar={}}window.Confluence.TeamCalendars.subcalendar.other={getDialog:function(){AJS.log("Tried to call getDialog on child calendar type. This should not happen.")},weight:1,typeName:"Events Calendars"};window.Confluence.TeamCalendars.subcalendar.travel=a.extend({},window.Confluence.TeamCalendars.subcalendar.other,{weight:2,typeName:"Travel"});window.Confluence.TeamCalendars.subcalendar.leaves=a.extend({},window.Confluence.TeamCalendars.subcalendar.other,{weight:3,typeName:"Leave"});window.Confluence.TeamCalendars.subcalendar.birthdays=a.extend({},window.Confluence.TeamCalendars.subcalendar.other,{weight:4,typeName:"Birthdays"});window.Confluence.TeamCalendars.subcalendar["jira-agile-sprint"]=a.extend({},window.Confluence.TeamCalendars.subcalendar.other,{weight:6,typeName:"JIRA Agile Sprints"});window.Confluence.TeamCalendars.subcalendar["jira-project-releases"]=a.extend({},window.Confluence.TeamCalendars.subcalendar.other,{weight:7,typeName:"JIRA Project Releases"});window.Confluence.TeamCalendars.subcalendar["jira-issue-dates"]=a.extend({},window.Confluence.TeamCalendars.subcalendar.other,{weight:8,typeName:"JIRA Issue Dates"});window.Confluence.TeamCalendars.subcalendar.custom=a.extend({},window.Confluence.TeamCalendars.subcalendar.other,{weight:9,typeName:"custom_name"})})(AJS.$);
}catch(e){WRMCB(e)};
;
try {
/* module-key = 'com.atlassian.confluence.extra.team-calendars:calendar-resources', location = 'com/atlassian/confluence/extra/calendar3/js/parent-subcalendar.js' */
(function(b){if(!window.Confluence.TeamCalendars.subcalendar){window.Confluence.TeamCalendars.subcalendar={}}if(!window.Confluence.TeamCalendars.subcalendar.parent){var a=require("tc/calendar-util");window.Confluence.TeamCalendars.subcalendar.parent={getDialog:function(g,d,c){var e,f;var h=function(){var k=g.getCurrentPanel();f.resetFieldErrors();f.populateTimeZoneDropDown(k);var j=b("select[name='timeZoneIdSelect']",e);if(f.isNewCalendar()){f.setFormModeCreate();f.setHeading("Create Calendar",g);f.setSubCalendarIdField("");f.setNameField("");f.setDescriptionField("");f.setColorField(c.getNextCalendarColor());f.setSpaceToDefault();f.setTimeZoneIdField("")}else{f.setFormModeEdit();f.setHeading(d.name,g);f.setSubCalendarIdField(d.id);f.setNameField(d.name);f.setDescriptionField(d.description);f.setColorField(d.color);f.setSpaceKeyField(d.spaceKey);f.setSpaceKeyAutocompleteField(d.spaceName);f.setTimeZoneIdField(d.timeZoneId)}var l=b("input[name='name'], textarea[name='description'], input[name='spaceKeyAutocomplete']",e);if(c.isCalendarInEditMode()){l.removeAttr("readonly");j.removeAttr("disabled")}else{f.setFormModeReadOnly();l.attr("readonly","readonly");j.attr("disabled","disabled")}if(f.isNewCalendar()&&AJS.Meta.get("space-key")){var i=b(".field-group-space-permission",e);i.addClass("hidden")}};return{initializeForm:function(i){g.addHeader("Create Calendar");g.addPanel("General",Confluence.TeamCalendars.Templates.editLocalCalendar(),"calendar-dialog-panel create-calendar-dialog");e=b("form.sub-calendar-edit-form",g.getCurrentPanel().body);f=Confluence.TeamCalendars.getEditCalendarDialogHelper(e,d,c);f.initSpaceDropDown();f.initTimeZoneSelect();f.initOkButton("OK",g);f.initCloseButton(g,i);h();return e},getFormDataAsAjaxData:function(){var i={type:"parent",subCalendarId:b("input[name='subCalendarId']",e).val(),name:b("input[name='name']",e).val(),description:b("textarea[name='description']",e).val(),color:b("input[name='color']",e).val(),spaceKey:b("input[name='spaceKeyAutocomplete']",e).val()?b("input[name='spaceKey']",e).val():"",timeZoneId:b("input[name='timeZoneId']",e).val()||b("select[name='timeZoneIdSelect'] option:selected",e).val()};a.putCalendarContextParams(i);return i},onSubmitStart:function(){f.disableOkButton("Adding...")},onSubmitEnd:function(){f.enableOkButton("OK")}}},weight:1,typeName:"Calendars"}}})(jQuery);
}catch(e){WRMCB(e)};
;
try {
/* module-key = 'com.atlassian.confluence.extra.team-calendars:calendar-resources', location = 'com/atlassian/confluence/extra/calendar3/js/jira-subcalendar.js' */
(function(a){if(!window.Confluence.TeamCalendars.subcalendar){window.Confluence.TeamCalendars.subcalendar={}}if(!window.Confluence.TeamCalendars.subcalendar.jira){window.Confluence.TeamCalendars.subcalendar.jira={weight:5,typeName:"JIRA Calendars",getDialog:function(){AJS.log("Confluence.TeamCalendars.subcalendar.jira.should never be called")}}}})(AJS.$);
}catch(e){WRMCB(e)};
;
try {
/* module-key = 'com.atlassian.confluence.extra.team-calendars:calendar-resources', location = 'com/atlassian/confluence/extra/calendar3/js/subscription-subcalendar.js' */
(function(b){if(!window.Confluence.TeamCalendars.subcalendar){window.Confluence.TeamCalendars.subcalendar={}}if(!window.Confluence.TeamCalendars.subcalendar.subscription){var a=require("tc/calendar-util");window.Confluence.TeamCalendars.subcalendar.subscription={getDialog:function(g,d,c){var f,e;var h=function(){f.resetFieldErrors();var j=function(){return b(document.createElement("div")).addClass("calendar-dialog-help-link").append(b(document.createElement("a")).attr("href","http://confluence.atlassian.com/x/YQ1cDg").attr("target","_blank").text("Help"))};if(f.isNewCalendar()){f.setFormModeCreate();f.setHeading("Subscribe",g).append(j());f.setSubCalendarIdField("");f.setNameField("");f.setDescriptionField("");f.setColorField(c.getNextCalendarColor());f.setSpaceToDefault();f.setLocationField("");f.setUserNameField("");f.setTimeZoneIdDisplayField("")}else{f.setFormModeEdit();f.setHeading(d.name,g).append(j());f.setSubCalendarIdField(d.id);f.setNameField(d.name);f.setDescriptionField(d.description);f.setColorField(d.color);f.setSpaceKeyField(d.spaceKey);f.setSpaceKeyAutocompleteField(d.spaceName);f.setLocationField(d.sourceLocation);f.setUserNameField(d.userName||"");f.setTimeZoneIdDisplayField(d.timeZoneId)}var k=b("input[name='name'], textarea[name='description'], input[name='spaceKeyAutocomplete'], input[name='location'], input[name='username'], input[name='password']",e);if(c.isCalendarInEditMode()){k.removeAttr("readonly")}else{f.setFormModeReadOnly();k.attr("readonly","readonly")}if(AJS.Meta.get("space-key")){var i=b(".field-group-space-permission",e);i.css("display","none")}};return{initializeForm:function(){g.addHeader("Subscribe");g.addPanel("General",Confluence.TeamCalendars.Templates.editSubscriptionSubcalendar(),"calendar-dialog-panel subscribe-dialog");e=b("form.sub-calendar-edit-form",g.getCurrentPanel().body);f=Confluence.TeamCalendars.getEditCalendarDialogHelper(e,d,c);f.initSpaceDropDown();f.initOkButton("Subscribe",g);f.initCloseButton(g);h();return e},getFormDataAsAjaxData:function(){var i={type:"subscription",subCalendarId:b("input[name='subCalendarId']",e).val(),name:b("input[name='name']",e).val(),description:b("textarea[name='description']",e).val(),color:b("input[name='color']",e).val(),spaceKey:!!b("input[name='spaceKeyAutocomplete']",e).val()?b("input[name='spaceKey']",e).val():"",location:b("input[name='location']",e).val(),userName:b("input[name='username']",e).val(),password:b("input[name='password']",e).val()};a.putCalendarContextParams(i);return i},onSubmitStart:function(){f.disableOkButton("Subscribing")},onSubmitEnd:function(){f.enableOkButton("Subscribe")}}},weight:6,typeName:"Subscriptions"}}})(jQuery);
}catch(e){WRMCB(e)};
;
try {
/* module-key = 'com.atlassian.confluence.extra.team-calendars:calendar-resources', location = 'com/atlassian/confluence/extra/calendar3/js/remove-jira-events-dialog.js' */
(function(a){Confluence.TeamCalendars.getRemoveJiraEventsDialog=function(f,e,c){var b;b=new AJS.Dialog(400,250);b.addHeader("Remove JIRA events?");b.addPanel("",Confluence.TeamCalendars.Templates.confirmRemoveJiraEvents({childName:c.name,parentName:f.getSubCalendar(e,c.parentId).name}),"remove-jira-events-confirmation-panel");b.addButton("Remove",function(){d();b.remove()});b.addCancel("Cancel",function(){b.remove()});b.show();function d(){var g=f.setSubCalendarSpinnerIconVisible(e,true);var h=function(){if(g){g.resolve()}};f.setProcessingSubCalendar(e,true);f._deleteSubCalendarInternal(e,c.subscriptionId||c.id,function(i,k,j){f.showAjaxError(e,i,k,j,f.ERROR_CLASS_SUB_CALENDAR_DELETE);h();f.setProcessingSubCalendar(e,false)},function(i){f.removeSubCalendarEventSource(e,c.id);f.setSubCalendars(e,i.payload);f.updateAvailableSubCalendarsInSubCalendarPanel(e);h();f.setProcessingSubCalendar(e,false)})}}}(AJS.$));
}catch(e){WRMCB(e)};
;
try {
/* module-key = 'com.atlassian.confluence.extra.team-calendars:calendar-resources', location = 'com/atlassian/confluence/extra/calendar3/templates/timezone-drop-down.soy' */
// This file was automatically generated from timezone-drop-down.soy.
// Please don't edit this file by hand.

/**
 * @fileoverview Templates in namespace Confluence.TeamCalendars.Templates.
 */

if (typeof Confluence == 'undefined') { var Confluence = {}; }
if (typeof Confluence.TeamCalendars == 'undefined') { Confluence.TeamCalendars = {}; }
if (typeof Confluence.TeamCalendars.Templates == 'undefined') { Confluence.TeamCalendars.Templates = {}; }


Confluence.TeamCalendars.Templates.timeZoneDropDown = function(opt_data, opt_ignored) {
  var output = '';
  var timeZoneList3 = opt_data.timeZones;
  var timeZoneListLen3 = timeZoneList3.length;
  for (var timeZoneIndex3 = 0; timeZoneIndex3 < timeZoneListLen3; timeZoneIndex3++) {
    var timeZoneData3 = timeZoneList3[timeZoneIndex3];
    output += '<option value=' + soy.$$escapeHtml(timeZoneData3.name) + '>' + soy.$$escapeHtml(timeZoneData3.name) + ' (' + soy.$$escapeHtml(timeZoneData3.offset) + ')</option>';
  }
  return output;
};
if (goog.DEBUG) {
  Confluence.TeamCalendars.Templates.timeZoneDropDown.soyTemplateName = 'Confluence.TeamCalendars.Templates.timeZoneDropDown';
}

}catch(e){WRMCB(e)};
;
try {
/* module-key = 'com.atlassian.confluence.extra.team-calendars:calendar-resources', location = 'com/atlassian/confluence/extra/calendar3/templates/subcalendar-panel-entry.soy' */
// This file was automatically generated from subcalendar-panel-entry.soy.
// Please don't edit this file by hand.

/**
 * @fileoverview Templates in namespace Confluence.TeamCalendars.Templates.
 */

if (typeof Confluence == 'undefined') { var Confluence = {}; }
if (typeof Confluence.TeamCalendars == 'undefined') { Confluence.TeamCalendars = {}; }
if (typeof Confluence.TeamCalendars.Templates == 'undefined') { Confluence.TeamCalendars.Templates = {}; }


Confluence.TeamCalendars.Templates.subCalendarPanelEntry = function(opt_data, opt_ignored) {
  return '<div class="subcalendar-item " data-sub-calendar-id="' + soy.$$escapeHtml(opt_data.subCalendar.id) + '"><div class="subcalendar-info"><div class="subcalendar-name"><span class="ellipsis_text"><b>' + soy.$$escapeHtml(opt_data.subCalendar.displayName) + '</b></span></div></div><ul class="child-subcalendars"/></div>';
};
if (goog.DEBUG) {
  Confluence.TeamCalendars.Templates.subCalendarPanelEntry.soyTemplateName = 'Confluence.TeamCalendars.Templates.subCalendarPanelEntry';
}


Confluence.TeamCalendars.Templates.customEventTypePanelEntry = function(opt_data, opt_ignored) {
  return '<li class="child-subcalendar ' + soy.$$escapeHtml(opt_data.customEventType.icon) + '" data-custom-event-type-id="' + soy.$$escapeHtml(opt_data.customEventType.customEventTypeId) + '" data-sub-calendar-id="' + soy.$$escapeHtml(opt_data.childSubCalendar.id) + '" data-parent-sub-calendar-id="' + soy.$$escapeHtml(opt_data.childSubCalendar.parentId) + '"><div class="child-subcalendar-color ' + soy.$$escapeHtml(opt_data.childSubCalendar.color) + '"/><div class="child-subcalendar-name">' + ((opt_data.childSubCalendar.subscriptionType) ? Confluence.TeamCalendars.Templates.iconCustomPrinting({icon: opt_data.customEventType.icon, className: 'iconSubCalendarPrint'}) : Confluence.TeamCalendars.Templates.iconCustomPrinting({icon: opt_data.customEventType.icon, className: 'iconSubCalendarPrint'})) + '<span class="ellipsis_text">' + soy.$$escapeHtml(opt_data.customEventType.title) + '</span></div></li>';
};
if (goog.DEBUG) {
  Confluence.TeamCalendars.Templates.customEventTypePanelEntry.soyTemplateName = 'Confluence.TeamCalendars.Templates.customEventTypePanelEntry';
}


Confluence.TeamCalendars.Templates.childSubCalendarPanelEntry = function(opt_data, opt_ignored) {
  return '<li class="child-subcalendar ' + ((opt_data.childSubCalendar.subscriptionType) ? ' ' + soy.$$escapeHtml(opt_data.childSubCalendar.subscriptionType) : soy.$$escapeHtml(opt_data.childSubCalendar.type)) + '" data-sub-calendar-id="' + soy.$$escapeHtml(opt_data.childSubCalendar.id) + '"data-parent-sub-calendar-id="' + soy.$$escapeHtml(opt_data.childSubCalendar.parentId) + '"><div class="child-subcalendar-color ' + soy.$$escapeHtml(opt_data.childSubCalendar.color) + '"/><div class="child-subcalendar-name">' + ((opt_data.childSubCalendar.subscriptionType) ? Confluence.TeamCalendars.Templates.iconSubCalendarPrinting({eventType: opt_data.childSubCalendar.subscriptionType}) : Confluence.TeamCalendars.Templates.iconSubCalendarPrinting({eventType: opt_data.childSubCalendar.type})) + '<span class="ellipsis_text">' + soy.$$escapeHtml(opt_data.childSubCalendar.displayName) + '</span></div></li>';
};
if (goog.DEBUG) {
  Confluence.TeamCalendars.Templates.childSubCalendarPanelEntry.soyTemplateName = 'Confluence.TeamCalendars.Templates.childSubCalendarPanelEntry';
}


Confluence.TeamCalendars.Templates.subCalendarMenu = function(opt_data, opt_ignored) {
  return '' + ((opt_data.subCalendar.menuOptions.showMenu) ? Confluence.TeamCalendars.Templates.subCalendarPopupMenu({subCalendar: opt_data.subCalendar, autoConvertSupported: opt_data.autoConvertSupported, subCalendarClasses: opt_data.subCalendarClasses, isParent: true}) : '');
};
if (goog.DEBUG) {
  Confluence.TeamCalendars.Templates.subCalendarMenu.soyTemplateName = 'Confluence.TeamCalendars.Templates.subCalendarMenu';
}


Confluence.TeamCalendars.Templates.customEventTypeMenu = function(opt_data, opt_ignored) {
  return '' + ((opt_data.subCalendar.menuOptions.showMenu) ? Confluence.TeamCalendars.Templates.subCalendarPopupMenu({subCalendar: opt_data.subCalendar, autoConvertSupported: opt_data.autoConvertSupported, subCalendarClasses: opt_data.subCalendarClasses, isCustomEventType: true, parentSubCalendar: opt_data.parentSubCalendar, isParent: false}) : '');
};
if (goog.DEBUG) {
  Confluence.TeamCalendars.Templates.customEventTypeMenu.soyTemplateName = 'Confluence.TeamCalendars.Templates.customEventTypeMenu';
}


Confluence.TeamCalendars.Templates.childSubCalendarMenu = function(opt_data, opt_ignored) {
  return '' + ((opt_data.subCalendar.menuOptions.showMenu) ? Confluence.TeamCalendars.Templates.subCalendarPopupMenu({subCalendar: opt_data.subCalendar, autoConvertSupported: opt_data.autoConvertSupported, subCalendarClasses: opt_data.subCalendarClasses, isParent: false}) : '');
};
if (goog.DEBUG) {
  Confluence.TeamCalendars.Templates.childSubCalendarMenu.soyTemplateName = 'Confluence.TeamCalendars.Templates.childSubCalendarMenu';
}


Confluence.TeamCalendars.Templates.subCalendarPopupMenu = function(opt_data, opt_ignored) {
  return '<div class="subcalendar-dropdown-menu ' + ((opt_data.isParent) ? 'parent-subCalendar' : '') + '"><div class="aui-dd-parent"><div class="aui-dd-trigger subcalendar-dropdown-menu-button"><button  class=\'aui-button aui-button-compact aui-button-subtle\'><span class=\'aui-icon aui-icon-small calendar-icon-more\'>More</span></button></div><ul class="aui-dropdown">' + ((opt_data.subCalendar.menuOptions.showAddEvent) ? '<li><a href="#" class="subcalendar-addevent" title="' + soy.$$escapeHtml('Add a calendar event') + '">' + soy.$$escapeHtml('Add Event') + '</a></li>' : '') + ((opt_data.subCalendar.menuOptions.showDisplayLink) ? '<li class="subcalendar-display-hide"><a href="#" title="' + soy.$$escapeHtml('Hide Events') + '">' + soy.$$escapeHtml('Hide Events') + '</a></li><li class="subcalendar-display-show"><a href="#" title="' + soy.$$escapeHtml('Show Events') + '">' + soy.$$escapeHtml('Show Events') + '</a></li>' : '') + ((opt_data.subCalendar.menuOptions.showNotifications) ? '<li class="subcalendar-watch section-end"><a href="#" title="' + soy.$$escapeHtml('Watch this calendar') + '">' + soy.$$escapeHtml('Watch') + '</a></li><li class="subcalendar-unwatch section-end"><a href="#" title="' + soy.$$escapeHtml('Stop watching this calendar') + '">' + soy.$$escapeHtml('Stop Watching') + '</a></li><li class="subcalendar-watching section-end"><a href="#" title="' + soy.$$escapeHtml('You\x27re watching this calendar via pages') + '">' + soy.$$escapeHtml('Watching') + '</a></li><li class="subcalendar-loading-watching-status section-end"><a href="#">' + soy.$$escapeHtml('Loading Watching Status') + '<span class="aui-icon aui-icon-wait"></span></a></li>' : '') + ((opt_data.subCalendar.menuOptions.showView) ? '<li><a href="#" class="subcalendar-view" title="' + soy.$$escapeHtml('View calendar details') + '">' + soy.$$escapeHtml('View Calendar') + '</a></li>' : '') + ((opt_data.parentSubCalendar && opt_data.parentSubCalendar.menuOptions.showEdit && opt_data.isCustomEventType) ? '<li><a href="#" class="custom-event-type-edit" title="' + soy.$$escapeHtml('Edit custom event type details') + '">' + soy.$$escapeHtml('Edit') + '</a></li>' : '') + ((opt_data.subCalendar.menuOptions.showEdit) ? '<li><a href="#" class="subcalendar-edit" title="' + soy.$$escapeHtml('Edit calendar details') + '">' + soy.$$escapeHtml('Edit') + '</a></li>' : '') + ((opt_data.subCalendar.menuOptions.showRestrictions) ? '<li><a href="#" class="subcalendar-restrict" title="' + soy.$$escapeHtml('Restrict access to calendar') + '">' + soy.$$escapeHtml('Restrictions') + '</a></li>' : '') + ((opt_data.subCalendar.menuOptions.showRemove) ? '<li class="section-end"><a href="#" class="subcalendar-remove" title="' + soy.$$escapeHtml('Remove calendar') + '">' + soy.$$escapeHtml('Remove...') + '</a></li>' : '') + ((opt_data.subCalendar.menuOptions.showShareAndSubscribe) ? ((opt_data.autoConvertSupported) ? '<li><a href="#" class="subcalendar-share-or-embed" title="' + soy.$$escapeHtml('Share calendar with others') + '">' + soy.$$escapeHtml('Embed') + '</a></li>' : '<li><a href="#" class="subcalendar-share" title="' + soy.$$escapeHtml('Share calendar with others') + '">' + soy.$$escapeHtml('Share') + '</a></li>') + ((opt_data.subCalendar.menuOptions.showSubscribe) ? '<li><a href="#" class="subcalendar-subscribe" title="' + soy.$$escapeHtml('Subscribe to calendar with calendar programs') + '">' + soy.$$escapeHtml('Subscribe') + '</a></li>' : '') + '<li><a href="#" class="subcalendar-icalexport" title="' + soy.$$escapeHtml('Export calendar in iCalendar format') + '">' + soy.$$escapeHtml('Export to iCalendar') + '</a></li>' : '') + ((opt_data.subCalendar.menuOptions.showReload) ? '<li class="section-end"><a href="#" class="subcalendar-reload" title="' + soy.$$escapeHtml('Refresh calendar') + '">' + soy.$$escapeHtml('Refresh') + '</a></li>' : '') + ((opt_data.subCalendar.menuOptions.showReminder) ? '<li class="subcalendar-reminder section-end"><a href="#" class="unreminder-me ' + ((opt_data.subCalendar.reminderMe == false) ? 'hidden' : '') + '" title="' + soy.$$escapeHtml('Don\x27t send me reminders for this event type') + '">' + soy.$$escapeHtml('Turn off reminders') + '</a><a href="#" class="reminder-me ' + ((opt_data.subCalendar.reminderMe) ? 'hidden' : '') + '" title="' + soy.$$escapeHtml('Send me reminders for this event type') + '">' + soy.$$escapeHtml('Turn on reminders') + '</a></li>' : '') + ((opt_data.subCalendar.menuOptions.showSettingReminder) ? '<li class="subcalendar-setting-reminder section-end"><a href="#" class="setting-reminder-setting" title="' + soy.$$escapeHtml('There\x27s no reminder for this event type. Add one now.') + '">' + soy.$$escapeHtml('Add Reminder') + '</a></li>' : '') + ((opt_data.subCalendar.menuOptions.showColourGrid) ? Confluence.TeamCalendars.Templates.subCalendarColourGrid(opt_data) : '') + '</ul></div></div>';
};
if (goog.DEBUG) {
  Confluence.TeamCalendars.Templates.subCalendarPopupMenu.soyTemplateName = 'Confluence.TeamCalendars.Templates.subCalendarPopupMenu';
}


Confluence.TeamCalendars.Templates.subCalendarColourGrid = function(opt_data, opt_ignored) {
  var output = '<li class="color-grid"><div class="color-cells">';
  var subCalendarColorClassList226 = opt_data.subCalendarClasses;
  var subCalendarColorClassListLen226 = subCalendarColorClassList226.length;
  for (var subCalendarColorClassIndex226 = 0; subCalendarColorClassIndex226 < subCalendarColorClassListLen226; subCalendarColorClassIndex226++) {
    var subCalendarColorClassData226 = subCalendarColorClassList226[subCalendarColorClassIndex226];
    output += '<div class="' + soy.$$escapeHtml(subCalendarColorClassData226) + ' color-cell ' + ((subCalendarColorClassIndex226 % 7 == 0) ? ' clear' : '') + '" data-colour="' + soy.$$escapeHtml(subCalendarColorClassData226) + '"></div>';
  }
  output += '<div class="clear"></div></div></li>';
  return output;
};
if (goog.DEBUG) {
  Confluence.TeamCalendars.Templates.subCalendarColourGrid.soyTemplateName = 'Confluence.TeamCalendars.Templates.subCalendarColourGrid';
}

}catch(e){WRMCB(e)};
;
try {
/* module-key = 'com.atlassian.confluence.extra.team-calendars:calendar-resources', location = 'com/atlassian/confluence/extra/calendar3/templates/edit-local-subcalendar.soy' */
// This file was automatically generated from edit-local-subcalendar.soy.
// Please don't edit this file by hand.

/**
 * @fileoverview Templates in namespace Confluence.TeamCalendars.Templates.
 */

if (typeof Confluence == 'undefined') { var Confluence = {}; }
if (typeof Confluence.TeamCalendars == 'undefined') { Confluence.TeamCalendars = {}; }
if (typeof Confluence.TeamCalendars.Templates == 'undefined') { Confluence.TeamCalendars.Templates = {}; }


Confluence.TeamCalendars.Templates.editLocalCalendar = function(opt_data, opt_ignored) {
  return '<form name="editSubCalendarForm" class="sub-calendar-edit-form aui" method="POST" action="#"><input type="hidden" name="subCalendarId" value=""><input type="hidden" name="timeZoneId" value=""><input type="hidden" name="type" value="local"><input type="hidden" name="color" value=""><input type="hidden" name="spaceKey" value=""><div class="form-mode create"><div class="subcalendar-type subcalendar-local"><div class="field-group field-group-name"><label for="name">' + soy.$$escapeHtml('Name') + '<span class="aui-icon icon-required"></span></label><input name="name" id="name" type="text" class="text" value="" autocomplete="off"><div class="error name-error"></div></div><div class="field-group field-group-description"><label for="description">' + soy.$$escapeHtml('Description') + '</label><textarea name="description" id="description" rows="5" class="textarea"></textarea></div><div class="field-group field-group-space-permission"><label for="spaceKeyAutocomplete">' + soy.$$escapeHtml('Related space') + '<span class="aui-icon icon-required"></span></label><input name="spaceKeyAutocomplete" id="spaceKeyAutocomplete" type="text" class="autocomplete-space text" data-max="5" data-none-message="' + soy.$$escapeHtml('No spaces found') + '" data-template="{key}"><div class="description">' + soy.$$escapeHtml('Link this calendar to a space.') + '</div><div class="error spaceKeyAutocomplete-error"></div></div><div class="field-group field-group-timezone"><label for="timeZoneIdSelect">' + soy.$$escapeHtml('Time zone') + '</label><select name="timeZoneIdSelect" id="timeZoneIdSelect" class="select"></select><span class="spinner aui-icon aui-icon-wait"></span><div class="error timeZoneId-error"></div></div><div class="field-group field-group-timezone-display"><label>' + soy.$$escapeHtml('Time zone') + '</label><span class="timeZoneIdDisplay field-value"></span></div><div class="aui-message error calendar-error hidden"><p class="title"><span class="aui-icon icon-error"></span><strong>' + soy.$$escapeHtml('Error(s) occurred.') + '</strong></p><div class="error-content"><ul class="error-messages hidden"></ul></div></div></div></div></form>';
};
if (goog.DEBUG) {
  Confluence.TeamCalendars.Templates.editLocalCalendar.soyTemplateName = 'Confluence.TeamCalendars.Templates.editLocalCalendar';
}

}catch(e){WRMCB(e)};
;
try {
/* module-key = 'com.atlassian.confluence.extra.team-calendars:calendar-resources', location = 'com/atlassian/confluence/extra/calendar3/templates/edit-people-subcalendar.soy' */
// This file was automatically generated from edit-people-subcalendar.soy.
// Please don't edit this file by hand.

/**
 * @fileoverview Templates in namespace Confluence.TeamCalendars.Templates.
 */

if (typeof Confluence == 'undefined') { var Confluence = {}; }
if (typeof Confluence.TeamCalendars == 'undefined') { Confluence.TeamCalendars = {}; }
if (typeof Confluence.TeamCalendars.Templates == 'undefined') { Confluence.TeamCalendars.Templates = {}; }


Confluence.TeamCalendars.Templates.editPeopleCalendar = function(opt_data, opt_ignored) {
  return '<form name="editSubCalendarForm" class="sub-calendar-edit-form aui" method="POST" action="#"><input type="hidden" name="subCalendarId" value=""><input type="hidden" name="timeZoneId" value=""><input type="hidden" name="type" value="people"><input type="hidden" name="color" value=""><input type="hidden" name="spaceKey" value=""><div class="form-mode create"><div class="subcalendar-type subcalendar-people"><div class="field-group field-group-name"><label for="name">' + soy.$$escapeHtml('Name') + '<span class="aui-icon icon-required"></span></label><input name="name" id="name" type="text" class="text" value="" autocomplete="off"><div class="error name-error"></div></div><div class="field-group field-group-description"><label for="description">' + soy.$$escapeHtml('Description') + '</label><textarea name="description" id="description" rows="5" class="textarea"></textarea></div><div class="field-group field-group-space-permission"><label for="spaceKeyAutocomplete">' + soy.$$escapeHtml('Related space') + '<span class="aui-icon icon-required"></span></label><input name="spaceKeyAutocomplete" id="spaceKeyAutocomplete" type="text" class="autocomplete-space text" data-max="5" data-none-message="' + soy.$$escapeHtml('No spaces found') + '"><div class="description">' + soy.$$escapeHtml('Link this calendar to a space.') + '</div><div class="error spaceKeyAutocomplete-error"></div></div><div class="field-group field-group-timezone"><label for="timeZoneIdSelect">' + soy.$$escapeHtml('Time zone') + '</label><select name="timeZoneIdSelect" id="timeZoneIdSelect" class="select"></select><span class="spinner aui-icon aui-icon-wait"></span><div class="error timeZoneId-error"></div></div><div class="field-group field-group-timezone-display"><label>' + soy.$$escapeHtml('Time zone') + '</label><span class="timeZoneIdDisplay field-value"></span></div><div class="aui-message error calendar-error hidden"><p class="title"><span class="aui-icon icon-error"></span><strong>' + soy.$$escapeHtml('Error(s) occurred.') + '</strong></p><div class="error-content"><ul class="error-messages hidden"></ul></div></div></div></div></form>';
};
if (goog.DEBUG) {
  Confluence.TeamCalendars.Templates.editPeopleCalendar.soyTemplateName = 'Confluence.TeamCalendars.Templates.editPeopleCalendar';
}

}catch(e){WRMCB(e)};
;
try {
/* module-key = 'com.atlassian.confluence.extra.team-calendars:calendar-resources', location = 'com/atlassian/confluence/extra/calendar3/templates/edit-subscription-subcalendar.soy' */
// This file was automatically generated from edit-subscription-subcalendar.soy.
// Please don't edit this file by hand.

/**
 * @fileoverview Templates in namespace Confluence.TeamCalendars.Templates.
 */

if (typeof Confluence == 'undefined') { var Confluence = {}; }
if (typeof Confluence.TeamCalendars == 'undefined') { Confluence.TeamCalendars = {}; }
if (typeof Confluence.TeamCalendars.Templates == 'undefined') { Confluence.TeamCalendars.Templates = {}; }


Confluence.TeamCalendars.Templates.editSubscriptionSubcalendar = function(opt_data, opt_ignored) {
  return '<form name="editSubCalendarForm" class="sub-calendar-edit-form aui" method="POST" action="#"><input type="hidden" name="subCalendarId" value=""><input type="hidden" name="type" value="subscription"><input type="hidden" name="color" value=""><input type="hidden" name="spaceKey" value=""><div class="form-mode create"><div class="subcalendar-type subcalendar-subscription"><div class="field-group field-group-name"><label for="name">' + soy.$$escapeHtml('Name') + '<span class="aui-icon icon-required"></span></label><input name="name" id="name" type="text" class="text" value="" autocomplete="off"><div class="error name-error"></div></div><div class="field-group field-group-description"><label for="description">' + soy.$$escapeHtml('Description') + '</label><textarea name="description" id="description" rows="5" class="textarea"></textarea></div><div class="field-group field-group-url"><label for="location">' + soy.$$escapeHtml('URL') + '<span class="aui-icon icon-required"></span></label><input name="location" id="location" type="text" class="text" autocomplete="off"><div class="description">' + soy.$$escapeHtml('iCal URL') + '</div><div class="error location-error"></div></div><div class="field-group field-group-username"><label for="username">' + soy.$$escapeHtml('User name') + '</label><input name="username" id="username" type="text" class="text"></div><div class="field-group field-group-password"><label for="password">' + soy.$$escapeHtml('Password') + '</label><input name="password" id="password" type="password" class="password"></div><div class="field-group field-group-space-permission"><label for="spaceKeyAutocomplete">' + soy.$$escapeHtml('Related space') + '<span class="aui-icon icon-required"></span></label><input name="spaceKeyAutocomplete" id="spaceKeyAutocomplete" type="text" class="autocomplete-space text" data-max="5" data-none-message="' + soy.$$escapeHtml('No spaces found') + '"><div class="description">' + soy.$$escapeHtml('Link this calendar to a space.') + '</div><div class="error spaceKeyAutocomplete-error"></div></div></div></div></form>';
};
if (goog.DEBUG) {
  Confluence.TeamCalendars.Templates.editSubscriptionSubcalendar.soyTemplateName = 'Confluence.TeamCalendars.Templates.editSubscriptionSubcalendar';
}

}catch(e){WRMCB(e)};
;
try {
/* module-key = 'com.atlassian.confluence.extra.team-calendars:calendar-resources', location = 'com/atlassian/confluence/extra/calendar3/templates/edit-jira-subcalendar.soy' */
// This file was automatically generated from edit-jira-subcalendar.soy.
// Please don't edit this file by hand.

/**
 * @fileoverview Templates in namespace Confluence.TeamCalendars.Templates.
 */

if (typeof Confluence == 'undefined') { var Confluence = {}; }
if (typeof Confluence.TeamCalendars == 'undefined') { Confluence.TeamCalendars = {}; }
if (typeof Confluence.TeamCalendars.Templates == 'undefined') { Confluence.TeamCalendars.Templates = {}; }


Confluence.TeamCalendars.Templates.hiddenJiraFields = function(opt_data, opt_ignored) {
  return '<input type="hidden" name="subCalendarId" value=""><input type="hidden" name="type" value="jira"><input type="hidden" name="color" value=""><input type="hidden" name="spaceKey" value="">';
};
if (goog.DEBUG) {
  Confluence.TeamCalendars.Templates.hiddenJiraFields.soyTemplateName = 'Confluence.TeamCalendars.Templates.hiddenJiraFields';
}


Confluence.TeamCalendars.Templates.editJiraCalendar = function(opt_data, opt_ignored) {
  return '<form name="editSubCalendarForm" class="sub-calendar-edit-form aui" method="POST" action="#">' + Confluence.TeamCalendars.Templates.hiddenJiraFields(null) + '<div class="form-mode create"><div class="subcalendar-type subcalendar-jira"><div class="jira-query-options option-project-selected"><fieldset class="group loading-dummy"><legend><span>' + soy.$$escapeHtml('Display') + ' <span class="aui-icon icon-required"></span></span></legend><div class="matrix"><span class="spinner aui-icon aui-icon-wait"></span></div></fieldset><fieldset class="group query-group"><legend><span>' + soy.$$escapeHtml('Display') + ' <span class="aui-icon icon-required"></span></span></legend><div class="matrix"><div class="radio radio-project"><input class="radio" type="radio" id="query-by-project" name="query-type" checked="checked" value="option-project"><label for="query-by-project">' + soy.$$escapeHtml('Project') + '</label></div><div class="radio radio-search-filter trailing-option"><input class="radio" type="radio" id="query-by-searchfilter" name="query-type" value="option-search-filter"><label for="query-by-searchfilter">' + soy.$$escapeHtml('Saved filter') + '</label></div><div class="radio radio-jql trailing-option"><input class="radio" type="radio" id="query-by-jql" name="query-type" value="option-jql"><label for="query-by-jql">' + soy.$$escapeHtml('JQL (advanced)') + '</label></div></div><div class="field-group hidden"><div class="error jiraQueryOptions-error"></div></div></fieldset><div class="field-group compatibility-group" style="position: relative;"><label for="project" class="hidden project-select-label">' + soy.$$escapeHtml('Project') + '<span class="aui-icon icon-required"></span></label><div class="option-project option disableable-option"><div class="option-content"><select class="select content option-value" name="project" id="project"></select><div class="unavailable-message field-value"></div></div><div class="error project-error"></div></div><div class="option-search-filter option disableable-option"><input type="text" class="text option-value hidden" id="searchFilter" name="searchFilter"><label for="searchFilter" class="hidden">' + soy.$$escapeHtml('Saved filter') + '</label><div class="option-content"><input type="text" class="text content" id="searchFilterName" name="searchFilterName"><label for="searchFilterName" class="hidden">' + soy.$$escapeHtml('Saved filter') + '</label><div class="unavailable-message field-value">' + soy.$$escapeHtml('No search filters found. Please create a JIRA search filter.') + '</div><div class="search-filter-suggestions hidden"></div><div class="error searchFilterId-error"></div></div></div><div class="option-jql option"><textarea rows="20" cols="20" class="textarea option-value" id="jql" name="jql" wrap="off" autocomplete="off"></textarea><span class="jqlAutoCompleteSpinner hidden aui-icon aui-icon-wait"></span><div class="clear"></div><label for="jql" class="hidden">' + soy.$$escapeHtml('JQL (advanced)') + '</label><div class="error jql-error" id="jql-error"></div><div class="invisible jql-status"><div class="jql-ok hidden">' + soy.$$escapeHtml('Valid') + ' <a href="http://confluence.atlassian.com/x/ghGyCg" target="_blank">' + soy.$$escapeHtml('JQL') + '</a></div><div class="jql-bad hidden">' + soy.$$escapeHtml('Invalid') + ' <a href="http://confluence.atlassian.com/x/ghGyCg" target="_blank">' + soy.$$escapeHtml('JQL') + '</a></div></div></div></div><div class="date-fields-spinner-container hidden"><span class="aui-icon aui-icon-wait"></span><span>' + soy.$$escapeHtml('Loading dates to display...') + '</span></div><fieldset class="group field-group-jira field-group-jira-show hidden"><legend><span>' + soy.$$escapeHtml('Show') + '</span></legend><div class="dates"><div class="single-dates"><p class="subtitle">' + soy.$$escapeHtml('Single date:') + '</p><div class="date-fields"></div></div><div class="duration"><p class="subtitle">' + soy.$$escapeHtml('Date range:') + '</p><div class="date-fields"></div><p class="duration-desc">' + soy.$$escapeHtml('Display the time between a start and end date for an issue.') + '</p><a href="#" class="add-duration">' + soy.$$escapeHtml('Add start and end date...') + '</a></div><div class="clear"></div></div><div class="error dateFieldName-error"></div></fieldset><div class="field-group field-group-timezone-display"><label>' + soy.$$escapeHtml('Time zone') + '</label><span class="timeZoneIdDisplay field-value"></span></div></div></div></div></form>';
};
if (goog.DEBUG) {
  Confluence.TeamCalendars.Templates.editJiraCalendar.soyTemplateName = 'Confluence.TeamCalendars.Templates.editJiraCalendar';
}

}catch(e){WRMCB(e)};
;
try {
/* module-key = 'com.atlassian.confluence.extra.team-calendars:calendar-resources', location = 'com/atlassian/confluence/extra/calendar3/templates/edit-jira-subcalendar-duration.soy' */
// This file was automatically generated from edit-jira-subcalendar-duration.soy.
// Please don't edit this file by hand.

/**
 * @fileoverview Templates in namespace Confluence.TeamCalendars.Templates.
 */

if (typeof Confluence == 'undefined') { var Confluence = {}; }
if (typeof Confluence.TeamCalendars == 'undefined') { Confluence.TeamCalendars = {}; }
if (typeof Confluence.TeamCalendars.Templates == 'undefined') { Confluence.TeamCalendars.Templates = {}; }


Confluence.TeamCalendars.Templates.editJiraSubCalendarDurations = function(opt_data, opt_ignored) {
  return '<p class="intro">' + soy.$$filterNoAutoescape('You can visualise the duration between two issue dates in Team Calendars. To do this, select your desired fields below or \x3ca href\x3d\x22https://confluence.atlassian.com/x/8QESCw\x22 target\x3d\x22_blank\x22\x3elearn more about creating custom dates\x3c/a\x3e.') + '</p><div class="duration-fields"><div class="duration-start"><select name="start-field"><option value="">' + soy.$$escapeHtml('Select start date...') + '</option></select></div><div class="duration-end"><select name="end-field"><option value="">' + soy.$$escapeHtml('Select end date...') + '</option></select></div><div class="clear"></div></div><div class="no-selectable-date-fields hidden"><p>' + soy.$$escapeHtml('No custom dates found for the selected JIRA query.') + '</p><p class="add-fields"></p></div>';
};
if (goog.DEBUG) {
  Confluence.TeamCalendars.Templates.editJiraSubCalendarDurations.soyTemplateName = 'Confluence.TeamCalendars.Templates.editJiraSubCalendarDurations';
}

}catch(e){WRMCB(e)};
;
try {
/* module-key = 'com.atlassian.confluence.extra.team-calendars:calendar-resources', location = 'com/atlassian/confluence/extra/calendar3/components/calendar-feature-discovery-dialog/subcalendar-features-dialog.soy' */
// This file was automatically generated from subcalendar-features-dialog.soy.
// Please don't edit this file by hand.

/**
 * @fileoverview Templates in namespace Confluence.TeamCalendars.Templates.
 */

if (typeof Confluence == 'undefined') { var Confluence = {}; }
if (typeof Confluence.TeamCalendars == 'undefined') { Confluence.TeamCalendars = {}; }
if (typeof Confluence.TeamCalendars.Templates == 'undefined') { Confluence.TeamCalendars.Templates = {}; }


Confluence.TeamCalendars.Templates.subCalendarFeatures = function(opt_data, opt_ignored) {
  return '<div class="feature-discovery"><p class="didyouknow description">' + soy.$$escapeHtml('Did you know you can also:') + '</p><div class="features-table-container' + ((! opt_data.autoConvertSupported) ? ' noautoconvert' : '') + '"><table cellspacing="0" class="' + soy.$$escapeHtml(opt_data.subCalendar.type) + '"><tbody><tr class="features"><td class="feature add-event"><a class="feature-icon" alt="' + soy.$$escapeHtml('Add') + '">' + soy.$$escapeHtml('Add') + '</a><p class="title">' + soy.$$escapeHtml('Add') + '</p><p class="feature-description">' + soy.$$escapeHtml('Add events to your calendar.') + '</p></td><td class="feature restrict"><a class="feature-icon" alt="' + soy.$$escapeHtml('Restrict') + '">' + soy.$$escapeHtml('Restrict') + '</a><p class="title">' + soy.$$escapeHtml('Restrict') + '</p><p class="feature-description">' + soy.$$escapeHtml('Restrict the calendar\x27s visibility so that only certain people can   see or edit it.') + '</p></td><td class="feature embed"><a class="feature-icon" alt="' + soy.$$escapeHtml('Embed') + '">' + soy.$$escapeHtml('Embed') + '</a><p class="title">' + soy.$$escapeHtml('Embed') + '</p><p class="feature-description">' + soy.$$escapeHtml('Embed the calendar on a page or blog post.') + '</p></td><td class="feature embed-or-share"><a class="feature-icon" alt="' + soy.$$escapeHtml('Embed') + '">' + soy.$$escapeHtml('Embed') + '</a><p class="title">' + soy.$$escapeHtml('Embed') + '</p><p class="feature-description">' + soy.$$escapeHtml('Share calendar with others.') + '</p></td><td class="feature share"><a class="feature-icon" alt="' + soy.$$escapeHtml('Share') + '">' + soy.$$escapeHtml('Share') + '</a><p class="title">' + soy.$$escapeHtml('Share') + '</p><p class="feature-description">' + soy.$$escapeHtml('Share the calendar with other people for them to subscribe to.') + '</p></td></tr></tbody></table></div></div>';
};
if (goog.DEBUG) {
  Confluence.TeamCalendars.Templates.subCalendarFeatures.soyTemplateName = 'Confluence.TeamCalendars.Templates.subCalendarFeatures';
}

}catch(e){WRMCB(e)};
;
try {
/* module-key = 'com.atlassian.confluence.extra.team-calendars:calendar-resources', location = 'com/atlassian/confluence/extra/calendar3/components/calendar-reset-url-dialog/subcalendar-privateurl-reset-dialog.soy' */
// This file was automatically generated from subcalendar-privateurl-reset-dialog.soy.
// Please don't edit this file by hand.

/**
 * @fileoverview Templates in namespace Confluence.TeamCalendars.Templates.
 */

if (typeof Confluence == 'undefined') { var Confluence = {}; }
if (typeof Confluence.TeamCalendars == 'undefined') { Confluence.TeamCalendars = {}; }
if (typeof Confluence.TeamCalendars.Templates == 'undefined') { Confluence.TeamCalendars.Templates = {}; }


Confluence.TeamCalendars.Templates.resetSubCalendarPrivateUrl = function(opt_data, opt_ignored) {
  return '<p class="reset-reason">' + soy.$$filterNoAutoescape('Your subscription link for \x3cstrong class\x3d\x22calendar-title\x22\x3e\x3c/strong\x3e is private. If you have accidentally shared this link with others you may want to reset it.') + '</p><p class="reset-implication">' + soy.$$escapeHtml('Resetting the link to this calendar will mean you will need to re-subscribe to the calendar from your calendar application.') + '</p><div class="reset-progress"><div class="resetting"><span class="progress-icon aui-icon aui-icon-wait"></span><span class="progress-description">' + soy.$$escapeHtml('Resetting...') + '</span></div><div class="reset"><img class="progress-icon" src="' + soy.$$escapeHtml("/wiki") + '/images/icons/bullet_done.gif"><span class="progress-description">' + soy.$$escapeHtml('Subscription link has been reset.') + ' <a href="#" class="subscribe-to-calendar">' + soy.$$escapeHtml('Subscribe to this calendar') + '</a>.</span></div></div>';
};
if (goog.DEBUG) {
  Confluence.TeamCalendars.Templates.resetSubCalendarPrivateUrl.soyTemplateName = 'Confluence.TeamCalendars.Templates.resetSubCalendarPrivateUrl';
}

}catch(e){WRMCB(e)};
;
try {
/* module-key = 'com.atlassian.confluence.extra.team-calendars:calendar-resources', location = 'com/atlassian/confluence/extra/calendar3/components/calendar-restriction-dialog/subcalendar-restrict-dialog.soy' */
// This file was automatically generated from subcalendar-restrict-dialog.soy.
// Please don't edit this file by hand.

/**
 * @fileoverview Templates in namespace Confluence.TeamCalendars.Templates.
 */

if (typeof Confluence == 'undefined') { var Confluence = {}; }
if (typeof Confluence.TeamCalendars == 'undefined') { Confluence.TeamCalendars = {}; }
if (typeof Confluence.TeamCalendars.Templates == 'undefined') { Confluence.TeamCalendars.Templates = {}; }


Confluence.TeamCalendars.Templates.restrictSubCalendar = function(opt_data, opt_ignored) {
  return '<form name="editSubCalendarForm" class="sub-calendar-edit-form aui" method="POST" action="#"><input type="hidden" name="subCalendarId"><div class="field-group-permissions"><div class="permissions-type-select"><input type="radio" name="restriction-type" class="radio option-view-restrictions" id="option-view-restrictions-' + soy.$$escapeHtml(opt_data.elementIdSuffix) + '" value="view"><span>' + soy.$$escapeHtml('Restrict viewing') + '</span><input type="radio" name="restriction-type" class="radio option-edit-restrictions" id="option-edit-restrictions-' + soy.$$escapeHtml(opt_data.elementIdSuffix) + '" value="edit" checked="checked"><span>' + soy.$$escapeHtml('Restrict editing') + '</span></div><div class="permissions-details"><div class="permissions-input"><div class="user-picker-container"><input name="permissionsUserPicker" id="permissionsUserPicker-' + soy.$$escapeHtml(opt_data.elementIdSuffix) + '" type="text" class="text autocomplete-user with-hint" value="' + soy.$$escapeHtml('Enter user name') + '" autocomplete="off" data-none-message="' + soy.$$escapeHtml('No user found. Press \x27enter\x27 to input as group.') + '" data-template="{title}" data-max="3"></div><div class="group-picker-container"><span class="or-text">' + soy.$$escapeHtml('or') + '</span><a class="group-picker-trigger" href="#">' + ((opt_data.pdlEnabled) ? '<span class="icon icon-group"></span><span>' + soy.$$escapeHtml('Group...') + '</span>' : '<img class="group-picker-icon" src="' + soy.$$escapeHtml("/wiki") + '/images/icons/group_16.gif"><span>' + soy.$$escapeHtml('Group...') + '</span>') + '</a><div class="clear"></div></div></div><div class="clear"></div><div class="error permissions-error"></div><div class="view-permissions">' + ((opt_data.pdlEnabled) ? '<span class="aui-icon-small aui-iconfont-view"></span>' : '') + '<span class="no-view-restrictions">' + soy.$$escapeHtml('No view restrictions defined for this calendar') + '</span><span class="restricted-viewing-to">' + soy.$$escapeHtml('Viewing restricted to:') + '</span><table class="permission-table hidden"><tbody class="permitted-entities"></tbody></table></div><div class="clear"></div><div class="edit-permissions"><div class="no-edit-restrictions">' + soy.$$escapeHtml('No edit restrictions defined for this calendar') + '</div><div class="restricted-editing-to">' + soy.$$escapeHtml('Editing restricted to:') + '</div><table class="permission-table hidden"><tbody class="permitted-entities"></tbody></table></div></div></div></form>';
};
if (goog.DEBUG) {
  Confluence.TeamCalendars.Templates.restrictSubCalendar.soyTemplateName = 'Confluence.TeamCalendars.Templates.restrictSubCalendar';
}

}catch(e){WRMCB(e)};
;
try {
/* module-key = 'com.atlassian.confluence.extra.team-calendars:calendar-resources', location = 'com/atlassian/confluence/extra/calendar3/components/calendar-remove-dialog/subcalendar-remove-dialog.soy' */
// This file was automatically generated from subcalendar-remove-dialog.soy.
// Please don't edit this file by hand.

/**
 * @fileoverview Templates in namespace Confluence.TeamCalendars.Templates.
 */

if (typeof Confluence == 'undefined') { var Confluence = {}; }
if (typeof Confluence.TeamCalendars == 'undefined') { Confluence.TeamCalendars = {}; }
if (typeof Confluence.TeamCalendars.Templates == 'undefined') { Confluence.TeamCalendars.Templates = {}; }


Confluence.TeamCalendars.Templates.removeSubCalendar = function(opt_data, opt_ignored) {
  return '<form class="sub-calendar-remove aui" action="#" method="POST"><h3>' + soy.$$filterNoAutoescape('What would you like to do with \x26quot;\x3cspan class\x3d\x22calendar-to-remove\x22\x3e\x3c/span\x3e\x26quot;?') + '</h3><fieldset class="group radios"><div class="radio"><input class="radio" type="radio" name="remove" id="removefromviewoption" checked="checked"><label for="removefromviewoption">' + ((opt_data.inSpace == true) ? soy.$$escapeHtml('Remove this calendar from space calendar view.') : soy.$$escapeHtml('Remove this calendar from my calendar view.')) + '</label></div><div class="radio"><input class="radio" type="radio" name="remove" id="deletecalendaroption" ><label for="deletecalendaroption">' + soy.$$escapeHtml('Permanently delete this calendar for all users.') + '</label></div></fieldset></form>';
};
if (goog.DEBUG) {
  Confluence.TeamCalendars.Templates.removeSubCalendar.soyTemplateName = 'Confluence.TeamCalendars.Templates.removeSubCalendar';
}

}catch(e){WRMCB(e)};
;
try {
/* module-key = 'com.atlassian.confluence.extra.team-calendars:calendar-resources', location = 'com/atlassian/confluence/extra/calendar3/templates/subcalendar-remove-confirm-dialog.soy' */
// This file was automatically generated from subcalendar-remove-confirm-dialog.soy.
// Please don't edit this file by hand.

/**
 * @fileoverview Templates in namespace Confluence.TeamCalendars.Templates.
 */

if (typeof Confluence == 'undefined') { var Confluence = {}; }
if (typeof Confluence.TeamCalendars == 'undefined') { Confluence.TeamCalendars = {}; }
if (typeof Confluence.TeamCalendars.Templates == 'undefined') { Confluence.TeamCalendars.Templates = {}; }


Confluence.TeamCalendars.Templates.confirmRemoveSubCalendar = function(opt_data, opt_ignored) {
  return '<form class="sub-calendar-delete-confirm aui" action="#" method="POST"><input type="hidden" name="subCalendarId" value=""><p><strong>' + soy.$$filterNoAutoescape('Are you sure you want to delete \x26quot;\x3cspan class\x3d\x22calendar-to-delete\x22\x3e\x3c/span\x3e\x26quot;?') + ((opt_data.subscriberCount > 0) ? (opt_data.subscriberCount > 1) ? '<span class="has-subscribers-warning"> ' + soy.$$escapeHtml(AJS.format('There are {0} people subscribed to this calendar.',opt_data.subscriberCount)) + '</span>' : '<span class="has-subscribers-warning"> ' + soy.$$escapeHtml('There is 1 person subscribed to this calendar.') + '</span>' : '') + '</strong></p>' + ((opt_data.subCalendar.subscriptionType == 'jira' || opt_data.subCalendar.type == 'jira') ? soy.$$escapeHtml('Removing this calendar will not change anything in JIRA. This calendar is only a view of it. The same view can be recreated again, if so desired, with the same parameters.') : '<p>' + soy.$$escapeHtml('All subscribers will be sent an iCalendar export of this calendar.') + '</p><p>' + soy.$$filterNoAutoescape(AJS.format('If you need to restore the calendar at any time, simply choose the \x26quot;{0}\x26quot; option when adding a new calendar.','Import Calendar')) + '</p>') + '<div class="clear"></div></form>';
};
if (goog.DEBUG) {
  Confluence.TeamCalendars.Templates.confirmRemoveSubCalendar.soyTemplateName = 'Confluence.TeamCalendars.Templates.confirmRemoveSubCalendar';
}

}catch(e){WRMCB(e)};
;
try {
/* module-key = 'com.atlassian.confluence.extra.team-calendars:calendar-resources', location = 'com/atlassian/confluence/extra/calendar3/templates/jira-subcalendar-remove-confirm-dialog.soy' */
// This file was automatically generated from jira-subcalendar-remove-confirm-dialog.soy.
// Please don't edit this file by hand.

/**
 * @fileoverview Templates in namespace Confluence.TeamCalendars.Templates.
 */

if (typeof Confluence == 'undefined') { var Confluence = {}; }
if (typeof Confluence.TeamCalendars == 'undefined') { Confluence.TeamCalendars = {}; }
if (typeof Confluence.TeamCalendars.Templates == 'undefined') { Confluence.TeamCalendars.Templates = {}; }


Confluence.TeamCalendars.Templates.confirmRemoveJiraEvents = function(opt_data, opt_ignored) {
  return '<div class="delete-jira-events-hint"><p>' + soy.$$escapeHtml(AJS.format('Are you sure you want to remove \x27\x27{0}\x27\x27 from \x27\x27{1}\x27\x27?',opt_data.childName,opt_data.parentName)) + '</p></div>';
};
if (goog.DEBUG) {
  Confluence.TeamCalendars.Templates.confirmRemoveJiraEvents.soyTemplateName = 'Confluence.TeamCalendars.Templates.confirmRemoveJiraEvents';
}

}catch(e){WRMCB(e)};
;
try {
/* module-key = 'com.atlassian.confluence.extra.team-calendars:calendar-resources', location = 'com/atlassian/confluence/extra/calendar3/components/calendar-subcalendar-subscribe-dialog/calendar-search-result.soy' */
// This file was automatically generated from calendar-search-result.soy.
// Please don't edit this file by hand.

/**
 * @fileoverview Templates in namespace Confluence.TeamCalendars.Templates.
 */

if (typeof Confluence == 'undefined') { var Confluence = {}; }
if (typeof Confluence.TeamCalendars == 'undefined') { Confluence.TeamCalendars = {}; }
if (typeof Confluence.TeamCalendars.Templates == 'undefined') { Confluence.TeamCalendars.Templates = {}; }


Confluence.TeamCalendars.Templates.calendarSearchResultTable = function(opt_data, opt_ignored) {
  return '<table><thead class="tc-subscription-header"><tr><th class="subcalendar-checkbox"></th><th class="subcalendar-name">' + soy.$$escapeHtml('Calendar') + '</th><th class="subcalendar-description">' + soy.$$escapeHtml('Description') + '</th><th class="subcalendar-space">' + soy.$$escapeHtml('Related space') + '</th><th class="subcalendar-subscribercount">' + soy.$$escapeHtml('Subscribers') + '</th></tr></thead></table><table class="confluenceTable tc-table-content"><tbody class="tc-subscription-result" data-page-size="10"></tbody></table>';
};
if (goog.DEBUG) {
  Confluence.TeamCalendars.Templates.calendarSearchResultTable.soyTemplateName = 'Confluence.TeamCalendars.Templates.calendarSearchResultTable';
}


Confluence.TeamCalendars.Templates.calendarSearchResult = function(opt_data, opt_ignored) {
  return '<tr><td class="confluenceTd"><input type="checkbox" class="subcalendar-select"></td><td class="confluenceTd subcalendar-name"><div class="ellipsedColumn" title="' + soy.$$escapeHtml(opt_data.name) + '" threedots="' + soy.$$escapeHtml(opt_data.name) + '"><span class="ellipsis_text">' + soy.$$escapeHtml(opt_data.name) + '</span></div></td><td class="confluenceTd subcalendar-description"><div class="ellipsedColumn" title="' + soy.$$escapeHtml(opt_data.description) + '" threedots="' + soy.$$escapeHtml(opt_data.description) + '"><span class="ellipsis_text">' + soy.$$escapeHtml(opt_data.description) + '</span></div></td><td class="confluenceTd subcalendar-space"><div class="ellipsedColumn" title="' + soy.$$escapeHtml(opt_data.relatedSpace) + '" threedots="' + soy.$$escapeHtml(opt_data.relatedSpace) + '"><span class="ellipsis_text">' + soy.$$escapeHtml(opt_data.relatedSpace) + '</span></div></td><td class="confluenceTd subcalendar-subscribercount"><div class="ellipsedColumn" title="' + soy.$$escapeHtml(opt_data.numSubscribers) + '" threedots="' + soy.$$escapeHtml(opt_data.numSubscribers) + '"><span class="ellipsis_text">' + soy.$$escapeHtml(opt_data.numSubscribers) + '</span></div></td></tr>';
};
if (goog.DEBUG) {
  Confluence.TeamCalendars.Templates.calendarSearchResult.soyTemplateName = 'Confluence.TeamCalendars.Templates.calendarSearchResult';
}

}catch(e){WRMCB(e)};
;
try {
/* module-key = 'com.atlassian.confluence.extra.team-calendars:calendar-resources', location = 'com/atlassian/confluence/extra/calendar3/js/timeline-view.js' */
(function(a){Confluence.TeamCalendars.getTimelineAdapter=function(E,r,m,x){var n,e,p,B,c,q,g,u,l,J,w,b,L=null,j,y=null,G=500,i=0.2,K;n=r;e=m;p=E;B=x;c=1000*60*60*24*7;q=new Date();g=new Date(q.getTime()-c*2);u=new Date(q.getTime()+c*2);B.visStart=g;B.visEnd=u;l=g;J=u;function t(Q){var V,X,P,U,S=function(){if(j){P=j.dom.frame.scrollTop;U=a(j.dom.content).height()}},R=function(){var Y=a(j.dom.content).height()-U;if(Y>0){j.dom.frame.scrollTop=P+Y}else{j.dom.frame.scrollTop=P}},O=function(){if(K){var Y=a("<div/>");a.each(Q,function(ab,Z){var aa=Y.empty().html(Z.content).find("[data-event-id]").data("event-id");if(aa===K.id){j.setSelection([{row:ab}],true)}});K=null}},W=function(){var Y=a(j.dom.content).find(".timeline-event-content");a.each(Y,function(ad,aa){var Z=a(aa).parent();if(Z!==undefined&&Z.length>0){var ae=a(Z).position().left;var ab=a(j.dom.content).width();if(a(Z).width()>=ab){if(ae>0){a(aa).css("padding-left",(ab-ae)/2)}else{if(ab>=(a(Z).width()+ae)){a(aa).css("padding-left",(a(Z).width()+ae)/2-ae)}else{a(aa).css("padding-left",ab/2-ae)}}}else{var ac=(a(Z).width()+ae)/2-ae;if((ab>=(a(Z).width()+ae))&&ac>=0&&(ac<a(Z).width())){a(aa).css("padding-left",ac)}else{a(aa).css("padding-left",0)}}}})};V=n.getTimelineHeight(e)||G;var T=parseInt(n.getMaxMonthToDisplayTimelineCalendar(e))||6;X={width:"99%",height:"auto",viewHeight:V+"px",minHeight:V,editable:true,enableKeys:true,axisOnTop:false,showNavigation:true,style:"box",start:g,end:u,intervalMin:1000*60*60*6,intervalMax:c*4*T,MONTHS:n.getMonthNames(),DAYS:n.getDayNames()};S();j=new links.Timeline(p[0]);links.events.addListener(j,"select",o);links.events.addListener(j,"change",v);links.events.addListener(j,"rangechange",C);links.events.addListener(j,"rangechanged",F);links.events.addListener(j,"add",z);links.events.addListener(j,"moved",s);j.draw(Q,X);R();O();W();C()}function C(){A()}function o(O){var Q=M(),P=a(".timeline-event-box.timeline-event-selected");if(!Q){return}if(!P.length){P=a(".timeline-event-range.timeline-event-selected")}if(!d(Q)){j.setSelection([])}if(Q.disableResizing){a(".timeline-event-range-drag-left, .timeline-event-range-drag-right").addClass("hidden")}else{a(".timeline-event-range-drag-left, .timeline-event-range-drag-right").removeClass("hidden")}L=n.getEventDetailsDialog(e,Q,P);L[0].style.zIndex=1000;L.show();if(P.position().left<0){setTimeout(function(){var R=P.parent().offset().left;L.offset({left:R})},0)}}function v(){var R=M(),Q=H(),P=D(R,Q);K=R;if(!d(R)){j.cancelChange()}else{var O=n.setSubCalendarSpinnerIconVisible(e,true);n.updateEvent(e,P,function(S,U,T){if(O){O.resolve()}n.showAjaxError(e,S,U,T,n.ERROR_CLASS_EVENT_UPDATE)},function(S){if(O){O.resolve()}if(S.success){y=R.subCalendarId;n.reloadSubCalendar(e,R.subCalendarId)}else{Confluence.TeamCalendars.setGenericErrors(e,I(S.fieldErrors),n.ERROR_CLASS_EVENT_UPDATE)}})}A()}function F(){var O=j.getVisibleChartRange();k(O.start.getTime(),O.end.getTime())}function f(Q,P){if(!Q&&!P){var O=j.getVisibleChartRange();Q=new Date(O.start);P=new Date(O.end)}Confluence.TeamCalendars.updateDateDisplay(e,a.fullCalendar.formatDate(Q,"dd MMM")+" &mdash; "+a.fullCalendar.formatDate(P,"dd MMM, yyyy"))}function k(Q,P){var O=(P-Q)/2;g=new Date(Q);u=new Date(P);if(l.getTime()>Q||J.getTime()<P){l.setTime(Q-O);J.setTime(P+O);B.visStart=l;B.visEnd=J;B.update()}f(g,u)}function z(O){Confluence.TeamCalendars.Dialogs.getEditEventDialog({start:O.start,localizedStartTime:n.getDefaultStartTime(e),localizedEndTime:n.getDefaultEndTime(e),allDay:true},null,n,e).show()}function s(){A()}function d(O){return n.isEventEditable(e,O)}function h(){var P=undefined;var O=j.getSelection();if(O.length){if(O[0].row!=undefined){P=O[0].row}}return P}function M(){return w[h()]}function H(){return b[h()]}function A(){L&&L.hide()}function I(O){return a.map(O,function(P,Q){return P.field+" : "+P.errorMessages.toString()})}function N(P){function O(S){var R;if(!S.allDay){return S.end}if(S.className[0]==="jira-version"||(S.className[0]==="jira-issue"&&S.localizedStartDate===S.localizedEndDate)){return null}R=S.end||new Date(S.start.getTime());R=new Date(R.getTime());R.setHours(R.getHours()+23);R.setMinutes(59);R.setSeconds(59);return R}function Q(T){var S=T.className[0];function R(){if(a.inArray("jira-version",T.className)!==-1||a.inArray("jira-issue",T.className)!==-1){return T.title}if(a.inArray("other",T.className)!==-1||T.eventType==="custom"){if(T.shortTitle){return T.shortTitle+": "+T.title}else{if(T.invitees&&T.invitees.length){return T.invitees[0].displayName+": "+T.title}else{return T.title}}}else{return T.shortTitle||T.title}}switch(S){case"birthdays":return Confluence.TeamCalendars.Templates.timelineEventContentWithEventTypeIcon({eventId:T.id,className:S,title:R()});break;case"travel":case"leaves":case"other":if(T.invitees&&T.invitees.length){if(T.invitees.length>1){return Confluence.TeamCalendars.Templates.timelineEventContent({eventId:T.id,iconClass:"people",title:R()})}else{return Confluence.TeamCalendars.Templates.timelineEventContentSingleInvitee({eventId:T.id,iconUrl:T.iconUrl,title:R()})}}else{return Confluence.TeamCalendars.Templates.defaultTimelineEventContent({eventId:T.id,title:T.title})}break;case"jira-issue":case"jira-version":case"greenhopper-sprint":return Confluence.TeamCalendars.Templates.timelineEventContent({eventId:T.id,iconClass:S,title:R()});break}return Confluence.TeamCalendars.Templates.defaultTimelineEventContent({eventId:T.id,title:T.title})}return a.map(P,function(R){return{start:R.start,end:O(R),content:Q(R),className:R.colorScheme}})}function D(O,Q){var P={},R=n.getSubCalendar(e,O.subCalendarId);if(O.className[0]=="jira-version"||(O.className[0]==="jira-issue"&&O.localizedStartDate===O.localizedEndDate)||(O.allDay&&Q.end.getHours()==23&&Q.end.getMinutes()==59)){P.allDayEvent=true;if(Q.end){Q.end.setHours(0);Q.end.setMinutes(0);Q.end.setSeconds(0)}}else{P.allDayEvent=false}P.subCalendarId=R.parentId;P.uid=O._id;P.originalStartDate=O.originalStart||"";P.what=O.title;P.url=O.workingUrl;P.start=a.fullCalendar.formatDate(Q.start,"ddMMyyyyHHmm");P.end=a.fullCalendar.formatDate(Q.end||Q.start,"ddMMyyyyHHmm");P.where=O.where;P.description=O.description;P.freq=O.recur?O.recur.freq:"";P.byday=O.recur?O.recur.byDay:"";P.interval=O.recur?O.recur.interval:"";P.until=O.recur?O.recur.localizedUntil||"":"";P.recurrenceId=O.recurId||"";P.editAllInRecurrenceSeries="false";P.dragAndDropUpdate=true;P.eventType=O.eventType;P.customEventTypeId=O.customEventTypeId;if(R.eventInviteesSupported){P.person=a.map(O.invitees||[],function(S){return S.id})}return P}return{renderEvents:function(P){var O=a.map(P,function(Q){return Q.subCalendarId});if(y&&a.inArray(y,O)===-1){y=null;return}w=P;b=N(P);t(b);f()},setDate:function(O){var P=u.getTime()-g.getTime();g=new Date(O.getTime()-(P/2));u=new Date(O.getTime()+(P/2));k(g.getTime(),u.getTime())},next:function(){j.move(i);F()},prev:function(){j.move(-i);F()},gotoToday:function(){j.setVisibleChartRangeNow();F()}}}})(AJS.$);
}catch(e){WRMCB(e)};
;
try {
/* module-key = 'com.atlassian.confluence.extra.team-calendars:calendar-resources', location = 'com/atlassian/confluence/extra/calendar3/templates/require-oauth-message.soy' */
// This file was automatically generated from require-oauth-message.soy.
// Please don't edit this file by hand.

/**
 * @fileoverview Templates in namespace Confluence.TeamCalendars.Templates.
 */

if (typeof Confluence == 'undefined') { var Confluence = {}; }
if (typeof Confluence.TeamCalendars == 'undefined') { Confluence.TeamCalendars = {}; }
if (typeof Confluence.TeamCalendars.Templates == 'undefined') { Confluence.TeamCalendars.Templates = {}; }


Confluence.TeamCalendars.Templates.requireOauthMessage = function(opt_data, opt_ignored) {
  return '<div class="oauth-approve aui-message hint" data-o-auth-url="' + soy.$$escapeHtml(opt_data.oAuthUrl) + '" data-sub-calendar-ids="' + soy.$$escapeHtml(opt_data.subCalendarIdsArrayJson) + '" data-sub-calendar-names="' + soy.$$escapeHtml(opt_data.subCalendarNamesArrayJson) + '"><p class="title"><span class="aui-icon aui-icon-info"></span></p><p class="info-approve">' + soy.$$filterNoAutoescape(AJS.format('\x3ca href\x3d\x22#\x22 class\x3d\x22approve-dance\x22\x3e{0}\x3c/a\x3e to see events of \x3cspan class\x3d\x22subcalendar-names\x22\x3e{1}\x3c/span\x3e','Login \x26 Approve',opt_data.subCalendarName)) + '</p></div>';
};
if (goog.DEBUG) {
  Confluence.TeamCalendars.Templates.requireOauthMessage.soyTemplateName = 'Confluence.TeamCalendars.Templates.requireOauthMessage';
}

}catch(e){WRMCB(e)};
;
try {
/* module-key = 'com.atlassian.confluence.extra.team-calendars:calendar-resources', location = 'com/atlassian/confluence/extra/calendar3/templates/timeline-event-content.soy' */
// This file was automatically generated from timeline-event-content.soy.
// Please don't edit this file by hand.

/**
 * @fileoverview Templates in namespace Confluence.TeamCalendars.Templates.
 */

if (typeof Confluence == 'undefined') { var Confluence = {}; }
if (typeof Confluence.TeamCalendars == 'undefined') { Confluence.TeamCalendars = {}; }
if (typeof Confluence.TeamCalendars.Templates == 'undefined') { Confluence.TeamCalendars.Templates = {}; }


Confluence.TeamCalendars.Templates.timelineEventContentSingleInvitee = function(opt_data, opt_ignored) {
  return '<div class="user-icon-container"><img class="user-icon" src="' + soy.$$escapeHtml(opt_data.iconUrl) + '" data-event-id="' + soy.$$escapeHtml(opt_data.eventId) + '"><span class="single_person">' + soy.$$escapeHtml(opt_data.title) + '</span></div>';
};
if (goog.DEBUG) {
  Confluence.TeamCalendars.Templates.timelineEventContentSingleInvitee.soyTemplateName = 'Confluence.TeamCalendars.Templates.timelineEventContentSingleInvitee';
}


Confluence.TeamCalendars.Templates.timelineEventContent = function(opt_data, opt_ignored) {
  return '<div class="timeline-event-content-container">' + Confluence.TeamCalendars.Templates.iconEventTimelinePrinting({eventType: opt_data.iconClass}) + '<div class="event-content-with-icon ' + soy.$$escapeHtml(opt_data.iconClass) + '-icon" data-event-id="' + soy.$$escapeHtml(opt_data.eventId) + '">' + soy.$$escapeHtml(opt_data.title) + '</div></div>';
};
if (goog.DEBUG) {
  Confluence.TeamCalendars.Templates.timelineEventContent.soyTemplateName = 'Confluence.TeamCalendars.Templates.timelineEventContent';
}


Confluence.TeamCalendars.Templates.timelineEventContentWithEventTypeIcon = function(opt_data, opt_ignored) {
  return '<div class="timeline-event-content-container ' + soy.$$escapeHtml(opt_data.className) + '">' + Confluence.TeamCalendars.Templates.iconEventTimelinePrinting({eventType: opt_data.className}) + '<div class="event-content" data-event-id="' + soy.$$escapeHtml(opt_data.eventId) + '">' + soy.$$escapeHtml(opt_data.title) + '</div></div>';
};
if (goog.DEBUG) {
  Confluence.TeamCalendars.Templates.timelineEventContentWithEventTypeIcon.soyTemplateName = 'Confluence.TeamCalendars.Templates.timelineEventContentWithEventTypeIcon';
}


Confluence.TeamCalendars.Templates.defaultTimelineEventContent = function(opt_data, opt_ignored) {
  return '<div class="timeline-event-content-container"><span data-event-id="' + soy.$$escapeHtml(opt_data.eventId) + '">' + soy.$$escapeHtml(opt_data.title) + '</span></div>';
};
if (goog.DEBUG) {
  Confluence.TeamCalendars.Templates.defaultTimelineEventContent.soyTemplateName = 'Confluence.TeamCalendars.Templates.defaultTimelineEventContent';
}

}catch(e){WRMCB(e)};
;
try {
/* module-key = 'com.atlassian.confluence.extra.team-calendars:calendar-resources', location = 'com/atlassian/confluence/extra/calendar3/components/calendar-subcalendar-subscribe-dialog/calendar-subscribe-dialog.soy' */
// This file was automatically generated from calendar-subscribe-dialog.soy.
// Please don't edit this file by hand.

/**
 * @fileoverview Templates in namespace Confluence.TeamCalendars.Templates.
 */

if (typeof Confluence == 'undefined') { var Confluence = {}; }
if (typeof Confluence.TeamCalendars == 'undefined') { Confluence.TeamCalendars = {}; }
if (typeof Confluence.TeamCalendars.Templates == 'undefined') { Confluence.TeamCalendars.Templates = {}; }


Confluence.TeamCalendars.Templates.subscribeDialog = function(opt_data, opt_ignored) {
  return '<div class="subscribe-to-subcalendar"><div class="aui-message error calendar-error hidden"><p class="title"><span class="aui-icon icon-error"></span><strong>' + soy.$$escapeHtml('Error(s) occurred.') + '</strong></p><div class="error-content"><ul class="error-messages hidden"></ul></div></div><div class="mode"><div id="tc-subscribe-no-search-warning" class="hidden loading"><span>' + soy.$$escapeHtml('The version of Confluence you are using does not allow calendars to be searched. Here is a list of all calendars you may subscribe to.') + '</span><span class="spinner aui-icon aui-icon-wait"></span></div><div class="preamble"><span id="subscribe-intro"></span><span class="spinner aui-icon aui-icon-wait"></span></div><div class="search"><form class="aui"><textarea name="query" class="textarea" rows="1"></textarea></form><span class="spinner aui-icon aui-icon-wait"></span></div></div></div><div class="results"></div>';
};
if (goog.DEBUG) {
  Confluence.TeamCalendars.Templates.subscribeDialog.soyTemplateName = 'Confluence.TeamCalendars.Templates.subscribeDialog';
}

}catch(e){WRMCB(e)};
;
try {
/* module-key = 'com.atlassian.confluence.extra.team-calendars:calendar-resources', location = 'com/atlassian/confluence/extra/calendar3/templates/event-popup-issue.soy' */
// This file was automatically generated from event-popup-issue.soy.
// Please don't edit this file by hand.

/**
 * @fileoverview Templates in namespace Confluence.TeamCalendars.Templates.
 */

if (typeof Confluence == 'undefined') { var Confluence = {}; }
if (typeof Confluence.TeamCalendars == 'undefined') { Confluence.TeamCalendars = {}; }
if (typeof Confluence.TeamCalendars.Templates == 'undefined') { Confluence.TeamCalendars.Templates = {}; }


Confluence.TeamCalendars.Templates.eventPopupIssue = function(opt_data, opt_ignored) {
  return '<div class="event-field labeled-field field-jira-date"><span class="field-label">' + soy.$$escapeHtml(opt_data.event.extraProperties.dateField) + ':</span><div class="field-value">' + ((opt_data.event.extraProperties.resolved == 'true') ? soy.$$escapeHtml(opt_data.event.localizedEndDate) : soy.$$escapeHtml(opt_data.event.extraProperties.jiraIssueDisplayDayDuration)) + '</div></div><div class="event-field labeled-field field-jira-assignee"><span class="field-label">' + soy.$$escapeHtml('Assignee') + ':</span><div class="field-value' + ((opt_data.event.extraProperties.assigneeProfileUrl) ? ' assignee-with-link' : '') + '"><span class="plain-assignee-name">' + soy.$$escapeHtml(opt_data.event.extraProperties.assigneeName) + '</span>' + ((opt_data.event.extraProperties.assigneeProfileUrl) ? '<a class="assignee-profile-link" href="' + soy.$$escapeHtml(opt_data.event.extraProperties.assigneeProfileUrl) + '">' + soy.$$escapeHtml(opt_data.event.extraProperties.assigneeName) + '</a>' : '') + '</div></div><div class="event-field labeled-field field-jira-status"><span class="field-label">' + soy.$$escapeHtml('Status') + ':</span><div class="field-value">' + soy.$$escapeHtml(opt_data.event.extraProperties.statusText) + '</div></div><div class="event-field field-event-links edit-controls"><a class="event-edit edit-control" href="#">' + soy.$$escapeHtml('Edit') + '</a> <span class="event-hyperlink-separator">&middot;</span> <a href="' + soy.$$escapeHtml(opt_data.event.extraProperties.issueLink) + '" class="event-hyperlink" target="_blank">' + soy.$$escapeHtml('View Issue') + '</a></div>';
};
if (goog.DEBUG) {
  Confluence.TeamCalendars.Templates.eventPopupIssue.soyTemplateName = 'Confluence.TeamCalendars.Templates.eventPopupIssue';
}

}catch(e){WRMCB(e)};
;
try {
/* module-key = 'com.atlassian.confluence.extra.team-calendars:calendar-resources', location = 'com/atlassian/confluence/extra/calendar3/templates/event-popup-version.soy' */
// This file was automatically generated from event-popup-version.soy.
// Please don't edit this file by hand.

/**
 * @fileoverview Templates in namespace Confluence.TeamCalendars.Templates.
 */

if (typeof Confluence == 'undefined') { var Confluence = {}; }
if (typeof Confluence.TeamCalendars == 'undefined') { Confluence.TeamCalendars = {}; }
if (typeof Confluence.TeamCalendars.Templates == 'undefined') { Confluence.TeamCalendars.Templates = {}; }


Confluence.TeamCalendars.Templates.eventPopupVersion = function(opt_data, opt_ignored) {
  return '<div class="event-field field-duration"><div class="time"></div><div class="day-duration">' + ((opt_data.event.extraProperties.resolved == 'true') ? soy.$$escapeHtml(opt_data.event.localizedEndDate) : soy.$$escapeHtml(opt_data.event.extraProperties.jiraVersionDisplayDayDuration)) + '</div></div><div class="event-field field-event-links edit-controls"><a class="event-edit edit-control" href="#">' + soy.$$escapeHtml('Edit') + '</a> <span class="event-hyperlink-separator">&middot;</span> <a href="' + soy.$$escapeHtml(opt_data.event.extraProperties.summaryLink) + '" class="event-hyperlink" target="_blank">' + soy.$$escapeHtml('Summary') + '</a> <span class="event-hyperlink-separator">&middot;</span> <a href="' + soy.$$escapeHtml(opt_data.event.extraProperties.viewIssuesLink) + '" class="event-hyperlink" target="_blank">' + soy.$$escapeHtml('View Issues') + '</a> <span class="event-hyperlink-separator">&middot;</span> <a href="' + soy.$$escapeHtml(opt_data.event.extraProperties.releaseNotesLink) + '" class="event-hyperlink" target="_blank">' + soy.$$escapeHtml('Release Notes') + '</a></div>';
};
if (goog.DEBUG) {
  Confluence.TeamCalendars.Templates.eventPopupVersion.soyTemplateName = 'Confluence.TeamCalendars.Templates.eventPopupVersion';
}

}catch(e){WRMCB(e)};
;
try {
/* module-key = 'com.atlassian.confluence.extra.team-calendars:calendar-resources', location = 'com/atlassian/confluence/extra/calendar3/templates/event-popup-sprint.soy' */
// This file was automatically generated from event-popup-sprint.soy.
// Please don't edit this file by hand.

/**
 * @fileoverview Templates in namespace Confluence.TeamCalendars.Templates.
 */

if (typeof Confluence == 'undefined') { var Confluence = {}; }
if (typeof Confluence.TeamCalendars == 'undefined') { Confluence.TeamCalendars = {}; }
if (typeof Confluence.TeamCalendars.Templates == 'undefined') { Confluence.TeamCalendars.Templates = {}; }


Confluence.TeamCalendars.Templates.eventPopupSprint = function(opt_data, opt_ignored) {
  return '<div class="event-field field-duration"><div class="time"></div><div class="all-day-label">' + soy.$$escapeHtml('All day') + '</div></div><div class="event-field field-event-links"><div class="' + ((opt_data.event.extraProperties.sprintHomePageUrl) ? 'with-sprint-homepage' : 'no-sprint-homepage') + '"><a href="' + soy.$$escapeHtml(opt_data.event.extraProperties.viewBoardsUrl) + '" class="event-hyperlink" target="_blank">' + soy.$$escapeHtml('View Sprint') + '</a>' + ((opt_data.event.extraProperties.sprintHomePageUrl) ? '<span class="sprintHomePageUrlContainer"> &middot; <a href="' + soy.$$escapeHtml(opt_data.event.extraProperties.sprintHomePageUrl) + '" class="event-hyperlink" target="_blank">' + soy.$$escapeHtml('Sprint Home Page') + '</a></span>' : '') + '</div></div>';
};
if (goog.DEBUG) {
  Confluence.TeamCalendars.Templates.eventPopupSprint.soyTemplateName = 'Confluence.TeamCalendars.Templates.eventPopupSprint';
}

}catch(e){WRMCB(e)};
;
try {
/* module-key = 'com.atlassian.confluence.extra.team-calendars:calendar-resources', location = 'com/atlassian/confluence/extra/calendar3/templates/event-popup.soy' */
// This file was automatically generated from event-popup.soy.
// Please don't edit this file by hand.

/**
 * @fileoverview Templates in namespace Confluence.TeamCalendars.Templates.
 */

if (typeof Confluence == 'undefined') { var Confluence = {}; }
if (typeof Confluence.TeamCalendars == 'undefined') { Confluence.TeamCalendars = {}; }
if (typeof Confluence.TeamCalendars.Templates == 'undefined') { Confluence.TeamCalendars.Templates = {}; }


Confluence.TeamCalendars.Templates.eventPopup = function(opt_data, opt_ignored) {
  var output = '<div class="event-details-popup ' + soy.$$escapeHtml(opt_data.contextClass) + '"><div class="' + soy.$$escapeHtml(opt_data.event.className) + '"><div class="event-icon-container"><img class="event-icon" src="' + soy.$$escapeHtml(opt_data.event.iconUrl) + '"></div><div class="event-fields"><div class="event-field field-subcalendar-name"><span class="lozenge ' + soy.$$escapeHtml(opt_data.event.colour) + '">' + soy.$$escapeHtml(opt_data.event.subCalendarDisplayName) + '</span><div class="name"><a href="' + soy.$$escapeHtml(opt_data.baseUrl) + '/calendar/previewcalendar.action?subCalendarId=' + soy.$$escapeHtml(opt_data.event.subCalendarId) + '">' + soy.$$escapeHtml(opt_data.event.subCalendarDisplayName) + '</a></div></div><div class="event-field field-summary"><span class="field-title"> ' + soy.$$escapeHtml(opt_data.event.title) + '</span>' + ((opt_data.event.period) ? '<span class="event-field reminder-icon" title="' + soy.$$escapeHtml(opt_data.event.period) + '"></span>' : '') + '</div>' + ((opt_data.event.where) ? '<div class="event-field field-location">' + soy.$$escapeHtml(opt_data.event.where) + '</div>' : '');
  if (opt_data.event.inviteesSupported && opt_data.event.invitees && opt_data.event.invitees.length > 1) {
    output += '<div class="event-field field-invitees">';
    var inviteeList36 = opt_data.event.invitees;
    var inviteeListLen36 = inviteeList36.length;
    for (var inviteeIndex36 = 0; inviteeIndex36 < inviteeListLen36; inviteeIndex36++) {
      var inviteeData36 = inviteeList36[inviteeIndex36];
      output += '<img class="invitee" src="' + soy.$$escapeHtml(inviteeData36.avatarIconUrl) + '" title="' + soy.$$escapeHtml(inviteeData36.displayName) + '">';
    }
    output += '</div>';
  }
  if (opt_data.event.workingUrl) {
    output += '<div class="event-field field-link">';
    var eventLink__soy47 = '' + ((! opt_data.event.urlAlias) ? soy.$$escapeHtml(opt_data.event.workingUrl) : soy.$$escapeHtml(opt_data.event.urlAlias));
    output += '<a class="event-link" href="' + soy.$$escapeHtml(opt_data.event.workingUrl) + '" title="' + soy.$$escapeHtml(eventLink__soy47) + '">' + soy.$$escapeHtml(eventLink__soy47) + '</a></div>';
  }
  output += (opt_data.event.description) ? '<div class="event-field field-description">' + ((opt_data.event.descriptionRendered) ? soy.$$filterNoAutoescape(opt_data.event.descriptionRendered) : soy.$$escapeHtml(opt_data.event.description)) + '</div>' : '';
  if (opt_data.event.extraPropertiesTemplate) {
    output += '<div class="extra-fields">';
    switch (opt_data.event.extraPropertiesTemplate) {
      case 'event-details-version':
        output += Confluence.TeamCalendars.Templates.eventPopupVersion(opt_data);
        break;
      case 'event-details-issue':
        output += Confluence.TeamCalendars.Templates.eventPopupIssue(opt_data);
        break;
      case 'event-details-sprint':
        output += Confluence.TeamCalendars.Templates.eventPopupSprint(opt_data);
        break;
    }
    output += '</div>';
  }
  output += '<div class="event-field field-duration"><div class="time"></div><div class="all-day-label">' + soy.$$escapeHtml('All day') + '</div></div><div class="event-field field-event-links edit-controls"><a class="event-edit edit-control" href="#">' + soy.$$escapeHtml('Edit') + '</a> <span class="event-hyperlink-separator">&middot;</span> <a class="event-delete edit-control" href="#">' + soy.$$escapeHtml('Delete') + '</a></div></div></div></div>';
  return output;
};
if (goog.DEBUG) {
  Confluence.TeamCalendars.Templates.eventPopup.soyTemplateName = 'Confluence.TeamCalendars.Templates.eventPopup';
}

}catch(e){WRMCB(e)};
;
try {
/* module-key = 'com.atlassian.confluence.extra.team-calendars:calendar-resources', location = 'com/atlassian/confluence/extra/calendar3/templates/upcoming-events.soy' */
// This file was automatically generated from upcoming-events.soy.
// Please don't edit this file by hand.

/**
 * @fileoverview Templates in namespace Confluence.TeamCalendars.Templates.
 */

if (typeof Confluence == 'undefined') { var Confluence = {}; }
if (typeof Confluence.TeamCalendars == 'undefined') { Confluence.TeamCalendars = {}; }
if (typeof Confluence.TeamCalendars.Templates == 'undefined') { Confluence.TeamCalendars.Templates = {}; }


Confluence.TeamCalendars.Templates.upcomingEvents = function(opt_data, opt_ignored) {
  var output = '<div class="dashboard-calendar"><div class="events-container"><ul class="group-list">';
  var eventGroupList4 = opt_data.eventGroups;
  var eventGroupListLen4 = eventGroupList4.length;
  for (var eventGroupIndex4 = 0; eventGroupIndex4 < eventGroupListLen4; eventGroupIndex4++) {
    var eventGroupData4 = eventGroupList4[eventGroupIndex4];
    output += '<li class="event-group"><div class="group-details-container"><div class="group-details"><div class="group-headline' + ((eventGroupData4.today == true) ? ' today-headline' : '') + '"><span class="other-days" data-group-date="' + soy.$$escapeHtml(eventGroupData4.dateFormatKey) + '">' + soy.$$escapeHtml('Formatting...') + '</span><span class="today">' + soy.$$escapeHtml('Today') + '</span></div><ul class="events">';
    var eventList16 = eventGroupData4.events;
    var eventListLen16 = eventList16.length;
    for (var eventIndex16 = 0; eventIndex16 < eventListLen16; eventIndex16++) {
      var eventData16 = eventList16[eventIndex16];
      output += '<li data-event-id="' + soy.$$escapeHtml(eventData16.id) + '" data-sub-calendar-name="' + soy.$$escapeHtml(eventData16.subCalendar.name) + '"><div class="event-details"><div class="event-subcalendar ' + soy.$$escapeHtml(eventData16.subCalendar.color) + '" title="' + soy.$$escapeHtml(eventData16.subCalendar.name) + '"></div>' + ((eventData16.mediumIconUrl) ? '<img class="event-icon" src="' + soy.$$escapeHtml(eventData16.mediumIconUrl) + '">' : '<img class="event-icon" src="' + soy.$$escapeHtml(eventData16.iconUrl) + '">') + '<strong class="event-name">' + soy.$$escapeHtml(eventData16.title) + '</strong><span class="event-subcalendar-name">' + ((eventData16.parentSubCalendar) ? soy.$$escapeHtml(eventData16.parentSubCalendar.name) : soy.$$escapeHtml(eventData16.subCalendar.name)) + '</span><div class="event-description">' + ((eventData16.descriptionRendered) ? '<span class="ellipsis_text">' + soy.$$filterNoAutoescape(eventData16.descriptionRendered) + '</span>' : (eventData16.description) ? '<span class="ellipsis_text">' + soy.$$escapeHtml(eventData16.description) + '</span>' : '') + '</div></div><div class="clear"></div>' + ((eventIndex16 == eventListLen16 - 1) ? (0 < eventGroupData4.hiddenEventsCount) ? (1 < eventGroupData4.hiddenEventsCount) ? '<div class="x-more-events">' + soy.$$escapeHtml(AJS.format('And {0} more events...',eventGroupData4.hiddenEventsCount)) + '</div>' : '<div class="x-more-events">' + soy.$$escapeHtml(AJS.format('And {0} more event...',eventGroupData4.hiddenEventsCount)) + '</div>' : '' : '') + '</li>';
    }
    output += '</ul></div></div><div class="group-date' + ((eventGroupData4.today) ? ' first-group-date' : '') + '"><div class="day" data-group-date="' + soy.$$escapeHtml(eventGroupData4.dateFormatKey) + '">' + soy.$$escapeHtml(eventGroupData4.groupDay) + '</div><div class="month" data-group-date="' + soy.$$escapeHtml(eventGroupData4.dateFormatKey) + '"></div></div><div class="event-group-clear"></div></li>';
  }
  output += '</ul><a href="#" class="more-events hidden">' + soy.$$escapeHtml('More') + '</a></div></div>';
  return output;
};
if (goog.DEBUG) {
  Confluence.TeamCalendars.Templates.upcomingEvents.soyTemplateName = 'Confluence.TeamCalendars.Templates.upcomingEvents';
}

}catch(e){WRMCB(e)};
;
try {
/* module-key = 'com.atlassian.confluence.extra.team-calendars:calendar-resources', location = 'com/atlassian/confluence/extra/calendar3/components/load-favicon/load-favicon.js' */
define("tc/load-favicon",["jquery"],function(a){return{render:function(){var b=(new Date()).getDate()+"";this._loadFaviconCalendar(b)},_loadFaviconCalendar:function(c){var d=a("<canvas />"),f=a("<img />"),b=a("link[rel~='icon']");if(typeof d.get(0).getContext==="function"){if(!b){b=document.createElement("link");b.setAttribute("rel","shortcut icon");b.type="image/x-icon";document.head.appendChild(b)}d.attr({width:16,height:16});var e=d.get(0).getContext("2d");f.load(function(){e.drawImage(this,0,0);e.font='bold 10px "helvetica", sans-serif';e.textAlign="center";e.fillStyle="gray";e.fillText(c,8,13);var g=!!navigator.userAgent.match(/Trident\/7.0/)&&!!navigator.userAgent.match(/.NET4.0E/);b.each(function(){if(g){this.href=Confluence.getContextPath()+"/download/resources/com.atlassian.confluence.extra.team-calendars:calendar-resources/img/logo_16.png"}else{this.href=d.get(0).toDataURL("image/png")}});a("head").append(b)});f.attr({src:Confluence.getContextPath()+"/download/resources/com.atlassian.confluence.extra.team-calendars:calendar-resources/img/calendar-favicon.png"})}}}});
}catch(e){WRMCB(e)};
;
try {
/* module-key = 'com.atlassian.confluence.extra.team-calendars:calendar-resources', location = 'com/atlassian/confluence/extra/calendar3/js/upcoming-events.js' */
jQuery(function(b){if(b("#dashboard-get-started").length>0){b("#dashboard-get-started").parent().after(b(".dashboard-calendar-container").children())}else{b(".welcome-message").after(b(".dashboard-calendar-container").children())}var a={initializeAddLater:function(c,e){var d=function(){b.ajax({cache:false,data:{messageKey:"MESSAGE_KEY_FULL_SIZED_EMPTY_UPCOMING_EVENTS"},error:function(){b(".show-small-sad-calendar-error",c).removeClass("hidden")},type:"DELETE",timeout:Confluence.TeamCalendars.ajaxTimeout,url:b("#confluence-context-path").attr("content")+"/rest/calendar-services/1.0/calendar/preferences/messagekey.json"})};b(".add-later",c).click(function(){var f=b(".sad-calendar",c);f.fadeTo(e,0,function(){f.addClass("small-sad-calendar").fadeTo(e,1);d()});return false})},initialize:function(c){this.initializeAddLater(c,"fast")}};b(".dashboard-calendar").each(function(){a.initialize(b(this))})});
}catch(e){WRMCB(e)};