'use strict';dotclear.ready(()=>{dotclear.pageTabs=function(startTab,opts){const defaults={containerClass:'part-tabs',partPrefix:'part-',contentClass:'multi-part',activeClass:'part-tabs-active',idTabPrefix:'part-tabs-',};const createTabs=(options)=>{const contentElements=document.querySelectorAll(`.${options.contentClass}`);const lis=[];for(const content of contentElements){content.style.display='none';const li=document.createElement('li');li.setAttribute('id',`${options.idTabPrefix}${content.id}`);const a=document.createElement('a');a.setAttribute('href',`#${content.id}`);a.textContent=content.title;if(content.dataset.pageTabsInfo!==undefined&&content.dataset.pageTabsInfo){const span=document.createElement('span');span.textContent=content.dataset.pageTabsInfo;a.append(span);}
li.append(a);if(content.dataset.pageTabsClass!==undefined&&content.dataset.pageTabsClass){li.classList.add(content.dataset.pageTabsClass);}
lis.push(li);content.id=`${options.partPrefix}${content.id}`;content.title='';}
const ul=document.createElement('ul');ul.append(...lis);const container=document.createElement('div');container.className=options.containerClass;container.append(ul);const firstContent=document.querySelector(`.${options.contentClass}`);if(firstContent){firstContent.parentNode.insertBefore(container,firstContent);}};const getHash=(href='')=>href.replace(/.*#/,'');const clickTab=(tab,options)=>{const tabsContainer=document.querySelector(`.${options.containerClass} ul`);const defaultTab=tabsContainer.querySelector('li a')?.getAttribute('href')||'';const anchor=tab||getHash(defaultTab);const tabElement=tabsContainer.querySelector(`li a[href="#${anchor}"]`)?.parentElement;if(tabElement){tabElement.click();}};const getLocationHash=()=>{const hashParts=getHash(globalThis.location.hash).split('.');return hashParts[0];};const getLocationSubhash=()=>{const hashParts=getHash(globalThis.location.hash).split('.');return hashParts[1];};const options={...defaults,...opts};let activeTab=startTab||'';const hash=getLocationHash();const subhash=getLocationSubhash();if(hash){globalThis.scrollTo(0,0);activeTab=hash;}else if(!activeTab){const firstPart=document.querySelector(`.${options.contentClass}`);activeTab=firstPart?firstPart.id:'';}
createTabs(options);const tabsContainer=document.querySelector(`.${options.containerClass} ul`);if(tabsContainer){tabsContainer.addEventListener('click',(event)=>{const target=event.target.closest('li');if(!target||target.classList.contains(options.activeClass))return;const activeTabElement=tabsContainer.querySelector(`li.${options.activeClass}`);if(activeTabElement){activeTabElement.removeAttribute('aria-current');activeTabElement.classList.remove(options.activeClass);}
target.classList.add(options.activeClass);target.setAttribute('aria-current','true');const activeContent=document.querySelector(`.${options.contentClass}.active`);if(activeContent){activeContent.classList.remove('active');activeContent.style.display='none';}
const partToActivate=document.getElementById(`${options.partPrefix}${getHash(target.querySelector('a').getAttribute('href'))}`,);if(!partToActivate){return;}
partToActivate.classList.add('active');partToActivate.style.display='';if(!partToActivate.classList.contains('loaded')){partToActivate.dispatchEvent(new Event('onetabload'));partToActivate.classList.add('loaded');}
partToActivate.dispatchEvent(new Event('tabload'));});globalThis.addEventListener('hashchange',()=>{clickTab(getLocationHash(),options);});clickTab(activeTab,options);}
if(subhash){const element=document.getElementById(subhash);if(element){if(!element.checkVisibility()){const findFirstVisibleParent=(element)=>{let parent=element.parentElement;while(parent){if(parent.checkVisibility?.())return parent;parent=parent.parentElement;}
return null;};const parent=findFirstVisibleParent(element);if(parent){const button=parent.querySelector('.details-cmd');if(button)button.click();}}
element.scrollIntoView();element.focus();element.classList.add('focus');element.addEventListener('focusout',()=>{element.classList.remove('focus');},{once:true},);}}
return this;};});