1import{b as q,r as o,j as e}from"./react-vendor-BLYYt06-.js";import{as as p,$ as D,F as S,i as I,Y as U,_ as O}from"./index-DRaU3u4n.js";import{u as $,a as H}from"./app-language-COTiUCjK.js";import{f as E,D as P,T as w}from"./teacherAvatarCatalog-DhzpZKl3.js";import{u as M}from"./user-service-CGisFhqW.js";import{T as V}from"./TeacherStudioLayout-Cl17GP7g.js";import{M as Y,A as F,L as G}from"./MfaSettings-Cy38PTKJ.js";import{U as z}from"./user-round-CZYPBPvq.js";import{S as B}from"./sparkles-DXIrBJBk.js";import"./teacher-studio-CFABJaVc.js";import"./teacherDemoStoryMedia-D1zdjcJh.js";import"./arrow-right-IQKFWU7J.js";import"./users-DR5frBTg.js";import"./book-open-qE86IEC8.js";import"./file-text-BlFP_SLW.js";import"./layout-grid-te742D4k.js";import"./plus-DHmRiFNG.js";import"./spell-check-CcvkmWHx.js";import"./chart-column-BHts5btP.js";import"./settings-DDOPtZ-9.js";import"./log-out-B1CnAJTD.js";import"./volume-x-BIiX-kJ8.js";import"./lock-3PMQ661V.js";import"./index.esm-CW2j8NTB.js";import"./index.esm2017-DCc8sxVG.js";import"./firebase-ByTXQOh0.js";import"./index.esm-BM5n8jef.js";import"./mfa-service-DxJbMJh4.js";const J=a=>{var d;return((d=E((a==null?void 0:a.avatarKey)||(a==null?void 0:a.profilePicture)))==null?void 0:d.avatarKey)||P.avatarKey},T={en:{eyebrow:"Teacher profile",title:"Choose your teacher avatar",description:"Name your avatar, then choose the adult visual style that feels most like you. Both are used across teacher-led stories.",chooseEyebrow:"Your choice",chooseTitle:"Teacher avatar",chooseDescription:"The name pupils see comes from you. The numbered options below only identify visual styles while you choose.",option:a=>`Avatar style ${a}`,current:a=>`Current avatar: ${a}`,nameLabel:"Avatar name",nameHint:"This is the name pupils see in class stories.",namePlaceholder:"For example, Sam",nameRequired:"Give your teacher avatar a name before saving.",note:"Your named avatar appears in the profile menu and teacher-led story tools.",save:"Save avatar",saving:"Savingâ¦",saved:"Teacher avatar saved.",savedState:"Avatar saved",saveError:"We could not save your teacher avatar",tryAgain:"Please try again."},es:{eyebrow:"Perfil del profesor",title:"Elige tu avatar de profesor",description:"Ponle un nombre a tu avatar y elige el estilo visual adulto que más se parezca a ti. Ambos se usan en las historias de clase.",chooseEyebrow:"Tu elección",chooseTitle:"Avatar de profesor",chooseDescription:"Tú eliges el nombre que ven los alumnos. Los números solo identifican los estilos visuales durante la selección.",option:a=>`Estilo de avatar ${a}`,current:a=>`Avatar actual: ${a}`,nameLabel:"Nombre del avatar",nameHint:"Este es el nombre que verán los alumnos en las historias de clase.",namePlaceholder:"Por ejemplo, Sam",nameRequired:"Ponle un nombre al avatar antes de guardar.",note:"Tu avatar con nombre aparece en el menú del perfil y en las historias dirigidas por profesores.",save:"Guardar avatar",saving:"Guardandoâ¦",saved:"Avatar de profesor guardado.",savedState:"Avatar guardado",saveError:"No hemos podido guardar tu avatar de profesor",tryAgain:"Inténtalo de nuevo."},fr:{eyebrow:"Profil enseignant",title:"Choisis ton avatar enseignant",description:"Nomme ton avatar, puis choisis le style visuel adulte qui te ressemble. Les deux sont utilisés dans les histoires de classe.",chooseEyebrow:"Ton choix",chooseTitle:"Avatar enseignant",chooseDescription:"Tu choisis le nom visible par les élèves. Les numéros servent seulement à distinguer les styles visuels pendant la sélection.",option:a=>`Style dâavatar ${a}`,current:a=>`Avatar actuel : ${a}`,nameLabel:"Nom de lâavatar",nameHint:"Câest le nom que les élèves verront dans les histoires de classe.",namePlaceholder:"Par exemple, Sam",nameRequired:"Donne un nom à lâavatar avant dâenregistrer.",note:"Ton avatar nommé apparaît dans le menu du profil et les histoires animées par lâenseignant.",save:"Enregistrer lâavatar",saving:"Enregistrementâ¦",saved:"Avatar enseignant enregistré.",savedState:"Avatar enregistré",saveError:"Impossible dâenregistrer ton avatar enseignant",tryAgain:"Réessaie."}};function Se(){const a=$(),d=H(),t=T[d.code]||T.en,[_]=q(),[c,g]=o.useState(()=>_.get("view")==="security"?"security":"avatar"),[n,K]=o.useState(()=>p("user")||{}),[b,C]=o.useState(()=>J(p("user"))),[u,L]=o.useState(b),[x,k]=o.useState(()=>{var s,r;return String(((s=p("user"))==null?void 0:s.teacherAvatarName)||((r=p("user"))==null?void 0:r.avatarName)||"").trim()}
1),[m,y]=o.useState(x),[v,N]=o.useState(!1),[j,h]=o.useState(""),l=o.useMemo(()=>E(u)||P,[u]),f=u!==b||m.trim()!==x,R=async()=>{h("");const s=m.trim();if(!s){h(t.nameRequired);return}N(!0);try{let r;if(I())r={...n,avatarKey:l.avatarKey,profilePicture:l.avatarKey,teacherAvatarName:s};else{const i=await M.updateMyUser({profilePicture:l.avatarKey,teacherAvatarName:s});if(i!=null&&i.error)throw new Error(i.error);r=(i==null?void 0:i.updatedUser)||{...n,profilePicture:l.avatarKey,teacherAvatarName:s}}K(r),C(l.avatarKey),k(s),y(s),localStorage.setItem("user",JSON.stringify(r)),window.dispatchEvent(new Event(U)),window.dispatchEvent(new Event("storage")),O.success(t.saved)}catch(r){h((r==null?void 0:r.message)||t.saveError)}finally{N(!1)}},A=[n==null?void 0:n.firstName,n==null?void 0:n.lastName].filter(Boolean).join(" ")||a.teacher.teacher;return e.jsx(V,{eyebrow:t.eyebrow,title:c==="avatar"?t.title:"Account security",description:c==="avatar"?"Your avatar is the teacher pupils meet in class stories. Pick a look and a name they will recognise.":"Manage two-step verification and the devices signed in to your account.",fit:!0,actions:e.jsxs("div",{className:"ts-segment",role:"tablist","aria-label":"Profile sections",children:[e.jsxs("button",{type:"button",role:"tab","aria-selected":c==="avatar",className:c==="avatar"?"is-active":"",onClick:()=>g("avatar"),children:[e.jsx(z,{"aria-hidden":"true"}),"Avatar"]}),e.jsxs("button",{type:"button",role:"tab","aria-selected":c==="security",className:c==="security"?"is-active":"",onClick:()=>g("security"),children:[e.jsx(D,{"aria-hidden":"true"}),"Security"]})]}),children:c==="avatar"?e.jsxs("div",{className:"grid min-h-0 flex-1 gap-5 laptop:grid-cols-[340px_minmax(0,1fr)]",children:[e.jsxs("section",{className:"ts-card ts-rise flex min-h-0 flex-col !p-5",children:[e.jsxs("div",{className:"relative grid min-h-0 flex-1 place-items-end overflow-hidden rounded-[18px] bg-gradient-to-b from-[#dff2fd] via-[#eef8ff] to-[#fff6d9]",children:[e.jsxs("span",{className:"absolute left-3 top-3 ts-chip ts-chip--blue",children:[e.jsx(B,{"aria-hidden":"true"}),"Preview"]}),e.jsx("img",{src:l.previewSrc||l.src,alt:"",className:"h-full max-h-[340px] w-full object-contain object-bottom mix-blend-multiply"})]}),e.jsxs("label",{className:"ts-field mt-4",children:[e.jsx("span",{className:"ts-label",children:t.nameLabel}),e.jsx("input",{className:"ts-input",value:m,onChange:s=>y(s.target.value),placeholder:t.namePlaceholder,maxLength:32,required:!0}),e.jsx("span",{className:"ts-hint",children:t.nameHint})]}),j?e.jsxs("p",{className:"mt-3 rounded-[10px] bg-[#fff2f0] px-3 py-2 text-sm font-medium text-[#b42318]",role:"alert",children:[j,". ",t.tryAgain]}):null,e.jsxs("button",{type:"button",onClick:R,disabled:!f||v||!m.trim(),className:"ts-btn ts-btn--primary ts-btn--lg ts-btn--block mt-4",children:[!f&&!v?e.jsx(S,{"aria-hidden":"true"}):null,v?t.saving:f?t.save:t.savedState]})]}),e.jsxs("section",{className:"ts-card ts-rise flex min-h-0 flex-col !p-5",children:[e.jsxs("div",{className:"ts-card__head",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"ts-card__title",children:t.chooseTitle}
1),e.jsxs("p",{className:"ts-card__desc",children:[A," · ",t.note]})]}),e.jsxs("span",{className:"ts-chip",children:[w.length," looks"]})]}),e.jsxs("fieldset",{className:"ts-scroll min-h-0 flex-1 pr-1",children:[e.jsx("legend",{className:"sr-only",children:t.chooseTitle}),e.jsx("div",{className:"grid grid-cols-3 gap-3 sm:grid-cols-5",children:w.map((s,r)=>{const i=s.avatarKey===l.avatarKey;return e.jsxs("label",{className:"group cursor-pointer",children:[e.jsx("input",{type:"radio",name:"teacher-avatar",value:s.avatarKey,checked:i,onChange:()=>L(s.avatarKey),className:"peer sr-only","aria-label":t.option(r+1)}),e.jsxs("span",{className:`relative flex aspect-[4/5] max-h-[150px] w-full items-end justify-center overflow-hidden rounded-[16px] border-2 bg-gradient-to-b from-[#f4f9ff] to-[#fff8e6] transition-[border-color,box-shadow,transform] duration-150 peer-focus-visible:outline peer-focus-visible:outline-[3px] peer-focus-visible:outline-offset-2 peer-focus-visible:outline-[#006afd] motion-safe:group-active:scale-[0.97] ${i?"border-[#3fae4c] shadow-[0_0_0_4px_rgba(63,174,76,0.18)]":"border-[#e2ebf8] hover:border-[#9cc1f5]"}`,children:[e.jsx("img",{src:s.thumbnail||s.src,alt:"",className:"h-[92%] w-full object-contain object-bottom mix-blend-multiply",draggable:"false"}),i?e.jsx("span",{className:"absolute right-2 top-2 grid size-6 place-items-center rounded-full bg-[#3fae4c] text-white shadow-sm","aria-hidden":"true",children:e.jsx(S,{className:"size-4 stroke-[3]"})}):null]})]},s.avatarKey)})})]})]})]}):e.jsxs("div",{className:"ts-scroll grid min-h-0 flex-1 content-start gap-4 laptop:grid-cols-2",children:[e.jsxs("div",{className:"ts-card ts-rise !p-5 [&>section]:!mt-0 [&>section]:!border-0 [&>section]:!bg-transparent [&>section]:!p-0",children:[e.jsx(Y,{}),e.jsx("p",{className:"ts-hint mt-3",children:"If two-step verification is not listed, it is not yet switched on for this Litsee server."})]}),e.jsxs("div",{className:"ts-card ts-rise !p-5 [&>section]:!mt-0 [&>section]:!border-0 [&>section]:!bg-transparent [&>section]:!p-0",children:[e.jsx(F,{}),e.jsxs("div",{className:"ts-empty mt-2",children:[e.jsx(G,{"aria-hidden":"true"}),e.jsxs("strong",{children:["Signed in as ",A]}),e.jsx("p",{children:"Use Log out in the profile menu to end this session."})]})]})]})})}export{Se 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.