"use strict";(globalThis.webpackChunk=globalThis.webpackChunk||[]).push([["vendors-node_modules_github_auto-complete-element_dist_index_js"],{60902:(t,e,i)=>{i.d(e,{ZP:()=>v});var n,s,o,r,a,l=i(10160);let u=window.testScreenReaderDelay||100;let Autocomplete=class Autocomplete{constructor(t,e,i,n=!1){var s;if(this.container=t,this.input=e,this.results=i,this.combobox=new l.Z(e,i,{defaultFirstOption:n}),this.feedback=t.getRootNode().getElementById(`${this.results.id}-feedback`),this.autoselectEnabled=n,this.clearButton=t.getRootNode().getElementById(`${this.input.id||this.input.name}-clear`),this.clientOptions=i.querySelectorAll("[role=option]"),this.feedback&&(this.feedback.setAttribute("aria-live","polite"),this.feedback.setAttribute("aria-atomic","true")),this.clearButton&&!this.clearButton.getAttribute("aria-label")){let t=document.querySelector(`label[for="${this.input.name}"]`);this.clearButton.setAttribute("aria-label","clear:"),this.clearButton.setAttribute("aria-labelledby",`${this.clearButton.id} ${(null==t?void 0:t.id)||""}`)}this.input.getAttribute("aria-expanded")||this.input.setAttribute("aria-expanded","false"),this.results.popover?this.results.matches(":popover-open")&&this.results.hidePopover():this.results.hidden=!0,this.results.getAttribute("aria-label")||this.results.setAttribute("aria-label","results"),this.input.setAttribute("autocomplete","off"),this.input.setAttribute("spellcheck","false"),this.interactingWithList=!1,this.onInputChange=function(t,e=0){let i;return function(...n){clearTimeout(i),i=window.setTimeout(()=>{clearTimeout(i),t(...n)},e)}}(this.onInputChange.bind(this),300),this.onResultsMouseDown=this.onResultsMouseDown.bind(this),this.onInputBlur=this.onInputBlur.bind(this),this.onInputFocus=this.onInputFocus.bind(this),this.onKeydown=this.onKeydown.bind(this),this.onCommit=this.onCommit.bind(this),this.handleClear=this.handleClear.bind(this),this.input.addEventListener("keydown",this.onKeydown),this.input.addEventListener("focus",this.onInputFocus),this.input.addEventListener("blur",this.onInputBlur),this.input.addEventListener("input",this.onInputChange),this.results.addEventListener("mousedown",this.onResultsMouseDown),this.results.addEventListener("combobox-commit",this.onCommit),null===(s=this.clearButton)||void 0===s||s.addEventListener("click",this.handleClear)}destroy(){this.input.removeEventListener("keydown",this.onKeydown),this.input.removeEventListener("focus",this.onInputFocus),this.input.removeEventListener("blur",this.onInputBlur),this.input.removeEventListener("input",this.onInputChange),this.results.removeEventListener("mousedown",this.onResultsMouseDown),this.results.removeEventListener("combobox-commit",this.onCommit)}handleClear(t){t.preventDefault(),"true"===this.input.getAttribute("aria-expanded")&&(this.input.setAttribute("aria-expanded","false"),this.updateFeedbackForScreenReaders("Results hidden.")),this.input.value="",this.container.value="",this.input.focus(),this.input.dispatchEvent(new Event("change")),this.container.open=!1}onKeydown(t){if("Escape"===t.key&&this.container.open)this.container.open=!1,t.stopPropagation(),t.preventDefault();else if(t.altKey&&"ArrowUp"===t.key&&this.container.open)this.container.open=!1,t.stopPropagation(),t.preventDefault();else if(t.altKey&&"ArrowDown"===t.key&&!this.container.open){if(!this.input.value.trim())return;this.container.open=!0,t.stopPropagation(),t.preventDefault()}}onInputFocus(){this.fetchResults()}onInputBlur(){if(this.interactingWithList){this.interactingWithList=!1;return}this.container.open=!1}onCommit({target:t}){if(!(t instanceof HTMLElement)||(this.container.open=!1,t instanceof HTMLAnchorElement))return;let e=t.getAttribute("data-autocomplete-value")||t.textContent;this.updateFeedbackForScreenReaders(`${t.textContent||""} selected.`),this.container.value=e,e||this.updateFeedbackForScreenReaders("Results hidden.")}onResultsMouseDown(){this.interactingWithList=!0}onInputChange(){this.feedback&&this.feedback.textContent&&(this.feedback.textContent=""),this.container.removeAttribute("value"),this.fetchResults()}identifyOptions(){let t=0;for(let e of this.results.querySelectorAll('[role="option"]:not([id])'))e.id=`${this.results.id}-option-${t++}`}updateFeedbackForScreenReaders(t){setTimeout(()=>{this.feedback&&(this.feedback.textContent=t)},u)}fetchResults(){let t=this.input.value.trim();if(!t&&!this.container.fetchOnEmpty){this.container.open=!1;return}let e=this.container.src;if(!e)return;let i=new URL(e,window.location.href),n=new URLSearchParams(i.search.slice(1));n.append("q",t),i.search=n.toString(),this.container.dispatchEvent(new CustomEvent("loadstart")),this.container.fetchResult(i).then(t=>{this.results.innerHTML=t,this.identifyOptions(),this.combobox.indicateDefaultOption();let e=this.results.querySelectorAll('[role="option"]'),i=!!e.length,n=e.length,[s]=e,o=null==s?void 0:s.textContent;this.autoselectEnabled&&o?this.updateFeedbackForScreenReaders(`${n} results. ${o} is the top result: Press Enter to activate.`):this.updateFeedbackForScreenReaders(`${n||"No"} results.`),this.container.open=i,this.container.dispatchEvent(new CustomEvent("load")),this.container.dispatchEvent(new CustomEvent("loadend"))}).catch(()=>{this.container.dispatchEvent(new CustomEvent("error")),this.container.dispatchEvent(new CustomEvent("loadend"))})}open(){let t=this.results.popover?!this.results.matches(":popover-open"):this.results.hidden;t&&(this.combobox.start(),this.results.popover?this.results.showPopover():this.results.hidden=!1)}close(){let t=this.results.popover?this.results.matches(":popover-open"):!this.results.hidden;t&&(this.combobox.stop(),this.results.popover?this.results.hidePopover():this.results.hidden=!0)}};var h=function(t,e,i,n){if("a"===i&&!n)throw TypeError("Private accessor was defined without a getter");if("function"==typeof e?t!==e||!n:!e.has(t))throw TypeError("Cannot read private member from an object whose class did not declare it");return"m"===i?n:"a"===i?n.call(t):n?n.value:e.get(t)},c=function(t,e,i,n,s){if("m"===n)throw TypeError("Private method is not writable");if("a"===n&&!s)throw TypeError("Private accessor was defined without a setter");if("function"==typeof e?t!==e||!s:!e.has(t))throw TypeError("Cannot write private member to an object whose class did not declare it");return"a"===n?s.call(t,i):s?s.value=i:e.set(t,i),i},d=function(t,e){var i={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&0>e.indexOf(n)&&(i[n]=t[n]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols)for(var s=0,n=Object.getOwnPropertySymbols(t);se.indexOf(n[s])&&Object.prototype.propertyIsEnumerable.call(t,n[s])&&(i[n[s]]=t[n[s]]);return i};let p=globalThis.HTMLElement||null;let AutoCompleteEvent=class AutoCompleteEvent extends Event{constructor(t,e){var{relatedTarget:i}=e;super(t,d(e,["relatedTarget"])),this.relatedTarget=i}};let b=new WeakMap,m=null;let auto_complete_element_AutoCompleteElement=class auto_complete_element_AutoCompleteElement extends p{constructor(){super(...arguments),n.add(this),s.set(this,null),o.set(this,null),a.set(this,void 0)}static define(t="auto-complete",e=customElements){return e.define(t,this),this}static setCSPTrustedTypesPolicy(t){m=null===t?t:Promise.resolve(t)}get forElement(){var t;if(null===(t=h(this,s,"f"))||void 0===t?void 0:t.isConnected)return h(this,s,"f");let e=this.getAttribute("for"),i=this.getRootNode();return e&&(i instanceof Document||i instanceof ShadowRoot)?i.getElementById(e):null}set forElement(t){c(this,s,t,"f"),this.setAttribute("for","")}get inputElement(){var t;return(null===(t=h(this,o,"f"))||void 0===t?void 0:t.isConnected)?h(this,o,"f"):this.querySelector("input")}set inputElement(t){c(this,o,t,"f"),h(this,n,"m",r).call(this)}connectedCallback(){this.isConnected&&h(this,n,"m",r).call(this)}disconnectedCallback(){let t=b.get(this);t&&(t.destroy(),b.delete(this))}get src(){return this.getAttribute("src")||""}set src(t){this.setAttribute("src",t)}get value(){return this.getAttribute("value")||""}set value(t){this.setAttribute("value",t)}get open(){return this.hasAttribute("open")}set open(t){t?this.setAttribute("open",""):this.removeAttribute("open")}get fetchOnEmpty(){return this.hasAttribute("fetch-on-empty")}set fetchOnEmpty(t){this.toggleAttribute("fetch-on-empty",t)}async fetchResult(t){var e;null===(e=h(this,a,"f"))||void 0===e||e.abort();let{signal:i}=c(this,a,new AbortController,"f"),n=await fetch(t.toString(),{signal:i,headers:{Accept:"text/fragment+html"}});if(!n.ok)throw Error(await n.text());if(m){let t=await m;return t.createHTML(await n.text(),n)}return await n.text()}static get observedAttributes(){return["open","value","for"]}attributeChangedCallback(t,e,i){var s,o;if(e===i)return;let a=b.get(this);if(a)switch((this.forElement!==(null===(s=b.get(this))||void 0===s?void 0:s.results)||this.inputElement!==(null===(o=b.get(this))||void 0===o?void 0:o.input))&&h(this,n,"m",r).call(this),t){case"open":null===i?a.close():a.open();break;case"value":null!==i&&(a.input.value=i),this.dispatchEvent(new AutoCompleteEvent("auto-complete-change",{bubbles:!0,relatedTarget:a.input}))}}};s=new WeakMap,o=new WeakMap,a=new WeakMap,n=new WeakSet,r=function(){var t;null===(t=b.get(this))||void 0===t||t.destroy();let{forElement:e,inputElement:i}=this;if(!e||!i)return;let n="true"===this.getAttribute("data-autoselect");b.set(this,new Autocomplete(this,i,e,n)),e.setAttribute("role","listbox")};let f="undefined"!=typeof globalThis?globalThis:window;try{f.AutocompleteElement=f.AutoCompleteElement=auto_complete_element_AutoCompleteElement.define()}catch(t){if(!(f.DOMException&&t instanceof DOMException&&"NotSupportedError"===t.name)&&!(t instanceof ReferenceError))throw t}let v=auto_complete_element_AutoCompleteElement},10160:(t,e,i)=>{i.d(e,{Z:()=>Combobox});let Combobox=class Combobox{constructor(t,e,{tabInsertsSuggestions:i,defaultFirstOption:n}={}){this.input=t,this.list=e,this.tabInsertsSuggestions=null==i||i,this.defaultFirstOption=null!=n&&n,this.isComposing=!1,e.id||(e.id=`combobox-${Math.random().toString().slice(2,6)}`),this.ctrlBindings=!!navigator.userAgent.match(/Macintosh/),this.keyboardEventHandler=t=>(function(t,e){if(!t.shiftKey&&!t.metaKey&&!t.altKey&&(e.ctrlBindings||!t.ctrlKey)&&!e.isComposing)switch(t.key){case"Enter":s(e.input,e.list)&&t.preventDefault();break;case"Tab":e.tabInsertsSuggestions&&s(e.input,e.list)&&t.preventDefault();break;case"Escape":e.clearSelection();break;case"ArrowDown":e.navigate(1),t.preventDefault();break;case"ArrowUp":e.navigate(-1),t.preventDefault();break;case"n":e.ctrlBindings&&t.ctrlKey&&(e.navigate(1),t.preventDefault());break;case"p":e.ctrlBindings&&t.ctrlKey&&(e.navigate(-1),t.preventDefault());break;default:if(t.ctrlKey)break;e.clearSelection()}})(t,this),this.compositionEventHandler=t=>(function(t,e){e.isComposing="compositionstart"===t.type;let i=document.getElementById(e.input.getAttribute("aria-controls")||"");i&&e.clearSelection()})(t,this),this.inputHandler=this.clearSelection.bind(this),t.setAttribute("role","combobox"),t.setAttribute("aria-controls",e.id),t.setAttribute("aria-expanded","false"),t.setAttribute("aria-autocomplete","list"),t.setAttribute("aria-haspopup","listbox")}destroy(){this.clearSelection(),this.stop(),this.input.removeAttribute("role"),this.input.removeAttribute("aria-controls"),this.input.removeAttribute("aria-expanded"),this.input.removeAttribute("aria-autocomplete"),this.input.removeAttribute("aria-haspopup")}start(){this.input.setAttribute("aria-expanded","true"),this.input.addEventListener("compositionstart",this.compositionEventHandler),this.input.addEventListener("compositionend",this.compositionEventHandler),this.input.addEventListener("input",this.inputHandler),this.input.addEventListener("keydown",this.keyboardEventHandler),this.list.addEventListener("click",n),this.indicateDefaultOption()}stop(){this.clearSelection(),this.input.setAttribute("aria-expanded","false"),this.input.removeEventListener("compositionstart",this.compositionEventHandler),this.input.removeEventListener("compositionend",this.compositionEventHandler),this.input.removeEventListener("input",this.inputHandler),this.input.removeEventListener("keydown",this.keyboardEventHandler),this.list.removeEventListener("click",n)}indicateDefaultOption(){var t;this.defaultFirstOption&&(null===(t=Array.from(this.list.querySelectorAll('[role="option"]:not([aria-disabled="true"])')).filter(o)[0])||void 0===t||t.setAttribute("data-combobox-option-default","true"))}navigate(t=1){let e=Array.from(this.list.querySelectorAll('[aria-selected="true"]')).filter(o)[0],i=Array.from(this.list.querySelectorAll('[role="option"]')).filter(o),n=i.indexOf(e);if(n===i.length-1&&1===t||0===n&&-1===t){this.clearSelection(),this.input.focus();return}let s=1===t?0:i.length-1;if(e&&n>=0){let e=n+t;e>=0&&e=i&&o<=n}(a=this.list,r)&&(a.scrollTop=r.offsetTop)):t.removeAttribute("aria-selected")}}clearSelection(){for(let t of(this.input.removeAttribute("aria-activedescendant"),this.list.querySelectorAll('[aria-selected="true"]')))t.removeAttribute("aria-selected");this.indicateDefaultOption()}};function n(t){if(!(t.target instanceof Element))return;let e=t.target.closest('[role="option"]');e&&"true"!==e.getAttribute("aria-disabled")&&function(t,e){t.dispatchEvent(new CustomEvent("combobox-commit",{bubbles:!0,detail:e}))}(e,{event:t})}function s(t,e){let i=e.querySelector('[aria-selected="true"], [data-combobox-option-default="true"]');return!!i&&("true"===i.getAttribute("aria-disabled")||(i.click(),!0))}function o(t){return!t.hidden&&!(t instanceof HTMLInputElement&&"hidden"===t.type)&&(t.offsetWidth>0||t.offsetHeight>0)}}}]); //# sourceMappingURL=vendors-node_modules_github_auto-complete-element_dist_index_js-57587fedd45e.js.map