"use strict";(globalThis.webpackChunk=globalThis.webpackChunk||[]).push([["vendors-node_modules_github_auto-complete-element_dist_index_js"],{23261:(t,e,i)=>{i.d(e,{ZP:()=>E});let Combobox=class Combobox{constructor(t,e,{tabInsertsSuggestions:i,defaultFirstOption:s,scrollIntoViewOptions:o}={}){this.input=t,this.list=e,this.tabInsertsSuggestions=null==i||i,this.defaultFirstOption=null!=s&&s,this.scrollIntoViewOptions=null!=o?o:{block:"nearest",inline:"nearest"},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":n(e.input,e.list)&&t.preventDefault();break;case"Tab":e.tabInsertsSuggestions&&n(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",s),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",s)}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),s=i.indexOf(e);if(s===i.length-1&&1===t||0===s&&-1===t){this.clearSelection(),this.input.focus();return}let n=1===t?0:i.length-1;if(e&&s>=0){let e=s+t;e>=0&&e0||t.offsetHeight>0)}let r=window.testScreenReaderDelay||100;let Autocomplete=class Autocomplete{constructor(t,e,i,s=!1){var n;if(this.container=t,this.input=e,this.results=i,this.combobox=new Combobox(e,i,{defaultFirstOption:s}),this.feedback=t.getRootNode().getElementById(`${this.results.id}-feedback`),this.autoselectEnabled=s,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(...s){clearTimeout(i),i=window.setTimeout(()=>{clearTimeout(i),t(...s)},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===(n=this.clearButton)||void 0===n||n.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.close()}onKeydown(t){if("Escape"===t.key&&this.container.open)this.close(),t.stopPropagation(),t.preventDefault();else if(t.altKey&&"ArrowUp"===t.key&&this.container.open)this.close(),t.stopPropagation(),t.preventDefault();else if(t.altKey&&"ArrowDown"===t.key&&!this.container.open){if(!this.input.value.trim())return;this.open(),t.stopPropagation(),t.preventDefault()}}onInputFocus(){this.interactingWithList||this.fetchResults()}onInputBlur(){this.interactingWithList||this.close()}onCommit({target:t}){if(!(t instanceof HTMLElement)||(this.close(),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)},r)}fetchResults(){let t=this.input.value.trim();if(!t&&!this.container.fetchOnEmpty){this.close();return}let e=this.container.src;if(!e)return;let i=new URL(e,window.location.href),s=new URLSearchParams(i.search.slice(1));s.append("q",t),i.search=s.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,s=e.length,[n]=e,o=null==n?void 0:n.textContent;this.autoselectEnabled&&o?this.updateFeedbackForScreenReaders(`${s} results. ${o} is the top result: Press Enter to activate.`):this.updateFeedbackForScreenReaders(`${s||"No"} results.`),i?this.open():this.close(),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),this.container.open=!0,this.interactingWithList=!0}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),this.container.open=!1,this.interactingWithList=!1}};var a,l,u,h,c,d=function(t,e,i,s){if("a"===i&&!s)throw TypeError("Private accessor was defined without a getter");if("function"==typeof e?t!==e||!s:!e.has(t))throw TypeError("Cannot read private member from an object whose class did not declare it");return"m"===i?s:"a"===i?s.call(t):s?s.value:e.get(t)},p=function(t,e,i,s,n){if("m"===s)throw TypeError("Private method is not writable");if("a"===s&&!n)throw TypeError("Private accessor was defined without a setter");if("function"==typeof e?t!==e||!n:!e.has(t))throw TypeError("Cannot write private member to an object whose class did not declare it");return"a"===s?n.call(t,i):n?n.value=i:e.set(t,i),i},b=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&0>e.indexOf(s)&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols)for(var n=0,s=Object.getOwnPropertySymbols(t);ne.indexOf(s[n])&&Object.prototype.propertyIsEnumerable.call(t,s[n])&&(i[s[n]]=t[s[n]]);return i};let m=globalThis.HTMLElement||null;let AutoCompleteEvent=class AutoCompleteEvent extends Event{constructor(t,e){var{relatedTarget:i}=e;super(t,b(e,["relatedTarget"])),this.relatedTarget=i}};let f=new WeakMap,v=null;let auto_complete_element_AutoCompleteElement=class auto_complete_element_AutoCompleteElement extends m{constructor(){super(...arguments),a.add(this),l.set(this,null),u.set(this,null),c.set(this,void 0)}static define(t="auto-complete",e=customElements){return e.define(t,this),this}static setCSPTrustedTypesPolicy(t){v=null===t?t:Promise.resolve(t)}get forElement(){var t;if(null===(t=d(this,l,"f"))||void 0===t?void 0:t.isConnected)return d(this,l,"f");let e=this.getAttribute("for"),i=this.getRootNode();return e&&(i instanceof Document||i instanceof ShadowRoot)?i.getElementById(e):null}set forElement(t){p(this,l,t,"f"),this.setAttribute("for","")}get inputElement(){var t;return(null===(t=d(this,u,"f"))||void 0===t?void 0:t.isConnected)?d(this,u,"f"):this.querySelector("input")}set inputElement(t){p(this,u,t,"f"),d(this,a,"m",h).call(this)}connectedCallback(){this.isConnected&&(d(this,a,"m",h).call(this),new MutationObserver(()=>{f.get(this)||d(this,a,"m",h).call(this)}).observe(this,{subtree:!0,childList:!0}))}disconnectedCallback(){let t=f.get(this);t&&(t.destroy(),f.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=d(this,c,"f"))||void 0===e||e.abort();let{signal:i}=p(this,c,new AbortController,"f"),s=await fetch(t.toString(),{signal:i,headers:{Accept:"text/fragment+html"}});if(!s.ok)throw Error(await s.text());if(v){let t=await v;return t.createHTML(await s.text(),s)}return await s.text()}static get observedAttributes(){return["open","value","for"]}attributeChangedCallback(t,e,i){var s,n;if(e===i)return;let o=f.get(this);if(o)switch((this.forElement!==(null===(s=f.get(this))||void 0===s?void 0:s.results)||this.inputElement!==(null===(n=f.get(this))||void 0===n?void 0:n.input))&&d(this,a,"m",h).call(this),t){case"open":null===i?o.close():o.open();break;case"value":null!==i&&(o.input.value=i),this.dispatchEvent(new AutoCompleteEvent("auto-complete-change",{bubbles:!0,relatedTarget:o.input}))}}};l=new WeakMap,u=new WeakMap,c=new WeakMap,a=new WeakSet,h=function(){var t;null===(t=f.get(this))||void 0===t||t.destroy();let{forElement:e,inputElement:i}=this;if(!e||!i)return;let s="true"===this.getAttribute("data-autoselect");f.set(this,new Autocomplete(this,i,e,s)),e.setAttribute("role","listbox")};let g="undefined"!=typeof globalThis?globalThis:window;try{g.AutocompleteElement=g.AutoCompleteElement=auto_complete_element_AutoCompleteElement.define()}catch(t){if(!(g.DOMException&&t instanceof DOMException&&"NotSupportedError"===t.name)&&!(t instanceof ReferenceError))throw t}let E=auto_complete_element_AutoCompleteElement}}]); //# sourceMappingURL=vendors-node_modules_github_auto-complete-element_dist_index_js-b5fa64f31d61.js.map