PageSourceSearch

https://www.theunivation.com/_next/static/chunks/c6c871b7b556bf3e.js

js theunivation.com collected 2026-10-08 12:23:29 UTC 41,257 bytes, 1 lines download raw bytes

1(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,707224,e=>{"use strict";let t=(0,e.i(106576).default)("Trophy",[["path",{d:"M6 9H4.5a2.5 2.5 0 0 1 0-5H6",key:"17hqa7"}],["path",{d:"M18 9h1.5a2.5 2.5 0 0 0 0-5H18",key:"lmptdp"}],["path",{d:"M4 22h16",key:"57wxv0"}],["path",{d:"M10 14.66V17c0 .55-.47.98-.97 1.21C7.85 18.75 7 20.24 7 22",key:"1nw9bq"}],["path",{d:"M14 14.66V17c0 .55.47.98.97 1.21C16.15 18.75 17 20.24 17 22",key:"1np0yb"}],["path",{d:"M18 2H6v7a6 6 0 0 0 12 0V2Z",key:"u46fv3"}]]);e.s(["Trophy",()=>t],707224)},857668,e=>{"use strict";let t=(0,e.i(106576).default)("Minus",[["path",{d:"M5 12h14",key:"1ays0h"}]]);e.s(["Minus",()=>t],857668)},522564,e=>{"use strict";var t=e.i(97941);e.s(["Edit3",()=>t.default])},215698,e=>{"use strict";var t=e.i(625555),r=e.i(71708),a=e.i(665030),n=e.i(272727),l=e.i(494779),s=e.i(357628),i=e.i(577407),o=e.i(100567),c=e.i(815806),d=e.i(623443),u=e.i(436698),g=e.i(624761),m=e.i(179311),p=e.i(647163);let x=[{border:"border-blue-300",bg:"bg-blue-50",badge:"bg-blue-100 text-blue-700",dot:"bg-blue-400",ring:"ring-blue-300"},{border:"border-violet-300",bg:"bg-violet-50",badge:"bg-violet-100 text-violet-700",dot:"bg-violet-400",ring:"ring-violet-300"},{border:"border-emerald-300",bg:"bg-emerald-50",badge:"bg-emerald-100 text-emerald-700",dot:"bg-emerald-400",ring:"ring-emerald-300"},{border:"border-orange-300",bg:"bg-orange-50",badge:"bg-orange-100 text-orange-700",dot:"bg-orange-400",ring:"ring-orange-300"},{border:"border-pink-300",bg:"bg-pink-50",badge:"bg-pink-100 text-pink-700",dot:"bg-pink-400",ring:"ring-pink-300"},{border:"border-teal-300",bg:"bg-teal-50",badge:"bg-teal-100 text-teal-700",dot:"bg-teal-400",ring:"ring-teal-300"},{border:"border-rose-300",bg:"bg-rose-50",badge:"bg-rose-100 text-rose-700",dot:"bg-rose-400",ring:"ring-rose-300"},{border:"border-cyan-300",bg:"bg-cyan-50",badge:"bg-cyan-100 text-cyan-700",dot:"bg-cyan-400",ring:"ring-cyan-300"}];function h(){return Math.random().toString(36).slice(2,9)}function f({page:e,index:r,compact:a=!1,isDragging:n,onDragStart:l,onDragEnd:s,onRemove:i}){return(0,t.jsxs)("div",{draggable:!!l,onDragStart:e=>{e.dataTransfer.effectAllowed="move",l?.()},onDragEnd:s,className:(0,p.cn)("relative rounded-lg overflow-hidden border border-gray-200 bg-white shadow-sm select-none transition-all group",l&&"cursor-grab active:cursor-grabbing",a?"h-16 w-12 flex-shrink-0":"aspect-[3/4]",n&&"opacity-30 ring-2 ring-blue-400 scale-95"),children:[(0,t.jsx)("img",{src:e.url,alt:e.fileName,className:"w-full h-full object-cover",draggable:!1}),void 0!==r&&(0,t.jsx)("div",{className:"absolute bottom-0 inset-x-0 bg-black/50 text-white text-[9px] text-center py-0.5 font-medium",children:r}),i&&(0,t.jsx)("div",{className:"absolute inset-0 bg-black/0 group-hover:bg-black/20 transition-colors flex items-center justify-center",children:(0,t.jsx)("button",{onClick:e=>{e.stopPropagation(),i()},className:"opacity-0 group-hover:opacity-100 p-1.5 bg-white rounded-full shadow-md hover:bg-red-50 transition-all",children:(0,t.jsx)(u.Trash2,{className:"w-3 h-3 text-red-500"})})})]})}function b({stack:e,stackPages:n,isDragOver:s,draggedPageId:i,onDragOver:o,onDragLeave:d,onDrop:u,onDragStart:g,onDragEnd:h,onRemove:b,onNameChange:y,mostPagesCount:v}){let[w,j]=(0,r.useState)(!1),N=x[e.colorIndex%x.length],k=n.length>0&&n.length<v-1;return(0,t.jsxs)("div",{className:(0,p.cn)("flex-shrink-0 w-36 sm:w-44 flex flex-col rounded-xl border-2 transition-all overflow-hidden",s?`${N.border} ${N.bg} ring-2 ${N.ring}`:"border-gray-200 bg-white hover:border-gray-300"),onDragOver:o,onDragLeave:d,onDrop:u,children:[(0,t.jsxs)("div",{className:(0,p.cn)("px-3 pt-3 pb-2 flex-shrink-0 border-b border-gray-100",s?N.bg:"bg-gray-50/70"),children:[(0,t.jsxs)("div",{className:"flex items-start justify-between mb-2",children:[(0,t.jsx)("div",{className:(0,p.cn)("w-2.5 h-2.5 rounded-full mt-0.5 flex-shrink-0",N.dot)}),(0,t.jsx)("button",{onClick:b,className:"p-0.5 rounded hover:bg-red-100 transition-colors ml-1",title:"Remove student",children:(0,t.jsx)(l.X,{className:"w-3 h-3 text-gray-300 hover:text-red-500 transition-colors"})})]}),w?(0,t.jsx)("input",{autoFocus:!0,defaultValue:e.name,onBlur:t=>{y(t.target.value||e.name),j(!1)},onKeyDown:e=>{"Enter"===e.key&&e.target.blur(),"Escape"===e.key&&j(!1)},className:"w-full text-sm font-semibold bg-transparent border-b-2 border-blue-400 outline-none text-gray-900 pb-0.5 mb-1"}):(0,t.jsx)("button",{onClick:()=>j(!0),className:"text-sm font-semibold text-gray-900 text-left w-full hover:text-blue-600 transition-colors truncate block mb-1",title:"Click to rename",children:e.name}),(0,t.jsxs)("div",{className:"flex items-center gap-1.5 flex-wrap",children:[(0,t.jsxs)("span",{className:(0,p.cn)("text-xs px-2 py-0.5 rounded-full font-medium",N.badge),
1children:[n.length," ",1===n.length?"page":"pages"]}),k&&(0,t.jsx)(c.AlertTriangle,{className:"w-3 h-3 text-orange-400","aria-label":"Fewer pages than other students"})]})]}),(0,t.jsxs)("div",{className:"flex-1 overflow-y-auto p-2 space-y-1.5 min-h-[140px]",children:[0===n.length&&!s&&(0,t.jsxs)("div",{className:"h-full flex flex-col items-center justify-center py-6 gap-1",children:[(0,t.jsx)(m.ImageIcon,{className:"w-5 h-5 text-gray-300"}),(0,t.jsx)("p",{className:"text-xs text-gray-400 text-center",children:"Drop pages here"})]}),n.map((e,r)=>(0,t.jsx)(f,{page:e,index:r+1,isDragging:i===e.id,onDragStart:()=>g(e.id),onDragEnd:h},e.id)),s&&i&&(0,t.jsx)(a.motion.div,{initial:{opacity:0,scale:.9},animate:{opacity:1,scale:1},className:(0,p.cn)("h-14 rounded-lg border-2 border-dashed flex items-center justify-center",N.border,N.bg),children:(0,t.jsx)("span",{className:"text-xs text-gray-400",children:"Release to add"})})]})]})}function y({pages:e,isDraggingOver:r,onDragOver:n,onDragLeave:l,onDrop:o,onBrowse:c,onAddMore:d,onRemovePage:u}){return(0,t.jsx)("div",{className:"flex-1 overflow-auto p-6 md:p-10",children:0===e.length?(0,t.jsxs)("div",{onDragOver:n,onDragLeave:l,onDrop:o,className:(0,p.cn)("h-full min-h-[420px] border-2 border-dashed rounded-2xl flex flex-col items-center justify-center p-10 transition-all duration-200",r?"border-blue-400 bg-blue-50 scale-[1.01]":"border-gray-200 bg-gray-50/50 hover:border-gray-300 hover:bg-gray-50"),children:[(0,t.jsx)(a.motion.div,{animate:{scale:r?1.1:1,y:r?-4:0},transition:{type:"spring",stiffness:300,damping:20},className:(0,p.cn)("w-20 h-20 rounded-2xl flex items-center justify-center mb-5 transition-colors",r?"bg-blue-100":"bg-gray-100"),children:(0,t.jsx)(s.Upload,{className:(0,p.cn)("w-9 h-9 transition-colors",r?"text-blue-500":"text-gray-400")})}),(0,t.jsx)("h3",{className:"text-xl font-semibold text-gray-800 mb-2",children:r?"Release to upload":"Drop all test pages here"}),(0,t.jsx)("p",{className:"text-gray-500 text-center max-w-xs mb-7 leading-relaxed",children:"Upload everything at once, in any order. You'll sort pages by student in the next step."}),(0,t.jsx)("button",{onClick:c,className:"px-7 py-3 bg-blue-600 text-white rounded-xl font-medium hover:bg-blue-700 active:bg-blue-800 transition-colors shadow-sm shadow-blue-200",children:"Browse files"}),(0,t.jsx)("p",{className:"text-xs text-gray-400 mt-3",children:"JPG, PNG, HEIC, WebP supported"})]}):(0,t.jsxs)("div",{children:[(0,t.jsxs)("div",{className:"flex items-center justify-between mb-5",children:[(0,t.jsxs)("div",{children:[(0,t.jsxs)("h3",{className:"font-semibold text-gray-900 text-lg",children:[e.length," pages uploaded"]}),(0,t.jsx)("p",{className:"text-sm text-gray-500 mt-0.5",children:"Ready to organize into student stacks"})]}),(0,t.jsxs)("button",{onClick:d,className:"flex items-center gap-1.5 px-4 py-2 text-sm font-medium text-blue-600 bg-blue-50 rounded-xl hover:bg-blue-100 transition-colors",children:[(0,t.jsx)(i.Plus,{className:"w-4 h-4"}),"Add more"]})]}),(0,t.jsx)("div",{onDragOver:n,onDragLeave:l,onDrop:o,className:(0,p.cn)("grid grid-cols-3 sm:grid-cols-5 md:grid-cols-7 lg:grid-cols-9 xl:grid-cols-11 gap-2.5 p-4 rounded-2xl transition-colors",r?"bg-blue-50 ring-2 ring-blue-300 ring-offset-1":"bg-gray-50"),children:e.map((e,r)=>(0,t.jsx)(a.motion.div,{initial:{opacity:0,scale:.7},animate:{opacity:1,scale:1},transition:{delay:Math.min(.025*r,.4),type:"spring",stiffness:400,damping:25},children:(0,t.jsx)(f,{page:e,onRemove:()=>u(e.id)})},e.id))})]})})}function v({unassignedPages:e,stacks:r,getStackPages:a,draggedPageId:n,dragOverTarget:l,onDragStart:s,onDragEnd:o,onDragOverTarget:u,onDropOnStack:g,onDropOnUnassigned:m,onAddStudent:x,onRemoveStudent:h,onUpdateStudentName:y}){let v=Math.max(...r.map(e=>a(e.id).length),1),w=e=>({onDragOver:t=>{t.preventDefault(),u(e)},onDragLeave:e=>{e.currentTarget.contains(e.relatedTarget)||u("")}});return(0,t.jsxs)("div",{className:"flex-1 overflow-hidden flex flex-col",children:[(0,t.jsxs)("div",{className:(0,p.cn)("border-b border-gray-200 px-4 pt-3 pb-3 flex-shrink-0 transition-colors","unassigned"===l?"bg-blue-50":"bg-gray-50/60"),...w("unassigned"),onDrop:e=>{e.preventDefault(),m()},children:[(0,t.jsxs)("div",{className:"flex items-center gap-2.5 mb-2.5",children:[(0,t.jsx)("span",{className:"text-sm font-semibold text-gray-700",children:"Unassigned pages"}),(0,t.jsx)("span",{className:"bg-gray-200 text-gray-600 text-xs font-medium px-2 py-0.5 rounded-full",children:e.length}),0===e.length&&(0,t.jsxs)("span",{className:"text-xs text-emerald-600 flex items-center gap-1 font-medium",children:[(0,t.jsx)(d.
1CheckCircle2,{className:"w-3.5 h-3.5"})," All assigned"]})]}),(0,t.jsx)("div",{className:"flex gap-2 overflow-x-auto pb-1 min-h-[68px] items-center",children:0===e.length?(0,t.jsx)("p",{className:"text-sm text-gray-400 italic w-full text-center py-2",children:"unassigned"===l?"Release to unassign":"Drag pages here to unassign them"}):e.map(e=>(0,t.jsx)(f,{page:e,compact:!0,isDragging:n===e.id,onDragStart:()=>s(e.id),onDragEnd:o},e.id))})]}),0===r.length&&(0,t.jsxs)("div",{className:"px-4 py-2 bg-amber-50 border-b border-amber-100 text-xs text-amber-700 flex items-center gap-2",children:[(0,t.jsx)(c.AlertTriangle,{className:"w-3.5 h-3.5 flex-shrink-0"}),"Add a student column below to start assigning pages"]}),(0,t.jsx)("div",{className:"flex-1 overflow-x-auto overflow-y-hidden",children:(0,t.jsxs)("div",{className:"flex gap-3 p-3 sm:gap-4 sm:p-4 h-full items-start",style:{minWidth:"max-content"},children:[r.map(e=>{let r=a(e.id);return(0,t.jsx)(b,{stack:e,stackPages:r,isDragOver:l===e.id,draggedPageId:n,mostPagesCount:v,...w(e.id),onDrop:t=>{t.preventDefault(),g(e.id)},onDragStart:s,onDragEnd:o,onRemove:()=>h(e.id),onNameChange:t=>y(e.id,t)},e.id)}),(0,t.jsxs)("button",{onClick:x,className:"flex-shrink-0 w-36 sm:w-44 min-h-[200px] border-2 border-dashed border-gray-200 rounded-xl flex flex-col items-center justify-center gap-2.5 text-gray-400 hover:border-blue-300 hover:text-blue-500 hover:bg-blue-50/40 transition-all",children:[(0,t.jsx)("div",{className:"w-9 h-9 rounded-full border-2 border-current flex items-center justify-center",children:(0,t.jsx)(i.Plus,{className:"w-4 h-4"})}),(0,t.jsx)("span",{className:"text-sm font-medium",children:"Add Student"})]})]})})]})}function w({stacks:e,getStackPages:r,unassignedPages:n}){let l=Math.max(...e.map(e=>r(e.id).length),1);return(0,t.jsxs)("div",{className:"flex-1 overflow-auto p-6 md:p-8",children:[n.length>0&&(0,t.jsxs)("div",{className:"mb-6 p-4 bg-orange-50 border border-orange-200 rounded-xl flex items-start gap-3",children:[(0,t.jsx)(c.AlertTriangle,{className:"w-5 h-5 text-orange-500 flex-shrink-0 mt-0.5"}),(0,t.jsxs)("div",{children:[(0,t.jsxs)("p",{className:"text-sm font-semibold text-orange-800",children:[n.length," unassigned ",1===n.length?"page":"pages"]}),(0,t.jsx)("p",{className:"text-sm text-orange-600 mt-0.5",children:"These pages won't be graded. Go back to assign them to a student."})]})]}),(0,t.jsx)("div",{className:"grid grid-cols-2 sm:grid-cols-3 lg:grid-cols-4 xl:grid-cols-5 gap-4",children:e.map(e=>{let n=r(e.id),s=x[e.colorIndex%x.length],i=n.length>0&&n.length<l-1,o=0===n.length;return(0,t.jsxs)(a.motion.div,{initial:{opacity:0,y:12},animate:{opacity:1,y:0},className:(0,p.cn)("rounded-xl border-2 overflow-hidden",s.border),children:[(0,t.jsxs)("div",{className:(0,p.cn)("p-3",s.bg),children:[(0,t.jsxs)("div",{className:"flex items-center gap-2 mb-1.5",children:[(0,t.jsx)("div",{className:(0,p.cn)("w-2.5 h-2.5 rounded-full flex-shrink-0",s.dot)}),(0,t.jsx)("h4",{className:"text-sm font-semibold text-gray-900 truncate flex-1",children:e.name})]}),(0,t.jsxs)("div",{className:"flex items-center gap-1.5 flex-wrap",children:[(0,t.jsxs)("span",{className:(0,p.cn)("text-xs px-2 py-0.5 rounded-full font-medium",s.badge),
1children:[n.length," ",1===n.length?"page":"pages"]}),o&&(0,t.jsx)("span",{className:"text-xs text-gray-400 italic",children:"No pages"}),i&&!o&&(0,t.jsxs)("span",{className:"text-xs text-orange-600 flex items-center gap-0.5 font-medium",children:[(0,t.jsx)(c.AlertTriangle,{className:"w-3 h-3"})," Short"]}),!i&&!o&&(0,t.jsxs)("span",{className:"text-xs text-emerald-600 flex items-center gap-0.5 font-medium",children:[(0,t.jsx)(d.CheckCircle2,{className:"w-3 h-3"})," Ready"]})]})]}),(0,t.jsx)("div",{className:"p-2 bg-white",children:0===n.length?(0,t.jsx)("div",{className:"h-16 flex items-center justify-center",children:(0,t.jsx)("p",{className:"text-xs text-gray-400 italic",children:"No pages assigned"})}):(0,t.jsxs)("div",{className:"grid grid-cols-4 gap-1",children:[n.slice(0,8).map(e=>(0,t.jsx)("div",{className:"aspect-[3/4] rounded overflow-hidden border border-gray-100",children:(0,t.jsx)("img",{src:e.url,alt:"",className:"w-full h-full object-cover"})},e.id)),n.length>8&&(0,t.jsx)("div",{className:"aspect-[3/4] rounded bg-gray-100 border border-gray-100 flex items-center justify-center",children:(0,t.jsxs)("span",{className:"text-[10px] text-gray-500 font-medium",children:["+",n.length-8]})})]})})]},e.id)})})]})}let j=[{key:"upload",label:"Upload"},{key:"organize",label:"Organize"},{key:"review",label:"Review"}];function N({current:e}){let r=j.findIndex(t=>t.key===e);return(0,t.jsx)("div",{className:"flex items-center gap-1",children:j.map(({key:a,label:n},l)=>{let s=l<r,i=a===e;return(0,t.jsxs)("div",{className:"flex items-center gap-1",children:[(0,t.jsxs)("div",{className:(0,p.cn)("flex items-center gap-1.5 px-3 py-1.5 rounded-full text-xs font-medium transition-all duration-200",i?"bg-blue-600 text-white shadow-sm":s?"bg-emerald-100 text-emerald-700":"bg-gray-100 text-gray-400"),children:[s?(0,t.jsx)(d.CheckCircle2,{className:"w-3 h-3"}):(0,t.jsx)("span",{className:"w-3.5 text-center",children:l+1}),(0,t.jsx)("span",{className:"hidden sm:inline",children:n})]}),l<j.length-1&&(0,t.jsx)("div",{className:(0,p.cn)("w-5 h-px transition-colors",s?"bg-emerald-300":"bg-gray-200")})]},a)})})}function k({open:e,onClose:s,assignmentTitle:i="Untitled Test",onStartGrading:c}){let[d,u]=(0,r.useState)("upload"),[m,x]=(0,r.useState)([]),[f,b]=(0,r.useState)([]),[j,k]=(0,r.useState)(null),[C,S]=(0,r.useState)(""),[T,E]=(0,r.useState)(!1),A=(0,r.useRef)(null),R=(0,r.useRef)(null);(0,r.useEffect)(()=>{if(!e){let e=setTimeout(()=>{u("upload"),m.forEach(e=>URL.revokeObjectURL(e.url)),x([]),b([]),k(null),S("")},300);return()=>clearTimeout(e)}},[e]);let D=(0,r.useCallback)(e=>{let t=Array.from(e).filter(e=>e.type.startsWith("image/"));x(e=>[...e,...t.map((t,r)=>({id:h(),url:URL.createObjectURL(t),fileName:t.name,assignedTo:null,positionInStack:e.length+r}))])},[]),L=(0,r.useCallback)((e,t)=>{x(r=>{let a=r.map(r=>r.id===e?{...r,assignedTo:t}:r);return t&&a.filter(e=>e.assignedTo===t).forEach((e,t)=>{let r=a.findIndex(t=>t.id===e.id);a[r]={...a[r],positionInStack:t}}),[...a]}),k(null),S("")},[]),U=(0,r.useCallback)(()=>{b(e=>[...e,{id:h(),name:`Student ${e.length+1}`,colorIndex:e.length}])},[]),I=(0,r.useCallback)(e=>{b(t=>t.filter(t=>t.id!==e)),x(t=>t.map(t=>t.assignedTo===e?{...t,assignedTo:null}:t))},[]),P=(0,r.useCallback)(e=>m.filter(t=>t.assignedTo===e).sort((e,t)=>e.positionInStack-t.positionInStack),[m]),O=m.filter(e=>null===e.assignedTo),M=m.length>0,G=f.length>0;return(0,t.jsx)(n.AnimatePresence,{children:e&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(a.motion.div,{initial:{opacity:0}
1,animate:{opacity:1},exit:{opacity:0},className:"fixed inset-0 z-40 bg-black/50 backdrop-blur-sm",onClick:s}),(0,t.jsxs)(a.motion.div,{initial:{opacity:0,scale:.97,y:8},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.97,y:8},transition:{type:"spring",stiffness:400,damping:30},className:"fixed inset-0 md:inset-4 lg:inset-8 z-50 flex flex-col bg-white md:rounded-2xl shadow-2xl overflow-hidden",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between px-5 py-4 border-b border-gray-200 bg-white flex-shrink-0",children:[(0,t.jsxs)("div",{className:"flex items-center gap-4 min-w-0",children:[(0,t.jsx)("button",{onClick:s,className:"p-2 rounded-lg hover:bg-gray-100 transition-colors flex-shrink-0","aria-label":"Close",children:(0,t.jsx)(l.X,{className:"w-4 h-4 text-gray-500"})}),(0,t.jsxs)("div",{className:"min-w-0",children:[(0,t.jsx)("h2",{className:"text-sm font-semibold text-gray-900 truncate",children:"Grade Tests"}),(0,t.jsx)("p",{className:"text-xs text-gray-400 truncate",children:i})]})]}),(0,t.jsx)(N,{current:d})]}),(0,t.jsx)("div",{className:"flex-1 overflow-hidden flex flex-col",children:(0,t.jsx)(n.AnimatePresence,{mode:"wait",children:(0,t.jsxs)(a.motion.div,{initial:{opacity:0,x:12},animate:{opacity:1,x:0},exit:{opacity:0,x:-12},transition:{duration:.18},className:"flex-1 overflow-hidden flex flex-col",children:["upload"===d&&(0,t.jsx)(y,{pages:m,isDraggingOver:T,onDragOver:e=>{e.preventDefault(),E(!0)},onDragLeave:()=>E(!1),onDrop:e=>{e.preventDefault(),E(!1),e.dataTransfer.files.length&&D(e.dataTransfer.files)},onBrowse:()=>A.current?.click(),onAddMore:()=>R.current?.click(),onRemovePage:e=>x(t=>{let r=t.find(t=>t.id===e);return r&&URL.revokeObjectURL(r.url),t.filter(t=>t.id!==e)})}),"organize"===d&&(0,t.jsx)(v,{unassignedPages:O,stacks:f,getStackPages:P,draggedPageId:j,dragOverTarget:C,onDragStart:e=>k(e),onDragEnd:()=>{k(null),S("")},onDragOverTarget:S,onDropOnStack:e=>j&&L(j,e),onDropOnUnassigned:()=>j&&L(j,null),onAddStudent:U,onRemoveStudent:I,onUpdateStudentName:(e,t)=>b(r=>r.map(r=>r.id===e?{...r,name:t}:r))}),"review"===d&&(0,t.jsx)(w,{stacks:f,getStackPages:P,unassignedPages:O})]},d)})}),(0,t.jsxs)("div",{className:"flex items-center justify-between px-5 py-4 border-t border-gray-200 bg-white flex-shrink-0",children:[(0,t.jsx)("button",{onClick:()=>{"organize"===d?u("upload"):"review"===d&&u("organize")},className:(0,p.cn)("px-4 py-2 text-sm font-medium text-gray-500 hover:text-gray-800 transition-colors rounded-lg hover:bg-gray-100","upload"===d&&"invisible pointer-events-none"),children:"← Back"}),(0,t.jsxs)("div",{className:"flex items-center gap-3",children:["upload"===d&&(0,t.jsxs)(t.Fragment,{children:[m.length>0&&(0,t.jsxs)("span",{className:"text-xs text-gray-400 hidden sm:block",children:[m.length," pages ready"]}),(0,t.jsxs)("button",{onClick:()=>{0===f.length&&U(),u("organize")},disabled:!M,className:"flex items-center gap-2 px-6 py-2.5 bg-blue-600 text-white text-sm font-medium rounded-xl hover:bg-blue-700 disabled:opacity-40 disabled:cursor-not-allowed transition-all shadow-sm",children:["Organize Pages",(0,t.jsx)(o.ChevronRight,{className:"w-4 h-4"})]})]}),"organize"===d&&(0,t.jsxs)("button",{onClick:()=>u("review"),disabled:!G,className:"flex items-center gap-2 px-6 py-2.5 bg-blue-600 text-white text-sm font-medium rounded-xl hover:bg-blue-700 disabled:opacity-40 disabled:cursor-not-allowed transition-all shadow-sm",children:["Review & Confirm",(0,t.jsx)(o.ChevronRight,{className:"w-4 h-4"})]}),"review"===d&&(0,t.jsxs)("button",{onClick:()=>{c?.(f,m),s()},disabled:0===f.filter(e=>P(e.id).length>0).length,className:"flex items-center gap-2 px-6 py-2.5 bg-blue-600 text-white text-sm font-medium rounded-xl hover:bg-blue-700 disabled:opacity-40 disabled:cursor-not-allowed transition-all shadow-sm",children:[(0,t.jsx)(g.Sparkles,{className:"w-4 h-4"}),"Start AI Grading"]})]})]}),(0,t.jsx)("input",{ref:A,type:"file",multiple:!0,accept:"image/*",className:"hidden",onChange:e=>{e.target.files&&(D(e.target.files),e.target.value="")}}),(0,t.jsx)("input",{ref:R,type:"file",multiple:!0,accept:"image/*",className:"hidden",onChange:e=>{e.target.files&&(D(e.target.files),e.target.value="")}})]})]})})}e.s(["default",()=>
1k])},289018,e=>{"use strict";let t=(0,e.i(106576).default)("TriangleAlert",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);e.s(["default",()=>t])},815806,e=>{"use strict";var t=e.i(289018);e.s(["AlertTriangle",()=>t.default])},408064,e=>{"use strict";let t=(0,e.i(106576).default)("GripVertical",[["circle",{cx:"9",cy:"12",r:"1",key:"1vctgf"}],["circle",{cx:"9",cy:"5",r:"1",key:"hp0tcf"}],["circle",{cx:"9",cy:"19",r:"1",key:"fkjjf6"}],["circle",{cx:"15",cy:"12",r:"1",key:"1tmaij"}],["circle",{cx:"15",cy:"5",r:"1",key:"19l28e"}],["circle",{cx:"15",cy:"19",r:"1",key:"f4zoj3"}]]);e.s(["GripVertical",()=>t],408064)},914955,e=>{"use strict";let t=(0,e.i(106576).default)("Paperclip",[["path",{d:"m21.44 11.05-9.19 9.19a6 6 0 0 1-8.49-8.49l8.57-8.57A4 4 0 1 1 18 8.84l-8.59 8.57a2 2 0 0 1-2.83-2.83l8.49-8.48",key:"1u3ebp"}]]);e.s(["Paperclip",()=>t],914955)},728231,e=>{"use strict";var t=e.i(625555),r=e.i(71708),a=e.i(291967),n=e.i(144646),l=e.i(28388),s=e.i(504133),i=e.i(476791),o=e.i(407721),c=(e.i(279959),e.i(178690)),d=e.i(383628),u=e.i(417785),g=e.i(10293),m=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),p=r.forwardRef((e,r)=>(0,t.jsx)(d.Primitive.span,{...e,ref:r,style:{...m,...e.style}}));p.displayName="VisuallyHidden";var[x,h]=(0,l.createContextScope)("Tooltip",[o.createPopperScope]),f=(0,o.createPopperScope)(),b="TooltipProvider",y="tooltip.open",[v,w]=x(b),j=e=>{let{__scopeTooltip:a,delayDuration:n=700,skipDelayDuration:l=300,disableHoverableContent:s=!1,children:i}=e,o=r.useRef(!0),c=r.useRef(!1),d=r.useRef(0);return r.useEffect(()=>{let e=d.current;return()=>window.clearTimeout(e)},[]),(0,t.jsx)(v,{scope:a,isOpenDelayedRef:o,delayDuration:n,onOpen:r.useCallback(()=>{window.clearTimeout(d.current),o.current=!1},[]),onClose:r.useCallback(()=>{window.clearTimeout(d.current),d.current=window.setTimeout(()=>o.current=!0,l)},[l]),isPointerInTransitRef:c,onPointerInTransitChange:r.useCallback(e=>{c.current=e},[]),disableHoverableContent:s,children:i})};j.displayName=b;var N="Tooltip",[k,C]=x(N),S=e=>{let{__scopeTooltip:a,children:n,open:l,defaultOpen:s,onOpenChange:c,disableHoverableContent:d,delayDuration:u}=e,m=w(N,e.__scopeTooltip),p=f(a),[x,h]=r.useState(null),b=(0,i.useId)(),v=r.useRef(0),j=d??m.disableHoverableContent,C=u??m.delayDuration,S=r.useRef(!1),[T,E]=(0,g.useControllableState)({prop:l,defaultProp:s??!1,onChange:e=>{e?(m.onOpen(),document.dispatchEvent(new CustomEvent(y))):m.onClose(),c?.(e)},caller:N}),A=r.useMemo(()=>T?S.current?"delayed-open":"instant-open":"closed",[T]),R=r.useCallback(()=>{window.clearTimeout(v.current),v.current=0,S.current=!1,E(!0)},[E]),D=r.useCallback(()=>{window.clearTimeout(v.current),v.current=0,E(!1)},[E]),L=r.useCallback(()=>{window.clearTimeout(v.current),v.current=window.setTimeout(()=>{S.current=!0,E(!0),v.current=0},C)},[C,E]);return r.useEffect(()=>()=>{v.current&&(window.clearTimeout(v.current),v.current=0)},[]),(0,t.jsx)(o.Root,{...p,children:(0,t.jsx)(k,{scope:a,contentId:b,open:T,stateAttribute:A,trigger:x,onTriggerChange:h,onTriggerEnter:r.useCallback(()=>{m.isOpenDelayedRef.current?L():R()},[m.isOpenDelayedRef,L,R]),onTriggerLeave:r.useCallback(()=>{j?D():(window.clearTimeout(v.current),v.current=0)},[D,j]),onOpen:R,onClose:D,disableHoverableContent:j,children:n})})};S.displayName=N;var T="TooltipTrigger",E=r.forwardRef((e,l)=>{let{__scopeTooltip:s,...i}=e,c=C(T,s),u=w(T,s),g=f(s),m=r.useRef(null),p=(0,n.useComposedRefs)(l,m,c.onTriggerChange),x=r.useRef(!1),h=r.useRef(!1),b=r.useCallback(()=>x.current=!1,[]);return r.useEffect(()=>()=>document.removeEventListener("pointerup",b),[b]),(0,t.jsx)(o.Anchor,{asChild:!0,...g,children:(0,t.jsx)(d.Primitive.button,{"aria-describedby":c.open?c.contentId:void 0,"data-state":c.stateAttribute,...i,ref:p,onPointerMove:(0,a.composeEventHandlers)(e.onPointerMove,e=>{"touch"!==e.pointerType&&(h.current||u.isPointerInTransitRef.current||(c.onTriggerEnter(),h.current=!0))}),onPointerLeave:(0,a.composeEventHandlers)(e.onPointerLeave,()=>{c.onTriggerLeave(),h.current=!1}),onPointerDown:(0,a.composeEventHandlers)(e.onPointerDown,()=>{c.open&&c.onClose(),x.current=!0,document.addEventListener("pointerup",b,{once:!0})}),onFocus:(0,a.composeEventHandlers)(e.onFocus,()=>{x.current||c.onOpen()}),onBlur:(0,a.composeEventHandlers)(e.onBlur,c.onClose),onClick:(0,a.composeEventHandlers)(e.onClick,c.onClose)})})});E.displayName=T;var[A,R]=x("TooltipPortal",{forceMount:void 0}),D="TooltipContent",L=r.forwardRef((e,r)=>{let a=R(D,e.__scopeTooltip),{forceMount:n=a.forceMount,side:l="top",...s}=e,i=C(D,e.__scopeTooltip);return(0,t.jsx)(c.Presence,{present:n||i.open,children:i.disableHoverableContent?(0,t.jsx)(M,{side:l,...s,ref:r}):(0,t.jsx)(U,{side:l,...s,ref:r})})}),U=r.forwardRef((e,a)=>{let l=C(D,e.__scopeTooltip),s=w(D,e.__scopeTooltip),i=r.useRef(null),o=(0,n.useComposedRefs)(a,i),[c,d]=r.useState(null),{trigger:u,onClose:g}=l,m=i.current,{onPointerInTransitChange:p}=s,x=r.useCallback(()=>{d(null),p(!1)},[p]),h=r.useCallback((e,t)=>{let r,a=e.currentTarget,n={x:e.clientX,y:e.clientY},l=function(e,t){let r=Math.abs(t.top-e.y),a=Math.abs(t.bottom-e.y),n=Math.abs(t.right-e.x),l=Math.abs(t.left-e.x);switch(Math.min(r,a,n,l)){case l:return"left";case n:return"right";case r:return"top";case a:return"bottom";default:throw Error("unreachable")}}(n,a.getBoundingClientRect());d(((r=[...function(e,t,r=5){let a=[];switch(t){case"top":a.push({x:e.x-r,y:e.y+r},{x:e.x+r,y:e.y+r});break;case"bottom":a.push({x:e.x-r,y:e.y-r},{x:e.x+r,y:e.y-r});break;case"left":a.push({x:e.x+r,y:e.y-r},{x:e.x+r,y:e.y+r});break;case"right":a.push({x:e.x-r,y:e.y-r},{x:e.x-r,y:e.y+r})}return a}
1(n,l),...function(e){let{top:t,right:r,bottom:a,left:n}=e;return[{x:n,y:t},{x:r,y:t},{x:r,y:a},{x:n,y:a}]}(t.getBoundingClientRect())].slice()).sort((e,t)=>e.x<t.x?-1:e.x>t.x?1:e.y<t.y?-1:1*!!(e.y>t.y)),function(e){if(e.length<=1)return e.slice();let t=[];for(let r=0;r<e.length;r++){let a=e[r];for(;t.length>=2;){let e=t[t.length-1],r=t[t.length-2];if((e.x-r.x)*(a.y-r.y)>=(e.y-r.y)*(a.x-r.x))t.pop();else break}t.push(a)}t.pop();let r=[];for(let t=e.length-1;t>=0;t--){let a=e[t];for(;r.length>=2;){let e=r[r.length-1],t=r[r.length-2];if((e.x-t.x)*(a.y-t.y)>=(e.y-t.y)*(a.x-t.x))r.pop();else break}r.push(a)}return(r.pop(),1===t.length&&1===r.length&&t[0].x===r[0].x&&t[0].y===r[0].y)?t:t.concat(r)}(r))),p(!0)},[p]);return r.useEffect(()=>()=>x(),[x]),r.useEffect(()=>{if(u&&m){let e=e=>h(e,m),t=e=>h(e,u);return u.addEventListener("pointerleave",e),m.addEventListener("pointerleave",t),()=>{u.removeEventListener("pointerleave",e),m.removeEventListener("pointerleave",t)}}},[u,m,h,x]),r.useEffect(()=>{if(c){let e=e=>{let t=e.target,r={x:e.clientX,y:e.clientY},a=u?.contains(t)||m?.contains(t),n=!function(e,t){let{x:r,y:a}=e,n=!1;for(let e=0,l=t.length-1;e<t.length;l=e++){let s=t[e],i=t[l],o=s.x,c=s.y,d=i.x,u=i.y;c>a!=u>a&&r<(d-o)*(a-c)/(u-c)+o&&(n=!n)}return n}(r,c);a?x():n&&(x(),g())};return document.addEventListener("pointermove",e),()=>document.removeEventListener("pointermove",e)}},[u,m,c,g,x]),(0,t.jsx)(M,{...e,ref:o})}),[I,P]=x(N,{isInside:!1}),O=(0,u.createSlottable)("TooltipContent"),M=r.forwardRef((e,a)=>{let{__scopeTooltip:n,children:l,"aria-label":i,onEscapeKeyDown:c,onPointerDownOutside:d,...u}=e,g=C(D,n),m=f(n),{onClose:x}=g;return r.useEffect(()=>(document.addEventListener(y,x),()=>document.removeEventListener(y,x)),[x]),r.useEffect(()=>{if(g.trigger){let e=e=>{let t=e.target;t?.contains(g.trigger)&&x()};return window.addEventListener("scroll",e,{capture:!0}),()=>window.removeEventListener("scroll",e,{capture:!0})}},[g.trigger,x]),(0,t.jsx)(s.DismissableLayer,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:c,onPointerDownOutside:d,onFocusOutside:e=>e.preventDefault(),onDismiss:x,children:(0,t.jsxs)(o.Content,{"data-state":g.stateAttribute,...m,...u,ref:a,style:{...u.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"},children:[(0,t.jsx)(O,{children:l}),(0,t.jsx)(I,{scope:n,isInside:!0,children:(0,t.jsx)(p,{id:g.contentId,role:"tooltip",children:i||l})})]})})});L.displayName=D;var G="TooltipArrow";r.forwardRef((e,r)=>{let{__scopeTooltip:a,...n}=e,l=f(a);return P(G,a).isInside?null:(0,t.jsx)(o.Arrow,{...l,...n,ref:r})}).displayName=G;var _=e.i(647163);let z=r.forwardRef(({className:e,sideOffset:r=4,...a},n)=>(0,t.jsx)(L,{ref:n,sideOffset:r,className:(0,_.cn)("z-50 overflow-hidden rounded-md border bg-popover px-3 py-1.5 text-sm text-popover-foreground shadow-md animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...a}));z.displayName=L.displayName,e.s(["Tooltip",()=>S,"TooltipContent",()=>z,"TooltipProvider",()=>j,"TooltipTrigger",()=>E],728231)},540974,e=>{"use strict";let t={female:"el-GR-AthinaNeural",male:"el-GR-NestorasNeural"};t.female;let r=/[Ͱ-Ͽἀ-῿]/,a=/[A-Za-zÀ-ɏ]/;function n(e){let t=0,n=0;for(let l of e)r.test(l)?t++:a.test(l)&&n++;return t>n?"el":"en"}e.s(["DEFAULT_EDGE_VOICE",0,"en-US-AvaNeural","EDGE_VOICES",0,[{id:"en-US-AvaNeural",label:"Ava (US, female, warm)",locale:"en-US",gender:"female"},{id:"en-US-AndrewNeural",label:"Andrew (US, male, warm)",locale:"en-US",gender:"male"},{id:"en-US-EmmaNeural",label:"Emma (US, female, friendly)",locale:"en-US",gender:"female"},{id:"en-US-BrianNeural",label:"Brian (US, male, conversational)",locale:"en-US",gender:"male"},{id:"en-US-JennyNeural",label:"Jenny (US, female, assistant)",locale:"en-US",gender:"female"},{id:"en-US-GuyNeural",label:"Guy (US, male, news anchor)",locale:"en-US",gender:"male"},{id:"en-GB-SoniaNeural",label:"Sonia (UK, female)",locale:"en-GB",gender:"female"},{id:"en-GB-RyanNeural",label:"Ryan (UK, male)",locale:"en-GB",gender:"male"},{id:"en-IE-EmilyNeural",label:"Emily (Ireland, female)",locale:"en-IE",gender:"female"},{id:"en-IE-ConnorNeural",label:"Connor (Ireland, male)",locale:"en-IE",gender:"male"},{id:"en-AU-NatashaNeural",label:"Natasha (Australia, female)",locale:"en-AU",gender:"female"},{id:"en-AU-WilliamNeural",label:"William (Australia, male)",locale:"en-AU",gender:"male"},{id:"en-IN-NeerjaNeural",label:"Neerja (India, female)",locale:"en-IN",gender:"female"},{id:"en-IN-PrabhatNeural",label:"Prabhat (India, male)",locale:"en-IN",gender:"male"},{id:"el-GR-AthinaNeural",label:"Αθηνά (Greece, female)",locale:"el-GR",gender:"female"},{id:"el-GR-NestorasNeural",label:"Νέστορας (Greece, male)",locale:"el-GR",gender:"male"}],"GREEK_VOICES",0,t,"detectLang",()=>n])},179311,e=>{"use strict";var t=e.i(527366);e.s(["ImageIcon",()=>t.default])},527366,e=>{"use strict";let t=(0,e.i(106576).default)("Image",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]]);e.s(["default",()=>t])},357628,e=>{"use strict";let t=(0,e.i(106576).default)("Upload",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"17 8 12 3 7 8",key:"t8dd8p"}],["line",{x1:"12",x2:"12",y1:"3",y2:"15",key:"widbto"}]]);e.s(["Upload",()=>t],357628)},810649,941628,34182,e=>{"use strict";let t=(0,e.i(106576).default)("CircleX",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]]);e.s(["XCircle",()=>t],810649);var r=e.i(71708),a=e.i(540974);function n(e){return e.replace(/```[\s\S]*?```/g," ").replace(/`[^`]*`/g," ").replace(/!\[[^\]]*]\([^)]*\)/g," ").replace(/\[([^\]]*)\]\([^)]*\)/g,"$1").replace(/\*\*([^*]*)\*\*/g,"$1").replace(/\*([^*]*)\*/g,"$1").replace(/__([^_]*)__/g,"$1").replace(/_([^_]*)_/g,"$1").replace(/~~([^~]*)~~/g,"$1").replace(/^#{1,6}\s+/gm,"").replace(/^>\s?/gm,"").replace(/^\s*[-*+]\s+/gm,"").replace(/^\s*\d+\.\s+/gm,"").replace(/^\s*\|?\s*:?-{3,}:?(\s*\|\s*:?-{3,}:?)*\s*\|?\s*$/gm," ").replace(/\|/g," ").replace(/[<>]/g," ").replace(/\s+/g," ").trim()}function l(e,t){return e.replace(/_/g,"-").toLowerCase()===t.replace(/_/g,"-").toLowerCase()}function s(e){return/microsoft/i.test(e.name)&&/(natural|online)/i.test(e.name)}
1function i(e=1e3){return new Promise(t=>{if(!window.speechSynthesis)return t([]);let r=window.speechSynthesis.getVoices();if(r.length>0)return t(r);let a=!1,n=()=>{a||(a=!0,window.speechSynthesis.removeEventListener("voiceschanged",n),t(window.speechSynthesis.getVoices()))};window.speechSynthesis.addEventListener("voiceschanged",n),setTimeout(n,e)})}function o(e,t){let r,a,n,{lang:i,base:o,person:c}=(a=(r=t.split("-")).slice(0,2).join("-"),n=(r[0]??a).toLowerCase(),{lang:a,base:n,person:(r[2]??"").replace(/Neural$/i,"").toLowerCase()}),d=e.filter(s);return d.find(e=>l(e.lang,i)&&e.name.toLowerCase().includes(c))??d.find(e=>l(e.lang,i))??d.find(e=>e.lang.toLowerCase().startsWith(o))??null}let c=/[Ͱ-Ͽἀ-῿]/g,d=/[\p{L}]/gu,u=new Map;function g(e={}){let t=e.voice??a.DEFAULT_EDGE_VOICE,l=a.GREEK_VOICES[e.greekVoice??"female"],[s,m]=(0,r.useState)("idle"),[p,x]=(0,r.useState)(null),[h,f]=(0,r.useState)(-1),[b,y]=(0,r.useState)(""),[v,w]=(0,r.useState)(-1),[j,N]=(0,r.useState)(""),[k,C]=(0,r.useState)(null),[S,T]=(0,r.useState)({ttftMs:null,generateMs:null,audioDurationS:null,charCount:null,charsPerSec:null,rtf:null}),E=(0,r.useRef)(null),A=(0,r.useRef)(null),R=(0,r.useRef)(null),D=(0,r.useRef)(null),L=(0,r.useRef)([]),U=(0,r.useRef)(0),I=(0,r.useRef)(t);I.current=t;let P=(0,r.useRef)(l);P.current=l;let O=(0,r.useCallback)(e=>!function(e){let t=e.match(c)?.length??0;if(0===t)return!1;let r=e.match(d)?.length??0;return 0!==r&&(!(t<3)||t===r)&&t/r>.3}(e)?I.current:P.current,[]),M=(0,r.useCallback)(()=>{f(-1),y(""),w(-1),N(""),L.current=[]},[]),G=(0,r.useCallback)(async()=>{if(!A.current){let e=new Audio;e.preload="auto",A.current=e}try{A.current.src="data:audio/wav;base64,UklGRiQAAABXQVZFZm10IBAAAAABAAEAgD4AAAB9AAACABAAZGF0YQAAAAA=",await A.current.play(),A.current.pause()}catch{}window.speechSynthesis?await i():await i(0),m("ready")},[]),_=(0,r.useCallback)(()=>{U.current+=1,null!==R.current&&(cancelAnimationFrame(R.current),R.current=null),D.current?.abort(),D.current=null,window.speechSynthesis&&window.speechSynthesis.cancel(),E.current=null,A.current&&(A.current.pause(),A.current.onended=null,A.current.onerror=null)},[]),z=(0,r.useCallback)(()=>{_(),M(),m(e=>"speaking"===e||"loading"===e?"ready":e)},[_,M]);(0,r.useEffect)(()=>()=>{null!==R.current&&cancelAnimationFrame(R.current),D.current?.abort(),window.speechSynthesis&&window.speechSynthesis.cancel(),A.current?.pause()},[]);let B=(0,r.useCallback)((e,t,r,a)=>{window.speechSynthesis.cancel();let n=new SpeechSynthesisUtterance(e);E.current=n,r&&(n.voice=r,n.lang=r.lang),n.rate=1,n.pitch=1,n.onboundary=r=>{if(U.current===a&&"word"===r.name){let a=e.slice(0,r.charIndex).split(/\s+/).filter(Boolean).length;f(a),y((t[a]??"").toLowerCase()),w(r.charIndex)}},n.onend=()=>{U.current===a&&(M(),m("ready"))},n.onerror=e=>{U.current===a&&("canceled"!==e.error&&"interrupted"!==e.error&&x(e.error),M(),m("ready"))},C("browser"),N(e),m("speaking"),f(0),y((t[0]??"").toLowerCase()),w(0),window.speechSynthesis.speak(n)},[M]),F=(0,r.useCallback)(async(e,t,r,a)=>{let n,l,s,i=`${a}::${e}`,o=u.get(i);m("loading");let c=performance.now(),d=o,g=null;if(!d){let t=new AbortController;D.current=t;try{let n=await fetch("/api/tts/edge",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({text:e,voice:a}),signal:t.signal});if(!n.ok){let e=await n.json().catch(()=>null);throw Error(e?.error||`Edge TTS failed (${n.status})`)}let l=await n.blob();if(U.current!==r)return!0;g=performance.now()-c;var p=d=URL.createObjectURL(l);for(u.set(i,p);u.size>24;){let e=u.keys().next().value;if(void 0===e)break;let t=u.get(e);u.delete(e),t&&URL.revokeObjectURL(t)}}catch(e){if(t.signal.aborted||U.current!==r)return!0;return x(e instanceof Error?e.message:"Edge TTS failed"),!1}finally{D.current===t&&(D.current=null)}}if(U.current!==r)return!0;A.current||(A.current=new Audio);let h=A.current;h.src=d,h.currentTime=0,C("server"),N(e),f(0),y((t[0]??"").toLowerCase()),w(0);let b=[],v=0;for(let r of t){let t=e.indexOf(r,v);b.push(-1===t?v:t),v=(-1===t?v:t)+r.length}let j=[],k=()=>{if(U.current!==r)return;let e=h.currentTime,a=0;for(;a+1<j.length&&(j[a+1]??1/0)<=e;)a++;f(a),y((t[a]??"").toLowerCase()),w(b[a]??0),R.current=requestAnimationFrame(k)};h.onended=()=>{U.current===r&&(null!==R.current&&cancelAnimationFrame(R.current),R.current=null,M(),m("ready"))},h.onerror=()=>{U.current===r&&(null!==R.current&&cancelAnimationFrame(R.current),R.current=null,x("Audio playback failed"),M(),m("ready"))};try{await h.play()}catch(e){if(U.current!==r)return!0;return x(e instanceof Error?e.message:"Audio playback blocked"),!1}if(U.current!==r)return!0;let S=Number.isFinite(h.duration)&&h.duration>0?h.duration:e.length/15;l=(n=t.map(e=>e.length+1)).reduce((e,t)=>
1e+t,0)||1,s=0,j=n.map(e=>{let t=s/l*S;return s+=e,t});let E=performance.now()-c;return T({ttftMs:g,generateMs:E,audioDurationS:S,charCount:e.length,charsPerSec:e.length/(E/1e3),rtf:E/1e3/S}),m("speaking"),R.current=requestAnimationFrame(k),!0},[M]);return{status:s,isSpeaking:"speaking"===s,isReady:"ready"===s||"idle"===s,isLoading:"loading"===s,error:p,loadProgress:100,metrics:S,currentWordIndex:h,currentWord:b,currentCharIndex:v,spokenText:j,engine:k,speak:(0,r.useCallback)(async e=>{let t=n(e);if(!t)return;_(),x(null);let r=U.current,a=t.split(/\s+/).filter(Boolean);L.current=a;let l=O(t),s=window.speechSynthesis,c=s?await i():[];if(U.current!==r)return;let d=o(c,l);s&&d?B(t,a,d,r):await F(t,a,r,l)||U.current!==r||(M(),m("error"))},[_,B,F,M,O]),speakWord:(0,r.useCallback)(async e=>{let t=e.trim();if(!t)return;_(),x(null);let r=U.current,a=window.speechSynthesis,n=a?await i():[];if(U.current!==r)return;let l=O(t),s=o(n,l);if(a&&s){let e=new SpeechSynthesisUtterance(t);E.current=e,e.voice=s,e.lang=s.lang,e.rate=.9,e.onend=()=>{U.current===r&&m("ready")},e.onerror=()=>{U.current===r&&m("ready")},C("browser"),m("speaking"),a.speak(e);return}await F(t,[t],r,l)||U.current!==r||m("error")},[_,F,O]),stop:z,init:G}}e.s(["cleanMarkdown",()=>n,"useNativeTTS",()=>g],941628);var m=e.i(625555),p=e.i(728231);function x({open:e,children:t,side:a="right",defaultWidth:n=320,minWidth:l=260,maxWidth:s=700,storageKey:i,tooltip:o,className:c}){let[d,u]=(0,r.useState)(n);(0,r.useEffect)(()=>{if(!i)return;let e=Number.parseInt(localStorage.getItem(i)??"",10);Number.isFinite(e)&&u(Math.max(l,Math.min(s,e)))},[i,l,s]);let g=(0,r.useRef)(null),x=(0,r.useCallback)(e=>{e.preventDefault(),g.current={startX:e.clientX,startW:d},document.body.style.userSelect="none",document.body.style.cursor="col-resize";let t=e=>{if(!g.current)return;let t="right"===a?g.current.startX-e.clientX:e.clientX-g.current.startX,r=Math.max(l,Math.min(s,g.current.startW+t));u(r),i&&localStorage.setItem(i,String(r))},r=()=>{g.current=null,document.body.style.userSelect="",document.body.style.cursor="",document.removeEventListener("pointermove",t),document.removeEventListener("pointerup",r)};document.addEventListener("pointermove",t),document.addEventListener("pointerup",r)},[d,a,l,s,i]);if(!e)return null;let h=(0,m.jsx)("div",{onPointerDown:x,className:`absolute inset-y-0 z-20 flex w-3 cursor-col-resize items-center justify-center transition-colors hover:bg-blue-50 active:bg-blue-100 dark:hover:bg-blue-500/10 dark:active:bg-blue-500/20 ${"right"===a?"left-0 -translate-x-1/2":"right-0 translate-x-1/2"} group`,children:(0,m.jsx)("div",{className:"w-0.5 h-8 rounded-full bg-gray-300 group-hover:bg-blue-400 group-active:bg-blue-500 transition-colors"})}),f=o?(0,m.jsx)(p.TooltipProvider,{delayDuration:400,children:(0,m.jsxs)(p.Tooltip,{children:[(0,m.jsx)(p.TooltipTrigger,{asChild:!0,children:h}),(0,m.jsx)(p.TooltipContent,{side:"right"===a?"left":"right",className:"text-xs",children:o})]})}):h;return(0,m.jsxs)("div",{style:{width:d},className:`relative h-full shrink-0 ${c??""}`,children:[t,f]})}e.s(["ResizableSidebar",()=>x],34182)}]);

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.