PageSourceSearch

https://edupark.ai/static/js/5161.b09d4047.chunk.js

js edupark.ai collected 2026-10-05 12:14:34 UTC 56,447 bytes, 55 lines download raw bytes

1/*! For license information please see 5161.b09d4047.chunk.js.LICENSE.txt */
2"use strict";(globalThis.webpackChunkedupark_client||=[]).push([[5161],{58679(e,t,s){var n=s(58878),r=s(71813),i=s(1060),a=s(19765),l=s(81676),d=s(98639),o=s(90782);const c=["exam_type","exam_section","subject","topic","subtopic","concept","passage_type","general"],m=a.J1`
3  query GetTags($type: String, $search: String, $is_public: Boolean) {
4    getTags(type: $type, search: $search, is_public: $is_public) {
5      id
6      type
7      name
8      description
9      is_public
10      parent_tag_id
11      parent_tag {
12        id
13        type
14        name
15        description
16        is_public
17        parent_tag_id
18        parent_tag {
19          id
20          type
21          name
22          description
23          is_public
24          parent_tag_id
25          parent_tag {
26            id
27            type
28            name
29            description
30            is_public
31            parent_tag_id
32            parent_tag {
33              id
34              type
35              name
36              description
37              is_public
38              parent_tag_id
39            }
40          }
41        }
42      }
43    }
44  }
45`,x=e=>{let{selectedTagIds:t,onTagIdsChange:s,onSelectedTagsChange:a,className:x="",placeholder:u,maxTags:p,publicOnly:h=!1,defaultAddParentTags:f=!0,allowedTypes:b,examTypeId:g,organizationId:y}=e;const{t:v}=(0,r.B)(),[j,N]=(0,n.useState)(""),[w,k]=(0,n.useState)(!1),[C,S]=(0,n.useState)([]),[E,T]=(0,n.use
45State)(f),{data:I}=(0,i.IT)(m,{...(0,d.X)("session"),variables:{is_public:!!h||void 0,examTypeId:g||void 0}}),{data:A,loading:R}=(0,i.IT)(m,{...(0,d.X)("session"),variables:{search:j||void 0,is_public:!!h||void 0,examTypeId:g||void 0},skip:!w}),L=(0,n.useMemo)(()=>(null===A||void 0===A?void 0:A.getTags)||[],[A]);(0,n.useEffect)(()=>{const e=[...(null===I||void 0===I?void 0:I.getTags)||[],...(null===A||void 0===A?void 0:A.getTags)||[]];e.length>0&&S(t=>{const s=e.filter(e=>!t.some(t=>t.id===e.id));return[...t,...s]})},[I,A]);const _=(0,n.useMemo)(()=>C.filter(e=>t.includes(e.id)),[C,t]);(0,n.useEffect)(()=>{a&&a(_.map(e=>({id:e.id,type:e.type,name:e.name})))},[_,a]);const $=(0,n.useMemo)(()=>L.filter(e=>!t.includes(e.id)&&!(b&&b.length>0&&!b.includes(e.type))),[L,t,b]),q=(0,n.useMemo)(()=>{const e={};return $.forEach(t=>{e[t.type]||(e[t.type]=[]),e[t.type].push(t)}),e},[$]),z=(0,n.useMemo)(()=>(b&&b.length>0?c.filter(e=>b.includes(e)):c).filter(e=>q[e]&&q[e].length>0).map(e=>({type:e,tags:q[e]})),[q,b]);return(0,o.jsxs)("div",{className:`relative ${x}`,children:[t.length>0&&(0,o.jsx)("div",{className:"mb-2 flex flex-wrap gap-1",children:_.map(e=>(0,o.jsxs)("span",{className:`inline-flex items-center px-2 py-1 rounded-md text-sm ${(0,l.iY)(e.type)}`,children:[(0,o.jsx)("span",{className:"mr-1 text-xs bg-primary-200 px-1 rounded",children:(0,l.Fm)(e.type)}),e.name,(0,o.jsx)("button",{type:"button",onClick:()=>(e=>{const n=t.filter(t=>t!==e);s(n)})(e.id),className:"ml-1 text-primary-600 hover:text-primary-800",children:"\xd7"})]},e.id))}),(0,o.jsxs)("div",{className:"mb-2 flex items-center",children:[(0,o.jsx)("input",{type:"checkbox",id:"add-parent-tags",checked:E,onChange:e=>T(e.target.checked),className:"h-4 w-4 text-primary-600 rounded border-border-strong focus:ring-primary-500"}),(0,o.jsx)("label",{htmlFor:"add-parent-tags",className:"ml-2 text-sm text-text-muted",children:v("Add all parent tags automatically")})]}),(0,o.jsxs)("div",{className:"relative",children:[(0,o.jsx)("input",{type:"text",value:j,onChange:e=>{N(e.target.value),k(!0)},onFocus:()=>{k(!0)},onBlur:()=>{setTimeout(()=>k(!1),200)},placeholder:null!==u&&void 0!==u?u:v("Search and select tags..."),className:"w-full px-3 py-2 border border-border-strong rounded-md focus:outline-none focus:ring-2 focus:ring-primary-500 focus:border-transparent"}),(0,o.jsx)("div",{className:"absolute inset-y-0 right-0 flex items-center pr-3",children:(0,o.jsx)("svg",{className:"w-4 h-4 text-text-subtle transition-transform "+(w?"rotate-180":""),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,o.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})})]}),w&&(0,o.jsx)("div",{className:"absolute z-10 w-full mt-1 bg-surface-raised border border-border-strong rounded-md shadow-lg max-h-60 overflow-y-auto",children:R?(0,o.jsx)("div",{className:"px-3 py-2 text-text-subtle",children:v("Loading tags...")}):0===$.length?(0,o.jsx)("div",{className:"px-3 py-2 text-text-subtle",children:v(j?"No tags found":"Start typing to search tags")}):z.map(e=>{let{type:n,tags:r}=e;return(0,o.jsxs)("div",{children:[(0,o.jsx)("div",{className:"px-3 py-1 bg-surface-sunken text-xs font-semibold text-text-muted uppercase",children:(0,l.Fm)(n)}),r.map(e=>(0,o.jsx)("button",{type:"button",onClick:()=>(e=>{let n=[...t,e.id];if(E){const t=(e=>{const t=[];let s=e;for(;s&&s.parent_tag;){const e=s.parent_tag.id;t.includes(e)||t.push(e),s=s.parent_tag}return t})(e);t.forEach(e=>{n.includes(e)||n.push(e)})}p&&n.length>p&&(n=[...t,e.id]),s(n),N("")})(e),className:"w-full px-3 py-2 text-left hover:bg-surface-sunken focus:bg-surface-sunken focus:outline-none",disabled:!!p&&t.length>=p,children:(0,o.jsxs)("div",{className:"flex items-center justify-between",children:[(0,o.jsxs)("div",{children:[(0,o.jsx)("div",{className:"font-medium text-text",children:e.name}),e.description&&(0,o.jsx)("div",{className:"text-sm text-text-subtle",children:e.description})]}),!e.is_public&&(0,o.jsx)("span",{className:"text-xs bg-warning-100 text-warning-800 px-1 rounded",children:"Private"})]})},e.id))]},n)})}),p&&t.length>=p&&(0,o.jsxs)("div",{className:"mt-1 text-sm text-warning-600",children:["Maximum ",p," tags selected"]})]})};s.d(t,["A",0,x])},36009(e,t,s){s.d(t,{A:()=>h});var n=s(58878),r=s(1060),i=s(65852),a=s(94409),l=s(94731),d=s(4329),o=s(97307),c=s(98639),m=s(90782);const x=e=>{switch(e){case"ADMIN":return"bg-purple-100 text-purple-700";case"CONTENT_REVIEWER":return"bg-teal-100 text-teal-700";default:return"bg-surface-sunken text-text-muted"}},u=e=>{let{itemType:t,selectedIds:s,onClose:u,onAssigned:p}=e;
45const[h,f]=(0,n.useState)([]),[b,g]=(0,n.useState)(""),[y,v]=(0,n.useState)(""),[j,N]=(0,n.useState)(null),{data:w,loading:k}=(0,r.IT)(a.mn,{...(0,c.X)("session")}),C=(null===w||void 0===w?void 0:w.getContentReviewers)||[],[S,{loading:E,error:T}]=(0,i.n)(a.Jz,{update:e=>(0,l.jl)(e)}),I=(0,n.useMemo)(()=>`Assign ${s.length} item${1===s.length?"":"s"} to ${h.length} reviewer${1===h.length?"":"s"}`,[s.length,h.length]);return(0,m.jsx)(o.A,{children:(0,m.jsx)("div",{className:"fixed inset-0 z-[200] flex items-center justify-center bg-neutral-900/50 backdrop-blur-sm p-4",onClick:u,children:(0,m.jsxs)("div",{className:"bg-surface-raised rounded-lg shadow-xl w-full max-w-md max-h-[90vh] flex flex-col",onClick:e=>e.stopPropagation(),children:[(0,m.jsxs)("div",{className:"px-5 py-4 border-b border-border-subtle flex items-center justify-between",children:[(0,m.jsx)("h2",{className:"text-lg font-semibold text-text",children:"Assign for review"}),(0,m.jsx)("button",{onClick:u,className:"text-text-subtle hover:text-text-muted","aria-label":"Close",children:(0,m.jsx)("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,m.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),j?(0,m.jsxs)("div",{className:"px-5 py-6 flex-1 overflow-y-auto",children:[(0,m.jsxs)("div",{className:"rounded-lg bg-success-50 border border-success-200 p-4 text-sm text-success-800",children:[(0,m.jsxs)("div",{className:"font-medium",children:["Assigned ",j.createdCount," assignment",1===j.createdCount?"":"s","."]}),j.skippedCount>0&&(0,m.jsxs)("div",{className:"mt-1 text-success-700",children:[j.skippedCount," skipped (already open for that reviewer)."]})]}),(0,m.jsx)("div",{className:"mt-5 flex justify-end",children:(0,m.jsx)(d.$,{variant:"primary",size:"md",onClick:u,children:"Done"})})]}):(0,m.jsxs)(m.Fragment,{children:[(0,m.jsxs)("div",{className:"px-5 py-4 flex-1 overflow-y-auto space-y-4",children:[(0,m.jsxs)("div",{children:[(0,m.jsx)("label",{className:"block text-sm font-medium text-text-muted mb-2",children:"Reviewers"}),k&&0===C.length?(0,m.jsx)("div",{className:"text-sm text-text-subtle",children:"Loading reviewers\u2026"}):0===C.length?(0,m.jsx)("div",{className:"text-sm text-text-subtle",children:"No reviewers available."}):(0,m.jsx)("div",{className:"border border-border rounded-md divide-y divide-neutral-50 max-h-48 overflow-y-auto",children:C.map(e=>(0,m.jsxs)("label",{className:"flex items-center gap-3 px-3 py-2 hover:bg-surface-sunken cursor-pointer",children:[(0,m.jsx)("input",{type:"checkbox",checked:h.includes(e.id),onChange:()=>{return t=e.id,void f(e=>e.includes(t)?e.filter(e=>e!==t):[...e,t]);var t},className:"h-4 w-4 rounded border-border-strong text-primary-600 focus:ring-primary-500"}),(0,m.jsxs)("span",{className:"flex-1 min-w-0",children:[(0,m.jsx)("span",{className:"block text-sm text-text truncate",children:e.email}),e.displayName&&(0,m.jsx)("span",{className:"block text-xs text-text-subtle truncate",children:e.displayName})]}),(0,m.jsx)("span",{className:`px-1.5 py-0.5 rounded text-xs font-medium flex-shrink-0 ${x(e.type)}`,children:e.type})]},e.id))})]}),(0,m.jsxs)("div",{children:[(0,m.jsxs)("label",{className:"block text-sm font-medium text-text-muted mb-1",children:["Note ",(0,m.jsx)("span",{className:"text-text-subtle font-normal",children:"(optional)"})]}),(0,m.jsx)("textarea",{value:b,onChange:e=>g(e.target.value),rows:2,placeholder:"Context for the reviewer\u2026",className:"w-full text-sm border border-border-strong rounded-md px-3 py-2 outline-none focus:ring-1 focus:ring-primary-500"})]}),(0,m.jsxs)("div",{children:[(0,m.jsxs)("label",{className:"block text-sm font-medium text-text-muted mb-1",children:["Due date ",(0,m.jsx)("span",{className:"text-text-subtle font-normal",children:"(optional)"})]}),(0,m.jsx)("input",{type:"date",value:y,onChange:e=>v(e.target.value),className:"text-sm border border-border-strong rounded-md px-3 py-2 outline-none focus:ring-1 focus:ring-primary-500"})]}),(0,m.jsx)("div",{className:"text-sm font-medium text-text-muted",children:I}),T&&(0,m.jsxs)("div",{className:"text-sm text-error-600",children:["Failed to assign: ",T.message]})]}),(0,m.jsxs)("div",{className:"px-5 py-4 border-t border-border-subtle flex justify-end gap-2",children:[(0,m.jsx)("button",{onClick:u,className:"px-4 py-2 text-sm font-medium rounded-md bg-surface-sunken text-text-muted hover:bg-neutral-200",children:"Cancel"}),(0,m.jsx)(d.$,{variant:"primary",size:"md",onClick:async()=>{var e;if(0===h.length||0===s.length)return;const n=null===(e=(await S({variables:{input:{items:s.map(e=>({itemType:t,itemId:e})),reviewerIds:h,note:b.trim()||null,dueDate:y||null}}})).data)||void 0===e?void 0:e.assignContentForReview;n&&(N(n),p())},disabled:E||0===h.length||0===s.length,children:E?"Assigning\u2026":"Assign"})]})]})]})})})},p=()=>(0,m.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,"aria-hidden":"true",children:[(0,m.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M16 21v-2a4 4 0 00-4-4H6a4 4 0 00-4 4v2"}),(0,m.jsx)("circle",{cx:"9",cy:"7",r:"4"}),(0,m.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M16 11l2 2 4-4"})]}),h=e=>{let{itemType:t,selectedIds:s,onClearSelection:r,onSelectAll:i}=e;
45const[a,l]=(0,n.useState)(null);return(0,m.jsxs)(m.Fragment,{children:[s.length>0&&(0,m.jsx)("div",{className:"sticky bottom-4 z-40 mx-auto max-w-3xl px-3 sm:px-0",children:(0,m.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-3 rounded-2xl bg-surface-raised px-4 py-3 shadow-lg ring-1 ring-neutral-100",children:[(0,m.jsxs)("div",{className:"flex items-center gap-3",children:[(0,m.jsxs)("span",{className:"font-semibold text-text",children:[s.length," selected"]}),i&&(0,m.jsx)("button",{type:"button",onClick:i,className:"text-sm font-medium text-text-muted hover:text-text",children:"Select all"})]}),(0,m.jsxs)("div",{className:"flex items-center gap-2",children:[(0,m.jsx)(d.$,{variant:"outline",size:"sm",onClick:r,children:"Clear"}),(0,m.jsx)(d.$,{variant:"primary",size:"sm",leftIcon:(0,m.jsx)(p,{}),onClick:()=>l(s),children:"Assign to reviewer"})]})]})}),a&&(0,m.jsx)(u,{itemType:t,selectedIds:a,onClose:()=>l(null),onAssigned:r})]})}},16749(e,t,s){var n=s(58878),r=s(65852),i=s(1060),a=s(94409),l=s(5663),d=s(36961),o=s(94731),c=s(98639),m=s(68155),x=s(4329),u=s(56480),p=s(90782);const h=e=>{var t;let{itemType:s,itemId:h,compact:f=!1}=e;const{hasPermission:b}=(0,l.S)(),[g,y]=(0,n.useState)(""),[v,j]=(0,n.useState)(!1),[N,w]=(0,n.useState)(null),k=b(d.Jj.REVIEW_CONTENT),{data:C,loading:S}=(0,i.IT)(a.t0,{variables:{itemType:s,itemIds:[h]},...(0,c.X)("session"),skip:!k||!h}),[E,{loading:T}]=(0,r.n)(a.CX,{update:e=>(0,o.fp)(e)});if(!k||!h)return null;const I=(null===C||void 0===C||null===(t=C.getContentReviewStatuses)||void 0===t?void 0:t[0])||null,A="reviewed"===(null===I||void 0===I?void 0:I.status),R="flagged"===(null===I||void 0===I?void 0:I.status),L=async e=>{var t,n;const r=g||(("REVIEWED"===e&&A||"FLAGGED"===e&&R)&&null!==(t=null===I||void 0===I?void 0:I.notes)&&void 0!==t?t:null);w(null);const i=null===(n=(await E({variables:{itemType:s,itemId:h,status:e,notes:r}})).data)||void 0===n?void 0:n.markContentReviewed;i&&!1===i.success&&i.error?w(i.error):(y(""),j(!1))},_=A?(0,p.jsx)(u.E,{variant:"success",dot:!0,children:"\u2713 Reviewed"}):R?(0,p.jsx)(u.E,{variant:"warning",dot:!0,children:"\u2691 Flagged"}):(0,p.jsx)(u.E,{variant:"neutral",children:"Unreviewed"}),$=(0,p.jsxs)(p.Fragment,{children:[(0,p.jsxs)("div",{className:"flex items-center gap-2 flex-wrap",children:[_,S&&!I&&(0,p.jsx)("span",{className:"text-xs text-text-subtle",children:"\u2026"}),(0,p.jsx)(x.$,{type:"button",variant:"successSoft",size:"xs",disabled:T,onClick:()=>L("REVIEWED"),className:"min-h-[40px]",children:A?"Confirm reviewed":"Mark reviewed"}),(0,p.jsx)(x.$,{type:"button",variant:"destructiveSoft",size:"xs",disabled:T,onClick:()=>f||R?L("FLAGGED"):j(!0),className:"min-h-[40px]",children:R?"Confirm flag":"Flag"}),(A||R)&&(0,p.jsx)(x.$,{type:"button",variant:"outline",size:"xs",disabled:T,onClick:()=>L("UNREVIEWED"),className:"min-h-[40px]",children:"Clear"})]}),N&&(0,p.jsx)("p",{className:"mt-2 text-xs text-error-fg",children:N}),!f&&(null===I||void 0===I?void 0:I.notes)&&!v&&(0,p.jsxs)("p",{className:"mt-2 text-xs text-text-subtle",children:["Note: ",I.notes]}),!f&&v&&(0,p.jsxs)("div",{className:"mt-2 flex items-center gap-2",children:[(0,p.jsx)("input",{type:"text",value:g,onChange:e=>y(e.target.value),placeholder:"Why is this flagged? (optional)",className:"flex-1 px-2 py-1 text-xs border border-border-strong rounded-md focus:ring-1 focus:ring-warning-500 focus:border-warning-500 outline-none"}),(0,p.jsx)(x.$,{type:"button",variant:"destructiveSoft",size:"xs",disabled:T,onClick:()=>L("FLAGGED"),className:"min-h-[40px]",children:"Save flag"}),(0,p.jsx)(x.$,{type:"button",variant:"ghost",size:"xs",onClick:()=>j(!1),className:"min-h-[40px]",children:"Cancel"})]})]});return f?(0,p.jsx)("div",{className:"flex items-center gap-2",children:$}):(0,p.jsx)(m.Z,{variant:"soft",padding:"sm",children:$})};s.d(t,["A",0,h])},85161(e,t,s){s.r(t),s.d(t,{default:()=>q});var n=s(58878),r=s(43681),i=s(84702);const a=(0,i.A)("star",[["path",{d:"M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z",key:"r04s7s"}]]);var l=s(61311),d=s(38557),o=s(74218);const c=(0,i.A)("download",[["path",{d:"M12 15V3",key:"m9g1x1"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["path",{d:"m7 10 5 5 5-5",key:"brsn70"}]]);var m=s(52487),x=s(15310),u=s(38926),p=s(25868),h=s(54079),f=s(15021),b=s(82491),g=s(60654),y=s(89500),v=s(65140),j=s(67889),N=s(82769),w=s(58679),k=s(81676),C=s(19765),S=s(1060),E=s(16749),T=s(97307),I=s(36009),A=s(5663),R=s(36961),L=s(98639),_=s(90782);const $=C.J1`
46  query GetTags {
47    getTags {
48      id
49      type
50      name
51      description
52      is_public
53    }
54  }
55`,q=()=>{const{hasPermission:e}
55=(0,A.S)(),t=e(R.Jj.MANAGE_CONTENT_REVIEW),[s,i]=(0,n.useState)(""),[C,q]=(0,n.useState)([]),[z,M]=(0,n.useState)(!1),[F,O]=(0,n.useState)({min:"",max:""}),[D,W]=(0,n.useState)(!1),[V,P]=(0,n.useState)(!1),[B,U]=(0,n.useState)([]),[H,G]=(0,n.useState)(0),[X,Y]=(0,n.useState)(!0),[J,Z]=(0,n.useState)(1),[Q]=(0,n.useState)(50),[K,ee]=(0,n.useState)(new Set),[te,se]=(0,n.useState)(new Set);(0,n.useEffect)(()=>{se(new Set)},[s,C,F,J]);const[ne,re]=(0,n.useState)(null),[ie,ae]=(0,n.useState)(!1),[le,de]=(0,n.useState)({totalWords:0,totalDefinitions:0,highFrequencyCount:0,difficultyEasyCount:0,difficultyMediumCount:0,difficultyHardCount:0}),[oe,ce]=(0,n.useState)(!0);(0,n.useEffect)(()=>{(async()=>{ce(!0);try{const e=await(0,j.qb)(N.aH.SAT.id);de(e)}catch(e){console.error("Failed to load stats",e)}finally{ce(!1)}})()},[]);const[me,xe]=(0,n.useState)({show:!1,type:"success",title:"",message:""}),{data:ue}=(0,S.IT)($,{...(0,L.X)("session")}),[pe,he]=(0,n.useState)({word:"",etymology:"",definitions:[{definition:"",partsOfSpeech:[],difficultyLevel:"",frequencyRank:"",exampleSentences:"",synonyms:"",antonyms:"",commonConfusions:""}]}),[fe,be]=(0,n.useState)([]),ge=(e,t)=>{he(s=>({...s,[e]:t}))},ye=(e,t,s)=>{he(n=>({...n,definitions:n.definitions.map((n,r)=>r===e?{...n,[t]:s}:n)}))},ve=e=>e?e<=50?(0,_.jsxs)("span",{className:"inline-flex items-center px-2 py-0.5 rounded text-xs font-medium bg-success-100 text-success-800",children:[(0,_.jsx)(a,{size:12,className:"inline mr-1"}),"High Frequency #",e]}):e<=200?(0,_.jsxs)("span",{className:"inline-flex items-center px-2 py-0.5 rounded text-xs font-medium bg-primary-100 text-primary-800",children:["Medium Frequency #",e]}):(0,_.jsxs)("span",{className:"inline-flex items-center px-2 py-0.5 rounded text-xs font-medium bg-surface-sunken text-text-muted",children:["Low Frequency #",e]}):null,je=e=>[...e].sort((e,t)=>e.frequencyRank&&!t.frequencyRank?-1:!e.frequencyRank&&t.frequencyRank?1:e.frequencyRank&&t.frequencyRank?e.frequencyRank-t.frequencyRank:0),Ne=(e,t,s)=>{xe({show:!0,type:e,title:t,message:s})},we=()=>{xe({show:!1,type:"success",title:"",message:""})},ke=e=>{var t,s;t="Delete Vocabulary Word",s=`Are you sure you want to delete "${e.word}" and all ${e.definitions.length} definition(s)? This action cannot be undone.`,xe({show:!0,type:"confirm",title:t,message:s,onConfirm:async()=>{try{await(0,j.IC)(e.id),Ne("success","Success","Word deleted successfully!"),await Ce()}catch(t){console.error("Error deleting word:",t),Ne("error","Error",`Failed to delete word: ${t.message}`)}}})};(0,n.useEffect)(()=>{Ce()},[s,C,F,J]),(0,n.useEffect)(()=>{Z(1)},[s,C,F]);const Ce=async()=>{Y(!0);try{const e={examTypeId:N.aH.SAT.id};if(s&&(e.searchQuery=s),C.length>0&&(e.difficultyLevels=C),F.min||F.max){const t=F.min?parseInt(F.min):0,s=F.max?parseInt(F.max):999999;e.frequencyRange=[t,s]}const t=(J-1)*Q;let n=await(0,j.Ut)({...e,limit:Q,offset:t}),r=n.words;G(n.total),U(r)}catch(e){console.error("Error fetching vocabulary words:",e),Ne("error","Error",`Failed to fetch vocabulary words: ${e.message}`)}finally{Y(!1)}},Se=async()=>{if(pe.word.trim())if(0!==pe.definitions.length){for(let e=0;e<pe.definitions.length;e++){const t=pe.definitions[e];if(!t.definition.trim())return void Ne("error","Validation Error",`Definition ${e+1}: Please enter a definition`);if(!t.difficultyLevel)return void Ne("error","Validation Error",`Definition ${e+1}: Please select a difficulty level`)}P(!0);try{const e=N.aH.SAT.id,t=pe.definitions.map((e,t)=>({id:e.id,definition:e.definition.trim(),partsOfSpeech:e.partsOfSpeech.length>0?e.partsOfSpeech:void 0,difficultyLevel:parseInt(e.difficultyLevel),frequencyRank:e.frequencyRank?parseInt(e.frequencyRank):void 0,exampleSentences:e.exampleSentences?e.exampleSentences.split("\n").filter(e=>e.trim()):[],synonyms:e.synonyms?e.synonyms.split(",").map(e=>e.trim()).filter(Boolean):[],antonyms:e.antonyms?e.antonyms.split(",").map(e=>e.trim()).filter(Boolean):[],commonConfusions:e.commonConfusions?e.commonConfusions.split(",").map(e=>e.trim()).filter(Boolean):[],orderIndex:t})),s={examTypeId:e,word:pe.word.trim(),etymology:pe.etymology.trim()||void 0,tagIds:fe.length>0?fe:void 0,definitions:t};ne?(await(0,j.w7)(ne.id,s),Ne("success","Success","Word updated successfully!")):(await(0,j.$n)(s),Ne("success","Success","Word added successfully!")),he({word:"",etymology:"",definitions:[{definition:"",partsOfSpeech:[],difficultyLevel:"",frequencyRank:"",exampleSentences:"",synonyms:"",antonyms:"",commonConfusions:""}]}),be([]),re(null),W(!1),ae(!1),await Ce()}catch(e){console.error(`Error ${ne?"updating":"adding"} word:`,e),Ne("error","Error",`Failed to ${ne?"update":"add"} word: ${e.message}`)}finally{P(!1)}}else Ne("error","Validation Error","Please add at least one definition");else Ne("error","Validation Error","Please enter a word")};return(0,_.jsxs)("div",{className:"max-w-7xl mx-auto",children:[(0,_.jsx)("div",{className:"mb-8",children:(0,_.jsxs)("div",{className:"flex items-center justify-between",children:[(0,_.jsxs)("div",{children:[(0,_.jsx)("h1",{className:"text-3xl font-bold text-text",children:"Vocabulary Management"}),(0,_.jsx)("p",{className:"mt-2 text-lg text-text-muted",children:"Add and manage SAT vocabulary words with multiple definitions"})]}),(0,_.jsxs)("button",{onClick:()=>W(!0),className:"px-4 py-2 bg-purple-600 text-white rounded-md hover:bg-purple-700 flex items-center gap-2",children:[(0,_.jsx)(l.A,{size:16}),"Add Vocabulary Word"]})]})}),(0,_.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-5 ga
55p-4 mb-8",children:[(0,_.jsxs)("div",{className:"bg-surface-raised shadow rounded-lg p-6",children:[(0,_.jsx)("div",{className:"text-sm font-medium text-text-subtle mb-2",children:"Total Words"}),(0,_.jsx)("div",{className:"text-3xl font-bold text-text",children:oe?"...":le.totalWords}),(0,_.jsxs)("div",{className:"text-xs text-text-subtle mt-1",children:[oe?"...":le.totalDefinitions," definitions"]})]}),(0,_.jsxs)("div",{className:"bg-surface-raised shadow rounded-lg p-6",children:[(0,_.jsxs)("div",{className:"text-sm font-medium text-text-subtle mb-2",children:[(0,_.jsx)(a,{size:14,className:"inline text-success-600 mr-1"}),"High Frequency"]}),(0,_.jsx)("div",{className:"text-3xl font-bold text-success-600",children:oe?"...":le.highFrequencyCount}),(0,_.jsx)("div",{className:"text-xs text-text-subtle mt-1",children:"Rank 1-50"})]}),(0,_.jsxs)("div",{className:"bg-surface-raised shadow rounded-lg p-6",children:[(0,_.jsx)("div",{className:"text-sm font-medium text-text-subtle mb-2",children:"Easy (1-2)"}),(0,_.jsx)("div",{className:"text-3xl font-bold text-success-600",children:oe?"...":le.difficultyEasyCount}),(0,_.jsx)("div",{className:"text-xs text-text-subtle mt-1",children:"Beginner"})]}),(0,_.jsxs)("div",{className:"bg-surface-raised shadow rounded-lg p-6",children:[(0,_.jsx)("div",{className:"text-sm font-medium text-text-subtle mb-2",children:"Medium (3)"}),(0,_.jsx)("div",{className:"text-3xl font-bold text-warning-600",children:oe?"...":le.difficultyMediumCount}),(0,_.jsx)("div",{className:"text-xs text-text-subtle mt-1",children:"Intermediate"})]}),(0,_.jsxs)("div",{className:"bg-surface-raised shadow rounded-lg p-6",children:[(0,_.jsx)("div",{className:"text-sm font-medium text-text-subtle mb-2",children:"Hard (4-5)"}),(0,_.jsx)("div",{className:"text-3xl font-bold text-error-600",children:oe?"...":le.difficultyHardCount}),(0,_.jsx)("div",{className:"text-xs text-text-subtle mt-1",children:"Advanced"})]})]}),(0,_.jsx)("div",{className:"bg-surface-raised shadow rounded-lg p-6 mb-6",children:(0,_.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-4 gap-4",children:[(0,_.jsxs)("div",{children:[(0,_.jsx)("label",{className:"block text-sm font-medium text-text-muted mb-2",children:"Search Words"}),(0,_.jsx)("input",{type:"text",value:s,onChange:e=>i(e.target.value),placeholder:"Search by word...",className:"w-full px-3 py-2 border border-border-strong rounded-md focus:outline-none focus:ring-2 focus:ring-purple-500"})]}),(0,_.jsxs)("div",{className:"relative",children:[(0,_.jsx)("label",{className:"block text-sm font-medium text-text-muted mb-2",children:"Difficulty Levels"}),(0,_.jsxs)("button",{type:"button",onClick:()=>M(!z),className:"w-full bg-surface-raised border border-border-strong rounded-md shadow-sm pl-3 pr-10 py-2 text-left cursor-default focus:outline-none focus:ring-1 focus:ring-purple-500 focus:border-purple-500 sm:text-sm",children:[(0,_.jsx)("span",{className:"block truncate",children:0===C.length?"All Levels":`${C.length} Selected`}),(0,_.jsx)("span",{className:"absolute inset-y-0 right-0 flex items-center pr-2 pointer-events-none top-8",children:(0,_.jsx)(d.A,{size:16,className:"text-text-subtle"})})]}),z&&(0,_.jsx)("div",{className:"absolute z-10 mt-1 w-full bg-surface-raised shadow-lg max-h-60 rounded-md py-1 text-base ring-1 ring-black ring-opacity-5 overflow-auto focus:outline-none sm:text-sm",children:(0,_.jsx)("div",{className:"p-2 space-y-2",children:[1,2,3,4,5].map(e=>(0,_.jsxs)("label",{className:"flex items-center space-x-3 cursor-pointer hover:bg-surface-sunken p-2 rounded",children:[(0,_.jsx)("input",{type:"checkbox",className:"form-checkbox h-4 w-4 text-purple-600 rounded border-border-strong focus:ring-purple-500",checked:C.includes(e),onChange:t=>{t.target.checked?q(t=>[...t,e]):q(t=>t.filter(t=>t!==e))}}),(0,_.jsxs)("span",{className:"text-text block truncate",children:["Level ",e]})]},e))})})]}),(0,_.jsxs)("div",{children:[(0,_.jsxs)("label",{className:"block text-sm font-medium text-text-muted mb-2",children:["Frequency Rank",(0,_.jsx)("span",{className:"text-xs text-text-subtle ml-1",children:"(Min - Max)"})]}),(0,_.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,_.jsx)("input",{type:"number",placeholder:"Min",min:"1",value:F.min,onChange:e=>O(t=>({...t,min:e.target.value})),className:"w-full px-3 py-2 border border-border-strong rounded-md focus:outline-none focus:ring-2 focus:ring-purple-500 text-sm"}),(0,_.jsx)("span",{className:"text-text-subtle font-bold",children:"-"}),(0,_.jsx)("input",{type:"number",placeholder:"Max",min:"1",value:F.max,onChange:e=>O(t=>({...t,max:e.target.value})),className:"w-full px-3 py-2 border border-border-strong rounded-md focus:outline-none focus:ring-2 focus:ring-purple-500 text-sm"})]})]}),(0,_.jsx)("div",{className:"flex items-end",children:(0,_.jsx)("button",{onClick:()=>{i(""),q([]),O({min:"",max:""})},className:"w-full px-4 py-2 bg-surface-sunken text-text-muted rounded-md hover:bg-neutral-200",children:"Clear Filters"})})]})}),(0,_.jsxs)("div",{className:"bg-surface-raised shadow rounded-lg overflow-hidden",children:[(0,_.jsxs)("div",{className:"px-6 py-4 border-b border-border flex items-center justify-between",children:[(0,_.jsx)("h2",{className:"text-lg font-semibold text-text",children:"Vocabulary Words"}),(0,_.jsxs)("div",{className:"flex items-center gap-2",children:[(0,_.jsx)("input",{type:"file",id:"csv-upload",accept:".csv",onChange:e=>{var t;const s=null===(t=e.target.files)||void 0===t?void 0:t[0];if(!s)return;const n=new FileReader;n.onload=async e=>{try{var t;const d=(null===(t=e.target)||void 0===t?void 0:t.result).split("\n").filter(e=>e.trim());if(d.length<2)return void Ne("error","Import Failed","CSV file is empty or invalid.");const o=d.slice(1),c=N.aH.SAT.id,m=new Map;for(let e=0;e<o.length;e++){var s,n;const t=o[e],l=[];let d="",x=!1;for(let e=0;e<t.length;e++){const s=t[e];'"'===s?x&&'"'===t[e+1]?(d+='"',e++):x=!x:","!==s||x?d+=s:(l.push(d),d="")}if(l.push(d),l.length<8||!l[2]||!l[7]){console.warn(`Skipping row ${e+2}: Missing word or definition`);continue}const u=(null===(s=l[0])||void 0===s?void 0:s.trim())||void 0,p=u||l[2].trim().toLowerCase();var r,i,a;if(!m.has(p))m.set(p,{id:u,examTypeId:(null===(r=l[1])||void 0===r?void 0:r.trim())||c,word:l[2].trim(),etymology:(null===(i=l[3])||void 0===i?void 0:i.trim())||void 0,tagIds:l[4]?l[4].split(",").map(e=>
55e.trim()).filter(Boolean):[],audioUrl:(null===(a=l[5])||void 0===a?void 0:a.trim())||void 0,definitions:[]});m.get(p).definitions.push({id:(null===(n=l[6])||void 0===n?void 0:n.trim())||void 0,definition:l[7].trim(),partsOfSpeech:l[8]?l[8].split(",").map(e=>e.trim()).filter(Boolean):[],difficultyLevel:parseInt(l[9])||3,frequencyRank:l[10]?parseInt(l[10]):void 0,exampleSentences:l[11]?l[11].split("\n").map(e=>e.trim()).filter(Boolean):[],synonyms:l[12]?l[12].split(",").map(e=>e.trim()).filter(Boolean):[],antonyms:l[13]?l[13].split(",").map(e=>e.trim()).filter(Boolean):[],commonConfusions:l[14]?l[14].split(",").map(e=>e.trim()).filter(Boolean):[],orderIndex:l[15]?parseInt(l[15]):void 0})}if(0===m.size)return void Ne("error","Import Failed","No valid vocabulary words found in CSV.");const x=Array.from(m.values()),u=x.filter(e=>!e.id),p=x.filter(e=>e.id);let h=0,f=0,b=0;if(u.length>0)try{const e=u.map(e=>({examTypeId:e.examTypeId,word:e.word,tagIds:e.tagIds,audioUrl:e.audioUrl,etymology:e.etymology,definitions:e.definitions}));await(0,j.Z4)(c,e),h=u.length}catch(l){console.error("Error bulk importing words:",l),b=u.length}if(p.length>0)try{const e=p.map(e=>({id:e.id,examTypeId:e.examTypeId,word:e.word,tagIds:e.tagIds,audioUrl:e.audioUrl,etymology:e.etymology,definitions:e.definitions}));await(0,j.Rq)(e),f=p.length}catch(l){console.error("Error bulk updating words:",l),b=p.length}await Ce();let g="";h>0&&f>0?g=`Created ${h} new words and updated ${f} existing words.`:h>0?g=`Created ${h} new words.`:f>0&&(g=`Updated ${f} existing words.`),b>0&&(g+=` ${b} words failed to import.`),b>0&&h+f>0?Ne("error","Partial Import",g):b>0?Ne("error","Import Failed",g):Ne("success","Import Successful",g)}catch(l){console.error("Error importing CSV:",l),Ne("error","Import Failed",`Failed to import CSV: ${l.message}`)}},n.readAsText(s),e.target.value=""},className:"hidden"}),(0,_.jsxs)("label",{htmlFor:"csv-upload",className:"px-3 py-1.5 text-sm bg-primary-50 text-primary-600 rounded-md hover:bg-primary-100 cursor-pointer inline-flex items-center",children:[(0,_.jsx)(o.A,{size:14,className:"inline mr-2"}),"Import CSV"]}),(0,_.jsxs)("button",{onClick:()=>{try{const e=["Word ID","Exam Type ID","Word","Etymology","Tag IDs","Audio URL","Definition ID","Definition","Parts of Speech","Difficulty Level","Frequency Rank","Example Sentences","Synonyms","Antonyms","Common Confusions","Order Index"],t=[];B.forEach(e=>{e.definitions.forEach(s=>{var n,r;t.push([e.id,e.examTypeId,e.word,e.etymology||"",e.tagIds.join(","),e.audioUrl||"",s.id,s.definition,s.partsOfSpeech.join(", "),s.difficultyLevel.toString(),(null===(n=s.frequencyRank)||void 0===n?void 0:n.toString())||"",s.exampleSentences.join("\n"),s.synonyms.join(", "),s.antonyms.join(", "),(null===(r=s.commonConfusions)||void 0===r?void 0:r.join(", "))||"",s.orderIndex.toString()])})});const s=[e.join(","),...t.map(e=>e.map(e=>{const t=String(e);return t.includes(",")||t.includes('"')||t.includes("\n")?`"${t.replace(/"/g,'""')}"`:t}).join(","))].join("\n"),n=new Blob([s],{type:"text/csv;charset=utf-8;"}),r=document.createElement("a"),i=URL.createObjectURL(n);r.setAttribute("href",i),r.setAttribute("download",`vocabulary_words_${(new Date).toISOString().split("T")[0]}.csv`),r.style.visibility="hidden",document.body.appendChild(r),r.click(),document.body.removeChild(r);const a=B.reduce((e,t)=>e+t.definitions.length,0);Ne("success","Export Successful",`Exported ${B.length} words with ${a} definitions to CSV.`)}catch(e){console.error("Error exporting CSV:",e),Ne("error","Export Failed",`Failed to export CSV: ${e.message}`)}},disabled:0===B.length,className:"px-3 py-1.5 text-sm bg-success-50 text-success-600 rounded-md hover:bg-success-100 disabled:opacity-50 disabled:cursor-not-allowed",children:[(0,_.jsx)(c,{size:14,className:"inline mr-2"}),"Export CSV"]})]})]}),X&&0===B.length&&(0,_.jsxs)("div",{className:"px-6 py-12 text-center",children:[(0,_.jsx)(r.k,{size:"lg"}),(0,_.jsx)("p",{className:"mt-4 text-text-muted",children:"Loading vocabulary words..."})]}),!X&&0===B.length&&(0,_.jsxs)("div",{className:"px-6 py-12 text-center",children:[(0,_.jsx)("div",{className:"text-6xl mb-4",children:"\ud83d\udcd6"}),(0,_.jsx)("h3",{className:"text-lg font-semibold text-text mb-2",children:"No vocabulary words yet"}),(0,_.jsx)("p",{className:"text-text-muted mb-4",children:"Start building your vocabulary database by adding words or importing from CSV"}),(0,_.jsx)("button",{onClick:()=>W(!0),className:"px-4 py-2 bg-purple-600 text-white rounded-md hover:bg-purple-700",children:"Add Your First Word"})]}),B.length>0&&(0,_.jsxs)("table",{className:"min-w-full divide-y divide-border",children:[(0,_.jsx)("thead",{className:"bg-surface-sunken",children:(0,_.jsxs)("tr",{children:[t&&(0,_.jsx)("th",{className:"px-3 py-3 text-left text-xs font-medium text-text-subtle uppercase tracking-wider w-8"}),(0,_.jsx)("th",{className:"px-6 py-3 text-left text-xs font-medium text-text-subtle uppercase tracking-wider w-8"}),(0,_.jsx)("th",{className:"px-6 py-3 text-left text-xs font-medium text-text-subtle uppercase tracking-wider",children:"Word"}),(0,_.jsx)("th",{className:"px-6 py-3 text-left text-xs font-medium text-text-subtle uppercase tracking-wider",children:"Definitions"}),(0,_.jsx)("th",{className:"px-6 py-3 text-left text-xs font-medium text-text-subtle uppercase tracking-wider",children:"Difficulty Range"}),(0,_.jsx)("th",{className:"px-6 py-3 text-right text-xs font-medium text-text-subtle uppercase tracking-wider",children:"Actions"})]})}),(0,_.jsx)("tbody",{className:"bg-surface-raised divide-y divide-border",children:B.map(e=>{const s=Math.min(...e.definitions.map(e=>
55e.difficultyLevel)),r=Math.max(...e.definitions.map(e=>e.difficultyLevel)),i=je(e.definitions)[0];return(0,_.jsxs)(n.Fragment,{children:[(0,_.jsxs)("tr",{className:"hover:bg-surface-sunken",children:[t&&(0,_.jsx)("td",{className:"px-3 py-4 whitespace-nowrap",children:(0,_.jsx)("input",{type:"checkbox",checked:te.has(e.id),onChange:()=>{return t=e.id,se(e=>{const s=new Set(e);return s.has(t)?s.delete(t):s.add(t),s});var t},className:"h-4 w-4 rounded border-border-strong text-primary-600 focus:ring-primary-500","aria-label":"Select word for assignment"})}),(0,_.jsx)("td",{className:"px-6 py-4 whitespace-nowrap",children:(0,_.jsx)("button",{onClick:()=>{return t=e.id,void ee(e=>{const s=new Set(e);return s.has(t)?s.delete(t):s.add(t),s});var t},className:"text-text-subtle hover:text-text-muted focus:outline-none",children:K.has(e.id)?(0,_.jsx)(d.A,{size:14}):(0,_.jsx)(m.A,{size:14})})}),(0,_.jsxs)("td",{className:"px-6 py-4 whitespace-nowrap",children:[(0,_.jsx)("div",{className:"text-sm font-medium text-text",children:e.word}),e.etymology&&(0,_.jsx)("div",{className:"text-xs text-text-subtle italic truncate max-w-xs",children:e.etymology})]}),(0,_.jsxs)("td",{className:"px-6 py-4",children:[(0,_.jsx)("div",{className:"text-sm text-text line-clamp-2",children:i.definition}),(0,_.jsxs)("div",{className:"flex items-center gap-2 mt-1",children:[i.frequencyRank&&ve(i.frequencyRank),e.definitions.length>1&&(0,_.jsxs)("span",{className:"text-xs text-purple-600",children:["+",e.definitions.length-1," more definition",e.definitions.length-1>1?"s":""]})]})]}),(0,_.jsx)("td",{className:"px-6 py-4 whitespace-nowrap",children:s===r?(0,_.jsxs)("span",{className:"px-2 py-1 inline-flex text-xs leading-5 font-semibold rounded-full "+(s<=2?"bg-success-100 text-success-800":3===s?"bg-warning-100 text-warning-800":"bg-error-100 text-error-800"),children:["Level ",s]}):(0,_.jsxs)("span",{className:"text-sm text-text-muted",children:["Level ",s,"-",r]})}),(0,_.jsxs)("td",{className:"px-6 py-4 whitespace-nowrap text-right text-sm font-medium",children:[(0,_.jsx)("button",{onClick:()=>(e=>{re(e),he({word:e.word,etymology:e.etymology||"",definitions:e.definitions.map(e=>{var t,s;return{id:e.id,definition:e.definition,partsOfSpeech:e.partsOfSpeech||[],difficultyLevel:e.difficultyLevel.toString(),frequencyRank:(null===(t=e.frequencyRank)||void 0===t?void 0:t.toString())||"",exampleSentences:e.exampleSentences.join("\n"),synonyms:e.synonyms.join(", "),antonyms:e.antonyms.join(", "),commonConfusions:(null===(s=e.commonConfusions)||void 0===s?void 0:s.join(", "))||""}})}),be(e.tagIds||[]),ae(!0)})(e),className:"text-purple-600 hover:text-purple-900 mr-3",title:"Edit word",children:(0,_.jsx)(x.A,{size:16})}),(0,_.jsx)("button",{onClick:()=>ke(e),className:"text-error-600 hover:text-error-800",title:"Delete word",children:(0,_.jsx)(u.A,{size:16})})]})]}),K.has(e.id)&&(0,_.jsx)("tr",{children:(0,_.jsxs)("td",{colSpan:t?6:5,className:"px-6 py-4 bg-surface-sunken border-t border-border-subtle",children:[(0,_.jsx)("div",{className:"mb-4",children:(0,_.jsx)(E.A,{itemType:"VOCABULARY",itemId:e.id})}),(0,_.jsxs)("div",{className:"space-y-6",children:[je(e.definitions).map((e,t)=>(0,_.jsxs)("div",{className:"border-l-4 border-purple-500 pl-4",children:[(0,_.jsxs)("div",{className:"flex items-center justify-between mb-2",children:[(0,_.jsxs)("div",{className:"flex items-center gap-2",children:[(0,_.jsxs)("h5",{className:"text-sm font-semibold text-text",children:["Definition ",t+1]}),e.frequencyRank&&ve(e.frequencyRank)]}),(0,_.jsxs)("div",{className:"flex items-center gap-2",children:[e.partsOfSpeech&&e.partsOfSpeech.length>0&&(0,_.jsx)("span",{className:"text-xs text-text-subtle italic",children:e.partsOfSpeech.join(", ")}),(0,_.jsxs)("span",{className:"px-2 py-1 text-xs rounded-full "+(e.difficultyLevel<=2?"bg-success-100 text-success-800":3===e.difficultyLevel?"bg-warning-100 text-warning-800":"bg-error-100 text-error-800"),children:["Level ",e.difficultyLevel]})]})]}),(0,_.jsx)("p",{className:"text-sm text-text-muted mb-3",children:e.definition}),e.exampleSentences&&e.exampleSentences.length>0&&(0,_.jsxs)("div",{className:"mb-2",children:[(0,_.jsx)("h6",{className:"text-xs font-semibold text-text-muted mb-1",children:"Examples"}),(0,_.jsx)("ul",{className:"list-disc list-inside space-y-0.5",children:e.exampleSentences.map((e,t)=>(0,_.jsx)("li",{className:"text-xs text-text-muted",children:e},t))})]}),(0,_.jsxs)("div",{className:"grid grid-cols-2 gap-3 mb-2",children:[e.synonyms&&e.synonyms.length>0&&(0,_.jsxs)("div",{children:[(0,_.jsx)("h6",{className:"text-xs font-semibold text-text-muted mb-1",children:"Synonyms"}),(0,_.jsx)("div",{className:"flex flex-wrap gap-1",children:e.synonyms.map((e,t)=>(0,_.jsx)("span",{className:"px-1.5 py-0.5 bg-primary-100 text-primary-700 rounded text-xs",children:e},t))})]}),e.antonyms&&e.antonyms.length>0&&(0,_.jsxs)("div",{children:[(0,_.jsx)("h6",{className:"text-xs font-semibold text-text-muted mb-1",children:"Antonyms"}),(0,_.jsx)("div",{className:"flex flex-wrap gap-1",children:e.antonyms.map((e,t)=>(0,_.jsx)("span",{className:"px-1.5 py-0.5 bg-warning-100 text-warning-700 rounded text-xs",children:e},t))})]})]}),e.commonConfusions&&e.commonConfusions.length>0&&(0,_.jsxs)("div",{className:"mb-2",children:[(0,_.jsx)("h6",{className:"text-xs font-semibold text-text-muted mb-1",children:"Common Confusions"}),(0,_.jsx)("div",{className:"flex flex-wrap gap-1",children:e.commonConfusions.map((e,t)=>(0,_.jsx)("span",{className:"px-1.5 py-0.5 bg-warning-100 text-warning-700 rounded text-xs",children:e},t))})]})]},e.id)),(0,_.jsxs)("div",{className:"border-t pt-3",children:[e.tagIds&&e.tagIds.length>0&&(0,_.jsxs)("div",{className:"mb-2",children:[(0,_.jsx)("h6",{className:"text-xs font-semibold text-text-muted mb-1",children:"Tags"}),(0,_.jsx)("div",{className:"flex flex-wrap gap-1",children:e.tagIds.map(e=>{const t=(e=>{var t;return null===ue||void 0===ue||null===(t=ue.getTags)||void 0===t?void 0:t.find(t=>
55t.id===e)})(e);return t?(0,_.jsxs)("span",{className:`inline-flex items-center px-2 py-1 rounded-md text-xs ${(0,k.iY)(t.type)}`,children:[(0,_.jsx)("span",{className:"mr-1 text-xs bg-primary-200 px-1 rounded",children:(0,k.Fm)(t.type)}),t.name]},e):null})})]}),e.etymology&&(0,_.jsxs)("div",{children:[(0,_.jsx)("h6",{className:"text-xs font-semibold text-text-muted mb-1",children:"Etymology"}),(0,_.jsx)("p",{className:"text-xs text-text-muted italic",children:e.etymology})]})]})]})]})})]},e.id)})})]}),!X&&B.length>0&&(0,_.jsxs)("div",{className:"bg-surface-raised px-4 py-3 flex items-center justify-between border-t border-border sm:px-6",children:[(0,_.jsxs)("div",{className:"flex-1 flex justify-between sm:hidden",children:[(0,_.jsx)("button",{onClick:()=>Z(Math.max(1,J-1)),disabled:1===J,className:"relative inline-flex items-center px-4 py-2 border border-border-strong text-sm font-medium rounded-md text-text-muted bg-surface-raised hover:bg-surface-sunken disabled:bg-surface-sunken disabled:text-text-subtle",children:"Previous"}),(0,_.jsx)("button",{onClick:()=>Z(J+1),disabled:J*Q>=H,className:"ml-3 relative inline-flex items-center px-4 py-2 border border-border-strong text-sm font-medium rounded-md text-text-muted bg-surface-raised hover:bg-surface-sunken disabled:bg-surface-sunken disabled:text-text-subtle",children:"Next"})]}),(0,_.jsxs)("div",{className:"hidden sm:flex-1 sm:flex sm:items-center sm:justify-between",children:[(0,_.jsx)("div",{children:(0,_.jsxs)("p",{className:"text-sm text-text-muted",children:["Showing ",(0,_.jsx)("span",{className:"font-medium",children:(J-1)*Q+1})," to ",(0,_.jsx)("span",{className:"font-medium",children:Math.min(J*Q,H)})," of ",(0,_.jsx)("span",{className:"font-medium",children:H})," results"]})}),(0,_.jsx)("div",{children:(0,_.jsxs)("nav",{className:"relative z-0 inline-flex rounded-md shadow-sm -space-x-px","aria-label":"Pagination",children:[(0,_.jsxs)("button",{onClick:()=>Z(Math.max(1,J-1)),disabled:1===J,className:"relative inline-flex items-center px-2 py-2 rounded-l-md border border-border-strong bg-surface-raised text-sm font-medium text-text-subtle hover:bg-surface-sunken disabled:bg-surface-sunken disabled:text-text-subtle",children:[(0,_.jsx)("span",{className:"sr-only",children:"Previous"}),(0,_.jsx)(p.A,{size:16})]}),Array.from({length:Math.min(5,Math.ceil(H/Q))},(e,t)=>{let s=J;const n=Math.ceil(H/Q);return s=n<=5||J<=3?t+1:J>=n-2?n-4+t:J-2+t,(0,_.jsx)("button",{onClick:()=>Z(s),"aria-current":J===s?"page":void 0,className:"relative inline-flex items-center px-4 py-2 border text-sm font-medium "+(J===s?"z-10 bg-purple-50 border-purple-500 text-purple-600":"bg-surface-raised border-border-strong text-text-subtle hover:bg-surface-sunken"),children:s},s)}),(0,_.jsxs)("button",{onClick:()=>Z(J+1),disabled:J*Q>=H,className:"relative inline-flex items-center px-2 py-2 rounded-r-md border border-border-strong bg-surface-raised text-sm font-medium text-text-subtle hover:bg-surface-sunken disabled:bg-surface-sunken disabled:text-text-subtle",children:[(0,_.jsx)("span",{className:"sr-only",children:"Next"}),(0,_.jsx)(m.A,{size:16})]})]})})]})]})]}),(D||ie)&&(0,_.jsx)(T.A,{children:(0,_.jsx)("div",{className:"fixed inset-0 bg-neutral-900/50 backdrop-blur-sm flex items-center justify-center z-[200] p-4",children:(0,_.jsxs)("div",{className:"bg-surface-raised rounded-lg shadow-xl max-w-4xl w-full max-h-[95vh] overflow-y-auto",children:[(0,_.jsxs)("div",{className:"px-6 py-4 border-b border-border flex items-center justify-between sticky top-0 bg-surface-raised z-10",children:[(0,_.jsx)("h3",{className:"text-lg font-semibold text-text",children:ne?"Edit Vocabulary Word":"Add Vocabulary Word"}),(0,_.jsx)("button",{onClick:()=>{W(!1),ae(!1),re(null),he({word:"",etymology:"",definitions:[{definition:"",partsOfSpeech:[],difficultyLevel:"",frequencyRank:"",exampleSentences:"",synonyms:"",antonyms:"",commonConfusions:""}]}),be([])},className:"text-text-subtle hover:text-text-muted",children:(0,_.jsx)(h.A,{size:16})})]}),(0,_.jsx)("div",{className:"px-6 py-4",children:(0,_.jsxs)("form",{className:"space-y-5",onSubmit:e=>{e.preventDefault(),Se()},children:[(0,_.jsxs)("div",{className:"border-b border-border pb-4",children:[(0,_.jsx)("h4",{className:"text-sm font-semibold text-text-muted mb-3",children:"Word Information"}),(0,_.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,_.jsxs)("div",{children:[(0,_.jsx)("label",{className:"block text-sm font-medium text-text-muted mb-2",children:"Word *"}),(0,_.jsx)("input",{type:"text",value:pe.word,onChange:e=>ge("word",e.target.value),placeholder:"e.g., bank",className:"w-full px-3 py-2 border border-border-strong rounded-md focus:outline-none focus:ring-2 focus:ring-purple-500"})]}),(0,_.jsxs)("div",{children:[(0,_.jsx)("label",{className:"block text-sm font-medium text-text-muted mb-2",children:"Etymology"}),(0,_.jsx)("input",{type:"text",value:pe.etymology,onChange:e=>ge("etymology",e.target.value),placeholder:"e.g., From Old Norse bakki 'ridge'",className:"w-full px-3 py-2 border border-border-strong rounded-md focus:outline-none focus:ring-2 focus:ring-purple-500"})]})]}),(0,_.jsxs)("div",{className:"mt-4",children:[(0,_.jsx)("label",{className:"block text-sm font-medium text-text-muted mb-2",children:"Tags"}),(0,_.jsx)(w.A,{selectedTagIds:fe,onTagIdsChange:be,placeholder:"Search and select tags...",publicOnly:!1}),(0,_.jsx)("p",{className:"mt-1 text-xs text-text-subtle",children:"Categorize this word with relevant tags"})]})]}),(0,_.jsxs)("div",{className:"space-y-4",children:[(0,_.jsxs)("div",{className:"flex items-center justify-between",children:[(0,_.jsx)("h4",{className:"text-sm font-semibold text-text-muted",children:"Definitions"}),(0,_.jsxs)("button",{type:"button",onClick:()=>{he(e=>({...e,definitions:[...e.definitions,{definition:"",partsOfSpeech:[],difficultyLevel:"",frequencyRank:"",exampleSentences:"",synonyms:"",antonyms:"",commonConfusions:""}]}))},className:"px-3 py-1 text-sm bg-purple-100 text-purple-700 rounded-md hover:bg-purple-200 flex items-center gap-1",children:[(0,_.jsx)(l.A,{size:14}),"Add Definition"]})]}),pe.definitions.map((e,t)=>(0,_.jsxs)("div",{className:"border-2 border-purple-200 rounded-lg p-4 relative",children:[pe.definitions.length>1&&(0,_.jsx)("button",{type:"button",onClick:()=>{return e=t,void he(t=>({...t,definitions:t.definitions.filter((t,s)=>s!==e)}));var e},className:"absolute top-2 right-2 text-error-600 hover:text-error-800",title:"Remove definition",children:(0,_.jsx)(h.A,{size:14})}),(0,_.jsxs)("h5",{className:"text-sm font-semibold text-purple-900 mb-3",children:["Definition ",t+1]}),(0,_.jsxs)("div",{className:"space-y-3",children:[(0,_.jsxs)("div",{children:[(0,_.jsx)("label",{className:"block text-sm font-medium text-text-muted mb-2",children:"Parts of Speech"}),(0,_.jsx)("div",{className:"grid grid-cols-4 gap-2 p-2 border border-border-strong rounded-md bg-surface-sunken",children:["noun","verb","adjective","adverb","preposition","conjunction","pronoun","interjection"].map(s=>(0,_.jsxs)("label",{className:"flex items-center space-x-1 cursor-pointer",children:[(0,_.jsx)("input",{type:"checkbox",checked:e.partsOfSpeech.includes(s),onChange:n=>{const r=e.partsOfSpeech,i=n.target.checked?[...r,s]:r.filter(e=>e!==s);
55ye(t,"partsOfSpeech",i)},className:"rounded text-purple-600 focus:ring-purple-500"}),(0,_.jsx)("span",{className:"text-xs text-text-muted capitalize",children:s})]},s))})]}),(0,_.jsxs)("div",{children:[(0,_.jsx)("label",{className:"block text-sm font-medium text-text-muted mb-2",children:"Definition *"}),(0,_.jsx)("textarea",{rows:2,value:e.definition,onChange:e=>ye(t,"definition",e.target.value),placeholder:"e.g., a financial institution (noun)",className:"w-full px-3 py-2 border border-border-strong rounded-md focus:outline-none focus:ring-2 focus:ring-purple-500"})]}),(0,_.jsxs)("div",{className:"grid grid-cols-2 gap-3",children:[(0,_.jsxs)("div",{children:[(0,_.jsx)("label",{className:"block text-sm font-medium text-text-muted mb-2",children:"Difficulty Level *"}),(0,_.jsxs)("select",{value:e.difficultyLevel,onChange:e=>ye(t,"difficultyLevel",e.target.value),className:"w-full px-3 py-2 border border-border-strong rounded-md focus:outline-none focus:ring-2 focus:ring-purple-500",children:[(0,_.jsx)("option",{value:"",children:"Select level"}),(0,_.jsx)("option",{value:"1",children:"1 - Easiest"}),(0,_.jsx)("option",{value:"2",children:"2 - Easy"}),(0,_.jsx)("option",{value:"3",children:"3 - Medium"}),(0,_.jsx)("option",{value:"4",children:"4 - Hard"}),(0,_.jsx)("option",{value:"5",children:"5 - Hardest"})]})]}),(0,_.jsxs)("div",{children:[(0,_.jsxs)("label",{className:"block text-sm font-medium text-text-muted mb-2",children:["Frequency Rank",(0,_.jsx)("span",{className:"text-xs text-text-subtle font-normal ml-1",children:"(1 = most frequent)"})]}),(0,_.jsx)("input",{type:"number",value:e.frequencyRank,onChange:e=>ye(t,"frequencyRank",e.target.value),placeholder:"e.g., 50",min:"1",className:"w-full px-3 py-2 border border-border-strong rounded-md focus:outline-none focus:ring-2 focus:ring-purple-500"}),(0,_.jsx)("p",{className:"mt-1 text-xs text-text-subtle",children:"Lower numbers = more frequent on exam"})]})]}),(0,_.jsxs)("div",{children:[(0,_.jsx)("label",{className:"block text-sm font-medium text-text-muted mb-2",children:"Example Sentences (one per line)"}),(0,_.jsx)("textarea",{rows:2,value:e.exampleSentences,onChange:e=>ye(t,"exampleSentences",e.target.value),placeholder:"She deposited money at the bank.",className:"w-full px-3 py-2 border border-border-strong rounded-md focus:outline-none focus:ring-2 focus:ring-purple-500"})]}),(0,_.jsxs)("div",{className:"grid grid-cols-2 gap-3",children:[(0,_.jsxs)("div",{children:[(0,_.jsx)("label",{className:"block text-sm font-medium text-text-muted mb-2",children:"Synonyms (comma-separated)"}),(0,_.jsx)("input",{type:"text",value:e.synonyms,onChange:e=>ye(t,"synonyms",e.target.value),placeholder:"institution, lender",className:"w-full px-3 py-2 border border-border-strong rounded-md focus:outline-none focus:ring-2 focus:ring-purple-500"})]}),(0,_.jsxs)("div",{children:[(0,_.jsx)("label",{className:"block text-sm font-medium text-text-muted mb-2",children:"Antonyms (comma-separated)"}),(0,_.jsx)("input",{type:"text",value:e.antonyms,onChange:e=>ye(t,"antonyms",e.target.value),placeholder:"debtor, borrower",className:"w-full px-3 py-2 border border-border-strong rounded-md focus:outline-none focus:ring-2 focus:ring-purple-500"})]})]}),(0,_.jsxs)("div",{children:[(0,_.jsx)("label",{className:"block text-sm font-medium text-text-muted mb-2",children:"Common Confusions (comma-separated)"}),(0,_.jsx)("input",{type:"text",value:e.commonConfusions,onChange:e=>ye(t,"commonConfusions",e.target.value),placeholder:"e.g., bench, bench (law), banker",className:"w-full px-3 py-2 border border-border-strong rounded-md focus:outline-none focus:ring-2 focus:ring-purple-500"})]})]})]},t))]})]})}),(0,_.jsxs)("div",{className:"px-6 py-4 border-t border-border flex items-center justify-end gap-3 sticky bottom-0 bg-surface-raised",children:[(0,_.jsx)("button",{onClick:()=>{W(!1),ae(!1),re(null)},type:"button",disabled:V,className:"px-4 py-2 bg-surface-sunken text-text-muted rounded-md hover:bg-neutral-200 disabled:opacity-50 disabled:cursor-not-allowed",children:"Cancel"}),(0,_.jsxs)("button",{onClick:Se,type:"button",disabled:V,className:"px-4 py-2 bg-purple-600 text-white rounded-md hover:bg-purple-700 disabled:opacity-50 disabled:cursor-not-allowed flex items-center gap-2",children:[V&&(0,_.jsx)(f.A,{size:16,className:"animate-spin"}),V?ne?"Updating...":"Adding...":ne?"Update Word":"Add Word"]})]})]})})}),(0,_.jsx)("div",{className:"bg-purple-50 border border-purple-200 rounded-lg p-4 mt-6",children:(0,_.jsxs)("div",{className:"flex items-start",children:[(0,_.jsx)("div",{className:"text-purple-600 mr-3",children:(0,_.jsx)(b.A,{size:16})}),(0,_.jsxs)("div",{children:[(0,_.jsx)("h4",{className:"text-sm font-semibold text-purple-900 mb-1",children:"Multiple Definitions & Frequency Ranking"}),(0,_.jsx)("p",{className:"text-sm text-purple-800 mb-2",children:"Words can now have multiple definitions, each with its own parts of speech, difficulty level, and related information. CSV import/export uses one row per definition format."}),(0,_.jsxs)("p",{className:"text-sm text-purple-800",children:[(0,_.jsx)("strong",{children:"Frequency Rank:"})," Lower rank numbers indicate MORE frequent occurrence on the exam (Rank 1 = most common, Rank 1000 = rare). Definitions are automatically sorted by frequency, with high-frequency definitions (\u2605 Rank 1-50) shown first to help students prioritize learning."]})]})]})}),me.show&&(0,_.jsx)(T.A,{children:(0,_.jsx)("div",{className:"fixed inset-0 bg-neutral-900/50 backdrop-blur-sm flex items-center justify-center z-[200] p-4",children:(0,_.jsxs)("div",{className:"bg-surface-raised rounded-lg shadow-xl max-w-md w-full animate-fadeIn",children:[(0,_.jsx)("div",{className:"px-6 py-4 border-b "+("success"===me.type?"border-success-200 bg-success-50":"error"===me.type?"border-error-200 bg-error-50":"border-warning-200 bg-warning-50"),children:(0,_.jsxs)("div",{className:"flex items-center",children:[(0,_.jsxs)("div",{className:"flex-shrink-0 "+("success"===me.type?"text-success-600":"error"===me.type?"text-error-600":"text-warning-600"),children:["success"===me.type&&(0,_.jsx)(g.A,{size:24}),"error"===me.type&&(0,_.jsx)(y.A,{size:24}),"confirm"===me.type&&(0,_.jsx)(v.A,{size:24})]}),(0,_.jsx)("h3",{className:"ml-3 text-lg font-semibold "+("success"===me.type?"text-success-800":"error"===me.type?"text-error-800":"text-warning-800"),children:me.title})]})}),(0,_.jsx)("div",{className:"px-6 py-4",children:(0,_.jsx)("p",{className:"text-sm text-text-muted whitespace-pre-line",children:me.message})}),(0,_.jsx)("div",{className:"px-6 py-4 bg-surface-sunken border-t border-border flex items-center justify-end gap-3",children:"confirm"===me.type?(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)("button",{onClick:we,className:"px-4 py-2 bg-surface-sunken text-text-muted rounded-md hover:bg-neutral-200 transition-colors",children:"Cancel"}),(0,_.jsx)("button",{onClick:()=>{me.onConfirm&&me.onConfirm(),we()},className:"px-4 py-2 bg-error-600 text-white rounded-md hover:bg-error-700 transition-colors",children:"Delete"})]}):(0,_.jsx)("button",{onClick:we,className:"px-4 py-2 rounded-md text-white transition-colors "+("success"===me.type?"bg-success-600 hover:bg-success-700":"bg-error-600 hover:bg-error-700"),
55children:"OK"})})]})})}),t&&(0,_.jsx)(I.A,{itemType:"VOCABULARY",selectedIds:Array.from(te),onClearSelection:()=>se(new Set)})]})}},81676(e,t,s){const n=e=>{switch(e){case"EXAM_TYPE":case"exam_type":return"bg-purple-100 text-purple-800";case"EXAM_SECTION":case"exam_section":return"bg-indigo-100 text-indigo-800";case"SUBJECT":case"subject":return"bg-primary-100 text-primary-800";case"TOPIC":case"SUBTOPIC":case"topic":case"subtopic":return"bg-success-100 text-success-800";case"CONCEPT":case"concept":return"bg-teal-100 text-teal-800";default:return"bg-surface-sunken text-text"}};s.d(t,["Fm",0,e=>({exam_type:"Exam Type",exam_section:"Exam Section",subject:"Subject",topic:"Topic",subtopic:"Subtopic",concept:"Concept",passage_type:"Passage Type",general:"General",EXAM_TYPE:"Exam Type",EXAM_SECTION:"Exam Section",SUBJECT:"Subject",TOPIC:"Topic",SUBTOPIC:"Subtopic",CONCEPT:"Concept",GENERAL:"General"}[e]||e.replace(/_/g," ")),"HW",0,e=>{var t;const s=null!==(t=null===e||void 0===e?void 0:e.tags)&&void 0!==t?t:[];return{topicTags:s.filter(e=>"topic"===(null===e||void 0===e?void 0:e.type)).map(e=>e.name),subtopicTags:s.filter(e=>"subtopic"===(null===e||void 0===e?void 0:e.type)).map(e=>e.name)}},"Z",0,e=>{const t=["EXAM_TYPE","EXAM_SECTION","SUBJECT","TOPIC","SUBTOPIC","CONCEPT","GENERAL"];return[...e].sort((e,s)=>{const n=t.indexOf(e.type.toUpperCase()),r=t.indexOf(s.type.toUpperCase());return-1!==n&&-1!==r?n-r:-1!==n?-1:-1!==r?1:e.type.localeCompare(s.type)})},"iQ",0,function(e){return`inline-flex items-center rounded-full font-medium ${"sm"===(arguments.length>1&&void 0!==arguments[1]?arguments[1]:"sm")?"px-3 py-1 text-sm":"px-2.5 py-0.5 text-xs"} ${n(e)}`},"iY",0,n])}}]);

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.