1import{r as a,j as e,P as y,Q as j,R as N,B as E}from"./index-Cshou3OC.js";import{A as C}from"./arrow-left-e7SZWsLz.js";import{A as k}from"./arrow-right-B5KfKiQE.js";function M({currentAbbr:g,onSelect:f,onClose:x,initialTestament:v,inline:t}){const[l,m]=a.useState(v==="new"?"new":"old"),n=a.useRef(null),c=a.useRef(null),[s,p]=a.useState(void 0);a.useEffect(()=>{if(!t)return;const o=()=>{if(!c.current)return;const r=c.current.getBoundingClientRect().top,d=document.getElementById("kjb-scroll"),i=d?d.getBoundingClientRect().bottom:window.innerHeight;p(Math.max(240,i-r-24))};return o(),window.addEventListener("resize",o),()=>window.removeEventListener("resize",o)},[t]),a.useEffect(()=>{n.current&&(n.current.scrollTop=0)},[l]);const h=l==="new"?y:j,u=l==="new"?{abbr:"MAT",name:"Matthew",chapters:28,shortName:"Mat"}:{abbr:"GEN",name:"Genesis",chapters:50,shortName:"Gen"},b=o=>{const r=o.abbr===g;return e.jsxs("button",{onClick:()=>{f(o,!1,!0),x()},className:`w-full text-left px-4 py-2.5 text-sm font-sans transition-colors border-b border-border/60 last:border-b-0 ${r?"bg-primary text-primary-foreground font-semibold":"hover:bg-accent/10 text-foreground"}`,children:[e.jsx("span",{className:"notranslate",children:o.name}),e.jsxs("span",{className:"ml-2 text-xs text-muted-foreground",children:[o.chapters," ch."]})]},o.abbr)};
1return e.jsxs("div",{ref:t?c:null,style:t&&s?{maxHeight:s}:void 0,className:`bg-card border border-border rounded-2xl shadow-2xl overflow-hidden max-h-[70vh] flex flex-col relative ${t?"w-full shadow-lg":"w-[95vw] max-w-md sm:max-w-2xl lg:max-w-3xl"}`,children:[e.jsxs("div",{className:"grid grid-cols-2 gap-1 p-2 border-b border-border",children:[e.jsx("button",{onClick:()=>m("old"),className:`py-2 rounded-lg font-sans text-sm font-semibold transition-colors ${l==="old"?"bg-primary text-primary-foreground":"text-foreground hover:bg-accent/10"}`,children:"Old Testament"}),e.jsx("button",{onClick:()=>m("new"),className:`py-2 rounded-lg font-sans text-sm font-semibold transition-colors ${l==="new"?"bg-primary text-primary-foreground":"text-foreground hover:bg-accent/10"}`,children:"New Testament"})]}),e.jsxs("div",{ref:n,className:"kjb-scroll-visible overflow-y-auto flex-1 pb-6 overscroll-contain",children:[e.jsx("button",{onClick:()=>{f(u,!0,!1),x()},className:"w-full text-left px-4 py-3.5 text-sm font-serif transition-colors hover:bg-accent/10 font-medium text-foreground border-b border-border",children:e.jsx("span",{children:"Title Page"})}),e.jsx("div",{className:"flex flex-col",children:h.map(o=>b(o))})]})]})}function P({totalChapters:g,currentChapter:f,onSelect:x,onClose:v,bare:t,bookName:l,onWholeBook:m,inline:n,onBack:c}){const[s,p]=a.useState(f),h=typeof m=="function",u=a.useRef(null),[b,o]=a.useState(void 0);return N.useEffect(()=>{if(!n||t)return;const r=()=>{if(!u.current)return;const d=u.current.getBoundingClientRect().top,i=document.getElementById("kjb-scroll"),w=i?i.getBoundingClientRect().bottom:window.innerHeight;o(Math.max(240,w-d-24))};return r(),window.addEventListener("resize",r),()=>window.removeEventListener("resize",r)},[n,t]),e.jsxs("div",{ref:n&&!t?u:null,style:n&&!t&&b?{maxHeight:b}:void 0,className:t?"flex flex-col":`bg-card border border-border rounded-2xl overflow-hidden max-h-[70vh] flex flex-col relative ${n?"w-full max-w-none shadow-lg":"w-[90vw] max-w-sm shadow-2xl"}`,children:[l&&e.jsxs("div",{className:"flex items-center gap-2 px-3 pt-3",children:[c&&e.jsxs("button",{"data-vaul-no-drag":!0,onPointerDown:r=>r.stopPropagation(),onClick:c,className:"flex items-center gap-1 px-2.5 py-1 rounded-lg bg-secondary border border-border text-foreground font-sans text-xs font-medium hover:bg-accent/20 transition-colors shrink-0",children:[e.jsx(C,{className:"w-3.5 h-3.5"}),"Books"]}),e.jsx("p",{className:"font-serif text-sm font-semibold text-foreground leading-snug break-words min-w-0 flex-1",children:l}),h&&e.jsxs("button",{"data-vaul-no-drag":!0,onPointerDown:r=>r.stopPropagation(),onClick:()=>m(),className:"flex items-center gap-1 px-2.5 py-1 rounded-lg bg-secondary border border-border text-foreground font-sans text-xs font-medium hover:bg-accent/20 transition-colors shrink-0",children:[e.jsx(E,{className:"w-3.5 h-3.5"}),"Whole Book"]})]}),e.jsx("div",{className:t?"p-1":"overflow-y-auto flex-1 p-3",children:e.jsx("div",{className:`grid gap-2 ${n?"grid-cols-6 sm:grid-cols-8 xl:grid-cols-12":"grid-cols-6 sm:grid-cols-8"}`,children:Array.from({length:g},(r,d)=>d+1).map(r=>{const d=r===s,i=s!=null;return e.jsx("button",{"data-vaul-no-drag":!0,onPointerDown:w=>w.stopPropagation(),onClick:()=>p(r),className:`h-9 w-full rounded text-sm font-sans font-medium border transition-colors ${d?"bg-accent text-accent-foreground font-bold border-accent":i?"bg-secondary/50 text-muted-foreground/60 border-border/60 hover:bg-accent/20 hover:text-foreground":"bg-secondary hover:bg-accent/20 text-foreground border-border"}`,children:r},r)})})}),e.jsxs("div",{className:"p-3 border-t border-border flex gap-2",children:[e.jsx("button",{onClick:()=>x(s,!0),disabled:s==null,className:"flex-1 px-4 py-2.5 rounded-lg bg-secondary border border-border text-secondary-foreground font-sans text-sm font-medium hover:bg-accent/20 transition-colors disabled:opacity-50 disabled:hover:bg-secondary",children:"Pick Verse"}),e.jsxs("button",{onClick:()=>x(s,!1),disabled:s==null,className:"flex-1 flex items-center justify-center gap-1.5 px-4 py-2.5 rounded-lg bg-primary border border-primary text-primary-foreground font-sans text-sm font-medium hover:opacity-90 transition-opacity disabled:opacity-50 disabled:hover:opacity-100",children:[s!=null?`Go to Chapter ${s}`:"Pick a chapter",s!=null&&e.jsx(k,{className:"w-4 h-4"})]})]})]})}export{M as B,P as C};
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.