PageSourceSearch

https://app.ateliereonline.ro/assets/Biblioteca-uiSSNQzO.js

js ateliereonline.ro collected 2026-09-25 03:34:01 UTC 31,028 bytes, 11 lines download raw bytes

1import{j as e,u as Be}from"./vendor-data-BnAsYEPc.js";import{r as l,L as Xe,e as Ye}from"./vendor-react-BNJcskRT.js";import{p as Pe,am as he,H as ge,m as P,as as Ze,f as q,aP as B,at as Ee,au as Ie,B as de,av as _e,c as Re,u as $e,X as et,Y as tt,Z as rt,_ as at,ao as Fe,W as lt,Q as qe,I as re,a1 as nt,aS as Ae,O as it,S as st,aM as ct}from"./index-P4Jm-5kS.js";import{S as ot}from"./Seo-BumBq7P1.js";import{O as dt}from"./OptimizedImage-BNkqfjXI.js";import{u as ut,C as ue}from"./libraryImage-BYkKU5uQ.js";import{S as Le}from"./separator-fdD_JMlQ.js";import{ah as ee,n as F,ai as le,l as mt,k as pt,O as xt,g as ft}from"./vendor-ui-vXhwLHr8.js";import{G as Te}from"./gift-CrkOnNjR.js";import{A as ht}from"./arrow-left-CZOZQRvu.js";import"./vendor-date-BFEA4iDb.js";/**
2 * @license lucide-react v0.462.0 - ISC
3 *
4 * This source code is licensed under the ISC license.
5 * See the LICENSE file in the root directory of this source tree.
6 */const ze=Pe("ChevronsUpDown",[["path",{d:"m7 15 5 5 5-5",key:"1hf1tw"}],["path",{d:"m7 9 5-5 5 5",key:"sgt6xg"}]]);/**
7 * @license lucide-react v0.462.0 - ISC
8 *
9 * This source code is licensed under the ISC license.
10 * See the LICENSE file in the root directory of this source tree.
11 */const gt=Pe("Truck",[["path",{d:"M14 18V6a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v11a1 1 0 0 0 1 1h2",key:"wrbu53"}],["path",{d:"M15 18H9",key:"1lyqi6"}],["path",{d:"M19 18h2a1 1 0 0 0 1-1v-3.65a1 1 0 0 0-.22-.624l-3.48-4.35A1 1 0 0 0 17.52 8H14",key:"lysw3i"}],["circle",{cx:"17",cy:"18",r:"2",key:"332jqn"}],["circle",{cx:"7",cy:"18",r:"2",key:"19iecd"}]]),vt=({book:t,onClick:n})=>{var i;const r=ut((i=t.photos)==null?void 0:i[0]),x=t.age_min&&t.age_max?`${t.age_min}–${t.age_max} ani`:t.age_min||t.age_max?`${t.age_min??t.age_max}+ ani`:null;return e.jsxs("button",{type:"button",onClick:n,className:"group text-left w-full h-full rounded-xl border border-border bg-card shadow-sm hover:shadow-md hover:border-primary/40 transition-all flex flex-col overflow-hidden",children:[e.jsxs("div",{className:"relative aspect-[3/4] bg-white flex items-center justify-center p-3",children:[e.jsx("div",{className:"h-full aspect-[2/3] overflow-hidden rounded-md bg-muted/30 shadow-sm",children:r?e.jsx(dt,{src:r,alt:t.title,preset:"workshopCard",className:"w-full h-full object-cover"}):e.jsx("div",{className:"w-full h-full flex items-center justify-center text-muted-foreground/30",children:e.jsx(he,{className:"w-7 h-7"})})}),t.condition&&ue[t.condition]&&e.jsx(ge,{variant:"secondary",className:"absolute top-1.5 right-1.5 text-[10px] px-1.5 py-0 font-medium",children:ue[t.condition]})]}),e.jsxs("div",{className:"p-2.5 flex-1 flex flex-col gap-0.5",children:[e.jsx("h3",{className:"text-[13px] font-semibold text-foreground line-clamp-2 leading-snug min-h-[2.4em]",children:t.title}),t.author&&e.jsx("p",{className:"text-[11px] text-muted-foreground line-clamp-1",children:t.author}),e.jsxs("div",{className:"mt-1 flex items-center justify-between gap-1",children:[e.jsx("span",{className:"text-[11px] font-semibold text-primary",children:"Gratuit"}),x&&e.jsx("span",{className:"text-[10px] text-muted-foreground",children:x})]})]})]})};var Oe=1,yt=.9,bt=.8,jt=.17,pe=.1,xe=.999,wt=.9999,Nt=.99,Ct=/[\\\/_+.#"@\[\(\{&]/,St=/[\\\/_+.#"@\[\(\{&]/g,kt=/[\s-]/,Ve=/[\s-]/g;function ve(t,n,r,x,i,o,u){if(o===n.length)return i===t.length?Oe:Nt;var f=`${i},${o}`;if(u[f]!==void 0)return u[f];for(var y=x.charAt(o),s=r.indexOf(y,i),h=0,g,d,p,C;s>=0;)g=ve(t,n,r,x,s+1,o+1,u),g>h&&(s===i?g*=Oe:Ct.test(t.charAt(s-1))?(g*=bt,p=t.slice(i,s-1).match(St),p&&i>0&&(g*=Math.pow(xe,p.length))):kt.test(t.charAt(s-1))?(g*=yt,C=t.slice(i,s-1).match(Ve),C&&i>0&&(g*=Math.pow(xe,C.length))):(g*=jt,i>0&&(g*=Math.pow(xe,s-i))),t.charAt(s)!==n.charAt(o)&&(g*=wt)),(g<pe&&r.charAt(s-1)===x.charAt(o+1)||x.charAt(o+1)===x.charAt(o)&&r.charAt(s-1)!==x.charAt(o))&&(d=ve(t,n,r,x,s+1,o+2,u),d*pe>g&&(g=d*pe)),g>h&&(h=g),s=r.indexOf(y,s+1);return u[f]=h,h}function Me(t){return t.toLowerCase().replace(Ve," ")}function Et(t,n,r){return t=r&&r.length>0?`${t+" "+r.join(" ")}`:t,ve(t,n,Me(t),Me(n),0,0,{})}var ae='[cmdk-group=""]',fe='[cmdk-group-items=""]',It='[cmdk-group-heading=""]',Ke='[cmdk-item=""]',De=`${Ke}:not([aria-disabled="true"])`,ye="cmdk-item-select",Y="data-value",_t=(t,n,r)=>Et(t,n,r),Ge=l.createContext(void 0),ne=()=>l.useContext(Ge),He=l.createContext(void 0),ke=()=>
11l.useContext(He),Ue=l.createContext(void 0),We=l.forwardRef((t,n)=>{let r=Z(()=>{var a,m;return{search:"",value:(m=(a=t.value)!=null?a:t.defaultValue)!=null?m:"",selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}}}),x=Z(()=>new Set),i=Z(()=>new Map),o=Z(()=>new Map),u=Z(()=>new Set),f=Je(t),{label:y,children:s,value:h,onValueChange:g,filter:d,shouldFilter:p,loop:C,disablePointerSelection:M=!1,vimBindings:I=!0,...A}=t,V=ee(),z=ee(),K=ee(),R=l.useRef(null),w=Ft();T(()=>{if(h!==void 0){let a=h.trim();r.current.value=a,S.emit()}},[h]),T(()=>{w(6,ie)},[]);let S=l.useMemo(()=>({subscribe:a=>(u.current.add(a),()=>u.current.delete(a)),snapshot:()=>r.current,setState:(a,m,v)=>{var c,b,N,_;if(!Object.is(r.current[a],m)){if(r.current[a]=m,a==="search")J(),U(),w(1,W);else if(a==="value"){if(document.activeElement.hasAttribute("cmdk-input")||document.activeElement.hasAttribute("cmdk-root")){let k=document.getElementById(K);k?k.focus():(c=document.getElementById(V))==null||c.focus()}if(w(7,()=>{var k;r.current.selectedItemId=(k=O())==null?void 0:k.id,S.emit()}),v||w(5,ie),((b=f.current)==null?void 0:b.value)!==void 0){let k=m??"";(_=(N=f.current).onValueChange)==null||_.call(N,k);return}}S.emit()}},emit:()=>{u.current.forEach(a=>a())}}),[]),G=l.useMemo(()=>({value:(a,m,v)=>{var c;m!==((c=o.current.get(a))==null?void 0:c.value)&&(o.current.set(a,{value:m,keywords:v}),r.current.filtered.items.set(a,H(m,v)),w(2,()=>{U(),S.emit()}))},item:(a,m)=>(x.current.add(a),m&&(i.current.has(m)?i.current.get(m).add(a):i.current.set(m,new Set([a]))),w(3,()=>{J(),U(),r.current.value||W(),S.emit()}),()=>{o.current.delete(a),x.current.delete(a),r.current.filtered.items.delete(a);let v=O();w(4,()=>{J(),(v==null?void 0:v.getAttribute("id"))===a&&W(),S.emit()})}),group:a=>(i.current.has(a)||i.current.set(a,new Set),()=>{o.current.delete(a),i.current.delete(a)}),filter:()=>f.current.shouldFilter,label:y||t["aria-label"],getDisablePointerSelection:()=>f.current.disablePointerSelection,listId:V,inputId:K,labelId:z,listInnerRef:R}),[]);function H(a,m){var v,c;let b=(c=(v=f.current)==null?void 0:v.filter)!=null?c:_t;return a?b(a,r.current.search,m):0}function U(){if(!r.current.search||f.current.shouldFilter===!1)return;let a=r.current.filtered.items,m=[];r.current.filtered.groups.forEach(c=>{let b=i.current.get(c),N=0;b.forEach(_=>{let k=a.get(_);N=Math.max(k,N)}),m.push([c,N])});let v=R.current;D().sort((c,b)=>{var N,_;let k=c.getAttribute("id"),ce=b.getAttribute("id");return((N=a.get(ce))!=null?N:0)-((_=a.get(k))!=null?_:0)}).forEach(c=>{let b=c.closest(fe);b?b.appendChild(c.parentElement===b?c:c.closest(`${fe} > *`)):v.appendChild(c.parentElement===v?c:c.closest(`${fe} > *`))}),m.sort((c,b)=>b[1]-c[1]).forEach(c=>{var b;let N=(b=R.current)==null?void 0:b.querySelector(`${ae}[${Y}="${encodeURIComponent(c[0])}"]`);N==null||N.parentElement.appendChild(N)})}function W(){let a=D().find(v=>v.getAttribute("aria-disabled")!=="true"),m=a==null?void 0:a.getAttribute(Y);S.setState("value",m||void 0)}function J(){var a,m,v,c;if(!r.current.search||f.current.shouldFilter===!1){r.current.filtered.count=x.current.size;return}r.current.filtered.groups=new Set;let b=0;for(let N of x.current){let _=(m=(a=o.current.get(N))==null?void 0:a.value)!=null?m:"",k=(c=(v=o.current.get(N))==null?void 0:v.keywords)!=null?c:[],ce=H(_,k);r.current.filtered.items.set(N,ce),ce>0&&b++}for(let[N,_]of i.current)for(let k of _)if(r.current.filtered.items.get(k)>0){r.current.filtered.groups.add(N);break}r.current.filtered.count=b}function ie(){var a,m,v;let c=O();c&&(((a=c.parentElement)==null?void 0:a.firstChild)===c&&((v=(m=c.closest(ae))==null?void 0:m.querySelector(It))==null||v.scrollIntoView({block:"nearest"})),c.scrollIntoView({block:"nearest"}))}function O(){var a;return(a=R.current)==null?void 0:a.querySelector(`${Ke}[aria-selected="true"]`)}function D(){var a;return Array.from(((a=R.current)==null?void 0:a.querySelectorAll(De))||[])}function Q(a){let m=D()[a];m&&S.setState("value",m.getAttribute(Y))}function te(a){var m;let v=O(),c=D(),b=c.findIndex(_=>_===v),N=c[b+a];(m=f.current)!=null&&m.loop&&(N=b+a<0?c[c.length-1]:b+a===c.length?c[0]:c[b+a]),N&&S.setState("value",N.getAttribute(Y))}function se(a){let m=O(),v=m==null?void 0:m.closest(ae),c;for(;v&&!c;)v=a>0?Pt(v,ae):$t(v,ae),c=v==null?void 0:v.querySelector(De);
vendor: 4,272 bytes, line 11
11c?S.setState("value",c.getAttribute(Y)):te(a)}let j=()=>Q(D().length-1),X=a=>{a.preventDefault(),a.metaKey?j():a.altKey?se(1):te(1)},L=a=>{a.preventDefault(),a.metaKey?Q(0):a.altKey?se(-1):te(-1)};return l.createElement(F.div,{ref:n,tabIndex:-1,...A,"cmdk-root":"",onKeyDown:a=>{var m;(m=A.onKeyDown)==null||m.call(A,a);let v=a.nativeEvent.isComposing||a.keyCode===229;if(!(a.defaultPrevented||v))switch(a.key){case"n":case"j":{I&&a.ctrlKey&&X(a);break}case"ArrowDown":{X(a);break}case"p":case"k":{I&&a.ctrlKey&&L(a);break}case"ArrowUp":{L(a);break}case"Home":{a.preventDefault(),Q(0);break}case"End":{a.preventDefault(),j();break}case"Enter":{a.preventDefault();let c=O();if(c){let b=new Event(ye);c.dispatchEvent(b)}}}}},l.createElement("label",{"cmdk-label":"",htmlFor:G.inputId,id:G.labelId,style:Tt},y),me(t,a=>l.createElement(He.Provider,{value:S},l.createElement(Ge.Provider,{value:G},a))))}),Rt=l.forwardRef((t,n)=>{var r,x;let i=ee(),o=l.useRef(null),u=l.useContext(Ue),f=ne(),y=Je(t),s=(x=(r=y.current)==null?void 0:r.forceMount)!=null?x:u==null?void 0:u.forceMount;T(()=>{if(!s)return f.item(i,u==null?void 0:u.id)},[s]);let h=Qe(i,o,[t.value,t.children,o],t.keywords),g=ke(),d=$(w=>w.value&&w.value===h.current),p=$(w=>s||f.filter()===!1?!0:w.search?w.filtered.items.get(i)>0:!0);l.useEffect(()=>{let w=o.current;if(!(!w||t.disabled))return w.addEventListener(ye,C),()=>w.removeEventListener(ye,C)},[p,t.onSelect,t.disabled]);function C(){var w,S;M(),(S=(w=y.current).onSelect)==null||S.call(w,h.current)}function M(){g.setState("value",h.current,!0)}if(!p)return null;let{disabled:I,value:A,onSelect:V,forceMount:z,keywords:K,...R}=t;return l.createElement(F.div,{ref:le(o,n),...R,id:i,"cmdk-item":"",role:"option","aria-disabled":!!I,"aria-selected":!!d,"data-disabled":!!I,"data-selected":!!d,onPointerMove:I||f.getDisablePointerSelection()?void 0:M,onClick:I?void 0:C},t.children)}),At=l.forwardRef((t,n)=>{let{heading:r,children:x,forceMount:i,...o}=t,u=ee(),f=l.useRef(null),y=l.useRef(null),s=ee(),h=ne(),g=$(p=>i||h.filter()===!1?!0:p.search?p.filtered.groups.has(u):!0);T(()=>h.group(u),[]),Qe(u,f,[t.value,t.heading,y]);let d=l.useMemo(()=>({id:u,forceMount:i}),[i]);return l.createElement(F.div,{ref:le(f,n),...o,"cmdk-group":"",role:"presentation",hidden:g?void 0:!0},r&&l.createElement("div",{ref:y,"cmdk-group-heading":"","aria-hidden":!0,id:s},r),me(t,p=>l.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":r?s:void 0},l.createElement(Ue.Provider,{value:d},p))))}),Lt=l.forwardRef((t,n)=>{let{alwaysRender:r,...x}=t,i=l.useRef(null),o=$(u=>!u.search);return!r&&!o?null:l.createElement(F.div,{ref:le(i,n),...x,"cmdk-separator":"",role:"separator"})}),zt=l.forwardRef((t,n)=>{let{onValueChange:r,...x}=t,i=t.value!=null,o=ke(),u=$(s=>s.search),f=$(s=>s.selectedItemId),y=ne();return l.useEffect(()=>{t.value!=null&&o.setState("search",t.value)},[t.value]),l.createElement(F.input,{ref:n,...x,"cmdk-input":"",autoComplete:"off",autoCorrect:"off",spellCheck:!1,"aria-autocomplete":"list",role:"combobox","aria-expanded":!0,"aria-controls":y.listId,"aria-labelledby":y.labelId,"aria-activedescendant":f,id:y.inputId,type:"text",value:i?t.value:u,onChange:s=>{i||o.setState("search",s.target.value),r==null||r(s.target.value)}})}),Ot=l.forwardRef((t,n)=>{let{children:r,label:x="Suggestions",...i}=t,o=l.useRef(null),u=l.useRef(null),f=$(s=>s.selectedItemId),y=ne();return l.useEffect(()=>{if(u.current&&o.current){let s=u.current,h=o.current,g,d=new ResizeObserver(()=>{g=requestAnimationFrame(()=>{let p=s.offsetHeight;h.style.setProperty("--cmdk-list-height",p.toFixed(1)+"px")})});return d.observe(s),()=>{cancelAnimationFrame(g),d.unobserve(s)}}},[]),l.createElement(F.div,{ref:le(o,n),...i,"cmdk-list":"",role:"listbox",tabIndex:-1,"aria-activedescendant":f,"aria-label":x,id:y.listId},me(t,s=>l.createElement("div",{ref:le(u,y.listInnerRef),"cmdk-list-sizer":""},s)))}),Mt=l.forwardRef((t,n)=>{let{open:r,onOpenChange:x,overlayClassName:i,contentClassName:o,container:u,...f}=t;return l.createElement(mt,{open:r,onOpenChange:x},l.createElement(pt,{container:u},l.createElement(xt,{"cmdk-overlay":"",className:i}),l.createElement(ft,{"aria-label":t.label,"cmdk-dialog":"",className:o},l.createElement(We,{ref:n,...f}))))}
11),Dt=l.forwardRef((t,n)=>$(r=>r.filtered.count===0)?l.createElement(F.div,{ref:n,...t,"cmdk-empty":"",role:"presentation"}):null),Bt=l.forwardRef((t,n)=>{let{progress:r,children:x,label:i="Loading...",...o}=t;return l.createElement(F.div,{ref:n,...o,"cmdk-loading":"",role:"progressbar","aria-valuenow":r,"aria-valuemin":0,"aria-valuemax":100,"aria-label":i},me(t,u=>l.createElement("div",{"aria-hidden":!0},u)))}),E=Object.assign(We,{List:Ot,Item:Rt,Input:zt,Group:At,Separator:Lt,Dialog:Mt,Empty:Dt,Loading:Bt});function Pt(t,n){let r=t.nextElementSibling;for(;r;){if(r.matches(n))return r;r=r.nextElementSibling}}function $t(t,n){let r=t.previousElementSibling;for(;r;){if(r.matches(n))return r;r=r.previousElementSibling}}function Je(t){let n=l.useRef(t);return T(()=>{n.current=t}),n}var T=typeof window>"u"?l.useEffect:l.useLayoutEffect;function Z(t){let n=l.useRef();return n.current===void 0&&(n.current=t()),n}function $(t){let n=ke(),r=()=>t(n.snapshot());return l.useSyncExternalStore(n.subscribe,r,r)}function Qe(t,n,r,x=[]){let i=l.useRef(),o=ne();return T(()=>{var u;let f=(()=>{var s;for(let h of r){if(typeof h=="string")return h.trim();if(typeof h=="object"&&"current"in h)return h.current?(s=h.current.textContent)==null?void 0:s.trim():i.current}})(),y=x.map(s=>s.trim());o.value(t,f,y),(u=n.current)==null||u.setAttribute(Y,f),i.current=f}),i}var Ft=()=>{let[t,n]=l.useState(),r=Z(()=>new Map);return T(()=>{r.current.forEach(x=>x()),r.current=new Map},[t]),(x,i)=>{r.current.set(x,i),n({})}};function qt(t){let n=t.type;return typeof n=="function"?n(t.props):"render"in n?n.render(t.props):t}function me({asChild:t,children:n},r){return t&&l.isValidElement(n)?l.cloneElement(qt(n),{ref:n.ref},r(n.props.children)):r(n)}var Tt={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};const be=l.forwardRef(({className:t,...n},r)=>e.jsx(E,{ref:r,className:P("flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",t),...n}));be.displayName=E.displayName;const je=l.forwardRef(({className:t,...n},r)=>e.jsxs("div",{className:"flex items-center border-b px-3","cmdk-input-wrapper":"",children:[e.jsx(Ze,{className:"mr-2 h-4 w-4 shrink-0 opacity-50"}),e.jsx(E.Input,{ref:r,className:P("flex h-11 w-full rounded-md bg-transparent py-3 text-sm outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",t),...n})]}));je.displayName=E.Input.displayName;const we=l.forwardRef(({className:t,...n},r)=>e.jsx(E.List,{ref:r,className:P("max-h-[300px] overflow-y-auto overflow-x-hidden",t),...n}));we.displayName=E.List.displayName;const Ne=l.forwardRef((t,n)=>e.jsx(E.Empty,{ref:n,className:"py-6 text-center text-sm",...t}));Ne.displayName=E.Empty.displayName;const Ce=l.forwardRef(({className:t,...n},r)=>e.jsx(E.Group,{ref:r,className:P("overflow-hidden p-1 text-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground",t),...n}));Ce.displayName=E.Group.displayName;const Vt=l.forwardRef(({className:t,...n},r)=>e.jsx(E.Separator,{ref:r,className:P("-mx-1 h-px bg-border",t),...n}));Vt.displayName=E.Separator.displayName;const Se=l.forwardRef(({className:t,...n},r)=>e.jsx(E.Item,{ref:r,className:P("relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none data-[disabled=true]:pointer-events-none data-[selected='true']:bg-accent data-[selected=true]:text-accent-foreground data-[disabled=true]:opacity-50",t),...n}));Se.displayName=E.Item.displayName;const oe=t=>t.toLowerCase().normalize("NFD").replace(/[\u0300-\u036f]/g,"").replace(/[^a-z0-9]/g,""),Kt=({county:t,city:n,onChange:r})=>{const[x,i]=l.useState(!1),[o,u]=l.useState(!1),{data:f,isLoading:y}=Be({queryKey:["sameday-coverage"],staleTime:1e3*60*60,queryFn:async()=>{const d=[];for(let C=0;C<40;C++){const{data:M,error:I}=await q.from("sameday_coverage").select("county, city").eq("active",!0).order("county",{ascending:!0}).order("city",{ascending:!0}).range(C*1e3,C*1e3+1e3-1);if(I)throw I;const A=M||[];if(d.push(...A),A.length<1e3)break}return d}}),s=f??[],h=l.useMemo(()=>Array.from(new Set(s.map(d=>d.county))).sort((d,p)=>d.localeCompare(p,"ro")),[s]),g=l.useMemo(()=>Array.from(new Set(s.filter(d=>d.county===t).map(d=>d.city))).sort((d,p)=>d.localeCompare(p,"ro")),[s,t]);return e.jsxs("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-2",children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(B,{className:"text-xs",children:"Județ *"}),e.jsxs(Ee,{open:x,onOpenChange:i,children:[e.jsx(Ie,{asChild:!0,children:e.jsxs(de,{variant:"outline",role:"combobox","aria-expanded":x,className:"w-full justify-between font-normal",disabled:y,children:[t||(y?"Se încarcă...":"Alege județul"),e.jsx(ze,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),e.jsx(_e,{className:"w-full p-0",align:"start",children:e.jsxs(be,{filter:(d,p)=>oe(d).includes(oe(p))?1:0,children:[e.jsx(je,{placeholder:"Caută județ..."}),e.jsxs(we,{children:[e.jsx(Ne,{children:"Niciun județ găsit."}),e.jsx(Ce,{children:h.map(d=>e.jsxs(Se,{value:d,onSelect:()=>{r({county:d,city:""}),i(!1)},children:[e.jsx(Re,{className:P("mr-2 h-4 w-4",t===d?"opacity-100":"opacity-0")}),d]},d))})]})]})})]})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(B,{className:"text-xs",children:"Oraș / Localitate *"}),e.jsxs(Ee,{open:o,onOpenChange:u,children:[e.jsx(Ie,{asChild:!0,children:e.jsxs(de,{variant:"outline",role:"combobox","aria-expanded":o,className:"w-full justify-between font-normal",disabled:!t||y,children:[n||(t?"Alege localitatea":"Mai întâi alege județul"),e.jsx(ze,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),e.jsx(_e,{className:"w-full p-0",align:"start",children:e.jsxs(be,{filter:(d,p)=>oe(d).includes(oe(p))?1:0,children:[e.jsx(je,{placeholder:"Caută localitate..."}),e.jsxs(we,{children:[e.jsx(Ne,{children:"Nicio localitate găsită."}),e.jsx(Ce,{children:g.map(d=>e.jsxs(Se,{value:d,onSelect:()=>{r({county:t,city:d}),u(!1)},children:[e.jsx(Re,{className:P("mr-2 h-4 w-4",n===d?"opacity-100":"opacity-0")}),d]},d))})]})]})})]})]})]})},Gt={not_authenticated:"Trebuie să fii autentificat pentru a rezerva o carte.",already_claimed_this_wave:"Ai deja o carte rezervată în acest val.",no_booking:"Biblioteca e disponibilă pentru părinții care au avut o rezervare la noi.",n
11ot_former_client:"Biblioteca e disponibilă deocamdată pentru clienții noștri."},Ht=({book:t,open:n,onOpenChange:r,onReserved:x})=>{const{user:i}=$e(),[o,u]=l.useState(null),[f,y]=l.useState(!1),[s,h]=l.useState(""),[g,d]=l.useState(""),[p,C]=l.useState(""),[M,I]=l.useState(""),[A,V]=l.useState(""),[z,K]=l.useState({county:"",city:""}),[R,w]=l.useState(""),[S,G]=l.useState(!1),[H,U]=l.useState(!1),[W,J]=l.useState(!1),[ie,O]=l.useState(!1);l.useEffect(()=>{if(!n||!t)return;h(""),d(""),C(""),I(""),V(""),K({county:"",city:""}),w(""),G(!1),U(!1),O(!1),u(null);let j=!1;return y(!0),q.rpc("user_can_claim_library_book",{p_user:(i==null?void 0:i.id)??null}).then(({data:X,error:L})=>{j||(u(L?{can_claim:!1,reason:"not_authenticated"}:X),y(!1))}),()=>{j=!0}},[n,t==null?void 0:t.id,i==null?void 0:i.id]);const D=g.replace(/\D/g,""),Q=D.length>=9&&D.length<=12,te=!!s.trim()&&Q&&!!z.county&&!!z.city&&!!R.trim()&&S&&!W,se=async()=>{if(!(!t||!i)){J(!0);try{const j={item_id:t.id,buyer_id:i.id,buyer_email:i.email??"",recipient_name:s.trim(),recipient_phone:g.trim(),easybox_county:z.county,easybox_city:z.city,easybox_locker:R.trim(),newsletter_optin:H},X={child_age:p.trim()||null,child_grade:M.trim()||null,child_interests:A.trim()||null};let{error:L}=await q.from("physical_orders").insert({...j,...X});if(L&&/column|schema/i.test(L.message)&&(L=(await q.from("physical_orders").insert(j)).error),L)throw L;const{error:a}=await q.from("physical_items").update({status:"reserved"}).eq("id",t.id);a&&console.warn("[BIBLIOTECA] item status update failed",a),H&&i.email&&q.functions.invoke("newsletter-subscribe",{body:{email:i.email,first_name:s.trim(),tag:"biblioteca"}}).catch(m=>console.warn("[BIBLIOTECA] newsletter failed",m)),O(!0),x()}catch(j){it({title:"Eroare",description:j.message,variant:"destructive"})}finally{J(!1)}}};return e.jsx(et,{open:n,onOpenChange:r,children:e.jsxs(tt,{className:"max-w-lg max-h-[90vh] overflow-y-auto",children:[e.jsx(rt,{children:e.jsxs(at,{className:"text-base leading-snug pr-6",children:["Rezervi „",t==null?void 0:t.title,"”"]})}),t&&e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"rounded-xl border border-primary/20 bg-primary/5 p-3 space-y-1.5",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx(ge,{className:"text-[10px]",children:"Gratuit pentru membrii Clubului"}),t.condition&&ue[t.condition]&&e.jsx(ge,{variant:"secondary",className:"text-[10px]",children:ue[t.condition]})]}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:[t.author?`${t.author} · `:"","Rezervi cartea acum, o expediem în 1–2 zile lucrătoare și o ridici din easyboxul indicat mai jos. Nu plătești nimic, nici transportul."]}),e.jsxs("div",{className:"flex flex-wrap gap-3 pt-1 text-[11px] text-foreground/80",children:[e.jsxs("span",{className:"inline-flex items-center gap-1",children:[e.jsx(Te,{className:"w-3.5 h-3.5 text-primary"})," 0 lei"]}),e.jsxs("span",{className:"inline-flex items-center gap-1",children:[e.jsx(gt,{className:"w-3.5 h-3.5 text-primary"})," livrare 2–5 zile"]}),e.jsxs("span",{className:"inline-flex items-center gap-1",children:[e.jsx(Fe,{className:"w-3.5 h-3.5 text-primary"})," ridicare din easybox"]})]})]}),ie?e.jsxs("div",{className:"flex items-start gap-2 text-sm text-foreground",children:[e.jsx(lt,{className:"w-5 h-5 text-primary shrink-0"}),e.jsx("p",{children:"Cartea ta e rezervată. Îți trimitem codul de ridicare pe email după ce pregătim expedierea, în 1–2 zile lucrătoare."})]}):f?e.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[e.jsx(qe,{className:"w-4 h-4 animate-spin"})," Verificăm disponibilitatea..."]}):o&&!o.can_claim?e.jsx("p",{className:"text-sm text-muted-foreground",children:Gt[o.reason]??"Momentan nu poți rezerva o carte."}):e.jsxs("div",{className:"space-y-3",children:[e.jsx("p",{className:"text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:"Date de livrare"}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(B,{htmlFor:"recipient",className:"text-xs",children:"Numele destinatarului (adult) *"}),e.jsx(re,{id:"recipient",value:s,onChange:j=>h(j.target.value),maxLength:120,placeholder:"Ex: Maria Popescu"})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(B,{htmlFor:"recipient-phone",className:"text-xs",children:"Telefon destinatar *"}),e.jsx(re,{id:"recipient-phone",type:"tel",inputMode:"tel",value:g,onChange:j=>d(j.target.value),maxLength:20,placeholder:"Ex: 0722 123 456"}),g.length>0&&!Q&&e.jsx("p",{className:"text-[11px] text-destructive",children:"Introdu un număr de telefon valid (aprox. 10 cifre)."})]}),e.jsx(Kt,{county:z.county,city:z.city,onChange:K}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(B,{htmlFor:"locker",className:"text-xs",children:"Punctul easybox (scrie numele lockerului, ex. Humulesti 2) *"}),e.jsx(re,{id:"locker",value:R,onChange:j=>w(j.target.value),maxLength:200,placeholder:"Ex: Humulesti 2"})]}),e.jsx(Le,{}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:"Despre copil (opțional)"}),e.jsx("p",{className:"text-[11px] text-muted-foreground",children:"Ne ajută să-i recomandăm cărți și ateliere potrivite la valurile următoare."})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(B,{htmlFor:"child-age",className:"text-xs",children:"Vârsta copilului"}),e.jsx(re,{id:"child-age",value:p,onChange:j=>C(j.target.value),maxLength:40,placeholder:"Ex: 8 ani"})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(B,{htmlFor:"child-grade",className:"text-xs",children:"Clasa"}),e.jsx(re,{id:"child-grade",value:M,onChange:j=>I(j.target.value),maxLength:40,placeholder:"Ex: clasa a II-a"})]})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(B,{htmlFor:"child-interests",className:"text-xs",children:"Ce îl interesează"}),e.jsx(nt,{id:"child-interests",value:A,onChange:j=>V(j.target.value),maxLength:500,rows:3,placeholder:"Ex: dinozauri, spațiu, desen, povești cu animale..."})]}),e.jsx(Le,{}),e.jsxs("label",{className:"flex items-start gap-2 text-xs text-foreground cursor-pointer",children:[e.jsx(Ae,{checked:S,onCheckedChange:j=>G(j===!0)}),e.jsxs("span",{children:["Sunt de acord ca datele de livrare să fie folosite pentru expedierea acestei cărți și confirm că am citit"," ",e.jsx(Xe,{to:"/legal/termeni-si-conditii",className:"text-primary underline underline-offset-2",target:"_blank",rel:"noopener noreferrer",children:"Termenii și Condițiile"})," ","programului Biblioteca Clubului Ateliere Online."]})]}),e.jsxs("label",{className:"flex items-start gap-2 text-xs text-foreground cursor-pointer",children:[e.jsx(Ae,{checked:H,onCheckedChange:j=>U(j===!0)}),e.jsx("span",{children:"Vreau să primesc noutăți despre ateliere și campanii."})]}),e.jsx(de,{className:"w-full",disabled:!te,onClick:se,children:W?"Se rezervă...":"Rezervă cartea gratuit"}),e.jsx("p",{className:"text-center text-[11px] text-muted-foreground",children:"O carte per cont, în fiecare val. Fără costuri ascunse."})]})]})]})})},lr=()=>{const t=Ye(),{isAuthenticated:n,isLoading:r}=$e(),[x,i]=l.useState(null),[o,u]=l.useState(!1),{data:f,isLoading:y,refetch:s}=Be({queryKey:["library-books"],queryFn:async()=>{const{data:p,error:C}=await q.from("physical_items").select("id, title, description, author, publisher, edition, page_count, condition, language, age_min, age_max, photos, wave, status").eq("status","available").eq("kind","donation").order("created_at",{ascending:!1});if(C)throw C;return p||[]}}),h=f??[],g=p=>
11{if(!n){sessionStorage.setItem("returnTo","/biblioteca"),u(!0);return}i(p)};if(r)return e.jsx("div",{className:"min-h-screen bg-background flex items-center justify-center",children:e.jsx(qe,{className:"w-6 h-6 animate-spin text-muted-foreground"})});const d=[{icon:he,title:"Alegi cartea",text:"O carte per cont, în fiecare val."},{icon:Fe,title:"Ne dai easyboxul",text:"Completezi datele de livrare în 1 minut."},{icon:Te,title:"O primești acasă",text:"În 2–5 zile lucrătoare, transport gratuit."}];return e.jsxs("div",{className:"min-h-screen bg-background pb-36",children:[e.jsx(ot,{title:"Biblioteca Clubului AteliereOnline — cărți gratuite pentru copii",description:"Beneficiu pentru membrii Clubului AteliereOnline: alegi o carte pentru copilul tău, o primești gratuit la easybox în 2–5 zile."}),e.jsxs("div",{className:"safe-top px-4 pt-4",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(de,{variant:"ghost",size:"icon",onClick:()=>t(-1),children:e.jsx(ht,{className:"w-5 h-5"})}),e.jsxs("h1",{className:"text-xl font-bold text-foreground flex items-center gap-2",children:[e.jsx(he,{className:"w-5 h-5 text-primary"}),"Biblioteca Clubului"]})]}),e.jsxs("div",{className:"mt-3 rounded-2xl border border-primary/20 bg-primary/5 p-4",children:[e.jsxs("div",{className:"inline-flex items-center gap-1.5 rounded-full bg-primary/10 px-2.5 py-1 text-[11px] font-semibold text-primary",children:[e.jsx(st,{className:"w-3 h-3"}),"Beneficiu de membru Club AteliereOnline"]}),e.jsx("p",{className:"mt-2 text-sm font-semibold text-foreground",children:"O carte pentru copilul tău, complet gratuită. Inclusiv livrarea."}),e.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:"Cărțile sunt donate de comunitatea noastră și de partenerii proiectului. Pentru că ai fost cu noi la ateliere, îți trimitem una la easyboxul pe care îl alegi — fără costuri, fără abonament."}),e.jsx("div",{className:"mt-4 grid gap-2 sm:grid-cols-3",children:d.map((p,C)=>e.jsxs("div",{className:"rounded-xl border border-border bg-card p-3 flex flex-col gap-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"w-6 h-6 rounded-full bg-primary/10 text-primary text-[11px] font-bold flex items-center justify-center",children:C+1}),e.jsx(p.icon,{className:"w-4 h-4 text-primary"})]}),e.jsx("p",{className:"text-xs font-semibold text-foreground",children:p.title}),e.jsx("p",{className:"text-[11px] text-muted-foreground leading-snug",children:p.text})]},p.title))})]})]}),e.jsxs("div",{className:"px-4 mt-5",children:[e.jsxs("div",{className:"flex items-baseline justify-between mb-3",children:[e.jsx("h2",{className:"text-base font-semibold text-foreground",children:"Cărți disponibile acum"}),!y&&h.length>0&&e.jsxs("span",{className:"text-xs text-muted-foreground",children:[h.length," titluri"]})]}),y?e.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-5 xl:grid-cols-6 gap-3",children:[0,1,2,3,4,5].map(p=>e.jsx("div",{className:"rounded-xl bg-muted animate-pulse aspect-[3/4]"},p))}):h.length===0?e.jsx("p",{className:"text-sm text-muted-foreground",children:"Momentan toate cărțile sunt rezervate. Revino la următorul val — adăugăm titluri noi constant."}):e.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-5 xl:grid-cols-6 gap-3",children:h.map(p=>e.jsx(vt,{book:p,onClick:()=>g(p)},p.id))})]}),e.jsx(Ht,{book:x,open:!!x,onOpenChange:p=>!p&&i(null),onReserved:()=>s()}),e.jsx(ct,{open:o,onOpenChange:u,title:"Intră în cont ca să rezervi cartea",description:"Cărțile din Bibliotecă sunt un beneficiu pentru membrii Clubului AteliereOnline. Contul e gratuit și durează un minut."})]})};export{lr 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.