// Schémas supplémentaires insérés dans le CM + termes à surligner
(function () {
var K = 'stroke="#000" stroke-width="3"', F = 'font-family="Archivo,sans-serif" font-weight="800"', M = 'font-family="IBM Plex Mono,monospace" font-weight="600"';
var b = function (x, y, w, h, fill, t, fs, col) { return '' + t + ''; };
var a = function (x1, y1, x2, y2) { return ''; };
var t = function (x, y, s, fs, mono) { return '' + s + ''; };
var S = function (w, h, body) { return ''; };
var Y = '#FFD23F', G = '#7CF2C0', P = '#FF6FB5', L = '#C4B5FD', N = '#F6F5F1', W = '#fff', D = '#13233A';
window.CONTENUS_SCHEMAS = Object.assign(window.CONTENUS_SCHEMAS || {}, {
binaire: { termes: ['bit', 'octet', 'quartet', 'poids fort', 'complément à deux', 'hexadécimal', 'base 2', 'base 16', '0x', 'Kio', 'ko'], figs: [
[3, 'Divisions successives : 45 en binaire', S(720, 250, [45, 22, 11, 5, 2, 1].map(function (n, i) { return b(20, 10 + i * 38, 140, 32, N, n + ' ÷ 2', 14) + b(180, 10 + i * 38, 60, 32, Y, n % 2, 16); }).join('') + a(280, 210, 280, 20) + t(300, 120, 'lecture de bas en haut', 16) + b(300, 140, 220, 50, G, '101101₂', 22))],
[4, 'Regrouper par 4 bits pour passer en hexadécimal', S(720, 170, b(20, 20, 150, 50, Y, '1011', 22) + b(180, 20, 150, 50, L, '0010', 22) + a(95, 70, 95, 105) + a(255, 70, 255, 105) + b(20, 110, 150, 45, W, 'B', 22) + b(180, 110, 150, 45, W, '2', 22) + t(380, 90, '1011 0010₂ = 0xB2 = 178', 20, 1))],
[6, 'Complément à deux : coder −5 sur 8 bits', S(720, 200, b(20, 20, 300, 44, W, '+5 = 0000 0101', 17) + a(170, 64, 170, 84) + b(20, 86, 300, 44, Y, 'inverser : 1111 1010', 17) + a(170, 130, 170, 150) + b(20, 152, 300, 44, P, '+1 : 1111 1011 = −5', 17) + t(360, 60, 'Plage sur 8 bits signés :', 16) + b(360, 80, 340, 50, G, '−128 … +127', 22))] ] },
terminal: { termes: ['pwd', 'ls -la', 'ls -l', 'cd ..', 'cd', 'mkdir -p', 'touch', 'cp -r', 'mv', 'rm -rf', 'rm', 'man', 'find', 'locate', 'echo $HOME', 'echo $PATH', '$HOME', '$PATH', '$USER', 'history', 'Ctrl+C', 'Ctrl+R', 'Tab', 'sudo', '/etc', '/home', '/var/log', '/tmp', '~'], figs: [
[0, 'Lire l’invite du shell', S(720, 170, b(20, 50, 110, 50, Y, 'eleve', 18) + b(130, 50, 40, 50, W, '@', 18) + b(170, 50, 120, 50, G, 'debian', 18) + b(290, 50, 30, 50, W, ':', 18) + b(320, 50, 60, 50, L, '~', 20) + b(380, 50, 50, 50, P, '$', 20) + t(20, 35, 'utilisateur', 13) + t(170, 35, 'machine', 13) + t(320, 35, 'dossier', 13) + t(380, 130, '$ = utilisateur · # = root', 15))],
[2, 'Chemin absolu et chemin relatif', S(720, 180, b(20, 20, 330, 44, Y, '/home/eleve/projets/web', 15) + t(20, 90, 'absolu : part toujours de /', 15) + b(380, 20, 320, 44, G, 'projets/web', 15) + t(380, 90, 'relatif : part du dossier courant', 15) + b(20, 120, 200, 40, N, '. = ici', 15) + b(240, 120, 200, 40, N, '.. = parent', 15) + b(460, 120, 240, 40, N, '~ = /home/eleve', 15))],
[4, 'Les 4 gestes sur les fichiers', S(720, 130, [['mkdir', Y, 'créer'], ['cp', G, 'copier'], ['mv', L, 'déplacer'], ['rm', P, 'supprimer']].map(function (c, i) { return b(20 + i * 175, 20, 160, 50, c[1], c[0], 20) + t(40 + i * 175, 100, c[2], 15); }).join(''))] ] },
droits: { termes: ['chmod', 'chown', 'umask', 'usermod -aG', 'adduser', 'sudo', 'visudo', 'SUID', 'SGID', 'sticky bit', 'setfacl', 'getfacl', '/etc/passwd', '/etc/shadow', '/etc/group', 'rwx', '777', '750', '644', 'moindre privilège'], figs: [
[2, 'Calculer un droit octal : r = 4, w = 2, x = 1', S(720, 170, b(20, 20, 80, 50, Y, 'r 4', 18) + t(110, 52, '+', 22) + b(130, 20, 80, 50, Y, 'w 2', 18) + t(220, 52, '+', 22) + b(240, 20, 80, 50, Y, 'x 1', 18) + t(330, 52, '=', 22) + b(360, 20, 80, 50, G, '7', 24) + b(20, 100, 80, 50, Y, 'r 4', 18) + t(110, 132, '+', 22) + b(130, 100, 80, 50, N, '– 0', 18) + t(220, 132, '+', 22) + b(240, 100, 80, 50, Y, 'x 1', 18) + t(330, 132, '=', 22) + b(360, 100, 80, 50, G, '5', 24) + t(480, 95, 'rwxr-x--- = 750', 20, 1))],
[4, 'Les trois droits spéciaux', S(720, 150, [['SUID 4', Y, 'droits du propriétaire'], ['SGID 2', G, 'hérite du groupe'], ['Sticky 1', P, 'chacun ses fichiers']].map(function (c, i) { return b(20 + i * 235, 20, 215, 55, c[1], c[0], 20) + t(30 + i * 235, 110, c[2], 15); }).join(''))] ] },
tubes: { termes: ['stdin', 'stdout', 'stderr', '2>', '>>', '&>', '/dev/null', 'grep', 'grep -E', 'grep -c', 'cut', 'sort', 'uniq -c', 'wc -l', 'head', 'tail -f', 'awk', 'sed', '|', '$( )', 'cron'], figs: [
[0, 'Les trois flux d’un processus', S(720, 180, b(260, 60, 200, 60, D, 'processus', 18, '#fff') + b(20, 70, 160, 40, Y, '0 · stdin', 15) + a(180, 90, 258, 90) + a(460, 75, 538, 45) + b(540, 20, 160, 40, G, '1 · stdout', 15) + a(460, 105, 538, 135) + b(540, 120, 160, 40, P, '2 · stderr', 15))],
[1, 'Écraser ou ajouter', S(720, 150, b(20, 20, 200, 50, Y, 'cmd > f', 18) + t(240, 52, 'f est vidé puis rempli', 15) + b(20, 85, 200, 50, G, 'cmd >> f', 18) + t(240, 117, 'la sortie s’ajoute à la fin de f', 15))] ] },
osi: { termes: ['TCP', 'UDP', 'IP', 'ICMP', 'ARP', 'MAC', 'Ethernet', 'HTTP', 'HTTPS', 'DNS', 'TLS', 'port', 'segment', 'paquet', 'trame', 'switch', 'routeur', 'SYN', 'ACK', 'ping', 'ip addr', 'ip link', 'ip neigh', 'ss -tlnp', 'tcpdump'], figs: [
[3, 'Encapsulation : chaque couche ajoute son en-tête', S(720, 230, b(470, 10, 230, 40, P, 'Données HTTP', 15) + b(360, 60, 110, 40, L, 'TCP', 15) + b(470, 60, 230, 40, P, 'Données', 15) + b(250, 110, 110, 40, G, 'IP', 15) + b(360, 110, 340, 40, L, 'segment', 15) + b(140, 160, 110, 40, Y, 'Ethernet', 15) + b(250, 160, 450, 40, G, 'paquet', 15) + t(20, 35, 'Application', 13) + t(20, 85, 'Transport', 13) + t(20, 135, 'Réseau', 13) + t(20, 185, 'Liaison', 13))],
[6, 'La poignée de main TCP', S(720, 230, b(20, 20, 150, 44, Y, 'Client', 17) + b(550, 20, 150, 44, G, 'Serveur', 17) + '' + a(95, 95, 622, 115) + t(330, 95, 'SYN', 16, 1) + a(625, 145, 98, 165) + t(310, 145, 'SYN-ACK', 16, 1) + a(95, 195, 622, 215) + t(330, 195, 'ACK', 16, 1))],
[7, 'ARP : qui a 192.168.10.1 ?', S(720, 170, b(20, 60, 160, 50, Y, 'Poste', 17) + a(180, 75, 538, 75) + t(220, 65, 'broadcast : qui a .10.1 ?', 14, 1) + b(540, 60, 160, 50, G, 'Passerelle', 17) + a(540, 100, 182, 100) + t(220, 130, 'réponse : 3c:52:82:1a:0f:9b', 14, 1))] ] },
sql: { termes: ['SELECT', 'FROM', 'WHERE', 'ORDER BY', 'GROUP BY', 'HAVING', 'JOIN', 'LEFT JOIN', 'INNER JOIN', 'INSERT INTO', 'UPDATE', 'DELETE', 'COUNT', 'AVG', 'LIMIT', 'DISTINCT', 'clé primaire', 'clé étrangère', 'BEGIN', 'COMMIT', 'ROLLBACK', 'EXPLAIN', 'index', 'requête préparée'], figs: [
[4, 'INNER JOIN et LEFT JOIN', S(720, 200, '' + t(60, 190, 'LEFT JOIN : toute la gauche', 14) + '' + t(420, 190, 'INNER JOIN : l’intersection', 14))],
[3, 'Ordre logique d’exécution d’une requête', S(720, 110, ['FROM', 'WHERE', 'GROUP BY', 'HAVING', 'SELECT', 'ORDER BY'].map(function (c, i) { return b(10 + i * 118, 30, 104, 44, [Y, Y, G, G, L, P][i], c, 14) + (i < 5 ? a(114 + i * 118, 52, 126 + i * 118, 52) : ''); }).join(''))] ] },
python: { termes: ['print', 'input', 'int', 'float', 'str', 'bool', 'list', 'dict', 'if', 'elif', 'else', 'for', 'while', 'range', 'def', 'return', 'assert', 'try', 'except', 'with open', 'import csv', 'indentation'], figs: [
[3, 'Boucle for : un tour par élément', S(720, 170, [12, 15, 9, 18].map(function (n, i) { return b(20 + i * 90, 20, 80, 50, Y, n, 20); }).join('') + a(200, 80, 200, 110) + b(20, 115, 360, 44, G, 'total += n → 54', 17) + t(420, 55, 'for n in notes:', 18, 1) + t(420, 85, ' total += n', 18, 1))],
[5, 'Une fonction : entrée → traitement → sortie', S(720, 140, b(20, 40, 180, 60, Y, '[10, 20]', 18) + a(200, 70, 258, 70) + b(260, 30, 200, 80, D, 'moyenne()', 18, '#fff') + a(460, 70, 518, 70) + b(520, 40, 180, 60, G, '15.0', 22))] ] },
web: { termes: ['GET', 'POST', 'HTTP', 'HTTPS', '200', '404', '403', '500', '