@01-edu/shared 2.0.6 → 2.0.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- import{a,b,c,d,e,f,g,h}from"./chunk-FQWECXED.js";import"./chunk-K5Z4W5GV.js";import"./chunk-YJMXNRLI.js";import"./chunk-NR2KVFFU.js";import"./chunk-T2KIY67K.js";import"./chunk-BLXMKMNK.js";import"./chunk-IF63VBJO.js";import"./chunk-MV3DQ3PZ.js";export{b as LEVELS,a as MAX_LEVEL,c as attrs,g as getAuditPath,h as internal,f as meetsRequirements,d as relationAttrs,e as types};
1
+ import{a,b,c,d,e,f,g,h}from"./chunk-NQCTSDJE.js";import"./chunk-K5Z4W5GV.js";import"./chunk-EOY6G4KE.js";import"./chunk-CBWHFDVB.js";import"./chunk-7ZTI6THC.js";import"./chunk-LDUPRVV4.js";import"./chunk-V47RDOUO.js";import"./chunk-727IHWVW.js";import"./chunk-EI7MMDWY.js";export{b as LEVELS,a as MAX_LEVEL,c as attrs,g as getAuditPath,h as internal,f as meetsRequirements,d as relationAttrs,e as types};
package/dist/attrs.js CHANGED
@@ -1 +1 @@
1
- import{a as c,b as d,c as e,d as f,e as g,f as h,g as i,h as j,i as k,j as l,k as m,l as n}from"./chunk-ZI7IBRHE.js";import{c as a,d as b}from"./chunk-FQWECXED.js";import"./chunk-K5Z4W5GV.js";import"./chunk-YJMXNRLI.js";import"./chunk-NR2KVFFU.js";import"./chunk-T2KIY67K.js";import"./chunk-BLXMKMNK.js";import"./chunk-IF63VBJO.js";import"./chunk-MV3DQ3PZ.js";export{c as attributes,a as attrs,g as attrsByType,n as expandDynamicAttrs,f as filterBulkAttrs,e as getAllBulkAttrs,k as getDefaultAttrs,i as getDefaultAttrsEntries,l as getDefaultRelAttrs,j as getDefaultRelAttrsEntries,m as partialExpandDynamicAttrs,d as relationAttributes,b as relationAttrs,h as relationAttrsByParentType};
1
+ import{a as c,b as d,c as e,d as f,e as g,f as h,g as i,h as j,i as k,j as l,k as m,l as n}from"./chunk-XYW3ROIR.js";import{c as a,d as b}from"./chunk-NQCTSDJE.js";import"./chunk-K5Z4W5GV.js";import"./chunk-EOY6G4KE.js";import"./chunk-CBWHFDVB.js";import"./chunk-7ZTI6THC.js";import"./chunk-LDUPRVV4.js";import"./chunk-V47RDOUO.js";import"./chunk-727IHWVW.js";import"./chunk-EI7MMDWY.js";export{c as attributes,a as attrs,g as attrsByType,n as expandDynamicAttrs,f as filterBulkAttrs,e as getAllBulkAttrs,k as getDefaultAttrs,i as getDefaultAttrsEntries,l as getDefaultRelAttrs,j as getDefaultRelAttrsEntries,m as partialExpandDynamicAttrs,d as relationAttributes,b as relationAttrs,h as relationAttrsByParentType};
@@ -1,3 +1,3 @@
1
1
  #!/usr/bin/env node
