@utahdts/utah-design-system-header
Version:
Utah Header for the Utah Design System
475 lines • 90.8 kB
JavaScript
(function(O,y){typeof exports=="object"&&typeof module<"u"?y(exports):typeof define=="function"&&define.amd?define(["exports"],y):(O=typeof globalThis<"u"?globalThis:O||self,y(O["@utahdts/utah-design-system-header"]={}))})(this,(function(O){"use strict";const y={FLYOUT:"flyout",INLINE:"inline",MEGA_MENU:"mega-menu",PLAIN:"plain"},re={BOTTOM:"bottom",BOTTOM_START:"bottom-start",BOTTOM_END:"bottom-end",LEFT:"left",LEFT_START:"left-start",LEFT_END:"left-end",RIGHT:"right",RIGHT_START:"right-start",RIGHT_END:"right-end",TOP:"top",TOP_START:"top-start",TOP_END:"top-end"},Be={HEADER_LOADED:"utahHeaderLoaded",HEADER_UNLOADED:"utahHeaderUnloaded"},se={SMALL:"SMALL",MEDIUM:"MEDIUM",LARGE:"LARGE"},on=`/* @media is never in scope for --variables, so this is the only way to solve this. :-( */
@media screen and (max-width: media-size__tablet-landscape__PLACEHOLDER) {
/* put your media query here for tablet landscape */
.utah-design-system .search-modal__input[type=text] {
width: 75vw;
}
}
@media screen and (max-width: media-size__tablet-portrait__PLACEHOLDER) {
.utds-header-desktop--hidden {
display: flex !important;
}
.utds-header-mobile--hidden {
display: none !important;
}
.utds-header {
height: 60px;
padding: var(--spacing-xs) var(--spacing);
}
.utds-title-wrapper {
font-size: var(--font-size-xl);
}
.utds-citizen-experience-wrapper {
display: none;
}
.utds-citizen-experience-wrapper--mobile {
display: flex;
}
.utah-design-system .main-menu__wrapper {
padding: 0 var(--spacing);
/* The utah id button is this tall, but without it, the menu doesn't fill the space up to the mobile menu content popup */
min-height: 46px;
}
.utah-design-system .main-menu__nav {
display: none;
}
.utah-design-system.utds-header-mobile-menu,
.utah-design-system .utds-header-mobile__utah-id-wrapper {
display: block;
}
.utah-design-system .icon-button.main-menu__hamburger,
.utah-design-system .utds-header-mobile__vip-action-items--left,
.utah-design-system .utds-header-mobile__vip-action-items--right,
.utah-design-system .main-menu__search-placeholder {
display: flex;
}
.utah-design-system .search-modal__input[type=text] {
width: 80vw;
padding: var(--spacing) var(--spacing) var(--spacing) var(--spacing-3xl);
}
.utah-design-system .search-modal__button-wrapper {
right: unset;
left: 50%;
transform: translateX(-50%) translateY(110%);
}
.utah-design-system .search-modal__button.button--solid.button--primary-color {
border-color: white;
width: max-content;
}
.utah-design-system .utds-official-website-popup__content {
flex-wrap: wrap;
gap: var(--spacing-l);
}
.utah-design-system .utds-official-website-popup__col {
width: 100%;
}
.utah-design-system .utds-official-website-popup__address-bar {
width: auto;
background-size: contain;
background-repeat: no-repeat;
}
.color-example {
flex-direction: column;
}
.color-example > div:not(:last-child) {
margin-bottom: var(--spacing-l);
}
.search-page {
.search-modal__form {
margin-bottom: var(--spacing-4xl);
}
.search-modal__input[type=text] {
padding: var(--spacing) var(--spacing) var(--spacing) var(--spacing-3xl);
}
}
}
@media screen and (max-width: media-size__mobile__PLACEHOLDER) {
/* put your media query here for mobile */
}
`;function f(e){return`.${(Array.isArray(e)?e:[e]).join(".")}`}const r={UTAH_DESIGN_SYSTEM:"utah-design-system",HEADER:"utds-header",FOOTER:"utds-footer",ICON_BUTTON:"icon-button",CSS_HEADER_MEDIA_TAG_ID:"cssHeaderMediaTag",IS_CLOSED:"is-closed",IS_OPEN:"is-open",VISUALLY_HIDDEN:"visually-hidden",MEDIA_SIZE__MOBILE__PLACEHOLDER:"media-size__mobile__PLACEHOLDER",MEDIA_SIZE__TABLET_LANDSCAPE__PLACEHOLDER:"media-size__tablet-landscape__PLACEHOLDER",MEDIA_SIZE__TABLET_PORTRAIT__PLACEHOLDER:"media-size__tablet-portrait__PLACEHOLDER",ACTION_ITEM:"utds-header-action-item",ACTION_ITEM__ICON_BUTTON:"utds-header-action-item__icon-button",ACTION_ITEM__ICON_BUTTON_TITLE:"utds-header-action-item__icon-button--has-title",ACTION_ITEM__TITLE:"utds-header-action-item__title",BADGE__LABEL:"utds-badge__label",BADGE__VALUE:"utds-badge__value",BADGE_WRAPPER__SMALL:"utds-badge__wrapper--small",BADGE_WRAPPER__ACTION_ITEM:"utds-badge__wrapper--action-item",CITIZEN_EXPERIENCE:"utds-citizen-experience-wrapper",CITIZEN_EXPERIENCE_MOBILE:"utds-citizen-experience-wrapper--mobile",FOOTER_COPYRIGHT_YEAR:"utds-footer__copyright-year",FOOTER_HORIZONTAL_DIVIDER:"utds-footer__horizontal-divider",FOOTER_LINK_PRIVACY_ID:"utds-footer-privacy-link",FOOTER_LINK_TERMS_ID:"utds-footer-terms-link",FOOTER_LINKS:"utds-footer__links",LOGO:"utds-logo-wrapper",LOGO_OFFICIAL_CLOSE_BUTTON:"utds-official-website-popup__close-button",LOGO_OFFICIAL_WRAPPER:"utds-official-website-popup__wrapper",LOGO_SVG:"utah-logo-svg",MAIN_MENU:"main-menu__wrapper",MAIN_MENU__HAMBURGER_ID:"utds-main-menu__hamburger",MAIN_MENU__HAMBURGER_ICON_ID:"utds-main-menu__hamburger-icon",MAIN_MENU__MENU_TOP:"main-menu__menu-top",MAIN_MENU__NAV:"main-menu__nav",MAIN_MENU__OUTER:"main-menu__outer",MAIN_MENU__REMOVED:"main-menu-is-removed",MAIN_MENU__SEARCH:"main-menu__search",MAIN_MENU__TITLE:"main-menu__title",MENU_ITEM__ARROW:"menu-item__menu-arrow",MENU_ITEM__BUTTON_TITLE:"menu-item__button-title",MENU_ITEM__LINK_TITLE:"menu-item__link-title",MENU_ITEM__LINK_TITLE_SPAN:"menu-item__link-title-span",MENU_ITEM__SELECTED:"menu-item--selected",MENU_ITEM__SELECTED_PARENT:"menu-item--selected_parent",MENU_ITEM__TITLE:"menu-item__title",MENU_ITEM__FLY_OUT:"menu-item--fly_out",MENU_ITEM__INLINE:"menu-item--inline",MENU_ITEM__MEGA_MENU:"menu-item--mega-menu",DESKTOP__HIDDEN:"utds-header-desktop--hidden",MOBILE__HIDDEN:"utds-header-mobile--hidden",MOBILE__UTAH_ID:"utds-header-mobile__utah-id-wrapper",ACTION_ITEM__SELECTED:"utds-header-mobile-menu__action-item--selected",MOBILE_MENU:"utds-header-mobile-menu",MOBILE_MENU__ACTION_BAR:"utds-header-mobile-menu__action-bar",MOBILE_MENU__BACKDROP:"utds-header-mobile-menu__backdrop",MOBILE_MENU__CONTENT:"utds-header-mobile-menu__content",MOBILE_MENU__CONTENT_ITEM:"utds-header-mobile-menu__content-item",MOBILE_MENU__LAST_FOCUSABLE:"utds-header-mobile-menu__hidden-last-focusable",MOBILE_MENU__WRAPPER:"utds-header-mobile-menu__wrapper",MOBILE_MENU_ACTON_BAR__HOME_ID:"utds-header-mobile-menu_action-bar__home",MOBILE_MENU_ACTON_BAR__PROFILE_ID:"utds-header-mobile-menu_action-bar__profile",MOBILE_MENU_ACTION_BAR__ACTION_ITEM_WRAPPER:"utds-header-mobile-menu__action-item",VERTICAL_MENU__BUTTON_TITLE:"vertical-menu__button-title",VERTICAL_MENU__CHEVRON:"vertical-menu__chevron",VERTICAL_MENU__DIVIDER:"vertical-menu__divider",VERTICAL_MENU__LINK_TEXT:"vertical-menu__link-text",VERTICAL_MENU__LINK_TITLE:"vertical-menu__link-title",VERTICAL_MENU__PLAIN_TITLE:"vertical-menu__plain-title",VERTICAL_MENU__TITLE:"vertical-menu__title",VERTICAL_MENU_WRAPPER__WRAPPER_TITLE:"vertical-menu__wrapper-title",POPUP__HIDDEN:"popup__wrapper--hidden",POPUP__VISIBLE:"popup__wrapper--visible",POPUP_ARROW:"popup__arrow",POPUP_CONTENT_WRAPPER:"popup__content",POPUP_WRAPPER:"popup__wrapper",SEARCH__SEARCH_BACKDROP:"search-backdrop",SEARCH__SEARCH_CLOSE_BUTTON:"search-modal__close-button",SEARCH__SEARCH_BUTTON:"search-modal__button",SEARCH__SEARCH_BUTTON_WRAPPER:"search-modal__button-wrapper",SEARCH__SEARCH_INPUT:"search-modal__input",SEARCH__SEARCH_MODAL:"search-modal",SKIP_LINK_LINK:"skip-link__link",SKIP_LINK_WRAPPER:"skip-link__wrapper",TITLE__LOGO:"utds-title-wrapper__logo",TITLE__TITLE:"utds-title-wrapper__title",TOOLTIP__ARROW:"tooltip__arrow",TOOLTIP__CONTENT:"tooltip__content",TOOLTIP__WRAPPER:"tooltip__wrapper",TOOLTIP__WRAPPER__HIDDEN:"tooltip__wrapper--hidden",TOOLTIP__WRAPPER__VISIBLE:"tooltip__wrapper--visible",UTAH_ID:"utds-utah-id-wrapper",UTAH_ID__BUTTON:"utds-utah-id__button"};function D(e,t){if(e)throw new Error(t)}function b(e,t){if(e==null)throw new Error(t);return e}function lt(e){return typeof e=="string"||e instanceof String}function rn(e){const t=new DOMParser;let n;if(lt(e)){const o=lt(e)?t.parseFromString(e,"text/html"):e,i=o.body.children.length>1?o.body.children:o.body.children.item(0);if(!i)throw console.error(e),new Error("renderDOM: nothing rendered");n=i}else if(e instanceof Element)n=e;else throw e?(console.error(e),new Error(`renderDOM: str is not a string nor a DOM Element : '${e}'`)):new Error("renderDOM: falsy string passed; cannot render nothing");return n}function g(e){const t=typeof e=="string"?rn(e):e;if(t instanceof HTMLCollection&&t.length>1)throw new Error("renderDOMSingle: must render a single element");const n=t instanceof HTMLCollection?t[0]:t;if(!n)throw console.error(e),new Error("renderDOMSingle: nothing rendered");return n}const _e={applicationType:"",onSearch:!1,mainMenu:!1,mediaSizes:{mobile:640,tabletPortrait:768,tabletLandscape:1024},showTitle:!0,size:se.MEDIUM,skipLinkUrl:"#main-content",title:"My Utah.gov Site",titleUrl:"/",utahId:!1};function sn(e){if(!e.showTitle&&!e.logo)throw new Error("validateSettings: A title must be shown if there is no logo. Please change the `showTitle` setting to be `true` or provide a logo image.")}class an{constructor(){this.settings={..._e}}setSettings(t){const n={..._e,...this.settings,...t};sn(n),this.settings=n}getSettings(){return this.settings}clearSettings(){this.settings={..._e}}}const Oe=new an;function M(){return Oe.getSettings()}function w(){return("10000000-1000-4000-8000"+-1e11).replace(/[018]/g,e=>(e^b(crypto.getRandomValues(new Uint8Array(1))[0],"uuidv4: crypto")&(15>>e)/4).toString(16))}const cn=`<div class="utds-header-mobile-menu__content-item" role="tabpanel">
</div>
`;function ke(e){const t=document.querySelector(f(r.MOBILE_MENU__WRAPPER));if(!t)throw new Error("addMobileMenuContentItem: mobileMenuWrapper not found");const n=t.querySelector(f(r.MOBILE_MENU__CONTENT));if(!n)throw new Error("addMobileMenuContentItem: mobileContentWrapper not found");const o=g(cn);return o.appendChild(e),n.appendChild(o),o.setAttribute("id",w()),o}function W(e){return e instanceof Function?e():e}function he(e){const t=b(document.querySelector(f(r.MOBILE_MENU)),`${e}: mobileMenu not found`),n=document.getElementById(r.MAIN_MENU__HAMBURGER_ID),o=document.getElementById(r.MAIN_MENU__HAMBURGER_ICON_ID);return{hamburger:n,hamburgerIcon:o,mobileMenu:t}}function ye(){const{hamburger:e,hamburgerIcon:t,mobileMenu:n}=he("hideMobileMenu");e?.setAttribute("aria-expanded","false"),n.classList.remove(r.IS_OPEN),e?.setAttribute("aria-label","Open the mobile menu"),t?.classList.add("utds-icon-before-hamburger"),t?.classList.remove("utds-icon-before-x-icon"),document.body.style.position=""}function ln(){document.querySelector(f(r.MAIN_MENU))?.classList.contains(r.MOBILE__HIDDEN)&&document.querySelector(`${f(r.UTAH_DESIGN_SYSTEM)}${f(r.MOBILE_MENU)}`)?.classList.add(r.MAIN_MENU__REMOVED);const{hamburger:t,hamburgerIcon:n,mobileMenu:o}=he("showMobileMenu");t?.setAttribute("aria-expanded","true"),o.classList.add(r.IS_OPEN),t?.setAttribute("aria-label","Close the mobile menu"),n?.classList.remove("utds-icon-before-hamburger"),n?.classList.add("utds-icon-before-x-icon"),document.body.style.position="relative"}function We(e,t){e.querySelectorAll(f(r.MOBILE_MENU_ACTION_BAR__ACTION_ITEM_WRAPPER)).forEach(o=>{o.classList.remove(r.ACTION_ITEM__SELECTED);const i=o.querySelector("button");if(!i)throw new Error("showActionItem: actionWrapper does not have actionItem A");i.setAttribute("aria-selected","false"),i.setAttribute("tabIndex","-1")}),t.classList.add(r.ACTION_ITEM__SELECTED);const n=t.querySelector("button");if(!n)throw new Error("showActionItem: actionWrapper does not have actionItem B");n.setAttribute("aria-selected","true"),n.removeAttribute("tabIndex"),n.focus()}function ut(e,t){e.querySelectorAll(f(r.MOBILE_MENU__CONTENT_ITEM)).forEach(n=>n.classList.remove(r.IS_OPEN)),t.classList.add(r.IS_OPEN)}function Fe(e,t,n,{ariaHasPopupType:o,additionalOnClick:i,onClickHandler:s,shouldOnClickCloseMenu:l}){if(t&&!o)throw new Error("mobileMenuInteractionHandler: there is content, but the aria type is not given");const c=document.querySelector(f(r.MOBILE_MENU));if(!c)throw new Error("mobileMenuInteractionHandler: mobileMenu not found");const a=document.querySelector(f(r.MOBILE_MENU__WRAPPER));if(!a)throw new Error("mobileMenuInteractionHandler: mobileMenuWrapper not found");const d=a.querySelector(f(r.MOBILE_MENU__CONTENT));if(!d)throw new Error("mobileMenuInteractionHandler: mobileContentWrapper not found");const _=W(n),p=W(n)?.querySelector?.("button"),m=(p||e).getAttribute("id");if(!m)throw new Error("mobileMenuInteractionHandler: interactiveElementId not found");if(t){const u=W(t);if(u){const h=u.getAttribute("id");if(!h)throw new Error("mobileMenuInteractionHandler: mobileMenuContentId not found");(p||e).setAttribute("aria-controls",h),u.setAttribute("aria-labelledby",m)}}if(e.onclick)throw new Error("mobileMenuInteractionHandler: interactiveElement already has onclick");if(e.onclick=u=>{if(!s?.(u))if(i?.(u),c.classList.contains(r.IS_OPEN))l&&ye();else{ln();const E=W(t);E&&ut(d,E),We(a,W(n))}},t){if(_!==e&&_.onclick)throw new Error("mobileMenuInteractionHandler: actionItemWrapperValue already has onclick");_.onclick=u=>{if(!s?.(u)){const h=W(t);h&&ut(d,h),We(a,W(n))}}}}function Z(e){return!e.closest(".menu-item__title")&&!e.closest(".vertical-menu__title")}function Ve(e,t,n){let o=!1;return e&&(Array.isArray(e)?o=e.some(i=>Ve(i,t,n)):(o=n(e),o||(o=!!t?.filter(i=>e[i])?.some(i=>Ve(e[i],t,n))))),o}const ae=Math.min,Q=Math.max,Ne=Math.round,Se=Math.floor,F=e=>({x:e,y:e}),un={left:"right",right:"left",bottom:"top",top:"bottom"},dn={start:"end",end:"start"};function qe(e,t,n){return Q(e,ae(t,n))}function me(e,t){return typeof e=="function"?e(t):e}function ee(e){return e.split("-")[0]}function Ee(e){return e.split("-")[1]}function dt(e){return e==="x"?"y":"x"}function $e(e){return e==="y"?"height":"width"}const fn=new Set(["top","bottom"]);function j(e){return fn.has(ee(e))?"y":"x"}function Ge(e){return dt(j(e))}function pn(e,t,n){n===void 0&&(n=!1);const o=Ee(e),i=Ge(e),s=$e(i);let l=i==="x"?o===(n?"end":"start")?"right":"left":o==="start"?"bottom":"top";return t.reference[s]>t.floating[s]&&(l=Pe(l)),[l,Pe(l)]}function _n(e){const t=Pe(e);return[ze(e),t,ze(t)]}function ze(e){return e.replace(/start|end/g,t=>dn[t])}const ft=["left","right"],pt=["right","left"],hn=["top","bottom"],mn=["bottom","top"];function En(e,t,n){switch(e){case"top":case"bottom":return n?t?pt:ft:t?ft:pt;case"left":case"right":return t?hn:mn;default:return[]}}function gn(e,t,n,o){const i=Ee(e);let s=En(ee(e),n==="start",o);return i&&(s=s.map(l=>l+"-"+i),t&&(s=s.concat(s.map(ze)))),s}function Pe(e){return e.replace(/left|right|bottom|top/g,t=>un[t])}function In(e){return{top:0,right:0,bottom:0,left:0,...e}}function _t(e){return typeof e!="number"?In(e):{top:e,right:e,bottom:e,left:e}}function Ce(e){const{x:t,y:n,width:o,height:i}=e;return{width:o,height:i,top:n,left:t,right:t+o,bottom:n+i,x:t,y:n}}function ht(e,t,n){let{reference:o,floating:i}=e;const s=j(t),l=Ge(t),c=$e(l),a=ee(t),d=s==="y",_=o.x+o.width/2-i.width/2,p=o.y+o.height/2-i.height/2,m=o[c]/2-i[c]/2;let u;switch(a){case"top":u={x:_,y:o.y-i.height};break;case"bottom":u={x:_,y:o.y+o.height};break;case"right":u={x:o.x+o.width,y:p};break;case"left":u={x:o.x-i.width,y:p};break;default:u={x:o.x,y:o.y}}switch(Ee(t)){case"start":u[l]-=m*(n&&d?-1:1);break;case"end":u[l]+=m*(n&&d?-1:1);break}return u}const bn=async(e,t,n)=>{const{placement:o="bottom",strategy:i="absolute",middleware:s=[],platform:l}=n,c=s.filter(Boolean),a=await(l.isRTL==null?void 0:l.isRTL(t));let d=await l.getElementRects({reference:e,floating:t,strategy:i}),{x:_,y:p}=ht(d,o,a),m=o,u={},h=0;for(let E=0;E<c.length;E++){const{name:T,fn:I}=c[E],{x:A,y:v,data:N,reset:L}=await I({x:_,y:p,initialPlacement:o,placement:m,strategy:i,middlewareData:u,rects:d,platform:l,elements:{reference:e,floating:t}});_=A??_,p=v??p,u={...u,[T]:{...u[T],...N}},L&&h<=50&&(h++,typeof L=="object"&&(L.placement&&(m=L.placement),L.rects&&(d=L.rects===!0?await l.getElementRects({reference:e,floating:t,strategy:i}):L.rects),{x:_,y:p}=ht(d,m,a)),E=-1)}return{x:_,y:p,placement:m,strategy:i,middlewareData:u}};async function mt(e,t){var n;t===void 0&&(t={});const{x:o,y:i,platform:s,rects:l,elements:c,strategy:a}=e,{boundary:d="clippingAncestors",rootBoundary:_="viewport",elementContext:p="floating",altBoundary:m=!1,padding:u=0}=me(t,e),h=_t(u),T=c[m?p==="floating"?"reference":"floating":p],I=Ce(await s.getClippingRect({element:(n=await(s.isElement==null?void 0:s.isElement(T)))==null||n?T:T.contextElement||await(s.getDocumentElement==null?void 0:s.getDocumentElement(c.floating)),boundary:d,rootBoundary:_,strategy:a})),A=p==="floating"?{x:o,y:i,width:l.floating.width,height:l.floating.height}:l.reference,v=await(s.getOffsetParent==null?void 0:s.getOffsetParent(c.floating)),N=await(s.isElement==null?void 0:s.isElement(v))?await(s.getScale==null?void 0:s.getScale(v))||{x:1,y:1}:{x:1,y:1},L=Ce(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:c,rect:A,offsetParent:v,strategy:a}):A);return{top:(I.top-L.top+h.top)/N.y,bottom:(L.bottom-I.bottom+h.bottom)/N.y,left:(I.left-L.left+h.left)/N.x,right:(L.right-I.right+h.right)/N.x}}const Tn=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:o,placement:i,rects:s,platform:l,elements:c,middlewareData:a}=t,{element:d,padding:_=0}=me(e,t)||{};if(d==null)return{};const p=_t(_),m={x:n,y:o},u=Ge(i),h=$e(u),E=await l.getDimensions(d),T=u==="y",I=T?"top":"left",A=T?"bottom":"right",v=T?"clientHeight":"clientWidth",N=s.reference[h]+s.reference[u]-m[u]-s.floating[h],L=m[u]-s.reference[u],z=await(l.getOffsetParent==null?void 0:l.getOffsetParent(d));let U=z?z[v]:0;(!U||!await(l.isElement==null?void 0:l.isElement(z)))&&(U=c.floating[v]||s.floating[h]);const Me=N/2-L/2,ne=U/2-E[h]/2-1,Y=ae(p[I],ne),Le=ae(p[A],ne),oe=Y,we=U-E[h]-Le,P=U/2-E[h]/2+Me,ie=qe(oe,P,we),K=!a.arrow&&Ee(i)!=null&&P!==ie&&s.reference[h]/2-(P<oe?Y:Le)-E[h]/2<0,B=K?P<oe?P-oe:P-we:0;return{[u]:m[u]+B,data:{[u]:ie,centerOffset:P-ie-B,...K&&{alignmentOffset:B}},reset:K}}}),An=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,o;const{placement:i,middlewareData:s,rects:l,initialPlacement:c,platform:a,elements:d}=t,{mainAxis:_=!0,crossAxis:p=!0,fallbackPlacements:m,fallbackStrategy:u="bestFit",fallbackAxisSideDirection:h="none",flipAlignment:E=!0,...T}=me(e,t);if((n=s.arrow)!=null&&n.alignmentOffset)return{};const I=ee(i),A=j(c),v=ee(c)===c,N=await(a.isRTL==null?void 0:a.isRTL(d.floating)),L=m||(v||!E?[Pe(c)]:_n(c)),z=h!=="none";!m&&z&&L.push(...gn(c,E,h,N));const U=[c,...L],Me=await mt(t,T),ne=[];let Y=((o=s.flip)==null?void 0:o.overflows)||[];if(_&&ne.push(Me[I]),p){const P=pn(i,l,N);ne.push(Me[P[0]],Me[P[1]])}if(Y=[...Y,{placement:i,overflows:ne}],!ne.every(P=>P<=0)){var Le,oe;const P=(((Le=s.flip)==null?void 0:Le.index)||0)+1,ie=U[P];if(ie&&(!(p==="alignment"?A!==j(ie):!1)||Y.every(k=>j(k.placement)===A?k.overflows[0]>0:!0)))return{data:{index:P,overflows:Y},reset:{placement:ie}};let K=(oe=Y.filter(B=>B.overflows[0]<=0).sort((B,k)=>B.overflows[1]-k.overflows[1])[0])==null?void 0:oe.placement;if(!K)switch(u){case"bestFit":{var we;const B=(we=Y.filter(k=>{if(z){const J=j(k.placement);return J===A||J==="y"}return!0}).map(k=>[k.placement,k.overflows.filter(J=>J>0).reduce((J,fi)=>J+fi,0)]).sort((k,J)=>k[1]-J[1])[0])==null?void 0:we[0];B&&(K=B);break}case"initialPlacement":K=c;break}if(i!==K)return{reset:{placement:K}}}return{}}}},vn=new Set(["left","top"]);async function Mn(e,t){const{placement:n,platform:o,elements:i}=e,s=await(o.isRTL==null?void 0:o.isRTL(i.floating)),l=ee(n),c=Ee(n),a=j(n)==="y",d=vn.has(l)?-1:1,_=s&&a?-1:1,p=me(t,e);let{mainAxis:m,crossAxis:u,alignmentAxis:h}=typeof p=="number"?{mainAxis:p,crossAxis:0,alignmentAxis:null}:{mainAxis:p.mainAxis||0,crossAxis:p.crossAxis||0,alignmentAxis:p.alignmentAxis};return c&&typeof h=="number"&&(u=c==="end"?h*-1:h),a?{x:u*_,y:m*d}:{x:m*d,y:u*_}}const Ln=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,o;const{x:i,y:s,placement:l,middlewareData:c}=t,a=await Mn(t,e);return l===((n=c.offset)==null?void 0:n.placement)&&(o=c.arrow)!=null&&o.alignmentOffset?{}:{x:i+a.x,y:s+a.y,data:{...a,placement:l}}}}},wn=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:o,placement:i}=t,{mainAxis:s=!0,crossAxis:l=!1,limiter:c={fn:T=>{let{x:I,y:A}=T;return{x:I,y:A}}},...a}=me(e,t),d={x:n,y:o},_=await mt(t,a),p=j(ee(i)),m=dt(p);let u=d[m],h=d[p];if(s){const T=m==="y"?"top":"left",I=m==="y"?"bottom":"right",A=u+_[T],v=u-_[I];u=qe(A,u,v)}if(l){const T=p==="y"?"top":"left",I=p==="y"?"bottom":"right",A=h+_[T],v=h-_[I];h=qe(A,h,v)}const E=c.fn({...t,[m]:u,[p]:h});return{...E,data:{x:E.x-n,y:E.y-o,enabled:{[m]:s,[p]:l}}}}}};function Re(){return typeof window<"u"}function ce(e){return Et(e)?(e.nodeName||"").toLowerCase():"#document"}function C(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function V(e){var t;return(t=(Et(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function Et(e){return Re()?e instanceof Node||e instanceof C(e).Node:!1}function x(e){return Re()?e instanceof Element||e instanceof C(e).Element:!1}function q(e){return Re()?e instanceof HTMLElement||e instanceof C(e).HTMLElement:!1}function gt(e){return!Re()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof C(e).ShadowRoot}const On=new Set(["inline","contents"]);function ge(e){const{overflow:t,overflowX:n,overflowY:o,display:i}=H(e);return/auto|scroll|overlay|hidden|clip/.test(t+o+n)&&!On.has(i)}const yn=new Set(["table","td","th"]);function Nn(e){return yn.has(ce(e))}const Sn=[":popover-open",":modal"];function Ue(e){return Sn.some(t=>{try{return e.matches(t)}catch{return!1}})}const Pn=["transform","translate","scale","rotate","perspective"],Cn=["transform","translate","scale","rotate","perspective","filter"],Rn=["paint","layout","strict","content"];function Ye(e){const t=Ke(),n=x(e)?H(e):e;return Pn.some(o=>n[o]?n[o]!=="none":!1)||(n.containerType?n.containerType!=="normal":!1)||!t&&(n.backdropFilter?n.backdropFilter!=="none":!1)||!t&&(n.filter?n.filter!=="none":!1)||Cn.some(o=>(n.willChange||"").includes(o))||Rn.some(o=>(n.contain||"").includes(o))}function Un(e){let t=X(e);for(;q(t)&&!le(t);){if(Ye(t))return t;if(Ue(t))return null;t=X(t)}return null}function Ke(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const Dn=new Set(["html","body","#document"]);function le(e){return Dn.has(ce(e))}function H(e){return C(e).getComputedStyle(e)}function De(e){return x(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function X(e){if(ce(e)==="html")return e;const t=e.assignedSlot||e.parentNode||gt(e)&&e.host||V(e);return gt(t)?t.host:t}function It(e){const t=X(e);return le(t)?e.ownerDocument?e.ownerDocument.body:e.body:q(t)&&ge(t)?t:It(t)}function Ie(e,t,n){var o;t===void 0&&(t=[]),n===void 0&&(n=!0);const i=It(e),s=i===((o=e.ownerDocument)==null?void 0:o.body),l=C(i);if(s){const c=Ze(l);return t.concat(l,l.visualViewport||[],ge(i)?i:[],c&&n?Ie(c):[])}return t.concat(i,Ie(i,[],n))}function Ze(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function bt(e){const t=H(e);let n=parseFloat(t.width)||0,o=parseFloat(t.height)||0;const i=q(e),s=i?e.offsetWidth:n,l=i?e.offsetHeight:o,c=Ne(n)!==s||Ne(o)!==l;return c&&(n=s,o=l),{width:n,height:o,$:c}}function je(e){return x(e)?e:e.contextElement}function ue(e){const t=je(e);if(!q(t))return F(1);const n=t.getBoundingClientRect(),{width:o,height:i,$:s}=bt(t);let l=(s?Ne(n.width):n.width)/o,c=(s?Ne(n.height):n.height)/i;return(!l||!Number.isFinite(l))&&(l=1),(!c||!Number.isFinite(c))&&(c=1),{x:l,y:c}}const xn=F(0);function Tt(e){const t=C(e);return!Ke()||!t.visualViewport?xn:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function Hn(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==C(e)?!1:t}function te(e,t,n,o){t===void 0&&(t=!1),n===void 0&&(n=!1);const i=e.getBoundingClientRect(),s=je(e);let l=F(1);t&&(o?x(o)&&(l=ue(o)):l=ue(e));const c=Hn(s,n,o)?Tt(s):F(0);let a=(i.left+c.x)/l.x,d=(i.top+c.y)/l.y,_=i.width/l.x,p=i.height/l.y;if(s){const m=C(s),u=o&&x(o)?C(o):o;let h=m,E=Ze(h);for(;E&&o&&u!==h;){const T=ue(E),I=E.getBoundingClientRect(),A=H(E),v=I.left+(E.clientLeft+parseFloat(A.paddingLeft))*T.x,N=I.top+(E.clientTop+parseFloat(A.paddingTop))*T.y;a*=T.x,d*=T.y,_*=T.x,p*=T.y,a+=v,d+=N,h=C(E),E=Ze(h)}}return Ce({width:_,height:p,x:a,y:d})}function Xe(e,t){const n=De(e).scrollLeft;return t?t.left+n:te(V(e)).left+n}function At(e,t,n){n===void 0&&(n=!1);const o=e.getBoundingClientRect(),i=o.left+t.scrollLeft-(n?0:Xe(e,o)),s=o.top+t.scrollTop;return{x:i,y:s}}function Bn(e){let{elements:t,rect:n,offsetParent:o,strategy:i}=e;const s=i==="fixed",l=V(o),c=t?Ue(t.floating):!1;if(o===l||c&&s)return n;let a={scrollLeft:0,scrollTop:0},d=F(1);const _=F(0),p=q(o);if((p||!p&&!s)&&((ce(o)!=="body"||ge(l))&&(a=De(o)),q(o))){const u=te(o);d=ue(o),_.x=u.x+o.clientLeft,_.y=u.y+o.clientTop}const m=l&&!p&&!s?At(l,a,!0):F(0);return{width:n.width*d.x,height:n.height*d.y,x:n.x*d.x-a.scrollLeft*d.x+_.x+m.x,y:n.y*d.y-a.scrollTop*d.y+_.y+m.y}}function kn(e){return Array.from(e.getClientRects())}function Wn(e){const t=V(e),n=De(e),o=e.ownerDocument.body,i=Q(t.scrollWidth,t.clientWidth,o.scrollWidth,o.clientWidth),s=Q(t.scrollHeight,t.clientHeight,o.scrollHeight,o.clientHeight);let l=-n.scrollLeft+Xe(e);const c=-n.scrollTop;return H(o).direction==="rtl"&&(l+=Q(t.clientWidth,o.clientWidth)-i),{width:i,height:s,x:l,y:c}}function Fn(e,t){const n=C(e),o=V(e),i=n.visualViewport;let s=o.clientWidth,l=o.clientHeight,c=0,a=0;if(i){s=i.width,l=i.height;const d=Ke();(!d||d&&t==="fixed")&&(c=i.offsetLeft,a=i.offsetTop)}return{width:s,height:l,x:c,y:a}}const Vn=new Set(["absolute","fixed"]);function qn(e,t){const n=te(e,!0,t==="fixed"),o=n.top+e.clientTop,i=n.left+e.clientLeft,s=q(e)?ue(e):F(1),l=e.clientWidth*s.x,c=e.clientHeight*s.y,a=i*s.x,d=o*s.y;return{width:l,height:c,x:a,y:d}}function vt(e,t,n){let o;if(t==="viewport")o=Fn(e,n);else if(t==="document")o=Wn(V(e));else if(x(t))o=qn(t,n);else{const i=Tt(e);o={x:t.x-i.x,y:t.y-i.y,width:t.width,height:t.height}}return Ce(o)}function Mt(e,t){const n=X(e);return n===t||!x(n)||le(n)?!1:H(n).position==="fixed"||Mt(n,t)}function $n(e,t){const n=t.get(e);if(n)return n;let o=Ie(e,[],!1).filter(c=>x(c)&&ce(c)!=="body"),i=null;const s=H(e).position==="fixed";let l=s?X(e):e;for(;x(l)&&!le(l);){const c=H(l),a=Ye(l);!a&&c.position==="fixed"&&(i=null),(s?!a&&!i:!a&&c.position==="static"&&!!i&&Vn.has(i.position)||ge(l)&&!a&&Mt(e,l))?o=o.filter(_=>_!==l):i=c,l=X(l)}return t.set(e,o),o}function Gn(e){let{element:t,boundary:n,rootBoundary:o,strategy:i}=e;const l=[...n==="clippingAncestors"?Ue(t)?[]:$n(t,this._c):[].concat(n),o],c=l[0],a=l.reduce((d,_)=>{const p=vt(t,_,i);return d.top=Q(p.top,d.top),d.right=ae(p.right,d.right),d.bottom=ae(p.bottom,d.bottom),d.left=Q(p.left,d.left),d},vt(t,c,i));return{width:a.right-a.left,height:a.bottom-a.top,x:a.left,y:a.top}}function zn(e){const{width:t,height:n}=bt(e);return{width:t,height:n}}function Yn(e,t,n){const o=q(t),i=V(t),s=n==="fixed",l=te(e,!0,s,t);let c={scrollLeft:0,scrollTop:0};const a=F(0);function d(){a.x=Xe(i)}if(o||!o&&!s)if((ce(t)!=="body"||ge(i))&&(c=De(t)),o){const u=te(t,!0,s,t);a.x=u.x+t.clientLeft,a.y=u.y+t.clientTop}else i&&d();s&&!o&&i&&d();const _=i&&!o&&!s?At(i,c):F(0),p=l.left+c.scrollLeft-a.x-_.x,m=l.top+c.scrollTop-a.y-_.y;return{x:p,y:m,width:l.width,height:l.height}}function Je(e){return H(e).position==="static"}function Lt(e,t){if(!q(e)||H(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return V(e)===n&&(n=n.ownerDocument.body),n}function wt(e,t){const n=C(e);if(Ue(e))return n;if(!q(e)){let i=X(e);for(;i&&!le(i);){if(x(i)&&!Je(i))return i;i=X(i)}return n}let o=Lt(e,t);for(;o&&Nn(o)&&Je(o);)o=Lt(o,t);return o&&le(o)&&Je(o)&&!Ye(o)?n:o||Un(e)||n}const Kn=async function(e){const t=this.getOffsetParent||wt,n=this.getDimensions,o=await n(e.floating);return{reference:Yn(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:o.width,height:o.height}}};function Zn(e){return H(e).direction==="rtl"}const jn={convertOffsetParentRelativeRectToViewportRelativeRect:Bn,getDocumentElement:V,getClippingRect:Gn,getOffsetParent:wt,getElementRects:Kn,getClientRects:kn,getDimensions:zn,getScale:ue,isElement:x,isRTL:Zn};function Ot(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function Xn(e,t){let n=null,o;const i=V(e);function s(){var c;clearTimeout(o),(c=n)==null||c.disconnect(),n=null}function l(c,a){c===void 0&&(c=!1),a===void 0&&(a=1),s();const d=e.getBoundingClientRect(),{left:_,top:p,width:m,height:u}=d;if(c||t(),!m||!u)return;const h=Se(p),E=Se(i.clientWidth-(_+m)),T=Se(i.clientHeight-(p+u)),I=Se(_),v={rootMargin:-h+"px "+-E+"px "+-T+"px "+-I+"px",threshold:Q(0,ae(1,a))||1};let N=!0;function L(z){const U=z[0].intersectionRatio;if(U!==a){if(!N)return l();U?l(!1,U):o=setTimeout(()=>{l(!1,1e-7)},1e3)}U===1&&!Ot(d,e.getBoundingClientRect())&&l(),N=!1}try{n=new IntersectionObserver(L,{...v,root:i.ownerDocument})}catch{n=new IntersectionObserver(L,v)}n.observe(e)}return l(!0),s}function Jn(e,t,n,o){o===void 0&&(o={});const{ancestorScroll:i=!0,ancestorResize:s=!0,elementResize:l=typeof ResizeObserver=="function",layoutShift:c=typeof IntersectionObserver=="function",animationFrame:a=!1}=o,d=je(e),_=i||s?[...d?Ie(d):[],...Ie(t)]:[];_.forEach(I=>{i&&I.addEventListener("scroll",n,{passive:!0}),s&&I.addEventListener("resize",n)});const p=d&&c?Xn(d,n):null;let m=-1,u=null;l&&(u=new ResizeObserver(I=>{let[A]=I;A&&A.target===d&&u&&(u.unobserve(t),cancelAnimationFrame(m),m=requestAnimationFrame(()=>{var v;(v=u)==null||v.observe(t)})),n()}),d&&!a&&u.observe(d),u.observe(t));let h,E=a?te(e):null;a&&T();function T(){const I=te(e);E&&!Ot(E,I)&&n(),E=I,h=requestAnimationFrame(T)}return n(),()=>{var I;_.forEach(A=>{i&&A.removeEventListener("scroll",n),s&&A.removeEventListener("resize",n)}),p?.(),(I=u)==null||I.disconnect(),u=null,a&&cancelAnimationFrame(h)}}const yt=Ln,Nt=wn,St=An,Pt=Tn,Ct=(e,t,n)=>{const o=new Map,i={platform:jn,...n},s={...i.platform,_c:o};return bn(e,t,{...i,platform:s})};function Qe(e,t,n,o){t?(e.classList.remove(o),e.classList.add(n)):(e.classList.add(o),e.classList.remove(n))}let R;const be={},et={SHIFT:"shift-key"};function Rt(){R&&(document.removeEventListener("click",R.globalOnClick),document.removeEventListener("keyup",R.globalOnKeyup),document.removeEventListener("keydown",R.globalOnKeydown),R=null)}function tt(){const e=[`${f(r.UTAH_DESIGN_SYSTEM)} ${f(r.HEADER)} ${f(r.POPUP_WRAPPER)}`,`${f(r.UTAH_DESIGN_SYSTEM)} ${f(r.MAIN_MENU)} ${f(r.POPUP_WRAPPER)}`],t=document.querySelectorAll(e.join(","));Array.from(t).filter(n=>!n.classList.contains(r.POPUP__HIDDEN)).forEach(n=>{const o=n.getAttribute("id");if(o){const i=document.querySelector(`[aria-controls="${o}"]`);i&&Z(i)&&i.setAttribute("aria-expanded","false")}Qe(n,!1,r.POPUP__VISIBLE,r.POPUP__HIDDEN)})}function Qn(){R&&Rt(),R={globalOnClick:()=>{},globalOnKeyup:()=>{},globalOnKeydown:()=>{}},R.globalOnClick=tt,document.addEventListener("click",R.globalOnClick),R.globalOnKeyup=(e=>{e.key==="Escape"&&tt(),e.shiftKey||(be[et.SHIFT]=!1),be[e.key]=!1}),document.addEventListener("keyup",R.globalOnKeyup),R.globalOnKeydown=e=>{e.shiftKey&&(be[et.SHIFT]=!0),be[e.key]=!0},document.addEventListener("keydown",R.globalOnKeydown)}function eo(){return"ontouchstart"in window||navigator.maxTouchPoints>0||navigator.msMaxTouchPoints>0}function de(e,t,n,o,i){let s=NaN,l=NaN;const c=350,a=150,d=50;Z(t)&&t.setAttribute("aria-expanded","false"),t.setAttribute("aria-haspopup",o);function _(m){clearTimeout(s),clearTimeout(l),(!i?.isPerformPopup||i?.isPerformPopup())&&(s=window.setTimeout(()=>{const u=n.querySelector(f(r.POPUP_ARROW)),h=[yt(11),St(),Nt()];u&&h.push(Pt({element:u})),Ct(t,n,{placement:i?.popupPlacement||re.BOTTOM,middleware:h}).then(({x:E,y:T,middlewareData:I})=>{n.setAttribute("data-popup-placement",i?.popupPlacement||re.BOTTOM),Object.assign(n.style,{left:`${E}px`,top:`${T}px`}),u&&Object.assign(u.style,{left:E!=null?`${I?.arrow?.x}px`:"",top:T!=null?`${I?.arrow?.y}px`:""})}),Qe(n,!0,r.POPUP__VISIBLE,r.POPUP__HIDDEN),Z(t)&&t.setAttribute("aria-expanded","true"),document.querySelectorAll(f(r.TOOLTIP__WRAPPER)).forEach(E=>E.classList.add(r.TOOLTIP__WRAPPER__HIDDEN))},m))}function p(m){clearTimeout(s),clearTimeout(l),(!i?.isPerformPopup||i.isPerformPopup())&&(l=window.setTimeout(()=>{Qe(n,!1,r.POPUP__VISIBLE,r.POPUP__HIDDEN),Z(t)&&t.setAttribute("aria-expanded","false")},m))}if(i?.preventOnClickHandling&&(D(!!e.onclick,"popupFocusHandler: wrapper already has an onclick"),e.onclick=m=>{m.stopPropagation()}),e.addEventListener("focusin",()=>_(a)),e.addEventListener("focusout",()=>p(a)),i?.shouldFocusOnHover&&(e.addEventListener("mouseenter",()=>_(c)),e.addEventListener("mouseleave",()=>p(c))),!i?.preventOnClickHandling){if(t.onclick)throw new Error("popupFocusHandler: button already has onclick");t.onclick=m=>{const u=t.getAttribute("aria-expanded")==="true";(!i?.isPerformPopup||i.isPerformPopup())&&(m.stopPropagation(),m.preventDefault(),u&&t.getAttribute("aria-expanded")==="true"?i?.doNotClosePopupOnClick||(p(d),document.activeElement?.blur()):(eo()&&tt(),_(d))),i?.onClick&&i.onClick(m)}}}const nt=`<span class="utds-new-tab-link-a11y">
<span class="visually-hidden">, opens in a new tab</span>
<span class="utds-icon-after-external-link" aria-hidden="true"></span>
</span>
`,to=`<span class="utds-icon-before-chevron-right vertical-menu__chevron" aria-hidden="true"></span>
`;function Ut(e,t){let n;return typeof t=="function"?n=t(e):n=t??"Overview",` ${n}`}const no=`<div class="popup__wrapper popup__wrapper--hidden">
<div class="popup__content">
<div class="popup__arrow"></div>
</div>
</div>
`;function ot(e,t){const n=e.getAttribute("id");if(!n)throw new Error("renderPopup: labelledByElement does not have an `id` attribute");const o=w();e.setAttribute("aria-controls",o);const i=g(no);if(i.setAttribute("id",o),i.setAttribute("aria-labelledby",n),t?.removePopupArrow){const s=i.querySelector(f(r.POPUP_ARROW));if(!s)throw new Error("renderPopup(): popup arrow missing (I wanted to remove it!!)");s.remove()}return i}const oo=`<ul class="vertical-menu" />
`,io=`<li class="vertical-menu__item">
<span class="vertical-menu__title">
<span class="vertical-menu__plain-title"></span>
<a href="#" class="vertical-menu__link-title">
<span class="vertical-menu__link-text"></span>
</a>
<button class="vertical-menu__button-title">
<span class="vertical-menu__link-text"></span>
</button>
</span>
<span class="vertical-menu__divider" />
</li>
`;function Dt(e){const t=e.closest("li");if(!t)throw console.error("element",e),new Error("toggleChildMenuExpansion: parent not found for child");t.querySelectorAll(":scope > ul").forEach(n=>{const o=n.closest("li")?.querySelector(f(r.VERTICAL_MENU__BUTTON_TITLE));if(!o)throw new Error("toggleChildMenuExpansion: button not found");const i=o.querySelector(`:scope > ${f(r.VERTICAL_MENU__CHEVRON)}`);if(!i)throw new Error("toggleChildMenuExpansion: chevron not found");n.classList.toggle(r.VISUALLY_HIDDEN),n.classList.contains(r.VISUALLY_HIDDEN)?(Z(o)&&o.setAttribute("aria-expanded","false"),i.classList.add(r.IS_CLOSED),i.classList.remove(r.IS_OPEN)):(Z(o)&&o.setAttribute("aria-expanded","true"),i.classList.remove(r.IS_CLOSED),i.classList.add(r.IS_OPEN))})}function ro(e){return t=>{t.preventDefault(),t.stopPropagation(),Dt(e)}}function xt(){const e=g(to);return e.classList.add(r.IS_CLOSED),e}function xe(){setTimeout(()=>{document.activeElement?.blur()},0)}function so(e,t,n){const o=g(io),i=o.querySelector(f(r.VERTICAL_MENU__TITLE));if(!i)throw new Error("renderPopupMenuItem: menuItemTitleWrapper not found");const s=o.querySelector(f(r.VERTICAL_MENU__BUTTON_TITLE));if(!s)throw new Error("renderPopupMenuItem: menuButton not found");const l=o.querySelector(f(r.VERTICAL_MENU__LINK_TITLE));if(!l)throw new Error("renderPopupMenuItem: aHref not found");const c=o.querySelector(f(r.VERTICAL_MENU__PLAIN_TITLE));if(!c)throw new Error("renderPopupMenuItem: plainTitle not found");const a=o.querySelector(f(r.VERTICAL_MENU__DIVIDER));if(!a)throw new Error("renderPopupMenuItem: menuDivider not found");const d=o.querySelector(`button ${f(r.VERTICAL_MENU__LINK_TEXT)}`);if(!d)throw new Error("renderPopupMenuItem: titleSpanButton not found");const _=o.querySelector(`a ${f(r.VERTICAL_MENU__LINK_TEXT)}`);if(!_)throw new Error("renderPopupMenuItem: titleSpanLink not found");const p=t.actionMenu&&[...t.actionMenu];if(p&&(t.actionFunction||t.actionUrl||t.actionFunctionUrl)&&!t.isOverviewHidden&&p.unshift({actionFunction:t.actionFunction,actionFunctionUrl:t.actionFunctionUrl,actionUrl:t.actionUrl,className:t.className,icon:t.icon,title:`${t.title}${Ut(t,n.parentMenuLinkSuffix)}`}),p?.length||(l.onclick=xe,s.onclick=xe),p){let u;switch(n.childrenMenuType){case y.FLYOUT:{u=xt(),s.appendChild(u),s.setAttribute("id",w());const h=it({menuItems:p,title:t.title},s,{...n,removePopupArrow:!0});o.appendChild(h),de(o,s,h,"menu",{popupPlacement:re.RIGHT_START,preventOnClickHandling:!0,shouldFocusOnHover:!0}),l.remove(),c.remove();break}case y.INLINE:{const h=fe(p,n),E=w();h.setAttribute("id",E),h.classList.add(r.VISUALLY_HIDDEN),o.appendChild(h),s.onclick=ro(s),Z(s)&&s.setAttribute("aria-expanded","false"),s.setAttribute("aria-controls",E),u=xt(),s.appendChild(u),l.remove(),c.remove(),o.addEventListener("focusin",T=>{for(let I=T.target?.closest("ul");I;I=I.parentElement?.closest("ul"))I.classList.remove(r.VISUALLY_HIDDEN),Z(s)&&s.setAttribute("aria-expanded","true"),T.target!==s&&(u?.classList?.remove(r.IS_CLOSED),u?.classList?.add(r.IS_OPEN))});break}case y.MEGA_MENU:{const h=fe(p,n),E=w();h.setAttribute("id",E),o.appendChild(h),l.remove(),s.remove(),c.appendChild(document.createTextNode(t.title));break}default:throw new Error(`renderPopupMenuItem: childrenMenuType unknown '${n.childrenMenuType}'`)}a.remove()}else if(t.actionFunction)s.onclick=u=>{t.actionFunction?.(u),xe()},l.remove(),a.remove(),c.remove();else if(t.actionUrl)l.setAttribute("href",t.actionUrl.url),s.remove(),a.remove(),c.remove();else if(t.actionFunctionUrl)l.setAttribute("href",t.actionFunctionUrl.url),l.onclick=u=>{t.actionFunctionUrl?.skipHandleEvent||(u.stopPropagation(),u.preventDefault()),t.actionFunctionUrl?.actionFunction(u),xe()},s.remove(),a.remove(),c.remove();else if(t.isDivider)i.remove(),o.setAttribute("aria-hidden","true"),o.setAttribute("role","separator");else throw console.error(t),new Error("renderPopupMenuItem: popupMenuItem must have either actionMenu, actionFunction, actionUrl, or isDivider (popupMenuItem.title)");if(!t.isDivider){if(t.icon){const u=g(t.icon);u.setAttribute("role","presentation"),d.appendChild(u),_.appendChild(u)}if(d.appendChild(document.createTextNode(t.title)),_.appendChild(document.createTextNode(t.title)),t.actionUrl?.openInNewTab||t.actionFunctionUrl?.openInNewTab){l.setAttribute("target","_blank");const u=g(nt);d.appendChild(u),_.appendChild(u)}}const m=t.actionMenu?.length?r.MENU_ITEM__SELECTED_PARENT:r.MENU_ITEM__SELECTED;return(t.isSelected||t.actionMenu&&Ve(t.actionMenu,["actionMenu"],u=>!!u.isSelected))&&(s.classList.add(m),l.classList.add(m)),n.childrenMenuType!==y.MEGA_MENU&&(t.isSelected?(Dt(o),o.classList.add(m)):o.classList.remove(m)),t.className&&o.classList.add(t.className),e.appendChild(o),o}function fe(e,t){const n=g(oo);return e?.forEach(o=>so(n,o,t)),n}function it(e,t,n){const o=ot(t,{removePopupArrow:n.removePopupArrow}),i=o.querySelector(f(r.POPUP_CONTENT_WRAPPER));if(!i)throw new Error("renderPopupMenu: contentWrapper not found");const s=fe(e.menuItems,n);return s.setAttribute("aria-label",e.title),i.appendChild(s),o}const ao=`<div class="utds-header-action-item-menu">
<div class="vertical-menu__wrapper-title"></div>
</div>
`,co=`<div class="utds-header-mobile-menu__action-item" role="tab">
<button type="button" class="icon-button icon-button--borderless utds-header-action-item__icon-button">
<div class="utds-header-action-item__title visually-hidden"></div>
<span aria-hidden="true" role="presentation">
</button>
<span class="menu-chiclet"></span>
</div>
`,lo=`<div class="utds-badge__wrapper">
<span class="utds-badge__value"></span>
<span class="utds-badge__label visually-hidden"></span>
</div>
`;function rt(e){let t=null;if(e){t=g(lo),t.classList.add(r.BADGE_WRAPPER__ACTION_ITEM);const n=t.querySelector(f(r.BADGE__LABEL));if(!n)throw new Error("renderActionItemBadge: badgeLabel not found");if(n.appendChild(document.createTextNode(e.label)),e.value||e.value===0){const o=t.querySelector(f(r.BADGE__VALUE));if(!o)throw new Error("renderActionItemBadge: badgeValue not found");o.appendChild(document.createTextNode(`${e.value}`))}else t.classList.add(r.BADGE_WRAPPER__SMALL);e.className&&t.classList.add(e.className)}return t}function uo(e){const t=g(co);t.getAttribute("id")||t.setAttribute("id",w());const n=document.createTextNode(e.title),o=t instanceof HTMLCollection?t[0]:t;e.showTitle&&o.classList.add(r.ACTION_ITEM__ICON_BUTTON_TITLE),o.classList.add(r.MOBILE_MENU_ACTION_BAR__ACTION_ITEM_WRAPPER),o.classList.remove(r.ACTION_ITEM);const i=o.querySelector(f(r.ACTION_ITEM__TITLE));if(!i)throw new Error("renderActionItem: titleDiv not found");i.appendChild(n),e.showTitle?i.classList.remove(r.VISUALLY_HIDDEN):i.classList.add(r.VISUALLY_HIDDEN);const s=t.querySelector(f(r.ACTION_ITEM__ICON_BUTTON));if(!s)throw new Error("renderActionItem: iconButton not found");e.className&&s.classList.add(e.className);const l=rt(e.badge);l&&s.appendChild(l);const c=g(e.icon);c.setAttribute("role","presentation"),s.appendChild(c);let a=null;if(e.actionFunction)s.onclick=e.actionFunction;else if(e.actionDom){const d=w();s.setAttribute("id",d),a=g(typeof e.actionDom=="function"?e.actionDom():e.actionDom)}else if(e.actionPopupMenu){const d=w();s.setAttribute("id",d),a=g(ao);const _=a.querySelector(f(r.VERTICAL_MENU_WRAPPER__WRAPPER_TITLE));if(!_)throw new Error("renderMobileActionItem: actionItemContentTitle not found");_.appendChild(document.createTextNode(e.actionPopupMenu.title));const p=fe(e.actionPopupMenu.menuItems,{childrenMenuType:y.INLINE,parentMenuLinkSuffix:e.actionPopupMenu.parentMenuLinkSuffix});a.appendChild(p)}else throw console.error(e),new Error("Action Item: no defined action; must have either actionFunction, actionDom, or actionPopupMenu");return{actionItemElement:t,actionItemContent:a}}function fo(){const e=document.getElementById(r.MOBILE_MENU_ACTON_BAR__HOME_ID);if(!e)throw new Error("renderMobileActionItems: homeActionItem not found");const t=e.closest(f(r.MOBILE_MENU_ACTION_BAR__ACTION_ITEM_WRAPPER));if(!t)throw new Error("renderMobileActionItems: homeActionItemWrapper not found");const i=(!!M().utahId?document.getElementById(r.MOBILE_MENU_ACTON_BAR__PROFILE_ID):null)?.closest?.(f(r.MOBILE_MENU_ACTION_BAR__ACTION_ITEM_WRAPPER));[...M().actionItems||[]].reverse()?.map(l=>({actionItem:l,...uo(l)}))?.forEach(({actionItem:l,actionItemContent:c,actionItemElement:a})=>{let d;switch(l.mobileMenuLocation){case"left":d=t;break;case"none":d=null;break;case"right":default:d=i||t;break}if(d&&(d.after(a),c)){const _=ke(c);let p=null;l.actionDom?p="dialog":l.actionPopupMenu&&(p="menu"),Fe(a,_,a,{ariaHasPopupType:p,shouldOnClickCloseMenu:!1})}}),M().mainMenu||(e.remove(),t.remove())}const po=`<div class="utds-footer utah-design-system">
<div class="utds-footer__horizontal-divider">
<hr />
</div>
<div class="utds-footer__utah-logo-wrapper">
<div class="utah-logo-svg" id="utah-logo-svg">
<svg viewBox="0 0 107 30.51" role="img">
<g>
<path
d="m12.44,30.51c-4.21,0-7.33-1.22-9.38-3.66C1.02,24.4,0,20.61,0,15.48V0h7.93v16.4c0,2.67.36,4.55,1.08,5.65.77,1.12,2.08,1.74,3.43,1.64,1.36.1,2.68-.52,3.48-1.63.75-1.09,1.13-2.97,1.13-5.65V0h7.65v15.48c0,5.13-1,8.92-3,11.36-2,2.44-5.09,3.66-9.26,3.66Zm24.42-.56V6.64h-7.93V0h23.78v6.64h-7.93v23.31h-7.92Zm26.17-14.56l-.51,2.07h5.53l-.51-2.07c-.37-1.44-.74-3.01-1.11-4.7-.37-1.69-.74-3.29-1.11-4.79h-.18c-.34,1.53-.68,3.14-1.04,4.82-.35,1.68-.71,3.24-1.08,4.68Zm-11.52,14.56L60.64,0h9.58l9.12,29.95h-8.39l-1.48-6.36h-8.38l-1.47,6.36h-8.11Zm30.69,0V0h7.93v11.15h8.94V0h7.93v29.95h-7.93v-11.89h-8.94v11.89h-7.93Z" />
</g>
</svg>
</div>
<div class="utds-footer__vertical-divider" role="separator" aria-orientation="vertical"></div>
<div class="utds-footer__official-site-wrapper">
<div class="utds-footer__official-site">An official website of the <span class="whitespace-no-wrap">state of Utah</span></div>
<div class="utds-footer__copyright">©<span class="utds-footer__copyright-year">2024</span> State of Utah</div>
</div>
</div>
<div class="utds-footer__links">
<ul>
<li>
<a href="https://www.utah.gov/index.html" target="__blank" rel="noreferrer">Utah.gov Home</a>
</li>
<li>
<a href="https://www.utah.gov/support/disclaimer.html" target="__blank" rel="noreferrer" id="utds-footer-terms-link">Terms of Use</a>
</li>
<li>
<a href="https://www.utah.gov/support/privacypolicy.html" target="__blank" rel="noreferrer" id="utds-footer-privacy-link">Privacy
Policy</a>
</li>
<li>
<a href="https://www.utah.gov/support/accessibility.html" target="__blank" rel="noreferrer">Accessibility</a>
</li>
<li>
<a href="https://www.utah.gov/support/translate.html" target="__blank" rel="noreferrer">Translate</a>
</li>
</ul>
</div>
</div>
`;function _o(e,t){const n=b(e.querySelector(f(r.FOOTER_COPYRIGHT_YEAR)),"renderFooterCopyrightYear: copyrightYearSpan not found");n.innerHTML=t??""}const $={copyrightYear:void 0,domLocationTarget:{cssSelector:void 0,element:void 0,elementFunction:void 0},showHorizontalRule:!1};function ho(){const e=M(),t=document.querySelector(f(r.FOOTER));let n=t;if(e.footer===null)t?.remove();else if($.domLocationTarget.cssSelector!==e?.footer?.domLocationTarget?.cssSelector||$.domLocationTarget.element!==e?.footer?.domLocationTarget?.element||$.domLocationTarget.elementFunction!==e?.footer?.domLocationTarget?.elementFunction||$.showHorizontalRule!==e?.footer?.showHorizontalRule||$.copyrightYear!==e?.footer?.copyrightYear||!t){t&&t.remove(),n=g(po);let i=document.body;if(e?.footer?.domLocationTarget){const c=[e?.footer?.domLocationTarget.cssSelector,e?.footer?.domLocationTarget.element,e?.footer?.domLocationTarget.elementFunction].filter(a=>a);if(D(c.length<1,"renderFooter: footer.domLocationTarget must either have a value for one of its properties or not be specified at all"),D(c.length>1,"renderFooter: footer.domLocationTarget must only have one target specified"),e?.footer?.domLocationTarget.cssSelector)i=document.querySelector(e?.footer?.domLocationTarget.cssSelector),D(!i,`renderFooter: element not found for domLocationTarget.cssSelector ${e?.footer?.domLocationTarget.cssSelector}`);else if(e?.footer?.domLocationTarget.element)i=e?.footer?.domLocationTarget.element;else if(e?.footer?.domLocationTarget.elementFunction)i=e?.footer?.domLocationTarget.elementFunction(),D(!i,"renderFooter: element not returned from domLocationTarget.elementFunction");else throw new Error("renderFooter: domLocationTarget must have at least one field set")}if(i?.appendChild(n),!e?.footer?.showHorizontalRule){const c=document.querySelector(f(r.FOOTER_HORIZONTAL_DIVIDER));D(!c,"renderFooter: cannot remove horizontal rule; not found"),c?.remove()}if(e?.footer?.linkPrivacyPolicy){const c=document.getElementById(r.FOOTER_LINK_PRIVACY_ID);D(!c,"renderFooter: cannot find privacy policy link"),c?.setAttribute("href",e.footer.linkPrivacyPolicy)}if(e?.footer?.linkTermsOfUse){const c=document.getElementById(r.FOOTER_LINK_TERMS_ID);D(!c,"renderFooter: cannot find terms of use link"),c?.setAttribute("href",e.footer.linkTermsOfUse)}b(document.querySelector(f(r.FOOTER_LINKS)),"renderFooter: footer links not found").querySelectorAll("a").forEach(c=>{c.appendChild(g(nt))}),_o(n,e?.footer?.copyrightYear),$.copyrightYear=e?.footer?.copyrightYear,$.domLocationTarget.cssSelector=e?.footer?.domLocationTarget?.cssSelector,$.domLocationTarget.element=e?.footer?.domLocationTarget?.element,$.domLocationTarget.elementFunction=e?.footer?.domLocationTarget?.elementFunction,$.showHorizontalRule=e?.footer?.showHorizontalRule}return n}const mo=`<div class="utds-action-items-wrapper"></div>
`,Eo=`<div class="tooltip__wrapper tooltip__wrapper--hidden" aria-hidden="true">
<div class="tooltip__content">
<div class="tooltip__arrow"></div>
</div>
</div>
`;let pe=NaN;function Te(e,t){const n=g(Eo),o=n.querySelector(f(r.TOOLTIP__CONTENT)),i=n.querySelector(f(r.TOOLTIP__ARROW));let s;if(!o)throw new Error("hookupTooltip: tooltipContent not found");o.appendChild(t),e.appendChild(n);const l=[yt(5),St(),Nt()];i&&l.push(Pt({element:i}));const c=()=>Ct(e,n,{placement:re.BOTTOM,middleware:l}).then(({x:d,y:_,middlewareData:p})=>{n.setAttribute("data-popup-placement",re.BOTTOM),Object.assign(n.style,{left:`${d}px`,top:`${_}px`}),i&&Object.assign(i?.style,{left:`${p.arrow?.x}px`,top:`${p?.arrow?.y}px`})});if(e.onmouseenter||e.onmouseleave)throw new Error("hookupTooltip: element already has an onmouseenter and/or onmouseleave event");let a=NaN;e.onmouseenter=()=>{clearTimeout(a),a=window.setTimeout(()=>{clearTimeout(pe),pe=-1;const d=e.querySelector(f(r.POPUP_WRAPPER));(!d||d.classList.contains(r.POPUP__HIDDEN))&&(n.classList.remove(r.TOOLTIP__WRAPPER__HIDDEN),n.classList.add(r.TOOLTIP__WRAPPER__VISIBLE),s=Jn(e,n,c))},pe?0:500)},e.onmouseleave=()=>{clearTimeout(a),n.classList.add(r.TOOLTIP__WRAPPER__HIDDEN),n.classList.remove(r.TOOLTIP__WRAPPER__VISIBLE),typeof s=="function"&&s(),clearTimeout(pe),pe=window.setTimeout(()=>{pe=NaN},500)}}const go=`<div class="utds-header-action-item">
<button type="button" class="icon-button utds-header-action-item__icon-button">
<div class="utds-header-action-item__title visually-hidden"></div>
</button>
</div>
`;function Io(e){const t=g(go),n=document.createTextNode(e.title),o=t instanceof HTMLCollection?t[0]:t;e.showTitle&&o.classList.add(r.ACTION_ITEM__ICON_BUTTON_TITLE);const i=o.querySelector(f(r.ACTION_ITEM__TITLE));if(!i)throw new Error("renderActionItem: titleDiv not found");i.appendChild(n),e.showTitle?i.classList.remove(r.VISUALLY_HIDDEN):i.classList.add(r.VISUALLY_HIDDEN);const s=t.querySelector(f(r.ACTION_ITEM__ICON_BUTTON));if(!s)throw new Error("renderActionItem: iconButton not found");e.className&&s.classList.add(e.className);const l=rt(e.badge);l&&s.appendChild(l);const c=g(e.icon);if(c.setAttribute("role","presentation"),s.appendChild(c),!(s instanceof HTMLElement))throw new Error("renderActionItem: iconButton is not an HTMLElement");if(e.actionFunction)s.onclick=e.actionFunction;else if(e.actionDom){const a=w();s.setAttribute("id",a);const d=ot(s),_=d.querySelector(f(r.POPUP_CONTENT_WRAPPER));if(!_)throw new Error("renderPopupMenu: contentWrapper not found");_.appendChild(g(typeof e.actionDom=="function"?e.actionDom():e.actionDom)),t.appendChild(d),de(o,s,d,"dialog",void 0)}else if(e.actionPopupMenu){const a=w();s.setAttribute("id",a);const d=it(e.actionPopupMenu,s,{childrenMenuType:y.INLINE,parentMenuLinkSuffix:e.actionPopupMenu.parentMenuLinkSuffix});t.appendChild(d),de(o,s,d,"menu",void 0)}else throw console.error(e),new Error("Action Item: no defined action; must have either actionFunction, actionDom, or actionPopupMenu");return Te(t,document.createTextNode(e.title)),t}function bo(){const{actionItems:e}=M();let t=null;return e?.length&&(t=g(mo),M().actionItems?.map(n=>Io(n))?.forEach(n=>t?.appendChild(n))),t}const He={PROFILE:"https://id.utah.gov",SIGN_IN:`https://id.utah.gov/login?goto=${window.location}`,SIGN_OUT:`https://id.utah.gov/logout?goto=${window.location}`,USER_INFO:"https://id.utah.gov/api/userInfo"},Ae={AUTOMATIC:"Automatic",NONE:"None",PROVIDED:"Provided"};let Ht=Ae.NONE;function To(e){let t;if(e===!0)t=Ae.AUTOMATIC;else if(e===!1)t=Ae.NONE;else if(e===void 0||e.currentUser===void 0)t=Ae.AUTOMATIC;else if(e.currentUser===null||e.currentUser)t=Ae.PROVIDED;else throw new Error("determineFetchStyle: Unknown utah id fetch style");return t}const S={isDefinitive:null,lastError:null,userInfo:null};function Bt(e){if(e.isDefinitive){zt(e);const t=M()?.utahId;typeof t=="object"&&t.onAuthChanged?.(e)}}let kt=!0;const Ao=500;let Wt=NaN;async function Ft(){let e=Promise.resolve(S);const t=M(),n=To(t.utahId);if(S.isDefinitive===!1)e=Promise.resolve(S);else if(kt)clearTimeout(Wt),e=new Promise(o=>{Wt=window.setTimeout(()=>{kt=!1,Ft().then(i=>o(i)).catch(i=>console.error(i))},Ao)});else if(t.utahId===!1)e=Promise.resolve({isDefinitive:!0,lastError:"Utah ID is off",userInfo:null});else if(t.utahId===!0||t.utahId?.currentUser===void 0)(n!==Ht||S.isDefinitive===null)&&(S.isDefinitive=!1,e=fetch(He.USER_INFO,{credentials:"include"}).then(o=>o.json()).then(o=>{if(o.status===200)S.lastError=null,S.userInfo=o.data;else throw new Error(o.err);return S}).catch(o=>(S.lastError=o,S.userInfo=null,S)).finally(()=>(S.isDefinitive=!0,Bt(S),S)));else{const o={isDefinitive:!0,lastError:null,userInfo:t.utahId?.currentUser};e=Promise.resolve(o),Bt(o)}return Ht=n,e}function vo(){return S}function Vt(e){e.preventDefault(),e.stopPropagation(),window.location.href=He.SIGN_IN}function Mo(){let e;const t=M();return t.utahId===!1?e=null:t.utahId===!0?e=Vt:e=t.utahId?.onSignIn??Vt,e}function Lo(){const e=vo(),t=M(),n=t.utahId!==!1&&t.utahId!==!0&&!!t.utahId?.currentUser,o=typeof t.utahId=="object"?t.utahId.currentUser??null:e.userInfo;return n?o:e.userInfo}function qt(e){const t=Lo();(!t||!t.authenticated)&&Mo()?.(e)}const wo=`<div class="vertical-menu__wrapper">
<div class="vertical-menu__wrapper-title"></div>
</div>
`;function $t(e,t){const n=g(wo),o=n.querySelector(f(r.VERTICAL_MENU_WRAPPER__WRAPPER_TITLE));if(!o)throw new Error("renderMenuWithTitle: menuTitleDiv not found");return o.appendChild(document.createTextNode(t)),n.appendChild(e),n}const Oo=`<button class="utds-utah-id__button button--solid" type="button">UtahID Sign In</button>
`,Gt=`<div class="utds-utah-id-wrapper"></div>
`;let G=null;function zt(e){G=e,document.querySelectorAll(f(r.UTAH_ID__BUTTON)).forEach(n=>{if(n){if(n.innerHTML="",G?.userInfo?.authenticated){const s=document.createElement("span");s.appendChild(document.createTextNode("UtahID Account:")),s.classList.add(r.VISUALLY_HIDDEN),n.appendChild(s),n.appendChild(document.createTextNode(`Hello, ${G.userInfo.first||""}`))}else n.appendChild(document.createTextNode("UtahID Sign In"));const o=n.getAttribute("aria-controls");if(!o)throw new Error(`authChangedEventHandler: popup id for button not found - ${o}`);const i=document.getElementById(o);i&&st(n,i)}})}function st(e,t){e&&t&&(!!G?.isDefinitive&&!!G?.userInfo?.authenticated?(e.setAttribute("aria-haspopup","menu"),e.setAttribute("aria-expanded","false"),t.removeAttribute("aria-hidden")):(e.removeAttribute("aria-haspopup"),e.removeAttribute("aria-expanded"),t.setAttribute("aria-hidden","true")))}function Yt(){const e=g(Oo);return e.setAttribute("id",w()),G&&zt(G),e}function Kt(e){const t=M(),n=t.utahId!==!1&&t.utahId!==!0&&t.utahId?.onProfile,o=t.utahId!==!1&&t.utahId!==!0&&t.utahId?.onSignOut,i=[...t.utahId!==!0&&t.utahId!==!1&&t.utahId?.menuItems||[]];i.length&&i.push({isDivider:!0,title:"--divider--"});const s=[...i,{actionUrl:n?void 0:{url:He.PROFILE,openInNewTab:!0},actionFunction:n||void 0,title:"UtahID Profile"},{actionUrl:o?void 0:{url:He.SIGN_OUT},actionFunction:o||void 0,title:"Sign Out"}],l=fe(s,{childrenMenuType:y.INLINE}),c=e?$t(l,"Utah ID Menu"):l;return c.setAttribute("aria-label","Utah Id Menu"),c.setAttribute("id",w()),c}function yo(){const e=g(Gt),t=Yt();t.setAttribute("id",w()),e.appendChild(t);const n=Kt(!1),o=ot(t),i=o.querySelector(f(r.POPUP_CONTENT_WRAPPER));if(!i)throw new Error("renderUtahIdForDesktop: contentWrapper not found");return i.appendChild(n),e.appendChild(o),st(t,o),de(e,t,o,"menu",{isPerformPopup:()=>!!G?.isDefinitive&&!!G?.userInfo?.authenticated,onClick:s=>qt(s)}),e}function No(){const e=g(Gt),t=Yt(),n=t.getAttribute("id");if(!n)throw new Error("renderUtahIdForMobile: utahIdButton has no id");e.appendChild(t);const o=Kt(!0),i=o.getAttribute("id");if(!i)throw new Error("renderUtahIdForMobile: utahIdPopupMenu has no id");return e.appendChild(o),t.setAttribute("aria-controls",i),o.setAttribute("aria-labelledby",n),st(t,o),{button:t,menu:o}}const So=`<div class="utds-citizen-experience-wrapper"></div>
`;function Po(){const e=g(So),t=bo();return t&&e.appendChild(t),M().utahId!==!1&&e.appendChild(yo()),e}const Co=`<div class="utds-citizen-experience-wrapper--mobile"></div>
`,Ro=`<div class="utds-title-wrapper">
<div class="utds-title-wrapper__logo"></div>
<div class="utds-title-wrapper__title"></div>
</div>
`,Uo=`<a class="utds-title-wrapper">
<div class="utds-title-wrapper__logo"></div>
<div class="utds-title-wrapper__title"></div>
</a>
`;function Do(){const e=M(),t=e.titleUrl||e.titleURL,n=g(t?Uo:Ro);if(!n)throw new Error("LogoTitle: titleWrapper is null");if(t&&n.setAttribute("href",t),e.titleFunction){if(n.onclick)throw new Error("LogoTitle: logoTitleWrapper already has an onclick");n.onclick=e.titleFunction}const o=n.querySelector(f(r.TITLE__LOGO));if(!o)throw new Error("LogoTitle: logoWrapper is null");const i=e.logo,s=e.showTitle,l=e.title;if(i){let d;if(i.htmlString)d=g(W(i.htmlString));else if(i.element)d=W(i.element);else if(i.imageUrl)d=g(`<img src=${W(i.imageUrl)} id="design-system-logo" />`);else throw new Error("LogoTitle: logo set but has no settings");d.setAttribute("role","presentation"),o.appendChild(d)}else n.removeChild(o);const c=document.createTextNode(l),a=n.querySelector(f(r.TITLE__TITLE));return a?.appendChild(c),!s&&i&&a?.classList.add(r.VISUALLY_HIDDEN),n}const xo=`{
"name": "@utahdts/utah-design-system-header",
"version": "4.1.0",
"description": "Utah Header for the Utah Design System",
"exports": {
".": {
"development-local": "./src/index.js",
"development": "./dist/utah-design-system-header.es.js",
"production": "./dist/utah-design-system-header.es.js",
"import": {
"types": "./dist/index.d.ts",
"default": "./dist/utah-design-system-header.es.js"
},
"types": "./dist/index.d.ts",
"require": "./dist/utah-design-system-header.umd.js",
"default": [
"./dist/utah-design-system-header.es.js",
"./dist/utah-design-system-header.umd.js",
"./src/index.js"
]
},
"./css": "./dist/style.css",
"./dist/*": "./dist/*"
},
"main": "./src/index.js",
"types": "./dist/index.d.ts",
"files": [
"src/css",
"dist"
],
"scripts": {
"build": "vite build",
"buildw": "vite build --watch",
"buildTypes": "mkdir -p dist && cp ./artifacts/index.d.ts ./dist/",
"generateTypes": "npx tsc",
"clean": "run-s cleanPackageLock cleanDist cleanNodeModules",
"cleani": "run-s clean npmi",
"cleanDist": "rimraf ./dist",
"cleanNodeModules": "rimraf ./node_modules",
"cleanPackageLock": "rimraf package-lock.json",
"npmi": "npm i",
"preview": "vite preview",
"publishHeader": "npm publish --access public",
"test-publish": "npm publish --dry-run",
"test": "vitest",
"testw": "vitest",
"testc": "vitest run --coverage",
"testOnce": "vitest run",
"testui": "vitest --ui",
"tsc": "tsc",
"tscw": "tsc --watch --skipLibCheck",
"watch": "vite build --watch"
},
"repository": {
"type": "git",
"url": "git+https://github.com/utahdts/utah-design-system.git"
},
"keywords": [
"design system",
"dts",
"utah",
"utah header",
"components"
],
"license": "Apache 2.0",
"bugs": {
"url": "https://github.com/utahdts/utah-design-system/issues"
},
"homepage": "https://github.com/utahdts/utah-design-system#readme",
"dependencies": {
"@floating-ui/dom": "1.7.3"
},
"devDependencies": {
"@vitest/ui": "3.2.4",
"jsdom": "26.1.0",
"replace": "1.2.2",
"sass": "1.90.0",
"tslib": "2.8.1",
"typescript": "5.9.2",
"vite": "7.1.3",
"vitest": "3.2.4"
},
"type": "module"
}
`,Ho=`<div class="utah-logo-wrapper">
<button class="utah-logo-svg" id="utah-logo-svg" aria-haspopup="dialog">
<span class="visually-hidden" id="utah-logo-description">An official website of the state of Utah. Click to learn
more.</span>
<svg viewBox="0 0 137.363 56.6959" role="img">
<g>
<g>
<path
d="M15.972,39.161c-5.4,0-9.4127-1.5667-12.038-4.7C1.3087,31.3277-.0027,26.466,0,19.876V0H10.175V21.06c0,3.4313,.4633,5.847,1.39,7.247,.9909,1.434,2.669,2.2337,4.407,2.1,1.7525,.124,3.4436-.6712,4.466-2.1,.966-1.4,1.449-3.8157,1.449-7.247V0h9.82V19.876c0,6.586-1.2817,11.4467-3.845,14.582-2.5633,3.1353-6.5267,4.703-11.89,4.703Zm31.353-.711V8.518h-10.175V0h30.525V8.518h-10.175v29.932h-10.175Zm33.6-18.693l-.651,2.662h7.1l-.651-2.662c-.4733-1.8533-.9467-3.8647-1.42-6.034-.4733-2.1693-.945-4.2197-1.415-6.151h-.237c-.434,1.972-.8777,4.0327-1.331,6.182s-.918,4.1507-1.394,6.004l-.001-.001Zm-14.788,18.693L77.85,0h12.3l11.717,38.45h-10.767l-1.893-8.162h-10.766l-1.893,8.162h-10.411Zm39.4,0V0h10.175V14.316h11.476V0h10.175V38.45h-10.175v-15.261h-11.479v15.261h-10.172Z" />
</g>
<text transform="translate(.0419 52.5939)" aria-hidden="true">
<tspan x="0" y="0">An official state website</tspan>
</text>
</g>
</svg>
</button>
</div>
`,Bo=`<div class="utah-logo-wrapper">
<button class="utah-logo-svg" id="utah-logo-svg" aria-haspopup="dialog">
<span class="visually-hidden" id="utah-logo-description">An official website of the state of Utah. Click to learn
more.</span>
<svg viewBox="0 0 105.9496 47.6226" role="img">
<g>
<g>
<path
d="M12.2714,30.0877c-4.1489,0-7.2318-1.2037-9.2489-3.611C1.0055,24.0693-.002,20.334,0,15.2709V0H7.8175V16.1806c0,2.6363,.356,4.4923,1.0679,5.5679,.7613,1.1018,2.0506,1.7162,3.3859,1.6134,1.3465,.0953,2.6458-.5157,3.4313-1.6134,.7422-1.0756,1.1133-2.9316,1.1133-5.5679V0h7.5448V15.2709c0,5.0601-.9847,8.7946-2.9541,11.2035-1.9694,2.4089-5.0145,3.6133-9.1352,3.6133Zm24.0887-.5463V6.5444h-7.8175V0h23.4526V6.5444h-7.8175V29.5414h-7.8175Zm25.8151-14.362l-.5002,2.0452h5.455l-.5002-2.0452c-.3637-1.4239-.7273-2.9693-1.091-4.636-.3637-1.6667-.7261-3.242-1.0871-4.7259h-.1821c-.3334,1.5151-.6743,3.0983-1.0226,4.7497s-.7053,3.189-1.071,4.6129l-.0008-.0008Zm-11.3617,14.362L59.8127,0h9.4502l9.0023,29.5414h-8.2724l-1.4544-6.2709h-8.2716l-1.4544,6.2709h-7.9988Zm30.2713,0V0h7.8175V10.9991h8.8171V0h7.8175V29.5414h-7.8175v-11.7251h-8.8194v11.7251h-7.8152Z" />
</g>
<text transform="translate(.0419 43.5205)" aria-hidden="true">
<tspan x="0" y="0">An official website</tspan>
</text>
</g>
</svg>
</button>
</div>
`,ko=`<div class="utds-official-website-hover__wrapper">
How do I know it's official?<br />
Learn more.
</div>
`,Wo=xo;let Zt=!1;function Fo(){const e=M();let t;switch(e.size){case se.LARGE:t=Ho;break;case se.SMALL:case se.MEDIUM:t=Bo;break;default:throw new Error(`Unknown settings size: '${M().size}'`)}const n=g(t);if(!n.querySelector(f(r.LOGO_SVG)))throw new Error("UtahLogo: logoButton not found");if(n.setAttribute("id",w()),Te(n,g(ko)),!Zt&&(!window.location.hostname||!["localhost","127.0.0.1","::1",".local"].find(i=>window.location.hostname.includes(i)))){Zt=!0;const i=document.createElement("img");i.classList.add("utah-logo-wrapper__data"),i.classList.add("hidden"),i.ariaHidden="true",i.src=`https://uds-data-a234spjofq-wm.a.run.app/${Wo.version}.png?applicationType=${encodeURIComponent(e.applicationType||"unspecified")}`,n.appendChild(i)}return n}const Vo=`<h1 class="utds-logo-wrapper"></h1>
`,qo=`<header class="utah-design-system utds-header" aria-label="Utah.gov Header"></header>
`,$o=`<span class="utds-logo-vert-line"></span>
`;function Go(){const e=g(qo);e.classList.add(`utds-header--${M().size?.toLowerCase()||se.MEDIUM}`);const t=g(Vo);return e.appendChild(t),t.appendChild(Fo()),t.appendChild(g($o)),t.appendChild(Do()),e.appendChild(Po()),e.appendChild(g(Co)),e}const zo=`<div class="utah-design-system visually-hidden" id="search-modal">
<div class="search-modal__close-button-wrapper">
<button type="button" class="search-modal__close-button button icon-button icon-button--borderless">
<span class="utds-icon-before-x-icon" aria-hidden="true"></span>
<span class="visually-hidden">Close search modal</span>
</button>
</div>
<div class="search-modal">
<form class="search-modal__form hcenter" role="search" aria-label="Sitewide" autocomplete="off">
<span class="utds-icon-before-search search-modal__icon-search search-input__icon-search vcenter" aria-hidden="true"></span>
<label for="search-modal-input-id" class="search-modal__input-label visually-hidden">Enter your search
terms</label>
<input type="text" id="search-modal-input-id" placeholder="Search" class="search-modal__input">
<div class="search-modal__button-wrapper vcenter visually-hidden">
<button type="submit" class="search-modal__button button button--solid button--primary-color">
Search Now
</button>
</div>
<div aria-hidden tabindex="0" class="search-modal__hidden-last-focusable visually-hidden">
end of search form
</div>
</form>
</div>
<div class="search-backdrop modal-backdrop backdrop-dark"></div>
</div>
`;function at(e){const t=b(e||document.getElementById(r.SEARCH__SEARCH_MODAL),`setupSearchModal: '#${r.SEARCH__SEARCH_MODAL}' not found`),n=b(t.querySelector(f(r.SEARCH__SEARCH_BACKDROP)),"setupSearchModal: backdrop not found"),o=b(t.querySelector(f(r.SEARCH__SEARCH_CLOSE_BUTTON)),"setupSearchModal: closeButton not found"),i=b(t.querySelector(f(r.SEARCH__SEARCH_BUTTON)),"setupSearchModal: searchButton not found"),s=b(t.querySelector(f(r.SEARCH__SEARCH_BUTTON_WRAPPER)),"setupSearchModal: searchButtonWrapper not found"),l=b(t.querySelector(f(r.SEARCH__SEARCH_INPUT)),"setupSearchModal: searchInput not found"),c=b(t.querySelector(".search-modal__hidden-last-focusable"),"setupSearchModal: hiddenLastFocusableButton not found");return{backdrop:n,closeButton:o,hiddenLastFocusableButton:c,searchButton:i,searchButtonWrapper:s,searchInput:l,searchModal:t}}function ve(){b(document.getElementById(r.SEARCH__SEARCH_MODAL),"closeSearchModal: search modal not found").classList.add(r.VISUALLY_HIDDEN);const{closeButton:t,hiddenLastFocusableButton:n}=at(),o=document.querySelector(f(r.MAIN_MENU__SEARCH));o&&document.activeElement?.closest(`#${r.SEARCH__SEARCH_MODAL}`)&&o.focus(),t.tabIndex=-1,n.tabIndex=-1}function ct(){b(document.getElementById(r.SEARCH__SEARCH_MODAL),"showSearchModal: search modal not found").classList.remove(r.VISUALLY_HIDDEN);const{searchInput:t,closeButton:n,hiddenLastFocusableButton:o}=at();t.focus(),n.tabIndex=0,o.tabIndex=0}function Yo(){const e=g(zo),{backdrop:t,closeButton:n,hiddenLastFocusableButton:o,searchButton:i,searchButtonWrapper:s,searchInput:l}=at(e);i.onclick=c=>{c.preventDefault(),c.stopPropagation(),ve();const{onSearch:a}=M();a&&a?.(l.value)},n.onclick=c=>{c.preventDefault(),c.stopPropagation(),ve()},t.onclick=c=>{c.preventDefault(),c.stopPropagation(),ve()},document.body.appendChild(e),l.oninput=()=>{s.classList.remove(r.VISUALLY_HIDDEN)},i.onfocus=()=>{s.classList.remove(r.VISUALLY_HIDDEN)},e.onkeyup=c=>{(c.code==="Escape"||c.key==="Escape")&&(c.preventDefault(),c.stopPropagation(),ve())},n.addEventListener("focusout",c=>{c.preventDefault(),c.stopPropagation(),e.classList.contains(r.VISUALLY_HIDDEN)||(be[et.SHIFT]?i.focus():l.focus())}),o.addEventListener("focusin",c=>{c.preventDefault(),c.stopPropagation(),e.classList.contains(r.VISUALLY_HIDDEN)||n.focus()}),ve()}const Ko=`<li class="menu-item">
<span class="menu-item__title">
<button class="menu-item__button-title" type="button">
<span class="menu-item__link-title-span"></span>
<span class="menu-item__menu-arrow utds-icon-before-chevron-down" aria-hidden="true"></span>
</button>
<a class="menu-item__link-title">
<span class="menu-item__link-title-span"></span>
<span class="menu-item__menu-arrow utds-icon-before-chevron-down" aria-hidden="true"></span>
</a>
<span class="menu-chiclet"></span>
</span>
</li>
`,Zo=`<div class="utah-design-system main-menu__outer">
<div class="main-menu__wrapper">
<nav class="horizontal-menu main-menu__nav">
<h2 class="main-menu__title visually-hidden"></h2>
<ul class="main-menu__menu-top"></ul>
</nav>
<div class="main-menu__search">
<button type="button" class="button icon-button icon-button--borderless">
<div>
<span class="utds-icon-before-search" aria-hidden="true"></span>
<span class="visually-hidden">search</span>
</div>
</button>
</div>
<div class="utds-header-mobile__vip-action-items--left">
</div>
<div class="utds-header-mobile__utah-id-wrapper">
</div>
<div class="utds-header-mobile__vip-action-items--right">
</div>
<button type="button" class="button icon-button icon-button--borderless main-menu__hamburger"
id="utds-main-menu__hamburger">
<div>
<span class="utds-icon-before-hamburger" id="utds-main-menu__hamburger-icon" aria-hidden="true"></span>
</div>
</button>
</div>
</div>
`;function jo(){const e=M(),t=g(Zo);let n=t.querySelector(f(r.MAIN_MENU__NAV));if(!n)throw new Error("renderMainMenu(): mainMenu not created");const o=n.querySelector(f(r.MAIN_MENU__TITLE));if(!o)throw new Error("renderMainMenu(): titleTag not found");const i="main-menu__nav";if(n.setAttribute("aria-labelledby",i),o.setAttribute("id",i),e.mainMenu?o.innerHTML=e.mainMenu.title||"Main Menu":(n.remove(),n=null),e.mainMenu){const c=n?.querySelector(f(r.MAIN_MENU__MENU_TOP));if(!c)throw new Error("renderMainMenu(): mainMenuTop not found");e.mainMenu.menuItems.forEach(a=>{const d=g(Ko);c.appendChild(d);const _=b(d.querySelector(f(r.MENU_ITEM__TITLE)),`renderMainMenu(): sub menu title not found for ${a.title}`),p=b(_.querySelector(f(r.MENU_ITEM__BUTTON_TITLE)),`renderMainMenu(): button title not found for ${a.title}`);p.setAttribute("id",`${r.MENU_ITEM__BUTTON_TITLE}__${a.title.replaceAll(" ","")}-${w()}`),a.className&&p.classList.add(a.className);const m=b(_.querySelector(f(r.MENU_ITEM__LINK_TITLE)),`renderMainMenu(): link title not found for ${a.title}`);m.setAttribute("id",`${r.MENU_ITEM__LINK_TITLE}__${a.title.replaceAll(" ","")}-${w()}`),a.className&&m.classList.add(a.className);let u;if(a.actionMenu||a.actionFunction)u=p,m.remove();else if(a.actionFunctionUrl||a.actionUrl)u=m,p.remove();else throw new Error(`renderMainMenu(): menuItem is missing an action: ${a.title}`);const h=b(u.querySelector(f(r.MENU_ITEM__LINK_TITLE_SPAN)),`renderMainMenu(): main menu item title span not found for: ${a.title}`);if(a.isSelected&&u.classList.add(r.MENU_ITEM__SELECTED),a.actionMenu){const E=e.mainMenu;h.innerHTML=a.title;const T=[...a.actionMenu];(a.actionFunction||a.actionUrl||a.actionFunctionUrl)&&!a.isOverviewHidden&&T.unshift({actionFunction:a.actionFunction,actionFunctionUrl:a.actionFunctionUrl,actionUrl:a.actionUrl,className:a.className,icon:a.icon,title:`${a.title}${Ut(a,E.parentMenuLinkSuffix)}`});const I={menuItems:T,title:a.title},A=it(I,u,{childrenMenuType:a.childrenMenuType||y.FLYOUT,parentMenuLinkSuffix:E.parentMenuLinkSuffix});d.appendChild(A),de(d,u,A,"menu",{shouldFocusOnHover:!0,doNotClosePopupOnClick:!0});let v;switch(a.childrenMenuType){case y.INLINE:v=r.MENU_ITEM__INLINE;break;case y.MEGA_MENU:v=r.MENU_ITEM__MEGA_MENU;break;case y.FLYOUT:default:v=r.MENU_ITEM__FLY_OUT;break}d.classList.add(v)}else b(u.querySelector(f(r.MENU_ITEM__ARROW)),`renderMainMenu(): menu arrow not found for ${a.title}`).remove();if(a.actionFunction?(h.innerHTML=a.title,a.actionMenu||(u.onclick=a.actionFunction)):a.actionFunctionUrl?(h.innerHTML=a.title,u.setAttribute("href",a.actionFunctionUrl.url),a.actionMenu||(u.onclick=E=>{a.actionFunctionUrl?.skipHandleEvent||(E.stopPropagation(),E.preventDefault()),a.actionFunctionUrl?.actionFunction(E)})):a.actionUrl&&(h.innerHTML=a.title,u.setAttribute("href",a.actionUrl.url)),!a.actionMenu&&(a.actionUrl?.openInNewTab||a.actionFunctionUrl?.openInNewTab)&&(u.setAttribute("target","_blank"),u.appendChild(g(nt))),a.icon){const E=g(a.icon);E.setAttribute("role","presentation"),u.insertBefore(E,h)}})}let s=null;if(e.utahId){const{button:c,menu:a}=No();s=a,b(t.querySelector(f(r.MOBILE__UTAH_ID)),"renderMainMenu: utahIdButtonWrapper not found").appendChild(c)}const l=b(t.querySelector(f(r.MAIN_MENU__SEARCH)),"renderMainMenu: searchIcon not found");if(e.onSearch){if(Yo(),Te(l,document.createTextNode("Search")),l.onclick)throw new Error("searchIcon already has onclick");if(l.onclick=()=>ct(),!e.mainMenu){const c=b(document.querySelector(f(r.CITIZEN_EXPERIENCE)),"renderMainMenu: citizen experience wrapper not found"),a=g(l.outerHTML);if(Te(a,document.createTextNode("Search")),a.onclick=()=>ct(),l.classList.add(r.DESKTOP__HIDDEN),e.utahId!==!1){const d=b(document.querySelector(f(r.UTAH_ID)),"renderMainMenu: utahId wrapper not found");c.insertBefore(a,d)}else c.appendChild(a)}if(!e.mainMenu&&!e.actionItems&&e.utahId===!1){const c=g(l.outerHTML);if(Te(c,document.createTextNode("Search")),c.onclick)throw new Error("searchIconMobile already has onclick");c.onclick=()=>ct(),b(document.querySelector(f(r.CITIZEN_EXPERIENCE_MOBILE)),"renderMainMenu: citizen-experience--mobile not found").appendChild(c)}}return e.onSearch||((e.mainMenu||!e.mainMenu&&e.utahId)&&l.parentElement?.insertBefore(g('<div class="main-menu__search-placeholder">'),l),l.remove()),{mainMenuWrapper:t,utahIdPopup:s}}const Xo=`<div class="utah-design-system utds-official-website-popup__wrapper visually-hidden" tabindex="-1">
<h2 class="utds-official-website-popup__heading">
An official website of the state of Utah. Here's how you know:
</h2>
<div class="utds-official-website-popup__content">
<div class="utds-official-website-popup__col">
<div class="utds-icon-before-verified big-icon" aria-hidden="true"></div>
<div>
<strong>Official Utah websites use utah.gov in the browser's address bar.</strong><br />
A Utah.gov website belongs to an official government organization in the state of Utah.
<div class="utds-official-website-popup__address-bar"></div>
</div>
</div>
<div class="utds-official-website-popup__col">
<div class="utds-icon-before-lock big-icon" aria-hidden="true"></div>
<div>
<strong>Be careful when sharing sensitive information.</strong><br />
Share sensitive information only on secure official Utah.gov websites.
</div>
</div>
<div>
<svg class="utds-official-website-popup__official-image" viewBox="0 0 105.9496 47.6226" role="img">
<g>
<g>
<path
d="M12.2714,30.0877c-4.1489,0-7.2318-1.2037-9.2489-3.611C1.0055,24.0693-.002,20.334,0,15.2709V0H7.8175V16.1806c0,2.6363,.356,4.4923,1.0679,5.5679,.7613,1.1018,2.0506,1.7162,3.3859,1.6134,1.3465,.0953,2.6458-.5157,3.4313-1.6134,.7422-1.0756,1.1133-2.9316,1.1133-5.5679V0h7.5448V15.2709c0,5.0601-.9847,8.7946-2.9541,11.2035-1.9694,2.4089-5.0145,3.6133-9.1352,3.6133Zm24.0887-.5463V6.5444h-7.8175V0h23.4526V6.5444h-7.8175V29.5414h-7.8175Zm25.8151-14.362l-.5002,2.0452h5.455l-.5002-2.0452c-.3637-1.4239-.7273-2.9693-1.091-4.636-.3637-1.6667-.7261-3.242-1.0871-4.7259h-.1821c-.3334,1.5151-.6743,3.0983-1.0226,4.7497s-.7053,3.189-1.071,4.6129l-.0008-.0008Zm-11.3617,14.362L59.8127,0h9.4502l9.0023,29.5414h-8.2724l-1.4544-6.2709h-8.2716l-1.4544,6.2709h-7.9988Zm30.2713,0V0h7.8175V10.9991h8.8171V0h7.8175V29.5414h-7.8175v-11.7251h-8.8194v11.7251h-7.8152Z" />
</g>
<text transform="translate(.0419 43.5205)" aria-hidden="true">
<tspan x="0" y="0">An official website</tspan>
</text>
</g>
</svg>
<div class="utds-official-website-popup__copyright">© State of Utah</div>
</div>
</div>
<button type="button" class="utds-official-website-popup__close-button button icon-button icon-button--borderless"
tabIndex="-1">
<span class="utds-icon-before-x-icon" aria-hidden="true"></span>
<span class="visually-hidden">Close official website popup</span>
</button>
</div>
`;function jt(){const e=b(document.querySelector(f(r.LOGO_OFFICIAL_WRAPPER)),"openOfficialWebsite: official wrapper not found"),t=b(document.querySelector(f(r.LOGO)),"openOfficialWebsite: logoWrapper not found"),n=b(t.querySelector(f(r.LOGO_SVG)),"openOfficialWebsite: logoButton not found"),o=b(e.querySelector(f(r.LOGO_OFFICIAL_CLOSE_BUTTON)),"openOfficialWebsite: official close button not found");e.classList.add(r.VISUALLY_HIDDEN),n.setAttribute("aria-expanded","false"),e.setAttribute("aria-hidden","true"),o.setAttribute("tabIndex","-1"),e.setAttribute("tabIndex","-1"),document.querySelectorAll(f(r.TOOLTIP__WRAPPER))?.forEach(s=>{s.classList.add(r.TOOLTIP__WRAPPER__HIDDEN),s.classList.remove(r.TOOLTIP__WRAPPER__VISIBLE)})}function Jo(){const e=b(document.querySelector(f(r.LOGO_OFFICIAL_WRAPPER)),"openOfficialWebsite: official wrapper not found"),t=b(document.querySelector(f(r.LOGO)),"openOfficialWebsite: logoWrapper not found"),n=b(t.querySelector(f(r.LOGO_SVG)),"openOfficialWebsite: logoButton not found"),o=b(e.querySelector(f(r.LOGO_OFFICIAL_CLOSE_BUTTON)),"openOfficialWebsite: official close button not found");e.classList.remove(r.VISUALLY_HIDDEN),o.removeAttribute("tabIndex"),e.removeAttribute("tabIndex"),n.setAttribute("aria-expanded","true"),e.setAttribute("aria-hidden","false"),e.focus(),document.querySelectorAll(f(r.TOOLTIP__WRAPPER))?.forEach(s=>{s.classList.add(r.TOOLTIP__WRAPPER__HIDDEN),s.classList.remove(r.TOOLTIP__WRAPPER__VISIBLE)}),ye()}function Qo(){const e=g(Xo),n=document.querySelector(f(r.LOGO))?.querySelector(f(r.LOGO_SVG));if(!n)throw new Error("renderOfficialWebsite: logoButton not found");if(n.onclick)throw new Error("renderOfficialWebsite: logoButton already has an onclick");const o=e.querySelector(f(r.LOGO_OFFICIAL_CLOSE_BUTTON));if(!o)throw new Error("renderOfficialWebsite: closeButton not found");return n.onclick=()=>{e.classList.toggle(r.VISUALLY_HIDDEN),e.classList.contains(r.VISUALLY_HIDDEN)?jt():Jo(),document.querySelectorAll(f(r.TOOLTIP__WRAPPER))?.forEach(s=>{s.classList.add(r.TOOLTIP__WRAPPER__HIDDEN),s.classList.remove(r.TOOLTIP__WRAPPER__VISIBLE)})},o.onclick=()=>{e.classList.toggle(r.VISUALLY_HIDDEN),n.focus(),n.setAttribute("aria-expanded","false"),e.setAttribute("aria-hidden","true")},o.id||(o.id=w()),e.id||(e.id=w()),n.setAttribute("aria-controls",e.id),n.setAttribute("aria-expanded","false"),e.setAttribute("aria-hidden","true"),e.setAttribute("aria-labelledby",n.id),e}function ei(e){const{hamburger:t}=he("hookupHamburger"),n=(d=>b(t,`hookupHamburger: hamburger required but is null: ${d}`)),o=M();if(o.actionItems?.some(d=>!!d.badge)){const d=rt({label:"Home Badge"});d&&n("home badge").appendChild(d)}ye();function s(){const d=b(document.querySelectorAll(`.${r.MOBILE_MENU__ACTION_BAR} .${r.MOBILE_MENU_ACTION_BAR__ACTION_ITEM_WRAPPER}`)[0],"hookupHamburger: no action items to select on mobile hamburger open"),p=d.querySelector("button")?.getAttribute("aria-controls");return{actionItem:d,actionItemWrapper:p?document.getElementById(p):null}}const l=b(document.querySelectorAll(`.${r.MOBILE_MENU__ACTION_BAR} .${r.MOBILE_MENU_ACTION_BAR__ACTION_ITEM_WRAPPER}`)[0],"hookupHamburger: no action items to select on mobile hamburger open"),c=l.querySelector?.("button"),a=(c||l).getAttribute("id");if(!a)throw new Error("mobileMenuInteractionHandler: actionItemId not found");if(e){const d=e.getAttribute("id");if(!d)throw new Error("mobileMenuInteractionHandler: mobileMainMenuContentItemId not found");(c||l).setAttribute("aria-controls",d),e.setAttribute("aria-labelledby",a)}t&&Fe(t,()=>s().actionItemWrapper,()=>s().actionItem,{additionalOnClick:()=>jt(),ariaHasPopupType:"menu",shouldOnClickCloseMenu:!0}),t&&(D(!!t.onblur,"hookupHamburger: hamburger already has an onblur event"),t.onblur=()=>{const{mobileMenu:d}=he("showMobileMenu");if(d.classList.contains(r.IS_OPEN)){const _=f(r.MOBILE_MENU__ACTION_BAR),p=f(r.MOBILE_MENU_ACTION_BAR__ACTION_ITEM_WRAPPER),m=f(r.ICON_BUTTON);document.querySelector(`${_} ${p}:first-child ${m}`)?.focus()}}),(o.mainMenu||o.actionItems)&&!o.onSearch&&o.utahId===!1&&(b(document.querySelector(f(r.CITIZEN_EXPERIENCE_MOBILE)),"hookupHamburger: citizen experience mobile not found").appendChild(n("adding to citizen experience")),b(document.querySelector(f(r.MAIN_MENU)),"hookupHamburger: main menu not found").classList.add(r.MOBILE__HIDDEN)),o.onSearch&&!o.mainMenu&&b(document.querySelector(f(r.MAIN_MENU)),"renderMainMenu: main menu not found").classList.add(r.DESKTOP__HIDDEN)}function ti(){const e=document.getElementById(r.MOBILE_MENU_ACTON_BAR__PROFILE_ID);if(!e)throw new Error("removeUtahIdInMobileMenu: profileActionItem not found");const t=e.closest(f(r.MOBILE_MENU_ACTION_BAR__ACTION_ITEM_WRAPPER));if(!t)throw new Error("removeUtahIdInMobileMenu: profileActionItemWrapper not found");t.remove()}function ni(e,t){const n=document.querySelector(f(r.MOBILE__UTAH_ID));if(!n)throw new Error("hookupUtahIdInMobileMenu: utahIdWrapper not found");const o=n.querySelector(f(r.UTAH_ID__BUTTON));if(!o)throw new Error("hookupUtahIdInMobileMenu: utahIdButton not found");if(!e.querySelector(f(r.MOBILE_MENU__CONTENT)))throw new Error("hookupUtahIdInMobileMenu: mobileContentWrapper not found");const s=document.getElementById(r.MOBILE_MENU_ACTON_BAR__PROFILE_ID);if(!s)throw new Error("hookupUtahIdInMobileMenu: profileActionItem not found");const l=s.closest(f(r.MOBILE_MENU_ACTION_BAR__ACTION_ITEM_WRAPPER));if(!l)throw new Error("hookupHamburger: profileActionItemWrapper not found");const c=ke(t);Fe(o,c,l,{ariaHasPopupType:"menu",onClickHandler:a=>(qt(a),!1),shouldOnClickCloseMenu:!0})}const oi=`<div class="utah-design-system utds-header-mobile-menu" id="utds-header-mobile-menu">
<div class="utds-header-mobile-menu__backdrop" aria-hidden></div>
<div class="utds-header-mobile-menu__wrapper">
<div class="utds-header-mobile-menu__action-bar" role="tablist">
<div class="utds-header-mobile-menu__action-item" role="tab">
<button type="button" class="icon-button icon-button--borderless utds-header-action-item__icon-button icon-home"
id="utds-header-mobile-menu_action-bar__home">
<div class="utds-header-action-item__title visually-hidden">Main Menu</div>
<span class="utds-icon-before-home-menu" aria-hidden="true" role="presentation">
</span>
</button>
<span class="menu-chiclet"></span>
</div>
<div class="utds-header-mobile-menu__action-item" role="tab">
<button type="button"
class="icon-button icon-button--borderless utds-header-action-item__icon-button icon-profile"
id="utds-header-mobile-menu_action-bar__profile">
<div class="utds-header-action-item__title visually-hidden">Profile</div>
<span class="utds-icon-before-account" aria-hidden="true" role="presentation">
</span>
</button>
<span class="menu-chiclet"></span>
</div>
</div>
<div class="utds-header-mobile-menu__content"> </div>
<div aria-hidden tabindex="0" class="utds-header-mobile-menu__hidden-last-focusable visually-hidden">
end of mobile content form
</div>
</div>
</div>
`;function ii(){const e=M();return fe(e.mainMenu&&e.mainMenu?.menuItems||void 0,{childrenMenuType:y.INLINE,parentMenuLinkSuffix:typeof e.mainMenu=="object"?e.mainMenu.parentMenuLinkSuffix:void 0,removePopupArrow:!0})}const ri=`<div class="utah-design-system skip-link__wrapper">
<div class="skip-link__tab">
<a href="#" class="skip-link__link button button--solid button--primary-color" id="skip-link">Skip to main content</a>
</div>
</div>
`;function si(){const{skipLinkUrl:e}=M();let t;if(e){t=g(ri);const n=t.querySelector(f(r.SKIP_LINK_LINK));if(!n)throw new Error("Skip Link Link is null");n.setAttribute("href",e)}else t=null,console.warn("Utah Design System: It is best practice to provide a skip link url (skipLinkUrl). See: https://designsystem.utah.gov/library/components/navigationLinks/skipLink");return t}function ai(){const t=[...document.querySelectorAll(`
${f(r.MOBILE_MENU__ACTION_BAR)}
${f(r.MOBILE_MENU_ACTION_BAR__ACTION_ITEM_WRAPPER)}
${f(r.ACTION_ITEM__ICON_BUTTON)}
`)];t.forEach(i=>{i.onkeydown=(s=>{(s.code==="Home"||s.code==="End"||s.code==="ArrowRight"||s.code==="ArrowLeft")&&s.preventDefault()}),i.onkeyup=(s=>{const l=t.indexOf(i);let c=NaN;if(s.code==="Home"?c=0:s.code==="End"?c=t.length-1:s.code==="ArrowRight"?c=(l+1)%t.length:s.code==="ArrowLeft"&&(c=(t.length+l-1)%t.length),!Number.isNaN(c)){s.preventDefault(),s.stopPropagation();const a=t[c],d=a?.closest(f(r.MOBILE_MENU_ACTION_BAR__ACTION_ITEM_WRAPPER));if(!d)throw new Error("hookupMobileActionItemKeyboarding: newWrapper not found... how in the blazes?!");const _=a?.getAttribute("aria-controls");if(_&&document.getElementById(_))a?.click();else{const u=document.querySelector(f(r.MOBILE_MENU__WRAPPER));if(!u)throw new Error("hookupMobileActionItemKeyboarding: mobileMenuWrapper not found");const h=u.querySelector(f(r.MOBILE_MENU__CONTENT));if(!h)throw new Error("hookupMobileActionItemKeyboarding: mobileContentWrapper not found");h.querySelectorAll(f(r.MOBILE_MENU__CONTENT_ITEM)).forEach(E=>E.classList.remove(r.IS_OPEN))}const m=document.querySelector(f(r.MOBILE_MENU__WRAPPER));if(!m)throw new Error("hookupMobileActionItemKeyboarding: mobileMenuWrapper not found");We(m,d)}})});const n=b(document.querySelector(f(r.MOBILE_MENU__LAST_FOCUSABLE)),"hookupMobileActionItemKeyboarding: hiddenLastFocusableButton not found"),{hamburger:o}=he("hookupMobileActionItemKeyboarding");n.addEventListener("focusin",i=>{i.preventDefault(),i.stopPropagation(),o?.focus()})}function ci(){const e=on.replace(r.MEDIA_SIZE__TABLET_PORTRAIT__PLACEHOLDER,`${M().mediaSizes.tabletPortrait}px`).replace(r.MEDIA_SIZE__TABLET_LANDSCAPE__PLACEHOLDER,`${M().mediaSizes.tabletLandscape}px`).replace(r.MEDIA_SIZE__MOBILE__PLACEHOLDER,`${M().mediaSizes.mobile}px`);let t=document.getElementById(r.CSS_HEADER_MEDIA_TAG_ID);t||(t=document.createElement("style"),t.id=r.CSS_HEADER_MEDIA_TAG_ID),t.innerHTML=e,document.body.appendChild(t)}function li(){const e=M();let t=document.body;if(e.domLocationTarget){const n=[e.domLocationTarget.cssSelector,e.domLocationTarget.element,e.domLocationTarget.elementFunction].filter(o=>o);if(n.length<1)throw new Error("loadHeader: domLocationTarget must either have a value for one of its properties or not be specified at all");if(n.length>1)throw new Error("loadHeader: domLocationTarget must only have one target specified");if(e.domLocationTarget.cssSelector)t=document.querySelector(e.domLocationTarget.cssSelector),D(!t,`loadHeader: element not found for domLocationTarget.cssSelector ${e.domLocationTarget.cssSelector}`);else if(e.domLocationTarget.element)t=e.domLocationTarget.element;else if(e.domLocationTarget.elementFunction)t=e.domLocationTarget.elementFunction(),D(!t,"loadHeader: element not returned from domLocationTarget.elementFunction");else throw new Error("loadHeader: domLocationTarget must have at least one field set")}return b(t,"loadHeader: domTarget is null (how?!)")}function Xt(){if(!document.querySelector(f([r.UTAH_DESIGN_SYSTEM,r.HEADER]))){const t=Go(),n=li();n.insertBefore(t,n.firstChild);const o=Qo();t.after(o);const i=si(),s=document.body;i&&s&&s.insertBefore(i,s.firstChild);const{mainMenuWrapper:l,utahIdPopup:c}=jo();l&&o.after(l);const a=g(oi);o.after(a);const d=document.querySelector(f(r.MOBILE_MENU__BACKDROP));if(!d)throw new Error("mobileMenuInteractionHandler: mobileMenuBackdrop not found");if(d.onclick)throw new Error("mobileMenuInteractionHandler: mobileMenuBackdrop already has onclick");d.onclick=()=>ye();const _=ii(),p=$t(_,"Main Menu");p.appendChild(_);const m=ke(p);ei(m),c?(c.closest("div")?.removeAttribute("aria-labelledby"),ni(a,c)):ti(),fo(),ai(),Qn(),ci(),Ft().catch(h=>console.error(h));const u=M();(!u.mainMenu&&!u.actionItems&&u.utahId===!1&&!u.onSearch||!u.mainMenu&&!u.actionItems&&u.utahId===!1&&u.onSearch||!u.mainMenu&&u.actionItems&&u.utahId===!1&&!u.onSearch)&&(a.classList.add(r.MAIN_MENU__REMOVED),l.remove()),(!u.mainMenu&&!u.actionItems&&u.utahId&&!u.onSearch||!u.mainMenu&&u.actionItems&&u.utahId&&!u.onSearch||!u.mainMenu&&u.actionItems&&!u.utahId&&u.onSearch)&&l.classList.add(r.DESKTOP__HIDDEN)}ho()}function Jt(e){document.querySelector(f([r.UTAH_DESIGN_SYSTEM,r.SKIP_LINK_WRAPPER]))?.remove(),document.querySelector(f([r.UTAH_DESIGN_SYSTEM,r.HEADER]))?.remove(),document.querySelector(f([r.UTAH_DESIGN_SYSTEM,r.MAIN_MENU__OUTER]))?.remove(),document.querySelector(f([r.UTAH_DESIGN_SYSTEM,r.MOBILE_MENU]))?.remove(),document.querySelector(f([r.UTAH_DESIGN_SYSTEM,r.LOGO_OFFICIAL_WRAPPER]))?.remove(),document.getElementById(r.SEARCH__SEARCH_MODAL)?.remove(),Rt(),e&&setTimeout(()=>document.dispatchEvent(new Event(Be.HEADER_UNLOADED)),0)}function Qt(){Jt(!1),Xt()}const ui=15e3;let en=0;const tn=setInterval(()=>{en+=1,en>=ui||typeof window>"u"||window["@utahdts/utah-design-system-header"]?.isSetUtahHeaderSettingsCalled?clearInterval(tn):document.dispatchEvent(new Event(Be.HEADER_LOADED))},2);window.addEventListener("unload",()=>{clearInterval(tn)});function nn(e){return Oe.setSettings(e),window["@utahdts/utah-design-system-header"]&&(window["@utahdts/utah-design-system-header"].isSetUtahHeaderSettingsCalled=!0),document?.body?Qt():window.addEventListener("load",()=>Qt()),Oe.getSettings()}function di(e){return nn({..._e,...Oe.getSettings(),footer:e})}O.PopupPlacement=re,O.childrenMenuTypes=y,O.defaultSettings=_e,O.events=Be,O.getUtahHeaderSettings=M,O.loadHeader=Xt,O.popupFocusHandler=de,O.removeHeader=Jt,O.renderDOMSingle=g,O.setUtahFooterSettings=di,O.setUtahHeaderSettings=nn,O.sizes=se,Object.defineProperty(O,Symbol.toStringTag,{value:"Module"})}));