1import{c as C,u as S,a as I,r as i,a1 as z,bp as R,j as e,T as l,L as p,P as b,bq as u,a5 as r,br as B,t as A,a0 as F,S as E,aj as L,Y as g}from"./index-Dkwi1Om3.js";import{i as h,B as P,a as T,b as U}from"./bookmark-photo-placeholder--KZboutH.js";import{S as M}from"./search-CvqiXADv.js";import{C as $}from"./chef-hat-DcCNW6kv.js";import{B as q}from"./bookmark-DrwAujxi.js";import{U as H}from"./users-BHbtIv9s.js";const O=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]],Q=C("circle-alert",O);function Y(){const{t:a}=S("recipes"),{user:n}=I(),[t,N]=i.useState(null),[d,k]=i.useState(null),[m,_]=i.useState(""),[o,x]=i.useState([]);i.useEffect(()=>{z().then(N).catch(s=>k(s.message??a("all.loadFailed"))),R().then(x).catch(()=>x([]))},[a]);const f=(t??[]).filter(s=>s.title.toLowerCase().includes(m.toLowerCase())),y=t?.length??0,w=y>=u;return e.jsxs("div",{className:"space-y-6 max-w-md md:max-w-5xl mx-auto",children:[e.jsxs("header",{className:"flex items-end justify-between gap-4",children:[e.jsx("h1",{className:"text-3xl font-bold tracking-tight",style:{color:l.ink},children:a("all.title")}),e.jsxs(p,{to:"/recipes/add",search:{addToAlbum:void 0},className:"inline-flex items-center gap-2 px-4 py-2.5 rounded-full text-sm font-semibold active:scale-95 transition-transform",style:{background:l.ink,color:"white",boxShadow:l.shadowSm},"aria-label":a("all.newAria"),children:[e.jsx(b,{className:"size-4"}),e.jsx("span",{className:"hidden sm:inline",children:a("all.new")})]})]}),t&&t.length>0&&e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsxs("div",{className:"rounded-full flex items-center gap-2 px-5 py-3 flex-1",style:{background:l.surface,boxShadow:l.shadowMd},children:[e.jsx(M,{className:"size-4",style:{color:l.subInk}}),e.jsx("input",{value:m,onChange:s=>_(s.target.value),placeholder:a("all.searchPlaceholder"),className:"bg-transparent outline-none flex-1 text-sm",style:{color:l.ink}})]}),e.jsxs("div",{className:"text-xs tabular-nums shrink-0",style:{color:l.subInk},children:[y,"/",u]})]}),w&&e.jsx(r,{children:e.jsx("p",{className:"text-sm",style:{color:l.ink},children:a("all.limitReached",{count:u})})}),d&&e.jsx(r,{children:e.jsx("p",{className:"text-sm",style:{color:l.destructive},children:d})}),o.length>0&&e.jsx(r,{children:e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-2 font-semibold",style:{color:l.ink},children:[e.jsx(Q,{className:"size-4",style:{color:l.destructive}}),o.length===1?a("all.unavailableOne",{count:1}):a("all.unavailableMany",{count:o.length})]}),e.jsx("p",{className:"text-xs",style:{color:l.subInk},children:a("all.unavailableBody")}),e.jsx("button",{onClick:async()=>{for(const s of o)try{await B({data:{recipeId:s.recipe_id}})}catch(c){console.error(c)}x([]),A.success(a("all.cleanedUp"))},className:"text-xs px-4 py-1.5 rounded-full font-semibold",style:{background:`${l.destructive}22`,color:l.destructive},children:a("all.cleanAll")})]})}),t===null&&!d&&e.jsx("ul",{className:"space-y-3",children:Array.from({length:4}).map((s,c)=>e.jsx("li",{className:"h-24 rounded-3xl animate-pulse",style:{background:l.chip}},c))}),t&&t.length===0&&e.jsxs(r,{className:"text-center py-16",children:[e.jsx("div",{className:"size-14 rounded-2xl grid place-items-center mx-auto mb-4",style:{background:l.accentSoft,color:l.ink},children:e.jsx($,{className:"size-6"})}),e.jsx("h2",{className:"text-lg font-semibold mb-1",style:{color:l.ink},children:a("all.emptyTitle")}),e.jsx("p",{className:"text-sm max-w-sm mx-auto mb-6",style:{color:l.subInk},children:a("all.emptyBody")}),e.jsxs(p,{to:"/recipes/add",search:{addToAlbum:void 0},className:"inline-flex items-center gap-2 px-5 py-2.5 rounded-full text-sm font-semibold",style:{background:l.ink,color:"white"},children:[e.jsx(b,{className:"size-4"}),a("all.firstRecipe")]})]}),t&&t.length>0&&e.jsxs("ul",{className:"space-y-3",children:[f.map(s=>{const c=!!n&&s.owner_id!==n.id&&!s.copied_from_recipe_id,v=!!s.copied_from_recipe_id;return e.jsx("li",{children:e.jsxs(p,{to:"/recipes/$recipeId",params:{recipeId:s.id},className:"flex items-center gap-4 p-3 rounded-3xl",style:{background:l.surface,boxShadow:l.shadowMd},children:[e.jsx("div",{className:"size-20 rounded-2xl shrink-0 overflow-hidden",style:{background:l.chip},children:h(s)&&!s.photo_url?e.jsx(P,{}):e.jsx(F,{path:s.photo_url,alt:s.title,className:"w-full h-full",width:400})}),e.jsxs("div",{className:"flex-1 min-w-0 space-y-1",children:[e.jsx("p",{className:"text-base font-bold leading-snug truncate",style:{color:l.ink},children:s.title}),e.jsxs("div",{className:"flex flex-wrap gap-1",children:[s.is_ai_generated&&e.jsx(j,{icon:e.jsx(E,{className:"size-2.5"}),label:a("all.badgeAi"),color:"#8B5CF6"}),c&&e.jsx(j,{icon:e.jsx(q,{className:"size-2.5"}),label:a("all.badgeFollowed"),color:"#3B82F6"}),v&&e.jsx(j,{icon:e.jsx(L,{className:"size-2.5"}),label:s.copied_from_owner_name?a("all.badgeCopyFrom",{name:s.copied_from_owner_name}):a("all.badgeCopy"),color:l.orange})]}),e.jsx("div",{className:"flex items-center gap-2 text-xs",style:{color:l.subInk},children:h(s)&&T(s.source_url)?e.jsx(U,{url:s.source_url,grey:!0,asLink:!1}):h(s)?e.jsxs(e.Fragment,{children:[e.jsxs("span",{className:"inline-flex items-center gap-1",children:[e.jsx(g,{className:"size-3"}),"â"]}),e.jsxs("span",{className:"inline-flex items-center gap-1",children:[e.jsx(H,{className:"size-3"}),"â"]})]}):e.jsxs(e.Fragment,{children:[(s.prep_time_minutes||s.cook_time_minutes)&&e.jsxs("span",{className:"inline-flex items-center gap-1",children:[e.jsx(g,{className:"size-3"}),a("all.minutes",{count:(s.prep_time_minutes??0)+(s.cook_time_minutes??0)})]}),e.jsxs("span",{children:["· ",a("all.persons",{count:s.base_servings})]})]})})]})]})},s.id)}),f.length===0&&e.jsx("li",{className:"text-center text-sm py-8",style:{color:l.subInk}
1,children:a("all.noResults",{query:m})})]})]})}function j({icon:a,label:n,color:t}){return e.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 rounded-full text-[10px] font-semibold uppercase tracking-wide border",style:{background:`${t}1A`,color:t,borderColor:`${t}55`},children:[a,n]})}const X=()=>e.jsx("div",{className:"pt-20",children:e.jsx("div",{className:"max-w-5xl lg:max-w-6xl mx-auto px-4 md:px-8 pb-8",children:e.jsx(Y,{})})});export{X as component};
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.