1995 lines
175 KiB
PHP
1995 lines
175 KiB
PHP
{{-- PL0XION machine-a-tsoins ⧗ — LA MACHINE À TSOINS (lot MACHINE, 25.09.2026 ; RS-7 : « avec tout ça t'as les moyens de faire une
|
||
vraie machine à tsoins »). Forme : docs/cahier/machine-a-tsoins-design.md (le sablier) ; langage : docs/plans/dix-mille-ans-v0.md
|
||
(§1-§6) ; plans : docs/plans/convergence-v0.md C2, C3, C3 bis, C5 ; doc : docs/dev/29-machine-a-tsoins.md « 3. La machine ».
|
||
COMPOSE, NE COPIE RIEN — bions : jOSTemps (le cœur, écrit sans point : px.blade et le layout l'incluent déjà, la route /px l'inclurait
|
||
une 2e fois ; pistes, frames, voir, brancher, poser, appliquer, combiner, dejaVu,
|
||
enregistrer, sceller, generations, budget) · jOSCube4D. (le cube, @include ci-dessous : il voyage dans le bundle) · jOSTsoin.
|
||
(le glyphe-badge ⧗) · jOSSession. (sous le ⏺ du cœur) · jOSApps. (les vues du tiroir, montées vivantes) · jOSGlyphCodec (option).
|
||
VUES :
|
||
⧗ sablier le sablier du temps en SVG : couché si le cadre est large (avant à gauche, après à droite), debout en portrait
|
||
(après en haut, avant en bas, comme l'erion du cahier) ; le cône du passé porte les frames en tranches (densité =
|
||
activité, le passé refroidit vers le bleu) ; le pincement = MAINTENANT, la seule couleur chaude, « certain » ; le cône
|
||
du futur porte les branches et les combinaisons, en éventail ; au-delà, des traits qui fuient = le chaos ; « incertain »
|
||
sous l'avant et l'après. Glisser le plan le long de l'axe = voyager (W) ; toucher une tranche = se poser sur l'instant.
|
||
Le HUBLOT : le ploxion monté vivant à l'instant choisi, dans une PAGE ISOLÉE (voir du cœur : autre royaume JS,
|
||
stockage sous cloche, ses écritures retenues), ⏮ ⏭ (la même page, relue), « ⑂ brancher ici », travailler dans
|
||
la branche (travailler du cœur : la page isolée écrit dans la branche, la page reste sur le réel ; kill-switch
|
||
xb:temps.isole=off → l'ancienne pose de toute la page), appliquer au réel (confirmation), revenir au réel.
|
||
pistes un sablier debout par piste (jOSTsoin.badge), taille = âge + quantité (bébé → jeune → vieux → ultra tsoin) ;
|
||
une piste = son temps à elle ; deux = une barre de portion et 5 petits sabliers « ou » (seq, xor, weave, fold,
|
||
mask) : en choisir un = une branche.
|
||
⑂ branches le graphe du cahier p.9 (fork = les lignes se séparent, appliquée = elles se rejoignent), qui finit en éventail ;
|
||
créer (depuis le sablier), nommer, comparer (deux branches, ou une branche et le réel), masquer (jamais détruire).
|
||
▣ cube 4D jOSCube4D pour un fichier vidéo, la caméra, un clip de la piste media, ou les frames d'une piste rendues en cartes ;
|
||
les vues pellicule · cube · patron · plan · fente · traînée · volume (T2) sont celles du cube.
|
||
◈ générations les générations d'UI (C2) : ⏪ revenir à la précédente en un geste ; garder l'UI actuelle.
|
||
▤ tiroir les autres vues de la machine, montées vivantes À LA DEMANDE par jOSApps.monter (ultimate = composition) : tsoin,
|
||
tsoinmachine, grand-tsoin, tsoinion, tsoinfini, montage, record, timeline, wayback. Ils restent utilisables seuls.
|
||
+ ♫ EXTRAPOLER EN MUSIQUE (docs/dev/30-son-et-flow.md « extrapoler avec du son ») : le bouton ♫ tient le mot tapé ou la piste
|
||
choisie et lance l'extrapolateur rythmique (partials/_extrapolateur_bion, nommé sans point : optionnel) ; le cône du futur montre ses
|
||
propositions en direct (des fils qui s'ouvrent à chaque phrase, le nœud a la forme du cran ○ ▢ △ ⧗, la voix qui sonne en clair, le
|
||
choix armé cerclé ; toucher le futur, espace ou un fil = choisir, le choix tombe au temps fort) ; la PISTE FLOW (les frames « flow »
|
||
de l'état de flow) teinte l'axe du temps, du tetraplexion froid au xerboxion ambre (le flow = être au présent) ; la fenêtre
|
||
♫ mesures gradue l'axe en mesures quand la musique joue ; une frame qui porte sa grille (mus) la montre dans les instruments.
|
||
Au plus un rendu par mesure (≤ 3 par seconde). Kill-switch : xb:machine.xp=off.
|
||
+ ⏺ / ⏹ (enregistrer / sceller du cœur) avec chronomètre et minuteur (arrêt automatique) ; « ⧗ déjà-vu ×n » discret ; la
|
||
BOUSSOLE-TESSERACT (16 sommets, 32 arêtes, un sablier au centre, les 6 plans en degrés exacts) qui tourne dans le plan de l'axe
|
||
emprunté (XW quand on voyage dans le temps, YW dans les branches, XY d'une vue à l'autre) et seulement pendant le geste.
|
||
ALIAS : tsoin-4d (ouvre le cube) et ultimate-tsoin (ouvre le tiroir) : entrées du registre 'app' => 'machine-a-tsoins' + dossiers
|
||
ploxions/tsoin-4d et ploxions/ultimate-tsoin pour /px/<alias>. window.jOSMachine = {ouvrir(source?), voyager(source, t)} (la porte
|
||
vit dans partials/_machine_tsoins_bion ; ce bundle la complète). describe() XUI p1-p3.
|
||
PI 4 / MONTRE : rien au boot (à la demande), 0 rAF au repos (seulement pendant un glisser ou une rotation de 320 ms), aucun polling
|
||
(les événements xb:temps:* suffisent ; le chronomètre ne bat qu'en enregistrant, page visible), paliers T0/T1/T2 (html[data-puissance],
|
||
prefers-reduced-motion) ; la fenêtre du passé borne les lectures (6 pistes au plus, 3 en T0). VIE PRIVÉE : la machine n'écrit rien
|
||
elle-même ; tout passe par le cœur (boxion de l'utilisateur, IndexedDB borné pour un anonyme) ; le cube vit en mémoire ; les
|
||
réglages (fenêtre, écriture en glyphes, branches masquées) en localStorage. NE PAS NUIRE : aucune écriture dans le réel sans geste
|
||
explicite ; appliquer demande une confirmation et crée de nouvelles frames. Tout ce qui vient des données est échappé (esc).
|
||
KILL-SWITCHES : xb:machine=off (ou ?machine=off) → la vue minimale · xb:temps=off → tout le cœur · xb:machine.cube=off ·
|
||
xb:machine.tiroir=off · xb:machine.boussole=off · xb:machine.anim=off. Test : node bin/verify-machine-a-tsoins.mjs --}}
|
||
@php
|
||
// PAGE /px/machine-a-tsoins (et /px/tsoin-4d, /px/ultimate-tsoin), rendue par px.blade ($id + $bions, pas de manifeste) : on pose les
|
||
// entrées __PLOXIONS__ des vues du tiroir (app_url + bions, même garde de visibilité que le manifeste), on inclut les partials de leurs
|
||
// bions absents de la page, plus le recorder et la session (le ⏺ du cœur). Dans le xer ou dans le bundle : rien (le manifeste a tout).
|
||
// Même pattern que ploxions/ultimate-social.
|
||
$matEntrees = [];
|
||
$matPartials = [];
|
||
$matIds = []; // v3 L0 : les ploxions qu'une page isolée peut monter (/px/<id>), pour « voir » depuis la page seule
|
||
if (isset($id, $bions) && in_array($id, ['machine-a-tsoins', 'tsoin-4d', 'ultimate-tsoin'], true) && ! isset($ploxionsManifest)
|
||
&& ! request()->attributes->get('mat_subs_done') && class_exists(\App\Http\Controllers\PloxionAppController::class)) {
|
||
request()->attributes->set('mat_subs_done', true); // une fois par requête (pas $GLOBALS : un serveur long garderait le drapeau)
|
||
$matPac = \App\Http\Controllers\PloxionAppController::class;
|
||
try {
|
||
$matEtats = $matPac::etats();
|
||
$matMap = function_exists('xr_dev_bion_map') ? xr_dev_bion_map() : $matPac::bionMap();
|
||
$matDeja = array_flip((array) $bions);
|
||
$matPx = @file_get_contents(resource_path('views/px.blade.php')) ?: '';
|
||
if (preg_match_all('/@include(?:If)?\(\s*[\'"]((?:partials|ploxions)\.[A-Za-z0-9_.-]+)[\'"]/', $matPx, $matM)) {
|
||
foreach ($matM[1] as $matV) { $matDeja[$matV] = true; }
|
||
}
|
||
$matNoms = $matPac::bions('machine-a-tsoins');
|
||
foreach (['tsoin', 'tsoinmachine', 'grand-tsoin', 'tsoinion', 'tsoinfini', 'montage', 'record', 'timeline', 'wayback'] as $matSub) {
|
||
$matP = $matPac::entree($matSub);
|
||
if ($matP === null || ! view()->exists('ploxions.' . $matSub . '.app') || ! $matPac::visible($matP, $matEtats)) { continue; }
|
||
$matB = $matPac::bions($matSub);
|
||
$matE = ['id' => $matSub, 'name' => (string) ($matP['name'] ?? $matSub), 'icon' => (string) ($matP['icon'] ?? '▣'), 'app_url' => $matPac::url($matSub)];
|
||
if ($matB) { $matE['bions'] = $matB; }
|
||
$matEntrees[] = $matE;
|
||
$matNoms = array_merge($matNoms, $matB);
|
||
}
|
||
foreach (config('ploxions.ploxions', []) as $matQ) { $matQi = (string) ($matQ['id'] ?? ''); if (preg_match('/^[a-z0-9][a-z0-9-]{1,62}$/', $matQi) && $matPac::visible($matQ, $matEtats) && view()->exists('ploxions.' . $matQi . '.app')) { $matIds[$matQi] = [mb_substr((string) ($matQ['name'] ?? $matQi), 0, 40), mb_substr((string) ($matQ['icon'] ?? '▣'), 0, 4)]; } }
|
||
$matVues = [];
|
||
foreach (array_unique($matNoms) as $matNom) {
|
||
$matF = $matMap[$matNom] ?? null;
|
||
if (! $matF) { continue; }
|
||
if (preg_match('#resources/views/(partials|ploxions)/(_[A-Za-z0-9_-]+)\.blade\.php$#', $matF, $matX)) { $matVues[] = $matX[1] . '.' . $matX[2]; }
|
||
elseif (preg_match('/^(partials|ploxions)\._[A-Za-z0-9_-]+$/', $matF)) { $matVues[] = $matF; }
|
||
}
|
||
// ⏺ ⏹ : jOSSession au-dessus de jOSTsoin.start (le recorder), qui n'est pas forcément le partial que la carte des bions désigne ;
|
||
// ♫ : l'horloge musicale et l'extrapolateur rythmique (optionnels, nommés sans point dans le JS : jamais attendus au montage)
|
||
foreach (array_merge(['partials._tsoin_recorder', 'partials._tsoin_session', 'partials._pulse_bion', 'partials._extrapolateur_bion'], $matVues) as $matV) {
|
||
if (! isset($matDeja[$matV])) { $matDeja[$matV] = true; $matPartials[] = $matV; }
|
||
}
|
||
} catch (\Throwable $matErr) {
|
||
$matEntrees = [];
|
||
$matPartials = [];
|
||
$matIds = [];
|
||
}
|
||
}
|
||
@endphp
|
||
@foreach ($matPartials as $matV)
|
||
@includeIf($matV)
|
||
@endforeach
|
||
@if ($matEntrees)
|
||
<script type="application/json" id="mat-subs">@json($matEntrees)</script>
|
||
@endif
|
||
@if ($matIds)
|
||
<script type="application/json" id="mat-ids">@json($matIds)</script>
|
||
@endif
|
||
@include('partials._cube4d_bion')
|
||
<style>
|
||
.mat{--m-vide:#010306;--m-fond:#040a13;--m-carte:rgba(10,20,32,.66);--m-trait:rgba(158,223,245,.6);--m-trait2:rgba(158,223,245,.18);
|
||
--m-txt:rgba(225,247,255,.92);--m-txt2:rgba(193,227,240,.56);--m-glace:#9edff5;--m-ambre:#ffb547;--m-passe:#5d86c9;--m-futur:#b89cff;
|
||
--m-vert:#8fe3c0;--m-rouge:#9fb0cc;--m-sur:#06111c;
|
||
position:relative;display:flex;flex-direction:column;height:100%;min-height:440px;overflow:hidden;box-sizing:border-box;
|
||
background:radial-gradient(120% 90% at 50% 34%,#08131f 0%,var(--m-vide) 64%);color:var(--m-txt);
|
||
font:13px/1.45 ui-sans-serif,system-ui,-apple-system,'Segoe UI',Roboto,sans-serif;container-type:inline-size;container-name:mat;
|
||
-webkit-tap-highlight-color:transparent}
|
||
.mat *,.mat *::before,.mat *::after{box-sizing:border-box}
|
||
.mat[data-palier=T0]{background:var(--m-vide)}
|
||
.mat[data-palier=T0],.mat[data-palier=T0] *{transition:none!important;animation:none!important} /* T0 (montre, e-ink, Pi faible) : aucune animation, pas même un fondu */
|
||
.mat--clair{--m-vide:#f3f0e8;--m-fond:#ebe7dd;--m-carte:rgba(255,255,255,.6);--m-trait:rgba(34,44,58,.62);--m-trait2:rgba(34,44,58,.18);
|
||
--m-txt:#18202a;--m-txt2:rgba(24,32,42,.6);--m-glace:#23536c;--m-ambre:#a35c00;--m-passe:#34568e;--m-futur:#6446b8;--m-vert:#1d7a52;
|
||
--m-rouge:#4c5a74;--m-sur:#ffffff;background:var(--m-vide)}
|
||
.mat button{font:inherit;color:inherit}
|
||
.mat [hidden]{display:none!important}
|
||
.mat-k{font-size:11.5px;font-variant-caps:all-small-caps;letter-spacing:.16em;color:var(--m-txt2);white-space:nowrap}
|
||
.mat-v{font:500 12.5px/1.35 ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;font-variant-numeric:tabular-nums;color:var(--m-txt);overflow-wrap:anywhere}
|
||
.mat-voix{font-family:ui-serif,Georgia,'Iowan Old Style','Times New Roman',serif;font-style:italic;color:var(--m-txt2)}
|
||
.mat-b{display:inline-flex;align-items:center;justify-content:center;gap:6px;min-height:44px;padding:0 14px;border-radius:12px;
|
||
border:1px solid var(--m-trait2);background:rgba(158,223,245,.04);color:var(--m-txt);cursor:pointer;text-decoration:none;white-space:nowrap}
|
||
.mat-b:hover,.mat-b:focus-visible{border-color:var(--m-trait);outline:none}
|
||
.mat-b:disabled{opacity:.38;cursor:default}
|
||
.mat-b--plein{background:rgba(158,223,245,.09);border-color:var(--m-glace);color:var(--m-glace);font-weight:600} /* le geste principal : un trait fin et lumineux, pas un pavé plein */
|
||
.mat--clair .mat-b--plein{background:rgba(35,83,108,.07)}
|
||
.mat-b--futur{border-color:rgba(184,156,255,.55);color:var(--m-futur)}
|
||
.mat-btns{display:flex;flex-wrap:wrap;gap:6px}
|
||
.mat-in{min-height:44px;padding:0 12px;border-radius:12px;border:1px solid var(--m-trait2);background:rgba(0,0,0,.18);color:var(--m-txt);font:inherit;font-size:16px;min-width:0}
|
||
.mat-sel{min-height:40px;padding:0 10px;border-radius:10px;border:1px solid var(--m-trait2);background:var(--m-fond);color:var(--m-txt);font:inherit;max-width:100%}
|
||
.mat-g{display:inline-flex;align-items:center;gap:5px;vertical-align:middle}
|
||
.mat-g svg{width:14px!important;height:14px!important;flex:0 0 auto;display:inline-block!important}
|
||
.mat[data-glyphes=jamais] .mat-g .mat-t,.mat[data-glyphes=survol] .mat-g .mat-t{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}
|
||
.mat[data-glyphes=survol] .mat-g:hover .mat-t,.mat[data-glyphes=survol] .mat-g.vu .mat-t,.mat[data-glyphes=survol] :focus-visible>.mat-g .mat-t{position:static;width:auto;height:auto;clip:auto}
|
||
.mat-fourche{display:inline-block;width:1em;height:1em;vertical-align:-.12em}
|
||
.mat-ic{width:1.05em;height:1.05em;vertical-align:-.16em;flex:0 0 auto}
|
||
/* tête */
|
||
.mat__tete{display:flex;flex-wrap:wrap;align-items:center;gap:6px 12px;padding:10px 14px 8px;border-bottom:1px solid var(--m-trait2)}
|
||
.mat__titre{display:flex;align-items:baseline;flex-wrap:wrap;gap:4px 10px;flex:1 1 230px;min-width:0}
|
||
.mat--bandeau .mat__tete{padding-top:var(--m-bandeau,52px)}
|
||
.mat__titre b{font-weight:600;font-size:15px;letter-spacing:.02em}
|
||
.mat__titre b span{color:var(--m-glace)} /* le sablier du titre : trait froid, seul son point (le maintenant) est ambre */
|
||
.mat__etat{display:inline-flex;align-items:center;gap:6px;min-height:32px;padding:2px 4px 2px 10px;border-radius:999px;border:1px solid var(--m-trait2);font-size:12px}
|
||
.mat__etat.pose{border-color:rgba(184,156,255,.6);color:var(--m-futur);max-width:min(100%,460px)}
|
||
.mat__etat .mat-nom{display:inline-block;max-width:17em;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;vertical-align:bottom}
|
||
.mat__etat .mat-b{min-height:30px;padding:0 10px;border-radius:999px;font-size:12px}
|
||
.mat__dv{font-size:12px;color:var(--m-txt2);padding:4px 10px;border-radius:999px;border:1px dashed var(--m-trait2);cursor:pointer;background:none;opacity:1;transition:opacity .6s}
|
||
.mat__dv.fond{opacity:0}
|
||
.mat__rec{display:inline-flex;align-items:center;gap:6px;flex-wrap:wrap}
|
||
.mat__rec .mat-b.on{border-color:var(--m-ambre);color:var(--m-ambre)}
|
||
.mat__rec label{display:inline-flex;align-items:center;gap:4px;font-size:12px;color:var(--m-txt2);min-height:44px}
|
||
.mat__chrono{font:500 13px ui-monospace,SFMono-Regular,Menlo,monospace;color:var(--m-ambre);min-width:3.4em}
|
||
.mat__nait{display:inline-block;width:14px;height:14px;background:currentColor;clip-path:polygon(0 0,100% 0,100% 50%,100% 100%,0 100%,0 50%)}
|
||
.mat--anim .mat__nait.nait{animation:mat-nait .6s ease-out both}
|
||
.mat--anim .mat__nait.fin{animation:mat-fin .6s ease-in both}
|
||
@keyframes mat-nait{0%{clip-path:polygon(0 0,100% 0,100% 50%,100% 100%,0 100%,0 50%)}60%{clip-path:polygon(0 0,100% 0,50% 50%,100% 100%,0 100%,50% 50%)}100%{clip-path:polygon(0 0,100% 0,50% 50%,100% 100%,0 100%,50% 50%)}}
|
||
@keyframes mat-fin{0%{clip-path:polygon(0 0,100% 0,50% 50%,100% 100%,0 100%,50% 50%);transform:none;opacity:1}100%{clip-path:polygon(0 0,100% 0,50% 50%,100% 100%,0 100%,50% 50%);transform:scale(1.8);opacity:0}}
|
||
.mat__bous{display:inline-flex;align-items:center;gap:8px}
|
||
.mat__bous svg{width:56px;height:56px;flex:0 0 auto;display:block}
|
||
.mat__bous .m-tes{fill:none;stroke:var(--m-glace);stroke-width:.9;stroke-linecap:round}
|
||
.mat__bous .m-tes--in{stroke-opacity:.38}.mat__bous .m-tes--lien{stroke-opacity:.22}.mat__bous .m-tes--out{stroke-opacity:.85}
|
||
.mat__bous .m-tes-sab{fill:none;stroke:var(--m-glace);stroke-width:1}
|
||
.mat__bous .m-tes-pt{fill:var(--m-ambre)}
|
||
.mat__rot{display:grid;grid-template-columns:repeat(3,auto);gap:0 9px;font:10.5px/1.5 ui-monospace,SFMono-Regular,Menlo,monospace;font-variant-numeric:tabular-nums;color:var(--m-txt2)}
|
||
.mat__rot span b{font-weight:600;margin-right:3px;letter-spacing:.06em}
|
||
.mat__rot span.on{color:var(--m-glace)}
|
||
@container mat (max-width:560px){
|
||
.mat__tete{gap:4px 8px;padding:8px 10px 6px}
|
||
.mat__titre{flex-basis:100%}.mat__titre b{font-size:14px}
|
||
.mat__rec label{min-height:36px}.mat__rec .mat-sel{min-height:36px;max-width:118px}
|
||
.mat__bous svg{width:44px;height:44px}.mat__rot{font-size:9.5px;gap:0 6px}
|
||
.mat__vues{padding:4px 8px}.mat__vues button{padding:0 11px}
|
||
.mat__pan{padding:8px 10px 16px}
|
||
}
|
||
/* vues */
|
||
.mat__vues{display:flex;gap:4px;overflow-x:auto;padding:6px 10px;border-bottom:1px solid var(--m-trait2);scrollbar-width:none;flex:0 0 auto}
|
||
.mat__vues::-webkit-scrollbar{display:none}
|
||
.mat__vues button{flex:0 0 auto;display:inline-flex;align-items:center;gap:6px;min-height:44px;padding:0 13px;border-radius:12px;border:1px solid transparent;background:transparent;color:var(--m-txt2);cursor:pointer}
|
||
.mat__vues button[aria-selected=true]{color:var(--m-txt);border-color:var(--m-trait2);background:rgba(158,223,245,.07)}
|
||
.mat__vues button.tir{margin-left:auto}
|
||
.mat__scene{position:relative;flex:1 1 auto;min-height:0;overflow:auto;-webkit-overflow-scrolling:touch;overscroll-behavior:contain}
|
||
.mat__pan{padding:10px 12px 18px}
|
||
.mat--anim .mat__pan.entre{animation:mat-xw .32s cubic-bezier(.2,.7,.2,1)}
|
||
@keyframes mat-xw{from{transform:perspective(1100px) rotateY(-24deg) scaleX(.94);opacity:.2}to{transform:none;opacity:1}}
|
||
.mat__vide{padding:14px;color:var(--m-txt2)}
|
||
.mat__carte{border:1px solid var(--m-trait2);border-radius:16px;background:var(--m-carte);padding:12px}
|
||
/* sablier */
|
||
.mat__sab{display:grid;grid-template-columns:minmax(0,1fr);gap:12px}
|
||
.mat__svgbox{position:relative;min-width:0}
|
||
.mat__svg{display:block;width:100%;height:auto;max-height:64vh;margin:0 auto;touch-action:none;user-select:none;-webkit-user-select:none;cursor:ew-resize;outline:none}
|
||
.mat__svg:focus-visible{outline:1px dashed var(--m-trait);outline-offset:2px}
|
||
.mat[data-orient=debout] .mat__svg{width:auto;max-width:100%;height:min(62vh,150vw);max-height:none;cursor:ns-resize}
|
||
.mat--voyage[data-orient=debout] .mat__svg{height:min(38vh,92vw)}
|
||
.mat__svg .m-axe{stroke:var(--m-trait);stroke-width:1.1}
|
||
.mat__svg .m-fleche{fill:var(--m-trait)}
|
||
.mat__svg .m-mur{fill:none;stroke:var(--m-trait);stroke-width:1.5;stroke-linejoin:round}
|
||
.mat__svg .m-base{stroke:var(--m-trait2);stroke-width:1.2;stroke-dasharray:3 6}
|
||
.mat__svg .m-fond-p{fill:rgba(93,134,201,.07)}.mat__svg .m-fond-f{fill:rgba(184,156,255,.05)}
|
||
.mat[data-palier=T0] .mat__svg .m-fond-p,.mat[data-palier=T0] .mat__svg .m-fond-f{fill:none}
|
||
.mat__svg .m-chaos line{stroke-width:1.1;stroke-linecap:round}
|
||
.mat__svg .m-ch-p{stroke:var(--m-passe);stroke-opacity:.42}.mat__svg .m-ch-f{stroke:var(--m-futur);stroke-opacity:.42}
|
||
.mat__svg .m-tr{stroke-width:2.4;cursor:pointer}
|
||
.mat__svg .m-tr:hover{stroke:var(--m-txt)!important;stroke-opacity:1}
|
||
.mat__svg .m-k0{stroke:#c9eeff}.mat__svg .m-k1{stroke:#9edff5}.mat__svg .m-k2{stroke:#86c3ec}.mat__svg .m-k3{stroke:#71a4de}.mat__svg .m-k4{stroke:#5d86c9}
|
||
.mat__svg .m-ka{stroke:#7fd6c9}.mat__svg .m-km{stroke:#a9b8ff}.mat__svg .m-ku{stroke:#c9b8ff}.mat__svg .m-kc{stroke:#cfd6e4}.mat__svg .m-kb{stroke:var(--m-futur)}
|
||
.mat--clair .mat__svg .m-k0,.mat--clair .mat__svg .m-k1{stroke:#2f6f8f}.mat--clair .mat__svg .m-k2,.mat--clair .mat__svg .m-k3,.mat--clair .mat__svg .m-k4{stroke:#34568e}
|
||
.mat__svg .m-tr.m-sel{stroke:var(--m-txt)!important;stroke-width:4;stroke-opacity:1!important}
|
||
.mat__svg .m-tick line{stroke:var(--m-trait2);stroke-width:1}
|
||
.mat__svg text{font-family:ui-sans-serif,system-ui,sans-serif}
|
||
.mat__svg .m-t{fill:var(--m-txt2);letter-spacing:.14em}
|
||
.mat__svg .m-tn{fill:var(--m-txt2);font-family:ui-monospace,SFMono-Regular,Menlo,monospace}
|
||
.mat__svg .m-voix{fill:var(--m-txt2);font-family:ui-serif,Georgia,serif;font-style:italic}
|
||
.mat__svg .m-cro{fill:none;stroke:var(--m-trait2);stroke-width:1.2}
|
||
.mat__svg .m-plan line{stroke:var(--m-glace);stroke-width:1.6}
|
||
.mat__svg .m-plan circle{fill:var(--m-vide);stroke:var(--m-glace);stroke-width:1.6}
|
||
.mat__svg .m-plan text{fill:var(--m-glace);font-family:ui-monospace,SFMono-Regular,Menlo,monospace}
|
||
.mat__svg .m-now .m-pt{fill:var(--m-ambre)}
|
||
.mat__svg .m-now .m-halo{fill:none;stroke:var(--m-ambre);stroke-opacity:.38;stroke-width:1.2}
|
||
.mat__svg .m-now text,.mat__svg .m-certain text{fill:var(--m-ambre)}
|
||
.mat__svg .m-certain path{fill:none;stroke:var(--m-ambre);stroke-width:1.2;stroke-opacity:.8}
|
||
.mat__svg .m-br path{fill:none;stroke:var(--m-futur);stroke-opacity:.52;stroke-width:1.6}
|
||
.mat__svg .m-br circle{fill:var(--m-vide);stroke:var(--m-futur);stroke-width:1.5;cursor:pointer}
|
||
.mat__svg .m-br text{fill:var(--m-futur);cursor:pointer}
|
||
.mat__svg .m-br--pose path{stroke-opacity:1;stroke-width:2.6}.mat__svg .m-br--pose circle{fill:var(--m-futur)}
|
||
.mat__svg .m-br--sel path{stroke-opacity:1;stroke:var(--m-txt)}
|
||
.mat__svg .m-br .m-cible{fill:transparent;stroke:none;cursor:pointer}
|
||
.mat__svg .m-de{fill:none;stroke:var(--m-futur);stroke-opacity:.45;stroke-width:1.2;stroke-dasharray:3 4}.mat__svg .m-de--loin{stroke-dasharray:1 5;stroke-opacity:.35}
|
||
.mat__svg .m-op path{fill:none;stroke:var(--m-glace);stroke-opacity:.7;stroke-width:1.4;stroke-dasharray:2 5}
|
||
.mat__svg .m-op circle{fill:var(--m-vide);stroke:var(--m-glace);cursor:pointer}
|
||
.mat__svg .m-op text{fill:var(--m-glace);cursor:pointer}
|
||
/* ♫ l'extrapolateur dans le cône du futur : un fil par possible, le nœud a sa forme (○ ▢ △ ⧗), la voix qui sonne en clair, le choix armé cerclé */
|
||
.mat__svg .m-fil{cursor:pointer}.mat__svg .m-fil path{fill:none;stroke:var(--m-futur);stroke-width:1.3;stroke-opacity:.5}.mat__svg .m-fil--certain path{stroke-opacity:.92;stroke-width:1.9}
|
||
.mat__svg .m-nd{fill:var(--m-vide);stroke:var(--m-futur);stroke-width:1.5}.mat__svg .m-fil text{fill:var(--m-futur)}.mat__svg .m-fil .m-cible{fill:transparent}
|
||
.mat__svg .m-fil--voix path,.mat__svg .m-fil--voix .m-nd{stroke:var(--m-txt);stroke-opacity:1}.mat__svg .m-fil--voix text{fill:var(--m-txt)}.mat__svg .m-anneau{fill:none;stroke:var(--m-glace);stroke-width:1.4}
|
||
.mat--anim .mat__svg .m-fils.nait path{stroke-dasharray:100;animation:mat-fil .6s ease-out both}@keyframes mat-fil{from{stroke-dashoffset:100}}
|
||
.mat__svg.m-xp-on .m-br,.mat__svg.m-xp-on .m-ops{opacity:.32}
|
||
.mat__svg .m-certain-noyau text,.mat__xp .m-now-xp,.mat__xp .m-certain-xp{fill:var(--m-ambre);color:var(--m-ambre)} /* le présent tenu, ce qui reste vrai partout */
|
||
/* la piste flow le long de l'axe : tetraplexion froid → aligné → xerboxion ambre (le flow = être au présent) */
|
||
.mat__svg .m-flow line{stroke-width:7;stroke-opacity:.34}.mat[data-palier=T0] .mat__svg .m-flow line{stroke-width:5}
|
||
.mat__svg .m-flow-t{stroke:var(--m-passe)}.mat__svg .m-flow-a{stroke:var(--m-glace)}.mat__svg .m-flow-x{stroke:var(--m-ambre);stroke-opacity:.5}
|
||
.mat__instr{display:flex;flex-direction:column;gap:10px;padding:12px;border:1px solid var(--m-trait2);border-radius:16px;background:var(--m-carte);min-width:0}
|
||
.mat__ligne{display:flex;flex-wrap:wrap;align-items:center;gap:6px 10px}
|
||
.mat__grille{display:grid;grid-template-columns:auto minmax(0,1fr);gap:3px 12px;align-items:baseline}
|
||
.mat__puces{display:flex;flex-wrap:wrap;gap:4px}
|
||
.mat__puces button{min-height:36px;padding:0 11px;border-radius:999px;border:1px solid var(--m-trait2);background:transparent;color:var(--m-txt2);cursor:pointer;font-size:12px}
|
||
.mat__puces button[aria-pressed=true]{color:var(--m-txt);border-color:var(--m-trait)}
|
||
.mat__nom{display:flex;flex-wrap:wrap;gap:6px}
|
||
.mat__nom .mat-in{flex:1 1 160px}
|
||
.mat__hublot{border:1px solid var(--m-trait);border-radius:16px;overflow:hidden;background:var(--m-fond);display:flex;flex-direction:column;min-width:0}
|
||
.mat__hub-tete{display:flex;flex-wrap:wrap;align-items:center;gap:6px 10px;padding:8px 10px;border-bottom:1px solid var(--m-trait2)}
|
||
.mat__hub-tete .mat-v{flex:1 1 180px}
|
||
.mat__hub-host{position:relative;min-height:52vh;height:62vh;overflow:auto;background:var(--xr-bg,#070a0d)}
|
||
.mat__hub-host>*{min-height:100%}
|
||
.mat__confirme{border:1px solid var(--m-trait);border-radius:14px;padding:10px 12px;display:flex;flex-direction:column;gap:8px;background:rgba(158,223,245,.05)}
|
||
.mat__xp{display:flex;flex-direction:column;gap:8px;padding-bottom:10px;border-bottom:1px solid var(--m-trait2)}.mat__xp form{display:flex;flex-wrap:wrap;gap:6px}.mat__xp .mat-in{flex:1 1 150px}
|
||
.mat__xp ol{list-style:none;margin:0;padding:0;display:grid;gap:4px}
|
||
.mat__xp li button{display:flex;align-items:baseline;gap:8px;width:100%;min-height:40px;padding:6px 10px;border-radius:12px;border:1px solid var(--m-trait2);background:none;color:var(--m-txt2);cursor:pointer;text-align:left;font-size:12.5px}
|
||
.mat__xp li b{font-weight:500;color:var(--m-futur)}.mat__xp li span{flex:1;overflow-wrap:anywhere}.mat__xp li small{font:11px ui-monospace,monospace;opacity:.8}
|
||
.mat__xp li .voix{color:var(--m-txt);border-color:var(--m-trait)}.mat__xp li [aria-pressed=true]{border-color:var(--m-glace);color:var(--m-glace)}
|
||
.mat__mes i{display:inline-block;width:7px;height:7px;margin-right:3px;border-radius:50%;border:1px solid var(--m-trait2)}.mat__mes i.on{background:var(--m-glace)}
|
||
@container mat (min-width:900px){
|
||
.mat__sab{grid-template-columns:minmax(0,1fr) 330px;align-items:start}
|
||
.mat__hublot{grid-column:1 / -1}
|
||
.mat__hub-host{height:56vh}
|
||
}
|
||
/* pistes */
|
||
.mat__pistes{display:flex;flex-wrap:wrap;align-items:flex-end;gap:8px 6px}
|
||
.mat__piste{display:flex;flex-direction:column;align-items:center;gap:3px;width:98px;min-height:44px;padding:8px 4px;border-radius:14px;border:1px solid transparent;background:transparent;color:var(--m-txt);cursor:pointer;text-align:center}
|
||
.mat__piste:hover{border-color:var(--m-trait2)}
|
||
.mat__piste[aria-pressed=true]{border-color:var(--m-glace);background:rgba(158,223,245,.08)}
|
||
.mat__piste b{font-weight:500;font-size:12px;max-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
|
||
.mat__piste small{color:var(--m-txt2);font-size:10.5px;line-height:1.25}
|
||
.mat__piste .mat-age{font-variant-caps:all-small-caps;letter-spacing:.12em}
|
||
/* le badge ⧗ de jOSTsoin (dégradé cyan → magenta, point blanc : le néon d'avant) repeint dans la langue de la machine : trait froid,
|
||
le cône du haut (l'après) violet, celui du bas (l'avant) bleu, le pincement ambre */
|
||
.mat__piste svg path{stroke:var(--m-trait)}.mat__piste svg path:not([opacity]){fill:none}
|
||
.mat__piste svg path[opacity]{stroke:none;fill:var(--m-passe)}.mat__piste svg path[opacity]:first-of-type{fill:var(--m-futur)}
|
||
.mat__piste svg line{stroke:var(--m-trait2)}
|
||
.mat__piste svg circle{fill:var(--m-ambre)}
|
||
.mat__combi{margin-top:14px;display:flex;flex-direction:column;gap:10px}
|
||
.mat__portion svg{display:block;width:100%;max-width:520px;height:auto}
|
||
.mat__portion .m-mur{fill:none;stroke:var(--m-trait);stroke-width:1.4}
|
||
.mat__portion .m-bar{stroke:var(--m-glace);stroke-width:3;stroke-linecap:round}
|
||
.mat__portion .m-worm{fill:none;stroke:var(--m-futur);stroke-opacity:.7;stroke-width:1.2}
|
||
.mat__portion text{fill:var(--m-txt2);font:12px ui-sans-serif,system-ui,sans-serif}
|
||
.mat__portion .m-pt{fill:var(--m-ambre)}
|
||
.mat__ou{display:flex;flex-wrap:wrap;align-items:center;gap:4px 6px}
|
||
.mat__ou>em{font-family:ui-serif,Georgia,serif;font-style:italic;color:var(--m-txt2);padding:0 2px}
|
||
.mat__op{display:flex;flex-direction:column;align-items:center;gap:2px;width:84px;min-height:44px;padding:6px 4px;border-radius:12px;border:1px solid var(--m-trait2);background:transparent;cursor:pointer}
|
||
.mat__op:hover,.mat__op[aria-pressed=true]{border-color:var(--m-glace)}
|
||
.mat__op svg{width:34px;height:50px;display:block}
|
||
.mat__op b{font:600 12px ui-monospace,SFMono-Regular,Menlo,monospace}
|
||
.mat__op small{font-size:10.5px;color:var(--m-txt2);line-height:1.2}
|
||
.mini .m-mur{fill:none;stroke:var(--m-trait);stroke-width:1.3}
|
||
.mini .m-tr{stroke:var(--m-glace);stroke-width:1.2}
|
||
.mini .m-pt{fill:var(--m-ambre)}
|
||
/* branches */
|
||
.mat__graphe svg{display:block;width:100%;height:auto}
|
||
.mat__graphe .m-reel{stroke:var(--m-glace);stroke-width:2;fill:none}
|
||
.mat__graphe .m-lane{fill:none;stroke:var(--m-futur);stroke-width:1.6;stroke-opacity:.7}
|
||
.mat__graphe .m-lane--pose{stroke-width:2.6;stroke-opacity:1}
|
||
.mat__graphe .m-lane--sel{stroke:var(--m-txt);stroke-opacity:1}
|
||
.mat__graphe .m-merge{fill:none;stroke:var(--m-vert);stroke-width:1.4;stroke-dasharray:4 4}
|
||
.mat__graphe .m-fan{stroke:var(--m-futur);stroke-opacity:.45;stroke-width:1}
|
||
.mat__graphe text{fill:var(--m-txt2);font:12px ui-sans-serif,system-ui,sans-serif}
|
||
.mat__graphe .m-nom{fill:var(--m-txt);cursor:pointer}
|
||
.mat__graphe .m-cible{fill:transparent;cursor:pointer}
|
||
.mat__graphe .m-now{fill:var(--m-ambre)}
|
||
.mat__brl{list-style:none;margin:10px 0 0;padding:0;display:flex;flex-direction:column;gap:8px}
|
||
.mat__brl li{border:1px solid var(--m-trait2);border-radius:14px;padding:10px;display:flex;flex-direction:column;gap:6px;background:var(--m-carte)}
|
||
.mat__brl li.sel{border-color:var(--m-trait)}
|
||
.mat__brl li.pose{border-color:rgba(184,156,255,.6)}
|
||
.mat__brl li.masquee{opacity:.55}
|
||
.mat__brl .mat-b{min-height:40px;padding:0 11px;font-size:12.5px}
|
||
.mat__brl label{display:inline-flex;align-items:center;gap:6px;min-height:40px;font-size:12.5px;color:var(--m-txt2);cursor:pointer}
|
||
.mat__diff{border:1px solid var(--m-trait2);border-radius:14px;padding:10px;display:flex;flex-direction:column;gap:6px}
|
||
.mat__diff table{width:100%;border-collapse:collapse;font:12px ui-monospace,SFMono-Regular,Menlo,monospace}
|
||
.mat__diff td,.mat__diff th{text-align:left;padding:4px 6px;border-top:1px solid var(--m-trait2);vertical-align:top;overflow-wrap:anywhere}
|
||
.mat__diff .plus{color:var(--m-vert)}.mat__diff .moins{color:var(--m-rouge);text-decoration:line-through}.mat__diff .change{color:var(--m-glace)}
|
||
.mat__diffbox{overflow-x:auto}
|
||
/* cube */
|
||
.mat__cubehost{position:relative;height:min(66vh,580px);min-height:340px;border:1px solid var(--m-trait2);border-radius:16px;overflow:hidden;background:#010306;margin-top:10px}
|
||
.mat__cubehost:empty{display:none}
|
||
.mat .c4d{--c4d-ambre:var(--m-ambre)} /* un seul ambre : celui du présent de la machine */
|
||
.mat__prog{height:3px;border-radius:2px;background:var(--m-trait2);overflow:hidden;margin-top:6px}
|
||
.mat__prog i{display:block;height:100%;width:0;background:var(--m-glace);transition:width .2s}
|
||
/* générations */
|
||
.mat__gens{list-style:none;margin:10px 0 0;padding:0;display:flex;flex-direction:column;gap:6px}
|
||
.mat__gens li{display:flex;flex-wrap:wrap;align-items:center;gap:6px 12px;padding:8px 10px;border-radius:12px;border:1px solid var(--m-trait2)}
|
||
.mat__gens li.cour{border-color:var(--m-trait)}
|
||
.mat__gens li .mat-v{flex:1 1 200px}
|
||
/* tiroir */
|
||
.mat__tiroir{position:absolute;left:0;right:0;bottom:0;height:88%;z-index:6;display:flex;flex-direction:column;background:var(--m-fond);
|
||
border-top:1px solid var(--m-trait);border-radius:18px 18px 0 0;box-shadow:0 -14px 44px rgba(0,0,0,.55)}
|
||
.mat--anim .mat__tiroir.entre{animation:mat-xw .32s cubic-bezier(.2,.7,.2,1)}
|
||
.mat__tir-tete{display:flex;align-items:center;gap:8px;padding:8px 10px 8px 14px;border-bottom:1px solid var(--m-trait2)}
|
||
.mat__tir-tete b{flex:1;font-weight:600}
|
||
.mat__tir-liste{display:flex;gap:6px;overflow-x:auto;padding:8px 10px;flex:0 0 auto;scrollbar-width:thin}
|
||
.mat__tir-liste button,.mat__tir-liste a{flex:0 0 auto;display:flex;flex-direction:column;align-items:flex-start;gap:1px;min-height:44px;max-width:180px;padding:6px 11px;border-radius:12px;border:1px solid var(--m-trait2);background:transparent;cursor:pointer;text-align:left;color:var(--m-txt);text-decoration:none}
|
||
.mat__tir-liste [aria-pressed=true]{border-color:var(--m-glace);background:rgba(158,223,245,.08)}
|
||
.mat__tir-liste small{font-size:10.5px;color:var(--m-txt2);white-space:normal;line-height:1.25}
|
||
.mat__tir-liste .indispo{opacity:.5}
|
||
.mat__tir-host{position:relative;flex:1 1 auto;min-height:0;overflow:auto;border-top:1px solid var(--m-trait2);background:var(--xr-bg,#070a0d)}
|
||
.mat__tir-host>*{min-height:100%}
|
||
@container mat (min-width:900px){.mat__tiroir{left:auto;top:0;height:auto;width:min(620px,54%);border-radius:18px 0 0 18px;border-top:0;border-left:1px solid var(--m-trait);box-shadow:-14px 0 44px rgba(0,0,0,.55)}}
|
||
/* réglages, messages, vue minimale */
|
||
.mat__reg{position:absolute;right:10px;top:10px;z-index:8;width:min(340px,calc(100% - 20px));max-height:calc(100% - 20px);overflow:auto;padding:12px;border-radius:16px;border:1px solid var(--m-trait);background:var(--m-fond);box-shadow:0 14px 40px rgba(0,0,0,.5);display:flex;flex-direction:column;gap:10px}
|
||
.mat__reg table{width:100%;border-collapse:collapse;font:11.5px ui-monospace,SFMono-Regular,Menlo,monospace}
|
||
.mat__reg td{padding:2px 4px;border-top:1px solid var(--m-trait2)}
|
||
.mat__jauge{height:6px;border-radius:3px;background:var(--m-trait2);overflow:hidden}
|
||
.mat__jauge i{display:block;height:100%;background:var(--m-glace)}
|
||
.mat__msg{position:absolute;left:50%;bottom:14px;transform:translateX(-50%);z-index:9;max-width:calc(100% - 24px);padding:9px 14px;border-radius:14px;background:var(--m-fond);border:1px solid var(--m-trait);box-shadow:0 10px 30px rgba(0,0,0,.5);font-size:12.5px}
|
||
.mat__msg.ko{border-style:dashed;border-color:var(--m-trait)} /* pas de pastille rouge (dix-mille-ans §1.9) : un trait tireté */
|
||
.mat__avant{flex:0 0 auto;margin:6px 10px 0;padding:9px 12px;border-radius:14px;border:1px dashed var(--m-passe);background:var(--m-carte);display:flex;flex-direction:column;gap:5px;font-size:12.5px} {{-- les données d'avant (le temps v2.2) : la couleur du passé, un trait tireté, jamais une alerte (l'ambre est au présent seul) --}}
|
||
.mat__avant p{margin:0}
|
||
.mat__min{padding:18px 16px;display:flex;flex-direction:column;gap:12px;max-width:640px}
|
||
.mat__min ul{margin:0;padding-left:18px;color:var(--m-txt2)}
|
||
@media (prefers-reduced-motion:reduce){.mat *{animation:none!important;transition:none!important}}
|
||
</style>
|
||
<script>
|
||
(function () {
|
||
'use strict';
|
||
var W = window, D = document, ID = 'machine-a-tsoins', VERSION = '1.0';
|
||
var A = W.jOSApps = W.jOSApps || {};
|
||
if (A[ID] && A[ID].__machine) return; {{-- le bundle arrive deux fois (page /px + alias) : un seul enregistrement --}}
|
||
|
||
{{-- ── page /px/machine-a-tsoins : les entrées de manifeste des vues du tiroir (posées côté serveur dans #mat-subs) ── --}}
|
||
(function () {
|
||
var el = D.getElementById('mat-subs'), l = null; if (!el) return;
|
||
try { l = JSON.parse(el.textContent || '[]'); } catch (e) { l = null; }
|
||
if (!Array.isArray(l)) return;
|
||
var M = W.__PLOXIONS__ = Array.isArray(W.__PLOXIONS__) ? W.__PLOXIONS__ : [];
|
||
l.forEach(function (e) { if (e && e.id && !M.some(function (x) { return x && x.id === e.id; })) M.push(e); });
|
||
})();
|
||
(function () { var el = D.getElementById('mat-ids'); if (el) try { var m = JSON.parse(el.textContent); W.__PX_IDS__ = Object.keys(m); W.__PX_ICONES__ = m; } catch (e) {} })();
|
||
|
||
{{-- ───────────────────────── outils ───────────────────────── --}}
|
||
function ls(k) { try { return W.localStorage.getItem(k); } catch (e) { return null; } }
|
||
function lsSet(k, v) { try { if (v == null) W.localStorage.removeItem(k); else W.localStorage.setItem(k, v); } catch (e) {} }
|
||
function qs(k) { try { return new URLSearchParams(W.location.search || '').get(k); } catch (e) { return null; } }
|
||
function eteint(v) { return v === 'off' || v === '0' || v === 'false'; }
|
||
function machineCoupee() { return eteint(qs('machine')) || eteint(ls('xb:machine')); }
|
||
function option(n) { return !eteint(ls('xb:machine.' + n)); }
|
||
function esc(s) { return window.jOSb.esc(s); }
|
||
function clamp(v, a, b) { return v < a ? a : (v > b ? b : v); }
|
||
function f1(v) { return String(Math.round(v * 10) / 10); }
|
||
function court(s, n) { s = String(s == null ? '' : s).replace(/\s+/g, ' ').trim(); return s.length > n ? s.slice(0, n - 1) + '…' : s; }
|
||
function deux(x) { return ('0' + x).slice(-2); }
|
||
function virgule(v, d) { var s = Math.abs(v).toFixed(d); return (v < 0 && Number(s) !== 0 ? '−' : '') + s.replace('.', ','); }
|
||
function fmtT(t) { {{-- l'instant exact : 25.09.2026 · 01:23:45,120 --}}
|
||
if (!(t > 0)) return '—';
|
||
var d = new Date(t);
|
||
return deux(d.getDate()) + '.' + deux(d.getMonth() + 1) + '.' + d.getFullYear() + ' · ' + deux(d.getHours()) + ':' + deux(d.getMinutes()) + ':' + deux(d.getSeconds()) + ',' + ('00' + d.getMilliseconds()).slice(-3);
|
||
}
|
||
function fmtH(t) { var d = new Date(t); return deux(d.getHours()) + ':' + deux(d.getMinutes()) + ':' + deux(d.getSeconds()); }
|
||
function fmtJ(t) { var d = new Date(t); return deux(d.getDate()) + '.' + deux(d.getMonth() + 1) + ' ' + deux(d.getHours()) + ':' + deux(d.getMinutes()); }
|
||
function fmtAge(ms) {
|
||
ms = Math.max(0, ms);
|
||
if (ms < 1000) return 'maintenant';
|
||
var s = Math.floor(ms / 1000), m = Math.floor(s / 60), h = Math.floor(m / 60), j = Math.floor(h / 24);
|
||
if (j >= 1) return j + ' j ' + (h % 24) + ' h';
|
||
if (h >= 1) return h + ' h ' + deux(m % 60) + ' min';
|
||
if (m >= 1) return m + ' min ' + deux(s % 60) + ' s';
|
||
return s + ' s';
|
||
}
|
||
function fmtCourt(ms) { var s = ms / 1000; if (s < 90) return Math.round(s) + ' s'; if (s < 5400) return Math.round(s / 60) + ' min'; if (s < 172800) return Math.round(s / 3600) + ' h'; return Math.round(s / 86400) + ' j'; }
|
||
function fmtO(o) { o = +o || 0; return o < 1000 ? o + ' o' : o < 1e6 ? virgule(o / 1e3, 1) + ' Ko' : virgule(o / 1e6, 1) + ' Mo'; } {{-- unités décimales, comme le budget du cœur (8 Mo = 8 000 000 o, affichés « 8,0 Mo » et non « 7,6 ») --}}
|
||
function fmtChrono(ms) { var s = Math.max(0, Math.floor(ms / 1000)), h = Math.floor(s / 3600); return (h ? h + ':' + deux(Math.floor(s / 60) % 60) : Math.floor(s / 60)) + ':' + deux(s % 60); }
|
||
function hash(s) { s = String(s == null ? '' : s); var h = 2166136261, i; for (i = 0; i < s.length; i++) { h ^= s.charCodeAt(i); h = Math.imul(h, 16777619); } return h >>> 0; }
|
||
function parT(a, b) { return (a.t - b.t) || (a.id < b.id ? -1 : a.id > b.id ? 1 : 0); }
|
||
function tDe(id) { var m = /^[fb]([0-9a-z]+)-/.exec(String(id || '')); return m ? parseInt(m[1], 36) : 0; }
|
||
function mm(q) { try { return !!(W.matchMedia && W.matchMedia(q).matches); } catch (e) { return false; } }
|
||
function T() { return W.jOSTemps || null; }
|
||
function tempsCoupe() { var t = T(); return !!(t && t.coupe) || eteint(ls('xb:temps')) || eteint(qs('temps')); }
|
||
{{-- ♫ optionnels, nommés sans point : jamais attendus au montage --}}
|
||
function XP() { var x = W.jOSExtrapolateur; return (option('xp') && x && typeof x.tenir === 'function' && typeof x.etat === 'function') ? x : null; }
|
||
function PU() { var p = W.jOSPulse; return (p && typeof p.etat === 'function' && typeof p.actif === 'function') ? p : null; }
|
||
function pulseBat() { var p = PU(); try { if (!p || !p.actif()) return false; var e = p.etat(); return !!(e && e.actif && !e.muet && e.bpm > 0); } catch (x) { return false; } }
|
||
function bpmCourant() { var p = PU(); try { var e = p && p.actif() ? p.etat() : null; if (e && e.bpm > 0) return e.bpm; } catch (x) {} return 0; }
|
||
function flowEtat(f) { {{-- lu dans le nom de la frame (« ⚡ flow : aligné ») --}}
|
||
var s = String((f && (f.nom || f.resume)) || '').toLowerCase();
|
||
return /xerboxion/.test(s) ? 'xerboxion' : (/align/.test(s) ? 'aligne' : (/tetraplexion/.test(s) ? 'tetraplexion' : null));
|
||
}
|
||
function cube() { var c = W.jOSCube4D; return (c && typeof c.monter === 'function') ? c : null; }
|
||
function codec() { return W['jOSGlyph' + 'Codec'] || null; } {{-- optionnel : écrit sans « . » pour ne pas devenir un bion attendu --}}
|
||
function manifeste(id) { var l = W.__PLOXIONS__, i; if (Array.isArray(l)) for (i = 0; i < l.length; i++) if (l[i] && l[i].id === id) return l[i]; return null; }
|
||
function demonter(x) { try { if (x && typeof x.unmount === 'function') x.unmount(); else if (x && typeof x.detruire === 'function') x.detruire(); } catch (e) {} }
|
||
function puissance() { var p = ''; try { p = D.documentElement.getAttribute('data-puissance') || ''; } catch (e) {} return p; }
|
||
function palier() { var p = puissance(); if (p === 'faible' || mm('(prefers-reduced-motion: reduce)')) return 'T0'; return p === 'forte' ? 'T2' : 'T1'; }
|
||
function animOk(pal) { return pal !== 'T0' && option('anim') && ls('xb-anim') !== '0' && !(D.documentElement.classList && D.documentElement.classList.contains('xb-no-anim')); }
|
||
function lireMasquees() { try { var l = JSON.parse(ls('xb:machine:masquees') || '[]'); return Array.isArray(l) ? l.filter(function (x) { return typeof x === 'string'; }) : []; } catch (e) { return []; } }
|
||
function heureDe(x) { {{-- t accepté : ms, Date, texte ISO, ou id de frame (f<t36>-…) --}}
|
||
if (x == null || x === '') return null;
|
||
if (typeof x === 'number') return x;
|
||
if (x instanceof Date) return x.getTime();
|
||
var s = String(x); if (/^f[0-9a-z]+-/.test(s)) return tDe(s);
|
||
if (/^\d{10,}$/.test(s)) return +s;
|
||
var t = Date.parse(s); return isNaN(t) ? null : t;
|
||
}
|
||
var FOURCHE = '<svg class="mat-fourche" viewBox="0 0 16 16" aria-hidden="true"><path d="M8 15V9M8 9 3.5 2.5M8 9l4.5-6.5" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round"/></svg>';
|
||
{{-- les instruments dessinés en SVG : ⧗ ⏮ ⏭ ⏺ ⏹ 👁 ⏲ manquent dans beaucoup de polices (vu en chromium le 25.09 : des carrés vides) --}}
|
||
function ic(d, extra) { return '<svg class="mat-ic" viewBox="0 0 16 16" aria-hidden="true">' + d + (extra || '') + '</svg>'; }
|
||
var ICO = {
|
||
sab: ic('<path d="M3.5 1.5h9L8 8zM3.5 14.5h9L8 8z" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linejoin="round"/>', '<circle cx="8" cy="8" r="1.4" fill="#ffb547"/>'),
|
||
sab2: ic('<path d="M1 1.5h6L4 8zM1 14.5h6L4 8zM9 1.5h6L12 8zM9 14.5h6L12 8z" fill="none" stroke="currentColor" stroke-width="1.2" stroke-linejoin="round"/>'),
|
||
prec: ic('<path d="M3.5 3v10M13 3 6 8l7 5z" fill="currentColor" stroke="currentColor" stroke-width="1.2" stroke-linejoin="round"/>'),
|
||
suiv: ic('<path d="M12.5 3v10M3 3l7 5-7 5z" fill="currentColor" stroke="currentColor" stroke-width="1.2" stroke-linejoin="round"/>'),
|
||
rec: ic('<circle cx="8" cy="8" r="5" fill="currentColor"/>'),
|
||
stop: ic('<rect x="3.5" y="3.5" width="9" height="9" rx="1" fill="currentColor"/>'),
|
||
oeil: ic('<path d="M1.5 8s2.5-4.5 6.5-4.5S14.5 8 14.5 8 12 12.5 8 12.5 1.5 8 1.5 8z" fill="none" stroke="currentColor" stroke-width="1.3"/><circle cx="8" cy="8" r="2.1" fill="currentColor"/>'),
|
||
minut: ic('<circle cx="8" cy="9" r="5.5" fill="none" stroke="currentColor" stroke-width="1.3"/><path d="M8 9V6M6.5 1.5h3" fill="none" stroke="currentColor" stroke-width="1.3" stroke-linecap="round"/>'),
|
||
cube: ic('<path d="M2.5 5 8 2l5.5 3v6L8 14l-5.5-3zM2.5 5 8 8l5.5-3M8 8v6" fill="none" stroke="currentColor" stroke-width="1.2" stroke-linejoin="round"/>'),
|
||
retour: ic('<path d="M8 3.5 2.5 8 8 12.5zM14 3.5 8.5 8l5.5 4.5z" fill="currentColor"/>'),
|
||
film: ic('<rect x="2" y="2.5" width="12" height="11" rx="1.2" fill="none" stroke="currentColor" stroke-width="1.2"/><path d="M4.5 2.5v11M11.5 2.5v11M2 6h2.5M2 10h2.5M11.5 6H14M11.5 10H14" fill="none" stroke="currentColor" stroke-width="1"/>'),
|
||
camera: ic('<path d="M2 5h2.6l1.2-1.6h4.4L11.4 5H14v7.5H2z" fill="none" stroke="currentColor" stroke-width="1.2" stroke-linejoin="round"/><circle cx="8" cy="8.6" r="2.3" fill="none" stroke="currentColor" stroke-width="1.2"/>'),
|
||
horloge: ic('<circle cx="8" cy="8" r="6" fill="none" stroke="currentColor" stroke-width="1.2"/><path d="M8 4.5V8l2.4 1.6" fill="none" stroke="currentColor" stroke-width="1.2" stroke-linecap="round"/>')
|
||
};
|
||
function fourche(txt) { return FOURCHE + '<span class="sr-fourche" style="position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0)">⑂</span>' + (txt ? ' ' + txt : ''); }
|
||
|
||
var FEN = { '1h': [36e5, '1 h'], '24h': [864e5, '24 h'], '7j': [6048e5, '7 j'], '30j': [2592e6, '30 j'], 'tout': [0, 'tout'] };
|
||
var OPS = [['seq', 'a puis b'], ['xor', 'ce qui diffère'], ['weave', 'entrelacés'], ['fold', 'le résidu'], ['mask', 'b posé sur a']];
|
||
var FIXES = { ui: 1, actions: 1, media: 1, code: 1 };
|
||
var TIROIR = [
|
||
['tsoin', '⦿', 'Tsoin', 'tes actions enregistrées, rejouées'],
|
||
['tsoinmachine', '⧗', 'La machine dessinée', 'la console, les wormions, les plugions'],
|
||
['grand-tsoin', '⧗', 'Grand tsoin', 'tous les tsoins en un seul'],
|
||
['tsoinion', '⬢', 'Tsoinion', 'capter, la frise, le rejeu'],
|
||
['tsoinfini', '∞', 'Tsoinfini', 'le temps n’existe pas'],
|
||
['montage', '🎬', 'La table', 'le montage multi-pistes'],
|
||
['record', '⏺', 'Record', 'caméra, écran ou micro'],
|
||
['timeline', '⏳', 'Timeline', 'passé ← présent → futur'],
|
||
['wayback', '🕰', 'Wayback', 'l’histoire du code d’un ploxion']
|
||
];
|
||
var VUES = [['sablier', ICO.sab, 'le sablier'], ['pistes', ICO.sab2, 'les pistes'], ['branches', FOURCHE, 'les branches'], ['cube', ICO.cube, 'le cube 4D'], ['generations', '◈', 'les générations']];
|
||
|
||
{{-- ───────────────────────── la géométrie du sablier ───────────────────────── --}}
|
||
{{-- u = l'axe du temps (0 → 1000 : l'avant → l'après ; le pincement MAINTENANT à 500) ; v = l'écart à l'axe. --}}
|
||
{{-- couché : (u, v) → (u, 280 + v) dans 1000 × 580 ; debout : (u, v) → (310 + v, 1000 − u) dans 610 × 1000 (l'après en haut). --}}
|
||
var PIN = 500, B0 = 70, B1 = 930, HC = 230, COL = 5, LONG = 430, KLOG = 40;
|
||
function Geo(o) { var c = o === 'couche'; return { o: o, w: c ? 1000 : 610, h: c ? 580 : 1000, ax: c ? 280 : 310, fs: c ? 13 : 23 }; }
|
||
function P(g, u, v) { return g.o === 'couche' ? [u, g.ax + v] : [g.ax + v, 1000 - u]; }
|
||
function pt(g, u, v) { var p = P(g, u, v); return f1(p[0]) + ' ' + f1(p[1]); }
|
||
function demi(u) { return COL + (HC - COL) * Math.min(1, Math.abs(u - PIN) / LONG); }
|
||
{{-- l'âge → la place dans le cône du passé (logarithmique : le récent a de la place près du pincement) --}}
|
||
function uDeAge(a, span) { if (!(a > 0)) return PIN; var x = Math.min(1, a / span); return PIN - LONG * Math.log(1 + KLOG * x) / Math.log(1 + KLOG); }
|
||
function ageDeU(u, span) { var y = clamp((PIN - u) / LONG, 0, 1); return span * (Math.pow(1 + KLOG, y) - 1) / KLOG; }
|
||
function texte(g, u, v, txt, cls, o) {
|
||
o = o || {}; var p = P(g, u, v), fs = o.fs || g.fs, anc = o.anc || 'middle';
|
||
var rot = o.rot && g.o === 'debout' ? ' transform="rotate(-90 ' + f1(p[0]) + ' ' + f1(p[1]) + ')"' : '';
|
||
return '<text x="' + f1(p[0]) + '" y="' + f1(p[1] + fs * 0.35) + '" font-size="' + fs + '" text-anchor="' + anc + '" class="' + cls + '"' + rot + '>' + esc(txt) + '</text>';
|
||
}
|
||
function chaos(g, n) { {{-- les traits qui fuient des bords : déterministes, statiques --}}
|
||
var s = 7, out = ['<g class="m-chaos" aria-hidden="true">'];
|
||
function rnd() { s = (s * 16807) % 2147483647; return (s - 1) / 2147483646; }
|
||
[[B0, -1, 'm-ch-p'], [B1, 1, 'm-ch-f']].forEach(function (c) {
|
||
for (var i = 0; i < n; i++) {
|
||
var v = (rnd() * 2 - 1) * HC * 1.02, u = c[0] + c[1] * rnd() * 16;
|
||
var ang = Math.atan2(v * 0.9, u - PIN) + (rnd() - 0.5) * 0.9, d0 = 6 + rnd() * 10, L = 12 + rnd() * 34;
|
||
var ua = clamp(u + Math.cos(ang) * d0, 4, 996), va = v + Math.sin(ang) * d0, ub = clamp(u + Math.cos(ang) * (d0 + L), 4, 996), vb = clamp(v + Math.sin(ang) * (d0 + L), -HC - 40, HC + 40);
|
||
var a = P(g, ua, va), b = P(g, ub, vb);
|
||
out.push('<line class="' + c[2] + '" x1="' + f1(a[0]) + '" y1="' + f1(a[1]) + '" x2="' + f1(b[0]) + '" y2="' + f1(b[1]) + '"/>');
|
||
}
|
||
});
|
||
out.push('</g>');
|
||
return out.join('');
|
||
}
|
||
function classeFrame(f, y) {
|
||
if (f.branche) return 'm-kb';
|
||
if (f.kind === 'action') return 'm-ka';
|
||
if (f.kind === 'media') return 'm-km';
|
||
if (f.kind === 'ui') return 'm-ku';
|
||
if (f.kind === 'code') return 'm-kc';
|
||
return 'm-k' + Math.min(4, Math.floor(y * 5));
|
||
}
|
||
{{-- un petit sablier debout (les opérateurs, les combinaisons) : n tranches dans le cône du bas (le passé) --}}
|
||
function miniSablier(n, max) {
|
||
var out = ['<svg class="mini" viewBox="0 0 40 60" aria-hidden="true"><path class="m-mur" d="M4 4H36L21 29.5V30.5L36 56H4L19 30.5V29.5Z"/>'];
|
||
var k = max > 0 ? Math.round(12 * Math.min(1, n / max)) : 0, i;
|
||
for (i = 0; i < k; i++) { var y = 54 - i * 2, w = 15 * (y - 30) / 26; out.push('<line class="m-tr" x1="' + f1(20 - w) + '" y1="' + y + '" x2="' + f1(20 + w) + '" y2="' + y + '"/>'); }
|
||
out.push('<circle class="m-pt" cx="20" cy="30" r="2.2"/></svg>');
|
||
return out.join('');
|
||
}
|
||
function sabDebout(icon, size) { {{-- repli si jOSTsoin.badge manque : le même glyphe ⧗ avec l'icône --}}
|
||
var s = size || 44;
|
||
return '<span style="display:inline-block;position:relative;width:' + s + 'px;height:' + s + 'px"><svg viewBox="0 0 48 48" width="100%" height="100%" aria-hidden="true"><path d="M10 6H38L24 24ZM10 42H38L24 24Z" fill="none" stroke="currentColor" stroke-width="2" stroke-linejoin="round"/><circle cx="24" cy="24" r="2.4" fill="#ffb547"/></svg><span style="position:absolute;inset:0;display:flex;align-items:center;justify-content:center;font-size:' + Math.round(s * 0.36) + 'px">' + (icon || '⧗') + '</span></span>';
|
||
}
|
||
function badge(icon, size) {
|
||
try { var t = W.jOSTsoin; if (t && typeof t.badge === 'function') return t.badge(esc(icon || '⧗'), size); } catch (e) {}
|
||
return sabDebout(esc(icon || '⧗'), size);
|
||
}
|
||
|
||
{{-- ───────────────────────── la boussole-tesseract ───────────────────────── --}}
|
||
var PLANS = ['xy', 'xz', 'yz', 'xw', 'yw', 'zw'], AXE = { x: 0, y: 1, z: 2, w: 3 }, ROT0 = { xy: 0, xz: -28, yz: -20, xw: 14, yw: 0, zw: 0 };
|
||
var SOMMETS = [], ARETES = [];
|
||
(function () { var i, b; for (i = 0; i < 16; i++) SOMMETS.push([(i & 1) ? 1 : -1, (i & 2) ? 1 : -1, (i & 4) ? 1 : -1, (i & 8) ? 1 : -1]); for (i = 0; i < 16; i++) for (b = 0; b < 4; b++) { var j = i ^ (1 << b); if (j > i) ARETES.push([i, j]); } })();
|
||
function norm180(a) { a = a % 360; if (a > 180) a -= 360; if (a <= -180) a += 360; return Math.abs(a) < 1e-9 ? 0 : a; }
|
||
function Boussole(el, I) {
|
||
var rot = {}, actif = null, anim = 0, fini = false;
|
||
PLANS.forEach(function (k) { rot[k] = ROT0[k]; });
|
||
el.innerHTML = '<svg viewBox="0 0 100 100" role="img" aria-label="boussole-tesseract"><path class="m-tes m-tes--in" d=""/><path class="m-tes m-tes--lien" d=""/><path class="m-tes m-tes--out" d=""/>' +
|
||
'<path class="m-tes-sab" d="M44.5 42H55.5L50 50ZM44.5 58H55.5L50 50Z"/><circle class="m-tes-pt" cx="50" cy="50" r="1.8"/></svg><div class="mat__rot" aria-label="plans de rotation"></div>';
|
||
var pIn = el.querySelector('.m-tes--in'), pLien = el.querySelector('.m-tes--lien'), pOut = el.querySelector('.m-tes--out'), lect = el.querySelector('.mat__rot');
|
||
function proj(p) {
|
||
var q = p.slice();
|
||
PLANS.forEach(function (pl) { var a = rot[pl] * Math.PI / 180; if (!a) return; var i1 = AXE[pl.charAt(0)], i2 = AXE[pl.charAt(1)], c = Math.cos(a), s = Math.sin(a), x = q[i1], y = q[i2]; q[i1] = x * c - y * s; q[i2] = x * s + y * c; });
|
||
var k4 = 2.6 / (2.6 - q[3] * 0.72), x3 = q[0] * k4, y3 = q[1] * k4, z3 = q[2] * k4, k3 = 4.2 / (4.2 - z3 * 0.6);
|
||
return [50 + x3 * k3 * 15.5, 50 + y3 * k3 * 15.5];
|
||
}
|
||
function dessiner() {
|
||
if (fini) return;
|
||
var p2 = SOMMETS.map(proj), d = { i: '', l: '', o: '' };
|
||
ARETES.forEach(function (e) {
|
||
var a = p2[e[0]], b = p2[e[1]], s = 'M' + f1(a[0]) + ' ' + f1(a[1]) + 'L' + f1(b[0]) + ' ' + f1(b[1]), wa = SOMMETS[e[0]][3], wb = SOMMETS[e[1]][3];
|
||
if (wa !== wb) d.l += s; else if (wa > 0) d.o += s; else d.i += s;
|
||
});
|
||
pIn.setAttribute('d', d.i); pLien.setAttribute('d', d.l); pOut.setAttribute('d', d.o);
|
||
lect.innerHTML = PLANS.map(function (k) { return '<span' + (k === actif ? ' class="on"' : '') + '><b>' + k.toUpperCase() + '</b>' + virgule(norm180(rot[k]), 1) + '°</span>'; }).join('');
|
||
}
|
||
function arreter() { if (anim) { W.cancelAnimationFrame(anim); anim = 0; } }
|
||
dessiner();
|
||
return {
|
||
{{-- pendant un geste : l'appelant redessine dans SON rAF (un seul rAF par geste) --}}
|
||
tourner: function (plan, delta) { if (fini || !(delta)) return; arreter(); actif = plan; rot[plan] = norm180(rot[plan] + delta); },
|
||
dessiner: dessiner,
|
||
lacher: function () { actif = null; dessiner(); },
|
||
{{-- une rotation courte et exacte (≈ 320 ms, sans rebond) ; au palier T0 ou sans animation : le saut direct --}}
|
||
animer: function (plan, delta) {
|
||
if (fini) return; arreter();
|
||
var de = rot[plan];
|
||
if (!animOk(I.palier) || typeof W.requestAnimationFrame !== 'function') { rot[plan] = norm180(de + delta); actif = null; dessiner(); return; }
|
||
var t0 = 0, DUREE = 320; actif = plan;
|
||
function pas(ts) {
|
||
if (fini) return;
|
||
if (!t0) t0 = ts || Date.now();
|
||
var x = clamp(((ts || Date.now()) - t0) / DUREE, 0, 1), e = 1 - Math.pow(1 - x, 3);
|
||
rot[plan] = norm180(de + delta * e); dessiner();
|
||
if (x < 1) anim = W.requestAnimationFrame(pas); else { anim = 0; actif = null; dessiner(); }
|
||
}
|
||
anim = W.requestAnimationFrame(pas);
|
||
},
|
||
rot: function () { var o = {}; PLANS.forEach(function (k) { o[k] = rot[k]; }); return o; },
|
||
enCours: function () { return !!anim; },
|
||
detruire: function () { fini = true; arreter(); }
|
||
};
|
||
}
|
||
|
||
{{-- ───────────────────────── les instances vivantes (jOSMachine les sert) ───────────────────────── --}}
|
||
var VIVANTS = [];
|
||
var JM = W.jOSMachine = W.jOSMachine || {};
|
||
function dernierVivant() { return VIVANTS.length ? VIVANTS[VIVANTS.length - 1] : null; }
|
||
|
||
{{-- ═════════════════════════ UNE MACHINE (une instance montée) ═════════════════════════ --}}
|
||
function Machine(host, ctx, via) {
|
||
ctx = ctx || {};
|
||
var I = {
|
||
host: host, ctx: ctx, via: via || ID, mort: false, vue: 'sablier', orient: 'couche', palier: palier(), fen: FEN[ls('xb:machine:fenetre')] ? ls('xb:machine:fenetre') : '24h',
|
||
filtre: null, pistes: [], branches: [], gens: [], budget: null, frames: [], span: 864e5, cache: {}, sel: null, planU: null, drag: null, raf: 0,
|
||
selBr: null, pistesSel: [], combi: null, voyage: null, nommer: null, confirme: null, compare: [], diff: null, montrerMasquees: false, masquees: lireMasquees(),
|
||
cube: null, cubeRun: 0, tir: { ouvert: false, id: null, h: null }, rec: null, chrono: 0, minuteur: 0, minuteurMs: 0, dvT: 0, sales: {}, tSale: 0,
|
||
glyphes: ls('xb:machine:glyphes') || '', ecoute: [], ro: null, tTaille: 0, pret: false, demande: null, clair: false, charge: null,
|
||
xp: { offs: [], aMoi: false, tMaj: 0, tRendu: 0, nait: false, fenAvant: null, bpm: 0 }, flow: []
|
||
};
|
||
var root = D.createElement('div');
|
||
root.className = 'mat'; root.setAttribute('data-ploxion', ID); root.setAttribute('data-via', I.via);
|
||
host.appendChild(root);
|
||
var ctl = { detruire: detruire, demande: recevoir, I: I, root: root };
|
||
|
||
{{-- ── la vue minimale : kill-switch, cœur coupé, cœur absent ── --}}
|
||
if (machineCoupee() || tempsCoupe() || !T()) {
|
||
var raison = machineCoupee() ? 'machine' : (tempsCoupe() ? 'temps' : 'absent');
|
||
root.classList.add('mat--min'); root.setAttribute('data-min', raison);
|
||
var h = '<div class="mat__min"><div class="mat__titre"><b><span>' + ICO.sab + '</span> la machine à tsoins</b> <i class="mat-voix">seul le présent est certain</i></div>';
|
||
if (raison === 'machine') h += '<p>La machine est en pause (<code>xb:machine=off</code>). Le cœur du temps continue de garder tes frames.</p><div class="mat-btns"><button type="button" class="mat-b mat-b--plein" data-act="rallumer">rallumer la machine</button></div>';
|
||
else if (raison === 'temps') h += '<p>Le cœur du temps est coupé (<code>xb:temps=off</code>) : aucune frame n’est gardée, rien n’est lu.</p><div class="mat-btns"><button type="button" class="mat-b mat-b--plein" data-act="rallumer-temps">rallumer le cœur (au prochain chargement)</button></div>';
|
||
else h += '<p>Le cœur du temps (<code>jOSTemps</code>) n’est pas chargé sur cette page. Ouvre la machine depuis le xer, ou sa page seule.</p><div class="mat-btns"><a class="mat-b" href="/px/' + ID + '" target="_blank" rel="noopener">ouvrir seule ↗</a></div>';
|
||
h += '<div data-z="minpistes"></div></div>';
|
||
root.innerHTML = h;
|
||
root.addEventListener('click', function (e) {
|
||
var b = e.target && e.target.closest ? e.target.closest('[data-act]') : null; if (!b) return;
|
||
var a = b.getAttribute('data-act');
|
||
if (a === 'rallumer') { lsSet('xb:machine', null); detruire(); var n = Machine(host, ctx, via); ctl.detruire = n.detruire; ctl.demande = n.demande; }
|
||
if (a === 'rallumer-temps') { try { if (T() && T().actif) T().actif(true); } catch (x) {} lsSet('xb:temps', null); b.disabled = true; b.textContent = 'rallumé : recharge la page'; }
|
||
});
|
||
if (raison === 'machine' && T() && !tempsCoupe()) { {{-- la liste des pistes, en texte : la machine dort, le temps non --}}
|
||
T().pistes().then(function (l) {
|
||
if (I.mort) return; var z = root.querySelector('[data-z="minpistes"]'); if (!z) return;
|
||
z.innerHTML = '<ul>' + (l || []).filter(function (p) { return p.n; }).map(function (p) { return '<li>' + esc(p.icon) + ' ' + esc(p.label) + ' · ' + esc(p.n) + ' frame' + (p.n > 1 ? 's' : '') + (p.dernier ? ' · ' + esc(fmtJ(p.dernier)) : '') + '</li>'; }).join('') + '</ul>';
|
||
}, function () {});
|
||
}
|
||
ctl.demande = function () { return false; }; {{-- la machine dort : elle ne prend aucune demande --}}
|
||
VIVANTS.push(ctl);
|
||
return ctl;
|
||
}
|
||
|
||
{{-- ── le squelette (une fois) ── --}}
|
||
root.innerHTML =
|
||
'<header class="mat__tete" data-z="tete"></header>' +
|
||
'<nav class="mat__vues" role="tablist" aria-label="vues de la machine" data-z="vues"></nav>' +
|
||
'<div class="mat__reg" data-z="reg" hidden></div>' +
|
||
'<div class="mat__avant" data-z="avant" role="status" hidden></div>' +
|
||
'<main class="mat__scene" data-z="scene">' +
|
||
'<section class="mat__pan" data-pan="sablier"><div class="mat__sab">' +
|
||
'<div class="mat__svgbox" data-z="svgbox"></div><div class="mat__instr" data-z="instr" aria-live="polite"></div>' +
|
||
'<div class="mat__hublot" data-z="hublot" hidden><div class="mat__hub-tete" data-z="hubtete"></div><div class="mat__hub-host" data-z="hubhost"></div></div>' +
|
||
'</div></section>' +
|
||
'<section class="mat__pan" data-pan="pistes" hidden><div data-z="pistes"></div></section>' +
|
||
'<section class="mat__pan" data-pan="branches" hidden><div data-z="branches"></div></section>' +
|
||
'<section class="mat__pan" data-pan="cube" hidden><div data-z="cubetete"></div><div class="mat__cubehost" data-z="cubehost"></div></section>' +
|
||
'<section class="mat__pan" data-pan="generations" hidden><div data-z="gens"></div></section>' +
|
||
'</main>' +
|
||
'<aside class="mat__tiroir" data-z="tiroir" hidden aria-label="les autres vues de la machine"><div class="mat__tir-tete"><b>▤ les autres vues</b><span class="mat-voix">montées vivantes, à la demande</span><button type="button" class="mat-b" data-act="tir-fermer" aria-label="fermer le tiroir">✕</button></div>' +
|
||
'<div class="mat__tir-liste" data-z="tirliste"></div><div class="mat__tir-host" data-z="tirhost"></div></aside>' +
|
||
'<div class="mat__msg" data-z="msg" role="status" aria-live="polite" hidden></div>';
|
||
function z(n) { return root.querySelector('[data-z="' + n + '"]'); }
|
||
var bous = null, M3 = null;
|
||
|
||
function L(txt) { {{-- un libellé : le français, et sa forme en glyphes si l'écriture est allumée (traduction réglable) --}}
|
||
if (!I.glyphes) return esc(txt);
|
||
var C = codec(); if (!C || typeof C.encode !== 'function') return esc(txt);
|
||
var k = String(txt), g = GLY[k];
|
||
if (g === undefined) {
|
||
var hh = hash(k), G = ['koin', 'kion', 'wormion', 'portion', 'losange'];
|
||
try { g = C.encode({ g: G[hh % 5], n: 3 + ((hh >>> 3) % 4), d: 1 + ((hh >>> 6) % 2) }, { size: 14 }); } catch (e) { g = ''; }
|
||
GLY[k] = g;
|
||
}
|
||
return g ? '<span class="mat-g" title="' + esc(k) + '">' + g + '<span class="mat-t">' + esc(k) + '</span></span>' : esc(k);
|
||
}
|
||
|
||
function orientation() {
|
||
var w = root.clientWidth || host.clientWidth || W.innerWidth || 1000, h = root.clientHeight || host.clientHeight || W.innerHeight || 700;
|
||
return (w >= 480 && w >= h) ? 'couche' : 'debout';
|
||
}
|
||
function clair() {
|
||
try { var c = W.getComputedStyle(host).backgroundColor || W.getComputedStyle(D.body).backgroundColor || ''; var m = /rgba?\((\d+),\s*(\d+),\s*(\d+)(?:,\s*([\d.]+))?/.exec(c); if (!m || (m[4] != null && +m[4] < 0.5)) return false; return (0.2126 * m[1] + 0.7152 * m[2] + 0.0722 * m[3]) / 255 > 0.62; } catch (e) { return false; }
|
||
}
|
||
function attrs() {
|
||
I.orient = orientation(); I.palier = palier();
|
||
root.setAttribute('data-orient', I.orient); root.setAttribute('data-palier', I.palier); root.setAttribute('data-vue', I.vue);
|
||
if (I.glyphes) root.setAttribute('data-glyphes', I.glyphes); else root.removeAttribute('data-glyphes');
|
||
root.classList.toggle('mat--anim', animOk(I.palier));
|
||
root.classList.toggle('mat--voyage', !!I.voyage);
|
||
root.classList.toggle('mat--clair', I.clair);
|
||
bandeauCoeur();
|
||
}
|
||
function bandeauCoeur() { {{-- le bandeau fixe du cœur (⑂ posé / 👁 bulle) : la tête descend d'autant si la machine est en haut de l'écran --}}
|
||
var b = D.getElementById('xb-temps-pose'), on = false, px = 0;
|
||
try { if (b && !b.hidden) { var rb = b.getBoundingClientRect(), rr = root.getBoundingClientRect(); if (rr.top < rb.bottom && rb.height > 0) { on = true; px = Math.ceil(rb.bottom - rr.top + 6); } } } catch (e) {}
|
||
root.classList.toggle('mat--bandeau', on);
|
||
if (on) root.style.setProperty('--m-bandeau', px + 'px'); else root.style.removeProperty('--m-bandeau');
|
||
}
|
||
function msg(t, ko) {
|
||
var m = z('msg'); if (!m) return;
|
||
m.textContent = String(t == null ? '' : t); m.hidden = false; m.classList.toggle('ko', !!ko);
|
||
if (I.tMsg) clearTimeout(I.tMsg);
|
||
I.tMsg = setTimeout(function () { I.tMsg = 0; if (!I.mort) m.hidden = true; }, ko ? 7000 : 4200);
|
||
}
|
||
function erreurMsg(e) { msg('⚠ ' + ((e && e.message) || e || 'erreur'), true); }
|
||
|
||
{{-- ── données : tout vient du cœur, borné par la fenêtre du passé ── --}}
|
||
function fenetre() { if (I.fen === 'mes') return [mesSpan(), '♫ mesures']; return FEN[I.fen] || FEN['24h']; }
|
||
{{-- ♫ l'axe en mesures : 64 mesures au tempo courant --}}
|
||
function mesMs() { var b = bpmCourant() || I.xp.bpm || 120; I.xp.bpm = b; return 4 * 60000 / b; }
|
||
function mesSpan() { return Math.max(30000, Math.min(36e5, 64 * mesMs())); }
|
||
function xpL() { var x = XP(); try { var e = x ? x.etat() : null; if (e && e.L) return e.L; } catch (er) {} return 8; }
|
||
function reperesMesures() { var m = mesMs(), Lp = xpL(); return [1, 2, 4, 8, 16, 32, 64].map(function (k) { return [k * m, k % Lp === 0 ? '−' + (k / Lp) + ' phrase' + (k / Lp > 1 ? 's' : '') : '−' + k + ' mes']; }); }
|
||
function depuis() { var f = fenetre(); return f[0] ? Date.now() - f[0] : null; }
|
||
function sourcesSablier() {
|
||
if (I.filtre) return [I.filtre];
|
||
var lim = I.palier === 'T0' ? 3 : 6, dep = depuis(), out = [];
|
||
I.pistes.forEach(function (p) { if (out.length >= lim || p.source === 'code' || !p.n) return; if (dep && p.dernier && p.dernier < dep) return; out.push(p.source); });
|
||
return out;
|
||
}
|
||
function chargerFrames() {
|
||
var t = T(), srcs = sourcesSablier(), dep = depuis(), lim = I.palier === 'T0' ? 90 : 240, jeton = (I.jetonFrames = (I.jetonFrames || 0) + 1);
|
||
var ps = srcs.map(function (s) {
|
||
var k = s + '\u0001' + (dep ? I.fen : 'tout'), c = I.cache[k];
|
||
if (c && !c.sale) return c.liste;
|
||
var o = { limite: lim }; if (dep) o.depuis = dep;
|
||
return t.frames(s, o).then(function (l) { l = Array.isArray(l) ? l : []; I.cache[k] = { liste: l, sale: false }; return l; }, function () { return []; });
|
||
});
|
||
ps.push(chargerFlow());
|
||
return Promise.all(ps).then(function (lst) {
|
||
if (jeton !== I.jetonFrames) return; {{-- une lecture plus récente est partie : la dernière gagne --}}
|
||
I.flow = segmentsFlow(lst.pop() || []);
|
||
var all = [], vu = {};
|
||
lst.forEach(function (l) { l.forEach(function (f) { if (f && f.id && !vu[f.id]) { vu[f.id] = 1; all.push(f); } }); });
|
||
all.sort(parT);
|
||
if (dep) all = all.filter(function (f) { return f.t >= dep; });
|
||
I.frames = all;
|
||
var f = fenetre()[0], now = Date.now();
|
||
I.span = f || Math.max(60000, all.length ? now - all[0].t : 864e5);
|
||
if (I.sel) { var s = trouverFrame(I.sel.id); if (s) I.sel = s; }
|
||
});
|
||
}
|
||
{{-- la piste flow : ses 240 dernières frames d'état, un segment par état tenu --}}
|
||
function chargerFlow() {
|
||
var t = T(); if (!option('flow') || !I.pistes.some(function (p) { return p.source === 'flow' && p.n; })) return Promise.resolve([]);
|
||
var k = 'flow\u0001tout', c = I.cache[k]; if (c && !c.sale) return Promise.resolve(c.liste);
|
||
return t.frames('flow', { limite: 240, branche: null }).then(function (l) { l = (Array.isArray(l) ? l : []).filter(function (f) { return f && f.cle === 'etat' && !f.branche; }); I.cache[k] = { liste: l, sale: false }; return l; }, function () { return []; });
|
||
}
|
||
function segmentsFlow(l) { var out = []; l.forEach(function (f) { var e = flowEtat(f); if (!e || (out.length && out[out.length - 1].etat === e)) return; out.push({ t: f.t, etat: e }); }); return out; }
|
||
function finFlow(seg) { var F = W.jOSFlowstate, n = Date.now(); try { if (F && typeof F.mesure === 'function' && F.mesure()) return n; } catch (e) {} return Math.min(n, seg.t + 18e5); }
|
||
function trouverFrame(id) { for (var i = 0; i < I.frames.length; i++) if (I.frames[i].id === id) return I.frames[i]; return null; }
|
||
function plusProche(t, src) {
|
||
var l = src ? I.frames.filter(function (f) { return f.source === src; }) : I.frames, best = null, d = Infinity, i;
|
||
for (i = 0; i < l.length; i++) { var x = Math.abs(l[i].t - t); if (x < d) { d = x; best = l[i]; } }
|
||
return best;
|
||
}
|
||
function chargerBase() {
|
||
var t = T();
|
||
return Promise.all([
|
||
t.pistes().catch(function () { return []; }),
|
||
t.branches().catch(function () { return []; }),
|
||
t.budget().catch(function () { return null; }),
|
||
(t.generations && t.generations.liste ? t.generations.liste() : Promise.resolve([])).catch(function () { return []; })
|
||
]).then(function (r) {
|
||
I.pistes = Array.isArray(r[0]) ? r[0] : []; I.branches = Array.isArray(r[1]) ? r[1] : []; I.budget = r[2]; I.gens = Array.isArray(r[3]) ? r[3] : [];
|
||
});
|
||
}
|
||
function tout() {
|
||
I.charge = chargerBase().then(chargerFrames).then(function () { if (I.mort) return; I.pret = true; rendreTout(); avantVoir(); if (I.demande) { var d = I.demande; I.demande = null; appliquerDemande(d); } }, function (e) { if (!I.mort) { I.pret = true; rendreTout(); erreurMsg(e); } });
|
||
return I.charge;
|
||
}
|
||
{{-- comptes v2 (docs/dev/39, point 3) : avant() ne rend plus que les écritures vraiment EN ATTENTE de la base d'avant (jamais l'histoire déjà envoyée,
|
||
le cache), et seulement au compte qui a hérité des données d'avant de ce navigateur ; les frames versées sont épinglées (r.elagues : ce que le
|
||
budget a dû retirer d'autre, dit). --}}
|
||
{{-- ── LES DONNÉES D'AVANT (le temps v2.2, docs/dev/29 section 9) : la base locale partagée d'avant (celle de l'anonyme désormais) n'est JAMAIS
|
||
versée seule dans un compte ; si elle a ce que le boxion de ce compte n'a pas, la machine le dit, avec ce qu'elle contient (pistes, clés, dates :
|
||
jamais les valeurs), et le geste : « les verser dans ce compte » ou « ignorer » (elles restent sur l'appareil, rien n'est effacé). ── --}}
|
||
function avantVoir() { var t = T(); if (t && typeof t.avant === 'function') t.avant().then(function (r) { if (!I.mort) { I.avant = r || null; rendreAvant(); } }, function () {}); }
|
||
function rendreAvant() {
|
||
var el = z('avant'), r = I.avant, n = function (x, m) { return esc(x) + ' ' + m + (x > 1 ? 's' : ''); }; if (!el) return;
|
||
el.hidden = !r; if (!r) { el.innerHTML = ''; return; }
|
||
el.innerHTML = '<div><b>des écritures locales d’avant attendent sur cet appareil</b> — ' + n(r.frames, 'frame') + (r.branches ? ', ' + n(r.branches, 'branche') : '') + (r.generations ? ', ' + n(r.generations, 'génération') : '') +
|
||
(r.depuis ? ' · du ' + esc(fmtJ(r.depuis)) + ' au ' + esc(fmtJ(r.jusqua || r.depuis)) : '') + '</div>' +
|
||
'<div class="mat-v">' + (r.pistes || []).slice(0, 6).map(function (p) { return esc(p.source) + ' ' + esc(p.n) + (p.cles && p.cles.length ? ' (' + esc(p.cles.join(', ')) + ')' : ''); }).join(' · ') + '</div>' +
|
||
'<p class="mat-voix">elles n’étaient pas parties, sur ce navigateur : elles n’entrent ici que si tu les verses</p>' +
|
||
'<div class="mat-btns"><button type="button" class="mat-b mat-b--plein" data-act="avant-verser">les verser dans ce compte</button><button type="button" class="mat-b" data-act="avant-ignorer">ignorer</button></div>';
|
||
}
|
||
function avantGeste(g, b) {
|
||
var t = T(); if (!t || !t.avant) return;
|
||
b.disabled = true;
|
||
t.avant(g).then(function (r) {
|
||
if (I.mort) return; I.avant = null; rendreAvant();
|
||
msg(g === 'verser' ? 'versées dans ce compte : ' + (r && r.frames || 0) + ' frame(s)' + (r && r.branches ? ', ' + r.branches + ' branche(s)' : '') + (r && r.envoye === false ? ' — elles partent au boxion dès qu’il répond' : '') + (r && r.elagues ? ' — épinglées : le budget a élagué ' + r.elagues + ' frame(s) plus ancienne(s)' : '') : 'ignorées : elles restent sur cet appareil, rien n’est effacé');
|
||
if (g === 'verser') { sale('frames'); sale('branches'); sale('gens'); }
|
||
}, function (e) { if (!I.mort) { b.disabled = false; erreurMsg(e); } });
|
||
}
|
||
{{-- les événements du cœur : on marque, puis UNE relecture groupée (700 ms) ; aucun polling --}}
|
||
function sale(quoi, src) {
|
||
I.sales[quoi] = 1;
|
||
if (src) { var k; for (k in I.cache) if (k.indexOf(src + '\u0001') === 0) I.cache[k].sale = true; I.sales.src = I.sales.src || {}; I.sales.src[src] = 1; }
|
||
if (I.tSale) return;
|
||
I.tSale = setTimeout(function () {
|
||
I.tSale = 0; if (I.mort) return;
|
||
var s = I.sales; I.sales = {};
|
||
var t = T(), ps = [t.pistes().then(function (l) { I.pistes = l || []; }, function () {}), t.budget().then(function (b) { I.budget = b; }, function () {})];
|
||
if (s.branches) ps.push(t.branches().then(function (l) { I.branches = l || []; }, function () {}));
|
||
if (s.gens && t.generations) ps.push(t.generations.liste().then(function (l) { I.gens = l || []; }, function () {}));
|
||
Promise.all(ps).then(function () { return s.frames ? chargerFrames() : null; }).then(function () { if (!I.mort) rafraichir(); });
|
||
}, 700);
|
||
}
|
||
{{-- un rafraîchissement venu du cœur ne coupe jamais un geste : pas pendant un glisser, ni quand un champ a le focus (un nom de --}}
|
||
{{-- branche en train d'être tapé, le minuteur) ; il attend le lâcher ou la sortie du champ --}}
|
||
function saisie() { var a = D.activeElement; return !!(a && root.contains(a) && /^(INPUT|TEXTAREA|SELECT)$/.test(a.tagName)); }
|
||
function rafraichir() {
|
||
if (I.drag || saisie()) { I.aRendre = true; return; }
|
||
I.aRendre = false; rendreTete(); rendreVue(true);
|
||
}
|
||
function rattraper() { if (I.aRendre && !I.mort) setTimeout(function () { if (I.aRendre && !I.mort) rafraichir(); }, 0); }
|
||
function ecouter(cible, nom, fn) { cible.addEventListener(nom, fn); I.ecoute.push([cible, nom, fn]); }
|
||
|
||
{{-- ── la tête : titre, où on est, déjà-vu, ⏺, la boussole, ⚙ ── --}}
|
||
function teteSquelette() { {{-- une fois : la boussole n'est jamais reconstruite par un rafraîchissement --}}
|
||
z('tete').innerHTML = '<div class="mat__titre"><b><span>' + ICO.sab + '</span> la machine à tsoins</b><i class="mat-voix">seul le présent est certain</i></div>' +
|
||
'<div class="mat__etat" data-z="etat"></div><button type="button" class="mat__dv fond" data-z="dv" data-act="dv" hidden></button>' +
|
||
'<div class="mat__rec" data-z="rec"></div>' + (option('boussole') ? '<div class="mat__bous" data-z="bous"></div>' : '') +
|
||
'<button type="button" class="mat-b" data-act="reg" aria-label="réglages" title="réglages">⚙</button>';
|
||
var bz = z('bous'); bous = bz ? Boussole(bz, I) : null;
|
||
}
|
||
function rendreTete() {
|
||
var t = T(), p = null; try { p = t.posee(); } catch (e) {}
|
||
var enr = !!I.rec, et = z('etat'), rc = z('rec');
|
||
if (et) {
|
||
et.className = 'mat__etat' + (p ? ' pose' : '');
|
||
et.innerHTML = p ? fourche('posé sur « <span class="mat-nom" title="' + esc(p.nom) + '">' + esc(p.nom) + '</span> »') + ' <small>' + esc(p.source) + '</small> <button type="button" class="mat-b" data-act="reel">↩ ' + L('revenir au réel') + '</button>'
|
||
: '<span style="color:var(--m-ambre)">●</span> ' + L('on est sur le réel');
|
||
}
|
||
if (rc) {
|
||
rc.innerHTML = '<button type="button" class="mat-b' + (enr ? ' on' : '') + '" data-act="rec" aria-pressed="' + enr + '"><i class="mat__nait" data-z="nait"></i>' + (enr ? ICO.stop + ' ' + L('sceller') : ICO.rec + ' ' + L('enregistrer')) + '</button>' +
|
||
(enr ? '<span class="mat__chrono" data-z="chrono">' + esc(fmtChrono(Date.now() - I.rec.t0)) + '</span>' + (I.minuteur ? '<small class="mat-k">arrêt à ' + esc(fmtH(I.minuteur)) + '</small>' : '')
|
||
: '<label title="minuteur : scelle tout seul après">' + ICO.minut + ' <select class="mat-sel" data-z="minuteur" aria-label="minuteur"><option value="0">sans minuteur</option><option value="60000">1 min</option><option value="300000">5 min</option><option value="900000">15 min</option><option value="1800000">30 min</option></select></label>' +
|
||
'<label title="capture de l’écran (demande la permission)"><input type="checkbox" data-z="media"> écran</label>');
|
||
if (I.minuteurMs) { var sm = rc.querySelector('[data-z="minuteur"]'); if (sm) sm.value = String(I.minuteurMs); }
|
||
}
|
||
}
|
||
function rendreVues() {
|
||
var h = (M3 ? M3.vues(VUES) : VUES).map(function (v) {
|
||
if (v[0] === 'cube' && !option('cube')) return '';
|
||
return '<button type="button" role="tab" data-act="vue" data-v="' + v[0] + '" aria-selected="' + (I.vue === v[0]) + '"><span aria-hidden="true">' + v[1] + '</span>' + L(v[2]) + '</button>';
|
||
}).join('');
|
||
if (option('tiroir')) h += '<button type="button" class="tir" data-act="tiroir" aria-pressed="' + I.tir.ouvert + '"><span aria-hidden="true">▤</span>' + L('les autres vues') + '</button>';
|
||
z('vues').innerHTML = h;
|
||
}
|
||
function rendreTout() { attrs(); rendreTete(); rendreVues(); rendreVue(false); }
|
||
function rendreVue(doux) {
|
||
attrs();
|
||
var pans = root.querySelectorAll('[data-pan]'), i;
|
||
for (i = 0; i < pans.length; i++) pans[i].hidden = pans[i].getAttribute('data-pan') !== I.vue;
|
||
if (I.vue === 'sablier') rendreSablier();
|
||
else if (I.vue === 'pistes') rendrePistes();
|
||
else if (I.vue === 'branches' && !(M3 && M3.rendre('branches'))) rendreBranches();
|
||
else if (I.vue === 'cube') rendreCubeTete();
|
||
else if (I.vue === 'generations') rendreGens();
|
||
else if (M3) M3.rendre(I.vue);
|
||
if (!doux) { var pan = root.querySelector('[data-pan="' + I.vue + '"]'); if (pan && animOk(I.palier)) { pan.classList.remove('entre'); void pan.offsetWidth; pan.classList.add('entre'); } }
|
||
}
|
||
function changerVue(v) {
|
||
if (v === I.vue) return;
|
||
var ordre = (M3 ? M3.vues(VUES) : VUES).map(function (x) { return x[0]; }), d = ordre.indexOf(v) - ordre.indexOf(I.vue);
|
||
I.vue = v; rendreVues(); rendreVue(false);
|
||
if (bous) bous.animer('xy', d > 0 ? 90 : -90); {{-- ±X : la case voisine --}}
|
||
var sc = z('scene'); if (sc) sc.scrollTop = 0;
|
||
}
|
||
|
||
{{-- ═════════════ ⧗ LE SABLIER ═════════════ --}}
|
||
function nomPiste(src) { for (var i = 0; i < I.pistes.length; i++) if (I.pistes[i].source === src) return I.pistes[i]; return null; }
|
||
function brancheDe(id) { for (var i = 0; i < I.branches.length; i++) if (I.branches[i].id === id) return I.branches[i]; return null; }
|
||
function branchesVisibles() { return I.branches.filter(function (b) { return I.montrerMasquees || I.masquees.indexOf(b.id) < 0; }); }
|
||
{{-- le temps v2 : une session de l'extrapolateur = UNE branche ✦ (ses pas = ses écritures) ; sa trace, un ✦ par choix, se lit dans n (aucun octet stocké) --}}
|
||
function etoiles(b) { var n = /^✦/.test(b.nom) ? b.n || 0 : 0; return n > 1 ? ' ' + Array(Math.min(n, 12) + 1).join('✦') + (n > 12 ? '+' + (n - 12) : '') : ''; }
|
||
function svgSablier() {
|
||
var g = Geo(I.orient), now = Date.now(), span = I.span, out = [], i, fs = g.fs;
|
||
var bw = I.palier === 'T0' ? 6 : 3, seaux = {}, maxc = 1, posee = null;
|
||
try { posee = T().posee(); } catch (e) {}
|
||
out.push('<svg class="mat__svg' + (xpMarche() ? ' m-xp-on' : '') + '" viewBox="0 0 ' + g.w + ' ' + g.h + '" data-orient="' + g.o + '" tabindex="0" role="group" aria-label="le sablier du temps : ' + (g.o === 'couche' ? 'l’avant à gauche, le maintenant au centre, l’après à droite' : 'l’après en haut, le maintenant au centre, l’avant en bas') + '">');
|
||
out.push(chaos(g, I.palier === 'T0' ? 9 : 18));
|
||
{{-- les cônes (le passé, le futur) et leurs bases = la barrière d'incertitude --}}
|
||
out.push('<path class="m-fond-p" d="M' + pt(g, B0, -HC) + 'L' + pt(g, PIN, -COL) + 'L' + pt(g, PIN, COL) + 'L' + pt(g, B0, HC) + 'Z"/>');
|
||
out.push('<path class="m-fond-f" d="M' + pt(g, B1, -HC) + 'L' + pt(g, PIN, -COL) + 'L' + pt(g, PIN, COL) + 'L' + pt(g, B1, HC) + 'Z"/>');
|
||
out.push('<path class="m-mur" d="M' + pt(g, B0, -HC) + 'L' + pt(g, PIN, -COL) + 'L' + pt(g, B1, -HC) + 'M' + pt(g, B0, HC) + 'L' + pt(g, PIN, COL) + 'L' + pt(g, B1, HC) + '"/>');
|
||
out.push('<path class="m-base" d="M' + pt(g, B0, -HC) + 'L' + pt(g, B0, HC) + 'M' + pt(g, B1, -HC) + 'L' + pt(g, B1, HC) + '"/>');
|
||
{{-- la piste flow, sous l'axe --}}
|
||
if (I.flow.length) {
|
||
out.push('<g class="m-flow" data-z="flow" aria-hidden="true">');
|
||
I.flow.forEach(function (sg, k2) {
|
||
var t2 = k2 + 1 < I.flow.length ? I.flow[k2 + 1].t : finFlow(sg); if (!(t2 > sg.t) || t2 < now - span) return;
|
||
var u1 = uDeAge(now - sg.t, span), u2 = uDeAge(now - t2, span); if (u2 - u1 < 1.5) u2 = Math.min(PIN, u1 + 1.5);
|
||
var a = P(g, u1, 0), b = P(g, u2, 0);
|
||
out.push('<line class="m-flow-' + sg.etat.charAt(0) + '" data-etat="' + esc(sg.etat) + '" x1="' + f1(a[0]) + '" y1="' + f1(a[1]) + '" x2="' + f1(b[0]) + '" y2="' + f1(b[1]) + '"/>');
|
||
});
|
||
out.push('</g>');
|
||
}
|
||
{{-- l'axe du temps, sa flèche vers l'après --}}
|
||
out.push('<line class="m-axe" x1="' + P(g, 14, 0)[0] + '" y1="' + P(g, 14, 0)[1] + '" x2="' + P(g, 976, 0)[0] + '" y2="' + P(g, 976, 0)[1] + '"/>');
|
||
var fl = g.o === 'couche' ? 'M986 ' + g.ax + 'L974 ' + (g.ax - 5) + 'L974 ' + (g.ax + 5) + 'Z' : 'M' + g.ax + ' 14L' + (g.ax - 5) + ' 26L' + (g.ax + 5) + ' 26Z';
|
||
out.push('<path class="m-fleche" d="' + fl + '"/>');
|
||
{{-- les repères de l'âge (instruments : la même échelle que les tranches) --}}
|
||
out.push('<g class="m-tick" aria-hidden="true">');
|
||
var tk = g.o === 'couche' ? { d: 26, anc: 'middle' } : { d: 16, anc: 'end' }, dernierU = PIN;
|
||
(I.fen === 'mes' ? reperesMesures() : [[6e4, '−1 min'], [6e5, '−10 min'], [36e5, '−1 h'], [216e5, '−6 h'], [864e5, '−1 j'], [6048e5, '−7 j'], [2592e6, '−30 j'], [31536e6, '−1 an']]).forEach(function (r) {
|
||
if (r[0] >= span * 0.98) return;
|
||
var u = uDeAge(r[0], span); if (PIN - u < 26 || dernierU - u < (g.o === 'couche' ? 46 : 30)) return;
|
||
dernierU = u;
|
||
var a = P(g, u, -demi(u) - 4), b = P(g, u, -demi(u) - 12);
|
||
out.push('<line x1="' + f1(a[0]) + '" y1="' + f1(a[1]) + '" x2="' + f1(b[0]) + '" y2="' + f1(b[1]) + '"/>');
|
||
out.push(texte(g, u, -demi(u) - tk.d, r[1], 'm-tn', { fs: fs * 0.78, anc: tk.anc }));
|
||
});
|
||
if (!(I.fen === 'mes' && g.o === 'debout')) out.push(texte(g, B0, -HC - tk.d, I.fen === 'mes' ? '−' + Math.round(span / mesMs()) + ' mes' : '−' + fmtCourt(span), 'm-tn', { fs: fs * 0.78, anc: tk.anc })); {{-- debout, en mesures : les repères suffisent --}}
|
||
out.push('</g>');
|
||
{{-- les tranches du passé : une par seau, densité = activité --}}
|
||
I.frames.forEach(function (f) {
|
||
var u = uDeAge(now - f.t, span), b = Math.floor((PIN - u) / bw), s = seaux[b] || (seaux[b] = { n: 0, f: null, br: 0 });
|
||
s.n++; if (!s.f || f.t >= s.f.t) s.f = f; if (f.branche) s.br++;
|
||
if (s.n > maxc) maxc = s.n;
|
||
});
|
||
out.push('<g class="m-tranches">');
|
||
Object.keys(seaux).forEach(function (k) {
|
||
var s = seaux[k], u = PIN - (+k + 0.5) * bw, dm = demi(u) - 3; if (dm < 2) dm = 2;
|
||
var y = (PIN - u) / LONG, a = P(g, u, -dm), b = P(g, u, dm), op = 0.3 + 0.7 * Math.min(1, s.n / Math.max(2, maxc * 0.6));
|
||
var sel = I.sel && s.f && I.sel.id === s.f.id;
|
||
out.push('<line class="m-tr ' + classeFrame(s.f, y) + (sel ? ' m-sel' : '') + '" data-fid="' + esc(s.f.id) + '" x1="' + f1(a[0]) + '" y1="' + f1(a[1]) + '" x2="' + f1(b[0]) + '" y2="' + f1(b[1]) + '" stroke-opacity="' + f1(op) + '"/>');
|
||
});
|
||
out.push('</g>');
|
||
{{-- une branche part d'un instant du passé : le trait pointillé de cet instant au pincement — les branches vivent dans les DEUX cônes --}}
|
||
{{-- (cahier §1). L'id de la frame d'origine porte son instant : le fil existe même quand cet instant sort de la fenêtre (relecture --}}
|
||
{{-- 25.09 : une branche d'il y a trois jours disparaissait du passé en fenêtre 24 h) ; il entre alors par la base, en pointillé fin. --}}
|
||
var bv = branchesVisibles(), N = bv.length;
|
||
out.push('<g class="m-branches">');
|
||
bv.forEach(function (br, ib) {
|
||
var fd = br.de ? trouverFrame(br.de) : null, td = fd ? fd.t : tDe(br.de);
|
||
if (!(td > 0)) return; {{-- une combinaison n'a pas d'instant d'origine : seulement son éventail dans le futur --}}
|
||
var loin = now - td >= span, ud = loin ? B0 : uDeAge(now - td, span), hv = -Math.min(60 + (ib % 4) * 9, (PIN - ud) * 0.3 + (ib % 4) * 4);
|
||
out.push('<path class="m-de' + (loin ? ' m-de--loin' : '') + '" d="M' + pt(g, ud, 0) + 'Q' + pt(g, (ud + PIN) / 2, hv) + ' ' + pt(g, PIN, 0) + '"/>');
|
||
});
|
||
{{-- le futur : les branches en éventail (la taille du nœud = ce qu'on y a écrit) --}}
|
||
var lim = I.palier === 'T0' ? 12 : 28, montrees = bv.slice(-lim);
|
||
montrees.forEach(function (br, i2) {
|
||
var n2 = montrees.length, uE = 850, span2 = demi(uE) * 0.9, vE = n2 === 1 ? 0 : -span2 + 2 * span2 * i2 / (n2 - 1);
|
||
var cls = 'm-br' + (posee && posee.id === br.id ? ' m-br--pose' : '') + (I.selBr === br.id ? ' m-br--sel' : '');
|
||
var d = 'M' + pt(g, PIN + 4, 0) + 'C' + pt(g, 580, 0) + ' ' + pt(g, uE - 150, vE * 0.55) + ' ' + pt(g, uE, vE);
|
||
var r = 4 + Math.min(6, Math.log(1 + (br.n || 0)) * 1.6), c = P(g, uE, vE);
|
||
out.push('<g class="' + cls + '" data-br="' + esc(br.id) + '"><path d="' + d + '"/><circle class="m-cible" cx="' + f1(c[0]) + '" cy="' + f1(c[1]) + '" r="' + (r + 12) + '" data-br="' + esc(br.id) + '"/><circle cx="' + f1(c[0]) + '" cy="' + f1(c[1]) + '" r="' + f1(r) + '" data-br="' + esc(br.id) + '"/>' +
|
||
(br.appliquee ? texte(g, uE + 18, vE, '✓', 'm-t', { fs: fs * 0.9 }) : '') + '</g>');
|
||
});
|
||
if (bv.length > montrees.length) out.push(texte(g, 880, HC - 10, '+' + (bv.length - montrees.length), 'm-t', { fs: fs * 0.8 }));
|
||
out.push('</g>');
|
||
{{-- une combinaison en attente : ses 5 « ou » en pointillé dans le futur --}}
|
||
if (I.combi && I.combi.res) {
|
||
out.push('<g class="m-ops">');
|
||
I.combi.res.forEach(function (r, i3) {
|
||
var uE = 700, sp = demi(uE) * 0.85, vE = -sp + 2 * sp * i3 / 4, c = P(g, uE, vE);
|
||
var uT = g.o === 'couche' ? uE + 34 : (i3 % 2 ? uE - 30 : uE + 30); {{-- debout : en quinconce, sinon les cinq mots se chevauchent --}}
|
||
out.push('<g class="m-op" data-op="' + esc(r.op) + '"><path d="M' + pt(g, PIN + 4, 0) + 'Q' + pt(g, 600, vE * 0.4) + ' ' + pt(g, uE, vE) + '"/><circle cx="' + f1(c[0]) + '" cy="' + f1(c[1]) + '" r="5" data-op="' + esc(r.op) + '"/>' + texte(g, uT, vE, r.op, 'm-t', { fs: fs * (g.o === 'couche' ? 0.8 : 0.66) }) + '</g>');
|
||
});
|
||
out.push('</g>');
|
||
}
|
||
{{-- ♫ les possibles de l'extrapolateur (redessinés seuls) --}}
|
||
out.push('<g class="m-fils" data-z="fils">' + filsSvg(g) + '</g>');
|
||
{{-- le plan (la 4e dimension : on le glisse le long de l'axe) --}}
|
||
var uP = uPlan();
|
||
out.push('<g class="m-plan" data-z="plan"' + (uP == null ? ' style="display:none"' : '') + '>' + (uP == null ? '' : planSvg(g, uP, now, span)) + '</g>');
|
||
{{-- le pincement : MAINTENANT, la seule couleur chaude --}}
|
||
var pp = P(g, PIN, 0);
|
||
out.push('<g class="m-now">' + (I.palier === 'T0' ? '' : '<circle class="m-halo" cx="' + pp[0] + '" cy="' + pp[1] + '" r="14"/>') + '<circle class="m-pt" cx="' + pp[0] + '" cy="' + pp[1] + '" r="7"/>' +
|
||
texte(g, PIN, g.o === 'couche' ? -48 : -60, 'maintenant', 'm-t', { fs: fs, anc: g.o === 'couche' ? 'middle' : 'end' }) + '</g>');
|
||
{{-- sous l'axe : « incertain » couvre l'avant ET l'après, « certain » ne couvre que le maintenant --}}
|
||
var yb = HC + (g.o === 'couche' ? 22 : 12);
|
||
out.push('<g class="m-legende" aria-hidden="true">');
|
||
[[B0 + 10, PIN - 26], [PIN + 26, B1 - 10]].forEach(function (seg) {
|
||
out.push('<path class="m-cro" d="M' + pt(g, seg[0], yb - 7) + 'L' + pt(g, seg[0], yb) + 'L' + pt(g, seg[1], yb) + 'L' + pt(g, seg[1], yb - 7) + '"/>');
|
||
out.push(texte(g, (seg[0] + seg[1]) / 2, yb + 18, 'incertain', 'm-voix', { fs: fs, rot: true }));
|
||
});
|
||
out.push('<g class="m-certain"><path d="M' + pt(g, PIN - 16, yb - 7) + 'L' + pt(g, PIN - 16, yb) + 'L' + pt(g, PIN + 16, yb) + 'L' + pt(g, PIN + 16, yb - 7) + '"/>' + texte(g, PIN, yb + 18, 'certain', 'm-voix', { fs: fs, rot: true }) + '</g>');
|
||
if (g.o === 'couche') {
|
||
out.push(texte(g, (B0 + PIN) / 2, -HC - 34, 'avant', 'm-t', { fs: fs * 1.05 }));
|
||
out.push(texte(g, (PIN + B1) / 2, -HC - 34, 'après', 'm-t', { fs: fs * 1.05 }));
|
||
} else { {{-- debout : l'après en haut, l'avant en bas, au bout de l'axe --}}
|
||
out.push(texte(g, B1 + 40, -150, 'après', 'm-t', { fs: fs * 1.05 }));
|
||
out.push(texte(g, B0 - 40, -150, 'avant', 'm-t', { fs: fs * 1.05 }));
|
||
}
|
||
out.push('</g>');
|
||
if (!I.frames.length) out.push(texte(g, (B0 + PIN) / 2 + 30, 0, I.pret ? 'rien dans cette fenêtre' : 'le temps se déplie…', 'm-voix', { fs: fs * 1.05 }));
|
||
out.push('</svg>');
|
||
return out.join('');
|
||
}
|
||
function planSvg(g, u, now, span) {
|
||
var dm = demi(u) + 10, a = P(g, u, -dm), b = P(g, u, dm), c = P(g, u, 0), t = now - ageDeU(u, span);
|
||
return '<line x1="' + f1(a[0]) + '" y1="' + f1(a[1]) + '" x2="' + f1(b[0]) + '" y2="' + f1(b[1]) + '"/><circle cx="' + f1(c[0]) + '" cy="' + f1(c[1]) + '" r="6"/>' +
|
||
texte(g, u, dm + 18, u >= PIN - 1 ? 'maintenant' : fmtH(t), '', { fs: g.fs * 0.9 });
|
||
}
|
||
function uPlan() { return I.planU != null ? I.planU : (I.sel ? uDeAge(Date.now() - I.sel.t, I.span) : null); }
|
||
function redessinerPlan() { {{-- pendant un glisser : seulement le plan (et la boussole), pas tout le SVG --}}
|
||
var gp = root.querySelector('[data-z="plan"]'); if (!gp) return;
|
||
var u = uPlan();
|
||
if (u == null) { gp.style.display = 'none'; return; }
|
||
gp.style.display = ''; gp.innerHTML = planSvg(Geo(I.orient), u, Date.now(), I.span);
|
||
}
|
||
|
||
{{-- ═════════════ ♫ extrapoler en musique ═════════════ --}}
|
||
function xpMarche() { var x = XP(); try { return !!(x && x.etat().marche); } catch (e) { return false; } }
|
||
function glyphe(f) { return ic(noeud(f, [8, 8], 5.4).replace('class="m-nd"', 'fill="none" stroke="currentColor" stroke-width="1.3"')); } {{-- dessiné : ⧗ manque dans les polices d'un Pi --}}
|
||
function noeud(f, c, r) { {{-- ○ ▢ △ ⧗ --}}
|
||
var a = f1(c[0] - r), b = f1(c[0] + r), h = f1(c[1] - r), k = f1(c[1] + r), m = f1(c[0]), o = f1(c[1]);
|
||
return f === 'cercle' ? '<circle class="m-nd" cx="' + m + '" cy="' + o + '" r="' + r + '"/>' : '<path class="m-nd" d="' + (f === 'carre' ? 'M' + a + ' ' + h + 'H' + b + 'V' + k + 'H' + a + 'Z'
|
||
: f === 'triangle' ? 'M' + m + ' ' + h + 'L' + b + ' ' + k + 'H' + a + 'Z' : 'M' + a + ' ' + h + 'H' + b + 'L' + m + ' ' + o + 'ZM' + a + ' ' + k + 'H' + b + 'L' + m + ' ' + o + 'Z') + '"/>';
|
||
}
|
||
{{-- un fil par possible : plus loin du présent, plus loin dans le futur --}}
|
||
function filsSvg(g) {
|
||
var X = XP(), e = null; try { e = X && X.etat(); } catch (x) { e = null; }
|
||
if (!e || !e.marche) return '';
|
||
var l = X.propositions(), n = l.length, out = [], fs = g.fs, deb = g.o === 'debout', noy = X.noyau();
|
||
if (!n) return texte(g, 700, -HC * 0.45, e.attente ? 'la musique ne bat pas encore' : 'les possibles arrivent…', 'm-voix', { fs: fs * 0.9 });
|
||
l.forEach(function (p, i) {
|
||
var uE = PIN + 120 + 300 * clamp(+p.distance || 0, 0, 1), sp = demi(uE) * 0.8, vE = n === 1 ? 0 : -sp + 2 * sp * i / (n - 1), c = P(g, uE, vE), r = deb ? 10 : 7;
|
||
out.push('<g class="m-fil' + ((e.curseur === i || e.curseur === -1) ? ' m-fil--voix' : '') + (e.arme === i ? ' m-fil--arme' : '') + ((+p.certitude || 0) >= 0.5 ? ' m-fil--certain' : '') + '" data-xp="' + i + '" data-v="' + esc(e.liste) + '" data-forme="' + esc(p.forme) + '">' +
|
||
'<path pathLength="100" d="M' + pt(g, PIN + 4, 0) + 'Q' + pt(g, (PIN + uE) / 2, vE * 0.35) + ' ' + pt(g, uE, vE) + '"/>' + noeud(p.forme, c, r) +
|
||
(e.arme === i ? '<circle class="m-anneau" cx="' + f1(c[0]) + '" cy="' + f1(c[1]) + '" r="' + (r + 6) + '"/>' : '') + '<circle class="m-cible" cx="' + f1(c[0]) + '" cy="' + f1(c[1]) + '" r="' + (r + 14) + '"/>' +
|
||
(deb ? texte(g, uE + (i % 2 ? r + 9 : -r - 15), vE, court(p.texte, 13), 'm-t', { fs: fs * 0.58 }) : texte(g, uE + 14, vE, court(p.texte, 30), 'm-t', { fs: fs * 0.74, anc: 'start' })) + '</g>'); {{-- debout : en quinconce --}}
|
||
});
|
||
if (noy.length) out.push('<g class="m-certain-noyau">' + texte(g, PIN + (deb ? 44 : 20), deb ? -HC : -HC - 16, 'certain : ' + noy.slice(0, deb ? 2 : 3).map(function (x) { return x.label; }).join(' · '), 'm-t', { fs: fs * (deb ? 0.58 : 0.74), anc: 'start' }) + '</g>');
|
||
return out.join('');
|
||
}
|
||
function redessinerFils(nait) {
|
||
var gp = root.querySelector('[data-z="fils"]'), svg = root.querySelector('svg.mat__svg'); if (!gp) return;
|
||
gp.classList.remove('nait'); {{-- les fils s'ouvrent à la phrase, pas à chaque redessin --}}
|
||
gp.innerHTML = filsSvg(Geo(I.orient)); if (svg) svg.classList.toggle('m-xp-on', xpMarche());
|
||
if (nait && animOk(I.palier)) { try { gp.getBoundingClientRect(); } catch (e) {} gp.classList.add('nait'); }
|
||
}
|
||
{{-- photosensibilité : au plus un rendu par 340 ms (≤ 3/s), en pratique un par mesure --}}
|
||
function xpMaj(nait) {
|
||
if (I.mort) return;
|
||
if (nait) I.xp.nait = true;
|
||
if (I.xp.tMaj) return;
|
||
var d = 340 - (Date.now() - (I.xp.tRendu || 0));
|
||
if (d <= 0) xpRendre(); else I.xp.tMaj = setTimeout(function () { I.xp.tMaj = 0; xpRendre(); }, d);
|
||
}
|
||
function xpRendre() {
|
||
if (I.mort) return;
|
||
I.xp.tRendu = Date.now(); I.xp.rendus = (I.xp.rendus || 0) + 1;
|
||
var nait = I.xp.nait, el = z('xp'); I.xp.nait = false;
|
||
if (I.vue !== 'sablier') return;
|
||
if (nait && I.fen === 'mes' && !I.drag) { rendreSablier(); redessinerFils(true); return; } {{-- en mesures : un rendu entier par phrase --}}
|
||
redessinerFils(nait);
|
||
if (el && !(saisie() && el.contains(D.activeElement))) el.innerHTML = xpInner();
|
||
}
|
||
function mesures(on) { {{-- l'axe passe en mesures quand la musique bat, et revient à la fenêtre d'avant à l'arrêt --}}
|
||
if (on ? (I.fen === 'mes' || I.xp.fenAvant != null) : I.xp.fenAvant == null) return false;
|
||
if (on) { I.xp.fenAvant = I.fen; I.fen = 'mes'; } else { I.fen = I.xp.fenAvant; I.xp.fenAvant = null; }
|
||
chargerFrames().then(function () { if (!I.mort && I.vue === 'sablier') { rendreSablier(); redessinerFils(true); } });
|
||
return true;
|
||
}
|
||
function xpEtat(e) {
|
||
if (I.mort || !e) return;
|
||
if (!e.marche) I.xp.aMoi = false;
|
||
if (!(e.marche ? !e.attente && I.xp.aMoi && pulseBat() && mesures(true) : mesures(false))) xpMaj(false);
|
||
}
|
||
function bt(a, t, x) { return '<button type="button" class="mat-b" data-act="' + a + '"' + (x || '') + '>' + t + '</button>'; }
|
||
function xpInner() {
|
||
var X = XP(), e = null; try { e = X && X.etat(); } catch (x) { e = null; } if (!e) return '';
|
||
if (e.coupe) return '<span class="mat-voix">♫ coupé (xb:extrapolateur=off)</span>';
|
||
if (!e.marche) {
|
||
var src = I.sel ? I.sel.source : I.filtre, pp = src ? nomPiste(src) : null;
|
||
return '<form data-act-form="xp"><input class="mat-in" data-z="xpmot" maxlength="80" aria-label="un mot à extrapoler" placeholder="' + esc('un mot' + (src ? ' (sinon : ' + (pp ? pp.label : src) + ')' : '')) + '">' +
|
||
'<button type="submit" class="mat-b mat-b--futur">♫ ' + L('extrapoler en musique') + '</button></form><span class="mat-voix">à chaque phrase des branches possibles ; au temps fort, ton geste en choisit une</span>';
|
||
}
|
||
var pr = e.present || {}, l = X.propositions(), noy = X.noyau(), so = e.son || {}, h, k, pts = '';
|
||
h = '<div class="mat__ligne"><span class="mat-k">♫ ' + L('on tient') + '</span><span class="mat-v m-now-xp">' + esc(court(pr.label || pr.texte || '', 70)) + '</span>' + bt('xp-stop', ICO.stop + ' ' + L('arrêter')) + '</div>';
|
||
if (e.attente) h += '<div class="mat__ligne"><span class="mat-voix">' + (e.cache ? 'en pause (page cachée)' : 'la musique ne bat pas encore :') + '</span>' + bt('xp-synchro', '▶ ' + L('synchro')) + bt('xp-tap', L('taper le tempo')) + '</div>';
|
||
else { for (k = 0; k < e.L; k++) pts += '<i' + (k <= e.dans ? ' class="on"' : '') + '></i>'; h += '<div class="mat__ligne mat-v">' + esc(virgule(bpmCourant() || I.xp.bpm || 0, 1)) + ' BPM · phrase ' + esc(e.phrase + 1) + ' · <span class="mat__mes" role="img" aria-label="mesure ' + esc(e.dans + 1) + ' sur ' + esc(e.L) + '">' + pts + '</span></div>'; }
|
||
h += '<ol>' + l.map(function (p, i) {
|
||
return '<li><button type="button" data-act="xp-choisir" data-i="' + i + '" data-v="' + esc(e.liste) + '" aria-pressed="' + (e.arme === i) + '"' + ((e.curseur === i || e.curseur === -1) ? ' class="voix"' : '') + '><b>' + glyphe(p.forme) + '</b><span>' + esc(p.texte) + '</span><small>' +
|
||
esc((p.statut ? p.statut + ' · ' : '') + 'd ' + virgule(+p.distance || 0, 2) + ((+p.certitude || 0) > 0 ? ' · c ' + virgule(+p.certitude, 2) : '')) + '</small></button></li>';
|
||
}).join('') + '</ol>';
|
||
if (e.arme != null && l[e.arme]) h += '<span class="mat-voix">au temps fort : « ' + esc(court(l[e.arme].texte, 70)) + ' »</span>';
|
||
if (noy.length) h += '<span class="mat-v m-certain-xp">certain : ' + esc(noy.slice(0, 4).map(function (x) { return x.label; }).join(' · ')) + '</span>';
|
||
if (e.message) h += '<span class="mat-voix">' + esc(e.message) + '</span>';
|
||
return h + '<div class="mat-btns">' + bt('xp-son', so.coupe ? 'son coupé' : '♪ ' + L(so.actif && !so.muet ? 'son' : 'sans son'), ' aria-pressed="' + !!(so.actif && !so.muet) + '"') +
|
||
[4, 8, 16].map(function (x) { return bt('xp-phrase', x + ' mes', ' data-n="' + x + '" aria-pressed="' + (e.L === x) + '"'); }).join('') + '</div>';
|
||
}
|
||
function xpDemarrer(mot) { {{-- DANS le geste (submit) : l'AudioContext naît ici (iPhone) --}}
|
||
var X = XP(), src = I.sel ? I.sel.source : I.filtre, pp = src ? nomPiste(src) : null;
|
||
var quoi = mot || (src && src !== 'code' && src.indexOf('code:') !== 0 ? { piste: src, label: pp ? pp.label : src } : null);
|
||
if (!X) return;
|
||
if (!quoi) { msg('donne un mot, ou choisis une piste', true); return; }
|
||
var p = X.demarrer({ quoi: quoi });
|
||
I.xp.aMoi = true; {{-- tout de suite : démonter pendant le démarrage arrête aussi la session --}}
|
||
Promise.resolve(p).then(function (r) {
|
||
if (I.mort) return;
|
||
if (!r || !r.ok) { I.xp.aMoi = false; msg((r && r.message) || 'l’extrapolateur ne part pas', true); xpMaj(); return; }
|
||
if (r.message) msg(r.message);
|
||
if (!(pulseBat() && mesures(true))) xpMaj(true);
|
||
});
|
||
}
|
||
function rendreSablier() {
|
||
var box = z('svgbox'); if (!box) return;
|
||
box.innerHTML = svgSablier();
|
||
var svg = box.querySelector('svg');
|
||
if (svg) {
|
||
svg.addEventListener('pointerdown', surDown); svg.addEventListener('pointermove', surMove);
|
||
svg.addEventListener('pointerup', surUp); svg.addEventListener('pointercancel', surUp);
|
||
svg.addEventListener('keydown', surClavier);
|
||
}
|
||
rendreInstr();
|
||
if (I.voyage) rendreHublotTete();
|
||
}
|
||
function rendreInstr() {
|
||
var el = z('instr'); if (!el) return;
|
||
var f = I.sel, h = '', pis = I.pistes.filter(function (p) { return p.n && p.source !== 'code'; });
|
||
if (XP()) h += '<div class="mat__xp" data-z="xp">' + xpInner() + '</div>';
|
||
h += '<div class="mat__ligne"><span class="mat-k">' + L('fenêtre du passé') + '</span><div class="mat__puces" role="group">' +
|
||
Object.keys(FEN).map(function (k) { return '<button type="button" data-act="fen" data-f="' + k + '" aria-pressed="' + (I.fen === k) + '">' + esc(FEN[k][1]) + '</button>'; }).join('') +
|
||
((pulseBat() || I.fen === 'mes') ? '<button type="button" data-act="fen" data-f="mes" aria-pressed="' + (I.fen === 'mes') + '" title="l’axe en mesures, au tempo de la musique">♫ ' + L('mesures') + '</button>' : '') + '</div></div>';
|
||
h += '<div class="mat__ligne"><span class="mat-k">' + L('piste') + '</span><select class="mat-sel" data-z="filtre" aria-label="piste montrée"><option value="">toutes (les plus récentes)</option>' +
|
||
pis.map(function (p) { return '<option value="' + esc(p.source) + '"' + (I.filtre === p.source ? ' selected' : '') + '>' + esc(p.icon) + ' ' + esc(p.label) + ' · ' + esc(p.n) + '</option>'; }).join('') +
|
||
(I.filtre && !nomPiste(I.filtre) ? '<option value="' + esc(I.filtre) + '" selected>' + esc(I.filtre) + '</option>' : '') + '</select></div>';
|
||
h += '<div class="mat__grille"><span class="mat-k">' + L('maintenant') + '</span><span class="mat-v" style="color:var(--m-ambre)">' + esc(fmtT(Date.now())) + '</span>' +
|
||
'<span class="mat-k">' + L('frames') + '</span><span class="mat-v">' + I.frames.length + ' dans la fenêtre · ' + esc(sourcesSablier().length) + ' piste' + (sourcesSablier().length > 1 ? 's' : '') + '</span></div>';
|
||
if (!f) {
|
||
h += '<p class="mat-voix" style="margin:0">' + (I.frames.length ? 'touche une tranche du passé pour t’y poser, ou glisse le plan le long de l’axe' : 'rien d’enregistré dans cette fenêtre : élargis-la, ou écris quelque chose dans un ploxion') + '</p>';
|
||
} else {
|
||
var pis2 = nomPiste(f.source), br = f.branche ? brancheDe(f.branche) : null, lecture = f.kind !== 'etat';
|
||
h += '<div class="mat__grille" data-z="instant">' +
|
||
'<span class="mat-k">' + L('instant') + '</span><span class="mat-v">' + esc(fmtT(f.t)) + '</span>' +
|
||
'<span class="mat-k">' + L('il y a') + '</span><span class="mat-v">' + esc(fmtAge(Date.now() - f.t)) + '</span>' +
|
||
'<span class="mat-k">' + L('piste') + '</span><span class="mat-v">' + esc(pis2 ? pis2.icon + ' ' + pis2.label : f.source) + ' <small style="opacity:.6">' + esc(f.source) + '</small></span>' +
|
||
(f.cle ? '<span class="mat-k">' + L('clé') + '</span><span class="mat-v">' + esc(f.cle) + '</span>' : '') +
|
||
'<span class="mat-k">' + L('genre') + '</span><span class="mat-v">' + esc(f.kind) + (f.deja ? ' · déjà-vu ×' + esc(f.deja) : '') + (f.origine ? ' · origine' : '') + (f.suppr ? ' · supprimé' : '') + '</span>' +
|
||
(br || f.branche ? '<span class="mat-k">' + L('branche') + '</span><span class="mat-v" style="color:var(--m-futur)">' + fourche(esc(br ? br.nom : f.branche)) + '</span>' : '') +
|
||
(f.mus && f.mus.bpm ? '<span class="mat-k">' + L('grille') + '</span><span class="mat-v">♩ mesure ' + esc(f.mus.mesure) + ' · temps ' + esc(f.mus.temps) + ' · phrase ' + esc(f.mus.phrase) + ' · ' + esc(virgule(+f.mus.bpm, 1)) + ' BPM</span>' : '') +
|
||
'<span class="mat-k">' + L('résumé') + '</span><span class="mat-v">' + esc(f.resume || '—') + '</span>' +
|
||
'<span class="mat-k">' + L('taille') + '</span><span class="mat-v">' + esc(fmtO(f.taille)) + (f.hash ? ' · #' + esc(String(f.hash).slice(0, 10)) : '') + '</span></div>';
|
||
h += '<div class="mat-btns"><button type="button" class="mat-b" data-act="prec" aria-label="instant d’avant">' + ICO.prec + '</button><button type="button" class="mat-b" data-act="suiv" aria-label="instant d’après">' + ICO.suiv + '</button>' +
|
||
'<button type="button" class="mat-b mat-b--plein" data-act="voir">' + ICO.oeil + ' ' + L('voir cet instant') + '</button>' +
|
||
'<button type="button" class="mat-b mat-b--futur" data-act="brancher"' + (lecture ? ' disabled title="lecture seule : seules les frames d’état se branchent"' : '') + '>' + fourche(L('brancher ici')) + '</button></div>';
|
||
if (I.nommer && !I.nommer.hub && I.nommer.frame === f.id) h += formNom('brancher-ok', 'branche du ' + fmtJ(f.t));
|
||
}
|
||
el.innerHTML = h;
|
||
}
|
||
function formNom(act, defaut) {
|
||
return '<form class="mat__nom" data-act-form="' + act + '"><input class="mat-in" data-z="nom" maxlength="60" aria-label="nom de la branche" value="' + esc(defaut) + '"><button type="submit" class="mat-b mat-b--futur">' + fourche('créer') + '</button><button type="button" class="mat-b" data-act="nom-annuler">annuler</button></form>';
|
||
}
|
||
function selectionner(f, doux) {
|
||
I.sel = f || null; I.planU = null; I.nommer = null;
|
||
if (I.vue === 'sablier') { if (doux) { majSelectionSvg(); rendreInstr(); } else rendreSablier(); }
|
||
}
|
||
function majSelectionSvg() {
|
||
var l = root.querySelectorAll('.m-tr.m-sel'), i; for (i = 0; i < l.length; i++) l[i].classList.remove('m-sel');
|
||
if (I.sel) { var e = root.querySelector('.m-tr[data-fid="' + String(I.sel.id).replace(/["\\]/g, '') + '"]'); if (e) e.classList.add('m-sel'); }
|
||
redessinerPlan();
|
||
}
|
||
{{-- pointeur → u (l'axe du temps), dans le repère du viewBox --}}
|
||
function uDe(e, svg) {
|
||
var g = Geo(I.orient), x = e.clientX, y = e.clientY, ok = false;
|
||
try { if (svg.getScreenCTM && svg.createSVGPoint) { var m = svg.getScreenCTM(); if (m) { var p = svg.createSVGPoint(); p.x = e.clientX; p.y = e.clientY; p = p.matrixTransform(m.inverse()); x = p.x; y = p.y; ok = true; } } } catch (er) {}
|
||
if (!ok) { var r = svg.getBoundingClientRect ? svg.getBoundingClientRect() : null; if (r && r.width) { x = (e.clientX - r.left) * g.w / r.width; y = (e.clientY - r.top) * g.h / r.height; } }
|
||
return g.o === 'couche' ? x : 1000 - y;
|
||
}
|
||
function surDown(e) {
|
||
if (e.button != null && e.button > 0) return;
|
||
var t = e.target, svg = e.currentTarget;
|
||
var br = t && t.getAttribute ? t.getAttribute('data-br') : null, op = t && t.getAttribute ? t.getAttribute('data-op') : null;
|
||
if (!br && t && t.closest) { var gb = t.closest('[data-br]'); if (gb) br = gb.getAttribute('data-br'); var go = t.closest('[data-op]'); if (go) op = go.getAttribute('data-op'); }
|
||
var xi = t && t.closest ? t.closest('[data-xp]') : null;
|
||
if (xi && xpMarche()) { XP().choisir(+xi.getAttribute('data-xp'), +xi.getAttribute('data-v')); xpMaj(); return; } {{-- data-v : la liste montrée --}}
|
||
if (br) { choisirBranche(br); return; }
|
||
if (op) { choisirOp(op); return; }
|
||
var u = uDe(e, svg);
|
||
if (u > PIN + 6) { if (xpMarche()) { XP().geste(); xpMaj(); } return; } {{-- le futur ne se glisse pas : il se choisit --}}
|
||
I.drag = { id: e.pointerId, u: u, bouge: false, fid: t && t.getAttribute ? t.getAttribute('data-fid') : null };
|
||
try { if (svg.setPointerCapture && e.pointerId != null) svg.setPointerCapture(e.pointerId); } catch (x) {}
|
||
I.planU = clamp(u, B0, PIN); redessinerPlan();
|
||
try { e.preventDefault(); } catch (x2) {}
|
||
}
|
||
function surMove(e) {
|
||
if (!I.drag) return;
|
||
var u = uDe(e, e.currentTarget);
|
||
if (Math.abs(u - I.drag.u) < 0.5) return;
|
||
if (bous) bous.tourner('xw', (u - I.drag.u) * 0.42); {{-- on voyage dans le temps : le plan XW --}}
|
||
I.drag.bouge = true; I.drag.u = u; I.planU = clamp(u, B0, PIN);
|
||
if (!I.raf) I.raf = W.requestAnimationFrame(function () { I.raf = 0; if (!I.mort) { redessinerPlan(); if (bous) bous.dessiner(); } });
|
||
}
|
||
function surUp(e) {
|
||
if (!I.drag) return;
|
||
if (I.raf) { W.cancelAnimationFrame(I.raf); I.raf = 0; }
|
||
var d = I.drag; I.drag = null;
|
||
try { if (e.currentTarget.releasePointerCapture && e.pointerId != null) e.currentTarget.releasePointerCapture(e.pointerId); } catch (x) {}
|
||
if (bous) bous.lacher();
|
||
var f = null;
|
||
if (!d.bouge && d.fid) f = trouverFrame(d.fid);
|
||
if (!f && I.planU != null) f = plusProche(Date.now() - ageDeU(I.planU, I.span), I.voyage && I.voyage.mode === 'bulle' ? I.voyage.source : null);
|
||
selectionner(f, true);
|
||
if (f && I.voyage && I.voyage.mode === 'bulle' && f.source === I.voyage.source) allerA(f);
|
||
rattraper();
|
||
}
|
||
function surClavier(e) {
|
||
var k = e.key;
|
||
if ((k === ' ' || k === 'Enter') && xpMarche()) { e.preventDefault(); XP().geste(); xpMaj(); return; }
|
||
if (['ArrowLeft', 'ArrowRight', 'ArrowUp', 'ArrowDown', 'Home', 'End'].indexOf(k) < 0) return;
|
||
e.preventDefault();
|
||
var l = I.frames; if (!l.length) return;
|
||
var i = I.sel ? l.indexOf(trouverFrame(I.sel.id)) : l.length;
|
||
var avance = I.orient === 'couche' ? (k === 'ArrowRight') : (k === 'ArrowUp');
|
||
if (k === 'Home') i = 0; else if (k === 'End') i = l.length - 1; else i = clamp(i + (avance ? 1 : -1), 0, l.length - 1);
|
||
if (bous) bous.animer('xw', avance ? 12 : -12);
|
||
selectionner(l[i], true);
|
||
if (I.voyage && I.voyage.mode === 'bulle' && l[i].source === I.voyage.source) allerA(l[i]);
|
||
}
|
||
function pas(d) {
|
||
if (!I.sel) return;
|
||
var src = I.voyage && I.voyage.mode === 'bulle' ? I.voyage.source : null, l = src ? I.frames.filter(function (f) { return f.source === src; }) : I.frames, i = -1, j;
|
||
for (j = 0; j < l.length; j++) if (l[j].id === I.sel.id) i = j;
|
||
var n = l[clamp(i + d, 0, l.length - 1)]; if (!n || n.id === I.sel.id) return;
|
||
if (bous) bous.animer('xw', d > 0 ? 12 : -12);
|
||
selectionner(n, true);
|
||
if (I.voyage && I.voyage.mode === 'bulle' && n.source === I.voyage.source) allerA(n);
|
||
}
|
||
|
||
{{-- ── le HUBLOT : voyager dans un ploxion ── --}}
|
||
function hublot(montrer) { var hb = z('hublot'); if (hb) hb.hidden = !montrer; attrs(); }
|
||
function fermerVoyage() {
|
||
if (I.voyage) { demonter(I.voyage.h); I.voyage = null; }
|
||
var hh = z('hubhost'); if (hh) hh.innerHTML = '';
|
||
I.confirme = null; hublot(false);
|
||
setTimeout(function () { if (!I.mort) bandeauCoeur(); }, 0);
|
||
}
|
||
function ploxionDe(src) {
|
||
var t = T(), pid = null; try { pid = t.lier ? t.lier(src) : null; } catch (e) {}
|
||
if (!pid && A.peut && A.peut(src)) pid = src;
|
||
if (!pid && src === 'p4') pid = 'pourriture-4';
|
||
return pid;
|
||
}
|
||
function voyager(f) {
|
||
if (!f) return;
|
||
fermerVoyage();
|
||
var hh = z('hubhost'), h = null;
|
||
try { h = T().voir(f.source, f.id, hh, {}); } catch (e) { erreurMsg(e); return; }
|
||
I.voyage = { mode: 'bulle', h: h, source: f.source, frame: f };
|
||
hublot(true); rendreHublotTete(); setTimeout(function () { if (!I.mort) bandeauCoeur(); }, 0);
|
||
if (bous) bous.animer('zw', 90); {{-- ±Z : on entre dans le ploxion --}}
|
||
if (h && h.ready && h.ready.then) h.ready.then(function () { if (!I.mort) rendreHublotTete(); }, function (e) { if (!I.mort) erreurMsg(e); });
|
||
try { var hb = z('hublot'); if (hb && hb.scrollIntoView && I.orient === 'debout') hb.scrollIntoView({ block: 'nearest' }); } catch (e2) {}
|
||
}
|
||
function allerA(f) {
|
||
if (!I.voyage || I.voyage.mode !== 'bulle') return;
|
||
I.voyage.frame = f;
|
||
try { var p = I.voyage.h.aller(f.id); if (p && p.then) p.then(function () { if (!I.mort) rendreHublotTete(); }, function () {}); } catch (e) { erreurMsg(e); }
|
||
rendreHublotTete();
|
||
}
|
||
function rendreHublotTete() {
|
||
var el = z('hubtete'); if (!el || !I.voyage) return;
|
||
var v = I.voyage, h = '', posee = null; try { posee = T().posee(v.source); } catch (e) {}
|
||
if (v.mode === 'bulle') {
|
||
var n = 0; try { n = (v.h && v.h.retenues ? v.h.retenues() : []).length; } catch (e) {}
|
||
h += '<span class="mat-v">' + ICO.oeil + ' <b>' + esc(v.source) + '</b> à ' + esc(fmtT(v.frame.t)) + ' · <span class="mat-voix">une bulle : ' + (n ? n + ' écriture' + (n > 1 ? 's' : '') + ' retenue' + (n > 1 ? 's' : '') : 'rien ne touche le réel') + '</span></span>';
|
||
h += '<div class="mat-btns"><button type="button" class="mat-b" data-act="prec" aria-label="instant d’avant">' + ICO.prec + '</button><button type="button" class="mat-b" data-act="suiv" aria-label="instant d’après">' + ICO.suiv + '</button>' +
|
||
'<button type="button" class="mat-b mat-b--futur" data-act="brancher"' + (v.frame.kind !== 'etat' ? ' disabled' : '') + '>' + fourche(L('brancher ici')) + '</button>' +
|
||
'<button type="button" class="mat-b" data-act="hub-fermer">✕ ' + L('fermer') + '</button></div>';
|
||
if (I.nommer && I.nommer.hub && I.nommer.frame === v.frame.id) h += formNom('brancher-ok', 'branche du ' + fmtJ(v.frame.t));
|
||
} else {
|
||
var br = brancheDe(v.br) || { id: v.br, nom: v.nom, source: v.source }, estPosee = v.isole || (posee && posee.id === br.id); {{-- isolé : le hublot EST dans la branche --}}
|
||
h += '<span class="mat-v" style="color:var(--m-futur)">' + fourche(estPosee ? 'dans la branche « ' + esc(br.nom) + ' »' : 'branche « ' + esc(br.nom) + ' » (pas posée)') + ' · <span class="mat-voix">' + esc(br.source) + ' — rien ne touche le réel</span></span>';
|
||
h += '<div class="mat-btns"><button type="button" class="mat-b mat-b--plein" data-act="appliquer" data-br="' + esc(br.id) + '">' + L('appliquer au réel') + '…</button>' +
|
||
'<button type="button" class="mat-b" data-act="reel">↩ ' + L('revenir au réel') + '</button></div>';
|
||
if (I.confirme && I.confirme.br === br.id) h += confirmeHtml(br);
|
||
}
|
||
if (M3) h += M3.hub(v);
|
||
el.innerHTML = h;
|
||
}
|
||
function confirmeHtml(br) {
|
||
return '<div class="mat__confirme" role="alertdialog" aria-label="appliquer au réel"><span>Appliquer « ' + esc(br.nom) + ' » au réel ? <span class="mat-voix">Chaque clé qui diffère est écrite dans ton boxion et devient une nouvelle frame : l’ancien état reste dans le temps, rien n’est perdu.</span></span>' +
|
||
(M3 ? M3.confirme(br) : '') + '<div class="mat-btns"><button type="button" class="mat-b mat-b--plein" data-act="appliquer-ok" data-br="' + esc(br.id) + '">oui, appliquer</button><button type="button" class="mat-b" data-act="appliquer-non">annuler</button></div></div>';
|
||
}
|
||
function creerBranche(nom) {
|
||
var f = I.nommer && I.nommer.frame ? (trouverFrame(I.nommer.frame) || (I.voyage && I.voyage.frame && I.voyage.frame.id === I.nommer.frame ? I.voyage.frame : null)) : null;
|
||
if (!f) return;
|
||
var v = I.voyage, p;
|
||
if (v && v.mode === 'bulle' && v.frame.id === f.id && v.h && v.h.retenues && v.h.retenues().length) p = v.h.garder(nom); {{-- la bulle + ce qu'on y a écrit --}}
|
||
else p = T().brancher(f.id, nom);
|
||
I.nommer = null;
|
||
return Promise.resolve(p).then(function (br) {
|
||
if (!br) throw new Error('branche non créée');
|
||
I.selBr = br.id; I.branches.push(br); sale('branches');
|
||
msg('branche « ' + br.nom + ' » créée — tu peux y travailler sans toucher le réel');
|
||
if (I.vue === 'sablier') { rendreSablier(); proposerTravail(br); }
|
||
return br;
|
||
}).catch(erreurMsg);
|
||
}
|
||
function proposerTravail(br) {
|
||
var el = z('instr'); if (!el) return;
|
||
var d = D.createElement('div'); d.className = 'mat__confirme';
|
||
d.innerHTML = '<span>' + fourche('« ' + esc(br.nom) + ' » est prête.') + ' <span class="mat-voix">Y travailler : le ploxion s’ouvre dans le hublot, posé sur la branche ; il y lit et y écrit, le reste de la page ne quitte pas le réel.</span></span><div class="mat-btns"><button type="button" class="mat-b mat-b--futur" data-act="travailler" data-br="' + esc(br.id) + '">' + fourche(L('travailler dans la branche')) + '</button></div>';
|
||
el.appendChild(d);
|
||
}
|
||
function travaillerDans(id) {
|
||
var br = brancheDe(id); if (!br) return Promise.resolve(null);
|
||
var t = T();
|
||
if (t && typeof t.travailler === 'function' && !eteint(ls('xb:temps.isole'))) { {{-- relecture adverse 25.09 : le hublot ISOLÉ (autre royaume JS, stockage sous cloche) — --}}
|
||
fermerVoyage(); {{-- la pose de toute la page laissait fuir localStorage et mémoire (jOSStore, état de module) --}}
|
||
var hh0 = z('hubhost'), h0 = null;
|
||
try { h0 = t.travailler(br.id, hh0, {}); } catch (e) { erreurMsg(e); return Promise.resolve(null); }
|
||
I.voyage = { mode: 'branche', isole: true, h: h0, source: br.source, br: br.id, nom: br.nom };
|
||
if (I.vue !== 'sablier' && !M3) changerVue('sablier'); {{-- v3 : le grand hublot couvre toutes les vues — on reste où l'on était (la convergence, les lignes) --}}
|
||
hublot(true); rendreHublotTete(); rendreTete();
|
||
if (bous) bous.animer('yw', 60); {{-- le 5e axe : on change de branche --}}
|
||
return Promise.resolve(h0 && h0.ready).then(function () { if (!I.mort) rendreHublotTete(); return h0; }, function (e) { if (!I.mort) erreurMsg(e); });
|
||
}
|
||
return t.poser(br.id).then(function () { {{-- un cœur plus ancien (sans travailler) : la pose de toute la page --}}
|
||
fermerVoyage();
|
||
var pid = ploxionDe(br.source), hh = z('hubhost'), h = null;
|
||
if (pid && A.monter) h = A.monter(pid, hh, { machine: true, branche: br.id, temps: { branche: br.id, source: br.source } });
|
||
else if (pid && A[pid] && A[pid].mount) h = A[pid].mount(hh, { machine: true, branche: br.id });
|
||
else apercuBranche(br, hh);
|
||
I.voyage = { mode: 'branche', h: h, source: br.source, br: br.id, nom: br.nom };
|
||
if (I.vue !== 'sablier') changerVue('sablier');
|
||
hublot(true); rendreHublotTete(); rendreTete();
|
||
if (bous) bous.animer('yw', 60); {{-- le 5e axe : on change de branche --}}
|
||
}).catch(erreurMsg);
|
||
}
|
||
function apercuBranche(br, el) {
|
||
el.innerHTML = '<div class="mat__vide">' + fourche('« ' + esc(br.nom) + ' »') + ' : aucun ploxion connu pour « ' + esc(br.source) + ' » — voici l’état de la branche.</div><pre class="mat-v" style="margin:0 12px 12px;white-space:pre-wrap" data-z="apercu">…</pre>';
|
||
T().etatA(br.source, null, { branche: br.id }).then(function (o) { var p = el.querySelector('[data-z="apercu"]'); if (p) { var s = ''; try { s = JSON.stringify(o, null, 1) || ''; } catch (e) { s = String(o); } p.textContent = s.length > 20000 ? s.slice(0, 20000) + '\n…' : s; } }, function () {});
|
||
}
|
||
function revenirAuReel() {
|
||
var v0 = I.voyage;
|
||
if (v0 && v0.mode === 'branche' && v0.isole) { {{-- le hublot isolé se referme ; la page n'a jamais quitté le réel (une pose de toute la page garde son bandeau) --}}
|
||
demonter(v0.h); var hh0 = z('hubhost'); if (hh0) hh0.innerHTML = '';
|
||
I.voyage = null; I.confirme = null; hublot(false);
|
||
msg('↩ revenu au réel — la branche « ' + v0.nom + ' » reste dans le temps');
|
||
rendreTete(); rendreVue(true);
|
||
if (bous) bous.animer('yw', -60);
|
||
return Promise.resolve(null);
|
||
}
|
||
return T().poser(null).then(function () {
|
||
var v = I.voyage;
|
||
if (v && v.mode === 'branche') { {{-- le même ploxion, maintenant sur le réel --}}
|
||
demonter(v.h); var hh = z('hubhost'); if (hh) hh.innerHTML = '';
|
||
var pid = ploxionDe(v.source);
|
||
I.voyage = null; hublot(false);
|
||
if (pid) msg('↩ revenu au réel — « ' + v.source + ' » relit le réel');
|
||
}
|
||
rendreTete(); rendreVue(true);
|
||
if (bous) bous.animer('yw', -60);
|
||
}).catch(erreurMsg);
|
||
}
|
||
function appliquer(id) {
|
||
var br = brancheDe(id); if (!br) return;
|
||
I.confirme = null;
|
||
return (M3 ? M3.appliquer(id) : T().appliquer(id)).then(function (r) { {{-- v3 : si le réel a bougé depuis la fourche, CONVERGER (par défaut) ; « remplacer » coché : l'avant --}}
|
||
if (r && r.horsLigne) { msg('hors ligne : sans compte, il n’y a pas de réel côté boxion (rien n’est écrit)', true); return r; }
|
||
if (r && r.ok === false) { msg('appliqué en partie : une écriture a été refusée — réessaie', true); }
|
||
else msg('« ' + br.nom + ' » appliquée au réel : ' + ((r && r.ecrites) || []).length + ' clé' + (((r && r.ecrites) || []).length > 1 ? 's' : '') + ' écrite' + (((r && r.ecrites) || []).length > 1 ? 's' : '') + ((r && r.ignorees && r.ignorees.length) ? ', ' + r.ignorees.length + ' ignorée(s) (trop grosses ou élaguées)' : '') + ' · rien n’est perdu');
|
||
sale('branches'); sale('frames', br.source);
|
||
rendreHublotTete(); if (I.vue === 'branches') rendreBranches();
|
||
return r;
|
||
}).catch(erreurMsg);
|
||
}
|
||
|
||
{{-- ═════════════ LES PISTES : des sabliers debout ═════════════ --}}
|
||
function ageDe(p) { return p.dernier && p.premier ? Math.max(0, p.dernier - p.premier) : 0; }
|
||
function stade(p) { var n = p.n || 0, j = ageDe(p) / 864e5; if (n >= 250 || (n >= 60 && j >= 30)) return 'ultra tsoin'; if (n >= 60 || j >= 7) return 'vieux tsoin'; if (n >= 8) return 'jeune tsoin'; return 'bébé tsoin'; }
|
||
function taille(p) { var n = p.n || 0, hres = ageDe(p) / 36e5; return Math.round(clamp(26 + Math.log(1 + n) / Math.LN2 * 4.2 + Math.log(1 + hres) / Math.LN10 * 5, 26, 76)); }
|
||
function rendrePistes() {
|
||
var el = z('pistes'); if (!el) return;
|
||
var l = I.pistes, h = '<p class="mat-voix" style="margin:0 0 8px">un sablier debout par piste : il grandit avec son âge et ce qu’il contient. Une piste = son temps ; deux = on les relie par la portion et on les combine.</p>';
|
||
if (!l.length) h += '<div class="mat__vide">aucune piste encore : écris quelque chose dans un ploxion (connecté : dans ton boxion ; sinon dans ce navigateur)</div>';
|
||
h += '<div class="mat__pistes">' + l.map(function (p) {
|
||
var on = I.pistesSel.indexOf(p.source) >= 0, code = p.source === 'code';
|
||
return '<button type="button" class="mat__piste" data-act="piste" data-src="' + esc(p.source) + '" aria-pressed="' + on + '" data-taille="' + (code ? 28 : taille(p)) + '">' + badge(p.icon, code ? 28 : taille(p)) +
|
||
'<b>' + esc(p.label) + '</b><small>' + (code ? 'à la demande' : esc(p.n) + ' frame' + (p.n > 1 ? 's' : '')) + '</small>' +
|
||
(code ? '' : '<small class="mat-age">' + esc(stade(p)) + '</small>') + (p.dernier ? '<small>' + esc(fmtJ(p.dernier)) + '</small>' : '') + '</button>';
|
||
}).join('') + '</div>';
|
||
var s = I.pistesSel;
|
||
if (s.length === 1) {
|
||
var p1 = nomPiste(s[0]) || { source: s[0], label: s[0], icon: '▣', n: 0 };
|
||
h += '<div class="mat__combi mat__carte"><div class="mat__ligne"><span class="mat-k">' + L('son temps à elle') + '</span><span class="mat-v">' + esc(p1.icon) + ' ' + esc(p1.label) + ' · ' + esc(p1.n || 0) + ' frames' + (p1.premier ? ' · depuis ' + esc(fmtJ(p1.premier)) : '') + '</span></div>' +
|
||
(p1.source === 'code' ? '<form class="mat__nom" data-act-form="code"><input class="mat-in" data-z="codeid" placeholder="id d’un ploxion (ex. pourriture-4)" aria-label="ploxion dont on lit le code"><button type="submit" class="mat-b">' + ICO.horloge + ' son code</button></form>' : '') +
|
||
'<div class="mat-btns"><button type="button" class="mat-b mat-b--plein" data-act="son-sablier" data-src="' + esc(p1.source) + '">' + ICO.sab + ' ' + L('son sablier') + '</button><button type="button" class="mat-b" data-act="deja" data-src="' + esc(p1.source) + '">' + ICO.sab + ' ' + L('déjà-vu') + '</button></div><div data-z="dejaliste"></div>' +
|
||
'<p class="mat-voix" style="margin:0">choisis une deuxième piste pour les combiner</p></div>';
|
||
} else if (s.length === 2) {
|
||
h += '<div class="mat__combi mat__carte" data-z="combi">' + portionSvg(s[0], s[1]) + (I.combi && I.combi.cle === s.join('\u0001') ? opsHtml() : '<div class="mat__vide">' + ICO.sab + ' la combinaison se calcule…</div>') + '</div>';
|
||
}
|
||
el.innerHTML = h;
|
||
if (s.length === 2 && !(I.combi && I.combi.cle === s.join('\u0001'))) combiner(s[0], s[1], s.join('\u0001'));
|
||
}
|
||
function portionSvg(a, b) { {{-- deux sabliers debout, reliés en haut par la barre de portion (« comm via portion »), un wormion entre eux --}}
|
||
var pa = nomPiste(a) || { label: a, icon: '▣' }, pb = nomPiste(b) || { label: b, icon: '▣' };
|
||
function sab(x) { return '<path class="m-mur" d="M' + (x - 34) + ' 30H' + (x + 34) + 'L' + (x + 2) + ' 70V72L' + (x + 34) + ' 112H' + (x - 34) + 'L' + (x - 2) + ' 72V70Z"/><circle class="m-pt" cx="' + x + '" cy="71" r="3"/>'; }
|
||
return '<div class="mat__portion"><svg viewBox="0 0 400 150" role="img" aria-label="deux pistes reliées par la portion">' +
|
||
'<line class="m-bar" x1="90" y1="18" x2="310" y2="18"/><text x="200" y="12" text-anchor="middle">portion</text>' + sab(100) + sab(300) +
|
||
'<path class="m-worm" d="M140 71c10-14 24-14 30 0s20 14 30 0 20-14 30 0 20 14 30 0"/>' +
|
||
'<text x="100" y="134" text-anchor="middle">' + esc(pa.icon) + ' ' + esc(String(pa.label).slice(0, 22)) + '</text><text x="300" y="134" text-anchor="middle">' + esc(pb.icon) + ' ' + esc(String(pb.label).slice(0, 22)) + '</text></svg></div>';
|
||
}
|
||
function opsHtml() {
|
||
var r = I.combi.res || [], max = 1;
|
||
r.forEach(function (x) { max = Math.max(max, (x.frames || []).length); });
|
||
var h = '<div class="mat__ou" role="group" aria-label="cinq résultats possibles">';
|
||
r.forEach(function (x, i) {
|
||
if (i) h += '<em>ou</em>';
|
||
var lab = OPS.filter(function (o) { return o[0] === x.op; })[0];
|
||
h += '<button type="button" class="mat__op" data-act="op" data-op="' + esc(x.op) + '" aria-pressed="' + (I.combi.choisi === x.op) + '" title="' + esc(x.resume) + '">' + miniSablier((x.frames || []).length, max) + '<b>' + esc(x.op) + '</b><small>' + esc(lab ? lab[1] : '') + '</small><small>' + (x.frames || []).length + ' frames</small></button>';
|
||
});
|
||
h += '</div><p class="mat-voix" style="margin:0">« )( + )( = tsoin ou tsoin ou tsoin » : en choisir un = une branche (seules les frames d’état se branchent)</p>';
|
||
if (I.combi.choisi && I.nommer && I.nommer.op) h += formNom('op-ok', I.combi.choisi + ' · ' + I.combi.noms);
|
||
return h;
|
||
}
|
||
function combiner(a, b, cle, noms) {
|
||
var jeton = (I.combiJeton = (I.combiJeton || 0) + 1);
|
||
return T().combiner(a, b).then(function (res) {
|
||
if (I.mort || jeton !== I.combiJeton) return;
|
||
I.combi = { cle: cle, a: a, b: b, res: res || [], choisi: null, noms: noms || (String(a).slice(0, 14) + ' + ' + String(b).slice(0, 14)) };
|
||
if (I.vue === 'pistes') rendrePistes(); else if (I.vue === 'branches') rendreBranches();
|
||
if (bous) bous.animer('yw', 30);
|
||
}).catch(function (e) { if (!I.mort && jeton === I.combiJeton) { I.combi = { cle: cle, res: [], erreur: true }; erreurMsg(e); } });
|
||
}
|
||
function choisirOp(op) {
|
||
if (!I.combi) return;
|
||
I.combi.choisi = op; I.nommer = { op: op };
|
||
if (I.vue === 'pistes') rendrePistes(); else if (I.vue === 'branches') rendreBranches(); else { changerVue(I.combi.b && /^br:/.test(I.combi.b) ? 'branches' : 'pistes'); }
|
||
var inp = root.querySelector('[data-z="nom"]'); if (inp && inp.focus) { try { inp.focus(); } catch (e) {} }
|
||
}
|
||
function brancherOp(nom) {
|
||
if (!I.combi || !I.combi.choisi) return;
|
||
var r = (I.combi.res || []).filter(function (x) { return x.op === I.combi.choisi; })[0]; if (!r) return;
|
||
I.nommer = null;
|
||
return T().brancher(r, nom).then(function (br) {
|
||
I.branches.push(br); I.selBr = br.id; sale('branches');
|
||
msg('« ' + br.nom + ' » : la combinaison ' + r.op + ' est une branche');
|
||
I.combi.choisi = null;
|
||
if (I.vue === 'pistes') rendrePistes(); else rendreBranches();
|
||
return br;
|
||
}).catch(function (e) { erreurMsg(e); if (I.vue === 'pistes') rendrePistes(); else rendreBranches(); });
|
||
}
|
||
|
||
{{-- ═════════════ ⑂ LES BRANCHES : le graphe du cahier p.9 ═════════════ --}}
|
||
function graphe() {
|
||
var bv = branchesVisibles(), W0 = Math.max(320, Math.min(1100, (root.clientWidth || W.innerWidth || 800) - 24)), H0 = 64 + 38 * (bv.length + 1), now = Date.now();
|
||
var t0 = now, i;
|
||
bv.forEach(function (b) { var td = tDe(b.de) || b.cree || now; if (td < t0) t0 = td; });
|
||
t0 = Math.min(t0, now - 60000);
|
||
var xL = 16, xR = W0 - 118, X = function (t) { return xL + (xR - xL) * clamp((t - t0) / Math.max(1, now - t0), 0, 1); };
|
||
var yR = 30, posee = null; try { posee = T().posee(); } catch (e) {}
|
||
var lanes = {}, out = ['<svg viewBox="0 0 ' + W0 + ' ' + H0 + '" role="img" aria-label="le graphe des branches">'];
|
||
out.push('<path class="m-reel" d="M' + xL + ' ' + yR + 'H' + xR + '"/><text x="' + xL + '" y="' + (yR - 10) + '">le réel · moi</text>');
|
||
bv.forEach(function (b, k) { lanes[b.id] = 30 + 38 * (k + 1); });
|
||
bv.forEach(function (b) {
|
||
var y = lanes[b.id], yp = b.parent && lanes[b.parent] ? lanes[b.parent] : yR, xd = X(tDe(b.de) || b.cree || now), xc = X(b.cree || now), xe = Math.max(xc + 24, X(posee && posee.id === b.id ? now : (b.appliquee || b.cree || now)));
|
||
xe = Math.min(xe, xR);
|
||
var cls = 'm-lane' + (posee && posee.id === b.id ? ' m-lane--pose' : '') + (I.selBr === b.id ? ' m-lane--sel' : '');
|
||
out.push('<path class="' + cls + '" d="M' + f1(xd) + ' ' + yp + 'C' + f1(xd + 18) + ' ' + yp + ' ' + f1(xd + 6) + ' ' + y + ' ' + f1(xd + 28) + ' ' + y + 'H' + f1(xe) + '"/>');
|
||
if (b.appliquee) { var xa = X(b.appliquee); out.push('<path class="m-merge" d="M' + f1(Math.max(xa, xd + 28)) + ' ' + y + 'C' + f1(xa + 20) + ' ' + y + ' ' + f1(xa + 10) + ' ' + yR + ' ' + f1(xa + 30) + ' ' + yR + '"/>'); }
|
||
for (i = -1; i <= 1; i++) out.push('<line class="m-fan" x1="' + f1(xe) + '" y1="' + y + '" x2="' + f1(xe + 16) + '" y2="' + (y + i * 7) + '"/>'); {{-- au bout : l'éventail --}}
|
||
out.push('<rect class="m-cible" data-act="br-sel" data-br="' + esc(b.id) + '" x="' + f1(xd) + '" y="' + (y - 14) + '" width="' + f1(Math.max(60, xe - xd + 20)) + '" height="28"/>');
|
||
var aDroite = xd > xL + (xR - xL) * 0.62;
|
||
out.push('<text class="m-nom" data-act="br-sel" data-br="' + esc(b.id) + '" x="' + f1(aDroite ? xd - 6 : xd + 32) + '" y="' + (y - 6) + '"' + (aDroite ? ' text-anchor="end"' : '') + '>' + esc(String(b.nom).slice(0, 40)) + etoiles(b) + (b.appliquee ? ' ✓' : '') + '</text>');
|
||
});
|
||
out.push('<circle class="m-now" cx="' + xR + '" cy="' + yR + '" r="5"/><text x="' + (xR + 9) + '" y="' + (yR + 4) + '" style="fill:var(--m-ambre)">maintenant</text>');
|
||
{{-- tout le faisceau finit en éventail, là où commence l'incertitude --}}
|
||
for (i = 0; i < 7; i++) out.push('<line class="m-fan" x1="' + xR + '" y1="' + yR + '" x2="' + (xR + 40) + '" y2="' + (yR - 18 + i * 6 + (bv.length ? 0 : 0)) + '"/>');
|
||
out.push('</svg>');
|
||
return out.join('');
|
||
}
|
||
function rendreBranches() {
|
||
var el = z('branches'); if (!el) return;
|
||
var posee = null; try { posee = T().posee(); } catch (e) {}
|
||
var bv = branchesVisibles(), h = '';
|
||
h += '<p class="mat-voix" style="margin:0 0 8px">les lignes se séparent = fork (une branche à toi, en bac à sable) ; elles se rejoignent = synchronisées (appliquée au réel). Jamais rien n’est détruit : on masque.</p>';
|
||
h += '<div class="mat__graphe mat__carte">' + graphe() + '</div>';
|
||
h += '<div class="mat__ligne" style="margin-top:10px"><span class="mat-k">' + I.branches.length + ' branche' + (I.branches.length > 1 ? 's' : '') + '</span>' +
|
||
'<label style="display:inline-flex;align-items:center;gap:6px;min-height:40px"><input type="checkbox" data-act="masquees"' + (I.montrerMasquees ? ' checked' : '') + '> montrer les masquées (' + I.masquees.filter(function (id) { return !!brancheDe(id); }).length + ')</label>' +
|
||
(I.compare.length === 2 ? '<button type="button" class="mat-b" data-act="comparer">⇄ ' + L('comparer') + '</button><button type="button" class="mat-b" data-act="br-combiner">' + L('combiner') + ' (5 « ou »)</button>' : '<span class="mat-voix">coche deux branches pour les comparer ou les combiner</span>') + '</div>';
|
||
if (I.diff) h += diffHtml();
|
||
if (I.combi && I.combi.cle && /^br:/.test(I.combi.a || '')) h += '<div class="mat__combi mat__carte">' + (I.combi.res ? opsHtml() : '<div class="mat__vide">' + ICO.sab + ' la combinaison se calcule…</div>') + '</div>';
|
||
if (!I.branches.length) h += '<div class="mat__vide">aucune branche : dans le sablier, pose-toi sur un instant et « brancher ici »</div>';
|
||
h += '<ul class="mat__brl">' + bv.slice().reverse().map(function (b) {
|
||
var pose = posee && posee.id === b.id, masq = I.masquees.indexOf(b.id) >= 0, sel = I.selBr === b.id, cmp = I.compare.indexOf(b.id) >= 0;
|
||
return '<li class="' + (sel ? 'sel ' : '') + (pose ? 'pose ' : '') + (masq ? 'masquee' : '') + '" data-br="' + esc(b.id) + '">' +
|
||
'<div class="mat__ligne"><b data-act="br-sel" data-br="' + esc(b.id) + '" style="cursor:pointer">' + fourche(esc(b.nom) + etoiles(b)) + '</b><span class="mat-v">' + esc(b.source) + ' · ' + esc(b.n || 0) + ' écriture' + ((b.n || 0) > 1 ? 's' : '') + '</span>' +
|
||
(pose ? '<span class="mat-k" style="color:var(--m-futur)">posée</span>' : '') + (b.appliquee ? '<span class="mat-k" style="color:var(--m-vert)">appliquée ' + esc(fmtJ(b.appliquee)) + '</span>' : '') + (b.combi ? '<span class="mat-k">' + esc(b.combi.op || 'combinaison') + '</span>' : '') + '</div>' +
|
||
'<div class="mat-v" style="opacity:.75">créée ' + esc(fmtT(b.cree)) + (b.de ? ' · depuis l’instant ' + esc(fmtT(tDe(b.de))) : '') + (b.parent ? ' · fille d’une branche' : '') + '</div>' +
|
||
'<div class="mat-btns">' + (pose ? '<button type="button" class="mat-b" data-act="reel">↩ ' + L('revenir au réel') + '</button>' : '<button type="button" class="mat-b mat-b--futur" data-act="travailler" data-br="' + esc(b.id) + '">' + fourche(L('travailler dedans')) + '</button>') +
|
||
'<button type="button" class="mat-b" data-act="appliquer" data-br="' + esc(b.id) + '">' + L('appliquer au réel') + '…</button>' +
|
||
'<label><input type="checkbox" data-act="br-cmp" data-br="' + esc(b.id) + '"' + (cmp ? ' checked' : '') + '> comparer</label>' +
|
||
'<button type="button" class="mat-b" data-act="' + (masq ? 'br-montrer' : 'br-masquer') + '" data-br="' + esc(b.id) + '">' + (masq ? 'montrer' : 'masquer') + '</button>' +
|
||
'<button type="button" class="mat-b" data-act="br-reel" data-br="' + esc(b.id) + '">⇄ ' + L('et le réel') + '</button></div>' +
|
||
(I.confirme && I.confirme.br === b.id ? confirmeHtml(b) : '') + '</li>';
|
||
}).join('') + '</ul>';
|
||
el.innerHTML = h;
|
||
}
|
||
function choisirBranche(id) {
|
||
I.selBr = id;
|
||
if (bous) bous.animer('yw', 24);
|
||
if (I.vue === 'branches') { rendreBranches(); return; }
|
||
var br = brancheDe(id); if (!br) return;
|
||
if (I.vue === 'sablier') {
|
||
rendreSablier();
|
||
var el = z('instr'); if (!el) return;
|
||
var d = D.createElement('div'); d.className = 'mat__confirme';
|
||
d.innerHTML = '<span>' + fourche('« ' + esc(br.nom) + ' »') + ' <span class="mat-v">' + esc(br.source) + ' · ' + esc(br.n || 0) + ' écriture(s) · créée ' + esc(fmtJ(br.cree)) + '</span></span>' +
|
||
'<div class="mat-btns"><button type="button" class="mat-b mat-b--futur" data-act="travailler" data-br="' + esc(br.id) + '">' + fourche(L('travailler dedans')) + '</button><button type="button" class="mat-b" data-act="vue" data-v="branches">' + L('toutes les branches') + '</button></div>';
|
||
el.appendChild(d);
|
||
}
|
||
}
|
||
function comparer(a, b) { {{-- deux branches (ou une branche et le réel, b = null) : les clés en plus, en moins, changées --}}
|
||
var ba = brancheDe(a), bb = b ? brancheDe(b) : null; if (!ba) return;
|
||
if (bb && bb.source !== ba.source) { msg('ces deux branches n’ont pas la même source : rien à comparer clé à clé', true); return; }
|
||
var t = T();
|
||
Promise.all([t.etatA(ba.source, null, { branche: ba.id }), b ? t.etatA(bb.source, null, { branche: bb.id }) : t.etatA(ba.source, null)]).then(function (r) {
|
||
var A1 = r[0] || {}, B1v = r[1] || {}, lignes = [], k, vu = {};
|
||
function j(x) { try { return JSON.stringify(x); } catch (e) { return String(x); } }
|
||
for (k in A1) { vu[k] = 1; if (!(k in B1v)) lignes.push(['moins', k, j(A1[k]), '']); else if (j(A1[k]) !== j(B1v[k])) lignes.push(['change', k, j(A1[k]), j(B1v[k])]); }
|
||
for (k in B1v) if (!vu[k]) lignes.push(['plus', k, '', j(B1v[k])]);
|
||
I.diff = { a: ba.nom, b: bb ? bb.nom : 'le réel', lignes: lignes, n: Object.keys(A1).length };
|
||
if (I.vue !== 'branches') changerVue('branches'); else rendreBranches();
|
||
}).catch(erreurMsg);
|
||
}
|
||
function diffHtml() {
|
||
var d = I.diff, court = function (s) { s = String(s || ''); return s.length > 160 ? s.slice(0, 160) + '…' : s; };
|
||
return '<div class="mat__diff" data-z="diff"><div class="mat__ligne"><span class="mat-k">⇄ comparer</span><span class="mat-v">' + fourche(esc(d.a)) + ' ⇄ ' + esc(d.b) + '</span><button type="button" class="mat-b" data-act="diff-fermer" aria-label="fermer la comparaison">✕</button></div>' +
|
||
(d.lignes.length ? '<div class="mat__diffbox"><table><tr><th></th><th>clé</th><th>' + esc(d.a) + '</th><th>' + esc(d.b) + '</th></tr>' + d.lignes.map(function (l) {
|
||
return '<tr class="' + l[0] + '"><td>' + (l[0] === 'plus' ? '+' : l[0] === 'moins' ? '−' : '≠') + '</td><td>' + esc(l[1]) + '</td><td>' + esc(court(l[2])) + '</td><td>' + esc(court(l[3])) + '</td></tr>';
|
||
}).join('') + '</table></div>' : '<span class="mat-voix">identiques : aucune clé ne diffère</span>') + '</div>';
|
||
}
|
||
|
||
{{-- ═════════════ ▣ LE CUBE 4D ═════════════ --}}
|
||
function rendreCubeTete() {
|
||
var el = z('cubetete'); if (!el) return;
|
||
var C = cube(), pis = I.pistes.filter(function (p) { return p.n && p.source !== 'code'; }), h = '';
|
||
h += '<p class="mat-voix" style="margin:0 0 8px">« dérouler un tsoin, en faire un cube, dérouler le cube » : les frames empilées en un volume x·y·t. Rien n’est stocké : le cube vit en mémoire.</p>';
|
||
if (!C) h += '<div class="mat__vide">le cube 4D (jOSCube4D) n’est pas chargé sur cette page</div>';
|
||
else {
|
||
h += '<div class="mat__ligne"><span class="mat-k">' + L('source') + '</span><div class="mat-btns">' +
|
||
'<label class="mat-b" style="position:relative">' + ICO.film + ' ' + L('un fichier vidéo') + '<input type="file" accept="video/*" data-z="cubefichier" style="position:absolute;inset:0;opacity:0;cursor:pointer" aria-label="choisir un fichier vidéo"></label>' +
|
||
'<button type="button" class="mat-b" data-act="cube-camera">' + ICO.camera + ' ' + L('la caméra') + ' (4 s)</button>' +
|
||
'<button type="button" class="mat-b" data-act="cube-clips">' + ICO.rec + ' ' + L('un clip') + '</button></div></div>' +
|
||
'<div class="mat__ligne"><span class="mat-k">' + L('ou les frames d’une piste') + '</span><select class="mat-sel" data-z="cubepiste" aria-label="piste à mettre en cube">' +
|
||
pis.map(function (p) { return '<option value="' + esc(p.source) + '"' + ((I.cube && I.cube.source === p.source) || (!I.cube && I.filtre === p.source) ? ' selected' : '') + '>' + esc(p.icon) + ' ' + esc(p.label) + ' · ' + esc(p.n) + '</option>'; }).join('') +
|
||
'</select><button type="button" class="mat-b mat-b--plein" data-act="cube-piste"' + (pis.length ? '' : ' disabled') + '>' + ICO.sab + '→' + ICO.cube + ' ' + L('en faire un cube') + '</button></div>' +
|
||
'<div data-z="cubeclips"></div><div class="mat__prog" data-z="cubeprog" hidden><i></i></div>' +
|
||
'<div class="mat-v" data-z="cubeinfo" style="margin-top:6px;opacity:.8">' + (I.cube ? esc(I.cube.info) : 'palier ' + esc(C.palier ? safePalier(C) : I.palier) + ' · au plus ' + esc(budgetCube(C).frames) + ' frames de ' + esc(budgetCube(C).largeur) + ' px') + '</div>';
|
||
}
|
||
el.innerHTML = h;
|
||
}
|
||
function safePalier(C) { try { return C.palier(); } catch (e) { return I.palier; } }
|
||
function budgetCube(C) { try { return C.budget(); } catch (e) { return { frames: 64, largeur: 120 }; } }
|
||
function progres(x) { var p = z('cubeprog'); if (!p) return; p.hidden = !(x < 1); var i = p.querySelector('i'); if (i) i.style.width = Math.round(clamp(x, 0, 1) * 100) + '%'; }
|
||
function monterCube(vol, source, info, frames) {
|
||
var C = cube(), hostC = z('cubehost'); if (!C || !hostC) return;
|
||
if (I.cube && I.cube.h) demonter(I.cube.h);
|
||
hostC.innerHTML = '';
|
||
var h = null;
|
||
try { h = C.monter(hostC, vol, { vue: I.palier === 'T0' ? 'fente' : 'cube', t: 1 }); } catch (e) { erreurMsg(e); return; }
|
||
var mem = 0; try { mem = C.memoire ? C.memoire(vol) : vol.octets; } catch (e) { mem = vol.octets || 0; }
|
||
I.cube = { h: h, vol: vol, source: source, frames: frames || null, info: info + ' · ' + vol.largeur + '×' + vol.hauteur + '×' + vol.frames + ' · ' + fmtO(mem) + ' en mémoire · palier ' + (vol.palier || I.palier) };
|
||
var ie = z('cubeinfo'); if (ie) ie.textContent = I.cube.info;
|
||
progres(1);
|
||
}
|
||
function cubeDepuisPiste(src) {
|
||
var C = cube(); if (!C || !src) return;
|
||
var run = ++I.cubeRun, b = budgetCube(C), W1 = b.largeur, H1 = Math.round(W1 * 0.62);
|
||
progres(0.02);
|
||
T().frames(src, { limite: b.frames }).then(function (l) {
|
||
if (I.mort || run !== I.cubeRun) return null;
|
||
l = (l || []).slice(-b.frames);
|
||
if (!l.length) throw new Error('cette piste n’a pas de frame');
|
||
var p = nomPiste(src) || { icon: '▣', label: src }, cartes = l.map(function (f) { return carte(f, W1, H1, p); });
|
||
return C.depuisImages(cartes, { frames: b.frames, largeur: W1, temps: l.map(function (f) { return (f.t - l[0].t) / 1000; }), etiquettes: l.map(function (f) { return fmtT(f.t) + ' · ' + (f.cle || f.kind) + ' · ' + (f.resume || ''); }), progres: progres })
|
||
.then(function (vol) { if (!I.mort && run === I.cubeRun) monterCube(vol, src, (p.icon + ' ' + p.label + ' · ' + l.length + ' frames rendues en cartes'), l); });
|
||
}).catch(function (e) { progres(1); erreurMsg(e); });
|
||
}
|
||
function carte(f, w, h, p) { {{-- une frame d'un ploxion rendue en petite carte (le résumé : l'état passé n'a pas de describe()) --}}
|
||
var c = D.createElement('canvas'); c.width = w; c.height = h;
|
||
var k = null; try { k = c.getContext('2d'); } catch (e) { k = null; }
|
||
if (!k || typeof k.fillRect !== 'function') return c;
|
||
var hu = 180 + hash(f.hash || f.id) % 120, fs = Math.max(7, Math.round(h / 8));
|
||
try {
|
||
k.fillStyle = '#010306'; k.fillRect(0, 0, w, h);
|
||
k.fillStyle = 'hsl(' + hu + ',60%,62%)'; k.fillRect(0, 0, Math.max(3, Math.round(w * 0.04)), h);
|
||
k.fillStyle = f.branche ? '#b89cff' : '#9edff5'; k.font = '600 ' + fs + 'px ui-monospace,monospace'; k.textBaseline = 'top';
|
||
k.fillText(fmtH(f.t), w * 0.08, h * 0.08);
|
||
k.fillStyle = 'rgba(225,247,255,.9)'; k.font = fs + 'px ui-sans-serif,system-ui,sans-serif';
|
||
k.fillText(String((p && p.icon ? p.icon + ' ' : '') + (f.cle || f.kind)).slice(0, 22), w * 0.08, h * 0.3);
|
||
k.fillStyle = 'rgba(193,227,240,.7)'; k.font = Math.max(6, fs - 1) + 'px ui-sans-serif,system-ui,sans-serif';
|
||
var r = String(f.resume || ''); k.fillText(r.slice(0, 26), w * 0.08, h * 0.52); k.fillText(r.slice(26, 52), w * 0.08, h * 0.68);
|
||
var bar = Math.min(1, Math.log(1 + (f.taille || 0)) / Math.log(1 + 524288));
|
||
k.fillStyle = 'hsl(' + hu + ',60%,62%)'; k.fillRect(w * 0.08, h * 0.88, (w * 0.84) * bar, Math.max(2, h * 0.04));
|
||
} catch (e2) {}
|
||
return c;
|
||
}
|
||
function cubeDepuisVideo(src, info) {
|
||
var C = cube(); if (!C) return;
|
||
var run = ++I.cubeRun; progres(0.02);
|
||
return C.depuisVideo(src, { progres: progres }).then(function (vol) { if (!I.mort && run === I.cubeRun) monterCube(vol, null, info); }).catch(function (e) { progres(1); erreurMsg(e); });
|
||
}
|
||
function cubeCamera() {
|
||
var C = cube(); if (!C) return;
|
||
var md = W.navigator && W.navigator.mediaDevices;
|
||
if (!md || !md.getUserMedia) { msg('pas de caméra ici', true); return; }
|
||
var run = ++I.cubeRun; progres(0.02);
|
||
md.getUserMedia({ video: true, audio: false }).then(function (flux) {
|
||
return C.depuisVideo(flux, { duree: 4, progres: progres }).then(function (vol) {
|
||
try { flux.getTracks().forEach(function (t) { t.stop(); }); } catch (e) {} {{-- les pistes nous appartiennent : on les arrête --}}
|
||
if (!I.mort && run === I.cubeRun) monterCube(vol, null, 'la caméra · 4 s');
|
||
}, function (e) { try { flux.getTracks().forEach(function (t) { t.stop(); }); } catch (x) {} throw e; });
|
||
}).catch(function (e) { progres(1); erreurMsg(e); });
|
||
}
|
||
function cubeClips() {
|
||
var el = z('cubeclips'); if (!el) return;
|
||
el.innerHTML = '<div class="mat__vide">les clips…</div>';
|
||
T().frames('media', { limite: 30 }).then(function (l) {
|
||
l = (l || []).filter(function (f) { var r = f.ref || {}; return /video|webm|mp4/.test(String(r.mime || r.type || '')) || r.src === 'screen' || r.src === 'cam'; });
|
||
el.innerHTML = l.length ? '<div class="mat-btns" style="margin-top:6px">' + l.slice().reverse().map(function (f) { return '<button type="button" class="mat-b" data-act="cube-clip" data-fid="' + esc(f.id) + '">' + ICO.film + ' ' + esc(fmtJ(f.t)) + ' · ' + esc(String(f.resume || '').slice(0, 30)) + '</button>'; }).join('') + '</div>'
|
||
: '<div class="mat__vide">aucun clip vidéo dans la piste media (« enregistrer » avec « écran », ou le ploxion record)</div>';
|
||
}, erreurMsg);
|
||
}
|
||
function cubeClip(fid) {
|
||
var C = cube(); if (!C) return;
|
||
var cache = D.createElement('div'); cache.style.cssText = 'position:fixed;left:-9999px;top:0;width:2px;height:2px;overflow:hidden';
|
||
D.body.appendChild(cache);
|
||
var h = T().voir('media', fid, cache, {}), fin = function () { demonter(h); if (cache.parentNode) cache.parentNode.removeChild(cache); };
|
||
progres(0.02);
|
||
Promise.resolve(h.ready).then(function () {
|
||
var v = cache.querySelector('video'); if (!v) throw new Error('ce clip n’est pas une vidéo lisible ici');
|
||
var run = ++I.cubeRun;
|
||
return C.depuisVideo(v, { progres: progres }).then(function (vol) { fin(); if (!I.mort && run === I.cubeRun) monterCube(vol, 'media', 'un clip'); });
|
||
}).catch(function (e) { fin(); progres(1); erreurMsg(e); });
|
||
}
|
||
|
||
{{-- ═════════════ ◈ LES GÉNÉRATIONS D'UI (C2) ═════════════ --}}
|
||
function rendreGens() {
|
||
var el = z('gens'); if (!el) return;
|
||
var l = I.gens.slice().sort(function (a, b) { return b.t - a.t; }), cour = l.filter(function (g) { return g.courante; })[0] || l[0] || null, prec = cour ? l.filter(function (g) { return g.t < cour.t; })[0] : null;
|
||
var h = '<p class="mat-voix" style="margin:0 0 8px">chaque génération d’UI est une frame de la piste « ui » : on avance sans peur, « revenir » ramène la précédente, et revenir crée une nouvelle génération (aucune n’est jamais supprimée).</p>';
|
||
h += '<div class="mat-btns"><button type="button" class="mat-b mat-b--plein" data-act="gen-prec"' + (prec ? ' data-id="' + esc(prec.id) + '"' : ' disabled') + '>' + ICO.retour + ' ' + L('revenir à la précédente') + '</button>' +
|
||
'<button type="button" class="mat-b" data-act="gen-garder">◈ ' + L('garder l’UI actuelle') + '</button></div>';
|
||
if (I.recharger) h += '<div class="mat__confirme"><span>certaines clés (fenêtres, carte, hypr…) se relisent au chargement.</span><div class="mat-btns"><button type="button" class="mat-b" data-act="recharger">⟳ recharger la page</button></div></div>';
|
||
h += l.length ? '<ul class="mat__gens">' + l.map(function (g) {
|
||
return '<li class="' + (g.courante ? 'cour' : '') + '"><span class="mat-v">◈ ' + esc(g.label) + (g.de ? ' <small style="opacity:.6">(retour)</small>' : '') + '</span><span class="mat-v" style="opacity:.7">' + esc(fmtT(g.t)) + '</span>' +
|
||
(g.courante ? '<span class="mat-k" style="color:var(--m-ambre)">courante</span>' : '<button type="button" class="mat-b" data-act="gen-revenir" data-id="' + esc(g.id) + '">' + ICO.retour + ' revenir ici</button>') + '</li>';
|
||
}).join('') + '</ul>' : '<div class="mat__vide">aucune génération encore : « garder l’UI actuelle » crée la génération 0</div>';
|
||
el.innerHTML = h;
|
||
}
|
||
function genRevenir(id) {
|
||
return T().generations.revenir(id).then(function (r) {
|
||
I.recharger = !!(r && r.recharger);
|
||
msg('↩ génération rejointe' + (r && r.cles && r.cles.length ? ' · ' + r.cles.length + ' réglage(s) remis' : '') + ' — c’est une nouvelle génération, rien n’est écrasé');
|
||
sale('gens'); return T().generations.liste().then(function (l) { I.gens = l || []; if (I.vue === 'generations') rendreGens(); });
|
||
}).catch(erreurMsg);
|
||
}
|
||
function genGarder() {
|
||
return T().generations.suivante('UI du ' + fmtJ(Date.now())).then(function (g) {
|
||
msg('◈ génération gardée : ' + (g && g.label ? g.label : ''));
|
||
return T().generations.liste().then(function (l) { I.gens = l || []; if (I.vue === 'generations') rendreGens(); });
|
||
}).catch(erreurMsg);
|
||
}
|
||
|
||
{{-- ═════════════ ▤ LE TIROIR : les autres vues, montées vivantes ═════════════ --}}
|
||
function tiroirOuvrir(ouvrir) {
|
||
var el = z('tiroir'); if (!el) return;
|
||
I.tir.ouvert = ouvrir; el.hidden = !ouvrir;
|
||
if (!ouvrir) { tiroirDemonter(); }
|
||
else { rendreTiroir(); if (animOk(I.palier)) { el.classList.remove('entre'); void el.offsetWidth; el.classList.add('entre'); } if (bous) bous.animer('xw', 90); }
|
||
rendreVues();
|
||
}
|
||
function rendreTiroir() {
|
||
var el = z('tirliste'); if (!el) return;
|
||
el.innerHTML = TIROIR.map(function (t) {
|
||
var m = manifeste(t[0]), ok = !!(A.peut ? A.peut(t[0]) : (A[t[0]] && A[t[0]].mount)), nom = (m && m.name) || t[2], ic = (m && m.icon) || t[1];
|
||
if (!ok) return '<a class="indispo" href="/px/' + esc(t[0]) + '" target="_blank" rel="noopener" title="pas disponible dans cette page (réservé, ou débranché) : ouvrir seul">' + '<span>' + esc(ic) + ' ' + esc(nom) + ' ↗</span><small>' + esc(t[3]) + '</small></a>';
|
||
return '<button type="button" data-act="tir-monter" data-id="' + esc(t[0]) + '" aria-pressed="' + (I.tir.id === t[0]) + '"><span>' + esc(ic) + ' ' + esc(nom) + '</span><small>' + esc(t[3]) + '</small></button>';
|
||
}).join('');
|
||
}
|
||
function tiroirDemonter() { if (I.tir.h) demonter(I.tir.h); I.tir.h = null; I.tir.id = null; var hh = z('tirhost'); if (hh) hh.innerHTML = ''; }
|
||
function tiroirMonter(id) {
|
||
if (I.tir.id === id) return;
|
||
tiroirDemonter();
|
||
var hh = z('tirhost'); if (!hh) return;
|
||
I.tir.id = id;
|
||
try {
|
||
if (A.monter) I.tir.h = A.monter(id, hh, { embed: true, machine: true, host: ID });
|
||
else if (A[id] && A[id].mount) I.tir.h = A[id].mount(hh, { embed: true, machine: true, host: ID });
|
||
} catch (e) { hh.innerHTML = '<div class="mat__vide">⚠ « ' + esc(id) + ' » : ' + esc(e && e.message) + '</div>'; }
|
||
rendreTiroir();
|
||
if (bous) bous.animer('zw', 45);
|
||
}
|
||
|
||
{{-- ═════════════ ⏺ ⏹ : enregistrer, sceller, chronomètre, minuteur ═════════════ --}}
|
||
function naissance(fin) { var n = root.querySelector('[data-z="nait"]'); if (!n || !animOk(I.palier)) return; n.classList.remove('nait'); n.classList.remove('fin'); void n.offsetWidth; n.classList.add(fin ? 'fin' : 'nait'); }
|
||
function battre() { {{-- le chronomètre ne bat qu'en enregistrant, page visible (1 s) ; rien d'autre --}}
|
||
if (I.chrono) { clearTimeout(I.chrono); I.chrono = 0; }
|
||
if (!I.rec || I.mort) return;
|
||
var c = root.querySelector('[data-z="chrono"]'); if (c) c.textContent = fmtChrono(Date.now() - I.rec.t0);
|
||
if (D.hidden) return;
|
||
I.chrono = setTimeout(battre, 1000);
|
||
}
|
||
function enregistrer() {
|
||
var media = root.querySelector('[data-z="media"]'), sm = root.querySelector('[data-z="minuteur"]'), ms = sm ? +sm.value || 0 : 0;
|
||
I.minuteurMs = ms;
|
||
return T().enregistrer('', { media: !!(media && media.checked) }).then(function (r) {
|
||
var t0 = (r && r.t0) || Date.now();
|
||
try { var s = W.jOSSession && W.jOSSession.current && W.jOSSession.current(); if (s && s.t0) t0 = s.t0; } catch (e) {}
|
||
I.rec = { id: r && r.id, t0: t0 };
|
||
if (ms > 0) { I.minuteur = Date.now() + ms; if (I.tMinuteur) clearTimeout(I.tMinuteur); I.tMinuteur = setTimeout(function () { I.tMinuteur = 0; if (!I.mort && I.rec) sceller(true); }, ms); }
|
||
rendreTete(); naissance(false); battre();
|
||
msg('le tsoin s’enregistre : tes actions' + (media && media.checked ? ' et l’écran' : '') + (ms ? ' · arrêt dans ' + fmtChrono(ms) : ''));
|
||
}).catch(erreurMsg);
|
||
}
|
||
function sceller(auto) {
|
||
naissance(true);
|
||
return T().sceller().then(function (r) {
|
||
I.rec = null; I.minuteur = 0; if (I.tMinuteur) { clearTimeout(I.tMinuteur); I.tMinuteur = 0; } battre();
|
||
rendreTete();
|
||
msg('tsoin scellé' + (auto ? ' (minuteur)' : '') + (r && r.frames ? ' · ' + r.frames.length + ' frame' + (r.frames.length > 1 ? 's' : '') : '') + (r && r.session ? ' · ' + (r.session.counts ? r.session.counts.actions : 0) + ' actions' : ''));
|
||
sale('frames', 'actions'); sale('frames', 'media');
|
||
}).catch(erreurMsg);
|
||
}
|
||
function enregistrementEnCours() {
|
||
try { var x = T().describe(); if (x && x.items && x.items.some(function (i) { return i.kind === 'action' && /sceller/.test(i.label || ''); })) return true; } catch (e) {}
|
||
try { return !!(W.jOSSession && W.jOSSession.isOn && W.jOSSession.isOn()); } catch (e2) { return false; }
|
||
}
|
||
|
||
{{-- ═════════════ réglages : l'écriture en glyphes, le budget, les kill-switches ═════════════ --}}
|
||
function rendreReglages() {
|
||
var el = z('reg'); if (!el) return;
|
||
var b = I.budget, C = codec(), h = '<div class="mat__ligne"><b style="flex:1">⚙ réglages</b><button type="button" class="mat-b" data-act="reg" aria-label="fermer">✕</button></div>';
|
||
h += '<div><div class="mat-k">l’écriture en glyphes' + (C ? '' : ' (codec absent ici)') + '</div><div class="mat__puces" role="group">' +
|
||
[['', 'éteinte'], ['toujours', 'glyphes + français'], ['survol', 'français au survol'], ['jamais', 'glyphes seuls']].map(function (x) { return '<button type="button" data-act="glyphes" data-g="' + x[0] + '" aria-pressed="' + (I.glyphes === x[0]) + '"' + (!C && x[0] ? ' disabled' : '') + '>' + esc(x[1]) + '</button>'; }).join('') + '</div></div>';
|
||
if (b) {
|
||
var pc = b.max ? Math.min(100, b.utilise / b.max * 100) : 0;
|
||
h += '<div><div class="mat__ligne"><span class="mat-k">stockage du temps</span><span class="mat-v">' + esc(fmtO(b.utilise)) + ' / ' + esc(fmtO(b.max)) + ' · ' + esc(b.frames) + ' frames · ' + esc(b.mode === 'boxion' ? 'ton boxion' : 'ce navigateur') + '</span></div><div class="mat__jauge"><i style="width:' + f1(pc) + '%"></i></div>' +
|
||
'<table>' + Object.keys(b.parPiste || {}).map(function (s) { var x = b.parPiste[s]; return '<tr><td>' + esc(s) + '</td><td>' + esc(x.n) + ' / ' + esc(x.maxFrames) + '</td><td>' + esc(fmtO(x.octets)) + ' / ' + esc(fmtO(x.maxOctets)) + '</td></tr>'; }).join('') + '</table>' +
|
||
'<p class="mat-voix" style="margin:4px 0 0">au-delà, le cœur élague les plus vieilles frames — jamais l’état courant, les branches ni les générations</p>' +
|
||
(b.plein ? '<p class="mat-voix" style="margin:4px 0 0">plein : si les frames qu’on ne peut pas élaguer dépassent ' + esc(fmtO(b.plafond || b.max)) + ', les nouvelles ne gardent que leur empreinte (le réel, lui, n’est pas touché)</p>' : '') + '</div>';
|
||
}
|
||
h += '<div class="mat-v" style="opacity:.7">palier ' + esc(I.palier) + ' · ' + esc(I.orient === 'couche' ? 'sablier couché' : 'sablier debout') + '<br>kill-switches : xb:machine=off · xb:temps=off · xb:machine.cube=off · xb:machine.tiroir=off · xb:machine.boussole=off · xb:machine.anim=off</div>';
|
||
el.innerHTML = h;
|
||
}
|
||
|
||
{{-- ═════════════ les gestes (délégation) ═════════════ --}}
|
||
function surClic(e) {
|
||
var b = e.target && e.target.closest ? e.target.closest('[data-act]') : null; if (!b || !root.contains(b)) return;
|
||
var a = b.getAttribute('data-act'), br = b.getAttribute('data-br');
|
||
if (b.tagName === 'INPUT' && b.type === 'checkbox') return; {{-- les cases passent par 'change' --}}
|
||
switch (a) {
|
||
case 'vue': changerVue(b.getAttribute('data-v')); break;
|
||
case 'tiroir': tiroirOuvrir(!I.tir.ouvert); break;
|
||
case 'tir-fermer': tiroirOuvrir(false); break;
|
||
case 'tir-monter': tiroirMonter(b.getAttribute('data-id')); break;
|
||
case 'reg': { var r = z('reg'); r.hidden = !r.hidden; if (!r.hidden) rendreReglages(); break; }
|
||
case 'avant-verser': case 'avant-ignorer': avantGeste(a.slice(6), b); break;
|
||
case 'glyphes': I.glyphes = b.getAttribute('data-g') || ''; lsSet('xb:machine:glyphes', I.glyphes || null); rendreTout(); rendreReglages(); break;
|
||
case 'fen': I.fen = b.getAttribute('data-f'); I.xp.fenAvant = null; if (I.fen !== 'mes') lsSet('xb:machine:fenetre', I.fen); chargerFrames().then(function () { if (!I.mort) rendreSablier(); }); break;
|
||
case 'xp-stop': { var X1 = XP(); if (X1) X1.arreter(); break; }
|
||
case 'xp-choisir': { var X2 = XP(); if (X2) { X2.choisir(+b.getAttribute('data-i'), +b.getAttribute('data-v')); xpMaj(); } break; }
|
||
case 'xp-son': { var X3 = XP(); if (X3) { var so = X3.sonif(); X3.sonif(!so.actif || so.muet); xpMaj(); } break; }
|
||
case 'xp-phrase': { var X4 = XP(); if (X4) { X4.phrase(+b.getAttribute('data-n')); xpMaj(); } break; }
|
||
case 'xp-synchro': { var P1 = PU(); if (P1 && typeof P1.demarrer === 'function') Promise.resolve(P1.demarrer()).then(function (r) { if (!I.mort && r && !r.ok && r.message) msg(r.message, true); xpMaj(); }); break; }
|
||
case 'xp-tap': { var P2 = PU(); if (P2 && typeof P2.tap === 'function') P2.tap(); xpMaj(); break; }
|
||
case 'prec': if (!(M3 && M3.pas && M3.pas(-1))) pas(-1); break; {{-- v3 : l'instant ouvert depuis les lignes avance dans SA ligne (relecture d'usage du 26.09) --}}
|
||
case 'suiv': if (!(M3 && M3.pas && M3.pas(1))) pas(1); break;
|
||
case 'voir': voyager(I.sel); break;
|
||
case 'brancher': { {{-- depuis le hublot : l'instant qu'on y voit ; depuis les instruments : l'instant où l'on est posé --}}
|
||
var dansHub = !!(b.closest && b.closest('[data-z="hubtete"]')), f = dansHub && I.voyage ? I.voyage.frame : I.sel;
|
||
if (f) { I.nommer = { frame: f.id, hub: dansHub }; if (dansHub) rendreHublotTete(); else rendreInstr(); var inp = (dansHub ? z('hubtete') : z('instr')).querySelector('[data-z="nom"]'); if (inp) { try { inp.focus(); inp.select(); } catch (x) {} } }
|
||
break;
|
||
}
|
||
case 'nom-annuler': I.nommer = null; if (I.combi) I.combi.choisi = null; rendreVue(true); break;
|
||
case 'hub-fermer': fermerVoyage(); rendreSablier(); break;
|
||
case 'travailler': travaillerDans(br); break;
|
||
case 'reel': revenirAuReel(); break;
|
||
case 'appliquer': I.confirme = { br: br }; if (I.voyage && I.voyage.mode === 'branche' && I.voyage.br === br && I.vue === 'sablier') rendreHublotTete(); else if (I.vue === 'branches') rendreBranches(); else { changerVue('branches'); } break;
|
||
case 'appliquer-ok': appliquer(br); break;
|
||
case 'appliquer-non': I.confirme = null; rendreHublotTete(); if (I.vue === 'branches') rendreBranches(); break;
|
||
case 'piste': {
|
||
var src = b.getAttribute('data-src'), i = I.pistesSel.indexOf(src);
|
||
if (i >= 0) I.pistesSel.splice(i, 1); else { I.pistesSel.push(src); if (I.pistesSel.length > 2) I.pistesSel.shift(); }
|
||
I.combi = null; I.nommer = null; rendrePistes();
|
||
if (bous) bous.animer('yz', 20);
|
||
break;
|
||
}
|
||
case 'son-sablier': {{-- une piste = SON temps, tout entier (une piste est bornée par le budget : 300 frames) --}}
|
||
I.filtre = b.getAttribute('data-src'); I.fen = 'tout'; I.sel = null;
|
||
chargerFrames().then(function () { if (!I.mort) changerVue('sablier'); if (I.vue === 'sablier' && !I.mort) rendreSablier(); }); break;
|
||
case 'deja': dejaVuListe(b.getAttribute('data-src')); break;
|
||
case 'op': choisirOp(b.getAttribute('data-op')); break;
|
||
case 'br-sel': choisirBranche(br); break;
|
||
case 'br-masquer': if (I.masquees.indexOf(br) < 0) I.masquees.push(br); lsSet('xb:machine:masquees', JSON.stringify(I.masquees.slice(-200))); rendreBranches(); break;
|
||
case 'br-montrer': I.masquees = I.masquees.filter(function (x) { return x !== br; }); lsSet('xb:machine:masquees', JSON.stringify(I.masquees)); rendreBranches(); break;
|
||
case 'br-reel': comparer(br, null); break;
|
||
case 'comparer': comparer(I.compare[0], I.compare[1]); break;
|
||
case 'br-combiner': { var x1 = brancheDe(I.compare[0]), x2 = brancheDe(I.compare[1]); if (x1 && x2) { I.combi = { cle: 'br:' + x1.id + '\u0001br:' + x2.id, a: 'br:' + x1.id, b: 'br:' + x2.id, res: null }; rendreBranches(); combiner('br:' + x1.id, 'br:' + x2.id, I.combi.cle, String(x1.nom).slice(0, 14) + ' + ' + String(x2.nom).slice(0, 14)); } break; }
|
||
case 'diff-fermer': I.diff = null; rendreBranches(); break;
|
||
case 'cube-camera': cubeCamera(); break;
|
||
case 'cube-clips': cubeClips(); break;
|
||
case 'cube-clip': cubeClip(b.getAttribute('data-fid')); break;
|
||
case 'cube-piste': { var sp = root.querySelector('[data-z="cubepiste"]'); cubeDepuisPiste(sp ? sp.value : I.filtre); break; }
|
||
case 'gen-prec': case 'gen-revenir': genRevenir(b.getAttribute('data-id')); break;
|
||
case 'gen-garder': genGarder(); break;
|
||
case 'recharger': try { W.location.reload(); } catch (x) {} break;
|
||
case 'rec': if (I.rec || enregistrementEnCours()) sceller(false); else enregistrer(); break;
|
||
case 'dv': { var s2 = b.getAttribute('data-src'); if (s2) { I.filtre = s2; I.vue = 'sablier'; I.cache = {}; chargerFrames().then(function () { if (!I.mort) rendreTout(); }); } break; }
|
||
default: if (M3) M3.clic(a, b, e);
|
||
}
|
||
}
|
||
function surChange(e) {
|
||
var t = e.target; if (!t || !root.contains(t)) return;
|
||
var a = t.getAttribute('data-act'), zz = t.getAttribute('data-z');
|
||
if (zz === 'filtre') { I.filtre = t.value || null; I.sel = null; I.planU = null; chargerFrames().then(function () { if (!I.mort) rendreSablier(); }); return; }
|
||
if (zz === 'cubefichier') { var f = t.files && t.files[0]; if (f) cubeDepuisVideo(f, 'vidéo · ' + f.name); return; }
|
||
if (zz === 'minuteur') { I.minuteurMs = +t.value || 0; return; }
|
||
if (a === 'masquees') { I.montrerMasquees = !!t.checked; rendreBranches(); if (I.vue === 'sablier') rendreSablier(); return; }
|
||
if (a === 'br-cmp') { var id = t.getAttribute('data-br'), i = I.compare.indexOf(id); if (t.checked && i < 0) { I.compare.push(id); if (I.compare.length > 2) I.compare.shift(); } else if (!t.checked && i >= 0) I.compare.splice(i, 1); rendreBranches(); }
|
||
}
|
||
function surSubmit(e) {
|
||
var f = e.target && e.target.closest ? e.target.closest('[data-act-form]') : null; if (!f || !root.contains(f)) return;
|
||
e.preventDefault();
|
||
var a = f.getAttribute('data-act-form'), inp = f.querySelector('[data-z="nom"]'), nom = inp ? String(inp.value || '').trim() : '';
|
||
if (a === 'xp') { var mi = f.querySelector('[data-z="xpmot"]'); xpDemarrer(mi ? String(mi.value || '').trim().slice(0, 80) : ''); }
|
||
else if (a === 'brancher-ok') creerBranche(nom || 'branche');
|
||
else if (a === 'op-ok') brancherOp(nom || 'combinaison');
|
||
else if (a === 'code') { var c = f.querySelector('[data-z="codeid"]'), pid = c ? String(c.value || '').trim().toLowerCase().replace(/[^a-z0-9-]/g, '') : ''; if (pid) { I.filtre = 'code:' + pid; I.fen = 'tout'; I.sel = null; chargerFrames().then(function () { if (!I.mort) changerVue('sablier'); if (!I.mort) rendreSablier(); }); } }
|
||
}
|
||
function dejaVuListe(src) {
|
||
var el = z('dejaliste'); if (!el) return;
|
||
T().dejaVu(src).then(function (l) {
|
||
el.innerHTML = l && l.length ? '<div class="mat-v" style="margin-top:6px">' + l.slice(0, 8).map(function (d) { return ICO.sab + ' déjà-vu ×' + esc(d.fois) + ' · #' + esc(String(d.hash).slice(0, 10)); }).join('<br>') + '</div>' : '<div class="mat__vide">aucun état revu deux fois</div>';
|
||
}, erreurMsg);
|
||
}
|
||
|
||
{{-- ═════════════ les demandes (jOSMachine, ctx, URL) ═════════════ --}}
|
||
function recevoir(d) {
|
||
if (!d || I.mort) return false;
|
||
if (!I.pret) { I.demande = d; return true; }
|
||
appliquerDemande(d); return true;
|
||
}
|
||
function appliquerDemande(d) {
|
||
var src = d.source ? String(d.source) : null, t = heureDe(d.t);
|
||
if (d.vue === 'lignes') d.vue = 'branches';
|
||
if (d.vue && (/^(cube|espace|page)$/.test(d.vue) || VUES.some(function (v) { return v[0] === d.vue; }))) I.vue = d.vue;
|
||
I.v3dem = d; if (M3) M3.demande(d);
|
||
if (src) { I.filtre = src; I.sel = null; if (t && depuis() && t < depuis()) I.fen = 'tout'; }
|
||
if (!src && !t) { rendreTout(); return; }
|
||
if (src || t) I.vue = d.vue && d.vue !== 'sablier' ? d.vue : 'sablier';
|
||
chargerFrames().then(function () {
|
||
if (I.mort) return;
|
||
var f = null;
|
||
if (t != null) {
|
||
var l = src ? I.frames.filter(function (x) { return x.source === src; }) : I.frames, i;
|
||
for (i = 0; i < l.length; i++) if (l[i].t <= t) f = l[i]; {{-- l'état qui valait à cet instant --}}
|
||
if (!f && l.length) f = l[0];
|
||
}
|
||
I.sel = f; rendreTout();
|
||
if (d.voyager && f) voyager(f);
|
||
});
|
||
}
|
||
|
||
{{-- ═════════════ montage ═════════════ --}}
|
||
I.clair = clair();
|
||
if (I.via === 'tsoin-4d') I.vue = 'cube';
|
||
if (ctx.vue === 'lignes') ctx.vue = 'branches';
|
||
if (ctx.vue && (/^(cube|espace|page)$/.test(ctx.vue) || VUES.some(function (v) { return v[0] === ctx.vue; }))) I.vue = ctx.vue;
|
||
if (!option('cube') && I.vue === 'cube') I.vue = 'sablier';
|
||
var qv = qs('vue'); if (qv === 'lignes') qv = 'branches'; if (qv && (/^(espace|page)$/.test(qv) || VUES.some(function (v) { return v[0] === qv; })) && !(qv === 'cube' && !option('cube'))) I.vue = qv;
|
||
if (qs('converger')) I.v3dem = { converger: qs('converger'), source: qs('source') };
|
||
var dem = null;
|
||
if (ctx.source || ctx.scope || ctx.t != null || ctx.voyager) dem = { source: ctx.source || ctx.scope || null, t: ctx.t, voyager: !!ctx.voyager };
|
||
else if (JM.__demande) { dem = JM.__demande; JM.__demande = null; }
|
||
else if (qs('source') || qs('t')) dem = { source: qs('source'), t: qs('t'), voyager: qs('voyager') === '1', vue: qs('vue') || undefined };
|
||
I.demande = dem;
|
||
if (enregistrementEnCours()) I.rec = { t0: (function () { try { var s = W.jOSSession && W.jOSSession.current && W.jOSSession.current(); return (s && s.t0) || Date.now(); } catch (e) { return Date.now(); } })() };
|
||
teteSquelette();
|
||
rendreTout();
|
||
if (I.rec) battre();
|
||
root.addEventListener('click', surClic);
|
||
root.addEventListener('change', surChange);
|
||
root.addEventListener('submit', surSubmit);
|
||
root.addEventListener('focusout', rattraper);
|
||
ecouter(W, 'xb:temps:frame', function (e) { var d = e.detail || {}; sale('frames', d.source); });
|
||
ecouter(W, 'xb:temps:branche', function () { sale('branches'); });
|
||
ecouter(W, 'xb:temps:pose', function () { if (!I.mort) { rendreTete(); if (I.voyage) rendreHublotTete(); setTimeout(function () { if (!I.mort) bandeauCoeur(); }, 0); } sale('branches'); });
|
||
ecouter(W, 'xb:temps:generation', function () { sale('gens'); });
|
||
ecouter(W, 'xb:temps:enregistre', function (e) { var d = e.detail || {}; if (d.on && !I.rec) { I.rec = { id: d.id, t0: Date.now() }; rendreTete(); battre(); } else if (!d.on && I.rec) { I.rec = null; rendreTete(); } });
|
||
ecouter(W, 'xb:temps:deja-vu', function (e) {
|
||
var d = e.detail || {}, el = root.querySelector('[data-z="dv"]'); if (!el) return;
|
||
el.hidden = false; el.innerHTML = ICO.sab + ' ' + esc('déjà-vu ×' + (+d.fois || 2) + ' · ' + String(d.source || '')); el.setAttribute('data-src', String(d.source || ''));
|
||
el.classList.remove('fond');
|
||
if (I.tDv) clearTimeout(I.tDv);
|
||
I.tDv = setTimeout(function () { I.tDv = 0; if (!I.mort) { el.classList.add('fond'); I.tDv = setTimeout(function () { I.tDv = 0; if (!I.mort) el.hidden = true; }, 700); } }, 7000);
|
||
});
|
||
ecouter(W, 'xb:puissance', function () { var p = palier(); if (p !== I.palier) { I.palier = p; attrs(); if (I.vue === 'sablier') rendreSablier(); } });
|
||
ecouter(D, 'visibilitychange', function () { if (!D.hidden && I.rec) battre(); });
|
||
(function () { {{-- l'orientation suit le cadre (debout / couché) : ResizeObserver, sinon resize ; 150 ms de calme --}}
|
||
function surTaille() { if (I.tTaille) clearTimeout(I.tTaille); I.tTaille = setTimeout(function () { I.tTaille = 0; if (I.mort) return; var o = orientation(); if (o !== I.orient) { I.orient = o; attrs(); if (I.vue === 'sablier') rendreSablier(); } }, 150); }
|
||
if (typeof W.ResizeObserver === 'function') { try { I.ro = new W.ResizeObserver(surTaille); I.ro.observe(root); } catch (e) { I.ro = null; } }
|
||
if (!I.ro) ecouter(W, 'resize', surTaille);
|
||
})();
|
||
if (I.via === 'ultimate-tsoin' || ctx.tiroir) tiroirOuvrir(true);
|
||
(function () { {{-- ♫ les événements de l'extrapolateur --}}
|
||
var X = XP(); if (!X) return;
|
||
I.xp.offs.push(X.on('propositions', function () { xpMaj(true); }));
|
||
I.xp.offs.push(X.on('mesure', function () { xpMaj(false); }));
|
||
I.xp.offs.push(X.on('arme', function () { xpMaj(false); }));
|
||
I.xp.offs.push(X.on('choix', function (c) { xpMaj(false); if (c && c.proposition) msg('♫ au temps fort : « ' + court(c.proposition.texte, 60) + ' »'); }));
|
||
I.xp.offs.push(X.on('etat', xpEtat));
|
||
})();
|
||
tout();
|
||
VIVANTS.push(ctl);
|
||
(function () { {{-- LA MACHINE v3 (docs/dev/29 « La machine v3 ») : les lignes, le grand hublot, la page, converger, l'espace-temps — public/js/machine-v3.js à la demande ; kill-switch xb:machine.v3=off --}}
|
||
if (!option('v3') || !T().v3) return;
|
||
function go() { if (I.mort || M3 || !W.__jOSMachineV3) return; M3 = W.__jOSMachineV3({ I: I, root: root, z: z, T: T, A: A, esc: esc, court: court, fmtT: fmtT, fmtJ: fmtJ, fmtAge: fmtAge, fmtO: fmtO, msg: msg, erreurMsg: erreurMsg, changerVue: changerVue, rendreVue: rendreVue, rendreVues: rendreVues, rendreTete: rendreTete,
|
||
rendreBranches: rendreBranches, rendreHublotTete: rendreHublotTete, voyager: voyager, fermerVoyage: fermerVoyage, hublot: hublot, travaillerDans: travaillerDans, appliquer: appliquer, brancheDe: brancheDe, nomPiste: nomPiste, trouverFrame: trouverFrame, sale: sale,
|
||
fourche: fourche, FOURCHE: FOURCHE, ICO: ICO, L: L, option: option, ls: ls, lsSet: lsSet, tDe: tDe, heureDe: heureDe, ploxionDe: ploxionDe, animOk: animOk, bous: function () { return bous; }, confirmeHtml: confirmeHtml, formNom: formNom, chargerFrames: chargerFrames, orientation: orientation }); root.classList.add('mat--v3'); if (M3) M3.demarrer(); }
|
||
if (W.__jOSMachineV3) return go();
|
||
var s = D.createElement('script'); s.src = '/js/machine-v3.js?v={{ max(is_file(public_path('js/machine-v3.js')) ? filemtime(public_path('js/machine-v3.js')) : 1, is_file(public_path('js/machine-3d.js')) ? filemtime(public_path('js/machine-3d.js')) : 1) }}'; s.async = true; s.onload = go; (D.head || D.documentElement).appendChild(s);
|
||
})();
|
||
|
||
function detruire() {
|
||
if (I.mort) return;
|
||
I.mort = true;
|
||
if (I.raf) { W.cancelAnimationFrame(I.raf); I.raf = 0; }
|
||
['tSale', 'tMsg', 'tDv', 'tTaille', 'chrono', 'tMinuteur'].forEach(function (k) { if (I[k]) { clearTimeout(I[k]); I[k] = 0; } });
|
||
if (I.xp.tMaj) { clearTimeout(I.xp.tMaj); I.xp.tMaj = 0; }
|
||
I.xp.offs.forEach(function (f) { try { f(); } catch (e) {} }); I.xp.offs = [];
|
||
if (I.xp.aMoi) { var Xm = XP(); try { if (Xm && Xm.etat().marche) Xm.arreter(); } catch (e) {} I.xp.aMoi = false; }
|
||
I.ecoute.forEach(function (x) { try { x[0].removeEventListener(x[1], x[2]); } catch (e) {} }); I.ecoute = [];
|
||
if (I.ro) { try { I.ro.disconnect(); } catch (e) {} I.ro = null; }
|
||
if (bous) { bous.detruire(); bous = null; }
|
||
if (I.voyage) { demonter(I.voyage.h); I.voyage = null; } {{-- la bulle se referme ; une branche posée le reste (le bandeau du cœur la montre) --}}
|
||
if (I.cube && I.cube.h) { demonter(I.cube.h); I.cube = null; }
|
||
tiroirDemonter();
|
||
root.removeEventListener('click', surClic); root.removeEventListener('change', surChange); root.removeEventListener('submit', surSubmit); root.removeEventListener('focusout', rattraper);
|
||
if (root.parentNode) root.parentNode.removeChild(root);
|
||
VIVANTS = VIVANTS.filter(function (x) { return x !== ctl; });
|
||
}
|
||
return ctl;
|
||
}
|
||
var GLY = {}; {{-- glyphes des libellés (cache : le codec est déterministe) --}}
|
||
|
||
{{-- ───────────────────────── describe() XUI ───────────────────────── --}}
|
||
function describe() {
|
||
var t = T(), items = [];
|
||
if (!t || tempsCoupe()) return { v: 1, id: ID, title: 'La machine à tsoins', icon: '⧗', items: [{ p: 1, kind: 'text', label: 'état', value: !t ? 'cœur absent' : 'cœur coupé (xb:temps=off)' }] };
|
||
var base = null; try { base = t.describe(); } catch (e) { base = null; }
|
||
var v = dernierVivant(), I = v && v.I;
|
||
(base && base.items || []).forEach(function (x) { if (x && x.p <= 2) items.push(x); });
|
||
if (I && I.pistes) items.push({ p: 2, kind: 'stat', label: 'pistes', value: I.pistes.filter(function (p) { return p.n; }).length });
|
||
if (I && I.branches) items.push({ p: 2, kind: 'stat', label: 'branches', value: I.branches.length });
|
||
try { if (W.__jOSMachineV3 && W.__jOSMachineV3.decrire) W.__jOSMachineV3.decrire(items); } catch (e) {}
|
||
(base && base.items || []).forEach(function (x) { if (x && x.p >= 3) items.push(x); });
|
||
items.push({ p: 3, kind: 'action', label: 'ouvrir la machine', act: { port: 'ploxion.machine-a-tsoins.cmd', payload: { cmd: 'ouvrir' } } });
|
||
return { v: 1, id: ID, title: 'La machine à tsoins', icon: '⧗', items: items };
|
||
}
|
||
|
||
{{-- ───────────────────────── les apps : la machine et ses deux alias ───────────────────────── --}}
|
||
function monter(host, ctx, via) {
|
||
if (!host || typeof host.appendChild !== 'function') return { unmount: function () {} };
|
||
var m = Machine(host, ctx || {}, via);
|
||
return { unmount: function () { m.detruire(); }, machine: m };
|
||
}
|
||
A[ID] = { manifest: { id: ID, name: 'La machine à tsoins', icon: '⧗' }, mount: function (h, c) { return monter(h, c, ID); }, describe: describe, __machine: true };
|
||
A['tsoin-4d'] = { manifest: { id: 'tsoin-4d', name: 'Tsoin 4D', icon: '▣' }, mount: function (h, c) { return monter(h, c, 'tsoin-4d'); }, describe: describe, __machine: true };
|
||
A['ultimate-tsoin'] = { manifest: { id: 'ultimate-tsoin', name: 'Ultimate tsoin', icon: '⧗' }, mount: function (h, c) { return monter(h, c, 'ultimate-tsoin'); }, describe: describe, __machine: true };
|
||
|
||
{{-- ───────────────────────── window.jOSMachine (la porte : partials/_machine_tsoins_bion) ───────────────────────── --}}
|
||
JM.version = JM.version || VERSION;
|
||
JM.__vivant = function (d) { var v = dernierVivant(); if (!v || !v.demande) return false; return !!v.demande(d); };
|
||
function dem(d) { if (JM.__vivant(d)) return true; JM.__demande = d; try { if (W.jOS && W.jOS.openPloxion && W.jOS.openPloxion(ID)) return true; } catch (e) {} return false; }
|
||
function opts(d, o) { if (o && typeof o === 'object') ['vue', 'converger', 'ligne', 'ou', 'annuler'].forEach(function (k) { if (o[k] != null) d[k] = typeof o[k] === 'object' ? { faisceau: String(o[k].faisceau || '') } : String(o[k]).slice(0, 80); }); return d; }
|
||
if (typeof JM.ouvrir !== 'function') { {{-- page sans la porte (/px) : le même contrat, servi par le bundle --}}
|
||
JM.ouvrir = function (source, o) { return dem(opts({ source: source == null ? null : String(source) }, o)); };
|
||
JM.voyager = function (source, t) { return dem({ source: source == null ? null : String(source), t: t == null ? null : t, voyager: true }); };
|
||
}
|
||
if (typeof JM.lignes !== 'function') JM.lignes = function (source, o) { return JM.ouvrir(source, opts({ vue: 'lignes' }, o)); }; {{-- v3 : « son temps » (le ⧗ des fenêtres) --}}
|
||
if (typeof JM.ouvrirLigne !== 'function') JM.ouvrirLigne = function (id, o) { return JM.ouvrir(null, opts({ vue: 'lignes', ligne: id && id.faisceau ? { faisceau: id.faisceau } : id }, o)); };
|
||
{{-- le bus (XUI) : ploxion.machine-a-tsoins.cmd {cmd: 'ouvrir'|'voyager', source, t} --}}
|
||
(function () {
|
||
try {
|
||
var Pb = W.jOSPorts; if (!Pb || typeof Pb.on !== 'function') return;
|
||
Pb.on('ploxion.' + ID + '.cmd', function (p) {
|
||
if (typeof p === 'string') { try { p = JSON.parse(p); } catch (e) { p = { cmd: p }; } }
|
||
p = p || {};
|
||
if (p.cmd === 'voyager') JM.voyager(p.source, p.t); else if (p.cmd === 'ouvrir') JM.ouvrir(p.source); else if (p.cmd === 'lignes' || p.cmd === 'espace') JM.ouvrir(p.source, { vue: p.cmd });
|
||
});
|
||
} catch (e) {}
|
||
})();
|
||
})();
|
||
</script>
|