PageSourceSearch

https://www.montpellier-tourisme.fr/app/dist/montpelliertourisme/a…ody-django-prompt-controller.b60a51693d.mjs

js montpellier-tourisme.fr collected 2026-10-02 07:05:47 UTC 3,351 bytes, 1 lines download raw bytes

1import o from"woody_library_woody_controller";import{initSuggestionsSwiper as c}from"woody_addon_django_suggestions_swiper";class a extends o{#t;#l;#e=null;#a=[];#i=!1;#s=null;#n=null;constructor(e){super(e)}async init(e){super.init(e),this.#t=this.el.querySelector('input[type="text"]'),this.#l=this.el.querySelector("select"),this.el.addEventListener("submit",t=>{t.preventDefault();let s="";return this.#t?s=this.#t.value:this.#l&&(s=this.#l.value),this.launch_ai(s),!1}),this.el.addEventListener("click",t=>{const s=t.target.closest(".prompt-suggestion-btn");if(!s)return;t.preventDefault();const n=s.getAttribute("data-value")||s.textContent?.trim()||"";n&&this.launch_ai(n)});const i=this.el.getAttribute("data-prompt-placeholder-animation");this.#t&&i==="true"&&this.#g(),c(this.el)}static#u=60;static#d=30;static#p=2e3;static#m=400;#f(){if(this.#s)return;const e=this.#t?.parentElement;if(!e)return;const i=document.createElement("span");i.className="prompt-tpl-02-animated-placeholder",i.setAttribute("aria-hidden","true");const t=document.createElement("span");t.className="prompt-tpl-02-animated-placeholder-text",i.appendChild(t),e.appendChild(i),e.classList.add("has-animated-placeholder"),this.#s=i,this.#n=t}#g(){if(window.matchMedia("(prefers-reduced-motion: reduce)").matches)return;const e=this.el.querySelectorAll(".prompt-suggestion-btn"),i=Array.from(e).map(n=>n.getAttribute("data-value")||n.textContent?.trim()||"");if(this.#a=i.filter(Boolean),this.#a.length===0)return;this.#f(),this.#i=!1;let t=0;const s=()=>
1{if(this.#i||this.#t.value!=="")return;const n=this.#a[t];if(!n){t=0;const r=this.#a[0];r&&this.#r(r,"",0,"typing",0);return}this.#r(n,"",0,"typing",t)};this.#t.addEventListener("focus",()=>{this.#i=!0,this.#c(),this.#o()}),this.#t.addEventListener("blur",()=>{this.#t.value===""&&(this.#i=!1,this.#E(),s())}),this.#t.addEventListener("input",()=>{this.#t.value!==""&&(this.#i=!0,this.#c(),this.#o())}),s()}#r(e,i,t,s,n){if(!(this.#i||this.#t.value!=="")){if(s==="typing"&&t<=e.length){this.#h(i),t<e.length?this.#e=setTimeout(()=>{this.#r(e,e.slice(0,t+1),t+1,"typing",n)},a.#u):this.#e=setTimeout(()=>{this.#r(e,i,e.length,"erasing",n)},a.#p);return}if(s==="erasing"&&t>=0){const r=e.slice(0,t);if(this.#h(r),t>0)this.#e=setTimeout(()=>{this.#r(e,r,t-1,"erasing",n)},a.#d);else{const l=(n+1)%this.#a.length;this.#e=setTimeout(()=>{if(this.#i||this.#t.value!=="")return;const h=this.#a[l];h&&this.#r(h,"",0,"typing",l)},a.#m)}}}}#h(e){this.#n&&(this.#n.textContent=e,this.#y())}#y(){const e=this.#s,i=this.#n;!e||!i||requestAnimationFrame(()=>{const t=i.offsetWidth-e.clientWidth;i.style.transform=t>0?`translateX(-${t}px)`:""})}#E(){this.#s&&(this.#s.style.display="",this.#t?.parentElement?.classList.add("has-animated-placeholder"))}#o(){this.#s&&(this.#s.style.display="none",this.#n&&(this.#n.textContent="",this.#n.style.transform=""),this.#t?.parentElement?.classList.remove("has-animated-placeholder"))}#c(){this.#e&&(clearTimeout(this.#e),this.#e=null)}launch_ai(e){if(!window.globals.django?.app_url){console.warn("DjangoPromptController - launch_ai - window.globals.django.app_url is missed");return}let[i,t=""]=window.globals.django.app_url.split("?");const s=new URLSearchParams(t);s.set("question",e);const n=`${i}?${s.toString()}`;window.open(n,"_blank","noopener,noreferrer")}}export{a as default};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.