"use strict";(self.webpackChunkamplifund=self.webpackChunkamplifund||[]).push([[5899],{64807(e,t,s){var n=s(51786),i=s.n(n),o=(s(86458),s(35380),s(74692));let d=0;class r{constructor(e,t){this.parent=null,this.title=e.title,this.url=e.url,this.isModal=e.isModal,this.elementId=e.elementId,this.useOldSemanticModalBinding=e.useOldSemanticModalBinding,this.depth=t,this.id="topnav-item-"+d++,this.submenuId=`${this.id}-submenu`,this.htmlId=this.elementId||this.id,this.tabIndex=(0,n.observable)(-1),this.isExpanded=(0,n.observable)(!1),this.childNodes=(0,n.observableArray)(e.childNodes.map((e=>{const t=new r(e,this.depth+1);return t.parent=this,t}))),this.isScrollable=this.hasChildren&&!this.childNodes().find((e=>e.hasChildren)),this.isSearchable=this.isTopLevel&&this.isScrollable&&this.childNodes().length>15,this.isWorkflowActionNode=e.isWorkflowActionNode,this.isDirectlyAssignedWorkFlowAction=e.isDirectlyAssignedWorkFlowAction,this.itemClass=(0,n.pureComputed)((()=>this.isWorkflowActionNode&&!this.isDirectlyAssignedWorkFlowAction?"item unassigned":"item")),this.ariaLabel=(0,n.pureComputed)((()=>this.isWorkflowActionNode&&!this.isDirectlyAssignedWorkFlowAction?`unassigned action: ${this.title}`:null)),this.ariaExpanded=(0,n.pureComputed)((()=>this.hasChildren?this.isExpanded()?"true":"false":null))}get hasChildren(){return!!this.childNodes()&&this.childNodes().length>0}get isTopLevel(){return 0===this.depth}get topLevelAncestor(){let e=this;for(;null!==e.parent;)e=e.parent;return e}}class a{constructor(e){this.depth=0,this.handleKeydownEventBinding=(e,t)=>this.handleKeydown(t),this.nodes=(0,n.observableArray)(e.nodes.map((e=>new r(e,this.depth)))),this.nodes().length>0&&this.nodes()[0].tabIndex(0)}handleKeydown(e){const t=e.currentTarget,s=i().dataFor(t);if(void 0===s)return!0;const n=null===s.parent?this.nodes():s.parent.childNodes(),o=n.indexOf(s);if(-1===o)return!0;switch(e.key){case"ArrowRight":return s.isTopLevel?(this.activateMenubarItem(n[(o+1)%n.length]),e.preventDefault(),!1):!s.hasChildren||(this.openSubmenuAndFocusFirst(s),e.preventDefault(),!1);case"ArrowLeft":return s.isTopLevel?(this.activateMenubarItem(n[(o-1+n.length)%n.length]),e.preventDefault(),!1):(this.closeSubmenuAndFocusParent(s),e.preventDefault(),!1);case"Home":return s.isTopLevel?this.activateMenubarItem(n[0]):this.focusNode(n[0]),e.preventDefault(),!1;case"End":{const t=n[n.length-1];return s.isTopLevel?this.activateMenubarItem(t):this.focusNode(t),e.preventDefault(),!1}case"ArrowDown":case"Enter":case" ":return s.isTopLevel&&s.hasChildren?(this.openSubmenuAndFocusFirst(s),e.preventDefault(),!1):s.isTopLevel||"ArrowDown"!==e.key?!!(s.hasChildren||"Enter"!==e.key&&" "!==e.key)||(e.preventDefault(),e.stopPropagation(),t.click(),!1):(this.focusNode(n[(o+1)%n.length]),e.preventDefault(),!1);case"ArrowUp":return!!s.isTopLevel||(this.focusNode(n[(o-1+n.length)%n.length]),e.preventDefault(),!1);case"Escape":return s.isTopLevel?!s.hasChildren||!s.isExpanded()||(this.closeSubmenu(s),e.preventDefault(),!1):(this.closeSubmenuAndFocusParent(s),e.preventDefault(),!1);case"Tab":return this.closeAllSubmenus(),!0;default:return!0}}activateMenubarItem(e){this.updateRovingTabIndex(e),this.focusNode(e)}updateRovingTabIndex(e){this.nodes().forEach((t=>{t.tabIndex(t===e?0:-1)}))}focusNode(e){var t;null===(t=document.getElementById(e.htmlId))||void 0===t||t.focus({preventScroll:!0})}openSubmenuAndFocusFirst(e){this.openSubmenu(e);const t=e.childNodes();t.length>0&&window.setTimeout((()=>this.focusNode(t[0])),100)}openSubmenu(e){if(e.hasChildren){e.isExpanded(!0);try{const t=o(`#${e.htmlId}`).closest(".ui.dropdown");t.dropdown("show"),t.find(".menu .item.selected, .menu .item.active").removeClass("selected active")}catch{}}}closeSubmenu(e){if(e.hasChildren){e.isExpanded(!1);try{o(`#${e.htmlId}`).closest(".ui.dropdown").dropdown("hide")}catch{}}}closeSubmenuAndFocusParent(e){const t=e.parent;null!==t&&(this.closeSubmenu(t),this.focusNode(t))}closeAllSubmenus(){this.nodes().forEach((e=>{e.hasChildren&&e.isExpanded()&&this.closeSubmenu(e)}))}updateBackgroundForScreenReader(){const e=this.nodes().some((e=>e.hasChildren&&e.isExpanded()));document.querySelectorAll(".af-body, .af-page > .af-empty").forEach((t=>{e?t.setAttribute("aria-hidden","true"):t.removeAttribute("aria-hidden")}))}}o((()=>{const e=new a(JSON.parse(o("#TopNavModelJson").val()));(0,n.applyBindings)(e,document.getElementById("TopNav")),o("#TopNav .ui.dropdown").each((function(){const t=o(this),s=t.children("a").first()[0],n=void 0!==s?i().dataFor(s):void 0;t.dropdown({allowTab:!1,action:"nothing",toggleSubMenusOn:"hover",fullTextSearch:!0,transition:"none",selectOnKeydown:!1,onShow:function(){null==n||n.isExpanded(!0),o(this).find(".menu .item.selected, .menu .item.active").removeClass("selected active"),e.updateBackgroundForScreenReader()},onHide:()=>{null==n||n.isExpanded(!1),e.updateBackgroundForScreenReader()}})}))}))}},e=>{e.O(0,[4121],(()=>e(e.s=64807))),e.O()}]); //# sourceMappingURL=topNav.06bc07afcd86edbc6474.js.map