ips.templates.set('menuManager.temporaryDropdown',"	<li class='ipsMenu_item {{#selected}}cMenuManager_active{{/selected}}' data-itemID='temp' data-role='menuItem'>		<span>			{{#lang}}menuManagerNewItem{{/lang}}			<ul class='cMenuManager_tools'>				<li>					<a href='#' data-action='removeItem' data-ipsTooltip title='{{#lang}}menuManagerRemoveItem{{/lang}}'>						<i class='fa-solid fa-xmark'></i></i>					</a>				</li>			</ul>		</span>	</li>");ips.templates.set('menuManager.temporaryMenuItem',"	<li id='menu_{{id}}' data-role='menuNode'>		<div class='cMenuManager_leaf {{#selected}}cMenuManager_active{{/selected}}' data-itemID='temp' data-role='menuItem'>			<h3 class='cMenuManager_leafTitle'>{{#lang}}menuManagerNewItem{{/lang}}</h3>			<ul class='cMenuManager_tools'>				<li>					<a href='#' data-action='removeItem' data-ipsTooltip title='{{#lang}}menuManagerRemoveItem{{/lang}}'>						<i class='fa-solid fa-xmark'></i></i>					</a>				</li>			</ul>		</div>	</li>");ips.templates.set('menuManager.emptyList',"	<li class='cMenuManager_emptyList i-color_soft i-text-align_center'>{{#lang}}menuManagerEmptyList{{/lang}}</li>");;
;(function($){"use strict";ips.controller.register('core.admin.system.upgradeManualQuery',{initialize:function(){this.scope.find('[data-role="runManualButton"]').css({'display':'inline'});this.on('click','[data-action="runQuery"]',this.runQuery);},runQuery:function(e){this.scope.find('[data-role="querySuccessButtons"]').hide();this.scope.css({'opacity':"0.5"}).addClass('ipsLoading');ips.getAjax()(this.scope.attr('data-url'),{timeout:30000}).done(function(response){if(response.runManualQuery){this.scope.find('[data-action="redirectContinue"]').trigger('click');}else{this.runQueryFailed();}}.bind(this)).fail(function(a,b,c){this.runQueryFailed();}.bind(this));},runQueryFailed:function(){this.scope.css({'opacity':"1"}).removeClass('ipsLoading');this.scope.find('[data-role="querySuccessButtons"]').show();this.scope.find('[data-role="runManualButton"]').hide();ips.ui.alert.show({type:'alert',icon:'warn',message:ips.getString('delta_upgrade_run_manual_query_fail_title'),subText:ips.getString('delta_upgrade_run_manual_query_fail_desc')});}});}(jQuery));;
;(function($){"use strict";ips.controller.register('core.admin.system.settings',{initialize:function(){this.on('change','input[name=datastore_method]',this.datastoreChanged);this.on('change','input[name=cache_method]',this.cacheChanged);this.setup();},setup:function(){if($('input[name=datastore_method]:checked').val()=='Redis'){$("input[name=cache_method][value=Redis]").prop("checked",true);$('#form_cache_method').slideUp();$('li[id^=redis]').slideDown();}},cacheChanged:function(e,data){var value=$(e.currentTarget).val();if(value=='Redis'){$("input[name=datastore_method][value=Redis]").prop("checked",true);$('#form_cache_method,#id_datastore_filesystem_path').slideUp();$('li[id^=redis]').slideDown();}else{$('#form_cache_method').slideDown();$('li[id^=redis]').slideUp();if($('input[name=datastore_method]:checked').val()=="Redis"){$("input[name=datastore_method][value=FileSystem]").prop("checked",true);}}},datastoreChanged:function(e,data){var value=$(e.currentTarget).val();if(value=='Redis'){$("input[name=cache_method][value=Redis]").prop("checked",true);$('#form_cache_method').slideUp();$('li[id^=redis]').slideDown();}else{$('#form_cache_method').slideDown();$('li[id^=redis]').slideUp();if($('input[name=cache_method]:checked').val()=="Redis"){$("input[name=cache_method][value=None]").prop("checked",true);}}}});}(jQuery));;
;(function($){"use strict";ips.controller.register('core.admin.system.menuManager',{_hasChanges:false,initialize:function(){this.on('sortstop','.ipsTree_rows > .ipsTree',this.afterSort);this._hasChanges=ips.getSetting('menuChanged');this.togglePublish();},afterSort:function(event,ui){this._hasChanges=true;this.togglePublish();},togglePublish:function(){if(this._hasChanges){$('#acpPageHeader > .ipsMessage').fadeIn();}else{$('#acpPageHeader > .ipsMessage').hide();}}});}(jQuery));;
;(function($){"use strict";ips.controller.register('core.admin.system.login',{initialize:function(){this.on('tabChanged',this.tabChanged);this.on('click','[data-action="upgradeWarningContinue"]',this.upgradeWarningContinue);this.setup();},setup:function(){this.scope.find("#elTabContent .ipsTabs__panel:visible").first().find('input[type="text"]').first().trigger('focus');},tabChanged:function(e,data){ips.utils.cookie.set('acpLoginMethod',data.tabID,1);},upgradeWarningContinue:function(e,data){e.preventDefault();$(this.scope).find('[data-role="upgradeWarning"]').hide();$(this.scope).find('[data-role="loginForms"]').removeClass('ipsHide').show();}});}(jQuery));;
;(function($){"use strict";ips.controller.register('core.admin.system.codeHook',{codeMirror:null,initialize:function(){this.on('click','[data-codeToInject]',this._itemClick);},_itemClick:function(e){var codeMirror=$(this.scope).find('textarea').data('CodeMirrorInstance');var regex=new RegExp(JSON.parse($(e.currentTarget).attr('data-signature')));var found=false;var lastLine=codeMirror.doc.lineCount()-1;codeMirror.doc.eachLine(function(line){if(line.text.match(regex)){found=true;codeMirror.setSelection({line:codeMirror.doc.getLineNumber(line),ch:0},{line:codeMirror.doc.getLineNumber(line),ch:line.text.length});codeMirror.scrollIntoView({line:codeMirror.doc.getLineNumber(line),ch:0});}
if(line.text.match(/^\s*}\s*$/)){lastLine=codeMirror.doc.getLineNumber(line);}});if(!found){codeMirror.doc.replaceRange(JSON.parse($(e.currentTarget).attr('data-codeToInject')),{line:lastLine-1,chr:0},{line:lastLine-1,chr:0});codeMirror.scrollIntoView({line:codeMirror.doc.lineCount(),ch:0});}}});}(jQuery));;
;(function($){"use strict";ips.controller.register('core.admin.system.autoupgradetimer',{initialize:function(){var self=this;var secondsRemaining=60*5;if(ips.getSetting('cloud2')){secondsRemaining=15;}
var interval=setInterval(function(){secondsRemaining--;if(secondsRemaining<1){clearInterval(interval);self.scope.find('[data-role="counter-wrapper"]').hide();self.scope.find('[data-role="continue-button"]').show();}
else
{var minutes=Math.floor(secondsRemaining/60);var seconds=secondsRemaining%60;self.scope.find('[data-role="counter"]').html(minutes+':'+((seconds>=10)?seconds:'0'+seconds));}},1000);}});}(jQuery));;
;(function($){"use strict";ips.controller.register('core.admin.system.apiPermissions',{initialize:function(){this.on('click','[data-action="toggleSection"]',this.toggleSection);this.on('click','.cApiPermissions [data-action="checkAll"]',this.checkAll);this.on('click','.cApiPermissions [data-action="checkNone"]',this.checkNone);this.on('click','.cApiPermissions_header [data-action="checkAll"]',this.checkAllHeader);this.on('click','.cApiPermissions_header [data-action="checkNone"]',this.checkNoneHeader);this.setup();},setup:function(){var self=this;var sections=this.scope.find('.cApiPermissions > li');sections.each(function(){self._calculatedCheckedEndpoints($(this));});},toggleSection:function(e){var header=$(e.currentTarget).parent();if(header.hasClass('cApiPermissions_open')){this._collapseSection(header);}else{this._expandSection(header);}},checkAllHeader:function(e){e.preventDefault();var self=this;var header=$(e.currentTarget).closest('.cApiPermissions_header');var sections=header.next('.cApiPermissions').find('> li');sections.each(function(){var next=$(this).find('> ul');if(!next.is(':visible')){next.animationComplete(function(){setTimeout(function(){self._togglePermissions(true,next);},300);});self._expandSection($(this));}else{self._togglePermissions(true,next);}})},checkNoneHeader:function(e){e.preventDefault();var self=this;var header=$(e.currentTarget).closest('.cApiPermissions_header');var sections=header.next('.cApiPermissions').find('> li');sections.each(function(){var next=$(this).find('> ul');if(!next.is(':visible')){next.animationComplete(function(){setTimeout(function(){self._togglePermissions(false,next);},300);});self._expandSection($(this));}else{self._togglePermissions(false,next);}})},checkAll:function(e){e.preventDefault();var self=this;var header=$(e.currentTarget).parents('li').first();var next=header.find('> ul');if(!next.is(':visible')){next.animationComplete(function(){setTimeout(function(){self._togglePermissions(true,next);},300);});this._expandSection(header);}else{this._togglePermissions(true,next);}},checkNone:function(e){e.preventDefault();var self=this;var header=$(e.currentTarget).parents('li').first();var next=header.find('> ul');if(!next.is(':visible')){next.animationComplete(function(){setTimeout(function(){self._togglePermissions(false,next);},300);});this._expandSection(header);}else{this._togglePermissions(false,next);}},_calculatedCheckedEndpoints:function(section){var totalEndpoints=section.find('input[name*="access"]');var checkedEndpoints=totalEndpoints.filter(':checked');var endpointSpan=section.find('[data-role="endpointOverview"]');if(section.hasClass('cApiPermissions_open')){endpointSpan.hide();}else{var text=ips.getString('apiEndpoints_all');if(!checkedEndpoints.length){text=ips.getString('apiEndpoints_none');}else if(totalEndpoints.length!==checkedEndpoints.length){text=ips.pluralize(ips.getString('apiEndpoints_some',{checked:checkedEndpoints.length}),totalEndpoints.length);}
endpointSpan.text(text).show();}},_togglePermissions:function(state,container){container.find('input[type="checkbox"]:not( [disabled] )').prop('checked',state).trigger('change');},_expandSection:function(section){var next=section.find('> ul');section.addClass('cApiPermissions_open').removeClass('cApiPermissions_closed');ips.utils.anim.go('fadeInDown fast',next);this._calculatedCheckedEndpoints(section);},_collapseSection:function(section){section.removeClass('cApiPermissions_open').addClass('cApiPermissions_closed');this._calculatedCheckedEndpoints(section);},});}(jQuery));;
;(function($){"use strict";ips.controller.register('core.admin.system.api',{initialize:function(){this.on('click','[data-action="showEndpoint"]',this.showEndpoint);},showEndpoint:function(e){e.preventDefault();var self=this;var url=$(e.currentTarget).attr('href');this.scope.find('.cApiTree_activeNode').removeClass('cApiTree_activeNode');$(e.currentTarget).parent('li').addClass('cApiTree_activeNode');this.scope.find('[data-role="referenceContainer"]').html($('<div/>').addClass('ipsLoading').css({height:'300px'}));ips.getAjax()(url).done(function(response){self.scope.find('[data-role="referenceContainer"]').html(response)}).fail(function(){window.location=url;});this.scope.find('[data-role="referenceContainer"]')[0].scrollIntoView({behavior:"smooth"});}});}(jQuery));;