1import{t as q,p as b}from"./cards-CT4eQxGR.js";const h=document.querySelector('meta[name="csrf-token"]')?.getAttribute("content"),y={"Content-Type":"application/json",Accept:"application/json",...h&&{"X-CSRF-TOKEN":h}},_=window.location.search;(async()=>{if(!_)return;window.Alpine&&await window.Alpine.nextTick();const t=new URLSearchParams(_),e=t.get("country");if(e){const o=document.getElementById(`tours-country-${e}`);o&&(o.checked=!0),await L(e),window.Alpine&&await window.Alpine.nextTick()}const r=t.get("region");if(r){const o=document.getElementById(`tours-region-${r}`);o&&(o.checked=!0)}const i=t.get("resort");if(i){const o=document.getElementById(`tours-resort-${i}`);o&&(o.checked=!0)}const n=t.get("date_from");if(n){const o=document.getElementById("tours-date-from-input");o&&(o.value=n)}const a=t.get("date_to");if(a){const o=document.getElementById("tours-date-to-input");o&&(o.value=a)}const c=t.get("nights_from");if(c){const o=document.getElementById("tours-night-from-input");o&&(o.value=c)}const s=t.get("nights_to");if(s){const o=document.getElementById("tours-night-to-input");o&&(o.value=s)}const l=t.get("price_from");if(l){const o=document.getElementById("tours-price-from-input");o&&(o.value=l)}const u=t.get("price_to");if(u){const o=document.getElementById("tours-price-to-input");o&&(o.value=u)}})();const w=document.getElementById("show-mobile-filter-tours");w&&w.addEventListener("click",()=>{if(window.innerWidth<=768){const t=document.getElementById("filter-tours-panel");t&&t.classList.remove("hidden")}});const I=document.getElementById("close-mobile-filter-tours");I&&I.addEventListener("click",()=>{if(window.innerWidth<=768){const t=document.getElementById("filter-tours-panel");t&&t.classList.add("hidden")}});function A(){const t=document.getElementById("filter-tours-panel");if(!t)return;function e(){const n={};document.querySelectorAll(".filter-input").forEach(p=>{const f=p.querySelector('input[type="radio"]:checked');if(!f||f.value=="all")return;const g=f.name,T=f.value;n[g]=T});const c=document.querySelector("#tours-date-from-input");c.value&&(n.date_from=c.value);const s=document.querySelector("#tours-date-to-input");s.value&&(n.date_to=s.value);const l=document.querySelector("#tours-night-from-input");l.value&&(n.nights_from=l.value);const u=document.querySelector("#tours-night-to-input");u.value&&(n.nights_to=u.value);const o=document.querySelector("#tours-price-from-input");o.value&&(n.price_from=o.value);const d=document.querySelector("#tours-price-to-input");d.value&&(n.price_to=d.value);const m=t.dataset.categoryId;return m&&(n.category_id=m),n}const r=document.getElementById("filter-show-tours-btn"),i=document.getElementById("filter-reset-tours-btn");r&&r.addEventListener("click",()=>{const n=e();v(n)}),i&&i.addEventListener("click",()=>{const n=document.getElementById("tours-country-all");n&&(n.checked=!0);const a=document.getElementById("tours-region-all");a&&(a.checked=!0);const c=document.getElementById("tours-resort-all");c&&(c.checked=!0),t.querySelectorAll('input[type="radio"].filter-input:checked').forEach(g=>{g.value!=="all"&&setTimeout(()=>{g.checked=!1},0)});const s=document.getElementById("tours-date-from-input");s&&(s.value="");const l=document.getElementById("tours-date-to-input");l&&(l.value="");const u=document.getElementById("tours-night-from-input");u&&(u.value="");const o=document.getElementById("tours-night-to-input");o&&(o.value="");const d=document.getElementById("tours-price-from-input");d&&(d.value="");const m=document.getElementById("tours-price-to-input");m&&(m.value="");const p={},f=t.dataset.categoryId;f&&(p.category_id=f),v(p)})}async function v(t){let e,r;window.innerWidth<=768?(document.getElementById("close-mobile-filter-tours")?.click(),e=document.querySelector("#tours-by-category-page"),r="start"):(e=document.querySelector("#result-count"),r="center"),e&&setTimeout(()=>{e.scrollIntoView({behavior:"smooth",block:r})},100);let i=document.querySelector(".filtered-content");try{const n=new URLSearchParams(t).toString();let a=!1,c="",s="";n?(a=!0,c=`/tours?${n}`,s=`${window.location.pathname}?${n}`):(a=!1,c="/tours",s=`${window.location.pathname}`),window.history.pushState({filters:t},"",s);const l=await fetch(`/api${c}`,{method:"GET",headers:y}),u=await l.json();if(l.ok){i.innerHTML="",u.total?u.data.forEach(p=>{i.insertAdjacentHTML("beforeEnd",q(p))}):i.innerHTML="РезÑлÑÑаÑÑ Ð½Ðµ найденÑ";const o=document.getElementById("result-count");o&&(o.innerHTML=u.total);const d=document.getElementById("count-text");switch(u.total){case 1:d.innerHTML="пÑедложение";break;case 2:case 3:case 4:d.innerHTML="пÑедложениÑ";break;default:d.innerHTML="пÑедложений";break}
1const m=document.getElementById("pagination");m&&(m.innerHTML="",m.innerHTML=b(1,u.total,u.per_page,s,a))}else console.error("ÐÑибка ÑеÑвеÑа:",u)}catch(n){console.error("ÐÑибка:",n)}}A();const E=document.getElementById("filter-tours-panel");E&&E.addEventListener("change",t=>{const e=t.target;if(e.type==="radio"){if(e.value==="all"){(e.name==="country"||e.name==="region"||e.name==="resort")&&(window.Alpine.store("common").countries=null,window.Alpine.store("common").regions=null,window.Alpine.store("common").resorts=null);return}e.name==="country"?L(e.value):e.name==="region"?B(e.value,"regions"):e.name==="resort"&&B(e.value,"resorts")}});async function L(t){const e=`/api/tours/filters/by-country/${t}`;try{const r=await fetch(e,{method:"GET",headers:y}),i=await r.json();r.ok?(window.Alpine.store("common").regions=i.regions,window.Alpine.store("common").resorts=i.resorts):console.error("ÐÑибка ÑеÑвеÑа:",i)}catch(r){console.error("ÐÑибка:",r)}}async function B(t,e){const r=`/api/${e}/${t}/destination`;try{const i=await fetch(r,{method:"GET",headers:y}),n=await i.json();i.ok?$(n.id):console.error("ÐÑибка ÑеÑвеÑа:",n)}catch(i){console.error("ÐÑибка:",i)}}function $(t){const e=document.querySelector("#countries-list").dataset.countries,r=JSON.parse(e),i=[];r.forEach(n=>{n.id==t&&i.push(n)}),window.Alpine.store("common").countries=i}const S=document.querySelector("#tours-search-input");S&&(S.addEventListener("input",async t=>{const e=t.target.value;if(!e)return;const r=document.getElementById("filter-tours-panel").dataset.categoryId;try{const i=`/api/tours/search?q=${e}&category_id=${r}`,n=await fetch(i,{method:"GET",headers:y}),a=await n.json();if(n.ok){const c=document.querySelector("#tours-search-result");c.classList.remove("hidden"),c.innerHTML="",a.data.length?a.data.forEach(s=>{const l=M(s.title,e);c.insertAdjacentHTML("beforeEnd",`<a href="${s.url}" class="block cursor-pointer text-vertical-overflow text-vertical-overflow-1">${l}</a>`)}):c.innerHTML="РезÑлÑÑаÑÑ Ð½Ðµ найденÑ"}else console.error("ÐÑибка ÑеÑвеÑа:",a)}catch(i){console.error("ÐÑибка:",i)}}),document.addEventListener("click",t=>{const e=document.querySelector("#tours-search-input"),r=document.querySelector("#tours-search-result");!e.contains(t.target)&&!r.contains(t.target)&&r.classList.add("hidden")}));function M(t,e){if(!e)return t;const r=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),i=new RegExp(`(${r})`,"gi");return t.replace(i,'<span class="color-secondary">$1</span>')}const k=document.querySelector("#tours-price-range-input");k&&k.addEventListener("input",t=>{const e=t.target.value,r=document.querySelector("#tours-price-to-input");r&&(r.value=e)});
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.