2
- import{readFile as Si,stat as Mr,watch as Ai}from"node:fs/promises";var fe=e=>new Date(e).getTime();var Ne=(e,t)=>fe(e)+t.attrs.delay,kt=(e,t)=>{let{scopeExtraDuration:r,duration:n}=t.attrs;return e+((r||0)+(n||1))*864e5};var Et=(e,t)=>typeof e=="object"&&Object.values(e)[0].some(r=>r===t);var Fe=(e,t)=>{let{key:r,parent:n}=e,o=t||Object.values(n.children),s=n.attrs.graph?.innerCircle?.find(d=>d.type==="slice"&&d.innerArc?.contents.find(m=>Et(m,r)));if(!s)return;let l=s.innerArc.contents.find(d=>Et(d,r));return o.filter(d=>d.key===Object.keys(l)[0])},qt=e=>[...e.centralPoint?[e.centralPoint]:[],...(e.innerCircle||[]).flatMap(t=>t.type==="slice"?[...t.entryPoint?[t.entryPoint]:[],...(t.innerArc?.contents||[]).flatMap(r=>typeof r=="string"?r:Object.entries(r)[0].flat()),...(t.outerArcs||[]).flatMap(r=>r.contents||[])]:t.contents),...(e.middleCircle||[]).flatMap(t=>t.contents||[]),...(e.outerCircle||[]).flatMap(t=>t.contents||[])];var F={LINE:{maxLinesCount:6,maxContentsCount:7},SLICE:{maxSlicesCount:4,innerCircle:{maxSubContentsCount:5,maxContentsCount:30},outerArc:{maxArcsCount:2,maxContentsCount:10}},MIDDLE_CIRCLE:{maxArcsCount:8,maxContentsCount:70},OUTER_CIRCLE:{maxArcsCount:9,maxContentsCount:90}};var be=new Set(["onboarding","piscine-registration","interview","games","administration","module-registration","form-step","sign-step","upload-step","contact-validation-step","avatar-step"]),St=new Set(["module","piscine","exam","raid","quest","exercise","project","signup","campus",...be]),At={campus:["signup","onboarding","piscine","module"],signup:["form-step","sign-step","upload-step","contact-validation-step","avatar-step"],onboarding:["games","administration","interview","piscine-registration","module-registration"],administration:["form-step","sign-step","upload-step","contact-validation-step","avatar-step"],piscine:["quest","exam","raid","project"],exam:["exercise"],quest:["exercise"],module:["project","piscine","exam"]};var Or=(e,t)=>{if(e)return t==="."?e:t===".."?e.parent:e.children[t]},G=(e,t,r={throwError:!0})=>{let n=t.path;if(Tr(e)){if(r.throwError)throw Error("'relativePath' must be a relative path");console.error("'relativePath' must be a relative path");return}e[e.length-1]==="/"&&(e=e.slice(0,-1));let o=e.split("/").reduce(Or,t);if(o)return o;let s=`Incorrect relative path '${e}': no object found \u2014 current path = '${n}'`;if(r.throwError)throw Error(s);console.error(s)},Tr=e=>e.startsWith("/");var _e={memory:{maxLevel:22,minRatio:1,freeAttempts:1e3,maxAttempts:1e3,shouldFailUnderScore:30,shouldFailUnderLevel:7,shouldSucceedFromScore:60,shouldSucceedFromLevel:15},zzle:{maxLevel:18,minRatio:1,freeAttempts:1e3,maxAttempts:1e3,shouldFailUnderScore:20,shouldFailUnderLevel:3,shouldSucceedFromScore:50,shouldSucceedFromLevel:10}};for(let e of Object.values(_e))e.levels=[...Array(e.maxLevel+50).keys()].map(t=>({maxScore:((t+1)/15+1)*5})),e.maxScore=e.levels.slice(0,e.maxLevel).reduce((t,r)=>t+r.maxScore,0);var Ve={prog:{name:"Elementary programming",description:"Basics of computer programming",type:"technical",abbreviation:"prog-1"},"intermediate-prog":{name:"Intermediate programming",description:"Intermediate notions of computer programming",type:"technical",abbreviation:"prog-2"},"advanced-prog":{name:"Advanced programming",description:"Advanced notions of computer programming",type:"technical",abbreviation:"prog-3"},algo:{name:"Elementary algorithms",description:"Problem-solving, algorithm design",type:"technical"},"sys-admin":{name:"System administration",description:"System administration, dev ops",type:"technical",abbreviation:"devops"},"front-end":{name:"Front-end",description:"Front-end technologies",type:"technical",abbreviation:"front"},"back-end":{name:"Back-end",description:"Back-end technologies",type:"technical",abbreviation:"back"},stats:{name:"Statistics",description:"Data analysis, interpretation",type:"technical"},ai:{name:"AI",description:"Artificial intelligence, machine learning",type:"technical"},game:{name:"Game programming",description:"Game programming",type:"technical"},blockchain:{name:"Blockchain",description:"Blockchain",type:"technical",abbreviation:"BC"},mobile:{name:"Mobile development",description:"Mobile development",type:"technical"},tcp:{name:"TCP/IP",description:"TCP/IP",type:"technical"},cybersecurity:{name:"Cybersecurity",description:"Cybersecurity",type:"technical",abbreviation:"cyber"},ux:{name:"UX/UI",description:"User experience design, user interface design",type:"technical"},cloud:{name:"Cloud",description:"Cloud infra, deployment and scaling",type:"technical"},automation:{name:"Automation",description:"Automate tasks to reduce repetitive tasks and minimize potential errors",type:"technical",abbreviation:"autom."},ci:{name:"CI/CD",description:"Set up CI/CD pipelines to maintain a consistent software release process",type:"technical"},testing:{name:"Testing",description:"TDD and other software testing strategies",type:"technical",abbreviation:"tests"},"curriculum-objectives-completed":{name:"Curriculum objectives completed",description:"Curriculum objectives completed to unlock the specialization branches",type:"technical",abbreviation:"credits"},go:{name:"Go",type:"technology"},js:{name:"JS",type:"technology"},rust:{name:"Rust",type:"technology"},java:{name:"Java",type:"technology"},html:{name:"HTML",type:"technology"},css:{name:"CSS",type:"technology"},unix:{name:"Unix",type:"technology"},docker:{name:"Docker",type:"technology"},sql:{name:"SQL",type:"technology"},"no-sql":{name:"Non-relational Databases",type:"technology"},c:{name:"C",type:"technology"},sh:{name:"Shell",type:"technology"},php:{name:"PHP",type:"technology"},python:{name:"Python",type:"technology"},ruby:{name:"Ruby",type:"technology"},"c-sharp":{name:"C#",type:"technology",abbreviation:"C#"},"c-pp":{name:"C++",type:"technology",abbreviation:"C++"},graphql:{name:"GraphQL",type:"technology",abbreviation:"GQL"},rails:{name:"Ruby on Rails",type:"technology"},laravel:{name:"Laravel",type:"technology"},django:{name:"Django",type:"technology"},react:{name:"React",type:"technology"},dotnet:{name:".NET",type:"technology"},electron:{name:"Electron",type:"technology",abbreviation:"elect."},git:{name:"Git",type:"technology"},employability:{name:"Employability",type:"employability",abbreviation:"jobSkills"},"personal-development":{name:"Personal Development",description:"Focuses on self-awareness, self-management, communication, and core values to build a strong personal foundation for growth and autonomy.",type:"lifeskills",abbreviation:"PDev"},"relational-development":{name:"Relational Development",description:"Develops the ability to connect with others through assertiveness, empathy, and resilience, enabling healthy collaboration and conflict management.",type:"lifeskills",abbreviation:"RelDev"},"professional-development":{name:"Professional Development",description:"Strengthens strategic thinking, leadership, and professional presence to drive impact, solve complex problems, and succeed in professional environments.",type:"lifeskills",abbreviation:"ProDev"}};var Ct=(e,t)=>Object.entries(e||{}).every(([r,n])=>(t?.[r]||0)>=n);var We=1e3,jt=60*We,Dt=60*jt,ze=24*Dt,Pi=7*ze,Lr=365*ze,Ni=Object.entries({year:Lr,month:2628e6,day:ze,hour:Dt,minute:jt,second:We});var Fi=new Intl.RelativeTimeFormat("en",{style:"narrow"});var Ue=e=>Pr(Math.round(e/We)),Be=[{label:"y",fullLabel:"year",size:31536e3},{label:"w",fullLabel:"week",size:604800},{label:"d",fullLabel:"day",size:86400},{label:"h",fullLabel:"hour",size:3600},{label:"m",fullLabel:"minute",size:60},{label:"s",fullLabel:"second",size:1}],Pr=(e,{noSeconds:t,stopFirst:r,useFullLabel:n,stopLabel:o}={})=>{let s=[];if(o&&e<Be.find(l=>l.fullLabel===o)?.size)return`less than 1${n?` ${o}`:Be.find(l=>l.fullLabel===o).label}`;for(let{label:l,size:d,fullLabel:m}of Be){let u=Math.floor(e/d);if(u!==0){if(s.push(`${u}${n?` ${m}`:l}${u>1&&n?"s":""}`),r)return s;e-=u*d}if(m===o)return s.join(" ")||(t?"0m":"0s")}return!t&&e!==0&&s.push(`${e}s`),s.join(" ")||(t?"0m":"0s")};var Nr=e=>e[0].toLowerCase()+e.slice(1),Fr=(e,t)=>t.toUpperCase(),Ge=e=>Nr(e.trim().toLowerCase().replace(/[ _-]+(.?)/g,Fr)),Xe=e=>/[ _-]+(.?)/g.test(e);var _r=(e,t,r)=>`${t} ${r}`,Ke=e=>e.trim().replace(/(.)([A-Z])/g,_r).toLowerCase();var E=(e,t=0)=>[...Array(e+t).keys()].slice(t);var ye=(e,t)=>Object.fromEntries(Object.entries(e).map(t)),b=(e,t)=>ye(e,([r,n])=>[r,t(n,r,e)]);var It=(e,t)=>e&&Object.values(e).find(r=>r.type===t);var q=128,De=Array(q+1),J=-1,Rt=0,Mt=0;for(;++J<q+1;){let e=J*.66+1,t=(J+2)*150+50,r=Math.round(e*t);Mt+=r,Rt+=e,De[J]={level:J,base:t,cumul:Mt,total:r,xpIndex:Math.floor(Rt)}}var Y=e=>e?.children&&Object.values(e.children)||[],ct=(e,t,r)=>e&&(t(e)?e:ct(e[r],t,r)),Br=(e,t)=>ct(e,t,"parent"),Zt=(e,t)=>ct(e,t,"prev"),Wr=({event:e})=>e,er=e=>e.type==="quest",Re=e=>e.attrs.category==="required",tr=e=>typeof e=="number"&&!Number.isNaN(e)?e:1,ut=e=>e.attrs.difficulty*tr(e.attrs.difficultyMod),rr=(e,t)=>e+t,zr=([e,t],[r,n])=>t.index-n.index,$t=(e,t,r)=>e.attrs[`${r}-${t?.attrs?.language}`]||e.attrs[`${r}-en`]||r,nr=(e,t,r)=>{let{group:n}=e.attrs;return n?r.find(o=>o.attrs.group===n)===e:!0},ir=e=>{let[t]=Fe(e)||[];return t?`${t.name}/${cr(e)}`:e.name},c=e=>({value:Object.values(e)[0],functions:e,functionsByName:Object.fromEntries(Object.values(e).map(t=>[t.name,t]))}),L={functions:{translate:$t},functionsByName:{translate:$t}},i=(e,t)=>({type:typeof e,value:e,...t}),R=(e,...t)=>{if(e.required)return typeof e.value=="function"?e.value(...t):e.value},h=e=>({value:(...t)=>b(e.type,r=>R(r,...t)),...e}),p={},f={},a={};p.address={"contact-validation-step":i("",{editable:!0,required:!0,label:"Phone validation URL"})};a.allowedFunctions={value:"",type:"string",editable:!0,label:"Function"};var Ot={type:[a.allowedFunctions],value:[],label:"Allowed functions",instruction:"Functions authorized to the student",editable:!0,restrictive:!0};p.allowedFunctions={exercise:Ot,raid:Ot};var Tt={type:"boolean",required:!0,private:!0,label:"Show invalid requirements"};p.showInvalidRequirements={project:Tt,piscine:Tt};var ar="Automatic success",Ur=`${ar} if`,Gr="Automatic reject if",or=e=>({type:"string",restrictive:!0,editable:!0,label:`${e} - number of conditions to fulfil`,...c({all:()=>"and",one:()=>"or"})});p.autoRejectOperator={games:or("Reject")};var Xr=Object.entries(_e),Kr=Xr.flatMap(([e,t])=>[[`${e}Score`,{shouldFailUnder:t.shouldFailUnderScore,shouldSucceedFrom:t.shouldSucceedFromScore}],[`${e}Level`,{shouldFailUnder:t.shouldFailUnderLevel,shouldSucceedFrom:t.shouldSucceedFromLevel}]]),sr=[["score",{shouldFailUnder:25,shouldSucceedFrom:50}],["level",{shouldFailUnder:10,shouldSucceedFrom:25}],...Kr],dt=e=>Array.isArray(e)||typeof e!="object"||!Object.keys(e).length,x=(e,t,r)=>{if(!e.length){let n=Error("Must be a non empty value");throw n.label=r,n}},Me=(e,t,r)=>{if(e<t||e>r)throw Error(`Expected to be a number range ${t} to ${r}`)},v=(e,t,r)=>{if(e<t||e>r||!Number.isInteger(e))throw Error(`Expected to be an integer range ${t} to ${r}`)},$e=(e,t,r)=>{if(e<t||e>r)throw Error(`Expected to be a duration between ${Ue(t)} and ${Ue(r)}`)},de=(e,t)=>{if(e.length>t)throw Error(`Max ${t} characters (spaces included).`)},lr=e=>{try{return!!new URL(e)}catch{throw Error("Invalid URL.")}},Ie={editable:!0,options:E(100,1),check:e=>v(e,1,100)};a.autoRejectWhereConditions=Object.fromEntries(sr.map(([e,{shouldFailUnder:t}])=>[e,{value:{},editable:!0,description:`Condition relative to ${Ke(e)} of the candidate.`,type:{"<":i(t,{label:"is lower than",description:"Under this number, condition is fulfilled.",...Ie}),"<=":i(t,{label:"is lower than or equal",description:"Until this number, condition is fulfilled.",...Ie})}}]));p.autoRejectWhere={games:{value:{},editable:!0,restrictive:!0,label:Gr,instruction:"List of conditions to automatically reject an application",type:a.autoRejectWhereConditions}};p.autoValidate={administration:i(!1,{label:ar,instruction:"Validate all applications when they are submitted",restrictive:!0,editable:!0})};p.autoValidateOperator={games:or("Success")};a.autoValidateWhereConditions=Object.fromEntries(sr.map(([e,{shouldSucceedFrom:t}])=>[e,{value:{},editable:!0,description:`Condition relative to ${Ke(e)} of the candidate.`,type:{">":i(t,{label:"is bigger than",description:"Above this number, condition is fulfilled.",...Ie}),">=":i(t,{label:"is bigger than or equal",description:"From this number, condition is fulfilled.",...Ie})}}]));p.autoValidateWhere={games:{value:{},editable:!0,restrictive:!0,label:Ur,instruction:"List of conditions to automatically accept an application",type:a.autoValidateWhereConditions}};var pt={value:{},editable:!0,label:"Skills rewarded",type:b(Ve,({name:e,type:t,description:r})=>({label:e,instruction:t,description:r,editable:!0,type:"number",value:1,options:E(100,1),check:n=>v(n,1,100)}))},_={...pt,instruction:"Skills rewarded to users when they succeed in the current content"};f.baseSkills={exam:{exercise:_},quest:{exercise:_},module:{piscine:_,project:_},campus:{piscine:_},piscine:{raid:_,project:_}};var Hr=e=>{if(Object.keys(e.children||{}).length&&e.type!=="raid")return 0;let t=De[e.attrs.level]||De[0];return Math.round(t.base*tr(ut(e)))},V={type:"number",required:!0,editable:!0,label:"XP rewards",instruction:"How much experience points the user gets by succeeding on this content",...c({"by level and difficulty":Hr}),check:e=>{if(!Number.isInteger(e))throw Error("Must be a whole number");if(e<0)throw Error("Must not be negative")}};f.baseXp={exam:{exercise:V},quest:{exercise:V},module:{piscine:V,project:V},piscine:{raid:V,project:V},campus:{piscine:V}};p.blockStartDelay={exam:i(15*6e4,{label:"Time to join the exam",editable:!0})};var Lt=i("Save",{label:"Submit button text",editable:!0,...L});p.buttonText={"sign-step":Lt,"form-step":Lt};p.campaignId={games:i("",{label:"Games campaign related",instruction:"Id required",required:!0,editable:!0,restrictive:!0})};var Yr=e=>e.path.split("/")[1],O={label:"Campus",type:"string",required:!0,private:!0,...c({"from campus name":Yr})};p.campus={exercise:O,module:O,piscine:O,project:O,raid:O,exam:O,quest:O,...Object.fromEntries([...be].map(e=>[e,O]))};var Z=i(400,{label:"Event capacity",instruction:"From 1 to 1000.",editable:!0,required:!0,check:e=>{if(!Number.isInteger(e))throw Error("Must be a whole number");if(e>1e3)throw Error("Cannot be more than 1000.");if(e<1)throw Error("Must be one or more")}});p.capacity={exam:Z,module:Z,piscine:Z,raid:Z,interview:Z};var Qr=new Set(["required","optional","bonus"]);f.category={exam:{exercise:i("required",{label:"Category of the exercise",required:!0,private:!0,check:e=>{if(!new Set(["required","optional"]).has(e))throw Error('Must be "required" or "optional"')}})},quest:{exercise:i("required",{label:"Category of the exercise",required:!0,editable:!0,options:["required","optional","bonus"],check:e=>{if(!Qr.has(e))throw Error('Must be "required", "optional" or "bonus"')}})},piscine:{raid:i("required",{required:!0,private:!0})}};p.checkbox={"sign-step":{label:"Display a checkbox",instruction:'Minimum options: "label" and "required"',value:{},editable:!0,type:"object",check:e=>{if(!e.label||typeof e.label!="string")throw Error('"label" must be defined as a text to be displayed on the right of the checkbox.');if(typeof e.required!="boolean")throw Error('"required" must be defined as true or false (if the checkbox is mandatory or not).')},...L}};a.codeEditorFile=h({label:"File",editable:!0,type:{giteaPath:i("root/public/README.md",{label:"Gitea file path",instruction:'Example: "{user}/{repo}/{path-to-file}"',editable:!0,check:e=>{de(e,200),x(e)}}),editorPath:i("provided/README.md",{label:"Path in Code editor",required:!0,editable:!0,check:e=>{de(e,200),x(e)}})}});a.providedFiles={editable:!0,label:"Provided files",type:[a.codeEditorFile]};a.enableCodeEditor=(e,t)=>i(e,{editable:!0,required:!0,label:"Enable",...t});var Pt={label:"Code editor settings",editable:!0,check:(e,{attrs:t})=>{if(t.language==="sh")throw Error("The code editor does not support shell exercises")},type:{enabled:a.enableCodeEditor(!1),providedFiles:a.providedFiles}};f.codeEditor={quest:{exercise:h({...Pt})},exam:{exercise:h({...Pt,required:!0,type:{enabled:a.enableCodeEditor(!0,{editable:!1}),providedFiles:a.providedFiles}})}};var Oe=e=>{let t=/^[^a-z](\d+)|[^a-z0-9_]/g,r=e.search(t);if(r!==-1){let n=e[r],o=e.normalize("NFD").toLowerCase().replace(t,""),s=o?`Did you mean ${o}?`:"";throw Error(`Property names should start with a letter, only contain lowercase letters, numbers, and underscores (${r}:"${n}"). ${s}`)}},Nt=process.env.ENABLE_CRM,Jr=process.env.CRM_NAME,Zr=process.env.CRM_ENDPOINT,en=process.env.CRM_PRIVATE_KEY;a.crmOnValidation=i("event_status",{editable:!0,label:"Validation status",check:e=>{x(e),Oe(e)}});var T=h({label:"Customer Relationship Management (CRM)",editable:!0,restrictive:!0,private:!(Nt&&JSON.parse(Nt)&&Jr&&Zr&&en),type:{onValidation:a.crmOnValidation}});a.crmGamesOnAttempts=i("number_of_attempts_remaining",{label:"Remaining attempts",editable:!0,check:e=>{x(e),Oe(e)}});a.crmOnProgress=i("last_progress",{label:"Currently in progress",editable:!0,check:e=>{x(e),Oe(e)}});a.gamesCRM={onAttempts:a.crmGamesOnAttempts};a.crmDueDate=i("audit_due_date",{label:"Due date",editable:!0,check:e=>{x(e),Oe(e)}});var Ft={...T,type:{...T.type,onProgress:a.crmOnProgress}};p.crm={games:{...T,type:{...a.gamesCRM,onValidation:T.type.onValidation}},interview:T,piscine:Ft,module:Ft,exam:T,raid:T,project:{...T,type:{dueDate:a.crmDueDate}}};var ge=({type:e,parent:t,index:r,attrs:n})=>t&&e==="exercise"&&n.special?Object.values(t.children).filter(s=>s.index<r).map(({attrs:s})=>s.duration).reduce(rr,0)*864e5:n.startDay?(n.startDay-1)*864e5:0,ee={type:"number",required:!0,private:!0};f.delay={piscine:{quest:{...ee,label:"Time before the quest starts",...c({"based on previous content temporal-windows":ge})},project:{...ee,label:"Time before the project starts",...c({"based on previous content temporal-windows":ge})}},quest:{exercise:{...ee,label:"Time before the exercise starts",...c({"based on previous exercises temporal-windows":ge})}},exam:{exercise:{...ee,label:"Time before the exercise starts",...c({"based on previous exercises temporal-windows":ge})}},module:{project:i(0,ee)}};var tn=({attrs:e,prev:t})=>e.parentType!=="exam"?1:e.group?Math.round(e.group*2):Math.round(((t?.attrs.group||0)+1)*2),rn=e=>Y(e).filter(nr).filter(Re).map(ut).reduce(rr,0),K=i(1,{required:!0,label:"Difficulty",instruction:"From 0.75 to 2 (in increments of 0.25)"}),He={...K,private:!0,...c({"Sum of required children exercises difficulties":rn})};f.difficulty={module:{project:{...K,editable:!0},exam:He},piscine:{project:{...K,editable:!0},raid:{...K,editable:!0},exam:He,quest:He},quest:{exercise:i(1,{...K,editable:!0})},exam:{exercise:{...K,editable:!0,editableDefaultValue:1,...c({"Based on exercise group or 1":tn})}}};var nn=({parent:e})=>e?.attrs.difficultyMod,C=i(1,{label:"XP Coefficient",required:!0,editable:!0,editableDefaultValue:1,...c({"from parent":nn}),check:e=>Me(e,0,64)});f.difficultyMod={campus:{piscine:C},module:{project:C,piscine:C,exam:C},piscine:{raid:C,exam:C,quest:C,project:C},quest:{exercise:C},exam:{exercise:C}};var an=({name:e})=>e,cr=e=>{let[t]=Fe(e)||[];return t&&t.name&&e.name.startsWith(t.name)?e.name.slice(t.name.length+1):e.name},te=i("",{editable:!0,label:"Displayed name",check:e=>de(e,60)});p.displayedName={raid:{...te,...c({"from name":an})},project:{...te,...c({"from name (or light version)":cr}),required:!0},piscine:te,exercise:te,quest:te};var ur=e=>e.attrs.special,_t=({parent:e})=>ur(e)?e.attrs.duration/Object.keys(e.children).length:0,on=()=>1,sn=()=>2,B=i(1,{label:"Temporal-window duration in the event",required:!0,editable:!0,check:e=>$e(e*864e5,0,50*864e5),editableDefaultValue:1,...c({"one day":on})});f.duration={module:{exam:{...B,hidden:!0}},piscine:{quest:B,exam:B,raid:{...B,...c({"two days":sn})},project:B},quest:{exercise:{...B,...c({"proportional to the others (in hackathon mode)":_t})}},exam:{exercise:{...B,...c({"proportional to the others (in hackathon mode)":_t})}}};var re={label:"Event duration",required:!0,editable:!0,check:e=>$e(e*6e4,1*6e4,365*864e5*3)};p.eventDuration={exam:i(4*36e5/6e4,re),module:i(365*864e5*2/6e4,re),interview:i(864e5*1/6e4,re),piscine:i(4*6048e5/6e4,re),raid:i(864e5*2/6e4,re)};var ln=({parent:e})=>e?.attrs.eventId,cn=({event:e})=>e?.id,z={type:"number",label:"Event id",required:!0,private:!0,...c({"own event":cn})},ne={...z,...c({"parent event":ln})};f.eventId={campus:{module:z,piscine:z},piscine:{quest:ne,project:ne,exam:z,raid:z},quest:{exercise:ne},exam:{exercise:ne},module:{piscine:z,project:ne,exam:z}};var ie=i(0,{label:"Time between registration and event",editable:!0});p.eventStartDelay={exam:ie,module:ie,interview:ie,piscine:ie,raid:ie};a.filesName=i("",{label:"Expected file name",instruction:'Examples: "main.go", or "exerciseName/main.go"',editable:!0,check:e=>{de(e,65)}});var Vt={type:[a.filesName],value:[],editable:!0,restrictive:!0,label:"Expected files",check:x};p.expectedFiles={exercise:Vt,raid:Vt};var un=(e,t)=>e+(Re(t)?t.attrs.baseXp:0),Bt=e=>Y(e).filter(nr).reduce(un,0),dn=(e,t)=>e+(t.attrs.expectedXp||0),Wt=e=>Y(e).reduce(dn,0),xe={type:"number",label:"XP",instruction:"Expertise(s) that this content is worth.",required:!0,check:e=>{if(!Number.isInteger(e))throw Error("Must be a whole number");if(e<0)throw Error("Must not be negative")}};p.expectedXp={piscine:{...xe,private:!0,label:"XP (for stats)",...c({"Sum of children expected XP":Wt})},module:{...xe,...c({"Sum of children expected XP":Wt})},quest:{...xe,...c({"Sum of required children XP":Bt})},exam:{...xe,...c({"Sum of required children XP":Bt})}};var dr=i("",{primary:!0,editable:!0,required:!0}),Q={key:{...dr,label:"Key (must be unique)",instruction:"Associated keyword in the database and data exports",check:(e,t)=>{if(x(e.trim()),Xe(e)){let o=Ge(e);throw Error(`Must be written in camelCase. Suggestion: "${o}"`)}if((t.attrs["form-en"]||t.attrs.form||[]).flatMap(o=>o.inputs.map(s=>s.key)).filter(o=>o===e)?.length>1)throw Error(`${e} is already used for another input. Please choose a unique key.`)}},required:i(!0,{label:"Must be fulfilled",editable:!0})},pn=new Set(["w100p","w18p"]),U={...Q,styleProps:h({label:"Input style",type:{w100p:i(!1,{label:"Large input style",editable:!0}),w18p:i(!1,{label:"Small input style",editable:!0})},editable:!0,check:e=>{let t=Object.keys(e).find(r=>!pn.has(r));if(t)throw Error(`${t} is not a valid css property`)}})},S={name:i("",{label:"Input HTML name",editable:!0,check:x}),id:i("",{label:"Input HTML id",editable:!0,check:x})},pe=(e,t)=>({placeholder:i(t||"Your answer...",{label:"Placeholder",editable:!0}),label:i(e||"",{label:"Label / title",instruction:"Displayed on top of the input",editable:!0})}),pr={...pe(),...S,minLength:i(1,{label:"Minimum length",editable:!0}),maxLength:i(60,{label:"Maximum length",editable:!0})};a.textInput=h({label:"Text input",type:{type:i("text",{label:"Input type",required:!0}),...U,...pr,size:i(20,{label:"Size",editable:!0})}});a.textareaInput=h({label:"Textarea input",type:{type:i("textarea",{label:"Input type",required:!0}),...U,...pr,rows:i(5,{label:"Rows",editable:!0}),cols:i(20,{label:"Columns",editable:!0})}});a.telInputPattern=i("/^\\s?\\+?[0-9 ()_-]+$/",{label:"Pattern to match",instruction:"Regular expression (in javascript) that the input's value must match.",editable:!0});a.telInput=h({label:"Tel input",type:{type:i("tel",{label:"Input type",required:!0}),...U,...S,...pe("Telephone number","+333 33 33 33 33"),pattern:a.telInputPattern,format:i("Format: +7 777 123 00 00",{label:"Format to respect",editable:!0})}});a.checkboxInput=h({label:"Checkbox input",type:{type:i("checkbox",{label:"Input type",required:!0}),...Q,...S,label:i("I agree",{label:"Text associated to the checkbox",instruction:"Displayed on the right of the checkbox",editable:!0,required:!0,check:x}),value:i(!1,{label:"Is initially checked",editable:!0,required:!0})}});a.switchInput=h({label:"Switch input",type:{type:i("switch",{label:"Input type",required:!0}),...Q,...S,label:i("I choose...",{label:"Text associated to the switch input",instruction:"Displayed on the left of the checkbox",editable:!0,required:!0,check:x}),value:i(!1,{label:"Is initially set to true",editable:!0,required:!0})}});a.numberInputsSteps=i(10,{label:"Step value up and down by",editable:!0});a.numberInput=h({label:"Number input",type:{type:i("number",{label:"Input type",required:!0}),...U,...S,...pe("How many/much...","Multiple of..."),min:i(1,{label:"Minimum",editable:!0}),max:i(100,{label:"Maximum",editable:!0}),step:a.numberInputsSteps}});a.dateInput=h({label:"Date input",type:{type:i("date",{label:"Input type",required:!0}),...U,...S,...pe("Date","2000-01-01"),value:i("2000-01-01",{label:"Default date value",editable:!0}),min:i("2000-01-01",{label:"Lowest date allowed",editable:!0}),max:i("2000-01-01",{label:"Highest date allowed",editable:!0})}});a.datetimeLocalInput=h({label:"Date with time input",type:{type:i("datetime-local",{label:"Input type",required:!0}),...U,...S,...pe("Date and time","2000-01-01T00:00"),value:i("2000-01-01T00:00",{label:"Default date and time value",editable:!0}),min:i("2000-01-01T00:00",{label:"Lowest date and time allowed",editable:!0}),max:i("2000-01-01T00:00",{label:"Highest date and time allowed",editable:!0})}});a.countriesInput=h({label:"Countries input",type:{type:i("countries",{label:"Input type",required:!0}),...Q,...S,label:i("Country",{label:"Label / title",instruction:"Displayed on top of the input",editable:!0}),emptyItem:h({label:"Empty selection text",editable:!0,instruction:"Displayed as a placeholder before selection",type:{label:i("Choose your country...",{label:"Label",editable:!0})}})}});a.languagesInput=h({label:"Languages input",type:{type:i("languages",{label:"Input type",required:!0}),...Q,...S,label:i("Language",{label:"Label / title",instruction:"Displayed on top of the input",editable:!0}),emptyItem:h({label:"Empty selection text",editable:!0,instruction:"Displayed as a placeholder before selection",type:{label:i("Choose your language...",{label:"Label",editable:!0})}})}});a.radioItems=h({label:"Radio item",type:{label:i("",{label:"Label (text displayed)",editable:!0}),data:i("",{label:"Data (value saved in database)",editable:!0,required:!0,primary:!0,check:x})}});a.radioInput=h({label:"Radio input",type:{type:i("radio",{label:"Input type",required:!0}),...Q,...S,label:i("Select one...",{label:"Label / title",instruction:"Displayed on top of the input",editable:!0,required:!0}),inlineBlock:i(!0,{label:"Displays options under the label",instruction:"If set to false, options are right to the label",editable:!0}),items:{value:[],type:[a.radioItems],label:"Items",required:!0,editable:!0}}});a.selectItems=h({label:"Select item",type:{label:i("",{label:"Label",instruction:"Text displayed and saved in database",editable:!0,required:!0,primary:!0,check:x}),data:i("",{label:"Data",editable:!0})}});a.selectInput=h({label:"Select input",type:{type:i("select",{label:"Input type",required:!0}),...U,...S,label:i("Select one...",{label:"Label / title",instruction:"Displayed on top of the input",editable:!0}),searchable:i(!0,{label:"Searchable",instruction:"Allow search, and sort the input options",editable:!0}),emptyItem:h({label:"Empty selection text",editable:!0,instruction:"Displayed as a placeholder before selection",type:{label:i("Choose...",{label:"Label",editable:!0})}}),items:{type:[a.selectItems],value:[],label:"Items",required:!0,editable:!0}}});a.formSectionResume=i("",{label:"Resume",editable:!0});a.formSection=h({type:{key:{...dr,label:"Section id",instruction:"Private info (for admins)",check:(e,t)=>{if(x(e.trim()),Xe(e)){let o=Ge(e);throw Error(`Must be written in camelCase. Suggestion: "${o}"`)}if((t.attrs["form-en"]||t.attrs.form||[]).map(o=>o.key).filter(o=>o===e)?.length>1)throw Error(`${e} is already used for another section. Please choose a unique key.`)}},title:i("",{label:"Section title",editable:!0}),resume:a.formSectionResume,inputs:{label:"Inputs",instruction:"Questions or instruction to answer to",required:!0,editable:!0,value:[],type:[a.textInput,a.textareaInput,a.telInput,a.checkboxInput,a.switchInput,a.dateInput,a.datetimeLocalInput,a.numberInput,a.countriesInput,a.languagesInput,a.radioInput,a.selectInput]}}});p.form={"form-step":{label:"Form to fill",required:!0,editable:!0,value:[{key:"firstSection",inputs:[]}],type:[a.formSection],...L}};var mn=e=>{if(!e.children)return;let t=Y(e),r=t.filter(Re).length,n=t.filter(o=>o.attrs.status==="succeeded").length;return n&&n/r};p.grade={quest:i(0,{required:!0,private:!0,label:"Quest grade",...c({"succeeded exercises / required":mn})})};a.graphArcName=h({label:"Name of the arc",type:{text:i("",{label:"The text name of the arc",type:"string"}),hidden:i(!0,{label:"Display the text name on the graph"})}});var st=(e,t)=>{if(!t.children[e])throw Error(`Invalid object - no object found in the module for the following key name: ${e}`)};a.graphArcContentName=i("",{label:"The text name of a content placed on an arc",check:(e,t)=>st(e,t)});a.graphArcContentWithSubContents={value:{},label:"Content with sub-contents placed on an arc",type:"object",check:(e,t)=>{if(dt(e))throw Error("Should be a non empty object.");let r=Object.entries(e);if(r.length>1)throw Error("Should be an object with a single key-value pair; the key being the content's name, and the value being an array of sub-contents's names.");let[n,o]=r[0];if(st(n,t),!Array.isArray(o)||!o.length)throw Error("Must be a non empty array");let s=new Set(o);if(o.length!==s.size)throw Error("Duplicates are not allowed.");let l=F.SLICE.innerCircle.maxSubContentsCount;if(o.length>l)throw Error("Max sattelites reached");for(let d of o)st(d,t)}};var mr=e=>{let{name:t,contents:r,type:n,id:o,...s}=e;if(Object.keys(s).length)throw Error(`Unsupported attribute "${Object.keys(s)[0]}"`);if(!Array.isArray(r)||!r?.length)throw Error("Must be a non empty array")};a.graphArc=h({label:"Name & contents of an arc",type:{id:i("",{label:"A randomly-generated id to identify the arc"}),name:a.graphArcName,contents:{label:"The list of contents to be placed on an arc",type:[a.graphArcContentName]}},check:mr});a.innerCircleSlice=h({label:"Slice on the inner circle",type:{id:i("",{label:"A randomly-generated id to identify the slice"}),name:a.graphArcName,type:i("slice",{label:"The slice type"}),entryPoint:a.graphArcContentName,innerArc:h({label:"Inner arc of an inner circle slice",type:{...a.graphArc.type,contents:{label:"The list of contents to be placed on an inner arc of an inner circle slice",type:[a.graphArcContentName,a.graphArcContentWithSubContents]}},check:mr}),outerArcs:{label:"Outer arcs of an inner circle slice",type:[a.graphArc],check:e=>{let{maxArcsCount:t,maxContentsCount:r}=F.SLICE.outerArc;if(e.length>t)throw Error("Max outerArcs reached");if(e.reduce((n,o)=>n+(o.contents?.length||0),0)>r)throw Error("Max contents spread over outerArcs of slice reached")}}},check:e=>{let{name:t,entryPoint:r,type:n,innerArc:o,outerArcs:s,id:l,...d}=e;if(Object.keys(d).length)throw Error(`Unsupported attribute "${Object.keys(d)[0]}"`);if(!t&&!r&&!n&&!o&&!s&&!l)throw Error("Empty inner circle, should be removed")}});a.innerCircleLine={...a.graphArc,label:"Line on the inner circle",type:{...a.graphArc.type,type:i("line",{label:"The line type"})},check:e=>{if(e.contents.length>F.LINE.maxContentsCount)throw Error("Max contents reached for a line")}};var hn=h({private:!0,required:!0,editable:!0,value:{innerCircle:[],middleCircle:[],outerCircle:[]},label:"Graph structure",instruction:"Structure of the visual graph",description:"Sets the visual structure & hierarchy of the graph of a module.",type:{centralPoint:a.graphArcContentName,innerCircle:{value:[],required:!0,editable:!0,label:"List of slices and/or lines spread on the inner circle",type:[a.innerCircleSlice,a.innerCircleLine],check:e=>{let t=e.filter(s=>s.type==="slice"),r=e.filter(s=>s.type==="line"),{SLICE:n,LINE:o}=F;if(t.length>n.maxSlicesCount)throw Error("Max slices sections reached");if(r.length>o.maxLinesCount)throw Error("Max lines sections reached");if(t.flatMap(({innerArc:s})=>s.contents.flatMap(l=>typeof l=="string"?l:Object.keys(l)[0])).length>n.innerCircle.maxContentsCount)throw Error("Max contents spread over innerArcs of slices reached")}},middleCircle:{value:[],required:!0,editable:!0,label:"List of arcs spread on the middle circle",type:[a.graphArc],check:e=>{let{maxArcsCount:t,maxContentsCount:r}=F.MIDDLE_CIRCLE;if(e.length>t)throw Error("Max arches reach on middleCircle");if(e.reduce((n,o)=>n+(o.contents?.length||0),0)>r)throw Error("Max contents reach on middleCircle")}},outerCircle:{value:[],required:!0,editable:!0,label:"List of arcs spread on the outer circle",type:[a.graphArc],check:e=>{let{maxArcsCount:t,maxContentsCount:r}=F.OUTER_CIRCLE;if(e.length>t)throw Error("Max arches reach on outerCircle");if(e.reduce((n,o)=>n+(o.contents?.length||0),0)>r)throw Error("Max contents reach on outerCircle")}}},check:(e,t)=>{let{centralPoint:r,innerCircle:n,middleCircle:o,outerCircle:s,...l}=e;if(Object.keys(l).length)throw Error(`Unsupported attribute "${Object.keys(l)[0]}"`);if(!r&&!n?.length&&!o?.length&&!s?.length)throw Error("Empty graph, should be removed");let d=qt(e),m=new Set(d);if(d.length!==m.size)throw Error("Graph should not contain duplicate contents keys");let u=Object.keys(t.children);m.size!==u.length&&console.error(`Inconsistancy in between graph and children: different size (${m.size} vs ${u.length})`)}});p.graph={module:hn};f.group={exam:{exercise:i(1,{label:"Exercise group",editable:!0,required:!0,hidden:!0,options:E(100,1),check:e=>v(e,1,100)})}};var fn=({group:e})=>e?.id,zt={label:"Group id of the user",type:"number",required:!0,private:!0,...c({"last confirmed group for this project":fn})};p.groupId={project:zt,raid:zt};p.groupMax={project:i(1,{label:"Max. group number",required:!0,editable:!0,options:E(20,1),check:(e,t)=>{if(v(e,1,20),t.attrs.groupMin>e)throw Error('Must be bigger or equal to "Min. group number"')}})};p.groupMin={project:i(1,{label:"Min. group number",required:!0,editable:!0,options:E(20,1),check:(e,t)=>{if(v(e,1,20),t.attrs.groupMax<e)throw Error('Must be smaller or equal to "Max. group number"')}})};p.groupSize={raid:i(3,{label:"Average group size",required:!0,editable:!0,options:[3,1,2,...E(17,4)],check:e=>v(e,1,20)})};var hr=({attrs:e})=>Date.now()>e.start,bn=()=>!0,yn=()=>!1,X={type:"boolean",required:!0,private:!0,...c({"from beginning of event":hr})},ae={label:"Starts when",type:"boolean",hidden:!0,required:!0,...c({"temporal-window has started (in hackathon mode)":hr,"always started":bn,"never starts":yn})};f.hasStarted={campus:{module:X,piscine:X},module:{piscine:X,exam:X,project:ae},piscine:{exam:X,raid:X,quest:ae,project:ae},quest:{exercise:ae},exam:{exercise:ae}};p.info={raid:i("Group 1",{editable:!0,label:"Calendar information tag",check:e=>de(e,50)})};var fr={label:"Upload input",required:!0,editable:!0,type:"object",value:{},...L,instruction:'Required option: "type"'},gn={...fr,editable:!1,check:e=>{let[t]=Object.values(e);if(dt(t),!t.type||t.type!=="file")throw Error('"type":"file" property must be defined in the upload input.');if(t.accept!==void 0&&typeof t.accept!="string")throw Error('"accept" property (if added) must be a text. Example: "image/png, image/jpeg"');if(t.required!==void 0&&typeof t.required!="boolean")throw Error('"required" property (if added) must be a true or false.')}},xn=h({label:"Avatar input",required:!0,editable:!1,value:{type:"file",accept:"image/png, image/jpeg",required:!0},type:{type:i("file",{label:"Input type",required:!0,editable:!1}),accept:i("image/png, image/jpeg",{label:"Accepted file types",editable:!1,required:!0}),required:i(!0,{label:"Required",editable:!1,required:!0})}});p.input={"upload-step":gn,"avatar-step":xn,"contact-validation-step":{...fr,check:e=>{let[t]=Object.values(e);if(dt(t),!t.type||t.type!=="tel")throw Error('"type":"tel" property must be defined in the contact validation input.');if(t.required!==void 0&&typeof t.required!="boolean")throw Error('"required" property (if added) must be a true or false.');if(t.label!==void 0&&typeof t.label!="string")throw Error('"label" property (if added) must be a text. Example: "Phone contact"');if(t.placeholder!==void 0&&typeof t.placeholder!="string")throw Error('"placeholder" property (if added) must be a text. Example: "+333 33 33 33 33"');if(t.format!==void 0&&typeof t.format!="string")throw Error('"format" property (if added) must be a text. Example: "Required format: +33 7 17 17 17 17"');if(t.pattern!==void 0){if(typeof t.pattern!="string")throw Error('"pattern" property (if added) must be a text and a valid regex. Example: "[+][0-9]{3}[0-9]{2}[0-9]{2}[0-9]{2}[0-9]{2}"');try{return new RegExp(e)}catch{throw Error("Invalid Regular expression.")}}}}};var br=({attrs:e})=>{let t=Date.now();return t>e.scopeStart&&t<e.scopeEnd},Ut=({attrs:e})=>e.hasStarted,vn=({parent:e})=>e.attrs.inScope,wn=({parent:e,attrs:t})=>{if(e.attrs.inScope){if(ur(e)){let r=Date.now();return r>t.start&&r<t.duration*864e5+t.start}return!0}return e.attrs.hasStarted&&t.category==="bonus"},H={label:"Reward scope",required:!0,type:"boolean"},Ye={...H,private:!0,label:"Active scope (distinct from temporal-window)",...c({"from start date to end date":br})};f.inScope={piscine:{quest:{...H,label:"Reward scope (temporal-window with extra duration)",instruction:"Defines whether the content keeps giving the rewards or not.",...c({"from start day to end of extra duration":br})},raid:Ye,exam:Ye,project:{...H,...c({"parent temporal-window":Ut})}},quest:{exercise:{...H,...c({"parent temporal-window (or one by one in hackathon)":wn}),instruction:"Defines whether the content keeps giving the rewards or not."}},exam:{exercise:{...H,private:!0,...c({"parent scope":vn})}},module:{project:{...H,...c({"parent scope":Ut})},exam:Ye}};var ve=i("",{label:"Programming language",instruction:'Example: "js", "go", "rust"',editable:!0,restrictive:!0});p.language={exam:ve,exercise:ve,raid:ve,project:ve};var kn=({parent:e,attrs:t})=>{if(e&&e.type==="exam")return e.attrs.level;let r=t.difficulty+t.xpIndex,n=De.find(o=>o.xpIndex>r);return n?n.level:0},j=i(1,{label:"Level",required:!0,editable:!0,editableDefaultValue:1,...c({"minimum required":kn}),options:E(q,1),check:e=>v(e,1,q)});f.level={module:{piscine:j,exam:j,project:j},piscine:{quest:j,raid:j,exam:j,project:j},quest:{exercise:j},exam:{exercise:j},campus:{piscine:j}};a.objectChildRelativePath=i("./",{label:"Content relative path",instruction:"As a child of this content",editable:!0,check:G,options:e=>Object.entries(e.children||{}).sort(zr).map(([t,r])=>`./${t}`)});var yr=(e,t)=>{if(!Array.isArray(e)||!e.length){let o=new Error("Must be a non empty array");throw o.userFeedback="This list cannot be empty! Please add an item or remove the setting.",o}let r=[...new Set(e)];if(e.length!==r.length)throw Error("Duplicates are not allowed.");let n=e.filter(o=>!G(o,t,{throwError:!1}));if(n.length){let o=n.map(l=>`'${l}'`).join(", "),s=new Error(`Invalid objects requirements - no object found for the following relative paths: ${o}`);throw s.userFeedback="Some Contents are misconfigured, please update them!",console.error(s.message),s}};a.objectRootRelativePath=i("../",{label:"Content relative path (Mandatory)",instruction:"In same parent",editable:!0,check:(e,t)=>{try{G(e,t)}catch(r){throw r.userFeedback=`This content relative path (${e}) is invalid, please select a valid content in the list below or remove it.`,r}},options:e=>e?.parent?.children?Object.entries(e.parent.children).filter(([n])=>n!==e.key).map(([n])=>`../${n}`):[]});a.sharedObjectList={label:"Contents required",editable:!0,check:(e,t)=>{yr(e.flat(),t)}};var gr={editable:!0,label:"Access conditions"},En={...gr,instruction:"Conditions to access this content",description:"Sets the requirements that have to be met for a content to be accessible to a student.",check:(e,t)=>{let{skills:r,objects:n,...o}=e;if(Object.keys(o).length)throw Error(`Unsupported attribute "${Object.keys(o)[0]}"`);if(!r&&!n)throw Error("Empty requirements, should be removed");let s=(n||[]).flat().filter(l=>!G(l,t,{throwError:!1}));if(s.length){let l=s.map(m=>`'${m}'`).join(", "),d=new Error(`Invalid objects requirements - no object found for the following relative paths: ${l}`);throw d.userFeedback="You have some misconfigured Contents required, please update them!",console.error(d.message),d}}},qn={...gr,instruction:"Conditions to unlock and earn this level",description:"Sets the requirements that have to be met for a level to be unlocked and earned by a student.",check:e=>{let{skills:t,objects:r,...n}=e;if(Object.keys(n).length)throw Error(`Unsupported attribute "${Object.keys(n)[0]}"`);if(!t&&!r)throw Error("Empty requirements, should be removed")}};a.levelDefinition=h({label:"Level definition",type:{level:i(q,{label:"Level",editable:!0,required:!0,primary:!0,options:E(q,1).reverse(),check:(e,t)=>{if(v(e,1,q),t.attrs.levelsDefinitions?.filter(n=>n.level===e)?.length>1)throw Error(`Level ${e} is set for different levels definitions! A given level can only be defined once.`)}}),requirements:h({...qn,type:{skills:{...pt,label:"Skills required",instruction:"Expertises required"},objects:{...a.sharedObjectList,value:(...e)=>{let t=a.objectChildRelativePath.options(...e)?.[0];return t?[t]:[]},type:[a.objectChildRelativePath],instruction:"Items to be succeeded"}},instruction:"Conditions to access this level"})}});var Sn={label:"Level requirements",instruction:"Set the requirements and conditions for the user to access specific levels",value:(...e)=>[b(a.levelDefinition.type,t=>R(t,...e))],editable:!0,restrictive:!0,type:[a.levelDefinition],check:e=>{if(!e?.length||!Array.isArray(e))throw Error("Must be a non empty array")}};p.levelsDefinitions={module:Sn};p.link={"sign-step":h({label:"Associated link to the document",editable:!0,type:{href:i("",{required:!0,editable:!0,label:"URL",instruction:"Href HTML attribute",check:e=>{e.length&&lr(e)}}),label:i("> Link to the document",{editable:!0,label:"Label / text displayed"}),target:i("_blank",{label:"Target HTML attribute",instruction:"Open the link in a new browser tab"})},...L}),"avatar-step":h({label:"Link to the legal page",editable:!1,required:!0,value:{href:"/legal",label:"> Privacy policy",target:"_blank"},type:{href:i("/legal",{editable:!1}),label:i("> Privacy policy",{editable:!1}),target:i("_blank",{editable:!1})}})};f.mandatory={module:{project:{label:"Mandatory content to validate the curriculum",type:"boolean",required:!1,editable:!0}}};var An=(e,t)=>Math.max(t.attrs.group||1,e),Cn=e=>Y(e).reduce(An,1);p.maxGroup={exam:{type:"number",label:"Max exercise group",private:!0,required:!0,...c({"biggest exercise group of the exam":Cn})}};var xr=i("",{label:"Name",editable:!0,...L}),vr={};for(let e of be)e!=="avatar-step"&&(vr[e]=xr);p.name={signup:xr,...vr};var jn=({parent:e})=>e?.type,D={type:"string",private:!0,required:!0,label:"Upper content type",...c({"from parent":jn})};f.parentType={campus:{piscine:D},module:{piscine:D,exam:D,project:D},piscine:{quest:D,exam:D,raid:D,project:D},quest:{exercise:D},exam:{exercise:D}};a.rankDefinitionName=i("",{label:"Name",editable:!0,required:!0,primary:!0,check:(e,t)=>{if(t.attrs.ranksDefinitions?.filter(n=>n.name===e)?.length>1)throw Error(`Name "${e}" is already set for a rank definition! A given name can only be attributed once to a rank.`)}});a.rankDefinition=h({label:"Rank requirements",type:{name:a.rankDefinitionName,level:i(q,{label:"Level required",editable:!0,required:!0,check:(e,t)=>{if(v(e,0,q),t.attrs.ranksDefinitions?.filter(n=>n.level===e)?.length>1)throw Error(`Level ${e} is already set for a rank definition! A given level can only be attributed once to a rank.`)}}),milestone:i("",{label:"Milestone description",editable:!0})}});var Gt={label:"Rank requirements",instruction:"List of ranks access conditions",editable:!0,restrictive:!0,value:(...e)=>[b(a.rankDefinition.type,t=>R(t,...e))],type:[a.rankDefinition],check:e=>{if(!e?.length||!Array.isArray(e))throw Error("Must be a non empty array")}};p.ranksDefinitions={module:Gt,piscine:Gt};var oe={label:"Registration duration (to an event)",required:!0,editable:!0,check:e=>$e(e*6e4,1*6e4,365*864e5)};p.registrationDuration={exam:i(1.5*864e5/6e4,oe),module:i(30*864e5/6e4,oe),interview:i(2*6048e5/6e4,oe),piscine:i(30*864e5/6e4,oe),raid:i(1.5*864e5/6e4,oe)};var Dn=`https://${process.env.DOMAIN}/git/`,In=({attrs:e})=>`${Dn}${e.repositoryPath}`,Qe={label:"Repository URL",type:"string",required:!0,private:!0,...c({"from gitea user account":In})};p.repository={exercise:Qe,project:Qe,raid:Qe};var wr=({group:e,parent:t})=>(e||(e=t?.group),e&&(e.captainLogin||e.captain?.login)),Rn=({name:e,group:t,parent:r},n)=>`${wr({group:t,parent:r})||n.login}/${e}`,Mn=({attrs:e,parent:t,group:r},n)=>{let o=wr({parent:t,group:r});return o?`${o}/${t.path.replace(/\/+/g,"-")}`:`${n.login}/${e.rootName}`},Je={label:"Repository path",type:"string",required:!0,private:!0,...c({"from captain":Rn})};p.repositoryPath={exercise:{...Je,...c({"from captain":Mn})},project:Je,raid:Je};p.requiredAuditRatio={project:i(.5,{label:"Audit ratio required to begin the project",instruction:"From 0 to 2 (1 being the perfect balance of audits)",required:!0,editable:!0,options:[...Array(21)].map((e,t)=>Math.round(t*.1*10)/10),check:e=>Me(e,0,2)})};a.pathwaysRequirementObjects={label:"Multiple content choices",instruction:"Adding this will create a new path way for the project being edit.",check:(e,t)=>{yr(e.flat(),t)},required:!1,editable:!0,type:[{...a.objectRootRelativePath,label:"Content relative path (optional)"}],value:(...e)=>{let t=a.objectRootRelativePath.options(...e)?.[0];return t?[t]:[]}};var we=h({...En,type:{skills:{...pt,label:"Skills required",instruction:"Necessary skill level to unlock the current content",description:"Define the skills and tier required to unlock the current content. The skill tracker button opens a modal where you can visualize the contents that reward the selected skill"},objects:{...a.sharedObjectList,value:(...e)=>{let t=a.objectRootRelativePath.options(...e)?.[0],r=a.pathwaysRequirementObjects.value(...e);return t?[t,r]:[]},type:[a.objectRootRelativePath,a.pathwaysRequirementObjects],instruction:"Content required to unlock the current one"}}});f.requirements={module:{project:we,piscine:we},campus:{piscine:{hidden:!0,...we},module:{hidden:!0,...we}}};var ke=i("",{label:"Resume",editable:!0,...L});p.resume={"module-registration":ke,"piscine-registration":ke,"form-step":ke,interview:ke};var $n=({attrs:e})=>e.baseSkills,Ze=({attrs:e})=>e.baseXp,On=({attrs:e})=>e.inScope?e.baseXp:0;a.skills={...c({"collect skills":$n}),label:"Skills",required:!0};var je={private:!0,required:!0,label:"Reward conditions",instruction:"Conditions to collect xp and skills when succeeded"},Ee=h({type:{skills:a.skills,xp:{...c({"collect xp in scope":On}),label:"XP",required:!0}},...je});f.rewards={piscine:{raid:h({type:{skills:a.skills,xp:{...c({"collect xp":Ze}),label:"XP",required:!0}},...je}),project:Ee},module:{piscine:h({type:{skills:a.skills,xp:{...c({"collect xp":Ze}),label:"XP",required:!0}},...je}),project:Ee},campus:{piscine:h({type:{skills:a.skills,xp:{...c({"collect xp":Ze}),label:"XP",required:!0}},...je})},quest:{exercise:Ee},exam:{exercise:Ee}};var Tn=({parent:e})=>{let{attrs:t,name:r,type:n,id:o,path:s}=e;return n!=="campus"?{attrs:{eventId:t.eventId},name:r,type:n,id:o,path:s}:void 0};f.rewardsTarget={module:{piscine:{type:"object",label:"Target of the rewards",instruction:"Content to which rewards are attributed",required:!0,...c({"parent event if exists":Tn})}}};var Ln=({parent:e})=>{for(;e;){if(e.type==="module"||e.type==="piscine")return e.key;e=e.parent}return""},se={type:"string",private:!0,...c({"root content key":Ln}),required:!0,label:"Root key"};f.rootName={quest:{exercise:se},exam:{exercise:se},module:{project:se},piscine:{project:se,raid:se}};var Pn=({parent:e})=>{for(;e;){if(e.type==="module"||e.type==="piscine")return e.path;e=e.parent}},M={type:"string",required:!0,private:!0,...c({"root content path":Pn}),label:"Root path"};f.rootPath={module:{project:M,piscine:M,exam:M},piscine:{project:M,raid:M,exam:M,quest:M},quest:{exercise:M},exam:{exercise:M}};var Nn=e=>kt(e.attrs.scopeStart,e),Fn=({event:e})=>e&&fe(e.endAt),kr={type:"number",required:!0,private:!0},et={...kr,label:"Active scope end",...c({"when event ends":Fn})},tt={...kr,label:"Reward scope end",...c({"when extra duration ends":Nn})};f.scopeEnd={piscine:{raid:et,exam:et,quest:tt,project:tt},module:{project:tt,exam:et}};var _n=i(0,{label:"Extra duration (for reward scope)",editable:!0,check:e=>$e(e*864e5,0,50*864e5)});f.scopeExtraDuration={piscine:{quest:_n}};var Vn=({attrs:e})=>e.start,Er={type:"number",required:!0,private:!0,...c({"from start date":Vn})},rt={...Er,label:"Active scope start"},nt={...Er,label:"Temporal-window & reward scope start"};f.scopeStart={piscine:{quest:nt,project:nt,raid:rt,exam:rt},module:{exam:rt,project:nt}};var Bn=({parent:e})=>e?.attrs.special;p.special={quest:i(!1,{label:"Activate hackathon mode",editable:!0,restrictive:!0}),exercise:{label:"In hackathon mode",type:"boolean",required:!0,...c({"activated with the quest":Bn})}};var mt=e=>{let t=Br(e,Wr),r=t?.event;if(r){let n=fe(r.startAt);return t===e?n:Ne(n,e)}if(e.parent)return Ne(e.parent.attrs.start,e)},$={label:"Start date",type:"number",required:!0,private:!0,...c({"from start date of event":mt})},Xt={...$,...c({"starts with module":mt})},Wn=({parent:e,attrs:t})=>e?.attrs.start+t.delay,zn={...$,...c({"from temporal-window (if in hackathon mode)":Wn})};f.start={campus:{module:$,piscine:$},module:{exam:$,piscine:$,project:Xt},piscine:{raid:$,exam:$,quest:{...$,...c({"from temporal-window":mt})},project:Xt},quest:{exercise:zn}};var le=i(0,{label:"Starts after a delay of (within the event)",editable:!0,required:!0});f.startAfter={module:{piscine:le,exam:le},piscine:{exam:le,raid:le},campus:{piscine:le}};var qr=({prev:e})=>e?e.attrs.duration+e.attrs.startDay:1,Un=({parent:e,prev:t})=>e.type==="piscine"?qr({prev:t}):void 0,qe=i(1,{label:"Start day n\xB0",...c({"from end of previous content temporal-window":qr}),required:!0,private:!0});f.startDay={piscine:{exam:{...qe,...c({"from end of previous content temporal-window":Un})},quest:qe,raid:qe,project:qe}};var P=e=>{if(e?.isDone)return e.grade>=1?"succeeded":"failed"},Gn=e=>{let{attrs:t,progress:r,parent:n}=e,o=P(r);if(o)return o;if(!n)return"available";if(n.attrs.status==="blocked")return"blocked";let{group:s}=t;if(s<=1)return n.attrs.status;let l=Y(n).filter(u=>u.attrs.group<s),d=Math.max(...l.map(u=>u.attrs.group));return l.filter(u=>u.attrs.group===d).some(u=>u.attrs.status==="succeeded")?"available":"blocked"},Xn=e=>{let{prev:t,attrs:r,progress:n,parent:o}=e,s=P(n);if(s)return s;if(!o)return"available";if(o.attrs.status==="blocked")return"blocked";let l=Date.now();if(r.special)return l<r.start?"blocked":l>r.duration+r.start?"failed":"available";if(t&&t.attrs.status!=="succeeded")return"blocked";let d=Date.now()+864e5;if(o.prev?.type==="project"&&o.prev?.attrs.status!=="succeeded"&&o.prev?.attrs.scopeEnd>d)return"blocked";let m=Zt(o.prev,er);return m&&m.attrs.status!=="succeeded"&&m.attrs.scopeEnd>d?"blocked":"available"},Kt=(e,t)=>{try{return G(e,t)?.attrs.status==="succeeded"}catch{return!0}},Ht=(e,t)=>{let n=e.parent.children[t.slice(3)]?.versions?.map(({key:o})=>`../${o}`);return n?.length?[t,...n]:[t]},Kn=(e,t)=>{if(!e)return!0;let{objects:r}=e;if(!r||!r.length)return!0;let n=r.map(m=>Array.isArray(m)?m.flatMap(u=>Ht(t,u)):Ht(t,m)),o=n.filter(m=>!Array.isArray(m)&&!!m),s=n?.filter(m=>Array.isArray(m)&&!!m),l=o.every(m=>Kt(m,t)),d=s?.every(m=>m.some(u=>Kt(u,t)));return d!==void 0?l&&d:l},ht=({requirements:e,object:t,user:r,progress:n})=>{if(n&&Object.keys(n).length||!e)return!0;let o=Ct(e.skills,r.skills);return Kn(e,t)&&o},Hn=e=>{let{prev:t,parent:r,attrs:n}=e;return!r.progress||!n.hasStarted||Date.now()<n.scopeEnd&&Sr(t)?"blocked":"available"},Yt=(e,t)=>{let{attrs:r,progress:n}=e,{requirements:o,parentType:s}=r,l=P(n);return l||(ht({object:e,requirements:o,user:t,progress:n})?s==="piscine"?Hn(e):"available":"blocked")},Sr=e=>e?.attrs.inScope&&e?.attrs.status!=="succeeded",Yn=e=>{for(let t of e){if(!Re(t))continue;if(!t.progress)return"failed";let r=P(t.progress);if(r&&r!=="succeeded")return r}return"succeeded"},it=e=>{let{prev:t,parent:r,attrs:n,progress:o}=e;if(!r||!r.progress||!n.hasStarted||!n.special&&Date.now()>n.scopeEnd&&Sr(Zt(t,er)))return"blocked";let s=Object.values(e.children||{});return s.length?Yn(s):P(o)||"available"},Qn=(e,t)=>{let{progress:r,attrs:n}=e,{requirements:o}=n;return ht({object:e,requirements:o,user:t,progress:r})},Qt=(e,t)=>{let{progress:r,event:n,attrs:o}=e,{requirements:s}=o,l=P(r);return l||(!ht({object:e,requirements:s,user:t,progress:r})&&!n?.registeredPosition?"blocked":"available")},Jn=e=>{let{progress:t,event:r,attrs:n}=e,o=P(t);return o||(!r||Date.now()<n.start?"blocked":"available")},Zn=()=>"available",ei=(e,t)=>t?.event&&(e==="interview"||e==="piscine-registration")&&new Date(t.event.endAt)>Date.now(),ti=e=>{let t=e.type.endsWith("-registration"),r=e.type.split("-")[0],n=t?It(e.parent.parent.children,r):e;if(!n)return"blocked";let o=n.lastProgress,s=P(o);return s==="succeeded"&&ei(e.type,n.lastProgress)?"available":s||(!e.prev||e.prev&&e.prev.attrs.status==="succeeded"?"available":"blocked")},ce={type:"string",label:"Unlock system",...c({"previous step validated":ti}),options:["blocked","available","succeeded","failed"],required:!0},I={type:"string",label:"Unlock system and result status",required:!0,options:["blocked","available","succeeded","failed"]};f.status={campus:{onboarding:{type:"string",private:!0,required:!0,...c({"always open":Zn})},piscine:{...I,...c({"by requirements and event":Qt})}},onboarding:{administration:ce,games:ce,"piscine-registration":ce,"module-registration":ce,interview:ce},piscine:{exam:{...I,...c({"by event":it})},quest:{...I,...c({"by scope":it})},raid:{...I,...c({"by event":Jn})},project:{...I,editable:!0,editableDefaultValue:"available",...c({"by requirements":Yt})}},quest:{exercise:{...I,editable:!0,editableDefaultValue:"available",...c({"one by one":Xn})}},exam:{exercise:{...I,editable:!0,editableDefaultValue:"available",...c({"one by one (grouped by difficulty)":Gn})}},module:{project:{...I,editable:!0,editableDefaultValue:"available",...c({"by requirements":Yt})},piscine:{...I,...c({"by requirements and event":Qt})},exam:{...I,...c({"by event":it})}}};a.meetRequirements=i(!1,{label:"User meet requirement",restrictive:!0,required:!0,hidden:!0,...c({"by requirements":Qn})});f.meetsRequirements={module:{piscine:a.meetRequirements,project:a.meetRequirements}};var ri=e=>`/markdown/root/public/${`subjects/${ir(e)}/README.md`}`,at=i("",{label:"Subject URL",editable:!0,required:!0,...c({"README.md in subject folder":ri})});p.subject={exercise:at,project:at,raid:at};var Se=i("",{editable:!0,...L});a.teamworkRankName=i("",{label:"Rank name",type:"string",editable:!0,required:!0,primary:!0,check:(e,t)=>{let{teamworkRanks:r}=t.attrs;if(r?.filter(o=>o.name===e)?.length>1)throw Error(`Name "${e}" is already set for a teamwork rank definition! A given name can only be attributed once to a rank.`)}});a.teamworkRankParticipations=i(0,{label:"Group Participations",instruction:"The number of users the student has to work with, to unlock this rank.",editable:!0,required:!0,options:E(150,0),type:"number",check:(e,t)=>{if(!Number.isInteger(e))throw Error("Must be a whole number");if(t.attrs.teamworkRanks?.filter(n=>n.groups===e)?.length>1)throw Error(`There is already a rank with ${e} users required for the rank`)}});a.teamworkRanks=h({type:{name:a.teamworkRankName,groups:a.teamworkRankParticipations}});p.teamworkRanks={campus:{label:"Teamwork ranks",instruction:"List of teamwork ranks",type:[a.teamworkRanks],required:!0,editable:!0,value:(...e)=>[b(a.teamworkRanks.type,t=>R(t,...e))],check:e=>{if(!e?.length||!Array.isArray(e))throw Error("Must be a non empty array")}}};p.text={"upload-step":{...Se,label:"Resume"},"sign-step":{...Se,label:"Text to agree to",required:!0},"contact-validation-step":{...Se,label:"Resume"},"avatar-step":{...Se,label:"Resume"}};a.timelineChunk=h({label:"Month guideline",type:{month:i(1,{label:"Month",editable:!0,required:!0,primary:!0,check:(e,t)=>{if(v(e,1,120),t.attrs.timeline?.filter(n=>n.month===e)?.length>1)throw Error(`Month ${e} is set for different timeline guidelines! A given month can only be defined once.`)}}),minLevel:i(0,{label:"Minimum level",instruction:"Minimum level to be considered on time",editable:!0,required:!0,check:e=>v(e,0,q)}),expectedLevel:i(0,{label:"Expected level",editable:!0,required:!0,instruction:"Recommended level the user should achieve",check:e=>v(e,0,q)}),checkpointLevel:i(0,{label:"Checkpoint level",editable:!0,required:!0,instruction:"Recommended checkpoint level the user should achieve",check:e=>v(e,0,100)}),rank:i("",{label:"Rank",editable:!0,instruction:"Recommended rank the user should achieve",options:e=>e.attrs.ranksDefinitions?.map(t=>t.name),check:(e,t)=>{if(!t.attrs.ranksDefinitions?.length)throw Error("Must match an existing rank name, but ranks definitions are not set.");let r=t.attrs.ranksDefinitions?.map(({name:n})=>n);if(!r.includes(e))throw Error(`Must match one of the following existing rank names: ${r.join(", ")}.`)}}),skills:h({label:"Skills",instruction:"Recommended skills the user should get",editable:!0,value:{},type:b(Ve,({name:e,type:t,description:r})=>({label:e,instruction:t,description:r,editable:!0,type:"number",value:1,options:E(100,1),check:n=>v(n,1,100)}))}),notes:i("",{label:"Other notes",instruction:"Write any other notes or expectations the user should aim for",editable:!0})}});var Jt={label:"Timeline of the curriculum",instruction:"Create a timeline with monthly expectations for users to better track their progression over time",value:(...e)=>[b(a.timelineChunk.type,t=>R(t,...e))],editable:!0,restrictive:!0,type:[a.timelineChunk],check:e=>{if(!e?.length||!Array.isArray(e))throw Error("Must be a non empty array")}};p.timeline={module:Jt,piscine:Jt};a.adminSelectionValidation=h({type:{type:i("admin_selection",{required:!0,private:!0,primary:!0,label:"Type",options:["admin_selection"]})},label:"Admin selection",description:"Admins manually select which submissions move forward."});var ni=({attrs:e})=>e.language&&`ghcr.io/01-edu/test-${e.language}`;a.testerValidation=h({label:"Automatic testing",description:"The solution submitted by the user will be automatically tested and a result will immediately be available.",type:{type:i("tester",{required:!0,private:!0,label:"Type",options:["tester"]}),testImage:{type:"string",label:"Docker image",required:!0,editable:!0,primary:!0,instruction:"used to run the tests",...c({"from language":ni})},cooldown:i(3*6e4,{required:!0,editable:!0,label:"Delay between two submit"})}});var ft={type:"object",required:!0,label:"Audited by",instruction:"Match groups with auditors"},ii=({attrs:e})=>({campus:{_eq:e.campus}}),ai=({attrs:e})=>({campus:{_eq:e.campus},_not:{roles:{slug:{_in:["admin",`campus_admin_${e.campus}`]}}}}),oi=({attrs:e})=>({events:{eventId:{_eq:e.eventId}}}),si=({attrs:e})=>({_not:{roles:{slug:{_in:["admin",`campus_admin_${e.campus}`]}}},events:{eventId:{_eq:e.eventId}}}),bt={id:{_eq:1}},li=({event:e})=>({_or:[{labels:{label:{name:{_eq:`auditorFor${e?.id}`}}}},bt]}),ci=({attrs:e})=>({_or:[{private:{roles:{slug:{_eq:`campus_admin_${e.campus}`}}}},bt]}),ui=()=>bt,di=e=>`/markdown/raw/root/public/${`subjects/${ir(e)}/audit/README.md`}`,yt={required:!0,editable:!0,type:"string",label:"Audit form URL",instruction:"List of questions asked by the auditor during the audit. The URL should return raw markdown",...c({"README in audit folder":di})};a.adminAuditValidationDelay=i(0,{label:"Audit duration",editable:!0,required:!0,instruction:"Time that the admins have to complete an audit before it expires"});a.adminAuditValidationRequired=i(1,{label:"Number required",required:!0,instruction:"Minimum of audits required",check:e=>{if(e<1)throw Error("must be at least one")}});a.adminAuditValidationRatio=i(1,{label:"Ratio",required:!0,instruction:"Proportion of extra audits generated",check:e=>{if(e<1)throw Error("must be at least one")}});a.adminAuditValidation=h({label:"Admin audit",description:"Only admins can evaluate this content.",type:{type:i("admin_audit",{required:!0,private:!0,primary:!0,label:"Type",options:["admin_audit"]}),delay:a.adminAuditValidationDelay,required:a.adminAuditValidationRequired,ratio:a.adminAuditValidationRatio,matchWhere:{...ft,...c({"an admin of same campus":ci,"manual attribution":ui})},form:yt}});a.userAuditValidationDelay=i(2*6048e5/6e4,{label:"Audit duration",required:!0,editable:!0,instruction:"Time that the users have to complete an audit before it expires"});a.userAuditValidationRequired=i(5,{label:"Number required",required:!0,editable:!0,instruction:"Minimum of audits required",check:e=>{if(e<1)throw Error("must be at least one")}});a.userAuditValidationRatio=i(2,{label:"Ratio",required:!0,editable:!0,instruction:"Proportion of extra audits generated",check:e=>{if(e<1)throw Error("must be at least one")}});a.matchInfluence=h({label:"Audit Attribution Influence",editable:!0,required:!0,instruction:"Adjust the weights in the match algorithm to influence how audits are attributed",type:{auditsRatio:i(1,{label:"Current Audit Ratio",editable:!0,required:!0}),auditsAssigned:i(1,{editable:!0,required:!0,label:"Fewest Pending Audits"}),levelProximity:i(1,{editable:!0,required:!0,label:"Level Proximity"}),lastAuditAttributed:i(1,{editable:!0,required:!0,label:"Last Audit Attributed"})}});a.userAuditValidation=h({label:"User audit",description:"Users will be assigned as auditors to peer-review the project submission. You can customise the rules of audit attribution and requirements for the group to succeed.",type:{type:i("user_audit",{required:!0,private:!0,primary:!0,label:"Type",options:["user_audit"]}),delay:a.userAuditValidationDelay,required:a.userAuditValidationRequired,ratio:a.userAuditValidationRatio,matchInfluence:a.matchInfluence,matchWhere:{...ft,...c({"any user in same campus":ai,"any user in same event":si,"any user in same campus (with admins)":ii,"any user in same event (with admins)":oi})},form:yt,preQuestions:{editable:!0,type:"array",label:"Pre questions",instruction:"Define a set of questions that appear before the main audit. Go to \u201Cedit & preview\u201D mode to visualize the question content"},postQuestions:{editable:!0,type:"array",label:"Post questions",instruction:"Define a set of questions that appear after the main audit. Go to \u201Cedit & preview\u201D mode to visualize the question content"}}});a.raidAuditorValidation=h({label:"Dedicated auditors for event",description:"Define a list of users that will audit the content. This list is created on each event related to this content, and needs to be available before the event ends.",type:{type:i("dedicated_auditors_for_event",{required:!0,private:!0,primary:!0,label:"Type",options:["dedicated_auditors_for_event"]}),delay:a.adminAuditValidationDelay,required:a.adminAuditValidationRequired,ratio:a.adminAuditValidationRatio,matchWhere:{...ft,...c({"any user labelled as event's auditor ":li})},form:yt}});var ue={label:"Evaluations required",instruction:"Define the evaluation methods for this content",check:e=>{if(!e.length)throw Error("must have at least one element")},required:!0,editable:!0};p.validations={project:{...ue,type:[a.userAuditValidation],value:(...e)=>[b(a.userAuditValidation.type,t=>R(t,...e))]},raid:{...ue,type:[a.adminAuditValidation,a.raidAuditorValidation],maxElements:1,value:(...e)=>[b(a.adminAuditValidation.type,t=>R(t,...e))]},exercise:{...ue,type:[a.testerValidation],value:(...e)=>[b(a.testerValidation.type,t=>R(t,...e))]},piscine:{...ue,type:[a.adminSelectionValidation],value:(...e)=>[b(a.adminSelectionValidation.type,t=>R(t,...e))]},interview:{...ue,type:[a.adminSelectionValidation],value:(...e)=>[b(a.adminSelectionValidation.type,t=>R(t,...e))]}};p.videos={quest:i("https://www.youtube.com/",{type:"string",label:"Videos URL",editable:!0,check:lr})};p.legalText={"avatar-step":i("Please make sure to upload a photograph that complies with the training center's internal regulations and standards of decency. This photo will be visible to the teaching staff to support essential individual academic monitoring, as well as to other learners to facilitate peer-to-peer collaboration. Any request for deletion or modification must be submitted to the management.",{type:"string",label:"Legal text",editable:!1,required:!0})};var pi=({attrs:e})=>{if(!e.startDay)return;let t=e.startDay/7;return Math.ceil(t)},Ae=i(1,{label:"Week n\xB0",required:!0,private:!0,...c({"from day n\xB0":pi})});f.week={piscine:{exam:Ae,quest:Ae,raid:Ae,project:{...Ae,value:1,functions:void 0,required:!1,private:!1}}};var mi=({object:e,value:t})=>{let r=Object.values(e.parent.children).filter(({type:n,key:o})=>o!==e.key&&n==="raid");for(let{attrs:n}of r)if(n.branch===t)throw Error("Raids should have their unique branch")},Ar=({object:e,value:t,limit:r=9})=>{if(Object.values(e.parent.children).filter(({key:o,attrs:s})=>o!==e.key&&s.branch===t).length+1>r)throw Error(`The limit of content in a branch is ${r}`)},Cr={label:"Base Branch",instruction:"From 1 to 4",description:"Changing branch can disrupt the piscine timeline.",required:!0,editable:!0,hidden:!0},hi=e=>{let r={};for(let o of Object.values(e.parent.children||{})){let s=o.attrs.branch;r[s]=(r[s]||0)+1}return[1,2,3,4].filter(o=>(r[o]||0)<9)},Ce=i(1,{...Cr,options:hi,check:(e,t)=>{Me(e,1,4),Ar({object:t,value:e})}}),fi=i(1,{...Cr,options:[1,2,3,4],check:(e,t)=>{Me(e,1,4),mi({object:t,value:e}),Ar({object:t,value:e})}});f.branch={piscine:{quest:Ce,project:Ce,raid:fi,sharedBranch:Ce,exam:Ce}};var ot=i(0,{required:!0,private:!0}),bi=({parent:e})=>e.attrs.xpIndex,yi=({prev:e,parent:t})=>e?(e.attrs.xpIndex||0)+(ut(e)||1):t?.attrs.xpIndex||0,W={required:!0,private:!0,type:"number",...c({"from previous xpIndex and XP coefficient (or parent if exam or no prev)":yi})};f.xpIndex={campus:{module:ot,piscine:ot},module:{piscine:ot,project:W,exam:W},piscine:{exam:W,project:W,quest:W,raid:W},quest:{exercise:W},exam:{exercise:{required:!0,private:!0,type:"number",...c({"from parent xpIndex":bi})}}};var gt={ab:"Abkhazian",aa:"Afar",af:"Afrikaans",sq:"Albanian",am:"Amharic",ar:"Arabic",hy:"Armenian",as:"Assamese",ay:"Aymara",az:"Azerbaijani",ba:"Bashkir",eu:"Basque",bn:"Bengali (Bangla)",dz:"Bhutani",bh:"Bihari",bi:"Bislama",br:"Breton",bg:"Bulgarian",my:"Burmese",be:"Byelorussian (Belarusian)",km:"Cambodian",ca:"Catalan",zh:"Chinese (Simplified)",co:"Corsican",hr:"Croatian",cs:"Czech",da:"Danish",nl:"Dutch",en:"English",eo:"Esperanto",et:"Estonian",fo:"Faeroese",fa:"Farsi",fj:"Fiji",fi:"Finnish",fr:"French",fy:"Frisian",gl:"Galician",gd:"Gaelic (Scottish)",gv:"Gaelic (Manx)",ka:"Georgian",de:"German",el:"Greek",kl:"Greenlandic",gn:"Guarani",gu:"Gujarati",ha:"Hausa",he:"Hebrew",hi:"Hindi",hu:"Hungarian",is:"Icelandic",id:"Indonesian",ia:"Interlingua",ie:"Interlingue",iu:"Inuktitut",ik:"Inupiak",ga:"Irish",it:"Italian",ja:"Japanese",kn:"Kannada",ks:"Kashmiri",kk:"Kazakh",rw:"Kinyarwanda (Ruanda)",ky:"Kirghiz",rn:"Kirundi (Rundi)",ko:"Korean",ku:"Kurdish",lo:"Laothian",la:"Latin",lv:"Latvian (Lettish)",li:"Limburgish ( Limburger)",ln:"Lingala",lt:"Lithuanian",mk:"Macedonian",mg:"Malagasy",ms:"Malay",ml:"Malayalam",mt:"Maltese",mi:"Maori",mr:"Marathi",mo:"Moldavian",mn:"Mongolian",na:"Nauru",ne:"Nepali",no:"Norwegian",oc:"Occitan",or:"Oriya",om:"Oromo (Afan, Galla)",ps:"Pashto (Pushto)",pl:"Polish",pt:"Portuguese",pa:"Punjabi",qu:"Quechua",rm:"Rhaeto-Romance",ro:"Romanian",ru:"Russian",sm:"Samoan",sg:"Sangro",sa:"Sanskrit",sr:"Serbian",sh:"Serbo-Croatian",st:"Sesotho",tn:"Setswana",sn:"Shona",sd:"Sindhi",si:"Sinhalese",ss:"Siswati",sk:"Slovak",sl:"Slovenian",so:"Somali",es:"Spanish",su:"Sundanese",sw:"Swahili (Kiswahili)",sv:"Swedish",tl:"Tagalog",tg:"Tajik",ta:"Tamil",tt:"Tatar",te:"Telugu",th:"Thai",bo:"Tibetan",ti:"Tigrinya",to:"Tonga",ts:"Tsonga",tr:"Turkish",tk:"Turkmen",tw:"Twi",ug:"Uighur",uk:"Ukrainian",ur:"Urdu",uz:"Uzbek",vi:"Vietnamese",vo:"Volap\xFCk",cy:"Welsh",wo:"Wolof",xh:"Xhosa",yi:"Yiddish",yo:"Yoruba",zu:"Zulu"},Hi=Object.fromEntries(Object.entries(gt).map(([e,t])=>[t,e]));var jr={boolean:e=>typeof e=="boolean",number:e=>typeof e=="number",string:e=>typeof e=="string",object:e=>typeof e=="object"&&e!==null,array:Array.isArray},gi=e=>Array.isArray(e)?"array":typeof e=="object"&&e!==null?e.type||"object":typeof e,Te=(e,t,r,n)=>{let{type:o,check:s,options:l}=e;if(t==null){if(!e.required||e.value!==void 0)return!0;throw Error(`missing value for required attribute ${n}`)}if(!o)throw Error(`attribute type definition is missing for ${n}`);if(t?.type==="function"){if(e.functionsByName[t.name])return!0;throw Error(`function associated not allowed for ${n}`)}if(s?.(t,r,n),l){let u=typeof l=="function"?l(r,t):l;if(u.length===1){if(u[0]!==t)throw Error(`${n} must be ${u[0]} but was ${t}`)}else if(!u.includes(t))throw Error(`invalid option for ${n}: should be included in ${u.join(", ")}`)}if(jr[o]){if(!jr[o](t))throw Error(`Expect ${o} for ${n}`);return!0}if(Array.isArray(o)){if(!Array.isArray(t))throw Error(`invalid attribute value: expects an array for ${n}`);let u=o.length===1&&o[0],w=!u&&Object.fromEntries(o.map(k=>[Array.isArray(k.type)?"array":k.type?.type?.value||k.type,k]));for(let[k,A]of t.entries()){let N=Error("checks failed for all types");N.index=k,N.key=n,N.label=e.label;let Le=u||w[gi(A)];if(!Le)throw N.details={label:"Unknown structure",err:Error("no type matches the value")},N;try{Te(Le,A,r,n)}catch(Pe){throw N.details=Pe.details||{label:Le.label||Pe.label,err:Pe},N}}return!0}if(typeof o!="object")throw Error("invalid attribute type definition");if(typeof t!="object"||t===null)throw Error("invalid attribute value: expects an object");let d=Object.entries(o),m=Object.keys(t).find(u=>!o[u]);if(m)throw Error(`${m} is invalid.`);for(let[u,w]of d)Te(w,t[u],r,u);return!0},me=ye(p,([e,t])=>[e,b(t,r=>({...r,check:(n,o)=>Te(r,n,o,e)}))]),he=ye(f,([e,t])=>[e,b(t,r=>b(r,n=>({...n,check:(o,s)=>Te(n,o,s,e)})))]);var xt={},xi=Object.entries(gt);for(let[e,t]of Object.entries(me))for(let[r,n]of Object.entries(t)){let o=xt[r]||(xt[r]={});o[e]=n;let{label:s,...l}=n;if(n.functionsByName?.translate)for(let[d,m]of xi){let u=`${s} - ${m}`;o[`${e}-${d}`]={...l,label:u,lgCode:d,required:!1}}}var vt={};for(let[e,t]of Object.entries(he))for(let[r,n]of Object.entries(t))for(let[o,s]of Object.entries(n)){let l=vt[r]||(vt[r]={}),d=l[o]||(l[o]={});d[e]=s}var ea=b(xt,Object.entries),ta=b(vt,e=>b(e,Object.entries));var vi=e=>e.toLowerCase().replaceAll(/[^a-z0-9]+/g," ").trim().replaceAll(" ","-"),wi=e=>{let{type:t,name:r,attrs:n,children:o,childrenAttrs:s,referencePath:l,...d}=e,[m]=Object.keys(d);if(m)throw Error(`Unexpected property ${m}, did you mean to define an attribute ?`);if(t==="campus")throw Error("Campuses can't be defined in definitions");if(!St.has(t))throw Error("Invalid type property");if(!r||typeof r!="string")throw Error("Invalid name property");if(!n||typeof n!="object"||Array.isArray(n))throw Error("Invalid attrs property");if(s)throw Error("childrenAttrs is no longer supported");for(let u of Object.keys(n||{})){if(he[u])throw Error(`Attr ${u} should be defined in the relation with its parent, not on the object itself.`);let w=me[u];if(!w)throw Error(`Undefined attr ${u}`);let k=w[t];if(!k){let A=Object.keys(w).join(", ");throw Error(`${t} does not match any of ${A} for attr ${u}`)}if(k.deprecated)throw Error(`attr ${u} deprecated: ${k.deprecated}`)}},Dr=({name:e,type:t,attrs:r,children:n,referencePath:o},s,l)=>{if(l>100)throw Error("Unexpected very deep tree, maybe circular ?");let d={name:e,type:t,attrs:r,children:{},referencePath:o,parent:s};if(!n)return d;let m;for(let[u,{ref:w,...k}]of Object.entries(n)){let A=Dr(w,d,(l||0)+1);A.attrs={...A.attrs,...k},m&&(m.next=A),A.prev=m,d.children[u]=A}return d},ki=(e,t,r)=>{if(!/^[a-z0-9-]*$/.test(t))throw Error(`Invalid key for child ${t} Kebab-case key suggestion: ${vi(t)}`);let n=r.ref,{type:o}=n;if(!At[e.type].includes(o))throw Error(`Type ${o} ${t} is not a possible child`);if(e.referencePath===n.referencePath)throw Error(`Self reference in child ${t}`);for(let l of Object.keys(r)){if(l==="ref")continue;let d=me[l];if(d?.[o]?.restrictive)throw Error(`Attr ${l} should be defined on the object itself, not in the relation with its parent.`);let m=he[l];if(!d&&!m)throw Error(`Undefined attr ${l}`);let u=(m?.[e.type]||d)[o];if(!u){let w=Object.keys(d).join(", ");throw Error(`${o} does not match any of ${w} for attr ${l}`)}if(u.deprecated)throw Error(`attr ${l} deprecated: ${u.deprecated}`)}},Ir=e=>{for(let[t,r]of Object.entries(e.attrs))try{let n=he[t]?.[e.parent?.type]?.[e.type]||me[t][e.type];if(r?.type==="function"){if(!n.functionsByName?.[r.name])throw Error(`function ${r.name} not found for attr ${t}`)}else if(!n.check(r,e))throw Error(`wrong type for attr ${t}`)}catch(n){throw n.parentRef=e.parent?.referencePath,n.childRef=e.referencePath,n.value=r,n.key=t,n}for(let t of Object.values(e.children))Ir(t)},Ei=e=>e.type==="exam",qi=e=>{let t={};for(let r of e.filter(Ei)){let n=0;for(let[o,s]of Object.entries(r.children))try{let{group:l}=s;if(!l)throw Error("missing exam group");let d=l-n;if(n=l,d>1)throw Error("exam must not have gaps in groups");if(d<0)throw Error("exercise must be sorted by group from lower to greater");let m=t[o];if(m==null)t[o]=l;else if(m!==l)throw Error("Exercise used in different exam groups")}catch(l){throw l.exam=r.referencePath,l.exercise=s.ref.referencePath,l}}},Rr=async e=>{let t={},r=async([s,l])=>{let d;try{let u=t[s];if(d=await(u||(t[s]=e(s))),l&&(l.ref=d),u)return[]}catch(u){throw u.name=s,u}try{wi(d)}catch(u){throw u.type=d.type,u.referencePath=d.referencePath,u}let m=Object.entries(d.children||{}).map(r);try{return[d,...(await Promise.all(m)).flat()]}catch(u){throw s&&(u.parents||(u.parents=[])).push(s),u}},n=await r([]);for(let s of n)if(s.children)try{for(let l of Object.entries(s.children))ki(s,l[0],l[1])}catch(l){throw l.type=s.type,l.referencePath=s.referencePath,l}let o=Dr(n[0]);return Ir(o),qi(n),{definitions:n,root:o}};var $r=["module","piscine","signup","onboarding"],Ci=e=>e.type.endsWith("_audit"),ji=async e=>{let t=e==null?"content/def.json":`content/${e}/def.json`,r=JSON.parse(await Si(t,"utf8"));if(r.attrs||(r.attrs={}),r.referencePath=t,e==null&&!$r.includes(r.type))throw Error(`Root definition must be one of ${$r.join(", ")}, found: ${r.type}`);switch(r.type){case"project":case"raid":{let n=(r.attrs.validations||[]).find(Ci);if(!n)throw Error("project and raid must have an audit validation specified");if(n.form)throw Error("audit form attribute is automatically set to be ./audit/README.md, do not specify it");n.form=`content/${e}/audit/README.md`,await Mr(n.form)}case"exercise":{if(r.attrs.subject)throw Error("subject attribute is automatically set to be ./README.md, do not specify it");r.attrs.subject=`content/${e}/README.md`,await Mr(r.attrs.subject)}}return r},wt=async()=>{try{return await Rr(ji)}catch({message:e,stack:t,...r}){console.error(e),console.error(r)}};if(process.argv.includes("--watch")||process.argv.includes("-w")){await wt();for await(let e of Ai(".",{recursive:!0}))console.clear(),e.filename.endsWith("def.json")&&(console.log(e.eventType,"on",e.filename,`
3
- `),await wt())}else await wt()||process.exit(1);console.log("All checks passed, no errors");
2
+ var Tr=Object.defineProperty;var r=(e,t)=>Tr(e,"name",{value:t,configurable:!0});import{readFile as Ci,stat as $r,watch as ji}from"node:fs/promises";var be=r(e=>new Date(e).getTime(),"numTime");var Fe=r((e,t)=>be(e)+t.attrs.delay,"getQuestStartAt"),Et=r((e,t)=>{let{scopeExtraDuration:n,duration:i}=t.attrs;return e+((n||0)+(i||1))*864e5},"getQuestExtraEndAt");var qt=r((e,t)=>typeof e=="object"&&Object.values(e)[0].some(n=>n===t),"isSatteliteObj");var _e=r((e,t)=>{let{key:n,parent:i}=e,s=t||Object.values(i.children),l=i.attrs.graph?.innerCircle?.find(p=>p.type==="slice"&&p.innerArc?.contents.find(h=>qt(h,n)));if(!l)return;let c=l.innerArc.contents.find(p=>qt(p,n));return s.filter(p=>p.key===Object.keys(c)[0])},"getCoreOfSattelite"),St=r(e=>[...e.centralPoint?[e.centralPoint]:[],...(e.innerCircle||[]).flatMap(t=>t.type==="slice"?[...t.entryPoint?[t.entryPoint]:[],...(t.innerArc?.contents||[]).flatMap(n=>typeof n=="string"?n:Object.entries(n)[0].flat()),...(t.outerArcs||[]).flatMap(n=>n.contents||[])]:t.contents),...(e.middleCircle||[]).flatMap(t=>t.contents||[]),...(e.outerCircle||[]).flatMap(t=>t.contents||[])],"flatGraphContents");var _={LINE:{maxLinesCount:6,maxContentsCount:7},SLICE:{maxSlicesCount:4,innerCircle:{maxSubContentsCount:5,maxContentsCount:30},outerArc:{maxArcsCount:2,maxContentsCount:10}},MIDDLE_CIRCLE:{maxArcsCount:8,maxContentsCount:70},OUTER_CIRCLE:{maxArcsCount:9,maxContentsCount:90}};var ye=new Set(["onboarding","piscine-registration","interview","games","administration","module-registration","form-step","sign-step","upload-step","contact-validation-step","avatar-step"]),At=new Set(["module","piscine","exam","raid","quest","exercise","project","signup","campus",...ye]),Ct={campus:["signup","onboarding","piscine","module"],signup:["form-step","sign-step","upload-step","contact-validation-step","avatar-step"],onboarding:["games","administration","interview","piscine-registration","module-registration"],administration:["form-step","sign-step","upload-step","contact-validation-step","avatar-step"],piscine:["quest","exam","raid","project"],exam:["exercise"],quest:["exercise"],module:["project","piscine","exam"]};var Lr=r((e,t)=>{if(e)return t==="."?e:t===".."?e.parent:e.children[t]},"walk"),X=r((e,t,n={throwError:!0})=>{let i=t.path;if(Pr(e)){if(n.throwError)throw Error("'relativePath' must be a relative path");console.error("'relativePath' must be a relative path");return}e[e.length-1]==="/"&&(e=e.slice(0,-1));let s=e.split("/").reduce(Lr,t);if(s)return s;let l=`Incorrect relative path '${e}': no object found \u2014 current path = '${i}'`;if(n.throwError)throw Error(l);console.error(l)},"getObjectFromRelativePath"),Pr=r(e=>e.startsWith("/"),"isAbsolutePath");var Ve={memory:{maxLevel:22,minRatio:1,freeAttempts:1e3,maxAttempts:1e3,shouldFailUnderScore:30,shouldFailUnderLevel:7,shouldSucceedFromScore:60,shouldSucceedFromLevel:15},zzle:{maxLevel:18,minRatio:1,freeAttempts:1e3,maxAttempts:1e3,shouldFailUnderScore:20,shouldFailUnderLevel:3,shouldSucceedFromScore:50,shouldSucceedFromLevel:10}};for(let e of Object.values(Ve))e.levels=[...Array(e.maxLevel+50).keys()].map(t=>({maxScore:((t+1)/15+1)*5})),e.maxScore=e.levels.slice(0,e.maxLevel).reduce((t,n)=>t+n.maxScore,0);var Be={prog:{name:"Elementary programming",description:"Basics of computer programming",type:"technical",abbreviation:"prog-1"},"intermediate-prog":{name:"Intermediate programming",description:"Intermediate notions of computer programming",type:"technical",abbreviation:"prog-2"},"advanced-prog":{name:"Advanced programming",description:"Advanced notions of computer programming",type:"technical",abbreviation:"prog-3"},algo:{name:"Elementary algorithms",description:"Problem-solving, algorithm design",type:"technical"},"sys-admin":{name:"System administration",description:"System administration, dev ops",type:"technical",abbreviation:"devops"},"front-end":{name:"Front-end",description:"Front-end technologies",type:"technical",abbreviation:"front"},"back-end":{name:"Back-end",description:"Back-end technologies",type:"technical",abbreviation:"back"},stats:{name:"Statistics",description:"Data analysis, interpretation",type:"technical"},ai:{name:"AI",description:"Artificial intelligence, machine learning",type:"technical"},game:{name:"Game programming",description:"Game programming",type:"technical"},blockchain:{name:"Blockchain",description:"Blockchain",type:"technical",abbreviation:"BC"},mobile:{name:"Mobile development",description:"Mobile development",type:"technical"},tcp:{name:"TCP/IP",description:"TCP/IP",type:"technical"},cybersecurity:{name:"Cybersecurity",description:"Cybersecurity",type:"technical",abbreviation:"cyber"},ux:{name:"UX/UI",description:"User experience design, user interface design",type:"technical"},cloud:{name:"Cloud",description:"Cloud infra, deployment and scaling",type:"technical"},automation:{name:"Automation",description:"Automate tasks to reduce repetitive tasks and minimize potential errors",type:"technical",abbreviation:"autom."},ci:{name:"CI/CD",description:"Set up CI/CD pipelines to maintain a consistent software release process",type:"technical"},testing:{name:"Testing",description:"TDD and other software testing strategies",type:"technical",abbreviation:"tests"},"curriculum-objectives-completed":{name:"Curriculum objectives completed",description:"Curriculum objectives completed to unlock the specialization branches",type:"technical",abbreviation:"credits"},go:{name:"Go",type:"technology"},js:{name:"JS",type:"technology"},rust:{name:"Rust",type:"technology"},java:{name:"Java",type:"technology"},html:{name:"HTML",type:"technology"},css:{name:"CSS",type:"technology"},unix:{name:"Unix",type:"technology"},docker:{name:"Docker",type:"technology"},sql:{name:"SQL",type:"technology"},"no-sql":{name:"Non-relational Databases",type:"technology"},c:{name:"C",type:"technology"},sh:{name:"Shell",type:"technology"},php:{name:"PHP",type:"technology"},python:{name:"Python",type:"technology"},ruby:{name:"Ruby",type:"technology"},"c-sharp":{name:"C#",type:"technology",abbreviation:"C#"},"c-pp":{name:"C++",type:"technology",abbreviation:"C++"},graphql:{name:"GraphQL",type:"technology",abbreviation:"GQL"},rails:{name:"Ruby on Rails",type:"technology"},laravel:{name:"Laravel",type:"technology"},django:{name:"Django",type:"technology"},react:{name:"React",type:"technology"},dotnet:{name:".NET",type:"technology"},electron:{name:"Electron",type:"technology",abbreviation:"elect."},git:{name:"Git",type:"technology"},employability:{name:"Employability",type:"employability",abbreviation:"jobSkills"},"personal-development":{name:"Personal Development",description:"Focuses on self-awareness, self-management, communication, and core values to build a strong personal foundation for growth and autonomy.",type:"lifeskills",abbreviation:"PDev"},"relational-development":{name:"Relational Development",description:"Develops the ability to connect with others through assertiveness, empathy, and resilience, enabling healthy collaboration and conflict management.",type:"lifeskills",abbreviation:"RelDev"},"professional-development":{name:"Professional Development",description:"Strengthens strategic thinking, leadership, and professional presence to drive impact, solve complex problems, and succeed in professional environments.",type:"lifeskills",abbreviation:"ProDev"}};var jt=r((e,t)=>Object.entries(e||{}).every(([n,i])=>(t?.[n]||0)>=i),"hasRequiredSkills");var ze=1e3,Dt=60*ze,It=60*Dt,Ue=24*It,Ui=7*Ue,Nr=365*Ue,Gi=Object.entries({year:Nr,month:2628e6,day:Ue,hour:It,minute:Dt,second:ze});var Xi=new Intl.RelativeTimeFormat("en",{style:"narrow"});var Ge=r(e=>Fr(Math.round(e/ze)),"formatedMS"),We=[{label:"y",fullLabel:"year",size:31536e3},{label:"w",fullLabel:"week",size:604800},{label:"d",fullLabel:"day",size:86400},{label:"h",fullLabel:"hour",size:3600},{label:"m",fullLabel:"minute",size:60},{label:"s",fullLabel:"second",size:1}],Fr=r((e,{noSeconds:t,stopFirst:n,useFullLabel:i,stopLabel:s}={})=>{let l=[];if(s&&e<We.find(c=>c.fullLabel===s)?.size)return`less than 1${i?` ${s}`:We.find(c=>c.fullLabel===s).label}`;for(let{label:c,size:p,fullLabel:h}of We){let d=Math.floor(e/p);if(d!==0){if(l.push(`${d}${i?` ${h}`:c}${d>1&&i?"s":""}`),n)return l;e-=d*p}if(h===s)return l.join(" ")||(t?"0m":"0s")}return!t&&e!==0&&l.push(`${e}s`),l.join(" ")||(t?"0m":"0s")},"formatedDuration");var _r=r(e=>e[0].toLowerCase()+e.slice(1),"lowertalize"),Vr=r((e,t)=>t.toUpperCase(),"upperFirstMatch"),Xe=r(e=>_r(e.trim().toLowerCase().replace(/[ _-]+(.?)/g,Vr)),"toCamelCase"),Ke=r(e=>/[ _-]+(.?)/g.test(e),"isNotCamel");var Br=r((e,t,n)=>`${t} ${n}`,"spaceJoin"),He=r(e=>e.trim().replace(/(.)([A-Z])/g,Br).toLowerCase(),"breath");var q=r((e,t=0)=>[...Array(e+t).keys()].slice(t),"arrayOf");var ge=r((e,t)=>Object.fromEntries(Object.entries(e).map(t)),"mapEntries"),y=r((e,t)=>ge(e,([n,i])=>[n,t(i,n,e)]),"mapValues");var Rt=r((e,t)=>e&&Object.values(e).find(n=>n.type===t),"getChildByType");var S=128,Ie=Array(S+1),Z=-1,Mt=0,$t=0;for(;++Z<S+1;){let e=Z*.66+1,t=(Z+2)*150+50,n=Math.round(e*t);$t+=n,Mt+=e,Ie[Z]={level:Z,base:t,cumul:$t,total:n,xpIndex:Math.floor(Mt)}}var Q=r(e=>e?.children&&Object.values(e.children)||[],"_children"),ut=r((e,t,n)=>e&&(t(e)?e:ut(e[n],t,n)),"find"),zr=r((e,t)=>ut(e,t,"parent"),"findParent"),er=r((e,t)=>ut(e,t,"prev"),"findPrev"),Ur=r(({event:e})=>e,"hasEvent"),tr=r(e=>e.type==="quest","isQuest"),Me=r(e=>e.attrs.category==="required","isRequired"),rr=r(e=>typeof e=="number"&&!Number.isNaN(e)?e:1,"numOrOne"),dt=r(e=>e.attrs.difficulty*rr(e.attrs.difficultyMod),"_difficultyXpCoef"),nr=r((e,t)=>e+t,"add"),Gr=r(([e,t],[n,i])=>t.index-i.index,"byValueIdx"),Ot=r((e,t,n)=>e.attrs[`${n}-${t?.attrs?.language}`]||e.attrs[`${n}-en`]||n,"translate"),ir=r((e,t,n)=>{let{group:i}=e.attrs;return i?n.find(s=>s.attrs.group===i)===e:!0},"firstOfGroup"),ar=r(e=>{let[t]=_e(e)||[];return t?`${t.name}/${ur(e)}`:e.name},"getObjectPath"),u=r(e=>({value:Object.values(e)[0],functions:e,functionsByName:Object.fromEntries(Object.values(e).map(t=>[t.name,t]))}),"Functions"),P={functions:{translate:Ot},functionsByName:{translate:Ot}},a=r((e,t)=>({type:typeof e,value:e,...t}),"Literal"),M=r((e,...t)=>{if(e.required)return typeof e.value=="function"?e.value(...t):e.value},"getDefaultValue"),f=r(e=>({value:r((...t)=>y(e.type,n=>M(n,...t)),"value"),...e}),"TypeObject"),m={},b={},o={};m.address={"contact-validation-step":a("",{editable:!0,required:!0,label:"Phone validation URL"})};o.allowedFunctions={value:"",type:"string",editable:!0,label:"Function"};var Tt={type:[o.allowedFunctions],value:[],label:"Allowed functions",instruction:"Functions authorized to the student",editable:!0,restrictive:!0};m.allowedFunctions={exercise:Tt,raid:Tt};var Lt={type:"boolean",required:!0,private:!0,label:"Show invalid requirements"};m.showInvalidRequirements={project:Lt,piscine:Lt};var or="Automatic success",Xr=`${or} if`,Kr="Automatic reject if",sr=r(e=>({type:"string",restrictive:!0,editable:!0,label:`${e} - number of conditions to fulfil`,...u({all:r(()=>"and","all"),one:r(()=>"or","one")})}),"sharedAutoValidationOperator");m.autoRejectOperator={games:sr("Reject")};var Hr=Object.entries(Ve),Yr=Hr.flatMap(([e,t])=>[[`${e}Score`,{shouldFailUnder:t.shouldFailUnderScore,shouldSucceedFrom:t.shouldSucceedFromScore}],[`${e}Level`,{shouldFailUnder:t.shouldFailUnderLevel,shouldSucceedFrom:t.shouldSucceedFromLevel}]]),lr=[["score",{shouldFailUnder:25,shouldSucceedFrom:50}],["level",{shouldFailUnder:10,shouldSucceedFrom:25}],...Yr],pt=r(e=>Array.isArray(e)||typeof e!="object"||!Object.keys(e).length,"isntObjectOrIsEmpty"),v=r((e,t,n)=>{if(!e.length){let i=Error("Must be a non empty value");throw i.label=n,i}},"checkNotEmpty"),$e=r((e,t,n)=>{if(e<t||e>n)throw Error(`Expected to be a number range ${t} to ${n}`)},"checkNumberInBetween"),w=r((e,t,n)=>{if(e<t||e>n||!Number.isInteger(e))throw Error(`Expected to be an integer range ${t} to ${n}`)},"checkIntegerInBetween"),Oe=r((e,t,n)=>{if(e<t||e>n)throw Error(`Expected to be a duration between ${Ge(t)} and ${Ge(n)}`)},"checkDurationInBetween"),pe=r((e,t)=>{if(e.length>t)throw Error(`Max ${t} characters (spaces included).`)},"checkTextLength"),cr=r(e=>{try{return!!new URL(e)}catch{throw Error("Invalid URL.")}},"checkValidURL"),Re={editable:!0,options:q(100,1),check:r(e=>w(e,1,100),"check")};o.autoRejectWhereConditions=Object.fromEntries(lr.map(([e,{shouldFailUnder:t}])=>[e,{value:{},editable:!0,description:`Condition relative to ${He(e)} of the candidate.`,type:{"<":a(t,{label:"is lower than",description:"Under this number, condition is fulfilled.",...Re}),"<=":a(t,{label:"is lower than or equal",description:"Until this number, condition is fulfilled.",...Re})}}]));m.autoRejectWhere={games:{value:{},editable:!0,restrictive:!0,label:Kr,instruction:"List of conditions to automatically reject an application",type:o.autoRejectWhereConditions}};m.autoValidate={administration:a(!1,{label:or,instruction:"Validate all applications when they are submitted",restrictive:!0,editable:!0})};m.autoValidateOperator={games:sr("Success")};o.autoValidateWhereConditions=Object.fromEntries(lr.map(([e,{shouldSucceedFrom:t}])=>[e,{value:{},editable:!0,description:`Condition relative to ${He(e)} of the candidate.`,type:{">":a(t,{label:"is bigger than",description:"Above this number, condition is fulfilled.",...Re}),">=":a(t,{label:"is bigger than or equal",description:"From this number, condition is fulfilled.",...Re})}}]));m.autoValidateWhere={games:{value:{},editable:!0,restrictive:!0,label:Xr,instruction:"List of conditions to automatically accept an application",type:o.autoValidateWhereConditions}};var mt={value:{},editable:!0,label:"Skills rewarded",type:y(Be,({name:e,type:t,description:n})=>({label:e,instruction:t,description:n,editable:!0,type:"number",value:1,options:q(100,1),check:r(i=>w(i,1,100),"check")}))},V={...mt,instruction:"Skills rewarded to users when they succeed in the current content"};b.baseSkills={exam:{exercise:V},quest:{exercise:V},module:{piscine:V,project:V},campus:{piscine:V},piscine:{raid:V,project:V}};var Qr=r(e=>{if(Object.keys(e.children||{}).length&&e.type!=="raid")return 0;let t=Ie[e.attrs.level]||Ie[0];return Math.round(t.base*rr(dt(e)))},"getBaseXpByLevelAndDifficulty"),B={type:"number",required:!0,editable:!0,label:"XP rewards",instruction:"How much experience points the user gets by succeeding on this content",...u({"by level and difficulty":Qr}),check:r(e=>{if(!Number.isInteger(e))throw Error("Must be a whole number");if(e<0)throw Error("Must not be negative")},"check")};b.baseXp={exam:{exercise:B},quest:{exercise:B},module:{piscine:B,project:B},piscine:{raid:B,project:B},campus:{piscine:B}};m.blockStartDelay={exam:a(15*6e4,{label:"Time to join the exam",editable:!0})};var Pt=a("Save",{label:"Submit button text",editable:!0,...P});m.buttonText={"sign-step":Pt,"form-step":Pt};m.campaignId={games:a("",{label:"Games campaign related",instruction:"Id required",required:!0,editable:!0,restrictive:!0})};var Jr=r(e=>e.path.split("/")[1],"getCampus"),T={label:"Campus",type:"string",required:!0,private:!0,...u({"from campus name":Jr})};m.campus={exercise:T,module:T,piscine:T,project:T,raid:T,exam:T,quest:T,...Object.fromEntries([...ye].map(e=>[e,T]))};var ee=a(400,{label:"Event capacity",instruction:"From 1 to 1000.",editable:!0,required:!0,check:r(e=>{if(!Number.isInteger(e))throw Error("Must be a whole number");if(e>1e3)throw Error("Cannot be more than 1000.");if(e<1)throw Error("Must be one or more")},"check")});m.capacity={exam:ee,module:ee,piscine:ee,raid:ee,interview:ee};var Zr=new Set(["required","optional","bonus"]);b.category={exam:{exercise:a("required",{label:"Category of the exercise",required:!0,private:!0,check:r(e=>{if(!new Set(["required","optional"]).has(e))throw Error('Must be "required" or "optional"')},"check")})},quest:{exercise:a("required",{label:"Category of the exercise",required:!0,editable:!0,options:["required","optional","bonus"],check:r(e=>{if(!Zr.has(e))throw Error('Must be "required", "optional" or "bonus"')},"check")})},piscine:{raid:a("required",{required:!0,private:!0})}};m.checkbox={"sign-step":{label:"Display a checkbox",instruction:'Minimum options: "label" and "required"',value:{},editable:!0,type:"object",check:r(e=>{if(!e.label||typeof e.label!="string")throw Error('"label" must be defined as a text to be displayed on the right of the checkbox.');if(typeof e.required!="boolean")throw Error('"required" must be defined as true or false (if the checkbox is mandatory or not).')},"check"),...P}};o.codeEditorFile=f({label:"File",editable:!0,type:{giteaPath:a("root/public/README.md",{label:"Gitea file path",instruction:'Example: "{user}/{repo}/{path-to-file}"',editable:!0,check:r(e=>{pe(e,200),v(e)},"check")}),editorPath:a("provided/README.md",{label:"Path in Code editor",required:!0,editable:!0,check:r(e=>{pe(e,200),v(e)},"check")})}});o.providedFiles={editable:!0,label:"Provided files",type:[o.codeEditorFile]};o.enableCodeEditor=(e,t)=>a(e,{editable:!0,required:!0,label:"Enable",...t});var Nt={label:"Code editor settings",editable:!0,check:r((e,{attrs:t})=>{if(t.language==="sh")throw Error("The code editor does not support shell exercises")},"check"),type:{enabled:o.enableCodeEditor(!1),providedFiles:o.providedFiles}};b.codeEditor={quest:{exercise:f({...Nt})},exam:{exercise:f({...Nt,required:!0,type:{enabled:o.enableCodeEditor(!0,{editable:!1}),providedFiles:o.providedFiles}})}};var Te=r(e=>{let t=/^[^a-z](\d+)|[^a-z0-9_]/g,n=e.search(t);if(n!==-1){let i=e[n],s=e.normalize("NFD").toLowerCase().replace(t,""),l=s?`Did you mean ${s}?`:"";throw Error(`Property names should start with a letter, only contain lowercase letters, numbers, and underscores (${n}:"${i}"). ${l}`)}},"checkCRMvalues"),Ft=process.env.ENABLE_CRM,en=process.env.CRM_NAME,tn=process.env.CRM_ENDPOINT,rn=process.env.CRM_PRIVATE_KEY;o.crmOnValidation=a("event_status",{editable:!0,label:"Validation status",check:r(e=>{v(e),Te(e)},"check")});var L=f({label:"Customer Relationship Management (CRM)",editable:!0,restrictive:!0,private:!(Ft&&JSON.parse(Ft)&&en&&tn&&rn),type:{onValidation:o.crmOnValidation}});o.crmGamesOnAttempts=a("number_of_attempts_remaining",{label:"Remaining attempts",editable:!0,check:r(e=>{v(e),Te(e)},"check")});o.crmOnProgress=a("last_progress",{label:"Currently in progress",editable:!0,check:r(e=>{v(e),Te(e)},"check")});o.gamesCRM={onAttempts:o.crmGamesOnAttempts};o.crmDueDate=a("audit_due_date",{label:"Due date",editable:!0,check:r(e=>{v(e),Te(e)},"check")});var _t={...L,type:{...L.type,onProgress:o.crmOnProgress}};m.crm={games:{...L,type:{...o.gamesCRM,onValidation:L.type.onValidation}},interview:L,piscine:_t,module:_t,exam:L,raid:L,project:{...L,type:{dueDate:o.crmDueDate}}};var xe=r(({type:e,parent:t,index:n,attrs:i})=>t&&e==="exercise"&&i.special?Object.values(t.children).filter(l=>l.index<n).map(({attrs:l})=>l.duration).reduce(nr,0)*864e5:i.startDay?(i.startDay-1)*864e5:0,"getDelay"),te={type:"number",required:!0,private:!0};b.delay={piscine:{quest:{...te,label:"Time before the quest starts",...u({"based on previous content temporal-windows":xe})},project:{...te,label:"Time before the project starts",...u({"based on previous content temporal-windows":xe})}},quest:{exercise:{...te,label:"Time before the exercise starts",...u({"based on previous exercises temporal-windows":xe})}},exam:{exercise:{...te,label:"Time before the exercise starts",...u({"based on previous exercises temporal-windows":xe})}},module:{project:a(0,te)}};var nn=r(({attrs:e,prev:t})=>e.parentType!=="exam"?1:e.group?Math.round(e.group*2):Math.round(((t?.attrs.group||0)+1)*2),"exerciseDifficulty"),an=r(e=>Q(e).filter(ir).filter(Me).map(dt).reduce(nr,0),"sumOfChildrenDifficulty"),H=a(1,{required:!0,label:"Difficulty",instruction:"From 0.75 to 2 (in increments of 0.25)"}),Ye={...H,private:!0,...u({"Sum of required children exercises difficulties":an})};b.difficulty={module:{project:{...H,editable:!0},exam:Ye},piscine:{project:{...H,editable:!0},raid:{...H,editable:!0},exam:Ye,quest:Ye},quest:{exercise:a(1,{...H,editable:!0})},exam:{exercise:{...H,editable:!0,editableDefaultValue:1,...u({"Based on exercise group or 1":nn})}}};var on=r(({parent:e})=>e?.attrs.difficultyMod,"getDifficultyMod"),j=a(1,{label:"XP Coefficient",required:!0,editable:!0,editableDefaultValue:1,...u({"from parent":on}),check:r(e=>$e(e,0,64),"check")});b.difficultyMod={campus:{piscine:j},module:{project:j,piscine:j,exam:j},piscine:{raid:j,exam:j,quest:j,project:j},quest:{exercise:j},exam:{exercise:j}};var sn=r(({name:e})=>e,"getName"),ur=r(e=>{let[t]=_e(e)||[];return t&&t.name&&e.name.startsWith(t.name)?e.name.slice(t.name.length+1):e.name},"getProjectName"),re=a("",{editable:!0,label:"Displayed name",check:r(e=>pe(e,60),"check")});m.displayedName={raid:{...re,...u({"from name":sn})},project:{...re,...u({"from name (or light version)":ur}),required:!0},piscine:re,exercise:re,quest:re};var dr=r(e=>e.attrs.special,"isHackathon"),Vt=r(({parent:e})=>dr(e)?e.attrs.duration/Object.keys(e.children).length:0,"getExerciseDuration"),ln=r(()=>1,"oneDayDuration"),cn=r(()=>2,"twoDaysDuration"),W=a(1,{label:"Temporal-window duration in the event",required:!0,editable:!0,check:r(e=>Oe(e*864e5,0,50*864e5),"check"),editableDefaultValue:1,...u({"one day":ln})});b.duration={module:{exam:{...W,hidden:!0}},piscine:{quest:W,exam:W,raid:{...W,...u({"two days":cn})},project:W},quest:{exercise:{...W,...u({"proportional to the others (in hackathon mode)":Vt})}},exam:{exercise:{...W,...u({"proportional to the others (in hackathon mode)":Vt})}}};var ne={label:"Event duration",required:!0,editable:!0,check:r(e=>Oe(e*6e4,1*6e4,365*864e5*3),"check")};m.eventDuration={exam:a(4*36e5/6e4,ne),module:a(365*864e5*2/6e4,ne),interview:a(864e5*1/6e4,ne),piscine:a(4*6048e5/6e4,ne),raid:a(864e5*2/6e4,ne)};var un=r(({parent:e})=>e?.attrs.eventId,"getParentEventId"),dn=r(({event:e})=>e?.id,"getEventId"),U={type:"number",label:"Event id",required:!0,private:!0,...u({"own event":dn})},ie={...U,...u({"parent event":un})};b.eventId={campus:{module:U,piscine:U},piscine:{quest:ie,project:ie,exam:U,raid:U},quest:{exercise:ie},exam:{exercise:ie},module:{piscine:U,project:ie,exam:U}};var ae=a(0,{label:"Time between registration and event",editable:!0});m.eventStartDelay={exam:ae,module:ae,interview:ae,piscine:ae,raid:ae};o.filesName=a("",{label:"Expected file name",instruction:'Examples: "main.go", or "exerciseName/main.go"',editable:!0,check:r(e=>{pe(e,65)},"check")});var Bt={type:[o.filesName],value:[],editable:!0,restrictive:!0,label:"Expected files",check:v};m.expectedFiles={exercise:Bt,raid:Bt};var pn=r((e,t)=>e+(Me(t)?t.attrs.baseXp:0),"totalRequiredXp"),Wt=r(e=>Q(e).filter(ir).reduce(pn,0),"getRequiredExpectedXp"),mn=r((e,t)=>e+(t.attrs.expectedXp||0),"totalExpectedXp"),zt=r(e=>Q(e).reduce(mn,0),"getTotalExpectedXp"),ve={type:"number",label:"XP",instruction:"Expertise(s) that this content is worth.",required:!0,check:r(e=>{if(!Number.isInteger(e))throw Error("Must be a whole number");if(e<0)throw Error("Must not be negative")},"check")};m.expectedXp={piscine:{...ve,private:!0,label:"XP (for stats)",...u({"Sum of children expected XP":zt})},module:{...ve,...u({"Sum of children expected XP":zt})},quest:{...ve,...u({"Sum of required children XP":Wt})},exam:{...ve,...u({"Sum of required children XP":Wt})}};var pr=a("",{primary:!0,editable:!0,required:!0}),J={key:{...pr,label:"Key (must be unique)",instruction:"Associated keyword in the database and data exports",check:r((e,t)=>{if(v(e.trim()),Ke(e)){let s=Xe(e);throw Error(`Must be written in camelCase. Suggestion: "${s}"`)}if((t.attrs["form-en"]||t.attrs.form||[]).flatMap(s=>s.inputs.map(l=>l.key)).filter(s=>s===e)?.length>1)throw Error(`${e} is already used for another input. Please choose a unique key.`)},"check")},required:a(!0,{label:"Must be fulfilled",editable:!0})},hn=new Set(["w100p","w18p"]),G={...J,styleProps:f({label:"Input style",type:{w100p:a(!1,{label:"Large input style",editable:!0}),w18p:a(!1,{label:"Small input style",editable:!0})},editable:!0,check:r(e=>{let t=Object.keys(e).find(n=>!hn.has(n));if(t)throw Error(`${t} is not a valid css property`)},"check")})},A={name:a("",{label:"Input HTML name",editable:!0,check:v}),id:a("",{label:"Input HTML id",editable:!0,check:v})},me=r((e,t)=>({placeholder:a(t||"Your answer...",{label:"Placeholder",editable:!0}),label:a(e||"",{label:"Label / title",instruction:"Displayed on top of the input",editable:!0})}),"labelAndPLaceholder"),mr={...me(),...A,minLength:a(1,{label:"Minimum length",editable:!0}),maxLength:a(60,{label:"Maximum length",editable:!0})};o.textInput=f({label:"Text input",type:{type:a("text",{label:"Input type",required:!0}),...G,...mr,size:a(20,{label:"Size",editable:!0})}});o.textareaInput=f({label:"Textarea input",type:{type:a("textarea",{label:"Input type",required:!0}),...G,...mr,rows:a(5,{label:"Rows",editable:!0}),cols:a(20,{label:"Columns",editable:!0})}});o.telInputPattern=a("/^\\s?\\+?[0-9 ()_-]+$/",{label:"Pattern to match",instruction:"Regular expression (in javascript) that the input's value must match.",editable:!0});o.telInput=f({label:"Tel input",type:{type:a("tel",{label:"Input type",required:!0}),...G,...A,...me("Telephone number","+333 33 33 33 33"),pattern:o.telInputPattern,format:a("Format: +7 777 123 00 00",{label:"Format to respect",editable:!0})}});o.checkboxInput=f({label:"Checkbox input",type:{type:a("checkbox",{label:"Input type",required:!0}),...J,...A,label:a("I agree",{label:"Text associated to the checkbox",instruction:"Displayed on the right of the checkbox",editable:!0,required:!0,check:v}),value:a(!1,{label:"Is initially checked",editable:!0,required:!0})}});o.switchInput=f({label:"Switch input",type:{type:a("switch",{label:"Input type",required:!0}),...J,...A,label:a("I choose...",{label:"Text associated to the switch input",instruction:"Displayed on the left of the checkbox",editable:!0,required:!0,check:v}),value:a(!1,{label:"Is initially set to true",editable:!0,required:!0})}});o.numberInputsSteps=a(10,{label:"Step value up and down by",editable:!0});o.numberInput=f({label:"Number input",type:{type:a("number",{label:"Input type",required:!0}),...G,...A,...me("How many/much...","Multiple of..."),min:a(1,{label:"Minimum",editable:!0}),max:a(100,{label:"Maximum",editable:!0}),step:o.numberInputsSteps}});o.dateInput=f({label:"Date input",type:{type:a("date",{label:"Input type",required:!0}),...G,...A,...me("Date","2000-01-01"),value:a("2000-01-01",{label:"Default date value",editable:!0}),min:a("2000-01-01",{label:"Lowest date allowed",editable:!0}),max:a("2000-01-01",{label:"Highest date allowed",editable:!0})}});o.datetimeLocalInput=f({label:"Date with time input",type:{type:a("datetime-local",{label:"Input type",required:!0}),...G,...A,...me("Date and time","2000-01-01T00:00"),value:a("2000-01-01T00:00",{label:"Default date and time value",editable:!0}),min:a("2000-01-01T00:00",{label:"Lowest date and time allowed",editable:!0}),max:a("2000-01-01T00:00",{label:"Highest date and time allowed",editable:!0})}});o.countriesInput=f({label:"Countries input",type:{type:a("countries",{label:"Input type",required:!0}),...J,...A,label:a("Country",{label:"Label / title",instruction:"Displayed on top of the input",editable:!0}),emptyItem:f({label:"Empty selection text",editable:!0,instruction:"Displayed as a placeholder before selection",type:{label:a("Choose your country...",{label:"Label",editable:!0})}})}});o.languagesInput=f({label:"Languages input",type:{type:a("languages",{label:"Input type",required:!0}),...J,...A,label:a("Language",{label:"Label / title",instruction:"Displayed on top of the input",editable:!0}),emptyItem:f({label:"Empty selection text",editable:!0,instruction:"Displayed as a placeholder before selection",type:{label:a("Choose your language...",{label:"Label",editable:!0})}})}});o.radioItems=f({label:"Radio item",type:{label:a("",{label:"Label (text displayed)",editable:!0}),data:a("",{label:"Data (value saved in database)",editable:!0,required:!0,primary:!0,check:v})}});o.radioInput=f({label:"Radio input",type:{type:a("radio",{label:"Input type",required:!0}),...J,...A,label:a("Select one...",{label:"Label / title",instruction:"Displayed on top of the input",editable:!0,required:!0}),inlineBlock:a(!0,{label:"Displays options under the label",instruction:"If set to false, options are right to the label",editable:!0}),items:{value:[],type:[o.radioItems],label:"Items",required:!0,editable:!0}}});o.selectItems=f({label:"Select item",type:{label:a("",{label:"Label",instruction:"Text displayed and saved in database",editable:!0,required:!0,primary:!0,check:v}),data:a("",{label:"Data",editable:!0})}});o.selectInput=f({label:"Select input",type:{type:a("select",{label:"Input type",required:!0}),...G,...A,label:a("Select one...",{label:"Label / title",instruction:"Displayed on top of the input",editable:!0}),searchable:a(!0,{label:"Searchable",instruction:"Allow search, and sort the input options",editable:!0}),emptyItem:f({label:"Empty selection text",editable:!0,instruction:"Displayed as a placeholder before selection",type:{label:a("Choose...",{label:"Label",editable:!0})}}),items:{type:[o.selectItems],value:[],label:"Items",required:!0,editable:!0}}});o.formSectionResume=a("",{label:"Resume",editable:!0});o.formSection=f({type:{key:{...pr,label:"Section id",instruction:"Private info (for admins)",check:r((e,t)=>{if(v(e.trim()),Ke(e)){let s=Xe(e);throw Error(`Must be written in camelCase. Suggestion: "${s}"`)}if((t.attrs["form-en"]||t.attrs.form||[]).map(s=>s.key).filter(s=>s===e)?.length>1)throw Error(`${e} is already used for another section. Please choose a unique key.`)},"check")},title:a("",{label:"Section title",editable:!0}),resume:o.formSectionResume,inputs:{label:"Inputs",instruction:"Questions or instruction to answer to",required:!0,editable:!0,value:[],type:[o.textInput,o.textareaInput,o.telInput,o.checkboxInput,o.switchInput,o.dateInput,o.datetimeLocalInput,o.numberInput,o.countriesInput,o.languagesInput,o.radioInput,o.selectInput]}}});m.form={"form-step":{label:"Form to fill",required:!0,editable:!0,value:[{key:"firstSection",inputs:[]}],type:[o.formSection],...P}};var fn=r(e=>{if(!e.children)return;let t=Q(e),n=t.filter(Me).length,i=t.filter(s=>s.attrs.status==="succeeded").length;return i&&i/n},"questGrade");m.grade={quest:a(0,{required:!0,private:!0,label:"Quest grade",...u({"succeeded exercises / required":fn})})};o.graphArcName=f({label:"Name of the arc",type:{text:a("",{label:"The text name of the arc",type:"string"}),hidden:a(!0,{label:"Display the text name on the graph"})}});var lt=r((e,t)=>{if(!t.children[e])throw Error(`Invalid object - no object found in the module for the following key name: ${e}`)},"checkGraphArcContentIsValid");o.graphArcContentName=a("",{label:"The text name of a content placed on an arc",check:r((e,t)=>lt(e,t),"check")});o.graphArcContentWithSubContents={value:{},label:"Content with sub-contents placed on an arc",type:"object",check:r((e,t)=>{if(pt(e))throw Error("Should be a non empty object.");let n=Object.entries(e);if(n.length>1)throw Error("Should be an object with a single key-value pair; the key being the content's name, and the value being an array of sub-contents's names.");let[i,s]=n[0];if(lt(i,t),!Array.isArray(s)||!s.length)throw Error("Must be a non empty array");let l=new Set(s);if(s.length!==l.size)throw Error("Duplicates are not allowed.");let c=_.SLICE.innerCircle.maxSubContentsCount;if(s.length>c)throw Error("Max sattelites reached");for(let p of s)lt(p,t)},"check")};var hr=r(e=>{let{name:t,contents:n,type:i,id:s,...l}=e;if(Object.keys(l).length)throw Error(`Unsupported attribute "${Object.keys(l)[0]}"`);if(!Array.isArray(n)||!n?.length)throw Error("Must be a non empty array")},"graphArcBasicChecks");o.graphArc=f({label:"Name & contents of an arc",type:{id:a("",{label:"A randomly-generated id to identify the arc"}),name:o.graphArcName,contents:{label:"The list of contents to be placed on an arc",type:[o.graphArcContentName]}},check:hr});o.innerCircleSlice=f({label:"Slice on the inner circle",type:{id:a("",{label:"A randomly-generated id to identify the slice"}),name:o.graphArcName,type:a("slice",{label:"The slice type"}),entryPoint:o.graphArcContentName,innerArc:f({label:"Inner arc of an inner circle slice",type:{...o.graphArc.type,contents:{label:"The list of contents to be placed on an inner arc of an inner circle slice",type:[o.graphArcContentName,o.graphArcContentWithSubContents]}},check:hr}),outerArcs:{label:"Outer arcs of an inner circle slice",type:[o.graphArc],check:r(e=>{let{maxArcsCount:t,maxContentsCount:n}=_.SLICE.outerArc;if(e.length>t)throw Error("Max outerArcs reached");if(e.reduce((i,s)=>i+(s.contents?.length||0),0)>n)throw Error("Max contents spread over outerArcs of slice reached")},"check")}},check:r(e=>{let{name:t,entryPoint:n,type:i,innerArc:s,outerArcs:l,id:c,...p}=e;if(Object.keys(p).length)throw Error(`Unsupported attribute "${Object.keys(p)[0]}"`);if(!t&&!n&&!i&&!s&&!l&&!c)throw Error("Empty inner circle, should be removed")},"check")});o.innerCircleLine={...o.graphArc,label:"Line on the inner circle",type:{...o.graphArc.type,type:a("line",{label:"The line type"})},check:r(e=>{if(e.contents.length>_.LINE.maxContentsCount)throw Error("Max contents reached for a line")},"check")};var bn=f({private:!0,required:!0,editable:!0,value:{innerCircle:[],middleCircle:[],outerCircle:[]},label:"Graph structure",instruction:"Structure of the visual graph",description:"Sets the visual structure & hierarchy of the graph of a module.",type:{centralPoint:o.graphArcContentName,innerCircle:{value:[],required:!0,editable:!0,label:"List of slices and/or lines spread on the inner circle",type:[o.innerCircleSlice,o.innerCircleLine],check:r(e=>{let t=e.filter(l=>l.type==="slice"),n=e.filter(l=>l.type==="line"),{SLICE:i,LINE:s}=_;if(t.length>i.maxSlicesCount)throw Error("Max slices sections reached");if(n.length>s.maxLinesCount)throw Error("Max lines sections reached");if(t.flatMap(({innerArc:l})=>l.contents.flatMap(c=>typeof c=="string"?c:Object.keys(c)[0])).length>i.innerCircle.maxContentsCount)throw Error("Max contents spread over innerArcs of slices reached")},"check")},middleCircle:{value:[],required:!0,editable:!0,label:"List of arcs spread on the middle circle",type:[o.graphArc],check:r(e=>{let{maxArcsCount:t,maxContentsCount:n}=_.MIDDLE_CIRCLE;if(e.length>t)throw Error("Max arches reach on middleCircle");if(e.reduce((i,s)=>i+(s.contents?.length||0),0)>n)throw Error("Max contents reach on middleCircle")},"check")},outerCircle:{value:[],required:!0,editable:!0,label:"List of arcs spread on the outer circle",type:[o.graphArc],check:r(e=>{let{maxArcsCount:t,maxContentsCount:n}=_.OUTER_CIRCLE;if(e.length>t)throw Error("Max arches reach on outerCircle");if(e.reduce((i,s)=>i+(s.contents?.length||0),0)>n)throw Error("Max contents reach on outerCircle")},"check")}},check:r((e,t)=>{let{centralPoint:n,innerCircle:i,middleCircle:s,outerCircle:l,...c}=e;if(Object.keys(c).length)throw Error(`Unsupported attribute "${Object.keys(c)[0]}"`);if(!n&&!i?.length&&!s?.length&&!l?.length)throw Error("Empty graph, should be removed");let p=St(e),h=new Set(p);if(p.length!==h.size)throw Error("Graph should not contain duplicate contents keys");let d=Object.keys(t.children);h.size!==d.length&&console.error(`Inconsistancy in between graph and children: different size (${h.size} vs ${d.length})`)},"check")});m.graph={module:bn};b.group={exam:{exercise:a(1,{label:"Exercise group",editable:!0,required:!0,hidden:!0,options:q(100,1),check:r(e=>w(e,1,100),"check")})}};var yn=r(({group:e})=>e?.id,"getGroupId"),Ut={label:"Group id of the user",type:"number",required:!0,private:!0,...u({"last confirmed group for this project":yn})};m.groupId={project:Ut,raid:Ut};m.groupMax={project:a(1,{label:"Max. group number",required:!0,editable:!0,options:q(20,1),check:r((e,t)=>{if(w(e,1,20),t.attrs.groupMin>e)throw Error('Must be bigger or equal to "Min. group number"')},"check")})};m.groupMin={project:a(1,{label:"Min. group number",required:!0,editable:!0,options:q(20,1),check:r((e,t)=>{if(w(e,1,20),t.attrs.groupMax<e)throw Error('Must be smaller or equal to "Max. group number"')},"check")})};m.groupSize={raid:a(3,{label:"Average group size",required:!0,editable:!0,options:[3,1,2,...q(17,4)],check:r(e=>w(e,1,20),"check")})};var fr=r(({attrs:e})=>Date.now()>e.start,"getHasStarted"),gn=r(()=>!0,"always"),xn=r(()=>!1,"never"),K={type:"boolean",required:!0,private:!0,...u({"from beginning of event":fr})},oe={label:"Starts when",type:"boolean",hidden:!0,required:!0,...u({"temporal-window has started (in hackathon mode)":fr,"always started":gn,"never starts":xn})};b.hasStarted={campus:{module:K,piscine:K},module:{piscine:K,exam:K,project:oe},piscine:{exam:K,raid:K,quest:oe,project:oe},quest:{exercise:oe},exam:{exercise:oe}};m.info={raid:a("Group 1",{editable:!0,label:"Calendar information tag",check:r(e=>pe(e,50),"check")})};var br={label:"Upload input",required:!0,editable:!0,type:"object",value:{},...P,instruction:'Required option: "type"'},vn={...br,editable:!1,check:r(e=>{let[t]=Object.values(e);if(pt(t),!t.type||t.type!=="file")throw Error('"type":"file" property must be defined in the upload input.');if(t.accept!==void 0&&typeof t.accept!="string")throw Error('"accept" property (if added) must be a text. Example: "image/png, image/jpeg"');if(t.required!==void 0&&typeof t.required!="boolean")throw Error('"required" property (if added) must be a true or false.')},"check")},wn=f({label:"Avatar input",required:!0,editable:!1,value:{type:"file",accept:"image/png, image/jpeg",required:!0},type:{type:a("file",{label:"Input type",required:!0,editable:!1}),accept:a("image/png, image/jpeg",{label:"Accepted file types",editable:!1,required:!0}),required:a(!0,{label:"Required",editable:!1,required:!0})}});m.input={"upload-step":vn,"avatar-step":wn,"contact-validation-step":{...br,check:r(e=>{let[t]=Object.values(e);if(pt(t),!t.type||t.type!=="tel")throw Error('"type":"tel" property must be defined in the contact validation input.');if(t.required!==void 0&&typeof t.required!="boolean")throw Error('"required" property (if added) must be a true or false.');if(t.label!==void 0&&typeof t.label!="string")throw Error('"label" property (if added) must be a text. Example: "Phone contact"');if(t.placeholder!==void 0&&typeof t.placeholder!="string")throw Error('"placeholder" property (if added) must be a text. Example: "+333 33 33 33 33"');if(t.format!==void 0&&typeof t.format!="string")throw Error('"format" property (if added) must be a text. Example: "Required format: +33 7 17 17 17 17"');if(t.pattern!==void 0){if(typeof t.pattern!="string")throw Error('"pattern" property (if added) must be a text and a valid regex. Example: "[+][0-9]{3}[0-9]{2}[0-9]{2}[0-9]{2}[0-9]{2}"');try{return new RegExp(e)}catch{throw Error("Invalid Regular expression.")}}},"check")}};var yr=r(({attrs:e})=>{let t=Date.now();return t>e.scopeStart&&t<e.scopeEnd},"getInScope"),Gt=r(({attrs:e})=>e.hasStarted,"getProjectInScope"),kn=r(({parent:e})=>e.attrs.inScope,"getExamExerciseInScope"),En=r(({parent:e,attrs:t})=>{if(e.attrs.inScope){if(dr(e)){let n=Date.now();return n>t.start&&n<t.duration*864e5+t.start}return!0}return e.attrs.hasStarted&&t.category==="bonus"},"getExerciseInScope"),Y={label:"Reward scope",required:!0,type:"boolean"},Qe={...Y,private:!0,label:"Active scope (distinct from temporal-window)",...u({"from start date to end date":yr})};b.inScope={piscine:{quest:{...Y,label:"Reward scope (temporal-window with extra duration)",instruction:"Defines whether the content keeps giving the rewards or not.",...u({"from start day to end of extra duration":yr})},raid:Qe,exam:Qe,project:{...Y,...u({"parent temporal-window":Gt})}},quest:{exercise:{...Y,...u({"parent temporal-window (or one by one in hackathon)":En}),instruction:"Defines whether the content keeps giving the rewards or not."}},exam:{exercise:{...Y,private:!0,...u({"parent scope":kn})}},module:{project:{...Y,...u({"parent scope":Gt})},exam:Qe}};var we=a("",{label:"Programming language",instruction:'Example: "js", "go", "rust"',editable:!0,restrictive:!0});m.language={exam:we,exercise:we,raid:we,project:we};var qn=r(({parent:e,attrs:t})=>{if(e&&e.type==="exam")return e.attrs.level;let n=t.difficulty+t.xpIndex,i=Ie.find(s=>s.xpIndex>n);return i?i.level:0},"getLevel"),D=a(1,{label:"Level",required:!0,editable:!0,editableDefaultValue:1,...u({"minimum required":qn}),options:q(S,1),check:r(e=>w(e,1,S),"check")});b.level={module:{piscine:D,exam:D,project:D},piscine:{quest:D,raid:D,exam:D,project:D},quest:{exercise:D},exam:{exercise:D},campus:{piscine:D}};o.objectChildRelativePath=a("./",{label:"Content relative path",instruction:"As a child of this content",editable:!0,check:X,options:r(e=>Object.entries(e.children||{}).sort(Gr).map(([t,n])=>`./${t}`),"options")});var gr=r((e,t)=>{if(!Array.isArray(e)||!e.length){let s=new Error("Must be a non empty array");throw s.userFeedback="This list cannot be empty! Please add an item or remove the setting.",s}let n=[...new Set(e)];if(e.length!==n.length)throw Error("Duplicates are not allowed.");let i=e.filter(s=>!X(s,t,{throwError:!1}));if(i.length){let s=i.map(c=>`'${c}'`).join(", "),l=new Error(`Invalid objects requirements - no object found for the following relative paths: ${s}`);throw l.userFeedback="Some Contents are misconfigured, please update them!",console.error(l.message),l}},"checkRelativePaths");o.objectRootRelativePath=a("../",{label:"Content relative path (Mandatory)",instruction:"In same parent",editable:!0,check:r((e,t)=>{try{X(e,t)}catch(n){throw n.userFeedback=`This content relative path (${e}) is invalid, please select a valid content in the list below or remove it.`,n}},"check"),options:r(e=>e?.parent?.children?Object.entries(e.parent.children).filter(([i])=>i!==e.key).map(([i])=>`../${i}`):[],"options")});o.sharedObjectList={label:"Contents required",editable:!0,check:r((e,t)=>{gr(e.flat(),t)},"check")};var xr={editable:!0,label:"Access conditions"},Sn={...xr,instruction:"Conditions to access this content",description:"Sets the requirements that have to be met for a content to be accessible to a student.",check:r((e,t)=>{let{skills:n,objects:i,...s}=e;if(Object.keys(s).length)throw Error(`Unsupported attribute "${Object.keys(s)[0]}"`);if(!n&&!i)throw Error("Empty requirements, should be removed");let l=(i||[]).flat().filter(c=>!X(c,t,{throwError:!1}));if(l.length){let c=l.map(h=>`'${h}'`).join(", "),p=new Error(`Invalid objects requirements - no object found for the following relative paths: ${c}`);throw p.userFeedback="You have some misconfigured Contents required, please update them!",console.error(p.message),p}},"check")},An={...xr,instruction:"Conditions to unlock and earn this level",description:"Sets the requirements that have to be met for a level to be unlocked and earned by a student.",check:r(e=>{let{skills:t,objects:n,...i}=e;if(Object.keys(i).length)throw Error(`Unsupported attribute "${Object.keys(i)[0]}"`);if(!t&&!n)throw Error("Empty requirements, should be removed")},"check")};o.levelDefinition=f({label:"Level definition",type:{level:a(S,{label:"Level",editable:!0,required:!0,primary:!0,options:q(S,1).reverse(),check:r((e,t)=>{if(w(e,1,S),t.attrs.levelsDefinitions?.filter(i=>i.level===e)?.length>1)throw Error(`Level ${e} is set for different levels definitions! A given level can only be defined once.`)},"check")}),requirements:f({...An,type:{skills:{...mt,label:"Skills required",instruction:"Expertises required"},objects:{...o.sharedObjectList,value:r((...e)=>{let t=o.objectChildRelativePath.options(...e)?.[0];return t?[t]:[]},"value"),type:[o.objectChildRelativePath],instruction:"Items to be succeeded"}},instruction:"Conditions to access this level"})}});var Cn={label:"Level requirements",instruction:"Set the requirements and conditions for the user to access specific levels",value:r((...e)=>[y(o.levelDefinition.type,t=>M(t,...e))],"value"),editable:!0,restrictive:!0,type:[o.levelDefinition],check:r(e=>{if(!e?.length||!Array.isArray(e))throw Error("Must be a non empty array")},"check")};m.levelsDefinitions={module:Cn};m.link={"sign-step":f({label:"Associated link to the document",editable:!0,type:{href:a("",{required:!0,editable:!0,label:"URL",instruction:"Href HTML attribute",check:r(e=>{e.length&&cr(e)},"check")}),label:a("> Link to the document",{editable:!0,label:"Label / text displayed"}),target:a("_blank",{label:"Target HTML attribute",instruction:"Open the link in a new browser tab"})},...P}),"avatar-step":f({label:"Link to the legal page",editable:!1,required:!0,value:{href:"/legal",label:"> Privacy policy",target:"_blank"},type:{href:a("/legal",{editable:!1}),label:a("> Privacy policy",{editable:!1}),target:a("_blank",{editable:!1})}})};b.mandatory={module:{project:{label:"Mandatory content to validate the curriculum",type:"boolean",required:!1,editable:!0}}};var jn=r((e,t)=>Math.max(t.attrs.group||1,e),"maxGroupReducer"),Dn=r(e=>Q(e).reduce(jn,1),"getMaxExamGroup");m.maxGroup={exam:{type:"number",label:"Max exercise group",private:!0,required:!0,...u({"biggest exercise group of the exam":Dn})}};var vr=a("",{label:"Name",editable:!0,...P}),wr={};for(let e of ye)e!=="avatar-step"&&(wr[e]=vr);m.name={signup:vr,...wr};var In=r(({parent:e})=>e?.type,"getParentType"),I={type:"string",private:!0,required:!0,label:"Upper content type",...u({"from parent":In})};b.parentType={campus:{piscine:I},module:{piscine:I,exam:I,project:I},piscine:{quest:I,exam:I,raid:I,project:I},quest:{exercise:I},exam:{exercise:I}};o.rankDefinitionName=a("",{label:"Name",editable:!0,required:!0,primary:!0,check:r((e,t)=>{if(t.attrs.ranksDefinitions?.filter(i=>i.name===e)?.length>1)throw Error(`Name "${e}" is already set for a rank definition! A given name can only be attributed once to a rank.`)},"check")});o.rankDefinition=f({label:"Rank requirements",type:{name:o.rankDefinitionName,level:a(S,{label:"Level required",editable:!0,required:!0,check:r((e,t)=>{if(w(e,0,S),t.attrs.ranksDefinitions?.filter(i=>i.level===e)?.length>1)throw Error(`Level ${e} is already set for a rank definition! A given level can only be attributed once to a rank.`)},"check")}),milestone:a("",{label:"Milestone description",editable:!0})}});var Xt={label:"Rank requirements",instruction:"List of ranks access conditions",editable:!0,restrictive:!0,value:r((...e)=>[y(o.rankDefinition.type,t=>M(t,...e))],"value"),type:[o.rankDefinition],check:r(e=>{if(!e?.length||!Array.isArray(e))throw Error("Must be a non empty array")},"check")};m.ranksDefinitions={module:Xt,piscine:Xt};var se={label:"Registration duration (to an event)",required:!0,editable:!0,check:r(e=>Oe(e*6e4,1*6e4,365*864e5),"check")};m.registrationDuration={exam:a(1.5*864e5/6e4,se),module:a(30*864e5/6e4,se),interview:a(2*6048e5/6e4,se),piscine:a(30*864e5/6e4,se),raid:a(1.5*864e5/6e4,se)};var Rn=`https://${process.env.DOMAIN}/git/`,Mn=r(({attrs:e})=>`${Rn}${e.repositoryPath}`,"getRepositoryURL"),Je={label:"Repository URL",type:"string",required:!0,private:!0,...u({"from gitea user account":Mn})};m.repository={exercise:Je,project:Je,raid:Je};var kr=r(({group:e,parent:t})=>(e||(e=t?.group),e&&(e.captainLogin||e.captain?.login)),"getCaptainLogin"),$n=r(({name:e,group:t,parent:n},i)=>`${kr({group:t,parent:n})||i.login}/${e}`,"getRepositoryPath"),On=r(({attrs:e,parent:t,group:n},i)=>{let s=kr({parent:t,group:n});return s?`${s}/${t.path.replace(/\/+/g,"-")}`:`${i.login}/${e.rootName}`},"getExerciseRepositoryPath"),Ze={label:"Repository path",type:"string",required:!0,private:!0,...u({"from captain":$n})};m.repositoryPath={exercise:{...Ze,...u({"from captain":On})},project:Ze,raid:Ze};m.requiredAuditRatio={project:a(.5,{label:"Audit ratio required to begin the project",instruction:"From 0 to 2 (1 being the perfect balance of audits)",required:!0,editable:!0,options:[...Array(21)].map((e,t)=>Math.round(t*.1*10)/10),check:r(e=>$e(e,0,2),"check")})};o.pathwaysRequirementObjects={label:"Multiple content choices",instruction:"Adding this will create a new path way for the project being edit.",check:r((e,t)=>{gr(e.flat(),t)},"check"),required:!1,editable:!0,type:[{...o.objectRootRelativePath,label:"Content relative path (optional)"}],value:r((...e)=>{let t=o.objectRootRelativePath.options(...e)?.[0];return t?[t]:[]},"value")};var ke=f({...Sn,type:{skills:{...mt,label:"Skills required",instruction:"Necessary skill level to unlock the current content",description:"Define the skills and tier required to unlock the current content. The skill tracker button opens a modal where you can visualize the contents that reward the selected skill"},objects:{...o.sharedObjectList,value:r((...e)=>{let t=o.objectRootRelativePath.options(...e)?.[0],n=o.pathwaysRequirementObjects.value(...e);return t?[t,n]:[]},"value"),type:[o.objectRootRelativePath,o.pathwaysRequirementObjects],instruction:"Content required to unlock the current one"}}});b.requirements={module:{project:ke,piscine:ke},campus:{piscine:{hidden:!0,...ke},module:{hidden:!0,...ke}}};var Ee=a("",{label:"Resume",editable:!0,...P});m.resume={"module-registration":Ee,"piscine-registration":Ee,"form-step":Ee,interview:Ee};var Tn=r(({attrs:e})=>e.baseSkills,"getBaseSkills"),et=r(({attrs:e})=>e.baseXp,"getBaseXp"),Ln=r(({attrs:e})=>e.inScope?e.baseXp:0,"getScopedBaseXp");o.skills={...u({"collect skills":Tn}),label:"Skills",required:!0};var De={private:!0,required:!0,label:"Reward conditions",instruction:"Conditions to collect xp and skills when succeeded"},qe=f({type:{skills:o.skills,xp:{...u({"collect xp in scope":Ln}),label:"XP",required:!0}},...De});b.rewards={piscine:{raid:f({type:{skills:o.skills,xp:{...u({"collect xp":et}),label:"XP",required:!0}},...De}),project:qe},module:{piscine:f({type:{skills:o.skills,xp:{...u({"collect xp":et}),label:"XP",required:!0}},...De}),project:qe},campus:{piscine:f({type:{skills:o.skills,xp:{...u({"collect xp":et}),label:"XP",required:!0}},...De})},quest:{exercise:qe},exam:{exercise:qe}};var Pn=r(({parent:e})=>{let{attrs:t,name:n,type:i,id:s,path:l}=e;return i!=="campus"?{attrs:{eventId:t.eventId},name:n,type:i,id:s,path:l}:void 0},"rewardParent");b.rewardsTarget={module:{piscine:{type:"object",label:"Target of the rewards",instruction:"Content to which rewards are attributed",required:!0,...u({"parent event if exists":Pn})}}};var Nn=r(({parent:e})=>{for(;e;){if(e.type==="module"||e.type==="piscine")return e.key;e=e.parent}return""},"getRootName"),le={type:"string",private:!0,...u({"root content key":Nn}),required:!0,label:"Root key"};b.rootName={quest:{exercise:le},exam:{exercise:le},module:{project:le},piscine:{project:le,raid:le}};var Fn=r(({parent:e})=>{for(;e;){if(e.type==="module"||e.type==="piscine")return e.path;e=e.parent}},"getRootPath"),$={type:"string",required:!0,private:!0,...u({"root content path":Fn}),label:"Root path"};b.rootPath={module:{project:$,piscine:$,exam:$},piscine:{project:$,raid:$,exam:$,quest:$},quest:{exercise:$},exam:{exercise:$}};var _n=r(e=>Et(e.attrs.scopeStart,e),"questScopeEnd"),Vn=r(({event:e})=>e&&be(e.endAt),"getEventScopeEnd"),Er={type:"number",required:!0,private:!0},tt={...Er,label:"Active scope end",...u({"when event ends":Vn})},rt={...Er,label:"Reward scope end",...u({"when extra duration ends":_n})};b.scopeEnd={piscine:{raid:tt,exam:tt,quest:rt,project:rt},module:{project:rt,exam:tt}};var Bn=a(0,{label:"Extra duration (for reward scope)",editable:!0,check:r(e=>Oe(e*864e5,0,50*864e5),"check")});b.scopeExtraDuration={piscine:{quest:Bn}};var Wn=r(({attrs:e})=>e.start,"getScopeStart"),qr={type:"number",required:!0,private:!0,...u({"from start date":Wn})},nt={...qr,label:"Active scope start"},it={...qr,label:"Temporal-window & reward scope start"};b.scopeStart={piscine:{quest:it,project:it,raid:nt,exam:nt},module:{exam:nt,project:it}};var zn=r(({parent:e})=>e?.attrs.special,"getSpecial");m.special={quest:a(!1,{label:"Activate hackathon mode",editable:!0,restrictive:!0}),exercise:{label:"In hackathon mode",type:"boolean",required:!0,...u({"activated with the quest":zn})}};var ht=r(e=>{let t=zr(e,Ur),n=t?.event;if(n){let i=be(n.startAt);return t===e?i:Fe(i,e)}if(e.parent)return Fe(e.parent.attrs.start,e)},"getStart"),O={label:"Start date",type:"number",required:!0,private:!0,...u({"from start date of event":ht})},Kt={...O,...u({"starts with module":ht})},Un=r(({parent:e,attrs:t})=>e?.attrs.start+t.delay,"getExerciseStart"),Gn={...O,...u({"from temporal-window (if in hackathon mode)":Un})};b.start={campus:{module:O,piscine:O},module:{exam:O,piscine:O,project:Kt},piscine:{raid:O,exam:O,quest:{...O,...u({"from temporal-window":ht})},project:Kt},quest:{exercise:Gn}};var ce=a(0,{label:"Starts after a delay of (within the event)",editable:!0,required:!0});b.startAfter={module:{piscine:ce,exam:ce},piscine:{exam:ce,raid:ce},campus:{piscine:ce}};var Sr=r(({prev:e})=>e?e.attrs.duration+e.attrs.startDay:1,"getStartDay"),Xn=r(({parent:e,prev:t})=>e.type==="piscine"?Sr({prev:t}):void 0,"getExamStartDay"),Se=a(1,{label:"Start day n\xB0",...u({"from end of previous content temporal-window":Sr}),required:!0,private:!0});b.startDay={piscine:{exam:{...Se,...u({"from end of previous content temporal-window":Xn})},quest:Se,raid:Se,project:Se}};var N=r(e=>{if(e?.isDone)return e.grade>=1?"succeeded":"failed"},"getProgressStatus"),Kn=r(e=>{let{attrs:t,progress:n,parent:i}=e,s=N(n);if(s)return s;if(!i)return"available";if(i.attrs.status==="blocked")return"blocked";let{group:l}=t;if(l<=1)return i.attrs.status;let c=Q(i).filter(d=>d.attrs.group<l),p=Math.max(...c.map(d=>d.attrs.group));return c.filter(d=>d.attrs.group===p).some(d=>d.attrs.status==="succeeded")?"available":"blocked"},"examExerciseStatus"),Hn=r(e=>{let{prev:t,attrs:n,progress:i,parent:s}=e,l=N(i);if(l)return l;if(!s)return"available";if(s.attrs.status==="blocked")return"blocked";let c=Date.now();if(n.special)return c<n.start?"blocked":c>n.duration+n.start?"failed":"available";if(t&&t.attrs.status!=="succeeded")return"blocked";let p=Date.now()+864e5;if(s.prev?.type==="project"&&s.prev?.attrs.status!=="succeeded"&&s.prev?.attrs.scopeEnd>p)return"blocked";let h=er(s.prev,tr);return h&&h.attrs.status!=="succeeded"&&h.attrs.scopeEnd>p?"blocked":"available"},"questExerciseStatus"),Ht=r((e,t)=>{try{return X(e,t)?.attrs.status==="succeeded"}catch{return!0}},"isPathStatusSucceeded"),Yt=r((e,t)=>{let i=e.parent.children[t.slice(3)]?.versions?.map(({key:s})=>`../${s}`);return i?.length?[t,...i]:[t]},"addVersionChain"),Yn=r((e,t)=>{if(!e)return!0;let{objects:n}=e;if(!n||!n.length)return!0;let i=n.map(h=>Array.isArray(h)?h.flatMap(d=>Yt(t,d)):Yt(t,h)),s=i.filter(h=>!Array.isArray(h)&&!!h),l=i?.filter(h=>Array.isArray(h)&&!!h),c=s.every(h=>Ht(h,t)),p=l?.every(h=>h.some(d=>Ht(d,t)));return p!==void 0?c&&p:c},"hasSucceededRequiredObjects"),ft=r(({requirements:e,object:t,user:n,progress:i})=>{if(i&&Object.keys(i).length||!e)return!0;let s=jt(e.skills,n.skills);return Yn(e,t)&&s},"meetsRequirements"),Qn=r(e=>{let{prev:t,parent:n,attrs:i}=e;return!n.progress||!i.hasStarted||Date.now()<i.scopeEnd&&Ar(t)?"blocked":"available"},"projectInPiscineStatus"),Qt=r((e,t)=>{let{attrs:n,progress:i}=e,{requirements:s,parentType:l}=n,c=N(i);return c||(ft({object:e,requirements:s,user:t,progress:i})?l==="piscine"?Qn(e):"available":"blocked")},"projectStatus"),Ar=r(e=>e?.attrs.inScope&&e?.attrs.status!=="succeeded","notSucceeded"),Jn=r(e=>{for(let t of e){if(!Me(t))continue;if(!t.progress)return"failed";let n=N(t.progress);if(n&&n!=="succeeded")return n}return"succeeded"},"successStatus"),at=r(e=>{let{prev:t,parent:n,attrs:i,progress:s}=e;if(!n||!n.progress||!i.hasStarted||!i.special&&Date.now()>i.scopeEnd&&Ar(er(t,tr)))return"blocked";let l=Object.values(e.children||{});return l.length?Jn(l):N(s)||"available"},"questStatus"),Zn=r((e,t)=>{let{progress:n,attrs:i}=e,{requirements:s}=i;return ft({object:e,requirements:s,user:t,progress:n})},"getMeetsRequirements"),Jt=r((e,t)=>{let{progress:n,event:i,attrs:s}=e,{requirements:l}=s,c=N(n);return c||(!ft({object:e,requirements:l,user:t,progress:n})&&!i?.registeredPosition?"blocked":"available")},"getPiscineStatus"),ei=r(e=>{let{progress:t,event:n,attrs:i}=e,s=N(t);return s||(!n||Date.now()<i.start?"blocked":"available")},"raidStatus"),ti=r(()=>"available","alwaysOpen"),ri=r((e,t)=>t?.event&&(e==="interview"||e==="piscine-registration")&&new Date(t.event.endAt)>Date.now(),"isWaitingEndOfEvent"),ni=r(e=>{let t=e.type.endsWith("-registration"),n=e.type.split("-")[0],i=t?Rt(e.parent.parent.children,n):e;if(!i)return"blocked";let s=i.lastProgress,l=N(s);return l==="succeeded"&&ri(e.type,i.lastProgress)?"available":l||(!e.prev||e.prev&&e.prev.attrs.status==="succeeded"?"available":"blocked")},"onboardingStatus"),ue={type:"string",label:"Unlock system",...u({"previous step validated":ni}),options:["blocked","available","succeeded","failed"],required:!0},R={type:"string",label:"Unlock system and result status",required:!0,options:["blocked","available","succeeded","failed"]};b.status={campus:{onboarding:{type:"string",private:!0,required:!0,...u({"always open":ti})},piscine:{...R,...u({"by requirements and event":Jt})}},onboarding:{administration:ue,games:ue,"piscine-registration":ue,"module-registration":ue,interview:ue},piscine:{exam:{...R,...u({"by event":at})},quest:{...R,...u({"by scope":at})},raid:{...R,...u({"by event":ei})},project:{...R,editable:!0,editableDefaultValue:"available",...u({"by requirements":Qt})}},quest:{exercise:{...R,editable:!0,editableDefaultValue:"available",...u({"one by one":Hn})}},exam:{exercise:{...R,editable:!0,editableDefaultValue:"available",...u({"one by one (grouped by difficulty)":Kn})}},module:{project:{...R,editable:!0,editableDefaultValue:"available",...u({"by requirements":Qt})},piscine:{...R,...u({"by requirements and event":Jt})},exam:{...R,...u({"by event":at})}}};o.meetRequirements=a(!1,{label:"User meet requirement",restrictive:!0,required:!0,hidden:!0,...u({"by requirements":Zn})});b.meetsRequirements={module:{piscine:o.meetRequirements,project:o.meetRequirements}};var ii=r(e=>`/markdown/root/public/${`subjects/${ar(e)}/README.md`}`,"getSubject"),ot=a("",{label:"Subject URL",editable:!0,required:!0,...u({"README.md in subject folder":ii})});m.subject={exercise:ot,project:ot,raid:ot};var Ae=a("",{editable:!0,...P});o.teamworkRankName=a("",{label:"Rank name",type:"string",editable:!0,required:!0,primary:!0,check:r((e,t)=>{let{teamworkRanks:n}=t.attrs;if(n?.filter(s=>s.name===e)?.length>1)throw Error(`Name "${e}" is already set for a teamwork rank definition! A given name can only be attributed once to a rank.`)},"check")});o.teamworkRankParticipations=a(0,{label:"Group Participations",instruction:"The number of users the student has to work with, to unlock this rank.",editable:!0,required:!0,options:q(150,0),type:"number",check:r((e,t)=>{if(!Number.isInteger(e))throw Error("Must be a whole number");if(t.attrs.teamworkRanks?.filter(i=>i.groups===e)?.length>1)throw Error(`There is already a rank with ${e} users required for the rank`)},"check")});o.teamworkRanks=f({type:{name:o.teamworkRankName,groups:o.teamworkRankParticipations}});m.teamworkRanks={campus:{label:"Teamwork ranks",instruction:"List of teamwork ranks",type:[o.teamworkRanks],required:!0,editable:!0,value:r((...e)=>[y(o.teamworkRanks.type,t=>M(t,...e))],"value"),check:r(e=>{if(!e?.length||!Array.isArray(e))throw Error("Must be a non empty array")},"check")}};m.text={"upload-step":{...Ae,label:"Resume"},"sign-step":{...Ae,label:"Text to agree to",required:!0},"contact-validation-step":{...Ae,label:"Resume"},"avatar-step":{...Ae,label:"Resume"}};o.timelineChunk=f({label:"Month guideline",type:{month:a(1,{label:"Month",editable:!0,required:!0,primary:!0,check:r((e,t)=>{if(w(e,1,120),t.attrs.timeline?.filter(i=>i.month===e)?.length>1)throw Error(`Month ${e} is set for different timeline guidelines! A given month can only be defined once.`)},"check")}),minLevel:a(0,{label:"Minimum level",instruction:"Minimum level to be considered on time",editable:!0,required:!0,check:r(e=>w(e,0,S),"check")}),expectedLevel:a(0,{label:"Expected level",editable:!0,required:!0,instruction:"Recommended level the user should achieve",check:r(e=>w(e,0,S),"check")}),checkpointLevel:a(0,{label:"Checkpoint level",editable:!0,required:!0,instruction:"Recommended checkpoint level the user should achieve",check:r(e=>w(e,0,100),"check")}),rank:a("",{label:"Rank",editable:!0,instruction:"Recommended rank the user should achieve",options:r(e=>e.attrs.ranksDefinitions?.map(t=>t.name),"options"),check:r((e,t)=>{if(!t.attrs.ranksDefinitions?.length)throw Error("Must match an existing rank name, but ranks definitions are not set.");let n=t.attrs.ranksDefinitions?.map(({name:i})=>i);if(!n.includes(e))throw Error(`Must match one of the following existing rank names: ${n.join(", ")}.`)},"check")}),skills:f({label:"Skills",instruction:"Recommended skills the user should get",editable:!0,value:{},type:y(Be,({name:e,type:t,description:n})=>({label:e,instruction:t,description:n,editable:!0,type:"number",value:1,options:q(100,1),check:r(i=>w(i,1,100),"check")}))}),notes:a("",{label:"Other notes",instruction:"Write any other notes or expectations the user should aim for",editable:!0})}});var Zt={label:"Timeline of the curriculum",instruction:"Create a timeline with monthly expectations for users to better track their progression over time",value:r((...e)=>[y(o.timelineChunk.type,t=>M(t,...e))],"value"),editable:!0,restrictive:!0,type:[o.timelineChunk],check:r(e=>{if(!e?.length||!Array.isArray(e))throw Error("Must be a non empty array")},"check")};m.timeline={module:Zt,piscine:Zt};o.adminSelectionValidation=f({type:{type:a("admin_selection",{required:!0,private:!0,primary:!0,label:"Type",options:["admin_selection"]})},label:"Admin selection",description:"Admins manually select which submissions move forward."});var ai=r(({attrs:e})=>e.language&&`ghcr.io/01-edu/test-${e.language}`,"getTesterImage");o.testerValidation=f({label:"Automatic testing",description:"The solution submitted by the user will be automatically tested and a result will immediately be available.",type:{type:a("tester",{required:!0,private:!0,label:"Type",options:["tester"]}),testImage:{type:"string",label:"Docker image",required:!0,editable:!0,primary:!0,instruction:"used to run the tests",...u({"from language":ai})},cooldown:a(3*6e4,{required:!0,editable:!0,label:"Delay between two submit"})}});var bt={type:"object",required:!0,label:"Audited by",instruction:"Match groups with auditors"},oi=r(({attrs:e})=>({campus:{_eq:e.campus}}),"usersOfCampusWithAdmins"),si=r(({attrs:e})=>({campus:{_eq:e.campus},_not:{roles:{slug:{_in:["admin",`campus_admin_${e.campus}`]}}}}),"userInCampus"),li=r(({attrs:e})=>({events:{eventId:{_eq:e.eventId}}}),"usersInEventWithAdmins"),ci=r(({attrs:e})=>({_not:{roles:{slug:{_in:["admin",`campus_admin_${e.campus}`]}}},events:{eventId:{_eq:e.eventId}}}),"userInEvent"),yt={id:{_eq:1}},ui=r(({event:e})=>({_or:[{labels:{label:{name:{_eq:`auditorFor${e?.id}`}}}},yt]}),"userAuditorForEvent"),di=r(({attrs:e})=>({_or:[{private:{roles:{slug:{_eq:`campus_admin_${e.campus}`}}}},yt]}),"isCampusAdmin"),pi=r(()=>yt,"noAttribution"),mi=r(e=>`/markdown/raw/root/public/${`subjects/${ar(e)}/audit/README.md`}`,"getAuditPath"),gt={required:!0,editable:!0,type:"string",label:"Audit form URL",instruction:"List of questions asked by the auditor during the audit. The URL should return raw markdown",...u({"README in audit folder":mi})};o.adminAuditValidationDelay=a(0,{label:"Audit duration",editable:!0,required:!0,instruction:"Time that the admins have to complete an audit before it expires"});o.adminAuditValidationRequired=a(1,{label:"Number required",required:!0,instruction:"Minimum of audits required",check:r(e=>{if(e<1)throw Error("must be at least one")},"check")});o.adminAuditValidationRatio=a(1,{label:"Ratio",required:!0,instruction:"Proportion of extra audits generated",check:r(e=>{if(e<1)throw Error("must be at least one")},"check")});o.adminAuditValidation=f({label:"Admin audit",description:"Only admins can evaluate this content.",type:{type:a("admin_audit",{required:!0,private:!0,primary:!0,label:"Type",options:["admin_audit"]}),delay:o.adminAuditValidationDelay,required:o.adminAuditValidationRequired,ratio:o.adminAuditValidationRatio,matchWhere:{...bt,...u({"an admin of same campus":di,"manual attribution":pi})},form:gt}});o.userAuditValidationDelay=a(2*6048e5/6e4,{label:"Audit duration",required:!0,editable:!0,instruction:"Time that the users have to complete an audit before it expires"});o.userAuditValidationRequired=a(5,{label:"Number required",required:!0,editable:!0,instruction:"Minimum of audits required",check:r(e=>{if(e<1)throw Error("must be at least one")},"check")});o.userAuditValidationRatio=a(2,{label:"Ratio",required:!0,editable:!0,instruction:"Proportion of extra audits generated",check:r(e=>{if(e<1)throw Error("must be at least one")},"check")});o.matchInfluence=f({label:"Audit Attribution Influence",editable:!0,required:!0,instruction:"Adjust the weights in the match algorithm to influence how audits are attributed",type:{auditsRatio:a(1,{label:"Current Audit Ratio",editable:!0,required:!0}),auditsAssigned:a(1,{editable:!0,required:!0,label:"Fewest Pending Audits"}),levelProximity:a(1,{editable:!0,required:!0,label:"Level Proximity"}),lastAuditAttributed:a(1,{editable:!0,required:!0,label:"Last Audit Attributed"})}});o.userAuditValidation=f({label:"User audit",description:"Users will be assigned as auditors to peer-review the project submission. You can customise the rules of audit attribution and requirements for the group to succeed.",type:{type:a("user_audit",{required:!0,private:!0,primary:!0,label:"Type",options:["user_audit"]}),delay:o.userAuditValidationDelay,required:o.userAuditValidationRequired,ratio:o.userAuditValidationRatio,matchInfluence:o.matchInfluence,matchWhere:{...bt,...u({"any user in same campus":si,"any user in same event":ci,"any user in same campus (with admins)":oi,"any user in same event (with admins)":li})},form:gt,preQuestions:{editable:!0,type:"array",label:"Pre questions",instruction:"Define a set of questions that appear before the main audit. Go to \u201Cedit & preview\u201D mode to visualize the question content"},postQuestions:{editable:!0,type:"array",label:"Post questions",instruction:"Define a set of questions that appear after the main audit. Go to \u201Cedit & preview\u201D mode to visualize the question content"}}});o.raidAuditorValidation=f({label:"Dedicated auditors for event",description:"Define a list of users that will audit the content. This list is created on each event related to this content, and needs to be available before the event ends.",type:{type:a("dedicated_auditors_for_event",{required:!0,private:!0,primary:!0,label:"Type",options:["dedicated_auditors_for_event"]}),delay:o.adminAuditValidationDelay,required:o.adminAuditValidationRequired,ratio:o.adminAuditValidationRatio,matchWhere:{...bt,...u({"any user labelled as event's auditor ":ui})},form:gt}});var de={label:"Evaluations required",instruction:"Define the evaluation methods for this content",check:r(e=>{if(!e.length)throw Error("must have at least one element")},"check"),required:!0,editable:!0};m.validations={project:{...de,type:[o.userAuditValidation],value:r((...e)=>[y(o.userAuditValidation.type,t=>M(t,...e))],"value")},raid:{...de,type:[o.adminAuditValidation,o.raidAuditorValidation],maxElements:1,value:r((...e)=>[y(o.adminAuditValidation.type,t=>M(t,...e))],"value")},exercise:{...de,type:[o.testerValidation],value:r((...e)=>[y(o.testerValidation.type,t=>M(t,...e))],"value")},piscine:{...de,type:[o.adminSelectionValidation],value:r((...e)=>[y(o.adminSelectionValidation.type,t=>M(t,...e))],"value")},interview:{...de,type:[o.adminSelectionValidation],value:r((...e)=>[y(o.adminSelectionValidation.type,t=>M(t,...e))],"value")}};m.videos={quest:a("https://www.youtube.com/",{type:"string",label:"Videos URL",editable:!0,check:cr})};m.legalText={"avatar-step":a("Please make sure to upload a photograph that complies with the training center's internal regulations and standards of decency. This photo will be visible to the teaching staff to support essential individual academic monitoring, as well as to other learners to facilitate peer-to-peer collaboration. Any request for deletion or modification must be submitted to the management.",{type:"string",label:"Legal text",editable:!1,required:!0})};var hi=r(({attrs:e})=>{if(!e.startDay)return;let t=e.startDay/7;return Math.ceil(t)},"getWeek"),Ce=a(1,{label:"Week n\xB0",required:!0,private:!0,...u({"from day n\xB0":hi})});b.week={piscine:{exam:Ce,quest:Ce,raid:Ce,project:{...Ce,value:1,functions:void 0,required:!1,private:!1}}};var fi=r(({object:e,value:t})=>{let n=Object.values(e.parent.children).filter(({type:i,key:s})=>s!==e.key&&i==="raid");for(let{attrs:i}of n)if(i.branch===t)throw Error("Raids should have their unique branch")},"checkRaidLimitation"),Cr=r(({object:e,value:t,limit:n=9})=>{if(Object.values(e.parent.children).filter(({key:s,attrs:l})=>s!==e.key&&l.branch===t).length+1>n)throw Error(`The limit of content in a branch is ${n}`)},"checkBranchLimitation"),jr={label:"Base Branch",instruction:"From 1 to 4",description:"Changing branch can disrupt the piscine timeline.",required:!0,editable:!0,hidden:!0},bi=r(e=>{let n={};for(let s of Object.values(e.parent.children||{})){let l=s.attrs.branch;n[l]=(n[l]||0)+1}return[1,2,3,4].filter(s=>(n[s]||0)<9)},"getBranchOptions"),je=a(1,{...jr,options:bi,check:r((e,t)=>{$e(e,1,4),Cr({object:t,value:e})},"check")}),yi=a(1,{...jr,options:[1,2,3,4],check:r((e,t)=>{$e(e,1,4),fi({object:t,value:e}),Cr({object:t,value:e})},"check")});b.branch={piscine:{quest:je,project:je,raid:yi,sharedBranch:je,exam:je}};var st=a(0,{required:!0,private:!0}),gi=r(({parent:e})=>e.attrs.xpIndex,"parentXpIndex"),xi=r(({prev:e,parent:t})=>e?(e.attrs.xpIndex||0)+(dt(e)||1):t?.attrs.xpIndex||0,"getXpIndex"),z={required:!0,private:!0,type:"number",...u({"from previous xpIndex and XP coefficient (or parent if exam or no prev)":xi})};b.xpIndex={campus:{module:st,piscine:st},module:{piscine:st,project:z,exam:z},piscine:{exam:z,project:z,quest:z,raid:z},quest:{exercise:z},exam:{exercise:{required:!0,private:!0,type:"number",...u({"from parent xpIndex":gi})}}};var xt={ab:"Abkhazian",aa:"Afar",af:"Afrikaans",sq:"Albanian",am:"Amharic",ar:"Arabic",hy:"Armenian",as:"Assamese",ay:"Aymara",az:"Azerbaijani",ba:"Bashkir",eu:"Basque",bn:"Bengali (Bangla)",dz:"Bhutani",bh:"Bihari",bi:"Bislama",br:"Breton",bg:"Bulgarian",my:"Burmese",be:"Byelorussian (Belarusian)",km:"Cambodian",ca:"Catalan",zh:"Chinese (Simplified)",co:"Corsican",hr:"Croatian",cs:"Czech",da:"Danish",nl:"Dutch",en:"English",eo:"Esperanto",et:"Estonian",fo:"Faeroese",fa:"Farsi",fj:"Fiji",fi:"Finnish",fr:"French",fy:"Frisian",gl:"Galician",gd:"Gaelic (Scottish)",gv:"Gaelic (Manx)",ka:"Georgian",de:"German",el:"Greek",kl:"Greenlandic",gn:"Guarani",gu:"Gujarati",ha:"Hausa",he:"Hebrew",hi:"Hindi",hu:"Hungarian",is:"Icelandic",id:"Indonesian",ia:"Interlingua",ie:"Interlingue",iu:"Inuktitut",ik:"Inupiak",ga:"Irish",it:"Italian",ja:"Japanese",kn:"Kannada",ks:"Kashmiri",kk:"Kazakh",rw:"Kinyarwanda (Ruanda)",ky:"Kirghiz",rn:"Kirundi (Rundi)",ko:"Korean",ku:"Kurdish",lo:"Laothian",la:"Latin",lv:"Latvian (Lettish)",li:"Limburgish ( Limburger)",ln:"Lingala",lt:"Lithuanian",mk:"Macedonian",mg:"Malagasy",ms:"Malay",ml:"Malayalam",mt:"Maltese",mi:"Maori",mr:"Marathi",mo:"Moldavian",mn:"Mongolian",na:"Nauru",ne:"Nepali",no:"Norwegian",oc:"Occitan",or:"Oriya",om:"Oromo (Afan, Galla)",ps:"Pashto (Pushto)",pl:"Polish",pt:"Portuguese",pa:"Punjabi",qu:"Quechua",rm:"Rhaeto-Romance",ro:"Romanian",ru:"Russian",sm:"Samoan",sg:"Sangro",sa:"Sanskrit",sr:"Serbian",sh:"Serbo-Croatian",st:"Sesotho",tn:"Setswana",sn:"Shona",sd:"Sindhi",si:"Sinhalese",ss:"Siswati",sk:"Slovak",sl:"Slovenian",so:"Somali",es:"Spanish",su:"Sundanese",sw:"Swahili (Kiswahili)",sv:"Swedish",tl:"Tagalog",tg:"Tajik",ta:"Tamil",tt:"Tatar",te:"Telugu",th:"Thai",bo:"Tibetan",ti:"Tigrinya",to:"Tonga",ts:"Tsonga",tr:"Turkish",tk:"Turkmen",tw:"Twi",ug:"Uighur",uk:"Ukrainian",ur:"Urdu",uz:"Uzbek",vi:"Vietnamese",vo:"Volap\xFCk",cy:"Welsh",wo:"Wolof",xh:"Xhosa",yi:"Yiddish",yo:"Yoruba",zu:"Zulu"},aa=Object.fromEntries(Object.entries(xt).map(([e,t])=>[t,e]));var Dr={boolean:r(e=>typeof e=="boolean","boolean"),number:r(e=>typeof e=="number","number"),string:r(e=>typeof e=="string","string"),object:r(e=>typeof e=="object"&&e!==null,"object"),array:Array.isArray},vi=r(e=>Array.isArray(e)?"array":typeof e=="object"&&e!==null?e.type||"object":typeof e,"determinType"),Le=r((e,t,n,i)=>{let{type:s,check:l,options:c}=e;if(t==null){if(!e.required||e.value!==void 0)return!0;throw Error(`missing value for required attribute ${i}`)}if(!s)throw Error(`attribute type definition is missing for ${i}`);if(t?.type==="function"){if(e.functionsByName[t.name])return!0;throw Error(`function associated not allowed for ${i}`)}if(l?.(t,n,i),c){let d=typeof c=="function"?c(n,t):c;if(d.length===1){if(d[0]!==t)throw Error(`${i} must be ${d[0]} but was ${t}`)}else if(!d.includes(t))throw Error(`invalid option for ${i}: should be included in ${d.join(", ")}`)}if(Dr[s]){if(!Dr[s](t))throw Error(`Expect ${s} for ${i}`);return!0}if(Array.isArray(s)){if(!Array.isArray(t))throw Error(`invalid attribute value: expects an array for ${i}`);let d=s.length===1&&s[0],k=!d&&Object.fromEntries(s.map(E=>[Array.isArray(E.type)?"array":E.type?.type?.value||E.type,E]));for(let[E,C]of t.entries()){let F=Error("checks failed for all types");F.index=E,F.key=i,F.label=e.label;let Pe=d||k[vi(C)];if(!Pe)throw F.details={label:"Unknown structure",err:Error("no type matches the value")},F;try{Le(Pe,C,n,i)}catch(Ne){throw F.details=Ne.details||{label:Pe.label||Ne.label,err:Ne},F}}return!0}if(typeof s!="object")throw Error("invalid attribute type definition");if(typeof t!="object"||t===null)throw Error("invalid attribute value: expects an object");let p=Object.entries(s),h=Object.keys(t).find(d=>!s[d]);if(h)throw Error(`${h} is invalid.`);for(let[d,k]of p)Le(k,t[d],n,d);return!0},"typeChecker"),he=ge(m,([e,t])=>[e,y(t,n=>({...n,check:r((i,s)=>Le(n,i,s,e),"check")}))]),fe=ge(b,([e,t])=>[e,y(t,n=>y(n,i=>({...i,check:r((s,l)=>Le(i,s,l,e),"check")})))]);var vt={},wi=Object.entries(xt);for(let[e,t]of Object.entries(he))for(let[n,i]of Object.entries(t)){let s=vt[n]||(vt[n]={});s[e]=i;let{label:l,...c}=i;if(i.functionsByName?.translate)for(let[p,h]of wi){let d=`${l} - ${h}`;s[`${e}-${p}`]={...c,label:d,lgCode:p,required:!1}}}var wt={};for(let[e,t]of Object.entries(fe))for(let[n,i]of Object.entries(t))for(let[s,l]of Object.entries(i)){let c=wt[n]||(wt[n]={}),p=c[s]||(c[s]={});p[e]=l}var ua=y(vt,Object.entries),da=y(wt,e=>y(e,Object.entries));var ki=r(e=>e.toLowerCase().replaceAll(/[^a-z0-9]+/g," ").trim().replaceAll(" ","-"),"normalize"),Ei=r(e=>{let{type:t,name:n,attrs:i,children:s,childrenAttrs:l,referencePath:c,...p}=e,[h]=Object.keys(p);if(h)throw Error(`Unexpected property ${h}, did you mean to define an attribute ?`);if(t==="campus")throw Error("Campuses can't be defined in definitions");if(!At.has(t))throw Error("Invalid type property");if(!n||typeof n!="string")throw Error("Invalid name property");if(!i||typeof i!="object"||Array.isArray(i))throw Error("Invalid attrs property");if(l)throw Error("childrenAttrs is no longer supported");for(let d of Object.keys(i||{})){if(fe[d])throw Error(`Attr ${d} should be defined in the relation with its parent, not on the object itself.`);let k=he[d];if(!k)throw Error(`Undefined attr ${d}`);let E=k[t];if(!E){let C=Object.keys(k).join(", ");throw Error(`${t} does not match any of ${C} for attr ${d}`)}if(E.deprecated)throw Error(`attr ${d} deprecated: ${E.deprecated}`)}},"assertDef"),Ir=r(({name:e,type:t,attrs:n,children:i,referencePath:s},l,c)=>{if(c>100)throw Error("Unexpected very deep tree, maybe circular ?");let p={name:e,type:t,attrs:n,children:{},referencePath:s,parent:l};if(!i)return p;let h;for(let[d,{ref:k,...E}]of Object.entries(i)){let C=Ir(k,p,(c||0)+1);C.attrs={...C.attrs,...E},h&&(h.next=C),C.prev=h,p.children[d]=C}return p},"buildTree"),qi=r((e,t,n)=>{if(!/^[a-z0-9-]*$/.test(t))throw Error(`Invalid key for child ${t} Kebab-case key suggestion: ${ki(t)}`);let i=n.ref,{type:s}=i;if(!Ct[e.type].includes(s))throw Error(`Type ${s} ${t} is not a possible child`);if(e.referencePath===i.referencePath)throw Error(`Self reference in child ${t}`);for(let c of Object.keys(n)){if(c==="ref")continue;let p=he[c];if(p?.[s]?.restrictive)throw Error(`Attr ${c} should be defined on the object itself, not in the relation with its parent.`);let h=fe[c];if(!p&&!h)throw Error(`Undefined attr ${c}`);let d=(h?.[e.type]||p)[s];if(!d){let k=Object.keys(p).join(", ");throw Error(`${s} does not match any of ${k} for attr ${c}`)}if(d.deprecated)throw Error(`attr ${c} deprecated: ${d.deprecated}`)}},"assertRelation"),Rr=r(e=>{for(let[t,n]of Object.entries(e.attrs))try{let i=fe[t]?.[e.parent?.type]?.[e.type]||he[t][e.type];if(n?.type==="function"){if(!i.functionsByName?.[n.name])throw Error(`function ${n.name} not found for attr ${t}`)}else if(!i.check(n,e))throw Error(`wrong type for attr ${t}`)}catch(i){throw i.parentRef=e.parent?.referencePath,i.childRef=e.referencePath,i.value=n,i.key=t,i}for(let t of Object.values(e.children))Rr(t)},"checkAttrs"),Si=r(e=>e.type==="exam","isExam"),Ai=r(e=>{let t={};for(let n of e.filter(Si)){let i=0;for(let[s,l]of Object.entries(n.children))try{let{group:c}=l;if(!c)throw Error("missing exam group");let p=c-i;if(i=c,p>1)throw Error("exam must not have gaps in groups");if(p<0)throw Error("exercise must be sorted by group from lower to greater");let h=t[s];if(h==null)t[s]=c;else if(h!==c)throw Error("Exercise used in different exam groups")}catch(c){throw c.exam=n.referencePath,c.exercise=l.ref.referencePath,c}}},"assertExams"),Mr=r(async e=>{let t={},n=r(async([l,c])=>{let p;try{let d=t[l];if(p=await(d||(t[l]=e(l))),c&&(c.ref=p),d)return[]}catch(d){throw d.name=l,d}try{Ei(p)}catch(d){throw d.type=p.type,d.referencePath=p.referencePath,d}let h=Object.entries(p.children||{}).map(n);try{return[p,...(await Promise.all(h)).flat()]}catch(d){throw l&&(d.parents||(d.parents=[])).push(l),d}},"getDefs"),i=await n([]);for(let l of i)if(l.children)try{for(let c of Object.entries(l.children))qi(l,c[0],c[1])}catch(c){throw c.type=l.type,c.referencePath=l.referencePath,c}let s=Ir(i[0]);return Rr(s),Ai(i),{definitions:i,root:s}},"checkAndBuildDefinitions");var Or=["module","piscine","signup","onboarding"],Di=r(e=>e.type.endsWith("_audit"),"isAudit"),Ii=r(async e=>{let t=e==null?"content/def.json":`content/${e}/def.json`,n=JSON.parse(await Ci(t,"utf8"));if(n.attrs||(n.attrs={}),n.referencePath=t,e==null&&!Or.includes(n.type))throw Error(`Root definition must be one of ${Or.join(", ")}, found: ${n.type}`);switch(n.type){case"project":case"raid":{let i=(n.attrs.validations||[]).find(Di);if(!i)throw Error("project and raid must have an audit validation specified");if(i.form)throw Error("audit form attribute is automatically set to be ./audit/README.md, do not specify it");i.form=`content/${e}/audit/README.md`,await $r(i.form)}case"exercise":{if(n.attrs.subject)throw Error("subject attribute is automatically set to be ./README.md, do not specify it");n.attrs.subject=`content/${e}/README.md`,await $r(n.attrs.subject)}}return n},"readDef"),kt=r(async()=>{try{return await Mr(Ii)}catch({message:e,stack:t,...n}){console.error(e),console.error(n)}},"runChecks");if(process.argv.includes("--watch")||process.argv.includes("-w")){await kt();for await(let e of ji(".",{recursive:!0}))console.clear(),e.filename.endsWith("def.json")&&(console.log(e.eventType,"on",e.filename,`
3
+ `),await kt())}else await kt()||process.exit(1);console.log("All checks passed, no errors");
@@ -0,0 +1 @@
1
+ import{a as s}from"./chunk-EI7MMDWY.js";var C=s((e,t)=>typeof e=="object"&&Object.keys(e)[0]===t,"isCoreObj"),f=s((e,t)=>typeof e=="object"&&Object.values(e)[0].some(n=>n===t),"isSatteliteObj"),p=s((e,t)=>{let{key:n,parent:c}=e,a=t||Object.values(c.children),i=c.attrs.graph.innerCircle.find(r=>r.type==="slice"&&r.innerArc.contents.find(u=>C(u,n)));if(!i)return[];let l=i.innerArc.contents.find(r=>C(r,n)),o=new Set(...Object.values(l));return a.filter(r=>o.has(r.key))},"getCoreSattelites"),y=s((e,t)=>{let{key:n,parent:c}=e,a=t||Object.values(c.children),i=c.attrs.graph?.innerCircle?.find(o=>o.type==="slice"&&o.innerArc?.contents.find(r=>f(r,n)));if(!i)return;let l=i.innerArc.contents.find(o=>f(o,n));return a.filter(o=>o.key===Object.keys(l)[0])},"getCoreOfSattelite"),b=s(e=>[...e.centralPoint?[e.centralPoint]:[],...(e.innerCircle||[]).flatMap(t=>t.type==="slice"?[...t.entryPoint?[t.entryPoint]:[],...(t.innerArc?.contents||[]).flatMap(n=>typeof n=="string"?n:Object.entries(n)[0].flat()),...(t.outerArcs||[]).flatMap(n=>n.contents||[])]:t.contents),...(e.middleCircle||[]).flatMap(t=>t.contents||[]),...(e.outerCircle||[]).flatMap(t=>t.contents||[])],"flatGraphContents"),j=s(e=>[...(e.innerCircle||[]).flatMap(t=>t.type==="slice"?[...t.entryPoint?[t.entryPoint]:[],...(t.innerArc?.contents||[]).flatMap(n=>typeof n=="string"?n:Object.keys(n)[0]),...(t.outerArcs||[]).flatMap(n=>n.contents||[])]:t.contents),...(e.middleCircle||[]).flatMap(t=>t.contents||[]),...(e.outerCircle||[]).flatMap(t=>t.contents||[])],"flatAtomeAndCoreContents"),m={LINE:{maxLinesCount:6,maxContentsCount:7},SLICE:{maxSlicesCount:4,innerCircle:{maxSubContentsCount:5,maxContentsCount:30},outerArc:{maxArcsCount:2,maxContentsCount:10}},MIDDLE_CIRCLE:{maxArcsCount:8,maxContentsCount:70},OUTER_CIRCLE:{maxArcsCount:9,maxContentsCount:90}};export{p as a,y as b,b as c,j as d,m as e};
@@ -0,0 +1 @@
1
+ import{a}from"./chunk-EI7MMDWY.js";var r={prog:{name:"Elementary programming",description:"Basics of computer programming",type:"technical",abbreviation:"prog-1"},"intermediate-prog":{name:"Intermediate programming",description:"Intermediate notions of computer programming",type:"technical",abbreviation:"prog-2"},"advanced-prog":{name:"Advanced programming",description:"Advanced notions of computer programming",type:"technical",abbreviation:"prog-3"},algo:{name:"Elementary algorithms",description:"Problem-solving, algorithm design",type:"technical"},"sys-admin":{name:"System administration",description:"System administration, dev ops",type:"technical",abbreviation:"devops"},"front-end":{name:"Front-end",description:"Front-end technologies",type:"technical",abbreviation:"front"},"back-end":{name:"Back-end",description:"Back-end technologies",type:"technical",abbreviation:"back"},stats:{name:"Statistics",description:"Data analysis, interpretation",type:"technical"},ai:{name:"AI",description:"Artificial intelligence, machine learning",type:"technical"},game:{name:"Game programming",description:"Game programming",type:"technical"},blockchain:{name:"Blockchain",description:"Blockchain",type:"technical",abbreviation:"BC"},mobile:{name:"Mobile development",description:"Mobile development",type:"technical"},tcp:{name:"TCP/IP",description:"TCP/IP",type:"technical"},cybersecurity:{name:"Cybersecurity",description:"Cybersecurity",type:"technical",abbreviation:"cyber"},ux:{name:"UX/UI",description:"User experience design, user interface design",type:"technical"},cloud:{name:"Cloud",description:"Cloud infra, deployment and scaling",type:"technical"},automation:{name:"Automation",description:"Automate tasks to reduce repetitive tasks and minimize potential errors",type:"technical",abbreviation:"autom."},ci:{name:"CI/CD",description:"Set up CI/CD pipelines to maintain a consistent software release process",type:"technical"},testing:{name:"Testing",description:"TDD and other software testing strategies",type:"technical",abbreviation:"tests"},"curriculum-objectives-completed":{name:"Curriculum objectives completed",description:"Curriculum objectives completed to unlock the specialization branches",type:"technical",abbreviation:"credits"},go:{name:"Go",type:"technology"},js:{name:"JS",type:"technology"},rust:{name:"Rust",type:"technology"},java:{name:"Java",type:"technology"},html:{name:"HTML",type:"technology"},css:{name:"CSS",type:"technology"},unix:{name:"Unix",type:"technology"},docker:{name:"Docker",type:"technology"},sql:{name:"SQL",type:"technology"},"no-sql":{name:"Non-relational Databases",type:"technology"},c:{name:"C",type:"technology"},sh:{name:"Shell",type:"technology"},php:{name:"PHP",type:"technology"},python:{name:"Python",type:"technology"},ruby:{name:"Ruby",type:"technology"},"c-sharp":{name:"C#",type:"technology",abbreviation:"C#"},"c-pp":{name:"C++",type:"technology",abbreviation:"C++"},graphql:{name:"GraphQL",type:"technology",abbreviation:"GQL"},rails:{name:"Ruby on Rails",type:"technology"},laravel:{name:"Laravel",type:"technology"},django:{name:"Django",type:"technology"},react:{name:"React",type:"technology"},dotnet:{name:".NET",type:"technology"},electron:{name:"Electron",type:"technology",abbreviation:"elect."},git:{name:"Git",type:"technology"},employability:{name:"Employability",type:"employability",abbreviation:"jobSkills"},"personal-development":{name:"Personal Development",description:"Focuses on self-awareness, self-management, communication, and core values to build a strong personal foundation for growth and autonomy.",type:"lifeskills",abbreviation:"PDev"},"relational-development":{name:"Relational Development",description:"Develops the ability to connect with others through assertiveness, empathy, and resilience, enabling healthy collaboration and conflict management.",type:"lifeskills",abbreviation:"RelDev"},"professional-development":{name:"Professional Development",description:"Strengthens strategic thinking, leadership, and professional presence to drive impact, solve complex problems, and succeed in professional environments.",type:"lifeskills",abbreviation:"ProDev"}},c=[{tier:"Beginner",name:"Code Explorer",maxValue:25},{tier:"Intermediate",name:"Bug Squasher",maxValue:50},{tier:"Advanced",name:"Script Wizard",maxValue:75},{tier:"Master",name:"Master Hacker",maxValue:100}],l=[{type:"technical",name:"Technical skills",description:"Technical skills are based on notions that are taught during the curriculum ; they represent what you learned from a project. They can be acquired when completing piscines, projects & exams."},{type:"technology",name:"Technologies",description:"Technologies gather the different programming languages, frameworks and platforms acquired from projects & piscines."},{type:"employability",name:"Employability",description:"Develops professional readiness through personal branding, digital presence, and job search strategies\u2014including portfolio building, CV writing, and effective networking."},{type:"lifeskills",name:"Life Skills",description:"Builds essential personal, relational, and professional competencies through structured learning and practical activities, strengthening communication, collaboration, resilience, and leadership."}],s=a((n,e)=>Object.entries(n||{}).every(([t,i])=>(e?.[t]||0)>=i),"hasRequiredSkills"),o=a((n,e={})=>{if(n?.attrs?.baseSkills)for(let[t,i]of Object.entries(n.attrs.baseSkills))(!e[t]||i>e[t])&&(e[t]=i);if(n.children)for(let t of Object.values(n.children))o(t,e);return e},"extractHighestSkills");export{r as a,c as b,l as c,s as d,o as e};
@@ -0,0 +1 @@
1
+ import{a as c}from"./chunk-EI7MMDWY.js";var s={memory:{maxLevel:22,minRatio:1,freeAttempts:1e3,maxAttempts:1e3,shouldFailUnderScore:30,shouldFailUnderLevel:7,shouldSucceedFromScore:60,shouldSucceedFromLevel:15},zzle:{maxLevel:18,minRatio:1,freeAttempts:1e3,maxAttempts:1e3,shouldFailUnderScore:20,shouldFailUnderLevel:3,shouldSucceedFromScore:50,shouldSucceedFromLevel:10}};for(let e of Object.values(s))e.levels=[...Array(e.maxLevel+50).keys()].map(o=>({maxScore:((o+1)/15+1)*5})),e.maxScore=e.levels.slice(0,e.maxLevel).reduce((o,t)=>o+t.maxScore,0);var a=c((e,o,t,r)=>{let l=1-t,n=o-(e-r);return e<=r||t===1?1:n<1?t:n/o*l+t},"projectValue"),m=c((e,o)=>{let{minRatio:t,freeAttempts:r,maxAttempts:l}=s[e];return a(o,l,t,r)},"getLevelRatio"),u=c((e,o,t)=>(t/15+1)*5*m(e,o),"getLevelScore"),p=c((e,o)=>s[o].levels[e].maxScore,"getLevelMaxPoints"),S=c((e,o)=>o.map((t,r)=>u(e,t.attempts,r+1)).reduce((t,r)=>t+r,0),"getLevelsScore"),d=c((e,o,t)=>{let l=S(e,t)/s[e].maxScore;return{ratio:l,percent:l*100,points:o*l}},"getGameScores"),v=c(e=>e.map(t=>d(t.name,t.points,t.results).percent).reduce((t,r)=>t+r,0)/e.length,"getGlobalScore");export{s as a,u as b,p as c,S as d,d as e,v as f};
@@ -0,0 +1 @@
1
+ var c=Object.defineProperty;var d=(a,b)=>c(a,"name",{value:b,configurable:!0});export{d as a};
@@ -0,0 +1 @@
1
+ import{a as n}from"./chunk-EI7MMDWY.js";var u=n((r,t)=>{if(c(r))throw new Error("'relativePath' must be a relative path");if(r[r.length-1]==="/"&&(r=r.slice(0,-1)),!c(t))throw Error("the currentPath has to be an absolute path");let o=t.split("/"),s=r.split("/");for(let e of s)if(e==="..")if(o.length>0)o.pop();else throw Error(`Incorrect relative path = ${r}, current path = ${t}`);else e!=="."&&o.push(e);return o.join("/")},"getAbsolutePath"),h=n((r,t)=>{if(r)return t==="."?r:t===".."?r.parent:r.children[t]},"walk"),f=n((r,t,o={throwError:!0})=>{let s=t.path;if(c(r)){if(o.throwError)throw Error("'relativePath' must be a relative path");console.error("'relativePath' must be a relative path");return}r[r.length-1]==="/"&&(r=r.slice(0,-1));let e=r.split("/").reduce(h,t);if(e)return e;let i=`Incorrect relative path '${r}': no object found \u2014 current path = '${s}'`;if(o.throwError)throw Error(i);console.error(i)},"getObjectFromRelativePath"),c=n(r=>r.startsWith("/"),"isAbsolutePath");export{u as a,f as b};
@@ -0,0 +1 @@
1
+ import{p as x}from"./chunk-V47RDOUO.js";import{a as n}from"./chunk-EI7MMDWY.js";var L={13:({save:t,value:e,event:r,allowLineBreak:o})=>r.shiftKey||o?!1:t(e),27:({set:t,originalValue:e})=>t(e),83:({save:t,value:e,event:r})=>r.metaKey||r.ctrlKey?t(e):!1},nt=n(t=>{let e=L[t.event.keyCode];e&&e(t)!==!1&&t.event.preventDefault()},"handleKeyDownEvent"),ot=n(t=>t[t.length-1],"last"),P=n(t=>t?t[0].toUpperCase()+t.slice(1):"","upperFirst"),st=n((t,e,r)=>t.map(o=>o===e?r(o):o),"replaceMap"),i=1e3,l=60*i,p=60*l,f=24*p,$=7*f,m=365*f,Z=Object.entries({year:m,month:2628e6,day:f,hour:p,minute:l,second:i}),_={years:m,year:m,yrs:m,yr:m,y:m,weeks:$,week:$,w:$,days:f,day:f,d:f,hours:p,hour:p,hrs:p,hr:p,h:p,minutes:l,minute:l,mins:l,min:l,m:l,seconds:i,second:i,secs:i,sec:i,s:i,milliseconds:1,millisecond:1,ms:1},W=new Intl.RelativeTimeFormat("en",{style:"narrow"}),at=n(t=>{for(let[e,r]of Z)if(Math.abs(t)>r||e==="second")return W.format(Math.round(t/r),e)},"relativeTime"),S=n(t=>t.toString().padStart(2,"0"),"padStart0"),ct=n(t=>{if(typeof t!="string")return 0;t=t.toLowerCase();let e=/(?<value>[0-9.-]+) *(?<type>[a-z]+)/g,r,o=0;for(;r=e.exec(t);){let{type:s,value:a}=r.groups,c=_[s];Number(a)&&c&&(o+=a*c)}return Math.round(o)},"timeToMS"),it=n((t,{hoursOnly:e}={})=>{let r=!e&&Math.floor(t/86400),o=Math.floor((e?t:t%86400)/3600),s=Math.floor(t%3600/60),a=Math.floor(t%60),c=`${S(o)}:${S(s)}:${S(a)}`;return r?`${r}d ${c}`:c},"formatedDurationColons"),ut=n(t=>w(Math.round(t/i)),"formatedMS"),D=[{label:"y",fullLabel:"year",size:31536e3},{label:"w",fullLabel:"week",size:604800},{label:"d",fullLabel:"day",size:86400},{label:"h",fullLabel:"hour",size:3600},{label:"m",fullLabel:"minute",size:60},{label:"s",fullLabel:"second",size:1}],w=n((t,{noSeconds:e,stopFirst:r,useFullLabel:o,stopLabel:s}={})=>{let a=[];if(s&&t<D.find(c=>c.fullLabel===s)?.size)return`less than 1${o?` ${s}`:D.find(c=>c.fullLabel===s).label}`;for(let{label:c,size:u,fullLabel:y}of D){let h=Math.floor(t/u);if(h!==0){if(a.push(`${h}${o?` ${y}`:c}${h>1&&o?"s":""}`),r)return a;t-=h*u}if(y===s)return a.join(" ")||(e?"0m":"0s")}return!e&&t!==0&&a.push(`${t}s`),a.join(" ")||(e?"0m":"0s")},"formatedDuration"),lt=n((t,e=Date.now())=>{if(!t)return null;let r=d(t)-d(e);return w(Math.floor(Math.abs(r)/1e3),{stopFirst:!0,useFullLabel:!0})},"timeDiff"),d=n(t=>t instanceof Date?t:new Date(t),"toDate"),M=n((t,e=!0)=>{if(g(t))return"\u221E";let r=d(t),o=(r.getMonth()+1).toString().padStart(2,"0"),s=r.getDate().toString().padStart(2,"0");return e?`${r.getFullYear()}-${o}-${s}`:`${s}/${o}/${r.getFullYear()}`},"toDateFormat"),pt=n(t=>d(t).toISOString(),"toISOStringWithTimeZone"),Y=n((t,e="T")=>{let r=d(t),o=String(r.getHours()).padStart(2,"0"),s=String(r.getMinutes()).padStart(2,"0");return`${M(r)}${e}${o}:${s}`},"toDateFormatWithTime"),mt=n((t,e="T")=>{let r=d(t),o=String(r.getHours()).padStart(2,"0"),s=String(r.getMinutes()).padStart(2,"0"),a=(r.getMonth()+1).toString().padStart(2,"0"),c=r.getDate().toString().padStart(2,"0");return`${r.getFullYear()}-${a}-${c}${e}${o}:${s}`},"toPermanentDateFormatWithTime"),ft=n(t=>Y(t," | "),"displayDateTime"),dt=n(t=>b[t],"getMonthName"),J=n(t=>U[t],"getDayName"),b=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],U=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],N=n(t=>t===0||t===12?12:t%12,"hour"),C=n(t=>String(t).padStart(2,"0"),"minPad"),A=n(t=>t===0?"am":t===12?"pm":t<12?"am":"pm","suffix"),g=n(t=>(t instanceof Date&&!Number.isNaN(t.valueOf())?t:new Date(t)).valueOf()>325036836e5,"dateIsPermanent"),T=n(t=>{let e=new Date(t),r=e.getDay(),o=e.getDate(),s=e.getMonth(),a=e.getFullYear(),c=e.getHours(),u=e.getMinutes();return{day:r,jj:o,mm:s,yyyy:a,hh:c,min:u}},"getDateElems"),ht=n((t,e="at")=>{if(!t)return"-";if(g(t))return"\u221E";let{jj:r,mm:o,yyyy:s,hh:a,min:c}=T(t);return`${b[o]} ${r}, ${s} ${e} ${N(a)}:${C(c)} ${A(a)}`},"formatedDateTime"),yt=n(t=>{if(!t)return"-";if(g(t))return"\u221E";let{day:e,jj:r,mm:o,yyyy:s,hh:a,min:c}=T(t);return`${J(e)}, ${b[o]} ${r}, ${s} at ${N(a)}:${C(c)} ${A(a)}`},"formatedDateTimeWithDay"),xt=n(t=>t?g(t)?"\u221E":M(t):"-","formatedDate"),gt=n(()=>{let t={};return t.done=new Promise((e,r)=>{t.resolve=e,t.reject=r}),t},"defer"),$t=n(t=>t.normalize("NFKD").replace(/\p{M}+/gu,"").toLowerCase().replace(/\s+/g," ").replace(/[^a-z0-9._ ]+/g,"").trim().replaceAll(" ","-"),"slugify"),St=n(({firstName:t,lastName:e})=>`${t||""} ${e||""}`,"fullName"),Dt=n(t=>new Date(t).toISOString().substr(11,8).replace(/^[0:]+/,""),"formatTime"),bt=n(t=>new Promise(e=>setTimeout(e,t)),"wait"),B=n(t=>t[0].toLowerCase()+t.slice(1),"lowertalize"),H=n((t,e)=>e.toUpperCase(),"upperFirstMatch"),j=n(t=>B(t.trim().toLowerCase().replace(/[ _-]+(.?)/g,H)),"toCamelCase"),wt=n(t=>/[ _-]+(.?)/g.test(t),"isNotCamel"),R=n((t,e,r)=>`${e}_${r}`,"underscoreJoin"),O=n(t=>t.trim().replace(/(.)([A-Z])/g,R).toLowerCase(),"toSnakeCase"),Mt=n(t=>t.match(/[A-Z](?=[A-Z][a-z]+[0-9]*[a-z]|\b)|[A-Z]?[a-z]+[0-9]+[a-z]?[A-Z]*|[A-Z]?[a-z]+[0-9]*|[A-Z]|[0-9]+/g).map(e=>e.toLowerCase()).join("-"),"toKebabCase"),q=n((t,e,r)=>`${e} ${r}`,"spaceJoin"),V=n(t=>t.trim().replace(/(.)([A-Z])/g,q).toLowerCase(),"breath"),Nt=n(t=>P(V(t)),"prettyKey"),z=n((t,e,r)=>I(t,([o,s])=>[e(o),r(s)]),"switchKeys"),G=n(t=>z(t,j,v),"toCamelKeys"),Q=n(t=>z(t,O,E),"toSnakeKeys"),F=n((t,e,r,o)=>!t||typeof t!="object"?t:Array.isArray(t)?t.map(o):r(t,e,o),"switchAll"),v=n(t=>F(t,j,G,v),"toCamelAll"),E=n(t=>F(t,O,Q,E),"toSnakeAll"),Ct=n((t,e=0)=>[...Array(t+e).keys()].slice(e),"arrayOf"),X=n(t=>t[t.length-1]==="/"?X(t.slice(0,-1)):t,"trimSlashEnd"),I=n((t,e)=>Object.fromEntries(Object.entries(t).map(e)),"mapEntries"),At=n((t,e)=>I(t,([r,o])=>[r,e(o,r,t)]),"mapValues"),k=n((t,e)=>Object.fromEntries(Object.entries(t).filter(e)),"filterEntries"),Tt=n((t,e)=>k(t,([r,o])=>[r,e(o,r,t)]),"filterValues"),tt=n((t,e)=>k(t,([r,o])=>!K(o,e[r])),"getChanges"),jt=n((t,e)=>Object.keys(tt(t,e)).length!==0,"hasChanged"),Ot=n(t=>{let e=[...t],r=e.length,o,s;for(;--r>0;)o=Math.floor(Math.random()*(r+1)),s=e[o],e[o]=e[r],e[r]=s;return e},"shuffle"),zt=n((t,e)=>t&&Object.values(t).find(r=>r.type===e),"getChildByType"),Ft=n(t=>{if(!t)return"-";if(t.attrs?.name)return t.attrs.name;let e=t.firstName||"-",r=t.lastName||"-";return`${e} ${r}`},"getUserName"),K=n((t,e)=>{if(t===e)return!0;if(typeof t!=typeof e)return!1;if(typeof t=="number"&&Number.isNaN(t)&&Number.isNaN(e))return!0;if(typeof t=="object"){if(!t||!e||t.constructor!==e.constructor)return!1;let r=Object.entries(t);if(r.length!==Object.values(e).length)return!1;for(let[o,s]of r)if(!K(e[o],s))return!1;return!0}return!1},"eq"),vt=n(t=>{if(!(!t||!t.isDone))return t.succeeded?"succeeded":"failed"},"getStatus"),et=n(t=>!t.type.canAccessPlatform&&(new Date(t.endAt)>Date.now()||t.type.isPermanent||!t.endAt)&&x(t.startAt),"isAccessBlocked"),Et=n(t=>{let r=t?.records?.find(et);if(!r)return;let o=Error("Banned");return o.record=r,o},"isBanned"),It=n(()=>Math.random().toString(36).slice(2,7).padEnd(5,"#").replace(/0/gi,"_").replace(/o/gi,"-").replace(/I/gi,"?").replace(/l/gi,"$"),"generateCode"),kt=n(t=>{let r=new TextEncoder().encode(t);return btoa(String.fromCharCode.apply(null,r))},"base64Encode"),Kt=n((t,e)=>new Date(new Date(t).getTime()+e).toISOString(),"timePlusDelay"),Lt=n(t=>x(t?.startAt)?t?.endAt&&x(t?.endAt)?"finished":t?.type.isPermanent?"permanent":t?.endAt?"in progress":"unblock required":"starting soon","getRecordStatus"),Pt=n(t=>t.reduce((e,r)=>(e[r]=(e[r]||0)+1,e),{}),"createFrequencyMap"),Zt=n(t=>{if(!t)return 0;let e=/(?:(\d+)\s+years?)?\s*(?:(\d+)\s+mons?)?\s*(?:(\d+)\s+days?)?\s*(?:(\d+):(\d+):([\d.]+))?/,r=t.match(e);if(!r)return 0;let o=Number.parseInt(r[1]||0,10),s=Number.parseInt(r[2]||0,10),a=Number.parseInt(r[3]||0,10),c=Number.parseInt(r[4]||0,10),u=Number.parseInt(r[5]||0,10),y=Number.parseFloat(r[6]||0);return o*365*24*60*60*1e3+s*30*24*60*60*1e3+a*24*60*60*1e3+c*60*60*1e3+u*60*1e3+y*1e3},"postgresIntervalToMS");export{nt as a,ot as b,P as c,st as d,i as e,l as f,p as g,f as h,$ as i,m as j,_ as k,at as l,S as m,ct as n,it as o,ut as p,D as q,w as r,lt as s,M as t,pt as u,Y as v,mt as w,ft as x,dt as y,J as z,b as A,U as B,g as C,ht as D,yt as E,xt as F,gt as G,$t as H,St as I,Dt as J,bt as K,j as L,wt as M,Mt as N,V as O,Nt as P,G as Q,Q as R,v as S,E as T,Ct as U,X as V,I as W,At as X,k as Y,Tt as Z,tt as _,jt as $,Ot as aa,zt as ba,Ft as ca,K as da,vt as ea,Et as fa,It as ga,kt as ha,Kt as ia,Lt as ja,Pt as ka,Zt as la};