1import{r as x,j as s,L as t,J as i,o as l,B as f}from"./index-DESPVSwC.js";import{u as j,M as c}from"./resource-schema-Cumv1u_G.js";import{I as y}from"./IconX-v_fz5M5l.js";const T={search:"",resourceType:[],topic:[],audience:[],language:[],from:"",to:""};function R(e){return{resourceType:e.resourceType,topic:e.topic,audience:e.audience,language:e.language,search:e.search,from:e.from?new Date(`${e.from}T00:00:00.000`).toISOString():void 0,to:e.to?new Date(`${e.to}T23:59:59.999`).toISOString():void 0}}function N(e){return e.search.trim()!==""||e.resourceType.length>0||e.topic.length>0||e.audience.length>0||e.language.length>0||e.from!==""||e.to!==""}function S({value:e,onChange:o,stacked:d=!1,className:u}){const n=x.useId(),{types:m,topics:p,audiences:h,languages:g}=j({available:!0}),r=a=>o({...e,...a});return s.jsxs("div",{className:l("space-y-4",u),children:[s.jsxs("div",{className:l("grid gap-3",d?"grid-cols-1":"sm:grid-cols-2 lg:grid-cols-3"),children:[s.jsxs("div",{className:"min-w-0 space-y-1.5",children:[s.jsx(t,{htmlFor:n,children:"Search"}),s.jsx(i,{id:n,value:e.search,onChange:a=>r({search:a.target.value}),placeholder:"Title, author, keywordâ¦","data-testid":"resource-filter-search"})]}),s.jsxs("div",{className:"min-w-0 space-y-1.5",children:[s.jsx(t,{children:"Type"}),s.jsx(c,{options:m,value:e.resourceType,onChange:a=>r({resourceType:a}),placeholder:"Any type",dataTestId:"resource-filter-type"})]}),s.jsxs("div",{className:"min-w-0 space-y-1.5",children:[s.jsx(t,{children:"Topic"}),s.jsx(c,{options:p,value:e.topic,onChange:a=>r({topic:a}),placeholder:"Any topic",dataTestId:"resource-filter-topic"})]}),s.jsxs("div",{className:"min-w-0 space-y-1.5",children:[s.jsx(t,{children:"Audience"}),s.jsx(c,{options:h,value:e.audience,onChange:a=>r({audience:a}),placeholder:"Any audience",dataTestId:"resource-filter-audience"})]}),s.jsxs("div",{className:"min-w-0 space-y-1.5",children:[s.jsx(t,{children:"Language"}),s.jsx(c,{options:g,value:e.language,onChange:a=>r({language:a}),placeholder:"Any language",dataTestId:"resource-filter-language"})]}),s.jsxs("div",{className:"min-w-0 space-y-1.5",children:[s.jsx(t,{children:"Date added"}),s.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[s.jsx(i,{type:"date","aria-label":"From date",value:e.from,max:e.to||void 0,onChange:a=>r({from:a.target.value}),"data-testid":"resource-filter-from",className:"min-w-0 flex-1"}),s.jsx("span",{className:"text-muted-foreground",children:"â"}),s.jsx(i,{type:"date","aria-label":"To date",value:e.to,min:e.from||void 0,onChange:a=>r({to:a.target.value}),"data-testid":"resource-filter-to",className:"min-w-0 flex-1"})]})]})]}),N(e)&&s.jsxs(f,{type:"button",variant:"ghost",size:"sm",onClick:()=>o(T),"data-testid":"resource-filter-clear",children:[s.jsx(y,{className:"mr-1 size-4"}),"Clear filters"]})]})}export{T as E,S as R,R as r};
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.