slidetake 0.4.4 → 0.4.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/dist/index.html +326 -145
- package/dist/slidetake.js +191 -157
- package/package.json +1 -1
package/dist/slidetake.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
/* Slidetake 0.4.
|
|
2
|
-
"use strict";(()=>{var
|
|
1
|
+
/* Slidetake 0.4.5 · https://slidetake.com · Apache-2.0 */
|
|
2
|
+
"use strict";(()=>{var V=(e,t)=>()=>(e&&(t=e(e=0)),t);var uo,Ir=V(()=>{uo=`---
|
|
3
3
|
title: Slidetake \u2014 write in markdown with AI, record without timeline editing
|
|
4
4
|
description: "Write a deck in markdown, with AI, present it on a spatial canvas, and record it slide by slide: retake any slide, pick the best take, download the video. Open source."
|
|
5
5
|
brand: slidetake
|
|
@@ -240,7 +240,7 @@ One line, \`accent: "#3b82f6"\`, gives a deck its own colour, shaded for dark an
|
|
|
240
240
|
</svg>
|
|
241
241
|
\`\`\`
|
|
242
242
|
|
|
243
|
-
Press
|
|
243
|
+
Press **<span class="st-rec">\u25CF Record</span>** (R). **Every slide is a take:** stumbled? Press \u2190 and say it again. Every attempt is kept, and recording carries on.
|
|
244
244
|
|
|
245
245
|
## \u2702\uFE0F Edit by picking the best take
|
|
246
246
|
|
|
@@ -365,7 +365,7 @@ Images next to the markdown load as they are. Save in any editor and the deck re
|
|
|
365
365
|
Open source, Apache 2.0: [github.com/slidetake/slidetake](https://github.com/slidetake/slidetake). Nothing to sign up for, and your decks stay yours: [Privacy](/privacy).
|
|
366
366
|
|
|
367
367
|
Next, every feature and what it saves you: **[Features \u2192](/features)**
|
|
368
|
-
`});var
|
|
368
|
+
`});var zr,Pr=V(()=>{zr=`---
|
|
369
369
|
title: Slidetake Docs
|
|
370
370
|
description: "How to use Slidetake, step by step: get started, write a deck, present it, record a video in the browser or with OBS, and share it."
|
|
371
371
|
brand: slidetake
|
|
@@ -537,11 +537,13 @@ Click a card to fly to it. Drag to pan; scroll or pinch to zoom. On a touch scre
|
|
|
537
537
|
| \u2193 \u2191 | first child / parent |
|
|
538
538
|
| O | the whole map; **O** again or Esc goes back |
|
|
539
539
|
| F | fullscreen; **F** again or Esc leaves |
|
|
540
|
-
| K or ? | these keys; again closes them |
|
|
540
|
+
| K, / or ? | these keys; again closes them |
|
|
541
541
|
| 1 2 3 4 | focus, path, radial, tree |
|
|
542
|
-
| + \u2212 | bigger / smaller slides (remembered) |
|
|
542
|
+
| + \u2212 | bigger / smaller slides (remembered; = works for +) |
|
|
543
543
|
| E \xB7 L | editor \xB7 light / dark |
|
|
544
|
-
| C \xB7 V
|
|
544
|
+
| C \xB7 V | camera \xB7 camera layouts |
|
|
545
|
+
| R \xB7 S | record \xB7 Studio |
|
|
546
|
+
| P \xB7 D | in Studio: preview \xB7 download |
|
|
545
547
|
|
|
546
548
|
### Layouts
|
|
547
549
|
|
|
@@ -567,7 +569,7 @@ With \`duration: 10m\` (or \`90s\`, \`1h\`, \`12:30\`), a lighter layer of the s
|
|
|
567
569
|
|
|
568
570
|
## 4\uFE0F\u20E3 Record a video
|
|
569
571
|
|
|
570
|
-
Two modes, both slide by slide, so there's no timeline to edit afterwards. **\u25CF
|
|
572
|
+
Two modes, both slide by slide, so there's no timeline to edit afterwards. **\u25CF Record** in the bottom bar (or **R**) starts a take: the first time it opens Setup, then it records the slides without a take. **\u25CF Studio** (or **S**) is for picking takes and redoing slides; its \u2699 Setup switches between the modes.
|
|
571
573
|
|
|
572
574
|
\`\`\`svg
|
|
573
575
|
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 960 330" font-family="IBM Plex Sans, system-ui, sans-serif">
|
|
@@ -627,10 +629,9 @@ Two modes, both slide by slide, so there's no timeline to edit afterwards. **\u2
|
|
|
627
629
|
|
|
628
630
|
### Easy mode: record in the browser
|
|
629
631
|
|
|
630
|
-
**\u25CF
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
2. **\u25CF Record**, and share **this tab** when the browser asks. Only the 16:9 frame is recorded: slides and camera.
|
|
632
|
+
1. **\u25CF Record** (R) the first time opens **\u2699 Setup**: pick your camera (or **No camera**) and microphone. Recording turns the camera on and off by itself.
|
|
633
|
+
2. **\u25CF Record** again, and share **this tab** when the browser asks. Only the 16:9 frame is recorded: slides and camera.
|
|
634
|
+
3. Next time, **\u25CF Record** carries on with the slides that have no take yet. When every slide has one, it records from the slide on screen to the end.
|
|
634
635
|
|
|
635
636
|
For 1080p the frame needs 1920\xD71080 real pixels (a Retina laptop has them); 1280\xD7720 makes 720p. Smaller: use pro mode.
|
|
636
637
|
|
|
@@ -655,10 +656,10 @@ Each take is a file in this browser's private storage until you purge it, in \u2
|
|
|
655
656
|
### Pro mode: set up OBS
|
|
656
657
|
|
|
657
658
|
1. In OBS: Tools \u2192 WebSocket Server Settings, turn it on.
|
|
658
|
-
2. In
|
|
659
|
+
2. In Studio's **\u2699 Setup**, turn on **Pro** (top right), enter OBS's host, port and password, and **Connect**. Tick *Remember*.
|
|
659
660
|
3. Present on a 16:9 screen, physical or virtual (say 1920\xD71080). Setup checks it.
|
|
660
661
|
|
|
661
|
-
Studio opens in the mode you used last
|
|
662
|
+
Studio opens in the mode you used last: its title says **Slidetake Studio Pro** in pro mode, with the size (\`1080p\`) beside it, and the camera and microphone a take uses on the right.
|
|
662
663
|
|
|
663
664
|
### A 16:9 screen
|
|
664
665
|
|
|
@@ -704,13 +705,13 @@ A comment in a slide changes the camera from that slide on:
|
|
|
704
705
|
<!-- camera: 18% flip --> \u2190 small, other side
|
|
705
706
|
\`\`\`
|
|
706
707
|
|
|
707
|
-
Words you can combine: \`on\`, \`off\`, \`full\`, a size like \`30%\`, a corner, \`flip\`, \`circle\` / \`rect\`, \`mirror\` / \`unmirror\`. List them with commas to step through them on one slide: \`full, on\` opens on you, and the next \u2192 shrinks the camera to its corner and shows the slide.
|
|
708
|
+
Words you can combine: \`on\`, \`off\`, \`full\`, \`behind\` (the camera fills the frame under the slide, which stays on top: a talking head with slides), a size like \`30%\`, a corner, \`flip\`, \`circle\` / \`rect\`, \`mirror\` / \`unmirror\`. List them with commas to step through them on one slide: \`full, on\` opens on you, and the next \u2192 shrinks the camera to its corner and shows the slide.
|
|
708
709
|
|
|
709
710
|
**V** steps through the deck's \`camera:\` list by hand.
|
|
710
711
|
|
|
711
712
|
### Take by take
|
|
712
713
|
|
|
713
|
-
**\u25CF Record** counts down and starts. From then on \u2192 drives everything: slides, reveals and camera moves (a Bluetooth clicker works).
|
|
714
|
+
**\u25CF Record** (R) counts down and starts. From then on \u2192 drives everything: slides, reveals and camera moves (a Bluetooth clicker works).
|
|
714
715
|
|
|
715
716
|
- **\u2190** takes the slide again. The deck goes back and replays the slide's entry, so whichever take you pick joins smoothly
|
|
716
717
|
- **B** (or **.**, a clicker's blank-screen key) pauses and resumes
|
|
@@ -744,8 +745,8 @@ In \u2699 Setup \u2192 Microphone:
|
|
|
744
745
|
|
|
745
746
|
| Setting | Does |
|
|
746
747
|
|---|---|
|
|
747
|
-
| **
|
|
748
|
-
| **
|
|
748
|
+
| **Voice** (default) | Chrome's noise suppression: fans, hum, steady noise |
|
|
749
|
+
| **Raw** | the mic as it is: for a good mic in a quiet room |
|
|
749
750
|
| **\u{1F50A} Volume boost** (on) | raises the voice to YouTube's \u221214 LUFS, never past a \u22121.5 dB peak |
|
|
750
751
|
| **Peak limiter** (off) | catches the few loud peaks, so the boost goes all the way |
|
|
751
752
|
|
|
@@ -782,7 +783,7 @@ Every deck you open is **read-only**: Slidetake's own decks, templates, files on
|
|
|
782
783
|
No accounts, and no decks kept. Recording stays on your device.
|
|
783
784
|
|
|
784
785
|
Next, everything that leaves your browser, and where it goes: **[Privacy \u2192](/privacy)**
|
|
785
|
-
`});var
|
|
786
|
+
`});var Dr,Rr=V(()=>{Dr=`---
|
|
786
787
|
title: Slidetake Features
|
|
787
788
|
description: "Every Slidetake feature, one line each: recording in the browser or with OBS, a map instead of a stack, the camera in the deck, plain markdown, your colours, and where it runs."
|
|
788
789
|
brand: slidetake
|
|
@@ -821,7 +822,7 @@ The complete list, one line each. Press \u2192 to walk it, **O** for the map.
|
|
|
821
822
|
| Feature | Advantage |
|
|
822
823
|
|---|---|
|
|
823
824
|
| **Webcam in its box** | you and the slides in one recording, no compositing |
|
|
824
|
-
| **Camera per slide** | corner, size, side, circle, full screen or off |
|
|
825
|
+
| **Camera per slide** | corner, size, side, circle, full screen, behind the slide or off |
|
|
825
826
|
| **Steps on one slide** | open on you, then reveal the slide |
|
|
826
827
|
| **Camera layouts** (V) | try them live, without editing the deck |
|
|
827
828
|
| **Off until you turn it on** | not shown to viewers: the slides get the whole screen |
|
|
@@ -892,7 +893,7 @@ For Safari, Firefox or any browser, a screen too small for easy mode, or whateve
|
|
|
892
893
|
| **Open source, Apache 2.0** | read it, host it, change it: [github.com/slidetake/slidetake](https://github.com/slidetake/slidetake) |
|
|
893
894
|
|
|
894
895
|
Next, see them working: **[Showcase \u2192](/showcase)**
|
|
895
|
-
`});var
|
|
896
|
+
`});var Nr,Fr=V(()=>{Nr=`---
|
|
896
897
|
title: Slidetake Privacy
|
|
897
898
|
brand: slidetake
|
|
898
899
|
pip: none
|
|
@@ -963,7 +964,7 @@ A shared link carries the whole deck after \`#\`. Browsers never send that part
|
|
|
963
964
|
## \u2709\uFE0F Questions
|
|
964
965
|
|
|
965
966
|
Open an issue on [github.com/slidetake/slidetake](https://github.com/slidetake/slidetake/issues). Slidetake is open source, so everything above can be checked in its code.
|
|
966
|
-
`});var
|
|
967
|
+
`});var jr,Hr=V(()=>{jr=`---
|
|
967
968
|
title: My deck
|
|
968
969
|
---
|
|
969
970
|
|
|
@@ -978,7 +979,7 @@ Every heading is a card. \`##\` sections branch from the first card.
|
|
|
978
979
|
### A detail
|
|
979
980
|
|
|
980
981
|
\`###\` branches from the section above it.
|
|
981
|
-
`});var
|
|
982
|
+
`});var Wr,_r=V(()=>{Wr=`---
|
|
982
983
|
title: Talk title
|
|
983
984
|
duration: 15m
|
|
984
985
|
---
|
|
@@ -1019,7 +1020,7 @@ Something concrete the audience will recognise.
|
|
|
1019
1020
|
## \u{1F64F} Thank you
|
|
1020
1021
|
|
|
1021
1022
|
Where to find you, and the link to these slides.
|
|
1022
|
-
`});var
|
|
1023
|
+
`});var qr,Ur=V(()=>{qr=`---
|
|
1023
1024
|
title: Video title
|
|
1024
1025
|
duration: 10m
|
|
1025
1026
|
pip: bottom-right
|
|
@@ -1068,7 +1069,7 @@ Slides you talk over in the corner.
|
|
|
1068
1069
|
<!-- camera: on, full, on, off -->
|
|
1069
1070
|
|
|
1070
1071
|
Ends on you full screen, then back to the slide, then without the camera.
|
|
1071
|
-
`});var
|
|
1072
|
+
`});var Vr,Gr=V(()=>{Vr=`---
|
|
1072
1073
|
title: Slidetake Showcase
|
|
1073
1074
|
description: "Everything a Slidetake deck can hold, working on screen: text, steps, code, Graphviz, D2, SVG, charts, image layouts, YouTube, the camera and the map."
|
|
1074
1075
|
brand: slidetake
|
|
@@ -1261,7 +1262,7 @@ A deck sets its own colour with one line, \`accent: "#3b82f6"\`, shaded for both
|
|
|
1261
1262
|
|
|
1262
1263
|
## \u2702\uFE0F Record a video
|
|
1263
1264
|
|
|
1264
|
-
Try it: press **\u25CF
|
|
1265
|
+
Try it: press **\u25CF Record** in the bottom bar, or **R**. Stumble on a slide, press \u2190, say it again; then pick the best take of each. Step by step: [Docs \u2192 Record a video](/docs#4-record-a-video).
|
|
1265
1266
|
|
|
1266
1267
|
## \u{1F310} Open from anywhere
|
|
1267
1268
|
|
|
@@ -1274,50 +1275,50 @@ Open **\u270E Editor** and press **New** for a template (blank, talk or recordin
|
|
|
1274
1275
|
The templates and this deck live in [examples/](https://github.com/slidetake/slidetake/tree/main/examples) on GitHub.
|
|
1275
1276
|
|
|
1276
1277
|
Next, how it all works, step by step: **[Docs \u2192](/docs)**
|
|
1277
|
-
`});function
|
|
1278
|
+
`});function nt(e){return e.toLowerCase().replace(/[^\p{L}\p{N}]+/gu,"-").replace(/^-+|-+$/g,"")||"card"}function Pt(e){return e.replace(/<[^>]*>/g,"").replace(/!?\[([^\]]*)\]\([^)]*\)/g,"$1").replace(/[*_`~]/g,"").trim()}function A(e){return String(e).replace(/[&<>"]/g,t=>({"&":"&","<":"<",">":">",'"':"""})[t])}function Yr(e){if(typeof document<"u"){let t=document.createElement("textarea");return t.innerHTML=e,t.value}return e.replace(/&(#x[\da-f]+|#\d+|\w+);/gi,(t,a)=>a[0]==="#"?String.fromCodePoint(a[1].toLowerCase()==="x"?parseInt(a.slice(2),16):parseInt(a.slice(1),10)):As[a.toLowerCase()]??t)}function zt(e){let t={};for(let a of e.matchAll(/([\w-]+)="([^"]*)"/g))t[a[1]]=a[2];return t}function Rt(e,t){let a=[[]],o=null;return e.split(`
|
|
1278
1279
|
`).forEach(r=>{let n=r.match(/^\s{0,3}(`{3,}|~{3,})/);n&&(o?n[1][0]===o[0]&&n[1].length>=o.length&&(o=null):o=n[1]),!o&&!n&&t.test(r)?a.push([]):a[a.length-1].push(r)}),a.map(r=>r.join(`
|
|
1279
|
-
`))}function
|
|
1280
|
+
`))}function Kr(e){let t=String(e??"").trim().toLowerCase();if(!t)return 0;let a=t.match(/^(\d+):(\d{1,2})$/);if(a)return(+a[1]*60+ +a[2])*1e3;if(a=t.match(/^(\d+(?:\.\d+)?)\s*(h|hrs?|hours?|m|mins?|minutes?|s|secs?|seconds?)?$/),!a)return 0;let o=(a[2]||"m")[0];return parseFloat(a[1])*(o==="h"?3600:o==="s"?1:60)*1e3}function fa(e){let t=Math.max(0,Math.round(e/1e3)),a=Math.floor(t/3600),o=Math.floor(t%3600/60),r=t%60;return(a?a+":"+String(o).padStart(2,"0"):o)+":"+String(r).padStart(2,"0")}function it(e){let t=Math.max(0,Math.round(e/1e3)),a=Math.floor(t/3600),o=Math.floor(t%3600/60),r=t%60;return a?a+"h "+String(o).padStart(2,"0")+"m":o?o+"m "+String(r).padStart(2,"0")+"s":r+"s"}var As,ma=V(()=>{"use strict";As={amp:"&",lt:"<",gt:">",quot:'"',apos:"'",nbsp:"\xA0",mdash:"\u2014",ndash:"\u2013",hellip:"\u2026",rsquo:"\u2019",lsquo:"\u2018",rdquo:"\u201D",ldquo:"\u201C"}});function $r(e){let t=null;return e.split(`
|
|
1280
1281
|
`).filter(a=>{let o=a.match(/^\s{0,3}(`{3,}|~{3,})/);return o?(t?o[1][0]===t[0]&&o[1].length>=t.length&&(t=null):t=o[1],!1):!t}).join(`
|
|
1281
|
-
`).replace(/`[^`\n]*`/g,"")}function
|
|
1282
|
-
`).forEach(r=>{let n=r.match(/^\s+-\s+(.*)$/);if(n&&o){t[o].push(n[1].trim().replace(/^["']|["']$/g,""));return}let i=r.match(/^([A-Za-z_][\w-]*)\s*:\s*(.*)$/);if(!i){o=null;return}let s=i[1].toLowerCase(),l=i[2].trim().replace(/^["']|["']$/g,"");l===""?(t[s]=[],o=s):(t[s]=l,o=null)}),{deck:t,body:e.slice(a[0].length)}}function
|
|
1282
|
+
`).replace(/`[^`\n]*`/g,"")}function fo(e){return/<!--\s*view\s*:\s*(overview|map)\s*-->/i.test($r(e))}function mo(e){let t=$r(e).match(/<!--\s*camera\s*:\s*([\s\S]*?)\s*-->/i);return t?t[1].trim():null}function Bs(e){let t={},a=e.match(/^---[ \t]*\n([\s\S]*?)\n---[ \t]*(?:\n|$)/);if(!a)return{deck:t,body:e};let o=null;return a[1].split(`
|
|
1283
|
+
`).forEach(r=>{let n=r.match(/^\s+-\s+(.*)$/);if(n&&o){t[o].push(n[1].trim().replace(/^["']|["']$/g,""));return}let i=r.match(/^([A-Za-z_][\w-]*)\s*:\s*(.*)$/);if(!i){o=null;return}let s=i[1].toLowerCase(),l=i[2].trim().replace(/^["']|["']$/g,"");l===""?(t[s]=[],o=s):(t[s]=l,o=null)}),{deck:t,body:e.slice(a[0].length)}}function Xr(e){let t=r=>typeof r=="string"||typeof r=="number"||typeof r=="boolean",a=r=>String(r).replace(/\s*\n\s*/g," "),o=[];for(let[r,n]of Object.entries(e||{}))/^[A-Za-z_][\w-]*$/.test(r)&&(t(n)?o.push(r+": "+a(n)):Array.isArray(n)&&n.every(t)&&(o.push(r+":"),n.forEach(i=>o.push(" - "+a(i)))));return o.length?`---
|
|
1283
1284
|
`+o.join(`
|
|
1284
1285
|
`)+`
|
|
1285
1286
|
---
|
|
1286
|
-
`:""}function
|
|
1287
|
+
`:""}function Os(e){let t=e.split(`
|
|
1287
1288
|
`),a={},o=e;if(t[0]!==void 0&&t[0].trim()==="---"){let r=-1;for(let n=1;n<t.length;n++)if(t[n].trim()==="---"){r=n;break}r!==-1&&(t.slice(1,r).forEach(n=>{let i=n.indexOf(":");i>-1&&(a[n.slice(0,i).trim()]=n.slice(i+1).trim().replace(/^["']|["']$/g,""))}),o=t.slice(r+1).join(`
|
|
1288
|
-
`).replace(/^\n+/,""))}return{meta:a,body:o}}function
|
|
1289
|
-
`).map(i=>i.replace(/<[^>]+>/g,"").trim()).find(i=>i&&!/^[-|:\s]+$/.test(i));r=n?n.slice(0,60):null}return r?
|
|
1290
|
-
`);let n=/^\+\+\+[ \t]*$/m.test(e),i={};n||({deck:i,body:e}=
|
|
1291
|
-
`).forEach(x=>{let
|
|
1292
|
-
`);
|
|
1293
|
-
`).trim(),C=x.title||
|
|
1294
|
-
`).find(
|
|
1289
|
+
`).replace(/^\n+/,""))}return{meta:a,body:o}}function Is(e){let t=e.replace(/<!--[\s\S]*?-->/g,""),a=t.match(/^\s{0,3}#{1,6}\s+(.+?)\s*#*\s*$/m),o=t.match(/<h[1-6][^>]*>([\s\S]*?)<\/h[1-6]>/i),r=null;if(a&&(!o||a.index<o.index)?r=a[1]:o&&(r=o[1].replace(/<[^>]+>/g," ")),!r){let n=t.split(`
|
|
1290
|
+
`).map(i=>i.replace(/<[^>]+>/g,"").trim()).find(i=>i&&!/^[-|:\s]+$/.test(i));r=n?n.slice(0,60):null}return r?Yr(Pt(r)).replace(/\s+/g," ").trim():null}function Jr(e){let t=e.match(/<!--\s*\.slide:([\s\S]*?)-->/i);return t?zt(t[1]):{}}function Qr(e,{render:t=a=>({html:a,err:null})}={}){let a=new Map,o=y=>{let b=y,p=2;for(;a.has(b);)b=y+"-"+p++;return b},r=y=>(a.set(y.id,{x:null,y:null,children:[],...y}),y.id);e=e.replace(/\r\n?/g,`
|
|
1291
|
+
`);let n=/^\+\+\+[ \t]*$/m.test(e),i={};n||({deck:i,body:e}=Bs(e));let s=/^slides?$/i.test(String(i.layout||""))||/^slides?$/i.test(String(i.type||"")),l=!n&&(Rt(e,/^--\s*$/).length>1||s&&Rt(e,/^---\s*$/).length>1),c=n?M():l?m():d();return a.forEach(y=>{(!y.parent||y.parent===y.id||!a.has(y.parent))&&(y.parent=null)}),a.forEach(y=>{let b=new Set([y.id]),p=y.parent;for(;p;){if(b.has(p)){y.parent=null;break}b.add(p),p=a.get(p).parent}}),a.forEach(y=>{y.parent&&a.get(y.parent).children.push(y.id)}),{deck:i,nodes:a,format:n?"+++":l?"reveal":"headings",errCount:c};function d(){let y=[],b=null,p=null,T={level:0,title:null,explicitId:null,lines:[]};e.split(`
|
|
1292
|
+
`).forEach(x=>{let v=x.match(/^\s{0,3}(`{3,}|~{3,})/);v&&(p?v[1][0]===p[0]&&v[1].length>=p.length&&(p=null):p=v[1]);let S=!p&&!v?x.match(/^\s{0,3}(#{1,6})\s+(.+?)\s*#*\s*$/):null;if(S){let C=S[2],$=null,te=C.match(/\s*\{#([\w\-:.]+)\}\s*$/);te&&($=te[1],C=C.slice(0,te.index)),b={level:S[1].length,title:Pt(C),explicitId:$,lines:[S[1]+" "+C]},y.push(b)}else(b||T).lines.push(x)});let L=T.lines.join(`
|
|
1293
|
+
`);L.trim()&&(y.length&&!L.replace(/<!--[\s\S]*?-->/g,"").trim()?y[0].lines.splice(1,0,...T.lines):y.unshift(T));let w=[];return y.forEach(x=>{for(;w.length&&w[w.length-1].level>=x.level;)w.pop();let v=w.length?w[w.length-1].id:null,S=x.lines.join(`
|
|
1294
|
+
`).trim(),C=x.title||Pt((S.split(`
|
|
1295
|
+
`).find(X=>X.trim())||"Intro").slice(0,48));x.id=o(x.explicitId||nt(C));let{html:$,err:te}=t(S);r({id:x.id,parent:v,title:C,html:$,err:te,camera:mo(S),mapFirst:fo(S)}),w.push(x)}),0}function M(){let y=e.split(/\n\+\+\+[ \t]*\n/).map(T=>T.trim()).filter(T=>T.length),b=null,p=0;return y.forEach((T,L)=>{let{meta:w,body:x}=Os(T),v=o(w.id||"slide-"+(L+1)),S="parent"in w?w.parent||null:b,C=x.match(/^#{1,6}\s+(.+)$/m),$=w.title||(C?Pt(C[1]):v),{html:te,err:X}=t(x);X&&p++,r({id:v,parent:S,title:$,html:te,err:X,camera:w.camera||mo(x),mapFirst:fo(x),x:w.x!==void 0?parseFloat(w.x):null,y:w.y!==void 0?parseFloat(w.y):null}),b=v}),p}function m(){let y=0,b=0,p=null;function T(w,x){let v=w.body.trim();b++;let S=Is(v)||"Slide "+b,C=x?a.get(x).title:null;C&&S.startsWith(C+" / ")&&(S=S.slice(C.length+3));let $=o(nt(S)),{html:te,err:X}=t(v);return X&&y++,r({id:$,parent:x,title:S,html:te,err:X,camera:mo(v),mapFirst:fo(v),autoslide:parseInt(w.attrs["data-autoslide"],10)||0})}let L=[];return Rt(e,/^---\s*$/).forEach(w=>{if(/<section\b/i.test(w)){for(let S of w.matchAll(/<section\b([^>]*)>([\s\S]*?)<\/section>/gi))L.push([{body:S[2],attrs:zt(S[1])}]);let v=w.replace(/<section\b[^>]*>[\s\S]*?<\/section>/gi,"");v.trim()&&L.push([{body:v,attrs:Jr(v)}]);return}let x=Rt(w,/^--\s*$/).filter(v=>v.trim()).map(v=>({body:v,attrs:Jr(v)}));x.length&&L.push(x)}),L.forEach(w=>{let x=null;w.forEach((v,S)=>{if(!p){p=x=T(v,null);return}S===0?x=T(v,p):T(v,x)})}),y}}var Zr=V(()=>{"use strict";ma()});function Ft(e,t){return String(t||"").toLowerCase().split(/\s+/).forEach(a=>{a&&(a==="off"||a==="hide"?e.off=!0:a==="on"||a==="pip"||a==="show"?(e.off=!1,e.full=!1,e.behind=!1,e.used=!0):a==="full"||a==="fullscreen"?(e.full=!0,e.behind=!1,e.off=!1,e.used=!0):a==="behind"||a==="under"?(e.full=!0,e.behind=!0,e.off=!1,e.used=!0):/^\d+(\.\d+)?%?$/.test(a)?(e.size=go(parseFloat(a)),e.used=!0):Dt.includes(a)?(e.corner=a,e.used=!0):a==="flip"?(e.flip=!e.flip,e.used=!0):a==="circle"?e.circle=!0:a==="rect"?e.circle=!1:a==="mirror"?e.mirror=!0:(a==="unmirror"||a==="no-mirror")&&(e.mirror=!1))}),e}function en(e){return e?e.split(",").map(t=>t.trim()).filter(Boolean):[]}function tn(e,t){let a=[];if(!e.length){for(let r=0;r<=t;r++)a.push({cam:0,frag:r});return a}let o=e.findIndex(r=>!Ft({},r).full);o<0&&(o=e.length-1);for(let r=0;r<=o;r++)a.push({cam:r,frag:0});for(let r=1;r<=t;r++)a.push({cam:o,frag:r});for(let r=o+1;r<e.length;r++)a.push({cam:r,frag:t});return a}var Dt,go,an=V(()=>{"use strict";Dt=["top-left","top-right","bottom-left","bottom-right"],go=e=>Math.max(8,Math.min(60,e))});function on(e){let t=String(e||"").trim();if(!t)return null;let a;try{a=new URL(/^[a-z]+:\/\//i.test(t)?t:"https://"+t)}catch{return null}let o=a.pathname.split("/").filter(Boolean);if(a.hostname==="github.com"||a.hostname==="www.github.com"){let[r,n,i,s,...l]=o;if(r&&n&&(i==="blob"||i==="raw"||i==="tree")&&s){let c=l.join("/");return(i==="tree"||!/\.(md|markdown|txt)$/i.test(c))&&(c=(c?c+"/":"")+"index.md"),{kind:"url",url:yo+[r,n,s].join("/")+"/"+c}}if(r&&n&&!i)return{kind:"url",url:yo+r+"/"+n+"/HEAD/README.md"}}if(a.hostname==="gist.github.com"){let r=o.length>=2?o[1]:o[0];if(r&&/^[\da-f]+$/i.test(r))return{kind:"gist",id:r}}if(a.hostname==="slidetake.com"||a.hostname==="www.slidetake.com"){let r=vo(a.pathname);if(r)return r;let n=a.searchParams.get("src");if(n)return{kind:"url",url:n}}return{kind:"url",url:a.href}}function vo(e){let t=String(e||"").split("/").filter(Boolean).map(a=>{try{return decodeURIComponent(a)}catch{return a}});if(t[0]==="gh"&&t.length>=4){let[,a,o,...r]=t,n=o.indexOf("@"),i=n<0?o:o.slice(0,n),s=n<0?"HEAD":o.slice(n+1);return!a||!i||!s?null:{kind:"url",url:yo+[a,i,s,...r].map(encodeURIComponent).join("/")}}return t.length===1&&(t[0]==="docs"||t[0]==="help")?{kind:"builtin",id:"docs"}:t[0]==="showcase"&&t.length===1?{kind:"builtin",id:"showcase"}:t[0]==="examples"&&(t.length===1||t.length===2&&t[1]==="showcase")?{kind:"builtin",id:"showcase"}:t.length===1&&t[0]==="features"?{kind:"builtin",id:"features"}:t.length===1&&t[0]==="privacy"?{kind:"builtin",id:"privacy"}:t[0]==="gist"&&t[1]&&/^[\da-f]+$/i.test(t[1])?t[2]?{kind:"gist",id:t[1],file:t[2]}:{kind:"gist",id:t[1]}:null}function rn(e){if(e.kind==="builtin")return e.id==="home"?"/":e.id==="showcase"?"/showcase":e.id.startsWith("template:")?"/new?template="+e.id.slice(9):"/"+e.id;if(e.kind==="gist")return"/gist/"+e.id+(e.file?"/"+encodeURIComponent(e.file):"");let t=e.url.match(/^https:\/\/raw\.githubusercontent\.com\/([^/]+)\/([^/]+)\/([^/]+)\/(.+)$/);if(t){let[,a,o,r,n]=t;if(!/^refs$/.test(r))return"/gh/"+a+"/"+o+(r==="HEAD"?"":"@"+r)+"/"+n}return"/?src="+encodeURIComponent(e.url)}var yo,bo=V(()=>{"use strict";yo="https://raw.githubusercontent.com/"});function Ps(e){let t="";for(let a=0;a<e.length;a+=32768)t+=String.fromCharCode(...e.subarray(a,a+32768));return btoa(t).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}function zs(e){let t=atob(e.replace(/-/g,"+").replace(/_/g,"/")+"===".slice((e.length+3)%4));return Uint8Array.from(t,a=>a.charCodeAt(0))}async function nn(e,t){let a=new Response(new Blob([e]).stream().pipeThrough(t));return new Uint8Array(await a.arrayBuffer())}async function sn(e){return Ps(await nn(new TextEncoder().encode(e),new CompressionStream("deflate-raw")))}async function ln(e){return new TextDecoder().decode(await nn(zs(e),new DecompressionStream("deflate-raw")))}function ga(e){let t=e.replace(/^#/,"");if(!t.startsWith(wo)){let n=t;try{n=decodeURIComponent(t)}catch{}return{data:null,slide:n}}let a=t.slice(wo.length),o=a.indexOf("~"),r=o<0?"":a.slice(o+1);try{r=decodeURIComponent(r)}catch{}return{data:o<0?a:a.slice(0,o),slide:r}}function xo(e,t){return"#"+wo+e+(t?"~"+encodeURIComponent(t):"")}var wo,ko=V(()=>{"use strict";wo="deflate:"});function cn(e,t,a){let o=e.replace(/\/+$/,"")||"/",r=new URLSearchParams(t),{data:n,slide:i}=ga(a);if(o==="/share")return n?{page:"share",data:n,slide:i}:{page:"source",source:{kind:"builtin",id:"home"},slide:""};if(o==="/edit")return{page:"edit",slide:i};if(o==="/new"){let c=r.get("template");return c&&Rs.includes(c)?{page:"source",source:{kind:"builtin",id:"template:"+c},slide:i}:{page:"pick"}}let s=vo(o);if(s)return{page:"source",source:s,slide:i};let l=r.get("src");return o==="/"&&l?{page:"source",source:{kind:"url",url:l},slide:i}:{page:"source",source:{kind:"builtin",id:"home"},slide:i}}function Se(e){switch(e.kind){case"builtin":return e.id==="home"?"Home":e.id==="docs"||e.id==="help"?"the docs":e.id==="showcase"?"the showcase":e.id==="features"?"the features":e.id==="privacy"?"the privacy page":"the "+e.id.replace(/^template:/,"")+" template";case"gist":return"a gist"+(e.file?" ("+e.file+")":"");case"shared":return"a shared deck";case"file":return e.name;case"url":{let t=e.url.match(/^https:\/\/raw\.githubusercontent\.com\/([^/]+)\/([^/]+)\/[^/]+\/(.+)$/);if(t)return t[1]+"/"+t[2]+"/"+t[3];try{let a=new URL(e.url);return a.hostname+a.pathname}catch{return e.url}}}}function ya(e,t,{exported:a=!1}={}){return{text:e,origin:t,originText:e,exported:a?e:null}}function va(e){return e.text!==(e.exported??e.originText)}function ba(e){return e.text===e.originText}function dn(e){try{let t=JSON.parse(e||"null");return!t||typeof t.text!="string"||!t.origin||typeof t.origin.kind!="string"?null:{text:t.text,origin:t.origin,originText:typeof t.originText=="string"?t.originText:t.text,exported:typeof t.exported=="string"?t.exported:null}}catch{return null}}var Rs,hn=V(()=>{"use strict";bo();ko();Rs=["blank","talk","recording"]});function So(e){let t;try{t=new URL(e)}catch{return null}let a=t.hostname.replace(/^(www\.|m\.)/,""),o=null,r=!1;if(a==="youtu.be")o=t.pathname.slice(1).split("/")[0];else if(a==="youtube.com"||a==="youtube-nocookie.com"){let n=t.pathname.split("/").filter(Boolean);n[0]==="watch"?o=t.searchParams.get("v"):["shorts","live","embed"].includes(n[0])&&(o=n[1]||null,r=n[0]==="shorts")}return!o||!/^[\w-]{6,}$/.test(o)?null:{id:o,start:Ds(t.searchParams.get("t")||t.searchParams.get("start")||""),portrait:r}}function Ds(e){if(/^\d+$/.test(e))return+e;let t=e.match(/^(?:(\d+)h)?(?:(\d+)m)?(?:(\d+)s)?$/);return t&&e?+(t[1]||0)*3600+ +(t[2]||0)*60+ +(t[3]||0):0}function pn(e){return"https://www.youtube-nocookie.com/embed/"+encodeURIComponent(e.id)+"?enablejsapi=1&rel=0&playsinline=1"+(e.start?"&start="+e.start:"")}var un=V(()=>{"use strict"});function me(e){let t=new Map,a=e.totalObs??e.total;return e.events.forEach((o,r)=>{t.has(o.id)||t.set(o.id,{id:o.id,title:o.title,takes:[]});let n=t.get(o.id),i=e.events[r+1];n.takes.push({no:n.takes.length+1,start:fn(o)+(o.skip||0),end:i?fn(i)-(i.lead||0):a})}),t}function Nt(e){let t=[],a=xa(e);return me(e).forEach(o=>{let r=e.picks[o.id]??o.takes.length;if(!r)return;let n=o.takes[r-1];if(!n)return;let i=mn(n.start,a),s=mn(n.end,a);s>i&&t.push({id:o.id,title:o.title,f0:i,f1:s,start:i*1e3/a,end:s*1e3/a})}),t}function Fs(e){let t=[];return e.forEach(a=>{let o=t[t.length-1];o&&a.f0===o.f1?(o.f1=a.f1,o.end=a.end):t.push({f0:a.f0,f1:a.f1,start:a.start,end:a.end})}),t}function Eo(e,t){let a=0,o=[];return Nt(e).forEach(r=>{let{sec:n,title:i}=t(r.id,r.title),s=o[o.length-1];(!s||s.sec!==n&&s.title!==i)&&o.push({sec:n,title:i,t:a}),a+=r.end-r.start}),{list:o,length:a}}function yn(e,t){let{list:a,length:o}=Eo(e,t),r=a.filter((n,i)=>i===0||(a[i+1]?a[i+1].t:o)-n.t>=1e4);return r.length&&(r[0].t=0),{lines:r.map(n=>fa(n.t)+" "+n.title),dropped:a.length-r.length,length:o}}function vn(e,t,{input:a,outputName:o,sectionOf:r,loudness:n}){let i=Fs(Nt(e));if(!e.withObs)return"# This was a rehearsal: nothing was recorded.";if(!i.length)return"# Every slide is left out: nothing to render.";let s=Ns(a)+o,{list:l,length:c}=Eo(e,r),d=v=>String(v).replace(/[=;#\\\n]/g,S=>"\\"+S),m=`cat > /tmp/slidetake-chapters.txt <<'EOF'
|
|
1295
1296
|
`+(`;FFMETADATA1
|
|
1296
1297
|
title=`+d(e.deckTitle)+`
|
|
1297
|
-
`+l.map((
|
|
1298
|
+
`+l.map((v,S)=>`[CHAPTER]
|
|
1298
1299
|
TIMEBASE=1/1000
|
|
1299
|
-
START=`+Math.round(
|
|
1300
|
+
START=`+Math.round(v.t)+`
|
|
1300
1301
|
END=`+Math.round(l[S+1]?l[S+1].t:c)+`
|
|
1301
|
-
title=`+d(
|
|
1302
|
+
title=`+d(v.title)).join(`
|
|
1302
1303
|
`))+`
|
|
1303
1304
|
EOF
|
|
1304
|
-
`,
|
|
1305
|
-
inpoint `+
|
|
1306
|
-
outpoint `+
|
|
1305
|
+
`,y=" -map 0:v:0 -map 0:a:0 -map_metadata 1 -map_chapters 1";if(t==="copy"){let v=i.map(C=>"file "+wa(a)+`
|
|
1306
|
+
inpoint `+gn(C.start)+`
|
|
1307
|
+
outpoint `+gn(C.end)).join(`
|
|
1307
1308
|
`);return(i.length>1?`# Careful: without re-encoding, cuts can only land on keyframes (OBS puts one about every 2 s),
|
|
1308
1309
|
# so `+(i.length===2?"the cut":"each of the "+(i.length-1)+" cuts")+` here may keep or lose up to ~2 s. Use a frame-accurate option for retakes.
|
|
1309
1310
|
`:"")+`cat > /tmp/slidetake-cuts.txt <<'EOF'
|
|
1310
|
-
`+
|
|
1311
|
+
`+v+`
|
|
1311
1312
|
EOF
|
|
1312
|
-
`+
|
|
1313
|
-
`)};[qs(),_&&_.colors].filter(Boolean).forEach(o=>{["dark","light"].forEach(r=>{let n={...o,...o[r]||{}},i=r==="dark";n.accent&&typeof n.accent=="string"&&(n.accentSoft=n.accentSoft||n.accent,n.line=n.line||"color-mix(in srgb, "+n.accent+(i?" 45%, #09090b)":" 55%, #fff)"),n.ring=n.ring||(i?n.accent:n.line),n.onAccent=n.onAccent||(i?"color-mix(in srgb, "+n.accent+" 15%, #000)":"#fff")),t(i?'body:not([data-mode="light"])':'body[data-mode="light"]',n)})});let a=document.getElementById("st-colors");a||(a=document.createElement("style"),a.id="st-colors",document.head.appendChild(a)),a.textContent!==e&&(a.textContent=e),document.body.classList.toggle("st-header-color",e.includes("--header-bg"))}function Ae(e){let t=document.createElement("span");t.style.color="var("+e+")",document.body.appendChild(t);let a=getComputedStyle(t).color;return t.remove(),Ne=Ne||Object.assign(document.createElement("canvas"),{width:1,height:1}).getContext("2d",{willReadFrequently:!0}),Ne.clearRect(0,0,1,1),Ne.fillStyle="#000",Ne.fillStyle=a,Ne.fillRect(0,0,1,1),"#"+[...Ne.getImageData(0,0,1,1).data.slice(0,3)].map(o=>o.toString(16).padStart(2,"0")).join("")}function Vs(e,t,a){let o=i=>[1,3,5].map(s=>parseInt(i.slice(s,s+2),16)),r=o(e),n=o(t);return"#"+r.map((i,s)=>Math.round(i*a+n[s]*(1-a)).toString(16).padStart(2,"0")).join("")}function _a(){if(_&&_.themeKey&&!En){let t=U(_.themeKey);return t==="light"||t==="dark"?t:matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}return String(En||U("slidetake:mode")||R.mode||"dark").toLowerCase()==="light"?"light":"dark"}function qn(){let e=_a()==="light";e?document.body.dataset.mode="light":delete document.body.dataset.mode;let t=document.getElementById("btn-mode");t&&(t.innerHTML=e?'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M21 12.8A9 9 0 1 1 11.2 3a7 7 0 0 0 9.8 9.8z"/></svg>':'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"><circle cx="12" cy="12" r="4.5"/><path d="M12 2v2M12 20v2M4.9 4.9l1.4 1.4M17.7 17.7l1.4 1.4M2 12h2M20 12h2M4.9 19.1l1.4-1.4M17.7 6.3l1.4-1.4"/></svg>',t.title=(e?"Dark theme":"Light theme")+" (L)",t.setAttribute("aria-label",t.title))}function Gn(){let e=_a()==="light"?"dark":"light";_&&_.themeKey?(V(_.themeKey,e),document.documentElement.classList.toggle("dark",e==="dark")):V("slidetake:mode",e),qn(),ie.querySelector(".echarts-container, .diagram.d2, .diagram.dot")&&ut(!0)}function Ys(){let t=(R.camera||"").replace(/^\[|\]$/g,"").split(",").map(a=>a.trim().replace(/^["']|["']$/g,"")).filter(Boolean);return t.length?t:["on","full","off"]}function Bo(e){return!oe&&e?Wr(e.camera):[]}function xt(e){return qr(Bo(e),e&&e.frags?e.frags.length:0)}function Vn(){let e=xt(u.get(f));return e[Math.min(we,e.length-1)]||{cam:0,frag:0}}function Ks(){if(!f)return null;let e=u.get(f),t=Bo(e);if(t.length)return t[Math.min(Vn().cam,t.length-1)];if(e&&e.el&&e.el.classList.contains("card-full"))return"off";for(let a=y.indexOf(f)-1;a>=0;a--){let o=Bo(u.get(y[a]));if(o.length)return o[o.length-1]}return null}function Js(){let e={corner:(R.pip||"none").toLowerCase(),size:to(parseFloat(R.pip_size)||24),circle:(R.pip_shape||"").toLowerCase()==="circle",mirror:!/^(no|false|off)$/i.test(R.pip_mirror||""),full:!1,off:!1,flip:!1,used:!1};return la(e,Ks()),ge&&!/\b(off|hide)\b/i.test(ge)&&(e.off=!1),la(e,ge),!At.includes(e.corner)&&(ae||e.used)&&(e.corner="bottom-right"),e.flip&&At.includes(e.corner)&&(e.corner=e.corner.includes("left")?e.corner.replace("left","right"):e.corner.replace("right","left")),e}function Vo(){let e=!z.hidden&&z.offsetWidth?z.getBoundingClientRect():null,t=Ye=Js(),a=At.includes(t.corner);if(z.className=a?[t.corner,t.circle&&"circle",ae&&"live",t.mirror&&"mirror",t.full&&"full",z.classList.contains("msg")&&"msg"].filter(Boolean).join(" "):"",z.style.width=t.size+"%",z.hidden=!a||oe||t.off,Ao.dataset.pip=z.hidden||t.full?"none":t.corner,z.hidden||wt||!z.animate)return;let o="cubic-bezier(.65,0,.35,1)";if(!e){z.animate([{opacity:0},{opacity:1}],{duration:300,easing:"ease-out"});return}let r=z.getBoundingClientRect();Math.abs(e.left-r.left)+Math.abs(e.top-r.top)+Math.abs(e.width-r.width)+Math.abs(e.height-r.height)<2||z.animate([{transformOrigin:"0 0",transform:"translate("+(e.left-r.left)+"px,"+(e.top-r.top)+"px) scale("+e.width/r.width+","+e.height/r.height+")"},{transformOrigin:"0 0",transform:"none"}],{duration:600,easing:o})}function $s(){let e=Ye;if(!e||z.hidden||e.full)return null;let t=H.clientWidth,a=H.clientHeight,o=16,r=t*e.size/100,n=e.circle?r:r*9/16,i=e.corner.includes("left")?o:t-o-r,s=e.corner.includes("top")?o:a-o-n;return{x0:i,y0:s,x1:i+r,y1:s+n}}function Xs(){if(!bt)return;if(oe){ra(!0);return}let e=Ys();Ie=(Ie+1)%e.length,ge=e[Ie],Vo(),K||lt("Camera: "+ge),!ae&&!z.hidden?Qe():xe()}function Yn(e){let t=_r(e,{render:_s});R=t.deck,u=t.nodes,Aa();let a={"+++":"+++ format",reveal:"reveal.js format",headings:"headings"}[t.format];Is.textContent=u.size+(u.size===1?" card":" cards")+" \xB7 "+a,Ut.textContent=t.errCount?t.errCount+" card(s) had errors":""}function Kn(){qe=[...u.values()].filter(o=>!o.parent).map(o=>o.id);let e=0;function t(o,r){let n=u.get(o);if(n.depth=r,n.children.length===0)n._slot=e++;else{n.children.forEach(s=>t(s,r+1));let i=n.children.map(s=>u.get(s)._slot);n._slot=(Math.min(...i)+Math.max(...i))/2}}qe.forEach(o=>t(o,0)),y=[];function a(o){y.push(o),u.get(o).children.forEach(a)}return qe.forEach(a),Math.max(1,e)}function Qs(){let e=[],t=[],a=[];return u.forEach(o=>{e[o.depth]=Math.max(e[o.depth]||0,o._h),t[o.depth]=Math.max(t[o.depth]||0,o._w),a[o.depth]=(a[o.depth]||0)+1}),{maxH:e,maxW:t,count:a,maxDepth:e.length-1}}function Jn(e){e.x!==null&&!isNaN(e.x)&&(e.cx=e.x+e._w/2),e.y!==null&&!isNaN(e.y)&&(e.cy=e.y+e._h/2)}function Zs(){let{maxH:e,maxDepth:t}=Qs(),a=[0];for(let l=1;l<=t;l++)a[l]=a[l-1]+e[l-1]+Ds;let o=Rs-dt,r=[],n=(l,c)=>{let d=u.get(l);d.cx+=c,d.children.forEach(L=>n(L,c))},i=l=>{let c=u.get(l);r[c.depth]=Math.max(r[c.depth]??-1/0,c.cx+c._w/2),c.children.forEach(i)};function s(l){let c=u.get(l),d=r[c.depth]!==void 0?r[c.depth]+o:-1/0;c.children.length?(c.children.forEach(s),c.cx=(u.get(c.children[0]).cx+u.get(c.children[c.children.length-1]).cx)/2,c.cx-c._w/2<d&&n(l,d-(c.cx-c._w/2))):c.cx=(d===-1/0?0:d)+c._w/2,i(l)}qe.forEach(s),u.forEach(l=>{l.cy=a[l.depth]+l._h/2,Jn(l)})}function el(e){let t=Math.PI*2/e,a=32,o=[],r=(s,l)=>Math.abs(s.cx-l.cx)<(s._w+l._w)/2+a&&Math.abs(s.cy-l.cy)<(s._h+l._h)/2+a,n=Math.max(0,...[...u.values()].map(s=>s.depth)),i=0;for(let s=0;s<=n;s++){let l=[...u.values()].filter(d=>d.depth===s);if(!l.length)continue;let c=s===0?qe.length>1?Ns*.5:0:i+Fs;for(let d=0;d<400&&(l.forEach(g=>{let b=(g._slot+.5)*t-Math.PI/2;g.cx=c*Math.cos(b),g.cy=c*Math.sin(b),Jn(g)}),!!l.some((g,b)=>l.some((v,p)=>p>b&&r(g,v))||o.some(v=>r(g,v))));d++)c=c*1.02+10;i=c,o.push(...l)}}function tl(e){let t=document.createTreeWalker(e,NodeFilter.SHOW_COMMENT),a=[];for(;t.nextNode();)a.push(t.currentNode);a.forEach(o=>{let r=o.data.match(/^\s*\.element:\s*([\s\S]*)$/);if(!r)return;let n=o.previousSibling;for(;n&&n.nodeType===3&&!n.data.trim();)n=n.previousSibling;let i=n&&n.nodeType===1?n:o.parentElement;i&&Object.entries(Tt(r[1])).forEach(([s,l])=>{s==="class"?i.classList.add(...l.split(/\s+/).filter(Boolean)):s==="style"?i.style.cssText+=";"+l:i.setAttribute(s,l)})})}function rl(e){let t=new DOMParser().parseFromString(e,"image/svg+xml"),a=t.documentElement;if(!a||a.localName!=="svg"||t.getElementsByTagName("parsererror").length)return null;let o=a.namespaceURI,r=i=>{[...i.children].forEach(s=>{s.namespaceURI!==o||!al.has(s.localName)?s.remove():r(s)}),[...i.attributes].forEach(s=>{let l=s.name.toLowerCase(),c=s.value;(l.startsWith("on")||/javascript:|expression\(/i.test(c)||/url\(\s*['"]?(?!#)/i.test(c)||(l==="href"||l==="xlink:href")&&!c.trim().startsWith("#"))&&i.removeAttribute(s.name)})};r(a);let n="st-svg"+ ++ol+"-";return[a,...a.querySelectorAll("*")].forEach(i=>[...i.attributes].forEach(s=>{let l=s.name==="id"?n+s.value:s.value.replace(/url\(\s*(['"]?)#/g,"url($1#"+n);(s.name==="href"||s.name==="xlink:href")&&l.startsWith("#")&&(l="#"+n+l.slice(1)),l!==s.value&&(s.value=l)})),document.importNode(a,!0)}function Be(e,t){let a=e.classList.contains("fragment");["fragment","fade-up","visible","current-fragment"].forEach(o=>{e.classList.contains(o)&&(t.classList.add(o),e.classList.remove(o))}),e.dataset.fragmentIndex!==void 0&&(t.dataset.fragmentIndex=e.dataset.fragmentIndex,delete e.dataset.fragmentIndex),e.replaceWith(t),a&&u.forEach(o=>o.frags&&o.frags.forEach(r=>{let n=r.indexOf(e);n>=0&&(r[n]=t)}))}function bo(e){let t=document.createElement("figure");t.className="media",Be(e,t),t.appendChild(e);let a=e.getAttribute("alt");return a&&t.insertAdjacentHTML("beforeend","<figcaption>"+B(a)+"</figcaption>"),t}function nl(e,t){let a=document.createElement("figure");return a.className="media yt fragment yt-play"+(e.portrait?" portrait":""),a.innerHTML='<div class="frame"><iframe src="'+en(e)+'" title="'+B(t||"YouTube video")+'" allow="autoplay; encrypted-media; picture-in-picture; fullscreen" allowfullscreen loading="lazy"></iframe></div>'+(t?"<figcaption>"+B(t)+"</figcaption>":""),a}function Cn(e,t){let a=t<=4?t:t<=6?3:4;e.style.setProperty("--cols",a),e.style.setProperty("--rows",Math.ceil(t/a))}function sl(e,t){t.querySelectorAll("pre > code.language-svg").forEach(n=>{let i=rl(n.textContent.trim()),s=document.createElement("div");s.className=i?"diagram svg":"diagram err",i?s.appendChild(i):s.textContent="SVG error: not a valid <svg> drawing",Be(n.parentElement,s)}),t.querySelectorAll(":scope > p").forEach(n=>{let i=n.children.length===1?n.children[0]:null;if(!i)return;let s=i.tagName==="A"&&n.textContent.trim()===i.textContent.trim()?i.getAttribute("href"):i.tagName==="IMG"?i.getAttribute("src"):null,l=s&&lo(s);l&&Be(n,nl(l,i.tagName==="IMG"?i.getAttribute("alt"):""))}),t.querySelectorAll(":scope > ul, :scope > ol").forEach(n=>{let i=[...n.children];!i.length||!i.every(s=>wo(s)||cl(s))||(n.classList.add("gallery"),i.some(s=>!wo(s))&&n.classList.add("diagrams"),i.forEach(s=>{if(!wo(s))return;let l=s.querySelector("img");s.innerHTML="",s.appendChild(l),bo(l)}),i.length>1&&i.every(s=>s.classList.contains("fragment"))?(n.classList.add("carousel"),i[0].classList.remove("fragment","fade-up"),i.forEach((s,l)=>{s.classList.replace("fade-up","current-visible");let c=s.querySelector("figcaption");c&&(c.dataset.count=l+1+" / "+i.length)})):Cn(n,i.length))}),t.querySelectorAll(":scope > p").forEach(n=>{if(!il(n))return;let i=[...n.querySelectorAll("img")];if(i.length===1){Be(n,i[0]),bo(i[0]);return}let s=document.createElement("div");s.className="gallery grid",Be(n,s),i.forEach(l=>{s.appendChild(l),bo(l)}),Cn(s,i.length)});let a=[...t.children].filter(n=>!/^H[1-6]$/.test(n.tagName)&&!(n.nodeType===1&&n.tagName==="HR")),o=a.filter(n=>n.matches("figure.media"));o.length===1&&a.length===1&&e.classList.add("card-media");let r=document.createTreeWalker(t,NodeFilter.SHOW_COMMENT);for(;r.nextNode();)/^\s*view\s*:\s*full\s*$/i.test(r.currentNode.data)&&e.classList.add("card-full");if(a.length===1&&(a[0].matches("figure.media:not(.yt)")||a[0].matches(".gallery.carousel:not(.diagrams)")))e.classList.add("card-bleed");else if(o.length===1&&a.length>1&&!o[0].matches(".yt")){e.classList.add("card-split",a.indexOf(o[0])===0?"media-first":"media-last");let n=document.createElement("div");n.className="split-text",a.filter(i=>i!==o[0]).forEach(i=>n.appendChild(i)),o[0].after(n),a.indexOf(o[0])!==0&&n.after(o[0])}t.querySelector(".gallery")&&e.classList.add("card-gallery")}function $n(e,t){let a=e.querySelector("iframe");a&&a.contentWindow&&a.contentWindow.postMessage(JSON.stringify({event:"command",func:t,args:[]}),"*")}function ll(e){let t=document.createTreeWalker(e,NodeFilter.SHOW_COMMENT),a=[];for(;t.nextNode();)/^\s*steps\s*$/i.test(t.currentNode.data)&&a.push(t.currentNode);a.forEach(o=>{for(let r=o.nextSibling;r&&!(r.nodeType===8&&/^\s*steps\s*:\s*off\s*$/i.test(r.data));r=r.nextSibling)r.nodeType!==1||r.classList.contains("fragment")||(/^(UL|OL)$/.test(r.tagName)?r.querySelectorAll(":scope > li").forEach(n=>n.classList.add("fragment","fade-up")):r.classList.add("fragment","fade-up"))})}function dl(e){let t=r=>r.classList.contains("fragment")&&(r.tagName==="P"&&r.children.length===1&&r.children[0].tagName==="IMG"&&!r.textContent.trim()&&!lo(r.children[0].getAttribute("src")||"")||r.tagName==="PRE"&&!!r.querySelector(Xn)),a=[],o=[];[...e.children].forEach(r=>{t(r)?o.push(r):(o.length>1&&a.push(o),o=[])}),o.length>1&&a.push(o),a.forEach(r=>{let n=document.createElement("ul");r[0].before(n),r.forEach(i=>{let s=document.createElement("li");s.className="fragment fade-up",i.classList.remove("fragment","fade-up"),s.appendChild(i),n.appendChild(s)})})}function hl(e){let t=[...e.querySelectorAll(".fragment")].map((r,n)=>({e:r,i:n,k:r.dataset.fragmentIndex}));if(t.every(r=>r.k===void 0))return t.map(r=>[r.e]);let a=0;t.forEach(r=>{r.k=r.k===void 0?a:parseFloat(r.k),a=Math.max(a,r.k)+1}),t.sort((r,n)=>r.k-n.k||r.i-n.i);let o=[];return t.forEach((r,n)=>{n&&t[n-1].k===r.k?o[o.length-1].push(r.e):o.push([r.e])}),o}function Yo(e,t,a){!e||!e.frags||(a&&e.el.classList.add("snap"),e.frags.forEach((o,r)=>o.forEach(n=>{let i=n.classList.contains("visible");n.classList.toggle("visible",r<t),n.classList.toggle("current-fragment",r===t-1),n.classList.contains("yt-play")&&i!==r<t&&!a&&$n(n,r<t?"playVideo":"pauseVideo")})),a&&(e.el.offsetWidth,e.el.classList.remove("snap")))}function pl(){try{return R.base?new URL(R.base,ze||location.href):ze?new URL(ze):null}catch{return null}}function ul(e){let t=pl(),a=0;return e.querySelectorAll("img[src], source[src], video[src], iframe[src], a[href]").forEach(o=>{let r=o.hasAttribute("src")?"src":"href",n=o.getAttribute(r);if(!n||/^(#|[a-z][a-z0-9+.-]*:|\/\/)/i.test(n))return;if(!t){r==="src"&&!n.startsWith("/")&&a++;return}let i=t;try{R.site&&(i=new URL(R.site,t))}catch{}o.setAttribute(r,new URL(n,n.startsWith("/")?i:t).href)}),a}function Ua(e){let t=e.el,a=t.querySelector(".body");t.classList.add("measuring"),a.style.zoom="";let o=dt;e.visual=!!a.querySelector("iframe, .echarts-container, pre > code.language-dot, pre > code.language-d2, pre > code.language-echarts, .diagram, figure.media"),e.visual&&(o=le);let r=t.classList.contains("card-full");if(t.classList.remove("img-portrait","img-landscape","img-overlay","img-cover"),r&&(o=le),t.classList.contains("card-bleed")){let l=Math.max(0,...[...a.querySelectorAll("img")].map(d=>d.naturalWidth&&d.naturalHeight?d.naturalWidth/d.naturalHeight:0))||1.7777777777777777,c=le-xa*l>=260;if(r&&c)t.classList.add("img-portrait"),t.style.setProperty("--img-w",Math.round(xa*l)+"px"),o=le;else if(r||Math.abs(l-16/9)<.08)t.classList.add("img-overlay"),o=le,l>=16/9&&l<=16/9*1.15&&t.classList.add("img-cover");else if(l<1.3){let d=Math.min(Math.round(xa*l),le-300);t.classList.add("img-portrait"),t.style.setProperty("--img-w",d+"px"),o=Math.min(le,Math.max(vo,d*2))}else t.classList.add("img-landscape"),o=Math.round(Math.max(dt,Math.min(le,(xa-Ps)*l))),t.style.setProperty("--img-h",Math.round(o/l)+"px")}else(a.querySelector('[style*="flex"], [style*="grid"], .r-hstack')||a.querySelectorAll("img").length>=4)&&(o=vo);let n=a.querySelectorAll("table");if(n.length){t.style.width=le+"px";let l=t.offsetWidth-a.clientWidth;n.forEach(c=>{o=Math.max(o,Math.min(vo,Math.ceil(c.offsetWidth)+l+12))})}let i=a.querySelectorAll("pre");if(i.length){t.style.width=le+"px";let l=t.offsetWidth-a.clientWidth;i.forEach(c=>{c.style.width="max-content",o=Math.max(o,Math.min(le,Math.ceil(c.offsetWidth)+l+2)),c.style.width=""})}let s=a.querySelectorAll(".fragment.grow");if(s.length){t.style.width=o+"px";let l=t.offsetWidth-a.clientWidth;s.forEach(c=>{o=Math.max(o,Math.min(le,Math.ceil(c.offsetWidth*1.3)+l))})}t.style.width=o+"px",t.scrollWidth>o+2&&(t.style.width=(o=Math.min(le,t.scrollWidth+24))+"px"),a.scrollWidth>a.clientWidth+2&&(a.style.zoom=(a.clientWidth/a.scrollWidth).toFixed(3)),e._w=o,e._h=t.offsetHeight||Lo,t.classList.remove("measuring")}function fl(){clearTimeout(Mn),Mn=setTimeout(()=>{u.forEach(Ua),$t(),xe(!0)},200)}function vl(){let e=_a()==="light"?"light":"dark",t=Ae(e==="light"?"--accent-ring":"--accent"),a="slidetake-"+e+"-"+t.slice(1);return Tn.has(a)||(bl(a,yl[e],t),Tn.add(a)),a}function bl(e,t,a){let o={axisLine:{lineStyle:{color:t.line}},axisTick:{lineStyle:{color:t.line}},axisLabel:{color:t.muted},splitLine:{lineStyle:{color:t.split}},nameTextStyle:{color:t.muted}};echarts.registerTheme(e,{color:[a,...t.palette],backgroundColor:"transparent",textStyle:{color:t.text,fontFamily:"'IBM Plex Sans', sans-serif"},title:{textStyle:{color:t.text},subtextStyle:{color:t.muted}},legend:{textStyle:{color:t.text}},tooltip:{backgroundColor:t.tip,borderColor:t.line,textStyle:{color:t.text}},categoryAxis:o,valueAxis:o,logAxis:o,timeAxis:o,line:{symbolSize:6,lineStyle:{width:2.5}},pie:{label:{color:t.text,textBorderWidth:0},labelLine:{lineStyle:{color:t.muted}}},funnel:{label:{color:t.text,textBorderWidth:0}}})}function kl(){let e=_a()==="light"?"light":"dark",t=Ae("--node-bg"),a=Ae(e==="dark"?"--accent":"--accent-line"),o=e==="dark"?[.58,.38,.25,.18,.12]:[.7,.45,.25,.15,.08],r={...xl[e],N7:t,B1:Ae("--accent")};return o.forEach((n,i)=>{r["B"+(i+2)]=Vs(a,t,n)}),r}function Sl(){let e=Ae("--text"),t=Ae("--text-muted"),a=Ae("--accent"),o='"Helvetica,Arial,sans-serif"';return' graph [bgcolor=transparent color="'+t+'" fontcolor="'+e+'" fontname='+o+'] node [color="'+a+'" fontcolor="'+e+'" fontname='+o+'] edge [color="'+t+'" fontcolor="'+t+'" fontname='+o+"] "}function Oo(e){return xo[e]||(xo[e]=new Promise((t,a)=>{let o=document.createElement("script");o.src=e,o.onload=t,o.onerror=()=>{delete xo[e],a(new Error("could not load "+e))},document.head.appendChild(o)}))}async function Ml(){let e=He,t=[...ie.querySelectorAll(".node pre > code.language-dot")];ie.querySelectorAll(".node pre > code.language-echarts").forEach(n=>{let i=document.createElement("div");i.className="echarts-container",i.dataset.chart=n.textContent,Be(n.parentElement,i)});let a=[...ie.querySelectorAll(".node .echarts-container[data-chart]")],o=[...ie.querySelectorAll(".node pre > code.language-d2")];if(!t.length&&!a.length&&!o.length)return;let r=[];if(t.length)try{if(await Oo(ml),ko=ko||await Viz.instance(),e!==He)return;let n=Sl();t.forEach(i=>{let s=document.createElement("div");s.className="diagram dot";try{s.appendChild(ko.renderSVGElement(El(i.textContent,n)))}catch(l){s.className="diagram err",s.textContent="Diagram error: "+l.message}Be(i.parentElement,s)})}catch{r.push("diagrams")}if(o.length)try{if(!ka){let i=await import(wl);ka=new i.D2}if(e!==He)return;let n=kl();for(let i of o){let s=document.createElement("div");s.className="diagram d2";try{let l=await ka.compile(Cl(i.textContent));s.innerHTML=await ka.render(l.diagram,{...l.renderOptions||{},themeOverrides:n,darkThemeOverrides:n})}catch(l){s.className="diagram err",s.textContent="Diagram error: "+(l.message||l)}if(e!==He)return;Be(i.parentElement,s)}}catch{r.push("D2 diagrams")}if(a.length)try{if(await Oo(gl),e!==He)return;let n=vl();a.forEach(i=>{let s;try{s=JSON.parse(i.dataset.chart)}catch{i.textContent="Chart data is not valid JSON.";return}echarts.init(i,n,{renderer:"svg"}).setOption(Object.assign({backgroundColor:"transparent",animation:!wt},s))})}catch{r.push("charts")}e===He&&(r.length&&(Ut.textContent="Could not load the "+r.join(" and ")+" renderer (offline?)"),u.forEach(Ua),$t(),xe(!0))}function Tl(){let e=[];return y.forEach(t=>{let a=vt(t),o=e[e.length-1];o&&o.sec===a?o.ids.push(t):e.push({sec:a,ids:[t]})}),e}function Ll(){let a=0,o=0,r=0;Tl().forEach((n,i)=>{let s=Math.max(...n.ids.map(d=>u.get(d)._h));i&&(a+=r/2+120+s/2);let l=o,c=o;n.ids.forEach((d,L)=>{let g=u.get(d);L&&(l+=90+g._w/2),g.cx=l,g.cy=a,c=l,l+=g._w/2}),o=c,r=s})}function Al(){u.forEach(e=>{e.cx=0,e.cy=0})}function Qn(){He++,window.echarts&&ie.querySelectorAll(".echarts-container").forEach(a=>{let o=echarts.getInstanceByDom(a);o&&o.dispose()}),ie.querySelectorAll("div.node").forEach(a=>a.remove());let e=Kn(),t=0;u.forEach(a=>{let o=document.createElement("div");o.className="node",o.tabIndex=0,o.dataset.id=a.id;let r=a.parent?Wa(a.id).slice(0,-1).map(i=>u.get(i).title).join(" / "):"";o.innerHTML=(r?'<div class="crumb">'+B(r)+"</div>":"")+'<div class="body">'+a.html+"</div>"+(a.err?'<div class="err-badge">!</div>':"");let n=o.querySelector(".body");tl(n),ll(n),dl(n),sl(o,n),/^slidetake$/i.test(R.brand||"")&&Ws(n),n.querySelectorAll("thead").forEach(i=>{i.textContent.trim()||i.remove()}),t+=ul(n),a.frags=hl(n),n.querySelectorAll("img").forEach(i=>{i.complete||i.addEventListener("load",fl,{once:!0})}),o.querySelectorAll("a[href]").forEach(i=>{let s=i.getAttribute("href");if(s.startsWith("#")){let l=decodeURIComponent(s.slice(1));u.has(l)&&(i.classList.add("xlink"),i.addEventListener("click",c=>{c.preventDefault(),c.stopPropagation(),h.active||j(l)}))}else i.target="_blank",i.rel="noopener",i.addEventListener("click",l=>l.stopPropagation())}),o.addEventListener("click",()=>{h.active||j(a.id)}),o.addEventListener("keydown",i=>{i.key==="Enter"&&i.target===o&&j(a.id)}),ie.appendChild(o),a.el=o,Yo(a,a.frags.length)}),t&&!Ut.textContent&&(Ut.textContent=t+" image(s) use relative paths: add base: to the deck, or open it with ?src="),u.forEach(Ua),$t(e),Ml()}function $t(e){e===void 0&&(e=Kn()),Y==="radial"?el(e):Y==="path"?Ll():Y==="focus"?Al():Zs(),ie.classList.toggle("focus",Y==="focus"),u.forEach(t=>{let a=t.el.style;a.setProperty("--cx",t.cx),a.setProperty("--cy",t.cy)}),Bl(),kt(),$o()}function Bl(){let e="";if(Y==="focus"){yo.innerHTML="";return}if(Y==="path"){for(let t=1;t<y.length;t++){let a=u.get(y[t-1]),o=u.get(y[t]);e+='<path data-from="'+a.id+'" data-to="'+o.id+'" d="M '+a.cx+" "+a.cy+" L "+o.cx+" "+o.cy+'"/>'}yo.innerHTML=e;return}u.forEach(t=>{if(!t.parent)return;let a=u.get(t.parent);if(Y==="radial")e+='<path data-from="'+a.id+'" data-to="'+t.id+'" d="M '+a.cx+" "+a.cy+" L "+t.cx+" "+t.cy+'"/>';else{let o=a.cy+a._h/2,r=t.cy-t._h/2,n=o+(r-o)/2;e+='<path data-from="'+a.id+'" data-to="'+t.id+'" d="M '+a.cx+" "+o+" L "+a.cx+" "+n+" L "+t.cx+" "+n+" L "+t.cx+" "+r+'"/>'}}),yo.innerHTML=e}function Wa(e){let t=[],a=e;for(;a;)t.unshift(a),a=u.get(a).parent;return t}function ht(){let e=H.clientWidth,t=H.clientHeight;ie.style.transform="translate("+e/2+"px,"+t/2+"px) scale("+P.zoom+") translate("+-P.x+"px,"+-P.y+"px)",si()}function Ko(){Ht&&(Ht.kill(),Ht=null)}function Zn(e,t){if(Ko(),t||wt||!window.gsap){Object.assign(P,e),ht();return}let a=H.clientWidth,o=Math.hypot(e.x-P.x,e.y-P.y),r=e.zoom,n=gsap.timeline({onUpdate:ht,onComplete:()=>{Ht=null}}),{zoom:i,...s}=e,l=o*Math.min(P.zoom,r),c=Math.max(.55,Math.min(1.3,.55+l/a*.3));if(n.to(P,{...s,duration:c,ease:"power2.inOut"},0),l>a*1.2){let d=Math.max(.06,Math.min(P.zoom,r,a*.9/(o+dt)));n.to(P,{zoom:d,duration:c/2,ease:"sine.out"},0).to(P,{zoom:r,duration:c/2,ease:"sine.in"},c/2)}else n.to(P,{zoom:r,duration:c,ease:"power2.inOut"},0);Ht=n}function Ol(){let e=H.getBoundingClientRect(),t=14,a=[];if(!Te.hidden&&Te.offsetWidth){let r=Te.getBoundingClientRect();a.push({x0:r.left-e.left-t,y0:r.top-e.top-t,x1:r.right-e.left+t,y1:r.bottom-e.top+t})}let o=$s();return o&&a.push({x0:o.x0-t,y0:o.y0-t,x1:o.x1+t,y1:o.y1+t}),a}function Il(){let e=H.clientWidth,t=H.clientHeight,a=[{x0:16,y0:K?20:56,x1:e-16,y1:t-(K?20:74)}];return Ol().forEach(o=>{let r=[];a.forEach(n=>{if(o.x1<=n.x0||o.x0>=n.x1||o.y1<=n.y0||o.y0>=n.y1){r.push(n);return}[{...n,x1:Math.min(n.x1,o.x0)},{...n,x0:Math.max(n.x0,o.x1)},{...n,y1:Math.min(n.y1,o.y0)},{...n,y0:Math.max(n.y0,o.y1)}].forEach(i=>{i.x1-i.x0>80&&i.y1-i.y0>80&&r.push(i)})}),r.length&&(a=r)}),a}function Io(e,t,a){let o=H.clientWidth,r=H.clientHeight,n=null;return Il().forEach(i=>{let s=a*Math.min((i.x1-i.x0)/e,(i.y1-i.y0)/t);(!n||s>n.zoom)&&(n={zoom:s,sx:(i.x0+i.x1)/2-o/2,sy:(i.y0+i.y1)/2-r/2})}),n}function ei(e,t,a,o){return{x:e-a.sx/o,y:t-a.sy/o}}function Ke(e,t){let a=u.get(e);if(!a)return;let o=Io(a._w,a._h,Wt),r=vt(e),n=y.filter(l=>vt(l)===r&&!u.get(l).visual).map(l=>{let c=u.get(l);return Io(c._w,c._h,Wt).zoom}).sort((l,c)=>l-c),i=n.length?n[Math.floor((n.length-1)/2)]:o.zoom,s=Math.max(.2,Math.min(5,o.zoom,i));Zn(Object.assign(ei(a.cx,a.cy,o,s),{zoom:s}),t)}function Xt(e){let t=[...u.values()];if(!t.length)return;let a=H.clientWidth,o=H.clientHeight,r=Math.min(...t.map(d=>d.cx-d._w/2)),n=Math.max(...t.map(d=>d.cx+d._w/2)),i=Math.min(...t.map(d=>d.cy-d._h/2)),s=Math.max(...t.map(d=>d.cy+d._h/2)),l=Io(n-r,s-i,.94),c=Math.max(.05,Math.min(1,l.zoom));Zn(Object.assign(ei((r+n)/2,(i+s)/2,l,c),{zoom:c}),e)}function xe(e){f&&u.has(f)?Ke(f,e):Xt(e)}function kt(){let e=f?Wa(f):[];u.forEach(t=>{let a=t.el;a.classList.toggle("current",t.id===f),a.classList.toggle("active-path",e.includes(t.id))}),ie.querySelectorAll("#connectors path").forEach(t=>{let a=Y==="path"?!!f&&y.indexOf(t.dataset.to)<=y.indexOf(f):e.includes(t.dataset.from)&&e.includes(t.dataset.to);t.classList.toggle("active",a)}),Dl(e),ai()}function ti(){return Fr(new URLSearchParams(location.search).get("duration")??R.duration)}function zl(){return K&&ti()>0&&(!h.active||/^always$/i.test(R.timer||""))}function Ba(){let e=zl()&&Pe.start>0;if(_e.classList.toggle("timed",e),!e){_e.classList.remove("over");return}let a=(h.active&&h.t0?ft():performance.now()-Pe.start)/ti();_e.firstChild.style.width=Math.min(100,a*100)+"%",_e.classList.toggle("over",a>=1)}function Pl(){Pe.start=performance.now(),clearInterval(Pe.timer),Pe.timer=setInterval(Ba,1e3),Ba()}function Rl(){clearInterval(Pe.timer),Pe.timer=null,Pe.start=0,Ba()}function ai(){let e=K&&y.length>1&&!/^(off|no|false)$/i.test(R.progress||"");if(_e.classList.toggle("show",e),!e)return;Ba();let t=y.indexOf(f),a=0,o=0;y.forEach((r,n)=>{let i=xt(u.get(r)).length;a+=i,n<t?o+=i:n===t&&(o+=Math.min(we,i-1)+1)}),_e.lastChild.style.width=(a?o/a*100:0)+"%"}function Dl(e){kn.innerHTML=e.map((t,a)=>(a>0?'<span class="sep">\u203A</span>':"")+'<button class="crumb-btn'+(t===f?" here":"")+'" data-id="'+B(t)+'">'+B(u.get(t).title)+"</button>").join(""),kn.querySelectorAll(".crumb-btn").forEach(t=>t.addEventListener("click",()=>{h.active||j(t.dataset.id)}))}function Qt(e){let t=u.get(f);t&&(Yo(t,Vn().frag,e),Vo(),(z.hidden||!Ye||!Ye.full)&&Hl(t),Jo(t))}function Nl(e){return!y.length||e.id!==y[0]&&e.id!==y[y.length-1]||e.el.querySelector("[data-gsap], .title-scramble")?null:[...e.el.querySelector(".body").children].filter(t=>!t.classList.contains("fragment"))}function Hl(e){if(e._played||!window.gsap||wt)return;e._played=!0;let t=Nl(e);if(t&&t.length){e._auto=t;let[a,...o]=t;/^H[1-3]$/.test(a.tagName)&&!a.children.length?(a.classList.add("auto-scramble"),Ln(a)):o.unshift(a),gsap.from(o,{opacity:0,y:24,duration:.7,ease:"power2.out",delay:.5,stagger:.45})}e.el.querySelectorAll("[data-gsap]").forEach(a=>{let o;try{o=JSON.parse(a.dataset.gsap)}catch{return}let r={duration:o.duration??1,delay:o.delay??0,ease:o.ease||"power2.out"};o.to?gsap.fromTo(a,o.from||{},Object.assign({},o.to,r)):o.from&&gsap.from(a,Object.assign({},o.from,r))}),e.el.querySelectorAll(".title-scramble").forEach(Ln)}function qt(e){!e||!e._played||(e._played=!1,window.gsap&&(e._auto&&(e._auto.forEach(t=>{gsap.killTweensOf(t),gsap.set(t,{clearProps:"opacity,transform"})}),e._auto=null),e.el.querySelectorAll("[data-gsap]").forEach(t=>{gsap.killTweensOf(t);let a={};try{a=JSON.parse(t.dataset.gsap)}catch{}let o=new Set(Object.keys(Object.assign({},a.from,a.to)).map(r=>Fl.includes(r)?"transform":r));o.size&&gsap.set(t,{clearProps:[...o].join(",")})}),e.el.querySelectorAll(".title-scramble, .auto-scramble").forEach(t=>{t._scramble&&t._scramble.kill(),t.dataset.text&&(t.textContent=t.dataset.text)})))}function Ln(e){let t=e.dataset.text||(e.dataset.text=e.textContent),a=Array.from(t),o="ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789#%&*+=?",r={p:0};e._scramble=gsap.to(r,{p:1,duration:1.4,ease:"none",onUpdate(){let n=Math.floor(r.p*a.length);e.textContent=a.map((i,s)=>s<n||/\s/.test(i)?i:o[Math.random()*o.length|0]).join("")},onComplete(){e.textContent=t}})}function Jo(e){clearTimeout(pt),!(!K||!e||!e.autoslide||h.active&&(!h.t0||h.paused))&&(pt=setTimeout(()=>{f===e.id&&Re(1)},e.autoslide))}function oi(e){let t=e&&e!==y[0]?e:"";try{E&&E.kind==="share"?history.replaceState(null,"",location.pathname+location.search+io(E.data,t)):history.replaceState(null,"",e?"#"+encodeURIComponent(e):location.pathname+location.search)}catch{}}function j(e,t,a){if(!u.has(e))return;if(e!==f){ge=null,Ie=-1,we=a?xt(u.get(e)).length-1:0;let n=u.get(f);n&&Y==="focus"&&!t&&(n.el.classList.add("leaving"),setTimeout(()=>n.el.classList.remove("leaving"),600)),ni()}let o=e!==f;if(o&&(ri=f),f=e,clearTimeout(me),me=null,o&&Y==="focus"&&!t&&!wt){let n=u.get(e).el;n.classList.add("entering"),n.offsetWidth,n.classList.remove("entering")}Qt(o),o&&!Ce&&Yt("slide",e);let r=u.get(e);o&&r.mapFirst&&!a&&!t&&Y!=="focus"?(Xt(),me=setTimeout(()=>{me=null,f===e&&Ke(e)},1900)):Ke(e,t),kt(),$o(),oi(e)}function ni(){let e=u.get(f);e&&(e.el.querySelectorAll("figure.yt").forEach(t=>$n(t,"pauseVideo")),Yo(e,e.frags.length,!0),qt(e))}function jl(){if(!f&&Ue&&u.has(Ue)){ii();return}f&&(Ue=f),Y==="focus"&&qa("path"),ni(),clearTimeout(pt),f=null,kt(),$o(),Xt(),oi(null)}function ii(){if(me)return clearTimeout(me),me=null,Ke(f),!0;if(!f&&Ue&&u.has(Ue)){let e=Ue;return Ue=null,j(e),!0}return!1}function Re(e){if(!f){y.length&&j(y[e>0?0:y.length-1]);return}if(me&&e>0){clearTimeout(me),me=null,Ke(f);return}let t=xt(u.get(f)),a=Math.min(we,t.length-1)+e;if(a>=0&&a<t.length){we=a,ge=null,Ie=-1,Qt(),!ae&&!z.hidden&&Ye.used?Qe():xe(),kt();return}let o=y.indexOf(f)+e;o>=0&&o<y.length&&j(y[o],!1,e<0)}function _l(){let e=u.get(f);e&&e.parent&&j(e.parent)}function Ul(){let e=u.get(f);e&&e.children.length?j(e.children[0]):!f&&y.length&&j(y[0])}function $o(){let e=[...u.values()];if(!e.length){To.innerHTML="",Se=null;return}zs.textContent="map";let t=p=>p.cx,a=p=>p.cy,o=Math.min(...e.map(t))-dt/2,r=Math.max(...e.map(t))+dt/2,n=Math.min(...e.map(a))-Lo/2,i=Math.max(...e.map(a))+Lo/2,s=16,l=180,c=130,d=Math.min((l-2*s)/Math.max(1,r-o),(c-2*s-6)/Math.max(1,i-n)),L=l/2-(o+r)/2*d,g=c/2+5-(n+i)/2*d,b=f?Wa(f):[],v="";e.forEach(p=>{if(!p.parent)return;let M=u.get(p.parent);v+='<line x1="'+(t(M)*d+L)+'" y1="'+(a(M)*d+g)+'" x2="'+(t(p)*d+L)+'" y2="'+(a(p)*d+g)+'" stroke="var(--panel-line)" stroke-width="1"/>'}),e.forEach(p=>{let M=p.id===f?"var(--accent)":b.includes(p.id)?"var(--accent-teal)":"var(--node-border)";v+='<circle data-id="'+B(p.id)+'" cx="'+(t(p)*d+L)+'" cy="'+(a(p)*d+g)+'" r="'+(p.id===f?4:3)+'" fill="'+M+'"><title>'+B(p.title)+"</title></circle>"}),v+='<rect id="mm-viewport" fill="none" stroke="var(--accent)" stroke-width="1" opacity="0.7"/>',To.innerHTML=v,Se={s:d,ox:L,oy:g},si()}function si(){let e=document.getElementById("mm-viewport");if(!e||!Se)return;let t=H.clientWidth/P.zoom,a=H.clientHeight/P.zoom;e.setAttribute("x",(P.x-t/2)*Se.s+Se.ox),e.setAttribute("y",(P.y-a/2)*Se.s+Se.oy),e.setAttribute("width",Math.max(2,t*Se.s)),e.setAttribute("height",Math.max(2,a*Se.s))}function ut(e){Yn(ne.value),f&&!u.has(f)&&(f=null),Qn(),f?j(f,e):y.length?j(y[0],e):(f=null,Xt(!0))}function qa(e,t){Y=e,V("slidetake:layout",e),document.querySelectorAll("#layout-toggle .seg-btn").forEach(a=>a.classList.toggle("active",a.dataset.mode===e)),u.size&&(!t&&!wt&&(ie.classList.add("morph"),setTimeout(()=>ie.classList.remove("morph"),700)),$t(),ht(),f?Ke(f,t):Xt(t))}function li(e){return Math.max(.04,Math.min(5,e))}function Wl(e){Wt=Math.round(Math.max(Hs,Math.min(js,e))*100)/100,V("slidetake:slideSize",Wt),f&&Ke(f)}function An(e){f?Wl(Wt+e*.1):ci(e>0?1.2:1/1.2)}function ci(e,t,a){Ko();let o=li(P.zoom*e);if(t!==void 0){let r=H.getBoundingClientRect(),n=t-r.left-r.width/2,i=a-r.top-r.height/2;P.x+=n/P.zoom-n/o,P.y+=i/P.zoom-i/o}P.zoom=o,ht()}function Ga(){_||(Fe.classList.toggle("collapsed"),document.getElementById("btn-edit-toggle").classList.toggle("active",!Fe.classList.contains("collapsed")))}function ye(e){K=e,document.body.classList.toggle("presenting",e),Qi(document.getElementById("btn-present"),e),Zi();let t=document.documentElement;e&&t.requestFullscreen&&!document.fullscreenElement&&t.requestFullscreen().catch(()=>{}),!e&&document.fullscreenElement&&document.exitFullscreen&&document.exitFullscreen().catch(()=>{}),e&&!f&&y.length&&j(y[0]);let a=R.camera||[...u.values()].some(o=>o.camera);e&&a&&!ae&&!oe&&Qe(),e?Jo(u.get(f)):clearTimeout(pt),e?Pl():Rl(),ai()}function ft(){return(h.paused?h.pauseAt:performance.now())-h.t0-h.pausedMs}function Zt(e){e.classList.add("open")}function Yl(e){if(V("slidetake:analytics",e?"on":"off"),!e){window["ga-disable-"+Gl]=!0;let t=["","; Domain="+location.hostname,"; Domain=."+location.hostname.replace(/^www\./,"")];document.cookie.split(";").map(a=>a.split("=")[0].trim()).filter(a=>a==="_ga"||a.startsWith("_ga_")).forEach(a=>t.forEach(o=>{document.cookie=a+"=; Max-Age=0; Path=/"+o}))}hi()}function hi(){Zo.querySelectorAll("[data-analytics]").forEach(e=>e.setAttribute("aria-checked",String(e.dataset.analytics==="on"===Vl())))}function Va(){document.querySelectorAll(".modal.open").forEach(e=>e.classList.remove("open"))}function Kl(){let e=new URLSearchParams(location.search).get("obs");if(e){let[t,a,...o]=e.split(":");return Oa.value=t||"localhost",Ia.value=a||"4455",za.value=o.join(":"),!0}try{let t=JSON.parse(U("slidetake:obs")||"null");t&&(Oa.value=t.host||"localhost",Ia.value=t.port||"4455",za.value=t.password||"",Xo.checked=!0)}catch{}return!1}function ui(){if(Xo.checked)V("slidetake:obs",JSON.stringify({host:Oa.value.trim(),port:Ia.value.trim(),password:za.value}));else try{localStorage.removeItem("slidetake:obs")}catch{}}function zt(e,t,a){jt.textContent=e,jt.className=t||"",jt.title=a||e;let o=document.getElementById("obs-detail");o.textContent=a||"",o.hidden=!a}function $l(e){return location.protocol==="https:"&&!Jl(e)}async function fi(){let e=Oa.value.trim()||"localhost",t="ws://"+e+":"+(Ia.value.trim()||"4455");if($l(e)){Oe=!1,zt("Blocked here","err",Xl);return}zt("Connecting\u2026"),jt.title="Connecting to "+t;try{await Oo(ql);let a=window.OBSWebSocket&&(window.OBSWebSocket.default||window.OBSWebSocket);if(re)try{await re.disconnect()}catch{}re=new a,re.on("ConnectionClosed",()=>{Oe=!1,zt("Disconnected","err")}),re.on("RecordStateChanged",r=>{r.outputState==="OBS_WEBSOCKET_OUTPUT_STARTED"&&We&&(We(),We=null),r.outputState==="OBS_WEBSOCKET_OUTPUT_STOPPED"&&h.active&&h.withObs&&!h.finishing&&yt("Stopped in OBS")});let o=await re.connect(t,za.value||void 0);Oe=!0;try{let r=await re.call("GetVideoSettings");r&&r.fpsNumerator&&r.fpsDenominator&&(Qo=r.fpsNumerator/r.fpsDenominator),di=r&&r.outputWidth&&r.outputHeight?pn(r.outputWidth,r.outputHeight):""}catch{}zt("Connected","ok",""),jt.title="Connected"+(o&&o.obsWebSocketVersion?" \xB7 OBS WebSocket "+o.obsWebSocketVersion:""),ui(),se.classList.contains("open")&&Ka()&&(A("Connected to OBS. Press \u25CF Record."),Me())}catch(a){Oe=!1;let o=a&&a.message&&a.message!=="Error"?a.message+".":"Nothing answered at "+t+".";zt("Could not connect","err",o+" Is OBS running with its WebSocket server on, and are the port and password right?")}}function Ql(){let e=document.getElementById("rec-screen"),t=screen.width,a=screen.height;if(Math.abs(t/a-16/9)<.02){e.innerHTML='<span class="ok">This screen is 16:9 ('+t+"\xD7"+a+"), right for YouTube.</span>";return}let o=[["16:10",1.6],["3:2",1.5],["4:3",4/3],["21:9",21/9],["16:9",16/9]],[r,n]=o.reduce((s,l)=>Math.abs(l[1]-t/a)<Math.abs(s[1]-t/a)?l:s),i=Math.abs(n-t/a)<.005?r:"about "+r;e.innerHTML='<span class="warn">This screen is '+i+" ("+t+"\xD7"+a+"), not 16:9, so the video will have bars or be cropped. Move this window to a 16:9 screen, physical or virtual (say 1920\xD71080), then press F there.</span>"}function Xe(){let e=navigator.mediaDevices;if(!window.isSecureContext||!e||!e.getDisplayMedia)return{why:"This page can\u2019t capture itself here. Open Slidetake in Chrome or Edge on a computer."};if(!window.RestrictionTarget&&!window.CropTarget)return{why:"Recording in the browser needs Chrome or Edge (or another Chromium browser) on a computer."};let t=window.MediaRecorder?cn(r=>MediaRecorder.isTypeSupported(r)):"";if(!t||!navigator.storage||!navigator.storage.getDirectory)return{why:"This browser can\u2019t record video here. Use a recent Chrome or Edge."};let{quality:a,device:o}=ln(screen.width,screen.height,devicePixelRatio||1);return a?{ok:!0,type:t,quality:a}:{why:"This screen gives a "+o[0]+"\xD7"+o[1]+" frame, less than 720p. Use pro mode (OBS), or a larger screen."}}async function Ya(){Ro++,de&&(cancelAnimationFrame(de.raf),de.stream.getTracks().forEach(e=>e.stop()),de.ctx.close().catch(()=>{}),de=null,Po.value=0)}async function Pa(){await Ya();let e=Ro;try{let t=mt.value,a=await navigator.mediaDevices.getUserMedia({audio:Bi(t)});if(e!==Ro){a.getTracks().forEach(l=>l.stop());return}let o=new AudioContext,r=o.createAnalyser();r.fftSize=512,o.createMediaStreamSource(a).connect(r);let n=new Float32Array(r.fftSize),i=de={stream:a,ctx:o,raf:0},s=()=>{if(de!==i)return;r.getFloatTimeDomainData(n);let l=0;for(let c of n)l=Math.max(l,Math.abs(c));Po.value=Math.max(l,Po.value*.85),i.raf=requestAnimationFrame(s)};s()}catch(t){it.innerHTML='<span class="warn">The microphone isn\u2019t available: '+B(t.message||t.name)+". Allow it in the site settings.</span>"}}async function Ra(e=!0){try{e&&!de&&await Pa();let t=await navigator.mediaDevices.enumerateDevices(),a=(n,i)=>{let s=t.filter(v=>v.kind===n),l=s.find(v=>v.deviceId==="default"),c=l?l.label.replace(/^Default - /,""):"",d=s.filter(v=>v.deviceId!=="default"&&v.deviceId!=="communications"),L=v=>!!l&&(v.label===c||!!l.groupId&&v.groupId===l.groupId&&!d.some(p=>p!==v&&p.label===c)),g=d.map((v,p)=>hn(v.label)||(n==="audioinput"?"Microphone ":"Camera ")+(p+1));g.forEach((v,p)=>{let M=g.slice(0,p).filter(T=>T===v).length;M&&(g[p]=v+" "+(M+1))});let b=d.some(v=>v.deviceId===i)||i==="none"?i:(d.find(L)||d[0]||{}).deviceId;return d.map((v,p)=>'<option value="'+B(v.deviceId)+'"'+(v.deviceId===b?" selected":"")+">"+B(g[p]+(L(v)?" (system default)":""))+"</option>").join("")},o=er();_t.innerHTML='<option value="none"'+(o==="none"?" selected":"")+">No camera</option>"+a("videoinput",o);let r=U("slidetake:mic")||"";mt.innerHTML=a("audioinput",r),r&&mt.value===r&&de&&de.stream.getAudioTracks()[0].getSettings().deviceId!==r&&Pa()}catch{}}function er(){let e=U(gi());return e||(ec()?U("slidetake:cam")||"default":"none")}function tc(e){V(gi(),e),e!=="none"&&e!=="default"&&V("slidetake:cam",e)}function ac(){h.camWas=!oe;let e=er()!=="none";e!==!oe&&ra(e,!0)}function yi(){h.camWas!=null&&(h.camWas!==!oe&&ra(h.camWas,!0),h.camWas=null)}async function vi(){let e=Xe();if(!e.ok)return it.innerHTML='<span class="warn">'+B(e.why)+"</span>",e;Ea&&(it.innerHTML='<span class="warn">'+B(Ea)+"</span>",Ea="");let t=rt.indexOf(e.quality),a=U("slidetake:quality");gt.innerHTML=rt.slice(t).map(r=>"<option"+(r.name===a?" selected":"")+">"+r.name+"</option>").join("");let o="";try{let{quota:r,usage:n}=await navigator.storage.estimate(),i=rt.find(s=>s.name===gt.value)||e.quality;o=" Room for about "+Math.floor((r-n)/dn(i))+" minutes of takes."}catch{}return it.querySelector(".warn")||(it.innerHTML='<span class="ok">Ready: this screen records up to '+e.quality.name+" in fullscreen."+B(o)+"</span>"),e}function bi(e){mi=e,V("slidetake:rec-mode",e),se.classList.contains("open")&&Da({setup:!0})}function Da(e={}){bt&&(Xe().ok&&(mi||"browser")==="browser"?hr(e):oc(e))}function oc(e={}){let t=rr().find(a=>a.key===Je()&&a.withObs&&!a.inBrowser);Pi(t||{key:Je(),deckTitle:R.title||(y[0]?u.get(y[0]).title:"Deck"),date:new Date().toISOString(),withObs:!0,outputPath:null,reason:"",total:0,totalObs:null,fps:Qo,events:[],picks:{},empty:!0},e)}async function tr(e,t){return(await(await navigator.storage.getDirectory()).getDirectoryHandle("slidetake-takes",{create:!0})).getDirectoryHandle(e,{create:!!t})}async function ar(e){try{await(await(await navigator.storage.getDirectory()).getDirectoryHandle("slidetake-takes")).removeEntry(e,{recursive:!0})}catch{}}async function xi(e){window.RestrictionTarget&&e.restrictTo?await e.restrictTo(await RestrictionTarget.fromElement(Ao)):await e.cropTo(await CropTarget.fromElement(Ao))}async function rc(e){try{window.RestrictionTarget&&e.track.restrictTo?await e.track.restrictTo(null):await e.track.cropTo(null),await xi(e.track)}catch{}await e.track.applyConstraints(wi(e.quality)).catch(()=>{}),await Vt()}async function nc(){let e=Xe();if(!e.ok)throw new Error(e.why);let t=rt.find(s=>s.name===gt.value)||e.quality;document.body.classList.add("rec-frame");let a=await navigator.mediaDevices.getDisplayMedia({video:{frameRate:Ot},audio:!1,preferCurrentTab:!0,selfBrowserSurface:"include",surfaceSwitching:"exclude",monitorTypeSurfaces:"exclude"}),o=a.getVideoTracks()[0],r=()=>a.getTracks().forEach(s=>s.stop());if(!o.restrictTo&&!o.cropTo)throw r(),new Error("Share \u201Cthis tab\u201D to record the slides.");try{await xi(o)}catch(s){throw r(),new Error("Chrome could not record just the slides ("+(s.message||s.name)+").")}await o.applyConstraints(wi(t)).catch(()=>{});let n;try{let s=U("slidetake:mic");n=await navigator.mediaDevices.getUserMedia({audio:Bi(s)})}catch(s){throw r(),new Error("The microphone isn\u2019t available ("+(s.message||s.name)+").")}let i=new Date().toISOString().replace(/[:.]/g,"-");h.browser={id:i,display:a,mic:n,track:o,quality:t,type:e.type,stream:new MediaStream([o,...n.getAudioTracks()]),dir:await tr(i,!0),clips:[],cur:null,chain:Promise.resolve(),error:null},o.addEventListener("ended",()=>{h.active&&!h.finishing&&yt("Sharing stopped")})}function ki(){let e=h.browser;e&&(e.display.getTracks().forEach(t=>t.stop()),e.mic.getTracks().forEach(t=>t.stop()),document.body.classList.remove("rec-frame"))}function ic(e){let t=h.browser,a="take-"+t.clips.length+"."+ho(t.type),o={name:a,rec:null,done:null};t.clips.push(o),e.clip=t.id+"/"+a,t.chain=t.chain.then(async()=>{let r=await(await t.dir.getFileHandle(a,{create:!0})).createWritable(),n=new MediaRecorder(t.stream,{mimeType:t.type,videoBitsPerSecond:t.quality.bitrate,audioBitsPerSecond:ga}),i=Promise.resolve();n.ondataavailable=l=>{l.data.size&&(i=i.then(()=>r.write(l.data)).catch(c=>{t.error=c}))},o.done=new Promise(l=>{n.onstop=async()=>{await i,await r.close().catch(()=>{}),l()}}),await new Promise(l=>{n.onstart=l,n.start(1e3)}),e.t=Math.round(ft()),e.cutAt!=null&&(e.lead=Math.max(0,Math.round(e.t-e.cutAt)));let s=t.cur;t.cur=o,o.rec=n,s&&s.rec.state!=="inactive"&&s.rec.stop()}).catch(r=>{t.error=r})}async function Pn(e,t){if(h.active||!y.length)return;let a=e==="obs";if(Ya(),e==="browser"){K||ye(!0);try{await nc()}catch(c){document.body.classList.remove("rec-frame"),K&&ye(!1),Ea=c.name==="NotAllowedError"?"Recording needs this tab shared: press \u25CF Record again and choose Share.":c.message,hr({setup:!0});return}}Va();let o=t&&t.length?t.filter(c=>y.includes(c)):null,r=o?o[0]:y[0],n=y[y.indexOf(r)-1]||null;Object.assign(h,{active:!0,withObs:a,counting:!0,paused:!1,finishing:!1,t0:0,pausedMs:0,events:[],outputPath:null,only:o?new Set(o):null}),e!=="browser"&&(h.browser=null),document.body.classList.add("recording"),ur();let i=document.getElementById("rec-layout").value;i!=="current"&&i!==Y&&qa(i,!0),K||ye(!0),ac(),n?(document.body.classList.add("no-anim"),u.get(n)._played=!0,Ce=!0,j(n,!0,!0),Ce=!1,z.getAnimations().forEach(c=>c.finish()),await Vt(),document.body.classList.remove("no-anim")):(f===r&&(we=0,ge=null,Ie=-1),j(r,!0)),!document.fullscreenElement&&document.documentElement.requestFullscreen&&await document.documentElement.requestFullscreen().catch(()=>{});let s=Rt.querySelector(".hint");for(let c=3;c>0;c--)if(s.textContent=(document.fullscreenElement?"":"Press F for fullscreen \xB7 ")+"recording starts after the countdown \xB7 Esc to cancel",Rt.querySelector(".num").textContent=c,Rt.classList.add("show"),await Gt(1e3),!h.active)return;if(Rt.classList.remove("show"),await Vt(),a){let c=new Promise(d=>{We=d,setTimeout(()=>{We&&(We(),We=null)},2500)});try{await re.call("StartRecord")}catch(d){or("OBS could not start recording: "+(d&&d.message||d));return}if(await c,!h.active)return}h.browser&&await rc(h.browser),h.counting=!1,h.t0=performance.now();let l=u.get(r);if(n){Yt("slide",r),h.browser&&await h.browser.chain,qt(l),Ce=!0,j(r),Ce=!1;return}qt(l),Qt(!0),Yt("slide",f)}function or(e){if(h.active=!1,h.counting=!1,h.browser){let t=h.browser;t.chain.then(()=>{t.cur&&t.cur.rec.state!=="inactive"&&t.cur.rec.stop()}).then(()=>ar(t.id)),ki(),h.browser=null}Rt.classList.remove("show"),document.body.classList.remove("recording"),K&&ye(!1),yi(),lt(e)}function Yt(e,t,a){if(!h.active||!h.t0||h.finishing)return;let o=u.get(t),r={id:t,title:o?o.title:t,retake:e==="retake",t:Math.round(ft()),obsT:null};a==null&&h.browser&&(a=r.t),a!=null&&(r.cutAt=a,r.lead=Math.max(0,Math.round(r.t-a))),h.events.push(r),h.browser&&ic(r),h.withObs&&Oe&&(re.call("GetRecordStatus").then(n=>{n&&typeof n.outputDuration=="number"&&(r.obsT=n.outputDuration)}).catch(()=>{}),o&&re.call("CreateRecordChapter",{chapterName:(r.retake?"RETAKE \xB7 ":"")+o.title}).catch(()=>{}))}function sc(e){let t=e.key;if((On.includes(t)||In.includes(t)||zn.includes(t)||t==="Escape")&&e.preventDefault(),t==="Escape"){h.counting?or("Take cancelled"):yt("Stopped early");return}if((t==="f"||t==="F")&&!document.fullscreenElement&&document.documentElement.requestFullscreen){e.preventDefault(),document.documentElement.requestFullscreen().catch(()=>{});return}if(!(h.counting||h.finishing||Ge)){if(zn.includes(t)){hc();return}h.paused||(On.includes(t)?lc():In.includes(t)&&cc())}}function lc(){let e=xt(u.get(f)),t=Math.min(we,e.length-1)>=e.length-1,a=y.indexOf(f);if(!t){Re(1);return}if(!h.only){a===y.length-1?yt():Re(1);return}let o=y.slice(a+1).find(r=>h.only.has(r));o?y[a+1]===o?Re(1):Si(y[y.indexOf(o)-1],o,"slide"):yt()}async function cc(){let e=u.get(f);if(!e||Ge)return;let t=f,a=ri;if(!a||a===t||!u.has(a)){dc(e);return}Si(a,t,"retake")}async function Si(e,t,a){let o=u.get(t);if(!o||Ge)return;Ge=!0;let r=ft();document.body.classList.add("no-anim");let n=u.get(e);Ce=!0,n._played=!0,j(e,!0,!0),z.getAnimations().forEach(i=>i.finish()),Ce=!1,await Vt(),document.body.classList.remove("no-anim"),Yt(a,t,r),h.browser&&await h.browser.chain,h.withObs&&await Ei(),qt(o),Ce=!0,j(t),Ce=!1,!ae&&!z.hidden&&Ye.used&&Qe(),Ge=!1}async function Ei(){let e=h.events[h.events.length-1];e&&(e.skip=Rn/2),await Gt(Rn)}async function dc(e){Ge=!0,we=0,ge=null,Ie=-1,qt(e),Qt(!0),!ae&&!z.hidden&&Ye.used?Qe():xe(),kt(),Yt("retake",f),h.withObs&&await Ei(),Ge=!1}async function hc(){if(h.t0)if(h.paused){if(zo.classList.remove("show"),await Vt(),h.withObs&&await re.call("ResumeRecord").catch(()=>{}),h.browser){let e=h.browser;e.chain=e.chain.then(()=>{e.cur&&e.cur.rec.state==="paused"&&e.cur.rec.resume()})}h.pausedMs+=performance.now()-h.pauseAt,h.paused=!1,Jo(u.get(f))}else{if(h.paused=!0,h.pauseAt=performance.now(),clearTimeout(pt),h.withObs&&await re.call("PauseRecord").catch(()=>{}),h.browser){let e=h.browser;e.chain=e.chain.then(()=>{e.cur&&e.cur.rec.state==="recording"&&e.cur.rec.pause()})}zo.classList.add("show")}}async function yt(e){if(!h.active||h.finishing)return;if(h.counting){or("Take cancelled");return}h.finishing=!0,clearTimeout(pt),h.paused&&(h.pausedMs+=performance.now()-h.pauseAt,h.paused=!1,zo.classList.remove("show"));let t=Math.round(ft()),a=null;if(h.withObs){try{let n=await re.call("GetRecordStatus");n&&typeof n.outputDuration=="number"&&(a=n.outputDuration)}catch{}await Gt(1200);try{let n=await re.call("StopRecord");h.outputPath=n&&n.outputPath}catch(n){e=(e?e+". ":"")+"OBS did not confirm the stop ("+(n&&n.message||n)+")"}}let o=h.browser;o&&(await Gt(600),await o.chain,t=Math.round(ft()),o.cur&&o.cur.rec&&o.cur.rec.state!=="inactive"&&o.cur.rec.stop(),await Promise.all(o.clips.map(n=>n.done)),ki(),h.browser=null,o.error&&(e=(e?e+". ":"")+"Some of the take could not be saved ("+(o.error.message||o.error.name)+")")),h.active=!1,h.finishing=!1,document.body.classList.remove("recording"),K&&ye(!1),yi();let r={key:Je(),deckTitle:R.title||u.get(y[0]).title,date:new Date().toISOString(),withObs:h.withObs,outputPath:h.outputPath,reason:e||"",total:t,totalObs:a,fps:o?Ot:Qo,...o?{inBrowser:!0,takesId:o.id,quality:o.quality.name,type:o.type}:{},events:h.events.map(n=>({id:n.id,title:n.title,retake:n.retake,t:n.t,obsT:n.obsT,...n.lead?{lead:n.lead}:{},...n.skip?{skip:n.skip}:{},...n.clip?{clip:n.clip}:{}})),picks:{}};if(r.inBrowser){bc(r);return}nr(r),Pi(r,{note:(e?e+". ":"")+fe(r).size+" slides recorded with OBS."})}function Je(){return tt(R.title||(y[0]?u.get(y[0]).title:"deck"))}function rr(){try{return JSON.parse(U("slidetake:sessions")||"[]")}catch{return[]}}function nr(e){let t=rr().filter(a=>a.date!==e.date);t.unshift(e),t.slice(12).forEach(a=>{a.takesId&&ar(a.takesId)}),V("slidetake:sessions",JSON.stringify(t.slice(0,12)))}function vt(e){let t=u.has(e)?Wa(e):[e];return t[Math.min(1,t.length-1)]}function Ci(e,t){let a=vt(e);return{sec:a,title:u.has(a)?u.get(a).title:t}}function A(e,{warn:t=!1,html:a="",title:o=""}={}){Pt.classList.toggle("warn",t),a?Pt.innerHTML=a:Pt.textContent=e,Pt.title=o||Pt.textContent;let r=document.getElementById("rv-save-again");r&&(r.onclick=()=>Wi(!0))}function Pi(e,t={}){Va(),N=e,Q=null;let a=e.events.filter(i=>i.retake).length,o=e.empty?"":fe(e).size+" slides, "+(a?a+" retake"+(a>1?"s":""):"no retakes")+", recorded "+at(e.totalObs??e.total)+". ";se.classList.remove("in-browser","board"),se.classList.add("obs");let r=document.getElementById("rv-rec");r.title="Records the deck with OBS: a new video in place of this one",r.disabled=!1,document.getElementById("rv-use-browser").style.display=Xe().ok?"":"none",document.getElementById("rv-render-btn").disabled=document.getElementById("rv-clean").disabled=!!e.cleaned,document.getElementById("rv-file").textContent=e.outputPath?" ("+ot(e.outputPath)+")":"";let n=fa(e);Fa.value=[...Fa.options].reduce((i,s)=>Math.abs(s.value-n)<Math.abs(i.value-n)?s:i).value,k.src&&(e.inBrowser||De!==ot(e.outputPath)&&e.outputPath)&&(k.removeAttribute("src"),k.load(),De=""),document.getElementById("rv-novideo").hidden=!!k.src||!!e.empty,Q=null,F=null,St(),Ja(),Zt(se),ve.open=!!t.setup||!Oe||!!e.empty,ve.open?dr():Ra(!1).then(Me),A(t.note||(e.empty?Oe?"Press \u25CF Record: OBS records the deck.":"Connect to OBS in Setup, then press \u25CF Record.":o+(k.src?"Click a take to preview it.":"Open the recording to preview it."))),e.empty||Sc(e)}function Ja(){if(N&&N.board){$e();return}let e=N,t=document.getElementById("rv-list"),a=null;t.innerHTML=[...fe(e).values()].map(o=>{let r=e.picks[o.id]??o.takes.length,n=vt(o.id),i=n!==a;a=n;let s=o.takes.map(l=>'<button class="rv-chip'+(r===l.no?" on":"")+'" data-id="'+B(o.id)+'" data-take="'+l.no+'">Take '+l.no+" \xB7 "+at(l.end-l.start)+"</button>").join("");return'<div class="rv-row'+(i?" sec":"")+'"><div class="t">'+B(o.title)+"<small>"+ia(o.takes[0].start)+'</small></div><div class="rv-chips">'+s+"</div></div>"}).join(""),t.querySelectorAll(".rv-chip").forEach(o=>o.onclick=()=>{e.picks[o.dataset.id]=+o.dataset.take,nr(e),Ja();let r=fe(e).get(o.dataset.id),n=r&&r.takes[+o.dataset.take-1];if(!n)return;let i=r.title+(r.takes.length>1?" \xB7 take "+n.no:"");if(e.inBrowser){let s=e.events.filter(l=>l.id===o.dataset.id)[n.no-1];s&&s.clip&&$a([{clip:s.clip,keep:(n.end-n.start)/1e3,title:i}])}else Ha([{start:n.start,end:n.end,title:i}])}),document.getElementById("rv-ffmpeg-copy").disabled=document.getElementById("rv-play-final").disabled=!e.events.length,Di(e),Ni(e)}function Di(e){let t=pc(e),a=document.getElementById("rv-chapters");Ri=t.lines.join(`
|
|
1314
|
-
`),a.disabled=t.lines.length<3,a.title=t.lines.length<3?"YouTube needs at least three chapters of 10 seconds or more":"Copies the "+t.lines.length+" chapters, to paste into the YouTube description"}function Fi(e,t){let a=e.dataset.label||(e.dataset.label=e.textContent);(navigator.clipboard?navigator.clipboard.writeText(t):Promise.reject()).catch(()=>{}),e.textContent="\u2713 Copied",clearTimeout(+e.dataset.timer),e.dataset.timer=String(setTimeout(()=>{e.textContent=a},1500))}async function Ni(e){let t=document.getElementById("rv-final"),a=++Eo,o=Bt(e).reduce((n,i)=>n+i.end-i.start,0),r=n=>(n?"about "+(n>1e9?(n/1e9).toFixed(1)+" GB":Math.max(1,Math.round(n/1e6))+" MB")+" \xB7 ":"Final cut ")+at(o);if(!e.inBrowser||e.cleaned){t.textContent=r(null);return}try{let n=0;for(let i of It(e))Ma.has(i.clip)||Ma.set(i.clip,(await ea(i.clip)).size),n+=Ma.get(i.clip);a===Eo&&(t.textContent=r(n))}catch{a===Eo&&(t.textContent=r(null))}}function Ha(e){if(!k.src){Na=e,A(jo?"Opening the recording\u2026 it plays when ready.":"Open the recording to preview.");return}Na=null,Q={ranges:e,i:0},A("\u25B6 "+e[0].title);let t=()=>{k.currentTime=e[0].start/1e3,k.play().catch(a=>{a&&a.name!=="AbortError"&&A("Could not play: "+a.message,{warn:!0})})};k.readyState>=1?t():k.addEventListener("loadedmetadata",t,{once:!0})}function St(){st=null}function ir(){let e=F&&!F.single&&!k.paused;Hi.textContent=e?"\u275A\u275A Pause":"\u25B6 Preview",document.querySelectorAll("#rv-list .rv-row.playing").forEach(o=>o.classList.remove("playing"));let t=F&&F.parts[F.i],a=t&&t.id&&document.querySelector('#rv-list .rv-row[data-id="'+CSS.escape(t.id)+'"]');a&&(a.classList.add("playing"),a.scrollIntoView({block:"nearest"}))}function fc(e){let t=N?It(N):[],a=t.findIndex(r=>r.id===e.id),o=a>=0?t[a+1]:null;st=o?o.id:null,A(o?"Preview continues from "+o.title+".":"That was the last slide: Preview plays from the start.")}function ji(e){return Array.from({length:e.numberOfChannels},(t,a)=>{let o=new Float32Array(e.numberOfFrames);return e.copyTo(o,{planeIndex:a,format:"f32-planar"}),o})}async function ea(e){let[t,a]=e.split("/");return(await(await tr(t)).getFileHandle(a)).getFile()}async function $a(e,t=0,a=!1){if(!(!N||N.cleaned||!e.length)){Q=null,F={parts:e,i:t,single:a};try{let o=await ea(e[t].clip);if(!se.classList.contains("open"))return;k.src&&URL.revokeObjectURL(k.src),k.src=URL.createObjectURL(o),A("\u25B6 "+e[t].title),await k.play()}catch(o){if(o&&o.name==="AbortError")return;F=null,A(o&&o.name==="NotFoundError"?"This take is no longer in the browser.":"Could not play this take: "+(o&&o.message||o),{warn:!0})}}}function _i(){let e=F;if(e.i+1<e.parts.length){$a(e.parts,e.i+1,e.single);return}F=null,k.pause(),e.single?fc(e.parts[0]):A(""),ir()}async function mc(e){if(!e.where)return!0;try{let t=await pr("video-folder");return!t||t.name!==e.where||await t.queryPermission({mode:"readwrite"})!=="granted"||await t.getFileHandle(e.name),!0}catch{return!1}}async function Wi(e){let t=N;if(!t||!t.inBrowser||t.cleaned)return;let a=It(t);if(!a.length){A("No slide has a take yet: nothing to save.",{warn:!0});return}let o=JSON.stringify([a.map(d=>[d.clip,Math.round(d.keep*1e3)]),Ve(),Kt(),t.type]),r=t.board&&O.lastDownload;if(!e&&r&&r.sig===o&&await mc(r)){A("",{html:'<button class="btn small" id="rv-save-again">Save another copy</button> Already saved in '+B(Co(r))+".",title:"Already saved in "+Co(r)+". A new video is made only when a take or the sound settings change."});return}let n=ho(t.type||"")==="mp4",i=Je()+" "+yc(new Date)+"."+(n?"mp4":"webm"),s=null,l="";try{let d=await qi(!1);d&&(s=await(await d.getFileHandle(i,{create:!0})).createWritable(),l=d.name)}catch(d){if(d&&d.name==="AbortError")return}let c=sr;c.disabled=!0,je("Preparing\u2026");try{let d=await import(Zl),L=s?new d.StreamTarget(s):new d.BufferTarget,g=new d.Output({format:n?new d.Mp4OutputFormat({fastStart:s?!1:"in-memory"}):new d.WebMOutputFormat,target:L}),b=1,v="",p=Ve()&&Kt();if(Ve()){let D=await Dn(d,a,1,!1,"Measuring");if(D&&isFinite(D.integrated)){let W=uo(D,{limit:p});if(p&&Math.abs(W)>=.05){let X=await Dn(d,a,ba(W),!0,"Checking");X&&isFinite(X.integrated)&&(W=Math.min(W+(-14-X.integrated),po))}b=ba(W);let ce=p?-14:D.integrated+W,te=!p&&uo(D,{limit:!0})-W>.5;v=" \xB7 loudness "+D.integrated.toFixed(1)+(Math.abs(W)<.05?" LUFS, left as is":" \u2192 "+ce.toFixed(1)+" LUFS")+(te?"; a loud peak held it back, turn on Peak limiter to reach "+-14:"")}}let M=b!==1||p;await gc(d,a);let T=null,w=null,x=0,m=-1,S=-1,C=null,J=[],ee=async()=>{for(;J.length&&C.ready()>=J[0].n;){let D=J.shift(),W=C.take(D.n),ce=new Float32Array(D.n*D.ch);W.forEach((te,X)=>ce.set(te,X*D.n)),await w.add(new d.AudioSample({data:ce,format:"f32-planar",numberOfChannels:D.ch,sampleRate:D.rate,timestamp:D.t}))}};for(let[D,W]of a.entries()){je("Joining "+(D+1)+"/"+a.length);let ce=new d.Input({source:new d.BlobSource(await ea(W.clip)),formats:d.ALL_FORMATS}),te=await ce.getPrimaryVideoTrack(),X=await ce.getPrimaryAudioTrack();if(!te)throw new Error(W.title+" has no video");T||(T=new d.EncodedVideoPacketSource(await te.getCodec()),g.addVideoTrack(T,{frameRate:Ot}),X&&(w=M?new d.AudioSampleSource({codec:n?"aac":"opus",bitrate:ga}):new d.EncodedAudioPacketSource(await X.getCodec()),g.addAudioTrack(w)),await g.start());let Ct={decoderConfig:await te.getDecoderConfig()},Ze=0,yr=!0;for await(let q of new d.EncodedPacketSink(te).packets())q.timestamp>=W.keep||(m=ya(m,x+q.timestamp),await T.add(q.clone({timestamp:m}),yr&&D===0?Ct:void 0),yr=!1,Ze=Math.max(Ze,q.timestamp+q.duration));if(X&&w&&M)for await(let q of new d.AudioSampleSink(X).samples(0,Ze)){if(q.timestamp+q.duration>Ze+1e-4){q.close();continue}S=ya(S,x+q.timestamp);let pe=ji(q);if(pe.forEach(ue=>{for(let et=0;et<ue.length;et++)ue[et]*=b}),p)C=C||fo(q.sampleRate,pe.length),C.push(pe),J.push({t:S,n:q.numberOfFrames,rate:q.sampleRate,ch:pe.length}),q.close(),await ee();else{let ue=q.numberOfFrames,et=new Float32Array(ue*pe.length);pe.forEach((ns,is)=>et.set(ns,is*ue)),await w.add(new d.AudioSample({data:et,format:"f32-planar",numberOfChannels:pe.length,sampleRate:q.sampleRate,timestamp:S})),q.close()}}else if(X&&w){let q={decoderConfig:await X.getDecoderConfig()},pe=!0;for await(let ue of new d.EncodedPacketSink(X).packets())ue.timestamp+ue.duration>Ze+1e-4||(S=ya(S,x+ue.timestamp),await w.add(ue.clone({timestamp:S}),pe&&D===0?q:void 0),pe=!1)}x+=Ze}if(C&&(C.end(),await ee(),C.events&&(v+=", "+C.events+" peak"+(C.events===1?"":"s")+" limited")),je("Finishing\u2026"),await g.finalize(),!s){let D=document.createElement("a");D.href=URL.createObjectURL(new Blob([L.buffer],{type:n?"video/mp4":"video/webm"})),D.download=i,D.click(),setTimeout(()=>URL.revokeObjectURL(D.href),1e4)}let $={sig:o,name:i,where:l};t.board&&(O.lastDownload=$,aa()),A("Saved in "+Co($)+" ("+at(x*1e3)+v+")."),je("\u2713 Saved"),Ui=setTimeout(()=>je(),2500)}catch(d){je(),A("Could not save the video: "+(d&&d.message||d),{warn:!0}),s&&s.abort().catch(()=>{})}finally{c.disabled=!!t.cleaned}}async function Dn(e,t,a,o,r){let n=null,i=null;for(let[s,l]of t.entries()){je(r+" "+(s+1)+"/"+t.length);let c=await new e.Input({source:new e.BlobSource(await ea(l.clip)),formats:e.ALL_FORMATS}).getPrimaryAudioTrack();if(c)for await(let d of new e.AudioSampleSink(c).samples(0,l.keep)){let L=ji(d);n=n||fn(d.sampleRate,L.length),a!==1&&o?(L.forEach(g=>{for(let b=0;b<g.length;b++)g[b]*=a}),i=i||fo(d.sampleRate,L.length),i.push(L),i.ready()&&n.add(i.take(i.ready()))):n.add(L),d.close()}}return i&&(i.end(),i.ready()&&n.add(i.take(i.ready()))),n?n.result():null}async function gc(e,t){let a=[];for(let i of t){let s=await new e.Input({source:new e.BlobSource(await ea(i.clip)),formats:e.ALL_FORMATS}).getPrimaryVideoTrack(),l=s&&await s.getDecoderConfig();a.push(l?l.codec+" "+l.codedWidth+"\xD7"+l.codedHeight+" "+(l.description?[...new Uint8Array(l.description)].join("."):""):"none")}let o=new Map;a.forEach(i=>o.set(i,(o.get(i)||0)+1));let r=[...o.entries()].sort((i,s)=>s[1]-i[1])[0][0],n=t.filter((i,s)=>a[s]!==r);if(n.length)throw new Error(n.map(i=>i.title).join(", ")+(n.length===1?" was":" were")+" recorded at a different size ("+a[t.indexOf(n[0])].split(" ")[1]+", not "+r.split(" ")[1]+"). Tick "+(n.length===1?"it":"them")+" and record again")}async function qi(e){if(!window.showDirectoryPicker)return null;let t=e?null:await pr("video-folder");if(t){let a=await t.queryPermission({mode:"readwrite"});if(a==="prompt"&&(a=await t.requestPermission({mode:"readwrite"})),a==="granted")return t}return t=await window.showDirectoryPicker({id:"slidetake-videos",mode:"readwrite",startIn:"videos"}),Ki("video-folder",t),t}function ta(){let e=Gi();if(O&&Fo===e)return O;Fo=e;try{O=JSON.parse(U(e)||"null")}catch{O=null}return(!O||!Array.isArray(O.takes))&&(O={takes:[],picks:{},type:"",quality:""}),O}function bc(e){ta();let t=vn(e,e.takesId,lr());t.forEach(a=>{delete O.picks[a.id]}),O.takes.push(...t),Object.assign(O,{type:e.type,quality:e.quality}),aa(),Le.clear(),hr({note:(e.reason?e.reason+". ":"")+t.length+" new take"+(t.length===1?"":"s")+" on the board."})}function Vi(){let e=mo(ta(),lr()),t=Object.assign(bn(e),{board:!0,inBrowser:!0,withObs:!1,type:O.type||"video/mp4",quality:O.quality||"",deckTitle:R.title||(y[0]?u.get(y[0]).title:"Deck"),date:new Date().toISOString()});return{rows:e,sess:t}}function dr(){if(Ka()){Ql(),Ra(!1).then(Me);return}it.innerHTML="",vi().then(e=>{e.ok?Ra().then(Me):Me()})}function Me(){let e=r=>{let n=r.selectedOptions[0];return n?n.textContent.replace(/ \(system default\)$/,""):""},t=e(_t)||(er()==="none"?"No camera":"Camera"),a=Ka()?["Pro","OBS",di,t].filter(Boolean):Xe().ok?["Easy",No,gt.value,t,e(mt)||"Microphone"].filter(Boolean):["Easy",No+" can\u2019t record here"],o=document.getElementById("rv-using");o.textContent=a.join(" \xB7 "),o.title=cr.title="Recording with "+a.join(" \xB7 ")}function hr(e={}){if(!bt)return;Va(),ta(),se.classList.remove("obs"),se.classList.add("in-browser","board"),document.getElementById("rv-rec").title="Records the whole deck, or only the ticked slides (shift-click ticks a range)",document.getElementById("rv-novideo").hidden=!0,k.src&&(URL.revokeObjectURL(k.src),k.removeAttribute("src"),k.load()),Q=null,F=null,St(),Ca=-1,$e(),Zt(se);let t=Xe().ok;ve.open=!!e.setup||!t||!O.takes.length,ve.open?dr():vi().then(()=>Ra(!1)).then(Me),A(e.note||zi()||(O.takes.length?wc()+". Click a take to preview it.":y.length+" slides, nothing recorded yet. Press \u25CF Record."))}function wc(){let e=mo(ta(),lr()),t=e.filter(o=>o.pick).length,a=e.filter(o=>o.takes.length&&!o.pick).length;return t+" of "+e.length+" slides ready"+(a?", "+a+" to record again":"")}function $e(){let{rows:e,sess:t}=Vi();N=t;let a=document.getElementById("rv-list"),o=null;a.innerHTML=e.map(i=>{let s=vt(i.id),l=s!==o;o=s;let c=B(i.id),d={slide:"Recorded before this slide changed",before:"Starts with the entry from the slide before, which has changed or is gone: record this slide again"},L=i.takes.length?i.takes.map(g=>'<button class="rv-chip'+(i.pick===g.uid?" on":"")+(g.outdated?' outdated" title="'+d[g.outdated]:"")+'" data-id="'+c+'" data-uid="'+B(g.uid)+'">Take '+g.no+" \xB7 "+at(g.ms)+"</button>").join("")+(i.pick?"":'<span class="rv-none">'+(i.takes.some(g=>g.outdated==="before")&&!i.takes.some(g=>g.outdated==="slide")?"The slide before changed: record again":"Changed since: record again")+"</span>"):'<span class="rv-none">No take yet</span>';return'<div class="rv-row with-sel'+(l?" sec":"")+(Le.has(i.id)?" selected":"")+'" data-id="'+c+'"><input type="checkbox" class="rv-sel" data-id="'+c+'"'+(Le.has(i.id)?" checked":"")+' aria-label="Select '+B(i.title)+' to record"><div><div class="t">'+B(i.title)+'</div><div class="rv-chips">'+L+"</div></div></div>"}).join(""),a.querySelectorAll(".rv-chip").forEach(i=>i.onclick=()=>{O.picks[i.dataset.id]=i.dataset.uid,aa(),$e();let s=e.find(c=>c.id===i.dataset.id),l=s&&s.takes.find(c=>c.uid===i.dataset.uid);l&&$a([{id:s.id,clip:l.clip,keep:l.ms/1e3,title:s.title+" \xB7 take "+l.no}],0,!0)}),a.querySelectorAll(".rv-sel").forEach(i=>i.addEventListener("click",s=>{(s.shiftKey?wn(y,Fn,i.dataset.id):[i.dataset.id]).forEach(c=>{i.checked?Le.add(c):Le.delete(c)}),St(),Fn=i.dataset.id,$e()}));let r=wa(y,Le),n=Xe().ok;document.getElementById("rv-rec").disabled=!n,Ca>=0&&r.length!==Ca&&A(zi()||"Record takes the whole deck."),Ca=r.length,document.getElementById("rv-render-btn").disabled=document.getElementById("rv-play-final").disabled=!t.events.length,Di(t),Ni(t)}async function xc(e){for(let a of e)try{let[o,r]=a.clip.split("/");await(await tr(o)).removeEntry(r)}catch{}let t=new Set(e.map(a=>a.uid));O.takes=O.takes.filter(a=>!t.has(a.uid)),Object.keys(O.picks).forEach(a=>{t.has(O.picks[a])&&delete O.picks[a]}),aa(),k.src&&(URL.revokeObjectURL(k.src),k.removeAttribute("src"),k.load()),F=null,St(),$e()}function Yi(e){return new Promise((t,a)=>{let o=indexedDB.open(e||"slidetake",1);o.onupgradeneeded=()=>o.result.createObjectStore("kv"),o.onsuccess=()=>t(o.result),o.onerror=()=>a(o.error)})}async function pr(e){let t=async a=>{let o=await Yi(a);return await new Promise(r=>{let n=o.transaction("kv").objectStore("kv").get(e);n.onsuccess=()=>r(n.result),n.onerror=()=>r(null)})};try{return await t()??await t("markcast")??await t("traverse")??null}catch{return null}}async function Ki(e,t){try{(await Yi()).transaction("kv","readwrite").objectStore("kv").put(t,e)}catch{}}async function Xa(e){jo=!0;try{return await kc(e)}finally{jo=!1}}async function kc(e){let t=await e.getFile();for(let a=0;a<10;a++){await new Promise(r=>setTimeout(r,1e3));let o=await e.getFile();if(o.size===t.size&&o.lastModified===t.lastModified)return o;t=o}return t}function oa(e,t,a){k.src&&URL.revokeObjectURL(k.src),Dt=t||null,a||(Ho=0),k.src=URL.createObjectURL(e),De=e.name,document.getElementById("rv-novideo").hidden=!0,A("Loaded "+e.name+". Click a take to preview it."),Na?Ha(Na):a&&Q&&Ha(Q.ranges.slice(Q.i))}async function Sc(e){let t=ot(e.outputPath);if(!(!t||!window.showDirectoryPicker)&&!(De===t&&k.src))try{let a=await pr("obs-folder");if(!a||await a.queryPermission({mode:"read"})!=="granted")return;let o=await a.getFileHandle(t);A("Opening "+t+"\u2026"),oa(await Xa(o),o)}catch{}}function lt(e,t){if(!h.active){if(clearTimeout(Ta),!z.hidden&&!z.classList.contains("live")){Nt.classList.remove("show"),$i.textContent=e,z.classList.add("msg"),t||(Ta=setTimeout(Xi,9e3));return}Nt.textContent=e,Nt.classList.add("show"),t||(Ta=setTimeout(()=>Nt.classList.remove("show"),9e3))}}function Xi(){$i.textContent="PIP camera",z.classList.remove("msg")}function ur(){clearTimeout(Ta),Nt.classList.remove("show"),Xi()}function Mo(){let e=!1;try{e=window.top!==window.self}catch{e=!0}return e?" This page is running inside a preview frame that may not allow cameras. Open Slidetake directly in Chrome (from localhost or as a file).":window.isSecureContext?" Allow camera access for this page in the browser\u2019s site settings (the icon at the left of the address bar), then try again.":" Browsers only allow cameras on secure pages. Open it from http://localhost or as a local file in Chrome."}function fr(){ae&&ae.getTracks().forEach(t=>t.stop()),ae=null;let e=z.querySelector("video");e&&e.remove()}async function Qe(){if(!(ae||oe)){{if(!navigator.mediaDevices||!navigator.mediaDevices.getUserMedia){lt("Camera not available on this page."+Mo(),!0);return}if(Ee.disabled)return;Ee.disabled=!0,lt("Waiting for camera permission \u2014 check the browser prompt near the address bar.",!0);try{let t=U("slidetake:cam");ae=await navigator.mediaDevices.getUserMedia({video:{...t?{deviceId:{ideal:t}}:{},width:{ideal:1920},height:{ideal:1080},frameRate:{ideal:30}},audio:!1}),ur()}catch(t){let a=t&&t.name;lt(a==="NotAllowedError"||a==="SecurityError"?"Camera access was blocked."+Mo():a==="NotFoundError"||a==="OverconstrainedError"?"No camera was found. Check that a webcam is connected.":a==="NotReadableError"?"The camera is busy \u2014 close other apps using it (Zoom, OBS, FaceTime) and try again.":"Could not start the camera"+(a?" ("+a+")":"")+"."+Mo(),!0);return}finally{Ee.disabled=!1,mr()}ae.getVideoTracks().forEach(t=>t.addEventListener("ended",()=>{fr(),Aa(),xe()}));let e=document.createElement("video");e.autoplay=!0,e.muted=!0,e.playsInline=!0,e.srcObject=ae,z.appendChild(e)}Aa(),xe()}}function Qi(e,t){e.classList.toggle("on",t),e.setAttribute("aria-pressed",String(t))}function mr(){Ee.querySelector("svg")||(Ee.innerHTML=Ec+'<span class="lbl"> Camera</span>'),Ee.classList.toggle("on",!oe),Ee.setAttribute("aria-pressed",String(!oe)),Ee.title=oe?"Camera is off for every slide (C)":"Camera is on and follows the deck (C)"}function ra(e,t){e&&!bt||(oe=!e,oe&&(fr(),ur()),ge=null,Ie=-1,we=Math.min(we,Math.max(0,xt(u.get(f)).length-1)),mr(),Aa(),Qt(),kt(),xe(),!K&&!t&<(e?"Camera on \u2014 slides follow their camera settings.":"Camera off \u2014 camera settings are ignored and slides use the whole screen."),e&&Qe())}function Zi(){document.body.classList.remove("idle"),clearTimeout(Nn),K&&(Nn=setTimeout(()=>document.body.classList.add("idle"),2e3))}function Jt(e,t){ct.textContent=e,ct.classList.add("show"),clearTimeout(jn),jn=setTimeout(()=>ct.classList.remove("show"),t||2500)}function _o(e,{keepObs:t=!0,keepEdit:a=!0,slide:o=""}={}){let r=new URL(Yr(e),location.origin);return new URLSearchParams(location.search).forEach((n,i)=>{i==="src"||i==="obs"&&!t||i==="edit"&&!a||r.searchParams.set(i,n)}),o&&(r.hash=o),r.href.replace(r.pathname,r.pathname.replace(/%40/g,"@"))}async function Mc(e){let t={keepObs:!1,keepEdit:!1,slide:e};if(E.kind==="source")return{link:_o(E.source,t),inside:!1};if(E.kind==="copy"&&pa(I)&&["url","gist","builtin"].includes(I.origin.kind))return{link:_o(I.origin,t),inside:!1};let o=E.kind==="share"?E.data:await Jr(ne.value),r=new URLSearchParams(location.search);return["src","obs","edit"].forEach(n=>r.delete(n)),{link:location.origin+"/share"+(r.toString()?"?"+r:"")+io(o,e),inside:!0}}function Tc(){let e=U("slidetake:draft");if(!e||e===Qa)return null;let t=da(e,{kind:"file",name:"your earlier draft"},{exported:!0});V("slidetake:copy",JSON.stringify(t));try{localStorage.removeItem("slidetake:draft")}catch{}return t}function na(){V("slidetake:copy",JSON.stringify(I))}function Et(){if(_)return;let e;if(gr())e='<span class="mine">'+B(he.file)+'</span> <span class="ro">\xB7 on this computer, saved as you type</span>';else if(E.kind==="copy")e='<span class="mine">Your copy of '+B(ke(I.origin))+"</span>"+(ha(I)?' <span class="edited">\xB7 edited</span>':"");else{let a=E.kind==="share"?"a shared deck":ke(E.source);e='<span class="mine">'+B(a.charAt(0).toUpperCase()+a.slice(1))+'</span> <span class="ro">\xB7 read-only, typing makes your copy</span>'}document.getElementById("doc-state").innerHTML=e,Fe.classList.toggle("unsaved",E.kind==="copy"&&ha(I)),document.getElementById("btn-reset").hidden=!(E.kind==="copy"&&!pa(I));let t=document.getElementById("continue");t.hidden=E.kind==="copy"||!I,I&&(t.textContent="Your copy \u2192",t.title="Continue your copy of "+ke(I.origin))}function es(e){return!I||!ha(I)?!0:confirm("Your copy of "+ke(I.origin)+" has edits you haven't saved or shared. Replace it with "+e+"?")}function ts(){let e=new URLSearchParams(location.search);return e.delete("src"),e.delete("template"),"/edit"+(e.toString()?"?"+e:"")}function Lc(){let e=E.kind==="share"?{kind:"shared"}:E.source;return es("a copy of "+ke(e))?(I=da(E.text,e),E={kind:"copy"},history.pushState(null,"",ts()+(f&&f!==y[0]?"#"+encodeURIComponent(f):"")),Jt("Editing your own copy of "+ke(e)+". The original is unchanged.",4e3),!0):(ne.value=E.text,!1)}function Ac(){E={kind:"copy"},history.pushState(null,"",ts()),Fe.classList.contains("collapsed")&&Ga(),ne.value=I.text,ut(!0),Et()}function gr(){return!!(he&&E&&E.kind==="source"&&E.source.kind==="url"&&new URL(E.source.url,location.href).pathname===he.deck)}function Bc(e){fetch(he.save,{method:"PUT",body:e}).catch(()=>Jt("Could not save "+he.file+": is npx slidetake still running?",6e3))}async function Oc(e){if(e.kind==="builtin")return La[e.id==="help"?"docs":e.id]??La.home;if(e.kind==="gist"){let a=await fetch("https://api.github.com/gists/"+encodeURIComponent(e.id));if(!a.ok)throw new Error(a.status===404?"no such gist":a.status+" "+a.statusText);let o=Object.values((await a.json()).files||{}),r=o.find(n=>n.filename===e.file)||o.find(n=>/\.(md|markdown)$/i.test(n.filename))||o[0];if(!r)throw new Error("the gist has no files");return ze=r.raw_url,r.truncated?await(await fetch(r.raw_url)).text():r.content}let t=await fetch(e.url);if(!t.ok)throw new Error(t.status===404?"not found":t.status+" "+t.statusText);return ze=new URL(e.url,location.href).href,await t.text()}function Wn(){return E={kind:"source",source:{kind:"builtin",id:"home"},text:La.home},E.text}async function Ic(){if(he&&Z.page==="source"&&Z.source.kind==="builtin"&&Z.source.id==="home"&&location.pathname==="/"&&(Z.source={kind:"url",url:he.deck}),_)return ze=_.base||location.href,E={kind:"source",source:{kind:"url",url:ze},text:jr(_.settings||{})+String(_.markdown||"")},E.text;if(Z.page==="edit"){if(I)return E={kind:"copy"},I.text;history.replaceState(null,"","/new"+location.search),Z.page="pick"}if(Z.page==="pick")return Zt(document.getElementById("new-dialog")),E={kind:"source",source:{kind:"builtin",id:"template:blank"},text:La["template:blank"]},E.text;if(Z.page==="share")try{let e=await $r(Z.data);return E={kind:"share",data:Z.data,text:e},e}catch{return Jt("This link's deck is damaged or cut short, so it could not be opened.",6e3),Wn()}try{let e=await Oc(Z.source);return E={kind:"source",source:Z.source,text:e},e}catch(e){return Ut.textContent="Could not load the deck ("+e.message+")",Jt("Could not load "+ke(Z.source)+": "+e.message,6e3),Wn()}}var _,he,qo,bt,wt,La,ne,H,ie,yo,kn,Is,Ut,To,zs,Fe,xa,Ps,dt,vo,le,Lo,Rs,Ds,Fs,Ns,Hs,js,Wt,u,y,qe,f,Go,Y,K,R,oe,ae,Te,z,Ao,P,Ht,Us,Sn,Ne,En,we,ge,Ie,Ye,al,ol,il,Xn,wo,cl,ze,Mn,ml,gl,yl,Tn,wl,ka,xl,El,Cl,xo,He,ko,_e,Pe,Fl,pt,me,ri,Ce,Ue,Se,Sa,So,nt,Bn,ql,On,In,zn,se,Rt,zo,Oa,Ia,za,Xo,jt,re,Oe,We,Qo,di,h,Gt,Vt,Gl,Zo,Vl,pi,Jl,Xl,Zl,_t,mt,gt,Po,it,mi,Ea,de,Ro,ec,gi,Ka,wi,Ge,Rn,De,pc,uc,Mi,Ve,Ti,Do,Kt,Li,Ai,Bi,Oi,Ii,N,Q,k,Pt,Ca,zi,Ri,Ma,Eo,Fa,Na,Hi,st,F,sr,Ui,je,Co,yc,O,Fo,Fn,Le,Gi,aa,vc,lr,ve,cr,No,Dt,Ho,jo,Ft,Ji,Ee,Nt,Ta,$i,Ec,Nn,be,Hn,ct,jn,Cc,Uo,Wo,_n,ja,Z,Un,E,I,as=G(()=>{"use strict";xr();kr();Er();Mr();Lr();Br();Ir();Pr();sa();Ur();Gr();ro();so();Zr();tn();un();mn();xn();ma();_=window.SLIDETAKE||null;document.getElementById("deck-text")?.remove();he=window.SLIDETAKE_LOCAL||null,qo=document.querySelector("header .mark .logo").outerHTML;document.documentElement.classList.toggle("embed",!!_);bt=!_||_.recording===!0;document.documentElement.classList.toggle("no-record",!bt);wt=window.matchMedia("(prefers-reduced-motion: reduce)").matches,La={home:Qa,docs:Sr,features:Cr,privacy:Tr,showcase:Rr,"template:blank":Ar,"template:talk":Or,"template:recording":zr},ne=document.getElementById("editor"),H=document.getElementById("stage"),ie=document.getElementById("world"),yo=document.getElementById("connectors"),kn=document.getElementById("breadcrumbs"),Is=document.getElementById("status-count"),Ut=document.getElementById("status-err"),To=document.getElementById("mm-svg"),zs=document.getElementById("mm-label"),Fe=document.getElementById("editor-pane"),xa=540,Ps=96,dt=440,vo=720,le=960,Lo=180,Rs=540,Ds=100,Fs=110,Ns=420,Hs=.35,js=1,Wt=parseFloat(U("slidetake:slideSize"))||.92,u=new Map,y=[],qe=[],f=null,Go=["focus","path","radial","tree"],Y="path",K=!1,R={},oe=!0,ae=null,Te=document.getElementById("brand"),z=document.getElementById("pip"),Ao=document.getElementById("stage-wrap"),P={x:0,y:0,zoom:.6},Ht=null;Us='<span class="st-name">'+qo+'Slide<span class="st-take">take</span></span>';Sn={accent:"--accent",accentSoft:"--accent-teal",line:"--accent-line",ring:"--accent-ring",header:"--header-bg",headerText:"--header-ink",onAccent:"--on-accent"};Ne=null;En=new URLSearchParams(location.search).get("mode");we=0;ge=null,Ie=-1,Ye=null;al=new Set("svg g defs symbol use path rect circle ellipse line polyline polygon text tspan textPath title desc marker linearGradient radialGradient stop clipPath mask pattern filter feGaussianBlur feOffset feBlend feFlood feComposite feMerge feMergeNode feColorMatrix feDropShadow".split(" ")),ol=0;il=e=>e.querySelector("img")&&!e.textContent.trim()&&[...e.children].every(t=>/^(IMG|BR)$/.test(t.tagName));Xn=["dot","d2","echarts","svg"].map(e=>":scope > code.language-"+e).join(", "),wo=e=>!!e.querySelector("img")&&!e.textContent.trim(),cl=e=>e.children.length===1&&(e.children[0].tagName==="PRE"&&!!e.children[0].querySelector(Xn)||e.children[0].matches("div.diagram"));ze=null;Mn=null;ml="https://cdn.jsdelivr.net/npm/@viz-js/viz@3.4.0/lib/viz-standalone.js",gl="https://cdnjs.cloudflare.com/ajax/libs/echarts/5.5.0/echarts.min.js",yl={dark:{palette:["#60a5fa","#f472b6","#a78bfa","#fb923c","#facc15","#a1a1aa"],text:"#e4e4e7",muted:"#a1a1aa",line:"#3f3f46",split:"#27272a",tip:"#18181b"},light:{palette:["#2563eb","#db2777","#7c3aed","#ea580c","#ca8a04","#71717a"],text:"#27272a",muted:"#71717a",line:"#d4d4d8",split:"#e4e4e7",tip:"#ffffff"}};Tn=new Set;wl="https://esm.sh/@terrastruct/d2@0.1.33",ka=null,xl={dark:{N1:"#e4e4e7",N2:"#a1a1aa",N3:"#a1a1aa",N4:"#323238",N5:"#27272a",N6:"#18181b",N7:"#09090b"},light:{N1:"#27272a",N2:"#71717a",N3:"#71717a",N4:"#e4e4e7",N5:"#e4e4e7",N6:"#f4f4f5",N7:"#ffffff"}};El=(e,t)=>e.replace("{","{"+t),Cl=e=>/d2-config\s*:/.test(e)?e:`vars: {
|
|
1313
|
+
`+m+"ffmpeg -f concat -safe 0 -i /tmp/slidetake-cuts.txt -i /tmp/slidetake-chapters.txt"+y+" -c copy -movflags +faststart "+wa(s)}let b=xa(e),p=v=>(v/b).toFixed(6),T=v=>((v-.5)/b).toFixed(6),L=i.map(v=>"gte(t,"+T(v.f0)+")*lt(t,"+T(v.f1)+")").join("+"),w=i.map(v=>"gte(t,"+p(v.f0)+")*lt(t,"+p(v.f1)+")").join("+"),x=t==="mac"?"-c:v h264_videotoolbox -b:v 12M":"-c:v libx264 -crf 18 -preset medium";return m+"ffmpeg -i "+wa(a)+" -i /tmp/slidetake-chapters.txt"+y+` -vf "select='`+L+`',setpts=N/FRAME_RATE/TB" -af "asetnsamples=n=48:p=0,aselect='`+w+"',asetpts=N/SR/TB"+(n?",loudnorm=I=-14:TP=-1:LRA=11":"")+'"'+(n?" -ar 48000":"")+" "+x+" -c:a aac -b:a 192k -movflags +faststart "+wa(s)}var fn,xa,mn,st,Ns,wa,gn,ka=V(()=>{"use strict";ma();fn=e=>e.obsT??e.t,xa=e=>e.fps||60,mn=(e,t)=>Math.round(e*t/1e3);st=e=>String(e||"").split(/[\\/]/).pop()||"",Ns=e=>{let t=Math.max(String(e).lastIndexOf("/"),String(e).lastIndexOf("\\"));return t>=0?String(e).slice(0,t+1):""},wa=e=>"'"+String(e).replace(/'/g,"'\\''")+"'",gn=e=>(e/1e3).toFixed(3)});function Hs(e,t){let a=Math.min(e,t*16/9),o=a*9/16;return{w:a,h:o,x:(e-a)/2,y:(t-o)/2}}function bn(e,t,a){let o=Hs(e,t),r=[Math.floor(o.w*a),Math.floor(o.h*a)];return{quality:lt.find(n=>r[0]>=n.w&&r[1]>=n.h)||null,device:r}}function jt(e){let t=new Map;e.events.forEach((o,r)=>{t.has(o.id)||t.set(o.id,[]),t.get(o.id).push(r)});let a=[];return me(e).forEach(o=>{let r=e.picks[o.id]??o.takes.length,n=r?o.takes[r-1]:null;if(!n)return;let i=e.events[t.get(o.id)[r-1]];i&&i.clip&&n.end>n.start&&a.push({id:o.id,title:o.title,clip:i.clip,keep:(n.end-n.start)/1e3})}),a}var lt,Sa,Ht,js,wn,Co,xn,Ea,kn,Sn,En=V(()=>{"use strict";ka();lt=[{name:"1080p",w:1920,h:1080,bitrate:8e6},{name:"720p",w:1280,h:720,bitrate:5e6}],Sa=192e3,Ht=30;js=["video/mp4;codecs=avc1.640028,mp4a.40.2","video/mp4;codecs=avc1,mp4a.40.2","video/mp4","video/webm;codecs=vp9,opus","video/webm;codecs=vp8,opus","video/webm"],wn=e=>js.find(t=>e(t))||"",Co=e=>e.startsWith("video/mp4")?"mp4":"webm",xn=e=>Math.round((e.bitrate+Sa)/8*60);Ea=(e,t)=>t>e?t:e+.001,kn=e=>e.replace(/\s*\([0-9a-f]{4}:[0-9a-f]{4}\)\s*$/i,""),Sn=(e,t)=>Math.min(e,t)+"p"+(t>e?" portrait":"")});function _s(e){let t=1681.974450955533,a=.7071752369554196,o=Math.tan(Math.PI*t/e),r=Math.pow(10,3.999843853973347/20),n=Math.pow(r,.4996667741545416),i=1+o/a+o*o,s={b0:(r+n*o/a+o*o)/i,b1:2*(o*o-r)/i,b2:(r-n*o/a+o*o)/i,a1:2*(o*o-1)/i,a2:(1-o/a+o*o)/i};t=38.13547087602444,a=.5003270373238773,o=Math.tan(Math.PI*t/e),i=1+o/a+o*o;let l={b0:1,b1:-2,b2:1,a1:2*(o*o-1)/i,a2:(1-o/a+o*o)/i};return{shelf:s,highPass:l}}function Cn(e,t){let{shelf:a,highPass:o}=_s(e),r=Math.round(e/10),n=[],i=Array.from({length:t},()=>new Float64Array(8)),s=d=>d>=3&&d<=4?1.41:1,l=0,c=0;return{add(d){let M=d[0].length;for(let m=0;m<t;m++){let y=d[m]||d[0],b=i[m],p=s(m),[T,L,w,x,v,S,C,$]=b,te=l,X=Math.floor(te/r),D=(X+1)*r,q=0;for(let ce=0;ce<M;ce++){let ae=y[ce];ae>c?c=ae:-ae>c&&(c=-ae);let Q=a.b0*ae+a.b1*T+a.b2*L-a.a1*w-a.a2*x;L=T,T=ae,x=w,w=Q;let It=o.b0*Q+o.b1*v+o.b2*S-o.a1*C-o.a2*$;S=v,v=Q,$=C,C=It,q+=It*It,++te===D&&(n[X]=(n[X]||0)+p*q,q=0,X++,D+=r)}q&&(n[X]=(n[X]||0)+p*q),b.set([T,L,w,x,v,S,C,$])}l+=M},result(){let d=Math.floor(l/r),M=[];for(let p=3;p<d;p++)M.push(((n[p-3]||0)+(n[p-2]||0)+(n[p-1]||0)+(n[p]||0))/(4*r));let m=p=>p.reduce((T,L)=>T+L,0)/p.length,y=M.filter(p=>Ca(p)>-70),b=y.length?y.filter(p=>Ca(p)>Ca(m(y))-10):[];return{integrated:b.length?Ca(m(b)):-1/0,peak:c,peakDb:c>0?Ws(c):-1/0}}}}function To(e,{limit:t=!1,target:a=-14,ceiling:o=-1.5}={}){if(!isFinite(e.integrated))return 0;let r=Math.min(a-e.integrated,Mo);return r<=0||t||e.peakDb==null||!isFinite(e.peakDb)?r:Math.max(0,Math.min(r,o-e.peakDb))}function Lo(e,t,a={}){let o=Ma(a.ceilingDb??-1.5),r=Math.max(1,Math.round((a.lookahead??.005)*e)),n=1-Math.exp(-1/((a.release??.05)*e)),i=Array.from({length:t},()=>[]),s=[],l=[],c=new Float64Array(r),d=0,M=r,m=1,y=!1,b=0,p=0;c.fill(1);let T=L=>{for(;l.length&&l[l.length-1][1]>=L;)l.pop();for(l.push([d,L]);l[0][0]<=d-r;)l.shift();let w=l[0][1];if(m=w<m?w:m+(w-m)*n,m>.999&&(m=1),M+=m-c[d%r],c[d%r]=m,d>=r-1){let x=M/r,v=x>.999?1:x;s.push(v),v<.999&&!y&&b++,y=v<.999}d++};return{push(L){let w=L[0].length;for(let x=0;x<w;x++){let v=0;for(let S=0;S<t;S++){let C=(L[S]||L[0])[x];i[S].push(C),C>v?v=C:-C>v&&(v=-C)}T(v>o?o/v:1)}},ready:()=>s.length-p,take(L){let w=Array.from({length:t},()=>new Float32Array(L));for(let x=0;x<L;x++){let v=s[p+x];for(let S=0;S<t;S++)w[S][x]=i[S][p+x]*v}return p+=L,p>65536&&(s.splice(0,p),i.forEach(x=>x.splice(0,p)),p=0),w},end(){for(let L=0;L<r-1;L++){for(let w=0;w<t;w++)i[w].push(0);T(1)}},get events(){return b}}}var Ws,Ca,Mo,Ma,Mn=V(()=>{"use strict";Ws=e=>20*Math.log10(e),Ca=e=>-.691+10*Math.log10(e);Mo=20;Ma=e=>Math.pow(10,e/20)});function Tn(e){let t=2166136261;for(let a=0;a<e.length;a++)t^=e.charCodeAt(a),t=Math.imul(t,16777619);return(t>>>0).toString(36)}function Ln(e,t){return e.map((a,o)=>{let r=e[o-1]||"";return{id:a,title:t(a).title,fp:t(a).fp,prev:r,prevFp:r?t(r).fp:""}})}function An(e,t,a){let o=new Map(a.map(i=>[i.id,i])),r=new Map;e.events.forEach(i=>{r.has(i.id)||r.set(i.id,[]),r.get(i.id).push(i)});let n=[];return me(e).forEach(i=>i.takes.forEach((s,l)=>{let c=r.get(i.id)[l];if(!c||!c.clip||s.end<=s.start)return;let d=o.get(i.id);d&&n.push({uid:c.clip,id:i.id,title:i.title,clip:c.clip,ms:s.end-s.start,run:t,date:e.date,fp:d.fp,prev:d.prev,prevFp:d.prevFp,at:s.start})})),n.sort((i,s)=>i.at-s.at).map(({at:i,...s})=>s)}function Ta(e,t){return t.map(a=>{let o=e.takes.filter(i=>i.id===a.id).map((i,s)=>({...i,no:s+1,outdated:i.fp!==a.fp?"slide":(i.prev??null)!==a.prev||i.prevFp!==a.prevFp?"before":""})),r=e.picks[a.id],n=null;if(r&&o.some(i=>i.uid===r))n=r;else{let i=o.filter(s=>!s.outdated);n=i.length?i[i.length-1].uid:null}return{id:a.id,title:a.title,takes:o,pick:n}})}function Bn(e){let t=[],a=0;return e.forEach(o=>{let r=o.pick?o.takes.find(n=>n.uid===o.pick):null;r&&(t.push({id:o.id,title:o.title,t:a,clip:r.clip}),a+=r.ms)}),{events:t,picks:{},total:a}}function La(e,t){let a=new Set(t);return e.filter(o=>a.has(o))}function On(e,t,a){let o=t?e.indexOf(t):-1,r=e.indexOf(a);return o<0||r<0?[a]:e.slice(Math.min(o,r),Math.max(o,r)+1)}var In=V(()=>{"use strict";ka()});var Yc={};function W(e){try{let t=localStorage.getItem(e);if(t!==null||!e.startsWith("slidetake:"))return t;let a=e.slice(10);return localStorage.getItem("slidetake:"+a)??localStorage.getItem("traverse:"+a)}catch{return null}}function U(e,t){try{localStorage.setItem(e,t)}catch{}}function Qs(e){try{return{html:window.marked?window.marked.parse(e):"<pre>"+A(e)+"</pre>",err:null}}catch{return{html:"<p>(could not render)</p>",err:"render error"}}}function el(e){let t=document.createTreeWalker(e,NodeFilter.SHOW_TEXT,{acceptNode:o=>/Slidetake/.test(o.nodeValue||"")&&!o.parentElement?.closest("code, pre, kbd, svg, em, .st-name")?1:2}),a=[];for(;t.nextNode();)a.push(t.currentNode);a.forEach(o=>{let r=document.createElement("span");r.innerHTML=A(o.nodeValue||"").replace(/Slidetake/g,Zs),o.replaceWith(...r.childNodes)})}function _a(){let e=R.brand||"",t=R.logo||"",a=/^chip$/i.test(R.brand_style||""),o=/^slidetake$/i.test(e)?'<span class="st-mark">'+or+'<span class="word">Slide<span>take</span></span></span>':(t?'<img alt="" src="'+A(t)+'">':"")+(e?"<span"+(a?' class="chip"':"")+">"+A(e)+"</span>":"");if(Ae.dataset.html!==o){Ae.dataset.html=o,Ae.innerHTML=o;let r=Ae.querySelector("img");r&&(r.onload=r.onerror=()=>xe(!0))}Ae.hidden=!o,nr(),document.title=R.title||"Slidetake",al(),ti()}function tl(){let e=String(R.accent||"").trim();if(!e||!window.CSS||!CSS.supports("color",e))return null;if(!CSS.supports("color","oklch(from red l c h)"))return{accent:e,line:e};let t=a=>"oklch(from "+e+" "+a+" c h)";return{dark:{accent:t(.8),accentSoft:t(.87),line:t(.5)},light:{accent:t(.45),accentSoft:t(.4),line:t(.75),ring:t(.7)}}}function al(){let e="",t=(o,r)=>{let n=Object.entries(r||{}).filter(([i,s])=>zn[i]&&s&&typeof s!="object").map(([i,s])=>zn[i]+":"+String(s).replace(/[;{}<>]/g,"")).join(";");n&&(e+=o+"{"+n+`}
|
|
1314
|
+
`)};[tl(),_&&_.colors].filter(Boolean).forEach(o=>{["dark","light"].forEach(r=>{let n={...o,...o[r]||{}},i=r==="dark";n.accent&&typeof n.accent=="string"&&(n.accentSoft=n.accentSoft||n.accent,n.line=n.line||"color-mix(in srgb, "+n.accent+(i?" 45%, #09090b)":" 55%, #fff)"),n.ring=n.ring||(i?n.accent:n.line),n.onAccent=n.onAccent||(i?"color-mix(in srgb, "+n.accent+" 15%, #000)":"#fff")),t(i?'body:not([data-mode="light"])':'body[data-mode="light"]',n)})});let a=document.getElementById("st-colors");a||(a=document.createElement("style"),a.id="st-colors",document.head.appendChild(a)),a.textContent!==e&&(a.textContent=e),document.body.classList.toggle("st-header-color",e.includes("--header-bg"))}function Me(e){let t=document.createElement("span");t.style.color="var("+e+")",document.body.appendChild(t);let a=getComputedStyle(t).color;return t.remove(),_e=_e||Object.assign(document.createElement("canvas"),{width:1,height:1}).getContext("2d",{willReadFrequently:!0}),_e.clearRect(0,0,1,1),_e.fillStyle="#000",_e.fillStyle=a,_e.fillRect(0,0,1,1),"#"+[..._e.getImageData(0,0,1,1).data.slice(0,3)].map(o=>o.toString(16).padStart(2,"0")).join("")}function ol(e,t,a){let o=i=>[1,3,5].map(s=>parseInt(i.slice(s,s+2),16)),r=o(e),n=o(t);return"#"+r.map((i,s)=>Math.round(i*a+n[s]*(1-a)).toString(16).padStart(2,"0")).join("")}function eo(){if(_&&_.themeKey&&!Rn){let t=W(_.themeKey);return t==="light"||t==="dark"?t:matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}return String(Rn||W("slidetake:mode")||R.mode||"dark").toLowerCase()==="light"?"light":"dark"}function ti(){let e=eo()==="light";e?document.body.dataset.mode="light":delete document.body.dataset.mode;let t=document.getElementById("btn-mode");t&&(t.innerHTML=e?'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M21 12.8A9 9 0 1 1 11.2 3a7 7 0 0 0 9.8 9.8z"/></svg>':'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"><circle cx="12" cy="12" r="4.5"/><path d="M12 2v2M12 20v2M4.9 4.9l1.4 1.4M17.7 17.7l1.4 1.4M2 12h2M20 12h2M4.9 19.1l1.4-1.4M17.7 6.3l1.4-1.4"/></svg>',t.title=(e?"Dark theme":"Light theme")+" (L)",t.setAttribute("aria-label",t.title))}function ai(){let e=eo()==="light"?"dark":"light";_&&_.themeKey?(U(_.themeKey,e),document.documentElement.classList.toggle("dark",e==="dark")):U("slidetake:mode",e),ti(),se.querySelector(".echarts-container, .diagram.d2, .diagram.dot")&&wt(!0)}function rl(){let t=(R.camera||"").replace(/^\[|\]$/g,"").split(",").map(a=>a.trim().replace(/^["']|["']$/g,"")).filter(Boolean);return t.length?t:["on","full","off"]}function Wo(e){return!re&&e?en(e.camera):[]}function Tt(e){return tn(Wo(e),e&&e.frags?e.frags.length:0)}function oi(){let e=Tt(u.get(f));return e[Math.min(we,e.length-1)]||{cam:0,frag:0}}function nl(){if(!f)return null;let e=u.get(f),t=Wo(e);if(t.length)return t[Math.min(oi().cam,t.length-1)];if(e&&e.el&&e.el.classList.contains("card-full"))return"off";for(let a=g.indexOf(f)-1;a>=0;a--){let o=Wo(u.get(g[a]));if(o.length)return o[o.length-1]}return null}function il(){let e={corner:(R.pip||"none").toLowerCase(),size:go(parseFloat(R.pip_size)||24),circle:(R.pip_shape||"").toLowerCase()==="circle",mirror:!/^(no|false|off)$/i.test(R.pip_mirror||""),full:!1,off:!1,flip:!1,used:!1};return(e.corner==="behind"||e.corner==="under")&&(e.corner="bottom-right",Ft(e,"behind")),Ft(e,nl()),ye&&!/\b(off|hide)\b/i.test(ye)&&(e.off=!1),Ft(e,ye),!Dt.includes(e.corner)&&(oe||e.used)&&(e.corner="bottom-right"),e.flip&&Dt.includes(e.corner)&&(e.corner=e.corner.includes("left")?e.corner.replace("left","right"):e.corner.replace("right","left")),e}function nr(){let e=!P.hidden&&P.offsetWidth?P.getBoundingClientRect():null,t=Pe=il(),a=Dt.includes(t.corner);if(P.className=a?[t.corner,t.circle&&"circle",oe&&"live",t.mirror&&"mirror",t.full&&"full",t.behind&&"behind",P.classList.contains("msg")&&"msg"].filter(Boolean).join(" "):"",P.style.width=t.size+"%",P.hidden=!a||re||t.off,ja.dataset.pip=P.hidden||t.full?"none":t.corner,ja.classList.toggle("cam-behind",!P.hidden&&!!t.behind),P.hidden||Mt||!P.animate)return;let o="cubic-bezier(.65,0,.35,1)";if(!e){P.animate([{opacity:0},{opacity:1}],{duration:300,easing:"ease-out"});return}let r=P.getBoundingClientRect();Math.abs(e.left-r.left)+Math.abs(e.top-r.top)+Math.abs(e.width-r.width)+Math.abs(e.height-r.height)<2||P.animate([{transformOrigin:"0 0",transform:"translate("+(e.left-r.left)+"px,"+(e.top-r.top)+"px) scale("+e.width/r.width+","+e.height/r.height+")"},{transformOrigin:"0 0",transform:"none"}],{duration:600,easing:o})}function sl(){let e=Pe;if(!e||P.hidden||e.full)return null;let t=H.clientWidth,a=H.clientHeight,o=16,r=t*e.size/100,n=e.circle?r:r*9/16,i=e.corner.includes("left")?o:t-o-r,s=e.corner.includes("top")?o:a-o-n;return{x0:i,y0:s,x1:i+r,y1:s+n}}function ll(){if(!Ze)return;if(re){pa(!0);return}let e=rl();Ie=(Ie+1)%e.length,ye=e[Ie],nr(),K||mt("Camera: "+ye),!oe&&!P.hidden?at():xe()}function ri(e){let t=Qr(e,{render:Qs});R=t.deck,u=t.nodes,_a();let a={"+++":"+++ format",reveal:"reveal.js format",headings:"headings"}[t.format];Us.textContent=u.size+(u.size===1?" card":" cards")+" \xB7 "+a,Jt.textContent=t.errCount?t.errCount+" card(s) had errors":""}function ni(){Ye=[...u.values()].filter(o=>!o.parent).map(o=>o.id);let e=0;function t(o,r){let n=u.get(o);if(n.depth=r,n.children.length===0)n._slot=e++;else{n.children.forEach(s=>t(s,r+1));let i=n.children.map(s=>u.get(s)._slot);n._slot=(Math.min(...i)+Math.max(...i))/2}}Ye.forEach(o=>t(o,0)),g=[];function a(o){g.push(o),u.get(o).children.forEach(a)}return Ye.forEach(a),Math.max(1,e)}function cl(){let e=[],t=[],a=[];return u.forEach(o=>{e[o.depth]=Math.max(e[o.depth]||0,o._h),t[o.depth]=Math.max(t[o.depth]||0,o._w),a[o.depth]=(a[o.depth]||0)+1}),{maxH:e,maxW:t,count:a,maxDepth:e.length-1}}function ii(e){e.x!==null&&!isNaN(e.x)&&(e.cx=e.x+e._w/2),e.y!==null&&!isNaN(e.y)&&(e.cy=e.y+e._h/2)}function dl(){let{maxH:e,maxDepth:t}=cl(),a=[0];for(let l=1;l<=t;l++)a[l]=a[l-1]+e[l-1]+Ys;let o=Vs-yt,r=[],n=(l,c)=>{let d=u.get(l);d.cx+=c,d.children.forEach(M=>n(M,c))},i=l=>{let c=u.get(l);r[c.depth]=Math.max(r[c.depth]??-1/0,c.cx+c._w/2),c.children.forEach(i)};function s(l){let c=u.get(l),d=r[c.depth]!==void 0?r[c.depth]+o:-1/0;c.children.length?(c.children.forEach(s),c.cx=(u.get(c.children[0]).cx+u.get(c.children[c.children.length-1]).cx)/2,c.cx-c._w/2<d&&n(l,d-(c.cx-c._w/2))):c.cx=(d===-1/0?0:d)+c._w/2,i(l)}Ye.forEach(s),u.forEach(l=>{l.cy=a[l.depth]+l._h/2,ii(l)})}function hl(e){let t=Math.PI*2/e,a=32,o=[],r=(s,l)=>Math.abs(s.cx-l.cx)<(s._w+l._w)/2+a&&Math.abs(s.cy-l.cy)<(s._h+l._h)/2+a,n=Math.max(0,...[...u.values()].map(s=>s.depth)),i=0;for(let s=0;s<=n;s++){let l=[...u.values()].filter(d=>d.depth===s);if(!l.length)continue;let c=s===0?Ye.length>1?Js*.5:0:i+Ks;for(let d=0;d<400&&(l.forEach(m=>{let y=(m._slot+.5)*t-Math.PI/2;m.cx=c*Math.cos(y),m.cy=c*Math.sin(y),ii(m)}),!!l.some((m,y)=>l.some((b,p)=>p>y&&r(m,b))||o.some(b=>r(m,b))));d++)c=c*1.02+10;i=c,o.push(...l)}}function pl(e){let t=document.createTreeWalker(e,NodeFilter.SHOW_COMMENT),a=[];for(;t.nextNode();)a.push(t.currentNode);a.forEach(o=>{let r=o.data.match(/^\s*\.element:\s*([\s\S]*)$/);if(!r)return;let n=o.previousSibling;for(;n&&n.nodeType===3&&!n.data.trim();)n=n.previousSibling;let i=n&&n.nodeType===1?n:o.parentElement;i&&Object.entries(zt(r[1])).forEach(([s,l])=>{s==="class"?i.classList.add(...l.split(/\s+/).filter(Boolean)):s==="style"?i.style.cssText+=";"+l:i.setAttribute(s,l)})})}function ml(e){let t=new DOMParser().parseFromString(e,"image/svg+xml"),a=t.documentElement;if(!a||a.localName!=="svg"||t.getElementsByTagName("parsererror").length)return null;let o=a.namespaceURI,r=i=>{[...i.children].forEach(s=>{s.namespaceURI!==o||!ul.has(s.localName)?s.remove():r(s)}),[...i.attributes].forEach(s=>{let l=s.name.toLowerCase(),c=s.value;(l.startsWith("on")||/javascript:|expression\(/i.test(c)||/url\(\s*['"]?(?!#)/i.test(c)||(l==="href"||l==="xlink:href")&&!c.trim().startsWith("#"))&&i.removeAttribute(s.name)})};r(a);let n="st-svg"+ ++fl+"-";return[a,...a.querySelectorAll("*")].forEach(i=>[...i.attributes].forEach(s=>{let l=s.name==="id"?n+s.value:s.value.replace(/url\(\s*(['"]?)#/g,"url($1#"+n);(s.name==="href"||s.name==="xlink:href")&&l.startsWith("#")&&(l="#"+n+l.slice(1)),l!==s.value&&(s.value=l)})),document.importNode(a,!0)}function Oe(e,t){let a=e.classList.contains("fragment");["fragment","fade-up","visible","current-fragment"].forEach(o=>{e.classList.contains(o)&&(t.classList.add(o),e.classList.remove(o))}),e.dataset.fragmentIndex!==void 0&&(t.dataset.fragmentIndex=e.dataset.fragmentIndex,delete e.dataset.fragmentIndex),e.replaceWith(t),a&&u.forEach(o=>o.frags&&o.frags.forEach(r=>{let n=r.indexOf(e);n>=0&&(r[n]=t)}))}function Io(e){let t=document.createElement("figure");t.className="media",Oe(e,t),t.appendChild(e);let a=e.getAttribute("alt");return a&&t.insertAdjacentHTML("beforeend","<figcaption>"+A(a)+"</figcaption>"),t}function gl(e,t){let a=document.createElement("figure");return a.className="media yt fragment yt-play"+(e.portrait?" portrait":""),a.innerHTML='<div class="frame"><iframe src="'+pn(e)+'" title="'+A(t||"YouTube video")+'" allow="autoplay; encrypted-media; picture-in-picture; fullscreen" allowfullscreen loading="lazy"></iframe></div>'+(t?"<figcaption>"+A(t)+"</figcaption>":""),a}function Dn(e,t){let a=t<=4?t:t<=6?3:4;e.style.setProperty("--cols",a),e.style.setProperty("--rows",Math.ceil(t/a))}function vl(e,t){t.querySelectorAll("pre > code.language-svg").forEach(n=>{let i=ml(n.textContent.trim()),s=document.createElement("div");s.className=i?"diagram svg":"diagram err",i?s.appendChild(i):s.textContent="SVG error: not a valid <svg> drawing",Oe(n.parentElement,s)}),t.querySelectorAll(":scope > p").forEach(n=>{let i=n.children.length===1?n.children[0]:null;if(!i)return;let s=i.tagName==="A"&&n.textContent.trim()===i.textContent.trim()?i.getAttribute("href"):i.tagName==="IMG"?i.getAttribute("src"):null,l=s&&So(s);l&&Oe(n,gl(l,i.tagName==="IMG"?i.getAttribute("alt"):""))}),t.querySelectorAll(":scope > ul, :scope > ol").forEach(n=>{let i=[...n.children];!i.length||!i.every(s=>Po(s)||wl(s))||(n.classList.add("gallery"),i.some(s=>!Po(s))&&n.classList.add("diagrams"),i.forEach(s=>{if(!Po(s))return;let l=s.querySelector("img");s.innerHTML="",s.appendChild(l),Io(l)}),i.length>1&&i.every(s=>s.classList.contains("fragment"))?(n.classList.add("carousel"),i[0].classList.remove("fragment","fade-up"),i.forEach((s,l)=>{s.classList.replace("fade-up","current-visible");let c=s.querySelector("figcaption");c&&(c.dataset.count=l+1+" / "+i.length)})):Dn(n,i.length))}),t.querySelectorAll(":scope > p").forEach(n=>{if(!yl(n))return;let i=[...n.querySelectorAll("img")];if(i.length===1){Oe(n,i[0]),Io(i[0]);return}let s=document.createElement("div");s.className="gallery grid",Oe(n,s),i.forEach(l=>{s.appendChild(l),Io(l)}),Dn(s,i.length)});let a=[...t.children].filter(n=>!/^H[1-6]$/.test(n.tagName)&&!(n.nodeType===1&&n.tagName==="HR")),o=a.filter(n=>n.matches("figure.media"));o.length===1&&a.length===1&&e.classList.add("card-media");let r=document.createTreeWalker(t,NodeFilter.SHOW_COMMENT);for(;r.nextNode();)/^\s*view\s*:\s*full\s*$/i.test(r.currentNode.data)&&e.classList.add("card-full");if(a.length===1&&(a[0].matches("figure.media:not(.yt)")||a[0].matches(".gallery.carousel:not(.diagrams)")))e.classList.add("card-bleed");else if(o.length===1&&a.length>1&&!o[0].matches(".yt")){e.classList.add("card-split",a.indexOf(o[0])===0?"media-first":"media-last");let n=document.createElement("div");n.className="split-text",a.filter(i=>i!==o[0]).forEach(i=>n.appendChild(i)),o[0].after(n),a.indexOf(o[0])!==0&&n.after(o[0])}t.querySelector(".gallery")&&e.classList.add("card-gallery")}function si(e,t){let a=e.querySelector("iframe");a&&a.contentWindow&&a.contentWindow.postMessage(JSON.stringify({event:"command",func:t,args:[]}),"*")}function bl(e){let t=document.createTreeWalker(e,NodeFilter.SHOW_COMMENT),a=[];for(;t.nextNode();)/^\s*steps\s*$/i.test(t.currentNode.data)&&a.push(t.currentNode);a.forEach(o=>{for(let r=o.nextSibling;r&&!(r.nodeType===8&&/^\s*steps\s*:\s*off\s*$/i.test(r.data));r=r.nextSibling)r.nodeType!==1||r.classList.contains("fragment")||(/^(UL|OL)$/.test(r.tagName)?r.querySelectorAll(":scope > li").forEach(n=>n.classList.add("fragment","fade-up")):r.classList.add("fragment","fade-up"))})}function xl(e){let t=r=>r.classList.contains("fragment")&&(r.tagName==="P"&&r.children.length===1&&r.children[0].tagName==="IMG"&&!r.textContent.trim()&&!So(r.children[0].getAttribute("src")||"")||r.tagName==="PRE"&&!!r.querySelector(li)),a=[],o=[];[...e.children].forEach(r=>{t(r)?o.push(r):(o.length>1&&a.push(o),o=[])}),o.length>1&&a.push(o),a.forEach(r=>{let n=document.createElement("ul");r[0].before(n),r.forEach(i=>{let s=document.createElement("li");s.className="fragment fade-up",i.classList.remove("fragment","fade-up"),s.appendChild(i),n.appendChild(s)})})}function kl(e){let t=[...e.querySelectorAll(".fragment")].map((r,n)=>({e:r,i:n,k:r.dataset.fragmentIndex}));if(t.every(r=>r.k===void 0))return t.map(r=>[r.e]);let a=0;t.forEach(r=>{r.k=r.k===void 0?a:parseFloat(r.k),a=Math.max(a,r.k)+1}),t.sort((r,n)=>r.k-n.k||r.i-n.i);let o=[];return t.forEach((r,n)=>{n&&t[n-1].k===r.k?o[o.length-1].push(r.e):o.push([r.e])}),o}function ir(e,t,a){!e||!e.frags||(a&&e.el.classList.add("snap"),e.frags.forEach((o,r)=>o.forEach(n=>{let i=n.classList.contains("visible");n.classList.toggle("visible",r<t),n.classList.toggle("current-fragment",r===t-1),n.classList.contains("yt-play")&&i!==r<t&&!a&&si(n,r<t?"playVideo":"pauseVideo")})),a&&(e.el.offsetWidth,e.el.classList.remove("snap")))}function Sl(){try{return R.base?new URL(R.base,ze||location.href):ze?new URL(ze):null}catch{return null}}function El(e){let t=Sl(),a=0;return e.querySelectorAll("img[src], source[src], video[src], iframe[src], a[href]").forEach(o=>{let r=o.hasAttribute("src")?"src":"href",n=o.getAttribute(r);if(!n||/^(#|[a-z][a-z0-9+.-]*:|\/\/)/i.test(n))return;if(!t){r==="src"&&!n.startsWith("/")&&a++;return}let i=t;try{R.site&&(i=new URL(R.site,t))}catch{}o.setAttribute(r,new URL(n,n.startsWith("/")?i:t).href)}),a}function to(e){let t=e.el,a=t.querySelector(".body");t.classList.add("measuring"),a.style.zoom="";let o=yt;e.visual=!!a.querySelector("iframe, .echarts-container, pre > code.language-dot, pre > code.language-d2, pre > code.language-echarts, .diagram, figure.media"),e.visual&&(o=le);let r=t.classList.contains("card-full");if(t.classList.remove("img-portrait","img-landscape","img-overlay","img-cover"),r&&(o=le),t.classList.contains("card-bleed")){let l=Math.max(0,...[...a.querySelectorAll("img")].map(d=>d.naturalWidth&&d.naturalHeight?d.naturalWidth/d.naturalHeight:0))||1.7777777777777777,c=le-Aa*l>=260;if(r&&c)t.classList.add("img-portrait"),t.style.setProperty("--img-w",Math.round(Aa*l)+"px"),o=le;else if(r||Math.abs(l-16/9)<.08)t.classList.add("img-overlay"),o=le,l>=16/9&&l<=16/9*1.15&&t.classList.add("img-cover");else if(l<1.3){let d=Math.min(Math.round(Aa*l),le-300);t.classList.add("img-portrait"),t.style.setProperty("--img-w",d+"px"),o=Math.min(le,Math.max(Oo,d*2))}else t.classList.add("img-landscape"),o=Math.round(Math.max(yt,Math.min(le,(Aa-Gs)*l))),t.style.setProperty("--img-h",Math.round(o/l)+"px")}else(a.querySelector('[style*="flex"], [style*="grid"], .r-hstack')||a.querySelectorAll("img").length>=4)&&(o=Oo);let n=a.querySelectorAll("table");if(n.length){t.style.width=le+"px";let l=t.offsetWidth-a.clientWidth;n.forEach(c=>{o=Math.max(o,Math.min(Oo,Math.ceil(c.offsetWidth)+l+12))})}let i=a.querySelectorAll("pre");if(i.length){t.style.width=le+"px";let l=t.offsetWidth-a.clientWidth;i.forEach(c=>{c.style.width="max-content",o=Math.max(o,Math.min(le,Math.ceil(c.offsetWidth)+l+2)),c.style.width=""})}let s=a.querySelectorAll(".fragment.grow");if(s.length){t.style.width=o+"px";let l=t.offsetWidth-a.clientWidth;s.forEach(c=>{o=Math.max(o,Math.min(le,Math.ceil(c.offsetWidth*1.3)+l))})}t.style.width=o+"px",t.scrollWidth>o+2&&(t.style.width=(o=Math.min(le,t.scrollWidth+24))+"px"),a.scrollWidth>a.clientWidth+2&&(a.style.zoom=(a.clientWidth/a.scrollWidth).toFixed(3)),e._w=o,e._h=t.offsetHeight||_o,t.classList.remove("measuring")}function Cl(){clearTimeout(Fn),Fn=setTimeout(()=>{u.forEach(to),ra(),xe(!0)},200)}function Al(){let e=eo()==="light"?"light":"dark",t=Me(e==="light"?"--accent-ring":"--accent"),a="slidetake-"+e+"-"+t.slice(1);return Nn.has(a)||(Bl(a,Ll[e],t),Nn.add(a)),a}function Bl(e,t,a){let o={axisLine:{lineStyle:{color:t.line}},axisTick:{lineStyle:{color:t.line}},axisLabel:{color:t.muted},splitLine:{lineStyle:{color:t.split}},nameTextStyle:{color:t.muted}};echarts.registerTheme(e,{color:[a,...t.palette],backgroundColor:"transparent",textStyle:{color:t.text,fontFamily:"'IBM Plex Sans', sans-serif"},title:{textStyle:{color:t.text},subtextStyle:{color:t.muted}},legend:{textStyle:{color:t.text}},tooltip:{backgroundColor:t.tip,borderColor:t.line,textStyle:{color:t.text}},categoryAxis:o,valueAxis:o,logAxis:o,timeAxis:o,line:{symbolSize:6,lineStyle:{width:2.5}},pie:{label:{color:t.text,textBorderWidth:0},labelLine:{lineStyle:{color:t.muted}}},funnel:{label:{color:t.text,textBorderWidth:0}}})}function Pl(){let e=eo()==="light"?"light":"dark",t=Me("--node-bg"),a=Me(e==="dark"?"--accent":"--accent-line"),o=e==="dark"?[.58,.38,.25,.18,.12]:[.7,.45,.25,.15,.08],r={...Il[e],N7:t,B1:Me("--accent")};return o.forEach((n,i)=>{r["B"+(i+2)]=ol(a,t,n)}),r}function zl(){let e=Me("--text"),t=Me("--text-muted"),a=Me("--accent"),o='"Helvetica,Arial,sans-serif"';return' graph [bgcolor=transparent color="'+t+'" fontcolor="'+e+'" fontname='+o+'] node [color="'+a+'" fontcolor="'+e+'" fontname='+o+'] edge [color="'+t+'" fontcolor="'+t+'" fontname='+o+"] "}function Uo(e){return zo[e]||(zo[e]=new Promise((t,a)=>{let o=document.createElement("script");o.src=e,o.onload=t,o.onerror=()=>{delete zo[e],a(new Error("could not load "+e))},document.head.appendChild(o)}))}async function Fl(){let e=We,t=[...se.querySelectorAll(".node pre > code.language-dot")];se.querySelectorAll(".node pre > code.language-echarts").forEach(n=>{let i=document.createElement("div");i.className="echarts-container",i.dataset.chart=n.textContent,Oe(n.parentElement,i)});let a=[...se.querySelectorAll(".node .echarts-container[data-chart]")],o=[...se.querySelectorAll(".node pre > code.language-d2")];if(!t.length&&!a.length&&!o.length)return;let r=[];if(t.length)try{if(await Uo(Ml),Ro=Ro||await Viz.instance(),e!==We)return;let n=zl();t.forEach(i=>{let s=document.createElement("div");s.className="diagram dot";try{s.appendChild(Ro.renderSVGElement(Rl(i.textContent,n)))}catch(l){s.className="diagram err",s.textContent="Diagram error: "+l.message}Oe(i.parentElement,s)})}catch{r.push("diagrams")}if(o.length)try{if(!Ba){let i=await import(Ol);Ba=new i.D2}if(e!==We)return;let n=Pl();for(let i of o){let s=document.createElement("div");s.className="diagram d2";try{let l=await Ba.compile(Dl(i.textContent));s.innerHTML=await Ba.render(l.diagram,{...l.renderOptions||{},themeOverrides:n,darkThemeOverrides:n})}catch(l){s.className="diagram err",s.textContent="Diagram error: "+(l.message||l)}if(e!==We)return;Oe(i.parentElement,s)}}catch{r.push("D2 diagrams")}if(a.length)try{if(await Uo(Tl),e!==We)return;let n=Al();a.forEach(i=>{let s;try{s=JSON.parse(i.dataset.chart)}catch{i.textContent="Chart data is not valid JSON.";return}echarts.init(i,n,{renderer:"svg"}).setOption(Object.assign({backgroundColor:"transparent",animation:!Mt},s))})}catch{r.push("charts")}e===We&&(r.length&&(Jt.textContent="Could not load the "+r.join(" and ")+" renderer (offline?)"),u.forEach(to),ra(),xe(!0))}function Nl(){let e=[];return g.forEach(t=>{let a=Ct(t),o=e[e.length-1];o&&o.sec===a?o.ids.push(t):e.push({sec:a,ids:[t]})}),e}function Hl(){let a=0,o=0,r=0;Nl().forEach((n,i)=>{let s=Math.max(...n.ids.map(d=>u.get(d)._h));i&&(a+=r/2+120+s/2);let l=o,c=o;n.ids.forEach((d,M)=>{let m=u.get(d);M&&(l+=90+m._w/2),m.cx=l,m.cy=a,c=l,l+=m._w/2}),o=c,r=s})}function jl(){u.forEach(e=>{e.cx=0,e.cy=0})}function ci(){We++,window.echarts&&se.querySelectorAll(".echarts-container").forEach(a=>{let o=echarts.getInstanceByDom(a);o&&o.dispose()}),se.querySelectorAll("div.node").forEach(a=>a.remove());let e=ni(),t=0;u.forEach(a=>{let o=document.createElement("div");o.className="node",o.tabIndex=0,o.dataset.id=a.id;let r=a.parent?ao(a.id).slice(0,-1).map(i=>u.get(i).title).join(" / "):"";o.innerHTML=(r?'<div class="crumb">'+A(r)+"</div>":"")+'<div class="body">'+a.html+"</div>"+(a.err?'<div class="err-badge">!</div>':"");let n=o.querySelector(".body");pl(n),bl(n),xl(n),vl(o,n),/^slidetake$/i.test(R.brand||"")&&el(n),n.querySelectorAll("thead").forEach(i=>{i.textContent.trim()||i.remove()}),t+=El(n),a.frags=kl(n),n.querySelectorAll("img").forEach(i=>{i.complete||i.addEventListener("load",Cl,{once:!0})}),o.querySelectorAll("a[href]").forEach(i=>{let s=i.getAttribute("href");if(s.startsWith("#")){let l=decodeURIComponent(s.slice(1));u.has(l)&&(i.classList.add("xlink"),i.addEventListener("click",c=>{c.preventDefault(),c.stopPropagation(),h.active||j(l)}))}else i.target="_blank",i.rel="noopener",i.addEventListener("click",l=>l.stopPropagation())}),o.addEventListener("click",()=>{h.active||j(a.id)}),o.addEventListener("keydown",i=>{i.key==="Enter"&&i.target===o&&j(a.id)}),se.appendChild(o),a.el=o,ir(a,a.frags.length)}),t&&!Jt.textContent&&(Jt.textContent=t+" image(s) use relative paths: add base: to the deck, or open it with ?src="),u.forEach(to),ra(e),Fl()}function ra(e){e===void 0&&(e=ni()),J==="radial"?hl(e):J==="path"?Hl():J==="focus"?jl():dl(),se.classList.toggle("focus",J==="focus"),u.forEach(t=>{let a=t.el.style;a.setProperty("--cx",t.cx),a.setProperty("--cy",t.cy)}),_l(),Lt(),cr()}function _l(){let e="";if(J==="focus"){Bo.innerHTML="";return}if(J==="path"){for(let t=1;t<g.length;t++){let a=u.get(g[t-1]),o=u.get(g[t]);e+='<path data-from="'+a.id+'" data-to="'+o.id+'" d="M '+a.cx+" "+a.cy+" L "+o.cx+" "+o.cy+'"/>'}Bo.innerHTML=e;return}u.forEach(t=>{if(!t.parent)return;let a=u.get(t.parent);if(J==="radial")e+='<path data-from="'+a.id+'" data-to="'+t.id+'" d="M '+a.cx+" "+a.cy+" L "+t.cx+" "+t.cy+'"/>';else{let o=a.cy+a._h/2,r=t.cy-t._h/2,n=o+(r-o)/2;e+='<path data-from="'+a.id+'" data-to="'+t.id+'" d="M '+a.cx+" "+o+" L "+a.cx+" "+n+" L "+t.cx+" "+n+" L "+t.cx+" "+r+'"/>'}}),Bo.innerHTML=e}function ao(e){let t=[],a=e;for(;a;)t.unshift(a),a=u.get(a).parent;return t}function vt(){let e=H.clientWidth,t=H.clientHeight;se.style.transform="translate("+e/2+"px,"+t/2+"px) scale("+z.zoom+") translate("+-z.x+"px,"+-z.y+"px)",vi()}function sr(){Yt&&(Yt.kill(),Yt=null)}function di(e,t){if(sr(),t||Mt||!window.gsap){Object.assign(z,e),vt();return}let a=H.clientWidth,o=Math.hypot(e.x-z.x,e.y-z.y),r=e.zoom,n=gsap.timeline({onUpdate:vt,onComplete:()=>{Yt=null}}),{zoom:i,...s}=e,l=o*Math.min(z.zoom,r),c=Math.max(.55,Math.min(1.3,.55+l/a*.3));if(n.to(z,{...s,duration:c,ease:"power2.inOut"},0),l>a*1.2){let d=Math.max(.06,Math.min(z.zoom,r,a*.9/(o+yt)));n.to(z,{zoom:d,duration:c/2,ease:"sine.out"},0).to(z,{zoom:r,duration:c/2,ease:"sine.in"},c/2)}else n.to(z,{zoom:r,duration:c,ease:"power2.inOut"},0);Yt=n}function Wl(){let e=H.getBoundingClientRect(),t=14,a=[];if(!Ae.hidden&&Ae.offsetWidth){let r=Ae.getBoundingClientRect();a.push({x0:r.left-e.left-t,y0:r.top-e.top-t,x1:r.right-e.left+t,y1:r.bottom-e.top+t})}let o=sl();return o&&a.push({x0:o.x0-t,y0:o.y0-t,x1:o.x1+t,y1:o.y1+t}),a}function Ul(){let e=H.clientWidth,t=H.clientHeight,a=[{x0:16,y0:K?20:56,x1:e-16,y1:t-(K?20:74)}];return Wl().forEach(o=>{let r=[];a.forEach(n=>{if(o.x1<=n.x0||o.x0>=n.x1||o.y1<=n.y0||o.y0>=n.y1){r.push(n);return}[{...n,x1:Math.min(n.x1,o.x0)},{...n,x0:Math.max(n.x0,o.x1)},{...n,y1:Math.min(n.y1,o.y0)},{...n,y0:Math.max(n.y0,o.y1)}].forEach(i=>{i.x1-i.x0>80&&i.y1-i.y0>80&&r.push(i)})}),r.length&&(a=r)}),a}function qo(e,t,a){let o=H.clientWidth,r=H.clientHeight,n=null;return Ul().forEach(i=>{let s=a*Math.min((i.x1-i.x0)/e,(i.y1-i.y0)/t);(!n||s>n.zoom)&&(n={zoom:s,sx:(i.x0+i.x1)/2-o/2,sy:(i.y0+i.y1)/2-r/2})}),n}function hi(e,t,a,o){return{x:e-a.sx/o,y:t-a.sy/o}}function Xe(e,t){let a=u.get(e);if(!a)return;let o=qo(a._w,a._h,$t),r=Ct(e),n=g.filter(l=>Ct(l)===r&&!u.get(l).visual).map(l=>{let c=u.get(l);return qo(c._w,c._h,$t).zoom}).sort((l,c)=>l-c),i=n.length?n[Math.floor((n.length-1)/2)]:o.zoom,s=Math.max(.2,Math.min(5,o.zoom,i));di(Object.assign(hi(a.cx,a.cy,o,s),{zoom:s}),t)}function na(e){let t=[...u.values()];if(!t.length)return;let a=H.clientWidth,o=H.clientHeight,r=Math.min(...t.map(d=>d.cx-d._w/2)),n=Math.max(...t.map(d=>d.cx+d._w/2)),i=Math.min(...t.map(d=>d.cy-d._h/2)),s=Math.max(...t.map(d=>d.cy+d._h/2)),l=qo(n-r,s-i,.94),c=Math.max(.05,Math.min(1,l.zoom));di(Object.assign(hi((r+n)/2,(i+s)/2,l,c),{zoom:c}),e)}function xe(e){f&&u.has(f)?Xe(f,e):na(e)}function Lt(){let e=f?ao(f):[];u.forEach(t=>{let a=t.el;a.classList.toggle("current",t.id===f),a.classList.toggle("active-path",e.includes(t.id))}),se.querySelectorAll("#connectors path").forEach(t=>{let a=J==="path"?!!f&&g.indexOf(t.dataset.to)<=g.indexOf(f):e.includes(t.dataset.from)&&e.includes(t.dataset.to);t.classList.toggle("active",a)}),Yl(e),ui()}function pi(){return Kr(new URLSearchParams(location.search).get("duration")??R.duration)}function ql(){return K&&pi()>0&&(!h.active||/^always$/i.test(R.timer||""))}function Wa(){let e=ql()&&Re.start>0;if(qe.classList.toggle("timed",e),!e){qe.classList.remove("over");return}let a=(h.active&&h.t0?xt():performance.now()-Re.start)/pi();qe.firstChild.style.width=Math.min(100,a*100)+"%",qe.classList.toggle("over",a>=1)}function Gl(){Re.start=performance.now(),clearInterval(Re.timer),Re.timer=setInterval(Wa,1e3),Wa()}function Vl(){clearInterval(Re.timer),Re.timer=null,Re.start=0,Wa()}function ui(){let e=K&&g.length>1&&!/^(off|no|false)$/i.test(R.progress||"");if(qe.classList.toggle("show",e),!e)return;Wa();let t=g.indexOf(f),a=0,o=0;g.forEach((r,n)=>{let i=Tt(u.get(r)).length;a+=i,n<t?o+=i:n===t&&(o+=Math.min(we,i-1)+1)}),qe.lastChild.style.width=(a?o/a*100:0)+"%"}function Yl(e){Pn.innerHTML=e.map((t,a)=>(a>0?'<span class="sep">\u203A</span>':"")+'<button class="crumb-btn'+(t===f?" here":"")+'" data-id="'+A(t)+'">'+A(u.get(t).title)+"</button>").join(""),Pn.querySelectorAll(".crumb-btn").forEach(t=>t.addEventListener("click",()=>{h.active||j(t.dataset.id)}))}function ia(e){let t=u.get(f);t&&(ir(t,oi().frag,e),nr(),(P.hidden||!Pe||!Pe.full||Pe.behind)&&$l(t),lr(t))}function Jl(e){return!g.length||e.id!==g[0]&&e.id!==g[g.length-1]||e.el.querySelector("[data-gsap], .title-scramble")?null:[...e.el.querySelector(".body").children].filter(t=>!t.classList.contains("fragment"))}function $l(e){if(e._played||!window.gsap||Mt)return;e._played=!0;let t=Jl(e);if(t&&t.length){e._auto=t;let[a,...o]=t;/^H[1-3]$/.test(a.tagName)&&!a.children.length?(a.classList.add("auto-scramble"),Hn(a)):o.unshift(a),gsap.from(o,{opacity:0,y:24,duration:.7,ease:"power2.out",delay:.5,stagger:.45})}e.el.querySelectorAll("[data-gsap]").forEach(a=>{let o;try{o=JSON.parse(a.dataset.gsap)}catch{return}let r={duration:o.duration??1,delay:o.delay??0,ease:o.ease||"power2.out"};o.to?gsap.fromTo(a,o.from||{},Object.assign({},o.to,r)):o.from&&gsap.from(a,Object.assign({},o.from,r))}),e.el.querySelectorAll(".title-scramble").forEach(Hn)}function Xt(e){!e||!e._played||(e._played=!1,window.gsap&&(e._auto&&(e._auto.forEach(t=>{gsap.killTweensOf(t),gsap.set(t,{clearProps:"opacity,transform"})}),e._auto=null),e.el.querySelectorAll("[data-gsap]").forEach(t=>{gsap.killTweensOf(t);let a={};try{a=JSON.parse(t.dataset.gsap)}catch{}let o=new Set(Object.keys(Object.assign({},a.from,a.to)).map(r=>Kl.includes(r)?"transform":r));o.size&&gsap.set(t,{clearProps:[...o].join(",")})}),e.el.querySelectorAll(".title-scramble, .auto-scramble").forEach(t=>{t._scramble&&t._scramble.kill(),t.dataset.text&&(t.textContent=t.dataset.text)})))}function Hn(e){let t=e.dataset.text||(e.dataset.text=e.textContent),a=Array.from(t),o="ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789#%&*+=?",r={p:0};e._scramble=gsap.to(r,{p:1,duration:1.4,ease:"none",onUpdate(){let n=Math.floor(r.p*a.length);e.textContent=a.map((i,s)=>s<n||/\s/.test(i)?i:o[Math.random()*o.length|0]).join("")},onComplete(){e.textContent=t}})}function lr(e){clearTimeout(bt),!(!K||!e||!e.autoslide||h.active&&(!h.t0||h.paused))&&(bt=setTimeout(()=>{f===e.id&&De(1)},e.autoslide))}function fi(e){let t=e&&e!==g[0]?e:"";try{E&&E.kind==="share"?history.replaceState(null,"",location.pathname+location.search+xo(E.data,t)):history.replaceState(null,"",e?"#"+encodeURIComponent(e):location.pathname+location.search)}catch{}}function j(e,t,a){if(!u.has(e))return;if(e!==f){ye=null,Ie=-1,we=a?Tt(u.get(e)).length-1:0;let n=u.get(f);n&&J==="focus"&&!t&&(n.el.classList.add("leaving"),setTimeout(()=>n.el.classList.remove("leaving"),600)),gi()}let o=e!==f;if(o&&(mi=f),f=e,clearTimeout(ge),ge=null,o&&J==="focus"&&!t&&!Mt){let n=u.get(e).el;n.classList.add("entering"),n.offsetWidth,n.classList.remove("entering")}ia(o),o&&!Te&&ta("slide",e);let r=u.get(e);o&&r.mapFirst&&!a&&!t&&J!=="focus"?(na(),ge=setTimeout(()=>{ge=null,f===e&&Xe(e)},1900)):Xe(e,t),Lt(),cr(),fi(e)}function gi(){let e=u.get(f);e&&(e.el.querySelectorAll("figure.yt").forEach(t=>si(t,"pauseVideo")),ir(e,e.frags.length,!0),Xt(e))}function Xl(){if(!f&&Ge&&u.has(Ge)){yi();return}f&&(Ge=f),J==="focus"&&dr("path"),gi(),clearTimeout(bt),f=null,Lt(),cr(),na(),fi(null)}function yi(){if(ge)return clearTimeout(ge),ge=null,Xe(f),!0;if(!f&&Ge&&u.has(Ge)){let e=Ge;return Ge=null,j(e),!0}return!1}function De(e){if(!f){g.length&&j(g[e>0?0:g.length-1]);return}if(ge&&e>0){clearTimeout(ge),ge=null,Xe(f);return}let t=Tt(u.get(f)),a=Math.min(we,t.length-1)+e;if(a>=0&&a<t.length){we=a,ye=null,Ie=-1,ia(),!oe&&!P.hidden&&Pe.used?at():xe(),Lt();return}let o=g.indexOf(f)+e;o>=0&&o<g.length&&j(g[o],!1,e<0)}function Ql(){let e=u.get(f);e&&e.parent&&j(e.parent)}function Zl(){let e=u.get(f);e&&e.children.length?j(e.children[0]):!f&&g.length&&j(g[0])}function cr(){let e=[...u.values()];if(!e.length){jo.innerHTML="",Ee=null;return}qs.textContent="map";let t=p=>p.cx,a=p=>p.cy,o=Math.min(...e.map(t))-yt/2,r=Math.max(...e.map(t))+yt/2,n=Math.min(...e.map(a))-_o/2,i=Math.max(...e.map(a))+_o/2,s=16,l=180,c=130,d=Math.min((l-2*s)/Math.max(1,r-o),(c-2*s-6)/Math.max(1,i-n)),M=l/2-(o+r)/2*d,m=c/2+5-(n+i)/2*d,y=f?ao(f):[],b="";e.forEach(p=>{if(!p.parent)return;let T=u.get(p.parent);b+='<line x1="'+(t(T)*d+M)+'" y1="'+(a(T)*d+m)+'" x2="'+(t(p)*d+M)+'" y2="'+(a(p)*d+m)+'" stroke="var(--panel-line)" stroke-width="1"/>'}),e.forEach(p=>{let T=p.id===f?"var(--accent)":y.includes(p.id)?"var(--accent-teal)":"var(--node-border)";b+='<circle data-id="'+A(p.id)+'" cx="'+(t(p)*d+M)+'" cy="'+(a(p)*d+m)+'" r="'+(p.id===f?4:3)+'" fill="'+T+'"><title>'+A(p.title)+"</title></circle>"}),b+='<rect id="mm-viewport" fill="none" stroke="var(--accent)" stroke-width="1" opacity="0.7"/>',jo.innerHTML=b,Ee={s:d,ox:M,oy:m},vi()}function vi(){let e=document.getElementById("mm-viewport");if(!e||!Ee)return;let t=H.clientWidth/z.zoom,a=H.clientHeight/z.zoom;e.setAttribute("x",(z.x-t/2)*Ee.s+Ee.ox),e.setAttribute("y",(z.y-a/2)*Ee.s+Ee.oy),e.setAttribute("width",Math.max(2,t*Ee.s)),e.setAttribute("height",Math.max(2,a*Ee.s))}function wt(e){ri(ie.value),f&&!u.has(f)&&(f=null),ci(),f?j(f,e):g.length?j(g[0],e):(f=null,na(!0))}function dr(e,t){J=e,U("slidetake:layout",e),document.querySelectorAll("#layout-toggle .seg-btn").forEach(a=>a.classList.toggle("active",a.dataset.mode===e)),u.size&&(!t&&!Mt&&(se.classList.add("morph"),setTimeout(()=>se.classList.remove("morph"),700)),ra(),vt(),f?Xe(f,t):na(t))}function bi(e){return Math.max(.04,Math.min(5,e))}function ec(e){$t=Math.round(Math.max($s,Math.min(Xs,e))*100)/100,U("slidetake:slideSize",$t),f&&Xe(f)}function jn(e){f?ec($t+e*.1):wi(e>0?1.2:1/1.2)}function wi(e,t,a){sr();let o=bi(z.zoom*e);if(t!==void 0){let r=H.getBoundingClientRect(),n=t-r.left-r.width/2,i=a-r.top-r.height/2;z.x+=n/z.zoom-n/o,z.y+=i/z.zoom-i/o}z.zoom=o,vt()}function oo(){_||(Ne.classList.toggle("collapsed"),document.getElementById("btn-edit-toggle").classList.toggle("active",!Ne.classList.contains("collapsed")))}function ve(e){K=e,document.body.classList.toggle("presenting",e),cs(document.getElementById("btn-present"),e),ds();let t=document.documentElement;e&&t.requestFullscreen&&!document.fullscreenElement&&t.requestFullscreen().catch(()=>{}),!e&&document.fullscreenElement&&document.exitFullscreen&&document.exitFullscreen().catch(()=>{}),e&&!f&&g.length&&j(g[0]);let a=R.camera||[...u.values()].some(o=>o.camera);e&&a&&!oe&&!re&&at(),e?lr(u.get(f)):clearTimeout(bt),e?Gl():Vl(),ui()}function xt(){return(h.paused?h.pauseAt:performance.now())-h.t0-h.pausedMs}function sa(e){e.classList.add("open")}function rc(e){if(U("slidetake:analytics",e?"on":"off"),!e){window["ga-disable-"+ac]=!0;let t=["","; Domain="+location.hostname,"; Domain=."+location.hostname.replace(/^www\./,"")];document.cookie.split(";").map(a=>a.split("=")[0].trim()).filter(a=>a==="_ga"||a.startsWith("_ga_")).forEach(a=>t.forEach(o=>{document.cookie=a+"=; Max-Age=0; Path=/"+o}))}ki()}function ki(){ur.querySelectorAll("[data-analytics]").forEach(e=>e.setAttribute("aria-checked",String(e.dataset.analytics==="on"===oc())))}function la(){document.querySelectorAll(".modal.open").forEach(e=>e.classList.remove("open"))}function nc(){let e=new URLSearchParams(location.search).get("obs");if(e){let[t,a,...o]=e.split(":");return Ua.value=t||"localhost",qa.value=a||"4455",Ga.value=o.join(":"),!0}try{let t=JSON.parse(W("slidetake:obs")||"null");t&&(Ua.value=t.host||"localhost",qa.value=t.port||"4455",Ga.value=t.password||"",hr.checked=!0)}catch{}return!1}function Ei(){if(hr.checked)U("slidetake:obs",JSON.stringify({host:Ua.value.trim(),port:qa.value.trim(),password:Ga.value}));else try{localStorage.removeItem("slidetake:obs")}catch{}}function _t(e,t,a){Kt.textContent=e,Kt.className=t||"",Kt.title=a||e;let o=document.getElementById("obs-detail");o.textContent=a||"",o.hidden=!a}function sc(e){return location.protocol==="https:"&&!ic(e)}async function fr(){let e=Ua.value.trim()||"localhost",t="ws://"+e+":"+(qa.value.trim()||"4455");if(sc(e)){Le=!1,_t("Blocked here","err",lc);return}_t("Connecting\u2026"),Kt.title="Connecting to "+t;try{await Uo(tc);let a=window.OBSWebSocket&&(window.OBSWebSocket.default||window.OBSWebSocket);if(ne)try{await ne.disconnect()}catch{}ne=new a,ne.on("ConnectionClosed",()=>{Le=!1,_t("Disconnected","err")}),ne.on("RecordStateChanged",r=>{r.outputState==="OBS_WEBSOCKET_OUTPUT_STARTED"&&Ve&&(Ve(),Ve=null),r.outputState==="OBS_WEBSOCKET_OUTPUT_STOPPED"&&h.active&&h.withObs&&!h.finishing&&Et("Stopped in OBS")});let o=await ne.connect(t,Ga.value||void 0);Le=!0;try{let r=await ne.call("GetVideoSettings");r&&r.fpsNumerator&&r.fpsDenominator&&(pr=r.fpsNumerator/r.fpsDenominator),xi=r&&r.outputWidth&&r.outputHeight?Sn(r.outputWidth,r.outputHeight):""}catch{}_t("Connected","ok",""),Kt.title="Connected"+(o&&o.obsWebSocketVersion?" \xB7 OBS WebSocket "+o.obsWebSocketVersion:""),Ei(),Y.classList.contains("open")&&et()&&(B("Connected to OBS. Press \u25CF Record."),je())}catch(a){Le=!1;let o=a&&a.message&&a.message!=="Error"?a.message+".":"Nothing answered at "+t+".";_t("Could not connect","err",o+" Is OBS running with its WebSocket server on, and are the port and password right?")}}function cc(){let e=document.getElementById("rec-screen"),t=screen.width,a=screen.height;if(Math.abs(t/a-16/9)<.02){e.innerHTML='<span class="ok">This screen is 16:9 ('+t+"\xD7"+a+"), right for YouTube.</span>";return}let o=[["16:10",1.6],["3:2",1.5],["4:3",4/3],["21:9",21/9],["16:9",16/9]],[r,n]=o.reduce((s,l)=>Math.abs(l[1]-t/a)<Math.abs(s[1]-t/a)?l:s),i=Math.abs(n-t/a)<.005?r:"about "+r;e.innerHTML='<span class="warn">This screen is '+i+" ("+t+"\xD7"+a+"), not 16:9, so the video will have bars or be cropped. Move this window to a 16:9 screen, physical or virtual (say 1920\xD71080), then press F there.</span>"}function ke(){let e=navigator.mediaDevices;if(!window.isSecureContext||!e||!e.getDisplayMedia)return{why:"This page can\u2019t capture itself here. Open Slidetake in Chrome or Edge on a computer."};if(!window.RestrictionTarget&&!window.CropTarget)return{why:"Recording in the browser needs Chrome or Edge (or another Chromium browser) on a computer."};let t=window.MediaRecorder?wn(r=>MediaRecorder.isTypeSupported(r)):"";if(!t||!navigator.storage||!navigator.storage.getDirectory)return{why:"This browser can\u2019t record video here. Use a recent Chrome or Edge."};let{quality:a,device:o}=bn(screen.width,screen.height,devicePixelRatio||1);return a?{ok:!0,type:t,quality:a}:{why:"This screen gives a "+o[0]+"\xD7"+o[1]+" frame, less than 720p. Use pro mode (OBS), or a larger screen."}}async function ro(){Yo++,de&&(cancelAnimationFrame(de.raf),de.stream.getTracks().forEach(e=>e.stop()),de.ctx.close().catch(()=>{}),de=null,Vo.value=0,ut.getContext("2d").clearRect(0,0,ut.width,ut.height),Mi())}function Mi(){Ko++,za&&(za.getTracks().forEach(e=>e.stop()),za=null),Ci.srcObject=null}async function Ti(){Mi();let e=Ko,t=pt.value;if(Ia.hidden=t!=="none"&&!!t,Ia.textContent="No camera",!(!t||t==="none"))try{let a=await navigator.mediaDevices.getUserMedia({video:t==="default"?!0:{deviceId:{exact:t}}});if(e!==Ko){a.getTracks().forEach(o=>o.stop());return}za=a,Ci.srcObject=a}catch{Ia.hidden=!1,Ia.textContent="The camera isn\u2019t available"}}async function Va(){await ro();let e=Yo;try{let t=kt.value,a=await navigator.mediaDevices.getUserMedia({audio:_i(t)});if(e!==Yo){a.getTracks().forEach(m=>m.stop());return}let o=new AudioContext,r=o.createAnalyser();r.fftSize=512,o.createMediaStreamSource(a).connect(r);let n=new Float32Array(r.fftSize),i=de={stream:a,ctx:o,raf:0},s=ut.getContext("2d"),l=ut.width,c=ut.height,d=Me("--accent"),M=()=>{if(de!==i)return;r.getFloatTimeDomainData(n);let m=0;for(let y of n)m=Math.max(m,Math.abs(y));Vo.value=Math.max(m,Vo.value*.85),s.clearRect(0,0,l,c),s.lineWidth=3,s.strokeStyle=d,s.lineJoin="round",s.beginPath();for(let y=0;y<n.length;y++){let b=y/(n.length-1)*l,p=c/2-Math.max(-1,Math.min(1,n[y]*3))*(c/2-4);y?s.lineTo(b,p):s.moveTo(b,p)}s.stroke(),i.raf=requestAnimationFrame(M)};M()}catch(t){ht.innerHTML='<span class="warn">The microphone isn\u2019t available: '+A(t.message||t.name)+". Allow it in the site settings.</span>"}}async function Ya(e=!0){try{e&&!de&&await Va();let t=await navigator.mediaDevices.enumerateDevices(),a=(n,i)=>{let s=t.filter(b=>b.kind===n),l=s.find(b=>b.deviceId==="default"),c=l?l.label.replace(/^Default - /,""):"",d=s.filter(b=>b.deviceId!=="default"&&b.deviceId!=="communications"),M=b=>!!l&&(b.label===c||!!l.groupId&&b.groupId===l.groupId&&!d.some(p=>p!==b&&p.label===c)),m=d.map((b,p)=>kn(b.label)||(n==="audioinput"?"Microphone ":"Camera ")+(p+1));m.forEach((b,p)=>{let T=m.slice(0,p).filter(L=>L===b).length;T&&(m[p]=b+" "+(T+1))});let y=d.some(b=>b.deviceId===i)||i==="none"?i:(d.find(M)||d[0]||{}).deviceId;return d.map((b,p)=>'<option value="'+A(b.deviceId)+'"'+(b.deviceId===y?" selected":"")+">"+A(m[p]+(M(b)?" (system default)":""))+"</option>").join("")},o=mr();pt.innerHTML='<option value="none"'+(o==="none"?" selected":"")+">No camera</option>"+a("videoinput",o);let r=W("slidetake:mic")||"";kt.innerHTML=a("audioinput",r),r&&kt.value===r&&de&&de.stream.getAudioTracks()[0].getSettings().deviceId!==r&&Va()}catch{}}function mr(){let e=W(Li());return e||(hc()?W("slidetake:cam")||"default":"none")}function pc(e){U(Li(),e),e!=="none"&&e!=="default"&&U("slidetake:cam",e)}function uc(){h.camWas=!re;let e=mr()!=="none";e!==!re&&pa(e,!0)}function Ai(){h.camWas!=null&&(h.camWas!==!re&&pa(h.camWas,!0),h.camWas=null)}async function Bi(){let e=ke();if(!e.ok)return ht.innerHTML='<span class="warn">'+A(e.why)+"</span>",e;Pa&&(ht.innerHTML='<span class="warn">'+A(Pa)+"</span>",Pa="");let t=lt.indexOf(e.quality),a=W("slidetake:quality");St.innerHTML=lt.slice(t).map(r=>"<option"+(r.name===a?" selected":"")+">"+r.name+"</option>").join("");let o="";try{let{quota:r,usage:n}=await navigator.storage.estimate(),i=lt.find(s=>s.name===St.value)||e.quality;o=" Room for about "+Math.floor((r-n)/xn(i))+" minutes of takes."}catch{}return ht.querySelector(".warn")||(ht.innerHTML='<span class="ok">Ready: this screen records up to '+e.quality.name+" in fullscreen."+A(o)+"</span>"),e}function fc(e){pe=e,U("slidetake:rec-mode",e),ea({setup:Bt()})}function ea(e={}){Ze&&(ke().ok&&(pe||"browser")==="browser"?kr(e):mc(e))}function mc(e={}){let t=no().find(a=>a.key===He()&&a.withObs&&!a.inBrowser);Gi(t||{key:He(),deckTitle:R.title||(g[0]?u.get(g[0]).title:"Deck"),date:new Date().toISOString(),withObs:!0,outputPath:null,reason:"",total:0,totalObs:null,fps:pr,events:[],picks:{},empty:!0},e)}async function gr(){if(!(!Ze||h.active||!g.length)){if(!gc()){Xo({note:"Set up once: after this, \u25CF Record (R) starts recording straight away."});return}if(ke().ok&&(pe||"browser")==="browser"){let t=Ta(tt(),lo()).filter(r=>!r.pick).map(r=>r.id),a=g.indexOf(f),o=t.length?t:a>0?g.slice(a):g;Ka("browser",o.length===g.length?null:o);return}if(!Le&&W("slidetake:obs")&&await fr(),Le){Ka("obs");return}Xo({note:"Connect to OBS first: OBS \u2192 Connect."})}}async function yr(e,t){return(await(await navigator.storage.getDirectory()).getDirectoryHandle("slidetake-takes",{create:!0})).getDirectoryHandle(e,{create:!!t})}async function vr(e){try{await(await(await navigator.storage.getDirectory()).getDirectoryHandle("slidetake-takes")).removeEntry(e,{recursive:!0})}catch{}}async function Ii(e){window.RestrictionTarget&&e.restrictTo?await e.restrictTo(await RestrictionTarget.fromElement(ja)):await e.cropTo(await CropTarget.fromElement(ja))}async function yc(e){try{window.RestrictionTarget&&e.track.restrictTo?await e.track.restrictTo(null):await e.track.cropTo(null),await Ii(e.track)}catch{}await e.track.applyConstraints(Oi(e.quality)).catch(()=>{}),await Zt()}async function vc(){let e=ke();if(!e.ok)throw new Error(e.why);let t=lt.find(s=>s.name===St.value)||e.quality;document.body.classList.add("rec-frame");let a=await navigator.mediaDevices.getDisplayMedia({video:{frameRate:Ht},audio:!1,preferCurrentTab:!0,selfBrowserSurface:"include",surfaceSwitching:"exclude",monitorTypeSurfaces:"exclude"}),o=a.getVideoTracks()[0],r=()=>a.getTracks().forEach(s=>s.stop());if(!o.restrictTo&&!o.cropTo)throw r(),new Error("Share \u201Cthis tab\u201D to record the slides.");try{await Ii(o)}catch(s){throw r(),new Error("Chrome could not record just the slides ("+(s.message||s.name)+").")}await o.applyConstraints(Oi(t)).catch(()=>{});let n;try{let s=W("slidetake:mic");n=await navigator.mediaDevices.getUserMedia({audio:_i(s)})}catch(s){throw r(),new Error("The microphone isn\u2019t available ("+(s.message||s.name)+").")}let i=new Date().toISOString().replace(/[:.]/g,"-");h.browser={id:i,display:a,mic:n,track:o,quality:t,type:e.type,stream:new MediaStream([o,...n.getAudioTracks()]),dir:await yr(i,!0),clips:[],cur:null,chain:Promise.resolve(),error:null},o.addEventListener("ended",()=>{h.active&&!h.finishing&&Et("Sharing stopped")})}function Pi(){let e=h.browser;e&&(e.display.getTracks().forEach(t=>t.stop()),e.mic.getTracks().forEach(t=>t.stop()),document.body.classList.remove("rec-frame"))}function bc(e){let t=h.browser,a="take-"+t.clips.length+"."+Co(t.type),o={name:a,rec:null,done:null};t.clips.push(o),e.clip=t.id+"/"+a,t.chain=t.chain.then(async()=>{let r=await(await t.dir.getFileHandle(a,{create:!0})).createWritable(),n=new MediaRecorder(t.stream,{mimeType:t.type,videoBitsPerSecond:t.quality.bitrate,audioBitsPerSecond:Sa}),i=Promise.resolve();n.ondataavailable=l=>{l.data.size&&(i=i.then(()=>r.write(l.data)).catch(c=>{t.error=c}))},o.done=new Promise(l=>{n.onstop=async()=>{await i,await r.close().catch(()=>{}),l()}}),await new Promise(l=>{n.onstart=l,n.start(1e3)}),e.t=Math.round(xt()),e.cutAt!=null&&(e.lead=Math.max(0,Math.round(e.t-e.cutAt)));let s=t.cur;t.cur=o,o.rec=n,s&&s.rec.state!=="inactive"&&s.rec.stop()}).catch(r=>{t.error=r})}async function Ka(e,t){if(h.active||!g.length)return;let a=e==="obs";if(ro(),pe||(pe=a?"obs":"browser",U("slidetake:rec-mode",pe)),e==="browser"){K||ve(!0);try{await vc()}catch(l){document.body.classList.remove("rec-frame"),K&&ve(!1),Pa=l.name==="NotAllowedError"?"Recording needs this tab shared: press \u25CF Record again and choose Share.":l.message,kr({setup:!0});return}}la();let o=t&&t.length?t.filter(l=>g.includes(l)):null,r=o?o[0]:g[0],n=g[g.indexOf(r)-1]||null;Object.assign(h,{active:!0,withObs:a,counting:!0,paused:!1,finishing:!1,t0:0,pausedMs:0,events:[],outputPath:null,only:o?new Set(o):null}),e!=="browser"&&(h.browser=null),document.body.classList.add("recording"),Er(),K||ve(!0),uc(),n?(document.body.classList.add("no-anim"),u.get(n)._played=!0,Te=!0,j(n,!0,!0),Te=!1,P.getAnimations().forEach(l=>l.finish()),await Zt(),document.body.classList.remove("no-anim")):(f===r&&(we=0,ye=null,Ie=-1),j(r,!0)),!document.fullscreenElement&&document.documentElement.requestFullscreen&&await document.documentElement.requestFullscreen().catch(()=>{});let i=Ut.querySelector(".hint");for(let l=3;l>0;l--)if(i.textContent=(document.fullscreenElement?"":"Press F for fullscreen \xB7 ")+"recording starts after the countdown \xB7 Esc to cancel",Ut.querySelector(".num").textContent=l,Ut.classList.add("show"),await Qt(1e3),!h.active)return;if(Ut.classList.remove("show"),await Zt(),a){let l=new Promise(c=>{Ve=c,setTimeout(()=>{Ve&&(Ve(),Ve=null)},2500)});try{await ne.call("StartRecord")}catch(c){br("OBS could not start recording: "+(c&&c.message||c));return}if(await l,!h.active)return}h.browser&&await yc(h.browser),h.counting=!1,h.t0=performance.now();let s=u.get(r);if(n){ta("slide",r),h.browser&&await h.browser.chain,Xt(s),Te=!0,j(r),Te=!1;return}Xt(s),ia(!0),ta("slide",f)}function br(e){if(h.active=!1,h.counting=!1,h.browser){let t=h.browser;t.chain.then(()=>{t.cur&&t.cur.rec.state!=="inactive"&&t.cur.rec.stop()}).then(()=>vr(t.id)),Pi(),h.browser=null}Ut.classList.remove("show"),document.body.classList.remove("recording"),K&&ve(!1),Ai(),mt(e)}function ta(e,t,a){if(!h.active||!h.t0||h.finishing)return;let o=u.get(t),r={id:t,title:o?o.title:t,retake:e==="retake",t:Math.round(xt()),obsT:null};a==null&&h.browser&&(a=r.t),a!=null&&(r.cutAt=a,r.lead=Math.max(0,Math.round(r.t-a))),h.events.push(r),h.browser&&bc(r),h.withObs&&Le&&(ne.call("GetRecordStatus").then(n=>{n&&typeof n.outputDuration=="number"&&(r.obsT=n.outputDuration)}).catch(()=>{}),o&&ne.call("CreateRecordChapter",{chapterName:(r.retake?"RETAKE \xB7 ":"")+o.title}).catch(()=>{}))}function wc(e){let t=e.key;if((Wn.includes(t)||Un.includes(t)||qn.includes(t)||t==="Escape")&&e.preventDefault(),t==="Escape"){h.counting?br("Take cancelled"):Et("Stopped early");return}if((t==="f"||t==="F")&&!document.fullscreenElement&&document.documentElement.requestFullscreen){e.preventDefault(),document.documentElement.requestFullscreen().catch(()=>{});return}if(!(h.counting||h.finishing||Ke)){if(qn.includes(t)){Ec();return}h.paused||(Wn.includes(t)?xc():Un.includes(t)&&kc())}}function xc(){let e=Tt(u.get(f)),t=Math.min(we,e.length-1)>=e.length-1,a=g.indexOf(f);if(!t){De(1);return}if(!h.only){a===g.length-1?Et():De(1);return}let o=g.slice(a+1).find(r=>h.only.has(r));o?g[a+1]===o?De(1):zi(g[g.indexOf(o)-1],o,"slide"):Et()}async function kc(){let e=u.get(f);if(!e||Ke)return;let t=f,a=mi;if(!a||a===t||!u.has(a)){Sc(e);return}zi(a,t,"retake")}async function zi(e,t,a){let o=u.get(t);if(!o||Ke)return;Ke=!0;let r=xt();document.body.classList.add("no-anim");let n=u.get(e);Te=!0,n._played=!0,j(e,!0,!0),P.getAnimations().forEach(i=>i.finish()),Te=!1,await Zt(),document.body.classList.remove("no-anim"),ta(a,t,r),h.browser&&await h.browser.chain,h.withObs&&await Ri(),Xt(o),Te=!0,j(t),Te=!1,!oe&&!P.hidden&&Pe.used&&at(),Ke=!1}async function Ri(){let e=h.events[h.events.length-1];e&&(e.skip=Gn/2),await Qt(Gn)}async function Sc(e){Ke=!0,we=0,ye=null,Ie=-1,Xt(e),ia(!0),!oe&&!P.hidden&&Pe.used?at():xe(),Lt(),ta("retake",f),h.withObs&&await Ri(),Ke=!1}async function Ec(){if(h.t0)if(h.paused){if(Go.classList.remove("show"),await Zt(),h.withObs&&await ne.call("ResumeRecord").catch(()=>{}),h.browser){let e=h.browser;e.chain=e.chain.then(()=>{e.cur&&e.cur.rec.state==="paused"&&e.cur.rec.resume()})}h.pausedMs+=performance.now()-h.pauseAt,h.paused=!1,lr(u.get(f))}else{if(h.paused=!0,h.pauseAt=performance.now(),clearTimeout(bt),h.withObs&&await ne.call("PauseRecord").catch(()=>{}),h.browser){let e=h.browser;e.chain=e.chain.then(()=>{e.cur&&e.cur.rec.state==="recording"&&e.cur.rec.pause()})}Go.classList.add("show")}}async function Et(e){if(!h.active||h.finishing)return;if(h.counting){br("Take cancelled");return}h.finishing=!0,clearTimeout(bt),h.paused&&(h.pausedMs+=performance.now()-h.pauseAt,h.paused=!1,Go.classList.remove("show"));let t=Math.round(xt()),a=null;if(h.withObs){try{let n=await ne.call("GetRecordStatus");n&&typeof n.outputDuration=="number"&&(a=n.outputDuration)}catch{}await Qt(1200);try{let n=await ne.call("StopRecord");h.outputPath=n&&n.outputPath}catch(n){e=(e?e+". ":"")+"OBS did not confirm the stop ("+(n&&n.message||n)+")"}}let o=h.browser;o&&(await Qt(600),await o.chain,t=Math.round(xt()),o.cur&&o.cur.rec&&o.cur.rec.state!=="inactive"&&o.cur.rec.stop(),await Promise.all(o.clips.map(n=>n.done)),Pi(),h.browser=null,o.error&&(e=(e?e+". ":"")+"Some of the take could not be saved ("+(o.error.message||o.error.name)+")")),h.active=!1,h.finishing=!1,document.body.classList.remove("recording"),K&&ve(!1),Ai();let r={key:He(),deckTitle:R.title||u.get(g[0]).title,date:new Date().toISOString(),withObs:h.withObs,outputPath:h.outputPath,reason:e||"",total:t,totalObs:a,fps:o?Ht:pr,...o?{inBrowser:!0,takesId:o.id,quality:o.quality.name,type:o.type}:{},events:h.events.map(n=>({id:n.id,title:n.title,retake:n.retake,t:n.t,obsT:n.obsT,...n.lead?{lead:n.lead}:{},...n.skip?{skip:n.skip}:{},...n.clip?{clip:n.clip}:{}})),picks:{}};if(r.inBrowser){Ic(r);return}wr(r),Gi(r,{note:(e?e+". ":"")+me(r).size+" slides recorded with OBS."})}function He(){return nt(R.title||(g[0]?u.get(g[0]).title:"deck"))}function no(){try{return JSON.parse(W("slidetake:sessions")||"[]")}catch{return[]}}function wr(e){let t=no().filter(a=>a.date!==e.date);t.unshift(e),t.slice(12).forEach(a=>{a.takesId&&vr(a.takesId)}),U("slidetake:sessions",JSON.stringify(t.slice(0,12)))}function Ct(e){let t=u.has(e)?ao(e):[e];return t[Math.min(1,t.length-1)]}function Di(e,t){let a=Ct(e);return{sec:a,title:u.has(a)?u.get(a).title:t}}function B(e,{warn:t=!1,html:a="",title:o=""}={}){Wt.classList.toggle("warn",t),a?Wt.innerHTML=a:Wt.textContent=e,Wt.title=o||Wt.textContent;let r=document.getElementById("rv-save-again");r&&(r.onclick=()=>es(!0))}function Gi(e,t={}){la(),N=e,Z=null;let a=e.events.filter(i=>i.retake).length,o=e.empty?"":me(e).size+" slides, "+(a?a+" retake"+(a>1?"s":""):"no retakes")+", recorded "+it(e.totalObs??e.total)+". ";Y.classList.remove("in-browser","board"),Y.classList.add("obs");let r=document.getElementById("rv-rec");r.title="Records the deck with OBS: a new video in place of this one",r.disabled=!1,document.getElementById("rv-render-btn").disabled=document.getElementById("rv-clean").disabled=!!e.cleaned,document.getElementById("rv-file").textContent=e.outputPath?" ("+st(e.outputPath)+")":"";let n=xa(e);Ja.value=[...Ja.options].reduce((i,s)=>Math.abs(s.value-n)<Math.abs(i.value-n)?s:i).value,k.src&&(e.inBrowser||Fe!==st(e.outputPath)&&e.outputPath)&&(k.removeAttribute("src"),k.load(),Fe=""),document.getElementById("rv-novideo").hidden=!!k.src||!!e.empty,Z=null,F=null,At(),io(),sa(Y),t.setup?co(t):(ho(),Ya(!1).then(je)),B(t.note||(e.empty?Le?"Press \u25CF Record: OBS records the deck.":"Connect to OBS in Setup, then press \u25CF Record.":o+(k.src?"Click a take to preview it.":"Open the recording to preview it."))),e.empty||Fc(e)}function io(){if(N&&N.board){Qe();return}let e=N,t=document.getElementById("rv-list"),a=null;t.innerHTML=[...me(e).values()].map(o=>{let r=e.picks[o.id]??o.takes.length,n=Ct(o.id),i=n!==a;a=n;let s=o.takes.map(l=>'<button class="rv-chip'+(r===l.no?" on":"")+'" data-id="'+A(o.id)+'" data-take="'+l.no+'">Take '+l.no+" \xB7 "+it(l.end-l.start)+"</button>").join("");return'<div class="rv-row'+(i?" sec":"")+'"><div class="t">'+A(o.title)+"<small>"+fa(o.takes[0].start)+'</small></div><div class="rv-chips">'+s+"</div></div>"}).join(""),t.querySelectorAll(".rv-chip").forEach(o=>o.onclick=()=>{e.picks[o.dataset.id]=+o.dataset.take,wr(e),io();let r=me(e).get(o.dataset.id),n=r&&r.takes[+o.dataset.take-1];if(!n)return;let i=r.title+(r.takes.length>1?" \xB7 take "+n.no:"");if(e.inBrowser){let s=e.events.filter(l=>l.id===o.dataset.id)[n.no-1];s&&s.clip&&so([{clip:s.clip,keep:(n.end-n.start)/1e3,title:i}])}else Xa([{start:n.start,end:n.end,title:i}])}),document.getElementById("rv-ffmpeg-copy").disabled=document.getElementById("rv-play-final").disabled=!e.events.length,Yi(e),Ji(e)}function Yi(e){let t=Cc(e),a=document.getElementById("rv-chapters");Vi=t.lines.join(`
|
|
1315
|
+
`),a.disabled=t.lines.length<3,a.title=t.lines.length<3?"YouTube needs at least three chapters of 10 seconds or more":"Copies the "+t.lines.length+" chapters, to paste into the YouTube description"}function Ki(e,t){let a=e.dataset.label||(e.dataset.label=e.textContent);(navigator.clipboard?navigator.clipboard.writeText(t):Promise.reject()).catch(()=>{}),e.textContent="\u2713 Copied",clearTimeout(+e.dataset.timer),e.dataset.timer=String(setTimeout(()=>{e.textContent=a},1500))}async function Ji(e){let t=document.getElementById("rv-final"),a=++Fo,o=Nt(e).reduce((n,i)=>n+i.end-i.start,0),r=n=>(n?"about "+(n>1e9?(n/1e9).toFixed(1)+" GB":Math.max(1,Math.round(n/1e6))+" MB")+" \xB7 ":"Final cut ")+it(o);if(!e.inBrowser||e.cleaned){t.textContent=r(null);return}try{let n=0;for(let i of jt(e))Da.has(i.clip)||Da.set(i.clip,(await ca(i.clip)).size),n+=Da.get(i.clip);a===Fo&&(t.textContent=r(n))}catch{a===Fo&&(t.textContent=r(null))}}function Xa(e){if(!k.src){$a=e,B(Zo?"Opening the recording\u2026 it plays when ready.":"Open the recording to preview.");return}$a=null,Z={ranges:e,i:0},B("\u25B6 "+e[0].title);let t=()=>{k.currentTime=e[0].start/1e3,k.play().catch(a=>{a&&a.name!=="AbortError"&&B("Could not play: "+a.message,{warn:!0})})};k.readyState>=1?t():k.addEventListener("loadedmetadata",t,{once:!0})}function At(){ft=null}function xr(){let e=F&&!F.single&&!k.paused;$i.innerHTML=e?'\u275A\u275A <span><u class="key">P</u>ause</span>':'\u25B6 <span><u class="key">P</u>review</span>',document.querySelectorAll("#rv-list .rv-row.playing").forEach(o=>o.classList.remove("playing"));let t=F&&F.parts[F.i],a=t&&t.id&&document.querySelector('#rv-list .rv-row[data-id="'+CSS.escape(t.id)+'"]');a&&(a.classList.add("playing"),a.scrollIntoView({block:"nearest"}))}function Tc(e){let t=N?jt(N):[],a=t.findIndex(r=>r.id===e.id),o=a>=0?t[a+1]:null;ft=o?o.id:null,B(o?"Preview continues from "+o.title+".":"That was the last slide: Preview plays from the start.")}function Xi(e){return Array.from({length:e.numberOfChannels},(t,a)=>{let o=new Float32Array(e.numberOfFrames);return e.copyTo(o,{planeIndex:a,format:"f32-planar"}),o})}async function ca(e){let[t,a]=e.split("/");return(await(await yr(t)).getFileHandle(a)).getFile()}async function so(e,t=0,a=!1){if(!(!N||N.cleaned||!e.length)){Z=null,F={parts:e,i:t,single:a};try{let o=await ca(e[t].clip);if(!Y.classList.contains("open"))return;k.src&&URL.revokeObjectURL(k.src),k.src=URL.createObjectURL(o),B("\u25B6 "+e[t].title),await k.play()}catch(o){if(o&&o.name==="AbortError")return;F=null,B(o&&o.name==="NotFoundError"?"This take is no longer in the browser.":"Could not play this take: "+(o&&o.message||o),{warn:!0})}}}function Qi(){let e=F;if(e.i+1<e.parts.length){so(e.parts,e.i+1,e.single);return}F=null,k.pause(),e.single?Tc(e.parts[0]):B(""),xr()}async function Lc(e){if(!e.where)return!0;try{let t=await Sr("video-folder");return!t||t.name!==e.where||await t.queryPermission({mode:"readwrite"})!=="granted"||await t.getFileHandle(e.name),!0}catch{return!1}}async function es(e){let t=N;if(!t||!t.inBrowser||t.cleaned)return;let a=jt(t);if(!a.length){B("No slide has a take yet: nothing to save.",{warn:!0});return}let o=JSON.stringify([a.map(d=>[d.clip,Math.round(d.keep*1e3)]),Je(),aa(),t.type]),r=t.board&&O.lastDownload;if(!e&&r&&r.sig===o&&await Lc(r)){B("",{html:'<button class="btn small" id="rv-save-again">Save another copy</button> Already saved in '+A(No(r))+".",title:"Already saved in "+No(r)+". A new video is made only when a take or the sound settings change."});return}let n=Co(t.type||"")==="mp4",i=He()+" "+Bc(new Date)+"."+(n?"mp4":"webm"),s=null,l="";try{let d=await ts(!1);d&&(s=await(await d.getFileHandle(i,{create:!0})).createWritable(),l=d.name)}catch(d){if(d&&d.name==="AbortError")return}let c=Qa;c.disabled=!0,Ue("Preparing\u2026");try{let d=await import(dc),M=s?new d.StreamTarget(s):new d.BufferTarget,m=new d.Output({format:n?new d.Mp4OutputFormat({fastStart:s?!1:"in-memory"}):new d.WebMOutputFormat,target:M}),y=1,b="",p=Je()&&aa();if(Je()){let D=await Vn(d,a,1,!1,"Measuring");if(D&&isFinite(D.integrated)){let q=To(D,{limit:p});if(p&&Math.abs(q)>=.05){let Q=await Vn(d,a,Ma(q),!0,"Checking");Q&&isFinite(Q.integrated)&&(q=Math.min(q+(-14-Q.integrated),Mo))}y=Ma(q);let ce=p?-14:D.integrated+q,ae=!p&&To(D,{limit:!0})-q>.5;b=" \xB7 loudness "+D.integrated.toFixed(1)+(Math.abs(q)<.05?" LUFS, left as is":" \u2192 "+ce.toFixed(1)+" LUFS")+(ae?"; a loud peak held it back, turn on Peak limiter to reach "+-14:"")}}let T=y!==1||p;await Ac(d,a);let L=null,w=null,x=0,v=-1,S=-1,C=null,$=[],te=async()=>{for(;$.length&&C.ready()>=$[0].n;){let D=$.shift(),q=C.take(D.n),ce=new Float32Array(D.n*D.ch);q.forEach((ae,Q)=>ce.set(ae,Q*D.n)),await w.add(new d.AudioSample({data:ce,format:"f32-planar",numberOfChannels:D.ch,sampleRate:D.rate,timestamp:D.t}))}};for(let[D,q]of a.entries()){Ue("Joining "+(D+1)+"/"+a.length);let ce=new d.Input({source:new d.BlobSource(await ca(q.clip)),formats:d.ALL_FORMATS}),ae=await ce.getPrimaryVideoTrack(),Q=await ce.getPrimaryAudioTrack();if(!ae)throw new Error(q.title+" has no video");L||(L=new d.EncodedVideoPacketSource(await ae.getCodec()),m.addVideoTrack(L,{frameRate:Ht}),Q&&(w=T?new d.AudioSampleSource({codec:n?"aac":"opus",bitrate:Sa}):new d.EncodedAudioPacketSource(await Q.getCodec()),m.addAudioTrack(w)),await m.start());let It={decoderConfig:await ae.getDecoderConfig()},ot=0,Lr=!0;for await(let G of new d.EncodedPacketSink(ae).packets())G.timestamp>=q.keep||(v=Ea(v,x+G.timestamp),await L.add(G.clone({timestamp:v}),Lr&&D===0?It:void 0),Lr=!1,ot=Math.max(ot,G.timestamp+G.duration));if(Q&&w&&T)for await(let G of new d.AudioSampleSink(Q).samples(0,ot)){if(G.timestamp+G.duration>ot+1e-4){G.close();continue}S=Ea(S,x+G.timestamp);let ue=Xi(G);if(ue.forEach(fe=>{for(let rt=0;rt<fe.length;rt++)fe[rt]*=y}),p)C=C||Lo(G.sampleRate,ue.length),C.push(ue),$.push({t:S,n:G.numberOfFrames,rate:G.sampleRate,ch:ue.length}),G.close(),await te();else{let fe=G.numberOfFrames,rt=new Float32Array(fe*ue.length);ue.forEach((gs,ys)=>rt.set(gs,ys*fe)),await w.add(new d.AudioSample({data:rt,format:"f32-planar",numberOfChannels:ue.length,sampleRate:G.sampleRate,timestamp:S})),G.close()}}else if(Q&&w){let G={decoderConfig:await Q.getDecoderConfig()},ue=!0;for await(let fe of new d.EncodedPacketSink(Q).packets())fe.timestamp+fe.duration>ot+1e-4||(S=Ea(S,x+fe.timestamp),await w.add(fe.clone({timestamp:S}),ue&&D===0?G:void 0),ue=!1)}x+=ot}if(C&&(C.end(),await te(),C.events&&(b+=", "+C.events+" peak"+(C.events===1?"":"s")+" limited")),Ue("Finishing\u2026"),await m.finalize(),!s){let D=document.createElement("a");D.href=URL.createObjectURL(new Blob([M.buffer],{type:n?"video/mp4":"video/webm"})),D.download=i,D.click(),setTimeout(()=>URL.revokeObjectURL(D.href),1e4)}let X={sig:o,name:i,where:l};t.board&&(O.lastDownload=X,da()),B("Saved in "+No(X)+" ("+it(x*1e3)+b+")."),Ue("\u2713 Saved"),Zi=setTimeout(()=>Ue(),2500)}catch(d){Ue(),B("Could not save the video: "+(d&&d.message||d),{warn:!0}),s&&s.abort().catch(()=>{})}finally{c.disabled=!!t.cleaned}}async function Vn(e,t,a,o,r){let n=null,i=null;for(let[s,l]of t.entries()){Ue(r+" "+(s+1)+"/"+t.length);let c=await new e.Input({source:new e.BlobSource(await ca(l.clip)),formats:e.ALL_FORMATS}).getPrimaryAudioTrack();if(c)for await(let d of new e.AudioSampleSink(c).samples(0,l.keep)){let M=Xi(d);n=n||Cn(d.sampleRate,M.length),a!==1&&o?(M.forEach(m=>{for(let y=0;y<m.length;y++)m[y]*=a}),i=i||Lo(d.sampleRate,M.length),i.push(M),i.ready()&&n.add(i.take(i.ready()))):n.add(M),d.close()}}return i&&(i.end(),i.ready()&&n.add(i.take(i.ready()))),n?n.result():null}async function Ac(e,t){let a=[];for(let i of t){let s=await new e.Input({source:new e.BlobSource(await ca(i.clip)),formats:e.ALL_FORMATS}).getPrimaryVideoTrack(),l=s&&await s.getDecoderConfig();a.push(l?l.codec+" "+l.codedWidth+"\xD7"+l.codedHeight+" "+(l.description?[...new Uint8Array(l.description)].join("."):""):"none")}let o=new Map;a.forEach(i=>o.set(i,(o.get(i)||0)+1));let r=[...o.entries()].sort((i,s)=>s[1]-i[1])[0][0],n=t.filter((i,s)=>a[s]!==r);if(n.length)throw new Error(n.map(i=>i.title).join(", ")+(n.length===1?" was":" were")+" recorded at a different size ("+a[t.indexOf(n[0])].split(" ")[1]+", not "+r.split(" ")[1]+"). Tick "+(n.length===1?"it":"them")+" and record again")}async function ts(e){if(!window.showDirectoryPicker)return null;let t=e?null:await Sr("video-folder");if(t){let a=await t.queryPermission({mode:"readwrite"});if(a==="prompt"&&(a=await t.requestPermission({mode:"readwrite"})),a==="granted")return t}return t=await window.showDirectoryPicker({id:"slidetake-videos",mode:"readwrite",startIn:"videos"}),ns("video-folder",t),t}function tt(){let e=as();if(O&&$o===e)return O;$o=e;try{O=JSON.parse(W(e)||"null")}catch{O=null}return(!O||!Array.isArray(O.takes))&&(O={takes:[],picks:{},type:"",quality:""}),O}function Ic(e){tt();let t=An(e,e.takesId,lo());t.forEach(a=>{delete O.picks[a.id]}),O.takes.push(...t),Object.assign(O,{type:e.type,quality:e.quality}),da(),Be.clear(),kr({note:(e.reason?e.reason+". ":"")+t.length+" new take"+(t.length===1?"":"s")+" on the board."})}function os(){let e=Ta(tt(),lo()),t=Object.assign(Bn(e),{board:!0,inBrowser:!0,withObs:!1,type:O.type||"video/mp4",quality:O.quality||"",deckTitle:R.title||(g[0]?u.get(g[0]).title:"Deck"),date:new Date().toISOString()});return{rows:e,sess:t}}function co(e={}){Y.classList.add("setup-view"),Kn.textContent=e.note||"",Kn.hidden=!e.note,$e.textContent="\u2190 Back",$e.title="Back to Studio",$e.setAttribute("aria-expanded","true"),Pc()}function ho(){let e=Bt();e&&Y.classList.remove("setup-view"),$e.textContent="\u2699 Setup",$e.title="Settings: camera, microphone, video, OBS and files",$e.setAttribute("aria-expanded","false"),e&&(ro(),je())}function Xo(e={}){Y.classList.contains("open")?co(e):ea({...e,setup:!0})}function Pc(){let e=()=>{je(),Bt()&&Ti()};if(et()){cc(),Ya(!1).then(e);return}ht.innerHTML="",Bi().then(t=>{t.ok?Ya().then(e):e()})}function je(){let e=i=>{let s=i.selectedOptions[0];return s?s.textContent.replace(/ \(system default\)$/,""):""},t=e(pt)||(mr()==="none"?"No camera":"Camera"),a=et(),o=a?xi:ke().ok?St.value:"",r=a?[t]:[t,e(kt)||"Microphone"],n=document.getElementById("rv-using");n.textContent=r.join(" \xB7 "),n.title="Recording with "+r.join(" \xB7 "),document.getElementById("rv-size").textContent=o||"",dt.classList.toggle("on",a),dt.setAttribute("aria-pressed",String(a)),dt.disabled=!ke().ok,dt.title=dt.disabled?Fa+" records only with OBS: pro mode":a?"Pro mode: recording with OBS. Click for easy mode, in "+Fa:"Easy mode: recording in "+Fa+". Click for pro mode, with OBS"}function kr(e={}){Ze&&(la(),tt(),Y.classList.remove("obs"),Y.classList.add("in-browser","board"),document.getElementById("rv-rec").title="Records the whole deck, or only the ticked slides (shift-click ticks a range)",document.getElementById("rv-novideo").hidden=!0,k.src&&(URL.revokeObjectURL(k.src),k.removeAttribute("src"),k.load()),Z=null,F=null,At(),Ra=-1,Qe(),sa(Y),e.setup||!ke().ok?co(e):(ho(),Bi().then(()=>Ya(!1)).then(je)),B(e.note||qi()||(O.takes.length?zc()+". Click a take to preview it.":g.length+" slides, nothing recorded yet. Press \u25CF Record.")))}function zc(){let e=Ta(tt(),lo()),t=e.filter(o=>o.pick).length,a=e.filter(o=>o.takes.length&&!o.pick).length;return t+" of "+e.length+" slides ready"+(a?", "+a+" to record again":"")}function Qe(){let{rows:e,sess:t}=os();N=t;let a=document.getElementById("rv-list"),o=null;a.innerHTML=e.map(i=>{let s=Ct(i.id),l=s!==o;o=s;let c=A(i.id),d={slide:"Recorded before this slide changed",before:"Starts with the entry from the slide before, which has changed or is gone: record this slide again"},M=i.takes.length?i.takes.map(m=>'<button class="rv-chip'+(i.pick===m.uid?" on":"")+(m.outdated?' outdated" title="'+d[m.outdated]:"")+'" data-id="'+c+'" data-uid="'+A(m.uid)+'">Take '+m.no+" \xB7 "+it(m.ms)+"</button>").join("")+(i.pick?"":'<span class="rv-none">'+(i.takes.some(m=>m.outdated==="before")&&!i.takes.some(m=>m.outdated==="slide")?"The slide before changed: record again":"Changed since: record again")+"</span>"):'<span class="rv-none">No take yet</span>';return'<div class="rv-row with-sel'+(l?" sec":"")+(Be.has(i.id)?" selected":"")+'" data-id="'+c+'"><input type="checkbox" class="rv-sel" data-id="'+c+'"'+(Be.has(i.id)?" checked":"")+' aria-label="Select '+A(i.title)+' to record"><div><div class="t">'+A(i.title)+'</div><div class="rv-chips">'+M+"</div></div></div>"}).join(""),a.querySelectorAll(".rv-chip").forEach(i=>i.onclick=()=>{O.picks[i.dataset.id]=i.dataset.uid,da(),Qe();let s=e.find(c=>c.id===i.dataset.id),l=s&&s.takes.find(c=>c.uid===i.dataset.uid);l&&so([{id:s.id,clip:l.clip,keep:l.ms/1e3,title:s.title+" \xB7 take "+l.no}],0,!0)}),a.querySelectorAll(".rv-sel").forEach(i=>i.addEventListener("click",s=>{(s.shiftKey?On(g,Yn,i.dataset.id):[i.dataset.id]).forEach(c=>{i.checked?Be.add(c):Be.delete(c)}),At(),Yn=i.dataset.id,Qe()}));let r=La(g,Be),n=ke().ok;document.getElementById("rv-rec").disabled=!n,Ra>=0&&r.length!==Ra&&B(qi()||"Record takes the whole deck."),Ra=r.length,document.getElementById("rv-render-btn").disabled=document.getElementById("rv-play-final").disabled=!t.events.length,Yi(t),Ji(t)}async function Rc(e){for(let a of e)try{let[o,r]=a.clip.split("/");await(await yr(o)).removeEntry(r)}catch{}let t=new Set(e.map(a=>a.uid));O.takes=O.takes.filter(a=>!t.has(a.uid)),Object.keys(O.picks).forEach(a=>{t.has(O.picks[a])&&delete O.picks[a]}),da(),k.src&&(URL.revokeObjectURL(k.src),k.removeAttribute("src"),k.load()),F=null,At(),Qe()}function rs(e){return new Promise((t,a)=>{let o=indexedDB.open(e||"slidetake",1);o.onupgradeneeded=()=>o.result.createObjectStore("kv"),o.onsuccess=()=>t(o.result),o.onerror=()=>a(o.error)})}async function Sr(e){let t=async a=>{let o=await rs(a);return await new Promise(r=>{let n=o.transaction("kv").objectStore("kv").get(e);n.onsuccess=()=>r(n.result),n.onerror=()=>r(null)})};try{return await t()??await t("markcast")??await t("traverse")??null}catch{return null}}async function ns(e,t){try{(await rs()).transaction("kv","readwrite").objectStore("kv").put(t,e)}catch{}}async function po(e){Zo=!0;try{return await Dc(e)}finally{Zo=!1}}async function Dc(e){let t=await e.getFile();for(let a=0;a<10;a++){await new Promise(r=>setTimeout(r,1e3));let o=await e.getFile();if(o.size===t.size&&o.lastModified===t.lastModified)return o;t=o}return t}function ha(e,t,a){k.src&&URL.revokeObjectURL(k.src),qt=t||null,a||(Qo=0),k.src=URL.createObjectURL(e),Fe=e.name,document.getElementById("rv-novideo").hidden=!0,B("Loaded "+e.name+". Click a take to preview it."),$a?Xa($a):a&&Z&&Xa(Z.ranges.slice(Z.i))}async function Fc(e){let t=st(e.outputPath);if(!(!t||!window.showDirectoryPicker)&&!(Fe===t&&k.src))try{let a=await Sr("obs-folder");if(!a||await a.queryPermission({mode:"read"})!=="granted")return;let o=await a.getFileHandle(t);B("Opening "+t+"\u2026"),ha(await po(o),o)}catch{}}function mt(e,t){if(!h.active){if(clearTimeout(Na),!P.hidden&&!P.classList.contains("live")){Vt.classList.remove("show"),ss.textContent=e,P.classList.add("msg"),t||(Na=setTimeout(ls,9e3));return}Vt.textContent=e,Vt.classList.add("show"),t||(Na=setTimeout(()=>Vt.classList.remove("show"),9e3))}}function ls(){ss.textContent="PIP camera",P.classList.remove("msg")}function Er(){clearTimeout(Na),Vt.classList.remove("show"),ls()}function Ho(){let e=!1;try{e=window.top!==window.self}catch{e=!0}return e?" This page is running inside a preview frame that may not allow cameras. Open Slidetake directly in Chrome (from localhost or as a file).":window.isSecureContext?" Allow camera access for this page in the browser\u2019s site settings (the icon at the left of the address bar), then try again.":" Browsers only allow cameras on secure pages. Open it from http://localhost or as a local file in Chrome."}function Cr(){oe&&oe.getTracks().forEach(t=>t.stop()),oe=null;let e=P.querySelector("video");e&&e.remove()}async function at(){if(!(oe||re)){{if(!navigator.mediaDevices||!navigator.mediaDevices.getUserMedia){mt("Camera not available on this page."+Ho(),!0);return}if(Ce.disabled)return;Ce.disabled=!0,mt("Waiting for camera permission \u2014 check the browser prompt near the address bar.",!0);try{let t=W("slidetake:cam");oe=await navigator.mediaDevices.getUserMedia({video:{...t?{deviceId:{ideal:t}}:{},width:{ideal:1920},height:{ideal:1080},frameRate:{ideal:30}},audio:!1}),Er()}catch(t){let a=t&&t.name;mt(a==="NotAllowedError"||a==="SecurityError"?"Camera access was blocked."+Ho():a==="NotFoundError"||a==="OverconstrainedError"?"No camera was found. Check that a webcam is connected.":a==="NotReadableError"?"The camera is busy \u2014 close other apps using it (Zoom, OBS, FaceTime) and try again.":"Could not start the camera"+(a?" ("+a+")":"")+"."+Ho(),!0);return}finally{Ce.disabled=!1,Mr()}oe.getVideoTracks().forEach(t=>t.addEventListener("ended",()=>{Cr(),_a(),xe()}));let e=document.createElement("video");e.autoplay=!0,e.muted=!0,e.playsInline=!0,e.srcObject=oe,P.appendChild(e)}_a(),xe()}}function cs(e,t){e.classList.toggle("on",t),e.setAttribute("aria-pressed",String(t))}function Mr(){Ce.querySelector("svg")||(Ce.innerHTML=Nc+'<span class="lbl"> <u class="key">C</u>amera</span>'),Ce.classList.toggle("on",!re),Ce.setAttribute("aria-pressed",String(!re)),Ce.title=re?"Camera is off for every slide (C)":"Camera is on and follows the deck (C)"}function pa(e,t){e&&!Ze||(re=!e,re&&(Cr(),Er()),ye=null,Ie=-1,we=Math.min(we,Math.max(0,Tt(u.get(f)).length-1)),Mr(),_a(),ia(),Lt(),xe(),!K&&!t&&mt(e?"Camera on \u2014 slides follow their camera settings.":"Camera off \u2014 camera settings are ignored and slides use the whole screen."),e&&at())}function ds(){document.body.classList.remove("idle"),clearTimeout(Jn),K&&(Jn=setTimeout(()=>document.body.classList.add("idle"),2e3))}function oa(e,t){gt.textContent=e,gt.classList.add("show"),clearTimeout(Xn),Xn=setTimeout(()=>gt.classList.remove("show"),t||2500)}function er(e,{keepObs:t=!0,keepEdit:a=!0,slide:o=""}={}){let r=new URL(rn(e),location.origin);return new URLSearchParams(location.search).forEach((n,i)=>{i==="src"||i==="obs"&&!t||i==="edit"&&!a||r.searchParams.set(i,n)}),o&&(r.hash=o),r.href.replace(r.pathname,r.pathname.replace(/%40/g,"@"))}async function jc(e){let t={keepObs:!1,keepEdit:!1,slide:e};if(E.kind==="source")return{link:er(E.source,t),inside:!1};if(E.kind==="copy"&&ba(I)&&["url","gist","builtin"].includes(I.origin.kind))return{link:er(I.origin,t),inside:!1};let o=E.kind==="share"?E.data:await sn(ie.value),r=new URLSearchParams(location.search);return["src","obs","edit"].forEach(n=>r.delete(n)),{link:location.origin+"/share"+(r.toString()?"?"+r:"")+xo(o,e),inside:!0}}function _c(){let e=W("slidetake:draft");if(!e||e===uo)return null;let t=ya(e,{kind:"file",name:"your earlier draft"},{exported:!0});U("slidetake:copy",JSON.stringify(t));try{localStorage.removeItem("slidetake:draft")}catch{}return t}function ua(){U("slidetake:copy",JSON.stringify(I))}function Ot(){if(_)return;let e;if(Tr())e='<span class="mine">'+A(he.file)+'</span> <span class="ro">\xB7 on this computer, saved as you type</span>';else if(E.kind==="copy")e='<span class="mine">Your copy of '+A(Se(I.origin))+"</span>"+(va(I)?' <span class="edited">\xB7 edited</span>':"");else{let a=E.kind==="share"?"a shared deck":Se(E.source);e='<span class="mine">'+A(a.charAt(0).toUpperCase()+a.slice(1))+'</span> <span class="ro">\xB7 read-only, typing makes your copy</span>'}document.getElementById("doc-state").innerHTML=e,Ne.classList.toggle("unsaved",E.kind==="copy"&&va(I)),document.getElementById("btn-reset").hidden=!(E.kind==="copy"&&!ba(I));let t=document.getElementById("continue");t.hidden=E.kind==="copy"||!I,I&&(t.textContent="Your copy \u2192",t.title="Continue your copy of "+Se(I.origin))}function hs(e){return!I||!va(I)?!0:confirm("Your copy of "+Se(I.origin)+" has edits you haven't saved or shared. Replace it with "+e+"?")}function ps(){let e=new URLSearchParams(location.search);return e.delete("src"),e.delete("template"),"/edit"+(e.toString()?"?"+e:"")}function Wc(){let e=E.kind==="share"?{kind:"shared"}:E.source;return hs("a copy of "+Se(e))?(I=ya(E.text,e),E={kind:"copy"},history.pushState(null,"",ps()+(f&&f!==g[0]?"#"+encodeURIComponent(f):"")),oa("Editing your own copy of "+Se(e)+". The original is unchanged.",4e3),!0):(ie.value=E.text,!1)}function Uc(){E={kind:"copy"},history.pushState(null,"",ps()),Ne.classList.contains("collapsed")&&oo(),ie.value=I.text,wt(!0),Ot()}function Tr(){return!!(he&&E&&E.kind==="source"&&E.source.kind==="url"&&new URL(E.source.url,location.href).pathname===he.deck)}function qc(e){fetch(he.save,{method:"PUT",body:e}).catch(()=>oa("Could not save "+he.file+": is npx slidetake still running?",6e3))}async function Gc(e){if(e.kind==="builtin")return Ha[e.id==="help"?"docs":e.id]??Ha.home;if(e.kind==="gist"){let a=await fetch("https://api.github.com/gists/"+encodeURIComponent(e.id));if(!a.ok)throw new Error(a.status===404?"no such gist":a.status+" "+a.statusText);let o=Object.values((await a.json()).files||{}),r=o.find(n=>n.filename===e.file)||o.find(n=>/\.(md|markdown)$/i.test(n.filename))||o[0];if(!r)throw new Error("the gist has no files");return ze=r.raw_url,r.truncated?await(await fetch(r.raw_url)).text():r.content}let t=await fetch(e.url);if(!t.ok)throw new Error(t.status===404?"not found":t.status+" "+t.statusText);return ze=new URL(e.url,location.href).href,await t.text()}function ei(){return E={kind:"source",source:{kind:"builtin",id:"home"},text:Ha.home},E.text}async function Vc(){if(he&&ee.page==="source"&&ee.source.kind==="builtin"&&ee.source.id==="home"&&location.pathname==="/"&&(ee.source={kind:"url",url:he.deck}),_)return ze=_.base||location.href,E={kind:"source",source:{kind:"url",url:ze},text:Xr(_.settings||{})+String(_.markdown||"")},E.text;if(ee.page==="edit"){if(I)return E={kind:"copy"},I.text;history.replaceState(null,"","/new"+location.search),ee.page="pick"}if(ee.page==="pick")return sa(document.getElementById("new-dialog")),E={kind:"source",source:{kind:"builtin",id:"template:blank"},text:Ha["template:blank"]},E.text;if(ee.page==="share")try{let e=await ln(ee.data);return E={kind:"share",data:ee.data,text:e},e}catch{return oa("This link's deck is damaged or cut short, so it could not be opened.",6e3),ei()}try{let e=await Gc(ee.source);return E={kind:"source",source:ee.source,text:e},e}catch(e){return Jt.textContent="Could not load the deck ("+e.message+")",oa("Could not load "+Se(ee.source)+": "+e.message,6e3),ei()}}var _,he,or,Ze,Mt,Ha,ie,H,se,Bo,Pn,Us,Jt,jo,qs,Ne,Aa,Gs,yt,Oo,le,_o,Vs,Ys,Ks,Js,$s,Xs,$t,u,g,Ye,f,rr,J,K,R,re,oe,Ae,P,ja,z,Yt,Zs,zn,_e,Rn,we,ye,Ie,Pe,ul,fl,yl,li,Po,wl,ze,Fn,Ml,Tl,Ll,Nn,Ol,Ba,Il,Rl,Dl,zo,We,Ro,qe,Re,Kl,bt,ge,mi,Te,Ge,Ee,Oa,Do,ct,_n,tc,Wn,Un,qn,Y,Ut,Go,Ua,qa,Ga,hr,Kt,ne,Le,Ve,pr,xi,h,Qt,Zt,ac,ur,oc,Si,ic,lc,dc,pt,kt,St,Vo,ht,ut,pe,Pa,de,Yo,Ci,Ia,za,Ko,hc,Li,et,gc,Oi,Ke,Gn,Fe,Cc,Mc,Fi,Je,Ni,Jo,aa,Hi,ji,_i,Wi,Ui,N,Z,k,Wt,Ra,qi,Vi,Da,Fo,Ja,$a,$i,ft,F,Qa,Zi,Ue,No,Bc,O,$o,Yn,Be,as,da,Oc,lo,$e,Kn,Bt,Fa,dt,qt,Qo,Zo,Gt,is,Ce,Vt,Na,ss,Nc,Jn,be,$n,gt,Xn,Hc,tr,ar,Qn,Za,ee,Zn,E,I,us=V(()=>{"use strict";Ir();Pr();Rr();Fr();Hr();_r();Ur();Gr();ma();Zr();an();bo();ko();hn();un();En();Mn();In();ka();_=window.SLIDETAKE||null;document.getElementById("deck-text")?.remove();he=window.SLIDETAKE_LOCAL||null,or=document.querySelector("header .mark .logo").outerHTML;document.documentElement.classList.toggle("embed",!!_);Ze=!_||_.recording===!0;document.documentElement.classList.toggle("no-record",!Ze);Mt=window.matchMedia("(prefers-reduced-motion: reduce)").matches,Ha={home:uo,docs:zr,features:Dr,privacy:Nr,showcase:Vr,"template:blank":jr,"template:talk":Wr,"template:recording":qr},ie=document.getElementById("editor"),H=document.getElementById("stage"),se=document.getElementById("world"),Bo=document.getElementById("connectors"),Pn=document.getElementById("breadcrumbs"),Us=document.getElementById("status-count"),Jt=document.getElementById("status-err"),jo=document.getElementById("mm-svg"),qs=document.getElementById("mm-label"),Ne=document.getElementById("editor-pane"),Aa=540,Gs=96,yt=440,Oo=720,le=960,_o=180,Vs=540,Ys=100,Ks=110,Js=420,$s=.35,Xs=1,$t=parseFloat(W("slidetake:slideSize"))||.92,u=new Map,g=[],Ye=[],f=null,rr=["focus","path","radial","tree"],J="path",K=!1,R={},re=!0,oe=null,Ae=document.getElementById("brand"),P=document.getElementById("pip"),ja=document.getElementById("stage-wrap"),z={x:0,y:0,zoom:.6},Yt=null;Zs='<span class="st-name">'+or+'Slide<span class="st-take">take</span></span>';zn={accent:"--accent",accentSoft:"--accent-teal",line:"--accent-line",ring:"--accent-ring",header:"--header-bg",headerText:"--header-ink",onAccent:"--on-accent"};_e=null;Rn=new URLSearchParams(location.search).get("mode");we=0;ye=null,Ie=-1,Pe=null;ul=new Set("svg g defs symbol use path rect circle ellipse line polyline polygon text tspan textPath title desc marker linearGradient radialGradient stop clipPath mask pattern filter feGaussianBlur feOffset feBlend feFlood feComposite feMerge feMergeNode feColorMatrix feDropShadow".split(" ")),fl=0;yl=e=>e.querySelector("img")&&!e.textContent.trim()&&[...e.children].every(t=>/^(IMG|BR)$/.test(t.tagName));li=["dot","d2","echarts","svg"].map(e=>":scope > code.language-"+e).join(", "),Po=e=>!!e.querySelector("img")&&!e.textContent.trim(),wl=e=>e.children.length===1&&(e.children[0].tagName==="PRE"&&!!e.children[0].querySelector(li)||e.children[0].matches("div.diagram"));ze=null;Fn=null;Ml="https://cdn.jsdelivr.net/npm/@viz-js/viz@3.4.0/lib/viz-standalone.js",Tl="https://cdnjs.cloudflare.com/ajax/libs/echarts/5.5.0/echarts.min.js",Ll={dark:{palette:["#60a5fa","#f472b6","#a78bfa","#fb923c","#facc15","#a1a1aa"],text:"#e4e4e7",muted:"#a1a1aa",line:"#3f3f46",split:"#27272a",tip:"#18181b"},light:{palette:["#2563eb","#db2777","#7c3aed","#ea580c","#ca8a04","#71717a"],text:"#27272a",muted:"#71717a",line:"#d4d4d8",split:"#e4e4e7",tip:"#ffffff"}};Nn=new Set;Ol="https://esm.sh/@terrastruct/d2@0.1.33",Ba=null,Il={dark:{N1:"#e4e4e7",N2:"#a1a1aa",N3:"#a1a1aa",N4:"#323238",N5:"#27272a",N6:"#18181b",N7:"#09090b"},light:{N1:"#27272a",N2:"#71717a",N3:"#71717a",N4:"#e4e4e7",N5:"#e4e4e7",N6:"#f4f4f5",N7:"#ffffff"}};Rl=(e,t)=>e.replace("{","{"+t),Dl=e=>/d2-config\s*:/.test(e)?e:`vars: {
|
|
1315
1316
|
d2-config: {
|
|
1316
1317
|
layout-engine: elk
|
|
1317
1318
|
}
|
|
1318
1319
|
}
|
|
1319
|
-
`+e,
|
|
1320
|
-
`+t.html):""},lr=()=>yn(y,e=>({title:u.get(e).title,fp:vc(e)}));ve=document.getElementById("rv-setup"),cr=document.getElementById("rv-setup-btn");ve.addEventListener("toggle",()=>{cr.setAttribute("aria-expanded",String(ve.open)),ve.open?dr():Ya()});cr.onclick=()=>{ve.open=!ve.open};se.addEventListener("click",e=>{(e.target===se||e.target.closest("[data-close]"))&&Ya()});No=(()=>{let e=(navigator.userAgentData&&navigator.userAgentData.brands||[]).map(a=>a.brand).filter(a=>!/chromium|not.?a.?brand/i.test(a));if(e.length)return e[0].replace(/^(Google|Microsoft) /,"");let t=navigator.userAgent;return/Firefox\//.test(t)?"Firefox":/Edg\//.test(t)?"Edge":/OPR\//.test(t)?"Opera":/Chrome\//.test(t)?"Chrome":/Safari\//.test(t)?"Safari":"this browser"})();document.querySelectorAll(".browser-name").forEach(e=>{e.textContent=No});document.getElementById("rv-rec").onclick=()=>{if(!Ka()){Pn("browser",wa(y,Le));return}if(Oe){Pn("obs");return}ve.open=!0,A("Connect to OBS first: Setup \u2192 OBS \u2192 Connect.",{warn:!0})};document.getElementById("rv-use-obs").onclick=()=>bi("obs");document.getElementById("rv-use-browser").onclick=()=>bi("browser");document.querySelectorAll(".rv-purge .rv-menu button").forEach(e=>e.addEventListener("click",()=>{e.closest("details").open=!1}));document.getElementById("rv-clean-unused").onclick=async()=>{let{rows:e}=Vi(),t=new Set(e.map(o=>o.pick).filter(Boolean)),a=O.takes.filter(o=>!t.has(o.uid));if(!a.length){A("Every take is in use.");return}confirm("Purge "+a.length+" take"+(a.length===1?"":"s")+" the video doesn\u2019t use (earlier attempts and outdated takes)?")&&(await xc(a),A("Purged "+a.length+" unused take"+(a.length===1?"":"s")+"."))};document.getElementById("rv-clean").onclick=async()=>{if(!O.takes.length||!confirm("Purge all "+O.takes.length+" takes of this deck from this browser? Download the video first if you need it."))return;let e=new Set(O.takes.map(t=>t.clip.split("/")[0]));O.takes=[],O.picks={},aa();for(let t of e)await ar(t);k.src&&(URL.revokeObjectURL(k.src),k.removeAttribute("src"),k.load()),F=null,St(),A("All takes purged."),$e()};document.getElementById("rv-clean-every").onclick=async()=>{let e,t=0,a=0;try{e=await navigator.storage.getDirectory()}catch{return}let o=async s=>{for await(let l of s.values())l.kind==="directory"?await o(l):(a++,t+=(await l.getFile()).size)};try{await o(await e.getDirectoryHandle("slidetake-takes"))}catch{}let r=[];try{for(let s=0;s<localStorage.length;s++){let l=localStorage.key(s);l&&l.startsWith("slidetake:board:")&&r.push(l)}}catch{}let n=r.filter(s=>{try{return JSON.parse(localStorage.getItem(s)||"{}").takes.length>0}catch{return!1}}).length;if(!a){A("No takes are kept in this browser.");return}let i=t>1e9?(t/1e9).toFixed(1)+" GB":Math.max(1,Math.round(t/1e6))+" MB";if(confirm("Purge "+i+" of takes ("+a+" file"+(a===1?"":"s")+") from "+(n||"no")+" deck"+(n===1?"":"s")+" and any left behind? Every deck loses its takes; download the videos you need first.")){try{await e.removeEntry("slidetake-takes",{recursive:!0})}catch{}r.forEach(s=>{try{localStorage.removeItem(s)}catch{}}),V("slidetake:sessions",JSON.stringify(rr().map(s=>s.inBrowser?{...s,cleaned:!0}:s))),O=null,Fo="",ta(),Ma.clear(),k.src&&(URL.revokeObjectURL(k.src),k.removeAttribute("src"),k.load()),F=null,St(),$e(),A("Purged "+i+" of takes from every deck.")}};Dt=null,Ho=0,jo=!1;k.addEventListener("error",async()=>{if(k.getAttribute("src")){if(Dt&&Ho<5){Ho++,A("Reloading "+De+" (OBS was still finishing it)\u2026"),await new Promise(e=>setTimeout(e,1500));try{oa(await Xa(Dt),Dt,!0);return}catch{}}A(Dt?"Chrome cannot play "+De+". In OBS set Recording Format to Hybrid MP4 (or MP4) with H.264 video; the ffmpeg command still works with this file.":"Could not play "+(De||"this file")+". If OBS was still finishing it when you opened it, open it again; if it still fails, set OBS to Hybrid MP4 (or MP4) with H.264 video.",{warn:!0})}});Ft=document.getElementById("rv-file-input");Ft.addEventListener("change",()=>{Ft.files[0]&&oa(Ft.files[0]),Ft.value=""});document.getElementById("rv-open").onclick=async()=>{if(!window.showOpenFilePicker)return Ft.click();try{let[e]=await window.showOpenFilePicker({id:"obs-recordings",types:[{description:"Recordings",accept:{"video/*":[".mov",".mp4",".m4v",".mkv",".webm"]}}]});A("Opening "+e.name+"\u2026"),oa(await Xa(e),e)}catch(e){(!e||e.name!=="AbortError")&&A("Could not open that file.",{warn:!0})}};Ji=document.getElementById("rv-folder");window.showDirectoryPicker||(Ji.style.display="none");Ji.onclick=async()=>{let e=N&&ot(N.outputPath);try{let t=await window.showDirectoryPicker({id:"obs-recordings",mode:"read"});if(Ki("obs-folder",t),!e){A("Folder remembered. This session has no file name from OBS; open the file instead.");return}let a=await t.getFileHandle(e);oa(await Xa(a),a)}catch{}};Kl()&&new URLSearchParams(location.search).get("obs")&&fi();Ee=document.getElementById("btn-camera"),Nt=document.getElementById("pip-msg"),Ta=null,$i=z.querySelector("span");Ec='<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linejoin="round" aria-hidden="true"><rect x="2" y="6" width="14" height="12" rx="2"/><path d="M16 10.5 22 7v10l-6-3.5z"/></svg>';Ee.onclick=()=>ra(oe);mr();Nn=null;window.addEventListener("pointermove",Zi);document.addEventListener("fullscreenchange",()=>{document.fullscreenElement||(h.active?yt("Stopped: the browser left fullscreen"):K&&ye(!1))});be=document.getElementById("help");new MutationObserver(()=>Qi(document.getElementById("btn-keys"),be.classList.contains("open"))).observe(be,{attributes:!0,attributeFilter:["class"]});new MutationObserver(()=>{let e=se.classList.contains("open");document.getElementById("btn-studio").classList.toggle("active",e),!e&&!k.paused&&k.pause()}).observe(se,{attributes:!0,attributeFilter:["class"]});document.getElementById("btn-keys").onclick=()=>be.classList.add("open");document.getElementById("help-close").onclick=()=>be.classList.remove("open");be.addEventListener("click",e=>{e.target===be&&be.classList.remove("open")});window.addEventListener("keydown",e=>{if(e.key==="F5"){e.preventDefault(),h.active||Da();return}if(h.active){sc(e);return}if(document.querySelector(".modal.open")){e.key==="Escape"&&Va();return}let t=document.activeElement&&document.activeElement.tagName;if(t==="TEXTAREA"||t==="INPUT"||e.metaKey||e.ctrlKey||e.altKey)return;if(be.classList.contains("open")){/^(Escape|k|K|\?)$/.test(e.key)&&be.classList.remove("open");return}let a=e.key;a==="ArrowRight"||a===" "||a==="PageDown"?(e.preventDefault(),Re(1)):a==="ArrowLeft"||a==="PageUp"?(e.preventDefault(),Re(-1)):a==="ArrowDown"?(e.preventDefault(),Ul()):a==="ArrowUp"?(e.preventDefault(),_l()):a==="Home"?y.length&&j(y[0]):a==="End"?y.length&&j(y[y.length-1]):a==="o"||a==="O"?jl():a==="e"||a==="E"?Ga():a==="f"||a==="F"||a==="p"||a==="P"?ye(!K):a==="r"||a==="R"?Da():/^[1-4]$/.test(a)?qa(Go[+a-1]):a==="c"||a==="C"?ra(oe):a==="v"||a==="V"?Xs():a==="l"||a==="L"?Gn():a==="+"||a==="="?An(1):a==="-"||a==="_"?An(-1):a==="?"||a==="k"||a==="K"?be.classList.add("open"):a==="Escape"&&!ii()&&K&&ye(!1)});window.addEventListener("hashchange",()=>{let{data:e,slide:t}=ca(location.hash);if(e&&!(E&&E.kind==="share"&&e===E.data)){location.reload();return}t&&t!==f&&u.has(t)&&j(t)});Hn="";new ResizeObserver(()=>{let e=H.clientWidth+"x"+H.clientHeight;e!==Hn&&(Hn=e,ht(),xe(!0))}).observe(H);ct=document.createElement("div");ct.id="toast";ct.setAttribute("role","status");document.body.appendChild(ct);jn=null;Cc=document.getElementById("open-dialog"),Uo=document.getElementById("open-url"),Wo=document.getElementById("open-error");document.getElementById("btn-load").onclick=()=>{Wo.hidden=!0,Zt(Cc),Uo.focus(),Uo.select()};document.getElementById("open-form").onsubmit=e=>{e.preventDefault();let t=Vr(Uo.value);if(!t){Wo.textContent="That doesn't look like a link.",Wo.hidden=!1;return}location.href=_o(t)};document.getElementById("btn-share").onclick=async()=>{let{link:e,inside:t}=await Mc(f&&f!==y[0]?f:""),a=t?"Link copied, with the whole deck inside it ("+(e.length/1024).toFixed(1)+" KB)"+(e.length>8e3?". Some chat apps cut long links short: a GitHub file or gist makes a shorter one.":"."):"Link copied.";try{await navigator.clipboard.writeText(e),Jt(a,5e3)}catch{prompt("Copy this link:",e)}E.kind==="copy"&&(I.exported=I.text,na(),Et())};_n=U("slidetake:layout");Y=Go.includes(_n)?_n:"path";document.querySelectorAll("#layout-toggle .seg-btn").forEach(e=>e.classList.toggle("active",e.dataset.mode===Y));ja=new URLSearchParams(location.search);Go.includes(ja.get("layout"))&&(Y=ja.get("layout"),document.querySelectorAll("#layout-toggle .seg-btn").forEach(e=>e.classList.toggle("active",e.dataset.mode===Y)));if(_){let e=(Array.isArray(_.trail)?_.trail:_.back?[_.back]:[]).filter(r=>r&&r.label),t=document.querySelector("header .brand");e.length&&(t.innerHTML='<nav class="trail" aria-label="Site">'+e.map((r,n)=>(n?'<span class="sep" aria-hidden="true">|</span>':"")+(r.url?'<a href="'+B(r.url)+'">'+B(r.label)+"</a>":"<span>"+B(r.label)+"</span>")).join("")+"</nav>");let a=document.createElement("a");a.id="credit",a.href="https://slidetake.com",a.target="_blank",a.rel="noopener",a.title="Made with Slidetake",a.setAttribute("aria-label","Made with Slidetake"),a.innerHTML=qo+'<span class="word">Slide<span>take</span></span>';let o=document.querySelector("header .hdr-actions");o.insertBefore(a,o.firstChild),bt||(o.insertAdjacentHTML("beforeend",'<button class="btn" id="hdr-keys" title="Keyboard shortcuts (K)">\u2328 Keys</button><button class="btn" id="hdr-full" title="Fullscreen (F)">\u26F6 Fullscreen</button>'),document.getElementById("hdr-keys").onclick=()=>document.getElementById("help").classList.add("open"),document.getElementById("hdr-full").onclick=()=>ye(!K))}Z=Xr(location.pathname,location.search,location.hash),Un=Z.page==="pick"?"":Z.slide,E=null,I=Qr(U("slidetake:copy"))||Tc();window.addEventListener("popstate",()=>location.reload());he&&window.EventSource&&(new EventSource(he.events).onmessage=async e=>{if(!gr())return;let t=(JSON.parse(e.data).file||"").replace(/\\/g,"/");if(t===he.file){let a=await(await fetch(he.deck,{cache:"no-store"})).text();if(a===ne.value)return;ne.value=E.text=a,ut(!0);return}ie.querySelectorAll("img").forEach(a=>{let o=new URL(a.src);decodeURIComponent(o.pathname).endsWith("/"+t)&&(o.searchParams.set("t",String(Date.now())),a.src=o.href)})});(ja.get("edit")==="1"||Z.page==="edit"&&I&&ja.get("edit")!=="0")&&Ga();Ic().then(e=>(ne.value=e,Et(),Yn(ne.value),Qn(),document.fonts?document.fonts.ready:null)).then(()=>{u.forEach(Ua),$t(),j(u.has(Un)?Un:y[0],!0)})});var vr=` /* Every colour comes from these tokens. Slidetake's own is seafoam green: bright on zinc in dark mode,
|
|
1320
|
+
`+e,zo={};We=0,Ro=null;qe=document.getElementById("progress");qe.innerHTML="<b></b><i></i>";Re={start:0,timer:null};Kl=["x","y","xPercent","yPercent","scale","scaleX","scaleY","rotation","rotate","skewX","skewY"];bt=null;ge=null,mi=null,Te=!1;Ge=null;Ee=null;jo.addEventListener("click",e=>{let t=e.target.closest("circle");t&&!h.active&&j(t.dataset.id)});Oa=null;ie.addEventListener("input",()=>{if(Tr()){E.text=ie.value,clearTimeout(Oa),Oa=setTimeout(()=>{qc(ie.value),wt(!0)},300);return}E.kind!=="copy"&&!Wc()||(I.text=ie.value,Ot(),clearTimeout(Oa),Oa=setTimeout(()=>{ua(),wt(!0)},300))});document.querySelectorAll("#layout-toggle .seg-btn").forEach(e=>{e.addEventListener("click",()=>{e.dataset.mode!==J&&dr(e.dataset.mode)})});(function(){let e=new Map,t=0,a=!1,o=null,r=()=>{let[i,s]=[...e.values()];return Math.hypot(i.x-s.x,i.y-s.y)||1};H.addEventListener("pointerdown",i=>{i.pointerType==="mouse"&&i.button!==0||h.active||i.target.closest("a, pre, code, input, textarea")||(e.set(i.pointerId,{x:i.clientX,y:i.clientY}),t=0,a=!1,e.size===2&&(o={d:r(),zoom:z.zoom}))}),window.addEventListener("pointermove",i=>{let s=e.get(i.pointerId);if(!s)return;let l=i.clientX-s.x,c=i.clientY-s.y;e.set(i.pointerId,{x:i.clientX,y:i.clientY}),t+=Math.abs(l)+Math.abs(c),!a&&t>5&&(a=!0,sr(),H.classList.add("dragging")),a&&(e.size===2&&o?z.zoom=bi(o.zoom*r()/o.d):(z.x-=l/z.zoom,z.y-=c/z.zoom),vt())});let n=i=>{e.delete(i.pointerId),e.size<2&&(o=null),e.size||H.classList.remove("dragging")};window.addEventListener("pointerup",n),window.addEventListener("pointercancel",n),H.addEventListener("click",i=>{a&&(i.stopPropagation(),i.preventDefault(),a=!1)},!0)})();H.addEventListener("wheel",e=>{e.preventDefault(),!h.active&&wi(Math.exp(-e.deltaY*(e.ctrlKey?.01:.0015)),e.clientX,e.clientY)},{passive:!1});document.getElementById("nav-prev").onclick=()=>De(-1);document.getElementById("nav-next").onclick=()=>De(1);document.getElementById("btn-open").onclick=()=>document.getElementById("file-input").click();document.getElementById("file-input").addEventListener("change",e=>{let t=e.target.files[0];if(!t)return;let a=new FileReader;a.onload=()=>{hs("a copy of "+t.name)&&(I=ya(String(a.result),{kind:"file",name:t.name},{exported:!0}),ua(),ze=null,f=null,Uc())},a.readAsText(t),e.target.value=""});document.getElementById("btn-save").onclick=()=>{let e=new Blob([ie.value],{type:"text/markdown"}),t=document.createElement("a");t.href=URL.createObjectURL(e),t.download=(Ye[0]?nt(u.get(Ye[0]).title):"deck")+".md",t.click(),setTimeout(()=>URL.revokeObjectURL(t.href),1e3),E.kind==="copy"&&(I.exported=I.text,ua(),Ot())};document.getElementById("btn-reset").onclick=()=>{E.kind!=="copy"||ba(I)||confirm("Discard your edits and go back to "+Se(I.origin)+" as it was?")&&(I.text=I.originText,ua(),ie.value=I.text,f=null,wt(!0),Ot())};document.getElementById("btn-edit-toggle").onclick=oo;Do=document.querySelector("main"),ct=document.getElementById("editor-resizer"),_n=parseFloat(W("slidetake:editorWidth"));_n&&Ne.style.setProperty("--editor-w",_n+"px");ct.addEventListener("pointerdown",e=>{e.preventDefault(),ct.setPointerCapture(e.pointerId),Do.classList.add("resizing");let t=Do.getBoundingClientRect().right,a=r=>{let n=Math.round(Math.max(280,Math.min(window.innerWidth*.75,t-r.clientX)));Ne.style.setProperty("--editor-w",n+"px")},o=()=>{Do.classList.remove("resizing"),ct.removeEventListener("pointermove",a),U("slidetake:editorWidth",String(Ne.getBoundingClientRect().width))};ct.addEventListener("pointermove",a),ct.addEventListener("pointerup",o,{once:!0})});ct.addEventListener("dblclick",()=>{Ne.style.removeProperty("--editor-w");try{localStorage.removeItem("slidetake:editorWidth")}catch{}});document.getElementById("btn-mode").onclick=ai;document.getElementById("btn-present").onclick=()=>ve(!K);tc="https://cdn.jsdelivr.net/npm/obs-websocket-js@5.0.5/dist/obs-ws.min.js",Wn=["ArrowRight","PageDown"," ","ArrowDown","Enter"],Un=["ArrowLeft","PageUp","ArrowUp","r","R"],qn=["b","B","."],Y=document.getElementById("review"),Ut=document.getElementById("rec-countdown"),Go=document.getElementById("rec-paused"),Ua=document.getElementById("obs-host"),qa=document.getElementById("obs-port"),Ga=document.getElementById("obs-pass"),hr=document.getElementById("obs-remember"),Kt=document.getElementById("obs-status"),ne=null,Le=!1,Ve=null,pr=null,xi="",h={active:!1,withObs:!1,counting:!1,paused:!1,finishing:!1,t0:0,pauseAt:0,pausedMs:0,events:[],outputPath:null,browser:null},Qt=e=>new Promise(t=>setTimeout(t,e)),Zt=()=>Promise.race([new Promise(e=>requestAnimationFrame(()=>requestAnimationFrame(e))),Qt(100)]);ac="G-3S9FY4MQLS",ur=document.getElementById("analytics-dialog"),oc=()=>W("slidetake:analytics")!=="off";ur.querySelectorAll("[data-analytics]").forEach(e=>e.onclick=()=>rc(e.dataset.analytics==="on"));Si=document.getElementById("btn-analytics");Si.hidden=!/^(www\.)?slidetake\.com$/.test(location.hostname);Si.onclick=()=>{ki(),sa(ur)};document.querySelectorAll(".modal").forEach(e=>{e.addEventListener("click",t=>{(t.target===e||t.target.closest("[data-close]"))&&e.classList.remove("open")})});ic=e=>/^(localhost|127(\.\d+){3}|\[?::1\]?)$/i.test(e);lc="Run OBS on this computer and connect to localhost: a secure (https) page can't reach OBS at any other address.";document.getElementById("obs-connect").onclick=fr;hr.addEventListener("change",Ei);dc="https://cdn.jsdelivr.net/npm/mediabunny@1.64.0/+esm",pt=document.getElementById("rec-cam"),kt=document.getElementById("rec-mic"),St=document.getElementById("rec-quality"),Vo=document.getElementById("rec-meter"),ht=document.getElementById("rec-browser-check"),ut=document.getElementById("rec-wave"),pe=W("slidetake:rec-mode")||"",Pa="",de=null;Yo=0;Ci=document.getElementById("rec-cam-preview"),Ia=document.getElementById("rec-cam-none"),za=null,Ko=0;kt.onchange=()=>{U("slidetake:mic",kt.value),Va(),je()};pt.onchange=()=>{pc(pt.value),pt.value!=="none"&&oe&&(Cr(),at()),Bt()&&Ti(),je()};hc=()=>(R.pip||"none").toLowerCase()!=="none"||!!R.camera||[...u.values()].some(e=>e.camera),Li=()=>"slidetake:rec-cam:"+He();St.onchange=()=>{U("slidetake:quality",St.value),je()};et=()=>!(ke().ok&&(pe||"browser")==="browser");document.getElementById("btn-studio").onclick=()=>ea();gc=()=>!!pe||tt().takes.length>0||no().some(e=>e.key===He());document.getElementById("btn-record").onclick=()=>gr();Oi=e=>({width:e.w,height:e.h,aspectRatio:16/9,frameRate:Ht,resizeMode:"crop-and-scale"});Ke=!1;Gn=600;Fe="";Cc=e=>yn(e,Di),Mc=(e,t)=>vn(e,t,{input:e.outputPath||Fe||"recording.mov",outputName:He()+"-final.mp4",sectionOf:Di,loudness:Je()}),Fi=document.querySelectorAll(".rv-loud"),Je=()=>W("slidetake:loudness")!=="off",Ni=()=>Fi.forEach(e=>{e.setAttribute("aria-pressed",String(Je())),e.classList.toggle("on",Je())}),Jo=document.getElementById("rv-limiter"),aa=()=>W("slidetake:limiter")==="on",Hi=()=>{Jo.setAttribute("aria-pressed",String(aa())),Jo.classList.toggle("on",aa())};Hi();Jo.onclick=()=>{U("slidetake:limiter",aa()?"off":"on"),Hi()};ji=()=>W("slidetake:mic-sound")==="raw"?"raw":"voice",_i=e=>({...e?{deviceId:{ideal:e}}:{},echoCancellation:!1,autoGainControl:!1,noiseSuppression:ji()==="voice"}),Wi=document.querySelectorAll("[data-sound]"),Ui=()=>Wi.forEach(e=>{let t=e.dataset.sound===ji();e.classList.toggle("active",t),e.setAttribute("aria-checked",String(t))});Ui();Wi.forEach(e=>e.onclick=()=>{U("slidetake:mic-sound",e.dataset.sound),Ui(),de&&Va()});Ni();Fi.forEach(e=>e.onclick=()=>{U("slidetake:loudness",Je()?"off":"on"),Ni(),N&&io()});N=null,Z=null,k=document.getElementById("rv-video"),Wt=document.getElementById("rv-now");Ra=-1,qi=()=>{let e=La(g,Be).length;return e?e+"/"+g.length+" slide"+(e===1?"":"s")+" up for a take":""};Vi="";document.getElementById("rv-chapters").onclick=e=>Ki(e.currentTarget,Vi);document.getElementById("rv-ffmpeg-copy").onclick=e=>{!N||!N.events.length||(Ki(e.currentTarget,Mc(N,document.getElementById("rv-mode").value)),B("Copied the ffmpeg command: run it in a terminal, in the folder with "+(st(N.outputPath)||"the recording")+"."))};Da=new Map,Fo=0;Ja=document.getElementById("rv-fps");Ja.onchange=()=>{N&&(N.fps=parseFloat(Ja.value),wr(N),io())};$a=null;k.addEventListener("timeupdate",()=>{if(!Z)return;let e=Z.ranges[Z.i];if(k.currentTime*1e3<e.end)return;if(Z.i++,Z.i>=Z.ranges.length){k.pause(),Z=null,B("");return}let t=Z.ranges[Z.i];k.currentTime=t.start/1e3,B("\u25B6 "+t.title)});$i=document.getElementById("rv-play-final"),ft=null;$i.onclick=()=>{if(!N)return;if(!N.inBrowser){Xa(Nt(N).map(a=>({start:a.start,end:a.end,title:a.title})));return}if(F&&!F.single){k.paused?k.play().catch(()=>{}):k.pause();return}let e=jt(N),t=Math.max(0,ft?e.findIndex(a=>a.id===ft):0);ft=null,so(e.slice(t))};k.addEventListener("play",xr);k.addEventListener("pause",()=>{F&&F.single&&k.currentTime<F.parts[0].keep-.05&&(ft=F.parts[0].id,B("Preview starts from "+F.parts[0].title.replace(/ · take \d+$/,"")+".")),xr()});F=null;k.addEventListener("timeupdate",()=>{F&&k.currentTime>=F.parts[F.i].keep&&Qi()});k.addEventListener("ended",()=>{F&&Qi()});Qa=document.getElementById("rv-render-btn");Qa.onclick=()=>es(!1);Zi=0,Ue=e=>{clearTimeout(Zi),e?Qa.textContent=e:Qa.innerHTML='\u2193 <span><u class="key">D</u>ownload</span>'},No=e=>e.where?"\u201C"+e.where+"\u201D as "+e.name:"your downloads as "+e.name;Bc=e=>{let t=a=>String(a).padStart(2,"0");return e.getFullYear()+"-"+t(e.getMonth()+1)+"-"+t(e.getDate())+" "+t(e.getHours())+"-"+t(e.getMinutes())+"-"+t(e.getSeconds())};document.getElementById("rv-folder-change").onclick=async()=>{try{let e=await ts(!0);e&&B("Videos now go to "+e.name+".")}catch{}};O=null,$o="",Yn=null,Be=new Set,as=()=>"slidetake:board:"+He();da=()=>U(as(),JSON.stringify(O)),Oc=e=>{let t=u.get(e);return t?Tn(t.title+`
|
|
1321
|
+
`+t.html):""},lo=()=>Ln(g,e=>({title:u.get(e).title,fp:Oc(e)}));$e=document.getElementById("rv-setup-btn"),Kn=document.getElementById("setup-note"),Bt=()=>Y.classList.contains("setup-view");new MutationObserver(()=>{Y.classList.contains("open")||ho()}).observe(Y,{attributes:!0,attributeFilter:["class"]});$e.onclick=()=>{Bt()?ho():co()};document.getElementById("setup-record").onclick=()=>{la(),pe||(pe=et()?"obs":"browser",U("slidetake:rec-mode",pe)),gr()};Y.addEventListener("click",e=>{(e.target===Y||e.target.closest("[data-close]"))&&ro()});Fa=(()=>{let e=(navigator.userAgentData&&navigator.userAgentData.brands||[]).map(a=>a.brand).filter(a=>!/chromium|not.?a.?brand/i.test(a));if(e.length)return e[0].replace(/^(Google|Microsoft) /,"");let t=navigator.userAgent;return/Firefox\//.test(t)?"Firefox":/Edg\//.test(t)?"Edge":/OPR\//.test(t)?"Opera":/Chrome\//.test(t)?"Chrome":/Safari\//.test(t)?"Safari":"this browser"})();document.querySelectorAll(".browser-name").forEach(e=>{e.textContent=Fa});document.getElementById("rv-rec").onclick=()=>{if(!et()){Ka("browser",La(g,Be));return}if(Le){Ka("obs");return}Xo({note:"Connect to OBS first: OBS \u2192 Connect."})};dt=document.getElementById("rv-pro");dt.onclick=()=>{ke().ok&&fc(et()?"browser":"obs")};document.querySelectorAll(".rv-purge .rv-menu button").forEach(e=>e.addEventListener("click",()=>{e.closest("details").open=!1}));document.getElementById("rv-clean-unused").onclick=async()=>{let{rows:e}=os(),t=new Set(e.map(o=>o.pick).filter(Boolean)),a=O.takes.filter(o=>!t.has(o.uid));if(!a.length){B("Every take is in use.");return}confirm("Purge "+a.length+" take"+(a.length===1?"":"s")+" the video doesn\u2019t use (earlier attempts and outdated takes)?")&&(await Rc(a),B("Purged "+a.length+" unused take"+(a.length===1?"":"s")+"."))};document.getElementById("rv-clean").onclick=async()=>{if(!O.takes.length||!confirm("Purge all "+O.takes.length+" takes of this deck from this browser? Download the video first if you need it."))return;let e=new Set(O.takes.map(t=>t.clip.split("/")[0]));O.takes=[],O.picks={},da();for(let t of e)await vr(t);k.src&&(URL.revokeObjectURL(k.src),k.removeAttribute("src"),k.load()),F=null,At(),B("All takes purged."),Qe()};document.getElementById("rv-clean-every").onclick=async()=>{let e,t=0,a=0;try{e=await navigator.storage.getDirectory()}catch{return}let o=async s=>{for await(let l of s.values())l.kind==="directory"?await o(l):(a++,t+=(await l.getFile()).size)};try{await o(await e.getDirectoryHandle("slidetake-takes"))}catch{}let r=[];try{for(let s=0;s<localStorage.length;s++){let l=localStorage.key(s);l&&l.startsWith("slidetake:board:")&&r.push(l)}}catch{}let n=r.filter(s=>{try{return JSON.parse(localStorage.getItem(s)||"{}").takes.length>0}catch{return!1}}).length;if(!a){B("No takes are kept in this browser.");return}let i=t>1e9?(t/1e9).toFixed(1)+" GB":Math.max(1,Math.round(t/1e6))+" MB";if(confirm("Purge "+i+" of takes ("+a+" file"+(a===1?"":"s")+") from "+(n||"no")+" deck"+(n===1?"":"s")+" and any left behind? Every deck loses its takes; download the videos you need first.")){try{await e.removeEntry("slidetake-takes",{recursive:!0})}catch{}r.forEach(s=>{try{localStorage.removeItem(s)}catch{}}),U("slidetake:sessions",JSON.stringify(no().map(s=>s.inBrowser?{...s,cleaned:!0}:s))),O=null,$o="",tt(),Da.clear(),k.src&&(URL.revokeObjectURL(k.src),k.removeAttribute("src"),k.load()),F=null,At(),Qe(),B("Purged "+i+" of takes from every deck.")}};qt=null,Qo=0,Zo=!1;k.addEventListener("error",async()=>{if(k.getAttribute("src")){if(qt&&Qo<5){Qo++,B("Reloading "+Fe+" (OBS was still finishing it)\u2026"),await new Promise(e=>setTimeout(e,1500));try{ha(await po(qt),qt,!0);return}catch{}}B(qt?"Chrome cannot play "+Fe+". In OBS set Recording Format to Hybrid MP4 (or MP4) with H.264 video; the ffmpeg command still works with this file.":"Could not play "+(Fe||"this file")+". If OBS was still finishing it when you opened it, open it again; if it still fails, set OBS to Hybrid MP4 (or MP4) with H.264 video.",{warn:!0})}});Gt=document.getElementById("rv-file-input");Gt.addEventListener("change",()=>{Gt.files[0]&&ha(Gt.files[0]),Gt.value=""});document.getElementById("rv-open").onclick=async()=>{if(!window.showOpenFilePicker)return Gt.click();try{let[e]=await window.showOpenFilePicker({id:"obs-recordings",types:[{description:"Recordings",accept:{"video/*":[".mov",".mp4",".m4v",".mkv",".webm"]}}]});B("Opening "+e.name+"\u2026"),ha(await po(e),e)}catch(e){(!e||e.name!=="AbortError")&&B("Could not open that file.",{warn:!0})}};is=document.getElementById("rv-folder");window.showDirectoryPicker||(is.style.display="none");is.onclick=async()=>{let e=N&&st(N.outputPath);try{let t=await window.showDirectoryPicker({id:"obs-recordings",mode:"read"});if(ns("obs-folder",t),!e){B("Folder remembered. This session has no file name from OBS; open the file instead.");return}let a=await t.getFileHandle(e);ha(await po(a),a)}catch{}};nc()&&new URLSearchParams(location.search).get("obs")&&fr();Ce=document.getElementById("btn-camera"),Vt=document.getElementById("pip-msg"),Na=null,ss=P.querySelector("span");Nc='<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linejoin="round" aria-hidden="true"><rect x="2" y="6" width="14" height="12" rx="2"/><path d="M16 10.5 22 7v10l-6-3.5z"/></svg>';Ce.onclick=()=>pa(re);Mr();Jn=null;window.addEventListener("pointermove",ds);document.addEventListener("fullscreenchange",()=>{document.fullscreenElement||(h.active?Et("Stopped: the browser left fullscreen"):K&&ve(!1))});be=document.getElementById("help");new MutationObserver(()=>cs(document.getElementById("btn-keys"),be.classList.contains("open"))).observe(be,{attributes:!0,attributeFilter:["class"]});new MutationObserver(()=>{let e=Y.classList.contains("open");document.getElementById("btn-studio").classList.toggle("active",e),!e&&!k.paused&&k.pause()}).observe(Y,{attributes:!0,attributeFilter:["class"]});document.getElementById("btn-keys").onclick=()=>be.classList.add("open");document.getElementById("help-close").onclick=()=>be.classList.remove("open");be.addEventListener("click",e=>{e.target===be&&be.classList.remove("open")});window.addEventListener("keydown",e=>{if(e.key==="F5"){e.preventDefault(),h.active||ea();return}if(h.active){wc(e);return}if(document.querySelector(".modal.open")){let o=Y.classList.contains("open")&&Bt();if(e.key==="Escape")la();else if(Y.classList.contains("open")&&!e.metaKey&&!e.ctrlKey&&!e.altKey&&!/^(INPUT|TEXTAREA|SELECT)$/.test(document.activeElement?.tagName||"")){let r=e.key.toLowerCase(),n=r==="r"?o?"setup-record":"rv-rec":o?"":r==="p"?"rv-play-final":r==="d"?et()?"rv-ffmpeg-copy":"rv-render-btn":"",i=n?document.getElementById(n):null;i&&!i.disabled&&(e.preventDefault(),i.click())}return}let t=document.activeElement&&document.activeElement.tagName;if(t==="TEXTAREA"||t==="INPUT"||e.metaKey||e.ctrlKey||e.altKey)return;if(be.classList.contains("open")){/^(Escape|k|K|\?|\/)$/.test(e.key)&&be.classList.remove("open");return}let a=e.key;a==="ArrowRight"||a===" "||a==="PageDown"?(e.preventDefault(),De(1)):a==="ArrowLeft"||a==="PageUp"?(e.preventDefault(),De(-1)):a==="ArrowDown"?(e.preventDefault(),Zl()):a==="ArrowUp"?(e.preventDefault(),Ql()):a==="Home"?g.length&&j(g[0]):a==="End"?g.length&&j(g[g.length-1]):a==="o"||a==="O"?Xl():a==="e"||a==="E"?oo():a==="f"||a==="F"||a==="p"||a==="P"?ve(!K):a==="r"||a==="R"?gr():a==="s"||a==="S"?ea():/^[1-4]$/.test(a)?dr(rr[+a-1]):a==="c"||a==="C"?pa(re):a==="v"||a==="V"?ll():a==="l"||a==="L"?ai():a==="+"||a==="="?jn(1):a==="-"||a==="_"?jn(-1):a==="?"||a==="/"||a==="k"||a==="K"?be.classList.add("open"):a==="Escape"&&!yi()&&K&&ve(!1)});window.addEventListener("hashchange",()=>{let{data:e,slide:t}=ga(location.hash);if(e&&!(E&&E.kind==="share"&&e===E.data)){location.reload();return}t&&t!==f&&u.has(t)&&j(t)});$n="";new ResizeObserver(()=>{let e=H.clientWidth+"x"+H.clientHeight;e!==$n&&($n=e,vt(),xe(!0))}).observe(H);gt=document.createElement("div");gt.id="toast";gt.setAttribute("role","status");document.body.appendChild(gt);Xn=null;Hc=document.getElementById("open-dialog"),tr=document.getElementById("open-url"),ar=document.getElementById("open-error");document.getElementById("btn-load").onclick=()=>{ar.hidden=!0,sa(Hc),tr.focus(),tr.select()};document.getElementById("open-form").onsubmit=e=>{e.preventDefault();let t=on(tr.value);if(!t){ar.textContent="That doesn't look like a link.",ar.hidden=!1;return}location.href=er(t)};document.getElementById("btn-share").onclick=async()=>{let{link:e,inside:t}=await jc(f&&f!==g[0]?f:""),a=t?"Link copied, with the whole deck inside it ("+(e.length/1024).toFixed(1)+" KB)"+(e.length>8e3?". Some chat apps cut long links short: a GitHub file or gist makes a shorter one.":"."):"Link copied.";try{await navigator.clipboard.writeText(e),oa(a,5e3)}catch{prompt("Copy this link:",e)}E.kind==="copy"&&(I.exported=I.text,ua(),Ot())};Qn=W("slidetake:layout");J=rr.includes(Qn)?Qn:"path";document.querySelectorAll("#layout-toggle .seg-btn").forEach(e=>e.classList.toggle("active",e.dataset.mode===J));Za=new URLSearchParams(location.search);rr.includes(Za.get("layout"))&&(J=Za.get("layout"),document.querySelectorAll("#layout-toggle .seg-btn").forEach(e=>e.classList.toggle("active",e.dataset.mode===J)));if(_){let e=(Array.isArray(_.trail)?_.trail:_.back?[_.back]:[]).filter(r=>r&&r.label),t=document.querySelector("header .brand");e.length&&(t.innerHTML='<nav class="trail" aria-label="Site">'+e.map((r,n)=>(n?'<span class="sep" aria-hidden="true">|</span>':"")+(r.url?'<a href="'+A(r.url)+'">'+A(r.label)+"</a>":"<span>"+A(r.label)+"</span>")).join("")+"</nav>");let a=document.createElement("a");a.id="credit",a.href="https://slidetake.com",a.target="_blank",a.rel="noopener",a.title="Made with Slidetake",a.setAttribute("aria-label","Made with Slidetake"),a.innerHTML=or+'<span class="word">Slide<span>take</span></span>';let o=document.querySelector("header .hdr-actions");o.insertBefore(a,o.firstChild),Ze||(o.insertAdjacentHTML("beforeend",'<button class="btn" id="hdr-keys" title="Keyboard shortcuts (K)">\u2328 Keys</button><button class="btn" id="hdr-full" title="Fullscreen (F)">\u26F6 Fullscreen</button>'),document.getElementById("hdr-keys").onclick=()=>document.getElementById("help").classList.add("open"),document.getElementById("hdr-full").onclick=()=>ve(!K))}ee=cn(location.pathname,location.search,location.hash),Zn=ee.page==="pick"?"":ee.slide,E=null,I=dn(W("slidetake:copy"))||_c();window.addEventListener("popstate",()=>location.reload());he&&window.EventSource&&(new EventSource(he.events).onmessage=async e=>{if(!Tr())return;let t=(JSON.parse(e.data).file||"").replace(/\\/g,"/");if(t===he.file){let a=await(await fetch(he.deck,{cache:"no-store"})).text();if(a===ie.value)return;ie.value=E.text=a,wt(!0);return}se.querySelectorAll("img").forEach(a=>{let o=new URL(a.src);decodeURIComponent(o.pathname).endsWith("/"+t)&&(o.searchParams.set("t",String(Date.now())),a.src=o.href)})});(Za.get("edit")==="1"||ee.page==="edit"&&I&&Za.get("edit")!=="0")&&oo();Vc().then(e=>(ie.value=e,Ot(),ri(ie.value),ci(),document.fonts?document.fonts.ready:null)).then(()=>{u.forEach(to),ra(),j(u.has(Zn)?Zn:g[0],!0)})});var Ar=` /* Every colour comes from these tokens. Slidetake's own is seafoam green: bright on zinc in dark mode,
|
|
1321
1322
|
deep on white in light mode. A host page passes its own (window.SLIDETAKE.colors) and a deck can carry
|
|
1322
1323
|
its own (accent: in its top block); see applyColors in app.js. */
|
|
1323
1324
|
:root{
|
|
@@ -1667,6 +1668,17 @@ EOF
|
|
|
1667
1668
|
@media (max-width:560px){ .modal .fields{grid-template-columns:1fr;} }
|
|
1668
1669
|
/* Studio, beside the Editor: an accent dot (red is for \u25CF Record itself); lit, like the Editor, while open */
|
|
1669
1670
|
#btn-studio .rec-dot{color:var(--accent);}
|
|
1671
|
+
/* the key that does it, its letter in the accent: Keys, Camera, Record, Fullscreen, Editor, Studio */
|
|
1672
|
+
u.key{text-decoration:none;color:var(--accent);font-weight:600;}
|
|
1673
|
+
/* \u25CF Record looks the same in the bottom bar and in Studio: a red dot, plain text, the R in the accent */
|
|
1674
|
+
/* \u25CF Record looks the same in the bottom bar and in Studio: like the buttons beside it, with a red dot and
|
|
1675
|
+
its R in the accent; on hover it fills red, dot, text and R in white */
|
|
1676
|
+
#btn-record .rec-dot, #rv-rec .rec-dot, #setup-record .rec-dot{color:#ef4444;}
|
|
1677
|
+
.btn.rec#rv-rec, .btn.rec#setup-record{color:var(--text);}
|
|
1678
|
+
#navbar #btn-record:hover, .btn.rec#rv-rec:hover:not(:disabled), .btn.rec#setup-record:hover{background:#dc2626;border-color:#dc2626;color:#fff;}
|
|
1679
|
+
#btn-record:hover .rec-dot, #btn-record:hover u.key, #rv-rec:hover:not(:disabled) .rec-dot, #rv-rec:hover:not(:disabled) u.key,
|
|
1680
|
+
#setup-record:hover .rec-dot, #setup-record:hover u.key{color:#fff;}
|
|
1681
|
+
@media (pointer:coarse){ #btn-record{display:none;} }
|
|
1670
1682
|
/* phones and tablets can't record */
|
|
1671
1683
|
@media (pointer:coarse){ #btn-studio{display:none;} }
|
|
1672
1684
|
/* the bottom bar: Keys, Camera, Fullscreen, each in the accent while it is on */
|
|
@@ -1685,6 +1697,8 @@ EOF
|
|
|
1685
1697
|
#review.in-browser #rv-novideo{display:none !important;}
|
|
1686
1698
|
/* the takes screen records in this browser, or with OBS: each mode's own controls */
|
|
1687
1699
|
#review.obs .for-browser, #review:not(.obs) .for-obs{display:none !important;}
|
|
1700
|
+
/* Studio's dialog shows Studio or its Setup view, not both */
|
|
1701
|
+
#review:not(.setup-view) #rv-setup-view, #review.setup-view .rv-grid{display:none;}
|
|
1688
1702
|
#rec-countdown{
|
|
1689
1703
|
position:fixed;inset:0;z-index:70;display:none;align-items:center;justify-content:center;flex-direction:column;gap:14px;
|
|
1690
1704
|
background:rgba(4,7,13,.9);font-family:var(--display);color:var(--accent);
|
|
@@ -1722,18 +1736,32 @@ EOF
|
|
|
1722
1736
|
.rv-none{font-size:12px;color:var(--text-muted);font-style:italic;}
|
|
1723
1737
|
/* Recording setup: opened from the \u2699 Setup button at the top right, shown under the title */
|
|
1724
1738
|
.modal .rv-setup-btn[aria-expanded="true"]{border-color:var(--accent);color:var(--accent);background:color-mix(in srgb, var(--accent) 10%, transparent);}
|
|
1725
|
-
|
|
1726
|
-
|
|
1727
|
-
#rv-setup
|
|
1739
|
+
/* Setup, a view of Studio's dialog */
|
|
1740
|
+
.setup-note{margin:0 0 10px;font-size:13px;color:var(--accent);}
|
|
1741
|
+
#rv-setup{margin:8px 0 0;}
|
|
1742
|
+
/* the chosen camera, live, as a recording would see it (mirrored like the camera box), and the mic's waveform */
|
|
1743
|
+
.setup-cam{position:relative;aspect-ratio:16/9;background:#000;border-radius:8px;overflow:hidden;border:1px solid var(--panel-line);}
|
|
1744
|
+
.setup-cam video{position:absolute;inset:0;width:100%;height:100%;object-fit:cover;transform:scaleX(-1);}
|
|
1745
|
+
.setup-cam span{position:absolute;inset:0;display:flex;align-items:center;justify-content:center;font-size:12px;color:#a1a1aa;}
|
|
1746
|
+
.setup-cam span[hidden]{display:none;}
|
|
1747
|
+
.setup-wave{display:block;width:100%;height:60px;border-radius:8px;border:1px solid var(--panel-line);
|
|
1748
|
+
background:color-mix(in srgb, var(--accent) 5%, transparent);}
|
|
1749
|
+
.setup-actions{display:flex;justify-content:flex-start;gap:8px;margin-top:16px;}
|
|
1728
1750
|
#review h2.rv-brand{display:flex;align-items:center;gap:8px;color:var(--text);}
|
|
1729
1751
|
#review h2.rv-brand .logo{width:22px;height:22px;fill:var(--accent);flex:none;}
|
|
1730
1752
|
#review h2.rv-brand .word > span{color:var(--accent);}
|
|
1753
|
+
/* Slidetake Studio, Pro in pro mode, / Settings in the setup view, and the size as a chip */
|
|
1754
|
+
#review h2 .rv-pro-tag{color:var(--accent);}
|
|
1755
|
+
#review h2 .rv-settings-tag{color:var(--text-muted);font-weight:500;}
|
|
1756
|
+
#review:not(.setup-view) h2 .rv-settings-tag, #review:not(.setup-view) #rv-pro{display:none;}
|
|
1757
|
+
/* in Setup, \u2190 Back and Pro only: Back returns to Studio, which has \u2715 Close */
|
|
1758
|
+
#review.setup-view .panel-actions .close{display:none;}
|
|
1759
|
+
#review h2 .rv-size:empty{display:none;}
|
|
1760
|
+
#review h2 .rv-size{font-family:var(--mono);font-size:11px;font-weight:600;color:var(--text-muted);border:1px solid var(--panel-line);border-radius:6px;padding:2px 7px;margin-left:4px;}
|
|
1731
1761
|
.rv-using{align-self:center;max-width:34vw;font-family:var(--mono);font-size:12px;color:var(--text-muted);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;}
|
|
1732
1762
|
#review h2{padding-right:calc(34vw + 200px);}
|
|
1733
1763
|
@media (max-width:900px){ .rv-using{display:none;} #review h2{padding-right:190px;} }
|
|
1734
1764
|
/* three sections side by side: Camera, Microphone, Video; Use OBS at the top right */
|
|
1735
|
-
.rv-setup-head{display:flex;align-items:center;justify-content:space-between;gap:10px;margin-bottom:12px;padding-bottom:10px;border-bottom:1px solid var(--panel-line);}
|
|
1736
|
-
.rv-setup-head h4{margin:0;font-family:var(--display);font-size:13px;color:var(--text-muted);}
|
|
1737
1765
|
.rv-setup-cols{display:grid;grid-template-columns:repeat(3, minmax(0, 1fr));gap:18px;}
|
|
1738
1766
|
.rv-setup-cols section{display:flex;flex-direction:column;gap:8px;min-width:0;}
|
|
1739
1767
|
.rv-setup-cols h4{margin:0;font-family:var(--display);font-size:13px;color:var(--text);}
|
|
@@ -1969,7 +1997,7 @@ EOF
|
|
|
1969
1997
|
html.embed.no-record #navbar{display:flex;}
|
|
1970
1998
|
html.embed.no-record #navbar > :not(.touch-only){display:none !important;}
|
|
1971
1999
|
}
|
|
1972
|
-
html.no-record #btn-camera, html.no-record #btn-studio, html.no-record #pip, html.no-record #help tr.rec{display:none !important;}
|
|
2000
|
+
html.no-record #btn-camera, html.no-record #btn-studio, html.no-record #btn-record, html.no-record #pip, html.no-record #help tr.rec{display:none !important;}
|
|
1973
2001
|
/* the logo written into a heading: #  Slidetake */
|
|
1974
2002
|
.node .body :is(h1,h2) img[src$="favicon.svg"]{height:1em;width:auto;vertical-align:-.12em;margin-right:.25em;display:inline;}
|
|
1975
2003
|
#brand .st-mark{display:inline-flex;align-items:center;gap:8px;font-family:var(--display);font-weight:700;font-size:20px;color:var(--text);}
|
|
@@ -2001,6 +2029,12 @@ EOF
|
|
|
2001
2029
|
/* full: the camera takes the whole stage, under the brand and the controls */
|
|
2002
2030
|
/* it also swallows clicks, so a click can't land on the hidden cards behind it */
|
|
2003
2031
|
#pip.full{inset:0;width:100% !important;height:100%;aspect-ratio:auto;border-radius:0;z-index:9;pointer-events:auto;}
|
|
2032
|
+
/* behind: the camera fills the frame under the slides, which stay on top as cards; the stage's dotted
|
|
2033
|
+
background makes way so the camera shows around them */
|
|
2034
|
+
#pip.full.behind{z-index:0;pointer-events:none;box-shadow:none;}
|
|
2035
|
+
#stage-wrap.cam-behind #stage{z-index:1;background:transparent;}
|
|
2036
|
+
/* only the slide being presented shows over the camera: no neighbouring cards or lines around it */
|
|
2037
|
+
#stage-wrap.cam-behind div.node:not(.current), #stage-wrap.cam-behind #connectors{opacity:0;transition:opacity .3s;}
|
|
2004
2038
|
/* while presenting the box is empty so the camera overlay sits on plain background */
|
|
2005
2039
|
/* while presenting, the empty box stays as a faint guide for lining up a camera overlay */
|
|
2006
2040
|
body.presenting #pip{border-color:color-mix(in srgb, var(--accent-teal) 30%, transparent);background:none;}
|
|
@@ -2047,7 +2081,7 @@ EOF
|
|
|
2047
2081
|
#minimap{display:none;}
|
|
2048
2082
|
#navbar .lbl{display:none;}
|
|
2049
2083
|
}
|
|
2050
|
-
`;var
|
|
2084
|
+
`;var Br=`
|
|
2051
2085
|
<noscript>
|
|
2052
2086
|
<style>#deck-text{position:static;width:auto;height:auto;overflow:visible;clip:auto;white-space:normal;max-width:760px;margin:24px auto;padding:0 16px;}#deck-text img{max-width:100%;height:auto;}#deck-text :is(h1,h2) img{height:1em;width:auto;vertical-align:-.12em;}#deck-text table{border-collapse:collapse;}#deck-text :is(td,th){border:1px solid #3f3f46;padding:4px 8px;}#deck-text a{color:#29b685;}</style>
|
|
2053
2087
|
<p class="deck-text-note">Slidetake needs JavaScript to present and record decks. Here is this page as text; the source is on <a href="https://github.com/slidetake/slidetake">GitHub</a>.</p>
|
|
@@ -2073,8 +2107,8 @@ EOF
|
|
|
2073
2107
|
</div>
|
|
2074
2108
|
<button class="btn icon" id="btn-analytics" title="Privacy & analytics" aria-label="Privacy & analytics" hidden><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2"/></svg></button>
|
|
2075
2109
|
<button class="btn icon" id="btn-mode" title="Light / dark (L)" aria-label="Light / dark"></button>
|
|
2076
|
-
<button class="btn" id="btn-edit-toggle" title="Editor: write, open, share (E)">\u270E
|
|
2077
|
-
<button class="btn" id="btn-studio" title="Slidetake Studio:
|
|
2110
|
+
<button class="btn" id="btn-edit-toggle" title="Editor: write, open, share (E)">\u270E <span><u class="key">E</u>ditor</span></button>
|
|
2111
|
+
<button class="btn" id="btn-studio" title="Slidetake Studio: pick takes, redo slides, download (S)"><span class="rec-dot" aria-hidden="true">\u25CF</span> <span><u class="key">S</u>tudio</span></button>
|
|
2078
2112
|
</div>
|
|
2079
2113
|
</header>
|
|
2080
2114
|
|
|
@@ -2087,11 +2121,12 @@ EOF
|
|
|
2087
2121
|
</div>
|
|
2088
2122
|
<div id="breadcrumbs"></div>
|
|
2089
2123
|
<div id="navbar">
|
|
2090
|
-
<button id="btn-keys" title="Keyboard shortcuts (K)" aria-pressed="false">\u2328<span class="lbl">
|
|
2124
|
+
<button id="btn-keys" title="Keyboard shortcuts (K)" aria-pressed="false">\u2328<span class="lbl"> <u class="key">K</u>eys</span></button>
|
|
2091
2125
|
<button id="nav-prev" class="touch-only" title="Previous (\u2190)" aria-label="Previous">\u2190</button>
|
|
2092
2126
|
<button id="nav-next" class="touch-only" title="Next (\u2192)" aria-label="Next">\u2192</button>
|
|
2093
2127
|
<button id="btn-camera" title="Camera (C)" aria-pressed="false"></button>
|
|
2094
|
-
<button id="btn-
|
|
2128
|
+
<button id="btn-record" title="Record (R): the slides without a take, or from this slide on when every slide has one"><span class="rec-dot" aria-hidden="true">\u25CF</span><span class="lbl"> <u class="key">R</u>ecord</span></button>
|
|
2129
|
+
<button id="btn-present" title="Fullscreen (F)" aria-pressed="false">\u26F6<span class="lbl"> <u class="key">F</u>ullscreen</span></button>
|
|
2095
2130
|
</div>
|
|
2096
2131
|
<div id="progress" aria-hidden="true"></div>
|
|
2097
2132
|
<div id="minimap"><div class="mm-label" id="mm-label">map</div><svg id="mm-svg" width="180" height="130"></svg></div>
|
|
@@ -2122,19 +2157,23 @@ EOF
|
|
|
2122
2157
|
<button class="btn close" id="help-close">\u2715 Close</button>
|
|
2123
2158
|
<h2>Keys</h2>
|
|
2124
2159
|
<table class="keys">
|
|
2125
|
-
<tr><td><kbd>\u2192</kbd> <kbd>\u2190</kbd> <kbd>Space</kbd></td><td>next / previous step</td></tr>
|
|
2160
|
+
<tr><td><kbd>\u2192</kbd> <kbd>\u2190</kbd> <kbd>Space</kbd></td><td>next / previous step (a clicker's <kbd>PgDn</kbd> <kbd>PgUp</kbd> too)</td></tr>
|
|
2161
|
+
<tr><td><kbd>Home</kbd> <kbd>End</kbd></td><td>first / last slide</td></tr>
|
|
2126
2162
|
<tr><td><kbd>\u2193</kbd> <kbd>\u2191</kbd></td><td>first child / parent</td></tr>
|
|
2127
2163
|
<tr><td><kbd>O</kbd></td><td>the whole map; <kbd>O</kbd> or <kbd>Esc</kbd> goes back</td></tr>
|
|
2128
2164
|
<tr><td><kbd>1</kbd>\u2013<kbd>4</kbd></td><td>focus, path, radial, tree</td></tr>
|
|
2129
2165
|
<tr><td><kbd>F</kbd></td><td>fullscreen; <kbd>F</kbd> or <kbd>Esc</kbd> leaves</td></tr>
|
|
2130
|
-
<tr><td><kbd>+</kbd> <kbd>\u2212</kbd></td><td>bigger / smaller slides</td></tr>
|
|
2166
|
+
<tr><td><kbd>+</kbd> <kbd>\u2212</kbd></td><td>bigger / smaller slides (<kbd>=</kbd> works for <kbd>+</kbd>)</td></tr>
|
|
2131
2167
|
<tr class="edit"><td><kbd>E</kbd></td><td>editor: write, open, share</td></tr>
|
|
2132
2168
|
<tr><td><kbd>L</kbd></td><td>light / dark</td></tr>
|
|
2133
|
-
<tr class="rec"><td><kbd>C</kbd> <kbd>V</kbd
|
|
2134
|
-
<tr><td><kbd>
|
|
2169
|
+
<tr class="rec"><td><kbd>C</kbd> <kbd>V</kbd></td><td>camera, camera layouts</td></tr>
|
|
2170
|
+
<tr class="rec"><td><kbd>R</kbd> <kbd>S</kbd></td><td>record (the slides without a take), Studio</td></tr>
|
|
2171
|
+
<tr class="rec"><td><kbd>\u2190</kbd> <kbd>B</kbd> <kbd>Esc</kbd></td><td>while recording: take the slide again, pause, stop</td></tr>
|
|
2172
|
+
<tr class="rec"><td><kbd>P</kbd> <kbd>D</kbd></td><td>in Studio: preview, download</td></tr>
|
|
2173
|
+
<tr><td><kbd>K</kbd> <kbd>/</kbd> <kbd>?</kbd></td><td>this card; again or <kbd>Esc</kbd> closes it</td></tr>
|
|
2135
2174
|
</table>
|
|
2136
2175
|
<p>Drag to pan, scroll or pinch to zoom, click a card to fly to it.</p>
|
|
2137
|
-
<p><a href="https://slidetake.com/docs" target="_blank" rel="noopener">The docs \u2192</a>
|
|
2176
|
+
<p><a href="https://slidetake.com/docs" target="_blank" rel="noopener">The docs \u2192</a> write, present, record, edit and share, step by step.</p>
|
|
2138
2177
|
</div>
|
|
2139
2178
|
</div>
|
|
2140
2179
|
|
|
@@ -2197,98 +2236,93 @@ EOF
|
|
|
2197
2236
|
<div class="panel xwide">
|
|
2198
2237
|
<div class="panel-actions">
|
|
2199
2238
|
<span class="rv-using" id="rv-using"></span>
|
|
2200
|
-
<button class="btn
|
|
2239
|
+
<button class="btn toggle" id="rv-pro" aria-pressed="false" title="Pro mode: record with OBS">Pro</button>
|
|
2240
|
+
<button class="btn rv-setup-btn" id="rv-setup-btn" aria-expanded="false" aria-controls="rv-setup-view">\u2699 Setup</button>
|
|
2201
2241
|
<button class="btn close" data-close>\u2715 Close</button>
|
|
2202
2242
|
</div>
|
|
2203
|
-
<h2 id="rv-title" class="rv-brand"><svg class="logo" viewBox="0 0 64 64" aria-hidden="true"><path d="M 10 8 H 38 C 41.3 8 44 10.7 44 14 V 18 H 22 C 16.5 18 12 22.5 12 28 V 36 H 10 C 6.7 36 4 33.3 4 30 V 14 C 4 10.7 6.7 8 10 8 Z" opacity="0.4"/><path fill-rule="evenodd" d="M 22 22 H 54 C 57.3 22 60 24.7 60 28 V 50 C 60 53.3 57.3 56 54 56 H 22 C 18.7 56 16 53.3 16 50 V 28 C 16 24.7 18.7 22 22 22 Z M 26 34 C 28.2 34 30 32.2 30 30 C 30 27.8 28.2 26 26 26 C 23.8 26 22 27.8 22 30 C 22 32.2 23.8 34 26 34 Z M 38 40 C 36.9 40 36 40.9 36 42 V 48 C 36 49.1 36.9 50 38 50 H 50 C 51.1 50 52 49.1 52 48 V 42 C 52 40.9 51.1 40 50 40 H 38 Z"/></svg><span class="word">Slide<span>take</span></span> Studio</h2>
|
|
2204
|
-
<
|
|
2205
|
-
<
|
|
2206
|
-
<div
|
|
2207
|
-
<
|
|
2208
|
-
|
|
2209
|
-
|
|
2210
|
-
|
|
2211
|
-
|
|
2212
|
-
|
|
2213
|
-
|
|
2214
|
-
<div class="rv-obs-fields">
|
|
2215
|
-
<input type="text" id="obs-host" value="localhost" spellcheck="false" aria-label="Host" title="Host">
|
|
2216
|
-
<input type="text" id="obs-port" value="4455" inputmode="numeric" aria-label="Port" title="Port">
|
|
2217
|
-
<input type="password" id="obs-pass" autocomplete="off" placeholder="Password" aria-label="Password">
|
|
2218
|
-
</div>
|
|
2219
|
-
<div class="rv-setup-row">
|
|
2220
|
-
<button class="btn small" id="obs-connect">Connect</button>
|
|
2221
|
-
<label class="check rv-setup-label"><input type="checkbox" id="obs-remember"> Remember</label>
|
|
2222
|
-
<span class="rv-setup-gap"></span>
|
|
2223
|
-
<span id="obs-status">Not connected</span>
|
|
2224
|
-
</div>
|
|
2225
|
-
<p class="rv-setup-note" id="obs-detail" hidden></p>
|
|
2226
|
-
<p class="rv-setup-note">In OBS: Tools \u2192 WebSocket Server Settings \u2192 enable it (the port and password are there). Point OBS at this browser window plus your microphone; no scenes needed.</p>
|
|
2227
|
-
</section>
|
|
2228
|
-
<section>
|
|
2229
|
-
<h4>Camera</h4>
|
|
2230
|
-
<select id="rec-cam" aria-label="Camera"></select>
|
|
2231
|
-
<p class="rv-setup-note">Turns on by itself when recording starts. Choose No camera for slides only.</p>
|
|
2232
|
-
</section>
|
|
2233
|
-
<section class="for-browser">
|
|
2234
|
-
<h4>Microphone</h4>
|
|
2235
|
-
<select id="rec-mic" aria-label="Microphone"></select>
|
|
2236
|
-
<meter id="rec-meter" min="0" max="1" low="0.1" high="0.8" optimum="0.5" value="0" aria-label="Mic level"></meter>
|
|
2237
|
-
<div class="rv-setup-row">
|
|
2238
|
-
<span class="rv-setup-label">Sound</span>
|
|
2239
|
-
<div class="seg small" role="radiogroup" aria-label="Sound">
|
|
2240
|
-
<button class="seg-btn" data-sound="raw" role="radio" title="No processing: best for a good mic in a quiet room">Raw</button>
|
|
2241
|
-
<button class="seg-btn" data-sound="voice" role="radio" title="Chrome's noise suppression: takes out fans, hum and other steady noise">Voice</button>
|
|
2243
|
+
<h2 id="rv-title" class="rv-brand"><svg class="logo" viewBox="0 0 64 64" aria-hidden="true"><path d="M 10 8 H 38 C 41.3 8 44 10.7 44 14 V 18 H 22 C 16.5 18 12 22.5 12 28 V 36 H 10 C 6.7 36 4 33.3 4 30 V 14 C 4 10.7 6.7 8 10 8 Z" opacity="0.4"/><path fill-rule="evenodd" d="M 22 22 H 54 C 57.3 22 60 24.7 60 28 V 50 C 60 53.3 57.3 56 54 56 H 22 C 18.7 56 16 53.3 16 50 V 28 C 16 24.7 18.7 22 22 22 Z M 26 34 C 28.2 34 30 32.2 30 30 C 30 27.8 28.2 26 26 26 C 23.8 26 22 27.8 22 30 C 22 32.2 23.8 34 26 34 Z M 38 40 C 36.9 40 36 40.9 36 42 V 48 C 36 49.1 36.9 50 38 50 H 50 C 51.1 50 52 49.1 52 48 V 42 C 52 40.9 51.1 40 50 40 H 38 Z"/></svg><span class="word">Slide<span>take</span></span> Studio<span class="rv-pro-tag for-obs">Pro</span><span class="rv-settings-tag"> / Settings</span><span class="rv-size" id="rv-size"></span></h2>
|
|
2244
|
+
<div id="rv-setup-view">
|
|
2245
|
+
<p class="setup-note" id="setup-note" hidden></p>
|
|
2246
|
+
<div id="rv-setup">
|
|
2247
|
+
<div class="rv-setup-cols">
|
|
2248
|
+
<section class="for-obs">
|
|
2249
|
+
<h4>OBS</h4>
|
|
2250
|
+
<div class="rv-obs-fields">
|
|
2251
|
+
<input type="text" id="obs-host" value="localhost" spellcheck="false" aria-label="Host" title="Host">
|
|
2252
|
+
<input type="text" id="obs-port" value="4455" inputmode="numeric" aria-label="Port" title="Port">
|
|
2253
|
+
<input type="password" id="obs-pass" autocomplete="off" placeholder="Password" aria-label="Password">
|
|
2242
2254
|
</div>
|
|
2243
|
-
<
|
|
2244
|
-
|
|
2245
|
-
|
|
2246
|
-
|
|
2247
|
-
|
|
2248
|
-
|
|
2249
|
-
|
|
2250
|
-
|
|
2251
|
-
|
|
2252
|
-
|
|
2253
|
-
|
|
2254
|
-
|
|
2255
|
-
|
|
2256
|
-
<
|
|
2257
|
-
|
|
2258
|
-
|
|
2259
|
-
|
|
2260
|
-
|
|
2261
|
-
<
|
|
2262
|
-
|
|
2263
|
-
|
|
2264
|
-
<
|
|
2255
|
+
<div class="rv-setup-row">
|
|
2256
|
+
<button class="btn small" id="obs-connect">Connect</button>
|
|
2257
|
+
<label class="check rv-setup-label"><input type="checkbox" id="obs-remember"> Remember</label>
|
|
2258
|
+
<span class="rv-setup-gap"></span>
|
|
2259
|
+
<span id="obs-status">Not connected</span>
|
|
2260
|
+
</div>
|
|
2261
|
+
<p class="rv-setup-note" id="obs-detail" hidden></p>
|
|
2262
|
+
<p class="rv-setup-note">In OBS: Tools \u2192 WebSocket Server Settings \u2192 enable it (the port and password are there). Point OBS at this browser window plus your microphone; no scenes needed.</p>
|
|
2263
|
+
</section>
|
|
2264
|
+
<section>
|
|
2265
|
+
<h4>Camera</h4>
|
|
2266
|
+
<select id="rec-cam" aria-label="Camera"></select>
|
|
2267
|
+
<div class="setup-cam"><video id="rec-cam-preview" muted playsinline autoplay></video><span id="rec-cam-none">No camera</span></div>
|
|
2268
|
+
<p class="rv-setup-note">Turns on by itself when recording starts. Choose No camera for slides only.</p>
|
|
2269
|
+
</section>
|
|
2270
|
+
<section class="for-browser">
|
|
2271
|
+
<h4>Microphone</h4>
|
|
2272
|
+
<select id="rec-mic" aria-label="Microphone"></select>
|
|
2273
|
+
<meter id="rec-meter" min="0" max="1" low="0.1" high="0.8" optimum="0.5" value="0" aria-label="Mic level" hidden></meter>
|
|
2274
|
+
<canvas id="rec-wave" class="setup-wave" width="640" height="120" aria-label="What the microphone hears"></canvas>
|
|
2275
|
+
<div class="rv-setup-row">
|
|
2276
|
+
<span class="rv-setup-label">Sound</span>
|
|
2277
|
+
<div class="seg small" role="radiogroup" aria-label="Sound">
|
|
2278
|
+
<button class="seg-btn" data-sound="voice" role="radio" title="Chrome's noise suppression: takes out fans, hum and other steady noise (the default)">Voice</button>
|
|
2279
|
+
<button class="seg-btn" data-sound="raw" role="radio" title="No processing: best for a good mic in a quiet room">Raw</button>
|
|
2280
|
+
</div>
|
|
2281
|
+
<span class="rv-setup-gap"></span>
|
|
2282
|
+
<button class="btn small toggle rv-loud" id="rv-loud" aria-pressed="true" title="Raises the video towards YouTube's volume (-14 LUFS), stopping before the loudest peak would clip"><span class="ico" aria-hidden="true">\u{1F50A}</span> Volume boost</button>
|
|
2283
|
+
<button class="btn small toggle" id="rv-limiter" aria-pressed="false" title="Catches the few peaks (a click, a plosive) that would pass -1.5 dB, so Volume boost can reach -14 LUFS">Peak limiter</button>
|
|
2284
|
+
</div>
|
|
2285
|
+
</section>
|
|
2286
|
+
<section class="for-browser">
|
|
2287
|
+
<h4>Video</h4>
|
|
2288
|
+
<select id="rec-quality" aria-label="Quality"></select>
|
|
2289
|
+
<p class="rv-setup-note" id="rec-browser-check"></p>
|
|
2290
|
+
</section>
|
|
2291
|
+
<section class="for-obs">
|
|
2292
|
+
<h4>Video</h4>
|
|
2293
|
+
<select id="rv-mode" aria-label="How ffmpeg cuts">
|
|
2294
|
+
<option value="accurate">Frame-accurate (x264)</option>
|
|
2295
|
+
<option value="mac">Frame-accurate, Mac hardware encoder (faster)</option>
|
|
2296
|
+
<option value="copy">No re-encode (only when nothing is cut out)</option>
|
|
2265
2297
|
</select>
|
|
2266
|
-
<
|
|
2267
|
-
|
|
2298
|
+
<div class="rv-setup-row">
|
|
2299
|
+
<select id="rv-fps" aria-label="Frame rate" title="Recording frame rate: cut points snap to its frames">
|
|
2300
|
+
<option value="24">24 fps</option><option value="25">25 fps</option><option value="30">30 fps</option>
|
|
2301
|
+
<option value="50">50 fps</option><option value="60">60 fps</option>
|
|
2302
|
+
<option value="23.976">23.976 fps</option><option value="29.97">29.97 fps</option><option value="59.94">59.94 fps</option>
|
|
2303
|
+
</select>
|
|
2304
|
+
<span class="rv-setup-gap"></span>
|
|
2305
|
+
<button class="btn small toggle rv-loud" id="rv-loud-obs" aria-pressed="true" title="Adds loudnorm to the ffmpeg command: YouTube's volume (-14 LUFS), peaks held below -1 dB"><span class="ico" aria-hidden="true">\u{1F50A}</span> Volume boost</button>
|
|
2306
|
+
</div>
|
|
2307
|
+
<p class="rv-setup-note" id="rec-screen"></p>
|
|
2308
|
+
</section>
|
|
2309
|
+
</div>
|
|
2310
|
+
<div class="rv-setup-foot for-browser">
|
|
2311
|
+
<span class="rv-setup-note for-browser">When Chrome asks, share <strong>this tab</strong>: only the slides and your camera are recorded, in a 16:9 frame.</span>
|
|
2312
|
+
<div class="rv-setup-row rv-files for-browser">
|
|
2313
|
+
<span class="rv-setup-label">Files</span>
|
|
2314
|
+
<button class="btn small" id="rv-folder-change" title="Where Download saves videos">Download folder\u2026</button>
|
|
2315
|
+
<details class="rv-purge">
|
|
2316
|
+
<summary class="btn small" title="Delete takes from this browser">\u{1F5D1} Purge takes</summary>
|
|
2317
|
+
<div class="rv-menu"><button class="btn small" id="rv-clean-unused">Unused takes</button><button class="btn small" id="rv-clean">All takes</button><button class="btn small" id="rv-clean-every" title="Every take Slidetake keeps in this browser, of every deck">Every deck's takes\u2026</button></div>
|
|
2318
|
+
</details>
|
|
2268
2319
|
</div>
|
|
2269
|
-
<p class="rv-setup-note" id="rec-screen"></p>
|
|
2270
|
-
</section>
|
|
2271
|
-
</div>
|
|
2272
|
-
<div class="rv-setup-foot">
|
|
2273
|
-
<label class="rv-setup-label">Layout
|
|
2274
|
-
<select id="rec-layout">
|
|
2275
|
-
<option value="path">Path: short, one-direction moves</option>
|
|
2276
|
-
<option value="focus">Focus: no travel, slides fade in</option>
|
|
2277
|
-
<option value="current">Keep the current layout</option>
|
|
2278
|
-
</select>
|
|
2279
|
-
</label>
|
|
2280
|
-
<span class="rv-setup-note">During a take: \u2192 next \xB7 \u2190 take this slide again \xB7 B pause \xB7 Esc stop</span>
|
|
2281
|
-
<div class="rv-setup-row rv-files for-browser">
|
|
2282
|
-
<span class="rv-setup-label">Files</span>
|
|
2283
|
-
<button class="btn small" id="rv-folder-change" title="Where Download saves videos">Download folder\u2026</button>
|
|
2284
|
-
<details class="rv-purge">
|
|
2285
|
-
<summary class="btn small" title="Delete takes from this browser">\u{1F5D1} Purge takes</summary>
|
|
2286
|
-
<div class="rv-menu"><button class="btn small" id="rv-clean-unused">Unused takes</button><button class="btn small" id="rv-clean">All takes</button><button class="btn small" id="rv-clean-every" title="Every take Slidetake keeps in this browser, of every deck">Every deck's takes\u2026</button></div>
|
|
2287
|
-
</details>
|
|
2288
2320
|
</div>
|
|
2289
2321
|
</div>
|
|
2290
|
-
<
|
|
2291
|
-
|
|
2322
|
+
<div class="setup-actions">
|
|
2323
|
+
<button class="btn rec" id="setup-record" title="Start recording (R)"><span class="rec-dot" aria-hidden="true">\u25CF</span> <span><u class="key">R</u>ecord</span></button>
|
|
2324
|
+
</div>
|
|
2325
|
+
</div>
|
|
2292
2326
|
<div class="rv-grid">
|
|
2293
2327
|
<div>
|
|
2294
2328
|
<div class="rv-video">
|
|
@@ -2302,17 +2336,17 @@ EOF
|
|
|
2302
2336
|
</div>
|
|
2303
2337
|
</div>
|
|
2304
2338
|
<div class="rv-bar">
|
|
2305
|
-
<button class="btn rec" id="rv-rec" title="Records the whole deck, or only the ticked slides (shift-click ticks a range)">\u25CF
|
|
2339
|
+
<button class="btn rec" id="rv-rec" title="Records the whole deck, or only the ticked slides (shift-click ticks a range) (R)"><span class="rec-dot" aria-hidden="true">\u25CF</span> <span><u class="key">R</u>ecord</span></button>
|
|
2306
2340
|
<span id="rv-now"></span>
|
|
2307
|
-
<button class="btn rv-preview" id="rv-play-final" title="Plays the picked takes back to back">\u25B6
|
|
2341
|
+
<button class="btn rv-preview" id="rv-play-final" title="Plays the picked takes back to back (P)">\u25B6 <span><u class="key">P</u>review</span></button>
|
|
2308
2342
|
</div>
|
|
2309
2343
|
</div>
|
|
2310
2344
|
<div class="rv-list" id="rv-list"></div>
|
|
2311
2345
|
<div class="rv-dl">
|
|
2312
2346
|
<button class="btn" id="rv-chapters" title="Copies the chapters, to paste into the YouTube description">\u29C9 Chapters</button>
|
|
2313
2347
|
<span class="rv-final" id="rv-final"></span>
|
|
2314
|
-
<button class="btn for-browser" id="rv-render-btn" title="Saves the video: the picked takes joined into one file">\u2193
|
|
2315
|
-
<button class="btn for-obs" id="rv-ffmpeg-copy" title="Copies the ffmpeg command that cuts the picked takes from the OBS file">\u29C9 ffmpeg</button>
|
|
2348
|
+
<button class="btn for-browser" id="rv-render-btn" title="Saves the video: the picked takes joined into one file (D)">\u2193 <span><u class="key">D</u>ownload</span></button>
|
|
2349
|
+
<button class="btn for-obs" id="rv-ffmpeg-copy" title="Copies the ffmpeg command that cuts the picked takes from the OBS file (D)">\u29C9 ffmpeg</button>
|
|
2316
2350
|
</div>
|
|
2317
2351
|
</div>
|
|
2318
2352
|
</div>
|
|
@@ -2323,5 +2357,5 @@ EOF
|
|
|
2323
2357
|
<div id="rec-paused">Paused \xB7 press B to resume</div>
|
|
2324
2358
|
|
|
2325
2359
|
<!-- The sample deck. Plain markdown, nothing else. -->
|
|
2326
|
-
`;var
|
|
2327
|
-
<link href="https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@500;600;700&family=IBM+Plex+Mono:wght@400;500;600&family=IBM+Plex+Sans:wght@400;500;600&display=swap" rel="stylesheet">`;var
|
|
2360
|
+
`;var Or=`<link rel="preconnect" href="https://fonts.googleapis.com">
|
|
2361
|
+
<link href="https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@500;600;700&family=IBM+Plex+Mono:wght@400;500;600&family=IBM+Plex+Sans:wght@400;500;600&display=swap" rel="stylesheet">`;var fs=e=>new Promise((t,a)=>{let o=document.createElement("script");o.src=e,o.onload=t,o.onerror=()=>a(new Error("could not load "+e)),document.head.appendChild(o)});async function ms(){document.head.insertAdjacentHTML("beforeend",Or);let e=document.createElement("style");e.textContent=Ar,document.head.appendChild(e),document.body.insertAdjacentHTML("afterbegin",Br),await Promise.all([window.gsap?null:fs("https://cdnjs.cloudflare.com/ajax/libs/gsap/3.12.5/gsap.min.js"),window.marked?null:fs("https://cdnjs.cloudflare.com/ajax/libs/marked/12.0.2/marked.min.js")]),await Promise.resolve().then(()=>(us(),Yc))}document.readyState==="loading"?document.addEventListener("DOMContentLoaded",ms,{once:!0}):ms();})();
|