1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3110],{9649:function(e,t,r){r.r(t),r.d(t,{default:function(){return j}});var n=r(7437),a=r(2265),i=r(9376),o=r(9102),l=r(5609),s=r(8734);let c=Object.freeze([1,2,3,4,5]);var u=r(4887),d=r(7192),h=r(3486);let p=["image/jpeg","image/jpg","image/png","image/webp","image/gif"];async function f(e,t,r){let n=await fetch("/api/reviews/upload-url",{method:"POST",headers:{"Content-Type":"application/json",Authorization:"Bearer ".concat(t)},body:JSON.stringify({fileName:e.name,contentType:e.type})}),a=await n.json().catch(()=>({}));if(!n.ok||!(null==a?void 0:a.url)||!(null==a?void 0:a.publicUrl))throw Error((null==a?void 0:a.error)||r("reviews.imageUploadError","ש×××× ×××¢××ת ×ת××× ×"));if(!(await fetch(a.url,{method:"PUT",headers:{"Content-Type":e.type},body:e})).ok)throw Error(r("reviews.imageUploadError","ש×××× ×××¢××ת ×ת××× ×"));return a.publicUrl}let m="M8.47528 0.904831C8.84862 -0.301639 10.5563 -0.301637 10.9297 0.904832L12.3066 5.35444C12.4731 5.89246 12.9706 6.25929 13.5338 6.25929H18.1179C19.3471 6.25929 19.8743 7.81969 18.897 8.56523L15.0823 11.4754C14.6539 11.8022 14.475 12.3617 14.6343 12.8765L16.0656 17.5021C16.4353 18.6967 15.0535 19.6617 14.0593 18.9032L10.4816 16.1739C10.0215 15.8229 9.38345 15.8229 8.92332 16.1739L5.34564 18.9032C4.35139 19.6617 2.96962 18.6967 3.3393 17.5021L4.77069 12.8765C4.92998 12.3617 4.75107 11.8022 4.32265 11.4754L0.507893 8.56523C-0.469398 7.81969 0.0578415 6.25929 1.28704 6.25929H5.87117C6.43436 6.25929 6.93188 5.89245 7.09836 5.35444L8.47528 0.904831Z";function x(e){let{value:t,name:r,checked:a,onRate:i,onHover:o,t:l}=e;return(0,n.jsxs)("label",{onMouseEnter:()=>o(t),className:"absolute inset-0 z-10 cursor-pointer",children:[(0,n.jsx)("input",{type:"radio",name:r,value:t,checked:a,onChange:()=>i(t),className:"peer sr-only"}),(0,n.jsx)("span",{className:"sr-only",children:l("reviews.starsAria","{n} ××××××").replace("{n}",t)}),(0,n.jsx)("span",{"aria-hidden":"true",className:"absolute inset-0 rounded-[3px] peer-focus-visible:outline peer-focus-visible:outline-2 peer-focus-visible:outline-offset-2 peer-focus-visible:outline-brand-focus"})]})}function v(e){let{active:t,value:r,name:a,rating:i,onRate:o,onHover:l,t:s}=e;return(0,n.jsxs)("div",{className:"relative h-[34px] w-[34px]",children:[(0,n.jsx)("svg",{width:"34",height:"34",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true",className:"absolute inset-0 text-neutral-300",children:(0,n.jsx)("path",{d:m})}),t&&(0,n.jsx)("svg",{width:"34",height:"34",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true",className:"absolute inset-0 text-brand-green",children:(0,n.jsx)("path",{d:m})}),(0,n.jsx)(x,{value:r,name:a,checked:i===r,onRate:o,onHover:l,t:s})]})}function b(e){let{open:t,onClose:r,bookId:i,bookTitle:l,onSubmitted:m}=e,{getToken:x}=(0,o.a)(),{t:b,dir:g}=(0,d.Q)(),{invalidateRecommendations:w}=(0,h.G)(),[j,y]=(0,a.useState)(0),[k,N]=(0,a.useState)(0),[C,L]=(0,a.useState)(""),[E,S]=(0,a.useState)([]),[R,M]=(0,a.useState)(!1),[B,I]=(0,a.useState)(""),[T,U]=(0,a.useState)(!1),[z,O]=(0,a.useState)(!1),P=(0,a.useRef)(null),W=(0,a.useRef)(null),_=(0,a.useRef)(null),A=(0,a.useId)(),[G,H]=(0,a.useState)(0),F=(0,a.useCallback)(e=>{I(e),H(e=>e+1)},[]);(0,s.Z)(t,W),(0,a.useEffect)(()=>U(!0),[]),(0,a.useEffect)(()=>()=>E.forEach(e=>URL.revokeObjectURL(e.preview)),[E]);let J=(0,a.useRef)(r);(0,a.useEffect)(()=>{J.current=r},[r]);let Q=(0,a.useCallback)(()=>{O(!1),setTimeout(()=>{var e;return null===(e=J.current)||void 0===e?void 0:e.call(J)},220)},[]);if((0,a.useEffect)(()=>{if(!t){O(!1);return}y(0),N(0),L(""),S(e=>(e.forEach(e=>URL.revokeObjectURL(e.preview)),[])),I("");let e=setTimeout(()=>O(!0),10);return()=>clearTimeout(e)},[t]),(0,a.useEffect)(()=>{var e;G>0&&(null===(e=_.current)||void 0===e||e.focus())},[G]),(0,a.useEffect)(()=>{if(!t)return;let e=e=>"Escape"===e.key&&Q();document.addEventListener("keydown",e);let r=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.removeEventListener("keydown",e),document.body.style.overflow=r}},[t,Q]),!t||!T)return null;let Z=e=>{I("");let t=Array.from(e||[]);if(!t.length)return;let r=4-E.length;if(r<=0){F(b("reviews.maxImages","× ××ª× ×צרף ×¢× {n} ת××× ×ת").replace("{n}",4));return}let n=[];for(let e of t.slice(0,r)){if(!p.includes(e.type)){F(b("reviews.imageTypeError","× ××ª× ×צרף ×§××¦× ×ª××× × ×××× (JPG, PNG, WEBP, GIF)"));continue}if(e.size>5242880){F(b("reviews.imageSizeError","×× ×ª××× × ××××ת ××××ת ×¢× 5MB"));continue}
1n.push({file:e,preview:URL.createObjectURL(e)})}t.length>r&&F(b("reviews.maxImages","× ××ª× ×צרף ×¢× {n} ת××× ×ת").replace("{n}",4)),n.length&&S(e=>[...e,...n])},D=e=>{S(t=>{let r=t.filter((t,r)=>r!==e);return URL.revokeObjectURL(t[e].preview),r})},$=async e=>{if(e.preventDefault(),!(Number.isInteger(j)&&c.includes(j)))return F(b("reviews.pickRating","×××¨× ××ר×× ×××××××"));if(!C.trim())return F(b("reviews.writeReview","×ת×× ×ת ××××§×רת ש×××"));M(!0),I("");try{let e=await x(),t=[];E.length&&(t=await Promise.all(E.map(t=>f(t.file,e,b))));let r=await fetch("/api/reviews",{method:"POST",headers:{"Content-Type":"application/json",Authorization:"Bearer ".concat(e)},body:JSON.stringify({bookId:i,rating:j,review:C.trim(),images:t})}),n=await r.json().catch(()=>({}));if(!r.ok){F((null==n?void 0:n.error)||b("reviews.submitError","ש×××× ×ש×××ת ××××§×רת"));return}w(),null==m||m(),Q()}catch(e){F((null==e?void 0:e.message)||b("reviews.networkError","ש×××ת תקש×רת. × ×¡× ×©××"))}finally{M(!1)}};return(0,u.createPortal)((0,n.jsxs)("div",{className:"fixed inset-0 z-[100] flex items-center justify-center p-4",dir:g,onClick:Q,children:[(0,n.jsx)("div",{"aria-hidden":"true",className:"absolute inset-0 bg-black/50 backdrop-blur-sm transition-opacity ease-out motion-reduce:transition-none ".concat(z?"opacity-100 duration-300":"opacity-0 duration-200")}),(0,n.jsxs)("div",{ref:W,role:"dialog","aria-modal":"true","aria-labelledby":A,tabIndex:-1,onClick:e=>e.stopPropagation(),className:"relative w-full max-w-[460px] rounded-[20px] bg-white px-8 pb-8 pt-12 shadow-[0_30px_80px_rgba(0,0,0,0.35)] transition will-change-transform motion-reduce:transition-none motion-reduce:transform-none ".concat(z?"opacity-100 translate-y-0 scale-100 duration-300 ease-[cubic-bezier(0.16,1,0.3,1)]":"opacity-0 translate-y-3 scale-95 duration-200 ease-[cubic-bezier(0.4,0,1,1)]"),children:[(0,n.jsx)("button",{type:"button",onClick:Q,"aria-label":b("reviews.close","ס××ר×"),className:"absolute -top-6 left-1/2 grid h-12 w-12 -translate-x-1/2 place-items-center rounded-full bg-brand-green text-black shadow-md transition-transform duration-200 hover:rotate-90 hover:scale-105",children:(0,n.jsx)("svg",{width:"22",height:"22",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.2",strokeLinecap:"round","aria-hidden":"true",children:(0,n.jsx)("path",{d:"M6 6l12 12M18 6L6 18"})})}),(0,n.jsx)("h2",{id:A,className:"text-center text-[24px] font-bold text-black",children:b("reviews.modalTitle","×ת××ת ×××§×רת")}),l&&(0,n.jsx)("p",{className:"mt-1 text-center text-[15px] text-neutral-500",dir:"auto",children:l}),(0,n.jsxs)("form",{onSubmit:$,className:"mt-6",children:[(0,n.jsxs)("fieldset",{children:[(0,n.jsx)("legend",{className:"sr-only",children:b("reviews.ratingLegend","××ר×× ×ספר ×××××××")}),(0,n.jsx)("div",{className:"flex justify-center gap-1.5",dir:"ltr",onMouseLeave:()=>N(0),children:c.map(e=>{let t=k||j;return(0,n.jsx)(v,{active:t>=e,value:e,name:"".concat(A,"-rating"),rating:j,onRate:y,onHover:N,t:b},e)})})]}),(0,n.jsx)("label",{htmlFor:"".concat(A,"-text"),className:"sr-only",children:b("reviews.commentLabel","××××§×רת ש×××")}),(0,n.jsx)("textarea",{id:"".concat(A,"-text"),value:C,onChange:e=>L(e.target.value),dir:"auto",maxLength:2e3,rows:5,required:!0,placeholder:b("reviews.commentPlaceholder","×¡×¤×¨× ×× × ×× ×ש××ª× ×¢× ×ספר..."),className:"mt-5 w-full resize-none rounded-[10px] border border-black/20 bg-white p-4 text-start text-[16px] text-black outline-none focus:border-black/50"}),(0,n.jsxs)("div",{className:"mt-4 flex flex-wrap gap-2",dir:g,children:[E.map((e,t)=>(0,n.jsxs)("div",{className:"relative h-[64px] w-[64px] overflow-hidden rounded-[10px]",children:[(0,n.jsx)("img",{src:e.preview,alt:"",className:"h-full w-full object-cover"}),(0,n.jsx)("button",{type:"button",onClick:()=>D(t),"aria-label":b("reviews.removeImage","×סרת ת××× ×"),className:"absolute start-0.5 top-0.5 grid h-5 w-5 place-items-center rounded-full bg-black/70 text-white",children:(0,n.jsx)("svg",{width:"11",height:"11",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round","aria-hidden":"true",children:(0,n.jsx)("path",{d:"M6 6l12 12M18 6L6 18"})})})]},e.preview)),E.length<4&&(0,n.jsx)("button",{type:"button",onClick:()=>{var e;return null===(e=P.current)||void 0===e?void 0:e.click()},"aria-label":b("reviews.addImage","××ספת ת××× ×"),className:"grid h-[64px] w-[64px] place-items-center rounded-[10px] border border-dashed border-black/30 text-neutral-500 transition-colors hover:border-black/60 hover:text-black",children:(0,n.jsxs)("svg",{width:"22",height:"22",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[(0,n.jsx)("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2"}),(0,n.jsx)("circle",{cx:"9",cy:"9",r:"1.6"}),(0,n.jsx)("path",{d:"M21 15l-5-5L5 21"})]})})]}),(0,n.jsx)("input",{ref:P,type:"file",accept:"image/png,image/jpeg,image/webp,image/gif",multiple:!0,hidden:!0,onChange:e=>{Z(e.target.files),e.target.value=""}}),(0,n.jsx)("p",{ref:_,role:"alert","aria-atomic":"true",tabIndex:-1,dir:"auto",className:B?"mt-2 text-start text-[14px] font-medium text-red-600":"",children:B}),(0,n.jsx)("button",{type:"submit",disabled:R,className:"mt-4 flex h-12 w-full items-center justify-center rounded-[10px] bg-brand-green text-[16px] font-medium text-black transition-opacity disabled:opacity-60",children:R?b("reviews.submitting","ש×××..."):b("reviews.submit","פרס×× ×××§×רת")})]})]})]}),document.body)}var g=r(4064);r(3079);var w=(0,r(2119).$)("99f3e7f2ea1dec5d01acecb21b2708b57304c9b6");function j(e){let{bookId:t,bookTitle:r,className:s,children:c}=e,{authenticated:u}=(0,o.a)(),d=(0,i.useRouter)(),[h,p]=(0,a.useState)(!1),[f,m]=(0,a.useState)(!1),[x,v]=(0,a.useState)(!1);return(0,a.useEffect)(()=>{u&&x&&(v(!1),p(!1),m(!0))},[u,x]),(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("button",{type:"button",onClick:()=>{u?m(!0):(v(!0),p(!0))},className:s,children:c}),(0,n.jsx)(l.default,{open:h,onClose:()=>{p(!1),v(!1)},initialMode:"login"}),(0,n.jsx)(b,{open:f,onClose:()=>m(!1),bookId:t,bookTitle:r,onSubmitted:async()=>{await w(t),(0,g.I)(t),d.refresh()}})]})}},702:function(e,t,r){r.d(t,{default:function(){return c}});var n=r(7437),a=r(8353),i=r(4027),o=r(7192),l=r(4041);function s(){return(0,n.jsx)("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",className:"dir-flip",children:(0,n.jsx)("path",{d:"M15 6l-6 6 6 6",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}function c(e){let{title:t,titleLabel:r,label:c,books:u,href:d,topClass:h="mt-8 first:mt-6",startItem:p=null}=e,{t:f}=(0,o.Q)(),m=(0,l.D)(u),x=r||("string"==typeof t?t:""),v=f("common.allBooksInCategoryLink","××× ×ספר×× ××§×××ר××ת {category}").replace("{category}",x),b=f("common.showAllCategory","××¦× ×ת ×× {category}").replace("{category}",x);return m.length||p?(0,n.jsxs)("section",{"data-preferences-sentinel":"",className:h,"aria-label":!t&&c?c:void 0,children:[t&&(0,n.jsxs)("div",{className:"mb-3 flex items-center justify-between gap-3 px-4",children:[(0,n.jsx)("h2",{dir:"auto",className:"text-[19px] font-bold tracking-tight text-ui-content",children:d?(0,n.jsxs)(a.default,{href:d,"aria-label":v,className:"inline-flex items-center gap-1",children:[(0,n.jsx)("span",{children:t}),(0,n.jsx)(s,{})]}):t}),d&&(0,n.jsxs)(a.default,{href:d,"aria-label":v,className:"inline-flex shrink-0 items-center gap-1 text-[13px] font-medium text-emerald-700",children:[b,(0,n.jsx)(s,{})]})]}),(0,n.jsx)("div",{className:"max-w-full overflow-hidden [contain:paint]",children:(0,n.jsxs)("div",{className:"flex snap-x snap-mandatory items-start gap-3 overflow-x-auto px-4 pb-1 no-scrollbar [scroll-padding-inline-start:1rem]",children:[p&&(0,n.jsx)("div",{className:"flex w-[40vw] max-w-[168px] shrink-0 snap-start self-stretch","data-row-start-item":"",children:p}),m.slice(0,12).map((e,t)=>(0,n.jsx)(i.Z,{book:e,className:"w-[40vw] max-w-[168px] shrink-0 snap-start"},"".concat(e.id,"-").concat(t)))]})})]}):null}},6428:function(e,t,r){r.d(t,{default:function(){return s}});var n=r(7437),a=r(2265),i=r(7192);function o(){return(0,n.jsx)("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",children:(0,n.jsx)("path",{d:"M15 6l-6 6 6 6",stroke:"currentColor",strokeWidth:"2.2",strokeLinecap:"round",strokeLinejoin:"round"})})}function l(){return(0,n.jsx)("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",children:(0,n.jsx)("path",{d:"M9 6l6 6-6 6",stroke:"currentColor",strokeWidth:"2.2",strokeLinecap:"round",strokeLinejoin:"round"})})}function s(e){let{children:t,className:r="",cardsPerView:s=null}=e,{t:c,dir:u}=(0,i.Q)(),d="rtl"===u,h=Number.isInteger(s)&&s>1,p=h?{"--review-card-gap":"calc((100% - ".concat(272*s,"px) / ").concat(s-1,")")}:void 0,f=(0,a.useRef)(null),[m,x]=(0,a.useState)(!1),[v,b]=(0,a.useState)(!1),g=a.Children.count(t),w=(0,a.useCallback)(()=>{let e=f.current;if(!e)return;let t=e.scrollWidth-e.clientWidth;if(t<=1){x(!1),b(!1);return}let r=e.scrollLeft,n=d?-t:0,a=d?0:t;x(r>n+1),b(r<a-1)},[d]);(0,a.useEffect)(()=>{w();let e=f.current;if(!e)return;let t=new ResizeObserver(w);for(let r of(t.observe(e),e.children))t.observe(r);return()=>t.disconnect()},[w,g]);let j=e=>{var t,r;let n=f.current;if(!n)return;let[a,i]=n.children,o=a&&i?Math.abs(i.offsetLeft-a.offsetLeft):0,l=.9*n.clientWidth,s=o>0?Math.max(o,Math.floor(l/o)*o):Math.round(l),c=null===(t=(r=window).matchMedia)||void 0===t?void 0:t.call(r,"(prefers-reduced-motion: reduce)").matches;n.scrollBy({left:"left"===e?-s:s,behavior:c?"auto":"smooth"})},y=d?c("common.next","×××"):c("common.prev","××§×××"),k=d?c("common.prev","××§×××"):c("common.next","×××"),N="carousel-arrow absolute top-1/2 z-20 -mt-[6px] -translate-y-1/2 h-11 w-11 rounded-full bg-white text-neutral-900 shadow-[0_4px_14px_rgba(0,0,0,0.28)] ring-1 ring-black/5 transition duration-200 hover:scale-105 active:scale-95",C="opacity-0 pointer-events-none transition-opacity group-hover/reviews:opacity-100 group-hover/reviews:pointer-events-auto focus-visible:opacity-100 focus-visible:pointer-events-auto",L="opacity-0 pointer-events-none";return(0,n.jsxs)("div",{className:"group/reviews relative ".concat(r),children:[(0,n.jsx)("div",{ref:f,onScroll:w,style:p,className:"flex items-center overflow-x-auto overflow-y-hidden no-scrollbar pb-5 pt-2 ".concat(h?"gap-[var(--review-card-gap)]":"gap-4"),children:t}),(0,n.jsx)("button",{type:"button","aria-label":y,disabled:!m,onClick:()=>j("left"),className:"".concat(N," -left-[22px] ").concat(m?C:L),children:(0,n.jsx)(o,{})}),(0,n.jsx)("button",{type:"button","aria-label":k,disabled:!v,onClick:()=>j("right"),className:"".concat(N," -right-[22px] ").concat(v?C:L),children:(0,n.jsx)(l,{})})]})}},2119:function(e,t,r){Object.defineProperty(t,"$",{enumerable:!0,get:function(){return a}});let n=r(3079);function a(e){let{createServerReference:t}=r(6671);return t(e,n.callServer)}}}]);
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.