import{k as Se,r as s,dk as ke,h as c,F as m,j as e,K as i,dl as y,$ as E,I as oe,Y as L,a0 as re,a1 as f,a2 as Ae,B as Ue}from"./vendor.e6eaca24.js";import{s as a}from"./UserEditPage.66f2d9f8.js";import{a as ue,R as se,m as ze,u as De,c as Pe,b as u,h as Re,q as ie,v as S,w as k,t as A,i as p,x as le}from"./index.c6944236.js";import{u as Xe}from"./useAsyncCallbackPending.bf7bbf90.js";import{r as je,f as We,d as ce}from"./CodeFormatter.cc19f225.js";import{C as U,f as He}from"./CodeLanguage.24acdb11.js";import{C as Me,H as de}from"./CodeBox.16e9a888.js";import{C as Be}from"./CodeLanguageAndOptions.76c2a300.js";import"./validators.ad4c624c.js";import"./v4.90f1a8cc.js";async function nt(r){const{requestError:t,response:h}=await ue.user.getUserPreference({username:r});if(t)throw new se(t,{showRefresh:!0,showBack:!0});if(h.error)throw new se(ze(`user_edit.errors.${h.error}`));return await je,h}const z=r=>e("span",{style:{fontFamily:`"${r.fontFace}"`},children:r.fontFace}),qe=r=>{var M,B,q,V,$,K,G,J,Q,Y,Z,ee,te,ae;const t=De("user_edit.preference"),h=Pe();s.exports.useEffect(()=>{u.enterNewPage(`${t(".title")} - ${r.meta.username}`,null,!1)},[u.locale,r.meta]);const[Ve,l]=Re(),[C,me]=s.exports.useState(((M=r.preference.locale)==null?void 0:M.system)||null),[D,fe]=s.exports.useState(((B=r.preference.locale)==null?void 0:B.content)||null),[P,pe]=s.exports.useState(((q=r.preference.locale)==null?void 0:q.hideUnavailableMessage)||!1),[N,he]=s.exports.useState(r.preference.theme in ie?r.preference.theme:""),[O,ge]=s.exports.useState(((V=r.preference.font)==null?void 0:V.contentFontFace)||S[0]||"sans-serif"),[w,ye]=s.exports.useState((($=r.preference.font)==null?void 0:$.codeFontFace)||k[0]||"monospace"),[v,Ce]=s.exports.useState(((K=r.preference.font)==null?void 0:K.codeFontSize)||14),[_,Ne]=s.exports.useState(((G=r.preference.font)==null?void 0:G.codeLineHeight)||1.3),[b,Ie]=s.exports.useState(((J=r.preference.font)==null?void 0:J.codeFontLigatures)!==!1),[T,R]=s.exports.useState(((Q=r.preference.font)==null?void 0:Q.markdownEditorFont)||"content"),[F,Ee]=s.exports.useState(((Y=r.preference.codeFormatter)==null?void 0:Y.options)||""),[X,Oe]=s.exports.useState(!!((Z=r.preference.codeFormatter)==null?void 0:Z.disableByDefault)),[x,we]=s.exports.useState(Object.values(U).includes((ee=r.preference.code)==null?void 0:ee.defaultLanguage)?(te=r.preference.code)==null?void 0:te.defaultLanguage:U.Cpp),[j,ve]=s.exports.useState(He(x,(ae=r.preference.code)==null?void 0:ae.defaultCompileAndRunOptions)),W=le,H=C||le;s.exports.useEffect(()=>(u.temporaryThemeOverride=N,()=>u.temporaryThemeOverride=null),[N]);const[g,_e]=Xe(async()=>{var ne;const n={locale:{system:C,content:D,hideUnavailableMessage:P},theme:N,font:{contentFontFace:O,codeFontFace:w,codeFontSize:v,codeLineHeight:_,codeFontLigatures:b,markdownEditorFont:T},codeFormatter:{options:F,disableByDefault:X},code:{defaultLanguage:x,defaultCompileAndRunOptions:j}},{requestError:o,response:d}=await ue.user.updateUserPreference({userId:r.meta.id,preference:n});if(o)A.error(o(t));else if(d.error)A.error(t(`.${d.error}`));else if(l(!1),A.success(t(".success")),u.currentUser.id===r.meta.id){const Le=((ne=u.userPreference.locale)==null?void 0:ne.system)!==C;ke(u.userPreference,n),Le&&h.refresh()}}),be="<h2>A Harmony of LIGHT</h2><p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. A scelerisque purus semper eget duis at tellus at. Adipiscing elit duis tristique sollicitudin nibh.</p><h2>Awaits You in a Lost WORLD</h2><p>Velit sed ullamcorper morbi tincidunt ornare. Suscipit tellus mauris a diam maecenas. Tellus integer feugiat scelerisque varius morbi enim nunc. Eget aliquet nibh praesent tristique. Interdum posuere lorem ipsum dolor sit. Sed sed risus pretium quam vulputate dignissim suspendisse in est.</p><p>Elementum sagittis vitae et leo duis. Neque convallis a cras semper auctor. Justo eget magna fermentum iaculis eu non diam.</p>",Te=`// **Comments**
if ((a->b <=> c++) >= 0xFF && f(d || e) != (g << h)) {
    /* Do something */
    int abcdefghijklmn = OPQRSTUVWXYZ;
    int ABCDEFGHIJKLMN = opqrstuvwxyz;
}

return 1234567890;`,Fe=`#include<world.h>

int main() {
// ~ Switch on the power line / Remember to put on PROTECTION ~
world.start();

// ~ Lay down your pieces / And let's begin OBJECT CREATION ~
// ~ Fill in my data / Parameters INITIALIZATION ~
auto*me = World::createObject("me",world,parameters...);
auto &you = *World::createObject("you",world,parameters...);

// ~ Set up our new world ~
auto& world = World{me,you};

// ~ And let's begin the SIMULATION ~
world.beginSimulation();

      switch(me->type) {
        case Object::SET_OF_POINTS:
          // ~ If I'm a set of points / Then I will give you my DIMENSION ~
        you << dynamic_cast<Set<Point>*>(me)->getDimension(); break;
    case Object::CIRCLE:
  // ~ If I'm a circle / Then I will give you my CIRCUMFERENCE ~
  you << dynamic_cast<Circle* >(me)->getCircumference();
  break;
    case Object::SINE_WAVE:
      // ~ If I'm a sine wave / Then you can sit on all my TANGENTS ~
          for (auto&tangent:dynamic_cast<SineWave*>(me)->getTangents())
        you.sitOn(tangent);
      break;
    default:
  // ~ If I approach infinity / Then you can be my LIMITATIONS ~
    you.limit()>>me->limit();
}

    // ~ Switch my current / To AC to DC ~
    me->setCurrent(CurrentType::AC),me->setCurrent(CurrentType::DC);

    // ~ And then blind my vision / So dizzy, so dizzy ~
    delete me->vision;

// ~ Oh, we can travel / From A.D to B.C ~
world.setTime(CommonEra::AD,2016y+6m+16d);
world.setTime(CommonEra::BC,-2016y+6m+16d);

    // ~ And we can unite / So deeply, so deeply ~
    world.unite(you, *me);

    // ~ If I can, if I can, give you all THE SIMULATIONS ~
    if (std::all_of(world.simulations.begin(), world.simulations.end(), [&] (auto &simulation) {
return you << me->run(simulation);
}))
        // ~ Then I can, then I can, be your only SATISFACTION ~
        you.satisfactions = std::vector{me};

    // ~ If I can make you happy / Then I'll run the EXECUTION ~
    try
    {
      me->execute(you.nextCommand());
    } catch (const NotHappyException &e) {}

    // ~ Though we are trapped in this strange, strange SIMULATION ~
    world.trap(me);

    // ~ EXECUTION / EXECUTION / EXECUTION / EXECUTION ~
    // ~ EXECUTION / EXECUTION / EXECUTION / EXECUTION ~
    // ~ EXECUTION / EXECUTION / EXECUTION / EXECUTION ~
    for (size_t i = 0; i < 3; i++){
      for (size_t j = 0; j < 4; j++) world.continueExecution();
    }

    // ~ EIN / DOS / TROIS / NE / FEM / LIU / EXECUTION ~
    for (size_t i = 1; i <= 6; i++)
        sleepms(500);
    world.continueExecution();

    // ~ If I can, if I can, give you all the EXECUTION ~
    if (std::all_of(world.begin(), world.end(), [&] (auto &object) {
      return me->execute(object);
 }))
        // ~ Then I can, then I can, be your only EXECUTION ~
        me->execute(you.nextCommand());

    // ~ If I can, have you back ~
    if (*me << you)
        // ~ Then I will run the EXECUTION ~
        me->execute(you.nextCommand());
    
// ~ Though we are trapped / We are trapped ah ~
world.trap(me);

// ~ I've studied / I've studied how to properly / LO-O-OVE ~
me->study(Knowledge::Love);
// ~ Question me / Question me / I can answer all / LO-O-OVE ~
you.question(me, Knowledge::Love);
// ~ I know the algebraic expression of / LO-O-OVE ~
me->answer(you, Knowledge::Love);
// ~ Though you are free / I am trapped, trapped in / LO-O-OVE ~
world.trap(me);

// ~ EXECUTION ~
world.execute(me);
}
`,[I,xe]=We(Fe,U.Cpp,F||ce);return c(m,{children:[e(i,{className:a.sectionHeader,size:"large",content:t(".locale.header")}),e(i,{className:a.header,size:"tiny",content:t(".locale.system")}),e(y,{className:a.notFullWidth+" "+a.localeSelect,fluid:!0,value:C||"DEFAULT",onChange:(n,{value:o})=>(l(!0),me(o==="DEFAULT"?null:o)),options:[{key:"DEFAULT",value:"DEFAULT",text:r.meta.id===u.currentUser.id?c(m,{children:[e(E,{name:p[W].flag}),t(".locale.system_default_name",{name:p[W].name})]}):c(m,{children:[e(oe,{name:"globe"}),t(".locale.system_default")]})},...Object.entries(p).map(([n,o])=>({text:c(m,{children:[e(E,{name:o.flag}),o.name]}),value:n,key:n}))]}),e("div",{className:a.notes,children:t(".locale.system_notes")}),e(i,{className:a.header,size:"tiny",content:t(".locale.content")}),e(y,{className:a.notFullWidth+" "+a.localeSelect,fluid:!0,value:D||"DEFAULT",onChange:(n,{value:o})=>(l(!0),fe(o==="DEFAULT"?null:o)),options:[{key:"DEFAULT",value:"DEFAULT",text:r.meta.id===u.currentUser.id?c(m,{children:[e(E,{name:p[H].flag}),t(".locale.content_default_name",{name:p[H].name})]}):c(m,{children:[e(oe,{name:"globe"}),t(".locale.content_default")]})},...Object.entries(p).map(([n,o])=>({text:c(m,{children:[e(E,{name:o.flag}),o.name]}),value:n,key:n}))]}),e("div",{className:a.notes,children:t(".locale.content_notes")}),e(L,{className:a.checkbox,checked:P,label:t(".locale.hide_unavailable_message"),onChange:(n,{checked:o})=>!g&&(l(!0),pe(o))}),e(i,{className:a.sectionHeader,size:"large",content:t(".appearance.header")}),e(i,{className:a.header,size:"tiny",content:t(".appearance.theme")}),e(y,{className:a.notFullWidth,fluid:!0,value:N||"auto",onChange:(n,{value:o})=>(l(!0),he(o==="auto"?"":o)),options:["auto",...Object.keys(ie)].map(n=>({key:n,value:n,text:c(m,{children:[t(`.appearance.themes.${n}.name`),e("div",{className:a.notes+" "+a.selectOptionNotes,children:t(`.appearance.themes.${n}.description`)})]})}))}),e(i,{className:a.header,size:"tiny",content:t(".appearance.content_font_face")}),e("div",{className:a.forceLoadFonts,children:[...k,...S].map(n=>e(z,{fontFace:n},n))}),e(y,{className:a.notFullWidth+" "+a.fontSelect,fluid:!0,value:O,onChange:(n,{value:o})=>(l(!0),ge(o)),options:[{key:"sans-serif",value:"sans-serif",text:e("span",{style:{fontFamily:"sans-serif"},children:t(".appearance.system_default_sans_serif")})},{key:"serif",value:"serif",text:e("span",{style:{fontFamily:"serif"},children:t(".appearance.system_default_serif")})},...S.map(n=>({text:e(z,{fontFace:n}),value:n,key:n}))]}),e(i,{className:a.header,size:"tiny",content:t(".appearance.content_preview")}),e(Me,{className:"content-font",segment:{color:"pink"},html:be,fontFaceOverride:O,wrap:!0}),e(i,{className:a.header,size:"tiny",content:t(".appearance.code_font_face")}),e(y,{className:a.notFullWidth+" "+a.fontSelect,fluid:!0,value:w,onChange:(n,{value:o})=>(l(!0),ye(o)),options:[{key:"monospace",value:"monospace",text:e("span",{style:{fontFamily:"monospace"},children:t(".appearance.system_default")})},...k.map(n=>({text:e(z,{fontFace:n}),value:n,key:n}))]}),e(i,{className:a.header,size:"tiny",content:t(".appearance.code_font_size")}),e(re,{className:a.notFullWidth,fluid:!0,value:v,type:"number",min:5,max:20,step:.5,onChange:(n,{value:o})=>{const d=Number(o);d>=5&&d<=20&&(l(!0),Ce(d))}}),e(i,{className:a.header,size:"tiny",content:t(".appearance.code_line_height")}),e(re,{className:a.notFullWidth,fluid:!0,value:_,type:"number",min:1,max:2,step:.05,onChange:(n,{value:o})=>{const d=Number(o);d>=1&&d<=2&&(l(!0),Ne(d))}}),e(L,{className:a.checkbox+" "+a.largeMargin,checked:b,label:t(".appearance.code_font_ligatures"),onChange:(n,{checked:o})=>!g&&(l(!0),Ie(o))}),e("div",{className:a.notes,children:t(".appearance.code_font_ligatures_notes")}),e(i,{className:a.header,size:"tiny",content:t(".appearance.code_preview")}),e(de,{segment:{color:"blue"},language:"cpp",code:Te,fontFaceOverride:w,fontSizeOverride:v,lineHeightOverride:_,fontLigaturesOverride:b}),e(f,{children:c(f.Group,{inline:!0,children:[e("label",{className:a.formLabel,children:t(".appearance.markdown_editor_font.markdown_editor")}),e(f.Radio,{label:t(".appearance.markdown_editor_font.content_font"),value:"content",checked:T==="content",onChange:()=>R("content")}),e(f.Radio,{label:t(".appearance.markdown_editor_font.code_font"),value:"code",checked:T==="code",onChange:()=>R("code")})]})}),e(i,{className:a.sectionHeader,size:"large",content:t(".code_language.header")}),e(f,{className:a.notFullWidth+" "+a.headerMargin,children:e(Be,{headerForLanguage:t(".code_language.language"),classNameForCompileAndRunOptions:a.halfWidthFieldContainer,language:x,compileAndRunOptions:j,onUpdateLanguage:n=>(l(!0),we(n)),onUpdateCompileAndRunOptions:n=>(l(!0),ve(n))})}),e("div",{className:a.notes,children:t(".code_language.content_notes")}),e(i,{className:a.sectionHeader,size:"large",content:t(".code_formatter.header")}),e(i,{className:a.header,size:"tiny",content:t(".code_formatter.astyle_options")}),e(f,{children:e(Ae,{className:a.textarea+" monospace",rows:"5",placeholder:ce,value:F,onChange:(n,{value:o})=>o.length<1024&&!g&&(l(!0),Ee(o))})}),c("div",{className:a.notes,children:[t(".code_formatter.notes_before"),c("a",{href:"http://astyle.sourceforge.net/astyle.html",target:"_blank",rel:"noreferrer noopener",children:["\xA0",t(".code_formatter.notes_link"),"\xA0"]}),t(".code_formatter.notes_after")]}),e(L,{className:a.checkbox,checked:!X,label:t(".code_formatter.format_code_by_default"),onChange:(n,{checked:o})=>!g&&(l(!0),Oe(!o))}),e(i,{className:a.header,size:"tiny",content:t(I?".code_formatter.preview":".code_formatter.error")}),e(de,{segmentClassName:a.formatPreviewCodeBoxSegment+" "+a.scrollableCodeBoxSegment,segment:{color:I?"green":"red"},language:I?"cpp":null,code:xe}),e(Ue,{className:a.submit,loading:g,disabled:!I,primary:!0,content:t(".submit"),onClick:_e})]})},ot=Se(qe);export{ot as View,nt as fetchData};
