1import{r,i as q,j as a,aq as H,E as m,B as I,F as K,aZ as O,bw as P}from"./app-CQDOLSaW.js";import{DatePicker as C}from"./DatePicker-D86lFb3r.js";import{FilterDropdown as F}from"./FilterDropdown-pMGzJRFD.js";import{u as R,K as N}from"./KeywordInput-XwmefKqE.js";import"./index-Be86urCc.js";const S=(o,l)=>o?String(o).split(",").filter(c=>c!=="").map(l):[];function Z({searchParams:o,groupedTags:l,popularTags:c,prefectures:w,favoriteTags:v,favoriteAreas:A,auth:h}){const[i,f]=r.useState(null),[D,M]=r.useState(!1),{addHistory:E}=R();r.useEffect(()=>{M(!0)},[]);const[e,p]=r.useState({keyword:o.keyword||"",tagIds:S(o.tag_id,Number),areaIds:S(o.pref,String),date:o.date||"",online:o.online==="1",favorite:o.favorite==="1"}),d=(t,n)=>{p(s=>({...s,[t]:n}))},B=t=>{p(n=>({...n,keyword:n.keyword?`${n.keyword} ${t}`:t}))},Y=()=>{p(t=>({...t,tagIds:[],areaIds:[],online:!1,favorite:!1}))},u=()=>{e.keyword&&E(e.keyword);const n=new URLSearchParams(Object.entries({keyword:e.keyword,tag_id:e.tagIds.join(","),pref:e.areaIds.join(","),date:e.date,online:e.online?"1":"",favorite:e.favorite?"1":""}).filter(([,s])=>s)).toString();P.Inertia.visit(`/event${n?`?${n}`:""}`)},y=r.useMemo(()=>{const t=[...c,...l.flatMap(s=>s.tags)],n=new Map(t.map(s=>[s.id,s.name]));return e.tagIds.map(s=>n.get(s)).filter(Boolean)},[e.tagIds,l,c]),g=r.useMemo(()=>w.filter(t=>e.areaIds.includes(t.id)).map(t=>t.name),[e.areaIds,w]),$=r.useMemo(()=>[y.join(", "),g.join(", "),e.online&&"ãªã³ã©ã¤ã³",e.favorite&&"ãæ°ã«å
¥ã"].filter(Boolean).join(", ")||"ã¿ã°ã»ãã ããæ¡ä»¶",[y,g,e.online,e.favorite]),z=e.tagIds.length>0||e.areaIds.length>0||e.online||e.favorite,x=()=>f(null),j={value:e.keyword,onChange:t=>d("keyword",t),onTagSelect:B,onClear:()=>d("keyword",""),onFocus:()=>f("keyword"),onClose:x,isActive:i==="keyword",popularTags:c,groupedTags:l,favoriteTags:v,auth:h},k={value:e.date,onChange:t=>d("date",t),onClear:()=>d("date",""),onFocus:()=>f("date"),onClose:x,isActive:i==="date",displayText:e.date?q(e.date).format("YYYY/MM/DD"):"é嬿¥",hasValue:!!e.date},b={selectedTagIds:e.tagIds,selectedAreaIds:e.areaIds,online:e.online,favorite:e.favorite,onTagIdsChange:t=>d("tagIds",t),onAreaIdsChange:t=>d("areaIds",t),onOnlineChange:t=>d("online",t),onFavoriteChange:t=>d("favorite",t),onClear:Y,onFocus:()=>f("filter"),onClose:x,isActive:i==="filter",groupedTags:l,popularTags:c,prefectures:w,favoriteTags:v,favoriteAreas:A,auth:h,displayText:$,hasValue:z};return a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"hidden md:block",children:D&&H.createPortal(a.jsx("div",{className:m("fixed inset-0 bg-black/50 z-50 transition-opacity duration-200",i?"opacity-100":"opacity-0 pointer-events-none"),onClick:x}),document.body)}),a.jsx("div",{className:m("sticky md:top-[60px] bg-brand-primary py-3 md:py-4 px-2 md:px-6 z-[30]",i&&"md:z-[70]"),children:a.jsxs("div",{className:"max-w-[1200px] mx-auto",children:[a.jsxs("div",{className:"flex gap-1 items-center md:hidden",children:[a.jsx("div",{className:"flex-1 min-w-0 bg-white rounded",children:a.jsx(N,{...j})}),a.jsx("div",{className:"flex-1 min-w-0 bg-white rounded",children:a.jsx(C,{...k})}),a.jsx("div",{className:"flex-1 min-w-0 bg-white rounded",children:a.jsx(F,{...b})}),a.jsx(I,{variant:"secondary",className:"h-10 w-10 p-0 rounded shrink-0",onClick:u,children:a.jsx(K,{icon:O})})]}),a.jsxs("div",{className:"hidden md:flex gap-3 items-stretch",children:[a.jsx("div",{className:m("flex-1 min-w-0 overflow-visible bg-white rounded",i==="keyword"&&"bg-[#dbf0ff]"),children:a.jsx(N,{...j})}),a.jsx("div",{className:m("flex-none w-52 min-w-0 overflow-visible bg-white rounded",i==="date"&&"bg-[#dbf0ff]"),children:a.jsx(C,{...k})}),a.jsx("div",{className:m("flex-1 min-w-0 overflow-visible bg-white rounded",i==="filter"&&"bg-[#dbf0ff]"),children:a.jsx(F,{...b})}),a.jsx(I,{variant:"secondary",className:"py-0 px-6 rounded shrink-0",onClick:u,children:"çµãè¾¼ã"})]})]})})]})}export{Z as EventSearchForm};
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.