1import{ak as V,U as w,r as x,ei as S,ej as X,j as e,eb as N,b7 as j,aQ as U,bq as P,C as W,ee as J,E as T,aO as Y,aU as Z,aV as ee,V as I,b8 as M,dm as q,cX as F,dM as $,o as te,p as se,q as re,s as ae,L as ne,t as ie,ek as oe,a6 as le}from"./index-D3Di9rth.js";import{E as ce}from"./EventLanguage-CHsqOqqZ.js";const ue=new Set(["alphabet","phonics"]),me=[{key:"itemHs",label:"Digit Gap",hint:"between digits in a group"},{key:"groupHs",label:"Group Gap (across)",hint:"between groups side by side"},{key:"groupVs",label:"Group Gap (down)",hint:"between rows of groups"}],de=[{key:"itemHs",label:"Letter Gap",hint:"between letters in a group"},{key:"groupHs",label:"Group Gap (across)",hint:"between groups side by side"},{key:"groupVs",label:"Group Gap (down)",hint:"between rows of groups"}],k=700;function fe({current:t,mutation:n}){const{event:a}=V(),{toast:l}=w(),[s,r]=x.useState(t),[i,d]=x.useState(S(t==null?void 0:t.format)||""),[u,c]=x.useState({itemHs:(t==null?void 0:t.itemHs)??0,groupHs:(t==null?void 0:t.groupHs)??0,groupVs:(t==null?void 0:t.groupVs)??0}),h=x.useRef(null),p=x.useRef({}),f=x.useRef(!1);x.useEffect(()=>{r(t),f.current||(d(S(t==null?void 0:t.format)||""),c({itemHs:(t==null?void 0:t.itemHs)??0,groupHs:(t==null?void 0:t.groupHs)??0,groupVs:(t==null?void 0:t.groupVs)??0}))},[t]),x.useEffect(()=>()=>{h.current&&clearTimeout(h.current),Object.values(p.current).forEach(clearTimeout)},[]);const o=async(m,v)=>{try{await n.mutateAsync({event:a,key:m,value:v}),r(b=>({...b,[m]:v})),l({title:"Saved",variant:"success"})}catch(b){console.error("Error updating format:",b),l({title:"Error saving",variant:"destructive"})}},g=()=>{h.current&&(clearTimeout(h.current),h.current=null);const m=S(i);if(!m){d(S(s.format)||"");return}m!==s.format&&o("format",m)},y=m=>{d(m),h.current&&clearTimeout(h.current),h.current=setTimeout(()=>{if(m!==m.trimEnd())return;const v=S(m);!v||v===s.format||o("format",v)},k)},C=m=>{p.current[m]&&(clearTimeout(p.current[m]),p.current[m]=null);const v=Number(u[m]);if(!Number.isFinite(v)||v<0){c(b=>({...b,[m]:s[m]??0}));return}v!==s[m]&&o(m,v)},L=(m,v)=>{c(b=>({...b,[m]:v})),p.current[m]&&clearTimeout(p.current[m]),p.current[m]=setTimeout(()=>{const b=Number(v);!Number.isFinite(b)||b<0||b!==s[m]&&o(m,b)},k)};if(!s)return null;const A=ue.has(a),H=A?de:me,K=A?"letters":"digits",O=Math.max(2,i.split(` 2`).length),{rows:D}=X(i||s.format),z=D.length>1&&!D.every(m=>m.itemCount===D[0].itemCount);return e.jsxs("div",{className:"flex flex-col mt-6",children:[e.jsxs("div",{className:"flex flex-col gap-3",children:[e.jsxs("div",{className:"flex flex-col gap-1",children:[e.jsx(N,{className:"text-base text-white",children:"Format"}),e.jsx("textarea",{name:"format",spellCheck:!1,rows:O,className:"w-72 border border-dark4 rounded-md text-center bg-transparent text-base font-mono font-semibold tracking-widest text-white py-2 px-3 leading-snug resize-none focus:outline-none focus:ring-2 focus:ring-blue-500",value:i,onFocus:()=>{f.current=!0},onChange:m=>y(m.target.value),onBlur:()=>{f.current=!1,g()}}),e.jsxs("span",{className:"text-sm text-white/80 mt-1 max-w-xl",children:["Type the ",K," how you want them grouped."," ",e.jsx("span",{className:"text-white",children:"Space"})," = new group on the same row. ",e.jsx("span",{className:"text-white",children:"Enter"})," = new row."]})]}),e.jsx("div",{className:"flex flex-wrap gap-4 mt-2",children:H.map(({key:m,label:v,hint:b})=>e.jsxs("div",{className:"flex flex-col gap-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(N,{className:"text-base text-white whitespace-nowrap",children:v}),e.jsx(j,{name:m,className:"w-16 border text-center bg-transparent text-base font-medium text-white",value:u[m],onFocus:()=>{f.current=!0},onChange:Q=>L(m,Q.target.value),onBlur:()=>{f.current=!1,C(m)}})]}),e.jsx("span",{className:"text-xs text-white/70",children:b})]},m))})]}),e.jsxs("div",{className:"flex flex-col items-center",children:[e.jsx("div",{className:"preview mt-6 p-4 rounded bg-dark4 flex justify-center",children:e.jsx(U,{format:i||s.format,itemHs:Number(u.itemHs)||0,groupHs:Number(u.groupHs)||0,groupVs:Number(u.groupVs)||0,renderItem:(m,v)=>e.jsx("p",{className:"text-2xl font-bold leading-none text-white",children:"X"},`p_${v.rowId}_${v.itemIdInRow}`)})}),e.jsx("p",{className:"mt-2 text-lg font-bold text-white",children:"Preview"}),z&&e.jsx("p",{className:"mt-3 max-w-md text-center text-sm text-yellow-400",children:"Grid View needs every row to be the same length. This format will show as one line in Grid View instead of the rows above. Groups View always matches the shape shown here."})]})]})}function xe(t){return J.has(t)}function R(t){return t==="numerics"||t==="phonics"}function ge(t){const n=P(t);return[{value:"groups",label:n,description:n==="Single"?"One item at a time (current default)":"One group at a time (current default)"},{value:"grid",label:"Grid",description:"All items in a grid with group highlighting"}]}async function he(t,n,a,l){return(await fetch(`/api/user/event/settings/viewMode/${t}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({key:n,value:a})})).ok?(T.set(r=>{var i;return{...r,settings:{...r.settings,[`${t}_view`]:{...((i=r.settings)==null?void 0:i[`${t}_view`])||{},[n]:a}}}}),l==null||l({title:"Saved",variant:"success"}),!0):(l==null||l({title:"Failed to save view setting",variant:"destructive"}),!1)}function pe({eventName:t,value:n,onSelect:a}){var u;const[l,s]=x.useState(!1),r=x.useRef(null);x.useEffect(()=>{function c(h){r.current&&!r.current.contains(h.target)&&s(!1)}return document.addEventListener("mousedown",c),()=>document.removeEventListener("mousedown",c)},[]);const i=ge(t),d=((u=i.find(c=>c.value===n))==null?void 0:u.label)||P(t);return e.jsxs("div",{className:"relative w-56",ref:r,children:[e.jsxs("button",{type:"button",onClick:()=>s(c=>!c),className:"w-full flex items-center justify-between bg-dark3 border border-dark4 rounded-xl px-3 py-2 text-white",children:[e.jsx("span",{children:d}),e.jsx(W,{className:"w-4 h-4 text-gray-400"})]}),l&&e.jsx("div",{className:"absolute z-50 mt-1 w-full rounded-xl border border-dark4 bg-dark2 shadow-xl",children:e.jsx("ul",{className:"max-h-48 overflow-y-auto py-1",children:i.map(c=>e.jsxs("li",{onClick:()=>{s(!1),c.value!==n&&a(c.value)}
2,className:`cursor-pointer px-3 py-2 text-sm hover:bg-dark3 ${c.value===n?"text-blue-300 font-medium":"text-white"}`,children:[e.jsx("div",{children:c.label}),e.jsx("div",{className:"text-xs text-white/70",children:c.description})]},c.value))})})]})}function G({checked:t,onChange:n,label:a,hint:l}){return e.jsxs("label",{className:"flex items-start gap-3 cursor-pointer select-none",children:[e.jsx("input",{type:"checkbox",checked:!!t,onChange:s=>n(s.target.checked),className:"mt-1 w-4 h-4 accent-blue-500"}),e.jsxs("div",{children:[e.jsx("div",{className:"text-white text-sm",children:a}),l&&e.jsx("div",{className:"text-xs text-white/70",children:l})]})]})}function ve({eventName:t,current:n}){const{toast:a}=w(),l=(n==null?void 0:n.mode)||"groups",s=!!(n!=null&&n.rowNumbersMem),r=!!(n!=null&&n.rowNumbersRec),i=(d,u)=>he(t,d,u,a);return e.jsxs("div",{className:"flex flex-col gap-4",children:[e.jsxs("div",{children:[e.jsx("p",{className:"font-bold text-xl",children:"Default View"}),e.jsx("p",{className:"text-sm text-white/70 max-w-xl",children:R(t)?"Choose how items appear during recall. Memorization for this event is audio-only, so this only applies once recall starts. You can still toggle live during a session using the button in the top bar.":"Choose how items appear during memorization and recall. You can still toggle live during a session using the button in the top bar."})]}),e.jsx(pe,{eventName:t,value:l,onSelect:d=>i("mode",d)}),xe(t)&&e.jsxs("div",{className:"flex flex-col gap-2 mt-1",children:[e.jsx("p",{className:"font-medium text-white/80 text-sm",children:"Row numbers in Grid view"}),!R(t)&&e.jsx(G,{checked:s,onChange:d=>i("rowNumbersMem",d),label:"Show row numbers during memorization",hint:"Off by default â numbers can be distracting when encoding."}),e.jsx(G,{checked:r,onChange:d=>
2i("rowNumbersRec",d),label:"Show row numbers during recall",hint:"Helpful for tracking your place across pages while typing."})]})]})}function be({current:t,mutation:n}){const[a,l]=x.useState(t),{toast:s}=w();x.useEffect(()=>{l(t)},[t]);const r=async()=>{try{if(a===t)return;await n.mutateAsync({phone_format:a}),s({title:"Saved",variant:"success"})}catch(c){console.error("Error while changing phone format settings:",c),s({title:"Error saving",variant:"destructive"})}},i=()=>{(a.match(/X/g)||[]).length!==10?(s({title:"There must be exactly 10 'X' representing 10 digits",variant:"destructive"}),l(phoneFormat)):r()},d=c=>{let h=c.target.value.toUpperCase(),p="";for(let o of h)o==="X"||o==="-"||o===" "?p+=o:p+="X";(p.match(/X/g)||[]).length>10&&(s({id:"phone-format",title:"There must be exactly 10 'X' representing 10 digits",variant:"destructive"}),p=a),l(p)},u=c=>{c.key==="Enter"&&(c.preventDefault(),i())};return e.jsxs("div",{className:"flex flex-col gap-6",children:[e.jsxs("div",{className:"flex flex-col md:flex-row md:items-center",children:[e.jsx("p",{className:"font-bold text-xl text-center md:mr-4",children:"Phone Format"}),e.jsx(j,{type:"text",className:"w-56 border text-center font-medium bg-transparent text-xl",value:a,onChange:d,onBlur:i,onKeyDown:u})]}),e.jsxs("div",{id:"instruction",className:"font-medium",children:[e.jsx("b",{children:"N.B: "})," Each 'X' represents a digit in the phone number. Use '-' or a space to add separation between the digits."]}),e.jsxs("div",{className:"flex flex-col items-center gap-3",children:[e.jsx(Y,{className:"bg-dark2",children:e.jsx(Z,{className:"px-6 py-4 text-xl font-medium",children:ee(a,Array.from({length:10},()=>Math.floor(Math.random()*10)))})}),e.jsx("p",{className:"text-lg",children:"Preview"})]})]})}function we({current:t,mutation:n}){const{event:a}=V(),l=t,{toast:s}=w(),r=async i=>{try{n.mutate({memorize_timer:{[a]:i}}),s({title:"Saved",variant:"success"})}catch(d){console.error("Error while changing memorize timer:",d),s({title:"Error Saving",variant:"destructive"})}};return e.jsxs("div",{className:"flex text-xl items-center",children:[e.jsx("p",{className:"font-bold w-48",children:"Memorize Timer"}),e.jsx(I,{checked:l,onCheckedChange:r})]})}function je({current:t,mutation:n}){const{event:a}=V(),[l,s]=x.useState(t),[r,i]=x.useState(t.interval),{toast:d}=w();x.useEffect(()=>{s(t),i(t.interval)},[t]);const u=f=>{const o=f.target.valueAsNumber;i(o),o!==l.interval&&h("interval",o)},c=()=>{};async function h(f,o){if(o===l[f]||typeof o!="boolean"&&typeof o!="number")return null;try{n.mutate({auto_advance:{[a]:{[f]:o}}}),d({title:"Saved",variant:"success"})}catch(g){console.error("Error updating auto advance settings:",g),d({title:"Error Saving",variant:"destructive"})}s(g=>({...g,[f]:o}))}const p=(f,o)=>g=>{g.key==="Enter"&&(g.preventDefault(),h(f,o))};return e.jsxs("div",{className:"flex flex-col md:flex-row gap-4 items-center",children:[e.jsx("h2",{className:"font-bold text-xl w-48",children:"Auto Advance"}),e.jsxs("div",{className:"flex gap-x-8 gap-y-4 flex-wrap items-center font-medium",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(N,{className:"text-base",children:"Active"}),e.jsx(I,{checked:l.active,onCheckedChange:f=>h("active",f)})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(N,{className:"text-base",children:"Loop"}),e.jsx(I,{checked:l.repeat,onCheckedChange:f=>h("repeat",f)})]}),e.jsxs("div",{className:"flex gap-2 items-center",children:[e.jsx(N,{className:"text-base",children:"Interval(s)"}),e.jsx(j,{type:"number",className:"w-16 border bg-transparent",value:r,onBlur:c,onChange:u,onKeyDown:p("interval",r)})]})]})]})}const ye=({number:t})=>{const n=t<2?25:40;return e.jsx("div",{className:"relative h-[180px]",style:{width:`${120+n*(t-1)}px`},children:Array.from({length:t}).map((a,l)=>e.jsx("div",{className:"absolute top-0",style:{left:`${n*l}px`},children:e.jsx("img",{src:M,className:"h-[180px] aspect-auto border rounded-md"})},l))})},Ne=500;function E(t,n){const[a,l]=x.useState(t),s=x.useRef(null),r=x.useRef(!1),i=x.useRef(!1),d=x.useRef(t),u=x.useRef(n);u.current=n,x.useEffect(()=>{r.current||i.current||(l(t),d.current=t)},[t]);function c(o){const g=Number(o);!Number.isFinite(g)||g<1||g!==d.current&&(d.current=g,i.current=!0,Promise.resolve(u.current(g)).finally(()=>{i.current=!1}))}function h(o){l(o),s.current&&clearTimeout(s.current),s.current=setTimeout(()=>{s.current=null,c(o)},Ne)}function p(o=a){s.current&&(clearTimeout(s.current),s.current=null);const g=Number(o);if(!Number.isFinite(g)||g<1){l(d.current);return}c(g)}const f=x.useRef(a);return f.current=a,x.useEffect(()=>()=>{s.current&&(clearTimeout(s.current),c(f.current))},[]),{number:a,onChange:h,flush:p,onFocus:()=>{r.current=!0},onBlur:o=>{r.current=!1,p(o)}}}function Se({current:t,mutation:n}){const{toast:a}=w(),s=E(t,r=>{try{n.mutate({cards_group_number:r}),a({title:"Saved",variant:"success"})}catch(i){console.error("Error updating cards in group:",i),a({title:"Failed to save number",variant:"destructive"})}});return e.jsxs("div",{className:"flex flex-col gap-6",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx("p",{className:"font-bold text-xl capitalize",children:"Cards in group"}),e.jsx(j,{name:"cards_group_number",className:"w-56 border text-center bg-transparent font-medium text-lg",type:"number",value:s.number,onChange:r=>s.onChange(r.target.value),onFocus:s.onFocus,onBlur:r=>s.onBlur(r.target.value),onKeyDown:r=>{r.key==="Enter"&&(r.preventDefault(),s.flush(r.target.value))}})]}),e.jsxs("div",{className:"flex flex-col items-center gap-6",children:[e.jsx(ye,{number:s.number}),e.jsx("p",{className:"mt-3 font-medium text-lg",children:"Preview"})]})]})}const B=({number:t})=>e.jsx("div",{className:"flex space-x-4 overflow-x-auto",children:Array.from({length:t}).map((n,a)=>e.jsx("img",{src:M,alt:`Preview ${a+1}`,className:"border rounded-md object-cover w-16 h-16 sm:w-20 sm:h-20 md:w-24 md:h-24 lg:w-28 lg:h-28"},a))});function _e({current:t,mutation:n}){const{toast:a}=w(),s=E(t,r=>{try{n.mutate({images_group_number:r}),a({title:"Saved",variant:"success"})}catch(i){console.error("Error updating images in group:",i),a({title:"Failed to save number",variant:"destructive"})}});return e.jsxs("div",{className:"flex flex-col gap-6",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx("p",{className:"font-bold text-xl capitalize",children:"Images in group"}),e.jsx(j,{name:"images_group_number",className:"w-56 border text-center bg-transparent font-medium text-lg",type:"number",value:s.number,onChange:r=>s.onChange(r.target.value),onFocus:s.onFocus,onBlur:r=>s.onBlur(r.target.value),onKeyDown:r=>{r.key==="Enter"&&(r.preventDefault(),s.flush(r.target.value))}})]}),e.jsxs("div",{className:"flex flex-col items-center gap-6",children:[e.jsx(B,{number:s.number}),e.jsx("p",{className:"mt-3 font-medium text-lg",children:"Preview"})]})]})}function Ee({current:t,mutation:n}){const{toast:a}=w(),s=E(t,r=>{try{n.mutate({colors_group_number:r}),a({title:"Saved",variant:"success"})}catch(i){console.error("Error updating colors in group:",i),a({title:"Failed to save number",variant:"destructive"})}});return e.jsxs("div",{className:"flex flex-col gap-6",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx("p",{className:"font-bold text-xl capitalize",children:"Colors in group"}),e.jsx(j,{name:"colors_group_number",className:"w-56 border text-center bg-transparent font-medium text-lg",type:"number",value:s.number,onChange:r=>s.onChange(r.target.value),onFocus:s.onFocus,onBlur:r=>s.onBlur(r.target.value),onKeyDown:r=>{r.key==="Enter"&&(r.preventDefault(),s.flush(r.target.value))}})]}),e.jsxs("div",{className:"flex flex-col items-center gap-6",children:[e.jsx(B,{number:s.number}),e.jsx("p",{className:"mt-3 font-medium text-lg",children:"Preview"})]})]})}function Ce({number:t}){return e.jsx("div",{className:"flex flex-col space-y-2 overflow-y-auto",children:Array.from({length:t}).map((n,a)=>e.jsx("div",{className:`border rounded-md flex items-center justify-center 3 w-40 sm:w-56 md:w-64 lg:w-72 4 h-8 sm:h-10 md:h-10 lg:h-10 5 bg-muted/40 text-sm font-medium`,children:a+1},a))})}function Te({current:t,mutation:n}){const{toast:a}=w(),s=E(t,r=>{try{n.mutate({words_group_number:r}),a({title:"Saved",variant:"success"})}catch(i){console.error("Error updating words in group:",i),a({title:"Failed to save number",variant:"destructive"})}});return e.jsxs("div",{className:"flex flex-col gap-6",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx("p",{className:"font-bold text-xl capitalize",children:"Words in group"}),e.jsx(j,{name:"words_group_number",className:"w-56 border text-center bg-transparent font-medium text-lg",type:"number",value:s.number,onChange:r=>s.onChange(r.target.value),onFocus:s.onFocus,onBlur:r=>s.onBlur(r.target.value),onKeyDown:r=>{r.key==="Enter"&&(r.preventDefault(),s.flush(r.target.value))}})]}),e.jsxs("div",{className:"flex flex-col items-center gap-6",children:[e.jsx(Ce,{number:s.number}),e.jsx("p",{className:"mt-3 font-medium text-lg",children:"Preview"})]})]})}function Fe({number:t}){return e.jsx("div",{className:"flex flex-col space-y-2 overflow-y-auto",children:Array.from({length:t}).map((n,a)=>e.jsx("div",{className:`border rounded-md flex items-center 6 w-56 md:w-64 lg:w-72 h-10 bg-muted/40 text-sm font-medium 7 justify-center`,children:a+1},a))})}function Ve({current:t,mutation:n}){const{toast:a}=w(),s=E(t,r=>{try{n.mutate({dates_group_number:r}),a({title:"Saved",variant:"success"})}catch(i){console.error("Error updating dates in group:",i),a({title:"Failed to save number",variant:"destructive"})}});return e.jsxs("div",{className:"flex flex-col gap-6",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx("p",{className:"font-bold text-xl capitalize",children:"Dates in group"}),e.jsx(j,{name:"dates_group_number",className:"w-56 border text-center bg-transparent font-medium text-lg",type:"number",value:s.number,onChange:r=>s.onChange(r.target.value),onFocus:s.onFocus,onBlur:r=>s.onBlur(r.target.value),onKeyDown:r=>{r.key==="Enter"&&(r.preventDefault(),s.flush(r.target.value))}})]}),e.jsxs("div",{className:"flex flex-col items-center gap-6",children:[e.jsx(Fe,{number:s.number}),e.jsx("p",{className:"mt-3 font-medium text-lg",children:"Preview"})]})]})}const _=5*60*1e3,De=({eventName:t})=>{var d;const{toast:n}=w(),a=q(),l=F({queryKey:["timeVariants"],queryFn:async()=>await(await fetch("/api/time-variant/all")).json(),staleTime:1/0}),s=F({queryKey:["userTimeVariantSetting",t],queryFn:async()=>(await fetch(`/api/user/settings/time-variant?eventName=${t}`)).json(),staleTime:_}),r=$({mutationFn:async u=>(await fetch(`/api/user/settings/time-variant?eventName=${t}&timeVariantId=${u}`,{method:"POST"}),u),onSuccess:async u=>{a.setQueryData(["userTimeVariantSetting",t],c=>({...c,timeVariantId:u})),a.prefetchQuery({queryKey:["user-rank",u,t],queryFn:async()=>(await fetch(`/api/user/rank?timeVariantId=${u}&eventName=${t}`)).json(),staleTime:_}),a.prefetchQuery({queryKey:["userSettings",t,u],queryFn:async()=>(await fetch(`/api/user/settings?eventName=${t}&timeVariantId=${u}`)).json(),staleTime:_}),a.prefetchQuery({queryKey:["userStandardLevel",t,u],queryFn:async()=>(await fetch(`/api/user/standard-level?eventName=${t}&timeVariantId=${u}`)).json(),staleTime:_}),a.prefetchQuery({queryKey:["data-metrics",t,u],queryFn:async()=>(await fetch(`/api/bmevent/standard-data-metrics?eventName=${t}`)).json(),staleTime:_}),n({title:"Saved",variant:"success"})}}),i=async u=>{r.mutate(u)};return e.jsxs("div",{className:"space-y-1",children:[e.jsx(N,{children:"Time Variant"}),e.jsxs(te,{value:((d=s.data)==null?void 0:d.timeVariantId)||"",onValueChange:i,children:[e.jsx(se,{className:"bg-white/5",children:e.jsx(re,{placeholder:"Loading..."})}),e.jsxs(ae,{className:"bg-dark2",children:[l.isLoading&&e.jsx("div",{className:"flex items-center justify-center p-4",children:e.jsx(ne,{className:"animate-spin"})}),l.isSuccess&&l.data.map(u=>e.jsxs(ie,{value:u._id,className:"focus:bg-dark3",children:["Mem: ",u.memTime,", Rec: ",u.recTime]},u._id))]})]})]})},Ie=["binary","decimal","numerics","phonics","alphabet","password"];function ke(){var p;const{event:t}=V(),n=q(),a=5*60*1e3,s=(p=F({queryKey:["userTimeVariantSetting",t],queryFn:async()=>await(await fetch(`/api/user/settings/time-variant?eventName=${t}`)).json(),staleTime:a}).data)==null?void 0:p.timeVariantId,r=F({queryKey:["userSettings",t,s],queryFn:async()=>await(await fetch(`/api/user/settings?eventName=${t}&timeVariantId=${s}`)).json(),enabled:!!s,staleTime:a}),i=r.data,d=$({mutationFn:async f=>{const o=le(r.data,f);return await fetch(`/api/user/settings?eventName=${t}&timeVariantId=${s}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(o)}),o},onSuccess:f=>{n.setQueryData(["userSettings",t,s],f)}}),u=$({mutationFn:async({event:f,key:o,value:g})=>{if(!(await fetch(`/api/user/event/settings/options/${f}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({key:o,value:g})})).ok)throw new Error("Failed to save format setting");return{event:f,key:o,value:g}},onSuccess:({event:f,key:o,value:g})=>{T.set(y=>{var C;return{...y,settings:{...y.settings,[`${f}_format`]:{...((C=y.settings)==null?void 0:C[`${f}_format`])||{},[o]:g}}}})}}),c=T(f=>{var o;return(o=f.settings)==null?void 0:o[`${t}_format`]}),h=T(f=>{var o;return(o=f.settings)==null?void 0:o[`${t}_view`]});return i?e.jsxs("div",{className:"w-full h-full flex flex-col gap-8",children:[t!=="tetris"&&e.jsx("div",{className:"md:w-2/3 lg:w-1/2",children:e.jsx(De,{eventName:t})}),["names","biography","animals","words","dates","numerics","phonics"].includes(t)&&e.jsx("div",{className:"md:w-2/3 lg:w-1/2",children:e.jsx(ce,{eventName:t})}),Ie.includes(t)&&c&&e.jsx(fe,{current:c,mutation:u}),oe.includes(t)&&e.jsx(ve,{eventName:t,current:h}),t==="biography"&&e.jsx(be,{current:i.phone_format,mutation:d}),t==="cards"&&e.jsx(Se,{current:i.cards_group_number,mutation:d}),t==="images"&&e.jsx(_e,{current:i.images_group_number,mutation:d}),t==="colors"&&e.jsx(Ee,{current:i.colors_group_number,mutation:d}),t==="words"&&e.jsx(Te,{current:i.words_group_number,mutation:d}),t==="dates"&&e.jsx(Ve,{current:i.dates_group_number,mutation:d}),e.jsx(we,{current:i.memorize_timer[t],mutation:d}),t!=="tetris"&&t!=="numerics"&&t!=="phonics"&&e.jsx(je,{current:i.auto_advance[t],mutation:d})]}):null}export{ke as default};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.